[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing)
[kernel] Parsing tests/aorai/test_factorial.c (with preprocessing)
[aorai] Welcome to the Aorai plugin
[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing)
[kernel] Parsing /tmp/aorai_test_factorial0.i (no preprocessing)
/* Generated by Frama-C */
enum aorai_ListOper {
    op_decode_int = 2,
    op_factorial = 1,
    op_main = 0
};
enum aorai_OpStatusList {
    aorai_Terminated = 1,
    aorai_Called = 0
};
/*@ ghost enum aorai_ListOper aorai_CurOperation = op_main; */
/*@ ghost enum aorai_OpStatusList aorai_CurOpStatus = aorai_Called; */
/*@ ghost int accept_S1 = 0; */
/*@ ghost int accept_S2 = 0; */
/*@ ghost int accept_init = 1; */
/*@ ensures aorai_CurOpStatus ≡ aorai_Called;
    ensures aorai_CurOperation ≡ op_decode_int;
    assigns aorai_CurOpStatus, aorai_CurOperation, accept_S1, accept_S2,
            accept_init;
    
    behavior buch_state_accept_S1_in:
      assumes 1 ≡ accept_S1;
      ensures 1 ≡ accept_S1;
    
    behavior buch_state_accept_S1_out:
      assumes 0 ≡ accept_S1;
      ensures 0 ≡ accept_S1;
    
    behavior buch_state_accept_S2_out:
      ensures 0 ≡ accept_S2;
    
    behavior buch_state_accept_init_out:
      ensures 0 ≡ accept_init;
 */
extern void decode_int_pre_func(char *s);

/*@ requires 1 ≡ accept_S1 ∧ 0 ≡ accept_S2 ∧ 0 ≡ accept_init;
    ensures aorai_CurOpStatus ≡ aorai_Terminated;
    ensures aorai_CurOperation ≡ op_decode_int;
    assigns aorai_CurOpStatus, aorai_CurOperation, accept_S1, accept_S2,
            accept_init;
    
    behavior buch_state_accept_S1_in:
      assumes 1 ≡ accept_S1;
      ensures 1 ≡ accept_S1;
    
    behavior buch_state_accept_S1_out:
      assumes 0 ≡ accept_S1;
      ensures 0 ≡ accept_S1;
    
    behavior buch_state_accept_S2_in:
      assumes 1 ≡ accept_S1;
      ensures 1 ≡ accept_S2;
    
    behavior buch_state_accept_S2_out:
      assumes 0 ≡ accept_S1;
      ensures 0 ≡ accept_S2;
    
    behavior buch_state_accept_init_out:
      ensures 0 ≡ accept_init;
 */
extern void decode_int_post_func(int res);

/*@ requires 1 ≡ accept_S1 ∧ 0 ≡ accept_S2 ∧ 0 ≡ accept_init;
    
    behavior Buchi_property_behavior:
      ensures 1 ≡ accept_S1 ∨ 0 ≡ accept_S1;
      ensures 1 ≡ accept_S2 ∨ 0 ≡ accept_S2;
      ensures 0 ≡ accept_init;
      ensures 1 ≡ accept_S1 ∨ 1 ≡ accept_S2;
 */
int decode_int(char *s)
{
  int aorai_Loop_Init_81;
  int __retres;
  int intmax;
  int cutlim;
  int cutoff;
  int value;
  char c;
  decode_int_pre_func(s);
  intmax = ~ (1 << (sizeof(int) * (unsigned int)8 - (unsigned int)1));
  cutlim = intmax % 10;
  cutoff = intmax / 10;
  value = 0;
  /*@ ghost aorai_Loop_Init_81 = 1; */
  aorai_loop_81:
    /*@ loop invariant Aorai: 1 ≡ accept_S1;
        loop invariant Aorai: 0 ≡ accept_S2;
        loop invariant Aorai: 0 ≡ accept_init;
    */
    while (1) {
      {
        char *tmp;
        /*@ ghost aorai_Loop_Init_81 = 0; */
        tmp = s;
        s ++;
        c = *tmp;
        if (! c) goto while_0_break;
        {
          int v;
          v = 0;
          switch ((int)c) {
            case '0': v = 0;
            goto switch_1_break;
            case '1': v = 1;
            goto switch_1_break;
            case '2': v = 2;
            goto switch_1_break;
            case '3': v = 3;
            goto switch_1_break;
            case '4': v = 4;
            goto switch_1_break;
            case '5': v = 5;
            goto switch_1_break;
            case '6': v = 6;
            goto switch_1_break;
            case '7': v = 7;
            goto switch_1_break;
            case '8': v = 8;
            goto switch_1_break;
            case '9': v = 9;
            goto switch_1_break;
            default: ;
            __retres = -1;
            goto return_label;
          }
          switch_1_break: ;
          if (value > cutoff) {
            __retres = -1;
            goto return_label;
          }
          else 
            if (value == cutoff) 
              if (v > cutlim) {
                __retres = -1;
                goto return_label;
              }
          value = value * 10 + v;
        }
      }
    }
  while_0_break: ;
  __retres = value;
  return_label: decode_int_post_func(__retres);
  return __retres;
}

/*@ ensures aorai_CurOpStatus ≡ aorai_Called;
    ensures aorai_CurOperation ≡ op_factorial;
    assigns aorai_CurOpStatus, aorai_CurOperation, accept_S1, accept_S2,
            accept_init;
    
    behavior buch_state_accept_S1_out:
      ensures 0 ≡ accept_S1;
    
    behavior buch_state_accept_S2_in:
      assumes 1 ≡ accept_S2 ∨ 1 ≡ accept_S1;
      ensures 1 ≡ accept_S2;
    
    behavior buch_state_accept_S2_out:
      assumes 0 ≡ accept_S2 ∧ 0 ≡ accept_S1;
      ensures 0 ≡ accept_S2;
    
    behavior buch_state_accept_init_out:
      ensures 0 ≡ accept_init;
 */
