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

/*@ requires valid_string_s: valid_read_string(s);
    ensures acsl_c_equiv: \result == strlen(\old(s));
    assigns \result;
    assigns \result \from (indirect: *(s + (0 ..)));
 */
size_t __gen_e_acsl_strlen(char const *s);

/*@ requires \valid(&argc);
    requires \valid(&argv); */
int main(int argc, char **argv);

int __gen_e_acsl_main(int argc, char **argv)
{
  int __retres;
  int i;
  {
    int __gen_e_acsl_forall;
    long __gen_e_acsl_k;
    __e_acsl_store_block((void *)(& argv),8UL);
    __e_acsl_assert_data_t __gen_e_acsl_assert_data = {.values = (void *)0};
    __gen_e_acsl_forall = 1;
    __gen_e_acsl_k = 0;
    while (1) {
      if (__gen_e_acsl_k <= (long)argc) ; else break;
      {
        int __gen_e_acsl_valid;
        __gen_e_acsl_valid = __e_acsl_valid((void *)(argv + __gen_e_acsl_k),
                                            sizeof(char *),(void *)argv,
                                            (void *)(& argv));
        if (__gen_e_acsl_valid) ;
        else {
          __gen_e_acsl_forall = 0;
          goto e_acsl_end_loop1;
        }
      }
      __gen_e_acsl_k ++;
    }
    e_acsl_end_loop1: ;
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,
                                 "\\forall int k; 0 <= k <= argc ==> \\valid(argv + k)",
                                 0,__gen_e_acsl_forall);
    __gen_e_acsl_assert_data.blocking = 1;
    __gen_e_acsl_assert_data.kind = "Assertion";
    __gen_e_acsl_assert_data.pred_txt = "\\forall int k; 0 <= k <= argc ==> \\valid(argv + k)";
    __gen_e_acsl_assert_data.file = "mainargs.c";
    __gen_e_acsl_assert_data.fct = "main";
    __gen_e_acsl_assert_data.line = 12;
    __e_acsl_assert(__gen_e_acsl_forall,& __gen_e_acsl_assert_data);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data);
  }
  /*@ assert \forall int k; 0 <= k <= argc ==> \valid(argv + k); */ ;
  {
    unsigned long __gen_e_acsl_block_length;
    __e_acsl_mpz_t __gen_e_acsl_block_length_2;
    __e_acsl_mpz_t __gen_e_acsl_;
    int __gen_e_acsl_eq;
    __e_acsl_assert_data_t __gen_e_acsl_assert_data_2 =
      {.values = (void *)0};
    __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data_2,"argv",
                                 (void *)argv);
    __gen_e_acsl_block_length = __e_acsl_block_length((void *)argv);
    __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data_2,
                                   "\\block_length(argv)",0,
                                   __gen_e_acsl_block_length);
    __gmpz_init_set_ui(__gen_e_acsl_block_length_2,__gen_e_acsl_block_length);
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_2,"argc",0,argc);
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_2,
                                 "sizeof(char *)",0,8);
    __gmpz_init_set_si(__gen_e_acsl_,(argc + 1L) * 8);
    __gen_e_acsl_eq = __gmpz_cmp((__e_acsl_mpz_struct const *)(__gen_e_acsl_block_length_2),
                                 (__e_acsl_mpz_struct const *)(__gen_e_acsl_));
    __gen_e_acsl_assert_data_2.blocking = 1;
    __gen_e_acsl_assert_data_2.kind = "Assertion";
    __gen_e_acsl_assert_data_2.pred_txt = "\\block_length(argv) == (argc + 1) * sizeof(char *)";
    __gen_e_acsl_assert_data_2.file = "mainargs.c";
    __gen_e_acsl_assert_data_2.fct = "main";
    __gen_e_acsl_assert_data_2.line = 13;
    __e_acsl_assert(__gen_e_acsl_eq == 0,& __gen_e_acsl_assert_data_2);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data_2);
    __gmpz_clear(__gen_e_acsl_block_length_2);
    __gmpz_clear(__gen_e_acsl_);
  }
  /*@ assert \block_length(argv) == (argc + 1) * sizeof(char *); */ ;
  {
    int __gen_e_acsl_valid_read;
    __e_acsl_assert_data_t __gen_e_acsl_assert_data_3 =
      {.values = (void *)0};
    /*@ assert Eva: mem_access: \valid_read(argv + argc); */
    __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data_3,
                                 "*(argv + argc)",(void *)*(argv + argc));
    __e_acsl_assert_data_t __gen_e_acsl_assert_data_4 =
      {.values = (void *)0};
    __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data_4,"argv",
                                 (void *)argv);
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_4,"argc",0,argc);
    __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data_4,
                                   "sizeof(char *)",0,sizeof(char *));
    __gen_e_acsl_valid_read = __e_acsl_valid_read((void *)(argv + argc),
                                                  sizeof(char *),
                                                  (void *)argv,
                                                  (void *)(& argv));
    __gen_e_acsl_assert_data_4.blocking = 1;
    __gen_e_acsl_assert_data_4.kind = "RTE";
    __gen_e_acsl_assert_data_4.pred_txt = "\\valid_read(argv + argc)";
    __gen_e_acsl_assert_data_4.file = "mainargs.c";
    __gen_e_acsl_assert_data_4.fct = "main";
    __gen_e_acsl_assert_data_4.line = 15;
    __gen_e_acsl_assert_data_4.name = "mem_access";
    __e_acsl_assert(__gen_e_acsl_valid_read,& __gen_e_acsl_assert_data_4);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data_4);
    __gen_e_acsl_assert_data_3.blocking = 1;
    __gen_e_acsl_assert_data_3.kind = "Assertion";
    __gen_e_acsl_assert_data_3.pred_txt = "*(argv + argc) == \\null";
    __gen_e_acsl_assert_data_3.file = "mainargs.c";
    __gen_e_acsl_assert_data_3.fct = "main";
    __gen_e_acsl_assert_data_3.line = 15;
    /*@ assert Eva: mem_access: \valid_read(argv + argc); */
    __e_acsl_assert(*(argv + argc) == (char *)0,& __gen_e_acsl_assert_data_3);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data_3);
  }
  /*@ assert *(argv + argc) == \null; */ ;
  {
    int __gen_e_acsl_initialized;
    int __gen_e_acsl_and;
    __e_acsl_assert_data_t __gen_e_acsl_assert_data_5 =
      {.values = (void *)0};
    __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data_5,"argv",
                                 (void *)argv);
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_5,"argc",0,argc);
    __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data_5,
                                   "sizeof(char *)",0,sizeof(char *));
    __gen_e_acsl_initialized = __e_acsl_initialized((void *)(argv + argc),
                                                    sizeof(char *));
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_5,
                                 "\\initialized(argv + argc)",0,
                                 __gen_e_acsl_initialized);
    if (__gen_e_acsl_initialized) {
      int __gen_e_acsl_valid_read_2;
      int __gen_e_acsl_valid_2;
      /*@ assert Eva: mem_access: \valid_read(argv + argc); */
      __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data_5,
                                   "*(argv + argc)",(void *)*(argv + argc));
      __e_acsl_assert_data_t __gen_e_acsl_assert_data_6 =
        {.values = (void *)0};
      __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data_6,"argv",
                                   (void *)argv);
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_6,"argc",0,
                                   argc);
      __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data_6,
                                     "sizeof(char *)",0,sizeof(char *));
      __gen_e_acsl_valid_read_2 = __e_acsl_valid_read((void *)(argv + argc),
                                                      sizeof(char *),
                                                      (void *)argv,
                                                      (void *)(& argv));
      __gen_e_acsl_assert_data_6.blocking = 1;
      __gen_e_acsl_assert_data_6.kind = "RTE";
      __gen_e_acsl_assert_data_6.pred_txt = "\\valid_read(argv + argc)";
      __gen_e_acsl_assert_data_6.file = "mainargs.c";
      __gen_e_acsl_assert_data_6.fct = "main";
      __gen_e_acsl_assert_data_6.line = 16;
      __gen_e_acsl_assert_data_6.name = "mem_access";
      __e_acsl_assert(__gen_e_acsl_valid_read_2,& __gen_e_acsl_assert_data_6);
      __e_acsl_assert_clean(& __gen_e_acsl_assert_data_6);
      __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data_5,
                                     "sizeof(char)",0,sizeof(char));
      /*@ assert Eva: mem_access: \valid_read(argv + argc); */
      __gen_e_acsl_valid_2 = __e_acsl_valid((void *)*(argv + argc),
                                            sizeof(char),
                                            (void *)*(argv + argc),
                                            (void *)(argv + argc));
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_5,
                                   "\\valid(*(argv + argc))",0,
                                   __gen_e_acsl_valid_2);
      __gen_e_acsl_and = __gen_e_acsl_valid_2;
    }
    else __gen_e_acsl_and = 0;
    __gen_e_acsl_assert_data_5.blocking = 1;
    __gen_e_acsl_assert_data_5.kind = "Assertion";
    __gen_e_acsl_assert_data_5.pred_txt = "!\\valid(*(argv + argc))";
    __gen_e_acsl_assert_data_5.file = "mainargs.c";
    __gen_e_acsl_assert_data_5.fct = "main";
    __gen_e_acsl_assert_data_5.line = 16;
    __e_acsl_assert(! __gen_e_acsl_and,& __gen_e_acsl_assert_data_5);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data_5);
  }
  /*@ assert !\valid(*(argv + argc)); */ ;
  i = 0;
  while (i < argc) {
    {
      size_t tmp;
      tmp = __gen_e_acsl_strlen((char const *)*(argv + i));
      int len = (int)tmp;
      {
        int __gen_e_acsl_initialized_2;
        int __gen_e_acsl_and_2;
        __e_acsl_assert_data_t __gen_e_acsl_assert_data_7 =
          {.values = (void *)0};
        __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data_7,"argv",
                                     (void *)argv);
        __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_7,"i",0,i);
        __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data_7,
                                       "sizeof(char *)",0,sizeof(char *));
        __gen_e_acsl_initialized_2 = __e_acsl_initialized((void *)(argv + i),
                                                          sizeof(char *));
        __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_7,
                                     "\\initialized(argv + i)",0,
                                     __gen_e_acsl_initialized_2);
        if (__gen_e_acsl_initialized_2) {
          int __gen_e_acsl_valid_read_3;
          int __gen_e_acsl_valid_3;
          __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data_7,
                                       "*(argv + i)",(void *)*(argv + i));
          __e_acsl_assert_data_t __gen_e_acsl_assert_data_8 =
            {.values = (void *)0};
          __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data_8,"argv",
                                       (void *)argv);
          __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_8,"i",0,i);
          __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data_8,
                                         "sizeof(char *)",0,sizeof(char *));
          __gen_e_acsl_valid_read_3 = __e_acsl_valid_read((void *)(argv + i),
                                                          sizeof(char *),
                                                          (void *)argv,
                                                          (void *)(& argv));
          __gen_e_acsl_assert_data_8.blocking = 1;
          __gen_e_acsl_assert_data_8.kind = "RTE";
          __gen_e_acsl_assert_data_8.pred_txt = "\\valid_read(argv + i)";
          __gen_e_acsl_assert_data_8.file = "mainargs.c";
          __gen_e_acsl_assert_data_8.fct = "main";
          __gen_e_acsl_assert_data_8.line = 19;
          __gen_e_acsl_assert_data_8.name = "mem_access";
          __e_acsl_assert(__gen_e_acsl_valid_read_3,
                          & __gen_e_acsl_assert_data_8);
          __e_acsl_assert_clean(& __gen_e_acsl_assert_data_8);
          __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data_7,
                                         "sizeof(char)",0,sizeof(char));
          __gen_e_acsl_valid_3 = __e_acsl_valid((void *)*(argv + i),
                                                sizeof(char),
                                                (void *)*(argv + i),
                                                (void *)(argv + i));
          __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_7,
                                       "\\valid(*(argv + i))",0,
                                       __gen_e_acsl_valid_3);
          __gen_e_acsl_and_2 = __gen_e_acsl_valid_3;
        }
        else __gen_e_acsl_and_2 = 0;
        __gen_e_acsl_assert_data_7.blocking = 1;
        __gen_e_acsl_assert_data_7.kind = "Assertion";
        __gen_e_acsl_assert_data_7.pred_txt = "\\valid(*(argv + i))";
        __gen_e_acsl_assert_data_7.file = "mainargs.c";
        __gen_e_acsl_assert_data_7.fct = "main";
        __gen_e_acsl_assert_data_7.line = 19;
        __e_acsl_assert(__gen_e_acsl_and_2,& __gen_e_acsl_assert_data_7);
        __e_acsl_assert_clean(& __gen_e_acsl_assert_data_7);
      }
      /*@ assert \valid(*(argv + i)); */ ;
      {
        int __gen_e_acsl_forall_2;
        long __gen_e_acsl_k_2;
        __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 <= (long)len) ; else break;
          {
            int __gen_e_acsl_valid_read_4;
            int __gen_e_acsl_valid_4;
            __e_acsl_assert_data_t __gen_e_acsl_assert_data_10 =
              {.values = (void *)0};
            __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data_10,
                                         "argv",(void *)argv);
            __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_10,"i",0,
                                         i);
            __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data_10,
                                           "sizeof(char *)",0,sizeof(char *));
            __gen_e_acsl_valid_read_4 = __e_acsl_valid_read((void *)(
                                                            argv + i),
                                                            sizeof(char *),
                                                            (void *)argv,
                                                            (void *)(& argv));
            __gen_e_acsl_assert_data_10.blocking = 1;
            __gen_e_acsl_assert_data_10.kind = "RTE";
            __gen_e_acsl_assert_data_10.pred_txt = "\\valid_read(argv + i)";
            __gen_e_acsl_assert_data_10.file = "mainargs.c";
            __gen_e_acsl_assert_data_10.fct = "main";
            __gen_e_acsl_assert_data_10.line = 20;
            __gen_e_acsl_assert_data_10.name = "mem_access";
            __e_acsl_assert(__gen_e_acsl_valid_read_4,
                            & __gen_e_acsl_assert_data_10);
            __e_acsl_assert_clean(& __gen_e_acsl_assert_data_10);
            __gen_e_acsl_valid_4 = __e_acsl_valid((void *)(*(argv + i) + __gen_e_acsl_k_2),
                                                  sizeof(char),
                                                  (void *)*(argv + i),
                                                  (void *)(argv + i));
            if (__gen_e_acsl_valid_4) ;
            else {
              __gen_e_acsl_forall_2 = 0;
              goto e_acsl_end_loop2;
            }
          }
          __gen_e_acsl_k_2 ++;
        }
        e_acsl_end_loop2: ;
        __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_9,
                                     "\\forall int k; 0 <= k <= len ==> \\valid(*(argv + i) + k)",
                                     0,__gen_e_acsl_forall_2);
        __gen_e_acsl_assert_data_9.blocking = 1;
        __gen_e_acsl_assert_data_9.kind = "Assertion";
        __gen_e_acsl_assert_data_9.pred_txt = "\\forall int k; 0 <= k <= len ==> \\valid(*(argv + i) + k)";
        __gen_e_acsl_assert_data_9.file = "mainargs.c";
        __gen_e_acsl_assert_data_9.fct = "main";
        __gen_e_acsl_assert_data_9.line = 20;
        __e_acsl_assert(__gen_e_acsl_forall_2,& __gen_e_acsl_assert_data_9);
        __e_acsl_assert_clean(& __gen_e_acsl_assert_data_9);
      }
      /*@ assert \forall int k; 0 <= k <= len ==> \valid(*(argv + i) + k); */
      ;
    }
    i ++;
  }
  __retres = 0;
  __e_acsl_delete_block((void *)(& argv));
  return __retres;
}

