/* Generated by Frama-C */
#include "errno.h"
#include "pthread.h"
#include "sched.h"
#include "signal.h"
#include "stddef.h"
#include "stdint.h"
#include "stdio.h"
#include "stdlib.h"
#include "time.h"
#include "unistd.h"
char *__gen_e_acsl_literal_string_2;
char *__gen_e_acsl_literal_string_5;
char *__gen_e_acsl_literal_string_3;
char *__gen_e_acsl_literal_string_6;
char *__gen_e_acsl_literal_string_11;
char *__gen_e_acsl_literal_string_12;
char *__gen_e_acsl_literal_string;
char *__gen_e_acsl_literal_string_4;
char *__gen_e_acsl_literal_string_7;
char *__gen_e_acsl_literal_string_8;
char *__gen_e_acsl_literal_string_9;
char *__gen_e_acsl_literal_string_10;
char *__gen_e_acsl_literal_string_13;
char *__gen_e_acsl_literal_string_14;
extern  __attribute__((__FC_BUILTIN__)) int __e_acsl_sound_verdict;

/*@ requires valid_cond: \valid(cond);
    ensures sucess: \result == 0;
    assigns \result;
    assigns \result \from \nothing;
 */
int __gen_e_acsl_pthread_cond_broadcast(pthread_cond_t *cond);

/*@ requires valid_cond: \valid(cond);
    requires valid_null_attr: attr == \null || \valid_read(attr);
    ensures initialization: cond: \initialized(\old(cond));
    ensures success: \result == 0;
    assigns *cond, \result;
    assigns *cond \from *attr;
    assigns \result \from \nothing;
 */
int __gen_e_acsl_pthread_cond_init(pthread_cond_t * restrict cond,
                                   pthread_condattr_t const * restrict attr);

/*@ requires valid_cond: \valid(cond);
    requires valid_mutex: \valid(mutex);
    ensures success: \result == 0;
    assigns \result;
    assigns \result \from \nothing;
 */
int __gen_e_acsl_pthread_cond_wait(pthread_cond_t * restrict cond,
                                   pthread_mutex_t * restrict mutex);

/*@ requires valid_thread: \valid(thread);
    requires valid_null_attr: attr == \null || \valid_read(attr);
    requires valid_routine: \valid_function(start_routine);
    requires valid_null_arg: arg == \null || \valid((char *)arg);
    ensures
      success_or_error:
        \result == 0 || \result == 11 || \result == 22 || \result == 1;
    assigns *thread, \result;
    assigns *thread \from *attr;
    assigns \result \from (indirect: *attr);
 */
int __gen_e_acsl_pthread_create(pthread_t * restrict thread,
                                pthread_attr_t const * restrict attr,
                                void *(*start_routine)(void *),
                                void * restrict arg);

/*@ requires valid_or_null_retval: retval == \null || \valid(retval);
    ensures
      success_or_error:
        \result == 0 || \result == 35 || \result == 22 || \result == 3;
    assigns *retval, \result;
    assigns *retval \from thread;
    assigns \result \from (indirect: thread);
    
    behavior ignore_retval:
      assumes null_retval: retval == \null;
      assigns \result;
      assigns \result \from (indirect: thread);
    
    behavior use_retval:
      assumes valid_retval: \valid(retval);
      assigns *retval, \result;
      assigns *retval \from thread;
      assigns \result \from (indirect: thread);
 */
int __gen_e_acsl_pthread_join(pthread_t thread, void **retval);

/*@ requires mutex_valid: \valid(mutex);
    requires attrs_valid_or_null: attrs == \null || \valid_read(attrs);
    ensures
      initialization: success_or_error:
        (\result == 0 && \initialized(\old(mutex))) || \result == 11 ||
        \result == 12 || \result == 1 || \result == 22;
    assigns *mutex, \result;
    assigns *mutex \from *mutex, *attrs;
    assigns \result \from (indirect: *mutex), (indirect: *attrs);
 */
int __gen_e_acsl_pthread_mutex_init(pthread_mutex_t * restrict mutex,
                                    pthread_mutexattr_t const * restrict attrs);

/*@ requires mutex_valid: \valid(mutex);
    ensures
      success_or_error:
        \result == 0 || \result == 11 || \result == 22 || \result == 35;
    assigns *mutex, \result;
    assigns *mutex \from *mutex;
    assigns \result \from (indirect: *mutex);
 */
int __gen_e_acsl_pthread_mutex_lock(pthread_mutex_t *mutex);

/*@ requires mutex_valid: \valid(mutex);
    ensures success_or_error: \result == 0 || \result == 1;
    assigns *mutex, \result;
    assigns *mutex \from *mutex;
    assigns \result \from (indirect: *mutex);
 */
int __gen_e_acsl_pthread_mutex_unlock(pthread_mutex_t *mutex);

/*@ requires valid_string_s: valid_read_string(s);
    assigns __fc_stdout;
    assigns __fc_stdout \from __fc_errno, *(s + (0 .. strlen{Old}(s)));
 */
void __gen_e_acsl_perror(char const *s);

/*@ exits status: \exit_status == \old(status);
    ensures never_terminates: \false;
    
    assigns \exit_status \from status;
 */
void __gen_e_acsl_exit(int status);

/*@ ensures result_ok_or_error: \result == 0 || \result == -1;
    assigns \result, Frama_C_entropy_source;
    assigns \result
      \from (indirect: usec), (indirect: Frama_C_entropy_source);
    assigns Frama_C_entropy_source \from Frama_C_entropy_source;
 */
int __gen_e_acsl_usleep(useconds_t usec);

int *values[10];
int write_count = 0;
int read_count = 0;
pthread_cond_t write_cond;
pthread_cond_t read_cond;
pthread_mutex_t write_mutex;
pthread_mutex_t read_mutex;
/*@ ensures
      \let idx = *((int *)\old(arg));
        \valid(values[idx]) && \initialized(values[idx]);
 */
void *__gen_e_acsl_write_value(void *arg);

void *write_value(void *arg)
{
  void *__retres;
  int tmp;
  int tmp_0;
  int tmp_1;
  __e_acsl_store_block((void *)(& tmp_1),4UL);
  __e_acsl_store_block((void *)(& tmp_0),4UL);
  __e_acsl_store_block((void *)(& tmp),4UL);
  __e_acsl_store_block((void *)(& __retres),8UL);
  __e_acsl_store_block((void *)(& arg),8UL);
  __e_acsl_full_init((void *)(& tmp));
  tmp = __gen_e_acsl_pthread_mutex_lock(& write_mutex);
  if (tmp != 0) {
    __gen_e_acsl_perror(__gen_e_acsl_literal_string);
    __gen_e_acsl_exit(1);
  }
  write_count ++;
  __e_acsl_full_init((void *)(& tmp_0));
  tmp_0 = __gen_e_acsl_pthread_cond_wait(& write_cond,& write_mutex);
  if (tmp_0 != 0) {
    __gen_e_acsl_perror(__gen_e_acsl_literal_string_2);
    __gen_e_acsl_exit(1);
  }
  __e_acsl_full_init((void *)(& tmp_1));
  tmp_1 = __gen_e_acsl_pthread_mutex_unlock(& write_mutex);
  if (tmp_1 != 0) {
    __gen_e_acsl_perror(__gen_e_acsl_literal_string_3);
    __gen_e_acsl_exit(1);
  }
  __gen_e_acsl_usleep((useconds_t)100);
  int idx = *((int *)arg);
  __e_acsl_store_block((void *)(& idx),4UL);
  __e_acsl_full_init((void *)(& idx));
  __e_acsl_initialize((void *)(& values[idx]),sizeof(int *));
  values[idx] = (int *)malloc(sizeof(int));
  __e_acsl_initialize((void *)values[idx],sizeof(int));
  *(values[idx]) = idx;
  __e_acsl_full_init((void *)(& __retres));
  __retres = (void *)0;
  __e_acsl_delete_block((void *)(& arg));
  __e_acsl_delete_block((void *)(& idx));
  __e_acsl_delete_block((void *)(& tmp_1));
  __e_acsl_delete_block((void *)(& tmp_0));
  __e_acsl_delete_block((void *)(& tmp));
  __e_acsl_delete_block((void *)(& __retres));
  return __retres;
}

/*@ requires
      !(\let idx = *((int *)arg);
          \valid_read(values[idx]) && \initialized(values[idx]));
 */
void *__gen_e_acsl_read_value(void *arg);

