summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rwxr-xr-xemcc42
-rwxr-xr-xemrun1083
-rw-r--r--emrun.bat2
-rwxr-xr-xemscripten.py71
-rw-r--r--src/analyzer.js3
-rw-r--r--src/emrun_postjs.js20
-rw-r--r--src/emrun_prejs.js5
-rw-r--r--src/emscripten-source-map.min.js31
-rw-r--r--src/jsifier.js2
-rw-r--r--src/library.js187
-rw-r--r--src/library_egl.js20
-rw-r--r--src/library_fs.js2
-rw-r--r--src/library_glfw.js8
-rw-r--r--src/library_sdl.js5
-rw-r--r--src/modules.js24
-rw-r--r--src/preamble.js4
-rw-r--r--system/include/emscripten/emscripten.h64
-rw-r--r--tests/cases/caall.ll12
-rw-r--r--tests/cases/emptyalloca.ll31
-rw-r--r--tests/cases/i24_mem_ta2.ll10
-rw-r--r--tests/cases/i64toi8star.ll6
-rw-r--r--tests/cases/inttoptr.ll8
-rw-r--r--tests/cases/invokebitcast.ll7
-rw-r--r--tests/cases/phicubed.ll2
-rw-r--r--tests/cases/phientryimplicit.ll36
-rw-r--r--tests/cases/phiself.ll4
-rw-r--r--tests/cases/ptrtoi64.ll14
-rw-r--r--tests/cases/sillybitcast.ll4
-rw-r--r--tests/cases/sillybitcast2.ll35
-rw-r--r--tests/cases/unaligneddouble.ll2
-rw-r--r--tests/core/test_addr_of_stacked.in22
-rw-r--r--tests/core/test_alloca.in18
-rw-r--r--tests/core/test_alloca_stack.in31
-rw-r--r--tests/core/test_array2.in24
-rw-r--r--tests/core/test_array2b.in24
-rw-r--r--tests/core/test_assert.in16
-rw-r--r--tests/core/test_atexit.in24
-rw-r--r--tests/core/test_atoX.in80
-rw-r--r--tests/core/test_atomic.in38
-rw-r--r--tests/core/test_bigarray.in35
-rw-r--r--tests/core/test_bitfields.in43
-rw-r--r--tests/core/test_bsearch.in92
-rw-r--r--tests/core/test_bswap64.in104
-rw-r--r--tests/core/test_ccall.in37
-rw-r--r--tests/core/test_class.in52
-rw-r--r--tests/core/test_constglobalstructs.in45
-rw-r--r--tests/core/test_conststructs.in37
-rw-r--r--tests/core/test_copyop.in62
-rw-r--r--tests/core/test_corruption_2.in37
-rw-r--r--tests/core/test_corruption_3.in35
-rw-r--r--tests/core/test_cxx03_do_run.in18
-rw-r--r--tests/core/test_demangle_stacks.in37
-rw-r--r--tests/core/test_direct_string_constant_usage.in22
-rw-r--r--tests/core/test_dlfcn_self.in21
-rw-r--r--tests/core/test_dlmalloc_partial_2.in24
-rw-r--r--tests/core/test_double_i64_conversion.in126
-rw-r--r--tests/core/test_dynamic_cast.in23
-rw-r--r--tests/core/test_dynamic_cast_2.in18
-rw-r--r--tests/core/test_dynamic_cast_b.in47
-rw-r--r--tests/core/test_emptyclass.in20
-rw-r--r--tests/core/test_emscripten_api.in28
-rw-r--r--tests/core/test_erf.in22
-rw-r--r--tests/core/test_errar.in32
-rw-r--r--tests/core/test_exception_2.in36
-rw-r--r--tests/core/test_fakestat.in20
-rw-r--r--tests/core/test_fast_math.in1
-rw-r--r--tests/core/test_fcvt.in22
-rw-r--r--tests/core/test_flexarray_struct.in7
-rw-r--r--tests/core/test_float32_precise.in38
-rw-r--r--tests/core/test_floatvars.in44
-rw-r--r--tests/core/test_frexp.in49
-rw-r--r--tests/core/test_funcptr.in56
-rw-r--r--tests/core/test_funcptr_namecollide.in43
-rw-r--r--tests/core/test_funcptrfunc.in23
-rw-r--r--tests/core/test_funcs.in18
-rw-r--r--tests/core/test_functionpointer_libfunc_varargs.in24
-rw-r--r--tests/core/test_fwrite_0.in29
-rw-r--r--tests/core/test_gc.in146
-rw-r--r--tests/core/test_getgep.in29
-rw-r--r--tests/core/test_getloadavg.in26
-rw-r--r--tests/core/test_getopt.in85
-rw-r--r--tests/core/test_getopt_long.in129
-rw-r--r--tests/core/test_globaldoubles.in43
-rw-r--r--tests/core/test_globals.in19
-rw-r--r--tests/core/test_gmtime.in50
-rw-r--r--tests/core/test_hello_world.in13
-rw-r--r--tests/core/test_i16_emcc_intrinsic.in34
-rw-r--r--tests/core/test_i32_mul_precise.in21
-rw-r--r--tests/core/test_i32_mul_semiprecise.in42
-rw-r--r--tests/core/test_i64_7z.in31
-rw-r--r--tests/core/test_i64_b.in36
-rw-r--r--tests/core/test_i64_cmp.in24
-rw-r--r--tests/core/test_i64_cmp2.in50
-rw-r--r--tests/core/test_i64_double.in64
-rw-r--r--tests/core/test_i64_i16.in22
-rw-r--r--tests/core/test_i64_llabs.in14
-rw-r--r--tests/core/test_i64_qdouble.in33
-rw-r--r--tests/core/test_i64_umul.in30
-rw-r--r--tests/core/test_i64_varargs.in55
-rw-r--r--tests/core/test_i64_zextneg.in23
-rw-r--r--tests/core/test_if.in19
-rw-r--r--tests/core/test_if_else.in23
-rw-r--r--tests/core/test_indirectbr.in35
-rw-r--r--tests/core/test_indirectbr_many.in1550
-rw-r--r--tests/core/test_indirectbr_many.out1
-rw-r--r--tests/core/test_inherit.in47
-rw-r--r--tests/core/test_inlinejs.in45
-rw-r--r--tests/core/test_inlinejs2.in32
-rw-r--r--tests/core/test_inlinejs3.in44
-rw-r--r--tests/core/test_intvars.in93
-rw-r--r--tests/core/test_isdigit_l.in12
-rw-r--r--tests/core/test_isnan.in29
-rw-r--r--tests/core/test_istream.in23
-rw-r--r--tests/core/test_iswdigit.in20
-rw-r--r--tests/core/test_libcextra.in17
-rw-r--r--tests/core/test_libgen.in60
-rw-r--r--tests/core/test_linked_list.in73
-rw-r--r--tests/core/test_llrint.in15
-rw-r--r--tests/core/test_llvm_intrinsics.in85
-rw-r--r--tests/core/test_llvm_used.in23
-rw-r--r--tests/core/test_llvmswitch.in43
-rw-r--r--tests/core/test_longjmp.in57
-rw-r--r--tests/core/test_longjmp2.in72
-rw-r--r--tests/core/test_longjmp3.in82
-rw-r--r--tests/core/test_longjmp4.in64
-rw-r--r--tests/core/test_longjmp_exc.in46
-rw-r--r--tests/core/test_longjmp_funcptr.in49
-rw-r--r--tests/core/test_longjmp_repeat.in24
-rw-r--r--tests/core/test_longjmp_stacked.in80
-rw-r--r--tests/core/test_loop.in31
-rw-r--r--tests/core/test_mainenv.in13
-rw-r--r--tests/core/test_math.in68
-rw-r--r--tests/core/test_mathfuncptr.in22
-rw-r--r--tests/core/test_memcpy2.in40
-rw-r--r--tests/core/test_memcpy_memcmp.in82
-rw-r--r--tests/core/test_memmove.in18
-rw-r--r--tests/core/test_memmove2.in44
-rw-r--r--tests/core/test_memmove3.in18
-rw-r--r--tests/core/test_mmap.in74
-rw-r--r--tests/core/test_mod_globalstruct.in29
-rw-r--r--tests/core/test_multiexception.in62
-rw-r--r--tests/core/test_negative_zero.in55
-rw-r--r--tests/core/test_perrar.in21
-rw-r--r--tests/core/test_phiundef.in31
-rw-r--r--tests/core/test_poll.in52
-rw-r--r--tests/core/test_polymorph.in59
-rw-r--r--tests/core/test_printf_2.in26
-rw-r--r--tests/core/test_printf_more.in24
-rw-r--r--tests/core/test_ptrtoint.in28
-rw-r--r--tests/core/test_regex.in67
-rw-r--r--tests/core/test_reinterpreted_ptrs.in27
-rw-r--r--tests/core/test_rounding.in45
-rw-r--r--tests/core/test_simd.in68
-rw-r--r--tests/core/test_simd2.in72
-rw-r--r--tests/core/test_simd3.in959
-rw-r--r--tests/core/test_sintvars.in45
-rw-r--r--tests/core/test_sizeof.in49
-rw-r--r--tests/core/test_sscanf.in179
-rw-r--r--tests/core/test_sscanf_3.in26
-rw-r--r--tests/core/test_sscanf_4.in17
-rw-r--r--tests/core/test_sscanf_5.in28
-rw-r--r--tests/core/test_sscanf_6.in29
-rw-r--r--tests/core/test_sscanf_caps.in16
-rw-r--r--tests/core/test_sscanf_float.in17
-rw-r--r--tests/core/test_sscanf_hex.in14
-rw-r--r--tests/core/test_sscanf_n.in38
-rw-r--r--tests/core/test_sscanf_other_whitespace.in44
-rw-r--r--tests/core/test_sscanf_skip.in25
-rw-r--r--tests/core/test_sscanf_whitespace.in31
-rw-r--r--tests/core/test_stack.in35
-rw-r--r--tests/core/test_stack_byval.in44
-rw-r--r--tests/core/test_stack_varargs.in28
-rw-r--r--tests/core/test_stack_void.in48
-rw-r--r--tests/core/test_static_variable.in34
-rw-r--r--tests/core/test_statics.in64
-rw-r--r--tests/core/test_statvfs.in42
-rw-r--r--tests/core/test_std_cout_new.in39
-rw-r--r--tests/core/test_std_exception.in26
-rw-r--r--tests/core/test_stdvec.in44
-rw-r--r--tests/core/test_strcasecmp.in146
-rw-r--r--tests/core/test_strcmp_uni.in25
-rw-r--r--tests/core/test_strftime.in281
-rw-r--r--tests/core/test_strings.in107
-rw-r--r--tests/core/test_strndup.in59
-rw-r--r--tests/core/test_strptime_days.in58
-rw-r--r--tests/core/test_strptime_reentrant.in92
-rw-r--r--tests/core/test_strptime_tm.in44
-rw-r--r--tests/core/test_strstr.in63
-rw-r--r--tests/core/test_strtok.in34
-rw-r--r--tests/core/test_strtol_bin.in26
-rw-r--r--tests/core/test_strtol_dec.in35
-rw-r--r--tests/core/test_strtol_hex.in35
-rw-r--r--tests/core/test_strtol_oct.in35
-rw-r--r--tests/core/test_strtoll_bin.in26
-rw-r--r--tests/core/test_strtoll_dec.in35
-rw-r--r--tests/core/test_strtoll_hex.in35
-rw-r--r--tests/core/test_strtoll_oct.in35
-rw-r--r--tests/core/test_structs.in43
-rw-r--r--tests/core/test_time_c.in14
-rw-r--r--tests/core/test_timeb.in26
-rw-r--r--tests/core/test_tinyfuncstr.in20
-rw-r--r--tests/core/test_transtrcase.in24
-rw-r--r--tests/core/test_trickystring.in34
-rw-r--r--tests/core/test_typeid.in105
-rw-r--r--tests/core/test_uname.in28
-rw-r--r--tests/core/test_utf.in26
-rw-r--r--tests/core/test_varargs.in213
-rw-r--r--tests/core/test_vprintf.in28
-rw-r--r--tests/core/test_vsnprintf.in75
-rw-r--r--tests/core/test_white_list_exception.in37
-rw-r--r--tests/core/test_zero_multiplication.in24
-rw-r--r--tests/core/test_zerodiv.in33
-rw-r--r--tests/emscripten_log/emscripten_log.cpp136
-rw-r--r--tests/fuzz/13.c107
-rw-r--r--tests/fuzz/13.c.txt1
-rw-r--r--tests/fuzz/14.c2435
-rw-r--r--tests/fuzz/14.c.txt1
-rw-r--r--tests/fuzz/16.c1317
-rw-r--r--tests/fuzz/16.c.txt1
-rwxr-xr-xtests/fuzz/csmith_driver.py2
-rwxr-xr-xtests/fuzz/test.sh23
-rw-r--r--tests/hello_image_sdl.c43
-rw-r--r--tests/hello_world_exit.c15
-rwxr-xr-xtests/runner.py5
-rw-r--r--tests/test_benchmark.py263
-rw-r--r--tests/test_browser.py36
-rw-r--r--tests/test_core.py88
-rw-r--r--tests/test_egl.c11
-rw-r--r--tests/test_other.py7
-rw-r--r--tests/test_sanity.py28
-rw-r--r--tools/js-optimizer.js24
-rw-r--r--tools/shared.py27
-rw-r--r--tools/test-js-optimizer-asm-pre-output.js8
-rw-r--r--tools/test-js-optimizer-asm-pre.js4
235 files changed, 10344 insertions, 6367 deletions
diff --git a/AUTHORS b/AUTHORS
index 413b9de1..d71eea47 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -112,3 +112,4 @@ a license to everyone to use it as detailed in LICENSE.)
* Lu Wang <coolwanglu@gmail.com>
* Heidi Pan <heidi.pan@intel.com> (copyright owned by Intel)
* Vasilis Kalintiris <ehostunreach@gmail.com>
+* Adam C. Clifton <adam@hulkamaniac.com>
diff --git a/emcc b/emcc
index ba67f082..3cd049d8 100755
--- a/emcc
+++ b/emcc
@@ -503,6 +503,17 @@ Options that are modified or new in %s include:
--proxy-to-worker Generates both html and js files. The main
program is in js, and the html proxies to/from it.
+ --emrun Enables the generated output to be aware of the
+ emrun command line tool. This allows stdout, stderr
+ and exit(returncode) capture when running the
+ generated application through emrun.
+
+ --em-config Specifies the location of the .emscripten configuration
+ file for the current compiler run. If not specified,
+ the environment variable EM_CONFIG is read for this
+ file, and if that is not set, the default location
+ ~/.emscripten is assumed.
+
The target file, if specified (-o <target>), defines what will
be generated:
@@ -779,6 +790,7 @@ try:
shell_path = shared.path_from_root('src', 'shell.html')
js_libraries = []
bind = False
+ emrun = False
jcache = False
save_bc = False
memory_init_file = False
@@ -973,12 +985,24 @@ try:
if not absolute_warning_shown and os.path.isabs(path_name):
logging.warning ('-I or -L of an absolute path "' + newargs[i] + '" encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript). Pass \'-Wno-warn-absolute-paths\' to emcc to hide this warning.') # Of course an absolute path to a non-system-specific library or header is fine, and you can ignore this warning. The danger are system headers that are e.g. x86 specific and nonportable. The emscripten bundled headers are modified to be portable, local system ones are generally not
absolute_warning_shown = True
+ elif newargs[i] == '--emrun':
+ emrun = True
+ newargs[i] = ''
+ elif newargs[i] == '--em-config':
+ # This option is parsed in tools/shared.py, here only clean it up from being passed to clang.
+ newargs[i] = ''
+ newargs[i+1] = ''
+
newargs = [ arg for arg in newargs if arg is not '' ]
# If user did not specify a default -std for C++ code, specify the emscripten default.
if default_cxx_std:
newargs = newargs + [default_cxx_std]
+ if emrun:
+ pre_js += open(shared.path_from_root('src', 'emrun_prejs.js')).read() + '\n'
+ post_js += open(shared.path_from_root('src', 'emrun_postjs.js')).read() + '\n'
+
if js_opts is None: js_opts = opt_level >= 2
if llvm_opts is None: llvm_opts = LLVM_OPT_LEVEL[opt_level]
if llvm_lto is None and opt_level >= 3: llvm_lto = 3
@@ -1138,8 +1162,11 @@ try:
logging.warning('disabling asm.js since embind is not ready for it yet')
shared.Settings.ASM_JS = 0
+ if os.environ.get('EMCC_FAST_COMPILER'):
+ shared.Settings.ASM_JS = 1
+
if shared.Settings.ASM_JS:
- assert opt_level >= 1, 'asm.js requires -O1 or above'
+ assert opt_level >= 1 or os.environ.get('EMCC_FAST_COMPILER'), 'asm.js requires -O1 or above'
if bind:
shared.Settings.RESERVED_FUNCTION_POINTERS = max(shared.Settings.RESERVED_FUNCTION_POINTERS, 10)
@@ -1666,7 +1693,12 @@ try:
else:
# At minimum remove dead functions etc., this potentially saves a lot in the size of the generated code (and the time to compile it)
link_opts += shared.Building.get_safe_internalize() + ['-globaldce']
- if not save_bc:
+
+ # Simplify LLVM bitcode for fastcomp
+ if os.environ.get('EMCC_FAST_COMPILER') and not AUTODEBUG:
+ link_opts += ['-pnacl-abi-simplify-preopt', '-pnacl-abi-simplify-postopt']
+
+ if (not save_bc and not os.environ.get('EMCC_FAST_COMPILER')) or AUTODEBUG:
# let llvm opt directly emit ll, to skip writing and reading all the bitcode
link_opts += ['-S']
shared.Building.llvm_opt(final, link_opts, final + '.link.ll')
@@ -1693,6 +1725,12 @@ try:
final += '.ad.ll'
if DEBUG: save_intermediate('autodebug', 'll')
+ # Simplify bitcode after autodebug
+ if os.environ.get('EMCC_FAST_COMPILER') and AUTODEBUG:
+ shared.Building.llvm_opt(final, ['-pnacl-abi-simplify-preopt', '-pnacl-abi-simplify-postopt'], final + '.adsimp.bc')
+ final += '.adsimp.bc'
+ if DEBUG: save_intermediate('adsimp', 'bc')
+
# Emscripten
logging.debug('LLVM => JS')
extra_args = [] if not js_libraries else ['--libraries', ','.join(map(os.path.abspath, js_libraries))]
diff --git a/emrun b/emrun
new file mode 100755
index 00000000..d5975b8a
--- /dev/null
+++ b/emrun
@@ -0,0 +1,1083 @@
+#!/usr/bin/env python
+
+# emrun: Implements machinery that allows running a .html page as if it was a standard executable file.
+# Usage: emrun <options> filename.html <args to program>
+# See emrun --help for more information
+
+import os, platform, optparse, logging, re, pprint, atexit, urlparse, subprocess, sys, SocketServer, BaseHTTPServer, SimpleHTTPServer, time, string, struct, socket, cgi
+from operator import itemgetter
+from urllib import unquote
+from Queue import PriorityQueue
+from threading import Thread, RLock
+
+# Populated from cmdline params
+emrun_options = None
+
+# Represents the process object handle to the browser we opened to run the html page.
+browser_process = None
+
+# If we have routed browser output to file with --log_stdout and/or --log_stderr,
+# these track the handles.
+browser_stdout_handle = sys.stdout
+browser_stderr_handle = sys.stderr
+
+# This flag tracks whether the html page has sent any stdout messages back to us.
+# Used to detect whether we might have gotten detached from the browser process we
+# spawned, in which case we are not able to detect when user closes the browser with
+# the close button.
+have_received_messages = False
+
+# At startup print a warning message once if user did not build with --emrun.
+emrun_not_enabled_nag_printed = False
+
+# Stores the exit() code of the html page when/if it quits.
+page_exit_code = 0
+
+# If this is set to a non-empty string, all processes by this name will be killed at exit.
+# This is used to clean up after browsers that spawn subprocesses to handle the actual
+# browser launch. For example opera has a launcher.exe that runs the actual opera browser.
+# So killing browser_process would just kill launcher.exe and not the opera browser itself.
+processname_killed_atexit = ""
+
+# If user does not specify a --port parameter, this port is used to launch the server.
+default_webserver_port = 6931
+
+# Location of Android Debug Bridge executable
+ADB = ''
+
+# Host OS detection to autolocate browsers and other OS-specific support needs.
+WINDOWS = False
+LINUX = False
+OSX = False
+if os.name == 'nt':
+ WINDOWS = True
+
+ import win32api, _winreg
+ from win32com.client import GetObject
+ from win32api import GetFileVersionInfo, LOWORD, HIWORD
+ import shlex
+ from _winreg import HKEY_CURRENT_USER, OpenKey, QueryValue
+
+elif platform.system() == 'Linux':
+ LINUX = True
+elif platform.mac_ver()[0] != '':
+ OSX = True
+
+ import plistlib
+
+# If you are running on an OS that is not any of these, must add explicit support for it.
+if not WINDOWS and not LINUX and not OSX:
+ raise Exception("Unknown OS!")
+
+# Absolute wallclock time in seconds specifying when the previous HTTP stdout message from
+# the page was received.
+last_message_time = time.clock()
+
+# Absolute wallclock time in seconds telling when we launched emrun.
+page_start_time = time.clock()
+
+# Stores the time of most recent http page serve.
+page_last_served_time = None
+
+# Returns given log message formatted to be outputted on a HTML page.
+def format_html(msg):
+ if not msg.endswith('\n'):
+ msg += '\n'
+ msg = cgi.escape(msg)
+ msg = msg.replace('\r\n', '<br />').replace('\n', '<br />')
+ return msg
+
+# HTTP requests are handled from separate threads - synchronize them to avoid race conditions
+http_mutex = RLock()
+
+# Prints a log message to 'info' stdout channel. Always printed.
+def logi(msg):
+ global last_message_time
+ with http_mutex:
+ if emrun_options.log_html:
+ sys.stdout.write(format_html(msg))
+ else:
+ print >> sys.stdout, msg
+ sys.stdout.flush()
+ last_message_time = time.clock()
+
+# Prints a verbose log message to stdout channel. Only shown if run with --verbose.
+def logv(msg):
+ global emrun_options, last_message_time
+ with http_mutex:
+ if emrun_options.verbose:
+ if emrun_options.log_html:
+ sys.stdout.write(format_html(msg))
+ else:
+ print >> sys.stdout, msg
+ sys.stdout.flush()
+ last_message_time = time.clock()
+
+# Prints an error message to stderr channel.
+def loge(msg):
+ global last_message_time
+ with http_mutex:
+ if emrun_options.log_html:
+ sys.stderr.write(format_html(msg))
+ else:
+ print >> sys.stderr, msg
+ sys.stderr.flush()
+ last_message_time = time.clock()
+
+def format_eol(msg):
+ if WINDOWS:
+ msg = msg.replace('\r\n', '\n').replace('\n', '\r\n')
+ return msg
+
+# Prints a message to the browser stdout output stream.
+def browser_logi(msg):
+ global browser_stdout_handle
+ msg = format_eol(msg)
+ print >> browser_stdout_handle, msg
+ browser_stdout_handle.flush()
+ last_message_time = time.clock()
+
+# Prints a message to the browser stderr output stream.
+def browser_loge(msg):
+ global browser_stderr_handle
+ msg = format_eol(msg)
+ print >> browser_stderr_handle, msg
+ browser_stderr_handle.flush()
+ last_message_time = time.clock()
+
+# Unquotes a unicode string. (translates ascii-encoded utf string back to utf)
+def unquote_u(source):
+ result = unquote(source)
+ if '%u' in result:
+ result = result.replace('%u','\\u').decode('unicode_escape')
+ return result
+
+# Returns whether the browser page we spawned is still running.
+# (note, not perfect atm, in case we are running in detached mode)
+def is_browser_process_alive():
+ return browser_process and browser_process.poll() == None
+
+# Kills browser_process and processname_killed_atexit.
+def kill_browser_process():
+ global browser_process, processname_killed_atexit, emrun_options, ADB
+ if browser_process:
+ try:
+ logv('Terminating browser process..')
+ browser_process.kill()
+ except:
+ pass
+ browser_process = None
+ if len(processname_killed_atexit) > 0:
+ if emrun_options.android:
+ logv("Terminating Android app '" + processname_killed_atexit + "'.")
+ subprocess.call([ADB, 'shell', 'am', 'force-stop', processname_killed_atexit])
+ else:
+ logv("Terminating all processes that have string '" + processname_killed_atexit + "' in their name.")
+ if WINDOWS:
+ process_image = processname_killed_atexit if '.exe' in processname_killed_atexit else (processname_killed_atexit + '.exe')
+ process = subprocess.Popen(['taskkill', '/F', '/IM', process_image, '/T'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ process.communicate()
+ else:
+ try:
+ subprocess.call(['pkill', processname_killed_atexit])
+ except OSError, e:
+ try:
+ subprocess.call(['killall', processname_killed_atexit])
+ except OSError, e:
+ loge('Both commands pkill and killall failed to clean up the spawned browser process. Perhaps neither of these utilities is available on your system?')
+ # Clear the process name to represent that the browser is now dead.
+ processname_killed_atexit = ''
+
+# Our custom HTTP web server that will server the target page to run via .html.
+# This is used so that we can load the page via a http:// URL instead of a file:// URL, since those wouldn't work too well unless user allowed XHR without CORS rules.
+# Also, the target page will route its stdout and stderr back to here via HTTP requests.
+class HTTPWebServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):
+ # Log messaging arriving via HTTP can come in out of sequence. Implement a sequencing mechanism to enforce ordered transmission.
+ expected_http_seq_num = -1
+ # Stores messages that have arrived out of order, pending for a send as soon as the missing message arrives.
+ # Kept in sorted order, first element is the oldest message received.
+ http_message_queue = []
+
+ def handle_incoming_message(self, seq_num, log, data):
+ global have_received_messages
+ with http_mutex:
+ have_received_messages = True
+
+ if self.expected_http_seq_num == -1:
+ self.expected_http_seq_num = seq_num+1
+ log(data)
+ elif seq_num == -1: # Message arrived without a sequence number? Just log immediately
+ log(data)
+ elif seq_num == self.expected_http_seq_num:
+ log(data)
+ self.expected_http_seq_num += 1
+ self.print_messages_due()
+ elif seq_num < self.expected_http_seq_num:
+ log(data)
+ else:
+ self.http_message_queue += [(seq_num, data, log)]
+ self.http_message_queue.sort(key=itemgetter(0))
+ if len(self.http_message_queue) > 16:
+ self.print_next_message()
+
+ # If it's been too long since we we got a message, prints out the oldest queued message, ignoring the proper order.
+ # This ensures that if any messages are actually lost, that the message queue will be orderly flushed.
+ def print_timed_out_messages(self):
+ global last_message_time
+ with http_mutex:
+ now = time.clock()
+ max_message_queue_time = 5
+ if len(self.http_message_queue) > 0 and now - last_message_time > max_message_queue_time:
+ self.print_next_message()
+
+ # Skips to printing the next message in queue now, independent of whether there was missed messages in the sequence numbering.
+ def print_next_message(self):
+ with http_mutex:
+ if len(self.http_message_queue) > 0:
+ self.expected_http_seq_num = self.http_message_queue[0][0]
+ self.print_messages_due()
+
+ # Completely flushes all out-of-order messages in the queue.
+ def print_all_messages(self):
+ with http_mutex:
+ while len(self.http_message_queue) > 0:
+ self.print_next_message()
+
+ # Prints any messages that are now due after we logged some other previous messages.
+ def print_messages_due(self):
+ with http_mutex:
+ while len(self.http_message_queue) > 0:
+ msg = self.http_message_queue[0]
+ if msg[0] == self.expected_http_seq_num:
+ msg[2](msg[1])
+ self.expected_http_seq_num += 1
+ self.http_message_queue.pop(0)
+ else:
+ return
+
+ def serve_forever(self, timeout=0.5):
+ global emrun_options, last_message_time, page_exit_code, have_received_messages, emrun_not_enabled_nag_printed
+ self.is_running = True
+ self.timeout = timeout
+ while self.is_running:
+ now = time.clock()
+ # Did user close browser?
+ if not emrun_options.serve_after_close and browser_process and browser_process.poll() != None:
+ if not have_received_messages:
+ emrun_options.serve_after_close = True
+ logv('Warning: emrun got detached from the target browser process. Cannot detect when user closes the browser. Behaving as if --serve_after_close was passed in.')
+ else:
+ self.shutdown()
+ logv('Browser process has quit. Shutting down web server.. Pass --serve_after_close to keep serving the page even after the browser closes.')
+
+ # Serve HTTP
+ self.handle_request()
+ # Process message log queue
+ self.print_timed_out_messages()
+
+ # If web page was silent for too long without printing anything, kill process.
+ time_since_message = now - last_message_time
+ if emrun_options.silence_timeout != 0 and time_since_message > emrun_options.silence_timeout:
+ self.shutdown()
+ logv('No activity in ' + str(emrun_options.silence_timeout) + ' seconds. Quitting web server with return code ' + str(emrun_options.timeout_returncode) + '. (--silence_timeout option)')
+ page_exit_code = emrun_options.timeout_returncode
+ emrun_options.kill_on_exit = True
+
+ # If the page has been running too long as a whole, kill process.
+ time_since_start = now - page_start_time
+ if emrun_options.timeout != 0 and time_since_start > emrun_options.timeout:
+ self.shutdown()
+ logv('Page has not finished in ' + str(emrun_options.timeout) + ' seconds. Quitting web server with return code ' + str(emrun_options.timeout_returncode) + '. (--timeout option)')
+ emrun_options.kill_on_exit = True
+ page_exit_code = emrun_options.timeout_returncode
+
+ # If we detect that the page is not running with emrun enabled, print a warning message.
+ if not emrun_not_enabled_nag_printed and page_last_served_time is not None:
+ time_since_page_serve = now - page_last_served_time
+ if not have_received_messages and time_since_page_serve > 10:
+ logi('The html page you are running is not emrun-capable. Stdout, stderr and exit(returncode) capture will not work. Recompile the application with the --emrun linker flag to enable this, or pass --no_emrun_detect to emrun to hide this check.')
+ emrun_not_enabled_nag_printed = True
+
+ # Clean up at quit, print any leftover messages in queue.
+ self.print_all_messages()
+
+ def handle_error(self, request, client_address):
+ err = sys.exc_info()[1][0]
+ # Filter out the useless '[Errno 10054] An existing connection was forcibly closed by the remote host' errors that occur when we
+ # forcibly kill the client.
+ if err != 10054:
+ SocketServer.BaseServer.handle_error(self, request, client_address)
+
+ def shutdown(self):
+ self.is_running = False
+ self.print_all_messages()
+ return 1
+
+# Processes HTTP request back to the browser.
+class HTTPHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
+ def send_head(self):
+ global page_last_served_time
+ path = self.translate_path(self.path)
+ f = None
+
+ if os.path.isdir(path):
+ if not self.path.endswith('/'):
+ self.send_response(301)
+ self.send_header("Location", self.path + "/")
+ self.end_headers()
+ return None
+ for index in "index.html", "index.htm":
+ index = os.path.join(path, index)
+ if os.path.isfile(index):
+ path = index
+ break
+ else:
+ # Manually implement directory listing support.
+ return self.list_directory(path)
+ ctype = self.guess_type(path)
+ try:
+ f = open(path, 'rb')
+ except IOError:
+ self.send_error(404, "File not found: " + path)
+ return None
+ self.send_response(200)
+ self.send_header("Content-type", ctype)
+ fs = os.fstat(f.fileno())
+ self.send_header("Content-Length", str(fs[6]))
+ self.send_header("Last-Modified", self.date_time_string(fs.st_mtime))
+ self.send_header('Cache-Control','no-cache, must-revalidate')
+ self.send_header('Expires','-1')
+ self.end_headers()
+ page_last_served_time = time.clock()
+ return f
+
+ def log_request(self, code):
+ # Filter out 200 OK messages to remove noise.
+ if code is not 200:
+ SimpleHTTPServer.SimpleHTTPRequestHandler.log_request(self, code)
+
+ def log_message(self, format, *args):
+ msg = "%s - - [%s] %s\n" % (self.address_string(), self.log_date_time_string(), format%args)
+ if not 'favicon.ico' in msg: # Filter out 404 messages on favicon.ico not being found to remove noise.
+ sys.stderr.write(msg)
+
+ def do_POST(self):
+ global page_exit_code, emrun_options, have_received_messages
+
+ (_, _, path, query, _) = urlparse.urlsplit(self.path)
+ data = self.rfile.read(int(self.headers['Content-Length']))
+ data = data.replace("+", " ")
+ data = unquote_u(data)
+
+ # The user page sent a message with POST. Parse the message and log it to stdout/stderr.
+ is_stdout = False
+ is_stderr = False
+ seq_num = -1
+ # The html shell is expected to send messages of form ^out^(number)^(message) or ^err^(number)^(message).
+ if data.startswith('^err^'):
+ is_stderr = True
+ elif data.startswith('^out^'):
+ is_stdout = True
+ if is_stderr or is_stdout:
+ try:
+ i = data.index('^', 5)
+ seq_num = int(data[5:i])
+ data = data[i+1:]
+ except:
+ pass
+
+ is_exit = data.startswith('^exit^')
+
+ if data == '^pageload^': # Browser is just notifying that it has successfully launched the page.
+ have_received_messages = True
+ elif not is_exit:
+ log = browser_loge if is_stderr else browser_logi
+ self.server.handle_incoming_message(seq_num, log, data)
+ elif not emrun_options.serve_after_exit:
+ page_exit_code = int(data[6:])
+ logv('Web page has quit with a call to exit() with return code ' + str(page_exit_code) + '. Shutting down web server. Pass --serve_after_exit to keep serving even after the page terminates with exit().')
+ self.server.shutdown()
+
+ self.send_response(200)
+ self.send_header("Content-type", "text/plain")
+ self.send_header('Cache-Control','no-cache, must-revalidate')
+ self.send_header('Expires','-1')
+ self.end_headers()
+ self.wfile.write('OK')
+
+# From http://stackoverflow.com/questions/4842448/getting-processor-information-in-python
+# Returns a string with something like "AMD64, Intel(R) Core(TM) i5-2557M CPU @ 1.70GHz, Intel64 Family 6 Model 42 Stepping 7, GenuineIntel"
+def get_cpu_infoline():
+ try:
+ if WINDOWS:
+ root_winmgmts = GetObject("winmgmts:root\cimv2")
+ cpus = root_winmgmts.ExecQuery("Select * from Win32_Processor")
+ cpu_name = cpus[0].Name + ', ' + platform.processor()
+ elif OSX:
+ cpu_name = subprocess.check_output(['sysctl', '-n', 'machdep.cpu.brand_string']).strip()
+ elif LINUX:
+ command = "cat /proc/cpuinfo"
+ all_info = subprocess.check_output(command, shell=True).strip()
+ for line in all_info.split("\n"):
+ if "model name" in line:
+ cpu_name = re.sub( ".*model name.*:", "", line,1).strip()
+ except:
+ return "Unknown"
+
+ return platform.machine() + ', ' + cpu_name
+
+def get_android_cpu_infoline():
+ lines = subprocess.check_output([ADB, 'shell', 'cat', '/proc/cpuinfo']).split('\n')
+ processor = ''
+ hardware = ''
+ for line in lines:
+ if line.startswith('Processor'):
+ processor = line[line.find(':')+1:].strip()
+ elif line.startswith('Hardware'):
+ hardware = line[line.find(':')+1:].strip()
+
+ freq = int(subprocess.check_output([ADB, 'shell', 'cat', '/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq']).strip())/1000
+ return 'CPU: ' + processor + ', ' + hardware + ' @ ' + str(freq) + ' MHz'
+
+def win_print_gpu_info():
+ gpus = []
+ gpu_memory = []
+
+ for i in range(0, 16):
+ try:
+ hHardwareReg = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, "HARDWARE")
+ hDeviceMapReg = _winreg.OpenKey(hHardwareReg, "DEVICEMAP")
+ hVideoReg = _winreg.OpenKey(hDeviceMapReg, "VIDEO")
+ VideoCardString = _winreg.QueryValueEx(hVideoReg,"\Device\Video"+str(i))[0]
+ #Get Rid of Registry/Machine from the string
+ VideoCardStringSplit = VideoCardString.split("\\")
+ ClearnVideoCardString = string.join(VideoCardStringSplit[3:], "\\")
+ #Go up one level for detailed
+ VideoCardStringRoot = string.join(VideoCardStringSplit[3:len(VideoCardStringSplit)-1], "\\")
+
+ #Get the graphics card information
+ hVideoCardReg = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, ClearnVideoCardString)
+ try:
+ VideoCardDescription = _winreg.QueryValueEx(hVideoCardReg, "Device Description")[0]
+ except WindowsError:
+ VideoCardDescription = _winreg.QueryValueEx(hVideoCardReg, "DriverDesc")[0]
+
+ try:
+ driverVersion = _winreg.QueryValueEx(hVideoCardReg, "DriverVersion")[0]
+ VideoCardDescription += ', driver version ' + driverVersion
+ except:
+ pass
+
+ try:
+ driverDate = _winreg.QueryValueEx(hVideoCardReg, "DriverDate")[0]
+ VideoCardDescription += ' (' + driverDate + ')'
+ except:
+ pass
+
+ VideoCardMemorySize = _winreg.QueryValueEx(hVideoCardReg, "HardwareInformation.MemorySize")[0]
+ try:
+ vram = struct.unpack('l',VideoCardMemorySize)[0]
+ except struct.error:
+ vram = int(VideoCardMemorySize)
+ if not VideoCardDescription in gpus:
+ gpus += [VideoCardDescription]
+ gpu_memory += [str(int(vram/1024/1024))]
+ except WindowsError:
+ pass
+
+ if len(gpus) == 1:
+ print "GPU: " + gpus[0] + " with " + gpu_memory[0] + " MB of VRAM"
+ elif len(gpus) > 1:
+ for i in range(0, len(gpus)):
+ print "GPU"+str(i)+ ": " + gpus[i] + " with " + gpu_memory[i] + " MBs of VRAM"
+
+def linux_print_gpu_info():
+ glxinfo = subprocess.check_output('glxinfo')
+ for line in glxinfo.split("\n"):
+ if "OpenGL vendor string:" in line:
+ gl_vendor = line[len("OpenGL vendor string:"):].strip()
+ if "OpenGL version string:" in line:
+ gl_version = line[len("OpenGL version string:"):].strip()
+ if "OpenGL renderer string:" in line:
+ gl_renderer = line[len("OpenGL renderer string:"):].strip()
+ logi('GPU: ' + gl_vendor + ' ' + gl_renderer + ', GL version ' + gl_version)
+
+def osx_print_gpu_info():
+ try:
+ info = subprocess.check_output(['system_profiler', 'SPDisplaysDataType'])
+ gpu = re.search("Chipset Model: (.*)", info)
+ if gpu:
+ chipset = gpu.group(1)
+ vram = re.search("VRAM \(Total\): (.*) MB", info)
+ if vram:
+ logi('GPU: ' + chipset + ' with ' + vram.group(1) + ' MBs of VRAM')
+ else:
+ logi('GPU: ' + chipset)
+ except:
+ pass
+
+def print_gpu_infolines():
+ if WINDOWS:
+ win_print_gpu_info()
+ elif LINUX:
+ linux_print_gpu_info()
+ elif OSX:
+ osx_print_gpu_info()
+
+def get_executable_version(filename):
+ try:
+ if WINDOWS:
+ info = GetFileVersionInfo(filename, "\\")
+ ms = info['FileVersionMS']
+ ls = info['FileVersionLS']
+ version = HIWORD (ms), LOWORD (ms), HIWORD (ls), LOWORD (ls)
+ return '.'.join(map(str, version))
+ elif OSX:
+ plistfile = app_name[0:app_name.find('MacOS')] + 'Info.plist'
+ info = plistlib.readPlist(plistfile)
+ # Data in Info.plists is a bit odd, this check combo gives best information on each browser.
+ if 'firefox' in app_name.lower():
+ return info['CFBundleShortVersionString'] + ' 20' + info['CFBundleVersion'][2:].replace('.', '-')
+ if 'opera' in app_name.lower():
+ return info['CFBundleVersion']
+ else:
+ return info['CFBundleShortVersionString']
+ elif LINUX:
+ if 'firefox' in filename.lower():
+ version = subprocess.check_output([filename, '-v'])
+ version = version.replace('Mozilla Firefox ', '')
+ return version.strip()
+ else:
+ return ""
+ except:
+ return ""
+
+# http://stackoverflow.com/questions/580924/python-windows-file-version-attribute
+def win_get_file_properties(fname):
+ propNames = ('Comments', 'InternalName', 'ProductName',
+ 'CompanyName', 'LegalCopyright', 'ProductVersion',
+ 'FileDescription', 'LegalTrademarks', 'PrivateBuild',
+ 'FileVersion', 'OriginalFilename', 'SpecialBuild')
+
+ props = {'FixedFileInfo': None, 'StringFileInfo': None, 'FileVersion': None}
+
+ try:
+ # backslash as parm returns dictionary of numeric info corresponding to VS_FIXEDFILEINFO struc
+ fixedInfo = win32api.GetFileVersionInfo(fname, '\\')
+ props['FixedFileInfo'] = fixedInfo
+ props['FileVersion'] = "%d.%d.%d.%d" % (fixedInfo['FileVersionMS'] / 65536,
+ fixedInfo['FileVersionMS'] % 65536, fixedInfo['FileVersionLS'] / 65536,
+ fixedInfo['FileVersionLS'] % 65536)
+
+ # \VarFileInfo\Translation returns list of available (language, codepage)
+ # pairs that can be used to retreive string info. We are using only the first pair.
+ lang, codepage = win32api.GetFileVersionInfo(fname, '\\VarFileInfo\\Translation')[0]
+
+ # any other must be of the form \StringfileInfo\%04X%04X\parm_name, middle
+ # two are language/codepage pair returned from above
+
+ strInfo = {}
+ for propName in propNames:
+ strInfoPath = u'\\StringFileInfo\\%04X%04X\\%s' % (lang, codepage, propName)
+ ## print str_info
+ strInfo[propName] = win32api.GetFileVersionInfo(fname, strInfoPath)
+
+ props['StringFileInfo'] = strInfo
+ except:
+ pass
+
+ return props
+
+def get_os_version():
+ try:
+ if WINDOWS:
+ versionHandle = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion")
+ productName = _winreg.QueryValueEx(versionHandle, "ProductName")
+ return productName[0]
+ elif OSX:
+ return 'Mac OS ' + platform.mac_ver()[0]
+ elif LINUX:
+ kernel_version = subprocess.check_output(['uname', '-r']).strip()
+ return ' '.join(platform.linux_distribution()) + ', linux kernel ' + kernel_version + ' ' + platform.architecture()[0]
+ except:
+ return 'Unknown OS'
+
+def get_system_memory():
+ global emrun_options
+
+ try:
+ if LINUX or emrun_options.android:
+ if emrun_options.android:
+ lines = subprocess.check_output([ADB, 'shell', 'cat', '/proc/meminfo']).split('\n')
+ else:
+ mem = open('/proc/meminfo', 'r')
+ lines = mem.readlines()
+ mem.close()
+ for i in lines:
+ sline = i.split()
+ if str(sline[0]) == 'MemTotal:':
+ return int(sline[1]) * 1024
+ elif WINDOWS:
+ return win32api.GlobalMemoryStatusEx()['TotalPhys']
+ elif OSX:
+ return int(subprocess.check_output(['sysctl', '-n', 'hw.memsize']).strip())
+ except:
+ return -1
+
+# Finds the given executable 'program' in PATH. Operates like the Unix tool 'which'.
+def which(program):
+ def is_exe(fpath):
+ return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
+
+ fpath, fname = os.path.split(program)
+ if fpath:
+ if is_exe(program):
+ return program
+ else:
+ for path in os.environ["PATH"].split(os.pathsep):
+ path = path.strip('"')
+ exe_file = os.path.join(path, program)
+ if is_exe(exe_file):
+ return exe_file
+
+ if WINDOWS and not '.' in fname:
+ if is_exe(exe_file + '.exe'):
+ return exe_file + '.exe'
+ if is_exe(exe_file + '.cmd'):
+ return exe_file + '.cmd'
+ if is_exe(exe_file + '.bat'):
+ return exe_file + '.bat'
+
+ return None
+
+def win_get_default_browser():
+ # Manually find the default system browser on Windows without relying on 'start %1' since
+ # that method has an issue, see comment below.
+
+ # In Py3, this module is called winreg without the underscore
+
+ with OpenKey(HKEY_CURRENT_USER, r"Software\Classes\http\shell\open\command") as key:
+ cmd = QueryValue(key, None)
+ if cmd:
+ parts = shlex.split(cmd)
+ if len(parts) > 0:
+ return [parts[0]]
+
+ # Fall back to 'start %1', which we have to treat as if user passed --serve_forever, since
+ # for some reason, we are not able to detect when the browser closes when this is passed.
+ return ['cmd', '/C', 'start']
+
+def find_browser(name):
+ if WINDOWS and name == 'start':
+ return win_get_default_browser()
+ if OSX and name == 'open':
+ return [name]
+
+ if os.path.isfile(os.path.abspath(name)):
+ return [name]
+ if os.path.isfile(os.path.abspath(name)+'.exe'):
+ return [os.path.abspath(name)+'.exe']
+ if os.path.isfile(os.path.abspath(name)+'.cmd'):
+ return [os.path.abspath(name)+'.cmd']
+ if os.path.isfile(os.path.abspath(name)+'.bat'):
+ return [os.path.abspath(name)+'.bat']
+
+ path_lookup = which(name)
+ if path_lookup != None:
+ return [path_lookup]
+
+ browser_locations = []
+ if OSX:
+ # Note: by default Firefox beta installs as 'Firefox.app', you must manually rename it to
+ # FirefoxBeta.app after installation.
+ browser_locations = [ ('firefox', '/Applications/Firefox.app/Contents/MacOS/firefox'),
+ ('firefox_beta', '/Applications/FirefoxBeta.app/Contents/MacOS/firefox'),
+ ('firefox_aurora', '/Applications/FirefoxAurora.app/Contents/MacOS/firefox'),
+ ('firefox_nightly', '/Applications/FirefoxNightly.app/Contents/MacOS/firefox'),
+ ('safari', '/Applications/Safari.app/Contents/MacOS/Safari'),
+ ('opera', '/Applications/Opera.app/Contents/MacOS/Opera'),
+ ('chrome', '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'),
+ ('chrome_canary', '/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary') ]
+ elif WINDOWS:
+ pf_locations = ['ProgramFiles(x86)', 'ProgramFiles', 'ProgramW6432']
+
+ for pf_env in pf_locations:
+ if not pf_env in os.environ:
+ continue
+ program_files = os.environ[pf_env] if WINDOWS else ''
+
+ browser_locations += [ ('chrome', os.path.join(program_files, 'Google/Chrome/Application/chrome.exe')),
+ ('chrome_canary', os.path.expanduser("~/AppData/Local/Google/Chrome SxS/Application/chrome.exe")),
+ ('firefox_nightly', os.path.join(program_files, 'Nightly/firefox.exe')),
+ ('firefox_aurora', os.path.join(program_files, 'Aurora/firefox.exe')),
+ ('firefox_beta', os.path.join(program_files, 'Beta/firefox.exe')),
+ ('firefox_beta', os.path.join(program_files, 'FirefoxBeta/firefox.exe')),
+ ('firefox_beta', os.path.join(program_files, 'Firefox Beta/firefox.exe')),
+ ('firefox', os.path.join(program_files, 'Mozilla Firefox/firefox.exe')),
+ ('iexplore', os.path.join(program_files, 'Internet Explorer/iexplore.exe')),
+ ('opera', os.path.join(program_files, 'Opera/launcher.exe')) ]
+
+ elif LINUX:
+ browser_locations = [ ('firefox', os.path.expanduser('~/firefox/firefox')),
+ ('firefox_beta', os.path.expanduser('~/firefox_beta/firefox')),
+ ('firefox_aurora', os.path.expanduser('~/firefox_aurora/firefox')),
+ ('firefox_nightly', os.path.expanduser('~/firefox_nightly/firefox')),
+ ('chrome', which('google-chrome-stable'))]
+
+ for (alias, browser_exe) in browser_locations:
+ if name == alias:
+ if os.path.isfile(browser_exe):
+ return [browser_exe]
+
+ return None # Could not find the browser
+
+def get_android_model():
+ global ADB
+ manufacturer = subprocess.check_output([ADB, 'shell', 'getprop', 'ro.product.manufacturer']).strip()
+ brand = subprocess.check_output([ADB, 'shell', 'getprop', 'ro.product.brand']).strip()
+ model = subprocess.check_output([ADB, 'shell', 'getprop', 'ro.product.model']).strip()
+ board = subprocess.check_output([ADB, 'shell', 'getprop', 'ro.product.board']).strip()
+ device = subprocess.check_output([ADB, 'shell', 'getprop', 'ro.product.device']).strip()
+ name = subprocess.check_output([ADB, 'shell', 'getprop', 'ro.product.name']).strip()
+ return manufacturer + ' ' + brand + ' ' + model + ' ' + board + ' ' + device + ' ' + name
+
+def get_android_os_version():
+ global ADB
+ ver = subprocess.check_output([ADB, 'shell', 'getprop', 'ro.build.version.release']).strip()
+ apiLevel = subprocess.check_output([ADB, 'shell', 'getprop', 'ro.build.version.sdk']).strip()
+ if not apiLevel:
+ apiLevel = subprocess.check_output([ADB, 'shell', 'getprop', 'ro.build.version.sdk_int']).strip()
+
+ os = ''
+ if ver:
+ os += 'Android ' + ver + ' '
+ if apiLevel:
+ os += 'SDK API Level ' + apiLevel + ' '
+ os += subprocess.check_output([ADB, 'shell', 'getprop', 'ro.build.description']).strip()
+ return os
+
+def list_android_browsers():
+ global ADB
+ apps = subprocess.check_output([ADB, 'shell', 'pm', 'list', 'packages', '-f']).replace('\r\n', '\n')
+ browsers = []
+ for line in apps.split('\n'):
+ line = line.strip()
+ if line.endswith('=org.mozilla.firefox'):
+ browsers += ['firefox']
+ if line.endswith('=org.mozilla.firefox_beta'):
+ browsers += ['firefox_beta']
+ if line.endswith('=org.mozilla.fennec_aurora'):
+ browsers += ['firefox_aurora']
+ if line.endswith('=org.mozilla.fennec'):
+ browsers += ['firefox_nightly']
+ if line.endswith('=com.android.chrome'):
+ browsers += ['chrome']
+ if line.endswith('=com.chrome.beta'):
+ browsers += ['chrome_beta']
+ if line.endswith('=com.opera.browser'):
+ browsers += ['opera']
+ if line.endswith('=com.opera.mini.android'):
+ browsers += ['opera_mini']
+ if line.endswith('=mobi.mgeek.TunnyBrowser'):
+ browsers += ['dolphin']
+
+ browsers.sort()
+ logi('emrun has automatically found the following browsers on the connected Android device:')
+ for browser in browsers:
+ logi(' - ' + browser)
+
+def list_pc_browsers():
+ browsers = ['firefox', 'firefox_beta', 'firefox_aurora', 'firefox_nightly', 'chrome', 'chrome_canary', 'iexplore', 'safari', 'opera']
+ logi('emrun has automatically found the following browsers in the default install locations on the system:')
+ logi('')
+ for browser in browsers:
+ browser_exe = find_browser(browser)
+ if type(browser_exe) == list:
+ browser_exe = browser_exe[0]
+ if browser_exe:
+ logi(' - ' + browser + ': ' + browser_display_name(browser_exe) + ' ' + get_executable_version(browser_exe))
+ logi('')
+ logi('You can pass the --browser <id> option to launch with the given browser above.')
+ logi('Even if your browser was not detected, you can use --browser /path/to/browser/executable to launch with that browser.')
+
+def browser_display_name(browser):
+ b = browser.lower()
+ if 'iexplore' in b:
+ return 'Microsoft Internet Explorer'
+ if 'chrome' in b:
+ return 'Google Chrome'
+ if 'firefox' in b:
+ # Try to identify firefox flavor explicitly, to help show issues where emrun would launch the wrong browser.
+ product_name = win_get_file_properties(browser)['StringFileInfo']['ProductName'] if WINDOWS else 'firefox'
+ if product_name.lower() != 'firefox':
+ return 'Mozilla Firefox ' + product_name
+ else:
+ return 'Mozilla Firefox'
+ if 'opera' in b:
+ return 'Opera'
+ if 'safari' in b:
+ return 'Apple Safari'
+ return browser
+
+def main():
+ global browser_process, processname_killed_atexit, emrun_options, emrun_not_enabled_nag_printed, ADB
+ usage_str = "usage: %prog [options] [optional_portnum]"
+ parser = optparse.OptionParser(usage=usage_str)
+
+ parser.add_option('--kill_start', dest='kill_on_start', action='store_true', default=False,
+ help='If true, any previously running instances of the target browser are killed before starting.')
+
+ parser.add_option('--kill_exit', dest='kill_on_exit', action='store_true', default=False,
+ help='If true, the spawned browser process is forcibly killed when it calls exit().')
+
+ parser.add_option('--no_server', dest='no_server', action='store_true', default=False,
+ help='If specified, a HTTP web server is not launched to host the page to run.')
+
+ parser.add_option('--no_browser', dest='no_browser', action='store_true', default=False,
+ help='If specified, emrun will not launch a web browser to run the page.')
+
+ parser.add_option('--no_emrun_detect', dest='no_emrun_detect', action='store_true', default=False,
+ help='If specified, skips printing the warning message if html page is detected to not have been built with --emrun linker flag.')
+
+ parser.add_option('--serve_after_close', dest='serve_after_close', action='store_true', default=False,
+ help='If true, serves the web page even after the application quits by user closing the web page.')
+
+ parser.add_option('--serve_after_exit', dest='serve_after_exit', action='store_true', default=False,
+ help='If true, serves the web page even after the application quits by a call to exit().')
+
+ parser.add_option('--serve_root', dest='serve_root', default='',
+ help='If set, specifies the root path that the emrun web server serves. If not specified, the directory where the target .html page lives in is served.')
+
+ parser.add_option('--verbose', dest='verbose', action='store_true', default=False,
+ help='Enable verbose logging from emrun internal operation.')
+
+ parser.add_option('--port', dest='port', default=default_webserver_port, type="int",
+ help='Specifies the port the server runs in.')
+
+ parser.add_option('--log_stdout', dest='log_stdout', default='',
+ help='Specifies a log filename where the browser process stdout data will be appended to.')
+
+ parser.add_option('--log_stderr', dest='log_stderr', default='',
+ help='Specifies a log filename where the browser process stderr data will be appended to.')
+
+ parser.add_option('--silence_timeout', dest='silence_timeout', type="int", default=0,
+ help='If no activity is received in this many seconds, the browser process is assumed to be hung, and the web server is shut down and the target browser killed. Disabled by default.')
+
+ parser.add_option('--timeout', dest='timeout', type="int", default=0,
+ help='If the browser process does not quit or the page exit() in this many seconds, the browser is assumed to be hung, and the web server is shut down and the target browser killed. Disabled by default.')
+
+ parser.add_option('--timeout_returncode', dest='timeout_returncode', type="int", default=99999,
+ help='Sets the exit code that emrun reports back to caller in the case that a page timeout occurs. Default: 99999.')
+
+ parser.add_option('--list_browsers', dest='list_browsers', action='store_true',
+ help='Prints out all detected browser that emrun is able to use with the --browser command and exits.')
+
+ parser.add_option('--browser', dest='browser', default='',
+ help='Specifies the browser executable to run the web page in.')
+
+ parser.add_option('--android', dest='android', action='store_true', default=False,
+ help='Launches the page in a browser of an Android device connected to an USB on the local system. (via adb)')
+
+ parser.add_option('--system_info', dest='system_info', action='store_true',
+ help='Prints information about the current system at startup.')
+
+ parser.add_option('--browser_info', dest='browser_info', action='store_true',
+ help='Prints information about the target browser to launch at startup.')
+
+ parser.add_option('--log_html', dest='log_html', action='store_true',
+ help='If set, information lines are printed out an HTML-friendly format.')
+
+ (options, args) = parser.parse_args(sys.argv)
+ emrun_options = options
+
+ if options.android:
+ ADB = which('adb')
+ if not ADB:
+ loge("Could not find the adb tool. Install Android SDK and add the directory of adb to PATH.")
+ return 1
+
+ if not options.browser and not options.android:
+ if WINDOWS:
+ options.browser = 'start'
+ elif LINUX:
+ options.browser = which('xdg-open')
+ if not options.browser:
+ options.browser = 'firefox'
+ elif OSX:
+ options.browser = 'safari'
+
+ if options.list_browsers:
+ if options.android:
+ list_android_browsers()
+ else:
+ list_pc_browsers()
+ return
+
+ if len(args) < 2 and (options.system_info or options.browser_info):
+ options.no_server = options.no_browser = True # Don't run if only --system_info or --browser_info was passed.
+
+ if len(args) < 2 and not (options.no_server == True and options.no_browser == True):
+ logi('Usage: emrun filename.html')
+ return
+
+ file_to_serve = args[1] if len(args) > 1 else ''
+ cmdlineparams = args[2:] if len(args) > 2 else []
+
+ if options.serve_root:
+ serve_dir = os.path.abspath(options.serve_root)
+ else:
+ serve_dir = os.path.dirname(os.path.abspath(file_to_serve))
+ url = os.path.relpath(os.path.abspath(file_to_serve), serve_dir)
+ if len(cmdlineparams) > 0:
+ url += '?' + '&'.join(cmdlineparams)
+ server_root = 'localhost'
+ if options.android:
+ server_root = socket.gethostbyname(socket.gethostname())
+ url = 'http://' + server_root + ':' + str(options.port)+'/'+url
+
+ os.chdir(serve_dir)
+ logv('Web server root directory: ' + os.path.abspath('.'))
+
+ if options.android:
+ if not options.no_browser:
+ if not options.browser:
+ loge("Running on Android requires that you explicitly specify the browser to run with --browser <id>. Run emrun --android --list_browsers to obtain a list of installed browsers you can use.")
+ return 1
+ elif options.browser == 'firefox':
+ browser_app = 'org.mozilla.firefox/.App'
+ elif options.browser == 'firefox_beta':
+ browser_app = 'org.mozilla.firefox_beta/.App'
+ elif options.browser == 'firefox_aurora' or options.browser == 'fennec_aurora':
+ browser_app = 'org.mozilla.fennec_aurora/.App'
+ elif options.browser == 'firefox_nightly' or options.browser == 'fennec':
+ browser_app = 'org.mozilla.fennec/.App'
+ elif options.browser == 'chrome':
+ browser_app = 'com.android.chrome/.Main'
+ elif options.browser == 'chrome_beta' or options.browser == 'chrome_canary': # There is no Chrome Canary for Android, but Play store has 'Chrome Beta' instead.
+ browser_app = 'com.chrome.beta/com.android.chrome.Main'
+ elif options.browser == 'opera':
+ browser_app = 'com.opera.browser/com.opera.Opera'
+ elif options.browser == 'opera_mini': # Launching the URL works, but page seems to never load (Fails with 'Network problem' even when other browsers work)
+ browser_app = 'com.opera.mini.android/.Browser'
+ elif options.browser =='dolphin': # Current stable Dolphin as of 12/2013 does not have WebGL support.
+ browser_app = 'mobi.mgeek.TunnyBrowser/.BrowserActivity'
+ else:
+ loge("Don't know how to launch browser " + options.browser + ' on Android!')
+ return 1
+ # To add support for a new Android browser in the list above:
+ # 1. Install the browser to Android phone, connect it via adb to PC.
+ # 2. Type 'adb shell pm list packages -f' to locate the package name of that application.
+ # 3. Type 'adb pull <packagename>.apk' to copy the apk of that application to PC.
+ # 4. Type 'aapt d xmltree <packagename>.apk AndroidManifest.xml > manifest.txt' to extract the manifest from the package.
+ # 5. Locate the name of the main activity for the browser in manifest.txt and add an entry to above list in form 'appname/mainactivityname'
+
+ if WINDOWS:
+ url = url.replace('&', '\\&')
+ browser = [ADB, 'shell', 'am', 'start', '-a', 'android.intent.action.VIEW', '-n', browser_app, '-d', url]
+ processname_killed_atexit = browser_app[:browser_app.find('/')]
+ else: #Launching a web page on local system.
+ browser = find_browser(str(options.browser))
+ browser_exe = browser[0]
+ browser_args = []
+
+ if 'safari' in browser_exe.lower():
+ # Safari has a bug that a command line 'Safari http://page.com' does not launch that page,
+ # but instead launches 'file:///http://page.com'. To remedy this, must use the open -a command
+ # to run Safari, but unfortunately this will end up spawning Safari process detached from emrun.
+ if OSX:
+ browser = ['open', '-a', 'Safari'] + (browser[1:] if len(browser) > 1 else [])
+
+ processname_killed_atexit = 'Safari'
+ elif 'chrome' in browser_exe.lower():
+ processname_killed_atexit = 'chrome'
+ browser_args = ['--incognito', '--enable-nacl', '--enable-pnacl', '--disable-restore-session-state', '--enable-webgl', '--no-default-browser-check', '--no-first-run', '--allow-file-access-from-files']
+ # if options.no_server:
+ # browser_args += ['--disable-web-security']
+ elif 'firefox' in browser_exe.lower():
+ processname_killed_atexit = 'firefox'
+ elif 'iexplore' in browser_exe.lower():
+ processname_killed_atexit = 'iexplore'
+ browser_args = ['-private']
+ elif 'opera' in browser_exe.lower():
+ processname_killed_atexit = 'opera'
+
+ # In Windows cmdline, & character delimits multiple commmands, so must use ^ to escape them.
+ if browser_exe == 'cmd':
+ url = url.replace('&', '^&')
+ browser += browser_args + [url]
+
+ if options.kill_on_start:
+ pname = processname_killed_atexit
+ kill_browser_process()
+ processname_killed_atexit = pname
+
+ if options.system_info:
+ logi('Time of run: ' + time.strftime("%x %X"))
+ if options.android:
+ logi('Model: ' + get_android_model())
+ logi('OS: ' + get_android_os_version() + ' with ' + str(get_system_memory()/1024/1024) + ' MB of System RAM')
+ logi('CPU: ' + get_android_cpu_infoline())
+ else:
+ logi('Computer name: ' + socket.gethostname()) # http://stackoverflow.com/questions/799767/getting-name-of-windows-computer-running-python-script
+ logi('OS: ' + get_os_version() + ' with ' + str(get_system_memory()/1024/1024) + ' MB of System RAM')
+ logi('CPU: ' + get_cpu_infoline())
+ print_gpu_infolines()
+ if options.browser_info:
+ if options.android:
+ logi('Browser: Android ' + browser_app)
+ else:
+ logi('Browser: ' + browser_display_name(browser[0]) + ' ' + get_executable_version(browser_exe))
+
+ # Suppress run warning if requested.
+ if options.no_emrun_detect:
+ emrun_not_enabled_nag_printed = True
+
+ global browser_stdout_handle, browser_stderr_handle
+ if options.log_stdout:
+ browser_stdout_handle = open(options.log_stdout, 'ab')
+ if options.log_stderr:
+ if options.log_stderr == options.log_stdout:
+ browser_stderr_handle = browser_stdout_handle
+ else:
+ browser_stderr_handle = open(options.log_stderr, 'ab')
+
+ if not options.no_server:
+ logv('Starting web server in port ' + str(options.port))
+ httpd = HTTPWebServer(('', options.port), HTTPHandler)
+
+ if not options.no_browser:
+ logv("Executing %s" % ' '.join(browser))
+ if browser[0] == 'cmd':
+ serve_forever = True # Workaround an issue where passing 'cmd /C start' is not able to detect when the user closes the page.
+ browser_process = subprocess.Popen(browser)
+ if options.kill_on_exit:
+ atexit.register(kill_browser_process)
+ # For Android automation, we execute adb, so this process does not represent a browser and no point killing it.
+ if options.android:
+ browser_process = None
+
+ if browser_process and browser_process.poll() == None:
+ options.serve_after_close = True
+ logv('Warning: emrun got detached from the target browser process. Cannot detect when user closes the browser. Behaving as if --serve_after_close was passed in.')
+
+ if not options.no_server:
+ try:
+ httpd.serve_forever()
+ except KeyboardInterrupt:
+ httpd.server_close()
+ httpd.server_close()
+
+ logv('Closed web server.')
+
+ if not options.no_browser:
+ if options.kill_on_exit:
+ kill_browser_process()
+ elif is_browser_process_alive():
+ logv('Not terminating browser process, pass --kill_exit to terminate the browser when it calls exit().')
+
+ return page_exit_code
+
+if __name__ == '__main__':
+ returncode = main()
+ logv('emrun quitting with process exit code ' + str(returncode))
+ sys.exit(returncode)
diff --git a/emrun.bat b/emrun.bat
new file mode 100644
index 00000000..ae937e4d
--- /dev/null
+++ b/emrun.bat
@@ -0,0 +1,2 @@
+@echo off
+python "%~dp0\emrun" %* \ No newline at end of file
diff --git a/emscripten.py b/emscripten.py
index 7514b3ca..42db0803 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -726,7 +726,6 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None,
"""
assert(settings['ASM_JS']) # TODO: apply ASM_JS even in -O0 for fastcomp
- assert(settings['RUNNING_JS_OPTS'])
# Overview:
# * Run LLVM backend to emit JS. JS includes function bodies, memory initializer,
@@ -734,47 +733,20 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None,
# * Run compiler.js on the metadata to emit the shell js code, pre/post-ambles,
# JS library dependencies, etc.
- if DEBUG: logging.debug('emscript: llvm backend')
-
- # TODO: proper temp files
- # TODO: use a single LLVM toolchain instead of normal for source, pnacl for simplification, custom for js backend
-
- if DEBUG: shutil.copyfile(infile, os.path.join(shared.CANONICAL_TEMP_DIR, 'temp0.ll'))
-
- if DEBUG: logging.debug(' ..1..')
- temp1 = temp_files.get('.1.bc').name
- shared.jsrun.timeout_run(subprocess.Popen([os.path.join(shared.LLVM_ROOT, 'opt'), infile, '-pnacl-abi-simplify-preopt', '-o', temp1]))
- assert os.path.exists(temp1)
- if DEBUG:
- shutil.copyfile(temp1, os.path.join(shared.CANONICAL_TEMP_DIR, 'temp1.bc'))
- shared.jsrun.timeout_run(subprocess.Popen([os.path.join(shared.LLVM_ROOT, 'llvm-dis'), 'temp1.bc', '-o', 'temp1.ll']))
-
- #if DEBUG: logging.debug(' ..2..')
- #temp2 = temp_files.get('.2.bc').name
- #shared.jsrun.timeout_run(subprocess.Popen([os.path.join(shared.LLVM_ROOT, 'opt'), temp1, '-O3', '-o', temp2]))
- #assert os.path.exists(temp2)
- #if DEBUG:
- # shutil.copyfile(temp2, os.path.join(shared.CANONICAL_TEMP_DIR, 'temp2.bc'))
- # shared.jsrun.timeout_run(subprocess.Popen([os.path.join(shared.LLVM_ROOT, 'llvm-dis'), 'temp2.bc', '-o', 'temp2.ll']))
- temp2 = temp1 # XXX if we optimize the bc, we remove some pnacl clutter, but it also makes varargs stores be 8-byte aligned
-
- if DEBUG: logging.debug(' ..3..')
- temp3 = temp_files.get('.3.bc').name
- shared.jsrun.timeout_run(subprocess.Popen([os.path.join(shared.LLVM_ROOT, 'opt'), temp2, '-pnacl-abi-simplify-postopt', '-o', temp3]))
- #'-print-after-all'
- assert os.path.exists(temp3)
if DEBUG:
- shutil.copyfile(temp3, os.path.join(shared.CANONICAL_TEMP_DIR, 'temp3.bc'))
- shared.jsrun.timeout_run(subprocess.Popen([os.path.join(shared.LLVM_ROOT, 'llvm-dis'), 'temp3.bc', '-o', 'temp3.ll']))
+ logging.debug('emscript: llvm backend')
+ t = time.time()
- if DEBUG: logging.debug(' ..4..')
- temp4 = temp_files.get('.4.js').name
+ temp_js = temp_files.get('.4.js').name
backend_compiler = os.path.join(shared.LLVM_ROOT, 'llc')
- shared.jsrun.timeout_run(subprocess.Popen([backend_compiler, temp3, '-march=js', '-filetype=asm', '-o', temp4], stdout=subprocess.PIPE))
- if DEBUG: shutil.copyfile(temp4, os.path.join(shared.CANONICAL_TEMP_DIR, 'temp4.js'))
+ shared.jsrun.timeout_run(subprocess.Popen([backend_compiler, infile, '-march=js', '-filetype=asm', '-o', temp_js], stdout=subprocess.PIPE))
+
+ if DEBUG:
+ logging.debug(' emscript: llvm backend took %s seconds' % (time.time() - t))
+ t = time.time()
# Split up output
- backend_output = open(temp4).read()
+ backend_output = open(temp_js).read()
#if DEBUG: print >> sys.stderr, backend_output
start_funcs_marker = '// EMSCRIPTEN_START_FUNCTIONS'
@@ -801,6 +773,20 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None,
table_sizes[k] = str(v.count(',')) # undercounts by one, but that is what we want
funcs = re.sub(r"#FM_(\w+)#", lambda m: table_sizes[m.groups(0)[0]], funcs)
+ # fix +float into float.0, if not running js opts
+ if not settings['RUNNING_JS_OPTS']:
+ def fix_dot_zero(m):
+ num = m.group(3)
+ # TODO: handle 0x floats?
+ if num.find('.') < 0:
+ e = num.find('e');
+ if e < 0:
+ num += '.0'
+ else:
+ num = num[:e] + '.0' + num[e:]
+ return m.group(1) + m.group(2) + num
+ funcs = re.sub(r'([(=,+\-*/%<>:?] *)\+(-?)((0x)?[0-9a-f]*\.?[0-9]+([eE][-+]?[0-9]+)?)', lambda m: fix_dot_zero(m), funcs)
+
# js compiler
if DEBUG: logging.debug('emscript: js compiler glue')
@@ -836,7 +822,9 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None,
assert '//FORWARDED_DATA:' in out, 'Did not receive forwarded data in pre output - process failed?'
glue, forwarded_data = out.split('//FORWARDED_DATA:')
- #print >> sys.stderr, out
+ if DEBUG:
+ logging.debug(' emscript: glue took %s seconds' % (time.time() - t))
+ t = time.time()
last_forwarded_json = forwarded_json = json.loads(forwarded_data)
@@ -932,7 +920,10 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None,
if item == '0': return bad if not newline else (bad + '\n')
if item not in metadata['implementedFunctions']:
# this is imported into asm, we must wrap it
- code = item + '(' + coerced_params + ')'
+ call_ident = item
+ if call_ident in metadata['redirects']: call_ident = metadata['redirects'][call_ident]
+ if not call_ident.startswith('_') and not call_ident.startswith('Math_'): call_ident = '_' + call_ident
+ code = call_ident + '(' + coerced_params + ')'
if sig[0] != 'v':
code = 'return ' + shared.JS.make_coercion(code, sig[0], settings)
code += ';'
@@ -1203,6 +1194,8 @@ Runtime.stackRestore = function(top) { asm['stackRestore'](top) };
outfile.close()
+ if DEBUG: logging.debug(' emscript: final python processing took %s seconds' % (time.time() - t))
+
if os.environ.get('EMCC_FAST_COMPILER'):
emscript = emscript_fast
diff --git a/src/analyzer.js b/src/analyzer.js
index 253c5505..17582ea3 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -1662,11 +1662,13 @@ function analyzer(data, sidePass) {
function stackAnalyzer() {
data.functions.forEach(function(func) {
var lines = func.labels[0].lines;
+ var hasAlloca = false;
for (var i = 0; i < lines.length; i++) {
var item = lines[i];
if (!item.assignTo || item.intertype != 'alloca' || !isNumber(item.ident)) break;
item.allocatedSize = func.variables[item.assignTo].impl === VAR_EMULATED ?
calcAllocatedSize(item.allocatedType)*item.ident: 0;
+ hasAlloca = true;
if (USE_TYPED_ARRAYS === 2) {
// We need to keep the stack aligned
item.allocatedSize = Runtime.forceAlign(item.allocatedSize, Runtime.STACK_ALIGN);
@@ -1682,6 +1684,7 @@ function analyzer(data, sidePass) {
}
func.initialStack = index;
func.otherStackAllocations = false;
+ if (func.initialStack === 0 && hasAlloca) func.otherStackAllocations = true; // a single alloca of zero still requires us to emit stack support code
while (func.initialStack == 0) { // one-time loop with possible abort in the middle
// If there is no obvious need for stack management, perhaps we don't need it
// (we try to optimize that way with SKIP_STACK_IN_SMALL). However,
diff --git a/src/emrun_postjs.js b/src/emrun_postjs.js
new file mode 100644
index 00000000..eec203ec
--- /dev/null
+++ b/src/emrun_postjs.js
@@ -0,0 +1,20 @@
+function emrun_register_handlers() {
+ function post(msg) {
+ var http = new XMLHttpRequest();
+ http.open("POST", "stdio.html", true);
+ http.send(msg);
+ }
+ // If the address contains localhost, or we are running the page from port 6931, we can assume we're running the test runner and should post stdout logs.
+ if (document.URL.search("localhost") != -1 || document.URL.search(":6931/") != -1) {
+ var emrun_http_sequence_number = 1;
+ var prevExit = Module['exit'];
+ var prevPrint = Module['print'];
+ var prevErr = Module['printErr'];
+ Module['exit'] = function emrun_exit(returncode) { post('^exit^'+returncode); prevExit(returncode); }
+ Module['print'] = function emrun_print(text) { post('^out^'+(emrun_http_sequence_number++)+'^'+text); prevPrint(text); }
+ Module['printErr'] = function emrun_printErr(text) { post('^err^'+(emrun_http_sequence_number++)+'^'+text); prevErr(text); }
+ }
+ // Notify emrun web server that this browser has successfully launched the page.
+ post('^pageload^');
+}
+emrun_register_handlers();
diff --git a/src/emrun_prejs.js b/src/emrun_prejs.js
new file mode 100644
index 00000000..14613c5d
--- /dev/null
+++ b/src/emrun_prejs.js
@@ -0,0 +1,5 @@
+// Route URL GET parameters to argc+argv
+Module['arguments'] = window.location.search.substr(1).trim().split('&');
+// If no args were passed arguments = [''], in which case kill the single empty string.
+if (!Module['arguments'][0])
+ Module['arguments'] = [];
diff --git a/src/emscripten-source-map.min.js b/src/emscripten-source-map.min.js
new file mode 100644
index 00000000..9151400f
--- /dev/null
+++ b/src/emscripten-source-map.min.js
@@ -0,0 +1,31 @@
+function define(e,t,n){if(typeof e!="string")throw new TypeError("Expected string, got: "+e);arguments.length==2&&(n=t);if(e in define.modules)throw new Error("Module already defined: "+e);define.modules[e]=n}function Domain(){this.modules={},this._currentModule=null}define.modules={},function(){function e(e){var t=e.split("/"),n=1;while(n<t.length)t[n]===".."?t.splice(n-1,1):t[n]==="."?t.splice(n,1):n++;return t.join("/")}function t(e,t){return e=e.trim(),t=t.trim(),/^\//.test(t)?t:e.replace(/\/*$/,"/")+t}function n(e){var t=e.split("/");return t.pop(),t.join("/")}Domain.prototype.require=function(e,t){if(Array.isArray(e)){var n=e.map(function(e){return this.lookup(e)},this);return t&&t.apply(null,n),undefined}return this.lookup(e)},Domain.prototype.lookup=function(r){/^\./.test(r)&&(r=e(t(n(this._currentModule),r)));if(r in this.modules){var i=this.modules[r];return i}if(r in define.modules){var i=define.modules[r];if(typeof i=="function"){var s={},o=this._currentModule;this._currentModule=r,i(this.require.bind(this),s,{id:r,uri:""}),this._currentModule=o,i=s}return this.modules[r]=i,i}throw new Error("Module not defined: "+r)}}(),define.Domain=Domain,define.globalDomain=new Domain;var require=define.globalDomain.require.bind(define.globalDomain);define("source-map/source-map-generator",["require","exports","module","source-map/base64-vlq","source-map/util","source-map/array-set"],function(e,t,n){function o(e){this._file=i.getArg(e,"file"),this._sourceRoot=i.getArg(e,"sourceRoot",null),this._sources=new s,this._names=new s,this._mappings=[],this._sourcesContents=null}function u(e,t){var n=(e&&e.line)-(t&&t.line);return n?n:(e&&e.column)-(t&&t.column)}function a(e,t){return e=e||"",t=t||"",(e>t)-(e<t)}function f(e,t){return u(e.generated,t.generated)||u(e.original,t.original)||a(e.source,t.source)||a(e.name,t.name)}var r=e("./base64-vlq"),i=e("./util"),s=e("./array-set").ArraySet;o.prototype._version=3,o.fromSourceMap=function(t){var n=t.sourceRoot,r=new o({file:t.file,sourceRoot:n});return t.eachMapping(function(e){var t={generated:{line:e.generatedLine,column:e.generatedColumn}};e.source&&(t.source=e.source,n&&(t.source=i.relative(n,t.source)),t.original={line:e.originalLine,column:e.originalColumn},e.name&&(t.name=e.name)),r.addMapping(t)}),t.sources.forEach(function(e){var n=t.sourceContentFor(e);n&&r.setSourceContent(e,n)}),r},o.prototype.addMapping=function(t){var n=i.getArg(t,"generated"),r=i.getArg(t,"original",null),s=i.getArg(t,"source",null),o=i.getArg(t,"name",null);this._validateMapping(n,r,s,o),s&&!this._sources.has(s)&&this._sources.add(s),o&&!this._names.has(o)&&this._names.add(o),this._mappings.push({generated:n,original:r,source:s,name:o})},o.prototype.setSourceContent=function(t,n){var r=t;this._sourceRoot&&(r=i.relative(this._sourceRoot,r)),n!==null?(this._sourcesContents||(this._sourcesContents={}),this._sourcesContents[i.toSetString(r)]=n):(delete this._sourcesContents[i.toSetString(r)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))},o.prototype.applySourceMap=function(t,n){n||(n=t.file);var r=this._sourceRoot;r&&(n=i.relative(r,n));var o=new s,u=new s;this._mappings.forEach(function(e){if(e.source===n&&e.original){var s=t.originalPositionFor({line:e.original.line,column:e.original.column});s.source!==null&&(r?e.source=i.relative(r,s.source):e.source=s.source,e.original.line=s.line,e.original.column=s.column,s.name!==null&&e.name!==null&&(e.name=s.name))}var a=e.source;a&&!o.has(a)&&o.add(a);var f=e.name;f&&!u.has(f)&&u.add(f)},this),this._sources=o,this._names=u,t.sources.forEach(function(e){var n=t.sourceContentFor(e);n&&(r&&(e=i.relative(r,e)),this.setSourceContent(e,n))},this)},o.prototype._validateMapping=function(t,n,r,i){if(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0&&!n&&!r&&!i)return;if(t&&"line"in t&&"column"in t&&n&&"line"in n&&"column"in n&&t.line>0&&t.column>=0&&n.line>0&&n.column>=0&&r)return;throw new Error("Invalid mapping.")},o.prototype._serializeMappings=function(){var t=0,n=1,i=0,s=0,o=0,u=0,a="",l;this._mappings.sort(f);for(var c=0,h=this._mappings.length;c<h;c++){l=this._mappings[c];if(l.generated.line!==n){t=0;while(l.generated.line!==n)a+=";",n++}else if(c>0){if(!f(l,this._mappings[c-1]))continue;a+=","}a+=r.encode(l.generated.column-t),t=l.generated.column,l.source&&l.original&&(a+=r.encode(this._sources.indexOf(l.source)-u),u=this._sources.indexOf(l.source),a+=r.encode(l.original.line-1-s),s=l.original.line-1,a+=r.encode(l.original.column-i),i=l.original.column,l.name&&(a+=r.encode(this._names.indexOf(l.name)-o),o=this._names.indexOf(l.name)))}return a},o.prototype.toJSON=function(){var t={version:this._version,file:this._file,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._sourceRoot&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=t.sources.map(function(e){return t.sourceRoot&&(e=i.relative(t.sourceRoot,e)),Object.prototype.hasOwnProperty.call(this._sourcesContents,i.toSetString(e))?this._sourcesContents[i.toSetString(e)]:null},this)),t},o.prototype.toString=function(){return JSON.stringify(this)},t.SourceMapGenerator=o}),define("source-map/base64-vlq",["require","exports","module","source-map/base64"],function(e,t,n){function a(e){return e<0?(-e<<1)+1:(e<<1)+0}function f(e){var t=(e&1)===1,n=e>>1;return t?-n:n}var r=e("./base64"),i=5,s=1<<i,o=s-1,u=s;t.encode=function(t){var n="",s,f=a(t);do s=f&o,f>>>=i,f>0&&(s|=u),n+=r.encode(s);while(f>0);return n},t.decode=function(t){var n=0,s=t.length,a=0,l=0,c,h;do{if(n>=s)throw new Error("Expected more digits in base 64 VLQ value.");h=r.decode(t.charAt(n++)),c=!!(h&u),h&=o,a+=h<<l,l+=i}while(c);return{value:f(a),rest:t.slice(n)}}}),define("source-map/base64",["require","exports","module"],function(e,t,n){var r={},i={};"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").forEach(function(e,t){r[e]=t,i[t]=e}),t.encode=function(t){if(t in i)return i[t];throw new TypeError("Must be between 0 and 63: "+t)},t.decode=function(t){if(t in r)return r[t];throw new TypeError("Not a valid base 64 digit: "+t)}}),define("source-map/util",["require","exports","module"],function(e,t,n){function r(e,t,n){if(t in e)return e[t];if(arguments.length===3)return n;throw new Error('"'+t+'" is a required argument.')}function s(e){var t=e.match(i);return t?{scheme:t[1],auth:t[3],host:t[4],port:t[6],path:t[7]}:null}function o(e){var t=e.scheme+"://";return e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}function u(e,t){var n;return t.match(i)?t:t.charAt(0)==="/"&&(n=s(e))?(n.path=t,o(n)):e.replace(/\/$/,"")+"/"+t}function a(e){return"$"+e}function f(e){return e.substr(1)}function l(e,t){e=e.replace(/\/$/,"");var n=s(e);return t.charAt(0)=="/"&&n&&n.path=="/"?t.slice(1):t.indexOf(e+"/")===0?t.substr(e.length+1):t}t.getArg=r;var i=/([\w+\-.]+):\/\/((\w+:\w+)@)?([\w.]+)?(:(\d+))?(\S+)?/;t.urlParse=s,t.urlGenerate=o,t.join=u,t.toSetString=a,t.fromSetString=f,t.relative=l}),define("source-map/array-set",["require","exports","module","source-map/util"],function(e,t,n){function i(){this._array=[],this._set={}}var r=e("./util");i.fromArray=function(t,n){var r=new i;for(var s=0,o=t.length;s<o;s++)r.add(t[s],n);return r},i.prototype.add=function(t,n){var i=this.has(t),s=this._array.length;(!i||n)&&this._array.push(t),i||(this._set[r.toSetString(t)]=s)},i.prototype.has=function(t){return Object.prototype.hasOwnProperty.call(this._set,r.toSetString(t))},i.prototype.indexOf=function(t){if(this.has(t))return this._set[r.toSetString(t)];throw new Error('"'+t+'" is not in the set.')},i.prototype.at=function(t){if(t>=0&&t<this._array.length)return this._array[t];throw new Error("No element indexed by "+t)},i.prototype.toArray=function(){return this._array.slice()},t.ArraySet=i}),define("source-map/source-map-consumer",["require","exports","module","source-map/util","source-map/binary-search","source-map/array-set","source-map/base64-vlq"],function(e,t,n){function u(e){var t=e;typeof e=="string"&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var n=r.getArg(t,"version"),i=r.getArg(t,"sources"),o=r.getArg(t,"names"),u=r.getArg(t,"sourceRoot",null),a=r.getArg(t,"sourcesContent",null),f=r.getArg(t,"mappings"),l=r.getArg(t,"file",null);if(n!==this._version)throw new Error("Unsupported version: "+n);this._names=s.fromArray(o,!0),this._sources=s.fromArray(i,!0),this.sourceRoot=u,this.sourcesContent=a,this.file=l,this._generatedMappings=[],this._originalMappings=[],this._parseMappings(f,u)}var r=e("./util"),i=e("./binary-search"),s=e("./array-set").ArraySet,o=e("./base64-vlq");u.prototype._version=3,Object.defineProperty(u.prototype,"sources",{get:function(){return this._sources.toArray().map(function(e){return this.sourceRoot?r.join(this.sourceRoot,e):e},this)}}),u.prototype._parseMappings=function(t,n){var r=1,i=0,s=0,u=0,a=0,f=0,l=/^[,;]/,c=t,h,p;while(c.length>0)if(c.charAt(0)===";")r++,c=c.slice(1),i=0;else if(c.charAt(0)===",")c=c.slice(1);else{h={},h.generatedLine=r,p=o.decode(c),h.generatedColumn=i+p.value,i=h.generatedColumn,c=p.rest;if(c.length>0&&!l.test(c.charAt(0))){p=o.decode(c),h.source=this._sources.at(a+p.value),a+=p.value,c=p.rest;if(c.length===0||l.test(c.charAt(0)))throw new Error("Found a source, but no line and column");p=o.decode(c),h.originalLine=s+p.value,s=h.originalLine,h.originalLine+=1,c=p.rest;if(c.length===0||l.test(c.charAt(0)))throw new Error("Found a source and line, but no column");p=o.decode(c),h.originalColumn=u+p.value,u=h.originalColumn,c=p.rest,c.length>0&&!l.test(c.charAt(0))&&(p=o.decode(c),h.name=this._names.at(f+p.value),f+=p.value,c=p.rest)}this._generatedMappings.push(h),typeof h.originalLine=="number"&&this._originalMappings.push(h)}this._originalMappings.sort(this._compareOriginalPositions)},u.prototype._compareOriginalPositions=function(t,n){if(t.source>n.source)return 1;if(t.source<n.source)return-1;var r=t.originalLine-n.originalLine;return r===0?t.originalColumn-n.originalColumn:r},u.prototype._compareGeneratedPositions=function(t,n){var r=t.generatedLine-n.generatedLine;return r===0?t.generatedColumn-n.generatedColumn:r},u.prototype._findMapping=function(t,n,r,s,o){if(t[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+t[r]);if(t[s]<0)throw new TypeError("Column must be greater than or equal to 0, got "+t[s]);return i.search(t,n,o)},u.prototype.originalPositionFor=function(t){var n={generatedLine:r.getArg(t,"line"),generatedColumn:r.getArg(t,"column")},i=this._findMapping(n,this._generatedMappings,"generatedLine","generatedColumn",this._compareGeneratedPositions);if(i){var s=r.getArg(i,"source",null);return s&&this.sourceRoot&&(s=r.join(this.sourceRoot,s)),{source:s,line:r.getArg(i,"originalLine",null),column:r.getArg(i,"originalColumn",null),name:r.getArg(i,"name",null)}}return{source:null,line:null,column:null,name:null}},u.prototype.sourceContentFor=function(t){if(!this.sourcesContent)return null;this.sourceRoot&&(t=r.relative(this.sourceRoot,t));if(this._sources.has(t))return this.sourcesContent[this._sources.indexOf(t)];var n;if(this.sourceRoot&&(n=r.urlParse(this.sourceRoot))){var i=t.replace(/^file:\/\//,"");if(n.scheme=="file"&&this._sources.has(i))return this.sourcesContent[this._sources.indexOf(i)];if((!n.path||n.path=="/")&&this._sources.has("/"+t))return this.sourcesContent[this._sources.indexOf("/"+t)]}throw new Error('"'+t+'" is not in the SourceMap.')},u.prototype.generatedPositionFor=function(t){var n={source:r.getArg(t,"source"),originalLine:r.getArg(t,"line"),originalColumn:r.getArg(t,"column")};this.sourceRoot&&(n.source=r.relative(this.sourceRoot,n.source));var i=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",this._compareOriginalPositions);return i?{line:r.getArg(i,"generatedLine",null),column:r.getArg(i,"generatedColumn",null)}:{line:null,column:null}},u.GENERATED_ORDER=1,u.ORIGINAL_ORDER=2,u.prototype.eachMapping=function(t,n,i){var s=n||null,o=i||u.GENERATED_ORDER,a;switch(o){case u.GENERATED_ORDER:a=this._generatedMappings;break;case u.ORIGINAL_ORDER:a=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var f=this.sourceRoot;a.map(function(e){var t=e.source;return t&&f&&(t=r.join(f,t)),{source:t,generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:e.name}}).forEach(t,s)},t.SourceMapConsumer=u}),define("source-map/binary-search",["require","exports","module"],function(e,t,n){function r(e,t,n,i,s){var o=Math.floor((t-e)/2)+e,u=s(n,i[o]);return u===0?i[o]:u>0?t-o>1?r(o,t,n,i,s):i[o]:o-e>1?r(e,o,n,i,s):e<0?null:i[e]}t.search=function(t,n,i){return n.length>0?r(-1,n.length,t,n,i):null}}),define("source-map/source-node",["require","exports","module","source-map/source-map-generator","source-map/util"],function(e,t,n){function s(e,t,n,r,i){this.children=[],this.sourceContents={},this.line=e===undefined?null:e,this.column=t===undefined?null:t,this.source=n===undefined?null:n,this.name=i===undefined?null:i,r!=null&&this.add(r)}var r=e("./source-map-generator").SourceMapGenerator,i=e("./util");s.fromStringWithSourceMap=function(t,n){function f(e,t){e===null||e.source===undefined?r.add(t):r.add(new s(e.originalLine,e.originalColumn,e.source,t,e.name))}var r=new s,i=t.split("\n"),o=1,u=0,a=null;return n.eachMapping(function(e){if(a===null){while(o<e.generatedLine)r.add(i.shift()+"\n"),o++;if(u<e.generatedColumn){var t=i[0];r.add(t.substr(0,e.generatedColumn)),i[0]=t.substr(e.generatedColumn),u=e.generatedColumn}}else if(o<e.generatedLine){var n="";do n+=i.shift()+"\n",o++,u=0;while(o<e.generatedLine);if(u<e.generatedColumn){var t=i[0];n+=t.substr(0,e.generatedColumn),i[0]=t.substr(e.generatedColumn),u=e.generatedColumn}f(a,n)}else{var t=i[0],n=t.substr(0,e.generatedColumn-u);i[0]=t.substr(e.generatedColumn-u),u=e.generatedColumn,f(a,n)}a=e},this),f(a,i.join("\n")),n.sources.forEach(function(e){var t=n.sourceContentFor(e);t&&r.setSourceContent(e,t)}),r},s.prototype.add=function(t){if(Array.isArray(t))t.forEach(function(e){this.add(e)},this);else{if(!(t instanceof s||typeof t=="string"))throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);t&&this.children.push(t)}return this},s.prototype.prepend=function(t){if(Array.isArray(t))for(var n=t.length-1;n>=0;n--)this.prepend(t[n]);else{if(!(t instanceof s||typeof t=="string"))throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);this.children.unshift(t)}return this},s.prototype.walk=function(t){this.children.forEach(function(e){e instanceof s?e.walk(t):e!==""&&t(e,{source:this.source,line:this.line,column:this.column,name:this.name})},this)},s.prototype.join=function(t){var n,r,i=this.children.length;if(i>0){n=[];for(r=0;r<i-1;r++)n.push(this.children[r]),n.push(t);n.push(this.children[r]),this.children=n}return this},s.prototype.replaceRight=function(t,n){var r=this.children[this.children.length-1];return r instanceof s?r.replaceRight(t,n):typeof r=="string"?this.children[this.children.length-1]=r.replace(t,n):this.children.push("".replace(t,n)),this},s.prototype.setSourceContent=function(t,n){this.sourceContents[i.toSetString(t)]=n},s.prototype.walkSourceContents=function(t){this.children.forEach(function(e){e instanceof s&&e.walkSourceContents(t)},this),Object.keys(this.sourceContents).forEach(function(e){t(i.fromSetString(e),this.sourceContents[e])},this)},s.prototype.toString=function(){var t="";return this.walk(function(e){t+=e}),t},s.prototype.toStringWithSourceMap=function(t){var n={code:"",line:1,column:0},i=new r(t),s=!1,o=null,u=null,a=null,f=null;return this.walk(function(e,t){n.code+=e,t.source!==null&&t.line!==null&&t.column!==null?((o!==t.source||u!==t.line||a!==t.column||f!==t.name)&&i.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:n.line,column:n.column},name:t.name}),o=t.source,u=t.line,a=t.column,f=t.name,s=!0):s&&(i.addMapping({generated:{line:n.line,column:n.column}}),o=null,s=!1),e.split("").forEach(function(e){e==="\n"?(n.line++,n.column=0):n.column++})}),this.walkSourceContents(function(e,t){i.setSourceContent(e,t)}),{code:n.code,map:i}},t.SourceNode=s}),window.sourceMap={SourceMapConsumer:require("source-map/source-map-consumer").SourceMapConsumer,SourceMapGenerator:require("source-map/source-map-generator").SourceMapGenerator,SourceNode:require("source-map/source-node").SourceNode}
+
+var emscripten_sourcemap_xmlHttp = undefined;
+function emscripten_sourceMapLoaded() {
+ if (emscripten_sourcemap_xmlHttp.readyState === 4) {
+ Module['removeRunDependency']('sourcemap');
+ if (emscripten_sourcemap_xmlHttp.status === 200) {
+ emscripten_source_map = new window.sourceMap.SourceMapConsumer(emscripten_sourcemap_xmlHttp.responseText);
+ console.log('Source map data loaded.');
+ } else {
+ console.warn('Source map data loading failed with status code ' + emscripten_sourcemap_xmlHttp.status + '.');
+ }
+ emscripten_sourcemap_xmlHttp = undefined;
+ }
+}
+function emscripten_loadSourceMap() {
+ var url = window.location.href+'.map';
+ console.log('Loading source map data from ' + url + '..');
+ Module['addRunDependency']('sourcemap');
+ emscripten_sourcemap_xmlHttp = new XMLHttpRequest();
+ emscripten_sourcemap_xmlHttp.onreadystatechange = emscripten_sourceMapLoaded;
+ emscripten_sourcemap_xmlHttp.open("GET", url, true);
+ emscripten_sourcemap_xmlHttp.send(null);
+}
+
+var Module;
+if (Module['preRun'] instanceof Array) {
+ Module['preRun'].push(emscripten_loadSourceMap);
+} else {
+ Module['preRun'] = [emscripten_loadSourceMap];
+}
diff --git a/src/jsifier.js b/src/jsifier.js
index b5502741..6b831b04 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -1859,7 +1859,7 @@ function JSify(data, functionsOnly, givenFunctions) {
// first row are utilities called from generated code, second are needed from fastLong
['i64Add', 'i64Subtract', 'bitshift64Shl', 'bitshift64Lshr', 'bitshift64Ashr',
'llvm_ctlz_i32', 'llvm_cttz_i32'].forEach(function(func) {
- if (!Functions.libraryFunctions[func] || (phase == 'glue' && func[0] === 'l')) { // TODO: one-by-one in fastcomp glue mode
+ if (!Functions.libraryFunctions[func] || (phase == 'glue' && func[0] === 'l' && !addedLibraryItems[func])) { // TODO: one-by-one in fastcomp glue mode
print(processLibraryFunction(LibraryManager.library[func], func)); // must be first to be close to generated code
Functions.implementedFunctions['_' + func] = LibraryManager.library[func + '__sig'];
Functions.libraryFunctions[func] = phase == 'glue' ? 2 : 1; // XXX
diff --git a/src/library.js b/src/library.js
index bdc0a39e..fc731e01 100644
--- a/src/library.js
+++ b/src/library.js
@@ -8835,6 +8835,193 @@ LibraryManager.library = {
}
},
+ // Returns [parentFuncArguments, functionName, paramListName]
+ _emscripten_traverse_stack: function(args) {
+ if (!args || !args.callee || !args.callee.name) {
+ return [null, '', ''];
+ }
+
+ var funstr = args.callee.toString();
+ var funcname = args.callee.name;
+ var str = '(';
+ var first = true;
+ for(i in args) {
+ var a = args[i];
+ if (!first) {
+ str += ", ";
+ }
+ first = false;
+ if (typeof a === 'number' || typeof a === 'string') {
+ str += a;
+ } else {
+ str += '(' + typeof a + ')';
+ }
+ }
+ str += ')';
+ args = args.callee.caller.arguments;
+ if (first)
+ str = '';
+ return [args, funcname, str];
+ },
+
+ emscripten_get_callstack_js__deps: ['_emscripten_traverse_stack'],
+ emscripten_get_callstack_js: function(flags) {
+ var err = new Error();
+ if (!err.stack) {
+ Runtime.warnOnce('emscripten_get_callstack_js is not supported on this browser!');
+ return '';
+ }
+ var callstack = new Error().stack.toString();
+
+ // Find the symbols in the callstack that corresponds to the functions that report callstack information, and remove everyhing up to these from the output.
+ var iThisFunc = callstack.lastIndexOf('_emscripten_log');
+ var iThisFunc2 = callstack.lastIndexOf('_emscripten_get_callstack');
+ var iNextLine = callstack.indexOf('\n', Math.max(iThisFunc, iThisFunc2))+1;
+ callstack = callstack.slice(iNextLine);
+
+ // If user requested to see the original source stack, but no source map information is available, just fall back to showing the JS stack.
+ if (flags & 8/*EM_LOG_C_STACK*/ && typeof emscripten_source_map === 'undefined') {
+ Runtime.warnOnce('Source map information is not available, emscripten_log with EM_LOG_C_STACK will be ignored. Build with "--pre-js $EMSCRIPTEN/src/emscripten-source-map.min.js" linker flag to add source map loading to code.');
+ flags ^= 8/*EM_LOG_C_STACK*/;
+ flags |= 16/*EM_LOG_JS_STACK*/;
+ }
+
+ var stack_args = null;
+ if (flags & 128 /*EM_LOG_FUNC_PARAMS*/) {
+ // To get the actual parameters to the functions, traverse the stack via the unfortunately deprecated 'arguments.callee' method, if it works:
+ var stack_args = __emscripten_traverse_stack(arguments);
+ while (stack_args[1].indexOf('_emscripten_') >= 0)
+ stack_args = __emscripten_traverse_stack(stack_args[0]);
+ }
+
+ // Process all lines:
+ lines = callstack.split('\n');
+ callstack = '';
+ var firefoxRe = new RegExp('\\s*(.*?)@(.*):(.*)'); // Extract components of form ' Object._main@http://server.com:4324'
+ var chromeRe = new RegExp('\\s*at (.*?) \\\((.*):(.*):(.*)\\\)'); // Extract components of form ' at Object._main (http://server.com/file.html:4324:12)'
+
+ for(l in lines) {
+ var line = lines[l];
+
+ var jsSymbolName = '';
+ var file = '';
+ var lineno = 0;
+ var column = 0;
+
+ var parts = chromeRe.exec(line);
+ if (parts && parts.length == 5) {
+ jsSymbolName = parts[1];
+ file = parts[2];
+ lineno = parts[3];
+ column = parts[4];
+ } else {
+ parts = firefoxRe.exec(line);
+ if (parts && parts.length == 4) {
+ jsSymbolName = parts[1];
+ file = parts[2];
+ lineno = parts[3];
+ column = 0; // Firefox doesn't carry column information. See https://bugzilla.mozilla.org/show_bug.cgi?id=762556
+ } else {
+ // Was not able to extract this line for demangling/sourcemapping purposes. Output it as-is.
+ callstack += line + '\n';
+ continue;
+ }
+ }
+
+ // Try to demangle the symbol, but fall back to showing the original JS symbol name if not available.
+ var cSymbolName = (flags & 32/*EM_LOG_DEMANGLE*/) ? demangle(jsSymbolName) : jsSymbolName;
+ if (!cSymbolName) {
+ cSymbolName = jsSymbolName;
+ }
+
+ var haveSourceMap = false;
+
+ if (flags & 8/*EM_LOG_C_STACK*/) {
+ var orig = emscripten_source_map.originalPositionFor({line: lineno, column: column});
+ haveSourceMap = (orig && orig.source);
+ if (haveSourceMap) {
+ if (flags & 64/*EM_LOG_NO_PATHS*/) {
+ orig.source = orig.source.substring(orig.source.replace(/\\/g, "/").lastIndexOf('/')+1);
+ }
+ callstack += ' at ' + cSymbolName + ' (' + orig.source + ':' + orig.line + ':' + orig.column + ')\n';
+ }
+ }
+ if ((flags & 16/*EM_LOG_JS_STACK*/) || !haveSourceMap) {
+ if (flags & 64/*EM_LOG_NO_PATHS*/) {
+ file = file.substring(file.replace(/\\/g, "/").lastIndexOf('/')+1);
+ }
+ callstack += (haveSourceMap ? (' = '+jsSymbolName) : (' at '+cSymbolName)) + ' (' + file + ':' + lineno + ':' + column + ')\n';
+ }
+
+ // If we are still keeping track with the callstack by traversing via 'arguments.callee', print the function parameters as well.
+ if (flags & 128 /*EM_LOG_FUNC_PARAMS*/ && stack_args[0]) {
+ if (stack_args[1] == jsSymbolName && stack_args[2].length > 0) {
+ callstack = callstack.replace(/\s+$/, '');
+ callstack += ' with values: ' + stack_args[1] + stack_args[2] + '\n';
+ }
+ stack_args = __emscripten_traverse_stack(stack_args[0]);
+ }
+ }
+ // Trim extra whitespace at the end of the output.
+ callstack = callstack.replace(/\s+$/, '');
+ return callstack;
+ },
+
+ emscripten_get_callstack__deps: ['emscripten_get_callstack_js'],
+ emscripten_get_callstack: function(flags, str, maxbytes) {
+ var callstack = _emscripten_get_callstack_js(flags);
+ // User can query the required amount of bytes to hold the callstack.
+ if (!str || maxbytes <= 0) {
+ return callstack.length+1;
+ }
+ // Truncate output to avoid writing past bounds.
+ if (callstack.length > maxbytes-1) {
+ callstack.slice(0, maxbytes-1);
+ }
+ // Output callstack string as C string to HEAP.
+ writeStringToMemory(callstack, str, false);
+
+ // Return number of bytes written.
+ return callstack.length+1;
+ },
+
+ emscripten_log_js__deps: ['emscripten_get_callstack_js'],
+ emscripten_log_js: function(flags, str) {
+ if (flags & 24/*EM_LOG_C_STACK | EM_LOG_JS_STACK*/) {
+ str = str.replace(/\s+$/, ''); // Ensure the message and the callstack are joined cleanly with exactly one newline.
+ str += (str.length > 0 ? '\n' : '') + _emscripten_get_callstack_js(flags);
+ }
+
+ if (flags & 1 /*EM_LOG_CONSOLE*/) {
+ if (flags & 4 /*EM_LOG_ERROR*/) {
+ console.error(str);
+ } else if (flags & 2 /*EM_LOG_WARN*/) {
+ console.warn(str);
+ } else {
+ console.log(str);
+ }
+ } else if (flags & 6 /*EM_LOG_ERROR|EM_LOG_WARN*/) {
+ Module.printErr(str);
+ } else {
+ Module.print(str);
+ }
+ },
+
+ emscripten_log__deps: ['_formatString', 'emscripten_log_js'],
+ emscripten_log: function(flags, varargs) {
+ // Extract the (optionally-existing) printf format specifier field from varargs.
+ var format = {{{ makeGetValue('varargs', '0', 'i32', undefined, undefined, true) }}};
+ varargs += Math.max(Runtime.getNativeFieldSize('i32'), Runtime.getAlignSize('i32', null, true));
+ var str = '';
+ if (format) {
+ var result = __formatString(format, varargs);
+ for(var i = 0 ; i < result.length; ++i) {
+ str += String.fromCharCode(result[i]);
+ }
+ }
+ _emscripten_log_js(flags, str);
+ },
+
//============================
// emscripten vector ops
//============================
diff --git a/src/library_egl.js b/src/library_egl.js
index 73d5e544..11cf8951 100644
--- a/src/library_egl.js
+++ b/src/library_egl.js
@@ -264,6 +264,26 @@ var LibraryEGL = {
return 0;
}
+ // EGL 1.4 spec says default EGL_CONTEXT_CLIENT_VERSION is GLES1, but this is not supported by Emscripten.
+ // So user must pass EGL_CONTEXT_CLIENT_VERSION == 2 to initialize EGL.
+ var glesContextVersion = 1;
+ for(;;) {
+ var param = {{{ makeGetValue('contextAttribs', '0', 'i32') }}};
+ if (!param) break;
+ var value = {{{ makeGetValue('contextAttribs', '4', 'i32') }}};
+ if (param == 0x3098 /*EGL_CONTEXT_CLIENT_VERSION*/) {
+ glesContextVersion = value;
+ }
+ contextAttribs += 8;
+ }
+ if (glesContextVersion != 2) {
+#if GL_ASSERTIONS
+ Module.printErr('When initializing GLES2/WebGL1 via EGL, one must pass EGL_CONTEXT_CLIENT_VERSION = 2 to GL context attributes! GLES version ' + glesContextVersion + ' is not supported!');
+#endif
+ EGL.setErrorCode(0x3005 /* EGL_BAD_CONFIG */);
+ return 0; /* EGL_NO_CONTEXT */
+ }
+
_glutInitDisplayMode(0x92 /* GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH | GLUT_MULTISAMPLE */);
EGL.windowID = _glutCreateWindow();
if (EGL.windowID != 0) {
diff --git a/src/library_fs.js b/src/library_fs.js
index 5412185f..1e7856aa 100644
--- a/src/library_fs.js
+++ b/src/library_fs.js
@@ -961,7 +961,7 @@ mergeInto(LibraryManager.library, {
throw new FS.ErrnoError(ERRNO_CODES.EACCES);
}
if (!stream.stream_ops.mmap) {
- throw new FS.errnoError(ERRNO_CODES.ENODEV);
+ throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
}
return stream.stream_ops.mmap(stream, buffer, offset, length, position, prot, flags);
},
diff --git a/src/library_glfw.js b/src/library_glfw.js
index 647d4bb6..17e8956a 100644
--- a/src/library_glfw.js
+++ b/src/library_glfw.js
@@ -120,7 +120,6 @@ var LibraryGLFW = {
if (event.charCode) {
var char = GLFW.getUnicodeChar(event.charCode);
if (char !== null && GLFW.charFunc) {
- event.preventDefault();
Runtime.dynCall('vii', GLFW.charFunc, [event.charCode, 1]);
}
}
@@ -130,13 +129,18 @@ var LibraryGLFW = {
var key = GLFW.DOMToGLFWKeyCode(event.keyCode);
if (key && GLFW.keyFunc) {
GLFW.keys[key] = status;
- event.preventDefault();
Runtime.dynCall('vii', GLFW.keyFunc, [key, status]);
}
},
onKeydown: function(event) {
GLFW.onKeyChanged(event, 1);//GLFW_PRESS
+ // This logic comes directly from the sdl implementation. We cannot
+ // call preventDefault on all keydown events otherwise onKeyPress will
+ // not get called
+ if (event.keyCode === 8 /* backspace */ || event.keyCode === 9 /* tab */) {
+ event.preventDefault();
+ }
},
onKeyup: function(event) {
diff --git a/src/library_sdl.js b/src/library_sdl.js
index 40e5e3ab..2efc1271 100644
--- a/src/library_sdl.js
+++ b/src/library_sdl.js
@@ -1247,10 +1247,7 @@ var LibrarySDL = {
return 0;
},
- SDL_LowerBlit__deps: ['SDL_UpperBlit'],
- SDL_LowerBlit: function(src, srcrect, dst, dstrect) {
- return _SDL_UpperBlit(src, srcrect, dst, dstrect);
- },
+ SDL_LowerBlit: 'SDL_UpperBlit',
SDL_FillRect: function(surf, rect, color) {
var surfData = SDL.surfaces[surf];
diff --git a/src/modules.js b/src/modules.js
index b9b8ab5e..e2d3433f 100644
--- a/src/modules.js
+++ b/src/modules.js
@@ -284,8 +284,8 @@ var Functions = {
var chunks = getNumIntChunks(type);
if (chunks > 0) {
for (var j = 0; j < chunks; j++) sig += 'i';
- } else {
- // some special type like a SIMD vector
+ } else if (type !== '...') {
+ // some special type like a SIMD vector (anything but varargs, which we handle below)
sig += Functions.getSignatureLetter(type);
}
}
@@ -429,6 +429,26 @@ var LibraryManager = {
eval(processMacros(preprocess(read(libraries[i]))));
}
+ /*
+ // export code for CallHandlers.h
+ printErr('============================');
+ for (var x in this.library) {
+ var y = this.library[x];
+ if (typeof y === 'string' && x.indexOf('__sig') < 0 && x.indexOf('__postset') < 0 && y.indexOf(' ') < 0) {
+ printErr('DEF_REDIRECT_HANDLER(' + x + ', ' + y + ');');
+ }
+ }
+ printErr('============================');
+ for (var x in this.library) {
+ var y = this.library[x];
+ if (typeof y === 'string' && x.indexOf('__sig') < 0 && x.indexOf('__postset') < 0 && y.indexOf(' ') < 0) {
+ printErr(' SETUP_CALL_HANDLER(' + x + ');');
+ }
+ }
+ printErr('============================');
+ // end export code for CallHandlers.h
+ */
+
this.loaded = true;
},
diff --git a/src/preamble.js b/src/preamble.js
index 710b7c52..832ec2c3 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -642,6 +642,10 @@ Module['stringToUTF32'] = stringToUTF32;
function demangle(func) {
try {
+ // Special-case the entry point, since its name differs from other name mangling.
+ if (func == 'Object._main' || func == '_main') {
+ return 'main()';
+ }
if (typeof func === 'number') func = Pointer_stringify(func);
if (func[0] !== '_') return func;
if (func[1] !== '_') return func; // C function
diff --git a/system/include/emscripten/emscripten.h b/system/include/emscripten/emscripten.h
index ddcbc43a..b6e6307b 100644
--- a/system/include/emscripten/emscripten.h
+++ b/system/include/emscripten/emscripten.h
@@ -447,6 +447,70 @@ void emscripten_asm_const(const char *code);
int emscripten_asm_const_int(const char *code, ...);
double emscripten_asm_const_double(const char *code, ...);
+/* If specified, logs directly to the browser console/inspector
+ * window. If not specified, logs via the application Module. */
+#define EM_LOG_CONSOLE 1
+/* If specified, prints a warning message. */
+#define EM_LOG_WARN 2
+/* If specified, prints an error message. If neither EM_LOG_WARN
+ * or EM_LOG_ERROR is specified, an info message is printed.
+ * EM_LOG_WARN and EM_LOG_ERROR are mutually exclusive. */
+#define EM_LOG_ERROR 4
+/* If specified, prints a callstack that contains filenames referring
+ * to original C sources using source map information. */
+#define EM_LOG_C_STACK 8
+/* If specified, prints a callstack that contains filenames referring
+ * to lines to the built .js/.html file along with the message. The
+ * flags EM_LOG_C_STACK and EM_LOG_JS_STACK can be combined to output
+ * both untranslated and translated file+line information. */
+#define EM_LOG_JS_STACK 16
+/* If specified, C/C++ function names are demangled before printing.
+ * Otherwise, the mangled post-compilation JS function names are
+ * displayed. */
+#define EM_LOG_DEMANGLE 32
+/* If specified, the pathnames of the file information in the call
+ * stack will be omitted. */
+#define EM_LOG_NO_PATHS 64
+/* If specified, prints out the actual values of the parameters the
+ * functions were invoked with. */
+#define EM_LOG_FUNC_PARAMS 128
+
+/*
+ * Prints out a message to the console, optionally with the
+ * callstack information.
+ * @param flags A binary OR of items from the list of EM_LOG_xxx
+ * flags that specify printing options.
+ * @param '...' A printf-style "format, ..." parameter list that
+ * is parsed according to the printf formatting rules.
+ */
+void emscripten_log(int flags, ...);
+
+/*
+ * Programmatically obtains the current callstack.
+ * @param flags A binary OR of items from the list of EM_LOG_xxx
+ * flags that specify printing options. The
+ * items EM_LOG_CONSOLE, EM_LOG_WARN and
+ * EM_LOG_ERROR do not apply in this function and
+ * are ignored.
+ * @param out A pointer to a memory region where the callstack
+ * string will be written to. The string outputted
+ * by this function will always be null-terminated.
+ * @param maxbytes The maximum number of bytes that this function can
+ * write to the memory pointed to by 'out'. If
+ * there is no enough space, the output will be
+ * truncated (but always null-terminated).
+ * @return Returns the number of bytes written. (not number of
+ * characters, so this will also include the terminating zero)
+
+ * To query the amount of bytes needed for a callstack without writing
+ * it, pass 0 to 'out' and 'maxbytes', in which case the function will
+ * return the number of bytes (including the terminating zero) that
+ * will be needed to hold the full callstack. Note that this might be
+ * fully accurate since subsequent calls will carry different line
+ * numbers, so it is best to allocate a few bytes extra to be safe.
+ */
+int emscripten_get_callstack(int flags, char *out, int maxbytes);
+
#ifdef __cplusplus
}
#endif
diff --git a/tests/cases/caall.ll b/tests/cases/caall.ll
index 5b8f7f29..2cc231ec 100644
--- a/tests/cases/caall.ll
+++ b/tests/cases/caall.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]*]
@@ -11,14 +11,14 @@ entry:
store i32 0, i32* %retval
%call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ; [#uses=0 type=i32]
%call12 = call void (i32*)** @_ZNSt3__13mapINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPFvP6ObjectENS_4lessIS6_EENS4_INS_4pairIKS6_SA_EEEEEixERSE_(i32 10)
- %26 = load void (%class.Object*)** %call12
+ %l26 = load void (i32*)** %call12
ret i32 1
}
-define (i32*)** @_ZNSt3__13mapINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPFvP6ObjectENS_4lessIS6_EENS4_INS_4pairIKS6_SA_EEEEEixERSE_(i32 %x) {
+define void (i32*)** @_ZNSt3__13mapINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPFvP6ObjectENS_4lessIS6_EENS4_INS_4pairIKS6_SA_EEEEEixERSE_(i32 %x) {
entry:
- %ret = inttoptr i32 0 to (i32*)**
- ret (i32*)** %ret
+ %ret = inttoptr i32 0 to void (i32*)**
+ ret void (i32*)** %ret
}
; [#uses=1]
diff --git a/tests/cases/emptyalloca.ll b/tests/cases/emptyalloca.ll
new file mode 100644
index 00000000..f12a4161
--- /dev/null
+++ b/tests/cases/emptyalloca.ll
@@ -0,0 +1,31 @@
+; ModuleID = '/tmp/tmpjSNiky/a.out.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 [30 x i8] c"Module.print('hello, world!')\00", align 1
+
+; Function Attrs: nounwind
+define internal void @_Z9doNothingPi(i32* %arr) #0 {
+ %1 = alloca i32*, align 4
+ store i32* %arr, i32** %1, align 4
+ ret void
+}
+
+define i32 @main() #1 {
+ %arr = alloca [0 x i32], align 4
+ %1 = bitcast [0 x i32]* %arr to i8*
+ call void @llvm.memset.p0i8.i32(i8* %1, i8 0, i32 0, i32 4, i1 false)
+ %2 = getelementptr inbounds [0 x i32]* %arr, i32 0, i32 0
+ call void @_Z9doNothingPi(i32* %2)
+ call void @emscripten_asm_const(i8* getelementptr inbounds ([30 x i8]* @.str, i32 0, i32 0))
+ ret i32 0
+}
+
+; Function Attrs: nounwind
+declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) #2
+
+declare void @emscripten_asm_const(i8*) #1
+
+attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #2 = { nounwind }
diff --git a/tests/cases/i24_mem_ta2.ll b/tests/cases/i24_mem_ta2.ll
index e50014ca..550389fe 100644
--- a/tests/cases/i24_mem_ta2.ll
+++ b/tests/cases/i24_mem_ta2.ll
@@ -1,8 +1,8 @@
; 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".%x.\0A\00", align 1 ; [#uses=1 type=[5 x i8]*]
+@.str = private unnamed_addr constant [6 x i8] c".%x.\0A\00", align 1 ; [#uses=1 type=[5 x i8]*]
define i32 @main() {
entry:
@@ -11,11 +11,11 @@ entry:
%i24 = bitcast i32* %mem to i24*
%load = load i24* %i24, align 4
%load32 = zext i24 %load to i32
- %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([5 x i8]* @.str, i32 0, i32 0), i32 %load32)
+ %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 0), i32 %load32)
%val_24 = trunc i32 4041265344 to i24
store i24 %val_24, i24* %i24, align 4
%load32b = load i32* %mem, align 4
- %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([5 x i8]* @.str, i32 0, i32 0), i32 %load32b)
+ %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 0), i32 %load32b)
ret i32 1
}
diff --git a/tests/cases/i64toi8star.ll b/tests/cases/i64toi8star.ll
index d4a39340..b2307449 100644
--- a/tests/cases/i64toi8star.ll
+++ b/tests/cases/i64toi8star.ll
@@ -25,8 +25,8 @@ entry:
%retval = alloca i32 ; [#uses=2]
%0 = alloca i32 ; [#uses=2]
%"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
- %5 = call i32 @PyLong_FromVoidPtr(i8* null) nounwind ; [#uses=0]
- %13 = call i32 @PyLong_FromVoidPtr(i8* inttoptr (i64 1 to i8*)) nounwind ; [#uses=0]
- %1 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0]
+ %a5 = call i32 @PyLong_FromVoidPtr(i8* null) nounwind ; [#uses=0]
+ %a13 = call i32 @PyLong_FromVoidPtr(i8* inttoptr (i64 1 to i8*)) nounwind ; [#uses=0]
+ %a1 = call i32 @puts(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0]
ret i32 0
}
diff --git a/tests/cases/inttoptr.ll b/tests/cases/inttoptr.ll
index b0711672..c1b40a74 100644
--- a/tests/cases/inttoptr.ll
+++ b/tests/cases/inttoptr.ll
@@ -1,6 +1,6 @@
; ModuleID = '/tmp/emscripten/tmp/src.cpp.o'
-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"
-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 constant [14 x i8] c"hello, world!\00", align 1 ; [#uses=1]
@@ -14,7 +14,7 @@ entry:
%0 = alloca i32 ; [#uses=2]
%"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
%sz.i7 = inttoptr i32 64 to i32* ; [#uses=1 type=i32*]
- store i32 184, i32* %sz.i7, align 8, !tbaa !1610
- %1 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0]
+ store i32 184, i32* %sz.i7, align 8
+ %1 = call i32 @puts(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0]
ret i32 0
}
diff --git a/tests/cases/invokebitcast.ll b/tests/cases/invokebitcast.ll
index ffb5803f..ec090b0d 100644
--- a/tests/cases/invokebitcast.ll
+++ b/tests/cases/invokebitcast.ll
@@ -1,7 +1,7 @@
; ModuleID = '/dev/shm/tmp/src.cpp.o'
; Just test for compilation here
-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-f128:128:128-n8:16:32"
-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"
%struct.CPU_Regs = type { [8 x %union.GenReg32] }
%union.GenReg32 = type { [1 x i32] }
@@ -16,7 +16,8 @@ entry:
%0 = alloca i32 ; [#uses=2]
%"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
%1 = load i32* bitcast (i32* getelementptr inbounds (%struct.CPU_Regs* @cpu_regs, i32 0, i32 0, i32 1, i32 0, i32 0) to i32*), align 2 ; [#uses=1]
- store i16 %1, i16* bitcast (%struct.CPU_Regs* @cpu_regs to i16*), align 2
+ %s = trunc i32 %1 to i16
+ store i16 %s, i16* bitcast (%struct.CPU_Regs* @cpu_regs to i16*), align 2
%2 = call i32 @puts(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0]
store i32 0, i32* %0, align 4
%3 = load i32* %0, align 4 ; [#uses=1]
diff --git a/tests/cases/phicubed.ll b/tests/cases/phicubed.ll
index a0799997..5fc3208b 100644
--- a/tests/cases/phicubed.ll
+++ b/tests/cases/phicubed.ll
@@ -1,4 +1,6 @@
; ModuleID = '/dev/shm/tmp/src.cpp.o'
+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"
%struct.worker_args = type { i32, %struct.worker_args* }
diff --git a/tests/cases/phientryimplicit.ll b/tests/cases/phientryimplicit.ll
index 8a510f43..c237457c 100644
--- a/tests/cases/phientryimplicit.ll
+++ b/tests/cases/phientryimplicit.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"
; Phi nodes can refer to the entry. And the entry might be unnamed, and doesn't even have a consistent implicit name!
@@ -9,35 +9,35 @@ target triple = "i386-pc-linux-gnu"
; [#uses=0]
define i32 @main() {
%retval = alloca i32, align 4 ; [#uses=1 type=i32*]
- %16 = trunc i32 1 to i1
- br i1 %16, label %17, label %26, !dbg !1269853 ; [debug line = 3920:5]
+ %a16 = trunc i32 1 to i1
+ br i1 %a16, label %L17, label %L26, !dbg !1269853 ; [debug line = 3920:5]
-; <label>:17 ; preds = %1
- %25 = trunc i32 1 to i1
- br label %26
+L17:
+ %a25 = trunc i32 1 to i1
+ br label %L26
-; <label>:26 ; preds = %17, %1
- %27 = phi i1 [ false, %1 ], [ %25, %17 ] ; [#uses=1 type=i1]
+L26:
+ %a27 = phi i1 [ false, %1 ], [ %a25, %L17 ] ; [#uses=1 type=i1]
store i32 0, i32* %retval
%call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ; [#uses=0 type=i32]
- %cal2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), i32 %27) ; make sure %27 is used
+ %cal2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), i1 %a27) ; make sure %27 is used
ret i32 1
}
define i32 @main0() {
%retval = alloca i32, align 4 ; [#uses=1 type=i32*]
- %16 = trunc i32 1 to i1
- br i1 %16, label %17, label %26, !dbg !1269853 ; [debug line = 3920:5]
+ %a16 = trunc i32 1 to i1
+ br i1 %a16, label %L17, label %L26, !dbg !1269853 ; [debug line = 3920:5]
-; <label>:17 ; preds = %1
- %25 = trunc i32 1 to i1
- br label %26
+L17:
+ %a25 = trunc i32 1 to i1
+ br label %L26
-; <label>:26 ; preds = %17, %1
- %27 = phi i1 [ false, %0 ], [ %25, %17 ] ; [#uses=1 type=i1]
+L26:
+ %a27 = phi i1 [ false, %0 ], [ %a25, %L17 ] ; [#uses=1 type=i1]
store i32 0, i32* %retval
%call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ; [#uses=0 type=i32]
- %cal2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), i32 %27) ; make sure %27 is used
+ %cal2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), i1 %a27) ; make sure %27 is used
ret i32 1
}
diff --git a/tests/cases/phiself.ll b/tests/cases/phiself.ll
index 81249799..0a06fcca 100644
--- a/tests/cases/phiself.ll
+++ b/tests/cases/phiself.ll
@@ -1,6 +1,6 @@
; ModuleID = '/tmp/emscripten_temp/src.cpp.o'
-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 [7 x i8] c"cheez\0A\00", align 1
@.str1 = private unnamed_addr constant [6 x i8] c"*%d*\0A\00", align 1
diff --git a/tests/cases/ptrtoi64.ll b/tests/cases/ptrtoi64.ll
index 01e466fe..5898f529 100644
--- a/tests/cases/ptrtoi64.ll
+++ b/tests/cases/ptrtoi64.ll
@@ -1,8 +1,8 @@
; pointer to i64, then to i32
; ModuleID = '/tmp/emscripten/tmp/src.cpp.o'
-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"
-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"
@.str2 = private constant [9 x i8] c"*%d,%d*\0A\00", align 1 ; [#uses=1]
@@ -18,10 +18,10 @@ entry:
%0 = alloca i32 ; [#uses=2]
%"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
%sz.i7 = inttoptr i32 400 to i32* ; [#uses=1 type=i32*]
- %10 = ptrtoint i32* %sz.i7 to i64, !dbg !8557 ; [#uses=1 type=i64] [debug line = 99:3]
- %conv5 = trunc i64 %10 to i32, !dbg !8557 ; [#uses=1 type=i32] [debug line = 99:3]
- %11 = ptrtoint i32* %sz.i7 to i8, !dbg !8557 ; [#uses=1 type=i64] [debug line = 99:3]
- %conv6 = zext i8 %11 to i32, !dbg !8557 ; [#uses=1 type=i32] [debug line = 99:3]
- %55 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([9 x i8]* @.str2, i32 0, i32 0), i32 %conv5, i32 %conv6) ; [#uses=0]
+ %a10 = ptrtoint i32* %sz.i7 to i64
+ %conv5 = trunc i64 %a10 to i32
+ %a11 = ptrtoint i32* %sz.i7 to i8
+ %conv6 = zext i8 %a11 to i32
+ %a55 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([9 x i8]* @.str2, i32 0, i32 0), i32 %conv5, i32 %conv6)
ret i32 0
}
diff --git a/tests/cases/sillybitcast.ll b/tests/cases/sillybitcast.ll
index c5ca4f9a..50a54da9 100644
--- a/tests/cases/sillybitcast.ll
+++ b/tests/cases/sillybitcast.ll
@@ -1,6 +1,6 @@
; ModuleID = '/tmp/emscripten/tmp/src.cpp.o'
-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"
-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 constant [14 x i8] c"hello, world!\00", align 1 ; [#uses=1]
diff --git a/tests/cases/sillybitcast2.ll b/tests/cases/sillybitcast2.ll
new file mode 100644
index 00000000..02cf8615
--- /dev/null
+++ b/tests/cases/sillybitcast2.ll
@@ -0,0 +1,35 @@
+; ModuleID = '/tmp/emscripten/tmp/src.cpp.o'
+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 [14 x i8] c"hello, world!\00", align 1 ; [#uses=1]
+
+; [#uses=2]
+define void @"_Z5hellov"() {
+entry:
+ %0 = call i32 bitcast (i32 (i32*)* @puts to i32 (i8*)*)(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+; [#uses=1]
+declare i32 @puts(i32*)
+
+; [#uses=0]
+define i32 @main() {
+entry:
+ %retval = alloca i32 ; [#uses=2]
+ %0 = alloca i32 ; [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
+ call void @"_Z5hellov"()
+ store i32 0, i32* %0, align 4
+ %1 = load i32* %0, align 4 ; [#uses=1]
+ store i32 %1, i32* %retval, align 4
+ br label %return
+
+return: ; preds = %entry
+ %retval1 = load i32* %retval ; [#uses=1]
+ ret i32 %retval1
+}
diff --git a/tests/cases/unaligneddouble.ll b/tests/cases/unaligneddouble.ll
index 22b92741..e4067831 100644
--- a/tests/cases/unaligneddouble.ll
+++ b/tests/cases/unaligneddouble.ll
@@ -10,7 +10,7 @@ entry:
%retval = alloca i32, align 4 ; [#uses=1 type=i32*]
%doub = alloca double, align 4
store i32 0, i32* %retval
- %0 = bitcast double* %doub to i32
+ %0 = ptrtoint double* %doub to i32
%1 = uitofp i32 %0 to double
store double %1, double* %doub, align 1
store double %1, double* %doub, align 2
diff --git a/tests/core/test_addr_of_stacked.in b/tests/core/test_addr_of_stacked.in
index af5a6e32..7a4d9ba7 100644
--- a/tests/core/test_addr_of_stacked.in
+++ b/tests/core/test_addr_of_stacked.in
@@ -1,14 +1,8 @@
-
- #include <stdio.h>
- void alter(int *y)
- {
- *y += 5;
- }
- int main()
- {
- int x = 2;
- alter(&x);
- printf("*%d*\n", x);
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+void alter(int *y) { *y += 5; }
+int main() {
+ int x = 2;
+ alter(&x);
+ printf("*%d*\n", x);
+ return 0;
+}
diff --git a/tests/core/test_alloca.in b/tests/core/test_alloca.in
index 7b53e56c..bfad3324 100644
--- a/tests/core/test_alloca.in
+++ b/tests/core/test_alloca.in
@@ -1,11 +1,9 @@
+#include <stdio.h>
+#include <stdlib.h>
- #include <stdio.h>
- #include <stdlib.h>
-
- int main() {
- char *pc;
- pc = (char *)alloca(5);
- printf("z:%d*%d*\n", pc > 0, (int)pc);
- return 0;
- }
- \ No newline at end of file
+int main() {
+ char *pc;
+ pc = (char *)alloca(5);
+ printf("z:%d*%d*\n", pc > 0, (int)pc);
+ return 0;
+}
diff --git a/tests/core/test_alloca_stack.in b/tests/core/test_alloca_stack.in
index ab7c7306..ba3afcc7 100644
--- a/tests/core/test_alloca_stack.in
+++ b/tests/core/test_alloca_stack.in
@@ -1,19 +1,16 @@
-
// We should not blow up the stack with numerous allocas
- #include <stdio.h>
- #include <stdlib.h>
+#include <stdio.h>
+#include <stdlib.h>
- func(int i) {
- char *pc = (char *)alloca(100);
- *pc = i;
- (*pc)++;
- return (*pc) % 10;
- }
- int main() {
- int total = 0;
- for (int i = 0; i < 1024*1024; i++)
- total += func(i);
- printf("ok:%d*\n", total);
- return 0;
- }
-
+func(int i) {
+ char *pc = (char *)alloca(100);
+ *pc = i;
+ (*pc)++;
+ return (*pc) % 10;
+}
+int main() {
+ int total = 0;
+ for (int i = 0; i < 1024 * 1024; i++) total += func(i);
+ printf("ok:%d*\n", total);
+ return 0;
+}
diff --git a/tests/core/test_array2.in b/tests/core/test_array2.in
index 0e5bcbfb..452e0792 100644
--- a/tests/core/test_array2.in
+++ b/tests/core/test_array2.in
@@ -1,15 +1,13 @@
+#include <stdio.h>
- #include <stdio.h>
+static const double grid[4][2] = {{-3 / 3., -1 / 3.},
+ {+1 / 3., -3 / 3.},
+ {-1 / 3., +3 / 3.},
+ {+3 / 3., +1 / 3.}};
- static const double grid[4][2] = {
- {-3/3.,-1/3.},{+1/3.,-3/3.},
- {-1/3.,+3/3.},{+3/3.,+1/3.}
- };
-
- int main() {
- for (int i = 0; i < 4; i++)
- printf("%d:%.2f,%.2f ", i, grid[i][0], grid[i][1]);
- printf("\n");
- return 0;
- }
- \ No newline at end of file
+int main() {
+ for (int i = 0; i < 4; i++)
+ printf("%d:%.2f,%.2f ", i, grid[i][0], grid[i][1]);
+ printf("\n");
+ return 0;
+}
diff --git a/tests/core/test_array2b.in b/tests/core/test_array2b.in
index b94821d8..97ace8db 100644
--- a/tests/core/test_array2b.in
+++ b/tests/core/test_array2b.in
@@ -1,16 +1,12 @@
+#include <stdio.h>
- #include <stdio.h>
+static const struct {
+ unsigned char left;
+ unsigned char right;
+} prioritah[] = {{6, 6}, {6, 6}, {7, 95}, {7, 7}};
- static const struct {
- unsigned char left;
- unsigned char right;
- } prioritah[] = {
- {6, 6}, {6, 6}, {7, 95}, {7, 7}
- };
-
- int main() {
- printf("*%d,%d\n", prioritah[1].left, prioritah[1].right);
- printf("%d,%d*\n", prioritah[2].left, prioritah[2].right);
- return 0;
- }
- \ No newline at end of file
+int main() {
+ printf("*%d,%d\n", prioritah[1].left, prioritah[1].right);
+ printf("%d,%d*\n", prioritah[2].left, prioritah[2].right);
+ return 0;
+}
diff --git a/tests/core/test_assert.in b/tests/core/test_assert.in
index 7547468e..3a1898fa 100644
--- a/tests/core/test_assert.in
+++ b/tests/core/test_assert.in
@@ -1,9 +1,7 @@
-
- #include <stdio.h>
- #include <assert.h>
- int main() {
- assert(1 == true); // pass
- assert(1 == false); // fail
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+#include <assert.h>
+int main() {
+ assert(1 == true); // pass
+ assert(1 == false); // fail
+ return 0;
+}
diff --git a/tests/core/test_atexit.in b/tests/core/test_atexit.in
index 56489a6c..b40c01c0 100644
--- a/tests/core/test_atexit.in
+++ b/tests/core/test_atexit.in
@@ -1,17 +1,11 @@
+#include <stdio.h>
+#include <stdlib.h>
- #include <stdio.h>
- #include <stdlib.h>
+static void cleanA() { printf("A"); }
+static void cleanB() { printf("B"); }
- static void cleanA() {
- printf("A");
- }
- static void cleanB() {
- printf("B");
- }
-
- int main() {
- atexit(cleanA);
- atexit(cleanB);
- return 0;
- }
- \ No newline at end of file
+int main() {
+ atexit(cleanA);
+ atexit(cleanB);
+ return 0;
+}
diff --git a/tests/core/test_atoX.in b/tests/core/test_atoX.in
index 8325acfa..327871b8 100644
--- a/tests/core/test_atoX.in
+++ b/tests/core/test_atoX.in
@@ -1,42 +1,40 @@
+#include <stdio.h>
+#include <stdlib.h>
- #include <stdio.h>
- #include <stdlib.h>
-
- int main () {
- printf("%d*", atoi(""));
- printf("%d*", atoi("a"));
- printf("%d*", atoi(" b"));
- printf("%d*", atoi(" c "));
- printf("%d*", atoi("6"));
- printf("%d*", atoi(" 5"));
- printf("%d*", atoi("4 "));
- printf("%d*", atoi("3 6"));
- printf("%d*", atoi(" 3 7"));
- printf("%d*", atoi("9 d"));
- printf("%d\n", atoi(" 8 e"));
- printf("%d*", atol(""));
- printf("%d*", atol("a"));
- printf("%d*", atol(" b"));
- printf("%d*", atol(" c "));
- printf("%d*", atol("6"));
- printf("%d*", atol(" 5"));
- printf("%d*", atol("4 "));
- printf("%d*", atol("3 6"));
- printf("%d*", atol(" 3 7"));
- printf("%d*", atol("9 d"));
- printf("%d\n", atol(" 8 e"));
- printf("%lld*", atoll("6294967296"));
- printf("%lld*", atoll(""));
- printf("%lld*", atoll("a"));
- printf("%lld*", atoll(" b"));
- printf("%lld*", atoll(" c "));
- printf("%lld*", atoll("6"));
- printf("%lld*", atoll(" 5"));
- printf("%lld*", atoll("4 "));
- printf("%lld*", atoll("3 6"));
- printf("%lld*", atoll(" 3 7"));
- printf("%lld*", atoll("9 d"));
- printf("%lld\n", atoll(" 8 e"));
- return 0;
- }
- \ No newline at end of file
+int main() {
+ printf("%d*", atoi(""));
+ printf("%d*", atoi("a"));
+ printf("%d*", atoi(" b"));
+ printf("%d*", atoi(" c "));
+ printf("%d*", atoi("6"));
+ printf("%d*", atoi(" 5"));
+ printf("%d*", atoi("4 "));
+ printf("%d*", atoi("3 6"));
+ printf("%d*", atoi(" 3 7"));
+ printf("%d*", atoi("9 d"));
+ printf("%d\n", atoi(" 8 e"));
+ printf("%d*", atol(""));
+ printf("%d*", atol("a"));
+ printf("%d*", atol(" b"));
+ printf("%d*", atol(" c "));
+ printf("%d*", atol("6"));
+ printf("%d*", atol(" 5"));
+ printf("%d*", atol("4 "));
+ printf("%d*", atol("3 6"));
+ printf("%d*", atol(" 3 7"));
+ printf("%d*", atol("9 d"));
+ printf("%d\n", atol(" 8 e"));
+ printf("%lld*", atoll("6294967296"));
+ printf("%lld*", atoll(""));
+ printf("%lld*", atoll("a"));
+ printf("%lld*", atoll(" b"));
+ printf("%lld*", atoll(" c "));
+ printf("%lld*", atoll("6"));
+ printf("%lld*", atoll(" 5"));
+ printf("%lld*", atoll("4 "));
+ printf("%lld*", atoll("3 6"));
+ printf("%lld*", atoll(" 3 7"));
+ printf("%lld*", atoll("9 d"));
+ printf("%lld\n", atoll(" 8 e"));
+ return 0;
+}
diff --git a/tests/core/test_atomic.in b/tests/core/test_atomic.in
index d0950551..2390941f 100644
--- a/tests/core/test_atomic.in
+++ b/tests/core/test_atomic.in
@@ -1,20 +1,18 @@
-
- #include <stdio.h>
- int main() {
- int x = 10;
- int y = __sync_add_and_fetch(&x, 5);
- printf("*%d,%d*\n", x, y);
- x = 10;
- y = __sync_fetch_and_add(&x, 5);
- printf("*%d,%d*\n", x, y);
- x = 10;
- y = __sync_lock_test_and_set(&x, 6);
- printf("*%d,%d*\n", x, y);
- x = 10;
- y = __sync_bool_compare_and_swap(&x, 9, 7);
- printf("*%d,%d*\n", x, y);
- y = __sync_bool_compare_and_swap(&x, 10, 7);
- printf("*%d,%d*\n", x, y);
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+int main() {
+ int x = 10;
+ int y = __sync_add_and_fetch(&x, 5);
+ printf("*%d,%d*\n", x, y);
+ x = 10;
+ y = __sync_fetch_and_add(&x, 5);
+ printf("*%d,%d*\n", x, y);
+ x = 10;
+ y = __sync_lock_test_and_set(&x, 6);
+ printf("*%d,%d*\n", x, y);
+ x = 10;
+ y = __sync_bool_compare_and_swap(&x, 9, 7);
+ printf("*%d,%d*\n", x, y);
+ y = __sync_bool_compare_and_swap(&x, 10, 7);
+ printf("*%d,%d*\n", x, y);
+ return 0;
+}
diff --git a/tests/core/test_bigarray.in b/tests/core/test_bigarray.in
index 0255c207..292a44e5 100644
--- a/tests/core/test_bigarray.in
+++ b/tests/core/test_bigarray.in
@@ -1,19 +1,22 @@
-
// avoid "array initializer too large" errors
- #include <stdio.h>
- #include <assert.h>
+#include <stdio.h>
+#include <assert.h>
- #define SIZE (1024*100)
- struct Struct {
- char x;
- int y;
- };
- Struct buffy[SIZE];
+#define SIZE (1024 * 100)
+struct Struct {
+ char x;
+ int y;
+};
+Struct buffy[SIZE];
- int main() {
- for (int i = 0; i < SIZE; i++) { assert(buffy[i].x == 0 && buffy[i].y == 0); } // we were zeroinitialized
- for (int i = 0; i < SIZE; i++) { buffy[i].x = i*i; buffy[i].y = i*i*i; } // we can save data
- printf("*%d*\n", buffy[SIZE/3].x);
- return 0;
- }
-
+int main() {
+ for (int i = 0; i < SIZE; i++) {
+ assert(buffy[i].x == 0 && buffy[i].y == 0);
+ } // we were zeroinitialized
+ for (int i = 0; i < SIZE; i++) {
+ buffy[i].x = i * i;
+ buffy[i].y = i * i * i;
+ } // we can save data
+ printf("*%d*\n", buffy[SIZE / 3].x);
+ return 0;
+}
diff --git a/tests/core/test_bitfields.in b/tests/core/test_bitfields.in
index 08831f23..cbc7ccf2 100644
--- a/tests/core/test_bitfields.in
+++ b/tests/core/test_bitfields.in
@@ -1,23 +1,20 @@
-
- #include <stdio.h>
- struct bitty {
- unsigned x : 1;
- unsigned y : 1;
- unsigned z : 1;
- };
- int main()
- {
- bitty b;
- printf("*");
- for (int i = 0; i <= 1; i++)
- for (int j = 0; j <= 1; j++)
- for (int k = 0; k <= 1; k++) {
- b.x = i;
- b.y = j;
- b.z = k;
- printf("%d,%d,%d,", b.x, b.y, b.z);
- }
- printf("*\n");
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+struct bitty {
+ unsigned x : 1;
+ unsigned y : 1;
+ unsigned z : 1;
+};
+int main() {
+ bitty b;
+ printf("*");
+ for (int i = 0; i <= 1; i++)
+ for (int j = 0; j <= 1; j++)
+ for (int k = 0; k <= 1; k++) {
+ b.x = i;
+ b.y = j;
+ b.z = k;
+ printf("%d,%d,%d,", b.x, b.y, b.z);
+ }
+ printf("*\n");
+ return 0;
+}
diff --git a/tests/core/test_bsearch.in b/tests/core/test_bsearch.in
index 285210bd..3b5fb6bc 100644
--- a/tests/core/test_bsearch.in
+++ b/tests/core/test_bsearch.in
@@ -1,47 +1,45 @@
-
- #include <stdlib.h>
- #include <stdio.h>
-
- int cmp(const void* key, const void* member) {
- return *(int *)key - *(int *)member;
- }
-
- void printResult(int* needle, int* haystack, unsigned int len) {
- void *result = bsearch(needle, haystack, len, sizeof(unsigned int), cmp);
-
- if (result == NULL) {
- printf("null\n");
- } else {
- printf("%d\n", *(unsigned int *)result);
- }
- }
-
- int main() {
- int a[] = { -2, -1, 0, 6, 7, 9 };
- int b[] = { 0, 1 };
-
- /* Find all keys that exist. */
- for(int i = 0; i < 6; i++) {
- int val = a[i];
-
- printResult(&val, a, 6);
- }
-
- /* Keys that are covered by the range of the array but aren't in
- * the array cannot be found.
- */
- int v1 = 3;
- int v2 = 8;
- printResult(&v1, a, 6);
- printResult(&v2, a, 6);
-
- /* Keys outside the range of the array cannot be found. */
- int v3 = -1;
- int v4 = 2;
-
- printResult(&v3, b, 2);
- printResult(&v4, b, 2);
-
- return 0;
- }
- \ No newline at end of file
+#include <stdlib.h>
+#include <stdio.h>
+
+int cmp(const void* key, const void* member) {
+ return *(int*)key - *(int*)member;
+}
+
+void printResult(int* needle, int* haystack, unsigned int len) {
+ void* result = bsearch(needle, haystack, len, sizeof(unsigned int), cmp);
+
+ if (result == NULL) {
+ printf("null\n");
+ } else {
+ printf("%d\n", *(unsigned int*)result);
+ }
+}
+
+int main() {
+ int a[] = {-2, -1, 0, 6, 7, 9};
+ int b[] = {0, 1};
+
+ /* Find all keys that exist. */
+ for (int i = 0; i < 6; i++) {
+ int val = a[i];
+
+ printResult(&val, a, 6);
+ }
+
+ /* Keys that are covered by the range of the array but aren't in
+ * the array cannot be found.
+ */
+ int v1 = 3;
+ int v2 = 8;
+ printResult(&v1, a, 6);
+ printResult(&v2, a, 6);
+
+ /* Keys outside the range of the array cannot be found. */
+ int v3 = -1;
+ int v4 = 2;
+
+ printResult(&v3, b, 2);
+ printResult(&v4, b, 2);
+
+ return 0;
+}
diff --git a/tests/core/test_bswap64.in b/tests/core/test_bswap64.in
index addf6086..a608ad22 100644
--- a/tests/core/test_bswap64.in
+++ b/tests/core/test_bswap64.in
@@ -1,56 +1,48 @@
-
- #include <stdio.h>
- #include <stdlib.h>
-
- #include <iostream>
- #include <string>
- #include <sstream>
-
- typedef unsigned long long quint64;
-
- using namespace std;
-
- inline quint64 qbswap(quint64 source)
- {
- return 0
- | ((source & quint64(0x00000000000000ffLL)) << 56)
- | ((source & quint64(0x000000000000ff00LL)) << 40)
- | ((source & quint64(0x0000000000ff0000LL)) << 24)
- | ((source & quint64(0x00000000ff000000LL)) << 8)
- | ((source & quint64(0x000000ff00000000LL)) >> 8)
- | ((source & quint64(0x0000ff0000000000LL)) >> 24)
- | ((source & quint64(0x00ff000000000000LL)) >> 40)
- | ((source & quint64(0xff00000000000000LL)) >> 56);
- }
-
- int main()
- {
- quint64 v = strtoull("4433ffeeddccbb00", NULL, 16);
- printf("%lld\n", v);
-
- const string string64bitInt = "4433ffeeddccbb00";
- stringstream s(string64bitInt);
- quint64 int64bitInt = 0;
- printf("1\n");
- s >> hex >> int64bitInt;
- printf("2\n");
-
- stringstream out;
- out << hex << qbswap(int64bitInt);
-
- cout << out.str() << endl;
- cout << hex << int64bitInt << endl;
- cout << string64bitInt << endl;
-
- if (out.str() != "bbccddeeff3344")
- {
- cout << "Failed!" << endl;
- }
- else
- {
- cout << "Succeeded!" << endl;
- }
-
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <iostream>
+#include <string>
+#include <sstream>
+
+typedef unsigned long long quint64;
+
+using namespace std;
+
+inline quint64 qbswap(quint64 source) {
+ return 0 | ((source & quint64(0x00000000000000ffLL)) << 56) |
+ ((source & quint64(0x000000000000ff00LL)) << 40) |
+ ((source & quint64(0x0000000000ff0000LL)) << 24) |
+ ((source & quint64(0x00000000ff000000LL)) << 8) |
+ ((source & quint64(0x000000ff00000000LL)) >> 8) |
+ ((source & quint64(0x0000ff0000000000LL)) >> 24) |
+ ((source & quint64(0x00ff000000000000LL)) >> 40) |
+ ((source & quint64(0xff00000000000000LL)) >> 56);
+}
+
+int main() {
+ quint64 v = strtoull("4433ffeeddccbb00", NULL, 16);
+ printf("%lld\n", v);
+
+ const string string64bitInt = "4433ffeeddccbb00";
+ stringstream s(string64bitInt);
+ quint64 int64bitInt = 0;
+ printf("1\n");
+ s >> hex >> int64bitInt;
+ printf("2\n");
+
+ stringstream out;
+ out << hex << qbswap(int64bitInt);
+
+ cout << out.str() << endl;
+ cout << hex << int64bitInt << endl;
+ cout << string64bitInt << endl;
+
+ if (out.str() != "bbccddeeff3344") {
+ cout << "Failed!" << endl;
+ } else {
+ cout << "Succeeded!" << endl;
+ }
+
+ return 0;
+}
diff --git a/tests/core/test_ccall.in b/tests/core/test_ccall.in
index 6374ebb3..0aefdc9d 100644
--- a/tests/core/test_ccall.in
+++ b/tests/core/test_ccall.in
@@ -1,19 +1,22 @@
+#include <stdio.h>
+#include <stdlib.h>
- #include <stdio.h>
- #include <stdlib.h>
+extern "C" {
+int get_int() { return 5; }
+float get_float() { return 3.14; }
+char *get_string() { return "hello world"; }
+void print_int(int x) { printf("%d\n", x); }
+void print_float(float x) { printf("%.2f\n", x); }
+void print_string(char *x) { printf("%s\n", x); }
+int multi(int x, float y, int z, char *str) {
+ if (x) puts(str);
+ return (x + y) * z;
+}
+int *pointer(int *in) {
+ printf("%d\n", *in);
+ static int ret = 21;
+ return &ret;
+}
+}
- extern "C" {
- int get_int() { return 5; }
- float get_float() { return 3.14; }
- char * get_string() { return "hello world"; }
- void print_int(int x) { printf("%d\n", x); }
- void print_float(float x) { printf("%.2f\n", x); }
- void print_string(char *x) { printf("%s\n", x); }
- int multi(int x, float y, int z, char *str) { if (x) puts(str); return (x+y)*z; }
- int * pointer(int *in) { printf("%d\n", *in); static int ret = 21; return &ret; }
- }
-
- int main(int argc, char **argv) {
- return 0;
- }
- \ No newline at end of file
+int main(int argc, char **argv) { return 0; }
diff --git a/tests/core/test_class.in b/tests/core/test_class.in
index fc61869e..9450b4a1 100644
--- a/tests/core/test_class.in
+++ b/tests/core/test_class.in
@@ -1,26 +1,28 @@
+#include <stdio.h>
+struct Random {
+ enum {
+ IM = 139968,
+ IA = 3877,
+ IC = 29573
+ };
+ Random() : last(42) {}
+ float get(float max = 1.0f) {
+ last = (last * IA + IC) % IM;
+ return max * last / IM;
+ }
- #include <stdio.h>
- struct Random {
- enum { IM = 139968, IA = 3877, IC = 29573 };
- Random() : last(42) {}
- float get( float max = 1.0f ) {
- last = ( last * IA + IC ) % IM;
- return max * last / IM;
- }
- protected:
- unsigned int last;
- } rng1;
- int main()
- {
- Random rng2;
- int count = 0;
- for (int i = 0; i < 100; i++) {
- float x1 = rng1.get();
- float x2 = rng2.get();
- printf("%f, %f\n", x1, x2);
- if (x1 != x2) count += 1;
- }
- printf("*%d*\n", count);
- return 0;
- }
- \ No newline at end of file
+ protected:
+ unsigned int last;
+} rng1;
+int main() {
+ Random rng2;
+ int count = 0;
+ for (int i = 0; i < 100; i++) {
+ float x1 = rng1.get();
+ float x2 = rng2.get();
+ printf("%f, %f\n", x1, x2);
+ if (x1 != x2) count += 1;
+ }
+ printf("*%d*\n", count);
+ return 0;
+}
diff --git a/tests/core/test_constglobalstructs.in b/tests/core/test_constglobalstructs.in
index f2f23c5d..182fae2f 100644
--- a/tests/core/test_constglobalstructs.in
+++ b/tests/core/test_constglobalstructs.in
@@ -1,30 +1,21 @@
+#include <stdio.h>
+struct IUB {
+ int c;
+ double p;
+ unsigned int pi;
+};
- #include <stdio.h>
- struct IUB {
- int c;
- double p;
- unsigned int pi;
- };
+IUB iub[] = {{'a', 0.27, 5}, {'c', 0.15, 4}, {'g', 0.12, 3}, {'t', 0.27, 2}, };
- IUB iub[] = {
- { 'a', 0.27, 5 },
- { 'c', 0.15, 4 },
- { 'g', 0.12, 3 },
- { 't', 0.27, 2 },
- };
+const unsigned char faceedgesidx[6][4] = {{4, 5, 8, 10},
+ {6, 7, 9, 11},
+ {0, 2, 8, 9},
+ {1, 3, 10, 11},
+ {0, 1, 4, 6},
+ {2, 3, 5, 7}, };
- const unsigned char faceedgesidx[6][4] =
- {
- { 4, 5, 8, 10 },
- { 6, 7, 9, 11 },
- { 0, 2, 8, 9 },
- { 1, 3, 10,11 },
- { 0, 1, 4, 6 },
- { 2, 3, 5, 7 },
- };
-
- int main( int argc, const char *argv[] ) {
- printf("*%d,%d,%d,%d*\n", iub[0].c, int(iub[1].p*100), iub[2].pi, faceedgesidx[3][2]);
- return 0;
- }
- \ No newline at end of file
+int main(int argc, const char *argv[]) {
+ printf("*%d,%d,%d,%d*\n", iub[0].c, int(iub[1].p * 100), iub[2].pi,
+ faceedgesidx[3][2]);
+ return 0;
+}
diff --git a/tests/core/test_conststructs.in b/tests/core/test_conststructs.in
index e95fd6be..6d664bea 100644
--- a/tests/core/test_conststructs.in
+++ b/tests/core/test_conststructs.in
@@ -1,21 +1,18 @@
+#include <stdio.h>
+struct IUB {
+ int c;
+ double p;
+ unsigned int pi;
+};
- #include <stdio.h>
- struct IUB {
- int c;
- double p;
- unsigned int pi;
- };
-
- int main( int argc, const char *argv[] ) {
- int before = 70;
- IUB iub[] = {
- { 'a', 0.3029549426680, 5 },
- { 'c', 0.15, 4 },
- { 'g', 0.12, 3 },
- { 't', 0.27, 2 },
- };
- int after = 90;
- printf("*%d,%d,%d,%d,%d,%d*\n", before, iub[0].c, int(iub[1].p*100), iub[2].pi, int(iub[0].p*10000), after);
- return 0;
- }
- \ No newline at end of file
+int main(int argc, const char *argv[]) {
+ int before = 70;
+ IUB iub[] = {{'a', 0.3029549426680, 5},
+ {'c', 0.15, 4},
+ {'g', 0.12, 3},
+ {'t', 0.27, 2}, };
+ int after = 90;
+ printf("*%d,%d,%d,%d,%d,%d*\n", before, iub[0].c, int(iub[1].p * 100),
+ iub[2].pi, int(iub[0].p * 10000), after);
+ return 0;
+}
diff --git a/tests/core/test_copyop.in b/tests/core/test_copyop.in
index 4bf7da12..847a516c 100644
--- a/tests/core/test_copyop.in
+++ b/tests/core/test_copyop.in
@@ -1,36 +1,34 @@
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
- #include <stdio.h>
- #include <math.h>
- #include <string.h>
+struct vec {
+ double x, y, z;
+ vec() : x(0), y(0), z(0) {};
+ vec(const double a, const double b, const double c) : x(a), y(b), z(c) {};
+};
- struct vec {
- double x,y,z;
- vec() : x(0), y(0), z(0) { };
- vec(const double a, const double b, const double c) : x(a), y(b), z(c) { };
- };
+struct basis {
+ vec a, b, c;
+ basis(const vec& v) {
+ a = v; // should not touch b!
+ printf("*%.2f,%.2f,%.2f*\n", b.x, b.y, b.z);
+ }
+};
- struct basis {
- vec a, b, c;
- basis(const vec& v) {
- a=v; // should not touch b!
- printf("*%.2f,%.2f,%.2f*\n", b.x, b.y, b.z);
- }
- };
+int main() {
+ basis B(vec(1, 0, 0));
- int main() {
- basis B(vec(1,0,0));
-
- // Part 2: similar problem with memset and memmove
- int x = 1, y = 77, z = 2;
- memset((void*)&x, 0, sizeof(int));
- memset((void*)&z, 0, sizeof(int));
- printf("*%d,%d,%d*\n", x, y, z);
- memcpy((void*)&x, (void*)&z, sizeof(int));
- memcpy((void*)&z, (void*)&x, sizeof(int));
- printf("*%d,%d,%d*\n", x, y, z);
- memmove((void*)&x, (void*)&z, sizeof(int));
- memmove((void*)&z, (void*)&x, sizeof(int));
- printf("*%d,%d,%d*\n", x, y, z);
- return 0;
- }
- \ No newline at end of file
+ // Part 2: similar problem with memset and memmove
+ int x = 1, y = 77, z = 2;
+ memset((void*)&x, 0, sizeof(int));
+ memset((void*)&z, 0, sizeof(int));
+ printf("*%d,%d,%d*\n", x, y, z);
+ memcpy((void*)&x, (void*)&z, sizeof(int));
+ memcpy((void*)&z, (void*)&x, sizeof(int));
+ printf("*%d,%d,%d*\n", x, y, z);
+ memmove((void*)&x, (void*)&z, sizeof(int));
+ memmove((void*)&z, (void*)&x, sizeof(int));
+ printf("*%d,%d,%d*\n", x, y, z);
+ return 0;
+}
diff --git a/tests/core/test_corruption_2.in b/tests/core/test_corruption_2.in
index 87aef9da..4db3b7c4 100644
--- a/tests/core/test_corruption_2.in
+++ b/tests/core/test_corruption_2.in
@@ -1,26 +1,21 @@
+#include <iostream>
+#include <fstream>
+#include <stdlib.h>
+#include <stdio.h>
- #include <iostream>
- #include <fstream>
- #include <stdlib.h>
- #include <stdio.h>
+void bye() { printf("all ok\n"); }
- void bye() {
- printf("all ok\n");
- }
+int main() {
+ atexit(bye);
- int main() {
- atexit(bye);
+ std::string testPath = "/Script/WA-KA.txt";
+ std::fstream str(testPath.c_str(), std::ios::in | std::ios::binary);
- std::string testPath = "/Script/WA-KA.txt";
- std::fstream str(testPath.c_str(), std::ios::in | std::ios::binary);
+ if (str.is_open()) {
+ std::cout << "open!" << std::endl;
+ } else {
+ std::cout << "missing!" << std::endl;
+ }
- if (str.is_open())
- {
- std::cout << "open!" << std::endl;
- } else {
- std::cout << "missing!" << std::endl;
- }
-
- return 1;
- }
- \ No newline at end of file
+ return 1;
+}
diff --git a/tests/core/test_corruption_3.in b/tests/core/test_corruption_3.in
index b951ac6b..08e7d345 100644
--- a/tests/core/test_corruption_3.in
+++ b/tests/core/test_corruption_3.in
@@ -1,22 +1,19 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <assert.h>
+void bye() { printf("all ok\n"); }
- void bye() {
- printf("all ok\n");
- }
+int main(int argc, char **argv) {
+ atexit(bye);
- int main(int argc, char **argv) {
- atexit(bye);
-
- char *buffer = (char*)malloc(100);
- for (int i = 0; i < 100; i++) buffer[i] = (i*i)%256;
- buffer = (char*)realloc(buffer, argc + 50);
- for (int i = 0; i < argc + 50; i++) {
- //printf("%d : %d : %d : %d\n", i, (int)(buffer + i), buffer[i], (char)((i*i)%256));
- assert(buffer[i] == (char)((i*i)%256));
- }
- return 1;
- }
- \ No newline at end of file
+ char *buffer = (char *)malloc(100);
+ for (int i = 0; i < 100; i++) buffer[i] = (i * i) % 256;
+ buffer = (char *)realloc(buffer, argc + 50);
+ for (int i = 0; i < argc + 50; i++) {
+ // printf("%d : %d : %d : %d\n", i, (int)(buffer + i), buffer[i],
+ // (char)((i*i)%256));
+ assert(buffer[i] == (char)((i * i) % 256));
+ }
+ return 1;
+}
diff --git a/tests/core/test_cxx03_do_run.in b/tests/core/test_cxx03_do_run.in
index ec7d1189..2ed0d2cf 100644
--- a/tests/core/test_cxx03_do_run.in
+++ b/tests/core/test_cxx03_do_run.in
@@ -1,12 +1,10 @@
+#include <stdio.h>
- #include <stdio.h>
+#if __cplusplus != 199711L
+#error By default, if no -std is specified, emscripten should be compiling with -std=c++03!
+#endif
- #if __cplusplus != 199711L
- #error By default, if no -std is specified, emscripten should be compiling with -std=c++03!
- #endif
-
- int main( int argc, const char *argv[] ) {
- printf("Hello world!\n");
- return 0;
- }
- \ No newline at end of file
+int main(int argc, const char *argv[]) {
+ printf("Hello world!\n");
+ return 0;
+}
diff --git a/tests/core/test_demangle_stacks.in b/tests/core/test_demangle_stacks.in
index 8db34832..e19d1a70 100644
--- a/tests/core/test_demangle_stacks.in
+++ b/tests/core/test_demangle_stacks.in
@@ -1,21 +1,20 @@
+#include <stdio.h>
+#include <stdlib.h>
- #include<stdio.h>
- #include<stdlib.h>
+namespace NameSpace {
+class Class {
+ public:
+ int Aborter(double x, char y, int *z) {
+ int addr = x + y + (int)z;
+ void *p = (void *)addr;
+ for (int i = 0; i < 100; i++)
+ free(p); // will abort, should show proper stack trace
+ }
+};
+}
- namespace NameSpace {
- class Class {
- public:
- int Aborter(double x, char y, int *z) {
- int addr = x+y+(int)z;
- void *p = (void*)addr;
- for (int i = 0; i < 100; i++) free(p); // will abort, should show proper stack trace
- }
- };
- }
-
- int main(int argc, char **argv) {
- NameSpace::Class c;
- c.Aborter(1.234, 'a', NULL);
- return 0;
- }
- \ No newline at end of file
+int main(int argc, char **argv) {
+ NameSpace::Class c;
+ c.Aborter(1.234, 'a', NULL);
+ return 0;
+}
diff --git a/tests/core/test_direct_string_constant_usage.in b/tests/core/test_direct_string_constant_usage.in
index e43232f0..cab335bd 100644
--- a/tests/core/test_direct_string_constant_usage.in
+++ b/tests/core/test_direct_string_constant_usage.in
@@ -1,13 +1,9 @@
-
- #include <iostream>
- template<int i>
- void printText( const char (&text)[ i ] )
- {
- std::cout << text;
- }
- int main()
- {
- printText( "some string constant" );
- return 0;
- }
- \ No newline at end of file
+#include <iostream>
+template <int i>
+void printText(const char (&text)[i]) {
+ std::cout << text;
+}
+int main() {
+ printText("some string constant");
+ return 0;
+}
diff --git a/tests/core/test_dlfcn_self.in b/tests/core/test_dlfcn_self.in
index 687c4d6f..7094b97d 100644
--- a/tests/core/test_dlfcn_self.in
+++ b/tests/core/test_dlfcn_self.in
@@ -1,4 +1,3 @@
-
#include <stdio.h>
#include <dlfcn.h>
#include <emscripten.h>
@@ -6,19 +5,19 @@
int EMSCRIPTEN_KEEPALIVE global = 123;
extern "C" EMSCRIPTEN_KEEPALIVE void foo(int x) {
-printf("%d\n", x);
+ printf("%d\n", x);
}
extern "C" EMSCRIPTEN_KEEPALIVE void repeatable() {
-void* self = dlopen(NULL, RTLD_LAZY);
-int* global_ptr = (int*)dlsym(self, "global");
-void (*foo_ptr)(int) = (void (*)(int))dlsym(self, "foo");
-foo_ptr(*global_ptr);
-dlclose(self);
+ void* self = dlopen(NULL, RTLD_LAZY);
+ int* global_ptr = (int*)dlsym(self, "global");
+ void (*foo_ptr)(int) = (void (*)(int))dlsym(self, "foo");
+ foo_ptr(*global_ptr);
+ dlclose(self);
}
int main() {
-repeatable();
-repeatable();
-return 0;
-} \ No newline at end of file
+ repeatable();
+ repeatable();
+ return 0;
+}
diff --git a/tests/core/test_dlmalloc_partial_2.in b/tests/core/test_dlmalloc_partial_2.in
index f68e9cdf..1e16657e 100644
--- a/tests/core/test_dlmalloc_partial_2.in
+++ b/tests/core/test_dlmalloc_partial_2.in
@@ -1,14 +1,10 @@
-
- #include <stdio.h>
- #include <stdlib.h>
- void *malloc(size_t size)
- {
- return (void*)123;
- }
- int main() {
- void *x = malloc(10);
- printf("got %p\n", x);
- free(x);
- printf("freed the faker\n");
- return 1;
- }
+#include <stdio.h>
+#include <stdlib.h>
+void *malloc(size_t size) { return (void *)123; }
+int main() {
+ void *x = malloc(10);
+ printf("got %p\n", x);
+ free(x);
+ printf("freed the faker\n");
+ return 1;
+}
diff --git a/tests/core/test_double_i64_conversion.in b/tests/core/test_double_i64_conversion.in
index 404c6796..4033e211 100644
--- a/tests/core/test_double_i64_conversion.in
+++ b/tests/core/test_double_i64_conversion.in
@@ -1,69 +1,69 @@
+#include <cassert>
+#include <inttypes.h>
+#include <stdio.h>
- #include <cassert>
- #include <inttypes.h>
- #include <stdio.h>
+__attribute((noinline)) bool eq(double d, int64_t i) {
+ int64_t i2 = (int64_t)d;
+ if (i != i2) {
+ printf("%.20g converted to int64 returns %lld, not %lld as expected!\n", d,
+ i2, i);
+ }
+ return i == i2;
+}
- __attribute((noinline)) bool eq(double d, int64_t i) {
- int64_t i2 = (int64_t)d;
- if (i != i2) {
- printf("%.20g converted to int64 returns %lld, not %lld as expected!\n", d, i2, i);
- }
- return i == i2;
- }
+int main() {
+ assert(eq(0.0, 0));
+ assert(eq(-0.0, 0));
+ assert(eq(0.1, 0));
+ assert(eq(-0.1, 0));
+ assert(eq(0.6, 0));
+ assert(eq(-0.6, 0));
+ assert(eq(1.0, 1));
+ assert(eq(-1.0, -1));
+ assert(eq(1.1, 1));
+ assert(eq(-1.1, -1));
+ assert(eq(1.6, 1));
+ assert(eq(-1.6, -1));
+ assert(eq(4294967295.0, 4294967295LL));
+ assert(eq(4294967295.5, 4294967295LL));
+ assert(eq(4294967296.0, 4294967296LL));
+ assert(eq(4294967296.5, 4294967296LL));
+ assert(eq(14294967295.0, 14294967295LL));
+ assert(eq(14294967295.5, 14294967295LL));
+ assert(eq(14294967296.0, 14294967296LL));
+ assert(eq(14294967296.5, 14294967296LL));
+ assert(eq(-4294967295.0, -4294967295LL));
+ assert(eq(-4294967295.5, -4294967295LL));
+ assert(eq(-4294967296.0, -4294967296LL));
+ assert(eq(-4294967296.5, -4294967296LL));
+ assert(eq(-14294967295.0, -14294967295LL));
+ assert(eq(-14294967295.5, -14294967295LL));
+ assert(eq(-14294967296.0, -14294967296LL));
+ assert(eq(-14294967296.5, -14294967296LL));
- int main() {
- assert(eq(0.0, 0));
- assert(eq(-0.0, 0));
- assert(eq(0.1, 0));
- assert(eq(-0.1, 0));
- assert(eq(0.6, 0));
- assert(eq(-0.6, 0));
- assert(eq(1.0, 1));
- assert(eq(-1.0, -1));
- assert(eq(1.1, 1));
- assert(eq(-1.1, -1));
- assert(eq(1.6, 1));
- assert(eq(-1.6, -1));
- assert(eq(4294967295.0, 4294967295LL));
- assert(eq(4294967295.5, 4294967295LL));
- assert(eq(4294967296.0, 4294967296LL));
- assert(eq(4294967296.5, 4294967296LL));
- assert(eq(14294967295.0, 14294967295LL));
- assert(eq(14294967295.5, 14294967295LL));
- assert(eq(14294967296.0, 14294967296LL));
- assert(eq(14294967296.5, 14294967296LL));
- assert(eq(-4294967295.0, -4294967295LL));
- assert(eq(-4294967295.5, -4294967295LL));
- assert(eq(-4294967296.0, -4294967296LL));
- assert(eq(-4294967296.5, -4294967296LL));
- assert(eq(-14294967295.0, -14294967295LL));
- assert(eq(-14294967295.5, -14294967295LL));
- assert(eq(-14294967296.0, -14294967296LL));
- assert(eq(-14294967296.5, -14294967296LL));
+ assert(eq(4294967295.3, 4294967295LL));
+ assert(eq(4294967296.3, 4294967296LL));
+ assert(eq(14294967295.3, 14294967295LL));
+ assert(eq(14294967296.3, 14294967296LL));
+ assert(eq(-4294967295.3, -4294967295LL));
+ assert(eq(-4294967296.3, -4294967296LL));
+ assert(eq(-14294967295.3, -14294967295LL));
+ assert(eq(-14294967296.3, -14294967296LL));
- assert(eq(4294967295.3, 4294967295LL));
- assert(eq(4294967296.3, 4294967296LL));
- assert(eq(14294967295.3, 14294967295LL));
- assert(eq(14294967296.3, 14294967296LL));
- assert(eq(-4294967295.3, -4294967295LL));
- assert(eq(-4294967296.3, -4294967296LL));
- assert(eq(-14294967295.3, -14294967295LL));
- assert(eq(-14294967296.3, -14294967296LL));
+ assert(eq(4294967295.8, 4294967295LL));
+ assert(eq(4294967296.8, 4294967296LL));
+ assert(eq(14294967295.8, 14294967295LL));
+ assert(eq(14294967296.8, 14294967296LL));
+ assert(eq(-4294967295.8, -4294967295LL));
+ assert(eq(-4294967296.8, -4294967296LL));
+ assert(eq(-14294967295.8, -14294967295LL));
+ assert(eq(-14294967296.8, -14294967296LL));
- assert(eq(4294967295.8, 4294967295LL));
- assert(eq(4294967296.8, 4294967296LL));
- assert(eq(14294967295.8, 14294967295LL));
- assert(eq(14294967296.8, 14294967296LL));
- assert(eq(-4294967295.8, -4294967295LL));
- assert(eq(-4294967296.8, -4294967296LL));
- assert(eq(-14294967295.8, -14294967295LL));
- assert(eq(-14294967296.8, -14294967296LL));
+ // The following number is the largest double such that all integers smaller
+ // than this can exactly be represented in a double.
+ assert(eq(9007199254740992.0, 9007199254740992LL /* == 2^53 */));
+ assert(eq(-9007199254740992.0, -9007199254740992LL /* == -2^53 */));
- // The following number is the largest double such that all integers smaller than this can exactly be represented in a double.
- assert(eq(9007199254740992.0, 9007199254740992LL /* == 2^53 */));
- assert(eq(-9007199254740992.0, -9007199254740992LL /* == -2^53 */));
-
- printf("OK!\n");
- return 0;
- }
- \ No newline at end of file
+ printf("OK!\n");
+ return 0;
+}
diff --git a/tests/core/test_dynamic_cast.in b/tests/core/test_dynamic_cast.in
index ebe9263b..1752573c 100644
--- a/tests/core/test_dynamic_cast.in
+++ b/tests/core/test_dynamic_cast.in
@@ -1,17 +1,12 @@
+#include <stdio.h>
- #include <stdio.h>
+struct Support {
+ virtual void f() { printf("f()\n"); }
+};
- struct Support {
- virtual void f() {
- printf("f()\n");
- }
- };
+struct Derived : Support {};
- struct Derived : Support {
- };
-
- int main() {
- Support * p = new Derived;
- dynamic_cast<Derived*>(p)->f();
- }
- \ No newline at end of file
+int main() {
+ Support* p = new Derived;
+ dynamic_cast<Derived*>(p)->f();
+}
diff --git a/tests/core/test_dynamic_cast_2.in b/tests/core/test_dynamic_cast_2.in
index 6da4cade..634ff5c2 100644
--- a/tests/core/test_dynamic_cast_2.in
+++ b/tests/core/test_dynamic_cast_2.in
@@ -1,12 +1,10 @@
+#include <stdio.h>
+#include <typeinfo>
- #include <stdio.h>
- #include <typeinfo>
+class Class {};
- class Class {};
-
- int main() {
- const Class* dp = dynamic_cast<const Class*>(&typeid(Class));
- // should return dp == NULL,
- printf("pointer: %p\n", dp);
- }
- \ No newline at end of file
+int main() {
+ const Class* dp = dynamic_cast<const Class*>(&typeid(Class));
+ // should return dp == NULL,
+ printf("pointer: %p\n", dp);
+}
diff --git a/tests/core/test_dynamic_cast_b.in b/tests/core/test_dynamic_cast_b.in
index f5931fef..77981035 100644
--- a/tests/core/test_dynamic_cast_b.in
+++ b/tests/core/test_dynamic_cast_b.in
@@ -1,28 +1,31 @@
+#include <stdio.h>
- #include <stdio.h>
+class CBase {
+ virtual void dummy() {}
+};
+class CDerived : public CBase {
+ int a;
+};
+class CDerivedest : public CDerived {
+ float b;
+};
- class CBase { virtual void dummy() {} };
- class CDerived : public CBase { int a; };
- class CDerivedest : public CDerived { float b; };
+int main() {
+ CBase *pa = new CBase;
+ CBase *pb = new CDerived;
+ CBase *pc = new CDerivedest;
- int main ()
- {
- CBase *pa = new CBase;
- CBase *pb = new CDerived;
- CBase *pc = new CDerivedest;
+ printf("a1: %d\n", dynamic_cast<CDerivedest *>(pa) != NULL);
+ printf("a2: %d\n", dynamic_cast<CDerived *>(pa) != NULL);
+ printf("a3: %d\n", dynamic_cast<CBase *>(pa) != NULL);
- printf("a1: %d\n", dynamic_cast<CDerivedest*>(pa) != NULL);
- printf("a2: %d\n", dynamic_cast<CDerived*>(pa) != NULL);
- printf("a3: %d\n", dynamic_cast<CBase*>(pa) != NULL);
+ printf("b1: %d\n", dynamic_cast<CDerivedest *>(pb) != NULL);
+ printf("b2: %d\n", dynamic_cast<CDerived *>(pb) != NULL);
+ printf("b3: %d\n", dynamic_cast<CBase *>(pb) != NULL);
- printf("b1: %d\n", dynamic_cast<CDerivedest*>(pb) != NULL);
- printf("b2: %d\n", dynamic_cast<CDerived*>(pb) != NULL);
- printf("b3: %d\n", dynamic_cast<CBase*>(pb) != NULL);
+ printf("c1: %d\n", dynamic_cast<CDerivedest *>(pc) != NULL);
+ printf("c2: %d\n", dynamic_cast<CDerived *>(pc) != NULL);
+ printf("c3: %d\n", dynamic_cast<CBase *>(pc) != NULL);
- printf("c1: %d\n", dynamic_cast<CDerivedest*>(pc) != NULL);
- printf("c2: %d\n", dynamic_cast<CDerived*>(pc) != NULL);
- printf("c3: %d\n", dynamic_cast<CBase*>(pc) != NULL);
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_emptyclass.in b/tests/core/test_emptyclass.in
index 24a550db..370cacf5 100644
--- a/tests/core/test_emptyclass.in
+++ b/tests/core/test_emptyclass.in
@@ -1,15 +1,11 @@
+#include <stdio.h>
- #include <stdio.h>
+struct Randomized {
+ Randomized(int x) { printf("*zzcheezzz*\n"); }
+};
- struct Randomized {
- Randomized(int x) {
- printf("*zzcheezzz*\n");
- }
- };
+int main(int argc, const char *argv[]) {
+ new Randomized(55);
- int main( int argc, const char *argv[] ) {
- new Randomized(55);
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_emscripten_api.in b/tests/core/test_emscripten_api.in
index fb25175e..7ece877f 100644
--- a/tests/core/test_emscripten_api.in
+++ b/tests/core/test_emscripten_api.in
@@ -1,17 +1,15 @@
+#include <stdio.h>
+#include "emscripten.h"
- #include <stdio.h>
- #include "emscripten.h"
+extern "C" {
+void save_me_aimee() { printf("mann\n"); }
+}
- extern "C" {
- void save_me_aimee() { printf("mann\n"); }
- }
-
- int main() {
- // EMSCRIPTEN_COMMENT("hello from the source");
- emscripten_run_script("Module.print('hello world' + '!')");
- printf("*%d*\n", emscripten_run_script_int("5*20"));
- printf("*%s*\n", emscripten_run_script_string("'five'+'six'"));
- emscripten_run_script("Module['_save_me_aimee']()");
- return 0;
- }
- \ No newline at end of file
+int main() {
+ // EMSCRIPTEN_COMMENT("hello from the source");
+ emscripten_run_script("Module.print('hello world' + '!')");
+ printf("*%d*\n", emscripten_run_script_int("5*20"));
+ printf("*%s*\n", emscripten_run_script_string("'five'+'six'"));
+ emscripten_run_script("Module['_save_me_aimee']()");
+ return 0;
+}
diff --git a/tests/core/test_erf.in b/tests/core/test_erf.in
index 70658ea5..bd14b14f 100644
--- a/tests/core/test_erf.in
+++ b/tests/core/test_erf.in
@@ -1,15 +1,7 @@
-
- #include <math.h>
- #include <stdio.h>
- int main()
- {
- printf("%1.6f, %1.6f, %1.6f, %1.6f, %1.6f, %1.6f\n",
- erf(1.0),
- erf(3.0),
- erf(-1.0),
- erfc(1.0),
- erfc(3.0),
- erfc(-1.5));
- return 0;
- }
- \ No newline at end of file
+#include <math.h>
+#include <stdio.h>
+int main() {
+ printf("%1.6f, %1.6f, %1.6f, %1.6f, %1.6f, %1.6f\n", erf(1.0), erf(3.0),
+ erf(-1.0), erfc(1.0), erfc(3.0), erfc(-1.5));
+ return 0;
+}
diff --git a/tests/core/test_errar.in b/tests/core/test_errar.in
index 7ef2b23d..9fda2099 100644
--- a/tests/core/test_errar.in
+++ b/tests/core/test_errar.in
@@ -1,21 +1,19 @@
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
- #include <stdio.h>
- #include <errno.h>
- #include <string.h>
+int main() {
+ char* err;
+ char buffer[200];
- int main() {
- char* err;
- char buffer[200];
+ err = strerror(EDOM);
+ strerror_r(EWOULDBLOCK, buffer, 200);
+ printf("<%s>\n", err);
+ printf("<%s>\n", buffer);
- err = strerror(EDOM);
- strerror_r(EWOULDBLOCK, buffer, 200);
- printf("<%s>\n", err);
- printf("<%s>\n", buffer);
+ printf("<%d>\n", strerror_r(EWOULDBLOCK, buffer, 0));
+ errno = 123;
+ printf("<%d>\n", errno);
- printf("<%d>\n", strerror_r(EWOULDBLOCK, buffer, 0));
- errno = 123;
- printf("<%d>\n", errno);
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_exception_2.in b/tests/core/test_exception_2.in
index 5a9efce5..2eae3198 100644
--- a/tests/core/test_exception_2.in
+++ b/tests/core/test_exception_2.in
@@ -1,26 +1,18 @@
+#include <stdexcept>
+#include <stdio.h>
- #include <stdexcept>
- #include <stdio.h>
+typedef void (*FuncPtr)();
- typedef void (*FuncPtr)();
+void ThrowException() { throw std::runtime_error("catch me!"); }
- void ThrowException()
- {
- throw std::runtime_error("catch me!");
- }
+FuncPtr ptr = ThrowException;
- FuncPtr ptr = ThrowException;
-
- int main()
- {
- try
- {
- ptr();
- }
- catch(...)
- {
- printf("Exception caught successfully!\n");
- }
- return 0;
- }
- \ No newline at end of file
+int main() {
+ try {
+ ptr();
+ }
+ catch (...) {
+ printf("Exception caught successfully!\n");
+ }
+ return 0;
+}
diff --git a/tests/core/test_fakestat.in b/tests/core/test_fakestat.in
index 9a09b57c..d1dbed29 100644
--- a/tests/core/test_fakestat.in
+++ b/tests/core/test_fakestat.in
@@ -1,10 +1,10 @@
-
- #include <stdio.h>
- struct stat { int x, y; };
- int main() {
- stat s;
- s.x = 10;
- s.y = 22;
- printf("*%d,%d*\n", s.x, s.y);
- }
- \ No newline at end of file
+#include <stdio.h>
+struct stat {
+ int x, y;
+};
+int main() {
+ stat s;
+ s.x = 10;
+ s.y = 22;
+ printf("*%d,%d*\n", s.x, s.y);
+}
diff --git a/tests/core/test_fast_math.in b/tests/core/test_fast_math.in
index 27bd01fd..e3b283aa 100644
--- a/tests/core/test_fast_math.in
+++ b/tests/core/test_fast_math.in
@@ -1,4 +1,3 @@
-
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/core/test_fcvt.in b/tests/core/test_fcvt.in
index 66b5adef..2e3fdbc6 100644
--- a/tests/core/test_fcvt.in
+++ b/tests/core/test_fcvt.in
@@ -1,14 +1,12 @@
-/* This example borrowed from MSDN documentation */
- #include <stdlib.h>
- #include <stdio.h>
+/* This example borrowed from MSDN documentation */#include <stdlib.h>
+#include <stdio.h>
- int main() {
- int decimal, sign;
- char *buffer;
- double source = 3.1415926535;
+int main() {
+ int decimal, sign;
+ char *buffer;
+ double source = 3.1415926535;
- buffer = fcvt(source, 7, &decimal, &sign);
- printf("source: %2.10f buffer: '%s' decimal: %d sign: %d\n",
- source, buffer, decimal, sign);
- }
-
+ buffer = fcvt(source, 7, &decimal, &sign);
+ printf("source: %2.10f buffer: '%s' decimal: %d sign: %d\n", source,
+ buffer, decimal, sign);
+}
diff --git a/tests/core/test_flexarray_struct.in b/tests/core/test_flexarray_struct.in
index 40ee1ddd..cb83a7e5 100644
--- a/tests/core/test_flexarray_struct.in
+++ b/tests/core/test_flexarray_struct.in
@@ -1,13 +1,10 @@
-
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
-typedef struct
-{
+typedef struct {
uint16_t length;
- struct
- {
+ struct {
int32_t int32;
} value[];
} Tuple;
diff --git a/tests/core/test_float32_precise.in b/tests/core/test_float32_precise.in
index 231b4289..969f5ed6 100644
--- a/tests/core/test_float32_precise.in
+++ b/tests/core/test_float32_precise.in
@@ -1,21 +1,19 @@
+#include <stdio.h>
- #include <stdio.h>
-
- int main(int argc, char **argv) {
- float x = 1.23456789123456789;
- float y = 5.20456089123406709;
- while (argc > 10 || argc % 19 == 15) {
- // confuse optimizer
- x /= y;
- y = 2*y - 1;
- argc--;
- }
- x = x - y;
- y = 3*y - x/2;
- x = x*y;
- y += 0.000000000123123123123;
- x -= y/7.654;
- printf("\n%.20f, %.20f\n", x, y);
- return 0;
- }
- \ No newline at end of file
+int main(int argc, char **argv) {
+ float x = 1.23456789123456789;
+ float y = 5.20456089123406709;
+ while (argc > 10 || argc % 19 == 15) {
+ // confuse optimizer
+ x /= y;
+ y = 2 * y - 1;
+ argc--;
+ }
+ x = x - y;
+ y = 3 * y - x / 2;
+ x = x * y;
+ y += 0.000000000123123123123;
+ x -= y / 7.654;
+ printf("\n%.20f, %.20f\n", x, y);
+ return 0;
+}
diff --git a/tests/core/test_floatvars.in b/tests/core/test_floatvars.in
index f63da19c..b6c94c82 100644
--- a/tests/core/test_floatvars.in
+++ b/tests/core/test_floatvars.in
@@ -1,29 +1,27 @@
+#include <stdio.h>
- #include <stdio.h>
+// headers test, see issue #1013
+#include <cfloat>
+#include <cmath>
- // headers test, see issue #1013
- #include<cfloat>
- #include<cmath>
+int main(int argc, char **argv) {
+ float x = 1.234, y = 3.5, q = 0.00000001;
+ y *= 3;
+ int z = x < y;
+ printf("*%d,%d,%.1f,%d,%.4f,%.2f*\n", z, int(y), y, (int)x, x, q);
- int main(int argc, char **argv)
- {
- float x = 1.234, y = 3.5, q = 0.00000001;
- y *= 3;
- int z = x < y;
- printf("*%d,%d,%.1f,%d,%.4f,%.2f*\n", z, int(y), y, (int)x, x, q);
+ printf("%.2f, %.2f, %.2f, %.2f\n", fmin(0.5, 3.3), fmin(NAN, 3.3),
+ fmax(0.5, 3.3), fmax(NAN, 3.3));
- printf("%.2f, %.2f, %.2f, %.2f\n", fmin(0.5, 3.3), fmin(NAN, 3.3), fmax(0.5, 3.3), fmax(NAN, 3.3));
+ printf("small: %.10f\n", argc * 0.000001);
- printf("small: %.10f\n", argc * 0.000001);
+ /*
+ // Rounding behavior
+ float fs[6] = { -2.75, -2.50, -2.25, 2.25, 2.50, 2.75 };
+ double ds[6] = { -2.75, -2.50, -2.25, 2.25, 2.50, 2.75 };
+ for (int i = 0; i < 6; i++)
+ printf("*int(%.2f)=%d,%d*\n", fs[i], int(fs[i]), int(ds[i]));
+ */
- /*
- // Rounding behavior
- float fs[6] = { -2.75, -2.50, -2.25, 2.25, 2.50, 2.75 };
- double ds[6] = { -2.75, -2.50, -2.25, 2.25, 2.50, 2.75 };
- for (int i = 0; i < 6; i++)
- printf("*int(%.2f)=%d,%d*\n", fs[i], int(fs[i]), int(ds[i]));
- */
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_frexp.in b/tests/core/test_frexp.in
index d3facca8..fba3231f 100644
--- a/tests/core/test_frexp.in
+++ b/tests/core/test_frexp.in
@@ -1,32 +1,29 @@
+#include <stdio.h>
+#include <math.h>
+#include <assert.h>
- #include <stdio.h>
- #include <math.h>
- #include <assert.h>
+static const double tol = 1e-16;
- static const double tol=1e-16;
+void test_value(double value) {
+ int exponent;
+ double x = frexp(value, &exponent);
+ double expected = x * pow(2.0, exponent);
- void test_value(double value)
- {
- int exponent;
- double x=frexp(value, &exponent);
- double expected=x*pow(2.0, exponent);
+ printf("%f=%f*2^%d\n", value, x, exponent);
- printf("%f=%f*2^%d\n", value, x, exponent);
+ assert(fabs(expected - value) < tol);
+ assert(x == 0 || (fabs(x) >= 5e-1 && fabs(x) < 1)); // x has a magnitude in
+ // the interval [1/2, 1)
+}
- assert(fabs(expected-value)<tol);
- assert(x==0 || (fabs(x)>=5e-1 && fabs(x)<1)); // x has a magnitude in the interval [1/2, 1)
- }
+int main() {
+ test_value(0);
+ test_value(100.1);
+ test_value(-100.1);
+ test_value(.5);
+ test_value(-.5);
+ test_value(1 - 1e-16);
+ test_value(-(1 - 1e-16));
- int main()
- {
- test_value(0);
- test_value(100.1);
- test_value(-100.1);
- test_value(.5);
- test_value(-.5);
- test_value(1-1e-16);
- test_value(-(1-1e-16));
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_funcptr.in b/tests/core/test_funcptr.in
index 8328924a..23813b33 100644
--- a/tests/core/test_funcptr.in
+++ b/tests/core/test_funcptr.in
@@ -1,35 +1,33 @@
+#include <stdio.h>
+int calc1() { return 26; }
+int calc2() { return 90; }
+typedef int (*fp_t)();
- #include <stdio.h>
- int calc1() { return 26; }
- int calc2() { return 90; }
- typedef int (*fp_t)();
+fp_t globally1 = calc1;
+fp_t globally2 = calc2;
- fp_t globally1 = calc1;
- fp_t globally2 = calc2;
+int nothing(const char *str) { return 0; }
- int nothing(const char *str) { return 0; }
+int main() {
+ fp_t fp = calc1;
+ void *vp = (void *)fp;
+ fp_t fpb = (fp_t)vp;
+ fp_t fp2 = calc2;
+ void *vp2 = (void *)fp2;
+ fp_t fpb2 = (fp_t)vp2;
+ printf("*%d,%d,%d,%d,%d,%d*\n", fp(), fpb(), fp2(), fpb2(), globally1(),
+ globally2());
- int main()
- {
- fp_t fp = calc1;
- void *vp = (void*)fp;
- fp_t fpb = (fp_t)vp;
- fp_t fp2 = calc2;
- void *vp2 = (void*)fp2;
- fp_t fpb2 = (fp_t)vp2;
- printf("*%d,%d,%d,%d,%d,%d*\n", fp(), fpb(), fp2(), fpb2(), globally1(), globally2());
+ fp_t t = calc1;
+ printf("*%d,%d", t == calc1, t == calc2);
+ t = calc2;
+ printf(",%d,%d*\n", t == calc1, t == calc2);
- fp_t t = calc1;
- printf("*%d,%d", t == calc1, t == calc2);
- t = calc2;
- printf(",%d,%d*\n", t == calc1, t == calc2);
+ int (*other)(const char * str);
+ other = nothing;
+ other("*hello!*");
+ other = puts;
+ other("*goodbye!*");
- int (*other)(const char *str);
- other = nothing;
- other("*hello!*");
- other = puts;
- other("*goodbye!*");
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_funcptr_namecollide.in b/tests/core/test_funcptr_namecollide.in
index 0b27b07c..dc5cfaba 100644
--- a/tests/core/test_funcptr_namecollide.in
+++ b/tests/core/test_funcptr_namecollide.in
@@ -1,27 +1,24 @@
+#include <stdio.h>
- #include <stdio.h>
+void do_call(void (*puts)(const char *), const char *str);
- void do_call(void (*puts)(const char *), const char *str);
+void do_print(const char *str) {
+ if (!str) do_call(NULL, "delusion");
+ if ((int)str == -1) do_print(str + 10);
+ puts("====");
+ puts(str);
+ puts("====");
+}
- void do_print(const char *str) {
- if (!str) do_call(NULL, "delusion");
- if ((int)str == -1) do_print(str+10);
- puts("====");
- puts(str);
- puts("====");
- }
+void do_call(void (*puts)(const char *), const char *str) {
+ if (!str) do_print("confusion");
+ if ((int)str == -1) do_call(NULL, str - 10);
+ (*puts)(str);
+}
- void do_call(void (*puts)(const char *), const char *str) {
- if (!str) do_print("confusion");
- if ((int)str == -1) do_call(NULL, str-10);
- (*puts)(str);
- }
-
- int main(int argc, char **argv)
- {
- for (int i = 0; i < argc; i++) {
- do_call(i != 10 ? do_print : NULL, i != 15 ? "waka waka" : NULL);
- }
- return 0;
- }
- \ No newline at end of file
+int main(int argc, char **argv) {
+ for (int i = 0; i < argc; i++) {
+ do_call(i != 10 ? do_print : NULL, i != 15 ? "waka waka" : NULL);
+ }
+ return 0;
+}
diff --git a/tests/core/test_funcptrfunc.in b/tests/core/test_funcptrfunc.in
index 6c146421..c6487b88 100644
--- a/tests/core/test_funcptrfunc.in
+++ b/tests/core/test_funcptrfunc.in
@@ -1,17 +1,12 @@
+#include <stdio.h>
- #include <stdio.h>
+typedef void (*funcptr)(int, int);
+typedef funcptr (*funcptrfunc)(int);
- typedef void (*funcptr)(int, int);
- typedef funcptr (*funcptrfunc)(int);
+funcptr __attribute__((noinline)) getIt(int x) { return (funcptr)x; }
- funcptr __attribute__ ((noinline)) getIt(int x) {
- return (funcptr)x;
- }
-
- int main(int argc, char **argv)
- {
- funcptrfunc fpf = argc < 100 ? getIt : NULL;
- printf("*%p*\n", fpf(argc));
- return 0;
- }
- \ No newline at end of file
+int main(int argc, char **argv) {
+ funcptrfunc fpf = argc < 100 ? getIt : NULL;
+ printf("*%p*\n", fpf(argc));
+ return 0;
+}
diff --git a/tests/core/test_funcs.in b/tests/core/test_funcs.in
index f2e707f9..3619faec 100644
--- a/tests/core/test_funcs.in
+++ b/tests/core/test_funcs.in
@@ -1,12 +1,6 @@
-
- #include <stdio.h>
- int funcy(int x)
- {
- return x*9;
- }
- int main()
- {
- printf("*%d,%d*\n", funcy(8), funcy(10));
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+int funcy(int x) { return x * 9; }
+int main() {
+ printf("*%d,%d*\n", funcy(8), funcy(10));
+ return 0;
+}
diff --git a/tests/core/test_functionpointer_libfunc_varargs.in b/tests/core/test_functionpointer_libfunc_varargs.in
index 6cabe8c5..69faefa2 100644
--- a/tests/core/test_functionpointer_libfunc_varargs.in
+++ b/tests/core/test_functionpointer_libfunc_varargs.in
@@ -1,13 +1,11 @@
-
- #include <stdio.h>
- #include <fcntl.h>
- typedef int (*fp_t)(int, int, ...);
- int main(int argc, char **argv) {
- fp_t fp = &fcntl;
- if (argc == 1337) fp = (fp_t)&main;
- (*fp)(0, 10);
- (*fp)(0, 10, 5);
- printf("waka\n");
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+#include <fcntl.h>
+typedef int (*fp_t)(int, int, ...);
+int main(int argc, char **argv) {
+ fp_t fp = &fcntl;
+ if (argc == 1337) fp = (fp_t) & main;
+ (*fp)(0, 10);
+ (*fp)(0, 10, 5);
+ printf("waka\n");
+ return 0;
+}
diff --git a/tests/core/test_fwrite_0.in b/tests/core/test_fwrite_0.in
index 478524bb..990ab250 100644
--- a/tests/core/test_fwrite_0.in
+++ b/tests/core/test_fwrite_0.in
@@ -1,21 +1,18 @@
+#include <stdio.h>
+#include <stdlib.h>
- #include <stdio.h>
- #include <stdlib.h>
+int main() {
+ FILE *fh;
- int main ()
- {
- FILE *fh;
+ fh = fopen("a.txt", "wb");
+ if (!fh) exit(1);
+ fclose(fh);
- fh = fopen("a.txt", "wb");
- if (!fh) exit(1);
- fclose(fh);
+ fh = fopen("a.txt", "rb");
+ if (!fh) exit(1);
- fh = fopen("a.txt", "rb");
- if (!fh) exit(1);
+ char data[] = "foobar";
+ size_t written = fwrite(data, 1, sizeof(data), fh);
- char data[] = "foobar";
- size_t written = fwrite(data, 1, sizeof(data), fh);
-
- printf("written=%zu\n", written);
- }
- \ No newline at end of file
+ printf("written=%zu\n", written);
+}
diff --git a/tests/core/test_gc.in b/tests/core/test_gc.in
index ae94b0ec..55d98e60 100644
--- a/tests/core/test_gc.in
+++ b/tests/core/test_gc.in
@@ -1,107 +1,107 @@
+#include <stdio.h>
+#include <gc.h>
+#include <assert.h>
- #include <stdio.h>
- #include <gc.h>
- #include <assert.h>
+void *global;
- void *global;
+void finalizer(void *ptr, void *arg) {
+ printf("finalizing %d (global == %d)\n", (int)arg, ptr == global);
+}
- void finalizer(void *ptr, void *arg) {
- printf("finalizing %d (global == %d)\n", (int)arg, ptr == global);
- }
+void finalizer2(void *ptr, void *arg) {
+ printf("finalizing2 %d (global == %d)\n", (int)arg, ptr == global);
+}
- void finalizer2(void *ptr, void *arg) {
- printf("finalizing2 %d (global == %d)\n", (int)arg, ptr == global);
- }
+int main() {
+ GC_INIT();
- int main() {
- GC_INIT();
+ void *local, *local2, *local3, *local4, *local5, *local6;
- void *local, *local2, *local3, *local4, *local5, *local6;
+ // Hold on to global, drop locals
- // Hold on to global, drop locals
+ global = GC_MALLOC(1024); // rooted since in a static allocation
+ GC_REGISTER_FINALIZER_NO_ORDER(global, finalizer, 0, 0, 0);
+ printf("alloc %p\n", global);
- global = GC_MALLOC(1024); // rooted since in a static allocation
- GC_REGISTER_FINALIZER_NO_ORDER(global, finalizer, 0, 0, 0);
- printf("alloc %p\n", global);
+ local = GC_MALLOC(1024); // not rooted since stack is not scanned
+ GC_REGISTER_FINALIZER_NO_ORDER(local, finalizer, (void *)1, 0, 0);
+ printf("alloc %p\n", local);
- local = GC_MALLOC(1024); // not rooted since stack is not scanned
- GC_REGISTER_FINALIZER_NO_ORDER(local, finalizer, (void*)1, 0, 0);
- printf("alloc %p\n", local);
+ assert((char *)local - (char *)global >= 1024 ||
+ (char *)global - (char *)local >= 1024);
- assert((char*)local - (char*)global >= 1024 || (char*)global - (char*)local >= 1024);
+ local2 = GC_MALLOC(1024); // no finalizer
+ printf("alloc %p\n", local2);
- local2 = GC_MALLOC(1024); // no finalizer
- printf("alloc %p\n", local2);
+ local3 = GC_MALLOC(1024); // with finalizable2
+ GC_REGISTER_FINALIZER_NO_ORDER(local3, finalizer2, (void *)2, 0, 0);
+ printf("alloc %p\n", local);
- local3 = GC_MALLOC(1024); // with finalizable2
- GC_REGISTER_FINALIZER_NO_ORDER(local3, finalizer2, (void*)2, 0, 0);
- printf("alloc %p\n", local);
+ local4 = GC_MALLOC(1024); // yet another
+ GC_REGISTER_FINALIZER_NO_ORDER(local4, finalizer2, (void *)3, 0, 0);
+ printf("alloc %p\n", local);
- local4 = GC_MALLOC(1024); // yet another
- GC_REGISTER_FINALIZER_NO_ORDER(local4, finalizer2, (void*)3, 0, 0);
- printf("alloc %p\n", local);
+ printf("basic test\n");
- printf("basic test\n");
+ GC_FORCE_COLLECT();
- GC_FORCE_COLLECT();
+ printf("*\n");
- printf("*\n");
+ GC_FREE(global); // force free will actually work
- GC_FREE(global); // force free will actually work
+ // scanning inside objects
- // scanning inside objects
+ global = GC_MALLOC(12);
+ GC_REGISTER_FINALIZER_NO_ORDER(global, finalizer, 0, 0, 0);
+ local = GC_MALLOC(12);
+ GC_REGISTER_FINALIZER_NO_ORDER(local, finalizer, (void *)1, 0, 0);
+ local2 = GC_MALLOC_ATOMIC(12);
+ GC_REGISTER_FINALIZER_NO_ORDER(local2, finalizer, (void *)2, 0, 0);
+ local3 = GC_MALLOC(12);
+ GC_REGISTER_FINALIZER_NO_ORDER(local3, finalizer, (void *)3, 0, 0);
+ local4 = GC_MALLOC(12);
+ GC_REGISTER_FINALIZER_NO_ORDER(local4, finalizer, (void *)4, 0, 0);
+ local5 = GC_MALLOC_UNCOLLECTABLE(12);
+ // This should never trigger since local5 is uncollectable
+ GC_REGISTER_FINALIZER_NO_ORDER(local5, finalizer, (void *)5, 0, 0);
- global = GC_MALLOC(12);
- GC_REGISTER_FINALIZER_NO_ORDER(global, finalizer, 0, 0, 0);
- local = GC_MALLOC(12);
- GC_REGISTER_FINALIZER_NO_ORDER(local, finalizer, (void*)1, 0, 0);
- local2 = GC_MALLOC_ATOMIC(12);
- GC_REGISTER_FINALIZER_NO_ORDER(local2, finalizer, (void*)2, 0, 0);
- local3 = GC_MALLOC(12);
- GC_REGISTER_FINALIZER_NO_ORDER(local3, finalizer, (void*)3, 0, 0);
- local4 = GC_MALLOC(12);
- GC_REGISTER_FINALIZER_NO_ORDER(local4, finalizer, (void*)4, 0, 0);
- local5 = GC_MALLOC_UNCOLLECTABLE(12);
- // This should never trigger since local5 is uncollectable
- GC_REGISTER_FINALIZER_NO_ORDER(local5, finalizer, (void*)5, 0, 0);
+ printf("heap size = %d\n", GC_get_heap_size());
- printf("heap size = %d\n", GC_get_heap_size());
+ local4 = GC_REALLOC(local4, 24);
- local4 = GC_REALLOC(local4, 24);
+ printf("heap size = %d\n", GC_get_heap_size());
- printf("heap size = %d\n", GC_get_heap_size());
+ local6 = GC_MALLOC(12);
+ GC_REGISTER_FINALIZER_NO_ORDER(local6, finalizer, (void *)6, 0, 0);
+ // This should be the same as a free
+ GC_REALLOC(local6, 0);
- local6 = GC_MALLOC(12);
- GC_REGISTER_FINALIZER_NO_ORDER(local6, finalizer, (void*)6, 0, 0);
- // This should be the same as a free
- GC_REALLOC(local6, 0);
+ void **globalData = (void **)global;
+ globalData[0] = local;
+ globalData[1] = local2;
- void **globalData = (void**)global;
- globalData[0] = local;
- globalData[1] = local2;
+ void **localData = (void **)local;
+ localData[0] = local3;
- void **localData = (void**)local;
- localData[0] = local3;
+ void **local2Data = (void **)local2;
+ local2Data[0] =
+ local4; // actually ignored, because local2 is atomic, so 4 is freeable
- void **local2Data = (void**)local2;
- local2Data[0] = local4; // actually ignored, because local2 is atomic, so 4 is freeable
+ printf("object scan test test\n");
- printf("object scan test test\n");
+ GC_FORCE_COLLECT();
- GC_FORCE_COLLECT();
+ printf("*\n");
- printf("*\n");
+ GC_FREE(global); // force free will actually work
- GC_FREE(global); // force free will actually work
+ printf("*\n");
- printf("*\n");
+ GC_FORCE_COLLECT();
- GC_FORCE_COLLECT();
+ printf(".\n");
- printf(".\n");
+ global = 0;
- global = 0;
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_getgep.in b/tests/core/test_getgep.in
index b92c4a1a..452942f9 100644
--- a/tests/core/test_getgep.in
+++ b/tests/core/test_getgep.in
@@ -1,17 +1,14 @@
+#include <stdio.h>
+struct {
+ int y[10];
+ int z[10];
+} commonblock;
- #include <stdio.h>
- struct {
- int y[10];
- int z[10];
- } commonblock;
-
- int main()
- {
- for (int i = 0; i < 10; ++i) {
- commonblock.y[i] = 1;
- commonblock.z[i] = 2;
- }
- printf("*%d %d*\n", commonblock.y[0], commonblock.z[0]);
- return 0;
- }
- \ No newline at end of file
+int main() {
+ for (int i = 0; i < 10; ++i) {
+ commonblock.y[i] = 1;
+ commonblock.z[i] = 2;
+ }
+ printf("*%d %d*\n", commonblock.y[0], commonblock.z[0]);
+ return 0;
+}
diff --git a/tests/core/test_getloadavg.in b/tests/core/test_getloadavg.in
index 8365a9a1..c592985a 100644
--- a/tests/core/test_getloadavg.in
+++ b/tests/core/test_getloadavg.in
@@ -1,15 +1,13 @@
+#include <stdio.h>
+#include <stdlib.h>
- #include <stdio.h>
- #include <stdlib.h>
-
- int main() {
- double load[5] = {42.13, 42.13, 42.13, 42.13, 42.13};
- printf("ret: %d\n", getloadavg(load, 5));
- printf("load[0]: %.3lf\n", load[0]);
- printf("load[1]: %.3lf\n", load[1]);
- printf("load[2]: %.3lf\n", load[2]);
- printf("load[3]: %.3lf\n", load[3]);
- printf("load[4]: %.3lf\n", load[4]);
- return 0;
- }
- \ No newline at end of file
+int main() {
+ double load[5] = {42.13, 42.13, 42.13, 42.13, 42.13};
+ printf("ret: %d\n", getloadavg(load, 5));
+ printf("load[0]: %.3lf\n", load[0]);
+ printf("load[1]: %.3lf\n", load[1]);
+ printf("load[2]: %.3lf\n", load[2]);
+ printf("load[3]: %.3lf\n", load[3]);
+ printf("load[4]: %.3lf\n", load[4]);
+ return 0;
+}
diff --git a/tests/core/test_getopt.in b/tests/core/test_getopt.in
index 1f03ef4e..6a678b79 100644
--- a/tests/core/test_getopt.in
+++ b/tests/core/test_getopt.in
@@ -1,45 +1,40 @@
-
- #pragma clang diagnostic ignored "-Winvalid-pp-token"
- #include <unistd.h>
- #include <stdlib.h>
- #include <stdio.h>
-
- int
- main(int argc, char *argv[])
- {
- int flags, opt;
- int nsecs, tfnd;
-
- nsecs = 0;
- tfnd = 0;
- flags = 0;
- while ((opt = getopt(argc, argv, "nt:")) != -1) {
- switch (opt) {
- case 'n':
- flags = 1;
- break;
- case 't':
- nsecs = atoi(optarg);
- tfnd = 1;
- break;
- default: /* '?' */
- fprintf(stderr, "Usage: %s [-t nsecs] [-n] name\n",
- argv[0]);
- exit(EXIT_FAILURE);
- }
- }
-
- printf("flags=%d; tfnd=%d; optind=%d\n", flags, tfnd, optind);
-
- if (optind >= argc) {
- fprintf(stderr, "Expected argument after options\n");
- exit(EXIT_FAILURE);
- }
-
- printf("name argument = %s\n", argv[optind]);
-
- /* Other code omitted */
-
- exit(EXIT_SUCCESS);
- }
- \ No newline at end of file
+#pragma clang diagnostic ignored "-Winvalid-pp-token"
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+int main(int argc, char *argv[]) {
+ int flags, opt;
+ int nsecs, tfnd;
+
+ nsecs = 0;
+ tfnd = 0;
+ flags = 0;
+ while ((opt = getopt(argc, argv, "nt:")) != -1) {
+ switch (opt) {
+ case 'n':
+ flags = 1;
+ break;
+ case 't':
+ nsecs = atoi(optarg);
+ tfnd = 1;
+ break;
+ default: /* '?' */
+ fprintf(stderr, "Usage: %s [-t nsecs] [-n] name\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ printf("flags=%d; tfnd=%d; optind=%d\n", flags, tfnd, optind);
+
+ if (optind >= argc) {
+ fprintf(stderr, "Expected argument after options\n");
+ exit(EXIT_FAILURE);
+ }
+
+ printf("name argument = %s\n", argv[optind]);
+
+ /* Other code omitted */
+
+ exit(EXIT_SUCCESS);
+}
diff --git a/tests/core/test_getopt_long.in b/tests/core/test_getopt_long.in
index cc5c3e21..18f19f2e 100644
--- a/tests/core/test_getopt_long.in
+++ b/tests/core/test_getopt_long.in
@@ -1,82 +1,73 @@
+#pragma clang diagnostic ignored "-Winvalid-pp-token"
+#pragma clang diagnostic ignored "-Wdeprecated-writable-strings"
+#include <stdio.h> /* for printf */
+#include <stdlib.h> /* for exit */
+#include <getopt.h>
- #pragma clang diagnostic ignored "-Winvalid-pp-token"
- #pragma clang diagnostic ignored "-Wdeprecated-writable-strings"
- #include <stdio.h> /* for printf */
- #include <stdlib.h> /* for exit */
- #include <getopt.h>
+int main(int argc, char **argv) {
+ int c;
+ int digit_optind = 0;
- int
- main(int argc, char **argv)
- {
- int c;
- int digit_optind = 0;
+ while (1) {
+ int this_option_optind = optind ? optind : 1;
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"add", required_argument, 0, 0},
+ {"append", no_argument, 0, 0},
+ {"delete", required_argument, 0, 0},
+ {"verbose", no_argument, 0, 0},
+ {"create", required_argument, 0, 'c'},
+ {"file", required_argument, 0, 0},
+ {0, 0, 0, 0}};
- while (1) {
- int this_option_optind = optind ? optind : 1;
- int option_index = 0;
- static struct option long_options[] = {
- {"add", required_argument, 0, 0 },
- {"append", no_argument, 0, 0 },
- {"delete", required_argument, 0, 0 },
- {"verbose", no_argument, 0, 0 },
- {"create", required_argument, 0, 'c'},
- {"file", required_argument, 0, 0 },
- {0, 0, 0, 0 }
- };
+ c = getopt_long(argc, argv, "abc:d:012", long_options, &option_index);
+ if (c == -1) break;
- c = getopt_long(argc, argv, "abc:d:012",
- long_options, &option_index);
- if (c == -1)
- break;
+ switch (c) {
+ case 0:
+ printf("option %s", long_options[option_index].name);
+ if (optarg) printf(" with arg %s", optarg);
+ printf("\n");
+ break;
- switch (c) {
- case 0:
- printf("option %s", long_options[option_index].name);
- if (optarg)
- printf(" with arg %s", optarg);
- printf("\n");
- break;
+ case '0':
+ case '1':
+ case '2':
+ if (digit_optind != 0 && digit_optind != this_option_optind)
+ printf("digits occur in two different argv-elements.\n");
+ digit_optind = this_option_optind;
+ printf("option %c\n", c);
+ break;
- case '0':
- case '1':
- case '2':
- if (digit_optind != 0 && digit_optind != this_option_optind)
- printf("digits occur in two different argv-elements.\n");
- digit_optind = this_option_optind;
- printf("option %c\n", c);
- break;
+ case 'a':
+ printf("option a\n");
+ break;
- case 'a':
- printf("option a\n");
- break;
+ case 'b':
+ printf("option b\n");
+ break;
- case 'b':
- printf("option b\n");
- break;
+ case 'c':
+ printf("option c with value '%s'\n", optarg);
+ break;
- case 'c':
- printf("option c with value '%s'\n", optarg);
- break;
+ case 'd':
+ printf("option d with value '%s'\n", optarg);
+ break;
- case 'd':
- printf("option d with value '%s'\n", optarg);
- break;
+ case '?':
+ break;
- case '?':
- break;
+ default:
+ printf("?? getopt returned character code 0%o ??\n", c);
+ }
+ }
- default:
- printf("?? getopt returned character code 0%o ??\n", c);
- }
- }
+ if (optind < argc) {
+ printf("non-option ARGV-elements: ");
+ while (optind < argc) printf("%s ", argv[optind++]);
+ printf("\n");
+ }
- if (optind < argc) {
- printf("non-option ARGV-elements: ");
- while (optind < argc)
- printf("%s ", argv[optind++]);
- printf("\n");
- }
-
- exit(EXIT_SUCCESS);
- }
- \ No newline at end of file
+ exit(EXIT_SUCCESS);
+}
diff --git a/tests/core/test_globaldoubles.in b/tests/core/test_globaldoubles.in
index 45acc194..9ccfb521 100644
--- a/tests/core/test_globaldoubles.in
+++ b/tests/core/test_globaldoubles.in
@@ -1,26 +1,23 @@
+#include <stdlib.h>
+#include <stdio.h>
- #include <stdlib.h>
- #include <stdio.h>
+double testVu, testVv, testWu, testWv;
- double testVu, testVv, testWu, testWv;
+void Test(double _testVu, double _testVv, double _testWu, double _testWv) {
+ testVu = _testVu;
+ testVv = _testVv;
+ testWu = _testWu;
+ testWv = _testWv;
+ printf("BUG?\n");
+ printf("Display: Vu=%f Vv=%f Wu=%f Wv=%f\n", testVu, testVv, testWu,
+ testWv);
+}
- void Test(double _testVu, double _testVv, double _testWu, double _testWv)
- {
- testVu = _testVu;
- testVv = _testVv;
- testWu = _testWu;
- testWv = _testWv;
- printf("BUG?\n");
- printf("Display: Vu=%f Vv=%f Wu=%f Wv=%f\n", testVu, testVv, testWu, testWv);
- }
-
- int main(void)
- {
- double v1 = 465.1;
- double v2 = 465.2;
- double v3 = 160.3;
- double v4 = 111.4;
- Test(v1, v2, v3, v4);
- return 0;
- }
- \ No newline at end of file
+int main(void) {
+ double v1 = 465.1;
+ double v2 = 465.2;
+ double v3 = 160.3;
+ double v4 = 111.4;
+ Test(v1, v2, v3, v4);
+ return 0;
+}
diff --git a/tests/core/test_globals.in b/tests/core/test_globals.in
index ed5e7891..f972687a 100644
--- a/tests/core/test_globals.in
+++ b/tests/core/test_globals.in
@@ -1,13 +1,10 @@
+#include <stdio.h>
- #include <stdio.h>
+char cache[256], *next = cache;
- char cache[256], *next = cache;
-
- int main()
- {
- cache[10] = 25;
- next[20] = 51;
- printf("*%d,%d*\n", next[10], cache[20]);
- return 0;
- }
- \ No newline at end of file
+int main() {
+ cache[10] = 25;
+ next[20] = 51;
+ printf("*%d,%d*\n", next[10], cache[20]);
+ return 0;
+}
diff --git a/tests/core/test_gmtime.in b/tests/core/test_gmtime.in
index 41ce87f9..7b7227ba 100644
--- a/tests/core/test_gmtime.in
+++ b/tests/core/test_gmtime.in
@@ -1,28 +1,26 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <assert.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- #include <assert.h>
+int main(void) {
+ time_t t = time(NULL);
+ struct tm *ptm = gmtime(&t);
+ struct tm tmCurrent = *ptm;
+ int hour = tmCurrent.tm_hour;
- int main(void)
- {
- time_t t=time(NULL);
- struct tm *ptm=gmtime(&t);
- struct tm tmCurrent=*ptm;
- int hour=tmCurrent.tm_hour;
-
- t-=hour*3600; // back to midnight
- int yday = -1;
- for(hour=0;hour<24;hour++)
- {
- ptm=gmtime(&t);
- // tm_yday must be constant all day...
- printf("yday: %d, hour: %d\n", ptm->tm_yday, hour);
- if (yday == -1) yday = ptm->tm_yday;
- else assert(yday == ptm->tm_yday);
- t+=3600; // add one hour
- }
- printf("ok!\n");
- return(0);
- }
- \ No newline at end of file
+ t -= hour * 3600; // back to midnight
+ int yday = -1;
+ for (hour = 0; hour < 24; hour++) {
+ ptm = gmtime(&t);
+ // tm_yday must be constant all day...
+ printf("yday: %d, hour: %d\n", ptm->tm_yday, hour);
+ if (yday == -1)
+ yday = ptm->tm_yday;
+ else
+ assert(yday == ptm->tm_yday);
+ t += 3600; // add one hour
+ }
+ printf("ok!\n");
+ return (0);
+}
diff --git a/tests/core/test_hello_world.in b/tests/core/test_hello_world.in
index d9ca3acb..b1d9bbbc 100644
--- a/tests/core/test_hello_world.in
+++ b/tests/core/test_hello_world.in
@@ -1,8 +1,5 @@
-
- #include <stdio.h>
- int main()
- {
- printf("hello, world!\n");
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+int main() {
+ printf("hello, world!\n");
+ return 0;
+}
diff --git a/tests/core/test_i16_emcc_intrinsic.in b/tests/core/test_i16_emcc_intrinsic.in
index 54008cee..a2aa27ee 100644
--- a/tests/core/test_i16_emcc_intrinsic.in
+++ b/tests/core/test_i16_emcc_intrinsic.in
@@ -1,20 +1,18 @@
+#include <stdio.h>
- #include <stdio.h>
+int test(unsigned short a, unsigned short b) {
+ unsigned short result = a;
+ result += b;
+ if (result < b) printf("C!");
+ return result;
+}
- int test(unsigned short a, unsigned short b) {
- unsigned short result = a;
- result += b;
- if (result < b) printf("C!");
- return result;
- }
-
- int main(void) {
- printf(",%d,", test(0, 0));
- printf(",%d,", test(1, 1));
- printf(",%d,", test(65535, 1));
- printf(",%d,", test(1, 65535));
- printf(",%d,", test(32768, 32767));
- printf(",%d,", test(32768, 32768));
- return 0;
- }
- \ No newline at end of file
+int main(void) {
+ printf(",%d,", test(0, 0));
+ printf(",%d,", test(1, 1));
+ printf(",%d,", test(65535, 1));
+ printf(",%d,", test(1, 65535));
+ printf(",%d,", test(32768, 32767));
+ printf(",%d,", test(32768, 32768));
+ return 0;
+}
diff --git a/tests/core/test_i32_mul_precise.in b/tests/core/test_i32_mul_precise.in
index f045a768..2e62b4ba 100644
--- a/tests/core/test_i32_mul_precise.in
+++ b/tests/core/test_i32_mul_precise.in
@@ -1,11 +1,12 @@
+#include <stdio.h>
- #include <stdio.h>
-
- int main(int argc, char **argv) {
- unsigned long d1 = 0x847c9b5d;
- unsigned long q = 0x549530e1;
- if (argc > 1000) { q += argc; d1 -= argc; } // confuse optimizer
- printf("%lu\n", d1*q);
- return 0;
- }
- \ No newline at end of file
+int main(int argc, char **argv) {
+ unsigned long d1 = 0x847c9b5d;
+ unsigned long q = 0x549530e1;
+ if (argc > 1000) {
+ q += argc;
+ d1 -= argc;
+ } // confuse optimizer
+ printf("%lu\n", d1 * q);
+ return 0;
+}
diff --git a/tests/core/test_i32_mul_semiprecise.in b/tests/core/test_i32_mul_semiprecise.in
index c7b4cb96..a93a69da 100644
--- a/tests/core/test_i32_mul_semiprecise.in
+++ b/tests/core/test_i32_mul_semiprecise.in
@@ -1,28 +1,26 @@
+#include <stdio.h>
- #include <stdio.h>
+typedef unsigned int uint;
- typedef unsigned int uint;
+// from cube2, zlib licensed
- // from cube2, zlib licensed
+#define N (624)
+#define M (397)
+#define K (0x9908B0DFU)
- #define N (624)
- #define M (397)
- #define K (0x9908B0DFU)
+static uint state[N];
+static int next = N;
- static uint state[N];
- static int next = N;
+void seedMT(uint seed) {
+ state[0] = seed;
+ for (uint i = 1; i < N; i++) // if we do not do this precisely, at least we
+ // should coerce to int immediately, not wait
+ state[i] = seed = 1812433253U * (seed ^ (seed >> 30)) + i;
+ next = 0;
+}
- void seedMT(uint seed)
- {
- state[0] = seed;
- for(uint i = 1; i < N; i++) // if we do not do this precisely, at least we should coerce to int immediately, not wait
- state[i] = seed = 1812433253U * (seed ^ (seed >> 30)) + i;
- next = 0;
- }
-
- int main() {
- seedMT(5497);
- for (int i = 0; i < 10; i++) printf("%d: %u\n", i, state[i]);
- return 0;
- }
- \ No newline at end of file
+int main() {
+ seedMT(5497);
+ for (int i = 0; i < 10; i++) printf("%d: %u\n", i, state[i]);
+ return 0;
+}
diff --git a/tests/core/test_i64_7z.in b/tests/core/test_i64_7z.in
index 1d2f03a8..c15bfd78 100644
--- a/tests/core/test_i64_7z.in
+++ b/tests/core/test_i64_7z.in
@@ -1,17 +1,14 @@
-
- #include <stdint.h>
- #include <stdio.h>
- uint64_t a, b;
- int main(int argc, char *argv[])
- {
- a = argc;
- b = argv[1][0];
- printf("%d,%d\n", a, b);
- if (a > a + b || a > a + b + 1) {
- printf("one %lld, %lld", a, b);
- return 0;
- }
- printf("zero %lld, %lld", a, b);
- return 0;
- }
- \ No newline at end of file
+#include <stdint.h>
+#include <stdio.h>
+uint64_t a, b;
+int main(int argc, char *argv[]) {
+ a = argc;
+ b = argv[1][0];
+ printf("%d,%d\n", a, b);
+ if (a > a + b || a > a + b + 1) {
+ printf("one %lld, %lld", a, b);
+ return 0;
+ }
+ printf("zero %lld, %lld", a, b);
+ return 0;
+}
diff --git a/tests/core/test_i64_b.in b/tests/core/test_i64_b.in
index b373a3aa..1cd87104 100644
--- a/tests/core/test_i64_b.in
+++ b/tests/core/test_i64_b.in
@@ -1,22 +1,20 @@
+#include <stdio.h>
+#include <sys/time.h>
- #include <stdio.h>
- #include <sys/time.h>
+typedef long long int64;
- typedef long long int64;
+#define PRMJ_USEC_PER_SEC 1000000L
- #define PRMJ_USEC_PER_SEC 1000000L
-
- int main(int argc, char * argv[]) {
- int64 sec = 1329409675 + argc;
- int64 usec = 2329509675;
- int64 mul = int64(sec) * PRMJ_USEC_PER_SEC;
- int64 add = mul + int64(usec);
- int add_low = add;
- int add_high = add >> 32;
- printf("*%lld,%lld,%u,%u*\n", mul, add, add_low, add_high);
- int64 x = sec + (usec << 25);
- x >>= argc*3;
- printf("*%llu*\n", x);
- return 0;
- }
- \ No newline at end of file
+int main(int argc, char* argv[]) {
+ int64 sec = 1329409675 + argc;
+ int64 usec = 2329509675;
+ int64 mul = int64(sec) * PRMJ_USEC_PER_SEC;
+ int64 add = mul + int64(usec);
+ int add_low = add;
+ int add_high = add >> 32;
+ printf("*%lld,%lld,%u,%u*\n", mul, add, add_low, add_high);
+ int64 x = sec + (usec << 25);
+ x >>= argc * 3;
+ printf("*%llu*\n", x);
+ return 0;
+}
diff --git a/tests/core/test_i64_cmp.in b/tests/core/test_i64_cmp.in
index b967d2ff..b9cadd4a 100644
--- a/tests/core/test_i64_cmp.in
+++ b/tests/core/test_i64_cmp.in
@@ -1,18 +1,14 @@
+#include <stdio.h>
- #include <stdio.h>
+typedef long long int64;
- typedef long long int64;
+bool compare(int64 val) { return val == -12; }
- bool compare(int64 val) {
- return val == -12;
- }
+bool compare2(int64 val) { return val < -12; }
- bool compare2(int64 val) {
- return val < -12;
- }
-
- int main(int argc, char * argv[]) {
- printf("*%d,%d,%d,%d,%d,%d*\n", argc, compare(argc-1-12), compare(1000+argc), compare2(argc-1-10), compare2(argc-1-14), compare2(argc+1000));
- return 0;
- }
- \ No newline at end of file
+int main(int argc, char* argv[]) {
+ printf("*%d,%d,%d,%d,%d,%d*\n", argc, compare(argc - 1 - 12),
+ compare(1000 + argc), compare2(argc - 1 - 10), compare2(argc - 1 - 14),
+ compare2(argc + 1000));
+ return 0;
+}
diff --git a/tests/core/test_i64_cmp2.in b/tests/core/test_i64_cmp2.in
index b285e1a1..8985e5a8 100644
--- a/tests/core/test_i64_cmp2.in
+++ b/tests/core/test_i64_cmp2.in
@@ -1,32 +1,28 @@
+#include <inttypes.h>
+#include <stdio.h>
- #include <inttypes.h>
- #include <stdio.h>
+typedef int32_t INT32;
+typedef int64_t INT64;
+typedef uint8_t UINT8;
- typedef int32_t INT32;
- typedef int64_t INT64;
- typedef uint8_t UINT8;
+void interface_clock_changed() {
+ UINT8 m_divshift;
+ INT32 m_divisor;
- void interface_clock_changed()
- {
- UINT8 m_divshift;
- INT32 m_divisor;
+ // INT64 attos = m_attoseconds_per_cycle;
+ INT64 attos = 279365114840;
+ m_divshift = 0;
+ while (attos >= (1UL << 31)) {
+ m_divshift++;
+ printf("m_divshift is %i, on %Ld >?= %lu\n", m_divshift, attos, 1UL << 31);
+ attos >>= 1;
+ }
+ m_divisor = attos;
- //INT64 attos = m_attoseconds_per_cycle;
- INT64 attos = 279365114840;
- m_divshift = 0;
- while (attos >= (1UL << 31))
- {
- m_divshift++;
- printf("m_divshift is %i, on %Ld >?= %lu\n", m_divshift, attos, 1UL << 31);
- attos >>= 1;
- }
- m_divisor = attos;
+ printf("m_divisor is %i\n", m_divisor);
+}
- printf("m_divisor is %i\n",m_divisor);
- }
-
- int main() {
- interface_clock_changed();
- return 0;
- }
- \ No newline at end of file
+int main() {
+ interface_clock_changed();
+ return 0;
+}
diff --git a/tests/core/test_i64_double.in b/tests/core/test_i64_double.in
index 4b39355e..2b524971 100644
--- a/tests/core/test_i64_double.in
+++ b/tests/core/test_i64_double.in
@@ -1,38 +1,34 @@
+#include <stdio.h>
- #include <stdio.h>
+typedef long long int64;
+#define JSDOUBLE_HI32_SIGNBIT 0x80000000
- typedef long long int64;
- #define JSDOUBLE_HI32_SIGNBIT 0x80000000
+bool JSDOUBLE_IS_NEGZERO(double d) {
+ union {
+ struct {
+ unsigned int lo, hi;
+ } s;
+ double d;
+ } x;
+ if (d != 0) return false;
+ x.d = d;
+ return (x.s.hi & JSDOUBLE_HI32_SIGNBIT) != 0;
+}
- bool JSDOUBLE_IS_NEGZERO(double d)
- {
- union {
- struct {
- unsigned int lo, hi;
- } s;
- double d;
- } x;
- if (d != 0)
- return false;
- x.d = d;
- return (x.s.hi & JSDOUBLE_HI32_SIGNBIT) != 0;
- }
+bool JSINT64_IS_NEGZERO(int64 l) {
+ union {
+ int64 i;
+ double d;
+ } x;
+ if (l != 0) return false;
+ x.i = l;
+ return x.d == -0;
+}
- bool JSINT64_IS_NEGZERO(int64 l)
- {
- union {
- int64 i;
- double d;
- } x;
- if (l != 0)
- return false;
- x.i = l;
- return x.d == -0;
- }
-
- int main(int argc, char * argv[]) {
- printf("*%d,%d,%d,%d*\n", JSDOUBLE_IS_NEGZERO(0), JSDOUBLE_IS_NEGZERO(-0), JSDOUBLE_IS_NEGZERO(-1), JSDOUBLE_IS_NEGZERO(+1));
- printf("*%d,%d,%d,%d*\n", JSINT64_IS_NEGZERO(0), JSINT64_IS_NEGZERO(-0), JSINT64_IS_NEGZERO(-1), JSINT64_IS_NEGZERO(+1));
- return 0;
- }
- \ No newline at end of file
+int main(int argc, char* argv[]) {
+ printf("*%d,%d,%d,%d*\n", JSDOUBLE_IS_NEGZERO(0), JSDOUBLE_IS_NEGZERO(-0),
+ JSDOUBLE_IS_NEGZERO(-1), JSDOUBLE_IS_NEGZERO(+1));
+ printf("*%d,%d,%d,%d*\n", JSINT64_IS_NEGZERO(0), JSINT64_IS_NEGZERO(-0),
+ JSINT64_IS_NEGZERO(-1), JSINT64_IS_NEGZERO(+1));
+ return 0;
+}
diff --git a/tests/core/test_i64_i16.in b/tests/core/test_i64_i16.in
index dcd9a69e..81d4a7bd 100644
--- a/tests/core/test_i64_i16.in
+++ b/tests/core/test_i64_i16.in
@@ -1,12 +1,10 @@
-
- #include <stdint.h>
- #include <stdio.h>
- int main(int argc, char ** argv){
- int y=-133;
- int64_t x= ((int64_t)((short)(y)))*(100 + argc);
- if(x>0)
- printf(">0\n");
- else
- printf("<=0\n");
- }
- \ No newline at end of file
+#include <stdint.h>
+#include <stdio.h>
+int main(int argc, char** argv) {
+ int y = -133;
+ int64_t x = ((int64_t)((short)(y))) * (100 + argc);
+ if (x > 0)
+ printf(">0\n");
+ else
+ printf("<=0\n");
+}
diff --git a/tests/core/test_i64_llabs.in b/tests/core/test_i64_llabs.in
index 10961970..5d10bee0 100644
--- a/tests/core/test_i64_llabs.in
+++ b/tests/core/test_i64_llabs.in
@@ -1,9 +1,7 @@
+#include <stdio.h>
+#include <stdlib.h>
- #include <stdio.h>
- #include <stdlib.h>
-
- int main(int argc, char ** argv) {
- printf("%lld,%lld\n", llabs(-576460752303423489), llabs(576460752303423489));
- return 0;
- }
- \ No newline at end of file
+int main(int argc, char** argv) {
+ printf("%lld,%lld\n", llabs(-576460752303423489), llabs(576460752303423489));
+ return 0;
+}
diff --git a/tests/core/test_i64_qdouble.in b/tests/core/test_i64_qdouble.in
index 1b8297e4..db47afa6 100644
--- a/tests/core/test_i64_qdouble.in
+++ b/tests/core/test_i64_qdouble.in
@@ -1,21 +1,14 @@
+#include <stdio.h>
+typedef long long qint64; /* 64 bit signed */
+typedef double qreal;
- #include <stdio.h>
- typedef long long qint64; /* 64 bit signed */
- typedef double qreal;
-
-
- int main(int argc, char **argv)
- {
- qreal c = 111;
- qint64 d = -111 + (argc - 1);
- c += d;
- if (c < -1 || c > 1)
- {
- printf("Failed!\n");
- }
- else
- {
- printf("Succeeded!\n");
- }
- };
- \ No newline at end of file
+int main(int argc, char **argv) {
+ qreal c = 111;
+ qint64 d = -111 + (argc - 1);
+ c += d;
+ if (c < -1 || c > 1) {
+ printf("Failed!\n");
+ } else {
+ printf("Succeeded!\n");
+ }
+};
diff --git a/tests/core/test_i64_umul.in b/tests/core/test_i64_umul.in
index 4b4bdaca..bfe97154 100644
--- a/tests/core/test_i64_umul.in
+++ b/tests/core/test_i64_umul.in
@@ -1,20 +1,18 @@
+#include <inttypes.h>
+#include <stdio.h>
- #include <inttypes.h>
- #include <stdio.h>
+typedef uint32_t UINT32;
+typedef uint64_t UINT64;
- typedef uint32_t UINT32;
- typedef uint64_t UINT64;
+int main() {
+ volatile UINT32 testu32a = 2375724032U;
+ UINT32 bigu32 = 0xffffffffU;
+ volatile UINT64 testu64a = 14746250828952703000U;
- int main() {
- volatile UINT32 testu32a = 2375724032U;
- UINT32 bigu32 = 0xffffffffU;
- volatile UINT64 testu64a = 14746250828952703000U;
+ while ((UINT64)testu32a * (UINT64)bigu32 < testu64a) {
+ printf("testu64a is %llu\n", testu64a);
+ testu64a /= 2;
+ }
- while ((UINT64)testu32a * (UINT64)bigu32 < testu64a) {
- printf("testu64a is %llu\n", testu64a);
- testu64a /= 2;
- }
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_i64_varargs.in b/tests/core/test_i64_varargs.in
index 94982b51..7d2e4267 100644
--- a/tests/core/test_i64_varargs.in
+++ b/tests/core/test_i64_varargs.in
@@ -1,30 +1,29 @@
+#include <stdio.h>
+#include <stdint.h>
+#include <stdarg.h>
- #include <stdio.h>
- #include <stdint.h>
- #include <stdarg.h>
+int64_t ccv_cache_generate_signature(char *msg, int len, int64_t sig_start,
+ ...) {
+ if (sig_start < 10123) printf("%s\n", msg + len);
+ va_list v;
+ va_start(v, sig_start);
+ if (sig_start > 1413)
+ printf("%d\n", va_arg(v, int));
+ else
+ printf("nada\n");
+ va_end(v);
+ return len * sig_start * (msg[0] + 1);
+}
- int64_t ccv_cache_generate_signature(char *msg, int len, int64_t sig_start, ...) {
- if (sig_start < 10123)
- printf("%s\n", msg+len);
- va_list v;
- va_start(v, sig_start);
- if (sig_start > 1413)
- printf("%d\n", va_arg(v, int));
- else
- printf("nada\n");
- va_end(v);
- return len*sig_start*(msg[0]+1);
- }
-
- int main(int argc, char **argv)
- {
- for (int i = 0; i < argc; i++) {
- int64_t x;
- if (i % 123123 == 0)
- x = ccv_cache_generate_signature(argv[i], i+2, (int64_t)argc*argc, 54.111);
- else
- x = ccv_cache_generate_signature(argv[i], i+2, (int64_t)argc*argc, 13);
- printf("%lld\n", x);
- }
- };
- \ No newline at end of file
+int main(int argc, char **argv) {
+ for (int i = 0; i < argc; i++) {
+ int64_t x;
+ if (i % 123123 == 0)
+ x = ccv_cache_generate_signature(argv[i], i + 2, (int64_t)argc * argc,
+ 54.111);
+ else
+ x = ccv_cache_generate_signature(argv[i], i + 2, (int64_t)argc * argc,
+ 13);
+ printf("%lld\n", x);
+ }
+};
diff --git a/tests/core/test_i64_zextneg.in b/tests/core/test_i64_zextneg.in
index 3f77131d..b7e204fe 100644
--- a/tests/core/test_i64_zextneg.in
+++ b/tests/core/test_i64_zextneg.in
@@ -1,16 +1,13 @@
+#include <stdint.h>
+#include <stdio.h>
- #include <stdint.h>
- #include <stdio.h>
+int main(int argc, char *argv[]) {
+ uint8_t byte = 0x80;
+ uint16_t two = byte;
+ uint32_t four = byte;
+ uint64_t eight = byte;
- int main(int argc, char *argv[])
- {
- uint8_t byte = 0x80;
- uint16_t two = byte;
- uint32_t four = byte;
- uint64_t eight = byte;
+ printf("value: %d,%d,%d,%lld.\n", byte, two, four, eight);
- printf("value: %d,%d,%d,%lld.\n", byte, two, four, eight);
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_if.in b/tests/core/test_if.in
index 20ed3a01..07edbe8d 100644
--- a/tests/core/test_if.in
+++ b/tests/core/test_if.in
@@ -1,11 +1,8 @@
-
- #include <stdio.h>
- int main()
- {
- int x = 5;
- if (x > 3) {
- printf("*yes*\n");
- }
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+int main() {
+ int x = 5;
+ if (x > 3) {
+ printf("*yes*\n");
+ }
+ return 0;
+}
diff --git a/tests/core/test_if_else.in b/tests/core/test_if_else.in
index 03b2bfa6..b7693eed 100644
--- a/tests/core/test_if_else.in
+++ b/tests/core/test_if_else.in
@@ -1,13 +1,10 @@
-
- #include <stdio.h>
- int main()
- {
- int x = 5;
- if (x > 10) {
- printf("*yes*\n");
- } else {
- printf("*no*\n");
- }
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+int main() {
+ int x = 5;
+ if (x > 10) {
+ printf("*yes*\n");
+ } else {
+ printf("*no*\n");
+ }
+ return 0;
+}
diff --git a/tests/core/test_indirectbr.in b/tests/core/test_indirectbr.in
index bdc66b53..ae3f1baa 100644
--- a/tests/core/test_indirectbr.in
+++ b/tests/core/test_indirectbr.in
@@ -1,21 +1,20 @@
+#include <stdio.h>
+int main(void) {
+ const void *addrs[2] = {&&FOO, &&BAR};
- #include <stdio.h>
- int main(void) {
- const void *addrs[2] = { &&FOO, &&BAR };
+ // confuse the optimizer so it doesn't hardcode the jump and avoid generating
+ // an |indirectbr| instruction
+ int which = 0;
+ for (int x = 0; x < 1000; x++) which = (which + x * x) % 7;
+ which = (which % 2) + 1;
- // confuse the optimizer so it doesn't hardcode the jump and avoid generating an |indirectbr| instruction
- int which = 0;
- for (int x = 0; x < 1000; x++) which = (which + x*x) % 7;
- which = (which % 2) + 1;
+ goto *addrs[which];
- goto *addrs[which];
-
- FOO:
- printf("bad\n");
- return 0;
- BAR:
- printf("good\n");
- const void *addr = &&FOO;
- goto *addr;
- }
- \ No newline at end of file
+FOO:
+ printf("bad\n");
+ return 0;
+BAR:
+ printf("good\n");
+ const void *addr = &&FOO;
+ goto *addr;
+}
diff --git a/tests/core/test_indirectbr_many.in b/tests/core/test_indirectbr_many.in
index 769c331f..7937d197 100644
--- a/tests/core/test_indirectbr_many.in
+++ b/tests/core/test_indirectbr_many.in
@@ -1,1510 +1,44 @@
+#include <stdio.h>
- #include <stdio.h>
- int main(int argc, char **argv) {
- printf("\n");
- const void *addrs[] = { &&B0, &&B1, &&B2, &&B3, &&B4, &&B5, &&B6, &&B7, &&B8, &&B9, &&B10, &&B11, &&B12, &&B13, &&B14, &&B15, &&B16, &&B17, &&B18, &&B19, &&B20, &&B21, &&B22, &&B23, &&B24, &&B25, &&B26, &&B27, &&B28, &&B29, &&B30, &&B31, &&B32, &&B33, &&B34, &&B35, &&B36, &&B37, &&B38, &&B39, &&B40, &&B41, &&B42, &&B43, &&B44, &&B45, &&B46, &&B47, &&B48, &&B49, &&B50, &&B51, &&B52, &&B53, &&B54, &&B55, &&B56, &&B57, &&B58, &&B59, &&B60, &&B61, &&B62, &&B63, &&B64, &&B65, &&B66, &&B67, &&B68, &&B69, &&B70, &&B71, &&B72, &&B73, &&B74, &&B75, &&B76, &&B77, &&B78, &&B79, &&B80, &&B81, &&B82, &&B83, &&B84, &&B85, &&B86, &&B87, &&B88, &&B89, &&B90, &&B91, &&B92, &&B93, &&B94, &&B95, &&B96, &&B97, &&B98, &&B99, &&B100, &&B101, &&B102, &&B103, &&B104, &&B105, &&B106, &&B107, &&B108, &&B109, &&B110, &&B111, &&B112, &&B113, &&B114, &&B115, &&B116, &&B117, &&B118, &&B119, &&B120, &&B121, &&B122, &&B123, &&B124, &&B125, &&B126, &&B127, &&B128, &&B129, &&B130, &&B131, &&B132, &&B133, &&B134, &&B135, &&B136, &&B137, &&B138, &&B139, &&B140, &&B141, &&B142, &&B143, &&B144, &&B145, &&B146, &&B147, &&B148, &&B149, &&B150, &&B151, &&B152, &&B153, &&B154, &&B155, &&B156, &&B157, &&B158, &&B159, &&B160, &&B161, &&B162, &&B163, &&B164, &&B165, &&B166, &&B167, &&B168, &&B169, &&B170, &&B171, &&B172, &&B173, &&B174, &&B175, &&B176, &&B177, &&B178, &&B179, &&B180, &&B181, &&B182, &&B183, &&B184, &&B185, &&B186, &&B187, &&B188, &&B189, &&B190, &&B191, &&B192, &&B193, &&B194, &&B195, &&B196, &&B197, &&B198, &&B199, &&B200, &&B201, &&B202, &&B203, &&B204, &&B205, &&B206, &&B207, &&B208, &&B209, &&B210, &&B211, &&B212, &&B213, &&B214, &&B215, &&B216, &&B217, &&B218, &&B219, &&B220, &&B221, &&B222, &&B223, &&B224, &&B225, &&B226, &&B227, &&B228, &&B229, &&B230, &&B231, &&B232, &&B233, &&B234, &&B235, &&B236, &&B237, &&B238, &&B239, &&B240, &&B241, &&B242, &&B243, &&B244, &&B245, &&B246, &&B247, &&B248, &&B249, &&B250, &&B251, &&B252, &&B253, &&B254, &&B255, &&B256, &&B257, &&B258, &&B259, &&B260, &&B261, &&B262, &&B263, &&B264, &&B265, &&B266, &&B267, &&B268, &&B269, &&B270, &&B271, &&B272, &&B273, &&B274, &&B275, &&B276, &&B277, &&B278, &&B279, &&B280, &&B281, &&B282, &&B283, &&B284, &&B285, &&B286, &&B287, &&B288, &&B289, &&B290, &&B291, &&B292, &&B293, &&B294, &&B295, &&B296, &&B297, &&B298, &&B299, &&B300, &&B301, &&B302, &&B303, &&B304, &&B305, &&B306, &&B307, &&B308, &&B309, &&B310, &&B311, &&B312, &&B313, &&B314, &&B315, &&B316, &&B317, &&B318, &&B319, &&B320, &&B321, &&B322, &&B323, &&B324, &&B325, &&B326, &&B327, &&B328, &&B329, &&B330, &&B331, &&B332, &&B333, &&B334, &&B335, &&B336, &&B337, &&B338, &&B339, &&B340, &&B341, &&B342, &&B343, &&B344, &&B345, &&B346, &&B347, &&B348, &&B349, &&B350, &&B351, &&B352, &&B353, &&B354, &&B355, &&B356, &&B357, &&B358, &&B359, &&B360, &&B361, &&B362, &&B363, &&B364, &&B365, &&B366, &&B367, &&B368, &&B369, &&B370, &&B371, &&B372, &&B373, &&B374, &&B375, &&B376, &&B377, &&B378, &&B379, &&B380, &&B381, &&B382, &&B383, &&B384, &&B385, &&B386, &&B387, &&B388, &&B389, &&B390, &&B391, &&B392, &&B393, &&B394, &&B395, &&B396, &&B397, &&B398, &&B399, &&B400, &&B401, &&B402, &&B403, &&B404, &&B405, &&B406, &&B407, &&B408, &&B409, &&B410, &&B411, &&B412, &&B413, &&B414, &&B415, &&B416, &&B417, &&B418, &&B419, &&B420, &&B421, &&B422, &&B423, &&B424, &&B425, &&B426, &&B427, &&B428, &&B429, &&B430, &&B431, &&B432, &&B433, &&B434, &&B435, &&B436, &&B437, &&B438, &&B439, &&B440, &&B441, &&B442, &&B443, &&B444, &&B445, &&B446, &&B447, &&B448, &&B449, &&B450, &&B451, &&B452, &&B453, &&B454, &&B455, &&B456, &&B457, &&B458, &&B459, &&B460, &&B461, &&B462, &&B463, &&B464, &&B465, &&B466, &&B467, &&B468, &&B469, &&B470, &&B471, &&B472, &&B473, &&B474, &&B475, &&B476, &&B477, &&B478, &&B479, &&B480, &&B481, &&B482, &&B483, &&B484, &&B485, &&B486, &&B487, &&B488, &&B489, &&B490, &&B491, &&B492, &&B493, &&B494, &&B495, &&B496, &&B497, &&B498, &&B499, &&B500, &&B501, &&B502, &&B503, &&B504, &&B505, &&B506, &&B507, &&B508, &&B509, &&B510, &&B511, &&B512, &&B513, &&B514, &&B515, &&B516, &&B517, &&B518, &&B519, &&B520, &&B521, &&B522, &&B523, &&B524, &&B525, &&B526, &&B527, &&B528, &&B529, &&B530, &&B531, &&B532, &&B533, &&B534, &&B535, &&B536, &&B537, &&B538, &&B539, &&B540, &&B541, &&B542, &&B543, &&B544, &&B545, &&B546, &&B547, &&B548, &&B549, &&B550, &&B551, &&B552, &&B553, &&B554, &&B555, &&B556, &&B557, &&B558, &&B559, &&B560, &&B561, &&B562, &&B563, &&B564, &&B565, &&B566, &&B567, &&B568, &&B569, &&B570, &&B571, &&B572, &&B573, &&B574, &&B575, &&B576, &&B577, &&B578, &&B579, &&B580, &&B581, &&B582, &&B583, &&B584, &&B585, &&B586, &&B587, &&B588, &&B589, &&B590, &&B591, &&B592, &&B593, &&B594, &&B595, &&B596, &&B597, &&B598, &&B599, &&B600, &&B601, &&B602, &&B603, &&B604, &&B605, &&B606, &&B607, &&B608, &&B609, &&B610, &&B611, &&B612, &&B613, &&B614, &&B615, &&B616, &&B617, &&B618, &&B619, &&B620, &&B621, &&B622, &&B623, &&B624, &&B625, &&B626, &&B627, &&B628, &&B629, &&B630, &&B631, &&B632, &&B633, &&B634, &&B635, &&B636, &&B637, &&B638, &&B639, &&B640, &&B641, &&B642, &&B643, &&B644, &&B645, &&B646, &&B647, &&B648, &&B649, &&B650, &&B651, &&B652, &&B653, &&B654, &&B655, &&B656, &&B657, &&B658, &&B659, &&B660, &&B661, &&B662, &&B663, &&B664, &&B665, &&B666, &&B667, &&B668, &&B669, &&B670, &&B671, &&B672, &&B673, &&B674, &&B675, &&B676, &&B677, &&B678, &&B679, &&B680, &&B681, &&B682, &&B683, &&B684, &&B685, &&B686, &&B687, &&B688, &&B689, &&B690, &&B691, &&B692, &&B693, &&B694, &&B695, &&B696, &&B697, &&B698, &&B699, &&B700, &&B701, &&B702, &&B703, &&B704, &&B705, &&B706, &&B707, &&B708, &&B709, &&B710, &&B711, &&B712, &&B713, &&B714, &&B715, &&B716, &&B717, &&B718, &&B719, &&B720, &&B721, &&B722, &&B723, &&B724, &&B725, &&B726, &&B727, &&B728, &&B729, &&B730, &&B731, &&B732, &&B733, &&B734, &&B735, &&B736, &&B737, &&B738, &&B739, &&B740, &&B741, &&B742, &&B743, &&B744, &&B745, &&B746, &&B747, &&B748, &&B749, &&B750, &&B751, &&B752, &&B753, &&B754, &&B755, &&B756, &&B757, &&B758, &&B759, &&B760, &&B761, &&B762, &&B763, &&B764, &&B765, &&B766, &&B767, &&B768, &&B769, &&B770, &&B771, &&B772, &&B773, &&B774, &&B775, &&B776, &&B777, &&B778, &&B779, &&B780, &&B781, &&B782, &&B783, &&B784, &&B785, &&B786, &&B787, &&B788, &&B789, &&B790, &&B791, &&B792, &&B793, &&B794, &&B795, &&B796, &&B797, &&B798, &&B799, &&B800, &&B801, &&B802, &&B803, &&B804, &&B805, &&B806, &&B807, &&B808, &&B809, &&B810, &&B811, &&B812, &&B813, &&B814, &&B815, &&B816, &&B817, &&B818, &&B819, &&B820, &&B821, &&B822, &&B823, &&B824, &&B825, &&B826, &&B827, &&B828, &&B829, &&B830, &&B831, &&B832, &&B833, &&B834, &&B835, &&B836, &&B837, &&B838, &&B839, &&B840, &&B841, &&B842, &&B843, &&B844, &&B845, &&B846, &&B847, &&B848, &&B849, &&B850, &&B851, &&B852, &&B853, &&B854, &&B855, &&B856, &&B857, &&B858, &&B859, &&B860, &&B861, &&B862, &&B863, &&B864, &&B865, &&B866, &&B867, &&B868, &&B869, &&B870, &&B871, &&B872, &&B873, &&B874, &&B875, &&B876, &&B877, &&B878, &&B879, &&B880, &&B881, &&B882, &&B883, &&B884, &&B885, &&B886, &&B887, &&B888, &&B889, &&B890, &&B891, &&B892, &&B893, &&B894, &&B895, &&B896, &&B897, &&B898, &&B899, &&B900, &&B901, &&B902, &&B903, &&B904, &&B905, &&B906, &&B907, &&B908, &&B909, &&B910, &&B911, &&B912, &&B913, &&B914, &&B915, &&B916, &&B917, &&B918, &&B919, &&B920, &&B921, &&B922, &&B923, &&B924, &&B925, &&B926, &&B927, &&B928, &&B929, &&B930, &&B931, &&B932, &&B933, &&B934, &&B935, &&B936, &&B937, &&B938, &&B939, &&B940, &&B941, &&B942, &&B943, &&B944, &&B945, &&B946, &&B947, &&B948, &&B949, &&B950, &&B951, &&B952, &&B953, &&B954, &&B955, &&B956, &&B957, &&B958, &&B959, &&B960, &&B961, &&B962, &&B963, &&B964, &&B965, &&B966, &&B967, &&B968, &&B969, &&B970, &&B971, &&B972, &&B973, &&B974, &&B975, &&B976, &&B977, &&B978, &&B979, &&B980, &&B981, &&B982, &&B983, &&B984, &&B985, &&B986, &&B987, &&B988, &&B989, &&B990, &&B991, &&B992, &&B993, &&B994, &&B995, &&B996, &&B997, &&B998, &&B999, &&B1000, &&B1001, &&B1002, &&B1003, &&B1004, &&B1005, &&B1006, &&B1007, &&B1008, &&B1009, &&B1010, &&B1011, &&B1012, &&B1013, &&B1014, &&B1015, &&B1016, &&B1017, &&B1018, &&B1019, &&B1020, &&B1021, &&B1022, &&B1023, &&B1024, &&B1025, &&B1026, &&B1027, &&B1028, &&B1029, &&B1030, &&B1031, &&B1032, &&B1033, &&B1034, &&B1035, &&B1036, &&B1037, &&B1038, &&B1039, &&B1040, &&B1041, &&B1042, &&B1043, &&B1044, &&B1045, &&B1046, &&B1047, &&B1048, &&B1049, &&B1050, &&B1051, &&B1052, &&B1053, &&B1054, &&B1055, &&B1056, &&B1057, &&B1058, &&B1059, &&B1060, &&B1061, &&B1062, &&B1063, &&B1064, &&B1065, &&B1066, &&B1067, &&B1068, &&B1069, &&B1070, &&B1071, &&B1072, &&B1073, &&B1074, &&B1075, &&B1076, &&B1077, &&B1078, &&B1079, &&B1080, &&B1081, &&B1082, &&B1083, &&B1084, &&B1085, &&B1086, &&B1087, &&B1088, &&B1089, &&B1090, &&B1091, &&B1092, &&B1093, &&B1094, &&B1095, &&B1096, &&B1097, &&B1098, &&B1099, &&B1100, &&B1101, &&B1102, &&B1103, &&B1104, &&B1105, &&B1106, &&B1107, &&B1108, &&B1109, &&B1110, &&B1111, &&B1112, &&B1113, &&B1114, &&B1115, &&B1116, &&B1117, &&B1118, &&B1119, &&B1120, &&B1121, &&B1122, &&B1123, &&B1124, &&B1125, &&B1126, &&B1127, &&B1128, &&B1129, &&B1130, &&B1131, &&B1132, &&B1133, &&B1134, &&B1135, &&B1136, &&B1137, &&B1138, &&B1139, &&B1140, &&B1141, &&B1142, &&B1143, &&B1144, &&B1145, &&B1146, &&B1147, &&B1148, &&B1149, &&B1150, &&B1151, &&B1152, &&B1153, &&B1154, &&B1155, &&B1156, &&B1157, &&B1158, &&B1159, &&B1160, &&B1161, &&B1162, &&B1163, &&B1164, &&B1165, &&B1166, &&B1167, &&B1168, &&B1169, &&B1170, &&B1171, &&B1172, &&B1173, &&B1174, &&B1175, &&B1176, &&B1177, &&B1178, &&B1179, &&B1180, &&B1181, &&B1182, &&B1183, &&B1184, &&B1185, &&B1186, &&B1187, &&B1188, &&B1189, &&B1190, &&B1191, &&B1192, &&B1193, &&B1194, &&B1195, &&B1196, &&B1197, &&B1198, &&B1199, &&B1200, &&B1201, &&B1202, &&B1203, &&B1204, &&B1205, &&B1206, &&B1207, &&B1208, &&B1209, &&B1210, &&B1211, &&B1212, &&B1213, &&B1214, &&B1215, &&B1216, &&B1217, &&B1218, &&B1219, &&B1220, &&B1221, &&B1222, &&B1223, &&B1224, &&B1225, &&B1226, &&B1227, &&B1228, &&B1229, &&B1230, &&B1231, &&B1232, &&B1233, &&B1234, &&B1235, &&B1236, &&B1237, &&B1238, &&B1239, &&B1240, &&B1241, &&B1242, &&B1243, &&B1244, &&B1245, &&B1246, &&B1247, &&B1248, &&B1249, &&B1250, &&B1251, &&B1252, &&B1253, &&B1254, &&B1255, &&B1256, &&B1257, &&B1258, &&B1259, &&B1260, &&B1261, &&B1262, &&B1263, &&B1264, &&B1265, &&B1266, &&B1267, &&B1268, &&B1269, &&B1270, &&B1271, &&B1272, &&B1273, &&B1274, &&B1275, &&B1276, &&B1277, &&B1278, &&B1279, &&B1280, &&B1281, &&B1282, &&B1283, &&B1284, &&B1285, &&B1286, &&B1287, &&B1288, &&B1289, &&B1290, &&B1291, &&B1292, &&B1293, &&B1294, &&B1295, &&B1296, &&B1297, &&B1298, &&B1299, &&B1300, &&B1301, &&B1302, &&B1303, &&B1304, &&B1305, &&B1306, &&B1307, &&B1308, &&B1309, &&B1310, &&B1311, &&B1312, &&B1313, &&B1314, &&B1315, &&B1316, &&B1317, &&B1318, &&B1319, &&B1320, &&B1321, &&B1322, &&B1323, &&B1324, &&B1325, &&B1326, &&B1327, &&B1328, &&B1329, &&B1330, &&B1331, &&B1332, &&B1333, &&B1334, &&B1335, &&B1336, &&B1337, &&B1338, &&B1339, &&B1340, &&B1341, &&B1342, &&B1343, &&B1344, &&B1345, &&B1346, &&B1347, &&B1348, &&B1349, &&B1350, &&B1351, &&B1352, &&B1353, &&B1354, &&B1355, &&B1356, &&B1357, &&B1358, &&B1359, &&B1360, &&B1361, &&B1362, &&B1363, &&B1364, &&B1365, &&B1366, &&B1367, &&B1368, &&B1369, &&B1370, &&B1371, &&B1372, &&B1373, &&B1374, &&B1375, &&B1376, &&B1377, &&B1378, &&B1379, &&B1380, &&B1381, &&B1382, &&B1383, &&B1384, &&B1385, &&B1386, &&B1387, &&B1388, &&B1389, &&B1390, &&B1391, &&B1392, &&B1393, &&B1394, &&B1395, &&B1396, &&B1397, &&B1398, &&B1399, &&B1400, &&B1401, &&B1402, &&B1403, &&B1404, &&B1405, &&B1406, &&B1407, &&B1408, &&B1409, &&B1410, &&B1411, &&B1412, &&B1413, &&B1414, &&B1415, &&B1416, &&B1417, &&B1418, &&B1419, &&B1420, &&B1421, &&B1422, &&B1423, &&B1424, &&B1425, &&B1426, &&B1427, &&B1428, &&B1429, &&B1430, &&B1431, &&B1432, &&B1433, &&B1434, &&B1435, &&B1436, &&B1437, &&B1438, &&B1439, &&B1440, &&B1441, &&B1442, &&B1443, &&B1444, &&B1445, &&B1446, &&B1447, &&B1448, &&B1449, &&B1450, &&B1451, &&B1452, &&B1453, &&B1454, &&B1455, &&B1456, &&B1457, &&B1458, &&B1459, &&B1460, &&B1461, &&B1462, &&B1463, &&B1464, &&B1465, &&B1466, &&B1467, &&B1468, &&B1469, &&B1470, &&B1471, &&B1472, &&B1473, &&B1474, &&B1475, &&B1476, &&B1477, &&B1478, &&B1479, &&B1480, &&B1481, &&B1482, &&B1483, &&B1484, &&B1485, &&B1486, &&B1487, &&B1488, &&B1489, &&B1490, &&B1491, &&B1492, &&B1493, &&B1494, &&B1495, &&B1496, &&B1497, &&B1498, &&B1499 };
- goto *addrs[argc*argc + 1000];
+/* Store, "declare" (but jump over) the current B_* label */
+#define IND_BLOCK(X) \
+do { \
+ addrs[i] = &&B_##X; \
+ i++; \
+ goto JMP_##X; \
+ B_##X: \
+ printf(#X "\n"); \
+ return 0; \
+ JMP_##X: \
+ ; \
+} while (0)
-B0: printf("0\n"); return 0;
-B1: printf("1\n"); return 0;
-B2: printf("2\n"); return 0;
-B3: printf("3\n"); return 0;
-B4: printf("4\n"); return 0;
-B5: printf("5\n"); return 0;
-B6: printf("6\n"); return 0;
-B7: printf("7\n"); return 0;
-B8: printf("8\n"); return 0;
-B9: printf("9\n"); return 0;
-B10: printf("10\n"); return 0;
-B11: printf("11\n"); return 0;
-B12: printf("12\n"); return 0;
-B13: printf("13\n"); return 0;
-B14: printf("14\n"); return 0;
-B15: printf("15\n"); return 0;
-B16: printf("16\n"); return 0;
-B17: printf("17\n"); return 0;
-B18: printf("18\n"); return 0;
-B19: printf("19\n"); return 0;
-B20: printf("20\n"); return 0;
-B21: printf("21\n"); return 0;
-B22: printf("22\n"); return 0;
-B23: printf("23\n"); return 0;
-B24: printf("24\n"); return 0;
-B25: printf("25\n"); return 0;
-B26: printf("26\n"); return 0;
-B27: printf("27\n"); return 0;
-B28: printf("28\n"); return 0;
-B29: printf("29\n"); return 0;
-B30: printf("30\n"); return 0;
-B31: printf("31\n"); return 0;
-B32: printf("32\n"); return 0;
-B33: printf("33\n"); return 0;
-B34: printf("34\n"); return 0;
-B35: printf("35\n"); return 0;
-B36: printf("36\n"); return 0;
-B37: printf("37\n"); return 0;
-B38: printf("38\n"); return 0;
-B39: printf("39\n"); return 0;
-B40: printf("40\n"); return 0;
-B41: printf("41\n"); return 0;
-B42: printf("42\n"); return 0;
-B43: printf("43\n"); return 0;
-B44: printf("44\n"); return 0;
-B45: printf("45\n"); return 0;
-B46: printf("46\n"); return 0;
-B47: printf("47\n"); return 0;
-B48: printf("48\n"); return 0;
-B49: printf("49\n"); return 0;
-B50: printf("50\n"); return 0;
-B51: printf("51\n"); return 0;
-B52: printf("52\n"); return 0;
-B53: printf("53\n"); return 0;
-B54: printf("54\n"); return 0;
-B55: printf("55\n"); return 0;
-B56: printf("56\n"); return 0;
-B57: printf("57\n"); return 0;
-B58: printf("58\n"); return 0;
-B59: printf("59\n"); return 0;
-B60: printf("60\n"); return 0;
-B61: printf("61\n"); return 0;
-B62: printf("62\n"); return 0;
-B63: printf("63\n"); return 0;
-B64: printf("64\n"); return 0;
-B65: printf("65\n"); return 0;
-B66: printf("66\n"); return 0;
-B67: printf("67\n"); return 0;
-B68: printf("68\n"); return 0;
-B69: printf("69\n"); return 0;
-B70: printf("70\n"); return 0;
-B71: printf("71\n"); return 0;
-B72: printf("72\n"); return 0;
-B73: printf("73\n"); return 0;
-B74: printf("74\n"); return 0;
-B75: printf("75\n"); return 0;
-B76: printf("76\n"); return 0;
-B77: printf("77\n"); return 0;
-B78: printf("78\n"); return 0;
-B79: printf("79\n"); return 0;
-B80: printf("80\n"); return 0;
-B81: printf("81\n"); return 0;
-B82: printf("82\n"); return 0;
-B83: printf("83\n"); return 0;
-B84: printf("84\n"); return 0;
-B85: printf("85\n"); return 0;
-B86: printf("86\n"); return 0;
-B87: printf("87\n"); return 0;
-B88: printf("88\n"); return 0;
-B89: printf("89\n"); return 0;
-B90: printf("90\n"); return 0;
-B91: printf("91\n"); return 0;
-B92: printf("92\n"); return 0;
-B93: printf("93\n"); return 0;
-B94: printf("94\n"); return 0;
-B95: printf("95\n"); return 0;
-B96: printf("96\n"); return 0;
-B97: printf("97\n"); return 0;
-B98: printf("98\n"); return 0;
-B99: printf("99\n"); return 0;
-B100: printf("100\n"); return 0;
-B101: printf("101\n"); return 0;
-B102: printf("102\n"); return 0;
-B103: printf("103\n"); return 0;
-B104: printf("104\n"); return 0;
-B105: printf("105\n"); return 0;
-B106: printf("106\n"); return 0;
-B107: printf("107\n"); return 0;
-B108: printf("108\n"); return 0;
-B109: printf("109\n"); return 0;
-B110: printf("110\n"); return 0;
-B111: printf("111\n"); return 0;
-B112: printf("112\n"); return 0;
-B113: printf("113\n"); return 0;
-B114: printf("114\n"); return 0;
-B115: printf("115\n"); return 0;
-B116: printf("116\n"); return 0;
-B117: printf("117\n"); return 0;
-B118: printf("118\n"); return 0;
-B119: printf("119\n"); return 0;
-B120: printf("120\n"); return 0;
-B121: printf("121\n"); return 0;
-B122: printf("122\n"); return 0;
-B123: printf("123\n"); return 0;
-B124: printf("124\n"); return 0;
-B125: printf("125\n"); return 0;
-B126: printf("126\n"); return 0;
-B127: printf("127\n"); return 0;
-B128: printf("128\n"); return 0;
-B129: printf("129\n"); return 0;
-B130: printf("130\n"); return 0;
-B131: printf("131\n"); return 0;
-B132: printf("132\n"); return 0;
-B133: printf("133\n"); return 0;
-B134: printf("134\n"); return 0;
-B135: printf("135\n"); return 0;
-B136: printf("136\n"); return 0;
-B137: printf("137\n"); return 0;
-B138: printf("138\n"); return 0;
-B139: printf("139\n"); return 0;
-B140: printf("140\n"); return 0;
-B141: printf("141\n"); return 0;
-B142: printf("142\n"); return 0;
-B143: printf("143\n"); return 0;
-B144: printf("144\n"); return 0;
-B145: printf("145\n"); return 0;
-B146: printf("146\n"); return 0;
-B147: printf("147\n"); return 0;
-B148: printf("148\n"); return 0;
-B149: printf("149\n"); return 0;
-B150: printf("150\n"); return 0;
-B151: printf("151\n"); return 0;
-B152: printf("152\n"); return 0;
-B153: printf("153\n"); return 0;
-B154: printf("154\n"); return 0;
-B155: printf("155\n"); return 0;
-B156: printf("156\n"); return 0;
-B157: printf("157\n"); return 0;
-B158: printf("158\n"); return 0;
-B159: printf("159\n"); return 0;
-B160: printf("160\n"); return 0;
-B161: printf("161\n"); return 0;
-B162: printf("162\n"); return 0;
-B163: printf("163\n"); return 0;
-B164: printf("164\n"); return 0;
-B165: printf("165\n"); return 0;
-B166: printf("166\n"); return 0;
-B167: printf("167\n"); return 0;
-B168: printf("168\n"); return 0;
-B169: printf("169\n"); return 0;
-B170: printf("170\n"); return 0;
-B171: printf("171\n"); return 0;
-B172: printf("172\n"); return 0;
-B173: printf("173\n"); return 0;
-B174: printf("174\n"); return 0;
-B175: printf("175\n"); return 0;
-B176: printf("176\n"); return 0;
-B177: printf("177\n"); return 0;
-B178: printf("178\n"); return 0;
-B179: printf("179\n"); return 0;
-B180: printf("180\n"); return 0;
-B181: printf("181\n"); return 0;
-B182: printf("182\n"); return 0;
-B183: printf("183\n"); return 0;
-B184: printf("184\n"); return 0;
-B185: printf("185\n"); return 0;
-B186: printf("186\n"); return 0;
-B187: printf("187\n"); return 0;
-B188: printf("188\n"); return 0;
-B189: printf("189\n"); return 0;
-B190: printf("190\n"); return 0;
-B191: printf("191\n"); return 0;
-B192: printf("192\n"); return 0;
-B193: printf("193\n"); return 0;
-B194: printf("194\n"); return 0;
-B195: printf("195\n"); return 0;
-B196: printf("196\n"); return 0;
-B197: printf("197\n"); return 0;
-B198: printf("198\n"); return 0;
-B199: printf("199\n"); return 0;
-B200: printf("200\n"); return 0;
-B201: printf("201\n"); return 0;
-B202: printf("202\n"); return 0;
-B203: printf("203\n"); return 0;
-B204: printf("204\n"); return 0;
-B205: printf("205\n"); return 0;
-B206: printf("206\n"); return 0;
-B207: printf("207\n"); return 0;
-B208: printf("208\n"); return 0;
-B209: printf("209\n"); return 0;
-B210: printf("210\n"); return 0;
-B211: printf("211\n"); return 0;
-B212: printf("212\n"); return 0;
-B213: printf("213\n"); return 0;
-B214: printf("214\n"); return 0;
-B215: printf("215\n"); return 0;
-B216: printf("216\n"); return 0;
-B217: printf("217\n"); return 0;
-B218: printf("218\n"); return 0;
-B219: printf("219\n"); return 0;
-B220: printf("220\n"); return 0;
-B221: printf("221\n"); return 0;
-B222: printf("222\n"); return 0;
-B223: printf("223\n"); return 0;
-B224: printf("224\n"); return 0;
-B225: printf("225\n"); return 0;
-B226: printf("226\n"); return 0;
-B227: printf("227\n"); return 0;
-B228: printf("228\n"); return 0;
-B229: printf("229\n"); return 0;
-B230: printf("230\n"); return 0;
-B231: printf("231\n"); return 0;
-B232: printf("232\n"); return 0;
-B233: printf("233\n"); return 0;
-B234: printf("234\n"); return 0;
-B235: printf("235\n"); return 0;
-B236: printf("236\n"); return 0;
-B237: printf("237\n"); return 0;
-B238: printf("238\n"); return 0;
-B239: printf("239\n"); return 0;
-B240: printf("240\n"); return 0;
-B241: printf("241\n"); return 0;
-B242: printf("242\n"); return 0;
-B243: printf("243\n"); return 0;
-B244: printf("244\n"); return 0;
-B245: printf("245\n"); return 0;
-B246: printf("246\n"); return 0;
-B247: printf("247\n"); return 0;
-B248: printf("248\n"); return 0;
-B249: printf("249\n"); return 0;
-B250: printf("250\n"); return 0;
-B251: printf("251\n"); return 0;
-B252: printf("252\n"); return 0;
-B253: printf("253\n"); return 0;
-B254: printf("254\n"); return 0;
-B255: printf("255\n"); return 0;
-B256: printf("256\n"); return 0;
-B257: printf("257\n"); return 0;
-B258: printf("258\n"); return 0;
-B259: printf("259\n"); return 0;
-B260: printf("260\n"); return 0;
-B261: printf("261\n"); return 0;
-B262: printf("262\n"); return 0;
-B263: printf("263\n"); return 0;
-B264: printf("264\n"); return 0;
-B265: printf("265\n"); return 0;
-B266: printf("266\n"); return 0;
-B267: printf("267\n"); return 0;
-B268: printf("268\n"); return 0;
-B269: printf("269\n"); return 0;
-B270: printf("270\n"); return 0;
-B271: printf("271\n"); return 0;
-B272: printf("272\n"); return 0;
-B273: printf("273\n"); return 0;
-B274: printf("274\n"); return 0;
-B275: printf("275\n"); return 0;
-B276: printf("276\n"); return 0;
-B277: printf("277\n"); return 0;
-B278: printf("278\n"); return 0;
-B279: printf("279\n"); return 0;
-B280: printf("280\n"); return 0;
-B281: printf("281\n"); return 0;
-B282: printf("282\n"); return 0;
-B283: printf("283\n"); return 0;
-B284: printf("284\n"); return 0;
-B285: printf("285\n"); return 0;
-B286: printf("286\n"); return 0;
-B287: printf("287\n"); return 0;
-B288: printf("288\n"); return 0;
-B289: printf("289\n"); return 0;
-B290: printf("290\n"); return 0;
-B291: printf("291\n"); return 0;
-B292: printf("292\n"); return 0;
-B293: printf("293\n"); return 0;
-B294: printf("294\n"); return 0;
-B295: printf("295\n"); return 0;
-B296: printf("296\n"); return 0;
-B297: printf("297\n"); return 0;
-B298: printf("298\n"); return 0;
-B299: printf("299\n"); return 0;
-B300: printf("300\n"); return 0;
-B301: printf("301\n"); return 0;
-B302: printf("302\n"); return 0;
-B303: printf("303\n"); return 0;
-B304: printf("304\n"); return 0;
-B305: printf("305\n"); return 0;
-B306: printf("306\n"); return 0;
-B307: printf("307\n"); return 0;
-B308: printf("308\n"); return 0;
-B309: printf("309\n"); return 0;
-B310: printf("310\n"); return 0;
-B311: printf("311\n"); return 0;
-B312: printf("312\n"); return 0;
-B313: printf("313\n"); return 0;
-B314: printf("314\n"); return 0;
-B315: printf("315\n"); return 0;
-B316: printf("316\n"); return 0;
-B317: printf("317\n"); return 0;
-B318: printf("318\n"); return 0;
-B319: printf("319\n"); return 0;
-B320: printf("320\n"); return 0;
-B321: printf("321\n"); return 0;
-B322: printf("322\n"); return 0;
-B323: printf("323\n"); return 0;
-B324: printf("324\n"); return 0;
-B325: printf("325\n"); return 0;
-B326: printf("326\n"); return 0;
-B327: printf("327\n"); return 0;
-B328: printf("328\n"); return 0;
-B329: printf("329\n"); return 0;
-B330: printf("330\n"); return 0;
-B331: printf("331\n"); return 0;
-B332: printf("332\n"); return 0;
-B333: printf("333\n"); return 0;
-B334: printf("334\n"); return 0;
-B335: printf("335\n"); return 0;
-B336: printf("336\n"); return 0;
-B337: printf("337\n"); return 0;
-B338: printf("338\n"); return 0;
-B339: printf("339\n"); return 0;
-B340: printf("340\n"); return 0;
-B341: printf("341\n"); return 0;
-B342: printf("342\n"); return 0;
-B343: printf("343\n"); return 0;
-B344: printf("344\n"); return 0;
-B345: printf("345\n"); return 0;
-B346: printf("346\n"); return 0;
-B347: printf("347\n"); return 0;
-B348: printf("348\n"); return 0;
-B349: printf("349\n"); return 0;
-B350: printf("350\n"); return 0;
-B351: printf("351\n"); return 0;
-B352: printf("352\n"); return 0;
-B353: printf("353\n"); return 0;
-B354: printf("354\n"); return 0;
-B355: printf("355\n"); return 0;
-B356: printf("356\n"); return 0;
-B357: printf("357\n"); return 0;
-B358: printf("358\n"); return 0;
-B359: printf("359\n"); return 0;
-B360: printf("360\n"); return 0;
-B361: printf("361\n"); return 0;
-B362: printf("362\n"); return 0;
-B363: printf("363\n"); return 0;
-B364: printf("364\n"); return 0;
-B365: printf("365\n"); return 0;
-B366: printf("366\n"); return 0;
-B367: printf("367\n"); return 0;
-B368: printf("368\n"); return 0;
-B369: printf("369\n"); return 0;
-B370: printf("370\n"); return 0;
-B371: printf("371\n"); return 0;
-B372: printf("372\n"); return 0;
-B373: printf("373\n"); return 0;
-B374: printf("374\n"); return 0;
-B375: printf("375\n"); return 0;
-B376: printf("376\n"); return 0;
-B377: printf("377\n"); return 0;
-B378: printf("378\n"); return 0;
-B379: printf("379\n"); return 0;
-B380: printf("380\n"); return 0;
-B381: printf("381\n"); return 0;
-B382: printf("382\n"); return 0;
-B383: printf("383\n"); return 0;
-B384: printf("384\n"); return 0;
-B385: printf("385\n"); return 0;
-B386: printf("386\n"); return 0;
-B387: printf("387\n"); return 0;
-B388: printf("388\n"); return 0;
-B389: printf("389\n"); return 0;
-B390: printf("390\n"); return 0;
-B391: printf("391\n"); return 0;
-B392: printf("392\n"); return 0;
-B393: printf("393\n"); return 0;
-B394: printf("394\n"); return 0;
-B395: printf("395\n"); return 0;
-B396: printf("396\n"); return 0;
-B397: printf("397\n"); return 0;
-B398: printf("398\n"); return 0;
-B399: printf("399\n"); return 0;
-B400: printf("400\n"); return 0;
-B401: printf("401\n"); return 0;
-B402: printf("402\n"); return 0;
-B403: printf("403\n"); return 0;
-B404: printf("404\n"); return 0;
-B405: printf("405\n"); return 0;
-B406: printf("406\n"); return 0;
-B407: printf("407\n"); return 0;
-B408: printf("408\n"); return 0;
-B409: printf("409\n"); return 0;
-B410: printf("410\n"); return 0;
-B411: printf("411\n"); return 0;
-B412: printf("412\n"); return 0;
-B413: printf("413\n"); return 0;
-B414: printf("414\n"); return 0;
-B415: printf("415\n"); return 0;
-B416: printf("416\n"); return 0;
-B417: printf("417\n"); return 0;
-B418: printf("418\n"); return 0;
-B419: printf("419\n"); return 0;
-B420: printf("420\n"); return 0;
-B421: printf("421\n"); return 0;
-B422: printf("422\n"); return 0;
-B423: printf("423\n"); return 0;
-B424: printf("424\n"); return 0;
-B425: printf("425\n"); return 0;
-B426: printf("426\n"); return 0;
-B427: printf("427\n"); return 0;
-B428: printf("428\n"); return 0;
-B429: printf("429\n"); return 0;
-B430: printf("430\n"); return 0;
-B431: printf("431\n"); return 0;
-B432: printf("432\n"); return 0;
-B433: printf("433\n"); return 0;
-B434: printf("434\n"); return 0;
-B435: printf("435\n"); return 0;
-B436: printf("436\n"); return 0;
-B437: printf("437\n"); return 0;
-B438: printf("438\n"); return 0;
-B439: printf("439\n"); return 0;
-B440: printf("440\n"); return 0;
-B441: printf("441\n"); return 0;
-B442: printf("442\n"); return 0;
-B443: printf("443\n"); return 0;
-B444: printf("444\n"); return 0;
-B445: printf("445\n"); return 0;
-B446: printf("446\n"); return 0;
-B447: printf("447\n"); return 0;
-B448: printf("448\n"); return 0;
-B449: printf("449\n"); return 0;
-B450: printf("450\n"); return 0;
-B451: printf("451\n"); return 0;
-B452: printf("452\n"); return 0;
-B453: printf("453\n"); return 0;
-B454: printf("454\n"); return 0;
-B455: printf("455\n"); return 0;
-B456: printf("456\n"); return 0;
-B457: printf("457\n"); return 0;
-B458: printf("458\n"); return 0;
-B459: printf("459\n"); return 0;
-B460: printf("460\n"); return 0;
-B461: printf("461\n"); return 0;
-B462: printf("462\n"); return 0;
-B463: printf("463\n"); return 0;
-B464: printf("464\n"); return 0;
-B465: printf("465\n"); return 0;
-B466: printf("466\n"); return 0;
-B467: printf("467\n"); return 0;
-B468: printf("468\n"); return 0;
-B469: printf("469\n"); return 0;
-B470: printf("470\n"); return 0;
-B471: printf("471\n"); return 0;
-B472: printf("472\n"); return 0;
-B473: printf("473\n"); return 0;
-B474: printf("474\n"); return 0;
-B475: printf("475\n"); return 0;
-B476: printf("476\n"); return 0;
-B477: printf("477\n"); return 0;
-B478: printf("478\n"); return 0;
-B479: printf("479\n"); return 0;
-B480: printf("480\n"); return 0;
-B481: printf("481\n"); return 0;
-B482: printf("482\n"); return 0;
-B483: printf("483\n"); return 0;
-B484: printf("484\n"); return 0;
-B485: printf("485\n"); return 0;
-B486: printf("486\n"); return 0;
-B487: printf("487\n"); return 0;
-B488: printf("488\n"); return 0;
-B489: printf("489\n"); return 0;
-B490: printf("490\n"); return 0;
-B491: printf("491\n"); return 0;
-B492: printf("492\n"); return 0;
-B493: printf("493\n"); return 0;
-B494: printf("494\n"); return 0;
-B495: printf("495\n"); return 0;
-B496: printf("496\n"); return 0;
-B497: printf("497\n"); return 0;
-B498: printf("498\n"); return 0;
-B499: printf("499\n"); return 0;
-B500: printf("500\n"); return 0;
-B501: printf("501\n"); return 0;
-B502: printf("502\n"); return 0;
-B503: printf("503\n"); return 0;
-B504: printf("504\n"); return 0;
-B505: printf("505\n"); return 0;
-B506: printf("506\n"); return 0;
-B507: printf("507\n"); return 0;
-B508: printf("508\n"); return 0;
-B509: printf("509\n"); return 0;
-B510: printf("510\n"); return 0;
-B511: printf("511\n"); return 0;
-B512: printf("512\n"); return 0;
-B513: printf("513\n"); return 0;
-B514: printf("514\n"); return 0;
-B515: printf("515\n"); return 0;
-B516: printf("516\n"); return 0;
-B517: printf("517\n"); return 0;
-B518: printf("518\n"); return 0;
-B519: printf("519\n"); return 0;
-B520: printf("520\n"); return 0;
-B521: printf("521\n"); return 0;
-B522: printf("522\n"); return 0;
-B523: printf("523\n"); return 0;
-B524: printf("524\n"); return 0;
-B525: printf("525\n"); return 0;
-B526: printf("526\n"); return 0;
-B527: printf("527\n"); return 0;
-B528: printf("528\n"); return 0;
-B529: printf("529\n"); return 0;
-B530: printf("530\n"); return 0;
-B531: printf("531\n"); return 0;
-B532: printf("532\n"); return 0;
-B533: printf("533\n"); return 0;
-B534: printf("534\n"); return 0;
-B535: printf("535\n"); return 0;
-B536: printf("536\n"); return 0;
-B537: printf("537\n"); return 0;
-B538: printf("538\n"); return 0;
-B539: printf("539\n"); return 0;
-B540: printf("540\n"); return 0;
-B541: printf("541\n"); return 0;
-B542: printf("542\n"); return 0;
-B543: printf("543\n"); return 0;
-B544: printf("544\n"); return 0;
-B545: printf("545\n"); return 0;
-B546: printf("546\n"); return 0;
-B547: printf("547\n"); return 0;
-B548: printf("548\n"); return 0;
-B549: printf("549\n"); return 0;
-B550: printf("550\n"); return 0;
-B551: printf("551\n"); return 0;
-B552: printf("552\n"); return 0;
-B553: printf("553\n"); return 0;
-B554: printf("554\n"); return 0;
-B555: printf("555\n"); return 0;
-B556: printf("556\n"); return 0;
-B557: printf("557\n"); return 0;
-B558: printf("558\n"); return 0;
-B559: printf("559\n"); return 0;
-B560: printf("560\n"); return 0;
-B561: printf("561\n"); return 0;
-B562: printf("562\n"); return 0;
-B563: printf("563\n"); return 0;
-B564: printf("564\n"); return 0;
-B565: printf("565\n"); return 0;
-B566: printf("566\n"); return 0;
-B567: printf("567\n"); return 0;
-B568: printf("568\n"); return 0;
-B569: printf("569\n"); return 0;
-B570: printf("570\n"); return 0;
-B571: printf("571\n"); return 0;
-B572: printf("572\n"); return 0;
-B573: printf("573\n"); return 0;
-B574: printf("574\n"); return 0;
-B575: printf("575\n"); return 0;
-B576: printf("576\n"); return 0;
-B577: printf("577\n"); return 0;
-B578: printf("578\n"); return 0;
-B579: printf("579\n"); return 0;
-B580: printf("580\n"); return 0;
-B581: printf("581\n"); return 0;
-B582: printf("582\n"); return 0;
-B583: printf("583\n"); return 0;
-B584: printf("584\n"); return 0;
-B585: printf("585\n"); return 0;
-B586: printf("586\n"); return 0;
-B587: printf("587\n"); return 0;
-B588: printf("588\n"); return 0;
-B589: printf("589\n"); return 0;
-B590: printf("590\n"); return 0;
-B591: printf("591\n"); return 0;
-B592: printf("592\n"); return 0;
-B593: printf("593\n"); return 0;
-B594: printf("594\n"); return 0;
-B595: printf("595\n"); return 0;
-B596: printf("596\n"); return 0;
-B597: printf("597\n"); return 0;
-B598: printf("598\n"); return 0;
-B599: printf("599\n"); return 0;
-B600: printf("600\n"); return 0;
-B601: printf("601\n"); return 0;
-B602: printf("602\n"); return 0;
-B603: printf("603\n"); return 0;
-B604: printf("604\n"); return 0;
-B605: printf("605\n"); return 0;
-B606: printf("606\n"); return 0;
-B607: printf("607\n"); return 0;
-B608: printf("608\n"); return 0;
-B609: printf("609\n"); return 0;
-B610: printf("610\n"); return 0;
-B611: printf("611\n"); return 0;
-B612: printf("612\n"); return 0;
-B613: printf("613\n"); return 0;
-B614: printf("614\n"); return 0;
-B615: printf("615\n"); return 0;
-B616: printf("616\n"); return 0;
-B617: printf("617\n"); return 0;
-B618: printf("618\n"); return 0;
-B619: printf("619\n"); return 0;
-B620: printf("620\n"); return 0;
-B621: printf("621\n"); return 0;
-B622: printf("622\n"); return 0;
-B623: printf("623\n"); return 0;
-B624: printf("624\n"); return 0;
-B625: printf("625\n"); return 0;
-B626: printf("626\n"); return 0;
-B627: printf("627\n"); return 0;
-B628: printf("628\n"); return 0;
-B629: printf("629\n"); return 0;
-B630: printf("630\n"); return 0;
-B631: printf("631\n"); return 0;
-B632: printf("632\n"); return 0;
-B633: printf("633\n"); return 0;
-B634: printf("634\n"); return 0;
-B635: printf("635\n"); return 0;
-B636: printf("636\n"); return 0;
-B637: printf("637\n"); return 0;
-B638: printf("638\n"); return 0;
-B639: printf("639\n"); return 0;
-B640: printf("640\n"); return 0;
-B641: printf("641\n"); return 0;
-B642: printf("642\n"); return 0;
-B643: printf("643\n"); return 0;
-B644: printf("644\n"); return 0;
-B645: printf("645\n"); return 0;
-B646: printf("646\n"); return 0;
-B647: printf("647\n"); return 0;
-B648: printf("648\n"); return 0;
-B649: printf("649\n"); return 0;
-B650: printf("650\n"); return 0;
-B651: printf("651\n"); return 0;
-B652: printf("652\n"); return 0;
-B653: printf("653\n"); return 0;
-B654: printf("654\n"); return 0;
-B655: printf("655\n"); return 0;
-B656: printf("656\n"); return 0;
-B657: printf("657\n"); return 0;
-B658: printf("658\n"); return 0;
-B659: printf("659\n"); return 0;
-B660: printf("660\n"); return 0;
-B661: printf("661\n"); return 0;
-B662: printf("662\n"); return 0;
-B663: printf("663\n"); return 0;
-B664: printf("664\n"); return 0;
-B665: printf("665\n"); return 0;
-B666: printf("666\n"); return 0;
-B667: printf("667\n"); return 0;
-B668: printf("668\n"); return 0;
-B669: printf("669\n"); return 0;
-B670: printf("670\n"); return 0;
-B671: printf("671\n"); return 0;
-B672: printf("672\n"); return 0;
-B673: printf("673\n"); return 0;
-B674: printf("674\n"); return 0;
-B675: printf("675\n"); return 0;
-B676: printf("676\n"); return 0;
-B677: printf("677\n"); return 0;
-B678: printf("678\n"); return 0;
-B679: printf("679\n"); return 0;
-B680: printf("680\n"); return 0;
-B681: printf("681\n"); return 0;
-B682: printf("682\n"); return 0;
-B683: printf("683\n"); return 0;
-B684: printf("684\n"); return 0;
-B685: printf("685\n"); return 0;
-B686: printf("686\n"); return 0;
-B687: printf("687\n"); return 0;
-B688: printf("688\n"); return 0;
-B689: printf("689\n"); return 0;
-B690: printf("690\n"); return 0;
-B691: printf("691\n"); return 0;
-B692: printf("692\n"); return 0;
-B693: printf("693\n"); return 0;
-B694: printf("694\n"); return 0;
-B695: printf("695\n"); return 0;
-B696: printf("696\n"); return 0;
-B697: printf("697\n"); return 0;
-B698: printf("698\n"); return 0;
-B699: printf("699\n"); return 0;
-B700: printf("700\n"); return 0;
-B701: printf("701\n"); return 0;
-B702: printf("702\n"); return 0;
-B703: printf("703\n"); return 0;
-B704: printf("704\n"); return 0;
-B705: printf("705\n"); return 0;
-B706: printf("706\n"); return 0;
-B707: printf("707\n"); return 0;
-B708: printf("708\n"); return 0;
-B709: printf("709\n"); return 0;
-B710: printf("710\n"); return 0;
-B711: printf("711\n"); return 0;
-B712: printf("712\n"); return 0;
-B713: printf("713\n"); return 0;
-B714: printf("714\n"); return 0;
-B715: printf("715\n"); return 0;
-B716: printf("716\n"); return 0;
-B717: printf("717\n"); return 0;
-B718: printf("718\n"); return 0;
-B719: printf("719\n"); return 0;
-B720: printf("720\n"); return 0;
-B721: printf("721\n"); return 0;
-B722: printf("722\n"); return 0;
-B723: printf("723\n"); return 0;
-B724: printf("724\n"); return 0;
-B725: printf("725\n"); return 0;
-B726: printf("726\n"); return 0;
-B727: printf("727\n"); return 0;
-B728: printf("728\n"); return 0;
-B729: printf("729\n"); return 0;
-B730: printf("730\n"); return 0;
-B731: printf("731\n"); return 0;
-B732: printf("732\n"); return 0;
-B733: printf("733\n"); return 0;
-B734: printf("734\n"); return 0;
-B735: printf("735\n"); return 0;
-B736: printf("736\n"); return 0;
-B737: printf("737\n"); return 0;
-B738: printf("738\n"); return 0;
-B739: printf("739\n"); return 0;
-B740: printf("740\n"); return 0;
-B741: printf("741\n"); return 0;
-B742: printf("742\n"); return 0;
-B743: printf("743\n"); return 0;
-B744: printf("744\n"); return 0;
-B745: printf("745\n"); return 0;
-B746: printf("746\n"); return 0;
-B747: printf("747\n"); return 0;
-B748: printf("748\n"); return 0;
-B749: printf("749\n"); return 0;
-B750: printf("750\n"); return 0;
-B751: printf("751\n"); return 0;
-B752: printf("752\n"); return 0;
-B753: printf("753\n"); return 0;
-B754: printf("754\n"); return 0;
-B755: printf("755\n"); return 0;
-B756: printf("756\n"); return 0;
-B757: printf("757\n"); return 0;
-B758: printf("758\n"); return 0;
-B759: printf("759\n"); return 0;
-B760: printf("760\n"); return 0;
-B761: printf("761\n"); return 0;
-B762: printf("762\n"); return 0;
-B763: printf("763\n"); return 0;
-B764: printf("764\n"); return 0;
-B765: printf("765\n"); return 0;
-B766: printf("766\n"); return 0;
-B767: printf("767\n"); return 0;
-B768: printf("768\n"); return 0;
-B769: printf("769\n"); return 0;
-B770: printf("770\n"); return 0;
-B771: printf("771\n"); return 0;
-B772: printf("772\n"); return 0;
-B773: printf("773\n"); return 0;
-B774: printf("774\n"); return 0;
-B775: printf("775\n"); return 0;
-B776: printf("776\n"); return 0;
-B777: printf("777\n"); return 0;
-B778: printf("778\n"); return 0;
-B779: printf("779\n"); return 0;
-B780: printf("780\n"); return 0;
-B781: printf("781\n"); return 0;
-B782: printf("782\n"); return 0;
-B783: printf("783\n"); return 0;
-B784: printf("784\n"); return 0;
-B785: printf("785\n"); return 0;
-B786: printf("786\n"); return 0;
-B787: printf("787\n"); return 0;
-B788: printf("788\n"); return 0;
-B789: printf("789\n"); return 0;
-B790: printf("790\n"); return 0;
-B791: printf("791\n"); return 0;
-B792: printf("792\n"); return 0;
-B793: printf("793\n"); return 0;
-B794: printf("794\n"); return 0;
-B795: printf("795\n"); return 0;
-B796: printf("796\n"); return 0;
-B797: printf("797\n"); return 0;
-B798: printf("798\n"); return 0;
-B799: printf("799\n"); return 0;
-B800: printf("800\n"); return 0;
-B801: printf("801\n"); return 0;
-B802: printf("802\n"); return 0;
-B803: printf("803\n"); return 0;
-B804: printf("804\n"); return 0;
-B805: printf("805\n"); return 0;
-B806: printf("806\n"); return 0;
-B807: printf("807\n"); return 0;
-B808: printf("808\n"); return 0;
-B809: printf("809\n"); return 0;
-B810: printf("810\n"); return 0;
-B811: printf("811\n"); return 0;
-B812: printf("812\n"); return 0;
-B813: printf("813\n"); return 0;
-B814: printf("814\n"); return 0;
-B815: printf("815\n"); return 0;
-B816: printf("816\n"); return 0;
-B817: printf("817\n"); return 0;
-B818: printf("818\n"); return 0;
-B819: printf("819\n"); return 0;
-B820: printf("820\n"); return 0;
-B821: printf("821\n"); return 0;
-B822: printf("822\n"); return 0;
-B823: printf("823\n"); return 0;
-B824: printf("824\n"); return 0;
-B825: printf("825\n"); return 0;
-B826: printf("826\n"); return 0;
-B827: printf("827\n"); return 0;
-B828: printf("828\n"); return 0;
-B829: printf("829\n"); return 0;
-B830: printf("830\n"); return 0;
-B831: printf("831\n"); return 0;
-B832: printf("832\n"); return 0;
-B833: printf("833\n"); return 0;
-B834: printf("834\n"); return 0;
-B835: printf("835\n"); return 0;
-B836: printf("836\n"); return 0;
-B837: printf("837\n"); return 0;
-B838: printf("838\n"); return 0;
-B839: printf("839\n"); return 0;
-B840: printf("840\n"); return 0;
-B841: printf("841\n"); return 0;
-B842: printf("842\n"); return 0;
-B843: printf("843\n"); return 0;
-B844: printf("844\n"); return 0;
-B845: printf("845\n"); return 0;
-B846: printf("846\n"); return 0;
-B847: printf("847\n"); return 0;
-B848: printf("848\n"); return 0;
-B849: printf("849\n"); return 0;
-B850: printf("850\n"); return 0;
-B851: printf("851\n"); return 0;
-B852: printf("852\n"); return 0;
-B853: printf("853\n"); return 0;
-B854: printf("854\n"); return 0;
-B855: printf("855\n"); return 0;
-B856: printf("856\n"); return 0;
-B857: printf("857\n"); return 0;
-B858: printf("858\n"); return 0;
-B859: printf("859\n"); return 0;
-B860: printf("860\n"); return 0;
-B861: printf("861\n"); return 0;
-B862: printf("862\n"); return 0;
-B863: printf("863\n"); return 0;
-B864: printf("864\n"); return 0;
-B865: printf("865\n"); return 0;
-B866: printf("866\n"); return 0;
-B867: printf("867\n"); return 0;
-B868: printf("868\n"); return 0;
-B869: printf("869\n"); return 0;
-B870: printf("870\n"); return 0;
-B871: printf("871\n"); return 0;
-B872: printf("872\n"); return 0;
-B873: printf("873\n"); return 0;
-B874: printf("874\n"); return 0;
-B875: printf("875\n"); return 0;
-B876: printf("876\n"); return 0;
-B877: printf("877\n"); return 0;
-B878: printf("878\n"); return 0;
-B879: printf("879\n"); return 0;
-B880: printf("880\n"); return 0;
-B881: printf("881\n"); return 0;
-B882: printf("882\n"); return 0;
-B883: printf("883\n"); return 0;
-B884: printf("884\n"); return 0;
-B885: printf("885\n"); return 0;
-B886: printf("886\n"); return 0;
-B887: printf("887\n"); return 0;
-B888: printf("888\n"); return 0;
-B889: printf("889\n"); return 0;
-B890: printf("890\n"); return 0;
-B891: printf("891\n"); return 0;
-B892: printf("892\n"); return 0;
-B893: printf("893\n"); return 0;
-B894: printf("894\n"); return 0;
-B895: printf("895\n"); return 0;
-B896: printf("896\n"); return 0;
-B897: printf("897\n"); return 0;
-B898: printf("898\n"); return 0;
-B899: printf("899\n"); return 0;
-B900: printf("900\n"); return 0;
-B901: printf("901\n"); return 0;
-B902: printf("902\n"); return 0;
-B903: printf("903\n"); return 0;
-B904: printf("904\n"); return 0;
-B905: printf("905\n"); return 0;
-B906: printf("906\n"); return 0;
-B907: printf("907\n"); return 0;
-B908: printf("908\n"); return 0;
-B909: printf("909\n"); return 0;
-B910: printf("910\n"); return 0;
-B911: printf("911\n"); return 0;
-B912: printf("912\n"); return 0;
-B913: printf("913\n"); return 0;
-B914: printf("914\n"); return 0;
-B915: printf("915\n"); return 0;
-B916: printf("916\n"); return 0;
-B917: printf("917\n"); return 0;
-B918: printf("918\n"); return 0;
-B919: printf("919\n"); return 0;
-B920: printf("920\n"); return 0;
-B921: printf("921\n"); return 0;
-B922: printf("922\n"); return 0;
-B923: printf("923\n"); return 0;
-B924: printf("924\n"); return 0;
-B925: printf("925\n"); return 0;
-B926: printf("926\n"); return 0;
-B927: printf("927\n"); return 0;
-B928: printf("928\n"); return 0;
-B929: printf("929\n"); return 0;
-B930: printf("930\n"); return 0;
-B931: printf("931\n"); return 0;
-B932: printf("932\n"); return 0;
-B933: printf("933\n"); return 0;
-B934: printf("934\n"); return 0;
-B935: printf("935\n"); return 0;
-B936: printf("936\n"); return 0;
-B937: printf("937\n"); return 0;
-B938: printf("938\n"); return 0;
-B939: printf("939\n"); return 0;
-B940: printf("940\n"); return 0;
-B941: printf("941\n"); return 0;
-B942: printf("942\n"); return 0;
-B943: printf("943\n"); return 0;
-B944: printf("944\n"); return 0;
-B945: printf("945\n"); return 0;
-B946: printf("946\n"); return 0;
-B947: printf("947\n"); return 0;
-B948: printf("948\n"); return 0;
-B949: printf("949\n"); return 0;
-B950: printf("950\n"); return 0;
-B951: printf("951\n"); return 0;
-B952: printf("952\n"); return 0;
-B953: printf("953\n"); return 0;
-B954: printf("954\n"); return 0;
-B955: printf("955\n"); return 0;
-B956: printf("956\n"); return 0;
-B957: printf("957\n"); return 0;
-B958: printf("958\n"); return 0;
-B959: printf("959\n"); return 0;
-B960: printf("960\n"); return 0;
-B961: printf("961\n"); return 0;
-B962: printf("962\n"); return 0;
-B963: printf("963\n"); return 0;
-B964: printf("964\n"); return 0;
-B965: printf("965\n"); return 0;
-B966: printf("966\n"); return 0;
-B967: printf("967\n"); return 0;
-B968: printf("968\n"); return 0;
-B969: printf("969\n"); return 0;
-B970: printf("970\n"); return 0;
-B971: printf("971\n"); return 0;
-B972: printf("972\n"); return 0;
-B973: printf("973\n"); return 0;
-B974: printf("974\n"); return 0;
-B975: printf("975\n"); return 0;
-B976: printf("976\n"); return 0;
-B977: printf("977\n"); return 0;
-B978: printf("978\n"); return 0;
-B979: printf("979\n"); return 0;
-B980: printf("980\n"); return 0;
-B981: printf("981\n"); return 0;
-B982: printf("982\n"); return 0;
-B983: printf("983\n"); return 0;
-B984: printf("984\n"); return 0;
-B985: printf("985\n"); return 0;
-B986: printf("986\n"); return 0;
-B987: printf("987\n"); return 0;
-B988: printf("988\n"); return 0;
-B989: printf("989\n"); return 0;
-B990: printf("990\n"); return 0;
-B991: printf("991\n"); return 0;
-B992: printf("992\n"); return 0;
-B993: printf("993\n"); return 0;
-B994: printf("994\n"); return 0;
-B995: printf("995\n"); return 0;
-B996: printf("996\n"); return 0;
-B997: printf("997\n"); return 0;
-B998: printf("998\n"); return 0;
-B999: printf("999\n"); return 0;
-B1000: printf("1000\n"); return 0;
-B1001: printf("1001\n"); return 0;
-B1002: printf("1002\n"); return 0;
-B1003: printf("1003\n"); return 0;
-B1004: printf("1004\n"); return 0;
-B1005: printf("1005\n"); return 0;
-B1006: printf("1006\n"); return 0;
-B1007: printf("1007\n"); return 0;
-B1008: printf("1008\n"); return 0;
-B1009: printf("1009\n"); return 0;
-B1010: printf("1010\n"); return 0;
-B1011: printf("1011\n"); return 0;
-B1012: printf("1012\n"); return 0;
-B1013: printf("1013\n"); return 0;
-B1014: printf("1014\n"); return 0;
-B1015: printf("1015\n"); return 0;
-B1016: printf("1016\n"); return 0;
-B1017: printf("1017\n"); return 0;
-B1018: printf("1018\n"); return 0;
-B1019: printf("1019\n"); return 0;
-B1020: printf("1020\n"); return 0;
-B1021: printf("1021\n"); return 0;
-B1022: printf("1022\n"); return 0;
-B1023: printf("1023\n"); return 0;
-B1024: printf("1024\n"); return 0;
-B1025: printf("1025\n"); return 0;
-B1026: printf("1026\n"); return 0;
-B1027: printf("1027\n"); return 0;
-B1028: printf("1028\n"); return 0;
-B1029: printf("1029\n"); return 0;
-B1030: printf("1030\n"); return 0;
-B1031: printf("1031\n"); return 0;
-B1032: printf("1032\n"); return 0;
-B1033: printf("1033\n"); return 0;
-B1034: printf("1034\n"); return 0;
-B1035: printf("1035\n"); return 0;
-B1036: printf("1036\n"); return 0;
-B1037: printf("1037\n"); return 0;
-B1038: printf("1038\n"); return 0;
-B1039: printf("1039\n"); return 0;
-B1040: printf("1040\n"); return 0;
-B1041: printf("1041\n"); return 0;
-B1042: printf("1042\n"); return 0;
-B1043: printf("1043\n"); return 0;
-B1044: printf("1044\n"); return 0;
-B1045: printf("1045\n"); return 0;
-B1046: printf("1046\n"); return 0;
-B1047: printf("1047\n"); return 0;
-B1048: printf("1048\n"); return 0;
-B1049: printf("1049\n"); return 0;
-B1050: printf("1050\n"); return 0;
-B1051: printf("1051\n"); return 0;
-B1052: printf("1052\n"); return 0;
-B1053: printf("1053\n"); return 0;
-B1054: printf("1054\n"); return 0;
-B1055: printf("1055\n"); return 0;
-B1056: printf("1056\n"); return 0;
-B1057: printf("1057\n"); return 0;
-B1058: printf("1058\n"); return 0;
-B1059: printf("1059\n"); return 0;
-B1060: printf("1060\n"); return 0;
-B1061: printf("1061\n"); return 0;
-B1062: printf("1062\n"); return 0;
-B1063: printf("1063\n"); return 0;
-B1064: printf("1064\n"); return 0;
-B1065: printf("1065\n"); return 0;
-B1066: printf("1066\n"); return 0;
-B1067: printf("1067\n"); return 0;
-B1068: printf("1068\n"); return 0;
-B1069: printf("1069\n"); return 0;
-B1070: printf("1070\n"); return 0;
-B1071: printf("1071\n"); return 0;
-B1072: printf("1072\n"); return 0;
-B1073: printf("1073\n"); return 0;
-B1074: printf("1074\n"); return 0;
-B1075: printf("1075\n"); return 0;
-B1076: printf("1076\n"); return 0;
-B1077: printf("1077\n"); return 0;
-B1078: printf("1078\n"); return 0;
-B1079: printf("1079\n"); return 0;
-B1080: printf("1080\n"); return 0;
-B1081: printf("1081\n"); return 0;
-B1082: printf("1082\n"); return 0;
-B1083: printf("1083\n"); return 0;
-B1084: printf("1084\n"); return 0;
-B1085: printf("1085\n"); return 0;
-B1086: printf("1086\n"); return 0;
-B1087: printf("1087\n"); return 0;
-B1088: printf("1088\n"); return 0;
-B1089: printf("1089\n"); return 0;
-B1090: printf("1090\n"); return 0;
-B1091: printf("1091\n"); return 0;
-B1092: printf("1092\n"); return 0;
-B1093: printf("1093\n"); return 0;
-B1094: printf("1094\n"); return 0;
-B1095: printf("1095\n"); return 0;
-B1096: printf("1096\n"); return 0;
-B1097: printf("1097\n"); return 0;
-B1098: printf("1098\n"); return 0;
-B1099: printf("1099\n"); return 0;
-B1100: printf("1100\n"); return 0;
-B1101: printf("1101\n"); return 0;
-B1102: printf("1102\n"); return 0;
-B1103: printf("1103\n"); return 0;
-B1104: printf("1104\n"); return 0;
-B1105: printf("1105\n"); return 0;
-B1106: printf("1106\n"); return 0;
-B1107: printf("1107\n"); return 0;
-B1108: printf("1108\n"); return 0;
-B1109: printf("1109\n"); return 0;
-B1110: printf("1110\n"); return 0;
-B1111: printf("1111\n"); return 0;
-B1112: printf("1112\n"); return 0;
-B1113: printf("1113\n"); return 0;
-B1114: printf("1114\n"); return 0;
-B1115: printf("1115\n"); return 0;
-B1116: printf("1116\n"); return 0;
-B1117: printf("1117\n"); return 0;
-B1118: printf("1118\n"); return 0;
-B1119: printf("1119\n"); return 0;
-B1120: printf("1120\n"); return 0;
-B1121: printf("1121\n"); return 0;
-B1122: printf("1122\n"); return 0;
-B1123: printf("1123\n"); return 0;
-B1124: printf("1124\n"); return 0;
-B1125: printf("1125\n"); return 0;
-B1126: printf("1126\n"); return 0;
-B1127: printf("1127\n"); return 0;
-B1128: printf("1128\n"); return 0;
-B1129: printf("1129\n"); return 0;
-B1130: printf("1130\n"); return 0;
-B1131: printf("1131\n"); return 0;
-B1132: printf("1132\n"); return 0;
-B1133: printf("1133\n"); return 0;
-B1134: printf("1134\n"); return 0;
-B1135: printf("1135\n"); return 0;
-B1136: printf("1136\n"); return 0;
-B1137: printf("1137\n"); return 0;
-B1138: printf("1138\n"); return 0;
-B1139: printf("1139\n"); return 0;
-B1140: printf("1140\n"); return 0;
-B1141: printf("1141\n"); return 0;
-B1142: printf("1142\n"); return 0;
-B1143: printf("1143\n"); return 0;
-B1144: printf("1144\n"); return 0;
-B1145: printf("1145\n"); return 0;
-B1146: printf("1146\n"); return 0;
-B1147: printf("1147\n"); return 0;
-B1148: printf("1148\n"); return 0;
-B1149: printf("1149\n"); return 0;
-B1150: printf("1150\n"); return 0;
-B1151: printf("1151\n"); return 0;
-B1152: printf("1152\n"); return 0;
-B1153: printf("1153\n"); return 0;
-B1154: printf("1154\n"); return 0;
-B1155: printf("1155\n"); return 0;
-B1156: printf("1156\n"); return 0;
-B1157: printf("1157\n"); return 0;
-B1158: printf("1158\n"); return 0;
-B1159: printf("1159\n"); return 0;
-B1160: printf("1160\n"); return 0;
-B1161: printf("1161\n"); return 0;
-B1162: printf("1162\n"); return 0;
-B1163: printf("1163\n"); return 0;
-B1164: printf("1164\n"); return 0;
-B1165: printf("1165\n"); return 0;
-B1166: printf("1166\n"); return 0;
-B1167: printf("1167\n"); return 0;
-B1168: printf("1168\n"); return 0;
-B1169: printf("1169\n"); return 0;
-B1170: printf("1170\n"); return 0;
-B1171: printf("1171\n"); return 0;
-B1172: printf("1172\n"); return 0;
-B1173: printf("1173\n"); return 0;
-B1174: printf("1174\n"); return 0;
-B1175: printf("1175\n"); return 0;
-B1176: printf("1176\n"); return 0;
-B1177: printf("1177\n"); return 0;
-B1178: printf("1178\n"); return 0;
-B1179: printf("1179\n"); return 0;
-B1180: printf("1180\n"); return 0;
-B1181: printf("1181\n"); return 0;
-B1182: printf("1182\n"); return 0;
-B1183: printf("1183\n"); return 0;
-B1184: printf("1184\n"); return 0;
-B1185: printf("1185\n"); return 0;
-B1186: printf("1186\n"); return 0;
-B1187: printf("1187\n"); return 0;
-B1188: printf("1188\n"); return 0;
-B1189: printf("1189\n"); return 0;
-B1190: printf("1190\n"); return 0;
-B1191: printf("1191\n"); return 0;
-B1192: printf("1192\n"); return 0;
-B1193: printf("1193\n"); return 0;
-B1194: printf("1194\n"); return 0;
-B1195: printf("1195\n"); return 0;
-B1196: printf("1196\n"); return 0;
-B1197: printf("1197\n"); return 0;
-B1198: printf("1198\n"); return 0;
-B1199: printf("1199\n"); return 0;
-B1200: printf("1200\n"); return 0;
-B1201: printf("1201\n"); return 0;
-B1202: printf("1202\n"); return 0;
-B1203: printf("1203\n"); return 0;
-B1204: printf("1204\n"); return 0;
-B1205: printf("1205\n"); return 0;
-B1206: printf("1206\n"); return 0;
-B1207: printf("1207\n"); return 0;
-B1208: printf("1208\n"); return 0;
-B1209: printf("1209\n"); return 0;
-B1210: printf("1210\n"); return 0;
-B1211: printf("1211\n"); return 0;
-B1212: printf("1212\n"); return 0;
-B1213: printf("1213\n"); return 0;
-B1214: printf("1214\n"); return 0;
-B1215: printf("1215\n"); return 0;
-B1216: printf("1216\n"); return 0;
-B1217: printf("1217\n"); return 0;
-B1218: printf("1218\n"); return 0;
-B1219: printf("1219\n"); return 0;
-B1220: printf("1220\n"); return 0;
-B1221: printf("1221\n"); return 0;
-B1222: printf("1222\n"); return 0;
-B1223: printf("1223\n"); return 0;
-B1224: printf("1224\n"); return 0;
-B1225: printf("1225\n"); return 0;
-B1226: printf("1226\n"); return 0;
-B1227: printf("1227\n"); return 0;
-B1228: printf("1228\n"); return 0;
-B1229: printf("1229\n"); return 0;
-B1230: printf("1230\n"); return 0;
-B1231: printf("1231\n"); return 0;
-B1232: printf("1232\n"); return 0;
-B1233: printf("1233\n"); return 0;
-B1234: printf("1234\n"); return 0;
-B1235: printf("1235\n"); return 0;
-B1236: printf("1236\n"); return 0;
-B1237: printf("1237\n"); return 0;
-B1238: printf("1238\n"); return 0;
-B1239: printf("1239\n"); return 0;
-B1240: printf("1240\n"); return 0;
-B1241: printf("1241\n"); return 0;
-B1242: printf("1242\n"); return 0;
-B1243: printf("1243\n"); return 0;
-B1244: printf("1244\n"); return 0;
-B1245: printf("1245\n"); return 0;
-B1246: printf("1246\n"); return 0;
-B1247: printf("1247\n"); return 0;
-B1248: printf("1248\n"); return 0;
-B1249: printf("1249\n"); return 0;
-B1250: printf("1250\n"); return 0;
-B1251: printf("1251\n"); return 0;
-B1252: printf("1252\n"); return 0;
-B1253: printf("1253\n"); return 0;
-B1254: printf("1254\n"); return 0;
-B1255: printf("1255\n"); return 0;
-B1256: printf("1256\n"); return 0;
-B1257: printf("1257\n"); return 0;
-B1258: printf("1258\n"); return 0;
-B1259: printf("1259\n"); return 0;
-B1260: printf("1260\n"); return 0;
-B1261: printf("1261\n"); return 0;
-B1262: printf("1262\n"); return 0;
-B1263: printf("1263\n"); return 0;
-B1264: printf("1264\n"); return 0;
-B1265: printf("1265\n"); return 0;
-B1266: printf("1266\n"); return 0;
-B1267: printf("1267\n"); return 0;
-B1268: printf("1268\n"); return 0;
-B1269: printf("1269\n"); return 0;
-B1270: printf("1270\n"); return 0;
-B1271: printf("1271\n"); return 0;
-B1272: printf("1272\n"); return 0;
-B1273: printf("1273\n"); return 0;
-B1274: printf("1274\n"); return 0;
-B1275: printf("1275\n"); return 0;
-B1276: printf("1276\n"); return 0;
-B1277: printf("1277\n"); return 0;
-B1278: printf("1278\n"); return 0;
-B1279: printf("1279\n"); return 0;
-B1280: printf("1280\n"); return 0;
-B1281: printf("1281\n"); return 0;
-B1282: printf("1282\n"); return 0;
-B1283: printf("1283\n"); return 0;
-B1284: printf("1284\n"); return 0;
-B1285: printf("1285\n"); return 0;
-B1286: printf("1286\n"); return 0;
-B1287: printf("1287\n"); return 0;
-B1288: printf("1288\n"); return 0;
-B1289: printf("1289\n"); return 0;
-B1290: printf("1290\n"); return 0;
-B1291: printf("1291\n"); return 0;
-B1292: printf("1292\n"); return 0;
-B1293: printf("1293\n"); return 0;
-B1294: printf("1294\n"); return 0;
-B1295: printf("1295\n"); return 0;
-B1296: printf("1296\n"); return 0;
-B1297: printf("1297\n"); return 0;
-B1298: printf("1298\n"); return 0;
-B1299: printf("1299\n"); return 0;
-B1300: printf("1300\n"); return 0;
-B1301: printf("1301\n"); return 0;
-B1302: printf("1302\n"); return 0;
-B1303: printf("1303\n"); return 0;
-B1304: printf("1304\n"); return 0;
-B1305: printf("1305\n"); return 0;
-B1306: printf("1306\n"); return 0;
-B1307: printf("1307\n"); return 0;
-B1308: printf("1308\n"); return 0;
-B1309: printf("1309\n"); return 0;
-B1310: printf("1310\n"); return 0;
-B1311: printf("1311\n"); return 0;
-B1312: printf("1312\n"); return 0;
-B1313: printf("1313\n"); return 0;
-B1314: printf("1314\n"); return 0;
-B1315: printf("1315\n"); return 0;
-B1316: printf("1316\n"); return 0;
-B1317: printf("1317\n"); return 0;
-B1318: printf("1318\n"); return 0;
-B1319: printf("1319\n"); return 0;
-B1320: printf("1320\n"); return 0;
-B1321: printf("1321\n"); return 0;
-B1322: printf("1322\n"); return 0;
-B1323: printf("1323\n"); return 0;
-B1324: printf("1324\n"); return 0;
-B1325: printf("1325\n"); return 0;
-B1326: printf("1326\n"); return 0;
-B1327: printf("1327\n"); return 0;
-B1328: printf("1328\n"); return 0;
-B1329: printf("1329\n"); return 0;
-B1330: printf("1330\n"); return 0;
-B1331: printf("1331\n"); return 0;
-B1332: printf("1332\n"); return 0;
-B1333: printf("1333\n"); return 0;
-B1334: printf("1334\n"); return 0;
-B1335: printf("1335\n"); return 0;
-B1336: printf("1336\n"); return 0;
-B1337: printf("1337\n"); return 0;
-B1338: printf("1338\n"); return 0;
-B1339: printf("1339\n"); return 0;
-B1340: printf("1340\n"); return 0;
-B1341: printf("1341\n"); return 0;
-B1342: printf("1342\n"); return 0;
-B1343: printf("1343\n"); return 0;
-B1344: printf("1344\n"); return 0;
-B1345: printf("1345\n"); return 0;
-B1346: printf("1346\n"); return 0;
-B1347: printf("1347\n"); return 0;
-B1348: printf("1348\n"); return 0;
-B1349: printf("1349\n"); return 0;
-B1350: printf("1350\n"); return 0;
-B1351: printf("1351\n"); return 0;
-B1352: printf("1352\n"); return 0;
-B1353: printf("1353\n"); return 0;
-B1354: printf("1354\n"); return 0;
-B1355: printf("1355\n"); return 0;
-B1356: printf("1356\n"); return 0;
-B1357: printf("1357\n"); return 0;
-B1358: printf("1358\n"); return 0;
-B1359: printf("1359\n"); return 0;
-B1360: printf("1360\n"); return 0;
-B1361: printf("1361\n"); return 0;
-B1362: printf("1362\n"); return 0;
-B1363: printf("1363\n"); return 0;
-B1364: printf("1364\n"); return 0;
-B1365: printf("1365\n"); return 0;
-B1366: printf("1366\n"); return 0;
-B1367: printf("1367\n"); return 0;
-B1368: printf("1368\n"); return 0;
-B1369: printf("1369\n"); return 0;
-B1370: printf("1370\n"); return 0;
-B1371: printf("1371\n"); return 0;
-B1372: printf("1372\n"); return 0;
-B1373: printf("1373\n"); return 0;
-B1374: printf("1374\n"); return 0;
-B1375: printf("1375\n"); return 0;
-B1376: printf("1376\n"); return 0;
-B1377: printf("1377\n"); return 0;
-B1378: printf("1378\n"); return 0;
-B1379: printf("1379\n"); return 0;
-B1380: printf("1380\n"); return 0;
-B1381: printf("1381\n"); return 0;
-B1382: printf("1382\n"); return 0;
-B1383: printf("1383\n"); return 0;
-B1384: printf("1384\n"); return 0;
-B1385: printf("1385\n"); return 0;
-B1386: printf("1386\n"); return 0;
-B1387: printf("1387\n"); return 0;
-B1388: printf("1388\n"); return 0;
-B1389: printf("1389\n"); return 0;
-B1390: printf("1390\n"); return 0;
-B1391: printf("1391\n"); return 0;
-B1392: printf("1392\n"); return 0;
-B1393: printf("1393\n"); return 0;
-B1394: printf("1394\n"); return 0;
-B1395: printf("1395\n"); return 0;
-B1396: printf("1396\n"); return 0;
-B1397: printf("1397\n"); return 0;
-B1398: printf("1398\n"); return 0;
-B1399: printf("1399\n"); return 0;
-B1400: printf("1400\n"); return 0;
-B1401: printf("1401\n"); return 0;
-B1402: printf("1402\n"); return 0;
-B1403: printf("1403\n"); return 0;
-B1404: printf("1404\n"); return 0;
-B1405: printf("1405\n"); return 0;
-B1406: printf("1406\n"); return 0;
-B1407: printf("1407\n"); return 0;
-B1408: printf("1408\n"); return 0;
-B1409: printf("1409\n"); return 0;
-B1410: printf("1410\n"); return 0;
-B1411: printf("1411\n"); return 0;
-B1412: printf("1412\n"); return 0;
-B1413: printf("1413\n"); return 0;
-B1414: printf("1414\n"); return 0;
-B1415: printf("1415\n"); return 0;
-B1416: printf("1416\n"); return 0;
-B1417: printf("1417\n"); return 0;
-B1418: printf("1418\n"); return 0;
-B1419: printf("1419\n"); return 0;
-B1420: printf("1420\n"); return 0;
-B1421: printf("1421\n"); return 0;
-B1422: printf("1422\n"); return 0;
-B1423: printf("1423\n"); return 0;
-B1424: printf("1424\n"); return 0;
-B1425: printf("1425\n"); return 0;
-B1426: printf("1426\n"); return 0;
-B1427: printf("1427\n"); return 0;
-B1428: printf("1428\n"); return 0;
-B1429: printf("1429\n"); return 0;
-B1430: printf("1430\n"); return 0;
-B1431: printf("1431\n"); return 0;
-B1432: printf("1432\n"); return 0;
-B1433: printf("1433\n"); return 0;
-B1434: printf("1434\n"); return 0;
-B1435: printf("1435\n"); return 0;
-B1436: printf("1436\n"); return 0;
-B1437: printf("1437\n"); return 0;
-B1438: printf("1438\n"); return 0;
-B1439: printf("1439\n"); return 0;
-B1440: printf("1440\n"); return 0;
-B1441: printf("1441\n"); return 0;
-B1442: printf("1442\n"); return 0;
-B1443: printf("1443\n"); return 0;
-B1444: printf("1444\n"); return 0;
-B1445: printf("1445\n"); return 0;
-B1446: printf("1446\n"); return 0;
-B1447: printf("1447\n"); return 0;
-B1448: printf("1448\n"); return 0;
-B1449: printf("1449\n"); return 0;
-B1450: printf("1450\n"); return 0;
-B1451: printf("1451\n"); return 0;
-B1452: printf("1452\n"); return 0;
-B1453: printf("1453\n"); return 0;
-B1454: printf("1454\n"); return 0;
-B1455: printf("1455\n"); return 0;
-B1456: printf("1456\n"); return 0;
-B1457: printf("1457\n"); return 0;
-B1458: printf("1458\n"); return 0;
-B1459: printf("1459\n"); return 0;
-B1460: printf("1460\n"); return 0;
-B1461: printf("1461\n"); return 0;
-B1462: printf("1462\n"); return 0;
-B1463: printf("1463\n"); return 0;
-B1464: printf("1464\n"); return 0;
-B1465: printf("1465\n"); return 0;
-B1466: printf("1466\n"); return 0;
-B1467: printf("1467\n"); return 0;
-B1468: printf("1468\n"); return 0;
-B1469: printf("1469\n"); return 0;
-B1470: printf("1470\n"); return 0;
-B1471: printf("1471\n"); return 0;
-B1472: printf("1472\n"); return 0;
-B1473: printf("1473\n"); return 0;
-B1474: printf("1474\n"); return 0;
-B1475: printf("1475\n"); return 0;
-B1476: printf("1476\n"); return 0;
-B1477: printf("1477\n"); return 0;
-B1478: printf("1478\n"); return 0;
-B1479: printf("1479\n"); return 0;
-B1480: printf("1480\n"); return 0;
-B1481: printf("1481\n"); return 0;
-B1482: printf("1482\n"); return 0;
-B1483: printf("1483\n"); return 0;
-B1484: printf("1484\n"); return 0;
-B1485: printf("1485\n"); return 0;
-B1486: printf("1486\n"); return 0;
-B1487: printf("1487\n"); return 0;
-B1488: printf("1488\n"); return 0;
-B1489: printf("1489\n"); return 0;
-B1490: printf("1490\n"); return 0;
-B1491: printf("1491\n"); return 0;
-B1492: printf("1492\n"); return 0;
-B1493: printf("1493\n"); return 0;
-B1494: printf("1494\n"); return 0;
-B1495: printf("1495\n"); return 0;
-B1496: printf("1496\n"); return 0;
-B1497: printf("1497\n"); return 0;
-B1498: printf("1498\n"); return 0;
-B1499: printf("1499\n"); return 0;
- return 0;
- }
- \ No newline at end of file
+/* Add an indirection block to enable token pasting */
+#define SINGLE(X) IND_BLOCK(X);
+
+#define P2 SINGLE(__COUNTER__) SINGLE(__COUNTER__)
+#define P4 P2 P2
+#define P8 P4 P4
+#define P16 P8 P8
+#define P32 P16 P16
+#define P64 P32 P32
+#define P128 P64 P64
+#define P256 P128 P128
+#define P512 P256 P256
+#define P1024 P512 P512
+
+int main(int argc, char *argv[])
+{
+ const void *addrs[1024 + 512];
+ int i = 0;
+
+ /*
+ * Repeat as many times as you want, but remember to update
+ * the labels address array's size accordingly.
+ */
+ P1024;
+ P512;
+
+ /* jump back at the correct label */
+ goto *addrs[(argc * argc) + 1000];
+}
diff --git a/tests/core/test_indirectbr_many.out b/tests/core/test_indirectbr_many.out
index d53baec4..dd117240 100644
--- a/tests/core/test_indirectbr_many.out
+++ b/tests/core/test_indirectbr_many.out
@@ -1,2 +1 @@
-
1001
diff --git a/tests/core/test_inherit.in b/tests/core/test_inherit.in
index e9a152e8..ae5b819d 100644
--- a/tests/core/test_inherit.in
+++ b/tests/core/test_inherit.in
@@ -1,25 +1,22 @@
-
- #include <stdio.h>
- struct Parent {
- int x1, x2;
- };
- struct Child : Parent {
- int y;
- };
- int main()
- {
- Parent a;
- a.x1 = 50;
- a.x2 = 87;
- Child b;
- b.x1 = 78;
- b.x2 = 550;
- b.y = 101;
- Child* c = (Child*)&a;
- c->x1 ++;
- c = &b;
- c->y --;
- printf("*%d,%d,%d,%d,%d,%d,%d*\n", a.x1, a.x2, b.x1, b.x2, b.y, c->x1, c->x2);
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+struct Parent {
+ int x1, x2;
+};
+struct Child : Parent {
+ int y;
+};
+int main() {
+ Parent a;
+ a.x1 = 50;
+ a.x2 = 87;
+ Child b;
+ b.x1 = 78;
+ b.x2 = 550;
+ b.y = 101;
+ Child* c = (Child*)&a;
+ c->x1++;
+ c = &b;
+ c->y--;
+ printf("*%d,%d,%d,%d,%d,%d,%d*\n", a.x1, a.x2, b.x1, b.x2, b.y, c->x1, c->x2);
+ return 0;
+}
diff --git a/tests/core/test_inlinejs.in b/tests/core/test_inlinejs.in
index 0359b707..b6a98954 100644
--- a/tests/core/test_inlinejs.in
+++ b/tests/core/test_inlinejs.in
@@ -1,26 +1,27 @@
+#include <stdio.h>
- #include <stdio.h>
+double get() {
+ double ret = 0;
+ __asm __volatile__("Math.abs(-12/3.3)" : "=r"(ret)); // write to a variable
+ asm("#comment1");
+ asm volatile("#comment2");
+ asm volatile(
+ "#comment3\n"
+ "#comment4\n");
+ return ret;
+}
- double get() {
- double ret = 0;
- __asm __volatile__("Math.abs(-12/3.3)":"=r"(ret)); // write to a variable
- asm("#comment1");
- asm volatile("#comment2");
- asm volatile("#comment3\n"
- "#comment4\n");
- return ret;
- }
+int main() {
+ asm("Module.print('Inline JS is very cool')");
+ printf("%.2f\n", get());
- int main() {
- asm("Module.print('Inline JS is very cool')");
- printf("%.2f\n", get());
+ // Test that passing multiple input and output variables works.
+ int src1 = 1, src2 = 2, src3 = 3;
+ int dst1 = 0, dst2 = 0, dst3 = 0;
+ // TODO asm("Module.print(%3); Module.print(%4); Module.print(%5); %0 = %3; %1
+ // = %4; %2 = %5;" : "=r"(dst1),"=r"(dst2),"=r"(dst3):
+ // "r"(src1),"r"(src2),"r"(src3));
+ // TODO printf("%d\n%d\n%d\n", dst1, dst2, dst3);
- // Test that passing multiple input and output variables works.
- int src1 = 1, src2 = 2, src3 = 3;
- int dst1 = 0, dst2 = 0, dst3 = 0;
- // TODO asm("Module.print(%3); Module.print(%4); Module.print(%5); %0 = %3; %1 = %4; %2 = %5;" : "=r"(dst1),"=r"(dst2),"=r"(dst3): "r"(src1),"r"(src2),"r"(src3));
- // TODO printf("%d\n%d\n%d\n", dst1, dst2, dst3);
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_inlinejs2.in b/tests/core/test_inlinejs2.in
index 7a05fd67..438253c2 100644
--- a/tests/core/test_inlinejs2.in
+++ b/tests/core/test_inlinejs2.in
@@ -1,20 +1,18 @@
+#include <stdio.h>
- #include <stdio.h>
+int mix(int x, int y) {
+ int ret;
+ asm("Math.pow(2, %0+%1+1)" : "=r"(ret) : "r"(x), "r"(y)); // read and write
+ return ret;
+}
- int mix(int x, int y) {
- int ret;
- asm("Math.pow(2, %0+%1+1)" : "=r"(ret) : "r"(x), "r"(y)); // read and write
- return ret;
- }
+void mult() {
+ asm("var $_$1 = Math.abs(-100); $_$1 *= 2; Module.print($_$1)"); // multiline
+ asm __volatile__("Module.print('done')");
+}
- void mult() {
- asm("var $_$1 = Math.abs(-100); $_$1 *= 2; Module.print($_$1)"); // multiline
- asm __volatile__("Module.print('done')");
- }
-
- int main(int argc, char **argv) {
- printf("%d\n", mix(argc, argc/2));
- mult();
- return 0;
- }
- \ No newline at end of file
+int main(int argc, char **argv) {
+ printf("%d\n", mix(argc, argc / 2));
+ mult();
+ return 0;
+}
diff --git a/tests/core/test_inlinejs3.in b/tests/core/test_inlinejs3.in
index e7d9b1e8..3e1913ff 100644
--- a/tests/core/test_inlinejs3.in
+++ b/tests/core/test_inlinejs3.in
@@ -1,26 +1,20 @@
+#include <stdio.h>
+#include <emscripten.h>
- #include <stdio.h>
- #include <emscripten.h>
-
- int main(int argc, char **argv) {
- EM_ASM(Module.print('hello dere1'));
- EM_ASM(
- Module.print('hello dere2');
- );
- for (int i = 0; i < 3; i++) {
- EM_ASM(
- Module.print('hello dere3');
- Module.print('hello dere' + 4);
- );
- }
- int sum = 0;
- for (int i = 0; i < argc*3; i++) {
- sum += EM_ASM_INT({
- Module.print('i: ' + [$0, ($1).toFixed(2)]);
- return $0*2;
- }, i, double(i)/12);
- }
- printf("sum: %d\n", sum);
- return 0;
- }
- \ No newline at end of file
+int main(int argc, char **argv) {
+ EM_ASM(Module.print('hello dere1'));
+ EM_ASM(Module.print('hello dere2'););
+ for (int i = 0; i < 3; i++) {
+ EM_ASM(Module.print('hello dere3'); Module.print('hello dere' + 4););
+ }
+ int sum = 0;
+ for (int i = 0; i < argc * 3; i++) {
+ sum += EM_ASM_INT({
+ Module.print('i: ' + [ $0, ($1).toFixed(2) ]);
+ return $0 * 2;
+ },
+ i, double(i) / 12);
+ }
+ printf("sum: %d\n", sum);
+ return 0;
+}
diff --git a/tests/core/test_intvars.in b/tests/core/test_intvars.in
index 7cf7df89..27b4180b 100644
--- a/tests/core/test_intvars.in
+++ b/tests/core/test_intvars.in
@@ -1,50 +1,49 @@
+#include <stdio.h>
+int global = 20;
+int *far;
+int main() {
+ int x = 5;
+ int y = x + 17;
+ int z = (y - 1) / 2; // Should stay an integer after division!
+ y += 1;
+ int w = x * 3 + 4;
+ int k = w < 15 ? 99 : 101;
+ far = &k;
+ *far += global;
+ int i = k > 100; // Should be an int, not a bool!
+ int j = i << 6;
+ j >>= 1;
+ j = j ^ 5;
+ int h = 1;
+ h |= 0;
+ int p = h;
+ p &= 0;
+ printf("*%d,%d,%d,%d,%d,%d,%d,%d,%d*\n", x, y, z, w, k, i, j, h, p);
- #include <stdio.h>
- int global = 20;
- int *far;
- int main()
- {
- int x = 5;
- int y = x+17;
- int z = (y-1)/2; // Should stay an integer after division!
- y += 1;
- int w = x*3+4;
- int k = w < 15 ? 99 : 101;
- far = &k;
- *far += global;
- int i = k > 100; // Should be an int, not a bool!
- int j = i << 6;
- j >>= 1;
- j = j ^ 5;
- int h = 1;
- h |= 0;
- int p = h;
- p &= 0;
- printf("*%d,%d,%d,%d,%d,%d,%d,%d,%d*\n", x, y, z, w, k, i, j, h, p);
+ long hash = -1;
+ size_t perturb;
+ int ii = 0;
+ for (perturb = hash;; perturb >>= 5) {
+ printf("%d:%d", ii, perturb);
+ ii++;
+ if (ii == 9) break;
+ printf(",");
+ }
+ printf("*\n");
+ printf("*%.1d,%.2d*\n", 56, 9);
- long hash = -1;
- size_t perturb;
- int ii = 0;
- for (perturb = hash; ; perturb >>= 5) {
- printf("%d:%d", ii, perturb);
- ii++;
- if (ii == 9) break;
- printf(",");
- }
- printf("*\n");
- printf("*%.1d,%.2d*\n", 56, 9);
+ // Fixed-point math on 64-bit ints. Tricky to support since we have no 64-bit
+ // shifts in JS
+ {
+ struct Fixed {
+ static int Mult(int a, int b) {
+ return ((long long)a * (long long)b) >> 16;
+ }
+ };
+ printf("fixed:%d\n", Fixed::Mult(150000, 140000));
+ }
- // Fixed-point math on 64-bit ints. Tricky to support since we have no 64-bit shifts in JS
- {
- struct Fixed {
- static int Mult(int a, int b) {
- return ((long long)a * (long long)b) >> 16;
- }
- };
- printf("fixed:%d\n", Fixed::Mult(150000, 140000));
- }
-
- printf("*%ld*%p\n", (long)21, &hash); // The %p should not enter an infinite loop!
- return 0;
- }
- \ No newline at end of file
+ printf("*%ld*%p\n", (long)21,
+ &hash); // The %p should not enter an infinite loop!
+ return 0;
+}
diff --git a/tests/core/test_isdigit_l.in b/tests/core/test_isdigit_l.in
index b94f618d..069f2027 100644
--- a/tests/core/test_isdigit_l.in
+++ b/tests/core/test_isdigit_l.in
@@ -1,7 +1,5 @@
-
- #include <iostream>
- int main() {
- using namespace std;
- use_facet<num_put<char> >(cout.getloc()).put(cout, cout, '0', 3.14159265);
- }
- \ No newline at end of file
+#include <iostream>
+int main() {
+ using namespace std;
+ use_facet<num_put<char> >(cout.getloc()).put(cout, cout, '0', 3.14159265);
+}
diff --git a/tests/core/test_isnan.in b/tests/core/test_isnan.in
index d5ca7a6e..808ffa19 100644
--- a/tests/core/test_isnan.in
+++ b/tests/core/test_isnan.in
@@ -1,17 +1,16 @@
+#include <stdio.h>
- #include <stdio.h>
+int IsNaN(double x) {
+ int rc; /* The value return */
+ volatile double y = x;
+ volatile double z = y;
+ rc = (y != z);
+ return rc;
+}
- int IsNaN(double x){
- int rc; /* The value return */
- volatile double y = x;
- volatile double z = y;
- rc = (y!=z);
- return rc;
- }
-
- int main() {
- double tests[] = { 1.0, 3.333, 1.0/0.0, 0.0/0.0, -1.0/0.0, -0, 0, -123123123, 12.0E200 };
- for (int i = 0; i < sizeof(tests)/sizeof(double); i++)
- printf("%d - %f - %d\n", i, tests[i], IsNaN(tests[i]));
- }
- \ No newline at end of file
+int main() {
+ double tests[] = {1.0, 3.333, 1.0 / 0.0, 0.0 / 0.0, -1.0 / 0.0,
+ -0, 0, -123123123, 12.0E200};
+ for (int i = 0; i < sizeof(tests) / sizeof(double); i++)
+ printf("%d - %f - %d\n", i, tests[i], IsNaN(tests[i]));
+}
diff --git a/tests/core/test_istream.in b/tests/core/test_istream.in
index 9a9d1c9a..e5988d24 100644
--- a/tests/core/test_istream.in
+++ b/tests/core/test_istream.in
@@ -1,16 +1,13 @@
+#include <string>
+#include <sstream>
+#include <iostream>
- #include <string>
- #include <sstream>
- #include <iostream>
+int main() {
+ std::string mystring("1 2 3");
+ std::istringstream is(mystring);
+ int one, two, three;
- int main()
- {
- std::string mystring("1 2 3");
- std::istringstream is(mystring);
- int one, two, three;
+ is >> one >> two >> three;
- is >> one >> two >> three;
-
- printf( "%i %i %i", one, two, three );
- }
- \ No newline at end of file
+ printf("%i %i %i", one, two, three);
+}
diff --git a/tests/core/test_iswdigit.in b/tests/core/test_iswdigit.in
index cc1b4a74..74277a41 100644
--- a/tests/core/test_iswdigit.in
+++ b/tests/core/test_iswdigit.in
@@ -1,12 +1,10 @@
+#include <stdio.h>
+#include <cctype>
+#include <cwctype>
- #include <stdio.h>
- #include <cctype>
- #include <cwctype>
-
- int main() {
- using namespace std;
- printf("%d ", isdigit('0'));
- printf("%d ", iswdigit(L'0'));
- return 0;
- }
- \ No newline at end of file
+int main() {
+ using namespace std;
+ printf("%d ", isdigit('0'));
+ printf("%d ", iswdigit(L'0'));
+ return 0;
+}
diff --git a/tests/core/test_libcextra.in b/tests/core/test_libcextra.in
index e0ff2f8e..ebeb8b50 100644
--- a/tests/core/test_libcextra.in
+++ b/tests/core/test_libcextra.in
@@ -1,13 +1,10 @@
+#include <stdio.h>
+#include <wchar.h>
- #include <stdio.h>
- #include <wchar.h>
+int main() {
+ const wchar_t* wstr = L"Hello";
- int main()
- {
- const wchar_t* wstr = L"Hello";
+ printf("wcslen: %d\n", wcslen(wstr));
- printf("wcslen: %d\n", wcslen(wstr));
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_libgen.in b/tests/core/test_libgen.in
index c7918a78..d62e4a00 100644
--- a/tests/core/test_libgen.in
+++ b/tests/core/test_libgen.in
@@ -1,41 +1,39 @@
+#include <stdio.h>
+#include <libgen.h>
- #include <stdio.h>
- #include <libgen.h>
+int main() {
+ char p1[16] = "/usr/lib", p1x[16] = "/usr/lib";
+ printf("%s -> ", p1);
+ printf("%s : %s\n", dirname(p1x), basename(p1));
- int main() {
- char p1[16] = "/usr/lib", p1x[16] = "/usr/lib";
- printf("%s -> ", p1);
- printf("%s : %s\n", dirname(p1x), basename(p1));
+ char p2[16] = "/usr", p2x[16] = "/usr";
+ printf("%s -> ", p2);
+ printf("%s : %s\n", dirname(p2x), basename(p2));
- char p2[16] = "/usr", p2x[16] = "/usr";
- printf("%s -> ", p2);
- printf("%s : %s\n", dirname(p2x), basename(p2));
+ char p3[16] = "/usr/", p3x[16] = "/usr/";
+ printf("%s -> ", p3);
+ printf("%s : %s\n", dirname(p3x), basename(p3));
- char p3[16] = "/usr/", p3x[16] = "/usr/";
- printf("%s -> ", p3);
- printf("%s : %s\n", dirname(p3x), basename(p3));
+ char p4[16] = "/usr/lib///", p4x[16] = "/usr/lib///";
+ printf("%s -> ", p4);
+ printf("%s : %s\n", dirname(p4x), basename(p4));
- char p4[16] = "/usr/lib///", p4x[16] = "/usr/lib///";
- printf("%s -> ", p4);
- printf("%s : %s\n", dirname(p4x), basename(p4));
+ char p5[16] = "/", p5x[16] = "/";
+ printf("%s -> ", p5);
+ printf("%s : %s\n", dirname(p5x), basename(p5));
- char p5[16] = "/", p5x[16] = "/";
- printf("%s -> ", p5);
- printf("%s : %s\n", dirname(p5x), basename(p5));
+ char p6[16] = "///", p6x[16] = "///";
+ printf("%s -> ", p6);
+ printf("%s : %s\n", dirname(p6x), basename(p6));
- char p6[16] = "///", p6x[16] = "///";
- printf("%s -> ", p6);
- printf("%s : %s\n", dirname(p6x), basename(p6));
+ char p7[16] = "/usr/../lib/..", p7x[16] = "/usr/../lib/..";
+ printf("%s -> ", p7);
+ printf("%s : %s\n", dirname(p7x), basename(p7));
- char p7[16] = "/usr/../lib/..", p7x[16] = "/usr/../lib/..";
- printf("%s -> ", p7);
- printf("%s : %s\n", dirname(p7x), basename(p7));
+ char p8[16] = "", p8x[16] = "";
+ printf("(empty) -> %s : %s\n", dirname(p8x), basename(p8));
- char p8[16] = "", p8x[16] = "";
- printf("(empty) -> %s : %s\n", dirname(p8x), basename(p8));
+ printf("(null) -> %s : %s\n", dirname(0), basename(0));
- printf("(null) -> %s : %s\n", dirname(0), basename(0));
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_linked_list.in b/tests/core/test_linked_list.in
index 4ca978bf..c3d457dd 100644
--- a/tests/core/test_linked_list.in
+++ b/tests/core/test_linked_list.in
@@ -1,42 +1,39 @@
+#include <stdio.h>
+struct worker_args {
+ int value;
+ struct worker_args* next;
+};
+int main() {
+ worker_args a;
+ worker_args b;
+ a.value = 60;
+ a.next = &b;
+ b.value = 900;
+ b.next = NULL;
+ worker_args* c = &a;
+ int total = 0;
+ while (c) {
+ total += c->value;
+ c = c->next;
+ }
- #include <stdio.h>
- struct worker_args {
- int value;
- struct worker_args *next;
- };
- int main()
- {
- worker_args a;
- worker_args b;
- a.value = 60;
- a.next = &b;
- b.value = 900;
- b.next = NULL;
- worker_args* c = &a;
- int total = 0;
- while (c) {
- total += c->value;
- c = c->next;
- }
+ // Chunk of em
+ worker_args chunk[10];
+ for (int i = 0; i < 9; i++) {
+ chunk[i].value = i * 10;
+ chunk[i].next = &chunk[i + 1];
+ }
+ chunk[9].value = 90;
+ chunk[9].next = &chunk[0];
- // Chunk of em
- worker_args chunk[10];
- for (int i = 0; i < 9; i++) {
- chunk[i].value = i*10;
- chunk[i].next = &chunk[i+1];
- }
- chunk[9].value = 90;
- chunk[9].next = &chunk[0];
+ c = chunk;
+ do {
+ total += c->value;
+ c = c->next;
+ } while (c != chunk);
- c = chunk;
- do {
- total += c->value;
- c = c->next;
- } while (c != chunk);
+ printf("*%d,%d*\n", total, b.next);
+ // NULL *is* 0, in C/C++. No JS null! (null == 0 is false, etc.)
- printf("*%d,%d*\n", total, b.next);
- // NULL *is* 0, in C/C++. No JS null! (null == 0 is false, etc.)
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_llrint.in b/tests/core/test_llrint.in
index cbba8a21..2744c73a 100644
--- a/tests/core/test_llrint.in
+++ b/tests/core/test_llrint.in
@@ -1,8 +1,7 @@
-
- #include <stdio.h>
- #include <math.h>
- int main() {
- printf("%lld\n%lld\n%lld\n%lld\n", llrint(0.1), llrint(0.6), llrint(1.25), llrint(1099511627776.667));
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+#include <math.h>
+int main() {
+ printf("%lld\n%lld\n%lld\n%lld\n", llrint(0.1), llrint(0.6), llrint(1.25),
+ llrint(1099511627776.667));
+ return 0;
+}
diff --git a/tests/core/test_llvm_intrinsics.in b/tests/core/test_llvm_intrinsics.in
index 6c235bdf..2bc87a54 100644
--- a/tests/core/test_llvm_intrinsics.in
+++ b/tests/core/test_llvm_intrinsics.in
@@ -1,41 +1,44 @@
-
- #include <stdio.h>
- #include <sys/types.h>
-
- extern "C" {
- extern unsigned short llvm_bswap_i16(unsigned short x);
- extern unsigned int llvm_bswap_i32(unsigned int x);
- extern int32_t llvm_ctlz_i32(int32_t x);
- extern int64_t llvm_ctlz_i64(int64_t x);
- extern int32_t llvm_cttz_i32(int32_t x);
- extern int64_t llvm_cttz_i64(int64_t x);
- extern int32_t llvm_ctpop_i32(int32_t x);
- extern int64_t llvm_ctpop_i64(int64_t x);
- extern int llvm_expect_i32(int x, int y);
- }
-
- int main(void) {
- unsigned short x = 0xc8ef;
- printf("%x,%x\n", x&0xff, x >> 8);
- x = llvm_bswap_i16(x);
- printf("%x,%x\n", x&0xff, x >> 8);
-
- unsigned int y = 0xc5de158a;
- printf("%x,%x,%x,%x\n", y&0xff, (y>>8)&0xff, (y>>16)&0xff, (y>>24)&0xff);
- y = llvm_bswap_i32(y);
- printf("%x,%x,%x,%x\n", y&0xff, (y>>8)&0xff, (y>>16)&0xff, (y>>24)&0xff);
-
- printf("%d,%d\n", (int)llvm_ctlz_i64(((int64_t)1) << 40), llvm_ctlz_i32(1<<10));
- printf("%d,%d\n", (int)llvm_cttz_i64(((int64_t)1) << 40), llvm_cttz_i32(1<<10));
- printf("%d,%d\n", (int)llvm_ctpop_i64((0x3101ULL << 32) | 1), llvm_ctpop_i32(0x3101));
- printf("%d\n", (int)llvm_ctpop_i32(-594093059));
-
- printf("%d\n", llvm_expect_i32(x % 27, 3));
-
- int64_t a = 1;
- a = __builtin_bswap64(a);
- printf("%lld\n", a);
-
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+#include <sys/types.h>
+
+extern "C" {
+extern unsigned short llvm_bswap_i16(unsigned short x);
+extern unsigned int llvm_bswap_i32(unsigned int x);
+extern int32_t llvm_ctlz_i32(int32_t x);
+extern int64_t llvm_ctlz_i64(int64_t x);
+extern int32_t llvm_cttz_i32(int32_t x);
+extern int64_t llvm_cttz_i64(int64_t x);
+extern int32_t llvm_ctpop_i32(int32_t x);
+extern int64_t llvm_ctpop_i64(int64_t x);
+extern int llvm_expect_i32(int x, int y);
+}
+
+int main(void) {
+ unsigned short x = 0xc8ef;
+ printf("%x,%x\n", x & 0xff, x >> 8);
+ x = llvm_bswap_i16(x);
+ printf("%x,%x\n", x & 0xff, x >> 8);
+
+ unsigned int y = 0xc5de158a;
+ printf("%x,%x,%x,%x\n", y & 0xff, (y >> 8) & 0xff, (y >> 16) & 0xff,
+ (y >> 24) & 0xff);
+ y = llvm_bswap_i32(y);
+ printf("%x,%x,%x,%x\n", y & 0xff, (y >> 8) & 0xff, (y >> 16) & 0xff,
+ (y >> 24) & 0xff);
+
+ printf("%d,%d\n", (int)llvm_ctlz_i64(((int64_t)1) << 40),
+ llvm_ctlz_i32(1 << 10));
+ printf("%d,%d\n", (int)llvm_cttz_i64(((int64_t)1) << 40),
+ llvm_cttz_i32(1 << 10));
+ printf("%d,%d\n", (int)llvm_ctpop_i64((0x3101ULL << 32) | 1),
+ llvm_ctpop_i32(0x3101));
+ printf("%d\n", (int)llvm_ctpop_i32(-594093059));
+
+ printf("%d\n", llvm_expect_i32(x % 27, 3));
+
+ int64_t a = 1;
+ a = __builtin_bswap64(a);
+ printf("%lld\n", a);
+
+ return 0;
+}
diff --git a/tests/core/test_llvm_used.in b/tests/core/test_llvm_used.in
index e40ae09e..b3c9f10e 100644
--- a/tests/core/test_llvm_used.in
+++ b/tests/core/test_llvm_used.in
@@ -1,14 +1,13 @@
+#include <stdio.h>
+#include <emscripten.h>
- #include <stdio.h>
- #include <emscripten.h>
-
- extern "C" {
- EMSCRIPTEN_KEEPALIVE void foobar(int x) {
- printf("Worked! %d\n", x);
- }
- }
+extern "C" {
+ EMSCRIPTEN_KEEPALIVE void foobar(int x) {
+ printf("Worked! %d\n", x);
+ }
+}
- int main() {
- emscripten_run_script("Module['_foobar'](10)");
- return 0;
- } \ No newline at end of file
+int main() {
+ emscripten_run_script("Module['_foobar'](10)");
+ return 0;
+}
diff --git a/tests/core/test_llvmswitch.in b/tests/core/test_llvmswitch.in
index 64cfa652..b3f871e4 100644
--- a/tests/core/test_llvmswitch.in
+++ b/tests/core/test_llvmswitch.in
@@ -1,24 +1,23 @@
+#include <stdio.h>
+#include <string.h>
- #include <stdio.h>
- #include <string.h>
+int switcher(int p) {
+ switch (p) {
+ case 'a':
+ case 'b':
+ case 'c':
+ return p - 1;
+ case -15:
+ return p + 1;
+ }
+ return p;
+}
- int switcher(int p)
- {
- switch(p) {
- case 'a':
- case 'b':
- case 'c':
- return p-1;
- case -15:
- return p+1;
- }
- return p;
- }
-
- int main( int argc, const char *argv[] ) {
- unsigned int x = 0xfffffff1;
- x >>= (argc-1); // force it to be unsigned for purpose of checking our switch comparison in signed/unsigned
- printf("*%d,%d,%d,%d,%d,%d*\n", switcher('a'), switcher('b'), switcher('c'), switcher(x), switcher(-15), switcher('e'));
- return 0;
- }
- \ No newline at end of file
+int main(int argc, const char *argv[]) {
+ unsigned int x = 0xfffffff1;
+ x >>= (argc - 1); // force it to be unsigned for purpose of checking our
+ // switch comparison in signed/unsigned
+ printf("*%d,%d,%d,%d,%d,%d*\n", switcher('a'), switcher('b'), switcher('c'),
+ switcher(x), switcher(-15), switcher('e'));
+ return 0;
+}
diff --git a/tests/core/test_longjmp.in b/tests/core/test_longjmp.in
index 4260ed15..44940cdd 100644
--- a/tests/core/test_longjmp.in
+++ b/tests/core/test_longjmp.in
@@ -1,34 +1,33 @@
+#include <stdio.h>
+#include <setjmp.h>
- #include <stdio.h>
- #include <setjmp.h>
+static jmp_buf buf;
- static jmp_buf buf;
+void second(void) {
+ printf("second\n");
+ longjmp(buf, -1);
+}
- void second(void) {
- printf("second\n");
- longjmp(buf,-1);
- }
+void first(void) {
+ printf("first\n"); // prints
+ longjmp(buf, 1); // jumps back to where setjmp was called - making setjmp now
+ // return 1
+}
- void first(void) {
- printf("first\n"); // prints
- longjmp(buf,1); // jumps back to where setjmp was called - making setjmp now return 1
- }
+int main() {
+ volatile int x = 0;
+ int jmpval = setjmp(buf);
+ if (!jmpval) {
+ x++; // should be properly restored once longjmp jumps back
+ first(); // when executed, setjmp returns 1
+ printf("skipped\n"); // does not print
+ } else if (jmpval == 1) { // when first() jumps back, setjmp returns 1
+ printf("result: %d %d\n", x, jmpval); // prints
+ x++;
+ second(); // when executed, setjmp returns -1
+ } else if (jmpval == -1) { // when second() jumps back, setjmp returns -1
+ printf("result: %d %d\n", x, jmpval); // prints
+ }
- int main() {
- volatile int x = 0;
- int jmpval = setjmp(buf);
- if (!jmpval) {
- x++; // should be properly restored once longjmp jumps back
- first(); // when executed, setjmp returns 1
- printf("skipped\n"); // does not print
- } else if (jmpval == 1) { // when first() jumps back, setjmp returns 1
- printf("result: %d %d\n", x, jmpval); // prints
- x++;
- second(); // when executed, setjmp returns -1
- } else if (jmpval == -1) { // when second() jumps back, setjmp returns -1
- printf("result: %d %d\n", x, jmpval); // prints
- }
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_longjmp2.in b/tests/core/test_longjmp2.in
index ef73c8ba..e09a33f7 100644
--- a/tests/core/test_longjmp2.in
+++ b/tests/core/test_longjmp2.in
@@ -1,37 +1,35 @@
-
- #include <setjmp.h>
- #include <stdio.h>
-
- typedef struct {
- jmp_buf* jmp;
- } jmp_state;
-
- void stack_manipulate_func(jmp_state* s, int level) {
- jmp_buf buf;
-
- printf("Entering stack_manipulate_func, level: %d\n", level);
-
- if (level == 0) {
- s->jmp = &buf;
- if (setjmp(*(s->jmp)) == 0) {
- printf("Setjmp normal execution path, level: %d\n", level);
- stack_manipulate_func(s, level + 1);
- } else {
- printf("Setjmp error execution path, level: %d\n", level);
- }
- } else {
- printf("Perform longjmp at level %d\n", level);
- longjmp(*(s->jmp), 1);
- }
-
- printf("Exiting stack_manipulate_func, level: %d\n", level);
- }
-
- int main(int argc, char *argv[]) {
- jmp_state s;
- s.jmp = NULL;
- stack_manipulate_func(&s, 0);
-
- return 0;
- }
- \ No newline at end of file
+#include <setjmp.h>
+#include <stdio.h>
+
+typedef struct {
+ jmp_buf* jmp;
+} jmp_state;
+
+void stack_manipulate_func(jmp_state* s, int level) {
+ jmp_buf buf;
+
+ printf("Entering stack_manipulate_func, level: %d\n", level);
+
+ if (level == 0) {
+ s->jmp = &buf;
+ if (setjmp(*(s->jmp)) == 0) {
+ printf("Setjmp normal execution path, level: %d\n", level);
+ stack_manipulate_func(s, level + 1);
+ } else {
+ printf("Setjmp error execution path, level: %d\n", level);
+ }
+ } else {
+ printf("Perform longjmp at level %d\n", level);
+ longjmp(*(s->jmp), 1);
+ }
+
+ printf("Exiting stack_manipulate_func, level: %d\n", level);
+}
+
+int main(int argc, char* argv[]) {
+ jmp_state s;
+ s.jmp = NULL;
+ stack_manipulate_func(&s, 0);
+
+ return 0;
+}
diff --git a/tests/core/test_longjmp3.in b/tests/core/test_longjmp3.in
index 95fcf36c..f9b88469 100644
--- a/tests/core/test_longjmp3.in
+++ b/tests/core/test_longjmp3.in
@@ -1,42 +1,40 @@
-
- #include <setjmp.h>
- #include <stdio.h>
-
- typedef struct {
- jmp_buf* jmp;
- } jmp_state;
-
- void setjmp_func(jmp_state* s, int level) {
- jmp_buf* prev_jmp = s->jmp;
- jmp_buf c_jmp;
-
- if (level == 2) {
- printf("level is 2, perform longjmp!\n");
- longjmp(*(s->jmp), 1);
- }
-
- if (setjmp(c_jmp) == 0) {
- printf("setjmp normal execution path, level: %d\n", level);
- s->jmp = &c_jmp;
- setjmp_func(s, level + 1);
- } else {
- printf("setjmp exception execution path, level: %d\n", level);
- if (prev_jmp) {
- printf("prev_jmp is not empty, continue with longjmp!\n");
- s->jmp = prev_jmp;
- longjmp(*(s->jmp), 1);
- }
- }
-
- printf("Exiting setjmp function, level: %d\n", level);
- }
-
- int main(int argc, char *argv[]) {
- jmp_state s;
- s.jmp = NULL;
-
- setjmp_func(&s, 0);
-
- return 0;
- }
- \ No newline at end of file
+#include <setjmp.h>
+#include <stdio.h>
+
+typedef struct {
+ jmp_buf* jmp;
+} jmp_state;
+
+void setjmp_func(jmp_state* s, int level) {
+ jmp_buf* prev_jmp = s->jmp;
+ jmp_buf c_jmp;
+
+ if (level == 2) {
+ printf("level is 2, perform longjmp!\n");
+ longjmp(*(s->jmp), 1);
+ }
+
+ if (setjmp(c_jmp) == 0) {
+ printf("setjmp normal execution path, level: %d\n", level);
+ s->jmp = &c_jmp;
+ setjmp_func(s, level + 1);
+ } else {
+ printf("setjmp exception execution path, level: %d\n", level);
+ if (prev_jmp) {
+ printf("prev_jmp is not empty, continue with longjmp!\n");
+ s->jmp = prev_jmp;
+ longjmp(*(s->jmp), 1);
+ }
+ }
+
+ printf("Exiting setjmp function, level: %d\n", level);
+}
+
+int main(int argc, char* argv[]) {
+ jmp_state s;
+ s.jmp = NULL;
+
+ setjmp_func(&s, 0);
+
+ return 0;
+}
diff --git a/tests/core/test_longjmp4.in b/tests/core/test_longjmp4.in
index ce27f751..68fa4c22 100644
--- a/tests/core/test_longjmp4.in
+++ b/tests/core/test_longjmp4.in
@@ -1,44 +1,40 @@
+#include <setjmp.h>
+#include <stdio.h>
- #include <setjmp.h>
- #include <stdio.h>
+typedef struct {
+ jmp_buf* jmp;
+} jmp_state;
- typedef struct {
- jmp_buf* jmp;
- } jmp_state;
+void second_func(jmp_state* s);
- void second_func(jmp_state* s);
+void first_func(jmp_state* s) {
+ jmp_buf* prev_jmp = s->jmp;
+ jmp_buf c_jmp;
+ volatile int once = 0;
- void first_func(jmp_state* s) {
- jmp_buf* prev_jmp = s->jmp;
- jmp_buf c_jmp;
- volatile int once = 0;
+ if (setjmp(c_jmp) == 0) {
+ printf("Normal execution path of first function!\n");
- if (setjmp(c_jmp) == 0) {
- printf("Normal execution path of first function!\n");
+ s->jmp = &c_jmp;
+ second_func(s);
+ } else {
+ printf("Exception execution path of first function! %d\n", once);
- s->jmp = &c_jmp;
- second_func(s);
- } else {
- printf("Exception execution path of first function! %d\n", once);
+ if (!once) {
+ printf("Calling longjmp the second time!\n");
+ once = 1;
+ longjmp(*(s->jmp), 1);
+ }
+ }
+}
- if (!once) {
- printf("Calling longjmp the second time!\n");
- once = 1;
- longjmp(*(s->jmp), 1);
- }
- }
- }
+void second_func(jmp_state* s) { longjmp(*(s->jmp), 1); }
- void second_func(jmp_state* s) {
- longjmp(*(s->jmp), 1);
- }
+int main(int argc, char* argv[]) {
+ jmp_state s;
+ s.jmp = NULL;
- int main(int argc, char *argv[]) {
- jmp_state s;
- s.jmp = NULL;
+ first_func(&s);
- first_func(&s);
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_longjmp_exc.in b/tests/core/test_longjmp_exc.in
index 3fc07b85..4e568242 100644
--- a/tests/core/test_longjmp_exc.in
+++ b/tests/core/test_longjmp_exc.in
@@ -1,28 +1,28 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <setjmp.h>
+#include <emscripten.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <setjmp.h>
- #include <emscripten.h>
+jmp_buf abortframe;
- jmp_buf abortframe;
+void dostuff(int a) {
+ printf("pre\n");
+ if (a != 42)
+ emscripten_run_script(
+ "waka_waka()"); // this should fail, and never reach "never"
+ printf("never\n");
- void dostuff(int a) {
- printf("pre\n");
- if (a != 42) emscripten_run_script("waka_waka()"); // this should fail, and never reach "never"
- printf("never\n");
+ if (a == 100) {
+ longjmp(abortframe, -1);
+ }
- if (a == 100) {
- longjmp (abortframe, -1);
- }
+ if (setjmp(abortframe)) {
+ printf("got 100");
+ }
+}
- if (setjmp(abortframe)) {
- printf("got 100");
- }
- }
-
- int main(int argc, char **argv) {
- dostuff(argc);
- exit(1);
- return 1;
- }
- \ No newline at end of file
+int main(int argc, char **argv) {
+ dostuff(argc);
+ exit(1);
+ return 1;
+}
diff --git a/tests/core/test_longjmp_funcptr.in b/tests/core/test_longjmp_funcptr.in
index e699bae6..38cbd86e 100644
--- a/tests/core/test_longjmp_funcptr.in
+++ b/tests/core/test_longjmp_funcptr.in
@@ -1,32 +1,31 @@
+#include <stdio.h>
+#include <setjmp.h>
- #include <stdio.h>
- #include <setjmp.h>
+static jmp_buf buf;
- static jmp_buf buf;
+void (*fp)() = NULL;
- void (*fp)() = NULL;
+void second(void) {
+ printf("second\n"); // prints
+ longjmp(buf, 1); // jumps back to where setjmp was called - making setjmp now
+ // return 1
+}
- void second(void) {
- printf("second\n"); // prints
- longjmp(buf,1); // jumps back to where setjmp was called - making setjmp now return 1
- }
+void first(void) {
+ fp();
+ printf("first\n"); // does not print
+}
- void first(void) {
- fp();
- printf("first\n"); // does not print
- }
+int main(int argc, char **argv) {
+ fp = argc == 200 ? NULL : second;
- int main(int argc, char **argv) {
- fp = argc == 200 ? NULL : second;
+ volatile int x = 0;
+ if (!setjmp(buf)) {
+ x++;
+ first(); // when executed, setjmp returns 0
+ } else { // when longjmp jumps back, setjmp returns 1
+ printf("main: %d\n", x); // prints
+ }
- volatile int x = 0;
- if ( ! setjmp(buf) ) {
- x++;
- first(); // when executed, setjmp returns 0
- } else { // when longjmp jumps back, setjmp returns 1
- printf("main: %d\n", x); // prints
- }
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_longjmp_repeat.in b/tests/core/test_longjmp_repeat.in
index 4476f8dd..f782fc0c 100644
--- a/tests/core/test_longjmp_repeat.in
+++ b/tests/core/test_longjmp_repeat.in
@@ -1,15 +1,13 @@
+#include <stdio.h>
+#include <setjmp.h>
- #include <stdio.h>
- #include <setjmp.h>
+static jmp_buf buf;
- static jmp_buf buf;
-
- int main() {
- volatile int x = 0;
- printf("setjmp:%d\n", setjmp(buf));
- x++;
- printf("x:%d\n", x);
- if (x < 4) longjmp(buf, x*2);
- return 0;
- }
- \ No newline at end of file
+int main() {
+ volatile int x = 0;
+ printf("setjmp:%d\n", setjmp(buf));
+ x++;
+ printf("x:%d\n", x);
+ if (x < 4) longjmp(buf, x * 2);
+ return 0;
+}
diff --git a/tests/core/test_longjmp_stacked.in b/tests/core/test_longjmp_stacked.in
index 19539561..b7fd6bfa 100644
--- a/tests/core/test_longjmp_stacked.in
+++ b/tests/core/test_longjmp_stacked.in
@@ -1,44 +1,42 @@
+#include <stdio.h>
+#include <setjmp.h>
+#include <stdlib.h>
+#include <string.h>
- #include <stdio.h>
- #include <setjmp.h>
- #include <stdlib.h>
- #include <string.h>
+int bottom, top;
- int bottom, top;
+int run(int y) {
+ // confuse stack
+ char *s = (char *)alloca(100);
+ memset(s, 1, 100);
+ s[y] = y;
+ s[y / 2] = y * 2;
+ volatile int x = s[y];
+ top = (int)alloca(4);
+ if (x <= 2) return x;
+ jmp_buf buf;
+ printf("setjmp of %d\n", x);
+ if (setjmp(buf) == 0) {
+ printf("going\n");
+ x += run(x / 2);
+ longjmp(buf, 1);
+ }
+ printf("back\n");
+ return x / 2;
+}
- int run(int y) {
- // confuse stack
- char *s = (char*)alloca(100);
- memset(s, 1, 100);
- s[y] = y;
- s[y/2] = y*2;
- volatile int x = s[y];
- top = (int)alloca(4);
- if (x <= 2) return x;
- jmp_buf buf;
- printf("setjmp of %d\n", x);
- if (setjmp(buf) == 0) {
- printf("going\n");
- x += run(x/2);
- longjmp(buf, 1);
- }
- printf("back\n");
- return x/2;
- }
-
- int main(int argc, char **argv) {
- int sum = 0;
- for (int i = 0; i < argc*2; i++) {
- bottom = (int)alloca(4);
- sum += run(10);
- // scorch the earth
- if (bottom < top) {
- memset((void*)bottom, 1, top - bottom);
- } else {
- memset((void*)top, 1, bottom - top);
- }
- }
- printf("%d\n", sum);
- return sum;
- }
- \ No newline at end of file
+int main(int argc, char **argv) {
+ int sum = 0;
+ for (int i = 0; i < argc * 2; i++) {
+ bottom = (int)alloca(4);
+ sum += run(10);
+ // scorch the earth
+ if (bottom < top) {
+ memset((void *)bottom, 1, top - bottom);
+ } else {
+ memset((void *)top, 1, bottom - top);
+ }
+ }
+ printf("%d\n", sum);
+ return sum;
+}
diff --git a/tests/core/test_loop.in b/tests/core/test_loop.in
index 9df45457..83721d17 100644
--- a/tests/core/test_loop.in
+++ b/tests/core/test_loop.in
@@ -1,17 +1,14 @@
-
- #include <stdio.h>
- int main()
- {
- int x = 5;
- for (int i = 0; i < 6; i++) {
- x += x*i;
- if (x > 1000) {
- if (x % 7 == 0) printf("cheez\n");
- x /= 2;
- break;
- }
- }
- printf("*%d*\n", x);
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+int main() {
+ int x = 5;
+ for (int i = 0; i < 6; i++) {
+ x += x * i;
+ if (x > 1000) {
+ if (x % 7 == 0) printf("cheez\n");
+ x /= 2;
+ break;
+ }
+ }
+ printf("*%d*\n", x);
+ return 0;
+}
diff --git a/tests/core/test_mainenv.in b/tests/core/test_mainenv.in
index da434196..f42c6b59 100644
--- a/tests/core/test_mainenv.in
+++ b/tests/core/test_mainenv.in
@@ -1,8 +1,5 @@
-
- #include <stdio.h>
- int main(int argc, char **argv, char **envp)
- {
- printf("*%p*\n", envp);
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+int main(int argc, char **argv, char **envp) {
+ printf("*%p*\n", envp);
+ return 0;
+}
diff --git a/tests/core/test_math.in b/tests/core/test_math.in
index 0685c178..e638404b 100644
--- a/tests/core/test_math.in
+++ b/tests/core/test_math.in
@@ -1,34 +1,34 @@
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <cmath>
- int main(int argc, char **argv)
- {
- printf("*%.2f,%.2f,%d", M_PI, -M_PI, (1/0.0) > 1e300); // could end up as infinity, or just a very very big number
- printf(",%d", isfinite(NAN) != 0);
- printf(",%d", isfinite(INFINITY) != 0);
- printf(",%d", isfinite(-INFINITY) != 0);
- printf(",%d", isfinite(12.3) != 0);
- printf(",%d", isinf(NAN) != 0);
- printf(",%d", isinf(INFINITY) != 0);
- printf(",%d", isinf(-INFINITY) != 0);
- printf(",%d", isinf(12.3) != 0);
- div_t div_result = div(23, 10);
- printf(",%d", div_result.quot);
- printf(",%d", div_result.rem);
- double sine = -1.0, cosine = -1.0;
- sincos(0.0, &sine, &cosine);
- printf(",%1.1lf", sine);
- printf(",%1.1lf", cosine);
- float fsine = -1.0f, fcosine = -1.0f;
- sincosf(0.0, &fsine, &fcosine);
- printf(",%1.1f", fsine);
- printf(",%1.1f", fcosine);
- fsine = sinf(1.1 + argc - 1);
- fcosine = cosf(1.1 + argc - 1);
- printf(",%1.1f", fsine);
- printf(",%1.1f", fcosine);
- printf("*\n");
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+#include <stdlib.h>
+#include <cmath>
+int main(int argc, char **argv) {
+ printf("*%.2f,%.2f,%d", M_PI, -M_PI, (1 / 0.0) > 1e300); // could end up as
+ // infinity, or just
+ // a very very big
+ // number
+ printf(",%d", isfinite(NAN) != 0);
+ printf(",%d", isfinite(INFINITY) != 0);
+ printf(",%d", isfinite(-INFINITY) != 0);
+ printf(",%d", isfinite(12.3) != 0);
+ printf(",%d", isinf(NAN) != 0);
+ printf(",%d", isinf(INFINITY) != 0);
+ printf(",%d", isinf(-INFINITY) != 0);
+ printf(",%d", isinf(12.3) != 0);
+ div_t div_result = div(23, 10);
+ printf(",%d", div_result.quot);
+ printf(",%d", div_result.rem);
+ double sine = -1.0, cosine = -1.0;
+ sincos(0.0, &sine, &cosine);
+ printf(",%1.1lf", sine);
+ printf(",%1.1lf", cosine);
+ float fsine = -1.0f, fcosine = -1.0f;
+ sincosf(0.0, &fsine, &fcosine);
+ printf(",%1.1f", fsine);
+ printf(",%1.1f", fcosine);
+ fsine = sinf(1.1 + argc - 1);
+ fcosine = cosf(1.1 + argc - 1);
+ printf(",%1.1f", fsine);
+ printf(",%1.1f", fcosine);
+ printf("*\n");
+ return 0;
+}
diff --git a/tests/core/test_mathfuncptr.in b/tests/core/test_mathfuncptr.in
index 96e78401..87feaade 100644
--- a/tests/core/test_mathfuncptr.in
+++ b/tests/core/test_mathfuncptr.in
@@ -1,13 +1,11 @@
+#include <math.h>
+#include <stdio.h>
- #include <math.h>
- #include <stdio.h>
-
- int
- main(int argc, char **argv) {
- float (*fn)(float) = argc != 12 ? &sqrtf : &fabsf;
- float (*fn2)(float) = argc != 13 ? &fabsf : &sqrtf;
- float (*fn3)(float) = argc != 14 ? &erff : &fabsf;
- printf("fn2(-5) = %d, fn(10) = %.2f, erf(10) = %.2f\n", (int)fn2(-5), fn(10), fn3(10));
- return 0;
- }
- \ No newline at end of file
+int main(int argc, char **argv) {
+ float (*fn)(float) = argc != 12 ? &sqrtf : &fabsf;
+ float (*fn2)(float) = argc != 13 ? &fabsf : &sqrtf;
+ float (*fn3)(float) = argc != 14 ? &erff : &fabsf;
+ printf("fn2(-5) = %d, fn(10) = %.2f, erf(10) = %.2f\n", (int)fn2(-5), fn(10),
+ fn3(10));
+ return 0;
+}
diff --git a/tests/core/test_memcpy2.in b/tests/core/test_memcpy2.in
index 91e0b6a0..c7b4de89 100644
--- a/tests/core/test_memcpy2.in
+++ b/tests/core/test_memcpy2.in
@@ -1,22 +1,20 @@
-
- #include <stdio.h>
- #include <string.h>
- #include <assert.h>
- int main() {
- char buffer[256];
- for (int i = 0; i < 10; i++) {
- for (int j = 0; j < 10; j++) {
- for (int k = 0; k < 35; k++) {
- for (int t = 0; t < 256; t++) buffer[t] = t;
- char *dest = buffer + i + 128;
- char *src = buffer+j;
- //printf("%d, %d, %d\n", i, j, k);
- assert(memcpy(dest, src, k) == dest);
- assert(memcmp(dest, src, k) == 0);
- }
- }
- }
- printf("ok.\n");
- return 1;
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+int main() {
+ char buffer[256];
+ for (int i = 0; i < 10; i++) {
+ for (int j = 0; j < 10; j++) {
+ for (int k = 0; k < 35; k++) {
+ for (int t = 0; t < 256; t++) buffer[t] = t;
+ char *dest = buffer + i + 128;
+ char *src = buffer + j;
+ // printf("%d, %d, %d\n", i, j, k);
+ assert(memcpy(dest, src, k) == dest);
+ assert(memcmp(dest, src, k) == 0);
}
- \ No newline at end of file
+ }
+ }
+ printf("ok.\n");
+ return 1;
+}
diff --git a/tests/core/test_memcpy_memcmp.in b/tests/core/test_memcpy_memcmp.in
index c89d7ef6..fb5dfe6f 100644
--- a/tests/core/test_memcpy_memcmp.in
+++ b/tests/core/test_memcpy_memcmp.in
@@ -1,45 +1,43 @@
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
- #include <stdio.h>
- #include <string.h>
- #include <assert.h>
-
- #define MAXX 48
- void reset(unsigned char *buffer) {
- for (int i = 0; i < MAXX; i++) buffer[i] = i+1;
- }
- void dump(unsigned char *buffer) {
- for (int i = 0; i < MAXX-1; i++) printf("%2d,", buffer[i]);
- printf("%d\n", buffer[MAXX-1]);
+#define MAXX 48
+void reset(unsigned char *buffer) {
+ for (int i = 0; i < MAXX; i++) buffer[i] = i + 1;
+}
+void dump(unsigned char *buffer) {
+ for (int i = 0; i < MAXX - 1; i++) printf("%2d,", buffer[i]);
+ printf("%d\n", buffer[MAXX - 1]);
+}
+int main() {
+ unsigned char buffer[MAXX];
+ for (int i = MAXX / 4; i < MAXX - MAXX / 4; i++) {
+ for (int j = MAXX / 4; j < MAXX - MAXX / 4; j++) {
+ for (int k = 1; k < MAXX / 4; k++) {
+ if (i == j) continue;
+ if (i < j && i + k > j) continue;
+ if (j < i && j + k > i) continue;
+ printf("[%d,%d,%d] ", i, j, k);
+ reset(buffer);
+ memcpy(buffer + i, buffer + j, k);
+ dump(buffer);
+ assert(memcmp(buffer + i, buffer + j, k) == 0);
+ buffer[i + k / 2]++;
+ if (buffer[i + k / 2] != 0) {
+ assert(memcmp(buffer + i, buffer + j, k) > 0);
+ } else {
+ assert(memcmp(buffer + i, buffer + j, k) < 0);
}
- int main() {
- unsigned char buffer[MAXX];
- for (int i = MAXX/4; i < MAXX-MAXX/4; i++) {
- for (int j = MAXX/4; j < MAXX-MAXX/4; j++) {
- for (int k = 1; k < MAXX/4; k++) {
- if (i == j) continue;
- if (i < j && i+k > j) continue;
- if (j < i && j+k > i) continue;
- printf("[%d,%d,%d] ", i, j, k);
- reset(buffer);
- memcpy(buffer+i, buffer+j, k);
- dump(buffer);
- assert(memcmp(buffer+i, buffer+j, k) == 0);
- buffer[i + k/2]++;
- if (buffer[i + k/2] != 0) {
- assert(memcmp(buffer+i, buffer+j, k) > 0);
- } else {
- assert(memcmp(buffer+i, buffer+j, k) < 0);
- }
- buffer[i + k/2]--;
- buffer[j + k/2]++;
- if (buffer[j + k/2] != 0) {
- assert(memcmp(buffer+i, buffer+j, k) < 0);
- } else {
- assert(memcmp(buffer+i, buffer+j, k) > 0);
- }
- }
- }
- }
- return 0;
+ buffer[i + k / 2]--;
+ buffer[j + k / 2]++;
+ if (buffer[j + k / 2] != 0) {
+ assert(memcmp(buffer + i, buffer + j, k) < 0);
+ } else {
+ assert(memcmp(buffer + i, buffer + j, k) > 0);
}
- \ No newline at end of file
+ }
+ }
+ }
+ return 0;
+}
diff --git a/tests/core/test_memmove.in b/tests/core/test_memmove.in
index 690075d9..615a5ae1 100644
--- a/tests/core/test_memmove.in
+++ b/tests/core/test_memmove.in
@@ -1,10 +1,8 @@
-
- #include <stdio.h>
- #include <string.h>
- int main() {
- char str[] = "memmove can be very useful....!";
- memmove (str+20, str+15, 11);
- puts(str);
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+#include <string.h>
+int main() {
+ char str[] = "memmove can be very useful....!";
+ memmove(str + 20, str + 15, 11);
+ puts(str);
+ return 0;
+}
diff --git a/tests/core/test_memmove2.in b/tests/core/test_memmove2.in
index 087f59b8..2aed0b51 100644
--- a/tests/core/test_memmove2.in
+++ b/tests/core/test_memmove2.in
@@ -1,24 +1,22 @@
-
- #include <stdio.h>
- #include <string.h>
- #include <assert.h>
- int main() {
- int sum = 0;
- char buffer[256];
- for (int i = 0; i < 10; i++) {
- for (int j = 0; j < 10; j++) {
- for (int k = 0; k < 35; k++) {
- for (int t = 0; t < 256; t++) buffer[t] = t;
- char *dest = buffer + i;
- char *src = buffer + j;
- if (dest == src) continue;
- //printf("%d, %d, %d\n", i, j, k);
- assert(memmove(dest, src, k) == dest);
- for (int t = 0; t < 256; t++) sum += buffer[t];
- }
- }
- }
- printf("final: %d.\n", sum);
- return 1;
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+int main() {
+ int sum = 0;
+ char buffer[256];
+ for (int i = 0; i < 10; i++) {
+ for (int j = 0; j < 10; j++) {
+ for (int k = 0; k < 35; k++) {
+ for (int t = 0; t < 256; t++) buffer[t] = t;
+ char *dest = buffer + i;
+ char *src = buffer + j;
+ if (dest == src) continue;
+ // printf("%d, %d, %d\n", i, j, k);
+ assert(memmove(dest, src, k) == dest);
+ for (int t = 0; t < 256; t++) sum += buffer[t];
}
- \ No newline at end of file
+ }
+ }
+ printf("final: %d.\n", sum);
+ return 1;
+}
diff --git a/tests/core/test_memmove3.in b/tests/core/test_memmove3.in
index a28267cd..27f9055b 100644
--- a/tests/core/test_memmove3.in
+++ b/tests/core/test_memmove3.in
@@ -1,10 +1,8 @@
-
- #include <stdio.h>
- #include <string.h>
- int main() {
- char str[] = "memmove can be vvery useful....!";
- memmove(str+15, str+16, 17);
- puts(str);
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+#include <string.h>
+int main() {
+ char str[] = "memmove can be vvery useful....!";
+ memmove(str + 15, str + 16, 17);
+ puts(str);
+ return 0;
+}
diff --git a/tests/core/test_mmap.in b/tests/core/test_mmap.in
index 46400278..16c1c647 100644
--- a/tests/core/test_mmap.in
+++ b/tests/core/test_mmap.in
@@ -1,38 +1,36 @@
-
- #include <stdio.h>
- #include <sys/mman.h>
- #include <assert.h>
-
- int main(int argc, char *argv[]) {
- for (int i = 0; i < 10; i++) {
- int* map = (int*)mmap(0, 5000, PROT_READ | PROT_WRITE,
- MAP_SHARED | MAP_ANON, -1, 0);
- /* TODO: Should we align to 4k?
- assert(((int)map) % 4096 == 0); // aligned
- */
- assert(munmap(map, 5000) == 0);
- }
-
- const int NUM_BYTES = 8 * 1024 * 1024;
- const int NUM_INTS = NUM_BYTES / sizeof(int);
-
- int* map = (int*)mmap(0, NUM_BYTES, PROT_READ | PROT_WRITE,
- MAP_SHARED | MAP_ANON, -1, 0);
- assert(map != MAP_FAILED);
-
- int i;
-
- for (i = 0; i < NUM_INTS; i++) {
- map[i] = i;
- }
-
- for (i = 0; i < NUM_INTS; i++) {
- assert(map[i] == i);
- }
-
- assert(munmap(map, NUM_BYTES) == 0);
-
- printf("hello,world");
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+#include <sys/mman.h>
+#include <assert.h>
+
+int main(int argc, char* argv[]) {
+ for (int i = 0; i < 10; i++) {
+ int* map = (int*)mmap(0, 5000, PROT_READ | PROT_WRITE,
+ MAP_SHARED | MAP_ANON, -1, 0);
+ /* TODO: Should we align to 4k?
+ assert(((int)map) % 4096 == 0); // aligned
+ */
+ assert(munmap(map, 5000) == 0);
+ }
+
+ const int NUM_BYTES = 8 * 1024 * 1024;
+ const int NUM_INTS = NUM_BYTES / sizeof(int);
+
+ int* map = (int*)mmap(0, NUM_BYTES, PROT_READ | PROT_WRITE,
+ MAP_SHARED | MAP_ANON, -1, 0);
+ assert(map != MAP_FAILED);
+
+ int i;
+
+ for (i = 0; i < NUM_INTS; i++) {
+ map[i] = i;
+ }
+
+ for (i = 0; i < NUM_INTS; i++) {
+ assert(map[i] == i);
+ }
+
+ assert(munmap(map, NUM_BYTES) == 0);
+
+ printf("hello,world");
+ return 0;
+}
diff --git a/tests/core/test_mod_globalstruct.in b/tests/core/test_mod_globalstruct.in
index 3e1ed493..3a8522cc 100644
--- a/tests/core/test_mod_globalstruct.in
+++ b/tests/core/test_mod_globalstruct.in
@@ -1,19 +1,18 @@
+#include <stdio.h>
- #include <stdio.h>
+struct malloc_params {
+ size_t magic, page_size;
+};
- struct malloc_params {
- size_t magic, page_size;
- };
+malloc_params mparams;
- malloc_params mparams;
+#define SIZE_T_ONE ((size_t)1)
+#define page_align(S) \
+ (((S) + (mparams.page_size - SIZE_T_ONE)) & ~(mparams.page_size - SIZE_T_ONE))
- #define SIZE_T_ONE ((size_t)1)
- #define page_align(S) (((S) + (mparams.page_size - SIZE_T_ONE)) & ~(mparams.page_size - SIZE_T_ONE))
-
- int main()
- {
- mparams.page_size = 4096;
- printf("*%d,%d,%d,%d*\n", mparams.page_size, page_align(1000), page_align(6000), page_align(66474));
- return 0;
- }
- \ No newline at end of file
+int main() {
+ mparams.page_size = 4096;
+ printf("*%d,%d,%d,%d*\n", mparams.page_size, page_align(1000),
+ page_align(6000), page_align(66474));
+ return 0;
+}
diff --git a/tests/core/test_multiexception.in b/tests/core/test_multiexception.in
index 93795388..46acbbf3 100644
--- a/tests/core/test_multiexception.in
+++ b/tests/core/test_multiexception.in
@@ -1,48 +1,50 @@
-
#include <stdio.h>
static int current_exception_id = 0;
typedef struct {
-int jmp;
+ int jmp;
} jmp_state;
void setjmp_func(jmp_state* s, int level) {
-int prev_jmp = s->jmp;
-int c_jmp;
+ int prev_jmp = s->jmp;
+ int c_jmp;
-if (level == 2) {
- printf("level is 2, perform longjmp!\n");
- throw 1;
-}
+ if (level == 2) {
+ printf("level is 2, perform longjmp!\n");
+ throw 1;
+ }
-c_jmp = current_exception_id++;
-try {
- printf("setjmp normal execution path, level: %d, prev_jmp: %d\n", level, prev_jmp);
- s->jmp = c_jmp;
- setjmp_func(s, level + 1);
-} catch (int catched_eid) {
- printf("caught %d\n", catched_eid);
- if (catched_eid == c_jmp) {
- printf("setjmp exception execution path, level: %d, prev_jmp: %d\n", level, prev_jmp);
- if (prev_jmp != -1) {
- printf("prev_jmp is not empty, continue with longjmp!\n");
- s->jmp = prev_jmp;
- throw s->jmp;
+ c_jmp = current_exception_id++;
+ try {
+ printf("setjmp normal execution path, level: %d, prev_jmp: %d\n", level,
+ prev_jmp);
+ s->jmp = c_jmp;
+ setjmp_func(s, level + 1);
+ }
+ catch (int catched_eid) {
+ printf("caught %d\n", catched_eid);
+ if (catched_eid == c_jmp) {
+ printf("setjmp exception execution path, level: %d, prev_jmp: %d\n",
+ level, prev_jmp);
+ if (prev_jmp != -1) {
+ printf("prev_jmp is not empty, continue with longjmp!\n");
+ s->jmp = prev_jmp;
+ throw s->jmp;
+ }
+ } else {
+ throw;
}
- } else {
- throw;
}
-}
-printf("Exiting setjmp function, level: %d, prev_jmp: %d\n", level, prev_jmp);
+ printf("Exiting setjmp function, level: %d, prev_jmp: %d\n", level, prev_jmp);
}
-int main(int argc, char *argv[]) {
-jmp_state s;
-s.jmp = -1;
+int main(int argc, char* argv[]) {
+ jmp_state s;
+ s.jmp = -1;
-setjmp_func(&s, 0);
+ setjmp_func(&s, 0);
-return 0;
+ return 0;
}
diff --git a/tests/core/test_negative_zero.in b/tests/core/test_negative_zero.in
index 8e1fcc0b..395f84ce 100644
--- a/tests/core/test_negative_zero.in
+++ b/tests/core/test_negative_zero.in
@@ -1,30 +1,27 @@
+#include <stdio.h>
+#include <math.h>
- #include <stdio.h>
- #include <math.h>
-
- int main() {
- #define TEST(x, y) \
- printf("%.2f, %.2f ==> %.2f\n", x, y, copysign(x, y));
- TEST( 5.0f, 5.0f);
- TEST( 5.0f, -5.0f);
- TEST(-5.0f, 5.0f);
- TEST(-5.0f, -5.0f);
- TEST( 5.0f, 4.0f);
- TEST( 5.0f, -4.0f);
- TEST(-5.0f, 4.0f);
- TEST(-5.0f, -4.0f);
- TEST( 0.0f, 5.0f);
- TEST( 0.0f, -5.0f);
- TEST(-0.0f, 5.0f);
- TEST(-0.0f, -5.0f);
- TEST( 5.0f, 0.0f);
- TEST( 5.0f, -0.0f);
- TEST(-5.0f, 0.0f);
- TEST(-5.0f, -0.0f);
- TEST( 0.0f, 0.0f);
- TEST( 0.0f, -0.0f);
- TEST(-0.0f, 0.0f);
- TEST(-0.0f, -0.0f);
- return 0;
- }
- \ No newline at end of file
+int main() {
+#define TEST(x, y) printf("%.2f, %.2f ==> %.2f\n", x, y, copysign(x, y));
+ TEST(5.0f, 5.0f);
+ TEST(5.0f, -5.0f);
+ TEST(-5.0f, 5.0f);
+ TEST(-5.0f, -5.0f);
+ TEST(5.0f, 4.0f);
+ TEST(5.0f, -4.0f);
+ TEST(-5.0f, 4.0f);
+ TEST(-5.0f, -4.0f);
+ TEST(0.0f, 5.0f);
+ TEST(0.0f, -5.0f);
+ TEST(-0.0f, 5.0f);
+ TEST(-0.0f, -5.0f);
+ TEST(5.0f, 0.0f);
+ TEST(5.0f, -0.0f);
+ TEST(-5.0f, 0.0f);
+ TEST(-5.0f, -0.0f);
+ TEST(0.0f, 0.0f);
+ TEST(0.0f, -0.0f);
+ TEST(-0.0f, 0.0f);
+ TEST(-0.0f, -0.0f);
+ return 0;
+}
diff --git a/tests/core/test_perrar.in b/tests/core/test_perrar.in
index e15c583a..d7c9eae7 100644
--- a/tests/core/test_perrar.in
+++ b/tests/core/test_perrar.in
@@ -1,13 +1,10 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <stdio.h>
-
- int main( int argc, char** argv ){
- int retval = open( "NonExistingFile", O_RDONLY );
- if( retval == -1 )
- perror( "Cannot open NonExistingFile" );
- return 0;
- }
- \ No newline at end of file
+int main(int argc, char** argv) {
+ int retval = open("NonExistingFile", O_RDONLY);
+ if (retval == -1) perror("Cannot open NonExistingFile");
+ return 0;
+}
diff --git a/tests/core/test_phiundef.in b/tests/core/test_phiundef.in
index cf4b0f18..91273cc9 100644
--- a/tests/core/test_phiundef.in
+++ b/tests/core/test_phiundef.in
@@ -1,18 +1,17 @@
-
#include <stdlib.h>
#include <stdio.h>
static int state;
struct my_struct {
-union {
- struct {
- unsigned char a;
- unsigned char b;
- } c;
- unsigned int d;
-} e;
-unsigned int f;
+ union {
+ struct {
+ unsigned char a;
+ unsigned char b;
+ } c;
+ unsigned int d;
+ } e;
+ unsigned int f;
};
int main(int argc, char **argv) {
@@ -20,14 +19,12 @@ int main(int argc, char **argv) {
state = 0;
- for (int i=0;i<argc+10;i++)
- {
- if (state % 2 == 0)
- r.e.c.a = 3;
- else
- printf("%d\n", r.e.c.a);
- state++;
+ for (int i = 0; i < argc + 10; i++) {
+ if (state % 2 == 0)
+ r.e.c.a = 3;
+ else
+ printf("%d\n", r.e.c.a);
+ state++;
}
return 0;
}
- \ No newline at end of file
diff --git a/tests/core/test_poll.in b/tests/core/test_poll.in
index 3fb0ebc9..aa2c09ee 100644
--- a/tests/core/test_poll.in
+++ b/tests/core/test_poll.in
@@ -1,30 +1,28 @@
+#include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <poll.h>
- #include <stdio.h>
- #include <errno.h>
- #include <fcntl.h>
- #include <poll.h>
+int main() {
+ struct pollfd multi[5];
+ multi[0].fd = open("/file", O_RDONLY, 0777);
+ multi[1].fd = open("/device", O_RDONLY, 0777);
+ multi[2].fd = 123;
+ multi[3].fd = open("/file", O_RDONLY, 0777);
+ multi[4].fd = open("/file", O_RDONLY, 0777);
+ multi[0].events = POLLIN | POLLOUT | POLLNVAL | POLLERR;
+ multi[1].events = POLLIN | POLLOUT | POLLNVAL | POLLERR;
+ multi[2].events = POLLIN | POLLOUT | POLLNVAL | POLLERR;
+ multi[3].events = 0x00;
+ multi[4].events = POLLOUT | POLLNVAL | POLLERR;
- int main() {
- struct pollfd multi[5];
- multi[0].fd = open("/file", O_RDONLY, 0777);
- multi[1].fd = open("/device", O_RDONLY, 0777);
- multi[2].fd = 123;
- multi[3].fd = open("/file", O_RDONLY, 0777);
- multi[4].fd = open("/file", O_RDONLY, 0777);
- multi[0].events = POLLIN | POLLOUT | POLLNVAL | POLLERR;
- multi[1].events = POLLIN | POLLOUT | POLLNVAL | POLLERR;
- multi[2].events = POLLIN | POLLOUT | POLLNVAL | POLLERR;
- multi[3].events = 0x00;
- multi[4].events = POLLOUT | POLLNVAL | POLLERR;
+ printf("ret: %d\n", poll(multi, 5, 123));
+ printf("errno: %d\n", errno);
+ printf("multi[0].revents: %d\n", multi[0].revents == (POLLIN | POLLOUT));
+ printf("multi[1].revents: %d\n", multi[1].revents == (POLLIN | POLLOUT));
+ printf("multi[2].revents: %d\n", multi[2].revents == POLLNVAL);
+ printf("multi[3].revents: %d\n", multi[3].revents == 0);
+ printf("multi[4].revents: %d\n", multi[4].revents == POLLOUT);
- printf("ret: %d\n", poll(multi, 5, 123));
- printf("errno: %d\n", errno);
- printf("multi[0].revents: %d\n", multi[0].revents == (POLLIN | POLLOUT));
- printf("multi[1].revents: %d\n", multi[1].revents == (POLLIN | POLLOUT));
- printf("multi[2].revents: %d\n", multi[2].revents == POLLNVAL);
- printf("multi[3].revents: %d\n", multi[3].revents == 0);
- printf("multi[4].revents: %d\n", multi[4].revents == POLLOUT);
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_polymorph.in b/tests/core/test_polymorph.in
index 2faa1935..1f24a1aa 100644
--- a/tests/core/test_polymorph.in
+++ b/tests/core/test_polymorph.in
@@ -1,34 +1,33 @@
+#include <stdio.h>
+struct Pure {
+ virtual int implme() = 0;
+};
+struct Parent : Pure {
+ virtual int getit() {
+ return 11;
+ };
+ int implme() { return 32; }
+};
+struct Child : Parent {
+ int getit() { return 74; }
+ int implme() { return 1012; }
+};
- #include <stdio.h>
- struct Pure {
- virtual int implme() = 0;
- };
- struct Parent : Pure {
- virtual int getit() { return 11; };
- int implme() { return 32; }
- };
- struct Child : Parent {
- int getit() { return 74; }
- int implme() { return 1012; }
- };
+struct Other {
+ int one() { return 11; }
+ int two() { return 22; }
+};
- struct Other {
- int one() { return 11; }
- int two() { return 22; }
- };
+int main() {
+ Parent *x = new Parent();
+ Parent *y = new Child();
+ printf("*%d,%d,%d,%d*\n", x->getit(), y->getit(), x->implme(), y->implme());
- int main()
- {
- Parent *x = new Parent();
- Parent *y = new Child();
- printf("*%d,%d,%d,%d*\n", x->getit(), y->getit(), x->implme(), y->implme());
+ Other *o = new Other;
+ int (Other::*Ls)() = &Other::one;
+ printf("*%d*\n", (o->*(Ls))());
+ Ls = &Other::two;
+ printf("*%d*\n", (o->*(Ls))());
- Other *o = new Other;
- int (Other::*Ls)() = &Other::one;
- printf("*%d*\n", (o->*(Ls))());
- Ls = &Other::two;
- printf("*%d*\n", (o->*(Ls))());
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_printf_2.in b/tests/core/test_printf_2.in
index ef94aec1..8fb16173 100644
--- a/tests/core/test_printf_2.in
+++ b/tests/core/test_printf_2.in
@@ -1,17 +1,15 @@
+#include <stdio.h>
- #include <stdio.h>
+int main() {
+ char c = '1';
+ short s = 2;
+ int i = 3;
+ long long l = 4;
+ float f = 5.5;
+ double d = 6.6;
- int main() {
- char c = '1';
- short s = 2;
- int i = 3;
- long long l = 4;
- float f = 5.5;
- double d = 6.6;
+ printf("%c,%hd,%d,%lld,%.1f,%.1llf\n", c, s, i, l, f, d);
+ printf("%#x,%#x\n", 1, 0);
- printf("%c,%hd,%d,%lld,%.1f,%.1llf\n", c, s, i, l, f, d);
- printf("%#x,%#x\n", 1, 0);
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_printf_more.in b/tests/core/test_printf_more.in
index b8e3ba61..ad1cebc8 100644
--- a/tests/core/test_printf_more.in
+++ b/tests/core/test_printf_more.in
@@ -1,13 +1,11 @@
-
- #include <stdio.h>
- int main() {
- int size = snprintf(NULL, 0, "%s %d %.2f\n", "me and myself", 25, 1.345);
- char buf[size];
- snprintf(buf, size, "%s %d %.2f\n", "me and myself", 25, 1.345);
- printf("%d : %s\n", size, buf);
- char *buff = NULL;
- asprintf(&buff, "%d waka %d\n", 21, 95);
- puts(buff);
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+int main() {
+ int size = snprintf(NULL, 0, "%s %d %.2f\n", "me and myself", 25, 1.345);
+ char buf[size];
+ snprintf(buf, size, "%s %d %.2f\n", "me and myself", 25, 1.345);
+ printf("%d : %s\n", size, buf);
+ char *buff = NULL;
+ asprintf(&buff, "%d waka %d\n", 21, 95);
+ puts(buff);
+ return 0;
+}
diff --git a/tests/core/test_ptrtoint.in b/tests/core/test_ptrtoint.in
index be7214e8..88e91262 100644
--- a/tests/core/test_ptrtoint.in
+++ b/tests/core/test_ptrtoint.in
@@ -1,16 +1,14 @@
+#include <stdio.h>
- #include <stdio.h>
-
- int main( int argc, const char *argv[] ) {
- char *a = new char[10];
- char *a0 = a+0;
- char *a5 = a+5;
- int *b = new int[10];
- int *b0 = b+0;
- int *b5 = b+5;
- int c = (int)b5-(int)b0; // Emscripten should warn!
- int d = (int)b5-(int)b0; // Emscripten should warn!
- printf("*%d*\n", (int)a5-(int)a0);
- return 0;
- }
- \ No newline at end of file
+int main(int argc, const char *argv[]) {
+ char *a = new char[10];
+ char *a0 = a + 0;
+ char *a5 = a + 5;
+ int *b = new int[10];
+ int *b0 = b + 0;
+ int *b5 = b + 5;
+ int c = (int)b5 - (int)b0; // Emscripten should warn!
+ int d = (int)b5 - (int)b0; // Emscripten should warn!
+ printf("*%d*\n", (int)a5 - (int)a0);
+ return 0;
+}
diff --git a/tests/core/test_regex.in b/tests/core/test_regex.in
index a7ceb7a3..4f1bdd21 100644
--- a/tests/core/test_regex.in
+++ b/tests/core/test_regex.in
@@ -1,37 +1,36 @@
-// This is from http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Frtref%2Fregexec.htm
- #include <regex.h>
- #include <stdio.h>
- #include <stdlib.h>
+// This is from// http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Frtref%2Fregexec.htm
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
- int main(void)
- {
- regex_t preg;
- const char *string = "a very simple simple simple string";
- const char *pattern = "\\(sim[a-z]le\\) \\1";
- int rc;
- size_t nmatch = 2;
- regmatch_t pmatch[2];
+int main(void) {
+ regex_t preg;
+ const char *string = "a very simple simple simple string";
+ const char *pattern = "\\(sim[a-z]le\\) \\1";
+ int rc;
+ size_t nmatch = 2;
+ regmatch_t pmatch[2];
- if (0 != (rc = regcomp(&preg, pattern, 0))) {
- printf("regcomp() failed, returning nonzero (%d)\n", rc);
- exit(EXIT_FAILURE);
- }
+ if (0 != (rc = regcomp(&preg, pattern, 0))) {
+ printf("regcomp() failed, returning nonzero (%d)\n", rc);
+ exit(EXIT_FAILURE);
+ }
- if (0 != (rc = regexec(&preg, string, nmatch, pmatch, 0))) {
- printf("Failed to match '%s' with '%s',returning %d.\n",
- string, pattern, rc);
- }
- else {
- printf("With the whole expression, "
- "a matched substring \"%.*s\" is found at position %d to %d.\n",
- pmatch[0].rm_eo - pmatch[0].rm_so, &string[pmatch[0].rm_so],
- pmatch[0].rm_so, pmatch[0].rm_eo - 1);
- printf("With the sub-expression, "
- "a matched substring \"%.*s\" is found at position %d to %d.\n",
- pmatch[1].rm_eo - pmatch[1].rm_so, &string[pmatch[1].rm_so],
- pmatch[1].rm_so, pmatch[1].rm_eo - 1);
- }
- regfree(&preg);
- return 0;
- }
-
+ if (0 != (rc = regexec(&preg, string, nmatch, pmatch, 0))) {
+ printf("Failed to match '%s' with '%s',returning %d.\n", string, pattern,
+ rc);
+ } else {
+ printf(
+ "With the whole expression, "
+ "a matched substring \"%.*s\" is found at position %d to %d.\n",
+ pmatch[0].rm_eo - pmatch[0].rm_so, &string[pmatch[0].rm_so],
+ pmatch[0].rm_so, pmatch[0].rm_eo - 1);
+ printf(
+ "With the sub-expression, "
+ "a matched substring \"%.*s\" is found at position %d to %d.\n",
+ pmatch[1].rm_eo - pmatch[1].rm_so, &string[pmatch[1].rm_so],
+ pmatch[1].rm_so, pmatch[1].rm_eo - 1);
+ }
+ regfree(&preg);
+ return 0;
+}
diff --git a/tests/core/test_reinterpreted_ptrs.in b/tests/core/test_reinterpreted_ptrs.in
index e5e257e0..9865c61f 100644
--- a/tests/core/test_reinterpreted_ptrs.in
+++ b/tests/core/test_reinterpreted_ptrs.in
@@ -1,13 +1,13 @@
-
#include <stdio.h>
class Foo {
-private:
+ private:
float bar;
-public:
+
+ public:
int baz;
- Foo(): bar(0), baz(4711) {};
+ Foo() : bar(0), baz(4711) {};
int getBar() const;
};
@@ -16,8 +16,8 @@ int Foo::getBar() const {
return this->bar;
};
-const Foo *magic1 = reinterpret_cast<Foo*>(0xDEAD111F);
-const Foo *magic2 = reinterpret_cast<Foo*>(0xDEAD888F);
+const Foo *magic1 = reinterpret_cast<Foo *>(0xDEAD111F);
+const Foo *magic2 = reinterpret_cast<Foo *>(0xDEAD888F);
static void runTest() {
@@ -25,17 +25,16 @@ static void runTest() {
const Foo *b = a;
if (a->getBar() == 0) {
- if (a->baz == 4712)
- b = magic1;
- else
- b = magic2;
+ if (a->baz == 4712)
+ b = magic1;
+ else
+ b = magic2;
}
- printf("%s\n", (b == magic1 ? "magic1" : (b == magic2 ? "magic2" : "neither")));
+ printf("%s\n",
+ (b == magic1 ? "magic1" : (b == magic2 ? "magic2" : "neither")));
};
extern "C" {
- int main(int argc, char **argv) {
- runTest();
- }
+int main(int argc, char **argv) { runTest(); }
}
diff --git a/tests/core/test_rounding.in b/tests/core/test_rounding.in
index 63960ac4..af7d9099 100644
--- a/tests/core/test_rounding.in
+++ b/tests/core/test_rounding.in
@@ -1,29 +1,26 @@
+#include <stdio.h>
+#include <math.h>
- #include <stdio.h>
- #include <math.h>
+int main() {
+ printf("%.1f ", round(1.4));
+ printf("%.1f ", round(1.6));
+ printf("%.1f ", round(-1.4));
+ printf("%.1f ", round(-1.6));
- int main()
- {
- printf("%.1f ", round(1.4));
- printf("%.1f ", round(1.6));
- printf("%.1f ", round(-1.4));
- printf("%.1f ", round(-1.6));
+ printf("%.1f ", round(1.5));
+ printf("%.1f ", round(2.5));
+ printf("%.1f ", round(-1.5));
+ printf("%.1f ", round(-2.5));
- printf("%.1f ", round(1.5));
- printf("%.1f ", round(2.5));
- printf("%.1f ", round(-1.5));
- printf("%.1f ", round(-2.5));
+ printf("%ld ", lrint(1.4));
+ printf("%ld ", lrint(1.6));
+ printf("%ld ", lrint(-1.4));
+ printf("%ld ", lrint(-1.6));
- printf("%ld ", lrint(1.4));
- printf("%ld ", lrint(1.6));
- printf("%ld ", lrint(-1.4));
- printf("%ld ", lrint(-1.6));
+ printf("%ld ", lrint(1.5));
+ printf("%ld ", lrint(2.5));
+ printf("%ld ", lrint(-1.5));
+ printf("%ld ", lrint(-2.5));
- printf("%ld ", lrint(1.5));
- printf("%ld ", lrint(2.5));
- printf("%ld ", lrint(-1.5));
- printf("%ld ", lrint(-2.5));
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_simd.in b/tests/core/test_simd.in
index 978ea96a..5018b8e3 100644
--- a/tests/core/test_simd.in
+++ b/tests/core/test_simd.in
@@ -1,61 +1,69 @@
-
#include <stdio.h>
#include <emscripten/vector.h>
static inline float32x4 __attribute__((always_inline))
-_mm_set_ps(const float __Z, const float __Y, const float __X, const float __W)
-{
- return (float32x4){ __W, __X, __Y, __Z };
+ _mm_set_ps(const float __Z, const float __Y, const float __X,
+ const float __W) {
+ return (float32x4) {__W, __X, __Y, __Z};
}
static __inline__ float32x4 __attribute__((__always_inline__))
-_mm_setzero_ps(void)
-{
- return (float32x4){ 0.0, 0.0, 0.0, 0.0 };
+ _mm_setzero_ps(void) {
+ return (float32x4) {0.0, 0.0, 0.0, 0.0};
}
int main(int argc, char **argv) {
float data[8];
- for (int i = 0; i < 32; i++) data[i] = (1+i+argc)*(2+i+argc*argc); // confuse optimizer
+ for (int i = 0; i < 32; i++)
+ data[i] = (1 + i + argc) * (2 + i + argc * argc); // confuse optimizer
{
- float32x4 *a = (float32x4*)&data[0];
- float32x4 *b = (float32x4*)&data[4];
+ float32x4 *a = (float32x4 *)&data[0];
+ float32x4 *b = (float32x4 *)&data[4];
float32x4 c, d;
c = *a;
d = *b;
- printf("1floats! %d, %d, %d, %d %d, %d, %d, %d\n", (int)c[0], (int)c[1], (int)c[2], (int)c[3], (int)d[0], (int)d[1], (int)d[2], (int)d[3]);
- c = c+d;
- printf("2floats! %d, %d, %d, %d %d, %d, %d, %d\n", (int)c[0], (int)c[1], (int)c[2], (int)c[3], (int)d[0], (int)d[1], (int)d[2], (int)d[3]);
- d = c*d;
- printf("3floats! %d, %d, %d, %d %d, %d, %d, %d\n", (int)c[0], (int)c[1], (int)c[2], (int)c[3], (int)d[0], (int)d[1], (int)d[2], (int)d[3]);
+ printf("1floats! %d, %d, %d, %d %d, %d, %d, %d\n", (int)c[0], (int)c[1],
+ (int)c[2], (int)c[3], (int)d[0], (int)d[1], (int)d[2], (int)d[3]);
+ c = c + d;
+ printf("2floats! %d, %d, %d, %d %d, %d, %d, %d\n", (int)c[0], (int)c[1],
+ (int)c[2], (int)c[3], (int)d[0], (int)d[1], (int)d[2], (int)d[3]);
+ d = c * d;
+ printf("3floats! %d, %d, %d, %d %d, %d, %d, %d\n", (int)c[0], (int)c[1],
+ (int)c[2], (int)c[3], (int)d[0], (int)d[1], (int)d[2], (int)d[3]);
c = _mm_setzero_ps();
- printf("zeros %d, %d, %d, %d\n", (int)c[0], (int)c[1], (int)c[2], (int)c[3]);
+ printf("zeros %d, %d, %d, %d\n", (int)c[0], (int)c[1], (int)c[2],
+ (int)c[3]);
}
{
- int32x4 *a = (int32x4*)&data[0];
- int32x4 *b = (int32x4*)&data[4];
+ int32x4 *a = (int32x4 *)&data[0];
+ int32x4 *b = (int32x4 *)&data[4];
int32x4 c, d, e, f;
c = *a;
d = *b;
- printf("4ints! %d, %d, %d, %d %d, %d, %d, %d\n", c[0], c[1], c[2], c[3], d[0], d[1], d[2], d[3]);
- e = c+d;
- f = c-d;
- printf("5ints! %d, %d, %d, %d %d, %d, %d, %d\n", e[0], e[1], e[2], e[3], f[0], f[1], f[2], f[3]);
- e = c&d;
- f = c|d;
- e = ~c&d;
- f = c^d;
- printf("5intops! %d, %d, %d, %d %d, %d, %d, %d\n", e[0], e[1], e[2], e[3], f[0], f[1], f[2], f[3]);
+ printf("4ints! %d, %d, %d, %d %d, %d, %d, %d\n", c[0], c[1], c[2], c[3],
+ d[0], d[1], d[2], d[3]);
+ e = c + d;
+ f = c - d;
+ printf("5ints! %d, %d, %d, %d %d, %d, %d, %d\n", e[0], e[1], e[2], e[3],
+ f[0], f[1], f[2], f[3]);
+ e = c & d;
+ f = c | d;
+ e = ~c & d;
+ f = c ^ d;
+ printf("5intops! %d, %d, %d, %d %d, %d, %d, %d\n", e[0], e[1], e[2], e[3],
+ f[0], f[1], f[2], f[3]);
}
{
float32x4 c, d, e, f;
c = _mm_set_ps(9.0, 4.0, 0, -9.0);
d = _mm_set_ps(10.0, 14.0, -12, -2.0);
- printf("6floats! %d, %d, %d, %d %d, %d, %d, %d\n", (int)c[0], (int)c[1], (int)c[2], (int)c[3], (int)d[0], (int)d[1], (int)d[2], (int)d[3]);
- printf("7calcs: %d\n", emscripten_float32x4_signmask(c)); // TODO: just not just compilation but output as well
+ printf("6floats! %d, %d, %d, %d %d, %d, %d, %d\n", (int)c[0], (int)c[1],
+ (int)c[2], (int)c[3], (int)d[0], (int)d[1], (int)d[2], (int)d[3]);
+ printf("7calcs: %d\n",
+ emscripten_float32x4_signmask(c)); // TODO: just not just
+ // compilation but output as well
}
return 0;
}
- \ No newline at end of file
diff --git a/tests/core/test_simd2.in b/tests/core/test_simd2.in
index 97b1d841..be1655c2 100644
--- a/tests/core/test_simd2.in
+++ b/tests/core/test_simd2.in
@@ -1,39 +1,35 @@
+#include <stdio.h>
- #include <stdio.h>
-
- typedef float __m128 __attribute__ ((__vector_size__ (16)));
-
- static inline __m128 __attribute__((always_inline))
- _mm_set_ps(const float __Z, const float __Y, const float __X, const float __W)
- {
- return (__m128){ __W, __X, __Y, __Z };
- }
-
- static inline void __attribute__((always_inline))
- _mm_store_ps(float *__P, __m128 __A)
- {
- *(__m128 *)__P = __A;
- }
-
- static inline __m128 __attribute__((always_inline))
- _mm_add_ps(__m128 __A, __m128 __B)
- {
- return __A + __B;
- }
-
- using namespace std;
-
- int main(int argc, char ** argv) {
- float __attribute__((__aligned__(16))) ar[4];
- __m128 v1 = _mm_set_ps(9.0, 4.0, 0, -9.0);
- __m128 v2 = _mm_set_ps(7.0, 3.0, 2.5, 1.0);
- __m128 v3 = _mm_add_ps(v1, v2);
- _mm_store_ps(ar, v3);
-
- for (int i = 0; i < 4; i++) {
- printf("%f\n", ar[i]);
- }
-
- return 0;
- }
- \ No newline at end of file
+typedef float __m128 __attribute__((__vector_size__(16)));
+
+static inline __m128 __attribute__((always_inline))
+ _mm_set_ps(const float __Z, const float __Y, const float __X,
+ const float __W) {
+ return (__m128) {__W, __X, __Y, __Z};
+}
+
+static inline void __attribute__((always_inline))
+ _mm_store_ps(float *__P, __m128 __A) {
+ *(__m128 *)__P = __A;
+}
+
+static inline __m128 __attribute__((always_inline))
+ _mm_add_ps(__m128 __A, __m128 __B) {
+ return __A + __B;
+}
+
+using namespace std;
+
+int main(int argc, char **argv) {
+ float __attribute__((__aligned__(16))) ar[4];
+ __m128 v1 = _mm_set_ps(9.0, 4.0, 0, -9.0);
+ __m128 v2 = _mm_set_ps(7.0, 3.0, 2.5, 1.0);
+ __m128 v3 = _mm_add_ps(v1, v2);
+ _mm_store_ps(ar, v3);
+
+ for (int i = 0; i < 4; i++) {
+ printf("%f\n", ar[i]);
+ }
+
+ return 0;
+}
diff --git a/tests/core/test_simd3.in b/tests/core/test_simd3.in
index 462370e7..f005d847 100644
--- a/tests/core/test_simd3.in
+++ b/tests/core/test_simd3.in
@@ -1,471 +1,488 @@
-
- #include <iostream>
- #include <emmintrin.h>
- #include <assert.h>
- #include <stdint.h>
- #include <bitset>
-
- using namespace std;
-
- void testSetPs() {
- float __attribute__((__aligned__(16))) ar[4];
- __m128 v = _mm_set_ps(1.0, 2.0, 3.0, 4.0);
- _mm_store_ps(ar, v);
- assert(ar[0] == 4.0);
- assert(ar[1] == 3.0);
- assert(ar[2] == 2.0);
- assert(ar[3] == 1.0);
- }
-
- void testSet1Ps() {
- float __attribute__((__aligned__(16))) ar[4];
- __m128 v = _mm_set1_ps(5.5);
- _mm_store_ps(ar, v);
- assert(ar[0] == 5.5);
- assert(ar[1] == 5.5);
- assert(ar[2] == 5.5);
- assert(ar[3] == 5.5);
- }
-
- void testSetZeroPs() {
- float __attribute__((__aligned__(16))) ar[4];
- __m128 v = _mm_setzero_ps();
- _mm_store_ps(ar, v);
- assert(ar[0] == 0);
- assert(ar[1] == 0);
- assert(ar[2] == 0);
- assert(ar[3] == 0);
- }
-
- void testSetEpi32() {
- int32_t __attribute__((__aligned__(16))) ar[4];
- __m128i v = _mm_set_epi32(5, 7, 126, 381);
- _mm_store_si128((__m128i *)ar, v);
- assert(ar[0] == 381);
- assert(ar[1] == 126);
- assert(ar[2] == 7);
- assert(ar[3] == 5);
- v = _mm_set_epi32(0x55555555, 0xaaaaaaaa, 0xffffffff, 0x12345678);
- _mm_store_si128((__m128i *)ar, v);
- assert(ar[0] == 0x12345678);
- assert(ar[1] == 0xffffffff);
- assert(ar[2] == 0xaaaaaaaa);
- assert(ar[3] == 0x55555555);
- }
-
- void testSet1Epi32() {
- int32_t __attribute__((__aligned__(16))) ar[4];
- __m128i v = _mm_set1_epi32(-5);
- _mm_store_si128((__m128i *)ar, v);
- assert(ar[0] == -5);
- assert(ar[1] == -5);
- assert(ar[2] == -5);
- assert(ar[3] == -5);
- }
-
- void testSetZeroSi128() {
- int32_t __attribute__((__aligned__(16))) ar[4];
- __m128i v = _mm_setzero_si128();
- _mm_store_si128((__m128i *)ar, v);
- assert(ar[0] == 0);
- assert(ar[1] == 0);
- assert(ar[2] == 0);
- assert(ar[3] == 0);
- }
-
- void testBitCasts() {
- int32_t __attribute__((__aligned__(16))) ar1[4];
- float __attribute__((__aligned__(16))) ar2[4];
- __m128i v1 = _mm_set_epi32(0x3f800000, 0x40000000, 0x40400000, 0x40800000);
- __m128 v2 = _mm_castsi128_ps(v1);
- _mm_store_ps(ar2, v2);
- assert(ar2[0] == 4.0);
- assert(ar2[1] == 3.0);
- assert(ar2[2] == 2.0);
- assert(ar2[3] == 1.0);
- v2 = _mm_set_ps(5.0, 6.0, 7.0, 8.0);
- v1 = _mm_castps_si128(v2);
- _mm_store_si128((__m128i *)ar1, v1);
- assert(ar1[0] == 0x41000000);
- assert(ar1[1] == 0x40e00000);
- assert(ar1[2] == 0x40c00000);
- assert(ar1[3] == 0x40a00000);
- float w = 0;
- float z = -278.3;
- float y = 5.2;
- float x = -987654321;
- v1 = _mm_castps_si128(_mm_set_ps(w, z, y, x));
- _mm_store_ps(ar2, _mm_castsi128_ps(v1));
- assert(ar2[0] == x);
- assert(ar2[1] == y);
- assert(ar2[2] == z);
- assert(ar2[3] == w);
- /*
- std::bitset<sizeof(float)*CHAR_BIT> bits1x(*reinterpret_cast<unsigned long*>(&(ar2[0])));
- std::bitset<sizeof(float)*CHAR_BIT> bits1y(*reinterpret_cast<unsigned long*>(&(ar2[1])));
- std::bitset<sizeof(float)*CHAR_BIT> bits1z(*reinterpret_cast<unsigned long*>(&(ar2[2])));
- std::bitset<sizeof(float)*CHAR_BIT> bits1w(*reinterpret_cast<unsigned long*>(&(ar2[3])));
- std::bitset<sizeof(float)*CHAR_BIT> bits2x(*reinterpret_cast<unsigned long*>(&x));
- std::bitset<sizeof(float)*CHAR_BIT> bits2y(*reinterpret_cast<unsigned long*>(&y));
- std::bitset<sizeof(float)*CHAR_BIT> bits2z(*reinterpret_cast<unsigned long*>(&z));
- std::bitset<sizeof(float)*CHAR_BIT> bits2w(*reinterpret_cast<unsigned long*>(&w));
- assert(bits1x == bits2x);
- assert(bits1y == bits2y);
- assert(bits1z == bits2z);
- assert(bits1w == bits2w);
- */
- v2 = _mm_castsi128_ps(_mm_set_epi32(0xffffffff, 0, 0x5555cccc, 0xaaaaaaaa));
- _mm_store_si128((__m128i *)ar1, _mm_castps_si128(v2));
- assert(ar1[0] == 0xaaaaaaaa);
- assert(ar1[1] == 0x5555cccc);
- assert(ar1[2] == 0);
- assert(ar1[3] == 0xffffffff);
- }
-
- void testConversions() {
- int32_t __attribute__((__aligned__(16))) ar1[4];
- float __attribute__((__aligned__(16))) ar2[4];
- __m128i v1 = _mm_set_epi32(0, -3, -517, 256);
- __m128 v2 = _mm_cvtepi32_ps(v1);
- _mm_store_ps(ar2, v2);
- assert(ar2[0] == 256.0);
- assert(ar2[1] == -517.0);
- assert(ar2[2] == -3.0);
- assert(ar2[3] == 0);
- v2 = _mm_set_ps(5.0, 6.0, 7.45, -8.0);
- v1 = _mm_cvtps_epi32(v2);
- _mm_store_si128((__m128i *)ar1, v1);
- assert(ar1[0] == -8);
- assert(ar1[1] == 7);
- assert(ar1[2] == 6);
- assert(ar1[3] == 5);
- }
-
- void testMoveMaskPs() {
- __m128 v = _mm_castsi128_ps(_mm_set_epi32(0xffffffff, 0xffffffff, 0, 0xffffffff));
- int mask = _mm_movemask_ps(v);
- assert(mask == 13);
- }
-
- void testAddPs() {
- float __attribute__((__aligned__(16))) ar[4];
- __m128 v1 = _mm_set_ps(4.0, 3.0, 2.0, 1.0);
- __m128 v2 = _mm_set_ps(10.0, 20.0, 30.0, 40.0);
- __m128 v = _mm_add_ps(v1, v2);
- _mm_store_ps(ar, v);
- assert(ar[0] == 41.0);
- assert(ar[1] == 32.0);
- assert(ar[2] == 23.0);
- assert(ar[3] == 14.0);
- }
-
- void testSubPs() {
- float __attribute__((__aligned__(16))) ar[4];
- __m128 v1 = _mm_set_ps(4.0, 3.0, 2.0, 1.0);
- __m128 v2 = _mm_set_ps(10.0, 20.0, 30.0, 40.0);
- __m128 v = _mm_sub_ps(v1, v2);
- _mm_store_ps(ar, v);
- assert(ar[0] == -39.0);
- assert(ar[1] == -28.0);
- assert(ar[2] == -17.0);
- assert(ar[3] == -6.0);
- }
-
- void testMulPs() {
- float __attribute__((__aligned__(16))) ar[4];
- __m128 v1 = _mm_set_ps(4.0, 3.0, 2.0, 1.0);
- __m128 v2 = _mm_set_ps(10.0, 20.0, 30.0, 40.0);
- __m128 v = _mm_mul_ps(v1, v2);
- _mm_store_ps(ar, v);
- assert(ar[0] == 40.0);
- assert(ar[1] == 60.0);
- assert(ar[2] == 60.0);
- assert(ar[3] == 40.0);
- }
-
- void testDivPs() {
- float __attribute__((__aligned__(16))) ar[4];
- __m128 v1 = _mm_set_ps(4.0, 9.0, 8.0, 1.0);
- __m128 v2 = _mm_set_ps(2.0, 3.0, 1.0, 0.5);
- __m128 v = _mm_div_ps(v1, v2);
- _mm_store_ps(ar, v);
- assert(ar[0] == 2.0);
- assert(ar[1] == 8.0);
- assert(ar[2] == 3.0);
- assert(ar[3] == 2.0);
- }
-
- void testMinPs() {
- float __attribute__((__aligned__(16))) ar[4];
- __m128 v1 = _mm_set_ps(-20.0, 10.0, 30.0, 0.5);
- __m128 v2 = _mm_set_ps(2.0, 1.0, 50.0, 0.0);
- __m128 v = _mm_min_ps(v1, v2);
- _mm_store_ps(ar, v);
- assert(ar[0] == 0.0);
- assert(ar[1] == 30.0);
- assert(ar[2] == 1.0);
- assert(ar[3] == -20.0);
- }
-
- void testMaxPs() {
- float __attribute__((__aligned__(16))) ar[4];
- __m128 v1 = _mm_set_ps(-20.0, 10.0, 30.0, 0.5);
- __m128 v2 = _mm_set_ps(2.5, 5.0, 55.0, 1.0);
- __m128 v = _mm_max_ps(v1, v2);
- _mm_store_ps(ar, v);
- assert(ar[0] == 1.0);
- assert(ar[1] == 55.0);
- assert(ar[2] == 10.0);
- assert(ar[3] == 2.5);
- }
-
- void testSqrtPs() {
- float __attribute__((__aligned__(16))) ar[4];
- __m128 v1 = _mm_set_ps(16.0, 9.0, 4.0, 1.0);
- __m128 v = _mm_sqrt_ps(v1);
- _mm_store_ps(ar, v);
- assert(ar[0] == 1.0);
- assert(ar[1] == 2.0);
- assert(ar[2] == 3.0);
- assert(ar[3] == 4.0);
- }
-
- void testCmpLtPs() {
- int32_t __attribute__((__aligned__(16))) ar[4];
- __m128 v1 = _mm_set_ps(1.0, 2.0, 0.1, 0.001);
- __m128 v2 = _mm_set_ps(2.0, 2.0, 0.001, 0.1);
- __m128 v = _mm_cmplt_ps(v1, v2);
- _mm_store_si128((__m128i *)ar, _mm_castps_si128(v));
- assert(ar[0] == 0xffffffff);
- assert(ar[1] == 0);
- assert(ar[2] == 0);
- assert(ar[3] == 0xffffffff);
- assert(_mm_movemask_ps(v) == 9);
- }
-
- void testCmpLePs() {
- int32_t __attribute__((__aligned__(16))) ar[4];
- __m128 v1 = _mm_set_ps(1.0, 2.0, 0.1, 0.001);
- __m128 v2 = _mm_set_ps(2.0, 2.0, 0.001, 0.1);
- __m128 v = _mm_cmple_ps(v1, v2);
- _mm_store_si128((__m128i *)ar, _mm_castps_si128(v));
- assert(ar[0] == 0xffffffff);
- assert(ar[1] == 0);
- assert(ar[2] == 0xffffffff);
- assert(ar[3] == 0xffffffff);
- assert(_mm_movemask_ps(v) == 13);
- }
-
- void testCmpEqPs() {
- int32_t __attribute__((__aligned__(16))) ar[4];
- __m128 v1 = _mm_set_ps(1.0, 2.0, 0.1, 0.001);
- __m128 v2 = _mm_set_ps(2.0, 2.0, 0.001, 0.1);
- __m128 v = _mm_cmpeq_ps(v1, v2);
- _mm_store_si128((__m128i *)ar, _mm_castps_si128(v));
- assert(ar[0] == 0);
- assert(ar[1] == 0);
- assert(ar[2] == 0xffffffff);
- assert(ar[3] == 0);
- assert(_mm_movemask_ps(v) == 4);
- }
-
- void testCmpGePs() {
- int32_t __attribute__((__aligned__(16))) ar[4];
- __m128 v1 = _mm_set_ps(1.0, 2.0, 0.1, 0.001);
- __m128 v2 = _mm_set_ps(2.0, 2.0, 0.001, 0.1);
- __m128 v = _mm_cmpge_ps(v1, v2);
- _mm_store_si128((__m128i *)ar, _mm_castps_si128(v));
- assert(ar[0] == 0);
- assert(ar[1] == 0xffffffff);
- assert(ar[2] == 0xffffffff);
- assert(ar[3] == 0);
- assert(_mm_movemask_ps(v) == 6);
- }
-
- void testCmpGtPs() {
- int32_t __attribute__((__aligned__(16))) ar[4];
- __m128 v1 = _mm_set_ps(1.0, 2.0, 0.1, 0.001);
- __m128 v2 = _mm_set_ps(2.0, 2.0, 0.001, 0.1);
- __m128 v = _mm_cmpgt_ps(v1, v2);
- _mm_store_si128((__m128i *)ar, _mm_castps_si128(v));
- assert(ar[0] == 0);
- assert(ar[1] == 0xffffffff);
- assert(ar[2] == 0);
- assert(ar[3] == 0);
- assert(_mm_movemask_ps(v) == 2);
- }
-
- void testAndPs() {
- float __attribute__((__aligned__(16))) ar[4];
- __m128 v1 = _mm_set_ps(425, -501, -32, 68);
- __m128 v2 = _mm_castsi128_ps(_mm_set_epi32(0xffffffff, 0xffffffff, 0, 0xffffffff));
- __m128 v = _mm_and_ps(v1, v2);
- _mm_store_ps(ar, v);
- assert(ar[0] == 68);
- assert(ar[1] == 0);
- assert(ar[2] == -501);
- assert(ar[3] == 425);
- int32_t __attribute__((__aligned__(16))) ar2[4];
- v1 = _mm_castsi128_ps(_mm_set_epi32(0xaaaaaaaa, 0xaaaaaaaa, -1431655766, 0xaaaaaaaa));
- v2 = _mm_castsi128_ps(_mm_set_epi32(0x55555555, 0x55555555, 0x55555555, 0x55555555));
- v = _mm_and_ps(v1, v2);
- _mm_store_si128((__m128i *)ar2, _mm_castps_si128(v));
- assert(ar2[0] == 0);
- assert(ar2[1] == 0);
- assert(ar2[2] == 0);
- assert(ar2[3] == 0);
- }
-
- void testAndNotPs() {
- float __attribute__((__aligned__(16))) ar[4];
- __m128 v1 = _mm_set_ps(425, -501, -32, 68);
- __m128 v2 = _mm_castsi128_ps(_mm_set_epi32(0xffffffff, 0xffffffff, 0, 0xffffffff));
- __m128 v = _mm_andnot_ps(v2, v1);
- _mm_store_ps(ar, v);
- assert(ar[0] == 0);
- assert(ar[1] == -32);
- assert(ar[2] == 0);
- assert(ar[3] == 0);
- int32_t __attribute__((__aligned__(16))) ar2[4];
- v1 = _mm_castsi128_ps(_mm_set_epi32(0xaaaaaaaa, 0xaaaaaaaa, -1431655766, 0xaaaaaaaa));
- v2 = _mm_castsi128_ps(_mm_set_epi32(0x55555555, 0x55555555, 0x55555555, 0x55555555));
- v = _mm_andnot_ps(v1, v2);
- _mm_store_si128((__m128i *)ar2, _mm_castps_si128(v));
- assert(ar2[0] == 0x55555555);
- assert(ar2[1] == 0x55555555);
- assert(ar2[2] == 0x55555555);
- assert(ar2[3] == 0x55555555);
- }
-
- void testOrPs() {
- int32_t __attribute__((__aligned__(16))) ar[4];
- __m128 v1 = _mm_castsi128_ps(_mm_set_epi32(0xaaaaaaaa, 0xaaaaaaaa, 0xffffffff, 0));
- __m128 v2 = _mm_castsi128_ps(_mm_set_epi32(0x55555555, 0x55555555, 0x55555555, 0x55555555));
- __m128 v = _mm_or_ps(v1, v2);
- _mm_store_si128((__m128i *)ar, _mm_castps_si128(v));
- assert(ar[0] == 0x55555555);
- assert(ar[1] == 0xffffffff);
- assert(ar[2] == 0xffffffff);
- assert(ar[3] == 0xffffffff);
- }
-
- void testXorPs() {
- int32_t __attribute__((__aligned__(16))) ar[4];
- __m128 v1 = _mm_castsi128_ps(_mm_set_epi32(0xaaaaaaaa, 0xaaaaaaaa, 0xffffffff, 0));
- __m128 v2 = _mm_castsi128_ps(_mm_set_epi32(0x55555555, 0x55555555, 0x55555555, 0x55555555));
- __m128 v = _mm_xor_ps(v1, v2);
- _mm_store_si128((__m128i *)ar, _mm_castps_si128(v));
- assert(ar[0] == 0x55555555);
- assert(ar[1] == 0xaaaaaaaa);
- assert(ar[2] == 0xffffffff);
- assert(ar[3] == 0xffffffff);
- }
-
- void testAndSi128() {
- int32_t __attribute__((__aligned__(16))) ar[4];
- __m128i v1 = _mm_set_epi32(0xaaaaaaaa, 0xaaaaaaaa, -1431655766, 0xaaaaaaaa);
- __m128i v2 = _mm_set_epi32(0x55555555, 0x55555555, 0x55555555, 0x55555555);
- __m128i v = _mm_and_si128(v1, v2);
- _mm_store_si128((__m128i *)ar, v);
- assert(ar[0] == 0);
- assert(ar[1] == 0);
- assert(ar[2] == 0);
- assert(ar[3] == 0);
- }
-
- void testAndNotSi128() {
- int32_t __attribute__((__aligned__(16))) ar[4];
- __m128i v1 = _mm_set_epi32(0xaaaaaaaa, 0xaaaaaaaa, -1431655766, 0xaaaaaaaa);
- __m128i v2 = _mm_set_epi32(0x55555555, 0x55555555, 0x55555555, 0x55555555);
- __m128i v = _mm_andnot_si128(v1, v2);
- _mm_store_si128((__m128i *)ar, v);
- assert(ar[0] == 0x55555555);
- assert(ar[1] == 0x55555555);
- assert(ar[2] == 0x55555555);
- assert(ar[3] == 0x55555555);
- }
-
- void testOrSi128() {
- int32_t __attribute__((__aligned__(16))) ar[4];
- __m128i v1 = _mm_set_epi32(0xaaaaaaaa, 0xaaaaaaaa, 0xffffffff, 0);
- __m128i v2 = _mm_set_epi32(0x55555555, 0x55555555, 0x55555555, 0x55555555);
- __m128i v = _mm_or_si128(v1, v2);
- _mm_store_si128((__m128i *)ar, v);
- assert(ar[0] == 0x55555555);
- assert(ar[1] == 0xffffffff);
- assert(ar[2] == 0xffffffff);
- assert(ar[3] == 0xffffffff);
- }
-
- void testXorSi128() {
- int32_t __attribute__((__aligned__(16))) ar[4];
- __m128i v1 = _mm_set_epi32(0xaaaaaaaa, 0xaaaaaaaa, 0xffffffff, 0);
- __m128i v2 = _mm_set_epi32(0x55555555, 0x55555555, 0x55555555, 0x55555555);
- __m128i v = _mm_xor_si128(v1, v2);
- _mm_store_si128((__m128i *)ar, v);
- assert(ar[0] == 0x55555555);
- assert(ar[1] == 0xaaaaaaaa);
- assert(ar[2] == 0xffffffff);
- assert(ar[3] == 0xffffffff);
- }
-
- void testAddEpi32() {
- int32_t __attribute__((__aligned__(16))) ar[4];
- __m128i v1 = _mm_set_epi32(4, 3, 2, 1);
- __m128i v2 = _mm_set_epi32(10, 20, 30, 40);
- __m128i v = _mm_add_epi32(v1, v2);
- _mm_store_si128((__m128i *)ar, v);
- assert(ar[0] == 41);
- assert(ar[1] == 32);
- assert(ar[2] == 23);
- assert(ar[3] == 14);
- }
-
- void testSubEpi32() {
- int32_t __attribute__((__aligned__(16))) ar[4];
- __m128i v1 = _mm_set_epi32(4, 3, 2, 1);
- __m128i v2 = _mm_set_epi32(10, 20, 30, 40);
- __m128i v = _mm_sub_epi32(v1, v2);
- _mm_store_si128((__m128i *)ar, v);
- assert(ar[0] == -39);
- assert(ar[1] == -28);
- assert(ar[2] == -17);
- assert(ar[3] == -6);
- }
-
- int main(int argc, char ** argv) {
- testSetPs();
- testSet1Ps();
- testSetZeroPs();
- testSetEpi32();
- testSet1Epi32();
- testSetZeroSi128();
- testBitCasts();
- testConversions();
- testMoveMaskPs();
- testAddPs();
- testSubPs();
- testMulPs();
- testDivPs();
- testMaxPs();
- testMinPs();
- testSqrtPs();
- testCmpLtPs();
- testCmpLePs();
- testCmpEqPs();
- testCmpGePs();
- testCmpGtPs();
- testAndPs();
- testAndNotPs();
- testOrPs();
- testXorPs();
- testAndSi128();
- testAndNotSi128();
- testOrSi128();
- testXorSi128();
- testAddEpi32();
- testSubEpi32();
- printf("DONE");
- return 0;
- }
- \ No newline at end of file
+#include <iostream>
+#include <emmintrin.h>
+#include <assert.h>
+#include <stdint.h>
+#include <bitset>
+
+using namespace std;
+
+void testSetPs() {
+ float __attribute__((__aligned__(16))) ar[4];
+ __m128 v = _mm_set_ps(1.0, 2.0, 3.0, 4.0);
+ _mm_store_ps(ar, v);
+ assert(ar[0] == 4.0);
+ assert(ar[1] == 3.0);
+ assert(ar[2] == 2.0);
+ assert(ar[3] == 1.0);
+}
+
+void testSet1Ps() {
+ float __attribute__((__aligned__(16))) ar[4];
+ __m128 v = _mm_set1_ps(5.5);
+ _mm_store_ps(ar, v);
+ assert(ar[0] == 5.5);
+ assert(ar[1] == 5.5);
+ assert(ar[2] == 5.5);
+ assert(ar[3] == 5.5);
+}
+
+void testSetZeroPs() {
+ float __attribute__((__aligned__(16))) ar[4];
+ __m128 v = _mm_setzero_ps();
+ _mm_store_ps(ar, v);
+ assert(ar[0] == 0);
+ assert(ar[1] == 0);
+ assert(ar[2] == 0);
+ assert(ar[3] == 0);
+}
+
+void testSetEpi32() {
+ int32_t __attribute__((__aligned__(16))) ar[4];
+ __m128i v = _mm_set_epi32(5, 7, 126, 381);
+ _mm_store_si128((__m128i *)ar, v);
+ assert(ar[0] == 381);
+ assert(ar[1] == 126);
+ assert(ar[2] == 7);
+ assert(ar[3] == 5);
+ v = _mm_set_epi32(0x55555555, 0xaaaaaaaa, 0xffffffff, 0x12345678);
+ _mm_store_si128((__m128i *)ar, v);
+ assert(ar[0] == 0x12345678);
+ assert(ar[1] == 0xffffffff);
+ assert(ar[2] == 0xaaaaaaaa);
+ assert(ar[3] == 0x55555555);
+}
+
+void testSet1Epi32() {
+ int32_t __attribute__((__aligned__(16))) ar[4];
+ __m128i v = _mm_set1_epi32(-5);
+ _mm_store_si128((__m128i *)ar, v);
+ assert(ar[0] == -5);
+ assert(ar[1] == -5);
+ assert(ar[2] == -5);
+ assert(ar[3] == -5);
+}
+
+void testSetZeroSi128() {
+ int32_t __attribute__((__aligned__(16))) ar[4];
+ __m128i v = _mm_setzero_si128();
+ _mm_store_si128((__m128i *)ar, v);
+ assert(ar[0] == 0);
+ assert(ar[1] == 0);
+ assert(ar[2] == 0);
+ assert(ar[3] == 0);
+}
+
+void testBitCasts() {
+ int32_t __attribute__((__aligned__(16))) ar1[4];
+ float __attribute__((__aligned__(16))) ar2[4];
+ __m128i v1 = _mm_set_epi32(0x3f800000, 0x40000000, 0x40400000, 0x40800000);
+ __m128 v2 = _mm_castsi128_ps(v1);
+ _mm_store_ps(ar2, v2);
+ assert(ar2[0] == 4.0);
+ assert(ar2[1] == 3.0);
+ assert(ar2[2] == 2.0);
+ assert(ar2[3] == 1.0);
+ v2 = _mm_set_ps(5.0, 6.0, 7.0, 8.0);
+ v1 = _mm_castps_si128(v2);
+ _mm_store_si128((__m128i *)ar1, v1);
+ assert(ar1[0] == 0x41000000);
+ assert(ar1[1] == 0x40e00000);
+ assert(ar1[2] == 0x40c00000);
+ assert(ar1[3] == 0x40a00000);
+ float w = 0;
+ float z = -278.3;
+ float y = 5.2;
+ float x = -987654321;
+ v1 = _mm_castps_si128(_mm_set_ps(w, z, y, x));
+ _mm_store_ps(ar2, _mm_castsi128_ps(v1));
+ assert(ar2[0] == x);
+ assert(ar2[1] == y);
+ assert(ar2[2] == z);
+ assert(ar2[3] == w);
+ /*
+ std::bitset<sizeof(float)*CHAR_BIT> bits1x(*reinterpret_cast<unsigned
+ long*>(&(ar2[0])));
+ std::bitset<sizeof(float)*CHAR_BIT> bits1y(*reinterpret_cast<unsigned
+ long*>(&(ar2[1])));
+ std::bitset<sizeof(float)*CHAR_BIT> bits1z(*reinterpret_cast<unsigned
+ long*>(&(ar2[2])));
+ std::bitset<sizeof(float)*CHAR_BIT> bits1w(*reinterpret_cast<unsigned
+ long*>(&(ar2[3])));
+ std::bitset<sizeof(float)*CHAR_BIT> bits2x(*reinterpret_cast<unsigned
+ long*>(&x));
+ std::bitset<sizeof(float)*CHAR_BIT> bits2y(*reinterpret_cast<unsigned
+ long*>(&y));
+ std::bitset<sizeof(float)*CHAR_BIT> bits2z(*reinterpret_cast<unsigned
+ long*>(&z));
+ std::bitset<sizeof(float)*CHAR_BIT> bits2w(*reinterpret_cast<unsigned
+ long*>(&w));
+ assert(bits1x == bits2x);
+ assert(bits1y == bits2y);
+ assert(bits1z == bits2z);
+ assert(bits1w == bits2w);
+ */
+ v2 = _mm_castsi128_ps(_mm_set_epi32(0xffffffff, 0, 0x5555cccc, 0xaaaaaaaa));
+ _mm_store_si128((__m128i *)ar1, _mm_castps_si128(v2));
+ assert(ar1[0] == 0xaaaaaaaa);
+ assert(ar1[1] == 0x5555cccc);
+ assert(ar1[2] == 0);
+ assert(ar1[3] == 0xffffffff);
+}
+
+void testConversions() {
+ int32_t __attribute__((__aligned__(16))) ar1[4];
+ float __attribute__((__aligned__(16))) ar2[4];
+ __m128i v1 = _mm_set_epi32(0, -3, -517, 256);
+ __m128 v2 = _mm_cvtepi32_ps(v1);
+ _mm_store_ps(ar2, v2);
+ assert(ar2[0] == 256.0);
+ assert(ar2[1] == -517.0);
+ assert(ar2[2] == -3.0);
+ assert(ar2[3] == 0);
+ v2 = _mm_set_ps(5.0, 6.0, 7.45, -8.0);
+ v1 = _mm_cvtps_epi32(v2);
+ _mm_store_si128((__m128i *)ar1, v1);
+ assert(ar1[0] == -8);
+ assert(ar1[1] == 7);
+ assert(ar1[2] == 6);
+ assert(ar1[3] == 5);
+}
+
+void testMoveMaskPs() {
+ __m128 v =
+ _mm_castsi128_ps(_mm_set_epi32(0xffffffff, 0xffffffff, 0, 0xffffffff));
+ int mask = _mm_movemask_ps(v);
+ assert(mask == 13);
+}
+
+void testAddPs() {
+ float __attribute__((__aligned__(16))) ar[4];
+ __m128 v1 = _mm_set_ps(4.0, 3.0, 2.0, 1.0);
+ __m128 v2 = _mm_set_ps(10.0, 20.0, 30.0, 40.0);
+ __m128 v = _mm_add_ps(v1, v2);
+ _mm_store_ps(ar, v);
+ assert(ar[0] == 41.0);
+ assert(ar[1] == 32.0);
+ assert(ar[2] == 23.0);
+ assert(ar[3] == 14.0);
+}
+
+void testSubPs() {
+ float __attribute__((__aligned__(16))) ar[4];
+ __m128 v1 = _mm_set_ps(4.0, 3.0, 2.0, 1.0);
+ __m128 v2 = _mm_set_ps(10.0, 20.0, 30.0, 40.0);
+ __m128 v = _mm_sub_ps(v1, v2);
+ _mm_store_ps(ar, v);
+ assert(ar[0] == -39.0);
+ assert(ar[1] == -28.0);
+ assert(ar[2] == -17.0);
+ assert(ar[3] == -6.0);
+}
+
+void testMulPs() {
+ float __attribute__((__aligned__(16))) ar[4];
+ __m128 v1 = _mm_set_ps(4.0, 3.0, 2.0, 1.0);
+ __m128 v2 = _mm_set_ps(10.0, 20.0, 30.0, 40.0);
+ __m128 v = _mm_mul_ps(v1, v2);
+ _mm_store_ps(ar, v);
+ assert(ar[0] == 40.0);
+ assert(ar[1] == 60.0);
+ assert(ar[2] == 60.0);
+ assert(ar[3] == 40.0);
+}
+
+void testDivPs() {
+ float __attribute__((__aligned__(16))) ar[4];
+ __m128 v1 = _mm_set_ps(4.0, 9.0, 8.0, 1.0);
+ __m128 v2 = _mm_set_ps(2.0, 3.0, 1.0, 0.5);
+ __m128 v = _mm_div_ps(v1, v2);
+ _mm_store_ps(ar, v);
+ assert(ar[0] == 2.0);
+ assert(ar[1] == 8.0);
+ assert(ar[2] == 3.0);
+ assert(ar[3] == 2.0);
+}
+
+void testMinPs() {
+ float __attribute__((__aligned__(16))) ar[4];
+ __m128 v1 = _mm_set_ps(-20.0, 10.0, 30.0, 0.5);
+ __m128 v2 = _mm_set_ps(2.0, 1.0, 50.0, 0.0);
+ __m128 v = _mm_min_ps(v1, v2);
+ _mm_store_ps(ar, v);
+ assert(ar[0] == 0.0);
+ assert(ar[1] == 30.0);
+ assert(ar[2] == 1.0);
+ assert(ar[3] == -20.0);
+}
+
+void testMaxPs() {
+ float __attribute__((__aligned__(16))) ar[4];
+ __m128 v1 = _mm_set_ps(-20.0, 10.0, 30.0, 0.5);
+ __m128 v2 = _mm_set_ps(2.5, 5.0, 55.0, 1.0);
+ __m128 v = _mm_max_ps(v1, v2);
+ _mm_store_ps(ar, v);
+ assert(ar[0] == 1.0);
+ assert(ar[1] == 55.0);
+ assert(ar[2] == 10.0);
+ assert(ar[3] == 2.5);
+}
+
+void testSqrtPs() {
+ float __attribute__((__aligned__(16))) ar[4];
+ __m128 v1 = _mm_set_ps(16.0, 9.0, 4.0, 1.0);
+ __m128 v = _mm_sqrt_ps(v1);
+ _mm_store_ps(ar, v);
+ assert(ar[0] == 1.0);
+ assert(ar[1] == 2.0);
+ assert(ar[2] == 3.0);
+ assert(ar[3] == 4.0);
+}
+
+void testCmpLtPs() {
+ int32_t __attribute__((__aligned__(16))) ar[4];
+ __m128 v1 = _mm_set_ps(1.0, 2.0, 0.1, 0.001);
+ __m128 v2 = _mm_set_ps(2.0, 2.0, 0.001, 0.1);
+ __m128 v = _mm_cmplt_ps(v1, v2);
+ _mm_store_si128((__m128i *)ar, _mm_castps_si128(v));
+ assert(ar[0] == 0xffffffff);
+ assert(ar[1] == 0);
+ assert(ar[2] == 0);
+ assert(ar[3] == 0xffffffff);
+ assert(_mm_movemask_ps(v) == 9);
+}
+
+void testCmpLePs() {
+ int32_t __attribute__((__aligned__(16))) ar[4];
+ __m128 v1 = _mm_set_ps(1.0, 2.0, 0.1, 0.001);
+ __m128 v2 = _mm_set_ps(2.0, 2.0, 0.001, 0.1);
+ __m128 v = _mm_cmple_ps(v1, v2);
+ _mm_store_si128((__m128i *)ar, _mm_castps_si128(v));
+ assert(ar[0] == 0xffffffff);
+ assert(ar[1] == 0);
+ assert(ar[2] == 0xffffffff);
+ assert(ar[3] == 0xffffffff);
+ assert(_mm_movemask_ps(v) == 13);
+}
+
+void testCmpEqPs() {
+ int32_t __attribute__((__aligned__(16))) ar[4];
+ __m128 v1 = _mm_set_ps(1.0, 2.0, 0.1, 0.001);
+ __m128 v2 = _mm_set_ps(2.0, 2.0, 0.001, 0.1);
+ __m128 v = _mm_cmpeq_ps(v1, v2);
+ _mm_store_si128((__m128i *)ar, _mm_castps_si128(v));
+ assert(ar[0] == 0);
+ assert(ar[1] == 0);
+ assert(ar[2] == 0xffffffff);
+ assert(ar[3] == 0);
+ assert(_mm_movemask_ps(v) == 4);
+}
+
+void testCmpGePs() {
+ int32_t __attribute__((__aligned__(16))) ar[4];
+ __m128 v1 = _mm_set_ps(1.0, 2.0, 0.1, 0.001);
+ __m128 v2 = _mm_set_ps(2.0, 2.0, 0.001, 0.1);
+ __m128 v = _mm_cmpge_ps(v1, v2);
+ _mm_store_si128((__m128i *)ar, _mm_castps_si128(v));
+ assert(ar[0] == 0);
+ assert(ar[1] == 0xffffffff);
+ assert(ar[2] == 0xffffffff);
+ assert(ar[3] == 0);
+ assert(_mm_movemask_ps(v) == 6);
+}
+
+void testCmpGtPs() {
+ int32_t __attribute__((__aligned__(16))) ar[4];
+ __m128 v1 = _mm_set_ps(1.0, 2.0, 0.1, 0.001);
+ __m128 v2 = _mm_set_ps(2.0, 2.0, 0.001, 0.1);
+ __m128 v = _mm_cmpgt_ps(v1, v2);
+ _mm_store_si128((__m128i *)ar, _mm_castps_si128(v));
+ assert(ar[0] == 0);
+ assert(ar[1] == 0xffffffff);
+ assert(ar[2] == 0);
+ assert(ar[3] == 0);
+ assert(_mm_movemask_ps(v) == 2);
+}
+
+void testAndPs() {
+ float __attribute__((__aligned__(16))) ar[4];
+ __m128 v1 = _mm_set_ps(425, -501, -32, 68);
+ __m128 v2 =
+ _mm_castsi128_ps(_mm_set_epi32(0xffffffff, 0xffffffff, 0, 0xffffffff));
+ __m128 v = _mm_and_ps(v1, v2);
+ _mm_store_ps(ar, v);
+ assert(ar[0] == 68);
+ assert(ar[1] == 0);
+ assert(ar[2] == -501);
+ assert(ar[3] == 425);
+ int32_t __attribute__((__aligned__(16))) ar2[4];
+ v1 = _mm_castsi128_ps(
+ _mm_set_epi32(0xaaaaaaaa, 0xaaaaaaaa, -1431655766, 0xaaaaaaaa));
+ v2 = _mm_castsi128_ps(
+ _mm_set_epi32(0x55555555, 0x55555555, 0x55555555, 0x55555555));
+ v = _mm_and_ps(v1, v2);
+ _mm_store_si128((__m128i *)ar2, _mm_castps_si128(v));
+ assert(ar2[0] == 0);
+ assert(ar2[1] == 0);
+ assert(ar2[2] == 0);
+ assert(ar2[3] == 0);
+}
+
+void testAndNotPs() {
+ float __attribute__((__aligned__(16))) ar[4];
+ __m128 v1 = _mm_set_ps(425, -501, -32, 68);
+ __m128 v2 =
+ _mm_castsi128_ps(_mm_set_epi32(0xffffffff, 0xffffffff, 0, 0xffffffff));
+ __m128 v = _mm_andnot_ps(v2, v1);
+ _mm_store_ps(ar, v);
+ assert(ar[0] == 0);
+ assert(ar[1] == -32);
+ assert(ar[2] == 0);
+ assert(ar[3] == 0);
+ int32_t __attribute__((__aligned__(16))) ar2[4];
+ v1 = _mm_castsi128_ps(
+ _mm_set_epi32(0xaaaaaaaa, 0xaaaaaaaa, -1431655766, 0xaaaaaaaa));
+ v2 = _mm_castsi128_ps(
+ _mm_set_epi32(0x55555555, 0x55555555, 0x55555555, 0x55555555));
+ v = _mm_andnot_ps(v1, v2);
+ _mm_store_si128((__m128i *)ar2, _mm_castps_si128(v));
+ assert(ar2[0] == 0x55555555);
+ assert(ar2[1] == 0x55555555);
+ assert(ar2[2] == 0x55555555);
+ assert(ar2[3] == 0x55555555);
+}
+
+void testOrPs() {
+ int32_t __attribute__((__aligned__(16))) ar[4];
+ __m128 v1 =
+ _mm_castsi128_ps(_mm_set_epi32(0xaaaaaaaa, 0xaaaaaaaa, 0xffffffff, 0));
+ __m128 v2 = _mm_castsi128_ps(
+ _mm_set_epi32(0x55555555, 0x55555555, 0x55555555, 0x55555555));
+ __m128 v = _mm_or_ps(v1, v2);
+ _mm_store_si128((__m128i *)ar, _mm_castps_si128(v));
+ assert(ar[0] == 0x55555555);
+ assert(ar[1] == 0xffffffff);
+ assert(ar[2] == 0xffffffff);
+ assert(ar[3] == 0xffffffff);
+}
+
+void testXorPs() {
+ int32_t __attribute__((__aligned__(16))) ar[4];
+ __m128 v1 =
+ _mm_castsi128_ps(_mm_set_epi32(0xaaaaaaaa, 0xaaaaaaaa, 0xffffffff, 0));
+ __m128 v2 = _mm_castsi128_ps(
+ _mm_set_epi32(0x55555555, 0x55555555, 0x55555555, 0x55555555));
+ __m128 v = _mm_xor_ps(v1, v2);
+ _mm_store_si128((__m128i *)ar, _mm_castps_si128(v));
+ assert(ar[0] == 0x55555555);
+ assert(ar[1] == 0xaaaaaaaa);
+ assert(ar[2] == 0xffffffff);
+ assert(ar[3] == 0xffffffff);
+}
+
+void testAndSi128() {
+ int32_t __attribute__((__aligned__(16))) ar[4];
+ __m128i v1 = _mm_set_epi32(0xaaaaaaaa, 0xaaaaaaaa, -1431655766, 0xaaaaaaaa);
+ __m128i v2 = _mm_set_epi32(0x55555555, 0x55555555, 0x55555555, 0x55555555);
+ __m128i v = _mm_and_si128(v1, v2);
+ _mm_store_si128((__m128i *)ar, v);
+ assert(ar[0] == 0);
+ assert(ar[1] == 0);
+ assert(ar[2] == 0);
+ assert(ar[3] == 0);
+}
+
+void testAndNotSi128() {
+ int32_t __attribute__((__aligned__(16))) ar[4];
+ __m128i v1 = _mm_set_epi32(0xaaaaaaaa, 0xaaaaaaaa, -1431655766, 0xaaaaaaaa);
+ __m128i v2 = _mm_set_epi32(0x55555555, 0x55555555, 0x55555555, 0x55555555);
+ __m128i v = _mm_andnot_si128(v1, v2);
+ _mm_store_si128((__m128i *)ar, v);
+ assert(ar[0] == 0x55555555);
+ assert(ar[1] == 0x55555555);
+ assert(ar[2] == 0x55555555);
+ assert(ar[3] == 0x55555555);
+}
+
+void testOrSi128() {
+ int32_t __attribute__((__aligned__(16))) ar[4];
+ __m128i v1 = _mm_set_epi32(0xaaaaaaaa, 0xaaaaaaaa, 0xffffffff, 0);
+ __m128i v2 = _mm_set_epi32(0x55555555, 0x55555555, 0x55555555, 0x55555555);
+ __m128i v = _mm_or_si128(v1, v2);
+ _mm_store_si128((__m128i *)ar, v);
+ assert(ar[0] == 0x55555555);
+ assert(ar[1] == 0xffffffff);
+ assert(ar[2] == 0xffffffff);
+ assert(ar[3] == 0xffffffff);
+}
+
+void testXorSi128() {
+ int32_t __attribute__((__aligned__(16))) ar[4];
+ __m128i v1 = _mm_set_epi32(0xaaaaaaaa, 0xaaaaaaaa, 0xffffffff, 0);
+ __m128i v2 = _mm_set_epi32(0x55555555, 0x55555555, 0x55555555, 0x55555555);
+ __m128i v = _mm_xor_si128(v1, v2);
+ _mm_store_si128((__m128i *)ar, v);
+ assert(ar[0] == 0x55555555);
+ assert(ar[1] == 0xaaaaaaaa);
+ assert(ar[2] == 0xffffffff);
+ assert(ar[3] == 0xffffffff);
+}
+
+void testAddEpi32() {
+ int32_t __attribute__((__aligned__(16))) ar[4];
+ __m128i v1 = _mm_set_epi32(4, 3, 2, 1);
+ __m128i v2 = _mm_set_epi32(10, 20, 30, 40);
+ __m128i v = _mm_add_epi32(v1, v2);
+ _mm_store_si128((__m128i *)ar, v);
+ assert(ar[0] == 41);
+ assert(ar[1] == 32);
+ assert(ar[2] == 23);
+ assert(ar[3] == 14);
+}
+
+void testSubEpi32() {
+ int32_t __attribute__((__aligned__(16))) ar[4];
+ __m128i v1 = _mm_set_epi32(4, 3, 2, 1);
+ __m128i v2 = _mm_set_epi32(10, 20, 30, 40);
+ __m128i v = _mm_sub_epi32(v1, v2);
+ _mm_store_si128((__m128i *)ar, v);
+ assert(ar[0] == -39);
+ assert(ar[1] == -28);
+ assert(ar[2] == -17);
+ assert(ar[3] == -6);
+}
+
+int main(int argc, char **argv) {
+ testSetPs();
+ testSet1Ps();
+ testSetZeroPs();
+ testSetEpi32();
+ testSet1Epi32();
+ testSetZeroSi128();
+ testBitCasts();
+ testConversions();
+ testMoveMaskPs();
+ testAddPs();
+ testSubPs();
+ testMulPs();
+ testDivPs();
+ testMaxPs();
+ testMinPs();
+ testSqrtPs();
+ testCmpLtPs();
+ testCmpLePs();
+ testCmpEqPs();
+ testCmpGePs();
+ testCmpGtPs();
+ testAndPs();
+ testAndNotPs();
+ testOrPs();
+ testXorPs();
+ testAndSi128();
+ testAndNotSi128();
+ testOrSi128();
+ testXorSi128();
+ testAddEpi32();
+ testSubEpi32();
+ printf("DONE");
+ return 0;
+}
diff --git a/tests/core/test_sintvars.in b/tests/core/test_sintvars.in
index 1b377c7c..570dba48 100644
--- a/tests/core/test_sintvars.in
+++ b/tests/core/test_sintvars.in
@@ -1,25 +1,24 @@
+#include <stdio.h>
+struct S {
+ char *match_start;
+ char *strstart;
+};
+int main() {
+ struct S _s;
+ struct S *s = &_s;
+ unsigned short int sh;
- #include <stdio.h>
- struct S {
- char *match_start;
- char *strstart;
- };
- int main()
- {
- struct S _s;
- struct S *s = &_s;
- unsigned short int sh;
+ s->match_start = (char *)32522;
+ s->strstart = (char *)(32780);
+ printf("*%d,%d,%d*\n", (int)s->strstart, (int)s->match_start,
+ (int)(s->strstart - s->match_start));
+ sh = s->strstart - s->match_start;
+ printf("*%d,%d*\n", sh, sh >> 7);
- s->match_start = (char*)32522;
- s->strstart = (char*)(32780);
- printf("*%d,%d,%d*\n", (int)s->strstart, (int)s->match_start, (int)(s->strstart - s->match_start));
- sh = s->strstart - s->match_start;
- printf("*%d,%d*\n", sh, sh>>7);
-
- s->match_start = (char*)32999;
- s->strstart = (char*)(32780);
- printf("*%d,%d,%d*\n", (int)s->strstart, (int)s->match_start, (int)(s->strstart - s->match_start));
- sh = s->strstart - s->match_start;
- printf("*%d,%d*\n", sh, sh>>7);
- }
- \ No newline at end of file
+ s->match_start = (char *)32999;
+ s->strstart = (char *)(32780);
+ printf("*%d,%d,%d*\n", (int)s->strstart, (int)s->match_start,
+ (int)(s->strstart - s->match_start));
+ sh = s->strstart - s->match_start;
+ printf("*%d,%d*\n", sh, sh >> 7);
+}
diff --git a/tests/core/test_sizeof.in b/tests/core/test_sizeof.in
index 952e900e..1186ce41 100644
--- a/tests/core/test_sizeof.in
+++ b/tests/core/test_sizeof.in
@@ -1,29 +1,28 @@
+#include <stdio.h>
+#include <string.h>
+#include "emscripten.h"
- #include <stdio.h>
- #include <string.h>
- #include "emscripten.h"
+struct A {
+ int x, y;
+};
- struct A { int x, y; };
+int main(int argc, const char *argv[]) {
+ int *a = new int[10];
+ int *b = new int[1];
+ int *c = new int[10];
+ for (int i = 0; i < 10; i++) a[i] = 2;
+ *b = 5;
+ for (int i = 0; i < 10; i++) c[i] = 8;
+ printf("*%d,%d,%d,%d,%d*\n", a[0], a[9], *b, c[0], c[9]);
+ // Should overwrite a, but not touch b!
+ memcpy(a, c, 10 * sizeof(int));
+ printf("*%d,%d,%d,%d,%d*\n", a[0], a[9], *b, c[0], c[9]);
- int main( int argc, const char *argv[] ) {
- int *a = new int[10];
- int *b = new int[1];
- int *c = new int[10];
- for (int i = 0; i < 10; i++)
- a[i] = 2;
- *b = 5;
- for (int i = 0; i < 10; i++)
- c[i] = 8;
- printf("*%d,%d,%d,%d,%d*\n", a[0], a[9], *b, c[0], c[9]);
- // Should overwrite a, but not touch b!
- memcpy(a, c, 10*sizeof(int));
- printf("*%d,%d,%d,%d,%d*\n", a[0], a[9], *b, c[0], c[9]);
+ // Part 2
+ A as[3] = {{5, 12}, {6, 990}, {7, 2}};
+ memcpy(&as[0], &as[2], sizeof(A));
- // Part 2
- A as[3] = { { 5, 12 }, { 6, 990 }, { 7, 2 } };
- memcpy(&as[0], &as[2], sizeof(A));
-
- printf("*%d,%d,%d,%d,%d,%d*\n", as[0].x, as[0].y, as[1].x, as[1].y, as[2].x, as[2].y);
- return 0;
- }
- \ No newline at end of file
+ printf("*%d,%d,%d,%d,%d,%d*\n", as[0].x, as[0].y, as[1].x, as[1].y, as[2].x,
+ as[2].y);
+ return 0;
+}
diff --git a/tests/core/test_sscanf.in b/tests/core/test_sscanf.in
index 821e0c86..d5289fe5 100644
--- a/tests/core/test_sscanf.in
+++ b/tests/core/test_sscanf.in
@@ -1,88 +1,91 @@
-
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
-
- int main () {
- #define CHECK(str) \
- { \
- char name[1000]; \
- memset(name, 0, 1000); \
- int prio = 99; \
- sscanf(str, "%s %d", name, &prio); \
- printf("%s : %d\n", name, prio); \
- }
- CHECK("en-us 2");
- CHECK("en-r");
- CHECK("en 3");
-
- printf("%f, %f\n", atof("1.234567"), atof("cheez"));
-
- char float_formats[] = "fegE";
- char format[] = "%_";
- for(int i = 0; i < 4; ++i) {
- format[1] = float_formats[i];
-
- float n = -1;
- sscanf(" 2.8208", format, &n);
- printf("%.4f\n", n);
-
- float a = -1;
- sscanf("-3.03", format, &a);
- printf("%.4f\n", a);
- }
-
- char buffy[100];
- sscanf("cheez some thing moar 123\nyet more\n", "cheez %s", buffy);
- printf("|%s|\n", buffy);
- sscanf("cheez something\nmoar 123\nyet more\n", "cheez %s", buffy);
- printf("|%s|\n", buffy);
- sscanf("cheez somethingmoar\tyet more\n", "cheez %s", buffy);
- printf("|%s|\n", buffy);
-
- int numverts = -1;
- printf("%d\n", sscanf(" numverts 1499\n", " numverts %d", &numverts)); // white space is the same, even if tab vs space
- printf("%d\n", numverts);
-
- int index;
- float u, v;
- short start, count;
- printf("%d\n", sscanf(" vert 87 ( 0.481565 0.059481 ) 0 1\n", " vert %d ( %f %f ) %hu %hu", &index, &u, &v, &start, &count));
- printf("%d,%.6f,%.6f,%hu,%hu\n", index, u, v, start, count);
-
- int neg, neg2, neg3 = 0;
- printf("%d\n", sscanf("-123 -765 -34-6", "%d %u %d", &neg, &neg2, &neg3));
- printf("%d,%u,%d\n", neg, neg2, neg3);
-
- {
- int a = 0;
- sscanf("1", "%i", &a);
- printf("%i\n", a);
- }
-
- char buf1[100], buf2[100], buf3[100], buf4[100];
-
- int numItems = sscanf("level=4:ref=3", "%255[^:=]=%255[^:]:%255[^=]=%255c", buf1, buf2, buf3, buf4);
- printf("%d, %s, %s, %s, %s\n", numItems, buf1, buf2, buf3, buf4);
-
- numItems = sscanf("def|456", "%[a-z]|%[0-9]", buf1, buf2);
- printf("%d, %s, %s\n", numItems, buf1, buf2);
-
- numItems = sscanf("3-4,-ab", "%[-0-9],%[ab-z-]", buf1, buf2);
- printf("%d, %s, %s\n", numItems, buf1, buf2);
-
- numItems = sscanf("Hello,World", "%[A-Za-z],%[^0-9]", buf1, buf2);
- printf("%d, %s, %s\n", numItems, buf1, buf2);
-
- numItems = sscanf("Hello4711", "%[^0-9],%[^0-9]", buf1, buf2);
- printf("%d, %s\n", numItems, buf1);
-
- numItems = sscanf("JavaScript", "%4[A-Za-z]", buf1);
- printf("%d, %s\n", numItems, buf1);
-
- numItems = sscanf("[]", "%1[[]%1[]]", buf1, buf2);
- printf("%d, %s, %s\n", numItems, buf1, buf2);
-
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+int main() {
+#define CHECK(str) \
+ { \
+ char name[1000]; \
+ memset(name, 0, 1000); \
+ int prio = 99; \
+ sscanf(str, "%s %d", name, &prio); \
+ printf("%s : %d\n", name, prio); \
+ }
+ CHECK("en-us 2");
+ CHECK("en-r");
+ CHECK("en 3");
+
+ printf("%f, %f\n", atof("1.234567"), atof("cheez"));
+
+ char float_formats[] = "fegE";
+ char format[] = "%_";
+ for (int i = 0; i < 4; ++i) {
+ format[1] = float_formats[i];
+
+ float n = -1;
+ sscanf(" 2.8208", format, &n);
+ printf("%.4f\n", n);
+
+ float a = -1;
+ sscanf("-3.03", format, &a);
+ printf("%.4f\n", a);
+ }
+
+ char buffy[100];
+ sscanf("cheez some thing moar 123\nyet more\n", "cheez %s", buffy);
+ printf("|%s|\n", buffy);
+ sscanf("cheez something\nmoar 123\nyet more\n", "cheez %s", buffy);
+ printf("|%s|\n", buffy);
+ sscanf("cheez somethingmoar\tyet more\n", "cheez %s", buffy);
+ printf("|%s|\n", buffy);
+
+ int numverts = -1;
+ printf("%d\n",
+ sscanf(" numverts 1499\n", " numverts %d",
+ &numverts)); // white space is the same, even if tab vs space
+ printf("%d\n", numverts);
+
+ int index;
+ float u, v;
+ short start, count;
+ printf("%d\n",
+ sscanf(" vert 87 ( 0.481565 0.059481 ) 0 1\n",
+ " vert %d ( %f %f ) %hu %hu", &index, &u, &v, &start, &count));
+ printf("%d,%.6f,%.6f,%hu,%hu\n", index, u, v, start, count);
+
+ int neg, neg2, neg3 = 0;
+ printf("%d\n", sscanf("-123 -765 -34-6", "%d %u %d", &neg, &neg2, &neg3));
+ printf("%d,%u,%d\n", neg, neg2, neg3);
+
+ {
+ int a = 0;
+ sscanf("1", "%i", &a);
+ printf("%i\n", a);
+ }
+
+ char buf1[100], buf2[100], buf3[100], buf4[100];
+
+ int numItems = sscanf("level=4:ref=3", "%255[^:=]=%255[^:]:%255[^=]=%255c",
+ buf1, buf2, buf3, buf4);
+ printf("%d, %s, %s, %s, %s\n", numItems, buf1, buf2, buf3, buf4);
+
+ numItems = sscanf("def|456", "%[a-z]|%[0-9]", buf1, buf2);
+ printf("%d, %s, %s\n", numItems, buf1, buf2);
+
+ numItems = sscanf("3-4,-ab", "%[-0-9],%[ab-z-]", buf1, buf2);
+ printf("%d, %s, %s\n", numItems, buf1, buf2);
+
+ numItems = sscanf("Hello,World", "%[A-Za-z],%[^0-9]", buf1, buf2);
+ printf("%d, %s, %s\n", numItems, buf1, buf2);
+
+ numItems = sscanf("Hello4711", "%[^0-9],%[^0-9]", buf1, buf2);
+ printf("%d, %s\n", numItems, buf1);
+
+ numItems = sscanf("JavaScript", "%4[A-Za-z]", buf1);
+ printf("%d, %s\n", numItems, buf1);
+
+ numItems = sscanf("[]", "%1[[]%1[]]", buf1, buf2);
+ printf("%d, %s, %s\n", numItems, buf1, buf2);
+
+ return 0;
+}
diff --git a/tests/core/test_sscanf_3.in b/tests/core/test_sscanf_3.in
index fb8949e7..e21897ed 100644
--- a/tests/core/test_sscanf_3.in
+++ b/tests/core/test_sscanf_3.in
@@ -1,17 +1,17 @@
+#include <stdint.h>
+#include <stdio.h>
- #include <stdint.h>
- #include <stdio.h>
+int main() {
- int main(){
+ int64_t s, m, l;
+ printf("%d\n", sscanf("123 1073741823 1125899906842620", "%lld %lld %lld", &s,
+ &m, &l));
+ printf("%lld,%lld,%lld\n", s, m, l);
- int64_t s, m, l;
- printf("%d\n", sscanf("123 1073741823 1125899906842620", "%lld %lld %lld", &s, &m, &l));
- printf("%lld,%lld,%lld\n", s, m, l);
+ int64_t negS, negM, negL;
+ printf("%d\n", sscanf("-123 -1073741823 -1125899906842620", "%lld %lld %lld",
+ &negS, &negM, &negL));
+ printf("%lld,%lld,%lld\n", negS, negM, negL);
- int64_t negS, negM, negL;
- printf("%d\n", sscanf("-123 -1073741823 -1125899906842620", "%lld %lld %lld", &negS, &negM, &negL));
- printf("%lld,%lld,%lld\n", negS, negM, negL);
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_sscanf_4.in b/tests/core/test_sscanf_4.in
index b54176c5..c9e3b5f1 100644
--- a/tests/core/test_sscanf_4.in
+++ b/tests/core/test_sscanf_4.in
@@ -1,11 +1,8 @@
+#include <stdio.h>
- #include <stdio.h>
-
- int main()
- {
- char pYear[16], pMonth[16], pDay[16], pDate[64];
- printf("%d\n", sscanf("Nov 19 2012", "%s%s%s", pMonth, pDay, pYear));
- printf("day %s, month %s, year %s \n", pDay, pMonth, pYear);
- return(0);
- }
- \ No newline at end of file
+int main() {
+ char pYear[16], pMonth[16], pDay[16], pDate[64];
+ printf("%d\n", sscanf("Nov 19 2012", "%s%s%s", pMonth, pDay, pYear));
+ printf("day %s, month %s, year %s \n", pDay, pMonth, pYear);
+ return (0);
+}
diff --git a/tests/core/test_sscanf_5.in b/tests/core/test_sscanf_5.in
index c3c1ed8a..c344258d 100644
--- a/tests/core/test_sscanf_5.in
+++ b/tests/core/test_sscanf_5.in
@@ -1,19 +1,13 @@
+#include "stdio.h"
- #include "stdio.h"
+static const char *colors[] = {" c black", ". c #001100", "X c #111100"};
- static const char *colors[] = {
- " c black",
- ". c #001100",
- "X c #111100"
- };
-
- int main(){
- unsigned char code;
- char color[32];
- int rcode;
- for(int i = 0; i < 3; i++) {
- rcode = sscanf(colors[i], "%c c %s", &code, color);
- printf("%i, %c, %s\n", rcode, code, color);
- }
- }
- \ No newline at end of file
+int main() {
+ unsigned char code;
+ char color[32];
+ int rcode;
+ for (int i = 0; i < 3; i++) {
+ rcode = sscanf(colors[i], "%c c %s", &code, color);
+ printf("%i, %c, %s\n", rcode, code, color);
+ }
+}
diff --git a/tests/core/test_sscanf_6.in b/tests/core/test_sscanf_6.in
index 2f2f58a3..63ede53f 100644
--- a/tests/core/test_sscanf_6.in
+++ b/tests/core/test_sscanf_6.in
@@ -1,15 +1,14 @@
-
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- char *date = "18.07.2013w";
- char c[10];
- memset(c, 0, 10);
- int y, m, d, i;
- i = sscanf(date, "%d.%d.%4d%c", &d, &m, &y, c);
- printf("date: %s; day %2d, month %2d, year %4d, extra: %c, %d\n", date, d, m, y, c[0], i);
- i = sscanf(date, "%d.%d.%3c", &d, &m, c);
- printf("date: %s; day %2d, month %2d, year %4d, extra: %s, %d\n", date, d, m, y, c, i);
- }
- \ No newline at end of file
+#include <stdio.h>
+#include <string.h>
+int main() {
+ char *date = "18.07.2013w";
+ char c[10];
+ memset(c, 0, 10);
+ int y, m, d, i;
+ i = sscanf(date, "%d.%d.%4d%c", &d, &m, &y, c);
+ printf("date: %s; day %2d, month %2d, year %4d, extra: %c, %d\n", date, d, m,
+ y, c[0], i);
+ i = sscanf(date, "%d.%d.%3c", &d, &m, c);
+ printf("date: %s; day %2d, month %2d, year %4d, extra: %s, %d\n", date, d, m,
+ y, c, i);
+}
diff --git a/tests/core/test_sscanf_caps.in b/tests/core/test_sscanf_caps.in
index 39a90db5..b0936036 100644
--- a/tests/core/test_sscanf_caps.in
+++ b/tests/core/test_sscanf_caps.in
@@ -1,10 +1,8 @@
+#include "stdio.h"
- #include "stdio.h"
-
- int main(){
- unsigned int a;
- float e, f, g;
- sscanf("a 1.1 1.1 1.1", "%X %E %F %G", &a, &e, &f, &g);
- printf("%d %.1F %.1F %.1F\n", a, e, f, g);
- }
- \ No newline at end of file
+int main() {
+ unsigned int a;
+ float e, f, g;
+ sscanf("a 1.1 1.1 1.1", "%X %E %F %G", &a, &e, &f, &g);
+ printf("%d %.1F %.1F %.1F\n", a, e, f, g);
+}
diff --git a/tests/core/test_sscanf_float.in b/tests/core/test_sscanf_float.in
index e87d839a..29fe2d56 100644
--- a/tests/core/test_sscanf_float.in
+++ b/tests/core/test_sscanf_float.in
@@ -1,9 +1,10 @@
+#include "stdio.h"
- #include "stdio.h"
-
- int main(){
- float f1, f2, f3, f4, f5, f6, f7, f8, f9;
- sscanf("0.512 0.250x5.129_-9.98 1.12*+54.32E3 +54.32E3^87.5E-3 87.5E-3$", "%f %fx%f_%f %f*%f %f^%f %f$", &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8, &f9);
- printf("\n%f, %f, %f, %f, %f, %f, %f, %f, %f\n", f1, f2, f3, f4, f5, f6, f7, f8, f9);
- }
- \ No newline at end of file
+int main() {
+ float f1, f2, f3, f4, f5, f6, f7, f8, f9;
+ sscanf("0.512 0.250x5.129_-9.98 1.12*+54.32E3 +54.32E3^87.5E-3 87.5E-3$",
+ "%f %fx%f_%f %f*%f %f^%f %f$", &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8,
+ &f9);
+ printf("\n%f, %f, %f, %f, %f, %f, %f, %f, %f\n", f1, f2, f3, f4, f5, f6, f7,
+ f8, f9);
+}
diff --git a/tests/core/test_sscanf_hex.in b/tests/core/test_sscanf_hex.in
index af6c158e..d8175e82 100644
--- a/tests/core/test_sscanf_hex.in
+++ b/tests/core/test_sscanf_hex.in
@@ -1,9 +1,7 @@
+#include "stdio.h"
- #include "stdio.h"
-
- int main(){
- unsigned int a, b;
- sscanf("0x12AB 12AB", "%x %x", &a, &b);
- printf("%d %d\n", a, b);
- }
- \ No newline at end of file
+int main() {
+ unsigned int a, b;
+ sscanf("0x12AB 12AB", "%x %x", &a, &b);
+ printf("%d %d\n", a, b);
+}
diff --git a/tests/core/test_sscanf_n.in b/tests/core/test_sscanf_n.in
index 78142b3a..b383a3d7 100644
--- a/tests/core/test_sscanf_n.in
+++ b/tests/core/test_sscanf_n.in
@@ -1,21 +1,19 @@
+#include <stdio.h>
+int main() {
+ char *line = "version 1.0";
+ int i, l, lineno;
+ char word[80];
+ if (sscanf(line, "%s%n", word, &l) != 1) {
+ printf("Header format error, line %d\n", lineno);
+ }
+ printf("[DEBUG] word 1: %s, l: %d\n", word, l);
- #include<stdio.h>
- int main() {
- char *line = "version 1.0";
- int i, l, lineno;
- char word[80];
- if (sscanf(line, "%s%n", word, &l) != 1) {
- printf("Header format error, line %d\n", lineno);
- }
- printf("[DEBUG] word 1: %s, l: %d\n", word, l);
-
- int x = sscanf("one %n two", "%s %n", word, &l);
- printf("%d,%s,%d\n", x, word, l);
- {
- int a, b, c, count;
- count = sscanf("12345 6789", "%d %n%d", &a, &b, &c);
- printf("%i %i %i %i\n", count, a, b, c);
- }
- return 0;
- }
- \ No newline at end of file
+ int x = sscanf("one %n two", "%s %n", word, &l);
+ printf("%d,%s,%d\n", x, word, l);
+ {
+ int a, b, c, count;
+ count = sscanf("12345 6789", "%d %n%d", &a, &b, &c);
+ printf("%i %i %i %i\n", count, a, b, c);
+ }
+ return 0;
+}
diff --git a/tests/core/test_sscanf_other_whitespace.in b/tests/core/test_sscanf_other_whitespace.in
index 224d1a23..467fa4f0 100644
--- a/tests/core/test_sscanf_other_whitespace.in
+++ b/tests/core/test_sscanf_other_whitespace.in
@@ -1,29 +1,23 @@
+#include <stdio.h>
- #include<stdio.h>
+int main() {
+ short int x;
+ short int y;
- int main() {
- short int x;
- short int y;
+ const char* buffer[] = {
+ "\t2\t3\t", /* TAB - horizontal tab */
+ "\t\t5\t\t7\t\t", "\n11\n13\n", /* LF - line feed */
+ "\n\n17\n\n19\n\n", "\v23\v29\v", /* VT - vertical tab */
+ "\v\v31\v\v37\v\v", "\f41\f43\f", /* FF - form feed */
+ "\f\f47\f\f53\f\f", "\r59\r61\r", /* CR - carrage return */
+ "\r\r67\r\r71\r\r"};
- const char* buffer[] = {
- "\t2\t3\t", /* TAB - horizontal tab */
- "\t\t5\t\t7\t\t",
- "\n11\n13\n", /* LF - line feed */
- "\n\n17\n\n19\n\n",
- "\v23\v29\v", /* VT - vertical tab */
- "\v\v31\v\v37\v\v",
- "\f41\f43\f", /* FF - form feed */
- "\f\f47\f\f53\f\f",
- "\r59\r61\r", /* CR - carrage return */
- "\r\r67\r\r71\r\r"
- };
+ for (int i = 0; i < 10; ++i) {
+ x = 0;
+ y = 0;
+ sscanf(buffer[i], " %d %d ", &x, &y);
+ printf("%d, %d, ", x, y);
+ }
- for (int i=0; i<10; ++i) {
- x = 0; y = 0;
- sscanf(buffer[i], " %d %d ", &x, &y);
- printf("%d, %d, ", x, y);
- }
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_sscanf_skip.in b/tests/core/test_sscanf_skip.in
index 0faae7aa..f4ef8265 100644
--- a/tests/core/test_sscanf_skip.in
+++ b/tests/core/test_sscanf_skip.in
@@ -1,16 +1,15 @@
+#include <stdint.h>
+#include <stdio.h>
- #include <stdint.h>
- #include <stdio.h>
+int main() {
+ int val1;
+ printf("%d\n", sscanf("10 20 30 40", "%*lld %*d %d", &val1));
+ printf("%d\n", val1);
- int main(){
- int val1;
- printf("%d\n", sscanf("10 20 30 40", "%*lld %*d %d", &val1));
- printf("%d\n", val1);
+ int64_t large, val2;
+ printf("%d\n", sscanf("1000000 -1125899906842620 -123 -1073741823",
+ "%lld %*lld %ld %*d", &large, &val2));
+ printf("%lld,%d\n", large, val2);
- int64_t large, val2;
- printf("%d\n", sscanf("1000000 -1125899906842620 -123 -1073741823", "%lld %*lld %ld %*d", &large, &val2));
- printf("%lld,%d\n", large, val2);
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_sscanf_whitespace.in b/tests/core/test_sscanf_whitespace.in
index 6947203f..8bcf1c7b 100644
--- a/tests/core/test_sscanf_whitespace.in
+++ b/tests/core/test_sscanf_whitespace.in
@@ -1,23 +1,16 @@
+#include <stdio.h>
- #include<stdio.h>
+int main() {
+ short int x;
+ short int y;
- int main() {
- short int x;
- short int y;
+ const char* buffer[] = {"173,16", " 16,173", "183, 173",
+ " 17, 287", " 98, 123, "};
- const char* buffer[] = {
- "173,16",
- " 16,173",
- "183, 173",
- " 17, 287",
- " 98, 123, "
- };
+ for (int i = 0; i < 5; ++i) {
+ sscanf(buffer[i], "%hd,%hd", &x, &y);
+ printf("%d:%d,%d ", i, x, y);
+ }
- for (int i=0; i<5; ++i) {
- sscanf(buffer[i], "%hd,%hd", &x, &y);
- printf("%d:%d,%d ", i, x, y);
- }
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_stack.in b/tests/core/test_stack.in
index 94e5d380..b2bca9a1 100644
--- a/tests/core/test_stack.in
+++ b/tests/core/test_stack.in
@@ -1,19 +1,16 @@
-
- #include <stdio.h>
- int test(int i) {
- int x = 10;
- if (i > 0) {
- return test(i-1);
- }
- return int(&x); // both for the number, and forces x to not be nativized
- }
- int main(int argc, char **argv)
- {
- // We should get the same value for the first and last - stack has unwound
- int x1 = test(argc - 2);
- int x2 = test(100);
- int x3 = test((argc - 2) / 4);
- printf("*%d,%d*\n", x3-x1, x2 != x1);
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+int test(int i) {
+ int x = 10;
+ if (i > 0) {
+ return test(i - 1);
+ }
+ return int(&x); // both for the number, and forces x to not be nativized
+}
+int main(int argc, char **argv) {
+ // We should get the same value for the first and last - stack has unwound
+ int x1 = test(argc - 2);
+ int x2 = test(100);
+ int x3 = test((argc - 2) / 4);
+ printf("*%d,%d*\n", x3 - x1, x2 != x1);
+ return 0;
+}
diff --git a/tests/core/test_stack_byval.in b/tests/core/test_stack_byval.in
index 565866ee..d7007d0a 100644
--- a/tests/core/test_stack_byval.in
+++ b/tests/core/test_stack_byval.in
@@ -1,25 +1,21 @@
-
// We should also not blow up the stack with byval arguments
- #include<stdio.h>
- struct vec {
- int x, y, z;
- vec(int x_, int y_, int z_) : x(x_), y(y_), z(z_) {}
- static vec add(vec a, vec b) {
- return vec(a.x+b.x, a.y+b.y, a.z+b.z);
- }
- };
- int main() {
- int total = 0;
- for (int i = 0; i < 1000; i++) {
- for (int j = 0; j < 1000; j++) {
- vec c(i+i%10, j*2, i%255);
- vec d(j*2, j%255, i%120);
- vec f = vec::add(c, d);
- total += (f.x + f.y + f.z) % 100;
- total %= 10240;
- }
- }
- printf("sum:%d*\n", total);
- return 0;
- }
-
+#include <stdio.h>
+struct vec {
+ int x, y, z;
+ vec(int x_, int y_, int z_) : x(x_), y(y_), z(z_) {}
+ static vec add(vec a, vec b) { return vec(a.x + b.x, a.y + b.y, a.z + b.z); }
+};
+int main() {
+ int total = 0;
+ for (int i = 0; i < 1000; i++) {
+ for (int j = 0; j < 1000; j++) {
+ vec c(i + i % 10, j * 2, i % 255);
+ vec d(j * 2, j % 255, i % 120);
+ vec f = vec::add(c, d);
+ total += (f.x + f.y + f.z) % 100;
+ total %= 10240;
+ }
+ }
+ printf("sum:%d*\n", total);
+ return 0;
+}
diff --git a/tests/core/test_stack_varargs.in b/tests/core/test_stack_varargs.in
index 74b600bd..01c231af 100644
--- a/tests/core/test_stack_varargs.in
+++ b/tests/core/test_stack_varargs.in
@@ -1,16 +1,16 @@
-
// We should not blow up the stack with numerous varargs
- #include <stdio.h>
- #include <stdlib.h>
+#include <stdio.h>
+#include <stdlib.h>
- void func(int i) {
- printf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
- i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i);
- }
- int main() {
- for (int i = 0; i < 1024; i++)
- func(i);
- printf("ok!\n");
- return 0;
- }
-
+void func(int i) {
+ printf(
+ "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,"
+ "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
+ i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i,
+ i, i, i, i, i, i, i, i, i, i, i, i, i, i);
+}
+int main() {
+ for (int i = 0; i < 1024; i++) func(i);
+ printf("ok!\n");
+ return 0;
+}
diff --git a/tests/core/test_stack_void.in b/tests/core/test_stack_void.in
index 7e48a0f0..0e72e509 100644
--- a/tests/core/test_stack_void.in
+++ b/tests/core/test_stack_void.in
@@ -1,16 +1,34 @@
+#include <stdio.h>
- #include <stdio.h>
-
- static char s[100]="aaaaa";
- static int func(void) {
- if(s[0]!='a') return 0;
- printf("iso open %s\n", s, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001);
- return 0;
- }
- int main(){
- int i;
- for(i=0;i<5000;i++)
- func();
- printf(".ok.\n");
- }
- \ No newline at end of file
+static char s[100] = "aaaaa";
+static int func(void) {
+ if (s[0] != 'a') return 0;
+ printf("iso open %s\n", s, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001,
+ 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001, 1.001);
+ return 0;
+}
+int main() {
+ int i;
+ for (i = 0; i < 5000; i++) func();
+ printf(".ok.\n");
+}
diff --git a/tests/core/test_static_variable.in b/tests/core/test_static_variable.in
index 82fcadac..70b41324 100644
--- a/tests/core/test_static_variable.in
+++ b/tests/core/test_static_variable.in
@@ -1,26 +1,18 @@
+#include <stdio.h>
- #include <stdio.h>
+struct DATA {
+ int value;
- struct DATA
- {
- int value;
+ DATA() { value = 0; }
+};
- DATA()
- {
- value = 0;
- }
- };
+DATA& GetData() {
+ static DATA data;
- DATA & GetData()
- {
- static DATA data;
+ return data;
+}
- return data;
- }
-
- int main()
- {
- GetData().value = 10;
- printf( "value:%i", GetData().value );
- }
- \ No newline at end of file
+int main() {
+ GetData().value = 10;
+ printf("value:%i", GetData().value);
+}
diff --git a/tests/core/test_statics.in b/tests/core/test_statics.in
index 0935aade..d3302db5 100644
--- a/tests/core/test_statics.in
+++ b/tests/core/test_statics.in
@@ -1,39 +1,35 @@
+#include <stdio.h>
+#include <string.h>
- #include <stdio.h>
- #include <string.h>
+#define CONSTRLEN 32
- #define CONSTRLEN 32
+char *(*func)(char *, const char *) = NULL;
- char * (*func)(char *, const char *) = NULL;
+void conoutfv(const char *fmt) {
+ static char buf[CONSTRLEN];
+ func(buf, fmt); // call by function pointer to make sure we test strcpy here
+ puts(buf);
+}
- void conoutfv(const char *fmt)
- {
- static char buf[CONSTRLEN];
- func(buf, fmt); // call by function pointer to make sure we test strcpy here
- puts(buf);
- }
+struct XYZ {
+ float x, y, z;
+ XYZ(float a, float b, float c) : x(a), y(b), z(c) {}
+ static const XYZ &getIdentity() {
+ static XYZ iT(1, 2, 3);
+ return iT;
+ }
+};
+struct S {
+ static const XYZ &getIdentity() {
+ static const XYZ iT(XYZ::getIdentity());
+ return iT;
+ }
+};
- struct XYZ {
- float x, y, z;
- XYZ(float a, float b, float c) : x(a), y(b), z(c) { }
- static const XYZ& getIdentity()
- {
- static XYZ iT(1,2,3);
- return iT;
- }
- };
- struct S {
- static const XYZ& getIdentity()
- {
- static const XYZ iT(XYZ::getIdentity());
- return iT;
- }
- };
-
- int main() {
- func = &strcpy;
- conoutfv("*staticccz*");
- printf("*%.2f,%.2f,%.2f*\n", S::getIdentity().x, S::getIdentity().y, S::getIdentity().z);
- return 0;
- }
- \ No newline at end of file
+int main() {
+ func = &strcpy;
+ conoutfv("*staticccz*");
+ printf("*%.2f,%.2f,%.2f*\n", S::getIdentity().x, S::getIdentity().y,
+ S::getIdentity().z);
+ return 0;
+}
diff --git a/tests/core/test_statvfs.in b/tests/core/test_statvfs.in
index f9bd781a..72891505 100644
--- a/tests/core/test_statvfs.in
+++ b/tests/core/test_statvfs.in
@@ -1,26 +1,24 @@
+#include <stdio.h>
+#include <errno.h>
+#include <sys/statvfs.h>
- #include <stdio.h>
- #include <errno.h>
- #include <sys/statvfs.h>
+int main() {
+ struct statvfs s;
- int main() {
- struct statvfs s;
+ printf("result: %d\n", statvfs("/test", &s));
+ printf("errno: %d\n", errno);
- printf("result: %d\n", statvfs("/test", &s));
- printf("errno: %d\n", errno);
+ printf("f_bsize: %lu\n", s.f_bsize);
+ printf("f_frsize: %lu\n", s.f_frsize);
+ printf("f_blocks: %lu\n", s.f_blocks);
+ printf("f_bfree: %lu\n", s.f_bfree);
+ printf("f_bavail: %lu\n", s.f_bavail);
+ printf("f_files: %d\n", s.f_files > 5);
+ printf("f_ffree: %lu\n", s.f_ffree);
+ printf("f_favail: %lu\n", s.f_favail);
+ printf("f_fsid: %lu\n", s.f_fsid);
+ printf("f_flag: %lu\n", s.f_flag);
+ printf("f_namemax: %lu\n", s.f_namemax);
- printf("f_bsize: %lu\n", s.f_bsize);
- printf("f_frsize: %lu\n", s.f_frsize);
- printf("f_blocks: %lu\n", s.f_blocks);
- printf("f_bfree: %lu\n", s.f_bfree);
- printf("f_bavail: %lu\n", s.f_bavail);
- printf("f_files: %d\n", s.f_files > 5);
- printf("f_ffree: %lu\n", s.f_ffree);
- printf("f_favail: %lu\n", s.f_favail);
- printf("f_fsid: %lu\n", s.f_fsid);
- printf("f_flag: %lu\n", s.f_flag);
- printf("f_namemax: %lu\n", s.f_namemax);
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_std_cout_new.in b/tests/core/test_std_cout_new.in
index 20895169..d1ab3c45 100644
--- a/tests/core/test_std_cout_new.in
+++ b/tests/core/test_std_cout_new.in
@@ -1,24 +1,21 @@
+#include <iostream>
- #include <iostream>
+struct NodeInfo { // structure that we want to transmit to our shaders
+ float x;
+ float y;
+ float s;
+ float c;
+};
+const int nbNodes = 100;
+NodeInfo* data = new NodeInfo[nbNodes]; // our data that will be transmitted
+ // using float texture.
- struct NodeInfo { //structure that we want to transmit to our shaders
- float x;
- float y;
- float s;
- float c;
- };
- const int nbNodes = 100;
- NodeInfo * data = new NodeInfo[nbNodes]; //our data that will be transmitted using float texture.
+template <int i>
+void printText(const char (&text)[i]) {
+ std::cout << text << std::endl;
+}
- template<int i>
- void printText( const char (&text)[ i ] )
- {
- std::cout << text << std::endl;
- }
-
- int main()
- {
- printText( "some string constant" );
- return 0;
- }
- \ No newline at end of file
+int main() {
+ printText("some string constant");
+ return 0;
+}
diff --git a/tests/core/test_std_exception.in b/tests/core/test_std_exception.in
index 280faed2..4b5905d8 100644
--- a/tests/core/test_std_exception.in
+++ b/tests/core/test_std_exception.in
@@ -1,15 +1,13 @@
+#include <stdio.h>
+#include <exception>
- #include <stdio.h>
- #include <exception>
-
- int main()
- {
- std::exception e;
- try {
- throw e;
- } catch(std::exception e) {
- printf("caught std::exception\n");
- }
- return 0;
- }
- \ No newline at end of file
+int main() {
+ std::exception e;
+ try {
+ throw e;
+ }
+ catch (std::exception e) {
+ printf("caught std::exception\n");
+ }
+ return 0;
+}
diff --git a/tests/core/test_stdvec.in b/tests/core/test_stdvec.in
index 884933c2..b370eb61 100644
--- a/tests/core/test_stdvec.in
+++ b/tests/core/test_stdvec.in
@@ -1,31 +1,25 @@
+#include <vector>
+#include <stdio.h>
- #include <vector>
- #include <stdio.h>
+struct S {
+ int a;
+ float b;
+};
- struct S {
- int a;
- float b;
- };
+void foo(int a, float b) { printf("%d:%.2f\n", a, b); }
- void foo(int a, float b)
- {
- printf("%d:%.2f\n", a, b);
- }
+int main(int argc, char *argv[]) {
+ std::vector<S> ar;
+ S s;
- int main ( int argc, char *argv[] )
- {
- std::vector<S> ar;
- S s;
+ s.a = 789;
+ s.b = 123.456f;
+ ar.push_back(s);
- s.a = 789;
- s.b = 123.456f;
- ar.push_back(s);
+ s.a = 0;
+ s.b = 100.1f;
+ ar.push_back(s);
- s.a = 0;
- s.b = 100.1f;
- ar.push_back(s);
-
- foo(ar[0].a, ar[0].b);
- foo(ar[1].a, ar[1].b);
- }
- \ No newline at end of file
+ foo(ar[0].a, ar[0].b);
+ foo(ar[1].a, ar[1].b);
+}
diff --git a/tests/core/test_strcasecmp.in b/tests/core/test_strcasecmp.in
index 6186e50b..2fb69d1a 100644
--- a/tests/core/test_strcasecmp.in
+++ b/tests/core/test_strcasecmp.in
@@ -1,81 +1,79 @@
+#include <stdio.h>
+#include <strings.h>
+int sign(int x) {
+ if (x < 0) return -1;
+ if (x > 0) return 1;
+ return 0;
+}
+int main() {
+ printf("*\n");
- #include <stdio.h>
- #include <strings.h>
- int sign(int x) {
- if (x < 0) return -1;
- if (x > 0) return 1;
- return 0;
- }
- int main() {
- printf("*\n");
+ printf("%d\n", sign(strcasecmp("hello", "hello")));
+ printf("%d\n", sign(strcasecmp("hello1", "hello")));
+ printf("%d\n", sign(strcasecmp("hello", "hello1")));
+ printf("%d\n", sign(strcasecmp("hello1", "hello1")));
+ printf("%d\n", sign(strcasecmp("iello", "hello")));
+ printf("%d\n", sign(strcasecmp("hello", "iello")));
+ printf("%d\n", sign(strcasecmp("A", "hello")));
+ printf("%d\n", sign(strcasecmp("Z", "hello")));
+ printf("%d\n", sign(strcasecmp("a", "hello")));
+ printf("%d\n", sign(strcasecmp("z", "hello")));
+ printf("%d\n", sign(strcasecmp("hello", "a")));
+ printf("%d\n", sign(strcasecmp("hello", "z")));
- printf("%d\n", sign(strcasecmp("hello", "hello")));
- printf("%d\n", sign(strcasecmp("hello1", "hello")));
- printf("%d\n", sign(strcasecmp("hello", "hello1")));
- printf("%d\n", sign(strcasecmp("hello1", "hello1")));
- printf("%d\n", sign(strcasecmp("iello", "hello")));
- printf("%d\n", sign(strcasecmp("hello", "iello")));
- printf("%d\n", sign(strcasecmp("A", "hello")));
- printf("%d\n", sign(strcasecmp("Z", "hello")));
- printf("%d\n", sign(strcasecmp("a", "hello")));
- printf("%d\n", sign(strcasecmp("z", "hello")));
- printf("%d\n", sign(strcasecmp("hello", "a")));
- printf("%d\n", sign(strcasecmp("hello", "z")));
+ printf("%d\n", sign(strcasecmp("Hello", "hello")));
+ printf("%d\n", sign(strcasecmp("Hello1", "hello")));
+ printf("%d\n", sign(strcasecmp("Hello", "hello1")));
+ printf("%d\n", sign(strcasecmp("Hello1", "hello1")));
+ printf("%d\n", sign(strcasecmp("Iello", "hello")));
+ printf("%d\n", sign(strcasecmp("Hello", "iello")));
+ printf("%d\n", sign(strcasecmp("A", "hello")));
+ printf("%d\n", sign(strcasecmp("Z", "hello")));
+ printf("%d\n", sign(strcasecmp("a", "hello")));
+ printf("%d\n", sign(strcasecmp("z", "hello")));
+ printf("%d\n", sign(strcasecmp("Hello", "a")));
+ printf("%d\n", sign(strcasecmp("Hello", "z")));
- printf("%d\n", sign(strcasecmp("Hello", "hello")));
- printf("%d\n", sign(strcasecmp("Hello1", "hello")));
- printf("%d\n", sign(strcasecmp("Hello", "hello1")));
- printf("%d\n", sign(strcasecmp("Hello1", "hello1")));
- printf("%d\n", sign(strcasecmp("Iello", "hello")));
- printf("%d\n", sign(strcasecmp("Hello", "iello")));
- printf("%d\n", sign(strcasecmp("A", "hello")));
- printf("%d\n", sign(strcasecmp("Z", "hello")));
- printf("%d\n", sign(strcasecmp("a", "hello")));
- printf("%d\n", sign(strcasecmp("z", "hello")));
- printf("%d\n", sign(strcasecmp("Hello", "a")));
- printf("%d\n", sign(strcasecmp("Hello", "z")));
+ printf("%d\n", sign(strcasecmp("hello", "Hello")));
+ printf("%d\n", sign(strcasecmp("hello1", "Hello")));
+ printf("%d\n", sign(strcasecmp("hello", "Hello1")));
+ printf("%d\n", sign(strcasecmp("hello1", "Hello1")));
+ printf("%d\n", sign(strcasecmp("iello", "Hello")));
+ printf("%d\n", sign(strcasecmp("hello", "Iello")));
+ printf("%d\n", sign(strcasecmp("A", "Hello")));
+ printf("%d\n", sign(strcasecmp("Z", "Hello")));
+ printf("%d\n", sign(strcasecmp("a", "Hello")));
+ printf("%d\n", sign(strcasecmp("z", "Hello")));
+ printf("%d\n", sign(strcasecmp("hello", "a")));
+ printf("%d\n", sign(strcasecmp("hello", "z")));
- printf("%d\n", sign(strcasecmp("hello", "Hello")));
- printf("%d\n", sign(strcasecmp("hello1", "Hello")));
- printf("%d\n", sign(strcasecmp("hello", "Hello1")));
- printf("%d\n", sign(strcasecmp("hello1", "Hello1")));
- printf("%d\n", sign(strcasecmp("iello", "Hello")));
- printf("%d\n", sign(strcasecmp("hello", "Iello")));
- printf("%d\n", sign(strcasecmp("A", "Hello")));
- printf("%d\n", sign(strcasecmp("Z", "Hello")));
- printf("%d\n", sign(strcasecmp("a", "Hello")));
- printf("%d\n", sign(strcasecmp("z", "Hello")));
- printf("%d\n", sign(strcasecmp("hello", "a")));
- printf("%d\n", sign(strcasecmp("hello", "z")));
+ printf("%d\n", sign(strcasecmp("Hello", "Hello")));
+ printf("%d\n", sign(strcasecmp("Hello1", "Hello")));
+ printf("%d\n", sign(strcasecmp("Hello", "Hello1")));
+ printf("%d\n", sign(strcasecmp("Hello1", "Hello1")));
+ printf("%d\n", sign(strcasecmp("Iello", "Hello")));
+ printf("%d\n", sign(strcasecmp("Hello", "Iello")));
+ printf("%d\n", sign(strcasecmp("A", "Hello")));
+ printf("%d\n", sign(strcasecmp("Z", "Hello")));
+ printf("%d\n", sign(strcasecmp("a", "Hello")));
+ printf("%d\n", sign(strcasecmp("z", "Hello")));
+ printf("%d\n", sign(strcasecmp("Hello", "a")));
+ printf("%d\n", sign(strcasecmp("Hello", "z")));
- printf("%d\n", sign(strcasecmp("Hello", "Hello")));
- printf("%d\n", sign(strcasecmp("Hello1", "Hello")));
- printf("%d\n", sign(strcasecmp("Hello", "Hello1")));
- printf("%d\n", sign(strcasecmp("Hello1", "Hello1")));
- printf("%d\n", sign(strcasecmp("Iello", "Hello")));
- printf("%d\n", sign(strcasecmp("Hello", "Iello")));
- printf("%d\n", sign(strcasecmp("A", "Hello")));
- printf("%d\n", sign(strcasecmp("Z", "Hello")));
- printf("%d\n", sign(strcasecmp("a", "Hello")));
- printf("%d\n", sign(strcasecmp("z", "Hello")));
- printf("%d\n", sign(strcasecmp("Hello", "a")));
- printf("%d\n", sign(strcasecmp("Hello", "z")));
+ printf("%d\n", sign(strncasecmp("hello", "hello", 3)));
+ printf("%d\n", sign(strncasecmp("hello1", "hello", 3)));
+ printf("%d\n", sign(strncasecmp("hello", "hello1", 3)));
+ printf("%d\n", sign(strncasecmp("hello1", "hello1", 3)));
+ printf("%d\n", sign(strncasecmp("iello", "hello", 3)));
+ printf("%d\n", sign(strncasecmp("hello", "iello", 3)));
+ printf("%d\n", sign(strncasecmp("A", "hello", 3)));
+ printf("%d\n", sign(strncasecmp("Z", "hello", 3)));
+ printf("%d\n", sign(strncasecmp("a", "hello", 3)));
+ printf("%d\n", sign(strncasecmp("z", "hello", 3)));
+ printf("%d\n", sign(strncasecmp("hello", "a", 3)));
+ printf("%d\n", sign(strncasecmp("hello", "z", 3)));
- printf("%d\n", sign(strncasecmp("hello", "hello", 3)));
- printf("%d\n", sign(strncasecmp("hello1", "hello", 3)));
- printf("%d\n", sign(strncasecmp("hello", "hello1", 3)));
- printf("%d\n", sign(strncasecmp("hello1", "hello1", 3)));
- printf("%d\n", sign(strncasecmp("iello", "hello", 3)));
- printf("%d\n", sign(strncasecmp("hello", "iello", 3)));
- printf("%d\n", sign(strncasecmp("A", "hello", 3)));
- printf("%d\n", sign(strncasecmp("Z", "hello", 3)));
- printf("%d\n", sign(strncasecmp("a", "hello", 3)));
- printf("%d\n", sign(strncasecmp("z", "hello", 3)));
- printf("%d\n", sign(strncasecmp("hello", "a", 3)));
- printf("%d\n", sign(strncasecmp("hello", "z", 3)));
+ printf("*\n");
- printf("*\n");
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_strcmp_uni.in b/tests/core/test_strcmp_uni.in
index 4ccd7db8..82819dde 100644
--- a/tests/core/test_strcmp_uni.in
+++ b/tests/core/test_strcmp_uni.in
@@ -1,11 +1,14 @@
-
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- #define TEST(func) { char *word = "WORD"; char wordEntry[2] = { -61,-126 }; /* "Â"; */ int cmp = func(word, wordEntry, 2); printf("Compare value " #func " is %d\n", cmp); }
- TEST(strncmp);
- TEST(strncasecmp);
- TEST(memcmp);
- }
- \ No newline at end of file
+#include <stdio.h>
+#include <string.h>
+int main() {
+#define TEST(func) \
+ { \
+ char *word = "WORD"; \
+ char wordEntry[2] = {-61, -126}; /* "Â"; */ \
+ int cmp = func(word, wordEntry, 2); \
+ printf("Compare value " #func " is %d\n", cmp); \
+ }
+ TEST(strncmp);
+ TEST(strncasecmp);
+ TEST(memcmp);
+}
diff --git a/tests/core/test_strftime.in b/tests/core/test_strftime.in
index 1897c58a..4a3a7fda 100644
--- a/tests/core/test_strftime.in
+++ b/tests/core/test_strftime.in
@@ -1,153 +1,134 @@
+#include <time.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
- #include <time.h>
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
-
- void test(int result, const char* comment, const char* parsed = "") {
- printf("%d",result);
- if (!result) {
- printf("\nERROR: %s (\"%s\")\n", comment, parsed);
- }
- }
-
- int cmp(const char *s1, const char *s2) {
- for ( ; *s1 == *s2 ; s1++,s2++ ) {
- if ( *s1 == '\0' )
- break;
- }
-
- return (*s1 - *s2);
- }
-
- int main() {
- struct tm tm;
- char s[1000];
- size_t size;
-
- tm.tm_sec = 4;
- tm.tm_min = 23;
- tm.tm_hour = 20;
- tm.tm_mday = 21;
- tm.tm_mon = 1;
- tm.tm_year = 74;
- tm.tm_wday = 4;
- tm.tm_yday = 51;
- tm.tm_isdst = 0;
-
- size = strftime(s, 1000, "", &tm);
- test((size==0) && (*s=='\0'), "strftime test #1", s);
-
- size = strftime(s, 1000, "%a", &tm);
- test((size==3) && !cmp(s, "Thu"), "strftime test #2", s);
-
- size = strftime(s, 1000, "%A", &tm);
- test((size==8) && !cmp(s, "Thursday"), "strftime test #3", s);
-
- size = strftime(s, 1000, "%b", &tm);
- test((size==3) && !cmp(s, "Feb"), "strftime test #4", s);
-
- size = strftime(s, 1000, "%B", &tm);
- test((size==8) && !cmp(s, "February"),
- "strftime test #5", s);
-
- size = strftime(s, 1000, "%d", &tm);
- test((size==2) && !cmp(s, "21"),
- "strftime test #6", s);
-
- size = strftime(s, 1000, "%H", &tm);
- test((size==2) && !cmp(s, "20"),
- "strftime test #7", s);
-
- size = strftime(s, 1000, "%I", &tm);
- test((size==2) && !cmp(s, "08"),
- "strftime test #8", s);
-
- size = strftime(s, 1000, "%j", &tm);
- test((size==3) && !cmp(s, "052"),
- "strftime test #9", s);
-
- size = strftime(s, 1000, "%m", &tm);
- test((size==2) && !cmp(s, "02"),
- "strftime test #10", s);
-
- size = strftime(s, 1000, "%M", &tm);
- test((size==2) && !cmp(s, "23"),
- "strftime test #11", s);
-
- size = strftime(s, 1000, "%p", &tm);
- test((size==2) && !cmp(s, "PM"),
- "strftime test #12", s);
-
- size = strftime(s, 1000, "%S", &tm);
- test((size==2) && !cmp(s, "04"),
- "strftime test #13", s);
-
- size = strftime(s, 1000, "%U", &tm);
- test((size==2) && !cmp(s, "07"),
- "strftime test #14", s);
-
- size = strftime(s, 1000, "%w", &tm);
- test((size==1) && !cmp(s, "4"),
- "strftime test #15", s);
-
- size = strftime(s, 1000, "%W", &tm);
- test((size==2) && !cmp(s, "07"),
- "strftime test #16", s);
-
- size = strftime(s, 1000, "%y", &tm);
- test((size==2) && !cmp(s, "74"),
- "strftime test #17", s);
-
- size = strftime(s, 1000, "%Y", &tm);
- test((size==4) && !cmp(s, "1974"),
- "strftime test #18", s);
-
- size = strftime(s, 1000, "%%", &tm);
- test((size==1) && !cmp(s, "%"),
- "strftime test #19", s);
-
- size = strftime(s, 5, "%Y", &tm);
- test((size==4) && !cmp(s, "1974"),
- "strftime test #20", s);
-
- size = strftime(s, 4, "%Y", &tm);
- test((size==0), "strftime test #21", s);
-
- tm.tm_mon = 0;
- tm.tm_mday = 1;
- size = strftime(s, 10, "%U", &tm);
- test((size==2) && !cmp(s, "00"), "strftime test #22", s);
-
- size = strftime(s, 10, "%W", &tm);
- test((size==2) && !cmp(s, "00"), "strftime test #23", s);
-
- // 1/1/1973 was a Sunday and is in CW 1
- tm.tm_year = 73;
- size = strftime(s, 10, "%W", &tm);
- test((size==2) && !cmp(s, "01"), "strftime test #24", s);
-
- // 1/1/1978 was a Monday and is in CW 1
- tm.tm_year = 78;
- size = strftime(s, 10, "%U", &tm);
- test((size==2) && !cmp(s, "01"), "strftime test #25", s);
-
- // 2/1/1999
- tm.tm_year = 99;
- tm.tm_yday = 1;
- size = strftime(s, 10, "%G (%V)", &tm);
- test((size==9) && !cmp(s, "1998 (53)"), "strftime test #26", s);
+void test(int result, const char* comment, const char* parsed = "") {
+ printf("%d", result);
+ if (!result) {
+ printf("\nERROR: %s (\"%s\")\n", comment, parsed);
+ }
+}
- size = strftime(s, 10, "%g", &tm);
- test((size==2) && !cmp(s, "98"), "strftime test #27", s);
+int cmp(const char* s1, const char* s2) {
+ for (; *s1 == *s2; s1++, s2++) {
+ if (*s1 == '\0') break;
+ }
- // 30/12/1997
- tm.tm_year = 97;
- tm.tm_yday = 363;
- size = strftime(s, 10, "%G (%V)", &tm);
- test((size==9) && !cmp(s, "1998 (01)"), "strftime test #28", s);
-
- size = strftime(s, 10, "%g", &tm);
- test((size==2) && !cmp(s, "98"), "strftime test #29", s);
- }
- \ No newline at end of file
+ return (*s1 - *s2);
+}
+
+int main() {
+ struct tm tm;
+ char s[1000];
+ size_t size;
+
+ tm.tm_sec = 4;
+ tm.tm_min = 23;
+ tm.tm_hour = 20;
+ tm.tm_mday = 21;
+ tm.tm_mon = 1;
+ tm.tm_year = 74;
+ tm.tm_wday = 4;
+ tm.tm_yday = 51;
+ tm.tm_isdst = 0;
+
+ size = strftime(s, 1000, "", &tm);
+ test((size == 0) && (*s == '\0'), "strftime test #1", s);
+
+ size = strftime(s, 1000, "%a", &tm);
+ test((size == 3) && !cmp(s, "Thu"), "strftime test #2", s);
+
+ size = strftime(s, 1000, "%A", &tm);
+ test((size == 8) && !cmp(s, "Thursday"), "strftime test #3", s);
+
+ size = strftime(s, 1000, "%b", &tm);
+ test((size == 3) && !cmp(s, "Feb"), "strftime test #4", s);
+
+ size = strftime(s, 1000, "%B", &tm);
+ test((size == 8) && !cmp(s, "February"), "strftime test #5", s);
+
+ size = strftime(s, 1000, "%d", &tm);
+ test((size == 2) && !cmp(s, "21"), "strftime test #6", s);
+
+ size = strftime(s, 1000, "%H", &tm);
+ test((size == 2) && !cmp(s, "20"), "strftime test #7", s);
+
+ size = strftime(s, 1000, "%I", &tm);
+ test((size == 2) && !cmp(s, "08"), "strftime test #8", s);
+
+ size = strftime(s, 1000, "%j", &tm);
+ test((size == 3) && !cmp(s, "052"), "strftime test #9", s);
+
+ size = strftime(s, 1000, "%m", &tm);
+ test((size == 2) && !cmp(s, "02"), "strftime test #10", s);
+
+ size = strftime(s, 1000, "%M", &tm);
+ test((size == 2) && !cmp(s, "23"), "strftime test #11", s);
+
+ size = strftime(s, 1000, "%p", &tm);
+ test((size == 2) && !cmp(s, "PM"), "strftime test #12", s);
+
+ size = strftime(s, 1000, "%S", &tm);
+ test((size == 2) && !cmp(s, "04"), "strftime test #13", s);
+
+ size = strftime(s, 1000, "%U", &tm);
+ test((size == 2) && !cmp(s, "07"), "strftime test #14", s);
+
+ size = strftime(s, 1000, "%w", &tm);
+ test((size == 1) && !cmp(s, "4"), "strftime test #15", s);
+
+ size = strftime(s, 1000, "%W", &tm);
+ test((size == 2) && !cmp(s, "07"), "strftime test #16", s);
+
+ size = strftime(s, 1000, "%y", &tm);
+ test((size == 2) && !cmp(s, "74"), "strftime test #17", s);
+
+ size = strftime(s, 1000, "%Y", &tm);
+ test((size == 4) && !cmp(s, "1974"), "strftime test #18", s);
+
+ size = strftime(s, 1000, "%%", &tm);
+ test((size == 1) && !cmp(s, "%"), "strftime test #19", s);
+
+ size = strftime(s, 5, "%Y", &tm);
+ test((size == 4) && !cmp(s, "1974"), "strftime test #20", s);
+
+ size = strftime(s, 4, "%Y", &tm);
+ test((size == 0), "strftime test #21", s);
+
+ tm.tm_mon = 0;
+ tm.tm_mday = 1;
+ size = strftime(s, 10, "%U", &tm);
+ test((size == 2) && !cmp(s, "00"), "strftime test #22", s);
+
+ size = strftime(s, 10, "%W", &tm);
+ test((size == 2) && !cmp(s, "00"), "strftime test #23", s);
+
+ // 1/1/1973 was a Sunday and is in CW 1
+ tm.tm_year = 73;
+ size = strftime(s, 10, "%W", &tm);
+ test((size == 2) && !cmp(s, "01"), "strftime test #24", s);
+
+ // 1/1/1978 was a Monday and is in CW 1
+ tm.tm_year = 78;
+ size = strftime(s, 10, "%U", &tm);
+ test((size == 2) && !cmp(s, "01"), "strftime test #25", s);
+
+ // 2/1/1999
+ tm.tm_year = 99;
+ tm.tm_yday = 1;
+ size = strftime(s, 10, "%G (%V)", &tm);
+ test((size == 9) && !cmp(s, "1998 (53)"), "strftime test #26", s);
+
+ size = strftime(s, 10, "%g", &tm);
+ test((size == 2) && !cmp(s, "98"), "strftime test #27", s);
+
+ // 30/12/1997
+ tm.tm_year = 97;
+ tm.tm_yday = 363;
+ size = strftime(s, 10, "%G (%V)", &tm);
+ test((size == 9) && !cmp(s, "1998 (01)"), "strftime test #28", s);
+
+ size = strftime(s, 10, "%g", &tm);
+ test((size == 2) && !cmp(s, "98"), "strftime test #29", s);
+}
diff --git a/tests/core/test_strings.in b/tests/core/test_strings.in
index 6c7e2366..3161b73f 100644
--- a/tests/core/test_strings.in
+++ b/tests/core/test_strings.in
@@ -1,53 +1,54 @@
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-
- int main(int argc, char **argv)
- {
- int x = 5, y = 9, magic = 7; // fool compiler with magic
- memmove(&x, &y, magic-7); // 0 should not crash us
-
- int xx, yy, zz;
- char s[32];
- int cc = sscanf("abc_10.b1_xyz9_543_defg", "abc_%d.%2x_xyz9_%3d_%3s", &xx, &yy, &zz, s);
- printf("%d:%d,%d,%d,%s\n", cc, xx, yy, zz, s);
-
- printf("%d\n", argc);
- puts(argv[1]);
- puts(argv[2]);
- printf("%d\n", atoi(argv[3])+2);
- const char *foolingthecompiler = "\rabcd";
- printf("%d\n", strlen(foolingthecompiler)); // Tests parsing /0D in llvm - should not be a 0 (end string) then a D!
- printf("%s\n", NULL); // Should print '(null)', not the string at address 0, which is a real address for us!
- printf("/* a comment */\n"); // Should not break the generated code!
- printf("// another\n"); // Should not break the generated code!
-
- char* strdup_val = strdup("test");
- printf("%s\n", strdup_val);
- free(strdup_val);
-
- {
- char *one = "one 1 ONE !";
- char *two = "two 2 TWO ?";
- char three[1024];
- memset(three, '.', 1024);
- three[50] = 0;
- strncpy(three + argc, one + (argc/2), argc+1);
- strncpy(three + argc*3, two + (argc/3), argc+2);
- printf("waka %s\n", three);
- }
-
- {
- char *one = "string number one top notch";
- char *two = "fa la sa ho fi FI FO FUM WHEN WHERE WHY HOW WHO";
- char three[1000];
- strcpy(three, &one[argc*2]);
- char *four = strcat(three, &two[argc*3]);
- printf("cat |%s|\n", three);
- printf("returned |%s|\n", four);
- }
-
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main(int argc, char **argv) {
+ int x = 5, y = 9, magic = 7; // fool compiler with magic
+ memmove(&x, &y, magic - 7); // 0 should not crash us
+
+ int xx, yy, zz;
+ char s[32];
+ int cc = sscanf("abc_10.b1_xyz9_543_defg", "abc_%d.%2x_xyz9_%3d_%3s", &xx,
+ &yy, &zz, s);
+ printf("%d:%d,%d,%d,%s\n", cc, xx, yy, zz, s);
+
+ printf("%d\n", argc);
+ puts(argv[1]);
+ puts(argv[2]);
+ printf("%d\n", atoi(argv[3]) + 2);
+ const char *foolingthecompiler = "\rabcd";
+ printf("%d\n", strlen(foolingthecompiler)); // Tests parsing /0D in llvm -
+ // should not be a 0 (end string)
+ // then a D!
+ printf("%s\n", NULL); // Should print '(null)', not the string at address 0,
+ // which is a real address for us!
+ printf("/* a comment */\n"); // Should not break the generated code!
+ printf("// another\n"); // Should not break the generated code!
+
+ char *strdup_val = strdup("test");
+ printf("%s\n", strdup_val);
+ free(strdup_val);
+
+ {
+ char *one = "one 1 ONE !";
+ char *two = "two 2 TWO ?";
+ char three[1024];
+ memset(three, '.', 1024);
+ three[50] = 0;
+ strncpy(three + argc, one + (argc / 2), argc + 1);
+ strncpy(three + argc * 3, two + (argc / 3), argc + 2);
+ printf("waka %s\n", three);
+ }
+
+ {
+ char *one = "string number one top notch";
+ char *two = "fa la sa ho fi FI FO FUM WHEN WHERE WHY HOW WHO";
+ char three[1000];
+ strcpy(three, &one[argc * 2]);
+ char *four = strcat(three, &two[argc * 3]);
+ printf("cat |%s|\n", three);
+ printf("returned |%s|\n", four);
+ }
+
+ return 0;
+}
diff --git a/tests/core/test_strndup.in b/tests/core/test_strndup.in
index 938452a1..2457de0c 100644
--- a/tests/core/test_strndup.in
+++ b/tests/core/test_strndup.in
@@ -1,39 +1,38 @@
+//---------------
+//- http://pubs.opengroup.org/onlinepubs/9699919799/functions/strndup.html
+//---------------
- //---------------
- //- http://pubs.opengroup.org/onlinepubs/9699919799/functions/strndup.html
- //---------------
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
+int main(int argc, char** argv) {
+ const char* source =
+ "strndup - duplicate a specific number of bytes from a string";
- int main(int argc, char **argv) {
- const char* source = "strndup - duplicate a specific number of bytes from a string";
+ char* strdup_val = strndup(source, 0);
+ printf("1:%s\n", strdup_val);
+ free(strdup_val);
- char* strdup_val = strndup(source, 0);
- printf("1:%s\n", strdup_val);
- free(strdup_val);
+ strdup_val = strndup(source, 7);
+ printf("2:%s\n", strdup_val);
+ free(strdup_val);
- strdup_val = strndup(source, 7);
- printf("2:%s\n", strdup_val);
- free(strdup_val);
+ strdup_val = strndup(source, 1000);
+ printf("3:%s\n", strdup_val);
+ free(strdup_val);
- strdup_val = strndup(source, 1000);
- printf("3:%s\n", strdup_val);
- free(strdup_val);
+ strdup_val = strndup(source, 60);
+ printf("4:%s\n", strdup_val);
+ free(strdup_val);
- strdup_val = strndup(source, 60);
- printf("4:%s\n", strdup_val);
- free(strdup_val);
+ strdup_val = strndup(source, 19);
+ printf("5:%s\n", strdup_val);
+ free(strdup_val);
- strdup_val = strndup(source, 19);
- printf("5:%s\n", strdup_val);
- free(strdup_val);
+ strdup_val = strndup(source, -1);
+ printf("6:%s\n", strdup_val);
+ free(strdup_val);
- strdup_val = strndup(source, -1);
- printf("6:%s\n", strdup_val);
- free(strdup_val);
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_strptime_days.in b/tests/core/test_strptime_days.in
index d4f0c079..382ea8ef 100644
--- a/tests/core/test_strptime_days.in
+++ b/tests/core/test_strptime_days.in
@@ -1,34 +1,32 @@
+#include <time.h>
+#include <stdio.h>
+#include <string.h>
- #include <time.h>
- #include <stdio.h>
- #include <string.h>
+static const struct {
+ const char *input;
+ const char *format;
+} day_tests[] = {{"2000-01-01", "%Y-%m-%d"},
+ {"03/03/00", "%D"},
+ {"9/9/99", "%x"},
+ {"19990502123412", "%Y%m%d%H%M%S"},
+ {"2001 20 Mon", "%Y %U %a"},
+ {"2006 4 Fri", "%Y %U %a"},
+ {"2001 21 Mon", "%Y %W %a"},
+ {"2013 29 Wed", "%Y %W %a"},
+ {"2000-01-01 08:12:21 AM", "%Y-%m-%d %I:%M:%S %p"},
+ {"2000-01-01 08:12:21 PM", "%Y-%m-%d %I:%M:%S %p"},
+ {"2001 17 Tue", "%Y %U %a"},
+ {"2001 8 Thursday", "%Y %W %a"}, };
- static const struct {
- const char *input;
- const char *format;
- } day_tests[] = {
- { "2000-01-01", "%Y-%m-%d"},
- { "03/03/00", "%D"},
- { "9/9/99", "%x"},
- { "19990502123412", "%Y%m%d%H%M%S"},
- { "2001 20 Mon", "%Y %U %a"},
- { "2006 4 Fri", "%Y %U %a"},
- { "2001 21 Mon", "%Y %W %a"},
- { "2013 29 Wed", "%Y %W %a"},
- { "2000-01-01 08:12:21 AM", "%Y-%m-%d %I:%M:%S %p"},
- { "2000-01-01 08:12:21 PM", "%Y-%m-%d %I:%M:%S %p"},
- { "2001 17 Tue", "%Y %U %a"},
- { "2001 8 Thursday", "%Y %W %a"},
- };
+int main() {
+ struct tm tm;
- int main() {
- struct tm tm;
+ for (int i = 0; i < sizeof(day_tests) / sizeof(day_tests[0]); ++i) {
+ memset(&tm, '\0', sizeof(tm));
+ char *ptr = strptime(day_tests[i].input, day_tests[i].format, &tm);
- for (int i = 0; i < sizeof (day_tests) / sizeof (day_tests[0]); ++i) {
- memset (&tm, '\0', sizeof (tm));
- char *ptr = strptime(day_tests[i].input, day_tests[i].format, &tm);
-
- printf("%s: %d/%d/%d (%dth DoW, %dth DoY)\n", (ptr != NULL && *ptr=='\0') ? "OK" : "ERR", tm.tm_mon+1, tm.tm_mday, 1900+tm.tm_year, tm.tm_wday, tm.tm_yday);
- }
- }
- \ No newline at end of file
+ printf("%s: %d/%d/%d (%dth DoW, %dth DoY)\n",
+ (ptr != NULL && *ptr == '\0') ? "OK" : "ERR", tm.tm_mon + 1,
+ tm.tm_mday, 1900 + tm.tm_year, tm.tm_wday, tm.tm_yday);
+ }
+}
diff --git a/tests/core/test_strptime_reentrant.in b/tests/core/test_strptime_reentrant.in
index b52d2399..b2a14d1d 100644
--- a/tests/core/test_strptime_reentrant.in
+++ b/tests/core/test_strptime_reentrant.in
@@ -1,47 +1,45 @@
-
- #include <time.h>
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
-
- int main () {
- int result = 0;
- struct tm tm;
-
- memset (&tm, 0xaa, sizeof (tm));
-
- /* Test we don't crash on uninitialized struct tm.
- Some fields might contain bogus values until everything
- needed is initialized, but we shouldn't crash. */
- if (strptime ("2007", "%Y", &tm) == NULL
- || strptime ("12", "%d", &tm) == NULL
- || strptime ("Feb", "%b", &tm) == NULL
- || strptime ("13", "%M", &tm) == NULL
- || strptime ("21", "%S", &tm) == NULL
- || strptime ("16", "%H", &tm) == NULL) {
- printf("ERR: returned NULL");
- exit(EXIT_FAILURE);
- }
-
- if (tm.tm_sec != 21 || tm.tm_min != 13 || tm.tm_hour != 16
- || tm.tm_mday != 12 || tm.tm_mon != 1 || tm.tm_year != 107
- || tm.tm_wday != 1 || tm.tm_yday != 42) {
- printf("ERR: unexpected tm content (1) - %d/%d/%d %d:%d:%d", tm.tm_mon+1, tm.tm_mday, tm.tm_year+1900, tm.tm_hour, tm.tm_min, tm.tm_sec);
- exit(EXIT_FAILURE);
- }
-
- if (strptime ("8", "%d", &tm) == NULL) {
- printf("ERR: strptime failed");
- exit(EXIT_FAILURE);
- }
-
- if (tm.tm_sec != 21 || tm.tm_min != 13 || tm.tm_hour != 16
- || tm.tm_mday != 8 || tm.tm_mon != 1 || tm.tm_year != 107
- || tm.tm_wday != 4 || tm.tm_yday != 38) {
- printf("ERR: unexpected tm content (2) - %d/%d/%d %d:%d:%d", tm.tm_mon+1, tm.tm_mday, tm.tm_year+1900, tm.tm_hour, tm.tm_min, tm.tm_sec);
- exit(EXIT_FAILURE);
- }
-
- printf("OK");
- }
- \ No newline at end of file
+#include <time.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+int main() {
+ int result = 0;
+ struct tm tm;
+
+ memset(&tm, 0xaa, sizeof(tm));
+
+ /* Test we don't crash on uninitialized struct tm.
+ Some fields might contain bogus values until everything
+ needed is initialized, but we shouldn't crash. */
+ if (strptime("2007", "%Y", &tm) == NULL ||
+ strptime("12", "%d", &tm) == NULL || strptime("Feb", "%b", &tm) == NULL ||
+ strptime("13", "%M", &tm) == NULL || strptime("21", "%S", &tm) == NULL ||
+ strptime("16", "%H", &tm) == NULL) {
+ printf("ERR: returned NULL");
+ exit(EXIT_FAILURE);
+ }
+
+ if (tm.tm_sec != 21 || tm.tm_min != 13 || tm.tm_hour != 16 ||
+ tm.tm_mday != 12 || tm.tm_mon != 1 || tm.tm_year != 107 ||
+ tm.tm_wday != 1 || tm.tm_yday != 42) {
+ printf("ERR: unexpected tm content (1) - %d/%d/%d %d:%d:%d", tm.tm_mon + 1,
+ tm.tm_mday, tm.tm_year + 1900, tm.tm_hour, tm.tm_min, tm.tm_sec);
+ exit(EXIT_FAILURE);
+ }
+
+ if (strptime("8", "%d", &tm) == NULL) {
+ printf("ERR: strptime failed");
+ exit(EXIT_FAILURE);
+ }
+
+ if (tm.tm_sec != 21 || tm.tm_min != 13 || tm.tm_hour != 16 ||
+ tm.tm_mday != 8 || tm.tm_mon != 1 || tm.tm_year != 107 ||
+ tm.tm_wday != 4 || tm.tm_yday != 38) {
+ printf("ERR: unexpected tm content (2) - %d/%d/%d %d:%d:%d", tm.tm_mon + 1,
+ tm.tm_mday, tm.tm_year + 1900, tm.tm_hour, tm.tm_min, tm.tm_sec);
+ exit(EXIT_FAILURE);
+ }
+
+ printf("OK");
+}
diff --git a/tests/core/test_strptime_tm.in b/tests/core/test_strptime_tm.in
index 29e40223..93cdb1d5 100644
--- a/tests/core/test_strptime_tm.in
+++ b/tests/core/test_strptime_tm.in
@@ -1,21 +1,27 @@
+#include <time.h>
+#include <stdio.h>
+#include <string.h>
- #include <time.h>
- #include <stdio.h>
- #include <string.h>
+int main() {
+ struct tm tm;
+ char *ptr = strptime("17410105012000", "%H%M%S%d%m%Y", &tm);
- int main() {
- struct tm tm;
- char *ptr = strptime("17410105012000", "%H%M%S%d%m%Y", &tm);
-
- printf("%s: %s, %d/%d/%d %d:%d:%d",
- (ptr != NULL && *ptr=='\0') ? "OK" : "ERR",
- tm.tm_wday == 0 ? "Sun" : (tm.tm_wday == 1 ? "Mon" : (tm.tm_wday == 2 ? "Tue" : (tm.tm_wday == 3 ? "Wed" : (tm.tm_wday == 4 ? "Thu" : (tm.tm_wday == 5 ? "Fri" : (tm.tm_wday == 6 ? "Sat" : "ERR")))))),
- tm.tm_mon+1,
- tm.tm_mday,
- tm.tm_year+1900,
- tm.tm_hour,
- tm.tm_min,
- tm.tm_sec
- );
- }
- \ No newline at end of file
+ printf(
+ "%s: %s, %d/%d/%d %d:%d:%d", (ptr != NULL && *ptr == '\0') ? "OK" : "ERR",
+ tm.tm_wday == 0
+ ? "Sun"
+ : (tm.tm_wday == 1
+ ? "Mon"
+ : (tm.tm_wday == 2
+ ? "Tue"
+ : (tm.tm_wday == 3
+ ? "Wed"
+ : (tm.tm_wday == 4
+ ? "Thu"
+ : (tm.tm_wday == 5
+ ? "Fri"
+ : (tm.tm_wday == 6 ? "Sat"
+ : "ERR")))))),
+ tm.tm_mon + 1, tm.tm_mday, tm.tm_year + 1900, tm.tm_hour, tm.tm_min,
+ tm.tm_sec);
+}
diff --git a/tests/core/test_strstr.in b/tests/core/test_strstr.in
index ab049cac..8aa56d4a 100644
--- a/tests/core/test_strstr.in
+++ b/tests/core/test_strstr.in
@@ -1,35 +1,32 @@
+#include <stdio.h>
+#include <string.h>
- #include <stdio.h>
- #include <string.h>
+int main() {
+ printf("%d\n", !!strstr("\\n", "\\n"));
+ printf("%d\n", !!strstr("cheezy", "ez"));
+ printf("%d\n", !!strstr("cheeezy", "ez"));
+ printf("%d\n", !!strstr("cheeeeeeeeeezy", "ez"));
+ printf("%d\n", !!strstr("cheeeeeeeeee1zy", "ez"));
+ printf("%d\n", !!strstr("che1ezy", "ez"));
+ printf("%d\n", !!strstr("che1ezy", "che"));
+ printf("%d\n", !!strstr("ce1ezy", "che"));
+ printf("%d\n", !!strstr("ce1ezy", "ezy"));
+ printf("%d\n", !!strstr("ce1ezyt", "ezy"));
+ printf("%d\n", !!strstr("ce1ez1y", "ezy"));
+ printf("%d\n", !!strstr("cheezy", "a"));
+ printf("%d\n", !!strstr("cheezy", "b"));
+ printf("%d\n", !!strstr("cheezy", "c"));
+ printf("%d\n", !!strstr("cheezy", "d"));
+ printf("%d\n", !!strstr("cheezy", "g"));
+ printf("%d\n", !!strstr("cheezy", "h"));
+ printf("%d\n", !!strstr("cheezy", "i"));
+ printf("%d\n", !!strstr("cheezy", "e"));
+ printf("%d\n", !!strstr("cheezy", "x"));
+ printf("%d\n", !!strstr("cheezy", "y"));
+ printf("%d\n", !!strstr("cheezy", "z"));
+ printf("%d\n", !!strstr("cheezy", "_"));
- int main()
- {
- printf("%d\n", !!strstr("\\n", "\\n"));
- printf("%d\n", !!strstr("cheezy", "ez"));
- printf("%d\n", !!strstr("cheeezy", "ez"));
- printf("%d\n", !!strstr("cheeeeeeeeeezy", "ez"));
- printf("%d\n", !!strstr("cheeeeeeeeee1zy", "ez"));
- printf("%d\n", !!strstr("che1ezy", "ez"));
- printf("%d\n", !!strstr("che1ezy", "che"));
- printf("%d\n", !!strstr("ce1ezy", "che"));
- printf("%d\n", !!strstr("ce1ezy", "ezy"));
- printf("%d\n", !!strstr("ce1ezyt", "ezy"));
- printf("%d\n", !!strstr("ce1ez1y", "ezy"));
- printf("%d\n", !!strstr("cheezy", "a"));
- printf("%d\n", !!strstr("cheezy", "b"));
- printf("%d\n", !!strstr("cheezy", "c"));
- printf("%d\n", !!strstr("cheezy", "d"));
- printf("%d\n", !!strstr("cheezy", "g"));
- printf("%d\n", !!strstr("cheezy", "h"));
- printf("%d\n", !!strstr("cheezy", "i"));
- printf("%d\n", !!strstr("cheezy", "e"));
- printf("%d\n", !!strstr("cheezy", "x"));
- printf("%d\n", !!strstr("cheezy", "y"));
- printf("%d\n", !!strstr("cheezy", "z"));
- printf("%d\n", !!strstr("cheezy", "_"));
-
- const char *str = "a big string";
- printf("%d\n", strstr(str, "big") - str);
- return 0;
- }
- \ No newline at end of file
+ const char *str = "a big string";
+ printf("%d\n", strstr(str, "big") - str);
+ return 0;
+}
diff --git a/tests/core/test_strtok.in b/tests/core/test_strtok.in
index 6391b9b0..6ef57191 100644
--- a/tests/core/test_strtok.in
+++ b/tests/core/test_strtok.in
@@ -1,20 +1,20 @@
+#include <stdio.h>
+#include <string.h>
- #include<stdio.h>
- #include<string.h>
+int main() {
+ char test[80], blah[80];
+ char *sep = "\\/:;=-";
+ char *word, *phrase, *brkt, *brkb;
- int main() {
- char test[80], blah[80];
- char *sep = "\\/:;=-";
- char *word, *phrase, *brkt, *brkb;
+ strcpy(test, "This;is.a:test:of=the/string\\tokenizer-function.");
- strcpy(test, "This;is.a:test:of=the/string\\tokenizer-function.");
-
- for (word = strtok_r(test, sep, &brkt); word; word = strtok_r(NULL, sep, &brkt)) {
- strcpy(blah, "blah:blat:blab:blag");
- for (phrase = strtok_r(blah, sep, &brkb); phrase; phrase = strtok_r(NULL, sep, &brkb)) {
- printf("at %s:%s\n", word, phrase);
- }
- }
- return 0;
- }
- \ No newline at end of file
+ for (word = strtok_r(test, sep, &brkt); word;
+ word = strtok_r(NULL, sep, &brkt)) {
+ strcpy(blah, "blah:blat:blab:blag");
+ for (phrase = strtok_r(blah, sep, &brkb); phrase;
+ phrase = strtok_r(NULL, sep, &brkb)) {
+ printf("at %s:%s\n", word, phrase);
+ }
+ }
+ return 0;
+}
diff --git a/tests/core/test_strtol_bin.in b/tests/core/test_strtol_bin.in
index 972853ba..e54e0173 100644
--- a/tests/core/test_strtol_bin.in
+++ b/tests/core/test_strtol_bin.in
@@ -1,17 +1,15 @@
+#include <stdio.h>
+#include <stdlib.h>
- #include <stdio.h>
- #include <stdlib.h>
+int main() {
+ const char *STRING = "1 -101 +1011";
+ char *end_char;
- int main() {
- const char *STRING = "1 -101 +1011";
- char *end_char;
+ // defined base
+ long l4 = strtol(STRING, &end_char, 2);
+ long l5 = strtol(end_char, &end_char, 2);
+ long l6 = strtol(end_char, NULL, 2);
- // defined base
- long l4 = strtol(STRING, &end_char, 2);
- long l5 = strtol(end_char, &end_char, 2);
- long l6 = strtol(end_char, NULL, 2);
-
- printf("%d%d%d\n", l4==1, l5==-5, l6==11);
- return 0;
- }
- \ No newline at end of file
+ printf("%d%d%d\n", l4 == 1, l5 == -5, l6 == 11);
+ return 0;
+}
diff --git a/tests/core/test_strtol_dec.in b/tests/core/test_strtol_dec.in
index 496e5dc8..56053521 100644
--- a/tests/core/test_strtol_dec.in
+++ b/tests/core/test_strtol_dec.in
@@ -1,22 +1,21 @@
+#include <stdio.h>
+#include <stdlib.h>
- #include <stdio.h>
- #include <stdlib.h>
+int main() {
+ const char *STRING = "4 -38 +4711";
+ char *end_char;
- int main() {
- const char *STRING = "4 -38 +4711";
- char *end_char;
+ // undefined base
+ long l1 = strtol(STRING, &end_char, 0);
+ long l2 = strtol(end_char, &end_char, 0);
+ long l3 = strtol(end_char, NULL, 0);
- // undefined base
- long l1 = strtol(STRING, &end_char, 0);
- long l2 = strtol(end_char, &end_char, 0);
- long l3 = strtol(end_char, NULL, 0);
+ // defined base
+ long l4 = strtol(STRING, &end_char, 10);
+ long l5 = strtol(end_char, &end_char, 10);
+ long l6 = strtol(end_char, NULL, 10);
- // defined base
- long l4 = strtol(STRING, &end_char, 10);
- long l5 = strtol(end_char, &end_char, 10);
- long l6 = strtol(end_char, NULL, 10);
-
- printf("%d%d%d%d%d%d\n", l1==4, l2==-38, l3==4711, l4==4, l5==-38, l6==4711);
- return 0;
- }
- \ No newline at end of file
+ printf("%d%d%d%d%d%d\n", l1 == 4, l2 == -38, l3 == 4711, l4 == 4, l5 == -38,
+ l6 == 4711);
+ return 0;
+}
diff --git a/tests/core/test_strtol_hex.in b/tests/core/test_strtol_hex.in
index f11d786a..65a43ed0 100644
--- a/tests/core/test_strtol_hex.in
+++ b/tests/core/test_strtol_hex.in
@@ -1,22 +1,21 @@
+#include <stdio.h>
+#include <stdlib.h>
- #include <stdio.h>
- #include <stdlib.h>
+int main() {
+ const char *STRING = "0x4 -0x3A +0xDEAD";
+ char *end_char;
- int main() {
- const char *STRING = "0x4 -0x3A +0xDEAD";
- char *end_char;
+ // undefined base
+ long l1 = strtol(STRING, &end_char, 0);
+ long l2 = strtol(end_char, &end_char, 0);
+ long l3 = strtol(end_char, NULL, 0);
- // undefined base
- long l1 = strtol(STRING, &end_char, 0);
- long l2 = strtol(end_char, &end_char, 0);
- long l3 = strtol(end_char, NULL, 0);
+ // defined base
+ long l4 = strtol(STRING, &end_char, 16);
+ long l5 = strtol(end_char, &end_char, 16);
+ long l6 = strtol(end_char, NULL, 16);
- // defined base
- long l4 = strtol(STRING, &end_char, 16);
- long l5 = strtol(end_char, &end_char, 16);
- long l6 = strtol(end_char, NULL, 16);
-
- printf("%d%d%d%d%d%d\n", l1==0x4, l2==-0x3a, l3==0xdead, l4==0x4, l5==-0x3a, l6==0xdead);
- return 0;
- }
- \ No newline at end of file
+ printf("%d%d%d%d%d%d\n", l1 == 0x4, l2 == -0x3a, l3 == 0xdead, l4 == 0x4,
+ l5 == -0x3a, l6 == 0xdead);
+ return 0;
+}
diff --git a/tests/core/test_strtol_oct.in b/tests/core/test_strtol_oct.in
index a50166a4..94b9c3ff 100644
--- a/tests/core/test_strtol_oct.in
+++ b/tests/core/test_strtol_oct.in
@@ -1,22 +1,21 @@
+#include <stdio.h>
+#include <stdlib.h>
- #include <stdio.h>
- #include <stdlib.h>
+int main() {
+ const char *STRING = "0 -035 +04711";
+ char *end_char;
- int main() {
- const char *STRING = "0 -035 +04711";
- char *end_char;
+ // undefined base
+ long l1 = strtol(STRING, &end_char, 0);
+ long l2 = strtol(end_char, &end_char, 0);
+ long l3 = strtol(end_char, NULL, 0);
- // undefined base
- long l1 = strtol(STRING, &end_char, 0);
- long l2 = strtol(end_char, &end_char, 0);
- long l3 = strtol(end_char, NULL, 0);
+ // defined base
+ long l4 = strtol(STRING, &end_char, 8);
+ long l5 = strtol(end_char, &end_char, 8);
+ long l6 = strtol(end_char, NULL, 8);
- // defined base
- long l4 = strtol(STRING, &end_char, 8);
- long l5 = strtol(end_char, &end_char, 8);
- long l6 = strtol(end_char, NULL, 8);
-
- printf("%d%d%d%d%d%d\n", l1==0, l2==-29, l3==2505, l4==0, l5==-29, l6==2505);
- return 0;
- }
- \ No newline at end of file
+ printf("%d%d%d%d%d%d\n", l1 == 0, l2 == -29, l3 == 2505, l4 == 0, l5 == -29,
+ l6 == 2505);
+ return 0;
+}
diff --git a/tests/core/test_strtoll_bin.in b/tests/core/test_strtoll_bin.in
index ed3c4acf..cbe5546f 100644
--- a/tests/core/test_strtoll_bin.in
+++ b/tests/core/test_strtoll_bin.in
@@ -1,17 +1,15 @@
+#include <stdio.h>
+#include <stdlib.h>
- #include <stdio.h>
- #include <stdlib.h>
+int main() {
+ const char *STRING = "1 -101 +1011";
+ char *end_char;
- int main() {
- const char *STRING = "1 -101 +1011";
- char *end_char;
+ // defined base
+ long long int l4 = strtoll(STRING, &end_char, 2);
+ long long int l5 = strtoll(end_char, &end_char, 2);
+ long long int l6 = strtoll(end_char, NULL, 2);
- // defined base
- long long int l4 = strtoll(STRING, &end_char, 2);
- long long int l5 = strtoll(end_char, &end_char, 2);
- long long int l6 = strtoll(end_char, NULL, 2);
-
- printf("%d%d%d\n", l4==1, l5==-5, l6==11);
- return 0;
- }
- \ No newline at end of file
+ printf("%d%d%d\n", l4 == 1, l5 == -5, l6 == 11);
+ return 0;
+}
diff --git a/tests/core/test_strtoll_dec.in b/tests/core/test_strtoll_dec.in
index fbd5749c..f4d2950e 100644
--- a/tests/core/test_strtoll_dec.in
+++ b/tests/core/test_strtoll_dec.in
@@ -1,22 +1,21 @@
+#include <stdio.h>
+#include <stdlib.h>
- #include <stdio.h>
- #include <stdlib.h>
+int main() {
+ const char *STRING = "4 -38 +4711";
+ char *end_char;
- int main() {
- const char *STRING = "4 -38 +4711";
- char *end_char;
+ // undefined base
+ long long int l1 = strtoll(STRING, &end_char, 0);
+ long long int l2 = strtoll(end_char, &end_char, 0);
+ long long int l3 = strtoll(end_char, NULL, 0);
- // undefined base
- long long int l1 = strtoll(STRING, &end_char, 0);
- long long int l2 = strtoll(end_char, &end_char, 0);
- long long int l3 = strtoll(end_char, NULL, 0);
+ // defined base
+ long long int l4 = strtoll(STRING, &end_char, 10);
+ long long int l5 = strtoll(end_char, &end_char, 10);
+ long long int l6 = strtoll(end_char, NULL, 10);
- // defined base
- long long int l4 = strtoll(STRING, &end_char, 10);
- long long int l5 = strtoll(end_char, &end_char, 10);
- long long int l6 = strtoll(end_char, NULL, 10);
-
- printf("%d%d%d%d%d%d\n", l1==4, l2==-38, l3==4711, l4==4, l5==-38, l6==4711);
- return 0;
- }
- \ No newline at end of file
+ printf("%d%d%d%d%d%d\n", l1 == 4, l2 == -38, l3 == 4711, l4 == 4, l5 == -38,
+ l6 == 4711);
+ return 0;
+}
diff --git a/tests/core/test_strtoll_hex.in b/tests/core/test_strtoll_hex.in
index 333fe512..a432d0dd 100644
--- a/tests/core/test_strtoll_hex.in
+++ b/tests/core/test_strtoll_hex.in
@@ -1,22 +1,21 @@
+#include <stdio.h>
+#include <stdlib.h>
- #include <stdio.h>
- #include <stdlib.h>
+int main() {
+ const char *STRING = "0x4 -0x3A +0xDEADBEEF";
+ char *end_char;
- int main() {
- const char *STRING = "0x4 -0x3A +0xDEADBEEF";
- char *end_char;
+ // undefined base
+ long long int l1 = strtoll(STRING, &end_char, 0);
+ long long int l2 = strtoll(end_char, &end_char, 0);
+ long long int l3 = strtoll(end_char, NULL, 0);
- // undefined base
- long long int l1 = strtoll(STRING, &end_char, 0);
- long long int l2 = strtoll(end_char, &end_char, 0);
- long long int l3 = strtoll(end_char, NULL, 0);
+ // defined base
+ long long int l4 = strtoll(STRING, &end_char, 16);
+ long long int l5 = strtoll(end_char, &end_char, 16);
+ long long int l6 = strtoll(end_char, NULL, 16);
- // defined base
- long long int l4 = strtoll(STRING, &end_char, 16);
- long long int l5 = strtoll(end_char, &end_char, 16);
- long long int l6 = strtoll(end_char, NULL, 16);
-
- printf("%d%d%d%d%d%d\n", l1==0x4, l2==-0x3a, l3==0xdeadbeef, l4==0x4, l5==-0x3a, l6==0xdeadbeef);
- return 0;
- }
- \ No newline at end of file
+ printf("%d%d%d%d%d%d\n", l1 == 0x4, l2 == -0x3a, l3 == 0xdeadbeef, l4 == 0x4,
+ l5 == -0x3a, l6 == 0xdeadbeef);
+ return 0;
+}
diff --git a/tests/core/test_strtoll_oct.in b/tests/core/test_strtoll_oct.in
index 260c7245..e5e12e24 100644
--- a/tests/core/test_strtoll_oct.in
+++ b/tests/core/test_strtoll_oct.in
@@ -1,22 +1,21 @@
+#include <stdio.h>
+#include <stdlib.h>
- #include <stdio.h>
- #include <stdlib.h>
+int main() {
+ const char *STRING = "0 -035 +04711";
+ char *end_char;
- int main() {
- const char *STRING = "0 -035 +04711";
- char *end_char;
+ // undefined base
+ long long int l1 = strtoll(STRING, &end_char, 0);
+ long long int l2 = strtoll(end_char, &end_char, 0);
+ long long int l3 = strtoll(end_char, NULL, 0);
- // undefined base
- long long int l1 = strtoll(STRING, &end_char, 0);
- long long int l2 = strtoll(end_char, &end_char, 0);
- long long int l3 = strtoll(end_char, NULL, 0);
+ // defined base
+ long long int l4 = strtoll(STRING, &end_char, 8);
+ long long int l5 = strtoll(end_char, &end_char, 8);
+ long long int l6 = strtoll(end_char, NULL, 8);
- // defined base
- long long int l4 = strtoll(STRING, &end_char, 8);
- long long int l5 = strtoll(end_char, &end_char, 8);
- long long int l6 = strtoll(end_char, NULL, 8);
-
- printf("%d%d%d%d%d%d\n", l1==0, l2==-29, l3==2505, l4==0, l5==-29, l6==2505);
- return 0;
- }
- \ No newline at end of file
+ printf("%d%d%d%d%d%d\n", l1 == 0, l2 == -29, l3 == 2505, l4 == 0, l5 == -29,
+ l6 == 2505);
+ return 0;
+}
diff --git a/tests/core/test_structs.in b/tests/core/test_structs.in
index 47158351..2d48a9aa 100644
--- a/tests/core/test_structs.in
+++ b/tests/core/test_structs.in
@@ -1,22 +1,21 @@
-
- #include <stdio.h>
- struct S
- {
- int x, y;
- };
- int main()
- {
- S a, b;
- a.x = 5; a.y = 6;
- b.x = 101; b.y = 7009;
- S *c, *d;
- c = &a;
- c->x *= 2;
- c = &b;
- c->y -= 1;
- d = c;
- d->y += 10;
- printf("*%d,%d,%d,%d,%d,%d,%d,%d*\n", a.x, a.y, b.x, b.y, c->x, c->y, d->x, d->y);
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+struct S {
+ int x, y;
+};
+int main() {
+ S a, b;
+ a.x = 5;
+ a.y = 6;
+ b.x = 101;
+ b.y = 7009;
+ S *c, *d;
+ c = &a;
+ c->x *= 2;
+ c = &b;
+ c->y -= 1;
+ d = c;
+ d->y += 10;
+ printf("*%d,%d,%d,%d,%d,%d,%d,%d*\n", a.x, a.y, b.x, b.y, c->x, c->y, d->x,
+ d->y);
+ return 0;
+}
diff --git a/tests/core/test_time_c.in b/tests/core/test_time_c.in
index 57b47217..9719464c 100644
--- a/tests/core/test_time_c.in
+++ b/tests/core/test_time_c.in
@@ -1,9 +1,7 @@
+#include <time.h>
+#include <stdio.h>
- #include <time.h>
- #include <stdio.h>
-
- int main() {
- time_t t = time(0);
- printf("time: %s\n", ctime(&t));
- }
- \ No newline at end of file
+int main() {
+ time_t t = time(0);
+ printf("time: %s\n", ctime(&t));
+}
diff --git a/tests/core/test_timeb.in b/tests/core/test_timeb.in
index baaefb8c..1e59f301 100644
--- a/tests/core/test_timeb.in
+++ b/tests/core/test_timeb.in
@@ -1,15 +1,13 @@
+#include <stdio.h>
+#include <assert.h>
+#include <sys/timeb.h>
- #include <stdio.h>
- #include <assert.h>
- #include <sys/timeb.h>
-
- int main() {
- timeb tb;
- tb.timezone = 1;
- printf("*%d\n", ftime(&tb));
- assert(tb.time > 10000);
- assert(tb.timezone == 0);
- assert(tb.dstflag == 0);
- return 0;
- }
- \ No newline at end of file
+int main() {
+ timeb tb;
+ tb.timezone = 1;
+ printf("*%d\n", ftime(&tb));
+ assert(tb.time > 10000);
+ assert(tb.timezone == 0);
+ assert(tb.dstflag == 0);
+ return 0;
+}
diff --git a/tests/core/test_tinyfuncstr.in b/tests/core/test_tinyfuncstr.in
index ea07ff33..fd1c9563 100644
--- a/tests/core/test_tinyfuncstr.in
+++ b/tests/core/test_tinyfuncstr.in
@@ -1,13 +1,11 @@
+#include <stdio.h>
- #include <stdio.h>
+struct Class {
+ static char *name1() { return "nameA"; }
+ char *name2() { return "nameB"; }
+};
- struct Class {
- static char *name1() { return "nameA"; }
- char *name2() { return "nameB"; }
- };
-
- int main() {
- printf("*%s,%s*\n", Class::name1(), (new Class())->name2());
- return 0;
- }
- \ No newline at end of file
+int main() {
+ printf("*%s,%s*\n", Class::name1(), (new Class())->name2());
+ return 0;
+}
diff --git a/tests/core/test_transtrcase.in b/tests/core/test_transtrcase.in
index 0592405e..a19fcb6e 100644
--- a/tests/core/test_transtrcase.in
+++ b/tests/core/test_transtrcase.in
@@ -1,13 +1,11 @@
-
- #include <stdio.h>
- #include <string.h>
- int main() {
- char szToupr[] = "hello, ";
- char szTolwr[] = "EMSCRIPTEN";
- strupr(szToupr);
- strlwr(szTolwr);
- printf(szToupr);
- printf(szTolwr);
- return 0;
- }
- \ No newline at end of file
+#include <stdio.h>
+#include <string.h>
+int main() {
+ char szToupr[] = "hello, ";
+ char szTolwr[] = "EMSCRIPTEN";
+ strupr(szToupr);
+ strlwr(szTolwr);
+ printf(szToupr);
+ printf(szTolwr);
+ return 0;
+}
diff --git a/tests/core/test_trickystring.in b/tests/core/test_trickystring.in
index 95744369..2735ef7c 100644
--- a/tests/core/test_trickystring.in
+++ b/tests/core/test_trickystring.in
@@ -1,26 +1,16 @@
+#include <stdio.h>
- #include <stdio.h>
+typedef struct {
+ int (*f)(void *);
+ void *d;
+ char s[16];
+} LMEXFunctionStruct;
- typedef struct
- {
- int (*f)(void *);
- void *d;
- char s[16];
- } LMEXFunctionStruct;
+int f(void *user) { return 0; }
- int f(void *user)
- {
- return 0;
- }
+static LMEXFunctionStruct const a[] = {{f, (void *)(int)'a', "aa"}};
- static LMEXFunctionStruct const a[] =
- {
- {f, (void *)(int)'a', "aa"}
- };
-
- int main()
- {
- printf("ok\n");
- return a[0].f(a[0].d);
- }
- \ No newline at end of file
+int main() {
+ printf("ok\n");
+ return a[0].f(a[0].d);
+}
diff --git a/tests/core/test_typeid.in b/tests/core/test_typeid.in
index fc777183..1f87e66e 100644
--- a/tests/core/test_typeid.in
+++ b/tests/core/test_typeid.in
@@ -1,53 +1,52 @@
-
- #include <stdio.h>
- #include <string.h>
- #include <typeinfo>
- int main() {
- printf("*\n");
- #define MAX 100
- int ptrs[MAX];
- int groups[MAX];
- memset(ptrs, 0, MAX*sizeof(int));
- memset(groups, 0, MAX*sizeof(int));
- int next_group = 1;
- #define TEST(X) { \
- int ptr = (int)&typeid(X); \
- int group = 0; \
- int i; \
- for (i = 0; i < MAX; i++) { \
- if (!groups[i]) break; \
- if (ptrs[i] == ptr) { \
- group = groups[i]; \
- break; \
- } \
- } \
- if (!group) { \
- groups[i] = group = next_group++; \
- ptrs[i] = ptr; \
- } \
- printf("%s:%d\n", #X, group); \
- }
- TEST(int);
- TEST(unsigned int);
- TEST(unsigned);
- TEST(signed int);
- TEST(long);
- TEST(unsigned long);
- TEST(signed long);
- TEST(long long);
- TEST(unsigned long long);
- TEST(signed long long);
- TEST(short);
- TEST(unsigned short);
- TEST(signed short);
- TEST(char);
- TEST(unsigned char);
- TEST(signed char);
- TEST(float);
- TEST(double);
- TEST(long double);
- TEST(void);
- TEST(void*);
- printf("*\n");
- }
- \ No newline at end of file
+#include <stdio.h>
+#include <string.h>
+#include <typeinfo>
+int main() {
+ printf("*\n");
+#define MAX 100
+ int ptrs[MAX];
+ int groups[MAX];
+ memset(ptrs, 0, MAX * sizeof(int));
+ memset(groups, 0, MAX * sizeof(int));
+ int next_group = 1;
+#define TEST(X) \
+ { \
+ int ptr = (int)&typeid(X); \
+ int group = 0; \
+ int i; \
+ for (i = 0; i < MAX; i++) { \
+ if (!groups[i]) break; \
+ if (ptrs[i] == ptr) { \
+ group = groups[i]; \
+ break; \
+ } \
+ } \
+ if (!group) { \
+ groups[i] = group = next_group++; \
+ ptrs[i] = ptr; \
+ } \
+ printf("%s:%d\n", #X, group); \
+ }
+ TEST(int);
+ TEST(unsigned int);
+ TEST(unsigned);
+ TEST(signed int);
+ TEST(long);
+ TEST(unsigned long);
+ TEST(signed long);
+ TEST(long long);
+ TEST(unsigned long long);
+ TEST(signed long long);
+ TEST(short);
+ TEST(unsigned short);
+ TEST(signed short);
+ TEST(char);
+ TEST(unsigned char);
+ TEST(signed char);
+ TEST(float);
+ TEST(double);
+ TEST(long double);
+ TEST(void);
+ TEST(void*);
+ printf("*\n");
+}
diff --git a/tests/core/test_uname.in b/tests/core/test_uname.in
index 5ea40b06..780a754b 100644
--- a/tests/core/test_uname.in
+++ b/tests/core/test_uname.in
@@ -1,16 +1,14 @@
+#include <stdio.h>
+#include <sys/utsname.h>
- #include <stdio.h>
- #include <sys/utsname.h>
-
- int main() {
- struct utsname u;
- printf("ret: %d\n", uname(&u));
- printf("sysname: %s\n", u.sysname);
- printf("nodename: %s\n", u.nodename);
- printf("release: %s\n", u.release);
- printf("version: %s\n", u.version);
- printf("machine: %s\n", u.machine);
- printf("invalid: %d\n", uname(0));
- return 0;
- }
- \ No newline at end of file
+int main() {
+ struct utsname u;
+ printf("ret: %d\n", uname(&u));
+ printf("sysname: %s\n", u.sysname);
+ printf("nodename: %s\n", u.nodename);
+ printf("release: %s\n", u.release);
+ printf("version: %s\n", u.version);
+ printf("machine: %s\n", u.machine);
+ printf("invalid: %d\n", uname(0));
+ return 0;
+}
diff --git a/tests/core/test_utf.in b/tests/core/test_utf.in
index 29cb6eac..87731186 100644
--- a/tests/core/test_utf.in
+++ b/tests/core/test_utf.in
@@ -1,13 +1,15 @@
+#include <stdio.h>
+#include <emscripten.h>
- #include <stdio.h>
- #include <emscripten.h>
-
- int main() {
- char *c = "μ†ℱ ╋ℯ╳╋ 😇";
- printf("%d %d %d %d %s\n", c[0]&0xff, c[1]&0xff, c[2]&0xff, c[3]&0xff, c);
- emscripten_run_script(
- "cheez = _malloc(100);"
- "Module.writeStringToMemory(\"μ†ℱ ╋ℯ╳╋ 😇\", cheez);"
- "Module.print([Pointer_stringify(cheez), Module.getValue(cheez, 'i8')&0xff, Module.getValue(cheez+1, 'i8')&0xff, Module.getValue(cheez+2, 'i8')&0xff, Module.getValue(cheez+3, 'i8')&0xff, ]);");
- }
- \ No newline at end of file
+int main() {
+ char *c = "μ†ℱ ╋ℯ╳╋ 😇";
+ printf("%d %d %d %d %s\n", c[0] & 0xff, c[1] & 0xff, c[2] & 0xff, c[3] & 0xff,
+ c);
+ emscripten_run_script(
+ "cheez = _malloc(100);"
+ "Module.writeStringToMemory(\"μ†ℱ ╋ℯ╳╋ 😇\", cheez);"
+ "Module.print([Pointer_stringify(cheez), Module.getValue(cheez, "
+ "'i8')&0xff, Module.getValue(cheez+1, 'i8')&0xff, "
+ "Module.getValue(cheez+2, 'i8')&0xff, Module.getValue(cheez+3, "
+ "'i8')&0xff, ]);");
+}
diff --git a/tests/core/test_varargs.in b/tests/core/test_varargs.in
index d169c151..653a6557 100644
--- a/tests/core/test_varargs.in
+++ b/tests/core/test_varargs.in
@@ -1,103 +1,112 @@
+#include <stdio.h>
+#include <stdarg.h>
- #include <stdio.h>
- #include <stdarg.h>
-
- void vary(const char *s, ...)
- {
- va_list v;
- va_start(v, s);
- char d[20];
- vsnprintf(d, 20, s, v);
- puts(d);
-
- // Try it with copying
- va_list tempva;
- va_copy(tempva, v);
- vsnprintf(d, 20, s, tempva);
- puts(d);
-
- va_end(v);
- }
-
- void vary2(char color, const char *s, ...)
- {
- va_list v;
- va_start(v, s);
- char d[21];
- d[0] = color;
- vsnprintf(d+1, 20, s, v);
- puts(d);
- va_end(v);
- }
-
- void varargs_listoffsets_list_evaluate(int count, va_list ap, int vaIteration)
- {
- while(count > 0)
- {
- const char* string = va_arg(ap, const char*);
- printf("%s", string);
- count--;
- }
- printf("\n");
- }
-
- void varags_listoffsets_list_copy(int count, va_list ap, int iteration)
- {
- va_list ap_copy;
- va_copy(ap_copy, ap);
- varargs_listoffsets_list_evaluate(count, ap_copy, iteration);
- va_end(ap_copy);
- }
-
- void varargs_listoffsets_args(int type, int count, ...)
- {
- va_list ap;
- va_start(ap, count);
-
- // evaluate a copied list
- varags_listoffsets_list_copy(count, ap, 1);
- varags_listoffsets_list_copy(count, ap, 2);
- varags_listoffsets_list_copy(count, ap, 3);
- varags_listoffsets_list_copy(count, ap, 4);
-
- varargs_listoffsets_list_evaluate(count, ap, 1);
-
- // NOTE: we expect this test to fail, so we will check the stdout for <BAD+0><BAD+1>.....
- varargs_listoffsets_list_evaluate(count, ap, 2);
-
- // NOTE: this test has to work again, as we restart the list
- va_end(ap);
- va_start(ap, count);
- varargs_listoffsets_list_evaluate(count, ap, 3);
- va_end(ap);
- }
-
- void varargs_listoffsets_main()
- {
- varargs_listoffsets_args(0, 5, "abc", "def", "ghi", "jkl", "mno", "<BAD+0>", "<BAD+1>", "<BAD+2>", "<BAD+3>", "<BAD+4>", "<BAD+5>", "<BAD+6>", "<BAD+7>", "<BAD+8>", "<BAD+9>", "<BAD+10>", "<BAD+11>", "<BAD+12>", "<BAD+13>", "<BAD+14>", "<BAD+15>", "<BAD+16>");
- }
-
- #define GETMAX(pref, type) type getMax##pref(int num, ...) { va_list vv; va_start(vv, num); type maxx = va_arg(vv, type); for (int i = 1; i < num; i++) { type curr = va_arg(vv, type); maxx = curr > maxx ? curr : maxx; } va_end(vv); return maxx; }
- GETMAX(i, int);
- GETMAX(D, double);
-
- int main(int argc, char **argv) {
- vary("*cheez: %d+%d*", 0, 24); // Also tests that '0' is not special as an array ender
- vary("*albeit*"); // Should not fail with no var args in vararg function
- vary2('Q', "%d*", 85);
-
- int maxxi = getMaxi(6, 2, 5, 21, 4, -10, 19);
- printf("maxxi:%d*\n", maxxi);
- double maxxD = getMaxD(6, (double)2.1, (double)5.1, (double)22.1, (double)4.1, (double)-10.1, (double)19.1, (double)2);
- printf("maxxD:%.2f*\n", (float)maxxD);
-
- // And, as a function pointer
- void (*vfp)(const char *s, ...) = argc == 1211 ? NULL : vary;
- vfp("*vfp:%d,%d*", 22, 199);
-
- // ensure lists work properly when copied, reinited etc.
- varargs_listoffsets_main();
-
- return 0;
- }
- \ No newline at end of file
+void vary(const char *s, ...) {
+ va_list v;
+ va_start(v, s);
+ char d[20];
+ vsnprintf(d, 20, s, v);
+ puts(d);
+
+ // Try it with copying
+ va_list tempva;
+ va_copy(tempva, v);
+ vsnprintf(d, 20, s, tempva);
+ puts(d);
+
+ va_end(v);
+}
+
+void vary2(char color, const char *s, ...) {
+ va_list v;
+ va_start(v, s);
+ char d[21];
+ d[0] = color;
+ vsnprintf(d + 1, 20, s, v);
+ puts(d);
+ va_end(v);
+}
+
+void varargs_listoffsets_list_evaluate(int count, va_list ap, int vaIteration) {
+ while (count > 0) {
+ const char *string = va_arg(ap, const char *);
+ printf("%s", string);
+ count--;
+ }
+ printf("\n");
+}
+
+void varags_listoffsets_list_copy(int count, va_list ap, int iteration) {
+ va_list ap_copy;
+ va_copy(ap_copy, ap);
+ varargs_listoffsets_list_evaluate(count, ap_copy, iteration);
+ va_end(ap_copy);
+}
+
+void varargs_listoffsets_args(int type, int count, ...) {
+ va_list ap;
+ va_start(ap, count);
+
+ // evaluate a copied list
+ varags_listoffsets_list_copy(count, ap, 1);
+ varags_listoffsets_list_copy(count, ap, 2);
+ varags_listoffsets_list_copy(count, ap, 3);
+ varags_listoffsets_list_copy(count, ap, 4);
+
+ varargs_listoffsets_list_evaluate(count, ap, 1);
+
+ // NOTE: we expect this test to fail, so we will check the stdout for
+ // <BAD+0><BAD+1>.....
+ varargs_listoffsets_list_evaluate(count, ap, 2);
+
+ // NOTE: this test has to work again, as we restart the list
+ va_end(ap);
+ va_start(ap, count);
+ varargs_listoffsets_list_evaluate(count, ap, 3);
+ va_end(ap);
+}
+
+void varargs_listoffsets_main() {
+ varargs_listoffsets_args(0, 5, "abc", "def", "ghi", "jkl", "mno", "<BAD+0>",
+ "<BAD+1>", "<BAD+2>", "<BAD+3>", "<BAD+4>",
+ "<BAD+5>", "<BAD+6>", "<BAD+7>", "<BAD+8>",
+ "<BAD+9>", "<BAD+10>", "<BAD+11>", "<BAD+12>",
+ "<BAD+13>", "<BAD+14>", "<BAD+15>", "<BAD+16>");
+}
+
+#define GETMAX(pref, type) \
+ type getMax##pref(int num, ...) { \
+ va_list vv; \
+ va_start(vv, num); \
+ type maxx = va_arg(vv, type); \
+ for (int i = 1; i < num; i++) { \
+ type curr = va_arg(vv, type); \
+ maxx = curr > maxx ? curr : maxx; \
+ } \
+ va_end(vv); \
+ return maxx; \
+ }
+GETMAX(i, int);
+GETMAX(D, double);
+
+int main(int argc, char **argv) {
+ vary("*cheez: %d+%d*", 0,
+ 24); // Also tests that '0' is not special as an array ender
+ vary("*albeit*"); // Should not fail with no var args in vararg function
+ vary2('Q', "%d*", 85);
+
+ int maxxi = getMaxi(6, 2, 5, 21, 4, -10, 19);
+ printf("maxxi:%d*\n", maxxi);
+ double maxxD = getMaxD(6, (double)2.1, (double)5.1, (double)22.1, (double)4.1,
+ (double)-10.1, (double)19.1, (double)2);
+ printf("maxxD:%.2f*\n", (float)maxxD);
+
+ // And, as a function pointer
+ void (*vfp)(const char * s, ...) = argc == 1211 ? NULL : vary;
+ vfp("*vfp:%d,%d*", 22, 199);
+
+ // ensure lists work properly when copied, reinited etc.
+ varargs_listoffsets_main();
+
+ return 0;
+}
diff --git a/tests/core/test_vprintf.in b/tests/core/test_vprintf.in
index fcaad9d9..a8af5735 100644
--- a/tests/core/test_vprintf.in
+++ b/tests/core/test_vprintf.in
@@ -1,18 +1,16 @@
+#include <stdio.h>
+#include <stdarg.h>
- #include <stdio.h>
- #include <stdarg.h>
+void print(char* format, ...) {
+ va_list args;
+ va_start(args, format);
+ vprintf(format, args);
+ va_end(args);
+}
- void print(char* format, ...) {
- va_list args;
- va_start (args, format);
- vprintf (format, args);
- va_end (args);
- }
+int main() {
+ print("Call with %d variable argument.\n", 1);
+ print("Call with %d variable %s.\n", 2, "arguments");
- int main () {
- print("Call with %d variable argument.\n", 1);
- print("Call with %d variable %s.\n", 2, "arguments");
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_vsnprintf.in b/tests/core/test_vsnprintf.in
index 938729b6..85f91e94 100644
--- a/tests/core/test_vsnprintf.in
+++ b/tests/core/test_vsnprintf.in
@@ -1,44 +1,41 @@
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdint.h>
- #include <stdio.h>
- #include <stdarg.h>
- #include <stdint.h>
+void printy(const char *f, ...) {
+ char buffer[256];
+ va_list args;
+ va_start(args, f);
+ vsnprintf(buffer, 256, f, args);
+ puts(buffer);
+ va_end(args);
+}
- void printy(const char *f, ...)
- {
- char buffer[256];
- va_list args;
- va_start(args, f);
- vsnprintf(buffer, 256, f, args);
- puts(buffer);
- va_end(args);
- }
+int main(int argc, char **argv) {
+ int64_t x = argc - 1;
+ int64_t y = argc - 1 + 0x400000;
+ if (x % 3 == 2) y *= 2;
- int main(int argc, char **argv) {
- int64_t x = argc - 1;
- int64_t y = argc - 1 + 0x400000;
- if (x % 3 == 2) y *= 2;
+ printy("0x%llx_0x%llx", x, y);
+ printy("0x%llx_0x%llx", x, x);
+ printy("0x%llx_0x%llx", y, x);
+ printy("0x%llx_0x%llx", y, y);
- printy("0x%llx_0x%llx", x, y);
- printy("0x%llx_0x%llx", x, x);
- printy("0x%llx_0x%llx", y, x);
- printy("0x%llx_0x%llx", y, y);
+ {
+ uint64_t A = 0x800000;
+ uint64_t B = 0x800000000000ULL;
+ printy("0x%llx_0x%llx", A, B);
+ }
+ {
+ uint64_t A = 0x800;
+ uint64_t B = 0x12340000000000ULL;
+ printy("0x%llx_0x%llx", A, B);
+ }
+ {
+ uint64_t A = 0x000009182746756;
+ uint64_t B = 0x192837465631ACBDULL;
+ printy("0x%llx_0x%llx", A, B);
+ }
- {
- uint64_t A = 0x800000;
- uint64_t B = 0x800000000000ULL;
- printy("0x%llx_0x%llx", A, B);
- }
- {
- uint64_t A = 0x800;
- uint64_t B = 0x12340000000000ULL;
- printy("0x%llx_0x%llx", A, B);
- }
- {
- uint64_t A = 0x000009182746756;
- uint64_t B = 0x192837465631ACBDULL;
- printy("0x%llx_0x%llx", A, B);
- }
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/core/test_white_list_exception.in b/tests/core/test_white_list_exception.in
index c7c29c35..2944f9fe 100644
--- a/tests/core/test_white_list_exception.in
+++ b/tests/core/test_white_list_exception.in
@@ -1,22 +1,21 @@
+#include <stdio.h>
- #include <stdio.h>
+void thrower() {
+ printf("infunc...");
+ throw(99);
+ printf("FAIL");
+}
- void thrower() {
- printf("infunc...");
- throw(99);
- printf("FAIL");
- }
+void somefunction() {
+ try {
+ thrower();
+ }
+ catch (...) {
+ printf("done!*\n");
+ }
+}
- void somefunction() {
- try {
- thrower();
- } catch(...) {
- printf("done!*\n");
- }
- }
-
- int main() {
- somefunction();
- return 0;
- }
- \ No newline at end of file
+int main() {
+ somefunction();
+ return 0;
+}
diff --git a/tests/core/test_zero_multiplication.in b/tests/core/test_zero_multiplication.in
index 2be87594..bb6e7e12 100644
--- a/tests/core/test_zero_multiplication.in
+++ b/tests/core/test_zero_multiplication.in
@@ -1,14 +1,12 @@
+#include <stdio.h>
+int main(int argc, char* argv[]) {
+ int one = argc;
- #include <stdio.h>
- int main(int argc, char * argv[]) {
- int one = argc;
-
- printf("%d ", 0 * one);
- printf("%d ", 0 * -one);
- printf("%d ", -one * 0);
- printf("%g ", 0.0 * one);
- printf("%g ", 0.0 * -one);
- printf("%g", -one * 0.0);
- return 0;
- }
- \ No newline at end of file
+ printf("%d ", 0 * one);
+ printf("%d ", 0 * -one);
+ printf("%d ", -one * 0);
+ printf("%g ", 0.0 * one);
+ printf("%g ", 0.0 * -one);
+ printf("%g", -one * 0.0);
+ return 0;
+}
diff --git a/tests/core/test_zerodiv.in b/tests/core/test_zerodiv.in
index 991b6c1d..21430772 100644
--- a/tests/core/test_zerodiv.in
+++ b/tests/core/test_zerodiv.in
@@ -1,21 +1,18 @@
+#include <stdio.h>
+int main(int argc, const char* argv[]) {
+ float f1 = 1.0f;
+ float f2 = 0.0f;
+ float f_zero = 0.0f;
- #include <stdio.h>
- int main(int argc, const char* argv[])
- {
- float f1 = 1.0f;
- float f2 = 0.0f;
- float f_zero = 0.0f;
+ float f3 = 0.0f / f2;
+ float f4 = f2 / 0.0f;
+ float f5 = f2 / f2;
+ float f6 = f2 / f_zero;
- float f3 = 0.0f / f2;
- float f4 = f2 / 0.0f;
- float f5 = f2 / f2;
- float f6 = f2 / f_zero;
+ printf("f3: %f\n", f3);
+ printf("f4: %f\n", f4);
+ printf("f5: %f\n", f5);
+ printf("f6: %f\n", f6);
- printf("f3: %f\n", f3);
- printf("f4: %f\n", f4);
- printf("f5: %f\n", f5);
- printf("f6: %f\n", f6);
-
- return 0;
- }
- \ No newline at end of file
+ return 0;
+}
diff --git a/tests/emscripten_log/emscripten_log.cpp b/tests/emscripten_log/emscripten_log.cpp
new file mode 100644
index 00000000..a5bb8432
--- /dev/null
+++ b/tests/emscripten_log/emscripten_log.cpp
@@ -0,0 +1,136 @@
+#include <emscripten.h>
+#include <stdio.h>
+#include <cstring>
+
+#define STRINGIZE_HELPER(x) #x
+#define STRINGIZE(x) STRINGIZE_HELPER(x)
+
+#ifndef REPORT_RESULT
+#define REPORT_RESULT int dummy
+#endif
+
+int result = 1; // If 1, this test succeeded.
+
+// A custom assert macro to test varargs routing to emscripten_log().
+#define MYASSERT(condition, ...) \
+ do { \
+ if (!(condition)) { \
+ emscripten_log(EM_LOG_ERROR, "%s", "Condition '" #condition "' failed in file " __FILE__ ":" STRINGIZE(__LINE__) "!"); \
+ emscripten_log(EM_LOG_ERROR, ##__VA_ARGS__); \
+ result = 0; \
+ } \
+ } while(0)
+
+void __attribute__((noinline)) kitten()
+{
+ // Log to Emscripten Module.
+ emscripten_log(EM_LOG_NO_PATHS, "Print a log message: int: %d, string: %s.", 42, "hello");
+ emscripten_log(EM_LOG_NO_PATHS | EM_LOG_WARN, "Print a warning message");
+ emscripten_log(EM_LOG_NO_PATHS | EM_LOG_ERROR, "This is an error!");
+
+ // Log directly to Browser web inspector/console.
+ emscripten_log(EM_LOG_NO_PATHS | EM_LOG_CONSOLE, "Info log to console: int: %d, string: %s", 42, "hello");
+ emscripten_log(EM_LOG_NO_PATHS | EM_LOG_CONSOLE | EM_LOG_WARN, "Warning message to console.");
+ emscripten_log(EM_LOG_NO_PATHS | EM_LOG_CONSOLE | EM_LOG_ERROR, "Error message to console! This should appear in red!");
+
+ // Log to with full callstack information (both original C source and JS callstacks):
+ emscripten_log(EM_LOG_C_STACK | EM_LOG_JS_STACK | EM_LOG_DEMANGLE, "A message with as full call stack information as possible:");
+
+ // Log with just mangled JS callstacks:
+ emscripten_log(EM_LOG_NO_PATHS | EM_LOG_JS_STACK, "This is a message with a mangled JS callstack:");
+
+ // Log only clean C callstack:
+ emscripten_log(EM_LOG_NO_PATHS | EM_LOG_C_STACK | EM_LOG_DEMANGLE, "This message should have a clean C callstack:");
+
+ // We can leave out the message to just print out the callstack:
+ printf("The following line should show just the callstack without a message:\n");
+ emscripten_log(EM_LOG_NO_PATHS | EM_LOG_ERROR | EM_LOG_C_STACK | EM_LOG_JS_STACK | EM_LOG_DEMANGLE);
+}
+
+void __attribute__((noinline)) bar(int = 0, char * = 0, double = 0) // Arbitrary function signature to add some content to callstack.
+{
+ if (1 == 2)
+ MYASSERT(2 == 1, "World falls apart!");
+ else
+ MYASSERT(1 == 1);
+
+ int flags = EM_LOG_NO_PATHS | EM_LOG_JS_STACK | EM_LOG_DEMANGLE | EM_LOG_FUNC_PARAMS;
+#ifndef RUN_FROM_JS_SHELL
+ flags |= EM_LOG_C_STACK;
+#endif
+
+ // We can programmatically get the callstack.
+ // 1. Ask for callstack length:
+ int nbytes = emscripten_get_callstack(flags, 0, 0);
+ // 2. Allocate temp memory to hold the callstack.
+ char *callstack = new char[nbytes];
+ // 3. Obtain it.
+ // 4. Do something with the callstack string.
+
+ emscripten_get_callstack(flags, callstack, nbytes);
+
+ /* The callstack should be something like
+ at bar(int, char*, double) (src.cpp.o.js:5383:12)
+ at void Foo<int>() (src.cpp.o.js:5417:4)
+ at main() (src.cpp.o.js:5404:2)
+ at Object.callMain (src.cpp.o.js:71344:30)
+ at doRun (src.cpp.o.js:71383:25)
+ at run (src.cpp.o.js:71396:5)
+ at Object.<anonymous> (src.cpp.o.js:71439:1)
+ at Module._compile (module.js:456:26)
+
+ but the line numbers will greatly vary depending on the mode we are compiling in, so cannot test with direct string comparison. */
+
+ if ((flags & EM_LOG_C_STACK) != 0)
+ {
+ MYASSERT(!!strstr(callstack, "at bar(int, char*, double) (src.cpp:"), "Callstack was %s!", callstack);
+ MYASSERT(!!strstr(callstack, "at void Foo<int>() (src.cpp:"), "Callstack was %s!", callstack);
+ }
+ else
+ {
+ MYASSERT(!!strstr(callstack, "at bar(int, char*, double) (src.cpp.o.js:"), "Callstack was %s!", callstack);
+ MYASSERT(!!strstr(callstack, "at void Foo<int>() (src.cpp.o.js:"), "Callstack was %s!", callstack);
+ }
+
+ // 5. Clean up.
+ delete[] callstack;
+
+ // Or alternatively use a fixed-size buffer for the callstack (and get a truncated output if it was too small).
+ char str[1024];
+ emscripten_get_callstack(EM_LOG_NO_PATHS | EM_LOG_JS_STACK, str, 1024);
+
+ /* With EM_LOG_JS_STACK, the callstack will be
+ at __Z3bariPcd (src.cpp.o.js:5394:12)
+ at __Z3FooIiEvv (src.cpp.o.js:5417:4)
+ at Object._main (src.cpp.o.js:5404:2)
+ at Object.callMain (src.cpp.o.js:71344:30)
+ at doRun (src.cpp.o.js:71383:25)
+ at run (src.cpp.o.js:71396:5)
+ at Object.<anonymous> (src.cpp.o.js:71439:1)
+ at Module._compile (module.js:456:26) */
+#ifdef RUN_FROM_JS_SHELL
+ MYASSERT(!!strstr(str, "at __Z3bariPcd (src.cpp"), "Callstack was %s!", str);
+ MYASSERT(!!strstr(str, "at __Z3FooIiEvv (src.cpp"), "Callstack was %s!", str);
+#else
+ MYASSERT(!!strstr(str, "at __Z3bariPcd (page.js"), "Callstack was %s!", str);
+ MYASSERT(!!strstr(str, "at __Z3FooIiEvv (page.js"), "Callstack was %s!", str);
+#endif
+}
+
+template<typename T>
+void __attribute__((noinline)) Foo() // Arbitrary function signature to add some content to callstack.
+{
+ bar();
+}
+
+int main()
+{
+ Foo<int>();
+#ifndef RUN_FROM_JS_SHELL
+ REPORT_RESULT();
+ return 0;
+#else
+ if (result)
+ printf("Success!\n");
+#endif
+}
diff --git a/tests/fuzz/13.c b/tests/fuzz/13.c
new file mode 100644
index 00000000..623f0dee
--- /dev/null
+++ b/tests/fuzz/13.c
@@ -0,0 +1,107 @@
+/*
+ * This is a RANDOMLY GENERATED PROGRAM.
+ *
+ * Generator: csmith 2.2.0
+ * Git version: bf42ffd
+ * Options: --no-volatiles --no-math64 --no-packed-struct
+ * Seed: 4004715028
+ */
+
+#include "csmith.h"
+
+
+static long __undefined;
+
+/* --- Struct/Union Declarations --- */
+/* --- GLOBAL VARIABLES --- */
+static uint16_t g_2[9][5] = {{1UL,65535UL,0xF90EL,1UL,65532UL},{1UL,1UL,0x4C8DL,1UL,1UL},{65532UL,65535UL,6UL,65529UL,65529UL},{0xF90EL,65532UL,0xF90EL,0x4C8DL,65529UL},{0xC891L,1UL,9UL,1UL,1UL},{65535UL,1UL,0xAA6EL,0xC891L,65532UL},{65526UL,65532UL,9UL,1UL,65535UL},{1UL,0xF90EL,0xF90EL,1UL,65526UL},{1UL,0xC891L,6UL,1UL,0xC891L}};
+
+
+/* --- FORWARD DECLARATIONS --- */
+static uint8_t func_1(void);
+
+
+/* --- FUNCTIONS --- */
+/* ------------------------------------------ */
+/*
+ * reads : g_2
+ * writes:
+ */
+static uint8_t func_1(void)
+{ /* block id: 0 */
+ return g_2[8][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();
+ for (i = 0; i < 9; i++)
+ {
+ for (j = 0; j < 5; j++)
+ {
+ transparent_crc(g_2[i][j], "g_2[i][j]", print_hash_value);
+ if (print_hash_value) printf("index = [%d][%d]\n", i, j);
+
+ }
+ }
+ platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value);
+ return 0;
+}
+
+/************************ statistics *************************
+XXX max struct depth: 0
+breakdown:
+ depth: 0, occurrence: 1
+XXX total union variables: 0
+
+XXX non-zero bitfields defined in structs: 0
+XXX zero bitfields defined in structs: 0
+XXX const bitfields defined in structs: 0
+XXX volatile bitfields defined in structs: 0
+XXX structs with bitfields in the program: 0
+breakdown:
+XXX full-bitfields structs in the program: 0
+breakdown:
+XXX times a bitfields struct's address is taken: 0
+XXX times a bitfields struct on LHS: 0
+XXX times a bitfields struct on RHS: 0
+XXX times a single bitfield on LHS: 0
+XXX times a single bitfield on RHS: 0
+
+XXX max expression depth: 1
+breakdown:
+ depth: 1, occurrence: 1
+
+XXX total number of pointers: 0
+
+XXX times a non-volatile is read: 1
+XXX times a non-volatile is write: 0
+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: 0
+
+XXX stmts: 1
+XXX max block depth: 0
+breakdown:
+ depth: 0, occurrence: 1
+
+XXX percentage a fresh-made variable is used: 100
+XXX percentage an existing variable is used: 0
+FYI: the random generator makes assumptions about the integer size. See platform.info for more details.
+********************* end of statistics **********************/
+
diff --git a/tests/fuzz/13.c.txt b/tests/fuzz/13.c.txt
new file mode 100644
index 00000000..696a3908
--- /dev/null
+++ b/tests/fuzz/13.c.txt
@@ -0,0 +1 @@
+checksum = 3F436227
diff --git a/tests/fuzz/14.c b/tests/fuzz/14.c
new file mode 100644
index 00000000..17e7ec5f
--- /dev/null
+++ b/tests/fuzz/14.c
@@ -0,0 +1,2435 @@
+/*
+ * This is a RANDOMLY GENERATED PROGRAM.
+ *
+ * Generator: csmith 2.2.0
+ * Git version: bf42ffd
+ * Options: --no-volatiles --no-math64 --no-packed-struct
+ * Seed: 695215668
+ */
+
+#include "csmith.h"
+
+
+static long __undefined;
+
+/* --- Struct/Union Declarations --- */
+/* --- GLOBAL VARIABLES --- */
+static int8_t g_2 = 9L;
+static uint8_t g_31[1] = {0x5BL};
+static int32_t g_36 = 0L;
+static int32_t *g_37 = &g_36;
+static int32_t g_59[9] = {0x5D8284A8L,0xF1AC28C4L,0x5D8284A8L,0xF1AC28C4L,0x5D8284A8L,0xF1AC28C4L,0x5D8284A8L,0xF1AC28C4L,0x5D8284A8L};
+static int32_t g_60[2][5][4] = {{{0x92628F0FL,0x92628F0FL,0x92628F0FL,0x92628F0FL},{0x92628F0FL,0x92628F0FL,0x92628F0FL,0x92628F0FL},{0x92628F0FL,0x92628F0FL,0x92628F0FL,0x92628F0FL},{0x92628F0FL,0x92628F0FL,0x92628F0FL,0x92628F0FL},{0x92628F0FL,0x92628F0FL,0x92628F0FL,0x92628F0FL}},{{0x92628F0FL,0x92628F0FL,0x92628F0FL,0x92628F0FL},{0x92628F0FL,0x92628F0FL,0x92628F0FL,0x92628F0FL},{0x92628F0FL,0x92628F0FL,0x92628F0FL,0x92628F0FL},{0x92628F0FL,0x92628F0FL,0x92628F0FL,0x92628F0FL},{0x92628F0FL,0x92628F0FL,0x92628F0FL,0x92628F0FL}}};
+static int32_t g_61 = 0xCBABA27FL;
+static uint16_t g_69[9] = {0x26B3L,0x26B3L,0x26B3L,0x26B3L,0x26B3L,0x26B3L,0x26B3L,0x26B3L,0x26B3L};
+static int16_t g_124 = 1L;
+static int8_t g_126 = 0x2EL;
+static uint8_t g_131 = 246UL;
+static uint32_t g_138[4] = {0x7CE49567L,0x7CE49567L,0x7CE49567L,0x7CE49567L};
+static uint16_t g_145 = 0xDE95L;
+static int32_t * const g_146 = &g_60[0][4][3];
+static int32_t g_358 = (-1L);
+static int32_t g_360 = (-1L);
+static uint32_t g_408[6][10] = {{0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL},{0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL},{0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL},{0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL},{0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL},{0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL,0x1EE3AD7CL}};
+static int8_t g_415 = 0x70L;
+static uint32_t *g_434 = &g_138[3];
+static int8_t **g_435 = (void*)0;
+static uint32_t g_436 = 0x61B69271L;
+static int32_t **g_455 = (void*)0;
+static int32_t ***g_454 = &g_455;
+static int8_t g_510 = 0xF4L;
+static int32_t *g_514 = &g_59[1];
+static uint8_t *g_659 = (void*)0;
+static uint8_t **g_658[5] = {&g_659,&g_659,&g_659,&g_659,&g_659};
+static uint16_t *g_713 = &g_69[6];
+static uint16_t **g_712 = &g_713;
+static int16_t g_775 = 0x1E63L;
+static const uint16_t g_961 = 0UL;
+static uint16_t ** const *g_993 = &g_712;
+static uint16_t ** const * const *g_992 = &g_993;
+static int32_t g_1096[1] = {0x8DF1AA83L};
+static int32_t g_1202 = 0x400DAD15L;
+static uint16_t g_1250 = 65535UL;
+static uint32_t g_1312 = 0x3F36EED0L;
+static uint16_t ***g_1324 = &g_712;
+static uint32_t g_1484 = 18446744073709551612UL;
+static uint32_t *g_1483 = &g_1484;
+static uint16_t g_1509 = 0x40B6L;
+static int32_t *g_1591[6][7] = {{&g_360,&g_360,&g_360,&g_360,&g_360,&g_360,&g_360},{&g_360,&g_360,&g_360,&g_360,&g_360,&g_360,&g_360},{&g_360,&g_360,&g_360,&g_360,&g_360,&g_360,&g_360},{&g_360,&g_360,&g_360,&g_360,&g_360,&g_360,&g_360},{&g_360,&g_360,&g_360,&g_360,&g_360,&g_360,&g_360},{&g_360,&g_360,&g_360,&g_360,&g_360,&g_360,&g_360}};
+static int32_t **g_1590 = &g_1591[5][6];
+static uint16_t g_1758[6][9][3] = {{{0UL,0xC542L,0xD8C5L},{0xC7C1L,0xC7C1L,7UL},{0xAF46L,9UL,0UL},{5UL,1UL,0x6937L},{3UL,0xCD4DL,1UL},{0x6937L,5UL,0x6937L},{0x0379L,0x9AA8L,0UL},{0UL,65535UL,7UL},{0UL,0x0FA7L,0xD8C5L}},{{0x294EL,0UL,0UL},{0UL,65526UL,3UL},{0UL,0x4878L,0xC7C1L},{0x0379L,0x8A66L,0UL},{0x6937L,7UL,65535UL},{3UL,0x8A66L,1UL},{5UL,0x4878L,65532UL},{0xAF46L,65526UL,0UL},{0xC7C1L,0UL,0x4878L}},{{0UL,0x0FA7L,0UL},{65530UL,65535UL,65532UL},{65532UL,0x9AA8L,1UL},{0UL,5UL,65535UL},{3UL,0x2348L,7UL},{0x294EL,65532UL,7UL},{0UL,0xCD4DL,1UL},{65535UL,7UL,0x294EL},{1UL,0x0FA7L,65532UL}},{{7UL,7UL,5UL},{0x0379L,0xCD4DL,0xD8C5L},{65530UL,65532UL,0x4878L},{1UL,0x2348L,0UL},{0x4878L,65530UL,0x4878L},{65535UL,65526UL,0xD8C5L},{0x6937L,1UL,5UL},{7UL,0x8290L,65532UL},{0xC7C1L,0x294EL,0x294EL}},{{7UL,0x7770L,1UL},{0x6937L,0UL,7UL},{65535UL,0xC542L,7UL},{0x4878L,5UL,0UL},{1UL,0xC542L,0xAF46L},{65530UL,0UL,65535UL},{0x0379L,0x7770L,1UL},{7UL,0x294EL,0UL},{1UL,0x8290L,1UL}},{{65535UL,1UL,65535UL},{0UL,65526UL,0xAF46L},{0x294EL,65530UL,0UL},{3UL,0x2348L,7UL},{0x294EL,65532UL,7UL},{0UL,0xCD4DL,1UL},{65535UL,7UL,0x294EL},{1UL,0x0FA7L,65532UL},{7UL,7UL,5UL}}};
+static int16_t g_1847 = 0x0129L;
+static int16_t *g_1846 = &g_1847;
+static const int32_t g_1959 = (-6L);
+static int16_t **g_2019 = (void*)0;
+static uint16_t g_2057[7][8] = {{0x80D1L,65533UL,0xF5B1L,1UL,0xF5B1L,65533UL,0x80D1L,0x80D1L},{65533UL,1UL,0x152EL,0x152EL,1UL,65533UL,0x3260L,65533UL},{1UL,65533UL,0x3260L,65533UL,1UL,0x152EL,0x152EL,1UL},{65533UL,0x80D1L,0x80D1L,65533UL,0xF5B1L,1UL,0xF5B1L,65533UL},{0x80D1L,0xF5B1L,0x80D1L,0x152EL,0x3260L,0x3260L,0x152EL,0x80D1L},{0xF5B1L,0xF5B1L,0x3260L,1UL,0UL,1UL,0x3260L,0xF5B1L},{0xF5B1L,0x80D1L,0x152EL,0x3260L,0x3260L,0x152EL,0x80D1L,0xF5B1L}};
+static int32_t **** const *g_2075 = (void*)0;
+static int32_t ** const **g_2127 = (void*)0;
+static int16_t g_2156 = 0xBBD0L;
+static uint8_t ***g_2219 = (void*)0;
+static int16_t g_2225[10] = {5L,5L,5L,5L,5L,5L,5L,5L,5L,5L};
+static int32_t g_2234 = (-1L);
+static int32_t g_2236 = 0xBA7E2085L;
+static int8_t g_2239 = 0xEBL;
+static int8_t *g_2246 = &g_510;
+static uint8_t g_2387[3][3] = {{255UL,249UL,255UL},{255UL,255UL,255UL},{255UL,249UL,255UL}};
+static const int16_t g_2451 = 0x2C58L;
+static uint8_t ***** const g_2561 = (void*)0;
+static const int32_t *g_2575 = &g_36;
+static int8_t ** const ** const g_2675 = (void*)0;
+static uint8_t * const ***g_2799 = (void*)0;
+static uint32_t g_2907 = 0x8E6C6828L;
+static const uint32_t g_3051 = 0UL;
+static int8_t ***** const g_3152 = (void*)0;
+static int8_t ***** const *g_3151 = &g_3152;
+static int8_t g_3207[10] = {0xB9L,(-7L),0xB9L,0xB9L,(-7L),0xB9L,0xB9L,(-7L),0xB9L,0xB9L};
+static uint32_t g_3271 = 0UL;
+static uint32_t g_3299 = 0x6396F30FL;
+static int32_t ****g_3325[2] = {&g_454,&g_454};
+static uint8_t g_3397 = 0x67L;
+static uint8_t g_3398 = 1UL;
+
+
+/* --- FORWARD DECLARATIONS --- */
+static uint32_t func_1(void);
+static const int32_t func_3(const uint32_t p_4, int32_t p_5, const int16_t p_6);
+static uint32_t func_7(int8_t p_8, int16_t p_9, int32_t p_10, int16_t p_11, int32_t p_12);
+static int32_t func_13(int32_t p_14, int32_t p_15, int16_t p_16, uint16_t p_17);
+static int32_t func_19(int32_t p_20, uint32_t p_21, const int32_t p_22, int32_t p_23, int32_t p_24);
+static int32_t * const func_32(int32_t * p_33);
+static uint8_t func_41(int32_t ** p_42, int32_t * p_43);
+static int32_t ** func_44(const int16_t p_45, uint16_t p_46, uint16_t p_47, int8_t p_48);
+static uint32_t func_49(uint16_t p_50, int32_t ** const p_51, int32_t p_52, int8_t p_53, uint8_t p_54);
+static uint32_t func_57(int16_t p_58);
+
+
+/* --- FUNCTIONS --- */
+/* ------------------------------------------ */
+/*
+ * reads : g_2 g_37 g_145 g_1250 g_69 g_713 g_434 g_2387 g_1846 g_1847 g_993 g_712 g_1590 g_1591 g_61 g_138 g_1324 g_992 g_1758 g_2246 g_510 g_2675 g_146 g_514 g_59 g_454 g_455 g_435 g_36 g_60 g_2236 g_1509 g_3051 g_408 g_131 g_436 g_2225 g_360 g_2575 g_3151 g_124 g_3207 g_1483 g_1484 g_2239 g_3271 g_126 g_3299 g_3325 g_3397 g_3398
+ * writes: g_2234 g_36 g_145 g_1250 g_138 g_69 g_1591 g_61 g_131 g_1847 g_1758 g_2225 g_31 g_60 g_59 g_2236 g_1509 g_436 g_2387 g_713 g_408 g_37 g_124 g_510 g_1312 g_2239 g_455 g_126 g_3299 g_1484 g_658 g_3398
+ */
+static uint32_t func_1(void)
+{ /* block id: 0 */
+ int32_t l_26 = 0xF4039EE4L;
+ int32_t l_3026[7][3] = {{0x1A749151L,0x425EA4C2L,0x425EA4C2L},{(-1L),0x425EA4C2L,0x97D45EBDL},{0xE085E4B3L,0x425EA4C2L,(-1L)},{0x7AAD61BDL,0x7AAD61BDL,(-1L)},{0x425EA4C2L,0x97D45EBDL,(-3L)},{0xE085E4B3L,0x7AAD61BDL,0xE085E4B3L},{0xE085E4B3L,0x425EA4C2L,0x7AAD61BDL}};
+ int8_t l_3266[10][5][2] = {{{0x10L,0x85L},{0x85L,0x10L},{0x85L,0x85L},{0x10L,0x85L},{0x85L,0x10L}},{{0x85L,0x85L},{0x10L,0x85L},{0x85L,0x10L},{0x85L,0x85L},{0x10L,0x85L}},{{0x85L,0x10L},{0x85L,0x85L},{0x10L,0x85L},{0x85L,0x10L},{0x85L,0x85L}},{{0x10L,0x85L},{0x85L,0x10L},{0x85L,0x85L},{0x10L,0x85L},{0x85L,0x10L}},{{0x85L,0x85L},{0x10L,0x85L},{0x85L,0x10L},{0x85L,0x85L},{0x10L,0x85L}},{{0x85L,0x10L},{0x85L,0x85L},{0x10L,0x85L},{0x85L,0x10L},{0x85L,0x85L}},{{0x10L,0x85L},{0x85L,0x10L},{0x85L,0x85L},{0x10L,0x85L},{0x85L,0x10L}},{{0x85L,0x85L},{0x10L,0x85L},{0x85L,0x10L},{0x85L,0x85L},{0x10L,0x85L}},{{0x85L,0x10L},{0x85L,0x85L},{0x10L,0x85L},{0x85L,0x10L},{0x85L,0x85L}},{{0x10L,0x85L},{0x85L,0x10L},{0x85L,0x85L},{0x10L,0x85L},{0x85L,0x10L}}};
+ int32_t * const *l_3293 = &g_514;
+ int32_t * const **l_3292 = &l_3293;
+ int32_t * const ***l_3291 = &l_3292;
+ uint8_t *l_3327 = &g_31[0];
+ uint16_t l_3340 = 0x2D69L;
+ uint16_t l_3380 = 0x6577L;
+ int8_t **l_3395[6];
+ int i, j, k;
+ for (i = 0; i < 6; i++)
+ l_3395[i] = &g_2246;
+ if (g_2)
+ { /* block id: 1 */
+ uint8_t l_18 = 0x0EL;
+ int32_t l_25 = (-5L);
+ l_3026[0][0] = func_3(func_7(g_2, g_2, (l_3026[1][2] |= (0x6F7FBF21L > func_13(l_18, func_19(((l_25 = (((l_18 <= g_2) && (0x0A9B27FAL && (l_18 > 0xC5A3D7F1L))) < 0x2530A9BCL)) == g_2), l_26, l_18, g_2, g_2), l_26, l_26))), l_18, l_18), l_18, l_18);
+ }
+ else
+ { /* block id: 1616 */
+ uint32_t l_3127 = 8UL;
+ int32_t l_3138 = 0x0C4C8D53L;
+ int32_t l_3153 = 0x33A3E34BL;
+ int32_t **l_3155 = &g_37;
+ const int16_t l_3197 = 0xABAEL;
+ uint8_t l_3232 = 0xCDL;
+ const uint8_t *l_3242 = &g_2387[2][1];
+ const uint8_t * const *l_3241 = &l_3242;
+ int32_t * const l_3286 = &g_36;
+ uint32_t l_3302 = 6UL;
+ for (g_145 = (-20); (g_145 <= 3); g_145++)
+ { /* block id: 1619 */
+ int16_t l_3147[9] = {0L,0L,0L,0L,0L,0L,0L,0L,0L};
+ int i;
+ (*g_146) = (l_3127 , 1L);
+ if ((*g_2575))
+ continue;
+ for (g_131 = (-12); (g_131 <= 1); g_131 = safe_add_func_uint16_t_u_u(g_131, 1))
+ { /* block id: 1624 */
+ uint32_t *l_3148 = &g_408[2][6];
+ int16_t l_3154 = 0x527AL;
+ (*g_514) ^= ((*g_146) = (safe_mul_func_uint16_t_u_u((safe_rshift_func_int16_t_s_s(0xD70CL, (((*g_434) , (--(*g_713))) & (safe_sub_func_uint16_t_u_u(((l_3138 &= (*g_1846)) & 0xAD6EL), (l_3127 != (((((safe_sub_func_uint8_t_u_u((0x27E1980DL < (((safe_mod_func_int16_t_s_s((l_3153 ^= (safe_add_func_int8_t_s_s((safe_mod_func_uint32_t_u_u((l_3147[5] | (-5L)), ((*l_3148)++))), (((((((void*)0 == g_3151) , 2L) , l_3147[5]) < (*g_1846)) >= l_3147[5]) | 0x77L)))), l_3154)) > l_3127) == 0L)), l_3154)) ^ (*g_434)) , l_3026[1][2]) >= l_3154) , l_3154))))))), (*g_1846))));
+ }
+ }
+ (*l_3155) = &l_3153;
+ if ((+0xFF1AF652L))
+ { /* block id: 1634 */
+ int32_t *l_3156[5];
+ uint8_t ***l_3173 = &g_658[2];
+ int8_t **l_3181 = &g_2246;
+ const int16_t l_3183 = (-1L);
+ int32_t l_3243 = 5L;
+ uint32_t l_3267 = 4294967288UL;
+ int i;
+ for (i = 0; i < 5; i++)
+ l_3156[i] = &g_36;
+ (*l_3155) = &l_3026[0][0];
+ for (g_124 = 0; (g_124 > (-8)); g_124--)
+ { /* block id: 1638 */
+ uint32_t l_3178 = 0xC9609AEAL;
+ int8_t l_3179[1][5];
+ uint32_t l_3180 = 18446744073709551612UL;
+ int32_t l_3182 = (-1L);
+ uint16_t **l_3227 = (void*)0;
+ int32_t *l_3260[8] = {&g_358,&g_358,&g_1096[0],&g_358,&g_358,&g_1096[0],&g_358,&g_358};
+ int32_t l_3265 = (-7L);
+ uint16_t *l_3276[7] = {&g_1758[2][3][0],&g_1250,&g_1758[2][3][0],&g_1758[2][3][0],&g_1250,&g_1758[2][3][0],&g_1758[2][3][0]};
+ int8_t *l_3277 = &g_126;
+ int32_t * const *l_3278 = &g_146;
+ int i, j;
+ for (i = 0; i < 1; i++)
+ {
+ for (j = 0; j < 5; j++)
+ l_3179[i][j] = 0x60L;
+ }
+ (*g_514) ^= ((l_26 && ((safe_sub_func_int32_t_s_s(((*g_37) != (((safe_rshift_func_uint8_t_u_s(((-1L) ^ (safe_rshift_func_uint8_t_u_s((safe_mul_func_uint16_t_u_u(l_3026[1][2], (0xE2F6L <= (((((l_3182 = (safe_sub_func_int32_t_s_s((safe_rshift_func_int16_t_s_s((**l_3155), (((*g_434) ^= ((safe_rshift_func_int8_t_s_s(((*g_2246) &= ((l_3173 == &g_658[2]) != (((((safe_div_func_uint32_t_u_u((safe_div_func_int32_t_s_s(((l_3178 ^ l_3178) | (**l_3155)), l_3179[0][0])), 4294967295UL)) == (**l_3155)) | l_3180) , l_3181) != &g_2246))), 4)) == l_3178)) != (**l_3155)))), 4294967295UL))) , (*g_454)) != &l_3156[1]) && l_3183) , 0UL)))), 4))), (**l_3155))) == 0x78F00C48L) || (**g_712))), 9L)) == 0x17DDD041L)) != 0x7496L);
+ for (l_3178 = 26; (l_3178 != 20); l_3178--)
+ { /* block id: 1645 */
+ uint8_t l_3231 = 0x9BL;
+ int16_t l_3268 = (-1L);
+ for (g_1312 = (-17); (g_1312 >= 7); g_1312 = safe_add_func_int8_t_s_s(g_1312, 5))
+ { /* block id: 1648 */
+ uint32_t *l_3198 = &g_408[2][6];
+ const uint16_t *l_3229 = &g_2057[5][1];
+ const uint16_t **l_3228 = &l_3229;
+ int32_t l_3230 = 0x605411FEL;
+ int8_t *l_3233 = (void*)0;
+ uint8_t **l_3240 = &g_659;
+ l_3156[1] = (((*l_3198) |= ((safe_lshift_func_int16_t_s_s((safe_mul_func_int8_t_s_s(((l_3179[0][4] <= (0L == (*g_1846))) & (safe_lshift_func_int8_t_s_s((**l_3155), (((((l_26 , (safe_div_func_uint8_t_u_u((((*g_2246) , ((*g_514) = (safe_unary_minus_func_int32_t_s(((*g_1846) > 0x8D74L))))) || ((*g_434) ^ (*g_434))), 0x0AL))) > l_3197) & l_3179[0][0]) , 0x7BL) && 0UL)))), 0x3FL)), l_26)) != 0xFF74B1E8L)) , (*l_3155));
+ (*g_146) |= (safe_mod_func_int16_t_s_s((safe_mul_func_uint16_t_u_u(((safe_mod_func_uint32_t_u_u((safe_add_func_uint16_t_u_u(g_3207[7], (safe_unary_minus_func_int16_t_s((((safe_sub_func_uint16_t_u_u((safe_mod_func_uint8_t_u_u((safe_mod_func_int32_t_s_s((safe_mod_func_int8_t_s_s((g_2239 &= ((((*g_1846) && (0xBCL && ((~(((((safe_mod_func_int16_t_s_s(((*g_1846) &= (safe_lshift_func_uint16_t_u_u((safe_rshift_func_uint8_t_u_u((((safe_sub_func_uint32_t_u_u(((safe_add_func_int16_t_s_s((((**l_3155) == (*g_2246)) != (l_3227 == l_3228)), (0xF5E6L & (0xCC5E7D7EL != l_3230)))) <= 0xD3L), (*g_2575))) == (**l_3155)) >= l_3231), l_3178)), 11))), l_3026[1][2])) < 0x6C78F6E4L) <= l_3232) , l_3179[0][0]) , (*g_1483))) , 0x5EL))) ^ 0xDC82L) < 0x6ACCL)), l_3026[1][1])), (**l_3155))), 0x50L)), (***g_993))) && (***g_1324)) , (-8L)))))), l_3179[0][2])) , 0x38A6L), (****g_992))), l_3179[0][0]));
+ (*g_514) |= (~((!(l_3230 > ((l_3230 , ((*g_2246) || l_3182)) , (safe_add_func_uint16_t_u_u((((safe_mul_func_uint16_t_u_u(((**l_3155) , ((***g_1324) = ((safe_rshift_func_uint16_t_u_s((((l_3240 == l_3241) , l_3243) , (safe_rshift_func_int16_t_s_s(((*g_1846) &= (l_3231 < 0xE8F6L)), l_3230))), l_3230)) , l_3230))), (**l_3155))) < l_3230) < (**l_3155)), l_3230))))) == (-1L)));
+ (*g_514) = ((*g_146) = ((**l_3155) = (((safe_sub_func_uint8_t_u_u((safe_mul_func_uint8_t_u_u(1UL, (*g_2246))), (((((((*l_3198) = (safe_add_func_uint16_t_u_u((safe_lshift_func_int8_t_s_u(0xDBL, 7)), ((safe_div_func_int8_t_s_s((safe_div_func_int32_t_s_s((safe_rshift_func_uint16_t_u_s((l_3173 != ((l_3156[1] == l_3260[3]) , (void*)0)), 0)), (((safe_mul_func_uint8_t_u_u((((l_3265 = ((safe_mul_func_int8_t_s_s((l_3230 | 7L), (*g_2246))) ^ l_3230)) | (*g_2575)) != l_3266[7][2][0]), l_3267)) | l_3182) , 0xC94E0367L))), l_3268)) >= 251UL)))) >= (**l_3155)) && 246UL) == l_3268) ^ 0x6F59L) | (**l_3155)))) | 0x97L) == l_3230)));
+ }
+ (*g_514) = (**l_3155);
+ (*g_454) = (*g_454);
+ if (l_3026[1][2])
+ break;
+ }
+ (*g_146) = (((((safe_rshift_func_int8_t_s_u(((**l_3181) = g_3271), 3)) && (*g_434)) , (**g_712)) ^ (**l_3155)) == ((*g_454) != ((safe_lshift_func_uint8_t_u_s((safe_lshift_func_uint16_t_u_u(3UL, (l_26 | (l_3182 = l_3179[0][0])))), ((*l_3277) ^= 0xE3L))) , l_3278)));
+ }
+ }
+ else
+ { /* block id: 1673 */
+ int8_t l_3279 = 0x05L;
+ int32_t l_3298 = 1L;
+ int16_t l_3328 = (-2L);
+ int8_t l_3378 = 0x76L;
+ const uint32_t l_3379 = 9UL;
+ int8_t l_3384 = 0xF5L;
+ (*g_37) = (*g_514);
+ l_3138 |= (~(**l_3155));
+ if (((*g_146) = l_3279))
+ { /* block id: 1677 */
+ int32_t ****l_3294[1][4][5] = {{{&g_454,&g_454,(void*)0,&g_454,&g_454},{(void*)0,&g_454,(void*)0,(void*)0,&g_454},{&g_454,(void*)0,(void*)0,&g_454,(void*)0},{&g_454,&g_454,&g_454,&g_454,&g_454}}};
+ const uint8_t * const **l_3317[9] = {&l_3241,&l_3241,&l_3241,&l_3241,&l_3241,&l_3241,&l_3241,&l_3241,&l_3241};
+ const uint8_t * const ***l_3316 = &l_3317[1];
+ int i, j, k;
+ if ((safe_unary_minus_func_int16_t_s(((*g_1846) = ((&g_3271 != (void*)0) > (*g_1846))))))
+ { /* block id: 1679 */
+ int32_t * const l_3281[8] = {&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36};
+ int32_t **l_3282 = (void*)0;
+ int32_t **l_3283 = &g_37;
+ int i;
+ (*l_3283) = l_3281[5];
+ (*l_3283) = ((((*g_2575) > 0xB5BFD70DL) || (safe_div_func_uint32_t_u_u(((void*)0 != l_3286), (safe_add_func_uint8_t_u_u(((safe_rshift_func_int16_t_s_s(((((l_3291 == l_3294[0][0][2]) > ((safe_add_func_int16_t_s_s(((****l_3291) >= (l_3279 <= (((safe_unary_minus_func_uint8_t_u((**l_3283))) || 0x4EL) , (-1L)))), (*g_1846))) , l_3279)) != (*g_434)) , l_3279), 0)) , 5UL), (-5L)))))) , (*l_3283));
+ g_3299++;
+ }
+ else
+ { /* block id: 1683 */
+ uint32_t l_3307[9] = {0x1754E157L,0x1754E157L,0x1754E157L,0x1754E157L,0x1754E157L,0x1754E157L,0x1754E157L,0x1754E157L,0x1754E157L};
+ uint8_t ****l_3318 = &g_2219;
+ int i;
+ --l_3302;
+ if ((*g_146))
+ { /* block id: 1685 */
+ int32_t *** const **l_3319 = (void*)0;
+ int32_t *** const **l_3320 = (void*)0;
+ int32_t **l_3324 = &g_514;
+ int32_t *** const l_3323 = &l_3324;
+ int32_t *** const *l_3322[10][5] = {{&l_3323,&l_3323,&l_3323,&l_3323,&l_3323},{&l_3323,&l_3323,&l_3323,(void*)0,(void*)0},{&l_3323,&l_3323,&l_3323,&l_3323,&l_3323},{(void*)0,&l_3323,&l_3323,(void*)0,&l_3323},{(void*)0,(void*)0,&l_3323,&l_3323,&l_3323},{&l_3323,&l_3323,&l_3323,&l_3323,&l_3323},{&l_3323,&l_3323,&l_3323,&l_3323,&l_3323},{&l_3323,&l_3323,&l_3323,&l_3323,&l_3323},{&l_3323,(void*)0,&l_3323,&l_3323,(void*)0},{&l_3323,&l_3323,&l_3323,&l_3323,&l_3323}};
+ int32_t *** const **l_3321 = &l_3322[9][1];
+ int16_t l_3326 = 0x5EE0L;
+ int i, j;
+ (**l_3324) = (((l_3307[7] && (safe_rshift_func_int8_t_s_u(((((((((((void*)0 == &g_1846) <= ((safe_lshift_func_int16_t_s_u((safe_add_func_int8_t_s_s((((*g_1483) = (0x6558BEDCL > (*g_434))) , ((*g_2246) = (safe_lshift_func_uint16_t_u_s((l_3316 == l_3318), 11)))), (****l_3291))), ((((((*l_3321) = &g_454) == g_3325[0]) || l_3298) > (*g_434)) == l_3326))) , (-1L))) & (*g_514)) , (void*)0) != l_3327) & 0xA7L) == (***l_3292)) | (*g_434)) ^ (*g_146)), 3))) && 0L) != l_3298);
+ (**l_3293) |= l_3328;
+ }
+ else
+ { /* block id: 1691 */
+ (****l_3291) = (((void*)0 != &g_124) , (safe_sub_func_uint16_t_u_u((**g_712), (*g_1846))));
+ }
+ }
+ for (l_3138 = 0; (l_3138 <= (-17)); l_3138 = safe_sub_func_uint8_t_u_u(l_3138, 3))
+ { /* block id: 1697 */
+ (*g_514) ^= (*g_2575);
+ }
+ }
+ else
+ { /* block id: 1700 */
+ uint8_t l_3339[9] = {251UL,251UL,251UL,251UL,251UL,251UL,251UL,251UL,251UL};
+ int i;
+ (*g_514) &= ((safe_mul_func_int8_t_s_s((((safe_mul_func_uint16_t_u_u((safe_div_func_uint32_t_u_u(4294967295UL, l_3339[8])), (((l_3340 = (9L && 250UL)) & ((l_3339[5] , ((safe_sub_func_int16_t_s_s(((-10L) ^ ((*g_434)--)), 7UL)) > (((((**g_712) | (&g_454 != (void*)0)) > l_3339[8]) , l_3339[8]) < 0xF9L))) , 0x7C37L)) <= l_3339[2]))) , l_3339[0]) && (*g_2246)), 0x6CL)) && l_3339[3]);
+ }
+ for (g_2239 = (-16); (g_2239 <= (-26)); g_2239--)
+ { /* block id: 1707 */
+ uint8_t l_3383[4][5][8] = {{{0x22L,0x97L,247UL,0xC9L,0xC9L,247UL,0x97L,0x22L},{0xE5L,250UL,0x1FL,0x75L,9UL,255UL,1UL,3UL},{0xA8L,0xE3L,0x97L,4UL,0x75L,255UL,0UL,0x09L},{1UL,250UL,0x1EL,1UL,252UL,247UL,0x1FL,247UL},{0x09L,0x97L,252UL,0x97L,0x09L,0UL,250UL,0x1FL}},{{0UL,250UL,0x88L,1UL,1UL,0x0BL,0x65L,0x97L},{0xC9L,0xA8L,0x88L,0UL,0x97L,0UL,250UL,0x1EL},{1UL,4UL,252UL,0x1FL,0x88L,0x88L,0x1FL,252UL},{9UL,9UL,0x1EL,250UL,0UL,0x97L,0UL,0x88L},{0x1EL,255UL,0x97L,0x65L,0x0BL,1UL,1UL,0x88L}},{{255UL,0x22L,0x1FL,250UL,0UL,0x09L,0x97L,252UL},{1UL,252UL,247UL,0x1FL,247UL,252UL,1UL,0x1EL},{0x1FL,0xF3L,0x09L,0UL,255UL,0x75L,4UL,0x97L},{0UL,0x09L,3UL,1UL,255UL,9UL,0x75L,0x1FL},{0x1FL,4UL,0x22L,0x97L,247UL,0xC9L,0xC9L,247UL}},{{1UL,1UL,1UL,1UL,0UL,4UL,0x88L,0x09L},{255UL,247UL,1UL,4UL,0x0BL,0x1EL,0xF3L,3UL},{0x1EL,247UL,0x65L,0x88L,1UL,0x22L,0x75L,0xF3L},{0x75L,0xC9L,0xE5L,250UL,4UL,250UL,0xE5L,0xC9L},{4UL,0x22L,9UL,4UL,0UL,0x75L,0x65L,247UL}}};
+ int32_t *l_3387 = &l_3298;
+ int32_t ***l_3393 = &g_455;
+ int i, j, k;
+ for (g_436 = 0; (g_436 >= 58); g_436 = safe_add_func_uint8_t_u_u(g_436, 9))
+ { /* block id: 1710 */
+ uint8_t l_3350 = 0UL;
+ int16_t l_3382 = 0x906CL;
+ const uint8_t l_3390 = 1UL;
+ int32_t ** const *l_3396 = &g_455;
+ if (l_3279)
+ { /* block id: 1711 */
+ uint8_t ***l_3349 = &g_658[2];
+ int32_t l_3355 = 0xE58C1806L;
+ uint32_t l_3381 = 0x8D96A914L;
+ int32_t **l_3385[4];
+ int32_t **l_3386 = &g_37;
+ int i;
+ for (i = 0; i < 4; i++)
+ l_3385[i] = &g_514;
+ (*l_3349) = &g_659;
+ l_3384 = (l_3350 || (safe_mul_func_uint16_t_u_u((((safe_div_func_int32_t_s_s(((l_3355 <= (*g_713)) , (l_3350 < (safe_rshift_func_uint8_t_u_u((((void*)0 == &g_2799) && (**l_3155)), 0)))), (safe_mul_func_int8_t_s_s(((*g_2246) = (safe_add_func_int16_t_s_s((safe_mul_func_int16_t_s_s((safe_add_func_int8_t_s_s(((safe_lshift_func_int16_t_s_s((((safe_rshift_func_uint8_t_u_u((safe_sub_func_int8_t_s_s((safe_rshift_func_uint16_t_u_s((((((*g_713) == (((((((safe_rshift_func_int16_t_s_s(((((*g_1846) = (*g_1846)) | g_2236) < 0x4AL), l_3378)) & (*g_2246)) || 0x10L) == l_3379) > 4294967289UL) && (-1L)) >= 1L)) < (**l_3155)) != (*g_434)) <= (*g_434)), 11)), (***l_3292))), 1)) == l_3380) , 0xF838L), (*l_3286))) > 1L), l_3381)), l_3382)), 0x3F1DL))), l_3383[0][1][7])))) ^ (-9L)) > (*g_434)), l_3383[3][2][6])));
+ (*l_3386) = (**l_3292);
+ }
+ else
+ { /* block id: 1717 */
+ int32_t ****l_3394 = &l_3393;
+ l_3387 = (void*)0;
+ (*g_146) = ((((**l_3293) >= (safe_mod_func_int8_t_s_s(((l_3390 ^ ((**l_3155) | ((((safe_mul_func_int16_t_s_s((((*l_3394) = l_3393) != ((l_3379 | (l_3395[4] != (void*)0)) , l_3396)), 5L)) & (*g_146)) >= (**l_3155)) & l_3298))) , (-1L)), (****l_3291)))) & 1L) ^ g_3397);
+ g_3398++;
+ }
+ }
+ }
+ }
+ }
+ return (****l_3291);
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_1846 g_514 g_59 g_1509 g_434 g_138 g_3051 g_1847 g_408 g_37 g_36 g_131 g_712 g_713 g_69 g_436 g_2225 g_993 g_1590 g_1591 g_360
+ * writes: g_1847 g_59 g_1509 g_138 g_131 g_36 g_436 g_2387 g_2225 g_713
+ */
+static const int32_t func_3(const uint32_t p_4, int32_t p_5, const int16_t p_6)
+{ /* block id: 1558 */
+ int8_t l_3038[3][4][7] = {{{(-9L),(-8L),0x33L,(-1L),1L,1L,(-2L)},{1L,(-6L),(-1L),0xE3L,0x61L,0x0FL,0x58L},{(-1L),0xF9L,(-9L),1L,0x61L,(-6L),(-6L)},{1L,0x33L,1L,0x33L,1L,0x00L,0x13L}},{{1L,0x61L,0xB1L,0x31L,(-1L),0xB9L,8L},{1L,0xFEL,0L,(-4L),0xFBL,(-1L),0xB1L},{1L,0x31L,(-8L),1L,(-6L),(-1L),0xE3L},{1L,1L,(-2L),0xFBL,0x52L,(-7L),(-1L)}},{{(-1L),(-2L),0xCAL,0xFBL,1L,0xFEL,1L},{1L,0x00L,0x00L,1L,(-2L),0x58L,1L},{(-9L),1L,(-9L),(-4L),0L,0x31L,0x1AL},{0x00L,0x58L,(-6L),0x31L,0x0FL,0xE3L,1L}}};
+ uint8_t *l_3071 = &g_2387[1][1];
+ int32_t l_3080 = 0L;
+ int32_t l_3081 = 0x141AEC86L;
+ int32_t l_3082 = 4L;
+ int32_t l_3087[4] = {1L,1L,1L,1L};
+ int8_t * const ***l_3105 = (void*)0;
+ int8_t * const ****l_3104 = &l_3105;
+ int8_t * const *****l_3106 = &l_3104;
+ uint16_t l_3107 = 0x130AL;
+ int16_t *l_3108 = &g_2225[6];
+ uint16_t l_3122 = 65529UL;
+ int i, j, k;
+ (*g_514) ^= ((safe_lshift_func_uint16_t_u_s((safe_rshift_func_uint16_t_u_u(0x5884L, 4)), 7)) ^ (safe_mul_func_int16_t_s_s(((l_3038[1][1][5] > 249UL) <= p_4), ((*g_1846) = (0x837FL ^ 0xE54FL)))));
+ for (p_5 = (-20); (p_5 < (-18)); ++p_5)
+ { /* block id: 1563 */
+ uint32_t l_3043 = 1UL;
+ int32_t l_3053 = 0x27A5B9B0L;
+ int32_t l_3079 = 0xBA3474DDL;
+ int32_t l_3083 = 0x0378FB79L;
+ int32_t l_3084 = 0x4EC607B8L;
+ int32_t l_3086 = 0x87B4D2E8L;
+ int32_t l_3088 = 5L;
+ int32_t l_3089 = 0xEFC3DAA0L;
+ int32_t l_3090 = 0xB68C8DD3L;
+ int32_t l_3091 = 1L;
+ int32_t l_3092 = (-1L);
+ int32_t l_3093[4][1][7] = {{{0x9167FBDEL,0x9167FBDEL,0x9167FBDEL,0x9167FBDEL,0x9167FBDEL,0x9167FBDEL,0x9167FBDEL}},{{0L,0L,0L,0L,0L,0L,0L}},{{0x9167FBDEL,0x9167FBDEL,0x9167FBDEL,0x9167FBDEL,0x9167FBDEL,0x9167FBDEL,0x9167FBDEL}},{{0L,0L,0L,0L,0L,0L,0L}}};
+ uint32_t l_3094 = 18446744073709551615UL;
+ int i, j, k;
+ for (g_1509 = 0; (g_1509 <= 6); g_1509 += 1)
+ { /* block id: 1566 */
+ uint32_t *l_3050 = &g_408[4][7];
+ int32_t l_3052 = 0x71A954C8L;
+ uint8_t *l_3068 = &g_131;
+ int32_t ****l_3074 = &g_454;
+ int32_t *l_3075 = &g_60[0][4][3];
+ int32_t *l_3076 = (void*)0;
+ int32_t *l_3077[2];
+ int8_t l_3078 = 0x3FL;
+ int32_t l_3085[3][2][9] = {{{0L,0L,0L,0L,0L,0L,0L,0L,0L},{0x2A21343BL,0x2A21343BL,0x2A21343BL,0x2A21343BL,0x2A21343BL,0x2A21343BL,0x2A21343BL,0x2A21343BL,0x2A21343BL}},{{0L,0L,0L,0L,0L,0L,0L,0L,0L},{0x2A21343BL,0x2A21343BL,0x2A21343BL,0x2A21343BL,0x2A21343BL,0x2A21343BL,0x2A21343BL,0x2A21343BL,0x2A21343BL}},{{0L,0L,0L,0L,0L,0L,0L,0L,0L},{0x2A21343BL,0x2A21343BL,0x2A21343BL,0x2A21343BL,0x2A21343BL,0x2A21343BL,0x2A21343BL,0x2A21343BL,0x2A21343BL}}};
+ int i, j, k;
+ for (i = 0; i < 2; i++)
+ l_3077[i] = &l_3052;
+ if ((safe_sub_func_int8_t_s_s(((l_3053 = (l_3043 < (safe_mod_func_int32_t_s_s(p_6, (((*g_434) = (*g_434)) ^ (l_3038[0][0][0] ^ (((1UL && (safe_sub_func_uint8_t_u_u(((((p_4 | p_5) , (safe_lshift_func_uint8_t_u_u(((void*)0 != l_3050), g_3051))) ^ l_3052) & 0x3911L), l_3038[1][1][5]))) | 0x33036F19L) , l_3052))))))) | 0x5FL), p_6)))
+ { /* block id: 1569 */
+ for (l_3043 = 1; (l_3043 <= 5); l_3043 += 1)
+ { /* block id: 1572 */
+ uint32_t l_3055 = 3UL;
+ int i, j;
+ for (g_1847 = 4; (g_1847 >= 0); g_1847 -= 1)
+ { /* block id: 1575 */
+ int32_t l_3054 = 0xE1145BC8L;
+ int i, j;
+ (*g_514) = 0x27A2A679L;
+ if (g_408[g_1847][(g_1847 + 2)])
+ continue;
+ --l_3055;
+ }
+ if (g_408[l_3043][(g_1509 + 3)])
+ continue;
+ (*g_514) |= (*g_37);
+ }
+ if (l_3053)
+ break;
+ }
+ else
+ { /* block id: 1584 */
+ (*g_514) ^= (-2L);
+ return p_5;
+ }
+ (*g_37) &= ((safe_div_func_int8_t_s_s((4L == l_3052), (safe_rshift_func_int8_t_s_s(((safe_mod_func_uint16_t_u_u((0xF60BDD11L | ((safe_rshift_func_uint8_t_u_s(((safe_lshift_func_int8_t_s_u(p_6, (++(*l_3068)))) <= ((*g_1846) ^= ((l_3071 != ((l_3068 == (void*)0) , (void*)0)) <= ((((safe_div_func_int32_t_s_s(((l_3053 = ((void*)0 != l_3074)) != p_5), 0x66F4258AL)) , 0xD0AF22D9L) , 0UL) >= 0x60F4L)))), l_3038[2][3][4])) , l_3043)), p_6)) >= p_4), 2)))) | (**g_712));
+ --l_3094;
+ for (g_436 = 0; (g_436 <= 6); g_436 += 1)
+ { /* block id: 1595 */
+ for (l_3092 = 6; (l_3092 >= 0); l_3092 -= 1)
+ { /* block id: 1598 */
+ return p_4;
+ }
+ if (p_5)
+ break;
+ }
+ }
+ }
+ l_3087[0] = (safe_div_func_int32_t_s_s((((**g_993) = (((((*l_3108) &= ((*g_434) ^ (((safe_lshift_func_int8_t_s_s(p_4, 2)) ^ (safe_unary_minus_func_uint32_t_u(((-1L) == (safe_mul_func_uint8_t_u_u(((*l_3071) = 0x55L), ((l_3082 = ((*g_1846) = p_6)) | p_6))))))) , ((l_3080 & (((((((*l_3106) = l_3104) == (void*)0) , 0x7096EE73L) >= p_4) >= l_3107) != 0xC9CFL)) > l_3082)))) != p_4) , l_3081) , &l_3107)) != (void*)0), l_3080));
+ (*g_514) &= ((((*g_37) = (safe_mod_func_uint16_t_u_u((safe_add_func_uint32_t_u_u((0xBB8BL | (p_6 <= (safe_mod_func_int8_t_s_s(p_6, ((safe_rshift_func_int16_t_s_u(0x7606L, (p_6 && l_3087[0]))) , (((((safe_div_func_int32_t_s_s((safe_rshift_func_int8_t_s_u(((safe_unary_minus_func_int32_t_s(l_3122)) , ((safe_div_func_int16_t_s_s(8L, l_3122)) != 0x444F67B9L)), l_3081)), 2L)) ^ (-1L)) > p_4) , (**g_1590)) , 0x96L)))))), l_3038[1][1][5])), p_6))) >= 0x6C7D49EBL) == 0xF40DL);
+ return l_3038[1][1][6];
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_2236
+ * writes: g_2236
+ */
+static uint32_t func_7(int8_t p_8, int16_t p_9, int32_t p_10, int16_t p_11, int32_t p_12)
+{ /* block id: 1551 */
+ uint16_t l_3029 = 0x94C3L;
+ for (g_2236 = (-17); (g_2236 > 22); g_2236++)
+ { /* block id: 1554 */
+ l_3029++;
+ }
+ return l_3029;
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_146 g_60
+ * writes:
+ */
+static int32_t func_13(int32_t p_14, int32_t p_15, int16_t p_16, uint16_t p_17)
+{ /* block id: 1548 */
+ return (*g_146);
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_37 g_145 g_1250 g_69 g_713 g_434 g_2387 g_1846 g_1847 g_993 g_712 g_1590 g_1591 g_61 g_138 g_1324 g_992 g_1758 g_2246 g_510 g_2675 g_146 g_514 g_59 g_454 g_455 g_435 g_36
+ * writes: g_2234 g_36 g_145 g_1250 g_138 g_69 g_1591 g_61 g_131 g_1847 g_1758 g_2225 g_31 g_60 g_59
+ */
+static int32_t func_19(int32_t p_20, uint32_t p_21, const int32_t p_22, int32_t p_23, int32_t p_24)
+{ /* block id: 3 */
+ uint16_t l_2271[8] = {0xDEC2L,0xDEC2L,0UL,0xDEC2L,0xDEC2L,0UL,0xDEC2L,0xDEC2L};
+ int32_t l_2279 = 0x4E8C2824L;
+ int32_t l_2329 = 0x307D7E8CL;
+ int32_t l_2330 = 1L;
+ int32_t l_2331 = 1L;
+ int32_t l_2332 = 6L;
+ uint8_t l_2333[6][9][4] = {{{255UL,4UL,255UL,3UL},{0UL,0x56L,2UL,0UL},{246UL,3UL,0x97L,0x56L},{3UL,4UL,0x97L,0x97L},{246UL,246UL,2UL,0x5BL},{0UL,0x19L,255UL,0x56L},{255UL,0x56L,3UL,255UL},{246UL,0x56L,252UL,0x56L},{0x56L,0x19L,0x97L,0x5BL}},{{0x45L,246UL,3UL,0x97L},{0UL,4UL,5UL,0x56L},{0UL,3UL,3UL,0UL},{0x45L,0x56L,0x97L,3UL},{0x56L,4UL,252UL,0x5BL},{246UL,0x45L,3UL,0x5BL},{255UL,4UL,255UL,3UL},{0UL,0x56L,2UL,0UL},{246UL,3UL,0x97L,0x56L}},{{3UL,4UL,0x97L,0x97L},{246UL,246UL,2UL,0x5BL},{0UL,0x19L,255UL,0x56L},{255UL,0x56L,3UL,255UL},{246UL,0x56L,252UL,0x56L},{0x56L,0x19L,0x97L,0x5BL},{0x45L,246UL,3UL,0x97L},{0UL,4UL,5UL,0x56L},{0UL,3UL,3UL,0UL}},{{0x45L,0x56L,0x97L,3UL},{0x56L,4UL,252UL,0x5BL},{246UL,0x45L,3UL,0x5BL},{255UL,4UL,255UL,3UL},{0UL,0x56L,2UL,0UL},{246UL,3UL,0x97L,0x56L},{3UL,4UL,0x97L,0x97L},{246UL,246UL,2UL,0x5BL},{0UL,0x19L,255UL,0x56L}},{{255UL,0x56L,3UL,255UL},{246UL,0x56L,252UL,0x56L},{0x56L,0x19L,0x97L,0x5BL},{0x45L,246UL,3UL,0x97L},{0UL,4UL,5UL,0x56L},{0UL,3UL,3UL,0UL},{0x45L,0x56L,0x97L,3UL},{0x56L,4UL,252UL,0x5BL},{246UL,0x45L,3UL,0x5BL}},{{255UL,4UL,252UL,5UL},{0x97L,255UL,0UL,0x97L},{3UL,5UL,6UL,255UL},{5UL,0x45L,6UL,6UL},{3UL,3UL,0UL,0x19L},{0x97L,255UL,252UL,255UL},{252UL,255UL,5UL,252UL},{3UL,255UL,4UL,255UL},{255UL,255UL,6UL,0x19L}}};
+ int16_t l_2338 = (-1L);
+ int32_t l_2339 = 0xCE9AC76DL;
+ int32_t l_2340 = 1L;
+ uint8_t **l_2352 = (void*)0;
+ int16_t l_2375 = 1L;
+ int8_t ***l_2396 = (void*)0;
+ int8_t ****l_2395 = &l_2396;
+ int32_t l_2405 = 0xE7CA1D27L;
+ int32_t l_2419 = 0xCAE5D46BL;
+ uint32_t l_2446 = 0x4AF43DC1L;
+ uint16_t **l_2486[2][9][10] = {{{&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713},{&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713},{&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713},{(void*)0,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713},{&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713},{&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713},{&g_713,&g_713,(void*)0,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713},{&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713},{(void*)0,&g_713,&g_713,(void*)0,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713}},{{&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713},{&g_713,&g_713,&g_713,(void*)0,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713},{&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713},{&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713},{&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713},{&g_713,&g_713,&g_713,&g_713,&g_713,(void*)0,&g_713,&g_713,&g_713,&g_713},{&g_713,&g_713,&g_713,&g_713,(void*)0,(void*)0,&g_713,&g_713,&g_713,&g_713},{&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713},{&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713}}};
+ int32_t l_2528[2];
+ uint8_t l_2534 = 0xC1L;
+ uint32_t l_2562 = 0xBBC01CAAL;
+ const int32_t **l_2615 = &g_2575;
+ const int32_t ***l_2614 = &l_2615;
+ int8_t l_2718 = 0x7FL;
+ int32_t l_2727 = 1L;
+ uint16_t l_2757 = 0xBD99L;
+ int32_t * const *l_2787[6];
+ uint8_t ****l_2801 = (void*)0;
+ int16_t l_2802 = 0x2117L;
+ int16_t *l_2803 = &g_2225[9];
+ const uint16_t l_2829 = 65529UL;
+ uint32_t * const l_2837 = (void*)0;
+ int32_t l_2854 = (-1L);
+ int16_t l_2994 = 0x4B9BL;
+ int32_t l_2995 = 0x159AF702L;
+ uint32_t l_3018 = 0x29CF6467L;
+ uint16_t ****l_3023 = &g_1324;
+ int i, j, k;
+ for (i = 0; i < 2; i++)
+ l_2528[i] = 0x408F1F41L;
+ for (i = 0; i < 6; i++)
+ l_2787[i] = &g_37;
+ for (p_21 = (-4); (p_21 == 4); p_21 = safe_add_func_int16_t_s_s(p_21, 3))
+ { /* block id: 6 */
+ const int16_t l_2281 = 0x5292L;
+ int32_t *l_2321 = &g_2234;
+ int32_t *l_2322 = (void*)0;
+ int32_t l_2323 = 0L;
+ int32_t *l_2324 = (void*)0;
+ int32_t *l_2325 = &g_60[0][0][2];
+ int32_t *l_2326 = &l_2279;
+ int32_t *l_2327 = &g_60[0][4][3];
+ int32_t *l_2328[1][4][10] = {{{&g_60[1][2][0],&g_61,&g_60[1][2][0],&g_60[1][2][0],&g_61,&g_60[1][2][0],&g_60[1][2][0],&g_61,&g_60[1][2][0],&g_60[1][2][0]},{&g_61,&g_61,&g_2236,&g_61,&g_61,&g_2236,&g_61,&g_61,&g_2236,&g_61},{&g_61,&g_60[1][2][0],&g_60[1][2][0],&g_61,&g_60[1][2][0],&g_60[1][2][0],&g_61,&g_60[1][2][0],&g_60[1][2][0],&g_61},{&g_60[1][2][0],&g_61,&g_60[1][2][0],&g_60[1][2][0],&g_61,&g_60[1][2][0],&g_60[1][2][0],&g_61,&g_60[1][2][0],&g_60[1][2][0]}}};
+ int i, j, k;
+ for (p_20 = 11; (p_20 == (-22)); --p_20)
+ { /* block id: 9 */
+ uint32_t **l_2265 = &g_434;
+ int32_t l_2282 = (-1L);
+ uint32_t l_2317 = 0UL;
+ int32_t *l_2320 = &l_2282;
+ for (p_23 = 0; (p_23 >= 0); p_23 -= 1)
+ { /* block id: 12 */
+ int32_t *l_35[7][7] = {{&g_36,&g_36,&g_36,(void*)0,&g_36,&g_36,&g_36},{&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36},{&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36},{&g_36,(void*)0,&g_36,&g_36,(void*)0,&g_36,(void*)0},{&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36},{&g_36,&g_36,&g_36,&g_36,&g_36,&g_36,&g_36},{&g_36,&g_36,(void*)0,&g_36,&g_36,&g_36,&g_36}};
+ int32_t **l_34[9][10][2] = {{{&l_35[4][1],&l_35[1][3]},{&l_35[0][0],&l_35[1][3]},{&l_35[5][1],(void*)0},{(void*)0,&l_35[1][3]},{(void*)0,(void*)0},{&l_35[5][1],&l_35[1][3]},{&l_35[0][0],&l_35[1][3]},{&l_35[4][1],(void*)0},{&l_35[1][3],(void*)0},{(void*)0,&l_35[1][3]}},{{&l_35[4][1],&l_35[1][3]},{&l_35[1][3],&l_35[1][3]},{&l_35[4][1],&l_35[1][3]},{(void*)0,(void*)0},{&l_35[1][3],(void*)0},{&l_35[4][1],&l_35[1][3]},{&l_35[0][0],&l_35[1][3]},{&l_35[5][1],(void*)0},{(void*)0,&l_35[1][3]},{(void*)0,(void*)0}},{{&l_35[5][1],&l_35[1][3]},{&l_35[0][0],&l_35[1][3]},{&l_35[4][1],(void*)0},{&l_35[1][3],(void*)0},{(void*)0,&l_35[1][3]},{&l_35[4][1],&l_35[1][3]},{&l_35[1][3],&l_35[1][3]},{&l_35[4][1],&l_35[1][3]},{(void*)0,(void*)0},{&l_35[1][3],(void*)0}},{{&l_35[4][1],&l_35[1][3]},{&l_35[0][0],&l_35[1][3]},{&l_35[5][1],(void*)0},{(void*)0,&l_35[1][3]},{(void*)0,(void*)0},{&l_35[5][1],&l_35[1][3]},{&l_35[0][0],&l_35[1][3]},{&l_35[4][1],(void*)0},{&l_35[1][3],(void*)0},{(void*)0,&l_35[1][0]}},{{&l_35[1][3],&l_35[1][3]},{&l_35[5][6],&l_35[1][3]},{&l_35[1][3],&l_35[1][0]},{&l_35[1][3],&l_35[1][3]},{&l_35[2][1],&l_35[6][4]},{&l_35[1][3],&l_35[0][3]},{&l_35[5][1],&l_35[1][3]},{&l_35[1][3],&l_35[6][4]},{&l_35[1][3],&l_35[5][0]},{&l_35[1][3],&l_35[6][4]}},{{&l_35[1][3],&l_35[1][3]},{&l_35[5][1],&l_35[0][3]},{&l_35[1][3],&l_35[6][4]},{&l_35[2][1],&l_35[1][3]},{&l_35[1][3],&l_35[1][0]},{&l_35[1][3],&l_35[1][3]},{&l_35[5][6],&l_35[1][3]},{&l_35[1][3],&l_35[1][0]},{&l_35[1][3],&l_35[1][3]},{&l_35[2][1],&l_35[6][4]}},{{&l_35[1][3],&l_35[0][3]},{&l_35[5][1],&l_35[1][3]},{&l_35[1][3],&l_35[6][4]},{&l_35[1][3],&l_35[5][0]},{&l_35[1][3],&l_35[6][4]},{&l_35[1][3],&l_35[1][3]},{&l_35[5][1],&l_35[0][3]},{&l_35[1][3],&l_35[6][4]},{&l_35[2][1],&l_35[1][3]},{&l_35[1][3],&l_35[1][0]}},{{&l_35[1][3],&l_35[1][3]},{&l_35[5][6],&l_35[1][3]},{&l_35[1][3],&l_35[1][0]},{&l_35[1][3],&l_35[1][3]},{&l_35[2][1],&l_35[6][4]},{&l_35[1][3],&l_35[0][3]},{&l_35[5][1],&l_35[1][3]},{&l_35[1][3],&l_35[6][4]},{&l_35[1][3],&l_35[5][0]},{&l_35[1][3],&l_35[6][4]}},{{&l_35[1][3],&l_35[1][3]},{&l_35[5][1],&l_35[0][3]},{&l_35[1][3],&l_35[6][4]},{&l_35[2][1],&l_35[1][3]},{&l_35[1][3],&l_35[1][0]},{&l_35[1][3],&l_35[1][3]},{&l_35[5][6],&l_35[1][3]},{&l_35[1][3],&l_35[1][0]},{&l_35[1][3],&l_35[1][3]},{&l_35[2][1],&l_35[6][4]}}};
+ int32_t **l_2264 = &l_35[1][3];
+ const int16_t l_2276[8] = {0xA6A5L,0xA6A5L,0xA6A5L,0xA6A5L,0xA6A5L,0xA6A5L,0xA6A5L,0xA6A5L};
+ uint8_t ****l_2288 = &g_2219;
+ int i, j, k;
+ }
+ return p_21;
+ }
+ l_2333[4][4][3]++;
+ if (((*g_37) = ((*l_2321) = (safe_mod_func_int8_t_s_s((-1L), 0xF3L)))))
+ { /* block id: 1225 */
+ return l_2338;
+ }
+ else
+ { /* block id: 1227 */
+ uint32_t l_2341 = 18446744073709551615UL;
+ l_2341++;
+ }
+ for (l_2329 = 0; (l_2329 >= 27); l_2329++)
+ { /* block id: 1232 */
+ for (g_145 = 0; (g_145 > 23); g_145 = safe_add_func_uint16_t_u_u(g_145, 1))
+ { /* block id: 1235 */
+ return l_2331;
+ }
+ for (l_2330 = 0; (l_2330 > (-5)); l_2330 = safe_sub_func_int16_t_s_s(l_2330, 5))
+ { /* block id: 1240 */
+ return l_2333[4][3][1];
+ }
+ (*g_37) = (safe_rshift_func_int8_t_s_s(p_23, 2));
+ }
+ }
+ for (g_1250 = 0; (g_1250 <= 2); g_1250 += 1)
+ { /* block id: 1248 */
+ const int32_t *l_2353 = &g_36;
+ const int32_t **l_2354 = &l_2353;
+ int8_t * const *l_2386 = (void*)0;
+ int8_t * const **l_2385[5] = {(void*)0,(void*)0,(void*)0,(void*)0,(void*)0};
+ int8_t ***l_2393 = &g_435;
+ int8_t ****l_2392 = &l_2393;
+ int32_t l_2400 = 0xE45F6443L;
+ int8_t l_2430[4];
+ const int16_t *l_2450 = &g_2451;
+ int16_t *l_2452 = &g_775;
+ const uint16_t *l_2485 = &g_145;
+ const uint16_t **l_2484 = &l_2485;
+ const uint16_t ***l_2483[8];
+ const uint32_t l_2507 = 0xC6FC5E1DL;
+ int8_t *l_2512 = &g_126;
+ int32_t l_2523 = 4L;
+ int32_t l_2524 = 9L;
+ int32_t l_2525 = 0x626DBABCL;
+ int32_t l_2526 = 0xB725935DL;
+ int32_t l_2527 = (-4L);
+ int32_t l_2529 = 1L;
+ int32_t l_2530 = 1L;
+ uint8_t l_2531[6][3][9] = {{{0xF8L,0x49L,7UL,9UL,6UL,0x07L,254UL,255UL,2UL},{9UL,0x1EL,0xA4L,0x69L,248UL,0xBCL,1UL,0x07L,0xADL},{2UL,7UL,3UL,0xFBL,0x34L,0xFBL,3UL,7UL,2UL}},{{0xFBL,2UL,9UL,4UL,4UL,0x5FL,0xAEL,255UL,0x21L},{0xD8L,9UL,255UL,0x53L,0xBCL,0x34L,4UL,0xEEL,7UL},{0xFBL,4UL,0xAEL,0xD8L,0xEAL,0xEAL,7UL,9UL,3UL}},{{2UL,0x4AL,0xF8L,0UL,0x21L,250UL,9UL,0xDAL,255UL},{9UL,0x46L,0xDAL,9UL,249UL,0UL,0x28L,0x03L,1UL},{0xF8L,0xBCL,0xBBL,0x58L,0x56L,9UL,0xF2L,0xBCL,0x07L}},{{0x58L,0x11L,251UL,0x07L,0xB7L,252UL,4UL,0x44L,255UL},{0x03L,6UL,248UL,251UL,251UL,248UL,6UL,0x03L,0x21L},{6UL,0x0BL,0xD8L,2UL,255UL,0x56L,0UL,0x49L,255UL}},{{249UL,3UL,0x44L,255UL,0xBCL,0xFBL,0x56L,0x98L,0x21L},{0xBFL,254UL,0xEAL,3UL,0x5FL,248UL,255UL,251UL,255UL},{0xBBL,248UL,4UL,248UL,255UL,255UL,254UL,7UL,0x07L}},{{0xF2L,4UL,0x21L,0x4AL,9UL,0x11L,0xEEL,0xD6L,0xBFL},{0xCCL,255UL,0xF2L,0x4AL,7UL,4UL,0x34L,248UL,0x49L},{255UL,0xBFL,0x03L,248UL,0x98L,9UL,0xCCL,0x53L,0x53L}}};
+ uint32_t l_2558 = 4294967295UL;
+ int16_t l_2602 = (-1L);
+ int i, j, k;
+ for (i = 0; i < 4; i++)
+ l_2430[i] = 0L;
+ for (i = 0; i < 8; i++)
+ l_2483[i] = &l_2484;
+ p_24 = (&g_659 != l_2352);
+ if (g_69[(g_1250 + 6)])
+ continue;
+ (*l_2354) = l_2353;
+ (*l_2354) = &p_22;
+ for (l_2330 = 0; (l_2330 <= 2); l_2330 += 1)
+ { /* block id: 1255 */
+ int8_t ****l_2382 = (void*)0;
+ int8_t ***l_2384 = &g_435;
+ int8_t ****l_2383 = &l_2384;
+ int8_t *****l_2394 = &l_2383;
+ int32_t l_2399[9][6][1] = {{{(-1L)},{(-1L)},{(-1L)},{0x5EEB2947L},{(-1L)},{(-1L)}},{{(-1L)},{(-1L)},{(-1L)},{0x5EEB2947L},{(-1L)},{(-1L)}},{{(-1L)},{(-1L)},{(-1L)},{0x5EEB2947L},{(-1L)},{(-1L)}},{{(-1L)},{(-1L)},{(-1L)},{0x5EEB2947L},{(-1L)},{(-1L)}},{{(-1L)},{(-1L)},{(-1L)},{0x5EEB2947L},{(-1L)},{(-1L)}},{{(-1L)},{(-1L)},{(-1L)},{0x5EEB2947L},{(-1L)},{(-1L)}},{{(-1L)},{(-1L)},{(-1L)},{0x5EEB2947L},{(-1L)},{(-1L)}},{{(-1L)},{(-1L)},{(-1L)},{0x5EEB2947L},{(-1L)},{(-1L)}},{{(-1L)},{(-1L)},{(-1L)},{0x5EEB2947L},{(-1L)},{(-1L)}}};
+ uint16_t l_2418 = 65533UL;
+ uint32_t *l_2426 = &g_138[3];
+ uint32_t l_2509 = 1UL;
+ uint8_t ****l_2560 = &g_2219;
+ uint8_t *****l_2559 = &l_2560;
+ uint32_t l_2573 = 18446744073709551612UL;
+ int i, j, k;
+ (*g_37) = (safe_lshift_func_int8_t_s_s(((((((*g_1590) = ((safe_mod_func_uint16_t_u_u(((*g_713) = (((((((safe_div_func_uint8_t_u_u((safe_lshift_func_int16_t_s_u(((safe_div_func_uint16_t_u_u(((((*g_434) = ((safe_mul_func_uint8_t_u_u(l_2340, (safe_mul_func_uint16_t_u_u((((safe_rshift_func_int8_t_s_u(l_2333[4][4][3], p_21)) , ((!(0x8BAFL > (((*l_2383) = ((safe_mul_func_int16_t_s_s(((safe_mod_func_int16_t_s_s(l_2375, (*g_713))) & (safe_mul_func_uint8_t_u_u(0xC5L, (safe_rshift_func_int16_t_s_u((safe_rshift_func_int8_t_s_s(p_24, 6)), 7))))), (*g_713))) , (void*)0)) != l_2385[4]))) >= 0x4190L)) >= l_2339), l_2339)))) && 6UL)) && p_24) , p_23), p_23)) || (-1L)), (*g_713))), g_2387[2][1])) | (*g_1846)) == p_21) , (***g_993)) | 1UL) > (*g_1846)) , 1UL)), p_22)) , (*g_1590))) == &p_23) == l_2333[4][4][3]) <= p_20) == 251UL), 5));
+ }
+ }
+ for (l_2332 = 1; (l_2332 >= 0); l_2332 -= 1)
+ { /* block id: 1347 */
+ const int32_t *l_2638 = &l_2339;
+ uint16_t ** const l_2650[10] = {&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713,&g_713};
+ int32_t l_2656 = 1L;
+ int32_t l_2659 = 0x8D981328L;
+ int16_t l_2694 = (-10L);
+ int16_t l_2706 = 0L;
+ int32_t l_2709 = 0xF0B25886L;
+ int32_t l_2712 = (-8L);
+ int32_t l_2713[10][1] = {{4L},{4L},{0x088957D1L},{4L},{4L},{0x088957D1L},{4L},{4L},{0x088957D1L},{4L}};
+ uint16_t l_2730 = 0xFE70L;
+ uint8_t **l_2752 = &g_659;
+ uint32_t **l_2791 = (void*)0;
+ uint32_t ***l_2790 = &l_2791;
+ uint32_t ***l_2792 = (void*)0;
+ uint32_t **l_2793 = &g_434;
+ int8_t *** const *l_2798 = (void*)0;
+ uint8_t * const ****l_2800[2][10][6] = {{{&g_2799,&g_2799,&g_2799,&g_2799,&g_2799,&g_2799},{&g_2799,&g_2799,&g_2799,&g_2799,&g_2799,&g_2799},{&g_2799,&g_2799,&g_2799,&g_2799,&g_2799,&g_2799},{&g_2799,&g_2799,&g_2799,&g_2799,&g_2799,(void*)0},{&g_2799,(void*)0,&g_2799,(void*)0,&g_2799,&g_2799},{&g_2799,&g_2799,&g_2799,&g_2799,&g_2799,&g_2799},{&g_2799,&g_2799,&g_2799,&g_2799,&g_2799,&g_2799},{&g_2799,&g_2799,(void*)0,&g_2799,&g_2799,&g_2799},{&g_2799,&g_2799,&g_2799,(void*)0,&g_2799,&g_2799},{&g_2799,(void*)0,&g_2799,&g_2799,&g_2799,&g_2799}},{{&g_2799,&g_2799,&g_2799,&g_2799,&g_2799,&g_2799},{&g_2799,&g_2799,&g_2799,&g_2799,&g_2799,&g_2799},{&g_2799,&g_2799,&g_2799,&g_2799,&g_2799,&g_2799},{&g_2799,(void*)0,(void*)0,&g_2799,&g_2799,(void*)0},{&g_2799,&g_2799,&g_2799,&g_2799,&g_2799,&g_2799},{(void*)0,&g_2799,&g_2799,&g_2799,&g_2799,&g_2799},{&g_2799,&g_2799,&g_2799,&g_2799,&g_2799,&g_2799},{&g_2799,(void*)0,&g_2799,&g_2799,&g_2799,&g_2799},{&g_2799,&g_2799,&g_2799,&g_2799,&g_2799,&g_2799},{&g_2799,&g_2799,&g_2799,&g_2799,&g_2799,&g_2799}}};
+ uint8_t l_2914 = 255UL;
+ int i, j, k;
+ }
+ for (p_24 = 1; (p_24 >= 0); p_24 -= 1)
+ { /* block id: 1503 */
+ int32_t *l_2915 = &g_1096[0];
+ int8_t ** const l_2916 = (void*)0;
+ int32_t l_2928 = 0xB06FF22EL;
+ uint16_t *l_2938[5][3];
+ int32_t l_2971 = 9L;
+ int8_t ***l_2975 = &g_435;
+ uint32_t **l_2984 = (void*)0;
+ int32_t l_2998 = (-4L);
+ int32_t l_2999 = 0xB5DEAA51L;
+ int32_t l_3000[7];
+ uint16_t *****l_3024 = (void*)0;
+ uint16_t *****l_3025 = &l_3023;
+ int i, j;
+ for (i = 0; i < 5; i++)
+ {
+ for (j = 0; j < 3; j++)
+ l_2938[i][j] = &g_1758[3][0][1];
+ }
+ for (i = 0; i < 7; i++)
+ l_3000[i] = (-3L);
+ if (((*g_1590) != l_2915))
+ { /* block id: 1504 */
+ uint16_t *l_2937 = &g_1250;
+ int8_t **** const l_2974 = &l_2396;
+ int32_t l_2983 = 4L;
+ int32_t ****l_2993 = &g_454;
+ int32_t l_2996[3][1];
+ uint32_t l_3015 = 0xBEECD428L;
+ int i, j;
+ for (i = 0; i < 3; i++)
+ {
+ for (j = 0; j < 1; j++)
+ l_2996[i][j] = 6L;
+ }
+ for (g_61 = 0; (g_61 <= 1); g_61 += 1)
+ { /* block id: 1507 */
+ int8_t l_2929 = (-4L);
+ int32_t *l_2930 = &g_36;
+ int8_t ***l_2976[5];
+ int32_t l_2997 = 0L;
+ int i;
+ for (i = 0; i < 5; i++)
+ l_2976[i] = &g_435;
+ for (l_2854 = 0; (l_2854 <= 2); l_2854 += 1)
+ { /* block id: 1510 */
+ int8_t **l_2917 = &g_2246;
+ uint16_t ****l_2925 = &g_1324;
+ int32_t l_2977 = 1L;
+ uint8_t l_3001[3][3][5] = {{{0xC0L,253UL,253UL,0xC0L,253UL},{251UL,0UL,0x97L,0UL,251UL},{253UL,0xC0L,253UL,253UL,0xC0L}},{{251UL,0x17L,0xEAL,0UL,0xEAL},{0xC0L,0xC0L,0x82L,0xC0L,0xC0L},{0xEAL,0UL,0xEAL,0x17L,251UL}},{{0xC0L,253UL,253UL,0xC0L,253UL},{251UL,0UL,0x97L,0UL,251UL},{253UL,0xC0L,253UL,253UL,0xC0L}}};
+ int i, j, k;
+ for (g_131 = 0; (g_131 <= 4); g_131 += 1)
+ { /* block id: 1513 */
+ int8_t ***l_2918 = &l_2917;
+ int8_t l_2939 = 0x4DL;
+ int32_t l_2946 = (-7L);
+ uint8_t *l_2978 = &g_31[0];
+ int i, j, k;
+ l_2930 = (((l_2916 == ((*l_2918) = l_2917)) , (safe_rshift_func_int8_t_s_u((0xA3L || ((safe_lshift_func_int8_t_s_s(((void*)0 != l_2915), 6)) >= (safe_lshift_func_int8_t_s_u(((((*g_1846) = (l_2925 != (void*)0)) < (((safe_mul_func_int16_t_s_s(l_2928, ((+((0xCEL >= 0x34L) , l_2928)) != p_22))) , (*g_434)) , (-1L))) , (-2L)), l_2929)))), p_23))) , (void*)0);
+ l_2930 = ((safe_add_func_int8_t_s_s((p_24 & (safe_mod_func_uint32_t_u_u(((safe_add_func_uint32_t_u_u(((**g_1324) != (l_2938[4][2] = l_2937)), ((((l_2939 | (safe_sub_func_int32_t_s_s(0x0979E7F6L, (safe_lshift_func_int16_t_s_s(p_24, 14))))) != ((p_22 >= (l_2528[p_24] = (safe_mod_func_uint8_t_u_u(0x34L, p_20)))) == p_23)) < 0xC3B9L) ^ (****g_992)))) ^ l_2939), p_24))), l_2946)) , (void*)0);
+ (*g_146) = (safe_div_func_int32_t_s_s((safe_mod_func_uint16_t_u_u((g_1758[(l_2854 + 3)][(l_2854 + 3)][l_2854] |= 1UL), (safe_lshift_func_uint16_t_u_u((((void*)0 != &g_434) , (safe_lshift_func_int16_t_s_u((((*l_2978) = (safe_mod_func_int32_t_s_s((((safe_mul_func_int16_t_s_s((safe_add_func_uint16_t_u_u((safe_sub_func_uint8_t_u_u(((((safe_div_func_int8_t_s_s((((**g_712) |= ((+((((safe_div_func_uint16_t_u_u((((safe_lshift_func_uint8_t_u_s(((*g_1846) != ((*l_2803) = (safe_mul_func_uint16_t_u_u((l_2971 || ((((*g_2246) == ((safe_add_func_uint32_t_u_u((g_2675 != l_2974), ((((*l_2974) = l_2975) == l_2976[0]) < p_24))) , l_2928)) <= p_20) != 0x89L)), p_20)))), (*g_2246))) ^ l_2977) ^ (*g_2246)), p_22)) ^ p_21) <= 0xE8FBL) == l_2528[p_24])) != p_22)) , 0L), 0xA7L)) , l_2528[p_24]) | (*g_434)) ^ (*g_1846)), 3L)), p_20)), 65527UL)) , 2L) & (*g_1846)), p_24))) <= p_24), l_2939))), 5)))), 0xAECA8320L));
+ }
+ if ((((safe_mod_func_int16_t_s_s((safe_lshift_func_uint16_t_u_u((l_2971 <= p_21), 3)), ((l_2528[p_24] = l_2983) , ((((((p_22 , (l_2984 == &g_434)) >= (safe_add_func_uint8_t_u_u((l_2528[p_24] != (((safe_add_func_int16_t_s_s((safe_add_func_uint16_t_u_u((((*g_37) = ((l_2993 == (void*)0) < 0UL)) , (***g_993)), p_23)), (***g_993))) , (void*)0) == l_2993)), p_24))) & 0xEC1A434FL) , p_23) , p_21) | 0xBD554C6CL)))) && (****g_992)) & (*g_434)))
+ { /* block id: 1529 */
+ ++l_3001[1][0][3];
+ (*g_514) ^= p_21;
+ }
+ else
+ { /* block id: 1532 */
+ int32_t l_3012 = 0L;
+ int i, j, k;
+ (*g_37) ^= (safe_mul_func_uint16_t_u_u((safe_sub_func_uint16_t_u_u(65535UL, ((safe_add_func_int8_t_s_s((safe_lshift_func_int8_t_s_u(((p_20 , &l_2930) == (*g_454)), l_3012)), ((((safe_sub_func_int16_t_s_s((((*g_434) = (p_21 = (p_22 != l_3001[1][0][3]))) < ((((g_1758[(g_61 + 3)][(p_24 + 7)][l_2854] = (&g_2246 != (*l_2975))) != p_23) , 0xEEL) > p_22)), (**g_712))) <= (*g_713)) , l_3015) >= p_24))) , p_22))), 2UL));
+ }
+ }
+ }
+ return p_24;
+ }
+ else
+ { /* block id: 1541 */
+ int32_t l_3016 = 0x8DB39DADL;
+ int32_t l_3017[3];
+ int i;
+ for (i = 0; i < 3; i++)
+ l_3017[i] = 0x6AFC90CCL;
+ l_3018--;
+ }
+ (*g_514) |= (&g_1324 != ((safe_mul_func_uint8_t_u_u(6UL, 0x72L)) , ((*l_3025) = l_3023)));
+ }
+ return p_21;
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_36 g_69 g_37 g_138 g_436 g_360 g_510 g_434 g_408 g_31 g_59 g_146 g_60 g_2 g_514 g_124 g_415 g_658 g_126 g_61 g_713 g_454 g_455 g_358 g_775 g_435 g_131 g_961 g_1096 g_145 g_992 g_993 g_1202 g_1250 g_712 g_1312 g_1324 g_1590 g_659 g_1509 g_1758 g_2057 g_2075 g_1846 g_1847 g_2127 g_2156 g_1591 g_2236 g_2234
+ * writes: g_36 g_59 g_60 g_61 g_69 g_37 g_360 g_510 g_436 g_145 g_415 g_131 g_31 g_138 g_658 g_712 g_659 g_455 g_775 g_126 g_124 g_358 g_408 g_454 g_1324 g_1483 g_435 g_1509 g_1758 g_514 g_1590 g_1847 g_2219 g_2246 g_2236 g_2234
+ */
+static int32_t * const func_32(int32_t * p_33)
+{ /* block id: 14 */
+ uint16_t l_40 = 0xF32AL;
+ int32_t *l_526 = &g_360;
+ int32_t **l_525 = &l_526;
+ int32_t ** const l_533 = &g_37;
+ int16_t *l_774[2];
+ int16_t *l_776[5][9] = {{&g_124,&g_775,&g_775,&g_124,(void*)0,&g_124,&g_775,&g_775,&g_124},{&g_775,&g_775,&g_124,&g_775,&g_775,&g_775,&g_775,&g_124,&g_775},{&g_775,(void*)0,&g_124,&g_775,(void*)0,&g_775,(void*)0,&g_124,&g_124},{&g_775,&g_775,&g_775,&g_775,&g_775,&g_775,&g_775,&g_775,&g_124},{&g_124,(void*)0,&g_124,&g_775,&g_775,&g_124,(void*)0,&g_124,&g_775}};
+ uint16_t l_777[6][1] = {{65535UL},{9UL},{65535UL},{65535UL},{9UL},{65535UL}};
+ int32_t ***l_1792 = &g_455;
+ int32_t *l_2249 = &g_2236;
+ int32_t *l_2250 = &g_2234;
+ int i, j;
+ for (i = 0; i < 2; i++)
+ l_774[i] = &g_775;
+ (*l_2250) ^= ((*l_2249) |= (safe_mul_func_uint8_t_u_u(l_40, func_41(((*l_1792) = func_44((g_775 ^= ((l_40 < func_49(l_40, (((safe_lshift_func_uint16_t_u_u((((func_57(l_40) >= (l_525 == ((0UL ^ (safe_div_func_uint8_t_u_u((safe_mod_func_uint8_t_u_u((safe_mod_func_int8_t_s_s(0xA1L, l_40)), 255UL)), l_40))) , &l_526))) ^ l_40) , 0x108BL), 3)) >= 8UL) , l_533), g_138[3], l_40, g_436)) <= g_408[3][9])), l_40, l_40, l_777[4][0])), p_33))));
+ (*p_33) = (((safe_div_func_uint32_t_u_u((*l_2249), (safe_unary_minus_func_int8_t_s((safe_div_func_uint16_t_u_u((~(safe_rshift_func_int8_t_s_u((((*l_2249) >= ((safe_sub_func_int32_t_s_s(((((*g_713) = (safe_mul_func_int8_t_s_s((*l_2249), (*l_2249)))) <= (*l_2250)) != ((*l_2250) & 0x31L)), ((((*l_2250) || 0x9EL) & (*l_2249)) >= (*p_33)))) ^ (*l_2249))) <= (*g_434)), 4))), (*l_2249))))))) ^ (*l_2250)) & (*l_2250));
+ p_33 = ((*l_533) = p_33);
+ for (g_124 = 0; (g_124 < (-4)); g_124--)
+ { /* block id: 1175 */
+ return p_33;
+ }
+ return p_33;
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_415 g_124 g_60 g_434 g_138 g_1509 g_510 g_358 g_2057 g_61 g_146 g_31 g_2075 g_514 g_59 g_408 g_1846 g_1847 g_2127 g_1096 g_36 g_713 g_69 g_2156 g_131 g_436 g_775 g_1591 p_24
+ * writes: g_415 g_124 g_1509 g_131 g_510 g_358 g_514 g_61 g_60 g_1590 g_436 g_1847 g_59 g_36 g_69 g_775 g_126 g_31 g_138 g_2219 g_2246 p_24
+ */
+static uint8_t func_41(int32_t ** p_42, int32_t * p_43)
+{ /* block id: 912 */
+ int32_t *l_1795 = &g_60[0][3][2];
+ int32_t l_1864 = 0x3228974EL;
+ int32_t l_1869[4] = {0xA483868DL,0xA483868DL,0xA483868DL,0xA483868DL};
+ const int8_t *l_1930 = &g_126;
+ const int8_t **l_1929 = &l_1930;
+ const int8_t ***l_1928 = &l_1929;
+ const int8_t ****l_1927 = &l_1928;
+ uint32_t l_1968[8][4] = {{2UL,1UL,2UL,0xDC5C3954L},{1UL,2UL,4294967292UL,2UL},{2UL,0UL,4294967292UL,4294967292UL},{1UL,1UL,2UL,4294967292UL},{0xDC5C3954L,0UL,0xDC5C3954L,2UL},{0xDC5C3954L,2UL,2UL,0xDC5C3954L},{1UL,2UL,4294967292UL,2UL},{2UL,0UL,4294967292UL,4294967292UL}};
+ int32_t l_1988 = 0x9CEC8610L;
+ uint32_t l_1993 = 0xC327587BL;
+ uint16_t *l_2036 = &g_69[4];
+ int32_t l_2046 = (-6L);
+ int32_t l_2047 = 3L;
+ int32_t l_2149 = 1L;
+ uint32_t l_2171 = 0x43A65C1DL;
+ uint8_t l_2174 = 0x1AL;
+ const int8_t l_2220 = (-3L);
+ int8_t l_2223[8] = {0x4EL,0x4EL,0x4EL,0x4EL,0x4EL,0x4EL,0x4EL,0x4EL};
+ int i, j;
+lbl_1873:
+ for (g_415 = 0; (g_415 < (-25)); g_415--)
+ { /* block id: 915 */
+ int32_t l_1813 = 0xD5715D00L;
+ int8_t l_1828 = 3L;
+ int32_t l_1831 = 0xCCA7621AL;
+ int32_t *l_1862 = &g_59[1];
+ int32_t *l_1863 = &g_59[3];
+ int32_t *l_1865 = &g_60[0][4][3];
+ int32_t *l_1866 = &g_59[6];
+ int32_t *l_1867 = (void*)0;
+ int32_t *l_1868[4][4][2] = {{{&g_61,&g_36},{&g_60[0][4][1],&g_61},{&l_1831,&g_59[1]},{&l_1831,&g_61}},{{&g_60[0][4][1],&g_36},{&g_61,&l_1831},{(void*)0,&g_59[1]},{&g_59[1],&g_60[0][1][0]}},{{&g_60[0][1][0],&g_60[0][4][1]},{&g_36,&g_60[0][4][1]},{&g_60[0][1][0],&g_60[0][1][0]},{&g_59[1],&g_59[1]}},{{(void*)0,&l_1831},{&g_61,&g_36},{&g_60[0][4][1],&g_61},{&l_1831,&g_59[1]}}};
+ uint8_t l_1870 = 7UL;
+ int i, j, k;
+ for (g_124 = 2; (g_124 >= 0); g_124 -= 1)
+ { /* block id: 918 */
+ uint8_t l_1803 = 0UL;
+ int32_t l_1812 = 0x0A2A1D39L;
+ int32_t l_1815[7][2][5] = {{{0L,0x1DDBFAEFL,0x1394708CL,(-7L),0xCF951AD2L},{9L,0x81596779L,(-7L),(-8L),0xB9144199L}},{{0x5CDB587BL,0L,0x81596779L,6L,0x08D53763L},{(-9L),0L,0L,0L,(-9L)}},{{(-1L),0x81596779L,0xB9144199L,1L,0x9F509A90L},{0xFFC6732DL,0x1DDBFAEFL,0xFAAD1AA0L,0xCF951AD2L,0xE291B965L}},{{(-7L),(-1L),0x4A8C519EL,0x81596779L,0x9F509A90L},{0xEA7A38EFL,0xCF951AD2L,6L,(-1L),(-9L)}},{{0x9F509A90L,(-9L),0xB975A64AL,0xFAAD1AA0L,0x08D53763L},{0xCF951AD2L,0xB9144199L,0xB975A64AL,0xB975A64AL,0xB9144199L}},{{0x2DAB1CE3L,8L,6L,(-1L),0xCF951AD2L},{(-1L),1L,0x4A8C519EL,0x08D53763L,0L}},{{0xB9144199L,0x4A8C519EL,0xFAAD1AA0L,0xFFC6732DL,(-1L)},{(-1L),(-1L),0xB9144199L,8L,0x4A8C519EL}}};
+ int16_t *l_1843 = &g_124;
+ const uint8_t *l_1858 = (void*)0;
+ const uint8_t **l_1857[6][1];
+ const uint8_t ***l_1856 = &l_1857[4][0];
+ int i, j, k;
+ for (i = 0; i < 6; i++)
+ {
+ for (j = 0; j < 1; j++)
+ l_1857[i][j] = &l_1858;
+ }
+ }
+ l_1870--;
+ if (g_124)
+ goto lbl_1873;
+ }
+ if ((0xB1F92AABL == ((safe_lshift_func_int8_t_s_u(((*l_1795) , (*l_1795)), 4)) > (*g_434))))
+ { /* block id: 956 */
+ const int32_t *l_1884 = &l_1869[3];
+ int8_t ***l_1901 = &g_435;
+ int8_t * const l_1904 = (void*)0;
+ int8_t * const *l_1903[1][6];
+ int8_t * const **l_1902 = &l_1903[0][2];
+ uint8_t l_1951 = 0xABL;
+ int32_t l_1966 = 0xF42C7F39L;
+ int32_t l_1967[3][8][6] = {{{7L,0x6AE2ACC6L,0L,0x34FDF0B3L,0x63305F13L,4L},{0x7CA956D1L,(-1L),0x63305F13L,0x6AE2ACC6L,4L,4L},{0L,0L,0L,0L,(-3L),0x6AE2ACC6L},{4L,(-1L),0xC143E02DL,0xB364E1CBL,0L,0x63305F13L},{0xC143E02DL,0x7CA956D1L,0L,(-1L),0L,(-1L)},{(-1L),(-1L),(-1L),4L,(-3L),0x7CA956D1L},{0x6AE2ACC6L,0L,0x34FDF0B3L,0x63305F13L,4L,(-3L)},{0xB364E1CBL,(-1L),4L,0x63305F13L,0x63305F13L,4L}},{{0x6AE2ACC6L,0x6AE2ACC6L,(-1L),7L,(-1L),(-3L)},{(-3L),0x6AE2ACC6L,0xC143E02DL,0x7CA956D1L,0L,(-1L)},{0xB364E1CBL,(-3L),0xC143E02DL,0L,0xC143E02DL,(-3L)},{4L,0L,(-1L),4L,0L,7L},{4L,0L,7L,0xC143E02DL,0x63305F13L,(-1L)},{0L,0L,(-1L),(-1L),0L,0L},{0L,0L,(-3L),0x6AE2ACC6L,0xC143E02DL,0x7CA956D1L},{(-1L),(-3L),0x63305F13L,0xB364E1CBL,0L,0x34FDF0B3L}},{{(-1L),0x6AE2ACC6L,0xB364E1CBL,0x6AE2ACC6L,(-1L),0xC143E02DL},{0L,0xC143E02DL,0L,(-1L),0x34FDF0B3L,4L},{0L,0x7CA956D1L,0x34FDF0B3L,0xC143E02DL,4L,4L},{4L,0L,0L,4L,(-1L),0xC143E02DL},{4L,(-1L),0xB364E1CBL,0L,0x6AE2ACC6L,0x34FDF0B3L},{0xB364E1CBL,0L,0x63305F13L,0x7CA956D1L,0x6AE2ACC6L,0x7CA956D1L},{(-3L),(-1L),(-3L),7L,(-1L),0L},{0xC143E02DL,0L,(-1L),0x34FDF0B3L,4L,(-1L)}}};
+ int8_t l_2037 = 0L;
+ int i, j, k;
+ for (i = 0; i < 1; i++)
+ {
+ for (j = 0; j < 6; j++)
+ l_1903[i][j] = &l_1904;
+ }
+ for (g_1509 = (-16); (g_1509 != 56); ++g_1509)
+ { /* block id: 959 */
+ int32_t *l_1880 = &g_36;
+ int32_t **l_1881 = &l_1795;
+ uint16_t **l_1896 = (void*)0;
+ int16_t l_1915 = 0xADC0L;
+ uint32_t l_1971 = 1UL;
+ int32_t l_1990 = 0x95171AE5L;
+ uint16_t ****l_2016 = &g_1324;
+ for (g_131 = 24; (g_131 <= 16); --g_131)
+ { /* block id: 962 */
+ l_1880 = &l_1869[0];
+ }
+ (*l_1881) = p_43;
+ for (g_510 = 0; (g_510 > (-17)); --g_510)
+ { /* block id: 968 */
+ const int32_t **l_1885 = &l_1884;
+ (*l_1885) = l_1884;
+ }
+ for (g_358 = 0; (g_358 != (-19)); g_358 = safe_sub_func_uint8_t_u_u(g_358, 9))
+ { /* block id: 973 */
+ int8_t * const ***l_1905 = &l_1902;
+ int32_t l_1909 = 0x8ABB3F3DL;
+ int32_t l_1914[4][3];
+ uint32_t l_1916 = 1UL;
+ int16_t l_1950 = (-1L);
+ uint8_t ***l_1956 = &g_658[4];
+ uint8_t **l_1976 = (void*)0;
+ uint32_t **l_1977 = (void*)0;
+ int32_t l_2045 = (-1L);
+ int32_t *** const *l_2053 = &g_454;
+ int i, j;
+ for (i = 0; i < 4; i++)
+ {
+ for (j = 0; j < 3; j++)
+ l_1914[i][j] = 0x04CCC10CL;
+ }
+ }
+ }
+ }
+ else
+ { /* block id: 1063 */
+ uint16_t l_2086 = 0x4952L;
+ int32_t **l_2087 = &g_1591[5][6];
+ const int32_t *l_2094 = (void*)0;
+ const int32_t **l_2093[3][8];
+ const int32_t ** const *l_2092 = &l_2093[0][7];
+ const int32_t ** const **l_2091 = &l_2092;
+ const int32_t ** const ***l_2090[6][3][9] = {{{&l_2091,&l_2091,&l_2091,(void*)0,(void*)0,&l_2091,&l_2091,&l_2091,(void*)0},{&l_2091,(void*)0,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,(void*)0,&l_2091},{&l_2091,(void*)0,&l_2091,(void*)0,&l_2091,&l_2091,(void*)0,&l_2091,(void*)0}},{{&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091},{&l_2091,&l_2091,(void*)0,&l_2091,(void*)0,&l_2091,&l_2091,(void*)0,&l_2091},{&l_2091,&l_2091,&l_2091,(void*)0,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091}},{{&l_2091,(void*)0,(void*)0,&l_2091,&l_2091,&l_2091,(void*)0,(void*)0,&l_2091},{&l_2091,(void*)0,&l_2091,(void*)0,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091},{(void*)0,&l_2091,&l_2091,&l_2091,&l_2091,(void*)0,&l_2091,&l_2091,&l_2091}},{{&l_2091,(void*)0,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,(void*)0,&l_2091},{&l_2091,&l_2091,&l_2091,(void*)0,(void*)0,&l_2091,&l_2091,&l_2091,&l_2091},{&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091}},{{&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,(void*)0,&l_2091,&l_2091,&l_2091},{&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091},{&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,(void*)0,&l_2091,&l_2091,&l_2091}},{{&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091},{&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,&l_2091},{&l_2091,&l_2091,&l_2091,&l_2091,&l_2091,(void*)0,&l_2091,&l_2091,&l_2091}}};
+ int32_t l_2095 = 6L;
+ int32_t l_2096[7] = {(-7L),(-7L),(-1L),(-7L),(-7L),(-1L),(-7L)};
+ int8_t l_2105 = 0L;
+ int16_t l_2140 = 0xC8C6L;
+ const int8_t l_2173 = 0L;
+ uint32_t **l_2189 = &g_434;
+ int32_t l_2190 = (-7L);
+ uint8_t ***l_2218 = &g_658[3];
+ int16_t l_2235 = 0x4B03L;
+ int32_t l_2237 = (-9L);
+ int16_t l_2238 = 1L;
+ int i, j, k;
+ for (i = 0; i < 3; i++)
+ {
+ for (j = 0; j < 8; j++)
+ l_2093[i][j] = &l_2094;
+ }
+ for (g_358 = (-3); (g_358 == 7); g_358 = safe_add_func_uint32_t_u_u(g_358, 9))
+ { /* block id: 1066 */
+ int32_t **l_2056 = &g_514;
+ (*l_2056) = &l_1869[1];
+ if (g_2057[4][3])
+ break;
+ }
+ if ((*p_43))
+ { /* block id: 1070 */
+ int16_t l_2081 = 0xFF8CL;
+ int32_t l_2102 = 0xDFDFE83FL;
+ int32_t l_2103 = 0xA84F3B43L;
+ int32_t l_2106 = 0x97BF29E5L;
+ uint16_t *l_2132 = &g_69[6];
+ int8_t *l_2138[7] = {&l_2105,&l_2105,&l_2105,&l_2105,&l_2105,&l_2105,&l_2105};
+ uint16_t l_2139 = 0x7CF9L;
+ int32_t *l_2141[9][5][5] = {{{&l_2102,&l_1864,&l_1988,(void*)0,&g_60[1][2][3]},{&g_60[0][4][3],&l_2102,&l_2095,&l_2096[6],&l_2095},{&l_2102,&g_60[0][4][3],&l_2095,&l_1864,&l_2096[4]},{&l_2096[4],&g_36,&l_2095,&l_2102,(void*)0},{(void*)0,&l_2095,&l_2095,&g_60[0][4][3],&l_2106}},{{&l_2102,&l_2102,&l_1988,&g_60[0][4][3],(void*)0},{&l_2102,&l_2095,&l_2095,&l_1864,&l_2096[4]},{(void*)0,&l_2095,&l_2095,&g_36,&l_2095},{&g_36,&l_2102,(void*)0,(void*)0,&g_60[1][2][3]},{&g_60[0][0][2],&l_2095,&g_60[1][1][2],&g_36,&g_36}},{{&l_2095,&g_36,(void*)0,&l_1864,&l_2096[3]},{&l_2095,&g_60[0][4][3],(void*)0,&g_60[0][4][3],&l_2095},{&g_60[0][0][2],&l_2102,&l_2096[4],&g_60[0][4][3],&l_1988},{&g_36,&l_1864,(void*)0,&l_2102,(void*)0},{(void*)0,(void*)0,(void*)0,&l_1864,(void*)0}},{{&l_2102,&l_1988,&g_60[1][1][2],&l_2096[6],&l_1988},{&l_2102,&l_2103,(void*)0,(void*)0,&l_2095},{(void*)0,&l_1988,&l_2095,&g_36,&l_2096[3]},{&l_2096[4],(void*)0,&l_2095,&g_36,&g_36},{&l_2102,&l_1864,&l_1988,(void*)0,&g_60[1][2][3]}},{{&g_60[0][4][3],&l_2102,&l_2095,&l_2096[6],&l_2095},{&l_2102,&g_60[0][4][3],&l_2095,&l_1864,&l_2096[4]},{&l_2096[4],&g_36,(void*)0,&l_2106,&l_2095},{&l_2095,&l_1988,&g_60[0][1][2],(void*)0,&g_60[0][4][3]},{(void*)0,&l_1988,&l_2103,&l_2106,&l_2095}},{{(void*)0,(void*)0,&g_60[0][4][3],&g_60[1][4][3],&l_2096[3]},{&l_2106,(void*)0,(void*)0,&l_1864,(void*)0},{&g_60[1][1][2],&l_1988,&l_2095,&l_2096[4],&l_2095},{&l_2095,&l_1988,(void*)0,&l_1864,&l_2102},{&l_1988,&g_60[1][1][2],&g_36,&g_60[1][4][3],(void*)0}},{{&l_1988,&l_2095,&l_2096[0],&l_2106,&g_60[0][1][2]},{&l_2095,&l_2102,&l_2096[3],(void*)0,(void*)0},{&g_60[1][1][2],(void*)0,&l_2096[0],&l_2106,&l_2096[0]},{&l_2106,&l_2106,&g_36,&l_1864,&l_2096[0]},{(void*)0,&g_60[1][2][3],(void*)0,&g_36,(void*)0}},{{(void*)0,&l_1988,&l_2095,&l_2096[4],&g_60[0][1][2]},{&l_2095,&g_60[1][2][3],(void*)0,&g_60[0][3][0],(void*)0},{&g_36,&l_2106,&g_60[0][4][3],&g_60[0][3][0],&l_2102},{&l_1988,(void*)0,&l_2103,&l_2096[4],&l_2095},{&l_2095,&l_2102,&g_60[0][1][2],&g_36,(void*)0}},{{&l_1988,&l_2095,(void*)0,&l_1864,&l_2096[3]},{&g_36,&g_60[1][1][2],(void*)0,&l_2106,&l_2095},{&l_2095,&l_1988,&g_60[0][1][2],(void*)0,&g_60[0][4][3]},{(void*)0,&l_1988,&l_2103,&l_2106,&l_2095},{(void*)0,(void*)0,&g_60[0][4][3],&g_60[1][4][3],&l_2096[3]}}};
+ int16_t l_2170 = (-5L);
+ int32_t *l_2175 = &g_59[1];
+ uint8_t l_2240 = 0UL;
+ uint16_t l_2243[9] = {5UL,65529UL,5UL,65529UL,5UL,65529UL,5UL,65529UL,5UL};
+ int i, j, k;
+ for (g_61 = 0; (g_61 <= 3); g_61 += 1)
+ { /* block id: 1073 */
+ int8_t l_2071 = 0x1AL;
+ int32_t ** const *l_2078 = &g_455;
+ int32_t ** const **l_2077 = &l_2078;
+ int32_t ** const ***l_2076 = &l_2077;
+ int32_t l_2101[5][1] = {{0xB5C5EAD7L},{4L},{0xB5C5EAD7L},{4L},{0xB5C5EAD7L}};
+ int16_t l_2104 = 1L;
+ int i, j;
+ for (g_358 = 0; (g_358 <= 0); g_358 += 1)
+ { /* block id: 1076 */
+ uint32_t **l_2069 = &g_434;
+ uint32_t ***l_2068 = &l_2069;
+ int32_t l_2070 = 9L;
+ if (((*p_43) = ((*g_146) = 0xE83D4D8CL)))
+ { /* block id: 1079 */
+ (*g_146) = 0x04E90537L;
+ }
+ else
+ { /* block id: 1081 */
+ int i, j;
+ (*p_43) = ((((safe_rshift_func_uint16_t_u_s(g_31[g_358], 0)) || (safe_sub_func_int16_t_s_s((-1L), (safe_rshift_func_int16_t_s_u((g_31[g_358] != ((l_1968[g_358][g_61] || (safe_add_func_int32_t_s_s(((*g_146) = ((safe_sub_func_int32_t_s_s(((((~(!(~(+(*l_1795))))) , 0xFAC5F3D3L) , p_43) == p_43), ((void*)0 != l_2068))) , 0L)), (*g_434)))) <= (-7L))), 6))))) <= l_2070) >= l_2071);
+ }
+ }
+ if ((safe_div_func_uint32_t_u_u(((((*g_146) = (safe_unary_minus_func_int16_t_s((g_2075 != l_2076)))) , (safe_add_func_int32_t_s_s((*p_43), (*g_514)))) & (l_2081 != ((safe_add_func_int32_t_s_s(0xAE26118AL, (safe_mul_func_uint16_t_u_u(l_2086, (!(l_2095 = (((l_2087 == (g_1590 = ((safe_sub_func_uint32_t_u_u(0xEE70B60DL, (*g_514))) , l_2087))) , g_2075) != l_2090[1][2][6]))))))) , 0x877CL))), l_2081)))
+ { /* block id: 1089 */
+ int32_t *l_2097 = &l_1988;
+ int32_t *l_2098 = &g_59[1];
+ int32_t *l_2099 = &l_2096[4];
+ int32_t *l_2100[3];
+ uint32_t l_2107 = 0x9327F5E4L;
+ int i;
+ for (i = 0; i < 3; i++)
+ l_2100[i] = &l_1869[0];
+ l_2107++;
+ for (l_2046 = 1; (l_2046 <= 5); l_2046 += 1)
+ { /* block id: 1093 */
+ const int16_t l_2110 = 0L;
+ if (l_2110)
+ break;
+ }
+ }
+ else
+ { /* block id: 1096 */
+ int16_t l_2117[4] = {0x585BL,0x585BL,0x585BL,0x585BL};
+ int i;
+ for (l_1988 = 4; (l_1988 >= 0); l_1988 -= 1)
+ { /* block id: 1099 */
+ uint8_t *l_2124[6][3][8] = {{{(void*)0,(void*)0,&g_31[0],&g_31[0],(void*)0,(void*)0,&g_131,(void*)0},{(void*)0,(void*)0,&g_131,(void*)0,(void*)0,&g_31[0],&g_31[0],(void*)0},{(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0}},{{(void*)0,(void*)0,(void*)0,&g_31[0],&g_131,&g_131,&g_31[0],(void*)0},{(void*)0,(void*)0,&g_131,(void*)0,(void*)0,(void*)0,&g_131,(void*)0},{(void*)0,(void*)0,&g_31[0],&g_131,&g_131,&g_31[0],(void*)0,(void*)0}},{{(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0},{(void*)0,(void*)0,&g_31[0],&g_31[0],&g_31[0],(void*)0,(void*)0,(void*)0},{&g_31[0],(void*)0,(void*)0,(void*)0,&g_31[0],&g_131,&g_131,&g_31[0]}},{{(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,&g_31[0],(void*)0,(void*)0},{(void*)0,(void*)0,(void*)0,&g_131,(void*)0,(void*)0,&g_131,(void*)0},{(void*)0,(void*)0,(void*)0,&g_31[0],(void*)0,&g_31[0],(void*)0,(void*)0}},{{(void*)0,(void*)0,&g_131,(void*)0,(void*)0,&g_131,(void*)0,(void*)0},{(void*)0,(void*)0,(void*)0,&g_31[0],(void*)0,(void*)0,(void*)0,(void*)0},{(void*)0,&g_31[0],&g_131,&g_131,&g_31[0],(void*)0,(void*)0,(void*)0}},{{&g_31[0],(void*)0,(void*)0,(void*)0,&g_31[0],&g_131,&g_131,&g_31[0]},{(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,&g_31[0],(void*)0,(void*)0},{(void*)0,(void*)0,(void*)0,&g_131,(void*)0,(void*)0,&g_131,(void*)0}}};
+ int i, j, k;
+ (*p_43) |= (safe_div_func_int16_t_s_s((safe_mul_func_uint8_t_u_u(g_408[(g_61 + 2)][(g_61 + 4)], ((safe_add_func_uint8_t_u_u(((l_2103 > l_2117[0]) , ((((((*g_1846) ^ (safe_mul_func_uint8_t_u_u(((~((((safe_lshift_func_uint16_t_u_u(l_2102, (safe_lshift_func_uint8_t_u_u(((*l_1795) = g_408[(g_61 + 2)][(g_61 + 4)]), 7)))) , (safe_sub_func_int32_t_s_s((((*l_2076) = g_2127) != (void*)0), (*l_1795)))) == (-1L)) >= l_2117[2])) <= (*g_434)), 2L))) , l_2106) == g_408[(g_61 + 2)][(g_61 + 4)]) , (-7L)) >= g_1096[0])), 0UL)) == (*g_434)))), 0x2AABL));
+ }
+ (*p_43) &= ((*l_1795) = l_2081);
+ }
+ for (g_436 = 0; (g_436 <= 5); g_436 += 1)
+ { /* block id: 1109 */
+ (***l_2091) = p_43;
+ }
+ }
+ g_36 |= ((~(safe_rshift_func_uint8_t_u_u(((((safe_lshift_func_uint8_t_u_s(((*l_1795) > (((*g_514) ^= (((void*)0 == l_2132) >= (((void*)0 == &g_434) == (((*g_1846) &= (*l_1795)) || (safe_mod_func_int32_t_s_s((*p_43), (safe_add_func_int8_t_s_s((g_510 ^= (!((safe_unary_minus_func_uint8_t_u((*l_1795))) != (*g_434)))), l_2139)))))))) , 0x3B27455CL)), (*l_1795))) < (*g_146)) , (*l_1795)) > l_2140), l_2081))) != (*l_1795));
+ for (l_2086 = 0; (l_2086 <= 5); l_2086 += 1)
+ { /* block id: 1119 */
+ uint32_t l_2148 = 0x2EC0A92AL;
+ uint8_t *l_2167 = &g_131;
+ int16_t *l_2172[7][7] = {{&l_2170,&g_775,(void*)0,&l_2081,&g_775,&l_2081,(void*)0},{&g_775,&g_775,&l_2081,&g_775,&g_2156,&l_2081,&g_2156},{&g_775,(void*)0,(void*)0,&g_775,&l_2081,&l_2170,&g_775},{&l_2170,&g_2156,&l_2081,&l_2081,&g_2156,&l_2170,(void*)0},{&g_2156,&g_775,&l_2081,&g_775,&g_775,&l_2081,&g_775},{&g_2156,(void*)0,&l_2170,&g_2156,&l_2081,&l_2081,&g_2156},{&l_2170,&g_775,&l_2170,&l_2081,&g_775,(void*)0,(void*)0}};
+ uint16_t l_2210 = 65530UL;
+ int32_t l_2221 = 0x2F3755E1L;
+ int32_t l_2222[3];
+ int32_t l_2224 = 0x60EE7009L;
+ int32_t l_2226 = 2L;
+ int32_t l_2227 = 0xEA617DEEL;
+ int32_t l_2228[1];
+ int i, j;
+ for (i = 0; i < 3; i++)
+ l_2222[i] = 0x6F7B8276L;
+ for (i = 0; i < 1; i++)
+ l_2228[i] = (-1L);
+ (***l_2091) = (**l_2092);
+ if ((*l_1795))
+ break;
+ l_1795 = (((((safe_div_func_uint16_t_u_u((4294967295UL ^ (((safe_sub_func_uint16_t_u_u(((l_2095 = (*l_1795)) || (((g_775 |= (safe_mul_func_uint8_t_u_u((((l_2148 && l_2149) != (safe_sub_func_uint16_t_u_u(((*g_434) && ((((safe_sub_func_int16_t_s_s((safe_rshift_func_int16_t_s_s((l_2148 , ((*g_1846) = ((((*g_713) = (*g_713)) | ((((g_2156 , ((safe_rshift_func_int8_t_s_s((safe_div_func_int8_t_s_s(((safe_add_func_int8_t_s_s(((safe_add_func_int32_t_s_s((safe_sub_func_uint8_t_u_u(((*l_2167)--), (((4UL ^ (*g_1846)) , (*g_146)) & (*g_146)))), (*g_434))) && l_2170), 0xEFL)) < 0x9E20L), g_31[0])), (*l_1795))) <= 0xFE4DL)) == 5UL) , (*l_1795)) || l_2148)) == (*l_1795)))), (*l_1795))), l_2148)) ^ l_2171) & 253UL) & (*p_43))), 65535UL))) || (*l_1795)), g_436))) , l_2173) >= l_2148)), l_2148)) <= (*l_1795)) , 0xC481E029L)), 1L)) ^ l_2148) >= (*g_434)) <= l_2174) , l_2175);
+ for (l_2139 = 1; (l_2139 <= 6); l_2139 += 1)
+ { /* block id: 1130 */
+ uint8_t *l_2176 = &g_31[0];
+ uint16_t *l_2183 = &g_1758[3][0][1];
+ int32_t l_2209 = 1L;
+ uint32_t l_2211[2][9];
+ int32_t l_2229 = 0xF892FDB3L;
+ int32_t l_2230 = 0xD0E01647L;
+ int32_t l_2231 = 1L;
+ int32_t l_2232 = 4L;
+ int32_t l_2233[9] = {(-10L),(-10L),0xEFA8FB7FL,(-10L),(-10L),0xEFA8FB7FL,(-10L),(-10L),0xEFA8FB7FL};
+ int i, j;
+ for (i = 0; i < 2; i++)
+ {
+ for (j = 0; j < 9; j++)
+ l_2211[i][j] = 0x465FC43EL;
+ }
+ for (g_131 = 1; (g_131 <= 4); g_131 += 1)
+ { /* block id: 1133 */
+ const uint16_t **l_2180 = (void*)0;
+ const uint16_t *l_2182[6][9][4];
+ const uint16_t **l_2181 = &l_2182[2][6][3];
+ int32_t l_2186 = 0xE8A6026BL;
+ int i, j, k;
+ for (i = 0; i < 6; i++)
+ {
+ for (j = 0; j < 9; j++)
+ {
+ for (k = 0; k < 4; k++)
+ l_2182[i][j][k] = &g_961;
+ }
+ }
+ (*g_146) ^= (l_2176 != ((((((g_510 = (((safe_unary_minus_func_int16_t_s(((l_2036 = &l_2139) != ((safe_rshift_func_uint16_t_u_u((((*l_2181) = &l_2086) == l_2183), 2)) , (((((((safe_lshift_func_int16_t_s_u((9UL >= l_2186), 14)) , ((safe_sub_func_int8_t_s_s((((+(&g_434 == ((*g_434) , l_2189))) || (*g_1846)) , g_138[3]), l_2190)) , (*l_1795))) & (-10L)) < l_2148) <= l_2148) , 0UL) , (void*)0))))) < (*p_43)) > l_2148)) , l_2148) >= 0xB2L) , &l_1928) == &l_1928) , l_2167));
+ l_2141[l_2139][g_131][g_131] = ((safe_lshift_func_int16_t_s_s(((*g_1846) = (((((safe_sub_func_int16_t_s_s(((((((5L && 0x0CL) > (0L <= (l_2186 || l_2148))) || (g_126 = l_2148)) ^ ((safe_mod_func_int8_t_s_s(((((*l_1795) = (((safe_add_func_uint32_t_u_u((((**l_2189) = (((safe_mul_func_int16_t_s_s(((safe_mul_func_uint8_t_u_u(((((((safe_rshift_func_uint8_t_u_u(((*l_2176) = (*l_1795)), 2)) | (((safe_rshift_func_uint16_t_u_u(65535UL, (((safe_rshift_func_uint8_t_u_u((*l_1795), 3)) & 0xF2244D35L) ^ l_2148))) <= 0x883EL) | 0x30L)) <= l_2186) & l_2186) != (*g_434)) != l_2186), 247UL)) && 0x03BCL), (*g_1846))) && (*l_1795)) ^ 0xB4BFL)) == l_2148), 1UL)) , 0UL) > l_2186)) && l_2209) != l_2209), 0x52L)) | (-1L))) < l_2148) < l_2209), (*g_1846))) , (void*)0) == (void*)0) | l_2210) != l_2186)), l_2211[0][5])) , g_1591[l_2086][l_2086]);
+ (*p_43) ^= (!(safe_add_func_int16_t_s_s((safe_lshift_func_int8_t_s_s((l_2209 , 0x98L), 2)), (((((*l_2175) |= (l_2221 = (l_2209 <= ((*l_2176) = ((+l_2186) || ((*g_146) | (!(safe_div_func_int32_t_s_s(0L, (((l_2210 , &g_658[3]) != (g_2219 = l_2218)) & l_2220)))))))))) > (*g_434)) && (*l_2175)) <= 3L))));
+ }
+ for (l_2105 = 0; (l_2105 <= 6); l_2105 += 1)
+ { /* block id: 1152 */
+ return (*l_1795);
+ }
+ ++l_2240;
+ }
+ }
+ (*g_514) ^= (l_2243[6] ^ 0x9B59B1E0L);
+ }
+ else
+ { /* block id: 1159 */
+ int8_t *l_2247 = &g_2239;
+ int8_t * const l_2248[6] = {&g_2,&g_2,&g_2,&g_2,&g_2,&g_2};
+ int i;
+ l_2096[4] ^= (safe_div_func_uint32_t_u_u(((l_2247 = (g_2246 = &l_2105)) == l_2248[4]), 6UL));
+ }
+ }
+ p_43 = &l_1988;
+ return (*l_1795);
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_126 g_434 g_138 g_514 g_59 g_713 g_69 g_146 g_60 g_775 g_436 g_124 g_358 g_454 g_455 g_435 g_408 g_360 g_415 g_131 g_961 g_1096 g_510 g_145 g_37 g_61 g_992 g_993 g_1202 g_36 g_1250 g_712 g_1312 g_2 g_1324 g_31 g_1590 g_658 g_659 g_1509 g_1758
+ * writes: g_415 g_60 g_59 g_775 g_138 g_436 g_69 g_126 g_124 g_358 g_408 g_658 g_360 g_61 g_131 g_510 g_145 g_37 g_454 g_1324 g_712 g_31 g_1483 g_659 g_435 g_1509 g_36 g_1758 g_514
+ */
+static int32_t ** func_44(const int16_t p_45, uint16_t p_46, uint16_t p_47, int8_t p_48)
+{ /* block id: 453 */
+ uint32_t l_789 = 3UL;
+ int8_t *l_790 = &g_415;
+ uint16_t *l_793[2][1];
+ int32_t ***l_824 = &g_455;
+ int32_t l_825 = 8L;
+ uint32_t l_826 = 0xD587BD29L;
+ int32_t *l_827 = (void*)0;
+ int32_t l_851 = 0xD020B236L;
+ int32_t l_855 = 0x2CE1D691L;
+ int32_t l_856 = 0L;
+ int32_t l_857[10] = {(-8L),0xCA3E0D9AL,0xF01EADB4L,0xF01EADB4L,0xCA3E0D9AL,(-8L),0xCA3E0D9AL,0xF01EADB4L,0xF01EADB4L,0xCA3E0D9AL};
+ int32_t l_858 = (-6L);
+ uint32_t l_860 = 7UL;
+ uint16_t **l_874 = &l_793[0][0];
+ int16_t l_919 = 0xCBE8L;
+ const uint16_t *l_963 = (void*)0;
+ const uint16_t **l_962 = &l_963;
+ const uint16_t **l_964 = &l_963;
+ const uint8_t l_1041[3][8][7] = {{{0xC9L,0xE7L,0xEFL,0x0CL,0x6BL,0xC2L,0xC9L},{0x14L,1UL,250UL,0xEFL,0xC9L,247UL,0xE7L},{1UL,246UL,247UL,249UL,0UL,255UL,1UL},{0xC9L,246UL,0x09L,7UL,255UL,0x99L,0x04L},{0xE5L,7UL,0x7DL,0x7DL,3UL,0x1BL,0x82L},{255UL,246UL,1UL,0x8FL,0xE5L,255UL,0xC2L},{247UL,255UL,255UL,0xEFL,0UL,0x60L,0x7DL},{0x23L,246UL,3UL,251UL,250UL,247UL,0xCAL}},{{0x09L,3UL,0xFBL,247UL,255UL,246UL,0xE5L},{1UL,0xCAL,0UL,0xE5L,0UL,255UL,9UL},{0x6CL,1UL,0x82L,0x71L,0xABL,0x38L,0x29L},{9UL,0xE5L,246UL,255UL,247UL,0xFBL,3UL},{255UL,247UL,0x29L,255UL,0x38L,0UL,1UL},{0x23L,0xEFL,0x9AL,0x71L,0x6BL,0x5EL,0x82L},{8UL,0xC2L,255UL,0xE5L,0x8FL,1UL,246UL},{0UL,255UL,0xABL,247UL,0x71L,0x71L,247UL}},{{0x1BL,255UL,0x1BL,251UL,0xC2L,247UL,0x29L},{246UL,0UL,255UL,0xEFL,1UL,246UL,1UL},{0xABL,0x29L,0x60L,0x8FL,0xB9L,247UL,0x99L},{0x6CL,0x1AL,247UL,0xB9L,9UL,0x71L,0xCAL},{0x8FL,0x9CL,246UL,246UL,0x5FL,1UL,0xEFL},{253UL,0x29L,255UL,1UL,0x38L,0x5EL,246UL},{0xABL,0x5FL,0x38L,0UL,0UL,0UL,0x82L},{0xEFL,0x09L,0xFBL,0x14L,1UL,0xFBL,255UL}}};
+ int8_t ***l_1061 = &g_435;
+ int8_t ***l_1064 = &g_435;
+ uint8_t l_1067 = 248UL;
+ int32_t *l_1124 = &l_825;
+ int32_t **l_1123 = &l_1124;
+ int8_t l_1173[1];
+ int32_t l_1178 = (-10L);
+ uint32_t l_1365 = 0xC69FFE11L;
+ int16_t l_1432 = 0x41AEL;
+ uint32_t l_1561 = 8UL;
+ int32_t l_1572 = 0xF6720B70L;
+ uint8_t ***l_1593[4];
+ uint8_t *l_1594 = &l_1067;
+ uint32_t l_1670 = 1UL;
+ uint32_t *l_1691 = &g_408[4][8];
+ uint16_t ** const **l_1710 = &g_993;
+ int32_t l_1742[8][4][5] = {{{0x0F03A4D8L,1L,(-1L),5L,1L},{0xAE8F677BL,(-1L),0x2EAAF741L,0x2EAAF741L,(-1L)},{(-5L),1L,(-1L),1L,3L},{0L,2L,0x1BFB8ECBL,(-1L),0xE39D686EL}},{{8L,(-5L),(-5L),8L,0x485B1D2AL},{0L,0x2EAAF741L,0x63768321L,0x2619FB32L,(-1L)},{(-5L),0xA73697A5L,0x8F9D8BBDL,(-1L),0x8F9D8BBDL},{0xAE8F677BL,0xAE8F677BL,(-1L),0x2619FB32L,0x63768321L}},{{0x0F03A4D8L,5L,0x485B1D2AL,8L,(-5L)},{0x1BFB8ECBL,(-1L),0xE39D686EL,(-1L),0x1BFB8ECBL},{0xE1025F8AL,5L,3L,1L,(-1L)},{0xE4018007L,(-1L),0L,(-1L),(-1L)}},{{1L,0xE1025F8AL,1L,1L,0x485B1D2AL},{0x1BFB8ECBL,(-1L),(-1L),2L,0x2EAAF741L},{0x485B1D2AL,8L,(-5L),(-5L),8L},{0L,0x63768321L,(-1L),0x2EAAF741L,0xE39D686EL}},{{0xE1025F8AL,3L,1L,0xA73697A5L,0x0F03A4D8L},{0xAE8F677BL,0L,0L,0xAE8F677BL,0L},{0xE1025F8AL,(-5L),0x8F9D8BBDL,5L,0xA73697A5L},{0L,0x2619FB32L,1L,(-1L),1L}},{{0x485B1D2AL,0x485B1D2AL,0xA73697A5L,5L,0x8F9D8BBDL},{0x1BFB8ECBL,2L,0L,0xAE8F677BL,0L},{1L,0xA73697A5L,0x0F03A4D8L,0xA73697A5L,1L},{0xE4018007L,2L,0xE39D686EL,0x2EAAF741L,(-1L)}},{{5L,0x485B1D2AL,8L,(-5L),(-5L)},{0x2EAAF741L,0x2619FB32L,0x2EAAF741L,2L,(-1L)},{1L,(-5L),0x485B1D2AL,1L,1L},{(-1L),0L,(-1L),(-1L),0L}},{{8L,3L,0x485B1D2AL,1L,0x8F9D8BBDL},{0x2619FB32L,0x63768321L,0x2EAAF741L,0L,1L},{(-1L),8L,8L,(-1L),0xA73697A5L},{0x2619FB32L,(-1L),0xE39D686EL,0xE4018007L,0L}}};
+ int i, j, k;
+ for (i = 0; i < 2; i++)
+ {
+ for (j = 0; j < 1; j++)
+ l_793[i][j] = &g_145;
+ }
+ for (i = 0; i < 1; i++)
+ l_1173[i] = (-1L);
+ for (i = 0; i < 4; i++)
+ l_1593[i] = &g_658[3];
+ if ((safe_lshift_func_uint8_t_u_s((((safe_add_func_int32_t_s_s(((*g_146) = (p_45 != (((g_126 != ((&g_69[4] != ((+(safe_sub_func_uint16_t_u_u(((safe_sub_func_uint32_t_u_u((*g_434), p_46)) > ((safe_mul_func_uint8_t_u_u((0x40L ^ ((*l_790) = (safe_unary_minus_func_uint8_t_u(l_789)))), (p_48 = (safe_lshift_func_int16_t_s_u((-6L), ((((((*g_434) ^ (*g_514)) , (*g_713)) , (*g_514)) > p_46) | 0x6DC26841L)))))) ^ p_47)), 65535UL))) , l_793[0][0])) && 0x8ACC9E21L)) | p_46) || 0xBD077CC9L))), l_789)) <= p_46) != p_45), l_789)))
+ { /* block id: 457 */
+ uint32_t * const l_796 = &g_436;
+ int32_t l_810 = 0x310EDFCEL;
+ int16_t *l_811 = &g_775;
+ int8_t l_844 = 0xF9L;
+ int32_t *l_845 = &g_59[4];
+ int32_t l_846 = 0x652F5472L;
+ int32_t *l_847 = (void*)0;
+ int32_t *l_848 = (void*)0;
+ int32_t *l_849 = (void*)0;
+ int32_t *l_850 = &g_59[1];
+ int32_t *l_852 = &l_846;
+ int32_t *l_853 = &g_61;
+ int32_t *l_854[3];
+ int16_t l_859 = 0L;
+ int i;
+ for (i = 0; i < 3; i++)
+ l_854[i] = &g_60[0][4][3];
+ if ((safe_sub_func_int32_t_s_s((l_796 != (((((((((safe_lshift_func_int8_t_s_u((safe_unary_minus_func_uint8_t_u((safe_rshift_func_uint8_t_u_u((((*g_434) |= (safe_div_func_int8_t_s_s((((*g_146) != (((void*)0 == &g_69[2]) > ((*l_811) ^= ((safe_mod_func_int32_t_s_s(5L, ((*g_514) = (safe_sub_func_uint8_t_u_u(((l_789 <= (safe_sub_func_int32_t_s_s((+p_45), (!l_810)))) , p_46), p_46))))) , p_47)))) > p_48), p_48))) > 0x42A497C5L), 2)))), l_810)) | l_810) & 8UL) >= p_46) <= l_789) , &l_793[0][0]) != &l_793[0][0]) && (*g_514)) , (void*)0)), 0x2E530132L)))
+ { /* block id: 461 */
+ int32_t l_821 = 7L;
+ (*g_514) = (safe_div_func_int16_t_s_s((g_59[1] == (safe_sub_func_int8_t_s_s((0x3683L ^ (((safe_rshift_func_int8_t_s_s((safe_unary_minus_func_int16_t_s((((safe_mod_func_int8_t_s_s((((*l_790) = l_821) && (safe_rshift_func_int16_t_s_s((((((((((((((0x42L < (l_824 == (void*)0)) , ((*g_146) &= (((*l_796) |= l_810) , l_810))) >= 1L) , l_825) & p_46) , 1L) , 0xFEL) , (-1L)) & 0x050B61B1L) && (*g_434)) < p_45) , (void*)0) != (void*)0), 2))), p_46)) > p_48) >= g_124))), l_810)) <= g_358) < l_826)), 5UL))), 65535UL));
+ l_827 = &g_60[0][4][3];
+ }
+ else
+ { /* block id: 467 */
+ const int16_t l_834 = 1L;
+ int32_t ** const l_843[8] = {&g_514,&g_514,&g_514,&g_514,&g_514,&g_514,&g_514,&g_514};
+ int i;
+ (*g_514) ^= (0x3980058AL <= (-8L));
+ (*g_146) = (safe_lshift_func_uint16_t_u_u((safe_mod_func_int32_t_s_s(((safe_mul_func_uint8_t_u_u(l_834, ((safe_div_func_uint32_t_u_u((safe_div_func_int16_t_s_s(((safe_sub_func_uint32_t_u_u(0x27FAB59DL, (++(*g_434)))) == ((((*g_454) == l_843[5]) ^ (((*g_713) != (p_46 = (*g_713))) != ((*l_811) = ((p_47 || 4294967289UL) , (l_810 = g_59[1]))))) , l_844)), 0x917AL)), p_48)) == p_45))) >= 0x45993A07L), p_47)), (*g_713)));
+ }
+ --l_860;
+ }
+ else
+ { /* block id: 476 */
+ uint16_t ***l_873[10] = {&g_712,&g_712,&g_712,&g_712,&g_712,&g_712,&g_712,&g_712,&g_712,&g_712};
+ int32_t l_879 = (-2L);
+ int32_t *l_880 = &g_60[0][4][1];
+ uint32_t l_990[3];
+ int8_t ***l_1063 = &g_435;
+ int8_t ***l_1065 = &g_435;
+ int32_t ****l_1071 = &g_454;
+ int32_t l_1108[2];
+ int32_t l_1182 = 0xF31FF310L;
+ uint32_t l_1249 = 0x30B3AA77L;
+ uint8_t l_1382 = 1UL;
+ uint8_t l_1431[3];
+ uint8_t ***l_1435 = &g_658[2];
+ uint8_t *l_1479 = (void*)0;
+ uint8_t *l_1480 = &l_1431[2];
+ uint32_t l_1485[2][6][9] = {{{0x001AC486L,1UL,0xD4514F8AL,0x7B4E6C99L,4294967293UL,0x43196522L,0x43196522L,4294967293UL,0x7B4E6C99L},{4294967295UL,0x0ACDEEBDL,4294967295UL,3UL,4294967290UL,0xF5ACFD47L,0x66335B3AL,4294967290UL,0x5C4275B8L},{0x001AC486L,0x972DEFA1L,0x0646B95BL,0x7B4E6C99L,1UL,1UL,0x43196522L,1UL,4294967295UL},{4294967295UL,4294967288UL,0x6102B2CFL,3UL,0x0ACDEEBDL,0x66335B3AL,0x66335B3AL,0x0ACDEEBDL,3UL},{0x001AC486L,4294967293UL,0x001AC486L,0x7B4E6C99L,0x972DEFA1L,0x4F90B9DFL,0x43196522L,0x972DEFA1L,0x05838E02L},{4294967295UL,4294967290UL,4294967295UL,3UL,4294967288UL,0x22B6C2F9L,0x66335B3AL,4294967288UL,0xBB659700L}},{{0x001AC486L,1UL,0xD4514F8AL,0x7B4E6C99L,4294967293UL,0x43196522L,0x43196522L,4294967293UL,0x7B4E6C99L},{4294967295UL,0x0ACDEEBDL,4294967295UL,3UL,4294967290UL,4294967295UL,0UL,0x66335B3AL,0x8121F976L},{4294967295UL,0x43196522L,0x55E71AF7L,0x6C626E1CL,1UL,0x2A49B2C7L,4UL,1UL,0xC95BEA71L},{0x9FBED03EL,0x22B6C2F9L,4294967295UL,0x5A1F2CF3L,0xF5ACFD47L,0UL,0UL,0xF5ACFD47L,0x5A1F2CF3L},{4294967295UL,0x4F90B9DFL,4294967295UL,0x6C626E1CL,0x43196522L,0x764EA846L,4UL,0x43196522L,8UL},{0x9FBED03EL,0x66335B3AL,0x5B65FAAEL,0x5A1F2CF3L,0x22B6C2F9L,0x4FA3FF0EL,0UL,0x22B6C2F9L,0x7F81A6ADL}}};
+ uint32_t l_1538 = 18446744073709551606UL;
+ uint32_t l_1542 = 0x5126608CL;
+ const int8_t l_1564 = 0xCFL;
+ int16_t l_1674 = 0L;
+ uint32_t l_1675[4][2][6] = {{{9UL,9UL,0UL,0x1A6A88C2L,0UL,9UL},{0UL,4294967295UL,0x1A6A88C2L,0x1A6A88C2L,4294967295UL,0UL}},{{9UL,0UL,0x1A6A88C2L,0UL,9UL,9UL},{4294967295UL,0UL,0UL,4294967295UL,4294967295UL,4294967295UL}},{{4294967295UL,4294967295UL,4294967295UL,0UL,0UL,4294967295UL},{9UL,9UL,0UL,0x1A6A88C2L,0UL,9UL}},{{0UL,4294967295UL,0x1A6A88C2L,0x1A6A88C2L,4294967295UL,0UL},{9UL,0UL,0x1A6A88C2L,0UL,9UL,9UL}}};
+ uint8_t l_1682 = 249UL;
+ int32_t l_1755 = 0L;
+ uint8_t l_1776 = 248UL;
+ int i, j, k;
+ for (i = 0; i < 3; i++)
+ l_990[i] = 4294967295UL;
+ for (i = 0; i < 2; i++)
+ l_1108[i] = 0xA99751B8L;
+ for (i = 0; i < 3; i++)
+ l_1431[i] = 0UL;
+ if ((safe_rshift_func_int8_t_s_s(0L, (((((safe_rshift_func_int16_t_s_s((((((safe_lshift_func_int16_t_s_s(((p_45 || (!(((*g_713)--) > p_48))) , (safe_mod_func_uint16_t_u_u((((&g_713 != (l_874 = &g_713)) , (++(*g_713))) != 0x7FDBL), (((p_45 && ((safe_sub_func_int16_t_s_s((((((&g_713 == &g_713) != 0x7EC58B7AL) , 0x7A3783A8L) == l_879) & p_47), 1UL)) != 2UL)) || 0UL) && l_879)))), g_775)) < 0xDACD2365L) == l_879) == 0UL) > p_48), 7)) == l_879) , (*g_434)) || p_47) >= p_46))))
+ { /* block id: 480 */
+ uint16_t l_892 = 0x8211L;
+ int32_t *l_941 = (void*)0;
+ int32_t *l_944 = &l_851;
+ uint16_t ****l_1005 = &l_873[3];
+ l_880 = &l_879;
+ if (((p_47 | 0x59C7L) == ((*g_434) = ((p_45 || (*g_434)) >= (safe_lshift_func_int16_t_s_u((safe_mod_func_int32_t_s_s(((*g_434) && (safe_unary_minus_func_uint16_t_u((p_47 ^ (0x8C6AL | ((safe_lshift_func_uint8_t_u_u(((((safe_lshift_func_uint8_t_u_u(0x1BL, p_47)) != (*l_880)) != g_59[1]) , l_892), 3)) & 0xA9L)))))), (*l_880))), p_48))))))
+ { /* block id: 483 */
+ int32_t *l_925 = (void*)0;
+ int32_t **l_945 = &l_827;
+ uint8_t l_954 = 0xC4L;
+ const uint16_t *l_960 = &g_961;
+ const uint16_t **l_959 = &l_960;
+ const uint16_t ***l_958[6];
+ int i;
+ for (i = 0; i < 6; i++)
+ l_958[i] = &l_959;
+ for (g_126 = 2; (g_126 > 7); ++g_126)
+ { /* block id: 486 */
+ int16_t *l_913 = (void*)0;
+ int16_t *l_914 = (void*)0;
+ int16_t *l_915 = &g_124;
+ int32_t l_916 = 0x331B7C2BL;
+ uint32_t *l_917[2][9] = {{&l_826,(void*)0,(void*)0,&l_826,(void*)0,&l_826,(void*)0,(void*)0,&l_826},{(void*)0,(void*)0,&l_789,(void*)0,(void*)0,(void*)0,(void*)0,&l_789,(void*)0}};
+ int32_t l_918[9];
+ int32_t l_920[4];
+ int16_t *l_921 = &g_775;
+ int i, j;
+ for (i = 0; i < 9; i++)
+ l_918[i] = 2L;
+ for (i = 0; i < 4; i++)
+ l_920[i] = 9L;
+ (*l_880) = (safe_add_func_uint32_t_u_u((~(safe_add_func_int32_t_s_s(0x2B42C6FBL, (((*l_921) |= (((safe_rshift_func_int16_t_s_u((safe_mul_func_uint8_t_u_u((p_48 ^ ((((safe_mul_func_uint16_t_u_u((p_45 <= (safe_lshift_func_uint8_t_u_u(((void*)0 != &g_454), 4))), ((safe_mul_func_int16_t_s_s(((safe_lshift_func_uint8_t_u_s(p_46, 6)) ^ (-1L)), ((l_918[4] = (safe_add_func_uint16_t_u_u(((((l_916 &= (p_47 , (((((((*l_915) = g_138[3]) > p_47) < p_45) < p_45) & 6UL) | 0xCCFFEDAEL))) ^ 0x8F8481BCL) | (*l_880)) , p_45), l_892))) , l_919))) == 251UL))) >= p_46) , (*l_880)) || 0xB3L)), l_920[1])), 14)) >= 0x4644L) , 1L)) != 0x0A15L)))), (*g_434)));
+ for (g_358 = 0; (g_358 == (-9)); g_358 = safe_sub_func_int32_t_s_s(g_358, 7))
+ { /* block id: 494 */
+ int32_t *l_924 = (void*)0;
+ uint32_t *l_940 = &g_408[2][5];
+ int32_t **l_942 = &l_924;
+ uint8_t ***l_943 = &g_658[3];
+ l_925 = l_924;
+ l_918[4] ^= (((safe_lshift_func_uint8_t_u_s(((safe_mod_func_uint16_t_u_u((g_435 == g_435), (((*g_514) = p_48) && ((*g_434) = (*l_880))))) > 4UL), p_47)) >= (((safe_div_func_int32_t_s_s((((*g_146) = l_892) && ((*l_940) &= (safe_lshift_func_int16_t_s_u((safe_sub_func_uint8_t_u_u((safe_mul_func_uint8_t_u_u((9UL < ((safe_add_func_uint8_t_u_u(p_48, p_47)) > l_892)), l_892)), (-1L))), 14)))), (*l_880))) || 0UL) || 255UL)) <= l_920[1]);
+ (*l_942) = l_941;
+ (*l_943) = &g_659;
+ }
+ (*g_514) = (p_48 && (-1L));
+ }
+ (*l_945) = l_944;
+ for (g_775 = 0; (g_775 >= (-1)); g_775 = safe_sub_func_uint16_t_u_u(g_775, 1))
+ { /* block id: 509 */
+ uint16_t l_957 = 1UL;
+ for (g_360 = 8; (g_360 >= 0); g_360 -= 1)
+ { /* block id: 512 */
+ int i;
+ (*l_827) = g_69[g_360];
+ }
+ for (l_826 = 7; (l_826 > 57); l_826 = safe_add_func_uint8_t_u_u(l_826, 2))
+ { /* block id: 517 */
+ int32_t *l_950 = &g_60[0][4][3];
+ int32_t *l_951 = &g_59[4];
+ int32_t *l_952 = &l_851;
+ int32_t *l_953[6][7][6] = {{{&l_851,&l_857[1],&g_36,(void*)0,(void*)0,&g_61},{&l_851,&l_857[1],&g_36,&g_60[0][4][3],&l_857[1],&l_857[1]},{(void*)0,&l_851,&l_851,(void*)0,&l_851,(void*)0},{&g_60[0][4][3],&g_36,&l_857[1],&l_851,&g_61,&l_857[4]},{(void*)0,&g_36,&l_857[1],&l_851,&g_61,&g_60[0][4][3]},{&g_61,&g_36,(void*)0,&g_60[1][0][3],&l_851,&g_60[1][0][3]},{&g_60[1][1][0],&l_851,&g_60[1][1][0],&l_857[1],&l_857[1],&g_61}},{{&g_61,&l_857[1],&l_857[4],&l_857[1],(void*)0,&g_36},{&l_857[1],&l_857[1],&g_61,&l_857[1],&l_879,&l_857[1]},{&g_61,(void*)0,&l_851,&l_857[1],&l_857[1],&l_851},{&g_60[1][1][0],&g_60[1][1][0],&l_855,&g_60[1][0][3],&g_59[1],&l_857[1]},{&g_61,&l_857[4],&g_59[1],&l_851,(void*)0,&l_855},{(void*)0,&g_61,&g_59[1],&l_851,&g_60[1][1][0],&l_857[1]},{&g_60[0][4][3],&l_851,&l_855,(void*)0,&l_855,&l_851}},{{&g_61,&g_36,&l_851,&l_857[4],(void*)0,&l_857[1]},{&l_851,&g_60[1][0][3],&g_61,&l_857[1],&g_61,&l_857[1]},{&g_61,&g_60[1][0][3],&g_61,&g_61,(void*)0,(void*)0},{&g_60[1][1][0],&g_36,&g_59[8],&g_59[8],&g_36,&g_60[1][1][0]},{&l_857[1],&l_851,&l_857[1],(void*)0,&g_59[8],&l_857[4]},{&l_879,&g_61,&l_855,&g_36,&l_851,&g_61},{&l_879,&g_61,&g_36,(void*)0,&g_60[1][0][3],&l_851}},{{&l_857[1],&g_59[8],&g_61,&g_59[8],&l_857[1],&l_855},{&g_60[1][1][0],&l_857[1],&l_857[1],&g_61,(void*)0,&g_59[1]},{&g_61,&l_855,&l_857[1],&l_857[1],&g_61,&g_59[1]},{&l_851,&g_36,&l_857[1],&l_857[4],&l_855,&l_855},{&g_61,&g_61,&g_61,&g_61,&l_851,&l_851},{&l_857[4],&l_857[1],&g_36,&l_851,(void*)0,&g_61},{&l_857[1],&l_857[1],&l_855,&g_61,(void*)0,&l_857[4]}},{{&g_61,&l_857[1],&l_857[1],&g_60[1][1][0],&l_851,&g_60[1][1][0]},{&g_59[8],&g_61,&g_59[8],&l_857[1],&l_855,(void*)0},{(void*)0,&g_36,&g_61,&l_879,&g_61,&l_857[1]},{&g_36,&l_855,&g_61,&l_879,(void*)0,&l_857[1]},{(void*)0,&l_857[1],&l_851,&l_857[1],&l_857[1],&l_851},{&g_59[8],&g_59[8],&g_36,&g_60[1][1][0],&g_60[1][0][3],&g_36},{&g_61,&g_61,&g_60[1][0][3],&g_61,&l_851,&g_36}},{{&l_857[1],&g_61,&g_60[1][0][3],&l_851,&g_59[8],&g_36},{&l_857[4],&l_851,&g_36,&g_61,&g_36,&l_851},{&g_61,&g_36,&l_851,&l_857[4],(void*)0,&l_857[1]},{&l_851,&g_60[1][0][3],&g_61,&l_857[1],&g_61,&l_857[1]},{&g_61,&g_60[1][0][3],&g_61,&g_61,(void*)0,(void*)0},{&g_60[1][1][0],&g_36,&g_59[8],&g_59[8],&g_36,&g_60[1][1][0]},{&l_857[1],&l_851,&l_857[1],(void*)0,&g_59[8],&l_857[4]}}};
+ int i, j, k;
+ ++l_954;
+ l_957 |= ((*l_952) = (((*l_790) ^= (-1L)) & (*l_944)));
+ }
+ (*g_514) = ((*l_827) |= (*l_880));
+ }
+ l_964 = (l_962 = (void*)0);
+ }
+ else
+ { /* block id: 528 */
+ for (g_61 = 0; g_61 < 2; g_61 += 1)
+ {
+ for (l_892 = 0; l_892 < 5; l_892 += 1)
+ {
+ for (g_358 = 0; g_358 < 4; g_358 += 1)
+ {
+ g_60[g_61][l_892][g_358] = 6L;
+ }
+ }
+ }
+ }
+ for (g_131 = (-5); (g_131 <= 34); g_131 = safe_add_func_int16_t_s_s(g_131, 5))
+ { /* block id: 533 */
+ uint16_t ***l_973 = &l_874;
+ int32_t l_984 = 0xDFBF9410L;
+ int32_t **l_1000 = &l_941;
+ uint8_t *l_1027 = &g_131;
+ for (p_47 = (-26); (p_47 < 29); p_47 = safe_add_func_int32_t_s_s(p_47, 6))
+ { /* block id: 536 */
+ uint16_t ****l_974 = &l_973;
+ uint16_t ****l_975 = &l_873[1];
+ int32_t *l_985[6][2][2] = {{{&g_61,&g_59[1]},{&g_59[1],&g_61}},{{&g_59[1],&g_59[1]},{&g_61,&g_59[1]}},{{&g_59[1],&g_61},{&g_59[1],&g_59[1]}},{{&g_61,&g_59[1]},{&g_59[1],&g_61}},{{&g_59[1],&g_59[1]},{&g_61,&g_59[1]}},{{&g_59[1],&g_61},{&g_59[1],&g_61}}};
+ uint16_t l_995[10][3][3] = {{{0x876CL,0xB242L,0x0660L},{65532UL,65532UL,65535UL},{65530UL,0xB242L,65535UL}},{{65535UL,4UL,65535UL},{65530UL,0xA11BL,65530UL},{65532UL,65535UL,65535UL}},{{0x876CL,1UL,65535UL},{65532UL,65535UL,65535UL},{65535UL,0xA11BL,0x0660L}},{{65532UL,4UL,65532UL},{0x876CL,0xB242L,0x0660L},{65532UL,65532UL,65535UL}},{{65530UL,0xB242L,65535UL},{65535UL,4UL,65535UL},{65530UL,0xA11BL,65530UL}},{{65532UL,65535UL,65535UL},{0x876CL,1UL,65535UL},{65532UL,65535UL,65535UL}},{{65535UL,0xA11BL,0x0660L},{65532UL,4UL,65532UL},{0x876CL,0xB242L,0x0660L}},{{65532UL,65532UL,65535UL},{65530UL,0xB242L,65535UL},{65535UL,4UL,65535UL}},{{65530UL,0xA11BL,65530UL},{65532UL,65535UL,65535UL},{0x876CL,1UL,65535UL}},{{65532UL,65535UL,65535UL},{65535UL,0xA11BL,0x0660L},{65532UL,4UL,65532UL}}};
+ int i, j, k;
+ }
+ }
+ }
+ else
+ { /* block id: 565 */
+ int8_t ****l_1062 = &l_1061;
+ uint8_t ***l_1066 = &g_658[3];
+ int32_t *l_1068 = (void*)0;
+ int32_t *l_1069 = (void*)0;
+ int32_t l_1070 = (-1L);
+ int32_t l_1105 = 0x2603CE82L;
+ int32_t l_1109 = 0x5D5B4DEDL;
+ int32_t l_1110[4] = {4L,4L,4L,4L};
+ uint16_t l_1112 = 0x8815L;
+ int i;
+ if ((((*g_434) < (safe_mul_func_int8_t_s_s(((safe_sub_func_int32_t_s_s(((((safe_mod_func_uint8_t_u_u(((safe_lshift_func_int16_t_s_u(((safe_add_func_uint32_t_u_u((safe_rshift_func_uint16_t_u_s(((((((((g_358 = (((safe_sub_func_uint16_t_u_u((p_47 = (safe_add_func_int16_t_s_s((((safe_sub_func_uint16_t_u_u(p_45, (((*l_1062) = l_1061) == l_1063))) , 0x4037D8D8L) <= (((*g_434) >= ((l_1064 != (l_1065 = l_1064)) != ((void*)0 == l_1066))) , l_1067)), (*l_880)))), p_45)) , (void*)0) == (void*)0)) , p_47) | 0x9FE39FA7L) , g_961) , p_47) < (*l_880)) == 0x4F7AL) || p_47), g_138[3])), p_46)) <= p_45), l_1070)) || 0x0DL), 0x71L)) < p_45) , l_1071) == &l_824), 0xDE5D4DB2L)) , l_1070), p_45))) <= p_45))
+ { /* block id: 570 */
+lbl_1099:
+ l_880 = &l_1070;
+ }
+ else
+ { /* block id: 572 */
+ const int8_t ****l_1085 = (void*)0;
+ for (g_436 = 0; (g_436 > 39); ++g_436)
+ { /* block id: 575 */
+ uint32_t l_1076 = 1UL;
+ const int32_t *l_1100 = &l_857[1];
+ for (g_358 = 0; (g_358 >= (-14)); g_358 = safe_sub_func_int16_t_s_s(g_358, 4))
+ { /* block id: 578 */
+ l_1076++;
+ if ((*l_880))
+ break;
+ if (p_46)
+ continue;
+ }
+ (*g_514) ^= ((safe_rshift_func_uint16_t_u_s(0x7586L, ((p_45 & (((safe_lshift_func_int16_t_s_u((((safe_lshift_func_uint16_t_u_s(((void*)0 == l_1085), (safe_div_func_int16_t_s_s((safe_sub_func_int16_t_s_s(((!0xE0L) && p_46), (l_1070 == (safe_sub_func_uint16_t_u_u((safe_lshift_func_uint8_t_u_s((safe_mul_func_int8_t_s_s(0L, l_1070)), 6)), 0xCBD5L))))), p_47)))) , (void*)0) != (void*)0), g_1096[0])) >= 0xE085DD08L) > l_1076)) == (-1L)))) , 0xEB6DF802L);
+ l_1070 |= (-2L);
+ for (g_510 = (-2); (g_510 != (-29)); g_510--)
+ { /* block id: 587 */
+ const int32_t **l_1101 = &l_1100;
+ if (g_360)
+ goto lbl_1099;
+ (*l_1101) = l_1100;
+ (*l_1101) = &l_1070;
+ if (p_48)
+ break;
+ }
+ }
+ }
+ for (g_145 = 0; (g_145 == 21); ++g_145)
+ { /* block id: 597 */
+ int32_t *l_1104 = (void*)0;
+ int32_t *l_1106 = (void*)0;
+ int32_t *l_1107[6][5] = {{&l_1070,(void*)0,&g_36,&g_60[0][4][3],&g_60[0][4][3]},{(void*)0,(void*)0,(void*)0,&g_59[0],(void*)0},{&g_60[0][4][3],&g_59[3],&g_59[0],&g_60[0][4][3],&g_59[0]},{&g_60[0][4][3],&g_60[0][4][3],&g_36,(void*)0,&l_1070},{(void*)0,&l_1070,&g_59[0],&g_59[0],&l_1070},{&l_1070,&g_59[3],(void*)0,&l_1070,&g_59[0]}};
+ int32_t l_1111 = 0xC680B001L;
+ int i, j;
+ l_1070 = 0x81C649FFL;
+ l_1112++;
+ return (*g_454);
+ }
+ }
+ for (p_46 = 0; (p_46 > 38); ++p_46)
+ { /* block id: 605 */
+ uint8_t l_1129[1][5][9] = {{{255UL,255UL,0xC0L,255UL,255UL,0xC0L,255UL,255UL,0xC0L},{1UL,1UL,0x8DL,1UL,1UL,0x8DL,1UL,1UL,0x8DL},{255UL,255UL,0xC0L,255UL,255UL,0xC0L,255UL,255UL,0xC0L},{1UL,1UL,0x8DL,1UL,1UL,0x8DL,1UL,1UL,0x8DL},{255UL,255UL,0xC0L,255UL,255UL,0xC0L,255UL,255UL,0xC0L}}};
+ int16_t *l_1144 = &g_124;
+ int32_t *l_1148[6][1][3] = {{{&l_1108[1],(void*)0,&l_851}},{{&g_36,&g_36,&l_851}},{{(void*)0,&l_1108[1],&l_851}},{{&l_1108[1],(void*)0,&l_851}},{{&g_36,&g_36,&l_851}},{{(void*)0,&l_1108[1],&l_851}}};
+ uint16_t ***l_1211 = &l_874;
+ uint32_t l_1212[4][2] = {{1UL,1UL},{1UL,1UL},{1UL,1UL},{1UL,1UL}};
+ uint32_t l_1258[3][10][8] = {{{0x0ECC242CL,2UL,0xBBA08DF3L,18446744073709551614UL,18446744073709551615UL,0x4194A657L,0xACFC1F18L,18446744073709551606UL},{1UL,0x728BE276L,18446744073709551615UL,0x4194A657L,18446744073709551613UL,0x4A4E1478L,18446744073709551614UL,2UL},{0xBBA08DF3L,0xC6AFF327L,0xEBB805F8L,18446744073709551613UL,0xEBB805F8L,0xC6AFF327L,0xBBA08DF3L,18446744073709551615UL},{18446744073709551609UL,0x073E66A2L,0x4194A657L,0x93447063L,0xC450AD13L,2UL,0xC6AFF327L,0xF001BE9DL},{0UL,0UL,2UL,0x0ECC242CL,0xC450AD13L,18446744073709551609UL,18446744073709551615UL,18446744073709551613UL},{18446744073709551609UL,0xD0026597L,0xACFC1F18L,0xF001BE9DL,0xEBB805F8L,2UL,0x93447063L,0x073E66A2L},{0xBBA08DF3L,0x71035224L,0xFAD7F9E8L,0UL,18446744073709551613UL,18446744073709551614UL,18446744073709551615UL,4UL},{1UL,1UL,0xFC2D4B21L,0xFAD7F9E8L,18446744073709551615UL,18446744073709551615UL,0xFAD7F9E8L,0xFC2D4B21L},{0x0ECC242CL,0x0ECC242CL,0xCE6368AAL,1UL,0xD0026597L,0xFC2D4B21L,0x71035224L,0UL},{0x71035224L,0xEBB805F8L,0x3A03219BL,0xC450AD13L,18446744073709551614UL,0UL,2UL,0UL}},{{0xEBB805F8L,18446744073709551615UL,18446744073709551614UL,1UL,2UL,0UL,0x834DBD27L,0xFC2D4B21L},{18446744073709551606UL,0x3A03219BL,18446744073709551614UL,0xFAD7F9E8L,0xBBA08DF3L,0x834DBD27L,1UL,4UL},{18446744073709551614UL,0xFC2D4B21L,18446744073709551615UL,0UL,0UL,0x073E66A2L,0xEBB805F8L,0x073E66A2L},{0xFAD7F9E8L,0xF001BE9DL,0xD0026597L,0xF001BE9DL,0xFAD7F9E8L,0x728BE276L,2UL,18446744073709551613UL},{2UL,4UL,1UL,0x0ECC242CL,18446744073709551615UL,18446744073709551606UL,0x073E66A2L,0xF001BE9DL},{1UL,4UL,1UL,0x93447063L,4UL,0x3A03219BL,2UL,18446744073709551615UL},{18446744073709551615UL,0x4A4E1478L,0xD0026597L,18446744073709551613UL,0x728BE276L,18446744073709551613UL,0xEBB805F8L,2UL},{18446744073709551613UL,18446744073709551615UL,18446744073709551615UL,0x4194A657L,18446744073709551609UL,0x71035224L,1UL,18446744073709551606UL},{0xC6AFF327L,0x834DBD27L,18446744073709551614UL,18446744073709551614UL,18446744073709551614UL,18446744073709551614UL,0x834DBD27L,0xC6AFF327L},{18446744073709551615UL,0xECA7B7A3L,18446744073709551614UL,0x834DBD27L,0x0ECC242CL,18446744073709551615UL,2UL,18446744073709551609UL}},{{1UL,18446744073709551609UL,0x3A03219BL,4UL,0x834DBD27L,18446744073709551615UL,0x71035224L,0UL},{18446744073709551613UL,0xECA7B7A3L,0xCE6368AAL,18446744073709551606UL,0x3A03219BL,18446744073709551614UL,0xFAD7F9E8L,0xBBA08DF3L},{0UL,0x834DBD27L,0xFC2D4B21L,18446744073709551613UL,0x073E66A2L,0x71035224L,18446744073709551615UL,0x5DC9B454L},{0x4A4E1478L,0UL,0x93447063L,0xBBA08DF3L,0x0ECC242CL,0UL,0x0ECC242CL,0xBBA08DF3L},{0xECA7B7A3L,18446744073709551606UL,0xECA7B7A3L,2UL,0xACFC1F18L,18446744073709551615UL,1UL,0xC450AD13L},{0UL,18446744073709551615UL,0xFC2D4B21L,18446744073709551614UL,0x4194A657L,0xFAD7F9E8L,0xACFC1F18L,0UL},{0UL,4UL,18446744073709551609UL,0xD0026597L,0xACFC1F18L,0xF001BE9DL,0xEBB805F8L,2UL},{0xECA7B7A3L,0x3A03219BL,0x71035224L,18446744073709551615UL,0x0ECC242CL,18446744073709551614UL,0x728BE276L,0xF001BE9DL},{18446744073709551606UL,0xD0026597L,0xCE6368AAL,18446744073709551613UL,18446744073709551614UL,4UL,0xECA7B7A3L,0xECA7B7A3L},{0x4194A657L,18446744073709551615UL,0xEBB805F8L,0xEBB805F8L,18446744073709551615UL,0x4194A657L,18446744073709551613UL,0UL}}};
+ int32_t ****l_1285 = &g_454;
+ int32_t l_1306 = 0xD7709800L;
+ uint32_t l_1354 = 0UL;
+ int i, j, k;
+ if (((safe_mod_func_uint32_t_u_u((safe_add_func_int32_t_s_s((+(safe_mod_func_uint32_t_u_u(((((l_1123 != &l_1124) >= (~(safe_sub_func_int8_t_s_s((safe_lshift_func_uint16_t_u_u(l_1129[0][0][2], (safe_div_func_uint16_t_u_u((safe_rshift_func_uint8_t_u_u((safe_rshift_func_uint16_t_u_u(((g_408[2][6] ^ (safe_add_func_int8_t_s_s((safe_sub_func_uint8_t_u_u((((safe_mul_func_int16_t_s_s(((*l_1144) = (((*g_146) = ((*g_146) > p_47)) && (safe_mod_func_int16_t_s_s(2L, 0xCCE6L)))), (((*g_514) = (!(((&g_435 == (void*)0) && 0x1E7E6082L) , (*g_514)))) , p_45))) ^ p_47) , 253UL), p_46)), p_45))) ^ (*g_434)), l_1129[0][1][7])), l_1129[0][4][0])), p_46)))), p_46)))) , 0L) , p_45), 8UL))), 0x70A85053L)), (*g_434))) | 254UL))
+ { /* block id: 609 */
+ int32_t **l_1145 = &g_37;
+ (*l_1145) = &g_59[1];
+ for (l_860 = 0; (l_860 < 52); l_860 = safe_add_func_int8_t_s_s(l_860, 8))
+ { /* block id: 613 */
+ l_1148[3][0][0] = (*l_1145);
+ }
+ }
+ else
+ { /* block id: 616 */
+ uint32_t *l_1161 = (void*)0;
+ uint32_t *l_1162 = &g_408[4][7];
+ uint32_t *l_1163[2];
+ int32_t l_1164 = 0L;
+ int8_t l_1165 = 0x78L;
+ int32_t l_1175 = 0x51F4F9EEL;
+ int32_t l_1177 = 0x008E83A0L;
+ int32_t l_1180 = 0xCBB2DE62L;
+ int32_t l_1181 = (-1L);
+ int32_t l_1183 = 0x5E58F2BFL;
+ int32_t l_1189 = 9L;
+ int32_t l_1191 = 0xFD59E9D3L;
+ int32_t l_1192[6][5] = {{2L,1L,2L,2L,1L},{0x04104790L,(-3L),(-10L),0x1EC6F59FL,(-10L)},{1L,1L,0x167B7268L,1L,1L},{(-10L),0x1EC6F59FL,(-10L),(-3L),0x04104790L},{1L,2L,2L,1L,2L},{0x04104790L,0x1EC6F59FL,1L,0x1EC6F59FL,0x04104790L}};
+ uint8_t l_1193 = 4UL;
+ const uint16_t ***l_1205 = &l_962;
+ int16_t l_1223 = 0x7D73L;
+ int32_t l_1251 = 2L;
+ int32_t l_1329[1];
+ const uint32_t l_1448 = 0x7DF362DFL;
+ int32_t **l_1458 = (void*)0;
+ int i, j;
+ for (i = 0; i < 2; i++)
+ l_1163[i] = &g_436;
+ for (i = 0; i < 1; i++)
+ l_1329[i] = 1L;
+ if (((+(safe_mul_func_int8_t_s_s((p_46 & ((((*g_434)++) ^ (((l_1164 = (safe_sub_func_uint32_t_u_u(((g_61 ^ (+(~(+(safe_lshift_func_int8_t_s_s(0xE2L, 3)))))) , ((*l_1162) = (0L ^ ((*g_514) &= ((*g_146) = (safe_rshift_func_int16_t_s_s((9UL != ((g_358 , ((*g_992) != &l_962)) | p_48)), g_61))))))), p_48))) < 0L) <= p_46)) == l_1165)), 0x64L))) != 65535UL))
+ { /* block id: 622 */
+ uint16_t l_1169 = 65535UL;
+ int32_t **l_1172 = &l_827;
+ int32_t l_1174 = (-7L);
+ int32_t l_1176 = (-1L);
+ int32_t l_1179 = 0xE825BFAEL;
+ int32_t l_1184 = 1L;
+ int32_t l_1185 = (-1L);
+ int32_t l_1186 = 0x368B2BF9L;
+ int32_t l_1187 = 0x2D5947ADL;
+ int32_t l_1188 = 0xA351F4C8L;
+ int32_t l_1190[8] = {0xD6BFCEA0L,(-10L),0xD6BFCEA0L,0xD6BFCEA0L,(-10L),0xD6BFCEA0L,0xD6BFCEA0L,(-10L)};
+ int i;
+ for (l_919 = 1; (l_919 == 1); l_919++)
+ { /* block id: 625 */
+ int8_t l_1168 = 0x45L;
+ ++l_1169;
+ }
+ (*l_1172) = l_1148[3][0][0];
+ ++l_1193;
+ }
+ else
+ { /* block id: 630 */
+ int8_t l_1214[6][7][1] = {{{5L},{1L},{5L},{1L},{5L},{1L},{5L}},{{1L},{5L},{1L},{5L},{1L},{5L},{1L}},{{5L},{1L},{5L},{1L},{5L},{1L},{5L}},{{1L},{5L},{1L},{5L},{1L},{5L},{1L}},{{5L},{1L},{5L},{1L},{5L},{1L},{5L}},{{1L},{5L},{1L},{5L},{1L},{5L},{1L}}};
+ uint16_t ***l_1323 = &l_874;
+ int32_t l_1330 = 0x3DE92DE1L;
+ int32_t ***l_1331 = (void*)0;
+ int i, j, k;
+ for (l_856 = 8; (l_856 >= 0); l_856 -= 1)
+ { /* block id: 633 */
+ const uint16_t ***l_1204 = &l_962;
+ const uint16_t ****l_1203[9][3][9] = {{{&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,(void*)0},{&l_1204,&l_1204,&l_1204,(void*)0,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204},{&l_1204,(void*)0,(void*)0,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204}},{{(void*)0,&l_1204,(void*)0,&l_1204,&l_1204,(void*)0,&l_1204,&l_1204,&l_1204},{&l_1204,(void*)0,&l_1204,(void*)0,&l_1204,&l_1204,&l_1204,(void*)0,&l_1204},{&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,(void*)0}},{{(void*)0,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,(void*)0,&l_1204},{&l_1204,&l_1204,&l_1204,&l_1204,(void*)0,(void*)0,(void*)0,&l_1204,&l_1204},{&l_1204,(void*)0,&l_1204,&l_1204,&l_1204,(void*)0,&l_1204,&l_1204,&l_1204}},{{&l_1204,(void*)0,&l_1204,(void*)0,&l_1204,(void*)0,&l_1204,(void*)0,&l_1204},{&l_1204,&l_1204,&l_1204,&l_1204,(void*)0,&l_1204,&l_1204,&l_1204,&l_1204},{&l_1204,&l_1204,&l_1204,(void*)0,(void*)0,&l_1204,&l_1204,(void*)0,&l_1204}},{{&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,(void*)0,&l_1204,&l_1204,&l_1204},{(void*)0,&l_1204,&l_1204,(void*)0,&l_1204,(void*)0,(void*)0,&l_1204,(void*)0},{&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,(void*)0,&l_1204}},{{(void*)0,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,(void*)0,&l_1204},{&l_1204,&l_1204,(void*)0,&l_1204,&l_1204,(void*)0,&l_1204,&l_1204,&l_1204},{&l_1204,(void*)0,&l_1204,(void*)0,&l_1204,(void*)0,(void*)0,(void*)0,&l_1204}},{{&l_1204,(void*)0,(void*)0,&l_1204,&l_1204,(void*)0,(void*)0,&l_1204,&l_1204},{(void*)0,&l_1204,&l_1204,(void*)0,&l_1204,&l_1204,&l_1204,(void*)0,&l_1204},{&l_1204,&l_1204,(void*)0,&l_1204,&l_1204,(void*)0,(void*)0,&l_1204,&l_1204}},{{&l_1204,&l_1204,(void*)0,(void*)0,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204},{(void*)0,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204},{&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,(void*)0,&l_1204,&l_1204}},{{&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204},{&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,&l_1204,(void*)0,&l_1204,(void*)0},{&l_1204,(void*)0,&l_1204,&l_1204,&l_1204,&l_1204,(void*)0,&l_1204,&l_1204}}};
+ int32_t ****l_1206 = &l_824;
+ uint32_t l_1213 = 0x6CD7B8E6L;
+ uint8_t *l_1238 = &g_131;
+ int i, j, k;
+ (*g_146) = (((((safe_mod_func_uint32_t_u_u(((safe_lshift_func_uint8_t_u_u((!(((safe_mul_func_int8_t_s_s(((*l_790) |= g_1202), (l_1177 = (!(p_45 ^ ((l_1205 = (void*)0) != (((((*l_1071) = (void*)0) == ((*l_1206) = &g_455)) , (safe_rshift_func_int8_t_s_s((((*l_1162) = 4294967295UL) >= (safe_mod_func_uint16_t_u_u(((l_1211 != ((((void*)0 != (*l_1061)) > p_46) , (void*)0)) , l_1193), g_60[0][4][3]))), 4))) , (*g_992)))))))) , l_1212[2][0]) <= 8L)), 4)) != p_46), (*g_434))) , l_1213) != 0UL) , p_47) <= l_1214[5][5][0]);
+ l_1251 ^= ((safe_mod_func_uint16_t_u_u(((safe_mul_func_uint16_t_u_u((safe_sub_func_int32_t_s_s((+((safe_add_func_uint16_t_u_u(l_1223, ((g_69[l_856] = (safe_rshift_func_int8_t_s_u((safe_add_func_uint8_t_u_u((safe_mod_func_uint8_t_u_u((safe_mod_func_uint16_t_u_u((safe_div_func_int8_t_s_s(((((((((((safe_add_func_uint32_t_u_u(l_1191, (((safe_rshift_func_int8_t_s_s(((((*g_146) |= ((((*l_1238) ^= p_48) , (safe_mul_func_uint16_t_u_u(((safe_mod_func_uint32_t_u_u(((*g_713) || (safe_div_func_uint32_t_u_u((((((((safe_mul_func_int8_t_s_s(p_47, p_46)) ^ (safe_sub_func_int16_t_s_s(g_69[6], (l_1214[5][5][0] | ((p_46 <= 1UL) <= g_36))))) | l_1214[5][5][0]) || (*g_713)) >= (*g_434)) , g_138[0]) && p_45), (*g_514)))), p_48)) <= p_47), p_48))) , l_1249)) <= p_45) & p_47), 3)) | (*g_514)) == p_46))) != 0x4E7AL) != p_46) < 0UL) , g_1250) , p_46) != l_1214[3][6][0]) < 0xB137L) , (*g_146)) , p_45), 1UL)), p_48)), 0xBDL)), 1UL)), l_1214[3][2][0]))) | l_1214[5][5][0]))) && 0x02L)), 0xC9004992L)), p_45)) != l_1214[5][5][0]), l_1214[5][5][0])) < p_48);
+ }
+ if ((((safe_div_func_int32_t_s_s(((*g_514) = ((p_46 >= 0x9A75L) || 0xACL)), p_47)) || (*g_713)) && (safe_lshift_func_int8_t_s_u((safe_add_func_uint32_t_u_u(((p_47 < (g_436 != (((**g_992) == ((*l_1211) = (void*)0)) ^ (*g_514)))) && p_47), 8UL)), l_1258[2][3][3]))))
+ { /* block id: 648 */
+ uint8_t *l_1269 = &l_1193;
+ uint8_t *l_1279 = &l_1067;
+ int32_t *****l_1284 = &l_1071;
+ uint16_t ***l_1307 = &g_712;
+ (*g_146) = (safe_add_func_int32_t_s_s((safe_lshift_func_int16_t_s_s((safe_mod_func_uint8_t_u_u(p_45, (safe_lshift_func_uint16_t_u_u((((*l_1279) = (((((safe_add_func_uint8_t_u_u(((((((*l_1269) = p_47) > ((!(safe_div_func_int16_t_s_s(p_45, (((safe_unary_minus_func_int8_t_s((l_1214[5][5][0] | ((safe_div_func_uint32_t_u_u((p_48 != (p_47 , (safe_add_func_uint16_t_u_u((l_1214[5][5][0] < (!(1L != (safe_lshift_func_int16_t_s_s(((*l_1144) &= g_1202), 13))))), p_46)))), p_46)) | 0xBEL)))) <= (-7L)) ^ 9UL)))) >= p_48)) && (*g_434)) != p_46) , p_48), 5UL)) || 0x1207L) ^ l_1214[5][5][0]) && 2L) ^ p_45)) && p_45), p_46)))), l_1214[1][5][0])), 4294967295UL));
+ (*g_514) ^= (((*l_790) &= (-8L)) == ((safe_mul_func_uint8_t_u_u((((*l_1284) = &g_454) == l_1285), (((safe_mul_func_uint16_t_u_u((safe_add_func_int16_t_s_s(l_1191, (l_1108[0] &= (((l_1306 = (safe_div_func_uint8_t_u_u(((*l_1279) = ((safe_sub_func_uint16_t_u_u(((safe_rshift_func_uint8_t_u_u((p_47 & (safe_rshift_func_int8_t_s_s((!((safe_sub_func_uint32_t_u_u((l_1214[1][6][0] >= l_1214[5][5][0]), ((safe_sub_func_uint16_t_u_u((((safe_div_func_uint16_t_u_u((((((*g_713) = (!(safe_mul_func_uint8_t_u_u(((*l_1269) |= 0x14L), (l_1144 == &g_775))))) ^ 0x29A5L) < p_47) != 0xCE61ED42L), p_46)) > 0x3BE5L) , (*g_713)), p_46)) | 0xC9L))) != l_1214[1][3][0])), 2))), 0)) > l_1214[2][4][0]), g_510)) , 0x2AL)), l_1214[5][5][0]))) , l_1307) != (*g_992))))), (-1L))) < g_60[0][4][3]) , p_45))) >= p_46));
+ return &g_37;
+ }
+ else
+ { /* block id: 662 */
+ uint8_t *l_1313 = &l_1129[0][2][4];
+ int32_t l_1322[9] = {(-3L),(-10L),(-3L),(-10L),(-3L),(-10L),(-3L),(-10L),(-3L)};
+ int i;
+ l_1329[0] = ((safe_sub_func_int8_t_s_s(((safe_mul_func_uint8_t_u_u(((*l_1313) |= g_1312), (p_48 <= (+(safe_rshift_func_int16_t_s_s((safe_div_func_uint32_t_u_u((safe_lshift_func_uint8_t_u_u(((safe_rshift_func_uint8_t_u_s(l_1322[4], 7)) < (l_1323 == (g_1324 = &l_874))), 5)), ((*l_1162) = (safe_rshift_func_int8_t_s_s((safe_div_func_int32_t_s_s((~p_45), (p_47 , 0x74FE25C3L))), 1))))), g_131)))))) != p_47), 0x79L)) | p_48);
+ l_1330 = l_1322[4];
+ l_1322[4] = ((void*)0 != l_1331);
+ }
+ }
+ for (l_789 = (-25); (l_789 >= 52); l_789 = safe_add_func_int8_t_s_s(l_789, 8))
+ { /* block id: 673 */
+ uint32_t l_1350[2][1][4];
+ int32_t **l_1355 = &l_1148[3][0][0];
+ int i, j, k;
+ for (i = 0; i < 2; i++)
+ {
+ for (j = 0; j < 1; j++)
+ {
+ for (k = 0; k < 4; k++)
+ l_1350[i][j][k] = 18446744073709551615UL;
+ }
+ }
+ for (p_48 = (-2); (p_48 == (-3)); p_48 = safe_sub_func_uint32_t_u_u(p_48, 5))
+ { /* block id: 676 */
+ uint32_t l_1353 = 18446744073709551615UL;
+ (*g_146) &= ((p_47 , (safe_mul_func_uint8_t_u_u(p_45, (safe_rshift_func_uint16_t_u_s(((safe_add_func_int16_t_s_s(p_47, ((+(((safe_mod_func_uint32_t_u_u((((*l_1162) = (safe_add_func_int32_t_s_s((((g_1096[0] , ((((safe_div_func_int32_t_s_s(((safe_sub_func_uint16_t_u_u(((*g_514) | p_48), (l_1350[0][0][1] = p_46))) & (safe_mul_func_int16_t_s_s(g_358, g_2))), (*g_434))) || p_48) , 65535UL) | p_47)) && 1UL) | l_1353), 0xB364D226L))) , 0xA0A58F63L), l_1191)) && p_46) != l_1353)) != l_1354))) >= p_45), g_415))))) ^ (*g_713));
+ return &g_37;
+ }
+ }
+ (*g_146) |= ((*g_713) && ((((((*g_1324) = (*g_1324)) == &l_793[0][0]) & (((((safe_unary_minus_func_int16_t_s(((safe_add_func_uint32_t_u_u((safe_div_func_uint16_t_u_u(0UL, ((*g_713) = p_45))), (safe_add_func_uint8_t_u_u(((safe_mod_func_int32_t_s_s(l_1365, (((safe_div_func_uint32_t_u_u((((safe_rshift_func_uint8_t_u_s(((*l_1071) == l_824), 7)) < g_1096[0]) != 0x39CA519CL), 0xF92D732FL)) , p_48) && p_46))) , 252UL), p_46)))) , p_47))) != 0x16L) != l_1180) | 1UL) | l_1192[4][4])) || 0x53A17BC8L) | 6L));
+ if ((((safe_mod_func_uint16_t_u_u(l_1249, 0x29DDL)) | ((safe_div_func_uint32_t_u_u((((*l_1162) = (p_46 && (safe_rshift_func_int8_t_s_u(g_145, ((l_1251 = (p_47 = (&g_775 != ((safe_div_func_int8_t_s_s(((*l_790) = p_45), p_47)) , &p_45)))) == (+(g_775 ^= (safe_rshift_func_uint16_t_u_u(((*g_713) = ((((*l_1144) = ((safe_sub_func_uint16_t_u_u((((*g_146) = p_48) || p_48), p_45)) , (-5L))) <= 0L) != (*g_514))), 12))))))))) ^ l_1164), (*g_434))) < l_1382)) < p_45))
+ { /* block id: 694 */
+ uint8_t *l_1385 = &g_31[0];
+ int32_t l_1414 = 7L;
+ uint8_t l_1447 = 0x67L;
+ int32_t **l_1455 = (void*)0;
+ l_880 = &l_1181;
+ if ((safe_mul_func_uint16_t_u_u(((((*l_1385)--) && 8UL) < ((((!(p_47 = (safe_sub_func_uint16_t_u_u((safe_lshift_func_int8_t_s_u(0xD6L, ((safe_sub_func_int8_t_s_s((((safe_div_func_uint16_t_u_u(((safe_mul_func_int16_t_s_s((safe_rshift_func_uint8_t_u_u(p_46, 1)), (safe_add_func_uint8_t_u_u((safe_sub_func_int16_t_s_s(g_415, ((safe_mul_func_int8_t_s_s((safe_lshift_func_uint16_t_u_u(((*g_713) = (l_1164 = ((g_408[2][6] , ((safe_sub_func_uint8_t_u_u((p_45 ^ 0x25L), (*l_880))) ^ (safe_div_func_uint8_t_u_u((safe_sub_func_int8_t_s_s((((g_36 , p_47) & p_46) , g_126), p_45)), l_1414)))) , 0xF394L))), l_1414)), (*l_880))) != 0x04DC5837L))), p_48)))) , p_48), 0x7F7CL)) & 0x8846L) && (*g_146)), p_48)) >= 4294967295UL))), p_48)))) && 0x5D09L) > 0UL) , p_46)), p_46)))
+ { /* block id: 700 */
+ int16_t l_1430 = 0xBBD6L;
+ (*g_514) = (safe_add_func_int32_t_s_s((((safe_div_func_int32_t_s_s(0x9175FE28L, (~((safe_mul_func_uint8_t_u_u((safe_add_func_uint16_t_u_u(((safe_lshift_func_uint8_t_u_u((safe_mul_func_int8_t_s_s((safe_div_func_int32_t_s_s(((void*)0 == &l_1192[3][4]), (+(safe_unary_minus_func_uint8_t_u(l_1430))))), 0xBBL)), l_1414)) == p_48), (1L <= l_1431[0]))), (-10L))) , (*g_434))))) , l_1432) , (*g_146)), p_48));
+ }
+ else
+ { /* block id: 702 */
+ uint8_t ****l_1436 = &l_1435;
+ int32_t l_1445 = 9L;
+ int16_t *l_1446[1];
+ int i;
+ for (i = 0; i < 1; i++)
+ l_1446[i] = &g_775;
+ l_1251 = (l_1063 != (((!(l_1447 = ((*l_1144) = ((0xEB40L ^ (safe_add_func_uint32_t_u_u((*g_434), (((*l_1436) = l_1435) == &g_658[3])))) == (((safe_lshift_func_uint8_t_u_s((safe_div_func_int8_t_s_s(p_47, 0x51L)), ((safe_add_func_int16_t_s_s((((-8L) & (safe_mul_func_int16_t_s_s(p_46, 7L))) > p_47), 1UL)) ^ g_415))) > 4294967290UL) || l_1445))))) != p_47) , (void*)0));
+ (*g_146) = (((*g_146) , 0x7A77L) ^ ((0xBAD2L || (l_1448 >= (p_48 = (safe_div_func_uint16_t_u_u(2UL, ((((*l_880) = ((safe_lshift_func_uint16_t_u_s(p_47, (((*g_514) = ((~((safe_add_func_uint32_t_u_u(((((((*l_1071) != &g_455) != 0x7B6E557FL) >= (*g_514)) < l_1447) <= 0x290502A0L), 4294967295UL)) >= p_48)) , (*g_514))) && 0x6D566369L))) , p_48)) , 0x9053L) , g_60[0][4][3])))))) , (*l_880)));
+ return l_1455;
+ }
+ }
+ else
+ { /* block id: 713 */
+ for (g_126 = 0; (g_126 != (-12)); g_126--)
+ { /* block id: 716 */
+ return l_1458;
+ }
+ }
+ }
+ for (g_415 = 0; (g_415 != 10); g_415 = safe_add_func_int32_t_s_s(g_415, 3))
+ { /* block id: 723 */
+ int32_t l_1465 = 0x90C86AAFL;
+ int32_t **l_1466[3];
+ int i;
+ for (i = 0; i < 3; i++)
+ l_1466[i] = &l_827;
+ }
+ }
+ if ((safe_lshift_func_uint16_t_u_u((g_360 >= (p_47 != ((safe_div_func_uint8_t_u_u((((!((*g_514) , (safe_div_func_uint16_t_u_u(((safe_rshift_func_uint16_t_u_u((safe_mul_func_uint8_t_u_u(((*l_1480) = ((void*)0 == &l_793[0][0])), ((*l_790) |= 2L))), (*g_713))) < 0xB9L), (((((g_1483 = ((safe_lshift_func_int8_t_s_u(((&g_659 == (void*)0) ^ 0x34L), p_48)) , &l_1249)) != &l_1249) ^ 0x8F060E18L) == p_48) | l_1485[1][5][1]))))) | p_45) != 0xA1L), p_46)) < g_408[2][6]))), 8)))
+ { /* block id: 744 */
+ uint32_t l_1512 = 0x0753D77DL;
+ int32_t **l_1517 = &l_827;
+ int32_t l_1537 = 0xA118C07FL;
+ int32_t *l_1566 = &g_61;
+ int32_t *l_1567 = &l_1537;
+ int32_t *l_1568 = &l_856;
+ int32_t *l_1569 = &g_59[1];
+ int32_t *l_1570 = &l_879;
+ int32_t *l_1571[9];
+ uint8_t l_1573 = 7UL;
+ int i;
+ for (i = 0; i < 9; i++)
+ l_1571[i] = &l_1182;
+ for (g_436 = 12; (g_436 <= 55); g_436 = safe_add_func_int8_t_s_s(g_436, 9))
+ { /* block id: 747 */
+ int32_t * const l_1490 = &g_59[1];
+ for (l_858 = (-21); (l_858 <= (-8)); l_858 = safe_add_func_int8_t_s_s(l_858, 1))
+ { /* block id: 750 */
+ int32_t **l_1491 = &l_880;
+ (*l_1491) = l_1490;
+ }
+ for (g_131 = (-22); (g_131 < 32); g_131++)
+ { /* block id: 755 */
+ int32_t *l_1494 = &g_59[1];
+ int32_t **l_1495 = &g_37;
+ int32_t ****l_1504 = &l_824;
+ uint16_t **l_1505 = &g_713;
+ uint16_t * const l_1508 = &g_1509;
+ uint16_t * const *l_1507[5][8][1] = {{{(void*)0},{&l_1508},{&l_1508},{(void*)0},{&l_1508},{&l_1508},{&l_1508},{(void*)0}},{{&l_1508},{&l_1508},{(void*)0},{&l_1508},{&l_1508},{&l_1508},{(void*)0},{&l_1508}},{{&l_1508},{(void*)0},{&l_1508},{&l_1508},{&l_1508},{(void*)0},{&l_1508},{&l_1508}},{{(void*)0},{&l_1508},{&l_1508},{&l_1508},{(void*)0},{&l_1508},{&l_1508},{(void*)0}},{{&l_1508},{&l_1508},{&l_1508},{(void*)0},{&l_1508},{&l_1508},{(void*)0},{&l_1508}}};
+ uint16_t * const **l_1506 = &l_1507[3][4][0];
+ int32_t ****l_1510 = (void*)0;
+ int32_t *****l_1511 = &l_1071;
+ int i, j, k;
+ if (p_46)
+ break;
+ (*l_1495) = l_1494;
+ (*l_1490) = ((safe_rshift_func_int16_t_s_s((safe_mul_func_uint8_t_u_u(247UL, (safe_div_func_uint16_t_u_u(((*g_434) && (*l_1490)), (safe_div_func_uint32_t_u_u(((((*l_1490) || (l_1504 == ((*l_1511) = (l_1510 = ((l_1505 != ((*l_1506) = l_1505)) , &g_454))))) , l_1061) == (void*)0), (*g_434))))))), (*l_1490))) , p_48);
+ }
+ l_1512--;
+ }
+ if (((*g_146) |= l_1512))
+ { /* block id: 766 */
+ for (p_48 = (-8); (p_48 >= 24); p_48 = safe_add_func_int32_t_s_s(p_48, 5))
+ { /* block id: 769 */
+ return (*l_824);
+ }
+ }
+ else
+ { /* block id: 772 */
+ int32_t l_1520 = (-1L);
+ for (l_1382 = 0; (l_1382 != 48); l_1382 = safe_add_func_uint32_t_u_u(l_1382, 3))
+ { /* block id: 775 */
+ int8_t l_1522 = 1L;
+ int32_t l_1523 = 1L;
+ int32_t l_1536 = (-10L);
+ int32_t l_1541 = 0x1F61027AL;
+ if ((l_1520 = ((*g_146) = (-1L))))
+ { /* block id: 778 */
+ int8_t l_1521 = (-4L);
+ if (p_47)
+ break;
+ l_1522 = l_1521;
+ }
+ else
+ { /* block id: 781 */
+ int32_t *l_1524 = &l_855;
+ int32_t *l_1525 = &g_36;
+ int32_t *l_1526 = &l_1108[0];
+ int32_t *l_1527 = &g_60[0][4][3];
+ int32_t *l_1528 = &l_879;
+ int32_t *l_1529 = (void*)0;
+ int32_t *l_1530 = &g_60[0][2][2];
+ int32_t *l_1531 = &g_36;
+ int32_t *l_1532 = (void*)0;
+ int32_t *l_1533 = &l_855;
+ int32_t *l_1534 = &g_36;
+ int32_t *l_1535[2];
+ int i;
+ for (i = 0; i < 2; i++)
+ l_1535[i] = (void*)0;
+ ++l_1538;
+ l_1542--;
+ }
+ return &g_514;
+ }
+ }
+ for (l_851 = 21; (l_851 <= 10); l_851 = safe_sub_func_int8_t_s_s(l_851, 1))
+ { /* block id: 790 */
+ int32_t l_1565 = (-1L);
+ (*g_514) |= (((safe_sub_func_uint16_t_u_u((safe_div_func_int8_t_s_s((safe_mod_func_uint32_t_u_u(p_46, 4L)), (safe_mod_func_uint8_t_u_u(p_45, (((safe_lshift_func_uint16_t_u_s(((safe_mul_func_int16_t_s_s((0xC1L <= ((safe_rshift_func_uint8_t_u_s(((((l_1561 < (safe_add_func_uint16_t_u_u(l_1564, ((~p_45) && ((*l_1480) = (l_1565 < 1L)))))) , &g_454) != &g_454) <= p_45), 1)) > 0x8D0979DCL)), l_1565)) != p_47), 6)) , p_46) || p_48))))), p_46)) , g_69[6]) != 0x8BL);
+ }
+ l_1573--;
+ }
+ else
+ { /* block id: 795 */
+ uint8_t *l_1579 = &g_131;
+ uint8_t ** const l_1578 = &l_1579;
+ uint8_t ** const *l_1577 = &l_1578;
+ uint8_t ** const **l_1576 = &l_1577;
+ int32_t l_1605 = 0x9D3CEF20L;
+ uint32_t l_1635 = 0xA0B6A9DBL;
+ int8_t **l_1656 = (void*)0;
+ int32_t l_1663 = (-1L);
+ int32_t **l_1673[5] = {&g_514,&g_514,&g_514,&g_514,&g_514};
+ int16_t l_1711 = 0x11BEL;
+ int32_t l_1714 = 4L;
+ int32_t *l_1744 = &l_855;
+ uint8_t l_1765 = 0xB3L;
+ uint32_t l_1790 = 5UL;
+ uint32_t l_1791 = 0x09D0C495L;
+ int i;
+ if (((((*l_1480) &= 250UL) & ((((((*l_1576) = l_1435) == (((*g_514) = (+(safe_lshift_func_uint8_t_u_s(p_46, (g_435 == g_435))))) , &g_658[3])) , ((safe_div_func_int32_t_s_s(0x3603FE2EL, (safe_rshift_func_uint8_t_u_s((++(*l_1579)), 4)))) ^ p_47)) ^ 0UL) < p_47)) && 0xA1D3L))
+ { /* block id: 800 */
+ int8_t l_1607 = 0xDBL;
+ for (g_775 = (-4); (g_775 >= 1); ++g_775)
+ { /* block id: 803 */
+ uint8_t ****l_1592[8];
+ int32_t l_1606 = (-1L);
+ int i;
+ for (i = 0; i < 8; i++)
+ l_1592[i] = &l_1435;
+ (*g_146) = ((*g_713) < (g_1590 == &g_1591[5][6]));
+ l_1607 &= ((((l_1593[1] = l_1435) != &g_658[2]) || (+(((((***l_1576) = (**l_1435)) == ((*l_1578) = l_1594)) && (4294967290UL != (((safe_mul_func_int8_t_s_s((safe_add_func_uint8_t_u_u((l_1606 ^= (safe_mul_func_int16_t_s_s(((((((&p_48 == &p_48) , ((*l_790) = ((safe_rshift_func_uint16_t_u_s(((*g_713) = (+0xDA44L)), (safe_rshift_func_int8_t_s_s(8L, p_46)))) == 1L))) < l_1605) >= 0x4746L) == p_48) > 3L), g_131))), p_48)), 1L)) && p_48) < p_48))) || l_1605))) , (*g_146));
+ if (l_1607)
+ continue;
+ (*g_514) ^= (safe_mod_func_int16_t_s_s(((*g_434) , (255UL <= l_1606)), p_48));
+ }
+ return (*l_824);
+ }
+ else
+ { /* block id: 816 */
+ int16_t l_1625[5][7];
+ int8_t **l_1626 = &l_790;
+ uint32_t l_1629 = 0xA3E6BA5DL;
+ int8_t *l_1630 = &l_1173[0];
+ int i, j;
+ for (i = 0; i < 5; i++)
+ {
+ for (j = 0; j < 7; j++)
+ l_1625[i][j] = 0x8253L;
+ }
+ (*g_146) = ((safe_mod_func_uint32_t_u_u((safe_add_func_int8_t_s_s(p_45, (safe_mod_func_int16_t_s_s(((safe_mul_func_int16_t_s_s((safe_unary_minus_func_int8_t_s((p_45 != ((safe_sub_func_uint8_t_u_u((safe_add_func_uint16_t_u_u(((((*l_790) = (l_1625[2][5] , l_1605)) || (p_48 = ((*l_1630) = ((l_1626 == ((*l_1064) = (void*)0)) < ((safe_div_func_int32_t_s_s((((l_1629 && (&g_658[2] != l_1435)) | 0xD91DL) , 0xD5441AC9L), 0x10740426L)) , p_48))))) ^ p_46), l_1605)), g_59[7])) , p_46)))), 0x547DL)) && (*g_434)), p_46)))), p_46)) ^ g_1509);
+ }
+ for (g_1509 = 0; (g_1509 < 38); g_1509 = safe_add_func_uint16_t_u_u(g_1509, 1))
+ { /* block id: 825 */
+ uint8_t l_1647 = 0x58L;
+ uint16_t *l_1661[8] = {&g_69[0],&g_69[5],&g_69[0],&g_69[5],&g_69[0],&g_69[5],&g_69[0],&g_69[5]};
+ int32_t l_1662[8][3] = {{(-1L),0xF23F40CAL,0xA058F09DL},{0x60BB2647L,(-1L),0xF23F40CAL},{0x60BB2647L,3L,0xB82B7CEFL},{(-1L),0xFA4AA8CDL,(-1L)},{0xB82B7CEFL,3L,0x60BB2647L},{0xF23F40CAL,(-1L),0x60BB2647L},{0xA058F09DL,0xF23F40CAL,(-1L)},{1L,1L,0xB82B7CEFL}};
+ int i, j;
+ for (l_789 = (-9); (l_789 == 15); ++l_789)
+ { /* block id: 828 */
+ --l_1635;
+ }
+ for (g_36 = 0; (g_36 == (-18)); g_36 = safe_sub_func_uint16_t_u_u(g_36, 5))
+ { /* block id: 833 */
+ uint32_t l_1640[1];
+ int32_t l_1669 = 0x1BDB15C6L;
+ int i;
+ for (i = 0; i < 1; i++)
+ l_1640[i] = 0xAFBC8874L;
+ if (p_48)
+ { /* block id: 834 */
+ int8_t l_1643 = (-1L);
+ int32_t *l_1644 = (void*)0;
+ int32_t *l_1645 = &l_1182;
+ int32_t *l_1646[4][1][6] = {{{&l_1182,&g_36,(void*)0,(void*)0,&g_36,&l_1182}},{{&l_1605,&l_1182,(void*)0,&l_1182,&l_1605,&l_1605}},{{&l_855,&l_1182,&l_1182,&l_855,&g_36,&l_855}},{{&l_855,&g_36,&l_855,&l_1182,&l_1182,&l_855}}};
+ int i, j, k;
+ --l_1640[0];
+ if (l_1640[0])
+ continue;
+ l_1647++;
+ (*g_146) &= (safe_sub_func_uint32_t_u_u((l_1640[0] , (safe_lshift_func_int8_t_s_s((g_510 &= (safe_mul_func_int8_t_s_s((((l_1656 == ((*l_1061) = l_1656)) < g_1509) | ((p_47++) ^ (0x42L != (((!(p_45 | (l_1661[0] != &p_46))) , &g_510) == &g_510)))), (-1L)))), g_408[2][6]))), p_45));
+ }
+ else
+ { /* block id: 842 */
+ int32_t *l_1664 = &l_855;
+ int32_t *l_1665 = (void*)0;
+ int32_t *l_1666 = &l_1663;
+ int32_t *l_1667 = &l_1662[2][0];
+ int32_t *l_1668[7][2] = {{&g_59[8],&l_1662[2][0]},{&g_59[8],&l_1662[2][0]},{&g_59[8],&l_1662[2][0]},{&g_59[8],&l_1662[2][0]},{&g_59[8],&l_1662[2][0]},{&g_59[8],&l_1662[2][0]},{&g_59[8],&l_1662[2][0]}};
+ int i, j;
+ (*g_146) = p_48;
+ ++l_1670;
+ l_1662[1][0] = ((*g_146) = 0x32BC2857L);
+ }
+ return l_1673[2];
+ }
+ --l_1675[3][1][0];
+ for (g_360 = 0; (g_360 >= 25); g_360 = safe_add_func_uint16_t_u_u(g_360, 2))
+ { /* block id: 853 */
+ uint32_t *l_1689[8] = {&l_1542,&l_1542,&l_1542,&l_1542,&l_1542,&l_1542,&l_1542,&l_1542};
+ uint32_t **l_1690 = (void*)0;
+ int32_t l_1703 = 0x9EF797C4L;
+ int i;
+ (*g_514) &= (*g_146);
+ if (((safe_rshift_func_int8_t_s_u(p_48, 2)) > (((*l_1579) = (--l_1682)) == (safe_mod_func_int8_t_s_s((safe_mul_func_int16_t_s_s(0L, p_47)), (((l_1691 = l_1689[1]) != ((safe_div_func_int8_t_s_s(0L, (p_48 || ((safe_div_func_int16_t_s_s((safe_mod_func_int8_t_s_s(((*l_790) = (safe_mul_func_uint8_t_u_u(((*l_1594) = ((void*)0 != l_873[7])), (safe_unary_minus_func_uint16_t_u(((safe_mod_func_int8_t_s_s((l_1662[1][2] ^= l_1703), 0x88L)) , 1UL)))))), l_1703)), p_46)) || g_145)))) , &l_1670)) & l_1647))))))
+ { /* block id: 861 */
+ return (*l_824);
+ }
+ else
+ { /* block id: 863 */
+ return (*l_824);
+ }
+ }
+ }
+ if (((((safe_lshift_func_uint8_t_u_u(p_47, ((((*g_146) = ((((*g_514) = ((((void*)0 == &g_408[5][0]) && p_45) <= ((*g_434)++))) | p_47) | (1L <= (((void*)0 == l_1710) & (((g_124 &= ((0x09BA0DEDL > (-1L)) , 0L)) && p_47) != 0UL))))) , (*g_434)) != 0x6663A05DL))) || p_47) > p_46) , 0x9E8BC888L))
+ { /* block id: 872 */
+ int32_t l_1712[1];
+ int32_t l_1713[8][2][3] = {{{0xE0DAFB5FL,(-7L),(-7L)},{0x6966D37CL,(-7L),0xDF1FC2D9L}},{{(-1L),(-7L),0L},{0xE0DAFB5FL,(-7L),(-7L)}},{{0x6966D37CL,(-7L),0xDF1FC2D9L},{(-1L),(-7L),0L}},{{0xE0DAFB5FL,(-7L),(-7L)},{0x6966D37CL,(-7L),0xDF1FC2D9L}},{{(-1L),(-7L),0L},{0xE0DAFB5FL,(-7L),(-7L)}},{{0x6966D37CL,(-7L),0xDF1FC2D9L},{(-1L),(-7L),0L}},{{0xE0DAFB5FL,(-7L),(-7L)},{0x6966D37CL,(-7L),0xDF1FC2D9L}},{{(-1L),(-7L),0L},{0xE0DAFB5FL,(-7L),(-7L)}}};
+ int16_t l_1715 = 9L;
+ int32_t l_1716 = (-1L);
+ uint32_t l_1717 = 1UL;
+ int32_t *l_1720[4] = {&l_1714,&l_1714,&l_1714,&l_1714};
+ int i, j, k;
+ for (i = 0; i < 1; i++)
+ l_1712[i] = 0x31D00C21L;
+ for (g_775 = 0; g_775 < 9; g_775 += 1)
+ {
+ g_69[g_775] = 0xA232L;
+ }
+ ++l_1717;
+ l_1720[1] = &l_1713[7][0][1];
+ for (l_1715 = 9; (l_1715 <= 15); l_1715++)
+ { /* block id: 878 */
+ uint32_t l_1725[1][2][1];
+ int32_t *l_1743 = (void*)0;
+ int32_t l_1757[2][8][6] = {{{0x49E5A31AL,0xA31FA484L,2L,0L,0x8FADFB52L,0xC791BA3CL},{0xC791BA3CL,0L,0xFCCBC020L,0L,2L,0x49E5A31AL},{2L,0x8FADFB52L,0xA71F3D56L,1L,0xC791BA3CL,0xC791BA3CL},{0x8FADFB52L,0x46E5F6F7L,0x46E5F6F7L,0x8FADFB52L,0xA31FA484L,0xC791BA3CL},{0xFCCBC020L,0xC791BA3CL,0xA71F3D56L,0x49E5A31AL,1L,0x49E5A31AL},{0xA31FA484L,0L,0xA31FA484L,0L,1L,2L},{0xA71F3D56L,0xC791BA3CL,0xFCCBC020L,0xA31FA484L,0xA31FA484L,0xFCCBC020L},{0x46E5F6F7L,0x46E5F6F7L,0x8FADFB52L,0xA31FA484L,0xC791BA3CL,0L}},{{0xA71F3D56L,0x8FADFB52L,2L,0L,2L,0x8FADFB52L},{0xA31FA484L,0xA71F3D56L,2L,0x49E5A31AL,0x46E5F6F7L,0L},{0xFCCBC020L,0x49E5A31AL,0x8FADFB52L,0x8FADFB52L,0x49E5A31AL,0xFCCBC020L},{0x8FADFB52L,0x49E5A31AL,0xFCCBC020L,1L,0x46E5F6F7L,2L},{2L,0xA71F3D56L,0xA31FA484L,0xA71F3D56L,2L,0x49E5A31AL},{2L,0x8FADFB52L,0xA71F3D56L,1L,0xC791BA3CL,0xC791BA3CL},{0x8FADFB52L,0x46E5F6F7L,0x46E5F6F7L,0x8FADFB52L,0xA31FA484L,0xC791BA3CL},{0xFCCBC020L,0xC791BA3CL,0xA71F3D56L,0x49E5A31AL,1L,0x49E5A31AL}}};
+ int i, j, k;
+ for (i = 0; i < 1; i++)
+ {
+ for (j = 0; j < 2; j++)
+ {
+ for (k = 0; k < 1; k++)
+ l_1725[i][j][k] = 9UL;
+ }
+ }
+ (*g_514) |= p_47;
+ if ((((!(((((!(*g_434)) & (g_59[1] & p_46)) & (l_1725[0][0][0] > (safe_mul_func_int16_t_s_s((safe_mod_func_uint16_t_u_u(0x764CL, (safe_mul_func_int16_t_s_s(((g_1250 == (safe_mul_func_int8_t_s_s(p_45, (((((safe_div_func_int32_t_s_s((safe_lshift_func_uint16_t_u_u(1UL, (~(safe_add_func_uint32_t_u_u((&g_455 == &g_455), p_46))))), p_48)) , 0x19E31692L) ^ 0L) != 0L) || (*g_434))))) && p_47), 65529UL)))), l_1742[6][3][3])))) & p_45) == g_360)) , 1UL) < 0x0FL))
+ { /* block id: 880 */
+ int32_t ***l_1751 = &l_1673[0];
+ int16_t *l_1754 = &l_1432;
+ int16_t *l_1756 = &g_775;
+ l_1744 = l_1743;
+ (*g_146) ^= (safe_lshift_func_int16_t_s_s((safe_mul_func_int16_t_s_s(p_46, (safe_sub_func_int8_t_s_s((((*l_1071) != l_1751) <= (&g_435 != (void*)0)), 0UL)))), (safe_lshift_func_int16_t_s_u(((((*l_1754) = ((void*)0 == &g_658[0])) | ((*l_1756) ^= ((p_45 , p_45) | l_1755))) < (***l_1751)), p_45))));
+ }
+ else
+ { /* block id: 885 */
+ l_827 = &l_857[1];
+ g_1758[3][0][1]++;
+ g_514 = &g_61;
+ }
+ for (p_47 = 2; (p_47 > 57); p_47 = safe_add_func_int32_t_s_s(p_47, 2))
+ { /* block id: 892 */
+ int8_t l_1763 = (-7L);
+ int32_t l_1764 = 1L;
+ (*g_146) &= 1L;
+ --l_1765;
+ if (p_47)
+ break;
+ return &g_514;
+ }
+ }
+ }
+ else
+ { /* block id: 899 */
+ int8_t l_1789 = (-1L);
+ for (l_1249 = 18; (l_1249 <= 9); l_1249 = safe_sub_func_int8_t_s_s(l_1249, 1))
+ { /* block id: 902 */
+ (*g_514) |= ((safe_mod_func_int16_t_s_s(p_45, 0xDE63L)) > (safe_mod_func_uint8_t_u_u(((g_775 , (safe_sub_func_uint16_t_u_u(l_1776, (!((safe_mul_func_int8_t_s_s(p_46, ((safe_mod_func_int16_t_s_s((((p_45 <= ((safe_mod_func_int8_t_s_s((safe_mod_func_int16_t_s_s((((g_145 | p_45) & ((safe_sub_func_uint8_t_u_u(((*l_1579) ^= ((safe_sub_func_int16_t_s_s((l_1789 ^ 0L), p_47)) , p_46)), 0xA2L)) > 0xD456L)) && l_1790), 0x2067L)), 0xCDL)) ^ p_47)) | p_46) == l_1789), (*g_713))) || 0xB4L))) < 3L))))) ^ 0xD0L), l_1791)));
+ }
+ }
+ for (l_858 = 0; l_858 < 8; l_858 += 1)
+ {
+ for (l_1790 = 0; l_1790 < 4; l_1790 += 1)
+ {
+ for (g_775 = 0; g_775 < 5; g_775 += 1)
+ {
+ l_1742[l_858][l_1790][g_775] = 0x47264078L;
+ }
+ }
+ }
+ }
+ }
+ return (*l_824);
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_434 g_138 g_436 g_408 g_31 g_59 g_146 g_60 g_69 g_2 g_360 g_36 g_514 g_37 g_124 g_415 g_658 g_126 g_61 g_713 g_454 g_455 g_358 g_510
+ * writes: g_360 g_37 g_510 g_436 g_145 g_415 g_69 g_59 g_60 g_131 g_31 g_138 g_658 g_712 g_659 g_455
+ */
+static uint32_t func_49(uint16_t p_50, int32_t ** const p_51, int32_t p_52, int8_t p_53, uint8_t p_54)
+{ /* block id: 265 */
+ int32_t *l_540 = (void*)0;
+ int32_t l_551 = 0x82C03D9FL;
+ int32_t l_555 = (-1L);
+ int32_t l_557 = 0xD8A38C6FL;
+ int32_t ***l_583[5] = {&g_455,&g_455,&g_455,&g_455,&g_455};
+ uint32_t l_633 = 18446744073709551609UL;
+ const uint32_t l_656 = 0x411EFF5AL;
+ uint16_t *l_710 = &g_69[4];
+ uint16_t **l_709 = &l_710;
+ int i;
+lbl_539:
+ for (g_360 = 1; (g_360 >= 0); g_360 -= 1)
+ { /* block id: 268 */
+ int32_t *l_534 = &g_59[5];
+ (*p_51) = l_534;
+ for (g_510 = 0; (g_510 <= 1); g_510 += 1)
+ { /* block id: 272 */
+ return (*g_434);
+ }
+ }
+ for (g_436 = 25; (g_436 > 44); g_436 = safe_add_func_uint8_t_u_u(g_436, 5))
+ { /* block id: 278 */
+ const uint16_t *l_541 = &g_69[7];
+ int32_t l_546 = 6L;
+ int8_t *l_547 = &g_415;
+ int32_t l_552 = 0xFCB77EC7L;
+ int32_t l_553 = 0x0A279ABBL;
+ int32_t l_554 = 0x31D6845EL;
+ int32_t l_556 = 0xC2775E94L;
+ int32_t l_558 = 2L;
+ int32_t l_559 = 0xB7C1040AL;
+ int32_t ***l_581[10] = {&g_455,&g_455,&g_455,&g_455,&g_455,&g_455,&g_455,&g_455,&g_455,&g_455};
+ uint32_t l_616 = 0x0D85AE67L;
+ int32_t l_635[10] = {0x7AF0BAD7L,0x7AF0BAD7L,0x7AF0BAD7L,0x7AF0BAD7L,0x7AF0BAD7L,0x7AF0BAD7L,0x7AF0BAD7L,0x7AF0BAD7L,0x7AF0BAD7L,0x7AF0BAD7L};
+ uint16_t l_664 = 1UL;
+ int16_t l_734 = 0xCC65L;
+ uint32_t l_735 = 0x14DBAF86L;
+ int i;
+ for (g_145 = 0; (g_145 > 47); g_145 = safe_add_func_uint16_t_u_u(g_145, 4))
+ { /* block id: 281 */
+ if (g_436)
+ goto lbl_539;
+ }
+ (*p_51) = l_540;
+ if ((((void*)0 != l_541) != (safe_rshift_func_int16_t_s_u((((!(safe_lshift_func_int8_t_s_s(((*l_547) = l_546), 7))) ^ g_408[4][8]) ^ 0x8BL), 4))))
+ { /* block id: 286 */
+ int32_t *l_550[10] = {&g_60[0][4][3],&g_60[0][4][3],&g_60[0][4][3],&g_60[0][4][3],&g_60[0][4][3],&g_60[0][4][3],&g_60[0][4][3],&g_60[0][4][3],&g_60[0][4][3],&g_60[0][4][3]};
+ uint8_t l_560 = 0UL;
+ uint16_t *l_567 = &g_145;
+ uint16_t *l_576 = &g_69[7];
+ int32_t ****l_582[10][1];
+ uint32_t l_615 = 0x6C53EE8BL;
+ int32_t l_638 = (-8L);
+ int i, j;
+ for (i = 0; i < 10; i++)
+ {
+ for (j = 0; j < 1; j++)
+ l_582[i][j] = (void*)0;
+ }
+ for (g_360 = 0; (g_360 != (-29)); g_360 = safe_sub_func_uint16_t_u_u(g_360, 8))
+ { /* block id: 289 */
+ return (*g_434);
+ }
+ --l_560;
+ if ((safe_sub_func_uint8_t_u_u((safe_lshift_func_uint16_t_u_u((((*l_567) = g_138[3]) <= (l_552 ^ (safe_mod_func_uint16_t_u_u(((*l_576) = (safe_mul_func_uint8_t_u_u((safe_add_func_int8_t_s_s(g_31[0], 8L)), (l_546 = (safe_add_func_uint32_t_u_u(p_50, (*g_434))))))), ((((safe_add_func_int16_t_s_s((p_54 , (safe_sub_func_int8_t_s_s(((l_583[4] = l_581[2]) != l_581[2]), p_52))), g_59[1])) | (*g_146)) & p_54) & (-6L)))))), g_408[2][6])), (-5L))))
+ { /* block id: 297 */
+ uint32_t l_603[3];
+ int32_t *l_617 = (void*)0;
+ int i;
+ for (i = 0; i < 3; i++)
+ l_603[i] = 0x9414E551L;
+ for (g_510 = 9; (g_510 >= 0); g_510 -= 1)
+ { /* block id: 300 */
+ const uint8_t l_602 = 0UL;
+ uint8_t l_604 = 255UL;
+ int32_t l_605 = (-1L);
+ for (l_560 = 0; (l_560 <= 9); l_560 += 1)
+ { /* block id: 303 */
+ int i;
+ l_605 = (((((((((safe_div_func_uint8_t_u_u((safe_sub_func_uint16_t_u_u(p_50, ((*g_146) && (l_603[2] ^= ((((((((p_53 , (safe_mod_func_uint32_t_u_u((&l_541 == (void*)0), (+((p_54 || ((safe_lshift_func_int8_t_s_u((safe_add_func_uint32_t_u_u((g_69[5] | ((*l_547) = 0x37L)), (safe_rshift_func_uint16_t_u_u((safe_rshift_func_int16_t_s_s((((safe_mod_func_uint8_t_u_u((safe_div_func_int8_t_s_s((((!((((4294967287UL > p_53) | g_59[1]) & 8UL) <= 0L)) ^ p_54) == p_53), p_52)), p_54)) | p_54) && (-1L)), 9)), g_138[3])))), g_2)) ^ 255UL)) >= l_602))))) & (*g_146)) > (*g_146)) , g_436) && 0xCBL) == p_50) == (-2L)) >= 65533UL))))), (-10L))) & g_60[0][4][3]) , l_602) || l_603[2]) || l_603[2]) >= l_604) > g_360) >= g_436) >= g_36);
+ (*g_146) = ((0x1D37402DL || (*g_514)) , ((*g_514) = p_54));
+ (*g_514) = (*g_514);
+ }
+ (*p_51) = (*p_51);
+ }
+ if (p_50)
+ { /* block id: 313 */
+ return (*g_434);
+ }
+ else
+ { /* block id: 315 */
+ uint32_t l_608 = 0x2C838B9FL;
+ uint8_t l_612 = 0xA6L;
+ for (l_546 = 22; (l_546 <= 12); l_546 = safe_sub_func_int8_t_s_s(l_546, 8))
+ { /* block id: 318 */
+ uint8_t l_609 = 0UL;
+ if (l_608)
+ break;
+ --l_609;
+ }
+ p_52 |= l_608;
+ (*g_514) ^= l_612;
+ for (l_559 = 0; (l_559 < (-28)); l_559 = safe_sub_func_uint16_t_u_u(l_559, 7))
+ { /* block id: 326 */
+ (*g_146) &= l_615;
+ (*g_514) &= (p_52 , l_616);
+ if (l_603[2])
+ continue;
+ (*p_51) = l_617;
+ }
+ }
+ if ((*g_514))
+ break;
+ }
+ else
+ { /* block id: 334 */
+ uint32_t l_637 = 0UL;
+ uint32_t l_657 = 0x8AE57ECFL;
+ (*g_146) &= (&g_436 == (void*)0);
+ for (g_131 = 0; (g_131 < 17); g_131 = safe_add_func_uint32_t_u_u(g_131, 4))
+ { /* block id: 338 */
+ uint32_t l_623 = 0x5CA092ADL;
+ for (l_554 = (-7); (l_554 == (-20)); l_554--)
+ { /* block id: 341 */
+ int16_t l_622 = 0L;
+ l_623++;
+ if ((*g_146))
+ continue;
+ }
+ for (l_559 = 0; (l_559 <= 8); l_559 += 1)
+ { /* block id: 347 */
+ const int32_t *l_632 = &g_61;
+ int32_t *l_634[7];
+ int32_t **** const l_636 = &l_583[4];
+ int i;
+ for (i = 0; i < 7; i++)
+ l_634[i] = (void*)0;
+ l_638 |= (((safe_div_func_int32_t_s_s((((safe_sub_func_uint32_t_u_u((safe_mul_func_int16_t_s_s((g_59[l_559] <= ((*l_567) = ((*l_576) &= (l_632 != ((l_633 &= (*g_146)) , l_634[4]))))), 7UL)), (*g_434))) , ((g_124 , l_635[4]) , l_636)) != l_582[7][0]), (*g_434))) == 0x07D52D4DL) > l_637);
+ p_52 &= 0xA782E568L;
+ }
+ }
+ for (l_616 = 0; (l_616 == 29); ++l_616)
+ { /* block id: 357 */
+ uint32_t l_653 = 18446744073709551615UL;
+ int32_t *l_654[7][5] = {{&l_546,(void*)0,&l_557,&g_61,&l_555},{&g_60[0][0][2],(void*)0,&l_558,&l_559,&g_59[1]},{(void*)0,&l_559,&l_556,&g_60[1][0][2],&g_60[1][0][2]},{&g_60[0][0][2],&l_557,&g_60[0][0][2],&l_556,&l_551},{&l_546,&l_557,&g_59[1],(void*)0,(void*)0},{(void*)0,&l_559,&g_60[1][0][2],&l_558,&l_546},{&l_555,(void*)0,&g_59[1],(void*)0,&l_555}};
+ uint8_t *l_655 = &g_31[0];
+ uint8_t ***l_660 = (void*)0;
+ uint8_t ***l_661 = &g_658[3];
+ int i, j;
+ p_52 = (((*l_661) = ((safe_div_func_uint32_t_u_u((l_657 = ((*g_434) = (((*g_514) = (l_637 | 0UL)) || (safe_mul_func_int16_t_s_s((g_408[4][2] ^ p_53), (safe_mod_func_uint32_t_u_u(((safe_mul_func_int8_t_s_s((!(safe_sub_func_uint8_t_u_u(g_415, (((*l_655) = ((safe_mul_func_uint16_t_u_u(((0xE3L != ((((0UL & ((l_653 ^ (((*g_434) & (*g_514)) , 0xDF15A246L)) ^ 0x1573C95DL)) > 0L) , l_654[2][0]) != (void*)0)) , 0x53B7L), p_53)) >= 0xAB7CL)) & g_59[7])))), 248UL)) , p_53), l_656))))))), l_637)) , g_658[3])) != (void*)0);
+ (*p_51) = (*p_51);
+ if (p_53)
+ continue;
+ for (l_553 = (-15); (l_553 < 21); l_553++)
+ { /* block id: 368 */
+ (*g_514) = ((*g_146) |= (*g_514));
+ l_664--;
+ return (*g_434);
+ }
+ }
+ }
+ for (g_145 = 24; (g_145 != 26); ++g_145)
+ { /* block id: 378 */
+ int32_t l_671 = (-3L);
+ for (p_50 = 1; (p_50 <= 5); p_50 += 1)
+ { /* block id: 381 */
+ int16_t *l_682[10] = {&g_124,&g_124,&g_124,&g_124,&g_124,&g_124,&g_124,&g_124,&g_124,&g_124};
+ int32_t l_683 = 6L;
+ uint8_t *l_696[3][10] = {{&g_131,&g_131,&l_560,&g_31[0],&g_31[0],&g_31[0],&l_560,&g_131,&g_131,&l_560},{&l_560,&g_31[0],&g_31[0],&g_31[0],&g_31[0],&l_560,&l_560,&l_560,&g_31[0],&g_31[0]},{&g_31[0],&g_131,&g_31[0],&g_31[0],&l_560,&g_131,&l_560,&g_31[0],&g_31[0],&g_31[0]}};
+ int32_t l_705 = 0x94593FD2L;
+ int i, j;
+ if ((*g_514))
+ break;
+ (*g_514) = ((((+(safe_add_func_uint8_t_u_u(p_50, l_671))) , ((((g_408[2][6] , (safe_div_func_uint16_t_u_u(0UL, ((((safe_rshift_func_int8_t_s_u(((safe_rshift_func_uint8_t_u_s((2L > (((((safe_rshift_func_int8_t_s_s((((safe_div_func_uint16_t_u_u(p_53, (l_683 = g_124))) && (safe_mod_func_uint16_t_u_u((safe_mul_func_int8_t_s_s((safe_lshift_func_uint16_t_u_u((safe_lshift_func_int16_t_s_u((safe_sub_func_uint8_t_u_u((safe_add_func_int8_t_s_s(((p_52 > (++p_54)) > ((safe_sub_func_int8_t_s_s((((safe_mul_func_uint16_t_u_u((safe_lshift_func_int16_t_s_u((&g_659 == &l_696[1][4]), p_52)), 0x415CL)) , (void*)0) != &l_560), (-1L))) , g_126)), p_52)), 0x83L)), 9)), 1)), p_50)), g_415))) == 4L), p_50)) , (-1L)) , 4294967289UL) >= (*g_434)) & 0x9D18L)), l_671)) > p_53), 7)) == 0x15L) != l_705) || (*g_434))))) >= l_671) & p_50) | g_61)) != p_50) == p_50);
+ if (l_671)
+ break;
+ }
+ }
+ }
+ else
+ { /* block id: 389 */
+ uint16_t **l_711 = (void*)0;
+ int32_t l_714 = (-2L);
+ int32_t l_718[1][4];
+ int32_t l_733 = (-1L);
+ const int16_t *l_768 = &g_124;
+ int i, j;
+ for (i = 0; i < 1; i++)
+ {
+ for (j = 0; j < 4; j++)
+ l_718[i][j] = 0xE11A78C6L;
+ }
+ for (l_556 = 0; (l_556 >= (-25)); --l_556)
+ { /* block id: 392 */
+ uint8_t l_708 = 254UL;
+ for (g_510 = 0; (g_510 <= 4); g_510 += 1)
+ { /* block id: 395 */
+ int i;
+ if (l_708)
+ break;
+ (*g_514) = l_708;
+ }
+ l_718[0][1] &= (l_708 >= (((g_126 < (l_709 == (g_712 = l_711))) && (((*g_434) = (l_714 != (safe_unary_minus_func_int32_t_s(((*g_514) = (((*g_514) >= (safe_mod_func_int16_t_s_s(g_59[1], g_60[0][0][1]))) != ((((p_53 < (*g_434)) ^ p_50) >= 0xE6L) == 0x38L))))))) , p_50)) == (*g_146)));
+ if (l_718[0][1])
+ break;
+ if ((*g_146))
+ break;
+ }
+ for (l_558 = 25; (l_558 != 20); l_558 = safe_sub_func_uint32_t_u_u(l_558, 9))
+ { /* block id: 408 */
+ int8_t ***l_725 = &g_435;
+ int32_t l_738 = 9L;
+ uint32_t l_746 = 1UL;
+ if ((*g_146))
+ { /* block id: 409 */
+ uint32_t l_745[5] = {0UL,0UL,0UL,0UL,0UL};
+ int i;
+ for (l_664 = 3; (l_664 <= 9); l_664 += 1)
+ { /* block id: 412 */
+ int8_t ***l_726 = &g_435;
+ int32_t l_727[7][7][5] = {{{1L,1L,(-8L),0L,0xAC6AC439L},{0xE288136EL,0x1BA38A8AL,1L,(-1L),(-1L)},{1L,0xB996CF60L,0xBC9EBEC7L,0L,0xBC9EBEC7L},{0x1BA38A8AL,0x1BA38A8AL,0L,0x47413CE9L,(-1L)},{0xB996CF60L,1L,0xBC9EBEC7L,0xA7A60C50L,0xAC6AC439L},{0x1BA38A8AL,0xE288136EL,1L,0x47413CE9L,1L},{1L,1L,(-8L),0L,0xAC6AC439L}},{{0xE288136EL,0x1BA38A8AL,1L,(-1L),(-1L)},{1L,0xB996CF60L,0xBC9EBEC7L,0L,0xBC9EBEC7L},{0x1BA38A8AL,0x1BA38A8AL,0L,0x47413CE9L,(-1L)},{0xB996CF60L,1L,0xBC9EBEC7L,0xA7A60C50L,0xAC6AC439L},{0x1BA38A8AL,0xE288136EL,1L,0x47413CE9L,1L},{1L,1L,(-8L),0L,0xAC6AC439L},{0xE288136EL,0x1BA38A8AL,1L,(-1L),(-1L)}},{{1L,0xB996CF60L,0xBC9EBEC7L,0L,0xBC9EBEC7L},{0x1BA38A8AL,0x1BA38A8AL,0L,0x47413CE9L,(-1L)},{0xB996CF60L,1L,0xBC9EBEC7L,0xA7A60C50L,0xAC6AC439L},{0x1BA38A8AL,0xE288136EL,1L,0x47413CE9L,1L},{1L,1L,(-8L),0L,0xAC6AC439L},{0xE288136EL,0x1BA38A8AL,1L,(-1L),(-1L)},{1L,0xB996CF60L,0xBC9EBEC7L,0L,0xBC9EBEC7L}},{{0x1BA38A8AL,0x1BA38A8AL,0L,0x47413CE9L,(-1L)},{0xB996CF60L,1L,0xBC9EBEC7L,0xA7A60C50L,0xAC6AC439L},{0x1BA38A8AL,0xE288136EL,1L,0x47413CE9L,1L},{1L,1L,(-8L),0L,0xAC6AC439L},{0xE288136EL,0x1BA38A8AL,1L,(-1L),(-1L)},{1L,0xB996CF60L,0xBC9EBEC7L,0L,0xBC9EBEC7L},{0x1BA38A8AL,0x1BA38A8AL,0L,0x47413CE9L,(-1L)}},{{0xB996CF60L,1L,0xBC9EBEC7L,0xA7A60C50L,0xAC6AC439L},{0x1BA38A8AL,0xE288136EL,1L,0x47413CE9L,1L},{1L,1L,(-8L),0L,0xAC6AC439L},{0xE288136EL,0x1BA38A8AL,1L,(-1L),(-1L)},{1L,0xB996CF60L,0xBC9EBEC7L,0L,0xBC9EBEC7L},{0x1BA38A8AL,0x1BA38A8AL,0L,0x47413CE9L,(-1L)},{0xB996CF60L,1L,0xBC9EBEC7L,0xA7A60C50L,0xAC6AC439L}},{{0x1BA38A8AL,0xE288136EL,1L,0x47413CE9L,1L},{0xBC9EBEC7L,0xBC9EBEC7L,0xBF005C69L,1L,2L},{0L,1L,0L,1L,0L},{0xBC9EBEC7L,(-8L),0L,1L,0L},{1L,1L,0x29987E69L,(-2L),0L},{(-8L),0xBC9EBEC7L,0L,0xAA4F085EL,2L},{1L,0L,0L,(-2L),0L}},{{0xBC9EBEC7L,0xBC9EBEC7L,0xBF005C69L,1L,2L},{0L,1L,0L,1L,0L},{0xBC9EBEC7L,(-8L),0L,1L,0L},{1L,1L,0x29987E69L,(-2L),0L},{(-8L),0xBC9EBEC7L,0L,0xAA4F085EL,2L},{1L,0L,0L,(-2L),0L},{0xBC9EBEC7L,0xBC9EBEC7L,0xBF005C69L,1L,2L}}};
+ uint8_t **l_732 = &g_659;
+ uint8_t *l_736 = &g_31[0];
+ int16_t *l_737[7][10][3] = {{{&g_124,(void*)0,&l_734},{(void*)0,&g_124,(void*)0},{&g_124,&g_124,&l_734},{&g_124,&g_124,&l_734},{&g_124,&g_124,&l_734},{&g_124,&g_124,&l_734},{&l_734,(void*)0,(void*)0},{&g_124,(void*)0,&l_734},{&g_124,&g_124,&g_124},{&g_124,&l_734,&g_124}},{{(void*)0,(void*)0,&g_124},{&l_734,&g_124,(void*)0},{&l_734,&l_734,(void*)0},{&g_124,&l_734,&l_734},{&l_734,&g_124,&g_124},{&l_734,&l_734,&g_124},{(void*)0,(void*)0,&g_124},{&g_124,&g_124,(void*)0},{&g_124,&l_734,(void*)0},{&g_124,&l_734,&g_124}},{{&l_734,(void*)0,&l_734},{&g_124,&l_734,&g_124},{&g_124,&l_734,&g_124},{&g_124,(void*)0,&g_124},{&g_124,&l_734,(void*)0},{(void*)0,&l_734,&g_124},{&g_124,&g_124,&g_124},{(void*)0,(void*)0,&g_124},{&l_734,&l_734,&g_124},{&l_734,&g_124,&g_124}},{{&g_124,&l_734,&l_734},{&g_124,&l_734,&g_124},{&g_124,&g_124,&g_124},{&g_124,(void*)0,&g_124},{&g_124,&l_734,&g_124},{&l_734,&g_124,&g_124},{&l_734,(void*)0,(void*)0},{&l_734,(void*)0,&g_124},{(void*)0,&g_124,&g_124},{&g_124,&g_124,&g_124}},{{&g_124,&g_124,&l_734},{(void*)0,&g_124,&g_124},{&g_124,&g_124,&l_734},{&g_124,(void*)0,&g_124},{&l_734,&l_734,&l_734},{&g_124,(void*)0,&g_124},{(void*)0,(void*)0,&g_124},{&g_124,&l_734,&g_124},{&l_734,(void*)0,&g_124},{(void*)0,&l_734,(void*)0}},{{&l_734,(void*)0,&l_734},{&l_734,(void*)0,&g_124},{&l_734,&l_734,&l_734},{&l_734,(void*)0,&g_124},{&l_734,&g_124,(void*)0},{&g_124,&g_124,&l_734},{&l_734,&l_734,&l_734},{&l_734,&g_124,&l_734},{&g_124,&g_124,&l_734},{(void*)0,&g_124,(void*)0}},{{&l_734,&g_124,&g_124},{(void*)0,&g_124,&l_734},{&g_124,&g_124,&g_124},{&g_124,&l_734,&l_734},{&g_124,&g_124,(void*)0},{&g_124,&l_734,&g_124},{&l_734,&l_734,&g_124},{&g_124,&l_734,&g_124},{&g_124,(void*)0,&g_124},{&g_124,&l_734,&l_734}}};
+ int i, j, k;
+ (*p_51) = &l_718[0][1];
+ l_635[l_664] |= (safe_sub_func_int8_t_s_s(((+(*g_713)) <= (safe_rshift_func_uint16_t_u_s(((**p_51) ^ (l_725 == l_726)), (((*l_547) = p_53) != l_727[4][5][3])))), ((*l_736) = (safe_lshift_func_uint8_t_u_u(((p_54 ^ (safe_mod_func_uint16_t_u_u((((0x77L > (((*l_732) = ((l_718[0][3] , p_52) , (void*)0)) == &p_54)) || l_733) > l_727[4][5][3]), 0x2525L))) <= l_734), l_735)))));
+ l_746 ^= ((*g_146) = ((l_718[0][1] = 0x564EL) , ((l_738 || ((**l_709) |= 0xC3CCL)) < (safe_sub_func_uint16_t_u_u(p_50, (safe_add_func_uint16_t_u_u(((safe_add_func_int8_t_s_s(((*l_547) = p_53), (l_718[0][3] || ((l_745[0] < (((*g_454) = (*g_454)) != (void*)0)) & p_50)))) & l_745[3]), g_61)))))));
+ (**p_51) &= (0x54A292B6L > (p_54 & (g_358 , ((*l_736) = (~(safe_mul_func_uint16_t_u_u(p_50, 9UL)))))));
+ }
+ (*g_146) |= (safe_add_func_int32_t_s_s(((safe_add_func_int16_t_s_s(((void*)0 != &g_2), p_53)) | (safe_div_func_int16_t_s_s((safe_lshift_func_int8_t_s_u((p_54 , ((0x7874L == (safe_div_func_int16_t_s_s((((((p_50 >= ((safe_unary_minus_func_int16_t_s((safe_lshift_func_int8_t_s_u(((*l_547) = g_2), 5)))) | ((l_714 = (((safe_mod_func_int32_t_s_s((safe_add_func_int8_t_s_s(p_50, p_53)), (*g_514))) ^ 0UL) || p_54)) | 4294967295UL))) ^ (-1L)) != l_745[3]) , (*g_434)) , 0xF7FBL), 1L))) >= 1UL)), 6)), 0x7B0EL))), l_738));
+ }
+ else
+ { /* block id: 430 */
+ for (l_559 = 0; (l_559 < 25); l_559++)
+ { /* block id: 433 */
+ (*g_146) ^= ((g_126 , &l_734) != l_768);
+ (*p_51) = (*p_51);
+ }
+ }
+ for (p_54 = 0; (p_54 <= 24); p_54 = safe_add_func_int16_t_s_s(p_54, 4))
+ { /* block id: 440 */
+ uint16_t l_773[8][2] = {{0x9B95L,0x9F13L},{0xE64DL,0x9F13L},{0x9B95L,0x9F13L},{0xE64DL,0x9F13L},{0x9B95L,0x9F13L},{0xE64DL,0x9F13L},{0x9B95L,0x9F13L},{0xE64DL,0x9F13L}};
+ int i, j;
+ for (l_664 = 0; (l_664 >= 19); l_664 = safe_add_func_int16_t_s_s(l_664, 1))
+ { /* block id: 443 */
+ (*g_146) |= l_718[0][1];
+ }
+ (*g_146) = l_773[3][0];
+ }
+ }
+ }
+ }
+ return p_54;
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_36 g_69 g_37 p_24 l_3153
+ * writes: g_36 g_59 g_60 g_61 g_69 g_37 p_24 l_3153
+ */
+static uint32_t func_57(int16_t p_58)
+{ /* block id: 15 */
+ int32_t *l_62 = &g_59[1];
+ int32_t l_67 = 3L;
+ int32_t l_91 = 0xC7F14991L;
+ int32_t l_92[8][8] = {{1L,0x1594A516L,6L,6L,0x1594A516L,1L,0x1594A516L,6L},{0x03B84D85L,0x1594A516L,0x03B84D85L,1L,1L,0x03B84D85L,0x1594A516L,0x03B84D85L},{0xC4F7295DL,1L,6L,1L,0xC4F7295DL,0xC4F7295DL,1L,6L},{0xC4F7295DL,0xC4F7295DL,1L,6L,1L,0xC4F7295DL,0xC4F7295DL,1L},{0x03B84D85L,1L,1L,0x03B84D85L,0x1594A516L,0x03B84D85L,1L,1L},{1L,0x1594A516L,6L,6L,0x1594A516L,1L,0x1594A516L,6L},{0x03B84D85L,0x1594A516L,0x03B84D85L,1L,1L,0x03B84D85L,0x1594A516L,0x03B84D85L},{0xC4F7295DL,1L,6L,1L,0xC4F7295DL,0xC4F7295DL,1L,6L}};
+ int32_t l_94 = (-7L);
+ uint8_t l_95 = 0x96L;
+ int32_t **l_100 = (void*)0;
+ uint8_t *l_177 = &g_31[0];
+ const int32_t l_181 = 0xD7EB5230L;
+ uint16_t l_218 = 0x8B7BL;
+ int8_t l_219 = 0xA8L;
+ const uint8_t l_274 = 3UL;
+ int32_t **l_302 = &g_37;
+ uint8_t l_356 = 1UL;
+ const int8_t l_406 = 1L;
+ int32_t *l_438[5] = {&l_94,&l_94,&l_94,&l_94,&l_94};
+ uint16_t *l_457 = &l_218;
+ const int8_t *l_484[6] = {&l_406,&l_406,&l_406,&l_406,&l_406,&l_406};
+ const int8_t **l_483 = &l_484[2];
+ uint8_t l_492 = 0x16L;
+ int32_t l_513 = 0L;
+ uint32_t l_523 = 0x8A4C21B0L;
+ int i, j;
+ for (g_36 = 0; (g_36 <= 0); g_36 += 1)
+ { /* block id: 18 */
+ int32_t l_68 = 2L;
+ int32_t l_89 = 0x7EEACC20L;
+ int32_t l_93 = (-5L);
+ for (p_58 = 0; (p_58 <= 0); p_58 += 1)
+ { /* block id: 21 */
+ uint8_t l_72 = 255UL;
+ int32_t l_87 = 0x6EE5324EL;
+ int32_t l_88 = (-2L);
+ int32_t l_90 = 2L;
+ int32_t **l_98 = &g_37;
+ int32_t ***l_99[1][3];
+ int i, j;
+ for (i = 0; i < 1; i++)
+ {
+ for (j = 0; j < 3; j++)
+ l_99[i][j] = &l_98;
+ }
+ for (g_59[1] = 0; (g_59[1] <= 0); g_59[1] += 1)
+ { /* block id: 24 */
+ int8_t l_65 = 0xA8L;
+ int32_t l_66[10] = {0L,0L,0x855F075FL,0L,0L,0x855F075FL,0L,0L,0x855F075FL,0L};
+ int i;
+ for (g_60[0][4][3] = 0; (g_60[0][4][3] <= 0); g_60[0][4][3] += 1)
+ { /* block id: 27 */
+ int32_t *l_64[7];
+ int i;
+ for (i = 0; i < 7; i++)
+ l_64[i] = &g_61;
+ for (g_61 = 0; (g_61 >= 0); g_61 -= 1)
+ { /* block id: 30 */
+ int32_t **l_63 = &l_62;
+ (*l_63) = l_62;
+ }
+ ++g_69[6];
+ }
+ ++l_72;
+ for (l_68 = 0; (l_68 <= 0); l_68 += 1)
+ { /* block id: 38 */
+ int32_t *l_79 = &l_67;
+ int32_t *l_80 = &g_61;
+ int32_t *l_81 = &g_60[0][4][3];
+ int32_t *l_82 = &l_66[5];
+ int32_t *l_83 = (void*)0;
+ int32_t *l_84 = &l_67;
+ int32_t *l_85 = &g_60[0][4][3];
+ int32_t *l_86[2];
+ int i;
+ for (i = 0; i < 2; i++)
+ l_86[i] = &g_61;
+ (*l_79) |= (safe_sub_func_int32_t_s_s((safe_sub_func_int8_t_s_s(0xBDL, g_36)), ((*g_37) ^= ((p_58 > p_58) >= g_36))));
+ (*l_79) = 9L;
+ ++l_95;
+ }
+ }
+ l_100 = l_98;
+ for (l_94 = 0; (l_94 >= 0); l_94 -= 1)
+ { /* block id: 48 */
+ for (l_67 = 0; (l_67 <= 0); l_67 += 1)
+ { /* block id: 51 */
+ for (g_61 = 0; (g_61 <= 7); g_61 += 1)
+ { /* block id: 54 */
+ int i, j;
+ (*l_100) = &l_92[(l_94 + 3)][(g_36 + 5)];
+ }
+ }
+ if (p_58)
+ break;
+ }
+ }
+ }
+ for (l_95 = 0; (l_95 < 13); l_95 = safe_add_func_int8_t_s_s(l_95, 6))
+ { /* block id: 64 */
+ const int32_t l_122 = 0xE33F915BL;
+ int32_t * const l_132 = &g_60[0][4][3];
+ int32_t *l_133[9][4][6] = {{{(void*)0,&g_36,(void*)0,&l_92[2][7],(void*)0,&g_59[0]},{&g_36,&g_59[0],(void*)0,&l_92[6][7],&l_92[6][7],(void*)0},{&l_92[2][7],&l_92[2][7],&g_60[1][2][2],&l_92[6][7],&g_59[0],(void*)0},{&g_36,&g_60[1][2][2],&l_92[4][2],(void*)0,&l_92[4][2],&g_60[1][2][2]}},{{&l_92[6][7],&g_36,&l_92[4][2],(void*)0,&l_92[2][7],(void*)0},{(void*)0,(void*)0,&g_60[1][2][2],&g_60[1][2][2],(void*)0,(void*)0},{&g_60[1][2][2],(void*)0,(void*)0,&g_60[0][0][1],&l_92[2][7],&l_92[4][2]},{&l_92[4][2],&g_36,&l_92[6][7],&g_36,&l_92[4][2],(void*)0}},{{&l_92[4][2],&g_60[1][2][2],&g_36,&g_60[0][0][1],&g_59[0],&g_59[0]},{&g_60[1][2][2],&l_92[2][7],&l_92[2][7],&g_60[1][2][2],&l_92[6][7],&g_59[0]},{(void*)0,&g_59[0],&g_36,(void*)0,&g_60[0][0][1],(void*)0},{&l_92[6][7],(void*)0,&l_92[6][7],(void*)0,&g_60[0][0][1],&l_92[4][2]}},{{&g_36,&g_59[0],(void*)0,&l_92[6][7],&l_92[6][7],(void*)0},{&l_92[2][7],&l_92[2][7],&g_60[1][2][2],&l_92[6][7],&g_59[0],(void*)0},{&g_36,&g_60[1][2][2],&l_92[4][2],(void*)0,&l_92[4][2],&g_60[1][2][2]},{&l_92[6][7],&g_36,&l_92[4][2],(void*)0,&l_92[2][7],(void*)0}},{{(void*)0,(void*)0,&g_60[1][2][2],&g_60[1][2][2],(void*)0,(void*)0},{&g_60[1][2][2],(void*)0,(void*)0,&g_60[0][0][1],&l_92[2][7],&l_92[4][2]},{&l_92[4][2],&g_36,&l_92[6][7],&g_36,&l_92[4][2],(void*)0},{&l_92[4][2],&g_60[1][2][2],&g_36,&g_60[0][0][1],&g_59[0],&g_59[0]}},{{&g_60[1][2][2],&l_92[2][7],&l_92[2][7],&g_60[1][2][2],&l_92[6][7],&g_59[0]},{(void*)0,&g_59[0],&g_36,(void*)0,&g_60[0][0][1],(void*)0},{&l_92[6][7],(void*)0,&l_92[6][7],(void*)0,&g_60[0][0][1],&l_92[4][2]},{&g_36,&g_59[0],(void*)0,&l_92[6][7],&l_92[6][7],(void*)0}},{{&l_92[2][7],&l_92[2][7],&g_60[1][2][2],&l_92[6][7],&g_59[0],(void*)0},{&g_36,&g_60[1][2][2],&l_92[4][2],(void*)0,&l_92[4][2],&g_60[1][2][2]},{&l_92[6][7],&g_36,&l_92[4][2],(void*)0,&l_92[2][7],(void*)0},{(void*)0,(void*)0,&g_60[1][2][2],&g_60[1][2][2],(void*)0,(void*)0}},{{&g_60[1][2][2],(void*)0,(void*)0,&g_60[0][0][1],&l_92[2][7],&l_92[4][2]},{&l_92[4][2],&g_36,&l_92[6][7],&g_36,&l_92[4][2],(void*)0},{&l_92[4][2],&g_60[1][2][2],&g_36,&g_60[0][0][1],&g_59[0],&g_59[0]},{&g_60[1][2][2],&l_92[2][7],&l_92[2][7],&g_60[1][2][2],&l_92[6][7],&g_59[0]}},{{(void*)0,&g_59[0],&g_36,(void*)0,&g_59[0],&g_60[1][2][2]},{(void*)0,&g_60[0][0][1],(void*)0,&g_36,&g_59[0],(void*)0},{(void*)0,&l_92[4][2],&l_92[6][7],(void*)0,(void*)0,&l_92[6][7]},{(void*)0,(void*)0,&l_92[2][7],(void*)0,&l_92[4][2],&g_36}}};
+ int8_t *l_175[1][4];
+ int16_t l_217 = 0x3422L;
+ uint16_t *l_255 = &g_69[6];
+ int32_t * const **l_303[1];
+ uint32_t *l_407 = &g_408[2][6];
+ const int32_t *l_475 = (void*)0;
+ int8_t * const *l_511 = (void*)0;
+ int i, j, k;
+ for (i = 0; i < 1; i++)
+ {
+ for (j = 0; j < 4; j++)
+ l_175[i][j] = &g_126;
+ }
+ for (i = 0; i < 1; i++)
+ l_303[i] = (void*)0;
+ }
+ return p_58;
+}
+
+
+
+
+/* ---------------------------------------- */
+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);
+ for (i = 0; i < 1; i++)
+ {
+ transparent_crc(g_31[i], "g_31[i]", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ transparent_crc(g_36, "g_36", print_hash_value);
+ for (i = 0; i < 9; i++)
+ {
+ transparent_crc(g_59[i], "g_59[i]", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ for (i = 0; i < 2; i++)
+ {
+ for (j = 0; j < 5; j++)
+ {
+ for (k = 0; k < 4; k++)
+ {
+ transparent_crc(g_60[i][j][k], "g_60[i][j][k]", print_hash_value);
+ if (print_hash_value) printf("index = [%d][%d][%d]\n", i, j, k);
+
+ }
+ }
+ }
+ transparent_crc(g_61, "g_61", print_hash_value);
+ for (i = 0; i < 9; i++)
+ {
+ transparent_crc(g_69[i], "g_69[i]", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ transparent_crc(g_124, "g_124", print_hash_value);
+ transparent_crc(g_126, "g_126", print_hash_value);
+ transparent_crc(g_131, "g_131", print_hash_value);
+ for (i = 0; i < 4; i++)
+ {
+ transparent_crc(g_138[i], "g_138[i]", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ transparent_crc(g_145, "g_145", print_hash_value);
+ transparent_crc(g_358, "g_358", print_hash_value);
+ transparent_crc(g_360, "g_360", print_hash_value);
+ for (i = 0; i < 6; i++)
+ {
+ for (j = 0; j < 10; j++)
+ {
+ transparent_crc(g_408[i][j], "g_408[i][j]", print_hash_value);
+ if (print_hash_value) printf("index = [%d][%d]\n", i, j);
+
+ }
+ }
+ transparent_crc(g_415, "g_415", print_hash_value);
+ transparent_crc(g_436, "g_436", print_hash_value);
+ transparent_crc(g_510, "g_510", print_hash_value);
+ transparent_crc(g_775, "g_775", print_hash_value);
+ transparent_crc(g_961, "g_961", print_hash_value);
+ for (i = 0; i < 1; i++)
+ {
+ transparent_crc(g_1096[i], "g_1096[i]", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ transparent_crc(g_1202, "g_1202", print_hash_value);
+ transparent_crc(g_1250, "g_1250", print_hash_value);
+ transparent_crc(g_1312, "g_1312", print_hash_value);
+ transparent_crc(g_1484, "g_1484", print_hash_value);
+ transparent_crc(g_1509, "g_1509", print_hash_value);
+ for (i = 0; i < 6; i++)
+ {
+ for (j = 0; j < 9; j++)
+ {
+ for (k = 0; k < 3; k++)
+ {
+ transparent_crc(g_1758[i][j][k], "g_1758[i][j][k]", print_hash_value);
+ if (print_hash_value) printf("index = [%d][%d][%d]\n", i, j, k);
+
+ }
+ }
+ }
+ transparent_crc(g_1847, "g_1847", print_hash_value);
+ transparent_crc(g_1959, "g_1959", print_hash_value);
+ for (i = 0; i < 7; i++)
+ {
+ for (j = 0; j < 8; j++)
+ {
+ transparent_crc(g_2057[i][j], "g_2057[i][j]", print_hash_value);
+ if (print_hash_value) printf("index = [%d][%d]\n", i, j);
+
+ }
+ }
+ transparent_crc(g_2156, "g_2156", print_hash_value);
+ for (i = 0; i < 10; i++)
+ {
+ transparent_crc(g_2225[i], "g_2225[i]", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ transparent_crc(g_2234, "g_2234", print_hash_value);
+ transparent_crc(g_2236, "g_2236", print_hash_value);
+ transparent_crc(g_2239, "g_2239", print_hash_value);
+ for (i = 0; i < 3; i++)
+ {
+ for (j = 0; j < 3; j++)
+ {
+ transparent_crc(g_2387[i][j], "g_2387[i][j]", print_hash_value);
+ if (print_hash_value) printf("index = [%d][%d]\n", i, j);
+
+ }
+ }
+ transparent_crc(g_2451, "g_2451", print_hash_value);
+ transparent_crc(g_2907, "g_2907", print_hash_value);
+ transparent_crc(g_3051, "g_3051", print_hash_value);
+ for (i = 0; i < 10; i++)
+ {
+ transparent_crc(g_3207[i], "g_3207[i]", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ transparent_crc(g_3271, "g_3271", print_hash_value);
+ transparent_crc(g_3299, "g_3299", print_hash_value);
+ transparent_crc(g_3397, "g_3397", print_hash_value);
+ transparent_crc(g_3398, "g_3398", print_hash_value);
+ platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value);
+ return 0;
+}
+
+/************************ statistics *************************
+XXX max struct depth: 0
+breakdown:
+ depth: 0, occurrence: 805
+XXX total union variables: 0
+
+XXX non-zero bitfields defined in structs: 0
+XXX zero bitfields defined in structs: 0
+XXX const bitfields defined in structs: 0
+XXX volatile bitfields defined in structs: 0
+XXX structs with bitfields in the program: 0
+breakdown:
+XXX full-bitfields structs in the program: 0
+breakdown:
+XXX times a bitfields struct's address is taken: 0
+XXX times a bitfields struct on LHS: 0
+XXX times a bitfields struct on RHS: 0
+XXX times a single bitfield on LHS: 0
+XXX times a single bitfield on RHS: 0
+
+XXX max expression depth: 50
+breakdown:
+ depth: 1, occurrence: 386
+ depth: 2, occurrence: 129
+ depth: 3, occurrence: 4
+ depth: 4, occurrence: 6
+ depth: 5, occurrence: 3
+ depth: 6, occurrence: 2
+ depth: 8, occurrence: 1
+ depth: 9, occurrence: 1
+ depth: 14, occurrence: 2
+ depth: 15, occurrence: 2
+ depth: 16, occurrence: 2
+ depth: 17, occurrence: 5
+ depth: 18, occurrence: 6
+ depth: 19, occurrence: 4
+ depth: 20, occurrence: 5
+ depth: 21, occurrence: 5
+ depth: 22, occurrence: 2
+ depth: 23, occurrence: 6
+ depth: 24, occurrence: 1
+ depth: 25, occurrence: 5
+ depth: 26, occurrence: 4
+ depth: 27, occurrence: 3
+ depth: 28, occurrence: 3
+ depth: 30, occurrence: 3
+ depth: 31, occurrence: 6
+ depth: 32, occurrence: 1
+ depth: 35, occurrence: 2
+ depth: 36, occurrence: 2
+ depth: 38, occurrence: 2
+ depth: 39, occurrence: 1
+ depth: 40, occurrence: 1
+ depth: 42, occurrence: 2
+ depth: 43, occurrence: 1
+ depth: 46, occurrence: 1
+ depth: 47, occurrence: 1
+ depth: 50, occurrence: 1
+
+XXX total number of pointers: 604
+
+XXX times a variable address is taken: 1521
+XXX times a pointer is dereferenced on RHS: 568
+breakdown:
+ depth: 1, occurrence: 463
+ depth: 2, occurrence: 78
+ depth: 3, occurrence: 18
+ depth: 4, occurrence: 9
+XXX times a pointer is dereferenced on LHS: 494
+breakdown:
+ depth: 1, occurrence: 467
+ depth: 2, occurrence: 18
+ depth: 3, occurrence: 5
+ depth: 4, occurrence: 4
+XXX times a pointer is compared with null: 72
+XXX times a pointer is compared with address of another variable: 24
+XXX times a pointer is compared with another pointer: 23
+XXX times a pointer is qualified to be dereferenced: 11166
+
+XXX max dereference level: 6
+breakdown:
+ level: 0, occurrence: 0
+ level: 1, occurrence: 2371
+ level: 2, occurrence: 300
+ level: 3, occurrence: 264
+ level: 4, occurrence: 115
+ level: 5, occurrence: 8
+ level: 6, occurrence: 3
+XXX number of pointers point to pointers: 292
+XXX number of pointers point to scalars: 312
+XXX number of pointers point to structs: 0
+XXX percent of pointers has null in alias set: 29.3
+XXX average alias set size: 1.49
+
+XXX times a non-volatile is read: 3202
+XXX times a non-volatile is write: 1494
+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: 9
+
+XXX stmts: 414
+XXX max block depth: 5
+breakdown:
+ depth: 0, occurrence: 32
+ depth: 1, occurrence: 35
+ depth: 2, occurrence: 65
+ depth: 3, occurrence: 80
+ depth: 4, occurrence: 95
+ depth: 5, occurrence: 107
+
+XXX percentage a fresh-made variable is used: 14.8
+XXX percentage an existing variable is used: 85.2
+********************* end of statistics **********************/
+
diff --git a/tests/fuzz/14.c.txt b/tests/fuzz/14.c.txt
new file mode 100644
index 00000000..118ce7dd
--- /dev/null
+++ b/tests/fuzz/14.c.txt
@@ -0,0 +1 @@
+523D07B9
diff --git a/tests/fuzz/16.c b/tests/fuzz/16.c
new file mode 100644
index 00000000..187a6c64
--- /dev/null
+++ b/tests/fuzz/16.c
@@ -0,0 +1,1317 @@
+/*
+ * This is a RANDOMLY GENERATED PROGRAM.
+ *
+ * Generator: csmith 2.2.0
+ * Git version: bf42ffd
+ * Options: --no-volatiles --no-math64 --no-packed-struct
+ * Seed: 599346178
+ */
+
+#include "csmith.h"
+
+
+static long __undefined;
+
+/* --- Struct/Union Declarations --- */
+struct S0 {
+ signed f0 : 15;
+ unsigned f1 : 8;
+ unsigned f2 : 10;
+ unsigned f3 : 14;
+};
+
+struct S1 {
+ uint16_t f0;
+ uint16_t f1;
+};
+
+struct S2 {
+ signed f0 : 3;
+ unsigned f1 : 27;
+ unsigned f2 : 29;
+ const unsigned f3 : 5;
+ unsigned f4 : 31;
+ int32_t f5;
+ unsigned f6 : 24;
+ signed f7 : 15;
+ signed f8 : 15;
+};
+
+struct S3 {
+ const signed f0 : 30;
+ const signed f1 : 5;
+ unsigned f2 : 21;
+ signed f3 : 8;
+ unsigned f4 : 7;
+ unsigned f5 : 30;
+ unsigned f6 : 14;
+ signed f7 : 11;
+ const signed f8 : 14;
+ unsigned f9 : 26;
+};
+
+struct S4 {
+ struct S3 f0;
+ const signed f1 : 26;
+};
+
+struct S5 {
+ uint16_t f0;
+ uint16_t f1;
+ const struct S3 f2;
+ int32_t f3;
+};
+
+/* --- GLOBAL VARIABLES --- */
+static struct S1 g_22 = {0x9E5FL,0xF1BEL};
+static uint8_t g_23 = 0xDFL;
+static struct S1 g_43[8][10][3] = {{{{65530UL,1UL},{1UL,0xEB2EL},{0x7628L,1UL}},{{0x3094L,0xC7A5L},{0x2614L,65527UL},{0xCBE0L,0x4EC4L}},{{65530UL,1UL},{0UL,0x894BL},{65530UL,0xE41CL}},{{0xA3A0L,0xB06FL},{1UL,0x7DC5L},{7UL,65535UL}},{{65530UL,0x5790L},{0xEF29L,65535UL},{65530UL,1UL}},{{65535UL,65535UL},{0x4FDBL,65535UL},{65534UL,0xCDD4L}},{{65530UL,0xE41CL},{0xEF29L,65535UL},{4UL,0xDB38L}},{{0xC793L,0x51EAL},{1UL,0x7DC5L},{65535UL,2UL}},{{0x2801L,1UL},{0UL,0x894BL},{0xEBE4L,1UL}},{{7UL,65535UL},{0x2614L,65527UL},{0xED68L,0xD092L}}},{{{0xEBE4L,1UL},{1UL,0xEB2EL},{0xEBE4L,1UL}},{{0x9622L,0UL},{0UL,0xFB19L},{65535UL,2UL}},{{0x4927L,8UL},{0x1B31L,1UL},{4UL,0xDB38L}},{{0xCBE0L,0x4EC4L},{0x980DL,0x298BL},{65534UL,0xCDD4L}},{{0xCC22L,0xCDAAL},{0x64E9L,3UL},{65530UL,1UL}},{{0xCBE0L,0x4EC4L},{65535UL,2UL},{1UL,6UL}},{{65528UL,65532UL},{65530UL,1UL},{4UL,0x44EEL}},{{0xFCBCL,1UL},{65527UL,0x159EL},{1UL,0x5F07L}},{{0UL,0xE035L},{0x2801L,1UL},{0x7F1FL,1UL}},{{1UL,6UL},{65527UL,0x159EL},{0xF3A5L,0x7C9EL}}},{{{0xDF6EL,0x0FB7L},{65530UL,1UL},{0x6A5CL,5UL}},{{0xB7CFL,65535UL},{65535UL,2UL},{65526UL,0xC961L}},{{4UL,0x44EEL},{0xCC22L,0xCDAAL},{0UL,0x5C63L}},{{65526UL,0xC961L},{0x9622L,0UL},{65526UL,0xC961L}},{{0x9A5AL,0xFD0BL},{0x459FL,0x79DDL},{0x6A5CL,5UL}},{{0x6F24L,1UL},{0xBE1DL,0UL},{0xF3A5L,0x7C9EL}},{{0xB77DL,0xD86EL},{65530UL,0x5790L},{0x7F1FL,1UL}},{{0x2E96L,65531UL},{0x3094L,0xC7A5L},{1UL,0x5F07L}},{{0xB77DL,0xD86EL},{0x167AL,65530UL},{4UL,0x44EEL}},{{0x6F24L,1UL},{0xCBE0L,0x4EC4L},{1UL,6UL}}},{{{0x9A5AL,0xFD0BL},{4UL,0xDB38L},{0xB77DL,0xD86EL}},{{65526UL,0xC961L},{0xC793L,0x51EAL},{0x0DAEL,65535UL}},{{4UL,0x44EEL},{4UL,0xDB38L},{65533UL,0xBBCAL}},{{0xB7CFL,65535UL},{0xCBE0L,0x4EC4L},{65535UL,65535UL}},{{0xDF6EL,0x0FB7L},{0x167AL,65530UL},{0UL,0xE035L}},{{1UL,6UL},{0x3094L,0xC7A5L},{0UL,0xF9ADL}},{{0UL,0xE035L},{65530UL,0x5790L},{0UL,0xE035L}},{{0xFCBCL,1UL},{0xBE1DL,0UL},{65535UL,65535UL}},{{65528UL,65532UL},{0x459FL,0x79DDL},{65533UL,0xBBCAL}},{{1UL,0x5F07L},{0x9622L,0UL},{0x0DAEL,65535UL}}},{{{65530UL,9UL},{0xCC22L,0xCDAAL},{0xB77DL,0xD86EL}},{{1UL,0x5F07L},{65535UL,2UL},{1UL,6UL}},{{65528UL,65532UL},{65530UL,1UL},{4UL,0x44EEL}},{{0xFCBCL,1UL},{65527UL,0x159EL},{1UL,0x5F07L}},{{0UL,0xE035L},{0x2801L,1UL},{0x7F1FL,1UL}},{{1UL,6UL},{65527UL,0x159EL},{0xF3A5L,0x7C9EL}},{{0xDF6EL,0x0FB7L},{65530UL,1UL},{0x6A5CL,5UL}},{{0xB7CFL,65535UL},{65535UL,2UL},{65526UL,0xC961L}},{{4UL,0x44EEL},{0xCC22L,0xCDAAL},{0UL,0x5C63L}},{{65526UL,0xC961L},{0x9622L,0UL},{65526UL,0xC961L}}},{{{0x9A5AL,0xFD0BL},{0x459FL,0x79DDL},{0x6A5CL,5UL}},{{0x6F24L,1UL},{0xBE1DL,0UL},{0xF3A5L,0x7C9EL}},{{0xB77DL,0xD86EL},{65530UL,0x5790L},{0x7F1FL,1UL}},{{0x2E96L,65531UL},{0x3094L,0xC7A5L},{1UL,0x5F07L}},{{0xB77DL,0xD86EL},{0x167AL,65530UL},{4UL,0x44EEL}},{{0x6F24L,1UL},{0xCBE0L,0x4EC4L},{1UL,6UL}},{{0x9A5AL,0xFD0BL},{4UL,0xDB38L},{0xB77DL,0xD86EL}},{{65526UL,0xC961L},{0xC793L,0x51EAL},{0x0DAEL,65535UL}},{{4UL,0x44EEL},{4UL,0xDB38L},{65533UL,0xBBCAL}},{{0xB7CFL,65535UL},{0xCBE0L,0x4EC4L},{65535UL,65535UL}}},{{{0xDF6EL,0x0FB7L},{0x167AL,65530UL},{0UL,0xE035L}},{{1UL,6UL},{0x3094L,0xC7A5L},{0UL,0xF9ADL}},{{0UL,0xE035L},{65530UL,0x5790L},{0UL,0xE035L}},{{0xFCBCL,1UL},{0xBE1DL,0UL},{65535UL,65535UL}},{{65528UL,65532UL},{0x459FL,0x79DDL},{65533UL,0xBBCAL}},{{1UL,0x5F07L},{0x9622L,0UL},{0x0DAEL,65535UL}},{{65530UL,9UL},{0xCC22L,0xCDAAL},{0xB77DL,0xD86EL}},{{1UL,0x5F07L},{65535UL,2UL},{1UL,6UL}},{{65528UL,65532UL},{65530UL,1UL},{4UL,0x44EEL}},{{0xFCBCL,1UL},{65527UL,0x159EL},{1UL,0x5F07L}}},{{{0UL,0xE035L},{0x2801L,1UL},{0x7F1FL,1UL}},{{1UL,6UL},{65527UL,0x159EL},{0xF3A5L,0x7C9EL}},{{0xDF6EL,0x0FB7L},{65530UL,1UL},{0x6A5CL,5UL}},{{0xB7CFL,65535UL},{65535UL,2UL},{65526UL,0xC961L}},{{4UL,0x44EEL},{0xCC22L,0xCDAAL},{0UL,0x5C63L}},{{65526UL,0xC961L},{0x9622L,0UL},{65526UL,0xC961L}},{{0x9A5AL,0xFD0BL},{0x459FL,0x79DDL},{0x6A5CL,5UL}},{{0x6F24L,1UL},{0xBE1DL,0UL},{0xF3A5L,0x7C9EL}},{{0xB77DL,0xD86EL},{65530UL,0x5790L},{0x7F1FL,1UL}},{{0x4FDBL,65535UL},{0x2E96L,65531UL},{0x1FCFL,65528UL}}}};
+static struct S1 *g_42 = &g_43[6][6][2];
+static struct S5 g_69 = {1UL,0x0ACFL,{8641,1,66,-9,5,16167,108,18,97,2292},-1L};
+static struct S5 *g_76 = (void*)0;
+static struct S5 **g_75 = &g_76;
+static int32_t g_84 = 1L;
+static uint32_t g_85 = 0xA7E1DD48L;
+static uint8_t g_94 = 0xAFL;
+static int16_t g_109 = 0x89DBL;
+static struct S3 g_111 = {25828,3,536,-9,6,32740,94,43,-66,805};
+static struct S3 g_113 = {19961,-2,968,11,6,26254,93,-34,-102,7793};
+static struct S3 *g_112 = &g_113;
+static uint32_t g_131 = 4294967295UL;
+static struct S4 g_138 = {{-26187,-2,1070,5,2,15692,110,-5,66,322},7315};
+static int32_t *g_151[9] = {(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0};
+static struct S0 g_153 = {-53,3,7,82};
+static struct S3 g_182 = {-615,-4,889,-1,1,13978,113,20,74,1261};
+static int32_t g_214 = (-10L);
+static int8_t g_253 = 0xD8L;
+static const int8_t *g_252 = &g_253;
+static int16_t g_274 = 0xB1F5L;
+static uint32_t *g_346[10][3][5] = {{{&g_131,&g_131,&g_131,&g_131,(void*)0},{&g_131,&g_131,&g_131,&g_131,&g_131},{&g_131,&g_131,&g_131,&g_131,&g_131}},{{&g_131,&g_131,&g_131,&g_131,&g_131},{(void*)0,&g_131,&g_131,&g_131,&g_131},{&g_131,&g_131,&g_131,&g_131,&g_131}},{{&g_131,&g_131,&g_131,&g_131,&g_131},{&g_131,(void*)0,(void*)0,&g_131,&g_131},{(void*)0,&g_131,&g_131,&g_131,(void*)0}},{{&g_131,&g_131,&g_131,(void*)0,&g_131},{&g_131,&g_131,&g_131,&g_131,&g_131},{&g_131,&g_131,&g_131,&g_131,&g_131}},{{&g_131,&g_131,&g_131,&g_131,(void*)0},{&g_131,&g_131,(void*)0,&g_131,&g_131},{&g_131,&g_131,&g_131,&g_131,&g_131}},{{&g_131,&g_131,(void*)0,&g_131,&g_131},{(void*)0,&g_131,&g_131,&g_131,&g_131},{&g_131,&g_131,&g_131,&g_131,&g_131}},{{&g_131,&g_131,&g_131,&g_131,&g_131},{&g_131,(void*)0,&g_131,&g_131,&g_131},{(void*)0,&g_131,&g_131,&g_131,(void*)0}},{{&g_131,&g_131,(void*)0,(void*)0,&g_131},{&g_131,&g_131,&g_131,&g_131,&g_131},{&g_131,&g_131,&g_131,&g_131,&g_131}},{{&g_131,&g_131,&g_131,&g_131,(void*)0},{&g_131,&g_131,&g_131,&g_131,&g_131},{&g_131,&g_131,&g_131,&g_131,&g_131}},{{&g_131,&g_131,&g_131,&g_131,&g_131},{(void*)0,&g_131,&g_131,&g_131,&g_131},{&g_131,&g_131,&g_131,&g_131,&g_131}}};
+static uint32_t **g_345 = &g_346[0][2][2];
+static struct S2 g_349 = {-0,10399,13744,1,23366,0x73A13C76L,2460,-117,-63};
+static struct S2 *g_348 = &g_349;
+static struct S3 *g_352 = (void*)0;
+static struct S3 *g_355 = (void*)0;
+static struct S3 g_357 = {21505,3,625,-0,1,22557,91,-24,91,4258};
+static struct S3 *g_356 = &g_357;
+static uint32_t **g_401 = (void*)0;
+static uint32_t g_494[4] = {0xF410F1BCL,0xF410F1BCL,0xF410F1BCL,0xF410F1BCL};
+static struct S4 g_518[8] = {{{-7073,-1,1273,-8,2,4384,85,5,12,2244},-5776},{{-7073,-1,1273,-8,2,4384,85,5,12,2244},-5776},{{-7073,-1,1273,-8,2,4384,85,5,12,2244},-5776},{{-7073,-1,1273,-8,2,4384,85,5,12,2244},-5776},{{-7073,-1,1273,-8,2,4384,85,5,12,2244},-5776},{{-7073,-1,1273,-8,2,4384,85,5,12,2244},-5776},{{-7073,-1,1273,-8,2,4384,85,5,12,2244},-5776},{{-7073,-1,1273,-8,2,4384,85,5,12,2244},-5776}};
+static struct S4 *g_517 = &g_518[1];
+static struct S4 g_521[5][2][4] = {{{{{11267,4,50,0,0,23117,4,21,-42,449},-4258},{{11267,4,50,0,0,23117,4,21,-42,449},-4258},{{9750,-2,1241,6,5,3993,72,-4,66,4292},-6475},{{-32497,-1,427,1,10,16937,126,28,46,2174},3226}},{{{-17361,-1,25,8,3,23008,28,17,26,6153},2330},{{9750,-2,1241,6,5,3993,72,-4,66,4292},-6475},{{-22579,4,416,8,10,18216,1,12,11,5405},-4220},{{26283,3,971,4,9,10669,69,-23,-39,3125},6498}}},{{{{16235,0,21,-9,0,24889,42,-32,104,5527},-1564},{{16645,-0,330,-13,7,14218,38,36,88,1244},-5752},{{11050,-0,1023,-12,5,13403,121,-44,-26,7622},-3567},{{-22579,4,416,8,10,18216,1,12,11,5405},-4220}},{{{-22579,4,416,8,10,18216,1,12,11,5405},-4220},{{16645,-0,330,-13,7,14218,38,36,88,1244},-5752},{{11267,4,50,0,0,23117,4,21,-42,449},-4258},{{26283,3,971,4,9,10669,69,-23,-39,3125},6498}}},{{{{-27039,0,1347,9,7,17637,27,0,-93,8164},-4957},{{21599,1,11,15,10,12835,80,-43,-115,622},1327},{{-27039,0,1347,9,7,17637,27,0,-93,8164},-4957},{{30649,1,566,-14,4,26449,55,-3,38,555},-4627}},{{{-2727,2,211,13,7,2544,112,-36,83,238},-7275},{{-22579,4,416,8,10,18216,1,12,11,5405},-4220},{{11050,-0,1023,-12,5,13403,121,-44,-26,7622},-3567},{{16645,-0,330,-13,7,14218,38,36,88,1244},-5752}}},{{{{-17361,-1,25,8,3,23008,28,17,26,6153},2330},{{-2727,2,211,13,7,2544,112,-36,83,238},-7275},{{30649,1,566,-14,4,26449,55,-3,38,555},-4627},{{-22579,4,416,8,10,18216,1,12,11,5405},-4220}},{{{18460,-2,1432,5,10,14352,80,32,86,7371},4860},{{-10379,4,1045,-7,10,6983,94,-28,-104,1529},2147},{{30649,1,566,-14,4,26449,55,-3,38,555},-4627},{{16235,0,21,-9,0,24889,42,-32,104,5527},-1564}}},{{{{-17361,-1,25,8,3,23008,28,17,26,6153},2330},{{11050,-0,1023,-12,5,13403,121,-44,-26,7622},-3567},{{11050,-0,1023,-12,5,13403,121,-44,-26,7622},-3567},{{-17361,-1,25,8,3,23008,28,17,26,6153},2330}},{{{-2727,2,211,13,7,2544,112,-36,83,238},-7275},{{18460,-2,1432,5,10,14352,80,32,86,7371},4860},{{-27039,0,1347,9,7,17637,27,0,-93,8164},-4957},{{11267,4,50,0,0,23117,4,21,-42,449},-4258}}}};
+static uint16_t g_599 = 0x3677L;
+static int32_t g_601[2][3] = {{(-3L),(-3L),(-3L)},{(-3L),(-3L),(-3L)}};
+static uint8_t g_745 = 0x79L;
+static struct S0 *g_750 = (void*)0;
+static struct S0 **g_749 = &g_750;
+static const int32_t g_763 = 0x2FF78294L;
+static const int32_t *g_762 = &g_763;
+static int8_t g_798 = 9L;
+static int8_t g_809 = 7L;
+static struct S4 g_903 = {{1711,1,1044,15,3,21405,47,3,-94,3477},1019};
+static uint16_t g_922[6] = {0xC1F3L,0xC1F3L,0xC1F3L,0xC1F3L,0xC1F3L,0xC1F3L};
+static const struct S4 g_1001 = {{-16006,-3,1349,8,5,30049,50,-3,125,3359},4405};
+static struct S5 g_1017 = {0x37CCL,0x3778L,{-20731,-3,745,-15,3,27561,18,-35,-28,3640},0x8265F5ECL};
+
+
+/* --- FORWARD DECLARATIONS --- */
+static int32_t func_1(void);
+static struct S1 func_2(struct S1 p_3, struct S4 p_4, struct S3 p_5, const struct S3 p_6, struct S5 p_7);
+static struct S1 func_8(uint32_t p_9, struct S0 p_10);
+static uint32_t func_11(const struct S2 p_12, const struct S5 p_13, uint8_t p_14, uint8_t p_15, struct S0 p_16);
+static const struct S2 func_17(struct S1 p_18, int32_t p_19);
+static uint32_t func_26(uint8_t p_27, uint8_t p_28, struct S1 * p_29, struct S1 * p_30, const struct S1 * p_31);
+static struct S0 func_47(struct S0 p_48, struct S1 * p_49, const uint16_t p_50, struct S2 p_51);
+static struct S0 func_52(struct S0 p_53, struct S1 * p_54, struct S1 * p_55, struct S1 * p_56, struct S1 p_57);
+static struct S0 func_58(int16_t p_59, int32_t p_60, struct S1 * p_61, uint16_t p_62, struct S1 * p_63);
+static struct S1 * func_64(struct S1 * const p_65, struct S1 * p_66, struct S1 * p_67);
+
+
+/* --- FUNCTIONS --- */
+/* ------------------------------------------ */
+/*
+ * reads : g_23 g_42 g_43.f0 g_75 g_94 g_85 g_69.f2.f7 g_84 g_69.f1 g_131 g_138 g_111.f5 g_111.f6 g_111.f3 g_153 g_113.f9 g_69.f2.f3 g_69.f2.f2 g_69.f2.f0 g_111.f1 g_43 g_113.f8 g_214 g_113.f3 g_252 g_253 g_69.f0 g_109 g_182.f9 g_113.f0 g_69.f3 g_345 g_113.f6 g_348 g_182.f0 g_113.f5 g_349.f0 g_111.f4 g_346 g_357.f9 g_111.f7 g_349 g_69.f2.f4 g_494 g_517 g_518 g_182.f8 g_274 g_599 g_69 g_1017 g_601 g_762 g_763 g_903.f0.f7 g_903.f0 g_22.f1 g_22.f0
+ * writes: g_22 g_43 g_69.f0 g_84 g_85 g_69.f1 g_94 g_109 g_112 g_131 g_151 g_214 g_274 g_348 g_352 g_355 g_356 g_345 g_401 g_253 g_76 g_349.f5 g_494 g_517 g_599 g_69.f3 g_153
+ */
+static int32_t func_1(void)
+{ /* block id: 0 */
+ struct S1 l_20[8] = {{0x097EL,0UL},{0x097EL,0UL},{1UL,1UL},{0x097EL,0UL},{0x097EL,0UL},{1UL,1UL},{0x097EL,0UL},{0x097EL,0UL}};
+ struct S1 *l_21[4] = {(void*)0,(void*)0,(void*)0,(void*)0};
+ const struct S5 l_25 = {65529UL,6UL,{15351,-3,1209,-9,2,27860,14,-8,-117,4412},4L};
+ struct S0 l_1069 = {-51,6,31,68};
+ struct S4 l_1075[1] = {{{-2640,-0,453,-5,8,18251,94,17,-33,5958},-3807}};
+ int i;
+ (*g_42) = func_2(((*g_42) = func_8((func_11(func_17((g_22 = l_20[5]), g_23), l_25, (func_26(g_23, ((safe_rshift_func_uint16_t_u_u((safe_lshift_func_int16_t_s_u(0xBB1EL, (((safe_rshift_func_uint16_t_u_s((safe_mod_func_uint8_t_u_u(l_25.f2.f6, (safe_add_func_uint8_t_u_u(l_25.f2.f0, (l_25.f2.f4 < g_23))))), g_23)) , g_23) , 6UL))), l_25.f2.f9)) | g_23), g_42, &g_43[3][5][0], &l_20[1]) >= 0UL), g_903.f0.f7, l_1069) >= 4294967295UL), l_1069)), l_1075[0], g_903.f0, g_1017.f2, g_1017);
+ return l_25.f2.f9;
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_84 g_22.f1 g_94 g_22.f0 g_494 g_42 g_43
+ * writes: g_84 g_22.f1 g_94 g_22.f0
+ */
+static struct S1 func_2(struct S1 p_3, struct S4 p_4, struct S3 p_5, const struct S3 p_6, struct S5 p_7)
+{ /* block id: 578 */
+ const int8_t **l_1080 = &g_252;
+ for (g_84 = 8; (g_84 != (-5)); g_84 = safe_sub_func_int8_t_s_s(g_84, 7))
+ { /* block id: 581 */
+ for (g_22.f1 = 0; (g_22.f1 <= 22); g_22.f1 = safe_add_func_uint32_t_u_u(g_22.f1, 1))
+ { /* block id: 584 */
+ for (g_94 = 0; (g_94 <= 2); g_94 += 1)
+ { /* block id: 587 */
+ for (g_22.f0 = 2; (g_22.f0 <= 8); g_22.f0 += 1)
+ { /* block id: 590 */
+ int i;
+ if (g_494[(g_94 + 1)])
+ break;
+ }
+ for (p_3.f1 = 0; (p_3.f1 <= 2); p_3.f1 += 1)
+ { /* block id: 595 */
+ int i;
+ if (g_494[p_3.f1])
+ break;
+ }
+ return (*g_42);
+ }
+ return p_3;
+ }
+ }
+ l_1080 = l_1080;
+ return (*g_42);
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads :
+ * writes: g_84
+ */
+static struct S1 func_8(uint32_t p_9, struct S0 p_10)
+{ /* block id: 574 */
+ uint16_t l_1072 = 0xD8F4L;
+ int32_t *l_1073 = &g_84;
+ struct S1 l_1074 = {1UL,1UL};
+ (*l_1073) = (safe_lshift_func_uint16_t_u_u(l_1072, 8));
+ return l_1074;
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads :
+ * writes:
+ */
+static uint32_t func_11(const struct S2 p_12, const struct S5 p_13, uint8_t p_14, uint8_t p_15, struct S0 p_16)
+{ /* block id: 572 */
+ return p_12.f0;
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads :
+ * writes:
+ */
+static const struct S2 func_17(struct S1 p_18, int32_t p_19)
+{ /* block id: 2 */
+ const struct S2 l_24 = {0,9374,5952,0,29241,1L,2915,-142,113};
+ return l_24;
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_42 g_43.f0 g_75 g_94 g_85 g_69.f2.f7 g_84 g_23 g_69.f1 g_131 g_138 g_111.f5 g_111.f6 g_111.f3 g_153 g_113.f9 g_69.f2.f3 g_69.f2.f2 g_69.f2.f0 g_111.f1 g_43 g_113.f8 g_214 g_113.f3 g_252 g_253 g_69.f0 g_109 g_182.f9 g_113.f0 g_69.f3 g_345 g_113.f6 g_348 g_182.f0 g_113.f5 g_349.f0 g_111.f4 g_346 g_357.f9 g_111.f7 g_349 g_69.f2.f4 g_494 g_517 g_518 g_182.f8 g_274 g_599 g_69 g_1017 g_601 g_762 g_763
+ * writes: g_43 g_69.f0 g_84 g_85 g_69.f1 g_94 g_109 g_112 g_131 g_151 g_214 g_274 g_348 g_352 g_355 g_356 g_345 g_401 g_253 g_76 g_349.f5 g_494 g_517 g_599 g_69.f3 g_153
+ */
+static uint32_t func_26(uint8_t p_27, uint8_t p_28, struct S1 * p_29, struct S1 * p_30, const struct S1 * p_31)
+{ /* block id: 4 */
+ struct S1 l_46[5] = {{0UL,0xDF2DL},{0UL,0xDF2DL},{0UL,0xDF2DL},{0UL,0xDF2DL},{0UL,0xDF2DL}};
+ struct S5 **l_74 = (void*)0;
+ struct S1 *l_226 = &l_46[1];
+ struct S2 l_656 = {1,4806,1292,0,44121,0x66CCED79L,1233,93,31};
+ struct S0 l_659[3][5] = {{{51,2,31,109},{29,0,5,118},{-168,3,28,54},{-168,3,28,54},{29,0,5,118}},{{-179,5,22,23},{85,9,13,127},{-168,3,28,54},{126,4,25,11},{126,4,25,11}},{{85,9,13,127},{-179,5,22,23},{85,9,13,127},{-168,3,28,54},{126,4,25,11}}};
+ int32_t *l_660 = (void*)0;
+ int32_t **l_661 = (void*)0;
+ int32_t **l_662 = &l_660;
+ struct S4 l_726 = {{23764,4,181,9,6,19678,94,29,2,2307},-943};
+ uint32_t * const *l_784[2];
+ uint32_t * const **l_783[10];
+ uint32_t l_805 = 4294967295UL;
+ uint8_t *l_819[3];
+ int32_t l_904 = 0x227435A8L;
+ int32_t l_905 = 0x908C76C9L;
+ int32_t l_907 = 0L;
+ int32_t l_908[5][10][2] = {{{4L,0xDBBACBE8L},{0x1EB7CE3BL,6L},{6L,(-1L)},{0x373DBA5FL,0xDBBACBE8L},{9L,0xE060BC82L},{0xB21D5BCAL,0x1EB7CE3BL},{0xA2DA418AL,0xB21D5BCAL},{0L,0x5DAABF8FL},{0xF99A1A17L,(-1L)},{0xA2DA418AL,0x373DBA5FL}},{{(-1L),0xE060BC82L},{4L,1L},{0x373DBA5FL,6L},{(-1L),6L},{0x373DBA5FL,1L},{4L,0xE060BC82L},{(-1L),0x373DBA5FL},{0xA2DA418AL,(-1L)},{0xF99A1A17L,0x5DAABF8FL},{0L,0xB21D5BCAL}},{{0xA2DA418AL,0x1EB7CE3BL},{0xB21D5BCAL,0xE060BC82L},{9L,0xDBBACBE8L},{0x373DBA5FL,(-1L)},{6L,6L},{0x1EB7CE3BL,0xDBBACBE8L},{4L,3L},{0xB21D5BCAL,0x373DBA5FL},{0L,0xB21D5BCAL},{0xF99A1A17L,0xF88AD893L}},{{0xF99A1A17L,0xB21D5BCAL},{0L,0x373DBA5FL},{0xB21D5BCAL,3L},{4L,0xDBBACBE8L},{0x1EB7CE3BL,6L},{6L,(-1L)},{0x373DBA5FL,0xDBBACBE8L},{9L,0xE060BC82L},{0xB21D5BCAL,0x1EB7CE3BL},{0xA2DA418AL,0xB21D5BCAL}},{{0L,0x5DAABF8FL},{0xF99A1A17L,(-1L)},{0xA2DA418AL,0x373DBA5FL},{(-1L),0xE060BC82L},{4L,1L},{0x373DBA5FL,6L},{(-1L),6L},{0x373DBA5FL,1L},{4L,0xE060BC82L},{(-1L),0x373DBA5FL}}};
+ int32_t l_919 = 0x8475D920L;
+ uint8_t l_945 = 0x96L;
+ struct S3 *l_962 = (void*)0;
+ const int32_t *l_995 = &l_905;
+ struct S0 **l_1045 = &g_750;
+ uint32_t l_1063 = 0xC92B0175L;
+ int32_t *l_1068 = &g_214;
+ int i, j, k;
+ for (i = 0; i < 2; i++)
+ l_784[i] = &g_346[0][2][2];
+ for (i = 0; i < 10; i++)
+ l_783[i] = &l_784[1];
+ for (i = 0; i < 3; i++)
+ l_819[i] = &g_745;
+ for (p_28 = 0; (p_28 < 43); p_28 = safe_add_func_int32_t_s_s(p_28, 4))
+ { /* block id: 7 */
+ uint16_t *l_81 = (void*)0;
+ struct S1 *l_82[6][2][3] = {{{&l_46[3],&g_43[4][7][2],&l_46[3]},{(void*)0,&g_43[4][7][2],&l_46[1]}},{{&g_43[0][8][0],&g_43[4][7][2],&g_43[4][7][2]},{&l_46[3],&g_43[4][7][2],&l_46[3]}},{{(void*)0,&g_43[4][7][2],&l_46[1]},{&g_43[0][8][0],&g_43[4][7][2],&g_43[4][7][2]}},{{&l_46[3],&g_43[4][7][2],&l_46[3]},{(void*)0,&g_43[3][2][2],&l_46[1]}},{{&g_43[4][7][2],&g_43[3][2][2],&g_43[3][2][2]},{&l_46[1],&g_43[3][2][2],(void*)0}},{{&l_46[3],&g_43[3][2][2],&l_46[1]},{&g_43[4][7][2],&g_43[3][2][2],&g_43[3][2][2]}}};
+ const int32_t l_655 = 0L;
+ struct S0 *l_658[6] = {(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0};
+ int i, j, k;
+ (*g_42) = l_46[1];
+ g_153 = (l_659[2][4] = func_47(func_52(func_58(l_46[1].f1, g_43[6][6][2].f0, func_64(p_29, &g_43[0][2][1], p_30), (g_69.f0 = (safe_add_func_int16_t_s_s((l_74 != g_75), (safe_mul_func_uint8_t_u_u((safe_add_func_uint16_t_u_u((p_27 != p_27), 0xC976L)), 0xA7L))))), l_82[4][0][2]), p_30, &g_43[6][6][2], l_226, (*g_42)), g_42, l_655, l_656));
+ }
+ (*l_662) = l_660;
+ for (g_349.f5 = 0; (g_349.f5 > (-23)); g_349.f5 = safe_sub_func_uint8_t_u_u(g_349.f5, 8))
+ { /* block id: 352 */
+ int32_t l_688 = 0x3816D0D3L;
+ int32_t l_713 = 0L;
+ int32_t l_716[9][8][3] = {{{0x3BCCE3A3L,0xFE70B519L,1L},{0x3CD82101L,0L,(-1L)},{0x7C325AC9L,(-7L),(-8L)},{0xC7B04A55L,0x4A0176CCL,1L},{0xFE70B519L,0x0DD4E228L,0x0DD4E228L},{0x5542C803L,0xF31E4DAEL,0xBF445B9AL},{0x0F15FBADL,(-9L),0xCE133DEBL},{(-1L),(-1L),0x3BBD2679L}},{{0xBF445B9AL,0x6C83F1EEL,(-8L)},{0x6CAF9D30L,(-1L),0x04ADB9DFL},{1L,(-9L),0xD0FFF10AL},{8L,0xF31E4DAEL,0L},{0L,0x0DD4E228L,9L},{0x9B75BFF6L,0x4A0176CCL,0xD9072743L},{(-10L),(-7L),(-1L)},{0xF742CD06L,0L,0x5542C803L}},{{0x6A7C68C7L,0xFE70B519L,2L},{0L,0xBF445B9AL,0xF742CD06L},{1L,0L,0xC7B04A55L},{0x20F5AD6DL,0x7C325AC9L,8L},{0x3BBD2679L,0xF8CFA606L,(-8L)},{0x46A37A33L,0x827C1ED6L,0L},{0xBD005C73L,0xB6E969FCL,0xE3047B84L},{0x5DD129CFL,(-5L),1L}},{{0xCE133DEBL,0x9DB6C7FFL,0xE3277720L},{0L,1L,0xB6E969FCL},{2L,0x3BBD2679L,0xB6E969FCL},{0xF8CFA606L,0x04ADB9DFL,0xE3277720L},{(-9L),0x3BCCE3A3L,1L},{0xF00157DCL,1L,0xE3047B84L},{1L,0xEDBC2C95L,0L},{8L,0xE3047B84L,(-8L)}},{{(-8L),0xCE133DEBL,8L},{(-6L),0L,0xC7B04A55L},{0x827C1ED6L,0L,0xF742CD06L},{0L,0x8430A39AL,2L},{0x1D9E6B75L,0x745CECD1L,0x5542C803L},{(-5L),0x5542C803L,(-1L)},{(-1L),0x57658509L,0xD9072743L},{0x24009C27L,(-1L),9L}},{{0L,1L,0L},{1L,0xD7884624L,0xD0FFF10AL},{0xB3DD4A61L,1L,0x04ADB9DFL},{0xBAF9344DL,1L,(-8L)},{4L,(-8L),0x3BBD2679L},{0xBAF9344DL,0L,0xCE133DEBL},{0xB3DD4A61L,(-7L),0xBF445B9AL},{1L,0L,0x0DD4E228L}},{{0L,(-1L),1L},{0x24009C27L,0xF730B445L,(-8L)},{(-1L),0x20F5AD6DL,(-1L)},{(-5L),0x9B8547DBL,1L},{0x1D9E6B75L,0x6CAF9D30L,0x9DB6C7FFL},{0L,0x3CD82101L,0xB6095228L},{0x827C1ED6L,(-6L),0x4F266C63L},{(-6L),4L,1L}},{{(-8L),9L,0xEDBC2C95L},{0x6A7C68C7L,0L,0xE3277720L},{8L,(-8L),1L},{(-7L),(-10L),(-1L)},{(-10L),0L,1L},{0x6CAF9D30L,0x6C83F1EEL,0xC7B04A55L},{0x4F266C63L,0x6C83F1EEL,0x3BBD2679L},{0x5DD129CFL,0L,0xC92C255AL}},{{0x7C325AC9L,(-10L),0x3E2BF1D1L},{0L,(-8L),(-1L)},{(-1L),0L,1L},{(-7L),0x9B8547DBL,2L},{(-6L),0x9DB6C7FFL,0L},{0x4A0176CCL,0xEDBC2C95L,0xB5E31D23L},{0xF730B445L,2L,0xF31E4DAEL},{0x1B78B7DEL,0L,0x3CD82101L}}};
+ int32_t *l_731[10] = {&g_84,&g_84,&g_84,&g_84,&g_84,&g_84,&g_84,&g_84,&g_84,&g_84};
+ int32_t l_748 = 0xB46690BEL;
+ const struct S0 l_787 = {-75,4,1,63};
+ struct S1 *l_812[4];
+ const uint32_t *l_817 = &g_494[1];
+ const uint32_t **l_816[10];
+ struct S4 l_821 = {{22752,2,1164,1,7,29048,25,-24,82,6268},-1323};
+ int8_t l_834 = 0xB9L;
+ int16_t *l_849 = &g_274;
+ int16_t **l_848 = &l_849;
+ int16_t *** const l_847[9] = {&l_848,&l_848,&l_848,&l_848,&l_848,&l_848,&l_848,&l_848,&l_848};
+ struct S4 *l_902 = &g_903;
+ struct S5 l_938[6] = {{1UL,2UL,{-12957,3,1222,8,1,6685,24,-39,-99,7802},1L},{0x099DL,0x20E4L,{-1296,3,899,-1,9,6177,108,3,14,1101},-1L},{1UL,2UL,{-12957,3,1222,8,1,6685,24,-39,-99,7802},1L},{1UL,2UL,{-12957,3,1222,8,1,6685,24,-39,-99,7802},1L},{0x099DL,0x20E4L,{-1296,3,899,-1,9,6177,108,3,14,1101},-1L},{1UL,2UL,{-12957,3,1222,8,1,6685,24,-39,-99,7802},1L}};
+ int32_t l_1023 = 0x8D8FD03DL;
+ uint32_t l_1058 = 0x051FCD20L;
+ uint32_t ***l_1060 = &g_345;
+ uint32_t ****l_1059 = &l_1060;
+ uint16_t *l_1066 = &l_46[1].f0;
+ uint16_t *l_1067 = &g_43[6][6][2].f0;
+ int i, j, k;
+ for (i = 0; i < 4; i++)
+ l_812[i] = &g_43[5][3][2];
+ for (i = 0; i < 10; i++)
+ l_816[i] = &l_817;
+ for (g_94 = 0; (g_94 > 18); ++g_94)
+ { /* block id: 355 */
+ uint16_t l_669 = 8UL;
+ for (g_69.f1 = 0; (g_69.f1 < 46); g_69.f1 = safe_add_func_int8_t_s_s(g_69.f1, 2))
+ { /* block id: 358 */
+ uint32_t l_670 = 0xA45EC3F1L;
+ for (g_253 = 0; (g_253 <= 2); g_253 += 1)
+ { /* block id: 361 */
+ int i, j, k;
+ l_669 = p_27;
+ (*l_662) = (g_151[(g_253 + 3)] = g_346[(g_253 + 7)][g_253][g_253]);
+ return p_27;
+ }
+ ++l_670;
+ }
+ }
+ if (p_27)
+ break;
+ for (p_27 = (-2); (p_27 <= 11); ++p_27)
+ { /* block id: 373 */
+ struct S1 l_677 = {4UL,1UL};
+ uint16_t *l_678 = &l_46[1].f0;
+ uint16_t *l_679 = &l_46[1].f1;
+ int32_t l_686 = 3L;
+ int32_t l_687 = 0x1F991E30L;
+ int32_t l_712 = (-3L);
+ int32_t l_715 = (-7L);
+ int32_t l_717 = 1L;
+ int32_t l_718 = 0L;
+ int32_t l_719 = 5L;
+ int32_t l_720 = 0L;
+ int32_t l_722 = (-1L);
+ uint32_t l_723 = 18446744073709551607UL;
+ struct S4 l_794[9] = {{{-24595,-1,930,-9,8,18801,42,8,-108,1131},820},{{-22623,-3,856,14,10,3217,36,-26,-92,2350},-7770},{{-24595,-1,930,-9,8,18801,42,8,-108,1131},820},{{-22623,-3,856,14,10,3217,36,-26,-92,2350},-7770},{{-24595,-1,930,-9,8,18801,42,8,-108,1131},820},{{-22623,-3,856,14,10,3217,36,-26,-92,2350},-7770},{{-24595,-1,930,-9,8,18801,42,8,-108,1131},820},{{-22623,-3,856,14,10,3217,36,-26,-92,2350},-7770},{{-24595,-1,930,-9,8,18801,42,8,-108,1131},820}};
+ struct S0 l_815[4][10] = {{{-124,2,22,31},{-88,15,5,17},{-27,11,7,35},{57,6,26,49},{57,6,26,49},{-27,11,7,35},{-88,15,5,17},{-124,2,22,31},{-124,2,22,31},{-88,15,5,17}},{{-124,2,22,31},{57,6,26,49},{-88,15,5,17},{-88,15,5,17},{57,6,26,49},{-124,2,22,31},{-27,11,7,35},{-27,11,7,35},{-124,2,22,31},{57,6,26,49}},{{57,6,26,49},{-88,15,5,17},{-88,15,5,17},{57,6,26,49},{-124,2,22,31},{-27,11,7,35},{-27,11,7,35},{-124,2,22,31},{57,6,26,49},{-88,15,5,17}},{{57,6,26,49},{57,6,26,49},{-27,11,7,35},{-88,15,5,17},{-124,2,22,31},{-124,2,22,31},{-88,15,5,17},{-27,11,7,35},{57,6,26,49},{57,6,26,49}}};
+ const struct S0 *l_857 = &l_815[2][5];
+ int32_t l_906 = 0x6DAA9DF0L;
+ int32_t l_914 = 0xEF2044C3L;
+ int32_t l_915 = (-1L);
+ int32_t l_916 = 0xB33D429DL;
+ int32_t l_920 = 0xCD43F33BL;
+ int32_t l_921[6][5][7] = {{{(-1L),0x91634774L,0x68746CC2L,5L,5L,0x68746CC2L,0x91634774L},{0x171B7552L,0L,(-1L),0xCDAAB82EL,0x171B7552L,0xCDAAB82EL,(-1L)},{5L,9L,0x68746CC2L,0x64AF7050L,(-1L),(-1L),0x64AF7050L},{0x88DB7A49L,0xD9E1FA8EL,0x88DB7A49L,0xCDAAB82EL,0x45C4CF09L,0xD9E1FA8EL,0x45C4CF09L},{9L,0x64AF7050L,0x91634774L,5L,(-1L),0x28F9752DL,0x28F9752DL}},{{0x171B7552L,(-7L),0x4C84DF75L,(-7L),0x171B7552L,0xD9E1FA8EL,0x4C84DF75L},{1L,9L,0x64AF7050L,0x91634774L,5L,(-1L),0x28F9752DL},{0x45C4CF09L,0xCDAAB82EL,0x88DB7A49L,0xD9E1FA8EL,0x88DB7A49L,0xCDAAB82EL,0x45C4CF09L},{1L,0x91634774L,0x28F9752DL,5L,9L,0x68746CC2L,0x64AF7050L},{0x171B7552L,0xCDAAB82EL,(-1L),0L,0x171B7552L,0L,(-1L)}},{{9L,9L,0x28F9752DL,0x64AF7050L,1L,(-1L),0x91634774L},{0x88DB7A49L,(-7L),0x88DB7A49L,0L,0x45C4CF09L,(-7L),0x45C4CF09L},{5L,0x64AF7050L,0x64AF7050L,5L,1L,0x28F9752DL,0x68746CC2L},{0x171B7552L,0xD9E1FA8EL,0x4C84DF75L,0xD9E1FA8EL,0x171B7552L,(-7L),0x4C84DF75L},{(-1L),9L,0x91634774L,0x91634774L,9L,(-1L),0x68746CC2L}},{{0x45C4CF09L,0L,0x88DB7A49L,(-7L),0x88DB7A49L,0L,0x45C4CF09L},{(-1L),0x91634774L,0x68746CC2L,5L,5L,0x68746CC2L,0x91634774L},{0x171B7552L,0L,(-1L),0xCDAAB82EL,0x171B7552L,0xCDAAB82EL,(-1L)},{5L,9L,0x68746CC2L,0x64AF7050L,(-1L),(-1L),0x64AF7050L},{0x88DB7A49L,0xD9E1FA8EL,0x88DB7A49L,0xCDAAB82EL,0x45C4CF09L,0xD9E1FA8EL,0x45C4CF09L}},{{9L,0x64AF7050L,0x91634774L,5L,(-1L),0x28F9752DL,0x28F9752DL},{0x171B7552L,(-7L),0x4C84DF75L,(-7L),0x171B7552L,0xD9E1FA8EL,0x4C84DF75L},{1L,9L,0x64AF7050L,0x91634774L,5L,(-1L),0x28F9752DL},{0x45C4CF09L,0xCDAAB82EL,0x88DB7A49L,0xD9E1FA8EL,0x88DB7A49L,0xCDAAB82EL,0x45C4CF09L},{1L,0x91634774L,0x28F9752DL,5L,9L,0x68746CC2L,0x64AF7050L}},{{0x171B7552L,0xCDAAB82EL,(-1L),0L,0x171B7552L,0L,(-1L)},{9L,9L,0x28F9752DL,0x64AF7050L,1L,(-1L),0x91634774L},{0x88DB7A49L,(-7L),0x88DB7A49L,0L,0x45C4CF09L,(-7L),0x45C4CF09L},{5L,0x64AF7050L,0x64AF7050L,5L,1L,0x28F9752DL,0x68746CC2L},{0x171B7552L,0xD9E1FA8EL,0x4C84DF75L,0xD9E1FA8EL,0x171B7552L,(-7L),0x4C84DF75L}}};
+ int8_t l_937 = 1L;
+ int32_t l_946 = 0xF1A2D0D4L;
+ struct S1 l_975 = {0x427BL,65527UL};
+ const struct S3 l_984 = {-14746,-2,662,-4,10,30454,114,16,-56,7335};
+ uint32_t l_994 = 7UL;
+ const int32_t *l_1029 = &l_946;
+ int i, j, k;
+ }
+ l_908[1][1][1] ^= (+(safe_div_func_uint32_t_u_u(((g_1017 , ((*l_1067) = (((safe_lshift_func_uint16_t_u_u((safe_lshift_func_uint8_t_u_u((g_94 |= (safe_add_func_int32_t_s_s(p_28, (safe_mod_func_uint8_t_u_u((l_1058 = g_182.f8), ((((*l_1059) = &g_345) != &g_345) && ((-10L) <= (((safe_mod_func_uint16_t_u_u(((*l_1066) = (l_1063 != (safe_mod_func_uint16_t_u_u(((*g_252) >= p_27), g_138.f0.f4)))), g_109)) != (*g_252)) <= 6L)))))))), p_27)), g_601[0][2])) | 0UL) <= (*l_995)))) | (*l_995)), p_27)));
+ }
+ (*l_1068) &= ((p_28 < (1L & (*g_762))) , p_28);
+ return p_27;
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads :
+ * writes:
+ */
+static struct S0 func_47(struct S0 p_48, struct S1 * p_49, const uint16_t p_50, struct S2 p_51)
+{ /* block id: 343 */
+ struct S3 *l_657 = &g_138.f0;
+ l_657 = l_657;
+ return p_48;
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_94 g_113.f8 g_214 g_113.f3 g_252 g_253 g_69.f0 g_109 g_182.f9 g_113.f0 g_69.f3 g_153 g_345 g_113.f6 g_69.f2.f3 g_138.f0.f2 g_348 g_69.f1 g_84 g_182.f0 g_75 g_113.f5 g_349.f0 g_111.f4 g_42 g_43 g_346 g_357.f9 g_349.f5 g_111.f6 g_111.f7 g_111.f5 g_138 g_349 g_113.f9 g_69.f2.f4 g_85 g_494 g_517 g_518 g_182.f8 g_274 g_131 g_599 g_69
+ * writes: g_214 g_94 g_69.f0 g_109 g_43.f1 g_274 g_348 g_112 g_352 g_355 g_356 g_84 g_151 g_345 g_401 g_253 g_76 g_349.f5 g_43 g_494 g_517 g_85 g_131 g_599 g_69.f3
+ */
+static struct S0 func_52(struct S0 p_53, struct S1 * p_54, struct S1 * p_55, struct S1 * p_56, struct S1 p_57)
+{ /* block id: 101 */
+ uint8_t l_227 = 3UL;
+ int32_t *l_228 = &g_214;
+ const struct S3 l_229 = {-12834,3,624,-6,8,31570,34,35,4,446};
+ struct S1 l_234 = {0x7CBEL,65531UL};
+ int8_t *l_255 = &g_253;
+ int32_t l_280 = 0xE149A9F4L;
+ int32_t l_281 = 3L;
+ int32_t l_318 = (-2L);
+ int32_t l_320 = 0xFA7069FDL;
+ int32_t l_322[1][1];
+ int32_t l_383[6] = {1L,1L,1L,1L,1L,1L};
+ struct S5 *l_427 = &g_69;
+ int16_t **l_492 = (void*)0;
+ uint16_t l_548 = 1UL;
+ int8_t l_581 = 0x33L;
+ int16_t ***l_597 = &l_492;
+ uint32_t l_646 = 0UL;
+ int i, j;
+ for (i = 0; i < 1; i++)
+ {
+ for (j = 0; j < 1; j++)
+ l_322[i][j] = 0L;
+ }
+ if ((((*l_228) = l_227) <= ((l_229 , (&p_57 != (void*)0)) == p_53.f2)))
+ { /* block id: 103 */
+ for (g_94 = 8; (g_94 > 31); g_94 = safe_add_func_uint16_t_u_u(g_94, 2))
+ { /* block id: 106 */
+ if (p_57.f1)
+ break;
+ }
+ }
+ else
+ { /* block id: 109 */
+ int16_t *l_247 = &g_109;
+ int16_t * const l_249 = (void*)0;
+ int32_t l_250 = (-1L);
+ int32_t l_272 = 0L;
+ int32_t l_275 = 0L;
+ int32_t l_329 = 0x121242E4L;
+ struct S0 l_363 = {175,9,31,37};
+ int32_t l_374 = 0x9A027F3BL;
+ uint32_t l_391 = 0xCD74C835L;
+ uint32_t ***l_400 = &g_345;
+ uint32_t *l_409 = (void*)0;
+ int32_t *l_410 = &l_280;
+ const uint16_t l_411 = 0x43A9L;
+ int32_t *l_412 = &l_250;
+ struct S5 l_415[5][8] = {{{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L},{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L}},{{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L},{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L}},{{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L},{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L}},{{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L},{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L}},{{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L},{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{65534UL,65532UL,{5369,2,486,12,0,13875,95,41,123,1543},0xC4F27E92L},{1UL,0x3AC6L,{-12171,2,112,-9,2,32314,79,-30,68,750},-6L}}};
+ uint32_t l_544 = 4294967293UL;
+ uint32_t l_582 = 0xA0A9C2C1L;
+ int32_t l_621[4] = {0xC353EE67L,0xC353EE67L,0xC353EE67L,0xC353EE67L};
+ int16_t ***l_630 = &l_492;
+ struct S3 l_639 = {-32711,-2,123,13,10,14313,101,-44,-66,6352};
+ struct S1 *l_645 = &l_234;
+ int i, j;
+ for (l_227 = (-14); (l_227 <= 46); l_227++)
+ { /* block id: 112 */
+ struct S0 *l_236 = &g_153;
+ struct S0 **l_235 = &l_236;
+ struct S0 **l_237 = (void*)0;
+ struct S0 *l_239[4][5] = {{&g_153,(void*)0,&g_153,&g_153,&g_153},{(void*)0,&g_153,(void*)0,&g_153,&g_153},{&g_153,(void*)0,&g_153,&g_153,&g_153},{(void*)0,&g_153,(void*)0,&g_153,&g_153}};
+ struct S0 **l_238 = &l_239[2][1];
+ int32_t l_244 = 3L;
+ int16_t **l_248 = &l_247;
+ int32_t l_305 = 0xFBD691C8L;
+ int32_t l_323 = (-5L);
+ int32_t l_326[3][3][10] = {{{0x1F4B9C93L,8L,8L,0x1F4B9C93L,0x349389C5L,5L,0x73619E2BL,(-1L),(-1L),1L},{0xFDE84D4DL,(-1L),(-1L),0x73619E2BL,8L,0x7A2AB3D7L,8L,0x73619E2BL,(-1L),(-1L)},{(-1L),1L,(-1L),0x1F4B9C93L,0x71D502BBL,0xDEF5D37AL,5L,(-1L),0x349389C5L,0x349389C5L}},{{1L,1L,0xDEF5D37AL,0x7A2AB3D7L,0x7A2AB3D7L,0xDEF5D37AL,1L,1L,0x1F4B9C93L,5L},{(-1L),(-1L),0x73619E2BL,1L,0L,0x7A2AB3D7L,(-1L),5L,(-1L),0x7A2AB3D7L},{0xFDE84D4DL,0L,0x73619E2BL,0L,0xFDE84D4DL,5L,0x1F4B9C93L,1L,1L,0xDEF5D37AL}},{{0x1F4B9C93L,0x71D502BBL,0xDEF5D37AL,5L,(-1L),0x349389C5L,0x349389C5L,(-1L),5L,0xDEF5D37AL},{5L,5L,(-1L),0xDEF5D37AL,0xFDE84D4DL,(-1L),(-1L),0x73619E2BL,8L,0x7A2AB3D7L},{0x73619E2BL,(-1L),(-1L),1L,0L,1L,(-1L),(-1L),0x73619E2BL,5L}}};
+ int32_t *l_373 = &l_329;
+ int32_t *l_378 = &l_323;
+ int32_t *l_379 = &l_275;
+ int32_t *l_380 = &l_280;
+ int32_t *l_381[8] = {(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0};
+ int32_t l_382 = 0x5FE0C3B8L;
+ uint16_t l_384 = 1UL;
+ uint8_t l_388[10][1][2] = {{{0x82L,0xB0L}},{{0xB0L,0x5FL}},{{0xB0L,0x5FL}},{{0xB0L,0xB0L}},{{0x82L,0x82L}},{{0x82L,0xB0L}},{{0xB0L,0x5FL}},{{0xB0L,0x5FL}},{{0xB0L,0xB0L}},{{0x82L,0x82L}}};
+ int i, j, k;
+ if ((((p_53.f0 == (func_17(l_234, (((*l_238) = ((*l_235) = &p_53)) != &p_53)) , g_113.f8)) < (safe_rshift_func_uint16_t_u_s((((((safe_add_func_uint8_t_u_u(l_244, ((safe_mul_func_int8_t_s_s((250UL != (+((((*l_248) = l_247) != l_249) ^ p_53.f2))), (*l_228))) || p_53.f2))) , (*l_228)) , 0xC7L) || l_250) | p_53.f3), g_113.f3))) == l_250))
+ { /* block id: 116 */
+ int32_t l_251 = 0xAE49ED9AL;
+ int8_t *l_254 = &g_253;
+ for (g_69.f0 = 0; (g_69.f0 <= 8); g_69.f0 += 1)
+ { /* block id: 119 */
+ uint16_t *l_262 = (void*)0;
+ uint16_t *l_263 = &l_234.f0;
+ int16_t *l_273[5];
+ int i;
+ for (i = 0; i < 5; i++)
+ l_273[i] = &g_274;
+ if (l_251)
+ break;
+ (*l_228) |= ((0x2AL | (g_252 == (l_255 = l_254))) , (p_53 , (safe_add_func_uint16_t_u_u((safe_div_func_int16_t_s_s((l_275 ^= (p_53 , ((safe_div_func_int32_t_s_s((((*l_263) = 0x18A4L) | ((((g_109 = (l_272 &= (safe_mul_func_uint16_t_u_u(((safe_sub_func_uint8_t_u_u(((-1L) || (!((safe_mul_func_uint8_t_u_u((safe_mod_func_int16_t_s_s((-7L), (5UL && 251UL))), l_250)) ^ l_244))), 7UL)) || l_251), 0L)))) != 0UL) , (void*)0) != &l_229)), p_57.f1)) > (*g_252)))), p_57.f1)), 0x5575L))));
+ if (l_251)
+ break;
+ p_53.f0 = ((safe_rshift_func_int8_t_s_s((*g_252), p_53.f2)) , (0UL || (*l_228)));
+ }
+ }
+ else
+ { /* block id: 130 */
+ int32_t *l_278 = &l_250;
+ int32_t *l_279[8][4] = {{&l_244,(void*)0,(void*)0,(void*)0},{(void*)0,&l_272,&l_275,&l_244},{(void*)0,&l_250,&l_250,(void*)0},{(void*)0,(void*)0,&l_275,&g_214},{(void*)0,(void*)0,(void*)0,&l_244},{&l_244,&l_250,&l_244,&l_244},{(void*)0,(void*)0,(void*)0,&g_214},{&l_275,(void*)0,(void*)0,(void*)0}};
+ uint8_t l_282 = 253UL;
+ uint16_t *l_289[6] = {&g_43[6][6][2].f0,&g_43[6][6][2].f0,&g_43[6][6][2].f0,&g_43[6][6][2].f0,&g_43[6][6][2].f0,&g_43[6][6][2].f0};
+ struct S0 *l_300[7] = {&g_153,&g_153,&g_153,&g_153,&g_153,&g_153,&g_153};
+ uint8_t *l_303 = &g_94;
+ uint32_t l_304 = 0x5DECD937L;
+ int32_t l_328 = 0L;
+ uint32_t **l_333 = (void*)0;
+ struct S5 l_358 = {65526UL,65535UL,{-17020,-3,129,6,9,5641,116,6,16,3716},0x87A08BDBL};
+ int i, j;
+ ++l_282;
+ if ((((((safe_mul_func_int16_t_s_s((l_244 = (safe_add_func_int8_t_s_s(((((--g_69.f0) || l_244) & (g_43[6][6][2].f1 = p_53.f2)) ^ ((**l_248) |= (g_274 = p_57.f1))), (*g_252)))), (safe_div_func_int8_t_s_s((safe_rshift_func_uint8_t_u_u(g_182.f9, 0)), ((*l_303) = ((p_53.f1 && ((safe_lshift_func_uint8_t_u_s((safe_sub_func_uint32_t_u_u((l_300[0] == (*l_235)), ((*l_228) = ((safe_sub_func_int8_t_s_s(0x3CL, 1L)) | p_57.f1)))), 5)) <= l_250)) | g_113.f0)))))) | g_69.f3) || p_53.f0) , l_304) != l_305))
+ { /* block id: 139 */
+ struct S4 *l_308 = &g_138;
+ int32_t l_315 = 1L;
+ int32_t l_316 = 0xC4D5F313L;
+ int32_t l_317 = 0x579CAB94L;
+ int32_t l_325 = 0L;
+ int32_t l_327[4][3][8] = {{{0x030C2675L,3L,0xE8FD32BEL,0xFF4CD6DDL,(-1L),1L,1L,1L},{3L,(-10L),0x51BD3FEEL,1L,(-10L),0x8A8F9135L,0x3ADFECCFL,0xDE5CFD58L},{0x51BD3FEEL,(-1L),0x57BA0327L,1L,0xFDD9E36FL,3L,0x3D1CCB86L,1L}},{{0x3D1CCB86L,0x3ADFECCFL,0x57BA0327L,0xFF4CD6DDL,0xFF4CD6DDL,0x57BA0327L,0x3ADFECCFL,0x3D1CCB86L},{0xFDD9E36FL,0x5D09D952L,0x51BD3FEEL,0xDE5CFD58L,(-1L),(-1L),0xE8FD32BEL,0x57BA0327L},{0L,1L,(-1L),0x8A8F9135L,0xDE5CFD58L,(-1L),0xDE5CFD58L,0x8A8F9135L}},{{0x3ADFECCFL,0x5D09D952L,0x3ADFECCFL,0x51BD3FEEL,(-1L),0x57BA0327L,1L,0xFDD9E36FL},{0x8A8F9135L,0x3ADFECCFL,0xDE5CFD58L,0xE8FD32BEL,0L,3L,(-1L),(-1L)},{0x8A8F9135L,(-1L),0x3D1CCB86L,0x3D1CCB86L,(-1L),0x8A8F9135L,0x5D09D952L,(-10L)}},{{0x3ADFECCFL,1L,3L,0x5D09D952L,0xDE5CFD58L,0x030C2675L,0xFDD9E36FL,0xFF4CD6DDL},{0L,(-10L),0x030C2675L,0x5D09D952L,(-1L),0x5D09D952L,0x030C2675L,(-10L)},{0xFDD9E36FL,(-1L),0xE8FD32BEL,0x3D1CCB86L,0xFF4CD6DDL,0x51BD3FEEL,0L,(-1L)}}};
+ int i, j, k;
+ for (p_57.f0 = (-21); (p_57.f0 < 48); ++p_57.f0)
+ { /* block id: 142 */
+ struct S4 **l_309 = &l_308;
+ (*l_309) = l_308;
+ return g_153;
+ }
+ if (l_305)
+ break;
+ for (l_305 = (-25); (l_305 < 11); l_305 = safe_add_func_int16_t_s_s(l_305, 1))
+ { /* block id: 149 */
+ int8_t l_312 = 0xE5L;
+ int32_t l_313 = 1L;
+ int32_t l_314 = 0xB566A646L;
+ int32_t l_319 = 1L;
+ int32_t l_321 = 3L;
+ int32_t l_324[4];
+ uint16_t l_330 = 0xFA7FL;
+ int i;
+ for (i = 0; i < 4; i++)
+ l_324[i] = 0x82E92E31L;
+ l_330--;
+ }
+ for (l_244 = 0; (l_244 <= 3); l_244 += 1)
+ { /* block id: 154 */
+ uint32_t ***l_334 = &l_333;
+ int32_t l_347 = 0xF0677D09L;
+ struct S2 **l_350 = &g_348;
+ int i, j;
+ (*l_334) = l_333;
+ p_53.f0 = (247UL & (safe_lshift_func_uint16_t_u_u((safe_mod_func_uint16_t_u_u((safe_lshift_func_int16_t_s_s((safe_add_func_uint16_t_u_u((p_57.f1 = ((&l_239[l_244][(l_244 + 1)] == &l_239[l_244][l_244]) < (~(((((*l_228) && p_57.f0) ^ (safe_lshift_func_int16_t_s_s((+(*l_278)), (((((((((((l_315 > ((g_345 == (void*)0) , g_113.f6)) < g_69.f2.f3) >= p_53.f0) , l_326[1][0][2]) || 1UL) != (*g_252)) && (*g_252)) >= p_57.f0) >= 65532UL) , 0x41F066B9L) || p_57.f1)))) ^ l_347) < l_305)))), p_53.f2)), p_53.f3)), g_138.f0.f2)), 15)));
+ (*l_350) = g_348;
+ }
+ }
+ else
+ { /* block id: 160 */
+ struct S3 **l_351 = &g_112;
+ struct S3 *l_354 = &g_138.f0;
+ struct S3 **l_353[1];
+ int i;
+ for (i = 0; i < 1; i++)
+ l_353[i] = &l_354;
+ g_356 = (g_355 = (g_352 = ((*l_351) = (void*)0)));
+ if (l_329)
+ continue;
+ }
+ (*l_228) = (l_358 , ((*l_278) = p_53.f0));
+ (*l_228) ^= (g_69.f1 <= (p_57.f1 || (*g_252)));
+ }
+ for (l_318 = 0; (l_318 <= (-8)); --l_318)
+ { /* block id: 173 */
+ uint16_t l_367[3];
+ int32_t *l_372 = &g_214;
+ int i;
+ for (i = 0; i < 3; i++)
+ l_367[i] = 65527UL;
+ for (l_234.f1 = (-8); (l_234.f1 >= 26); ++l_234.f1)
+ { /* block id: 176 */
+ (*l_228) = (l_275 > (*g_252));
+ return l_363;
+ }
+ l_244 = (*l_228);
+ for (l_234.f1 = 3; (l_234.f1 <= 8); l_234.f1 += 1)
+ { /* block id: 183 */
+ uint16_t l_375 = 0x71EFL;
+ for (l_244 = 0; (l_244 <= 8); l_244 += 1)
+ { /* block id: 186 */
+ return g_153;
+ }
+ for (g_84 = 8; (g_84 >= 0); g_84 -= 1)
+ { /* block id: 191 */
+ int32_t *l_364 = &l_329;
+ int32_t *l_365 = (void*)0;
+ int32_t *l_366[1];
+ int32_t **l_370 = &l_366[0];
+ int32_t **l_371 = (void*)0;
+ int i;
+ for (i = 0; i < 1; i++)
+ l_366[i] = (void*)0;
+ l_367[1]++;
+ g_151[4] = (l_373 = (l_372 = ((*l_370) = &g_214)));
+ --l_375;
+ }
+ }
+ }
+ l_384++;
+ for (g_94 = 2; (g_94 <= 7); g_94 += 1)
+ { /* block id: 204 */
+ int16_t l_387[1][8];
+ int i, j;
+ for (i = 0; i < 1; i++)
+ {
+ for (j = 0; j < 8; j++)
+ l_387[i][j] = 1L;
+ }
+ l_388[6][0][1]--;
+ (*l_380) = l_387[0][0];
+ }
+ }
+ if (((*l_412) = ((((p_53.f3 = ((*l_228) = (p_53.f1 = l_391))) || ((*l_410) ^= (safe_rshift_func_int16_t_s_u((((p_53.f3 <= (((safe_sub_func_uint8_t_u_u((safe_mul_func_int16_t_s_s((-2L), (safe_lshift_func_uint16_t_u_u((l_374 != 65530UL), 13)))), ((*l_255) = ((((*l_400) = &g_346[3][1][3]) != (g_401 = &g_346[0][2][2])) <= (l_272 ^= (safe_sub_func_uint8_t_u_u((((safe_sub_func_uint32_t_u_u((((safe_unary_minus_func_uint16_t_u(((safe_lshift_func_int16_t_s_u(((((*l_228) && ((*g_252) | 2UL)) , p_53.f1) != g_69.f0), 9)) > (-5L)))) >= p_53.f0) > (*l_228)), (*l_228))) >= (*l_228)) , (*l_228)), 1UL))))))) | 65528UL) | p_57.f1)) <= 1L) < g_182.f0), l_275)))) > l_411) , p_53.f3)))
+ { /* block id: 218 */
+ uint8_t l_443[8] = {0x1DL,0x1DL,0x1DL,0x1DL,0x1DL,0x1DL,0x1DL,0x1DL};
+ uint32_t *l_451 = &g_131;
+ int32_t l_504[3][5] = {{(-1L),(-1L),1L,1L,(-1L)},{(-1L),(-1L),1L,1L,(-1L)},{(-1L),(-1L),1L,1L,(-1L)}};
+ struct S4 *l_574 = &g_518[1];
+ int16_t ***l_595 = &l_492;
+ int16_t l_620 = (-6L);
+ uint8_t l_622 = 0x8BL;
+ uint32_t *l_636 = &g_494[2];
+ uint16_t l_644 = 0x655EL;
+ int i, j;
+ if ((((safe_mul_func_uint8_t_u_u(p_53.f2, ((l_415[1][6] , ((*l_228) = (((safe_mod_func_uint8_t_u_u((safe_unary_minus_func_int8_t_s(p_53.f2)), 0xEFL)) >= ((safe_sub_func_uint8_t_u_u((safe_div_func_int16_t_s_s((safe_lshift_func_uint16_t_u_s((safe_add_func_uint32_t_u_u((7UL < (((*g_75) = l_427) == (void*)0)), ((safe_div_func_uint8_t_u_u(((safe_div_func_uint32_t_u_u((((safe_lshift_func_uint8_t_u_u((safe_mod_func_int32_t_s_s(p_53.f2, (g_113.f5 && 255UL))), g_94)) >= 0x48L) , 0x0A836DACL), p_53.f1)) | g_349.f0), (*l_228))) , 4L))), g_111.f4)), p_53.f1)), (*g_252))) || p_53.f1)) , 0xA8E3F1E3L))) ^ 0x4A00F90DL))) ^ 0x7BL) < 0x4F381AB7L))
+ { /* block id: 221 */
+ struct S1 l_450 = {0x958CL,0UL};
+ int8_t l_468[8][4][2] = {{{0x38L,1L},{0x38L,0x38L},{1L,0x38L},{0x38L,1L}},{{0x38L,0x38L},{1L,0x38L},{0x38L,1L},{0x38L,0x38L}},{{1L,0x38L},{0x38L,1L},{0x38L,0x38L},{1L,0x38L}},{{0x38L,1L},{0x38L,0x38L},{1L,0x38L},{0x38L,1L}},{{0x38L,0x38L},{1L,0x38L},{0x38L,1L},{0x38L,0x38L}},{{1L,0x38L},{0x38L,1L},{0x38L,0x38L},{1L,0x38L}},{{0x38L,1L},{0x38L,0x38L},{1L,0x38L},{0x38L,1L}},{{0x38L,0x38L},{1L,0x38L},{0x38L,1L},{0x38L,0x38L}}};
+ int32_t l_476 = (-1L);
+ int16_t ***l_493 = &l_492;
+ int32_t l_503 = (-3L);
+ struct S4 *l_520 = &g_521[4][0][0];
+ const struct S3 l_529 = {2366,0,1008,2,10,12108,126,-23,-15,1054};
+ int32_t *l_575 = &l_476;
+ int32_t *l_576 = &l_503;
+ int32_t *l_577 = &l_374;
+ int32_t *l_578 = &l_281;
+ int32_t *l_579 = &l_476;
+ int32_t *l_580[7];
+ int i, j, k;
+ for (i = 0; i < 7; i++)
+ l_580[i] = &l_250;
+ if ((safe_unary_minus_func_int8_t_s((safe_div_func_int16_t_s_s((((safe_rshift_func_uint16_t_u_s((safe_div_func_int8_t_s_s(p_53.f3, l_443[6])), ((((*l_247) = ((*g_42) , (p_53.f3 && (*l_412)))) >= (safe_div_func_uint8_t_u_u(9UL, 1UL))) <= p_57.f0))) > (safe_sub_func_int32_t_s_s((safe_add_func_uint8_t_u_u((((l_451 = (func_17(l_450, l_450.f0) , (*g_345))) != (**l_400)) == (*l_410)), (*l_228))), (*l_228)))) < l_443[6]), g_357.f9)))))
+ { /* block id: 224 */
+ int8_t l_457[7];
+ int i;
+ for (i = 0; i < 7; i++)
+ l_457[i] = 0xE6L;
+ for (g_349.f5 = 15; (g_349.f5 == (-25)); --g_349.f5)
+ { /* block id: 227 */
+ uint16_t l_460[9] = {0x13E5L,1UL,0x13E5L,0x13E5L,1UL,0x13E5L,0x13E5L,1UL,0x13E5L};
+ uint16_t *l_463 = &l_450.f1;
+ int i;
+ (*l_412) |= ((p_53.f3 & ((*l_247) = 0xA57DL)) & (*l_228));
+ if (p_53.f0)
+ break;
+ p_53.f0 = ((!((safe_unary_minus_func_uint32_t_u(((safe_mod_func_int32_t_s_s(((*l_410) = (-2L)), ((*l_228) &= p_53.f3))) ^ l_457[0]))) || (((g_153.f0 >= (+(safe_div_func_uint32_t_u_u(p_53.f2, (((l_460[8] , (safe_lshift_func_uint16_t_u_u(p_53.f2, 15))) ^ (((*l_463) = g_111.f6) , (((0x2BB8L < p_53.f2) ^ p_53.f0) > 4294967295UL))) , p_53.f0))))) && l_457[0]) <= 0x1EL))) == p_53.f3);
+ (*g_42) = (*p_54);
+ }
+ }
+ else
+ { /* block id: 237 */
+ uint8_t l_477 = 0x96L;
+ for (l_450.f0 = 0; (l_450.f0 != 42); l_450.f0 = safe_add_func_int16_t_s_s(l_450.f0, 2))
+ { /* block id: 240 */
+ int32_t l_466[6] = {0x1655F412L,0x1655F412L,0x1655F412L,0x1655F412L,0x1655F412L,0x1655F412L};
+ int32_t *l_467 = (void*)0;
+ int32_t *l_469 = (void*)0;
+ int32_t *l_470 = &l_466[5];
+ int32_t *l_471 = &l_322[0][0];
+ int32_t *l_472 = &l_320;
+ int32_t *l_473 = &l_272;
+ int32_t *l_474 = &l_374;
+ int32_t *l_475[8][1] = {{&l_320},{&l_281},{&l_281},{&l_322[0][0]},{&l_320},{&l_320},{&l_322[0][0]},{&l_320}};
+ int i, j;
+ l_477--;
+ return g_153;
+ }
+ }
+ if (((*l_228) |= (((g_494[2] = (!((safe_rshift_func_int16_t_s_s(((*l_247) = ((void*)0 == &g_23)), 6)) == (safe_add_func_int32_t_s_s(((safe_rshift_func_int16_t_s_u((((p_53.f1 = (*l_412)) > (*l_410)) && (safe_add_func_uint8_t_u_u(((safe_rshift_func_int8_t_s_u((safe_rshift_func_int16_t_s_u((g_274 = (&g_76 != (((*g_252) , (((*l_493) = l_492) != (void*)0)) , &g_76))), p_53.f1)), g_111.f7)) | l_450.f0), p_57.f0))), g_111.f5)) , 1L), p_53.f0))))) > l_468[7][3][0]) || 1L)))
+ { /* block id: 251 */
+ struct S3 *l_497[9][10][2] = {{{&g_111,&g_182},{&g_111,&g_113},{(void*)0,&g_113},{&g_111,&g_182},{&g_111,(void*)0},{&g_138.f0,&g_111},{&g_138.f0,(void*)0},{&g_111,&g_182},{&g_111,&g_113},{(void*)0,&g_113}},{{&g_111,&g_182},{&g_111,(void*)0},{&g_138.f0,&g_111},{&g_138.f0,(void*)0},{&g_111,&g_182},{&g_111,&g_113},{(void*)0,&g_113},{&g_111,&g_182},{&g_111,(void*)0},{&g_138.f0,&g_111}},{{&g_138.f0,(void*)0},{&g_111,&g_182},{&g_111,&g_113},{(void*)0,&g_113},{&g_111,&g_182},{&g_111,(void*)0},{&g_138.f0,&g_111},{&g_138.f0,(void*)0},{&g_111,&g_182},{&g_111,&g_113}},{{(void*)0,&g_113},{&g_111,&g_182},{&g_111,(void*)0},{&g_138.f0,&g_111},{&g_138.f0,(void*)0},{&g_111,&g_182},{&g_111,&g_113},{(void*)0,&g_113},{&g_111,&g_182},{&g_111,(void*)0}},{{&g_138.f0,&g_111},{&g_138.f0,(void*)0},{&g_111,&g_182},{&g_111,&g_113},{(void*)0,&g_113},{&g_111,&g_182},{&g_111,(void*)0},{&g_138.f0,&g_111},{&g_138.f0,(void*)0},{&g_111,&g_182}},{{&g_111,&g_113},{(void*)0,&g_113},{&g_111,&g_182},{&g_111,(void*)0},{&g_138.f0,&g_111},{&g_138.f0,(void*)0},{&g_111,&g_182},{&g_111,&g_113},{(void*)0,&g_113},{&g_111,&g_182}},{{&g_111,(void*)0},{&g_138.f0,&g_111},{&g_138.f0,(void*)0},{&g_111,&g_182},{&g_111,&g_113},{(void*)0,&g_113},{&g_111,&g_182},{&g_111,(void*)0},{&g_138.f0,&g_111},{&g_138.f0,(void*)0}},{{&g_111,&g_182},{&g_111,&g_113},{(void*)0,&g_113},{&g_111,&g_182},{&g_111,(void*)0},{&g_138.f0,&g_111},{&g_138.f0,(void*)0},{&g_111,&g_182},{&g_111,&g_113},{(void*)0,&g_113}},{{&g_111,&g_182},{&g_111,(void*)0},{&g_138.f0,&g_111},{&g_138.f0,(void*)0},{&g_111,&g_182},{&g_111,&g_113},{(void*)0,&g_113},{&g_111,&g_182},{&g_111,(void*)0},{&g_138.f0,&g_111}}};
+ int32_t l_505 = 0x3BBE76C4L;
+ uint8_t l_506 = 6UL;
+ int i, j, k;
+ (*l_410) |= ((*l_412) = p_53.f0);
+ for (l_374 = (-26); (l_374 == 16); l_374 = safe_add_func_int16_t_s_s(l_374, 4))
+ { /* block id: 256 */
+ struct S3 **l_498 = &l_497[8][7][0];
+ (*l_498) = l_497[8][9][0];
+ }
+ for (p_57.f0 = 0; (p_57.f0 != 45); p_57.f0 = safe_add_func_uint8_t_u_u(p_57.f0, 7))
+ { /* block id: 261 */
+ int32_t **l_501 = &l_412;
+ int32_t *l_502[1];
+ int i;
+ for (i = 0; i < 1; i++)
+ l_502[i] = &l_281;
+ (*l_501) = &l_281;
+ l_506++;
+ }
+ }
+ else
+ { /* block id: 265 */
+ struct S4 *l_516 = &g_138;
+ struct S4 **l_515 = &l_516;
+ struct S4 **l_519 = (void*)0;
+ uint16_t *l_523 = (void*)0;
+ uint16_t *l_524 = &l_450.f0;
+ int32_t l_547 = 2L;
+ struct S5 *l_566 = (void*)0;
+ p_53.f0 = (((safe_div_func_int32_t_s_s((safe_mul_func_uint16_t_u_u(((*l_524) = (+(l_504[1][2] || (g_138 , (((*l_410) = (safe_add_func_int8_t_s_s((*g_252), ((l_520 = (g_517 = ((*l_515) = &g_138))) == ((*g_348) , &g_521[4][0][0]))))) >= (safe_unary_minus_func_int16_t_s((g_113.f9 < ((g_69.f2.f4 ^ (~p_57.f0)) <= p_53.f3))))))))), 0x3F82L)), 1L)) || 8L) != p_53.f1);
+ for (g_85 = 0; (g_85 <= 2); g_85 += 1)
+ { /* block id: 274 */
+ uint32_t *l_532 = &g_494[3];
+ int32_t l_535 = (-6L);
+ uint16_t *l_545 = &g_43[6][6][2].f1;
+ uint16_t l_546 = 65532UL;
+ struct S2 **l_551 = &g_348;
+ int32_t *l_567 = &l_503;
+ (*l_412) = ((safe_lshift_func_uint8_t_u_s((safe_mod_func_uint32_t_u_u(((g_153 , ((l_529 , (((*l_545) = (safe_sub_func_int8_t_s_s(((((+(--(*l_532))) , ((*g_517) , (l_535 | ((g_182.f8 , (((((safe_add_func_uint8_t_u_u((safe_div_func_int32_t_s_s((safe_sub_func_int32_t_s_s(l_504[0][1], p_53.f3)), (safe_lshift_func_uint8_t_u_u((((*l_524) = p_57.f0) <= (*l_228)), 1)))), 0x9CL)) > 0x6DCC9F64L) || l_544) >= (*g_252)) > 4UL)) >= 4294967295UL)))) <= g_138.f0.f6) < 5UL), 0xB6L))) == l_546)) | 0xC305L)) , l_529.f8), l_547)), (*g_252))) || l_548);
+ (*l_412) &= (safe_add_func_int32_t_s_s(p_53.f3, (0xFA528CD4L <= ((((*p_56) = (*g_42)) , &l_228) == (void*)0))));
+ (*l_551) = &g_349;
+ (*l_567) ^= ((*l_228) > (safe_lshift_func_uint16_t_u_s(((safe_add_func_int32_t_s_s(p_57.f1, (((((g_153 , ((((*l_410) &= p_53.f3) ^ 4294967295UL) > (safe_mul_func_int16_t_s_s(p_57.f1, 5UL)))) <= ((safe_mul_func_uint16_t_u_u((safe_mul_func_uint8_t_u_u((safe_add_func_int16_t_s_s((((((255UL != (~(4294967294UL == 0UL))) , (void*)0) == l_566) , g_69.f3) ^ l_504[2][3]), g_274)), 0x5DL)), g_111.f6)) == l_535)) & 8UL) && p_53.f2) | (*l_412)))) || p_53.f0), 3)));
+ }
+ (*l_412) = (((g_274 |= 0L) == g_349.f1) && (safe_lshift_func_int8_t_s_s(0L, (safe_rshift_func_int16_t_s_s((safe_add_func_uint16_t_u_u(((void*)0 != l_574), (l_234 , l_529.f8))), 12)))));
+ }
+ l_582++;
+ }
+ else
+ { /* block id: 289 */
+ uint32_t l_606[6];
+ int32_t l_609 = 0x40AE2A13L;
+ int32_t *l_610 = &l_504[1][3];
+ int32_t *l_611 = &l_318;
+ int32_t *l_612 = &g_84;
+ int32_t *l_613 = &l_609;
+ int32_t *l_614 = (void*)0;
+ int32_t *l_615 = &l_504[1][2];
+ int32_t l_616 = 0x99467C25L;
+ int32_t *l_617 = &l_322[0][0];
+ int32_t *l_618[5];
+ int16_t l_619 = 8L;
+ int i;
+ for (i = 0; i < 6; i++)
+ l_606[i] = 0x997170ADL;
+ for (i = 0; i < 5; i++)
+ l_618[i] = &l_616;
+ for (g_131 = (-27); (g_131 == 22); g_131++)
+ { /* block id: 292 */
+ for (l_318 = 2; (l_318 >= 0); l_318 -= 1)
+ { /* block id: 295 */
+ (*l_410) = ((*l_228) = p_57.f1);
+ }
+ }
+ for (p_57.f0 = 3; (p_57.f0 <= 8); p_57.f0 += 1)
+ { /* block id: 302 */
+ int32_t *l_600 = (void*)0;
+ int32_t *l_602 = &l_504[2][0];
+ int32_t *l_603 = &l_320;
+ int32_t *l_604 = &l_281;
+ int32_t *l_605[9][2] = {{(void*)0,&l_329},{(void*)0,(void*)0},{&l_329,&l_329},{&l_329,&l_280},{&l_329,&l_329},{&l_280,&l_329},{&l_329,&l_280},{&l_329,&l_329},{&l_280,&l_329}};
+ int i, j;
+ for (l_250 = 0; (l_250 <= 8); l_250 += 1)
+ { /* block id: 305 */
+ struct S3 l_594[7] = {{-9867,4,834,0,10,12828,54,32,17,4899},{-9867,4,834,0,10,12828,54,32,17,4899},{-9867,4,834,0,10,12828,54,32,17,4899},{-9867,4,834,0,10,12828,54,32,17,4899},{-9867,4,834,0,10,12828,54,32,17,4899},{-9867,4,834,0,10,12828,54,32,17,4899},{-9867,4,834,0,10,12828,54,32,17,4899}};
+ int16_t ****l_596[10] = {&l_595,&l_595,&l_595,&l_595,&l_595,&l_595,&l_595,&l_595,&l_595,&l_595};
+ uint16_t *l_598 = &l_415[1][6].f0;
+ int i;
+ (*l_410) |= ((safe_add_func_int8_t_s_s((safe_mod_func_uint16_t_u_u((((safe_unary_minus_func_int8_t_s((((&g_356 == &g_112) & (safe_mod_func_uint8_t_u_u((249UL >= (l_594[6] , (p_53.f1 != ((*l_598) = ((l_597 = l_595) == (void*)0))))), (*g_252)))) <= ((void*)0 == l_451)))) != g_599) != p_57.f0), 2UL)), (-1L))) != (*l_228));
+ }
+ l_606[2]--;
+ }
+ l_622++;
+ }
+ for (l_582 = 0; (l_582 > 11); l_582 = safe_add_func_int16_t_s_s(l_582, 7))
+ { /* block id: 316 */
+ struct S3 **l_627 = &g_356;
+ (*l_627) = &g_113;
+ }
+ (*l_410) |= (safe_sub_func_uint32_t_u_u(p_53.f1, (l_630 != ((g_599 = (safe_add_func_int32_t_s_s((*l_228), (safe_div_func_int16_t_s_s((safe_unary_minus_func_uint32_t_u(((*l_636) |= 1UL))), (safe_add_func_int8_t_s_s((*g_252), (g_153 , 0x7DL)))))))) , l_595))));
+ g_151[2] = &l_374;
+ }
+ else
+ { /* block id: 323 */
+ if (l_646)
+ { /* block id: 324 */
+ return p_53;
+ }
+ else
+ { /* block id: 326 */
+ struct S0 l_647[3][6][8] = {{{{-136,13,28,56},{145,13,26,9},{25,0,13,51},{-81,8,14,33},{-140,15,5,35},{-129,10,27,47},{124,4,0,104},{121,11,4,41}},{{30,12,15,71},{-136,13,28,56},{-55,14,13,73},{-148,11,29,18},{25,0,13,51},{-61,5,20,10},{66,11,28,12},{174,14,3,98}},{{110,4,20,75},{-150,13,15,70},{-141,10,31,71},{47,14,31,82},{-116,6,24,66},{95,3,18,52},{-81,14,25,100},{29,12,13,108}},{{-61,5,20,10},{-114,12,30,14},{-23,5,25,53},{172,13,28,120},{29,2,12,91},{174,14,3,98},{174,14,3,98},{29,2,12,91}},{{-23,5,25,53},{56,4,31,53},{56,4,31,53},{-23,5,25,53},{59,9,19,14},{30,12,15,71},{-61,5,20,10},{-118,2,9,105}},{{124,4,0,104},{47,14,31,82},{154,4,1,112},{-129,10,27,47},{-150,13,15,70},{-140,15,5,35},{172,13,28,120},{74,8,2,48}}},{{{-0,14,5,119},{47,14,31,82},{145,13,26,9},{-150,12,27,48},{174,14,3,98},{30,12,15,71},{-134,5,10,54},{154,4,1,112}},{{-97,7,20,120},{56,4,31,53},{-81,14,25,100},{-19,5,8,89},{-134,10,28,16},{174,14,3,98},{-112,11,31,77},{-149,15,5,23}},{{-140,15,5,35},{-114,12,30,14},{-116,6,24,66},{101,10,31,13},{95,1,23,52},{95,3,18,52},{-129,10,27,47},{172,13,28,120}},{{59,6,30,38},{-150,13,15,70},{59,9,19,14},{124,4,0,104},{152,6,21,93},{-61,5,20,10},{-141,10,31,71},{56,4,31,53}},{{-148,11,29,18},{-136,13,28,56},{-39,7,30,57},{-150,13,15,70},{29,12,13,108},{-129,10,27,47},{-114,12,30,14},{-141,10,31,71}},{{42,8,21,80},{145,13,26,9},{-81,8,14,33},{130,13,14,91},{-81,8,14,33},{145,13,26,9},{42,8,21,80},{-86,15,8,7}}},{{{25,0,13,51},{128,3,7,9},{59,6,30,38},{95,1,23,52},{154,4,1,112},{74,8,2,48},{45,11,4,116},{-116,6,24,66}},{{59,9,19,14},{101,10,31,13},{-118,2,9,105},{-136,13,28,56},{154,4,1,112},{-112,11,31,77},{110,4,20,75},{130,13,14,91}},{{25,0,13,51},{9,13,20,103},{-134,10,28,16},{-116,6,24,66},{-81,8,14,33},{161,6,7,45},{83,12,31,120},{-134,5,10,54}},{{42,8,21,80},{110,4,20,75},{-129,10,27,47},{34,6,31,81},{29,12,13,108},{95,1,23,52},{-46,5,11,42},{145,13,26,9}},{{-148,11,29,18},{-39,7,30,57},{30,12,15,71},{29,2,12,91},{152,6,21,93},{101,10,31,13},{154,4,1,112},{-19,5,8,89}},{{59,6,30,38},{-118,2,9,105},{42,8,21,80},{66,11,28,12},{95,1,23,52},{-136,13,28,56},{-140,15,5,35},{161,6,7,45}}}};
+ int i, j, k;
+ return l_647[1][1][5];
+ }
+ }
+ for (l_329 = 0; (l_329 != (-25)); l_329--)
+ { /* block id: 332 */
+ struct S1 **l_650[10] = {&l_645,&l_645,&l_645,&l_645,&l_645,&l_645,&l_645,&l_645,&l_645,&l_645};
+ int i;
+ p_56 = &g_43[1][0][0];
+ }
+ return l_363;
+ }
+ for (g_69.f3 = 6; (g_69.f3 <= (-1)); --g_69.f3)
+ { /* block id: 339 */
+ const int32_t *l_653 = &l_322[0][0];
+ const int32_t **l_654 = &l_653;
+ (*l_654) = ((*l_427) , l_653);
+ }
+ return g_153;
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_94 g_85 g_69.f2.f7 g_84 g_23 g_69.f1 g_131 g_43.f0 g_138 g_111.f5 g_111.f6 g_111.f3 g_153 g_113.f9 g_69.f2.f3 g_69.f2.f2 g_69.f2.f0 g_111.f1
+ * writes: g_84 g_85 g_69.f1 g_94 g_109 g_112 g_131 g_151
+ */
+static struct S0 func_58(int16_t p_59, int32_t p_60, struct S1 * p_61, uint16_t p_62, struct S1 * p_63)
+{ /* block id: 14 */
+ int32_t *l_83 = &g_84;
+ int32_t l_91 = 0xF83796EEL;
+ int32_t l_93[5][6] = {{(-10L),0x1B442378L,0x08F057B9L,0xA9A3A129L,0xA9A3A129L,0x08F057B9L},{0xBEE15430L,1L,0xBEE15430L,1L,0xBA1556E8L,(-10L)},{1L,0xBEE15430L,0x08F057B9L,(-10L),0x08F057B9L,0xBEE15430L},{1L,1L,0x08F057B9L,(-1L),1L,(-10L)},{0xA9A3A129L,(-1L),0xBEE15430L,0xBEE15430L,(-1L),0xA9A3A129L}};
+ int8_t l_142 = 0x11L;
+ int32_t **l_180 = &g_151[4];
+ struct S3 *l_181 = &g_182;
+ struct S0 l_225 = {-105,9,22,104};
+ int i, j;
+ g_85 = ((*l_83) = 1L);
+lbl_205:
+ for (g_69.f1 = (-24); (g_69.f1 > 31); g_69.f1++)
+ { /* block id: 19 */
+ int32_t *l_88 = &g_84;
+ int32_t *l_89 = &g_84;
+ int32_t *l_90 = &g_84;
+ int32_t *l_92[2][7][8] = {{{&g_84,&g_84,&l_91,&g_84,&g_84,(void*)0,(void*)0,&g_84},{&g_84,&g_84,&g_84,&g_84,&g_84,&g_84,&g_84,&g_84},{&g_84,(void*)0,&g_84,&g_84,&g_84,&g_84,&l_91,&g_84},{&l_91,&g_84,&l_91,&g_84,&g_84,&g_84,&l_91,&l_91},{&l_91,(void*)0,(void*)0,&l_91,&g_84,&g_84,&g_84,(void*)0},{&l_91,&g_84,&l_91,&l_91,&g_84,(void*)0,&g_84,(void*)0},{&l_91,&g_84,&g_84,&g_84,&g_84,(void*)0,&l_91,&l_91}},{{(void*)0,&g_84,&g_84,&l_91,&g_84,&l_91,&g_84,&g_84},{&l_91,&g_84,&g_84,&g_84,&l_91,(void*)0,(void*)0,&l_91},{&g_84,&l_91,&g_84,&g_84,&l_91,(void*)0,(void*)0,&l_91},{(void*)0,&g_84,&g_84,(void*)0,&l_91,&l_91,&g_84,&l_91},{&l_91,&l_91,&g_84,&l_91,&g_84,&l_91,&l_91,(void*)0},{&g_84,&l_91,&g_84,&g_84,&g_84,&g_84,&g_84,&l_91},{&l_91,&l_91,&l_91,&g_84,(void*)0,(void*)0,&g_84,&l_91}}};
+ int i, j, k;
+ ++g_94;
+ }
+ for (p_59 = 4; (p_59 >= 1); p_59 -= 1)
+ { /* block id: 24 */
+ uint32_t l_101 = 0x928AAD06L;
+ struct S1 * const l_122[1] = {&g_43[6][6][2]};
+ int32_t l_123 = 0x0C6443E6L;
+ uint8_t l_146 = 0x0DL;
+ uint16_t l_160[4];
+ int32_t l_210 = 4L;
+ int32_t l_211 = 0xFD14C5FFL;
+ int32_t l_212 = (-4L);
+ int32_t l_213 = (-1L);
+ int32_t l_215 = 0x9EB05264L;
+ int32_t l_216 = 0L;
+ int32_t l_217 = 0xE4B4E971L;
+ int32_t l_218[3];
+ int32_t l_219 = 0x5BEEE314L;
+ uint16_t l_220 = 0xB3DFL;
+ int i;
+ for (i = 0; i < 4; i++)
+ l_160[i] = 65535UL;
+ for (i = 0; i < 3; i++)
+ l_218[i] = 0x77C93981L;
+ for (g_85 = 0; (g_85 <= 2); g_85 += 1)
+ { /* block id: 27 */
+ int32_t l_127 = (-1L);
+ struct S4 l_163 = {{-17390,4,292,-10,2,16271,17,29,-55,7808},-5540};
+ struct S3 *l_165 = &g_138.f0;
+ int32_t **l_179 = &l_83;
+ int i, j;
+ if (l_93[p_59][g_85])
+ break;
+ for (p_62 = 1; (p_62 <= 4); p_62 += 1)
+ { /* block id: 31 */
+ const uint16_t l_107 = 0x3CE0L;
+ int16_t *l_108 = &g_109;
+ struct S1 *l_120[2];
+ int32_t l_126 = 0x6F6EEB39L;
+ int32_t l_130 = 1L;
+ struct S5 l_134 = {0x658AL,65534UL,{-27175,1,1343,1,2,13314,81,9,-34,991},0L};
+ struct S5 **l_137 = &g_76;
+ int i;
+ for (i = 0; i < 2; i++)
+ l_120[i] = &g_43[0][8][0];
+ if (p_60)
+ break;
+ if ((safe_lshift_func_int8_t_s_s((((safe_add_func_int8_t_s_s((1UL < p_59), g_69.f2.f7)) , (((((l_101 != (*l_83)) || 4294967286UL) <= (l_101 & (safe_unary_minus_func_uint8_t_u((safe_mul_func_uint16_t_u_u(g_23, ((safe_add_func_int32_t_s_s(((((*l_108) = (l_107 , l_101)) & 0x9021L) < 3UL), g_69.f1)) & 0UL))))))) <= (-1L)) < (*l_83))) > 0xBFDD0443L), 6)))
+ { /* block id: 34 */
+ for (p_60 = 0; (p_60 <= 4); p_60 += 1)
+ { /* block id: 37 */
+ struct S3 *l_110 = &g_111;
+ g_112 = l_110;
+ }
+ }
+ else
+ { /* block id: 40 */
+ const struct S2 l_121[5][9][1] = {{{{0,10989,2755,4,45111,0x0F242EEFL,3188,149,-109}},{{0,10989,2755,4,45111,0x0F242EEFL,3188,149,-109}},{{-1,10083,9718,2,9836,8L,3398,-135,38}},{{-0,7117,4484,1,13754,0xEE6007DAL,2870,165,-29}},{{-0,8270,6048,0,30763,0xAE96437FL,1414,97,-111}},{{-1,5203,21771,0,26939,6L,2897,-13,-86}},{{0,5200,14207,3,36662,0xB4F79F91L,2945,-6,101}},{{-0,10871,5590,2,27478,-5L,4068,71,10}},{{0,5200,14207,3,36662,0xB4F79F91L,2945,-6,101}}},{{{-1,5203,21771,0,26939,6L,2897,-13,-86}},{{-0,8270,6048,0,30763,0xAE96437FL,1414,97,-111}},{{-0,7117,4484,1,13754,0xEE6007DAL,2870,165,-29}},{{-1,10083,9718,2,9836,8L,3398,-135,38}},{{0,10989,2755,4,45111,0x0F242EEFL,3188,149,-109}},{{0,10989,2755,4,45111,0x0F242EEFL,3188,149,-109}},{{-1,10083,9718,2,9836,8L,3398,-135,38}},{{-0,7117,4484,1,13754,0xEE6007DAL,2870,165,-29}},{{-0,8270,6048,0,30763,0xAE96437FL,1414,97,-111}}},{{{-1,5203,21771,0,26939,6L,2897,-13,-86}},{{0,5200,14207,3,36662,0xB4F79F91L,2945,-6,101}},{{-0,10871,5590,2,27478,-5L,4068,71,10}},{{0,5200,14207,3,36662,0xB4F79F91L,2945,-6,101}},{{-1,5203,21771,0,26939,6L,2897,-13,-86}},{{-0,8270,6048,0,30763,0xAE96437FL,1414,97,-111}},{{-0,7117,4484,1,13754,0xEE6007DAL,2870,165,-29}},{{-1,10083,9718,2,9836,8L,3398,-135,38}},{{0,10989,2755,4,45111,0x0F242EEFL,3188,149,-109}}},{{{0,10989,2755,4,45111,0x0F242EEFL,3188,149,-109}},{{-1,10083,9718,2,9836,8L,3398,-135,38}},{{-0,7117,4484,1,13754,0xEE6007DAL,2870,165,-29}},{{-0,8270,6048,0,30763,0xAE96437FL,1414,97,-111}},{{-1,5203,21771,0,26939,6L,2897,-13,-86}},{{0,5200,14207,3,36662,0xB4F79F91L,2945,-6,101}},{{-0,10871,5590,2,27478,-5L,4068,71,10}},{{0,5200,14207,3,36662,0xB4F79F91L,2945,-6,101}},{{-1,5203,21771,0,26939,6L,2897,-13,-86}}},{{{-0,8270,6048,0,30763,0xAE96437FL,1414,97,-111}},{{-0,7117,4484,1,13754,0xEE6007DAL,2870,165,-29}},{{-1,10083,9718,2,9836,8L,3398,-135,38}},{{0,10989,2755,4,45111,0x0F242EEFL,3188,149,-109}},{{0,10989,2755,4,45111,0x0F242EEFL,3188,149,-109}},{{-1,10083,9718,2,9836,8L,3398,-135,38}},{{-0,7117,4484,1,13754,0xEE6007DAL,2870,165,-29}},{{-0,8270,6048,0,30763,0xAE96437FL,1414,97,-111}},{{-1,5203,21771,0,26939,6L,2897,-13,-86}}}};
+ int32_t l_128 = 0L;
+ int32_t l_129 = 0xA5D6F3FEL;
+ int32_t *l_150 = (void*)0;
+ struct S0 *l_152[6][10] = {{&g_153,&g_153,&g_153,&g_153,&g_153,&g_153,&g_153,&g_153,&g_153,&g_153},{&g_153,&g_153,&g_153,(void*)0,&g_153,&g_153,&g_153,&g_153,&g_153,&g_153},{&g_153,&g_153,&g_153,&g_153,&g_153,&g_153,&g_153,&g_153,&g_153,&g_153},{&g_153,&g_153,&g_153,&g_153,&g_153,&g_153,&g_153,&g_153,&g_153,&g_153},{&g_153,&g_153,&g_153,&g_153,&g_153,&g_153,&g_153,&g_153,&g_153,&g_153},{&g_153,&g_153,(void*)0,&g_153,(void*)0,&g_153,&g_153,&g_153,&g_153,&g_153}};
+ int32_t *l_157 = &l_93[p_59][p_59];
+ int32_t *l_158 = (void*)0;
+ int32_t *l_159[2][8][2] = {{{&g_84,&l_126},{&l_93[0][3],(void*)0},{&l_93[0][3],&l_126},{&g_84,&g_84},{&l_126,&l_93[0][3]},{(void*)0,&l_93[0][3]},{&l_126,&g_84},{&g_84,&l_126}},{{&l_93[0][3],(void*)0},{&l_93[0][3],&l_126},{&g_84,&g_84},{&l_126,&l_93[0][3]},{(void*)0,&l_93[0][3]},{&l_126,&g_84},{&g_84,&l_126},{&l_93[0][3],(void*)0}}};
+ struct S3 *l_164 = &l_163.f0;
+ uint32_t *l_176 = &g_131;
+ int i, j, k;
+ if ((((safe_add_func_uint8_t_u_u(p_62, ((safe_lshift_func_int16_t_s_s((&l_93[2][4] == (void*)0), (((void*)0 == &p_62) <= 6UL))) | ((l_93[p_59][p_59] |= 0L) & (((l_123 ^= (safe_lshift_func_uint16_t_u_s((l_120[1] != (l_121[0][7][0] , l_122[0])), p_60))) && 1UL) || (-7L)))))) >= (*l_83)) | (-1L)))
+ { /* block id: 43 */
+ int32_t *l_124 = &l_123;
+ int32_t *l_125[2][5][2] = {{{&l_93[p_59][p_59],(void*)0},{&l_93[p_59][g_85],&l_93[p_59][g_85]},{(void*)0,&l_93[p_59][g_85]},{&l_93[p_59][g_85],(void*)0},{&l_93[p_59][p_59],&l_93[p_59][p_59]}},{{&l_93[p_59][p_59],(void*)0},{&l_93[p_59][g_85],&l_93[p_59][g_85]},{(void*)0,&l_93[p_59][g_85]},{&l_93[p_59][g_85],(void*)0},{&l_93[p_59][p_59],&l_93[p_59][p_59]}}};
+ int i, j, k;
+ ++g_131;
+ p_60 ^= (l_134 , (((-1L) ^ (safe_mod_func_int32_t_s_s((*l_83), (((*l_124) &= g_43[6][6][2].f0) || (l_137 == (g_138 , &g_76)))))) != ((((void*)0 == &g_84) == p_62) || (*l_83))));
+ p_60 ^= 0x3CCC8CD9L;
+ }
+ else
+ { /* block id: 48 */
+ uint32_t *l_139 = &g_131;
+ int32_t l_143 = 0x4D29C7E7L;
+ int32_t *l_144 = &l_129;
+ int32_t *l_145[7][7] = {{&l_93[p_59][g_85],(void*)0,&l_130,(void*)0,&l_93[p_59][g_85],&l_93[p_59][g_85],(void*)0},{&l_128,&g_84,&l_128,&l_93[p_59][p_59],(void*)0,&l_143,&l_91},{(void*)0,&l_127,&l_130,&l_130,&l_127,(void*)0,&l_127},{&l_128,&l_93[p_59][p_59],(void*)0,&l_143,&l_91,&l_143,(void*)0},{&l_93[p_59][g_85],&l_93[p_59][g_85],(void*)0,&l_130,(void*)0,&l_93[p_59][g_85],&l_93[p_59][g_85]},{(void*)0,&l_93[p_59][p_59],(void*)0,&l_93[p_59][p_59],(void*)0,&l_123,(void*)0},{&l_93[p_59][g_85],&l_127,&l_93[p_59][g_85],(void*)0,(void*)0,&l_93[p_59][g_85],&l_127}};
+ int32_t **l_149[8] = {&l_145[0][1],&l_83,&l_145[0][1],&l_145[0][1],&l_83,&l_145[0][1],&l_145[0][1],&l_83};
+ struct S0 **l_154 = &l_152[5][8];
+ struct S0 *l_156 = &g_153;
+ struct S0 **l_155 = &l_156;
+ int i, j;
+ (*l_83) ^= ((p_62 | ((--(*l_139)) & l_123)) , (l_142 != l_143));
+ ++l_146;
+ g_151[4] = (l_150 = &l_143);
+ (*l_155) = ((*l_154) = l_152[5][8]);
+ }
+ if (p_62)
+ break;
+ ++l_160[3];
+ (*l_157) = ((l_163 , ((p_60 & (8UL & (((g_112 = l_164) != l_165) > (safe_lshift_func_uint8_t_u_s(l_146, (((l_163.f0.f1 || ((0xC9L ^ (safe_mul_func_uint8_t_u_u((safe_mod_func_uint32_t_u_u((((*l_176) = (((((((safe_rshift_func_uint16_t_u_s((((safe_div_func_int8_t_s_s(1L, g_111.f5)) < 0x7EL) & p_60), p_59)) , p_62) == l_134.f3) & 0x03L) ^ p_62) >= g_111.f6) > (*l_83))) || p_59), l_160[2])), (*l_83)))) , l_134.f1)) > 0xD4A83E69L) > p_62)))))) > p_62)) > 0xF8C4L);
+ }
+ if (((**l_179) = ((safe_lshift_func_int16_t_s_u((*l_83), 5)) >= ((0xB5L & (l_179 == l_180)) , g_111.f3))))
+ { /* block id: 64 */
+ int32_t l_185 = (-2L);
+ l_181 = l_165;
+ for (l_101 = 0; (l_101 <= 2); l_101 += 1)
+ { /* block id: 68 */
+ int8_t *l_186 = &l_142;
+ uint32_t *l_199 = (void*)0;
+ uint32_t *l_200 = &g_131;
+ uint16_t *l_203 = &g_69.f1;
+ int32_t *l_204[1][8];
+ int i, j;
+ for (i = 0; i < 1; i++)
+ {
+ for (j = 0; j < 8; j++)
+ l_204[i][j] = &l_127;
+ }
+ l_123 |= (safe_rshift_func_int8_t_s_s(((*l_186) = l_185), (((safe_lshift_func_int8_t_s_s((safe_lshift_func_int16_t_s_u(((3UL < ((g_153 , ((safe_mod_func_uint8_t_u_u(p_60, ((&g_109 != (void*)0) , (((safe_lshift_func_uint8_t_u_s((((safe_mod_func_uint8_t_u_u((((((*l_203) = (((p_62 ^ ((*l_83) = (safe_mod_func_uint32_t_u_u(((*l_200) = g_113.f9), ((safe_sub_func_int32_t_s_s((((**l_179) , &g_153) == &g_153), g_69.f2.f3)) , (-7L)))))) , g_69.f2.f2) | p_60)) || p_62) , 0x0F5ECD5AL) , l_185), g_153.f3)) == 0x31L) != p_62), p_62)) , 4UL) || p_62)))) || g_69.f2.f0)) | 0x452CL)) , g_111.f1), 13)), 4)) != l_185) >= g_138.f0.f5)));
+ }
+ if (p_60)
+ break;
+ }
+ else
+ { /* block id: 76 */
+ (*l_180) = (void*)0;
+ }
+ if (l_134.f2.f7)
+ goto lbl_205;
+ }
+ }
+ for (l_146 = 0; (l_146 <= 4); l_146 += 1)
+ { /* block id: 84 */
+ int32_t *l_206 = &l_93[4][4];
+ int32_t *l_207 = (void*)0;
+ int32_t *l_208 = &l_93[0][3];
+ int32_t *l_209[3][1];
+ int i, j;
+ for (i = 0; i < 3; i++)
+ {
+ for (j = 0; j < 1; j++)
+ l_209[i][j] = &g_84;
+ }
+ --l_220;
+ for (g_94 = 0; (g_94 <= 3); g_94 += 1)
+ { /* block id: 88 */
+ struct S4 *l_223 = &g_138;
+ struct S4 **l_224 = &l_223;
+ int i, j;
+ if (l_93[(g_94 + 1)][l_146])
+ break;
+ for (l_123 = 0; (l_123 <= 3); l_123 += 1)
+ { /* block id: 92 */
+ if (p_59)
+ break;
+ }
+ (*l_224) = l_223;
+ }
+ return l_225;
+ }
+ }
+ return l_225;
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads :
+ * writes:
+ */
+static struct S1 * func_64(struct S1 * const p_65, struct S1 * p_66, struct S1 * p_67)
+{ /* block id: 9 */
+ struct S5 *l_68 = &g_69;
+ struct S5 **l_70 = &l_68;
+ int32_t l_71 = 1L;
+ (*l_70) = l_68;
+ l_71 &= (-1L);
+ return p_66;
+}
+
+
+
+
+/* ---------------------------------------- */
+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_22.f0, "g_22.f0", print_hash_value);
+ transparent_crc(g_22.f1, "g_22.f1", print_hash_value);
+ transparent_crc(g_23, "g_23", print_hash_value);
+ for (i = 0; i < 8; i++)
+ {
+ for (j = 0; j < 10; j++)
+ {
+ for (k = 0; k < 3; k++)
+ {
+ transparent_crc(g_43[i][j][k].f0, "g_43[i][j][k].f0", print_hash_value);
+ transparent_crc(g_43[i][j][k].f1, "g_43[i][j][k].f1", print_hash_value);
+ if (print_hash_value) printf("index = [%d][%d][%d]\n", i, j, k);
+
+ }
+ }
+ }
+ transparent_crc(g_69.f0, "g_69.f0", print_hash_value);
+ transparent_crc(g_69.f1, "g_69.f1", print_hash_value);
+ transparent_crc(g_69.f2.f0, "g_69.f2.f0", print_hash_value);
+ transparent_crc(g_69.f2.f1, "g_69.f2.f1", print_hash_value);
+ transparent_crc(g_69.f2.f2, "g_69.f2.f2", print_hash_value);
+ transparent_crc(g_69.f2.f3, "g_69.f2.f3", print_hash_value);
+ transparent_crc(g_69.f2.f4, "g_69.f2.f4", print_hash_value);
+ transparent_crc(g_69.f2.f5, "g_69.f2.f5", print_hash_value);
+ transparent_crc(g_69.f2.f6, "g_69.f2.f6", print_hash_value);
+ transparent_crc(g_69.f2.f7, "g_69.f2.f7", print_hash_value);
+ transparent_crc(g_69.f2.f8, "g_69.f2.f8", print_hash_value);
+ transparent_crc(g_69.f2.f9, "g_69.f2.f9", print_hash_value);
+ transparent_crc(g_69.f3, "g_69.f3", print_hash_value);
+ transparent_crc(g_84, "g_84", print_hash_value);
+ transparent_crc(g_85, "g_85", print_hash_value);
+ transparent_crc(g_94, "g_94", print_hash_value);
+ transparent_crc(g_109, "g_109", print_hash_value);
+ transparent_crc(g_111.f0, "g_111.f0", print_hash_value);
+ transparent_crc(g_111.f1, "g_111.f1", print_hash_value);
+ transparent_crc(g_111.f2, "g_111.f2", print_hash_value);
+ transparent_crc(g_111.f3, "g_111.f3", print_hash_value);
+ transparent_crc(g_111.f4, "g_111.f4", print_hash_value);
+ transparent_crc(g_111.f5, "g_111.f5", print_hash_value);
+ transparent_crc(g_111.f6, "g_111.f6", print_hash_value);
+ transparent_crc(g_111.f7, "g_111.f7", print_hash_value);
+ transparent_crc(g_111.f8, "g_111.f8", print_hash_value);
+ transparent_crc(g_111.f9, "g_111.f9", print_hash_value);
+ transparent_crc(g_113.f0, "g_113.f0", print_hash_value);
+ transparent_crc(g_113.f1, "g_113.f1", print_hash_value);
+ transparent_crc(g_113.f2, "g_113.f2", print_hash_value);
+ transparent_crc(g_113.f3, "g_113.f3", print_hash_value);
+ transparent_crc(g_113.f4, "g_113.f4", print_hash_value);
+ transparent_crc(g_113.f5, "g_113.f5", print_hash_value);
+ transparent_crc(g_113.f6, "g_113.f6", print_hash_value);
+ transparent_crc(g_113.f7, "g_113.f7", print_hash_value);
+ transparent_crc(g_113.f8, "g_113.f8", print_hash_value);
+ transparent_crc(g_113.f9, "g_113.f9", print_hash_value);
+ transparent_crc(g_131, "g_131", print_hash_value);
+ transparent_crc(g_138.f0.f0, "g_138.f0.f0", print_hash_value);
+ transparent_crc(g_138.f0.f1, "g_138.f0.f1", print_hash_value);
+ transparent_crc(g_138.f0.f2, "g_138.f0.f2", print_hash_value);
+ transparent_crc(g_138.f0.f3, "g_138.f0.f3", print_hash_value);
+ transparent_crc(g_138.f0.f4, "g_138.f0.f4", print_hash_value);
+ transparent_crc(g_138.f0.f5, "g_138.f0.f5", print_hash_value);
+ transparent_crc(g_138.f0.f6, "g_138.f0.f6", print_hash_value);
+ transparent_crc(g_138.f0.f7, "g_138.f0.f7", print_hash_value);
+ transparent_crc(g_138.f0.f8, "g_138.f0.f8", print_hash_value);
+ transparent_crc(g_138.f0.f9, "g_138.f0.f9", print_hash_value);
+ transparent_crc(g_138.f1, "g_138.f1", print_hash_value);
+ transparent_crc(g_153.f0, "g_153.f0", print_hash_value);
+ transparent_crc(g_153.f1, "g_153.f1", print_hash_value);
+ transparent_crc(g_153.f2, "g_153.f2", print_hash_value);
+ transparent_crc(g_153.f3, "g_153.f3", print_hash_value);
+ transparent_crc(g_182.f0, "g_182.f0", print_hash_value);
+ transparent_crc(g_182.f1, "g_182.f1", print_hash_value);
+ transparent_crc(g_182.f2, "g_182.f2", print_hash_value);
+ transparent_crc(g_182.f3, "g_182.f3", print_hash_value);
+ transparent_crc(g_182.f4, "g_182.f4", print_hash_value);
+ transparent_crc(g_182.f5, "g_182.f5", print_hash_value);
+ transparent_crc(g_182.f6, "g_182.f6", print_hash_value);
+ transparent_crc(g_182.f7, "g_182.f7", print_hash_value);
+ transparent_crc(g_182.f8, "g_182.f8", print_hash_value);
+ transparent_crc(g_182.f9, "g_182.f9", print_hash_value);
+ transparent_crc(g_214, "g_214", print_hash_value);
+ transparent_crc(g_253, "g_253", print_hash_value);
+ transparent_crc(g_274, "g_274", print_hash_value);
+ transparent_crc(g_349.f0, "g_349.f0", print_hash_value);
+ transparent_crc(g_349.f1, "g_349.f1", print_hash_value);
+ transparent_crc(g_349.f2, "g_349.f2", print_hash_value);
+ transparent_crc(g_349.f3, "g_349.f3", print_hash_value);
+ transparent_crc(g_349.f4, "g_349.f4", print_hash_value);
+ transparent_crc(g_349.f5, "g_349.f5", print_hash_value);
+ transparent_crc(g_349.f6, "g_349.f6", print_hash_value);
+ transparent_crc(g_349.f7, "g_349.f7", print_hash_value);
+ transparent_crc(g_349.f8, "g_349.f8", print_hash_value);
+ transparent_crc(g_357.f0, "g_357.f0", print_hash_value);
+ transparent_crc(g_357.f1, "g_357.f1", print_hash_value);
+ transparent_crc(g_357.f2, "g_357.f2", print_hash_value);
+ transparent_crc(g_357.f3, "g_357.f3", print_hash_value);
+ transparent_crc(g_357.f4, "g_357.f4", print_hash_value);
+ transparent_crc(g_357.f5, "g_357.f5", print_hash_value);
+ transparent_crc(g_357.f6, "g_357.f6", print_hash_value);
+ transparent_crc(g_357.f7, "g_357.f7", print_hash_value);
+ transparent_crc(g_357.f8, "g_357.f8", print_hash_value);
+ transparent_crc(g_357.f9, "g_357.f9", print_hash_value);
+ for (i = 0; i < 4; i++)
+ {
+ transparent_crc(g_494[i], "g_494[i]", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ for (i = 0; i < 8; i++)
+ {
+ transparent_crc(g_518[i].f0.f0, "g_518[i].f0.f0", print_hash_value);
+ transparent_crc(g_518[i].f0.f1, "g_518[i].f0.f1", print_hash_value);
+ transparent_crc(g_518[i].f0.f2, "g_518[i].f0.f2", print_hash_value);
+ transparent_crc(g_518[i].f0.f3, "g_518[i].f0.f3", print_hash_value);
+ transparent_crc(g_518[i].f0.f4, "g_518[i].f0.f4", print_hash_value);
+ transparent_crc(g_518[i].f0.f5, "g_518[i].f0.f5", print_hash_value);
+ transparent_crc(g_518[i].f0.f6, "g_518[i].f0.f6", print_hash_value);
+ transparent_crc(g_518[i].f0.f7, "g_518[i].f0.f7", print_hash_value);
+ transparent_crc(g_518[i].f0.f8, "g_518[i].f0.f8", print_hash_value);
+ transparent_crc(g_518[i].f0.f9, "g_518[i].f0.f9", print_hash_value);
+ transparent_crc(g_518[i].f1, "g_518[i].f1", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ for (i = 0; i < 5; i++)
+ {
+ for (j = 0; j < 2; j++)
+ {
+ for (k = 0; k < 4; k++)
+ {
+ transparent_crc(g_521[i][j][k].f0.f0, "g_521[i][j][k].f0.f0", print_hash_value);
+ transparent_crc(g_521[i][j][k].f0.f1, "g_521[i][j][k].f0.f1", print_hash_value);
+ transparent_crc(g_521[i][j][k].f0.f2, "g_521[i][j][k].f0.f2", print_hash_value);
+ transparent_crc(g_521[i][j][k].f0.f3, "g_521[i][j][k].f0.f3", print_hash_value);
+ transparent_crc(g_521[i][j][k].f0.f4, "g_521[i][j][k].f0.f4", print_hash_value);
+ transparent_crc(g_521[i][j][k].f0.f5, "g_521[i][j][k].f0.f5", print_hash_value);
+ transparent_crc(g_521[i][j][k].f0.f6, "g_521[i][j][k].f0.f6", print_hash_value);
+ transparent_crc(g_521[i][j][k].f0.f7, "g_521[i][j][k].f0.f7", print_hash_value);
+ transparent_crc(g_521[i][j][k].f0.f8, "g_521[i][j][k].f0.f8", print_hash_value);
+ transparent_crc(g_521[i][j][k].f0.f9, "g_521[i][j][k].f0.f9", print_hash_value);
+ transparent_crc(g_521[i][j][k].f1, "g_521[i][j][k].f1", print_hash_value);
+ if (print_hash_value) printf("index = [%d][%d][%d]\n", i, j, k);
+
+ }
+ }
+ }
+ transparent_crc(g_599, "g_599", print_hash_value);
+ for (i = 0; i < 2; i++)
+ {
+ for (j = 0; j < 3; j++)
+ {
+ transparent_crc(g_601[i][j], "g_601[i][j]", print_hash_value);
+ if (print_hash_value) printf("index = [%d][%d]\n", i, j);
+
+ }
+ }
+ transparent_crc(g_745, "g_745", print_hash_value);
+ transparent_crc(g_763, "g_763", print_hash_value);
+ transparent_crc(g_798, "g_798", print_hash_value);
+ transparent_crc(g_809, "g_809", print_hash_value);
+ transparent_crc(g_903.f0.f0, "g_903.f0.f0", print_hash_value);
+ transparent_crc(g_903.f0.f1, "g_903.f0.f1", print_hash_value);
+ transparent_crc(g_903.f0.f2, "g_903.f0.f2", print_hash_value);
+ transparent_crc(g_903.f0.f3, "g_903.f0.f3", print_hash_value);
+ transparent_crc(g_903.f0.f4, "g_903.f0.f4", print_hash_value);
+ transparent_crc(g_903.f0.f5, "g_903.f0.f5", print_hash_value);
+ transparent_crc(g_903.f0.f6, "g_903.f0.f6", print_hash_value);
+ transparent_crc(g_903.f0.f7, "g_903.f0.f7", print_hash_value);
+ transparent_crc(g_903.f0.f8, "g_903.f0.f8", print_hash_value);
+ transparent_crc(g_903.f0.f9, "g_903.f0.f9", print_hash_value);
+ transparent_crc(g_903.f1, "g_903.f1", print_hash_value);
+ for (i = 0; i < 6; i++)
+ {
+ transparent_crc(g_922[i], "g_922[i]", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ transparent_crc(g_1001.f0.f0, "g_1001.f0.f0", print_hash_value);
+ transparent_crc(g_1001.f0.f1, "g_1001.f0.f1", print_hash_value);
+ transparent_crc(g_1001.f0.f2, "g_1001.f0.f2", print_hash_value);
+ transparent_crc(g_1001.f0.f3, "g_1001.f0.f3", print_hash_value);
+ transparent_crc(g_1001.f0.f4, "g_1001.f0.f4", print_hash_value);
+ transparent_crc(g_1001.f0.f5, "g_1001.f0.f5", print_hash_value);
+ transparent_crc(g_1001.f0.f6, "g_1001.f0.f6", print_hash_value);
+ transparent_crc(g_1001.f0.f7, "g_1001.f0.f7", print_hash_value);
+ transparent_crc(g_1001.f0.f8, "g_1001.f0.f8", print_hash_value);
+ transparent_crc(g_1001.f0.f9, "g_1001.f0.f9", print_hash_value);
+ transparent_crc(g_1001.f1, "g_1001.f1", print_hash_value);
+ transparent_crc(g_1017.f0, "g_1017.f0", print_hash_value);
+ transparent_crc(g_1017.f1, "g_1017.f1", print_hash_value);
+ transparent_crc(g_1017.f2.f0, "g_1017.f2.f0", print_hash_value);
+ transparent_crc(g_1017.f2.f1, "g_1017.f2.f1", print_hash_value);
+ transparent_crc(g_1017.f2.f2, "g_1017.f2.f2", print_hash_value);
+ transparent_crc(g_1017.f2.f3, "g_1017.f2.f3", print_hash_value);
+ transparent_crc(g_1017.f2.f4, "g_1017.f2.f4", print_hash_value);
+ transparent_crc(g_1017.f2.f5, "g_1017.f2.f5", print_hash_value);
+ transparent_crc(g_1017.f2.f6, "g_1017.f2.f6", print_hash_value);
+ transparent_crc(g_1017.f2.f7, "g_1017.f2.f7", print_hash_value);
+ transparent_crc(g_1017.f2.f8, "g_1017.f2.f8", print_hash_value);
+ transparent_crc(g_1017.f2.f9, "g_1017.f2.f9", print_hash_value);
+ transparent_crc(g_1017.f3, "g_1017.f3", print_hash_value);
+ platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value);
+ return 0;
+}
+
+/************************ statistics *************************
+XXX max struct depth: 2
+breakdown:
+ depth: 0, occurrence: 261
+ depth: 1, occurrence: 31
+ depth: 2, occurrence: 14
+XXX total union variables: 0
+
+XXX non-zero bitfields defined in structs: 23
+XXX zero bitfields defined in structs: 0
+XXX const bitfields defined in structs: 5
+XXX volatile bitfields defined in structs: 0
+XXX structs with bitfields in the program: 66
+breakdown:
+ indirect level: 0, occurrence: 35
+ indirect level: 1, occurrence: 25
+ indirect level: 2, occurrence: 6
+XXX full-bitfields structs in the program: 16
+breakdown:
+ indirect level: 0, occurrence: 16
+XXX times a bitfields struct's address is taken: 89
+XXX times a bitfields struct on LHS: 8
+XXX times a bitfields struct on RHS: 69
+XXX times a single bitfield on LHS: 10
+XXX times a single bitfield on RHS: 131
+
+XXX max expression depth: 37
+breakdown:
+ depth: 1, occurrence: 153
+ depth: 2, occurrence: 53
+ depth: 3, occurrence: 2
+ depth: 4, occurrence: 5
+ depth: 6, occurrence: 3
+ depth: 7, occurrence: 1
+ depth: 9, occurrence: 1
+ depth: 10, occurrence: 1
+ depth: 12, occurrence: 1
+ depth: 17, occurrence: 2
+ depth: 19, occurrence: 2
+ depth: 20, occurrence: 2
+ depth: 22, occurrence: 1
+ depth: 24, occurrence: 2
+ depth: 25, occurrence: 2
+ depth: 27, occurrence: 4
+ depth: 29, occurrence: 2
+ depth: 33, occurrence: 1
+ depth: 35, occurrence: 1
+ depth: 37, occurrence: 1
+
+XXX total number of pointers: 257
+
+XXX times a variable address is taken: 468
+XXX times a pointer is dereferenced on RHS: 95
+breakdown:
+ depth: 1, occurrence: 91
+ depth: 2, occurrence: 4
+XXX times a pointer is dereferenced on LHS: 124
+breakdown:
+ depth: 1, occurrence: 120
+ depth: 2, occurrence: 4
+XXX times a pointer is compared with null: 12
+XXX times a pointer is compared with address of another variable: 2
+XXX times a pointer is compared with another pointer: 5
+XXX times a pointer is qualified to be dereferenced: 3560
+
+XXX max dereference level: 3
+breakdown:
+ level: 0, occurrence: 0
+ level: 1, occurrence: 756
+ level: 2, occurrence: 89
+ level: 3, occurrence: 4
+XXX number of pointers point to pointers: 71
+XXX number of pointers point to scalars: 126
+XXX number of pointers point to structs: 60
+XXX percent of pointers has null in alias set: 25.3
+XXX average alias set size: 1.37
+
+XXX times a non-volatile is read: 778
+XXX times a non-volatile is write: 446
+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: 3
+
+XXX stmts: 166
+XXX max block depth: 5
+breakdown:
+ depth: 0, occurrence: 26
+ depth: 1, occurrence: 16
+ depth: 2, occurrence: 19
+ depth: 3, occurrence: 31
+ depth: 4, occurrence: 40
+ depth: 5, occurrence: 34
+
+XXX percentage a fresh-made variable is used: 19.7
+XXX percentage an existing variable is used: 80.3
+FYI: the random generator makes assumptions about the integer size. See platform.info for more details.
+********************* end of statistics **********************/
+
diff --git a/tests/fuzz/16.c.txt b/tests/fuzz/16.c.txt
new file mode 100644
index 00000000..222e3adc
--- /dev/null
+++ b/tests/fuzz/16.c.txt
@@ -0,0 +1 @@
+checksum = 8C69559B
diff --git a/tests/fuzz/csmith_driver.py b/tests/fuzz/csmith_driver.py
index c987a3be..ecf5d2dc 100755
--- a/tests/fuzz/csmith_driver.py
+++ b/tests/fuzz/csmith_driver.py
@@ -10,7 +10,7 @@ import os, sys, difflib, shutil
from distutils.spawn import find_executable
from subprocess import check_call, Popen, PIPE, STDOUT, CalledProcessError
-sys.path += [os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'tools')]
+sys.path += [os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), 'tools')]
import shared
engine1 = eval('shared.' + sys.argv[1]) if len(sys.argv) > 1 else shared.JS_ENGINES[0]
diff --git a/tests/fuzz/test.sh b/tests/fuzz/test.sh
new file mode 100755
index 00000000..cc77dba4
--- /dev/null
+++ b/tests/fuzz/test.sh
@@ -0,0 +1,23 @@
+# 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 "0"
+gcc $1 -I/home/alon/Dev/csmith/runtime &> /dev/null
+~/Dev/emscripten/emcc $1 -I/home/alon/Dev/csmith/runtime &> /dev/null
+./a.out > o
+mozjs a.out.js > b
+diff o b
+echo "1"
+gcc -O1 $1 -I/home/alon/Dev/csmith/runtime &> /dev/null
+~/Dev/emscripten/emcc -O1 $1 -I/home/alon/Dev/csmith/runtime &> /dev/null
+./a.out > o
+mozjs a.out.js > b
+diff o b
+echo "2"
+gcc -O2 $1 -I/home/alon/Dev/csmith/runtime &> /dev/null
+~/Dev/emscripten/emcc -O2 $1 -I/home/alon/Dev/csmith/runtime &> /dev/null
+./a.out > o
+mozjs a.out.js > b
+diff o b
+
diff --git a/tests/hello_image_sdl.c b/tests/hello_image_sdl.c
new file mode 100644
index 00000000..449798bd
--- /dev/null
+++ b/tests/hello_image_sdl.c
@@ -0,0 +1,43 @@
+#include <stdio.h>
+#include <SDL/SDL.h>
+#include <SDL/SDL_image.h>
+#include <assert.h>
+#include <emscripten.h>
+#include <unistd.h>
+
+int testImage(SDL_Surface* screen, const char* fileName) {
+ SDL_Surface *image = IMG_Load(fileName);
+ if (!image)
+ {
+ printf("IMG_Load: %s\n", IMG_GetError());
+ return 0;
+ }
+ assert(image->format->BitsPerPixel == 32);
+ assert(image->format->BytesPerPixel == 4);
+ assert(image->pitch == 4*image->w);
+ int result = image->w;
+
+ SDL_BlitSurface (image, NULL, screen, NULL);
+ SDL_FreeSurface (image);
+
+ return result;
+}
+
+int main() {
+ SDL_Init(SDL_INIT_VIDEO);
+ SDL_Surface *screen = SDL_SetVideoMode(600, 450, 32, SDL_SWSURFACE);
+
+ int result = 0;
+
+ result |= testImage(screen, "screenshot.jpg"); // absolute path
+ assert(result != 0);
+
+ SDL_Flip(screen);
+
+ printf("you should see an image.\n");
+
+ SDL_Quit();
+
+ return 0;
+}
+
diff --git a/tests/hello_world_exit.c b/tests/hello_world_exit.c
new file mode 100644
index 00000000..8932caf2
--- /dev/null
+++ b/tests/hello_world_exit.c
@@ -0,0 +1,15 @@
+#include<stdio.h>
+#include<stdlib.h>
+
+int main(int argc, char **argv) {
+ printf("argc: %d\n", argc);
+ for(int i = 0; i < argc; ++i) {
+ printf("argv[%d]: %s\n", i, argv[i]);
+ }
+ if (argc <= 1)
+ exit(1);
+ printf("hello, world!\n");
+ fprintf(stderr, "hello, error stream!\n");
+ exit(100);
+}
+
diff --git a/tests/runner.py b/tests/runner.py
index 8a5e1129..37e307e9 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -328,7 +328,10 @@ process(sys.argv[1])
os.makedirs(ret)
return ret
- def get_library(self, name, generated_libs, configure=['sh', './configure'], configure_args=[], make=['make'], make_args=['-j', '2'], cache=True, env_init={}, cache_name_extra='', native=False):
+ def get_library(self, name, generated_libs, configure=['sh', './configure'], configure_args=[], make=['make'], make_args='help', cache=True, env_init={}, cache_name_extra='', native=False):
+ if make_args == 'help':
+ make_args = ['-j', str(multiprocessing.cpu_count())]
+
build_dir = self.get_build_dir()
output_dir = self.get_dir()
diff --git a/tests/test_benchmark.py b/tests/test_benchmark.py
index 63e0041f..284d7c22 100644
--- a/tests/test_benchmark.py
+++ b/tests/test_benchmark.py
@@ -14,6 +14,113 @@ DEFAULT_ARG = '4'
TEST_REPS = 2
+CORE_BENCHMARKS = True # core benchmarks vs full regression suite
+
+class Benchmarker:
+ def __init__(self, name):
+ self.name = name
+
+ def bench(self, args, output_parser=None):
+ self.times = []
+ for i in range(TEST_REPS):
+ start = time.time()
+ output = self.run(args)
+ if not output_parser:
+ curr = time.time()-start
+ else:
+ curr = output_parser(output)
+ self.times.append(curr)
+
+ def display(self, baseline=None):
+ if baseline == self: baseline = None
+ mean = sum(self.times)/len(self.times)
+ squared_times = map(lambda x: x*x, self.times)
+ mean_of_squared = sum(squared_times)/len(self.times)
+ std = math.sqrt(mean_of_squared - mean*mean)
+ sorted_times = self.times[:]
+ sorted_times.sort()
+ median = sum(sorted_times[len(sorted_times)/2 - 1:len(sorted_times)/2 + 1])/2
+
+ print ' %10s: mean: %4.3f (+-%4.3f) secs median: %4.3f range: %4.3f-%4.3f (noise: %4.3f%%) (%d runs)' % (self.name, mean, std, median, min(self.times), max(self.times), 100*std/mean, TEST_REPS),
+
+ if baseline:
+ mean_baseline = sum(baseline.times)/len(baseline.times)
+ final = mean / mean_baseline
+ print ' Relative: %.2f X slower' % final
+ else:
+ print
+
+class NativeBenchmarker(Benchmarker):
+ def __init__(self, name, cc, cxx):
+ self.name = name
+ self.cc = cc
+ self.cxx = cxx
+
+ def build(self, parent, filename, args, shared_args, emcc_args, native_args, native_exec, lib_builder):
+ self.parent = parent
+ if lib_builder: native_args += lib_builder(self.name, native=True, env_init={ 'CC': self.cc, 'CXX': self.cxx })
+ if not native_exec:
+ compiler = self.cxx if filename.endswith('cpp') else self.cc
+ process = Popen([compiler, '-O2', '-fno-math-errno', filename, '-o', filename+'.native'] + shared_args + native_args, stdout=PIPE, stderr=parent.stderr_redirect)
+ output = process.communicate()
+ if process.returncode is not 0:
+ print >> sys.stderr, "Building native executable with command '%s' failed with a return code %d!" % (' '.join([compiler, '-O2', filename, '-o', filename+'.native']), process.returncode)
+ print "Output: " + output[0]
+ else:
+ print '(using clang)'
+ shutil.copyfile(native_exec, filename + '.native')
+ shutil.copymode(native_exec, filename + '.native')
+ self.filename = filename
+
+ def run(self, args):
+ process = Popen([self.filename+'.native'] + args, stdout=PIPE, stderr=PIPE)
+ return process.communicate()[0]
+
+class JSBenchmarker(Benchmarker):
+ def __init__(self, name, engine, extra_args=[]):
+ self.name = name
+ self.engine = engine
+ self.extra_args = extra_args
+
+ def build(self, parent, filename, args, shared_args, emcc_args, native_args, native_exec, lib_builder):
+ self.filename = filename
+ if lib_builder: emcc_args += lib_builder('js', native=False, env_init={})
+
+ open('hardcode.py', 'w').write('''
+def process(filename):
+ js = open(filename).read()
+ replaced = js.replace("run();", "run(%s.concat(Module[\\"arguments\\"]));")
+ assert js != replaced
+ open(filename, 'w').write(replaced)
+import sys
+process(sys.argv[1])
+''' % str(args[:-1]) # do not hardcode in the last argument, the default arg
+)
+
+ try_delete(filename + '.js')
+ output = Popen([PYTHON, EMCC, filename, #'-O3',
+ '-O2', '-s', 'DOUBLE_MODE=0', '-s', 'PRECISE_I64_MATH=0',
+ '--memory-init-file', '0', '--js-transform', 'python hardcode.py',
+ '-s', 'TOTAL_MEMORY=128*1024*1024',
+ #'--closure', '1',
+ #'-g',
+ '-o', filename + '.js'] + shared_args + emcc_args + self.extra_args, stdout=PIPE, stderr=PIPE).communicate()
+ assert os.path.exists(filename + '.js'), 'Failed to compile file: ' + output[0]
+
+ def run(self, args):
+ return run_js(self.filename + '.js', engine=self.engine, args=args, stderr=PIPE, full_output=True)
+
+# Benchmarkers
+benchmarkers = [
+ NativeBenchmarker('clang', CLANG_CC, CLANG),
+ NativeBenchmarker('gcc', 'gcc', 'g++'),
+ JSBenchmarker('sm-f32', SPIDERMONKEY_ENGINE, ['-s', 'PRECISE_F32=2']),
+ JSBenchmarker('sm', SPIDERMONKEY_ENGINE),
+ #JSBenchmarker('sm-noasm', SPIDERMONKEY_ENGINE + ['--no-asmjs']),
+ #JSBenchmarker('sm-noasm-f32', SPIDERMONKEY_ENGINE + ['--no-asmjs'], ['-s', 'PRECISE_F32=2']),
+ JSBenchmarker('v8', V8_ENGINE)
+]
+
class benchmark(RunnerCore):
save_dir = True
@@ -49,47 +156,7 @@ class benchmark(RunnerCore):
Building.COMPILER = CLANG
Building.COMPILER_TEST_OPTS = []
- # Pick the JS engine to benchmark. If you specify one, it will be picked. For example, python tests/runner.py benchmark SPIDERMONKEY_ENGINE
- global JS_ENGINE
- JS_ENGINE = Building.JS_ENGINE_OVERRIDE if Building.JS_ENGINE_OVERRIDE is not None else JS_ENGINES[0]
- print 'Benchmarking JS engine: %s' % JS_ENGINE
-
- def print_stats(self, times, native_times, last=False, reps=TEST_REPS):
- if reps == 0:
- print '(no reps)'
- return
- mean = sum(times)/len(times)
- squared_times = map(lambda x: x*x, times)
- mean_of_squared = sum(squared_times)/len(times)
- std = math.sqrt(mean_of_squared - mean*mean)
- sorted_times = times[:]
- sorted_times.sort()
- median = sum(sorted_times[len(sorted_times)/2 - 1:len(sorted_times)/2 + 1])/2
-
- mean_native = sum(native_times)/len(native_times)
- squared_native_times = map(lambda x: x*x, native_times)
- mean_of_squared_native = sum(squared_native_times)/len(native_times)
- std_native = math.sqrt(mean_of_squared_native - mean_native*mean_native)
- sorted_native_times = native_times[:]
- sorted_native_times.sort()
- median_native = sum(sorted_native_times[len(sorted_native_times)/2 - 1:len(sorted_native_times)/2 + 1])/2
-
- final = mean / mean_native
-
- if last:
- norm = 0
- for i in range(len(times)):
- norm += times[i]/native_times[i]
- norm /= len(times)
- print
- print ' JavaScript: %.3f Native: %.3f Ratio: %.3f Normalized ratio: %.3f' % (mean, mean_native, final, norm)
- return
-
- print
- print ' JavaScript: mean: %.3f (+-%.3f) secs median: %.3f range: %.3f-%.3f (noise: %3.3f%%) (%d runs)' % (mean, std, median, min(times), max(times), 100*std/mean, reps)
- print ' Native : mean: %.3f (+-%.3f) secs median: %.3f range: %.3f-%.3f (noise: %3.3f%%) JS is %.2f X slower' % (mean_native, std_native, median_native, min(native_times), max(native_times), 100*std_native/mean_native, final)
-
- 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):
+ 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):
args = args or [DEFAULT_ARG]
if args_processor: args = args_processor(args)
@@ -98,68 +165,12 @@ class benchmark(RunnerCore):
f = open(filename, 'w')
f.write(src)
f.close()
- final_filename = os.path.join(dirname, name + '.js')
-
- open('hardcode.py', 'w').write('''
-def process(filename):
- js = open(filename).read()
- replaced = js.replace("run();", "run(%s.concat(Module[\\"arguments\\"]));")
- assert js != replaced
- open(filename, 'w').write(replaced)
-import sys
-process(sys.argv[1])
-''' % str(args[:-1]) # do not hardcode in the last argument, the default arg
-)
- try_delete(final_filename)
- output = Popen([PYTHON, EMCC, filename, #'-O3',
- '-O2', '-s', 'DOUBLE_MODE=0', '-s', 'PRECISE_I64_MATH=0',
- '--memory-init-file', '0', '--js-transform', 'python hardcode.py',
- '-s', 'TOTAL_MEMORY=128*1024*1024',
- '--closure', '1',
- #'-s', 'PRECISE_F32=1',
- #'-g',
- '-o', final_filename] + shared_args + emcc_args, stdout=PIPE, stderr=self.stderr_redirect).communicate()
- assert os.path.exists(final_filename), 'Failed to compile file: ' + output[0]
-
- # Run JS
- times = []
- for i in range(reps):
- start = time.time()
- js_output = run_js(final_filename, engine=JS_ENGINE, args=args, stderr=PIPE, full_output=True)
-
- if i == 0 and 'uccessfully compiled asm.js code' in js_output:
- if 'asm.js link error' not in js_output:
- print "[%s was asm.js'ified]" % name
- if not output_parser:
- curr = time.time()-start
- else:
- curr = output_parser(js_output)
- times.append(curr)
- if i == 0:
- # Sanity check on output
- self.assertContained(expected_output, js_output)
-
- # Run natively
- if not native_exec:
- self.build_native(filename, shared_args + native_args)
- else:
- shutil.copyfile(native_exec, filename + '.native')
- shutil.copymode(native_exec, filename + '.native')
- native_times = []
- for i in range(reps):
- start = time.time()
- native_output = self.run_native(filename, args)
- if i == 0:
- # Sanity check on output
- self.assertContained(expected_output, native_output)
- if not output_parser:
- curr = time.time()-start
- else:
- curr = output_parser(native_output)
- native_times.append(curr)
-
- self.print_stats(times, native_times, reps=reps)
+ print
+ for b in benchmarkers:
+ b.build(self, filename, args, shared_args, emcc_args, native_args, native_exec, lib_builder)
+ b.bench(args, output_parser)
+ b.display(benchmarkers[0])
def test_primes(self):
src = r'''
@@ -402,9 +413,11 @@ process(sys.argv[1])
self.fasta('fasta_float', 'float')
def test_fasta_double(self):
+ if CORE_BENCHMARKS: return
self.fasta('fasta_double', 'double')
def test_fasta_double_full(self):
+ if CORE_BENCHMARKS: return
self.fasta('fasta_double_full', 'double', emcc_args=['-s', 'DOUBLE_MODE=1'])
def test_skinning(self):
@@ -412,10 +425,12 @@ process(sys.argv[1])
self.do_benchmark('skinning', src, 'blah=0.000000')
def test_life(self):
+ if CORE_BENCHMARKS: return
src = open(path_from_root('tests', 'life.c'), 'r').read()
self.do_benchmark('life', src, '''--------------------------------''', shared_args=['-std=c99'], force_c=True)
def test_linpack_double(self):
+ if CORE_BENCHMARKS: return
def output_parser(output):
return 100.0/float(re.search('Unrolled Double Precision +([\d\.]+) Mflops', output).group(1))
self.do_benchmark('linpack_double', open(path_from_root('tests', 'linpack.c')).read(), '''Unrolled Double Precision''', force_c=True, output_parser=output_parser)
@@ -426,6 +441,7 @@ process(sys.argv[1])
self.do_benchmark('linpack_float', open(path_from_root('tests', 'linpack.c')).read(), '''Unrolled Single Precision''', force_c=True, output_parser=output_parser, shared_args=['-DSP'])
def test_zzz_java_nbody(self): # tests xmlvm compiled java, including bitcasts of doubles, i64 math, etc.
+ if CORE_BENCHMARKS: return
args = [path_from_root('tests', 'nbody-java', x) for x in os.listdir(path_from_root('tests', 'nbody-java')) if x.endswith('.c')] + \
['-I' + path_from_root('tests', 'nbody-java')]
self.do_benchmark('nbody_java', '', '''Time(s)''',
@@ -458,42 +474,29 @@ process(sys.argv[1])
def test_zzz_zlib(self):
src = open(path_from_root('tests', 'zlib', 'benchmark.c'), 'r').read()
- emcc_args = self.get_library('zlib', os.path.join('libz.a'), make_args=['libz.a']) + \
- ['-I' + path_from_root('tests', 'zlib')]
- native_args = self.get_library('zlib_native', os.path.join('libz.a'), make_args=['libz.a'], native=True) + \
- ['-I' + path_from_root('tests', 'zlib')]
+ def lib_builder(name, native, env_init):
+ return self.get_library('zlib', os.path.join('libz.a'), make_args=['libz.a'], native=native, cache_name_extra=name, env_init=env_init)
self.do_benchmark('zlib', src, '''ok.''',
- force_c=True, emcc_args=emcc_args, native_args=native_args)
+ force_c=True, shared_args=['-I' + path_from_root('tests', 'zlib')], lib_builder=lib_builder)
def test_zzz_box2d(self): # Called thus so it runs late in the alphabetical cycle... it is long
src = open(path_from_root('tests', 'box2d', 'Benchmark.cpp'), 'r').read()
-
- js_lib = self.get_library('box2d', [os.path.join('box2d.a')], configure=None)
- native_lib = self.get_library('box2d_native', [os.path.join('box2d.a')], configure=None, native=True)
-
- emcc_args = js_lib + ['-I' + path_from_root('tests', 'box2d')]
- native_args = native_lib + ['-I' + path_from_root('tests', 'box2d')]
-
- self.do_benchmark('box2d', src, 'frame averages', emcc_args=emcc_args, native_args=native_args)
+ def lib_builder(name, native, env_init):
+ return self.get_library('box2d', [os.path.join('box2d.a')], configure=None, native=native, cache_name_extra=name, env_init=env_init)
+ self.do_benchmark('box2d', src, 'frame averages', shared_args=['-I' + path_from_root('tests', 'box2d')], lib_builder=lib_builder)
def test_zzz_bullet(self): # Called thus so it runs late in the alphabetical cycle... it is long
src = open(path_from_root('tests', 'bullet', 'Demos', 'Benchmarks', 'BenchmarkDemo.cpp'), 'r').read() + \
open(path_from_root('tests', 'bullet', 'Demos', 'Benchmarks', 'main.cpp'), 'r').read()
- js_lib = self.get_library('bullet', [os.path.join('src', '.libs', 'libBulletDynamics.a'),
+ def lib_builder(name, native, env_init):
+ return self.get_library('bullet', [os.path.join('src', '.libs', 'libBulletDynamics.a'),
os.path.join('src', '.libs', 'libBulletCollision.a'),
os.path.join('src', '.libs', 'libLinearMath.a')],
- configure_args=['--disable-demos','--disable-dependency-tracking'])
- native_lib = self.get_library('bullet_native', [os.path.join('src', '.libs', 'libBulletDynamics.a'),
- os.path.join('src', '.libs', 'libBulletCollision.a'),
- os.path.join('src', '.libs', 'libLinearMath.a')],
- configure_args=['--disable-demos','--disable-dependency-tracking'],
- native=True)
-
- emcc_args = js_lib + ['-I' + path_from_root('tests', 'bullet', 'src'),
- '-I' + path_from_root('tests', 'bullet', 'Demos', 'Benchmarks'),
- '-s', 'DEAD_FUNCTIONS=["__ZSt9terminatev"]']
- native_args = native_lib + ['-I' + path_from_root('tests', 'bullet', 'src'),
- '-I' + path_from_root('tests', 'bullet', 'Demos', 'Benchmarks')]
-
- self.do_benchmark('bullet', src, '\nok.\n', emcc_args=emcc_args, native_args=native_args)
+ configure_args=['--disable-demos','--disable-dependency-tracking'], native=native, cache_name_extra=name, env_init=env_init)
+
+ emcc_args = ['-s', 'DEAD_FUNCTIONS=["__ZSt9terminatev"]']
+
+ self.do_benchmark('bullet', src, '\nok.\n', emcc_args=emcc_args, shared_args=['-I' + path_from_root('tests', 'bullet', 'src'),
+ '-I' + path_from_root('tests', 'bullet', 'Demos', 'Benchmarks')], lib_builder=lib_builder)
+
diff --git a/tests/test_browser.py b/tests/test_browser.py
index d0618af8..30d3b930 100644
--- a/tests/test_browser.py
+++ b/tests/test_browser.py
@@ -119,6 +119,13 @@ If manually bisecting:
Even better, add a breakpoint, e.g. on the printf, then reload, then step through and see the print (best to run with EM_SAVE_DIR=1 for the reload).
'''
+ def test_emscripten_log(self):
+ src = os.path.join(self.get_dir(), 'src.cpp')
+ open(src, 'w').write(self.with_report_result(open(path_from_root('tests', 'emscripten_log', 'emscripten_log.cpp')).read()))
+
+ Popen([PYTHON, EMCC, src, '--pre-js', path_from_root('src', 'emscripten-source-map.min.js'), '-g', '-o', 'page.html']).communicate()
+ self.run_browser('page.html', None, '/report_result?1')
+
def build_native_lzma(self):
lzma_native = path_from_root('third_party', 'lzma.js', 'lzma-native')
if os.path.isfile(lzma_native) and os.access(lzma_native, os.X_OK): return
@@ -1680,3 +1687,32 @@ keydown(100);keyup(100); // trigger the end
open(self.in_dir('data.dat'), 'w').write('data from the file ' + ('.' * 9000))
for extra_args in [[], ['--no-heap-copy']]:
self.btest(path_from_root('tests', 'mmap_file.c'), expected='1', args=['--preload-file', 'data.dat'] + extra_args)
+
+ def test_emrun_info(self):
+ result = subprocess.check_output([PYTHON, path_from_root('emrun'), '--system_info', '--browser_info'])
+ assert 'CPU' in result
+ assert 'Browser' in result
+ assert 'Traceback' not in result
+
+ result = subprocess.check_output([PYTHON, path_from_root('emrun'), '--list_browsers'])
+ assert 'Traceback' not in result
+
+ def test_emrun(self):
+ Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world_exit.c'), '--emrun', '-o', 'hello_world.html']).communicate()
+ outdir = os.getcwd()
+ # We cannot run emrun from the temp directory the suite will clean up afterwards, since the browser that is launched will have that directory as startup directory,
+ # and the browser will not close as part of the test, pinning down the cwd on Windows and it wouldn't be possible to delete it. Therefore switch away from that directory
+ # before launching.
+ os.chdir(path_from_root())
+ args = [PYTHON, path_from_root('emrun'), '--timeout', '30', '--verbose', os.path.join(outdir, 'hello_world.html'), '1', '2', '3', '--log_stdout', os.path.join(outdir, 'stdout.txt'), '--log_stderr', os.path.join(outdir, 'stderr.txt')]
+ if emscripten_browser is not None:
+ args += ['--browser', emscripten_browser]
+ process = subprocess.Popen(args)
+ process.communicate()
+ stdout = open(os.path.join(outdir, 'stdout.txt'), 'r').read()
+ stderr = open(os.path.join(outdir, 'stderr.txt'), 'r').read()
+ assert process.returncode == 100
+ assert 'argc: 4' in stdout
+ assert 'argv[3]: 3' in stdout
+ assert 'hello, world!' in stdout
+ assert 'hello, error stream!' in stderr
diff --git a/tests/test_core.py b/tests/test_core.py
index 9b072b90..80fb3cc5 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -351,6 +351,9 @@ 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'
@@ -459,6 +462,8 @@ 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')
@@ -520,7 +525,7 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
os.environ['EMSCRIPT_MAX_CHUNK_SIZE'] = old_chunk_size
assert 'asm1' in test_modes
- if self.run_name == 'asm1':
+ if self.run_name == 'asm1' and not os.environ.get('EMCC_FAST_COMPILER'):
assert Settings.RELOOP
generated = open('src.cpp.o.js').read()
main = generated[generated.find('function _main'):]
@@ -1086,36 +1091,48 @@ 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(self):
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
+
test_path = path_from_root('tests', 'core', 'test_longjmp')
src, output = (test_path + s for s in ('.in', '.out'))
self.do_run_from_file(src, output)
def test_longjmp2(self):
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
+
test_path = path_from_root('tests', 'core', 'test_longjmp2')
src, output = (test_path + s for s in ('.in', '.out'))
self.do_run_from_file(src, output)
def test_longjmp3(self):
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
+
test_path = path_from_root('tests', 'core', 'test_longjmp3')
src, output = (test_path + s for s in ('.in', '.out'))
self.do_run_from_file(src, output)
def test_longjmp4(self):
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
+
test_path = path_from_root('tests', 'core', 'test_longjmp4')
src, output = (test_path + s for s in ('.in', '.out'))
self.do_run_from_file(src, output)
def test_longjmp_funcptr(self):
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
+
test_path = path_from_root('tests', 'core', 'test_longjmp_funcptr')
src, output = (test_path + s for s in ('.in', '.out'))
self.do_run_from_file(src, output)
def test_longjmp_repeat(self):
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
+
Settings.MAX_SETJMPS = 1
test_path = path_from_root('tests', 'core', 'test_longjmp_repeat')
@@ -1124,6 +1141,8 @@ 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_stacked(self):
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
+
test_path = path_from_root('tests', 'core', 'test_longjmp_stacked')
src, output = (test_path + s for s in ('.in', '.out'))
@@ -1131,12 +1150,16 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
def test_longjmp_exc(self):
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
+
test_path = path_from_root('tests', 'core', 'test_longjmp_exc')
src, output = (test_path + s for s in ('.in', '.out'))
self.do_run_from_file(src, output)
def test_setjmp_many(self):
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
+
src = r'''
#include <stdio.h>
#include <setjmp.h>
@@ -1155,6 +1178,7 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
def test_exceptions(self):
if Settings.QUANTUM_SIZE == 1: return self.skip("we don't support libcxx in q1")
if self.emcc_args is None: return self.skip('need emcc to add in libcxx properly')
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
Settings.EXCEPTION_DEBUG = 1
@@ -1243,6 +1267,7 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
def test_exception_2(self):
if self.emcc_args is None: return self.skip('need emcc to add in libcxx properly')
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
Settings.DISABLE_EXCEPTION_CATCHING = 0
test_path = path_from_root('tests', 'core', 'test_exception_2')
@@ -1251,6 +1276,8 @@ 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_white_list_exception(self):
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
+
Settings.DISABLE_EXCEPTION_CATCHING = 2
Settings.EXCEPTION_CATCHING_WHITELIST = ["__Z12somefunctionv"]
Settings.INLINING_LIMIT = 50 # otherwise it is inlined and not identified
@@ -1265,6 +1292,7 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
def test_uncaught_exception(self):
if self.emcc_args is None: return self.skip('no libcxx inclusion without emcc')
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
Settings.DISABLE_EXCEPTION_CATCHING = 0
@@ -1303,6 +1331,8 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
self.do_run(src, 'success')
def test_typed_exceptions(self):
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
+
Settings.DISABLE_EXCEPTION_CATCHING = 0
Settings.SAFE_HEAP = 0 # Throwing null will cause an ignorable null pointer access.
src = open(path_from_root('tests', 'exceptions', 'typed.cpp'), 'r').read()
@@ -1310,6 +1340,8 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
self.do_run(src, expected)
def test_multiexception(self):
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
+
Settings.DISABLE_EXCEPTION_CATCHING = 0
test_path = path_from_root('tests', 'core', 'test_multiexception')
@@ -1319,6 +1351,7 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
def test_std_exception(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.DISABLE_EXCEPTION_CATCHING = 0
self.emcc_args += ['-s', 'SAFE_HEAP=0']
@@ -1844,12 +1877,9 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
self.do_run_from_file(src, output, [], lambda x, err: x.replace('\n', '*'))
- def test_float_h(self):
- process = Popen([PYTHON, EMCC, path_from_root('tests', 'float+.c')], stdout=PIPE, stderr=PIPE)
- process.communicate()
- assert process.returncode is 0, 'float.h should agree with our system'
-
def test_llvm_used(self):
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('pnacl kills llvm_used')
+
Building.LLVM_OPTS = 3
test_path = path_from_root('tests', 'core', 'test_llvm_used')
@@ -1885,6 +1915,7 @@ def process(filename):
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('todo in fastcomp')
test_path = path_from_root('tests', 'core', 'test_inlinejs')
src, output = (test_path + s for s in ('.in', '.out'))
@@ -1897,6 +1928,7 @@ def process(filename):
def test_inlinejs2(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('todo in fastcomp')
test_path = path_from_root('tests', 'core', 'test_inlinejs2')
src, output = (test_path + s for s in ('.in', '.out'))
@@ -2027,6 +2059,7 @@ def process(filename):
def test_bigswitch(self):
if self.run_name != 'default': return self.skip('TODO: issue #781')
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
src = open(path_from_root('tests', 'bigswitch.cpp')).read()
self.do_run(src, '''34962: GL_ARRAY_BUFFER (0x8892)
@@ -2035,6 +2068,8 @@ 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')
@@ -2043,6 +2078,8 @@ 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')
@@ -2488,6 +2525,8 @@ The current type of b is: 9
self.do_run_from_file(src, output)
def test_intentional_fault(self):
+ if os.environ.get('EMCC_FAST_COMPILER') == '1' and self.run_name == 'default': return self.skip('todo in fastcomp in default')
+
# Some programs intentionally segfault themselves, we should compile that into a throw
src = r'''
int main () {
@@ -2689,6 +2728,10 @@ The current type of b is: 9
self.do_run(main, 'supp: 54,2\nmain: 56\nsupp see: 543\nmain see: 76\nok.')
def can_dlfcn(self):
+ if os.environ.get('EMCC_FAST_COMPILER') == '1':
+ self.skip('todo in fastcomp')
+ return False
+
if self.emcc_args and '--memory-init-file' in self.emcc_args:
for i in range(len(self.emcc_args)):
if self.emcc_args[i] == '--memory-init-file':
@@ -3067,6 +3110,7 @@ def process(filename):
def test_dlfcn_self(self):
if Settings.USE_TYPED_ARRAYS == 1: return self.skip('Does not work with USE_TYPED_ARRAYS=1')
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
Settings.DLOPEN_SUPPORT = 1
def post(filename):
@@ -4016,6 +4060,8 @@ def process(filename):
def test_utf32(self):
if self.emcc_args is None: return self.skip('need libc for wcslen()')
if not self.is_le32(): return self.skip('this test uses inline js, which requires le32')
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
+
self.do_run(open(path_from_root('tests', 'utf32.cpp')).read(), 'OK.')
self.do_run(open(path_from_root('tests', 'utf32.cpp')).read(), 'OK.', args=['-fshort-wchar'])
@@ -4550,6 +4596,7 @@ return malloc(size);
def test_simd(self):
if Settings.USE_TYPED_ARRAYS != 2: return self.skip('needs ta2')
if Settings.ASM_JS: Settings.ASM_JS = 2 # does not validate
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
test_path = path_from_root('tests', 'core', 'test_simd')
src, output = (test_path + s for s in ('.in', '.out'))
@@ -4558,6 +4605,7 @@ return malloc(size);
def test_simd2(self):
if Settings.ASM_JS: Settings.ASM_JS = 2 # does not validate
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
test_path = path_from_root('tests', 'core', 'test_simd2')
src, output = (test_path + s for s in ('.in', '.out'))
@@ -4567,6 +4615,7 @@ return malloc(size);
def test_simd3(self):
if Settings.USE_TYPED_ARRAYS != 2: return self.skip('needs ta2')
if Settings.ASM_JS: Settings.ASM_JS = 2 # does not validate
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
test_path = path_from_root('tests', 'core', 'test_simd3')
src, output = (test_path + s for s in ('.in', '.out'))
@@ -4593,6 +4642,7 @@ return malloc(size);
def test_lua(self):
if self.emcc_args is None: return self.skip('requires emcc')
if Settings.QUANTUM_SIZE == 1: return self.skip('TODO: make this work')
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
self.do_run('',
'hello lua world!\n17\n1\n2\n3\n4\n7',
@@ -4610,6 +4660,7 @@ return malloc(size);
def test_freetype(self):
if self.emcc_args is None: return self.skip('requires emcc')
if Settings.QUANTUM_SIZE == 1: return self.skip('TODO: Figure out and try to fix')
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
assert 'asm2g' in test_modes
if self.run_name == 'asm2g':
@@ -4742,7 +4793,7 @@ def process(filename):
test()
assert 'asm2g' in test_modes
- if self.run_name == 'asm2g' and not use_cmake:
+ if self.run_name == 'asm2g' and not use_cmake and os.environ.get('EMCC_FAST_COMPILER') != '1':
# Test forced alignment
print >> sys.stderr, 'testing FORCE_ALIGNED_MEMORY'
old = open('src.cpp.o.js').read()
@@ -4755,6 +4806,7 @@ def process(filename):
def test_poppler(self):
if self.emcc_args is None: return self.skip('very slow, we only do this in emcc runs')
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
Settings.CORRECT_OVERFLOWS = 1
Settings.CORRECT_SIGNS = 1
@@ -4970,11 +5022,12 @@ def process(filename):
shortname = name.replace('.ll', '')
if '' not in shortname: continue
if os.environ.get('EMCC_FAST_COMPILER') == '1' and os.path.basename(shortname) in [
- 'structparam', 'uadd_overflow_ta2', 'extendedprecision', 'issue_39', 'emptystruct', 'phinonexist', 'quotedlabel', 'oob_ta2', # invalid ir
- 'structphiparam', 'callwithstructural_ta2', # pnacl limitation in ExpandStructRegs
+ 'structparam', 'uadd_overflow_ta2', 'extendedprecision', 'issue_39', 'emptystruct', 'phinonexist', 'quotedlabel', 'oob_ta2', 'phientryimplicit', 'phiself', 'invokebitcast', # invalid ir
+ 'structphiparam', 'callwithstructural_ta2', 'callwithstructural64_ta2', 'structinparam', # pnacl limitations in ExpandStructRegs
+ '2xi40', # pnacl limitations in ExpandGetElementPtr
'legalizer_ta2', '514_ta2', # pnacl limitation in not legalizing i104, i96, etc.
- 'longjmp_tiny', 'longjmp_tiny_phi', 'indirectbrphi', 'ptrtoint_blockaddr', 'quoted', # current fastcomp limitations FIXME
- 'sillyfuncast', # TODO very very soon XXX
+ 'longjmp_tiny', 'longjmp_tiny_invoke', 'longjmp_tiny_phi', 'longjmp_tiny_phi2', 'indirectbrphi', 'ptrtoint_blockaddr', 'quoted', # current fastcomp limitations FIXME
+ 'sillyfuncast', 'sillyfuncast2', 'sillybitcast', # TODO very very soon XXX
]: continue
if '_ta2' in shortname and not Settings.USE_TYPED_ARRAYS == 2:
print self.skip('case "%s" only relevant for ta2' % shortname)
@@ -5019,6 +5072,7 @@ def process(filename):
def run_all(x):
print x
for name in glob.glob(path_from_root('tests', 'fuzz', '*.c')):
+ #if os.path.basename(name) != '4.c': continue
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)
@@ -5378,6 +5432,7 @@ def process(filename):
def test_embind(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')
Building.COMPILER_TEST_OPTS += ['--bind']
src = r'''
@@ -5400,6 +5455,7 @@ def process(filename):
def test_embind_2(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')
Building.COMPILER_TEST_OPTS += ['--bind', '--post-js', 'post.js']
open('post.js', 'w').write('''
Module.print('lerp ' + Module.lerp(1, 2, 0.66) + '.');
@@ -5420,6 +5476,7 @@ 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
@@ -5909,6 +5966,7 @@ def process(filename):
def test_source_map(self):
if Settings.USE_TYPED_ARRAYS != 2: return self.skip("doesn't pass without typed arrays")
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
if NODE_JS not in JS_ENGINES: return self.skip('sourcemapper requires Node to run')
if '-g' not in Building.COMPILER_TEST_OPTS: Building.COMPILER_TEST_OPTS.append('-g')
@@ -5992,6 +6050,7 @@ def process(filename):
if Settings.USE_TYPED_ARRAYS != 2: return self.skip("doesn't pass without typed arrays")
if '-g4' not in Building.COMPILER_TEST_OPTS: Building.COMPILER_TEST_OPTS.append('-g4')
if NODE_JS not in JS_ENGINES: return self.skip('sourcemapper requires Node to run')
+ if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
src = '''
#include <stdio.h>
@@ -6023,6 +6082,11 @@ def process(filename):
dirname = self.get_dir()
self.build(src, dirname, os.path.join(dirname, 'src.cpp'), post_build=(None, post))
+ def test_emscripten_log(self):
+ if self.emcc_args is None: return self.skip('This test needs libc.')
+ if '-g' not in Building.COMPILER_TEST_OPTS: Building.COMPILER_TEST_OPTS.append('-g')
+ self.do_run('#define RUN_FROM_JS_SHELL\n' + open(path_from_root('tests', 'emscripten_log', 'emscripten_log.cpp')).read(), "Success!")
+
def test_linespecific(self):
if Settings.ASM_JS: return self.skip('asm always has corrections on')
@@ -6303,7 +6367,7 @@ def make_run(fullname, name=-1, compiler=-1, embetter=0, quantum_size=0,
return TT
# Make one run with the defaults
-default = make_run("default", compiler=CLANG, emcc_args=[])
+default = make_run("default", compiler=CLANG, emcc_args=[] if os.environ.get('EMCC_FAST_COMPILER') != '1' else ['-s', 'ASM_JS=1'])
# Make one run with -O1, with safe heap
o1 = make_run("o1", compiler=CLANG, emcc_args=["-O1", "-s", "ASM_JS=0", "-s", "SAFE_HEAP=1"])
diff --git a/tests/test_egl.c b/tests/test_egl.c
index 5864a797..d66949d0 100644
--- a/tests/test_egl.c
+++ b/tests/test_egl.c
@@ -37,12 +37,21 @@ int main(int argc, char *argv[])
assert(eglGetError() == EGL_SUCCESS);
assert(surface != 0);
+ // WebGL maps to GLES2. GLES1 is not supported.
+ EGLint contextAttribsOld[] =
+ {
+ EGL_CONTEXT_CLIENT_VERSION, 1,
+ EGL_NONE
+ };
+ EGLContext context = eglCreateContext(display, config, NULL, contextAttribsOld);
+ assert(eglGetError() != EGL_SUCCESS);
+
EGLint contextAttribs[] =
{
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
- EGLContext context = eglCreateContext(display, config, NULL, contextAttribs);
+ context = eglCreateContext(display, config, NULL, contextAttribs);
assert(eglGetError() == EGL_SUCCESS);
assert(context != 0);
diff --git a/tests/test_other.py b/tests/test_other.py
index 30546ae8..c0f926df 100644
--- a/tests/test_other.py
+++ b/tests/test_other.py
@@ -843,7 +843,7 @@ f.close()
for test_opts, expected_ranges in [
([], {
- 100: (190, 275),
+ 100: (190, 500),
250: (200, 500),
500: (250, 500),
1000: (230, 1000),
@@ -2176,3 +2176,8 @@ mergeInto(LibraryManager.library, {
Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world.cpp'), '--js-library', 'lib.js']).communicate()
self.assertContained('hello, world!', run_js(os.path.join(self.get_dir(), 'a.out.js')))
+ def test_float_h(self):
+ process = Popen([PYTHON, EMCC, path_from_root('tests', 'float+.c')], stdout=PIPE, stderr=PIPE)
+ out, err = process.communicate()
+ assert process.returncode is 0, 'float.h should agree with our system: ' + out + '\n\n\n' + err
+
diff --git a/tests/test_sanity.py b/tests/test_sanity.py
index c7dd86e4..dc3d53db 100644
--- a/tests/test_sanity.py
+++ b/tests/test_sanity.py
@@ -548,3 +548,31 @@ fi
if old:
os.environ['EMCC_LLVM_TARGET'] = old
+ def test_emconfig(self):
+ restore()
+
+ (fd, custom_config_filename) = tempfile.mkstemp(prefix='.emscripten_config_')
+
+ orig_config = open(CONFIG_FILE, 'r').read()
+
+ # Move the ~/.emscripten to a custom location.
+ tfile = os.fdopen(fd, "w")
+ tfile.write(orig_config)
+ tfile.close()
+
+ # Make a syntax error in the original config file so that attempting to access it would fail.
+ open(CONFIG_FILE, 'w').write('asdfasdfasdfasdf\n\'\'\'' + orig_config)
+
+ 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')])
+ result = run_js('a.out.js')
+
+ # Clean up created temp files.
+ os.remove(custom_config_filename)
+ os.chdir(path_from_root())
+ shutil.rmtree(temp_dir)
+
+ self.assertContained('hello, world!', result)
+
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index 57ce0071..57585663 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -585,12 +585,24 @@ function simplifyExpressions(ast) {
}
} else if (type === 'assign') {
// optimizations for assigning into HEAP32 specifically
- if (node[1] === true && node[2][0] === 'sub' && node[2][1][0] === 'name' && node[2][1][1] === 'HEAP32') {
- // HEAP32[..] = x | 0 does not need the | 0 (unless it is a mandatory |0 of a call)
- if (node[3][0] === 'binary' && node[3][1] === '|') {
- if (node[3][2][0] === 'num' && node[3][2][1] === 0 && node[3][3][0] != 'call') {
- node[3] = node[3][3];
- } else if (node[3][3][0] === 'num' && node[3][3][1] === 0 && node[3][2][0] != 'call') {
+ if (node[1] === true && node[2][0] === 'sub' && node[2][1][0] === 'name') {
+ if (node[2][1][1] === 'HEAP32') {
+ // HEAP32[..] = x | 0 does not need the | 0 (unless it is a mandatory |0 of a call)
+ if (node[3][0] === 'binary' && node[3][1] === '|') {
+ if (node[3][2][0] === 'num' && node[3][2][1] === 0 && node[3][3][0] != 'call') {
+ node[3] = node[3][3];
+ } else if (node[3][3][0] === 'num' && node[3][3][1] === 0 && node[3][2][0] != 'call') {
+ node[3] = node[3][2];
+ }
+ }
+ } else if (node[2][1][1] === 'HEAP8') {
+ // HEAP8[..] = x & 0xff does not need the & 0xff
+ if (node[3][0] === 'binary' && node[3][1] === '&' && node[3][3][0] == 'num' && node[3][3][1] == 0xff) {
+ node[3] = node[3][2];
+ }
+ } else if (node[2][1][1] === 'HEAP16') {
+ // HEAP16[..] = x & 0xffff does not need the & 0xffff
+ if (node[3][0] === 'binary' && node[3][1] === '&' && node[3][3][0] == 'num' && node[3][3][1] == 0xffff) {
node[3] = node[3][2];
}
}
diff --git a/tools/shared.py b/tools/shared.py
index 3456ab18..443ff4c7 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -176,13 +176,28 @@ if WINDOWS:
else:
logging.StreamHandler.emit = add_coloring_to_emit_ansi(logging.StreamHandler.emit)
-# Emscripten configuration is done through the EM_CONFIG environment variable.
-# If the string value contained in this environment variable contains newline
-# separated definitions, then these definitions will be used to configure
+# Emscripten configuration is done through the --em-config command line option or
+# the EM_CONFIG environment variable. If the specified string value contains newline
+# or semicolon-separated definitions, then these definitions will be used to configure
# Emscripten. Otherwise, the string is understood to be a path to a settings
# file that contains the required definitions.
-EM_CONFIG = os.environ.get('EM_CONFIG')
+try:
+ EM_CONFIG = sys.argv[sys.argv.index('--em-config')+1]
+ # Emscripten compiler spawns other processes, which can reimport shared.py, so make sure that
+ # those child processes get the same configuration file by setting it to the currently active environment.
+ os.environ['EM_CONFIG'] = EM_CONFIG
+except:
+ EM_CONFIG = os.environ.get('EM_CONFIG')
+
+if EM_CONFIG and not os.path.isfile(EM_CONFIG):
+ if EM_CONFIG.startswith('-'):
+ raise Exception('Passed --em-config without an argument. Usage: --em-config /path/to/.emscripten or --em-config EMSCRIPTEN_ROOT=/path/;LLVM_ROOT=/path;...')
+ if not '=' in EM_CONFIG:
+ raise Exception('File ' + EM_CONFIG + ' passed to --em-config does not exist!')
+ else:
+ EM_CONFIG = EM_CONFIG.replace(';', '\n') + '\n'
+
if not EM_CONFIG:
EM_CONFIG = '~/.emscripten'
if '\n' in EM_CONFIG:
@@ -926,7 +941,7 @@ class Building:
@staticmethod
- def build_library(name, build_dir, output_dir, generated_libs, configure=['sh', './configure'], configure_args=[], make=['make'], make_args=['-j', '2'], cache=None, cache_name=None, copy_project=False, env_init={}, source_dir=None, native=False):
+ def build_library(name, build_dir, output_dir, generated_libs, configure=['sh', './configure'], configure_args=[], make=['make'], make_args='help', cache=None, cache_name=None, copy_project=False, env_init={}, source_dir=None, native=False):
''' Build a library into a .bc file. We build the .bc file once and cache it for all our tests. (We cache in
memory since the test directory is destroyed and recreated for each test. Note that we cache separately
for different compilers).
@@ -934,6 +949,8 @@ class Building:
if type(generated_libs) is not list: generated_libs = [generated_libs]
if source_dir is None: source_dir = path_from_root('tests', name.replace('_native', ''))
+ if make_args == 'help':
+ make_args = ['-j', str(multiprocessing.cpu_count())]
temp_dir = build_dir
if copy_project:
diff --git a/tools/test-js-optimizer-asm-pre-output.js b/tools/test-js-optimizer-asm-pre-output.js
index 2e3db000..0fa81050 100644
--- a/tools/test-js-optimizer-asm-pre-output.js
+++ b/tools/test-js-optimizer-asm-pre-output.js
@@ -58,12 +58,14 @@ function b($this, $__n) {
_memset($38 + $23 | 0, 0, $__n | 0, 1, 1213141516);
$40 = $23 + $__n | 0;
if ((HEAP8[$4 & 16777215] & 1) == 0) {
- HEAP8[$4 & 16777215] = $40 << 1 & 255;
+ HEAP8[$4 & 16777215] = $40 << 1;
} else {
HEAP32[($this + 4 & 16777215) >> 2] = $40;
}
HEAP8[$38 + $40 & 16777215] = 0;
HEAP32[$4] = ~HEAP32[$5];
+ HEAP8[$4] = HEAP32[$5];
+ HEAP16[$4] = HEAP32[$5];
HEAP32[$4] = ~HEAP32[$5];
HEAP32[$4] = ~HEAP32[$5];
h(~~g ^ -1);
@@ -240,10 +242,10 @@ function _main($argc, $argv) {
}
if (($i_09_i_i | 0) > (HEAP32[9600 + ($j_08_i_i << 2) >> 2] | 0)) {
$34 = $j_08_i_i + 1 | 0;
- HEAP8[$i_09_i_i + 8952 | 0] = $34 & 255;
+ HEAP8[$i_09_i_i + 8952 | 0] = $34;
$j_1_i_i = $34;
} else {
- HEAP8[$i_09_i_i + 8952 | 0] = $j_08_i_i & 255;
+ HEAP8[$i_09_i_i + 8952 | 0] = $j_08_i_i;
$j_1_i_i = $j_08_i_i;
}
$38 = $i_09_i_i + 1 | 0;
diff --git a/tools/test-js-optimizer-asm-pre.js b/tools/test-js-optimizer-asm-pre.js
index 9e6edf0f..dadeef53 100644
--- a/tools/test-js-optimizer-asm-pre.js
+++ b/tools/test-js-optimizer-asm-pre.js
@@ -66,6 +66,10 @@ function b($this, $__n) {
HEAP8[($38 + $40 | 0) & 16777215] = 0;
// Eliminate the |0.
HEAP32[$4] = ((~(HEAP32[$5]|0))|0);
+ // Eliminate the &255
+ HEAP8[$4] = HEAP32[$5]&255;
+ // Eliminate the &65535
+ HEAP16[$4] = HEAP32[$5]&65535;
// Rewrite to ~.
HEAP32[$4] = HEAP32[$5]^-1;
// Rewrite to ~ and eliminate the |0.