[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing)
[kernel] Parsing tests/aorai/test_recursion2.c (with preprocessing)
tests/aorai/test_recursion2.c:29:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead.
tests/aorai/test_recursion2.c:38:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead.
tests/aorai/test_recursion2.c:39:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead.
tests/aorai/test_recursion2.c:40:[kernel] warning: parsing obsolete ACSL construct '\valid_range(addr,min,max)'. '\valid(addr+(min..max))' should be used instead.
tests/aorai/test_recursion2.c:59:[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_recursion20.i (no preprocessing)
/* Generated by Frama-C */
enum aorai_ListOper {
    op_count = 2,
    op_main = 1,
    op_sumOne = 0
};
enum aorai_OpStatusList {
    aorai_Terminated = 1,
    aorai_Called = 0
};
/*@
axiomatic string_len {
  logic ℤ string_len{L}(char *s) ;
  
  axiom strlen0{L}: ∀ char *s; \valid{L}(s) ⇒ string_len{L}(s) ≥ 0;
  
  axiom strlen1{L}:
    ∀ char *s;
      \valid{L}(s) ∧ *(s+0) ≡ '\000' ⇒ string_len{L}(s) ≡ 0;
  
  axiom strlen2{L}:
    ∀ char *s; \valid{L}(s) ⇒ *(s+string_len{L}(s)) ≡ '\000';
  
  axiom strlen3{L}:
    ∀ char *s;
      \valid{L}(s) ∧ *(s+0) ≢ '\000' ⇒
      string_len{L}(s) ≡ 1+string_len{L}(s+1) ∧ \valid{L}(s+1);
  
  axiom strlen4{L}:
    ∀ char *s;
      \valid{L}(s) ⇒
      (∀ ℤ i; 0 ≤ i < string_len{L}(s) ⇒ *(s+i) ≢ '\000');
  
  }
 */
/*@
predicate valid_string{L}(char *s) =
  \valid{L}(s) ∧ \valid{L}(s+(0 .. string_len{L}(s)));
 */
/*@
axiomatic sum_tab {
  logic ℤ sum_tab{L}(char *t, ℤ l, ℤ i) ;
  
  axiom sum_tab0{L}:
    ∀ char *t, ℤ l;
      \valid{L}(t+(0 .. l)) ⇒ sum_tab{L}(t, l, 0) ≡ *(t+0);
  
  axiom sum_tabi{L}:
    ∀ char *t, ℤ l, ℤ i;
      \valid{L}(t+(0 .. l)) ∧ 0 < i ≤ l ⇒
      sum_tab{L}(t, l, i) ≡ sum_tab{L}(t, l, i-1)+*(t+i);
  
  axiom sum_tabn{L}:
    ∀ char *t, ℤ l;
      \valid{L}(t+(0 .. l)) ∧ l > 0 ∧ l ≡ string_len{L}(t) ⇒
      sum_tab{L}(t, l, l) ≡ sum_tab{L}(t, l, l-1);
  
  }
 */
int global_argc = 0;
/*@ ghost enum aorai_ListOper aorai_CurOperation = op_main; */
/*@ ghost enum aorai_OpStatusList aorai_CurOpStatus = aorai_Called; */
/*@ ghost int S1 = 0; */
/*@ ghost int T0_init = 1; */
/*@ ghost int T1 = 0; */
/*@ ghost int accept_T2 = 0; */
/*@ ensures aorai_CurOpStatus ≡ aorai_Called;
    ensures aorai_CurOperation ≡ op_count;
    assigns aorai_CurOpStatus, aorai_CurOperation, S1, T0_init, T1,
            accept_T2;
    
    behavior buch_state_S1_in:
      assumes (1 ≡ T1 ∧ global_argc > 0) ∨ 1 ≡ S1;
      ensures 1 ≡ S1;
    
    behavior buch_state_S1_out:
      assumes (0 ≡ T1 ∨ ¬(global_argc > 0)) ∧ 0 ≡ S1;
      ensures 0 ≡ S1;
    
    behavior buch_state_T0_init_out:
      ensures 0 ≡ T0_init;
    
    behavior buch_state_T1_out:
      ensures 0 ≡ T1;
    
    behavior buch_state_accept_T2_out:
      ensures 0 ≡ accept_T2;
 */
extern void count_pre_func(char *argv);

/*@ requires 1 ≡ S1 ∧ 0 ≡ T0_init ∧ 0 ≡ T1 ∧ 0 ≡ accept_T2;
    ensures aorai_CurOpStatus ≡ aorai_Terminated;
    ensures aorai_CurOperation ≡ op_count;
    assigns aorai_CurOpStatus, aorai_CurOperation, S1, T0_init, T1,
            accept_T2;
    
    behavior buch_state_S1_in:
      assumes 1 ≡ S1;
      ensures 1 ≡ S1;
    
    behavior buch_state_S1_out:
      assumes 0 ≡ S1;
      ensures 0 ≡ S1;
    
    behavior buch_state_T0_init_out:
      ensures 0 ≡ T0_init;
    
    behavior buch_state_T1_out:
      ensures 0 ≡ T1;
    
    behavior buch_state_accept_T2_out:
      ensures 0 ≡ accept_T2;
 */
extern void count_post_func(int res);

/*@ requires (1 ≡ S1 ∨ 1 ≡ T1) ∧ 0 ≡ T0_init ∧ 0 ≡ accept_T2;
    requires 1 ≡ T1 ⇒ global_argc > 0;
    requires 1 ≡ T1 ∨ 0 ≡ T1;
    requires 1 ≡ S1 ∨ 0 ≡ S1;
    requires valid_string(argv);
    ensures \result ≡ string_len(\old(argv));
    
    behavior Buchi_property_behavior:
      ensures 0 ≡ T0_init ∧ 0 ≡ T1 ∧ 0 ≡ accept_T2;
      ensures 1 ≡ S1;
 */
int count(char *argv)
{
  int __retres;
  int tmp;
  count_pre_func(argv);
  if ((int)*(argv + 0) == 0) {
    __retres = 0;
    goto return_label;
  }
  tmp = count(argv + 1);
  __retres = 1 + tmp;
  return_label: count_post_func(__retres);
  return __retres;
}

/*@ ensures aorai_CurOpStatus ≡ aorai_Called;
    ensures aorai_CurOperation ≡ op_sumOne;
    assigns aorai_CurOpStatus, aorai_CurOperation, S1, T0_init, T1,
            accept_T2;
    
    behavior buch_state_S1_out:
      ensures 0 ≡ S1;
    
    behavior buch_state_T0_init_out:
      ensures 0 ≡ T0_init;
    
    behavior buch_state_T1_in:
      assumes 1 ≡ S1;
      ensures 1 ≡ T1;
    
    behavior buch_state_T1_out:
      assumes 0 ≡ S1;
      ensures 0 ≡ T1;
    
    behavior buch_state_accept_T2_out:
      ensures 0 ≡ accept_T2;
 */
extern void sumOne_pre_func(char *t, int length);

/*@ requires 1 ≡ T1 ∧ 0 ≡ S1 ∧ 0 ≡ T0_init ∧ 0 ≡ accept_T2;
    ensures aorai_CurOpStatus ≡ aorai_Terminated;
    ensures aorai_CurOperation ≡ op_sumOne;
    assigns aorai_CurOpStatus, aorai_CurOperation, S1, T0_init, T1,
            accept_T2;
    
    behavior buch_state_S1_out:
      ensures 0 ≡ S1;
    
    behavior buch_state_T0_init_out:
      ensures 0 ≡ T0_init;
    
    behavior buch_state_T1_in:
      assumes 1 ≡ T1;
      ensures 1 ≡ T1;
    
    behavior buch_state_T1_out:
      assumes 0 ≡ T1;
      ensures 0 ≡ T1;
    
    behavior buch_state_accept_T2_out:
      ensures 0 ≡ accept_T2;
 */
extern void sumOne_post_func(int res);

/*@ requires 1 ≡ S1 ∧ 0 ≡ T0_init ∧ 0 ≡ T1 ∧ 0 ≡ accept_T2;
    requires
      \valid(t) ∧ length ≥ 0 ∧ length ≡ string_len(t) ∧
      \valid(t+(0 .. length));
    ensures \result ≡ sum_tab(\old(t), \old(length), \old(length));
    
    behavior Buchi_property_behavior:
      ensures 0 ≡ S1 ∧ 0 ≡ T0_init ∧ 0 ≡ accept_T2;
      ensures 1 ≡ T1;
 */
int sumOne(char *t, int length)
{
  int aorai_Loop_Init_42;
  int sum;
  int i;
  sumOne_pre_func(t,length);
  sum = 0;
  i = 0;
  i = 0;
  /*@ ghost aorai_Loop_Init_42 = 1; */
  aorai_loop_42:
    /*@ loop invariant ranges: 0 ≤ i ≤ length;
        loop invariant sumValue0: i ≡ 0 ⇒ sum ≡ 0;
        loop invariant sumValuei: i > 0 ⇒ sum ≡ sum_tab(t, length, i-1);
        loop invariant Aorai: 0 ≡ S1;
        loop invariant Aorai: 0 ≡ T0_init;
        loop invariant Aorai: 1 ≡ T1;
        loop invariant Aorai: 0 ≡ accept_T2;
    */
    while (1) {
      if (! (i < length)) goto while_0_break;
      /*@ ghost aorai_Loop_Init_42 = 0; */
      sum += (int)*(t + i);
      i ++;
    }
  while_0_break: ;
  sumOne_post_func(sum);
  return sum;
}

/*@ ensures aorai_CurOpStatus ≡ aorai_Called;
    ensures aorai_CurOperation ≡ op_main;
    assigns aorai_CurOpStatus, aorai_CurOperation, S1, T0_init, T1,
            accept_T2;
    
    behavior buch_state_S1_out:
      ensures 0 ≡ S1;
    
    behavior buch_state_T0_init_out:
      ensures 0 ≡ T0_init;
    
    behavior buch_state_T1_in:
      assumes 1 ≡ T0_init;
      ensures 1 ≡ T1;
    
    behavior buch_state_T1_out:
      assumes 0 ≡ T0_init;
      ensures 0 ≡ T1;
    
    behavior buch_state_accept_T2_out:
      ensures 0 ≡ accept_T2;
 */
extern void main_pre_func(int argc, char **argv);

/*@ requires 1 ≡ T1 ∧ 0 ≡ S1 ∧ 0 ≡ T0_init ∧ 0 ≡ accept_T2;
    ensures aorai_CurOpStatus ≡ aorai_Terminated;
    ensures aorai_CurOperation ≡ op_main;
    assigns aorai_CurOpStatus, aorai_CurOperation, S1, T0_init, T1,
            accept_T2;
    
    behavior buch_state_S1_out:
      ensures 0 ≡ S1;
    
    behavior buch_state_T0_init_out:
      ensures 0 ≡ T0_init;
    
    behavior buch_state_T1_in:
      assumes 1 ≡ T1;
      ensures 1 ≡ T1;
    
    behavior buch_state_T1_out:
      assumes 0 ≡ T1;
      ensures 0 ≡ T1;
    
    behavior buch_state_accept_T2_in:
      assumes 1 ≡ T1;
      ensures 1 ≡ accept_T2;
    
    behavior buch_state_accept_T2_out:
      assumes 0 ≡ T1;
      ensures 0 ≡ accept_T2;
 */
extern void main_post_func(int res);

/*@ requires 1 ≡ T0_init ∧ 0 ≡ S1 ∧ 0 ≡ T1 ∧ 0 ≡ accept_T2;
    requires
      argc ≥ 0 ∧ (argc > 0 ⇒ \valid(argv) ∧ valid_string(*(argv+0)));
    ensures \result ≡ 1;
    
    behavior aorai_acceptance:
      ensures 1 ≡ accept_T2;
    
    behavior Buchi_property_behavior:
      ensures 1 ≡ T1 ∨ 0 ≡ T1;
      ensures 1 ≡ accept_T2 ∨ 0 ≡ accept_T2;
      ensures 0 ≡ S1 ∧ 0 ≡ T0_init;
      ensures 1 ≡ T1 ∨ 1 ≡ accept_T2;
 */
int main(int argc, char **argv)
{
  int __retres;
  int sum;
  int length;
  main_pre_func(argc,argv);
  sum = 0;
  global_argc = argc;
  if (argc > 0) {
    length = count(*(argv + 0));
    sum = sumOne(*(argv + 0),length);
  }
  __retres = 1;
  main_post_func(__retres);
  return __retres;
}


