From 879bb4fd5ca73211981702cf6b1f8a4410304d5a Mon Sep 17 00:00:00 2001 From: Michael Tautschnig Date: Wed, 15 Nov 2017 16:10:31 +0000 Subject: [PATCH 1/4] Rename busybox/basename benchmark files with undefined behaviour The version without undefined behaviour, where additional properties can be checked, already exists in the repository. --- ...verflow_false-valid-deref.c => basename_false-valid-deref.c} | 0 ...verflow_false-valid-deref.i => basename_false-valid-deref.i} | 0 c/check.py | 2 -- 3 files changed, 2 deletions(-) rename c/busybox-1.22.0/{basename_false-unreach-call_true-no-overflow_false-valid-deref.c => basename_false-valid-deref.c} (100%) rename c/busybox-1.22.0/{basename_false-unreach-call_true-no-overflow_false-valid-deref.i => basename_false-valid-deref.i} (100%) diff --git a/c/busybox-1.22.0/basename_false-unreach-call_true-no-overflow_false-valid-deref.c b/c/busybox-1.22.0/basename_false-valid-deref.c similarity index 100% rename from c/busybox-1.22.0/basename_false-unreach-call_true-no-overflow_false-valid-deref.c rename to c/busybox-1.22.0/basename_false-valid-deref.c diff --git a/c/busybox-1.22.0/basename_false-unreach-call_true-no-overflow_false-valid-deref.i b/c/busybox-1.22.0/basename_false-valid-deref.i similarity index 100% rename from c/busybox-1.22.0/basename_false-unreach-call_true-no-overflow_false-valid-deref.i rename to c/busybox-1.22.0/basename_false-valid-deref.i diff --git a/c/check.py b/c/check.py index d0c19cb0bce..0b66667bbbd 100755 --- a/c/check.py +++ b/c/check.py @@ -91,8 +91,6 @@ ] KNOWN_BENCHMARK_FILE_PROBLEMS = [ - ("busybox-1.22.0/basename_false-unreach-call_true-no-overflow_false-valid-deref.c", "has expected undefined behavior but also a verdict for some other property"), - ("busybox-1.22.0/basename_false-unreach-call_true-no-overflow_false-valid-deref.i", "has expected undefined behavior but also a verdict for some other property"), ("busybox-1.22.0/head_true-no-overflow_false-valid-deref.c", "has expected undefined behavior but also a verdict for some other property"), ("busybox-1.22.0/head_true-no-overflow_false-valid-deref.i", "has expected undefined behavior but also a verdict for some other property"), ("busybox-1.22.0/sleep_true-no-overflow_false-valid-deref.c", "has expected undefined behavior but also a verdict for some other property"), From b5075cadce1be1df713485100b2f2684863e013f Mon Sep 17 00:00:00 2001 From: Michael Tautschnig Date: Wed, 15 Nov 2017 16:30:19 +0000 Subject: [PATCH 2/4] Rename busybox/head file with undefined behaviour and add fixed variant This is a follow-up to d115b6f9f72, where the null-pointer dereference has been discussed. --- ...valid-deref.c => head_false-valid-deref.c} | 0 ...valid-deref.i => head_false-valid-deref.i} | 0 .../head_true-no-overflow_true-valid-deref.c | 959 ++++++ .../head_true-no-overflow_true-valid-deref.i | 2951 +++++++++++++++++ c/check.py | 2 - 5 files changed, 3910 insertions(+), 2 deletions(-) rename c/busybox-1.22.0/{head_true-no-overflow_false-valid-deref.c => head_false-valid-deref.c} (100%) rename c/busybox-1.22.0/{head_true-no-overflow_false-valid-deref.i => head_false-valid-deref.i} (100%) create mode 100644 c/busybox-1.22.0/head_true-no-overflow_true-valid-deref.c create mode 100644 c/busybox-1.22.0/head_true-no-overflow_true-valid-deref.i diff --git a/c/busybox-1.22.0/head_true-no-overflow_false-valid-deref.c b/c/busybox-1.22.0/head_false-valid-deref.c similarity index 100% rename from c/busybox-1.22.0/head_true-no-overflow_false-valid-deref.c rename to c/busybox-1.22.0/head_false-valid-deref.c diff --git a/c/busybox-1.22.0/head_true-no-overflow_false-valid-deref.i b/c/busybox-1.22.0/head_false-valid-deref.i similarity index 100% rename from c/busybox-1.22.0/head_true-no-overflow_false-valid-deref.i rename to c/busybox-1.22.0/head_false-valid-deref.i diff --git a/c/busybox-1.22.0/head_true-no-overflow_true-valid-deref.c b/c/busybox-1.22.0/head_true-no-overflow_true-valid-deref.c new file mode 100644 index 00000000000..7b5dd5ef008 --- /dev/null +++ b/c/busybox-1.22.0/head_true-no-overflow_true-valid-deref.c @@ -0,0 +1,959 @@ +/* + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 dated June, 1991. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301, USA. +*/ + +#include "busybox_sv_comp.h" + +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// file include/libbb.h line 841 +struct suffix_mult; + +#ifndef NULL +#define NULL ((void*)0) +#endif + +// file include/libbb.h line 1081 +static void bb_error_msg(const char *s, ...); +// file include/libbb.h line 1082 +static void bb_error_msg_and_die(const char *s, ...); +// file libbb/get_line_from_file.c line 14 +static char * bb_get_chunk_from_file(struct _IO_FILE *file, signed int *end); +// file include/libbb.h line 1083 +static void bb_perror_msg(const char *s, ...); +// file include/libbb.h line 1085 +static void bb_perror_msg_and_die(const char *s, ...); +// file ./libbb-dump.i line 1 +static void bb_show_usage(void); +// file include/libbb.h line 1084 +static void bb_simple_perror_msg(const char *s); +// file include/libbb.h line 1092 +static void bb_verror_msg(const char *s, va_list p, const char *strerr); +// file libbb/xfuncs_printf.c line 269 +static void die_if_ferror(struct _IO_FILE *fp, const char *fn); +// file libbb/xfuncs_printf.c line 278 +static void die_if_ferror_stdout(void); +// file coreutils/head.c line 133 +static unsigned long int eat_num(_Bool *negative_N, const char *p); +// file libbb/fclose_nonstdin.c line 17 +static signed int fclose_if_not_stdin(struct _IO_FILE *f); +// file include/libbb.h line 785 +static signed int fflush_all(void); +// file include/libbb.h line 786 +static void fflush_stdout_and_exit(signed int retval); +// file include/libbb.h line 790 +static struct _IO_FILE * fopen_or_warn(const char *path, const char *mode); +// file include/libbb.h line 793 +static struct _IO_FILE * fopen_or_warn_stdin(const char *filename); +// file include/libbb.h line 751 +static signed long int full_write(signed int fd, const void *buf, unsigned long int len); +// file coreutils/head.c line 61 +static void print_except_N_last_bytes(struct _IO_FILE *fp, unsigned int count); +// file coreutils/head.c line 90 +static void print_except_N_last_lines(struct _IO_FILE *fp, unsigned int count); +// file coreutils/head.c line 44 +static void print_first_N(struct _IO_FILE *fp, unsigned long int count, _Bool count_bytes); +// file include/libbb.h line 748 +static signed long int safe_write(signed int fd, const void *buf, unsigned long int count); +// file include/xatonum.h line 87 +static inline unsigned long int xatoul_sfx(const char *str, struct suffix_mult *sfx); +// file libbb/xatonum_template.c line 110 +static unsigned long long int xatoull_sfx(const char *numstr, struct suffix_mult *suffixes); +// file include/libbb.h line 1079 +static void xfunc_die(void); +// file include/libbb.h line 695 +static void * xmalloc(unsigned long int size); +// file libbb/get_line_from_file.c line 46 +static char * xmalloc_fgets(struct _IO_FILE *file); +// file include/libbb.h line 697 +static void * xrealloc(void *ptr, unsigned long int size); +// file libbb/xatonum_template.c line 19 +static unsigned long long int xstrtoull_range_sfx(const char *numstr, signed int base, unsigned long long int lower, unsigned long long int upper, struct suffix_mult *suffixes); +// file include/libbb.h line 696 +static void * xzalloc(unsigned long int size); + +struct libbb_anonymous$7 +{ + // __val + unsigned long int __val[16l]; +}; + +struct suffix_mult +{ + // suffix + char suffix[4l]; + // mult + unsigned int mult; +}; + +// file include/libbb.h line 1708 +static const char *applet_name; +// file libbb/ptr_to_globals.c line 19 +static signed int bb_errno_location; +static signed int * const bb_errno = &bb_errno_location; +// file libbb/messages.c line 25 +static const char bb_msg_memory_exhausted[14l] = { (const char)111, (const char)117, (const char)116, (const char)32, (const char)111, (const char)102, (const char)32, (const char)109, (const char)101, (const char)109, (const char)111, (const char)114, (const char)121, (const char)0 }; +// file libbb/messages.c line 33 +static const char bb_msg_standard_input[15l] = { (const char)115, (const char)116, (const char)97, (const char)110, (const char)100, (const char)97, (const char)114, (const char)100, (const char)32, (const char)105, (const char)110, (const char)112, (const char)117, (const char)116, (const char)0 }; +// file libbb/messages.c line 34 +static const char bb_msg_standard_output[16l] = { (const char)115, (const char)116, (const char)97, (const char)110, (const char)100, (const char)97, (const char)114, (const char)100, (const char)32, (const char)111, (const char)117, (const char)116, (const char)112, (const char)117, (const char)116, (const char)0 }; +// file libbb/xatonum.c line 72 +static struct suffix_mult bkm_suffixes[4l] = { { .suffix={ (char)98, (char)0, (char)0, (char)0 }, .mult=(unsigned int)512 }, + { .suffix={ (char)107, (char)0, (char)0, (char)0 }, .mult=(unsigned int)1024 }, + { .suffix={ (char)109, (char)0, (char)0, (char)0 }, .mult=(unsigned int)(1024 * 1024) }, + { .suffix={ (char)0, (char)0, (char)0, (char)0 }, .mult=(unsigned int)0 } }; +// file libbb/xfunc_die.c line 17 +static struct __jmp_buf_tag die_jmp[1l]; +// file libbb/xfunc_die.c line 15 +static signed int die_sleep; +// file coreutils/head.c line 144 +static const char head_opts[7l] = { (const char)110, (const char)58, (const char)99, (const char)58, (const char)113, (const char)118, (const char)0 }; +// file libbb/verror_msg.c line 14 +static signed char logmode = (signed char)1; +// file libbb/verror_msg.c line 15 +static const char *msg_eol = "\n"; +// file libbb/default_error_retval.c line 18 +static unsigned char xfunc_error_retval = (unsigned char)1; + +// file include/libbb.h line 1081 +static void bb_error_msg(const char *s, ...) +{ + va_list p; + va_start(p, s); + bb_verror_msg(s, p, (const char *)NULL); + va_end(p); +} + +// file include/libbb.h line 1082 +static void bb_error_msg_and_die(const char *s, ...) +{ + va_list p; + va_start(p, s); + bb_verror_msg(s, p, (const char *)NULL); + va_end(p); + abort(); // xfunc_die() invokes exit() and would thus leak memory +} + +// file libbb/get_line_from_file.c line 14 +static char * bb_get_chunk_from_file(struct _IO_FILE *file, signed int *end) +{ + signed int ch; + unsigned int idx = (unsigned int)0; + char *linebuf = (char *)NULL; + void *return_value_xrealloc$1; + unsigned int tmp_post$2; + do + { + ch=getc(file); + if(ch == -1) + break; + + if((255u & idx) == 0u) + { + return_value_xrealloc$1=xrealloc((void *)linebuf, (unsigned long int)(idx + (unsigned int)256)); + linebuf = (char *)return_value_xrealloc$1; + } + + tmp_post$2 = idx; + idx = idx + 1u; + linebuf[(signed long int)tmp_post$2] = (char)ch; + if(ch == 0) + break; + + if(!(end == ((signed int *)NULL))) + { + if(ch == 10) + break; + + } + + } + while((_Bool)1); + if(!(end == ((signed int *)NULL))) + *end = (signed int)idx; + + if(!(linebuf == ((char *)NULL))) + { + void *return_value_xrealloc$3; + return_value_xrealloc$3=xrealloc((void *)linebuf, (unsigned long int)(idx + (unsigned int)1)); + linebuf = (char *)return_value_xrealloc$3; + linebuf[(signed long int)idx] = (char)0; + } + + return linebuf; +} + +// file include/libbb.h line 1083 +static void bb_perror_msg(const char *s, ...) +{ + va_list p; + va_start(p, s); + char *tmp_if_expr$2; + char *return_value_strerror$1; + if(!(*bb_errno == 0)) + { + return_value_strerror$1=strerror(*bb_errno); + tmp_if_expr$2 = return_value_strerror$1; + } + + else + tmp_if_expr$2 = (char *)NULL; + bb_verror_msg(s, p, tmp_if_expr$2); + va_end(p); +} + +// file include/libbb.h line 1085 +static void bb_perror_msg_and_die(const char *s, ...) +{ + va_list p; + va_start(p, s); + char *tmp_if_expr$2; + char *return_value_strerror$1; + if(!(*bb_errno == 0)) + { + return_value_strerror$1=strerror(*bb_errno); + tmp_if_expr$2 = return_value_strerror$1; + } + + else + tmp_if_expr$2 = (char *)NULL; + bb_verror_msg(s, p, tmp_if_expr$2); + va_end(p); + abort(); // xfunc_die() invokes exit() and would thus leak memory +} + +// file ./libbb-dump.i line 1 +static void bb_show_usage(void) +{ + ; +} + +// file include/libbb.h line 1084 +static void bb_simple_perror_msg(const char *s) +{ + bb_perror_msg("%s", s); +} + +// file include/libbb.h line 1092 +static void bb_verror_msg(const char *s, va_list p, const char *strerr) +{ + char *msg; + char *msg1; + signed int applet_len; + signed int strerr_len; + signed int msgeol_len; + signed int used; + if((signed int)logmode == 0) + return; + + if(s == ((const char *)NULL)) + s = ""; + + used=vasprintf(&msg, s, p); + if(used < 0) + return; + + unsigned long int return_value_strlen$1; + return_value_strlen$1=strlen(applet_name); + applet_len = (signed int)(return_value_strlen$1 + (unsigned long int)2); + unsigned long int tmp_if_expr$3; + unsigned long int return_value_strlen$2; + if(!(strerr == ((const char *)NULL))) + { + return_value_strlen$2=strlen(strerr); + tmp_if_expr$3 = return_value_strlen$2; + } + + else + tmp_if_expr$3 = (unsigned long int)0; + strerr_len = (signed int)tmp_if_expr$3; + unsigned long int return_value_strlen$4; + return_value_strlen$4=strlen(msg_eol); + msgeol_len = (signed int)return_value_strlen$4; + void *return_value_realloc$5; + return_value_realloc$5=realloc((void *)msg, (unsigned long int)(applet_len + used + strerr_len + msgeol_len + 3)); + msg1 = (char *)return_value_realloc$5; + signed int tmp_post$6; + signed int tmp_post$7; + signed int tmp_post$8; + if(msg1 == ((char *)NULL)) + { + tmp_post$6 = used; + used = used + 1; + msg[(signed long int)tmp_post$6] = (char)10; + applet_len = 0; + } + + else + { + msg = msg1; + memmove((void *)(msg + (signed long int)applet_len), (const void *)msg, (unsigned long int)used); + used = used + applet_len; + strcpy(msg, applet_name); + msg[(signed long int)(applet_len - 2)] = (char)58; + msg[(signed long int)(applet_len - 1)] = (char)32; + if(!(strerr == ((const char *)NULL))) + { + if(!((signed int)*s == 0)) + { + tmp_post$7 = used; + used = used + 1; + msg[(signed long int)tmp_post$7] = (char)58; + tmp_post$8 = used; + used = used + 1; + msg[(signed long int)tmp_post$8] = (char)32; + } + + strcpy(&msg[(signed long int)used], strerr); + used = used + strerr_len; + } + + strcpy(&msg[(signed long int)used], msg_eol); + used = used + msgeol_len; + } + if(!((1 & (signed int)logmode) == 0)) + { + fflush_all(); + full_write(2, (const void *)msg, (unsigned long int)used); + } + + if(!((2 & (signed int)logmode) == 0)) + syslog(3, "%s", msg + (signed long int)applet_len); + + free((void *)msg); +} + +// file libbb/xfuncs_printf.c line 269 +static void die_if_ferror(struct _IO_FILE *fp, const char *fn) +{ + signed int return_value_ferror$1; + return_value_ferror$1=ferror(fp); + if(!(return_value_ferror$1 == 0)) + bb_error_msg_and_die("%s: I/O error", fn); + +} + +// file libbb/xfuncs_printf.c line 278 +static void die_if_ferror_stdout(void) +{ + die_if_ferror(stdout, bb_msg_standard_output); +} + +// file coreutils/head.c line 133 +static unsigned long int eat_num(_Bool *negative_N, const char *p) +{ + + if((signed int)*p == 45) + { + + *negative_N = 1 != 0; + p = p + 1l; + } + + unsigned long int return_value_xatoul_sfx$1; + return_value_xatoul_sfx$1=xatoul_sfx(p, bkm_suffixes); + return return_value_xatoul_sfx$1; +} + +// file libbb/fclose_nonstdin.c line 17 +static signed int fclose_if_not_stdin(struct _IO_FILE *f) +{ + signed int r; + r=ferror(f); + if(!(r == 0)) + *bb_errno = 5; + + signed int return_value_fclose$1; + if(!(f == stdin)) + { + return_value_fclose$1=fclose(f); + return r | return_value_fclose$1; + } + + return r; +} + +// file include/libbb.h line 785 +static signed int fflush_all(void) +{ + signed int return_value_fflush$1; + return_value_fflush$1=fflush((struct _IO_FILE *)NULL); + return return_value_fflush$1; +} + +// file include/libbb.h line 786 +static void fflush_stdout_and_exit(signed int retval) +{ + signed int return_value_fflush$1; + return_value_fflush$1=fflush(stdout); + if(!(return_value_fflush$1 == 0)) + bb_perror_msg_and_die(bb_msg_standard_output); + + if(die_sleep < 0) + { + xfunc_error_retval = (unsigned char)retval; + abort(); // xfunc_die() invokes exit() and would thus leak memory + } + + exit(retval); +} + +// file include/libbb.h line 790 +static struct _IO_FILE * fopen_or_warn(const char *path, const char *mode) +{ + struct _IO_FILE *fp; + fp=fopen(path, mode); + if(fp == ((struct _IO_FILE *)NULL)) + bb_simple_perror_msg(path); + + return fp; +} + +// file include/libbb.h line 793 +static struct _IO_FILE * fopen_or_warn_stdin(const char *filename) +{ + struct _IO_FILE *fp = stdin; + _Bool tmp_if_expr$1; + if(!(filename == bb_msg_standard_input)) + { + if(!((signed int)*filename == 45)) + tmp_if_expr$1 = 1 != 0; + + else + tmp_if_expr$1 = ((signed int)filename[(signed long int)1] != 0 ? (signed int)(1 != 0) : (signed int)(0 != 0)) != 0; + if(!(tmp_if_expr$1 == (_Bool)0)) + fp=fopen_or_warn(filename, "r"); + + } + + return fp; +} + +// file include/libbb.h line 751 +static signed long int full_write(signed int fd, const void *buf, unsigned long int len) +{ + signed long int cc; + signed long int total = (signed long int)0; + for( ; !(len == 0ul); len = len - (unsigned long int)cc) + { + cc=safe_write(fd, buf, len); + if(cc < 0l) + { + if(!(total == 0l)) + return total; + + return cc; + } + + total = total + cc; + buf = (const void *)((const char *)buf + cc); + } + return total; +} + +// file coreutils/head.c line 154 +signed int __main(signed int argc, char **argv) +{ + unsigned long int count = (unsigned long int)10; + signed int header_threshhold = 1; + _Bool count_bytes = 0 != 0; + _Bool negative_N = 0 != 0; + struct _IO_FILE *fp; + const char *fmt; + char *p; + signed int opt; + signed int retval = 0; + + if(!(*(1l + argv) == ((char *)NULL))) + { + + if(!((signed int)*(*(1l + argv)) == 45)) + goto __CPROVER_DUMP_L9; + + + if(!(208 + (signed int)(unsigned char)(signed int)*(1l + *(1l + argv)) <= 9)) + goto __CPROVER_DUMP_L9; + + argc = argc - 1; + argv = argv + 1l; + + p = argv[(signed long int)0] + (signed long int)1; + } + + else + { + + __CPROVER_DUMP_L9: + ; + opt=getopt(argc, argv, head_opts); + if(!(opt > 0)) + goto __CPROVER_DUMP_L17; + + if(!(opt == 113)) + { + if(opt == 118) + goto __CPROVER_DUMP_L11; + + if(opt == 99) + goto __CPROVER_DUMP_L12; + + if(opt == 110) + goto __CPROVER_DUMP_L13; + + goto __CPROVER_DUMP_L15; + } + + header_threshhold = 2147483647; + goto __CPROVER_DUMP_L16; + + __CPROVER_DUMP_L11: + ; + header_threshhold = -1; + goto __CPROVER_DUMP_L16; + + __CPROVER_DUMP_L12: + ; + count_bytes = 1 != 0; + + __CPROVER_DUMP_L13: + ; + p = optarg; + } + + if(p!=NULL) + { +GET_COUNT: + ; + count=eat_num(&negative_N, p); + goto __CPROVER_DUMP_L16; + } + +__CPROVER_DUMP_L15: + ; + bb_show_usage(); + +__CPROVER_DUMP_L16: + ; + goto __CPROVER_DUMP_L9; + +__CPROVER_DUMP_L17: + ; + argc = argc - optind; + argv = argv + (signed long int)optind; + + if(*argv == ((char *)NULL)) + { + argv = argv - 1l; + + *argv = (char *)"-"; + } + + fmt = "\n==> %s <==\n" + (signed long int)1; + if(header_threshhold >= argc) + header_threshhold = 0; + + if(!((signed int)negative_N == 0)) + { + if(count >= 268435455ul) + bb_error_msg("count is too big: %lu", count); + + } + + while((_Bool)1) + { + + fp=fopen_or_warn_stdin(*argv); + if(!(fp == ((struct _IO_FILE *)NULL))) + { + if(fp == stdin) + { + + *argv = (char *)bb_msg_standard_input; + } + + if(!(header_threshhold == 0)) + { + + printf(fmt, *argv); + } + + if(!((signed int)negative_N == 0)) + { + if(!((signed int)count_bytes == 0)) + print_except_N_last_bytes(fp, (unsigned int)count); + + else + print_except_N_last_lines(fp, (unsigned int)count); + } + + else + print_first_N(fp, count, count_bytes); + die_if_ferror_stdout(); + signed int return_value_fclose_if_not_stdin$1; + return_value_fclose_if_not_stdin$1=fclose_if_not_stdin(fp); + if(!(return_value_fclose_if_not_stdin$1 == 0)) + { + + bb_simple_perror_msg(*argv); + retval = 1; + } + + } + + else + retval = 1; + fmt = "\n==> %s <==\n"; + argv = argv + 1l; + + if(*argv == ((char *)NULL)) + break; + + } + // fflush_stdout_and_exit(retval); -- invokes exit() and would thus leak memory + fflush(stdout); + return retval; +} + +// file coreutils/head.c line 61 +static void print_except_N_last_bytes(struct _IO_FILE *fp, unsigned int count) +{ + unsigned char *circle; + count = count + 1u; + void *return_value_xmalloc$1; + return_value_xmalloc$1=xmalloc((unsigned long int)count); + circle = (unsigned char *)return_value_xmalloc$1; + unsigned int head = (unsigned int)0; + unsigned int tmp_post$2; + do + { + signed int c; + c=getc(fp); + if(c == -1) + goto ret; + + tmp_post$2 = head; + head = head + 1u; + + circle[(signed long int)tmp_post$2] = (unsigned char)c; + if(head == count) + break; + + } + while((_Bool)1); + do + { + signed int print_except_N_last_bytes$$1$$2$$1$$c; + if(head == count) + head = (unsigned int)0; + + + putchar((signed int)circle[(signed long int)head]); + print_except_N_last_bytes$$1$$2$$1$$c=getc(fp); + if(print_except_N_last_bytes$$1$$2$$1$$c == -1) + break; + + + circle[(signed long int)head] = (unsigned char)print_except_N_last_bytes$$1$$2$$1$$c; + head = head + 1u; + } + while((_Bool)1); + +ret: + ; + free((void *)circle); +} + +// file coreutils/head.c line 90 +static void print_except_N_last_lines(struct _IO_FILE *fp, unsigned int count) +{ + char **circle; + count = count + 1u; + void *return_value_xzalloc$1; + return_value_xzalloc$1=xzalloc((unsigned long int)count * sizeof(char *) /*8ul*/ ); + circle = (char **)return_value_xzalloc$1; + unsigned int head = (unsigned int)0; + unsigned int tmp_post$2; + do + { + char *c; + c=xmalloc_fgets(fp); + if(c == ((char *)NULL)) + goto ret; + + tmp_post$2 = head; + head = head + 1u; + + circle[(signed long int)tmp_post$2] = c; + if(head == count) + break; + + } + while((_Bool)1); + unsigned int tmp_post$3; + do + { + char *print_except_N_last_lines$$1$$2$$1$$c; + if(head == count) + head = (unsigned int)0; + + + fputs(circle[(signed long int)head], stdout); + print_except_N_last_lines$$1$$2$$1$$c=xmalloc_fgets(fp); + if(print_except_N_last_lines$$1$$2$$1$$c == ((char *)NULL)) + break; + + + free((void *)circle[(signed long int)head]); + tmp_post$3 = head; + head = head + 1u; + + circle[(signed long int)tmp_post$3] = print_except_N_last_lines$$1$$2$$1$$c; + } + while((_Bool)1); + +ret: + ; + head = (unsigned int)0; + unsigned int tmp_post$4; + do + { + tmp_post$4 = head; + head = head + 1u; + + free((void *)circle[(signed long int)tmp_post$4]); + if(head == count) + break; + + } + while((_Bool)1); + free((void *)circle); +} + +// file coreutils/head.c line 44 +static void print_first_N(struct _IO_FILE *fp, unsigned long int count, _Bool count_bytes) +{ + while(!(count == 0ul)) + { + signed int c; + c=getc(fp); + if(c == -1) + break; + + if((signed int)count_bytes == 0) + { + if(c == 10) + goto __CPROVER_DUMP_L3; + + } + + else + { + + __CPROVER_DUMP_L3: + ; + count = count - 1ul; + } + putchar(c); + } +} + +// file include/libbb.h line 748 +static signed long int safe_write(signed int fd, const void *buf, unsigned long int count) +{ + signed long int n; + _Bool tmp_if_expr$1; + do + { + n=write(fd, buf, count); + if(n < 0l) + tmp_if_expr$1 = (*bb_errno == 4 ? (signed int)(1 != 0) : (signed int)(0 != 0)) != 0; + + else + tmp_if_expr$1 = 0 != 0; + } + while(tmp_if_expr$1 != (_Bool)0); + return n; +} + +// file include/xatonum.h line 87 +static inline unsigned long int xatoul_sfx(const char *str, struct suffix_mult *sfx) +{ + unsigned long long int return_value_xatoull_sfx$1; + return_value_xatoull_sfx$1=xatoull_sfx(str, sfx); + return return_value_xatoull_sfx$1; +} + +// file libbb/xatonum_template.c line 110 +static unsigned long long int xatoull_sfx(const char *numstr, struct suffix_mult *suffixes) +{ + unsigned long long int return_value_xstrtoull_range_sfx$1; + return_value_xstrtoull_range_sfx$1=xstrtoull_range_sfx(numstr, 10, (unsigned long long int)0, (unsigned long int)9223372036854775807ll * 2ull + 1ull, suffixes); + return return_value_xstrtoull_range_sfx$1; +} + +// file include/libbb.h line 1079 +static void xfunc_die(void) +{ + if(!(die_sleep == 0)) + { + if(die_sleep < 0) + longjmp(die_jmp, (signed int)xfunc_error_retval != 0 ? (signed int)xfunc_error_retval : -2222); + + sleep((unsigned int)die_sleep); + } + + exit((signed int)xfunc_error_retval); +} + +// file include/libbb.h line 695 +static void * xmalloc(unsigned long int size) +{ + void *ptr; + ptr=malloc(size); + if(ptr == NULL) + { + if(!(size == 0ul)) + bb_error_msg_and_die(bb_msg_memory_exhausted); + + } + + return ptr; +} + +// file libbb/get_line_from_file.c line 46 +static char * xmalloc_fgets(struct _IO_FILE *file) +{ + signed int i; + char *return_value_bb_get_chunk_from_file$1; + return_value_bb_get_chunk_from_file$1=bb_get_chunk_from_file(file, &i); + return return_value_bb_get_chunk_from_file$1; +} + +// file include/libbb.h line 697 +static void * xrealloc(void *ptr, unsigned long int size) +{ + ptr=realloc(ptr, size); + if(ptr == NULL) + { + if(!(size == 0ul)) + bb_error_msg_and_die(bb_msg_memory_exhausted); + + } + + return ptr; +} + +// file libbb/xatonum_template.c line 19 +static unsigned long long int xstrtoull_range_sfx(const char *numstr, signed int base, unsigned long long int lower, unsigned long long int upper, struct suffix_mult *suffixes) +{ + unsigned long long int r; + signed int old_errno; + char *e; + _Bool tmp_if_expr$1; + if((signed int)*numstr == 45) + tmp_if_expr$1 = 1 != 0; + + else + tmp_if_expr$1 = ((signed int)*numstr == 43 ? (signed int)(1 != 0) : (signed int)(0 != 0)) != 0; + _Bool tmp_if_expr$3; + _Bool tmp_statement_expression$2; + if(!(tmp_if_expr$1 == (_Bool)0)) + tmp_if_expr$3 = 1 != 0; + + else + { + unsigned char bb__isspace = (unsigned char)((signed int)*numstr - 9); + tmp_statement_expression$2 = (signed int)bb__isspace == 32 - 9 || (signed int)bb__isspace <= 13 - 9; + tmp_if_expr$3 = (tmp_statement_expression$2 != (_Bool)0 ? (signed int)(1 != 0) : (signed int)(0 != 0)) != 0; + } + signed int tmp_statement_expression$4; + if(tmp_if_expr$3 == (_Bool)0) + { + old_errno = *bb_errno; + *bb_errno = 0; + r=strtoull(numstr, &e, base); + if(!(numstr == e)) + { + if(*bb_errno == 0) + { + *bb_errno = old_errno; + if(!(suffixes == ((struct suffix_mult *)NULL))) + for( ; !(suffixes->mult == 0u); suffixes = suffixes + 1l) + { + unsigned long int __s1_len; + unsigned long int __s2_len; + signed int return_value___builtin_strcmp$5; + return_value___builtin_strcmp$5=strcmp(suffixes->suffix, e); + tmp_statement_expression$4 = return_value___builtin_strcmp$5; + if(tmp_statement_expression$4 == 0) + { + if(!(18446744073709551615ull / (unsigned long int)suffixes->mult >= r)) + goto range; + + r = r * (unsigned long long int)suffixes->mult; + goto chk_range; + } + + } + + if((signed int)*e == 0) + { + + chk_range: + ; + if(r >= lower) + { + if(upper >= r) + return r; + + } + + range: + ; + bb_error_msg_and_die("number %s is not in %llu..%llu range", numstr, (unsigned long long int)lower, (unsigned long long int)upper); + } + + } + + } + + } + +inval: + ; + bb_error_msg_and_die("invalid number '%s'", numstr); +} + +// file include/libbb.h line 696 +static void * xzalloc(unsigned long int size) +{ + void *ptr; + ptr=xmalloc(size); + memset(ptr, 0, size); + return ptr; +} + +#include "busybox_sv_comp_impl.h" diff --git a/c/busybox-1.22.0/head_true-no-overflow_true-valid-deref.i b/c/busybox-1.22.0/head_true-no-overflow_true-valid-deref.i new file mode 100644 index 00000000000..8a8e87c9c35 --- /dev/null +++ b/c/busybox-1.22.0/head_true-no-overflow_true-valid-deref.i @@ -0,0 +1,2951 @@ +extern long __VERIFIER_nondet_long(void); +extern unsigned long __VERIFIER_nondet_ulong(void); +extern int __VERIFIER_nondet_int(void); +extern unsigned int __VERIFIER_nondet_uint(void); +extern char __VERIFIER_nondet_char(void); +extern short __VERIFIER_nondet_short(void); +extern void __VERIFIER_assume(int); +extern void __VERIFIER_error(void); +typedef __builtin_va_list __gnuc_va_list; + +extern void closelog (void); +extern void openlog (const char *__ident, int __option, int __facility); +extern int setlogmask (int __mask) __attribute__ ((__nothrow__ , __leaf__)); +extern void syslog (int __pri, const char *__fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); +extern void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap) + __attribute__ ((__format__ (__printf__, 2, 0))); + +extern char *optarg; +extern int optind; +extern int opterr; +extern int optopt; +struct option +{ + const char *name; + int has_arg; + int *flag; + int val; +}; +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +extern int getopt_long (int ___argc, char *const *___argv, + const char *__shortopts, + const struct option *__longopts, int *__longind) + __attribute__ ((__nothrow__ , __leaf__)); +extern int getopt_long_only (int ___argc, char *const *___argv, + const char *__shortopts, + const struct option *__longopts, int *__longind) + __attribute__ ((__nothrow__ , __leaf__)); +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; +typedef int __daddr_t; +typedef int __key_t; +typedef int __clockid_t; +typedef void * __timer_t; +typedef long int __blksize_t; +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; +typedef long int __fsword_t; +typedef long int __ssize_t; +typedef long int __syscall_slong_t; +typedef unsigned long int __syscall_ulong_t; +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; +typedef long int __intptr_t; +typedef unsigned int __socklen_t; +typedef long unsigned int size_t; +typedef struct +{ + int __count; + union + { + unsigned int __wch; + char __wchb[4]; + } __value; +} __mbstate_t; +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +struct _IO_jump_t; struct _IO_FILE; +typedef void _IO_lock_t; +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + int _pos; +}; +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +struct _IO_FILE { + int _flags; + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + struct _IO_marker *_markers; + struct _IO_FILE *_chain; + int _fileno; + int _flags2; + __off_t _old_offset; + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + _IO_lock_t *_lock; + __off64_t _offset; + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + int _mode; + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; +}; +typedef struct _IO_FILE _IO_FILE; +struct _IO_FILE_plus; +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); +typedef int __io_close_fn (void *__cookie); +typedef __io_read_fn cookie_read_function_t; +typedef __io_write_fn cookie_write_function_t; +typedef __io_seek_fn cookie_seek_function_t; +typedef __io_close_fn cookie_close_function_t; +typedef struct +{ + __io_read_fn *read; + __io_write_fn *write; + __io_seek_fn *seek; + __io_close_fn *close; +} _IO_cookie_io_functions_t; +typedef _IO_cookie_io_functions_t cookie_io_functions_t; +struct _IO_cookie_file; +extern void _IO_cookie_init (struct _IO_cookie_file *__cfile, int __read_write, + void *__cookie, _IO_cookie_io_functions_t __fns); +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_peekc_locked (_IO_FILE *__fp); +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); + +typedef long int __jmp_buf[8]; +typedef int __sig_atomic_t; +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +struct __jmp_buf_tag + { + __jmp_buf __jmpbuf; + int __mask_was_saved; + __sigset_t __saved_mask; + }; + +typedef struct __jmp_buf_tag jmp_buf[1]; +extern int setjmp (jmp_buf __env) __attribute__ ((__nothrow__)); + +extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __attribute__ ((__nothrow__)); +extern int _setjmp (struct __jmp_buf_tag __env[1]) __attribute__ ((__nothrow__)); + +extern void longjmp (struct __jmp_buf_tag __env[1], int __val) + __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__)); + +extern void _longjmp (struct __jmp_buf_tag __env[1], int __val) + __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__)); +typedef struct __jmp_buf_tag sigjmp_buf[1]; +extern void siglongjmp (sigjmp_buf __env, int __val) + __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__)); + + +extern int __sigismember (const __sigset_t *, int); +extern int __sigaddset (__sigset_t *, int); +extern int __sigdelset (__sigset_t *, int); + +typedef __sig_atomic_t sig_atomic_t; + +typedef __sigset_t sigset_t; +typedef __pid_t pid_t; +typedef __uid_t uid_t; +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; +typedef union sigval + { + int sival_int; + void *sival_ptr; + } sigval_t; +typedef __clock_t __sigchld_clock_t; +typedef struct + { + int si_signo; + int si_errno; + int si_code; + union + { + int _pad[((128 / sizeof (int)) - 4)]; + struct + { + __pid_t si_pid; + __uid_t si_uid; + } _kill; + struct + { + int si_tid; + int si_overrun; + sigval_t si_sigval; + } _timer; + struct + { + __pid_t si_pid; + __uid_t si_uid; + sigval_t si_sigval; + } _rt; + struct + { + __pid_t si_pid; + __uid_t si_uid; + int si_status; + __sigchld_clock_t si_utime; + __sigchld_clock_t si_stime; + } _sigchld; + struct + { + void *si_addr; + short int si_addr_lsb; + } _sigfault; + struct + { + long int si_band; + int si_fd; + } _sigpoll; + struct + { + void *_call_addr; + int _syscall; + unsigned int _arch; + } _sigsys; + } _sifields; + } siginfo_t ; +enum +{ + SI_ASYNCNL = -60, + SI_TKILL = -6, + SI_SIGIO, + SI_ASYNCIO, + SI_MESGQ, + SI_TIMER, + SI_QUEUE, + SI_USER, + SI_KERNEL = 0x80 +}; +enum +{ + ILL_ILLOPC = 1, + ILL_ILLOPN, + ILL_ILLADR, + ILL_ILLTRP, + ILL_PRVOPC, + ILL_PRVREG, + ILL_COPROC, + ILL_BADSTK +}; +enum +{ + FPE_INTDIV = 1, + FPE_INTOVF, + FPE_FLTDIV, + FPE_FLTOVF, + FPE_FLTUND, + FPE_FLTRES, + FPE_FLTINV, + FPE_FLTSUB +}; +enum +{ + SEGV_MAPERR = 1, + SEGV_ACCERR +}; +enum +{ + BUS_ADRALN = 1, + BUS_ADRERR, + BUS_OBJERR, + BUS_MCEERR_AR, + BUS_MCEERR_AO +}; +enum +{ + TRAP_BRKPT = 1, + TRAP_TRACE +}; +enum +{ + CLD_EXITED = 1, + CLD_KILLED, + CLD_DUMPED, + CLD_TRAPPED, + CLD_STOPPED, + CLD_CONTINUED +}; +enum +{ + POLL_IN = 1, + POLL_OUT, + POLL_MSG, + POLL_ERR, + POLL_PRI, + POLL_HUP +}; +typedef union pthread_attr_t pthread_attr_t; +typedef struct sigevent + { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + union + { + int _pad[((64 / sizeof (int)) - 4)]; + __pid_t _tid; + struct + { + void (*_function) (sigval_t); + pthread_attr_t *_attribute; + } _sigev_thread; + } _sigev_un; + } sigevent_t; +enum +{ + SIGEV_SIGNAL = 0, + SIGEV_NONE, + SIGEV_THREAD, + SIGEV_THREAD_ID = 4 +}; +typedef void (*__sighandler_t) (int); +extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +extern __sighandler_t sysv_signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); + +extern __sighandler_t signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); + +extern __sighandler_t bsd_signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +extern int kill (__pid_t __pid, int __sig) __attribute__ ((__nothrow__ , __leaf__)); +extern int killpg (__pid_t __pgrp, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + +extern int raise (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + +extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +extern int gsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); +extern void psignal (int __sig, const char *__s); +extern void psiginfo (const siginfo_t *__pinfo, const char *__s); +extern int __sigpause (int __sig_or_mask, int __is_sig); +extern int sigpause (int __sig) __asm__ ("__xpg_sigpause"); +extern int sigblock (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); +extern int sigsetmask (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); +extern int siggetmask (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); +typedef __sighandler_t sighandler_t; +typedef __sighandler_t sig_t; +extern int sigemptyset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int sigfillset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int sigaddset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int sigdelset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int sigismember (const sigset_t *__set, int __signo) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int sigisemptyset (const sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int sigandset (sigset_t *__set, const sigset_t *__left, + const sigset_t *__right) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))); +extern int sigorset (sigset_t *__set, const sigset_t *__left, + const sigset_t *__right) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))); +struct sigaction + { + union + { + __sighandler_t sa_handler; + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; + __sigset_t sa_mask; + int sa_flags; + void (*sa_restorer) (void); + }; +extern int sigprocmask (int __how, const sigset_t *__restrict __set, + sigset_t *__restrict __oset) __attribute__ ((__nothrow__ , __leaf__)); +extern int sigsuspend (const sigset_t *__set) __attribute__ ((__nonnull__ (1))); +extern int sigaction (int __sig, const struct sigaction *__restrict __act, + struct sigaction *__restrict __oact) __attribute__ ((__nothrow__ , __leaf__)); +extern int sigpending (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig) + __attribute__ ((__nonnull__ (1, 2))); +extern int sigwaitinfo (const sigset_t *__restrict __set, + siginfo_t *__restrict __info) __attribute__ ((__nonnull__ (1))); +extern int sigtimedwait (const sigset_t *__restrict __set, + siginfo_t *__restrict __info, + const struct timespec *__restrict __timeout) + __attribute__ ((__nonnull__ (1))); +extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val) + __attribute__ ((__nothrow__ , __leaf__)); +extern const char *const _sys_siglist[65]; +extern const char *const sys_siglist[65]; +struct sigvec + { + __sighandler_t sv_handler; + int sv_mask; + int sv_flags; + }; +extern int sigvec (int __sig, const struct sigvec *__vec, + struct sigvec *__ovec) __attribute__ ((__nothrow__ , __leaf__)); +struct _fpx_sw_bytes +{ + __uint32_t magic1; + __uint32_t extended_size; + __uint64_t xstate_bv; + __uint32_t xstate_size; + __uint32_t padding[7]; +}; +struct _fpreg +{ + unsigned short significand[4]; + unsigned short exponent; +}; +struct _fpxreg +{ + unsigned short significand[4]; + unsigned short exponent; + unsigned short padding[3]; +}; +struct _xmmreg +{ + __uint32_t element[4]; +}; +struct _fpstate +{ + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _fpxreg _st[8]; + struct _xmmreg _xmm[16]; + __uint32_t padding[24]; +}; +struct sigcontext +{ + __uint64_t r8; + __uint64_t r9; + __uint64_t r10; + __uint64_t r11; + __uint64_t r12; + __uint64_t r13; + __uint64_t r14; + __uint64_t r15; + __uint64_t rdi; + __uint64_t rsi; + __uint64_t rbp; + __uint64_t rbx; + __uint64_t rdx; + __uint64_t rax; + __uint64_t rcx; + __uint64_t rsp; + __uint64_t rip; + __uint64_t eflags; + unsigned short cs; + unsigned short gs; + unsigned short fs; + unsigned short __pad0; + __uint64_t err; + __uint64_t trapno; + __uint64_t oldmask; + __uint64_t cr2; + __extension__ union + { + struct _fpstate * fpstate; + __uint64_t __fpstate_word; + }; + __uint64_t __reserved1 [8]; +}; +struct _xsave_hdr +{ + __uint64_t xstate_bv; + __uint64_t reserved1[2]; + __uint64_t reserved2[5]; +}; +struct _ymmh_state +{ + __uint32_t ymmh_space[64]; +}; +struct _xstate +{ + struct _fpstate fpstate; + struct _xsave_hdr xstate_hdr; + struct _ymmh_state ymmh; +}; +extern int sigreturn (struct sigcontext *__scp) __attribute__ ((__nothrow__ , __leaf__)); +extern int siginterrupt (int __sig, int __interrupt) __attribute__ ((__nothrow__ , __leaf__)); +struct sigstack + { + void *ss_sp; + int ss_onstack; + }; +enum +{ + SS_ONSTACK = 1, + SS_DISABLE +}; +typedef struct sigaltstack + { + void *ss_sp; + int ss_flags; + size_t ss_size; + } stack_t; +__extension__ typedef long long int greg_t; +typedef greg_t gregset_t[23]; +enum +{ + REG_R8 = 0, + REG_R9, + REG_R10, + REG_R11, + REG_R12, + REG_R13, + REG_R14, + REG_R15, + REG_RDI, + REG_RSI, + REG_RBP, + REG_RBX, + REG_RDX, + REG_RAX, + REG_RCX, + REG_RSP, + REG_RIP, + REG_EFL, + REG_CSGSFS, + REG_ERR, + REG_TRAPNO, + REG_OLDMASK, + REG_CR2 +}; +struct _libc_fpxreg +{ + unsigned short int significand[4]; + unsigned short int exponent; + unsigned short int padding[3]; +}; +struct _libc_xmmreg +{ + __uint32_t element[4]; +}; +struct _libc_fpstate +{ + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _libc_fpxreg _st[8]; + struct _libc_xmmreg _xmm[16]; + __uint32_t padding[24]; +}; +typedef struct _libc_fpstate *fpregset_t; +typedef struct + { + gregset_t gregs; + fpregset_t fpregs; + __extension__ unsigned long long __reserved1 [8]; +} mcontext_t; +typedef struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; + struct _libc_fpstate __fpregs_mem; + } ucontext_t; +extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); +extern int sigaltstack (const struct sigaltstack *__restrict __ss, + struct sigaltstack *__restrict __oss) __attribute__ ((__nothrow__ , __leaf__)); +extern int sighold (int __sig) __attribute__ ((__nothrow__ , __leaf__)); +extern int sigrelse (int __sig) __attribute__ ((__nothrow__ , __leaf__)); +extern int sigignore (int __sig) __attribute__ ((__nothrow__ , __leaf__)); +extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __attribute__ ((__nothrow__ , __leaf__)); +typedef unsigned long int pthread_t; +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + unsigned int __nusers; + int __kind; + short __spins; + short __elision; + __pthread_list_t __list; + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; +typedef unsigned int pthread_key_t; +typedef int pthread_once_t; +typedef union +{ + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + unsigned long int __pad1; + unsigned long int __pad2; + unsigned int __flags; + } __data; + char __size[56]; + long int __align; +} pthread_rwlock_t; +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; +typedef volatile int pthread_spinlock_t; +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +extern int pthread_sigmask (int __how, + const __sigset_t *__restrict __newmask, + __sigset_t *__restrict __oldmask)__attribute__ ((__nothrow__ , __leaf__)); +extern int pthread_kill (pthread_t __threadid, int __signo) __attribute__ ((__nothrow__ , __leaf__)); +extern int pthread_sigqueue (pthread_t __threadid, int __signo, + const union sigval __value) __attribute__ ((__nothrow__ , __leaf__)); +extern int __libc_current_sigrtmin (void) __attribute__ ((__nothrow__ , __leaf__)); +extern int __libc_current_sigrtmax (void) __attribute__ ((__nothrow__ , __leaf__)); + + +struct _IO_FILE; + +typedef struct _IO_FILE FILE; + + +typedef struct _IO_FILE __FILE; +typedef __gnuc_va_list va_list; +typedef __off_t off_t; +typedef __off64_t off64_t; +typedef __ssize_t ssize_t; + +typedef _G_fpos_t fpos_t; + +typedef _G_fpos64_t fpos64_t; +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + +extern FILE *tmpfile (void) ; +extern FILE *tmpfile64 (void) ; +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern int fclose (FILE *__stream); +extern int fflush (FILE *__stream); + +extern int fflush_unlocked (FILE *__stream); +extern int fcloseall (void); + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; + +extern FILE *fopen64 (const char *__restrict __filename, + const char *__restrict __modes) ; +extern FILE *freopen64 (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +extern FILE *fopencookie (void *__restrict __magic_cookie, + const char *__restrict __modes, + _IO_cookie_io_functions_t __io_funcs) __attribute__ ((__nothrow__ , __leaf__)) ; +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); +extern int printf (const char *__restrict __format, ...); +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +extern int vasprintf (char **__restrict __ptr, const char *__restrict __f, + __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 0))) ; +extern int __asprintf (char **__restrict __ptr, + const char *__restrict __fmt, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 3))) ; +extern int asprintf (char **__restrict __ptr, + const char *__restrict __fmt, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 3))) ; +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; +extern int scanf (const char *__restrict __format, ...) ; +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); +extern int getchar (void); + +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +extern int fgetc_unlocked (FILE *__stream); + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); +extern int putchar (int __c); + +extern int fputc_unlocked (int __c, FILE *__stream); +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); +extern int getw (FILE *__stream); +extern int putw (int __w, FILE *__stream); + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; + +extern char *fgets_unlocked (char *__restrict __s, int __n, + FILE *__restrict __stream) ; +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); +extern int puts (const char *__s); +extern int ungetc (int __c, FILE *__stream); +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +extern int fputs_unlocked (const char *__restrict __s, + FILE *__restrict __stream); +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + +extern int fseek (FILE *__stream, long int __off, int __whence); +extern long int ftell (FILE *__stream) ; +extern void rewind (FILE *__stream); + +extern int fseeko (FILE *__stream, __off_t __off, int __whence); +extern __off_t ftello (FILE *__stream) ; + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); +extern int fsetpos (FILE *__stream, const fpos_t *__pos); + +extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence); +extern __off64_t ftello64 (FILE *__stream) ; +extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos); +extern int fsetpos64 (FILE *__stream, const fpos64_t *__pos); + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern void perror (const char *__s); + +extern int sys_nerr; +extern const char *const sys_errlist[]; +extern int _sys_nerr; +extern const char *const _sys_errlist[]; +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern FILE *popen (const char *__command, const char *__modes) ; +extern int pclose (FILE *__stream); +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +extern char *cuserid (char *__s); +struct obstack; +extern int obstack_printf (struct obstack *__restrict __obstack, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 3))); +extern int obstack_vprintf (struct obstack *__restrict __obstack, + const char *__restrict __format, + __gnuc_va_list __args) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 0))); +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +typedef int wchar_t; + +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +union wait + { + int w_status; + struct + { + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + } __wait_terminated; + struct + { + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + } __wait_stopped; + }; +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); + +typedef struct + { + int quot; + int rem; + } div_t; +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +typedef struct __locale_struct +{ + struct __locale_data *__locales[13]; + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + const char *__names[13]; +} *__locale_t; +typedef __locale_t locale_t; +extern long int strtol_l (const char *__restrict __nptr, + char **__restrict __endptr, int __base, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 4))); +extern unsigned long int strtoul_l (const char *__restrict __nptr, + char **__restrict __endptr, + int __base, __locale_t __loc) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 4))); +__extension__ +extern long long int strtoll_l (const char *__restrict __nptr, + char **__restrict __endptr, int __base, + __locale_t __loc) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 4))); +__extension__ +extern unsigned long long int strtoull_l (const char *__restrict __nptr, + char **__restrict __endptr, + int __base, __locale_t __loc) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 4))); +extern double strtod_l (const char *__restrict __nptr, + char **__restrict __endptr, __locale_t __loc) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))); +extern float strtof_l (const char *__restrict __nptr, + char **__restrict __endptr, __locale_t __loc) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))); +extern long double strtold_l (const char *__restrict __nptr, + char **__restrict __endptr, + __locale_t __loc) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))); +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; +typedef __loff_t loff_t; +typedef __ino_t ino_t; +typedef __ino64_t ino64_t; +typedef __dev_t dev_t; +typedef __gid_t gid_t; +typedef __mode_t mode_t; +typedef __nlink_t nlink_t; +typedef __id_t id_t; +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; +typedef __key_t key_t; + +typedef __clock_t clock_t; + + + +typedef __time_t time_t; + + +typedef __clockid_t clockid_t; +typedef __timer_t timer_t; +typedef __useconds_t useconds_t; +typedef __suseconds_t suseconds_t; +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +typedef int int8_t __attribute__ ((__mode__ (__QI__))); +typedef int int16_t __attribute__ ((__mode__ (__HI__))); +typedef int int32_t __attribute__ ((__mode__ (__SI__))); +typedef int int64_t __attribute__ ((__mode__ (__DI__))); +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); +typedef int register_t __attribute__ ((__mode__ (__word__))); +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +typedef long int __fd_mask; +typedef struct + { + __fd_mask fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + } fd_set; +typedef __fd_mask fd_mask; + +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + +typedef __blksize_t blksize_t; +typedef __blkcnt_t blkcnt_t; +typedef __fsblkcnt_t fsblkcnt_t; +typedef __fsfilcnt_t fsfilcnt_t; +typedef __blkcnt64_t blkcnt64_t; +typedef __fsblkcnt64_t fsblkcnt64_t; +typedef __fsfilcnt64_t fsfilcnt64_t; + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + }; +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +extern char *secure_getenv (const char *__name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +extern int mkstemp64 (char *__template) __attribute__ ((__nonnull__ (1))) ; +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +extern int mkstemps64 (char *__template, int __suffixlen) + __attribute__ ((__nonnull__ (1))) ; +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int mkostemp (char *__template, int __flags) __attribute__ ((__nonnull__ (1))) ; +extern int mkostemp64 (char *__template, int __flags) __attribute__ ((__nonnull__ (1))) ; +extern int mkostemps (char *__template, int __suffixlen, int __flags) + __attribute__ ((__nonnull__ (1))) ; +extern int mkostemps64 (char *__template, int __suffixlen, int __flags) + __attribute__ ((__nonnull__ (1))) ; + +extern int system (const char *__command) ; + +extern char *canonicalize_file_name (const char *__name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; +typedef int (*__compar_fn_t) (const void *, const void *); +typedef __compar_fn_t comparison_fn_t; +typedef int (*__compar_d_fn_t) (const void *, const void *, void *); + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +extern void qsort_r (void *__base, size_t __nmemb, size_t __size, + __compar_d_fn_t __compar, void *__arg) + __attribute__ ((__nonnull__ (1, 4))); +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +extern void setkey (const char *__key) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int posix_openpt (int __oflag) ; +extern int grantpt (int __fd) __attribute__ ((__nothrow__ , __leaf__)); +extern int unlockpt (int __fd) __attribute__ ((__nothrow__ , __leaf__)); +extern char *ptsname (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ptsname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +extern int getpt (void); +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + +extern void *rawmemchr (const void *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +extern void *memrchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + +extern char *strchrnul (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +extern char *strcasestr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +extern void *memmem (const void *__haystack, size_t __haystacklen, + const void *__needle, size_t __needlelen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 3))); +extern void *__mempcpy (void *__restrict __dest, + const void *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern void *mempcpy (void *__restrict __dest, + const void *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern int ffsl (long int __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ extern int ffsll (long long int __ll) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +extern int strcasecmp_l (const char *__s1, const char *__s2, + __locale_t __loc) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); +extern int strncasecmp_l (const char *__s1, const char *__s2, + size_t __n, __locale_t __loc) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 4))); +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int strverscmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *strfry (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void *memfrob (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern char *basename (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +typedef __intptr_t intptr_t; +typedef __socklen_t socklen_t; +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int euidaccess (const char *__name, int __type) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int eaccess (const char *__name, int __type) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +extern __off64_t lseek64 (int __fd, __off64_t __offset, int __whence) + __attribute__ ((__nothrow__ , __leaf__)); +extern int close (int __fd); +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +extern ssize_t pread64 (int __fd, void *__buf, size_t __nbytes, + __off64_t __offset) ; +extern ssize_t pwrite64 (int __fd, const void *__buf, size_t __n, + __off64_t __offset) ; +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int pipe2 (int __pipedes[2], int __flags) __attribute__ ((__nothrow__ , __leaf__)) ; +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned int sleep (unsigned int __seconds); +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); +extern int usleep (__useconds_t __useconds); +extern int pause (void); +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +extern char *get_current_dir_name (void) __attribute__ ((__nothrow__ , __leaf__)); +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +extern int dup3 (int __fd, int __fd2, int __flags) __attribute__ ((__nothrow__ , __leaf__)); +extern char **__environ; +extern char **environ; +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int execvpe (const char *__file, char *const __argv[], + char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; +extern void _exit (int __status) __attribute__ ((__noreturn__)); +enum + { + _PC_LINK_MAX, + _PC_MAX_CANON, + _PC_MAX_INPUT, + _PC_NAME_MAX, + _PC_PATH_MAX, + _PC_PIPE_BUF, + _PC_CHOWN_RESTRICTED, + _PC_NO_TRUNC, + _PC_VDISABLE, + _PC_SYNC_IO, + _PC_ASYNC_IO, + _PC_PRIO_IO, + _PC_SOCK_MAXBUF, + _PC_FILESIZEBITS, + _PC_REC_INCR_XFER_SIZE, + _PC_REC_MAX_XFER_SIZE, + _PC_REC_MIN_XFER_SIZE, + _PC_REC_XFER_ALIGN, + _PC_ALLOC_SIZE_MIN, + _PC_SYMLINK_MAX, + _PC_2_SYMLINKS + }; +enum + { + _SC_ARG_MAX, + _SC_CHILD_MAX, + _SC_CLK_TCK, + _SC_NGROUPS_MAX, + _SC_OPEN_MAX, + _SC_STREAM_MAX, + _SC_TZNAME_MAX, + _SC_JOB_CONTROL, + _SC_SAVED_IDS, + _SC_REALTIME_SIGNALS, + _SC_PRIORITY_SCHEDULING, + _SC_TIMERS, + _SC_ASYNCHRONOUS_IO, + _SC_PRIORITIZED_IO, + _SC_SYNCHRONIZED_IO, + _SC_FSYNC, + _SC_MAPPED_FILES, + _SC_MEMLOCK, + _SC_MEMLOCK_RANGE, + _SC_MEMORY_PROTECTION, + _SC_MESSAGE_PASSING, + _SC_SEMAPHORES, + _SC_SHARED_MEMORY_OBJECTS, + _SC_AIO_LISTIO_MAX, + _SC_AIO_MAX, + _SC_AIO_PRIO_DELTA_MAX, + _SC_DELAYTIMER_MAX, + _SC_MQ_OPEN_MAX, + _SC_MQ_PRIO_MAX, + _SC_VERSION, + _SC_PAGESIZE, + _SC_RTSIG_MAX, + _SC_SEM_NSEMS_MAX, + _SC_SEM_VALUE_MAX, + _SC_SIGQUEUE_MAX, + _SC_TIMER_MAX, + _SC_BC_BASE_MAX, + _SC_BC_DIM_MAX, + _SC_BC_SCALE_MAX, + _SC_BC_STRING_MAX, + _SC_COLL_WEIGHTS_MAX, + _SC_EQUIV_CLASS_MAX, + _SC_EXPR_NEST_MAX, + _SC_LINE_MAX, + _SC_RE_DUP_MAX, + _SC_CHARCLASS_NAME_MAX, + _SC_2_VERSION, + _SC_2_C_BIND, + _SC_2_C_DEV, + _SC_2_FORT_DEV, + _SC_2_FORT_RUN, + _SC_2_SW_DEV, + _SC_2_LOCALEDEF, + _SC_PII, + _SC_PII_XTI, + _SC_PII_SOCKET, + _SC_PII_INTERNET, + _SC_PII_OSI, + _SC_POLL, + _SC_SELECT, + _SC_UIO_MAXIOV, + _SC_IOV_MAX = _SC_UIO_MAXIOV, + _SC_PII_INTERNET_STREAM, + _SC_PII_INTERNET_DGRAM, + _SC_PII_OSI_COTS, + _SC_PII_OSI_CLTS, + _SC_PII_OSI_M, + _SC_T_IOV_MAX, + _SC_THREADS, + _SC_THREAD_SAFE_FUNCTIONS, + _SC_GETGR_R_SIZE_MAX, + _SC_GETPW_R_SIZE_MAX, + _SC_LOGIN_NAME_MAX, + _SC_TTY_NAME_MAX, + _SC_THREAD_DESTRUCTOR_ITERATIONS, + _SC_THREAD_KEYS_MAX, + _SC_THREAD_STACK_MIN, + _SC_THREAD_THREADS_MAX, + _SC_THREAD_ATTR_STACKADDR, + _SC_THREAD_ATTR_STACKSIZE, + _SC_THREAD_PRIORITY_SCHEDULING, + _SC_THREAD_PRIO_INHERIT, + _SC_THREAD_PRIO_PROTECT, + _SC_THREAD_PROCESS_SHARED, + _SC_NPROCESSORS_CONF, + _SC_NPROCESSORS_ONLN, + _SC_PHYS_PAGES, + _SC_AVPHYS_PAGES, + _SC_ATEXIT_MAX, + _SC_PASS_MAX, + _SC_XOPEN_VERSION, + _SC_XOPEN_XCU_VERSION, + _SC_XOPEN_UNIX, + _SC_XOPEN_CRYPT, + _SC_XOPEN_ENH_I18N, + _SC_XOPEN_SHM, + _SC_2_CHAR_TERM, + _SC_2_C_VERSION, + _SC_2_UPE, + _SC_XOPEN_XPG2, + _SC_XOPEN_XPG3, + _SC_XOPEN_XPG4, + _SC_CHAR_BIT, + _SC_CHAR_MAX, + _SC_CHAR_MIN, + _SC_INT_MAX, + _SC_INT_MIN, + _SC_LONG_BIT, + _SC_WORD_BIT, + _SC_MB_LEN_MAX, + _SC_NZERO, + _SC_SSIZE_MAX, + _SC_SCHAR_MAX, + _SC_SCHAR_MIN, + _SC_SHRT_MAX, + _SC_SHRT_MIN, + _SC_UCHAR_MAX, + _SC_UINT_MAX, + _SC_ULONG_MAX, + _SC_USHRT_MAX, + _SC_NL_ARGMAX, + _SC_NL_LANGMAX, + _SC_NL_MSGMAX, + _SC_NL_NMAX, + _SC_NL_SETMAX, + _SC_NL_TEXTMAX, + _SC_XBS5_ILP32_OFF32, + _SC_XBS5_ILP32_OFFBIG, + _SC_XBS5_LP64_OFF64, + _SC_XBS5_LPBIG_OFFBIG, + _SC_XOPEN_LEGACY, + _SC_XOPEN_REALTIME, + _SC_XOPEN_REALTIME_THREADS, + _SC_ADVISORY_INFO, + _SC_BARRIERS, + _SC_BASE, + _SC_C_LANG_SUPPORT, + _SC_C_LANG_SUPPORT_R, + _SC_CLOCK_SELECTION, + _SC_CPUTIME, + _SC_THREAD_CPUTIME, + _SC_DEVICE_IO, + _SC_DEVICE_SPECIFIC, + _SC_DEVICE_SPECIFIC_R, + _SC_FD_MGMT, + _SC_FIFO, + _SC_PIPE, + _SC_FILE_ATTRIBUTES, + _SC_FILE_LOCKING, + _SC_FILE_SYSTEM, + _SC_MONOTONIC_CLOCK, + _SC_MULTI_PROCESS, + _SC_SINGLE_PROCESS, + _SC_NETWORKING, + _SC_READER_WRITER_LOCKS, + _SC_SPIN_LOCKS, + _SC_REGEXP, + _SC_REGEX_VERSION, + _SC_SHELL, + _SC_SIGNALS, + _SC_SPAWN, + _SC_SPORADIC_SERVER, + _SC_THREAD_SPORADIC_SERVER, + _SC_SYSTEM_DATABASE, + _SC_SYSTEM_DATABASE_R, + _SC_TIMEOUTS, + _SC_TYPED_MEMORY_OBJECTS, + _SC_USER_GROUPS, + _SC_USER_GROUPS_R, + _SC_2_PBS, + _SC_2_PBS_ACCOUNTING, + _SC_2_PBS_LOCATE, + _SC_2_PBS_MESSAGE, + _SC_2_PBS_TRACK, + _SC_SYMLOOP_MAX, + _SC_STREAMS, + _SC_2_PBS_CHECKPOINT, + _SC_V6_ILP32_OFF32, + _SC_V6_ILP32_OFFBIG, + _SC_V6_LP64_OFF64, + _SC_V6_LPBIG_OFFBIG, + _SC_HOST_NAME_MAX, + _SC_TRACE, + _SC_TRACE_EVENT_FILTER, + _SC_TRACE_INHERIT, + _SC_TRACE_LOG, + _SC_LEVEL1_ICACHE_SIZE, + _SC_LEVEL1_ICACHE_ASSOC, + _SC_LEVEL1_ICACHE_LINESIZE, + _SC_LEVEL1_DCACHE_SIZE, + _SC_LEVEL1_DCACHE_ASSOC, + _SC_LEVEL1_DCACHE_LINESIZE, + _SC_LEVEL2_CACHE_SIZE, + _SC_LEVEL2_CACHE_ASSOC, + _SC_LEVEL2_CACHE_LINESIZE, + _SC_LEVEL3_CACHE_SIZE, + _SC_LEVEL3_CACHE_ASSOC, + _SC_LEVEL3_CACHE_LINESIZE, + _SC_LEVEL4_CACHE_SIZE, + _SC_LEVEL4_CACHE_ASSOC, + _SC_LEVEL4_CACHE_LINESIZE, + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + _SC_RAW_SOCKETS, + _SC_V7_ILP32_OFF32, + _SC_V7_ILP32_OFFBIG, + _SC_V7_LP64_OFF64, + _SC_V7_LPBIG_OFFBIG, + _SC_SS_REPL_MAX, + _SC_TRACE_EVENT_NAME_MAX, + _SC_TRACE_NAME_MAX, + _SC_TRACE_SYS_MAX, + _SC_TRACE_USER_EVENT_MAX, + _SC_XOPEN_STREAMS, + _SC_THREAD_ROBUST_PRIO_INHERIT, + _SC_THREAD_ROBUST_PRIO_PROTECT + }; +enum + { + _CS_PATH, + _CS_V6_WIDTH_RESTRICTED_ENVS, + _CS_GNU_LIBC_VERSION, + _CS_GNU_LIBPTHREAD_VERSION, + _CS_V5_WIDTH_RESTRICTED_ENVS, + _CS_V7_WIDTH_RESTRICTED_ENVS, + _CS_LFS_CFLAGS = 1000, + _CS_LFS_LDFLAGS, + _CS_LFS_LIBS, + _CS_LFS_LINTFLAGS, + _CS_LFS64_CFLAGS, + _CS_LFS64_LDFLAGS, + _CS_LFS64_LIBS, + _CS_LFS64_LINTFLAGS, + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + _CS_XBS5_ILP32_OFF32_LDFLAGS, + _CS_XBS5_ILP32_OFF32_LIBS, + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + _CS_XBS5_ILP32_OFFBIG_LIBS, + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + _CS_XBS5_LP64_OFF64_CFLAGS, + _CS_XBS5_LP64_OFF64_LDFLAGS, + _CS_XBS5_LP64_OFF64_LIBS, + _CS_XBS5_LP64_OFF64_LINTFLAGS, + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + _CS_XBS5_LPBIG_OFFBIG_LIBS, + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + _CS_POSIX_V6_ILP32_OFF32_LIBS, + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + _CS_POSIX_V6_LP64_OFF64_LIBS, + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + _CS_POSIX_V7_ILP32_OFF32_LIBS, + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + _CS_POSIX_V7_LP64_OFF64_LIBS, + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + _CS_V6_ENV, + _CS_V7_ENV + }; +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int group_member (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)); +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int getresuid (__uid_t *__ruid, __uid_t *__euid, __uid_t *__suid) + __attribute__ ((__nothrow__ , __leaf__)); +extern int getresgid (__gid_t *__rgid, __gid_t *__egid, __gid_t *__sgid) + __attribute__ ((__nothrow__ , __leaf__)); +extern int setresuid (__uid_t __ruid, __uid_t __euid, __uid_t __suid) + __attribute__ ((__nothrow__ , __leaf__)) ; +extern int setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid) + __attribute__ ((__nothrow__ , __leaf__)) ; +extern __pid_t fork (void) __attribute__ ((__nothrow__)); +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); +extern char *getlogin (void); +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); +extern int fsync (int __fd); +extern int syncfs (int __fd) __attribute__ ((__nothrow__ , __leaf__)); +extern long int gethostid (void); +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int truncate64 (const char *__file, __off64_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ftruncate64 (int __fd, __off64_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +extern int lockf (int __fd, int __cmd, __off_t __len) ; +extern int lockf64 (int __fd, int __cmd, __off64_t __len) ; +extern int fdatasync (int __fildes); +extern char *crypt (const char *__key, const char *__salt) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern void encrypt (char *__glibc_block, int __edflag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void swab (const void *__restrict __from, void *__restrict __to, + ssize_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +struct timezone + { + int tz_minuteswest; + int tz_dsttime; + }; +typedef struct timezone *__restrict __timezone_ptr_t; +extern int gettimeofday (struct timeval *__restrict __tv, + __timezone_ptr_t __tz) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int settimeofday (const struct timeval *__tv, + const struct timezone *__tz) + __attribute__ ((__nothrow__ , __leaf__)); +extern int adjtime (const struct timeval *__delta, + struct timeval *__olddelta) __attribute__ ((__nothrow__ , __leaf__)); +enum __itimer_which + { + ITIMER_REAL = 0, + ITIMER_VIRTUAL = 1, + ITIMER_PROF = 2 + }; +struct itimerval + { + struct timeval it_interval; + struct timeval it_value; + }; +typedef enum __itimer_which __itimer_which_t; +extern int getitimer (__itimer_which_t __which, + struct itimerval *__value) __attribute__ ((__nothrow__ , __leaf__)); +extern int setitimer (__itimer_which_t __which, + const struct itimerval *__restrict __new, + struct itimerval *__restrict __old) __attribute__ ((__nothrow__ , __leaf__)); +extern int utimes (const char *__file, const struct timeval __tvp[2]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int lutimes (const char *__file, const struct timeval __tvp[2]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern int futimes (int __fd, const struct timeval __tvp[2]) __attribute__ ((__nothrow__ , __leaf__)); +extern int futimesat (int __fd, const char *__file, + const struct timeval __tvp[2]) __attribute__ ((__nothrow__ , __leaf__)); + +struct lastlog + { + int32_t ll_time; + char ll_line[32]; + char ll_host[256]; + }; +struct exit_status + { + short int e_termination; + short int e_exit; + }; +struct utmp +{ + short int ut_type; + pid_t ut_pid; + char ut_line[32]; + char ut_id[4]; + char ut_user[32]; + char ut_host[256]; + struct exit_status ut_exit; + int32_t ut_session; + struct + { + int32_t tv_sec; + int32_t tv_usec; + } ut_tv; + int32_t ut_addr_v6[4]; + char __glibc_reserved[20]; +}; +extern int login_tty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); +extern void login (const struct utmp *__entry) __attribute__ ((__nothrow__ , __leaf__)); +extern int logout (const char *__ut_line) __attribute__ ((__nothrow__ , __leaf__)); +extern void logwtmp (const char *__ut_line, const char *__ut_name, + const char *__ut_host) __attribute__ ((__nothrow__ , __leaf__)); +extern void updwtmp (const char *__wtmp_file, const struct utmp *__utmp) + __attribute__ ((__nothrow__ , __leaf__)); +extern int utmpname (const char *__file) __attribute__ ((__nothrow__ , __leaf__)); +extern struct utmp *getutent (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setutent (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endutent (void) __attribute__ ((__nothrow__ , __leaf__)); +extern struct utmp *getutid (const struct utmp *__id) __attribute__ ((__nothrow__ , __leaf__)); +extern struct utmp *getutline (const struct utmp *__line) __attribute__ ((__nothrow__ , __leaf__)); +extern struct utmp *pututline (const struct utmp *__utmp_ptr) __attribute__ ((__nothrow__ , __leaf__)); +extern int getutent_r (struct utmp *__buffer, struct utmp **__result) __attribute__ ((__nothrow__ , __leaf__)); +extern int getutid_r (const struct utmp *__id, struct utmp *__buffer, + struct utmp **__result) __attribute__ ((__nothrow__ , __leaf__)); +extern int getutline_r (const struct utmp *__line, + struct utmp *__buffer, struct utmp **__result) __attribute__ ((__nothrow__ , __leaf__)); + +struct suffix_mult; +static void bb_error_msg(const char *s, ...); +static void bb_error_msg_and_die(const char *s, ...); +static char * bb_get_chunk_from_file(struct _IO_FILE *file, signed int *end); +static void bb_perror_msg(const char *s, ...); +static void bb_perror_msg_and_die(const char *s, ...); +static void bb_show_usage(void); +static void bb_simple_perror_msg(const char *s); +static void bb_verror_msg(const char *s, va_list p, const char *strerr); +static void die_if_ferror(struct _IO_FILE *fp, const char *fn); +static void die_if_ferror_stdout(void); +static unsigned long int eat_num(_Bool *negative_N, const char *p); +static signed int fclose_if_not_stdin(struct _IO_FILE *f); +static signed int fflush_all(void); +static void fflush_stdout_and_exit(signed int retval); +static struct _IO_FILE * fopen_or_warn(const char *path, const char *mode); +static struct _IO_FILE * fopen_or_warn_stdin(const char *filename); +static signed long int full_write(signed int fd, const void *buf, unsigned long int len); +static void print_except_N_last_bytes(struct _IO_FILE *fp, unsigned int count); +static void print_except_N_last_lines(struct _IO_FILE *fp, unsigned int count); +static void print_first_N(struct _IO_FILE *fp, unsigned long int count, _Bool count_bytes); +static signed long int safe_write(signed int fd, const void *buf, unsigned long int count); +static inline unsigned long int xatoul_sfx(const char *str, struct suffix_mult *sfx); +static unsigned long long int xatoull_sfx(const char *numstr, struct suffix_mult *suffixes); +static void xfunc_die(void); +static void * xmalloc(unsigned long int size); +static char * xmalloc_fgets(struct _IO_FILE *file); +static void * xrealloc(void *ptr, unsigned long int size); +static unsigned long long int xstrtoull_range_sfx(const char *numstr, signed int base, unsigned long long int lower, unsigned long long int upper, struct suffix_mult *suffixes); +static void * xzalloc(unsigned long int size); +struct libbb_anonymous$7 +{ + unsigned long int __val[16l]; +}; +struct suffix_mult +{ + char suffix[4l]; + unsigned int mult; +}; +static const char *applet_name; +static signed int bb_errno_location; +static signed int * const bb_errno = &bb_errno_location; +static const char bb_msg_memory_exhausted[14l] = { (const char)111, (const char)117, (const char)116, (const char)32, (const char)111, (const char)102, (const char)32, (const char)109, (const char)101, (const char)109, (const char)111, (const char)114, (const char)121, (const char)0 }; +static const char bb_msg_standard_input[15l] = { (const char)115, (const char)116, (const char)97, (const char)110, (const char)100, (const char)97, (const char)114, (const char)100, (const char)32, (const char)105, (const char)110, (const char)112, (const char)117, (const char)116, (const char)0 }; +static const char bb_msg_standard_output[16l] = { (const char)115, (const char)116, (const char)97, (const char)110, (const char)100, (const char)97, (const char)114, (const char)100, (const char)32, (const char)111, (const char)117, (const char)116, (const char)112, (const char)117, (const char)116, (const char)0 }; +static struct suffix_mult bkm_suffixes[4l] = { { .suffix={ (char)98, (char)0, (char)0, (char)0 }, .mult=(unsigned int)512 }, + { .suffix={ (char)107, (char)0, (char)0, (char)0 }, .mult=(unsigned int)1024 }, + { .suffix={ (char)109, (char)0, (char)0, (char)0 }, .mult=(unsigned int)(1024 * 1024) }, + { .suffix={ (char)0, (char)0, (char)0, (char)0 }, .mult=(unsigned int)0 } }; +static struct __jmp_buf_tag die_jmp[1l]; +static signed int die_sleep; +static const char head_opts[7l] = { (const char)110, (const char)58, (const char)99, (const char)58, (const char)113, (const char)118, (const char)0 }; +static signed char logmode = (signed char)1; +static const char *msg_eol = "\n"; +static unsigned char xfunc_error_retval = (unsigned char)1; +static void bb_error_msg(const char *s, ...) +{ + va_list p; + __builtin_va_start(p,s); + bb_verror_msg(s, p, (const char *)((void *)0)); + __builtin_va_end(p); +} +static void bb_error_msg_and_die(const char *s, ...) +{ + va_list p; + __builtin_va_start(p,s); + bb_verror_msg(s, p, (const char *)((void *)0)); + __builtin_va_end(p); + abort(); +} +static char * bb_get_chunk_from_file(struct _IO_FILE *file, signed int *end) +{ + signed int ch; + unsigned int idx = (unsigned int)0; + char *linebuf = (char *)((void *)0); + void *return_value_xrealloc$1; + unsigned int tmp_post$2; + do + { + ch=_IO_getc (file); + if(ch == -1) + break; + if((255u & idx) == 0u) + { + return_value_xrealloc$1=xrealloc((void *)linebuf, (unsigned long int)(idx + (unsigned int)256)); + linebuf = (char *)return_value_xrealloc$1; + } + tmp_post$2 = idx; + idx = idx + 1u; + linebuf[(signed long int)tmp_post$2] = (char)ch; + if(ch == 0) + break; + if(!(end == ((signed int *)((void *)0)))) + { + if(ch == 10) + break; + } + } + while((_Bool)1); + if(!(end == ((signed int *)((void *)0)))) + *end = (signed int)idx; + if(!(linebuf == ((char *)((void *)0)))) + { + void *return_value_xrealloc$3; + return_value_xrealloc$3=xrealloc((void *)linebuf, (unsigned long int)(idx + (unsigned int)1)); + linebuf = (char *)return_value_xrealloc$3; + linebuf[(signed long int)idx] = (char)0; + } + return linebuf; +} +static void bb_perror_msg(const char *s, ...) +{ + va_list p; + __builtin_va_start(p,s); + char *tmp_if_expr$2; + char *return_value_strerror$1; + if(!(*bb_errno == 0)) + { + return_value_strerror$1=strerror(*bb_errno); + tmp_if_expr$2 = return_value_strerror$1; + } + else + tmp_if_expr$2 = (char *)((void *)0); + bb_verror_msg(s, p, tmp_if_expr$2); + __builtin_va_end(p); +} +static void bb_perror_msg_and_die(const char *s, ...) +{ + va_list p; + __builtin_va_start(p,s); + char *tmp_if_expr$2; + char *return_value_strerror$1; + if(!(*bb_errno == 0)) + { + return_value_strerror$1=strerror(*bb_errno); + tmp_if_expr$2 = return_value_strerror$1; + } + else + tmp_if_expr$2 = (char *)((void *)0); + bb_verror_msg(s, p, tmp_if_expr$2); + __builtin_va_end(p); + abort(); +} +static void bb_show_usage(void) +{ + ; +} +static void bb_simple_perror_msg(const char *s) +{ + bb_perror_msg("%s", s); +} +static void bb_verror_msg(const char *s, va_list p, const char *strerr) +{ + char *msg; + char *msg1; + signed int applet_len; + signed int strerr_len; + signed int msgeol_len; + signed int used; + if((signed int)logmode == 0) + return; + if(s == ((const char *)((void *)0))) + s = ""; + used=vasprintf(&msg, s, p); + if(used < 0) + return; + unsigned long int return_value_strlen$1; + return_value_strlen$1=strlen(applet_name); + applet_len = (signed int)(return_value_strlen$1 + (unsigned long int)2); + unsigned long int tmp_if_expr$3; + unsigned long int return_value_strlen$2; + if(!(strerr == ((const char *)((void *)0)))) + { + return_value_strlen$2=strlen(strerr); + tmp_if_expr$3 = return_value_strlen$2; + } + else + tmp_if_expr$3 = (unsigned long int)0; + strerr_len = (signed int)tmp_if_expr$3; + unsigned long int return_value_strlen$4; + return_value_strlen$4=strlen(msg_eol); + msgeol_len = (signed int)return_value_strlen$4; + void *return_value_realloc$5; + return_value_realloc$5=realloc((void *)msg, (unsigned long int)(applet_len + used + strerr_len + msgeol_len + 3)); + msg1 = (char *)return_value_realloc$5; + signed int tmp_post$6; + signed int tmp_post$7; + signed int tmp_post$8; + if(msg1 == ((char *)((void *)0))) + { + tmp_post$6 = used; + used = used + 1; + msg[(signed long int)tmp_post$6] = (char)10; + applet_len = 0; + } + else + { + msg = msg1; + memmove((void *)(msg + (signed long int)applet_len), (const void *)msg, (unsigned long int)used); + used = used + applet_len; + strcpy(msg, applet_name); + msg[(signed long int)(applet_len - 2)] = (char)58; + msg[(signed long int)(applet_len - 1)] = (char)32; + if(!(strerr == ((const char *)((void *)0)))) + { + if(!((signed int)*s == 0)) + { + tmp_post$7 = used; + used = used + 1; + msg[(signed long int)tmp_post$7] = (char)58; + tmp_post$8 = used; + used = used + 1; + msg[(signed long int)tmp_post$8] = (char)32; + } + strcpy(&msg[(signed long int)used], strerr); + used = used + strerr_len; + } + strcpy(&msg[(signed long int)used], msg_eol); + used = used + msgeol_len; + } + if(!((1 & (signed int)logmode) == 0)) + { + fflush_all(); + full_write(2, (const void *)msg, (unsigned long int)used); + } + if(!((2 & (signed int)logmode) == 0)) + syslog(3, "%s", msg + (signed long int)applet_len); + free((void *)msg); +} +static void die_if_ferror(struct _IO_FILE *fp, const char *fn) +{ + signed int return_value_ferror$1; + return_value_ferror$1=ferror(fp); + if(!(return_value_ferror$1 == 0)) + bb_error_msg_and_die("%s: I/O error", fn); +} +static void die_if_ferror_stdout(void) +{ + die_if_ferror(stdout, bb_msg_standard_output); +} +static unsigned long int eat_num(_Bool *negative_N, const char *p) +{ + if((signed int)*p == 45) + { + *negative_N = 1 != 0; + p = p + 1l; + } + unsigned long int return_value_xatoul_sfx$1; + return_value_xatoul_sfx$1=xatoul_sfx(p, bkm_suffixes); + return return_value_xatoul_sfx$1; +} +static signed int fclose_if_not_stdin(struct _IO_FILE *f) +{ + signed int r; + r=ferror(f); + if(!(r == 0)) + *bb_errno = 5; + signed int return_value_fclose$1; + if(!(f == stdin)) + { + return_value_fclose$1=fclose(f); + return r | return_value_fclose$1; + } + return r; +} +static signed int fflush_all(void) +{ + signed int return_value_fflush$1; + return_value_fflush$1=fflush((struct _IO_FILE *)((void *)0)); + return return_value_fflush$1; +} +static void fflush_stdout_and_exit(signed int retval) +{ + signed int return_value_fflush$1; + return_value_fflush$1=fflush(stdout); + if(!(return_value_fflush$1 == 0)) + bb_perror_msg_and_die(bb_msg_standard_output); + if(die_sleep < 0) + { + xfunc_error_retval = (unsigned char)retval; + abort(); + } + exit(retval); +} +static struct _IO_FILE * fopen_or_warn(const char *path, const char *mode) +{ + struct _IO_FILE *fp; + fp=fopen(path, mode); + if(fp == ((struct _IO_FILE *)((void *)0))) + bb_simple_perror_msg(path); + return fp; +} +static struct _IO_FILE * fopen_or_warn_stdin(const char *filename) +{ + struct _IO_FILE *fp = stdin; + _Bool tmp_if_expr$1; + if(!(filename == bb_msg_standard_input)) + { + if(!((signed int)*filename == 45)) + tmp_if_expr$1 = 1 != 0; + else + tmp_if_expr$1 = ((signed int)filename[(signed long int)1] != 0 ? (signed int)(1 != 0) : (signed int)(0 != 0)) != 0; + if(!(tmp_if_expr$1 == (_Bool)0)) + fp=fopen_or_warn(filename, "r"); + } + return fp; +} +static signed long int full_write(signed int fd, const void *buf, unsigned long int len) +{ + signed long int cc; + signed long int total = (signed long int)0; + for( ; !(len == 0ul); len = len - (unsigned long int)cc) + { + cc=safe_write(fd, buf, len); + if(cc < 0l) + { + if(!(total == 0l)) + return total; + return cc; + } + total = total + cc; + buf = (const void *)((const char *)buf + cc); + } + return total; +} +signed int __main(signed int argc, char **argv) +{ + unsigned long int count = (unsigned long int)10; + signed int header_threshhold = 1; + _Bool count_bytes = 0 != 0; + _Bool negative_N = 0 != 0; + struct _IO_FILE *fp; + const char *fmt; + char *p; + signed int opt; + signed int retval = 0; + if(!(*(1l + argv) == ((char *)((void *)0)))) + { + if(!((signed int)*(*(1l + argv)) == 45)) + goto __CPROVER_DUMP_L9; + if(!(208 + (signed int)(unsigned char)(signed int)*(1l + *(1l + argv)) <= 9)) + goto __CPROVER_DUMP_L9; + argc = argc - 1; + argv = argv + 1l; + p = argv[(signed long int)0] + (signed long int)1; + } + else + { + __CPROVER_DUMP_L9: + ; + opt=getopt(argc, argv, head_opts); + if(!(opt > 0)) + goto __CPROVER_DUMP_L17; + if(!(opt == 113)) + { + if(opt == 118) + goto __CPROVER_DUMP_L11; + if(opt == 99) + goto __CPROVER_DUMP_L12; + if(opt == 110) + goto __CPROVER_DUMP_L13; + goto __CPROVER_DUMP_L15; + } + header_threshhold = 2147483647; + goto __CPROVER_DUMP_L16; + __CPROVER_DUMP_L11: + ; + header_threshhold = -1; + goto __CPROVER_DUMP_L16; + __CPROVER_DUMP_L12: + ; + count_bytes = 1 != 0; + __CPROVER_DUMP_L13: + ; + p = optarg; + } + if(p!=((void *)0)) + { +GET_COUNT: + ; + count=eat_num(&negative_N, p); + goto __CPROVER_DUMP_L16; + } +__CPROVER_DUMP_L15: + ; + bb_show_usage(); +__CPROVER_DUMP_L16: + ; + goto __CPROVER_DUMP_L9; +__CPROVER_DUMP_L17: + ; + argc = argc - optind; + argv = argv + (signed long int)optind; + if(*argv == ((char *)((void *)0))) + { + argv = argv - 1l; + *argv = (char *)"-"; + } + fmt = "\n==> %s <==\n" + (signed long int)1; + if(header_threshhold >= argc) + header_threshhold = 0; + if(!((signed int)negative_N == 0)) + { + if(count >= 268435455ul) + bb_error_msg("count is too big: %lu", count); + } + while((_Bool)1) + { + fp=fopen_or_warn_stdin(*argv); + if(!(fp == ((struct _IO_FILE *)((void *)0)))) + { + if(fp == stdin) + { + *argv = (char *)bb_msg_standard_input; + } + if(!(header_threshhold == 0)) + { + printf(fmt, *argv); + } + if(!((signed int)negative_N == 0)) + { + if(!((signed int)count_bytes == 0)) + print_except_N_last_bytes(fp, (unsigned int)count); + else + print_except_N_last_lines(fp, (unsigned int)count); + } + else + print_first_N(fp, count, count_bytes); + die_if_ferror_stdout(); + signed int return_value_fclose_if_not_stdin$1; + return_value_fclose_if_not_stdin$1=fclose_if_not_stdin(fp); + if(!(return_value_fclose_if_not_stdin$1 == 0)) + { + bb_simple_perror_msg(*argv); + retval = 1; + } + } + else + retval = 1; + fmt = "\n==> %s <==\n"; + argv = argv + 1l; + if(*argv == ((char *)((void *)0))) + break; + } + fflush(stdout); + return retval; +} +static void print_except_N_last_bytes(struct _IO_FILE *fp, unsigned int count) +{ + unsigned char *circle; + count = count + 1u; + void *return_value_xmalloc$1; + return_value_xmalloc$1=xmalloc((unsigned long int)count); + circle = (unsigned char *)return_value_xmalloc$1; + unsigned int head = (unsigned int)0; + unsigned int tmp_post$2; + do + { + signed int c; + c=_IO_getc (fp); + if(c == -1) + goto ret; + tmp_post$2 = head; + head = head + 1u; + circle[(signed long int)tmp_post$2] = (unsigned char)c; + if(head == count) + break; + } + while((_Bool)1); + do + { + signed int print_except_N_last_bytes$$1$$2$$1$$c; + if(head == count) + head = (unsigned int)0; + putchar((signed int)circle[(signed long int)head]); + print_except_N_last_bytes$$1$$2$$1$$c=_IO_getc (fp); + if(print_except_N_last_bytes$$1$$2$$1$$c == -1) + break; + circle[(signed long int)head] = (unsigned char)print_except_N_last_bytes$$1$$2$$1$$c; + head = head + 1u; + } + while((_Bool)1); +ret: + ; + free((void *)circle); +} +static void print_except_N_last_lines(struct _IO_FILE *fp, unsigned int count) +{ + char **circle; + count = count + 1u; + void *return_value_xzalloc$1; + return_value_xzalloc$1=xzalloc((unsigned long int)count * sizeof(char *) ); + circle = (char **)return_value_xzalloc$1; + unsigned int head = (unsigned int)0; + unsigned int tmp_post$2; + do + { + char *c; + c=xmalloc_fgets(fp); + if(c == ((char *)((void *)0))) + goto ret; + tmp_post$2 = head; + head = head + 1u; + circle[(signed long int)tmp_post$2] = c; + if(head == count) + break; + } + while((_Bool)1); + unsigned int tmp_post$3; + do + { + char *print_except_N_last_lines$$1$$2$$1$$c; + if(head == count) + head = (unsigned int)0; + fputs(circle[(signed long int)head], stdout); + print_except_N_last_lines$$1$$2$$1$$c=xmalloc_fgets(fp); + if(print_except_N_last_lines$$1$$2$$1$$c == ((char *)((void *)0))) + break; + free((void *)circle[(signed long int)head]); + tmp_post$3 = head; + head = head + 1u; + circle[(signed long int)tmp_post$3] = print_except_N_last_lines$$1$$2$$1$$c; + } + while((_Bool)1); +ret: + ; + head = (unsigned int)0; + unsigned int tmp_post$4; + do + { + tmp_post$4 = head; + head = head + 1u; + free((void *)circle[(signed long int)tmp_post$4]); + if(head == count) + break; + } + while((_Bool)1); + free((void *)circle); +} +static void print_first_N(struct _IO_FILE *fp, unsigned long int count, _Bool count_bytes) +{ + while(!(count == 0ul)) + { + signed int c; + c=_IO_getc (fp); + if(c == -1) + break; + if((signed int)count_bytes == 0) + { + if(c == 10) + goto __CPROVER_DUMP_L3; + } + else + { + __CPROVER_DUMP_L3: + ; + count = count - 1ul; + } + putchar(c); + } +} +static signed long int safe_write(signed int fd, const void *buf, unsigned long int count) +{ + signed long int n; + _Bool tmp_if_expr$1; + do + { + n=write(fd, buf, count); + if(n < 0l) + tmp_if_expr$1 = (*bb_errno == 4 ? (signed int)(1 != 0) : (signed int)(0 != 0)) != 0; + else + tmp_if_expr$1 = 0 != 0; + } + while(tmp_if_expr$1 != (_Bool)0); + return n; +} +static inline unsigned long int xatoul_sfx(const char *str, struct suffix_mult *sfx) +{ + unsigned long long int return_value_xatoull_sfx$1; + return_value_xatoull_sfx$1=xatoull_sfx(str, sfx); + return return_value_xatoull_sfx$1; +} +static unsigned long long int xatoull_sfx(const char *numstr, struct suffix_mult *suffixes) +{ + unsigned long long int return_value_xstrtoull_range_sfx$1; + return_value_xstrtoull_range_sfx$1=xstrtoull_range_sfx(numstr, 10, (unsigned long long int)0, (unsigned long int)9223372036854775807ll * 2ull + 1ull, suffixes); + return return_value_xstrtoull_range_sfx$1; +} +static void xfunc_die(void) +{ + if(!(die_sleep == 0)) + { + if(die_sleep < 0) + longjmp(die_jmp, (signed int)xfunc_error_retval != 0 ? (signed int)xfunc_error_retval : -2222); + sleep((unsigned int)die_sleep); + } + exit((signed int)xfunc_error_retval); +} +static void * xmalloc(unsigned long int size) +{ + void *ptr; + ptr=malloc(size); + if(ptr == ((void *)0)) + { + if(!(size == 0ul)) + bb_error_msg_and_die(bb_msg_memory_exhausted); + } + return ptr; +} +static char * xmalloc_fgets(struct _IO_FILE *file) +{ + signed int i; + char *return_value_bb_get_chunk_from_file$1; + return_value_bb_get_chunk_from_file$1=bb_get_chunk_from_file(file, &i); + return return_value_bb_get_chunk_from_file$1; +} +static void * xrealloc(void *ptr, unsigned long int size) +{ + ptr=realloc(ptr, size); + if(ptr == ((void *)0)) + { + if(!(size == 0ul)) + bb_error_msg_and_die(bb_msg_memory_exhausted); + } + return ptr; +} +static unsigned long long int xstrtoull_range_sfx(const char *numstr, signed int base, unsigned long long int lower, unsigned long long int upper, struct suffix_mult *suffixes) +{ + unsigned long long int r; + signed int old_errno; + char *e; + _Bool tmp_if_expr$1; + if((signed int)*numstr == 45) + tmp_if_expr$1 = 1 != 0; + else + tmp_if_expr$1 = ((signed int)*numstr == 43 ? (signed int)(1 != 0) : (signed int)(0 != 0)) != 0; + _Bool tmp_if_expr$3; + _Bool tmp_statement_expression$2; + if(!(tmp_if_expr$1 == (_Bool)0)) + tmp_if_expr$3 = 1 != 0; + else + { + unsigned char bb__isspace = (unsigned char)((signed int)*numstr - 9); + tmp_statement_expression$2 = (signed int)bb__isspace == 32 - 9 || (signed int)bb__isspace <= 13 - 9; + tmp_if_expr$3 = (tmp_statement_expression$2 != (_Bool)0 ? (signed int)(1 != 0) : (signed int)(0 != 0)) != 0; + } + signed int tmp_statement_expression$4; + if(tmp_if_expr$3 == (_Bool)0) + { + old_errno = *bb_errno; + *bb_errno = 0; + r=strtoull(numstr, &e, base); + if(!(numstr == e)) + { + if(*bb_errno == 0) + { + *bb_errno = old_errno; + if(!(suffixes == ((struct suffix_mult *)((void *)0)))) + for( ; !(suffixes->mult == 0u); suffixes = suffixes + 1l) + { + unsigned long int __s1_len; + unsigned long int __s2_len; + signed int return_value___builtin_strcmp$5; + return_value___builtin_strcmp$5=strcmp(suffixes->suffix, e); + tmp_statement_expression$4 = return_value___builtin_strcmp$5; + if(tmp_statement_expression$4 == 0) + { + if(!(18446744073709551615ull / (unsigned long int)suffixes->mult >= r)) + goto range; + r = r * (unsigned long long int)suffixes->mult; + goto chk_range; + } + } + if((signed int)*e == 0) + { + chk_range: + ; + if(r >= lower) + { + if(upper >= r) + return r; + } + range: + ; + bb_error_msg_and_die("number %s is not in %llu..%llu range", numstr, (unsigned long long int)lower, (unsigned long long int)upper); + } + } + } + } +inval: + ; + bb_error_msg_and_die("invalid number '%s'", numstr); +} +static void * xzalloc(unsigned long int size) +{ + void *ptr; + ptr=xmalloc(size); + memset(ptr, 0, size); + return ptr; +} +static struct utmp dummy_utmp; +struct utmp *getutent(void) { + if (__VERIFIER_nondet_int()) + return (struct utmp *)((void *)0); + dummy_utmp.ut_tv.tv_sec = __VERIFIER_nondet_int(); + dummy_utmp.ut_type = __VERIFIER_nondet_short(); + for (int i = 0; i < sizeof(dummy_utmp.ut_line); ++i) + dummy_utmp.ut_line[i] = __VERIFIER_nondet_char(); + for (int i = 0; i < sizeof(dummy_utmp.ut_user); ++i) + dummy_utmp.ut_user[i] = __VERIFIER_nondet_char(); + return &dummy_utmp; +} +int getopt(int argc, char * const argv[], const char *optstring) +{ + int result = -1; + if(optind == 0) + optind = 1; + if(optind >= argc || argv[optind][0] != '-') + return -1; + size_t opt_index = __VERIFIER_nondet_ulong(); + __VERIFIER_assume(opt_index < strlen(optstring) && optstring[opt_index] != ':'); + if(__VERIFIER_nondet_int()) + { + result = optstring[opt_index]; + if(__VERIFIER_nondet_int()) + ++optind; + } + if(result != -1 && optind < argc && optstring[opt_index+1] == ':') + { + if(__VERIFIER_nondet_int()) + { + optarg = argv[optind]; + ++optind; + } + else + optarg = ((void *)0); + } + return result; +} +int getopt_long(int argc, char * const argv[], const char *optstring, + const struct option *longopts, int *longindex) +{ + (void)*longopts; + (void)longindex; + return getopt(argc, argv, optstring); +} +ssize_t read(int fildes, void *buf, size_t nbyte) +{ + long ret=__VERIFIER_nondet_long(); + unsigned long offset=__VERIFIER_nondet_ulong(); + __VERIFIER_assume(ret>=-1 && ret<=nbyte); + __VERIFIER_assume(offset=-1 && ret<=nbyte); + return ret; +} +int main() +{ + char *a = malloc(11); + a[10] = 0; + for(int i=0; i<10; ++i) + a[i]=__VERIFIER_nondet_char(); + applet_name = a; + bb_errno_location = __VERIFIER_nondet_int(); + optind = 1; + int argc = __VERIFIER_nondet_int(); + __VERIFIER_assume(argc >= 1 && argc <= 10000); + char **argv=malloc((argc+1)*sizeof(char*)); + argv[argc]=0; + for(int i=0; i Date: Wed, 15 Nov 2017 16:51:30 +0000 Subject: [PATCH 3/4] Fix the reported bug in busybox/sleep Fixes: #444 --- ...alid-deref.c => sleep_true-no-overflow_true-valid-deref.c} | 4 ++-- ...alid-deref.i => sleep_true-no-overflow_true-valid-deref.i} | 4 ++-- c/check.py | 2 -- 3 files changed, 4 insertions(+), 6 deletions(-) rename c/busybox-1.22.0/{sleep_true-no-overflow_false-valid-deref.c => sleep_true-no-overflow_true-valid-deref.c} (99%) rename c/busybox-1.22.0/{sleep_true-no-overflow_false-valid-deref.i => sleep_true-no-overflow_true-valid-deref.i} (99%) diff --git a/c/busybox-1.22.0/sleep_true-no-overflow_false-valid-deref.c b/c/busybox-1.22.0/sleep_true-no-overflow_true-valid-deref.c similarity index 99% rename from c/busybox-1.22.0/sleep_true-no-overflow_false-valid-deref.c rename to c/busybox-1.22.0/sleep_true-no-overflow_true-valid-deref.c index 1610b564ea7..19823481272 100644 --- a/c/busybox-1.22.0/sleep_true-no-overflow_false-valid-deref.c +++ b/c/busybox-1.22.0/sleep_true-no-overflow_true-valid-deref.c @@ -107,7 +107,7 @@ static void bb_error_msg_and_die(const char *s, ...) // file ./libbb-dump.i line 1 static void bb_show_usage(void) { - ; + abort(); } // file include/libbb.h line 1092 @@ -296,7 +296,7 @@ signed int __main(signed int argc, char **argv) else { - tmp_if_expr$10 = ((signed int)*pp != 0 ? (signed int)(1 != 0) : (signed int)(0 != 0)) != 0; + tmp_if_expr$10 = ((arg == pp || (signed int)*pp != 0) ? (signed int)(1 != 0) : (signed int)(0 != 0)) != 0; } if(!(tmp_if_expr$10 == (_Bool)0)) bb_show_usage(); diff --git a/c/busybox-1.22.0/sleep_true-no-overflow_false-valid-deref.i b/c/busybox-1.22.0/sleep_true-no-overflow_true-valid-deref.i similarity index 99% rename from c/busybox-1.22.0/sleep_true-no-overflow_false-valid-deref.i rename to c/busybox-1.22.0/sleep_true-no-overflow_true-valid-deref.i index 8589b3c3212..72d81c5bda0 100644 --- a/c/busybox-1.22.0/sleep_true-no-overflow_false-valid-deref.i +++ b/c/busybox-1.22.0/sleep_true-no-overflow_true-valid-deref.i @@ -2374,7 +2374,7 @@ static void bb_error_msg_and_die(const char *s, ...) } static void bb_show_usage(void) { - ; + abort(); } static void bb_verror_msg(const char *s, va_list p, const char *strerr) { @@ -2533,7 +2533,7 @@ signed int __main(signed int argc, char **argv) tmp_if_expr$10 = 1 != 0; else { - tmp_if_expr$10 = ((signed int)*pp != 0 ? (signed int)(1 != 0) : (signed int)(0 != 0)) != 0; + tmp_if_expr$10 = ((arg == pp || (signed int)*pp != 0) ? (signed int)(1 != 0) : (signed int)(0 != 0)) != 0; } if(!(tmp_if_expr$10 == (_Bool)0)) bb_show_usage(); diff --git a/c/check.py b/c/check.py index 34182d24cce..3098ea103c1 100755 --- a/c/check.py +++ b/c/check.py @@ -91,8 +91,6 @@ ] KNOWN_BENCHMARK_FILE_PROBLEMS = [ - ("busybox-1.22.0/sleep_true-no-overflow_false-valid-deref.c", "has expected undefined behavior but also a verdict for some other property"), - ("busybox-1.22.0/sleep_true-no-overflow_false-valid-deref.i", "has expected undefined behavior but also a verdict for some other property"), ("forester-heap/dll-rb-cnstr_1_false-unreach-call_false-valid-deref.c", "has expected undefined behavior but also a verdict for some other property"), ("forester-heap/dll-rb-cnstr_1_false-unreach-call_false-valid-deref.i", "has expected undefined behavior but also a verdict for some other property"), ("forester-heap/sll-01_false-unreach-call_false-valid-deref.c", "has expected undefined behavior but also a verdict for some other property"), From 2035c6718d2fbccf824758ff7814698c81165d6e Mon Sep 17 00:00:00 2001 From: Michael Tautschnig Date: Wed, 15 Nov 2017 17:04:31 +0000 Subject: [PATCH 4/4] Busybox: do not unncessarily mix signed and unsigned char Fixes: #511 --- ...lse-unreach-call_true-no-overflow_true-valid-memsafety.c | 2 +- ...lse-unreach-call_true-no-overflow_true-valid-memsafety.i | 2 +- c/busybox-1.22.0/basename_false-valid-deref.c | 2 +- c/busybox-1.22.0/basename_false-valid-deref.i | 2 +- ...lse-unreach-call_true-no-overflow_true-valid-memsafety.c | 2 +- ...lse-unreach-call_true-no-overflow_true-valid-memsafety.i | 2 +- .../dirname_true-no-overflow_true-valid-memsafety.c | 2 +- .../dirname_true-no-overflow_true-valid-memsafety.i | 2 +- ...lse-unreach-call_true-no-overflow_true-valid-memsafety.c | 2 +- ...lse-unreach-call_true-no-overflow_true-valid-memsafety.i | 2 +- ...lse-unreach-call_true-no-overflow_true-valid-memsafety.c | 2 +- ...lse-unreach-call_true-no-overflow_true-valid-memsafety.i | 2 +- ...lse-unreach-call_true-no-overflow_true-valid-memsafety.c | 2 +- ...lse-unreach-call_true-no-overflow_true-valid-memsafety.i | 2 +- .../uudecode_true-no-overflow_true-valid-memsafety.c | 6 +++--- .../uudecode_true-no-overflow_true-valid-memsafety.i | 6 +++--- 16 files changed, 20 insertions(+), 20 deletions(-) diff --git a/c/busybox-1.22.0/basename_false-unreach-call_true-no-overflow_true-valid-memsafety.c b/c/busybox-1.22.0/basename_false-unreach-call_true-no-overflow_true-valid-memsafety.c index 6b84ce9f13d..6d3bff06b33 100644 --- a/c/busybox-1.22.0/basename_false-unreach-call_true-no-overflow_true-valid-memsafety.c +++ b/c/busybox-1.22.0/basename_false-unreach-call_true-no-overflow_true-valid-memsafety.c @@ -80,7 +80,7 @@ signed int __main(signed int argc, char **argv) } if(!(tmp_if_expr$2 == (_Bool)0)) { - const unsigned char *__s2; + const char *__s2; __s2 = (const char *)argv[(signed long int)1]; signed int __result; diff --git a/c/busybox-1.22.0/basename_false-unreach-call_true-no-overflow_true-valid-memsafety.i b/c/busybox-1.22.0/basename_false-unreach-call_true-no-overflow_true-valid-memsafety.i index f3fa766d253..2cfff69b818 100644 --- a/c/busybox-1.22.0/basename_false-unreach-call_true-no-overflow_true-valid-memsafety.i +++ b/c/busybox-1.22.0/basename_false-unreach-call_true-no-overflow_true-valid-memsafety.i @@ -1333,7 +1333,7 @@ signed int __main(signed int argc, char **argv) } if(!(tmp_if_expr$2 == (_Bool)0)) { - const unsigned char *__s2; + const char *__s2; __s2 = (const char *)argv[(signed long int)1]; signed int __result; __result = (signed int)((const char *)"--")[(signed long int)0] - (signed int)__s2[(signed long int)0]; diff --git a/c/busybox-1.22.0/basename_false-valid-deref.c b/c/busybox-1.22.0/basename_false-valid-deref.c index 070af86034d..c092594c8fc 100644 --- a/c/busybox-1.22.0/basename_false-valid-deref.c +++ b/c/busybox-1.22.0/basename_false-valid-deref.c @@ -80,7 +80,7 @@ signed int __main(signed int argc, char **argv) } if(!(tmp_if_expr$2 == (_Bool)0)) { - const unsigned char *__s2; + const char *__s2; __s2 = (const char *)argv[(signed long int)1]; signed int __result; diff --git a/c/busybox-1.22.0/basename_false-valid-deref.i b/c/busybox-1.22.0/basename_false-valid-deref.i index 7d74e850dde..ab1744cbf3e 100644 --- a/c/busybox-1.22.0/basename_false-valid-deref.i +++ b/c/busybox-1.22.0/basename_false-valid-deref.i @@ -1333,7 +1333,7 @@ signed int __main(signed int argc, char **argv) } if(!(tmp_if_expr$2 == (_Bool)0)) { - const unsigned char *__s2; + const char *__s2; __s2 = (const char *)argv[(signed long int)1]; signed int __result; __result = (signed int)((const char *)"--")[(signed long int)0] - (signed int)__s2[(signed long int)0]; diff --git a/c/busybox-1.22.0/date_false-unreach-call_true-no-overflow_true-valid-memsafety.c b/c/busybox-1.22.0/date_false-unreach-call_true-no-overflow_true-valid-memsafety.c index 3ffd5b91d4f..fe6270a78a0 100644 --- a/c/busybox-1.22.0/date_false-unreach-call_true-no-overflow_true-valid-memsafety.c +++ b/c/busybox-1.22.0/date_false-unreach-call_true-no-overflow_true-valid-memsafety.c @@ -659,7 +659,7 @@ signed int __main(signed int argc, char **argv) } if(!(tmp_if_expr$20 == (_Bool)0)) { - const unsigned char *__s2 = (const char *)fmt_dt2str; + const char *__s2 = (const char *)fmt_dt2str; signed int __result; __result = (signed int)((const char *)"%f")[(signed long int)0] - (signed int)__s2[(signed long int)0]; diff --git a/c/busybox-1.22.0/date_false-unreach-call_true-no-overflow_true-valid-memsafety.i b/c/busybox-1.22.0/date_false-unreach-call_true-no-overflow_true-valid-memsafety.i index 38e0ba33347..5415e6fbadb 100644 --- a/c/busybox-1.22.0/date_false-unreach-call_true-no-overflow_true-valid-memsafety.i +++ b/c/busybox-1.22.0/date_false-unreach-call_true-no-overflow_true-valid-memsafety.i @@ -2846,7 +2846,7 @@ signed int __main(signed int argc, char **argv) } if(!(tmp_if_expr$20 == (_Bool)0)) { - const unsigned char *__s2 = (const char *)fmt_dt2str; + const char *__s2 = (const char *)fmt_dt2str; signed int __result; __result = (signed int)((const char *)"%f")[(signed long int)0] - (signed int)__s2[(signed long int)0]; if(__s2_len > 0ul) diff --git a/c/busybox-1.22.0/dirname_true-no-overflow_true-valid-memsafety.c b/c/busybox-1.22.0/dirname_true-no-overflow_true-valid-memsafety.c index b4121f6b166..2cae8f11dd9 100644 --- a/c/busybox-1.22.0/dirname_true-no-overflow_true-valid-memsafety.c +++ b/c/busybox-1.22.0/dirname_true-no-overflow_true-valid-memsafety.c @@ -97,7 +97,7 @@ static char * single_argv(char **argv) } if(!(tmp_if_expr$2 == (_Bool)0)) { - const unsigned char *__s2 = (const char *)argv[(signed long int)1]; + const char *__s2 = (const char *)argv[(signed long int)1]; signed int __result = (signed int)((const char *)"--")[(signed long int)0] - (signed int)__s2[(signed long int)0]; if(__s2_len > 0ul) { diff --git a/c/busybox-1.22.0/dirname_true-no-overflow_true-valid-memsafety.i b/c/busybox-1.22.0/dirname_true-no-overflow_true-valid-memsafety.i index f4e238607b0..4219d06f4d7 100644 --- a/c/busybox-1.22.0/dirname_true-no-overflow_true-valid-memsafety.i +++ b/c/busybox-1.22.0/dirname_true-no-overflow_true-valid-memsafety.i @@ -1171,7 +1171,7 @@ static char * single_argv(char **argv) } if(!(tmp_if_expr$2 == (_Bool)0)) { - const unsigned char *__s2 = (const char *)argv[(signed long int)1]; + const char *__s2 = (const char *)argv[(signed long int)1]; signed int __result = (signed int)((const char *)"--")[(signed long int)0] - (signed int)__s2[(signed long int)0]; if(__s2_len > 0ul) { diff --git a/c/busybox-1.22.0/ls-incomplete_false-unreach-call_true-no-overflow_true-valid-memsafety.c b/c/busybox-1.22.0/ls-incomplete_false-unreach-call_true-no-overflow_true-valid-memsafety.c index 4e3d76cd7a7..1890393cb90 100644 --- a/c/busybox-1.22.0/ls-incomplete_false-unreach-call_true-no-overflow_true-valid-memsafety.c +++ b/c/busybox-1.22.0/ls-incomplete_false-unreach-call_true-no-overflow_true-valid-memsafety.c @@ -2021,7 +2021,7 @@ signed int __main(signed int argc, char **argv) } if(!(tmp_if_expr$2 == (_Bool)0)) { - const unsigned char *__s2 = (const char *)p; + const char *__s2 = (const char *)p; signed int __result; __result = (signed int)((const char *)"none")[(signed long int)0] - (signed int)__s2[(signed long int)0]; diff --git a/c/busybox-1.22.0/ls-incomplete_false-unreach-call_true-no-overflow_true-valid-memsafety.i b/c/busybox-1.22.0/ls-incomplete_false-unreach-call_true-no-overflow_true-valid-memsafety.i index 7a06edc1d14..dc7afafe9ae 100644 --- a/c/busybox-1.22.0/ls-incomplete_false-unreach-call_true-no-overflow_true-valid-memsafety.i +++ b/c/busybox-1.22.0/ls-incomplete_false-unreach-call_true-no-overflow_true-valid-memsafety.i @@ -4058,7 +4058,7 @@ signed int __main(signed int argc, char **argv) } if(!(tmp_if_expr$2 == (_Bool)0)) { - const unsigned char *__s2 = (const char *)p; + const char *__s2 = (const char *)p; signed int __result; __result = (signed int)((const char *)"none")[(signed long int)0] - (signed int)__s2[(signed long int)0]; if(__s2_len > 0ul) diff --git a/c/busybox-1.22.0/stty_false-unreach-call_true-no-overflow_true-valid-memsafety.c b/c/busybox-1.22.0/stty_false-unreach-call_true-no-overflow_true-valid-memsafety.c index c1c5721827a..e7336ba2767 100644 --- a/c/busybox-1.22.0/stty_false-unreach-call_true-no-overflow_true-valid-memsafety.c +++ b/c/busybox-1.22.0/stty_false-unreach-call_true-no-overflow_true-valid-memsafety.c @@ -1331,7 +1331,7 @@ static void set_control_char_or_die(struct control_info *info, const char *arg, } if(!(tmp_if_expr$4 == (_Bool)0)) { - const unsigned char *__s2 = (const char *)arg; + const char *__s2 = (const char *)arg; signed int __result; __result = (signed int)((const char *)"^-")[(signed long int)0] - (signed int)__s2[(signed long int)0]; diff --git a/c/busybox-1.22.0/stty_false-unreach-call_true-no-overflow_true-valid-memsafety.i b/c/busybox-1.22.0/stty_false-unreach-call_true-no-overflow_true-valid-memsafety.i index 2d3248c86bb..ede6acf6977 100644 --- a/c/busybox-1.22.0/stty_false-unreach-call_true-no-overflow_true-valid-memsafety.i +++ b/c/busybox-1.22.0/stty_false-unreach-call_true-no-overflow_true-valid-memsafety.i @@ -3372,7 +3372,7 @@ static void set_control_char_or_die(struct control_info *info, const char *arg, } if(!(tmp_if_expr$4 == (_Bool)0)) { - const unsigned char *__s2 = (const char *)arg; + const char *__s2 = (const char *)arg; signed int __result; __result = (signed int)((const char *)"^-")[(signed long int)0] - (signed int)__s2[(signed long int)0]; if(set_control_char_or_die$$1$$1$$__s2_len > 0ul) diff --git a/c/busybox-1.22.0/test-incomplete_false-unreach-call_true-no-overflow_true-valid-memsafety.c b/c/busybox-1.22.0/test-incomplete_false-unreach-call_true-no-overflow_true-valid-memsafety.c index 16c1c324f98..4b178c05252 100644 --- a/c/busybox-1.22.0/test-incomplete_false-unreach-call_true-no-overflow_true-valid-memsafety.c +++ b/c/busybox-1.22.0/test-incomplete_false-unreach-call_true-no-overflow_true-valid-memsafety.c @@ -1053,7 +1053,7 @@ signed int __main(signed int argc, char **argv) } if(!(tmp_if_expr$3 == (_Bool)0)) { - const unsigned char *__s2; + const char *__s2; __s2 = (const char *)argv[(signed long int)argc]; signed int __result; diff --git a/c/busybox-1.22.0/test-incomplete_false-unreach-call_true-no-overflow_true-valid-memsafety.i b/c/busybox-1.22.0/test-incomplete_false-unreach-call_true-no-overflow_true-valid-memsafety.i index 1f105039e93..cae840aedba 100644 --- a/c/busybox-1.22.0/test-incomplete_false-unreach-call_true-no-overflow_true-valid-memsafety.i +++ b/c/busybox-1.22.0/test-incomplete_false-unreach-call_true-no-overflow_true-valid-memsafety.i @@ -3171,7 +3171,7 @@ signed int __main(signed int argc, char **argv) } if(!(tmp_if_expr$3 == (_Bool)0)) { - const unsigned char *__s2; + const char *__s2; __s2 = (const char *)argv[(signed long int)argc]; signed int __result; __result = (signed int)((const char *)"]]")[(signed long int)0] - (signed int)__s2[(signed long int)0]; diff --git a/c/busybox-1.22.0/uudecode_true-no-overflow_true-valid-memsafety.c b/c/busybox-1.22.0/uudecode_true-no-overflow_true-valid-memsafety.c index 42e97b48750..20b7b95321e 100644 --- a/c/busybox-1.22.0/uudecode_true-no-overflow_true-valid-memsafety.c +++ b/c/busybox-1.22.0/uudecode_true-no-overflow_true-valid-memsafety.c @@ -1152,7 +1152,7 @@ static void read_base64(struct _IO_FILE *src_stream, struct _IO_FILE *dst_stream } if(!(tmp_if_expr$3 == (_Bool)0)) { - const unsigned char *__s2 = (const char *)in_buf; + const char *__s2 = (const char *)in_buf; signed int __result = (signed int)((const char *)"====")[(signed long int)0] - (signed int)__s2[(signed long int)0]; if(__s2_len > 0ul) { @@ -1254,7 +1254,7 @@ static void read_stduu(struct _IO_FILE *src_stream, struct _IO_FILE *dst_stream, } if(!(tmp_if_expr$2 == (_Bool)0)) { - const unsigned char *__s2 = (const char *)line; + const char *__s2 = (const char *)line; signed int __result; __result = (signed int)((const char *)"end")[(signed long int)0] - (signed int)__s2[(signed long int)0]; @@ -1464,7 +1464,7 @@ signed int __main(signed int argc, char **argv) } if(!(tmp_if_expr$11 == (_Bool)0)) { - const unsigned char *__s2 = (const char *)line; + const char *__s2 = (const char *)line; signed int __result; __result = (signed int)((const char *)"begin-base64 ")[(signed long int)0] - (signed int)__s2[(signed long int)0]; diff --git a/c/busybox-1.22.0/uudecode_true-no-overflow_true-valid-memsafety.i b/c/busybox-1.22.0/uudecode_true-no-overflow_true-valid-memsafety.i index 2e8c037df44..437c4d9ee6f 100644 --- a/c/busybox-1.22.0/uudecode_true-no-overflow_true-valid-memsafety.i +++ b/c/busybox-1.22.0/uudecode_true-no-overflow_true-valid-memsafety.i @@ -3135,7 +3135,7 @@ static void read_base64(struct _IO_FILE *src_stream, struct _IO_FILE *dst_stream } if(!(tmp_if_expr$3 == (_Bool)0)) { - const unsigned char *__s2 = (const char *)in_buf; + const char *__s2 = (const char *)in_buf; signed int __result = (signed int)((const char *)"====")[(signed long int)0] - (signed int)__s2[(signed long int)0]; if(__s2_len > 0ul) { @@ -3220,7 +3220,7 @@ static void read_stduu(struct _IO_FILE *src_stream, struct _IO_FILE *dst_stream, } if(!(tmp_if_expr$2 == (_Bool)0)) { - const unsigned char *__s2 = (const char *)line; + const char *__s2 = (const char *)line; signed int __result; __result = (signed int)((const char *)"end")[(signed long int)0] - (signed int)__s2[(signed long int)0]; if(__s2_len > 0ul) @@ -3383,7 +3383,7 @@ signed int __main(signed int argc, char **argv) } if(!(tmp_if_expr$11 == (_Bool)0)) { - const unsigned char *__s2 = (const char *)line; + const char *__s2 = (const char *)line; signed int __result; __result = (signed int)((const char *)"begin-base64 ")[(signed long int)0] - (signed int)__s2[(signed long int)0]; if(__s2_len > 0ul)