/* Generated by Frama-C */
#include "stddef.h"
#include "stdio.h"
extern int __e_acsl_sound_verdict;

/*@ requires \initialized(p);
    requires *p ≡ 0;
    ensures \result ≡ \old(*p);
 */
int __gen_e_acsl_f(int *p);

int f(int *p)
{
  int __retres;
  __e_acsl_store_block((void *)(& p),(size_t)8);
  {
    int i = 0;
    {
      int __gen_e_acsl_and;
      if (0 <= i) __gen_e_acsl_and = i <= 1; else __gen_e_acsl_and = 0;
      __e_acsl_assert(__gen_e_acsl_and,"Invariant","f","0 <= i <= 1",
                      "tests/special/e-acsl-functions.c",11);
    }
    /*@ loop invariant 0 ≤ i ≤ 1; */
    while (i < 1) {
      int __gen_e_acsl_and_2;
      i ++;
      if (0 <= i) __gen_e_acsl_and_2 = i <= 1; else __gen_e_acsl_and_2 = 0;
      __e_acsl_assert(__gen_e_acsl_and_2,"Invariant","f","0 <= i <= 1",
                      "tests/special/e-acsl-functions.c",11);
    }
  }
  __retres = 0;
  __e_acsl_delete_block((void *)(& p));
  return __retres;
}

/*@ requires \initialized(p);
    requires *p ≡ 1;
    ensures \result ≡ \old(*p);
 */
int g(int *p)
{
  int __retres;
  {
    int i = 0;
    /*@ loop invariant 0 ≤ i ≤ 1; */
    while (i < 1) i ++;
  }
  __retres = 0;
  return __retres;
}

int main(void)
{
  int __retres;
  __e_acsl_memory_init((int *)0,(char ***)0,(size_t)8);
  int x = 0;
  __e_acsl_store_block((void *)(& x),(size_t)4);
  __e_acsl_full_init((void *)(& x));
  int y = 0;
  __gen_e_acsl_f(& x);
  g(& y);
  __retres = 0;
  __e_acsl_delete_block((void *)(& x));
  __e_acsl_memory_clean();
  return __retres;
}

/*@ requires \initialized(p);
    requires *p ≡ 0;
    ensures \result ≡ \old(*p);
 */
int __gen_e_acsl_f(int *p)
{
  int __gen_e_acsl_at;
  int __retres;
  {
    int __gen_e_acsl_initialized;
    __e_acsl_store_block((void *)(& p),(size_t)8);
    __gen_e_acsl_initialized = __e_acsl_initialized((void *)p,sizeof(int));
    __e_acsl_assert(__gen_e_acsl_initialized,"Precondition","f",
                    "\\initialized(p)","tests/special/e-acsl-functions.c",7);
    __e_acsl_assert(*p == 0,"Precondition","f","*p == 0",
                    "tests/special/e-acsl-functions.c",8);
  }
  {
    int __gen_e_acsl_valid_read;
    __gen_e_acsl_valid_read = __e_acsl_valid_read((void *)p,sizeof(int),
                                                  (void *)p,(void *)(& p));
    __e_acsl_assert(__gen_e_acsl_valid_read,"RTE","f",
                    "mem_access: \\valid_read(p)",
                    "tests/special/e-acsl-functions.c",9);
    __gen_e_acsl_at = *p;
  }
  __retres = f(p);
  __e_acsl_assert(__retres == __gen_e_acsl_at,"Postcondition","f",
                  "\\result == \\old(*p)","tests/special/e-acsl-functions.c",
                  9);
  __e_acsl_delete_block((void *)(& p));
  return __retres;
}


