/* Generated by Frama-C */
#include "pthread.h"
#include "sched.h"
#include "signal.h"
#include "stddef.h"
#include "stdint.h"
#include "stdio.h"
#include "time.h"
extern  __attribute__((__FC_BUILTIN__)) int __e_acsl_sound_verdict;

void simple_loop(void)
{
  int sum = 0;
  {
    int i = 0;
    {
      int __gen_e_acsl_and;
      __e_acsl_assert_data_t __gen_e_acsl_assert_data =
        {.values = (void *)0};
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,"i",0,i);
      if (0 <= i) {
        __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,"i",0,i);
        __gen_e_acsl_and = i <= 10;
      }
      else __gen_e_acsl_and = 0;
      __gen_e_acsl_assert_data.blocking = 1;
      __gen_e_acsl_assert_data.kind = "Invariant";
      __gen_e_acsl_assert_data.pred_txt = "0 <= i <= 10";
      __gen_e_acsl_assert_data.file = "loop.i";
      __gen_e_acsl_assert_data.fct = "simple_loop";
      __gen_e_acsl_assert_data.line = 8;
      __e_acsl_assert(__gen_e_acsl_and,& __gen_e_acsl_assert_data);
      __e_acsl_assert_clean(& __gen_e_acsl_assert_data);
    }
    /*@ loop invariant 0 <= i <= 10; */
    while (i < 10) {
      sum += i;
      {
        int __gen_e_acsl_and_2;
        i ++;
        __e_acsl_assert_data_t __gen_e_acsl_assert_data_2 =
          {.values = (void *)0};
        __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_2,"i",0,i);
        if (0 <= i) {
          __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_2,"i",0,i);
          __gen_e_acsl_and_2 = i <= 10;
        }
        else __gen_e_acsl_and_2 = 0;
        __gen_e_acsl_assert_data_2.blocking = 1;
        __gen_e_acsl_assert_data_2.kind = "Invariant";
        __gen_e_acsl_assert_data_2.pred_txt = "0 <= i <= 10";
        __gen_e_acsl_assert_data_2.file = "loop.i";
        __gen_e_acsl_assert_data_2.fct = "simple_loop";
        __gen_e_acsl_assert_data_2.line = 8;
        __e_acsl_assert(__gen_e_acsl_and_2,& __gen_e_acsl_assert_data_2);
        __e_acsl_assert_clean(& __gen_e_acsl_assert_data_2);
      }
    }
  }
  return;
}

