/* Generated by Frama-C */
#include "stddef.h"
#include "stdio.h"
int main(void)
{
  int __retres;
  __e_acsl_memory_init((int *)0,(char ***)0,(size_t)8);
  int x = 1;
  __e_acsl_store_block((void *)(& x),(size_t)4);
  __e_acsl_full_init((void *)(& x));
  int t[3] = {2, 3, 4};
  __e_acsl_store_block((void *)(t),(size_t)12);
  __e_acsl_full_init((void *)(& t));
  int *p = & x;
  __e_acsl_store_block((void *)(& p),(size_t)8);
  __e_acsl_full_init((void *)(& p));
  {
    int __gen_e_acsl_initialized;
    int __gen_e_acsl_and;
    __gen_e_acsl_initialized = __e_acsl_initialized((void *)(& p),
                                                    sizeof(int *));
    if (__gen_e_acsl_initialized) {
      int __gen_e_acsl_valid_read;
      __gen_e_acsl_valid_read = __e_acsl_valid_read((void *)p,sizeof(int),
                                                    (void *)p,(void *)(& p));
      __gen_e_acsl_and = __gen_e_acsl_valid_read;
    }
    else __gen_e_acsl_and = 0;
    __e_acsl_assert(__gen_e_acsl_and,"RTE","main",
                    "mem_access: \\valid_read(p)","tests/memory/ptr.i",11);
    __e_acsl_assert(*p == 1,"Assertion","main","*p == 1",
                    "tests/memory/ptr.i",11);
  }
  /*@ assert *p ≡ 1; */ ;
  __e_acsl_assert(t[0] == 2,"Assertion","main","t[0] == 2",
                  "tests/memory/ptr.i",12);
  /*@ assert t[0] ≡ 2; */ ;
  __e_acsl_assert(t[2] == 4,"Assertion","main","t[2] == 4",
                  "tests/memory/ptr.i",13);
  /*@ assert t[2] ≡ 4; */ ;
  __e_acsl_assert(t[2] == 4,"Assertion","main",
                  "t[(2 * sizeof(int)) / sizeof((int)0x0)] == 4",
                  "tests/memory/ptr.i",14);
  /*@ assert t[(2 * sizeof(int)) / sizeof((int)0x0)] ≡ 4; */ ;
  {
    int i = 0;
    while (i < 2) {
      __e_acsl_assert(i < 3,"RTE","main","index_bound: i < 3",
                      "tests/memory/ptr.i",17);
      __e_acsl_assert(0 <= i,"RTE","main","index_bound: 0 <= i",
                      "tests/memory/ptr.i",17);
      __e_acsl_assert((long)t[i] == i + 2L,"Assertion","main",
                      "t[i] == i + 2","tests/memory/ptr.i",17);
      /*@ assert t[i] ≡ i + 2; */ ;
      __e_acsl_assert(2L - i < 3L,"RTE","main",
                      "index_bound: (long)(2 - i) < 3","tests/memory/ptr.i",
                      18);
      __e_acsl_assert(0L <= 2L - i,"RTE","main",
                      "index_bound: 0 <= (long)(2 - i)","tests/memory/ptr.i",
                      18);
      __e_acsl_assert((long)t[2L - i] == 4L - i,"Assertion","main",
                      "t[2 - i] == 4 - i","tests/memory/ptr.i",18);
      /*@ assert t[2 - i] ≡ 4 - i; */ ;
      {
        int __gen_e_acsl_valid_read_2;
        __gen_e_acsl_valid_read_2 = __e_acsl_valid_read((void *)(& t[2] - i),
                                                        sizeof(int),
                                                        (void *)(& t[2]),
                                                        (void *)0);
        __e_acsl_assert(__gen_e_acsl_valid_read_2,"RTE","main",
                        "mem_access: \\valid_read(&t[2] - i)",
                        "tests/memory/ptr.i",19);
        __e_acsl_assert((long)*(& t[2] - i) == 4L - i,"Assertion","main",
                        "*(&t[2] - i) == 4 - i","tests/memory/ptr.i",19);
      }
      /*@ assert *(&t[2] - i) ≡ 4 - i; */ ;
      i ++;
    }
  }
  __e_acsl_full_init((void *)(& p));
  p = & t[2];
  __e_acsl_initialize((void *)(& t[2]),sizeof(int));
  t[2] = 5;
  {
    int __gen_e_acsl_initialized_2;
    int __gen_e_acsl_and_2;
    __gen_e_acsl_initialized_2 = __e_acsl_initialized((void *)(& p),
                                                      sizeof(int *));
    if (__gen_e_acsl_initialized_2) {
      int __gen_e_acsl_valid_read_3;
      __gen_e_acsl_valid_read_3 = __e_acsl_valid_read((void *)p,sizeof(int),
                                                      (void *)p,
                                                      (void *)(& p));
      __gen_e_acsl_and_2 = __gen_e_acsl_valid_read_3;
    }
    else __gen_e_acsl_and_2 = 0;
    __e_acsl_assert(__gen_e_acsl_and_2,"RTE","main",
                    "mem_access: \\valid_read(p)","tests/memory/ptr.i",25);
    __e_acsl_assert(*p == 5,"Assertion","main","*p == 5",
                    "tests/memory/ptr.i",25);
  }
  /*@ assert *p ≡ 5; */ ;
  int k = -1;
  {
    int __gen_e_acsl_valid_read_4;
    __gen_e_acsl_valid_read_4 = __e_acsl_valid_read((void *)(p + k),
                                                    sizeof(int),(void *)p,
                                                    (void *)(& p));
    __e_acsl_assert(__gen_e_acsl_valid_read_4,"RTE","main",
                    "mem_access: \\valid_read(p + k)","tests/memory/ptr.i",
                    27);
    __e_acsl_assert(*(p + k) == 3,"Assertion","main","*(p + k) == 3",
                    "tests/memory/ptr.i",27);
  }
  /*@ assert *(p + k) ≡ 3; */ ;
  __retres = 0;
  __e_acsl_delete_block((void *)(& p));
  __e_acsl_delete_block((void *)(t));
  __e_acsl_delete_block((void *)(& x));
  __e_acsl_memory_clean();
  return __retres;
}