void *read_value(void *arg)
{
  void *__retres;
  int tmp;
  int tmp_0;
  int tmp_1;
  __e_acsl_store_block((void *)(& tmp_1),4UL);
  __e_acsl_store_block((void *)(& tmp_0),4UL);
  __e_acsl_store_block((void *)(& tmp),4UL);
  __e_acsl_store_block((void *)(& __retres),8UL);
  __e_acsl_store_block((void *)(& arg),8UL);
  __e_acsl_full_init((void *)(& tmp));
  tmp = __gen_e_acsl_pthread_mutex_lock(& read_mutex);
  if (tmp != 0) {
    __gen_e_acsl_perror(__gen_e_acsl_literal_string_4);
    __gen_e_acsl_exit(1);
  }
  read_count ++;
  __e_acsl_full_init((void *)(& tmp_0));
  tmp_0 = __gen_e_acsl_pthread_cond_wait(& read_cond,& read_mutex);
  if (tmp_0 != 0) {
    __gen_e_acsl_perror(__gen_e_acsl_literal_string_5);
    __gen_e_acsl_exit(1);
  }
  __e_acsl_full_init((void *)(& tmp_1));
  tmp_1 = __gen_e_acsl_pthread_mutex_unlock(& read_mutex);
  if (tmp_1 != 0) {
    __gen_e_acsl_perror(__gen_e_acsl_literal_string_6);
    __gen_e_acsl_exit(1);
  }
  __gen_e_acsl_usleep((useconds_t)100);
  {
    int __gen_e_acsl_idx;
    int __gen_e_acsl_initialized;
    int __gen_e_acsl_and;
    int __gen_e_acsl_and_2;
    __e_acsl_assert_data_t __gen_e_acsl_assert_data = {.values = (void *)0};
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,"*((int *)arg)",
                                 0,*((int *)arg));
    __gen_e_acsl_idx = *((int *)arg);
    __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data,"&values[idx]",
                                 (void *)(& values[__gen_e_acsl_idx]));
    __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data,
                                   "sizeof(int *)",0,sizeof(int *));
    __gen_e_acsl_initialized = __e_acsl_initialized((void *)(& values[__gen_e_acsl_idx]),
                                                    sizeof(int *));
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,
                                 "\\initialized(&values[idx])",0,
                                 __gen_e_acsl_initialized);
    if (__gen_e_acsl_initialized) {
      int __gen_e_acsl_valid_read;
      __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data,"values[idx]",
                                   (void *)values[__gen_e_acsl_idx]);
      __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,
                                   "__gen_e_acsl_idx",0,__gen_e_acsl_idx);
      __gen_e_acsl_assert_data_2.blocking = 1;
      __gen_e_acsl_assert_data_2.kind = "RTE";
      __gen_e_acsl_assert_data_2.pred_txt = "__gen_e_acsl_idx < 10";
      __gen_e_acsl_assert_data_2.file = "parallel_threads.c";
      __gen_e_acsl_assert_data_2.fct = "read_value";
      __gen_e_acsl_assert_data_2.line = 82;
      __gen_e_acsl_assert_data_2.name = "index_bound";
      __e_acsl_assert(__gen_e_acsl_idx < 10,& __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_3 =
        {.values = (void *)0};
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_3,
                                   "__gen_e_acsl_idx",0,__gen_e_acsl_idx);
      __gen_e_acsl_assert_data_3.blocking = 1;
      __gen_e_acsl_assert_data_3.kind = "RTE";
      __gen_e_acsl_assert_data_3.pred_txt = "0 <= __gen_e_acsl_idx";
      __gen_e_acsl_assert_data_3.file = "parallel_threads.c";
      __gen_e_acsl_assert_data_3.fct = "read_value";
      __gen_e_acsl_assert_data_3.line = 82;
      __gen_e_acsl_assert_data_3.name = "index_bound";
      __e_acsl_assert(0 <= __gen_e_acsl_idx,& __gen_e_acsl_assert_data_3);
      __e_acsl_assert_clean(& __gen_e_acsl_assert_data_3);
      __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data,
                                     "sizeof(int)",0,sizeof(int));
      __gen_e_acsl_valid_read = __e_acsl_valid_read((void *)values[__gen_e_acsl_idx],
                                                    sizeof(int),
                                                    (void *)values[__gen_e_acsl_idx],
                                                    (void *)(& values[__gen_e_acsl_idx]));
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,
                                   "\\valid_read(values[idx])",0,
                                   __gen_e_acsl_valid_read);
      __gen_e_acsl_and = __gen_e_acsl_valid_read;
    }
    else __gen_e_acsl_and = 0;
    if (__gen_e_acsl_and) {
      int __gen_e_acsl_initialized_2;
      __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data,"values[idx]",
                                   (void *)values[__gen_e_acsl_idx]);
      __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_idx",0,__gen_e_acsl_idx);
      __gen_e_acsl_assert_data_4.blocking = 1;
      __gen_e_acsl_assert_data_4.kind = "RTE";
      __gen_e_acsl_assert_data_4.pred_txt = "__gen_e_acsl_idx < 10";
      __gen_e_acsl_assert_data_4.file = "parallel_threads.c";
      __gen_e_acsl_assert_data_4.fct = "read_value";
      __gen_e_acsl_assert_data_4.line = 82;
      __gen_e_acsl_assert_data_4.name = "index_bound";
      __e_acsl_assert(__gen_e_acsl_idx < 10,& __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_idx",0,__gen_e_acsl_idx);
      __gen_e_acsl_assert_data_5.blocking = 1;
      __gen_e_acsl_assert_data_5.kind = "RTE";
      __gen_e_acsl_assert_data_5.pred_txt = "0 <= __gen_e_acsl_idx";
      __gen_e_acsl_assert_data_5.file = "parallel_threads.c";
      __gen_e_acsl_assert_data_5.fct = "read_value";
      __gen_e_acsl_assert_data_5.line = 82;
      __gen_e_acsl_assert_data_5.name = "index_bound";
      __e_acsl_assert(0 <= __gen_e_acsl_idx,& __gen_e_acsl_assert_data_5);
      __e_acsl_assert_clean(& __gen_e_acsl_assert_data_5);
      __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data,
                                     "sizeof(int)",0,sizeof(int));
      __gen_e_acsl_initialized_2 = __e_acsl_initialized((void *)values[__gen_e_acsl_idx],
                                                        sizeof(int));
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,
                                   "\\initialized(values[idx])",0,
                                   __gen_e_acsl_initialized_2);
      __gen_e_acsl_and_2 = __gen_e_acsl_initialized_2;
    }
    else __gen_e_acsl_and_2 = 0;
    __gen_e_acsl_assert_data.blocking = 1;
    __gen_e_acsl_assert_data.kind = "Precondition";
    __gen_e_acsl_assert_data.pred_txt = "\\let idx = *((int *)arg);\n  \\valid_read(values[idx]) && \\initialized(values[idx])";
    __gen_e_acsl_assert_data.file = "parallel_threads.c";
    __gen_e_acsl_assert_data.fct = "read_value";
    __gen_e_acsl_assert_data.line = 81;
    __e_acsl_assert(__gen_e_acsl_and_2,& __gen_e_acsl_assert_data);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data);
  }
  /*@ requires
        \let idx = *((int *)arg);
          \valid_read(values[idx]) && \initialized(values[idx]);
  */
  {
    int idx = *((int *)arg);
    __e_acsl_store_block((void *)(& idx),4UL);
    __e_acsl_full_init((void *)(& idx));
    {
      int __gen_e_acsl_initialized_3;
      int __gen_e_acsl_and_3;
      __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,
                                   "*(values[idx])",0,*(values[idx]));
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_6,"idx",0,idx);
      __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,
                                   "&values[idx]",(void *)(& values[idx]));
      __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data_7,
                                     "sizeof(int *)",0,sizeof(int *));
      __gen_e_acsl_initialized_3 = __e_acsl_initialized((void *)(& values[idx]),
                                                        sizeof(int *));
      if (__gen_e_acsl_initialized_3) {
        int __gen_e_acsl_valid_read_2;
        __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data_7,
                                     "values[idx]",(void *)values[idx]);
        __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,"idx",0,
                                     idx);
        __gen_e_acsl_assert_data_8.blocking = 1;
        __gen_e_acsl_assert_data_8.kind = "RTE";
        __gen_e_acsl_assert_data_8.pred_txt = "idx < 10";
        __gen_e_acsl_assert_data_8.file = "parallel_threads.c";
        __gen_e_acsl_assert_data_8.fct = "read_value";
        __gen_e_acsl_assert_data_8.line = 85;
        __gen_e_acsl_assert_data_8.name = "index_bound";
        __e_acsl_assert(idx < 10,& __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};
        __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_9,"idx",0,
                                     idx);
        __gen_e_acsl_assert_data_9.blocking = 1;
        __gen_e_acsl_assert_data_9.kind = "RTE";
        __gen_e_acsl_assert_data_9.pred_txt = "0 <= idx";
        __gen_e_acsl_assert_data_9.file = "parallel_threads.c";
        __gen_e_acsl_assert_data_9.fct = "read_value";
        __gen_e_acsl_assert_data_9.line = 85;
        __gen_e_acsl_assert_data_9.name = "index_bound";
        __e_acsl_assert(0 <= idx,& __gen_e_acsl_assert_data_9);
        __e_acsl_assert_clean(& __gen_e_acsl_assert_data_9);
        __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data_7,
                                       "sizeof(int)",0,sizeof(int));
        __gen_e_acsl_valid_read_2 = __e_acsl_valid_read((void *)values[idx],
                                                        sizeof(int),
                                                        (void *)values[idx],
                                                        (void *)(& values[idx]));
        __gen_e_acsl_and_3 = __gen_e_acsl_valid_read_2;
      }
      else __gen_e_acsl_and_3 = 0;
      __gen_e_acsl_assert_data_7.blocking = 1;
      __gen_e_acsl_assert_data_7.kind = "RTE";
      __gen_e_acsl_assert_data_7.pred_txt = "\\valid_read(values[idx])";
      __gen_e_acsl_assert_data_7.file = "parallel_threads.c";
      __gen_e_acsl_assert_data_7.fct = "read_value";
      __gen_e_acsl_assert_data_7.line = 85;
      __gen_e_acsl_assert_data_7.name = "mem_access";
      __e_acsl_assert(__gen_e_acsl_and_3,& __gen_e_acsl_assert_data_7);
      __e_acsl_assert_clean(& __gen_e_acsl_assert_data_7);
      __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,"idx",0,idx);
      __gen_e_acsl_assert_data_10.blocking = 1;
      __gen_e_acsl_assert_data_10.kind = "RTE";
      __gen_e_acsl_assert_data_10.pred_txt = "idx < 10";
      __gen_e_acsl_assert_data_10.file = "parallel_threads.c";
      __gen_e_acsl_assert_data_10.fct = "read_value";
      __gen_e_acsl_assert_data_10.line = 85;
      __gen_e_acsl_assert_data_10.name = "index_bound";
      __e_acsl_assert(idx < 10,& __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,"idx",0,idx);
      __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 <= idx";
      __gen_e_acsl_assert_data_11.file = "parallel_threads.c";
      __gen_e_acsl_assert_data_11.fct = "read_value";
      __gen_e_acsl_assert_data_11.line = 85;
      __gen_e_acsl_assert_data_11.name = "index_bound";
      __e_acsl_assert(0 <= idx,& __gen_e_acsl_assert_data_11);
      __e_acsl_assert_clean(& __gen_e_acsl_assert_data_11);
      __gen_e_acsl_assert_data_6.blocking = 1;
      __gen_e_acsl_assert_data_6.kind = "Assertion";
      __gen_e_acsl_assert_data_6.pred_txt = "*(values[idx]) == idx";
      __gen_e_acsl_assert_data_6.file = "parallel_threads.c";
      __gen_e_acsl_assert_data_6.fct = "read_value";
      __gen_e_acsl_assert_data_6.line = 85;
      __e_acsl_assert(*(values[idx]) == idx,& __gen_e_acsl_assert_data_6);
      __e_acsl_assert_clean(& __gen_e_acsl_assert_data_6);
    }
    /*@ assert *(values[idx]) == idx; */ ;
    free((void *)values[idx]);
    __e_acsl_full_init((void *)(& __retres));
    __retres = (void *)0;
    __e_acsl_delete_block((void *)(& idx));
    goto return_label;
    __e_acsl_delete_block((void *)(& idx));
  }
  return_label:
  __e_acsl_delete_block((void *)(& arg));
  __e_acsl_delete_block((void *)(& tmp_1));
  __e_acsl_delete_block((void *)(& tmp_0));
  __e_acsl_delete_block((void *)(& tmp));
  __e_acsl_delete_block((void *)(& __retres));
  return __retres;
}

/*@ requires
      !(\let idx = *((int *)arg);
          \valid_read(values[idx]) && \initialized(values[idx]));
 */