extern void factorial_pre_func(int value);

/*@ requires (1 ≡ accept_S1 ∨ 1 ≡ accept_S2) ∧ 0 ≡ accept_init;
    ensures aorai_CurOpStatus ≡ aorai_Terminated;
    ensures aorai_CurOperation ≡ op_factorial;
    assigns aorai_CurOpStatus, aorai_CurOperation, accept_S1, accept_S2,
            accept_init;
    
    behavior buch_state_accept_S1_in:
      assumes 1 ≡ accept_S2 ∨ 1 ≡ accept_S1;
      ensures 1 ≡ accept_S1;
    
    behavior buch_state_accept_S1_out:
      assumes 0 ≡ accept_S2 ∧ 0 ≡ accept_S1;
      ensures 0 ≡ accept_S1;
    
    behavior buch_state_accept_S2_in:
      assumes 1 ≡ accept_S2 ∨ 1 ≡ accept_S1;
      ensures 1 ≡ accept_S2;
    
    behavior buch_state_accept_S2_out:
      assumes 0 ≡ accept_S2 ∧ 0 ≡ accept_S1;
      ensures 0 ≡ accept_S2;
    
    behavior buch_state_accept_init_out:
      ensures 0 ≡ accept_init;
 */
extern void factorial_post_func(int res);

/*@ requires (1 ≡ accept_S1 ∨ 1 ≡ accept_S2) ∧ 0 ≡ accept_init;
    requires 1 ≡ accept_S2 ∨ 0 ≡ accept_S2;
    requires 1 ≡ accept_S1 ∨ 0 ≡ accept_S1;
    requires 0 ≤ value ≤ 12;
    decreases value;
    ensures \result ≥ 1;
    
    behavior Buchi_property_behavior:
      ensures 1 ≡ accept_S1 ∨ 0 ≡ accept_S1;
      ensures 1 ≡ accept_S2 ∨ 0 ≡ accept_S2;
      ensures 0 ≡ accept_init;
      ensures 1 ≡ accept_S1 ∨ 1 ≡ accept_S2;
 */
int factorial(int value)
{
  int tmp_0;
  factorial_pre_func(value);
  if (value > 0) {
    int tmp;
    tmp = factorial(value - 1);
    tmp_0 = tmp * value;
  }
  else tmp_0 = 1;
  factorial_post_func(tmp_0);
  return tmp_0;
}

/*@ ensures aorai_CurOpStatus ≡ aorai_Called;
    ensures aorai_CurOperation ≡ op_main;
    assigns aorai_CurOpStatus, aorai_CurOperation, accept_S1, accept_S2,
            accept_init;
    
    behavior buch_state_accept_S1_in:
      assumes 1 ≡ accept_init;
      ensures 1 ≡ accept_S1;
    
    behavior buch_state_accept_S1_out:
      assumes 0 ≡ accept_init;
      ensures 0 ≡ accept_S1;
    
    behavior buch_state_accept_S2_out:
      ensures 0 ≡ accept_S2;
    
    behavior buch_state_accept_init_out:
      ensures 0 ≡ accept_init;
 */
extern void main_pre_func(int argc, char **argv);

/*@ requires 1 ≡ accept_S1 ∧ 0 ≡ accept_S2 ∧ 0 ≡ accept_init;
    ensures aorai_CurOpStatus ≡ aorai_Terminated;
    ensures aorai_CurOperation ≡ op_main;
    assigns aorai_CurOpStatus, aorai_CurOperation, accept_S1, accept_S2,
            accept_init;
    
    behavior buch_state_accept_S1_in:
      assumes 1 ≡ accept_S1;
      ensures 1 ≡ accept_S1;
    
    behavior buch_state_accept_S1_out:
      assumes 0 ≡ accept_S1;
      ensures 0 ≡ accept_S1;
    
    behavior buch_state_accept_S2_in:
      assumes 1 ≡ accept_S1;
      ensures 1 ≡ accept_S2;
    
    behavior buch_state_accept_S2_out:
      assumes 0 ≡ accept_S1;
      ensures 0 ≡ accept_S2;
    
    behavior buch_state_accept_init_out:
      ensures 0 ≡ accept_init;
 */
extern void main_post_func(int res);

/*@ requires 1 ≡ accept_init ∧ 0 ≡ accept_S1 ∧ 0 ≡ accept_S2;
    requires argc ≡ 2;
    ensures \result ≡ 0 ∨ \result ≡ 1;
    
    behavior Buchi_property_behavior:
      ensures 1 ≡ accept_S1 ∨ 0 ≡ accept_S1;
      ensures 1 ≡ accept_S2 ∨ 0 ≡ accept_S2;
      ensures 0 ≡ accept_init;
      ensures 1 ≡ accept_S1 ∨ 1 ≡ accept_S2;
 */
int main(int argc, char **argv)
{
  int __retres;
  int value;
  main_pre_func(argc,argv);
  if (argc != 2) {
    __retres = 1;
    goto return_label;
  }
  else {
    value = decode_int(*(argv + 1));
    if (value < 0) {
      __retres = 1;
      goto return_label;
    }
    else 
      if (value > 12) {
        __retres = 1;
        goto return_label;
      }
  }
  factorial(value);
  __retres = 0;
  return_label: main_post_func(__retres);
  return __retres;
}