/*@ requires \valid(&argc);
    requires \valid(&argv); */
int main(int argc, char **argv)
{
  int __retres;
  __e_acsl_memory_init(& argc,& argv,8UL);
  {
    int __gen_e_acsl_valid;
    int __gen_e_acsl_valid_2;
    __e_acsl_assert_data_t __gen_e_acsl_assert_data = {.values = (void *)0};
    __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data,"&argc",
                                 (void *)(& argc));
    __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data,"sizeof(int)",
                                   0,sizeof(int));
    __gen_e_acsl_valid = __e_acsl_valid((void *)(& argc),sizeof(int),
                                        (void *)(& argc),(void *)0);
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,"\\valid(&argc)",
                                 0,__gen_e_acsl_valid);
    __gen_e_acsl_assert_data.blocking = 1;
    __gen_e_acsl_assert_data.kind = "Precondition";
    __gen_e_acsl_assert_data.pred_txt = "\\valid(&argc)";
    __gen_e_acsl_assert_data.file = "mainargs.c";
    __gen_e_acsl_assert_data.fct = "main";
    __gen_e_acsl_assert_data.line = 7;
    __e_acsl_assert(__gen_e_acsl_valid,& __gen_e_acsl_assert_data);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data);
    __e_acsl_assert_data_t __gen_e_acsl_assert_data_2 =
      {.values = (void *)0};
    __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data_2,"&argv",
                                 (void *)(& argv));
    __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data_2,
                                   "sizeof(char **)",0,sizeof(char **));
    __gen_e_acsl_valid_2 = __e_acsl_valid((void *)(& argv),sizeof(char **),
                                          (void *)(& argv),(void *)0);
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_2,
                                 "\\valid(&argv)",0,__gen_e_acsl_valid_2);
    __gen_e_acsl_assert_data_2.blocking = 1;
    __gen_e_acsl_assert_data_2.kind = "Precondition";
    __gen_e_acsl_assert_data_2.pred_txt = "\\valid(&argv)";
    __gen_e_acsl_assert_data_2.file = "mainargs.c";
    __gen_e_acsl_assert_data_2.fct = "main";
    __gen_e_acsl_assert_data_2.line = 8;
    __e_acsl_assert(__gen_e_acsl_valid_2,& __gen_e_acsl_assert_data_2);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data_2);
  }
  __retres = __gen_e_acsl_main(argc,argv);
  __e_acsl_delete_block((void *)(& argv));
  __e_acsl_memory_clean();
  return __retres;
}

/*@ requires valid_string_s: valid_read_string(s);
    ensures acsl_c_equiv: \result == strlen(\old(s));
    assigns \result;
    assigns \result \from (indirect: *(s + (0 ..)));
 */
size_t __gen_e_acsl_strlen(char const *s)
{
  size_t __retres;
  __e_acsl_store_block((void *)(& s),8UL);
  __retres = strlen(s);
  __e_acsl_delete_block((void *)(& s));
  return __retres;
}


