Showing error 2202

User: Jiri Slaby
Error type: Reachable Error Location
Error type description: A specified error location is reachable in some program path
File location: pthread/queue_unsafe.i
Line in file: 1034
Project: SV-COMP 2013
Project version: 2.6.28
Tools: Manual Work
Entered: 2013-01-17 16:57:54 UTC


Source:

   1typedef unsigned char __u_char;
   2typedef unsigned short int __u_short;
   3typedef unsigned int __u_int;
   4typedef unsigned long int __u_long;
   5typedef signed char __int8_t;
   6typedef unsigned char __uint8_t;
   7typedef signed short int __int16_t;
   8typedef unsigned short int __uint16_t;
   9typedef signed int __int32_t;
  10typedef unsigned int __uint32_t;
  11typedef signed long int __int64_t;
  12typedef unsigned long int __uint64_t;
  13typedef long int __quad_t;
  14typedef unsigned long int __u_quad_t;
  15typedef unsigned long int __dev_t;
  16typedef unsigned int __uid_t;
  17typedef unsigned int __gid_t;
  18typedef unsigned long int __ino_t;
  19typedef unsigned long int __ino64_t;
  20typedef unsigned int __mode_t;
  21typedef unsigned long int __nlink_t;
  22typedef long int __off_t;
  23typedef long int __off64_t;
  24typedef int __pid_t;
  25typedef struct { int __val[2]; } __fsid_t;
  26typedef long int __clock_t;
  27typedef unsigned long int __rlim_t;
  28typedef unsigned long int __rlim64_t;
  29typedef unsigned int __id_t;
  30typedef long int __time_t;
  31typedef unsigned int __useconds_t;
  32typedef long int __suseconds_t;
  33typedef int __daddr_t;
  34typedef long int __swblk_t;
  35typedef int __key_t;
  36typedef int __clockid_t;
  37typedef void * __timer_t;
  38typedef long int __blksize_t;
  39typedef long int __blkcnt_t;
  40typedef long int __blkcnt64_t;
  41typedef unsigned long int __fsblkcnt_t;
  42typedef unsigned long int __fsblkcnt64_t;
  43typedef unsigned long int __fsfilcnt_t;
  44typedef unsigned long int __fsfilcnt64_t;
  45typedef long int __ssize_t;
  46typedef __off64_t __loff_t;
  47typedef __quad_t *__qaddr_t;
  48typedef char *__caddr_t;
  49typedef long int __intptr_t;
  50typedef unsigned int __socklen_t;
  51typedef long unsigned int size_t;
  52
  53typedef __time_t time_t;
  54
  55
  56struct timespec
  57  {
  58    __time_t tv_sec;
  59    long int tv_nsec;
  60  };
  61typedef __pid_t pid_t;
  62struct sched_param
  63  {
  64    int __sched_priority;
  65  };
  66
  67
  68struct __sched_param
  69  {
  70    int __sched_priority;
  71  };
  72typedef unsigned long int __cpu_mask;
  73typedef struct
  74{
  75  __cpu_mask __bits[1024 / (8 * sizeof (__cpu_mask))];
  76} cpu_set_t;
  77
  78extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp)
  79  __attribute__ ((__nothrow__ , __leaf__));
  80extern cpu_set_t *__sched_cpualloc (size_t __count) __attribute__ ((__nothrow__ , __leaf__)) ;
  81extern void __sched_cpufree (cpu_set_t *__set) __attribute__ ((__nothrow__ , __leaf__));
  82
  83
  84extern int sched_setparam (__pid_t __pid, __const struct sched_param *__param)
  85     __attribute__ ((__nothrow__ , __leaf__));
  86extern int sched_getparam (__pid_t __pid, struct sched_param *__param) __attribute__ ((__nothrow__ , __leaf__));
  87extern int sched_setscheduler (__pid_t __pid, int __policy,
  88          __const struct sched_param *__param) __attribute__ ((__nothrow__ , __leaf__));
  89extern int sched_getscheduler (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__));
  90extern int sched_yield (void) __attribute__ ((__nothrow__ , __leaf__));
  91extern int sched_get_priority_max (int __algorithm) __attribute__ ((__nothrow__ , __leaf__));
  92extern int sched_get_priority_min (int __algorithm) __attribute__ ((__nothrow__ , __leaf__));
  93extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __attribute__ ((__nothrow__ , __leaf__));
  94
  95
  96
  97typedef __clock_t clock_t;
  98
  99
 100typedef __clockid_t clockid_t;
 101
 102
 103
 104typedef __timer_t timer_t;
 105
 106struct tm
 107{
 108  int tm_sec;
 109  int tm_min;
 110  int tm_hour;
 111  int tm_mday;
 112  int tm_mon;
 113  int tm_year;
 114  int tm_wday;
 115  int tm_yday;
 116  int tm_isdst;
 117  long int tm_gmtoff;
 118  __const char *tm_zone;
 119};
 120
 121
 122struct itimerspec
 123  {
 124    struct timespec it_interval;
 125    struct timespec it_value;
 126  };
 127struct sigevent;
 128
 129extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__));
 130extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
 131extern double difftime (time_t __time1, time_t __time0)
 132     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
 133extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
 134extern size_t strftime (char *__restrict __s, size_t __maxsize,
 135   __const char *__restrict __format,
 136   __const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__));
 137
 138typedef struct __locale_struct
 139{
 140  struct __locale_data *__locales[13];
 141  const unsigned short int *__ctype_b;
 142  const int *__ctype_tolower;
 143  const int *__ctype_toupper;
 144  const char *__names[13];
 145} *__locale_t;
 146typedef __locale_t locale_t;
 147extern size_t strftime_l (char *__restrict __s, size_t __maxsize,
 148     __const char *__restrict __format,
 149     __const struct tm *__restrict __tp,
 150     __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__));
 151
 152extern struct tm *gmtime (__const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
 153extern struct tm *localtime (__const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
 154
 155extern struct tm *gmtime_r (__const time_t *__restrict __timer,
 156       struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__));
 157extern struct tm *localtime_r (__const time_t *__restrict __timer,
 158          struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__));
 159
 160extern char *asctime (__const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
 161extern char *ctime (__const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
 162
 163extern char *asctime_r (__const struct tm *__restrict __tp,
 164   char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__));
 165extern char *ctime_r (__const time_t *__restrict __timer,
 166        char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__));
 167extern char *__tzname[2];
 168extern int __daylight;
 169extern long int __timezone;
 170extern char *tzname[2];
 171extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__));
 172extern int daylight;
 173extern long int timezone;
 174extern int stime (__const time_t *__when) __attribute__ ((__nothrow__ , __leaf__));
 175extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
 176extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
 177extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
 178extern int nanosleep (__const struct timespec *__requested_time,
 179        struct timespec *__remaining);
 180extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__));
 181extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__));
 182extern int clock_settime (clockid_t __clock_id, __const struct timespec *__tp)
 183     __attribute__ ((__nothrow__ , __leaf__));
 184extern int clock_nanosleep (clockid_t __clock_id, int __flags,
 185       __const struct timespec *__req,
 186       struct timespec *__rem);
 187extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__));
 188extern int timer_create (clockid_t __clock_id,
 189    struct sigevent *__restrict __evp,
 190    timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__));
 191extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__));
 192extern int timer_settime (timer_t __timerid, int __flags,
 193     __const struct itimerspec *__restrict __value,
 194     struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__));
 195extern int timer_gettime (timer_t __timerid, struct itimerspec *__value)
 196     __attribute__ ((__nothrow__ , __leaf__));
 197extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__));
 198
 199typedef unsigned long int pthread_t;
 200typedef union
 201{
 202  char __size[56];
 203  long int __align;
 204} pthread_attr_t;
 205typedef struct __pthread_internal_list
 206{
 207  struct __pthread_internal_list *__prev;
 208  struct __pthread_internal_list *__next;
 209} __pthread_list_t;
 210typedef union
 211{
 212  struct __pthread_mutex_s
 213  {
 214    int __lock;
 215    unsigned int __count;
 216    int __owner;
 217    unsigned int __nusers;
 218    int __kind;
 219    int __spins;
 220    __pthread_list_t __list;
 221  } __data;
 222  char __size[40];
 223  long int __align;
 224} pthread_mutex_t;
 225typedef union
 226{
 227  char __size[4];
 228  int __align;
 229} pthread_mutexattr_t;
 230typedef union
 231{
 232  struct
 233  {
 234    int __lock;
 235    unsigned int __futex;
 236    __extension__ unsigned long long int __total_seq;
 237    __extension__ unsigned long long int __wakeup_seq;
 238    __extension__ unsigned long long int __woken_seq;
 239    void *__mutex;
 240    unsigned int __nwaiters;
 241    unsigned int __broadcast_seq;
 242  } __data;
 243  char __size[48];
 244  __extension__ long long int __align;
 245} pthread_cond_t;
 246typedef union
 247{
 248  char __size[4];
 249  int __align;
 250} pthread_condattr_t;
 251typedef unsigned int pthread_key_t;
 252typedef int pthread_once_t;
 253typedef union
 254{
 255  struct
 256  {
 257    int __lock;
 258    unsigned int __nr_readers;
 259    unsigned int __readers_wakeup;
 260    unsigned int __writer_wakeup;
 261    unsigned int __nr_readers_queued;
 262    unsigned int __nr_writers_queued;
 263    int __writer;
 264    int __shared;
 265    unsigned long int __pad1;
 266    unsigned long int __pad2;
 267    unsigned int __flags;
 268  } __data;
 269  char __size[56];
 270  long int __align;
 271} pthread_rwlock_t;
 272typedef union
 273{
 274  char __size[8];
 275  long int __align;
 276} pthread_rwlockattr_t;
 277typedef volatile int pthread_spinlock_t;
 278typedef union
 279{
 280  char __size[32];
 281  long int __align;
 282} pthread_barrier_t;
 283typedef union
 284{
 285  char __size[4];
 286  int __align;
 287} pthread_barrierattr_t;
 288typedef long int __jmp_buf[8];
 289enum
 290{
 291  PTHREAD_CREATE_JOINABLE,
 292  PTHREAD_CREATE_DETACHED
 293};
 294enum
 295{
 296  PTHREAD_MUTEX_TIMED_NP,
 297  PTHREAD_MUTEX_RECURSIVE_NP,
 298  PTHREAD_MUTEX_ERRORCHECK_NP,
 299  PTHREAD_MUTEX_ADAPTIVE_NP
 300  ,
 301  PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP,
 302  PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
 303  PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
 304  PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
 305};
 306enum
 307{
 308  PTHREAD_MUTEX_STALLED,
 309  PTHREAD_MUTEX_STALLED_NP = PTHREAD_MUTEX_STALLED,
 310  PTHREAD_MUTEX_ROBUST,
 311  PTHREAD_MUTEX_ROBUST_NP = PTHREAD_MUTEX_ROBUST
 312};
 313enum
 314{
 315  PTHREAD_RWLOCK_PREFER_READER_NP,
 316  PTHREAD_RWLOCK_PREFER_WRITER_NP,
 317  PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,
 318  PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_READER_NP
 319};
 320enum
 321{
 322  PTHREAD_INHERIT_SCHED,
 323  PTHREAD_EXPLICIT_SCHED
 324};
 325enum
 326{
 327  PTHREAD_SCOPE_SYSTEM,
 328  PTHREAD_SCOPE_PROCESS
 329};
 330enum
 331{
 332  PTHREAD_PROCESS_PRIVATE,
 333  PTHREAD_PROCESS_SHARED
 334};
 335struct _pthread_cleanup_buffer
 336{
 337  void (*__routine) (void *);
 338  void *__arg;
 339  int __canceltype;
 340  struct _pthread_cleanup_buffer *__prev;
 341};
 342enum
 343{
 344  PTHREAD_CANCEL_ENABLE,
 345  PTHREAD_CANCEL_DISABLE
 346};
 347enum
 348{
 349  PTHREAD_CANCEL_DEFERRED,
 350  PTHREAD_CANCEL_ASYNCHRONOUS
 351};
 352
 353extern int pthread_create (pthread_t *__restrict __newthread,
 354      __const pthread_attr_t *__restrict __attr,
 355      void *(*__start_routine) (void *),
 356      void *__restrict __arg) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 3)));
 357extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__));
 358extern int pthread_join (pthread_t __th, void **__thread_return);
 359extern int pthread_detach (pthread_t __th) __attribute__ ((__nothrow__ , __leaf__));
 360extern pthread_t pthread_self (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
 361extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) __attribute__ ((__nothrow__ , __leaf__));
 362extern int pthread_attr_init (pthread_attr_t *__attr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 363extern int pthread_attr_destroy (pthread_attr_t *__attr)
 364     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 365extern int pthread_attr_getdetachstate (__const pthread_attr_t *__attr,
 366     int *__detachstate)
 367     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
 368extern int pthread_attr_setdetachstate (pthread_attr_t *__attr,
 369     int __detachstate)
 370     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 371extern int pthread_attr_getguardsize (__const pthread_attr_t *__attr,
 372          size_t *__guardsize)
 373     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
 374extern int pthread_attr_setguardsize (pthread_attr_t *__attr,
 375          size_t __guardsize)
 376     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 377extern int pthread_attr_getschedparam (__const pthread_attr_t *__restrict
 378           __attr,
 379           struct sched_param *__restrict __param)
 380     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
 381extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
 382           __const struct sched_param *__restrict
 383           __param) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
 384extern int pthread_attr_getschedpolicy (__const pthread_attr_t *__restrict
 385     __attr, int *__restrict __policy)
 386     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
 387extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy)
 388     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 389extern int pthread_attr_getinheritsched (__const pthread_attr_t *__restrict
 390      __attr, int *__restrict __inherit)
 391     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
 392extern int pthread_attr_setinheritsched (pthread_attr_t *__attr,
 393      int __inherit)
 394     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 395extern int pthread_attr_getscope (__const pthread_attr_t *__restrict __attr,
 396      int *__restrict __scope)
 397     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
 398extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope)
 399     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 400extern int pthread_attr_getstackaddr (__const pthread_attr_t *__restrict
 401          __attr, void **__restrict __stackaddr)
 402     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__deprecated__));
 403extern int pthread_attr_setstackaddr (pthread_attr_t *__attr,
 404          void *__stackaddr)
 405     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__));
 406extern int pthread_attr_getstacksize (__const pthread_attr_t *__restrict
 407          __attr, size_t *__restrict __stacksize)
 408     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
 409extern int pthread_attr_setstacksize (pthread_attr_t *__attr,
 410          size_t __stacksize)
 411     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 412extern int pthread_attr_getstack (__const pthread_attr_t *__restrict __attr,
 413      void **__restrict __stackaddr,
 414      size_t *__restrict __stacksize)
 415     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3)));
 416extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
 417      size_t __stacksize) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 418extern int pthread_setschedparam (pthread_t __target_thread, int __policy,
 419      __const struct sched_param *__param)
 420     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3)));
 421extern int pthread_getschedparam (pthread_t __target_thread,
 422      int *__restrict __policy,
 423      struct sched_param *__restrict __param)
 424     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3)));
 425extern int pthread_setschedprio (pthread_t __target_thread, int __prio)
 426     __attribute__ ((__nothrow__ , __leaf__));
 427extern int pthread_once (pthread_once_t *__once_control,
 428    void (*__init_routine) (void)) __attribute__ ((__nonnull__ (1, 2)));
 429extern int pthread_setcancelstate (int __state, int *__oldstate);
 430extern int pthread_setcanceltype (int __type, int *__oldtype);
 431extern int pthread_cancel (pthread_t __th);
 432extern void pthread_testcancel (void);
 433typedef struct
 434{
 435  struct
 436  {
 437    __jmp_buf __cancel_jmp_buf;
 438    int __mask_was_saved;
 439  } __cancel_jmp_buf[1];
 440  void *__pad[4];
 441} __pthread_unwind_buf_t __attribute__ ((__aligned__));
 442struct __pthread_cleanup_frame
 443{
 444  void (*__cancel_routine) (void *);
 445  void *__cancel_arg;
 446  int __do_it;
 447  int __cancel_type;
 448};
 449extern void __pthread_register_cancel (__pthread_unwind_buf_t *__buf)
 450     ;
 451extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
 452  ;
 453extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf)
 454     __attribute__ ((__noreturn__))
 455     __attribute__ ((__weak__))
 456     ;
 457struct __jmp_buf_tag;
 458extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __attribute__ ((__nothrow__ , __leaf__));
 459extern int pthread_mutex_init (pthread_mutex_t *__mutex,
 460          __const pthread_mutexattr_t *__mutexattr)
 461     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 462extern int pthread_mutex_destroy (pthread_mutex_t *__mutex)
 463     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 464extern int pthread_mutex_trylock (pthread_mutex_t *__mutex)
 465     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 466extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
 467     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 468extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
 469        __const struct timespec *__restrict
 470        __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
 471extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
 472     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 473extern int pthread_mutex_getprioceiling (__const pthread_mutex_t *
 474      __restrict __mutex,
 475      int *__restrict __prioceiling)
 476     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
 477extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex,
 478      int __prioceiling,
 479      int *__restrict __old_ceiling)
 480     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3)));
 481extern int pthread_mutex_consistent (pthread_mutex_t *__mutex)
 482     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 483extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr)
 484     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 485extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr)
 486     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 487extern int pthread_mutexattr_getpshared (__const pthread_mutexattr_t *
 488      __restrict __attr,
 489      int *__restrict __pshared)
 490     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
 491extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr,
 492      int __pshared)
 493     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 494extern int pthread_mutexattr_gettype (__const pthread_mutexattr_t *__restrict
 495          __attr, int *__restrict __kind)
 496     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
 497extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind)
 498     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 499extern int pthread_mutexattr_getprotocol (__const pthread_mutexattr_t *
 500       __restrict __attr,
 501       int *__restrict __protocol)
 502     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
 503extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr,
 504       int __protocol)
 505     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 506extern int pthread_mutexattr_getprioceiling (__const pthread_mutexattr_t *
 507          __restrict __attr,
 508          int *__restrict __prioceiling)
 509     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
 510extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr,
 511          int __prioceiling)
 512     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 513extern int pthread_mutexattr_getrobust (__const pthread_mutexattr_t *__attr,
 514     int *__robustness)
 515     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
 516extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
 517     int __robustness)
 518     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 519extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
 520    __const pthread_rwlockattr_t *__restrict
 521    __attr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 522extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock)
 523     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 524extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock)
 525     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 526extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
 527  __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 528extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
 529           __const struct timespec *__restrict
 530           __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
 531extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
 532     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 533extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
 534     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 535extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
 536           __const struct timespec *__restrict
 537           __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
 538extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
 539     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 540extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr)
 541     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 542extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr)
 543     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 544extern int pthread_rwlockattr_getpshared (__const pthread_rwlockattr_t *
 545       __restrict __attr,
 546       int *__restrict __pshared)
 547     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
 548extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr,
 549       int __pshared)
 550     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 551extern int pthread_rwlockattr_getkind_np (__const pthread_rwlockattr_t *
 552       __restrict __attr,
 553       int *__restrict __pref)
 554     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
 555extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
 556       int __pref) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 557extern int pthread_cond_init (pthread_cond_t *__restrict __cond,
 558         __const pthread_condattr_t *__restrict
 559         __cond_attr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 560extern int pthread_cond_destroy (pthread_cond_t *__cond)
 561     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 562extern int pthread_cond_signal (pthread_cond_t *__cond)
 563     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 564extern int pthread_cond_broadcast (pthread_cond_t *__cond)
 565     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 566extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
 567         pthread_mutex_t *__restrict __mutex)
 568     __attribute__ ((__nonnull__ (1, 2)));
 569extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
 570       pthread_mutex_t *__restrict __mutex,
 571       __const struct timespec *__restrict
 572       __abstime) __attribute__ ((__nonnull__ (1, 2, 3)));
 573extern int pthread_condattr_init (pthread_condattr_t *__attr)
 574     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 575extern int pthread_condattr_destroy (pthread_condattr_t *__attr)
 576     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 577extern int pthread_condattr_getpshared (__const pthread_condattr_t *
 578     __restrict __attr,
 579     int *__restrict __pshared)
 580     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
 581extern int pthread_condattr_setpshared (pthread_condattr_t *__attr,
 582     int __pshared) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 583extern int pthread_condattr_getclock (__const pthread_condattr_t *
 584          __restrict __attr,
 585          __clockid_t *__restrict __clock_id)
 586     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
 587extern int pthread_condattr_setclock (pthread_condattr_t *__attr,
 588          __clockid_t __clock_id)
 589     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 590extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
 591     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 592extern int pthread_spin_destroy (pthread_spinlock_t *__lock)
 593     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 594extern int pthread_spin_lock (pthread_spinlock_t *__lock)
 595     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 596extern int pthread_spin_trylock (pthread_spinlock_t *__lock)
 597     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 598extern int pthread_spin_unlock (pthread_spinlock_t *__lock)
 599     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 600extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier,
 601     __const pthread_barrierattr_t *__restrict
 602     __attr, unsigned int __count)
 603     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 604extern int pthread_barrier_destroy (pthread_barrier_t *__barrier)
 605     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 606extern int pthread_barrier_wait (pthread_barrier_t *__barrier)
 607     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 608extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr)
 609     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 610extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr)
 611     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 612extern int pthread_barrierattr_getpshared (__const pthread_barrierattr_t *
 613        __restrict __attr,
 614        int *__restrict __pshared)
 615     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
 616extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
 617        int __pshared)
 618     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 619extern int pthread_key_create (pthread_key_t *__key,
 620          void (*__destr_function) (void *))
 621     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
 622extern int pthread_key_delete (pthread_key_t __key) __attribute__ ((__nothrow__ , __leaf__));
 623extern void *pthread_getspecific (pthread_key_t __key) __attribute__ ((__nothrow__ , __leaf__));
 624extern int pthread_setspecific (pthread_key_t __key,
 625    __const void *__pointer) __attribute__ ((__nothrow__ , __leaf__)) ;
 626extern int pthread_getcpuclockid (pthread_t __thread_id,
 627      __clockid_t *__clock_id)
 628     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
 629extern int pthread_atfork (void (*__prepare) (void),
 630      void (*__parent) (void),
 631      void (*__child) (void)) __attribute__ ((__nothrow__ , __leaf__));
 632
 633
 634struct _IO_FILE;
 635
 636typedef struct _IO_FILE FILE;
 637
 638
 639typedef struct _IO_FILE __FILE;
 640typedef struct
 641{
 642  int __count;
 643  union
 644  {
 645    unsigned int __wch;
 646    char __wchb[4];
 647  } __value;
 648} __mbstate_t;
 649typedef struct
 650{
 651  __off_t __pos;
 652  __mbstate_t __state;
 653} _G_fpos_t;
 654typedef struct
 655{
 656  __off64_t __pos;
 657  __mbstate_t __state;
 658} _G_fpos64_t;
 659typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
 660typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
 661typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
 662typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
 663typedef __builtin_va_list __gnuc_va_list;
 664struct _IO_jump_t; struct _IO_FILE;
 665typedef void _IO_lock_t;
 666struct _IO_marker {
 667  struct _IO_marker *_next;
 668  struct _IO_FILE *_sbuf;
 669  int _pos;
 670};
 671enum __codecvt_result
 672{
 673  __codecvt_ok,
 674  __codecvt_partial,
 675  __codecvt_error,
 676  __codecvt_noconv
 677};
 678struct _IO_FILE {
 679  int _flags;
 680  char* _IO_read_ptr;
 681  char* _IO_read_end;
 682  char* _IO_read_base;
 683  char* _IO_write_base;
 684  char* _IO_write_ptr;
 685  char* _IO_write_end;
 686  char* _IO_buf_base;
 687  char* _IO_buf_end;
 688  char *_IO_save_base;
 689  char *_IO_backup_base;
 690  char *_IO_save_end;
 691  struct _IO_marker *_markers;
 692  struct _IO_FILE *_chain;
 693  int _fileno;
 694  int _flags2;
 695  __off_t _old_offset;
 696  unsigned short _cur_column;
 697  signed char _vtable_offset;
 698  char _shortbuf[1];
 699  _IO_lock_t *_lock;
 700  __off64_t _offset;
 701  void *__pad1;
 702  void *__pad2;
 703  void *__pad3;
 704  void *__pad4;
 705  size_t __pad5;
 706  int _mode;
 707  char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];
 708};
 709typedef struct _IO_FILE _IO_FILE;
 710struct _IO_FILE_plus;
 711extern struct _IO_FILE_plus _IO_2_1_stdin_;
 712extern struct _IO_FILE_plus _IO_2_1_stdout_;
 713extern struct _IO_FILE_plus _IO_2_1_stderr_;
 714typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
 715typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
 716     size_t __n);
 717typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);
 718typedef int __io_close_fn (void *__cookie);
 719extern int __underflow (_IO_FILE *);
 720extern int __uflow (_IO_FILE *);
 721extern int __overflow (_IO_FILE *, int);
 722extern int _IO_getc (_IO_FILE *__fp);
 723extern int _IO_putc (int __c, _IO_FILE *__fp);
 724extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__));
 725extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__));
 726extern int _IO_peekc_locked (_IO_FILE *__fp);
 727extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
 728extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
 729extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
 730extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
 731   __gnuc_va_list, int *__restrict);
 732extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
 733    __gnuc_va_list);
 734extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t);
 735extern size_t _IO_sgetn (_IO_FILE *, void *, size_t);
 736extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int);
 737extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int);
 738extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
 739typedef __gnuc_va_list va_list;
 740typedef __off_t off_t;
 741typedef __ssize_t ssize_t;
 742
 743typedef _G_fpos_t fpos_t;
 744
 745extern struct _IO_FILE *stdin;
 746extern struct _IO_FILE *stdout;
 747extern struct _IO_FILE *stderr;
 748
 749extern int remove (__const char *__filename) __attribute__ ((__nothrow__ , __leaf__));
 750extern int rename (__const char *__old, __const char *__new) __attribute__ ((__nothrow__ , __leaf__));
 751
 752extern int renameat (int __oldfd, __const char *__old, int __newfd,
 753       __const char *__new) __attribute__ ((__nothrow__ , __leaf__));
 754
 755extern FILE *tmpfile (void) ;
 756extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ;
 757
 758extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ;
 759extern char *tempnam (__const char *__dir, __const char *__pfx)
 760     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;
 761
 762extern int fclose (FILE *__stream);
 763extern int fflush (FILE *__stream);
 764
 765extern int fflush_unlocked (FILE *__stream);
 766
 767extern FILE *fopen (__const char *__restrict __filename,
 768      __const char *__restrict __modes) ;
 769extern FILE *freopen (__const char *__restrict __filename,
 770        __const char *__restrict __modes,
 771        FILE *__restrict __stream) ;
 772
 773extern FILE *fdopen (int __fd, __const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ;
 774extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes)
 775  __attribute__ ((__nothrow__ , __leaf__)) ;
 776extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ;
 777
 778extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__));
 779extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
 780      int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__));
 781
 782extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
 783         size_t __size) __attribute__ ((__nothrow__ , __leaf__));
 784extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
 785
 786extern int fprintf (FILE *__restrict __stream,
 787      __const char *__restrict __format, ...);
 788extern int printf (__const char *__restrict __format, ...);
 789extern int sprintf (char *__restrict __s,
 790      __const char *__restrict __format, ...) __attribute__ ((__nothrow__));
 791extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
 792       __gnuc_va_list __arg);
 793extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg);
 794extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
 795       __gnuc_va_list __arg) __attribute__ ((__nothrow__));
 796
 797
 798extern int snprintf (char *__restrict __s, size_t __maxlen,
 799       __const char *__restrict __format, ...)
 800     __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4)));
 801extern int vsnprintf (char *__restrict __s, size_t __maxlen,
 802        __const char *__restrict __format, __gnuc_va_list __arg)
 803     __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0)));
 804
 805extern int vdprintf (int __fd, __const char *__restrict __fmt,
 806       __gnuc_va_list __arg)
 807     __attribute__ ((__format__ (__printf__, 2, 0)));
 808extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
 809     __attribute__ ((__format__ (__printf__, 2, 3)));
 810
 811extern int fscanf (FILE *__restrict __stream,
 812     __const char *__restrict __format, ...) ;
 813extern int scanf (__const char *__restrict __format, ...) ;
 814extern int sscanf (__const char *__restrict __s,
 815     __const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__));
 816extern int fscanf (FILE *__restrict __stream, __const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") ;
 817extern int scanf (__const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") ;
 818extern int sscanf (__const char *__restrict __s, __const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__));
 819
 820
 821extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
 822      __gnuc_va_list __arg)
 823     __attribute__ ((__format__ (__scanf__, 2, 0))) ;
 824extern int vscanf (__const char *__restrict __format, __gnuc_va_list __arg)
 825     __attribute__ ((__format__ (__scanf__, 1, 0))) ;
 826extern int vsscanf (__const char *__restrict __s,
 827      __const char *__restrict __format, __gnuc_va_list __arg)
 828     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0)));
 829extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf")
 830     __attribute__ ((__format__ (__scanf__, 2, 0))) ;
 831extern int vscanf (__const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf")
 832     __attribute__ ((__format__ (__scanf__, 1, 0))) ;
 833extern int vsscanf (__const char *__restrict __s, __const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__))
 834     __attribute__ ((__format__ (__scanf__, 2, 0)));
 835
 836
 837extern int fgetc (FILE *__stream);
 838extern int getc (FILE *__stream);
 839extern int getchar (void);
 840
 841extern int getc_unlocked (FILE *__stream);
 842extern int getchar_unlocked (void);
 843extern int fgetc_unlocked (FILE *__stream);
 844
 845extern int fputc (int __c, FILE *__stream);
 846extern int putc (int __c, FILE *__stream);
 847extern int putchar (int __c);
 848
 849extern int fputc_unlocked (int __c, FILE *__stream);
 850extern int putc_unlocked (int __c, FILE *__stream);
 851extern int putchar_unlocked (int __c);
 852extern int getw (FILE *__stream);
 853extern int putw (int __w, FILE *__stream);
 854
 855extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
 856     ;
 857extern char *gets (char *__s) ;
 858
 859extern __ssize_t __getdelim (char **__restrict __lineptr,
 860          size_t *__restrict __n, int __delimiter,
 861          FILE *__restrict __stream) ;
 862extern __ssize_t getdelim (char **__restrict __lineptr,
 863        size_t *__restrict __n, int __delimiter,
 864        FILE *__restrict __stream) ;
 865extern __ssize_t getline (char **__restrict __lineptr,
 866       size_t *__restrict __n,
 867       FILE *__restrict __stream) ;
 868
 869extern int fputs (__const char *__restrict __s, FILE *__restrict __stream);
 870extern int puts (__const char *__s);
 871extern int ungetc (int __c, FILE *__stream);
 872extern size_t fread (void *__restrict __ptr, size_t __size,
 873       size_t __n, FILE *__restrict __stream) ;
 874extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
 875        size_t __n, FILE *__restrict __s);
 876
 877extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
 878         size_t __n, FILE *__restrict __stream) ;
 879extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
 880          size_t __n, FILE *__restrict __stream);
 881
 882extern int fseek (FILE *__stream, long int __off, int __whence);
 883extern long int ftell (FILE *__stream) ;
 884extern void rewind (FILE *__stream);
 885
 886extern int fseeko (FILE *__stream, __off_t __off, int __whence);
 887extern __off_t ftello (FILE *__stream) ;
 888
 889extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
 890extern int fsetpos (FILE *__stream, __const fpos_t *__pos);
 891
 892
 893extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
 894extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
 895extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
 896
 897extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
 898extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
 899extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
 900
 901extern void perror (__const char *__s);
 902
 903extern int sys_nerr;
 904extern __const char *__const sys_errlist[];
 905extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
 906extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
 907extern FILE *popen (__const char *__command, __const char *__modes) ;
 908extern int pclose (FILE *__stream);
 909extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__));
 910extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
 911
 912
 913
 914extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
 915
 916
 917extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
 918
 919
 920extern void __assert_fail (__const char *__assertion, __const char *__file,
 921      unsigned int __line, __const char *__function)
 922     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
 923extern void __assert_perror_fail (int __errnum, __const char *__file,
 924      unsigned int __line,
 925      __const char *__function)
 926     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
 927extern void __assert (const char *__assertion, const char *__file, int __line)
 928     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
 929
 930typedef struct {
 931    int element[(20)];
 932    int head;
 933    int tail;
 934    int amount;
 935} QType;
 936pthread_mutex_t m;
 937int nondet_int();
 938int stored_elements[(20)];
 939_Bool enqueue_flag, dequeue_flag;
 940QType queue;
 941int init(QType *q)
 942{
 943  q->head=0;
 944  q->tail=0;
 945  q->amount=0;
 946}
 947int empty(QType * q)
 948{
 949  if (q->head == q->tail)
 950  {
 951    printf("queue is empty\n");
 952    return (-1);
 953  }
 954  else
 955    return 0;
 956}
 957int full(QType * q)
 958{
 959  if (q->amount == (20))
 960  {
 961 printf("queue is full\n");
 962 return (-2);
 963  }
 964  else
 965    return 0;
 966}
 967int enqueue(QType *q, int x)
 968{
 969  q->element[q->tail] = x;
 970  q->amount++;
 971  if (q->tail == (20))
 972  {
 973    q->tail = 1;
 974  }
 975  else
 976  {
 977    q->tail++;
 978  }
 979  return 0;
 980}
 981int dequeue(QType *q)
 982{
 983  int x;
 984  x = q->element[q->head];
 985  q->amount--;
 986  if (q->head == (20))
 987  {
 988    q->head = 1;
 989  }
 990  else
 991    q->head++;
 992  return x;
 993}
 994void *t1(void *arg)
 995{
 996  int value, i;
 997  pthread_mutex_lock(&m);
 998  value = nondet_int();
 999  if (enqueue(&queue,value)) {
1000    goto ERROR;
1001  }
1002  stored_elements[0]=value;
1003  if (empty(&queue)) {
1004    goto ERROR;
1005  }
1006  pthread_mutex_unlock(&m);
1007  for(i=0; i<((20)-1); i++)
1008  {
1009    pthread_mutex_lock(&m);
1010    if (enqueue_flag)
1011    {
1012      value = nondet_int();
1013      enqueue(&queue,value);
1014      stored_elements[i+1]=value;
1015      enqueue_flag=(0);
1016      dequeue_flag=(1);
1017    }
1018    pthread_mutex_unlock(&m);
1019  }
1020  return ((void *)0);
1021  ERROR:
1022    ;
1023}
1024void *t2(void *arg)
1025{
1026  int i;
1027  for(i=0; i<(20); i++)
1028  {
1029    pthread_mutex_lock(&m);
1030    if (dequeue_flag)
1031    {
1032      if (!dequeue(&queue)==stored_elements[i]) {
1033        goto ERROR;
1034        ERROR:
1035          ;
1036      }
1037      dequeue_flag=(0);
1038      enqueue_flag=(1);
1039    }
1040    pthread_mutex_unlock(&m);
1041  }
1042  return ((void *)0);
1043}
1044int main(void)
1045{
1046  pthread_t id1, id2;
1047  enqueue_flag=(1);
1048  dequeue_flag=(0);
1049  init(&queue);
1050  if (!empty(&queue)==(-1)) {
1051    goto ERROR;
1052    ERROR:
1053      ;
1054  }
1055  pthread_mutex_init(&m, 0);
1056  pthread_create(&id1, ((void *)0), t1, &queue);
1057  pthread_create(&id2, ((void *)0), t2, &queue);
1058  pthread_join(id1, ((void *)0));
1059  pthread_join(id2, ((void *)0));
1060  return 0;
1061}