diff options
67 files changed, 3439 insertions, 651 deletions
@@ -124,5 +124,6 @@ a license to everyone to use it as detailed in LICENSE.) * jonas echterhoff <jonas@unity3d.com> * Sami Vaarala <sami.vaarala@iki.fi> * Jack A. Arrington <jack@epicpineapple.com> - - +* Richard Janicek <r@janicek.co> +* Joel Croteau <jcroteau@gmail.com> +* Haneef Mubarak <haneef503@gmail.com> @@ -13,7 +13,7 @@ The full text of both licenses follows. ============================================================================== -Copyright (c) 2010-2011 Emscripten authors, see AUTHORS file. +Copyright (c) 2010-2014 Emscripten authors, see AUTHORS file. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -35,7 +35,7 @@ THE SOFTWARE. ============================================================================== -Copyright (c) 2010-2011 Emscripten authors, see AUTHORS file. +Copyright (c) 2010-2014 Emscripten authors, see AUTHORS file. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a @@ -91,4 +91,4 @@ in accordance with the terms of the MIT license. Node's license follows: LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - """
\ No newline at end of file + """ diff --git a/cmake/Platform/Emscripten.cmake b/cmake/Platform/Emscripten.cmake index 4f434d14..7d86c467 100644 --- a/cmake/Platform/Emscripten.cmake +++ b/cmake/Platform/Emscripten.cmake @@ -125,20 +125,20 @@ set(CMAKE_C_SIZEOF_DATA_PTR 4) set(CMAKE_CXX_SIZEOF_DATA_PTR 4) set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2" CACHE STRING "Emscripten-overridden CMAKE_C_FLAGS_RELEASE") -set(CMAKE_C_FLAGS_MINSIZEREL "-DNDEBUG -O2" CACHE STRING "Emscripten-overridden CMAKE_C_FLAGS_MINSIZEREL") +set(CMAKE_C_FLAGS_MINSIZEREL "-DNDEBUG -Os" CACHE STRING "Emscripten-overridden CMAKE_C_FLAGS_MINSIZEREL") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2" CACHE STRING "Emscripten-overridden CMAKE_C_FLAGS_RELWITHDEBINFO") set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O2" CACHE STRING "Emscripten-overridden CMAKE_CXX_FLAGS_RELEASE") -set(CMAKE_CXX_FLAGS_MINSIZEREL "-DNDEBUG -O2" CACHE STRING "Emscripten-overridden CMAKE_CXX_FLAGS_MINSIZEREL") +set(CMAKE_CXX_FLAGS_MINSIZEREL "-DNDEBUG -Os" CACHE STRING "Emscripten-overridden CMAKE_CXX_FLAGS_MINSIZEREL") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2" CACHE STRING "Emscripten-overridden CMAKE_CXX_FLAGS_RELWITHDEBINFO") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-O2" CACHE STRING "Emscripten-overridden CMAKE_EXE_LINKER_FLAGS_RELEASE") -set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "-O2" CACHE STRING "Emscripten-overridden CMAKE_EXE_LINKER_FLAGS_MINSIZEREL") +set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "-Os" CACHE STRING "Emscripten-overridden CMAKE_EXE_LINKER_FLAGS_MINSIZEREL") set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Emscripten-overridden CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO") set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "-O2" CACHE STRING "Emscripten-overridden CMAKE_SHARED_LINKER_FLAGS_RELEASE") -set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "-O2" CACHE STRING "Emscripten-overridden CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL") +set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "-Os" CACHE STRING "Emscripten-overridden CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL") set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Emscripten-overridden CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO") set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "-O2" CACHE STRING "Emscripten-overridden CMAKE_MODULE_LINKER_FLAGS_RELEASE") -set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "-O2" CACHE STRING "Emscripten-overridden CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL") +set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "-Os" CACHE STRING "Emscripten-overridden CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL") set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Emscripten-overridden CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO") function(em_validate_asmjs_after_build target) @@ -573,7 +573,7 @@ elif sys.argv[1] == '--version': finally: os.chdir(here) print '''emcc (Emscripten GCC-like replacement) %s (%s) -Copyright (C) 2013 the Emscripten authors (see AUTHORS.txt) +Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt) This is free and open source software under the MIT license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ''' % (shared.EMSCRIPTEN_VERSION, revision) @@ -1204,11 +1204,9 @@ try: if fastcomp: shared.Settings.ASM_JS = 1 if opt_level > 0 else 2 - assert shared.Settings.ALLOW_MEMORY_GROWTH == 0, 'memory growth not supported in fastcomp yet' assert shared.Settings.UNALIGNED_MEMORY == 0, 'forced unaligned memory not supported in fastcomp' assert shared.Settings.CHECK_HEAP_ALIGN == 0, 'check heap align not supported in fastcomp yet' assert shared.Settings.SAFE_DYNCALLS == 0, 'safe dyncalls not supported in fastcomp' - assert shared.Settings.RESERVED_FUNCTION_POINTERS == 0, 'reserved function pointers not supported in fastcomp' assert shared.Settings.ASM_HEAP_LOG == 0, 'asm heap log not supported in fastcomp' assert shared.Settings.LABEL_DEBUG == 0, 'label debug not supported in fastcomp' assert shared.Settings.EXECUTION_TIMEOUT == -1, 'execution timeout not supported in fastcomp' @@ -1218,6 +1216,8 @@ try: assert shared.Settings.USE_TYPED_ARRAYS == 2, 'fastcomp assumes ta2' assert not split_js_file, '--split-js is deprecated and not supported in fastcomp' assert not bind, 'embind not supported in fastcomp yet' + assert shared.Settings.MAX_SETJMPS == 20, 'changing MAX_SETJMPS is not supported in fastcomp yet' + assert shared.Settings.INIT_HEAP == 0, 'HEAP_INIT is not supported in fastcomp (and should never be needed except for debugging)' if jcache: logging.warning('jcache is not supported in fastcomp (you should not need it anyhow), disabling') jcache = False @@ -1246,8 +1246,8 @@ try: logging.warning('enabling js opts to allow SAFE_HEAP to work properly') if shared.Settings.ALLOW_MEMORY_GROWTH: - logging.error('Cannot enable ALLOW_MEMORY_GROWTH with asm.js, build with -s ASM_JS=0 if you need a growable heap'); - sys.exit(1); + logging.warning('Disabling asm.js validation for memory growth (memory can grow, but you lose some amount of speed)'); + shared.Settings.ASM_JS = 2 if shared.Settings.CORRECT_SIGNS >= 2 or shared.Settings.CORRECT_OVERFLOWS >= 2 or shared.Settings.CORRECT_ROUNDINGS >= 2: debug_level = 4 # must keep debug info to do line-by-line operations @@ -1308,6 +1308,10 @@ try: if js_opts: shared.Settings.RUNNING_JS_OPTS = 1 + shared.Settings.EMSCRIPTEN_VERSION = shared.EMSCRIPTEN_VERSION + shared.Settings.OPT_LEVEL = opt_level + shared.Settings.DEBUG_LEVEL = debug_level + ## Compile source code to bitcode logging.debug('compiling to bitcode') diff --git a/emscripten.py b/emscripten.py index c96c56a0..59a0666c 100755 --- a/emscripten.py +++ b/emscripten.py @@ -744,6 +744,8 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None, backend_args += ['-emscripten-precise-f32'] if settings['WARN_UNALIGNED']: backend_args += ['-emscripten-warn-unaligned'] + if settings['RESERVED_FUNCTION_POINTERS'] > 0: + backend_args += ['-emscripten-reserved-function-pointers=%d' % settings['RESERVED_FUNCTION_POINTERS']] if DEBUG: logging.debug('emscript: llvm backend: ' + ' '.join(backend_args)) t = time.time() @@ -801,9 +803,13 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None, # Settings changes assert settings['TARGET_LE32'] == 1 settings['TARGET_LE32'] = 2 - if 'i64Add' in metadata['declares']: # TODO: others, once we split them up - settings['PRECISE_I64_MATH'] = 2 - metadata['declares'] = filter(lambda i64_func: i64_func not in ['getHigh32', 'setHigh32', '__muldi3', '__divdi3', '__remdi3', '__udivdi3', '__uremdi3'], metadata['declares']) # FIXME: do these one by one as normal js lib funcs + i64_funcs = ['i64Add', 'i64Subtract', '__muldi3', '__divdi3', '__udivdi3', '__remdi3', '__uremdi3'] + for i64_func in i64_funcs: + if i64_func in metadata['declares']: + settings['PRECISE_I64_MATH'] = 2 + break + + metadata['declares'] = filter(lambda i64_func: i64_func not in ['getHigh32', 'setHigh32', '__muldi3', '__divdi3', '__remdi3', '__udivdi3', '__uremdi3'], metadata['declares']) # FIXME: do these one by one as normal js lib funcs # Integrate info from backend settings['DEFAULT_LIBRARY_FUNCS_TO_INCLUDE'] = list( @@ -912,28 +918,48 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None, def unfloat(s): return 'd' if s == 'f' else s # lower float to double for ffis + if settings['ASSERTIONS'] >= 2: + debug_tables = {} + def make_table(sig, raw): - i = Counter.i - Counter.i += 1 - bad = 'b' + str(i) + Counter.pre = '' params = ','.join(['p%d' % p for p in range(len(sig)-1)]) coerced_params = ','.join([shared.JS.make_coercion('p%d', unfloat(sig[p+1]), settings) % p for p in range(len(sig)-1)]) coercions = ';'.join(['p%d = %s' % (p, shared.JS.make_coercion('p%d' % p, sig[p+1], settings)) for p in range(len(sig)-1)]) + ';' def make_func(name, code): return 'function %s(%s) { %s %s }' % (name, params, coercions, code) - Counter.pre = [make_func(bad, ('abort' if not settings['ASSERTIONS'] else 'nullFunc') + '(' + str(i) + ');' + ( - '' if sig[0] == 'v' else ('return %s' % shared.JS.make_initializer(sig[0], settings)) - ))] + def make_bad(target=None): + i = Counter.i + Counter.i += 1 + if target is None: target = i + name = 'b' + str(i) + if not settings['ASSERTIONS']: + code = 'abort(%s);' % target + else: + code = 'nullFunc_' + sig + '(%d);' % target + if sig[0] != 'v': + code += 'return %s' % shared.JS.make_initializer(sig[0], settings) + ';' + return name, make_func(name, code) + bad, bad_func = make_bad() # the default bad func + Counter.pre = [bad_func] start = raw.index('[') end = raw.rindex(']') body = raw[start+1:end].split(',') for j in range(settings['RESERVED_FUNCTION_POINTERS']): - body[settings['FUNCTION_POINTER_ALIGNMENT'] * (1 + j)] = 'jsCall_%s_%s' % (sig, j) + curr = 'jsCall_%s_%s' % (sig, j) + body[settings['FUNCTION_POINTER_ALIGNMENT'] * (1 + j)] = curr + implemented_functions.add(curr) Counter.j = 0 def fix_item(item): Counter.j += 1 newline = Counter.j % 30 == 29 - if item == '0': return bad if not newline else (bad + '\n') + if item == '0': + if settings['ASSERTIONS'] <= 1: + return bad if not newline else (bad + '\n') + else: + specific_bad, specific_bad_func = make_bad(Counter.j) + Counter.pre.append(specific_bad_func) + return specific_bad if not newline else (specific_bad + '\n') if item not in implemented_functions: # this is imported into asm, we must wrap it call_ident = item @@ -948,6 +974,8 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None, Counter.pre.append(make_func(item + '__wrapper', code)) return item + '__wrapper' return item if not newline else (item + '\n') + if settings['ASSERTIONS'] >= 2: + debug_tables[sig] = body body = ','.join(map(fix_item, body)) return ('\n'.join(Counter.pre), ''.join([raw[:start+1], body, raw[end:]])) @@ -969,8 +997,20 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None, if settings['SAFE_HEAP']: basic_funcs += ['SAFE_HEAP_LOAD', 'SAFE_HEAP_STORE'] if settings['CHECK_HEAP_ALIGN']: basic_funcs += ['CHECK_ALIGN_2', 'CHECK_ALIGN_4', 'CHECK_ALIGN_8'] if settings['ASSERTIONS']: - basic_funcs += ['nullFunc'] - asm_setup += 'function nullFunc(x) { Module["printErr"]("Invalid function pointer called. Perhaps a miscast function pointer (check compilation warnings) or bad vtable lookup (maybe due to derefing a bad pointer, like NULL)?"); abort(x) }\n' + for sig in last_forwarded_json['Functions']['tables'].iterkeys(): + basic_funcs += ['nullFunc_' + sig] + if settings['ASSERTIONS'] <= 1: + extra = ' Module["printErr"]("Build with ASSERTIONS=2 for more info.");' + pointer = ' ' + else: + pointer = ' \'" + x + "\' ' + asm_setup += '\nvar debug_table_' + sig + ' = ' + json.dumps(debug_tables[sig]) + ';' + extra = ' Module["printErr"]("This pointer might make sense in another type signature: ' + for other in last_forwarded_json['Functions']['tables'].iterkeys(): + if other != sig: + extra += other + ': " + debug_table_' + other + '[x] + " ' + extra += '"); ' + asm_setup += '\nfunction nullFunc_' + sig + '(x) { Module["printErr"]("Invalid function pointer' + pointer + 'called with signature \'' + sig + '\'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an different type, which will fail?"); ' + extra + ' abort(x) }\n' basic_vars = ['STACKTOP', 'STACK_MAX', 'tempDoublePtr', 'ABORT'] basic_float_vars = ['NaN', 'Infinity'] diff --git a/src/jsifier.js b/src/jsifier.js index 35846d39..c1ca893b 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -1419,7 +1419,7 @@ function JSify(data, functionsOnly) { // store current list offset in tempInt, advance list offset by STACK_ALIGN, return list entry stored at tempInt return '(tempInt=' + makeGetValue(ident, Runtime.QUANTUM_SIZE, '*') + ',' + - makeSetValue(ident, Runtime.QUANTUM_SIZE, 'tempInt + ' + move, '*', null, null, null, null, ',') + ',' + + makeSetValue(ident, Runtime.QUANTUM_SIZE, asmCoercion('tempInt + ' + move, 'i32'), '*', null, null, null, null, ',') + ',' + makeGetValue(makeGetValue(ident, 0, '*'), 'tempInt', item.type) + ')'; } diff --git a/src/library.js b/src/library.js index f69b52e5..91d5f925 100644 --- a/src/library.js +++ b/src/library.js @@ -131,7 +131,7 @@ LibraryManager.library = { stream.position++; return 0; }, - readdir__deps: ['readdir_r', '__setErrNo', '$ERRNO_CODES'], + readdir__deps: ['readdir_r', '__setErrNo', '$ERRNO_CODES', 'malloc'], readdir: function(dirp) { // struct dirent *readdir(DIR *dirp); // http://pubs.opengroup.org/onlinepubs/007908799/xsh/readdir_r.html @@ -1021,7 +1021,7 @@ LibraryManager.library = { return -1; } }, - ttyname__deps: ['ttyname_r'], + ttyname__deps: ['ttyname_r', 'malloc'], ttyname: function(fildes) { // char *ttyname(int fildes); // http://pubs.opengroup.org/onlinepubs/000095399/functions/ttyname.html @@ -1287,7 +1287,7 @@ LibraryManager.library = { return -1; } }, - getlogin__deps: ['getlogin_r'], + getlogin__deps: ['getlogin_r', 'malloc'], getlogin: function() { // char *getlogin(void); // http://pubs.opengroup.org/onlinepubs/000095399/functions/getlogin.html @@ -1970,7 +1970,7 @@ LibraryManager.library = { } next = {{{ makeGetValue(0, 'textIndex+1', 'i8') }}}; } - if (precision === -1) { + if (precision < 0) { precision = 6; // Standard default. precisionSet = false; } @@ -2695,7 +2695,7 @@ LibraryManager.library = { if (buf) _setvbuf(stream, buf, 0, 8192); // _IOFBF, BUFSIZ. else _setvbuf(stream, buf, 2, 8192); // _IONBF, BUFSIZ. }, - tmpnam__deps: ['$FS'], + tmpnam__deps: ['$FS', 'malloc'], tmpnam: function(s, dir, prefix) { // char *tmpnam(char *s); // http://pubs.opengroup.org/onlinepubs/000095399/functions/tmpnam.html @@ -2792,7 +2792,7 @@ LibraryManager.library = { function unget() { index--; }; return __scanString(format, get, unget, varargs); }, - snprintf__deps: ['_formatString'], + snprintf__deps: ['_formatString', 'malloc'], snprintf: function(s, n, format, varargs) { // int snprintf(char *restrict s, size_t n, const char *restrict format, ...); // http://pubs.opengroup.org/onlinepubs/000095399/functions/printf.html @@ -2903,7 +2903,7 @@ LibraryManager.library = { // sys/mman.h // ========================================================================== - mmap__deps: ['$FS'], + mmap__deps: ['$FS', 'malloc', 'memset'], mmap: function(start, num, prot, flags, fd, offset) { /* FIXME: Since mmap is normally implemented at the kernel level, * this implementation simply uses malloc underneath the call to @@ -3061,7 +3061,7 @@ LibraryManager.library = { return 0; }, - realloc__deps: ['memcpy'], + realloc__deps: ['malloc', 'memcpy', 'free'], realloc: function(ptr, size) { // Very simple, inefficient implementation - if you use a real malloc, best to use // a real realloc with it @@ -3275,7 +3275,7 @@ LibraryManager.library = { return _strtoll(ptr, null, 10); }, - qsort__deps: ['memcpy'], + qsort__deps: ['malloc', 'memcpy', 'free'], qsort: function(base, num, size, cmp) { if (num == 0 || size == 0) return; // forward calls to the JavaScript sort method @@ -3825,7 +3825,7 @@ LibraryManager.library = { }, rindex: 'strrchr', - strdup__deps: ['strlen'], + strdup__deps: ['strlen', 'malloc'], strdup: function(ptr) { var len = _strlen(ptr); var newStr = _malloc(len + 1); @@ -3834,7 +3834,7 @@ LibraryManager.library = { return newStr; }, - strndup__deps: ['strdup', 'strlen'], + strndup__deps: ['strdup', 'strlen', 'malloc'], strndup: function(ptr, size) { var len = _strlen(ptr); @@ -3942,7 +3942,7 @@ LibraryManager.library = { return ___setErrNo(ERRNO_CODES.EINVAL); } }, - strerror__deps: ['strerror_r'], + strerror__deps: ['strerror_r', 'malloc'], strerror: function(errnum) { if (!_strerror.buffer) _strerror.buffer = _malloc(256); _strerror_r(errnum, _strerror.buffer, 256); @@ -4080,6 +4080,7 @@ LibraryManager.library = { return _isgraph(chr); // no locale support yet }, // Lookup tables for glibc ctype implementation. + __ctype_b_loc__deps: ['malloc'], __ctype_b_loc: function() { // http://refspecs.freestandards.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/baselib---ctype-b-loc.html var me = ___ctype_b_loc; @@ -4105,6 +4106,7 @@ LibraryManager.library = { } return me.ret; }, + __ctype_tolower_loc__deps: ['malloc'], __ctype_tolower_loc: function() { // http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/libutil---ctype-tolower-loc.html var me = ___ctype_tolower_loc; @@ -4133,6 +4135,7 @@ LibraryManager.library = { } return me.ret; }, + __ctype_toupper_loc__deps: ['malloc'], __ctype_toupper_loc: function() { // http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/libutil---ctype-toupper-loc.html var me = ___ctype_toupper_loc; @@ -4338,12 +4341,12 @@ LibraryManager.library = { __cxa_caught_exceptions: [], // Exceptions - __cxa_allocate_exception__deps: ['__cxa_exception_header_size'], + __cxa_allocate_exception__deps: ['__cxa_exception_header_size', 'malloc'], __cxa_allocate_exception: function(size) { var ptr = _malloc(size + ___cxa_exception_header_size); return ptr + ___cxa_exception_header_size; }, - __cxa_free_exception__deps: ['__cxa_exception_header_size'], + __cxa_free_exception__deps: ['__cxa_exception_header_size', 'free'], __cxa_free_exception: function(ptr) { try { return _free(ptr - ___cxa_exception_header_size); @@ -4414,7 +4417,7 @@ LibraryManager.library = { // we don't actually get the value that we allocated, but something else. Easiest // to remember that the last exception thrown is going to be the first to be caught, // so just use that value instead as it is what we're really looking for. - __cxa_begin_catch__deps: ['_ZSt18uncaught_exceptionv', '__cxa_caught_exceptions'], + __cxa_begin_catch__deps: ['_ZSt18uncaught_exceptionv', '__cxa_caught_exceptions', '__cxa_last_thrown_exception'], __cxa_begin_catch: function(ptr) { __ZSt18uncaught_exceptionv.uncaught_exception--; ___cxa_caught_exceptions.push(___cxa_last_thrown_exception); @@ -4449,14 +4452,13 @@ LibraryManager.library = { ___cxa_last_thrown_exception = 0; } }, - __cxa_get_exception_ptr__deps: ['___cxa_last_thrown_exception'], __cxa_get_exception_ptr: function(ptr) { return ptr; }, _ZSt18uncaught_exceptionv: function() { // std::uncaught_exception() return !!__ZSt18uncaught_exceptionv.uncaught_exception; }, - __cxa_uncaught_exception__deps: ['_Zst18uncaught_exceptionv'], + __cxa_uncaught_exception__deps: ['_ZSt18uncaught_exceptionv'], __cxa_uncaught_exception: function() { return !!__ZSt18uncaught_exceptionv.uncaught_exception; }, @@ -4532,7 +4534,7 @@ LibraryManager.library = { {{{ makeStructuralReturn(['thrown', 'throwntype']) }}}; }, - __resumeException__deps: [function() { Functions.libraryFunctions['__resumeException'] = 1 }], // will be called directly from compiled code + __resumeException__deps: [function() { Functions.libraryFunctions['__resumeException'] = 1 }, '__cxa_last_thrown_exception'], // will be called directly from compiled code __resumeException: function(ptr) { #if EXCEPTION_DEBUG Module.print("Resuming exception"); @@ -4585,7 +4587,7 @@ LibraryManager.library = { _ZNSt9exceptionD1Ev: function() {}, _ZNSt9exceptionD2Ev: function() {}, - _ZNKSt9exception4whatEv__deps: ['_malloc'], + _ZNKSt9exception4whatEv__deps: ['malloc'], _ZNKSt9exception4whatEv: function() { if (!__ZNKSt9exception4whatEv.buffer) { var name = "std::exception"; @@ -6443,7 +6445,19 @@ LibraryManager.library = { // var indexes = Runtime.calculateStructAlignment({ fields: ['i32', 'i32'] }); var me = _localeconv; if (!me.ret) { - me.ret = allocate([allocate(intArrayFromString('.'), 'i8', ALLOC_NORMAL)], 'i8*', ALLOC_NORMAL); // just decimal point, for now + // These are defaults from the "C" locale + me.ret = allocate([ + allocate(intArrayFromString('.'), 'i8', ALLOC_NORMAL),0,0,0, // decimal_point + allocate(intArrayFromString(''), 'i8', ALLOC_NORMAL),0,0,0, // thousands_sep + allocate(intArrayFromString(''), 'i8', ALLOC_NORMAL),0,0,0, // grouping + allocate(intArrayFromString(''), 'i8', ALLOC_NORMAL),0,0,0, // int_curr_symbol + allocate(intArrayFromString(''), 'i8', ALLOC_NORMAL),0,0,0, // currency_symbol + allocate(intArrayFromString(''), 'i8', ALLOC_NORMAL),0,0,0, // mon_decimal_point + allocate(intArrayFromString(''), 'i8', ALLOC_NORMAL),0,0,0, // mon_thousands_sep + allocate(intArrayFromString(''), 'i8', ALLOC_NORMAL),0,0,0, // mon_grouping + allocate(intArrayFromString(''), 'i8', ALLOC_NORMAL),0,0,0, // positive_sign + allocate(intArrayFromString(''), 'i8', ALLOC_NORMAL),0,0,0 // negative_sign + ], 'i8*', ALLOC_NORMAL); // Allocate strings in lconv, still don't allocate chars } return me.ret; }, @@ -6454,6 +6468,7 @@ LibraryManager.library = { // langinfo.h // ========================================================================== + nl_langinfo__deps: ['malloc'], nl_langinfo: function(item) { // char *nl_langinfo(nl_item item); // http://pubs.opengroup.org/onlinepubs/000095399/functions/nl_langinfo.html @@ -7080,7 +7095,7 @@ LibraryManager.library = { } return addr; }, - inet_ntoa__deps: ['_inet_ntop4_raw'], + inet_ntoa__deps: ['_inet_ntop4_raw', 'malloc'], inet_ntoa: function(in_addr) { if (!_inet_ntoa.buffer) { _inet_ntoa.buffer = _malloc(1024); @@ -7442,7 +7457,7 @@ LibraryManager.library = { return _gethostbyname(hostp); }, - gethostbyname__deps: ['$DNS', '_inet_pton4_raw'], + gethostbyname__deps: ['$DNS', '_inet_pton4_raw', 'malloc'], gethostbyname: function(name) { name = Pointer_stringify(name); @@ -7475,7 +7490,7 @@ LibraryManager.library = { return 0; }, - getaddrinfo__deps: ['$Sockets', '$DNS', '_inet_pton4_raw', '_inet_ntop4_raw', '_inet_pton6_raw', '_inet_ntop6_raw', '_write_sockaddr', 'htonl'], + getaddrinfo__deps: ['$Sockets', '$DNS', '_inet_pton4_raw', '_inet_ntop4_raw', '_inet_pton6_raw', '_inet_ntop6_raw', '_write_sockaddr', 'htonl', 'malloc'], getaddrinfo: function(node, service, hint, out) { // Note getaddrinfo currently only returns a single addrinfo with ai_next defaulting to NULL. When NULL // hints are specified or ai_family set to AF_UNSPEC or ai_socktype or ai_protocol set to 0 then we @@ -7692,7 +7707,7 @@ LibraryManager.library = { // are actually negative numbers and you can't have expressions as keys in JavaScript literals. $GAI_ERRNO_MESSAGES: {}, - gai_strerror__deps: ['$GAI_ERRNO_MESSAGES'], + gai_strerror__deps: ['$GAI_ERRNO_MESSAGES', 'malloc'], gai_strerror: function(val) { var buflen = 256; @@ -7734,7 +7749,7 @@ LibraryManager.library = { list: [], map: {} }, - setprotoent__deps: ['$Protocols'], + setprotoent__deps: ['$Protocols', 'malloc'], setprotoent: function(stayopen) { // void setprotoent(int stayopen); @@ -8397,7 +8412,7 @@ LibraryManager.library = { } }, - getsockname__deps: ['$FS', '$SOCKFS', '$DNS', '$ERRNO_CODES', '__setErrNo', '_write_sockaddr', '_inet_pton_raw'], + getsockname__deps: ['$FS', '$SOCKFS', '$DNS', '$ERRNO_CODES', '__setErrNo', '_write_sockaddr'], getsockname: function (fd, addr, addrlen) { var sock = SOCKFS.getSocket(fd); if (!sock) { @@ -8415,7 +8430,7 @@ LibraryManager.library = { } }, - getpeername__deps: ['$FS', '$SOCKFS', '$DNS', '$ERRNO_CODES', '__setErrNo', '_write_sockaddr', '_inet_pton_raw'], + getpeername__deps: ['$FS', '$SOCKFS', '$DNS', '$ERRNO_CODES', '__setErrNo', '_write_sockaddr'], getpeername: function (fd, addr, addrlen) { var sock = SOCKFS.getSocket(fd); if (!sock) { @@ -8565,7 +8580,7 @@ LibraryManager.library = { } }, - recvmsg__deps: ['$FS', '$SOCKFS', '$DNS', '$ERRNO_CODES', '__setErrNo', '_inet_pton_raw', '_write_sockaddr'], + recvmsg__deps: ['$FS', '$SOCKFS', '$DNS', '$ERRNO_CODES', '__setErrNo', '_write_sockaddr'], recvmsg: function(fd, message, flags) { var sock = SOCKFS.getSocket(fd); if (!sock) { @@ -9051,6 +9066,49 @@ LibraryManager.library = { _emscripten_log_js(flags, str); }, + emscripten_get_compiler_setting: function(name) { + name = Pointer_stringify(name); + + var ret = Runtime.getCompilerSetting(name); + if (typeof ret === 'number') return ret; + + if (!_emscripten_get_compiler_setting.cache) _emscripten_get_compiler_setting.cache = {}; + var cache = _emscripten_get_compiler_setting.cache; + var fullname = name + '__str'; + var fullret = cache[fullname]; + if (fullret) return fullret; + return cache[fullname] = allocate(intArrayFromString(ret + ''), 'i8', ALLOC_NORMAL); + }, + +#if ASM_JS +#if ALLOW_MEMORY_GROWTH + emscripten_replace_memory__asm: true, // this is used inside the asm module + emscripten_replace_memory__sig: 'viiiiiiii', // bogus + emscripten_replace_memory: function(_HEAP8, _HEAP16, _HEAP32, _HEAPU8, _HEAPU16, _HEAPU32, _HEAPF32, _HEAPF64) { + _HEAP8 = _HEAP8; // fake asm coercions + _HEAP16 = _HEAP16; + _HEAP32 = _HEAP32; + _HEAPU8 = _HEAPU8; + _HEAPU16 = _HEAPU16; + _HEAPU32 = _HEAPU32; + _HEAPF32 = _HEAPF32; + _HEAPF64 = _HEAPF64; + HEAP8 = _HEAP8; // replace the memory views + HEAP16 = _HEAP16; + HEAP32 = _HEAP32; + HEAPU8 = _HEAPU8; + HEAPU16 = _HEAPU16; + HEAPU32 = _HEAPU32; + HEAPF32 = _HEAPF32; + HEAPF64 = _HEAPF64; + }, + // this function is inside the asm block, but prevents validation as asm.js + // the codebase still benefits from being in the general asm.js shape, + // but should not declare itself as validating (which is prevented in ASM_JS == 2). + {{{ (assert(ASM_JS === 2), DEFAULT_LIBRARY_FUNCS_TO_INCLUDE.push('emscripten_replace_memory'), '') }}} +#endif +#endif + //============================ // emscripten vector ops //============================ diff --git a/src/library_browser.js b/src/library_browser.js index 50a8fc6f..b800292c 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -234,6 +234,10 @@ mergeInto(LibraryManager.library, { } #endif var ctx; + var errorInfo = '?'; + function onContextCreationError(event) { + errorInfo = event.statusMessage || errorInfo; + } try { if (useWebGL) { var contextAttributes = { @@ -251,10 +255,6 @@ mergeInto(LibraryManager.library, { contextAttributes.preserveDrawingBuffer = true; #endif - var errorInfo = '?'; - function onContextCreationError(event) { - errorInfo = event.statusMessage || errorInfo; - } canvas.addEventListener('webglcontextcreationerror', onContextCreationError, false); try { ['experimental-webgl', 'webgl'].some(function(webglId) { @@ -752,7 +752,7 @@ mergeInto(LibraryManager.library, { document.body.appendChild(script); }, - emscripten_set_main_loop: function(func, fps, simulateInfiniteLoop) { + emscripten_set_main_loop: function(func, fps, simulateInfiniteLoop, arg) { Module['noExitRuntime'] = true; Browser.mainLoop.runner = function Browser_mainLoop_runner() { @@ -803,7 +803,11 @@ mergeInto(LibraryManager.library, { } try { - Runtime.dynCall('v', func); + if (typeof arg !== 'undefined') { + Runtime.dynCall('vi', func, [arg]); + } else { + Runtime.dynCall('v', func); + } } catch (e) { if (e instanceof ExitStatus) { return; @@ -843,6 +847,11 @@ mergeInto(LibraryManager.library, { } }, + emscripten_set_main_loop_arg__deps: ['emscripten_set_main_loop'], + emscripten_set_main_loop_arg: function(func, arg, fps, simulateInfiniteLoop) { + _emscripten_set_main_loop(func, fps, simulateInfiniteLoop, arg); + }, + emscripten_cancel_main_loop: function() { Browser.mainLoop.scheduler = null; Browser.mainLoop.shouldPause = true; diff --git a/src/library_egl.js b/src/library_egl.js index 69dd266d..e2d1df43 100644 --- a/src/library_egl.js +++ b/src/library_egl.js @@ -550,7 +550,21 @@ var LibraryEGL = { // EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface); eglSwapBuffers: function() { - EGL.setErrorCode(0x3000 /* EGL_SUCCESS */); + if (!EGL.defaultDisplayInitialized) { + EGL.setErrorCode(0x3001 /* EGL_NOT_INITIALIZED */); + } else if (!Module.ctx) { + EGL.setErrorCode(0x3002 /* EGL_BAD_ACCESS */); + } else if (Module.ctx.isContextLost()) { + EGL.setErrorCode(0x300E /* EGL_CONTEXT_LOST */); + } else { + // According to documentation this does an implicit flush. + // Due to discussion at https://github.com/kripken/emscripten/pull/1871 + // the flush was removed since this _may_ result in slowing code down. + //_glFlush(); + EGL.setErrorCode(0x3000 /* EGL_SUCCESS */); + return 1; // EGL_TRUE + } + return 0; // EGL_FALSE }, eglGetProcAddress__deps: ['emscripten_GetProcAddress'], diff --git a/src/library_fs.js b/src/library_fs.js index e97ba588..1428f041 100644 --- a/src/library_fs.js +++ b/src/library_fs.js @@ -616,13 +616,13 @@ mergeInto(LibraryManager.library, { }, // helpers to create specific types of nodes create: function(path, mode) { - mode = mode !== undefined ? mode : 0666; + mode = mode !== undefined ? mode : 438 /* 0666 */; mode &= {{{ cDefine('S_IALLUGO') }}}; mode |= {{{ cDefine('S_IFREG') }}}; return FS.mknod(path, mode, 0); }, mkdir: function(path, mode) { - mode = mode !== undefined ? mode : 0777; + mode = mode !== undefined ? mode : 511 /* 0777 */; mode &= {{{ cDefine('S_IRWXUGO') }}} | {{{ cDefine('S_ISVTX') }}}; mode |= {{{ cDefine('S_IFDIR') }}}; return FS.mknod(path, mode, 0); @@ -630,7 +630,7 @@ mergeInto(LibraryManager.library, { mkdev: function(path, mode, dev) { if (typeof(dev) === 'undefined') { dev = mode; - mode = 0666; + mode = 438 /* 0666 */; } mode |= {{{ cDefine('S_IFCHR') }}}; return FS.mknod(path, mode, dev); @@ -895,7 +895,7 @@ mergeInto(LibraryManager.library, { }, open: function(path, flags, mode, fd_start, fd_end) { flags = typeof flags === 'string' ? FS.modeStringToFlags(flags) : flags; - mode = typeof mode === 'undefined' ? 0666 : mode; + mode = typeof mode === 'undefined' ? 438 /* 0666 */ : mode; if ((flags & {{{ cDefine('O_CREAT') }}})) { mode = (mode & {{{ cDefine('S_IALLUGO') }}}) | {{{ cDefine('S_IFREG') }}}; } else { diff --git a/src/library_gl.js b/src/library_gl.js index e3442a8a..7e4c5a97 100644 --- a/src/library_gl.js +++ b/src/library_gl.js @@ -19,6 +19,7 @@ var LibraryGL = { textures: [], uniforms: [], shaders: [], + vaos: [], #if FULL_ES2 clientBuffers: [], @@ -633,6 +634,9 @@ var LibraryGL = { // Extension available from Firefox 26 and Google Chrome 30 GL.instancedArraysExt = GLctx.getExtension('ANGLE_instanced_arrays'); + + // Extension available from Firefox 25 and WebKit + GL.vaoExt = Module.ctx.getExtension('OES_vertex_array_object'); // These are the 'safe' feature-enabling extensions that don't add any performance impact related to e.g. debugging, and // should be enabled by default so that client GLES2/GL code will not need to go through extra hoops to get its stuff working. @@ -1797,6 +1801,81 @@ var LibraryGL = { }, #if LEGACY_GL_EMULATION + glGenVertexArrays__deps: ['emulGlGenVertexArrays'], +#endif + glGenVertexArrays__sig: 'vii', + glGenVertexArrays: function (n, arrays) { +#if LEGACY_GL_EMULATION + _emulGlGenVertexArrays(n, arrays); +#else +#if GL_ASSERTIONS + assert(GL.vaoExt, 'Must have OES_vertex_array_object to use vao'); +#endif + + for(var i = 0; i < n; i++) { + var id = GL.getNewId(GL.vaos); + var vao = GL.vaoExt.createVertexArrayOES(); + vao.name = id; + GL.vaos[id] = vao; + {{{ makeSetValue('arrays', 'i*4', 'id', 'i32') }}}; + } +#endif + }, + +#if LEGACY_GL_EMULATION + glDeleteVertexArrays__deps: ['emulGlDeleteVertexArrays'], +#endif + glDeleteVertexArrays__sig: 'vii', + glDeleteVertexArrays: function(n, vaos) { +#if LEGACY_GL_EMULATION + _emulGlDeleteVertexArrays(n, vaos); +#else +#if GL_ASSERTIONS + assert(GL.vaoExt, 'Must have OES_vertex_array_object to use vao'); +#endif + for(var i = 0; i < n; i++) { + var id = {{{ makeGetValue('vaos', 'i*4', 'i32') }}}; + GL.vaoExt.deleteVertexArrayOES(GL.vaos[id]); + GL.vaos[id] = null; + } +#endif + }, + +#if LEGACY_GL_EMULATION + glBindVertexArray__deps: ['emulGlBindVertexArray'], +#endif + glBindVertexArray__sig: 'vi', + glBindVertexArray: function(vao) { +#if LEGACY_GL_EMULATION + _emulGlBindVertexArray(vao); +#else +#if GL_ASSERTIONS + assert(GL.vaoExt, 'Must have OES_vertex_array_object to use vao'); +#endif + + GL.vaoExt.bindVertexArrayOES(GL.vaos[vao]); +#endif + }, + +#if LEGACY_GL_EMULATION + glIsVertexArray__deps: ['emulGlIsVertexArray'], +#endif + glIsVertexArray__sig: 'ii', + glIsVertexArray: function(array) { +#if LEGACY_GL_EMULATION + return _emulGlIsVertexArray(array); +#else +#if GL_ASSERTIONS + assert(GL.vaoExt, 'Must have OES_vertex_array_object to use vao'); +#endif + + var vao = GL.vaos[array]; + if (!vao) return 0; + return GL.vaoExt.isVertexArrayOES(vao); +#endif + }, + +#if LEGACY_GL_EMULATION // GL emulation: provides misc. functionality not present in OpenGL ES 2.0 or WebGL @@ -4809,9 +4888,9 @@ var LibraryGL = { }, // Vertex array object (VAO) support. TODO: when the WebGL extension is popular, use that and remove this code and GL.vaos - glGenVertexArrays__deps: ['$GLEmulation'], - glGenVertexArrays__sig: 'vii', - glGenVertexArrays: function(n, vaos) { + emulGlGenVertexArrays__deps: ['$GLEmulation'], + emulGlGenVertexArrays__sig: 'vii', + emulGlGenVertexArrays: function(n, vaos) { for (var i = 0; i < n; i++) { var id = GL.getNewId(GLEmulation.vaos); GLEmulation.vaos[id] = { @@ -4825,17 +4904,23 @@ var LibraryGL = { {{{ makeSetValue('vaos', 'i*4', 'id', 'i32') }}}; } }, - glDeleteVertexArrays__sig: 'vii', - glDeleteVertexArrays: function(n, vaos) { + emulGlDeleteVertexArrays__sig: 'vii', + emulGlDeleteVertexArrays: function(n, vaos) { for (var i = 0; i < n; i++) { var id = {{{ makeGetValue('vaos', 'i*4', 'i32') }}}; GLEmulation.vaos[id] = null; if (GLEmulation.currentVao && GLEmulation.currentVao.id == id) GLEmulation.currentVao = null; } }, - glBindVertexArray__deps: ['glBindBuffer', 'glEnableVertexAttribArray', 'glVertexAttribPointer', 'glEnableClientState'], - glBindVertexArray__sig: 'vi', - glBindVertexArray: function(vao) { + emulGlIsVertexArray__sig: 'vi', + emulGlIsVertexArray: function(array) { + var vao = GLEmulation.vaos[array]; + if (!vao) return 0; + return 1; + }, + emulGlBindVertexArray__deps: ['glBindBuffer', 'glEnableVertexAttribArray', 'glVertexAttribPointer', 'glEnableClientState'], + emulGlBindVertexArray__sig: 'vi', + emulGlBindVertexArray: function(vao) { // undo vao-related things, wipe the slate clean, both for vao of 0 or an actual vao GLEmulation.currentVao = null; // make sure the commands we run here are not recorded if (GLImmediate.lastRenderer) GLImmediate.lastRenderer.cleanup(); @@ -5034,21 +5119,23 @@ var LibraryGL = { glCheckFramebufferStatusOES : 'glCheckFramebufferStatus', glDeleteFramebuffersOES : 'glDeleteFramebuffers', glDeleteRenderbuffersOES : 'glDeleteRenderbuffers', - glGenVertexArraysOES: 'glGenVertexArrays', - glDeleteVertexArraysOES: 'glDeleteVertexArrays', - glBindVertexArrayOES: 'glBindVertexArray', glFramebufferTexture2DOES: 'glFramebufferTexture2D', #else // LEGACY_GL_EMULATION glVertexPointer: function(){ throw 'Legacy GL function (glVertexPointer) called. If you want legacy GL emulation, you need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, - glGenVertexArrays: function(){ throw 'Legacy GL function (glGenVertexArrays) called. If you want legacy GL emulation, you need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, glMatrixMode: function(){ throw 'Legacy GL function (glMatrixMode) called. If you want legacy GL emulation, you need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, glBegin: function(){ throw 'Legacy GL function (glBegin) called. If you want legacy GL emulation, you need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, glLoadIdentity: function(){ throw 'Legacy GL function (glLoadIdentity) called. If you want legacy GL emulation, you need to compile with -s LEGACY_GL_EMULATION=1 to enable legacy GL emulation.'; }, #endif // LEGACY_GL_EMULATION + // Open GLES1.1 vao compatibility (Could work w/o -s LEGACY_GL_EMULATION=1) + + glGenVertexArraysOES: 'glGenVertexArrays', + glDeleteVertexArraysOES: 'glDeleteVertexArrays', + glBindVertexArrayOES: 'glBindVertexArray', + // GLU gluPerspective: function(fov, aspect, near, far) { diff --git a/src/library_html5.js b/src/library_html5.js index a38c2390..63a4dff7 100644 --- a/src/library_html5.js +++ b/src/library_html5.js @@ -156,17 +156,17 @@ var LibraryJSEvents = { var e = event || window.event; writeStringToMemory(e.key ? e.key : "", JSEvents.keyEvent + {{{ C_STRUCTS.EmscriptenKeyboardEvent.key }}} ); writeStringToMemory(e.code ? e.code : "", JSEvents.keyEvent + {{{ C_STRUCTS.EmscriptenKeyboardEvent.code }}} ); - {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.location, 'e.location', 'i32') }}} - {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.ctrlKey, 'e.ctrlKey', 'i32') }}} - {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.shiftKey, 'e.shiftKey', 'i32') }}} - {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.altKey, 'e.altKey', 'i32') }}} - {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.metaKey, 'e.metaKey', 'i32') }}} - {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.repeat, 'e.repeat', 'i32') }}} + {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.location, 'e.location', 'i32') }}}; + {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.ctrlKey, 'e.ctrlKey', 'i32') }}}; + {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.shiftKey, 'e.shiftKey', 'i32') }}}; + {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.altKey, 'e.altKey', 'i32') }}}; + {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.metaKey, 'e.metaKey', 'i32') }}}; + {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.repeat, 'e.repeat', 'i32') }}}; writeStringToMemory(e.locale ? e.locale : "", JSEvents.keyEvent + {{{ C_STRUCTS.EmscriptenKeyboardEvent.locale }}} ); writeStringToMemory(e.char ? e.char : "", JSEvents.keyEvent + {{{ C_STRUCTS.EmscriptenKeyboardEvent.charValue }}} ); - {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.charCode, 'e.charCode', 'i32') }}} - {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.keyCode, 'e.keyCode', 'i32') }}} - {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.which, 'e.which', 'i32') }}} + {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.charCode, 'e.charCode', 'i32') }}}; + {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.keyCode, 'e.keyCode', 'i32') }}}; + {{{ makeSetValue('JSEvents.keyEvent', C_STRUCTS.EmscriptenKeyboardEvent.which, 'e.which', 'i32') }}}; var shouldCancel = Runtime.dynCall('iiii', callbackfunc, [eventTypeId, JSEvents.keyEvent, userData]); if (shouldCancel) { e.preventDefault(); @@ -188,21 +188,21 @@ var LibraryJSEvents = { fillMouseEventData: function(eventStruct, e) { var rect = Module['canvas'].getBoundingClientRect(); - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.timestamp, 'JSEvents.tick()', 'double') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.screenX, 'e.screenX', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.screenY, 'e.screenY', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.clientX, 'e.clientX', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.clientY, 'e.clientY', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.ctrlKey, 'e.ctrlKey', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.shiftKey, 'e.shiftKey', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.altKey, 'e.altKey', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.metaKey, 'e.metaKey', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.button, 'e.button', 'i16') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.buttons, 'e.buttons', 'i16') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.movementX, 'e.movementX', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.movementY, 'e.movementY', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.canvasX, 'e.clientX - rect.left', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.canvasY, 'e.clientY - rect.top', 'i32') }}} + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.timestamp, 'JSEvents.tick()', 'double') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.screenX, 'e.screenX', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.screenY, 'e.screenY', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.clientX, 'e.clientX', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.clientY, 'e.clientY', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.ctrlKey, 'e.ctrlKey', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.shiftKey, 'e.shiftKey', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.altKey, 'e.altKey', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.metaKey, 'e.metaKey', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.button, 'e.button', 'i16') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.buttons, 'e.buttons', 'i16') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.movementX, 'e.movementX || e.mozMovementX || e.webkitMovementX', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.movementY, 'e.movementY || e.mozMovementY || e.webkitMovementY', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.canvasX, 'e.clientX - rect.left', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenMouseEvent.canvasY, 'e.clientY - rect.top', 'i32') }}}; }, registerMouseEventCallback: function(target, userData, useCapture, callbackfunc, eventTypeId, eventTypeString) { @@ -236,10 +236,10 @@ var LibraryJSEvents = { var handlerFunc = function(event) { var e = event || window.event; JSEvents.fillMouseEventData(JSEvents.wheelEvent, e); - {{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaX, 'e.deltaX', 'double') }}} - {{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaY, 'e.deltaY', 'double') }}} - {{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaZ, 'e.deltaZ', 'double') }}} - {{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaMode, 'e.deltaMode', 'i32') }}} + {{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaX, 'e.deltaX', 'double') }}}; + {{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaY, 'e.deltaY', 'double') }}}; + {{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaZ, 'e.deltaZ', 'double') }}}; + {{{ makeSetValue('JSEvents.wheelEvent', C_STRUCTS.EmscriptenWheelEvent.deltaMode, 'e.deltaMode', 'i32') }}}; var shouldCancel = Runtime.dynCall('iiii', callbackfunc, [eventTypeId, JSEvents.wheelEvent, userData]); if (shouldCancel) { e.preventDefault(); @@ -288,15 +288,15 @@ var LibraryJSEvents = { return; } var scrollPos = JSEvents.pageScrollPos(); - {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.detail, 'e.detail', 'i32') }}} - {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.documentBodyClientWidth, 'document.body.clientWidth', 'i32') }}} - {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.documentBodyClientHeight, 'document.body.clientHeight', 'i32') }}} - {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.windowInnerWidth, 'window.innerWidth', 'i32') }}} - {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.windowInnerHeight, 'window.innerHeight', 'i32') }}} - {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.windowOuterWidth, 'window.outerWidth', 'i32') }}} - {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.windowOuterHeight, 'window.outerHeight', 'i32') }}} - {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.scrollTop, 'scrollPos[0]', 'i32') }}} - {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.scrollLeft, 'scrollPos[1]', 'i32') }}} + {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.detail, 'e.detail', 'i32') }}}; + {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.documentBodyClientWidth, 'document.body.clientWidth', 'i32') }}}; + {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.documentBodyClientHeight, 'document.body.clientHeight', 'i32') }}}; + {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.windowInnerWidth, 'window.innerWidth', 'i32') }}}; + {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.windowInnerHeight, 'window.innerHeight', 'i32') }}}; + {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.windowOuterWidth, 'window.outerWidth', 'i32') }}}; + {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.windowOuterHeight, 'window.outerHeight', 'i32') }}}; + {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.scrollTop, 'scrollPos[0]', 'i32') }}}; + {{{ makeSetValue('JSEvents.uiEvent', C_STRUCTS.EmscriptenUiEvent.scrollLeft, 'scrollPos[1]', 'i32') }}}; var shouldCancel = Runtime.dynCall('iiii', callbackfunc, [eventTypeId, JSEvents.uiEvent, userData]); if (shouldCancel) { e.preventDefault(); @@ -361,11 +361,11 @@ var LibraryJSEvents = { var handlerFunc = function(event) { var e = event || window.event; - {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.timestamp, 'JSEvents.tick()', 'double') }}} - {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.alpha, 'e.alpha', 'double') }}} - {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.beta, 'e.beta', 'double') }}} - {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.gamma, 'e.gamma', 'double') }}} - {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.absolute, 'e.absolute', 'i32') }}} + {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.timestamp, 'JSEvents.tick()', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.alpha, 'e.alpha', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.beta, 'e.beta', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.gamma, 'e.gamma', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceOrientationEvent.absolute, 'e.absolute', 'i32') }}}; var shouldCancel = Runtime.dynCall('iiii', callbackfunc, [eventTypeId, JSEvents.deviceOrientationEvent, userData]); if (shouldCancel) { @@ -391,16 +391,16 @@ var LibraryJSEvents = { var handlerFunc = function(event) { var e = event || window.event; - {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.timestamp, 'JSEvents.tick()', 'double') }}} - {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationX, 'e.acceleration.x', 'double') }}} - {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationY, 'e.acceleration.y', 'double') }}} - {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationZ, 'e.acceleration.z', 'double') }}} - {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationIncludingGravityX, 'e.accelerationIncludingGravity.x', 'double') }}} - {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationIncludingGravityY, 'e.accelerationIncludingGravity.y', 'double') }}} - {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationIncludingGravityZ, 'e.accelerationIncludingGravity.z', 'double') }}} - {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.rotationRateAlpha, 'e.rotationRate.alpha', 'double') }}} - {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.rotationRateBeta, 'e.rotationRate.beta', 'double') }}} - {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.rotationRateGamma, 'e.rotationRate.gamma', 'double') }}} + {{{ makeSetValue('JSEvents.deviceOrientationEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.timestamp, 'JSEvents.tick()', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationX, 'e.acceleration.x', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationY, 'e.acceleration.y', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationZ, 'e.acceleration.z', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationIncludingGravityX, 'e.accelerationIncludingGravity.x', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationIncludingGravityY, 'e.accelerationIncludingGravity.y', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationIncludingGravityZ, 'e.accelerationIncludingGravity.z', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.rotationRateAlpha, 'e.rotationRate.alpha', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.rotationRateBeta, 'e.rotationRate.beta', 'double') }}}; + {{{ makeSetValue('JSEvents.deviceMotionEvent', C_STRUCTS.EmscriptenDeviceMotionEvent.rotationRateGamma, 'e.rotationRate.gamma', 'double') }}}; var shouldCancel = Runtime.dynCall('iiii', callbackfunc, [eventTypeId, JSEvents.deviceMotionEvent, userData]); if (shouldCancel) { @@ -434,8 +434,8 @@ var LibraryJSEvents = { orientation = orientations2.indexOf(orientationString); } - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenOrientationChangeEvent.orientationIndex, '1 << orientation', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenOrientationChangeEvent.orientationAngle, 'window.orientation', 'i32') }}} + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenOrientationChangeEvent.orientationIndex, '1 << orientation', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenOrientationChangeEvent.orientationAngle, 'window.orientation', 'i32') }}}; }, registerOrientationChangeEventCallback: function(target, userData, useCapture, callbackfunc, eventTypeId, eventTypeString) { @@ -482,8 +482,8 @@ var LibraryJSEvents = { fillFullscreenChangeEventData: function(eventStruct, e) { var fullscreenElement = document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement; var isFullscreen = !!fullscreenElement; - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenFullscreenChangeEvent.isFullscreen, 'isFullscreen', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenFullscreenChangeEvent.fullscreenEnabled, 'JSEvents.fullscreenEnabled()', 'i32') }}} + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenFullscreenChangeEvent.isFullscreen, 'isFullscreen', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenFullscreenChangeEvent.fullscreenEnabled, 'JSEvents.fullscreenEnabled()', 'i32') }}}; var nodeName = JSEvents.getNodeNameForTarget(fullscreenElement); var id = (fullscreenElement && fullscreenElement.id) ? fullscreenElement.id : ''; writeStringToMemory(nodeName, eventStruct + {{{ C_STRUCTS.EmscriptenFullscreenChangeEvent.nodeName }}} ); @@ -547,7 +547,7 @@ var LibraryJSEvents = { fillPointerlockChangeEventData: function(eventStruct, e) { var pointerLockElement = document.pointerLockElement || document.mozPointerLockElement || document.webkitPointerLockElement || document.msPointerLockElement; var isPointerlocked = !!pointerLockElement; - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenPointerlockChangeEvent.isActive, 'isPointerlocked', 'i32') }}} + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenPointerlockChangeEvent.isActive, 'isPointerlocked', 'i32') }}}; var nodeName = JSEvents.getNodeNameForTarget(pointerLockElement); var id = (pointerLockElement && pointerLockElement.id) ? pointerLockElement.id : ''; writeStringToMemory(nodeName, eventStruct + {{{ C_STRUCTS.EmscriptenPointerlockChangeEvent.nodeName }}} ); @@ -612,8 +612,8 @@ var LibraryJSEvents = { var visibilityStates = [ "hidden", "visible", "prerender", "unloaded" ]; var visibilityState = visibilityStates.indexOf(document.visibilityState); - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenVisibilityChangeEvent.hidden, 'document.hidden', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenVisibilityChangeEvent.visibilityState, 'visibilityState', 'i32') }}} + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenVisibilityChangeEvent.hidden, 'document.hidden', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenVisibilityChangeEvent.visibilityState, 'visibilityState', 'i32') }}}; }, registerVisibilityChangeEventCallback: function(target, userData, useCapture, callbackfunc, eventTypeId, eventTypeString) { @@ -673,33 +673,33 @@ var LibraryJSEvents = { } var ptr = JSEvents.touchEvent; - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchEvent.ctrlKey, 'e.ctrlKey', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchEvent.shiftKey, 'e.shiftKey', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchEvent.altKey, 'e.altKey', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchEvent.metaKey, 'e.metaKey', 'i32') }}} + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchEvent.ctrlKey, 'e.ctrlKey', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchEvent.shiftKey, 'e.shiftKey', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchEvent.altKey, 'e.altKey', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchEvent.metaKey, 'e.metaKey', 'i32') }}}; ptr += {{{ C_STRUCTS.EmscriptenTouchEvent.touches }}}; // Advance to the start of the touch array. var rect = Module['canvas'].getBoundingClientRect(); var numTouches = 0; for(var i in touches) { var t = touches[i]; - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.identifier, 't.identifier', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.screenX, 't.screenX', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.screenY, 't.screenY', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.clientX, 't.clientX', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.clientY, 't.clientY', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.pageX, 't.pageX', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.pageY, 't.pageY', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.isChanged, 't.changed', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.onTarget, 't.onTarget', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.canvasX, 't.clientX - rect.left', 'i32') }}} - {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.canvasY, 't.clientY - rect.top', 'i32') }}} + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.identifier, 't.identifier', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.screenX, 't.screenX', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.screenY, 't.screenY', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.clientX, 't.clientX', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.clientY, 't.clientY', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.pageX, 't.pageX', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.pageY, 't.pageY', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.isChanged, 't.changed', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.onTarget, 't.onTarget', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.canvasX, 't.clientX - rect.left', 'i32') }}}; + {{{ makeSetValue('ptr', C_STRUCTS.EmscriptenTouchPoint.canvasY, 't.clientY - rect.top', 'i32') }}}; ptr += {{{ C_STRUCTS.EmscriptenTouchPoint.__size__ }}}; if (++numTouches >= 32) { break; } } - {{{ makeSetValue('JSEvents.touchEvent', C_STRUCTS.EmscriptenTouchEvent.numTouches, 'numTouches', 'i32') }}} + {{{ makeSetValue('JSEvents.touchEvent', C_STRUCTS.EmscriptenTouchEvent.numTouches, 'numTouches', 'i32') }}}; var shouldCancel = Runtime.dynCall('iiii', callbackfunc, [eventTypeId, JSEvents.touchEvent, userData]); if (shouldCancel) { @@ -721,20 +721,20 @@ var LibraryJSEvents = { }, fillGamepadEventData: function(eventStruct, e) { - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.timestamp, 'e.timestamp', 'double') }}} + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.timestamp, 'e.timestamp', 'double') }}}; for(var i = 0; i < e.axes.length; ++i) { - {{{ makeSetValue('eventStruct+i*8', C_STRUCTS.EmscriptenGamepadEvent.axis, 'e.axes[i]', 'double') }}} + {{{ makeSetValue('eventStruct+i*8', C_STRUCTS.EmscriptenGamepadEvent.axis, 'e.axes[i]', 'double') }}}; } for(var i = 0; i < e.buttons.length; ++i) { - {{{ makeSetValue('eventStruct+i*8', C_STRUCTS.EmscriptenGamepadEvent.analogButton, 'e.buttons[i].value', 'double') }}} + {{{ makeSetValue('eventStruct+i*8', C_STRUCTS.EmscriptenGamepadEvent.analogButton, 'e.buttons[i].value', 'double') }}}; } for(var i = 0; i < e.buttons.length; ++i) { - {{{ makeSetValue('eventStruct+i*4', C_STRUCTS.EmscriptenGamepadEvent.digitalButton, 'e.buttons[i].pressed', 'i32') }}} + {{{ makeSetValue('eventStruct+i*4', C_STRUCTS.EmscriptenGamepadEvent.digitalButton, 'e.buttons[i].pressed', 'i32') }}}; } - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.connected, 'e.connected', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.index, 'e.index', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.numAxes, 'e.axes.length', 'i32') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.numButtons, 'e.buttons.length', 'i32') }}} + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.connected, 'e.connected', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.index, 'e.index', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.numAxes, 'e.axes.length', 'i32') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.numButtons, 'e.buttons.length', 'i32') }}}; writeStringToMemory(e.id, eventStruct + {{{ C_STRUCTS.EmscriptenGamepadEvent.id }}} ); writeStringToMemory(e.mapping, eventStruct + {{{ C_STRUCTS.EmscriptenGamepadEvent.mapping }}} ); }, @@ -772,7 +772,9 @@ var LibraryJSEvents = { var confirmationMessage = Runtime.dynCall('iiii', callbackfunc, [eventTypeId, 0, userData]); - confirmationMessage = Pointer_stringify(confirmationMessage); + if (confirmationMessage) { + confirmationMessage = Pointer_stringify(confirmationMessage); + } if (confirmationMessage) { e.preventDefault(); e.returnValue = confirmationMessage; @@ -794,10 +796,10 @@ var LibraryJSEvents = { battery: function() { return navigator.battery || navigator.mozBattery || navigator.webkitBattery; }, fillBatteryEventData: function(eventStruct, e) { - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenBatteryEvent.chargingTime, 'e.chargingTime', 'double') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenBatteryEvent.dischargingTime, 'e.dischargingTime', 'double') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenBatteryEvent.level, 'e.level', 'double') }}} - {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenBatteryEvent.charging, 'e.charging', 'i32') }}} + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenBatteryEvent.chargingTime, 'e.chargingTime', 'double') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenBatteryEvent.dischargingTime, 'e.dischargingTime', 'double') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenBatteryEvent.level, 'e.level', 'double') }}}; + {{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenBatteryEvent.charging, 'e.charging', 'i32') }}}; }, registerBatteryEventCallback: function(target, userData, useCapture, callbackfunc, eventTypeId, eventTypeString) { @@ -1158,7 +1160,7 @@ var LibraryJSEvents = { var vibrateList = []; for(var i = 0; i < numEntries; ++i) { - var msecs = {{{ makeGetValue('msecsArray', 'i*4', 'i32') }}} + var msecs = {{{ makeGetValue('msecsArray', 'i*4', 'i32') }}}; vibrateList.push(msecs); } navigator.vibrate(vibrateList); diff --git a/src/library_memfs.js b/src/library_memfs.js index d3148d8b..95c3ae65 100644 --- a/src/library_memfs.js +++ b/src/library_memfs.js @@ -8,7 +8,7 @@ mergeInto(LibraryManager.library, { CONTENT_FLEXIBLE: 2, // has been modified or never set to anything, and is a flexible js array that can grow/shrink CONTENT_FIXED: 3, // contains some fixed-size content written into it, in a typed array mount: function(mount) { - return MEMFS.createNode(null, '/', {{{ cDefine('S_IFDIR') }}} | 0777, 0); + return MEMFS.createNode(null, '/', {{{ cDefine('S_IFDIR') }}} | 511 /* 0777 */, 0); }, createNode: function(parent, name, mode, dev) { if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { @@ -23,7 +23,6 @@ mergeInto(LibraryManager.library, { setattr: MEMFS.node_ops.setattr, lookup: MEMFS.node_ops.lookup, mknod: MEMFS.node_ops.mknod, - mknod: MEMFS.node_ops.mknod, rename: MEMFS.node_ops.rename, unlink: MEMFS.node_ops.unlink, rmdir: MEMFS.node_ops.rmdir, @@ -185,7 +184,7 @@ mergeInto(LibraryManager.library, { return entries; }, symlink: function(parent, newname, oldpath) { - var node = MEMFS.createNode(parent, newname, 0777 | {{{ cDefine('S_IFLNK') }}}, 0); + var node = MEMFS.createNode(parent, newname, 511 /* 0777 */ | {{{ cDefine('S_IFLNK') }}}, 0); node.link = oldpath; return node; }, diff --git a/src/library_sockfs.js b/src/library_sockfs.js index 2028d841..22fd8761 100644 --- a/src/library_sockfs.js +++ b/src/library_sockfs.js @@ -3,7 +3,7 @@ mergeInto(LibraryManager.library, { $SOCKFS__deps: ['$FS', 'mkport'], $SOCKFS: { mount: function(mount) { - return FS.createNode(null, '/', {{{ cDefine('S_IFDIR') }}} | 0777, 0); + return FS.createNode(null, '/', {{{ cDefine('S_IFDIR') }}} | 511 /* 0777 */, 0); }, createSocket: function(family, type, protocol) { var streaming = type == {{{ cDefine('SOCK_STREAM') }}}; diff --git a/src/postamble.js b/src/postamble.js index 382d3117..bb1e334c 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -2,19 +2,21 @@ // === Auto-generated postamble setup entry stuff === if (memoryInitializer) { - function applyData(data) { + if (ENVIRONMENT_IS_NODE || ENVIRONMENT_IS_SHELL) { + var data = Module['readBinary'](memoryInitializer); #if USE_TYPED_ARRAYS == 2 HEAPU8.set(data, STATIC_BASE); #else allocate(data, 'i8', ALLOC_NONE, STATIC_BASE); #endif - } - if (ENVIRONMENT_IS_NODE || ENVIRONMENT_IS_SHELL) { - applyData(Module['readBinary'](memoryInitializer)); } else { addRunDependency('memory initializer'); Browser.asyncLoad(memoryInitializer, function(data) { - applyData(data); +#if USE_TYPED_ARRAYS == 2 + HEAPU8.set(data, STATIC_BASE); +#else + allocate(data, 'i8', ALLOC_NONE, STATIC_BASE); +#endif removeRunDependency('memory initializer'); }, function(data) { throw 'could not load memory initializer ' + memoryInitializer; diff --git a/src/preamble.js b/src/preamble.js index 5038e9c4..27a98422 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -683,6 +683,130 @@ function stringToUTF32(str, outPtr) { Module['stringToUTF32'] = stringToUTF32; function demangle(func) { + var i = 3; + // params, etc. + var basicTypes = { + 'v': 'void', + 'b': 'bool', + 'c': 'char', + 's': 'short', + 'i': 'int', + 'l': 'long', + 'f': 'float', + 'd': 'double', + 'w': 'wchar_t', + 'a': 'signed char', + 'h': 'unsigned char', + 't': 'unsigned short', + 'j': 'unsigned int', + 'm': 'unsigned long', + 'x': 'long long', + 'y': 'unsigned long long', + 'z': '...' + }; + var subs = []; + var first = true; + function dump(x) { + //return; + if (x) Module.print(x); + Module.print(func); + var pre = ''; + for (var a = 0; a < i; a++) pre += ' '; + Module.print (pre + '^'); + } + function parseNested() { + i++; + if (func[i] === 'K') i++; // ignore const + var parts = []; + while (func[i] !== 'E') { + if (func[i] === 'S') { // substitution + i++; + var next = func.indexOf('_', i); + var num = func.substring(i, next) || 0; + parts.push(subs[num] || '?'); + i = next+1; + continue; + } + if (func[i] === 'C') { // constructor + parts.push(parts[parts.length-1]); + i += 2; + continue; + } + var size = parseInt(func.substr(i)); + var pre = size.toString().length; + if (!size || !pre) { i--; break; } // counter i++ below us + var curr = func.substr(i + pre, size); + parts.push(curr); + subs.push(curr); + i += pre + size; + } + i++; // skip E + return parts; + } + function parse(rawList, limit, allowVoid) { // main parser + limit = limit || Infinity; + var ret = '', list = []; + function flushList() { + return '(' + list.join(', ') + ')'; + } + var name; + if (func[i] === 'N') { + // namespaced N-E + name = parseNested().join('::'); + limit--; + if (limit === 0) return rawList ? [name] : name; + } else { + // not namespaced + if (func[i] === 'K' || (first && func[i] === 'L')) i++; // ignore const and first 'L' + var size = parseInt(func.substr(i)); + if (size) { + var pre = size.toString().length; + name = func.substr(i + pre, size); + i += pre + size; + } + } + first = false; + if (func[i] === 'I') { + i++; + var iList = parse(true); + var iRet = parse(true, 1, true); + ret += iRet[0] + ' ' + name + '<' + iList.join(', ') + '>'; + } else { + ret = name; + } + paramLoop: while (i < func.length && limit-- > 0) { + //dump('paramLoop'); + var c = func[i++]; + if (c in basicTypes) { + list.push(basicTypes[c]); + } else { + switch (c) { + case 'P': list.push(parse(true, 1, true)[0] + '*'); break; // pointer + case 'R': list.push(parse(true, 1, true)[0] + '&'); break; // reference + case 'L': { // literal + i++; // skip basic type + var end = func.indexOf('E', i); + var size = end - i; + list.push(func.substr(i, size)); + i += size + 2; // size + 'EE' + break; + } + case 'A': { // array + var size = parseInt(func.substr(i)); + i += size.toString().length; + if (func[i] !== '_') throw '?'; + i++; // skip _ + list.push(parse(true, 1, true)[0] + ' [' + size + ']'); + break; + } + case 'E': break paramLoop; + default: ret += '?' + c; break paramLoop; + } + } + } + if (!allowVoid && list.length === 1 && list[0] === 'void') list = []; // avoid (void) + return rawList ? list : ret + flushList(); + } try { // Special-case the entry point, since its name differs from other name mangling. if (func == 'Object._main' || func == '_main') { @@ -696,130 +820,6 @@ function demangle(func) { case 'n': return 'operator new()'; case 'd': return 'operator delete()'; } - var i = 3; - // params, etc. - var basicTypes = { - 'v': 'void', - 'b': 'bool', - 'c': 'char', - 's': 'short', - 'i': 'int', - 'l': 'long', - 'f': 'float', - 'd': 'double', - 'w': 'wchar_t', - 'a': 'signed char', - 'h': 'unsigned char', - 't': 'unsigned short', - 'j': 'unsigned int', - 'm': 'unsigned long', - 'x': 'long long', - 'y': 'unsigned long long', - 'z': '...' - }; - function dump(x) { - //return; - if (x) Module.print(x); - Module.print(func); - var pre = ''; - for (var a = 0; a < i; a++) pre += ' '; - Module.print (pre + '^'); - } - var subs = []; - function parseNested() { - i++; - if (func[i] === 'K') i++; // ignore const - var parts = []; - while (func[i] !== 'E') { - if (func[i] === 'S') { // substitution - i++; - var next = func.indexOf('_', i); - var num = func.substring(i, next) || 0; - parts.push(subs[num] || '?'); - i = next+1; - continue; - } - if (func[i] === 'C') { // constructor - parts.push(parts[parts.length-1]); - i += 2; - continue; - } - var size = parseInt(func.substr(i)); - var pre = size.toString().length; - if (!size || !pre) { i--; break; } // counter i++ below us - var curr = func.substr(i + pre, size); - parts.push(curr); - subs.push(curr); - i += pre + size; - } - i++; // skip E - return parts; - } - var first = true; - function parse(rawList, limit, allowVoid) { // main parser - limit = limit || Infinity; - var ret = '', list = []; - function flushList() { - return '(' + list.join(', ') + ')'; - } - var name; - if (func[i] === 'N') { - // namespaced N-E - name = parseNested().join('::'); - limit--; - if (limit === 0) return rawList ? [name] : name; - } else { - // not namespaced - if (func[i] === 'K' || (first && func[i] === 'L')) i++; // ignore const and first 'L' - var size = parseInt(func.substr(i)); - if (size) { - var pre = size.toString().length; - name = func.substr(i + pre, size); - i += pre + size; - } - } - first = false; - if (func[i] === 'I') { - i++; - var iList = parse(true); - var iRet = parse(true, 1, true); - ret += iRet[0] + ' ' + name + '<' + iList.join(', ') + '>'; - } else { - ret = name; - } - paramLoop: while (i < func.length && limit-- > 0) { - //dump('paramLoop'); - var c = func[i++]; - if (c in basicTypes) { - list.push(basicTypes[c]); - } else { - switch (c) { - case 'P': list.push(parse(true, 1, true)[0] + '*'); break; // pointer - case 'R': list.push(parse(true, 1, true)[0] + '&'); break; // reference - case 'L': { // literal - i++; // skip basic type - var end = func.indexOf('E', i); - var size = end - i; - list.push(func.substr(i, size)); - i += size + 2; // size + 'EE' - break; - } - case 'A': { // array - var size = parseInt(func.substr(i)); - i += size.toString().length; - if (func[i] !== '_') throw '?'; - i++; // skip _ - list.push(parse(true, 1, true)[0] + ' [' + size + ']'); - break; - } - case 'E': break paramLoop; - default: ret += '?' + c; break paramLoop; - } - } - } - if (!allowVoid && list.length === 1 && list[0] === 'void') list = []; // avoid (void) - return rawList ? list : ret + flushList(); - } return parse(); } catch(e) { return func; @@ -860,33 +860,19 @@ var DYNAMIC_BASE = 0, DYNAMICTOP = 0; // dynamic area handled by sbrk #if USE_TYPED_ARRAYS function enlargeMemory() { #if ALLOW_MEMORY_GROWTH == 0 -#if ASM_JS == 0 abort('Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value ' + TOTAL_MEMORY + ', (2) compile with ALLOW_MEMORY_GROWTH which adjusts the size at runtime but prevents some optimizations, or (3) set Module.TOTAL_MEMORY before the program runs.'); #else - abort('Cannot enlarge memory arrays in asm.js. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value ' + TOTAL_MEMORY + ', or (2) set Module.TOTAL_MEMORY before the program runs.'); -#endif -#else // TOTAL_MEMORY is the current size of the actual array, and DYNAMICTOP is the new top. #if ASSERTIONS - Module.printErr('Warning: Enlarging memory arrays, this is not fast, and ALLOW_MEMORY_GROWTH is not fully tested with all optimizations on! ' + [DYNAMICTOP, TOTAL_MEMORY]); // We perform safe elimination instead of elimination in this mode, but if you see this error, try to disable it and other optimizations entirely + Module.printErr('Warning: Enlarging memory arrays, this is not fast! ' + [DYNAMICTOP, TOTAL_MEMORY]); assert(DYNAMICTOP >= TOTAL_MEMORY); assert(TOTAL_MEMORY > 4); // So the loop below will not be infinite #endif - while (TOTAL_MEMORY <= DYNAMICTOP) { // Simple heuristic. Override enlargeMemory() if your program has something more optimal for it + + while (TOTAL_MEMORY <= DYNAMICTOP) { // Simple heuristic. TOTAL_MEMORY = alignMemoryPage(2*TOTAL_MEMORY); } assert(TOTAL_MEMORY <= Math.pow(2, 30)); // 2^30==1GB is a practical maximum - 2^31 is already close to possible negative numbers etc. -#if USE_TYPED_ARRAYS == 1 - var oldIHEAP = IHEAP; - Module['HEAP'] = Module['IHEAP'] = HEAP = IHEAP = new Int32Array(TOTAL_MEMORY); - IHEAP.set(oldIHEAP); - IHEAPU = new Uint32Array(IHEAP.buffer); -#if USE_FHEAP - var oldFHEAP = FHEAP; - Module['FHEAP'] = FHEAP = new Float64Array(TOTAL_MEMORY); - FHEAP.set(oldFHEAP); -#endif -#endif #if USE_TYPED_ARRAYS == 2 var oldHEAP8 = HEAP8; var buffer = new ArrayBuffer(TOTAL_MEMORY); @@ -899,6 +885,11 @@ function enlargeMemory() { Module['HEAPF32'] = HEAPF32 = new Float32Array(buffer); Module['HEAPF64'] = HEAPF64 = new Float64Array(buffer); HEAP8.set(oldHEAP8); +#else + abort('cannot enlarge memory arrays in non-ta2 modes'); +#endif +#if ASM_JS + _emscripten_replace_memory(HEAP8, HEAP16, HEAP32, HEAPU8, HEAPU16, HEAPU32, HEAPF32, HEAPF64); #endif #endif } @@ -927,7 +918,7 @@ if (totalMemory !== TOTAL_MEMORY) { #if USE_TYPED_ARRAYS // check for full engine support (use string 'subarray' to avoid closure compiler confusion) assert(typeof Int32Array !== 'undefined' && typeof Float64Array !== 'undefined' && !!(new Int32Array(1)['subarray']) && !!(new Int32Array(1)['set']), - 'Cannot fallback to non-typed array case: Code is too specialized'); + 'JS engine does not provide full typed array support'); #if USE_TYPED_ARRAYS == 1 HEAP = IHEAP = new Int32Array(TOTAL_MEMORY); diff --git a/src/proxyClient.js b/src/proxyClient.js index 8f4ad7a6..2d1c76fe 100644 --- a/src/proxyClient.js +++ b/src/proxyClient.js @@ -3,9 +3,39 @@ Module.ctx = Module.canvas.getContext('2d'); +// render + +var renderFrameData = null; + +function renderFrame() { + var dst = Module.canvasData.data; + if (dst.set) { + dst.set(renderFrameData); + } else { + for (var i = 0; i < renderFrameData.length; i++) { + dst[i] = renderFrameData[i]; + } + } + Module.ctx.putImageData(Module.canvasData, 0, 0); + renderFrameData = null; +} + +window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || + window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || + renderFrame; + +// end render + var worker = new Worker('{{{ filename }}}.js'); +var workerResponded = false; + worker.onmessage = function worker_onmessage(event) { + if (!workerResponded) { + workerResponded = true; + if (Module.setStatus) Module.setStatus(''); + } + var data = event.data; switch (data.target) { case 'stdout': { @@ -26,20 +56,18 @@ worker.onmessage = function worker_onmessage(event) { Module.canvas.width = data.width; Module.canvas.height = data.height; Module.canvasData = Module.ctx.getImageData(0, 0, data.width, data.height); - postMessage({ target: 'canvas', boundingClientRect: Module.canvas.getBoundingClientRect() }); + worker.postMessage({ target: 'canvas', boundingClientRect: cloneObject(Module.canvas.getBoundingClientRect()) }); break; } case 'render': { - var src = data.image.data; - var dst = Module.canvasData.data; - if (dst.set) { - dst.set(src); + if (renderFrameData) { + // previous image was not rendered yet, just update image + renderFrameData = data.image.data; } else { - for (var i = 0; i < src.length; i++) { - dst[i] = src[i]; - } + // previous image was rendered so update image and request another frame + renderFrameData = data.image.data; + window.requestAnimationFrame(renderFrame); } - Module.ctx.putImageData(Module.canvasData, 0, 0); break; } default: throw 'eh?'; @@ -50,7 +78,7 @@ worker.onmessage = function worker_onmessage(event) { } }; -function cloneEvent(event) { +function cloneObject(event) { var ret = {}; for (var x in event) { if (x == x.toUpperCase()) continue; @@ -62,20 +90,20 @@ function cloneEvent(event) { ['keydown', 'keyup', 'keypress', 'blur', 'visibilitychange'].forEach(function(event) { document.addEventListener(event, function(event) { - worker.postMessage({ target: 'document', event: cloneEvent(event) }); + worker.postMessage({ target: 'document', event: cloneObject(event) }); event.preventDefault(); }); }); ['unload'].forEach(function(event) { window.addEventListener(event, function(event) { - worker.postMessage({ target: 'window', event: cloneEvent(event) }); + worker.postMessage({ target: 'window', event: cloneObject(event) }); }); }); ['mousedown', 'mouseup', 'mousemove', 'DOMMouseScroll', 'mousewheel', 'mouseout'].forEach(function(event) { Module.canvas.addEventListener(event, function(event) { - worker.postMessage({ target: 'canvas', event: cloneEvent(event) }); + worker.postMessage({ target: 'canvas', event: cloneObject(event) }); event.preventDefault(); }, true); }); diff --git a/src/proxyWorker.js b/src/proxyWorker.js index 5d34b900..cfe0c26e 100644 --- a/src/proxyWorker.js +++ b/src/proxyWorker.js @@ -79,11 +79,13 @@ document.createElement = function document_createElement(what) { } }; -var console = { - log: function(x) { - Module.printErr(x); - } -}; +if (typeof console === 'undefined') { + var console = { + log: function(x) { + Module.printErr(x); + } + }; +} Module.canvas = document.createElement('canvas'); diff --git a/src/runtime.js b/src/runtime.js index a9265e70..fecd3b68 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -336,6 +336,9 @@ var Runtime = { #if ASM_JS if (!args.splice) args = Array.prototype.slice.call(args); args.splice(0, 0, ptr); +#if ASSERTIONS + assert(('dynCall_' + sig) in Module, 'bad function pointer type - no table for sig \'' + sig + '\''); +#endif return Module['dynCall_' + sig].apply(null, args); #else return FUNCTION_TABLE[ptr].apply(null, args); @@ -345,6 +348,9 @@ var Runtime = { assert(sig.length == 1); #endif #if ASM_JS +#if ASSERTIONS + assert(('dynCall_' + sig) in Module, 'bad function pointer type - no table for sig \'' + sig + '\''); +#endif return Module['dynCall_' + sig].call(null, ptr); #else return FUNCTION_TABLE[ptr](); @@ -487,6 +493,19 @@ var Runtime = { } }, +#if RETAIN_COMPILER_SETTINGS + compilerSettings: {}, +#endif + + getCompilerSetting: function(name) { +#if RETAIN_COMPILER_SETTINGS == 0 + throw 'You must build with -s RETAIN_COMPILER_SETTINGS=1 for Runtime.getCompilerSetting or emscripten_get_compiler_setting to work'; +#else + if (!(name in Runtime.compilerSettings)) return 'invalid compiler setting: ' + name; + return Runtime.compilerSettings[name]; +#endif + }, + #if RUNTIME_DEBUG debug: true, // Switch to false at runtime to disable logging at the right times @@ -612,3 +631,12 @@ function reSign(value, bits, ignore) { // Then 'dynamic' memory for sbrk. Runtime.GLOBAL_BASE = Runtime.alignMemory(1); +if (RETAIN_COMPILER_SETTINGS) { + var blacklist = set('RELOOPER', 'STRUCT_INFO'); + for (var x in this) { + try { + if (x[0] !== '_' && !(x in blacklist) && x == x.toUpperCase() && (typeof this[x] === 'number' || typeof this[x] === 'string' || this.isArray())) Runtime.compilerSettings[x] = this[x]; + } catch(e){} + } +} + diff --git a/src/settings.js b/src/settings.js index 1db91dca..c8114059 100644 --- a/src/settings.js +++ b/src/settings.js @@ -315,6 +315,17 @@ var EXPORT_ALL = 0; // If true, we export all the symbols. Note that this does * // still eliminate functions as dead. This just exports them on the Module object. var EXPORT_BINDINGS = 0; // Export all bindings generator functions (prefixed with emscripten_bind_). This // is necessary to use the bindings generator with asm.js +var RETAIN_COMPILER_SETTINGS = 0; // Remembers the values of these settings, and makes them accessible + // through Runtime.getCompilerSetting and emscripten_get_compiler_setting. + // To see what is retained, look for compilerSettings in the generated code. + + +var EMSCRIPTEN_VERSION = ''; // this will contain the emscripten version. you should not modify it. This + // and the following few settings are useful in combination with + // RETAIN_COMPILER_SETTINGS +var OPT_LEVEL = 0; // this will contain the optimization level (-Ox). you should not modify it. +var DEBUG_LEVEL = 0; // this will contain the debug level (-gx). you should not modify it. + // JS library functions (C functions implemented in JS) // that we include by default. If you want to make sure diff --git a/src/utility.js b/src/utility.js index 178c596b..54cc2d69 100644 --- a/src/utility.js +++ b/src/utility.js @@ -200,11 +200,11 @@ function dprint() { printErr(text); } -var PROF_ORIGIN = Date.now(); -var PROF_TIME = PROF_ORIGIN; +var _PROF_ORIGIN = Date.now(); +var _PROF_TIME = _PROF_ORIGIN; function PROF(pass) { if (!pass) { - dprint("Profiling: " + ((Date.now() - PROF_TIME)/1000) + ' seconds, total: ' + ((Date.now() - PROF_ORIGIN)/1000)); + dprint("Profiling: " + ((Date.now() - _PROF_TIME)/1000) + ' seconds, total: ' + ((Date.now() - _PROF_ORIGIN)/1000)); } PROF_TIME = Date.now(); } diff --git a/system/include/emscripten/emscripten.h b/system/include/emscripten/emscripten.h index eb5ded91..b92d920c 100644 --- a/system/include/emscripten/emscripten.h +++ b/system/include/emscripten/emscripten.h @@ -116,6 +116,9 @@ extern void emscripten_async_load_script(const char *script, void (*onload)(), v * asynchronous callbacks, but you must pause the main * loop until they complete. * + * If you want your main loop function to receive a void* + * argument, use emscripten_set_main_loop_arg. + * @simulate_infinite_loop If true, this function will throw an * exception in order to stop execution of the caller. This * will lead to the main loop being entered instead of code @@ -134,6 +137,7 @@ extern void emscripten_async_load_script(const char *script, void (*onload)(), v */ #if EMSCRIPTEN extern void emscripten_set_main_loop(void (*func)(), int fps, int simulate_infinite_loop); +extern void emscripten_set_main_loop_arg(void (*func)(void*), void *arg, int fps, int simulate_infinite_loop); extern void emscripten_pause_main_loop(); extern void emscripten_resume_main_loop(); extern void emscripten_cancel_main_loop(); @@ -420,6 +424,27 @@ int emscripten_get_worker_queue_size(worker_handle worker); #define EMSCRIPTEN_NETWORK_WEBRTC 1 void emscripten_set_network_backend(int backend); +/* + * Returns the value of a compiler setting. For example + * + * emscripten_get_compiler_setting("PRECISE_F32") + * + * will return an integer representing the value of + * PRECISE_F32 during compilation. For values containing + * anything other than an integer, a string is returned + * (you will need to cast the int return value to a char*). + * + * Some useful things this can do is provide the + * version of emscripten ("EMSCRIPTEN_VERSION"), the optimization + * level ("OPT_LEVEL"), debug level ("DEBUG_LEVEL"), etc. + * + * For this command to work, you must build with + * -s RETAIN_COMPILER_SETTINGS=1 + * as otherwise we do not want to increase the build size + * with this metadata. + */ +int emscripten_get_compiler_setting(const char *name); + /* Internal APIs. Be careful with these. */ /* diff --git a/system/include/execinfo.h b/system/include/execinfo.h deleted file mode 100644 index 17cda148..00000000 --- a/system/include/execinfo.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2003 Maxim Sobolev <sobomax@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: execinfo.h,v 1.2 2004/07/19 05:20:29 sobomax Exp $ - */ - -#ifndef COMPAT_EXECINFO_H_INCLUDED -#define COMPAT_EXECINFO_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -int backtrace(void **, int); -char ** backtrace_symbols(void *const *, int); -void backtrace_symbols_fd(void *const *, int, int); - -#ifdef __cplusplus -} -#endif - -#endif /* COMPAT_EXECINFO_H_INCLUDED */ diff --git a/system/include/unwind.h b/system/include/unwind.h deleted file mode 100644 index f8d43d0d..00000000 --- a/system/include/unwind.h +++ /dev/null @@ -1,154 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2003 Hewlett-Packard Co - Contributed by David Mosberger-Tang <davidm@hpl.hp.com> - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifndef _UNWIND_H -#define _UNWIND_H - -/* For uint64_t */ -#include <stdint.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* Minimal interface as per C++ ABI draft standard: - - http://www.codesourcery.com/cxx-abi/abi-eh.html */ - -typedef enum - { - _URC_NO_REASON = 0, - _URC_FOREIGN_EXCEPTION_CAUGHT = 1, - _URC_FATAL_PHASE2_ERROR = 2, - _URC_FATAL_PHASE1_ERROR = 3, - _URC_NORMAL_STOP = 4, - _URC_END_OF_STACK = 5, - _URC_HANDLER_FOUND = 6, - _URC_INSTALL_CONTEXT = 7, - _URC_CONTINUE_UNWIND = 8 - } -_Unwind_Reason_Code; - -typedef int _Unwind_Action; - -#define _UA_SEARCH_PHASE 1 -#define _UA_CLEANUP_PHASE 2 -#define _UA_HANDLER_FRAME 4 -#define _UA_FORCE_UNWIND 8 - -struct _Unwind_Context; /* opaque data-structure */ -struct _Unwind_Exception; /* forward-declaration */ - -typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, - struct _Unwind_Exception *); - -typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int, _Unwind_Action, - uint64_t, - struct _Unwind_Exception *, - struct _Unwind_Context *, - void *); - -/* The C++ ABI requires exception_class, private_1, and private_2 to - be of type uint64 and the entire structure to be - double-word-aligned. Please note that exception_class stays 64-bit - even on 32-bit machines for gcc compatibility. */ -struct _Unwind_Exception - { - uint64_t exception_class; - _Unwind_Exception_Cleanup_Fn exception_cleanup; - unsigned long private_1; - unsigned long private_2; - } __attribute__((__aligned__)); - -extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); -extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, - _Unwind_Stop_Fn, void *); -extern void _Unwind_Resume (struct _Unwind_Exception *); -extern void _Unwind_DeleteException (struct _Unwind_Exception *); -extern unsigned long _Unwind_GetGR (struct _Unwind_Context *, int); -extern void _Unwind_SetGR (struct _Unwind_Context *, int, unsigned long); -extern unsigned long _Unwind_GetIP (struct _Unwind_Context *); -extern unsigned long _Unwind_GetIPInfo (struct _Unwind_Context *, int *); -extern void _Unwind_SetIP (struct _Unwind_Context *, unsigned long); -extern unsigned long _Unwind_GetLanguageSpecificData (struct _Unwind_Context*); -extern unsigned long _Unwind_GetRegionStart (struct _Unwind_Context *); - -#ifdef _GNU_SOURCE - -/* Callback for _Unwind_Backtrace(). The backtrace stops immediately - if the callback returns any value other than _URC_NO_REASON. */ -typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) (struct _Unwind_Context *, - void *); - -/* See http://gcc.gnu.org/ml/gcc-patches/2001-09/msg00082.html for why - _UA_END_OF_STACK exists. */ -# define _UA_END_OF_STACK 16 - -/* If the unwind was initiated due to a forced unwind, resume that - operation, else re-raise the exception. This is used by - __cxa_rethrow(). */ -extern _Unwind_Reason_Code - _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *); - -/* See http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00154.html for why - _Unwind_GetBSP() exists. */ -extern unsigned long _Unwind_GetBSP (struct _Unwind_Context *); - -/* Return the "canonical frame address" for the given context. - This is used by NPTL... */ -extern unsigned long _Unwind_GetCFA (struct _Unwind_Context *); - -/* Return the base-address for data references. */ -extern unsigned long _Unwind_GetDataRelBase (struct _Unwind_Context *); - -/* Return the base-address for text references. */ -extern unsigned long _Unwind_GetTextRelBase (struct _Unwind_Context *); - -/* Call _Unwind_Trace_Fn once for each stack-frame, without doing any - cleanup. The first frame for which the callback is invoked is the - one for the caller of _Unwind_Backtrace(). _Unwind_Backtrace() - returns _URC_END_OF_STACK when the backtrace stopped due to - reaching the end of the call-chain or _URC_FATAL_PHASE1_ERROR if it - stops for any other reason. */ -extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); - -/* Find the start-address of the procedure containing the specified IP - or NULL if it cannot be found (e.g., because the function has no - unwind info). Note: there is not necessarily a one-to-one - correspondence between source-level functions and procedures: some - functions don't have unwind-info and others are split into multiple - procedures. */ -extern void *_Unwind_FindEnclosingFunction (void *); - -/* See also Linux Standard Base Spec: - http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/libgcc-s.html */ - -#endif /* _GNU_SOURCE */ - -#ifdef __cplusplus -}; -#endif - -#endif /* _UNWIND_H */ diff --git a/system/lib/gl.c b/system/lib/gl.c index e6c60956..bbc77437 100644 --- a/system/lib/gl.c +++ b/system/lib/gl.c @@ -1543,11 +1543,13 @@ GLAPI void APIENTRY emscripten_glVertexAttribDivisor (GLuint index, GLuint divis void* emscripten_GetProcAddress(const char *name_) { char *name = malloc(strlen(name_)+1); strcpy(name, name_); - // remove EXT|ARB suffixes + // remove EXT|ARB|OES suffixes char *end = strstr(name, "EXT"); if (end) *end = 0; end = strstr(name, "ARB"); if (end) *end = 0; + end = strstr(name, "OES"); + if (end) *end = 0; // misc renamings if (!strcmp(name, "glCreateProgramObject")) name = "glCreateProgram"; else if (!strcmp(name, "glUseProgramObject")) name = "glUseProgram"; diff --git a/tests/cases/atomicrmw_dec.ll b/tests/cases/atomicrmw_dec.ll new file mode 100644 index 00000000..0ff08a5d --- /dev/null +++ b/tests/cases/atomicrmw_dec.ll @@ -0,0 +1,21 @@ +; ModuleID = 'tests/hello_world.bc' +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32" +target triple = "le32-unknown-nacl" + +@.str = private unnamed_addr constant [15 x i8] c"hello, %d,%d!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] + +; [#uses=0] +define i32 @main() { +entry: + %t = alloca i32, align 4 ; [#uses=2 type=i32**] + store i32 50, i32* %t, align 4 + %0 = load i32* %t + %1 = atomicrmw sub i32* %t, i32 3 seq_cst ; [#uses=0 type=i32] [debug line = 21:12] + %2 = load i32* %t + %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), i32 %0, i32 %2) ; [#uses=0 type=i32] + %3 = atomicrmw volatile add i32* %t, i32 3 seq_cst ; [#uses=0 type=i32] [debug line = 21:12] + ret i32 1 +} + +; [#uses=1] +declare i32 @printf(i8*, ...) diff --git a/tests/cases/atomicrmw_dec.txt b/tests/cases/atomicrmw_dec.txt new file mode 100644 index 00000000..e8dcb406 --- /dev/null +++ b/tests/cases/atomicrmw_dec.txt @@ -0,0 +1 @@ +hello, 50,47! diff --git a/tests/cases/boolret_fastcomp.ll b/tests/cases/boolret_fastcomp.ll new file mode 100644 index 00000000..a20cd001 --- /dev/null +++ b/tests/cases/boolret_fastcomp.ll @@ -0,0 +1,31 @@ +; ModuleID = 'tests/hello_world.bc' +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32" +target triple = "le32-unknown-nacl" + +@.str = private unnamed_addr constant [15 x i8] c"helloworld%d.\0A\00", align 1 + +define i1 @boolretter() { + ret i1 -1 +} + +define i8 @smallretter() { + ret i8 -1 +} + +define i32 @main() { +entry: + %retval = alloca i32, align 4 ; [#uses=1 type=i32*] + store i32 0, i32* %retval + %bool = call i1 ()* @boolretter() + %combined = xor i1 %bool, 1 + %int = select i1 %combined, i32 20, i32 30 + %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), i32 %int) + %small = call i8 ()* @smallretter() + %bcombined = xor i8 %small, 1 + %bcheck = icmp eq i8 %bcombined, 255 + %bint = select i1 %bcheck, i32 20, i32 30 + %bcall = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), i32 %bint) + ret i32 1 +} + +declare i32 @printf(i8*, ...) diff --git a/tests/cases/boolret_fastcomp.txt b/tests/cases/boolret_fastcomp.txt new file mode 100644 index 00000000..e1ad61ab --- /dev/null +++ b/tests/cases/boolret_fastcomp.txt @@ -0,0 +1,2 @@ +helloworld30. +helloworld30. diff --git a/tests/cases/dollar.ll b/tests/cases/dollar.ll new file mode 100644 index 00000000..7d730d6a --- /dev/null +++ b/tests/cases/dollar.ll @@ -0,0 +1,22 @@ +; ModuleID = 'tests/hello_world.bc' +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32" +target triple = "le32-unknown-nacl" + +@.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] + +define void @"dollar$"() { + %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ; [#uses=0 type=i32] + ret void +} + +; [#uses=0] +define i32 @main() { +entry: + %retval = alloca i32, align 4 ; [#uses=1 type=i32*] + store i32 0, i32* %retval + call void ()* @"dollar$"() + ret i32 1 +} + +; [#uses=1] +declare i32 @printf(i8*, ...) diff --git a/tests/cases/i96_ashr_ta2.ll b/tests/cases/i96_ashr_ta2.ll new file mode 100644 index 00000000..83966168 --- /dev/null +++ b/tests/cases/i96_ashr_ta2.ll @@ -0,0 +1,35 @@ +; ModuleID = 'tests/hello_world.bc' +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32" +target triple = "le32-unknown-nacl" + +@.str = private unnamed_addr constant [23 x i8] c"hello..world!%x,%x,%x\0A\00", align 1 + +; [#uses=0] +define i32 @main() { +entry: + %a = trunc i128 5634002668910802268259393791 to i96 + %x = trunc i96 %a to i32 + %y0 = lshr i96 %a, 32 + %y = trunc i96 %y0 to i32 + %z0 = lshr i96 %a, 64 + %z = trunc i96 %z0 to i32 + %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([23 x i8]* @.str, i32 0, i32 0), i32 %x, i32 %y, i32 %z) ; [#uses=0 type=i32] + %b = lshr i96 78981949996569583556032504063, 17 + %bx = trunc i96 %b to i32 + %by0 = lshr i96 %b, 32 + %by = trunc i96 %by0 to i32 + %bz0 = lshr i96 %b, 64 + %bz = trunc i96 %bz0 to i32 + %bcall = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([23 x i8]* @.str, i32 0, i32 0), i32 %bx, i32 %by, i32 %bz) ; [#uses=0 type=i32] + %c = ashr i96 78981949996569583556032504063, 17 + %cx = trunc i96 %c to i32 + %cy0 = lshr i96 %c, 32 + %cy = trunc i96 %cy0 to i32 + %cz0 = lshr i96 %c, 64 + %cz = trunc i96 %cz0 to i32 + %ccall = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([23 x i8]* @.str, i32 0, i32 0), i32 %cx, i32 %cy, i32 %cz) ; [#uses=0 type=i32] + ret i32 1 +} + +; [#uses=1] +declare i32 @printf(i8*, ...) diff --git a/tests/cases/i96_ashr_ta2.txt b/tests/cases/i96_ashr_ta2.txt new file mode 100644 index 00000000..dbbcf911 --- /dev/null +++ b/tests/cases/i96_ashr_ta2.txt @@ -0,0 +1,3 @@ +hello..world!2468a0ff,abcdefdc,12345678 +hello..world!f7ee1234,2b3c55e6,7f9a +hello..world!f7ee1234,2b3c55e6,ffffff9a diff --git a/tests/cases/ptrtoint_blockaddr.ll b/tests/cases/ptrtoint_blockaddr.ll index 68b29300..6adc2c5b 100644 --- a/tests/cases/ptrtoint_blockaddr.ll +++ b/tests/cases/ptrtoint_blockaddr.ll @@ -1,8 +1,12 @@ +; ModuleID = 'tests/hello_world.bc' +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32" +target triple = "le32-unknown-nacl" + @.str = private constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1] -define linkonce_odr i32* @main() align 2 { - %199 = trunc i8 1 to i1 ; [#uses=1] - br i1 %199, label %label555, label %label569 +define linkonce_odr i32 @main() align 2 { + %a199 = trunc i8 1 to i1 ; [#uses=1] + br i1 %a199, label %label555, label %label569 label555: ; preds = %353 br label %label569 @@ -10,9 +14,9 @@ label555: ; preds = %353 br label %label569 label569: ; preds = %555 - %333 = call i32 @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ; [#uses=0] + %a333 = call i32 @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ; [#uses=0] ; this should compile ok - store i32 ptrtoint (i8* blockaddress(@main, %label569) to i32), i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), align 8 + store i32 ptrtoint (i8* blockaddress(@main, %label569) to i32), i32* bitcast (i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0) to i32*), align 8 ret i32 0 } diff --git a/tests/core/emscripten_get_compiler_setting.c b/tests/core/emscripten_get_compiler_setting.c new file mode 100644 index 00000000..41eb8e38 --- /dev/null +++ b/tests/core/emscripten_get_compiler_setting.c @@ -0,0 +1,11 @@ +#include <stdio.h> +#include <assert.h> +#include <emscripten.h> + +int main() { + printf("QS: %d\n", emscripten_get_compiler_setting("QUANTUM_SIZE")); + assert((unsigned)emscripten_get_compiler_setting("OPT_LEVEL") <= 3); + assert((unsigned)emscripten_get_compiler_setting("DEBUG_LEVEL") <= 4); + printf("EV: %s\n", (char*)emscripten_get_compiler_setting("EMSCRIPTEN_VERSION")); +} + diff --git a/tests/core/emscripten_get_compiler_setting.out b/tests/core/emscripten_get_compiler_setting.out new file mode 100644 index 00000000..cd520064 --- /dev/null +++ b/tests/core/emscripten_get_compiler_setting.out @@ -0,0 +1,2 @@ +QS: 4 +EV: waka diff --git a/tests/emscripten_api_browser.cpp b/tests/emscripten_api_browser.cpp index 18046ca3..a03b71ed 100644 --- a/tests/emscripten_api_browser.cpp +++ b/tests/emscripten_api_browser.cpp @@ -31,6 +31,18 @@ void five(void *arg) { emscripten_resume_main_loop(); } +void argey(void* arg) { + static int counter = 0; + assert((int)arg == 17); + counter++; + printf("argey: %d\n", counter); + if (counter == 5) { + emscripten_cancel_main_loop(); + int result = 1; + REPORT_RESULT(); + } +} + void mainey() { static int counter = 0; printf("mainey: %d\n", counter++); @@ -45,8 +57,8 @@ void mainey() { assert(pre1ed); assert(pre2ed); printf("Good!\n"); - int result = 1; - REPORT_RESULT(); + emscripten_cancel_main_loop(); + emscripten_set_main_loop_arg(argey, (void*)17, 0, 0); } } diff --git a/tests/fuzz/18.cpp b/tests/fuzz/18.cpp new file mode 100644 index 00000000..b27aac1b --- /dev/null +++ b/tests/fuzz/18.cpp @@ -0,0 +1,1125 @@ +/* + * This is a RANDOMLY GENERATED PROGRAM. + * + * Generator: csmith 2.2.0 + * Git version: bf42ffd + * Options: --no-volatiles --no-packed-struct --lang-cpp + * Seed: 2604553870 + */ + +#include "csmith.h" + + +static long __undefined; + +/* --- Struct/Union Declarations --- */ +struct S0 { + unsigned f0 : 21; + uint8_t f1; + const unsigned f2 : 30; + unsigned f3 : 8; + signed f4 : 13; + unsigned f5 : 5; + unsigned f6 : 18; + unsigned f7 : 3; +}; + +struct S1 { + const int32_t f0; + unsigned f1 : 9; + unsigned f2 : 16; +}; + +struct S2 { + int32_t f0; + int64_t f1; +}; + +/* --- GLOBAL VARIABLES --- */ +static int32_t g_2 = 9L; +static int16_t g_27 = 0x03BEL; +static int16_t g_38 = 6L; +static int16_t *g_37[8][8] = {{&g_38,NULL,&g_38,&g_38,NULL,&g_38,&g_38,&g_38},{&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,NULL,&g_38},{&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38},{&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38},{&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38},{&g_38,NULL,&g_38,&g_38,NULL,&g_38,&g_38,&g_38},{&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38},{&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38}}; +static int32_t g_62 = 0x3DA513E6L; +static int32_t *g_61 = &g_62; +static uint16_t g_68 = 0xCE71L; +static uint8_t g_78 = 0x1DL; +static uint32_t g_114 = 0x200BAF9CL; +static struct S2 g_121 = {0x5C255F5DL,-10L}; +static uint64_t g_159 = 0UL; +static uint16_t g_161 = 0x490DL; +static uint8_t g_184 = 8UL; +static uint32_t g_187 = 0x30F3DA43L; +static int32_t g_202 = 0x4816DB70L; +static uint64_t g_203 = 18446744073709551615UL; +static struct S1 g_208 = {0xB9C60537L,10,69}; +static uint32_t g_215 = 0x25330C45L; +static int32_t g_239 = 9L; +static int8_t g_240 = 3L; +static int16_t g_241[4] = {0xD26EL,0xD26EL,0xD26EL,0xD26EL}; +static int64_t g_242 = 7L; +static uint16_t g_244[3] = {65534UL,65534UL,65534UL}; +static struct S2 g_291[4][6] = {{{0L,0x2B7545660DAF5139LL},{-3L,0L},{0L,0x2B7545660DAF5139LL},{-3L,0L},{0L,0x2B7545660DAF5139LL},{-3L,0L}},{{0x468E1691L,0x9955880D6DFFD78ALL},{-3L,0L},{0x468E1691L,0x9955880D6DFFD78ALL},{-3L,0L},{0x468E1691L,0x9955880D6DFFD78ALL},{-3L,0L}},{{0L,0x2B7545660DAF5139LL},{-3L,0L},{0L,0x2B7545660DAF5139LL},{-3L,0L},{0L,0x2B7545660DAF5139LL},{-3L,0L}},{{0x468E1691L,0x9955880D6DFFD78ALL},{-3L,0L},{0x468E1691L,0x9955880D6DFFD78ALL},{-3L,0L},{0x468E1691L,0x9955880D6DFFD78ALL},{-3L,0L}}}; +static uint64_t g_323 = 1UL; +static int64_t *g_379 = &g_242; +static int64_t **g_378[4] = {&g_379,&g_379,&g_379,&g_379}; +static const int32_t *g_385 = &g_291[0][1].f0; +static int32_t g_386[4] = {0L,0L,0L,0L}; +static struct S0 g_408 = {1391,0xFDL,15322,15,20,0,166,1}; +static struct S0 * const g_414 = &g_408; +static struct S0 * const *g_413[3][5] = {{NULL,NULL,&g_414,NULL,NULL},{&g_414,NULL,&g_414,&g_414,NULL},{NULL,&g_414,&g_414,NULL,&g_414}}; +static int32_t g_467 = 0x3F4F500CL; +static uint32_t g_468 = 3UL; +static int32_t g_476 = (-7L); +static uint8_t *g_553 = &g_184; +static uint8_t **g_552[9][3] = {{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553}}; +static int64_t * const **g_561 = NULL; +static int64_t g_565 = 0L; +static uint16_t *g_569 = &g_68; +static uint16_t * const *g_568 = &g_569; +static struct S2 *g_589 = &g_291[0][1]; +static struct S0 g_605 = {1424,0xCBL,22754,10,-53,2,290,0}; +static int8_t g_706 = 8L; +static uint32_t *g_708 = &g_114; +static uint32_t **g_707 = &g_708; +static uint64_t g_721 = 0xC18F15E9DB4D38A5LL; +static uint32_t g_732[5] = {4UL,4UL,4UL,4UL,4UL}; + + +/* --- FORWARD DECLARATIONS --- */ +static uint16_t func_1(void); +static struct S1 func_11(uint64_t p_12, struct S0 p_13, int32_t p_14, int32_t p_15); +static int8_t func_18(int16_t p_19, struct S0 p_20, const struct S0 p_21, uint8_t p_22); +static struct S0 func_24(const int16_t p_25); +static const struct S0 func_32(int16_t * p_33, int16_t * p_34, int16_t * p_35, uint32_t p_36); +static int16_t * func_39(int16_t * p_40, struct S2 p_41, const int16_t p_42); +static struct S2 func_43(uint64_t p_44, int8_t p_45, int64_t p_46, const int16_t * p_47, int32_t p_48); +static uint64_t func_49(int16_t * p_50, int16_t * p_51, uint8_t p_52); +static int16_t * func_53(uint8_t p_54); +static const int32_t * func_63(uint16_t p_64, uint32_t p_65); + + +/* --- FUNCTIONS --- */ +/* ------------------------------------------ */ +/* + * reads : g_2 g_37 g_38 g_68 g_62 g_78 g_61 g_114 g_121 g_159 g_187 g_203 g_215 g_161 g_244 g_202 g_241 g_242 g_208 g_323 g_378 g_291.f0 g_386 g_385 g_184 g_413 g_379 g_240 g_569 g_408.f1 g_565 g_706 g_707 g_568 g_467 g_721 g_732 g_408.f0 g_708 g_476 g_589 g_291 + * writes: g_2 g_27 g_61 g_68 g_78 g_62 g_114 g_38 g_121.f1 g_121.f0 g_159 g_161 g_187 g_203 g_215 g_244 g_184 g_242 g_291 g_323 g_378 g_385 g_413 g_240 g_552 g_589 g_467 g_241 g_721 g_732 g_476 g_706 + */ +static uint16_t func_1(void) +{ /* block id: 0 */ + int32_t l_23 = 0x5ECCE35AL; + int16_t *l_55 = &g_38; + const int32_t l_409 = (-1L); + int8_t l_740[6]; + struct S0 l_770[6][4] = {{{194,0x1EL,26558,5,45,3,258,0},{560,246UL,5062,13,1,2,403,1},{194,0x1EL,26558,5,45,3,258,0},{194,0x1EL,26558,5,45,3,258,0}},{{560,246UL,5062,13,1,2,403,1},{560,246UL,5062,13,1,2,403,1},{426,7UL,3307,9,-84,3,210,1},{560,246UL,5062,13,1,2,403,1}},{{560,246UL,5062,13,1,2,403,1},{194,0x1EL,26558,5,45,3,258,0},{194,0x1EL,26558,5,45,3,258,0},{560,246UL,5062,13,1,2,403,1}},{{194,0x1EL,26558,5,45,3,258,0},{560,246UL,5062,13,1,2,403,1},{194,0x1EL,26558,5,45,3,258,0},{194,0x1EL,26558,5,45,3,258,0}},{{560,246UL,5062,13,1,2,403,1},{560,246UL,5062,13,1,2,403,1},{426,7UL,3307,9,-84,3,210,1},{560,246UL,5062,13,1,2,403,1}},{{560,246UL,5062,13,1,2,403,1},{194,0x1EL,26558,5,45,3,258,0},{194,0x1EL,26558,5,45,3,258,0},{560,246UL,5062,13,1,2,403,1}}}; + int i, j; + for (i = 0; i < 6; i++) + l_740[i] = 0L; + for (g_2 = 0; (g_2 >= (-27)); g_2--) + { /* block id: 3 */ + int16_t *l_26 = &g_27; + int32_t l_738[1][3]; + int32_t *l_792[9][5]; + int i, j; + for (i = 0; i < 1; i++) + { + for (j = 0; j < 3; j++) + l_738[i][j] = 0x140016D3L; + } + for (i = 0; i < 9; i++) + { + for (j = 0; j < 5; j++) + l_792[i][j] = &g_291[0][1].f0; + } + l_23 = (safe_mod_func_int32_t_s_s((safe_rshift_func_int16_t_s_s((safe_div_func_int16_t_s_s((0xFDEB7727L != (func_11((safe_mul_func_int8_t_s_s(func_18(l_23, func_24(((*l_26) = 1L)), func_32(g_37[1][3], l_26, func_39(&g_38, func_43(func_49(func_53((NULL != l_55)), &g_38, g_38), g_386[0], l_23, &g_241[2], l_23), l_409), l_738[0][1]), l_740[4]), g_386[2])), l_770[4][1], l_770[4][1].f2, l_738[0][1]) , (*g_385))), l_738[0][1])), l_738[0][0])), l_770[4][1].f0)); + } + return l_740[0]; +} + + +/* ------------------------------------------ */ +/* + * reads : g_589 g_291 g_467 g_208 + * writes: g_291 g_467 + */ +static struct S1 func_11(uint64_t p_12, struct S0 p_13, int32_t p_14, int32_t p_15) +{ /* block id: 356 */ + int32_t *l_774 = NULL; + int32_t *l_775 = &g_386[3]; + int32_t l_776 = (-4L); + int32_t *l_777 = &g_476; + int32_t *l_778 = &g_386[3]; + int32_t *l_779 = &g_291[0][1].f0; + int32_t *l_780 = &g_467; + int32_t *l_781 = &g_121.f0; + int32_t *l_782 = NULL; + int32_t *l_783 = NULL; + int32_t *l_784 = &g_121.f0; + int32_t *l_785 = &l_776; + int32_t *l_786 = &g_386[3]; + int32_t *l_787 = &g_476; + int32_t *l_788[5]; + uint32_t l_789 = 4294967295UL; + int i; + for (i = 0; i < 5; i++) + l_788[i] = &g_467; + (*g_589) = (*g_589); + for (g_467 = (-24); (g_467 >= (-17)); g_467 = safe_add_func_int16_t_s_s(g_467, 2)) + { /* block id: 360 */ + struct S2 l_773 = {7L,0L}; + (*g_589) = l_773; + } + l_789--; + return g_208; +} + + +/* ------------------------------------------ */ +/* + * reads : g_408.f0 g_708 g_114 g_467 g_476 g_408.f1 g_61 g_386 + * writes: g_476 g_240 g_706 g_62 g_61 + */ +static int8_t func_18(int16_t p_19, struct S0 p_20, const struct S0 p_21, uint8_t p_22) +{ /* block id: 344 */ + int16_t l_743[9] = {(-1L),(-1L),(-1L),(-1L),(-1L),(-1L),(-1L),(-1L),(-1L)}; + int32_t l_752 = (-4L); + int32_t *l_753 = &g_476; + struct S2 **l_758 = &g_589; + int8_t *l_759 = NULL; + int8_t *l_760 = &g_240; + int8_t *l_761 = NULL; + int8_t *l_762 = &g_706; + int32_t l_763[5][9] = {{0x84E88DC3L,0x30E877D1L,0x84E88DC3L,0x128A5967L,0x128A5967L,0x84E88DC3L,0x30E877D1L,0x84E88DC3L,0x128A5967L},{0x84E88DC3L,0x128A5967L,0x128A5967L,0x84E88DC3L,0x30E877D1L,0x84E88DC3L,0x128A5967L,0x128A5967L,0x84E88DC3L},{0x8A917A69L,0x128A5967L,0L,0x128A5967L,0x8A917A69L,0x8A917A69L,0x128A5967L,0L,0x128A5967L},{0x128A5967L,0x30E877D1L,0L,0L,0x30E877D1L,0x128A5967L,0x30E877D1L,0L,0L},{0x8A917A69L,0x8A917A69L,0x128A5967L,0L,0x128A5967L,0x8A917A69L,0x8A917A69L,0x128A5967L,0L}}; + int32_t *l_764 = &g_62; + uint32_t *l_765[3]; + uint16_t l_766 = 0xF503L; + int32_t **l_769 = &g_61; + int i, j; + for (i = 0; i < 3; i++) + l_765[i] = &g_187; + (*l_764) = (l_763[4][6] = (((safe_add_func_uint16_t_u_u(l_743[0], (!((l_743[6] > ((safe_div_func_uint64_t_u_u((safe_add_func_uint32_t_u_u(l_743[8], (((*l_762) = ((*l_760) = ((safe_lshift_func_int16_t_s_u(((p_21.f3 < (safe_mod_func_int64_t_s_s(((((*l_753) = (l_752 = p_20.f1)) <= (safe_div_func_int8_t_s_s((safe_mod_func_int16_t_s_s(0xB8ECL, (p_20.f2 | ((((g_408.f0 , ((((p_21.f2 , p_21.f0) != (*g_708)) != 0x4E7498EBL) , l_758)) == NULL) , 0L) , 0xBFE5L)))), 0x90L))) != 0xE0L), g_467))) , (*l_753)), 14)) && 65535UL))) & g_408.f1))), 1L)) < l_743[0])) ^ p_20.f2)))) ^ 0L) >= l_743[0])); + (*l_769) = &g_386[2]; + return (**l_769); +} + + +/* ------------------------------------------ */ +/* + * reads : + * writes: + */ +static struct S0 func_24(const int16_t p_25) +{ /* block id: 5 */ + uint8_t l_28 = 1UL; + struct S0 l_31 = {1310,250UL,6302,7,41,3,97,1}; + --l_28; + return l_31; +} + + +/* ------------------------------------------ */ +/* + * reads : + * writes: + */ +static const struct S0 func_32(int16_t * p_33, int16_t * p_34, int16_t * p_35, uint32_t p_36) +{ /* block id: 342 */ + const struct S0 l_739[6][2] = {{{320,0x7AL,32637,2,-27,2,378,0},{320,0x7AL,32637,2,-27,2,378,0}},{{320,0x7AL,32637,2,-27,2,378,0},{320,0x7AL,32637,2,-27,2,378,0}},{{320,0x7AL,32637,2,-27,2,378,0},{320,0x7AL,32637,2,-27,2,378,0}},{{320,0x7AL,32637,2,-27,2,378,0},{320,0x7AL,32637,2,-27,2,378,0}},{{320,0x7AL,32637,2,-27,2,378,0},{320,0x7AL,32637,2,-27,2,378,0}},{{320,0x7AL,32637,2,-27,2,378,0},{320,0x7AL,32637,2,-27,2,378,0}}}; + int i, j; + return l_739[2][1]; +} + + +/* ------------------------------------------ */ +/* + * reads : g_385 g_62 g_2 g_68 g_184 g_413 g_244 g_208.f0 g_121.f0 g_61 g_114 g_379 g_240 g_291.f0 g_569 g_242 g_121.f1 g_408.f1 g_38 g_241 g_565 g_706 g_707 g_568 g_467 g_721 g_732 + * writes: g_68 g_61 g_184 g_413 g_78 g_121.f0 g_242 g_240 g_215 g_38 g_244 g_552 g_589 g_467 g_241 g_721 g_732 + */ +static int16_t * func_39(int16_t * p_40, struct S2 p_41, const int16_t p_42) +{ /* block id: 206 */ + struct S0 *l_412 = &g_408; + struct S0 ** const l_411 = &l_412; + int32_t l_433 = 0x4FB4C694L; + struct S2 l_438 = {-10L,1L}; + int32_t l_485 = 0x47EB926BL; + int32_t l_489 = (-5L); + int32_t l_491 = (-5L); + int32_t l_497[1][2][7] = {{{1L,0x49C8437AL,0x027D64C9L,0x027D64C9L,0x49C8437AL,1L,0x49C8437AL},{0L,1L,1L,0L,0x49C8437AL,0L,1L}}}; + int16_t l_566 = (-6L); + int64_t **l_571 = &g_379; + uint8_t *l_616 = &g_78; + const struct S1 l_690 = {8L,21,198}; + struct S2 *l_701[10][4]; + uint64_t *l_704 = &g_159; + uint64_t **l_703 = &l_704; + uint32_t l_715 = 0x9F38D7D3L; + int32_t l_718 = 0x12E69001L; + int8_t l_719 = 0xD2L; + int32_t *l_724 = &g_121.f0; + int32_t *l_725 = &g_476; + int32_t *l_726[4][7] = {{&g_291[0][1].f0,&l_497[0][0][3],&l_497[0][0][3],&g_291[0][1].f0,&l_497[0][0][3],&l_497[0][0][3],&g_291[0][1].f0},{&g_476,&l_497[0][0][3],&g_476,&g_386[0],&l_491,&g_386[0],&g_476},{&g_291[0][1].f0,&g_291[0][1].f0,&l_485,&g_291[0][1].f0,&g_291[0][1].f0,&l_485,&g_291[0][1].f0},{&l_491,&g_386[0],&g_476,&l_497[0][0][3],&g_476,&g_386[0],&l_491}}; + int8_t l_727 = 0x0FL; + int32_t l_728 = 0x918BB4DCL; + int8_t l_729 = (-1L); + int64_t l_730 = 0x057B8866389C3D9ALL; + int32_t l_731 = 0x218CCC61L; + uint32_t l_735[3][8] = {{4UL,0xC3126DF4L,4294967288UL,0x0F3DCF02L,4294967295UL,0x220CCB51L,4294967295UL,0x0F3DCF02L},{0x3C85B5A0L,0x3828014FL,0x3C85B5A0L,0xAB1F2D4FL,0x0F3DCF02L,0x220CCB51L,4294967288UL,4294967288UL},{4294967288UL,0xC3126DF4L,4UL,4UL,0xC3126DF4L,4294967288UL,0x0F3DCF02L,4294967295UL}}; + int i, j, k; + for (i = 0; i < 10; i++) + { + for (j = 0; j < 4; j++) + l_701[i][j] = &g_121; + } + if ((*g_385)) + { /* block id: 207 */ + const int64_t l_425 = 0L; + int64_t l_445[1][7][8] = {{{6L,0x5503377F6E0C2E72LL,0xDB1D715F2161BBA0LL,8L,0xC2EEBBADC442C092LL,8L,0xDB1D715F2161BBA0LL,0x5503377F6E0C2E72LL},{0L,0xDB1D715F2161BBA0LL,(-1L),8L,0x9650F0EF7A1B8096LL,0xE43D72817AE39055LL,0xE43D72817AE39055LL,0x9650F0EF7A1B8096LL},{(-9L),0x9650F0EF7A1B8096LL,0x9650F0EF7A1B8096LL,(-9L),0L,0x5503377F6E0C2E72LL,0xE43D72817AE39055LL,6L},{0xDB1D715F2161BBA0LL,(-9L),(-1L),0xE43D72817AE39055LL,(-1L),(-9L),0xDB1D715F2161BBA0LL,0xC2EEBBADC442C092LL},{(-1L),(-9L),0xDB1D715F2161BBA0LL,0xC2EEBBADC442C092LL,0x5503377F6E0C2E72LL,0x5503377F6E0C2E72LL,0xC2EEBBADC442C092LL,0xDB1D715F2161BBA0LL},{0x9650F0EF7A1B8096LL,0x9650F0EF7A1B8096LL,(-9L),0L,0x5503377F6E0C2E72LL,0xE43D72817AE39055LL,6L,0xE43D72817AE39055LL},{(-1L),0xDB1D715F2161BBA0LL,0L,0xDB1D715F2161BBA0LL,(-1L),8L,0x9650F0EF7A1B8096LL,0xE43D72817AE39055LL}}}; + int32_t l_456 = 0xF544D161L; + int32_t l_457 = (-3L); + int32_t l_472 = 0x70112BE4L; + int32_t l_473 = (-3L); + int32_t l_474 = (-8L); + int32_t l_482 = 3L; + int32_t l_487 = 0xF8FC29F0L; + int32_t l_488 = 1L; + int32_t l_495 = 0x89F792B4L; + int32_t l_499 = 7L; + int32_t l_501 = 8L; + int32_t l_503[8][4] = {{4L,(-1L),(-1L),4L},{0x45F54343L,0xC77ACF08L,0x5D3F1EBDL,(-1L)},{0xC77ACF08L,0x923204FEL,1L,(-1L)},{(-1L),0x45F54343L,(-1L),(-1L)},{9L,0x923204FEL,9L,(-1L)},{4L,0xC77ACF08L,9L,4L},{(-1L),(-1L),0x5D3F1EBDL,0xC77ACF08L},{(-1L),0x923204FEL,0x5D3F1EBDL,0x5D3F1EBDL}}; + int8_t l_508 = (-1L); + const int64_t *l_537 = &l_438.f1; + const int64_t **l_536 = &l_537; + uint8_t *l_540[1][10] = {{&g_184,&g_184,NULL,&g_184,NULL,&g_184,&g_184,NULL,&g_184,NULL}}; + struct S1 l_567[5] = {{0x8D6E23A6L,16,120},{0x8D6E23A6L,16,120},{0x8D6E23A6L,16,120},{0x8D6E23A6L,16,120},{0x8D6E23A6L,16,120}}; + int64_t l_572[6][1][3]; + struct S0 *l_603 = &g_408; + struct S0 *l_618 = &g_605; + int16_t l_624 = 0xB59DL; + int8_t *l_683 = &g_240; + struct S2 **l_700[2][3][2] = {{{&g_589,&g_589},{&g_589,&g_589},{&g_589,&g_589}},{{&g_589,&g_589},{&g_589,&g_589},{&g_589,&g_589}}}; + int16_t *l_702[4][1]; + int8_t *l_705 = &l_508; + int i, j, k; + for (i = 0; i < 6; i++) + { + for (j = 0; j < 1; j++) + { + for (k = 0; k < 3; k++) + l_572[i][j][k] = 0xD283F39FEC0527E5LL; + } + } + for (i = 0; i < 4; i++) + { + for (j = 0; j < 1; j++) + l_702[i][j] = &g_241[3]; + } + for (g_68 = 0; (g_68 <= 3); g_68 += 1) + { /* block id: 210 */ + int32_t **l_410 = &g_61; + struct S0 **l_421[3][5] = {{&l_412,&l_412,&l_412,&l_412,&l_412},{&l_412,&l_412,&l_412,&l_412,&l_412},{&l_412,&l_412,&l_412,&l_412,&l_412}}; + struct S1 l_442 = {0x8A5D5689L,10,57}; + uint64_t l_448 = 0x6347FF966CC3914CLL; + int32_t l_471 = 1L; + int32_t l_478 = 8L; + int32_t l_480 = 0xFA8E425CL; + int32_t l_483 = 0x315C4785L; + int32_t l_484 = 0x680B5AEDL; + int32_t l_490 = 0xE692470BL; + int32_t l_496 = 0L; + int32_t l_498 = (-1L); + int32_t l_500 = 0x95A5B8D0L; + int32_t l_502 = 0L; + int32_t l_504 = 0L; + int32_t l_505 = 0x05779FDBL; + int32_t l_506 = 0x918B72A4L; + int32_t l_507 = 0x2EA2263BL; + int32_t l_510 = 0xE311EADEL; + int32_t l_511 = 0x75ECBCB0L; + int32_t l_512 = 0x1C2CC190L; + int32_t l_513 = 0L; + int32_t l_514 = 6L; + int32_t l_515 = 0x0937537CL; + int32_t l_517 = 0x3441E561L; + int32_t l_518 = 0xC823A3FCL; + int32_t l_519 = 0x90011C2FL; + int32_t l_520 = 0x341C22D6L; + int32_t l_521 = 0x5CAAD854L; + int32_t l_522 = (-10L); + int32_t l_523 = 0x049BF5F2L; + int32_t l_524 = (-8L); + uint16_t l_525 = 65535UL; + int64_t ***l_590 = &g_378[0]; + int64_t l_629 = 0x46CA53608441CAF0LL; + int16_t l_677 = 0L; + uint8_t **l_681 = &l_540[0][2]; + int i, j; + (*l_410) = &g_2; + for (g_184 = 0; (g_184 <= 2); g_184 += 1) + { /* block id: 214 */ + struct S0 * const **l_415 = NULL; + struct S0 * const **l_416[6]; + uint8_t *l_424 = &g_78; + int32_t *l_426[2]; + uint64_t *l_462 = &g_159; + uint64_t *l_463 = &g_159; + int16_t l_493 = 0x6E98L; + int8_t l_494 = 0xF3L; + int64_t l_509 = 0xC174661CDA2966DCLL; + int32_t l_516 = 0x5FDB9509L; + int64_t * const l_564 = &g_565; + int64_t * const *l_563 = &l_564; + int64_t * const **l_562[10] = {&l_563,&l_563,&l_563,&l_563,&l_563,&l_563,&l_563,&l_563,&l_563,&l_563}; + int8_t *l_601 = &g_240; + struct S0 *l_604[2]; + int32_t * const l_620 = &l_487; + int64_t l_634 = 1L; + struct S2 l_641 = {2L,0L}; + int i; + for (i = 0; i < 6; i++) + l_416[i] = &g_413[0][2]; + for (i = 0; i < 2; i++) + l_426[i] = NULL; + for (i = 0; i < 2; i++) + l_604[i] = &g_605; + g_121.f0 &= ((l_411 != (g_413[1][3] = g_413[0][2])) , (safe_add_func_int8_t_s_s((((safe_div_func_uint8_t_u_u((&l_412 == l_421[1][3]), ((NULL == (*l_411)) && g_244[g_184]))) < (((*l_424) = (((0x12C856C1CC60DBF6LL < (safe_mul_func_uint8_t_u_u((g_244[g_184] | g_208.f0), 0UL))) < 0x8AL) , 255UL)) == l_425)) >= 6UL), 3UL))); + for (g_242 = 0; (g_242 <= 3); g_242 += 1) + { /* block id: 220 */ + int8_t *l_439 = &g_240; + uint16_t *l_440 = &g_244[g_184]; + int32_t l_441 = (-1L); + struct S1 *l_452 = &g_208; + struct S1 **l_451 = &l_452; + int32_t l_475 = 8L; + int32_t l_477 = 0x536BCEFBL; + int32_t l_486[10] = {0x481F5BC6L,0x481F5BC6L,0x481F5BC6L,0x481F5BC6L,0x481F5BC6L,0x481F5BC6L,0x481F5BC6L,0x481F5BC6L,0x481F5BC6L,0x481F5BC6L}; + int16_t l_492 = 0x66BEL; + uint8_t **l_541 = &l_540[0][0]; + uint8_t ***l_554 = &l_541; + int32_t *l_570 = &l_516; + uint32_t * const l_588 = &g_114; + uint32_t * const *l_587[4][9][1] = {{{NULL},{NULL},{&l_588},{&l_588},{NULL},{&l_588},{&l_588},{NULL},{NULL}},{{NULL},{NULL},{NULL},{&l_588},{&l_588},{NULL},{&l_588},{&l_588},{NULL}},{{NULL},{NULL},{NULL},{NULL},{&l_588},{&l_588},{NULL},{&l_588},{&l_588}},{{NULL},{NULL},{NULL},{NULL},{NULL},{&l_588},{&l_588},{NULL},{&l_588}}}; + int i, j, k; + } + if ((p_42 && (((safe_mod_func_int8_t_s_s(0L, (safe_add_func_int8_t_s_s((**l_410), ((g_114 >= (NULL == (*l_571))) > ((((safe_div_func_int64_t_s_s((((safe_lshift_func_int8_t_s_s((((*l_601) ^= (safe_sub_func_int16_t_s_s((-9L), ((0L <= (p_42 < 4UL)) > p_42)))) == p_41.f0), g_291[0][1].f0)) && (*g_569)) <= 0xD53C66FD4F73076ELL), p_42)) ^ p_41.f0) != 0UL) > 0xF8645B00L)))))) && (*g_379)) , l_489))) + { /* block id: 267 */ + int32_t l_617 = (-7L); + l_495 &= ((safe_unary_minus_func_uint8_t_u((((*l_411) = l_603) != ((((l_604[1] = &g_408) != (((safe_mul_func_int16_t_s_s(((l_617 = ((*l_616) = (safe_mod_func_uint64_t_u_u(((safe_mod_func_uint64_t_u_u((g_121.f1 > (((safe_rshift_func_uint8_t_u_u((p_41.f1 , p_41.f1), ((safe_div_func_int8_t_s_s((!(l_616 == l_540[0][0])), (-1L))) && 4294967291UL))) < p_42) , 0UL)), (*g_379))) != 0xE395B63D813E0CE4LL), l_567[1].f0)))) | (-7L)), (**l_410))) , (**l_410)) , l_603)) & 0xE7L) , l_618)))) == p_41.f0); + } + else + { /* block id: 273 */ + int8_t l_619 = 1L; + int32_t l_622 = 0x58D90218L; + int32_t l_627[3][2][3] = {{{0x6C7084D8L,1L,1L},{(-2L),0x656137AFL,(-2L)}},{{0x6C7084D8L,0x6C7084D8L,1L},{0xC42365C0L,0x656137AFL,0xC42365C0L}},{{0x6C7084D8L,1L,1L},{(-2L),0x656137AFL,(-2L)}}}; + int16_t l_630 = 0x0383L; + uint64_t l_631 = 2UL; + int i, j, k; + if ((*g_61)) + { /* block id: 274 */ + return p_40; + } + else + { /* block id: 276 */ + if (l_619) + break; + } + for (g_215 = 0; (g_215 <= 3); g_215 += 1) + { /* block id: 281 */ + int32_t **l_621 = &g_61; + int32_t l_623 = 1L; + int32_t l_625 = 0x55945757L; + int32_t l_626 = (-10L); + int32_t l_628[7][6] = {{(-1L),(-1L),(-1L),(-1L),(-1L),(-1L)},{(-1L),(-1L),(-1L),(-1L),(-1L),(-1L)},{(-1L),(-1L),(-1L),(-1L),(-1L),(-1L)},{(-1L),(-1L),(-1L),(-1L),(-1L),(-1L)},{(-1L),(-1L),(-1L),(-1L),(-1L),(-1L)},{(-1L),(-1L),(-1L),(-1L),(-1L),(-1L)},{(-1L),(-1L),(-1L),(-1L),(-1L),(-1L)}}; + int i, j; + (*l_621) = l_620; + l_631--; + } + p_41.f0 &= (l_634 , (*g_385)); + } + (*l_620) = (((g_408.f1 , (safe_div_func_int8_t_s_s((&g_385 == &g_61), (l_501 = 5L)))) >= (safe_mul_func_uint16_t_u_u((((**l_410) , (-9L)) || ((((((safe_mod_func_uint16_t_u_u(((l_641 , (**l_410)) != p_41.f0), p_42)) ^ (*p_40)) & 0x0CL) || 1UL) , (-3L)) >= 1L)), (*p_40)))) ^ 248UL); + } + for (l_472 = 3; (l_472 >= 0); l_472 -= 1) + { /* block id: 292 */ + int i; + if (g_241[g_68]) + break; + for (l_624 = 0; (l_624 >= 0); l_624 -= 1) + { /* block id: 296 */ + int16_t *l_657[8][5][6] = {{{&g_38,&g_38,&g_38,NULL,&g_38,NULL},{&g_241[0],NULL,&g_241[3],NULL,&l_624,&g_241[g_68]},{&g_38,&g_38,&g_241[0],NULL,NULL,&g_241[3]},{NULL,&g_241[0],&g_241[3],NULL,NULL,NULL},{NULL,NULL,&l_624,&g_241[g_68],&g_241[0],&g_241[2]}},{{&g_241[2],NULL,&g_241[g_68],NULL,&g_38,NULL},{&g_38,&g_241[g_68],&g_241[3],NULL,&g_38,NULL},{&g_38,NULL,&g_38,&l_566,&g_241[3],&g_38},{NULL,NULL,&g_241[3],&g_241[3],NULL,NULL},{&g_38,&l_624,&g_241[3],&g_38,NULL,&g_241[3]}},{{NULL,NULL,&g_241[3],NULL,&g_241[3],&l_624},{&g_241[g_68],&l_624,NULL,NULL,&l_566,&l_624},{&l_624,NULL,&l_566,NULL,NULL,&g_38},{NULL,&l_566,&g_241[3],&g_241[0],NULL,&l_624},{&g_241[1],&g_241[3],NULL,&g_38,NULL,NULL}},{{NULL,&g_241[0],NULL,&g_38,&l_624,NULL},{NULL,&g_38,&l_566,&l_566,&g_241[0],NULL},{&g_241[2],&g_38,&g_241[3],&l_624,&g_38,&g_241[2]},{&g_241[0],&l_624,&g_241[2],&g_241[3],&g_241[2],&l_624},{NULL,&g_241[3],NULL,&g_241[2],&g_38,&g_241[3]}},{{&g_38,NULL,&g_241[2],&g_241[g_68],&g_38,NULL},{NULL,NULL,NULL,&l_566,&g_38,NULL},{&l_624,&g_241[3],&g_241[g_68],NULL,&g_241[2],NULL},{NULL,&l_624,NULL,NULL,&g_38,&g_241[3]},{&l_624,&g_38,&g_38,&l_566,&g_241[0],&g_38}},{{NULL,&g_38,&g_38,NULL,&l_624,&l_566},{&g_241[2],&g_241[0],&g_241[3],NULL,NULL,NULL},{&g_241[3],&g_241[3],NULL,NULL,NULL,&g_241[g_68]},{NULL,&l_566,&g_241[g_68],NULL,NULL,&g_241[g_68]},{NULL,NULL,&l_624,&g_38,&l_566,NULL}},{{&g_241[g_68],&l_624,NULL,&g_241[0],&g_241[0],&l_624},{&g_241[0],&g_241[g_68],NULL,NULL,NULL,NULL},{&l_566,NULL,&l_624,NULL,&l_624,&g_241[g_68]},{NULL,&l_624,&g_241[g_68],&l_624,&g_241[g_68],&g_241[g_68]},{NULL,&g_241[3],NULL,NULL,&g_241[3],NULL}},{{&g_241[3],&g_241[3],&g_241[3],NULL,&g_241[g_68],&l_566},{&l_566,NULL,&g_38,NULL,&g_38,&g_38},{&g_241[0],&g_241[0],&g_38,&g_241[g_68],NULL,&g_241[3]},{&g_241[g_68],NULL,NULL,NULL,&g_241[2],NULL},{&g_241[g_68],&l_624,&g_241[g_68],&g_241[3],NULL,NULL}}}; + uint16_t *l_674 = NULL; + uint16_t *l_675 = &g_244[0]; + int i, j, k; + if (l_497[l_624][(l_624 + 1)][(l_472 + 2)]) + break; + if ((1UL ^ ((0UL >= (safe_add_func_int32_t_s_s((safe_mod_func_int8_t_s_s((l_457 = ((safe_mod_func_uint16_t_u_u(0xE961L, (safe_sub_func_uint16_t_u_u((safe_mul_func_uint8_t_u_u((safe_lshift_func_uint16_t_u_u((l_497[l_624][(l_624 + 1)][(l_472 + 2)] != (((*p_40) = (0xA3B3L | (0x1353L ^ 4L))) && (g_408.f1 < ((*l_616) = p_41.f0)))), 6)), l_495)), g_241[g_68])))) , 0x84L)), p_41.f0)), 0x07DE3AA1L))) <= 0x6467FAD3L))) + { /* block id: 301 */ + const uint16_t *l_655 = &g_244[2]; + const uint16_t **l_654 = &l_655; + const uint16_t ***l_656 = &l_654; + (*l_656) = l_654; + return &g_241[3]; + } + else + { /* block id: 304 */ + int i, j, k; + l_497[l_624][l_624][(g_68 + 2)] = (&g_378[3] == &l_571); + if (l_438.f1) + continue; + (*l_410) = (*l_410); + } + if ((safe_rshift_func_uint16_t_u_u(((*l_675) = (((safe_div_func_uint8_t_u_u(252UL, l_474)) && (3UL ^ (((*p_40) & (safe_rshift_func_int8_t_s_s((+(l_497[l_624][(l_624 + 1)][(l_472 + 2)] || ((safe_rshift_func_uint8_t_u_s((safe_mul_func_int8_t_s_s((safe_add_func_int64_t_s_s((0UL == (safe_mul_func_uint8_t_u_u(((*g_569) , ((safe_sub_func_uint16_t_u_u((3L > l_497[0][0][2]), l_485)) & g_241[g_68])), p_41.f0))), l_438.f1)), p_41.f1)), p_41.f0)) , 255UL))), g_565))) < 0x23L))) || l_488)), l_474))) + { /* block id: 310 */ + return p_40; + } + else + { /* block id: 312 */ + int32_t *l_676 = &l_512; + (*l_676) |= 0xC60B90E3L; + if (l_677) + continue; + } + for (l_485 = 3; (l_485 >= 0); l_485 -= 1) + { /* block id: 318 */ + uint8_t ***l_680 = &g_552[0][2]; + int32_t *l_682[10] = {&l_499,&l_488,&l_499,&l_499,&l_488,&l_499,&l_499,&l_488,&l_499,&l_499}; + int i; + l_490 = (safe_div_func_uint16_t_u_u((((*l_680) = &g_553) == l_681), (-5L))); + } + } + } + } + g_467 |= (((*l_683) = 0x75L) >= ((safe_mul_func_uint16_t_u_u(((safe_rshift_func_int16_t_s_u((safe_add_func_int32_t_s_s((l_690 , ((((((safe_add_func_int8_t_s_s(((*l_705) = (((safe_div_func_int32_t_s_s((safe_unary_minus_func_int64_t_s(((((safe_lshift_func_int16_t_s_s((l_499 |= ((*p_40) = (safe_sub_func_int32_t_s_s((*g_385), ((g_589 = (l_701[2][1] = &g_291[0][1])) != &g_291[1][3]))))), 5)) || l_438.f0) == ((-8L) < (((((p_41.f0 && p_42) & g_242) && 65533UL) >= p_41.f0) ^ 0x0575L))) || (*g_385)))), 0x74555EFDL)) , l_703) != NULL)), p_41.f1)) && g_706) >= 1UL) , (uint32_t**) NULL) == g_707) | p_41.f0)), p_41.f1)), (*g_569))) ^ (**g_568)), 0xD444L)) | 0x2E5CL)); + return &g_241[3]; + } + else + { /* block id: 333 */ + int32_t *l_709 = &g_386[0]; + int32_t *l_710 = &g_291[0][1].f0; + int32_t *l_711 = &g_386[0]; + int32_t *l_712[10] = {&g_476,&g_476,&g_476,&g_476,&g_476,&g_476,&g_476,&g_476,&g_476,&g_476}; + int8_t l_713[2][10] = {{8L,8L,8L,8L,8L,8L,8L,8L,8L,8L},{8L,8L,8L,8L,8L,8L,8L,8L,8L,8L}}; + int8_t l_714 = (-4L); + int8_t l_720 = 0x74L; + int i, j; + for (g_242 = 0; g_242 < 4; g_242 += 1) + { + g_241[g_242] = 0xA2BAL; + } + ++l_715; + --g_721; + } + p_41.f0 |= p_42; + ++g_732[4]; + --l_735[1][1]; + return p_40; +} + + +/* ------------------------------------------ */ +/* + * reads : g_187 g_61 g_2 g_291.f0 g_121 + * writes: g_242 g_68 g_291 g_203 + */ +static struct S2 func_43(uint64_t p_44, int8_t p_45, int64_t p_46, const int16_t * p_47, int32_t p_48) +{ /* block id: 199 */ + struct S1 *l_389[8] = {&g_208,&g_208,&g_208,&g_208,&g_208,&g_208,&g_208,&g_208}; + struct S2 *l_396 = &g_121; + uint16_t *l_399 = &g_161; + uint64_t *l_402 = &g_203; + int32_t l_403[3][3] = {{0x065366F1L,0x065366F1L,0x065366F1L},{(-1L),(-1L),(-1L)},{0x065366F1L,0x065366F1L,0x065366F1L}}; + int64_t l_404 = 0x9AD62FCB4E69716BLL; + int32_t *l_405 = &g_291[0][1].f0; + struct S0 *l_407 = &g_408; + struct S0 **l_406 = &l_407; + int i, j; + for (g_242 = 0; g_242 < 4; g_242 += 1) + { + for (g_68 = 0; g_68 < 6; g_68 += 1) + { + struct S2 tmp = {0xF74DE0BBL,0xE77EDE5556FB1F53LL}; + g_291[g_242][g_68] = tmp; + } + } + (*l_405) ^= (safe_mul_func_uint16_t_u_u(p_45, (!((&g_208 == l_389[7]) > ((l_403[0][0] = ((safe_rshift_func_int8_t_s_u((safe_mul_func_uint16_t_u_u((safe_mul_func_int16_t_s_s((l_396 != NULL), (safe_div_func_uint64_t_u_u(((NULL == l_399) , ((*l_402) = (l_389[7] == ((safe_add_func_int8_t_s_s(0x0DL, g_187)) , l_389[7])))), l_403[2][1])))), l_404)), l_403[2][1])) , (*g_61))) , 9UL))))); + (*l_406) = NULL; + return g_121; +} + + +/* ------------------------------------------ */ +/* + * reads : g_2 g_68 g_62 g_78 g_38 g_61 g_114 g_121 g_159 g_187 g_203 g_215 g_161 g_244 g_202 g_241 g_242 g_208 g_323 g_378 g_291.f0 + * writes: g_61 g_68 g_78 g_62 g_114 g_38 g_121.f1 g_121.f0 g_159 g_161 g_187 g_203 g_215 g_244 g_184 g_242 g_291 g_323 g_378 g_385 + */ +static uint64_t func_49(int16_t * p_50, int16_t * p_51, uint8_t p_52) +{ /* block id: 10 */ + int32_t *l_57 = &g_2; + int32_t **l_58 = NULL; + int32_t *l_60 = &g_2; + int32_t **l_59[1]; + uint16_t *l_66 = NULL; + uint16_t *l_67 = &g_68; + const int32_t *l_384 = &g_291[0][1].f0; + const int32_t **l_383[7] = {&l_384,&l_384,&l_384,&l_384,&l_384,&l_384,&l_384}; + int i; + for (i = 0; i < 1; i++) + l_59[i] = &l_60; + g_61 = (l_57 = l_57); + g_385 = func_63(((*l_67) ^= g_2), g_62); + g_291[0][1].f0 &= 0x21F51DF0L; + return g_208.f2; +} + + +/* ------------------------------------------ */ +/* + * reads : + * writes: + */ +static int16_t * func_53(uint8_t p_54) +{ /* block id: 8 */ + int16_t *l_56 = NULL; + return l_56; +} + + +/* ------------------------------------------ */ +/* + * reads : g_78 g_68 g_62 g_2 g_38 g_61 g_114 g_121 g_159 g_187 g_203 g_215 g_161 g_244 g_202 g_241 g_242 g_208 g_323 g_378 + * writes: g_78 g_62 g_114 g_38 g_121.f1 g_121.f0 g_159 g_68 g_161 g_187 g_203 g_215 g_244 g_184 g_242 g_291 g_323 g_378 + */ +static const int32_t * func_63(uint16_t p_64, uint32_t p_65) +{ /* block id: 14 */ + int32_t *l_69 = NULL; + int32_t **l_70 = &l_69; + int32_t l_91 = 0xE8BE9C2CL; + uint16_t **l_98 = NULL; + uint8_t l_223 = 1UL; + uint8_t *l_237 = &g_184; + int32_t l_267 = 0x50EEFC11L; + uint32_t l_268 = 0x089C4C44L; + uint8_t l_305 = 255UL; + int32_t l_356 = (-1L); + int32_t l_358 = 0x1ABD8A15L; + uint32_t l_375 = 0xAF36EF52L; + int64_t ***l_380 = &g_378[3]; + int64_t **l_382 = &g_379; + int64_t ***l_381 = &l_382; +lbl_190: + (*l_70) = l_69; + if ((safe_rshift_func_int16_t_s_u(p_64, 10))) + { /* block id: 16 */ + uint16_t *l_85[1]; + int32_t l_89 = (-6L); + struct S2 l_122[6] = {{0L,0x1CD949914032C2DELL},{0L,0x1CD949914032C2DELL},{0L,0x1CD949914032C2DELL},{0L,0x1CD949914032C2DELL},{0L,0x1CD949914032C2DELL},{0L,0x1CD949914032C2DELL}}; + struct S1 l_136 = {0L,20,34}; + uint8_t *l_163 = &g_78; + struct S1 *l_207 = &g_208; + struct S1 *l_247 = &g_208; + int i; + for (i = 0; i < 1; i++) + l_85[i] = &g_68; + if (p_64) + { /* block id: 17 */ + uint8_t *l_77 = &g_78; + uint16_t *l_83[2][1][1]; + uint16_t **l_84 = &l_83[1][0][0]; + int32_t l_88 = 1L; + int32_t *l_90 = NULL; + int i, j, k; + for (i = 0; i < 2; i++) + { + for (j = 0; j < 1; j++) + { + for (k = 0; k < 1; k++) + l_83[i][j][k] = NULL; + } + } + l_91 &= ((+(65535UL == ((~((safe_div_func_int16_t_s_s((((safe_div_func_int8_t_s_s(p_64, (+((((((*l_77)--) <= (safe_rshift_func_uint8_t_u_s((((*l_84) = l_83[1][0][0]) == l_85[0]), 4))) < p_64) & (g_68 <= g_62)) , ((safe_rshift_func_int16_t_s_u((g_2 ^ g_38), p_64)) & l_88))))) == (*g_61)) | p_64), l_89)) , g_62)) ^ p_65))) , p_65); + if (p_64) + { /* block id: 21 */ + int32_t *l_92 = &g_62; + int32_t *l_93 = &l_89; + (*l_93) = ((*l_92) |= l_89); + } + else + { /* block id: 24 */ + return &g_2; + } + } + else + { /* block id: 27 */ + uint32_t *l_113 = &g_114; + int32_t l_115 = 1L; + struct S2 l_126 = {0x3EC0817FL,-8L}; + uint8_t *l_151 = &g_78; + int16_t *l_182[3]; + int32_t l_221 = 0xB19B034DL; + int32_t l_222 = 1L; + int32_t *l_236[6][4][8] = {{{&l_89,&l_126.f0,&l_221,&l_89,&g_62,NULL,&l_126.f0,&l_126.f0},{&l_122[5].f0,&g_62,NULL,NULL,&g_62,&l_122[5].f0,&l_115,&l_122[5].f0},{&l_89,&l_115,&l_91,&l_126.f0,&l_122[5].f0,&l_91,&g_62,&l_91},{&l_222,&l_126.f0,&l_126.f0,&l_126.f0,&l_222,&l_126.f0,&l_126.f0,&l_122[5].f0}},{{&l_89,&l_222,&l_122[5].f0,NULL,&l_126.f0,&l_89,&l_89,&l_126.f0},{&l_89,&l_122[5].f0,&l_122[5].f0,&l_89,&l_115,&l_91,&l_126.f0,&l_122[5].f0},{&l_126.f0,&g_62,&l_126.f0,&l_122[5].f0,&g_62,&l_221,&g_62,&l_122[5].f0},{&l_91,&g_62,&l_91,&l_122[5].f0,&l_126.f0,&l_91,&l_115,&l_89}},{{&l_222,&l_122[5].f0,NULL,&l_126.f0,&l_89,&l_89,&l_126.f0,NULL},{&l_222,&l_222,&l_221,&l_122[5].f0,&l_126.f0,&l_126.f0,&l_222,&l_126.f0},{&l_91,&l_126.f0,&l_122[5].f0,&l_91,&g_62,&l_91,&l_122[5].f0,&l_126.f0},{&l_126.f0,&l_115,NULL,&l_122[5].f0,&l_115,&l_122[5].f0,&g_62,NULL}},{{&l_89,&g_62,NULL,&l_126.f0,&l_126.f0,NULL,&g_62,&l_89},{&l_89,&l_126.f0,NULL,&l_122[5].f0,&l_222,&l_89,&l_122[5].f0,&l_122[5].f0},{&l_222,&l_89,&l_122[5].f0,&l_122[5].f0,&l_122[5].f0,&l_89,&l_222,&l_122[5].f0},{&l_89,&l_126.f0,&l_221,&l_89,&g_62,NULL,&l_126.f0,&l_126.f0}},{{&l_122[5].f0,&g_62,NULL,NULL,&g_62,&l_122[5].f0,&l_115,&l_122[5].f0},{&l_89,&l_115,&l_126.f0,&l_91,NULL,&l_126.f0,&l_89,&l_126.f0},{&l_122[5].f0,&l_91,&g_62,&l_91,&l_122[5].f0,&l_126.f0,&l_91,&l_115},{&l_221,&l_122[5].f0,NULL,&g_2,&l_91,&l_221,&l_221,&l_91}},{{NULL,NULL,NULL,NULL,&l_126.f0,&l_126.f0,&l_91,NULL},{&l_91,&l_89,&g_62,&l_115,&l_89,&l_89,&l_89,&l_115},{&l_126.f0,&l_89,&l_126.f0,NULL,&l_91,&l_126.f0,&l_126.f0,NULL},{&l_122[5].f0,NULL,&g_2,&l_91,&l_221,&l_221,&l_91,&g_2}}}; + struct S1 **l_248 = &l_207; + int i, j, k; + for (i = 0; i < 3; i++) + l_182[i] = &g_38; + if ((g_62 ^ (!((safe_sub_func_int64_t_s_s((~(l_115 = (g_62 , ((safe_lshift_func_int16_t_s_s((NULL == l_98), (safe_rshift_func_uint16_t_u_s(((((*l_113) ^= (safe_mul_func_int16_t_s_s((0x3A24L >= (-6L)), (safe_rshift_func_uint16_t_u_s((safe_lshift_func_int8_t_s_s(p_64, 1)), ((l_89 = (safe_mod_func_int16_t_s_s((safe_sub_func_int32_t_s_s(0L, (safe_lshift_func_uint16_t_u_s((0x2F0D9F09L & 1UL), 4)))), p_64))) ^ g_68)))))) != 0xC0EDEAE2L) == g_2), p_64)))) || g_2)))), p_65)) & p_65)))) + { /* block id: 31 */ + int32_t *l_116 = NULL; + int16_t l_160 = 1L; + int32_t l_166 = 4L; + struct S2 l_179 = {0x56559E35L,7L}; + int32_t *l_185 = NULL; + int32_t *l_186[6][6][5] = {{{&g_121.f0,&g_121.f0,NULL,&l_166,NULL},{&l_89,&g_62,NULL,&l_89,&l_179.f0},{NULL,&l_122[5].f0,&l_89,NULL,NULL},{NULL,&g_62,&l_89,&g_62,NULL},{&l_89,&g_121.f0,&l_122[5].f0,NULL,&g_121.f0},{NULL,&l_115,&g_121.f0,&g_62,NULL}},{{NULL,&l_166,NULL,&g_121.f0,&g_121.f0},{&l_89,&g_62,&l_89,&l_89,NULL},{&g_121.f0,&l_122[5].f0,NULL,&g_121.f0,NULL},{&l_126.f0,&l_122[5].f0,&l_89,&g_62,&l_179.f0},{&l_89,NULL,NULL,NULL,NULL},{&l_179.f0,&l_115,&l_89,&g_62,NULL}},{{&l_166,NULL,NULL,NULL,&l_166},{&l_89,&l_122[5].f0,&g_121.f0,&l_89,&l_126.f0},{&l_166,&l_122[5].f0,&l_122[5].f0,&l_166,NULL},{&l_179.f0,&g_62,&l_89,&l_122[5].f0,&l_126.f0},{&l_89,&l_166,&l_89,NULL,&l_166},{&l_126.f0,&l_115,NULL,&l_122[5].f0,NULL}},{{&g_121.f0,&g_121.f0,NULL,&l_166,NULL},{&l_89,&g_62,NULL,&l_89,&l_179.f0},{NULL,&l_122[5].f0,&l_89,NULL,NULL},{NULL,&g_62,&l_89,&g_62,NULL},{&l_89,&g_121.f0,&l_122[5].f0,NULL,&g_121.f0},{NULL,&l_115,&g_121.f0,&g_62,NULL}},{{NULL,&l_166,NULL,&g_121.f0,&g_121.f0},{&l_89,&g_62,&l_89,&l_89,NULL},{&g_121.f0,&l_122[5].f0,NULL,&g_121.f0,NULL},{&l_126.f0,NULL,&l_126.f0,&l_115,NULL},{&l_115,NULL,&l_126.f0,&l_126.f0,NULL},{NULL,NULL,&l_89,&l_89,NULL}},{{&l_122[5].f0,NULL,&g_121.f0,NULL,&l_122[5].f0},{&l_89,NULL,&l_89,NULL,&l_89},{&l_122[5].f0,NULL,NULL,&l_122[5].f0,&l_126.f0},{NULL,&l_115,&l_126.f0,NULL,&l_89},{&l_115,&l_122[5].f0,&l_115,&l_126.f0,&l_122[5].f0},{&l_89,NULL,NULL,NULL,NULL}}}; + int i, j, k; + g_62 &= (g_68 , p_65); + for (g_38 = (-4); (g_38 < 27); g_38++) + { /* block id: 35 */ + for (g_114 = (-27); (g_114 != 17); ++g_114) + { /* block id: 38 */ + uint32_t l_123 = 4294967286UL; + struct S2 *l_127 = &l_122[1]; + l_122[5] = g_121; + ++l_123; + (*l_127) = (g_114 , l_126); + } + } + for (g_121.f1 = 0; (g_121.f1 >= 14); g_121.f1 = safe_add_func_int64_t_s_s(g_121.f1, 3)) + { /* block id: 46 */ + int8_t l_157 = 0L; + int8_t l_162 = 1L; + struct S1 l_170 = {0x613543D0L,20,166}; + for (g_121.f0 = 0; (g_121.f0 <= 27); ++g_121.f0) + { /* block id: 49 */ + uint8_t l_134[1]; + int32_t *l_135 = &l_91; + int i; + for (i = 0; i < 1; i++) + l_134[i] = 0x73L; + (*l_135) = (g_62 = ((safe_rshift_func_int16_t_s_s(0x5A5DL, 8)) <= l_134[0])); + } + if ((l_136 , (*g_61))) + { /* block id: 53 */ + (*l_70) = &g_2; + } + else + { /* block id: 55 */ + uint32_t l_156 = 4294967286UL; + uint64_t *l_158 = &g_159; + int32_t *l_164 = NULL; + int32_t *l_165 = &l_91; + int8_t *l_169 = &l_162; + const int16_t *l_173[5][6][8] = {{{&l_160,&g_38,&l_160,&l_160,NULL,NULL,NULL,NULL},{&l_160,&l_160,&l_160,&l_160,&g_38,&l_160,&l_160,&l_160},{NULL,&g_38,&l_160,&l_160,&g_38,&g_38,&l_160,&g_38},{&g_38,&g_38,&g_38,&l_160,&g_38,&l_160,&g_38,&g_38},{&l_160,&l_160,NULL,&g_38,&g_38,NULL,&l_160,&l_160},{&l_160,&g_38,&g_38,NULL,&l_160,&l_160,&l_160,&g_38}},{{&g_38,&g_38,&l_160,&g_38,&g_38,&g_38,&l_160,&g_38},{&l_160,&g_38,&l_160,&g_38,&l_160,NULL,&g_38,&g_38},{&l_160,&l_160,&l_160,&g_38,&g_38,&g_38,&g_38,&l_160},{&l_160,&g_38,&l_160,&g_38,&l_160,&l_160,&g_38,&g_38},{&g_38,&l_160,NULL,&l_160,&g_38,&l_160,&g_38,&g_38},{&g_38,&l_160,NULL,NULL,&g_38,NULL,NULL,&l_160}},{{&g_38,&l_160,&g_38,&l_160,&g_38,&l_160,&l_160,NULL},{&g_38,&l_160,&g_38,&g_38,&g_38,&g_38,&l_160,&g_38},{&l_160,&g_38,&g_38,&l_160,NULL,&g_38,NULL,&g_38},{NULL,&g_38,NULL,&g_38,&l_160,&l_160,&g_38,&l_160},{NULL,&g_38,NULL,&g_38,&g_38,&g_38,&g_38,&g_38},{&g_38,&g_38,&l_160,&l_160,&l_160,&g_38,&g_38,NULL}},{{&l_160,&g_38,&l_160,&g_38,&g_38,&g_38,&l_160,&l_160},{&g_38,&l_160,&g_38,&g_38,NULL,&g_38,&l_160,&l_160},{NULL,&g_38,&g_38,&l_160,NULL,&l_160,&g_38,&l_160},{&g_38,&g_38,NULL,NULL,&l_160,&g_38,&l_160,&l_160},{&l_160,&g_38,&g_38,&g_38,&g_38,&l_160,&g_38,NULL},{&l_160,&l_160,&g_38,&l_160,&l_160,NULL,&g_38,&g_38}},{{NULL,&g_38,&g_38,&l_160,&l_160,&g_38,&g_38,NULL},{&l_160,&l_160,&g_38,&g_38,&g_38,&l_160,&g_38,&l_160},{&l_160,&g_38,&l_160,NULL,NULL,&g_38,&g_38,&l_160},{&l_160,&l_160,&g_38,&l_160,&g_38,&g_38,&g_38,&l_160},{&g_38,&g_38,&g_38,&g_38,&l_160,&l_160,&l_160,&l_160},{&l_160,&l_160,&l_160,&g_38,&l_160,&l_160,&g_38,&g_38}}}; + uint8_t *l_183[3][2][3] = {{{&g_184,&g_184,&g_184},{&g_184,&g_184,&g_184}},{{&g_184,&g_184,&g_184},{&g_184,&g_184,&g_184}},{{&g_184,&g_184,&g_184},{&g_184,&g_184,&g_184}}}; + int i, j, k; + l_166 |= (l_126 , ((*l_165) ^= (((safe_mod_func_uint8_t_u_u((+(&g_78 == ((safe_add_func_int32_t_s_s((safe_mul_func_uint8_t_u_u(((-1L) & (p_65 > (l_162 = (~(g_161 = (g_68 = (((safe_rshift_func_int8_t_s_s((+(safe_mod_func_uint16_t_u_u(l_126.f1, ((((*l_158) = ((((safe_rshift_func_uint16_t_u_u((((*l_113) = (l_151 != ((((func_24((((safe_mod_func_int16_t_s_s((l_156 = ((safe_rshift_func_uint8_t_u_s(p_64, (~0x5FL))) > 0L)), p_64)) || 0xCC89D979L) <= 0x3E2DD196261E54E0LL)) , l_126.f0) | 0x1E0ADED1L) | l_157) , (uint8_t*) NULL))) != 7UL), l_126.f0)) | l_126.f1) & (*g_61)) & p_64)) & 0x0FC352BBFD28FE82LL) | g_121.f0)))), p_64)) & 0xCEC0L) || l_160))))))), 0xACL)), l_136.f0)) , l_163))), l_157)) , &g_2) != &g_62))); + l_122[5].f0 |= ((*l_165) ^= (safe_add_func_int8_t_s_s(((*l_169) = g_159), (((~(l_170 , (0xDCF4L | (safe_div_func_uint8_t_u_u((((l_89 = ((*l_163) = (l_173[2][1][1] != ((safe_unary_minus_func_uint64_t_u(((safe_div_func_uint32_t_u_u((safe_div_func_uint32_t_u_u((l_179 , (p_64 & l_115)), (0xD642D507L | ((safe_mul_func_uint8_t_u_u((g_159 != 0xE52791890F00B84BLL), 255UL)) ^ p_65)))), l_89)) <= p_65))) , l_182[2])))) , p_65) , p_65), p_65))))) && 0xDB16BE7C8CA683B8LL) > g_68)))); + } + } + g_187++; + } + else + { /* block id: 72 */ + uint16_t l_191 = 1UL; + if (g_187) + goto lbl_190; + l_191 = 7L; + } + for (g_159 = 0; (g_159 <= 0); g_159 += 1) + { /* block id: 78 */ + int32_t *l_192 = &l_91; + uint32_t l_218 = 0xF747F287L; + int32_t *l_219 = &l_126.f0; + int32_t *l_220[8][10][3] = {{{NULL,&g_2,&l_89},{&l_91,&l_91,&l_115},{&g_2,&l_89,NULL},{NULL,&l_91,&l_115},{&l_126.f0,&g_121.f0,&l_89},{&l_122[5].f0,&l_126.f0,&l_91},{&l_115,NULL,&l_115},{&l_89,NULL,&l_89},{&l_89,&g_2,&l_122[5].f0},{&g_2,NULL,&l_126.f0}},{{NULL,&l_115,&g_2},{&l_91,&l_89,NULL},{NULL,NULL,NULL},{&g_2,&l_91,&g_121.f0},{&l_89,&g_121.f0,&l_91},{&l_89,NULL,NULL},{&l_115,NULL,&g_62},{&l_122[5].f0,NULL,&l_89},{&l_126.f0,&l_89,&l_89},{NULL,NULL,&l_91}},{{&g_2,&l_89,&g_2},{&l_91,NULL,&g_121.f0},{NULL,NULL,NULL},{NULL,NULL,&l_122[5].f0},{&g_121.f0,&g_121.f0,&l_115},{&g_62,&l_91,&l_126.f0},{&l_115,NULL,&l_91},{&g_121.f0,NULL,NULL},{&l_89,&g_2,&l_91},{&l_91,&l_91,NULL}},{{&l_122[5].f0,NULL,&g_2},{&g_121.f0,NULL,NULL},{&l_89,&g_121.f0,&l_89},{&l_126.f0,&g_62,&l_89},{&l_91,&l_115,NULL},{&l_122[5].f0,&g_121.f0,&l_122[5].f0},{&g_2,NULL,NULL},{&l_122[5].f0,NULL,NULL},{&l_91,&g_62,NULL},{&l_126.f0,&l_91,&l_89}},{{&l_89,NULL,NULL},{&g_121.f0,&g_121.f0,&l_91},{&l_122[5].f0,&g_121.f0,&l_89},{&l_91,NULL,&l_122[5].f0},{&l_89,&l_115,&g_62},{&g_121.f0,NULL,&g_62},{&g_2,&g_121.f0,&l_89},{&g_121.f0,&g_121.f0,NULL},{&l_115,NULL,NULL},{&l_91,&l_91,&g_121.f0}},{{&l_122[5].f0,&g_62,NULL},{&g_121.f0,NULL,NULL},{&g_62,NULL,&l_89},{&l_126.f0,&g_121.f0,NULL},{&g_2,&l_115,NULL},{&l_115,&g_62,&g_121.f0},{&g_2,&g_121.f0,NULL},{NULL,NULL,NULL},{&g_2,NULL,&l_89},{NULL,&l_91,&g_62}},{{&l_115,&g_2,&g_62},{&g_121.f0,NULL,&l_122[5].f0},{&l_115,&l_126.f0,&l_89},{NULL,&l_122[5].f0,&l_91},{&g_2,&l_115,NULL},{NULL,&l_89,&l_89},{&g_2,&l_89,NULL},{&l_115,&g_2,NULL},{&g_2,NULL,NULL},{&l_126.f0,&l_91,&l_122[5].f0}},{{&g_62,NULL,NULL},{&g_121.f0,&g_2,&l_89},{&l_122[5].f0,&l_89,&l_89},{&l_91,&l_89,NULL},{&l_115,&l_115,&g_2},{&g_121.f0,&l_122[5].f0,NULL},{&g_2,&l_126.f0,&l_91},{&g_121.f0,NULL,NULL},{&l_89,&g_2,&l_91},{&l_91,&l_91,NULL}}}; + int i, j, k; + g_121.f0 ^= l_89; + for (g_121.f1 = 0; (g_121.f1 <= 2); g_121.f1 += 1) + { /* block id: 82 */ + int16_t l_193 = 7L; + int32_t *l_194 = &g_62; + int32_t *l_195 = &l_115; + int32_t *l_196 = &l_115; + int32_t *l_197 = &l_89; + int32_t l_198 = 1L; + int32_t *l_199 = &l_89; + int32_t l_200 = 0xEA293CA1L; + int32_t *l_201[5][8] = {{&l_198,NULL,&l_89,&l_115,&l_115,&l_89,NULL,&l_198},{NULL,&l_126.f0,&l_198,&g_2,&l_198,&l_126.f0,NULL,NULL},{&l_126.f0,&g_2,&l_89,&l_89,&g_2,&l_126.f0,&l_115,&l_126.f0},{&g_2,&l_126.f0,&l_115,&l_126.f0,&g_2,&l_89,&l_115,&l_89},{NULL,&g_2,&g_2,NULL,&l_91,&l_89,&l_91,NULL}}; + int i, j; + (*l_70) = l_192; + g_203--; + if (l_126.f1) + break; + } + for (l_126.f1 = 0; (l_126.f1 >= 0); l_126.f1 -= 1) + { /* block id: 89 */ + int64_t l_209 = (-1L); + for (l_126.f0 = 0; (l_126.f0 <= 0); l_126.f0 += 1) + { /* block id: 92 */ + (*l_192) ^= 0xDC3F510EL; + (*l_70) = NULL; + } + for (g_161 = 0; (g_161 <= 5); g_161 += 1) + { /* block id: 98 */ + int32_t *l_206 = &l_126.f0; + int i; + (*l_70) = l_206; + l_122[(l_126.f1 + 1)] = l_122[(l_126.f1 + 4)]; + l_207 = NULL; + if (p_65) + continue; + } + for (g_121.f1 = 0; (g_121.f1 <= 2); g_121.f1 += 1) + { /* block id: 106 */ + int32_t *l_210 = &l_122[5].f0; + int32_t *l_211 = &l_115; + int32_t *l_212 = &l_115; + int32_t *l_213 = NULL; + int32_t *l_214[2]; + int i; + for (i = 0; i < 2; i++) + l_214[i] = &l_89; + g_215++; + if (l_218) + break; + (*l_211) = p_65; + } + } + --l_223; + } + if (((safe_div_func_int16_t_s_s((((+p_65) > ((-6L) || (safe_div_func_uint64_t_u_u(p_64, (safe_rshift_func_int8_t_s_s(((l_122[5].f0 = ((safe_mul_func_int16_t_s_s((safe_rshift_func_uint8_t_u_u(((l_91 = l_122[5].f0) , (&g_184 != (l_237 = l_163))), ((l_89 = ((safe_unary_minus_func_int8_t_s(g_38)) && (&g_208 != NULL))) < 0xE523L))), 0x8B00L)) >= p_64)) || p_64), p_65)))))) <= 0L), 9UL)) >= g_161)) + { /* block id: 118 */ + l_91 = (p_64 & (-1L)); + } + else + { /* block id: 120 */ + int8_t l_243 = (-1L); + --g_244[2]; + } + (*l_248) = l_247; + } + } + else + { /* block id: 125 */ + int16_t l_254 = 0xC2D8L; + int32_t l_258 = 3L; + struct S1 *l_298[4][3] = {{&g_208,&g_208,&g_208},{&g_208,&g_208,&g_208},{&g_208,&g_208,&g_208},{&g_208,&g_208,&g_208}}; + uint16_t l_306 = 0UL; + uint32_t *l_307 = NULL; + int32_t l_308 = (-7L); + uint16_t l_359 = 0x98FFL; + int i, j; + for (g_121.f0 = 0; (g_121.f0 <= 3); g_121.f0 += 1) + { /* block id: 128 */ + uint32_t *l_253 = &g_114; + int32_t *l_255 = &l_91; + int32_t *l_256 = NULL; + int32_t *l_257 = &l_91; + int32_t *l_259 = &l_258; + int32_t *l_260 = &l_91; + int32_t *l_261 = &g_62; + int32_t *l_262 = &g_62; + int32_t l_263[4][10][6] = {{{3L,2L,0x44646C51L,2L,3L,0x240811FDL},{2L,3L,0x240811FDL,0x240811FDL,3L,2L},{(-1L),2L,0x1456EAE4L,3L,0x1456EAE4L,2L},{0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L,0x44646C51L,0x240811FDL},{0x1456EAE4L,0x1456EAE4L,0x44646C51L,3L,0x2A09282DL,3L},{(-1L),0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L,0x44646C51L},{2L,(-1L),(-1L),2L,0x1456EAE4L,3L},{3L,2L,0x44646C51L,2L,3L,0x240811FDL},{2L,3L,0x240811FDL,0x240811FDL,3L,2L},{(-1L),2L,0x1456EAE4L,3L,0x1456EAE4L,2L}},{{0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L,0x44646C51L,0x240811FDL},{0x1456EAE4L,0x1456EAE4L,0x44646C51L,3L,0x2A09282DL,3L},{(-1L),0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L,0x44646C51L},{2L,(-1L),(-1L),2L,0x1456EAE4L,3L},{3L,2L,0x44646C51L,2L,3L,0x240811FDL},{2L,3L,0x240811FDL,0x240811FDL,3L,2L},{(-1L),2L,0x1456EAE4L,3L,0x1456EAE4L,2L},{0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L,0x44646C51L,0x240811FDL},{0x1456EAE4L,0x1456EAE4L,0x44646C51L,3L,0x2A09282DL,3L},{(-1L),0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L,0x44646C51L}},{{2L,(-1L),(-1L),2L,0x1456EAE4L,3L},{3L,2L,0x44646C51L,2L,3L,0x240811FDL},{2L,3L,0x240811FDL,0x240811FDL,3L,2L},{(-1L),2L,0x1456EAE4L,3L,0x1456EAE4L,2L},{0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L,0x44646C51L,0x240811FDL},{0x1456EAE4L,0x1456EAE4L,0x44646C51L,3L,0x2A09282DL,3L},{(-1L),0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L,0x44646C51L},{2L,(-1L),(-1L),2L,0x1456EAE4L,3L},{3L,(-1L),0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L},{(-1L),0x240811FDL,0x44646C51L,0x44646C51L,0x240811FDL,(-1L)}},{{3L,(-1L),0x2A09282DL,0x240811FDL,0x2A09282DL,(-1L)},{0x2A09282DL,3L,0x44646C51L,0x1456EAE4L,0x1456EAE4L,0x44646C51L},{0x2A09282DL,0x2A09282DL,0x1456EAE4L,0x240811FDL,2L,0x240811FDL},{3L,0x2A09282DL,3L,0x44646C51L,0x1456EAE4L,0x1456EAE4L},{(-1L),3L,3L,(-1L),0x2A09282DL,0x240811FDL},{0x240811FDL,(-1L),0x1456EAE4L,(-1L),0x240811FDL,0x44646C51L},{(-1L),0x240811FDL,0x44646C51L,0x44646C51L,0x240811FDL,(-1L)},{3L,(-1L),0x2A09282DL,0x240811FDL,0x2A09282DL,(-1L)},{0x2A09282DL,3L,0x44646C51L,0x1456EAE4L,0x1456EAE4L,0x44646C51L},{0x2A09282DL,0x2A09282DL,0x1456EAE4L,0x240811FDL,2L,0x240811FDL}}}; + int32_t *l_264 = &l_91; + int32_t *l_265 = &l_91; + int32_t *l_266[3]; + int64_t *l_280[8][3] = {{&g_121.f1,&g_121.f1,&g_121.f1},{NULL,&g_242,&g_242},{&g_121.f1,&g_242,NULL},{NULL,NULL,NULL},{&g_121.f1,&g_121.f1,NULL},{&g_121.f1,&g_121.f1,&g_242},{NULL,&g_121.f1,&g_121.f1},{&g_242,NULL,NULL}}; + uint16_t *l_283[9][10] = {{&g_244[0],NULL,&g_68,&g_68,&g_68,&g_68,NULL,&g_244[0],&g_68,&g_68},{&g_244[0],&g_244[2],&g_68,&g_68,&g_68,&g_244[0],NULL,&g_68,&g_68,&g_68},{&g_244[0],NULL,&g_68,&g_68,&g_68,&g_68,NULL,&g_244[0],&g_68,&g_68},{&g_244[0],&g_244[2],&g_68,&g_68,&g_68,&g_244[0],NULL,&g_68,&g_68,&g_68},{&g_244[0],NULL,&g_68,&g_68,&g_68,&g_68,NULL,&g_244[0],&g_68,&g_68},{&g_244[0],&g_244[2],&g_68,&g_68,&g_68,&g_244[0],NULL,&g_68,&g_68,&g_68},{&g_244[0],NULL,&g_68,&g_68,&g_68,&g_68,NULL,&g_244[0],&g_68,&g_68},{&g_244[0],&g_244[2],&g_68,&g_68,&g_68,&g_244[0],NULL,&g_68,&g_68,&g_68},{&g_244[0],NULL,&g_68,&g_68,&g_68,&g_68,NULL,&g_244[0],&g_68,&g_68}}; + int i, j, k; + for (i = 0; i < 3; i++) + l_266[i] = &l_91; + l_254 = ((safe_rshift_func_uint8_t_u_u((g_184 = (((*l_253) &= (safe_rshift_func_int8_t_s_s(g_202, 2))) > 0x48EA2435L)), p_65)) <= 1L); + l_268--; + (*l_259) = (!p_64); + (*l_265) = ((((1UL || ((((safe_sub_func_uint64_t_u_u(0x55E803D2FD9BEF9FLL, (safe_add_func_int32_t_s_s((0x1127L != (safe_mod_func_uint64_t_u_u((((((0xF7L > (safe_unary_minus_func_int8_t_s(p_65))) && ((safe_div_func_uint64_t_u_u(18446744073709551615UL, (g_242 = (-1L)))) , (safe_lshift_func_uint16_t_u_s((l_258 = 0x8659L), (safe_mul_func_uint16_t_u_u(((g_121 , (int16_t*) NULL) != NULL), p_64)))))) && 3UL) > g_2) & (*l_265)), 1L))), 0x307B5E04L)))) , (*l_260)) , p_65) <= l_254)) , p_65) <= p_64) <= p_65); + for (g_187 = 0; (g_187 <= 3); g_187 += 1) + { /* block id: 139 */ + uint8_t l_286[9][1][3] = {{{255UL,2UL,255UL}},{{0x71L,246UL,0x12L}},{{246UL,246UL,255UL}},{{0x12L,255UL,255UL}},{{255UL,0x71L,2UL}},{{0x12L,0x71L,0x12L}},{{246UL,255UL,2UL}},{{246UL,246UL,255UL}},{{0x12L,255UL,255UL}}}; + int i, j, k; + for (g_215 = 0; (g_215 <= 3); g_215 += 1) + { /* block id: 142 */ + int i; + for (g_68 = 0; (g_68 <= 3); g_68 += 1) + { /* block id: 145 */ + l_286[7][0][1]--; + } + for (p_65 = 2; (p_65 <= 8); p_65 += 1) + { /* block id: 150 */ + struct S2 *l_289 = NULL; + struct S2 *l_290 = &g_291[0][1]; + (*l_290) = g_121; + if (p_64) + goto lbl_190; + } + for (g_161 = 0; (g_161 <= 3); g_161 += 1) + { /* block id: 156 */ + return &g_2; + } + if (g_241[g_187]) + continue; + } + } + } + l_258 = p_64; + if (((safe_mul_func_uint8_t_u_u((((!((safe_mul_func_uint8_t_u_u((p_65 | ((!(safe_rshift_func_uint8_t_u_u(((-3L) | (p_64 || (&g_208 == l_298[3][2]))), 5))) && g_242)), (((safe_mod_func_uint16_t_u_u((l_308 = (safe_mul_func_uint16_t_u_u(((l_258 |= (safe_mod_func_int8_t_s_s((-1L), ((p_65 != ((p_65 | l_305) , 0x0DA34F26F14F79CFLL)) || l_306)))) , g_159), 0L))), (-1L))) , g_208) , p_65))) <= p_64)) & 1L) > 0x66L), 5L)) && 0UL)) + { /* block id: 166 */ + uint32_t **l_315 = &l_307; + struct S2 l_320 = {0x97D02AEDL,0xD98A267DB47F5A99LL}; + uint64_t *l_321 = NULL; + uint64_t *l_322 = &g_159; + uint16_t *l_324 = &g_161; + l_258 = (safe_mod_func_int32_t_s_s(((!(safe_add_func_uint16_t_u_u(g_203, ((p_65 == (safe_mul_func_int8_t_s_s(((((((((((p_65 != (((*l_315) = &g_114) == NULL)) , ((*l_324) = (((*l_237) = (safe_mul_func_int16_t_s_s((g_68 != ((safe_mod_func_int32_t_s_s((g_208.f2 && ((*l_322) = ((l_320 , (l_320.f1 > 1L)) || g_2))), g_121.f0)) >= (*g_61))), g_323))) & 0xD4L))) <= g_2) || (-2L)) , 0xF4L) & 255UL) , 1L) & p_65) , 0xFE222A196B499643LL) && p_65), p_64))) , p_64)))) , 0x7C957AF7L), (-1L))); + } + else + { /* block id: 172 */ + uint32_t *l_329[8] = {NULL,&l_268,&l_268,NULL,&l_268,&l_268,NULL,&l_268}; + int32_t l_349 = 2L; + int32_t l_357 = 0x3309E014L; + struct S2 l_362 = {0L,-4L}; + int i; + for (g_215 = 0; (g_215 != 12); ++g_215) + { /* block id: 175 */ + int32_t l_332 = 0x995CAD86L; + uint32_t *l_333 = &g_215; + struct S2 l_334[8][3] = {{{0x249C85D9L,0L},{0x249C85D9L,0L},{0x249C85D9L,0L}},{{-1L,0L},{-1L,0L},{-1L,0L}},{{0x249C85D9L,0L},{0x249C85D9L,0L},{0x249C85D9L,0L}},{{-1L,0L},{-1L,0L},{-1L,0L}},{{0x249C85D9L,0L},{0x249C85D9L,0L},{0x249C85D9L,0L}},{{-1L,0L},{-1L,0L},{-1L,0L}},{{0x249C85D9L,0L},{0x249C85D9L,0L},{0x249C85D9L,0L}},{{-1L,0L},{-1L,0L},{-1L,0L}}}; + struct S2 *l_335 = &g_291[0][5]; + int32_t *l_336 = &l_258; + int32_t *l_337 = &l_332; + int32_t *l_338 = &l_258; + int32_t *l_339 = &l_267; + int32_t *l_340 = &l_308; + int32_t *l_341 = &g_62; + int32_t *l_342 = NULL; + int32_t *l_343 = &l_267; + int32_t *l_344 = &l_267; + int32_t *l_345 = &l_308; + int32_t *l_346 = &l_332; + int32_t *l_347 = &g_291[0][1].f0; + int32_t *l_348 = NULL; + int32_t *l_350 = &l_332; + int32_t *l_351 = &l_258; + int32_t *l_352 = &g_291[0][1].f0; + int32_t *l_353 = &g_291[0][1].f0; + int32_t *l_354 = &g_62; + int32_t *l_355[7]; + int i, j; + for (i = 0; i < 7; i++) + l_355[i] = &l_334[1][0].f0; + (*l_335) = (g_208 , (((((safe_add_func_int64_t_s_s(g_242, (1L || p_65))) | (l_329[7] == ((((safe_sub_func_int8_t_s_s((~g_208.f0), (+l_258))) > ((p_65 ^ l_332) , 3UL)) , g_121.f0) , l_333))) || g_215) <= l_332) , l_334[1][0])); + ++l_359; + (*l_335) = l_362; + } + for (l_306 = 0; (l_306 >= 25); ++l_306) + { /* block id: 182 */ + return &g_62; + } + return &g_2; + } + for (g_323 = 0; (g_323 < 1); g_323 = safe_add_func_uint8_t_u_u(g_323, 5)) + { /* block id: 189 */ + int32_t *l_367 = &g_62; + int32_t *l_368 = NULL; + int32_t l_369 = 0x32767108L; + int32_t *l_370 = &l_258; + int32_t *l_371 = &l_356; + int32_t *l_372 = &l_258; + int32_t *l_373 = &g_291[0][1].f0; + int32_t *l_374[4]; + int i; + for (i = 0; i < 4; i++) + l_374[i] = &l_308; + --l_375; + } + } + (*l_381) = ((*l_380) = g_378[3]); + return &g_2; +} + + + + +/* ---------------------------------------- */ +int main (int argc, char* argv[]) +{ + int i, j; + int print_hash_value = 0; + if (argc == 2 && strcmp(argv[1], "1") == 0) print_hash_value = 1; + platform_main_begin(); + crc32_gentab(); + func_1(); + transparent_crc(g_2, "g_2", print_hash_value); + transparent_crc(g_27, "g_27", print_hash_value); + transparent_crc(g_38, "g_38", print_hash_value); + transparent_crc(g_62, "g_62", print_hash_value); + transparent_crc(g_68, "g_68", print_hash_value); + transparent_crc(g_78, "g_78", print_hash_value); + transparent_crc(g_114, "g_114", print_hash_value); + transparent_crc(g_121.f0, "g_121.f0", print_hash_value); + transparent_crc(g_121.f1, "g_121.f1", print_hash_value); + transparent_crc(g_159, "g_159", print_hash_value); + transparent_crc(g_161, "g_161", print_hash_value); + transparent_crc(g_184, "g_184", print_hash_value); + transparent_crc(g_187, "g_187", print_hash_value); + transparent_crc(g_202, "g_202", print_hash_value); + transparent_crc(g_203, "g_203", print_hash_value); + transparent_crc(g_208.f0, "g_208.f0", print_hash_value); + transparent_crc(g_208.f1, "g_208.f1", print_hash_value); + transparent_crc(g_208.f2, "g_208.f2", print_hash_value); + transparent_crc(g_215, "g_215", print_hash_value); + transparent_crc(g_239, "g_239", print_hash_value); + transparent_crc(g_240, "g_240", print_hash_value); + for (i = 0; i < 4; i++) + { + transparent_crc(g_241[i], "g_241[i]", print_hash_value); + if (print_hash_value) printf("index = [%d]\n", i); + + } + transparent_crc(g_242, "g_242", print_hash_value); + for (i = 0; i < 3; i++) + { + transparent_crc(g_244[i], "g_244[i]", print_hash_value); + if (print_hash_value) printf("index = [%d]\n", i); + + } + for (i = 0; i < 4; i++) + { + for (j = 0; j < 6; j++) + { + transparent_crc(g_291[i][j].f0, "g_291[i][j].f0", print_hash_value); + transparent_crc(g_291[i][j].f1, "g_291[i][j].f1", print_hash_value); + if (print_hash_value) printf("index = [%d][%d]\n", i, j); + + } + } + transparent_crc(g_323, "g_323", print_hash_value); + for (i = 0; i < 4; i++) + { + transparent_crc(g_386[i], "g_386[i]", print_hash_value); + if (print_hash_value) printf("index = [%d]\n", i); + + } + transparent_crc(g_408.f0, "g_408.f0", print_hash_value); + transparent_crc(g_408.f1, "g_408.f1", print_hash_value); + transparent_crc(g_408.f2, "g_408.f2", print_hash_value); + transparent_crc(g_408.f3, "g_408.f3", print_hash_value); + transparent_crc(g_408.f4, "g_408.f4", print_hash_value); + transparent_crc(g_408.f5, "g_408.f5", print_hash_value); + transparent_crc(g_408.f6, "g_408.f6", print_hash_value); + transparent_crc(g_408.f7, "g_408.f7", print_hash_value); + transparent_crc(g_467, "g_467", print_hash_value); + transparent_crc(g_468, "g_468", print_hash_value); + transparent_crc(g_476, "g_476", print_hash_value); + transparent_crc(g_565, "g_565", print_hash_value); + transparent_crc(g_605.f0, "g_605.f0", print_hash_value); + transparent_crc(g_605.f1, "g_605.f1", print_hash_value); + transparent_crc(g_605.f2, "g_605.f2", print_hash_value); + transparent_crc(g_605.f3, "g_605.f3", print_hash_value); + transparent_crc(g_605.f4, "g_605.f4", print_hash_value); + transparent_crc(g_605.f5, "g_605.f5", print_hash_value); + transparent_crc(g_605.f6, "g_605.f6", print_hash_value); + transparent_crc(g_605.f7, "g_605.f7", print_hash_value); + transparent_crc(g_706, "g_706", print_hash_value); + transparent_crc(g_721, "g_721", print_hash_value); + for (i = 0; i < 5; i++) + { + transparent_crc(g_732[i], "g_732[i]", print_hash_value); + if (print_hash_value) printf("index = [%d]\n", i); + + } + platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value); + return 0; +} + +/************************ statistics ************************* +XXX max struct depth: 1 +breakdown: + depth: 0, occurrence: 213 + depth: 1, occurrence: 18 +XXX total union variables: 0 + +XXX non-zero bitfields defined in structs: 9 +XXX zero bitfields defined in structs: 0 +XXX const bitfields defined in structs: 1 +XXX volatile bitfields defined in structs: 0 +XXX structs with bitfields in the program: 19 +breakdown: + indirect level: 0, occurrence: 8 + indirect level: 1, occurrence: 7 + indirect level: 2, occurrence: 4 +XXX full-bitfields structs in the program: 0 +breakdown: +XXX times a bitfields struct's address is taken: 18 +XXX times a bitfields struct on LHS: 0 +XXX times a bitfields struct on RHS: 15 +XXX times a single bitfield on LHS: 0 +XXX times a single bitfield on RHS: 14 + +XXX max expression depth: 40 +breakdown: + depth: 1, occurrence: 150 + depth: 2, occurrence: 38 + depth: 4, occurrence: 3 + depth: 7, occurrence: 1 + depth: 15, occurrence: 1 + depth: 18, occurrence: 3 + depth: 19, occurrence: 1 + depth: 21, occurrence: 3 + depth: 22, occurrence: 1 + depth: 23, occurrence: 1 + depth: 24, occurrence: 1 + depth: 25, occurrence: 3 + depth: 31, occurrence: 1 + depth: 33, occurrence: 1 + depth: 34, occurrence: 1 + depth: 35, occurrence: 1 + depth: 40, occurrence: 1 + +XXX total number of pointers: 223 + +XXX times a variable address is taken: 543 +XXX times a pointer is dereferenced on RHS: 51 +breakdown: + depth: 1, occurrence: 34 + depth: 2, occurrence: 17 +XXX times a pointer is dereferenced on LHS: 78 +breakdown: + depth: 1, occurrence: 78 +XXX times a pointer is compared with null: 11 +XXX times a pointer is compared with address of another variable: 4 +XXX times a pointer is compared with another pointer: 3 +XXX times a pointer is qualified to be dereferenced: 3931 + +XXX max dereference level: 2 +breakdown: + level: 0, occurrence: 0 + level: 1, occurrence: 316 + level: 2, occurrence: 69 +XXX number of pointers point to pointers: 42 +XXX number of pointers point to scalars: 163 +XXX number of pointers point to structs: 18 +XXX percent of pointers has null in alias set: 23.3 +XXX average alias set size: 1.38 + +XXX times a non-volatile is read: 508 +XXX times a non-volatile is write: 276 +XXX times a volatile is read: 0 +XXX times read thru a pointer: 0 +XXX times a volatile is write: 0 +XXX times written thru a pointer: 0 +XXX times a volatile is available for access: 0 +XXX percentage of non-volatile access: 100 + +XXX forward jumps: 0 +XXX backward jumps: 2 + +XXX stmts: 141 +XXX max block depth: 5 +breakdown: + depth: 0, occurrence: 30 + depth: 1, occurrence: 13 + depth: 2, occurrence: 19 + depth: 3, occurrence: 25 + depth: 4, occurrence: 21 + depth: 5, occurrence: 33 + +XXX percentage a fresh-made variable is used: 17.8 +XXX percentage an existing variable is used: 82.2 +FYI: the random generator makes assumptions about the integer size. See platform.info for more details. +********************* end of statistics **********************/ + diff --git a/tests/fuzz/18.cpp.txt b/tests/fuzz/18.cpp.txt new file mode 100644 index 00000000..33a07e9f --- /dev/null +++ b/tests/fuzz/18.cpp.txt @@ -0,0 +1 @@ +checksum = C536CE7C diff --git a/tests/fuzz/9.c b/tests/fuzz/9.c new file mode 100644 index 00000000..3e69535e --- /dev/null +++ b/tests/fuzz/9.c @@ -0,0 +1,1296 @@ +/* + * This is a RANDOMLY GENERATED PROGRAM. + * + * Generator: csmith 2.2.0 + * Git version: bf42ffd + * Options: --no-volatiles --no-packed-struct --no-math64 + * Seed: 3993158628 + */ + +#include "csmith.h" + + +static long __undefined; + +/* --- Struct/Union Declarations --- */ +struct S0 { + signed f0 : 2; + signed f1 : 30; + const unsigned f2 : 2; + signed f3 : 15; + unsigned f4 : 13; + unsigned f5 : 2; + signed f6 : 6; + signed f7 : 19; + signed f8 : 5; +}; + +union U1 { + const int8_t f0; +}; + +/* --- GLOBAL VARIABLES --- */ +static int32_t g_2 = 0xDBC37078L; +static uint32_t g_24 = 1UL; +static int16_t g_36 = 1L; +static int32_t g_52 = 0L; +static int32_t g_53 = 0xB92BB776L; +static int32_t g_55 = 0xD870105CL; +static uint16_t g_72 = 0xB820L; +static int32_t *g_86 = &g_52; +static struct S0 g_109 = {1,-3768,1,145,49,0,-1,-585,0}; +static uint8_t g_113 = 0xB8L; +static uint8_t g_114 = 0xE1L; +static int16_t g_126[4][6] = {{0x5BB1L,0x13A7L,0x5786L,0x89D4L,0x5786L,0x13A7L},{0xD5BCL,0x5BB1L,0x5786L,2L,0x8967L,0x89D4L},{0x4E36L,2L,0x13A7L,0x13A7L,2L,0x4E36L},{0x13A7L,2L,0x4E36L,0xF1A0L,0x8967L,0x5786L}}; +static uint32_t g_141[2] = {1UL,1UL}; +static int8_t g_143 = 1L; +static uint8_t g_144 = 0x18L; +static uint16_t *g_194[1] = {&g_72}; +static int32_t g_215 = 3L; +static int32_t *g_214 = &g_215; +static int16_t g_217 = 0x0B9EL; +static int16_t *g_216 = &g_217; +static uint32_t g_234[6][6][7] = {{{4294967295UL,1UL,0xE50A6E4DL,0x7CBB9599L,0x4038AB73L,1UL,0x30275B19L},{0xEF103696L,4294967288UL,0xF9FCF56DL,4294967288UL,0xEF103696L,0UL,4UL},{0x4038AB73L,0x7CBB9599L,0xE50A6E4DL,1UL,4294967295UL,7UL,0xE50A6E4DL},{0UL,0xEF4BBCF4L,0UL,9UL,0UL,0xF9FCF56DL,0xF9FCF56DL},{0x30275B19L,0UL,0x7A5E963CL,0UL,0x30275B19L,0UL,0xE50A6E4DL},{0UL,9UL,0UL,0xEF4BBCF4L,0UL,0xF9FCF56DL,0xF01C7FA8L}},{{0xEEABF480L,0UL,0xB0A03C78L,0x3D45A5B2L,0x30275B19L,7UL,0xD95DDA20L},{0UL,0xEF4BBCF4L,1UL,0xEF4BBCF4L,0UL,0x9CA25930L,0xF01C7FA8L},{0x30275B19L,0x3D45A5B2L,0xB0A03C78L,0UL,0xEEABF480L,7UL,0xE50A6E4DL},{0UL,0xEF4BBCF4L,0UL,9UL,0UL,0xF9FCF56DL,0xF9FCF56DL},{0x30275B19L,0UL,0x7A5E963CL,0UL,0x30275B19L,0UL,0xE50A6E4DL},{0UL,9UL,0UL,0xEF4BBCF4L,0UL,0xF9FCF56DL,0xF01C7FA8L}},{{0xEEABF480L,0UL,0xB0A03C78L,0x3D45A5B2L,0x30275B19L,7UL,0xD95DDA20L},{0UL,0xEF4BBCF4L,1UL,0xEF4BBCF4L,0UL,0x9CA25930L,0xF01C7FA8L},{0x30275B19L,0x3D45A5B2L,0xB0A03C78L,0UL,0xEEABF480L,7UL,0xE50A6E4DL},{0UL,0xEF4BBCF4L,0UL,9UL,0UL,0xF9FCF56DL,0xF9FCF56DL},{0x30275B19L,0UL,0x7A5E963CL,0UL,0x30275B19L,0UL,0xE50A6E4DL},{0UL,9UL,0UL,0xEF4BBCF4L,0UL,0xF9FCF56DL,0xF01C7FA8L}},{{0xEEABF480L,0UL,0xB0A03C78L,0x3D45A5B2L,0x30275B19L,7UL,0xD95DDA20L},{0UL,0xEF4BBCF4L,1UL,0xEF4BBCF4L,0UL,0x9CA25930L,0xF01C7FA8L},{0x30275B19L,0x3D45A5B2L,0xB0A03C78L,0UL,0xEEABF480L,7UL,0xE50A6E4DL},{0UL,0xEF4BBCF4L,0UL,9UL,0UL,0xF9FCF56DL,0xF9FCF56DL},{0x30275B19L,0UL,0x7A5E963CL,0UL,0x30275B19L,0UL,0xE50A6E4DL},{0UL,9UL,0UL,0xEF4BBCF4L,0UL,0xF9FCF56DL,0xF01C7FA8L}},{{0xEEABF480L,0UL,0xB0A03C78L,0x3D45A5B2L,0x30275B19L,7UL,0xD95DDA20L},{0UL,0xEF4BBCF4L,1UL,0xEF4BBCF4L,0UL,0x9CA25930L,0xF01C7FA8L},{0x30275B19L,0x3D45A5B2L,0xB0A03C78L,0UL,0xEEABF480L,7UL,0xE50A6E4DL},{0UL,0xEF4BBCF4L,0UL,9UL,0UL,0xF9FCF56DL,0xF9FCF56DL},{0x30275B19L,0UL,0x7A5E963CL,0UL,0x30275B19L,0UL,0xE50A6E4DL},{0UL,9UL,0UL,0xEF4BBCF4L,0UL,0xF9FCF56DL,0xF01C7FA8L}},{{0x28C0AEB2L,0UL,0xFD89EE91L,0x495489C1L,0xD95DDA20L,0x177A3353L,0x7A5E963CL},{0xF9FCF56DL,4294967294UL,0x3E2A85B4L,4294967294UL,0xF9FCF56DL,4UL,0UL},{0xD95DDA20L,0x495489C1L,0xFD89EE91L,0UL,0x28C0AEB2L,0x177A3353L,0xB0A03C78L},{0x9CA25930L,4294967294UL,1UL,0xEF103696L,0xF9FCF56DL,1UL,1UL},{0xD95DDA20L,0UL,1UL,0UL,0xD95DDA20L,4294967295UL,0xB0A03C78L},{0xF9FCF56DL,0xEF103696L,1UL,4294967294UL,0x9CA25930L,1UL,0UL}}}; +static uint32_t *g_252[2][6] = {{&g_141[1],(void*)0,&g_141[1],(void*)0,&g_141[1],(void*)0},{&g_141[1],(void*)0,&g_141[1],(void*)0,&g_141[1],(void*)0}}; +static uint32_t g_312[2] = {0x15E444CFL,0x15E444CFL}; +static const union U1 g_331 = {-8L}; +static struct S0 g_350[9][8] = {{{-1,20557,0,-138,48,0,7,-279,4},{-0,-27047,1,59,12,0,3,510,2},{0,24814,0,172,41,1,5,583,-3},{1,12364,1,154,28,0,-0,-107,1},{0,24814,0,172,41,1,5,583,-3},{-0,-27047,1,59,12,0,3,510,2},{-1,20557,0,-138,48,0,7,-279,4},{-0,19189,1,60,64,1,1,97,2}},{{1,-6931,1,81,81,1,-2,483,0},{-1,-26584,0,-110,24,0,0,-318,3},{1,-10097,1,114,10,1,-4,152,3},{1,12364,1,154,28,0,-0,-107,1},{-1,20557,0,-138,48,0,7,-279,4},{-0,-28474,1,81,7,1,-7,16,2},{-1,32727,1,-65,83,1,4,-198,-0},{1,-10897,1,12,62,1,3,-592,2}},{{0,4827,1,-65,66,1,-3,-196,-3},{1,12364,1,154,28,0,-0,-107,1},{1,23006,1,51,25,1,-4,439,-4},{1,17086,1,-44,2,0,0,411,-4},{-1,20557,0,-138,48,0,7,-279,4},{1,17086,1,-44,2,0,0,411,-4},{1,23006,1,51,25,1,-4,439,-4},{1,12364,1,154,28,0,-0,-107,1}},{{1,-6931,1,81,81,1,-2,483,0},{-0,-27047,1,59,12,0,3,510,2},{0,4827,1,-65,66,1,-3,-196,-3},{1,-10897,1,12,62,1,3,-592,2},{0,24814,0,172,41,1,5,583,-3},{1,17086,1,-44,2,0,0,411,-4},{1,-6931,1,81,81,1,-2,483,0},{-0,19189,1,60,64,1,1,97,2}},{{-1,20557,0,-138,48,0,7,-279,4},{1,12364,1,154,28,0,-0,-107,1},{1,-10097,1,114,10,1,-4,152,3},{-1,-26584,0,-110,24,0,0,-318,3},{1,-6931,1,81,81,1,-2,483,0},{-0,-28474,1,81,7,1,-7,16,2},{1,-6931,1,81,81,1,-2,483,0},{-1,-26584,0,-110,24,0,0,-318,3}},{{0,4827,1,-65,66,1,-3,-196,-3},{-1,-26584,0,-110,24,0,0,-318,3},{0,4827,1,-65,66,1,-3,-196,-3},{1,17086,1,-44,2,0,0,411,-4},{-1,32727,1,-65,83,1,4,-198,-0},{-0,-27047,1,59,12,0,3,510,2},{1,23006,1,51,25,1,-4,439,-4},{-1,-26584,0,-110,24,0,0,-318,3}},{{-1,32727,1,-65,83,1,4,-198,-0},{-0,-27047,1,59,12,0,3,510,2},{1,23006,1,51,25,1,-4,439,-4},{-1,-26584,0,-110,24,0,0,-318,3},{0,24814,0,172,41,1,5,583,-3},{-0,19189,1,60,64,1,1,97,2},{-1,32727,1,-65,83,1,4,-198,-0},{-0,19189,1,60,64,1,1,97,2}},{{-1,32727,1,-65,83,1,4,-198,-0},{1,-10897,1,12,62,1,3,-592,2},{1,-10097,1,114,10,1,-4,152,3},{1,-10897,1,12,62,1,3,-592,2},{-1,32727,1,-65,83,1,4,-198,-0},{-0,-28474,1,81,7,1,-7,16,2},{-1,20557,0,-138,48,0,7,-279,4},{1,12364,1,154,28,0,-0,-107,1}},{{0,4827,1,-65,66,1,-3,-196,-3},{1,-10897,1,12,62,1,3,-592,2},{0,24814,0,172,41,1,5,583,-3},{1,17086,1,-44,2,0,0,411,-4},{1,-6931,1,81,81,1,-2,483,0},{-0,19189,1,60,64,1,1,97,2},{1,23006,1,51,25,1,-4,439,-4},{1,-10897,1,12,62,1,3,-592,2}}}; +static uint16_t *g_351 = (void*)0; +static int16_t g_408 = 0x7620L; +static union U1 g_477 = {1L}; +static int8_t *g_487 = &g_143; +static int8_t **g_486 = &g_487; +static const int32_t g_493 = 1L; +static int8_t g_543 = (-9L); +static uint8_t *g_555 = &g_144; +static uint8_t **g_554 = &g_555; +static uint16_t g_626 = 65526UL; +static const uint32_t g_664 = 1UL; +static const uint32_t g_666[1][9][4] = {{{4294967295UL,4294967293UL,4294967295UL,4294967293UL},{4294967295UL,4294967293UL,4294967295UL,4294967293UL},{4294967295UL,4294967293UL,4294967295UL,4294967293UL},{4294967295UL,4294967293UL,4294967295UL,4294967293UL},{4294967295UL,4294967293UL,4294967295UL,4294967293UL},{4294967295UL,4294967293UL,4294967295UL,4294967293UL},{4294967295UL,4294967293UL,4294967295UL,4294967293UL},{4294967295UL,4294967293UL,4294967295UL,4294967293UL},{4294967295UL,4294967293UL,4294967295UL,4294967293UL}}}; +static uint8_t g_733 = 0UL; +static uint32_t g_776 = 4294967291UL; +static int32_t ** const g_786 = &g_214; +static int32_t ** const *g_785 = &g_786; +static int32_t ** const **g_784[2] = {&g_785,&g_785}; +static uint16_t g_807 = 65535UL; +static int32_t *g_808 = (void*)0; +static int32_t g_812 = 0xAE392FB2L; +static union U1 g_824 = {0xC0L}; +static int32_t g_825 = (-1L); +static int16_t g_891 = (-1L); +static uint32_t *g_967[10][9] = {{&g_234[2][0][1],&g_234[2][0][1],&g_141[0],&g_141[1],&g_141[0],&g_141[0],&g_141[1],&g_141[0],&g_234[2][0][1]},{&g_141[0],&g_234[4][3][3],&g_141[1],&g_234[3][1][4],&g_24,&g_141[0],&g_141[1],&g_234[2][0][1],&g_141[0]},{&g_24,&g_234[2][0][1],&g_234[2][0][1],&g_234[2][0][1],(void*)0,&g_234[2][0][1],&g_141[0],(void*)0,&g_234[4][3][3]},{&g_776,&g_234[3][1][4],&g_141[0],&g_141[1],&g_24,&g_234[2][0][1],&g_234[2][0][1],&g_234[2][0][1],(void*)0},{&g_234[3][1][4],&g_234[2][0][1],&g_24,&g_234[3][1][1],&g_234[3][1][1],&g_24,&g_234[2][0][1],&g_234[3][1][4],&g_141[0]},{&g_776,&g_24,&g_234[2][0][1],&g_24,&g_234[3][1][1],&g_141[0],&g_141[1],&g_141[1],&g_141[1]},{&g_234[4][3][3],&g_141[0],&g_24,&g_234[3][1][4],&g_24,&g_141[0],&g_234[4][3][3],&g_141[0],&g_141[0]},{&g_141[0],&g_234[2][0][1],&g_234[4][3][3],&g_234[3][1][4],&g_141[1],&g_234[3][1][1],(void*)0,&g_24,(void*)0},{(void*)0,&g_776,&g_24,&g_24,&g_776,(void*)0,&g_141[0],&g_141[0],&g_234[4][3][3]},{&g_24,&g_234[2][0][1],&g_24,&g_234[3][1][1],&g_141[0],&g_141[1],&g_141[1],&g_141[1],&g_141[1]}}; +static int32_t * const *g_1021 = &g_214; +static int32_t * const **g_1020 = &g_1021; +static union U1 **g_1028 = (void*)0; +static int8_t g_1058 = 0x12L; +static int32_t ***g_1078 = (void*)0; +static int8_t ** const g_1095 = (void*)0; +static int8_t ** const *g_1094 = &g_1095; +static const union U1 g_1177 = {-3L}; +static const int8_t *g_1218 = &g_1177.f0; +static const int8_t **g_1217 = &g_1218; + + +/* --- FORWARD DECLARATIONS --- */ +static int16_t func_1(void); +static int32_t func_11(int32_t * p_12, uint32_t p_13, const int32_t p_14, int32_t p_15, int32_t * p_16); +static uint32_t func_20(uint32_t p_21); +static const uint8_t func_31(uint8_t p_32); +static int32_t * func_40(uint32_t p_41, int32_t * p_42, int16_t * p_43, int32_t p_44, uint32_t * p_45); +static union U1 func_46(int8_t p_47); +static int32_t func_48(int32_t * p_49); +static uint16_t func_97(uint32_t p_98); +static int32_t * func_99(uint32_t * const p_100, uint8_t p_101, uint8_t p_102, const int8_t p_103); +static uint8_t func_104(const struct S0 p_105, int16_t p_106, int32_t p_107); + + +/* --- FUNCTIONS --- */ +/* ------------------------------------------ */ +/* + * reads : g_2 g_24 g_36 g_53 g_86 g_52 g_109 g_114 g_72 g_144 g_55 g_126 g_141 g_214 g_216 g_215 g_217 g_234 g_312 g_331 g_350 g_351 g_143 g_408 g_486 g_493 g_487 g_543 g_113 g_554 g_555 g_477 g_626 g_784 g_666 g_824 g_825 g_785 g_786 g_891 g_733 g_967 g_1020 g_1028 g_807 g_1058 g_1078 g_1021 + * writes: g_2 g_24 g_36 g_52 g_53 g_55 g_86 g_113 g_126 g_109.f3 g_114 g_141 g_143 g_144 g_72 g_194 g_215 g_252 g_217 g_312 g_234 g_486 g_350.f8 g_214 g_351 g_626 g_776 g_808 g_408 g_733 g_1020 g_807 g_825 g_1078 g_1094 g_1058 g_967 g_543 + */ +static int16_t func_1(void) +{ /* block id: 0 */ + int32_t l_8 = (-1L); + int32_t *l_19 = (void*)0; + uint32_t l_39 = 18446744073709551615UL; + if (g_2) + { /* block id: 1 */ + uint8_t l_3 = 0UL; + int32_t l_22 = 0xB0420410L; + uint32_t *l_23 = &g_24; + int16_t *l_35 = &g_36; + int32_t *l_1232 = &g_52; + l_3--; + for (l_3 = 2; (l_3 <= 56); l_3 = safe_add_func_int8_t_s_s(l_3, 1)) + { /* block id: 5 */ + int16_t l_9[2][5][10] = {{{0x4E76L,0xFA83L,0x1F6FL,0xCA36L,0xCA36L,0x1F6FL,0xFA83L,0x4E76L,(-1L),0xC1D1L},{0x2278L,0xF72BL,0L,0xDB82L,8L,0x1F6FL,0xEE5AL,0x2278L,0xDB82L,0xCA36L},{0x4E76L,0x80DBL,0L,8L,0x391CL,0x2278L,2L,0x4E76L,1L,0xCA36L},{0L,0xD2B5L,0x1F6FL,0xC1D1L,8L,0L,2L,0L,8L,0xC1D1L},{0x9F7CL,0x80DBL,0x9F7CL,0xC1D1L,0xCA36L,0L,0xEE5AL,0x9F7CL,1L,(-1L)}},{{0x9F7CL,0xF72BL,0x4E76L,8L,1L,0L,0xFA83L,0x9F7CL,0xDB82L,1L},{0L,0xFA83L,0x9F7CL,0xDB82L,1L,0x2278L,0x80DBL,0L,(-1L),(-1L)},{0x4E76L,0xFA83L,0x1F6FL,0xCA36L,0xCA36L,0x1F6FL,0xFA83L,0x4E76L,(-1L),0xC1D1L},{0x2278L,0xF72BL,0L,0xDB82L,8L,0x1F6FL,0xEE5AL,0x2278L,0xDB82L,0xCA36L},{0x4E76L,0x80DBL,0L,8L,0x391CL,0x2278L,2L,0x4E76L,1L,0xCA36L}}}; + int32_t *l_10 = &g_2; + int i, j, k; + (*l_10) |= (l_9[0][1][8] = l_8); + } + (*l_1232) = func_11(&l_8, (safe_rshift_func_uint16_t_u_s((((void*)0 == l_19) , (func_20((++(*l_23))) , (safe_rshift_func_uint8_t_u_s(func_31(((safe_rshift_func_uint16_t_u_s((0xFA3CL & g_2), (((!((*l_35) ^= g_24)) <= g_24) || (safe_sub_func_int32_t_s_s((l_22 <= l_39), 0xE948ECA1L))))) , 1UL)), g_109.f2)))), g_666[0][0][3])), l_22, l_22, &l_22); + } + else + { /* block id: 556 */ + int16_t l_1233 = 0x9A09L; + int8_t *l_1240 = &g_1058; + const uint8_t l_1241 = 1UL; + union U1 l_1242 = {9L}; + (*g_214) = ((g_477 , l_1233) ^ (((safe_add_func_int16_t_s_s((safe_sub_func_uint8_t_u_u((((((!((safe_mul_func_int8_t_s_s(((*l_1240) = ((*g_487) = 4L)), ((-1L) & (-7L)))) & ((((l_1241 < (l_1241 | l_1241)) , (((l_1242 , l_1233) < l_1241) & l_39)) > l_1242.f0) | 6UL))) , l_1233) != (*g_86)) == 0x7FL) != (*g_555)), (*g_555))), (-1L))) , l_39) <= (**g_1021))); + (**g_786) &= 0x557529FFL; + } + return (*g_216); +} + + +/* ------------------------------------------ */ +/* + * reads : g_216 g_52 g_824 g_555 g_144 g_141 g_825 g_487 g_217 g_785 g_786 g_214 g_331 g_554 g_143 g_234 g_626 g_891 g_733 g_114 g_486 g_312 g_967 g_55 g_477 g_1020 g_1028 g_807 g_1058 g_408 g_1078 g_215 g_350.f6 g_72 g_113 + * writes: g_72 g_52 g_114 g_217 g_808 g_126 g_143 g_214 g_408 g_234 g_144 g_626 g_733 g_351 g_141 g_252 g_113 g_1020 g_807 g_776 g_55 g_24 g_825 g_1078 g_1094 g_1058 g_215 g_2 g_967 g_543 + */ +static int32_t func_11(int32_t * p_12, uint32_t p_13, const int32_t p_14, int32_t p_15, int32_t * p_16) +{ /* block id: 328 */ + int32_t *l_794 = &g_55; + uint32_t l_821 = 0UL; + const uint32_t *l_910 = (void*)0; + const int8_t *l_915 = &g_477.f0; + uint32_t **l_968 = &g_252[0][5]; + int16_t l_969 = 0L; + struct S0 l_988[8] = {{-1,2956,0,-52,85,0,1,513,4},{-1,747,0,116,79,1,2,-456,1},{-1,2956,0,-52,85,0,1,513,4},{-1,747,0,116,79,1,2,-456,1},{-1,2956,0,-52,85,0,1,513,4},{-1,747,0,116,79,1,2,-456,1},{-1,2956,0,-52,85,0,1,513,4},{-1,747,0,116,79,1,2,-456,1}}; + uint8_t **l_992[6] = {&g_555,&g_555,&g_555,&g_555,&g_555,&g_555}; + uint32_t l_1018 = 1UL; + int32_t l_1033[10] = {(-5L),0x05CEC50EL,(-5L),0x05CEC50EL,(-5L),0x05CEC50EL,(-5L),0x05CEC50EL,(-5L),0x05CEC50EL}; + int32_t l_1163[10]; + int32_t l_1220 = 9L; + int32_t l_1229 = 0x0A906A68L; + uint32_t l_1230[8][4] = {{0x1199E2CDL,0xCCF4C89AL,5UL,0UL},{0x1199E2CDL,0xE2EEF004L,0UL,0UL},{0xCCF4C89AL,0xCCF4C89AL,0x4DCCF4F6L,0xE2EEF004L},{0xE2EEF004L,0x1199E2CDL,0x4DCCF4F6L,0x1199E2CDL},{0xCCF4C89AL,5UL,0UL,0x4DCCF4F6L},{0x1199E2CDL,5UL,5UL,0x1199E2CDL},{5UL,0x1199E2CDL,0xCCF4C89AL,0xE2EEF004L},{5UL,0xCCF4C89AL,5UL,0UL}}; + uint16_t **l_1231[2]; + int i, j; + for (i = 0; i < 10; i++) + l_1163[i] = 0x1BA9B6D4L; + for (i = 0; i < 2; i++) + l_1231[i] = &g_194[0]; +lbl_1113: + for (g_72 = (-30); (g_72 < 11); g_72 = safe_add_func_uint16_t_u_u(g_72, 8)) + { /* block id: 331 */ + int32_t *l_793 = &g_52; + int32_t *l_815 = &g_812; + uint32_t l_889 = 18446744073709551615UL; + uint16_t *l_928 = &g_626; + int32_t l_956 = 0x322A5631L; + uint32_t l_957 = 0x0E4C1742L; + for (g_52 = 0; (g_52 == (-15)); --g_52) + { /* block id: 334 */ + int32_t l_792 = 0x51FDD8C4L; + (*p_12) &= l_792; + } + l_794 = l_793; + for (g_114 = 0; (g_114 == 36); ++g_114) + { /* block id: 340 */ + uint16_t * const l_806 = &g_807; + uint16_t * const *l_805 = &l_806; + int32_t l_816 = 1L; + uint32_t **l_831 = &g_252[1][0]; + for (g_52 = (-18); (g_52 == (-27)); g_52 = safe_sub_func_int16_t_s_s(g_52, 7)) + { /* block id: 343 */ + uint16_t **l_803 = &g_351; + uint16_t * const **l_804 = (void*)0; + int32_t **l_809 = (void*)0; + int32_t *l_811 = &g_812; + int32_t **l_810 = &l_811; + int32_t *l_814 = &g_812; + int32_t **l_813[9][9][3] = {{{&l_814,(void*)0,&l_814},{&l_814,&l_814,&l_814},{&l_814,&l_814,(void*)0},{&l_814,&l_814,&l_814},{&l_814,&l_814,&l_814},{&l_814,&l_814,&l_814},{&l_814,&l_814,(void*)0},{&l_814,&l_814,&l_814},{&l_814,&l_814,(void*)0}},{{&l_814,&l_814,&l_814},{&l_814,&l_814,&l_814},{(void*)0,&l_814,&l_814},{(void*)0,&l_814,&l_814},{&l_814,&l_814,&l_814},{(void*)0,(void*)0,&l_814},{(void*)0,&l_814,&l_814},{&l_814,&l_814,&l_814},{&l_814,&l_814,&l_814}},{{&l_814,&l_814,(void*)0},{&l_814,&l_814,&l_814},{&l_814,&l_814,(void*)0},{&l_814,(void*)0,&l_814},{&l_814,&l_814,&l_814},{&l_814,(void*)0,&l_814},{&l_814,&l_814,(void*)0},{(void*)0,&l_814,&l_814},{(void*)0,&l_814,&l_814}},{{&l_814,&l_814,&l_814},{(void*)0,&l_814,&l_814},{(void*)0,(void*)0,(void*)0},{&l_814,&l_814,&l_814},{&l_814,(void*)0,&l_814},{&l_814,&l_814,&l_814},{&l_814,&l_814,&l_814},{&l_814,&l_814,&l_814},{&l_814,&l_814,(void*)0}},{{&l_814,&l_814,&l_814},{&l_814,&l_814,&l_814},{&l_814,(void*)0,&l_814},{&l_814,&l_814,&l_814},{&l_814,&l_814,(void*)0},{&l_814,&l_814,&l_814},{&l_814,&l_814,&l_814},{&l_814,&l_814,&l_814},{&l_814,&l_814,(void*)0}},{{&l_814,&l_814,&l_814},{&l_814,&l_814,(void*)0},{&l_814,&l_814,&l_814},{&l_814,&l_814,&l_814},{(void*)0,&l_814,&l_814},{(void*)0,&l_814,&l_814},{&l_814,&l_814,&l_814},{(void*)0,(void*)0,&l_814},{(void*)0,(void*)0,&l_814}},{{&l_814,&l_814,&l_814},{(void*)0,&l_814,&l_814},{&l_814,&l_814,&l_814},{&l_814,&l_814,&l_814},{&l_814,&l_814,&l_814},{&l_814,&l_814,&l_814},{&l_814,&l_814,&l_814},{(void*)0,(void*)0,(void*)0},{&l_814,&l_814,(void*)0}},{{&l_814,(void*)0,&l_814},{&l_814,&l_814,(void*)0},{&l_814,(void*)0,(void*)0},{&l_814,&l_814,&l_814},{(void*)0,(void*)0,&l_814},{&l_814,&l_814,&l_814},{&l_814,&l_814,&l_814},{&l_814,&l_814,&l_814},{&l_814,&l_814,&l_814}},{{&l_814,&l_814,&l_814},{(void*)0,&l_814,&l_814},{&l_814,&l_814,&l_814},{&l_814,(void*)0,(void*)0},{&l_814,&l_814,(void*)0},{&l_814,(void*)0,&l_814},{&l_814,&l_814,(void*)0},{&l_814,&l_814,(void*)0},{&l_814,&l_814,&l_814}}}; + int16_t *l_822 = (void*)0; + int16_t *l_823[3][4] = {{(void*)0,(void*)0,(void*)0,(void*)0},{(void*)0,(void*)0,(void*)0,(void*)0},{(void*)0,(void*)0,(void*)0,(void*)0}}; + int32_t l_826[6][10][1] = {{{7L},{0x94DFE73AL},{1L},{(-1L)},{2L},{0x0C09348AL},{2L},{(-1L)},{1L},{0x94DFE73AL}},{{7L},{0xCD063AC6L},{0x9A614DC4L},{0xCD063AC6L},{7L},{0x94DFE73AL},{1L},{(-1L)},{2L},{0x0C09348AL}},{{2L},{(-1L)},{1L},{0x94DFE73AL},{7L},{0xCD063AC6L},{0x9A614DC4L},{0xCD063AC6L},{7L},{0x94DFE73AL}},{{1L},{(-1L)},{2L},{0x0C09348AL},{2L},{(-1L)},{1L},{0x94DFE73AL},{7L},{0xCD063AC6L}},{{0x9A614DC4L},{0xCD063AC6L},{7L},{0x94DFE73AL},{1L},{(-1L)},{2L},{0x0C09348AL},{2L},{(-1L)}},{{1L},{0x94DFE73AL},{7L},{0xCD063AC6L},{0x9A614DC4L},{0xCD063AC6L},{7L},{0x94DFE73AL},{1L},{(-1L)}}}; + int i, j, k; + (*p_16) &= (((*g_487) = (safe_sub_func_int8_t_s_s((p_15 , (((((safe_add_func_int16_t_s_s(((*g_216) = (l_803 != (l_805 = (void*)0))), ((((g_126[2][2] = ((((!(((l_815 = ((*l_810) = (g_808 = (void*)0))) != (void*)0) == (~1L))) != l_816) | (safe_add_func_int8_t_s_s(((safe_sub_func_int32_t_s_s((((p_15 == 1L) == (*l_793)) >= (*l_793)), l_821)) >= l_816), p_14))) | p_14)) , g_824) , (*g_555)) != (*l_793)))) , 0x04B39DE0L) ^ p_15) ^ g_141[1]) || g_825)), (*l_794)))) > l_826[1][1][0]); + } + (*l_793) = (safe_rshift_func_int16_t_s_u((*g_216), (safe_mod_func_uint8_t_u_u(((void*)0 != l_831), ((*l_794) & p_13))))); + if ((*p_16)) + { /* block id: 354 */ + int32_t **l_832 = (void*)0; + int32_t **l_833[1][10][2] = {{{&g_86,&g_86},{&l_794,&g_86},{&g_86,&l_794},{&l_793,&l_793},{&l_794,&l_793},{&l_793,&l_794},{&l_793,&l_793},{&l_794,&l_793},{&l_793,&l_794},{&g_86,&g_86}}}; + int i, j, k; + (*g_786) = (**g_785); + p_12 = ((**g_785) = &p_15); + } + else + { /* block id: 358 */ + uint32_t l_834 = 0x597229EDL; + ++l_834; + (**g_785) = l_793; + if ((*l_794)) + continue; + } + } + for (g_143 = 20; (g_143 >= 19); g_143 = safe_sub_func_int8_t_s_s(g_143, 3)) + { /* block id: 366 */ + int8_t *l_858[7] = {&g_543,&g_543,&g_543,&g_543,&g_543,&g_543,&g_543}; + const int32_t l_859 = 0x8F3A324DL; + int8_t l_860 = 3L; + union U1 *l_863 = (void*)0; + int32_t l_868 = 0x4157F9B0L; + int16_t *l_919[10]; + uint32_t *l_962 = &g_141[1]; + int i; + for (i = 0; i < 10; i++) + l_919[i] = &g_126[1][4]; + (**g_785) = (void*)0; + if (((safe_div_func_int8_t_s_s((safe_mod_func_uint32_t_u_u((((((*g_216) <= (safe_mul_func_uint8_t_u_u(((g_331 , (**g_554)) , (safe_sub_func_int8_t_s_s((safe_unary_minus_func_int8_t_s(((safe_sub_func_uint32_t_u_u((safe_mod_func_uint32_t_u_u((+p_15), ((0L > (safe_sub_func_int8_t_s_s(((*l_793) = (safe_sub_func_uint8_t_u_u((safe_add_func_int16_t_s_s((g_408 = (*g_216)), (&g_808 != &g_808))), p_14))), p_14))) ^ (-1L)))), l_859)) == p_15))), (*g_487)))), p_15))) , 2L) == l_859) >= l_860), p_13)), 0x22L)) & (*g_216))) + { /* block id: 370 */ + union U1 *l_862 = &g_477; + union U1 **l_861 = &l_862; + uint32_t *l_869 = &g_234[2][0][1]; + int32_t l_876 = (-1L); + uint32_t *l_888[4][6] = {{&g_141[1],&g_141[1],(void*)0,&g_141[1],&g_141[1],(void*)0},{&g_141[1],&g_141[1],(void*)0,&g_141[1],&g_141[1],&g_141[1]},{&g_141[1],&g_141[1],&g_141[1],&g_141[1],&g_141[1],&g_141[1]},{&g_141[1],&g_141[1],&g_141[1],&g_141[1],&g_141[1],&g_141[1]}}; + uint16_t *l_890 = &g_626; + uint32_t l_896 = 0x1B4D8A09L; + uint8_t *l_899 = &g_733; + uint8_t *l_904 = (void*)0; + uint8_t *l_905 = &g_114; + const uint32_t *l_909 = &g_666[0][5][1]; + const uint32_t **l_908[2]; + const int8_t **l_916 = &l_915; + const int8_t *l_918 = &g_477.f0; + const int8_t **l_917 = &l_918; + int i, j; + for (i = 0; i < 2; i++) + l_908[i] = &l_909; + (*l_794) = ((((l_863 = ((*l_861) = (void*)0)) == ((((safe_rshift_func_uint8_t_u_u((((*l_794) || (safe_unary_minus_func_uint8_t_u(((safe_unary_minus_func_int32_t_s((-1L))) <= 0xC8L)))) != (((*l_890) |= ((((++(*l_869)) >= ((safe_div_func_int32_t_s_s((safe_lshift_func_int8_t_s_u((l_876 || (((safe_add_func_uint8_t_u_u((safe_mul_func_uint8_t_u_u(((**g_554) = (*g_555)), (*g_487))), ((safe_mul_func_uint8_t_u_u(((safe_unary_minus_func_uint32_t_u((safe_add_func_uint32_t_u_u((safe_mod_func_uint8_t_u_u(l_876, (((((l_889 = (0xEDF1L != 0xC34DL)) , (void*)0) != (void*)0) >= (*p_16)) , p_14))), p_15)))) , (*l_794)), 0xE3L)) < 0x71L))) ^ l_876) != (*l_793))), (*l_794))), (*p_12))) > 0x7A44L)) > (*g_216)) != 3UL)) , p_13)), 6)) > g_891) , 0x39L) , (void*)0)) , p_15) ^ 65534UL); + (*p_12) |= (((*l_861) != (((l_868 ^= ((safe_sub_func_uint8_t_u_u(((*g_555) = (l_896 == 0L)), (safe_mul_func_int16_t_s_s((0xC16CF829L != (((*l_899)--) < (safe_div_func_uint16_t_u_u((((((*l_869) = p_14) > (*p_16)) == ((((*g_487) > ((*l_905)--)) , &l_896) != (l_910 = p_16))) && (-1L)), (*g_216))))), (*g_216))))) , p_14)) && p_13) , &g_331)) || 0xAD58L); + if ((*l_793)) + break; + (*p_16) &= ((p_13 >= (safe_mod_func_int32_t_s_s((0xCBE4L >= ((*g_555) , (*g_216))), 1UL))) >= (safe_sub_func_int32_t_s_s((*p_12), ((((((*l_917) = ((*l_916) = l_915)) != (void*)0) , l_919[1]) != l_890) == p_14)))); + } + else + { /* block id: 389 */ + uint16_t **l_929 = &g_351; + int32_t l_930 = 0x94F847F7L; + struct S0 l_954 = {0,-17641,1,-5,1,1,-0,-701,-1}; + int32_t l_955[6][2] = {{2L,2L},{0xABC97F79L,2L},{2L,0xABC97F79L},{2L,2L},{0xABC97F79L,2L},{2L,0xABC97F79L}}; + int i, j; + l_868 ^= ((safe_div_func_uint16_t_u_u((((*l_793) = (((-1L) || (safe_rshift_func_uint8_t_u_u((safe_sub_func_int16_t_s_s((safe_div_func_int16_t_s_s((((*l_929) = l_928) == ((((l_930 == ((safe_rshift_func_int16_t_s_s((safe_unary_minus_func_uint16_t_u((safe_mod_func_int8_t_s_s((((*g_216) = ((void*)0 == &g_626)) & ((!((((l_930 >= (safe_add_func_uint16_t_u_u(((safe_sub_func_uint32_t_u_u((safe_mul_func_int8_t_s_s((safe_sub_func_uint8_t_u_u((((*l_794) < ((safe_div_func_uint16_t_u_u(((safe_div_func_uint32_t_u_u((safe_lshift_func_int8_t_s_s((((l_957 |= ((*p_12) |= ((l_954.f6 = (l_956 |= (l_955[5][0] ^= (safe_add_func_int32_t_s_s((safe_mod_func_int32_t_s_s(((l_954 , 65527UL) < 0x3CB0L), l_954.f7)), 0x40492926L))))) | 0x30L))) >= 0x67C755EDL) < (*l_794)), 5)), (*p_16))) , p_13), 0xE718L)) , l_859)) && (*g_555)), 0x15L)), (**g_486))), 0xF838E5DEL)) && 0x0FL), 0xA8E8L))) != 0x32L) == 1UL) & p_14)) == p_14)), (*g_487))))), 6)) ^ (*g_487))) | p_13) < 1L) , &g_72)), 0x370CL)), (-1L))), l_954.f1))) <= l_859)) , p_14), g_312[1])) && 0x4B9B8319L); + if ((*p_12)) + continue; + } + (*p_12) ^= ((**g_486) || (((safe_mod_func_int32_t_s_s((*p_16), (--(*l_962)))) == ((**g_554) ^ 0xB0L)) == p_14)); + if ((*l_794)) + continue; + } + } + if ((((safe_add_func_int16_t_s_s((((*l_968) = g_967[4][1]) == p_16), (0x5FL >= ((((+(l_969 && (+((**g_486) &= ((*l_794) & (safe_rshift_func_int8_t_s_s((p_13 < (safe_rshift_func_int16_t_s_s(0x58D4L, 9))), 2))))))) > ((-6L) && ((*l_794) , 0x3108L))) < (*l_794)) && 0x9B63F63FL)))) , g_477) , 0xF4F5C698L)) + { /* block id: 408 */ + int32_t l_993[7][4][7] = {{{(-1L),0x669ADB8DL,(-1L),0x768A8FF2L,(-9L),0x5618A3D9L,(-1L)},{(-1L),1L,1L,(-1L),0L,0x0CE0602CL,(-8L)},{0xBDF91091L,(-9L),0L,0L,(-9L),0xBDF91091L,(-1L)},{(-3L),0x65E176B1L,0xD0E18EF1L,(-1L),7L,0xD0E18EF1L,(-1L)}},{{(-9L),(-1L),0x63B56E82L,(-9L),0L,0xA0C6014DL,(-9L)},{0x0CE0602CL,0x65E176B1L,0x8B067229L,0L,(-8L),1L,1L},{5L,(-9L),0x5618A3D9L,(-9L),5L,(-1L),(-1L)},{0x3CB930F8L,1L,0L,7L,(-3L),1L,0x3CB930F8L}},{{0L,0x669ADB8DL,(-1L),0L,(-1L),0xDDF01AC2L,0x6F8CD22DL},{0x3CB930F8L,7L,(-1L),(-8L),0x32492198L,0xD0E18EF1L,0x32492198L},{5L,0x6F8CD22DL,0x6F8CD22DL,5L,0xDDF01AC2L,0L,0x768A8FF2L},{0x0CE0602CL,0x45BD0F4FL,0xBCF91C2CL,(-3L),0x45BD0F4FL,(-8L),1L}},{{(-9L),0xF839E9FAL,0x5618A3D9L,(-1L),0L,0x5618A3D9L,0x768A8FF2L},{(-3L),1L,0x0CE0602CL,0x32492198L,(-3L),(-3L),0x32492198L},{0xBDF91091L,5L,0xBDF91091L,0xDDF01AC2L,0xF839E9FAL,6L,0x6F8CD22DL},{(-1L),(-3L),0xD0E18EF1L,0x45BD0F4FL,0x65E176B1L,(-1L),0x3CB930F8L}},{{(-1L),0x6F8CD22DL,0xA0C6014DL,0L,0L,6L,(-1L)},{0x8B067229L,(-1L),1L,(-3L),0x3CB930F8L,(-3L),1L},{0L,0L,(-1L),0xF839E9FAL,(-1L),0x5618A3D9L,(-9L)},{0x65E176B1L,1L,1L,0x65E176B1L,0L,(-8L),(-1L)}},{{0xBDF91091L,(-1L),0xDDF01AC2L,0L,(-1L),0L,(-1L)},{0x45BD0F4FL,(-8L),0xD0E18EF1L,0x3CB930F8L,0x3CB930F8L,0xD0E18EF1L,(-8L)},{(-9L),(-1L),0L,(-1L),0L,0xDDF01AC2L,(-1L)},{0x0CE0602CL,(-1L),0L,1L,1L,0xD0E18EF1L,1L}},{{(-1L),0L,(-1L),0xDDF01AC2L,0x6F8CD22DL,0x669ADB8DL,0x63B56E82L},{(-8L),1L,0x9EE64B86L,0x8B067229L,0x9EE64B86L,1L,(-8L)},{0L,0xBDF91091L,(-1L),0L,0x63B56E82L,6L,0x2F367A28L},{0x0CE0602CL,0x8B067229L,0x3CB930F8L,1L,(-3L),7L,0L}}}; + int8_t l_1011 = (-1L); + int32_t l_1019 = 0L; + int32_t ***l_1023 = (void*)0; + union U1 *l_1027 = &g_824; + union U1 ** const l_1026 = &l_1027; + int i, j, k; + for (g_113 = 0; (g_113 >= 15); g_113++) + { /* block id: 411 */ + uint8_t **l_983 = &g_555; + int32_t l_987 = (-9L); + } + (*p_16) = (((safe_rshift_func_uint16_t_u_u(((safe_div_func_int32_t_s_s((*l_794), (((*g_555) = (safe_sub_func_int32_t_s_s(0x9FC66077L, 1UL))) , ((*p_12) = l_1011)))) == ((safe_mul_func_int16_t_s_s((*g_216), (((*l_794) ^ 4294967295UL) & ((**g_486) = (((0xFFF2L == ((l_993[0][1][0] = (safe_mul_func_uint8_t_u_u((safe_lshift_func_int8_t_s_s(l_993[0][1][0], 1)), l_1018))) && (-9L))) > 0UL) , p_14))))) <= p_14)), 13)) < (-8L)) , (*l_794)); + for (l_1011 = 0; (l_1011 <= 1); l_1011 += 1) + { /* block id: 437 */ + int32_t * const ***l_1022 = &g_1020; + int i; + if (l_1019) + break; + (*p_16) |= (((*l_794) , l_993[6][1][0]) && (1L || (((*g_555) = ((((*l_1022) = g_1020) == l_1023) ^ (safe_lshift_func_uint16_t_u_u(((((*l_794) , l_1026) != g_1028) ^ p_14), 0)))) < p_15))); + l_1033[5] = (safe_mod_func_int8_t_s_s((-6L), (++(*g_555)))); + for (g_114 = 0; (g_114 <= 1); g_114 += 1) + { /* block id: 446 */ + for (l_821 = 0; (l_821 <= 1); l_821 += 1) + { /* block id: 449 */ + uint16_t *l_1036 = (void*)0; + uint16_t *l_1037 = &g_807; + int32_t l_1040[3][4]; + int i, j; + for (i = 0; i < 3; i++) + { + for (j = 0; j < 4; j++) + l_1040[i][j] = 0x5DAFB0C6L; + } + (*p_16) = ((safe_mul_func_int16_t_s_s(0xA4FBL, (*g_216))) , (((++(*l_1037)) | l_1040[0][1]) , (*p_12))); + if ((*p_16)) + continue; + } + } + } + } + else + { /* block id: 456 */ + int16_t l_1043 = 0x49EFL; + uint32_t *l_1048 = &g_776; + uint32_t *l_1057 = &g_24; + int32_t l_1059 = 0x6FF24338L; + int32_t l_1068 = 0x5AC0A6A1L; + int8_t l_1069[9]; + int32_t l_1070[8][1][4] = {{{0x7F392DC0L,0x199421BFL,0xC16261B1L,1L}},{{0xC16261B1L,1L,0xC16261B1L,0x199421BFL}},{{0x7F392DC0L,1L,0xD4EC7BF7L,1L}},{{0x7F392DC0L,0x199421BFL,0xC16261B1L,1L}},{{0xC16261B1L,1L,0xC16261B1L,0x199421BFL}},{{0x7F392DC0L,1L,0xD4EC7BF7L,1L}},{{0x7F392DC0L,0x199421BFL,0xC16261B1L,1L}},{{0xC16261B1L,1L,0xC16261B1L,0x199421BFL}}}; + uint32_t l_1071 = 1UL; + const union U1 *l_1176 = &g_1177; + union U1 *l_1179[8][7] = {{&g_824,&g_477,(void*)0,&g_477,&g_824,&g_477,(void*)0},{&g_477,&g_477,(void*)0,&g_824,(void*)0,(void*)0,&g_824},{(void*)0,&g_824,(void*)0,&g_477,(void*)0,&g_824,(void*)0},{&g_477,&g_824,&g_824,&g_477,(void*)0,(void*)0,(void*)0},{&g_824,&g_824,(void*)0,&g_824,&g_824,&g_824,(void*)0},{(void*)0,&g_477,&g_824,&g_824,&g_477,(void*)0,(void*)0},{(void*)0,&g_477,(void*)0,&g_824,(void*)0,&g_477,(void*)0},{(void*)0,&g_824,(void*)0,&g_477,&g_477,(void*)0,&g_824}}; + uint16_t **l_1182 = &g_351; + uint16_t ***l_1181 = &l_1182; + struct S0 l_1185 = {-0,1627,0,19,60,1,5,363,-1}; + int i, j, k; + for (i = 0; i < 9; i++) + l_1069[i] = (-8L); + l_1059 |= (((safe_lshift_func_int8_t_s_s((((p_15 ^ ((*g_487) = (l_1043 ^ ((*l_794) = ((p_13 | (*l_794)) || ((*l_1048) = (((*g_555)--) , ((safe_rshift_func_int16_t_s_s((*l_794), 4)) > (*l_794))))))))) ^ (safe_add_func_int32_t_s_s(((*p_16) = l_1033[5]), ((*l_1057) = (!(safe_mul_func_int16_t_s_s(((((safe_sub_func_int16_t_s_s(l_1043, (safe_add_func_int8_t_s_s(p_13, p_14)))) && p_15) > p_14) , (*g_216)), p_14))))))) == l_1043), g_1058)) >= l_1043) & (*g_216)); + for (g_825 = 22; (g_825 > (-1)); g_825 = safe_sub_func_uint8_t_u_u(g_825, 7)) + { /* block id: 466 */ + int32_t *l_1062 = &g_2; + int32_t *l_1063 = &g_215; + int32_t l_1064 = 0x85D314CCL; + int32_t *l_1065 = &g_2; + int32_t *l_1066 = &l_1059; + int32_t *l_1067[1][1][1]; + int32_t **l_1087 = &g_214; + int32_t *** const l_1086 = &l_1087; + uint32_t l_1170 = 0x1133297AL; + const union U1 *l_1175 = &g_331; + int i, j, k; + for (i = 0; i < 1; i++) + { + for (j = 0; j < 1; j++) + { + for (k = 0; k < 1; k++) + l_1067[i][j][k] = &g_2; + } + } + --l_1071; + for (g_408 = 1; (g_408 >= 0); g_408 -= 1) + { /* block id: 470 */ + const int32_t l_1099 = 0x5235A3F0L; + int32_t l_1134 = 8L; + int16_t **l_1153 = &g_216; + int32_t l_1162[6]; + int32_t l_1164 = 8L; + int i; + for (i = 0; i < 6; i++) + l_1162[i] = 0x6B185421L; + if ((safe_mod_func_uint32_t_u_u(1UL, g_141[g_408]))) + { /* block id: 471 */ + uint16_t l_1096 = 65535UL; + for (g_733 = 0; (g_733 <= 1); g_733 += 1) + { /* block id: 474 */ + int32_t ****l_1079 = &g_1078; + int8_t ** const *l_1093 = &g_486; + int i, j; + (*l_1066) = (safe_sub_func_uint8_t_u_u((((*l_1079) = g_1078) != (((safe_mod_func_uint32_t_u_u(4294967292UL, (safe_lshift_func_uint16_t_u_s(p_14, (*l_794))))) > (safe_mod_func_int16_t_s_s((*g_216), 1L))) , l_1086)), ((((safe_rshift_func_int8_t_s_u((safe_unary_minus_func_uint32_t_u(((0x73L <= (safe_rshift_func_uint8_t_u_s(((g_1094 = l_1093) == (void*)0), g_141[g_408]))) , (*l_794)))), p_15)) , (void*)0) == &g_486) , (*g_555)))); + l_1096 = (*l_794); + if ((*l_794)) + break; + } + for (p_13 = 0; (p_13 <= 8); p_13 += 1) + { /* block id: 483 */ + uint32_t l_1100 = 0xD370DA3EL; + const uint8_t *l_1112 = &g_733; + const uint8_t **l_1111 = &l_1112; + (*l_1062) = (((*l_1063) ^= (((p_14 | (*g_216)) > ((safe_add_func_uint16_t_u_u(l_1099, l_1100)) ^ p_15)) >= ((**g_486) && (g_733 &= (safe_lshift_func_int8_t_s_s((safe_mod_func_int16_t_s_s((safe_rshift_func_uint16_t_u_s(((safe_lshift_func_int8_t_s_s((safe_mod_func_int8_t_s_s((!(g_1058 &= ((*g_487) = (((g_141[g_408] ^ ((((65535UL ^ (l_1111 != l_992[1])) , 0x1CL) , (*g_216)) == l_1096)) | l_1100) | 0xDDF6L)))), (*g_555))), (*l_794))) | p_14), p_13)), l_1100)), p_15)))))) < 0x24L); + if (l_1100) + goto lbl_1113; + (*l_794) ^= (*l_1066); + } + } + else + { /* block id: 492 */ + int32_t l_1126 = 0xCFC1EBE5L; + uint16_t l_1137 = 0x946EL; + const int32_t *l_1158 = &g_55; + int32_t l_1159 = 3L; + int32_t l_1160 = (-1L); + int32_t l_1161[2]; + uint32_t l_1165[10][1] = {{0xE54AEF6EL},{0x293B7BE6L},{0xE54AEF6EL},{0x293B7BE6L},{0xE54AEF6EL},{0x293B7BE6L},{0xE54AEF6EL},{0x293B7BE6L},{0xE54AEF6EL},{0x293B7BE6L}}; + int i, j; + for (i = 0; i < 2; i++) + l_1161[i] = 1L; + for (g_215 = 2; (g_215 <= 8); g_215 += 1) + { /* block id: 495 */ + uint32_t *l_1129 = &g_234[2][5][1]; + uint16_t ***l_1144 = (void*)0; + uint16_t ****l_1145 = &l_1144; + int8_t *l_1148[7][6][4] = {{{(void*)0,&l_1069[3],&l_1069[4],(void*)0},{&l_1069[3],&g_1058,&l_1069[4],&l_1069[5]},{(void*)0,&g_1058,&g_1058,&l_1069[3]},{&l_1069[5],&g_543,&l_1069[3],(void*)0},{&l_1069[3],(void*)0,&l_1069[1],&g_1058},{&g_543,&l_1069[5],&l_1069[5],&g_543}},{{(void*)0,&l_1069[3],&l_1069[5],&g_1058},{&g_543,&l_1069[1],&g_543,&g_543},{&l_1069[3],&g_543,(void*)0,&g_543},{&l_1069[3],&l_1069[1],&l_1069[3],&g_1058},{&l_1069[5],&l_1069[3],&l_1069[3],&g_543},{(void*)0,&l_1069[5],&g_1058,&g_1058}},{{&g_1058,(void*)0,(void*)0,(void*)0},{(void*)0,&g_543,&g_543,&l_1069[3]},{&l_1069[3],&g_1058,&l_1069[3],&l_1069[5]},{&g_1058,&l_1069[5],&l_1069[3],&g_543},{&g_1058,(void*)0,&g_543,&l_1069[5]},{&l_1069[5],&g_543,(void*)0,&g_1058}},{{&g_543,&g_1058,&l_1069[3],&l_1069[4]},{&l_1069[5],&l_1069[3],(void*)0,(void*)0},{&g_1058,&g_1058,&g_1058,&l_1069[3]},{&g_1058,(void*)0,&g_543,&l_1069[3]},{&g_1058,&l_1069[3],&l_1069[3],&g_543},{(void*)0,&l_1069[3],&l_1069[1],&l_1069[3]}},{{&l_1069[3],(void*)0,&l_1069[4],&l_1069[3]},{&l_1069[3],&g_1058,&g_1058,(void*)0},{&l_1069[1],&l_1069[3],&g_543,&l_1069[4]},{(void*)0,&g_1058,(void*)0,&g_1058},{&l_1069[4],&g_543,&l_1069[5],&l_1069[5]},{&l_1069[3],(void*)0,&l_1069[3],&g_543}},{{(void*)0,&l_1069[5],&l_1069[3],&g_1058},{&l_1069[3],&l_1069[3],&l_1069[5],&g_543},{&l_1069[4],&l_1069[3],(void*)0,&l_1069[3]},{(void*)0,&l_1069[3],&g_543,&g_1058},{&l_1069[1],&g_1058,&g_1058,&l_1069[1]},{&l_1069[3],&l_1069[3],&l_1069[4],&l_1069[3]}},{{&l_1069[3],&g_543,&l_1069[1],&l_1069[3]},{(void*)0,(void*)0,&l_1069[3],&l_1069[3]},{&g_1058,&g_543,&g_543,&l_1069[3]},{&g_1058,&l_1069[3],&g_1058,&l_1069[1]},{&g_1058,&g_1058,(void*)0,&g_1058},{&l_1069[5],&l_1069[3],&l_1069[3],&l_1069[3]}}}; + int8_t *l_1154[2]; + int8_t *l_1155 = &g_543; + const int32_t *l_1157 = &g_493; + const int32_t **l_1156[6]; + int i, j, k; + for (i = 0; i < 2; i++) + l_1154[i] = &l_1069[3]; + for (i = 0; i < 6; i++) + l_1156[i] = &l_1157; + l_1134 &= (safe_mul_func_int16_t_s_s((p_14 & (g_141[g_408] |= (((safe_lshift_func_uint8_t_u_s((safe_mul_func_int8_t_s_s((safe_rshift_func_int8_t_s_u((safe_rshift_func_uint16_t_u_s(p_15, 4)), 3)), ((safe_mul_func_uint16_t_u_u(l_1126, (((*g_555) = (safe_add_func_uint8_t_u_u(((g_967[g_215][g_215] = l_1129) == ((*l_968) = (void*)0)), (*g_555)))) >= (safe_rshift_func_uint16_t_u_s(((0x17L && (g_350[4][2].f6 || (&g_216 == (void*)0))) , 0xABBCL), (*g_216)))))) >= l_1126))), 6)) <= l_1126) ^ l_1069[3]))), (*l_794))); + l_1070[0][0][0] = ((((*p_16) = (g_141[g_408] || (((safe_add_func_int32_t_s_s((((**g_486) = l_1137) | p_14), ((safe_lshift_func_uint16_t_u_u((safe_div_func_int16_t_s_s((((((0xB1L < 0xF5L) | ((safe_add_func_uint32_t_u_u((((*l_1145) = l_1144) != (((l_1059 = (safe_mod_func_uint8_t_u_u(1UL, 1L))) || ((safe_add_func_uint8_t_u_u(((((safe_mul_func_int8_t_s_s((g_543 = (-1L)), p_15)) < l_1134) ^ 254UL) , (**g_554)), p_13)) >= p_15)) , (void*)0)), (*p_12))) , p_14)) || l_1137) >= g_141[g_408]) && 0xE81EF0E4L), l_1137)), 14)) == (*l_794)))) && (*p_12)) , p_15))) , 0xF2D2L) | g_141[g_408]); + if (l_1137) + continue; + l_1158 = l_910; + } + l_1165[3][0]++; + } + } + (**l_1086) = (**g_785); + for (g_144 = 0; (g_144 == 50); g_144 = safe_add_func_uint8_t_u_u(g_144, 8)) + { /* block id: 518 */ + uint16_t **l_1174[9][1][8] = {{{&g_194[0],&g_351,&g_194[0],&g_194[0],&g_351,&g_194[0],&g_194[0],&g_194[0]}},{{&g_351,&g_194[0],&g_194[0],&g_194[0],&g_351,&g_194[0],&g_194[0],&g_351}},{{&g_194[0],&g_194[0],&g_194[0],&g_194[0],&g_194[0],&g_351,&g_194[0],&g_194[0]}},{{&g_194[0],&g_194[0],&g_194[0],&g_194[0],&g_194[0],&g_194[0],&g_194[0],&g_194[0]}},{{&g_194[0],&g_194[0],&g_194[0],&g_351,&g_351,&g_351,&g_194[0],&g_194[0]}},{{&g_194[0],&g_194[0],&g_194[0],&g_194[0],&g_194[0],&g_194[0],&g_194[0],&g_194[0]}},{{&g_194[0],&g_194[0],&g_194[0],&g_351,&g_194[0],&g_194[0],&g_194[0],&g_194[0]}},{{&g_194[0],&g_351,&g_194[0],&g_194[0],&g_351,&g_194[0],&g_194[0],&g_194[0]}},{{&g_351,&g_194[0],&g_194[0],&g_194[0],&g_351,&g_194[0],&g_194[0],&g_351}}}; + uint16_t ***l_1173[7]; + const union U1 **l_1178[1]; + union U1 **l_1180 = &l_1179[0][0]; + int32_t l_1202 = 6L; + int i, j, k; + for (i = 0; i < 7; i++) + l_1173[i] = &l_1174[7][0][7]; + for (i = 0; i < 1; i++) + l_1178[i] = (void*)0; + --l_1170; + if ((l_1173[5] != (((l_1175 = (l_1176 = l_1175)) == ((*l_1180) = l_1179[6][2])) , l_1181))) + { /* block id: 523 */ + struct S0 *l_1183 = &l_988[7]; + struct S0 **l_1184 = &l_1183; + (*l_1184) = l_1183; + } + else + { /* block id: 525 */ + (*p_12) = ((&g_109 != &g_350[7][3]) || 0xC1D9L); + } + (*p_16) = (l_1185 , (safe_lshift_func_int8_t_s_s((((safe_unary_minus_func_uint16_t_u((safe_mod_func_uint16_t_u_u((safe_add_func_uint32_t_u_u((0x13L > (safe_add_func_int16_t_s_s((((*p_12) = (safe_sub_func_int32_t_s_s((*l_794), ((safe_unary_minus_func_int32_t_s((*p_16))) && (safe_add_func_int32_t_s_s(((((*g_216) = (safe_add_func_int8_t_s_s((0x3D58L != l_1202), p_13))) ^ ((safe_div_func_int32_t_s_s((((((*l_1065) = (-1L)) ^ 0xEDBC3F46L) < (*p_12)) < l_1202), 0x6FEA2B67L)) ^ (*p_12))) & l_1185.f5), 1UL)))))) >= l_1185.f4), (*l_794)))), p_13)), (*l_794))))) & (*l_1063)) == p_13), p_13))); + for (l_969 = 29; (l_969 == (-2)); l_969 = safe_sub_func_uint32_t_u_u(l_969, 1)) + { /* block id: 534 */ + } + } + } + } + (*p_12) = ((((safe_unary_minus_func_uint8_t_u((l_1220 ^ (((safe_sub_func_uint32_t_u_u(((safe_div_func_uint8_t_u_u((safe_mod_func_int8_t_s_s((safe_div_func_uint16_t_u_u(((l_1229 = ((l_988[7] , (((((((-1L) & ((*g_487) |= (*l_794))) >= (*l_794)) , (*l_794)) & p_15) || (-3L)) > (((0x3940D9DAL <= 4294967289UL) == (*l_794)) | (*l_794)))) <= (*l_794))) ^ l_1230[3][0]), 0xDA9EL)), p_13)), (*l_794))) , 0x099334B0L), (*l_794))) > (*l_794)) > 0x30ABL)))) , &g_194[0]) == l_1231[0]) , (*p_12)); + return (*l_794); +} + + +/* ------------------------------------------ */ +/* + * reads : g_2 + * writes: g_2 + */ +static uint32_t func_20(uint32_t p_21) +{ /* block id: 10 */ + const int32_t l_27[8][7][4] = {{{0x213633E7L,1L,(-7L),1L},{0xBFCF419CL,(-3L),(-7L),1L},{0x213633E7L,0xB19D88C8L,0xBFCF419CL,(-3L)},{(-7L),0xB19D88C8L,(-7L),0xE89405DBL},{(-7L),0xE89405DBL,1L,1L},{0xBFCF419CL,0xE89405DBL,9L,0xE89405DBL},{1L,0xB19D88C8L,9L,(-3L)}},{{0xBFCF419CL,1L,1L,(-3L)},{(-7L),0xB19D88C8L,(-7L),0xE89405DBL},{(-7L),0xE89405DBL,1L,1L},{0xBFCF419CL,0xE89405DBL,9L,0xE89405DBL},{1L,0xB19D88C8L,9L,(-3L)},{0xBFCF419CL,1L,1L,(-3L)},{(-7L),0xB19D88C8L,(-7L),0xE89405DBL}},{{(-7L),0xE89405DBL,1L,1L},{0xBFCF419CL,0xE89405DBL,9L,0xE89405DBL},{1L,0xB19D88C8L,9L,(-3L)},{0xBFCF419CL,1L,1L,(-3L)},{(-7L),0xB19D88C8L,(-7L),0xE89405DBL},{(-7L),0xE89405DBL,1L,1L},{0xBFCF419CL,0xE89405DBL,9L,0xE89405DBL}},{{1L,0xB19D88C8L,9L,(-3L)},{0xBFCF419CL,1L,1L,(-3L)},{(-7L),0xB19D88C8L,(-7L),0xE89405DBL},{(-7L),0xE89405DBL,1L,1L},{0xBFCF419CL,0xE89405DBL,9L,0xE89405DBL},{1L,0xB19D88C8L,9L,(-3L)},{0xBFCF419CL,1L,1L,(-3L)}},{{(-7L),0xB19D88C8L,(-7L),0xE89405DBL},{(-7L),0xE89405DBL,1L,1L},{0xBFCF419CL,0xE89405DBL,9L,0xE89405DBL},{1L,0xB19D88C8L,9L,(-3L)},{0xBFCF419CL,1L,1L,(-3L)},{(-7L),0xB19D88C8L,(-7L),0xE89405DBL},{(-7L),0xE89405DBL,1L,1L}},{{0xBFCF419CL,0xE89405DBL,9L,0xE89405DBL},{1L,0xB19D88C8L,9L,(-3L)},{0xBFCF419CL,1L,1L,(-3L)},{(-7L),0xB19D88C8L,(-7L),0xE89405DBL},{(-7L),0xE89405DBL,1L,1L},{0xBFCF419CL,0xE89405DBL,9L,0xE89405DBL},{1L,0xB19D88C8L,9L,(-3L)}},{{0xBFCF419CL,1L,1L,(-3L)},{(-7L),0xB19D88C8L,(-7L),0xE89405DBL},{(-7L),0xE89405DBL,1L,1L},{0xBFCF419CL,0xE89405DBL,9L,0xE89405DBL},{1L,0xB19D88C8L,9L,(-3L)},{0xBFCF419CL,1L,1L,(-3L)},{(-7L),0xB19D88C8L,(-7L),0xE89405DBL}},{{(-7L),0xE89405DBL,1L,1L},{0xBFCF419CL,1L,0x213633E7L,1L},{(-7L),1L,0x213633E7L,0xB19D88C8L},{1L,0xE89405DBL,(-7L),0xB19D88C8L},{9L,1L,9L,1L},{9L,1L,(-7L),(-3L)},{1L,1L,0x213633E7L,1L}}}; + int32_t *l_28 = &g_2; + int i, j, k; + (*l_28) &= l_27[0][2][2]; + return p_21; +} + + +/* ------------------------------------------ */ +/* + * reads : g_24 g_53 g_2 g_36 g_86 g_52 g_109 g_114 g_72 g_144 g_55 g_126 g_141 g_214 g_216 g_215 g_217 g_234 g_312 g_331 g_350 g_351 g_143 g_408 g_486 g_493 g_487 g_543 g_113 g_554 g_555 g_477 g_626 g_784 + * writes: g_24 g_2 g_36 g_52 g_53 g_55 g_86 g_113 g_126 g_109.f3 g_114 g_141 g_143 g_144 g_72 g_194 g_215 g_252 g_217 g_312 g_234 g_486 g_350.f8 g_214 g_351 g_626 g_776 + */ +static const uint8_t func_31(uint8_t p_32) +{ /* block id: 14 */ + uint16_t l_213[5][7][7] = {{{0xE217L,65535UL,0x056FL,0xE217L,65532UL,0x5C96L,8UL},{65526UL,0x85C2L,0UL,65532UL,65532UL,0UL,0x85C2L},{65532UL,0x9171L,0x0C94L,1UL,0x056FL,8UL,65533UL},{0x0C94L,65526UL,0x4E03L,0x9171L,0x3561L,65535UL,0x056FL},{0x72F8L,0x85C2L,1UL,1UL,0xA3E3L,0x9D98L,65526UL},{65535UL,0x056FL,0xE217L,65532UL,0x5C96L,8UL,0x72F8L},{0x941BL,1UL,0xE217L,0xE217L,1UL,0x941BL,0UL}},{{0x3561L,1UL,1UL,0xA3E3L,0x85C2L,0x208BL,0xA3E3L},{65532UL,0x7E30L,0x4E03L,65533UL,0UL,0x0C94L,0x72F8L},{0x9171L,1UL,0x0C94L,8UL,0x3561L,0xE217L,0x9171L},{1UL,1UL,0UL,0xA3E3L,65535UL,2UL,65535UL},{1UL,0x056FL,0x056FL,1UL,0x4E03L,0x5C96L,65533UL},{0x9171L,0x85C2L,0x941BL,0x4E03L,65532UL,0x941BL,0x5C96L},{65532UL,65526UL,2UL,1UL,65535UL,1UL,65533UL}},{{0x3561L,0x9171L,0x4E03L,65526UL,0x0C94L,65535UL,65535UL},{0x941BL,0x85C2L,0x9171L,65535UL,0xA3E3L,65535UL,0x9171L},{65535UL,65535UL,65526UL,65532UL,0x85C2L,1UL,0x72F8L},{0x72F8L,65535UL,0xE217L,1UL,65535UL,0x941BL,0xA3E3L},{0x0C94L,1UL,0x9171L,0UL,0x85C2L,0x5C96L,0UL},{65532UL,0x60CBL,0x6E77L,65533UL,0xA3E3L,2UL,0x72F8L},{65526UL,0xE217L,0x0C94L,65533UL,0x0C94L,0xE217L,65526UL}},{{0xE217L,1UL,0x941BL,0UL,65535UL,0x0C94L,0x056FL},{1UL,65535UL,6UL,1UL,65532UL,0x208BL,65533UL},{65526UL,0x5C96L,0x941BL,65532UL,0x4E03L,0x941BL,0x85C2L},{0x9D98L,0x7E30L,0UL,65526UL,8UL,1UL,1UL},{0x941BL,0x7E30L,1UL,0x7E30L,0x941BL,1UL,8UL},{0x4E03L,2UL,65535UL,0xE217L,0x208BL,65526UL,0x7E30L},{1UL,8UL,6UL,0x9D98L,0x0C94L,1UL,0x6E77L}},{{0x4E03L,0xE217L,65535UL,0x056FL,0xE217L,65532UL,0x5C96L},{0x941BL,6UL,65535UL,0x5C96L,2UL,2UL,0x5C96L},{0x9D98L,0UL,0x9D98L,1UL,0x5C96L,0UL,0x6E77L},{0x7E30L,0x056FL,0x72F8L,0x9171L,0x941BL,65535UL,0x7E30L},{0x056FL,65526UL,0x6E77L,0x5C96L,1UL,0UL,8UL},{6UL,8UL,1UL,6UL,65535UL,2UL,1UL},{0x7E30L,0x0C94L,65532UL,65535UL,65535UL,65532UL,0x0C94L}}}; + int32_t l_222[3][10] = {{(-1L),(-1L),(-1L),(-1L),0x2D656744L,5L,0x2D656744L,(-1L),(-1L),(-1L)},{0x2D656744L,(-1L),0x83BE1114L,1L,1L,0x83BE1114L,(-1L),0x2D656744L,(-1L),0x83BE1114L},{5L,(-1L),1L,(-1L),5L,0x83BE1114L,0x83BE1114L,5L,(-1L),1L}}; + uint32_t *l_233[3][2]; + int32_t **l_236 = &g_86; + int8_t *l_250 = &g_143; + int16_t l_251 = 0x6775L; + int32_t *l_253 = (void*)0; + uint8_t *l_256 = &g_114; + union U1 l_263 = {0xD8L}; + const int16_t l_288 = 0L; + int32_t l_289 = 0L; + uint16_t l_299 = 0xB300L; + int32_t l_311 = 1L; + int32_t l_326 = 1L; + uint32_t l_359 = 0x854B9D9CL; + struct S0 l_375 = {-0,-610,1,170,32,1,-2,576,1}; + int32_t l_440 = (-1L); + int32_t l_443 = 0xC3336E55L; + union U1 *l_476[1]; + int8_t l_522 = 0x0AL; + uint8_t l_530 = 0xC0L; + int8_t **l_696 = &g_487; + int16_t l_724 = 0x0842L; + uint32_t * const l_775 = &g_776; + uint32_t * const *l_774 = &l_775; + int i, j, k; + for (i = 0; i < 3; i++) + { + for (j = 0; j < 2; j++) + l_233[i][j] = &g_234[2][0][1]; + } + for (i = 0; i < 1; i++) + l_476[i] = &g_477; + (*l_236) = func_40((func_46(p_32) , l_213[2][6][1]), g_214, g_216, (+(safe_sub_func_int32_t_s_s(((safe_lshift_func_uint8_t_u_u(g_109.f7, 7)) == l_222[0][6]), (safe_mul_func_int16_t_s_s((((safe_lshift_func_uint8_t_u_s(((((l_222[0][7] == (safe_lshift_func_int8_t_s_u((safe_rshift_func_uint8_t_u_s((safe_sub_func_uint32_t_u_u(g_109.f8, (*g_214))), 0)), g_109.f4))) < 0x97C0L) <= p_32) , g_109.f0), p_32)) ^ l_213[3][0][1]) & 0x3BD0L), p_32))))), l_233[2][1]); +lbl_787: + g_2 |= (((safe_mod_func_int8_t_s_s(((g_252[1][3] = func_99(l_233[1][0], (((((*g_216) , (safe_unary_minus_func_uint16_t_u((safe_lshift_func_int16_t_s_u(6L, (**l_236)))))) < ((*g_214) |= (safe_add_func_int16_t_s_s(((g_109 , ((**l_236) >= (((safe_lshift_func_uint8_t_u_s(((safe_rshift_func_int8_t_s_s((((*l_250) = (g_234[2][0][1] != (p_32 == (((safe_div_func_int16_t_s_s((*g_216), (*g_216))) ^ 1UL) & (**l_236))))) & (**l_236)), 3)) | p_32), 5)) | p_32) ^ g_141[1]))) ^ 0xC824L), 1UL)))) && l_251) & (*g_86)), (**l_236), p_32)) == &g_24), p_32)) != 0x33L) == (*g_86)); + (*g_214) = ((safe_sub_func_int8_t_s_s(0x67L, ((**l_236) , ((*l_256) = (**l_236))))) == ((((**l_236) & (safe_div_func_uint8_t_u_u(((safe_add_func_uint8_t_u_u(((safe_sub_func_uint16_t_u_u(((((*g_216) |= p_32) , ((l_263 , (void*)0) == &l_251)) & ((safe_div_func_int16_t_s_s(p_32, 65527UL)) & 6UL)), 0x9836L)) , g_109.f4), p_32)) < p_32), (**l_236)))) & (**l_236)) == 253UL)); + if (((p_32 ^ ((p_32 ^ (~((((*g_214) |= (safe_sub_func_int16_t_s_s((safe_sub_func_uint8_t_u_u((**l_236), (safe_div_func_uint32_t_u_u((l_289 = (((*g_216) = (0xB485L > ((safe_lshift_func_uint8_t_u_u((safe_sub_func_int16_t_s_s((safe_div_func_int16_t_s_s((safe_mod_func_int32_t_s_s(((((safe_sub_func_uint32_t_u_u((g_109.f8 , ((g_141[0] || ((0x2F8BL || (safe_sub_func_int16_t_s_s((safe_sub_func_int8_t_s_s((p_32 | (p_32 > 0xF1L)), 0xF4L)), p_32))) != 0xDE6FF466L)) || p_32)), (**l_236))) > (-1L)) && g_72) || (**l_236)), p_32)), (**l_236))), 65528UL)), 7)) < l_288))) > (**l_236))), (*g_86))))), p_32))) , p_32) < 0x883BL))) >= 0xB94D1ED4L)) != 0x6E74L)) + { /* block id: 111 */ + struct S0 l_292 = {1,868,0,-167,63,0,6,185,-4}; + int16_t *l_293 = &l_251; + int16_t **l_294 = &l_293; + int8_t *l_426 = (void*)0; + int16_t l_436 = 0L; + int32_t l_439 = 0x78F69DFEL; + int32_t l_441 = 6L; + int32_t l_442 = 0x2B99C833L; + uint32_t l_454 = 18446744073709551615UL; + uint32_t l_466 = 1UL; + union U1 l_471 = {0x2BL}; + int8_t l_490[6]; + int32_t *l_495 = &g_2; + int16_t l_527 = 0x2489L; + uint16_t l_542 = 0UL; + const uint32_t *l_663[9] = {&g_664,&g_664,&g_664,&g_664,&g_664,&g_664,&g_664,&g_664,&g_664}; + const uint32_t **l_662[6] = {&l_663[8],&l_663[4],&l_663[4],&l_663[8],&l_663[4],&l_663[4]}; + const uint32_t *l_665 = &g_666[0][5][1]; + int i; + for (i = 0; i < 6; i++) + l_490[i] = 0x8DL; + if ((safe_lshift_func_int8_t_s_u(g_109.f5, ((l_292 , &l_251) != ((*l_294) = l_293))))) + { /* block id: 113 */ +lbl_399: + (*l_236) = &g_55; + } + else + { /* block id: 115 */ + int32_t l_300[7][3] = {{0xDEA12953L,0xA39915C5L,0xA39915C5L},{0xDEA12953L,0xA39915C5L,0xA39915C5L},{0xDEA12953L,0xA39915C5L,0xA39915C5L},{0xDEA12953L,0xA39915C5L,0xA39915C5L},{0xDEA12953L,0xA39915C5L,0xA39915C5L},{0xDEA12953L,0xA39915C5L,0xA39915C5L},{0xDEA12953L,0xA39915C5L,0xA39915C5L}}; + int16_t *l_301 = &l_251; + int32_t l_388 = 0x600FA4EEL; + uint8_t **l_422 = &l_256; + int8_t *l_423[2]; + int8_t **l_424 = (void*)0; + int8_t **l_425 = &l_423[1]; + uint8_t l_427 = 3UL; + union U1 *l_475 = &l_471; + uint32_t l_489 = 0UL; + int32_t **l_496 = &g_214; + int32_t l_513 = 0xF8A528CBL; + int32_t l_517 = (-1L); + uint16_t l_541 = 5UL; + uint8_t *l_544 = (void*)0; + uint8_t *l_545 = &g_114; + uint8_t *l_546 = &g_113; + int16_t l_589 = (-2L); + int32_t l_595[3]; + int32_t l_605 = (-10L); + struct S0 l_606 = {0,19573,1,121,89,0,5,169,-3}; + int16_t l_621 = 1L; + uint8_t l_623 = 255UL; + uint8_t l_632 = 248UL; + int8_t l_633 = (-1L); + uint8_t l_634 = 1UL; + uint32_t l_635 = 0x54A42BA3L; + int32_t l_639 = 0L; + uint16_t l_645 = 0xDE68L; + int16_t l_648 = (-1L); + int8_t l_655 = 0x79L; + int16_t l_656 = (-1L); + int32_t *l_657 = &g_215; + int i, j; + for (i = 0; i < 2; i++) + l_423[i] = &g_143; + for (i = 0; i < 3; i++) + l_595[i] = (-7L); + if ((safe_add_func_uint32_t_u_u((safe_mul_func_uint16_t_u_u(((l_292 , ((l_299 >= l_300[4][1]) , l_301)) == ((((safe_rshift_func_int16_t_s_u(l_292.f3, ((g_144 < (l_292.f8 < (((65527UL <= (((((void*)0 != l_301) & (*g_214)) ^ p_32) , l_292.f4)) < g_109.f5) > g_53))) || 0x91L))) ^ l_292.f7) >= l_300[3][2]) , &l_251)), p_32)), (*g_86)))) + { /* block id: 116 */ + int32_t *l_304 = &l_300[5][1]; + int32_t *l_305 = (void*)0; + int32_t l_306 = (-1L); + int32_t *l_307 = &l_300[4][1]; + int32_t *l_308 = &g_53; + int32_t *l_309[2]; + int32_t l_310 = 0x9A6A31B5L; + int8_t *l_321 = &g_143; + int i; + for (i = 0; i < 2; i++) + l_309[i] = (void*)0; + ++g_312[0]; + if (((safe_mul_func_int8_t_s_s((p_32 == ((safe_mul_func_uint8_t_u_u(((**l_236) = 0xC4L), (safe_div_func_int32_t_s_s((((p_32 ^ 0xE6BD7F7FL) , l_321) != &g_143), (safe_rshift_func_uint8_t_u_s(3UL, 5)))))) > ((safe_lshift_func_int16_t_s_u(((((p_32 <= (l_292.f1 = p_32)) , l_326) > p_32) == p_32), p_32)) , 0x79L))), g_109.f2)) == (-1L))) + { /* block id: 120 */ + (*l_307) = (safe_lshift_func_int16_t_s_s(4L, 8)); + (*l_308) |= (*g_214); + (*g_86) = (safe_lshift_func_uint16_t_u_u((*l_307), (((g_331 , p_32) , (-5L)) && 0xA58AL))); + (*g_86) ^= (safe_div_func_int32_t_s_s((-1L), 0xEDDE48FAL)); + } + else + { /* block id: 125 */ + uint32_t l_353 = 4294967291UL; + int32_t l_354 = 0x8D8C0522L; + for (g_114 = 0; (g_114 == 45); g_114 = safe_add_func_int32_t_s_s(g_114, 4)) + { /* block id: 128 */ + int32_t *l_336 = &g_215; + uint16_t *l_345 = &g_72; + int32_t l_352 = 0x8A444AF9L; + (*l_236) = l_336; + (*l_236) = &g_215; + l_354 = (safe_rshift_func_uint16_t_u_s((safe_sub_func_uint8_t_u_u(g_109.f6, ((+(safe_div_func_int32_t_s_s(p_32, (safe_add_func_uint8_t_u_u(((((void*)0 == l_345) , (safe_mod_func_uint16_t_u_u((((*l_336) ^= p_32) ^ (l_300[5][0] , (safe_add_func_int32_t_s_s(((((((((g_126[2][2] || (l_263 , ((*l_321) |= (((g_350[4][2] , (-1L)) , &g_72) == g_351)))) & 6L) == p_32) , p_32) > l_352) > g_114) > l_353) , p_32), p_32)))), (*l_307)))) , p_32), 0x31L))))) < (*l_308)))), 14)); + } + if (g_109.f7) + goto lbl_494; + } + for (g_2 = 25; (g_2 < (-5)); g_2 = safe_sub_func_uint8_t_u_u(g_2, 5)) + { /* block id: 138 */ + for (g_113 = 0; (g_113 < 55); g_113 = safe_add_func_uint16_t_u_u(g_113, 8)) + { /* block id: 141 */ + (*l_236) = (void*)0; + } + for (l_251 = 2; (l_251 >= 0); l_251 -= 1) + { /* block id: 146 */ + int i, j; + return l_300[l_251][l_251]; + } + } + l_359--; + } + else + { /* block id: 151 */ + int16_t l_392 = (-1L); + int32_t l_393 = 0x4FE45244L; + int32_t *l_421 = &g_2; + for (g_217 = (-10); (g_217 == 12); g_217 = safe_add_func_uint32_t_u_u(g_217, 1)) + { /* block id: 154 */ + int16_t l_370 = (-1L); + int16_t l_398 = 0x1CFDL; + if (((safe_add_func_uint32_t_u_u(((l_300[4][2] == (safe_lshift_func_int8_t_s_u((g_331 , (safe_div_func_uint8_t_u_u(0xCFL, (-1L)))), l_292.f2))) ^ (g_109 , l_300[4][1])), l_370)) , ((safe_rshift_func_int16_t_s_u((safe_div_func_uint8_t_u_u((&p_32 == &g_113), p_32)), p_32)) <= g_350[4][2].f7))) + { /* block id: 155 */ + int16_t l_381 = (-1L); + const int32_t l_391 = 0L; + l_381 ^= (l_375 , ((g_215 , (**l_236)) > ((((safe_sub_func_uint16_t_u_u(((((!(**l_236)) & (1L >= p_32)) , ((((safe_unary_minus_func_int8_t_s((**l_236))) < 0x3DA1L) >= (((p_32 ^ (**l_236)) | l_300[4][1]) && (*g_86))) <= p_32)) == l_300[4][1]), l_300[0][2])) | l_292.f4) , (void*)0) == l_250))); + l_393 &= (((safe_div_func_int8_t_s_s((safe_lshift_func_int8_t_s_u((((*g_216) & (0x61DE9766L != 0xD43EE1FDL)) , (p_32 < ((!(((((((safe_add_func_uint16_t_u_u(((l_388 == (248UL ^ ((*l_250) |= (safe_div_func_uint8_t_u_u(0x83L, (l_292.f1 && (*g_216))))))) , l_391), l_392)) , l_292.f1) && p_32) , 65532UL) | l_292.f4) , p_32) == p_32)) || 6UL))), g_350[4][2].f3)), g_24)) != p_32) , 0x6C8538B0L); + } + else + { /* block id: 159 */ + return p_32; + } + (*g_86) = (safe_lshift_func_int8_t_s_u((0x40C17C14L >= (g_350[4][2].f4 , (safe_lshift_func_uint8_t_u_u(l_398, 0)))), 3)); + } + if (l_251) + goto lbl_399; + (*g_86) = ((*g_214) & (((l_393 < 5UL) >= (-1L)) || ((**l_236) && (0x29C54269L != 0x3CAA9559L)))); + l_393 = (safe_mul_func_uint16_t_u_u((safe_sub_func_uint16_t_u_u((safe_sub_func_uint32_t_u_u((((safe_rshift_func_uint8_t_u_s(((g_408 && (*g_86)) >= p_32), 1)) , 4294967288UL) & (*g_214)), ((*l_421) = (safe_div_func_int32_t_s_s(0xEC54B450L, ((safe_add_func_uint8_t_u_u((safe_mod_func_int8_t_s_s((safe_sub_func_int32_t_s_s((-7L), (safe_mod_func_uint8_t_u_u(p_32, (safe_mod_func_int32_t_s_s((&g_214 == &l_253), l_392)))))), 0x60L)), g_109.f8)) , l_388)))))), p_32)), l_292.f3)); + } + if (((g_109.f2 | (((*l_422) = (void*)0) != ((((*l_425) = (l_292 , l_423[1])) != l_426) , (((0x82AE79FEL || (l_427 = p_32)) & ((safe_mul_func_int16_t_s_s((p_32 > (safe_mul_func_int8_t_s_s((safe_div_func_uint32_t_u_u(((l_292.f2 > (-9L)) ^ l_300[5][1]), 0xCB376623L)), 1UL))), 0L)) & p_32)) , &g_113)))) , p_32)) + { /* block id: 172 */ + int32_t *l_434[8][4][6] = {{{&l_311,&g_215,&g_215,&g_215,&l_289,(void*)0},{&g_215,&g_215,&l_388,&l_388,&g_215,&g_215},{&l_388,&g_215,&g_215,(void*)0,&l_289,&g_215},{&g_215,&g_215,&l_311,&g_215,&g_215,&g_215}},{{&g_215,&l_388,&g_215,(void*)0,&l_300[0][1],&l_300[0][1]},{&l_388,&l_289,&l_289,&l_388,&l_311,&l_300[0][1]},{&g_215,&l_300[0][1],&g_215,&g_215,(void*)0,&g_215},{&l_311,&l_388,&l_311,(void*)0,(void*)0,&g_215}},{{&l_388,&g_215,&l_311,&g_215,&g_215,&l_311},{(void*)0,(void*)0,&l_289,&g_215,&g_215,&g_215},{&l_388,&l_289,&g_215,&g_215,&g_215,&l_289},{&g_215,&l_388,&g_215,&l_388,(void*)0,&g_215}},{{&l_311,&l_388,&l_289,&l_289,&l_388,&l_311},{&l_289,&l_388,&l_311,&l_300[0][1],(void*)0,&g_215},{&g_215,&l_388,&g_215,&l_388,&g_215,&l_388},{&g_215,&l_289,&l_388,&l_300[0][1],&g_215,&g_215}},{{&l_289,(void*)0,(void*)0,&l_289,&g_215,&g_215},{&l_311,&g_215,&l_388,&l_388,&l_300[0][1],&l_388},{&g_215,(void*)0,&g_215,&g_215,&l_300[0][1],&g_215},{&l_388,&g_215,&l_311,&g_215,&g_215,&l_311}},{{(void*)0,(void*)0,&l_289,&g_215,&g_215,&g_215},{&l_388,&l_289,&g_215,&g_215,&g_215,&l_289},{&g_215,&l_388,&g_215,&l_388,(void*)0,&g_215},{&l_311,&l_388,&l_289,&l_289,&l_388,&l_311}},{{&l_289,&l_388,&l_311,&l_300[0][1],(void*)0,&g_215},{&g_215,&l_388,&g_215,&l_388,&g_215,&l_388},{&g_215,&l_289,&l_388,&l_300[0][1],&g_215,&g_215},{&l_289,(void*)0,(void*)0,&l_289,&g_215,&g_215}},{{&l_311,&g_215,&l_388,&l_388,&l_300[0][1],&l_388},{&g_215,(void*)0,&g_215,&g_215,&l_300[0][1],&g_215},{&l_388,&g_215,&l_311,&g_215,&g_215,&l_311},{(void*)0,(void*)0,&l_289,&g_215,&g_215,&g_215}}}; + int32_t l_435 = 3L; + int32_t l_437 = 5L; + int32_t l_438[2]; + uint32_t l_444 = 0xDB1A413FL; + uint8_t *l_453 = &g_113; + struct S0 l_455 = {1,6823,0,-72,14,1,-4,-531,-1}; + const int8_t *l_457 = &l_263.f0; + const int8_t **l_456 = &l_457; + int i, j, k; + for (i = 0; i < 2; i++) + l_438[i] = 0L; + l_444++; + (*g_214) &= (safe_mod_func_uint32_t_u_u((l_454 = (((safe_lshift_func_int8_t_s_s(((safe_mod_func_int16_t_s_s((l_250 == l_426), p_32)) ^ (((*l_250) = 0xDAL) | (g_331 , p_32))), (((g_2 & ((g_126[1][2] & (l_453 != &g_144)) , g_350[4][2].f3)) , l_292.f3) | p_32))) & 7L) != 6L)), l_439)); + for (l_299 = 0; l_299 < 2; l_299 += 1) + { + for (l_289 = 0; l_289 < 6; l_289 += 1) + { + g_252[l_299][l_289] = &g_141[0]; + } + } + if (((*g_214) |= (&g_143 == (l_455 , ((*l_456) = l_453))))) + { /* block id: 180 */ + int16_t l_462 = 0xFFE7L; + int32_t l_464 = 1L; + int32_t l_465 = (-8L); + uint8_t l_472[4][10][6] = {{{0x44L,0x78L,7UL,1UL,0UL,7UL},{0x09L,0x2AL,0UL,255UL,0UL,0x2AL},{1UL,0x78L,0xF6L,255UL,0x78L,0UL},{0x09L,0UL,0xF6L,1UL,0x2AL,0x2AL},{0x44L,0UL,0UL,0x44L,0x78L,7UL},{0x44L,0x78L,7UL,1UL,0UL,7UL},{0x09L,0x2AL,0UL,255UL,0UL,0x2AL},{1UL,0x78L,0xF6L,255UL,0x7FL,0xE7L},{0UL,0xE7L,0UL,7UL,0xBEL,0xBEL},{0xF6L,0xE7L,0xE7L,0xF6L,0x7FL,0x13L}},{{0xF6L,0x7FL,0x13L,7UL,0xE7L,0x13L},{0UL,0xBEL,0xE7L,0x78L,0xE7L,0xBEL},{7UL,0x7FL,0UL,0x78L,0x7FL,0xE7L},{0UL,0xE7L,0UL,7UL,0xBEL,0xBEL},{0xF6L,0xE7L,0xE7L,0xF6L,0x7FL,0x13L},{0xF6L,0x7FL,0x13L,7UL,0xE7L,0x13L},{0UL,0xBEL,0xE7L,0x78L,0xE7L,0xBEL},{7UL,0x7FL,0UL,0x78L,0x7FL,0xE7L},{0UL,0xE7L,0UL,7UL,0xBEL,0xBEL},{0xF6L,0xE7L,0xE7L,0xF6L,0x7FL,0x13L}},{{0xF6L,0x7FL,0x13L,7UL,0xE7L,0x13L},{0UL,0xBEL,0xE7L,0x78L,0xE7L,0xBEL},{7UL,0x7FL,0UL,0x78L,0x7FL,0xE7L},{0UL,0xE7L,0UL,7UL,0xBEL,0xBEL},{0xF6L,0xE7L,0xE7L,0xF6L,0x7FL,0x13L},{0xF6L,0x7FL,0x13L,7UL,0xE7L,0x13L},{0UL,0xBEL,0xE7L,0x78L,0xE7L,0xBEL},{7UL,0x7FL,0UL,0x78L,0x7FL,0xE7L},{0UL,0xE7L,0UL,7UL,0xBEL,0xBEL},{0xF6L,0xE7L,0xE7L,0xF6L,0x7FL,0x13L}},{{0xF6L,0x7FL,0x13L,7UL,0xE7L,0x13L},{0UL,0xBEL,0xE7L,0x78L,0xE7L,0xBEL},{7UL,0x7FL,0UL,0x78L,0x7FL,0xE7L},{0UL,0xE7L,0UL,7UL,0xBEL,0xBEL},{0xF6L,0xE7L,0xE7L,0xF6L,0x7FL,0x13L},{0xF6L,0x7FL,0x13L,7UL,0xE7L,0x13L},{0UL,0xBEL,0xE7L,0x78L,0xE7L,0xBEL},{7UL,0x7FL,0UL,0x78L,0x7FL,0xE7L},{0UL,0xE7L,0UL,7UL,0xBEL,0xBEL},{0xF6L,0xE7L,0xE7L,0UL,1UL,0xD6L}}}; + int8_t ***l_488 = &g_486; + int i, j, k; + for (l_436 = 0; (l_436 == (-20)); l_436--) + { /* block id: 183 */ + int16_t l_460 = 0x8D84L; + int32_t l_461 = 0L; + int32_t l_463[3][1][7] = {{{5L,0x4FEAE600L,5L,0x2AF12338L,0x70CB83D5L,0x70CB83D5L,0x2AF12338L}},{{5L,0x4FEAE600L,5L,0x2AF12338L,0x70CB83D5L,0x70CB83D5L,0x2AF12338L}},{{5L,0x4FEAE600L,5L,0x2AF12338L,0x70CB83D5L,0x70CB83D5L,0x2AF12338L}}}; + int i, j, k; + l_466--; + (*g_214) = (safe_rshift_func_uint8_t_u_u(l_436, 0)); + (*g_214) = (0UL >= (((p_32 | l_436) , &l_465) != (l_471 , &g_52))); + l_472[2][3][2]++; + } + l_476[0] = l_475; + (*g_214) = (safe_mul_func_int16_t_s_s((-1L), (safe_add_func_int16_t_s_s((((*g_214) & ((((safe_div_func_int32_t_s_s((65534UL >= ((!((l_465 &= (((*l_488) = g_486) == &l_457)) != (g_350[4][2].f8 = (*g_214)))) >= l_489)), p_32)) < (0x270A4E95L != 1L)) > l_490[5]) | 1L)) & l_300[3][0]), 0xE47FL)))); + l_292.f0 |= (&g_216 != (void*)0); + } + else + { /* block id: 195 */ + for (l_311 = 0; (l_311 > 18); l_311 = safe_add_func_int32_t_s_s(l_311, 1)) + { /* block id: 198 */ + return g_493; + } + } + } + else + { /* block id: 202 */ +lbl_494: + (*g_214) ^= 9L; + for (l_439 = 2; (l_439 >= 0); l_439 -= 1) + { /* block id: 207 */ + int32_t ***l_497 = &l_236; + uint16_t *l_506 = &l_213[2][2][2]; + uint32_t l_514 = 0UL; + int32_t *l_515 = &l_222[0][4]; + int32_t *l_516[2]; + int i; + for (i = 0; i < 2; i++) + l_516[i] = (void*)0; + g_86 = l_495; + (*l_497) = l_496; + } + if ((l_375 , (((**l_294) = (((safe_add_func_uint32_t_u_u((l_530 |= 4294967295UL), 0xE1E4D1B6L)) & (*g_487)) <= (((*l_546) = (g_143 , ((*l_545) |= ((safe_sub_func_uint8_t_u_u((safe_mod_func_int16_t_s_s(p_32, (safe_sub_func_uint32_t_u_u((safe_div_func_uint32_t_u_u((safe_sub_func_int32_t_s_s((((((*l_495) & ((l_541 &= 0x15239216L) ^ (&g_216 == &g_216))) , 0xD1FAFE0AL) > (**l_496)) , p_32), 0x11CB596BL)), l_542)), g_543)))), (*l_495))) != (*l_495))))) > p_32))) <= (*g_216)))) + { /* block id: 233 */ + int32_t l_562 = 0L; + uint16_t *l_573 = &g_72; + uint16_t *l_578 = &l_213[2][6][1]; + uint16_t *l_579 = &l_542; + int32_t l_580[8][1][3] = {{{0L,0L,0L}},{{0xED1E47A8L,0xED1E47A8L,0xED1E47A8L}},{{0L,0L,0L}},{{0xED1E47A8L,0xED1E47A8L,0xED1E47A8L}},{{0L,0L,0L}},{{0xED1E47A8L,0xED1E47A8L,0xED1E47A8L}},{{0L,0L,0L}},{{0xED1E47A8L,0xED1E47A8L,0xED1E47A8L}}}; + uint8_t l_596 = 246UL; + union U1 **l_597 = &l_476[0]; + union U1 ***l_598 = &l_597; + int i, j, k; + (*l_495) = ((p_32 ^ (((*l_546) &= p_32) & (safe_sub_func_uint8_t_u_u(((safe_unary_minus_func_uint8_t_u((safe_mul_func_int16_t_s_s((+(((((p_32 != p_32) , (void*)0) == (void*)0) & ((void*)0 == g_554)) > 1L)), 0xE42FL)))) , (*g_555)), (*g_555))))) >= (**l_496)); + l_517 |= (p_32 ^ ((**l_496) || ((safe_lshift_func_int16_t_s_u((safe_lshift_func_uint8_t_u_s((p_32 > (safe_sub_func_uint16_t_u_u((l_562 & (l_580[2][0][0] |= (safe_sub_func_int32_t_s_s(((*g_214) = (((safe_mul_func_uint16_t_u_u(((*l_579) = (+((safe_add_func_uint32_t_u_u((safe_add_func_int8_t_s_s((-9L), (((((safe_sub_func_int32_t_s_s((*l_495), (((((*l_578) = ((++(*l_573)) , (((safe_div_func_uint8_t_u_u((&l_496 == &l_496), (*g_487))) ^ (*l_495)) != 0UL))) ^ p_32) && 0x6B6A2B71L) != (**g_486)))) , (void*)0) != &g_331) ^ 0x78B73E53L) | 0xD9BBL))), p_32)) , p_32))), (*g_216))) , (*l_495)) , p_32)), 0L)))), p_32))), p_32)), 0)) & p_32))); + l_596 |= ((+(p_32 , ((+2UL) != (safe_div_func_uint32_t_u_u(((safe_lshift_func_uint8_t_u_u((l_471 , (safe_mul_func_uint16_t_u_u((safe_sub_func_int16_t_s_s((*l_495), l_589)), (((**l_496) &= (safe_unary_minus_func_int8_t_s((-3L)))) | (safe_mod_func_int16_t_s_s((((*l_495) <= ((safe_div_func_uint32_t_u_u(p_32, 1L)) | 0L)) <= g_408), p_32)))))), 4)) > (*g_487)), 0x8438359BL))))) <= l_595[1]); + (*l_598) = l_597; + } + else + { /* block id: 245 */ + int32_t l_622 = 0xFB315905L; + uint16_t *l_627 = (void*)0; + uint16_t *l_628 = &l_542; + uint8_t l_629[8][8][2] = {{{248UL,248UL},{7UL,255UL},{254UL,0UL},{4UL,0UL},{247UL,4UL},{255UL,0x46L},{255UL,4UL},{247UL,0UL}},{{4UL,0UL},{254UL,255UL},{7UL,248UL},{248UL,6UL},{1UL,0x4EL},{0x5DL,0UL},{6UL,6UL},{0xAAL,254UL}},{{0x8AL,247UL},{6UL,0x5DL},{0x22L,249UL},{0xFBL,2UL},{6UL,0xFEL},{0x4EL,0xFEL},{6UL,2UL},{0xFBL,249UL}},{{0x22L,0x5DL},{6UL,247UL},{0x8AL,254UL},{0xAAL,6UL},{6UL,0UL},{0x5DL,0x4EL},{1UL,6UL},{248UL,248UL}},{{7UL,255UL},{254UL,0UL},{4UL,0UL},{247UL,4UL},{255UL,0x46L},{255UL,4UL},{247UL,0UL},{4UL,0UL}},{{254UL,255UL},{7UL,248UL},{248UL,6UL},{1UL,0x4EL},{0x5DL,0UL},{6UL,6UL},{0xAAL,254UL},{0x8AL,247UL}},{{6UL,0x5DL},{0x22L,249UL},{0xFBL,2UL},{6UL,0xFEL},{0x4EL,0xFEL},{6UL,2UL},{0xFBL,249UL},{0x22L,0x5DL}},{{6UL,247UL},{0x8AL,254UL},{0xAAL,6UL},{6UL,0UL},{0x5DL,0x4EL},{1UL,6UL},{248UL,248UL},{7UL,255UL}}}; + const int32_t ** const *l_631 = (void*)0; + const int32_t ** const **l_630 = &l_631; + int32_t l_640 = 7L; + int32_t l_641 = (-1L); + int8_t l_642 = (-1L); + int32_t l_643 = (-1L); + int32_t l_644 = 0x8BDF11AEL; + int i, j, k; + if ((safe_rshift_func_int8_t_s_s(((safe_rshift_func_uint16_t_u_u((((l_605 | p_32) ^ (((l_606 , ((l_375 , ((safe_mul_func_int8_t_s_s((((safe_mul_func_uint16_t_u_u((g_477 , l_632), p_32)) && p_32) ^ p_32), p_32)) & p_32)) < l_633)) || (**g_486)) <= p_32)) < l_634), 9)) , l_635), 2))) + { /* block id: 249 */ + int32_t *l_636 = &l_595[1]; + int32_t *l_637 = &l_326; + int32_t *l_638[10][10] = {{&l_440,&l_300[2][2],&l_440,&l_441,&g_215,&l_595[1],&l_443,&g_53,&g_215,&g_215},{&l_300[2][2],&g_215,(void*)0,&l_595[2],&l_443,&g_53,&g_215,&g_55,&g_55,&g_215},{&l_440,(void*)0,&g_215,&g_215,(void*)0,&l_440,&g_55,&l_388,&l_443,(void*)0},{&l_595[1],&l_622,&g_55,&l_311,&l_388,(void*)0,&g_53,&g_52,&l_326,&l_441},{&l_595[1],&g_215,&l_441,&l_440,&l_300[2][2],&l_440,&l_441,&g_215,&l_595[1],&l_443},{&l_440,&l_441,&g_215,&l_595[1],&l_443,&g_53,&g_215,&g_215,&l_517,&g_52},{&l_311,&g_55,&l_622,&l_595[1],&l_517,&l_595[2],&l_595[2],&l_517,&l_595[1],&l_622},{&g_215,&g_215,(void*)0,&l_440,&g_55,&l_388,&l_443,(void*)0,&l_326,&l_289},{&l_441,(void*)0,&g_215,&l_311,&l_595[2],&l_326,&l_443,&l_440,&l_443,&l_326},{&l_289,&g_215,&l_311,&g_215,&l_289,&g_215,&l_595[2],&l_300[4][1],&g_55,(void*)0}}; + int i, j; + ++l_645; + } + else + { /* block id: 251 */ + uint16_t **l_649 = &g_351; + struct S0 l_652 = {1,-1595,1,-114,32,1,3,-572,3}; + l_648 &= (*g_214); + (*l_496) = (*l_236); + l_656 = (p_32 , (((+(*l_495)) <= (((*l_649) = &g_72) != &g_72)) , ((((((--(**l_649)) , (((l_652 , (safe_sub_func_uint32_t_u_u((((*g_351) = (*g_351)) >= p_32), ((*l_495) = p_32)))) != (((*l_475) , (**g_486)) >= (**g_486))) | p_32)) > l_655) >= p_32) >= 3UL) & (*g_216)))); + } + } + (*l_657) |= (*l_495); + } + return (**g_554); + } + (*g_86) = (safe_add_func_uint32_t_u_u(p_32, (safe_div_func_uint16_t_u_u(0UL, (l_471 , (((**l_236) | ((&g_24 != (l_665 = l_253)) ^ (**l_236))) && (*l_495))))))); + } + else + { /* block id: 267 */ + int32_t *l_667 = &l_311; + const int8_t **l_779 = (void*)0; + int32_t ***l_783 = &l_236; + int32_t ****l_782 = &l_783; + for (g_52 = 0; (g_52 <= 1); g_52 += 1) + { /* block id: 270 */ + int32_t *l_674 = &g_2; + int i; + if (g_312[g_52]) + break; + (**l_236) = g_141[g_52]; + l_667 = l_667; + (*l_674) ^= (!((~((safe_add_func_uint8_t_u_u(((safe_mul_func_uint16_t_u_u(((((*g_214) = ((**l_236) = (safe_sub_func_uint16_t_u_u(((~p_32) >= (*l_667)), (0xFCA0L || (*g_216)))))) < (p_32 || ((!9L) != (0xEAD7L || p_32)))) | 2UL), (*l_667))) | 0xD8E940E8L), 0UL)) < p_32)) | 3UL)); + } + (*g_86) = (safe_mul_func_int8_t_s_s((((*g_487) = (0xEDL && 2UL)) >= ((void*)0 == &g_486)), p_32)); + for (g_53 = 0; (g_53 <= 0); g_53 += 1) + { /* block id: 282 */ + union U1 **l_690 = &l_476[0]; + union U1 ***l_689 = &l_690; + int32_t l_697 = 5L; + int32_t l_698 = 0x4E770919L; + uint32_t **l_713[2]; + int16_t l_728 = 0x06BDL; + struct S0 l_738[4] = {{-1,-28471,1,52,85,1,-3,153,2},{-1,-28471,1,52,85,1,-3,153,2},{-1,-28471,1,52,85,1,-3,153,2},{-1,-28471,1,52,85,1,-3,153,2}}; + int16_t **l_739 = &g_216; + const int8_t *l_781 = (void*)0; + const int8_t **l_780 = &l_781; + int i; + for (i = 0; i < 2; i++) + l_713[i] = &l_233[2][1]; + for (g_626 = 0; (g_626 <= 1); g_626 += 1) + { /* block id: 285 */ + int32_t ***l_686 = &l_236; + int32_t **** const l_685[1][6][8] = {{{&l_686,&l_686,&l_686,&l_686,&l_686,&l_686,&l_686,&l_686},{&l_686,&l_686,&l_686,&l_686,&l_686,&l_686,&l_686,&l_686},{&l_686,&l_686,&l_686,&l_686,&l_686,&l_686,&l_686,&l_686},{&l_686,&l_686,&l_686,&l_686,&l_686,&l_686,&l_686,&l_686},{&l_686,&l_686,&l_686,&l_686,&l_686,&l_686,&l_686,&l_686},{&l_686,&l_686,&l_686,&l_686,&l_686,&l_686,&l_686,&l_686}}}; + int8_t ***l_693 = (void*)0; + int8_t ***l_694 = (void*)0; + int8_t ***l_695[1]; + uint32_t **l_715 = &g_252[0][3]; + union U1 *l_722 = &g_477; + uint32_t * const *l_773 = (void*)0; + uint32_t * const **l_772[4]; + int i, j, k; + for (i = 0; i < 1; i++) + l_695[i] = (void*)0; + for (i = 0; i < 4; i++) + l_772[i] = &l_773; + } + (**l_236) ^= ((safe_sub_func_uint32_t_u_u(((*l_775) = p_32), ((l_738[3] , l_779) == l_780))) , (0xC66D43EFL & ((1L && ((g_350[4][2].f4 , l_782) == g_784[1])) | 65535UL))); + if (g_55) + goto lbl_787; + } + } + return p_32; +} + + +/* ------------------------------------------ */ +/* + * reads : g_141 g_53 g_2 g_36 g_86 g_52 g_109 g_114 g_72 g_144 g_24 g_55 g_126 g_214 g_215 + * writes: g_24 g_2 g_36 g_52 g_53 g_55 g_86 g_113 g_126 g_109.f3 g_114 g_141 g_143 g_144 g_72 g_194 g_215 + */ +static int32_t * func_40(uint32_t p_41, int32_t * p_42, int16_t * p_43, int32_t p_44, uint32_t * p_45) +{ /* block id: 97 */ + uint32_t l_235 = 1UL; + (*g_214) |= ((func_46(g_141[1]) , l_235) , 0xCE81F14CL); + return p_45; +} + + +/* ------------------------------------------ */ +/* + * reads : g_24 g_53 g_2 g_36 g_86 g_52 g_109 g_114 g_72 g_144 g_55 g_126 g_141 + * writes: g_24 g_2 g_36 g_52 g_53 g_55 g_86 g_113 g_126 g_109.f3 g_114 g_141 g_143 g_144 g_72 g_194 + */ +static union U1 func_46(int8_t p_47) +{ /* block id: 15 */ + int32_t *l_50 = &g_2; + int32_t l_211[7][2][7] = {{{6L,(-5L),6L,(-5L),6L,(-5L),6L},{0xD1FBBA7CL,0xBCAAB667L,0xBCAAB667L,0xD1FBBA7CL,0xD1FBBA7CL,0xBCAAB667L,0xBCAAB667L}},{{0x225E0FD6L,(-5L),0x225E0FD6L,(-5L),0x225E0FD6L,(-5L),0x225E0FD6L},{0xD1FBBA7CL,0xD1FBBA7CL,0xBCAAB667L,0xBCAAB667L,0xD1FBBA7CL,0xD1FBBA7CL,0xBCAAB667L}},{{6L,(-5L),6L,(-5L),6L,(-5L),6L},{0xD1FBBA7CL,0xBCAAB667L,0xBCAAB667L,0xD1FBBA7CL,0xD1FBBA7CL,0xBCAAB667L,0xBCAAB667L}},{{0x225E0FD6L,(-5L),0x225E0FD6L,(-5L),0x225E0FD6L,(-5L),0x225E0FD6L},{0xD1FBBA7CL,0xD1FBBA7CL,0xBCAAB667L,0xBCAAB667L,0xD1FBBA7CL,0xD1FBBA7CL,0xBCAAB667L}},{{6L,(-5L),6L,(-5L),6L,(-5L),6L},{0xD1FBBA7CL,0xBCAAB667L,0xBCAAB667L,0xD1FBBA7CL,0xD1FBBA7CL,0xBCAAB667L,0xBCAAB667L}},{{0x225E0FD6L,(-5L),0x225E0FD6L,(-5L),0x225E0FD6L,(-5L),0x225E0FD6L},{0xD1FBBA7CL,0xD1FBBA7CL,0xBCAAB667L,0xBCAAB667L,0xD1FBBA7CL,0xD1FBBA7CL,0xBCAAB667L}},{{6L,(-5L),6L,(-5L),6L,(-5L),6L},{0xD1FBBA7CL,0xBCAAB667L,0xBCAAB667L,0xD1FBBA7CL,0xD1FBBA7CL,0xBCAAB667L,0xBCAAB667L}}}; + union U1 l_212 = {0L}; + int i, j, k; + l_211[2][1][3] &= func_48(l_50); + return l_212; +} + + +/* ------------------------------------------ */ +/* + * reads : g_24 g_53 g_2 g_36 g_86 g_52 g_109 g_114 g_72 g_144 g_55 g_126 g_141 + * writes: g_24 g_2 g_36 g_52 g_53 g_55 g_86 g_113 g_126 g_109.f3 g_114 g_141 g_143 g_144 g_72 g_194 + */ +static int32_t func_48(int32_t * p_49) +{ /* block id: 16 */ + uint32_t l_51[1]; + uint16_t *l_193 = &g_72; + int8_t *l_195 = &g_143; + int16_t *l_207 = (void*)0; + int16_t *l_208 = &g_36; + int32_t l_209[7][1]; + int32_t l_210 = 0xA774E767L; + int i, j; + for (i = 0; i < 1; i++) + l_51[i] = 2UL; + for (i = 0; i < 7; i++) + { + for (j = 0; j < 1; j++) + l_209[i][j] = 9L; + } + for (g_24 = 0; (g_24 <= 0); g_24 += 1) + { /* block id: 19 */ + uint32_t l_57 = 4294967293UL; + int32_t l_85 = 0L; + for (g_2 = 0; (g_2 >= 0); g_2 -= 1) + { /* block id: 22 */ + int32_t l_88[7]; + const uint32_t l_173[9] = {0xBCAD55B1L,0xBCAD55B1L,0xBCAD55B1L,0xBCAD55B1L,0xBCAD55B1L,0xBCAD55B1L,0xBCAD55B1L,0xBCAD55B1L,0xBCAD55B1L}; + int32_t l_183 = 0x181DA4DAL; + int i; + for (i = 0; i < 7; i++) + l_88[i] = 0xFA934127L; + for (g_36 = 0; (g_36 <= 0); g_36 += 1) + { /* block id: 25 */ + uint32_t l_67 = 1UL; + int32_t l_73 = 0xAC9C4BD7L; + for (g_52 = 0; (g_52 >= 0); g_52 -= 1) + { /* block id: 28 */ + uint8_t l_68 = 251UL; + for (g_53 = 0; g_53 < 1; g_53 += 1) + { + l_51[g_53] = 4294967287UL; + } + for (g_53 = 0; (g_53 >= 0); g_53 -= 1) + { /* block id: 32 */ + int32_t *l_54 = &g_55; + int32_t *l_56 = &g_55; + int32_t **l_60[5][2][1] = {{{&l_54},{(void*)0}},{{&l_54},{(void*)0}},{{&l_54},{(void*)0}},{{&l_54},{(void*)0}},{{&l_54},{(void*)0}}}; + uint16_t *l_71[4][9] = {{(void*)0,&g_72,(void*)0,(void*)0,&g_72,(void*)0,(void*)0,&g_72,(void*)0},{(void*)0,&g_72,(void*)0,(void*)0,&g_72,(void*)0,(void*)0,&g_72,(void*)0},{(void*)0,&g_72,(void*)0,(void*)0,&g_72,(void*)0,(void*)0,&g_72,(void*)0},{(void*)0,&g_72,(void*)0,(void*)0,&g_72,(void*)0,(void*)0,&g_72,(void*)0}}; + int i, j, k; + l_57++; + if (l_51[g_53]) + break; + p_49 = (void*)0; + (*l_54) = (safe_add_func_uint16_t_u_u(((safe_mod_func_uint16_t_u_u(0x021BL, (safe_lshift_func_int8_t_s_s((l_57 <= ((l_67 ^ (l_68 > (safe_lshift_func_uint16_t_u_s((l_73 = g_2), 10)))) == 0UL)), (safe_unary_minus_func_uint8_t_u((!l_67))))))) | l_68), (safe_add_func_uint32_t_u_u((safe_lshift_func_int16_t_s_u(g_36, 7)), 0L)))); + } + l_85 &= (safe_mul_func_uint8_t_u_u((safe_sub_func_uint8_t_u_u((safe_lshift_func_uint8_t_u_u(l_68, 2)), l_67)), g_2)); + for (g_53 = 0; (g_53 <= 0); g_53 += 1) + { /* block id: 42 */ + return l_51[0]; + } + } + for (l_67 = 0; (l_67 <= 0); l_67 += 1) + { /* block id: 48 */ + const int16_t *l_87 = (void*)0; + int16_t l_172 = (-1L); + int32_t *l_174 = &l_85; + uint16_t *l_184[7] = {(void*)0,&g_72,(void*)0,(void*)0,&g_72,(void*)0,(void*)0}; + int32_t *l_190 = &g_53; + int i; + g_86 = &g_2; + if ((~((&g_36 != l_87) <= (l_88[5] <= (safe_mod_func_int32_t_s_s((*g_86), ((*l_174) &= (((safe_mod_func_int32_t_s_s((safe_div_func_int32_t_s_s((((safe_sub_func_uint16_t_u_u(func_97(g_52), (((safe_mod_func_int16_t_s_s(l_88[3], (safe_mod_func_int16_t_s_s((safe_rshift_func_uint16_t_u_s(g_109.f6, (0L == g_109.f0))), l_51[0])))) , l_88[5]) | l_88[3]))) == l_88[5]) < l_172), (*g_86))), l_173[0])) <= (-1L)) , 1L)))))))) + { /* block id: 75 */ + (*l_174) = 0xA3D40197L; + return (*g_86); + } + else + { /* block id: 78 */ + if (l_51[0]) + break; + } + (*l_190) &= ((l_51[g_24] = (l_51[0] || ((~(l_51[0] || l_67)) > (safe_mod_func_uint16_t_u_u(0x7F8CL, (safe_div_func_int16_t_s_s((safe_lshift_func_uint16_t_u_u(((((((l_173[0] ^ (safe_mod_func_int16_t_s_s(g_55, (g_72 = l_183)))) || ((+(safe_mul_func_uint16_t_u_u((safe_lshift_func_uint16_t_u_s(l_73, 1)), (((safe_unary_minus_func_uint32_t_u(l_183)) != (-1L)) != l_51[0])))) ^ g_109.f4)) , g_109.f3) , g_126[2][2]) < 0x684FL) , l_51[0]), g_109.f2)), l_51[0]))))))) && (*l_174)); + } + if (l_51[0]) + continue; + return l_173[2]; + } + } + } + l_210 &= (safe_add_func_uint32_t_u_u(((~(((((*l_195) = ((g_194[0] = l_193) == l_193)) >= (safe_sub_func_uint32_t_u_u(((((safe_unary_minus_func_uint16_t_u(((((safe_add_func_uint16_t_u_u((l_195 != ((*g_86) , l_195)), (safe_sub_func_int8_t_s_s((safe_rshift_func_int16_t_s_u((((8L < (l_51[0] > (~(((((safe_mul_func_int16_t_s_s(((*l_208) &= (-1L)), 0xAB67L)) > l_51[0]) != g_126[0][1]) , 0xBED7L) <= l_51[0])))) && (-5L)) & g_141[0]), g_109.f1)), g_126[2][0])))) > g_72) & 0UL) && 0L))) == 0x986FCF50L) > l_209[2][0]) < l_209[5][0]), l_51[0]))) , l_195) == l_195)) > 0x199EL), 0xF422AACBL)); + return l_51[0]; +} + + +/* ------------------------------------------ */ +/* + * reads : g_109 g_114 g_72 g_53 g_52 g_86 g_2 g_144 g_24 g_36 + * writes: g_113 g_126 g_109.f3 g_52 g_114 g_53 g_141 g_143 g_144 g_55 + */ +static uint16_t func_97(uint32_t p_98) +{ /* block id: 50 */ + const struct S0 l_108[9][4] = {{{0,-21199,1,135,86,0,1,-402,3},{-1,23252,1,149,26,1,-4,-424,-2},{0,-21199,1,135,86,0,1,-402,3},{-0,-7293,0,111,28,1,7,-518,-3}},{{0,-21199,1,135,86,0,1,-402,3},{-0,-7293,0,111,28,1,7,-518,-3},{-0,-7293,0,111,28,1,7,-518,-3},{0,-21199,1,135,86,0,1,-402,3}},{{1,3929,0,-39,34,0,-6,-396,2},{-0,-7293,0,111,28,1,7,-518,-3},{-0,-26147,1,-163,61,0,7,427,2},{-0,-7293,0,111,28,1,7,-518,-3}},{{-0,-7293,0,111,28,1,7,-518,-3},{-1,23252,1,149,26,1,-4,-424,-2},{-0,-26147,1,-163,61,0,7,427,2},{-0,-26147,1,-163,61,0,7,427,2}},{{1,3929,0,-39,34,0,-6,-396,2},{1,3929,0,-39,34,0,-6,-396,2},{-0,-7293,0,111,28,1,7,-518,-3},{-0,-26147,1,-163,61,0,7,427,2}},{{0,-21199,1,135,86,0,1,-402,3},{-1,23252,1,149,26,1,-4,-424,-2},{0,-21199,1,135,86,0,1,-402,3},{-0,-7293,0,111,28,1,7,-518,-3}},{{0,-21199,1,135,86,0,1,-402,3},{-0,-7293,0,111,28,1,7,-518,-3},{-0,-7293,0,111,28,1,7,-518,-3},{0,-21199,1,135,86,0,1,-402,3}},{{1,3929,0,-39,34,0,-6,-396,2},{-0,-7293,0,111,28,1,7,-518,-3},{-0,-26147,1,-163,61,0,7,427,2},{-0,-7293,0,111,28,1,7,-518,-3}},{{-0,-7293,0,111,28,1,7,-518,-3},{-1,23252,1,149,26,1,-4,-424,-2},{-0,-26147,1,-163,61,0,7,427,2},{-0,-26147,1,-163,61,0,7,427,2}}}; + const union U1 l_110[3][7][3] = {{{{0L},{0L},{0L}},{{0xE3L},{-1L},{-1L}},{{0L},{0L},{0x97L}},{{0xE3L},{7L},{0xE3L}},{{0L},{0L},{0x97L}},{{-9L},{-9L},{-1L}},{{0xB4L},{0L},{0L}}},{{{-1L},{7L},{0x16L}},{{0xB4L},{0L},{0xB4L}},{{-9L},{-1L},{0x16L}},{{0L},{0L},{0L}},{{0xE3L},{-1L},{-1L}},{{0L},{0L},{0x97L}},{{0xE3L},{7L},{0xE3L}}},{{{0L},{0L},{0x97L}},{{-9L},{-9L},{-1L}},{{0x97L},{0xB4L},{0xB4L}},{{0xE3L},{-9L},{7L}},{{0x97L},{0L},{0x97L}},{{-1L},{0xE3L},{7L}},{{0L},{0L},{0xB4L}}}}; + int32_t *l_111 = (void*)0; + uint8_t *l_112 = &g_113; + int32_t **l_164 = &l_111; + uint32_t l_165 = 0xE251D069L; + int i, j, k; + (*l_164) = func_99(&g_24, func_104(l_108[1][0], ((l_108[1][0].f4 , g_109) , ((l_110[0][2][1] , (((void*)0 != l_111) <= ((l_110[0][2][1] , ((*l_112) = (p_98 > p_98))) ^ g_109.f5))) | 0x4A07L)), g_114), g_109.f6, g_109.f7); + return l_165; +} + + +/* ------------------------------------------ */ +/* + * reads : g_52 g_109.f1 g_109.f0 g_86 g_2 g_144 g_24 g_36 g_234 + * writes: g_52 g_114 g_53 g_141 g_143 g_144 g_55 + */ +static int32_t * func_99(uint32_t * const p_100, uint8_t p_101, uint8_t p_102, const int8_t p_103) +{ /* block id: 57 */ + uint8_t l_151[6][9][4] = {{{255UL,0x6EL,0x5DL,0xA6L},{1UL,0UL,0UL,1UL},{1UL,0xC0L,0x5DL,0xD0L},{255UL,1UL,0xFCL,0x27L},{0xA6L,6UL,0xA6L,0x27L},{0xFCL,1UL,255UL,0xD0L},{0x5DL,0xC0L,1UL,1UL},{0UL,0UL,1UL,0xA6L},{0x5DL,0x6EL,255UL,0xC0L}},{{0xFCL,255UL,0xA6L,255UL},{0xA6L,255UL,0xFCL,0xC0L},{255UL,0x6EL,0x5DL,0xA6L},{1UL,0UL,0UL,1UL},{1UL,0xC0L,0x5DL,0xD0L},{255UL,1UL,0xFCL,0x27L},{0xA6L,6UL,0xA6L,0x27L},{0xFCL,1UL,255UL,0xD0L},{0x5DL,0xC0L,1UL,1UL}},{{0UL,0UL,1UL,0xA6L},{0x5DL,0x6EL,255UL,0xC0L},{0xFCL,255UL,0xA6L,255UL},{0xA6L,255UL,0xFCL,0xC0L},{255UL,0x6EL,0x5DL,0xA6L},{1UL,0UL,0UL,1UL},{1UL,0xC0L,0x5DL,0xD0L},{255UL,1UL,0xFCL,0x27L},{0xA6L,6UL,0xA6L,0x27L}},{{0xFCL,1UL,255UL,0xD0L},{0x5DL,0xC0L,1UL,1UL},{0UL,0UL,1UL,0xA6L},{0x5DL,0x6EL,255UL,0xC0L},{0xFCL,255UL,0xA6L,255UL},{0xA6L,255UL,0xFCL,0xC0L},{255UL,0x6EL,0x5DL,0xA6L},{1UL,0UL,0UL,1UL},{1UL,0xC0L,0x5DL,0xD0L}},{{255UL,1UL,0xFCL,0x27L},{0xA6L,6UL,0xA6L,0x27L},{0xFCL,1UL,255UL,0xD0L},{0x5DL,0xC0L,1UL,1UL},{0UL,0UL,1UL,0xA6L},{0x5DL,0x6EL,255UL,0xC0L},{0xFCL,255UL,0xA6L,255UL},{0xA6L,255UL,0xFCL,0xC0L},{6UL,0xFCL,0xA6L,0xC0L}},{{0UL,0x27L,0x27L,0UL},{0UL,1UL,0xA6L,0x6EL},{6UL,0UL,0x5DL,255UL},{0xC0L,0xD0L,0xC0L,255UL},{0x5DL,0UL,6UL,0x6EL},{0xA6L,1UL,0UL,0UL},{0x27L,0x27L,0UL,0xC0L},{0xA6L,0xFCL,6UL,1UL},{0x5DL,6UL,0xC0L,6UL}}}; + int32_t *l_155 = &g_55; + int32_t l_156 = 0x20075B0AL; + int32_t *l_157 = (void*)0; + int32_t *l_158 = &g_52; + int32_t *l_159 = (void*)0; + uint16_t l_160 = 0xAE7EL; + int32_t *l_163 = (void*)0; + int i, j, k; + for (g_52 = 0; (g_52 < 13); g_52 = safe_add_func_int8_t_s_s(g_52, 1)) + { /* block id: 60 */ + int16_t l_132[8] = {0x8A8DL,0x8A8DL,1L,0x8A8DL,0x8A8DL,1L,0x8A8DL,0x8A8DL}; + uint8_t *l_135[2][9] = {{&g_114,(void*)0,&g_113,&g_113,&g_113,(void*)0,&g_114,&g_114,(void*)0},{&g_113,(void*)0,&g_114,(void*)0,&g_113,(void*)0,(void*)0,&g_113,(void*)0}}; + int32_t *l_136 = &g_53; + int32_t **l_137 = &l_136; + uint32_t *l_138 = (void*)0; + uint32_t *l_139 = (void*)0; + uint32_t *l_140 = &g_141[1]; + int8_t *l_142 = &g_143; + int32_t *l_152 = &g_55; + int32_t **l_153 = (void*)0; + int32_t **l_154[5][5] = {{&l_152,&l_136,&l_152,&g_86,&g_86},{&l_152,&l_152,&g_86,&l_152,&l_152},{&l_152,&l_152,&l_136,&l_152,&l_136},{&l_136,&l_136,&g_86,&l_152,&l_152},{&l_152,&l_152,&l_152,&l_152,&l_136}}; + int i, j; + (*l_136) = (l_132[7] | (g_114 = (safe_div_func_int8_t_s_s(l_132[7], g_109.f1)))); + (*l_137) = p_100; + (*l_152) = (0x47L != ((g_109.f0 >= ((*l_142) = (((*l_140) = ((void*)0 != &g_114)) >= (*g_86)))) > ((0xACL >= (g_144 |= 7L)) | (((safe_rshift_func_int16_t_s_s((((safe_rshift_func_int16_t_s_u(0x722AL, ((safe_add_func_uint8_t_u_u(((*g_86) != (*p_100)), l_151[4][2][3])) || l_151[5][1][2]))) & (*g_86)) == p_102), 6)) , g_36) ^ l_151[4][2][3])))); + l_155 = p_100; + } + l_160++; + return l_163; +} + + +/* ------------------------------------------ */ +/* + * reads : g_72 g_53 g_109.f6 g_52 g_109.f3 + * writes: g_126 g_109.f3 + */ +static uint8_t func_104(const struct S0 p_105, int16_t p_106, int32_t p_107) +{ /* block id: 52 */ + uint8_t l_121 = 0xD5L; + uint32_t l_124[7]; + int16_t *l_125 = &g_126[2][2]; + int32_t *l_127[9][9] = {{&g_53,&g_52,(void*)0,&g_52,&g_53,&g_55,&g_52,(void*)0,(void*)0},{&g_2,&g_2,(void*)0,&g_2,(void*)0,&g_2,&g_2,&g_53,&g_2},{&g_2,&g_53,&g_52,&g_55,&g_52,&g_55,&g_52,&g_53,&g_2},{&g_2,&g_52,(void*)0,&g_53,&g_55,(void*)0,&g_55,&g_53,(void*)0},{&g_52,&g_52,&g_55,(void*)0,&g_53,(void*)0,&g_2,(void*)0,&g_53},{&g_2,&g_55,&g_55,&g_2,&g_2,&g_2,&g_2,(void*)0,&g_2},{&g_2,&g_55,&g_55,&g_55,&g_55,&g_2,&g_52,&g_52,&g_53},{&g_2,&g_2,(void*)0,&g_2,&g_2,(void*)0,&g_2,&g_2,&g_52},{&g_53,&g_55,&g_52,&g_52,&g_53,&g_53,&g_52,&g_52,&g_55}}; + int32_t *l_128[3]; + int16_t l_129 = (-1L); + int i, j; + for (i = 0; i < 7; i++) + l_124[i] = 18446744073709551615UL; + for (i = 0; i < 3; i++) + l_128[i] = &g_52; + g_109.f3 |= (safe_add_func_uint16_t_u_u((((((safe_div_func_uint16_t_u_u((safe_mod_func_int8_t_s_s((((((p_105.f0 <= (l_121 ^ p_106)) > (~(((*l_125) = (p_105.f5 <= (safe_rshift_func_int8_t_s_u(l_124[0], 0)))) > (((l_124[0] && l_124[2]) != ((l_128[2] = l_127[6][6]) == (void*)0)) & p_105.f5)))) >= 0xF23EL) < g_72) | 0L), p_107)), (-8L))) | g_53) , g_109.f6) | p_105.f8) , 0xEFFEL), g_52)); + return l_129; +} + + + + +/* ---------------------------------------- */ +int main (int argc, char* argv[]) +{ + int i, j, k; + int print_hash_value = 0; + if (argc == 2 && strcmp(argv[1], "1") == 0) print_hash_value = 1; + platform_main_begin(); + crc32_gentab(); + func_1(); + transparent_crc(g_2, "g_2", print_hash_value); + transparent_crc(g_24, "g_24", print_hash_value); + transparent_crc(g_36, "g_36", print_hash_value); + transparent_crc(g_52, "g_52", print_hash_value); + transparent_crc(g_53, "g_53", print_hash_value); + transparent_crc(g_55, "g_55", print_hash_value); + transparent_crc(g_72, "g_72", print_hash_value); + transparent_crc(g_109.f0, "g_109.f0", print_hash_value); + transparent_crc(g_109.f1, "g_109.f1", print_hash_value); + transparent_crc(g_109.f2, "g_109.f2", print_hash_value); + transparent_crc(g_109.f3, "g_109.f3", print_hash_value); + transparent_crc(g_109.f4, "g_109.f4", print_hash_value); + transparent_crc(g_109.f5, "g_109.f5", print_hash_value); + transparent_crc(g_109.f6, "g_109.f6", print_hash_value); + transparent_crc(g_109.f7, "g_109.f7", print_hash_value); + transparent_crc(g_109.f8, "g_109.f8", print_hash_value); + transparent_crc(g_113, "g_113", print_hash_value); + transparent_crc(g_114, "g_114", print_hash_value); + for (i = 0; i < 4; i++) + { + for (j = 0; j < 6; j++) + { + transparent_crc(g_126[i][j], "g_126[i][j]", print_hash_value); + if (print_hash_value) printf("index = [%d][%d]\n", i, j); + + } + } + for (i = 0; i < 2; i++) + { + transparent_crc(g_141[i], "g_141[i]", print_hash_value); + if (print_hash_value) printf("index = [%d]\n", i); + + } + transparent_crc(g_143, "g_143", print_hash_value); + transparent_crc(g_144, "g_144", print_hash_value); + transparent_crc(g_215, "g_215", print_hash_value); + transparent_crc(g_217, "g_217", print_hash_value); + for (i = 0; i < 6; i++) + { + for (j = 0; j < 6; j++) + { + for (k = 0; k < 7; k++) + { + transparent_crc(g_234[i][j][k], "g_234[i][j][k]", print_hash_value); + if (print_hash_value) printf("index = [%d][%d][%d]\n", i, j, k); + + } + } + } + for (i = 0; i < 2; i++) + { + transparent_crc(g_312[i], "g_312[i]", print_hash_value); + if (print_hash_value) printf("index = [%d]\n", i); + + } + transparent_crc(g_331.f0, "g_331.f0", print_hash_value); + for (i = 0; i < 9; i++) + { + for (j = 0; j < 8; j++) + { + transparent_crc(g_350[i][j].f0, "g_350[i][j].f0", print_hash_value); + transparent_crc(g_350[i][j].f1, "g_350[i][j].f1", print_hash_value); + transparent_crc(g_350[i][j].f2, "g_350[i][j].f2", print_hash_value); + transparent_crc(g_350[i][j].f3, "g_350[i][j].f3", print_hash_value); + transparent_crc(g_350[i][j].f4, "g_350[i][j].f4", print_hash_value); + transparent_crc(g_350[i][j].f5, "g_350[i][j].f5", print_hash_value); + transparent_crc(g_350[i][j].f6, "g_350[i][j].f6", print_hash_value); + transparent_crc(g_350[i][j].f7, "g_350[i][j].f7", print_hash_value); + transparent_crc(g_350[i][j].f8, "g_350[i][j].f8", print_hash_value); + if (print_hash_value) printf("index = [%d][%d]\n", i, j); + + } + } + transparent_crc(g_408, "g_408", print_hash_value); + transparent_crc(g_477.f0, "g_477.f0", print_hash_value); + transparent_crc(g_493, "g_493", print_hash_value); + transparent_crc(g_543, "g_543", print_hash_value); + transparent_crc(g_626, "g_626", print_hash_value); + transparent_crc(g_664, "g_664", print_hash_value); + for (i = 0; i < 1; i++) + { + for (j = 0; j < 9; j++) + { + for (k = 0; k < 4; k++) + { + transparent_crc(g_666[i][j][k], "g_666[i][j][k]", print_hash_value); + if (print_hash_value) printf("index = [%d][%d][%d]\n", i, j, k); + + } + } + } + transparent_crc(g_733, "g_733", print_hash_value); + transparent_crc(g_776, "g_776", print_hash_value); + transparent_crc(g_807, "g_807", print_hash_value); + transparent_crc(g_812, "g_812", print_hash_value); + transparent_crc(g_824.f0, "g_824.f0", print_hash_value); + transparent_crc(g_825, "g_825", print_hash_value); + transparent_crc(g_891, "g_891", print_hash_value); + transparent_crc(g_1058, "g_1058", print_hash_value); + transparent_crc(g_1177.f0, "g_1177.f0", print_hash_value); + platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value); + return 0; +} + +/************************ statistics ************************* +XXX max struct depth: 1 +breakdown: + depth: 0, occurrence: 261 + depth: 1, occurrence: 12 +XXX total union variables: 7 + +XXX non-zero bitfields defined in structs: 9 +XXX zero bitfields defined in structs: 0 +XXX const bitfields defined in structs: 1 +XXX volatile bitfields defined in structs: 0 +XXX structs with bitfields in the program: 13 +breakdown: + indirect level: 0, occurrence: 12 + indirect level: 1, occurrence: 1 +XXX full-bitfields structs in the program: 12 +breakdown: + indirect level: 0, occurrence: 12 +XXX times a bitfields struct's address is taken: 3 +XXX times a bitfields struct on LHS: 0 +XXX times a bitfields struct on RHS: 25 +XXX times a single bitfield on LHS: 5 +XXX times a single bitfield on RHS: 59 + +XXX max expression depth: 51 +breakdown: + depth: 1, occurrence: 185 + depth: 2, occurrence: 44 + depth: 3, occurrence: 2 + depth: 4, occurrence: 3 + depth: 5, occurrence: 5 + depth: 6, occurrence: 3 + depth: 7, occurrence: 3 + depth: 9, occurrence: 1 + depth: 11, occurrence: 1 + depth: 13, occurrence: 4 + depth: 14, occurrence: 1 + depth: 16, occurrence: 1 + depth: 17, occurrence: 2 + depth: 18, occurrence: 7 + depth: 19, occurrence: 1 + depth: 20, occurrence: 4 + depth: 21, occurrence: 2 + depth: 22, occurrence: 4 + depth: 23, occurrence: 4 + depth: 24, occurrence: 2 + depth: 25, occurrence: 2 + depth: 26, occurrence: 3 + depth: 27, occurrence: 1 + depth: 31, occurrence: 2 + depth: 32, occurrence: 1 + depth: 33, occurrence: 2 + depth: 34, occurrence: 1 + depth: 39, occurrence: 1 + depth: 51, occurrence: 1 + +XXX total number of pointers: 243 + +XXX times a variable address is taken: 502 +XXX times a pointer is dereferenced on RHS: 249 +breakdown: + depth: 1, occurrence: 194 + depth: 2, occurrence: 53 + depth: 3, occurrence: 2 +XXX times a pointer is dereferenced on LHS: 190 +breakdown: + depth: 1, occurrence: 170 + depth: 2, occurrence: 19 + depth: 3, occurrence: 1 +XXX times a pointer is compared with null: 15 +XXX times a pointer is compared with address of another variable: 3 +XXX times a pointer is compared with another pointer: 9 +XXX times a pointer is qualified to be dereferenced: 3325 + +XXX max dereference level: 4 +breakdown: + level: 0, occurrence: 0 + level: 1, occurrence: 943 + level: 2, occurrence: 212 + level: 3, occurrence: 39 + level: 4, occurrence: 2 +XXX number of pointers point to pointers: 94 +XXX number of pointers point to scalars: 139 +XXX number of pointers point to structs: 1 +XXX percent of pointers has null in alias set: 29.6 +XXX average alias set size: 1.43 + +XXX times a non-volatile is read: 1247 +XXX times a non-volatile is write: 551 +XXX times a volatile is read: 0 +XXX times read thru a pointer: 0 +XXX times a volatile is write: 0 +XXX times written thru a pointer: 0 +XXX times a volatile is available for access: 0 +XXX percentage of non-volatile access: 100 + +XXX forward jumps: 1 +XXX backward jumps: 3 + +XXX stmts: 190 +XXX max block depth: 5 +breakdown: + depth: 0, occurrence: 27 + depth: 1, occurrence: 24 + depth: 2, occurrence: 29 + depth: 3, occurrence: 38 + depth: 4, occurrence: 37 + depth: 5, occurrence: 35 + +XXX percentage a fresh-made variable is used: 15.1 +XXX percentage an existing variable is used: 84.9 +FYI: the random generator makes assumptions about the integer size. See platform.info for more details. +********************* end of statistics **********************/ + diff --git a/tests/fuzz/9.c.txt b/tests/fuzz/9.c.txt new file mode 100644 index 00000000..b551cc19 --- /dev/null +++ b/tests/fuzz/9.c.txt @@ -0,0 +1 @@ +checksum = F61662D3 diff --git a/tests/fuzz/creduce_tester.py b/tests/fuzz/creduce_tester.py index d5618c2e..6bf9473f 100755 --- a/tests/fuzz/creduce_tester.py +++ b/tests/fuzz/creduce_tester.py @@ -34,7 +34,7 @@ except Exception, e: print '4) Compile JS-ly and compare' def try_js(args): - shared.check_execute([shared.EMCC] + EMCC_ARGS + CSMITH_CFLAGS + args + + shared.check_execute([shared.PYTHON, shared.EMCC] + EMCC_ARGS + CSMITH_CFLAGS + args + [filename, '-o', js_filename]) js = shared.run_js(js_filename, stderr=PIPE, engine=ENGINE) assert correct == js diff --git a/tests/fuzz/csmith_driver.py b/tests/fuzz/csmith_driver.py index d7ed46e1..ad5a7021 100755 --- a/tests/fuzz/csmith_driver.py +++ b/tests/fuzz/csmith_driver.py @@ -14,7 +14,7 @@ sys.path += [os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.pat import shared engine1 = eval('shared.' + sys.argv[1]) if len(sys.argv) > 1 else shared.JS_ENGINES[0] -engine2 = eval('shared.' + sys.argv[2]) if len(sys.argv) > 2 else None +engine2 = shared.SPIDERMONKEY_ENGINE if os.path.exists(shared.SPIDERMONKEY_ENGINE[0]) else None print 'testing js engines', engine1, engine2 @@ -39,25 +39,37 @@ while 1: print 'opt level:', opts print 'Tried %d, notes: %s' % (tried, notes) - print '1) Generate C' + print '1) Generate source' extra_args = [] if random.random() < 0.5: extra_args += ['--no-math64'] - print extra_args + suffix = '.c' + COMP = shared.CLANG_CC + if random.random() < 0.5: + extra_args += ['--lang-cpp'] + suffix += 'pp' + COMP = shared.CLANG + print COMP, extra_args + fullname = filename + suffix check_call([CSMITH, '--no-volatiles', '--no-packed-struct'] + extra_args, #['--max-block-depth', '2', '--max-block-size', '2', '--max-expr-complexity', '2', '--max-funcs', '2'], - stdout=open(filename + '.c', 'w')) - #shutil.copyfile(filename + '.c', 'testcase%d.c' % tried) - print '1) Generate C... %.2f K of C source' % (len(open(filename + '.c').read())/1024.) + stdout=open(fullname, 'w')) + print '1) Generate source... %.2f K' % (len(open(fullname).read())/1024.) tried += 1 print '2) Compile natively' shared.try_delete(filename) - shared.check_execute([shared.CLANG_CC, opts, filename + '.c', '-o', filename + '1'] + CSMITH_CFLAGS) # + shared.EMSDK_OPTS - shared.check_execute([shared.CLANG_CC, opts, '-emit-llvm', '-c', '-Xclang', '-triple=i386-pc-linux-gnu', filename + '.c', '-o', filename + '.bc'] + CSMITH_CFLAGS + shared.EMSDK_OPTS) + try: + shared.check_execute([COMP, opts, fullname, '-o', filename + '1'] + CSMITH_CFLAGS + ['-w']) # + shared.EMSDK_OPTS + except Exception, e: + print 'Failed to compile natively using clang' + notes['invalid'] += 1 + continue + + shared.check_execute([COMP, opts, '-emit-llvm', '-c', '-Xclang', '-triple=i386-pc-linux-gnu', fullname, '-o', filename + '.bc'] + CSMITH_CFLAGS + shared.EMSDK_OPTS) shared.check_execute([shared.path_from_root('tools', 'nativize_llvm.py'), filename + '.bc']) shutil.move(filename + '.bc.run', filename + '2') - shared.check_execute([shared.CLANG_CC, filename + '.c', '-o', filename + '3'] + CSMITH_CFLAGS) + shared.check_execute([COMP, fullname, '-o', filename + '3'] + CSMITH_CFLAGS) print '3) Run natively' try: correct1 = shared.jsrun.timeout_run(Popen([filename + '1'], stdout=PIPE, stderr=PIPE), 3) @@ -77,7 +89,7 @@ while 1: def try_js(args): shared.try_delete(filename + '.js') print '(compile)' - shared.check_execute([shared.EMCC, opts, filename + '.c', '-o', filename + '.js'] + CSMITH_CFLAGS + args) + shared.check_execute([shared.PYTHON, shared.EMCC, opts, fullname, '-o', filename + '.js'] + CSMITH_CFLAGS + args) assert os.path.exists(filename + '.js') print '(run)' js = shared.run_js(filename + '.js', stderr=PIPE, engine=engine1, check_timeout=True) @@ -103,7 +115,7 @@ while 1: print "EMSCRIPTEN BUG" notes['embug'] += 1 fails += 1 - shutil.copyfile(filename + '.c', 'newfail%d.c' % fails) + shutil.copyfile(fullname, 'newfail%d%s' % (fails, suffix)) continue #if not ok: # try: # finally, try with safe heap. if that is triggered, this is nonportable code almost certainly @@ -118,7 +130,7 @@ while 1: # break # This is ok. Try in secondary JS engine too - if engine2 and normal: + if opts != '-O0' and engine2 and normal: try: js2 = shared.run_js(filename + '.js', stderr=PIPE, engine=engine2, full_output=True, check_timeout=True) except: @@ -130,11 +142,7 @@ while 1: print "ODIN VALIDATION BUG" notes['embug'] += 1 fails += 1 - shutil.copyfile(filename + '.c', 'newfail%d.c' % fails) + shutil.copyfile(fullname, 'newfail%d.c' % fails) continue - - js2 = js2.replace('\nwarning: Successfully compiled asm.js code\n', '') - - assert js2 == correct1 or js2 == correct2, ''.join([a.rstrip()+'\n' for a in difflib.unified_diff(correct1.split('\n'), js2.split('\n'), fromfile='expected', tofile='actual')]) + 'ODIN FAIL' - print 'odin ok' + print '[asm.js validation ok]' diff --git a/tests/fuzz/test.sh b/tests/fuzz/test.sh index 5912682e..7e6b8966 100755 --- a/tests/fuzz/test.sh +++ b/tests/fuzz/test.sh @@ -43,5 +43,9 @@ diff fc js | grep -v warning echo "js/fc-sh" diff fc-sh js | grep -v warning echo "native/fc" -diff n1 fc | grep -v warning +grep -v warning fc > fclean +diff n1 fclean | grep -v warning +echo "native2/fc" +grep -v warning fc > fclean +diff n2 fclean | grep -v warning diff --git a/tests/fuzz/testpp.sh b/tests/fuzz/testpp.sh new file mode 100755 index 00000000..8e9f4185 --- /dev/null +++ b/tests/fuzz/testpp.sh @@ -0,0 +1,51 @@ +# e.g. +# ~/Dev/emscripten/tests/fuzz$ CSMITH=~/Dev/csmith/src/csmith CSMITH_PATH=~/Dev/csmith python ./csmith_driver.py +# to find failures, then check those out with this script + +echo "builds" +rm *.out *.bc *.js +g++ $@ -I/home/alon/Dev/csmith/runtime -o n1.out &> /dev/null +/home/alon/Dev/fastcomp/build/Release/bin/clang++ $@ -I/home/alon/Dev/csmith/runtime -o n2.out &> /dev/null +/home/alon/Dev/fastcomp/build/Release/bin/clang++ $@ -I/home/alon/Dev/csmith/runtime -emit-llvm -c -o bc.bc &> o +~/Dev/emscripten/em++ $@ -I/home/alon/Dev/csmith/runtime -o js.out.js &> /dev/null +~/Dev/emscripten/em++ $@ -s UNALIGNED_MEMORY=1 -I/home/alon/Dev/csmith/runtime -o ua.out.js &> /dev/null +~/Dev/emscripten/em++ $@ -s SAFE_HEAP=1 -I/home/alon/Dev/csmith/runtime -o sh.out.js &> /dev/null +EMCC_FAST_COMPILER=1 ~/Dev/emscripten/em++ $@ -I/home/alon/Dev/csmith/runtime -o fc.out.js &> /dev/null +EMCC_FAST_COMPILER=1 ~/Dev/emscripten/em++ $@ -s SAFE_HEAP=1 -I/home/alon/Dev/csmith/runtime -o fc-sh.out.js &> /dev/null +echo "run n1" +./n1.out &> n1 +echo "run n2" +./n2.out &> n2 +echo "run bc" +/home/alon/Dev/fastcomp/build/Release/bin/lli bc.bc &> bc +echo "run js" +mozjs js.out.js &> js +echo "run ua" +mozjs ua.out.js &> ua +echo "run sh" +mozjs sh.out.js &> sh +echo "run fc" +mozjs fc.out.js &> fc +echo "run fc-sh" +mozjs fc-sh.out.js &> fc-sh +echo "n/n" +diff n1 n2 +echo "n/bc" +diff n1 bc +echo "n/js" +diff n1 js | grep -v warning +echo "n/js-ua" +diff n1 ua | grep -v warning +echo "n/js-sh" +diff n1 sh | grep -v warning +echo "js/fc" +diff fc js | grep -v warning +echo "js/fc-sh" +diff fc-sh js | grep -v warning +echo "native/fc" +grep -v warning fc > fclean +diff n1 fclean | grep -v warning +echo "native2/fc" +grep -v warning fc > fclean +diff n2 fclean | grep -v warning + diff --git a/tests/hello_world.ll b/tests/hello_world.ll index adeac7eb..19f84851 100644 --- a/tests/hello_world.ll +++ b/tests/hello_world.ll @@ -1,6 +1,6 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128" -target triple = "i386-pc-linux-gnu" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32" +target triple = "le32-unknown-nacl" @.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/module/test_stdin.c b/tests/module/test_stdin.c index 4838d466..319c686c 100644 --- a/tests/module/test_stdin.c +++ b/tests/module/test_stdin.c @@ -9,7 +9,7 @@ int line = 0; -void main_loop(void *arg) +void main_loop() { char str[10] = {0}; int ret; @@ -46,12 +46,12 @@ int main(int argc, char const *argv[]) // SM shell doesn't implement an event loop and therefor doesn't support // emscripten_set_main_loop. However, its stdin reads are sync so it // should exit out after calling main_loop once. - main_loop(NULL); + main_loop(); #if EMSCRIPTEN emscripten_set_main_loop(main_loop, 60, 0); #else - while (1) main_loop(NULL); sleep(1); + while (1) main_loop(); sleep(1); #endif return 0; -}
\ No newline at end of file +} diff --git a/tests/printf/output.txt b/tests/printf/output.txt index a3baed28..14e053f6 100644 --- a/tests/printf/output.txt +++ b/tests/printf/output.txt @@ -8281,4 +8281,5 @@ ffffff8000000000 1 1.234568E+04 +1.234568E+04 no_new_line diff --git a/tests/printf/test.c b/tests/printf/test.c index adeb69db..c83d92b0 100644 --- a/tests/printf/test.c +++ b/tests/printf/test.c @@ -8286,6 +8286,7 @@ int main() { printf("%x\n", -0xFFFFFFFF); printf("\n"); printf("%*.*E\n", 10, -1, 12345.6789123); + printf("%*.*E\n", 10, -313, 12345.6789123); printf("no_new_line"); return 0; } diff --git a/tests/sockets/test_sockets_echo_client.c b/tests/sockets/test_sockets_echo_client.c index 18cff97e..684d767f 100644 --- a/tests/sockets/test_sockets_echo_client.c +++ b/tests/sockets/test_sockets_echo_client.c @@ -48,7 +48,7 @@ void finish(int result) { exit(result); } -void main_loop(void *arg) { +void main_loop() { static char out[1024*2]; static int pos = 0; fd_set fdr; @@ -163,7 +163,7 @@ int main() { #if EMSCRIPTEN emscripten_set_main_loop(main_loop, 0, 0); #else - while (1) main_loop(NULL); + while (1) main_loop(); #endif return EXIT_SUCCESS; diff --git a/tests/sockets/test_sockets_echo_server.c b/tests/sockets/test_sockets_echo_server.c index 850b7e89..b24472e8 100644 --- a/tests/sockets/test_sockets_echo_server.c +++ b/tests/sockets/test_sockets_echo_server.c @@ -49,7 +49,7 @@ void cleanup() { } } -void main_loop(void *arg) { +void main_loop() { int res; fd_set fdr; fd_set fdw; @@ -189,7 +189,7 @@ int main() { #if EMSCRIPTEN emscripten_set_main_loop(main_loop, 60, 0); #else - while (1) main_loop(NULL); + while (1) main_loop(); #endif return EXIT_SUCCESS; diff --git a/tests/sockets/test_sockets_partial_client.c b/tests/sockets/test_sockets_partial_client.c index dcf90f19..61084b17 100644 --- a/tests/sockets/test_sockets_partial_client.c +++ b/tests/sockets/test_sockets_partial_client.c @@ -25,7 +25,7 @@ void finish(int result) { exit(result); } -void iter(void *arg) { +void iter() { char buffer[1024]; char packetLength; fd_set fdr; @@ -111,7 +111,7 @@ int main() { #if EMSCRIPTEN emscripten_set_main_loop(iter, 0, 0); #else - while (1) iter(NULL); + while (1) iter(); #endif return EXIT_SUCCESS; diff --git a/tests/sockets/test_sockets_partial_server.c b/tests/sockets/test_sockets_partial_server.c index 19f7f2af..f740c307 100644 --- a/tests/sockets/test_sockets_partial_server.c +++ b/tests/sockets/test_sockets_partial_server.c @@ -61,7 +61,7 @@ void do_send(int sockfd) { exit(EXIT_SUCCESS); } -void iter(void *arg) { +void iter() { int res; fd_set fdr; fd_set fdw; @@ -127,7 +127,7 @@ int main() { #if EMSCRIPTEN emscripten_set_main_loop(iter, 60, 0); #else - while (1) iter(NULL); + while (1) iter(); #endif return EXIT_SUCCESS; diff --git a/tests/sockets/test_sockets_select_server_closes_connection_client_rw.c b/tests/sockets/test_sockets_select_server_closes_connection_client_rw.c index 25dcdd05..e69c3ac0 100644 --- a/tests/sockets/test_sockets_select_server_closes_connection_client_rw.c +++ b/tests/sockets/test_sockets_select_server_closes_connection_client_rw.c @@ -30,7 +30,7 @@ void finish(int result) { exit(result); } -void main_loop(void *arg) { +void main_loop() { static int state = 0; static int readPos = 0; static int writePos = 0; @@ -219,7 +219,7 @@ int main() { #if EMSCRIPTEN emscripten_set_main_loop(main_loop, 0, 0); #else - while (1) main_loop(NULL); + while (1) main_loop(); #endif return EXIT_SUCCESS; diff --git a/tests/sockets/test_sockets_select_server_down_client.c b/tests/sockets/test_sockets_select_server_down_client.c index 27e200e0..2765a879 100644 --- a/tests/sockets/test_sockets_select_server_down_client.c +++ b/tests/sockets/test_sockets_select_server_down_client.c @@ -26,7 +26,7 @@ void finish(int result) { exit(result); } -void iter(void *arg) { +void iter() { static int retries = 0; fd_set sett; @@ -90,7 +90,7 @@ int main() { #if EMSCRIPTEN emscripten_set_main_loop(iter, 0, 0); #else - while (1) iter(NULL); + while (1) iter(); #endif return EXIT_FAILURE; diff --git a/tests/sockets/test_sockets_select_server_down_server.c b/tests/sockets/test_sockets_select_server_down_server.c index c2e70f33..012932cf 100644 --- a/tests/sockets/test_sockets_select_server_down_server.c +++ b/tests/sockets/test_sockets_select_server_down_server.c @@ -14,7 +14,7 @@ #include <emscripten.h> #endif -void main_loop(void *arg) { +void main_loop() { } int main() { @@ -50,7 +50,7 @@ int main() { #if EMSCRIPTEN emscripten_set_main_loop(main_loop, 60, 0); #else - while (1) main_loop(NULL); sleep(1); + while (1) main_loop(); sleep(1); #endif return EXIT_SUCCESS; diff --git a/tests/sockets/webrtc_host.c b/tests/sockets/webrtc_host.c index 770e59e0..866c875c 100644 --- a/tests/sockets/webrtc_host.c +++ b/tests/sockets/webrtc_host.c @@ -26,7 +26,7 @@ struct iovec iov[1]; struct msghdr hdr; int done = 0; -void iter(void* arg) { +void iter() { int n; n = recvmsg(sock, &hdr, 0); @@ -82,8 +82,8 @@ int main(void) #if EMSCRIPTEN emscripten_set_main_loop(iter, 0, 0); #else - while (!done) iter(NULL); + while (!done) iter(); #endif return EXIT_SUCCESS; -}
\ No newline at end of file +} diff --git a/tests/sockets/webrtc_peer.c b/tests/sockets/webrtc_peer.c index d24979e7..dd44e93e 100644 --- a/tests/sockets/webrtc_peer.c +++ b/tests/sockets/webrtc_peer.c @@ -25,7 +25,7 @@ struct iovec iov[1]; struct msghdr hdr; int done = 0; -void iter(void* arg) { +void iter() { int n; n = sendmsg(sock, &hdr, 0); @@ -74,8 +74,8 @@ int main(void) #if EMSCRIPTEN emscripten_set_main_loop(iter, 0, 0); #else - while (!done) iter(NULL); + while (!done) iter(); #endif return EXIT_SUCCESS; -}
\ No newline at end of file +} diff --git a/tests/test_benchmark.py b/tests/test_benchmark.py index 1bf1c1d5..023ac1e2 100644 --- a/tests/test_benchmark.py +++ b/tests/test_benchmark.py @@ -176,7 +176,7 @@ class benchmark(RunnerCore): pass Building.COMPILER = CLANG - Building.COMPILER_TEST_OPTS = [] + Building.COMPILER_TEST_OPTS = ['-O2'] def do_benchmark(self, name, src, expected_output='FAIL', args=[], emcc_args=[], native_args=[], shared_args=[], force_c=False, reps=TEST_REPS, native_exec=None, output_parser=None, args_processor=None, lib_builder=None): if len(benchmarkers) == 0: raise Exception('error, no benchmarkers: ' + benchmarkers_error) diff --git a/tests/test_browser.py b/tests/test_browser.py index ddd70362..c1d1caab 100644 --- a/tests/test_browser.py +++ b/tests/test_browser.py @@ -747,8 +747,11 @@ function assert(x, y) { if (!x) throw 'assertion failed ' + y } var windowClose = window.close; window.close = function() { - doReftest(); - setTimeout(windowClose, 1000); + // wait for rafs to arrive and the screen to update before reftesting + setTimeout(function() { + doReftest(); + setTimeout(windowClose, 1000); + }, 1000); }; </script> </body>''' % open('reftest.js').read()) @@ -1540,7 +1543,7 @@ keydown(100);keyup(100); // trigger the end self.btest('gles2_conformance.cpp', args=['-s', 'GL_ASSERTIONS=1'], expected=['1']) def test_matrix_identity(self): - self.btest('gl_matrix_identity.c', expected=['-1882984448', '460451840'], args=['-s', 'LEGACY_GL_EMULATION=1']) + self.btest('gl_matrix_identity.c', expected=['-1882984448', '460451840', '1588195328'], args=['-s', 'LEGACY_GL_EMULATION=1']) def test_cubegeom_pre(self): self.btest('cubegeom_pre.c', reference='cubegeom_pre.png', args=['-s', 'LEGACY_GL_EMULATION=1']) diff --git a/tests/test_core.py b/tests/test_core.py index cc887f19..c4bfcfa3 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -352,8 +352,6 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co ''' self.do_run(src, '*4903566027370624, 153236438355333*') - if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp') - code = open(os.path.join(self.get_dir(), 'src.cpp.o.js')).read() assert 'goog.math.Long' not in code, 'i64 precise math should not have been included if not actually used' @@ -462,8 +460,6 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co self.do_run_from_file(src, output) def test_float32_precise(self): - if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp') - Settings.PRECISE_F32 = 1 test_path = path_from_root('tests', 'core', 'test_float32_precise') @@ -1142,7 +1138,7 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co self.do_run_from_file(src, output) def test_longjmp_repeat(self): - Settings.MAX_SETJMPS = 1 + if os.environ.get('EMCC_FAST_COMPILER') != '1': Settings.MAX_SETJMPS = 1 # todo: do this more strict thing in fastcomp too test_path = path_from_root('tests', 'core', 'test_longjmp_repeat') src, output = (test_path + s for s in ('.in', '.out')) self.do_run_from_file(src, output) @@ -1925,6 +1921,13 @@ def process(filename): self.emcc_args += ['--closure', '1'] # Use closure here for some additional coverage self.do_run(open(path_from_root('tests', 'emscripten_get_now.cpp')).read(), 'Timer resolution is good.') + def test_emscripten_get_compiler_setting(self): + test_path = path_from_root('tests', 'core', 'emscripten_get_compiler_setting') + src, output = (test_path + s for s in ('.c', '.out')) + self.do_run(open(src).read(), 'You must build with -s RETAIN_COMPILER_SETTINGS=1') + Settings.RETAIN_COMPILER_SETTINGS = 1 + self.do_run(open(src).read(), open(output).read().replace('waka', EMSCRIPTEN_VERSION)) + def test_inlinejs(self): if not self.is_le32(): return self.skip('le32 needed for inline js') if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('fastcomp only supports EM_ASM') @@ -1954,8 +1957,7 @@ def process(filename): self.do_run_from_file(src, output) def test_memorygrowth(self): - if Settings.USE_TYPED_ARRAYS == 0: return self.skip('memory growth is only supported with typed arrays') - if Settings.ASM_JS: return self.skip('asm does not support memory growth yet') + if Settings.USE_TYPED_ARRAYS != 2: return self.skip('memory growth is only supported with typed arrays mode 2') # With typed arrays in particular, it is dangerous to use more memory than TOTAL_MEMORY, # since we then need to enlarge the heap(s). @@ -2078,8 +2080,6 @@ def process(filename): ''', args=['34962', '26214', '35040']) def test_indirectbr(self): - if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp') - Building.COMPILER_TEST_OPTS = filter(lambda x: x != '-g', Building.COMPILER_TEST_OPTS) test_path = path_from_root('tests', 'core', 'test_indirectbr') @@ -2088,8 +2088,6 @@ def process(filename): self.do_run_from_file(src, output) def test_indirectbr_many(self): - if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp') - if Settings.USE_TYPED_ARRAYS != 2: return self.skip('blockaddr > 255 requires ta2') test_path = path_from_root('tests', 'core', 'test_indirectbr_many') @@ -2337,6 +2335,7 @@ The current type of b is: 9 src = ''' #include <stdio.h> #include <stdlib.h> + #include <ctype.h> #include <sys/time.h> void clean() @@ -2381,11 +2380,13 @@ The current type of b is: 9 printf("*malloc(0)!=0:%d*\\n", malloc(0) != 0); // We should not fail horribly + printf("tolower_l: %c\\n", tolower_l('A', 0)); + return 0; } ''' - self.do_run(src, '*1,2,3,5,5,6*\n*stdin==0:0*\n*%*\n*5*\n*66.0*\n*10*\n*0*\n*-10*\n*18*\n*10*\n*0*\n*4294967286*\n*malloc(0)!=0:1*\n*cleaned*') + self.do_run(src, '*1,2,3,5,5,6*\n*stdin==0:0*\n*%*\n*5*\n*66.0*\n*10*\n*0*\n*-10*\n*18*\n*10*\n*0*\n*4294967286*\n*malloc(0)!=0:1*\ntolower_l: a\n*cleaned*') src = r''' #include <stdio.h> @@ -3945,9 +3946,9 @@ def process(filename): post = ''' def process(filename): src = \'\'\' - var data = [10, 20, 40, 30]; var Module = { - stdin: function() { return data.pop() || null }, + data: [10, 20, 40, 30], + stdin: function() { return Module.data.pop() || null }, stdout: function(x) { Module.print('got: ' + x) } }; \'\'\' + open(filename, 'r').read() @@ -5128,8 +5129,7 @@ def process(filename): 'structparam', 'extendedprecision', 'issue_39', 'emptystruct', 'phinonexist', 'quotedlabel', 'oob_ta2', 'phientryimplicit', 'phiself', 'invokebitcast', 'funcptr', # invalid ir 'structphiparam', 'callwithstructural_ta2', 'callwithstructural64_ta2', 'structinparam', # pnacl limitations in ExpandStructRegs '2xi40', # pnacl limitations in ExpandGetElementPtr - 'legalizer_ta2', # pnacl limitation in not legalizing i104, i96, etc. - 'indirectbrphi', 'ptrtoint_blockaddr', 'quoted', # current fastcomp limitations FIXME + 'quoted', # current fastcomp limitations FIXME 'sillyfuncast2', 'sillybitcast', 'atomicrmw_unaligned' # TODO XXX ]: continue if '_ta2' in shortname and not Settings.USE_TYPED_ARRAYS == 2: @@ -5141,6 +5141,9 @@ def process(filename): if '_le32' in shortname and not self.is_le32(): print self.skip('case "%s" not relevant for non-le32 target' % shortname) continue + if '_fastcomp' in shortname and not os.environ.get('EMCC_FAST_COMPILER') == '1': + print self.skip('case "%s" not relevant for non-fastcomp' % shortname) + continue self.emcc_args = emcc_args if os.path.exists(shortname + '.emcc'): if not self.emcc_args: continue @@ -5174,13 +5177,14 @@ def process(filename): def run_all(x): print x - for name in glob.glob(path_from_root('tests', 'fuzz', '*.c')): + for name in glob.glob(path_from_root('tests', 'fuzz', '*.c')) + glob.glob(path_from_root('tests', 'fuzz', '*.cpp')): #if os.path.basename(name) != '4.c': continue - if os.environ.get('EMCC_FAST_COMPILER') == '1' and os.path.basename(name) in ['17.c']: continue # pnacl limitation in not legalizing i104, i96, etc. + if 'newfail' in name: continue + if os.path.basename(name) == '18.cpp' and not os.environ.get('EMCC_FAST_COMPILER') == '1': continue # works only in fastcomp print name self.do_run(open(path_from_root('tests', 'fuzz', name)).read(), - open(path_from_root('tests', 'fuzz', name + '.txt')).read(), force_c=True) + open(path_from_root('tests', 'fuzz', name + '.txt')).read(), force_c=name.endswith('.c')) run_all('normal') @@ -5489,7 +5493,6 @@ def process(filename): def test_add_function(self): if self.emcc_args is None: return self.skip('requires emcc') - if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp') Settings.INVOKE_RUN = 0 Settings.RESERVED_FUNCTION_POINTERS = 1 @@ -5581,7 +5584,6 @@ def process(filename): def test_scriptaclass(self): if self.emcc_args is None: return self.skip('requires emcc') - if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp') Settings.EXPORT_BINDINGS = 1 @@ -6398,6 +6400,10 @@ def process(filename): if os.environ.get('EMCC_FAST_COMPILER') != '1': return self.skip('this test will not pass in the old compiler') self.do_run(open(path_from_root('tests', 'test_minmax.c')).read(), 'NAN != NAN\nSuccess!') + def test_locale(self): + if self.emcc_args is None: return self.skip('needs emcc') + self.do_run_from_file(path_from_root('tests', 'test_locale.c'), path_from_root('tests', 'test_locale.out')) + # Generate tests for everything def make_run(fullname, name=-1, compiler=-1, embetter=0, quantum_size=0, typed_arrays=0, emcc_args=None, env=None): diff --git a/tests/test_locale.c b/tests/test_locale.c new file mode 100644 index 00000000..4aba30db --- /dev/null +++ b/tests/test_locale.c @@ -0,0 +1,24 @@ +#include <locale.h> +#include <stdio.h> + +int main() +{ + // Test basic functions from classic locale. + struct lconv* locale = localeconv(); + + printf("Testing locale information.\n"); + printf("Decimal point: %s\n", locale->decimal_point); + printf("Thousands separator: %s\n", locale->thousands_sep); + printf("Grouping: %s\n", locale->grouping); + printf("International currency symbol: %s\n", locale->int_curr_symbol); + printf("Currency symbol: %s\n", locale->currency_symbol); + printf("Money decimal point: %s\n", locale->mon_decimal_point); + printf("Money thousands separator: %s\n", locale->mon_thousands_sep); + printf("Money Grouping: %s\n", locale->mon_grouping); + printf("Positive sign: %s\n", locale->positive_sign); + printf("Negative sign: %s\n", locale->negative_sign); + + // If no runtime errors, assume the test passed. + printf("Locale tests passed.\n"); + return 0; +} diff --git a/tests/test_locale.out b/tests/test_locale.out new file mode 100644 index 00000000..7e8740fb --- /dev/null +++ b/tests/test_locale.out @@ -0,0 +1,12 @@ +Testing locale information. +Decimal point: . +Thousands separator: +Grouping: +International currency symbol: +Currency symbol: +Money decimal point: +Money thousands separator: +Money Grouping: +Positive sign: +Negative sign: +Locale tests passed. diff --git a/tests/test_other.py b/tests/test_other.py index e5dbb38a..80461972 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -19,7 +19,7 @@ class other(RunnerCore): output = Popen([PYTHON, compiler, '--version'], stdout=PIPE, stderr=PIPE).communicate() output = output[0].replace('\r', '') self.assertContained('''emcc (Emscripten GCC-like replacement)''', output) - self.assertContained('''Copyright (C) 2013 the Emscripten authors (see AUTHORS.txt) + self.assertContained('''Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt) This is free and open source software under the MIT license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ''', output) @@ -521,7 +521,6 @@ f.close() assert 'function _malloc' in src def test_dangerous_func_cast(self): - if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp') src = r''' #include <stdio.h> typedef void (*voidfunc)(); @@ -543,13 +542,23 @@ f.close() self.assertContained(expected, run_js(self.in_dir('a.out.js'), stderr=PIPE, full_output=True)) return open(self.in_dir('a.out.js')).read() - test([], 'my func') # no asm, so casting func works - test(['-O2'], 'abort', ['Casting potentially incompatible function pointer i32 ()* to void (...)*, for my_func', - 'Incompatible function pointer casts are very dangerous with ASM_JS=1, you should investigate and correct these']) # asm, so failure - test(['-O2', '-s', 'ASSERTIONS=1'], - 'Invalid function pointer called. Perhaps a miscast function pointer (check compilation warnings) or bad vtable lookup (maybe due to derefing a bad pointer, like NULL)?', - ['Casting potentially incompatible function pointer i32 ()* to void (...)*, for my_func', - 'Incompatible function pointer casts are very dangerous with ASM_JS=1, you should investigate and correct these']) # asm, so failure + if os.environ.get('EMCC_FAST_COMPILER') != '1': + test([], 'my func') # no asm, so casting func works + test(['-O2'], 'abort', ['Casting potentially incompatible function pointer i32 ()* to void (...)*, for my_func', + 'Incompatible function pointer casts are very dangerous with ASM_JS=1, you should investigate and correct these']) # asm, so failure + test(['-O2', '-s', 'ASSERTIONS=1'], + 'Invalid function pointer called. Perhaps a miscast function pointer (check compilation warnings) or bad vtable lookup (maybe due to derefing a bad pointer, like NULL)?', + ['Casting potentially incompatible function pointer i32 ()* to void (...)*, for my_func', + 'Incompatible function pointer casts are very dangerous with ASM_JS=1, you should investigate and correct these']) # asm, so failure + else: + # fastcomp. all asm, so it can't just work with wrong sigs. but, ASSERTIONS=2 gives much better info to debug + test(['-O1'], 'abort') # no useful info + test(['-O1', '-s', 'ASSERTIONS=1'], '''Invalid function pointer called with signature 'v'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an different type, which will fail? +Build with ASSERTIONS=2 for more info. +''') # some useful text + test(['-O1', '-s', 'ASSERTIONS=2'], '''Invalid function pointer '1' called with signature 'v'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an different type, which will fail? +This pointer might make sense in another type signature: i: _my_func +''') # actually useful identity of the bad pointer, with comparisons to what it would be in other types/tables def test_l_link(self): # Linking with -lLIBNAME and -L/DIRNAME should work @@ -1925,8 +1934,6 @@ seeked= file. assert output == invalid def test_link_s(self): - if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo safe heap in fastcomp') - # -s OPT=VALUE can conflict with -s as a linker option. We warn and ignore open(os.path.join(self.get_dir(), 'main.cpp'), 'w').write(r''' extern "C" { diff --git a/tests/test_sanity.py b/tests/test_sanity.py index cc0819a7..894f2192 100644 --- a/tests/test_sanity.py +++ b/tests/test_sanity.py @@ -3,7 +3,7 @@ from runner import RunnerCore, path_from_root from tools.shared import * SANITY_FILE = CONFIG_FILE + '_sanity' -commands = [[EMCC], [PYTHON, path_from_root('tests', 'runner.py'), 'blahblah']] +commands = [[PYTHON, EMCC], [PYTHON, path_from_root('tests', 'runner.py'), 'blahblah']] def restore(): shutil.copyfile(CONFIG_FILE + '_backup', CONFIG_FILE) @@ -51,7 +51,7 @@ class sanity(RunnerCore): if type(command) is not list: command = [command] if expected is None: - if command[0] == EMCC: + if command[0] == EMCC or (len(command) >= 2 and command[1] == EMCC): expected = 'no input files' else: expected = "No tests found for ['blahblah']" @@ -421,12 +421,12 @@ fi restore() def ensure_cache(): - self.do([EMCC, '-O2', path_from_root('tests', 'hello_world.c')]) + self.do([PYTHON, EMCC, '-O2', path_from_root('tests', 'hello_world.c')]) # Manual cache clearing ensure_cache() assert os.path.exists(EMCC_CACHE) - output = self.do([EMCC, '--clear-cache']) + output = self.do([PYTHON, EMCC, '--clear-cache']) assert ERASING_MESSAGE in output assert not os.path.exists(EMCC_CACHE) @@ -436,7 +436,7 @@ fi try: os.environ['LLVM'] = 'waka' assert os.path.exists(EMCC_CACHE) - output = self.do([EMCC]) + output = self.do([PYTHON, EMCC]) assert ERASING_MESSAGE in output assert not os.path.exists(EMCC_CACHE) finally: @@ -594,7 +594,7 @@ fi temp_dir = tempfile.mkdtemp(prefix='emscripten_temp_') os.chdir(temp_dir) - self.do([EMCC, '-O2', '--em-config', custom_config_filename, path_from_root('tests', 'hello_world.c')]) + self.do([PYTHON, EMCC, '-O2', '--em-config', custom_config_filename, path_from_root('tests', 'hello_world.c')]) result = run_js('a.out.js') # Clean up created temp files. diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js index c8766bc6..fc195e03 100644 --- a/tools/js-optimizer.js +++ b/tools/js-optimizer.js @@ -216,16 +216,6 @@ function traverse(node, pre, post, stack) { } // Only walk through the generated functions -function traverseGenerated(ast, pre, post, stack) { - assert(generatedFunctions); - traverse(ast, function(node) { - if (node[0] === 'defun') { - traverse(node, pre, post, stack); - return null; - } - }); -} - function traverseGeneratedFunctions(ast, callback) { assert(generatedFunctions); if (ast[0] === 'toplevel') { @@ -239,6 +229,12 @@ function traverseGeneratedFunctions(ast, callback) { } } +function traverseGenerated(ast, pre, post, stack) { + traverseGeneratedFunctions(ast, function(func) { + traverse(func, pre, post, stack); + }); +} + // Walk the ast in a simple way, with an understanding of which JS variables are defined) function traverseWithVariables(ast, callback) { traverse(ast, function(node, type, stack) { @@ -1562,6 +1558,7 @@ function unVarify(vars, ret) { // transform var x=1, y=2 etc. into (x=1, y=2), i var ASM_INT = 0; var ASM_DOUBLE = 1; var ASM_FLOAT = 2; +var ASM_NONE = 3; function detectAsmCoercion(node, asmInfo) { // for params, +x vs x|0, for vars, 0.0 vs 0 @@ -1569,6 +1566,7 @@ function detectAsmCoercion(node, asmInfo) { if (node[0] === 'unary-prefix') return ASM_DOUBLE; if (node[0] === 'call' && node[1][0] === 'name' && node[1][1] === 'Math_fround') return ASM_FLOAT; if (asmInfo && node[0] == 'name') return getAsmType(node[1], asmInfo); + if (node[0] === 'name') return ASM_NONE; return ASM_INT; } @@ -1577,7 +1575,8 @@ function makeAsmCoercion(node, type) { case ASM_INT: return ['binary', '|', node, ['num', 0]]; case ASM_DOUBLE: return ['unary-prefix', '+', node]; case ASM_FLOAT: return ['call', ['name', 'Math_fround'], [node]]; - default: throw 'wha? ' + JSON.stringify([node, type]) + new Error().stack; + case ASM_NONE: return node; // non-validating code, emit nothing + default: throw 'whaa?'; } } @@ -1974,7 +1973,7 @@ function registerize(ast) { // we just use a fresh register to make sure we avoid this, but it could be // optimized to check for safe registers (free, and not used in this loop level). var varRegs = {}; // maps variables to the register they will use all their life - var freeRegsClasses = asm ? [[], [], []] : []; // two classes for asm, one otherwise XXX - hardcoded length + var freeRegsClasses = asm ? [[], [], [], []] : []; // two classes for asm, one otherwise XXX - hardcoded length var nextReg = 1; var fullNames = {}; var loopRegs = {}; // for each loop nesting level, the list of bound variables @@ -2130,8 +2129,8 @@ function registerizeHarder(ast) { // Utilities for allocating register variables. // We need distinct register pools for each type of variable. - var allRegsByType = [{}, {}, {}]; - var regPrefixByType = ['i', 'd', 'f']; + var allRegsByType = [{}, {}, {}, {}]; + var regPrefixByType = ['i', 'd', 'f', 'n']; var nextReg = 1; function createReg(forName) { diff --git a/tools/make_minigzip.py b/tools/make_minigzip.py index 0c96457b..cc097a6e 100644 --- a/tools/make_minigzip.py +++ b/tools/make_minigzip.py @@ -9,5 +9,5 @@ zlib = shared.Building.build_library('zlib', shared.EMSCRIPTEN_TEMP_DIR, shared. print 'Building minigzip' -Popen(['python2', shared.EMCC, '-O2', shared.path_from_root('tests', 'zlib', 'minigzip.c'), zlib, '-o', shared.path_from_root('tools', 'minigzip.js')]).communicate() +Popen([shared.PYTHON, shared.EMCC, '-O2', shared.path_from_root('tests', 'zlib', 'minigzip.c'), zlib, '-o', shared.path_from_root('tools', 'minigzip.js')]).communicate() diff --git a/tools/shared.py b/tools/shared.py index a675501f..c4b01518 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -345,7 +345,7 @@ def find_temp_directory(): # we re-check sanity when the settings are changed) # We also re-check sanity and clear the cache when the version changes -EMSCRIPTEN_VERSION = '1.10.4' +EMSCRIPTEN_VERSION = '1.12.0' def generate_sanity(): return EMSCRIPTEN_VERSION + '|' + get_llvm_target() + '|' + LLVM_ROOT + '|' + get_clang_version() |