void *__gen_e_acsl_read_value(void *arg)
{
  void *__retres;
  __e_acsl_store_block((void *)(& __retres),8UL);
  {
    int __gen_e_acsl_idx;
    int __gen_e_acsl_initialized;
    int __gen_e_acsl_and;
    int __gen_e_acsl_and_2;
    __e_acsl_store_block((void *)(& arg),8UL);
    __e_acsl_assert_data_t __gen_e_acsl_assert_data = {.values = (void *)0};
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,"*((int *)arg)",
                                 0,*((int *)arg));
    __gen_e_acsl_idx = *((int *)arg);
    __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data,"&values[idx]",
                                 (void *)(& values[__gen_e_acsl_idx]));
    __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data,
                                   "sizeof(int *)",0,sizeof(int *));
    __gen_e_acsl_initialized = __e_acsl_initialized((void *)(& values[__gen_e_acsl_idx]),
                                                    sizeof(int *));
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,
                                 "\\initialized(&values[idx])",0,
                                 __gen_e_acsl_initialized);
    if (__gen_e_acsl_initialized) {
      int __gen_e_acsl_valid_read;
      __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data,"values[idx]",
                                   (void *)values[__gen_e_acsl_idx]);
      __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,
                                   "__gen_e_acsl_idx",0,__gen_e_acsl_idx);
      __gen_e_acsl_assert_data_2.blocking = 1;
      __gen_e_acsl_assert_data_2.kind = "RTE";
      __gen_e_acsl_assert_data_2.pred_txt = "__gen_e_acsl_idx < 10";
      __gen_e_acsl_assert_data_2.file = "parallel_threads.c";
      __gen_e_acsl_assert_data_2.fct = "read_value";
      __gen_e_acsl_assert_data_2.line = 61;
      __gen_e_acsl_assert_data_2.name = "index_bound";
      __e_acsl_assert(__gen_e_acsl_idx < 10,& __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_3 =
        {.values = (void *)0};
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_3,
                                   "__gen_e_acsl_idx",0,__gen_e_acsl_idx);
      __gen_e_acsl_assert_data_3.blocking = 1;
      __gen_e_acsl_assert_data_3.kind = "RTE";
      __gen_e_acsl_assert_data_3.pred_txt = "0 <= __gen_e_acsl_idx";
      __gen_e_acsl_assert_data_3.file = "parallel_threads.c";
      __gen_e_acsl_assert_data_3.fct = "read_value";
      __gen_e_acsl_assert_data_3.line = 61;
      __gen_e_acsl_assert_data_3.name = "index_bound";
      __e_acsl_assert(0 <= __gen_e_acsl_idx,& __gen_e_acsl_assert_data_3);
      __e_acsl_assert_clean(& __gen_e_acsl_assert_data_3);
      __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data,
                                     "sizeof(int)",0,sizeof(int));
      __gen_e_acsl_valid_read = __e_acsl_valid_read((void *)values[__gen_e_acsl_idx],
                                                    sizeof(int),
                                                    (void *)values[__gen_e_acsl_idx],
                                                    (void *)(& values[__gen_e_acsl_idx]));
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,
                                   "\\valid_read(values[idx])",0,
                                   __gen_e_acsl_valid_read);
      __gen_e_acsl_and = __gen_e_acsl_valid_read;
    }
    else __gen_e_acsl_and = 0;
    if (__gen_e_acsl_and) {
      int __gen_e_acsl_initialized_2;
      __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data,"values[idx]",
                                   (void *)values[__gen_e_acsl_idx]);
      __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_idx",0,__gen_e_acsl_idx);
      __gen_e_acsl_assert_data_4.blocking = 1;
      __gen_e_acsl_assert_data_4.kind = "RTE";
      __gen_e_acsl_assert_data_4.pred_txt = "__gen_e_acsl_idx < 10";
      __gen_e_acsl_assert_data_4.file = "parallel_threads.c";
      __gen_e_acsl_assert_data_4.fct = "read_value";
      __gen_e_acsl_assert_data_4.line = 61;
      __gen_e_acsl_assert_data_4.name = "index_bound";
      __e_acsl_assert(__gen_e_acsl_idx < 10,& __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_idx",0,__gen_e_acsl_idx);
      __gen_e_acsl_assert_data_5.blocking = 1;
      __gen_e_acsl_assert_data_5.kind = "RTE";
      __gen_e_acsl_assert_data_5.pred_txt = "0 <= __gen_e_acsl_idx";
      __gen_e_acsl_assert_data_5.file = "parallel_threads.c";
      __gen_e_acsl_assert_data_5.fct = "read_value";
      __gen_e_acsl_assert_data_5.line = 61;
      __gen_e_acsl_assert_data_5.name = "index_bound";
      __e_acsl_assert(0 <= __gen_e_acsl_idx,& __gen_e_acsl_assert_data_5);
      __e_acsl_assert_clean(& __gen_e_acsl_assert_data_5);
      __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data,
                                     "sizeof(int)",0,sizeof(int));
      __gen_e_acsl_initialized_2 = __e_acsl_initialized((void *)values[__gen_e_acsl_idx],
                                                        sizeof(int));
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,
                                   "\\initialized(values[idx])",0,
                                   __gen_e_acsl_initialized_2);
      __gen_e_acsl_and_2 = __gen_e_acsl_initialized_2;
    }
    else __gen_e_acsl_and_2 = 0;
    __gen_e_acsl_assert_data.blocking = 1;
    __gen_e_acsl_assert_data.kind = "Precondition";
    __gen_e_acsl_assert_data.pred_txt = "!(\\let idx = *((int *)arg);\n    \\valid_read(values[idx]) && \\initialized(values[idx]))";
    __gen_e_acsl_assert_data.file = "parallel_threads.c";
    __gen_e_acsl_assert_data.fct = "read_value";
    __gen_e_acsl_assert_data.line = 60;
    __e_acsl_assert(! __gen_e_acsl_and_2,& __gen_e_acsl_assert_data);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data);
  }
  __retres = read_value(arg);
  __e_acsl_delete_block((void *)(& arg));
  __e_acsl_delete_block((void *)(& __retres));
  return __retres;
}

/*@ ensures
      \let idx = *((int *)\old(arg));
        \valid(values[idx]) && \initialized(values[idx]);
 */
void *__gen_e_acsl_write_value(void *arg)
{
  void *__gen_e_acsl_at;
  void *__retres;
  __e_acsl_store_block((void *)(& __retres),8UL);
  __e_acsl_store_block((void *)(& arg),8UL);
  __gen_e_acsl_at = arg;
  __retres = write_value(arg);
  {
    int __gen_e_acsl_idx;
    int __gen_e_acsl_initialized;
    int __gen_e_acsl_and;
    int __gen_e_acsl_and_2;
    __e_acsl_assert_data_t __gen_e_acsl_assert_data = {.values = (void *)0};
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,
                                 "*((int *)\\old(arg))",0,
                                 *((int *)__gen_e_acsl_at));
    __gen_e_acsl_idx = *((int *)__gen_e_acsl_at);
    __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data,"&values[idx]",
                                 (void *)(& values[__gen_e_acsl_idx]));
    __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data,
                                   "sizeof(int *)",0,sizeof(int *));
    __gen_e_acsl_initialized = __e_acsl_initialized((void *)(& values[__gen_e_acsl_idx]),
                                                    sizeof(int *));
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,
                                 "\\initialized(&values[idx])",0,
                                 __gen_e_acsl_initialized);
    if (__gen_e_acsl_initialized) {
      int __gen_e_acsl_valid;
      __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data,"values[idx]",
                                   (void *)values[__gen_e_acsl_idx]);
      __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,
                                   "__gen_e_acsl_idx",0,__gen_e_acsl_idx);
      __gen_e_acsl_assert_data_2.blocking = 1;
      __gen_e_acsl_assert_data_2.kind = "RTE";
      __gen_e_acsl_assert_data_2.pred_txt = "__gen_e_acsl_idx < 10";
      __gen_e_acsl_assert_data_2.file = "parallel_threads.c";
      __gen_e_acsl_assert_data_2.fct = "write_value";
      __gen_e_acsl_assert_data_2.line = 32;
      __gen_e_acsl_assert_data_2.name = "index_bound";
      __e_acsl_assert(__gen_e_acsl_idx < 10,& __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_3 =
        {.values = (void *)0};
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_3,
                                   "__gen_e_acsl_idx",0,__gen_e_acsl_idx);
      __gen_e_acsl_assert_data_3.blocking = 1;
      __gen_e_acsl_assert_data_3.kind = "RTE";
      __gen_e_acsl_assert_data_3.pred_txt = "0 <= __gen_e_acsl_idx";
      __gen_e_acsl_assert_data_3.file = "parallel_threads.c";
      __gen_e_acsl_assert_data_3.fct = "write_value";
      __gen_e_acsl_assert_data_3.line = 32;
      __gen_e_acsl_assert_data_3.name = "index_bound";
      __e_acsl_assert(0 <= __gen_e_acsl_idx,& __gen_e_acsl_assert_data_3);
      __e_acsl_assert_clean(& __gen_e_acsl_assert_data_3);
      __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data,
                                     "sizeof(int)",0,sizeof(int));
      __gen_e_acsl_valid = __e_acsl_valid((void *)values[__gen_e_acsl_idx],
                                          sizeof(int),
                                          (void *)values[__gen_e_acsl_idx],
                                          (void *)(& values[__gen_e_acsl_idx]));
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,
                                   "\\valid(values[idx])",0,
                                   __gen_e_acsl_valid);
      __gen_e_acsl_and = __gen_e_acsl_valid;
    }
    else __gen_e_acsl_and = 0;
    if (__gen_e_acsl_and) {
      int __gen_e_acsl_initialized_2;
      __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data,"values[idx]",
                                   (void *)values[__gen_e_acsl_idx]);
      __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_idx",0,__gen_e_acsl_idx);
      __gen_e_acsl_assert_data_4.blocking = 1;
      __gen_e_acsl_assert_data_4.kind = "RTE";
      __gen_e_acsl_assert_data_4.pred_txt = "__gen_e_acsl_idx < 10";
      __gen_e_acsl_assert_data_4.file = "parallel_threads.c";
      __gen_e_acsl_assert_data_4.fct = "write_value";
      __gen_e_acsl_assert_data_4.line = 32;
      __gen_e_acsl_assert_data_4.name = "index_bound";
      __e_acsl_assert(__gen_e_acsl_idx < 10,& __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_idx",0,__gen_e_acsl_idx);
      __gen_e_acsl_assert_data_5.blocking = 1;
      __gen_e_acsl_assert_data_5.kind = "RTE";
      __gen_e_acsl_assert_data_5.pred_txt = "0 <= __gen_e_acsl_idx";
      __gen_e_acsl_assert_data_5.file = "parallel_threads.c";
      __gen_e_acsl_assert_data_5.fct = "write_value";
      __gen_e_acsl_assert_data_5.line = 32;
      __gen_e_acsl_assert_data_5.name = "index_bound";
      __e_acsl_assert(0 <= __gen_e_acsl_idx,& __gen_e_acsl_assert_data_5);
      __e_acsl_assert_clean(& __gen_e_acsl_assert_data_5);
      __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data,
                                     "sizeof(int)",0,sizeof(int));
      __gen_e_acsl_initialized_2 = __e_acsl_initialized((void *)values[__gen_e_acsl_idx],
                                                        sizeof(int));
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,
                                   "\\initialized(values[idx])",0,
                                   __gen_e_acsl_initialized_2);
      __gen_e_acsl_and_2 = __gen_e_acsl_initialized_2;
    }
    else __gen_e_acsl_and_2 = 0;
    __gen_e_acsl_assert_data.blocking = 1;
    __gen_e_acsl_assert_data.kind = "Postcondition";
    __gen_e_acsl_assert_data.pred_txt = "\\let idx = *((int *)\\old(arg));\n  \\valid(values[idx]) && \\initialized(values[idx])";
    __gen_e_acsl_assert_data.file = "parallel_threads.c";
    __gen_e_acsl_assert_data.fct = "write_value";
    __gen_e_acsl_assert_data.line = 31;
    __e_acsl_assert(__gen_e_acsl_and_2,& __gen_e_acsl_assert_data);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data);
    __e_acsl_delete_block((void *)(& arg));
    __e_acsl_delete_block((void *)(& __retres));
    return __retres;
  }
}

/*@ ensures result_ok_or_error: \result == 0 || \result == -1;
    assigns \result, Frama_C_entropy_source;
    assigns \result
      \from (indirect: usec), (indirect: Frama_C_entropy_source);
    assigns Frama_C_entropy_source \from Frama_C_entropy_source;
 */
int __gen_e_acsl_usleep(useconds_t usec)
{
  int __retres;
  __e_acsl_store_block((void *)(& __retres),4UL);
  __e_acsl_store_block((void *)(& usec),4UL);
  __retres = usleep(usec);
  {
    int __gen_e_acsl_or;
    __e_acsl_assert_data_t __gen_e_acsl_assert_data = {.values = (void *)0};
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,"\\result",0,
                                 __retres);
    if (__retres == 0) __gen_e_acsl_or = 1;
    else {
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,"\\result",0,
                                   __retres);
      __gen_e_acsl_or = __retres == -1;
    }
    __gen_e_acsl_assert_data.blocking = 1;
    __gen_e_acsl_assert_data.kind = "Postcondition";
    __gen_e_acsl_assert_data.pred_txt = "\\result == 0 || \\result == -1";
    __gen_e_acsl_assert_data.file = "FRAMAC_SHARE/libc/unistd.h";
    __gen_e_acsl_assert_data.fct = "usleep";
    __gen_e_acsl_assert_data.line = 1145;
    __gen_e_acsl_assert_data.name = "result_ok_or_error";
    __e_acsl_assert(__gen_e_acsl_or,& __gen_e_acsl_assert_data);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data);
    __e_acsl_delete_block((void *)(& usec));
    __e_acsl_delete_block((void *)(& __retres));
    return __retres;
  }
}

