/* Generated by Frama-C */
#include "stddef.h"
#include "stdio.h"
#include "stdlib.h"
char *__gen_e_acsl_literal_string;
void __e_acsl_globals_init(void)
{
  static char __e_acsl_already_run = 0;
  if (! __e_acsl_already_run) {
    __e_acsl_already_run = 1;
    __gen_e_acsl_literal_string = "Same address %p in %d steps\n";
    __e_acsl_store_block((void *)__gen_e_acsl_literal_string,
                         sizeof("Same address %p in %d steps\n"));
    __e_acsl_full_init((void *)__gen_e_acsl_literal_string);
    __e_acsl_mark_readonly((void *)__gen_e_acsl_literal_string);
  }
  return;
}

int main(void)
{
  int __retres;
  int *p;
  int *q;
  __e_acsl_memory_init((int *)0,(char ***)0,(size_t)8);
  __e_acsl_globals_init();
  __e_acsl_store_block((void *)(& q),(size_t)8);
  __e_acsl_store_block((void *)(& p),(size_t)8);
  int counter = 0;
  size_t limit = (unsigned long)10000;
  __e_acsl_full_init((void *)(& p));
  __e_acsl_temporal_reset_parameters();
  __e_acsl_temporal_reset_return();
  p = (int *)malloc((unsigned long)(1024 * 1024));
  __e_acsl_temporal_store_nblock((void *)(& p),(void *)*(& p));
  __e_acsl_full_init((void *)(& q));
  __e_acsl_temporal_store_nreferent((void *)(& q),(void *)(& p));
  q = p;
  __e_acsl_temporal_reset_parameters();
  __e_acsl_temporal_reset_return();
  __e_acsl_temporal_save_nreferent_parameter((void *)(& p),0U);
  free((void *)p);
  while ((size_t)counter < limit) {
    __e_acsl_full_init((void *)(& p));
    __e_acsl_temporal_reset_parameters();
    __e_acsl_temporal_reset_return();
    p = (int *)malloc((unsigned long)(1024 * 1024));
    __e_acsl_temporal_store_nblock((void *)(& p),(void *)*(& p));
    counter ++;
    /*@ assert Eva: dangling_pointer: ¬\dangling(&q); */
    if (p != q) {
      __e_acsl_temporal_reset_parameters();
      __e_acsl_temporal_reset_return();
      __e_acsl_temporal_save_nreferent_parameter((void *)(& p),0U);
      free((void *)p);
    }
    else {
      __e_acsl_temporal_reset_parameters();
      __e_acsl_temporal_reset_return();
      __e_acsl_temporal_save_nreferent_parameter((void *)(& p),1U);
      printf(__gen_e_acsl_literal_string,(void *)p,counter); /* printf_va_1 */
      break;
    }
    __e_acsl_full_init((void *)(& p));
    __e_acsl_temporal_store_nblock((void *)(& p),(void *)0);
    p = (int *)0;
  }
  if (p) {
    __e_acsl_initialize((void *)q,sizeof(int));
    *q = 1;
    __e_acsl_initialize((void *)p,sizeof(int));
    *p = 2;
  }
  __e_acsl_temporal_reset_parameters();
  __e_acsl_temporal_reset_return();
  __e_acsl_temporal_save_nreferent_parameter((void *)(& p),0U);
  free((void *)p);
  __retres = 0;
  __e_acsl_delete_block((void *)(& q));
  __e_acsl_delete_block((void *)(& p));
  __e_acsl_memory_clean();
  return __retres;
}


