summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rwxr-xr-xemcc17
-rwxr-xr-xemscripten.py174
-rw-r--r--src/analyzer.js11
-rw-r--r--src/compiler.js2
-rw-r--r--src/jsifier.js2
-rw-r--r--src/library.js27
-rw-r--r--src/parseTools.js1
-rw-r--r--src/relooper/Relooper.cpp84
-rw-r--r--src/relooper/test.txt4
-rw-r--r--src/relooper/test2.txt15
-rw-r--r--src/relooper/test3.txt38
-rw-r--r--src/relooper/test4.txt21
-rw-r--r--src/relooper/test6.txt15
-rw-r--r--src/relooper/test_debug.txt15
-rw-r--r--src/relooper/test_fuzz1.txt13
-rw-r--r--src/relooper/test_fuzz5.txt27
-rw-r--r--src/relooper/test_inf.txt651
-rw-r--r--src/settings.js2
-rw-r--r--system/include/emscripten/emscripten.h24
-rw-r--r--system/include/stdbool.h3
-rw-r--r--tests/fuzz/8.c2214
-rw-r--r--tests/fuzz/8.c.txt1
-rwxr-xr-xtests/fuzz/csmith_driver.py13
-rw-r--r--tests/hello_libcxx_mod2.cpp10
-rw-r--r--tests/hello_libcxx_mod2a.cpp11
-rwxr-xr-xtests/runner.py33
-rw-r--r--third_party/jni/emjvm.cpp133
-rw-r--r--third_party/jni/emjvm.h8
-rw-r--r--third_party/jni/emjvm.js180
-rw-r--r--third_party/jni/jni.h1154
-rw-r--r--tools/cache.py194
l---------tools/eliminator/node_modules/.bin/cake1
l---------tools/eliminator/node_modules/.bin/coffee1
-rw-r--r--tools/file_packager.py2
-rw-r--r--tools/js_optimizer.py7
-rw-r--r--tools/jsrun.py27
-rw-r--r--tools/shared.py352
-rw-r--r--tools/tempfiles.py40
39 files changed, 4748 insertions, 780 deletions
diff --git a/.gitignore b/.gitignore
index 31814a09..843b21b1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,4 @@ src/relooper.js.raw.js
src/relooper/*.o
src/relooper/*.out
+tests/fake/ \ No newline at end of file
diff --git a/emcc b/emcc
index b3581ea8..f644b924 100755
--- a/emcc
+++ b/emcc
@@ -421,6 +421,22 @@ Options that are modified or new in %s include:
'jsfuncs' will be cached. So avoid modifying
globals to let caching work fully.
+ To work around the problem mentioned in the
+ previous paragraph, you can use
+
+ emscripten_jcache_printf
+
+ when adding debug printfs to your code. That
+ function is specially preprocessed so that it
+ does not create a constant string global for
+ its first argument. See emscripten.h for more
+ details. Note in particular that you need to
+ already have a call to that function in your
+ code *before* you add one and do an incremental
+ build, so that adding an external reference
+ (also a global property) does not invalidate
+ everything.
+
--clear-cache Manually clears the cache of compiled
emscripten system libraries (libc++,
libc++abi, libc). This is normally
@@ -978,6 +994,7 @@ try:
for input_file in input_files:
if input_file.endswith(SOURCE_SUFFIXES):
if DEBUG: print >> sys.stderr, 'emcc: compiling source file: ', input_file
+ input_file = shared.Building.preprocess(input_file, in_temp(uniquename(input_file)))
output_file = in_temp(unsuffixed(uniquename(input_file)) + '.o')
temp_files.append(output_file)
args = newargs + ['-emit-llvm', '-c', input_file, '-o', output_file]
diff --git a/emscripten.py b/emscripten.py
index 1fc5f190..0b9244c2 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -9,21 +9,9 @@ header files (so that the JS compiler can see the constants in those
headers, for the libc implementation in JS).
'''
-import os, sys, json, optparse, subprocess, re, time, multiprocessing
+import os, sys, json, optparse, subprocess, re, time, multiprocessing, functools
-if not os.environ.get('EMSCRIPTEN_SUPPRESS_USAGE_WARNING'):
- print >> sys.stderr, '''
-==============================================================
-WARNING: You should normally never use this! Use emcc instead.
-==============================================================
- '''
-
-from tools import shared
-
-DEBUG = os.environ.get('EMCC_DEBUG')
-if DEBUG == "0":
- DEBUG = None
-DEBUG_CACHE = DEBUG and "cache" in DEBUG
+from tools import jsrun, cache as cache_module, tempfiles
__rootpath__ = os.path.abspath(os.path.dirname(__file__))
def path_from_root(*pathelems):
@@ -32,11 +20,6 @@ def path_from_root(*pathelems):
"""
return os.path.join(__rootpath__, *pathelems)
-temp_files = shared.TempFiles()
-
-compiler_engine = None
-jcache = False
-
def scan(ll, settings):
# blockaddress(@main, %23)
blockaddrs = []
@@ -50,16 +33,20 @@ NUM_CHUNKS_PER_CORE = 1.25
MIN_CHUNK_SIZE = 1024*1024
MAX_CHUNK_SIZE = float(os.environ.get('EMSCRIPT_MAX_CHUNK_SIZE') or 'inf') # configuring this is just for debugging purposes
-def process_funcs(args):
- i, funcs, meta, settings_file, compiler, forwarded_file, libraries = args
+def process_funcs((i, funcs, meta, settings_file, compiler, forwarded_file, libraries, compiler_engine, temp_files)):
ll = ''.join(funcs) + '\n' + meta
funcs_file = temp_files.get('.func_%d.ll' % i).name
open(funcs_file, 'w').write(ll)
- out = shared.run_js(compiler, compiler_engine, [settings_file, funcs_file, 'funcs', forwarded_file] + libraries, stdout=subprocess.PIPE, cwd=path_from_root('src'))
- shared.try_delete(funcs_file)
+ out = jsrun.run_js(
+ compiler,
+ engine=compiler_engine,
+ args=[settings_file, funcs_file, 'funcs', forwarded_file] + libraries,
+ stdout=subprocess.PIPE)
+ tempfiles.try_delete(funcs_file)
return out
-def emscript(infile, settings, outfile, libraries=[]):
+def emscript(infile, settings, outfile, libraries=[], compiler_engine=None,
+ jcache=None, temp_files=None, DEBUG=None, DEBUG_CACHE=None):
"""Runs the emscripten LLVM-to-JS compiler. We parallelize as much as possible
Args:
@@ -78,7 +65,7 @@ def emscript(infile, settings, outfile, libraries=[]):
if DEBUG: print >> sys.stderr, 'emscript: ll=>js'
- if jcache: shared.JCache.ensure()
+ if jcache: jcache.ensure()
# Pre-scan ll and alter settings as necessary
if DEBUG: t = time.time()
@@ -147,13 +134,13 @@ def emscript(infile, settings, outfile, libraries=[]):
out = None
if jcache:
keys = [pre_input, settings_text, ','.join(libraries)]
- shortkey = shared.JCache.get_shortkey(keys)
+ shortkey = jcache.get_shortkey(keys)
if DEBUG_CACHE: print >>sys.stderr, 'shortkey', shortkey
- out = shared.JCache.get(shortkey, keys)
+ out = jcache.get(shortkey, keys)
if DEBUG_CACHE and not out:
- dfpath = os.path.join(shared.TEMP_DIR, "ems_" + shortkey)
+ dfpath = os.path.join(configuration.TEMP_DIR, "ems_" + shortkey)
dfp = open(dfpath, 'w')
dfp.write(pre_input);
dfp.write("\n\n========================== settings_text\n\n");
@@ -166,10 +153,10 @@ def emscript(infile, settings, outfile, libraries=[]):
if out and DEBUG: print >> sys.stderr, ' loading pre from jcache'
if not out:
open(pre_file, 'w').write(pre_input)
- out = shared.run_js(compiler, shared.COMPILER_ENGINE, [settings_file, pre_file, 'pre'] + libraries, stdout=subprocess.PIPE, cwd=path_from_root('src'))
+ out = jsrun.run_js(compiler, compiler_engine, [settings_file, pre_file, 'pre'] + libraries, stdout=subprocess.PIPE)
if jcache:
if DEBUG: print >> sys.stderr, ' saving pre to jcache'
- shared.JCache.set(shortkey, keys, out)
+ jcache.set(shortkey, keys, out)
pre, forwarded_data = out.split('//FORWARDED_DATA:')
forwarded_file = temp_files.get('.json').name
open(forwarded_file, 'w').write(forwarded_data)
@@ -194,15 +181,17 @@ def emscript(infile, settings, outfile, libraries=[]):
settings['EXPORTED_FUNCTIONS'] = forwarded_json['EXPORTED_FUNCTIONS']
save_settings()
- chunks = shared.JCache.chunkify(funcs, chunk_size, 'emscript_files' if jcache else None)
+ chunks = cache_module.chunkify(
+ funcs, chunk_size,
+ jcache.get_cachename('emscript_files') if jcache else None)
if jcache:
# load chunks from cache where we can # TODO: ignore small chunks
cached_outputs = []
def load_from_cache(chunk):
keys = [settings_text, forwarded_data, chunk]
- shortkey = shared.JCache.get_shortkey(keys) # TODO: share shortkeys with later code
- out = shared.JCache.get(shortkey, keys) # this is relatively expensive (pickling?)
+ shortkey = jcache.get_shortkey(keys) # TODO: share shortkeys with later code
+ out = jcache.get(shortkey, keys) # this is relatively expensive (pickling?)
if out:
cached_outputs.append(out)
return False
@@ -215,12 +204,16 @@ def emscript(infile, settings, outfile, libraries=[]):
# TODO: minimize size of forwarded data from funcs to what we actually need
- if cores == 1 and total_ll_size < MAX_CHUNK_SIZE: assert len(chunks) == 1, 'no point in splitting up without multiple cores'
+ if cores == 1 and total_ll_size < MAX_CHUNK_SIZE:
+ assert len(chunks) == 1, 'no point in splitting up without multiple cores'
if len(chunks) > 0:
if DEBUG: print >> sys.stderr, ' emscript: phase 2 working on %d chunks %s (intended chunk size: %.2f MB, meta: %.2f MB, forwarded: %.2f MB, total: %.2f MB)' % (len(chunks), ('using %d cores' % cores) if len(chunks) > 1 else '', chunk_size/(1024*1024.), len(meta)/(1024*1024.), len(forwarded_data)/(1024*1024.), total_ll_size/(1024*1024.))
- commands = [(i, chunks[i], meta, settings_file, compiler, forwarded_file, libraries) for i in range(len(chunks))]
+ commands = [
+ (i, chunk, meta, settings_file, compiler, forwarded_file, libraries, compiler_engine, temp_files)
+ for i, chunk in enumerate(chunks)
+ ]
if len(chunks) > 1:
pool = multiprocessing.Pool(processes=cores)
@@ -235,8 +228,8 @@ def emscript(infile, settings, outfile, libraries=[]):
for i in range(len(chunks)):
chunk = chunks[i]
keys = [settings_text, forwarded_data, chunk]
- shortkey = shared.JCache.get_shortkey(keys)
- shared.JCache.set(shortkey, keys, outputs[i])
+ shortkey = jcache.get_shortkey(keys)
+ jcache.set(shortkey, keys, outputs[i])
if out and DEBUG and len(chunks) > 0: print >> sys.stderr, ' saving %d funcchunks to jcache' % len(chunks)
if jcache: outputs += cached_outputs # TODO: preserve order
@@ -311,7 +304,7 @@ def emscript(infile, settings, outfile, libraries=[]):
if DEBUG: t = time.time()
post_file = temp_files.get('.post.ll').name
open(post_file, 'w').write('\n') # no input, just processing of forwarded data
- out = shared.run_js(compiler, shared.COMPILER_ENGINE, [settings_file, post_file, 'post', forwarded_file] + libraries, stdout=subprocess.PIPE, cwd=path_from_root('src'))
+ out = jsrun.run_js(compiler, compiler_engine, [settings_file, post_file, 'post', forwarded_file] + libraries, stdout=subprocess.PIPE)
post, last_forwarded_data = out.split('//FORWARDED_DATA:') # if this fails, perhaps the process failed prior to printing forwarded data?
last_forwarded_json = json.loads(last_forwarded_data)
@@ -495,8 +488,7 @@ Runtime.stackRestore = function(top) { asm.stackRestore(top) };
outfile.close()
-
-def main(args):
+def main(args, compiler_engine, cache, jcache, relooper, temp_files, DEBUG, DEBUG_CACHE):
# Prepare settings for serialization to JSON.
settings = {}
for setting in args.settings:
@@ -570,16 +562,23 @@ def main(args):
libraries = args.libraries[0].split(',') if len(args.libraries) > 0 else []
# Compile the assembly to Javascript.
- if settings.get('RELOOP'): shared.Building.ensure_relooper()
-
- emscript(args.infile, settings, args.outfile, libraries)
-
-if __name__ == '__main__':
+ if settings.get('RELOOP'):
+ if not relooper:
+ relooper = cache.get_path('relooper.js')
+ settings.setdefault('RELOOPER', relooper)
+ if not os.path.exists(relooper):
+ from tools import shared
+ shared.Building.ensure_relooper(relooper)
+
+ emscript(args.infile, settings, args.outfile, libraries, compiler_engine=compiler_engine,
+ jcache=jcache, temp_files=temp_files, DEBUG=DEBUG, DEBUG_CACHE=DEBUG_CACHE)
+
+def _main(environ):
parser = optparse.OptionParser(
- usage='usage: %prog [-h] [-H HEADERS] [-o OUTFILE] [-c COMPILER_ENGINE] [-s FOO=BAR]* infile',
- description=('You should normally never use this! Use emcc instead. '
- 'This is a wrapper around the JS compiler, converting .ll to .js.'),
- epilog='')
+ usage='usage: %prog [-h] [-H HEADERS] [-o OUTFILE] [-c COMPILER_ENGINE] [-s FOO=BAR]* infile',
+ description=('You should normally never use this! Use emcc instead. '
+ 'This is a wrapper around the JS compiler, converting .ll to .js.'),
+ epilog='')
parser.add_option('-H', '--headers',
default=[],
action='append',
@@ -592,8 +591,11 @@ if __name__ == '__main__':
default=sys.stdout,
help='Where to write the output; defaults to stdout.')
parser.add_option('-c', '--compiler',
- default=shared.COMPILER_ENGINE,
+ default=None,
help='Which JS engine to use to run the compiler; defaults to the one in ~/.emscripten.')
+ parser.add_option('--relooper',
+ default=None,
+ help='Which relooper file to use if RELOOP is enabled.')
parser.add_option('-s', '--setting',
dest='settings',
default=[],
@@ -605,16 +607,82 @@ if __name__ == '__main__':
action='store_true',
default=False,
help=('Enable jcache (ccache-like caching of compilation results, for faster incremental builds).'))
+ parser.add_option('-T', '--temp-dir',
+ default=None,
+ help=('Where to create temporary files.'))
+ parser.add_option('-v', '--verbose',
+ action='store_true',
+ dest='verbose',
+ help='Displays debug output')
+ parser.add_option('-q', '--quiet',
+ action='store_false',
+ dest='verbose',
+ help='Hides debug output')
+ parser.add_option('--suppressUsageWarning',
+ action='store_true',
+ default=environ.get('EMSCRIPTEN_SUPPRESS_USAGE_WARNING'),
+ help=('Suppress usage warning'))
# Convert to the same format that argparse would have produced.
keywords, positional = parser.parse_args()
+
+ if not keywords.suppressUsageWarning:
+ print >> sys.stderr, '''
+==============================================================
+WARNING: You should normally never use this! Use emcc instead.
+==============================================================
+ '''
+
if len(positional) != 1:
raise RuntimeError('Must provide exactly one positional argument.')
keywords.infile = os.path.abspath(positional[0])
if isinstance(keywords.outfile, basestring):
keywords.outfile = open(keywords.outfile, 'w')
- compiler_engine = keywords.compiler
- jcache = keywords.jcache
- temp_files.run_and_clean(lambda: main(keywords))
+ if keywords.relooper:
+ relooper = os.path.abspath(keywords.relooper)
+ else:
+ relooper = None # use the cache
+
+ def get_configuration():
+ if hasattr(get_configuration, 'configuration'):
+ return get_configuration.configuration
+
+ from tools import shared
+ configuration = shared.Configuration(environ=os.environ)
+ get_configuration.configuration = configuration
+ return configuration
+
+ if keywords.temp_dir is None:
+ temp_files = get_configuration().get_temp_files()
+ else:
+ temp_dir = os.path.abspath(keywords.temp_dir)
+ if not os.path.exists(temp_dir):
+ os.makedirs(temp_dir)
+ temp_files = tempfiles.TempFiles(temp_dir)
+
+ if keywords.compiler is None:
+ from tools import shared
+ keywords.compiler = shared.COMPILER_ENGINE
+
+ if keywords.verbose is None:
+ DEBUG = get_configuration().DEBUG
+ DEBUG_CACHE = get_configuration().DEBUG_CACHE
+ else:
+ DEBUG = keywords.verbose
+ DEBUG_CACHE = keywords.verbose
+
+ cache = cache_module.Cache()
+ temp_files.run_and_clean(lambda: main(
+ keywords,
+ compiler_engine=keywords.compiler,
+ cache=cache,
+ jcache=cache_module.JCache(cache) if keywords.jcache else None,
+ relooper=relooper,
+ temp_files=temp_files,
+ DEBUG=DEBUG,
+ DEBUG_CACHE=DEBUG_CACHE,
+ ))
+if __name__ == '__main__':
+ _main(environ=os.environ)
diff --git a/src/analyzer.js b/src/analyzer.js
index f9b0c5af..ecb5ea6b 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -122,7 +122,8 @@ function analyzer(data, sidePass) {
// Legalization
if (USE_TYPED_ARRAYS == 2) {
function getLegalVars(base, bits, allowLegal) {
- if (allowLegal && bits <= 32) return [{ ident: base, bits: bits }];
+ bits = bits || 32; // things like pointers are all i32, but show up as 0 bits from getBits
+ if (allowLegal && bits <= 32) return [{ ident: base + ('i' + bits in Runtime.INT_TYPES ? '' : '$0'), bits: bits }];
if (isNumber(base)) return getLegalLiterals(base, bits);
var ret = new Array(Math.ceil(bits/32));
var i = 0;
@@ -647,13 +648,7 @@ function analyzer(data, sidePass) {
default: throw 'Invalid mathop for legalization: ' + [value.op, item.lineNum, dump(item)];
}
// Do the legalization
- var sourceElements;
- if (sourceBits <= 32) {
- // The input is a legal type
- sourceElements = [{ ident: value.params[0].ident, bits: sourceBits }];
- } else {
- sourceElements = getLegalVars(value.params[0].ident, sourceBits);
- }
+ var sourceElements = getLegalVars(value.params[0].ident, sourceBits, true);
if (!isNumber(shifts)) {
// We can't statically legalize this, do the operation at runtime TODO: optimize
assert(sourceBits == 64, 'TODO: handle nonconstant shifts on != 64 bits');
diff --git a/src/compiler.js b/src/compiler.js
index 1cd09c30..3047daf1 100644
--- a/src/compiler.js
+++ b/src/compiler.js
@@ -199,7 +199,7 @@ load('parseTools.js');
load('intertyper.js');
load('analyzer.js');
load('jsifier.js');
-if (RELOOP) load('relooper.js')
+if (RELOOP) load(RELOOPER)
globalEval(processMacros(preprocess(read('runtime.js'))));
Runtime.QUANTUM_SIZE = QUANTUM_SIZE;
diff --git a/src/jsifier.js b/src/jsifier.js
index ca404258..ff58ece2 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -1210,7 +1210,7 @@ function JSify(data, functionsOnly, givenFunctions) {
case 'xchg': return '(tempValue=' + makeGetValue(param1, 0, type) + ',' + makeSetValue(param1, 0, param2, type, null, null, null, null, ',') + ',tempValue)';
case 'cmpxchg': {
var param3 = finalizeLLVMParameter(item.params[2]);
- return '(tempValue=' + makeGetValue(param1, 0, type) + ',(' + makeGetValue(param1, 0, type) + '==' + param2 + ' ? ' + makeSetValue(param1, 0, param3, type, null, null, null, null, ',') + ' : 0),tempValue)';
+ return '(tempValue=' + makeGetValue(param1, 0, type) + ',(' + makeGetValue(param1, 0, type) + '==(' + param2 + '|0) ? ' + makeSetValue(param1, 0, param3, type, null, null, null, null, ',') + ' : 0),tempValue)';
}
default: throw 'unhandled atomic op: ' + item.op;
}
diff --git a/src/library.js b/src/library.js
index 1676a82c..a288b739 100644
--- a/src/library.js
+++ b/src/library.js
@@ -2403,6 +2403,7 @@ LibraryManager.library = {
case {{{ cDefine('_SC_STREAM_MAX') }}}: return 16;
case {{{ cDefine('_SC_TZNAME_MAX') }}}: return 6;
case {{{ cDefine('_SC_THREAD_DESTRUCTOR_ITERATIONS') }}}: return 4;
+ case {{{ cDefine('_SC_NPROCESSORS_ONLN') }}}: return 1;
}
___setErrNo(ERRNO_CODES.EINVAL);
return -1;
@@ -6064,6 +6065,15 @@ LibraryManager.library = {
__timespec_struct_layout: Runtime.generateStructInfo([
['i32', 'tv_sec'],
['i32', 'tv_nsec']]),
+ nanosleep__deps: ['usleep', '__timespec_struct_layout'],
+ nanosleep: function(rqtp, rmtp) {
+ // int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
+ var seconds = {{{ makeGetValue('rqtp', '___timespec_struct_layout.tv_sec', 'i32') }}};
+ var nanoseconds = {{{ makeGetValue('rqtp', '___timespec_struct_layout.tv_nsec', 'i32') }}};
+ {{{ makeSetValue('rmtp', '___timespec_struct_layout.tv_sec', '0', 'i32') }}}
+ {{{ makeSetValue('rmtp', '___timespec_struct_layout.tv_nsec', '0', 'i32') }}}
+ return _usleep((seconds * 1e6) + (nanoseconds / 1000));
+ },
// TODO: Implement these for real.
clock_gettime__deps: ['__timespec_struct_layout'],
clock_gettime: function(clk_id, tp) {
@@ -7368,6 +7378,23 @@ LibraryManager.library = {
emscripten_random: function() {
return Math.random();
},
+
+ emscripten_jcache_printf___deps: ['_formatString'],
+ emscripten_jcache_printf_: function(varargs) {
+ var MAX = 10240;
+ if (!_emscripten_jcache_printf_.buffer) {
+ _emscripten_jcache_printf_.buffer = _malloc(MAX);
+ }
+ var i = 0;
+ do {
+ var curr = {{{ makeGetValue('varargs', 'i*4', 'i8') }}};
+ {{{ makeSetValue('_emscripten_jcache_printf_.buffer', 'i', 'curr', 'i8') }}};
+ i++;
+ assert(i*4 < MAX);
+ } while (curr != 0);
+ Module.print(intArrayToString(__formatString(_emscripten_jcache_printf_.buffer, varargs + i*4)).replace('\\n', ''));
+ Runtime.stackAlloc(-4*i); // free up the stack space we know is ok to free
+ },
};
function autoAddDeps(object, name) {
diff --git a/src/parseTools.js b/src/parseTools.js
index 5d3c0179..7f4f3a18 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -2203,7 +2203,6 @@ function processMathop(item) {
case 'ne': case 'eq': {
// We must sign them, so we do not compare -1 to 255 (could have unsigned them both too)
// since LLVM tells us if <=, >= etc. comparisons are signed, but not == and !=.
- assert(paramTypes[0] == paramTypes[1]);
idents[0] = makeSignOp(idents[0], paramTypes[0], 're');
idents[1] = makeSignOp(idents[1], paramTypes[1], 're');
return idents[0] + (variant === 'eq' ? '==' : '!=') + idents[1];
diff --git a/src/relooper/Relooper.cpp b/src/relooper/Relooper.cpp
index ae8577b1..1a7acc15 100644
--- a/src/relooper/Relooper.cpp
+++ b/src/relooper/Relooper.cpp
@@ -909,48 +909,54 @@ void Relooper::Calculate(Block *Entry) {
}
std::stack<Shape*> &LoopStack = *((std::stack<Shape*>*)Closure);
- SHAPE_SWITCH(Root, {
- MultipleShape *Fused = Shape::IsMultiple(Root->Next);
- // If we are fusing a Multiple with a loop into this Simple, then visit it now
- if (Fused && Fused->NeedLoop) {
- LoopStack.push(Fused);
- RECURSE_MULTIPLE_MANUAL(FindLabeledLoops, Fused);
- }
- for (BlockBranchMap::iterator iter = Simple->Inner->ProcessedBranchesOut.begin(); iter != Simple->Inner->ProcessedBranchesOut.end(); iter++) {
- Block *Target = iter->first;
- Branch *Details = iter->second;
- if (Details->Type != Branch::Direct) {
- assert(LoopStack.size() > 0);
- if (Details->Ancestor != LoopStack.top()) {
- LabeledShape *Labeled = Shape::IsLabeled(Details->Ancestor);
- Labeled->Labeled = true;
- Details->Labeled = true;
- } else {
- Details->Labeled = false;
+ Shape *Next = Root;
+ while (Next) {
+ Root = Next;
+ Next = NULL;
+
+ SHAPE_SWITCH(Root, {
+ MultipleShape *Fused = Shape::IsMultiple(Root->Next);
+ // If we are fusing a Multiple with a loop into this Simple, then visit it now
+ if (Fused && Fused->NeedLoop) {
+ LoopStack.push(Fused);
+ RECURSE_MULTIPLE_MANUAL(FindLabeledLoops, Fused);
+ }
+ for (BlockBranchMap::iterator iter = Simple->Inner->ProcessedBranchesOut.begin(); iter != Simple->Inner->ProcessedBranchesOut.end(); iter++) {
+ Block *Target = iter->first;
+ Branch *Details = iter->second;
+ if (Details->Type != Branch::Direct) {
+ assert(LoopStack.size() > 0);
+ if (Details->Ancestor != LoopStack.top()) {
+ LabeledShape *Labeled = Shape::IsLabeled(Details->Ancestor);
+ Labeled->Labeled = true;
+ Details->Labeled = true;
+ } else {
+ Details->Labeled = false;
+ }
}
}
- }
- if (Fused && Fused->NeedLoop) {
- LoopStack.pop();
- if (Fused->Next) FindLabeledLoops(Fused->Next);
- } else {
- if (Root->Next) FindLabeledLoops(Root->Next);
- }
- }, {
- if (Multiple->NeedLoop) {
- LoopStack.push(Multiple);
- }
- RECURSE_MULTIPLE(FindLabeledLoops);
- if (Multiple->NeedLoop) {
+ if (Fused && Fused->NeedLoop) {
+ LoopStack.pop();
+ Next = Fused->Next;
+ } else {
+ Next = Root->Next;
+ }
+ }, {
+ if (Multiple->NeedLoop) {
+ LoopStack.push(Multiple);
+ }
+ RECURSE_MULTIPLE(FindLabeledLoops);
+ if (Multiple->NeedLoop) {
+ LoopStack.pop();
+ }
+ Next = Root->Next;
+ }, {
+ LoopStack.push(Loop);
+ RECURSE_LOOP(FindLabeledLoops);
LoopStack.pop();
- }
- if (Root->Next) FindLabeledLoops(Root->Next);
- }, {
- LoopStack.push(Loop);
- RECURSE_LOOP(FindLabeledLoops);
- LoopStack.pop();
- if (Root->Next) FindLabeledLoops(Root->Next);
- });
+ Next = Root->Next;
+ });
+ }
if (First) {
delete (std::stack<Shape*>*)Closure;
diff --git a/src/relooper/test.txt b/src/relooper/test.txt
index 12d0ef39..b7c8794d 100644
--- a/src/relooper/test.txt
+++ b/src/relooper/test.txt
@@ -54,7 +54,7 @@ while(1) {
// code 2
if (!($2)) {
var $x_1 = $x_0;
- label = 18;
+ label = 19;
break;
}
// code 3
@@ -64,7 +64,7 @@ while(1) {
var $i_0 = $7;var $x_0 = $5;
}
}
-if (label == 18) {
+if (label == 19) {
// code 7
}
// code 4
diff --git a/src/relooper/test2.txt b/src/relooper/test2.txt
index a847e806..c77ce491 100644
--- a/src/relooper/test2.txt
+++ b/src/relooper/test2.txt
@@ -1,11 +1,12 @@
ep
-L1:
-if (ep -> LBB1) {
- LBB1
- if (!(LBB1 -> LBB2)) {
- break L1;
+do {
+ if (ep -> LBB1) {
+ LBB1
+ if (!(LBB1 -> LBB2)) {
+ break;
+ }
+ LBB2
}
- LBB2
-}
+} while(0);
LBB3
diff --git a/src/relooper/test3.txt b/src/relooper/test3.txt
index 7d06f06a..696542ef 100644
--- a/src/relooper/test3.txt
+++ b/src/relooper/test3.txt
@@ -1,25 +1,27 @@
ep
-L1:
-if (ep -> LBB1) {
- LBB1
- if (!(LBB1 -> LBB2)) {
- break L1;
+do {
+ if (ep -> LBB1) {
+ LBB1
+ if (!(LBB1 -> LBB2)) {
+ break;
+ }
+ LBB2
}
- LBB2
-}
+} while(0);
LBB3
-L5:
-if (LBB3 -> LBB4) {
- LBB4
- if (!(LBB4 -> LBB5)) {
- break L5;
- }
- while(1) {
- LBB5
- if (LBB5 -> LBB6) {
- break L5;
+L5: do {
+ if (LBB3 -> LBB4) {
+ LBB4
+ if (!(LBB4 -> LBB5)) {
+ break;
+ }
+ while(1) {
+ LBB5
+ if (LBB5 -> LBB6) {
+ break L5;
+ }
}
}
-}
+} while(0);
LBB6
diff --git a/src/relooper/test4.txt b/src/relooper/test4.txt
index 2ab3265a..f0bfb972 100644
--- a/src/relooper/test4.txt
+++ b/src/relooper/test4.txt
@@ -1,16 +1,17 @@
//19
-L1:
-if ( 1 ) {
- //20
- if (!( 1 )) {
+do {
+ if ( 1 ) {
+ //20
+ if (!( 1 )) {
+ label = 4;
+ break;
+ }
+ //21
+ break;
+ } else {
label = 4;
- break L1;
}
- //21
- break L1;
-} else {
- label = 4;
-}
+} while(0);
if (label == 4) {
//22
}
diff --git a/src/relooper/test6.txt b/src/relooper/test6.txt
index 0ec7e666..c5effd08 100644
--- a/src/relooper/test6.txt
+++ b/src/relooper/test6.txt
@@ -1,11 +1,12 @@
//0
-L1:
-if (check(0)) {
- //1
- if (!(check(1))) {
- break L1;
+do {
+ if (check(0)) {
+ //1
+ if (!(check(1))) {
+ break;
+ }
+ //2
}
- //2
-}
+} while(0);
//3
diff --git a/src/relooper/test_debug.txt b/src/relooper/test_debug.txt
index 02377fb7..1c7d0508 100644
--- a/src/relooper/test_debug.txt
+++ b/src/relooper/test_debug.txt
@@ -83,13 +83,14 @@ int main() {
// === Optimizing shapes ===
// Fusing Multiple to Simple
ep
-L1:
-if (ep -> LBB1) {
- LBB1
- if (!(LBB1 -> LBB2)) {
- break L1;
+do {
+ if (ep -> LBB1) {
+ LBB1
+ if (!(LBB1 -> LBB2)) {
+ break;
+ }
+ LBB2
}
- LBB2
-}
+} while(0);
LBB3
diff --git a/src/relooper/test_fuzz1.txt b/src/relooper/test_fuzz1.txt
index 09edb594..5122257e 100644
--- a/src/relooper/test_fuzz1.txt
+++ b/src/relooper/test_fuzz1.txt
@@ -3,12 +3,13 @@
print('entry'); var label; var state; var decisions = [4, 1, 7, 2, 6, 6, 8]; var index = 0; function check() { if (index == decisions.length) throw 'HALT'; return decisions[index++] }
print(5); state = check();
print(6); state = check();
-L3:
-if (state == 7) {
- print(7); state = check();
- label = 3;
- break L3;
-}
+do {
+ if (state == 7) {
+ print(7); state = check();
+ label = 3;
+ break;
+ }
+} while(0);
L5: while(1) {
if (label == 3) {
label = 0;
diff --git a/src/relooper/test_fuzz5.txt b/src/relooper/test_fuzz5.txt
index 7c795d53..9548205c 100644
--- a/src/relooper/test_fuzz5.txt
+++ b/src/relooper/test_fuzz5.txt
@@ -3,21 +3,22 @@
print('entry'); var label; var state; var decisions = [133, 98, 134, 143, 162, 187, 130, 87, 91, 49, 102, 47, 9, 132, 179, 176, 157, 25, 64, 161, 57, 107, 16, 167, 185, 45, 191, 180, 23, 131]; var index = 0; function check() { if (index == decisions.length) throw 'HALT'; return decisions[index++] }
L1: while(1) {
print(7); state = check();
- L3:
- if (state % 3 == 1) {
- label = 3;
- } else if (state % 3 == 0) {
- print(8); state = check();
- if (state % 2 == 0) {
- label = 5;
- break L3;
+ do {
+ if (state % 3 == 1) {
+ label = 3;
+ } else if (state % 3 == 0) {
+ print(8); state = check();
+ if (state % 2 == 0) {
+ label = 5;
+ break;
+ } else {
+ label = 7;
+ break;
+ }
} else {
- label = 7;
- break L3;
+ break L1;
}
- } else {
- break L1;
- }
+ } while(0);
while(1) {
if (label == 3) {
label = 0;
diff --git a/src/relooper/test_inf.txt b/src/relooper/test_inf.txt
index 3e292433..379d2083 100644
--- a/src/relooper/test_inf.txt
+++ b/src/relooper/test_inf.txt
@@ -5,34 +5,35 @@ if (uint(i4) >= uint(i5)) {
code 1
}
code 3
-L5:
-if (!(i2 == 0)) {
- code 4
- while(1) {
- code 5
- if (uint(i6) >= uint(i7)) {
- code 7
- } else {
- code 6
- }
- code 8
- if (uint(i6) >= uint(i7)) {
- code 10
- } else {
- code 9
- }
- code 11
- if (uint(i5) >= uint(i6)) {
- code 13
- } else {
- code 12
- }
- code 14
- if (!(i2 != 0)) {
- break L5;
+L5: do {
+ if (!(i2 == 0)) {
+ code 4
+ while(1) {
+ code 5
+ if (uint(i6) >= uint(i7)) {
+ code 7
+ } else {
+ code 6
+ }
+ code 8
+ if (uint(i6) >= uint(i7)) {
+ code 10
+ } else {
+ code 9
+ }
+ code 11
+ if (uint(i5) >= uint(i6)) {
+ code 13
+ } else {
+ code 12
+ }
+ code 14
+ if (!(i2 != 0)) {
+ break L5;
+ }
}
}
-}
+} while(0);
code 15
if (uint(i4) >= uint(i5)) {
code 17
@@ -40,178 +41,179 @@ if (uint(i4) >= uint(i5)) {
code 16
}
code 18
-L26:
-if (!(i2 == 0)) {
- code 19
- while(1) {
- code 20
- if (uint(i5) >= uint(i6)) {
- code 22
- } else {
- code 21
- }
- code 23
- if (uint(i5) >= uint(i6)) {
- code 25
- } else {
- code 24
- }
- code 26
- if (uint(i5) >= uint(i6)) {
- code 28
- } else {
- code 27
- }
- code 29
- if (uint(i5) >= uint(i6)) {
- code 31
- } else {
- code 30
- }
- code 32
- if (uint(i5) >= uint(i6)) {
- code 34
- } else {
- code 33
- }
- code 35
- if (uint(i5) >= uint(i6)) {
- code 37
- } else {
- code 36
- }
- code 38
- if (uint(i5) >= uint(i6)) {
- code 40
- } else {
- code 39
- }
- code 41
- if (uint(i5) >= uint(i6)) {
- code 43
- } else {
- code 42
- }
- code 44
- if (uint(i5) >= uint(i6)) {
- code 46
- } else {
- code 45
- }
- code 47
- if (uint(i5) >= uint(i6)) {
- code 49
- } else {
- code 48
- }
- code 50
- if (uint(i5) >= uint(i6)) {
- code 52
- } else {
- code 51
- }
- code 53
- if (uint(i5) >= uint(i6)) {
- code 55
- } else {
- code 54
- }
- code 56
- if (uint(i5) >= uint(i6)) {
- code 58
- } else {
- code 57
- }
- code 59
- if (uint(i5) >= uint(i6)) {
- code 61
- } else {
- code 60
- }
- code 62
- if (uint(i5) >= uint(i6)) {
- code 64
- } else {
- code 63
- }
- code 65
- if (uint(i5) >= uint(i6)) {
- code 67
- } else {
- code 66
- }
- code 68
- if (uint(i5) >= uint(i6)) {
- code 70
- } else {
- code 69
- }
- code 71
- if (uint(i5) >= uint(i6)) {
- code 73
- } else {
- code 72
- }
- code 74
- if (uint(i5) >= uint(i6)) {
- code 76
- } else {
- code 75
- }
- code 77
- if (uint(i5) >= uint(i6)) {
- code 79
- } else {
- code 78
- }
- code 80
- if (uint(i5) >= uint(i6)) {
- code 82
- } else {
- code 81
- }
- code 83
- if (uint(i5) >= uint(i6)) {
- code 85
- } else {
- code 84
- }
- code 86
- if (uint(i5) >= uint(i6)) {
- code 88
- } else {
- code 87
- }
- code 89
- if (uint(i5) >= uint(i6)) {
- code 91
- } else {
- code 90
- }
- code 92
- if (uint(i5) >= uint(i6)) {
- code 94
- } else {
- code 93
- }
- code 95
- if (uint(i5) >= uint(i6)) {
- code 97
- } else {
- code 96
- }
- code 98
- if (uint(i5) >= uint(i6)) {
- code 100
- } else {
- code 99
- }
- code 101
- if (!(i2 != 0)) {
- break L26;
+L26: do {
+ if (!(i2 == 0)) {
+ code 19
+ while(1) {
+ code 20
+ if (uint(i5) >= uint(i6)) {
+ code 22
+ } else {
+ code 21
+ }
+ code 23
+ if (uint(i5) >= uint(i6)) {
+ code 25
+ } else {
+ code 24
+ }
+ code 26
+ if (uint(i5) >= uint(i6)) {
+ code 28
+ } else {
+ code 27
+ }
+ code 29
+ if (uint(i5) >= uint(i6)) {
+ code 31
+ } else {
+ code 30
+ }
+ code 32
+ if (uint(i5) >= uint(i6)) {
+ code 34
+ } else {
+ code 33
+ }
+ code 35
+ if (uint(i5) >= uint(i6)) {
+ code 37
+ } else {
+ code 36
+ }
+ code 38
+ if (uint(i5) >= uint(i6)) {
+ code 40
+ } else {
+ code 39
+ }
+ code 41
+ if (uint(i5) >= uint(i6)) {
+ code 43
+ } else {
+ code 42
+ }
+ code 44
+ if (uint(i5) >= uint(i6)) {
+ code 46
+ } else {
+ code 45
+ }
+ code 47
+ if (uint(i5) >= uint(i6)) {
+ code 49
+ } else {
+ code 48
+ }
+ code 50
+ if (uint(i5) >= uint(i6)) {
+ code 52
+ } else {
+ code 51
+ }
+ code 53
+ if (uint(i5) >= uint(i6)) {
+ code 55
+ } else {
+ code 54
+ }
+ code 56
+ if (uint(i5) >= uint(i6)) {
+ code 58
+ } else {
+ code 57
+ }
+ code 59
+ if (uint(i5) >= uint(i6)) {
+ code 61
+ } else {
+ code 60
+ }
+ code 62
+ if (uint(i5) >= uint(i6)) {
+ code 64
+ } else {
+ code 63
+ }
+ code 65
+ if (uint(i5) >= uint(i6)) {
+ code 67
+ } else {
+ code 66
+ }
+ code 68
+ if (uint(i5) >= uint(i6)) {
+ code 70
+ } else {
+ code 69
+ }
+ code 71
+ if (uint(i5) >= uint(i6)) {
+ code 73
+ } else {
+ code 72
+ }
+ code 74
+ if (uint(i5) >= uint(i6)) {
+ code 76
+ } else {
+ code 75
+ }
+ code 77
+ if (uint(i5) >= uint(i6)) {
+ code 79
+ } else {
+ code 78
+ }
+ code 80
+ if (uint(i5) >= uint(i6)) {
+ code 82
+ } else {
+ code 81
+ }
+ code 83
+ if (uint(i5) >= uint(i6)) {
+ code 85
+ } else {
+ code 84
+ }
+ code 86
+ if (uint(i5) >= uint(i6)) {
+ code 88
+ } else {
+ code 87
+ }
+ code 89
+ if (uint(i5) >= uint(i6)) {
+ code 91
+ } else {
+ code 90
+ }
+ code 92
+ if (uint(i5) >= uint(i6)) {
+ code 94
+ } else {
+ code 93
+ }
+ code 95
+ if (uint(i5) >= uint(i6)) {
+ code 97
+ } else {
+ code 96
+ }
+ code 98
+ if (uint(i5) >= uint(i6)) {
+ code 100
+ } else {
+ code 99
+ }
+ code 101
+ if (!(i2 != 0)) {
+ break L26;
+ }
}
}
-}
+} while(0);
code 102
if (uint(i4) >= uint(i5)) {
code 104
@@ -219,136 +221,137 @@ if (uint(i4) >= uint(i5)) {
code 103
}
code 105
-L143:
-if (!(i2 == 0)) {
- code 106
- while(1) {
- code 107
- if (uint(i5) >= uint(i6)) {
- code 109
- } else {
- code 108
- }
- code 110
- if (uint(i5) >= uint(i6)) {
- code 112
- } else {
- code 111
- }
- code 113
- if (uint(i5) >= uint(i6)) {
- code 115
- } else {
- code 114
- }
- code 116
- if (uint(i5) >= uint(i6)) {
- code 118
- } else {
- code 117
- }
- code 119
- if (uint(i5) >= uint(i6)) {
- code 121
- } else {
- code 120
- }
- code 122
- if (uint(i5) >= uint(i6)) {
- code 124
- } else {
- code 123
- }
- code 125
- if (uint(i5) >= uint(i6)) {
- code 127
- } else {
- code 126
- }
- code 128
- if (uint(i5) >= uint(i6)) {
- code 130
- } else {
- code 129
- }
- code 131
- if (uint(i5) >= uint(i6)) {
- code 133
- } else {
- code 132
- }
- code 134
- if (uint(i5) >= uint(i6)) {
- code 136
- } else {
- code 135
- }
- code 137
- if (uint(i5) >= uint(i6)) {
- code 139
- } else {
- code 138
- }
- code 140
- if (uint(i5) >= uint(i6)) {
- code 142
- } else {
- code 141
- }
- code 143
- if (uint(i5) >= uint(i6)) {
- code 145
- } else {
- code 144
- }
- code 146
- if (uint(i5) >= uint(i6)) {
- code 148
- } else {
- code 147
- }
- code 149
- if (uint(i5) >= uint(i6)) {
- code 151
- } else {
- code 150
- }
- code 152
- if (uint(i5) >= uint(i6)) {
- code 154
- } else {
- code 153
- }
- code 155
- if (uint(i5) >= uint(i6)) {
- code 157
- } else {
- code 156
- }
- code 158
- if (uint(i5) >= uint(i6)) {
- code 160
- } else {
- code 159
- }
- code 161
- if (uint(i5) >= uint(i6)) {
- code 163
- } else {
- code 162
- }
- code 164
- if (uint(i5) >= uint(i6)) {
- code 166
- } else {
- code 165
- }
- code 167
- if (!(i2 != 0)) {
- break L143;
+L143: do {
+ if (!(i2 == 0)) {
+ code 106
+ while(1) {
+ code 107
+ if (uint(i5) >= uint(i6)) {
+ code 109
+ } else {
+ code 108
+ }
+ code 110
+ if (uint(i5) >= uint(i6)) {
+ code 112
+ } else {
+ code 111
+ }
+ code 113
+ if (uint(i5) >= uint(i6)) {
+ code 115
+ } else {
+ code 114
+ }
+ code 116
+ if (uint(i5) >= uint(i6)) {
+ code 118
+ } else {
+ code 117
+ }
+ code 119
+ if (uint(i5) >= uint(i6)) {
+ code 121
+ } else {
+ code 120
+ }
+ code 122
+ if (uint(i5) >= uint(i6)) {
+ code 124
+ } else {
+ code 123
+ }
+ code 125
+ if (uint(i5) >= uint(i6)) {
+ code 127
+ } else {
+ code 126
+ }
+ code 128
+ if (uint(i5) >= uint(i6)) {
+ code 130
+ } else {
+ code 129
+ }
+ code 131
+ if (uint(i5) >= uint(i6)) {
+ code 133
+ } else {
+ code 132
+ }
+ code 134
+ if (uint(i5) >= uint(i6)) {
+ code 136
+ } else {
+ code 135
+ }
+ code 137
+ if (uint(i5) >= uint(i6)) {
+ code 139
+ } else {
+ code 138
+ }
+ code 140
+ if (uint(i5) >= uint(i6)) {
+ code 142
+ } else {
+ code 141
+ }
+ code 143
+ if (uint(i5) >= uint(i6)) {
+ code 145
+ } else {
+ code 144
+ }
+ code 146
+ if (uint(i5) >= uint(i6)) {
+ code 148
+ } else {
+ code 147
+ }
+ code 149
+ if (uint(i5) >= uint(i6)) {
+ code 151
+ } else {
+ code 150
+ }
+ code 152
+ if (uint(i5) >= uint(i6)) {
+ code 154
+ } else {
+ code 153
+ }
+ code 155
+ if (uint(i5) >= uint(i6)) {
+ code 157
+ } else {
+ code 156
+ }
+ code 158
+ if (uint(i5) >= uint(i6)) {
+ code 160
+ } else {
+ code 159
+ }
+ code 161
+ if (uint(i5) >= uint(i6)) {
+ code 163
+ } else {
+ code 162
+ }
+ code 164
+ if (uint(i5) >= uint(i6)) {
+ code 166
+ } else {
+ code 165
+ }
+ code 167
+ if (!(i2 != 0)) {
+ break L143;
+ }
}
}
-}
+} while(0);
code 168
if (uint(i4) >= uint(i5)) {
code 170
diff --git a/src/settings.js b/src/settings.js
index e260ed2a..1bfcf92a 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -58,6 +58,8 @@ var ALLOW_MEMORY_GROWTH = 0; // If false, we abort with an error if we try to al
// Code embetterments
var MICRO_OPTS = 1; // Various micro-optimizations, like nativizing variables
var RELOOP = 0; // Recreate js native loops from llvm data
+var RELOOPER = 'relooper.js'; // Loads the relooper from this path relative to compiler.js
+
var USE_TYPED_ARRAYS = 2; // Use typed arrays for the heap. See https://github.com/kripken/emscripten/wiki/Code-Generation-Modes/
// 0 means no typed arrays are used.
// 1 has two heaps, IHEAP (int32) and FHEAP (double),
diff --git a/system/include/emscripten/emscripten.h b/system/include/emscripten/emscripten.h
index 0c7cef35..61634b0e 100644
--- a/system/include/emscripten/emscripten.h
+++ b/system/include/emscripten/emscripten.h
@@ -345,6 +345,30 @@ extern void EMSCRIPTEN_PROFILE_INIT(int max);
extern void EMSCRIPTEN_PROFILE_BEGIN(int id);
extern void EMSCRIPTEN_PROFILE_END(int id);
+/*
+ * jcache-friendly printf. printf in general will receive a string
+ * literal, which becomes a global constant, which invalidates all
+ * jcache entries. emscripten_jcache_printf is parsed before
+ * clang into something without any string literals, so you can
+ * add such printouts to your code and only the (chunk containing
+ * the) function you modify will be invalided and recompiled.
+ *
+ * Note in particular that you need to already have a call to this
+ * function in your code *before* you add one and do an incremental
+ * build, so that adding an external reference does not invalidate
+ * everything.
+ *
+ * This function assumes the first argument is a string literal
+ * (otherwise you don't need it), and the other arguments, if any,
+ * are neither strings nor complex expressions (but just simple
+ * variables). (You can create a variable to store a complex
+ * expression on the previous line, if necessary.)
+ */
+#ifdef __cplusplus
+void emscripten_jcache_printf(const char *format, ...);
+void emscripten_jcache_printf_(...); /* internal use */
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/system/include/stdbool.h b/system/include/stdbool.h
index f970ade8..561eed3f 100644
--- a/system/include/stdbool.h
+++ b/system/include/stdbool.h
@@ -2,12 +2,13 @@
#ifndef __stdbool_h__
#define __stdbool_h__
+#define __bool_true_false_are_defined 1
+
#ifndef __cplusplus
#define bool _Bool
#define true 1
#define false 0
-#define __bool_true_false_are_defined 1
#endif
diff --git a/tests/fuzz/8.c b/tests/fuzz/8.c
new file mode 100644
index 00000000..2dbaa5b2
--- /dev/null
+++ b/tests/fuzz/8.c
@@ -0,0 +1,2214 @@
+/*
+ * This is a RANDOMLY GENERATED PROGRAM.
+ *
+ * Generator: csmith 2.2.0
+ * Git version: a8697aa
+ * Options: --no-volatiles --no-math64 --no-packed-struct
+ * Seed: 958095120
+ */
+
+#include "csmith.h"
+
+
+static long __undefined;
+
+/* --- Struct/Union Declarations --- */
+struct S0 {
+ signed f0 : 22;
+ unsigned f1 : 19;
+ const unsigned f2 : 9;
+};
+
+struct S1 {
+ uint8_t f0;
+ unsigned f1 : 17;
+};
+
+struct S2 {
+ const struct S0 f0;
+ int32_t f1;
+ struct S0 f2;
+ uint16_t f3;
+ const uint32_t f4;
+ uint32_t f5;
+ struct S1 f6;
+ const struct S0 f7;
+ const uint32_t f8;
+};
+
+union U3 {
+ int8_t f0;
+ signed f1 : 1;
+ uint8_t f2;
+ int8_t f3;
+};
+
+/* --- GLOBAL VARIABLES --- */
+static int32_t g_8 = 0xD069F498L;
+static int16_t g_54[10][9] = {{0L,0xDAE1L,(-1L),(-6L),0x7DA8L,(-6L),0x40C8L,0xDAE1L,0x1D9DL},{0xB79AL,(-1L),(-1L),0xD900L,(-6L),0xD17BL,1L,0L,1L},{0xB79AL,9L,0x0DE2L,1L,0L,(-6L),(-6L),0L,0x890FL},{0xD17BL,0xD900L,0xD17BL,(-6L),1L,(-6L),0xD900L,9L,0x40C8L},{0x7DA8L,0x40C8L,0x5FE9L,(-6L),6L,0xB79AL,1L,0x4C3DL,0L},{1L,(-1L),0xB79AL,0x4C3DL,0x1D9DL,0x1D9DL,0x5FE9L,(-6L),1L},{0x1D9DL,0x0DE2L,0L,(-1L),0xD17BL,1L,(-6L),(-6L),1L},{(-6L),0xD17BL,0x4C3DL,0x890FL,1L,0x890FL,0x4C3DL,0xD17BL,0xD900L},{(-1L),0x5FE9L,0x5FE9L,0L,0x890FL,0x0DE2L,(-1L),0xD900L,0x7DA8L},{1L,0xB79AL,6L,0xDAE1L,0xDAE1L,0L,0x890FL,(-6L),0x0DE2L}};
+static struct S0 g_60 = {1766,696,10};
+static uint8_t g_67 = 7UL;
+static struct S2 g_70 = {{-1862,222,13},0xB8BF5144L,{-1033,470,13},0x4A9FL,7UL,0x06D673C0L,{0x29L,4},{249,44,17},0UL};
+static uint16_t g_79 = 0UL;
+static const struct S0 *g_113 = &g_70.f7;
+static const struct S0 ** const g_112 = &g_113;
+static int32_t *g_125 = &g_8;
+static int32_t **g_124 = &g_125;
+static uint8_t g_141 = 0x42L;
+static struct S1 *g_156[4][8][8] = {{{(void*)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,(void*)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,(void*)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,(void*)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,(void*)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,(void*)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,(void*)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,(void*)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},{(void*)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,(void*)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,(void*)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,(void*)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,(void*)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,(void*)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,(void*)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,(void*)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},{(void*)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,(void*)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,(void*)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,(void*)0},{(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0}}};
+static uint8_t g_203[10] = {0x5BL,0x5BL,0x5BL,0x5BL,0x5BL,0x5BL,0x5BL,0x5BL,0x5BL,0x5BL};
+static uint32_t g_217[5] = {0xFF553064L,0xFF553064L,0xFF553064L,0xFF553064L,0xFF553064L};
+static int16_t g_234 = 0x7821L;
+static uint16_t g_235 = 0xABFCL;
+static int16_t g_252 = 0xF752L;
+static int16_t g_254[10] = {0x0379L,0x0379L,0x0379L,0x0379L,0x0379L,0x0379L,0x0379L,0x0379L,0x0379L,0x0379L};
+static uint16_t g_255 = 5UL;
+static struct S0 *g_259 = &g_70.f2;
+static struct S0 **g_258 = &g_259;
+static const int8_t g_281 = 0x46L;
+static int32_t g_285[7] = {0L,0L,0L,0L,0L,0L,0L};
+static union U3 g_304 = {-8L};
+static uint32_t g_351 = 0x1A7B9ABFL;
+static struct S1 g_361 = {252UL,209};
+static uint8_t g_371[6] = {0x1EL,0x1EL,0x1EL,1UL,1UL,1UL};
+static uint8_t g_389[7] = {0x18L,0x18L,0x18L,0x18L,0x18L,0x18L,0x18L};
+static uint8_t g_397[9][9] = {{1UL,0xA8L,1UL,0xA8L,1UL,0xA8L,1UL,0xA8L,1UL},{255UL,255UL,255UL,255UL,255UL,255UL,255UL,255UL,255UL},{1UL,0xA8L,1UL,0xA8L,1UL,0xA8L,1UL,0xA8L,1UL},{255UL,255UL,255UL,255UL,255UL,255UL,255UL,255UL,255UL},{1UL,0xA8L,1UL,0xA8L,1UL,0xA8L,1UL,0xA8L,1UL},{255UL,255UL,255UL,255UL,255UL,255UL,255UL,255UL,255UL},{1UL,0xA8L,1UL,0xA8L,1UL,0xA8L,1UL,0xA8L,1UL},{255UL,255UL,255UL,255UL,255UL,255UL,255UL,255UL,255UL},{1UL,0xA8L,1UL,0xA8L,1UL,0xA8L,1UL,0xA8L,1UL}};
+static const int16_t g_449 = 0x06B9L;
+static union U3 g_489 = {1L};
+static const union U3 g_524 = {0xFCL};
+static struct S1 **g_538[1] = {(void*)0};
+static uint16_t g_621[10][2][6] = {{{65533UL,65533UL,0UL,0x5037L,0xE95EL,65533UL},{4UL,65533UL,0x38D8L,65533UL,0xE95EL,65527UL}},{{65527UL,0UL,0x5037L,0x68F9L,0x68F9L,4UL},{0xE95EL,0UL,0x68F9L,65527UL,0x68F9L,0xE95EL}},{{0x5037L,0xE95EL,0UL,0UL,4UL,0x38D8L},{65533UL,0xE95EL,65527UL,0x5037L,4UL,0x240AL}},{{0x68F9L,0x68F9L,0x5037L,0x38D8L,0x5037L,0x68F9L},{65527UL,0x68F9L,0xE95EL,0x68F9L,0x5037L,0UL}},{{0UL,4UL,65533UL,0x240AL,0x240AL,65527UL},{0x5037L,0x5037L,0x240AL,0UL,0x240AL,0x5037L}},{{0x38D8L,0x5037L,4UL,4UL,65527UL,0xE95EL},{0x68F9L,0x240AL,0UL,0x38D8L,65527UL,65533UL}},{{0x240AL,0x240AL,0x38D8L,0xE95EL,0x38D8L,0x240AL},{0UL,65527UL,0x5037L,0x240AL,0x38D8L,4UL}},{{0x5037L,65527UL,0x68F9L,65533UL,65533UL,0UL},{0x38D8L,0x38D8L,65533UL,4UL,65533UL,0x38D8L}},{{0x68F9L,0x38D8L,65527UL,65527UL,0UL,0x240AL},{0x240AL,65533UL,4UL,0xE95EL,0UL,0x68F9L}},{{0UL,65533UL,0xE95EL,0x5037L,0xE95EL,0UL},{4UL,0UL,0x38D8L,65533UL,0x68F9L,65527UL}}};
+static const union U3 *g_664 = &g_489;
+static const union U3 **g_663[6][1][8] = {{{&g_664,&g_664,&g_664,&g_664,&g_664,&g_664,&g_664,&g_664}},{{&g_664,&g_664,&g_664,&g_664,&g_664,&g_664,&g_664,&g_664}},{{&g_664,&g_664,&g_664,&g_664,&g_664,&g_664,&g_664,&g_664}},{{&g_664,&g_664,&g_664,&g_664,&g_664,&g_664,&g_664,&g_664}},{{&g_664,&g_664,&g_664,&g_664,&g_664,&g_664,&g_664,&g_664}},{{&g_664,&g_664,&g_664,&g_664,&g_664,&g_664,&g_664,&g_664}}};
+static int16_t g_739[6] = {3L,3L,0x0F38L,4L,0x0F38L,3L};
+static int8_t g_745 = (-1L);
+static int32_t g_747 = 1L;
+static uint32_t g_829[2] = {0x935C6A21L,0x935C6A21L};
+static int32_t g_864[9][5][1] = {{{0xF6C99171L},{0x23E90A78L},{0x23E90A78L},{0x23E90A78L},{0xF6C99171L}},{{0xF6C99171L},{0xF6C99171L},{0xFB433239L},{0x23E90A78L},{0xFB433239L}},{{0x23E90A78L},{0xF6C99171L},{0x23E90A78L},{0xFB433239L},{0xFB433239L}},{{0xFB433239L},{0x23E90A78L},{0x23E90A78L},{0x23E90A78L},{0xF6C99171L}},{{0xFB433239L},{0xF6C99171L},{0xFB433239L},{0x23E90A78L},{0xFB433239L}},{{0xF6C99171L},{0xF6C99171L},{0x23E90A78L},{0xFB433239L},{0xFB433239L}},{{0xFB433239L},{0x23E90A78L},{0x23E90A78L},{0x23E90A78L},{0xF6C99171L}},{{0xFB433239L},{0xF6C99171L},{0x23E90A78L},{0x23E90A78L},{0xFB433239L}},{{0xF6C99171L},{0xF6C99171L},{0xF6C99171L},{0xFB433239L},{0xFB433239L}}};
+static const struct S2 g_873[10] = {{{-1400,335,11},0xAFE2933CL,{1507,179,3},0UL,0xD51EF24AL,4294967287UL,{0UL,25},{-1032,20,21},0x5CBAB4F1L},{{-1400,335,11},0xAFE2933CL,{1507,179,3},0UL,0xD51EF24AL,4294967287UL,{0UL,25},{-1032,20,21},0x5CBAB4F1L},{{1703,485,7},0x9C6C5086L,{1741,654,6},2UL,1UL,1UL,{255UL,223},{-1994,192,10},0UL},{{-350,118,17},0x8ED3ED5FL,{-1139,317,18},0x4A33L,0x123C372FL,1UL,{1UL,331},{-1160,101,7},0x29F7AFD7L},{{1703,485,7},0x9C6C5086L,{1741,654,6},2UL,1UL,1UL,{255UL,223},{-1994,192,10},0UL},{{1703,485,7},0x9C6C5086L,{1741,654,6},2UL,1UL,1UL,{255UL,223},{-1994,192,10},0UL},{{1703,485,7},0x9C6C5086L,{1741,654,6},2UL,1UL,1UL,{255UL,223},{-1994,192,10},0UL},{{-350,118,17},0x8ED3ED5FL,{-1139,317,18},0x4A33L,0x123C372FL,1UL,{1UL,331},{-1160,101,7},0x29F7AFD7L},{{1838,85,6},-1L,{-806,565,13},0x04AFL,0x3473F18AL,0xFFEB4ACFL,{0UL,71},{1706,355,4},1UL},{{-350,118,17},0x8ED3ED5FL,{-1139,317,18},0x4A33L,0x123C372FL,1UL,{1UL,331},{-1160,101,7},0x29F7AFD7L}};
+static uint8_t *g_904 = (void*)0;
+static uint8_t **g_903 = &g_904;
+static int8_t g_921 = (-1L);
+static uint8_t ***g_962 = &g_903;
+static int8_t g_973 = 0x25L;
+static uint32_t g_987[1][5][1] = {{{0xCEE53CD7L},{0xCEE53CD7L},{0xCEE53CD7L},{0xCEE53CD7L},{0xCEE53CD7L}}};
+static struct S2 g_994 = {{1271,119,9},0x1F922EA6L,{-338,152,14},65535UL,9UL,4294967295UL,{0x06L,47},{1040,71,21},0x0F9F6E59L};
+static int8_t g_1120[4] = {1L,1L,1L,1L};
+static const uint32_t **g_1134 = (void*)0;
+static union U3 **g_1183 = (void*)0;
+static int16_t g_1191 = 7L;
+static struct S2 *g_1269 = (void*)0;
+static struct S1 ***g_1322 = &g_538[0];
+static struct S1 ****g_1321[3] = {&g_1322,&g_1322,&g_1322};
+static uint32_t g_1371 = 0x6AB0ECFCL;
+static int8_t ** const g_1385 = (void*)0;
+static struct S2 g_1439 = {{-1864,157,10},0L,{995,67,13},65526UL,0xEDB13D73L,0x2334F1D6L,{0UL,199},{1788,370,3},0xDA46817DL};
+static int32_t g_1441 = 0x14E17A81L;
+static int16_t *g_1525 = &g_739[5];
+static int16_t **g_1524 = &g_1525;
+static const int16_t **g_1528 = (void*)0;
+static const int16_t **g_1529 = (void*)0;
+static union U3 *g_1634 = &g_489;
+static struct S2 g_1672 = {{-1762,333,7},0xF4A56E7FL,{419,337,19},0x9753L,0xC99B31FFL,0x7AE3A617L,{255UL,192},{1333,52,11},5UL};
+
+
+/* --- FORWARD DECLARATIONS --- */
+static uint32_t func_1(void);
+static uint16_t func_2(int32_t p_3, uint8_t p_4, int16_t p_5, union U3 p_6, const uint32_t p_7);
+static union U3 func_10(int8_t p_11, struct S1 p_12, uint32_t p_13, uint16_t p_14);
+static struct S1 func_19(int16_t p_20, union U3 p_21, uint8_t p_22, uint8_t p_23);
+static uint16_t func_24(uint32_t p_25, struct S0 p_26, union U3 p_27, uint32_t p_28, const union U3 p_29);
+static struct S0 func_30(const int8_t p_31, union U3 p_32);
+static union U3 func_33(int8_t p_34, int16_t p_35, int32_t p_36);
+static struct S1 * func_39(int32_t p_40, uint16_t p_41, struct S1 * p_42, struct S1 * p_43);
+static struct S1 * func_45(int32_t p_46, uint32_t p_47);
+static struct S0 * func_55(int16_t p_56, struct S0 * p_57);
+
+
+/* --- FUNCTIONS --- */
+/* ------------------------------------------ */
+/*
+ * reads : g_8 g_54 g_60.f0 g_70 g_79 g_112 g_124 g_125 g_141 g_156 g_67 g_60.f2 g_203 g_217 g_235 g_255 g_258 g_252 g_259 g_281 g_285 g_304 g_304.f3 g_304.f2 g_351 g_361 g_371 g_254 g_389 g_397 g_234 g_449 g_489 g_113 g_524.f2 g_489.f2 g_664 g_489.f3 g_489.f0 g_873.f2.f2 g_739 g_903 g_873.f6.f0 g_921 g_873.f8 g_873.f4 g_873.f0.f0 g_873.f2.f1 g_973 g_987 g_829 g_994.f4 g_994.f2.f2 g_994.f8 g_873.f5 g_747 g_873.f7.f0 g_994.f0.f2 g_60.f1 g_994.f2.f0 g_745 g_1134 g_994.f1 g_621 g_864 g_1191 g_1321 g_994.f7.f0 g_1371 g_1524 g_1528 g_1525 g_663 g_1439.f2.f2 g_1439.f0.f1 g_873.f3 g_524.f3 g_873.f0.f1 g_1120 g_1439.f6.f0 g_1439.f0.f0 g_1672.f0.f0 g_994.f0.f1 g_1439.f6.f1 g_1672.f6.f1
+ * writes: g_54 g_67 g_79 g_70.f2.f0 g_70.f6.f0 g_70.f6 g_60.f0 g_70.f5 g_141 g_125 g_203 g_217 g_70.f1 g_235 g_234 g_255 g_252 g_285 g_156 g_70.f3 g_351 g_254 g_304.f0 g_371 g_389 g_361 g_304.f3 g_489.f1 g_113 g_538 g_489.f2 g_489.f3 g_962 g_489 g_397 g_994.f2.f0 g_1134 g_8 g_304 g_745 g_1371 g_663 g_829 g_1524 g_1529 g_739 g_994.f3 g_1439.f3 g_1191 g_258 g_1634
+ */
+static uint32_t func_1(void)
+{ /* block id: 0 */
+ uint16_t l_9 = 0xCD40L;
+ int16_t l_38[6] = {(-6L),(-6L),(-6L),(-6L),(-6L),(-6L)};
+ const union U3 l_312[4] = {{0xF3L},{0xF3L},{0xF3L},{0xF3L}};
+ int8_t *l_360 = &g_304.f0;
+ union U3 l_754[4] = {{0x5FL},{0x5FL},{0x5FL},{0x5FL}};
+ struct S0 l_1127 = {-277,713,18};
+ struct S1 l_1192 = {0xBBL,139};
+ uint8_t ***l_1201 = &g_903;
+ struct S0 **l_1216[8] = {&g_259,&g_259,&g_259,&g_259,&g_259,&g_259,&g_259,&g_259};
+ int32_t *l_1225 = &g_285[4];
+ int32_t l_1234 = 0xDF42B7A1L;
+ union U3 l_1276 = {0x45L};
+ uint32_t l_1323[6];
+ int8_t l_1345 = 0x20L;
+ union U3 l_1347 = {0x5CL};
+ union U3 *l_1352 = (void*)0;
+ int16_t l_1369[10][2] = {{0xA13FL,0L},{0xA13FL,0xEBB6L},{(-4L),(-4L)},{0xA13FL,(-4L)},{(-4L),0L},{0L,(-4L)},{0L,0L},{(-4L),0xA13FL},{0L,0xA13FL},{0xA13FL,0L}};
+ const uint8_t l_1401[8] = {248UL,248UL,248UL,248UL,248UL,248UL,248UL,248UL};
+ const uint32_t l_1419 = 0xEC2B74D4L;
+ int32_t l_1449 = 0x929224DFL;
+ int32_t l_1451 = (-8L);
+ int32_t l_1452[2];
+ int32_t l_1453 = 1L;
+ const union U3 l_1493 = {0x90L};
+ const union U3 l_1556 = {0L};
+ uint32_t l_1574 = 0x9C50339FL;
+ struct S2 *l_1671 = &g_1672;
+ const int32_t *l_1719 = &l_1453;
+ const int32_t **l_1718[9] = {&l_1719,&l_1719,&l_1719,&l_1719,&l_1719,&l_1719,&l_1719,&l_1719,&l_1719};
+ int i, j;
+ for (i = 0; i < 6; i++)
+ l_1323[i] = 1UL;
+ for (i = 0; i < 2; i++)
+ l_1452[i] = 0xF2D303A9L;
+ if ((func_2(g_8, l_9, l_9, (l_754[3] = func_10(((*l_360) = ((safe_add_func_int32_t_s_s(g_8, ((safe_mul_func_int8_t_s_s(((func_19((func_24(l_9, func_30(l_9, func_33((0xE55B65ABL != (safe_unary_minus_func_int16_t_s(((g_8 , 0xB5BFL) == l_38[0])))), g_8, l_9)), g_304, g_304.f3, l_312[1]) > (-7L)), g_304, g_281, l_38[1]) , 0x6988L) > 1L), 0xA3L)) & g_70.f4))) , l_312[1].f3)), g_361, l_312[1].f3, g_70.f2.f2)), l_312[1].f3) != l_312[1].f2))
+ { /* block id: 684 */
+ struct S1 ***l_1110 = (void*)0;
+ struct S1 ****l_1109 = &l_1110;
+ uint32_t l_1115 = 4294967289UL;
+ uint16_t *l_1123 = &g_994.f3;
+ union U3 *l_1126 = &g_304;
+ uint32_t *l_1128 = (void*)0;
+ uint32_t *l_1129 = &g_829[1];
+ int32_t *l_1130 = &g_994.f1;
+ struct S0 l_1187 = {1711,690,10};
+ int32_t l_1233 = 6L;
+ int32_t l_1235 = 9L;
+ uint16_t l_1240 = 0x94D0L;
+ const union U3 l_1247 = {0x97L};
+ int8_t l_1284 = (-3L);
+ struct S1 l_1294 = {251UL,278};
+ int8_t l_1301[2];
+ int8_t **l_1316 = &l_360;
+ int8_t ***l_1315 = &l_1316;
+ union U3 l_1324 = {0xAFL};
+ union U3 l_1344 = {0L};
+ int i;
+ for (i = 0; i < 2; i++)
+ l_1301[i] = 5L;
+ if (l_312[1].f2)
+ { /* block id: 689 */
+ uint16_t l_1136 = 0x2987L;
+ for (g_252 = 0; (g_252 != 2); g_252++)
+ { /* block id: 692 */
+ int32_t l_1133 = (-1L);
+ const uint32_t ***l_1135 = &g_1134;
+ int32_t *l_1137 = &g_8;
+ if (l_38[3])
+ break;
+ (*l_1137) |= (l_1133 , ((((*l_1135) = g_1134) != (void*)0) || l_1136));
+ }
+ }
+ else
+ { /* block id: 697 */
+ union U3 l_1164 = {1L};
+ int16_t *l_1180 = &l_38[0];
+ int16_t **l_1179 = &l_1180;
+ union U3 **l_1190 = &l_1126;
+ int32_t * const l_1221[7][10] = {{&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0},{&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0},{&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0},{&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0},{&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0},{&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0},{&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0,&g_8,(void*)0}};
+ struct S1 l_1223 = {0xEBL,121};
+ struct S0 l_1248 = {1351,604,9};
+ int16_t l_1279[4];
+ const struct S2 l_1314 = {{1802,353,14},0x3F82D2C5L,{-600,686,5},0x3667L,0x9173B856L,1UL,{0x91L,155},{-1532,265,3},2UL};
+ union U3 l_1346 = {0xBAL};
+ int16_t l_1348 = 0xD08AL;
+ struct S1 l_1349[4][4][7] = {{{{6UL,66},{0x30L,289},{0UL,48},{0x51L,94},{0UL,48},{0x84L,29},{6UL,66}},{{0xE0L,225},{0xE0L,225},{0xE0L,225},{255UL,294},{255UL,294},{255UL,294},{0xE0L,225}},{{0UL,48},{0x84L,29},{6UL,66},{0x84L,29},{0UL,48},{0x30L,289},{0UL,54}},{{0xE0L,225},{0xE0L,225},{1UL,285},{255UL,294},{1UL,285},{0xE0L,225},{1UL,285}}},{{{6UL,66},{0x51L,94},{6UL,66},{0x30L,289},{6UL,66},{0x30L,289},{0UL,48}},{{1UL,285},{0xE0L,225},{1UL,285},{0xE0L,225},{255UL,294},{255UL,294},{255UL,294}},{{0UL,48},{0x84L,29},{0UL,54},{0x30L,289},{0UL,54},{0x51L,94},{0UL,48}},{{1UL,285},{1UL,285},{1UL,285},{0xE0L,225},{0xE0L,225},{0xE0L,225},{1UL,285}}},{{{0UL,54},{0x51L,94},{0UL,48},{0x51L,94},{0UL,54},{0x84L,29},{6UL,66}},{{1UL,285},{1UL,285},{255UL,294},{0xE0L,225},{255UL,294},{1UL,285},{255UL,294}},{{0UL,48},{0x30L,289},{0UL,48},{0x84L,29},{0UL,48},{0x84L,29},{0UL,54}},{{255UL,294},{1UL,285},{255UL,294},{1UL,285},{0xE0L,225},{0xE0L,225},{0xE0L,225}}},{{{0UL,54},{0x51L,94},{6UL,66},{0x84L,29},{6UL,66},{0x30L,289},{0UL,54}},{{255UL,294},{255UL,294},{255UL,294},{1UL,285},{1UL,285},{1UL,285},{255UL,294}},{{6UL,66},{0x30L,289},{0UL,54},{0x30L,289},{6UL,66},{0x51L,94},{0UL,48}},{{255UL,294},{255UL,294},{0xE0L,225},{1UL,285},{1UL,285},{255UL,294},{0xE0L,225}}}};
+ int i, j, k;
+ for (i = 0; i < 4; i++)
+ l_1279[i] = (-6L);
+ for (l_1115 = 0; (l_1115 != 57); l_1115 = safe_add_func_int8_t_s_s(l_1115, 2))
+ { /* block id: 700 */
+ int16_t l_1163 = 0x7843L;
+ struct S1 l_1173 = {4UL,105};
+ int16_t **l_1182 = (void*)0;
+ union U3 l_1188 = {-1L};
+ const union U3 l_1189 = {9L};
+ uint8_t ** const l_1200 = (void*)0;
+ uint8_t ** const *l_1199[2];
+ uint8_t ** const **l_1198 = &l_1199[1];
+ int32_t l_1236 = 1L;
+ int32_t l_1237 = 4L;
+ int16_t l_1239[5] = {1L,1L,1L,1L,1L};
+ const int32_t l_1262 = 0x1349BCC1L;
+ int i;
+ for (i = 0; i < 2; i++)
+ l_1199[i] = &l_1200;
+ }
+ for (g_234 = (-12); (g_234 > (-8)); ++g_234)
+ { /* block id: 787 */
+ int32_t l_1272 = 0x5F87868CL;
+ uint8_t *l_1273 = &l_754[3].f2;
+ union U3 l_1281 = {0x49L};
+ const uint32_t *l_1328 = (void*)0;
+ const uint32_t **l_1327 = &l_1328;
+ int32_t *l_1329[2][4];
+ int i, j;
+ for (i = 0; i < 2; i++)
+ {
+ for (j = 0; j < 4; j++)
+ l_1329[i][j] = &l_1272;
+ }
+ if ((g_739[5] || (((((((*l_1225) >= (~0x6CL)) , (0x48D5L ^ (((((*l_1225) != 0x13D4L) , (void*)0) == (*l_1179)) && (*l_1225)))) > 1L) <= l_1279[2]) , 0x53A9BAF2L) < 0UL)))
+ { /* block id: 789 */
+ int32_t l_1280 = 0x5CD13976L;
+ int8_t *l_1285 = &l_1276.f3;
+ uint8_t *l_1286 = (void*)0;
+ uint8_t *l_1287 = &g_203[3];
+ struct S1 l_1288 = {0xDEL,11};
+ uint16_t l_1299 = 0xE6BCL;
+ l_1288 = func_19(l_1280, ((**l_1190) = l_1281), ((*l_1273) ^= 0xD9L), ((*l_1287) |= ((g_994.f1 & (((l_1280 > (4UL >= g_621[1][0][1])) ^ ((*l_1285) ^= (g_745 = l_1284))) <= g_397[7][7])) > 1UL)));
+ if (l_1187.f2)
+ { /* block id: 796 */
+ const uint8_t *l_1290 = &l_1276.f2;
+ const uint8_t ** const l_1289[4] = {&l_1290,&l_1290,&l_1290,&l_1290};
+ const uint8_t **l_1292 = (void*)0;
+ const uint8_t ***l_1291 = &l_1292;
+ struct S1 *l_1293[7];
+ int i;
+ for (i = 0; i < 7; i++)
+ l_1293[i] = &g_994.f6;
+ (*l_1291) = l_1289[1];
+ l_1294 = l_1192;
+ return l_1281.f2;
+ }
+ else
+ { /* block id: 800 */
+ struct S0 l_1300 = {1603,306,9};
+ const struct S1 *l_1320 = &g_70.f6;
+ const struct S1 **l_1319 = &l_1320;
+ const struct S1 ***l_1318 = &l_1319;
+ const struct S1 ****l_1317 = &l_1318;
+ uint32_t * const l_1326 = &g_217[1];
+ uint32_t * const *l_1325 = &l_1326;
+ (*l_1225) = (-6L);
+ (*l_1225) = l_1281.f2;
+ if (l_1301[1])
+ break;
+ l_1300.f0 &= (((l_1299 ^ ((safe_add_func_int16_t_s_s((g_864[8][4][0] | g_1191), (l_1294.f1 , ((safe_lshift_func_uint8_t_u_u(l_1294.f0, 2)) == (&g_217[1] == l_1221[2][6]))))) , ((--(*l_1287)) | (func_30((safe_mul_func_uint8_t_u_u(0x1FL, ((safe_lshift_func_uint8_t_u_u((safe_div_func_int8_t_s_s((((((((l_1314 , l_1115) < 0xE394C0B6L) , l_1315) != (void*)0) , l_1317) == g_1321[2]) || l_1323[5]), 246UL)), 7)) | l_1240))), l_1324) , l_1294.f0)))) , l_1325) != l_1327);
+ }
+ }
+ else
+ { /* block id: 808 */
+ (*l_1225) = l_1324.f0;
+ l_1329[0][1] = &l_1233;
+ }
+ }
+ l_1349[1][1][4] = func_19((safe_lshift_func_uint8_t_u_u(((((void*)0 != &l_1201) != (((0xA1DDCCE8L < (*l_1225)) , l_754[3]) , (*l_1225))) <= 0x8222L), (*l_1225))), (*l_1126), l_1348, (*l_1225));
+ }
+ }
+ else
+ { /* block id: 818 */
+ union U3 *l_1350 = &l_1276;
+ union U3 **l_1351[2];
+ uint32_t l_1353 = 4UL;
+ int32_t l_1366 = 0x100FF667L;
+ const uint16_t *l_1388[2][7][5] = {{{&l_9,(void*)0,&g_994.f3,&g_255,&g_994.f3},{(void*)0,(void*)0,&g_873[1].f3,(void*)0,(void*)0},{&g_994.f3,&g_994.f3,(void*)0,&l_9,(void*)0},{&g_255,&g_621[0][1][1],&l_9,(void*)0,&g_994.f3},{&g_70.f3,&g_873[1].f3,&g_255,&g_70.f3,(void*)0},{&g_873[1].f3,&g_621[0][1][1],&g_873[1].f3,&g_255,&g_994.f3},{&g_873[1].f3,&g_994.f3,(void*)0,&g_255,&g_70.f3}},{{(void*)0,(void*)0,&g_873[1].f3,&g_70.f3,&l_9},{&g_621[6][1][5],(void*)0,&g_621[0][1][1],(void*)0,&g_621[6][1][5]},{(void*)0,&g_70.f3,&l_9,&l_9,&g_255},{&g_873[1].f3,(void*)0,&l_9,(void*)0,(void*)0},{&g_873[1].f3,(void*)0,&g_621[0][1][1],&g_255,&g_70.f3},{&g_70.f3,(void*)0,&g_873[1].f3,&g_873[1].f3,(void*)0},{&g_255,&g_873[1].f3,(void*)0,(void*)0,&g_255}}};
+ uint32_t *l_1397 = &g_217[1];
+ uint32_t **l_1396 = &l_1397;
+ union U3 l_1400[4] = {{0x80L},{0x80L},{0x80L},{0x80L}};
+ uint8_t l_1414 = 0x11L;
+ uint32_t l_1432 = 4294967294UL;
+ struct S2 *l_1438 = &g_1439;
+ int32_t l_1444 = 0xD7977A03L;
+ int32_t l_1445 = 1L;
+ int32_t l_1446 = 1L;
+ int32_t l_1447 = 0xA62D7EDBL;
+ int32_t l_1454 = 0x06D6FB74L;
+ int8_t l_1455 = (-6L);
+ uint32_t l_1456 = 0xE877AD48L;
+ uint16_t l_1467 = 2UL;
+ uint8_t *l_1494 = (void*)0;
+ uint8_t *l_1495 = &g_397[6][7];
+ union U3 l_1498 = {0xC6L};
+ int16_t l_1499 = 0xE9BFL;
+ struct S1 l_1533[6][8][5] = {{{{0UL,13},{255UL,320},{0x52L,217},{0UL,173},{0xC3L,289}},{{1UL,61},{247UL,80},{0UL,219},{0xC3L,289},{0UL,173}},{{248UL,194},{255UL,320},{0x87L,37},{0UL,219},{0x52L,217}},{{1UL,332},{0UL,18},{247UL,80},{1UL,61},{247UL,80}},{{1UL,61},{0xC3L,289},{0x24L,89},{0x40L,287},{0x85L,59}},{{0x23L,289},{0UL,13},{0xC0L,7},{0x40L,287},{0xBDL,201}},{{0x31L,83},{252UL,64},{0xBDL,201},{1UL,61},{0xC3L,289}},{{0UL,173},{0x40L,287},{255UL,156},{0UL,219},{0x23L,289}}},{{{0x85L,59},{1UL,332},{0xEEL,78},{0xC3L,289},{0x3DL,296}},{{1UL,274},{252UL,64},{247UL,80},{0UL,173},{0x40L,287}},{{0x85L,59},{0UL,219},{0UL,128},{0x52L,217},{248UL,194}},{{0UL,173},{0x31L,83},{0x23L,289},{247UL,80},{0x3DL,296}},{{0x31L,83},{0UL,18},{0x52L,217},{0x85L,59},{0UL,219}},{{0x23L,289},{0x52L,217},{0x52L,217},{0xBDL,201},{0x88L,333}},{{1UL,61},{1UL,274},{0x23L,289},{0xC3L,289},{0xBDL,201}},{{1UL,332},{255UL,320},{0UL,128},{0x23L,289},{0x52L,217}}},{{{248UL,194},{0xBDL,201},{247UL,80},{0x3DL,296},{0UL,31}},{{1UL,61},{0x31L,83},{0xEEL,78},{0x40L,287},{0x52L,217}},{{0UL,13},{0UL,13},{255UL,156},{248UL,194},{0xBDL,201}},{{0x88L,333},{0x3DL,296},{0xBDL,201},{0x3DL,296},{0x88L,333}},{{0UL,173},{1UL,332},{0xC0L,7},{0UL,219},{0UL,219}},{{255UL,320},{1UL,332},{0x24L,89},{0x88L,333},{0x3DL,296}},{{0UL,31},{0x3DL,296},{247UL,80},{0xBDL,201},{248UL,194}},{{0x85L,59},{0UL,13},{0x87L,37},{0x52L,217},{0x40L,287}}},{{{0UL,18},{0x31L,83},{0UL,219},{0UL,31},{0x3DL,296}},{{0x88L,333},{0xBDL,201},{0x52L,217},{0x52L,217},{0x23L,289}},{{0x23L,289},{255UL,320},{0x85L,59},{0xBDL,201},{0xC3L,289}},{{252UL,64},{1UL,274},{0UL,219},{0x88L,333},{0xBDL,201}},{{248UL,194},{0x52L,217},{0UL,128},{0UL,219},{0x85L,59}},{{248UL,194},{0UL,18},{0UL,31},{0x3DL,296},{247UL,80}},{{252UL,64},{0x31L,83},{0x24L,89},{248UL,194},{0x52L,217}},{{0x23L,289},{0UL,219},{255UL,156},{0x40L,287},{0UL,173}}},{{{0x88L,333},{252UL,64},{0UL,173},{0x3DL,296},{0x23L,289}},{{0UL,18},{1UL,332},{255UL,156},{0x23L,289},{248UL,194}},{{0x85L,59},{0x40L,287},{0x24L,89},{0xC3L,289},{0xFAL,126}},{{0UL,31},{252UL,64},{0UL,31},{0xBDL,201},{0UL,173}},{{255UL,320},{0UL,13},{0UL,128},{0x85L,59},{0UL,173}},{{0UL,173},{0xC3L,289},{0UL,219},{247UL,80},{0xFAL,126}},{{0x88L,333},{0UL,18},{0x85L,59},{0x52L,217},{248UL,194}},{{0UL,13},{255UL,320},{0x52L,217},{0UL,173},{0x23L,289}}},{{{1UL,61},{247UL,80},{0UL,219},{0xC3L,289},{0x43L,140}},{{248UL,194},{255UL,320},{0x87L,37},{0UL,219},{0xEEL,78}},{{1UL,332},{0UL,18},{247UL,80},{1UL,61},{0x87L,37}},{{1UL,61},{0xC3L,289},{0x24L,89},{0x40L,287},{255UL,125}},{{0x23L,289},{0UL,13},{252UL,64},{0x40L,287},{9UL,327}},{{0x31L,83},{252UL,64},{9UL,327},{1UL,61},{0x23L,289}},{{0UL,173},{0x40L,287},{1UL,61},{0UL,219},{1UL,332}},{{0x85L,59},{1UL,332},{5UL,232},{0xC3L,289},{1UL,212}}}};
+ struct S0 l_1644 = {-1878,566,19};
+ int16_t ***l_1649 = (void*)0;
+ struct S1 *l_1713[4] = {(void*)0,(void*)0,(void*)0,(void*)0};
+ uint32_t l_1743 = 4294967294UL;
+ int i, j, k;
+ for (i = 0; i < 2; i++)
+ l_1351[i] = &l_1350;
+ l_1352 = l_1350;
+lbl_1543:
+ if ((l_1353 = ((*l_1225) | (*l_1225))))
+ { /* block id: 821 */
+ uint16_t l_1357 = 0x8178L;
+ union U3 *l_1358 = &l_1347;
+ const uint32_t l_1363[2][8][10] = {{{0x05B69A1BL,0UL,4294967288UL,1UL,0xB0DB8155L,4294967288UL,0xB0DB8155L,1UL,0UL,0x05B69A1BL},{1UL,0x05B69A1BL,0UL,0xB0DB8155L,4294967288UL,0UL,0UL,0xB0DB8155L,0x05B69A1BL,1UL},{0xB0DB8155L,0xB0DB8155L,0x05B69A1BL,4294967288UL,0UL,0x05B69A1BL,0x05B69A1BL,4294967288UL,1UL,0xB0DB8155L},{4294967288UL,4294967288UL,1UL,0UL,0x05B69A1BL,1UL,1UL,0UL,0xB0DB8155L,4294967288UL},{0UL,0UL,0xB0DB8155L,0x05B69A1BL,1UL,0xB0DB8155L,0xB0DB8155L,0x05B69A1BL,4294967288UL,0UL},{0x05B69A1BL,0x05B69A1BL,4294967288UL,1UL,4294967288UL,4294967288UL,4294967288UL,1UL,0UL,1UL},{1UL,1UL,0UL,0xB0DB8155L,0UL,0UL,0UL,0xB0DB8155L,0x05B69A1BL,0xB0DB8155L},{0xB0DB8155L,0xB0DB8155L,0x05B69A1BL,4294967288UL,0x05B69A1BL,0x05B69A1BL,0x05B69A1BL,4294967288UL,1UL,4294967288UL}},{{4294967288UL,4294967288UL,0xB0DB8155L,0UL,1UL,1UL,1UL,0x05B69A1BL,0xB0DB8155L,0UL},{0UL,0UL,4294967288UL,0x05B69A1BL,0xB0DB8155L,0xB0DB8155L,0xB0DB8155L,1UL,4294967288UL,0x05B69A1BL},{0x05B69A1BL,0x05B69A1BL,0UL,1UL,4294967288UL,4294967288UL,4294967288UL,0xB0DB8155L,0UL,1UL},{0xB0DB8155L,1UL,0x05B69A1BL,0xB0DB8155L,0UL,0x05B69A1BL,0UL,4294967288UL,0x05B69A1BL,0xB0DB8155L},{4294967288UL,0xB0DB8155L,1UL,4294967288UL,0x05B69A1BL,1UL,0x05B69A1BL,0UL,1UL,4294967288UL},{0UL,4294967288UL,0xB0DB8155L,0UL,1UL,0xB0DB8155L,1UL,0x05B69A1BL,4294967288UL,0UL},{0x05B69A1BL,0UL,4294967288UL,1UL,0xB0DB8155L,4294967288UL,0xB0DB8155L,1UL,0UL,0x05B69A1BL},{1UL,0x05B69A1BL,0UL,0xB0DB8155L,4294967288UL,0UL,4294967288UL,0xB0DB8155L,0x05B69A1BL,1UL}}};
+ uint16_t *l_1364[10][8][3] = {{{&g_994.f3,&g_255,&l_9},{&l_9,&l_9,&l_1357},{&g_994.f3,&g_994.f3,&g_255},{&g_79,(void*)0,&g_255},{(void*)0,&g_621[2][1][5],(void*)0},{&g_79,(void*)0,&g_621[4][0][2]},{&g_994.f3,&g_994.f3,(void*)0},{(void*)0,(void*)0,&g_255}},{{(void*)0,&g_994.f3,&g_79},{&g_79,&g_79,&g_621[0][1][1]},{&g_70.f3,&l_9,&l_9},{&l_9,(void*)0,(void*)0},{&g_621[0][1][1],&g_621[0][1][1],&g_70.f3},{(void*)0,&g_79,&g_235},{&g_994.f3,&g_621[0][1][1],&l_1357},{&g_79,&g_70.f3,(void*)0}},{{&g_70.f3,(void*)0,&g_621[0][1][1]},{&g_621[0][1][1],(void*)0,&g_70.f3},{(void*)0,&g_621[2][1][5],&g_70.f3},{&g_621[0][1][1],&l_1357,&g_235},{&l_9,&g_994.f3,&g_994.f3},{(void*)0,(void*)0,(void*)0},{(void*)0,&l_1357,&g_994.f3},{&g_70.f3,(void*)0,&g_994.f3}},{{&g_70.f3,&g_235,(void*)0},{&g_255,&g_255,&g_70.f3},{(void*)0,&g_994.f3,&l_9},{&l_9,(void*)0,&l_9},{&l_9,&g_255,&g_621[0][1][1]},{&l_1357,&g_621[0][1][1],&l_9},{&g_255,&l_1357,&g_255},{&g_255,&g_621[4][1][0],(void*)0}},{{(void*)0,(void*)0,&g_255},{&g_621[4][0][2],&l_1357,&l_9},{(void*)0,&g_255,&g_621[0][1][1]},{&g_255,&g_621[0][1][1],&g_79},{&g_79,(void*)0,&g_255},{&g_621[0][1][1],&g_79,&g_994.f3},{&l_9,&g_621[0][1][1],(void*)0},{(void*)0,(void*)0,&g_70.f3}},{{&g_70.f3,&g_235,(void*)0},{&g_235,(void*)0,&l_1357},{&l_1357,&g_70.f3,&g_235},{(void*)0,&l_9,(void*)0},{&g_621[0][1][1],&g_994.f3,(void*)0},{&g_70.f3,(void*)0,&l_9},{&g_70.f3,&g_994.f3,&g_621[2][1][5]},{&g_235,&l_9,&g_79}},{{&g_994.f3,&g_994.f3,(void*)0},{(void*)0,&g_235,&g_79},{&g_994.f3,&g_994.f3,&g_255},{&g_994.f3,&g_70.f3,(void*)0},{(void*)0,(void*)0,&g_255},{&g_70.f3,&g_621[4][1][0],&l_9},{&l_9,&g_621[0][1][1],(void*)0},{&l_9,&g_70.f3,&g_235}},{{&g_255,&g_994.f3,&l_9},{&l_9,&l_9,(void*)0},{&g_255,(void*)0,&g_255},{(void*)0,(void*)0,&g_994.f3},{&g_255,(void*)0,&g_994.f3},{&l_9,&g_235,&l_9},{&g_621[0][1][1],(void*)0,&g_994.f3},{&g_79,&g_235,&g_235}},{{&g_255,&g_994.f3,&l_1357},{&g_994.f3,&g_621[4][0][2],&g_70.f3},{(void*)0,(void*)0,&g_994.f3},{&g_70.f3,&l_9,(void*)0},{&g_255,&g_621[0][1][1],&l_1357},{&l_1357,&g_79,(void*)0},{&g_235,&g_235,&l_9},{(void*)0,(void*)0,(void*)0}},{{(void*)0,&g_621[0][1][1],&g_994.f3},{&l_9,&g_79,(void*)0},{&g_70.f3,&g_235,&g_79},{&g_79,(void*)0,(void*)0},{(void*)0,&g_255,&g_994.f3},{&g_79,&g_79,&g_621[4][0][2]},{&g_255,&g_255,&l_9},{(void*)0,&g_621[4][1][0],(void*)0}}};
+ int32_t l_1365 = 0x47BABE44L;
+ int i, j, k;
+ l_1366 = (safe_rshift_func_uint16_t_u_u((l_1365 |= ((safe_unary_minus_func_uint8_t_u((l_1357 < ((safe_mod_func_int32_t_s_s((safe_sub_func_int16_t_s_s(((l_1357 == (l_1353 > 0xE5L)) & g_994.f7.f0), 0xF43BL)), l_1363[0][0][1])) , 9UL)))) <= 7L)), 8));
+ }
+ else
+ { /* block id: 825 */
+ int32_t *l_1367 = &g_285[6];
+ int32_t *l_1368[6] = {(void*)0,&g_8,&g_285[0],&g_285[0],(void*)0,&g_8};
+ int16_t l_1370 = 1L;
+ uint16_t l_1461 = 65526UL;
+ union U3 *l_1486 = &l_754[2];
+ int i;
+ g_1371++;
+ l_1366 = (safe_mul_func_uint8_t_u_u(g_70.f7.f2, g_304.f3));
+ for (l_1276.f2 = 0; (l_1276.f2 <= 8); l_1276.f2 += 1)
+ { /* block id: 830 */
+ uint8_t l_1378[5] = {0x4DL,0x4DL,0x4DL,0x4DL,0x4DL};
+ union U3 l_1395[6][4][6] = {{{{0x3FL},{1L},{0x00L},{1L},{0x76L},{1L}},{{1L},{0x76L},{0x98L},{1L},{0x3FL},{0x96L}},{{0x3FL},{8L},{0xC5L},{0x98L},{0x3FL},{0x3FL}},{{8L},{0x86L},{0x86L},{0xC5L},{0x3FL},{1L}}},{{{1L},{8L},{0x98L},{0x3FL},{0x86L},{1L}},{{0x76L},{0x96L},{0x3FL},{0x00L},{0x00L},{1L}},{{0x3FL},{0x3FL},{0x98L},{0xC5L},{0x98L},{0L}},{{0x3FL},{0xC5L},{0x76L},{0x96L},{1L},{0x76L}}},{{{0x3FL},{8L},{0L},{0xC5L},{0x00L},{1L}},{{0x86L},{8L},{0x04L},{1L},{0xC5L},{0x04L}},{{0x00L},{8L},{0x98L},{0x76L},{0x00L},{0x76L}},{{0x98L},{0x04L},{0x98L},{0L},{0L},{8L}}},{{{1L},{0L},{0x98L},{0xC5L},{0x04L},{0x76L}},{{0x96L},{0x76L},{8L},{0xC5L},{1L},{0xC5L}},{{0xC5L},{1L},{1L},{0xC5L},{0x00L},{0x98L}},{{0x00L},{1L},{0x86L},{1L},{0x00L},{0x00L}}},{{{0L},{1L},{1L},{0x86L},{0x00L},{0x76L}},{{0x04L},{0L},{0xC5L},{0x00L},{1L},{0x76L}},{{1L},{0x98L},{0x00L},{8L},{8L},{0x76L}},{{0x00L},{0x00L},{1L},{0x3FL},{1L},{0x96L}}},{{{0x00L},{0x86L},{1L},{0x98L},{0x76L},{1L}},{{0x00L},{0L},{0x96L},{0x86L},{0x98L},{0x04L}},{{1L},{0L},{0x3FL},{0x04L},{0x86L},{0x3FL}},{{0x98L},{0L},{1L},{1L},{8L},{1L}}}};
+ int32_t l_1406 = 0x84A3375CL;
+ int32_t l_1409[2][7][7] = {{{(-1L),0x5E4ADE58L,0xA92151E5L,0x4456E609L,0x4456E609L,0x058BA5DFL,(-8L)},{6L,8L,0L,(-3L),0xA1BC5B01L,0L,0L},{(-8L),0x682FACEEL,0xA92151E5L,0x1002CC41L,(-1L),0xA92151E5L,(-1L)},{0x8DB6EE34L,(-8L),8L,0L,0xFA31E86AL,(-3L),0x9B3A76E7L},{0xA92151E5L,0x682FACEEL,0x5E4ADE58L,0xFE2A663DL,0x636A4255L,0x058BA5DFL,(-1L)},{0L,0x710534E2L,0L,6L,0L,0x710534E2L,0x710534E2L},{0xA92151E5L,(-1L),0L,0x058BA5DFL,(-1L),0x1002CC41L,0x682FACEEL}},{{8L,1L,0x8DB6EE34L,0xA1BC5B01L,(-8L),0L,0x710534E2L},{0x5E4ADE58L,0x62B1F322L,0x1002CC41L,0xFE2A663DL,0x62B1F322L,0x4456E609L,0x636A4255L},{0L,8L,0x8DB6EE34L,8L,0xFA31E86AL,0L,0x4E0C0582L},{0L,(-1L),0x682FACEEL,0x682FACEEL,(-8L),(-1L),(-8L)},{0x8DB6EE34L,8L,(-3L),6L,0xFA31E86AL,0xA1BC5B01L,6L},{0x1002CC41L,0x1002CC41L,0xFE2A663DL,0x62B1F322L,0x4456E609L,0xA92151E5L,(-1L)},{0x8DB6EE34L,0xFA31E86AL,0x8DB6EE34L,(-3L),6L,0x9B3A76E7L,(-3L)}}};
+ int16_t l_1411 = 1L;
+ int32_t **l_1435 = &l_1368[1];
+ int32_t *l_1440 = &l_1406;
+ int16_t l_1460 = (-9L);
+ int32_t l_1474 = 3L;
+ int i, j, k;
+ }
+ }
+ if (((*l_1225) && 0x7FFFL))
+ { /* block id: 894 */
+ const union U3 ***l_1496 = &g_663[0][0][3];
+ const int32_t l_1497 = (-2L);
+ int32_t l_1504 = 1L;
+ uint8_t l_1505 = 255UL;
+ struct S0 l_1555[4] = {{85,152,2},{85,152,2},{85,152,2},{85,152,2}};
+ struct S1 *l_1577 = &g_361;
+ int16_t *l_1584 = &g_1191;
+ int16_t *l_1597 = &g_252;
+ int16_t *l_1598[7];
+ int i;
+ for (i = 0; i < 7; i++)
+ l_1598[i] = &l_1499;
+ (*l_1496) = &g_664;
+ (*l_1225) |= (0xE8E8L != (6L == ((void*)0 != &g_1183)));
+ if (((l_1497 , l_1497) , ((l_1497 < l_1499) , (*l_1225))))
+ { /* block id: 897 */
+ int16_t l_1500 = 0x9452L;
+ int32_t *l_1501 = &g_8;
+ int32_t *l_1502 = (void*)0;
+ int32_t *l_1503[10] = {&g_8,&l_1444,&l_1452[0],&l_1366,&l_1444,&l_1444,&l_1452[0],&g_8,&l_1445,&l_1452[0]};
+ int8_t l_1515 = 0x77L;
+ uint32_t l_1527[2][1];
+ struct S1 l_1534 = {1UL,311};
+ struct S2 **l_1548 = &g_1269;
+ union U3 l_1551 = {0x44L};
+ int i, j;
+ for (i = 0; i < 2; i++)
+ {
+ for (j = 0; j < 1; j++)
+ l_1527[i][j] = 1UL;
+ }
+ l_1505++;
+ for (l_1498.f3 = 9; (l_1498.f3 != 23); ++l_1498.f3)
+ { /* block id: 901 */
+ uint16_t *l_1510 = &g_994.f3;
+ uint32_t *l_1516 = (void*)0;
+ uint32_t *l_1517 = &g_829[0];
+ int16_t ***l_1526 = &g_1524;
+ int32_t l_1532 = 0x6526D43DL;
+ (*l_1225) = (((((*l_1517) = (((l_1510 != &l_9) != l_1505) || (*l_1225))) ^ (*l_1501)) >= (*l_1501)) > l_1447);
+ (*l_1501) ^= 0xD0C593A4L;
+ l_1534 = ((g_351 > (safe_mod_func_uint8_t_u_u(((((*l_360) = g_60.f0) == g_70.f8) && ((*g_1525) &= (safe_sub_func_uint32_t_u_u(l_1505, (safe_sub_func_uint16_t_u_u((((*l_1526) = g_1524) == (g_1529 = (l_1527[1][0] , g_1528))), (safe_div_func_int32_t_s_s(l_1455, l_1532)))))))), 5L))) , l_1533[3][4][3]);
+ return g_873[1].f8;
+ }
+ for (g_489.f2 = 0; (g_489.f2 > 35); g_489.f2 = safe_add_func_int16_t_s_s(g_489.f2, 1))
+ { /* block id: 915 */
+ uint8_t l_1540 = 1UL;
+ int32_t *l_1557 = &l_1452[0];
+ struct S2 **l_1558 = &g_1269;
+ uint16_t l_1561[5][8] = {{0xD1F5L,65535UL,1UL,0xC146L,0xD1F5L,65535UL,65528UL,8UL},{0xC146L,0xC146L,1UL,65535UL,1UL,1UL,8UL,65528UL},{1UL,1UL,1UL,0xD1F5L,1UL,1UL,1UL,8UL},{0xD1F5L,1UL,8UL,65535UL,1UL,1UL,65528UL,1UL},{1UL,0xC146L,0xC146L,65528UL,1UL,1UL,0xC146L,65528UL}};
+ union U3 l_1573 = {0xCFL};
+ struct S1 **l_1576[7][9][3] = {{{&g_156[2][2][2],&g_156[2][3][6],&g_156[2][1][7]},{&g_156[2][1][7],&g_156[2][7][2],(void*)0},{&g_156[2][1][7],&g_156[2][7][2],&g_156[2][1][7]},{&g_156[2][3][6],&g_156[0][2][7],&g_156[2][1][7]},{&g_156[2][1][7],&g_156[2][1][7],(void*)0},{&g_156[2][1][7],&g_156[2][1][7],&g_156[2][1][7]},{&g_156[2][1][7],&g_156[2][1][7],&g_156[2][1][6]},{&g_156[2][1][7],&g_156[2][1][7],&g_156[0][5][3]},{&g_156[2][1][7],&g_156[3][2][3],&g_156[2][1][7]}},{{&g_156[0][1][7],&g_156[2][4][0],(void*)0},{&g_156[2][1][7],&g_156[2][2][2],&g_156[2][7][2]},{&g_156[2][1][7],&g_156[0][5][3],&g_156[2][2][2]},{&g_156[2][4][0],&g_156[2][7][2],&g_156[3][2][3]},{&g_156[2][7][2],&g_156[0][5][3],&g_156[2][1][7]},{&g_156[2][1][7],&g_156[2][1][7],&g_156[2][7][2]},{&g_156[2][1][7],&g_156[2][7][2],&g_156[2][1][7]},{&g_156[2][1][7],&g_156[2][1][7],&g_156[2][1][7]},{&g_156[2][1][7],&g_156[0][1][7],(void*)0}},{{&g_156[2][1][6],&g_156[2][1][7],&g_156[0][3][0]},{&g_156[2][1][7],(void*)0,&g_156[2][2][2]},{&g_156[0][3][0],&g_156[2][1][7],(void*)0},{&g_156[2][1][7],&g_156[3][2][3],&g_156[0][1][7]},{&g_156[0][5][3],&g_156[2][1][7],&g_156[2][7][2]},{&g_156[2][1][7],&g_156[2][1][7],&g_156[0][5][3]},{(void*)0,&g_156[0][5][3],&g_156[2][1][7]},{&g_156[0][3][0],&g_156[0][3][0],(void*)0},{(void*)0,&g_156[2][1][6],&g_156[2][7][2]}},{{&g_156[2][1][7],&g_156[2][1][7],&g_156[2][1][7]},{&g_156[2][1][7],&g_156[2][1][7],(void*)0},{&g_156[2][1][7],&g_156[0][2][7],&g_156[2][1][7]},{&g_156[2][1][7],&g_156[0][1][7],&g_156[2][1][6]},{&g_156[2][1][7],(void*)0,&g_156[0][5][3]},{&g_156[0][5][3],&g_156[2][1][7],&g_156[2][1][7]},{&g_156[2][1][7],&g_156[2][1][7],(void*)0},{&g_156[2][1][7],&g_156[2][1][7],&g_156[2][7][2]},{&g_156[0][2][7],&g_156[2][1][7],&g_156[2][2][2]}},{{&g_156[2][1][7],&g_156[0][3][0],&g_156[3][2][3]},{&g_156[1][4][6],&g_156[2][1][7],&g_156[2][1][7]},{&g_156[3][2][3],&g_156[2][7][2],&g_156[2][7][2]},{&g_156[0][3][0],&g_156[2][1][6],&g_156[2][1][7]},{&g_156[0][2][7],&g_156[2][1][7],&g_156[2][1][7]},{&g_156[2][1][7],&g_156[2][1][7],(void*)0},{&g_156[2][7][2],(void*)0,&g_156[0][3][0]},{&g_156[3][2][3],&g_156[3][2][3],&g_156[2][2][2]},{&g_156[2][7][2],&g_156[2][1][7],(void*)0}},{{(void*)0,&g_156[2][1][7],&g_156[0][1][7]},{&g_156[2][3][6],&g_156[2][1][7],&g_156[2][7][2]},{&g_156[0][1][7],&g_156[2][2][2],&g_156[0][5][3]},{&g_156[2][1][7],&g_156[2][1][7],&g_156[2][1][7]},{&g_156[2][7][2],&g_156[2][1][7],(void*)0},{(void*)0,&g_156[1][4][6],&g_156[2][7][2]},{&g_156[0][5][3],&g_156[2][1][7],&g_156[2][1][7]},{&g_156[0][1][7],&g_156[0][1][7],(void*)0},{&g_156[2][2][2],&g_156[2][1][7],&g_156[2][1][7]}},{{&g_156[0][2][7],&g_156[2][1][7],&g_156[2][1][6]},{&g_156[2][4][0],(void*)0,&g_156[0][5][3]},{&g_156[2][3][6],(void*)0,&g_156[2][1][7]},{&g_156[2][1][7],&g_156[2][1][7],(void*)0},{&g_156[2][2][2],&g_156[2][1][7],&g_156[2][7][2]},{&g_156[2][1][7],&g_156[2][3][6],&g_156[2][2][2]},{&g_156[2][1][7],&g_156[2][1][7],&g_156[3][2][3]},{&g_156[2][1][6],&g_156[2][3][6],&g_156[2][1][7]},{(void*)0,&g_156[0][3][0],&g_156[2][7][2]}}};
+ int i, j, k;
+ for (g_304.f3 = 18; (g_304.f3 != 4); g_304.f3 = safe_sub_func_uint32_t_u_u(g_304.f3, 1))
+ { /* block id: 918 */
+ int16_t l_1539 = 0x0075L;
+ int16_t ***l_1544 = (void*)0;
+ int16_t ***l_1545 = &g_1524;
+ l_1540++;
+ if (g_994.f7.f0)
+ goto lbl_1543;
+ (*l_1545) = &g_1525;
+ (*l_1225) = g_70.f6.f0;
+ }
+ for (l_1366 = 12; (l_1366 != (-7)); l_1366--)
+ { /* block id: 926 */
+ (*l_1225) ^= (l_1548 != (void*)0);
+ if (l_1497)
+ continue;
+ (*l_1501) &= (l_1504 &= (*l_1225));
+ (*g_124) = &g_285[0];
+ }
+ if (((*l_1501) = ((safe_div_func_int16_t_s_s(func_24((l_1551 , (safe_unary_minus_func_int32_t_s((l_1504 && (l_1504 != (func_24((safe_add_func_uint32_t_u_u(l_1497, (*l_1225))), (**g_112), (*g_664), g_994.f0.f2, (*g_664)) > 0xBCL)))))), l_1555[0], (***l_1496), l_1432, l_1556), (-9L))) != 255UL)))
+ { /* block id: 934 */
+ struct S2 ***l_1559[6][8][5] = {{{&l_1558,&l_1548,&l_1558,&l_1558,(void*)0},{&l_1558,&l_1548,&l_1558,&l_1558,&l_1548},{&l_1558,&l_1558,&l_1548,&l_1548,&l_1558},{(void*)0,&l_1548,&l_1548,&l_1558,&l_1548},{&l_1558,&l_1548,&l_1548,&l_1548,&l_1558},{&l_1558,&l_1558,(void*)0,&l_1558,&l_1548},{&l_1548,&l_1558,&l_1558,(void*)0,&l_1548},{(void*)0,&l_1548,(void*)0,&l_1548,(void*)0}},{{(void*)0,&l_1558,&l_1558,&l_1548,&l_1558},{&l_1548,(void*)0,(void*)0,&l_1558,&l_1558},{&l_1558,&l_1548,&l_1548,&l_1548,&l_1548},{&l_1558,&l_1548,&l_1558,&l_1558,&l_1558},{&l_1558,&l_1548,&l_1548,&l_1548,&l_1548},{&l_1548,&l_1548,&l_1548,&l_1558,&l_1548},{&l_1558,&l_1558,&l_1548,(void*)0,&l_1548},{&l_1558,&l_1558,(void*)0,&l_1548,&l_1558}},{{(void*)0,&l_1558,&l_1548,&l_1548,(void*)0},{&l_1548,&l_1558,&l_1558,&l_1558,&l_1548},{&l_1558,&l_1558,&l_1558,&l_1548,&l_1558},{&l_1558,&l_1558,&l_1548,&l_1558,(void*)0},{&l_1548,&l_1548,(void*)0,&l_1548,&l_1548},{&l_1548,&l_1558,&l_1548,&l_1558,&l_1558},{&l_1548,(void*)0,&l_1558,&l_1558,&l_1548},{&l_1548,&l_1558,&l_1558,&l_1548,&l_1558}},{{(void*)0,&l_1558,&l_1558,&l_1548,(void*)0},{&l_1548,&l_1558,&l_1548,&l_1558,(void*)0},{&l_1548,&l_1548,&l_1548,&l_1548,&l_1548},{(void*)0,&l_1558,(void*)0,&l_1558,&l_1548},{&l_1558,&l_1548,(void*)0,&l_1548,&l_1548},{&l_1558,(void*)0,&l_1558,&l_1548,&l_1548},{&l_1548,(void*)0,&l_1558,&l_1558,&l_1548},{&l_1558,&l_1558,&l_1548,&l_1548,&l_1548}},{{&l_1558,&l_1548,&l_1558,&l_1548,&l_1558},{&l_1558,(void*)0,&l_1558,&l_1558,&l_1558},{&l_1558,&l_1548,&l_1548,&l_1548,&l_1558},{(void*)0,&l_1548,&l_1548,&l_1558,&l_1558},{&l_1548,&l_1548,&l_1558,&l_1558,&l_1548},{&l_1558,&l_1548,&l_1548,&l_1548,&l_1558},{&l_1548,&l_1558,&l_1558,&l_1558,(void*)0},{&l_1558,(void*)0,&l_1558,&l_1548,&l_1548}},{{&l_1558,&l_1558,&l_1558,&l_1548,&l_1558},{(void*)0,(void*)0,&l_1548,&l_1558,&l_1548},{&l_1558,&l_1548,&l_1548,&l_1548,&l_1558},{(void*)0,&l_1558,&l_1558,&l_1558,(void*)0},{&l_1548,(void*)0,(void*)0,&l_1558,&l_1548},{&l_1548,&l_1548,&l_1558,&l_1548,(void*)0},{&l_1548,&l_1548,&l_1558,&l_1558,&l_1558},{&l_1558,&l_1548,&l_1548,&l_1548,&l_1558}}};
+ int i, j, k;
+ (*g_124) = l_1557;
+ if ((*l_1225))
+ break;
+ l_1548 = l_1558;
+ }
+ else
+ { /* block id: 938 */
+ uint16_t l_1560 = 1UL;
+ int32_t l_1572 = 0x359A7594L;
+ uint16_t *l_1575 = &g_994.f3;
+ l_1561[1][4] = (l_1560 < g_1439.f2.f2);
+ (*l_1501) &= ((&g_829[1] == ((safe_sub_func_int32_t_s_s((((l_1192 , 0UL) > (safe_mod_func_uint16_t_u_u((((*l_360) = (safe_add_func_int32_t_s_s(((g_1439.f3 = ((*l_1575) = ((((safe_rshift_func_int8_t_s_s(func_24((++(**l_1396)), func_30((l_1572 = (l_1400[1].f3 , g_987[0][0][0])), ((*l_1352) = l_1573)), (***l_1496), g_449, l_1573), l_1574)) || l_1572) > (-1L)) ^ 1L))) == l_1498.f2), (*l_1557)))) | l_1555[0].f1), g_70.f7.f1))) <= l_1498.f2), l_1560)) , &g_829[1])) == g_361.f1);
+ }
+ l_1577 = &l_1533[4][0][4];
+ }
+ }
+ else
+ { /* block id: 950 */
+ for (g_79 = (-14); (g_79 < 4); g_79 = safe_add_func_uint16_t_u_u(g_79, 8))
+ { /* block id: 953 */
+ for (g_489.f2 = 0; (g_489.f2 <= 0); g_489.f2 += 1)
+ { /* block id: 956 */
+ int i, j;
+ return g_54[(g_489.f2 + 1)][(g_489.f2 + 1)];
+ }
+ }
+ }
+ (*g_124) = (((l_1504 = (g_54[9][7] &= (safe_add_func_uint8_t_u_u(((((*l_1495) = (*l_1225)) != (*l_1225)) >= l_1504), ((((*l_1225) ^ (safe_rshift_func_int16_t_s_s((((**g_1524) && ((*l_1584) = ((*g_113) , ((*g_1525) = (*g_1525))))) ^ (safe_lshift_func_int8_t_s_s(((((*l_1597) = (safe_lshift_func_int16_t_s_u((safe_rshift_func_int8_t_s_u((safe_add_func_uint8_t_u_u((safe_rshift_func_uint16_t_u_u(l_1505, (safe_lshift_func_int8_t_s_u((((8UL > g_1439.f0.f1) <= (-1L)) == l_1353), 7)))), (-7L))), 4)), g_254[0]))) == l_1555[0].f2) < l_1505), l_1353))), l_1353))) , l_1498.f0) == (*l_1225)))))) <= l_1505) , (void*)0);
+ }
+ else
+ { /* block id: 968 */
+ int32_t *l_1599 = &g_1441;
+ int32_t *l_1600 = (void*)0;
+ int32_t l_1601 = 0xAE42B3BBL;
+ int32_t *l_1602 = &l_1446;
+ int32_t *l_1603 = &l_1454;
+ int32_t *l_1604 = &l_1449;
+ int32_t *l_1605[1][10] = {{&l_1449,&l_1447,(void*)0,&l_1447,(void*)0,&l_1449,&l_1449,&l_1449,&l_1447,&l_1447}};
+ uint32_t l_1606[4];
+ int i, j;
+ for (i = 0; i < 4; i++)
+ l_1606[i] = 0x8DE90388L;
+ ++l_1606[1];
+ for (l_1454 = 28; (l_1454 == (-8)); l_1454 = safe_sub_func_uint16_t_u_u(l_1454, 1))
+ { /* block id: 972 */
+ struct S0 ***l_1611 = &g_258;
+ int32_t l_1612 = 0x4D626EE6L;
+ (*l_1611) = &g_259;
+ l_1612 &= (*l_1225);
+ return (*l_1225);
+ }
+ }
+ if ((*l_1225))
+ { /* block id: 978 */
+ uint32_t l_1621 = 0x24DC288AL;
+ union U3 l_1645 = {0xB5L};
+ int32_t l_1655 = 0xD35CC852L;
+ int16_t ***l_1656 = &g_1524;
+ (*l_1225) &= 0xB443BAC4L;
+ for (l_1498.f0 = (-13); (l_1498.f0 < (-15)); l_1498.f0--)
+ { /* block id: 982 */
+ uint16_t l_1615 = 0x80FAL;
+ int32_t l_1650[9][3][8] = {{{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L},{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L},{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L}},{{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L},{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L},{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L}},{{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L},{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L},{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L}},{{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L},{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L},{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L}},{{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L},{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L},{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L}},{{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L},{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L},{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L}},{{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L},{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L},{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L}},{{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L},{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L},{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L}},{{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L},{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L},{0x9D1FDFD4L,0x9D1FDFD4L,5L,0x9102FFFDL,1L,1L,0x9102FFFDL,5L}}};
+ struct S0 l_1654[6][8] = {{{388,541,14},{-1172,584,11},{-1559,260,10},{1907,696,16},{388,541,14},{210,414,5},{-221,347,11},{394,258,18}},{{388,541,14},{-1191,582,1},{1907,696,16},{394,258,18},{394,258,18},{-221,347,11},{-1559,260,10},{-221,347,11}},{{-1559,260,10},{-1191,582,1},{-221,347,11},{-1191,582,1},{210,414,5},{-1191,582,1},{394,258,18},{-1559,260,10}},{{-1172,584,11},{-1172,584,11},{-221,347,11},{210,414,5},{388,541,14},{388,541,14},{-1559,260,10},{394,258,18}},{{-221,347,11},{-1962,219,9},{1907,696,16},{-1191,582,1},{1907,696,16},{-221,347,11},{1907,696,16},{-1559,260,10}},{{210,414,5},{388,541,14},{-1559,260,10},{-1172,584,11},{1907,696,16},{-1962,219,9},{-1962,219,9},{-221,347,11}}};
+ int i, j, k;
+ for (l_1574 = 0; (l_1574 <= 7); l_1574 += 1)
+ { /* block id: 985 */
+ uint32_t l_1616 = 0xFD122033L;
+ if (l_1615)
+ break;
+ l_1192 = ((l_1615 > ((*l_1495) = l_1616)) , l_1192);
+ }
+ for (l_1347.f0 = 0; (l_1347.f0 <= (-15)); l_1347.f0 = safe_sub_func_int32_t_s_s(l_1347.f0, 4))
+ { /* block id: 992 */
+ uint16_t l_1633 = 0xA3D7L;
+ const union U3 l_1646 = {0x27L};
+ uint32_t *l_1667 = &g_351;
+ (*l_1225) = (safe_mul_func_int8_t_s_s(l_1621, 255UL));
+ for (g_1371 = (-11); (g_1371 == 25); g_1371++)
+ { /* block id: 996 */
+ int32_t l_1632 = 0x9A959592L;
+ int32_t *l_1635 = &l_1446;
+ int32_t *l_1647 = (void*)0;
+ int32_t *l_1648 = &l_1447;
+ int16_t *l_1653 = &l_1369[8][0];
+ (*l_1635) |= ((*l_1225) &= ((safe_rshift_func_int16_t_s_u(((g_1634 = (((*l_1495) = (((*l_360) = ((func_30(l_1414, (*l_1350)) , (g_873[1].f3 == ((0x08L != ((&g_79 != &l_1467) == (safe_sub_func_uint32_t_u_u((safe_lshift_func_uint16_t_u_u(((safe_div_func_uint16_t_u_u(((l_1366 , l_1632) && l_1632), 0x707FL)) , g_524.f3), 10)), 0x0E96D649L)))) , 0xD5DCL))) <= 65527UL)) < l_1633)) , &g_489)) != (void*)0), 5)) , l_1633));
+ (*l_1648) ^= (safe_mod_func_uint8_t_u_u((safe_add_func_int16_t_s_s(((*l_1635) , func_24((safe_mul_func_int16_t_s_s((safe_add_func_int32_t_s_s((3L || l_1444), ((void*)0 == &g_829[1]))), (g_873[1].f0.f1 != (*l_1225)))), l_1644, (l_1645 = (*l_1350)), (*l_1225), l_1646)), (**g_1524))), 249UL));
+ (*l_1225) = ((*l_1648) = (((l_1649 = &g_1524) == (func_19((**g_1524), ((((l_1650[5][0][4] = l_1446) , 0xBA97B269L) || (safe_mod_func_int16_t_s_s(l_1646.f2, g_70.f8))) , (*g_664)), l_1655, l_1646.f3) , l_1656)) < 0xB04F3DDBL));
+ (*l_1225) &= (safe_div_func_int16_t_s_s(l_1645.f2, l_1655));
+ }
+ for (g_745 = 0; (g_745 <= 1); g_745 += 1)
+ { /* block id: 1013 */
+ int i;
+ l_1452[g_745] = l_1452[g_745];
+ l_1438 = (void*)0;
+ }
+ (*l_1225) ^= (l_1366 = ((l_1645.f2 , g_1120[2]) > ((*l_1667) = g_994.f2.f2)));
+ }
+ }
+ }
+ else
+ { /* block id: 1022 */
+ struct S2 **l_1670[4][9] = {{&l_1438,&l_1438,&g_1269,&g_1269,(void*)0,&g_1269,&l_1438,&l_1438,(void*)0},{&g_1269,(void*)0,(void*)0,&g_1269,&g_1269,&g_1269,&l_1438,&l_1438,&l_1438},{(void*)0,&l_1438,&l_1438,(void*)0,&g_1269,(void*)0,&l_1438,(void*)0,&l_1438},{&g_1269,&g_1269,&g_1269,&l_1438,(void*)0,&l_1438,&g_1269,&l_1438,&l_1438}};
+ int32_t l_1687 = 0xC0D3F221L;
+ int32_t *l_1688 = &l_1451;
+ union U3 l_1689 = {6L};
+ union U3 *l_1696[8][9][1] = {{{&l_1689},{&l_1689},{&g_304},{&l_1400[1]},{&l_1689},{&l_1689},{&l_1276},{&l_1689},{&l_1689}},{{&l_1347},{&l_1689},{&l_1400[1]},{&g_304},{&l_1400[1]},{&l_1276},{&l_1689},{&l_1276},{&l_1347}},{{&g_304},{&l_1347},{&g_304},{&l_1689},{&g_304},{&l_1689},{&l_1689},{&l_1689},{&l_1689}},{{&l_1400[1]},{&l_1689},{&l_1400[1]},{&l_1276},{&l_1400[1]},{&l_1689},{&l_1347},{&l_1276},{&l_1400[1]}},{{&g_304},{&l_1347},{&l_1276},{&l_1689},{&g_304},{&l_1347},{&l_1689},{&l_1347},{&g_304}},{{&l_1400[1]},{&g_304},{&l_1689},{&l_1276},{&l_1689},{&l_1689},{&l_1347},{&l_1689},{&l_1400[1]}},{{&g_304},{&l_1400[1]},{&l_1276},{&l_1347},{&l_1276},{&l_1347},{&g_304},{&l_1347},{&g_304}},{{&l_1689},{&g_304},{&l_1689},{&l_1689},{&l_1689},{&l_1689},{&l_1400[1]},{&l_1689},{&l_1689}}};
+ union U3 *l_1697[6][7] = {{&l_1400[1],&l_754[3],&l_1347,&l_1689,&l_1347,&l_1347,(void*)0},{(void*)0,&l_1400[1],(void*)0,&l_1400[1],&l_754[0],&l_1347,&g_304},{&l_1347,&g_304,(void*)0,(void*)0,&l_754[3],&g_489,&l_1347},{&l_1400[1],&l_1400[1],&l_754[0],&l_1347,&l_754[0],&l_1400[1],&l_1400[1]},{&l_754[0],&l_1347,&g_304,&l_1347,&l_1347,(void*)0,&g_304},{&g_489,&g_304,(void*)0,&l_1347,(void*)0,&l_754[0],&l_1400[1]}};
+ union U3 *l_1698[2];
+ union U3 *l_1699 = &l_754[3];
+ uint8_t l_1700 = 0xD5L;
+ struct S1 *l_1711 = &g_1672.f6;
+ uint8_t * const *l_1715 = (void*)0;
+ uint32_t l_1730 = 0xEB5B1C50L;
+ int32_t l_1736 = 9L;
+ int32_t *l_1737 = &g_8;
+ int32_t *l_1738 = &l_1447;
+ int32_t *l_1739 = (void*)0;
+ int32_t *l_1740 = &l_1366;
+ int32_t *l_1741 = &l_1444;
+ int32_t *l_1742[7];
+ int i, j, k;
+ for (i = 0; i < 2; i++)
+ l_1698[i] = &l_1400[0];
+ for (i = 0; i < 7; i++)
+ l_1742[i] = &l_1687;
+ (*l_1225) = (safe_sub_func_int16_t_s_s((((l_1671 = &g_994) == (void*)0) , (safe_div_func_uint16_t_u_u((0xB6A98EE7L & func_24((safe_rshift_func_int16_t_s_u((((*l_1688) = ((-1L) <= ((*l_1225) = ((safe_add_func_int32_t_s_s((0L > ((*l_1225) | (!((*l_360) = (safe_div_func_int32_t_s_s((safe_mod_func_uint32_t_u_u((safe_mul_func_uint16_t_u_u((safe_lshift_func_int16_t_s_s((((((*l_1225) != (*l_1225)) > g_235) , l_1671) == (void*)0), 2)), (*g_1525))), 0xECDF187DL)), l_1687)))))), l_1687)) , (*l_1225))))) | 1L), g_1439.f6.f0)), (**g_112), l_1689, g_1439.f0.f0, l_1689)), g_1120[2]))), 1UL));
+ if (((*l_1688) = ((((safe_add_func_uint16_t_u_u((safe_sub_func_int32_t_s_s(7L, (((((*l_1225) = (g_1672.f0.f0 != l_1432)) , &g_873[1]) != &g_873[1]) & (*l_1688)))), g_873[1].f4)) | l_1446) == g_217[1]) > l_1700)))
+ { /* block id: 1031 */
+ int8_t *l_1705[4];
+ uint8_t * const * const l_1714[6][7] = {{(void*)0,&g_904,&g_904,(void*)0,(void*)0,&g_904,&g_904},{&l_1494,&g_904,&l_1494,&g_904,&l_1494,&g_904,&l_1494},{(void*)0,(void*)0,&g_904,&g_904,(void*)0,(void*)0,&g_904},{&l_1494,&g_904,&l_1494,&g_904,&l_1494,&g_904,&l_1494},{(void*)0,&g_904,&g_904,(void*)0,(void*)0,&g_904,&g_904},{&l_1494,&g_904,&l_1494,&g_904,&l_1494,&g_904,&l_1494}};
+ int32_t l_1731 = 0x43CC042CL;
+ int i, j;
+ for (i = 0; i < 4; i++)
+ l_1705[i] = &g_921;
+ if (g_255)
+ { /* block id: 1032 */
+ (*g_124) = &l_1687;
+ }
+ else
+ { /* block id: 1034 */
+ uint32_t *l_1701 = (void*)0;
+ uint32_t *l_1702 = &g_829[0];
+ uint32_t **l_1706 = &l_1397;
+ const int32_t ***l_1720 = (void*)0;
+ const int32_t ***l_1721 = &l_1718[5];
+ int32_t l_1732 = 0x93DFC5F6L;
+ (*l_1225) &= (*l_1688);
+ if ((((*l_1702)--) == ((void*)0 != l_1705[3])))
+ { /* block id: 1037 */
+ uint32_t ***l_1707 = &l_1396;
+ int32_t l_1710[10][6] = {{6L,0x3B16ECF0L,0L,(-8L),0x3B16ECF0L,0x3B16ECF0L},{0x3B16ECF0L,8L,8L,0x0A6BF73EL,0L,0x3B16ECF0L},{0x0F36165FL,(-8L),0L,0L,8L,0L},{0x0F36165FL,6L,0x0F36165FL,0x0A6BF73EL,0x3B16ECF0L,(-8L)},{0x3B16ECF0L,6L,0x0A6BF73EL,8L,8L,0x0F36165FL},{(-8L),(-8L),0x0A6BF73EL,(-8L),6L,(-8L)},{0x0F36165FL,0x0A6BF73EL,0x0F36165FL,(-8L),0L,0L},{(-8L),0L,6L,8L,0L,0L},{0L,0x0A6BF73EL,0x0A6BF73EL,0x0F36165FL,6L,0L},{0x3B16ECF0L,(-8L),6L,6L,0x0A6BF73EL,6L}};
+ int i, j;
+ (*l_1707) = l_1706;
+ (*l_1688) = (safe_add_func_uint8_t_u_u((*l_1688), l_1710[5][3]));
+ return l_1400[1].f2;
+ }
+ else
+ { /* block id: 1041 */
+ struct S1 **l_1712[8] = {&g_156[2][1][7],&g_156[2][1][7],&g_156[2][1][7],&g_156[2][1][7],&g_156[2][1][7],&g_156[2][1][7],&g_156[2][1][7],&g_156[2][1][7]};
+ int i;
+ l_1713[0] = l_1711;
+ l_1715 = l_1714[4][4];
+ }
+ (*l_1225) &= ((l_1445 & (safe_sub_func_uint32_t_u_u(g_829[0], (*l_1688)))) ^ ((&l_1688 != ((*l_1721) = l_1718[5])) ^ ((safe_mul_func_int16_t_s_s((safe_lshift_func_uint16_t_u_s(g_994.f0.f1, 2)), ((safe_rshift_func_int8_t_s_u(((l_1732 = (safe_mul_func_int8_t_s_s(0x77L, (((*l_1719) | l_1731) , (*l_1688))))) > (*l_1688)), (*l_1688))) & 0xEAL))) & 0UL)));
+ for (g_1191 = 0; (g_1191 > 17); g_1191 = safe_add_func_int32_t_s_s(g_1191, 6))
+ { /* block id: 1050 */
+ uint16_t l_1735 = 65535UL;
+ if (l_1735)
+ break;
+ }
+ }
+ }
+ else
+ { /* block id: 1054 */
+ return g_1439.f6.f1;
+ }
+ ++l_1743;
+ }
+ }
+ (*l_1225) = (*l_1719);
+ return g_1672.f6.f1;
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_60.f2 g_285 g_70.f3 g_141 g_217 g_60.f0 g_252 g_70.f2.f0 g_304.f2 g_351 g_70.f6.f1 g_524.f2 g_79 g_304.f3 g_8 g_113 g_70.f7 g_449 g_124 g_489.f2 g_664 g_489 g_489.f3 g_67 g_70.f0.f0 g_361.f1 g_489.f0 g_873.f2.f2 g_739 g_70.f0.f2 g_903 g_258 g_259 g_70.f2 g_235 g_873.f6.f0 g_70.f6.f0 g_921 g_281 g_873.f8 g_873.f4 g_54 g_70 g_112 g_873.f0.f0 g_873.f2.f1 g_125 g_973 g_987 g_829 g_994.f4 g_994.f2.f2 g_994.f8 g_254 g_873.f5 g_747 g_873.f7.f0 g_994.f0.f2 g_397 g_60.f1 g_994.f2.f0 g_745 g_255
+ * writes: g_285 g_252 g_141 g_70.f3 g_351 g_70.f2.f0 g_125 g_489.f2 g_489.f3 g_361.f1 g_254 g_235 g_67 g_79 g_113 g_962 g_489 g_397 g_994.f2.f0 g_217 g_70.f6
+ */
+static uint16_t func_2(int32_t p_3, uint8_t p_4, int16_t p_5, union U3 p_6, const uint32_t p_7)
+{ /* block id: 483 */
+ uint32_t l_755 = 0UL;
+ struct S2 l_758 = {{-918,375,16},0xEEC353FBL,{-1257,392,8},2UL,6UL,0x5AFAA565L,{7UL,310},{738,206,0},1UL};
+ union U3 l_761[3] = {{-1L},{-1L},{-1L}};
+ uint32_t l_762 = 4294967286UL;
+ uint8_t *l_763 = &g_397[6][7];
+ int32_t *l_764 = (void*)0;
+ int32_t *l_765 = &g_285[0];
+ int32_t l_770 = (-10L);
+ struct S2 *l_772 = (void*)0;
+ struct S2 **l_771[1][4];
+ int32_t l_799 = 0x7D10B75FL;
+ int32_t l_800 = (-6L);
+ int32_t l_801[9] = {9L,9L,(-9L),0x1EECED55L,(-9L),9L,(-9L),9L,0x1EECED55L};
+ uint8_t l_809 = 0x7BL;
+ struct S0 **l_814 = &g_259;
+ int16_t *l_850 = &g_254[9];
+ uint8_t l_865[6][10] = {{9UL,4UL,0UL,0x85L,1UL,0xFDL,0x85L,0x85L,1UL,9UL},{0x85L,9UL,9UL,1UL,1UL,0x85L,0x85L,0UL,0x85L,4UL},{9UL,1UL,0x85L,9UL,9UL,1UL,0UL,0x85L,0x85L,0xFDL},{9UL,0x85L,4UL,4UL,1UL,4UL,1UL,4UL,0xFDL,1UL},{1UL,1UL,4UL,0xFDL,1UL,1UL,9UL,1UL,0x85L,0UL},{0UL,9UL,0UL,1UL,0UL,4UL,9UL,9UL,0x85L,9UL}};
+ uint32_t l_899 = 0xBDBB613DL;
+ int32_t l_908 = 0x1E925F72L;
+ uint8_t l_930 = 255UL;
+ struct S0 ****l_975 = (void*)0;
+ const union U3 l_1048 = {0x9EL};
+ int i, j;
+ for (i = 0; i < 1; i++)
+ {
+ for (j = 0; j < 4; j++)
+ l_771[i][j] = &l_772;
+ }
+ l_755--;
+ (*l_765) &= (l_758 , (((~g_60.f2) , &g_739[5]) != &g_254[6]));
+ (*l_765) = func_24((safe_mod_func_uint8_t_u_u(g_70.f3, (safe_rshift_func_uint8_t_u_u(((((p_6.f2 > ((p_6.f0 ^ (*l_765)) ^ p_6.f3)) , l_758) , p_6.f3) ^ ((l_758.f6 , ((l_770 , l_771[0][3]) == (void*)0)) <= p_6.f0)), 7)))), l_758.f0, l_761[1], g_70.f3, l_761[1]);
+ if ((*l_765))
+ { /* block id: 489 */
+ int16_t l_781 = 0x1E28L;
+ uint8_t **l_783 = (void*)0;
+ uint8_t ***l_782 = &l_783;
+ int32_t l_794 = (-1L);
+ int32_t l_796[1];
+ struct S1 *l_807 = &l_758.f6;
+ int32_t *l_808[7][5] = {{(void*)0,&g_8,&l_799,&l_799,&l_796[0]},{(void*)0,(void*)0,&l_799,&g_285[0],(void*)0},{&g_8,&l_794,(void*)0,&l_799,(void*)0},{(void*)0,&l_794,&l_796[0],&g_8,&g_8},{(void*)0,&g_285[0],(void*)0,&l_799,(void*)0},{&l_794,(void*)0,&l_794,(void*)0,(void*)0},{&g_285[0],&g_285[0],(void*)0,(void*)0,&l_794}};
+ int i, j;
+ for (i = 0; i < 1; i++)
+ l_796[i] = 2L;
+ p_6.f1 = p_3;
+ if ((safe_mod_func_int16_t_s_s((g_70.f6.f1 | (safe_rshift_func_int8_t_s_u((safe_add_func_int8_t_s_s((safe_rshift_func_int16_t_s_s(((*l_765) = l_781), 15)), ((((((*l_782) = (void*)0) != (void*)0) , (safe_unary_minus_func_int16_t_s(g_524.f2))) && ((l_781 && (((((p_7 <= p_6.f1) < (safe_sub_func_uint32_t_u_u((safe_div_func_int32_t_s_s((safe_add_func_int8_t_s_s(((0L > g_79) < 1UL), l_781)), g_524.f2)), 0xD5B1C253L))) > 0xE7AFE5B4L) & 0xB3L) & p_6.f1)) <= 0x4BA776FBL)) , p_6.f1))), g_304.f3))), p_3)))
+ { /* block id: 493 */
+ return g_8;
+ }
+ else
+ { /* block id: 495 */
+ int8_t l_797[1];
+ int32_t l_798[9];
+ uint32_t l_802 = 4294967295UL;
+ struct S1 *l_805 = (void*)0;
+ int i;
+ for (i = 0; i < 1; i++)
+ l_797[i] = (-1L);
+ for (i = 0; i < 9; i++)
+ l_798[i] = 0L;
+ for (g_351 = 10; (g_351 < 10); ++g_351)
+ { /* block id: 498 */
+ int32_t *l_793 = &g_285[0];
+ int32_t *l_795[2];
+ struct S1 **l_806[4][10] = {{&g_156[2][2][2],&g_156[2][5][4],&g_156[3][4][1],&g_156[2][1][7],&g_156[2][5][4],&g_156[2][1][7],&g_156[3][1][3],&g_156[2][2][2],&g_156[3][4][1],&g_156[3][1][3]},{&g_156[3][1][3],&g_156[2][2][2],&g_156[2][1][7],&g_156[2][2][2],&g_156[2][2][2],&g_156[2][2][2],&g_156[2][5][4],&g_156[3][4][1],&g_156[2][1][7],&g_156[2][1][7]},{&g_156[2][1][7],&g_156[3][1][3],&g_156[2][5][4],&g_156[3][4][1],&g_156[3][1][3],&g_156[3][4][1],&g_156[2][2][2],&g_156[2][1][7],&g_156[2][5][4],&g_156[2][2][2]},{&g_156[2][2][2],&g_156[2][1][7],&g_156[3][4][1],&g_156[2][1][7],&g_156[2][1][7],&g_156[2][1][7],&g_156[3][1][3],&g_156[2][5][4],&g_156[3][4][1],&g_156[3][4][1]}};
+ int i, j;
+ for (i = 0; i < 2; i++)
+ l_795[i] = (void*)0;
+ --l_802;
+ l_807 = l_805;
+ }
+ }
+ ++l_809;
+ }
+ else
+ { /* block id: 504 */
+ uint32_t l_812 = 4UL;
+ struct S0 ***l_823 = &g_258;
+ union U3 l_828 = {-8L};
+ struct S1 ***l_833[8][7] = {{(void*)0,&g_538[0],&g_538[0],&g_538[0],&g_538[0],&g_538[0],&g_538[0]},{&g_538[0],&g_538[0],&g_538[0],&g_538[0],&g_538[0],(void*)0,&g_538[0]},{&g_538[0],&g_538[0],&g_538[0],&g_538[0],(void*)0,&g_538[0],&g_538[0]},{&g_538[0],&g_538[0],&g_538[0],&g_538[0],&g_538[0],(void*)0,&g_538[0]},{(void*)0,(void*)0,&g_538[0],&g_538[0],&g_538[0],&g_538[0],&g_538[0]},{&g_538[0],&g_538[0],(void*)0,&g_538[0],&g_538[0],&g_538[0],&g_538[0]},{&g_538[0],&g_538[0],&g_538[0],&g_538[0],&g_538[0],&g_538[0],&g_538[0]},{&g_538[0],(void*)0,(void*)0,(void*)0,&g_538[0],&g_538[0],&g_538[0]}};
+ int32_t l_857 = 0xBD36499BL;
+ int32_t l_895 = 0x949E899AL;
+ int32_t l_896 = 0xA891575AL;
+ int32_t l_897[3];
+ int32_t *l_929[8][2] = {{(void*)0,(void*)0},{(void*)0,(void*)0},{(void*)0,(void*)0},{(void*)0,&l_801[0]},{&l_801[0],&l_801[0]},{(void*)0,(void*)0},{(void*)0,(void*)0},{(void*)0,(void*)0}};
+ struct S2 *l_992 = &l_758;
+ uint8_t **l_1011 = &g_904;
+ struct S2 ***l_1061 = &l_771[0][3];
+ uint8_t l_1101 = 0UL;
+ int i, j;
+ for (i = 0; i < 3; i++)
+ l_897[i] = 0x4C16D487L;
+ if (l_812)
+ { /* block id: 505 */
+ int32_t l_813 = 1L;
+ struct S0 ***l_821[5][5] = {{&l_814,&l_814,(void*)0,&g_258,(void*)0},{&l_814,&g_258,&g_258,&g_258,&l_814},{(void*)0,&l_814,&l_814,&l_814,(void*)0},{&g_258,&l_814,&l_814,&l_814,&l_814},{&l_814,&g_258,(void*)0,&g_258,(void*)0}};
+ struct S0 ****l_822 = &l_821[3][2];
+ uint16_t *l_824[6][10][4] = {{{&g_235,(void*)0,&g_70.f3,&g_255},{&g_235,&g_70.f3,&g_255,(void*)0},{&g_255,&l_758.f3,(void*)0,&g_70.f3},{(void*)0,&g_79,(void*)0,&g_79},{&g_255,&g_235,&g_255,(void*)0},{&g_235,&g_79,&g_255,&g_235},{&g_235,&l_758.f3,(void*)0,&g_621[0][1][1]},{&g_255,&g_621[0][1][1],&g_621[0][1][1],&g_255},{&g_235,(void*)0,&g_621[0][1][1],(void*)0},{&g_235,(void*)0,&g_255,&g_235}},{{&l_758.f3,(void*)0,&g_235,&g_235},{&g_235,(void*)0,&g_79,&l_758.f3},{&g_235,&g_70.f3,&g_255,(void*)0},{&g_70.f3,&g_255,&g_70.f3,&g_235},{&g_255,&l_758.f3,&g_255,&l_758.f3},{&g_621[0][1][1],(void*)0,&g_255,&g_235},{&g_79,(void*)0,&g_235,&g_255},{&g_255,&g_235,&g_621[0][1][1],&g_621[0][1][1]},{&l_758.f3,&l_758.f3,&l_758.f3,&g_235},{&g_70.f3,&g_79,&l_758.f3,&l_758.f3}},{{(void*)0,&g_79,&g_255,(void*)0},{&g_621[0][1][1],&g_255,&g_235,&l_758.f3},{&g_621[0][1][1],&g_255,(void*)0,&g_621[0][1][1]},{(void*)0,&l_758.f3,&g_255,&l_758.f3},{&g_621[0][1][1],&g_235,&l_758.f3,&g_621[0][1][1]},{(void*)0,(void*)0,&g_621[0][1][1],&l_758.f3},{&g_79,&g_255,&l_758.f3,(void*)0},{&g_255,&g_255,&g_79,&g_255},{(void*)0,&g_621[0][1][1],&g_235,&g_621[0][1][1]},{&g_235,&g_255,&g_255,&g_235}},{{&g_79,&l_758.f3,&g_235,&g_70.f3},{&g_621[0][1][1],&g_621[1][1][1],(void*)0,(void*)0},{&g_621[1][1][1],&g_235,(void*)0,&g_621[0][1][1]},{&g_621[0][1][1],(void*)0,&l_758.f3,&g_621[0][1][1]},{&g_79,&g_621[0][1][1],&g_255,&g_235},{&g_255,(void*)0,(void*)0,&g_621[1][1][1]},{&g_621[0][1][1],&g_255,&g_255,(void*)0},{&g_235,&l_758.f3,&g_70.f3,&g_70.f3},{&g_235,&g_70.f3,(void*)0,&l_758.f3},{(void*)0,(void*)0,&g_255,&g_70.f3}},{{&l_758.f3,(void*)0,(void*)0,&g_255},{&g_255,&g_255,(void*)0,&g_255},{&g_79,&g_621[0][1][1],&g_79,&g_255},{&g_235,(void*)0,&g_235,(void*)0},{&g_621[0][1][1],&l_758.f3,(void*)0,(void*)0},{&g_255,&g_235,(void*)0,&l_758.f3},{&g_255,(void*)0,(void*)0,&g_255},{&g_255,(void*)0,&g_621[0][1][1],(void*)0},{(void*)0,(void*)0,&g_255,(void*)0},{&g_70.f3,&l_758.f3,&g_70.f3,&g_235}},{{&g_79,&g_621[1][1][1],&g_235,(void*)0},{(void*)0,(void*)0,&g_70.f3,&g_255},{&g_235,(void*)0,&g_621[0][1][1],&l_758.f3},{&g_621[0][1][1],&g_235,(void*)0,(void*)0},{&g_255,&g_235,&g_235,(void*)0},{(void*)0,(void*)0,&g_621[0][1][1],&g_255},{&g_235,&g_255,&g_621[0][1][1],&g_255},{&g_235,&g_621[0][1][1],(void*)0,&g_235},{&l_758.f3,(void*)0,&g_70.f3,&g_255},{&g_235,(void*)0,(void*)0,&l_758.f3}}};
+ int32_t l_825 = (-3L);
+ union U3 *l_830[9][10] = {{&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0]},{&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0]},{&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0]},{&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0]},{&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0]},{&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0]},{&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0]},{&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0]},{&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0],&l_761[0]}};
+ struct S1 l_846[3] = {{8UL,274},{8UL,274},{8UL,274}};
+ const struct S2 *l_875 = &g_873[1];
+ const struct S2 **l_874 = &l_875;
+ int32_t l_889 = 7L;
+ int32_t l_891 = 0xD6DC0909L;
+ int32_t l_893 = 0x73944F16L;
+ int32_t l_898 = 0xDC9222DBL;
+ uint8_t **l_905 = &l_763;
+ int i, j, k;
+ if ((func_24(l_813, (*g_113), (p_6 = p_6), g_449, l_761[0]) , p_7))
+ { /* block id: 510 */
+lbl_937:
+ (*g_124) = &l_825;
+ }
+ else
+ { /* block id: 512 */
+ struct S0 l_841 = {907,644,18};
+ int32_t l_890 = 0xB398AC28L;
+ int32_t l_894[4][10] = {{(-10L),(-10L),0xC401171EL,(-1L),(-2L),(-2L),0x249327B8L,(-2L),1L,0x1A769766L},{0x1A769766L,0x249327B8L,0x1A769766L,(-2L),0x1A769766L,0xC401171EL,0x249327B8L,0x249327B8L,1L,0x249327B8L},{1L,0xC401171EL,0xC401171EL,(-2L),0xC401171EL,(-10L),0xC401171EL,(-1L),(-2L),(-2L)},{(-2L),0x1A769766L,(-10L),0x249327B8L,0x249327B8L,0xC401171EL,0x249327B8L,(-1L),0x249327B8L,(-2L)}};
+ union U3 l_913 = {0x54L};
+ struct S1 l_922[6] = {{0xAFL,120},{0xAFL,120},{0xAFL,120},{0xAFL,120},{0xAFL,120},{0xAFL,120}};
+ int i, j;
+ for (g_489.f2 = (-26); (g_489.f2 <= 10); g_489.f2 = safe_add_func_uint16_t_u_u(g_489.f2, 4))
+ { /* block id: 515 */
+ struct S1 ****l_834 = &l_833[2][1];
+ int32_t l_842 = 4L;
+ int32_t *l_843 = &l_801[0];
+ (*l_843) |= func_24((((*l_834) = l_833[7][5]) == (void*)0), (*g_113), p_6, ((safe_mul_func_int16_t_s_s((safe_mul_func_int16_t_s_s((safe_mod_func_uint32_t_u_u(((func_24(p_4, l_841, p_6, p_4, (*g_664)) , 1UL) & 8UL), 6L)), 0UL)), p_5)) , l_842), p_6);
+ (*l_843) = (p_6.f2 | 0x93078A12L);
+ if (l_828.f2)
+ continue;
+ }
+ if ((&g_70 != (void*)0))
+ { /* block id: 521 */
+ int32_t *l_860 = (void*)0;
+ for (l_828.f3 = (-28); (l_828.f3 >= 25); l_828.f3 = safe_add_func_int32_t_s_s(l_828.f3, 8))
+ { /* block id: 524 */
+ int16_t **l_847 = (void*)0;
+ int16_t *l_849[6][4][6] = {{{&g_252,&g_254[9],&g_254[9],&g_739[3],&g_252,&g_254[6]},{&g_252,&g_252,&g_252,&g_252,(void*)0,&g_54[7][8]},{&g_54[7][8],&g_54[7][8],(void*)0,&g_252,&g_54[7][8],&g_54[7][8]},{&g_252,(void*)0,&g_739[3],&g_54[7][8],&g_252,&g_252}},{{(void*)0,&g_54[7][8],&g_252,&g_252,&g_254[6],&g_254[9]},{&g_254[9],&g_252,&g_254[6],(void*)0,&g_254[9],&g_252},{&g_54[7][8],&g_254[6],&g_54[7][8],&g_254[9],&g_252,(void*)0},{&g_254[6],&g_254[9],&g_54[7][8],&g_54[7][8],&g_252,&g_739[3]}},{{&g_739[3],&g_252,&g_252,&g_254[6],&g_739[3],&g_252},{&g_252,&g_252,&g_254[9],&g_739[3],&g_54[7][8],&g_254[6]},{&g_252,&g_739[3],&g_252,&g_252,(void*)0,&g_54[7][8]},{&g_54[7][8],&g_54[7][8],(void*)0,&g_252,&g_54[7][8],&g_54[7][8]}},{{&g_252,(void*)0,&g_739[3],&g_54[7][8],&g_252,&g_252},{&g_252,&g_54[7][8],&g_252,&g_739[3],&g_254[6],&g_254[9]},{&g_252,&g_252,&g_254[6],&g_252,&g_254[9],&g_252},{&g_54[7][8],&g_254[6],&g_54[7][8],&g_252,&g_252,(void*)0}},{{&g_252,&g_254[9],&g_54[7][8],&g_54[7][8],&g_252,&g_739[3]},{(void*)0,&g_252,&g_252,&g_252,&g_739[3],&g_252},{&g_254[9],&g_252,&g_254[9],(void*)0,&g_54[7][8],&g_254[6]},{&g_54[7][8],&g_739[3],&g_252,&g_254[9],(void*)0,&g_54[7][8]}},{{&g_254[6],&g_54[7][8],(void*)0,&g_54[7][8],&g_54[7][8],&g_54[7][8]},{&g_739[3],(void*)0,&g_739[3],&g_254[6],&g_252,&g_252},{&g_252,&g_54[7][8],&g_252,&g_739[3],&g_254[6],&g_254[9]},{&g_252,&g_252,&g_254[6],&g_252,&g_254[9],&g_252}}};
+ int16_t **l_848 = &l_849[3][3][4];
+ int i, j, k;
+ }
+ for (g_489.f3 = 0; (g_489.f3 >= (-14)); --g_489.f3)
+ { /* block id: 531 */
+ (*g_124) = l_860;
+ }
+ }
+ else
+ { /* block id: 534 */
+ int32_t *l_861 = &l_801[5];
+ int32_t *l_862 = &l_799;
+ int32_t *l_863[8][3][2] = {{{&l_801[7],&l_825},{&l_801[0],&l_801[0]},{&l_801[7],&l_801[0]}},{{&l_801[0],&l_825},{&l_801[7],&l_825},{&l_801[0],&l_801[0]}},{{&l_801[7],&l_801[0]},{&l_801[0],&l_825},{&l_801[7],&l_825}},{{&l_801[0],&l_801[0]},{&l_801[7],&l_801[0]},{&l_801[0],&l_825}},{{&l_801[7],&l_825},{&l_801[0],&l_801[0]},{&l_801[7],&l_801[0]}},{{&l_801[0],&l_825},{&l_801[7],&l_825},{&l_801[0],&l_801[0]}},{{&l_801[7],&l_801[0]},{&l_801[0],&l_825},{&l_801[7],&l_825}},{{&l_801[0],&l_801[0]},{&l_801[7],&l_801[0]},{&l_801[0],&l_825}}};
+ const struct S2 *l_872 = &g_873[1];
+ const struct S2 **l_871[8] = {&l_872,&l_872,&l_872,&l_872,&l_872,&l_872,&l_872,&l_872};
+ const struct S2 ***l_870 = &l_871[6];
+ const struct S2 ***l_876 = &l_874;
+ uint32_t *l_879[10] = {&g_829[1],&g_829[1],&g_829[1],&g_829[1],(void*)0,&g_829[1],&g_829[1],&g_829[1],(void*)0,&g_829[1]};
+ int i, j, k;
+ l_861 = &l_813;
+ l_865[1][4]--;
+ (*l_862) |= ((((((*l_870) = ((safe_mod_func_uint16_t_u_u(p_6.f2, 2UL)) , (void*)0)) != ((*l_876) = l_874)) && ((((g_361.f1 &= (safe_mod_func_int8_t_s_s((((l_813 |= l_828.f3) > p_6.f2) != g_67), g_70.f0.f0))) , (safe_sub_func_int32_t_s_s(((*l_765) = ((safe_mul_func_uint16_t_u_u((safe_sub_func_int8_t_s_s((g_489.f0 <= g_873[1].f2.f2), p_5)), g_739[5])) | g_8)), 4294967295UL))) & p_6.f3) , p_7)) > g_70.f0.f2) == g_739[4]);
+ }
+ for (l_758.f3 = 0; (l_758.f3 <= 0); l_758.f3 += 1)
+ { /* block id: 546 */
+ uint32_t l_886 = 0xFF8F26A0L;
+ int32_t *l_887 = (void*)0;
+ int32_t *l_888[4] = {&l_800,&l_800,&l_800,&l_800};
+ int32_t l_892 = 0x5B16BAD7L;
+ union U3 l_902 = {0xEAL};
+ int8_t *l_914 = &l_828.f0;
+ int i;
+ l_758.f2.f0 |= ((*l_765) = l_886);
+ ++l_899;
+ for (l_809 = 0; (l_809 <= 0); l_809 += 1)
+ { /* block id: 552 */
+ l_846[1] = func_19(l_825, (l_846[2].f0 , l_902), (g_903 != l_905), (((***l_823) , func_24(l_896, (***l_823), p_6, l_891, p_6)) <= 0UL));
+ if (l_908)
+ continue;
+ }
+ l_922[4] = func_19((safe_sub_func_uint32_t_u_u((safe_sub_func_uint8_t_u_u(l_891, func_24((((l_913 , (((*l_914) = (0x68L != p_6.f2)) && p_6.f2)) , 0xA0L) == ((g_235--) && (safe_add_func_int16_t_s_s((g_873[1].f6.f0 | (safe_div_func_uint32_t_u_u(4294967295UL, l_895))), p_4)))), (**g_258), (*g_664), g_70.f6.f0, l_913))), 1UL)), p_6, p_4, g_921);
+ for (g_70.f3 = 0; (g_70.f3 <= 0); g_70.f3 += 1)
+ { /* block id: 561 */
+ uint16_t l_923 = 0x3B19L;
+ int32_t * const l_926 = &l_801[0];
+ int32_t **l_927 = (void*)0;
+ int32_t **l_928 = &l_888[0];
+ (*l_765) ^= l_812;
+ ++l_923;
+ (*l_928) = l_926;
+ }
+ }
+ l_929[0][1] = ((*g_124) = &l_894[0][8]);
+ }
+ l_930++;
+ for (p_4 = 6; (p_4 >= 14); p_4 = safe_add_func_int8_t_s_s(p_4, 1))
+ { /* block id: 573 */
+ struct S1 l_940[5][2][4] = {{{{0x96L,209},{0x49L,359},{0x96L,209},{0x49L,359}},{{0x96L,209},{0x49L,359},{0x96L,209},{0x49L,359}}},{{{0x96L,209},{0x49L,359},{0x96L,209},{0x49L,359}},{{0x96L,209},{0x49L,359},{0x96L,209},{0x49L,359}}},{{{0x96L,209},{0x49L,359},{0x96L,209},{0x49L,359}},{{0x96L,209},{0x49L,359},{0x96L,209},{0x49L,359}}},{{{0x96L,209},{0x49L,359},{0x96L,209},{0x49L,359}},{{0x96L,209},{0x49L,359},{0x96L,209},{0x49L,359}}},{{{0x96L,209},{0x49L,359},{0x96L,209},{0x49L,359}},{{0x96L,209},{0x49L,359},{0x96L,209},{0x49L,359}}}};
+ int i, j, k;
+ for (l_799 = 0; (l_799 <= (-15)); l_799 = safe_sub_func_uint32_t_u_u(l_799, 5))
+ { /* block id: 576 */
+ if (g_70.f0.f0)
+ goto lbl_937;
+ for (g_351 = 17; (g_351 >= 55); g_351 = safe_add_func_int8_t_s_s(g_351, 8))
+ { /* block id: 580 */
+ struct S1 l_941 = {0xAAL,212};
+ int32_t l_948 = (-1L);
+ l_941 = l_940[4][1][2];
+ (*l_765) = (+(l_948 |= (((l_825 == (safe_rshift_func_uint16_t_u_u(p_6.f2, 12))) , 0xB9584012L) == (safe_mul_func_uint16_t_u_u(((+(g_235 ^= (safe_sub_func_uint32_t_u_u(g_281, (0x1EL == (&p_7 == (void*)0)))))) ^ l_940[4][1][2].f1), g_60.f2)))));
+ }
+ (*g_112) = func_55(g_873[1].f8, func_55(g_873[1].f4, (**l_823)));
+ }
+ }
+ (*l_765) |= (&l_755 == &g_351);
+ }
+ else
+ { /* block id: 590 */
+ int8_t *l_953 = (void*)0;
+ int8_t *l_954 = (void*)0;
+ int8_t *l_955 = &l_828.f3;
+ int8_t *l_956 = &l_761[1].f0;
+ int32_t l_958 = 0x9DAD464FL;
+ uint8_t ** const *l_963 = &g_903;
+ struct S2 *l_993 = &g_994;
+ int32_t l_999 = 0x1FC6B783L;
+ union U3 l_1000 = {2L};
+ int32_t l_1004 = (-3L);
+ int32_t l_1023 = 4L;
+ int32_t l_1024 = 1L;
+ int32_t l_1025 = 0x8524DFEBL;
+ struct S1 l_1036[8][9] = {{{248UL,94},{0xF8L,338},{0xE8L,272},{0xF8L,338},{0x26L,289},{0xF8L,338},{253UL,183},{0x81L,69},{0xE8L,272}},{{0UL,304},{250UL,353},{246UL,358},{246UL,358},{0UL,304},{0x63L,23},{0UL,304},{0UL,304},{0UL,304}},{{248UL,80},{0xF8L,338},{253UL,183},{255UL,52},{0xE8L,272},{0x30L,130},{253UL,183},{255UL,52},{0x26L,289}},{{0x63L,23},{0UL,304},{246UL,358},{0x63L,23},{246UL,358},{250UL,353},{0x2FL,317},{0UL,304},{250UL,353}},{{0xE8L,272},{0xEAL,336},{0xE8L,272},{255UL,52},{253UL,183},{0x81L,69},{248UL,94},{0x81L,69},{0x26L,289}},{{0x2FL,317},{246UL,358},{0UL,304},{246UL,358},{246UL,358},{246UL,358},{250UL,353},{0x63L,23},{0UL,304}},{{0xE8L,272},{0x30L,130},{0x26L,289},{0xF8L,338},{0xE8L,272},{0x81L,69},{0xE8L,272},{0xEAL,336},{0xE8L,272}},{{0x63L,23},{246UL,358},{250UL,353},{0x2FL,317},{0UL,304},{250UL,353},{250UL,353},{0x2FL,317},{246UL,358}}};
+ uint8_t l_1049 = 0xCDL;
+ uint16_t l_1052 = 4UL;
+ struct S1 *l_1053 = &g_70.f6;
+ struct S0 l_1102 = {810,622,17};
+ int i, j;
+ if ((0UL && ((((safe_add_func_int32_t_s_s(((safe_unary_minus_func_uint16_t_u(p_5)) , 0x17D517E7L), 0xF3F259D8L)) || (255UL < ((*l_956) = ((*l_955) = (safe_unary_minus_func_int32_t_s((*l_765))))))) <= p_6.f0) && (!(((safe_unary_minus_func_uint32_t_u(g_54[6][1])) || (((((*l_850) = (*l_765)) > 0L) | l_958) > g_873[1].f0.f0)) || p_5)))))
+ { /* block id: 594 */
+ int32_t *l_965 = &l_958;
+ int32_t l_977[9] = {1L,1L,1L,1L,1L,1L,1L,1L,1L};
+ uint32_t l_1026 = 0xEA2335E4L;
+ int i;
+ if ((+(safe_mod_func_int16_t_s_s(g_285[0], g_873[1].f2.f1))))
+ { /* block id: 595 */
+ uint8_t ****l_961 = (void*)0;
+ uint8_t ** const **l_964 = &l_963;
+ (*l_765) = ((g_962 = &g_903) == ((*l_964) = l_963));
+ }
+ else
+ { /* block id: 599 */
+ uint32_t l_968 = 4294967295UL;
+ int32_t l_976 = 0x3FD06290L;
+ struct S0 ****l_996 = &l_823;
+ int32_t l_1019 = 0xF3E25FD9L;
+ (*g_124) = l_965;
+ if ((safe_sub_func_int8_t_s_s(p_4, ((void*)0 != &p_5))))
+ { /* block id: 601 */
+ struct S0 ****l_974 = &l_823;
+ uint32_t l_978[1];
+ int i;
+ for (i = 0; i < 1; i++)
+ l_978[i] = 1UL;
+ (*g_124) = (*g_124);
+ l_968--;
+ (**g_124) = (safe_rshift_func_uint8_t_u_s(g_973, (l_974 == l_975)));
+ l_978[0]++;
+ }
+ else
+ { /* block id: 606 */
+ union U3 *l_981 = &g_489;
+ union U3 *l_986 = &g_489;
+ uint32_t *l_989 = &g_217[4];
+ uint32_t **l_988 = &l_989;
+ int32_t l_995 = (-1L);
+ uint32_t *l_1001 = (void*)0;
+ uint32_t *l_1002 = (void*)0;
+ uint32_t *l_1003 = &l_755;
+ l_981 = &p_6;
+ l_977[0] &= ((*l_765) < ((safe_rshift_func_uint16_t_u_s((safe_sub_func_uint32_t_u_u(g_70.f5, (((**g_124) <= ((l_828 = ((*l_986) = ((*l_981) = (*l_981)))) , g_987[0][0][0])) ^ ((l_976 , ((*l_988) = &l_762)) == &l_968)))), 8)) <= (safe_mul_func_int8_t_s_s((((**l_814) , g_829[1]) , g_987[0][0][0]), g_987[0][0][0]))));
+ l_993 = l_992;
+ l_1004 ^= ((((**g_124) = ((void*)0 != l_850)) != ((*l_1003) |= (p_6.f3 <= ((l_995 > (g_994.f4 & ((void*)0 == l_996))) == ((l_976 , ((safe_mod_func_int16_t_s_s(func_24(((func_19(p_4, p_6, l_999, g_70.f0.f2) , &g_962) != (void*)0), (*g_259), l_1000, g_994.f2.f2, p_6), 2L)) , l_995)) == l_995))))) , 0L);
+ }
+ for (l_908 = (-21); (l_908 >= (-30)); l_908 = safe_sub_func_int16_t_s_s(l_908, 2))
+ { /* block id: 620 */
+ int32_t l_1018 = 0x7BA02CBBL;
+ uint32_t l_1020 = 0xB5190745L;
+ (*g_124) = (void*)0;
+ l_1018 |= (safe_div_func_uint16_t_u_u((p_6.f0 >= (g_70.f6.f1 == (safe_div_func_uint16_t_u_u((((void*)0 != l_1011) == ((((safe_lshift_func_uint8_t_u_u(((*l_763) = ((safe_sub_func_int16_t_s_s((*l_965), p_7)) && (((safe_add_func_int16_t_s_s((func_24(p_6.f0, (p_6.f3 , (g_70 , (**l_814))), l_1000, g_873[1].f0.f0, p_6) < g_994.f8), p_5)) || 65531UL) && p_4))), 6)) , (void*)0) != &g_258) & p_6.f2)), 0xBE32L)))), p_6.f2));
+ l_1020--;
+ l_1026++;
+ }
+ }
+ }
+ else
+ { /* block id: 628 */
+ int8_t l_1050[1];
+ uint32_t l_1051 = 0x8A9C3866L;
+ int32_t **l_1060 = &l_929[2][1];
+ const struct S2 *l_1064 = &g_873[1];
+ const struct S2 **l_1063[2][1];
+ const struct S2 ***l_1062 = &l_1063[0][0];
+ int32_t *l_1065 = (void*)0;
+ struct S0 l_1066 = {-1073,606,6};
+ union U3 l_1090 = {-1L};
+ int i, j;
+ for (i = 0; i < 1; i++)
+ l_1050[i] = 0xE6L;
+ for (i = 0; i < 2; i++)
+ {
+ for (j = 0; j < 1; j++)
+ l_1063[i][j] = &l_1064;
+ }
+ for (l_1004 = (-27); (l_1004 == (-28)); --l_1004)
+ { /* block id: 631 */
+ int32_t l_1031 = 0x2CB25B1DL;
+ int32_t l_1047[1];
+ int i;
+ for (i = 0; i < 1; i++)
+ l_1047[i] = 0L;
+ l_1051 |= (((l_1031 & (safe_mod_func_uint16_t_u_u((safe_add_func_int16_t_s_s((0UL == ((((l_1036[2][1] , ((g_254[9] || p_7) | (((safe_div_func_int16_t_s_s((p_5 ^= func_24((~(p_7 < (0x33L > (l_1047[0] = (func_24((safe_add_func_int8_t_s_s(((*l_955) = (safe_rshift_func_uint16_t_u_s((!(((***l_823) , ((*l_956) = (safe_div_func_int16_t_s_s(g_873[1].f5, g_747)))) && p_7)), p_6.f0))), 0x6FL)), (**g_258), p_6, p_6.f2, p_6) , 5L))))), (**g_112), p_6, g_70.f0.f0, l_1048)), g_873[1].f7.f0)) & 0xB1A9L) || l_1049))) == l_1050[0]) < p_6.f0) >= l_1036[2][1].f0)), (-1L))), p_6.f0))) | (-2L)) && l_958);
+ if (l_1052)
+ continue;
+ for (l_1000.f2 = 0; (l_1000.f2 <= 3); l_1000.f2 += 1)
+ { /* block id: 640 */
+ union U3 *l_1055 = &l_761[2];
+ union U3 **l_1054 = &l_1055;
+ l_1053 = l_1053;
+ if (l_958)
+ break;
+ (*l_1054) = &p_6;
+ }
+ }
+ (*l_765) ^= (((((((g_994.f0.f2 , g_70.f0.f2) , 0x98L) | g_70.f0.f0) > 0x78B4L) , 0xC9L) , (void*)0) != &g_156[2][1][7]);
+ if (p_6.f0)
+ { /* block id: 649 */
+ struct S0 l_1067 = {-745,148,10};
+ const union U3 l_1068 = {0xE6L};
+ const union U3 l_1075 = {0xB9L};
+ l_1066.f0 ^= (p_6.f0 | ((**l_1061) == ((safe_mul_func_uint16_t_u_u(func_24((safe_rshift_func_uint16_t_u_s(((safe_div_func_uint16_t_u_u((func_24((g_70 , g_397[6][7]), (***l_823), p_6, l_1067.f1, l_1075) == g_60.f1), l_1036[2][1].f1)) && p_4), g_70.f4)), (**g_112), l_828, p_6.f2, p_6), p_3)) , (**l_1061))));
+ for (l_899 = 0; (l_899 != 57); l_899++)
+ { /* block id: 653 */
+ return g_60.f1;
+ }
+ }
+ else
+ { /* block id: 656 */
+ union U3 *l_1078 = &l_1000;
+ int32_t l_1083 = 0xDF239507L;
+ int32_t l_1091 = 0xD9436DE9L;
+ g_994.f2.f0 ^= func_24((((l_958 = 65527UL) || g_70.f0.f1) , g_70.f0.f0), func_30(p_7, l_761[1]), ((*l_1078) = p_6), (safe_add_func_int16_t_s_s((safe_add_func_uint8_t_u_u(l_1023, (l_999 , l_1083))), g_217[4])), p_6);
+ if (l_1083)
+ { /* block id: 660 */
+ int8_t l_1084 = 0x40L;
+ (*g_124) = (*l_1060);
+ return l_1084;
+ }
+ else
+ { /* block id: 663 */
+ const uint8_t l_1087 = 1UL;
+ uint32_t *l_1089 = &g_217[1];
+ union U3 l_1092 = {-1L};
+ struct S0 l_1103[3] = {{-1416,536,19},{-1416,536,19},{-1416,536,19}};
+ int32_t l_1104 = (-8L);
+ int i;
+ (*l_765) = (safe_rshift_func_uint8_t_u_u(p_3, l_1087));
+ (*l_1053) = (((*l_850) ^= g_304.f2) , func_19(((safe_unary_minus_func_int8_t_s((l_1091 |= (+func_24(((*l_1089) ^= p_3), (**g_112), l_1090, l_1023, p_6))))) <= (p_6 , ((void*)0 != &g_449))), l_1092, p_6.f2, p_7));
+ (*g_124) = &g_285[4];
+ l_1104 ^= (g_235 | func_24((func_24(((~((l_999 = func_24((p_6.f0 , (safe_div_func_int32_t_s_s(((safe_mul_func_int16_t_s_s(p_3, l_1092.f2)) == g_235), (-4L)))), l_1103[2], p_6, p_5, p_6)) , g_745)) || l_1036[2][1].f1), l_1066, l_828, p_6.f3, p_6) && 0x6F55L), (*g_113), p_6, g_255, p_6));
+ }
+ }
+ (*g_124) = (*l_1060);
+ }
+ for (l_1101 = 0; l_1101 < 7; l_1101 += 1)
+ {
+ g_285[l_1101] = (-9L);
+ }
+ }
+ (*g_124) = (void*)0;
+ }
+ return g_873[1].f4;
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_70.f3 g_371 g_252 g_254 g_285 g_70.f5 g_389 g_351 g_397 g_54 g_304 g_141 g_217 g_60.f0 g_70.f2.f0 g_304.f2 g_124 g_70 g_234 g_125 g_449 g_304.f3 g_489 g_258 g_259 g_203 g_112 g_113 g_235 g_255
+ * writes: g_70.f3 g_371 g_252 g_285 g_70.f5 g_389 g_351 g_54 g_141 g_70.f2.f0 g_203 g_254 g_361 g_234 g_125 g_304.f3 g_489.f1 g_113 g_538
+ */
+static union U3 func_10(int8_t p_11, struct S1 p_12, uint32_t p_13, uint16_t p_14)
+{ /* block id: 245 */
+ int32_t l_362 = 0xE1E14E08L;
+ int32_t l_366 = 0xFEEB1536L;
+ int32_t l_367 = 0xEBD9CC5EL;
+ int32_t l_369 = 0xC11021ADL;
+ int32_t l_370[1][1];
+ int16_t l_378 = 6L;
+ union U3 l_399[7] = {{0L},{0L},{0L},{0L},{0L},{0L},{0L}};
+ struct S1 l_411 = {0x94L,26};
+ uint32_t l_412 = 1UL;
+ struct S2 l_419 = {{-1658,138,1},0x63A0385EL,{552,221,3},7UL,1UL,4294967295UL,{255UL,122},{68,637,6},4294967286UL};
+ uint8_t *l_420 = &g_389[4];
+ int32_t l_427 = 5L;
+ uint8_t l_441 = 1UL;
+ int16_t l_486 = (-6L);
+ uint32_t l_500 = 5UL;
+ struct S2 *l_518 = &g_70;
+ struct S2 **l_517[10][1] = {{&l_518},{(void*)0},{(void*)0},{(void*)0},{&l_518},{&l_518},{&l_518},{&l_518},{&l_518},{&l_518}};
+ struct S1 **l_536 = &g_156[3][0][0];
+ struct S0 ***l_539 = &g_258;
+ int32_t l_614 = (-1L);
+ int8_t l_618 = 0x00L;
+ int16_t l_619 = 1L;
+ int32_t l_704 = 0L;
+ uint32_t l_741 = 4294967286UL;
+ int i, j;
+ for (i = 0; i < 1; i++)
+ {
+ for (j = 0; j < 1; j++)
+ l_370[i][j] = 5L;
+ }
+lbl_396:
+ for (g_70.f3 = 0; (g_70.f3 <= 9); g_70.f3 += 1)
+ { /* block id: 248 */
+ int32_t *l_363 = &g_285[0];
+ int32_t *l_364 = (void*)0;
+ int32_t *l_365[8] = {&l_362,&l_362,&l_362,&l_362,&l_362,&l_362,&l_362,&l_362};
+ int32_t l_368[6] = {(-6L),(-6L),(-6L),(-6L),(-6L),(-6L)};
+ int i;
+ g_371[3]--;
+ for (g_252 = 9; (g_252 >= 0); g_252 -= 1)
+ { /* block id: 252 */
+ uint32_t l_374 = 0x66269D93L;
+ ++l_374;
+ }
+ g_285[5] |= (g_254[g_70.f3] == 0x67D3L);
+ for (g_70.f5 = 0; (g_70.f5 <= 5); g_70.f5 += 1)
+ { /* block id: 258 */
+ int32_t l_377 = 0xDD09BC50L;
+ int8_t l_379 = 7L;
+ int32_t l_380 = 0xAE3961EAL;
+ int32_t l_381 = 0x42FC192AL;
+ int32_t l_382 = 7L;
+ int32_t l_383 = 0x9ACD6B56L;
+ int32_t l_384 = 0x3B7FE7ACL;
+ int32_t l_385 = 1L;
+ int32_t l_386 = 0x72941B8CL;
+ int32_t l_387 = 0x1F5CE4DAL;
+ int32_t l_388 = 0x3F1211D8L;
+ int i;
+ --g_389[4];
+ }
+ }
+ for (l_369 = 0; (l_369 < 0); l_369 = safe_add_func_uint32_t_u_u(l_369, 1))
+ { /* block id: 264 */
+ struct S0 l_398 = {-1582,239,17};
+ int8_t l_400 = 0xDBL;
+ uint8_t *l_407 = &g_203[9];
+ struct S1 *l_408 = &g_361;
+ for (g_351 = (-14); (g_351 < 46); ++g_351)
+ { /* block id: 267 */
+ if (g_252)
+ goto lbl_396;
+ if (g_397[6][7])
+ break;
+ }
+ (*l_408) = func_19((g_54[7][8] ^= (l_398 , (p_12.f1 | p_13))), l_399[5], l_399[5].f3, ((*l_407) = (p_14 == (~((p_14 > l_400) | (safe_div_func_uint16_t_u_u(func_24((safe_rshift_func_uint16_t_u_u(((((safe_mod_func_uint32_t_u_u(p_14, 0x7A0AC41DL)) , 1UL) != l_398.f0) && 65527UL), p_13)), l_398, l_399[1], l_399[5].f2, g_304), p_14)))))));
+ }
+ if (((safe_mul_func_int16_t_s_s((l_411 , l_412), ((p_12.f1 || ((safe_add_func_uint16_t_u_u((&g_156[2][1][7] != ((l_370[0][0] <= ((p_12.f1 & (((safe_rshift_func_uint8_t_u_u(((*l_420) = (safe_add_func_int32_t_s_s((l_419 , (l_367 |= (0x12A3BDFEL != ((4L > p_14) , 4294967295UL)))), l_362))), p_12.f1)) | 0xA0E8L) & l_362)) | l_419.f7.f2)) , (void*)0)), 0x28D3L)) < l_419.f3)) == 0xC3C018DCL))) > p_11))
+ { /* block id: 277 */
+ int32_t l_424 = 0x94D545F5L;
+ int32_t l_431 = 0L;
+ int32_t l_433 = 0x2D02096CL;
+ int32_t l_439 = 9L;
+ int32_t l_440 = 0xE3C3D422L;
+ int16_t *l_446 = &g_54[6][7];
+ union U3 l_450 = {-10L};
+ uint32_t l_461[7] = {0x9D54AD48L,0UL,0x9D54AD48L,0UL,0x8A9DE29EL,0UL,0x8A9DE29EL};
+ int8_t *l_487 = &g_304.f3;
+ union U3 *l_488 = &l_399[5];
+ struct S1 l_509 = {246UL,50};
+ int16_t l_542 = 0xB5B2L;
+ int i;
+ for (p_12.f0 = 0; (p_12.f0 <= 4); p_12.f0 += 1)
+ { /* block id: 280 */
+ int32_t l_423[4][2] = {{0x80E682F7L,2L},{0x80E682F7L,2L},{0x80E682F7L,2L},{0x80E682F7L,2L}};
+ int i, j;
+ for (g_234 = 2; (g_234 <= 8); g_234 += 1)
+ { /* block id: 283 */
+ int8_t l_425 = 0x0AL;
+ int32_t l_426 = 0xFD18EFFAL;
+ int32_t l_430 = 0x97BB54BDL;
+ int32_t l_432 = 0x0CE76D96L;
+ int32_t l_434 = 0x76B98D45L;
+ int32_t l_438 = 0xF3D00703L;
+ for (g_70.f5 = 1; (g_70.f5 <= 4); g_70.f5 += 1)
+ { /* block id: 286 */
+ int32_t *l_421 = &g_285[0];
+ int32_t l_428 = 0L;
+ int32_t l_429 = 0x3C8A0015L;
+ int32_t l_435 = 5L;
+ int32_t l_436 = 1L;
+ int32_t l_437 = 0x0061209BL;
+ int i, j;
+ for (g_361.f0 = 0; (g_361.f0 <= 8); g_361.f0 += 1)
+ { /* block id: 289 */
+ (*g_124) = (void*)0;
+ }
+ if ((g_70 , ((*l_421) ^= g_54[(g_234 + 1)][(g_70.f5 + 1)])))
+ { /* block id: 293 */
+ int32_t *l_422[7] = {&l_370[0][0],&l_370[0][0],&l_370[0][0],&l_370[0][0],&l_370[0][0],&l_370[0][0],&l_370[0][0]};
+ int i, j;
+ l_423[2][0] &= ((*l_421) = g_54[(g_70.f5 + 4)][g_234]);
+ (*g_124) = l_422[4];
+ ++l_441;
+ (**g_124) ^= g_397[g_234][g_70.f5];
+ }
+ else
+ { /* block id: 299 */
+ const struct S2 l_444 = {{-725,623,1},0xCA113D64L,{-36,526,18},0xFD0AL,2UL,0x325F462AL,{0x24L,77},{1998,387,3},4294967292UL};
+ const int16_t *l_448[9][3] = {{&g_449,&g_449,&g_449},{&g_449,&g_449,&g_449},{&g_449,&g_449,&g_449},{&g_449,(void*)0,&g_449},{&g_449,&g_449,&g_449},{&g_449,(void*)0,&g_449},{&g_449,&g_449,&g_449},{&g_449,&g_449,(void*)0},{&g_449,&g_449,&g_449}};
+ const int16_t **l_447 = &l_448[2][1];
+ int i, j;
+ l_423[2][0] &= (g_389[g_70.f5] > (l_444 , ((safe_unary_minus_func_uint16_t_u((l_446 != ((*l_447) = &g_234)))) || g_389[p_12.f0])));
+ (*g_124) = &g_8;
+ (*l_421) &= l_431;
+ }
+ }
+ }
+ for (l_419.f6.f0 = 3; (l_419.f6.f0 <= 8); l_419.f6.f0 += 1)
+ { /* block id: 309 */
+ int i, j;
+ if (g_54[l_419.f6.f0][(p_12.f0 + 3)])
+ break;
+ }
+ for (g_70.f5 = 0; (g_70.f5 <= 4); g_70.f5 += 1)
+ { /* block id: 314 */
+ return l_450;
+ }
+ }
+ if ((l_446 != l_446))
+ { /* block id: 318 */
+ int32_t *l_451 = &l_370[0][0];
+ int32_t *l_452 = &l_439;
+ int32_t *l_453 = &l_427;
+ int32_t *l_454 = (void*)0;
+ int32_t l_455 = 0L;
+ int32_t *l_456 = &l_366;
+ int32_t l_457 = 1L;
+ int32_t *l_458 = &l_427;
+ int32_t *l_459[9];
+ int32_t l_460 = 0xC37D6EB4L;
+ int i;
+ for (i = 0; i < 9; i++)
+ l_459[i] = &l_427;
+ l_461[0]++;
+ }
+ else
+ { /* block id: 320 */
+ uint16_t l_473 = 0x49B7L;
+ struct S1 **l_479[4];
+ struct S1 ***l_478 = &l_479[2];
+ int i;
+ for (i = 0; i < 4; i++)
+ l_479[i] = &g_156[2][1][7];
+ (*g_124) = (g_304 , ((safe_rshift_func_uint16_t_u_u((&g_156[2][2][3] == ((*l_478) = ((l_419 , ((safe_unary_minus_func_int32_t_s((((l_419 , (safe_mod_func_int8_t_s_s((p_12.f1 || (safe_add_func_int32_t_s_s((safe_rshift_func_int8_t_s_u(l_473, 4)), ((safe_add_func_int16_t_s_s(0xF2F6L, (safe_add_func_uint16_t_u_u(g_449, (((((func_30((g_70.f3 <= 4294967288UL), g_304) , l_439) || 0x5133L) , l_473) && 0x3730C2AAL) , l_431))))) , g_285[0])))), g_70.f6.f1))) & p_14) , 0xF7A3E2A1L))) == p_12.f0)) , &g_156[0][0][6]))), 4)) , (void*)0));
+ }
+ if ((safe_mul_func_uint16_t_u_u((safe_sub_func_int16_t_s_s(((((((l_419.f7.f1 | (safe_lshift_func_int8_t_s_u(l_486, 2))) | l_431) <= func_24(l_450.f3, func_30(((*l_487) ^= g_70.f6.f0), ((*l_488) = l_450)), g_489, (g_389[4] , l_362), g_489)) >= p_13) != 6L) | 0xAFF3E48AL), 0x0CA3L)), p_12.f1)))
+ { /* block id: 326 */
+ struct S1 *l_492 = &l_419.f6;
+ int32_t l_499 = 0xD4FC97C9L;
+ const int32_t l_506 = 0xD029A9FEL;
+ struct S1 ***l_537[5][10][1] = {{{&l_536},{(void*)0},{&l_536},{&l_536},{&l_536},{(void*)0},{&l_536},{&l_536},{&l_536},{(void*)0}},{{&l_536},{&l_536},{&l_536},{&l_536},{&l_536},{&l_536},{&l_536},{&l_536},{&l_536},{(void*)0}},{{&l_536},{&l_536},{&l_536},{(void*)0},{&l_536},{&l_536},{&l_536},{(void*)0},{&l_536},{&l_536}},{{&l_536},{&l_536},{&l_536},{&l_536},{&l_536},{&l_536},{&l_536},{(void*)0},{&l_536},{&l_536}},{{&l_536},{(void*)0},{&l_536},{&l_536},{&l_536},{(void*)0},{&l_536},{&l_536},{&l_536},{&l_536}}};
+ int i, j, k;
+ for (l_450.f0 = 0; (l_450.f0 < (-19)); l_450.f0 = safe_sub_func_uint8_t_u_u(l_450.f0, 3))
+ { /* block id: 329 */
+ g_489.f1 = ((**g_258) , 0x04E13DBBL);
+ }
+ (*l_492) = p_12;
+ for (g_141 = 0; (g_141 <= 9); g_141 += 1)
+ { /* block id: 335 */
+ int32_t *l_493 = &l_431;
+ int32_t *l_494 = &l_427;
+ int32_t *l_495 = &l_370[0][0];
+ int32_t *l_496 = &g_285[5];
+ int32_t *l_497 = &l_433;
+ int32_t *l_498[2][6] = {{&l_440,(void*)0,&l_424,&l_424,&l_440,(void*)0},{(void*)0,&l_424,&l_440,&l_440,&l_424,&l_424}};
+ struct S2 l_516 = {{-705,478,14},-2L,{874,439,19},0xA709L,0x881E990DL,0x2BEB2506L,{3UL,214},{1184,19,1},0UL};
+ int i, j;
+ ++l_500;
+ for (l_439 = 0; (l_439 <= 3); l_439 += 1)
+ { /* block id: 339 */
+ uint16_t *l_505 = (void*)0;
+ uint32_t l_531 = 0x08858FF4L;
+ int i;
+ (*l_493) &= (((g_254[(l_439 + 5)] = (safe_rshift_func_uint16_t_u_s(0xA922L, 9))) || ((l_499 = g_254[(l_439 + 5)]) <= (0L && l_506))) , ((~(*l_495)) & ((safe_add_func_uint32_t_u_u(g_70.f7.f2, (l_509 , (func_30(p_11, l_399[(l_439 + 2)]) , p_11)))) != 0x9845L)));
+ if (((((p_14 >= (safe_sub_func_uint32_t_u_u(((!(safe_mul_func_uint16_t_u_u((l_516 , (g_70.f0.f1 > ((void*)0 != &l_420))), ((g_70.f7.f2 , l_517[7][0]) != (void*)0)))) <= (p_12.f1 == l_419.f7.f0)), (*l_497)))) | g_54[7][8]) , l_419.f7.f2) != p_12.f0))
+ { /* block id: 343 */
+ int8_t l_519 = 1L;
+ int i;
+ (*l_492) = func_19(l_519, l_399[(l_439 + 3)], g_141, (safe_rshift_func_int8_t_s_u(l_424, 4)));
+ }
+ else
+ { /* block id: 345 */
+ const union U3 *l_523 = &g_524;
+ const union U3 **l_522 = &l_523;
+ const union U3 *l_526[4];
+ const union U3 **l_525 = &l_526[1];
+ int i;
+ for (i = 0; i < 4; i++)
+ l_526[i] = &g_524;
+ (*l_525) = ((*l_522) = &g_304);
+ }
+ if (((p_14 <= ((safe_sub_func_uint8_t_u_u(((l_509.f0 | (p_11 > (safe_div_func_uint8_t_u_u(l_506, g_203[3])))) & ((1UL || (p_12.f1 , ((*l_420) |= ((0L ^ ((((l_531 < p_14) , l_509.f0) ^ l_419.f7.f1) && l_399[(l_439 + 2)].f0)) < 0xFFL)))) ^ g_70.f0.f0)), p_12.f0)) | p_11)) , l_399[(l_439 + 2)].f2))
+ { /* block id: 350 */
+ (*l_495) |= 0xA66C8E15L;
+ if (g_54[7][8])
+ continue;
+ }
+ else
+ { /* block id: 353 */
+ struct S1 l_532[4][5] = {{{248UL,224},{0x00L,328},{248UL,224},{0x00L,328},{248UL,224}},{{1UL,256},{1UL,256},{0x44L,66},{0x44L,66},{1UL,256}},{{1UL,32},{0x00L,328},{1UL,32},{0x00L,328},{1UL,32}},{{1UL,256},{0x44L,66},{0x44L,66},{1UL,256},{1UL,256}}};
+ int i, j;
+ if (p_12.f0)
+ break;
+ (*l_492) = l_532[1][4];
+ (*g_112) = (*g_112);
+ (*l_494) &= p_11;
+ }
+ (*g_124) = &g_285[0];
+ for (l_419.f1 = 0; (l_419.f1 <= 3); l_419.f1 += 1)
+ { /* block id: 362 */
+ uint32_t l_533 = 0x67712ECBL;
+ l_533--;
+ }
+ }
+ }
+ g_538[0] = l_536;
+ }
+ else
+ { /* block id: 368 */
+ int16_t *l_543 = &g_252;
+ int32_t l_544 = (-2L);
+ p_12 = func_19(((l_539 == ((p_13 || ((((safe_rshift_func_int16_t_s_s(0x08C2L, 10)) > l_542) > (&g_234 != (g_235 , l_543))) & (&g_281 == (l_544 , (void*)0)))) , (void*)0)) > g_255), g_304, p_11, p_12.f1);
+ p_12 = l_509;
+ }
+ }
+ else
+ { /* block id: 372 */
+ struct S1 l_550 = {255UL,4};
+ union U3 l_567 = {0xA4L};
+ int32_t l_579 = 1L;
+ int32_t l_607 = 0x343D702DL;
+ int32_t l_612[7] = {(-1L),(-1L),(-1L),1L,(-1L),(-1L),(-1L)};
+ int32_t l_615 = 0x18B8815EL;
+ struct S0 l_644[9][3][6] = {{{{-416,386,14},{-353,567,15},{386,372,5},{755,243,19},{1570,267,4},{-1320,589,0}},{{1412,38,7},{-642,380,10},{1570,267,4},{-1688,534,20},{648,78,16},{449,197,0}},{{755,243,19},{537,229,7},{3,417,2},{-353,567,15},{-168,240,13},{449,197,0}}},{{{-1320,589,0},{1069,372,3},{1570,267,4},{1272,217,19},{3,417,2},{515,645,21}},{{1032,590,8},{-194,10,0},{-416,386,14},{836,386,12},{346,610,7},{346,610,7}},{{-353,567,15},{755,243,19},{755,243,19},{-1832,170,15},{755,243,19},{-1320,589,0}}},{{{1069,372,3},{-1832,170,15},{-353,567,15},{-642,380,10},{-1688,534,20},{1272,217,19}},{{3,417,2},{386,372,5},{-194,10,0},{1032,590,8},{-353,567,15},{1232,130,10}},{{3,417,2},{-416,386,14},{-105,256,14},{-642,380,10},{1272,217,19},{-168,240,13}}},{{{1069,372,3},{-1688,534,20},{-1974,600,18},{-1832,170,15},{836,386,12},{1069,372,3}},{{-353,567,15},{1412,38,7},{-100,325,0},{836,386,12},{-1832,170,15},{449,197,0}},{{1069,372,3},{1232,130,10},{648,78,16},{449,197,0},{-642,380,10},{1942,177,18}}},{{{515,645,21},{1942,177,18},{1272,217,19},{1602,197,15},{1032,590,8},{-416,386,14}},{{-1320,589,0},{1942,177,18},{449,197,0},{1232,130,10},{-642,380,10},{-1832,170,15}},{{1570,267,4},{1232,130,10},{515,645,21},{-1320,589,0},{-1832,170,15},{648,78,16}}},{{{-194,10,0},{1412,38,7},{386,372,5},{386,372,5},{836,386,12},{386,372,5}},{{3,417,2},{-1688,534,20},{3,417,2},{836,386,12},{1272,217,19},{1570,267,4}},{{449,197,0},{-416,386,14},{-1975,372,0},{648,78,16},{1602,197,15},{3,417,2}}},{{{1232,130,10},{-416,386,14},{-1975,372,0},{755,243,19},{1232,130,10},{1570,267,4}},{{-1975,372,0},{-353,567,15},{3,417,2},{537,229,7},{-1320,589,0},{386,372,5}},{{537,229,7},{-1320,589,0},{386,372,5},{-1832,170,15},{386,372,5},{648,78,16}}},{{{-1688,534,20},{1942,177,18},{515,645,21},{1032,590,8},{836,386,12},{-1832,170,15}},{{346,610,7},{-100,325,0},{449,197,0},{515,645,21},{648,78,16},{-416,386,14}},{{-642,380,10},{1032,590,8},{449,197,0},{515,645,21},{755,243,19},{-105,256,14}}},{{{346,610,7},{-1240,227,3},{755,243,19},{1032,590,8},{537,229,7},{-1974,600,18}},{{-1688,534,20},{1602,197,15},{-642,380,10},{-1832,170,15},{-1832,170,15},{-100,325,0}},{{537,229,7},{537,229,7},{-1975,372,0},{537,229,7},{1032,590,8},{648,78,16}}}};
+ int32_t l_674 = 0x3894630CL;
+ uint32_t l_691[7] = {4294967294UL,4294967294UL,4294967294UL,4294967294UL,4294967294UL,4294967294UL,4294967294UL};
+ const int32_t *l_708 = (void*)0;
+ const int32_t *l_709 = &l_362;
+ int i, j, k;
+ l_419.f2.f0 ^= 0x0E521611L;
+ for (g_234 = 19; (g_234 <= 21); g_234++)
+ { /* block id: 376 */
+ union U3 l_555 = {6L};
+ int32_t l_568 = 0x3DA5E9D1L;
+ union U3 l_576 = {-1L};
+ uint32_t l_578[4] = {4294967288UL,4294967288UL,4294967288UL,4294967288UL};
+ struct S0 l_593 = {125,387,1};
+ int32_t l_613 = 0xA08FAB05L;
+ int32_t l_617 = 8L;
+ const union U3 **l_665 = &g_664;
+ const union U3 l_675 = {1L};
+ int32_t l_727 = (-10L);
+ int32_t l_728 = 0xB2D0C4B9L;
+ int32_t l_731 = 0x2C7BC777L;
+ int32_t l_732 = (-1L);
+ int32_t l_733 = (-1L);
+ int32_t l_735 = 0L;
+ int32_t l_736 = 0x63764777L;
+ int32_t l_737 = (-6L);
+ int32_t l_738[3];
+ int16_t l_740[3][5][5] = {{{1L,3L,0x58C2L,0L,1L},{0x9C69L,0x938FL,0x58C2L,(-1L),0xDF69L},{0x58C2L,0L,0x37AAL,0x37AAL,0x7061L},{(-2L),(-1L),1L,(-1L),1L},{0x58C2L,(-1L),1L,3L,0xB254L}},{{0xD5DDL,9L,0x7061L,0xB254L,0x9C69L},{1L,(-1L),0x9C69L,0xB254L,0L},{(-1L),1L,0x318EL,0xB254L,(-1L)},{9L,0xD5DDL,0x37AAL,3L,0x37AAL},{0x58C2L,0x58C2L,9L,0x58C2L,(-1L)}},{{(-1L),0xD5DDL,(-1L),1L,3L},{0x7061L,0L,0x58C2L,1L,0xB254L},{1L,1L,0x3AA0L,0x7061L,0xB254L},{(-1L),9L,0xF9C9L,(-1L),0xB254L},{0x318EL,0xB254L,9L,3L,3L}}};
+ int32_t l_746 = 0xF7B220A1L;
+ uint32_t *l_753 = &l_578[1];
+ int i, j, k;
+ for (i = 0; i < 3; i++)
+ l_738[i] = 1L;
+ for (p_14 = (-16); (p_14 == 54); p_14 = safe_add_func_uint32_t_u_u(p_14, 3))
+ { /* block id: 379 */
+ struct S1 *l_549 = (void*)0;
+ l_550 = p_12;
+ }
+ }
+ }
+ return l_399[6];
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads :
+ * writes: g_254
+ */
+static struct S1 func_19(int16_t p_20, union U3 p_21, uint8_t p_22, uint8_t p_23)
+{ /* block id: 240 */
+ struct S1 l_359 = {255UL,212};
+ l_359 = l_359;
+ for (p_23 = 0; p_23 < 10; p_23 += 1)
+ {
+ g_254[p_23] = 0x93DCL;
+ }
+ return l_359;
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_252 g_141 g_70.f3 g_285 g_217 g_60.f0 g_70.f2.f0 g_304.f2 g_351
+ * writes: g_252 g_141 g_70.f3 g_285 g_351 g_70.f2.f0
+ */
+static uint16_t func_24(uint32_t p_25, struct S0 p_26, union U3 p_27, uint32_t p_28, const union U3 p_29)
+{ /* block id: 200 */
+ uint32_t l_317 = 0x2C0D943BL;
+ int32_t l_325 = 1L;
+ int32_t l_326 = 0xFC5A9C8AL;
+ int32_t l_327[4] = {2L,2L,2L,2L};
+ const uint16_t *l_347 = &g_70.f3;
+ uint8_t l_357 = 1UL;
+ int32_t *l_358[10][7] = {{&g_285[0],&l_325,&g_285[6],&g_285[6],&l_327[0],(void*)0,&g_285[0]},{&g_285[0],&l_326,&g_285[1],(void*)0,&g_285[5],&g_8,&l_327[0]},{&g_285[6],&g_8,&g_285[0],&g_285[6],&l_325,(void*)0,&l_326},{&l_327[0],&l_327[0],&g_8,&g_8,&g_285[1],&l_327[0],&l_326},{&g_8,&l_327[0],&g_285[0],(void*)0,&l_326,&g_8,&l_325},{(void*)0,&l_325,&g_285[0],&g_285[6],&l_327[0],&g_8,&g_285[5]},{&g_285[5],(void*)0,(void*)0,&g_285[0],&l_327[0],(void*)0,&g_285[0]},{&g_285[0],&g_285[2],(void*)0,&l_327[0],&l_327[0],&g_8,&g_8},{&g_285[6],&l_327[0],&l_325,&l_325,&g_8,&g_285[6],&l_326},{&g_8,&g_285[2],&l_327[0],&l_325,&g_285[2],&g_8,&g_285[0]}};
+ int i, j;
+ for (g_252 = 0; (g_252 <= 27); g_252++)
+ { /* block id: 203 */
+ uint8_t l_315 = 0x02L;
+ l_315 = (-1L);
+ if (l_315)
+ continue;
+ }
+ for (g_141 = 0; (g_141 <= 6); g_141 += 1)
+ { /* block id: 209 */
+ uint16_t l_316 = 65535UL;
+ uint32_t *l_350 = &g_351;
+ uint16_t l_352[7][5] = {{0xA96EL,0xDB85L,0UL,65527UL,0xDB85L},{65530UL,0x12FEL,0x616FL,0x41E1L,0x12FEL},{2UL,0UL,65527UL,0xA96EL,0UL},{0x616FL,0xC937L,0x12FEL,65530UL,0xC937L},{0xDB85L,2UL,0xA96EL,2UL,2UL},{0x12FEL,0x41E1L,65530UL,0x616FL,0x41E1L},{0xA96EL,0xDB85L,2UL,0xDB85L,0xDB85L}};
+ struct S2 *l_354 = &g_70;
+ struct S2 **l_353 = &l_354;
+ int i, j;
+ for (g_70.f3 = 1; (g_70.f3 <= 4); g_70.f3 += 1)
+ { /* block id: 212 */
+ uint8_t l_329 = 1UL;
+ int i;
+ if (g_285[g_141])
+ { /* block id: 213 */
+ int i;
+ return g_217[g_70.f3];
+ }
+ else
+ { /* block id: 215 */
+ int32_t l_328[5][4] = {{0L,(-1L),0L,(-1L)},{0L,(-1L),0L,(-1L)},{0L,(-1L),0L,(-1L)},{0L,(-1L),0L,(-1L)},{0L,(-1L),0L,(-1L)}};
+ struct S1 * const l_335 = &g_70.f6;
+ struct S1 l_336 = {0xC7L,109};
+ int i, j;
+ if (((l_316 ^ l_317) >= p_25))
+ { /* block id: 216 */
+ int32_t *l_318 = &g_285[5];
+ int32_t *l_319 = &g_285[3];
+ int32_t *l_320 = &g_285[g_141];
+ int32_t *l_321 = &g_285[0];
+ int32_t *l_322 = &g_285[0];
+ int32_t *l_323 = &g_285[6];
+ int32_t *l_324[2][6][1] = {{{&g_285[6]},{&g_8},{&g_8},{&g_285[0]},{&g_8},{&g_285[g_141]}},{{&g_285[5]},{&g_285[6]},{&g_8},{&g_285[5]},{&g_285[5]},{&g_285[0]}}};
+ int i, j, k;
+ ++l_329;
+ for (p_27.f0 = 4; (p_27.f0 >= 0); p_27.f0 -= 1)
+ { /* block id: 220 */
+ struct S1 *l_334[7][9] = {{&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,(void*)0},{&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,(void*)0},{&g_70.f6,(void*)0,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6},{&g_70.f6,(void*)0,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6},{&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6},{(void*)0,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6},{&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6}};
+ int i, j;
+ (*l_323) |= (safe_mul_func_int16_t_s_s((((void*)0 == &g_252) == ((l_334[3][5] != l_335) <= (l_336 , g_60.f0))), 0x9EE5L));
+ l_319 = &g_285[g_141];
+ }
+ }
+ else
+ { /* block id: 224 */
+ return g_252;
+ }
+ }
+ if (l_325)
+ break;
+ }
+ g_285[g_141] = (safe_add_func_int8_t_s_s((((func_30((p_27.f3 = (safe_add_func_uint32_t_u_u(((*l_350) = ((g_285[g_141] <= (g_285[g_141] , (safe_mul_func_int8_t_s_s(g_285[g_141], (safe_div_func_uint8_t_u_u((safe_add_func_int16_t_s_s(((void*)0 == l_347), ((safe_lshift_func_int8_t_s_s(g_285[g_141], p_26.f1)) < ((p_29.f0 , p_25) <= g_60.f0)))), 1UL)))))) >= 251UL)), 0x952115EFL))), p_29) , 4L) , l_326) <= p_26.f0), l_352[2][1]));
+ (*l_353) = (void*)0;
+ p_26.f0 |= (safe_add_func_uint32_t_u_u((((*l_350) = (0x42L | ((-1L) == l_327[0]))) , ((*l_350) |= g_304.f2)), l_357));
+ }
+ l_358[9][0] = &l_327[1];
+ return p_27.f3;
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_70.f3 g_70.f2.f0
+ * writes: g_70.f3 g_70.f2.f0
+ */
+static struct S0 func_30(const int8_t p_31, union U3 p_32)
+{ /* block id: 192 */
+ int32_t l_310 = (-1L);
+ struct S0 l_311 = {-1116,303,5};
+ for (g_70.f3 = 0; (g_70.f3 == 52); g_70.f3 = safe_add_func_uint32_t_u_u(g_70.f3, 5))
+ { /* block id: 195 */
+ uint32_t l_307 = 0UL;
+ int32_t *l_308 = (void*)0;
+ int32_t *l_309[5][9][3] = {{{&g_8,&g_285[0],&g_8},{&g_8,&g_8,(void*)0},{&g_8,(void*)0,&g_8},{&g_8,&g_285[0],&g_285[0]},{&g_8,(void*)0,&g_285[0]},{&g_8,&g_8,&g_8},{&g_8,&g_8,(void*)0},{&g_8,(void*)0,(void*)0},{&g_8,&g_285[0],&g_8}},{{&g_8,(void*)0,&g_8},{&g_8,&g_8,(void*)0},{&g_8,&g_8,&g_285[0]},{&g_8,(void*)0,(void*)0},{&g_8,&g_285[0],&g_8},{&g_8,(void*)0,&g_8},{&g_8,&g_8,(void*)0},{&g_8,&g_8,&g_285[0]},{(void*)0,(void*)0,(void*)0}},{{(void*)0,&g_285[0],&g_8},{&g_8,&g_285[0],&g_8},{&g_8,&g_8,(void*)0},{&g_8,&g_8,&g_285[0]},{(void*)0,&g_285[0],(void*)0},{(void*)0,&g_8,&g_8},{&g_8,&g_285[0],&g_8},{&g_8,&g_8,&g_285[0]},{&g_8,&g_8,&g_8}},{{(void*)0,&g_285[0],&g_285[0]},{(void*)0,&g_8,&g_8},{&g_8,&g_285[0],&g_8},{&g_8,&g_8,&g_285[0]},{&g_8,&g_8,&g_8},{&g_285[0],&g_285[0],&g_285[0]},{&g_285[0],&g_8,&g_8},{&g_8,&g_285[0],&g_8},{(void*)0,&g_8,&g_285[0]}},{{&g_8,&g_8,&g_8},{&g_285[0],&g_8,&g_285[0]},{&g_285[0],&g_8,&g_8},{&g_8,&g_8,&g_8},{(void*)0,&g_8,&g_285[0]},{&g_8,&g_8,&g_8},{&g_285[0],&g_8,&g_8},{&g_285[0],&g_8,&g_8},{&g_8,&g_8,&g_8}}};
+ int i, j, k;
+ g_70.f2.f0 |= (p_32 , p_32.f2);
+ l_310 |= p_31;
+ }
+ return l_311;
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_8 g_54 g_60.f0 g_70 g_79 g_112 g_124 g_125 g_141 g_156 g_67 g_60.f2 g_203 g_217 g_235 g_255 g_258 g_252 g_259 g_281 g_285 g_304
+ * writes: g_54 g_67 g_79 g_70.f2.f0 g_70.f6.f0 g_70.f6 g_60.f0 g_70.f5 g_141 g_125 g_203 g_217 g_70.f1 g_235 g_234 g_255 g_252 g_285 g_156
+ */
+static union U3 func_33(int8_t p_34, int16_t p_35, int32_t p_36)
+{ /* block id: 1 */
+ int8_t l_44 = (-8L);
+ int16_t *l_52 = (void*)0;
+ int16_t *l_53 = &g_54[7][8];
+ struct S1 *l_282 = (void*)0;
+ struct S1 **l_287 = &g_156[2][1][7];
+ struct S1 **l_288 = &l_282;
+ int32_t l_289[5] = {1L,1L,1L,1L,1L};
+ int32_t *l_290 = &g_285[0];
+ int32_t *l_291 = (void*)0;
+ int32_t *l_292 = &l_289[0];
+ int32_t *l_293 = &l_289[3];
+ int32_t *l_294 = (void*)0;
+ int32_t *l_295 = &g_285[0];
+ int32_t *l_296 = &g_285[0];
+ int32_t *l_297 = &l_289[3];
+ int32_t *l_298[1];
+ int32_t l_299 = (-1L);
+ int32_t l_300 = 0x460548ABL;
+ uint16_t l_301 = 0x1E4AL;
+ int i;
+ for (i = 0; i < 1; i++)
+ l_298[i] = (void*)0;
+ (*l_288) = ((*l_287) = func_39(l_44, g_8, func_45((safe_lshift_func_uint16_t_u_s((safe_div_func_int8_t_s_s(p_35, 0x53L)), ((*l_53) = g_8))), g_8), l_282));
+ l_301--;
+ return g_304;
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_285
+ * writes: g_285
+ */
+static struct S1 * func_39(int32_t p_40, uint16_t p_41, struct S1 * p_42, struct S1 * p_43)
+{ /* block id: 185 */
+ uint32_t l_283 = 0x3C929064L;
+ int32_t *l_284 = &g_285[0];
+ struct S1 *l_286 = (void*)0;
+ (*l_284) |= l_283;
+ return l_286;
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_54 g_60.f0 g_70 g_8 g_79 g_112 g_124 g_125 g_141 g_156 g_60.f2 g_203 g_217 g_235 g_255 g_258 g_252 g_259 g_281 g_67
+ * writes: g_67 g_79 g_70.f2.f0 g_70.f6.f0 g_70.f6 g_60.f0 g_70.f5 g_54 g_141 g_125 g_203 g_217 g_70.f1 g_235 g_234 g_255 g_252
+ */
+static struct S1 * func_45(int32_t p_46, uint32_t p_47)
+{ /* block id: 3 */
+ struct S0 *l_59 = &g_60;
+ struct S0 **l_82 = &l_59;
+ int32_t * const l_83 = &g_8;
+ int32_t *l_85 = &g_8;
+ int32_t **l_84 = &l_85;
+ uint16_t l_105 = 0x9B7AL;
+ int32_t l_107[8] = {0xA1CE40C6L,0xA1CE40C6L,0xA1CE40C6L,0xA1CE40C6L,0xA1CE40C6L,0xA1CE40C6L,0xA1CE40C6L,0xA1CE40C6L};
+ union U3 l_114 = {0xF1L};
+ struct S1 l_247[7][10][1] = {{{{0x1EL,184}},{{0x79L,135}},{{5UL,49}},{{0xA4L,104}},{{0x43L,70}},{{0x25L,42}},{{0x43L,70}},{{0xA4L,104}},{{5UL,49}},{{0x79L,135}}},{{{0x1EL,184}},{{0xA4L,104}},{{252UL,79}},{{0x25L,42}},{{252UL,79}},{{0xA4L,104}},{{0x1EL,184}},{{0x79L,135}},{{5UL,49}},{{0xA4L,104}}},{{{0x43L,70}},{{0x25L,42}},{{0x43L,70}},{{0xA4L,104}},{{5UL,49}},{{0x79L,135}},{{0x1EL,184}},{{0xA4L,104}},{{252UL,79}},{{0x25L,42}}},{{{252UL,79}},{{0xA4L,104}},{{0x1EL,184}},{{0x79L,135}},{{5UL,49}},{{0xA4L,104}},{{0x43L,70}},{{0x25L,42}},{{0x43L,70}},{{0xA4L,104}}},{{{5UL,49}},{{0x79L,135}},{{0x1EL,184}},{{0xA4L,104}},{{252UL,79}},{{0x25L,42}},{{252UL,79}},{{0xA4L,104}},{{0x1EL,184}},{{0x79L,135}}},{{{5UL,49}},{{0xA4L,104}},{{0x43L,70}},{{0x25L,42}},{{0x43L,70}},{{0xA4L,104}},{{5UL,49}},{{0x79L,135}},{{0x1EL,184}},{{0xA4L,104}}},{{{252UL,79}},{{0x25L,42}},{{252UL,79}},{{0xA4L,104}},{{0x1EL,184}},{{0x79L,135}},{{5UL,49}},{{0xA4L,104}},{{0x43L,70}},{{0x25L,42}}}};
+ int i, j, k;
+ (*l_82) = func_55((safe_unary_minus_func_uint8_t_u((l_59 != (void*)0))), &g_60);
+ (*l_84) = l_83;
+ if ((**l_84))
+ { /* block id: 12 */
+ uint16_t l_123[10][5];
+ int32_t l_126 = 0L;
+ int i, j;
+ for (i = 0; i < 10; i++)
+ {
+ for (j = 0; j < 5; j++)
+ l_123[i][j] = 0xDDF1L;
+ }
+ for (p_46 = (-1); (p_46 < (-18)); p_46 = safe_sub_func_int16_t_s_s(p_46, 8))
+ { /* block id: 15 */
+ uint32_t l_90 = 0xCF63D7CBL;
+ int32_t l_103 = 0xA8BA3176L;
+ const struct S0 *l_111[5][10] = {{&g_70.f2,&g_70.f2,&g_70.f0,&g_60,&g_70.f2,&g_70.f0,&g_70.f0,&g_60,&g_70.f2,&g_60},{&g_60,&g_60,&g_70.f2,&g_70.f2,&g_70.f2,&g_70.f2,&g_70.f2,&g_70.f0,&g_60,&g_70.f0},{&g_70.f0,&g_70.f0,&g_70.f2,&g_70.f2,&g_60,&g_70.f2,&g_60,&g_70.f2,&g_70.f0,&g_70.f2},{&g_70.f2,&g_70.f2,&g_70.f2,&g_60,&g_70.f0,&g_70.f2,&g_70.f0,&g_70.f2,&g_70.f2,&g_60},{&g_70.f2,&g_70.f2,&g_70.f2,&g_70.f0,&g_70.f2,&g_60,&g_70.f2,&g_70.f2,&g_70.f2,&g_70.f0}};
+ const struct S0 **l_110 = &l_111[2][5];
+ struct S1 l_116 = {0xCAL,42};
+ int i, j;
+ g_70.f2.f0 |= (safe_sub_func_uint32_t_u_u((0xE0L < (l_90 || g_70.f0.f0)), (-1L)));
+ if (((void*)0 == &g_54[7][8]))
+ { /* block id: 17 */
+ int32_t l_97[7][8][4] = {{{(-3L),(-3L),0xFED72739L,0x8FEE3948L},{(-4L),0xBC662C87L,(-1L),(-1L)},{(-1L),4L,4L,(-3L)},{4L,(-3L),0x2ABD0CEAL,0xD32418DFL},{0xBC662C87L,0x429AA74CL,0x429AA74CL,0x8FEE3948L},{1L,0xD32418DFL,(-1L),0xC6490BB3L},{0x8DDDCD3EL,0xAAA56D44L,(-3L),0x8FEE3948L},{1L,(-3L),(-10L),0xAAA56D44L}},{{0xC6490BB3L,1L,1L,0xFED72739L},{(-1L),0xA2B653F5L,(-3L),0xA2B653F5L},{0x8AADD0F3L,6L,0x8FEE3948L,0xBC662C87L},{1L,(-4L),0xBC662C87L,(-3L)},{0xFED72739L,0x0324A0BDL,0xBC662C87L,6L},{1L,0xFED72739L,0xC6490BB3L,1L},{1L,0x2ABD0CEAL,0xD32418DFL,0xD32418DFL},{4L,4L,(-3L),0x2ABD0CEAL}},{{0x2ABD0CEAL,(-1L),(-1L),(-1L)},{(-4L),0xFED72739L,0x7B59BB01L,4L},{(-1L),0x429AA74CL,0L,4L},{0x429AA74CL,(-4L),0xAAA56D44L,(-1L)},{(-10L),(-3L),0x0324A0BDL,0x8DDDCD3EL},{1L,0xA2B653F5L,1L,0x7B59BB01L},{0x429AA74CL,6L,0x429AA74CL,(-3L)},{0x7B59BB01L,(-3L),0xAAA56D44L,(-10L)}},{{0xBC662C87L,4L,0x7B59BB01L,(-4L)},{0xBC662C87L,0xD32418DFL,0xAAA56D44L,(-10L)},{0x8FEE3948L,0x0324A0BDL,(-3L),(-1L)},{(-3L),(-3L),(-3L),0xD32418DFL},{(-1L),0xD32418DFL,(-1L),0xBC662C87L},{(-1L),0xC6490BB3L,0x8FEE3948L,(-10L)},{0xAAA56D44L,0x2ABD0CEAL,(-1L),0x0324A0BDL},{0xA2B653F5L,0x2ABD0CEAL,0xBC662C87L,(-10L)}},{{0xD32418DFL,0xBC662C87L,0L,0x2ABD0CEAL},{0x0324A0BDL,0xAAA56D44L,0x429AA74CL,0x7B59BB01L},{1L,1L,0xC6490BB3L,1L},{(-4L),(-1L),(-10L),(-1L)},{0xD32418DFL,0x8FEE3948L,(-1L),0xD32418DFL},{0xAAA56D44L,0x8AADD0F3L,(-1L),(-1L)},{0xAAA56D44L,0x7B59BB01L,(-10L),0x429AA74CL},{0x429AA74CL,(-1L),0x2ABD0CEAL,0x2ABD0CEAL}},{{(-1L),(-1L),0xD32418DFL,(-1L)},{(-1L),(-3L),1L,0x8AADD0F3L},{0x8FEE3948L,0x7B59BB01L,6L,(-3L)},{1L,0x8FEE3948L,1L,(-3L)},{0xC6490BB3L,0x7B59BB01L,6L,1L},{0xA2B653F5L,0xD32418DFL,0x8AADD0F3L,4L},{(-4L),1L,0x429AA74CL,6L},{0xC6490BB3L,4L,0x8FEE3948L,0xD32418DFL}},{{0x8DDDCD3EL,0xC6490BB3L,6L,0L},{0x0324A0BDL,(-1L),0x8DDDCD3EL,0x8FEE3948L},{0x0324A0BDL,0x2ABD0CEAL,6L,0xA2B653F5L},{(-10L),0x8AADD0F3L,0xC6490BB3L,0x429AA74CL},{0xBC662C87L,(-3L),(-3L),0x2ABD0CEAL},{(-3L),0xBC662C87L,(-1L),(-1L)},{0x8AADD0F3L,0x0324A0BDL,(-10L),0xA2B653F5L},{0x2ABD0CEAL,(-1L),0x429AA74CL,0L}}};
+ uint16_t *l_102[8][9][3] = {{{(void*)0,&g_70.f3,&g_79},{&g_79,&g_70.f3,&g_70.f3},{&g_79,(void*)0,&g_70.f3},{&g_79,(void*)0,&g_70.f3},{&g_70.f3,(void*)0,&g_79},{(void*)0,&g_70.f3,&g_70.f3},{(void*)0,&g_70.f3,(void*)0},{&g_70.f3,(void*)0,&g_70.f3},{(void*)0,(void*)0,&g_79}},{{(void*)0,&g_70.f3,(void*)0},{(void*)0,(void*)0,&g_70.f3},{&g_79,&g_79,&g_70.f3},{&g_70.f3,(void*)0,&g_70.f3},{&g_79,&g_70.f3,(void*)0},{&g_79,&g_70.f3,&g_79},{&g_70.f3,&g_79,&g_70.f3},{&g_70.f3,&g_70.f3,&g_70.f3},{&g_70.f3,&g_70.f3,(void*)0}},{{&g_70.f3,&g_79,&g_79},{&g_70.f3,&g_70.f3,&g_79},{&g_79,&g_79,&g_79},{&g_79,&g_79,&g_79},{&g_79,&g_79,&g_70.f3},{(void*)0,&g_79,&g_79},{(void*)0,&g_79,(void*)0},{&g_70.f3,&g_79,&g_79},{&g_79,(void*)0,&g_70.f3}},{{(void*)0,&g_70.f3,&g_79},{&g_79,&g_79,&g_79},{&g_79,(void*)0,(void*)0},{&g_79,(void*)0,&g_79},{&g_79,(void*)0,&g_70.f3},{&g_79,(void*)0,&g_70.f3},{&g_70.f3,(void*)0,&g_79},{&g_79,&g_79,(void*)0},{&g_79,&g_70.f3,&g_79}},{{&g_79,&g_79,&g_79},{&g_70.f3,&g_70.f3,&g_70.f3},{(void*)0,(void*)0,&g_70.f3},{&g_79,(void*)0,&g_79},{&g_70.f3,&g_70.f3,&g_79},{(void*)0,&g_79,&g_70.f3},{&g_79,(void*)0,&g_79},{&g_70.f3,(void*)0,&g_79},{(void*)0,&g_79,&g_70.f3}},{{&g_70.f3,&g_70.f3,&g_70.f3},{&g_79,&g_70.f3,&g_70.f3},{&g_79,&g_79,&g_79},{&g_79,&g_70.f3,&g_79},{&g_79,&g_70.f3,&g_70.f3},{&g_79,&g_79,(void*)0},{&g_79,(void*)0,&g_79},{&g_79,&g_79,&g_79},{&g_70.f3,&g_79,(void*)0}},{{&g_70.f3,&g_70.f3,&g_70.f3},{(void*)0,(void*)0,&g_79},{&g_79,&g_79,&g_70.f3},{&g_79,(void*)0,(void*)0},{(void*)0,&g_79,(void*)0},{(void*)0,&g_70.f3,&g_70.f3},{&g_70.f3,&g_79,&g_70.f3},{(void*)0,&g_70.f3,&g_70.f3},{(void*)0,&g_79,&g_79}},{{&g_79,&g_70.f3,&g_79},{&g_79,(void*)0,&g_70.f3},{(void*)0,&g_79,(void*)0},{&g_79,(void*)0,(void*)0},{(void*)0,&g_70.f3,&g_79},{&g_79,&g_79,&g_70.f3},{&g_79,&g_79,&g_79},{&g_79,&g_79,(void*)0},{&g_79,(void*)0,&g_70.f3}}};
+ uint8_t *l_104 = &g_70.f6.f0;
+ int i, j, k;
+ g_70.f2.f0 ^= (safe_lshift_func_int16_t_s_s(p_46, p_46));
+ if (((0L & (safe_mul_func_int16_t_s_s((((*l_104) ^= ((safe_rshift_func_int8_t_s_s(((+p_46) , g_70.f0.f0), p_47)) < (0L && (l_97[2][3][1] ^ (p_47 < (safe_lshift_func_int16_t_s_s(((p_47 , (safe_mul_func_uint16_t_u_u((l_103 &= l_97[2][3][1]), p_47))) && (-8L)), 5))))))) , l_105), 0L))) , l_97[2][3][1]))
+ { /* block id: 21 */
+ int32_t *l_106[7] = {&l_103,&l_97[0][2][3],&l_97[0][2][3],&g_8,&l_103,&l_103,&l_97[0][2][3]};
+ int i;
+ l_107[5] = l_97[2][3][1];
+ }
+ else
+ { /* block id: 23 */
+ uint16_t l_115 = 1UL;
+ struct S1 *l_117 = &g_70.f6;
+ struct S1 *l_118 = &l_116;
+ int32_t l_128[4][4] = {{0xAE0EBF16L,1L,0xAE0EBF16L,1L},{0xAE0EBF16L,1L,0xAE0EBF16L,1L},{0xAE0EBF16L,1L,0xAE0EBF16L,1L},{0xAE0EBF16L,1L,0xAE0EBF16L,1L}};
+ int32_t *l_129 = (void*)0;
+ int32_t *l_130 = &l_128[2][3];
+ int32_t *l_131 = &l_126;
+ int32_t *l_132 = &l_97[3][6][0];
+ int32_t *l_133 = &l_126;
+ int32_t *l_134 = &l_107[5];
+ int32_t *l_135 = &l_97[5][3][3];
+ int32_t *l_136 = &l_128[2][3];
+ int32_t *l_137 = &l_126;
+ int32_t *l_138 = &l_126;
+ int32_t *l_139 = &l_103;
+ int32_t *l_140[5][10] = {{&l_107[6],&l_103,&g_8,&l_126,&l_103,&g_8,&l_126,(void*)0,&l_107[5],&g_8},{&l_107[5],&l_103,(void*)0,&l_103,&g_8,&l_97[2][3][1],&l_107[5],(void*)0,&l_126,&g_8},{&l_107[5],&l_126,&l_126,&l_107[5],(void*)0,&g_8,&g_8,&l_128[2][3],&l_103,&l_107[1]},{(void*)0,&l_107[5],(void*)0,(void*)0,(void*)0,&l_126,&g_8,&l_128[0][2],&l_107[5],&l_103},{&l_107[5],&g_8,(void*)0,&g_8,(void*)0,&l_126,&l_107[5],&l_126,(void*)0,&g_8}};
+ int i, j;
+ if ((g_70.f7 , (safe_mul_func_uint16_t_u_u(g_54[2][3], ((l_110 != g_112) && ((p_47 == (l_114 , (l_115 & (p_46 ^ ((((((*l_118) = ((*l_117) = l_116)) , g_70.f4) > g_70.f2.f2) , p_47) & 0xF1956382L))))) > l_115))))))
+ { /* block id: 26 */
+ int16_t *l_121[6] = {&g_54[7][8],&g_54[7][8],&g_54[7][8],&g_54[7][8],&g_54[7][8],&g_54[7][8]};
+ int16_t **l_120 = &l_121[4];
+ uint32_t *l_122 = &g_70.f5;
+ int i;
+ g_60.f0 |= (safe_unary_minus_func_uint16_t_u(p_47));
+ g_70.f2.f0 &= (((*l_120) = &g_54[7][8]) != &g_54[9][4]);
+ l_126 &= ((((*l_122) = (p_47 != (*l_85))) , ((**l_120) = ((((*l_104) = 0UL) > g_70.f7.f0) >= (l_123[6][1] != ((void*)0 == g_124))))) & p_46);
+ }
+ else
+ { /* block id: 34 */
+ int32_t *l_127[4] = {&l_97[2][3][1],&l_97[2][3][1],&l_97[2][3][1],&l_97[2][3][1]};
+ int i;
+ if ((**g_124))
+ break;
+ g_70.f2.f0 &= l_116.f1;
+ }
+ --g_141;
+ }
+ l_103 |= 0x9AB640BFL;
+ l_97[4][3][2] |= (g_8 >= ((p_47 >= (safe_mod_func_uint32_t_u_u(l_103, 8UL))) < p_47));
+ }
+ else
+ { /* block id: 42 */
+ int32_t l_149[4] = {0xBC5006F5L,0xBC5006F5L,0xBC5006F5L,0xBC5006F5L};
+ int i;
+ (*g_124) = (*g_124);
+ for (l_114.f2 = (-1); (l_114.f2 >= 24); ++l_114.f2)
+ { /* block id: 46 */
+ int32_t *l_148[5];
+ struct S1 *l_150 = (void*)0;
+ struct S1 *l_151 = &l_116;
+ int i;
+ for (i = 0; i < 5; i++)
+ l_148[i] = &l_107[5];
+ l_149[0] &= (g_60.f0 |= p_46);
+ (*l_151) = l_116;
+ for (g_141 = 0; (g_141 >= 36); ++g_141)
+ { /* block id: 52 */
+ if (p_47)
+ break;
+ (*l_151) = (g_70 , g_70.f6);
+ (*l_151) = g_70.f6;
+ }
+ }
+ for (l_105 = (-28); (l_105 != 42); l_105 = safe_add_func_uint32_t_u_u(l_105, 1))
+ { /* block id: 60 */
+ return g_156[2][1][7];
+ }
+ }
+ }
+ }
+ else
+ { /* block id: 65 */
+ uint32_t l_168 = 0UL;
+ int32_t l_174 = 8L;
+ int32_t l_206 = 0L;
+ int32_t l_215 = 0x8159E85BL;
+ uint16_t l_272 = 65534UL;
+ struct S0 *l_277 = &g_70.f2;
+ struct S2 l_280 = {{1515,507,0},0xA1E9C32DL,{1725,421,11},0xA2D4L,4294967293UL,4294967295UL,{0x17L,183},{209,374,19},0UL};
+lbl_268:
+ for (p_47 = (-26); (p_47 == 39); p_47++)
+ { /* block id: 68 */
+ int32_t *l_159 = &g_8;
+ int32_t l_162 = 0L;
+ struct S1 l_178 = {252UL,162};
+ int32_t l_214 = 0x89B60EE2L;
+ (*g_124) = ((*l_84) = l_159);
+ if (p_47)
+ { /* block id: 71 */
+ int8_t l_164 = (-10L);
+ for (g_70.f6.f0 = 0; (g_70.f6.f0 <= 3); g_70.f6.f0 += 1)
+ { /* block id: 74 */
+ if ((**g_124))
+ break;
+ for (p_46 = 3; (p_46 >= 0); p_46 -= 1)
+ { /* block id: 78 */
+ int32_t *l_160 = (void*)0;
+ int32_t *l_161 = &l_107[5];
+ if ((*g_125))
+ break;
+ (*l_161) |= (*g_125);
+ if ((*g_125))
+ continue;
+ }
+ l_162 &= (*l_159);
+ for (g_67 = 0; (g_67 <= 3); g_67 += 1)
+ { /* block id: 86 */
+ int32_t *l_163 = &l_107[5];
+ int32_t *l_165 = &l_162;
+ int32_t *l_166 = &l_107[5];
+ int32_t *l_167 = &l_162;
+ (*l_163) = 0x1E9C1B1BL;
+ l_168--;
+ }
+ }
+ }
+ else
+ { /* block id: 91 */
+ uint32_t l_175 = 4294967291UL;
+ struct S1 *l_183 = &g_70.f6;
+ uint8_t *l_184 = (void*)0;
+ int32_t l_193 = 0x0082912AL;
+ int32_t l_216 = 4L;
+ if ((*l_85))
+ { /* block id: 92 */
+ int32_t *l_171 = (void*)0;
+ int32_t *l_172 = &l_107[4];
+ int32_t *l_173[2][4];
+ struct S1 *l_179[8] = {&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6,&g_70.f6};
+ int i, j;
+ for (i = 0; i < 2; i++)
+ {
+ for (j = 0; j < 4; j++)
+ l_173[i][j] = &l_107[0];
+ }
+ l_175--;
+ if ((**g_124))
+ continue;
+ l_178 = l_178;
+ for (g_67 = 0; (g_67 < 1); g_67++)
+ { /* block id: 98 */
+ struct S1 *l_182 = &l_178;
+ return l_183;
+ }
+ }
+ else
+ { /* block id: 101 */
+ uint8_t **l_185 = (void*)0;
+ uint8_t **l_186 = &l_184;
+ int32_t l_197 = 0xDAA83F59L;
+ int32_t *l_198 = (void*)0;
+ int32_t *l_199 = &l_107[5];
+ int32_t *l_200 = &l_174;
+ int32_t *l_201 = &l_193;
+ int32_t *l_202[6][10][4] = {{{(void*)0,(void*)0,&l_197,(void*)0},{(void*)0,&l_107[7],&l_197,&l_107[4]},{&l_197,&l_193,&l_107[0],&l_174},{&l_193,(void*)0,&l_162,&l_197},{&l_197,&l_162,&l_193,&l_107[4]},{&l_174,&l_197,&l_174,&l_197},{&l_174,&l_193,&l_107[0],(void*)0},{&l_107[4],&l_107[5],&l_162,&l_174},{&l_107[5],&l_174,&l_107[5],&l_174},{&l_107[5],&l_107[5],(void*)0,&l_107[5]}},{{&l_107[5],(void*)0,(void*)0,&g_8},{&l_174,&g_8,(void*)0,(void*)0},{&l_107[5],&l_162,&l_193,(void*)0},{&l_107[5],&l_107[5],(void*)0,&g_8},{&l_107[4],&l_107[5],&l_174,&l_107[1]},{(void*)0,&l_193,&l_107[4],&l_197},{&g_8,&g_8,&l_197,&l_107[5]},{&l_193,&l_107[7],(void*)0,&l_107[5]},{&l_107[5],&l_162,&l_107[5],(void*)0},{&l_107[1],&l_107[5],&l_197,&l_197}},{{&l_193,(void*)0,(void*)0,&l_193},{&l_174,&l_107[4],&l_162,&l_107[5]},{&l_193,&l_107[5],&l_197,&l_174},{&l_107[5],&l_193,&l_193,&l_107[5]},{&l_107[5],&l_193,&l_197,&g_8},{&l_193,&l_193,&l_107[4],(void*)0},{&g_8,(void*)0,(void*)0,&g_8},{(void*)0,&l_197,&l_107[0],&l_107[4]},{&l_107[5],&l_174,(void*)0,&l_162},{&l_107[4],&l_197,&l_162,&l_193}},{{&l_107[5],&l_107[5],(void*)0,&l_107[7]},{(void*)0,&l_193,(void*)0,&l_193},{(void*)0,&l_162,&l_197,&l_107[5]},{&l_107[5],&l_193,&l_107[7],&l_193},{&l_193,(void*)0,&l_197,&l_197},{(void*)0,&l_162,&l_174,&l_162},{&l_174,&l_193,&l_174,&g_8},{&l_107[5],(void*)0,&l_107[4],&l_162},{&l_107[7],&l_193,&l_107[5],&l_107[4]},{&l_193,&l_193,&l_197,&l_162}},{{(void*)0,(void*)0,&l_107[5],&l_107[7]},{&l_197,(void*)0,&l_174,&l_107[5]},{(void*)0,&l_107[5],&l_107[5],&l_107[5]},{&l_193,&l_174,&l_107[5],&l_193},{&l_107[4],&l_107[5],&l_197,(void*)0},{&l_174,&l_197,&l_193,(void*)0},{&l_193,&l_162,&g_8,&l_193},{(void*)0,(void*)0,&l_193,&l_193},{&l_197,&l_193,&l_107[5],&l_107[4]},{&l_107[5],&l_174,&l_107[1],(void*)0}},{{&l_197,&l_107[5],&l_107[5],&l_193},{&l_107[4],&l_107[4],&l_197,&l_197},{&l_193,&l_193,&l_193,&l_107[0]},{&l_162,&g_8,&l_107[5],(void*)0},{&l_107[5],&l_162,&l_107[5],&l_193},{&l_193,&g_8,&l_193,&l_174},{&l_193,&l_197,&l_174,&g_8},{(void*)0,&l_193,&l_193,&g_8},{&l_107[5],(void*)0,&l_107[5],(void*)0},{&l_197,&l_193,&l_107[4],&l_197}}};
+ int i, j, k;
+ if (((((((*l_186) = l_184) == &g_67) && (safe_rshift_func_uint8_t_u_s(g_79, 6))) <= ((safe_mul_func_int16_t_s_s(p_46, (**l_84))) | (safe_rshift_func_uint16_t_u_s((&g_113 != &l_59), 14)))) <= g_60.f2))
+ { /* block id: 103 */
+ struct S2 **l_194 = (void*)0;
+ struct S2 *l_196 = &g_70;
+ struct S2 **l_195 = &l_196;
+ l_193 ^= (**g_124);
+ (*l_195) = &g_70;
+ (*g_124) = ((*l_84) = &l_162);
+ if (l_197)
+ break;
+ }
+ else
+ { /* block id: 109 */
+ if (l_197)
+ break;
+ (*g_124) = &l_162;
+ }
+ g_203[3]++;
+ }
+ if (p_47)
+ { /* block id: 115 */
+ if ((**l_84))
+ break;
+ }
+ else
+ { /* block id: 117 */
+ int32_t *l_207 = &l_193;
+ int32_t *l_208 = &l_193;
+ int32_t *l_209 = &l_193;
+ int32_t *l_210 = &l_107[5];
+ int32_t *l_211 = &l_162;
+ int32_t *l_212 = &l_107[1];
+ int32_t *l_213[6][4] = {{(void*)0,&l_107[2],(void*)0,&l_107[2]},{(void*)0,&l_107[2],(void*)0,&l_107[2]},{(void*)0,&l_107[2],(void*)0,&l_107[2]},{(void*)0,&l_107[2],(void*)0,&l_107[2]},{(void*)0,&l_107[2],(void*)0,&l_107[2]},{(void*)0,&l_107[2],(void*)0,&l_107[2]}};
+ int i, j;
+ l_206 |= (l_174 = (**g_124));
+ g_217[1]--;
+ }
+ }
+ for (l_168 = 0; (l_168 <= 15); l_168++)
+ { /* block id: 125 */
+ uint16_t l_227 = 65535UL;
+ for (g_141 = 25; (g_141 < 10); --g_141)
+ { /* block id: 128 */
+ uint32_t l_224[10] = {0x72F24C6DL,0x72F24C6DL,0x72F24C6DL,0x72F24C6DL,0x72F24C6DL,0x72F24C6DL,0x72F24C6DL,0x72F24C6DL,0x72F24C6DL,0x72F24C6DL};
+ int i;
+ --l_224[8];
+ l_227 = (-9L);
+ }
+ l_174 |= (*g_125);
+ }
+ }
+ for (g_70.f1 = 6; (g_70.f1 == 4); --g_70.f1)
+ { /* block id: 137 */
+ int32_t *l_230 = &l_206;
+ int32_t *l_231 = &l_215;
+ int32_t *l_232 = (void*)0;
+ int32_t *l_233[1];
+ struct S1 l_265 = {0UL,164};
+ int i;
+ for (i = 0; i < 1; i++)
+ l_233[i] = &l_174;
+ g_235--;
+ for (l_215 = 0; (l_215 <= (-16)); l_215--)
+ { /* block id: 141 */
+ struct S1 l_248[1][4][6] = {{{{9UL,284},{254UL,195},{9UL,284},{255UL,160},{9UL,284},{0x5BL,115}},{{0x72L,235},{0x79L,274},{255UL,160},{0x5BL,115},{0x5BL,115},{255UL,160}},{{254UL,195},{254UL,195},{254UL,155},{254UL,195},{0x79L,274},{254UL,195}},{{254UL,155},{254UL,155},{255UL,160},{0x79L,274},{0x72L,235},{0x72L,235}}}};
+ int32_t l_251 = 0x6C6B0ADAL;
+ int i, j, k;
+ for (g_70.f5 = 6; (g_70.f5 != 46); ++g_70.f5)
+ { /* block id: 144 */
+ int32_t *l_242 = (void*)0;
+ int32_t l_253[1][5][6] = {{{0xBA40BAC5L,0x923D8348L,0L,0x16EABE1CL,0x923D8348L,0x923D8348L},{0x923D8348L,0xB0590F93L,0x16EABE1CL,0xC21EBF77L,0L,0x6348B1DDL},{0x6348B1DDL,0xBA40BAC5L,0x923D8348L,0L,0x16EABE1CL,0x923D8348L},{0xC21EBF77L,0L,0xC21EBF77L,0xB0590F93L,0x6348B1DDL,0xBA40BAC5L},{0x6348B1DDL,0x923D8348L,0xB0590F93L,0xBA40BAC5L,0xBA40BAC5L,0xC21EBF77L}}};
+ int i, j, k;
+ for (l_105 = 0; (l_105 <= 9); l_105 += 1)
+ { /* block id: 147 */
+ int i;
+ (*g_124) = l_242;
+ (*l_230) ^= (safe_mul_func_int16_t_s_s((g_203[l_105] || 0L), (g_70.f5 < (p_46 == (safe_rshift_func_int8_t_s_s(p_46, 1))))));
+ }
+ for (g_234 = 0; (g_234 <= 3); g_234 += 1)
+ { /* block id: 153 */
+ l_248[0][1][0] = l_247[5][5][0];
+ }
+ if ((safe_lshift_func_uint8_t_u_u(p_47, 4)))
+ { /* block id: 156 */
+ struct S0 ***l_260 = &l_82;
+ g_255--;
+ l_174 &= (&g_113 != ((*l_260) = g_258));
+ }
+ else
+ { /* block id: 160 */
+ uint32_t l_261 = 0xCEF78231L;
+ ++l_261;
+ return g_156[1][6][3];
+ }
+ }
+ (*l_230) &= l_251;
+ if (p_46)
+ break;
+ if ((l_251 = (l_174 |= ((*l_230) = (g_70.f7.f1 <= p_46)))))
+ { /* block id: 170 */
+ const struct S1 l_264 = {250UL,40};
+ l_265 = l_264;
+ }
+ else
+ { /* block id: 172 */
+ uint16_t l_269 = 0xB5A1L;
+ for (g_252 = 0; (g_252 <= 7); ++g_252)
+ { /* block id: 175 */
+ if (l_105)
+ goto lbl_268;
+ if (l_269)
+ continue;
+ }
+ }
+ }
+ }
+ l_215 = (((safe_mod_func_int32_t_s_s(((l_272 >= (safe_mul_func_uint16_t_u_u((safe_div_func_int8_t_s_s((((l_168 | (l_277 != (*g_258))) ^ g_70.f2.f2) < (safe_add_func_int16_t_s_s((l_280 , ((p_46 <= ((((g_281 ^ ((void*)0 == &l_280)) , 0xF0L) != g_8) <= p_47)) < 1L)), p_46))), p_46)), (-7L)))) < l_280.f2.f0), p_47)) ^ 4294967290UL) & 1UL);
+ }
+ return g_156[2][1][7];
+}
+
+
+/* ------------------------------------------ */
+/*
+ * reads : g_54 g_60.f0 g_70 g_8 g_79
+ * writes: g_67 g_79
+ */
+static struct S0 * func_55(int16_t p_56, struct S0 * p_57)
+{ /* block id: 4 */
+ uint8_t *l_65 = (void*)0;
+ uint8_t *l_66 = &g_67;
+ int32_t l_73 = (-6L);
+ int32_t l_74 = 0x4EE4B4BCL;
+ int32_t l_75 = 1L;
+ int32_t *l_76 = &l_75;
+ int32_t *l_77 = &l_75;
+ int32_t *l_78[9][4] = {{&l_75,&l_73,&l_75,&l_75},{(void*)0,&l_75,&g_8,&g_8},{(void*)0,&l_75,(void*)0,&g_8},{&l_75,&l_73,&l_73,&g_8},{&g_8,&l_75,&g_8,&g_8},{&l_73,&l_73,&l_73,&g_8},{&l_75,&g_8,&l_75,&l_73},{&g_8,(void*)0,&l_75,(void*)0},{&l_75,&l_75,&g_8,&g_8}};
+ int i, j;
+ l_75 |= (((safe_sub_func_uint8_t_u_u(g_54[7][8], (safe_mod_func_uint8_t_u_u(((*l_66) = g_60.f0), (safe_mul_func_int8_t_s_s((p_56 , (((g_70 , (g_54[5][5] && (0L | g_70.f8))) , (safe_lshift_func_int8_t_s_s((l_73 >= (((l_74 = g_70.f6.f0) > l_73) >= l_73)), 4))) < l_73)), 5UL)))))) , g_8) & l_73);
+ --g_79;
+ return p_57;
+}
+
+
+
+
+/* ---------------------------------------- */
+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_8, "g_8", print_hash_value);
+ for (i = 0; i < 10; i++)
+ {
+ for (j = 0; j < 9; j++)
+ {
+ transparent_crc(g_54[i][j], "g_54[i][j]", print_hash_value);
+ if (print_hash_value) printf("index = [%d][%d]\n", i, j);
+
+ }
+ }
+ transparent_crc(g_60.f0, "g_60.f0", print_hash_value);
+ transparent_crc(g_60.f1, "g_60.f1", print_hash_value);
+ transparent_crc(g_60.f2, "g_60.f2", print_hash_value);
+ transparent_crc(g_67, "g_67", print_hash_value);
+ transparent_crc(g_70.f0.f0, "g_70.f0.f0", print_hash_value);
+ transparent_crc(g_70.f0.f1, "g_70.f0.f1", print_hash_value);
+ transparent_crc(g_70.f0.f2, "g_70.f0.f2", print_hash_value);
+ transparent_crc(g_70.f1, "g_70.f1", print_hash_value);
+ transparent_crc(g_70.f2.f0, "g_70.f2.f0", print_hash_value);
+ transparent_crc(g_70.f2.f1, "g_70.f2.f1", print_hash_value);
+ transparent_crc(g_70.f2.f2, "g_70.f2.f2", print_hash_value);
+ transparent_crc(g_70.f3, "g_70.f3", print_hash_value);
+ transparent_crc(g_70.f4, "g_70.f4", print_hash_value);
+ transparent_crc(g_70.f5, "g_70.f5", print_hash_value);
+ transparent_crc(g_70.f6.f0, "g_70.f6.f0", print_hash_value);
+ transparent_crc(g_70.f6.f1, "g_70.f6.f1", print_hash_value);
+ transparent_crc(g_70.f7.f0, "g_70.f7.f0", print_hash_value);
+ transparent_crc(g_70.f7.f1, "g_70.f7.f1", print_hash_value);
+ transparent_crc(g_70.f7.f2, "g_70.f7.f2", print_hash_value);
+ transparent_crc(g_70.f8, "g_70.f8", print_hash_value);
+ transparent_crc(g_79, "g_79", print_hash_value);
+ transparent_crc(g_141, "g_141", print_hash_value);
+ for (i = 0; i < 10; i++)
+ {
+ transparent_crc(g_203[i], "g_203[i]", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ for (i = 0; i < 5; i++)
+ {
+ transparent_crc(g_217[i], "g_217[i]", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ transparent_crc(g_234, "g_234", print_hash_value);
+ transparent_crc(g_235, "g_235", print_hash_value);
+ transparent_crc(g_252, "g_252", print_hash_value);
+ for (i = 0; i < 10; i++)
+ {
+ transparent_crc(g_254[i], "g_254[i]", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ transparent_crc(g_255, "g_255", print_hash_value);
+ transparent_crc(g_281, "g_281", print_hash_value);
+ for (i = 0; i < 7; i++)
+ {
+ transparent_crc(g_285[i], "g_285[i]", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ transparent_crc(g_304.f0, "g_304.f0", print_hash_value);
+ transparent_crc(g_304.f2, "g_304.f2", print_hash_value);
+ transparent_crc(g_304.f3, "g_304.f3", print_hash_value);
+ transparent_crc(g_351, "g_351", print_hash_value);
+ transparent_crc(g_361.f0, "g_361.f0", print_hash_value);
+ transparent_crc(g_361.f1, "g_361.f1", print_hash_value);
+ for (i = 0; i < 6; i++)
+ {
+ transparent_crc(g_371[i], "g_371[i]", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ for (i = 0; i < 7; i++)
+ {
+ transparent_crc(g_389[i], "g_389[i]", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ for (i = 0; i < 9; i++)
+ {
+ for (j = 0; j < 9; j++)
+ {
+ transparent_crc(g_397[i][j], "g_397[i][j]", print_hash_value);
+ if (print_hash_value) printf("index = [%d][%d]\n", i, j);
+
+ }
+ }
+ transparent_crc(g_449, "g_449", print_hash_value);
+ transparent_crc(g_524.f0, "g_524.f0", print_hash_value);
+ transparent_crc(g_524.f2, "g_524.f2", print_hash_value);
+ transparent_crc(g_524.f3, "g_524.f3", print_hash_value);
+ for (i = 0; i < 10; i++)
+ {
+ for (j = 0; j < 2; j++)
+ {
+ for (k = 0; k < 6; k++)
+ {
+ transparent_crc(g_621[i][j][k], "g_621[i][j][k]", print_hash_value);
+ if (print_hash_value) printf("index = [%d][%d][%d]\n", i, j, k);
+
+ }
+ }
+ }
+ for (i = 0; i < 6; i++)
+ {
+ transparent_crc(g_739[i], "g_739[i]", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ transparent_crc(g_745, "g_745", print_hash_value);
+ transparent_crc(g_747, "g_747", print_hash_value);
+ for (i = 0; i < 2; i++)
+ {
+ transparent_crc(g_829[i], "g_829[i]", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ for (i = 0; i < 9; i++)
+ {
+ for (j = 0; j < 5; j++)
+ {
+ for (k = 0; k < 1; k++)
+ {
+ transparent_crc(g_864[i][j][k], "g_864[i][j][k]", print_hash_value);
+ if (print_hash_value) printf("index = [%d][%d][%d]\n", i, j, k);
+
+ }
+ }
+ }
+ for (i = 0; i < 10; i++)
+ {
+ transparent_crc(g_873[i].f0.f0, "g_873[i].f0.f0", print_hash_value);
+ transparent_crc(g_873[i].f0.f1, "g_873[i].f0.f1", print_hash_value);
+ transparent_crc(g_873[i].f0.f2, "g_873[i].f0.f2", print_hash_value);
+ transparent_crc(g_873[i].f1, "g_873[i].f1", print_hash_value);
+ transparent_crc(g_873[i].f2.f0, "g_873[i].f2.f0", print_hash_value);
+ transparent_crc(g_873[i].f2.f1, "g_873[i].f2.f1", print_hash_value);
+ transparent_crc(g_873[i].f2.f2, "g_873[i].f2.f2", print_hash_value);
+ transparent_crc(g_873[i].f3, "g_873[i].f3", print_hash_value);
+ transparent_crc(g_873[i].f4, "g_873[i].f4", print_hash_value);
+ transparent_crc(g_873[i].f5, "g_873[i].f5", print_hash_value);
+ transparent_crc(g_873[i].f6.f0, "g_873[i].f6.f0", print_hash_value);
+ transparent_crc(g_873[i].f6.f1, "g_873[i].f6.f1", print_hash_value);
+ transparent_crc(g_873[i].f7.f0, "g_873[i].f7.f0", print_hash_value);
+ transparent_crc(g_873[i].f7.f1, "g_873[i].f7.f1", print_hash_value);
+ transparent_crc(g_873[i].f7.f2, "g_873[i].f7.f2", print_hash_value);
+ transparent_crc(g_873[i].f8, "g_873[i].f8", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ transparent_crc(g_921, "g_921", print_hash_value);
+ transparent_crc(g_973, "g_973", print_hash_value);
+ for (i = 0; i < 1; i++)
+ {
+ for (j = 0; j < 5; j++)
+ {
+ for (k = 0; k < 1; k++)
+ {
+ transparent_crc(g_987[i][j][k], "g_987[i][j][k]", print_hash_value);
+ if (print_hash_value) printf("index = [%d][%d][%d]\n", i, j, k);
+
+ }
+ }
+ }
+ transparent_crc(g_994.f0.f0, "g_994.f0.f0", print_hash_value);
+ transparent_crc(g_994.f0.f1, "g_994.f0.f1", print_hash_value);
+ transparent_crc(g_994.f0.f2, "g_994.f0.f2", print_hash_value);
+ transparent_crc(g_994.f1, "g_994.f1", print_hash_value);
+ transparent_crc(g_994.f2.f0, "g_994.f2.f0", print_hash_value);
+ transparent_crc(g_994.f2.f1, "g_994.f2.f1", print_hash_value);
+ transparent_crc(g_994.f2.f2, "g_994.f2.f2", print_hash_value);
+ transparent_crc(g_994.f3, "g_994.f3", print_hash_value);
+ transparent_crc(g_994.f4, "g_994.f4", print_hash_value);
+ transparent_crc(g_994.f5, "g_994.f5", print_hash_value);
+ transparent_crc(g_994.f6.f0, "g_994.f6.f0", print_hash_value);
+ transparent_crc(g_994.f6.f1, "g_994.f6.f1", print_hash_value);
+ transparent_crc(g_994.f7.f0, "g_994.f7.f0", print_hash_value);
+ transparent_crc(g_994.f7.f1, "g_994.f7.f1", print_hash_value);
+ transparent_crc(g_994.f7.f2, "g_994.f7.f2", print_hash_value);
+ transparent_crc(g_994.f8, "g_994.f8", print_hash_value);
+ for (i = 0; i < 4; i++)
+ {
+ transparent_crc(g_1120[i], "g_1120[i]", print_hash_value);
+ if (print_hash_value) printf("index = [%d]\n", i);
+
+ }
+ transparent_crc(g_1191, "g_1191", print_hash_value);
+ transparent_crc(g_1371, "g_1371", print_hash_value);
+ transparent_crc(g_1439.f0.f0, "g_1439.f0.f0", print_hash_value);
+ transparent_crc(g_1439.f0.f1, "g_1439.f0.f1", print_hash_value);
+ transparent_crc(g_1439.f0.f2, "g_1439.f0.f2", print_hash_value);
+ transparent_crc(g_1439.f1, "g_1439.f1", print_hash_value);
+ transparent_crc(g_1439.f2.f0, "g_1439.f2.f0", print_hash_value);
+ transparent_crc(g_1439.f2.f1, "g_1439.f2.f1", print_hash_value);
+ transparent_crc(g_1439.f2.f2, "g_1439.f2.f2", print_hash_value);
+ transparent_crc(g_1439.f3, "g_1439.f3", print_hash_value);
+ transparent_crc(g_1439.f4, "g_1439.f4", print_hash_value);
+ transparent_crc(g_1439.f5, "g_1439.f5", print_hash_value);
+ transparent_crc(g_1439.f6.f0, "g_1439.f6.f0", print_hash_value);
+ transparent_crc(g_1439.f6.f1, "g_1439.f6.f1", print_hash_value);
+ transparent_crc(g_1439.f7.f0, "g_1439.f7.f0", print_hash_value);
+ transparent_crc(g_1439.f7.f1, "g_1439.f7.f1", print_hash_value);
+ transparent_crc(g_1439.f7.f2, "g_1439.f7.f2", print_hash_value);
+ transparent_crc(g_1439.f8, "g_1439.f8", print_hash_value);
+ transparent_crc(g_1441, "g_1441", print_hash_value);
+ transparent_crc(g_1672.f0.f0, "g_1672.f0.f0", print_hash_value);
+ transparent_crc(g_1672.f0.f1, "g_1672.f0.f1", print_hash_value);
+ transparent_crc(g_1672.f0.f2, "g_1672.f0.f2", print_hash_value);
+ transparent_crc(g_1672.f1, "g_1672.f1", print_hash_value);
+ transparent_crc(g_1672.f2.f0, "g_1672.f2.f0", print_hash_value);
+ transparent_crc(g_1672.f2.f1, "g_1672.f2.f1", print_hash_value);
+ transparent_crc(g_1672.f2.f2, "g_1672.f2.f2", print_hash_value);
+ transparent_crc(g_1672.f3, "g_1672.f3", print_hash_value);
+ transparent_crc(g_1672.f4, "g_1672.f4", print_hash_value);
+ transparent_crc(g_1672.f5, "g_1672.f5", print_hash_value);
+ transparent_crc(g_1672.f6.f0, "g_1672.f6.f0", print_hash_value);
+ transparent_crc(g_1672.f6.f1, "g_1672.f6.f1", print_hash_value);
+ transparent_crc(g_1672.f7.f0, "g_1672.f7.f0", print_hash_value);
+ transparent_crc(g_1672.f7.f1, "g_1672.f7.f1", print_hash_value);
+ transparent_crc(g_1672.f7.f2, "g_1672.f7.f2", print_hash_value);
+ transparent_crc(g_1672.f8, "g_1672.f8", print_hash_value);
+ platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value);
+ return 0;
+}
+
+/************************ statistics *************************
+XXX max struct depth: 2
+breakdown:
+ depth: 0, occurrence: 514
+ depth: 1, occurrence: 51
+ depth: 2, occurrence: 8
+XXX total union variables: 51
+
+XXX non-zero bitfields defined in structs: 5
+XXX zero bitfields defined in structs: 0
+XXX const bitfields defined in structs: 1
+XXX volatile bitfields defined in structs: 0
+XXX structs with bitfields in the program: 167
+breakdown:
+ indirect level: 0, occurrence: 110
+ indirect level: 1, occurrence: 28
+ indirect level: 2, occurrence: 17
+ indirect level: 3, occurrence: 6
+ indirect level: 4, occurrence: 6
+XXX full-bitfields structs in the program: 22
+breakdown:
+ indirect level: 0, occurrence: 22
+XXX times a bitfields struct's address is taken: 128
+XXX times a bitfields struct on LHS: 26
+XXX times a bitfields struct on RHS: 257
+XXX times a single bitfield on LHS: 22
+XXX times a single bitfield on RHS: 141
+
+XXX max expression depth: 38
+breakdown:
+ depth: 1, occurrence: 395
+ depth: 2, occurrence: 99
+ depth: 3, occurrence: 7
+ depth: 4, occurrence: 7
+ depth: 5, occurrence: 6
+ depth: 6, occurrence: 3
+ depth: 7, occurrence: 2
+ depth: 8, occurrence: 3
+ depth: 11, occurrence: 4
+ depth: 12, occurrence: 3
+ depth: 13, occurrence: 1
+ depth: 14, occurrence: 2
+ depth: 15, occurrence: 5
+ depth: 16, occurrence: 3
+ depth: 17, occurrence: 5
+ depth: 18, occurrence: 2
+ depth: 19, occurrence: 3
+ depth: 20, occurrence: 2
+ depth: 21, occurrence: 2
+ depth: 23, occurrence: 4
+ depth: 24, occurrence: 1
+ depth: 25, occurrence: 3
+ depth: 26, occurrence: 1
+ depth: 27, occurrence: 2
+ depth: 30, occurrence: 3
+ depth: 37, occurrence: 1
+ depth: 38, occurrence: 1
+
+XXX total number of pointers: 473
+
+XXX times a variable address is taken: 1070
+XXX times a pointer is dereferenced on RHS: 207
+breakdown:
+ depth: 1, occurrence: 164
+ depth: 2, occurrence: 36
+ depth: 3, occurrence: 7
+XXX times a pointer is dereferenced on LHS: 256
+breakdown:
+ depth: 1, occurrence: 246
+ depth: 2, occurrence: 10
+XXX times a pointer is compared with null: 24
+XXX times a pointer is compared with address of another variable: 4
+XXX times a pointer is compared with another pointer: 11
+XXX times a pointer is qualified to be dereferenced: 6567
+
+XXX max dereference level: 4
+breakdown:
+ level: 0, occurrence: 0
+ level: 1, occurrence: 1418
+ level: 2, occurrence: 286
+ level: 3, occurrence: 49
+ level: 4, occurrence: 7
+XXX number of pointers point to pointers: 137
+XXX number of pointers point to scalars: 260
+XXX number of pointers point to structs: 53
+XXX percent of pointers has null in alias set: 27.5
+XXX average alias set size: 1.4
+
+XXX times a non-volatile is read: 1744
+XXX times a non-volatile is write: 819
+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: 5
+
+XXX stmts: 369
+XXX max block depth: 5
+breakdown:
+ depth: 0, occurrence: 33
+ depth: 1, occurrence: 33
+ depth: 2, occurrence: 52
+ depth: 3, occurrence: 52
+ depth: 4, occurrence: 88
+ depth: 5, occurrence: 111
+
+XXX percentage a fresh-made variable is used: 18.1
+XXX percentage an existing variable is used: 81.9
+FYI: the random generator makes assumptions about the integer size. See platform.info for more details.
+********************* end of statistics **********************/
+
diff --git a/tests/fuzz/8.c.txt b/tests/fuzz/8.c.txt
new file mode 100644
index 00000000..02f9ff4a
--- /dev/null
+++ b/tests/fuzz/8.c.txt
@@ -0,0 +1 @@
+checksum = 38B8E180
diff --git a/tests/fuzz/csmith_driver.py b/tests/fuzz/csmith_driver.py
index 3fa58db6..6c6965df 100755
--- a/tests/fuzz/csmith_driver.py
+++ b/tests/fuzz/csmith_driver.py
@@ -30,13 +30,15 @@ fails = 0
while 1:
print 'Tried %d, notes: %s' % (tried, notes)
- tried += 1
print '1) Generate C'
shared.execute([CSMITH, '--no-volatiles', '--no-math64', '--no-packed-struct'],# +
#['--max-block-depth', '2', '--max-block-size', '2', '--max-expr-complexity', '2', '--max-funcs', '2'],
stdout=open(filename + '.c', 'w'))
+ #shutil.copyfile(filename + '.c', 'testcase%d.c' % tried)
print '1) Generate C... %.2f K of C source' % (len(open(filename + '.c').read())/1024.)
+ tried += 1
+
print '2) Compile natively'
shared.try_delete(filename)
shared.execute([shared.CLANG_CC, '-O2', filename + '.c', '-o', filename + '1'] + CSMITH_CFLAGS, stderr=PIPE) # + shared.EMSDK_OPTS
@@ -46,11 +48,11 @@ while 1:
shared.execute([shared.CLANG_CC, filename + '.c', '-o', filename + '3'] + CSMITH_CFLAGS, stderr=PIPE)
print '3) Run natively'
try:
- correct1 = shared.timeout_run(Popen([filename + '1'], stdout=PIPE, stderr=PIPE), 5)
+ correct1 = shared.timeout_run(Popen([filename + '1'], stdout=PIPE, stderr=PIPE), 3)
if 'Segmentation fault' in correct1 or len(correct1) < 10: raise Exception('segfault')
- correct2 = shared.timeout_run(Popen([filename + '2'], stdout=PIPE, stderr=PIPE), 5)
+ correct2 = shared.timeout_run(Popen([filename + '2'], stdout=PIPE, stderr=PIPE), 3)
if 'Segmentation fault' in correct2 or len(correct2) < 10: raise Exception('segfault')
- correct3 = shared.timeout_run(Popen([filename + '3'], stdout=PIPE, stderr=PIPE), 5)
+ correct3 = shared.timeout_run(Popen([filename + '3'], stdout=PIPE, stderr=PIPE), 3)
if 'Segmentation fault' in correct3 or len(correct3) < 10: raise Exception('segfault')
if correct1 != correct3: raise Exception('clang opts change result')
except Exception, e:
@@ -82,6 +84,9 @@ while 1:
except Exception, e:
print e
normal = False
+ #open('testcase%d.js' % tried, 'w').write(
+ # open(filename + '.js').read().replace(' var ret = run();', ' var ret = run(["1"]);')
+ #)
if not ok:
print "EMSCRIPTEN BUG"
notes['embug'] += 1
diff --git a/tests/hello_libcxx_mod2.cpp b/tests/hello_libcxx_mod2.cpp
new file mode 100644
index 00000000..b18a523a
--- /dev/null
+++ b/tests/hello_libcxx_mod2.cpp
@@ -0,0 +1,10 @@
+#include <iostream>
+#include <emscripten.h>
+
+int main()
+{
+ std::cout << "hello, world!" << std::endl;
+ emscripten_jcache_printf("waka %d waka\n", 5);
+ return 0;
+}
+
diff --git a/tests/hello_libcxx_mod2a.cpp b/tests/hello_libcxx_mod2a.cpp
new file mode 100644
index 00000000..f48ad4fe
--- /dev/null
+++ b/tests/hello_libcxx_mod2a.cpp
@@ -0,0 +1,11 @@
+#include <iostream>
+#include <emscripten.h>
+
+int main()
+{
+ std::cout << "hello, world!" << std::endl;
+ emscripten_jcache_printf("waka %d waka\n", 5);
+ emscripten_jcache_printf("yet another printf %.2f %d\n", 5.5, 66);
+ return 0;
+}
+
diff --git a/tests/runner.py b/tests/runner.py
index 2515ef33..e631b025 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -3811,6 +3811,8 @@ The current type of b is: 9
''')
def test_structbyval(self):
+ Settings.INLINING_LIMIT = 50
+
# part 1: make sure that normally, passing structs by value works
src = r'''
@@ -5086,7 +5088,7 @@ at function.:blag
'''
self.do_run(src, '22 : me and myself 25 1.34\n21 waka 95\n')
- def test_perror(self):
+ def test_perrar(self):
src = r'''
#include <sys/types.h>
#include <sys/stat.h>
@@ -9749,6 +9751,23 @@ seeked= file.
if optimize_normally: del os.environ['EMCC_OPTIMIZE_NORMALLY']
del os.environ['EMCC_DEBUG']
+ def test_jcache_printf(self):
+ open(self.in_dir('src.cpp'), 'w').write(r'''
+ #include <stdio.h>
+ #include <stdint.h>
+ #include <emscripten.h>
+ int main() {
+ emscripten_jcache_printf("hello world\n");
+ emscripten_jcache_printf("hello %d world\n", 5);
+ emscripten_jcache_printf("hello %.3f world\n", 123.456789123);
+ emscripten_jcache_printf("hello %llx world\n", 0x1234567811223344ULL);
+ return 0;
+ }
+ ''')
+ Popen([PYTHON, EMCC, self.in_dir('src.cpp')]).communicate()
+ output = run_js('a.out.js')
+ self.assertIdentical('hello world\nhello 5 world\nhello 123.457 world\nhello 1234567811223300 world\n', output)
+
def test_conftest_s_flag_passing(self):
open(os.path.join(self.get_dir(), 'conftest.c'), 'w').write(r'''
int main() {
@@ -11924,6 +11943,8 @@ fi
try_delete(CANONICAL_TEMP_DIR)
def test_relooper(self):
+ RELOOPER = Cache.get_path('relooper.js')
+
restore()
for phase in range(2): # 0: we wipe the relooper dir. 1: we have it, so should just update
if phase == 0: Cache.erase()
@@ -11992,9 +12013,17 @@ fi
# finally, build a file close to the previous, to see that some chunks are found in the cache and some not
(['--jcache'], 'hello_libcxx_mod1.cpp', False, True, True, True, True, True, []), # win on pre, mix on funcs, mix on jsfuncs
(['--jcache'], 'hello_libcxx_mod1.cpp', False, True, False, True, False, True, []),
+ (None, None, None, None, None, None, None, None, None), # clear
+ (['--jcache'], 'hello_libcxx_mod2.cpp', True, False, True, False, True, False, []), # load into cache
+ (['--jcache'], 'hello_libcxx_mod2a.cpp', False, True, True, True, True, True, []) # add a printf, do not lose everything
]:
- print >> sys.stderr, args, input_file, expect_pre_save, expect_pre_load, expect_funcs_save, expect_funcs_load, expect_jsfuncs_save, expect_jsfuncs_load, expected
self.clear()
+ if args is None:
+ Cache.erase()
+ continue
+
+ print >> sys.stderr, args, input_file, expect_pre_save, expect_pre_load, expect_funcs_save, expect_funcs_load, expect_jsfuncs_save, expect_jsfuncs_load, expected
+
out, err = Popen([PYTHON, EMCC, '-O2', path_from_root('tests', input_file)] + args, stdout=PIPE, stderr=PIPE).communicate()
errtail = err.split('emcc invocation')[-1]
self.assertContained('hello, world!', run_js('a.out.js'), errtail)
diff --git a/third_party/jni/emjvm.cpp b/third_party/jni/emjvm.cpp
new file mode 100644
index 00000000..77ec3871
--- /dev/null
+++ b/third_party/jni/emjvm.cpp
@@ -0,0 +1,133 @@
+
+// Emscripten shims for JVM support
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#include "emjvm.h"
+
+// invoke interface
+
+jint DestroyJavaVM(JavaVM*) { exit(55); return NULL; }
+jint AttachCurrentThread(JavaVM*, JNIEnv**, void*) { exit(66); return NULL; }
+jint DetachCurrentThread(JavaVM*) { exit(77); return NULL; }
+jint GetEnv(JavaVM*, void** env, jint); // forward def
+jint AttachCurrentThreadAsDaemon(JavaVM*, JNIEnv**, void*) { exit(88); return NULL; }
+
+// env - some of these are externs that are implemented in JS
+
+jobject EMJVM_NewGlobalRef(JNIEnv*, jobject obj) {
+ return obj; // XXX no global refcounting, we just keep global singletons alive etc.
+}
+
+extern "C" {
+ extern jstring emjvm_newString(const jchar *chars, jsize len);
+}
+jstring EMJVM_NewString(JNIEnv*, const jchar* unicodeChars, jsize len) {
+ return emjvm_newString(unicodeChars, len);
+}
+
+extern "C" {
+ extern jclass emjvm_getObjectClass(JNIEnv*, jobject obj);
+}
+
+extern "C" {
+ extern jmethodID emjvm_getMethodID(jclass, const char*, const char*);
+}
+extern jmethodID EMJVM_GetMethodID(JNIEnv*, jclass clazz, const char* methodName, const char* sig) {
+ return emjvm_getMethodID(clazz, methodName, sig);
+}
+
+extern "C" {
+ extern jobject emjvm_callObjectMethod(JNIEnv*, jobject, jmethodID, va_list);
+
+ extern void emjvm_deleteLocalRef(JNIEnv*, jobject);
+
+ jsize emjvm_getArrayLength(JNIEnv*, jarray);
+
+ void emjvm_getByteArrayRegion(JNIEnv*, jbyteArray, jsize, jsize, jbyte*);
+
+ jclass emjvm_findClass(JNIEnv*, const char*);
+
+ jmethodID emjvm_getStaticMethodID(JNIEnv*, jclass, const char*, const char*);
+
+ jobject emjvm_callStaticObjectMethod(JNIEnv*, jclass, jmethodID, va_list);
+
+ jboolean emjvm_callBooleanMethod(JNIEnv*, jobject, jmethodID, va_list);
+ jboolean emjvm_callStaticBooleanMethod(JNIEnv*, jclass, jmethodID, va_list);
+
+ void emjvm_callVoidMethod(JNIEnv*, jobject, jmethodID, va_list);
+
+ jint emjvm_callIntMethod(JNIEnv*, jobject, jmethodID, va_list);
+
+ const char* emjvm_getStringUTFChars(JNIEnv*, jstring, jboolean*);
+ jsize emjvm_getStringUTFLength(JNIEnv*, jstring);
+ void emjvm_releaseStringUTFChars(JNIEnv*, jstring, const char*);
+}
+
+// JVM
+
+struct EmJVM {
+ JavaVM jvm;
+ JNIInvokeInterface jvmFunctions;
+
+ JNIEnv env;
+ JNINativeInterface envFunctions;
+
+ EmJVM() {
+ // jvm
+ jvm.functions = &jvmFunctions;
+
+ jvmFunctions.DestroyJavaVM = DestroyJavaVM;
+ jvmFunctions.AttachCurrentThread = AttachCurrentThread;
+ jvmFunctions.DetachCurrentThread = DetachCurrentThread;
+ jvmFunctions.GetEnv = GetEnv;
+ jvmFunctions.AttachCurrentThreadAsDaemon = AttachCurrentThreadAsDaemon;
+
+ // env
+ memset(&envFunctions, 0, sizeof(envFunctions));
+
+ env.functions = &envFunctions;
+
+ envFunctions.NewGlobalRef = EMJVM_NewGlobalRef;
+ envFunctions.NewString = EMJVM_NewString;
+ envFunctions.GetObjectClass = emjvm_getObjectClass;
+ envFunctions.GetMethodID = EMJVM_GetMethodID;
+ envFunctions.CallObjectMethodV = emjvm_callObjectMethod;
+ envFunctions.DeleteLocalRef = emjvm_deleteLocalRef;
+ envFunctions.GetArrayLength = emjvm_getArrayLength;
+ envFunctions.GetByteArrayRegion = emjvm_getByteArrayRegion;
+ envFunctions.FindClass = emjvm_findClass;
+ envFunctions.GetStaticMethodID = emjvm_getStaticMethodID;
+ envFunctions.CallStaticObjectMethodV = emjvm_callStaticObjectMethod;
+ envFunctions.CallBooleanMethodV = emjvm_callBooleanMethod;
+ envFunctions.CallStaticBooleanMethodV = emjvm_callStaticBooleanMethod;
+ envFunctions.CallVoidMethodV = emjvm_callVoidMethod;
+ envFunctions.CallIntMethodV = emjvm_callIntMethod;
+ envFunctions.GetStringUTFChars = emjvm_getStringUTFChars;
+ envFunctions.GetStringUTFLength = emjvm_getStringUTFLength;
+ envFunctions.ReleaseStringUTFChars = emjvm_releaseStringUTFChars;
+ }
+};
+
+EmJVM emJVM;
+
+// implement forward defs
+
+jint GetEnv(JavaVM*, void** env, jint) {
+ *env = &emJVM.env;
+ return 0;
+}
+
+// external access from JS
+
+extern "C" {
+
+JavaVM* emscripten_get_jvm() { return &emJVM.jvm; }
+
+JNIEnv* emscripten_get_jni_env() { return &emJVM.env; }
+
+}
+
diff --git a/third_party/jni/emjvm.h b/third_party/jni/emjvm.h
new file mode 100644
index 00000000..fb09413a
--- /dev/null
+++ b/third_party/jni/emjvm.h
@@ -0,0 +1,8 @@
+
+#include "jni.h"
+
+extern "C" {
+ extern JavaVM* emscripten_get_jvm();
+ extern JNIEnv* emscripten_get_jni_env();
+}
+
diff --git a/third_party/jni/emjvm.js b/third_party/jni/emjvm.js
new file mode 100644
index 00000000..e422d208
--- /dev/null
+++ b/third_party/jni/emjvm.js
@@ -0,0 +1,180 @@
+
+var EmJVM = {
+ debug: false,
+
+ nextId: 0,
+ objects: {},
+ classNames: {}, // class name => singleton object
+
+ addObject: function(o) {
+ var ret = EmJVM.nextId++;
+ EmJVM.objects[ret] = o;
+ o.id = ret;
+ o.refs = 1;
+ o.nextMethodId = 0;
+ // XXX Module.print('add object ' + JSON.stringify(o).substr(0, 80) + (ret > 5285 ? new Error().stack : ''));
+ return ret;
+ },
+
+ addSingletonObject: function(o) {
+ EmJVM.classNames[o.name] = o;
+ return EmJVM.addObject(o);
+ },
+
+ createString: function(data) {
+ return EmJVM.addObject({ name: 'string', value: data });
+ },
+
+ createByteArray: function(data) {
+ return EmJVM.addObject({ name: 'byteArray', value: data });
+ },
+};
+
+function widecharToString(ptr, len) {
+ var nullTerminated = typeof(len) == "undefined";
+ var ret = "";
+ var i = 0;
+ var t;
+ while (1) {
+ t = getValue(ptr + 2 * i, 'i16');
+ if (nullTerminated && t == 0) break;
+ if (t != 0) {
+ ret += String.fromCharCode(t);
+ }
+ ++i;
+ if (!nullTerminated && i == len) break;
+ };
+ return ret;
+}
+
+function _emjvm_newString(chars, len) {
+ return EmJVM.createString(widecharToString(chars, len));
+}
+
+function _emjvm_getStringUTFChars(jniEnv, string, isCopy) {
+ var obj = EmJVM.objects[string];
+ assert(obj.name == 'string');
+ if (isCopy) setValue(isCopy, 'i8', 1);
+ var buffer = _malloc(obj.value.length+1);
+ writeStringToMemory(obj.value, buffer);
+ return buffer;
+}
+
+function _emjvm_getStringUTFLength(jniEnv, string) {
+ var obj = EmJVM.objects[string];
+ if (obj.value) {
+ return obj.value.length;
+ }
+ return 0;
+}
+
+function _emjvm_releaseStringUTFChars(jniEnv, string, utf) {
+}
+
+function _emjvm_getObjectClass(env, jobject) {
+ if (EmJVM.debug) {
+ console.log('EMJVM_GetObjectClass+AddLocalRef: ' + [jobject]);
+ }
+ var obj = EmJVM.objects[jobject];
+ obj.refs++;
+ return jobject;
+}
+
+function _emjvm_getMethodID(jclass, name, sig) {
+ if (EmJVM.debug) {
+ console.log('EMJVM_GetMethodID: ' + [jclass, Pointer_stringify(name), Pointer_stringify(sig)]);
+ console.log('EMJVM_GetMethodID: ' + [EmJVM.objects[jclass].name]);
+ }
+ // assumes class <--> object, just called on singletons
+ name = Pointer_stringify(name);
+ var obj = EmJVM.objects[jclass];
+ if (!obj[name]) {
+ throw 'missing implementation for ' + obj.name + '::' + name + ' : ' + new Error().stack;
+ }
+ if (!obj[name + '__methodId']) {
+ var methodId = obj.nextMethodId++;
+ obj[name + '__methodId'] = methodId;
+ obj['method__' + methodId] = obj[name];
+ obj['methodName__' + methodId] = name;
+ }
+ return obj[name + '__methodId'];
+}
+
+function _emjvm_getStaticMethodID(jniEnv, jclass, name, sig) {
+ // Pretend this to be the same as looking up a non-static method
+ return _emjvm_getMethodID(jclass, name, sig);
+}
+
+function _emjvm_callObjectMethod(jniEnv, jobject, methodId, varargs) {
+ if (EmJVM.debug) {
+ console.log('EMJVM_CallObjectMethod: ' + [jobject, EmJVM.objects[jobject].name, methodId, EmJVM.objects[jobject]['methodName__' + methodId]]);
+ }
+ return EmJVM.objects[jobject]['method__' + methodId](varargs);
+}
+
+function _emjvm_callStaticObjectMethod(jniEnv, jclass, methodId, varargs) {
+ // Pretend this to be the same as calling a non-static method
+ return _emjvm_callObjectMethod(jniEnv, jclass, methodId, varargs);
+}
+
+function _emjvm_callStaticBooleanMethod(jniEnv, jclass, methodId, varargs) {
+ // Only differs in return type
+ return _emjvm_callStaticObjectMethod(jniEnv, jclass, methodId, varargs);
+}
+
+function _emjvm_callBooleanMethod(jniEnv, jobject, methodId, varargs) {
+ // Pretend this to be the same as calling a non-static method
+ return _emjvm_callStaticBooleanMethod(jniEnv, jobject, methodId, varargs);
+}
+
+function _emjvm_callVoidMethod(jniEnv, jobject, methodId, varargs) {
+ _emjvm_callObjectMethod(jniEnv, jobject, methodId, varargs);
+}
+
+function _emjvm_callIntMethod(jniEnv, jobject, methodId, varargs) {
+ return _emjvm_callObjectMethod(jniEnv, jobject, methodId, varargs);
+}
+
+function _emjvm_deleteLocalRef(jniEnv, jobject) {
+ if (EmJVM.debug) {
+ console.log('EMJVM_DeleteLocalRef: ' + [jobject]);
+ }
+ var obj = EmJVM.objects[jobject];
+ obj.refs--;
+ if (obj.refs == 0) {
+ if (EmJVM.debug) {
+ console.log('EMJVM_DeleteLocalRef: remove ' + obj.name);
+ }
+ delete EmJVM.objects[jobject];
+ }
+}
+
+function _emjvm_getArrayLength(jniEnv, jobject) {
+ var obj = EmJVM.objects[jobject];
+ assert(obj.name == 'byteArray');
+ return obj.value.length;
+}
+
+function _emjvm_getByteArrayRegion(jniEnv, jobject, start, len, buf) {
+ var obj = EmJVM.objects[jobject];
+ assert(obj.name == 'byteArray');
+ assert(obj.value); // we set this to null below and assume we are never called again
+ if (EmJVM.debug) {
+ console.log('emjvm_getByteArrayRegion: ' + [jobject, obj.value.length, start, len, buf]);
+ }
+ assert(start + len <= obj.value.length);
+ assert(len == obj.value.length); // we assume users read it all, and we can now copy it all with set() and then free it
+ HEAPU8.set(obj.value, buf);
+ obj.value = null; // XXX assume byte arrays are one-shot
+}
+
+function _emjvm_findClass(env, name) {
+ name = Pointer_stringify(name);
+ if (EmJVM.debug) {
+ console.log('emjvm_findClass: ' + [name]);
+ }
+ var obj = EmJVM.classNames[name];
+ assert(obj);
+ return obj.id;
+}
+
diff --git a/third_party/jni/jni.h b/third_party/jni/jni.h
new file mode 100644
index 00000000..b425dd42
--- /dev/null
+++ b/third_party/jni/jni.h
@@ -0,0 +1,1154 @@
+/*
+* Copyright (C) 2006 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+/*
+ * JNI specification, as defined by Sun:
+ * http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/jniTOC.html
+ *
+ * Everything here is expected to be VM-neutral.
+ */
+#ifndef _JNI_H
+#define _JNI_H
+
+#include <stdarg.h>
+
+/*
+ * Primitive types that match up with Java equivalents.
+ */
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h> /* C99 */
+typedef uint8_t jboolean; /* unsigned 8 bits */
+typedef int8_t jbyte; /* signed 8 bits */
+typedef uint16_t jchar; /* unsigned 16 bits */
+typedef int16_t jshort; /* signed 16 bits */
+typedef int32_t jint; /* signed 32 bits */
+typedef int64_t jlong; /* signed 64 bits */
+typedef float jfloat; /* 32-bit IEEE 754 */
+typedef double jdouble; /* 64-bit IEEE 754 */
+#else
+typedef unsigned char jboolean; /* unsigned 8 bits */
+typedef signed char jbyte; /* signed 8 bits */
+typedef unsigned short jchar; /* unsigned 16 bits */
+typedef short jshort; /* signed 16 bits */
+typedef int jint; /* signed 32 bits */
+typedef long long jlong; /* signed 64 bits */
+typedef float jfloat; /* 32-bit IEEE 754 */
+typedef double jdouble; /* 64-bit IEEE 754 */
+#endif
+
+/* "cardinal indices and sizes" */
+typedef jint jsize;
+
+#ifdef __cplusplus
+/*
+ * Reference types, in C++
+ */
+class _jobject {};
+class _jclass : public _jobject {};
+class _jstring : public _jobject {};
+class _jarray : public _jobject {};
+class _jobjectArray : public _jarray {};
+class _jbooleanArray : public _jarray {};
+class _jbyteArray : public _jarray {};
+class _jcharArray : public _jarray {};
+class _jshortArray : public _jarray {};
+class _jintArray : public _jarray {};
+class _jlongArray : public _jarray {};
+class _jfloatArray : public _jarray {};
+class _jdoubleArray : public _jarray {};
+class _jthrowable : public _jobject {};
+
+typedef _jobject* jobject;
+typedef _jclass* jclass;
+typedef _jstring* jstring;
+typedef _jarray* jarray;
+typedef _jobjectArray* jobjectArray;
+typedef _jbooleanArray* jbooleanArray;
+typedef _jbyteArray* jbyteArray;
+typedef _jcharArray* jcharArray;
+typedef _jshortArray* jshortArray;
+typedef _jintArray* jintArray;
+typedef _jlongArray* jlongArray;
+typedef _jfloatArray* jfloatArray;
+typedef _jdoubleArray* jdoubleArray;
+typedef _jthrowable* jthrowable;
+typedef _jobject* jweak;
+
+
+#else /* not __cplusplus */
+
+/*
+ * Reference types, in C.
+ */
+typedef void* jobject;
+typedef jobject jclass;
+typedef jobject jstring;
+typedef jobject jarray;
+typedef jarray jobjectArray;
+typedef jarray jbooleanArray;
+typedef jarray jbyteArray;
+typedef jarray jcharArray;
+typedef jarray jshortArray;
+typedef jarray jintArray;
+typedef jarray jlongArray;
+typedef jarray jfloatArray;
+typedef jarray jdoubleArray;
+typedef jobject jthrowable;
+typedef jobject jweak;
+
+#endif /* not __cplusplus */
+
+struct _jfieldID; /* opaque structure */
+typedef struct _jfieldID* jfieldID; /* field IDs */
+
+struct _jmethodID; /* opaque structure */
+typedef struct _jmethodID* jmethodID; /* method IDs */
+
+struct JNIInvokeInterface;
+
+typedef union jvalue {
+ jboolean z;
+ jbyte b;
+ jchar c;
+ jshort s;
+ jint i;
+ jlong j;
+ jfloat f;
+ jdouble d;
+ jobject l;
+} jvalue;
+
+typedef enum jobjectRefType {
+ JNIInvalidRefType = 0,
+ JNILocalRefType = 1,
+ JNIGlobalRefType = 2,
+ JNIWeakGlobalRefType = 3
+} jobjectRefType;
+
+typedef struct {
+ const char* name;
+ const char* signature;
+ void* fnPtr;
+} JNINativeMethod;
+
+struct _JNIEnv;
+struct _JavaVM;
+typedef const struct JNINativeInterface* C_JNIEnv;
+
+#if defined(__cplusplus)
+typedef _JNIEnv JNIEnv;
+typedef _JavaVM JavaVM;
+#else
+typedef const struct JNINativeInterface* JNIEnv;
+typedef const struct JNIInvokeInterface* JavaVM;
+#endif
+
+/*
+ * Table of interface function pointers.
+ */
+struct JNINativeInterface {
+ void* reserved0;
+ void* reserved1;
+ void* reserved2;
+ void* reserved3;
+
+ jint (*GetVersion)(JNIEnv *);
+
+ jclass (*DefineClass)(JNIEnv*, const char*, jobject, const jbyte*,
+ jsize);
+ jclass (*FindClass)(JNIEnv*, const char*);
+
+ jmethodID (*FromReflectedMethod)(JNIEnv*, jobject);
+ jfieldID (*FromReflectedField)(JNIEnv*, jobject);
+ /* spec doesn't show jboolean parameter */
+ jobject (*ToReflectedMethod)(JNIEnv*, jclass, jmethodID, jboolean);
+
+ jclass (*GetSuperclass)(JNIEnv*, jclass);
+ jboolean (*IsAssignableFrom)(JNIEnv*, jclass, jclass);
+
+ /* spec doesn't show jboolean parameter */
+ jobject (*ToReflectedField)(JNIEnv*, jclass, jfieldID, jboolean);
+
+ jint (*Throw)(JNIEnv*, jthrowable);
+ jint (*ThrowNew)(JNIEnv *, jclass, const char *);
+ jthrowable (*ExceptionOccurred)(JNIEnv*);
+ void (*ExceptionDescribe)(JNIEnv*);
+ void (*ExceptionClear)(JNIEnv*);
+ void (*FatalError)(JNIEnv*, const char*);
+
+ jint (*PushLocalFrame)(JNIEnv*, jint);
+ jobject (*PopLocalFrame)(JNIEnv*, jobject);
+
+ jobject (*NewGlobalRef)(JNIEnv*, jobject);
+ void (*DeleteGlobalRef)(JNIEnv*, jobject);
+ void (*DeleteLocalRef)(JNIEnv*, jobject);
+ jboolean (*IsSameObject)(JNIEnv*, jobject, jobject);
+
+ jobject (*NewLocalRef)(JNIEnv*, jobject);
+ jint (*EnsureLocalCapacity)(JNIEnv*, jint);
+
+ jobject (*AllocObject)(JNIEnv*, jclass);
+ jobject (*NewObject)(JNIEnv*, jclass, jmethodID, ...);
+ jobject (*NewObjectV)(JNIEnv*, jclass, jmethodID, va_list);
+ jobject (*NewObjectA)(JNIEnv*, jclass, jmethodID, jvalue*);
+
+ jclass (*GetObjectClass)(JNIEnv*, jobject);
+ jboolean (*IsInstanceOf)(JNIEnv*, jobject, jclass);
+ jmethodID (*GetMethodID)(JNIEnv*, jclass, const char*, const char*);
+
+ jobject (*CallObjectMethod)(JNIEnv*, jobject, jmethodID, ...);
+ jobject (*CallObjectMethodV)(JNIEnv*, jobject, jmethodID, va_list);
+ jobject (*CallObjectMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
+ jboolean (*CallBooleanMethod)(JNIEnv*, jobject, jmethodID, ...);
+ jboolean (*CallBooleanMethodV)(JNIEnv*, jobject, jmethodID, va_list);
+ jboolean (*CallBooleanMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
+ jbyte (*CallByteMethod)(JNIEnv*, jobject, jmethodID, ...);
+ jbyte (*CallByteMethodV)(JNIEnv*, jobject, jmethodID, va_list);
+ jbyte (*CallByteMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
+ jchar (*CallCharMethod)(JNIEnv*, jobject, jmethodID, ...);
+ jchar (*CallCharMethodV)(JNIEnv*, jobject, jmethodID, va_list);
+ jchar (*CallCharMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
+ jshort (*CallShortMethod)(JNIEnv*, jobject, jmethodID, ...);
+ jshort (*CallShortMethodV)(JNIEnv*, jobject, jmethodID, va_list);
+ jshort (*CallShortMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
+ jint (*CallIntMethod)(JNIEnv*, jobject, jmethodID, ...);
+ jint (*CallIntMethodV)(JNIEnv*, jobject, jmethodID, va_list);
+ jint (*CallIntMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
+ jlong (*CallLongMethod)(JNIEnv*, jobject, jmethodID, ...);
+ jlong (*CallLongMethodV)(JNIEnv*, jobject, jmethodID, va_list);
+ jlong (*CallLongMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
+ jfloat (*CallFloatMethod)(JNIEnv*, jobject, jmethodID, ...);
+ jfloat (*CallFloatMethodV)(JNIEnv*, jobject, jmethodID, va_list);
+ jfloat (*CallFloatMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
+ jdouble (*CallDoubleMethod)(JNIEnv*, jobject, jmethodID, ...);
+ jdouble (*CallDoubleMethodV)(JNIEnv*, jobject, jmethodID, va_list);
+ jdouble (*CallDoubleMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
+ void (*CallVoidMethod)(JNIEnv*, jobject, jmethodID, ...);
+ void (*CallVoidMethodV)(JNIEnv*, jobject, jmethodID, va_list);
+ void (*CallVoidMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);
+
+ jobject (*CallNonvirtualObjectMethod)(JNIEnv*, jobject, jclass,
+ jmethodID, ...);
+ jobject (*CallNonvirtualObjectMethodV)(JNIEnv*, jobject, jclass,
+ jmethodID, va_list);
+ jobject (*CallNonvirtualObjectMethodA)(JNIEnv*, jobject, jclass,
+ jmethodID, jvalue*);
+ jboolean (*CallNonvirtualBooleanMethod)(JNIEnv*, jobject, jclass,
+ jmethodID, ...);
+ jboolean (*CallNonvirtualBooleanMethodV)(JNIEnv*, jobject, jclass,
+ jmethodID, va_list);
+ jboolean (*CallNonvirtualBooleanMethodA)(JNIEnv*, jobject, jclass,
+ jmethodID, jvalue*);
+ jbyte (*CallNonvirtualByteMethod)(JNIEnv*, jobject, jclass,
+ jmethodID, ...);
+ jbyte (*CallNonvirtualByteMethodV)(JNIEnv*, jobject, jclass,
+ jmethodID, va_list);
+ jbyte (*CallNonvirtualByteMethodA)(JNIEnv*, jobject, jclass,
+ jmethodID, jvalue*);
+ jchar (*CallNonvirtualCharMethod)(JNIEnv*, jobject, jclass,
+ jmethodID, ...);
+ jchar (*CallNonvirtualCharMethodV)(JNIEnv*, jobject, jclass,
+ jmethodID, va_list);
+ jchar (*CallNonvirtualCharMethodA)(JNIEnv*, jobject, jclass,
+ jmethodID, jvalue*);
+ jshort (*CallNonvirtualShortMethod)(JNIEnv*, jobject, jclass,
+ jmethodID, ...);
+ jshort (*CallNonvirtualShortMethodV)(JNIEnv*, jobject, jclass,
+ jmethodID, va_list);
+ jshort (*CallNonvirtualShortMethodA)(JNIEnv*, jobject, jclass,
+ jmethodID, jvalue*);
+ jint (*CallNonvirtualIntMethod)(JNIEnv*, jobject, jclass,
+ jmethodID, ...);
+ jint (*CallNonvirtualIntMethodV)(JNIEnv*, jobject, jclass,
+ jmethodID, va_list);
+ jint (*CallNonvirtualIntMethodA)(JNIEnv*, jobject, jclass,
+ jmethodID, jvalue*);
+ jlong (*CallNonvirtualLongMethod)(JNIEnv*, jobject, jclass,
+ jmethodID, ...);
+ jlong (*CallNonvirtualLongMethodV)(JNIEnv*, jobject, jclass,
+ jmethodID, va_list);
+ jlong (*CallNonvirtualLongMethodA)(JNIEnv*, jobject, jclass,
+ jmethodID, jvalue*);
+ jfloat (*CallNonvirtualFloatMethod)(JNIEnv*, jobject, jclass,
+ jmethodID, ...);
+ jfloat (*CallNonvirtualFloatMethodV)(JNIEnv*, jobject, jclass,
+ jmethodID, va_list);
+ jfloat (*CallNonvirtualFloatMethodA)(JNIEnv*, jobject, jclass,
+ jmethodID, jvalue*);
+ jdouble (*CallNonvirtualDoubleMethod)(JNIEnv*, jobject, jclass,
+ jmethodID, ...);
+ jdouble (*CallNonvirtualDoubleMethodV)(JNIEnv*, jobject, jclass,
+ jmethodID, va_list);
+ jdouble (*CallNonvirtualDoubleMethodA)(JNIEnv*, jobject, jclass,
+ jmethodID, jvalue*);
+ void (*CallNonvirtualVoidMethod)(JNIEnv*, jobject, jclass,
+ jmethodID, ...);
+ void (*CallNonvirtualVoidMethodV)(JNIEnv*, jobject, jclass,
+ jmethodID, va_list);
+ void (*CallNonvirtualVoidMethodA)(JNIEnv*, jobject, jclass,
+ jmethodID, jvalue*);
+
+ jfieldID (*GetFieldID)(JNIEnv*, jclass, const char*, const char*);
+
+ jobject (*GetObjectField)(JNIEnv*, jobject, jfieldID);
+ jboolean (*GetBooleanField)(JNIEnv*, jobject, jfieldID);
+ jbyte (*GetByteField)(JNIEnv*, jobject, jfieldID);
+ jchar (*GetCharField)(JNIEnv*, jobject, jfieldID);
+ jshort (*GetShortField)(JNIEnv*, jobject, jfieldID);
+ jint (*GetIntField)(JNIEnv*, jobject, jfieldID);
+ jlong (*GetLongField)(JNIEnv*, jobject, jfieldID);
+ jfloat (*GetFloatField)(JNIEnv*, jobject, jfieldID);
+ jdouble (*GetDoubleField)(JNIEnv*, jobject, jfieldID);
+
+ void (*SetObjectField)(JNIEnv*, jobject, jfieldID, jobject);
+ void (*SetBooleanField)(JNIEnv*, jobject, jfieldID, jboolean);
+ void (*SetByteField)(JNIEnv*, jobject, jfieldID, jbyte);
+ void (*SetCharField)(JNIEnv*, jobject, jfieldID, jchar);
+ void (*SetShortField)(JNIEnv*, jobject, jfieldID, jshort);
+ void (*SetIntField)(JNIEnv*, jobject, jfieldID, jint);
+ void (*SetLongField)(JNIEnv*, jobject, jfieldID, jlong);
+ void (*SetFloatField)(JNIEnv*, jobject, jfieldID, jfloat);
+ void (*SetDoubleField)(JNIEnv*, jobject, jfieldID, jdouble);
+
+ jmethodID (*GetStaticMethodID)(JNIEnv*, jclass, const char*, const char*);
+
+ jobject (*CallStaticObjectMethod)(JNIEnv*, jclass, jmethodID, ...);
+ jobject (*CallStaticObjectMethodV)(JNIEnv*, jclass, jmethodID, va_list);
+ jobject (*CallStaticObjectMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);
+ jboolean (*CallStaticBooleanMethod)(JNIEnv*, jclass, jmethodID, ...);
+ jboolean (*CallStaticBooleanMethodV)(JNIEnv*, jclass, jmethodID,
+ va_list);
+ jboolean (*CallStaticBooleanMethodA)(JNIEnv*, jclass, jmethodID,
+ jvalue*);
+ jbyte (*CallStaticByteMethod)(JNIEnv*, jclass, jmethodID, ...);
+ jbyte (*CallStaticByteMethodV)(JNIEnv*, jclass, jmethodID, va_list);
+ jbyte (*CallStaticByteMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);
+ jchar (*CallStaticCharMethod)(JNIEnv*, jclass, jmethodID, ...);
+ jchar (*CallStaticCharMethodV)(JNIEnv*, jclass, jmethodID, va_list);
+ jchar (*CallStaticCharMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);
+ jshort (*CallStaticShortMethod)(JNIEnv*, jclass, jmethodID, ...);
+ jshort (*CallStaticShortMethodV)(JNIEnv*, jclass, jmethodID, va_list);
+ jshort (*CallStaticShortMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);
+ jint (*CallStaticIntMethod)(JNIEnv*, jclass, jmethodID, ...);
+ jint (*CallStaticIntMethodV)(JNIEnv*, jclass, jmethodID, va_list);
+ jint (*CallStaticIntMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);
+ jlong (*CallStaticLongMethod)(JNIEnv*, jclass, jmethodID, ...);
+ jlong (*CallStaticLongMethodV)(JNIEnv*, jclass, jmethodID, va_list);
+ jlong (*CallStaticLongMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);
+ jfloat (*CallStaticFloatMethod)(JNIEnv*, jclass, jmethodID, ...);
+ jfloat (*CallStaticFloatMethodV)(JNIEnv*, jclass, jmethodID, va_list);
+ jfloat (*CallStaticFloatMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);
+ jdouble (*CallStaticDoubleMethod)(JNIEnv*, jclass, jmethodID, ...);
+ jdouble (*CallStaticDoubleMethodV)(JNIEnv*, jclass, jmethodID, va_list);
+ jdouble (*CallStaticDoubleMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);
+ void (*CallStaticVoidMethod)(JNIEnv*, jclass, jmethodID, ...);
+ void (*CallStaticVoidMethodV)(JNIEnv*, jclass, jmethodID, va_list);
+ void (*CallStaticVoidMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);
+
+ jfieldID (*GetStaticFieldID)(JNIEnv*, jclass, const char*,
+ const char*);
+
+ jobject (*GetStaticObjectField)(JNIEnv*, jclass, jfieldID);
+ jboolean (*GetStaticBooleanField)(JNIEnv*, jclass, jfieldID);
+ jbyte (*GetStaticByteField)(JNIEnv*, jclass, jfieldID);
+ jchar (*GetStaticCharField)(JNIEnv*, jclass, jfieldID);
+ jshort (*GetStaticShortField)(JNIEnv*, jclass, jfieldID);
+ jint (*GetStaticIntField)(JNIEnv*, jclass, jfieldID);
+ jlong (*GetStaticLongField)(JNIEnv*, jclass, jfieldID);
+ jfloat (*GetStaticFloatField)(JNIEnv*, jclass, jfieldID);
+ jdouble (*GetStaticDoubleField)(JNIEnv*, jclass, jfieldID);
+
+ void (*SetStaticObjectField)(JNIEnv*, jclass, jfieldID, jobject);
+ void (*SetStaticBooleanField)(JNIEnv*, jclass, jfieldID, jboolean);
+ void (*SetStaticByteField)(JNIEnv*, jclass, jfieldID, jbyte);
+ void (*SetStaticCharField)(JNIEnv*, jclass, jfieldID, jchar);
+ void (*SetStaticShortField)(JNIEnv*, jclass, jfieldID, jshort);
+ void (*SetStaticIntField)(JNIEnv*, jclass, jfieldID, jint);
+ void (*SetStaticLongField)(JNIEnv*, jclass, jfieldID, jlong);
+ void (*SetStaticFloatField)(JNIEnv*, jclass, jfieldID, jfloat);
+ void (*SetStaticDoubleField)(JNIEnv*, jclass, jfieldID, jdouble);
+
+ jstring (*NewString)(JNIEnv*, const jchar*, jsize);
+ jsize (*GetStringLength)(JNIEnv*, jstring);
+ const jchar* (*GetStringChars)(JNIEnv*, jstring, jboolean*);
+ void (*ReleaseStringChars)(JNIEnv*, jstring, const jchar*);
+ jstring (*NewStringUTF)(JNIEnv*, const char*);
+ jsize (*GetStringUTFLength)(JNIEnv*, jstring);
+ /* JNI spec says this returns const jbyte*, but that's inconsistent */
+ const char* (*GetStringUTFChars)(JNIEnv*, jstring, jboolean*);
+ void (*ReleaseStringUTFChars)(JNIEnv*, jstring, const char*);
+ jsize (*GetArrayLength)(JNIEnv*, jarray);
+ jobjectArray (*NewObjectArray)(JNIEnv*, jsize, jclass, jobject);
+ jobject (*GetObjectArrayElement)(JNIEnv*, jobjectArray, jsize);
+ void (*SetObjectArrayElement)(JNIEnv*, jobjectArray, jsize, jobject);
+
+ jbooleanArray (*NewBooleanArray)(JNIEnv*, jsize);
+ jbyteArray (*NewByteArray)(JNIEnv*, jsize);
+ jcharArray (*NewCharArray)(JNIEnv*, jsize);
+ jshortArray (*NewShortArray)(JNIEnv*, jsize);
+ jintArray (*NewIntArray)(JNIEnv*, jsize);
+ jlongArray (*NewLongArray)(JNIEnv*, jsize);
+ jfloatArray (*NewFloatArray)(JNIEnv*, jsize);
+ jdoubleArray (*NewDoubleArray)(JNIEnv*, jsize);
+
+ jboolean* (*GetBooleanArrayElements)(JNIEnv*, jbooleanArray, jboolean*);
+ jbyte* (*GetByteArrayElements)(JNIEnv*, jbyteArray, jboolean*);
+ jchar* (*GetCharArrayElements)(JNIEnv*, jcharArray, jboolean*);
+ jshort* (*GetShortArrayElements)(JNIEnv*, jshortArray, jboolean*);
+ jint* (*GetIntArrayElements)(JNIEnv*, jintArray, jboolean*);
+ jlong* (*GetLongArrayElements)(JNIEnv*, jlongArray, jboolean*);
+ jfloat* (*GetFloatArrayElements)(JNIEnv*, jfloatArray, jboolean*);
+ jdouble* (*GetDoubleArrayElements)(JNIEnv*, jdoubleArray, jboolean*);
+
+ void (*ReleaseBooleanArrayElements)(JNIEnv*, jbooleanArray,
+ jboolean*, jint);
+ void (*ReleaseByteArrayElements)(JNIEnv*, jbyteArray,
+ jbyte*, jint);
+ void (*ReleaseCharArrayElements)(JNIEnv*, jcharArray,
+ jchar*, jint);
+ void (*ReleaseShortArrayElements)(JNIEnv*, jshortArray,
+ jshort*, jint);
+ void (*ReleaseIntArrayElements)(JNIEnv*, jintArray,
+ jint*, jint);
+ void (*ReleaseLongArrayElements)(JNIEnv*, jlongArray,
+ jlong*, jint);
+ void (*ReleaseFloatArrayElements)(JNIEnv*, jfloatArray,
+ jfloat*, jint);
+ void (*ReleaseDoubleArrayElements)(JNIEnv*, jdoubleArray,
+ jdouble*, jint);
+
+ void (*GetBooleanArrayRegion)(JNIEnv*, jbooleanArray,
+ jsize, jsize, jboolean*);
+ void (*GetByteArrayRegion)(JNIEnv*, jbyteArray,
+ jsize, jsize, jbyte*);
+ void (*GetCharArrayRegion)(JNIEnv*, jcharArray,
+ jsize, jsize, jchar*);
+ void (*GetShortArrayRegion)(JNIEnv*, jshortArray,
+ jsize, jsize, jshort*);
+ void (*GetIntArrayRegion)(JNIEnv*, jintArray,
+ jsize, jsize, jint*);
+ void (*GetLongArrayRegion)(JNIEnv*, jlongArray,
+ jsize, jsize, jlong*);
+ void (*GetFloatArrayRegion)(JNIEnv*, jfloatArray,
+ jsize, jsize, jfloat*);
+ void (*GetDoubleArrayRegion)(JNIEnv*, jdoubleArray,
+ jsize, jsize, jdouble*);
+
+ /* spec shows these without const; some jni.h do, some don't */
+ void (*SetBooleanArrayRegion)(JNIEnv*, jbooleanArray,
+ jsize, jsize, const jboolean*);
+ void (*SetByteArrayRegion)(JNIEnv*, jbyteArray,
+ jsize, jsize, const jbyte*);
+ void (*SetCharArrayRegion)(JNIEnv*, jcharArray,
+ jsize, jsize, const jchar*);
+ void (*SetShortArrayRegion)(JNIEnv*, jshortArray,
+ jsize, jsize, const jshort*);
+ void (*SetIntArrayRegion)(JNIEnv*, jintArray,
+ jsize, jsize, const jint*);
+ void (*SetLongArrayRegion)(JNIEnv*, jlongArray,
+ jsize, jsize, const jlong*);
+ void (*SetFloatArrayRegion)(JNIEnv*, jfloatArray,
+ jsize, jsize, const jfloat*);
+ void (*SetDoubleArrayRegion)(JNIEnv*, jdoubleArray,
+ jsize, jsize, const jdouble*);
+
+ jint (*RegisterNatives)(JNIEnv*, jclass, const JNINativeMethod*,
+ jint);
+ jint (*UnregisterNatives)(JNIEnv*, jclass);
+ jint (*MonitorEnter)(JNIEnv*, jobject);
+ jint (*MonitorExit)(JNIEnv*, jobject);
+ jint (*GetJavaVM)(JNIEnv*, JavaVM**);
+
+ void (*GetStringRegion)(JNIEnv*, jstring, jsize, jsize, jchar*);
+ void (*GetStringUTFRegion)(JNIEnv*, jstring, jsize, jsize, char*);
+
+ void* (*GetPrimitiveArrayCritical)(JNIEnv*, jarray, jboolean*);
+ void (*ReleasePrimitiveArrayCritical)(JNIEnv*, jarray, void*, jint);
+
+ const jchar* (*GetStringCritical)(JNIEnv*, jstring, jboolean*);
+ void (*ReleaseStringCritical)(JNIEnv*, jstring, const jchar*);
+
+ jweak (*NewWeakGlobalRef)(JNIEnv*, jobject);
+ void (*DeleteWeakGlobalRef)(JNIEnv*, jweak);
+
+ jboolean (*ExceptionCheck)(JNIEnv*);
+
+ jobject (*NewDirectByteBuffer)(JNIEnv*, void*, jlong);
+ void* (*GetDirectBufferAddress)(JNIEnv*, jobject);
+ jlong (*GetDirectBufferCapacity)(JNIEnv*, jobject);
+
+ /* added in JNI 1.6 */
+ jobjectRefType (*GetObjectRefType)(JNIEnv*, jobject);
+};
+
+/*
+ * C++ object wrapper.
+ *
+ * This is usually overlaid on a C struct whose first element is a
+ * JNINativeInterface*. We rely somewhat on compiler behavior.
+ */
+struct _JNIEnv {
+ /* do not rename this; it does not seem to be entirely opaque */
+ const struct JNINativeInterface* functions;
+
+#if defined(__cplusplus)
+
+ jint GetVersion()
+ { return functions->GetVersion(this); }
+
+ jclass DefineClass(const char *name, jobject loader, const jbyte* buf,
+ jsize bufLen)
+ { return functions->DefineClass(this, name, loader, buf, bufLen); }
+
+ jclass FindClass(const char* name)
+ { return functions->FindClass(this, name); }
+
+ jmethodID FromReflectedMethod(jobject method)
+ { return functions->FromReflectedMethod(this, method); }
+
+ jfieldID FromReflectedField(jobject field)
+ { return functions->FromReflectedField(this, field); }
+
+ jobject ToReflectedMethod(jclass cls, jmethodID methodID, jboolean isStatic)
+ { return functions->ToReflectedMethod(this, cls, methodID, isStatic); }
+
+ jclass GetSuperclass(jclass clazz)
+ { return functions->GetSuperclass(this, clazz); }
+
+ jboolean IsAssignableFrom(jclass clazz1, jclass clazz2)
+ { return functions->IsAssignableFrom(this, clazz1, clazz2); }
+
+ jobject ToReflectedField(jclass cls, jfieldID fieldID, jboolean isStatic)
+ { return functions->ToReflectedField(this, cls, fieldID, isStatic); }
+
+ jint Throw(jthrowable obj)
+ { return functions->Throw(this, obj); }
+
+ jint ThrowNew(jclass clazz, const char* message)
+ { return functions->ThrowNew(this, clazz, message); }
+
+ jthrowable ExceptionOccurred()
+ { return functions->ExceptionOccurred(this); }
+
+ void ExceptionDescribe()
+ { functions->ExceptionDescribe(this); }
+
+ void ExceptionClear()
+ { functions->ExceptionClear(this); }
+
+ void FatalError(const char* msg)
+ { functions->FatalError(this, msg); }
+
+ jint PushLocalFrame(jint capacity)
+ { return functions->PushLocalFrame(this, capacity); }
+
+ jobject PopLocalFrame(jobject result)
+ { return functions->PopLocalFrame(this, result); }
+
+ jobject NewGlobalRef(jobject obj)
+ { return functions->NewGlobalRef(this, obj); }
+
+ void DeleteGlobalRef(jobject globalRef)
+ { functions->DeleteGlobalRef(this, globalRef); }
+
+ void DeleteLocalRef(jobject localRef)
+ { functions->DeleteLocalRef(this, localRef); }
+
+ jboolean IsSameObject(jobject ref1, jobject ref2)
+ { return functions->IsSameObject(this, ref1, ref2); }
+
+ jobject NewLocalRef(jobject ref)
+ { return functions->NewLocalRef(this, ref); }
+
+ jint EnsureLocalCapacity(jint capacity)
+ { return functions->EnsureLocalCapacity(this, capacity); }
+
+ jobject AllocObject(jclass clazz)
+ { return functions->AllocObject(this, clazz); }
+
+ jobject NewObject(jclass clazz, jmethodID methodID, ...)
+ {
+ va_list args;
+ va_start(args, methodID);
+ jobject result = functions->NewObjectV(this, clazz, methodID, args);
+ va_end(args);
+ return result;
+ }
+
+ jobject NewObjectV(jclass clazz, jmethodID methodID, va_list args)
+ { return functions->NewObjectV(this, clazz, methodID, args); }
+
+ jobject NewObjectA(jclass clazz, jmethodID methodID, jvalue* args)
+ { return functions->NewObjectA(this, clazz, methodID, args); }
+
+ jclass GetObjectClass(jobject obj)
+ { return functions->GetObjectClass(this, obj); }
+
+ jboolean IsInstanceOf(jobject obj, jclass clazz)
+ { return functions->IsInstanceOf(this, obj, clazz); }
+
+ jmethodID GetMethodID(jclass clazz, const char* name, const char* sig)
+ { return functions->GetMethodID(this, clazz, name, sig); }
+
+#define CALL_TYPE_METHOD(_jtype, _jname) \
+ _jtype Call##_jname##Method(jobject obj, jmethodID methodID, ...) \
+ { \
+ _jtype result; \
+ va_list args; \
+ va_start(args, methodID); \
+ result = functions->Call##_jname##MethodV(this, obj, methodID, \
+ args); \
+ va_end(args); \
+ return result; \
+ }
+#define CALL_TYPE_METHODV(_jtype, _jname) \
+ _jtype Call##_jname##MethodV(jobject obj, jmethodID methodID, \
+ va_list args) \
+ { return functions->Call##_jname##MethodV(this, obj, methodID, args); }
+#define CALL_TYPE_METHODA(_jtype, _jname) \
+ _jtype Call##_jname##MethodA(jobject obj, jmethodID methodID, \
+ jvalue* args) \
+ { return functions->Call##_jname##MethodA(this, obj, methodID, args); }
+
+#define CALL_TYPE(_jtype, _jname) \
+ CALL_TYPE_METHOD(_jtype, _jname) \
+ CALL_TYPE_METHODV(_jtype, _jname) \
+ CALL_TYPE_METHODA(_jtype, _jname)
+
+ CALL_TYPE(jobject, Object)
+ CALL_TYPE(jboolean, Boolean)
+ CALL_TYPE(jbyte, Byte)
+ CALL_TYPE(jchar, Char)
+ CALL_TYPE(jshort, Short)
+ CALL_TYPE(jint, Int)
+ CALL_TYPE(jlong, Long)
+ CALL_TYPE(jfloat, Float)
+ CALL_TYPE(jdouble, Double)
+
+ void CallVoidMethod(jobject obj, jmethodID methodID, ...)
+ {
+ va_list args;
+ va_start(args, methodID);
+ functions->CallVoidMethodV(this, obj, methodID, args);
+ va_end(args);
+ }
+ void CallVoidMethodV(jobject obj, jmethodID methodID, va_list args)
+ { functions->CallVoidMethodV(this, obj, methodID, args); }
+ void CallVoidMethodA(jobject obj, jmethodID methodID, jvalue* args)
+ { functions->CallVoidMethodA(this, obj, methodID, args); }
+
+#define CALL_NONVIRT_TYPE_METHOD(_jtype, _jname) \
+ _jtype CallNonvirtual##_jname##Method(jobject obj, jclass clazz, \
+ jmethodID methodID, ...) \
+ { \
+ _jtype result; \
+ va_list args; \
+ va_start(args, methodID); \
+ result = functions->CallNonvirtual##_jname##MethodV(this, obj, \
+ clazz, methodID, args); \
+ va_end(args); \
+ return result; \
+ }
+#define CALL_NONVIRT_TYPE_METHODV(_jtype, _jname) \
+ _jtype CallNonvirtual##_jname##MethodV(jobject obj, jclass clazz, \
+ jmethodID methodID, va_list args) \
+ { return functions->CallNonvirtual##_jname##MethodV(this, obj, clazz, \
+ methodID, args); }
+#define CALL_NONVIRT_TYPE_METHODA(_jtype, _jname) \
+ _jtype CallNonvirtual##_jname##MethodA(jobject obj, jclass clazz, \
+ jmethodID methodID, jvalue* args) \
+ { return functions->CallNonvirtual##_jname##MethodA(this, obj, clazz, \
+ methodID, args); }
+
+#define CALL_NONVIRT_TYPE(_jtype, _jname) \
+ CALL_NONVIRT_TYPE_METHOD(_jtype, _jname) \
+ CALL_NONVIRT_TYPE_METHODV(_jtype, _jname) \
+ CALL_NONVIRT_TYPE_METHODA(_jtype, _jname)
+
+ CALL_NONVIRT_TYPE(jobject, Object)
+ CALL_NONVIRT_TYPE(jboolean, Boolean)
+ CALL_NONVIRT_TYPE(jbyte, Byte)
+ CALL_NONVIRT_TYPE(jchar, Char)
+ CALL_NONVIRT_TYPE(jshort, Short)
+ CALL_NONVIRT_TYPE(jint, Int)
+ CALL_NONVIRT_TYPE(jlong, Long)
+ CALL_NONVIRT_TYPE(jfloat, Float)
+ CALL_NONVIRT_TYPE(jdouble, Double)
+
+ void CallNonvirtualVoidMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...)
+ {
+ va_list args;
+ va_start(args, methodID);
+ functions->CallNonvirtualVoidMethodV(this, obj, clazz, methodID, args);
+ va_end(args);
+ }
+ void CallNonvirtualVoidMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args)
+ { functions->CallNonvirtualVoidMethodV(this, obj, clazz, methodID, args); }
+ void CallNonvirtualVoidMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, jvalue* args)
+ { functions->CallNonvirtualVoidMethodA(this, obj, clazz, methodID, args); }
+
+ jfieldID GetFieldID(jclass clazz, const char* name, const char* sig)
+ { return functions->GetFieldID(this, clazz, name, sig); }
+
+ jobject GetObjectField(jobject obj, jfieldID fieldID)
+ { return functions->GetObjectField(this, obj, fieldID); }
+ jboolean GetBooleanField(jobject obj, jfieldID fieldID)
+ { return functions->GetBooleanField(this, obj, fieldID); }
+ jbyte GetByteField(jobject obj, jfieldID fieldID)
+ { return functions->GetByteField(this, obj, fieldID); }
+ jchar GetCharField(jobject obj, jfieldID fieldID)
+ { return functions->GetCharField(this, obj, fieldID); }
+ jshort GetShortField(jobject obj, jfieldID fieldID)
+ { return functions->GetShortField(this, obj, fieldID); }
+ jint GetIntField(jobject obj, jfieldID fieldID)
+ { return functions->GetIntField(this, obj, fieldID); }
+ jlong GetLongField(jobject obj, jfieldID fieldID)
+ { return functions->GetLongField(this, obj, fieldID); }
+ jfloat GetFloatField(jobject obj, jfieldID fieldID)
+ { return functions->GetFloatField(this, obj, fieldID); }
+ jdouble GetDoubleField(jobject obj, jfieldID fieldID)
+ { return functions->GetDoubleField(this, obj, fieldID); }
+
+ void SetObjectField(jobject obj, jfieldID fieldID, jobject value)
+ { functions->SetObjectField(this, obj, fieldID, value); }
+ void SetBooleanField(jobject obj, jfieldID fieldID, jboolean value)
+ { functions->SetBooleanField(this, obj, fieldID, value); }
+ void SetByteField(jobject obj, jfieldID fieldID, jbyte value)
+ { functions->SetByteField(this, obj, fieldID, value); }
+ void SetCharField(jobject obj, jfieldID fieldID, jchar value)
+ { functions->SetCharField(this, obj, fieldID, value); }
+ void SetShortField(jobject obj, jfieldID fieldID, jshort value)
+ { functions->SetShortField(this, obj, fieldID, value); }
+ void SetIntField(jobject obj, jfieldID fieldID, jint value)
+ { functions->SetIntField(this, obj, fieldID, value); }
+ void SetLongField(jobject obj, jfieldID fieldID, jlong value)
+ { functions->SetLongField(this, obj, fieldID, value); }
+ void SetFloatField(jobject obj, jfieldID fieldID, jfloat value)
+ { functions->SetFloatField(this, obj, fieldID, value); }
+ void SetDoubleField(jobject obj, jfieldID fieldID, jdouble value)
+ { functions->SetDoubleField(this, obj, fieldID, value); }
+
+ jmethodID GetStaticMethodID(jclass clazz, const char* name, const char* sig)
+ { return functions->GetStaticMethodID(this, clazz, name, sig); }
+
+#define CALL_STATIC_TYPE_METHOD(_jtype, _jname) \
+ _jtype CallStatic##_jname##Method(jclass clazz, jmethodID methodID, \
+ ...) \
+ { \
+ _jtype result; \
+ va_list args; \
+ va_start(args, methodID); \
+ result = functions->CallStatic##_jname##MethodV(this, clazz, \
+ methodID, args); \
+ va_end(args); \
+ return result; \
+ }
+#define CALL_STATIC_TYPE_METHODV(_jtype, _jname) \
+ _jtype CallStatic##_jname##MethodV(jclass clazz, jmethodID methodID, \
+ va_list args) \
+ { return functions->CallStatic##_jname##MethodV(this, clazz, methodID, \
+ args); }
+#define CALL_STATIC_TYPE_METHODA(_jtype, _jname) \
+ _jtype CallStatic##_jname##MethodA(jclass clazz, jmethodID methodID, \
+ jvalue* args) \
+ { return functions->CallStatic##_jname##MethodA(this, clazz, methodID, \
+ args); }
+
+#define CALL_STATIC_TYPE(_jtype, _jname) \
+ CALL_STATIC_TYPE_METHOD(_jtype, _jname) \
+ CALL_STATIC_TYPE_METHODV(_jtype, _jname) \
+ CALL_STATIC_TYPE_METHODA(_jtype, _jname)
+
+ CALL_STATIC_TYPE(jobject, Object)
+ CALL_STATIC_TYPE(jboolean, Boolean)
+ CALL_STATIC_TYPE(jbyte, Byte)
+ CALL_STATIC_TYPE(jchar, Char)
+ CALL_STATIC_TYPE(jshort, Short)
+ CALL_STATIC_TYPE(jint, Int)
+ CALL_STATIC_TYPE(jlong, Long)
+ CALL_STATIC_TYPE(jfloat, Float)
+ CALL_STATIC_TYPE(jdouble, Double)
+
+ void CallStaticVoidMethod(jclass clazz, jmethodID methodID, ...)
+ {
+ va_list args;
+ va_start(args, methodID);
+ functions->CallStaticVoidMethodV(this, clazz, methodID, args);
+ va_end(args);
+ }
+ void CallStaticVoidMethodV(jclass clazz, jmethodID methodID, va_list args)
+ { functions->CallStaticVoidMethodV(this, clazz, methodID, args); }
+ void CallStaticVoidMethodA(jclass clazz, jmethodID methodID, jvalue* args)
+ { functions->CallStaticVoidMethodA(this, clazz, methodID, args); }
+
+ jfieldID GetStaticFieldID(jclass clazz, const char* name, const char* sig)
+ { return functions->GetStaticFieldID(this, clazz, name, sig); }
+
+ jobject GetStaticObjectField(jclass clazz, jfieldID fieldID)
+ { return functions->GetStaticObjectField(this, clazz, fieldID); }
+ jboolean GetStaticBooleanField(jclass clazz, jfieldID fieldID)
+ { return functions->GetStaticBooleanField(this, clazz, fieldID); }
+ jbyte GetStaticByteField(jclass clazz, jfieldID fieldID)
+ { return functions->GetStaticByteField(this, clazz, fieldID); }
+ jchar GetStaticCharField(jclass clazz, jfieldID fieldID)
+ { return functions->GetStaticCharField(this, clazz, fieldID); }
+ jshort GetStaticShortField(jclass clazz, jfieldID fieldID)
+ { return functions->GetStaticShortField(this, clazz, fieldID); }
+ jint GetStaticIntField(jclass clazz, jfieldID fieldID)
+ { return functions->GetStaticIntField(this, clazz, fieldID); }
+ jlong GetStaticLongField(jclass clazz, jfieldID fieldID)
+ { return functions->GetStaticLongField(this, clazz, fieldID); }
+ jfloat GetStaticFloatField(jclass clazz, jfieldID fieldID)
+ { return functions->GetStaticFloatField(this, clazz, fieldID); }
+ jdouble GetStaticDoubleField(jclass clazz, jfieldID fieldID)
+ { return functions->GetStaticDoubleField(this, clazz, fieldID); }
+
+ void SetStaticObjectField(jclass clazz, jfieldID fieldID, jobject value)
+ { functions->SetStaticObjectField(this, clazz, fieldID, value); }
+ void SetStaticBooleanField(jclass clazz, jfieldID fieldID, jboolean value)
+ { functions->SetStaticBooleanField(this, clazz, fieldID, value); }
+ void SetStaticByteField(jclass clazz, jfieldID fieldID, jbyte value)
+ { functions->SetStaticByteField(this, clazz, fieldID, value); }
+ void SetStaticCharField(jclass clazz, jfieldID fieldID, jchar value)
+ { functions->SetStaticCharField(this, clazz, fieldID, value); }
+ void SetStaticShortField(jclass clazz, jfieldID fieldID, jshort value)
+ { functions->SetStaticShortField(this, clazz, fieldID, value); }
+ void SetStaticIntField(jclass clazz, jfieldID fieldID, jint value)
+ { functions->SetStaticIntField(this, clazz, fieldID, value); }
+ void SetStaticLongField(jclass clazz, jfieldID fieldID, jlong value)
+ { functions->SetStaticLongField(this, clazz, fieldID, value); }
+ void SetStaticFloatField(jclass clazz, jfieldID fieldID, jfloat value)
+ { functions->SetStaticFloatField(this, clazz, fieldID, value); }
+ void SetStaticDoubleField(jclass clazz, jfieldID fieldID, jdouble value)
+ { functions->SetStaticDoubleField(this, clazz, fieldID, value); }
+
+ jstring NewString(const jchar* unicodeChars, jsize len)
+ { return functions->NewString(this, unicodeChars, len); }
+
+ jsize GetStringLength(jstring string)
+ { return functions->GetStringLength(this, string); }
+
+ const jchar* GetStringChars(jstring string, jboolean* isCopy)
+ { return functions->GetStringChars(this, string, isCopy); }
+
+ void ReleaseStringChars(jstring string, const jchar* chars)
+ { functions->ReleaseStringChars(this, string, chars); }
+
+ jstring NewStringUTF(const char* bytes)
+ { return functions->NewStringUTF(this, bytes); }
+
+ jsize GetStringUTFLength(jstring string)
+ { return functions->GetStringUTFLength(this, string); }
+
+ const char* GetStringUTFChars(jstring string, jboolean* isCopy)
+ { return functions->GetStringUTFChars(this, string, isCopy); }
+
+ void ReleaseStringUTFChars(jstring string, const char* utf)
+ { functions->ReleaseStringUTFChars(this, string, utf); }
+
+ jsize GetArrayLength(jarray array)
+ { return functions->GetArrayLength(this, array); }
+
+ jobjectArray NewObjectArray(jsize length, jclass elementClass,
+ jobject initialElement)
+ { return functions->NewObjectArray(this, length, elementClass,
+ initialElement); }
+
+ jobject GetObjectArrayElement(jobjectArray array, jsize index)
+ { return functions->GetObjectArrayElement(this, array, index); }
+
+ void SetObjectArrayElement(jobjectArray array, jsize index, jobject value)
+ { functions->SetObjectArrayElement(this, array, index, value); }
+
+ jbooleanArray NewBooleanArray(jsize length)
+ { return functions->NewBooleanArray(this, length); }
+ jbyteArray NewByteArray(jsize length)
+ { return functions->NewByteArray(this, length); }
+ jcharArray NewCharArray(jsize length)
+ { return functions->NewCharArray(this, length); }
+ jshortArray NewShortArray(jsize length)
+ { return functions->NewShortArray(this, length); }
+ jintArray NewIntArray(jsize length)
+ { return functions->NewIntArray(this, length); }
+ jlongArray NewLongArray(jsize length)
+ { return functions->NewLongArray(this, length); }
+ jfloatArray NewFloatArray(jsize length)
+ { return functions->NewFloatArray(this, length); }
+ jdoubleArray NewDoubleArray(jsize length)
+ { return functions->NewDoubleArray(this, length); }
+
+ jboolean* GetBooleanArrayElements(jbooleanArray array, jboolean* isCopy)
+ { return functions->GetBooleanArrayElements(this, array, isCopy); }
+ jbyte* GetByteArrayElements(jbyteArray array, jboolean* isCopy)
+ { return functions->GetByteArrayElements(this, array, isCopy); }
+ jchar* GetCharArrayElements(jcharArray array, jboolean* isCopy)
+ { return functions->GetCharArrayElements(this, array, isCopy); }
+ jshort* GetShortArrayElements(jshortArray array, jboolean* isCopy)
+ { return functions->GetShortArrayElements(this, array, isCopy); }
+ jint* GetIntArrayElements(jintArray array, jboolean* isCopy)
+ { return functions->GetIntArrayElements(this, array, isCopy); }
+ jlong* GetLongArrayElements(jlongArray array, jboolean* isCopy)
+ { return functions->GetLongArrayElements(this, array, isCopy); }
+ jfloat* GetFloatArrayElements(jfloatArray array, jboolean* isCopy)
+ { return functions->GetFloatArrayElements(this, array, isCopy); }
+ jdouble* GetDoubleArrayElements(jdoubleArray array, jboolean* isCopy)
+ { return functions->GetDoubleArrayElements(this, array, isCopy); }
+
+ void ReleaseBooleanArrayElements(jbooleanArray array, jboolean* elems,
+ jint mode)
+ { functions->ReleaseBooleanArrayElements(this, array, elems, mode); }
+ void ReleaseByteArrayElements(jbyteArray array, jbyte* elems,
+ jint mode)
+ { functions->ReleaseByteArrayElements(this, array, elems, mode); }
+ void ReleaseCharArrayElements(jcharArray array, jchar* elems,
+ jint mode)
+ { functions->ReleaseCharArrayElements(this, array, elems, mode); }
+ void ReleaseShortArrayElements(jshortArray array, jshort* elems,
+ jint mode)
+ { functions->ReleaseShortArrayElements(this, array, elems, mode); }
+ void ReleaseIntArrayElements(jintArray array, jint* elems,
+ jint mode)
+ { functions->ReleaseIntArrayElements(this, array, elems, mode); }
+ void ReleaseLongArrayElements(jlongArray array, jlong* elems,
+ jint mode)
+ { functions->ReleaseLongArrayElements(this, array, elems, mode); }
+ void ReleaseFloatArrayElements(jfloatArray array, jfloat* elems,
+ jint mode)
+ { functions->ReleaseFloatArrayElements(this, array, elems, mode); }
+ void ReleaseDoubleArrayElements(jdoubleArray array, jdouble* elems,
+ jint mode)
+ { functions->ReleaseDoubleArrayElements(this, array, elems, mode); }
+
+ void GetBooleanArrayRegion(jbooleanArray array, jsize start, jsize len,
+ jboolean* buf)
+ { functions->GetBooleanArrayRegion(this, array, start, len, buf); }
+ void GetByteArrayRegion(jbyteArray array, jsize start, jsize len,
+ jbyte* buf)
+ { functions->GetByteArrayRegion(this, array, start, len, buf); }
+ void GetCharArrayRegion(jcharArray array, jsize start, jsize len,
+ jchar* buf)
+ { functions->GetCharArrayRegion(this, array, start, len, buf); }
+ void GetShortArrayRegion(jshortArray array, jsize start, jsize len,
+ jshort* buf)
+ { functions->GetShortArrayRegion(this, array, start, len, buf); }
+ void GetIntArrayRegion(jintArray array, jsize start, jsize len,
+ jint* buf)
+ { functions->GetIntArrayRegion(this, array, start, len, buf); }
+ void GetLongArrayRegion(jlongArray array, jsize start, jsize len,
+ jlong* buf)
+ { functions->GetLongArrayRegion(this, array, start, len, buf); }
+ void GetFloatArrayRegion(jfloatArray array, jsize start, jsize len,
+ jfloat* buf)
+ { functions->GetFloatArrayRegion(this, array, start, len, buf); }
+ void GetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len,
+ jdouble* buf)
+ { functions->GetDoubleArrayRegion(this, array, start, len, buf); }
+
+ void SetBooleanArrayRegion(jbooleanArray array, jsize start, jsize len,
+ const jboolean* buf)
+ { functions->SetBooleanArrayRegion(this, array, start, len, buf); }
+ void SetByteArrayRegion(jbyteArray array, jsize start, jsize len,
+ const jbyte* buf)
+ { functions->SetByteArrayRegion(this, array, start, len, buf); }
+ void SetCharArrayRegion(jcharArray array, jsize start, jsize len,
+ const jchar* buf)
+ { functions->SetCharArrayRegion(this, array, start, len, buf); }
+ void SetShortArrayRegion(jshortArray array, jsize start, jsize len,
+ const jshort* buf)
+ { functions->SetShortArrayRegion(this, array, start, len, buf); }
+ void SetIntArrayRegion(jintArray array, jsize start, jsize len,
+ const jint* buf)
+ { functions->SetIntArrayRegion(this, array, start, len, buf); }
+ void SetLongArrayRegion(jlongArray array, jsize start, jsize len,
+ const jlong* buf)
+ { functions->SetLongArrayRegion(this, array, start, len, buf); }
+ void SetFloatArrayRegion(jfloatArray array, jsize start, jsize len,
+ const jfloat* buf)
+ { functions->SetFloatArrayRegion(this, array, start, len, buf); }
+ void SetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len,
+ const jdouble* buf)
+ { functions->SetDoubleArrayRegion(this, array, start, len, buf); }
+
+ jint RegisterNatives(jclass clazz, const JNINativeMethod* methods,
+ jint nMethods)
+ { return functions->RegisterNatives(this, clazz, methods, nMethods); }
+
+ jint UnregisterNatives(jclass clazz)
+ { return functions->UnregisterNatives(this, clazz); }
+
+ jint MonitorEnter(jobject obj)
+ { return functions->MonitorEnter(this, obj); }
+
+ jint MonitorExit(jobject obj)
+ { return functions->MonitorExit(this, obj); }
+
+ jint GetJavaVM(JavaVM** vm)
+ { return functions->GetJavaVM(this, vm); }
+
+ void GetStringRegion(jstring str, jsize start, jsize len, jchar* buf)
+ { functions->GetStringRegion(this, str, start, len, buf); }
+
+ void GetStringUTFRegion(jstring str, jsize start, jsize len, char* buf)
+ { return functions->GetStringUTFRegion(this, str, start, len, buf); }
+
+ void* GetPrimitiveArrayCritical(jarray array, jboolean* isCopy)
+ { return functions->GetPrimitiveArrayCritical(this, array, isCopy); }
+
+ void ReleasePrimitiveArrayCritical(jarray array, void* carray, jint mode)
+ { functions->ReleasePrimitiveArrayCritical(this, array, carray, mode); }
+
+ const jchar* GetStringCritical(jstring string, jboolean* isCopy)
+ { return functions->GetStringCritical(this, string, isCopy); }
+
+ void ReleaseStringCritical(jstring string, const jchar* carray)
+ { functions->ReleaseStringCritical(this, string, carray); }
+
+ jweak NewWeakGlobalRef(jobject obj)
+ { return functions->NewWeakGlobalRef(this, obj); }
+
+ void DeleteWeakGlobalRef(jweak obj)
+ { functions->DeleteWeakGlobalRef(this, obj); }
+
+ jboolean ExceptionCheck()
+ { return functions->ExceptionCheck(this); }
+
+ jobject NewDirectByteBuffer(void* address, jlong capacity)
+ { return functions->NewDirectByteBuffer(this, address, capacity); }
+
+ void* GetDirectBufferAddress(jobject buf)
+ { return functions->GetDirectBufferAddress(this, buf); }
+
+ jlong GetDirectBufferCapacity(jobject buf)
+ { return functions->GetDirectBufferCapacity(this, buf); }
+
+ /* added in JNI 1.6 */
+ jobjectRefType GetObjectRefType(jobject obj)
+ { return functions->GetObjectRefType(this, obj); }
+#endif /*__cplusplus*/
+};
+
+
+/*
+ * JNI invocation interface.
+ */
+struct JNIInvokeInterface {
+ void* reserved0;
+ void* reserved1;
+ void* reserved2;
+
+ jint (*DestroyJavaVM)(JavaVM*);
+ jint (*AttachCurrentThread)(JavaVM*, JNIEnv**, void*);
+ jint (*DetachCurrentThread)(JavaVM*);
+ jint (*GetEnv)(JavaVM*, void**, jint);
+ jint (*AttachCurrentThreadAsDaemon)(JavaVM*, JNIEnv**, void*);
+};
+
+/*
+ * C++ version.
+ */
+struct _JavaVM {
+ const struct JNIInvokeInterface* functions;
+
+#if defined(__cplusplus)
+ jint DestroyJavaVM()
+ { return functions->DestroyJavaVM(this); }
+ jint AttachCurrentThread(JNIEnv** p_env, void* thr_args)
+ { return functions->AttachCurrentThread(this, p_env, thr_args); }
+ jint DetachCurrentThread()
+ { return functions->DetachCurrentThread(this); }
+ jint GetEnv(void** env, jint version)
+ { return functions->GetEnv(this, env, version); }
+ jint AttachCurrentThreadAsDaemon(JNIEnv** p_env, void* thr_args)
+ { return functions->AttachCurrentThreadAsDaemon(this, p_env, thr_args); }
+#endif /*__cplusplus*/
+};
+
+struct JavaVMAttachArgs {
+ jint version; /* must be >= JNI_VERSION_1_2 */
+ const char* name; /* NULL or name of thread as modified UTF-8 str */
+ jobject group; /* global ref of a ThreadGroup object, or NULL */
+};
+typedef struct JavaVMAttachArgs JavaVMAttachArgs;
+
+/*
+ * JNI 1.2+ initialization. (As of 1.6, the pre-1.2 structures are no
+ * longer supported.)
+ */
+typedef struct JavaVMOption {
+ const char* optionString;
+ void* extraInfo;
+} JavaVMOption;
+
+typedef struct JavaVMInitArgs {
+ jint version; /* use JNI_VERSION_1_2 or later */
+
+ jint nOptions;
+ JavaVMOption* options;
+ jboolean ignoreUnrecognized;
+} JavaVMInitArgs;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * VM initialization functions.
+ *
+ * Note these are the only symbols exported for JNI by the VM.
+ */
+jint JNI_GetDefaultJavaVMInitArgs(void*);
+jint JNI_CreateJavaVM(JavaVM**, JNIEnv**, void*);
+jint JNI_GetCreatedJavaVMs(JavaVM**, jsize, jsize*);
+
+/*
+ * Prototypes for functions exported by loadable shared libs. These are
+ * called by JNI, not provided by JNI.
+ */
+jint JNI_OnLoad(JavaVM* vm, void* reserved);
+void JNI_OnUnload(JavaVM* vm, void* reserved);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/*
+ * Manifest constants.
+ */
+#define JNI_FALSE 0
+#define JNI_TRUE 1
+
+#define JNI_VERSION_1_1 0x00010001
+#define JNI_VERSION_1_2 0x00010002
+#define JNI_VERSION_1_4 0x00010004
+#define JNI_VERSION_1_6 0x00010006
+
+#define JNI_OK (0) /* no error */
+#define JNI_ERR (-1) /* generic error */
+#define JNI_EDETACHED (-2) /* thread detached from the VM */
+#define JNI_EVERSION (-3) /* JNI version error */
+
+#define JNI_COMMIT 1 /* copy content, do not free buffer */
+#define JNI_ABORT 2 /* free buffer w/o copying back */
+
+/* need these for Windows-aware headers */
+#define JNIIMPORT
+#define JNIEXPORT
+#define JNICALL
+
+#endif /*_JNI_H*/
diff --git a/tools/cache.py b/tools/cache.py
new file mode 100644
index 00000000..e7908fba
--- /dev/null
+++ b/tools/cache.py
@@ -0,0 +1,194 @@
+import os.path, sys, shutil, hashlib, cPickle, zlib, time
+
+import tempfiles
+
+# Permanent cache for dlmalloc and stdlibc++
+class Cache:
+ def __init__(self, dirname=None, debug=False):
+ if dirname is None:
+ dirname = os.environ.get('EM_CACHE')
+ if not dirname:
+ dirname = os.path.expanduser(os.path.join('~', '.emscripten_cache'))
+ self.dirname = dirname
+ self.debug = debug
+
+ def ensure(self):
+ if not os.path.exists(self.dirname):
+ os.makedirs(self.dirname)
+
+ def erase(self):
+ tempfiles.try_delete(self.dirname)
+ try:
+ open(self.dirname + '__last_clear', 'w').write('last clear: ' + time.asctime() + '\n')
+ except Exception, e:
+ print >> sys.stderr, 'failed to save last clear time: ', e
+
+ def get_path(self, shortname):
+ return os.path.join(self.dirname, shortname)
+
+ # Request a cached file. If it isn't in the cache, it will be created with
+ # the given creator function
+ def get(self, shortname, creator, extension='.bc'):
+ if not shortname.endswith(extension): shortname += extension
+ cachename = os.path.join(self.dirname, shortname)
+ if os.path.exists(cachename):
+ return cachename
+ self.ensure()
+ shutil.copyfile(creator(), cachename)
+ return cachename
+
+# JS-specific cache. We cache the results of compilation and optimization,
+# so that in incremental builds we can just load from cache.
+# We cache reasonably-large-sized chunks
+class JCache:
+ def __init__(self, cache):
+ self.cache = cache
+ self.dirname = os.path.join(cache.dirname, 'jcache')
+ self.debug = cache.debug
+
+ def ensure(self):
+ self.cache.ensure()
+ if not os.path.exists(self.dirname):
+ os.makedirs(self.dirname)
+
+ def get_shortkey(self, keys):
+ if type(keys) not in [list, tuple]:
+ keys = [keys]
+ ret = ''
+ for key in keys:
+ assert type(key) == str
+ ret += hashlib.md5(key).hexdigest()
+ return ret
+
+ def get_cachename(self, shortkey):
+ return os.path.join(self.dirname, shortkey)
+
+ # Returns a cached value, if it exists. Make sure the full key matches
+ def get(self, shortkey, keys):
+ if self.debug: print >> sys.stderr, 'jcache get?', shortkey
+ cachename = self.get_cachename(shortkey)
+ if not os.path.exists(cachename):
+ if self.debug: print >> sys.stderr, 'jcache none at all'
+ return
+ try:
+ data = cPickle.loads(zlib.decompress(open(cachename).read()))
+ except Exception, e:
+ if DEBUG_CACHE: print >> sys.stderr, 'jcache decompress/unpickle error:', e
+ if len(data) != 2:
+ if self.debug: print >> sys.stderr, 'jcache error in get'
+ return
+ oldkeys = data[0]
+ if len(oldkeys) != len(keys):
+ if self.debug: print >> sys.stderr, 'jcache collision (a)'
+ return
+ for i in range(len(oldkeys)):
+ if oldkeys[i] != keys[i]:
+ if self.debug: print >> sys.stderr, 'jcache collision (b)'
+ return
+ if self.debug: print >> sys.stderr, 'jcache win'
+ return data[1]
+
+ # Sets the cached value for a key (from get_key)
+ def set(self, shortkey, keys, value):
+ cachename = self.get_cachename(shortkey)
+ try:
+ f = open(cachename, 'w')
+ f.write(zlib.compress(cPickle.dumps([keys, value])))
+ f.close()
+ except Exception, e:
+ if DEBUG_CACHE: print >> sys.stderr, 'jcache compress/pickle error:', e
+ return
+ # for i in range(len(keys)):
+ # open(cachename + '.key' + str(i), 'w').write(keys[i])
+ # open(cachename + '.value', 'w').write(value)
+
+# Given a set of functions of form (ident, text), and a preferred chunk size,
+# generates a set of chunks for parallel processing and caching.
+# It is very important to generate similar chunks in incremental builds, in
+# order to maximize the chance of cache hits. To achieve that, we save the
+# chunking used in the previous compilation of this phase, and we try to
+# generate the same chunks, barring big differences in function sizes that
+# violate our chunk size guideline. If caching is not used, chunking_file
+# should be None
+def chunkify(funcs, chunk_size, chunking_file, DEBUG=False):
+ previous_mapping = None
+ if chunking_file:
+ chunking_file = chunking_file
+ if os.path.exists(chunking_file):
+ try:
+ previous_mapping = cPickle.Unpickler(open(chunking_file, 'rb')).load() # maps a function identifier to the chunk number it will be in
+ #if DEBUG: print >> sys.stderr, 'jscache previous mapping', previous_mapping
+ except:
+ pass
+ chunks = []
+ if previous_mapping:
+ # initialize with previous chunking
+ news = []
+ for func in funcs:
+ ident, data = func
+ assert ident, 'need names for jcache chunking'
+ if not ident in previous_mapping:
+ news.append(func)
+ else:
+ n = previous_mapping[ident]
+ while n >= len(chunks): chunks.append([])
+ chunks[n].append(func)
+ if DEBUG: print >> sys.stderr, 'jscache not in previous chunking', len(news)
+ # add news and adjust for new sizes
+ spilled = news
+ for i in range(len(chunks)):
+ chunk = chunks[i]
+ size = sum([len(func[1]) for func in chunk])
+ #if DEBUG: print >> sys.stderr, 'need spilling?', i, size, len(chunk), 'vs', chunk_size, 1.5*chunk_size
+ while size > 1.5*chunk_size and len(chunk) > 1:
+ spill = chunk.pop()
+ spilled.append(spill)
+ size -= len(spill[1])
+ #if DEBUG: print >> sys.stderr, 'jscache new + spilled', len(spilled)
+ for chunk in chunks:
+ size = sum([len(func[1]) for func in chunk])
+ while size < 0.66*chunk_size and len(spilled) > 0:
+ spill = spilled.pop()
+ chunk.append(spill)
+ size += len(spill[1])
+ chunks = filter(lambda chunk: len(chunk) > 0, chunks) # might have empty ones, eliminate them
+ funcs = spilled # we will allocate these into chunks as if they were normal inputs
+ #if DEBUG: print >> sys.stderr, 'leftover spills', len(spilled)
+ # initialize reasonably, the rest of the funcs we need to split out
+ curr = []
+ total_size = 0
+ for i in range(len(funcs)):
+ func = funcs[i]
+ curr_size = len(func[1])
+ if total_size + curr_size < chunk_size:
+ curr.append(func)
+ total_size += curr_size
+ else:
+ chunks.append(curr)
+ curr = [func]
+ total_size = curr_size
+ if curr:
+ chunks.append(curr)
+ curr = None
+ if chunking_file:
+ # sort within each chunk, to keep the order identical
+ for chunk in chunks:
+ chunk.sort(key=lambda func: func[0])
+ # save new mapping info
+ new_mapping = {}
+ for i in range(len(chunks)):
+ chunk = chunks[i]
+ for ident, data in chunk:
+ assert ident not in new_mapping, 'cannot have duplicate names in jcache chunking'
+ new_mapping[ident] = i
+ cPickle.Pickler(open(chunking_file, 'wb')).dump(new_mapping)
+ #if DEBUG:
+ # for i in range(len(chunks)):
+ # chunk = chunks[i]
+ # print >> sys.stderr, 'final chunk', i, len(chunk)
+ # print >> sys.stderr, 'new mapping:', new_mapping
+ # if previous_mapping:
+ # for ident in set(previous_mapping.keys() + new_mapping.keys()):
+ # if previous_mapping.get(ident) != new_mapping.get(ident):
+ # print >> sys.stderr, 'mapping inconsistency', ident, previous_mapping.get(ident), new_mapping.get(ident)
+ return [''.join([func[1] for func in chunk]) for chunk in chunks] # remove function names
diff --git a/tools/eliminator/node_modules/.bin/cake b/tools/eliminator/node_modules/.bin/cake
deleted file mode 120000
index d95f32af..00000000
--- a/tools/eliminator/node_modules/.bin/cake
+++ /dev/null
@@ -1 +0,0 @@
-../coffee-script/bin/cake \ No newline at end of file
diff --git a/tools/eliminator/node_modules/.bin/coffee b/tools/eliminator/node_modules/.bin/coffee
deleted file mode 120000
index b57f275d..00000000
--- a/tools/eliminator/node_modules/.bin/coffee
+++ /dev/null
@@ -1 +0,0 @@
-../coffee-script/bin/coffee \ No newline at end of file
diff --git a/tools/file_packager.py b/tools/file_packager.py
index bfa8e2f0..73ff4919 100644
--- a/tools/file_packager.py
+++ b/tools/file_packager.py
@@ -35,8 +35,8 @@ TODO: You can also provide .crn files yourself, pre-crunched. With this o
import os, sys, shutil, random
-from shared import Compression, execute, suffix, unsuffixed
import shared
+from shared import Compression, execute, suffix, unsuffixed
from subprocess import Popen, PIPE, STDOUT
data_target = sys.argv[1]
diff --git a/tools/js_optimizer.py b/tools/js_optimizer.py
index 231c6257..2fd2211b 100644
--- a/tools/js_optimizer.py
+++ b/tools/js_optimizer.py
@@ -2,7 +2,8 @@
import os, sys, subprocess, multiprocessing, re
import shared
-temp_files = shared.TempFiles()
+configuration = shared.configuration
+temp_files = configuration.get_temp_files()
__rootpath__ = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
def path_from_root(*pathelems):
@@ -30,7 +31,7 @@ def run_on_chunk(command):
return filename
def run_on_js(filename, passes, js_engine, jcache):
-
+ if isinstance(jcache, bool) and jcache: jcache = shared.JCache
if jcache: shared.JCache.ensure()
if type(passes) == str:
@@ -106,7 +107,7 @@ def run_on_js(filename, passes, js_engine, jcache):
intended_num_chunks = int(round(cores * NUM_CHUNKS_PER_CORE))
chunk_size = min(MAX_CHUNK_SIZE, max(MIN_CHUNK_SIZE, total_size / intended_num_chunks))
- chunks = shared.JCache.chunkify(funcs, chunk_size, 'jsopt' if jcache else None)
+ chunks = shared.chunkify(funcs, chunk_size, jcache.get_cachename('jsopt') if jcache else None)
if jcache:
# load chunks from cache where we can # TODO: ignore small chunks
diff --git a/tools/jsrun.py b/tools/jsrun.py
new file mode 100644
index 00000000..27c55350
--- /dev/null
+++ b/tools/jsrun.py
@@ -0,0 +1,27 @@
+import time
+from subprocess import Popen, PIPE, STDOUT
+
+def timeout_run(proc, timeout, note='unnamed process', full_output=False):
+ start = time.time()
+ if timeout is not None:
+ while time.time() - start < timeout and proc.poll() is None:
+ time.sleep(0.1)
+ if proc.poll() is None:
+ proc.kill() # XXX bug: killing emscripten.py does not kill it's child process!
+ raise Exception("Timed out: " + note)
+ out = proc.communicate()
+ return '\n'.join(out) if full_output else out[0]
+
+def run_js(filename, engine=None, args=[], check_timeout=False, stdout=PIPE, stderr=None, cwd=None, full_output=False):
+ if type(engine) is not list:
+ engine = [engine]
+ command = engine + [filename] + (['--'] if 'd8' in engine[0] else []) + args
+ return timeout_run(
+ Popen(
+ command,
+ stdout=stdout,
+ stderr=stderr,
+ cwd=cwd),
+ 15*60 if check_timeout else None,
+ 'Execution',
+ full_output=full_output)
diff --git a/tools/shared.py b/tools/shared.py
index f5f6a17b..09f6aef4 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -1,6 +1,7 @@
-import shutil, time, os, sys, json, tempfile, copy, shlex, atexit, subprocess, hashlib, cPickle
+import shutil, time, os, sys, json, tempfile, copy, shlex, atexit, subprocess, hashlib, cPickle, re
from subprocess import Popen, PIPE, STDOUT
from tempfile import mkstemp
+import jsrun, cache, tempfiles
def listify(x):
if type(x) is not list: return [x]
@@ -180,7 +181,7 @@ def check_node_version():
# we re-check sanity when the settings are changed)
# We also re-check sanity and clear the cache when the version changes
-EMSCRIPTEN_VERSION = '1.2.4'
+EMSCRIPTEN_VERSION = '1.2.6'
def check_sanity(force=False):
try:
@@ -289,34 +290,50 @@ AUTODEBUGGER = path_from_root('tools', 'autodebugger.py')
BINDINGS_GENERATOR = path_from_root('tools', 'bindings_generator.py')
EXEC_LLVM = path_from_root('tools', 'exec_llvm.py')
FILE_PACKAGER = path_from_root('tools', 'file_packager.py')
-RELOOPER = path_from_root('src', 'relooper.js')
# Temp dir. Create a random one, unless EMCC_DEBUG is set, in which case use TEMP_DIR/emscripten_temp
-try:
- TEMP_DIR
-except:
- print >> sys.stderr, 'TEMP_DIR not defined in ~/.emscripten, using /tmp'
- TEMP_DIR = '/tmp'
+class Configuration:
+ def __init__(self, environ):
+ self.DEBUG = environ.get('EMCC_DEBUG')
+ if self.DEBUG == "0":
+ self.DEBUG = None
+ self.DEBUG_CACHE = self.DEBUG and "cache" in self.DEBUG
+ self.EMSCRIPTEN_TEMP_DIR = None
-CANONICAL_TEMP_DIR = os.path.join(TEMP_DIR, 'emscripten_temp')
-EMSCRIPTEN_TEMP_DIR = None
+ try:
+ self.TEMP_DIR = TEMP_DIR
+ except NameError:
+ print >> sys.stderr, 'TEMP_DIR not defined in ~/.emscripten, using /tmp'
+ self.TEMP_DIR = '/tmp'
-DEBUG = os.environ.get('EMCC_DEBUG')
-if DEBUG == "0":
- DEBUG = None
-DEBUG_CACHE = DEBUG and "cache" in DEBUG
+ self.CANONICAL_TEMP_DIR = os.path.join(self.TEMP_DIR, 'emscripten_temp')
-if DEBUG:
- try:
- EMSCRIPTEN_TEMP_DIR = CANONICAL_TEMP_DIR
- if not os.path.exists(EMSCRIPTEN_TEMP_DIR):
- os.makedirs(EMSCRIPTEN_TEMP_DIR)
- except Exception, e:
- print >> sys.stderr, e, 'Could not create canonical temp dir. Check definition of TEMP_DIR in ~/.emscripten'
+ if self.DEBUG:
+ try:
+ self.EMSCRIPTEN_TEMP_DIR = self.CANONICAL_TEMP_DIR
+ if not os.path.exists(self.EMSCRIPTEN_TEMP_DIR):
+ os.makedirs(self.EMSCRIPTEN_TEMP_DIR)
+ except Exception, e:
+ print >> sys.stderr, e, 'Could not create canonical temp dir. Check definition of TEMP_DIR in ~/.emscripten'
+
+ def get_temp_files(self):
+ return tempfiles.TempFiles(
+ tmp=self.TEMP_DIR if not self.DEBUG else self.EMSCRIPTEN_TEMP_DIR,
+ save_debug_files=os.environ.get('EMCC_DEBUG_SAVE'))
+
+ def debug_log(self, msg):
+ if self.DEBUG:
+ print >> sys.stderr, msg
+
+configuration = Configuration(environ=os.environ)
+DEBUG = configuration.DEBUG
+EMSCRIPTEN_TEMP_DIR = configuration.EMSCRIPTEN_TEMP_DIR
+DEBUG_CACHE = configuration.DEBUG_CACHE
+CANONICAL_TEMP_DIR = configuration.CANONICAL_TEMP_DIR
if not EMSCRIPTEN_TEMP_DIR:
- EMSCRIPTEN_TEMP_DIR = tempfile.mkdtemp(prefix='emscripten_temp_', dir=TEMP_DIR)
+ EMSCRIPTEN_TEMP_DIR = tempfile.mkdtemp(prefix='emscripten_temp_', dir=configuration.TEMP_DIR)
def clean_temp():
try_delete(EMSCRIPTEN_TEMP_DIR)
atexit.register(clean_temp)
@@ -414,42 +431,7 @@ if not WINDOWS:
pass
# Temp file utilities
-
-def try_delete(filename):
- try:
- os.unlink(filename)
- except:
- try:
- shutil.rmtree(filename)
- except:
- pass
-
-class TempFiles:
- def __init__(self):
- self.to_clean = []
-
- def note(self, filename):
- self.to_clean.append(filename)
-
- def get(self, suffix):
- """Returns a named temp file with the given prefix."""
- named_file = tempfile.NamedTemporaryFile(dir=TEMP_DIR if not DEBUG else EMSCRIPTEN_TEMP_DIR, suffix=suffix, delete=False)
- self.note(named_file.name)
- return named_file
-
- def clean(self):
- if os.environ.get('EMCC_DEBUG_SAVE'):
- print >> sys.stderr, 'not cleaning up temp files since in debug-save mode, see them in %s' % EMSCRIPTEN_TEMP_DIR
- return
- for filename in self.to_clean:
- try_delete(filename)
- self.to_clean = []
-
- def run_and_clean(self, func):
- try:
- return func()
- finally:
- self.clean()
+from tempfiles import try_delete
# Utilities
@@ -463,23 +445,10 @@ def check_engine(engine):
print 'Checking JS engine %s failed. Check %s. Details: %s' % (str(engine), EM_CONFIG, str(e))
return False
-def timeout_run(proc, timeout, note='unnamed process', full_output=False):
- start = time.time()
- if timeout is not None:
- while time.time() - start < timeout and proc.poll() is None:
- time.sleep(0.1)
- if proc.poll() is None:
- proc.kill() # XXX bug: killing emscripten.py does not kill it's child process!
- raise Exception("Timed out: " + note)
- out = proc.communicate()
- return '\n'.join(out) if full_output else out[0]
-
-def run_js(filename, engine=None, args=[], check_timeout=False, stdout=PIPE, stderr=None, cwd=None, full_output=False):
- if engine is None: engine = JS_ENGINES[0]
- engine = listify(engine)
- #if not WINDOWS: 'd8' in engine[0] or 'node' in engine[0]: engine += ['--stack_size=8192'] # needed for some big projects
- command = engine + [filename] + (['--'] if 'd8' in engine[0] else []) + args
- return timeout_run(Popen(command, stdout=stdout, stderr=stderr, cwd=cwd), 15*60 if check_timeout else None, 'Execution', full_output=full_output)
+def run_js(filename, engine=None, *args, **kw):
+ if engine is None:
+ engine = JS_ENGINES[0]
+ return jsrun.run_js(filename, engine, *args, **kw)
def to_cc(cxx):
# By default, LLVM_GCC and CLANG are really the C++ versions. This gets an explicit C version
@@ -654,7 +623,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
.replace('$EMSCRIPTEN_ROOT', path_from_root('').replace('\\', '/')) \
.replace('$CFLAGS', env['CFLAGS']) \
.replace('$CXXFLAGS', env['CFLAGS'])
- toolchainFile = mkstemp(suffix='.cmaketoolchain.txt', dir=TEMP_DIR)[1]
+ toolchainFile = mkstemp(suffix='.cmaketoolchain.txt', dir=configuration.TEMP_DIR)[1]
open(toolchainFile, 'w').write(CMakeToolchain)
args.append('-DCMAKE_TOOLCHAIN_FILE=%s' % os.path.abspath(toolchainFile))
return args
@@ -968,8 +937,9 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
os.environ['EMSCRIPTEN_SUPPRESS_USAGE_WARNING'] = '1'
# Run Emscripten
+ Settings.RELOOPER = Cache.get_path('relooper.js')
settings = Settings.serialize()
- compiler_output = timeout_run(Popen([PYTHON, EMSCRIPTEN, filename + ('.o.ll' if append_ext else ''), '-o', filename + '.o.js'] + settings + extra_args, stdout=PIPE), None, 'Compiling')
+ compiler_output = jsrun.timeout_run(Popen([PYTHON, EMSCRIPTEN, filename + ('.o.ll' if append_ext else ''), '-o', filename + '.o.js'] + settings + extra_args, stdout=PIPE), None, 'Compiling')
#print compiler_output
# Detect compilation crashes and errors
@@ -1161,25 +1131,26 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
# Make sure the relooper exists. If it does not, check out the relooper code and bootstrap it
@staticmethod
- def ensure_relooper():
- if os.path.exists(RELOOPER): return
+ def ensure_relooper(relooper):
+ if os.path.exists(relooper): return
+ Cache.ensure()
curr = os.getcwd()
try:
ok = False
print >> sys.stderr, '======================================='
print >> sys.stderr, 'bootstrapping relooper...'
- Cache.ensure()
os.chdir(path_from_root('src'))
def make(opt_level):
- raw = RELOOPER + '.raw.js'
+ raw = relooper + '.raw.js'
Building.emcc(os.path.join('relooper', 'Relooper.cpp'), ['-I' + os.path.join('relooper'), '--post-js',
os.path.join('relooper', 'emscripten', 'glue.js'),
'-s', 'TOTAL_MEMORY=52428800',
'-s', 'EXPORTED_FUNCTIONS=["_rl_set_output_buffer","_rl_make_output_buffer","_rl_new_block","_rl_delete_block","_rl_block_add_branch_to","_rl_new_relooper","_rl_delete_relooper","_rl_relooper_add_block","_rl_relooper_calculate","_rl_relooper_render", "_rl_set_asm_js_mode"]',
'-s', 'DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=["memcpy", "memset", "malloc", "free", "puts"]',
+ '-s', 'RELOOPER="' + relooper + '"',
'-O' + str(opt_level), '--closure', '0'], raw)
- f = open(RELOOPER, 'w')
+ f = open(relooper, 'w')
f.write("// Relooper, (C) 2012 Alon Zakai, MIT license, https://github.com/kripken/Relooper\n")
f.write("var Relooper = (function() {\n");
f.write(open(raw).read())
@@ -1199,198 +1170,39 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
finally:
os.chdir(curr)
if not ok:
- print >> sys.stderr, 'bootstrapping relooper failed. You may need to manually create src/relooper.js by compiling it, see src/relooper/emscripten'
+ print >> sys.stderr, 'bootstrapping relooper failed. You may need to manually create relooper.js by compiling it, see src/relooper/emscripten'
1/0
-# Permanent cache for dlmalloc and stdlibc++
-class Cache:
- dirname = os.environ.get('EM_CACHE')
- if not dirname:
- dirname = os.path.expanduser(os.path.join('~', '.emscripten_cache'))
-
- @staticmethod
- def ensure():
- if not os.path.exists(Cache.dirname):
- os.makedirs(Cache.dirname)
-
@staticmethod
- def erase():
- try:
- shutil.rmtree(Cache.dirname)
- except:
- pass
- try_delete(RELOOPER)
- try:
- open(Cache.dirname + '__last_clear', 'w').write('last clear: ' + time.asctime() + '\n')
- except:
- print >> sys.stderr, 'failed to save last clear time'
-
- # Request a cached file. If it isn't in the cache, it will be created with
- # the given creator function
- @staticmethod
- def get(shortname, creator):
- if not shortname.endswith('.bc'): shortname += '.bc'
- cachename = os.path.join(Cache.dirname, shortname)
- if os.path.exists(cachename):
- return cachename
- Cache.ensure()
- shutil.copyfile(creator(), cachename)
- return cachename
-
-# JS-specific cache. We cache the results of compilation and optimization,
-# so that in incremental builds we can just load from cache.
-# We cache reasonably-large-sized chunks
-class JCache:
- dirname = os.path.join(Cache.dirname, 'jcache')
-
- @staticmethod
- def ensure():
- Cache.ensure()
- if not os.path.exists(JCache.dirname):
- os.makedirs(JCache.dirname)
-
- @staticmethod
- def get_shortkey(keys):
- if type(keys) not in [list, tuple]:
- keys = [keys]
- ret = ''
- for key in keys:
- assert type(key) == str
- ret += hashlib.md5(key).hexdigest()
- return ret
-
- @staticmethod
- def get_cachename(shortkey):
- return os.path.join(JCache.dirname, shortkey)
+ def preprocess(infile, outfile):
+ '''
+ Preprocess source C/C++ in some special ways that emscripten needs. Returns
+ a filename (potentially the same one if nothing was changed).
- # Returns a cached value, if it exists. Make sure the full key matches
- @staticmethod
- def get(shortkey, keys):
- if DEBUG_CACHE: print >> sys.stderr, 'jcache get?', shortkey
- cachename = JCache.get_cachename(shortkey)
- if not os.path.exists(cachename):
- if DEBUG_CACHE: print >> sys.stderr, 'jcache none at all'
- return
- data = cPickle.Unpickler(open(cachename, 'rb')).load()
- if len(data) != 2:
- if DEBUG_CACHE: print >> sys.stderr, 'jcache error in get'
- return
- oldkeys = data[0]
- if len(oldkeys) != len(keys):
- if DEBUG_CACHE: print >> sys.stderr, 'jcache collision (a)'
- return
- for i in range(len(oldkeys)):
- if oldkeys[i] != keys[i]:
- if DEBUG_CACHE: print >> sys.stderr, 'jcache collision (b)'
- return
- if DEBUG_CACHE: print >> sys.stderr, 'jcache win'
- return data[1]
-
- # Sets the cached value for a key (from get_key)
- @staticmethod
- def set(shortkey, keys, value):
- if DEBUG_CACHE: print >> sys.stderr, 'save to cache', shortkey
- cachename = JCache.get_cachename(shortkey)
- cPickle.Pickler(open(cachename, 'wb')).dump([keys, value])
- #if DEBUG:
- # for i in range(len(keys)):
- # open(cachename + '.key' + str(i), 'w').write(keys[i])
- # open(cachename + '.value', 'w').write(value)
-
- # Given a set of functions of form (ident, text), and a preferred chunk size,
- # generates a set of chunks for parallel processing and caching.
- # It is very important to generate similar chunks in incremental builds, in
- # order to maximize the chance of cache hits. To achieve that, we save the
- # chunking used in the previous compilation of this phase, and we try to
- # generate the same chunks, barring big differences in function sizes that
- # violate our chunk size guideline. If caching is not used, chunking_file
- # should be None
- @staticmethod
- def chunkify(funcs, chunk_size, chunking_file):
- previous_mapping = None
- if chunking_file:
- chunking_file = JCache.get_cachename(chunking_file)
- if os.path.exists(chunking_file):
- try:
- previous_mapping = cPickle.Unpickler(open(chunking_file, 'rb')).load() # maps a function identifier to the chunk number it will be in
- if DEBUG: print >> sys.stderr, 'jscache previous mapping of size %d loaded from %s' % (len(previous_mapping), chunking_file)
- except Exception, e:
- print >> sys.stderr, 'Failed to load and unpickle previous chunking file at %s: ' % chunking_file, e
- else:
- print >> sys.stderr, 'Previous chunking file not found at %s' % chunking_file
- chunks = []
- if previous_mapping:
- # initialize with previous chunking
- news = []
- for func in funcs:
- ident, data = func
- assert ident, 'need names for jcache chunking'
- if not ident in previous_mapping:
- news.append(func)
- else:
- n = previous_mapping[ident]
- while n >= len(chunks): chunks.append([])
- chunks[n].append(func)
- if DEBUG: print >> sys.stderr, 'jscache not in previous chunking', len(news)
- # add news and adjust for new sizes
- spilled = news
- for i in range(len(chunks)):
- chunk = chunks[i]
- size = sum([len(func[1]) for func in chunk])
- #if DEBUG: print >> sys.stderr, 'need spilling?', i, size, len(chunk), 'vs', chunk_size, 1.5*chunk_size
- while size > 1.5*chunk_size and len(chunk) > 1:
- spill = chunk.pop()
- spilled.append(spill)
- size -= len(spill[1])
- #if DEBUG: print >> sys.stderr, 'jscache new + spilled', len(spilled)
- for chunk in chunks:
- size = sum([len(func[1]) for func in chunk])
- while size < 0.66*chunk_size and len(spilled) > 0:
- spill = spilled.pop()
- chunk.append(spill)
- size += len(spill[1])
- chunks = filter(lambda chunk: len(chunk) > 0, chunks) # might have empty ones, eliminate them
- funcs = spilled # we will allocate these into chunks as if they were normal inputs
- #if DEBUG: print >> sys.stderr, 'leftover spills', len(spilled)
- # initialize reasonably, the rest of the funcs we need to split out
- curr = []
- total_size = 0
- for i in range(len(funcs)):
- func = funcs[i]
- curr_size = len(func[1])
- if total_size + curr_size < chunk_size:
- curr.append(func)
- total_size += curr_size
- else:
- chunks.append(curr)
- curr = [func]
- total_size = curr_size
- if curr:
- chunks.append(curr)
- curr = None
- if chunking_file:
- # sort within each chunk, to keep the order identical
- for chunk in chunks:
- chunk.sort(key=lambda func: func[0])
- # save new mapping info
- new_mapping = {}
- for i in range(len(chunks)):
- chunk = chunks[i]
- for ident, data in chunk:
- assert ident not in new_mapping, 'cannot have duplicate names in jcache chunking'
- new_mapping[ident] = i
- cPickle.Pickler(open(chunking_file, 'wb')).dump(new_mapping)
- if DEBUG: print >> sys.stderr, 'jscache mapping of size %d saved to %s' % (len(new_mapping), chunking_file)
- #if DEBUG:
- # for i in range(len(chunks)):
- # chunk = chunks[i]
- # print >> sys.stderr, 'final chunk', i, len(chunk)
- # print >> sys.stderr, 'new mapping:', new_mapping
- # if previous_mapping:
- # for ident in set(previous_mapping.keys() + new_mapping.keys()):
- # if previous_mapping.get(ident) != new_mapping.get(ident):
- # print >> sys.stderr, 'mapping inconsistency', ident, previous_mapping.get(ident), new_mapping.get(ident)
- return [''.join([func[1] for func in chunk]) for chunk in chunks] # remove function names
+ Currently this only does emscripten_jcache_printf(..) rewriting.
+ '''
+ src = open(infile).read() # stack warning on jcacheprintf! in docs # add jcache printf test separatrely, for content of printf
+ if 'emscripten_jcache_printf' not in src: return infile
+ def fix(m):
+ text = m.groups(0)[0]
+ assert text.count('(') == 1 and text.count(')') == 1, 'must have simple expressions in emscripten_jcache_printf calls, no parens'
+ assert text.count('"') == 2, 'must have simple expressions in emscripten_jcache_printf calls, no strings as varargs parameters'
+ start = text.index('(')
+ end = text.rindex(')')
+ args = text[start+1:end].split(',')
+ args = map(lambda x: x.strip(), args)
+ if args[0][0] == '"':
+ # flatten out
+ args = map(lambda x: str(ord(x)), args[0][1:len(args[0])-1]) + ['0'] + args[1:]
+ return 'emscripten_jcache_printf_(' + ','.join(args) + ')'
+ src = re.sub(r'(emscripten_jcache_printf\([^)]+\))', lambda m: fix(m), src)
+ open(outfile, 'w').write(src)
+ return outfile
+
+# compatibility with existing emcc, etc. scripts
+Cache = cache.Cache(debug=DEBUG_CACHE)
+JCache = cache.JCache(Cache)
+chunkify = cache.chunkify
class JS:
@staticmethod
diff --git a/tools/tempfiles.py b/tools/tempfiles.py
new file mode 100644
index 00000000..1721b2bb
--- /dev/null
+++ b/tools/tempfiles.py
@@ -0,0 +1,40 @@
+import os
+import shutil
+import tempfile
+
+def try_delete(filename):
+ try:
+ os.unlink(filename)
+ except:
+ if os.path.exists(filename):
+ shutil.rmtree(filename, ignore_errors=True)
+
+class TempFiles:
+ def __init__(self, tmp, save_debug_files=False):
+ self.tmp = tmp
+ self.save_debug_files = save_debug_files
+
+ self.to_clean = []
+
+ def note(self, filename):
+ self.to_clean.append(filename)
+
+ def get(self, suffix):
+ """Returns a named temp file with the given prefix."""
+ named_file = tempfile.NamedTemporaryFile(dir=self.tmp, suffix=suffix, delete=False)
+ self.note(named_file.name)
+ return named_file
+
+ def clean(self):
+ if self.save_debug_files:
+ print >> sys.stderr, 'not cleaning up temp files since in debug-save mode, see them in %s' % (self.tmp,)
+ return
+ for filename in self.to_clean:
+ try_delete(filename)
+ self.to_clean = []
+
+ def run_and_clean(self, func):
+ try:
+ return func()
+ finally:
+ self.clean()