/*@ exits status: \exit_status == \old(status);
    ensures never_terminates: \false;
    
    assigns \exit_status \from status;
 */
void __gen_e_acsl_exit(int status)
{
  __e_acsl_store_block((void *)(& status),4UL);
  exit(status);
  {
    __e_acsl_assert_data_t __gen_e_acsl_assert_data = {.values = (void *)0};
    __gen_e_acsl_assert_data.blocking = 1;
    __gen_e_acsl_assert_data.kind = "Postcondition";
    __gen_e_acsl_assert_data.pred_txt = "\\false";
    __gen_e_acsl_assert_data.file = "FRAMAC_SHARE/libc/stdlib.h";
    __gen_e_acsl_assert_data.fct = "exit";
    __gen_e_acsl_assert_data.line = 508;
    __gen_e_acsl_assert_data.name = "never_terminates";
    __e_acsl_assert(0,& __gen_e_acsl_assert_data);
    __e_acsl_delete_block((void *)(& status));
    return;
  }
}

/*@ requires valid_string_s: valid_read_string(s);
    assigns __fc_stdout;
    assigns __fc_stdout \from __fc_errno, *(s + (0 .. strlen{Old}(s)));
 */
void __gen_e_acsl_perror(char const *s)
{
  __e_acsl_store_block((void *)(& s),8UL);
  perror(s);
  __e_acsl_delete_block((void *)(& s));
  return;
}

/*@ requires mutex_valid: \valid(mutex);
    ensures success_or_error: \result == 0 || \result == 1;
    assigns *mutex, \result;
    assigns *mutex \from *mutex;
    assigns \result \from (indirect: *mutex);
 */
int __gen_e_acsl_pthread_mutex_unlock(pthread_mutex_t *mutex)
{
  int __retres;
  __e_acsl_store_block((void *)(& __retres),4UL);
  {
    int __gen_e_acsl_valid;
    __e_acsl_store_block((void *)(& mutex),8UL);
    __e_acsl_assert_data_t __gen_e_acsl_assert_data = {.values = (void *)0};
    __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data,"mutex",
                                 (void *)mutex);
    __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data,
                                   "sizeof(pthread_mutex_t)",0,
                                   sizeof(pthread_mutex_t));
    __gen_e_acsl_valid = __e_acsl_valid((void *)mutex,
                                        sizeof(pthread_mutex_t),
                                        (void *)mutex,(void *)(& mutex));
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,"\\valid(mutex)",
                                 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(mutex)";
    __gen_e_acsl_assert_data.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data.fct = "pthread_mutex_unlock";
    __gen_e_acsl_assert_data.line = 313;
    __gen_e_acsl_assert_data.name = "mutex_valid";
    __e_acsl_assert(__gen_e_acsl_valid,& __gen_e_acsl_assert_data);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data);
  }
  __retres = pthread_mutex_unlock(mutex);
  {
    int __gen_e_acsl_or;
    __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,"\\result",0,
                                 __retres);
    if (__retres == 0) __gen_e_acsl_or = 1;
    else {
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_2,"\\result",0,
                                   __retres);
      __gen_e_acsl_or = __retres == 1;
    }
    __gen_e_acsl_assert_data_2.blocking = 1;
    __gen_e_acsl_assert_data_2.kind = "Postcondition";
    __gen_e_acsl_assert_data_2.pred_txt = "\\result == 0 || \\result == 1";
    __gen_e_acsl_assert_data_2.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data_2.fct = "pthread_mutex_unlock";
    __gen_e_acsl_assert_data_2.line = 316;
    __gen_e_acsl_assert_data_2.name = "success_or_error";
    __e_acsl_assert(__gen_e_acsl_or,& __gen_e_acsl_assert_data_2);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data_2);
    __e_acsl_delete_block((void *)(& mutex));
    __e_acsl_delete_block((void *)(& __retres));
    return __retres;
  }
}

/*@ requires mutex_valid: \valid(mutex);
    ensures
      success_or_error:
        \result == 0 || \result == 11 || \result == 22 || \result == 35;
    assigns *mutex, \result;
    assigns *mutex \from *mutex;
    assigns \result \from (indirect: *mutex);
 */
int __gen_e_acsl_pthread_mutex_lock(pthread_mutex_t *mutex)
{
  int __retres;
  __e_acsl_store_block((void *)(& __retres),4UL);
  {
    int __gen_e_acsl_valid;
    __e_acsl_store_block((void *)(& mutex),8UL);
    __e_acsl_assert_data_t __gen_e_acsl_assert_data = {.values = (void *)0};
    __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data,"mutex",
                                 (void *)mutex);
    __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data,
                                   "sizeof(pthread_mutex_t)",0,
                                   sizeof(pthread_mutex_t));
    __gen_e_acsl_valid = __e_acsl_valid((void *)mutex,
                                        sizeof(pthread_mutex_t),
                                        (void *)mutex,(void *)(& mutex));
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,"\\valid(mutex)",
                                 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(mutex)";
    __gen_e_acsl_assert_data.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data.fct = "pthread_mutex_lock";
    __gen_e_acsl_assert_data.line = 295;
    __gen_e_acsl_assert_data.name = "mutex_valid";
    __e_acsl_assert(__gen_e_acsl_valid,& __gen_e_acsl_assert_data);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data);
  }
  __retres = pthread_mutex_lock(mutex);
  {
    int __gen_e_acsl_or;
    int __gen_e_acsl_or_2;
    int __gen_e_acsl_or_3;
    __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,"\\result",0,
                                 __retres);
    if (__retres == 0) __gen_e_acsl_or = 1;
    else {
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_2,"\\result",0,
                                   __retres);
      __gen_e_acsl_or = __retres == 11;
    }
    if (__gen_e_acsl_or) __gen_e_acsl_or_2 = 1;
    else {
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_2,"\\result",0,
                                   __retres);
      __gen_e_acsl_or_2 = __retres == 22;
    }
    if (__gen_e_acsl_or_2) __gen_e_acsl_or_3 = 1;
    else {
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_2,"\\result",0,
                                   __retres);
      __gen_e_acsl_or_3 = __retres == 35;
    }
    __gen_e_acsl_assert_data_2.blocking = 1;
    __gen_e_acsl_assert_data_2.kind = "Postcondition";
    __gen_e_acsl_assert_data_2.pred_txt = "\\result == 0 || \\result == 11 || \\result == 22 || \\result == 35";
    __gen_e_acsl_assert_data_2.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data_2.fct = "pthread_mutex_lock";
    __gen_e_acsl_assert_data_2.line = 299;
    __gen_e_acsl_assert_data_2.name = "success_or_error";
    __e_acsl_assert(__gen_e_acsl_or_3,& __gen_e_acsl_assert_data_2);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data_2);
    __e_acsl_delete_block((void *)(& mutex));
    __e_acsl_delete_block((void *)(& __retres));
    return __retres;
  }
}

/*@ requires mutex_valid: \valid(mutex);
    requires attrs_valid_or_null: attrs == \null || \valid_read(attrs);
    ensures
      initialization: success_or_error:
        (\result == 0 && \initialized(\old(mutex))) || \result == 11 ||
        \result == 12 || \result == 1 || \result == 22;
    assigns *mutex, \result;
    assigns *mutex \from *mutex, *attrs;
    assigns \result \from (indirect: *mutex), (indirect: *attrs);
 */
int __gen_e_acsl_pthread_mutex_init(pthread_mutex_t * restrict mutex,
                                    pthread_mutexattr_t const * restrict attrs)
{
  pthread_mutex_t *__gen_e_acsl_at;
  int __retres;
  __e_acsl_store_block((void *)(& __retres),4UL);
  {
    int __gen_e_acsl_valid;
    int __gen_e_acsl_or;
    __e_acsl_store_block((void *)(& attrs),8UL);
    __e_acsl_store_block((void *)(& mutex),8UL);
    __gen_e_acsl_at = mutex;
    __e_acsl_assert_data_t __gen_e_acsl_assert_data = {.values = (void *)0};
    __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data,"mutex",
                                 (void *)mutex);
    __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data,
                                   "sizeof(pthread_mutex_t)",0,
                                   sizeof(pthread_mutex_t));
    __gen_e_acsl_valid = __e_acsl_valid((void *)mutex,
                                        sizeof(pthread_mutex_t),
                                        (void *)mutex,(void *)(& mutex));
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,"\\valid(mutex)",
                                 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(mutex)";
    __gen_e_acsl_assert_data.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data.fct = "pthread_mutex_init";
    __gen_e_acsl_assert_data.line = 279;
    __gen_e_acsl_assert_data.name = "mutex_valid";
    __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,"attrs",
                                 (void *)attrs);
    if (attrs == (pthread_mutexattr_t const *)0) __gen_e_acsl_or = 1;
    else {
      int __gen_e_acsl_valid_read;
      __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data_2,"attrs",
                                   (void *)attrs);
      __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data_2,
                                     "sizeof(pthread_mutexattr_t const)",0,
                                     sizeof(pthread_mutexattr_t const));
      __gen_e_acsl_valid_read = __e_acsl_valid_read((void *)attrs,
                                                    sizeof(pthread_mutexattr_t const),
                                                    (void *)attrs,
                                                    (void *)(& attrs));
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_2,
                                   "\\valid_read(attrs)",0,
                                   __gen_e_acsl_valid_read);
      __gen_e_acsl_or = __gen_e_acsl_valid_read;
    }
    __gen_e_acsl_assert_data_2.blocking = 1;
    __gen_e_acsl_assert_data_2.kind = "Precondition";
    __gen_e_acsl_assert_data_2.pred_txt = "attrs == \\null || \\valid_read(attrs)";
    __gen_e_acsl_assert_data_2.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data_2.fct = "pthread_mutex_init";
    __gen_e_acsl_assert_data_2.line = 280;
    __gen_e_acsl_assert_data_2.name = "attrs_valid_or_null";
    __e_acsl_assert(__gen_e_acsl_or,& __gen_e_acsl_assert_data_2);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data_2);
  }
  __retres = pthread_mutex_init(mutex,attrs);
  {
    int __gen_e_acsl_and;
    int __gen_e_acsl_or_2;
    int __gen_e_acsl_or_3;
    int __gen_e_acsl_or_4;
    int __gen_e_acsl_or_5;
    __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,"\\result",0,
                                 __retres);
    if (__retres == 0) {
      int __gen_e_acsl_initialized;
      __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data_3,
                                   "\\old(mutex)",(void *)__gen_e_acsl_at);
      __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data_3,
                                     "sizeof(pthread_mutex_t)",0,
                                     sizeof(pthread_mutex_t));
      __gen_e_acsl_initialized = __e_acsl_initialized((void *)__gen_e_acsl_at,
                                                      sizeof(pthread_mutex_t));
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_3,
                                   "\\initialized(\\old(mutex))",0,
                                   __gen_e_acsl_initialized);
      __gen_e_acsl_and = __gen_e_acsl_initialized;
    }
    else __gen_e_acsl_and = 0;
    if (__gen_e_acsl_and) __gen_e_acsl_or_2 = 1;
    else {
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_3,"\\result",0,
                                   __retres);
      __gen_e_acsl_or_2 = __retres == 11;
    }
    if (__gen_e_acsl_or_2) __gen_e_acsl_or_3 = 1;
    else {
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_3,"\\result",0,
                                   __retres);
      __gen_e_acsl_or_3 = __retres == 12;
    }
    if (__gen_e_acsl_or_3) __gen_e_acsl_or_4 = 1;
    else {
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_3,"\\result",0,
                                   __retres);
      __gen_e_acsl_or_4 = __retres == 1;
    }
    if (__gen_e_acsl_or_4) __gen_e_acsl_or_5 = 1;
    else {
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_3,"\\result",0,
                                   __retres);
      __gen_e_acsl_or_5 = __retres == 22;
    }
    __gen_e_acsl_assert_data_3.blocking = 1;
    __gen_e_acsl_assert_data_3.kind = "Postcondition";
    __gen_e_acsl_assert_data_3.pred_txt = "(\\result == 0 && \\initialized(\\old(mutex))) || \\result == 11 || \\result == 12 ||\n\\result == 1 || \\result == 22";
    __gen_e_acsl_assert_data_3.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data_3.fct = "pthread_mutex_init";
    __gen_e_acsl_assert_data_3.line = 285;
    __gen_e_acsl_assert_data_3.name = "initialization/success_or_error";
    __e_acsl_assert(__gen_e_acsl_or_5,& __gen_e_acsl_assert_data_3);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data_3);
    __e_acsl_delete_block((void *)(& attrs));
    __e_acsl_delete_block((void *)(& mutex));
    __e_acsl_delete_block((void *)(& __retres));
    return __retres;
  }
}

