void Pendulum_prism_task_each_pals_period(void) 
{ 
  int8_t active_side ;
  int8_t tmp ;
  int8_t side1 ;
  int8_t side2 ;

  {
  tmp = read_active_side_history((unsigned char)0);
  active_side = tmp;
  side1 = nomsg;
  side2 = nomsg;
  side1 = s1p_old;
  s1p_old = nomsg;
  side2 = s2p_old;
  s2p_old = nomsg;
  if ((int )side1 == 1) {
    active_side = (int8_t )1;
  } else
  if ((int )side2 == 1) {
    active_side = (int8_t )2;
  } else
  if ((int )side1 == 0) {
    if ((int )side2 == (int )nomsg) {
      active_side = (int8_t )1;
    } else {
      active_side = (int8_t )0;
    }
  } else {
    active_side = (int8_t )0;
  }
  write_active_side_history(active_side);
  return;
}
}
int check(void) 
{ 
  int tmp ;
  msg_t tmp___0 ;
  _Bool tmp___1 ;
  _Bool tmp___2 ;
  _Bool tmp___3 ;
  _Bool tmp___4 ;
  int8_t tmp___5 ;
  _Bool tmp___6 ;
  _Bool tmp___7 ;
  _Bool tmp___8 ;
  int8_t tmp___9 ;
  _Bool tmp___10 ;
  _Bool tmp___11 ;
  _Bool tmp___12 ;
  msg_t tmp___13 ;
  _Bool tmp___14 ;
  _Bool tmp___15 ;
  _Bool tmp___16 ;
  _Bool tmp___17 ;
  int8_t tmp___18 ;
  int8_t tmp___19 ;
  int8_t tmp___20 ;

  {
  if (! side1Failed) {
    tmp = 1;
  } else
  if (! side2Failed) {
    tmp = 1;
  } else {
    tmp = 0;
  }
  __VERIFIER_assume((_Bool )tmp);
  tmp___0 = read_manual_selection_history((unsigned char)1);
  if (! tmp___0) {
    tmp___1 = read_side1_failed_history((unsigned char)1);
    if (! tmp___1) {
      tmp___2 = read_side1_failed_history((unsigned char)0);
      if (! tmp___2) {
        tmp___3 = read_side2_failed_history((unsigned char)1);
        if (! tmp___3) {
          tmp___4 = read_side2_failed_history((unsigned char)0);
          if (! tmp___4) {
            if (! ((int )side1_written == 1)) {
              if (! ((int )side1_written == 0)) {
                return (0);
              }
            }
            if (! (! ((int )side1_written == 0))) {
              if (! ((int )side2_written == 1)) {
                return (0);
              }
            }
            if (! (! ((int )side1_written == 1))) {
              if (! ((int )side2_written == 0)) {
                return (0);
              }
            }
          }
        }
      }
    }
  }
  tmp___7 = read_side1_failed_history((unsigned char)1);
  if (tmp___7) {
    tmp___8 = read_side2_failed_history((unsigned char)1);
    if (! tmp___8) {
      tmp___5 = read_active_side_history((unsigned char)0);
      if (! ((int )tmp___5 == 2)) {
        return (0);
      }
      tmp___6 = read_side2_failed_history((unsigned char)0);
      if (! tmp___6) {
        if (! ((int )side2_written == 1)) {
          return (0);
        }
      }
    }
  }
  tmp___11 = read_side1_failed_history((unsigned char)1);
  if (! tmp___11) {
    tmp___12 = read_side2_failed_history((unsigned char)1);
    if (tmp___12) {
      tmp___9 = read_active_side_history((unsigned char)0);
      if (! ((int )tmp___9 == 1)) {
        return (0);
      }
      tmp___10 = read_side1_failed_history((unsigned char)0);
      if (! tmp___10) {
        if (! ((int )side1_written == 1)) {
          return (0);
        }
      }
    }
  }
  tmp___20 = read_active_side_history((unsigned char)2);
  if ((int )tmp___20 > -2) {
    tmp___13 = read_manual_selection_history((unsigned char)2);
    if (! tmp___13) {
      tmp___14 = read_side1_failed_history((unsigned char)2);
      tmp___15 = read_side1_failed_history((unsigned char)1);
      if ((int )tmp___14 == (int )tmp___15) {
        tmp___16 = read_side2_failed_history((unsigned char)2);
        tmp___17 = read_side2_failed_history((unsigned char)1);
        if ((int )tmp___16 == (int )tmp___17) {
          tmp___18 = read_active_side_history((unsigned char)1);
          tmp___19 = read_active_side_history((unsigned char)0);
          if (! ((int )tmp___18 == (int )tmp___19)) {
            return (0);
          }
        }
      }
    }
  }
  return (1);
}
}