void nested_loops(void)
{
  int t[4][8];
  int i = 0;
  {
    int __gen_e_acsl_and;
    __e_acsl_assert_data_t __gen_e_acsl_assert_data = {.values = (void *)0};
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,"i",0,i);
    if (0 <= i) {
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,"i",0,i);
      __gen_e_acsl_and = i <= 4;
    }
    else __gen_e_acsl_and = 0;
    __gen_e_acsl_assert_data.blocking = 1;
    __gen_e_acsl_assert_data.kind = "Invariant";
    __gen_e_acsl_assert_data.pred_txt = "0 <= i <= 4";
    __gen_e_acsl_assert_data.file = "loop.i";
    __gen_e_acsl_assert_data.fct = "nested_loops";
    __gen_e_acsl_assert_data.line = 15;
    __e_acsl_assert(__gen_e_acsl_and,& __gen_e_acsl_assert_data);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data);
  }
  /*@ loop invariant 0 <= i <= 4; */
  while (i < 4) {
    {
      int j = 0;
      {
        int __gen_e_acsl_forall;
        int __gen_e_acsl_k;
        int __gen_e_acsl_l;
        int __gen_e_acsl_and_2;
        __e_acsl_assert_data_t __gen_e_acsl_assert_data_2 =
          {.values = (void *)0};
        __gen_e_acsl_forall = 1;
        __gen_e_acsl_k = 0;
        while (1) {
          if (__gen_e_acsl_k < i) ; else break;
          __gen_e_acsl_l = 0;
          while (1) {
            if (__gen_e_acsl_l < j) ; else break;
            {
              __e_acsl_assert_data_t __gen_e_acsl_assert_data_3 =
                {.values = (void *)0};
              __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_3,
                                           "__gen_e_acsl_l",0,__gen_e_acsl_l);
              __gen_e_acsl_assert_data_3.blocking = 1;
              __gen_e_acsl_assert_data_3.kind = "RTE";
              __gen_e_acsl_assert_data_3.pred_txt = "__gen_e_acsl_l < 8";
              __gen_e_acsl_assert_data_3.file = "loop.i";
              __gen_e_acsl_assert_data_3.fct = "nested_loops";
              __gen_e_acsl_assert_data_3.line = 19;
              __gen_e_acsl_assert_data_3.name = "index_bound";
              __e_acsl_assert(__gen_e_acsl_l < 8,
                              & __gen_e_acsl_assert_data_3);
              __e_acsl_assert_clean(& __gen_e_acsl_assert_data_3);
              __e_acsl_assert_data_t __gen_e_acsl_assert_data_4 =
                {.values = (void *)0};
              __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_4,
                                           "__gen_e_acsl_l",0,__gen_e_acsl_l);
              __gen_e_acsl_assert_data_4.blocking = 1;
              __gen_e_acsl_assert_data_4.kind = "RTE";
              __gen_e_acsl_assert_data_4.pred_txt = "0 <= __gen_e_acsl_l";
              __gen_e_acsl_assert_data_4.file = "loop.i";
              __gen_e_acsl_assert_data_4.fct = "nested_loops";
              __gen_e_acsl_assert_data_4.line = 19;
              __gen_e_acsl_assert_data_4.name = "index_bound";
              __e_acsl_assert(0 <= __gen_e_acsl_l,
                              & __gen_e_acsl_assert_data_4);
              __e_acsl_assert_clean(& __gen_e_acsl_assert_data_4);
              __e_acsl_assert_data_t __gen_e_acsl_assert_data_5 =
                {.values = (void *)0};
              __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_5,
                                           "__gen_e_acsl_k",0,__gen_e_acsl_k);
              __gen_e_acsl_assert_data_5.blocking = 1;
              __gen_e_acsl_assert_data_5.kind = "RTE";
              __gen_e_acsl_assert_data_5.pred_txt = "__gen_e_acsl_k < 4";
              __gen_e_acsl_assert_data_5.file = "loop.i";
              __gen_e_acsl_assert_data_5.fct = "nested_loops";
              __gen_e_acsl_assert_data_5.line = 19;
              __gen_e_acsl_assert_data_5.name = "index_bound";
              __e_acsl_assert(__gen_e_acsl_k < 4,
                              & __gen_e_acsl_assert_data_5);
              __e_acsl_assert_clean(& __gen_e_acsl_assert_data_5);
              __e_acsl_assert_data_t __gen_e_acsl_assert_data_6 =
                {.values = (void *)0};
              __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_6,
                                           "__gen_e_acsl_k",0,__gen_e_acsl_k);
              __gen_e_acsl_assert_data_6.blocking = 1;
              __gen_e_acsl_assert_data_6.kind = "RTE";
              __gen_e_acsl_assert_data_6.pred_txt = "0 <= __gen_e_acsl_k";
              __gen_e_acsl_assert_data_6.file = "loop.i";
              __gen_e_acsl_assert_data_6.fct = "nested_loops";
              __gen_e_acsl_assert_data_6.line = 19;
              __gen_e_acsl_assert_data_6.name = "index_bound";
              __e_acsl_assert(0 <= __gen_e_acsl_k,
                              & __gen_e_acsl_assert_data_6);
              __e_acsl_assert_clean(& __gen_e_acsl_assert_data_6);
              if ((long)t[__gen_e_acsl_k][__gen_e_acsl_l] == __gen_e_acsl_k * (long)__gen_e_acsl_l) 
                ;
              else {
                __gen_e_acsl_forall = 0;
                goto e_acsl_end_loop1;
              }
            }
            __gen_e_acsl_l ++;
          }
          __gen_e_acsl_k ++;
        }
        e_acsl_end_loop1: ;
        __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_2,
                                     "\\forall integer k, integer l; 0 <= k < i && 0 <= l < j ==> t[k][l] == k * l",
                                     0,__gen_e_acsl_forall);
        __gen_e_acsl_assert_data_2.blocking = 1;
        __gen_e_acsl_assert_data_2.kind = "Invariant";
        __gen_e_acsl_assert_data_2.pred_txt = "\\forall integer k, integer l; 0 <= k < i && 0 <= l < j ==> t[k][l] == k * l";
        __gen_e_acsl_assert_data_2.file = "loop.i";
        __gen_e_acsl_assert_data_2.fct = "nested_loops";
        __gen_e_acsl_assert_data_2.line = 19;
        __e_acsl_assert(__gen_e_acsl_forall,& __gen_e_acsl_assert_data_2);
        __e_acsl_assert_clean(& __gen_e_acsl_assert_data_2);
        __e_acsl_assert_data_t __gen_e_acsl_assert_data_7 =
          {.values = (void *)0};
        __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_7,"j",0,j);
        if (0 <= j) {
          __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_7,"j",0,j);
          __gen_e_acsl_and_2 = j <= 8;
        }
        else __gen_e_acsl_and_2 = 0;
        __gen_e_acsl_assert_data_7.blocking = 1;
        __gen_e_acsl_assert_data_7.kind = "Invariant";
        __gen_e_acsl_assert_data_7.pred_txt = "0 <= j <= 8";
        __gen_e_acsl_assert_data_7.file = "loop.i";
        __gen_e_acsl_assert_data_7.fct = "nested_loops";
        __gen_e_acsl_assert_data_7.line = 17;
        __e_acsl_assert(__gen_e_acsl_and_2,& __gen_e_acsl_assert_data_7);
        __e_acsl_assert_clean(& __gen_e_acsl_assert_data_7);
      }
      /*@ loop invariant 0 <= j <= 8;
          loop invariant
            \forall integer k, integer l;
              0 <= k < i && 0 <= l < j ==> t[k][l] == k * l;
      */
      while (j < 8) {
        t[i][j] = i * j;
        {
          int __gen_e_acsl_and_3;
          int __gen_e_acsl_forall_2;
          int __gen_e_acsl_k_2;
          int __gen_e_acsl_l_2;
          j ++;
          __e_acsl_assert_data_t __gen_e_acsl_assert_data_8 =
            {.values = (void *)0};
          __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_8,"j",0,j);
          if (0 <= j) {
            __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_8,"j",0,
                                         j);
            __gen_e_acsl_and_3 = j <= 8;
          }
          else __gen_e_acsl_and_3 = 0;
          __gen_e_acsl_assert_data_8.blocking = 1;
          __gen_e_acsl_assert_data_8.kind = "Invariant";
          __gen_e_acsl_assert_data_8.pred_txt = "0 <= j <= 8";
          __gen_e_acsl_assert_data_8.file = "loop.i";
          __gen_e_acsl_assert_data_8.fct = "nested_loops";
          __gen_e_acsl_assert_data_8.line = 17;
          __e_acsl_assert(__gen_e_acsl_and_3,& __gen_e_acsl_assert_data_8);
          __e_acsl_assert_clean(& __gen_e_acsl_assert_data_8);
          __e_acsl_assert_data_t __gen_e_acsl_assert_data_9 =
            {.values = (void *)0};
          __gen_e_acsl_forall_2 = 1;
          __gen_e_acsl_k_2 = 0;
          while (1) {
            if (__gen_e_acsl_k_2 < i) ; else break;
            __gen_e_acsl_l_2 = 0;
            while (1) {
              if (__gen_e_acsl_l_2 < j) ; else break;
              {
                __e_acsl_assert_data_t __gen_e_acsl_assert_data_10 =
                  {.values = (void *)0};
                __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_10,
                                             "__gen_e_acsl_l_2",0,
                                             __gen_e_acsl_l_2);
                __gen_e_acsl_assert_data_10.blocking = 1;
                __gen_e_acsl_assert_data_10.kind = "RTE";
                __gen_e_acsl_assert_data_10.pred_txt = "__gen_e_acsl_l_2 < 8";
                __gen_e_acsl_assert_data_10.file = "loop.i";
                __gen_e_acsl_assert_data_10.fct = "nested_loops";
                __gen_e_acsl_assert_data_10.line = 19;
                __gen_e_acsl_assert_data_10.name = "index_bound";
                __e_acsl_assert(__gen_e_acsl_l_2 < 8,
                                & __gen_e_acsl_assert_data_10);
                __e_acsl_assert_clean(& __gen_e_acsl_assert_data_10);
                __e_acsl_assert_data_t __gen_e_acsl_assert_data_11 =
                  {.values = (void *)0};
                __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_11,
                                             "__gen_e_acsl_l_2",0,
                                             __gen_e_acsl_l_2);
                __gen_e_acsl_assert_data_11.blocking = 1;
                __gen_e_acsl_assert_data_11.kind = "RTE";
                __gen_e_acsl_assert_data_11.pred_txt = "0 <= __gen_e_acsl_l_2";
                __gen_e_acsl_assert_data_11.file = "loop.i";
                __gen_e_acsl_assert_data_11.fct = "nested_loops";
                __gen_e_acsl_assert_data_11.line = 19;
                __gen_e_acsl_assert_data_11.name = "index_bound";
                __e_acsl_assert(0 <= __gen_e_acsl_l_2,
                                & __gen_e_acsl_assert_data_11);
                __e_acsl_assert_clean(& __gen_e_acsl_assert_data_11);
                __e_acsl_assert_data_t __gen_e_acsl_assert_data_12 =
                  {.values = (void *)0};
                __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_12,
                                             "__gen_e_acsl_k_2",0,
                                             __gen_e_acsl_k_2);
                __gen_e_acsl_assert_data_12.blocking = 1;
                __gen_e_acsl_assert_data_12.kind = "RTE";
                __gen_e_acsl_assert_data_12.pred_txt = "__gen_e_acsl_k_2 < 4";
                __gen_e_acsl_assert_data_12.file = "loop.i";
                __gen_e_acsl_assert_data_12.fct = "nested_loops";
                __gen_e_acsl_assert_data_12.line = 19;
                __gen_e_acsl_assert_data_12.name = "index_bound";
                __e_acsl_assert(__gen_e_acsl_k_2 < 4,
                                & __gen_e_acsl_assert_data_12);
                __e_acsl_assert_clean(& __gen_e_acsl_assert_data_12);
                __e_acsl_assert_data_t __gen_e_acsl_assert_data_13 =
                  {.values = (void *)0};
                __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_13,
                                             "__gen_e_acsl_k_2",0,
                                             __gen_e_acsl_k_2);
                __gen_e_acsl_assert_data_13.blocking = 1;
                __gen_e_acsl_assert_data_13.kind = "RTE";
                __gen_e_acsl_assert_data_13.pred_txt = "0 <= __gen_e_acsl_k_2";
                __gen_e_acsl_assert_data_13.file = "loop.i";
                __gen_e_acsl_assert_data_13.fct = "nested_loops";
                __gen_e_acsl_assert_data_13.line = 19;
                __gen_e_acsl_assert_data_13.name = "index_bound";
                __e_acsl_assert(0 <= __gen_e_acsl_k_2,
                                & __gen_e_acsl_assert_data_13);
                __e_acsl_assert_clean(& __gen_e_acsl_assert_data_13);
                if ((long)t[__gen_e_acsl_k_2][__gen_e_acsl_l_2] == __gen_e_acsl_k_2 * (long)__gen_e_acsl_l_2) 
                  ;
                else {
                  __gen_e_acsl_forall_2 = 0;
                  goto e_acsl_end_loop2;
                }
              }
              __gen_e_acsl_l_2 ++;
            }
            __gen_e_acsl_k_2 ++;
          }
          e_acsl_end_loop2: ;
          __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_9,
                                       "\\forall integer k, integer l; 0 <= k < i && 0 <= l < j ==> t[k][l] == k * l",
                                       0,__gen_e_acsl_forall_2);
          __gen_e_acsl_assert_data_9.blocking = 1;
          __gen_e_acsl_assert_data_9.kind = "Invariant";
          __gen_e_acsl_assert_data_9.pred_txt = "\\forall integer k, integer l; 0 <= k < i && 0 <= l < j ==> t[k][l] == k * l";
          __gen_e_acsl_assert_data_9.file = "loop.i";
          __gen_e_acsl_assert_data_9.fct = "nested_loops";
          __gen_e_acsl_assert_data_9.line = 19;
          __e_acsl_assert(__gen_e_acsl_forall_2,& __gen_e_acsl_assert_data_9);
          __e_acsl_assert_clean(& __gen_e_acsl_assert_data_9);
        }
      }
    }
    {
      int __gen_e_acsl_and_4;
      i ++;
      __e_acsl_assert_data_t __gen_e_acsl_assert_data_14 =
        {.values = (void *)0};
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_14,"i",0,i);
      if (0 <= i) {
        __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_14,"i",0,i);
        __gen_e_acsl_and_4 = i <= 4;
      }
      else __gen_e_acsl_and_4 = 0;
      __gen_e_acsl_assert_data_14.blocking = 1;
      __gen_e_acsl_assert_data_14.kind = "Invariant";
      __gen_e_acsl_assert_data_14.pred_txt = "0 <= i <= 4";
      __gen_e_acsl_assert_data_14.file = "loop.i";
      __gen_e_acsl_assert_data_14.fct = "nested_loops";
      __gen_e_acsl_assert_data_14.line = 15;
      __e_acsl_assert(__gen_e_acsl_and_4,& __gen_e_acsl_assert_data_14);
      __e_acsl_assert_clean(& __gen_e_acsl_assert_data_14);
    }
  }
  return;
}