/*@ requires valid_or_null_retval: retval == \null || \valid(retval);
    ensures
      success_or_error:
        \result == 0 || \result == 35 || \result == 22 || \result == 3;
    assigns *retval, \result;
    assigns *retval \from thread;
    assigns \result \from (indirect: thread);
    
    behavior ignore_retval:
      assumes null_retval: retval == \null;
      assigns \result;
      assigns \result \from (indirect: thread);
    
    behavior use_retval:
      assumes valid_retval: \valid(retval);
      assigns *retval, \result;
      assigns *retval \from thread;
      assigns \result \from (indirect: thread);
 */
int __gen_e_acsl_pthread_join(pthread_t thread, void **retval)
{
  __e_acsl_contract_t *__gen_e_acsl_contract;
  int __retres;
  __e_acsl_store_block((void *)(& __retres),4UL);
  {
    int __gen_e_acsl_or;
    int __gen_e_acsl_valid_2;
    __e_acsl_store_block((void *)(& retval),8UL);
    __e_acsl_store_block((void *)(& thread),4UL);
    __gen_e_acsl_contract = __e_acsl_contract_init(2UL);
    __e_acsl_assert_data_t __gen_e_acsl_assert_data = {.values = (void *)0};
    __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data,"retval",
                                 (void *)retval);
    if (retval == (void **)0) __gen_e_acsl_or = 1;
    else {
      int __gen_e_acsl_valid;
      __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data,"retval",
                                   (void *)retval);
      __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data,
                                     "sizeof(void *)",0,sizeof(void *));
      __gen_e_acsl_valid = __e_acsl_valid((void *)retval,sizeof(void *),
                                          (void *)retval,(void *)(& retval));
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,
                                   "\\valid(retval)",0,__gen_e_acsl_valid);
      __gen_e_acsl_or = __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 = "retval == \\null || \\valid(retval)";
    __gen_e_acsl_assert_data.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data.fct = "pthread_join";
    __gen_e_acsl_assert_data.line = 247;
    __gen_e_acsl_assert_data.name = "valid_or_null_retval";
    __e_acsl_assert(__gen_e_acsl_or,& __gen_e_acsl_assert_data);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data);
    __e_acsl_contract_set_behavior_assumes(__gen_e_acsl_contract,0UL,
                                           retval == (void **)0);
    __gen_e_acsl_valid_2 = __e_acsl_valid((void *)retval,sizeof(void *),
                                          (void *)retval,(void *)(& retval));
    __e_acsl_contract_set_behavior_assumes(__gen_e_acsl_contract,1UL,
                                           __gen_e_acsl_valid_2);
  }
  __retres = pthread_join(thread,retval);
  {
    int __gen_e_acsl_or_2;
    int __gen_e_acsl_or_3;
    int __gen_e_acsl_or_4;
    __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,"\\result",0,
                                 __retres);
    if (__retres == 0) __gen_e_acsl_or_2 = 1;
    else {
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_2,"\\result",0,
                                   __retres);
      __gen_e_acsl_or_2 = __retres == 35;
    }
    if (__gen_e_acsl_or_2) __gen_e_acsl_or_3 = 1;
    else {
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_2,"\\result",0,
                                   __retres);
      __gen_e_acsl_or_3 = __retres == 22;
    }
    if (__gen_e_acsl_or_3) __gen_e_acsl_or_4 = 1;
    else {
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_2,"\\result",0,
                                   __retres);
      __gen_e_acsl_or_4 = __retres == 3;
    }
    __gen_e_acsl_assert_data_2.blocking = 1;
    __gen_e_acsl_assert_data_2.kind = "Postcondition";
    __gen_e_acsl_assert_data_2.pred_txt = "\\result == 0 || \\result == 35 || \\result == 22 || \\result == 3";
    __gen_e_acsl_assert_data_2.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data_2.fct = "pthread_join";
    __gen_e_acsl_assert_data_2.line = 251;
    __gen_e_acsl_assert_data_2.name = "success_or_error";
    __e_acsl_assert(__gen_e_acsl_or_4,& __gen_e_acsl_assert_data_2);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data_2);
    __e_acsl_contract_clean(__gen_e_acsl_contract);
    __e_acsl_delete_block((void *)(& retval));
    __e_acsl_delete_block((void *)(& thread));
    __e_acsl_delete_block((void *)(& __retres));
    return __retres;
  }
}

/*@ requires valid_thread: \valid(thread);
    requires valid_null_attr: attr == \null || \valid_read(attr);
    requires valid_routine: \valid_function(start_routine);
    requires valid_null_arg: arg == \null || \valid((char *)arg);
    ensures
      success_or_error:
        \result == 0 || \result == 11 || \result == 22 || \result == 1;
    assigns *thread, \result;
    assigns *thread \from *attr;
    assigns \result \from (indirect: *attr);
 */
int __gen_e_acsl_pthread_create(pthread_t * restrict thread,
                                pthread_attr_t const * restrict attr,
                                void *(*start_routine)(void *),
                                void * restrict arg)
{
  int __retres;
  __e_acsl_store_block((void *)(& __retres),4UL);
  {
    int __gen_e_acsl_valid;
    int __gen_e_acsl_or;
    int __gen_e_acsl_or_2;
    __e_acsl_store_block((void *)(& arg),8UL);
    __e_acsl_store_block((void *)(& start_routine),8UL);
    __e_acsl_store_block((void *)(& attr),8UL);
    __e_acsl_store_block((void *)(& thread),8UL);
    __e_acsl_assert_data_t __gen_e_acsl_assert_data = {.values = (void *)0};
    __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data,"thread",
                                 (void *)thread);
    __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data,
                                   "sizeof(pthread_t)",0,sizeof(pthread_t));
    __gen_e_acsl_valid = __e_acsl_valid((void *)thread,sizeof(pthread_t),
                                        (void *)thread,(void *)(& thread));
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,
                                 "\\valid(thread)",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(thread)";
    __gen_e_acsl_assert_data.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data.fct = "pthread_create";
    __gen_e_acsl_assert_data.line = 223;
    __gen_e_acsl_assert_data.name = "valid_thread";
    __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,"attr",
                                 (void *)attr);
    if (attr == (pthread_attr_t const *)0) __gen_e_acsl_or = 1;
    else {
      int __gen_e_acsl_valid_read;
      __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data_2,"attr",
                                   (void *)attr);
      __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data_2,
                                     "sizeof(pthread_attr_t const)",0,
                                     sizeof(pthread_attr_t const));
      __gen_e_acsl_valid_read = __e_acsl_valid_read((void *)attr,
                                                    sizeof(pthread_attr_t const),
                                                    (void *)attr,
                                                    (void *)(& attr));
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_2,
                                   "\\valid_read(attr)",0,
                                   __gen_e_acsl_valid_read);
      __gen_e_acsl_or = __gen_e_acsl_valid_read;
    }
    __gen_e_acsl_assert_data_2.blocking = 1;
    __gen_e_acsl_assert_data_2.kind = "Precondition";
    __gen_e_acsl_assert_data_2.pred_txt = "attr == \\null || \\valid_read(attr)";
    __gen_e_acsl_assert_data_2.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data_2.fct = "pthread_create";
    __gen_e_acsl_assert_data_2.line = 224;
    __gen_e_acsl_assert_data_2.name = "valid_null_attr";
    __e_acsl_assert(__gen_e_acsl_or,& __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_4 =
      {.values = (void *)0};
    __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data_4,"arg",arg);
    if (arg == (void *)0) __gen_e_acsl_or_2 = 1;
    else {
      int __gen_e_acsl_valid_2;
      __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data_4,"arg",arg);
      __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data_4,
                                     "sizeof(char)",0,sizeof(char));
      __gen_e_acsl_valid_2 = __e_acsl_valid(arg,sizeof(char),arg,
                                            (void *)(& arg));
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_4,
                                   "\\valid((char *)arg)",0,
                                   __gen_e_acsl_valid_2);
      __gen_e_acsl_or_2 = __gen_e_acsl_valid_2;
    }
    __gen_e_acsl_assert_data_4.blocking = 1;
    __gen_e_acsl_assert_data_4.kind = "Precondition";
    __gen_e_acsl_assert_data_4.pred_txt = "arg == \\null || \\valid((char *)arg)";
    __gen_e_acsl_assert_data_4.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data_4.fct = "pthread_create";
    __gen_e_acsl_assert_data_4.line = 226;
    __gen_e_acsl_assert_data_4.name = "valid_null_arg";
    __e_acsl_assert(__gen_e_acsl_or_2,& __gen_e_acsl_assert_data_4);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data_4);
  }
  __retres = __e_acsl_pthread_create(thread,attr,start_routine,arg);
  {
    int __gen_e_acsl_or_3;
    int __gen_e_acsl_or_4;
    int __gen_e_acsl_or_5;
    __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,"\\result",0,
                                 __retres);
    if (__retres == 0) __gen_e_acsl_or_3 = 1;
    else {
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_5,"\\result",0,
                                   __retres);
      __gen_e_acsl_or_3 = __retres == 11;
    }
    if (__gen_e_acsl_or_3) __gen_e_acsl_or_4 = 1;
    else {
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_5,"\\result",0,
                                   __retres);
      __gen_e_acsl_or_4 = __retres == 22;
    }
    if (__gen_e_acsl_or_4) __gen_e_acsl_or_5 = 1;
    else {
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_5,"\\result",0,
                                   __retres);
      __gen_e_acsl_or_5 = __retres == 1;
    }
    __gen_e_acsl_assert_data_5.blocking = 1;
    __gen_e_acsl_assert_data_5.kind = "Postcondition";
    __gen_e_acsl_assert_data_5.pred_txt = "\\result == 0 || \\result == 11 || \\result == 22 || \\result == 1";
    __gen_e_acsl_assert_data_5.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data_5.fct = "pthread_create";
    __gen_e_acsl_assert_data_5.line = 230;
    __gen_e_acsl_assert_data_5.name = "success_or_error";
    __e_acsl_assert(__gen_e_acsl_or_5,& __gen_e_acsl_assert_data_5);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data_5);
    __e_acsl_delete_block((void *)(& arg));
    __e_acsl_delete_block((void *)(& start_routine));
    __e_acsl_delete_block((void *)(& attr));
    __e_acsl_delete_block((void *)(& thread));
    __e_acsl_delete_block((void *)(& __retres));
    return __retres;
  }
}

/*@ requires valid_cond: \valid(cond);
    requires valid_mutex: \valid(mutex);
    ensures success: \result == 0;
    assigns \result;
    assigns \result \from \nothing;
 */
