Closed Lee-Janggun closed 2 years ago
For anyone else struggling: I did manual binary search to reduce the example.
It looks like similar issue with https://github.com/kaist-cp/cs420/issues/337#issuecomment-1060612432.
Could you please check your test_polished.c
is a buggy input program by following the instructions in the above issue? I don't think these locale warnings are related to reducing the code.
By "buggy input program", you mean test_polished.c
after python3 tests/fuzz.py --print
has failed right?
My current (modified to be incorrect) implementation has the following error on python3 tests/fuzz.py --print
.
Test case #0 (skipped: 0)
Traceback (most recent call last):
File "tests/fuzz.py", line 304, in <module>
fuzz(tests_dir, fuzz_arg, args.num, args.easy)
File "tests/fuzz.py", line 249, in fuzz
raise Exception("Test `{}` failed with exit code {}.".format(" ".join(args), proc.returncode))
Exception: Test `/home/s20223506/cs420-Homework/target/release/fuzz -p /home/s20223506/cs420-Homework/tests/test_polished.c` failed with exit code 101
When I then run python3 tests/fuzz.py --print --reduce
, I get the error mentioned above.
Hmm it's strange..
By "buggy input program", you mean
test_polished.c
afterpython3 tests/fuzz.py --print
has failed write?
Yes. If you can reproduce the error, then what is the output of cargo run --features=build-bin --release --bin fuzz -- -p test_polished.c
(on tests/
directory)? Fuzzer starts to reduce the code when the output contains assertion failed
. Otherwise, it returns the error which you got.
I get this
thread 'main' panicked at 'parse failed while parsing the output from implemented printer: ParseError(SyntaxError(SyntaxError { source: "# 1 \"/tmp/.tmp52xirw/temp.c\"\n# 1 \"<built-in>\"\n# 1 \"<command-line>\"\n# 31 \"<command-line>\"\n# 1 \"/usr/include/stdc-predef.h\" 1 3 4\n# 32 \"<command-line>\" 2\n# 1 \"/tmp/.tmp52xirw/temp.c\"\ntypedef unsigned char __u_char;\n\ntypedef unsigned short int __u_short;\n\ntypedef unsigned int __u_int;\n\ntypedef unsigned long int __u_long;\n\ntypedef __signed char __int8_t;\n\ntypedef unsigned char __uint8_t;\n\ntypedef __signed short int __int16_t;\n\ntypedef unsigned short int __uint16_t;\n\ntypedef __signed int __int32_t;\n\ntypedef unsigned int __uint32_t;\n\ntypedef __signed long int __int64_t;\n\ntypedef unsigned long int __uint64_t;\n\ntypedef __int8_t __int_least8_t;\n\ntypedef __uint8_t __uint_least8_t;\n\ntypedef __int16_t __int_least16_t;\n\ntypedef __uint16_t __uint_least16_t;\n\ntypedef __int32_t __int_least32_t;\n\ntypedef __uint32_t __uint_least32_t;\n\ntypedef __int64_t __int_least64_t;\n\ntypedef __uint64_t __uint_least64_t;\n\ntypedef long int __quad_t;\n\ntypedef unsigned long int __u_quad_t;\n\ntypedef long int __intmax_t;\n\ntypedef unsigned long int __uintmax_t;\n\ntypedef unsigned long int __dev_t;\n\ntypedef unsigned int __uid_t;\n\ntypedef unsigned int __gid_t;\n\ntypedef unsigned long int __ino_t;\n\ntypedef unsigned long int __ino64_t;\n\ntypedef unsigned int __mode_t;\n\ntypedef unsigned long int __nlink_t;\n\ntypedef long int __off_t;\n\ntypedef long int __off64_t;\n\ntypedef int __pid_t;\n\ntypedef struct {\n int __val[2];\n} __fsid_t;\n\ntypedef long int __clock_t;\n\ntypedef unsigned long int __rlim_t;\n\ntypedef unsigned long int __rlim64_t;\n\ntypedef unsigned int __id_t;\n\ntypedef long int __time_t;\n\ntypedef unsigned int __useconds_t;\n\ntypedef long int __suseconds_t;\n\ntypedef int __daddr_t;\n\ntypedef int __key_t;\n\ntypedef int __clockid_t;\n\ntypedef void * __timer_t;\n\ntypedef long int __blksize_t;\n\ntypedef long int __blkcnt_t;\n\ntypedef long int __blkcnt64_t;\n\ntypedef unsigned long int __fsblkcnt_t;\n\ntypedef unsigned long int __fsblkcnt64_t;\n\ntypedef unsigned long int __fsfilcnt_t;\n\ntypedef unsigned long int __fsfilcnt64_t;\n\ntypedef long int __fsword_t;\n\ntypedef long int __ssize_t;\n\ntypedef long int __syscall_slong_t;\n\ntypedef unsigned long int __syscall_ulong_t;\n\ntypedef __off64_t __loff_t;\n\ntypedef char * __caddr_t;\n\ntypedef long int __intptr_t;\n\ntypedef unsigned int __socklen_t;\n\ntypedef int __sig_atomic_t;\n\ntypedef float float_t;\n\ntypedef double double_t;\n\nint __fpclassify(double __value);\n\nint __signbit(double __value);\n\nint __isinf(double __value);\n\nint __finite(double __value);\n\nint __isnan(double __value);\n\nint __iseqsig(double __x, double __y);\n\nint __issignaling(double __value);\n\ndouble acos(double __x);\n\ndouble asin(double __x);\n\ndouble atan(double __x);\n\ndouble atan2(double __y, double __x);\n\ndouble cos(double __x);\n\ndouble sin(double __x);\n\ndouble tan(double __x);\n\ndouble cosh(double __x);\n\ndouble sinh(double __x);\n\ndouble tanh(double __x);\n\ndouble acosh(double __x);\n\ndouble asinh(double __x);\n\ndouble atanh(double __x);\n\ndouble exp(double __x);\n\ndouble frexp(double __x, int * __exponent);\n\ndouble ldexp(double __x, int __exponent);\n\ndouble log(double __x);\n\ndouble log10(double __x);\n\ndouble modf(double __x, double * __iptr);\n\ndouble expm1(double __x);\n\ndouble log1p(double __x);\n\ndouble logb(double __x);\n\ndouble exp2(double __x);\n\ndouble log2(double __x);\n\ndouble pow(double __x, double __y);\n\ndouble sqrt(double __x);\n\ndouble hypot(double __x, double __y);\n\ndouble cbrt(double __x);\n\ndouble ceil(double __x);\n\ndouble fabs(double __x);\n\ndouble floor(double __x);\n\ndouble fmod(double __x, double __y);\n\nint isinf(double __value);\n\nint finite(double __value);\n\ndouble drem(double __x, double __y);\n\ndouble significand(double __x);\n\ndouble copysign(double __x, double __y);\n\ndouble nan(const char * __tagb);\n\nint isnan(double __value);\n\ndouble j0(double);\n\ndouble j1(double);\n\ndouble jn(int, double);\n\ndouble y0(double);\n\ndouble y1(double);\n\ndouble yn(int, double);\n\ndouble erf(double);\n\ndouble erfc(double);\n\ndouble lgamma(double);\n\ndouble tgamma(double);\n\ndouble gamma(double);\n\ndouble lgamma_r(double, int * __signgamp);\n\ndouble rint(double __x);\n\ndouble nextafter(double __x, double __y);\n\ndouble nexttoward(double __x, double __y);\n\ndouble remainder(double __x, double __y);\n\ndouble scalbn(double __x, int __n);\n\nint ilogb(double __x);\n\ndouble scalbln(double __x, long int __n);\n\ndouble nearbyint(double __x);\n\ndouble round(double __x);\n\ndouble trunc(double __x);\n\ndouble remquo(double __x, double __y, int * __quo);\n\nlong int lrint(double __x);\n\nlong long int llrint(double __x);\n\nlong int lround(double __x);\n\nlong long int llround(double __x);\n\ndouble fdim(double __x, double __y);\n\ndouble fmax(double __x, double __y);\n\ndouble fmin(double __x, double __y);\n\ndouble fma(double __x, double __y, double __z);\n\ndouble scalb(double __x, double __n);\n\nint __fpclassifyf(float __value);\n\nint __signbitf(float __value);\n\nint __isinff(float __value);\n\nint __finitef(float __value);\n\nint __isnanf(float __value);\n\nint __iseqsigf(float __x, float __y);\n\nint __issignalingf(float __value);\n\nfloat acosf(float __x);\n\nfloat asinf(float __x);\n\nfloat atanf(float __x);\n\nfloat atan2f(float __y, float __x);\n\nfloat cosf(float __x);\n\nfloat sinf(float __x);\n\nfloat tanf(float __x);\n\nfloat coshf(float __x);\n\nfloat sinhf(float __x);\n\nfloat tanhf(float __x);\n\nfloat acoshf(float __x);\n\nfloat asinhf(float __x);\n\nfloat atanhf(float __x);\n\nfloat expf(float __x);\n\nfloat frexpf(float __x, int * __exponent);\n\nfloat ldexpf(float __x, int __exponent);\n\nfloat logf(float __x);\n\nfloat log10f(float __x);\n\nfloat modff(float __x, float * __iptr);\n\nfloat expm1f(float __x);\n\nfloat log1pf(float __x);\n\nfloat logbf(float __x);\n\nfloat exp2f(float __x);\n\nfloat log2f(float __x);\n\nfloat powf(float __x, float __y);\n\nfloat sqrtf(float __x);\n\nfloat hypotf(float __x, float __y);\n\nfloat cbrtf(float __x);\n\nfloat ceilf(float __x);\n\nfloat fabsf(float __x);\n\nfloat floorf(float __x);\n\nfloat fmodf(float __x, float __y);\n\nint isinff(float __value);\n\nint finitef(float __value);\n\nfloat dremf(float __x, float __y);\n\nfloat significandf(float __x);\n\nfloat copysignf(float __x, float __y);\n\nfloat nanf(const char * __tagb);\n\nint isnanf(float __value);\n\nfloat j0f(float);\n\nfloat j1f(float);\n\nfloat jnf(int, float);\n\nfloat y0f(float);\n\nfloat y1f(float);\n\nfloat ynf(int, float);\n\nfloat erff(float);\n\nfloat erfcf(float);\n\nfloat lgammaf(float);\n\nfloat tgammaf(float);\n\nfloat gammaf(float);\n\nfloat lgammaf_r(float, int * __signgamp);\n\nfloat rintf(float __x);\n\nfloat nextafterf(float __x, float __y);\n\nfloat nexttowardf(float __x, double __y);\n\nfloat remainderf(float __x, float __y);\n\nfloat scalbnf(float __x, int __n);\n\nint ilogbf(float __x);\n\nfloat scalblnf(float __x, long int __n);\n\nfloat nearbyintf(float __x);\n\nfloat roundf(float __x);\n\nfloat truncf(float __x);\n\nfloat remquof(float __x, float __y, int * __quo);\n\nlong int lrintf(float __x);\n\nlong long int llrintf(float __x);\n\nlong int lroundf(float __x);\n\nlong long int llroundf(float __x);\n\nfloat fdimf(float __x, float __y);\n\nfloat fmaxf(float __x, float __y);\n\nfloat fminf(float __x, float __y);\n\nfloat fmaf(float __x, float __y, float __z);\n\nfloat scalbf(float __x, float __n);\n\nint __fpclassifyl(double __value);\n\nint __signbitl(double __value);\n\nint __isinfl(double __value);\n\nint __finitel(double __value);\n\nint __isnanl(double __value);\n\nint __iseqsigl(double __x, double __y);\n\nint __issignalingl(double __value);\n\ndouble acosl(double __x);\n\ndouble asinl(double __x);\n\ndouble atanl(double __x);\n\ndouble atan2l(double __y, double __x);\n\ndouble cosl(double __x);\n\ndouble sinl(double __x);\n\ndouble tanl(double __x);\n\ndouble coshl(double __x);\n\ndouble sinhl(double __x);\n\ndouble tanhl(double __x);\n\ndouble acoshl(double __x);\n\ndouble asinhl(double __x);\n\ndouble atanhl(double __x);\n\ndouble expl(double __x);\n\ndouble frexpl(double __x, int * __exponent);\n\ndouble ldexpl(double __x, int __exponent);\n\ndouble logl(double __x);\n\ndouble log10l(double __x);\n\ndouble modfl(double __x, double * __iptr);\n\ndouble expm1l(double __x);\n\ndouble log1pl(double __x);\n\ndouble logbl(double __x);\n\ndouble exp2l(double __x);\n\ndouble log2l(double __x);\n\ndouble powl(double __x, double __y);\n\ndouble sqrtl(double __x);\n\ndouble hypotl(double __x, double __y);\n\ndouble cbrtl(double __x);\n\ndouble ceill(double __x);\n\ndouble fabsl(double __x);\n\ndouble floorl(double __x);\n\ndouble fmodl(double __x, double __y);\n\nint isinfl(double __value);\n\nint finitel(double __value);\n\ndouble dreml(double __x, double __y);\n\ndouble significandl(double __x);\n\ndouble copysignl(double __x, double __y);\n\ndouble nanl(const char * __tagb);\n\nint isnanl(double __value);\n\ndouble j0l(double);\n\ndouble j1l(double);\n\ndouble jnl(int, double);\n\ndouble y0l(double);\n\ndouble y1l(double);\n\ndouble ynl(int, double);\n\ndouble erfl(double);\n\ndouble erfcl(double);\n\ndouble lgammal(double);\n\ndouble tgammal(double);\n\ndouble gammal(double);\n\ndouble lgammal_r(double, int * __signgamp);\n\ndouble rintl(double __x);\n\ndouble nextafterl(double __x, double __y);\n\ndouble nexttowardl(double __x, double __y);\n\ndouble remainderl(double __x, double __y);\n\ndouble scalbnl(double __x, int __n);\n\nint ilogbl(double __x);\n\ndouble scalblnl(double __x, long int __n);\n\ndouble nearbyintl(double __x);\n\ndouble roundl(double __x);\n\ndouble truncl(double __x);\n\ndouble remquol(double __x, double __y, int * __quo);\n\nlong int lrintl(double __x);\n\nlong long int llrintl(double __x);\n\nlong int lroundl(double __x);\n\nlong long int llroundl(double __x);\n\ndouble fdiml(double __x, double __y);\n\ndouble fmaxl(double __x, double __y);\n\ndouble fminl(double __x, double __y);\n\ndouble fmal(double __x, double __y, double __z);\n\ndouble scalbl(double __x, double __n);\n\nint __fpclassifyf128(double __value);\n\nint __signbitf128(double __value);\n\nint __isinff128(double __value);\n\nint __finitef128(double __value);\n\nint __isnanf128(double __value);\n\nint __iseqsigf128(double __x, double __y);\n\nint __issignalingf128(double __value);\n\nint signgam;\n\ntypedef long unsigned int size_t;\n\nvoid * memcpy(void * __dest, const void * __src, size_t __n);\n\nvoid * memmove(void * __dest, const void * __src, size_t __n);\n\nvoid * memccpy(void * __dest, const void * __src, int __c, size_t __n);\n\nvoid * memset(void * __s, int __c, size_t __n);\n\nint memcmp(const void * __s1, const void * __s2, size_t __n);\n\nvoid * memchr(const void * __s, int __c, size_t __n);\n\nchar * strcpy(char * __dest, const char * __src);\n\nchar * strncpy(char * __dest, const char * __src, size_t __n);\n\nchar * strcat(char * __dest, const char * __src);\n\nchar * strncat(char * __dest, const char * __src, size_t __n);\n\nint strcmp(const char * __s1, const char * __s2);\n\nint strncmp(const char * __s1, const char * __s2, size_t __n);\n\nint strcoll(const char * __s1, const char * __s2);\n\nsize_t strxfrm(char * __dest, const char * __src, size_t __n);\n\nstruct __locale_struct {\n struct __locale_data * __locales[13];\n const unsigned short int * __ctype_b;\n const int * __ctype_tolower;\n const int * __ctype_toupper;\n const char * __names[13];\n} ;\n\ntypedef struct __locale_struct * __locale_t;\n\ntypedef __locale_t locale_t;\n\nint strcoll_l(const char * __s1, const char * __s2, locale_t __l);\n\nsize_t strxfrm_l(char * __dest, const char * __src, size_t __n, locale_t __l);\n\nchar * strdup(const char * __s);\n\nchar * strndup(const char * __string, size_t __n);\n\nchar * strchr(const char * __s, int __c);\n\nchar * strrchr(const char * __s, int __c);\n\nsize_t strcspn(const char * __s, const char * __reject);\n\nsize_t strspn(const char * __s, const char * __accept);\n\nchar * strpbrk(const char * __s, const char * __accept);\n\nchar * strstr(const char * __haystack, const char * __needle);\n\nchar * strtok(char * __s, const char * __delim);\n\nchar * __strtok_r(char * __s, const char * __delim, char * * __save_ptr);\n\nchar * strtok_r(char * __s, const char * __delim, char * * __save_ptr);\n\nsize_t strlen(const char * __s);\n\nsize_t strnlen(const char * __string, size_t __maxlen);\n\nchar * strerror(int __errnum);\n\nint strerror_r(int __errnum, char * __buf, size_t __buflen);\n\nchar * strerror_l(int __errnum, locale_t __l);\n\nint bcmp(const void * __s1, const void * __s2, size_t __n);\n\nvoid bcopy(const void * __src, void * __dest, size_t __n);\n\nvoid bzero(void * __s, size_t __n);\n\nchar * index(const char * __s, int __c);\n\nchar * rindex(const char * __s, int __c);\n\nint ffs(int __i);\n\nint ffsl(long int __l);\n\nint ffsll(long long int __ll);\n\nint strcasecmp(const char * __s1, const char * __s2);\n\nint strncasecmp(const char * __s1, const char * __s2, size_t __n);\n\nint strcasecmp_l(const char * __s1, const char * __s2, locale_t __loc);\n\nint strncasecmp_l(const char * __s1, const char * __s2, size_t __n, locale_t __loc);\n\nvoid explicit_bzero(void * __s, size_t __n);\n\nchar * strsep(char * * __stringp, const char * __delim);\n\nchar * strsignal(int __sig);\n\nchar * __stpcpy(char * __dest, const char * __src);\n\nchar * stpcpy(char * __dest, const char * __src);\n\nchar * __stpncpy(char * __dest, const char * __src, size_t __n);\n\nchar * stpncpy(char * __dest, const char * __src, size_t __n);\n\ntypedef __int8_t int8_t;\n\ntypedef __int16_t int16_t;\n\ntypedef __int32_t int32_t;\n\ntypedef __int64_t int64_t;\n\ntypedef __uint8_t uint8_t;\n\ntypedef __uint16_t uint16_t;\n\ntypedef __uint32_t uint32_t;\n\ntypedef __uint64_t uint64_t;\n\ntypedef __int_least8_t int_least8_t;\n\ntypedef __int_least16_t int_least16_t;\n\ntypedef __int_least32_t int_least32_t;\n\ntypedef __int_least64_t int_least64_t;\n\ntypedef __uint_least8_t uint_least8_t;\n\ntypedef __uint_least16_t uint_least16_t;\n\ntypedef __uint_least32_t uint_least32_t;\n\ntypedef __uint_least64_t uint_least64_t;\n\ntypedef __signed char int_fast8_t;\n\ntypedef long int int_fast16_t;\n\ntypedef long int int_fast32_t;\n\ntypedef long int int_fast64_t;\n\ntypedef unsigned char uint_fast8_t;\n\ntypedef unsigned long int uint_fast16_t;\n\ntypedef unsigned long int uint_fast32_t;\n\ntypedef unsigned long int uint_fast64_t;\n\ntypedef long int intptr_t;\n\ntypedef unsigned long int uintptr_t;\n\ntypedef __intmax_t intmax_t;\n\ntypedef __uintmax_t uintmax_t;\n\nvoid __assert_fail(const char * __assertion, const char * __file, unsigned int __line, const char * __function);\n\nvoid __assert_perror_fail(int __errnum, const char * __file, unsigned int __line, const char * __function);\n\nvoid __assert(const char * __assertion, const char * __file, int __line);\n\ntypedef struct {\n int __count;\n struct {\n unsigned int __wch;\n char __wchb[4];\n} __value;\n} __mbstate_t;\n\ntypedef struct _G_fpos_t {\n __off_t __pos;\n __mbstate_t __state;\n} __fpos_t;\n\ntypedef struct _G_fpos64_t {\n __off64_t __pos;\n __mbstate_t __state;\n} __fpos64_t;\n\nstruct _IO_FILE ;\n\ntypedef struct _IO_FILE __FILE;\n\nstruct _IO_FILE ;\n\ntypedef struct _IO_FILE FILE;\n\nstruct _IO_FILE ;\n\nstruct _IO_marker ;\n\nstruct _IO_codecvt ;\n\nstruct _IO_wide_data ;\n\ntypedef void _IO_lock_t;\n\nstruct _IO_FILE {\n int _flags;\n char * _IO_read_ptr;\n char * _IO_read_end;\n char * _IO_read_base;\n char * _IO_write_base;\n char * _IO_write_ptr;\n char * _IO_write_end;\n char * _IO_buf_base;\n char * _IO_buf_end;\n char * _IO_save_base;\n char * _IO_backup_base;\n char * _IO_save_end;\n struct _IO_marker * _markers;\n struct _IO_FILE * _chain;\n int _fileno;\n int _flags2;\n __off_t _old_offset;\n unsigned short _cur_column;\n __signed char _vtable_offset;\n char _shortbuf[1];\n _IO_lock_t * _lock;\n __off64_t _offset;\n struct _IO_codecvt * _codecvt;\n struct _IO_wide_data * _wide_data;\n struct _IO_FILE * _freeres_list;\n void * _freeres_buf;\n size_t __pad5;\n int _mode;\n char _unused2[10];\n} ;\n\ntypedef __off_t off_t;\n\ntypedef __ssize_t ssize_t;\n\ntypedef __fpos_t fpos_t;\n\nFILE * stdin;\n\nFILE * stdout;\n\nFILE * stderr;\n\nint remove(const char * __filename);\n\nint rename(const char * __old, const char * __new);\n\nint renameat(int __oldfd, const char * __old, int __newfd, const char * __new);\n\nFILE * tmpfile(void);\n\nchar * tmpnam(char * __s);\n\nchar * tmpnam_r(char * __s);\n\nchar * tempnam(const char * __dir, const char * __pfx);\n\nint fclose(FILE * __stream);\n\nint fflush(FILE * __stream);\n\nint fflush_unlocked(FILE * __stream);\n\nFILE * fopen(const char * __filename, const char * __modes);\n\nFILE * freopen(const char * __filename, const char * __modes, FILE * __stream);\n\nFILE * fdopen(int __fd, const char * __modes);\n\nFILE * fmemopen(void * __s, size_t __len, const char * __modes);\n\nFILE * open_memstream(char * * __bufloc, size_t * __sizeloc);\n\nvoid setbuf(FILE * __stream, char * __buf);\n\nint setvbuf(FILE * __stream, char * __buf, int __modes, size_t __n);\n\nvoid setbuffer(FILE * __stream, char * __buf, size_t __size);\n\nvoid setlinebuf(FILE * __stream);\n\nint fgetc(FILE * __stream);\n\nint getc(FILE * __stream);\n\nint getchar(void);\n\nint getc_unlocked(FILE * __stream);\n\nint getchar_unlocked(void);\n\nint fgetc_unlocked(FILE * __stream);\n\nint fputc(int __c, FILE * __stream);\n\nint putc(int __c, FILE * __stream);\n\nint putchar(int __c);\n\nint fputc_unlocked(int __c, FILE * __stream);\n\nint putc_unlocked(int __c, FILE * __stream);\n\nint putchar_unlocked(int __c);\n\nint getw(FILE * __stream);\n\nint putw(int __w, FILE * __stream);\n\nchar * fgets(char * __s, int __n, FILE * __stream);\n\n__ssize_t __getdelim(char * * __lineptr, size_t * __n, int __delimiter, FILE * __stream);\n\n__ssize_t getdelim(char * * __lineptr, size_t * __n, int __delimiter, FILE * __stream);\n\n__ssize_t getline(char * * __lineptr, size_t * __n, FILE * __stream);\n\nint fputs(const char * __s, FILE * __stream);\n\nint puts(const char * __s);\n\nint ungetc(int __c, FILE * __stream);\n\nsize_t fread(void * __ptr, size_t __size, size_t __n, FILE * __stream);\n\nsize_t fwrite(const void * __ptr, size_t __size, size_t __n, FILE * __s);\n\nsize_t fread_unlocked(void * __ptr, size_t __size, size_t __n, FILE * __stream);\n\nsize_t fwrite_unlocked(const void * __ptr, size_t __size, size_t __n, FILE * __stream);\n\nint fseek(FILE * __stream, long int __off, int __whence);\n\nlong int ftell(FILE * __stream);\n\nvoid rewind(FILE * __stream);\n\nint fseeko(FILE * __stream, __off_t __off, int __whence);\n\n__off_t ftello(FILE * __stream);\n\nint fgetpos(FILE * __stream, fpos_t * __pos);\n\nint fsetpos(FILE * __stream, const fpos_t * __pos);\n\nvoid clearerr(FILE * __stream);\n\nint feof(FILE * __stream);\n\nint ferror(FILE * __stream);\n\nvoid clearerr_unlocked(FILE * __stream);\n\nint feof_unlocked(FILE * __stream);\n\nint ferror_unlocked(FILE * __stream);\n\nvoid perror(const char * __s);\n\nint sys_nerr;\n\nint fileno(FILE * __stream);\n\nint fileno_unlocked(FILE * __stream);\n\nFILE * popen(const char * __command, const char * __modes);\n\nint pclose(FILE * __stream);\n\nchar * ctermid(char * __s);\n\nvoid flockfile(FILE * __stream);\n\nint ftrylockfile(FILE * __stream);\n\nvoid funlockfile(FILE * __stream);\n\nint __uflow(FILE * );\n\nint __overflow(FILE * , int);\n\nvoid platform_main_begin(void) {\n}\n\nvoid platform_main_end(uint32_t crc, int flag) {\n}\n\nint8_t ( safe_unary_minus_func_int8_t_s)(int8_t si) {\n return (-(si));\n}\n\nint8_t ( safe_add_func_int8_t_s_s)(int8_t si1, int8_t si2) {\n return (((si1) + (si2)));\n}\n\nint8_t ( safe_sub_func_int8_t_s_s)(int8_t si1, int8_t si2) {\n return (((si1) - (si2)));\n}\n\nint8_t ( safe_mul_func_int8_t_s_s)(int8_t si1, int8_t si2) {\n return (((si1) * (si2)));\n}\n\nint8_t ( safe_mod_func_int8_t_s_s)(int8_t si1, int8_t si2) {\n return (((((((si2) == (0))) || (((((si1) == (-(128)))) && (((si2) == (-(1)))))))) ? (si1) : (((si1) % (si2)))));\n}\n\nint8_t ( safe_div_func_int8_t_s_s)(int8_t si1, int8_t si2) {\n return (((((((si2) == (0))) || (((((si1) == (-(128)))) && (((si2) == (-(1)))))))) ? (si1) : (((si1) / (si2)))));\n}\n\nint8_t ( safe_lshift_func_int8_t_s_s)(int8_t left, int right) {\n return (((((((((((left) < (0))) || ((((int) (right)) < (0))))) || ((((int) (right)) >= (32))))) || (((left) > (((127) >> ((int) (right)))))))) ? (left) : (((left) << ((int) (right))))));\n}\n\nint8_t ( safe_lshift_func_int8_t_s_u)(int8_t left, unsigned int right) {\n return (((((((((left) < (0))) || ((((unsigned int) (right)) >= (32))))) || (((left) > (((127) >> ((unsigned int) (right)))))))) ? (left) : (((left) << ((unsigned int) (right))))));\n}\n\nint8_t ( safe_rshift_func_int8_t_s_s)(int8_t left, int right) {\n return (((((((((left) < (0))) || ((((int) (right)) < (0))))) || ((((int) (right)) >= (32))))) ? (left) : (((left) >> ((int) (right))))));\n}\n\nint8_t ( safe_rshift_func_int8_t_s_u)(int8_t left, unsigned int right) {\n return (((((((left) < (0))) || ((((unsigned int) (right)) >= (32))))) ? (left) : (((left) >> ((unsigned int) (right))))));\n}\n\nint16_t ( safe_unary_minus_func_int16_t_s)(int16_t si) {\n return (-(si));\n}\n\nint16_t ( safe_add_func_int16_t_s_s)(int16_t si1, int16_t si2) {\n return (((si1) + (si2)));\n}\n\nint16_t ( safe_sub_func_int16_t_s_s)(int16_t si1, int16_t si2) {\n return (((si1) - (si2)));\n}\n\nint16_t ( safe_mul_func_int16_t_s_s)(int16_t si1, int16_t si2) {\n return (((si1) * (si2)));\n}\n\nint16_t ( safe_mod_func_int16_t_s_s)(int16_t si1, int16_t si2) {\n return (((((((si2) == (0))) || (((((si1) == (((-(32767)) - (1))))) && (((si2) == (-(1)))))))) ? (si1) : (((si1) % (si2)))));\n}\n\nint16_t ( safe_div_func_int16_t_s_s)(int16_t si1, int16_t si2) {\n return (((((((si2) == (0))) || (((((si1) == (((-(32767)) - (1))))) && (((si2) == (-(1)))))))) ? (si1) : (((si1) / (si2)))));\n}\n\nint16_t ( safe_lshift_func_int16_t_s_s)(int16_t left, int right) {\n return (((((((((((left) < (0))) || ((((int) (right)) < (0))))) || ((((int) (right)) >= (32))))) || (((left) > (((32767) >> ((int) (right)))))))) ? (left) : (((left) << ((int) (right))))));\n}\n\nint16_t ( safe_lshift_func_int16_t_s_u)(int16_t left, unsigned int right) {\n return (((((((((left) < (0))) || ((((unsigned int) (right)) >= (32))))) || (((left) > (((32767) >> ((unsigned int) (right)))))))) ? (left) : (((left) << ((unsigned int) (right))))));\n}\n\nint16_t ( safe_rshift_func_int16_t_s_s)(int16_t left, int right) {\n return (((((((((left) < (0))) || ((((int) (right)) < (0))))) || ((((int) (right)) >= (32))))) ? (left) : (((left) >> ((int) (right))))));\n}\n\nint16_t ( safe_rshift_func_int16_t_s_u)(int16_t left, unsigned int right) {\n return (((((((left) < (0))) || ((((unsigned int) (right)) >= (32))))) ? (left) : (((left) >> ((unsigned int) (right))))));\n}\n\nint32_t ( safe_unary_minus_func_int32_t_s)(int32_t si) {\n return (((((si) == (((-(2147483647)) - (1))))) ? (si) : (-(si))));\n}\n\nint32_t ( safe_add_func_int32_t_s_s)(int32_t si1, int32_t si2) {\n return (((((((((((si1) > (0))) && (((si2) > (0))))) && (((si1) > (((2147483647) - (si2))))))) || (((((((si1) < (0))) && (((si2) < (0))))) && (((si1) < (((((-(2147483647)) - (1))) - (si2))))))))) ? (si1) : (((si1) + (si2)))));\n}\n\nint32_t ( safe_sub_func_int32_t_s_s)(int32_t si1, int32_t si2) {\n return (((((((((si1) ^ (si2))) & (((((((si1) ^ (((((si1) ^ (si2))) & (~(2147483647)))))) - (si2))) ^ (si2))))) < (0))) ? (si1) : (((si1) - (si2)))));\n}\n\nint32_t ( safe_mul_func_int32_t_s_s)(int32_t si1, int32_t si2) {\n return (((((((((((((((si1) > (0))) && (((si2) > (0))))) && (((si1) > (((2147483647) / (si2))))))) || (((((((si1) > (0))) && (((si2) <= (0))))) && (((si2) < (((((-(2147483647)) - (1))) / (si1))))))))) || (((((((si1) <= (0))) && (((si2) > (0))))) && (((si1) < (((((-(2147483647)) - (1))) / (si2))))))))) || (((((((((si1) <= (0))) && (((si2) <= (0))))) && (((si1) != (0))))) && (((si2) < (((2147483647) / (si1))))))))) ? (si1) : (((si1) * (si2)))));\n}\n\nint32_t ( safe_mod_func_int32_t_s_s)(int32_t si1, int32_t si2) {\n return (((((((si2) == (0))) || (((((si1) == (((-(2147483647)) - (1))))) && (((si2) == (-(1)))))))) ? (si1) : (((si1) % (si2)))));\n}\n\nint32_t ( safe_div_func_int32_t_s_s)(int32_t si1, int32_t si2) {\n return (((((((si2) == (0))) || (((((si1) == (((-(2147483647)) - (1))))) && (((si2) == (-(1)))))))) ? (si1) : (((si1) / (si2)))));\n}\n\nint32_t ( safe_lshift_func_int32_t_s_s)(int32_t left, int right) {\n return (((((((((((left) < (0))) || ((((int) (right)) < (0))))) || ((((int) (right)) >= (32))))) || (((left) > (((2147483647) >> ((int) (right)))))))) ? (left) : (((left) << ((int) (right))))));\n}\n\nint32_t ( safe_lshift_func_int32_t_s_u)(int32_t left, unsigned int right) {\n return (((((((((left) < (0))) || ((((unsigned int) (right)) >= (32))))) || (((left) > (((2147483647) >> ((unsigned int) (right)))))))) ? (left) : (((left) << ((unsigned int) (right))))));\n}\n\nint32_t ( safe_rshift_func_int32_t_s_s)(int32_t left, int right) {\n return (((((((((left) < (0))) || ((((int) (right)) < (0))))) || ((((int) (right)) >= (32))))) ? (left) : (((left) >> ((int) (right))))));\n}\n\nint32_t ( safe_rshift_func_int32_t_s_u)(int32_t left, unsigned int right) {\n return (((((((left) < (0))) || ((((unsigned int) (right)) >= (32))))) ? (left) : (((left) >> ((unsigned int) (right))))));\n}\n\nint64_t ( safe_unary_minus_func_int64_t_s)(int64_t si) {\n return (((((si) == (((-(9223372036854775807L)) - (1))))) ? (si) : (-(si))));\n}\n\nint64_t ( safe_add_func_int64_t_s_s)(int64_t si1, int64_t si2) {\n return (((((((((((si1) > (0))) && (((si2) > (0))))) && (((si1) > (((9223372036854775807L) - (si2))))))) || (((((((si1) < (0))) && (((si2) < (0))))) && (((si1) < (((((-(9223372036854775807L)) - (1))) - (si2))))))))) ? (si1) : (((si1) + (si2)))));\n}\n\nint64_t ( safe_sub_func_int64_t_s_s)(int64_t si1, int64_t si2) {\n return (((((((((si1) ^ (si2))) & (((((((si1) ^ (((((si1) ^ (si2))) & (~(9223372036854775807L)))))) - (si2))) ^ (si2))))) < (0))) ? (si1) : (((si1) - (si2)))));\n}\n\nint64_t ( safe_mul_func_int64_t_s_s)(int64_t si1, int64_t si2) {\n return (((((((((((((((si1) > (0))) && (((si2) > (0))))) && (((si1) > (((9223372036854775807L) / (si2))))))) || (((((((si1) > (0))) && (((si2) <= (0))))) && (((si2) < (((((-(9223372036854775807L)) - (1))) / (si1))))))))) || (((((((si1) <= (0))) && (((si2) > (0))))) && (((si1) < (((((-(9223372036854775807L)) - (1))) / (si2))))))))) || (((((((((si1) <= (0))) && (((si2) <= (0))))) && (((si1) != (0))))) && (((si2) < (((9223372036854775807L) / (si1))))))))) ? (si1) : (((si1) * (si2)))));\n}\n\nint64_t ( safe_mod_func_int64_t_s_s)(int64_t si1, int64_t si2) {\n return (((((((si2) == (0))) || (((((si1) == (((-(9223372036854775807L)) - (1))))) && (((si2) == (-(1)))))))) ? (si1) : (((si1) % (si2)))));\n}\n\nint64_t ( safe_div_func_int64_t_s_s)(int64_t si1, int64_t si2) {\n return (((((((si2) == (0))) || (((((si1) == (((-(9223372036854775807L)) - (1))))) && (((si2) == (-(1)))))))) ? (si1) : (((si1) / (si2)))));\n}\n\nint64_t ( safe_lshift_func_int64_t_s_s)(int64_t left, int right) {\n return (((((((((((left) < (0))) || ((((int) (right)) < (0))))) || ((((int) (right)) >= (32))))) || (((left) > (((9223372036854775807L) >> ((int) (right)))))))) ? (left) : (((left) << ((int) (right))))));\n}\n\nint64_t ( safe_lshift_func_int64_t_s_u)(int64_t left, unsigned int right) {\n return (((((((((left) < (0))) || ((((unsigned int) (right)) >= (32))))) || (((left) > (((9223372036854775807L) >> ((unsigned int) (right)))))))) ? (left) : (((left) << ((unsigned int) (right))))));\n}\n\nint64_t ( safe_rshift_func_int64_t_s_s)(int64_t left, int right) {\n return (((((((((left) < (0))) || ((((int) (right)) < (0))))) || ((((int) (right)) >= (32))))) ? (left) : (((left) >> ((int) (right))))));\n}\n\nint64_t ( safe_rshift_func_int64_t_s_u)(int64_t left, unsigned int right) {\n return (((((((left) < (0))) || ((((unsigned int) (right)) >= (32))))) ? (left) : (((left) >> ((unsigned int) (right))))));\n}\n\nuint8_t ( safe_unary_minus_func_uint8_t_u)(uint8_t ui) {\n return (-(ui));\n}\n\nuint8_t ( safe_add_func_uint8_t_u_u)(uint8_t ui1, uint8_t ui2) {\n return (((ui1) + (ui2)));\n}\n\nuint8_t ( safe_sub_func_uint8_t_u_u)(uint8_t ui1, uint8_t ui2) {\n return (((ui1) - (ui2)));\n}\n\nuint8_t ( safe_mul_func_uint8_t_u_u)(uint8_t ui1, uint8_t ui2) {\n return ((((unsigned int) (ui1)) * ((unsigned int) (ui2))));\n}\n\nuint8_t ( safe_mod_func_uint8_t_u_u)(uint8_t ui1, uint8_t ui2) {\n return (((((ui2) == (0))) ? (ui1) : (((ui1) % (ui2)))));\n}\n\nuint8_t ( safe_div_func_uint8_t_u_u)(uint8_t ui1, uint8_t ui2) {\n return (((((ui2) == (0))) ? (ui1) : (((ui1) / (ui2)))));\n}\n\nuint8_t ( safe_lshift_func_uint8_t_u_s)(uint8_t left, int right) {\n return ((((((((((int) (right)) < (0))) || ((((int) (right)) >= (32))))) || (((left) > (((255) >> ((int) (right)))))))) ? (left) : (((left) << ((int) (right))))));\n}\n\nuint8_t ( safe_lshift_func_uint8_t_u_u)(uint8_t left, unsigned int right) {\n return ((((((((unsigned int) (right)) >= (32))) || (((left) > (((255) >> ((unsigned int) (right)))))))) ? (left) : (((left) << ((unsigned int) (right))))));\n}\n\nuint8_t ( safe_rshift_func_uint8_t_u_s)(uint8_t left, int right) {\n return ((((((((int) (right)) < (0))) || ((((int) (right)) >= (32))))) ? (left) : (((left) >> ((int) (right))))));\n}\n\nuint8_t ( safe_rshift_func_uint8_t_u_u)(uint8_t left, unsigned int right) {\n return ((((((unsigned int) (right)) >= (32))) ? (left) : (((left) >> ((unsigned int) (right))))));\n}\n\nuint16_t ( safe_unary_minus_func_uint16_t_u)(uint16_t ui) {\n return (-(ui));\n}\n\nuint16_t ( safe_add_func_uint16_t_u_u)(uint16_t ui1, uint16_t ui2) {\n return (((ui1) + (ui2)));\n}\n\nuint16_t ( safe_sub_func_uint16_t_u_u)(uint16_t ui1, uint16_t ui2) {\n return (((ui1) - (ui2)));\n}\n\nuint16_t ( safe_mul_func_uint16_t_u_u)(uint16_t ui1, uint16_t ui2) {\n return ((((unsigned int) (ui1)) * ((unsigned int) (ui2))));\n}\n\nuint16_t ( safe_mod_func_uint16_t_u_u)(uint16_t ui1, uint16_t ui2) {\n return (((((ui2) == (0))) ? (ui1) : (((ui1) % (ui2)))));\n}\n\nuint16_t ( safe_div_func_uint16_t_u_u)(uint16_t ui1, uint16_t ui2) {\n return (((((ui2) == (0))) ? (ui1) : (((ui1) / (ui2)))));\n}\n\nuint16_t ( safe_lshift_func_uint16_t_u_s)(uint16_t left, int right) {\n return ((((((((((int) (right)) < (0))) || ((((int) (right)) >= (32))))) || (((left) > (((65535) >> ((int) (right)))))))) ? (left) : (((left) << ((int) (right))))));\n}\n\nuint16_t ( safe_lshift_func_uint16_t_u_u)(uint16_t left, unsigned int right) {\n return ((((((((unsigned int) (right)) >= (32))) || (((left) > (((65535) >> ((unsigned int) (right)))))))) ? (left) : (((left) << ((unsigned int) (right))))));\n}\n\nuint16_t ( safe_rshift_func_uint16_t_u_s)(uint16_t left, int right) {\n return ((((((((int) (right)) < (0))) || ((((int) (right)) >= (32))))) ? (left) : (((left) >> ((int) (right))))));\n}\n\nuint16_t ( safe_rshift_func_uint16_t_u_u)(uint16_t left, unsigned int right) {\n return ((((((unsigned int) (right)) >= (32))) ? (left) : (((left) >> ((unsigned int) (right))))));\n}\n\nuint32_t ( safe_unary_minus_func_uint32_t_u)(uint32_t ui) {\n return (-(ui));\n}\n\nuint32_t ( safe_add_func_uint32_t_u_u)(uint32_t ui1, uint32_t ui2) {\n return (((ui1) + (ui2)));\n}\n\nuint32_t ( safe_sub_func_uint32_t_u_u)(uint32_t ui1, uint32_t ui2) {\n return (((ui1) - (ui2)));\n}\n\nuint32_t ( safe_mul_func_uint32_t_u_u)(uint32_t ui1, uint32_t ui2) {\n return ((((unsigned int) (ui1)) * ((unsigned int) (ui2))));\n}\n\nuint32_t ( safe_mod_func_uint32_t_u_u)(uint32_t ui1, uint32_t ui2) {\n return (((((ui2) == (0))) ? (ui1) : (((ui1) % (ui2)))));\n}\n\nuint32_t ( safe_div_func_uint32_t_u_u)(uint32_t ui1, uint32_t ui2) {\n return (((((ui2) == (0))) ? (ui1) : (((ui1) / (ui2)))));\n}\n\nuint32_t ( safe_lshift_func_uint32_t_u_s)(uint32_t left, int right) {\n return ((((((((((int) (right)) < (0))) || ((((int) (right)) >= (32))))) || (((left) > (((4294967295U) >> ((int) (right)))))))) ? (left) : (((left) << ((int) (right))))));\n}\n\nuint32_t ( safe_lshift_func_uint32_t_u_u)(uint32_t left, unsigned int right) {\n return ((((((((unsigned int) (right)) >= (32))) || (((left) > (((4294967295U) >> ((unsigned int) (right)))))))) ? (left) : (((left) << ((unsigned int) (right))))));\n}\n\nuint32_t ( safe_rshift_func_uint32_t_u_s)(uint32_t left, int right) {\n return ((((((((int) (right)) < (0))) || ((((int) (right)) >= (32))))) ? (left) : (((left) >> ((int) (right))))));\n}\n\nuint32_t ( safe_rshift_func_uint32_t_u_u)(uint32_t left, unsigned int right) {\n return ((((((unsigned int) (right)) >= (32))) ? (left) : (((left) >> ((unsigned int) (right))))));\n}\n\nuint64_t ( safe_unary_minus_func_uint64_t_u)(uint64_t ui) {\n return (-(ui));\n}\n\nuint64_t ( safe_add_func_uint64_t_u_u)(uint64_t ui1, uint64_t ui2) {\n return (((ui1) + (ui2)));\n}\n\nuint64_t ( safe_sub_func_uint64_t_u_u)(uint64_t ui1, uint64_t ui2) {\n return (((ui1) - (ui2)));\n}\n\nuint64_t ( safe_mul_func_uint64_t_u_u)(uint64_t ui1, uint64_t ui2) {\n return ((((unsigned long long) (ui1)) * ((unsigned long long) (ui2))));\n}\n\nuint64_t ( safe_mod_func_uint64_t_u_u)(uint64_t ui1, uint64_t ui2) {\n return (((((ui2) == (0))) ? (ui1) : (((ui1) % (ui2)))));\n}\n\nuint64_t ( safe_div_func_uint64_t_u_u)(uint64_t ui1, uint64_t ui2) {\n return (((((ui2) == (0))) ? (ui1) : (((ui1) / (ui2)))));\n}\n\nuint64_t ( safe_lshift_func_uint64_t_u_s)(uint64_t left, int right) {\n return ((((((((((int) (right)) < (0))) || ((((int) (right)) >= (32))))) || (((left) > (((18446744073709551615UL) >> ((int) (right)))))))) ? (left) : (((left) << ((int) (right))))));\n}\n\nuint64_t ( safe_lshift_func_uint64_t_u_u)(uint64_t left, unsigned int right) {\n return ((((((((unsigned int) (right)) >= (32))) || (((left) > (((18446744073709551615UL) >> ((unsigned int) (right)))))))) ? (left) : (((left) << ((unsigned int) (right))))));\n}\n\nuint64_t ( safe_rshift_func_uint64_t_u_s)(uint64_t left, int right) {\n return ((((((((int) (right)) < (0))) || ((((int) (right)) >= (32))))) ? (left) : (((left) >> ((int) (right))))));\n}\n\nuint64_t ( safe_rshift_func_uint64_t_u_u)(uint64_t left, unsigned int right) {\n return ((((((unsigned int) (right)) >= (32))) ? (left) : (((left) >> ((unsigned int) (right))))));\n}\n\nfloat ( safe_add_func_float_f_f)(float sf1, float sf2) {\n return (((((((((0.5f) * (sf1))) + (((0.5f) * (sf2))))) > (((0.5f) * (3.40282346638528859811704183484516925e+38f))))) ? (sf1) : (((sf1) + (sf2)))));\n}\n\nfloat ( safe_sub_func_float_f_f)(float sf1, float sf2) {\n return (((((((((0.5f) * (sf1))) - (((0.5f) * (sf2))))) > (((0.5f) * (3.40282346638528859811704183484516925e+38f))))) ? (sf1) : (((sf1) - (sf2)))));\n}\n\nfloat ( safe_mul_func_float_f_f)(float sf1, float sf2) {\n return (((((((((1.0p-100f) * (sf1))) * (((1.0p-28f) * (sf2))))) > (((1.0p-100f) * (((1.0p-28f) * (3.40282346638528859811704183484516925e+38f))))))) ? (sf1) : (((sf1) * (sf2)))));\n}\n\nfloat ( safe_div_func_float_f_f)(float sf1, float sf2) {\n return (((((((sf2) < (1.0f))) && (((((sf2) == (0.0f))) || (((((((1.0p-49f) * (sf1))) / (((1.0p100f) * (sf2))))) > (((1.0p-100f) * (((1.0p-49f) * (3.40282346638528859811704183484516925e+38f))))))))))) ? (sf1) : (((sf1) / (sf2)))));\n}\n\ndouble ( safe_add_func_double_f_f)(double sf1, double sf2) {\n return (((((fabs(((((0.5) * (sf1))) + (((0.5) * (sf2)))))) > (((0.5) * ((double) (1.79769313486231570814527423731704357e+308)))))) ? (sf1) : (((sf1) + (sf2)))));\n}\n\ndouble ( safe_sub_func_double_f_f)(double sf1, double sf2) {\n return (((((fabs(((((0.5) * (sf1))) - (((0.5) * (sf2)))))) > (((0.5) * ((double) (1.79769313486231570814527423731704357e+308)))))) ? (sf1) : (((sf1) - (sf2)))));\n}\n\ndouble ( safe_mul_func_double_f_f)(double sf1, double sf2) {\n return (((((fabs(((((1.0p-100) * (sf1))) * (((1.0p-924) * (sf2)))))) > (((1.0p-100) * (((1.0p-924) * ((double) (1.79769313486231570814527423731704357e+308)))))))) ? (sf1) : (((sf1) * (sf2)))));\n}\n\ndouble ( safe_div_func_double_f_f)(double sf1, double sf2) {\n return (((((((fabs(sf2)) < (1.0))) && (((((sf2) == (0.0))) || (((fabs(((((1.0p-974) * (sf1))) / (((1.0p100) * (sf2)))))) > (((1.0p-100) * (((1.0p-974) * ((double) (1.79769313486231570814527423731704357e+308)))))))))))) ? (sf1) : (((sf1) / (sf2)))));\n}\n\nint32_t ( safe_convert_func_float_to_int32_t)(float sf1) {\n return (((((((sf1) <= (((-(2147483647)) - (1))))) || (((sf1) >= (2147483647))))) ? (2147483647) : ((int32_t) (sf1))));\n}\n\nuint32_t crc32_tab[256];\n\nuint32_t crc32_context = 0xFFFFFFFFUL;\n\nvoid crc32_gentab(void) {\n uint32_t crc;\n const uint32_t poly = 0xEDB88320UL;\n int i, j;\n for (((i) = (0)); ((i) < (256)); (i)++) {\n ((crc) = (i));\n for (((j) = (8)); ((j) > (0)); (j)--) {\n if (((crc) & (1))) {\n ((crc) = (((((crc) >> (1))) ^ (poly))));\n } else {\n ((crc) >>= (1));\n }\n }\n (((crc32_tab)[(i)]) = (crc));\n }\n}\n\nvoid crc32_byte(uint8_t b) {\n ((crc32_context) = (((((((crc32_context) >> (8))) & (0x00FFFFFF))) ^ ((crc32_tab)[(((((crc32_context) ^ (b))) & (0xFF)))]))));\n}\n\nvoid crc32_8bytes(uint64_t val) {\n crc32_byte(((((val) >> (0))) & (0xff)));\n crc32_byte(((((val) >> (8))) & (0xff)));\n crc32_byte(((((val) >> (16))) & (0xff)));\n crc32_byte(((((val) >> (24))) & (0xff)));\n crc32_byte(((((val) >> (32))) & (0xff)));\n crc32_byte(((((val) >> (40))) & (0xff)));\n crc32_byte(((((val) >> (48))) & (0xff)));\n crc32_byte(((((val) >> (56))) & (0xff)));\n}\n\nvoid transparent_crc(uint64_t val, int flag) {\n crc32_8bytes(val);\n if (flag) {\n }\n}\n\nvoid transparent_crc_bytes(char * ptr, int nbytes, int flag) {\n int i;\n for (((i) = (0)); ((i) < (nbytes)); (i)++) {\n crc32_byte((ptr)[(i)]);\n }\n if (flag) {\n }\n}\n\nuint32_t func_1(void);\n\nuint32_t func_1(void) {\n int32_t l_2 = 0xE91A049FL;\n return (l_2);\n}\n\nint main(void) {\n int print_hash_value = 0;\n platform_main_begin();\n crc32_gentab();\n func_1();\n platform_main_end(((crc32_context) ^ (0xFFFFFFFFUL)),print_hash_value);\n return ((unsigned char) (crc32_context));\n}\n", line: 1353, column: 22, offset: 33849, expected: {"->", "^", "==", "<<", "<<=", ".", "&&", "++", ">", "^=", "<=", "||", "-", "[", ">=", ">>=", "%=", "-=", "*", "/", "--", "?", "[0-9]", ")", "<", "*=", "&=", "|", "+", "%", ">>", "=", "/=", "|=", "!=", "&", ",", "(", "[eE]", "+="} }))', src/tests.rs:91:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I also get test_reduced.c
, but it is the same as test_polished
.
We fixed reduce criteria for fuzzer. (https://github.com/kaist-cp/kecc-public/commit/bce209c613e432430866a7500fda35ac27e1e055)
Could you check if there is still an error?
There is no error now, but the reduced result is meaningless
test_reduced.c
struct {
} main() {
}
Does your implementation generate correct C code for test_reduced.c
?
(Check cargo run --features=build-bin --release --bin fuzz -- -p test_reduced.c
)
If so, please send your src/c/write_c.rs
to minseong.jang@kaist.ac.kr for more debugging.
A new trial of reduction does not even produce parseable code
void(a)() { ; }
void main() {}
I sent you my (1) test_reduced.c
, (2) test_polished.c
, (3) write_c.rs
, and (4) reduce-criteria.sh
of this trial.
However, doesn't the make the fuzzer not do the intended purpose, which is "reduce the polished program to a smaller one with the same error", as the reduced program does not detect the error that the polished does?
Yes, I think that's one of the limitations of the current fuzzer because we do not have a logic to determine two errors are the same error. One workaround that I recommend is doing "generate test_reduced.c
and resolve the error" repeatedly until there is no error in test_polished.c
. I believe this will resolve all errors that occurred in test_polished.c
..
Ah ok, thank you! I think I understand more about the fuzzer.
I am trying to fuzz on homework 1, but cannot reduce with the given instructions.
First, I tried
Which worked fine. Then, I tried
Which resulted in the following error
It seems some stuff are not installed on the server. Is there anything I can do here?