[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing)
[kernel] Parsing tests/aorai/test_recursion5.c (with preprocessing)
tests/aorai/test_recursion5.c:13:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead.
tests/aorai/test_recursion5.c:29:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead.
[aorai] Welcome to the Aorai plugin
[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing)
[kernel] Parsing /tmp/aorai_test_recursion50.i (no preprocessing)
/* Generated by Frama-C */
enum aorai_ListOper {
    op_foo = 3,
    op_isPresent = 2,
    op_isPresentRec = 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 End = 0; */
/*@ ghost int Idle = 1; */
/*@ ghost int IgnoreFoo = 0; */
/*@ ghost int WillDoFoo = 0; */
/*@ ensures aorai_CurOpStatus ≡ aorai_Called;
    ensures aorai_CurOperation ≡ op_isPresentRec;
    assigns aorai_CurOpStatus, aorai_CurOperation, End, Idle, IgnoreFoo,
            WillDoFoo;
    
    behavior buch_state_End_out:
      ensures 0 ≡ End;
    
    behavior buch_state_Idle_in:
      assumes 1 ≡ Idle;
      ensures 1 ≡ Idle;
    
    behavior buch_state_Idle_out:
      assumes 0 ≡ Idle;
      ensures 0 ≡ Idle;
    
    behavior buch_state_IgnoreFoo_out:
      ensures 0 ≡ IgnoreFoo;
    
    behavior buch_state_WillDoFoo_out:
      ensures 0 ≡ WillDoFoo;
 */
extern void isPresentRec_pre_func(int *t, int i, int max, int val);

/*@ requires
      (1 ≡ Idle ∨ 1 ≡ IgnoreFoo ∨ 1 ≡ WillDoFoo) ∧ 0 ≡ End;
    requires 1 ≡ Idle ⇒ res ≢ -1 ∨ res ≡ -1;
    requires 1 ≡ IgnoreFoo ⇒ res ≢ -1;
    requires 1 ≡ WillDoFoo ⇒ res ≡ -1;
    ensures aorai_CurOpStatus ≡ aorai_Terminated;
    ensures aorai_CurOperation ≡ op_isPresentRec;
    assigns aorai_CurOpStatus, aorai_CurOperation, End, Idle, IgnoreFoo,
            WillDoFoo;
    
    behavior buch_state_End_out:
      ensures 0 ≡ End;
    
    behavior buch_state_Idle_out:
      ensures 0 ≡ Idle;
    
    behavior buch_state_IgnoreFoo_in:
      assumes
        (1 ≡ IgnoreFoo ∧ res ≢ -1) ∨ (1 ≡ Idle ∧ res ≢ -1);
      ensures 1 ≡ IgnoreFoo;
    
    behavior buch_state_IgnoreFoo_out:
      assumes
        (0 ≡ IgnoreFoo ∨ ¬(res ≢ -1)) ∧
        (0 ≡ Idle ∨ ¬(res ≢ -1));
      ensures 0 ≡ IgnoreFoo;
    
    behavior buch_state_WillDoFoo_in:
      assumes
        (1 ≡ WillDoFoo ∧ res ≡ -1) ∨ (1 ≡ Idle ∧ res ≡ -1);
      ensures 1 ≡ WillDoFoo;
    
    behavior buch_state_WillDoFoo_out:
      assumes
        (0 ≡ WillDoFoo ∨ ¬(res ≡ -1)) ∧
        (0 ≡ Idle ∨ ¬(res ≡ -1));
      ensures 0 ≡ WillDoFoo;
 */
extern void isPresentRec_post_func(int res);

/*@ requires
      1 ≡ Idle ∧ 0 ≡ End ∧ 0 ≡ IgnoreFoo ∧ 0 ≡ WillDoFoo;
    requires \valid(t+(0 .. max));
    requires max ≥ 0;
    requires 0 ≤ i ≤ max;
    decreases max-i;
    ensures (\old(i) ≤ \result ≤ \old(max)) ∨ \result ≡ -1;
    ensures
      \old(i) ≤ \result ≤ \old(max) ⇒ *(\old(t)+\result) ≡ \old(val);
    ensures
      \result ≡ -1 ⇒
      (∀ ℤ j; \old(i) ≤ j ≤ \old(max) ⇒ *(\old(t)+j) ≢ \old(val));
    
    behavior Buchi_property_behavior:
      ensures
        (1 ≡ IgnoreFoo ⇒ \result ≢ -1) ∧
        (1 ≡ WillDoFoo ⇒ \result ≡ -1);
      ensures 1 ≡ IgnoreFoo ∨ 0 ≡ IgnoreFoo;
      ensures 1 ≡ WillDoFoo ∨ 0 ≡ WillDoFoo;
      ensures 0 ≡ End ∧ 0 ≡ Idle;
      ensures 1 ≡ IgnoreFoo ∨ 1 ≡ WillDoFoo;
 */
int isPresentRec(int *t, int i, int max, int val)
{
  int __retres;
  int tmp;
  isPresentRec_pre_func(t,i,max,val);
  if (*(t + i) == val) {
    __retres = i;
    goto return_label;
  }
  if (max == i) {
    __retres = -1;
    goto return_label;
  }
  tmp = isPresentRec(t,i + 1,max,val);
  __retres = tmp;
  return_label: isPresentRec_post_func(__retres);
  return __retres;
}

/*@ ensures aorai_CurOpStatus ≡ aorai_Called;
    ensures aorai_CurOperation ≡ op_isPresent;
    assigns aorai_CurOpStatus, aorai_CurOperation, End, Idle, IgnoreFoo,
            WillDoFoo;
    
    behavior buch_state_End_out:
      ensures 0 ≡ End;
    
    behavior buch_state_Idle_in:
      assumes 1 ≡ Idle;
      ensures 1 ≡ Idle;
    
    behavior buch_state_Idle_out:
      assumes 0 ≡ Idle;
      ensures 0 ≡ Idle;
    
    behavior buch_state_IgnoreFoo_out:
      ensures 0 ≡ IgnoreFoo;
    
    behavior buch_state_WillDoFoo_out:
      ensures 0 ≡ WillDoFoo;
 */
extern void isPresent_pre_func(int *t, int max, int val);

/*@ requires
      (1 ≡ IgnoreFoo ∨ 1 ≡ WillDoFoo) ∧ 0 ≡ End ∧ 0 ≡ Idle;
    requires 1 ≡ IgnoreFoo ⇒ res ≢ -1;
    requires 1 ≡ WillDoFoo ⇒ res ≡ -1;
    ensures aorai_CurOpStatus ≡ aorai_Terminated;
    ensures aorai_CurOperation ≡ op_isPresent;
    assigns aorai_CurOpStatus, aorai_CurOperation, End, Idle, IgnoreFoo,
            WillDoFoo;
    
    behavior buch_state_End_in:
      assumes 1 ≡ IgnoreFoo ∧ res ≢ -1;
      ensures 1 ≡ End;
    
    behavior buch_state_End_out:
      assumes 0 ≡ IgnoreFoo ∨ ¬(res ≢ -1);
      ensures 0 ≡ End;
    
    behavior buch_state_Idle_out:
      ensures 0 ≡ Idle;
    
    behavior buch_state_IgnoreFoo_out:
      ensures 0 ≡ IgnoreFoo;
    
    behavior buch_state_WillDoFoo_in:
      assumes 1 ≡ WillDoFoo ∧ res ≡ -1;
      ensures 1 ≡ WillDoFoo;
    
    behavior buch_state_WillDoFoo_out:
      assumes 0 ≡ WillDoFoo ∨ ¬(res ≡ -1);
      ensures 0 ≡ WillDoFoo;
 */
extern void isPresent_post_func(int res);

/*@ requires
      1 ≡ Idle ∧ 0 ≡ End ∧ 0 ≡ IgnoreFoo ∧ 0 ≡ WillDoFoo;
    requires \valid(t+(0 .. max));
    requires max ≥ 0;
    ensures (0 ≤ \result ≤ \old(max)) ∨ \result ≡ -1;
    ensures 0 ≤ \result ≤ \old(max) ⇒ *(\old(t)+\result) ≡ \old(val);
    ensures
      \result ≡ -1 ⇒
      (∀ ℤ i; 0 ≤ i ≤ \old(max) ⇒ *(\old(t)+i) ≢ \old(val));
    
    behavior Buchi_property_behavior:
      ensures
        (1 ≡ End ⇒ \result ≢ -1) ∧
        (1 ≡ WillDoFoo ⇒ \result ≡ -1);
      ensures 1 ≡ End ∨ 0 ≡ End;
      ensures 1 ≡ WillDoFoo ∨ 0 ≡ WillDoFoo;
      ensures 0 ≡ Idle ∧ 0 ≡ IgnoreFoo;
      ensures 1 ≡ End ∨ 1 ≡ WillDoFoo;
 */
int isPresent(int *t, int max, int val)
{
  int tmp;
  isPresent_pre_func(t,max,val);
  tmp = isPresentRec(t,0,max,val);
  isPresent_post_func(tmp);
  return tmp;
}

/*@ ensures aorai_CurOpStatus ≡ aorai_Called;
    ensures aorai_CurOperation ≡ op_foo;
    assigns aorai_CurOpStatus, aorai_CurOperation, End, Idle, IgnoreFoo,
            WillDoFoo;
    
    behavior buch_state_End_in:
      assumes 1 ≡ WillDoFoo;
      ensures 1 ≡ End;
    
    behavior buch_state_End_out:
      assumes 0 ≡ WillDoFoo;
      ensures 0 ≡ End;
    
    behavior buch_state_Idle_out:
      ensures 0 ≡ Idle;
    
    behavior buch_state_IgnoreFoo_out:
      ensures 0 ≡ IgnoreFoo;
    
    behavior buch_state_WillDoFoo_out:
      ensures 0 ≡ WillDoFoo;
 */
extern void foo_pre_func(void);

/*@ requires
      1 ≡ End ∧ 0 ≡ Idle ∧ 0 ≡ IgnoreFoo ∧ 0 ≡ WillDoFoo;
    ensures aorai_CurOpStatus ≡ aorai_Terminated;
    ensures aorai_CurOperation ≡ op_foo;
    assigns aorai_CurOpStatus, aorai_CurOperation, End, Idle, IgnoreFoo,
            WillDoFoo;
    
    behavior buch_state_End_in:
      assumes 1 ≡ End;
      ensures 1 ≡ End;
    
    behavior buch_state_End_out:
      assumes 0 ≡ End;
      ensures 0 ≡ End;
    
    behavior buch_state_Idle_out:
      ensures 0 ≡ Idle;
    
    behavior buch_state_IgnoreFoo_out:
      ensures 0 ≡ IgnoreFoo;
    
    behavior buch_state_WillDoFoo_out:
      ensures 0 ≡ WillDoFoo;
 */
extern void foo_post_func(void);

/*@ requires
      1 ≡ WillDoFoo ∧ 0 ≡ End ∧ 0 ≡ Idle ∧ 0 ≡ IgnoreFoo;
    
    behavior Buchi_property_behavior:
      ensures 0 ≡ Idle ∧ 0 ≡ IgnoreFoo ∧ 0 ≡ WillDoFoo;
      ensures 1 ≡ End;
 */
void foo(void)
{
  foo_pre_func();
  foo_post_func();
  return;
}

/*@ ensures aorai_CurOpStatus ≡ aorai_Called;
    ensures aorai_CurOperation ≡ op_main;
    assigns aorai_CurOpStatus, aorai_CurOperation, End, Idle, IgnoreFoo,
            WillDoFoo;
    
    behavior buch_state_End_out:
      ensures 0 ≡ End;
    
    behavior buch_state_Idle_in:
      assumes 1 ≡ Idle;
      ensures 1 ≡ Idle;
    
    behavior buch_state_Idle_out:
      assumes 0 ≡ Idle;
      ensures 0 ≡ Idle;
    
    behavior buch_state_IgnoreFoo_out:
      ensures 0 ≡ IgnoreFoo;
    
    behavior buch_state_WillDoFoo_out:
      ensures 0 ≡ WillDoFoo;
 */
extern void main_pre_func(int argc, char **argv);

/*@ requires
      1 ≡ End ∧ 0 ≡ Idle ∧ 0 ≡ IgnoreFoo ∧ 0 ≡ WillDoFoo;
    ensures aorai_CurOpStatus ≡ aorai_Terminated;
    ensures aorai_CurOperation ≡ op_main;
    assigns aorai_CurOpStatus, aorai_CurOperation, End, Idle, IgnoreFoo,
            WillDoFoo;
    
    behavior buch_state_End_in:
      assumes 1 ≡ End;
      ensures 1 ≡ End;
    
    behavior buch_state_End_out:
      assumes 0 ≡ End;
      ensures 0 ≡ End;
    
    behavior buch_state_Idle_out:
      ensures 0 ≡ Idle;
    
    behavior buch_state_IgnoreFoo_out:
      ensures 0 ≡ IgnoreFoo;
    
    behavior buch_state_WillDoFoo_out:
      ensures 0 ≡ WillDoFoo;
 */
extern void main_post_func(int res);

/*@ requires
      1 ≡ Idle ∧ 0 ≡ End ∧ 0 ≡ IgnoreFoo ∧ 0 ≡ WillDoFoo;
    
    behavior aorai_acceptance:
      ensures 1 ≡ End;
    
    behavior Buchi_property_behavior:
      ensures 0 ≡ Idle ∧ 0 ≡ IgnoreFoo ∧ 0 ≡ WillDoFoo;
      ensures 1 ≡ End;
 */
int main(int argc, char **argv)
{
  int __retres;
  int tab[4];
  int r;
  main_pre_func(argc,argv);
  tab[0] = 10;
  tab[1] = 20;
  tab[2] = 33;
  tab[3] = 15;
  r = isPresent(tab,3,33);
  if (r == -1) foo();
  __retres = 1;
  main_post_func(__retres);
  return __retres;
}