int __gen_e_acsl_pthread_cond_wait(pthread_cond_t * restrict cond,
                                   pthread_mutex_t * restrict mutex)
{
  int __retres;
  __e_acsl_store_block((void *)(& __retres),4UL);
  {
    int __gen_e_acsl_valid;
    int __gen_e_acsl_valid_2;
    __e_acsl_store_block((void *)(& mutex),8UL);
    __e_acsl_store_block((void *)(& cond),8UL);
    __e_acsl_assert_data_t __gen_e_acsl_assert_data = {.values = (void *)0};
    __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data,"cond",
                                 (void *)cond);
    __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data,
                                   "sizeof(pthread_cond_t)",0,
                                   sizeof(pthread_cond_t));
    __gen_e_acsl_valid = __e_acsl_valid((void *)cond,sizeof(pthread_cond_t),
                                        (void *)cond,(void *)(& cond));
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,"\\valid(cond)",
                                 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(cond)";
    __gen_e_acsl_assert_data.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data.fct = "pthread_cond_wait";
    __gen_e_acsl_assert_data.line = 203;
    __gen_e_acsl_assert_data.name = "valid_cond";
    __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,"mutex",
                                 (void *)mutex);
    __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data_2,
                                   "sizeof(pthread_mutex_t)",0,
                                   sizeof(pthread_mutex_t));
    __gen_e_acsl_valid_2 = __e_acsl_valid((void *)mutex,
                                          sizeof(pthread_mutex_t),
                                          (void *)mutex,(void *)(& mutex));
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_2,
                                 "\\valid(mutex)",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(mutex)";
    __gen_e_acsl_assert_data_2.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data_2.fct = "pthread_cond_wait";
    __gen_e_acsl_assert_data_2.line = 204;
    __gen_e_acsl_assert_data_2.name = "valid_mutex";
    __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 = pthread_cond_wait(cond,mutex);
  {
    __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,"\\result",0,
                                 __retres);
    __gen_e_acsl_assert_data_3.blocking = 1;
    __gen_e_acsl_assert_data_3.kind = "Postcondition";
    __gen_e_acsl_assert_data_3.pred_txt = "\\result == 0";
    __gen_e_acsl_assert_data_3.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data_3.fct = "pthread_cond_wait";
    __gen_e_acsl_assert_data_3.line = 206;
    __gen_e_acsl_assert_data_3.name = "success";
    __e_acsl_assert(__retres == 0,& __gen_e_acsl_assert_data_3);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data_3);
    __e_acsl_delete_block((void *)(& mutex));
    __e_acsl_delete_block((void *)(& cond));
    __e_acsl_delete_block((void *)(& __retres));
    return __retres;
  }
}

/*@ requires valid_cond: \valid(cond);
    requires valid_null_attr: attr == \null || \valid_read(attr);
    ensures initialization: cond: \initialized(\old(cond));
    ensures success: \result == 0;
    assigns *cond, \result;
    assigns *cond \from *attr;
    assigns \result \from \nothing;
 */
int __gen_e_acsl_pthread_cond_init(pthread_cond_t * restrict cond,
                                   pthread_condattr_t const * restrict attr)
{
  pthread_cond_t *__gen_e_acsl_at;
  int __retres;
  __e_acsl_store_block((void *)(& __retres),4UL);
  {
    int __gen_e_acsl_valid;
    int __gen_e_acsl_or;
    __e_acsl_store_block((void *)(& attr),8UL);
    __e_acsl_store_block((void *)(& cond),8UL);
    __gen_e_acsl_at = cond;
    __e_acsl_assert_data_t __gen_e_acsl_assert_data = {.values = (void *)0};
    __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data,"cond",
                                 (void *)cond);
    __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data,
                                   "sizeof(pthread_cond_t)",0,
                                   sizeof(pthread_cond_t));
    __gen_e_acsl_valid = __e_acsl_valid((void *)cond,sizeof(pthread_cond_t),
                                        (void *)cond,(void *)(& cond));
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,"\\valid(cond)",
                                 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(cond)";
    __gen_e_acsl_assert_data.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data.fct = "pthread_cond_init";
    __gen_e_acsl_assert_data.line = 187;
    __gen_e_acsl_assert_data.name = "valid_cond";
    __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,"attr",
                                 (void *)attr);
    if (attr == (pthread_condattr_t const *)0) __gen_e_acsl_or = 1;
    else {
      int __gen_e_acsl_valid_read;
      __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data_2,"attr",
                                   (void *)attr);
      __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data_2,
                                     "sizeof(pthread_condattr_t const)",0,
                                     sizeof(pthread_condattr_t const));
      __gen_e_acsl_valid_read = __e_acsl_valid_read((void *)attr,
                                                    sizeof(pthread_condattr_t const),
                                                    (void *)attr,
                                                    (void *)(& attr));
      __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_2,
                                   "\\valid_read(attr)",0,
                                   __gen_e_acsl_valid_read);
      __gen_e_acsl_or = __gen_e_acsl_valid_read;
    }
    __gen_e_acsl_assert_data_2.blocking = 1;
    __gen_e_acsl_assert_data_2.kind = "Precondition";
    __gen_e_acsl_assert_data_2.pred_txt = "attr == \\null || \\valid_read(attr)";
    __gen_e_acsl_assert_data_2.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data_2.fct = "pthread_cond_init";
    __gen_e_acsl_assert_data_2.line = 188;
    __gen_e_acsl_assert_data_2.name = "valid_null_attr";
    __e_acsl_assert(__gen_e_acsl_or,& __gen_e_acsl_assert_data_2);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data_2);
  }
  __retres = pthread_cond_init(cond,attr);
  {
    int __gen_e_acsl_initialized;
    __e_acsl_assert_data_t __gen_e_acsl_assert_data_3 =
      {.values = (void *)0};
    __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data_3,"\\old(cond)",
                                 (void *)__gen_e_acsl_at);
    __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data_3,
                                   "sizeof(pthread_cond_t)",0,
                                   sizeof(pthread_cond_t));
    __gen_e_acsl_initialized = __e_acsl_initialized((void *)__gen_e_acsl_at,
                                                    sizeof(pthread_cond_t));
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data_3,
                                 "initialization: cond: \\initialized(\\old(cond))",
                                 0,__gen_e_acsl_initialized);
    __gen_e_acsl_assert_data_3.blocking = 1;
    __gen_e_acsl_assert_data_3.kind = "Postcondition";
    __gen_e_acsl_assert_data_3.pred_txt = "\\initialized(\\old(cond))";
    __gen_e_acsl_assert_data_3.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data_3.fct = "pthread_cond_init";
    __gen_e_acsl_assert_data_3.line = 191;
    __gen_e_acsl_assert_data_3.name = "initialization/cond";
    __e_acsl_assert(__gen_e_acsl_initialized,& __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,"\\result",0,
                                 __retres);
    __gen_e_acsl_assert_data_4.blocking = 1;
    __gen_e_acsl_assert_data_4.kind = "Postcondition";
    __gen_e_acsl_assert_data_4.pred_txt = "\\result == 0";
    __gen_e_acsl_assert_data_4.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data_4.fct = "pthread_cond_init";
    __gen_e_acsl_assert_data_4.line = 192;
    __gen_e_acsl_assert_data_4.name = "success";
    __e_acsl_assert(__retres == 0,& __gen_e_acsl_assert_data_4);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data_4);
    __e_acsl_delete_block((void *)(& attr));
    __e_acsl_delete_block((void *)(& cond));
    __e_acsl_delete_block((void *)(& __retres));
    return __retres;
  }
}

/*@ requires valid_cond: \valid(cond);
    ensures sucess: \result == 0;
    assigns \result;
    assigns \result \from \nothing;
 */