void unnatural_loop(void)
{
  int x = 0;
  {
    int i = 0;
    {
      int __gen_e_acsl_and;
      __e_acsl_assert_data_t __gen_e_acsl_assert_data =
        {.values = (void *)0};
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,"i",0,i);
      if (0 <= i) {
        __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,"i",0,i);
        __gen_e_acsl_and = i <= 6;
      }
      else __gen_e_acsl_and = 0;
      __gen_e_acsl_assert_data.blocking = 1;
      __gen_e_acsl_assert_data.kind = "Invariant";
      __gen_e_acsl_assert_data.pred_txt = "0 <= i <= 6";
      __gen_e_acsl_assert_data.file = "loop.i";
      __gen_e_acsl_assert_data.fct = "unnatural_loop";
      __gen_e_acsl_assert_data.line = 26;
      __e_acsl_assert(__gen_e_acsl_and,& __gen_e_acsl_assert_data);
      __e_acsl_assert_clean(& __gen_e_acsl_assert_data);
    }
    /*@ loop invariant 0 <= i <= 6; */
    while (i < 10) {
      if (x == 5) break;
      x = i;
      {
        int __gen_e_acsl_and_2;
        i ++;
        __e_acsl_assert_data_t __gen_e_acsl_assert_data_2 =
          {.values = (void *)0};
        __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_2,"i",0,i);
        if (0 <= i) {
          __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_2,"i",0,i);
          __gen_e_acsl_and_2 = i <= 6;
        }
        else __gen_e_acsl_and_2 = 0;
        __gen_e_acsl_assert_data_2.blocking = 1;
        __gen_e_acsl_assert_data_2.kind = "Invariant";
        __gen_e_acsl_assert_data_2.pred_txt = "0 <= i <= 6";
        __gen_e_acsl_assert_data_2.file = "loop.i";
        __gen_e_acsl_assert_data_2.fct = "unnatural_loop";
        __gen_e_acsl_assert_data_2.line = 26;
        __e_acsl_assert(__gen_e_acsl_and_2,& __gen_e_acsl_assert_data_2);
        __e_acsl_assert_clean(& __gen_e_acsl_assert_data_2);
      }
    }
  }
  return;
}

int main(void)
{
  int __retres;
  __e_acsl_memory_init((int *)0,(char ***)0,8UL);
  simple_loop();
  nested_loops();
  unnatural_loop();
  __retres = 0;
  __e_acsl_memory_clean();
  return __retres;
}


