1typedef long unsigned int size_t;
2typedef unsigned char __u_char;
3typedef unsigned short int __u_short;
4typedef unsigned int __u_int;
5typedef unsigned long int __u_long;
6typedef signed char __int8_t;
7typedef unsigned char __uint8_t;
8typedef signed short int __int16_t;
9typedef unsigned short int __uint16_t;
10typedef signed int __int32_t;
11typedef unsigned int __uint32_t;
12typedef signed long int __int64_t;
13typedef unsigned long int __uint64_t;
14typedef long int __quad_t;
15typedef unsigned long int __u_quad_t;
16typedef unsigned long int __dev_t;
17typedef unsigned int __uid_t;
18typedef unsigned int __gid_t;
19typedef unsigned long int __ino_t;
20typedef unsigned long int __ino64_t;
21typedef unsigned int __mode_t;
22typedef unsigned long int __nlink_t;
23typedef long int __off_t;
24typedef long int __off64_t;
25typedef int __pid_t;
26typedef struct { int __val[2]; } __fsid_t;
27typedef long int __clock_t;
28typedef unsigned long int __rlim_t;
29typedef unsigned long int __rlim64_t;
30typedef unsigned int __id_t;
31typedef long int __time_t;
32typedef unsigned int __useconds_t;
33typedef long int __suseconds_t;
34typedef int __daddr_t;
35typedef long int __swblk_t;
36typedef int __key_t;
37typedef int __clockid_t;
38typedef void * __timer_t;
39typedef long int __blksize_t;
40typedef long int __blkcnt_t;
41typedef long int __blkcnt64_t;
42typedef unsigned long int __fsblkcnt_t;
43typedef unsigned long int __fsblkcnt64_t;
44typedef unsigned long int __fsfilcnt_t;
45typedef unsigned long int __fsfilcnt64_t;
46typedef long int __ssize_t;
47typedef __off64_t __loff_t;
48typedef __quad_t *__qaddr_t;
49typedef char *__caddr_t;
50typedef long int __intptr_t;
51typedef unsigned int __socklen_t;
52typedef struct _IO_FILE FILE;
53typedef struct _IO_FILE __FILE;
54typedef int wchar_t;
55typedef unsigned int wint_t;
56typedef struct
57{
58 int __count;
59 union
60 {
61 wint_t __wch;
62 char __wchb[4];
63 } __value;
64} __mbstate_t;
65typedef struct
66{
67 __off_t __pos;
68 __mbstate_t __state;
69} _G_fpos_t;
70typedef struct
71{
72 __off64_t __pos;
73 __mbstate_t __state;
74} _G_fpos64_t;
75enum
76{
77 __GCONV_OK = 0,
78 __GCONV_NOCONV,
79 __GCONV_NODB,
80 __GCONV_NOMEM,
81 __GCONV_EMPTY_INPUT,
82 __GCONV_FULL_OUTPUT,
83 __GCONV_ILLEGAL_INPUT,
84 __GCONV_INCOMPLETE_INPUT,
85 __GCONV_ILLEGAL_DESCRIPTOR,
86 __GCONV_INTERNAL_ERROR
87};
88enum
89{
90 __GCONV_IS_LAST = 0x0001,
91 __GCONV_IGNORE_ERRORS = 0x0002
92};
93struct __gconv_step;
94struct __gconv_step_data;
95struct __gconv_loaded_object;
96struct __gconv_trans_data;
97typedef int (*__gconv_fct) (struct __gconv_step *, struct __gconv_step_data *,
98 __const unsigned char **, __const unsigned char *,
99 unsigned char **, size_t *, int, int);
100typedef wint_t (*__gconv_btowc_fct) (struct __gconv_step *, unsigned char);
101typedef int (*__gconv_init_fct) (struct __gconv_step *);
102typedef void (*__gconv_end_fct) (struct __gconv_step *);
103typedef int (*__gconv_trans_fct) (struct __gconv_step *,
104 struct __gconv_step_data *, void *,
105 __const unsigned char *,
106 __const unsigned char **,
107 __const unsigned char *, unsigned char **,
108 size_t *);
109typedef int (*__gconv_trans_context_fct) (void *, __const unsigned char *,
110 __const unsigned char *,
111 unsigned char *, unsigned char *);
112typedef int (*__gconv_trans_query_fct) (__const char *, __const char ***,
113 size_t *);
114typedef int (*__gconv_trans_init_fct) (void **, const char *);
115typedef void (*__gconv_trans_end_fct) (void *);
116struct __gconv_trans_data
117{
118 __gconv_trans_fct __trans_fct;
119 __gconv_trans_context_fct __trans_context_fct;
120 __gconv_trans_end_fct __trans_end_fct;
121 void *__data;
122 struct __gconv_trans_data *__next;
123};
124struct __gconv_step
125{
126 struct __gconv_loaded_object *__shlib_handle;
127 __const char *__modname;
128 int __counter;
129 char *__from_name;
130 char *__to_name;
131 __gconv_fct __fct;
132 __gconv_btowc_fct __btowc_fct;
133 __gconv_init_fct __init_fct;
134 __gconv_end_fct __end_fct;
135 int __min_needed_from;
136 int __max_needed_from;
137 int __min_needed_to;
138 int __max_needed_to;
139 int __stateful;
140 void *__data;
141};
142
143
144
145struct __gconv_step_data
146{
147 unsigned char *__outbuf;
148 unsigned char *__outbufend;
149
150
151
152 int __flags;
153
154
155
156 int __invocation_counter;
157
158
159
160 int __internal_use;
161
162 __mbstate_t *__statep;
163 __mbstate_t __state;
164
165
166
167 struct __gconv_trans_data *__trans;
168};
169
170
171
172typedef struct __gconv_info
173{
174 size_t __nsteps;
175 struct __gconv_step *__steps;
176 __extension__ struct __gconv_step_data __data [];
177} *__gconv_t;
178typedef union
179{
180 struct __gconv_info __cd;
181 struct
182 {
183 struct __gconv_info __cd;
184 struct __gconv_step_data __data;
185 } __combined;
186} _G_iconv_t;
187typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
188typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
189typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
190typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
191typedef __builtin_va_list __gnuc_va_list;
192struct _IO_jump_t; struct _IO_FILE;
193typedef void _IO_lock_t;
194struct _IO_marker {
195 struct _IO_marker *_next;
196 struct _IO_FILE *_sbuf;
197 int _pos;
198
199
200};
201
202
203enum __codecvt_result
204{
205 __codecvt_ok,
206 __codecvt_partial,
207 __codecvt_error,
208 __codecvt_noconv
209};
210struct _IO_FILE {
211 int _flags;
212 char* _IO_read_ptr;
213 char* _IO_read_end;
214 char* _IO_read_base;
215 char* _IO_write_base;
216 char* _IO_write_ptr;
217 char* _IO_write_end;
218 char* _IO_buf_base;
219 char* _IO_buf_end;
220 char *_IO_save_base;
221 char *_IO_backup_base;
222 char *_IO_save_end;
223 struct _IO_marker *_markers;
224 struct _IO_FILE *_chain;
225 int _fileno;
226 int _flags2;
227 __off_t _old_offset;
228 unsigned short _cur_column;
229 signed char _vtable_offset;
230 char _shortbuf[1];
231 _IO_lock_t *_lock;
232 __off64_t _offset;
233 void *__pad1;
234 void *__pad2;
235 void *__pad3;
236 void *__pad4;
237 size_t __pad5;
238 int _mode;
239 char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];
240};
241typedef struct _IO_FILE _IO_FILE;
242struct _IO_FILE_plus;
243extern struct _IO_FILE_plus _IO_2_1_stdin_;
244extern struct _IO_FILE_plus _IO_2_1_stdout_;
245extern struct _IO_FILE_plus _IO_2_1_stderr_;
246typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
247typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
248 size_t __n);
249typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);
250typedef int __io_close_fn (void *__cookie);
251extern int __underflow (_IO_FILE *);
252extern int __uflow (_IO_FILE *);
253extern int __overflow (_IO_FILE *, int);
254extern wint_t __wunderflow (_IO_FILE *);
255extern wint_t __wuflow (_IO_FILE *);
256extern wint_t __woverflow (_IO_FILE *, wint_t);
257extern int _IO_getc (_IO_FILE *__fp);
258extern int _IO_putc (int __c, _IO_FILE *__fp);
259extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__));
260extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__));
261extern int _IO_peekc_locked (_IO_FILE *__fp);
262extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__));
263extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__));
264extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__));
265extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
266 __gnuc_va_list, int *__restrict);
267extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
268 __gnuc_va_list);
269extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t);
270extern size_t _IO_sgetn (_IO_FILE *, void *, size_t);
271extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int);
272extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int);
273extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__));
274typedef _G_fpos_t fpos_t;
275extern struct _IO_FILE *stdin;
276extern struct _IO_FILE *stdout;
277extern struct _IO_FILE *stderr;
278extern int remove (__const char *__filename) __attribute__ ((__nothrow__));
279extern int rename (__const char *__old, __const char *__new) __attribute__ ((__nothrow__));
280extern FILE *tmpfile (void);
281extern char *tmpnam (char *__s) __attribute__ ((__nothrow__));
282extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__));
283extern char *tempnam (__const char *__dir, __const char *__pfx)
284 __attribute__ ((__nothrow__)) __attribute__ ((__malloc__));
285extern int fclose (FILE *__stream);
286extern int fflush (FILE *__stream);
287extern int fflush_unlocked (FILE *__stream);
288extern FILE *fopen (__const char *__restrict __filename,
289 __const char *__restrict __modes);
290extern FILE *freopen (__const char *__restrict __filename,
291 __const char *__restrict __modes,
292 FILE *__restrict __stream);
293extern FILE *fdopen (int __fd, __const char *__modes) __attribute__ ((__nothrow__));
294extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__));
295extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
296 int __modes, size_t __n) __attribute__ ((__nothrow__));
297extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
298 size_t __size) __attribute__ ((__nothrow__));
299extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__));
300extern int fprintf (FILE *__restrict __stream,
301 __const char *__restrict __format, ...);
302extern int printf (__const char *__restrict __format, ...);
303extern int sprintf (char *__restrict __s,
304 __const char *__restrict __format, ...) __attribute__ ((__nothrow__));
305extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
306 __gnuc_va_list __arg);
307extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg);
308extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
309 __gnuc_va_list __arg) __attribute__ ((__nothrow__));
310extern int snprintf (char *__restrict __s, size_t __maxlen,
311 __const char *__restrict __format, ...)
312 __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4)));
313extern int vsnprintf (char *__restrict __s, size_t __maxlen,
314 __const char *__restrict __format, __gnuc_va_list __arg)
315 __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0)));
316extern int fscanf (FILE *__restrict __stream,
317 __const char *__restrict __format, ...) ;
318extern int scanf (__const char *__restrict __format, ...) ;
319extern int sscanf (__const char *__restrict __s,
320 __const char *__restrict __format, ...) __attribute__ ((__nothrow__));
321extern int fgetc (FILE *__stream);
322extern int getc (FILE *__stream);
323extern int getchar (void);
324extern int getc_unlocked (FILE *__stream);
325extern int getchar_unlocked (void);
326extern int fgetc_unlocked (FILE *__stream);
327extern int fputc (int __c, FILE *__stream);
328extern int putc (int __c, FILE *__stream);
329extern int putchar (int __c);
330extern int fputc_unlocked (int __c, FILE *__stream);
331extern int putc_unlocked (int __c, FILE *__stream);
332extern int putchar_unlocked (int __c);
333extern int getw (FILE *__stream);
334extern int putw (int __w, FILE *__stream);
335extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
336 ;
337extern char *gets (char *__s) ;
338extern int fputs (__const char *__restrict __s, FILE *__restrict __stream);
339extern int puts (__const char *__s);
340extern int ungetc (int __c, FILE *__stream);
341extern size_t fread (void *__restrict __ptr, size_t __size,
342 size_t __n, FILE *__restrict __stream) ;
343extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
344 size_t __n, FILE *__restrict __s) ;
345extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
346 size_t __n, FILE *__restrict __stream) ;
347extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
348 size_t __n, FILE *__restrict __stream) ;
349extern int fseek (FILE *__stream, long int __off, int __whence);
350extern long int ftell (FILE *__stream) ;
351extern void rewind (FILE *__stream);
352extern int fseeko (FILE *__stream, __off_t __off, int __whence);
353extern __off_t ftello (FILE *__stream) ;
354extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
355extern int fsetpos (FILE *__stream, __const fpos_t *__pos);
356extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__));
357extern int feof (FILE *__stream) __attribute__ ((__nothrow__)) ;
358extern int ferror (FILE *__stream) __attribute__ ((__nothrow__)) ;
359extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__));
360extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__)) ;
361extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__)) ;
362extern void perror (__const char *__s);
363extern int sys_nerr;
364extern __const char *__const sys_errlist[];
365extern int fileno (FILE *__stream) __attribute__ ((__nothrow__)) ;
366extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__)) ;
367extern FILE *popen (__const char *__command, __const char *__modes) ;
368extern int pclose (FILE *__stream);
369extern char *ctermid (char *__s) __attribute__ ((__nothrow__));
370extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__));
371extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__)) ;
372extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__));
373typedef struct
374 {
375 int quot;
376 int rem;
377 } div_t;
378typedef struct
379 {
380 long int quot;
381 long int rem;
382 } ldiv_t;
383extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__)) ;
384extern double atof (__const char *__nptr)
385 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
386extern int atoi (__const char *__nptr)
387 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
388extern long int atol (__const char *__nptr)
389 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
390__extension__ extern long long int atoll (__const char *__nptr)
391 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
392extern double strtod (__const char *__restrict __nptr,
393 char **__restrict __endptr)
394 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
395extern long int strtol (__const char *__restrict __nptr,
396 char **__restrict __endptr, int __base)
397 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
398extern unsigned long int strtoul (__const char *__restrict __nptr,
399 char **__restrict __endptr, int __base)
400 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
401__extension__
402extern long long int strtoq (__const char *__restrict __nptr,
403 char **__restrict __endptr, int __base)
404 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
405__extension__
406extern unsigned long long int strtouq (__const char *__restrict __nptr,
407 char **__restrict __endptr, int __base)
408 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
409__extension__
410extern long long int strtoll (__const char *__restrict __nptr,
411 char **__restrict __endptr, int __base)
412 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
413__extension__
414extern unsigned long long int strtoull (__const char *__restrict __nptr,
415 char **__restrict __endptr, int __base)
416 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
417extern double __strtod_internal (__const char *__restrict __nptr,
418 char **__restrict __endptr, int __group)
419 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
420extern float __strtof_internal (__const char *__restrict __nptr,
421 char **__restrict __endptr, int __group)
422 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
423extern long double __strtold_internal (__const char *__restrict __nptr,
424 char **__restrict __endptr,
425 int __group)
426 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
427extern long int __strtol_internal (__const char *__restrict __nptr,
428 char **__restrict __endptr,
429 int __base, int __group)
430 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
431extern unsigned long int __strtoul_internal (__const char *__restrict __nptr,
432 char **__restrict __endptr,
433 int __base, int __group)
434 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
435__extension__
436extern long long int __strtoll_internal (__const char *__restrict __nptr,
437 char **__restrict __endptr,
438 int __base, int __group)
439 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
440__extension__
441extern unsigned long long int __strtoull_internal (__const char *
442 __restrict __nptr,
443 char **__restrict __endptr,
444 int __base, int __group)
445 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
446extern char *l64a (long int __n) __attribute__ ((__nothrow__)) ;
447extern long int a64l (__const char *__s)
448 __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
449typedef __u_char u_char;
450typedef __u_short u_short;
451typedef __u_int u_int;
452typedef __u_long u_long;
453typedef __quad_t quad_t;
454typedef __u_quad_t u_quad_t;
455typedef __fsid_t fsid_t;
456typedef __loff_t loff_t;
457typedef __ino_t ino_t;
458typedef __dev_t dev_t;
459typedef __gid_t gid_t;
460typedef __mode_t mode_t;
461typedef __nlink_t nlink_t;
462typedef __uid_t uid_t;
463typedef __off_t off_t;
464typedef __pid_t pid_t;
465typedef __id_t id_t;
466typedef __ssize_t ssize_t;
467typedef __daddr_t daddr_t;
468typedef __caddr_t caddr_t;
469typedef __key_t key_t;
470typedef __time_t time_t;
471typedef __clockid_t clockid_t;
472typedef __timer_t timer_t;
473typedef unsigned long int ulong;
474typedef unsigned short int ushort;
475typedef unsigned int uint;
476typedef int int8_t __attribute__ ((__mode__ (__QI__)));
477typedef int int16_t __attribute__ ((__mode__ (__HI__)));
478typedef int int32_t __attribute__ ((__mode__ (__SI__)));
479typedef int int64_t __attribute__ ((__mode__ (__DI__)));
480typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
481typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
482typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
483typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__)));
484typedef int register_t __attribute__ ((__mode__ (__word__)));
485typedef int __sig_atomic_t;
486typedef struct
487 {
488 unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
489 } __sigset_t;
490typedef __sigset_t sigset_t;
491struct timespec
492 {
493 __time_t tv_sec;
494 long int tv_nsec;
495 };
496struct timeval
497 {
498 __time_t tv_sec;
499 __suseconds_t tv_usec;
500 };
501typedef __suseconds_t suseconds_t;
502typedef long int __fd_mask;
503typedef struct
504 {
505 __fd_mask __fds_bits[1024 / (8 * sizeof (__fd_mask))];
506 } fd_set;
507typedef __fd_mask fd_mask;
508extern int select (int __nfds, fd_set *__restrict __readfds,
509 fd_set *__restrict __writefds,
510 fd_set *__restrict __exceptfds,
511 struct timeval *__restrict __timeout);
512extern int pselect (int __nfds, fd_set *__restrict __readfds,
513 fd_set *__restrict __writefds,
514 fd_set *__restrict __exceptfds,
515 const struct timespec *__restrict __timeout,
516 const __sigset_t *__restrict __sigmask);
517__extension__
518extern __inline unsigned int gnu_dev_major (unsigned long long int __dev)
519 __attribute__ ((__nothrow__));
520__extension__
521extern __inline unsigned int gnu_dev_minor (unsigned long long int __dev)
522 __attribute__ ((__nothrow__));
523__extension__
524extern __inline unsigned long long int gnu_dev_makedev (unsigned int __major,
525 unsigned int __minor)
526 __attribute__ ((__nothrow__));
527__extension__ extern __inline unsigned int
528__attribute__ ((__nothrow__)) gnu_dev_major (unsigned long long int __dev)
529{
530 return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff);
531}
532__extension__ extern __inline unsigned int
533__attribute__ ((__nothrow__)) gnu_dev_minor (unsigned long long int __dev)
534{
535 return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff);
536}
537__extension__ extern __inline unsigned long long int
538__attribute__ ((__nothrow__)) gnu_dev_makedev (unsigned int __major, unsigned int __minor)
539{
540 return ((__minor & 0xff) | ((__major & 0xfff) << 8)
541 | (((unsigned long long int) (__minor & ~0xff)) << 12)
542 | (((unsigned long long int) (__major & ~0xfff)) << 32));
543}
544typedef __blkcnt_t blkcnt_t;
545typedef __fsblkcnt_t fsblkcnt_t;
546typedef __fsfilcnt_t fsfilcnt_t;
547typedef unsigned long int pthread_t;
548typedef union
549{
550 char __size[56];
551 long int __align;
552} pthread_attr_t;
553typedef struct __pthread_internal_list
554{
555 struct __pthread_internal_list *__prev;
556 struct __pthread_internal_list *__next;
557} __pthread_list_t;
558typedef union
559{
560 struct __pthread_mutex_s
561 {
562 int __lock;
563 unsigned int __count;
564 int __owner;
565 unsigned int __nusers;
566 int __kind;
567 int __spins;
568 __pthread_list_t __list;
569 } __data;
570 char __size[40];
571 long int __align;
572} pthread_mutex_t;
573typedef union
574{
575 char __size[4];
576 int __align;
577} pthread_mutexattr_t;
578typedef union
579{
580 struct
581 {
582 int __lock;
583 unsigned int __futex;
584 __extension__ unsigned long long int __total_seq;
585 __extension__ unsigned long long int __wakeup_seq;
586 __extension__ unsigned long long int __woken_seq;
587 void *__mutex;
588 unsigned int __nwaiters;
589 unsigned int __broadcast_seq;
590 } __data;
591 char __size[48];
592 __extension__ long long int __align;
593} pthread_cond_t;
594typedef union
595{
596 char __size[4];
597 int __align;
598} pthread_condattr_t;
599typedef unsigned int pthread_key_t;
600typedef int pthread_once_t;
601typedef union
602{
603 struct
604 {
605 int __lock;
606 unsigned int __nr_readers;
607 unsigned int __readers_wakeup;
608 unsigned int __writer_wakeup;
609 unsigned int __nr_readers_queued;
610 unsigned int __nr_writers_queued;
611 int __writer;
612 int __pad1;
613 unsigned long int __pad2;
614 unsigned long int __pad3;
615 unsigned int __flags;
616 } __data;
617 char __size[56];
618 long int __align;
619} pthread_rwlock_t;
620typedef union
621{
622 char __size[8];
623 long int __align;
624} pthread_rwlockattr_t;
625typedef volatile int pthread_spinlock_t;
626typedef union
627{
628 char __size[32];
629 long int __align;
630} pthread_barrier_t;
631typedef union
632{
633 char __size[4];
634 int __align;
635} pthread_barrierattr_t;
636extern long int random (void) __attribute__ ((__nothrow__));
637extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__));
638extern char *initstate (unsigned int __seed, char *__statebuf,
639 size_t __statelen) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
640extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
641struct random_data
642 {
643 int32_t *fptr;
644 int32_t *rptr;
645 int32_t *state;
646 int rand_type;
647 int rand_deg;
648 int rand_sep;
649 int32_t *end_ptr;
650 };
651extern int random_r (struct random_data *__restrict __buf,
652 int32_t *__restrict __result) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
653extern int srandom_r (unsigned int __seed, struct random_data *__buf)
654 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
655extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
656 size_t __statelen,
657 struct random_data *__restrict __buf)
658 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 4)));
659extern int setstate_r (char *__restrict __statebuf,
660 struct random_data *__restrict __buf)
661 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
662extern int rand (void) __attribute__ ((__nothrow__));
663extern void srand (unsigned int __seed) __attribute__ ((__nothrow__));
664extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__));
665extern double drand48 (void) __attribute__ ((__nothrow__));
666extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
667extern long int lrand48 (void) __attribute__ ((__nothrow__));
668extern long int nrand48 (unsigned short int __xsubi[3])
669 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
670extern long int mrand48 (void) __attribute__ ((__nothrow__));
671extern long int jrand48 (unsigned short int __xsubi[3])
672 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
673extern void srand48 (long int __seedval) __attribute__ ((__nothrow__));
674extern unsigned short int *seed48 (unsigned short int __seed16v[3])
675 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
676extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
677struct drand48_data
678 {
679 unsigned short int __x[3];
680 unsigned short int __old_x[3];
681 unsigned short int __c;
682 unsigned short int __init;
683 unsigned long long int __a;
684 };
685extern int drand48_r (struct drand48_data *__restrict __buffer,
686 double *__restrict __result) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
687extern int erand48_r (unsigned short int __xsubi[3],
688 struct drand48_data *__restrict __buffer,
689 double *__restrict __result) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
690extern int lrand48_r (struct drand48_data *__restrict __buffer,
691 long int *__restrict __result)
692 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
693extern int nrand48_r (unsigned short int __xsubi[3],
694 struct drand48_data *__restrict __buffer,
695 long int *__restrict __result)
696 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
697extern int mrand48_r (struct drand48_data *__restrict __buffer,
698 long int *__restrict __result)
699 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
700extern int jrand48_r (unsigned short int __xsubi[3],
701 struct drand48_data *__restrict __buffer,
702 long int *__restrict __result)
703 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
704extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
705 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
706extern int seed48_r (unsigned short int __seed16v[3],
707 struct drand48_data *__buffer) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
708extern int lcong48_r (unsigned short int __param[7],
709 struct drand48_data *__buffer)
710 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
711extern void *malloc (size_t __size) __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) ;
712extern void *calloc (size_t __nmemb, size_t __size)
713 __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) ;
714extern void *realloc (void *__ptr, size_t __size)
715 __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) __attribute__ ((__warn_unused_result__));
716extern void free (void *__ptr) __attribute__ ((__nothrow__));
717extern void cfree (void *__ptr) __attribute__ ((__nothrow__));
718extern void *alloca (size_t __size) __attribute__ ((__nothrow__));
719extern void *valloc (size_t __size) __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) ;
720extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
721 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
722extern void abort (void) __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__));
723extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
724extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
725 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
726extern void exit (int __status) __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__));
727extern char *getenv (__const char *__name) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
728extern char *__secure_getenv (__const char *__name)
729 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
730extern int putenv (char *__string) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
731extern int setenv (__const char *__name, __const char *__value, int __replace)
732 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
733extern int unsetenv (__const char *__name) __attribute__ ((__nothrow__));
734extern int clearenv (void) __attribute__ ((__nothrow__));
735extern char *mktemp (char *__template) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
736extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ;
737extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
738extern int system (__const char *__command) ;
739extern char *realpath (__const char *__restrict __name,
740 char *__restrict __resolved) __attribute__ ((__nothrow__)) ;
741typedef int (*__compar_fn_t) (__const void *, __const void *);
742extern void *bsearch (__const void *__key, __const void *__base,
743 size_t __nmemb, size_t __size, __compar_fn_t __compar)
744 __attribute__ ((__nonnull__ (1, 2, 5))) ;
745extern void qsort (void *__base, size_t __nmemb, size_t __size,
746 __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4)));
747extern int abs (int __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)) ;
748extern long int labs (long int __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)) ;
749extern div_t div (int __numer, int __denom)
750 __attribute__ ((__nothrow__)) __attribute__ ((__const__)) ;
751extern ldiv_t ldiv (long int __numer, long int __denom)
752 __attribute__ ((__nothrow__)) __attribute__ ((__const__)) ;
753extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
754 int *__restrict __sign) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) ;
755extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
756 int *__restrict __sign) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) ;
757extern char *gcvt (double __value, int __ndigit, char *__buf)
758 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3))) ;
759extern char *qecvt (long double __value, int __ndigit,
760 int *__restrict __decpt, int *__restrict __sign)
761 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) ;
762extern char *qfcvt (long double __value, int __ndigit,
763 int *__restrict __decpt, int *__restrict __sign)
764 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) ;
765extern char *qgcvt (long double __value, int __ndigit, char *__buf)
766 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3))) ;
767extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
768 int *__restrict __sign, char *__restrict __buf,
769 size_t __len) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5)));
770extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
771 int *__restrict __sign, char *__restrict __buf,
772 size_t __len) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5)));
773extern int qecvt_r (long double __value, int __ndigit,
774 int *__restrict __decpt, int *__restrict __sign,
775 char *__restrict __buf, size_t __len)
776 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5)));
777extern int qfcvt_r (long double __value, int __ndigit,
778 int *__restrict __decpt, int *__restrict __sign,
779 char *__restrict __buf, size_t __len)
780 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5)));
781extern int mblen (__const char *__s, size_t __n) __attribute__ ((__nothrow__)) ;
782extern int mbtowc (wchar_t *__restrict __pwc,
783 __const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__)) ;
784extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__)) ;
785extern size_t mbstowcs (wchar_t *__restrict __pwcs,
786 __const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__));
787extern size_t wcstombs (char *__restrict __s,
788 __const wchar_t *__restrict __pwcs, size_t __n)
789 __attribute__ ((__nothrow__));
790extern int rpmatch (__const char *__response) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
791extern int posix_openpt (int __oflag) ;
792extern int getloadavg (double __loadavg[], int __nelem)
793 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
794struct sched_param
795 {
796 int __sched_priority;
797 };
798extern int clone (int (*__fn) (void *__arg), void *__child_stack,
799 int __flags, void *__arg, ...) __attribute__ ((__nothrow__));
800extern int unshare (int __flags) __attribute__ ((__nothrow__));
801struct __sched_param
802 {
803 int __sched_priority;
804 };
805typedef unsigned long int __cpu_mask;
806typedef struct
807{
808 __cpu_mask __bits[1024 / (8 * sizeof (__cpu_mask))];
809} cpu_set_t;
810extern int sched_setparam (__pid_t __pid, __const struct sched_param *__param)
811 __attribute__ ((__nothrow__));
812extern int sched_getparam (__pid_t __pid, struct sched_param *__param) __attribute__ ((__nothrow__));
813extern int sched_setscheduler (__pid_t __pid, int __policy,
814 __const struct sched_param *__param) __attribute__ ((__nothrow__));
815extern int sched_getscheduler (__pid_t __pid) __attribute__ ((__nothrow__));
816extern int sched_yield (void) __attribute__ ((__nothrow__));
817extern int sched_get_priority_max (int __algorithm) __attribute__ ((__nothrow__));
818extern int sched_get_priority_min (int __algorithm) __attribute__ ((__nothrow__));
819extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __attribute__ ((__nothrow__));
820typedef __clock_t clock_t;
821struct tm
822{
823 int tm_sec;
824 int tm_min;
825 int tm_hour;
826 int tm_mday;
827 int tm_mon;
828 int tm_year;
829 int tm_wday;
830 int tm_yday;
831 int tm_isdst;
832 long int tm_gmtoff;
833 __const char *tm_zone;
834};
835struct itimerspec
836 {
837 struct timespec it_interval;
838 struct timespec it_value;
839 };
840struct sigevent;
841extern clock_t clock (void) __attribute__ ((__nothrow__));
842extern time_t time (time_t *__timer) __attribute__ ((__nothrow__));
843extern double difftime (time_t __time1, time_t __time0)
844 __attribute__ ((__nothrow__)) __attribute__ ((__const__));
845extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__));
846extern size_t strftime (char *__restrict __s, size_t __maxsize,
847 __const char *__restrict __format,
848 __const struct tm *__restrict __tp) __attribute__ ((__nothrow__));
849extern struct tm *gmtime (__const time_t *__timer) __attribute__ ((__nothrow__));
850extern struct tm *localtime (__const time_t *__timer) __attribute__ ((__nothrow__));
851extern struct tm *gmtime_r (__const time_t *__restrict __timer,
852 struct tm *__restrict __tp) __attribute__ ((__nothrow__));
853extern struct tm *localtime_r (__const time_t *__restrict __timer,
854 struct tm *__restrict __tp) __attribute__ ((__nothrow__));
855extern char *asctime (__const struct tm *__tp) __attribute__ ((__nothrow__));
856extern char *ctime (__const time_t *__timer) __attribute__ ((__nothrow__));
857extern char *asctime_r (__const struct tm *__restrict __tp,
858 char *__restrict __buf) __attribute__ ((__nothrow__));
859extern char *ctime_r (__const time_t *__restrict __timer,
860 char *__restrict __buf) __attribute__ ((__nothrow__));
861extern char *__tzname[2];
862extern int __daylight;
863extern long int __timezone;
864extern char *tzname[2];
865extern void tzset (void) __attribute__ ((__nothrow__));
866extern int daylight;
867extern long int timezone;
868extern int stime (__const time_t *__when) __attribute__ ((__nothrow__));
869extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__));
870extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__));
871extern int dysize (int __year) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
872extern int nanosleep (__const struct timespec *__requested_time,
873 struct timespec *__remaining);
874extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__));
875extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__));
876extern int clock_settime (clockid_t __clock_id, __const struct timespec *__tp)
877 __attribute__ ((__nothrow__));
878extern int clock_nanosleep (clockid_t __clock_id, int __flags,
879 __const struct timespec *__req,
880 struct timespec *__rem);
881extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__));
882extern int timer_create (clockid_t __clock_id,
883 struct sigevent *__restrict __evp,
884 timer_t *__restrict __timerid) __attribute__ ((__nothrow__));
885extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__));
886extern int timer_settime (timer_t __timerid, int __flags,
887 __const struct itimerspec *__restrict __value,
888 struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__));
889extern int timer_gettime (timer_t __timerid, struct itimerspec *__value)
890 __attribute__ ((__nothrow__));
891extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__));
892typedef long int __jmp_buf[8];
893enum
894{
895 PTHREAD_CREATE_JOINABLE,
896 PTHREAD_CREATE_DETACHED
897};
898enum
899{
900 PTHREAD_MUTEX_TIMED_NP,
901 PTHREAD_MUTEX_RECURSIVE_NP,
902 PTHREAD_MUTEX_ERRORCHECK_NP,
903 PTHREAD_MUTEX_ADAPTIVE_NP
904};
905enum
906{
907 PTHREAD_RWLOCK_PREFER_READER_NP,
908 PTHREAD_RWLOCK_PREFER_WRITER_NP,
909 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,
910 PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_READER_NP
911};
912enum
913{
914 PTHREAD_INHERIT_SCHED,
915 PTHREAD_EXPLICIT_SCHED
916};
917enum
918{
919 PTHREAD_SCOPE_SYSTEM,
920 PTHREAD_SCOPE_PROCESS
921};
922enum
923{
924 PTHREAD_PROCESS_PRIVATE,
925 PTHREAD_PROCESS_SHARED
926};
927struct _pthread_cleanup_buffer
928{
929 void (*__routine) (void *);
930 void *__arg;
931 int __canceltype;
932 struct _pthread_cleanup_buffer *__prev;
933};
934enum
935{
936 PTHREAD_CANCEL_ENABLE,
937 PTHREAD_CANCEL_DISABLE
938};
939enum
940{
941 PTHREAD_CANCEL_DEFERRED,
942 PTHREAD_CANCEL_ASYNCHRONOUS
943};
944extern int pthread_create (pthread_t *__restrict __newthread,
945 __const pthread_attr_t *__restrict __attr,
946 void *(*__start_routine) (void *),
947 void *__restrict __arg) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 3)));
948extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__));
949extern int pthread_join (pthread_t __th, void **__thread_return);
950extern int pthread_detach (pthread_t __th) __attribute__ ((__nothrow__));
951extern pthread_t pthread_self (void) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
952extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) __attribute__ ((__nothrow__));
953extern int pthread_attr_init (pthread_attr_t *__attr) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
954extern int pthread_attr_destroy (pthread_attr_t *__attr)
955 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
956extern int pthread_attr_getdetachstate (__const pthread_attr_t *__attr,
957 int *__detachstate)
958 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
959extern int pthread_attr_setdetachstate (pthread_attr_t *__attr,
960 int __detachstate)
961 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
962extern int pthread_attr_getguardsize (__const pthread_attr_t *__attr,
963 size_t *__guardsize)
964 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
965extern int pthread_attr_setguardsize (pthread_attr_t *__attr,
966 size_t __guardsize)
967 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
968extern int pthread_attr_getschedparam (__const pthread_attr_t *__restrict
969 __attr,
970 struct sched_param *__restrict __param)
971 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
972extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
973 __const struct sched_param *__restrict
974 __param) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
975extern int pthread_attr_getschedpolicy (__const pthread_attr_t *__restrict
976 __attr, int *__restrict __policy)
977 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
978extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy)
979 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
980extern int pthread_attr_getinheritsched (__const pthread_attr_t *__restrict
981 __attr, int *__restrict __inherit)
982 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
983extern int pthread_attr_setinheritsched (pthread_attr_t *__attr,
984 int __inherit)
985 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
986extern int pthread_attr_getscope (__const pthread_attr_t *__restrict __attr,
987 int *__restrict __scope)
988 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
989extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope)
990 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
991extern int pthread_attr_getstackaddr (__const pthread_attr_t *__restrict
992 __attr, void **__restrict __stackaddr)
993 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__deprecated__));
994extern int pthread_attr_setstackaddr (pthread_attr_t *__attr,
995 void *__stackaddr)
996 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__));
997extern int pthread_attr_getstacksize (__const pthread_attr_t *__restrict
998 __attr, size_t *__restrict __stacksize)
999 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1000extern int pthread_attr_setstacksize (pthread_attr_t *__attr,
1001 size_t __stacksize)
1002 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1003extern int pthread_attr_getstack (__const pthread_attr_t *__restrict __attr,
1004 void **__restrict __stackaddr,
1005 size_t *__restrict __stacksize)
1006 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2, 3)));
1007extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
1008 size_t __stacksize) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1009extern int pthread_setschedparam (pthread_t __target_thread, int __policy,
1010 __const struct sched_param *__param)
1011 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3)));
1012extern int pthread_getschedparam (pthread_t __target_thread,
1013 int *__restrict __policy,
1014 struct sched_param *__restrict __param)
1015 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3)));
1016extern int pthread_setschedprio (pthread_t __target_thread, int __prio)
1017 __attribute__ ((__nothrow__));
1018extern int pthread_once (pthread_once_t *__once_control,
1019 void (*__init_routine) (void)) __attribute__ ((__nonnull__ (1, 2)));
1020extern int pthread_setcancelstate (int __state, int *__oldstate);
1021extern int pthread_setcanceltype (int __type, int *__oldtype);
1022extern int pthread_cancel (pthread_t __th);
1023extern void pthread_testcancel (void);
1024typedef struct
1025{
1026 struct
1027 {
1028 __jmp_buf __cancel_jmp_buf;
1029 int __mask_was_saved;
1030 } __cancel_jmp_buf[1];
1031 void *__pad[4];
1032} __pthread_unwind_buf_t __attribute__ ((__aligned__));
1033struct __pthread_cleanup_frame
1034{
1035 void (*__cancel_routine) (void *);
1036 void *__cancel_arg;
1037 int __do_it;
1038 int __cancel_type;
1039};
1040extern void __pthread_register_cancel (__pthread_unwind_buf_t *__buf)
1041 ;
1042extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
1043 ;
1044extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf)
1045 __attribute__ ((__noreturn__))
1046 __attribute__ ((__weak__))
1047 ;
1048struct __jmp_buf_tag;
1049extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __attribute__ ((__nothrow__));
1050extern int pthread_mutex_init (pthread_mutex_t *__mutex,
1051 __const pthread_mutexattr_t *__mutexattr)
1052 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1053extern int pthread_mutex_destroy (pthread_mutex_t *__mutex)
1054 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1055extern int pthread_mutex_trylock (pthread_mutex_t *__mutex)
1056 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1057extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
1058 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1059extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
1060 __const struct timespec *__restrict
1061 __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1062extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
1063 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1064extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr)
1065 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1066extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr)
1067 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1068extern int pthread_mutexattr_getpshared (__const pthread_mutexattr_t *
1069 __restrict __attr,
1070 int *__restrict __pshared)
1071 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1072extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr,
1073 int __pshared)
1074 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1075extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
1076 __const pthread_rwlockattr_t *__restrict
1077 __attr) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1078extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock)
1079 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1080extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock)
1081 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1082extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
1083 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1084extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
1085 __const struct timespec *__restrict
1086 __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1087extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
1088 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1089extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
1090 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1091extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
1092 __const struct timespec *__restrict
1093 __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1094extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
1095 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1096extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr)
1097 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1098extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr)
1099 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1100extern int pthread_rwlockattr_getpshared (__const pthread_rwlockattr_t *
1101 __restrict __attr,
1102 int *__restrict __pshared)
1103 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1104extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr,
1105 int __pshared)
1106 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1107extern int pthread_rwlockattr_getkind_np (__const pthread_rwlockattr_t *
1108 __restrict __attr,
1109 int *__restrict __pref)
1110 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1111extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
1112 int __pref) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1113extern int pthread_cond_init (pthread_cond_t *__restrict __cond,
1114 __const pthread_condattr_t *__restrict
1115 __cond_attr) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1116extern int pthread_cond_destroy (pthread_cond_t *__cond)
1117 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1118extern int pthread_cond_signal (pthread_cond_t *__cond)
1119 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1120extern int pthread_cond_broadcast (pthread_cond_t *__cond)
1121 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1122extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
1123 pthread_mutex_t *__restrict __mutex)
1124 __attribute__ ((__nonnull__ (1, 2)));
1125extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
1126 pthread_mutex_t *__restrict __mutex,
1127 __const struct timespec *__restrict
1128 __abstime) __attribute__ ((__nonnull__ (1, 2, 3)));
1129extern int pthread_condattr_init (pthread_condattr_t *__attr)
1130 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1131extern int pthread_condattr_destroy (pthread_condattr_t *__attr)
1132 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1133extern int pthread_condattr_getpshared (__const pthread_condattr_t *
1134 __restrict __attr,
1135 int *__restrict __pshared)
1136 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1137extern int pthread_condattr_setpshared (pthread_condattr_t *__attr,
1138 int __pshared) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1139extern int pthread_condattr_getclock (__const pthread_condattr_t *
1140 __restrict __attr,
1141 __clockid_t *__restrict __clock_id)
1142 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1143extern int pthread_condattr_setclock (pthread_condattr_t *__attr,
1144 __clockid_t __clock_id)
1145 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1146extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
1147 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1148extern int pthread_spin_destroy (pthread_spinlock_t *__lock)
1149 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1150extern int pthread_spin_lock (pthread_spinlock_t *__lock)
1151 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1152extern int pthread_spin_trylock (pthread_spinlock_t *__lock)
1153 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1154extern int pthread_spin_unlock (pthread_spinlock_t *__lock)
1155 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1156extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier,
1157 __const pthread_barrierattr_t *__restrict
1158 __attr, unsigned int __count)
1159 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1160extern int pthread_barrier_destroy (pthread_barrier_t *__barrier)
1161 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1162extern int pthread_barrier_wait (pthread_barrier_t *__barrier)
1163 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1164extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr)
1165 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1166extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr)
1167 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1168extern int pthread_barrierattr_getpshared (__const pthread_barrierattr_t *
1169 __restrict __attr,
1170 int *__restrict __pshared)
1171 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1172extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
1173 int __pshared)
1174 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1175extern int pthread_key_create (pthread_key_t *__key,
1176 void (*__destr_function) (void *))
1177 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1178extern int pthread_key_delete (pthread_key_t __key) __attribute__ ((__nothrow__));
1179extern void *pthread_getspecific (pthread_key_t __key) __attribute__ ((__nothrow__));
1180extern int pthread_setspecific (pthread_key_t __key,
1181 __const void *__pointer) __attribute__ ((__nothrow__)) ;
1182extern int pthread_getcpuclockid (pthread_t __thread_id,
1183 __clockid_t *__clock_id)
1184 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
1185extern int pthread_atfork (void (*__prepare) (void),
1186 void (*__parent) (void),
1187 void (*__child) (void)) __attribute__ ((__nothrow__));
1188static int iSet = 4;
1189static int iCheck = 1;
1190static int a = 0;
1191static int b = 0;
1192void __ESBMC_yield();
1193void *setThread(void *param);
1194void *checkThread(void *param);
1195void set();
1196int check();
1197int main(int argc, char *argv[]) {
1198 int i, err;
1199 if (argc != 1) {
1200 if (argc != 3) {
1201 fprintf(stderr, "./reorder <param1> <param2>\n");
1202 exit(-1);
1203 } else {
1204 sscanf(argv[1], "%d", &iSet);
1205 sscanf(argv[2], "%d", &iCheck);
1206 }
1207 }
1208 pthread_t setPool[iSet];
1209 pthread_t checkPool[iCheck];
1210 for (i = 0; i < iSet; i++) {
1211 if (0 != (err = pthread_create(&setPool[i], ((void *)0), &setThread, ((void *)0)))) {
1212 fprintf(stderr, "Error [%d] found creating set thread.\n", err);
1213 exit(-1);
1214 }
1215 }
1216 for (i = 0; i < iCheck; i++) {
1217 if (0 != (err = pthread_create(&checkPool[i], ((void *)0), &checkThread,
1218 ((void *)0)))) {
1219 fprintf(stderr, "Error [%d] found creating check thread.\n", err);
1220 exit(-1);
1221 }
1222 }
1223 for (i = 0; i < iSet; i++) {
1224 if (0 != (err = pthread_join(setPool[i], ((void *)0)))) {
1225 fprintf(stderr, "pthread join error: %d\n", err);
1226 exit(-1);
1227 }
1228 }
1229 for (i = 0; i < iCheck; i++) {
1230 if (0 != (err = pthread_join(checkPool[i], ((void *)0)))) {
1231 fprintf(stderr, "pthread join error: %d\n", err);
1232 exit(-1);
1233 }
1234 }
1235 return 0;
1236}
1237void *setThread(void *param) {
1238 a = 1;
1239 b = -1;
1240 return ((void *)0);
1241}
1242void *checkThread(void *param) {
1243 if (! ((a == 0 && b == 0) || (a == 1 && b == -1))) {
1244 fprintf(stderr, "Bug found!\n");
1245 goto ERROR;
1246 ERROR:
1247 ;
1248 }
1249 return ((void *)0);
1250}