int __gen_e_acsl_pthread_cond_broadcast(pthread_cond_t *cond)
{
  int __retres;
  __e_acsl_store_block((void *)(& __retres),4UL);
  {
    int __gen_e_acsl_valid;
    __e_acsl_store_block((void *)(& cond),8UL);
    __e_acsl_assert_data_t __gen_e_acsl_assert_data = {.values = (void *)0};
    __e_acsl_assert_register_ptr(& __gen_e_acsl_assert_data,"cond",
                                 (void *)cond);
    __e_acsl_assert_register_ulong(& __gen_e_acsl_assert_data,
                                   "sizeof(pthread_cond_t)",0,
                                   sizeof(pthread_cond_t));
    __gen_e_acsl_valid = __e_acsl_valid((void *)cond,sizeof(pthread_cond_t),
                                        (void *)cond,(void *)(& cond));
    __e_acsl_assert_register_int(& __gen_e_acsl_assert_data,"\\valid(cond)",
                                 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(cond)";
    __gen_e_acsl_assert_data.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data.fct = "pthread_cond_broadcast";
    __gen_e_acsl_assert_data.line = 173;
    __gen_e_acsl_assert_data.name = "valid_cond";
    __e_acsl_assert(__gen_e_acsl_valid,& __gen_e_acsl_assert_data);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data);
  }
  __retres = pthread_cond_broadcast(cond);
  {
    __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,"\\result",0,
                                 __retres);
    __gen_e_acsl_assert_data_2.blocking = 1;
    __gen_e_acsl_assert_data_2.kind = "Postcondition";
    __gen_e_acsl_assert_data_2.pred_txt = "\\result == 0";
    __gen_e_acsl_assert_data_2.file = "FRAMAC_SHARE/libc/pthread.h";
    __gen_e_acsl_assert_data_2.fct = "pthread_cond_broadcast";
    __gen_e_acsl_assert_data_2.line = 175;
    __gen_e_acsl_assert_data_2.name = "sucess";
    __e_acsl_assert(__retres == 0,& __gen_e_acsl_assert_data_2);
    __e_acsl_assert_clean(& __gen_e_acsl_assert_data_2);
    __e_acsl_delete_block((void *)(& cond));
    __e_acsl_delete_block((void *)(& __retres));
    return __retres;
  }
}

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_2 = "Unable to wait on condvar in write_value()";
    __e_acsl_store_block((void *)__gen_e_acsl_literal_string_2,
                         sizeof("Unable to wait on condvar in write_value()"));
    __e_acsl_full_init((void *)__gen_e_acsl_literal_string_2);
    __e_acsl_mark_readonly((void *)__gen_e_acsl_literal_string_2);
    __gen_e_acsl_literal_string_5 = "Unable to wait on condvar in read_value()";
    __e_acsl_store_block((void *)__gen_e_acsl_literal_string_5,
                         sizeof("Unable to wait on condvar in read_value()"));
    __e_acsl_full_init((void *)__gen_e_acsl_literal_string_5);
    __e_acsl_mark_readonly((void *)__gen_e_acsl_literal_string_5);
    __gen_e_acsl_literal_string_3 = "Unable to unlock mutex in write_value()";
    __e_acsl_store_block((void *)__gen_e_acsl_literal_string_3,
                         sizeof("Unable to unlock mutex in write_value()"));
    __e_acsl_full_init((void *)__gen_e_acsl_literal_string_3);
    __e_acsl_mark_readonly((void *)__gen_e_acsl_literal_string_3);
    __gen_e_acsl_literal_string_6 = "Unable to unlock mutex in read_value()";
    __e_acsl_store_block((void *)__gen_e_acsl_literal_string_6,
                         sizeof("Unable to unlock mutex in read_value()"));
    __e_acsl_full_init((void *)__gen_e_acsl_literal_string_6);
    __e_acsl_mark_readonly((void *)__gen_e_acsl_literal_string_6);
    __gen_e_acsl_literal_string_11 = "Unable to lock write_mutex";
    __e_acsl_store_block((void *)__gen_e_acsl_literal_string_11,
                         sizeof("Unable to lock write_mutex"));
    __e_acsl_full_init((void *)__gen_e_acsl_literal_string_11);
    __e_acsl_mark_readonly((void *)__gen_e_acsl_literal_string_11);
    __gen_e_acsl_literal_string_12 = "Unable to lock read_mutex";
    __e_acsl_store_block((void *)__gen_e_acsl_literal_string_12,
                         sizeof("Unable to lock read_mutex"));
    __e_acsl_full_init((void *)__gen_e_acsl_literal_string_12);
    __e_acsl_mark_readonly((void *)__gen_e_acsl_literal_string_12);
    __gen_e_acsl_literal_string = "Unable to lock mutex in write_value()";
    __e_acsl_store_block((void *)__gen_e_acsl_literal_string,
                         sizeof("Unable to lock mutex in write_value()"));
    __e_acsl_full_init((void *)__gen_e_acsl_literal_string);
    __e_acsl_mark_readonly((void *)__gen_e_acsl_literal_string);
    __gen_e_acsl_literal_string_4 = "Unable to lock mutex in read_value()";
    __e_acsl_store_block((void *)__gen_e_acsl_literal_string_4,
                         sizeof("Unable to lock mutex in read_value()"));
    __e_acsl_full_init((void *)__gen_e_acsl_literal_string_4);
    __e_acsl_mark_readonly((void *)__gen_e_acsl_literal_string_4);
    __gen_e_acsl_literal_string_7 = "Unable to initialize write mutex";
    __e_acsl_store_block((void *)__gen_e_acsl_literal_string_7,
                         sizeof("Unable to initialize write mutex"));
    __e_acsl_full_init((void *)__gen_e_acsl_literal_string_7);
    __e_acsl_mark_readonly((void *)__gen_e_acsl_literal_string_7);
    __gen_e_acsl_literal_string_8 = "Unable to initialize write cond var";
    __e_acsl_store_block((void *)__gen_e_acsl_literal_string_8,
                         sizeof("Unable to initialize write cond var"));
    __e_acsl_full_init((void *)__gen_e_acsl_literal_string_8);
    __e_acsl_mark_readonly((void *)__gen_e_acsl_literal_string_8);
    __gen_e_acsl_literal_string_9 = "Unable to initialize read mutex";
    __e_acsl_store_block((void *)__gen_e_acsl_literal_string_9,
                         sizeof("Unable to initialize read mutex"));
    __e_acsl_full_init((void *)__gen_e_acsl_literal_string_9);
    __e_acsl_mark_readonly((void *)__gen_e_acsl_literal_string_9);
    __gen_e_acsl_literal_string_10 = "Unable to initialize read cond var";
    __e_acsl_store_block((void *)__gen_e_acsl_literal_string_10,
                         sizeof("Unable to initialize read cond var"));
    __e_acsl_full_init((void *)__gen_e_acsl_literal_string_10);
    __e_acsl_mark_readonly((void *)__gen_e_acsl_literal_string_10);
    __gen_e_acsl_literal_string_13 = "Unable to broadcast to write cond var";
    __e_acsl_store_block((void *)__gen_e_acsl_literal_string_13,
                         sizeof("Unable to broadcast to write cond var"));
    __e_acsl_full_init((void *)__gen_e_acsl_literal_string_13);
    __e_acsl_mark_readonly((void *)__gen_e_acsl_literal_string_13);
    __gen_e_acsl_literal_string_14 = "Unable to broadcast to read cond var";
    __e_acsl_store_block((void *)__gen_e_acsl_literal_string_14,
                         sizeof("Unable to broadcast to read cond var"));
    __e_acsl_full_init((void *)__gen_e_acsl_literal_string_14);
    __e_acsl_mark_readonly((void *)__gen_e_acsl_literal_string_14);
    __e_acsl_store_block((void *)(& __gen_e_acsl_read_value),1UL);
    __e_acsl_full_init((void *)(& __gen_e_acsl_read_value));
    __e_acsl_store_block((void *)(& __gen_e_acsl_write_value),1UL);
    __e_acsl_full_init((void *)(& __gen_e_acsl_write_value));
    __e_acsl_store_block((void *)(& __gen_e_acsl_usleep),1UL);
    __e_acsl_full_init((void *)(& __gen_e_acsl_usleep));
    __e_acsl_store_block((void *)(& __gen_e_acsl_exit),1UL);
    __e_acsl_full_init((void *)(& __gen_e_acsl_exit));
    __e_acsl_store_block((void *)(& __gen_e_acsl_perror),1UL);
    __e_acsl_full_init((void *)(& __gen_e_acsl_perror));
    __e_acsl_store_block((void *)(& __gen_e_acsl_pthread_mutex_unlock),1UL);
    __e_acsl_full_init((void *)(& __gen_e_acsl_pthread_mutex_unlock));
    __e_acsl_store_block((void *)(& __gen_e_acsl_pthread_mutex_lock),1UL);
    __e_acsl_full_init((void *)(& __gen_e_acsl_pthread_mutex_lock));
    __e_acsl_store_block((void *)(& __gen_e_acsl_pthread_mutex_init),1UL);
    __e_acsl_full_init((void *)(& __gen_e_acsl_pthread_mutex_init));
    __e_acsl_store_block((void *)(& __gen_e_acsl_pthread_join),1UL);
    __e_acsl_full_init((void *)(& __gen_e_acsl_pthread_join));
    __e_acsl_store_block((void *)(& __gen_e_acsl_pthread_create),1UL);
    __e_acsl_full_init((void *)(& __gen_e_acsl_pthread_create));
    __e_acsl_store_block((void *)(& __gen_e_acsl_pthread_cond_wait),1UL);
    __e_acsl_full_init((void *)(& __gen_e_acsl_pthread_cond_wait));
    __e_acsl_store_block((void *)(& __gen_e_acsl_pthread_cond_init),1UL);
    __e_acsl_full_init((void *)(& __gen_e_acsl_pthread_cond_init));
    __e_acsl_store_block((void *)(& __gen_e_acsl_pthread_cond_broadcast),1UL);
    __e_acsl_full_init((void *)(& __gen_e_acsl_pthread_cond_broadcast));
    __e_acsl_store_block((void *)(& read_value),1UL);
    __e_acsl_full_init((void *)(& read_value));
    __e_acsl_store_block((void *)(& write_value),1UL);
    __e_acsl_full_init((void *)(& write_value));
    __e_acsl_store_block((void *)(& read_mutex),4UL);
    __e_acsl_full_init((void *)(& read_mutex));
    __e_acsl_store_block((void *)(& write_mutex),4UL);
    __e_acsl_full_init((void *)(& write_mutex));
    __e_acsl_store_block((void *)(& read_cond),4UL);
    __e_acsl_full_init((void *)(& read_cond));
    __e_acsl_store_block((void *)(& write_cond),4UL);
    __e_acsl_full_init((void *)(& write_cond));
    __e_acsl_store_block((void *)(& read_count),4UL);
    __e_acsl_full_init((void *)(& read_count));
    __e_acsl_store_block((void *)(& write_count),4UL);
    __e_acsl_full_init((void *)(& write_count));
    __e_acsl_store_block((void *)(values),80UL);
    __e_acsl_full_init((void *)(& values));
    __e_acsl_store_block((void *)(& usleep),1UL);
    __e_acsl_full_init((void *)(& usleep));
    __e_acsl_store_block((void *)(& __fc_p_ttyname),8UL);
    __e_acsl_full_init((void *)(& __fc_p_ttyname));
    __e_acsl_store_block((void *)(ttyname),32UL);
    __e_acsl_full_init((void *)(& ttyname));
    __e_acsl_store_block((void *)(& Frama_C_entropy_source),4UL);
    __e_acsl_full_init((void *)(& Frama_C_entropy_source));
    __e_acsl_store_block((void *)(& exit),1UL);
    __e_acsl_full_init((void *)(& exit));
    __e_acsl_store_block((void *)(& free),1UL);
    __e_acsl_full_init((void *)(& free));
    __e_acsl_store_block((void *)(& malloc),1UL);
    __e_acsl_full_init((void *)(& malloc));
    __e_acsl_store_block((void *)(& __fc_p_random48_counter),8UL);
    __e_acsl_full_init((void *)(& __fc_p_random48_counter));
    __e_acsl_store_block((void *)(random48_counter),6UL);
    __e_acsl_full_init((void *)(& random48_counter));
    __e_acsl_store_block((void *)(& __fc_random48_init),4UL);
    __e_acsl_full_init((void *)(& __fc_random48_init));
    __e_acsl_store_block((void *)(& __fc_rand_max),8UL);
    __e_acsl_full_init((void *)(& __fc_rand_max));
    __e_acsl_store_block((void *)(& perror),1UL);
    __e_acsl_full_init((void *)(& perror));
    __e_acsl_store_block((void *)(& __fc_p_tmpnam),8UL);
    __e_acsl_full_init((void *)(& __fc_p_tmpnam));
    __e_acsl_store_block((void *)(__fc_tmpnam),2048UL);
    __e_acsl_full_init((void *)(& __fc_tmpnam));
    __e_acsl_store_block((void *)(& __fc_p_fopen),8UL);
    __e_acsl_full_init((void *)(& __fc_p_fopen));
    __e_acsl_store_block((void *)(__fc_fopen),128UL);
    __e_acsl_full_init((void *)(& __fc_fopen));
    __e_acsl_store_block((void *)(& stdout),8UL);
    __e_acsl_full_init((void *)(& stdout));
    __e_acsl_store_block((void *)(& stdin),8UL);
    __e_acsl_full_init((void *)(& stdin));
    __e_acsl_store_block((void *)(& __fc_interrupted),4UL);
    __e_acsl_full_init((void *)(& __fc_interrupted));
    __e_acsl_store_block((void *)(& __fc_p_time_tm),8UL);
    __e_acsl_full_init((void *)(& __fc_p_time_tm));
    __e_acsl_store_block((void *)(& __fc_time_tm),36UL);
    __e_acsl_full_init((void *)(& __fc_time_tm));
    __e_acsl_store_block((void *)(& __fc_p_ctime),8UL);
    __e_acsl_full_init((void *)(& __fc_p_ctime));
    __e_acsl_store_block((void *)(__fc_ctime),26UL);
    __e_acsl_full_init((void *)(& __fc_ctime));
    __e_acsl_store_block((void *)(& __fc_time),4UL);
    __e_acsl_full_init((void *)(& __fc_time));
    __e_acsl_store_block((void *)(& __fc_p_sigaction),8UL);
    __e_acsl_full_init((void *)(& __fc_p_sigaction));
    __e_acsl_store_block((void *)(sigaction),2080UL);
    __e_acsl_full_init((void *)(& sigaction));
    __e_acsl_store_block((void *)(& pthread_mutex_unlock),1UL);
    __e_acsl_full_init((void *)(& pthread_mutex_unlock));
    __e_acsl_store_block((void *)(& pthread_mutex_trylock),1UL);
    __e_acsl_full_init((void *)(& pthread_mutex_trylock));
    __e_acsl_store_block((void *)(& pthread_mutex_lock),1UL);
    __e_acsl_full_init((void *)(& pthread_mutex_lock));
    __e_acsl_store_block((void *)(& pthread_mutex_init),1UL);
    __e_acsl_full_init((void *)(& pthread_mutex_init));
    __e_acsl_store_block((void *)(& pthread_join),1UL);
    __e_acsl_full_init((void *)(& pthread_join));
    __e_acsl_store_block((void *)(& pthread_create),1UL);
    __e_acsl_full_init((void *)(& pthread_create));
    __e_acsl_store_block((void *)(& pthread_cond_wait),1UL);
    __e_acsl_full_init((void *)(& pthread_cond_wait));
    __e_acsl_store_block((void *)(& pthread_cond_init),1UL);
    __e_acsl_full_init((void *)(& pthread_cond_init));
    __e_acsl_store_block((void *)(& pthread_cond_broadcast),1UL);
    __e_acsl_full_init((void *)(& pthread_cond_broadcast));
    __e_acsl_store_block((void *)(& errno),4UL);
    __e_acsl_full_init((void *)(& errno));
  }
  return;
}

void __e_acsl_globals_clean(void)
{
  __e_acsl_delete_block((void *)(& __gen_e_acsl_read_value));
  __e_acsl_delete_block((void *)(& __gen_e_acsl_write_value));
  __e_acsl_delete_block((void *)(& __gen_e_acsl_usleep));
  __e_acsl_delete_block((void *)(& __gen_e_acsl_exit));
  __e_acsl_delete_block((void *)(& __gen_e_acsl_perror));
  __e_acsl_delete_block((void *)(& __gen_e_acsl_pthread_mutex_unlock));
  __e_acsl_delete_block((void *)(& __gen_e_acsl_pthread_mutex_lock));
  __e_acsl_delete_block((void *)(& __gen_e_acsl_pthread_mutex_init));
  __e_acsl_delete_block((void *)(& __gen_e_acsl_pthread_join));
  __e_acsl_delete_block((void *)(& __gen_e_acsl_pthread_create));
  __e_acsl_delete_block((void *)(& __gen_e_acsl_pthread_cond_wait));
  __e_acsl_delete_block((void *)(& __gen_e_acsl_pthread_cond_init));
  __e_acsl_delete_block((void *)(& __gen_e_acsl_pthread_cond_broadcast));
  __e_acsl_delete_block((void *)(& read_value));
  __e_acsl_delete_block((void *)(& write_value));
  __e_acsl_delete_block((void *)(& read_mutex));
  __e_acsl_delete_block((void *)(& write_mutex));
  __e_acsl_delete_block((void *)(& read_cond));
  __e_acsl_delete_block((void *)(& write_cond));
  __e_acsl_delete_block((void *)(& read_count));
  __e_acsl_delete_block((void *)(& write_count));
  __e_acsl_delete_block((void *)(values));
  __e_acsl_delete_block((void *)(& usleep));
  __e_acsl_delete_block((void *)(& __fc_p_ttyname));
  __e_acsl_delete_block((void *)(ttyname));
  __e_acsl_delete_block((void *)(& Frama_C_entropy_source));
  __e_acsl_delete_block((void *)(& exit));
  __e_acsl_delete_block((void *)(& free));
  __e_acsl_delete_block((void *)(& malloc));
  __e_acsl_delete_block((void *)(& __fc_p_random48_counter));
  __e_acsl_delete_block((void *)(random48_counter));
  __e_acsl_delete_block((void *)(& __fc_random48_init));
  __e_acsl_delete_block((void *)(& __fc_rand_max));
  __e_acsl_delete_block((void *)(& perror));
  __e_acsl_delete_block((void *)(& __fc_p_tmpnam));
  __e_acsl_delete_block((void *)(__fc_tmpnam));
  __e_acsl_delete_block((void *)(& __fc_p_fopen));
  __e_acsl_delete_block((void *)(__fc_fopen));
  __e_acsl_delete_block((void *)(& stdout));
  __e_acsl_delete_block((void *)(& stdin));
  __e_acsl_delete_block((void *)(& __fc_interrupted));
  __e_acsl_delete_block((void *)(& __fc_p_time_tm));
  __e_acsl_delete_block((void *)(& __fc_time_tm));
  __e_acsl_delete_block((void *)(& __fc_p_ctime));
  __e_acsl_delete_block((void *)(__fc_ctime));
  __e_acsl_delete_block((void *)(& __fc_time));
  __e_acsl_delete_block((void *)(& __fc_p_sigaction));
  __e_acsl_delete_block((void *)(sigaction));
  __e_acsl_delete_block((void *)(& pthread_mutex_unlock));
  __e_acsl_delete_block((void *)(& pthread_mutex_trylock));
  __e_acsl_delete_block((void *)(& pthread_mutex_lock));
  __e_acsl_delete_block((void *)(& pthread_mutex_init));
  __e_acsl_delete_block((void *)(& pthread_join));
  __e_acsl_delete_block((void *)(& pthread_create));
  __e_acsl_delete_block((void *)(& pthread_cond_wait));
  __e_acsl_delete_block((void *)(& pthread_cond_init));
  __e_acsl_delete_block((void *)(& pthread_cond_broadcast));
  __e_acsl_delete_block((void *)(& errno));
  return;
}

int main(void)
{
  int __retres;
  pthread_t writers[10];
  pthread_t readers[10];
  int args[10];
  int tmp;
  int tmp_0;
  int tmp_1;
  int tmp_2;
  int tmp_5;
  int tmp_6;
  __e_acsl_memory_init((int *)0,(char ***)0,8UL);
  __e_acsl_globals_init();
  __e_acsl_store_block((void *)(& tmp_6),4UL);
  __e_acsl_store_block((void *)(& tmp_5),4UL);
  __e_acsl_store_block((void *)(& tmp_2),4UL);
  __e_acsl_store_block((void *)(& tmp_1),4UL);
  __e_acsl_store_block((void *)(& tmp_0),4UL);
  __e_acsl_store_block((void *)(& tmp),4UL);
  __e_acsl_store_block((void *)(args),40UL);
  __e_acsl_store_block((void *)(readers),40UL);
  __e_acsl_store_block((void *)(writers),40UL);
  __e_acsl_store_block((void *)(& __retres),4UL);
  __e_acsl_full_init((void *)(& tmp));
  tmp = __gen_e_acsl_pthread_mutex_init(& write_mutex,
                                        (pthread_mutexattr_t const *)0);
  if (tmp != 0) {
    __gen_e_acsl_perror(__gen_e_acsl_literal_string_7);
    __gen_e_acsl_exit(1);
  }
  __e_acsl_full_init((void *)(& tmp_0));
  tmp_0 = __gen_e_acsl_pthread_cond_init(& write_cond,
                                         (pthread_condattr_t const *)0);
  if (tmp_0 != 0) {
    __gen_e_acsl_perror(__gen_e_acsl_literal_string_8);
    __gen_e_acsl_exit(1);
  }
  __e_acsl_full_init((void *)(& tmp_1));
  tmp_1 = __gen_e_acsl_pthread_mutex_init(& read_mutex,
                                          (pthread_mutexattr_t const *)0);
  if (tmp_1 != 0) {
    __gen_e_acsl_perror(__gen_e_acsl_literal_string_9);
    __gen_e_acsl_exit(1);
  }
  __e_acsl_full_init((void *)(& tmp_2));
  tmp_2 = __gen_e_acsl_pthread_cond_init(& read_cond,
                                         (pthread_condattr_t const *)0);
  if (tmp_2 != 0) {
    __gen_e_acsl_perror(__gen_e_acsl_literal_string_10);
    __gen_e_acsl_exit(1);
  }
  {
    int i = 0;
    __e_acsl_store_block((void *)(& i),4UL);
    __e_acsl_full_init((void *)(& i));
    while (i < 10) {
      __e_acsl_initialize((void *)(& args[i]),sizeof(int));
      args[i] = i;
      __gen_e_acsl_pthread_create(& writers[i],(pthread_attr_t const *)0,
                                  & __gen_e_acsl_write_value,
                                  (void *)(& args[i]));
      __gen_e_acsl_pthread_create(& readers[i],(pthread_attr_t const *)0,
                                  & __gen_e_acsl_read_value,
                                  (void *)(& args[i]));
      __e_acsl_full_init((void *)(& i));
      i ++;
    }
    __e_acsl_delete_block((void *)(& i));
  }
  while (1) {
    int res = pthread_mutex_trylock(& write_mutex);
    __e_acsl_store_block((void *)(& res),4UL);
    __e_acsl_full_init((void *)(& res));
    if (res == 0) {
      int done = write_count == 10;
      __e_acsl_store_block((void *)(& done),4UL);
      __e_acsl_full_init((void *)(& done));
      __gen_e_acsl_pthread_mutex_unlock(& write_mutex);
      if (done) {
        __e_acsl_delete_block((void *)(& res));
        __e_acsl_delete_block((void *)(& done));
        break;
      }
      __e_acsl_delete_block((void *)(& done));
    }
    else 
      if (res != 16) __gen_e_acsl_perror(__gen_e_acsl_literal_string_11);
    __gen_e_acsl_usleep((useconds_t)100);
    __e_acsl_delete_block((void *)(& res));
  }
  while (1) {
    int res_0 = pthread_mutex_trylock(& read_mutex);
    __e_acsl_store_block((void *)(& res_0),4UL);
    __e_acsl_full_init((void *)(& res_0));
    if (res_0 == 0) {
      int done_0 = read_count == 10;
      __e_acsl_store_block((void *)(& done_0),4UL);
      __e_acsl_full_init((void *)(& done_0));
      __gen_e_acsl_pthread_mutex_unlock(& read_mutex);
      if (done_0) {
        __e_acsl_delete_block((void *)(& res_0));
        __e_acsl_delete_block((void *)(& done_0));
        break;
      }
      __e_acsl_delete_block((void *)(& done_0));
    }
    else 
      if (res_0 != 16) __gen_e_acsl_perror(__gen_e_acsl_literal_string_12);
    __gen_e_acsl_usleep((useconds_t)100);
    __e_acsl_delete_block((void *)(& res_0));
  }
  __e_acsl_full_init((void *)(& tmp_5));
  tmp_5 = __gen_e_acsl_pthread_cond_broadcast(& write_cond);
  if (tmp_5 != 0) {
    __gen_e_acsl_perror(__gen_e_acsl_literal_string_13);
    __gen_e_acsl_exit(11);
  }
  {
    int i_0 = 0;
    __e_acsl_store_block((void *)(& i_0),4UL);
    __e_acsl_full_init((void *)(& i_0));
    while (i_0 < 10) {
      __gen_e_acsl_pthread_join(writers[i_0],(void **)0);
      __e_acsl_full_init((void *)(& i_0));
      i_0 ++;
    }
    __e_acsl_delete_block((void *)(& i_0));
  }
  __e_acsl_full_init((void *)(& tmp_6));
  tmp_6 = __gen_e_acsl_pthread_cond_broadcast(& read_cond);
  if (tmp_6 != 0) {
    __gen_e_acsl_perror(__gen_e_acsl_literal_string_14);
    __gen_e_acsl_exit(12);
  }
  {
    int i_1 = 0;
    __e_acsl_store_block((void *)(& i_1),4UL);
    __e_acsl_full_init((void *)(& i_1));
    while (i_1 < 10) {
      __gen_e_acsl_pthread_join(readers[i_1],(void **)0);
      __e_acsl_full_init((void *)(& i_1));
      i_1 ++;
    }
    __e_acsl_delete_block((void *)(& i_1));
  }
  __e_acsl_full_init((void *)(& __retres));
  __retres = 0;
  __e_acsl_delete_block((void *)(& tmp_6));
  __e_acsl_delete_block((void *)(& tmp_5));
  __e_acsl_delete_block((void *)(& tmp_2));
  __e_acsl_delete_block((void *)(& tmp_1));
  __e_acsl_delete_block((void *)(& tmp_0));
  __e_acsl_delete_block((void *)(& tmp));
  __e_acsl_delete_block((void *)(args));
  __e_acsl_delete_block((void *)(readers));
  __e_acsl_delete_block((void *)(writers));
  __e_acsl_delete_block((void *)(& __retres));
  __e_acsl_globals_clean();
  __e_acsl_memory_clean();
  return __retres;
}


