☠☠ backed out by 65262f9e7580 ☠ ☠ | |
author | Luke Wagner <luke@mozilla.com> |
Tue, 15 Oct 2013 12:13:34 -0500 | |
changeset 150844 | f5838290c7059fc279c1135e1a9f62690954548d |
parent 150843 | 5f0bfb16fa4a5fd22e5828277e7e4ed0c9747f88 |
child 150845 | f6cd58cf99ff7ffa8c0dba46d584b20ad79ff87a |
push id | 25469 |
push user | cbook@mozilla.com |
push date | Wed, 16 Oct 2013 10:46:01 +0000 |
treeherder | autoland@afae5911a1e0 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | sstangl |
bugs | 900669 |
milestone | 27.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -1077,16 +1077,25 @@ SetJitCompilerOption(JSContext *cx, unsi number = -1; JS_SetGlobalJitCompilerOption(cx, opt, uint32_t(number)); args.rval().setBoolean(true); return true; } +static bool +SetIonAssertGraphCoherency(JSContext *cx, unsigned argc, jsval *vp) +{ + CallArgs args = CallArgsFromVp(argc, vp); + jit::js_IonOptions.assertGraphConsistency = ToBoolean(args.get(0)); + args.rval().setUndefined(); + return true; +} + static const JSFunctionSpecWithHelp TestingFunctions[] = { JS_FN_HELP("gc", ::GC, 0, 0, "gc([obj] | 'compartment')", " Run the garbage collector. When obj is given, GC only its compartment.\n" " If 'compartment' is given, GC any compartments that were scheduled for\n" " GC via schedulegc."), JS_FN_HELP("minorgc", ::MinorGC, 0, 0, @@ -1241,16 +1250,22 @@ static const JSFunctionSpecWithHelp Test " Returns whether asm.js compilation is currently available or whether it is disabled\n" " (e.g., by the debugger)."), JS_FN_HELP("isAsmJSModule", IsAsmJSModule, 1, 0, "isAsmJSModule(fn)", " Returns whether the given value is a function containing \"use asm\" that has been\n" " validated according to the asm.js spec."), + JS_FN_HELP("isAsmJSModuleLoadedFromCache", IsAsmJSModuleLoadedFromCache, 1, 0, +"isAsmJSModule(fn)", +" Return whether the given asm.js module function has been loaded directly\n" +" from the cache. This function throws an error if fn is not a validated asm.js\n" +" module."), + JS_FN_HELP("isAsmJSFunction", IsAsmJSFunction, 1, 0, "isAsmJSFunction(fn)", " Returns whether the given value is a nested function in an asm.js module that has been\n" " both compile- and link-time validated."), JS_FN_HELP("inParallelSection", testingFunc_inParallelSection, 0, 0, "inParallelSection()", " True if this code is executing within a parallel section."), @@ -1270,16 +1285,22 @@ static const JSFunctionSpecWithHelp Test JS_FN_HELP("bailout", testingFunc_bailout, 0, 0, "bailout()", " Force a bailout out of ionmonkey (if running in ionmonkey)."), JS_FN_HELP("setJitCompilerOption", SetJitCompilerOption, 2, 0, "setCompilerOption(<option>, <number>)", " Set a compiler option indexed in JSCompileOption enum to a number.\n"), + JS_FN_HELP("setIonAssertGraphCoherency", SetIonAssertGraphCoherency, 1, 0, +"setIonAssertGraphCoherency(bool)", +" Set whether Ion should perform graph consistency (DEBUG-only) assertions. These assertions\n" +" are valuable and should be generally enabled, however they can be very expensive for large\n" +" (asm.js) programs."), + JS_FS_HELP_END }; bool js::DefineTestingFunctions(JSContext *cx, HandleObject obj) { return JS_DefineFunctionsWithHelp(cx, obj, TestingFunctions); }
--- a/js/src/frontend/ParseNode.h +++ b/js/src/frontend/ParseNode.h @@ -1449,12 +1449,25 @@ enum ParseReportKind ParseError, ParseWarning, ParseExtraWarning, ParseStrictError }; enum FunctionSyntaxKind { Expression, Statement, Arrow }; +static inline ParseNode * +FunctionArgsList(ParseNode *fn, unsigned *numFormals) +{ + JS_ASSERT(fn->isKind(PNK_FUNCTION)); + ParseNode *argsBody = fn->pn_body; + JS_ASSERT(argsBody->isKind(PNK_ARGSBODY)); + *numFormals = argsBody->pn_count; + if (*numFormals > 0 && argsBody->last()->isKind(PNK_STATEMENTLIST)) + (*numFormals)--; + JS_ASSERT(argsBody->isArity(PN_LIST)); + return argsBody->pn_head; +} + } /* namespace frontend */ } /* namespace js */ #endif /* frontend_ParseNode_h */
--- a/js/src/frontend/Parser.h +++ b/js/src/frontend/Parser.h @@ -278,16 +278,22 @@ struct ParseContext : public GenericPars // For example, while parsing this code we would encounter f1 and f2 at // body level, but we would not encounter f3 or f4 at body level: // // function f1() { function f2() { } } // if (cond) { function f3() { if (cond) { function f4() { } } } } // bool atBodyLevel() { return !topStmt; } + // True if this is the ParseContext for the body of a function created by + // the Function constructor. + bool isFunctionConstructorBody() const { + return sc->isFunctionBox() && staticLevel == 0; + } + inline bool useAsmOrInsideUseAsm() const { return sc->isFunctionBox() && sc->asFunctionBox()->useAsmOrInsideUseAsm(); } }; template <typename ParseHandler> inline Directives::Directives(ParseContext<ParseHandler> *parent) @@ -626,16 +632,25 @@ class Parser : private AutoGCRooter, pub bool leaveFunction(Node fn, ParseContext<ParseHandler> *outerpc, FunctionSyntaxKind kind = Expression); TokenPos pos() const { return tokenStream.currentToken().pos; } bool asmJS(Node list); + public: + // This function may only be called from within Parser::asmJS before + // parsing any tokens. It returns the canonical offset to be used as the + // start of the asm.js module. We use the offset in the char buffer + // immediately after the "use asm" processing directive statement (which + // includes any semicolons or newlines that end the statement). + uint32_t offsetOfCurrentAsmJSModule() const { return tokenStream.currentToken().pos.end; } + private: + friend class CompExprTransplanter; friend class GenexpGuard<ParseHandler>; friend struct BindData<ParseHandler>; }; /* Declare some required template specializations. */ template <>
--- a/js/src/frontend/TokenStream.h +++ b/js/src/frontend/TokenStream.h @@ -524,16 +524,25 @@ class MOZ_STACK_CLASS TokenStream TokenKind peekToken(Modifier modifier = None) { if (lookahead != 0) return tokens[(cursor + 1) & ntokensMask].type; TokenKind tt = getTokenInternal(modifier); ungetToken(); return tt; } + TokenPos peekTokenPos(Modifier modifier = None) { + if (lookahead != 0) + return tokens[(cursor + 1) & ntokensMask].pos; + getTokenInternal(modifier); + ungetToken(); + JS_ASSERT(lookahead != 0); + return tokens[(cursor + 1) & ntokensMask].pos; + } + // This is like peekToken(), with one exception: if there is an EOL // between the end of the current token and the start of the next token, it // returns TOK_EOL. In that case, no token with TOK_EOL is actually // created, just a TOK_EOL TokenKind is returned, and currentToken() // shouldn't be consulted. (This is the only place TOK_EOL is produced.) JS_ALWAYS_INLINE TokenKind peekTokenSameLine(Modifier modifier = None) { const Token &curr = currentToken(); @@ -610,16 +619,24 @@ class MOZ_STACK_CLASS TokenStream void tell(Position *); void seek(const Position &pos); void seek(const Position &pos, const TokenStream &other); size_t positionToOffset(const Position &pos) const { return pos.buf - userbuf.base(); } + const jschar *rawBase() const { + return userbuf.base(); + } + + const jschar *rawLimit() const { + return userbuf.limit(); + } + bool hasSourceURL() const { return sourceURL_ != nullptr; } jschar *sourceURL() { return sourceURL_; }
--- a/js/src/jit-test/jit_test.py +++ b/js/src/jit-test/jit_test.py @@ -1,14 +1,14 @@ #!/usr/bin/env python # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -import os, posixpath, shlex, subprocess, sys, traceback +import os, posixpath, shlex, shutil, subprocess, sys, traceback def add_libdir_to_path(): from os.path import dirname, exists, join, realpath js_src_dir = dirname(dirname(realpath(sys.argv[0]))) assert exists(join(js_src_dir,'jsapi.h')) sys.path.append(join(js_src_dir, 'lib')) sys.path.append(join(js_src_dir, 'tests', 'lib')) @@ -191,16 +191,28 @@ def main(argv): job_list.append(new_test) prefix = [os.path.abspath(args[0])] + shlex.split(options.shell_args) prolog = os.path.join(jittests.LIB_DIR, 'prolog.js') if options.remote: prolog = posixpath.join(options.remote_test_root, 'jit-tests', 'jit-tests', 'lib', 'prolog.js') prefix += ['-f', prolog] + prefix += ['--js-cache', jittests.JS_CACHE_DIR] + + # Avoid racing on the cache by having the js shell create a new cache + # subdir for each process. The js shell takes care of deleting these + # subdirs when the process exits. + if options.max_jobs > 1 and jittests.HAVE_MULTIPROCESSING: + prefix += ['--js-cache-per-process'] + + # Clean up any remnants from previous crashes etc + shutil.rmtree(jittests.JS_CACHE_DIR, ignore_errors=True) + os.mkdir(jittests.JS_CACHE_DIR) + if options.debug: if len(job_list) > 1: print 'Multiple tests match command line arguments, debugger can only run one' for tc in job_list: print ' %s' % tc.path sys.exit(1) tc = job_list[0]
--- a/js/src/jit-test/lib/asm.js +++ b/js/src/jit-test/lib/asm.js @@ -1,30 +1,52 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ const ASM_OK_STRING = "successfully compiled asm.js code"; const ASM_TYPE_FAIL_STRING = "asm.js type error:"; const ASM_DIRECTIVE_FAIL_STRING = "\"use asm\" is only meaningful in the Directive Prologue of a function body"; -const USE_ASM = "'use asm';"; +const USE_ASM = '"use asm";'; const HEAP_IMPORTS = "const i8=new glob.Int8Array(b);var u8=new glob.Uint8Array(b);"+ "const i16=new glob.Int16Array(b);var u16=new glob.Uint16Array(b);"+ "const i32=new glob.Int32Array(b);var u32=new glob.Uint32Array(b);"+ "const f32=new glob.Float32Array(b);var f64=new glob.Float64Array(b);"; const BUF_64KB = new ArrayBuffer(64 * 1024); function asmCompile() { var f = Function.apply(null, arguments); assertEq(!isAsmJSCompilationAvailable() || isAsmJSModule(f), true); return f; } +function asmCompileCached() +{ + if (!isAsmJSCompilationAvailable()) + return Function.apply(null, arguments); + + if (!isCachingEnabled()) { + var f = Function.apply(null, arguments); + assertEq(isAsmJSModule(f), true); + return f; + } + + var quotedArgs = []; + for (var i = 0; i < arguments.length; i++) + quotedArgs.push("'" + arguments[i] + "'"); + var code = "var f = new Function(" + quotedArgs.join(',') + ");assertEq(isAsmJSModule(f), true);"; + nestedShell("--js-cache", "--execute=" + code); + + var f = Function.apply(null, arguments); + assertEq(isAsmJSModuleLoadedFromCache(f), true); + return f; +} + function assertAsmDirectiveFail(str) { if (!isAsmJSCompilationAvailable()) return; // Turn on warnings-as-errors var oldOpts = options("werror"); assertEq(oldOpts.indexOf("werror"), -1);
new file mode 100644 --- /dev/null +++ b/js/src/jit-test/lib/bullet.js @@ -0,0 +1,56007 @@ +// Note: For maximum-speed code, see "Optimizing Code" on the Emscripten wiki, https://github.com/kripken/emscripten/wiki/Optimizing-Code +// Note: Some Emscripten settings may limit the speed of the generated code. +// The Module object: Our interface to the outside world. We import +// and export values on it, and do the work to get that through +// closure compiler if necessary. There are various ways Module can be used: +// 1. Not defined. We create it here +// 2. A function parameter, function(Module) { ..generated code.. } +// 3. pre-run appended it, var Module = {}; ..generated code.. +// 4. External script tag defines var Module. +// We need to do an eval in order to handle the closure compiler +// case, where this code here is minified but Module was defined +// elsewhere (e.g. case 4 above). We also need to check if Module +// already exists (e.g. case 3 above). +// Note that if you want to run closure, and also to use Module +// after the generated code, you will need to define var Module = {}; +// before the code. Then that object will be used in the code, and you +// can continue to use Module afterwards as well. +var Module; +if (!Module) Module = eval('(function() { try { return Module || {} } catch(e) { return {} } })()'); +// Sometimes an existing Module object exists with properties +// meant to overwrite the default module functionality. Here +// we collect those properties and reapply _after_ we configure +// the current environment's defaults to avoid having to be so +// defensive during initialization. +var moduleOverrides = {}; +for (var key in Module) { + if (Module.hasOwnProperty(key)) { + moduleOverrides[key] = Module[key]; + } +} +// The environment setup code below is customized to use Module. +// *** Environment setup code *** +var printedOutput = ""; +Module['print'] = function f(str) { + printedOutput += str; +} +if (typeof printErr != 'undefined') Module['printErr'] = printErr; // not present in v8 or older sm +if (typeof read != 'undefined') { +Module['read'] = read; +} else { +Module['read'] = function() { throw 'no read() available (jsc?)' }; +} +Module['readBinary'] = function(f) { +return read(f, 'binary'); +}; +if (typeof scriptArgs != 'undefined') { +Module['arguments'] = scriptArgs; +} else if (typeof arguments != 'undefined') { +Module['arguments'] = arguments; +} +this['Module'] = Module; +function globalEval(x) { + eval.call(null, x); +} +if (!Module['load'] == 'undefined' && Module['read']) { + Module['load'] = function(f) { + globalEval(Module['read'](f)); + }; +} +if (!Module['printErr']) { + Module['printErr'] = Module['print']; +} +// *** Environment setup code *** +// Closure helpers +Module.print = Module['print']; +Module.printErr = Module['printErr']; +// Callbacks +Module['preRun'] = []; +Module['postRun'] = []; +// Merge back in the overrides +for (var key in moduleOverrides) { + if (moduleOverrides.hasOwnProperty(key)) { + Module[key] = moduleOverrides[key]; + } +} +// === Auto-generated preamble library stuff === +//======================================== +// Runtime code shared with compiler +//======================================== +var Runtime = { + stackSave: function () { + return STACKTOP; + }, + stackRestore: function (stackTop) { + STACKTOP = stackTop; + }, + forceAlign: function (target, quantum) { + quantum = quantum || 4; + if (quantum == 1) return target; + if (isNumber(target) && isNumber(quantum)) { + return Math.ceil(target/quantum)*quantum; + } else if (isNumber(quantum) && isPowerOfTwo(quantum)) { + var logg = log2(quantum); + return '((((' +target + ')+' + (quantum-1) + ')>>' + logg + ')<<' + logg + ')'; + } + return 'Math.ceil((' + target + ')/' + quantum + ')*' + quantum; + }, + isNumberType: function (type) { + return type in Runtime.INT_TYPES || type in Runtime.FLOAT_TYPES; + }, + isPointerType: function isPointerType(type) { + return type[type.length-1] == '*'; +}, + isStructType: function isStructType(type) { + if (isPointerType(type)) return false; + if (isArrayType(type)) return true; + if (/<?{ ?[^}]* ?}>?/.test(type)) return true; // { i32, i8 } etc. - anonymous struct types + // See comment in isStructPointerType() + return type[0] == '%'; +}, + INT_TYPES: {"i1":0,"i8":0,"i16":0,"i32":0,"i64":0}, + FLOAT_TYPES: {"float":0,"double":0}, + or64: function (x, y) { + var l = (x | 0) | (y | 0); + var h = (Math.round(x / 4294967296) | Math.round(y / 4294967296)) * 4294967296; + return l + h; + }, + and64: function (x, y) { + var l = (x | 0) & (y | 0); + var h = (Math.round(x / 4294967296) & Math.round(y / 4294967296)) * 4294967296; + return l + h; + }, + xor64: function (x, y) { + var l = (x | 0) ^ (y | 0); + var h = (Math.round(x / 4294967296) ^ Math.round(y / 4294967296)) * 4294967296; + return l + h; + }, + getNativeTypeSize: function (type, quantumSize) { + if (Runtime.QUANTUM_SIZE == 1) return 1; + var size = { + '%i1': 1, + '%i8': 1, + '%i16': 2, + '%i32': 4, + '%i64': 8, + "%float": 4, + "%double": 8 + }['%'+type]; // add '%' since float and double confuse Closure compiler as keys, and also spidermonkey as a compiler will remove 's from '_i8' etc + if (!size) { + if (type.charAt(type.length-1) == '*') { + size = Runtime.QUANTUM_SIZE; // A pointer + } else if (type[0] == 'i') { + var bits = parseInt(type.substr(1)); + assert(bits % 8 == 0); + size = bits/8; + } + } + return size; + }, + getNativeFieldSize: function (type) { + return Math.max(Runtime.getNativeTypeSize(type), Runtime.QUANTUM_SIZE); + }, + dedup: function dedup(items, ident) { + var seen = {}; + if (ident) { + return items.filter(function(item) { + if (seen[item[ident]]) return false; + seen[item[ident]] = true; + return true; + }); + } else { + return items.filter(function(item) { + if (seen[item]) return false; + seen[item] = true; + return true; + }); + } +}, + set: function set() { + var args = typeof arguments[0] === 'object' ? arguments[0] : arguments; + var ret = {}; + for (var i = 0; i < args.length; i++) { + ret[args[i]] = 0; + } + return ret; +}, + STACK_ALIGN: 8, + getAlignSize: function (type, size, vararg) { + // we align i64s and doubles on 64-bit boundaries, unlike x86 + if (type == 'i64' || type == 'double' || vararg) return 8; + if (!type) return Math.min(size, 8); // align structures internally to 64 bits + return Math.min(size || (type ? Runtime.getNativeFieldSize(type) : 0), Runtime.QUANTUM_SIZE); + }, + calculateStructAlignment: function calculateStructAlignment(type) { + type.flatSize = 0; + type.alignSize = 0; + var diffs = []; + var prev = -1; + var index = 0; + type.flatIndexes = type.fields.map(function(field) { + index++; + var size, alignSize; + if (Runtime.isNumberType(field) || Runtime.isPointerType(field)) { + size = Runtime.getNativeTypeSize(field); // pack char; char; in structs, also char[X]s. + alignSize = Runtime.getAlignSize(field, size); + } else if (Runtime.isStructType(field)) { + if (field[1] === '0') { + // this is [0 x something]. When inside another structure like here, it must be at the end, + // and it adds no size + // XXX this happens in java-nbody for example... assert(index === type.fields.length, 'zero-length in the middle!'); + size = 0; + if (Types.types[field]) { + alignSize = Runtime.getAlignSize(null, Types.types[field].alignSize); + } else { + alignSize = type.alignSize || QUANTUM_SIZE; + } + } else { + size = Types.types[field].flatSize; + alignSize = Runtime.getAlignSize(null, Types.types[field].alignSize); + } + } else if (field[0] == 'b') { + // bN, large number field, like a [N x i8] + size = field.substr(1)|0; + alignSize = 1; + } else { + throw 'Unclear type in struct: ' + field + ', in ' + type.name_ + ' :: ' + dump(Types.types[type.name_]); + } + if (type.packed) alignSize = 1; + type.alignSize = Math.max(type.alignSize, alignSize); + var curr = Runtime.alignMemory(type.flatSize, alignSize); // if necessary, place this on aligned memory + type.flatSize = curr + size; + if (prev >= 0) { + diffs.push(curr-prev); + } + prev = curr; + return curr; + }); + type.flatSize = Runtime.alignMemory(type.flatSize, type.alignSize); + if (diffs.length == 0) { + type.flatFactor = type.flatSize; + } else if (Runtime.dedup(diffs).length == 1) { + type.flatFactor = diffs[0]; + } + type.needsFlattening = (type.flatFactor != 1); + return type.flatIndexes; + }, + generateStructInfo: function (struct, typeName, offset) { + var type, alignment; + if (typeName) { + offset = offset || 0; + type = (typeof Types === 'undefined' ? Runtime.typeInfo : Types.types)[typeName]; + if (!type) return null; + if (type.fields.length != struct.length) { + printErr('Number of named fields must match the type for ' + typeName + ': possibly duplicate struct names. Cannot return structInfo'); + return null; + } + alignment = type.flatIndexes; + } else { + var type = { fields: struct.map(function(item) { return item[0] }) }; + alignment = Runtime.calculateStructAlignment(type); + } + var ret = { + __size__: type.flatSize + }; + if (typeName) { + struct.forEach(function(item, i) { + if (typeof item === 'string') { + ret[item] = alignment[i] + offset; + } else { + // embedded struct + var key; + for (var k in item) key = k; + ret[key] = Runtime.generateStructInfo(item[key], type.fields[i], alignment[i]); + } + }); + } else { + struct.forEach(function(item, i) { + ret[item[1]] = alignment[i]; + }); + } + return ret; + }, + dynCall: function (sig, ptr, args) { + if (args && args.length) { + if (!args.splice) args = Array.prototype.slice.call(args); + args.splice(0, 0, ptr); + return Module['dynCall_' + sig].apply(null, args); + } else { + return Module['dynCall_' + sig].call(null, ptr); + } + }, + functionPointers: [], + addFunction: function (func) { + for (var i = 0; i < Runtime.functionPointers.length; i++) { + if (!Runtime.functionPointers[i]) { + Runtime.functionPointers[i] = func; + return 2 + 2*i; + } + } + throw 'Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.'; + }, + removeFunction: function (index) { + Runtime.functionPointers[(index-2)/2] = null; + }, + warnOnce: function (text) { + if (!Runtime.warnOnce.shown) Runtime.warnOnce.shown = {}; + if (!Runtime.warnOnce.shown[text]) { + Runtime.warnOnce.shown[text] = 1; + Module.printErr(text); + } + }, + funcWrappers: {}, + getFuncWrapper: function (func, sig) { + assert(sig); + if (!Runtime.funcWrappers[func]) { + Runtime.funcWrappers[func] = function() { + return Runtime.dynCall(sig, func, arguments); + }; + } + return Runtime.funcWrappers[func]; + }, + UTF8Processor: function () { + var buffer = []; + var needed = 0; + this.processCChar = function (code) { + code = code & 0xFF; + if (buffer.length == 0) { + if ((code & 0x80) == 0x00) { // 0xxxxxxx + return String.fromCharCode(code); + } + buffer.push(code); + if ((code & 0xE0) == 0xC0) { // 110xxxxx + needed = 1; + } else if ((code & 0xF0) == 0xE0) { // 1110xxxx + needed = 2; + } else { // 11110xxx + needed = 3; + } + return ''; + } + if (needed) { + buffer.push(code); + needed--; + if (needed > 0) return ''; + } + var c1 = buffer[0]; + var c2 = buffer[1]; + var c3 = buffer[2]; + var c4 = buffer[3]; + var ret; + if (buffer.length == 2) { + ret = String.fromCharCode(((c1 & 0x1F) << 6) | (c2 & 0x3F)); + } else if (buffer.length == 3) { + ret = String.fromCharCode(((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F)); + } else { + // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + var codePoint = ((c1 & 0x07) << 18) | ((c2 & 0x3F) << 12) | + ((c3 & 0x3F) << 6) | (c4 & 0x3F); + ret = String.fromCharCode( + Math.floor((codePoint - 0x10000) / 0x400) + 0xD800, + (codePoint - 0x10000) % 0x400 + 0xDC00); + } + buffer.length = 0; + return ret; + } + this.processJSString = function(string) { + string = unescape(encodeURIComponent(string)); + var ret = []; + for (var i = 0; i < string.length; i++) { + ret.push(string.charCodeAt(i)); + } + return ret; + } + }, + stackAlloc: function (size) { var ret = STACKTOP;STACKTOP = (STACKTOP + size)|0;STACKTOP = ((((STACKTOP)+7)>>3)<<3); return ret; }, + staticAlloc: function (size) { var ret = STATICTOP;STATICTOP = (STATICTOP + size)|0;STATICTOP = ((((STATICTOP)+7)>>3)<<3); return ret; }, + dynamicAlloc: function (size) { var ret = DYNAMICTOP;DYNAMICTOP = (DYNAMICTOP + size)|0;DYNAMICTOP = ((((DYNAMICTOP)+7)>>3)<<3); if (DYNAMICTOP >= TOTAL_MEMORY) enlargeMemory();; return ret; }, + alignMemory: function (size,quantum) { var ret = size = Math.ceil((size)/(quantum ? quantum : 8))*(quantum ? quantum : 8); return ret; }, + makeBigInt: function (low,high,unsigned) { var ret = (unsigned ? ((+(((low)>>>(0))))+((+(((high)>>>(0))))*(+(4294967296)))) : ((+(((low)>>>(0))))+((+(((high)|(0))))*(+(4294967296))))); return ret; }, + GLOBAL_BASE: 8, + QUANTUM_SIZE: 4, + __dummy__: 0 +} +//======================================== +// Runtime essentials +//======================================== +var __THREW__ = 0; // Used in checking for thrown exceptions. +var ABORT = false; // whether we are quitting the application. no code should run after this. set in exit() and abort() +var EXITSTATUS = 0; +var undef = 0; +// tempInt is used for 32-bit signed values or smaller. tempBigInt is used +// for 32-bit unsigned values or more than 32 bits. TODO: audit all uses of tempInt +var tempValue, tempInt, tempBigInt, tempInt2, tempBigInt2, tempPair, tempBigIntI, tempBigIntR, tempBigIntS, tempBigIntP, tempBigIntD; +var tempI64, tempI64b; +var tempRet0, tempRet1, tempRet2, tempRet3, tempRet4, tempRet5, tempRet6, tempRet7, tempRet8, tempRet9; +function assert(condition, text) { + if (!condition) { + abort('Assertion failed: ' + text); + } +} +var globalScope = this; +// C calling interface. A convenient way to call C functions (in C files, or +// defined with extern "C"). +// +// Note: LLVM optimizations can inline and remove functions, after which you will not be +// able to call them. Closure can also do so. To avoid that, add your function to +// the exports using something like +// +// -s EXPORTED_FUNCTIONS='["_main", "_myfunc"]' +// +// @param ident The name of the C function (note that C++ functions will be name-mangled - use extern "C") +// @param returnType The return type of the function, one of the JS types 'number', 'string' or 'array' (use 'number' for any C pointer, and +// 'array' for JavaScript arrays and typed arrays; note that arrays are 8-bit). +// @param argTypes An array of the types of arguments for the function (if there are no arguments, this can be ommitted). Types are as in returnType, +// except that 'array' is not possible (there is no way for us to know the length of the array) +// @param args An array of the arguments to the function, as native JS values (as in returnType) +// Note that string arguments will be stored on the stack (the JS string will become a C string on the stack). +// @return The return value, as a native JS value (as in returnType) +function ccall(ident, returnType, argTypes, args) { + return ccallFunc(getCFunc(ident), returnType, argTypes, args); +} +Module["ccall"] = ccall; +// Returns the C function with a specified identifier (for C++, you need to do manual name mangling) +function getCFunc(ident) { + try { + var func = Module['_' + ident]; // closure exported function + if (!func) func = eval('_' + ident); // explicit lookup + } catch(e) { + } + assert(func, 'Cannot call unknown function ' + ident + ' (perhaps LLVM optimizations or closure removed it?)'); + return func; +} +// Internal function that does a C call using a function, not an identifier +function ccallFunc(func, returnType, argTypes, args) { + var stack = 0; + function toC(value, type) { + if (type == 'string') { + if (value === null || value === undefined || value === 0) return 0; // null string + if (!stack) stack = Runtime.stackSave(); + var ret = Runtime.stackAlloc(value.length+1); + writeStringToMemory(value, ret); + return ret; + } else if (type == 'array') { + if (!stack) stack = Runtime.stackSave(); + var ret = Runtime.stackAlloc(value.length); + writeArrayToMemory(value, ret); + return ret; + } + return value; + } + function fromC(value, type) { + if (type == 'string') { + return Pointer_stringify(value); + } + assert(type != 'array'); + return value; + } + var i = 0; + var cArgs = args ? args.map(function(arg) { + return toC(arg, argTypes[i++]); + }) : []; + var ret = fromC(func.apply(null, cArgs), returnType); + if (stack) Runtime.stackRestore(stack); + return ret; +} +// Returns a native JS wrapper for a C function. This is similar to ccall, but +// returns a function you can call repeatedly in a normal way. For example: +// +// var my_function = cwrap('my_c_function', 'number', ['number', 'number']); +// alert(my_function(5, 22)); +// alert(my_function(99, 12)); +// +function cwrap(ident, returnType, argTypes) { + var func = getCFunc(ident); + return function() { + return ccallFunc(func, returnType, argTypes, Array.prototype.slice.call(arguments)); + } +} +Module["cwrap"] = cwrap; +// Sets a value in memory in a dynamic way at run-time. Uses the +// type data. This is the same as makeSetValue, except that +// makeSetValue is done at compile-time and generates the needed +// code then, whereas this function picks the right code at +// run-time. +// Note that setValue and getValue only do *aligned* writes and reads! +// Note that ccall uses JS types as for defining types, while setValue and +// getValue need LLVM types ('i8', 'i32') - this is a lower-level operation +function setValue(ptr, value, type, noSafe) { + type = type || 'i8'; + if (type.charAt(type.length-1) === '*') type = 'i32'; // pointers are 32-bit + switch(type) { + case 'i1': HEAP8[(ptr)]=value; break; + case 'i8': HEAP8[(ptr)]=value; break; + case 'i16': HEAP16[((ptr)>>1)]=value; break; + case 'i32': HEAP32[((ptr)>>2)]=value; break; + case 'i64': (tempI64 = [value>>>0,(tempDouble=value,(+(Math.abs(tempDouble))) >= (+(1)) ? (tempDouble > (+(0)) ? ((Math.min((+(Math.floor((tempDouble)/(+(4294967296))))), (+(4294967295))))|0)>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/(+(4294967296)))))))>>>0) : 0)],HEAP32[((ptr)>>2)]=tempI64[0],HEAP32[(((ptr)+(4))>>2)]=tempI64[1]); break; + case 'float': HEAPF32[((ptr)>>2)]=value; break; + case 'double': HEAPF64[((ptr)>>3)]=value; break; + default: abort('invalid type for setValue: ' + type); + } +} +Module['setValue'] = setValue; +// Parallel to setValue. +function getValue(ptr, type, noSafe) { + type = type || 'i8'; + if (type.charAt(type.length-1) === '*') type = 'i32'; // pointers are 32-bit + switch(type) { + case 'i1': return HEAP8[(ptr)]; + case 'i8': return HEAP8[(ptr)]; + case 'i16': return HEAP16[((ptr)>>1)]; + case 'i32': return HEAP32[((ptr)>>2)]; + case 'i64': return HEAP32[((ptr)>>2)]; + case 'float': return HEAPF32[((ptr)>>2)]; + case 'double': return HEAPF64[((ptr)>>3)]; + default: abort('invalid type for setValue: ' + type); + } + return null; +} +Module['getValue'] = getValue; +var ALLOC_NORMAL = 0; // Tries to use _malloc() +var ALLOC_STACK = 1; // Lives for the duration of the current function call +var ALLOC_STATIC = 2; // Cannot be freed +var ALLOC_DYNAMIC = 3; // Cannot be freed except through sbrk +var ALLOC_NONE = 4; // Do not allocate +Module['ALLOC_NORMAL'] = ALLOC_NORMAL; +Module['ALLOC_STACK'] = ALLOC_STACK; +Module['ALLOC_STATIC'] = ALLOC_STATIC; +Module['ALLOC_DYNAMIC'] = ALLOC_DYNAMIC; +Module['ALLOC_NONE'] = ALLOC_NONE; +// allocate(): This is for internal use. You can use it yourself as well, but the interface +// is a little tricky (see docs right below). The reason is that it is optimized +// for multiple syntaxes to save space in generated code. So you should +// normally not use allocate(), and instead allocate memory using _malloc(), +// initialize it with setValue(), and so forth. +// @slab: An array of data, or a number. If a number, then the size of the block to allocate, +// in *bytes* (note that this is sometimes confusing: the next parameter does not +// affect this!) +// @types: Either an array of types, one for each byte (or 0 if no type at that position), +// or a single type which is used for the entire block. This only matters if there +// is initial data - if @slab is a number, then this does not matter at all and is +// ignored. +// @allocator: How to allocate memory, see ALLOC_* +function allocate(slab, types, allocator, ptr) { + var zeroinit, size; + if (typeof slab === 'number') { + zeroinit = true; + size = slab; + } else { + zeroinit = false; + size = slab.length; + } + var singleType = typeof types === 'string' ? types : null; + var ret; + if (allocator == ALLOC_NONE) { + ret = ptr; + } else { + ret = [_malloc, Runtime.stackAlloc, Runtime.staticAlloc, Runtime.dynamicAlloc][allocator === undefined ? ALLOC_STATIC : allocator](Math.max(size, singleType ? 1 : types.length)); + } + if (zeroinit) { + var ptr = ret, stop; + assert((ret & 3) == 0); + stop = ret + (size & ~3); + for (; ptr < stop; ptr += 4) { + HEAP32[((ptr)>>2)]=0; + } + stop = ret + size; + while (ptr < stop) { + HEAP8[((ptr++)|0)]=0; + } + return ret; + } + if (singleType === 'i8') { + if (slab.subarray || slab.slice) { + HEAPU8.set(slab, ret); + } else { + HEAPU8.set(new Uint8Array(slab), ret); + } + return ret; + } + var i = 0, type, typeSize, previousType; + while (i < size) { + var curr = slab[i]; + if (typeof curr === 'function') { + curr = Runtime.getFunctionIndex(curr); + } + type = singleType || types[i]; + if (type === 0) { + i++; + continue; + } + if (type == 'i64') type = 'i32'; // special case: we have one i32 here, and one i32 later + setValue(ret+i, curr, type); + // no need to look up size unless type changes, so cache it + if (previousType !== type) { + typeSize = Runtime.getNativeTypeSize(type); + previousType = type; + } + i += typeSize; + } + return ret; +} +Module['allocate'] = allocate; +function Pointer_stringify(ptr, /* optional */ length) { + // TODO: use TextDecoder + // Find the length, and check for UTF while doing so + var hasUtf = false; + var t; + var i = 0; + while (1) { + t = HEAPU8[(((ptr)+(i))|0)]; + if (t >= 128) hasUtf = true; + else if (t == 0 && !length) break; + i++; + if (length && i == length) break; + } + if (!length) length = i; + var ret = ''; + if (!hasUtf) { + var MAX_CHUNK = 1024; // split up into chunks, because .apply on a huge string can overflow the stack + var curr; + while (length > 0) { + curr = String.fromCharCode.apply(String, HEAPU8.subarray(ptr, ptr + Math.min(length, MAX_CHUNK))); + ret = ret ? ret + curr : curr; + ptr += MAX_CHUNK; + length -= MAX_CHUNK; + } + return ret; + } + var utf8 = new Runtime.UTF8Processor(); + for (i = 0; i < length; i++) { + t = HEAPU8[(((ptr)+(i))|0)]; + ret += utf8.processCChar(t); + } + return ret; +} +Module['Pointer_stringify'] = Pointer_stringify; +// Given a pointer 'ptr' to a null-terminated UTF16LE-encoded string in the emscripten HEAP, returns +// a copy of that string as a Javascript String object. +function UTF16ToString(ptr) { + var i = 0; + var str = ''; + while (1) { + var codeUnit = HEAP16[(((ptr)+(i*2))>>1)]; + if (codeUnit == 0) + return str; + ++i; + // fromCharCode constructs a character from a UTF-16 code unit, so we can pass the UTF16 string right through. + str += String.fromCharCode(codeUnit); + } +} +Module['UTF16ToString'] = UTF16ToString; +// Copies the given Javascript String object 'str' to the emscripten HEAP at address 'outPtr', +// null-terminated and encoded in UTF16LE form. The copy will require at most (str.length*2+1)*2 bytes of space in the HEAP. +function stringToUTF16(str, outPtr) { + for(var i = 0; i < str.length; ++i) { + // charCodeAt returns a UTF-16 encoded code unit, so it can be directly written to the HEAP. + var codeUnit = str.charCodeAt(i); // possibly a lead surrogate + HEAP16[(((outPtr)+(i*2))>>1)]=codeUnit + } + // Null-terminate the pointer to the HEAP. + HEAP16[(((outPtr)+(str.length*2))>>1)]=0 +} +Module['stringToUTF16'] = stringToUTF16; +// Given a pointer 'ptr' to a null-terminated UTF32LE-encoded string in the emscripten HEAP, returns +// a copy of that string as a Javascript String object. +function UTF32ToString(ptr) { + var i = 0; + var str = ''; + while (1) { + var utf32 = HEAP32[(((ptr)+(i*4))>>2)]; + if (utf32 == 0) + return str; + ++i; + // Gotcha: fromCharCode constructs a character from a UTF-16 encoded code (pair), not from a Unicode code point! So encode the code point to UTF-16 for constructing. + if (utf32 >= 0x10000) { + var ch = utf32 - 0x10000; + str += String.fromCharCode(0xD800 | (ch >> 10), 0xDC00 | (ch & 0x3FF)); + } else { + str += String.fromCharCode(utf32); + } + } +} +Module['UTF32ToString'] = UTF32ToString; +// Copies the given Javascript String object 'str' to the emscripten HEAP at address 'outPtr', +// null-terminated and encoded in UTF32LE form. The copy will require at most (str.length+1)*4 bytes of space in the HEAP, +// but can use less, since str.length does not return the number of characters in the string, but the number of UTF-16 code units in the string. +function stringToUTF32(str, outPtr) { + var iChar = 0; + for(var iCodeUnit = 0; iCodeUnit < str.length; ++iCodeUnit) { + // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code unit, not a Unicode code point of the character! We must decode the string to UTF-32 to the heap. + var codeUnit = str.charCodeAt(iCodeUnit); // possibly a lead surrogate + if (codeUnit >= 0xD800 && codeUnit <= 0xDFFF) { + var trailSurrogate = str.charCodeAt(++iCodeUnit); + codeUnit = 0x10000 + ((codeUnit & 0x3FF) << 10) | (trailSurrogate & 0x3FF); + } + HEAP32[(((outPtr)+(iChar*4))>>2)]=codeUnit + ++iChar; + } + // Null-terminate the pointer to the HEAP. + HEAP32[(((outPtr)+(iChar*4))>>2)]=0 +} +Module['stringToUTF32'] = stringToUTF32; +// Memory management +var PAGE_SIZE = 4096; +function alignMemoryPage(x) { + return ((x+4095)>>12)<<12; +} +var HEAP; +var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64; +var STATIC_BASE = 0, STATICTOP = 0, staticSealed = false; // static area +var STACK_BASE = 0, STACKTOP = 0, STACK_MAX = 0; // stack area +var DYNAMIC_BASE = 0, DYNAMICTOP = 0; // dynamic area handled by sbrk +function enlargeMemory() { + abort('Cannot enlarge memory arrays in asm.js. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value ' + TOTAL_MEMORY + ', or (2) set Module.TOTAL_MEMORY before the program runs.'); +} +var TOTAL_STACK = Module['TOTAL_STACK'] || 5242880; +var TOTAL_MEMORY = Module['TOTAL_MEMORY'] || 16777216; +var FAST_MEMORY = Module['FAST_MEMORY'] || 2097152; +// Initialize the runtime's memory +// check for full engine support (use string 'subarray' to avoid closure compiler confusion) +assert(!!Int32Array && !!Float64Array && !!(new Int32Array(1)['subarray']) && !!(new Int32Array(1)['set']), + 'Cannot fallback to non-typed array case: Code is too specialized'); +var buffer = new ArrayBuffer(TOTAL_MEMORY); +HEAP8 = new Int8Array(buffer); +HEAP16 = new Int16Array(buffer); +HEAP32 = new Int32Array(buffer); +HEAPU8 = new Uint8Array(buffer); +HEAPU16 = new Uint16Array(buffer); +HEAPU32 = new Uint32Array(buffer); +HEAPF32 = new Float32Array(buffer); +HEAPF64 = new Float64Array(buffer); +// Endianness check (note: assumes compiler arch was little-endian) +HEAP32[0] = 255; +assert(HEAPU8[0] === 255 && HEAPU8[3] === 0, 'Typed arrays 2 must be run on a little-endian system'); +Module['HEAP'] = HEAP; +Module['HEAP8'] = HEAP8; +Module['HEAP16'] = HEAP16; +Module['HEAP32'] = HEAP32; +Module['HEAPU8'] = HEAPU8; +Module['HEAPU16'] = HEAPU16; +Module['HEAPU32'] = HEAPU32; +Module['HEAPF32'] = HEAPF32; +Module['HEAPF64'] = HEAPF64; +function callRuntimeCallbacks(callbacks) { + while(callbacks.length > 0) { + var callback = callbacks.shift(); + if (typeof callback == 'function') { + callback(); + continue; + } + var func = callback.func; + if (typeof func === 'number') { + if (callback.arg === undefined) { + Runtime.dynCall('v', func); + } else { + Runtime.dynCall('vi', func, [callback.arg]); + } + } else { + func(callback.arg === undefined ? null : callback.arg); + } + } +} +var __ATPRERUN__ = []; // functions called before the runtime is initialized +var __ATINIT__ = []; // functions called during startup +var __ATMAIN__ = []; // functions called when main() is to be run +var __ATEXIT__ = []; // functions called during shutdown +var __ATPOSTRUN__ = []; // functions called after the runtime has exited +var runtimeInitialized = false; +function preRun() { + // compatibility - merge in anything from Module['preRun'] at this time + if (Module['preRun']) { + if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']]; + while (Module['preRun'].length) { + addOnPreRun(Module['preRun'].shift()); + } + } + callRuntimeCallbacks(__ATPRERUN__); +} +function ensureInitRuntime() { + if (runtimeInitialized) return; + runtimeInitialized = true; + callRuntimeCallbacks(__ATINIT__); +} +function preMain() { + callRuntimeCallbacks(__ATMAIN__); +} +function exitRuntime() { + callRuntimeCallbacks(__ATEXIT__); +} +function postRun() { + // compatibility - merge in anything from Module['postRun'] at this time + if (Module['postRun']) { + if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']]; + while (Module['postRun'].length) { + addOnPostRun(Module['postRun'].shift()); + } + } + callRuntimeCallbacks(__ATPOSTRUN__); +} +function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); +} +Module['addOnPreRun'] = Module.addOnPreRun = addOnPreRun; +function addOnInit(cb) { + __ATINIT__.unshift(cb); +} +Module['addOnInit'] = Module.addOnInit = addOnInit; +function addOnPreMain(cb) { + __ATMAIN__.unshift(cb); +} +Module['addOnPreMain'] = Module.addOnPreMain = addOnPreMain; +function addOnExit(cb) { + __ATEXIT__.unshift(cb); +} +Module['addOnExit'] = Module.addOnExit = addOnExit; +function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); +} +Module['addOnPostRun'] = Module.addOnPostRun = addOnPostRun; +// Tools +// This processes a JS string into a C-line array of numbers, 0-terminated. +// For LLVM-originating strings, see parser.js:parseLLVMString function +function intArrayFromString(stringy, dontAddNull, length /* optional */) { + var ret = (new Runtime.UTF8Processor()).processJSString(stringy); + if (length) { + ret.length = length; + } + if (!dontAddNull) { + ret.push(0); + } + return ret; +} +Module['intArrayFromString'] = intArrayFromString; +function intArrayToString(array) { + var ret = []; + for (var i = 0; i < array.length; i++) { + var chr = array[i]; + if (chr > 0xFF) { + chr &= 0xFF; + } + ret.push(String.fromCharCode(chr)); + } + return ret.join(''); +} +Module['intArrayToString'] = intArrayToString; +// Write a Javascript array to somewhere in the heap +function writeStringToMemory(string, buffer, dontAddNull) { + var array = intArrayFromString(string, dontAddNull); + var i = 0; + while (i < array.length) { + var chr = array[i]; + HEAP8[(((buffer)+(i))|0)]=chr + i = i + 1; + } +} +Module['writeStringToMemory'] = writeStringToMemory; +function writeArrayToMemory(array, buffer) { + for (var i = 0; i < array.length; i++) { + HEAP8[(((buffer)+(i))|0)]=array[i]; + } +} +Module['writeArrayToMemory'] = writeArrayToMemory; +function unSign(value, bits, ignore, sig) { + if (value >= 0) { + return value; + } + return bits <= 32 ? 2*Math.abs(1 << (bits-1)) + value // Need some trickery, since if bits == 32, we are right at the limit of the bits JS uses in bitshifts + : Math.pow(2, bits) + value; +} +function reSign(value, bits, ignore, sig) { + if (value <= 0) { + return value; + } + var half = bits <= 32 ? Math.abs(1 << (bits-1)) // abs is needed if bits == 32 + : Math.pow(2, bits-1); + if (value >= half && (bits <= 32 || value > half)) { // for huge values, we can hit the precision limit and always get true here. so don't do that + // but, in general there is no perfect solution here. With 64-bit ints, we get rounding and errors + // TODO: In i64 mode 1, resign the two parts separately and safely + value = -2*half + value; // Cannot bitshift half, as it may be at the limit of the bits JS uses in bitshifts + } + return value; +} +if (!Math['imul']) Math['imul'] = function(a, b) { + var ah = a >>> 16; + var al = a & 0xffff; + var bh = b >>> 16; + var bl = b & 0xffff; + return (al*bl + ((ah*bl + al*bh) << 16))|0; +}; +Math.imul = Math['imul']; +// A counter of dependencies for calling run(). If we need to +// do asynchronous work before running, increment this and +// decrement it. Incrementing must happen in a place like +// PRE_RUN_ADDITIONS (used by emcc to add file preloading). +// Note that you can add dependencies in preRun, even though +// it happens right before run - run will be postponed until +// the dependencies are met. +var runDependencies = 0; +var runDependencyTracking = {}; +var calledInit = false, calledRun = false; +var runDependencyWatcher = null; +function addRunDependency(id) { + runDependencies++; + if (Module['monitorRunDependencies']) { + Module['monitorRunDependencies'](runDependencies); + } + if (id) { + assert(!runDependencyTracking[id]); + runDependencyTracking[id] = 1; + } else { + Module.printErr('warning: run dependency added without ID'); + } +} +Module['addRunDependency'] = addRunDependency; +function removeRunDependency(id) { + runDependencies--; + if (Module['monitorRunDependencies']) { + Module['monitorRunDependencies'](runDependencies); + } + if (id) { + assert(runDependencyTracking[id]); + delete runDependencyTracking[id]; + } else { + Module.printErr('warning: run dependency removed without ID'); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + // If run has never been called, and we should call run (INVOKE_RUN is true, and Module.noInitialRun is not false) + if (!calledRun) run(); + } +} +Module['removeRunDependency'] = removeRunDependency; +Module["preloadedImages"] = {}; // maps url to image data +Module["preloadedAudios"] = {}; // maps url to audio data +function loadMemoryInitializer(filename) { + function applyData(data) { + HEAPU8.set(data, STATIC_BASE); + } + // always do this asynchronously, to keep shell and web as similar as possible + addOnPreRun(function() { + if (ENVIRONMENT_IS_NODE || ENVIRONMENT_IS_SHELL) { + applyData(Module['readBinary'](filename)); + } else { + Browser.asyncLoad(filename, function(data) { + applyData(data); + }, function(data) { + throw 'could not load memory initializer ' + filename; + }); + } + }); +} +// === Body === +STATIC_BASE = 8; +STATICTOP = STATIC_BASE + 14352; +/* global initializers */ __ATINIT__.push({ func: function() { runPostSets() } },{ func: function() { __GLOBAL__I_a() } }); +var ___dso_handle; +var __ZTVN10__cxxabiv120__si_class_type_infoE; +var __ZTVN10__cxxabiv117__class_type_infoE; +var __ZN23btDiscreteDynamicsWorldC1EP12btDispatcherP21btBroadphaseInterfaceP18btConstraintSolverP24btCollisionConfiguration; +var __ZN11btRigidBodyC1ERKNS_27btRigidBodyConstructionInfoE; +var __ZN11btRigidBodyC1EfP13btMotionStateP16btCollisionShapeRK9btVector3; +var __ZN35btSequentialImpulseConstraintSolverC1Ev; +var __ZN21btCollisionDispatcherC1EP24btCollisionConfiguration; +var __ZN27btContinuousConvexCollisionC1EPK13btConvexShapeS2_P22btVoronoiSimplexSolverP30btConvexPenetrationDepthSolver; +var __ZN27btContinuousConvexCollisionC1EPK13btConvexShapePK18btStaticPlaneShape; +var __ZN16btDbvtBroadphaseC1EP22btOverlappingPairCache; +var __ZN31btDefaultCollisionConfigurationC1ERK34btDefaultCollisionConstructionInfo; +var __ZN16btEmptyAlgorithmC1ERK36btCollisionAlgorithmConstructionInfo; +var __ZN17btGjkPairDetectorC1EPK13btConvexShapeS2_P22btVoronoiSimplexSolverP30btConvexPenetrationDepthSolver; +var __ZN17btGjkPairDetectorC1EPK13btConvexShapeS2_iiffP22btVoronoiSimplexSolverP30btConvexPenetrationDepthSolver; +var __ZN16btManifoldResultC1EP17btCollisionObjectS1_; +var __ZN28btHashedOverlappingPairCacheC1Ev; +var __ZN25btSimulationIslandManagerC1Ev; +var __ZN32btSphereSphereCollisionAlgorithmC1EP20btPersistentManifoldRK36btCollisionAlgorithmConstructionInfoP17btCollisionObjectS6_; +var __ZN34btSphereTriangleCollisionAlgorithmC1EP20btPersistentManifoldRK36btCollisionAlgorithmConstructionInfoP17btCollisionObjectS6_b; +var __ZN22btSubsimplexConvexCastC1EPK13btConvexShapeS2_P22btVoronoiSimplexSolver; +var __ZN11btUnionFindD1Ev; +var __ZN11btUnionFindC1Ev; +var __ZN22SphereTriangleDetectorC1EP13btSphereShapeP15btTriangleShapef; +var __ZN26btBoxBoxCollisionAlgorithmC1EP20btPersistentManifoldRK36btCollisionAlgorithmConstructionInfoP17btCollisionObjectS6_; +var __ZN16btBoxBoxDetectorC1EP10btBoxShapeS1_; +var __ZN28btCompoundCollisionAlgorithmC1ERK36btCollisionAlgorithmConstructionInfoP17btCollisionObjectS4_b; +var __ZN33btConvexConcaveCollisionAlgorithmC1ERK36btCollisionAlgorithmConstructionInfoP17btCollisionObjectS4_b; +var __ZN23btConvexConvexAlgorithm10CreateFuncC1EP22btVoronoiSimplexSolverP30btConvexPenetrationDepthSolver; +var __ZN31btConvexPlaneCollisionAlgorithmC1EP20btPersistentManifoldRK36btCollisionAlgorithmConstructionInfoP17btCollisionObjectS6_bii; +var __ZN18btConvexPolyhedronC1Ev; +var __ZN6btDbvtC1Ev; +var __ZN6btDbvtD1Ev; +var __ZN15btGjkConvexCastC1EPK13btConvexShapeS2_P22btVoronoiSimplexSolver; +__ZTVN10__cxxabiv120__si_class_type_infoE=allocate([0,0,0,0,96,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], "i8", ALLOC_STATIC); +__ZTVN10__cxxabiv117__class_type_infoE=allocate([0,0,0,0,112,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], "i8", ALLOC_STATIC); +/* memory initializer */ allocate([0,0,0,64,0,0,0,0,10,215,163,60,0,0,0,0,98,116,67,111,108,108,105,115,105,111,110,79,98,106,101,99,116,70,108,111,97,116,68,97,116,97,0,0,0,0,0,0,99,111,110,118,101,120,83,119,101,101,112,84,101,115,116,0,67,67,68,32,109,111,116,105,111,110,32,99,108,97,109,112,105,110,103,0,0,0,0,0,99,111,110,118,101,120,83,119,101,101,112,67,111,109,112,111,117,110,100,0,0,0,0,0,105,110,116,101,103,114,97,116,101,84,114,97,110,115,102,111,114,109,115,0,0,0,0,0,100,105,115,112,97,116,99,104,65,108,108,67,111,108,108,105,115,105,111,110,80,97,105,114,115,0,0,0,0,0,0,0,99,97,108,99,117,108,97,116,101,83,105,109,117,108,97,116,105,111,110,73,115,108,97,110,100,115,0,0,0,0,0,0,99,97,108,99,117,108,97,116,101,79,118,101,114,108,97,112,112,105,110,103,80,97,105,114,115,0,0,0,0,0,0,0,115,111,108,118,101,67,111,110,115,116,114,97,105,110,116,115,0,0,0,0,0,0,0,0,82,111,111,116,0,0,0,0,112,101,114,102,111,114,109,68,105,115,99,114,101,116,101,67,111,108,108,105,115,105,111,110,68,101,116,101,99,116,105,111,110,0,0,0,0,0,0,0,117,112,100,97,116,101,65,99,116,105,118,97,116,105,111,110,83,116,97,116,101,0,0,0,66,117,108,108,101,116,67,111,108,108,105,115,105,111,110,47,78,97,114,114,111,119,80,104,97,115,101,67,111,108,108,105,115,105,111,110,47,98,116,80,111,108,121,104,101,100,114,97,108,67,111,110,116,97,99,116,67,108,105,112,112,105,110,103,46,99,112,112,0,0,0,0,115,111,108,118,101,71,114,111,117,112,67,97,99,104,101,70,114,105,101,110,100,108,121,83,101,116,117,112,0,0,0,0,117,112,100,97,116,101,65,97,98,98,115,0,0,0,0,0,117,112,100,97,116,101,65,99,116,105,111,110,115,0,0,0,115,116,100,58,58,98,97,100,95,97,108,108,111,99,0,0,84,104,97,110,107,115,46,10,0,0,0,0,0,0,0,0,105,115,108,97,110,100,85,110,105,111,110,70,105,110,100,65,110,100,81,117,105,99,107,83,111,114,116,0,0,0,0,0,105,110,116,101,114,110,97,108,83,105,110,103,108,101,83,116,101,112,83,105,109,117,108,97,116,105,111,110,0,0,0,0,100,49,62,61,48,46,48,102,0,0,0,0,0,0,0,0,115,111,108,118,101,71,114,111,117,112,0,0,0,0,0,0,98,116,82,105,103,105,100,66,111,100,121,70,108,111,97,116,68,97,116,97,0,0,0,0,80,108,101,97,115,101,32,105,110,99,108,117,100,101,32,97,98,111,118,101,32,105,110,102,111,114,109,97,116,105,111,110,44,32,121,111,117,114,32,80,108,97,116,102,111,114,109,44,32,118,101,114,115,105,111,110,32,111,102,32,79,83,46,10,0,0,0,0,0,0,0,0,115,116,101,112,83,105,109,117,108,97,116,105,111,110,0,0,66,111,120,0,0,0,0,0,100,48,62,61,48,46,48,102,0,0,0,0,0,0,0,0,115,111,108,118,101,71,114,111,117,112,67,97,99,104,101,70,114,105,101,110,100,108,121,73,116,101,114,97,116,105,111,110,115,0,0,0,0,0,0,0,83,80,72,69,82,69,0,0,112,114,111,99,101,115,115,73,115,108,97,110,100,115,0,0,98,116,67,111,110,118,101,120,73,110,116,101,114,110,97,108,83,104,97,112,101,68,97,116,97,0,0,0,0,0,0,0,84,114,105,97,110,103,108,101,0,0,0,0,0,0,0,0,112,114,101,100,105,99,116,85,110,99,111,110,115,116,114,97,105,110,116,77,111,116,105,111,110,0,0,0,0,0,0,0,79,118,101,114,102,108,111,119,32,105,110,32,65,65,66,66,44,32,111,98,106,101,99,116,32,114,101,109,111,118,101,100,32,102,114,111,109,32,115,105,109,117,108,97,116,105,111,110,0,0,0,0,0,0,0,0,115,121,110,99,104,114,111,110,105,122,101,77,111,116,105,111,110,83,116,97,116,101,115,0,73,102,32,121,111,117,32,99,97,110,32,114,101,112,114,111,100,117,99,101,32,116,104,105,115,44,32,112,108,101,97,115,101,32,101,109,97,105,108,32,98,117,103,115,64,99,111,110,116,105,110,117,111,117,115,112,104,121,115,105,99,115,46,99,111,109,10,0,0,0,0,0,115,101,97,114,99,104,32,115,112,101,99,117,108,97,116,105,118,101,32,99,111,110,116,97,99,116,115,0,0,0,0,0,98,116,67,111,108,108,105,115,105,111,110,83,104,97,112,101,68,97,116,97,0,0,0,0,97,100,100,83,112,101,99,117,108,97,116,105,118,101,67,111,110,116,97,99,116,115,0,0,100,101,98,117,103,68,114,97,119,87,111,114,108,100,0,0,119,111,114,108,100,32,112,111,115,32,61,32,37,46,50,102,44,37,46,50,102,44,37,46,50,102,10,0,0,0,0,0,98,111,111,108,32,84,101,115,116,83,101,112,65,120,105,115,40,99,111,110,115,116,32,98,116,67,111,110,118,101,120,80,111,108,121,104,101,100,114,111,110,32,38,44,32,99,111,110,115,116,32,98,116,67,111,110,118,101,120,80,111,108,121,104,101,100,114,111,110,32,38,44,32,99,111,110,115,116,32,98,116,84,114,97,110,115,102,111,114,109,32,38,44,32,99,111,110,115,116,32,98,116,84,114,97,110,115,102,111,114,109,32,38,44,32,99,111,110,115,116,32,98,116,86,101,99,116,111,114,51,32,38,44,32,102,108,111,97,116,32,38,41,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,40,0,0,20,1,0,0,44,0,0,0,86,0,0,0,4,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,40,0,0,84,0,0,0,42,0,0,0,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,40,0,0,90,0,0,0,204,0,0,0,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,144,40,0,0,116,1,0,0,90,1,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,40,0,0,196,0,0,0,104,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,176,40,0,0,98,1,0,0,50,1,0,0,26,0,0,0,16,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,40,0,0,8,1,0,0,40,0,0,0,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,208,40,0,0,198,0,0,0,56,1,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,40,0,0,4,0,0,0,14,0,0,0,26,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,40,0,0,122,0,0,0,30,0,0,0,26,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,0,0,236,0,0,0,98,0,0,0,38,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,41,0,0,114,0,0,0,158,0,0,0,10,0,0,0,76,0,0,0,2,0,0,0,32,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,41,0,0,124,0,0,0,168,0,0,0,40,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,41,0,0,22,0,0,0,184,0,0,0,40,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,41,0,0,64,1,0,0,190,0,0,0,22,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,41,0,0,32,0,0,0,180,0,0,0,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,41,0,0,94,1,0,0,240,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,144,41,0,0,28,0,0,0,20,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,41,0,0,228,0,0,0,248,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,176,41,0,0,72,0,0,0,60,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,41,0,0,82,1,0,0,92,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,208,41,0,0,112,0,0,0,142,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,41,0,0,150,0,0,0,100,1,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,41,0,0,48,1,0,0,202,0,0,0,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,42,0,0,102,1,0,0,220,0,0,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,42,0,0,88,1,0,0,30,1,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,42,0,0,34,0,0,0,200,0,0,0,30,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,42,0,0,20,0,0,0,34,0,0,0,80,0,0,0,100,0,0,0,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,42,0,0,6,0,0,0,14,1,0,0,74,0,0,0,214,0,0,0,4,0,0,0,2,0,0,0,32,0,0,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,152,42,0,0,112,1,0,0,38,0,0,0,56,0,0,0,2,0,0,0,30,0,0,0,162,0,0,0,2,0,0,0,6,0,0,0,2,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,168,42,0,0,156,0,0,0,2,0,0,0,2,0,0,0,16,0,0,0,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,184,42,0,0,54,1,0,0,70,1,0,0,24,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,200,42,0,0,52,0,0,0,182,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,216,42,0,0,146,0,0,0,62,1,0,0,26,0,0,0,8,0,0,0,98,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,232,42,0,0,118,1,0,0,6,1,0,0,14,0,0,0,2,0,0,0,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,43,0,0,88,0,0,0,224,0,0,0,32,0,0,0,36,0,0,0,40,0,0,0,20,0,0,0,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,43,0,0,120,1,0,0,218,0,0,0,20,0,0,0,6,0,0,0,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,43,0,0,32,1,0,0,178,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,43,0,0,106,0,0,0,250,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,43,0,0,96,1,0,0,174,0,0,0,26,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,43,0,0,144,0,0,0,38,1,0,0,10,0,0,0,22,0,0,0,48,0,0,0,6,0,0,0,24,0,0,0,60,0,0,0,14,0,0,0,14,0,0,0,24,0,0,0,68,0,0,0,62,0,0,0,12,0,0,0,58,0,0,0,36,0,0,0,82,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,43,0,0,102,0,0,0,68,1,0,0,4,0,0,0,10,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,43,0,0,10,1,0,0,22,1,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,144,43,0,0,8,0,0,0,252,0,0,0,28,0,0,0,4,0,0,0,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,43,0,0,58,1,0,0,26,0,0,0,40,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,176,43,0,0,52,1,0,0,104,1,0,0,22,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,43,0,0,84,1,0,0,238,0,0,0,52,0,0,0,70,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,208,43,0,0,40,1,0,0,74,1,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,43,0,0,80,0,0,0,26,1,0,0,58,0,0,0,60,0,0,0,4,0,0,0,2,0,0,0,2,0,0,0,56,0,0,0,4,0,0,0,2,0,0,0,4,0,0,0,6,0,0,0,34,0,0,0,6,0,0,0,86,0,0,0,38,0,0,0,42,0,0,0,28,0,0,0,38,0,0,0,12,0,0,0,78,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,0,0,242,0,0,0,132,0,0,0,96,0,0,0,22,0,0,0,30,0,0,0,86,1,0,0,14,0,0,0,60,0,0,0,70,0,0,0,78,0,0,0,176,0,0,0,50,0,0,0,2,0,0,0,68,0,0,0,40,0,0,0,106,0,0,0,10,0,0,0,38,0,0,0,44,0,0,0,154,0,0,0,42,0,0,0,56,0,0,0,104,0,0,0,70,0,0,0,64,0,0,0,8,0,0,0,34,0,0,0,36,0,0,0,54,0,0,0,210,0,0,0,74,0,0,0,8,0,0,0,26,0,0,0,46,0,0,0,14,0,0,0,10,0,0,0,8,0,0,0,94,0,0,0,94,0,0,0,16,0,0,0,18,0,0,0,62,0,0,0,66,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,44,0,0,66,1,0,0,82,0,0,0,16,0,0,0,12,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,44,0,0,48,0,0,0,232,0,0,0,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,44,0,0,18,0,0,0,18,1,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,44,0,0,42,1,0,0,110,0,0,0,10,0,0,0,52,0,0,0,2,0,0,0,32,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,44,0,0,4,1,0,0,172,0,0,0,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,44,0,0,254,0,0,0,16,1,0,0,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,152,44,0,0,186,0,0,0,208,0,0,0,58,0,0,0,60,0,0,0,4,0,0,0,2,0,0,0,2,0,0,0,56,0,0,0,2,0,0,0,2,0,0,0,4,0,0,0,6,0,0,0,34,0,0,0,6,0,0,0,86,0,0,0,38,0,0,0,2,0,0,0,2,0,0,0,38,0,0,0,12,0,0,0,78,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,168,44,0,0,46,1,0,0,36,0,0,0,8,0,0,0,2,0,0,0,12,0,0,0,100,0,0,0,8,0,0,0,16,0,0,0,44,0,0,0,44,0,0,0,16,0,0,0,48,0,0,0,26,0,0,0,70,0,0,0,12,0,0,0,58,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,44,0,0,216,0,0,0,114,1,0,0,20,0,0,0,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,208,44,0,0,24,0,0,0,140,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,216,44,0,0,138,0,0,0,2,1,0,0,10,0,0,0,6,0,0,0,2,0,0,0,32,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,232,44,0,0,136,0,0,0,170,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,44,0,0,230,0,0,0,108,1,0,0,10,0,0,0,80,0,0,0,2,0,0,0,32,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,45,0,0,54,0,0,0,0,1,0,0,2,0,0,0,92,0,0,0,2,0,0,0,32,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,45,0,0,70,0,0,0,212,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,45,0,0,28,1,0,0,60,1,0,0,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,45,0,0,20,0,0,0,118,0,0,0,24,1,0,0,30,0,0,0,76,0,0,0,22,0,0,0,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,45,0,0,194,0,0,0,134,0,0,0,68,0,0,0,16,0,0,0,252,255,255,255,80,45,0,0,130,0,0,0,108,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,45,0,0,16,0,0,0,222,0,0,0,34,0,0,0,50,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,45,0,0,12,0,0,0,110,1,0,0,52,0,0,0,70,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,144,45,0,0,116,0,0,0,160,0,0,0,38,0,0,0,14,0,0,0,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,45,0,0,66,0,0,0,188,0,0,0,2,0,0,0,58,0,0,0,12,0,0,0,54,0,0,0,8,0,0,0,12,0,0,0,56,0,0,0,62,0,0,0,68,0,0,0,84,0,0,0,48,0,0,0,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,176,45,0,0,128,0,0,0,106,1,0,0,96,0,0,0,22,0,0,0,30,0,0,0,78,0,0,0,14,0,0,0,60,0,0,0,8,0,0,0,24,0,0,0,176,0,0,0,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,45,0,0,226,0,0,0,72,1,0,0,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,208,45,0,0,166,0,0,0,50,0,0,0,66,0,0,0,60,0,0,0,4,0,0,0,2,0,0,0,2,0,0,0,56,0,0,0,2,0,0,0,18,0,0,0,4,0,0,0,6,0,0,0,34,0,0,0,6,0,0,0,86,0,0,0,38,0,0,0,6,0,0,0,50,0,0,0,38,0,0,0,42,0,0,0,12,0,0,0,2,0,0,0,50,0,0,0,4,0,0,0,20,0,0,0,30,0,0,0,28,0,0,0,6,0,0,0,2,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,45,0,0,120,0,0,0,10,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,46,0,0,46,0,0,0,76,1,0,0,10,0,0,0,60,0,0,0,4,0,0,0,2,0,0,0,2,0,0,0,56,0,0,0,6,0,0,0,16,0,0,0,12,0,0,0,2,0,0,0,34,0,0,0,6,0,0,0,86,0,0,0,46,0,0,0,18,0,0,0,34,0,0,0,38,0,0,0,12,0,0,0,78,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,46,0,0,206,0,0,0,78,1,0,0,2,0,0,0,60,0,0,0,4,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,10,0,0,0,14,0,0,0,86,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,46,0,0,6,0,0,0,12,1,0,0,34,1,0,0,30,0,0,0,20,0,0,0,18,0,0,0,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,46,0,0,148,0,0,0,86,0,0,0,48,0,0,0,60,0,0,0,4,0,0,0,2,0,0,0,64,0,0,0,56,0,0,0,8,0,0,0,72,0,0,0,2,0,0,0,6,0,0,0,34,0,0,0,6,0,0,0,86,0,0,0,72,0,0,0,64,0,0,0,46,0,0,0,38,0,0,0,46,0,0,0,8,0,0,0,2,0,0,0,22,0,0,0,38,0,0,0,18,0,0,0,54,0,0,0,52,0,0,0,62,0,0,0,4,0,0,0,28,0,0,0,0,0,0,0,0,0,0,0,90,78,51,51,98,116,77,105,110,107,111,119,115,107,105,80,101,110,101,116,114,97,116,105,111,110,68,101,112,116,104,83,111,108,118,101,114,49,50,99,97,108,99,80,101,110,68,101,112,116,104,69,82,50,50,98,116,86,111,114,111,110,111,105,83,105,109,112,108,101,120,83,111,108,118,101,114,80,75,49,51,98,116,67,111,110,118,101,120,83,104,97,112,101,83,52,95,82,75,49,49,98,116,84,114,97,110,115,102,111,114,109,83,55,95,82,57,98,116,86,101,99,116,111,114,51,83,57,95,83,57,95,80,49,50,98,116,73,68,101,98,117,103,68,114,97,119,80,49,50,98,116,83,116,97,99,107,65,108,108,111,99,69,50,48,98,116,73,110,116,101,114,109,101,100,105,97,116,101,82,101,115,117,108,116,0,0,0,0,0,0,0,90,78,51,51,98,116,67,111,110,118,101,120,67,111,110,99,97,118,101,67,111,108,108,105,115,105,111,110,65,108,103,111,114,105,116,104,109,50,49,99,97,108,99,117,108,97,116,101,84,105,109,101,79,102,73,109,112,97,99,116,69,80,49,55,98,116,67,111,108,108,105,115,105,111,110,79,98,106,101,99,116,83,49,95,82,75,49,54,98,116,68,105,115,112,97,116,99,104,101,114,73,110,102,111,80,49,54,98,116,77,97,110,105,102,111,108,100,82,101,115,117,108,116,69,51,49,76,111,99,97,108,84,114,105,97,110,103,108,101,83,112,104,101,114,101,67,97,115,116,67,97,108,108,98,97,99,107,0,0,0,90,78,50,56,98,116,72,97,115,104,101,100,79,118,101,114,108,97,112,112,105,110,103,80,97,105,114,67,97,99,104,101,51,55,114,101,109,111,118,101,79,118,101,114,108,97,112,112,105,110,103,80,97,105,114,115,67,111,110,116,97,105,110,105,110,103,80,114,111,120,121,69,80,49,55,98,116,66,114,111,97,100,112,104,97,115,101,80,114,111,120,121,80,49,50,98,116,68,105,115,112,97,116,99,104,101,114,69,49,56,82,101,109,111,118,101,80,97,105,114,67,97,108,108,98,97,99,107,0,0,0,0,0,0,0,0,90,78,50,56,98,116,72,97,115,104,101,100,79,118,101,114,108,97,112,112,105,110,103,80,97,105,114,67,97,99,104,101,49,57,99,108,101,97,110,80,114,111,120,121,70,114,111,109,80,97,105,114,115,69,80,49,55,98,116,66,114,111,97,100,112,104,97,115,101,80,114,111,120,121,80,49,50,98,116,68,105,115,112,97,116,99,104,101,114,69,49,55,67,108,101,97,110,80,97,105,114,67,97,108,108,98,97,99,107,0,0,0,90,78,50,51,98,116,68,105,115,99,114,101,116,101,68,121,110,97,109,105,99,115,87,111,114,108,100,49,54,115,111,108,118,101,67,111,110,115,116,114,97,105,110,116,115,69,82,49,57,98,116,67,111,110,116,97,99,116,83,111,108,118,101,114,73,110,102,111,69,50,55,73,110,112,108,97,99,101,83,111,108,118,101,114,73,115,108,97,110,100,67,97,108,108,98,97,99,107,0,0,0,0,0,0,90,78,50,51,98,116,67,111,110,118,101,120,67,111,110,118,101,120,65,108,103,111,114,105,116,104,109,49,54,112,114,111,99,101,115,115,67,111,108,108,105,115,105,111,110,69,80,49,55,98,116,67,111,108,108,105,115,105,111,110,79,98,106,101,99,116,83,49,95,82,75,49,54,98,116,68,105,115,112,97,116,99,104,101,114,73,110,102,111,80,49,54,98,116,77,97,110,105,102,111,108,100,82,101,115,117,108,116,69,49,51,98,116,68,117,109,109,121,82,101,115,117,108,116,0,0,0,0,90,78,50,50,98,116,66,118,104,84,114,105,97,110,103,108,101,77,101,115,104,83,104,97,112,101,49,55,112,101,114,102,111,114,109,67,111,110,118,101,120,99,97,115,116,69,80,49,56,98,116,84,114,105,97,110,103,108,101,67,97,108,108,98,97,99,107,82,75,57,98,116,86,101,99,116,111,114,51,83,52,95,83,52,95,83,52,95,69,50,49,77,121,78,111,100,101,79,118,101,114,108,97,112,67,97,108,108,98,97,99,107,0,0,0,0,0,0,0,0,90,78,50,50,98,116,66,118,104,84,114,105,97,110,103,108,101,77,101,115,104,83,104,97,112,101,49,52,112,101,114,102,111,114,109,82,97,121,99,97,115,116,69,80,49,56,98,116,84,114,105,97,110,103,108,101,67,97,108,108,98,97,99,107,82,75,57,98,116,86,101,99,116,111,114,51,83,52,95,69,50,49,77,121,78,111,100,101,79,118,101,114,108,97,112,67,97,108,108,98,97,99,107,0,90,78,49,54,98,116,67,111,108,108,105,115,105,111,110,87,111,114,108,100,49,55,111,98,106,101,99,116,81,117,101,114,121,83,105,110,103,108,101,69,80,75,49,51,98,116,67,111,110,118,101,120,83,104,97,112,101,82,75,49,49,98,116,84,114,97,110,115,102,111,114,109,83,53,95,80,49,55,98,116,67,111,108,108,105,115,105,111,110,79,98,106,101,99,116,80,75,49,54,98,116,67,111,108,108,105,115,105,111,110,83,104,97,112,101,83,53,95,82,78,83,95,50,48,67,111,110,118,101,120,82,101,115,117,108,116,67,97,108,108,98,97,99,107,69,102,69,51,50,66,114,105,100,103,101,84,114,105,97,110,103,108,101,67,111,110,118,101,120,99,97,115,116,67,97,108,108,98,97,99,107,95,48,0,90,78,49,54,98,116,67,111,108,108,105,115,105,111,110,87,111,114,108,100,49,55,111,98,106,101,99,116,81,117,101,114,121,83,105,110,103,108,101,69,80,75,49,51,98,116,67,111,110,118,101,120,83,104,97,112,101,82,75,49,49,98,116,84,114,97,110,115,102,111,114,109,83,53,95,80,49,55,98,116,67,111,108,108,105,115,105,111,110,79,98,106,101,99,116,80,75,49,54,98,116,67,111,108,108,105,115,105,111,110,83,104,97,112,101,83,53,95,82,78,83,95,50,48,67,111,110,118,101,120,82,101,115,117,108,116,67,97,108,108,98,97,99,107,69,102,69,51,50,66,114,105,100,103,101,84,114,105,97,110,103,108,101,67,111,110,118,101,120,99,97,115,116,67,97,108,108,98,97,99,107,0,0,0,90,78,49,54,98,116,67,111,108,108,105,115,105,111,110,87,111,114,108,100,49,55,111,98,106,101,99,116,81,117,101,114,121,83,105,110,103,108,101,69,80,75,49,51,98,116,67,111,110,118,101,120,83,104,97,112,101,82,75,49,49,98,116,84,114,97,110,115,102,111,114,109,83,53,95,80,49,55,98,116,67,111,108,108,105,115,105,111,110,79,98,106,101,99,116,80,75,49,54,98,116,67,111,108,108,105,115,105,111,110,83,104,97,112,101,83,53,95,82,78,83,95,50,48,67,111,110,118,101,120,82,101,115,117,108,116,67,97,108,108,98,97,99,107,69,102,69,49,52,76,111,99,97,108,73,110,102,111,65,100,100,101,114,95,49,0,0,0,90,78,49,54,98,116,67,111,108,108,105,115,105,111,110,87,111,114,108,100,49,51,114,97,121,84,101,115,116,83,105,110,103,108,101,69,82,75,49,49,98,116,84,114,97,110,115,102,111,114,109,83,50,95,80,49,55,98,116,67,111,108,108,105,115,105,111,110,79,98,106,101,99,116,80,75,49,54,98,116,67,111,108,108,105,115,105,111,110,83,104,97,112,101,83,50,95,82,78,83,95,49,55,82,97,121,82,101,115,117,108,116,67,97,108,108,98,97,99,107,69,69,57,82,97,121,84,101,115,116,101,114,95,49,0,0,90,78,49,54,98,116,67,111,108,108,105,115,105,111,110,87,111,114,108,100,49,51,114,97,121,84,101,115,116,83,105,110,103,108,101,69,82,75,49,49,98,116,84,114,97,110,115,102,111,114,109,83,50,95,80,49,55,98,116,67,111,108,108,105,115,105,111,110,79,98,106,101,99,116,80,75,49,54,98,116,67,111,108,108,105,115,105,111,110,83,104,97,112,101,83,50,95,82,78,83,95,49,55,82,97,121,82,101,115,117,108,116,67,97,108,108,98,97,99,107,69,69,50,57,66,114,105,100,103,101,84,114,105,97,110,103,108,101,82,97,121,99,97,115,116,67,97,108,108,98,97,99,107,95,48,0,0,0,0,0,90,78,49,54,98,116,67,111,108,108,105,115,105,111,110,87,111,114,108,100,49,51,114,97,121,84,101,115,116,83,105,110,103,108,101,69,82,75,49,49,98,116,84,114,97,110,115,102,111,114,109,83,50,95,80,49,55,98,116,67,111,108,108,105,115,105,111,110,79,98,106,101,99,116,80,75,49,54,98,116,67,111,108,108,105,115,105,111,110,83,104,97,112,101,83,50,95,82,78,83,95,49,55,82,97,121,82,101,115,117,108,116,67,97,108,108,98,97,99,107,69,69,50,57,66,114,105,100,103,101,84,114,105,97,110,103,108,101,82,97,121,99,97,115,116,67,97,108,108,98,97,99,107,0,0,0,0,0,0,0,90,78,49,54,98,116,67,111,108,108,105,115,105,111,110,87,111,114,108,100,49,51,114,97,121,84,101,115,116,83,105,110,103,108,101,69,82,75,49,49,98,116,84,114,97,110,115,102,111,114,109,83,50,95,80,49,55,98,116,67,111,108,108,105,115,105,111,110,79,98,106,101,99,116,80,75,49,54,98,116,67,111,108,108,105,115,105,111,110,83,104,97,112,101,83,50,95,82,78,83,95,49,55,82,97,121,82,101,115,117,108,116,67,97,108,108,98,97,99,107,69,69,49,53,76,111,99,97,108,73,110,102,111,65,100,100,101,114,50,0,0,0,0,0,83,116,57,116,121,112,101,95,105,110,102,111,0,0,0,0,83,116,57,101,120,99,101,112,116,105,111,110,0,0,0,0,83,116,57,98,97,100,95,97,108,108,111,99,0,0,0,0,78,54,98,116,68,98,118,116,56,73,67,111,108,108,105,100,101,69,0,0,0,0,0,0,78,51,54,98,116,68,105,115,99,114,101,116,101,67,111,108,108,105,115,105,111,110,68,101,116,101,99,116,111,114,73,110,116,101,114,102,97,99,101,54,82,101,115,117,108,116,69,0,78,51,52,98,116,83,112,104,101,114,101,84,114,105,97,110,103,108,101,67,111,108,108,105,115,105,111,110,65,108,103,111,114,105,116,104,109,49,48,67,114,101,97,116,101,70,117,110,99,69,0,0,0,0,0,0,78,51,51,98,116,67,111,110,118,101,120,67,111,110,99,97,118,101,67,111,108,108,105,115,105,111,110,65,108,103,111,114,105,116,104,109,49,55,83,119,97,112,112,101,100,67,114,101,97,116,101,70,117,110,99,69,0,0,0,0,0,0,0,0,78,51,51,98,116,67,111,110,118,101,120,67,111,110,99,97,118,101,67,111,108,108,105,115,105,111,110,65,108,103,111,114,105,116,104,109,49,48,67,114,101,97,116,101,70,117,110,99,69,0,0,0,0,0,0,0,78,51,50,98,116,83,112,104,101,114,101,83,112,104,101,114,101,67,111,108,108,105,115,105,111,110,65,108,103,111,114,105,116,104,109,49,48,67,114,101,97,116,101,70,117,110,99,69,0,0,0,0,0,0,0,0,78,51,49,98,116,67,111,110,118,101,120,80,108,97,110,101,67,111,108,108,105,115,105,111,110,65,108,103,111,114,105,116,104,109,49,48,67,114,101,97,116,101,70,117,110,99,69,0,78,50,56,98,116,67,111,109,112,111,117,110,100,67,111,108,108,105,115,105,111,110,65,108,103,111,114,105,116,104,109,49,55,83,119,97,112,112,101,100,67,114,101,97,116,101,70,117,110,99,69,0,0,0,0,0,78,50,56,98,116,67,111,109,112,111,117,110,100,67,111,108,108,105,115,105,111,110,65,108,103,111,114,105,116,104,109,49,48,67,114,101,97,116,101,70,117,110,99,69,0,0,0,0,78,50,54,98,116,66,111,120,66,111,120,67,111,108,108,105,115,105,111,110,65,108,103,111,114,105,116,104,109,49,48,67,114,101,97,116,101,70,117,110,99,69,0,0,0,0,0,0,78,50,53,98,116,83,105,109,117,108,97,116,105,111,110,73,115,108,97,110,100,77,97,110,97,103,101,114,49,52,73,115,108,97,110,100,67,97,108,108,98,97,99,107,69,0,0,0,78,50,51,98,116,67,111,110,118,101,120,67,111,110,118,101,120,65,108,103,111,114,105,116,104,109,49,48,67,114,101,97,116,101,70,117,110,99,69,0,78,49,54,98,116,69,109,112,116,121,65,108,103,111,114,105,116,104,109,49,48,67,114,101,97,116,101,70,117,110,99,69,0,0,0,0,0,0,0,0,78,49,54,98,116,67,111,108,108,105,115,105,111,110,87,111,114,108,100,50,55,67,108,111,115,101,115,116,67,111,110,118,101,120,82,101,115,117,108,116,67,97,108,108,98,97,99,107,69,0,0,0,0,0,0,0,78,49,54,98,116,67,111,108,108,105,115,105,111,110,87,111,114,108,100,50,48,67,111,110,118,101,120,82,101,115,117,108,116,67,97,108,108,98,97,99,107,69,0,0,0,0,0,0,78,49,54,98,116,67,111,108,108,105,115,105,111,110,87,111,114,108,100,49,55,82,97,121,82,101,115,117,108,116,67,97,108,108,98,97,99,107,69,0,78,49,50,98,116,67,111,110,118,101,120,67,97,115,116,49,48,67,97,115,116,82,101,115,117,108,116,69,0,0,0,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,49,95,95,118,109,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,0,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,48,95,95,115,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,0,0,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,0,0,0,0,0,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,54,95,95,115,104,105,109,95,116,121,112,101,95,105,110,102,111,69,0,0,0,0,0,0,0,0,51,54,98,116,68,105,115,99,114,101,116,101,67,111,108,108,105,115,105,111,110,68,101,116,101,99,116,111,114,73,110,116,101,114,102,97,99,101,0,0,51,53,98,116,83,101,113,117,101,110,116,105,97,108,73,109,112,117,108,115,101,67,111,110,115,116,114,97,105,110,116,83,111,108,118,101,114,0,0,0,51,52,98,116,83,112,104,101,114,101,84,114,105,97,110,103,108,101,67,111,108,108,105,115,105,111,110,65,108,103,111,114,105,116,104,109,0,0,0,0,51,52,98,116,67,108,111,115,101,115,116,78,111,116,77,101,67,111,110,118,101,120,82,101,115,117,108,116,67,97,108,108,98,97,99,107,0,0,0,0,51,51,98,116,77,105,110,107,111,119,115,107,105,80,101,110,101,116,114,97,116,105,111,110,68,101,112,116,104,83,111,108,118,101,114,0,0,0,0,0,51,51,98,116,67,111,110,118,101,120,67,111,110,99,97,118,101,67,111,108,108,105,115,105,111,110,65,108,103,111,114,105,116,104,109,0,0,0,0,0,51,50,98,116,83,112,104,101,114,101,83,112,104,101,114,101,67,111,108,108,105,115,105,111,110,65,108,103,111,114,105,116,104,109,0,0,0,0,0,0,51,49,98,116,73,110,116,101,114,110,97,108,84,114,105,97,110,103,108,101,73,110,100,101,120,67,97,108,108,98,97,99,107,0,0,0,0,0,0,0,51,49,98,116,68,101,102,97,117,108,116,67,111,108,108,105,115,105,111,110,67,111,110,102,105,103,117,114,97,116,105,111,110,0,0,0,0,0,0,0,51,49,98,116,67,111,110,118,101,120,80,108,97,110,101,67,111,108,108,105,115,105,111,110,65,108,103,111,114,105,116,104,109,0,0,0,0,0,0,0,51,48,98,116,71,106,107,69,112,97,80,101,110,101,116,114,97,116,105,111,110,68,101,112,116,104,83,111,108,118,101,114,0,0,0,0,0,0,0,0,51,48,98,116,67,111,110,118,101,120,80,101,110,101,116,114,97,116,105,111,110,68,101,112,116,104,83,111,108,118,101,114,0,0,0,0,0,0,0,0,51,48,98,116,67,111,108,108,105,115,105,111,110,65,108,103,111,114,105,116,104,109,67,114,101,97,116,101,70,117,110,99,0,0,0,0,0,0,0,0,51,48,98,116,65,99,116,105,118,97,116,105,110,103,67,111,108,108,105,115,105,111,110,65,108,103,111,114,105,116,104,109,0,0,0,0,0,0,0,0,50,56,98,116,84,114,105,97,110,103,108,101,67,111,110,118,101,120,99,97,115,116,67,97,108,108,98,97,99,107,0,0,50,56,98,116,72,97,115,104,101,100,79,118,101,114,108,97,112,112,105,110,103,80,97,105,114,67,97,99,104,101,0,0,50,56,98,116,67,111,109,112,111,117,110,100,67,111,108,108,105,115,105,111,110,65,108,103,111,114,105,116,104,109,0,0,50,55,98,116,67,111,110,116,105,110,117,111,117,115,67,111,110,118,101,120,67,111,108,108,105,115,105,111,110,0,0,0,50,54,98,116,66,111,120,66,111,120,67,111,108,108,105,115,105,111,110,65,108,103,111,114,105,116,104,109,0,0,0,0,50,53,98,116,84,114,105,97,110,103,108,101,82,97,121,99,97,115,116,67,97,108,108,98,97,99,107,0,0,0,0,0,50,53,98,116,83,105,109,117,108,97,116,105,111,110,73,115,108,97,110,100,77,97,110,97,103,101,114,0,0,0,0,0,50,53,98,116,79,118,101,114,108,97,112,112,105,110,103,80,97,105,114,67,97,108,108,98,97,99,107,0,0,0,0,0,50,52,98,116,80,101,114,116,117,114,98,101,100,67,111,110,116,97,99,116,82,101,115,117,108,116,0,0,0,0,0,0,50,52,98,116,67,111,110,118,101,120,84,114,105,97,110,103,108,101,67,97,108,108,98,97,99,107,0,0,0,0,0,0,50,52,98,116,67,111,108,108,105,115,105,111,110,67,111,110,102,105,103,117,114,97,116,105,111,110,0,0,0,0,0,0,50,52,98,116,66,114,111,97,100,112,104,97,115,101,65,97,98,98,67,97,108,108,98,97,99,107,0,0,0,0,0,0,50,51,98,116,80,111,108,121,104,101,100,114,97,108,67,111,110,118,101,120,83,104,97,112,101,0,0,0,0,0,0,0,50,51,98,116,68,105,115,99,114,101,116,101,68,121,110,97,109,105,99,115,87,111,114,108,100,0,0,0,0,0,0,0,50,51,98,116,67,111,110,118,101,120,67,111,110,118,101,120,65,108,103,111,114,105,116,104,109,0,0,0,0,0,0,0,50,51,98,116,67,111,108,108,105,115,105,111,110,80,97,105,114,67,97,108,108,98,97,99,107,0,0,0,0,0,0,0,50,51,98,116,66,114,111,97,100,112,104,97,115,101,82,97,121,67,97,108,108,98,97,99,107,0,0,0,0,0,0,0,50,50,98,116,83,117,98,115,105,109,112,108,101,120,67,111,110,118,101,120,67,97,115,116,0,0,0,0,0,0,0,0,50,50,98,116,79,118,101,114,108,97,112,112,105,110,103,80,97,105,114,67,97,99,104,101,0,0,0,0,0,0,0,0,50,50,98,116,67,111,109,112,111,117,110,100,76,101,97,102,67,97,108,108,98,97,99,107,0,0,0,0,0,0,0,0,50,50,83,112,104,101,114,101,84,114,105,97,110,103,108,101,68,101,116,101,99,116,111,114,0,0,0,0,0,0,0,0,50,49,98,116,83,105,110,103,108,101,83,119,101,101,112,67,97,108,108,98,97,99,107,0,50,49,98,116,78,111,100,101,79,118,101,114,108,97,112,67,97,108,108,98,97,99,107,0,50,49,98,116,67,111,110,118,101,120,73,110,116,101,114,110,97,108,83,104,97,112,101,0,50,49,98,116,67,111,108,108,105,115,105,111,110,68,105,115,112,97,116,99,104,101,114,0,50,49,98,116,66,114,111,97,100,112,104,97,115,101,73,110,116,101,114,102,97,99,101,0,50,48,98,116,68,101,102,97,117,108,116,77,111,116,105,111,110,83,116,97,116,101,0,0,50,48,98,116,67,111,108,108,105,115,105,111,110,65,108,103,111,114,105,116,104,109,0,0,50,48,66,114,111,97,100,112,104,97,115,101,65,97,98,98,84,101,115,116,101,114,0,0,49,57,98,116,83,105,110,103,108,101,82,97,121,67,97,108,108,98,97,99,107,0,0,0,49,57,66,114,111,97,100,112,104,97,115,101,82,97,121,84,101,115,116,101,114,0,0,0,49,56,98,116,84,114,105,97,110,103,108,101,67,97,108,108,98,97,99,107,0,0,0,0,49,56,98,116,68,98,118,116,84,114,101,101,67,111,108,108,105,100,101,114,0,0,0,0,49,56,98,116,67,111,110,118,101,120,80,111,108,121,104,101,100,114,111,110,0,0,0,0,49,56,98,116,67,111,110,115,116,114,97,105,110,116,83,111,108,118,101,114,0,0,0,0,49,55,98,116,79,118,101,114,108,97,112,67,97,108,108,98,97,99,107,0,0,0,0,0,49,55,98,116,71,106,107,80,97,105,114,68,101,116,101,99,116,111,114,0,0,0,0,0,49,55,98,116,67,111,108,108,105,115,105,111,110,79,98,106,101,99,116,0,0,0,0,0,49,55,68,101,98,117,103,68,114,97,119,99,97,108,108,98,97,99,107,0,0,0,0,0,49,54,98,116,80,111,105,110,116,67,111,108,108,101,99,116,111,114,0,0,0,0,0,0,49,54,98,116,77,97,110,105,102,111,108,100,82,101,115,117,108,116,0,0,0,0,0,0,49,54,98,116,69,109,112,116,121,65,108,103,111,114,105,116,104,109,0,0,0,0,0,0,49,54,98,116,68,98,118,116,66,114,111,97,100,112,104,97,115,101,0,0,0,0,0,0,49,54,98,116,67,111,108,108,105,115,105,111,110,87,111,114,108,100,0,0,0,0,0,0,49,54,98,116,67,111,108,108,105,115,105,111,110,83,104,97,112,101,0,0,0,0,0,0,49,54,98,116,66,111,120,66,111,120,68,101,116,101,99,116,111,114,0,0,0,0,0,0,49,53,98,116,84,114,105,97,110,103,108,101,83,104,97,112,101,0,0,0,0,0,0,0,49,53,98,116,71,106,107,67,111,110,118,101,120,67,97,115,116,0,0,0,0,0,0,0,49,53,98,116,68,121,110,97,109,105,99,115,87,111,114,108,100,0,0,0,0,0,0,0,49,51,98,116,83,112,104,101,114,101,83,104,97,112,101,0,49,51,98,116,77,111,116,105].concat([111,110,83,116,97,116,101,0,49,51,98,116,67,111,110,118,101,120,83,104,97,112,101,0,49,50,98,116,68,105,115,112,97,116,99,104,101,114,0,0,49,50,98,116,67,111,110,118,101,120,67,97,115,116,0,0,49,49,98,116,82,105,103,105,100,66,111,100,121,0,0,0,49,48,98,116,66,111,120,83,104,97,112,101,0,0,0,0,0,0,0,0,248,19,0,0,120,41,0,0,0,0,0,0,0,0,0,0,184,20,0,0,8,45,0,0,0,0,0,0,0,0,0,0,88,21,0,0,48,45,0,0,0,0,0,0,0,0,0,0,224,21,0,0,48,45,0,0,0,0,0,0,0,0,0,0,80,22,0,0,0,42,0,0,0,0,0,0,0,0,0,0,184,22,0,0,120,41,0,0,0,0,0,0,0,0,0,0,56,23,0,0,144,44,0,0,0,0,0,0,0,0,0,0,176,23,0,0,144,44,0,0,0,0,0,0,0,0,0,0,24,24,0,0,80,43,0,0,0,0,0,0,0,0,0,0,208,24,0,0,80,43,0,0,0,0,0,0,0,0,0,0,136,25,0,0,56,42,0,0,0,0,0,0,0,0,0,0,48,26,0,0,112,41,0,0,0,0,0,0,0,0,0,0,184,26,0,0,160,43,0,0,0,0,0,0,0,0,0,0,88,27,0,0,160,43,0,0,0,0,0,0,0,0,0,0,248,27,0,0,64,42,0,0,0,0,0,0,0,0,0,0,136,28,0,0,0,0,0,0,152,28,0,0,0,0,0,0,168,28,0,0,88,41,0,0,0,0,0,0,0,0,0,0,184,28,0,0,0,0,0,0,208,28,0,0,0,0,0,0,0,29,0,0,56,43,0,0,0,0,0,0,0,0,0,0,56,29,0,0,56,43,0,0,0,0,0,0,0,0,0,0,120,29,0,0,56,43,0,0,0,0,0,0,0,0,0,0,176,29,0,0,56,43,0,0,0,0,0,0,0,0,0,0,232,29,0,0,56,43,0,0,0,0,0,0,0,0,0,0,24,30,0,0,56,43,0,0,0,0,0,0,0,0,0,0,80,30,0,0,56,43,0,0,0,0,0,0,0,0,0,0,128,30,0,0,56,43,0,0,0,0,0,0,0,0,0,0,176,30,0,0,0,0,0,0,224,30,0,0,56,43,0,0,0,0,0,0,0,0,0,0,8,31,0,0,56,43,0,0,0,0,0,0,0,0,0,0,48,31,0,0,56,42,0,0,0,0,0,0,0,0,0,0,104,31,0,0,0,0,0,0,152,31,0,0,0,0,0,0,192,31,0,0,0,0,0,0,224,31,0,0,112,42,0,0,0,0,0,0,0,0,0,0,8,32,0,0,112,42,0,0,0,0,0,0,0,0,0,0,48,32,0,0,128,42,0,0,0,0,0,0,0,0,0,0,88,32,0,0,80,41,0,0,0,0,0,0,0,0,0,0,128,32,0,0,0,0,0,0,168,32,0,0,40,45,0,0,0,0,0,0,0,0,0,0,208,32,0,0,64,43,0,0,0,0,0,0,0,0,0,0,248,32,0,0,40,42,0,0,0,0,0,0,0,0,0,0,32,33,0,0,48,43,0,0,0,0,0,0,0,0,0,0,72,33,0,0,64,43,0,0,0,0,0,0,0,0,0,0,112,33,0,0,64,43,0,0,0,0,0,0,0,0,0,0,152,33,0,0,0,0,0,0,192,33,0,0,224,43,0,0,0,0,0,0,0,0,0,0,232,33,0,0,208,44,0,0,0,0,0,0,0,0,0,0,16,34,0,0,48,43,0,0,0,0,0,0,0,0,0,0,56,34,0,0,0,0,0,0,96,34,0,0,0,0,0,0,136,34,0,0,208,44,0,0,0,0,0,0,0,0,0,0,176,34,0,0,8,45,0,0,0,0,0,0,0,0,0,0,208,34,0,0,80,44,0,0,0,0,0,0,0,0,0,0,240,34,0,0,64,43,0,0,0,0,0,0,0,0,0,0,16,35,0,0,48,46,0,0,0,0,0,0,0,0,0,0,48,35,0,0,64,43,0,0,0,0,0,0,0,0,0,0,80,35,0,0,8,45,0,0,0,0,0,0,0,0,0,0,112,35,0,0,0,0,0,0,144,35,0,0,0,0,0,0,176,35,0,0,128,45,0,0,0,0,0,0,0,0,0,0,208,35,0,0,8,45,0,0,0,0,0,0,0,0,0,0,240,35,0,0,0,0,0,0,16,36,0,0,0,0,0,0,48,36,0,0,152,44,0,0,0,0,0,0,0,0,0,0,80,36,0,0,240,45,0,0,0,0,0,0,0,0,0,0,112,36,0,0,64,43,0,0,0,0,0,0,0,0,0,0,144,36,0,0,48,45,0,0,0,0,0,0,0,0,0,0,176,36,0,0,232,43,0,0,0,0,0,0,0,0,0,0,208,36,0,0,48,46,0,0,0,0,0,0,0,0,0,0,240,36,0,0,184,43,0,0,0,0,0,0,0,0,0,0,16,37,0,0,112,41,0,0,0,0,0,0,0,0,0,0,48,37,0,0,144,42,0,0,0,0,0,0,0,0,0,0,80,37,0,0,48,44,0,0,0,0,0,0,0,0,0,0,104,37,0,0,0,0,0,0,128,37,0,0,24,46,0,0,0,0,0,0,0,0,0,0,152,37,0,0,40,46,0,0,0,0,0,0,0,0,0,0,176,37,0,0,0,0,0,0,200,37,0,0,16,46,0,0,0,0,0,0,0,0,0,0,224,37,0,0,0,0,0,0,248,37,0,0,112,41,0,0,0,0,0,0,0,0,0,0,16,38,0,0,48,44,0,0,0,0,0,0,0,0,0,0,40,38,0,0,112,41,0,0,0,0,0,0,0,0,0,0,64,38,0,0,0,0,0,0,88,38,0,0,112,41,0,0,0,0,0,0,0,0,0,0,112,38,0,0,0,0,0,0,136,38,0,0,0,0,0,0,160,38,0,0,0,0,0,0,184,38,0,0,144,42,0,0,0,0,0,0,0,0,0,0,208,38,0,0,16,9,0,0,232,38,0,0,0,0,0,0,2,0,0,0,8,45,0,0,2,0,0,0,248,42,0,0,2,4,0,0,0,0,0,0,0,39,0,0,120,41,0,0,0,0,0,0,0,0,0,0,24,39,0,0,120,41,0,0,0,0,0,0,0,0,0,0,48,39,0,0,208,44,0,0,0,0,0,0,0,0,0,0,72,39,0,0,184,44,0,0,0,0,0,0,0,0,0,0,96,39,0,0,0,0,0,0,120,39,0,0,0,0,0,0,144,39,0,0,144,42,0,0,0,0,0,0,0,0,0,0,168,39,0,0,240,43,0,0,0,0,0,0,0,0,0,0,192,39,0,0,48,46,0,0,0,0,0,0,0,0,0,0,216,39,0,0,176,45,0,0,0,0,0,0,0,0,0,0,240,39,0,0,152,44,0,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,16,40,0,0,184,45,0,0,0,0,0,0,0,0,0,0,32,40,0,0,0,0,0,0,48,40,0,0,0,0,0,0,64,40,0,0,72,45,0,0,0,0,0,0,0,0,0,0,80,40,0,0,240,43,0,0,0,0,0,0,176,55,0,0,0,0,0,0,44,1,0,0,0,0,0,0,4,0,0,0,0,0,0,0,164,0,0,0,0,0,0,0,78,0,0,0,0,0,0,0]) +, "i8", ALLOC_NONE, Runtime.GLOBAL_BASE) +var tempDoublePtr = Runtime.alignMemory(allocate(12, "i8", ALLOC_STATIC), 8); +assert(tempDoublePtr % 8 == 0); +function copyTempFloat(ptr) { // functions, because inlining this code increases code size too much + HEAP8[tempDoublePtr] = HEAP8[ptr]; + HEAP8[tempDoublePtr+1] = HEAP8[ptr+1]; + HEAP8[tempDoublePtr+2] = HEAP8[ptr+2]; + HEAP8[tempDoublePtr+3] = HEAP8[ptr+3]; +} +function copyTempDouble(ptr) { + HEAP8[tempDoublePtr] = HEAP8[ptr]; + HEAP8[tempDoublePtr+1] = HEAP8[ptr+1]; + HEAP8[tempDoublePtr+2] = HEAP8[ptr+2]; + HEAP8[tempDoublePtr+3] = HEAP8[ptr+3]; + HEAP8[tempDoublePtr+4] = HEAP8[ptr+4]; + HEAP8[tempDoublePtr+5] = HEAP8[ptr+5]; + HEAP8[tempDoublePtr+6] = HEAP8[ptr+6]; + HEAP8[tempDoublePtr+7] = HEAP8[ptr+7]; +} + function ___gxx_personality_v0() { + } + function __exit(status) { + // void _exit(int status); + // http://pubs.opengroup.org/onlinepubs/000095399/functions/exit.html + Module.print('exit(' + status + ') called'); + Module['exit'](status); + }function _exit(status) { + __exit(status); + }function __ZSt9terminatev() { + _exit(-1234); + } + var ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:35,EIDRM:36,ECHRNG:37,EL2NSYNC:38,EL3HLT:39,EL3RST:40,ELNRNG:41,EUNATCH:42,ENOCSI:43,EL2HLT:44,EDEADLK:45,ENOLCK:46,EBADE:50,EBADR:51,EXFULL:52,ENOANO:53,EBADRQC:54,EBADSLT:55,EDEADLOCK:56,EBFONT:57,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:74,EDOTDOT:76,EBADMSG:77,ENOTUNIQ:80,EBADFD:81,EREMCHG:82,ELIBACC:83,ELIBBAD:84,ELIBSCN:85,ELIBMAX:86,ELIBEXEC:87,ENOSYS:88,ENOTEMPTY:90,ENAMETOOLONG:91,ELOOP:92,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:106,EPROTOTYPE:107,ENOTSOCK:108,ENOPROTOOPT:109,ESHUTDOWN:110,ECONNREFUSED:111,EADDRINUSE:112,ECONNABORTED:113,ENETUNREACH:114,ENETDOWN:115,ETIMEDOUT:116,EHOSTDOWN:117,EHOSTUNREACH:118,EINPROGRESS:119,EALREADY:120,EDESTADDRREQ:121,EMSGSIZE:122,EPROTONOSUPPORT:123,ESOCKTNOSUPPORT:124,EADDRNOTAVAIL:125,ENETRESET:126,EISCONN:127,ENOTCONN:128,ETOOMANYREFS:129,EUSERS:131,EDQUOT:132,ESTALE:133,ENOTSUP:134,ENOMEDIUM:135,EILSEQ:138,EOVERFLOW:139,ECANCELED:140,ENOTRECOVERABLE:141,EOWNERDEAD:142,ESTRPIPE:143}; + var ERRNO_MESSAGES={0:"Success",1:"Not super-user",2:"No such file or directory",3:"No such process",4:"Interrupted system call",5:"I/O error",6:"No such device or address",7:"Arg list too long",8:"Exec format error",9:"Bad file number",10:"No children",11:"No more processes",12:"Not enough core",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Mount device busy",17:"File exists",18:"Cross-device link",19:"No such device",20:"Not a directory",21:"Is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",25:"Not a typewriter",26:"Text file busy",27:"File too large",28:"No space left on device",29:"Illegal seek",30:"Read only file system",31:"Too many links",32:"Broken pipe",33:"Math arg out of domain of func",34:"Math result not representable",35:"No message of desired type",36:"Identifier removed",37:"Channel number out of range",38:"Level 2 not synchronized",39:"Level 3 halted",40:"Level 3 reset",41:"Link number out of range",42:"Protocol driver not attached",43:"No CSI structure available",44:"Level 2 halted",45:"Deadlock condition",46:"No record locks available",50:"Invalid exchange",51:"Invalid request descriptor",52:"Exchange full",53:"No anode",54:"Invalid request code",55:"Invalid slot",56:"File locking deadlock error",57:"Bad font file fmt",60:"Device not a stream",61:"No data (for no delay io)",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",65:"Package not installed",66:"The object is remote",67:"The link has been severed",68:"Advertise error",69:"Srmount error",70:"Communication error on send",71:"Protocol error",74:"Multihop attempted",76:"Cross mount point (not really error)",77:"Trying to read unreadable message",80:"Given log. name not unique",81:"f.d. invalid for this operation",82:"Remote address changed",83:"Can access a needed shared lib",84:"Accessing a corrupted shared lib",85:".lib section in a.out corrupted",86:"Attempting to link in too many libs",87:"Attempting to exec a shared library",88:"Function not implemented",90:"Directory not empty",91:"File or path name too long",92:"Too many symbolic links",95:"Operation not supported on transport endpoint",96:"Protocol family not supported",104:"Connection reset by peer",105:"No buffer space available",106:"Address family not supported by protocol family",107:"Protocol wrong type for socket",108:"Socket operation on non-socket",109:"Protocol not available",110:"Can't send after socket shutdown",111:"Connection refused",112:"Address already in use",113:"Connection aborted",114:"Network is unreachable",115:"Network interface is not configured",116:"Connection timed out",117:"Host is down",118:"Host is unreachable",119:"Connection already in progress",120:"Socket already connected",121:"Destination address required",122:"Message too long",123:"Unknown protocol",124:"Socket type not supported",125:"Address not available",126:"Connection reset by network",127:"Socket is already connected",128:"Socket is not connected",129:"Too many references",131:"Too many users",132:"Quota exceeded",133:"Stale file handle",134:"Not supported",135:"No medium (in tape drive)",138:"Illegal byte sequence",139:"Value too large for defined data type",140:"Operation canceled",141:"State not recoverable",142:"Previous owner died",143:"Streams pipe error"}; + var ___errno_state=0;function ___setErrNo(value) { + // For convenient setting and returning of errno. + HEAP32[((___errno_state)>>2)]=value + return value; + } + var VFS=undefined; + var PATH={splitPath:function (filename) { + var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + },normalizeArray:function (parts, allowAboveRoot) { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (; up--; up) { + parts.unshift('..'); + } + } + return parts; + },normalize:function (path) { + var isAbsolute = path.charAt(0) === '/', + trailingSlash = path.substr(-1) === '/'; + // Normalize the path + path = PATH.normalizeArray(path.split('/').filter(function(p) { + return !!p; + }), !isAbsolute).join('/'); + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + return (isAbsolute ? '/' : '') + path; + },dirname:function (path) { + var result = PATH.splitPath(path), + root = result[0], + dir = result[1]; + if (!root && !dir) { + // No dirname whatsoever + return '.'; + } + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } + return root + dir; + },basename:function (path, ext) { + // EMSCRIPTEN return '/'' for '/', not an empty string + if (path === '/') return '/'; + var f = PATH.splitPath(path)[2]; + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; + },extname:function (path) { + return PATH.splitPath(path)[3]; + },join:function () { + var paths = Array.prototype.slice.call(arguments, 0); + return PATH.normalize(paths.filter(function(p, index) { + if (typeof p !== 'string') { + throw new TypeError('Arguments to path.join must be strings'); + } + return p; + }).join('/')); + },resolve:function () { + var resolvedPath = '', + resolvedAbsolute = false; + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? arguments[i] : FS.cwd(); + // Skip empty and invalid entries + if (typeof path !== 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charAt(0) === '/'; + } + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + resolvedPath = PATH.normalizeArray(resolvedPath.split('/').filter(function(p) { + return !!p; + }), !resolvedAbsolute).join('/'); + return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; + },relative:function (from, to) { + from = PATH.resolve(from).substr(1); + to = PATH.resolve(to).substr(1); + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join('/'); + }}; + var TTY={ttys:[],init:function () { + // https://github.com/kripken/emscripten/pull/1555 + // if (ENVIRONMENT_IS_NODE) { + // // currently, FS.init does not distinguish if process.stdin is a file or TTY + // // device, it always assumes it's a TTY device. because of this, we're forcing + // // process.stdin to UTF8 encoding to at least make stdin reading compatible + // // with text files until FS.init can be refactored. + // process['stdin']['setEncoding']('utf8'); + // } + },shutdown:function () { + // https://github.com/kripken/emscripten/pull/1555 + // if (ENVIRONMENT_IS_NODE) { + // // inolen: any idea as to why node -e 'process.stdin.read()' wouldn't exit immediately (with process.stdin being a tty)? + // // isaacs: because now it's reading from the stream, you've expressed interest in it, so that read() kicks off a _read() which creates a ReadReq operation + // // inolen: I thought read() in that case was a synchronous operation that just grabbed some amount of buffered data if it exists? + // // isaacs: it is. but it also triggers a _read() call, which calls readStart() on the handle + // // isaacs: do process.stdin.pause() and i'd think it'd probably close the pending call + // process['stdin']['pause'](); + // } + },register:function (dev, ops) { + TTY.ttys[dev] = { input: [], output: [], ops: ops }; + FS.registerDevice(dev, TTY.stream_ops); + },stream_ops:{open:function (stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(ERRNO_CODES.ENODEV); + } + stream.tty = tty; + stream.seekable = false; + },close:function (stream) { + // flush any pending line data + if (stream.tty.output.length) { + stream.tty.ops.put_char(stream.tty, 10); + } + },read:function (stream, buffer, offset, length, pos /* ignored */) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(ERRNO_CODES.ENXIO); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(ERRNO_CODES.EIO); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(ERRNO_CODES.EAGAIN); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset+i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + },write:function (stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(ERRNO_CODES.ENXIO); + } + for (var i = 0; i < length; i++) { + try { + stream.tty.ops.put_char(stream.tty, buffer[offset+i]); + } catch (e) { + throw new FS.ErrnoError(ERRNO_CODES.EIO); + } + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }},default_tty_ops:{get_char:function (tty) { + if (!tty.input.length) { + var result = null; + if (ENVIRONMENT_IS_NODE) { + result = process['stdin']['read'](); + if (!result) { + if (process['stdin']['_readableState'] && process['stdin']['_readableState']['ended']) { + return null; // EOF + } + return undefined; // no data available + } + } else if (typeof window != 'undefined' && + typeof window.prompt == 'function') { + // Browser. + result = window.prompt('Input: '); // returns null on cancel + if (result !== null) { + result += '\n'; + } + } else if (typeof readline == 'function') { + // Command line. + result = readline(); + if (result !== null) { + result += '\n'; + } + } + if (!result) { + return null; + } + tty.input = intArrayFromString(result, true); + } + return tty.input.shift(); + },put_char:function (tty, val) { + if (val === null || val === 10) { + Module['print'](tty.output.join('')); + tty.output = []; + } else { + tty.output.push(TTY.utf8.processCChar(val)); + } + }},default_tty1_ops:{put_char:function (tty, val) { + if (val === null || val === 10) { + Module['printErr'](tty.output.join('')); + tty.output = []; + } else { + tty.output.push(TTY.utf8.processCChar(val)); + } + }}}; + var MEMFS={CONTENT_OWNING:1,CONTENT_FLEXIBLE:2,CONTENT_FIXED:3,ensureFlexible:function (node) { + if (node.contentMode !== MEMFS.CONTENT_FLEXIBLE) { + var contents = node.contents; + node.contents = Array.prototype.slice.call(contents); + node.contentMode = MEMFS.CONTENT_FLEXIBLE; + } + },mount:function (mount) { + return MEMFS.create_node(null, '/', 0040000 | 0777, 0); + },create_node:function (parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + // no supported + throw new FS.ErrnoError(ERRNO_CODES.EPERM); + } + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink + }; + node.stream_ops = { + llseek: MEMFS.stream_ops.llseek + }; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }; + node.stream_ops = { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap + }; + node.contents = []; + node.contentMode = MEMFS.CONTENT_FLEXIBLE; + } else if (FS.isLink(node.mode)) { + node.node_ops = { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink + }; + node.stream_ops = {}; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr + }; + node.stream_ops = FS.chrdev_stream_ops; + } + node.timestamp = Date.now(); + // add the new node to the parent + if (parent) { + parent.contents[name] = node; + } + return node; + },node_ops:{getattr:function (node) { + var attr = {}; + // device numbers reuse inode numbers. + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.contents.length; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.timestamp); + attr.mtime = new Date(node.timestamp); + attr.ctime = new Date(node.timestamp); + // NOTE: In our implementation, st_blocks = Math.ceil(st_size/st_blksize), + // but this is not required by the standard. + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + },setattr:function (node, attr) { + if (attr.mode !== undefined) { + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + node.timestamp = attr.timestamp; + } + if (attr.size !== undefined) { + MEMFS.ensureFlexible(node); + var contents = node.contents; + if (attr.size < contents.length) contents.length = attr.size; + else while (attr.size > contents.length) contents.push(0); + } + },lookup:function (parent, name) { + throw new FS.ErrnoError(ERRNO_CODES.ENOENT); + },mknod:function (parent, name, mode, dev) { + return MEMFS.create_node(parent, name, mode, dev); + },rename:function (old_node, new_dir, new_name) { + // if we're overwriting a directory at new_name, make sure it's empty. + if (FS.isDir(old_node.mode)) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) { + } + if (new_node) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY); + } + } + } + // do the internal rewiring + delete old_node.parent.contents[old_node.name]; + old_node.name = new_name; + new_dir.contents[new_name] = old_node; + },unlink:function (parent, name) { + delete parent.contents[name]; + },rmdir:function (parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY); + } + delete parent.contents[name]; + },readdir:function (node) { + var entries = ['.', '..'] + for (var key in node.contents) { + if (!node.contents.hasOwnProperty(key)) { + continue; + } + entries.push(key); + } + return entries; + },symlink:function (parent, newname, oldpath) { + var node = MEMFS.create_node(parent, newname, 0777 | 0120000, 0); + node.link = oldpath; + return node; + },readlink:function (node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + return node.link; + }},stream_ops:{read:function (stream, buffer, offset, length, position) { + var contents = stream.node.contents; + var size = Math.min(contents.length - position, length); + if (size > 8 && contents.subarray) { // non-trivial, and typed array + buffer.set(contents.subarray(position, position + size), offset); + } else + { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } + return size; + },write:function (stream, buffer, offset, length, position, canOwn) { + var node = stream.node; + node.timestamp = Date.now(); + var contents = node.contents; + if (length && contents.length === 0 && position === 0 && buffer.subarray) { + // just replace it with the new data + assert(buffer.length); + if (canOwn && buffer.buffer === HEAP8.buffer && offset === 0) { + node.contents = buffer; // this is a subarray of the heap, and we can own it + node.contentMode = MEMFS.CONTENT_OWNING; + } else { + node.contents = new Uint8Array(buffer.subarray(offset, offset+length)); + node.contentMode = MEMFS.CONTENT_FIXED; + } + return length; + } + MEMFS.ensureFlexible(node); + var contents = node.contents; + while (contents.length < position) contents.push(0); + for (var i = 0; i < length; i++) { + contents[position + i] = buffer[offset + i]; + } + return length; + },llseek:function (stream, offset, whence) { + var position = offset; + if (whence === 1) { // SEEK_CUR. + position += stream.position; + } else if (whence === 2) { // SEEK_END. + if (FS.isFile(stream.node.mode)) { + position += stream.node.contents.length; + } + } + if (position < 0) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + stream.ungotten = []; + stream.position = position; + return position; + },allocate:function (stream, offset, length) { + MEMFS.ensureFlexible(stream.node); + var contents = stream.node.contents; + var limit = offset + length; + while (limit > contents.length) contents.push(0); + },mmap:function (stream, buffer, offset, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(ERRNO_CODES.ENODEV); + } + var ptr; + var allocated; + var contents = stream.node.contents; + // Only make a new copy when MAP_PRIVATE is specified. + if ( !(flags & 0x02) && + (contents.buffer === buffer || contents.buffer === buffer.buffer) ) { + // We can't emulate MAP_SHARED when the file is not backed by the buffer + // we're mapping to (e.g. the HEAP buffer). + allocated = false; + ptr = contents.byteOffset; + } else { + // Try to avoid unnecessary slices. + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call(contents, position, position + length); + } + } + allocated = true; + ptr = _malloc(length); + if (!ptr) { + throw new FS.ErrnoError(ERRNO_CODES.ENOMEM); + } + buffer.set(contents, ptr); + } + return { ptr: ptr, allocated: allocated }; + }}}; + var _stdin=allocate(1, "i32*", ALLOC_STATIC); + var _stdout=allocate(1, "i32*", ALLOC_STATIC); + var _stderr=allocate(1, "i32*", ALLOC_STATIC); + function _fflush(stream) { + // int fflush(FILE *stream); + // http://pubs.opengroup.org/onlinepubs/000095399/functions/fflush.html + // we don't currently perform any user-space buffering of data + }var FS={root:null,devices:[null],streams:[null],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:function ErrnoError(errno) { + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + this.message = ERRNO_MESSAGES[errno]; + },handleFSError:function (e) { + if (!(e instanceof FS.ErrnoError)) throw e + ' : ' + new Error().stack; + return ___setErrNo(e.errno); + },cwd:function () { + return FS.currentPath; + },lookupPath:function (path, opts) { + path = PATH.resolve(FS.currentPath, path); + opts = opts || { recurse_count: 0 }; + if (opts.recurse_count > 8) { // max recursive lookup of 8 + throw new FS.ErrnoError(ERRNO_CODES.ELOOP); + } + // split the path + var parts = PATH.normalizeArray(path.split('/').filter(function(p) { + return !!p; + }), false); + // start at the root + var current = FS.root; + var current_path = '/'; + for (var i = 0; i < parts.length; i++) { + var islast = (i === parts.length-1); + if (islast && opts.parent) { + // stop resolving + break; + } + current = FS.lookupNode(current, parts[i]); + current_path = PATH.join(current_path, parts[i]); + // jump to the mount's root node if this is a mountpoint + if (FS.isMountpoint(current)) { + current = current.mount.root; + } + // follow symlinks + // by default, lookupPath will not follow a symlink if it is the final path component. + // setting opts.follow = true will override this behavior. + if (!islast || opts.follow) { + var count = 0; + while (FS.isLink(current.mode)) { + var link = FS.readlink(current_path); + current_path = PATH.resolve(PATH.dirname(current_path), link); + var lookup = FS.lookupPath(current_path, { recurse_count: opts.recurse_count }); + current = lookup.node; + if (count++ > 40) { // limit max consecutive symlinks to 40 (SYMLOOP_MAX). + throw new FS.ErrnoError(ERRNO_CODES.ELOOP); + } + } + } + } + return { path: current_path, node: current }; + },getPath:function (node) { + var path; + while (true) { + if (FS.isRoot(node)) { + return path ? PATH.join(node.mount.mountpoint, path) : node.mount.mountpoint; + } + path = path ? PATH.join(node.name, path) : node.name; + node = node.parent; + } + },hashName:function (parentid, name) { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + },hashAddNode:function (node) { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + },hashRemoveNode:function (node) { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + },lookupNode:function (parent, name) { + var err = FS.mayLookup(parent); + if (err) { + throw new FS.ErrnoError(err); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + if (node.parent.id === parent.id && node.name === name) { + return node; + } + } + // if we failed to find it in the cache, call into the VFS + return FS.lookup(parent, name); + },createNode:function (parent, name, mode, rdev) { + var node = { + id: FS.nextInode++, + name: name, + mode: mode, + node_ops: {}, + stream_ops: {}, + rdev: rdev, + parent: null, + mount: null + }; + if (!parent) { + parent = node; // root node sets parent to itself + } + node.parent = parent; + node.mount = parent.mount; + // compatibility + var readMode = 292 | 73; + var writeMode = 146; + // NOTE we must use Object.defineProperties instead of individual calls to + // Object.defineProperty in order to make closure compiler happy + Object.defineProperties(node, { + read: { + get: function() { return (node.mode & readMode) === readMode; }, + set: function(val) { val ? node.mode |= readMode : node.mode &= ~readMode; } + }, + write: { + get: function() { return (node.mode & writeMode) === writeMode; }, + set: function(val) { val ? node.mode |= writeMode : node.mode &= ~writeMode; } + }, + isFolder: { + get: function() { return FS.isDir(node.mode); }, + }, + isDevice: { + get: function() { return FS.isChrdev(node.mode); }, + }, + }); + FS.hashAddNode(node); + return node; + },destroyNode:function (node) { + FS.hashRemoveNode(node); + },isRoot:function (node) { + return node === node.parent; + },isMountpoint:function (node) { + return node.mounted; + },isFile:function (mode) { + return (mode & 0170000) === 0100000; + },isDir:function (mode) { + return (mode & 0170000) === 0040000; + },isLink:function (mode) { + return (mode & 0170000) === 0120000; + },isChrdev:function (mode) { + return (mode & 0170000) === 0020000; + },isBlkdev:function (mode) { + return (mode & 0170000) === 0060000; + },isFIFO:function (mode) { + return (mode & 0170000) === 0010000; + },isSocket:function (mode) { + return (mode & 0140000) === 0140000; + },flagModes:{"r":0,"rs":8192,"r+":2,"w":1537,"wx":3585,"xw":3585,"w+":1538,"wx+":3586,"xw+":3586,"a":521,"ax":2569,"xa":2569,"a+":522,"ax+":2570,"xa+":2570},modeStringToFlags:function (str) { + var flags = FS.flagModes[str]; + if (typeof flags === 'undefined') { + throw new Error('Unknown file open mode: ' + str); + } + return flags; + },flagsToPermissionString:function (flag) { + var accmode = flag & 3; + var perms = ['r', 'w', 'rw'][accmode]; + if ((flag & 1024)) { + perms += 'w'; + } + return perms; + },nodePermissions:function (node, perms) { + if (FS.ignorePermissions) { + return 0; + } + // return 0 if any user, group or owner bits are set. + if (perms.indexOf('r') !== -1 && !(node.mode & 292)) { + return ERRNO_CODES.EACCES; + } else if (perms.indexOf('w') !== -1 && !(node.mode & 146)) { + return ERRNO_CODES.EACCES; + } else if (perms.indexOf('x') !== -1 && !(node.mode & 73)) { + return ERRNO_CODES.EACCES; + } + return 0; + },mayLookup:function (dir) { + return FS.nodePermissions(dir, 'x'); + },mayCreate:function (dir, name) { + try { + var node = FS.lookupNode(dir, name); + return ERRNO_CODES.EEXIST; + } catch (e) { + } + return FS.nodePermissions(dir, 'wx'); + },mayDelete:function (dir, name, isdir) { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var err = FS.nodePermissions(dir, 'wx'); + if (err) { + return err; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return ERRNO_CODES.ENOTDIR; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.currentPath) { + return ERRNO_CODES.EBUSY; + } + } else { + if (FS.isDir(node.mode)) { + return ERRNO_CODES.EISDIR; + } + } + return 0; + },mayOpen:function (node, flags) { + if (!node) { + return ERRNO_CODES.ENOENT; + } + if (FS.isLink(node.mode)) { + return ERRNO_CODES.ELOOP; + } else if (FS.isDir(node.mode)) { + if ((flags & 3) !== 0 || // opening for write + (flags & 1024)) { + return ERRNO_CODES.EISDIR; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + },MAX_OPEN_FDS:4096,nextfd:function (fd_start, fd_end) { + fd_start = fd_start || 1; + fd_end = fd_end || FS.MAX_OPEN_FDS; + for (var fd = fd_start; fd <= fd_end; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(ERRNO_CODES.EMFILE); + },getStream:function (fd) { + return FS.streams[fd]; + },createStream:function (stream, fd_start, fd_end) { + var fd = FS.nextfd(fd_start, fd_end); + stream.fd = fd; + // compatibility + Object.defineProperties(stream, { + object: { + get: function() { return stream.node; }, + set: function(val) { stream.node = val; } + }, + isRead: { + get: function() { return (stream.flags & 3) !== 1; } + }, + isWrite: { + get: function() { return (stream.flags & 3) !== 0; } + }, + isAppend: { + get: function() { return (stream.flags & 8); } + } + }); + FS.streams[fd] = stream; + return stream; + },closeStream:function (fd) { + FS.streams[fd] = null; + },chrdev_stream_ops:{open:function (stream) { + var device = FS.getDevice(stream.node.rdev); + // override node's stream ops with the device's + stream.stream_ops = device.stream_ops; + // forward the open call + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + },llseek:function () { + throw new FS.ErrnoError(ERRNO_CODES.ESPIPE); + }},major:function (dev) { + return ((dev) >> 8); + },minor:function (dev) { + return ((dev) & 0xff); + },makedev:function (ma, mi) { + return ((ma) << 8 | (mi)); + },registerDevice:function (dev, ops) { + FS.devices[dev] = { stream_ops: ops }; + },getDevice:function (dev) { + return FS.devices[dev]; + },mount:function (type, opts, mountpoint) { + var mount = { + type: type, + opts: opts, + mountpoint: mountpoint, + root: null + }; + var lookup; + if (mountpoint) { + lookup = FS.lookupPath(mountpoint, { follow: false }); + } + // create a root node for the fs + var root = type.mount(mount); + root.mount = mount; + mount.root = root; + // assign the mount info to the mountpoint's node + if (lookup) { + lookup.node.mount = mount; + lookup.node.mounted = true; + // compatibility update FS.root if we mount to / + if (mountpoint === '/') { + FS.root = mount.root; + } + } + return root; + },lookup:function (parent, name) { + return parent.node_ops.lookup(parent, name); + },mknod:function (path, mode, dev) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + var err = FS.mayCreate(parent, name); + if (err) { + throw new FS.ErrnoError(err); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(ERRNO_CODES.EPERM); + } + return parent.node_ops.mknod(parent, name, mode, dev); + },create:function (path, mode) { + mode = mode !== undefined ? mode : 0666; + mode &= 4095; + mode |= 0100000; + return FS.mknod(path, mode, 0); + },mkdir:function (path, mode) { + mode = mode !== undefined ? mode : 0777; + mode &= 511 | 0001000; + mode |= 0040000; + return FS.mknod(path, mode, 0); + },mkdev:function (path, mode, dev) { + if (typeof(dev) === 'undefined') { + dev = mode; + mode = 0666; + } + mode |= 0020000; + return FS.mknod(path, mode, dev); + },symlink:function (oldpath, newpath) { + var lookup = FS.lookupPath(newpath, { parent: true }); + var parent = lookup.node; + var newname = PATH.basename(newpath); + var err = FS.mayCreate(parent, newname); + if (err) { + throw new FS.ErrnoError(err); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(ERRNO_CODES.EPERM); + } + return parent.node_ops.symlink(parent, newname, oldpath); + },rename:function (old_path, new_path) { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + // parents must exist + var lookup, old_dir, new_dir; + try { + lookup = FS.lookupPath(old_path, { parent: true }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { parent: true }); + new_dir = lookup.node; + } catch (e) { + throw new FS.ErrnoError(ERRNO_CODES.EBUSY); + } + // need to be part of the same mount + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(ERRNO_CODES.EXDEV); + } + // source must exist + var old_node = FS.lookupNode(old_dir, old_name); + // old path should not be an ancestor of the new path + var relative = PATH.relative(old_path, new_dirname); + if (relative.charAt(0) !== '.') { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + // new path should not be an ancestor of the old path + relative = PATH.relative(new_path, old_dirname); + if (relative.charAt(0) !== '.') { + throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY); + } + // see if the new path already exists + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) { + // not fatal + } + // early out if nothing needs to change + if (old_node === new_node) { + return; + } + // we'll need to delete the old entry + var isdir = FS.isDir(old_node.mode); + var err = FS.mayDelete(old_dir, old_name, isdir); + if (err) { + throw new FS.ErrnoError(err); + } + // need delete permissions if we'll be overwriting. + // need create permissions if new doesn't already exist. + err = new_node ? + FS.mayDelete(new_dir, new_name, isdir) : + FS.mayCreate(new_dir, new_name); + if (err) { + throw new FS.ErrnoError(err); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(ERRNO_CODES.EPERM); + } + if (FS.isMountpoint(old_node) || (new_node && FS.isMountpoint(new_node))) { + throw new FS.ErrnoError(ERRNO_CODES.EBUSY); + } + // if we are going to change the parent, check write permissions + if (new_dir !== old_dir) { + err = FS.nodePermissions(old_dir, 'w'); + if (err) { + throw new FS.ErrnoError(err); + } + } + // remove the node from the lookup hash + FS.hashRemoveNode(old_node); + // do the underlying fs rename + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + } catch (e) { + throw e; + } finally { + // add the node back to the hash (in case node_ops.rename + // changed its name) + FS.hashAddNode(old_node); + } + },rmdir:function (path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var err = FS.mayDelete(parent, name, true); + if (err) { + throw new FS.ErrnoError(err); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(ERRNO_CODES.EPERM); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(ERRNO_CODES.EBUSY); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + },readdir:function (path) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node.node_ops.readdir) { + throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR); + } + return node.node_ops.readdir(node); + },unlink:function (path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var err = FS.mayDelete(parent, name, false); + if (err) { + // POSIX says unlink should set EPERM, not EISDIR + if (err === ERRNO_CODES.EISDIR) err = ERRNO_CODES.EPERM; + throw new FS.ErrnoError(err); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(ERRNO_CODES.EPERM); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(ERRNO_CODES.EBUSY); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + },readlink:function (path) { + var lookup = FS.lookupPath(path, { follow: false }); + var link = lookup.node; + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + return link.node_ops.readlink(link); + },stat:function (path, dontFollow) { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + var node = lookup.node; + if (!node.node_ops.getattr) { + throw new FS.ErrnoError(ERRNO_CODES.EPERM); + } + return node.node_ops.getattr(node); + },lstat:function (path) { + return FS.stat(path, true); + },chmod:function (path, mode, dontFollow) { + var node; + if (typeof path === 'string') { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(ERRNO_CODES.EPERM); + } + node.node_ops.setattr(node, { + mode: (mode & 4095) | (node.mode & ~4095), + timestamp: Date.now() + }); + },lchmod:function (path, mode) { + FS.chmod(path, mode, true); + },fchmod:function (fd, mode) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(ERRNO_CODES.EBADF); + } + FS.chmod(stream.node, mode); + },chown:function (path, uid, gid, dontFollow) { + var node; + if (typeof path === 'string') { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(ERRNO_CODES.EPERM); + } + node.node_ops.setattr(node, { + timestamp: Date.now() + // we ignore the uid / gid for now + }); + },lchown:function (path, uid, gid) { + FS.chown(path, uid, gid, true); + },fchown:function (fd, uid, gid) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(ERRNO_CODES.EBADF); + } + FS.chown(stream.node, uid, gid); + },truncate:function (path, len) { + if (len < 0) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + var node; + if (typeof path === 'string') { + var lookup = FS.lookupPath(path, { follow: true }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(ERRNO_CODES.EPERM); + } + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(ERRNO_CODES.EISDIR); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + var err = FS.nodePermissions(node, 'w'); + if (err) { + throw new FS.ErrnoError(err); + } + node.node_ops.setattr(node, { + size: len, + timestamp: Date.now() + }); + },ftruncate:function (fd, len) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(ERRNO_CODES.EBADF); + } + if ((stream.flags & 3) === 0) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + FS.truncate(stream.node, len); + },utime:function (path, atime, mtime) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + node.node_ops.setattr(node, { + timestamp: Math.max(atime, mtime) + }); + },open:function (path, flags, mode, fd_start, fd_end) { + path = PATH.normalize(path); + flags = typeof flags === 'string' ? FS.modeStringToFlags(flags) : flags; + mode = typeof mode === 'undefined' ? 0666 : mode; + if ((flags & 512)) { + mode = (mode & 4095) | 0100000; + } else { + mode = 0; + } + var node; + try { + var lookup = FS.lookupPath(path, { + follow: !(flags & 0200000) + }); + node = lookup.node; + path = lookup.path; + } catch (e) { + // ignore + } + // perhaps we need to create the node + if ((flags & 512)) { + if (node) { + // if O_CREAT and O_EXCL are set, error out if the node already exists + if ((flags & 2048)) { + throw new FS.ErrnoError(ERRNO_CODES.EEXIST); + } + } else { + // node doesn't exist, try to create it + node = FS.mknod(path, mode, 0); + } + } + if (!node) { + throw new FS.ErrnoError(ERRNO_CODES.ENOENT); + } + // can't truncate a device + if (FS.isChrdev(node.mode)) { + flags &= ~1024; + } + // check permissions + var err = FS.mayOpen(node, flags); + if (err) { + throw new FS.ErrnoError(err); + } + // do truncation if necessary + if ((flags & 1024)) { + FS.truncate(node, 0); + } + // register the stream with the filesystem + var stream = FS.createStream({ + path: path, + node: node, + flags: flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + // used by the file family libc calls (fopen, fwrite, ferror, etc.) + ungotten: [], + error: false + }, fd_start, fd_end); + // call the new stream's open function + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + return stream; + },close:function (stream) { + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + },llseek:function (stream, offset, whence) { + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(ERRNO_CODES.ESPIPE); + } + return stream.stream_ops.llseek(stream, offset, whence); + },read:function (stream, buffer, offset, length, position) { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + if ((stream.flags & 3) === 1) { + throw new FS.ErrnoError(ERRNO_CODES.EBADF); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(ERRNO_CODES.EISDIR); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + var seeking = true; + if (typeof position === 'undefined') { + position = stream.position; + seeking = false; + } else if (!stream.seekable) { + throw new FS.ErrnoError(ERRNO_CODES.ESPIPE); + } + var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position); + if (!seeking) stream.position += bytesRead; + return bytesRead; + },write:function (stream, buffer, offset, length, position, canOwn) { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + if ((stream.flags & 3) === 0) { + throw new FS.ErrnoError(ERRNO_CODES.EBADF); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(ERRNO_CODES.EISDIR); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + var seeking = true; + if (typeof position === 'undefined') { + position = stream.position; + seeking = false; + } else if (!stream.seekable) { + throw new FS.ErrnoError(ERRNO_CODES.ESPIPE); + } + if (stream.flags & 8) { + // seek to the end before writing in append mode + FS.llseek(stream, 0, 2); + } + var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + },allocate:function (stream, offset, length) { + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + if ((stream.flags & 3) === 0) { + throw new FS.ErrnoError(ERRNO_CODES.EBADF); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(ERRNO_CODES.ENODEV); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP); + } + stream.stream_ops.allocate(stream, offset, length); + },mmap:function (stream, buffer, offset, length, position, prot, flags) { + // TODO if PROT is PROT_WRITE, make sure we have write access + if ((stream.flags & 3) === 1) { + throw new FS.ErrnoError(ERRNO_CODES.EACCES); + } + if (!stream.stream_ops.mmap) { + throw new FS.errnoError(ERRNO_CODES.ENODEV); + } + return stream.stream_ops.mmap(stream, buffer, offset, length, position, prot, flags); + },ioctl:function (stream, cmd, arg) { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(ERRNO_CODES.ENOTTY); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + },readFile:function (path, opts) { + opts = opts || {}; + opts.flags = opts.flags || 'r'; + opts.encoding = opts.encoding || 'binary'; + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === 'utf8') { + ret = ''; + var utf8 = new Runtime.UTF8Processor(); + for (var i = 0; i < length; i++) { + ret += utf8.processCChar(buf[i]); + } + } else if (opts.encoding === 'binary') { + ret = buf; + } else { + throw new Error('Invalid encoding type "' + opts.encoding + '"'); + } + FS.close(stream); + return ret; + },writeFile:function (path, data, opts) { + opts = opts || {}; + opts.flags = opts.flags || 'w'; + opts.encoding = opts.encoding || 'utf8'; + var stream = FS.open(path, opts.flags, opts.mode); + if (opts.encoding === 'utf8') { + var utf8 = new Runtime.UTF8Processor(); + var buf = new Uint8Array(utf8.processJSString(data)); + FS.write(stream, buf, 0, buf.length, 0); + } else if (opts.encoding === 'binary') { + FS.write(stream, data, 0, data.length, 0); + } else { + throw new Error('Invalid encoding type "' + opts.encoding + '"'); + } + FS.close(stream); + },createDefaultDirectories:function () { + FS.mkdir('/tmp'); + },createDefaultDevices:function () { + // create /dev + FS.mkdir('/dev'); + // setup /dev/null + FS.registerDevice(FS.makedev(1, 3), { + read: function() { return 0; }, + write: function() { return 0; } + }); + FS.mkdev('/dev/null', FS.makedev(1, 3)); + // setup /dev/tty and /dev/tty1 + // stderr needs to print output using Module['printErr'] + // so we register a second tty just for it. + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev('/dev/tty', FS.makedev(5, 0)); + FS.mkdev('/dev/tty1', FS.makedev(6, 0)); + // we're not going to emulate the actual shm device, + // just create the tmp dirs that reside in it commonly + FS.mkdir('/dev/shm'); + FS.mkdir('/dev/shm/tmp'); + },createStandardStreams:function () { + // TODO deprecate the old functionality of a single + // input / output callback and that utilizes FS.createDevice + // and instead require a unique set of stream ops + // by default, we symlink the standard streams to the + // default tty devices. however, if the standard streams + // have been overwritten we create a unique device for + // them instead. + if (Module['stdin']) { + FS.createDevice('/dev', 'stdin', Module['stdin']); + } else { + FS.symlink('/dev/tty', '/dev/stdin'); + } + if (Module['stdout']) { + FS.createDevice('/dev', 'stdout', null, Module['stdout']); + } else { + FS.symlink('/dev/tty', '/dev/stdout'); + } + if (Module['stderr']) { + FS.createDevice('/dev', 'stderr', null, Module['stderr']); + } else { + FS.symlink('/dev/tty1', '/dev/stderr'); + } + // open default streams for the stdin, stdout and stderr devices + var stdin = FS.open('/dev/stdin', 'r'); + HEAP32[((_stdin)>>2)]=stdin.fd; + assert(stdin.fd === 1, 'invalid handle for stdin (' + stdin.fd + ')'); + var stdout = FS.open('/dev/stdout', 'w'); + HEAP32[((_stdout)>>2)]=stdout.fd; + assert(stdout.fd === 2, 'invalid handle for stdout (' + stdout.fd + ')'); + var stderr = FS.open('/dev/stderr', 'w'); + HEAP32[((_stderr)>>2)]=stderr.fd; + assert(stderr.fd === 3, 'invalid handle for stderr (' + stderr.fd + ')'); + },staticInit:function () { + FS.nameTable = new Array(4096); + FS.root = FS.createNode(null, '/', 0040000 | 0777, 0); + FS.mount(MEMFS, {}, '/'); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + },init:function (input, output, error) { + assert(!FS.init.initialized, 'FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)'); + FS.init.initialized = true; + // Allow Module.stdin etc. to provide defaults, if none explicitly passed to us here + Module['stdin'] = input || Module['stdin']; + Module['stdout'] = output || Module['stdout']; + Module['stderr'] = error || Module['stderr']; + FS.createStandardStreams(); + },quit:function () { + FS.init.initialized = false; + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + },getMode:function (canRead, canWrite) { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + },joinPath:function (parts, forceRelative) { + var path = PATH.join.apply(null, parts); + if (forceRelative && path[0] == '/') path = path.substr(1); + return path; + },absolutePath:function (relative, base) { + return PATH.resolve(base, relative); + },standardizePath:function (path) { + return PATH.normalize(path); + },findObject:function (path, dontResolveLastLink) { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (ret.exists) { + return ret.object; + } else { + ___setErrNo(ret.error); + return null; + } + },analyzePath:function (path, dontResolveLastLink) { + // operate from within the context of the symlink's target + try { + var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + path = lookup.path; + } catch (e) { + } + var ret = { + isRoot: false, exists: false, error: 0, name: null, path: null, object: null, + parentExists: false, parentPath: null, parentObject: null + }; + try { + var lookup = FS.lookupPath(path, { parent: true }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === '/'; + } catch (e) { + ret.error = e.errno; + }; + return ret; + },createFolder:function (parent, name, canRead, canWrite) { + var path = PATH.join(typeof parent === 'string' ? parent : FS.getPath(parent), name); + var mode = FS.getMode(canRead, canWrite); + return FS.mkdir(path, mode); + },createPath:function (parent, path, canRead, canWrite) { + parent = typeof parent === 'string' ? parent : FS.getPath(parent); + var parts = path.split('/').reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join(parent, part); + try { + FS.mkdir(current); + } catch (e) { + // ignore EEXIST + } + parent = current; + } + return current; + },createFile:function (parent, name, properties, canRead, canWrite) { + var path = PATH.join(typeof parent === 'string' ? parent : FS.getPath(parent), name); + var mode = FS.getMode(canRead, canWrite); + return FS.create(path, mode); + },createDataFile:function (parent, name, data, canRead, canWrite, canOwn) { + var path = name ? PATH.join(typeof parent === 'string' ? parent : FS.getPath(parent), name) : parent; + var mode = FS.getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data === 'string') { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i); + data = arr; + } + // make sure we can write to the file + FS.chmod(path, mode | 146); + var stream = FS.open(path, 'w'); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(path, mode); + } + return node; + },createDevice:function (parent, name, input, output) { + var path = PATH.join(typeof parent === 'string' ? parent : FS.getPath(parent), name); + var mode = FS.getMode(!!input, !!output); + if (!FS.createDevice.major) FS.createDevice.major = 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + // Create a fake device that a set of stream ops to emulate + // the old behavior. + FS.registerDevice(dev, { + open: function(stream) { + stream.seekable = false; + }, + close: function(stream) { + // flush any pending line data + if (output && output.buffer && output.buffer.length) { + output(10); + } + }, + read: function(stream, buffer, offset, length, pos /* ignored */) { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(ERRNO_CODES.EIO); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(ERRNO_CODES.EAGAIN); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset+i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write: function(stream, buffer, offset, length, pos) { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset+i]); + } catch (e) { + throw new FS.ErrnoError(ERRNO_CODES.EIO); + } + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + } + }); + return FS.mkdev(path, mode, dev); + },createLink:function (parent, name, target, canRead, canWrite) { + var path = PATH.join(typeof parent === 'string' ? parent : FS.getPath(parent), name); + return FS.symlink(target, path); + },forceLoadFile:function (obj) { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true; + var success = true; + if (typeof XMLHttpRequest !== 'undefined') { + throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread."); + } else if (Module['read']) { + // Command-line. + try { + // WARNING: Can't read binary files in V8's d8 or tracemonkey's js, as + // read() will try to parse UTF8. + obj.contents = intArrayFromString(Module['read'](obj.url), true); + } catch (e) { + success = false; + } + } else { + throw new Error('Cannot load without read() or XMLHttpRequest.'); + } + if (!success) ___setErrNo(ERRNO_CODES.EIO); + return success; + },createLazyFile:function (parent, name, url, canRead, canWrite) { + if (typeof XMLHttpRequest !== 'undefined') { + if (!ENVIRONMENT_IS_WORKER) throw 'Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc'; + // Lazy chunked Uint8Array (implements get and length from Uint8Array). Actual getting is abstracted away for eventual reuse. + var LazyUint8Array = function() { + this.lengthKnown = false; + this.chunks = []; // Loaded chunks. Index is the chunk number + } + LazyUint8Array.prototype.get = function(idx) { + if (idx > this.length-1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = Math.floor(idx / this.chunkSize); + return this.getter(chunkNum)[chunkOffset]; + } + LazyUint8Array.prototype.setDataGetter = function(getter) { + this.getter = getter; + } + LazyUint8Array.prototype.cacheLength = function() { + // Find length + var xhr = new XMLHttpRequest(); + xhr.open('HEAD', url, false); + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes"; + var chunkSize = 1024*1024; // Chunk size in bytes + if (!hasByteServing) chunkSize = datalength; + // Function to get a range from the remote URL. + var doXHR = (function(from, to) { + if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!"); + if (to > datalength-1) throw new Error("only " + datalength + " bytes available! programmer error!"); + // TODO: Use mozResponseArrayBuffer, responseStream, etc. if available. + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + // Some hints to the browser that we want binary data. + if (typeof Uint8Array != 'undefined') xhr.responseType = 'arraybuffer'; + if (xhr.overrideMimeType) { + xhr.overrideMimeType('text/plain; charset=x-user-defined'); + } + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } else { + return intArrayFromString(xhr.responseText || '', true); + } + }); + var lazyArray = this; + lazyArray.setDataGetter(function(chunkNum) { + var start = chunkNum * chunkSize; + var end = (chunkNum+1) * chunkSize - 1; // including this byte + end = Math.min(end, datalength-1); // if datalength-1 is selected, this is the last block + if (typeof(lazyArray.chunks[chunkNum]) === "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof(lazyArray.chunks[chunkNum]) === "undefined") throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + } + var lazyArray = new LazyUint8Array(); + Object.defineProperty(lazyArray, "length", { + get: function() { + if(!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + }); + Object.defineProperty(lazyArray, "chunkSize", { + get: function() { + if(!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + }); + var properties = { isDevice: false, contents: lazyArray }; + } else { + var properties = { isDevice: false, url: url }; + } + var node = FS.createFile(parent, name, properties, canRead, canWrite); + // This is a total hack, but I want to get this lazy file code out of the + // core of MEMFS. If we want to keep this lazy file concept I feel it should + // be its own thin LAZYFS proxying calls to MEMFS. + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + // override each stream op with one that tries to force load the lazy file first + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach(function(key) { + var fn = node.stream_ops[key]; + stream_ops[key] = function() { + if (!FS.forceLoadFile(node)) { + throw new FS.ErrnoError(ERRNO_CODES.EIO); + } + return fn.apply(null, arguments); + }; + }); + // use a custom read function + stream_ops.read = function(stream, buffer, offset, length, position) { + if (!FS.forceLoadFile(node)) { + throw new FS.ErrnoError(ERRNO_CODES.EIO); + } + var contents = stream.node.contents; + var size = Math.min(contents.length - position, length); + if (contents.slice) { // normal array + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { // LazyUint8Array from sync binary XHR + buffer[offset + i] = contents.get(position + i); + } + } + return size; + }; + node.stream_ops = stream_ops; + return node; + },createPreloadedFile:function (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn) { + Browser.init(); + // TODO we should allow people to just pass in a complete filename instead + // of parent and name being that we just join them anyways + var fullname = name ? PATH.resolve(PATH.join(parent, name)) : parent; + function processData(byteArray) { + function finish(byteArray) { + if (!dontCreateFile) { + FS.createDataFile(parent, name, byteArray, canRead, canWrite, canOwn); + } + if (onload) onload(); + removeRunDependency('cp ' + fullname); + } + var handled = false; + Module['preloadPlugins'].forEach(function(plugin) { + if (handled) return; + if (plugin['canHandle'](fullname)) { + plugin['handle'](byteArray, fullname, finish, function() { + if (onerror) onerror(); + removeRunDependency('cp ' + fullname); + }); + handled = true; + } + }); + if (!handled) finish(byteArray); + } + addRunDependency('cp ' + fullname); + if (typeof url == 'string') { + Browser.asyncLoad(url, function(byteArray) { + processData(byteArray); + }, onerror); + } else { + processData(url); + } + },indexedDB:function () { + return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; + },DB_NAME:function () { + return 'EM_FS_' + window.location.pathname; + },DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:function (paths, onload, onerror) { + onload = onload || function(){}; + onerror = onerror || function(){}; + var indexedDB = FS.indexedDB(); + try { + var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION); + } catch (e) { + return onerror(e); + } + openRequest.onupgradeneeded = function() { + console.log('creating db'); + var db = openRequest.result; + db.createObjectStore(FS.DB_STORE_NAME); + }; + openRequest.onsuccess = function() { + var db = openRequest.result; + var transaction = db.transaction([FS.DB_STORE_NAME], 'readwrite'); + var files = transaction.objectStore(FS.DB_STORE_NAME); + var ok = 0, fail = 0, total = paths.length; + function finish() { + if (fail == 0) onload(); else onerror(); + } + paths.forEach(function(path) { + var putRequest = files.put(FS.analyzePath(path).object.contents, path); + putRequest.onsuccess = function() { ok++; if (ok + fail == total) finish() }; + putRequest.onerror = function() { fail++; if (ok + fail == total) finish() }; + }); + transaction.onerror = onerror; + }; + openRequest.onerror = onerror; + },loadFilesFromDB:function (paths, onload, onerror) { + onload = onload || function(){}; + onerror = onerror || function(){}; + var indexedDB = FS.indexedDB(); + try { + var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION); + } catch (e) { + return onerror(e); + } + openRequest.onupgradeneeded = onerror; // no database to load from + openRequest.onsuccess = function() { + var db = openRequest.result; + try { + var transaction = db.transaction([FS.DB_STORE_NAME], 'readonly'); + } catch(e) { + onerror(e); + return; + } + var files = transaction.objectStore(FS.DB_STORE_NAME); + var ok = 0, fail = 0, total = paths.length; + function finish() { + if (fail == 0) onload(); else onerror(); + } + paths.forEach(function(path) { + var getRequest = files.get(path); + getRequest.onsuccess = function() { + if (FS.analyzePath(path).exists) { + FS.unlink(path); + } + FS.createDataFile(PATH.dirname(path), PATH.basename(path), getRequest.result, true, true, true); + ok++; + if (ok + fail == total) finish(); + }; + getRequest.onerror = function() { fail++; if (ok + fail == total) finish() }; + }); + transaction.onerror = onerror; + }; + openRequest.onerror = onerror; + }}; + var SOCKFS={mount:function (mount) { + return FS.createNode(null, '/', 0040000 | 0777, 0); + },nextname:function () { + if (!SOCKFS.nextname.current) { + SOCKFS.nextname.current = 0; + } + return 'socket[' + (SOCKFS.nextname.current++) + ']'; + },createSocket:function (family, type, protocol) { + var streaming = type == 1; + if (protocol) { + assert(streaming == (protocol == 6)); // if SOCK_STREAM, must be tcp + } + // create our internal socket structure + var sock = { + family: family, + type: type, + protocol: protocol, + server: null, + peers: {}, + pending: [], + recv_queue: [], + sock_ops: SOCKFS.websocket_sock_ops + }; + // create the filesystem node to store the socket structure + var name = SOCKFS.nextname(); + var node = FS.createNode(SOCKFS.root, name, 0140000, 0); + node.sock = sock; + // and the wrapping stream that enables library functions such + // as read and write to indirectly interact with the socket + var stream = FS.createStream({ + path: name, + node: node, + flags: FS.modeStringToFlags('r+'), + seekable: false, + stream_ops: SOCKFS.stream_ops + }); + // map the new stream to the socket structure (sockets have a 1:1 + // relationship with a stream) + sock.stream = stream; + return sock; + },getSocket:function (fd) { + var stream = FS.getStream(fd); + if (!stream || !FS.isSocket(stream.node.mode)) { + return null; + } + return stream.node.sock; + },stream_ops:{poll:function (stream) { + var sock = stream.node.sock; + return sock.sock_ops.poll(sock); + },ioctl:function (stream, request, varargs) { + var sock = stream.node.sock; + return sock.sock_ops.ioctl(sock, request, varargs); + },read:function (stream, buffer, offset, length, position /* ignored */) { + var sock = stream.node.sock; + var msg = sock.sock_ops.recvmsg(sock, length); + if (!msg) { + // socket is closed + return 0; + } + buffer.set(msg.buffer, offset); + return msg.buffer.length; + },write:function (stream, buffer, offset, length, position /* ignored */) { + var sock = stream.node.sock; + return sock.sock_ops.sendmsg(sock, buffer, offset, length); + },close:function (stream) { + var sock = stream.node.sock; + sock.sock_ops.close(sock); + }},websocket_sock_ops:{createPeer:function (sock, addr, port) { + var ws; + if (typeof addr === 'object') { + ws = addr; + addr = null; + port = null; + } + if (ws) { + // for sockets that've already connected (e.g. we're the server) + // we can inspect the _socket property for the address + if (ws._socket) { + addr = ws._socket.remoteAddress; + port = ws._socket.remotePort; + } + // if we're just now initializing a connection to the remote, + // inspect the url property + else { + var result = /ws[s]?:\/\/([^:]+):(\d+)/.exec(ws.url); + if (!result) { + throw new Error('WebSocket URL must be in the format ws(s)://address:port'); + } + addr = result[1]; + port = parseInt(result[2], 10); + } + } else { + // create the actual websocket object and connect + try { + var url = 'ws://' + addr + ':' + port; + // the node ws library API is slightly different than the browser's + var opts = ENVIRONMENT_IS_NODE ? {} : ['binary']; + ws = new WebSocket(url, opts); + ws.binaryType = 'arraybuffer'; + } catch (e) { + throw new FS.ErrnoError(ERRNO_CODES.EHOSTUNREACH); + } + } + var peer = { + addr: addr, + port: port, + socket: ws, + dgram_send_queue: [] + }; + SOCKFS.websocket_sock_ops.addPeer(sock, peer); + SOCKFS.websocket_sock_ops.handlePeerEvents(sock, peer); + // if this is a bound dgram socket, send the port number first to allow + // us to override the ephemeral port reported to us by remotePort on the + // remote end. + if (sock.type === 2 && typeof sock.sport !== 'undefined') { + peer.dgram_send_queue.push(new Uint8Array([ + 255, 255, 255, 255, + 'p'.charCodeAt(0), 'o'.charCodeAt(0), 'r'.charCodeAt(0), 't'.charCodeAt(0), + ((sock.sport & 0xff00) >> 8) , (sock.sport & 0xff) + ])); + } + return peer; + },getPeer:function (sock, addr, port) { + return sock.peers[addr + ':' + port]; + },addPeer:function (sock, peer) { + sock.peers[peer.addr + ':' + peer.port] = peer; + },removePeer:function (sock, peer) { + delete sock.peers[peer.addr + ':' + peer.port]; + },handlePeerEvents:function (sock, peer) { + var first = true; + var handleOpen = function () { + try { + var queued = peer.dgram_send_queue.shift(); + while (queued) { + peer.socket.send(queued); + queued = peer.dgram_send_queue.shift(); + } + } catch (e) { + // not much we can do here in the way of proper error handling as we've already + // lied and said this data was sent. shut it down. + peer.socket.close(); + } + }; + var handleMessage = function(data) { + assert(typeof data !== 'string' && data.byteLength !== undefined); // must receive an ArrayBuffer + data = new Uint8Array(data); // make a typed array view on the array buffer + // if this is the port message, override the peer's port with it + var wasfirst = first; + first = false; + if (wasfirst && + data.length === 10 && + data[0] === 255 && data[1] === 255 && data[2] === 255 && data[3] === 255 && + data[4] === 'p'.charCodeAt(0) && data[5] === 'o'.charCodeAt(0) && data[6] === 'r'.charCodeAt(0) && data[7] === 't'.charCodeAt(0)) { + // update the peer's port and it's key in the peer map + var newport = ((data[8] << 8) | data[9]); + SOCKFS.websocket_sock_ops.removePeer(sock, peer); + peer.port = newport; + SOCKFS.websocket_sock_ops.addPeer(sock, peer); + return; + } + sock.recv_queue.push({ addr: peer.addr, port: peer.port, data: data }); + }; + if (ENVIRONMENT_IS_NODE) { + peer.socket.on('open', handleOpen); + peer.socket.on('message', function(data, flags) { + if (!flags.binary) { + return; + } + handleMessage((new Uint8Array(data)).buffer); // copy from node Buffer -> ArrayBuffer + }); + peer.socket.on('error', function() { + // don't throw + }); + } else { + peer.socket.onopen = handleOpen; + peer.socket.onmessage = function(event) { + handleMessage(event.data); + }; + } + },poll:function (sock) { + if (sock.type === 1 && sock.server) { + // listen sockets should only say they're available for reading + // if there are pending clients. + return sock.pending.length ? (0 /* XXX missing C define POLLRDNORM */ | 1) : 0; + } + var mask = 0; + var dest = sock.type === 1 ? // we only care about the socket state for connection-based sockets + SOCKFS.websocket_sock_ops.getPeer(sock, sock.daddr, sock.dport) : + null; + if (sock.recv_queue.length || + !dest || // connection-less sockets are always ready to read + (dest && dest.socket.readyState === dest.socket.CLOSING) || + (dest && dest.socket.readyState === dest.socket.CLOSED)) { // let recv return 0 once closed + mask |= (0 /* XXX missing C define POLLRDNORM */ | 1); + } + if (!dest || // connection-less sockets are always ready to write + (dest && dest.socket.readyState === dest.socket.OPEN)) { + mask |= 2; + } + if ((dest && dest.socket.readyState === dest.socket.CLOSING) || + (dest && dest.socket.readyState === dest.socket.CLOSED)) { + mask |= 16; + } + return mask; + },ioctl:function (sock, request, arg) { + switch (request) { + case 1: + var bytes = 0; + if (sock.recv_queue.length) { + bytes = sock.recv_queue[0].data.length; + } + HEAP32[((arg)>>2)]=bytes; + return 0; + default: + return ERRNO_CODES.EINVAL; + } + },close:function (sock) { + // if we've spawned a listen server, close it + if (sock.server) { + try { + sock.server.close(); + } catch (e) { + } + sock.server = null; + } + // close any peer connections + var peers = Object.keys(sock.peers); + for (var i = 0; i < peers.length; i++) { + var peer = sock.peers[peers[i]]; + try { + peer.socket.close(); + } catch (e) { + } + SOCKFS.websocket_sock_ops.removePeer(sock, peer); + } + return 0; + },bind:function (sock, addr, port) { + if (typeof sock.saddr !== 'undefined' || typeof sock.sport !== 'undefined') { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); // already bound + } + sock.saddr = addr; + sock.sport = port || _mkport(); + // in order to emulate dgram sockets, we need to launch a listen server when + // binding on a connection-less socket + // note: this is only required on the server side + if (sock.type === 2) { + // close the existing server if it exists + if (sock.server) { + sock.server.close(); + sock.server = null; + } + // swallow error operation not supported error that occurs when binding in the + // browser where this isn't supported + try { + sock.sock_ops.listen(sock, 0); + } catch (e) { + if (!(e instanceof FS.ErrnoError)) throw e; + if (e.errno !== ERRNO_CODES.EOPNOTSUPP) throw e; + } + } + },connect:function (sock, addr, port) { + if (sock.server) { + throw new FS.ErrnoError(ERRNO_CODS.EOPNOTSUPP); + } + // TODO autobind + // if (!sock.addr && sock.type == 2) { + // } + // early out if we're already connected / in the middle of connecting + if (typeof sock.daddr !== 'undefined' && typeof sock.dport !== 'undefined') { + var dest = SOCKFS.websocket_sock_ops.getPeer(sock, sock.daddr, sock.dport); + if (dest) { + if (dest.socket.readyState === dest.socket.CONNECTING) { + throw new FS.ErrnoError(ERRNO_CODES.EALREADY); + } else { + throw new FS.ErrnoError(ERRNO_CODES.EISCONN); + } + } + } + // add the socket to our peer list and set our + // destination address / port to match + var peer = SOCKFS.websocket_sock_ops.createPeer(sock, addr, port); + sock.daddr = peer.addr; + sock.dport = peer.port; + // always "fail" in non-blocking mode + throw new FS.ErrnoError(ERRNO_CODES.EINPROGRESS); + },listen:function (sock, backlog) { + if (!ENVIRONMENT_IS_NODE) { + throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP); + } + if (sock.server) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); // already listening + } + var WebSocketServer = require('ws').Server; + var host = sock.saddr; + sock.server = new WebSocketServer({ + host: host, + port: sock.sport + // TODO support backlog + }); + sock.server.on('connection', function(ws) { + if (sock.type === 1) { + var newsock = SOCKFS.createSocket(sock.family, sock.type, sock.protocol); + // create a peer on the new socket + var peer = SOCKFS.websocket_sock_ops.createPeer(newsock, ws); + newsock.daddr = peer.addr; + newsock.dport = peer.port; + // push to queue for accept to pick up + sock.pending.push(newsock); + } else { + // create a peer on the listen socket so calling sendto + // with the listen socket and an address will resolve + // to the correct client + SOCKFS.websocket_sock_ops.createPeer(sock, ws); + } + }); + sock.server.on('closed', function() { + sock.server = null; + }); + sock.server.on('error', function() { + // don't throw + }); + },accept:function (listensock) { + if (!listensock.server) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + var newsock = listensock.pending.shift(); + newsock.stream.flags = listensock.stream.flags; + return newsock; + },getname:function (sock, peer) { + var addr, port; + if (peer) { + if (sock.daddr === undefined || sock.dport === undefined) { + throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN); + } + addr = sock.daddr; + port = sock.dport; + } else { + // TODO saddr and sport will be set for bind()'d UDP sockets, but what + // should we be returning for TCP sockets that've been connect()'d? + addr = sock.saddr || 0; + port = sock.sport || 0; + } + return { addr: addr, port: port }; + },sendmsg:function (sock, buffer, offset, length, addr, port) { + if (sock.type === 2) { + // connection-less sockets will honor the message address, + // and otherwise fall back to the bound destination address + if (addr === undefined || port === undefined) { + addr = sock.daddr; + port = sock.dport; + } + // if there was no address to fall back to, error out + if (addr === undefined || port === undefined) { + throw new FS.ErrnoError(ERRNO_CODES.EDESTADDRREQ); + } + } else { + // connection-based sockets will only use the bound + addr = sock.daddr; + port = sock.dport; + } + // find the peer for the destination address + var dest = SOCKFS.websocket_sock_ops.getPeer(sock, addr, port); + // early out if not connected with a connection-based socket + if (sock.type === 1) { + if (!dest || dest.socket.readyState === dest.socket.CLOSING || dest.socket.readyState === dest.socket.CLOSED) { + throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN); + } else if (dest.socket.readyState === dest.socket.CONNECTING) { + throw new FS.ErrnoError(ERRNO_CODES.EAGAIN); + } + } + // create a copy of the incoming data to send, as the WebSocket API + // doesn't work entirely with an ArrayBufferView, it'll just send + // the entire underlying buffer + var data; + if (buffer instanceof Array || buffer instanceof ArrayBuffer) { + data = buffer.slice(offset, offset + length); + } else { // ArrayBufferView + data = buffer.buffer.slice(buffer.byteOffset + offset, buffer.byteOffset + offset + length); + } + // if we're emulating a connection-less dgram socket and don't have + // a cached connection, queue the buffer to send upon connect and + // lie, saying the data was sent now. + if (sock.type === 2) { + if (!dest || dest.socket.readyState !== dest.socket.OPEN) { + // if we're not connected, open a new connection + if (!dest || dest.socket.readyState === dest.socket.CLOSING || dest.socket.readyState === dest.socket.CLOSED) { + dest = SOCKFS.websocket_sock_ops.createPeer(sock, addr, port); + } + dest.dgram_send_queue.push(data); + return length; + } + } + try { + // send the actual data + dest.socket.send(data); + return length; + } catch (e) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + },recvmsg:function (sock, length) { + // http://pubs.opengroup.org/onlinepubs/7908799/xns/recvmsg.html + if (sock.type === 1 && sock.server) { + // tcp servers should not be recv()'ing on the listen socket + throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN); + } + var queued = sock.recv_queue.shift(); + if (!queued) { + if (sock.type === 1) { + var dest = SOCKFS.websocket_sock_ops.getPeer(sock, sock.daddr, sock.dport); + if (!dest) { + // if we have a destination address but are not connected, error out + throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN); + } + else if (dest.socket.readyState === dest.socket.CLOSING || dest.socket.readyState === dest.socket.CLOSED) { + // return null if the socket has closed + return null; + } + else { + // else, our socket is in a valid state but truly has nothing available + throw new FS.ErrnoError(ERRNO_CODES.EAGAIN); + } + } else { + throw new FS.ErrnoError(ERRNO_CODES.EAGAIN); + } + } + // queued.data will be an ArrayBuffer if it's unadulterated, but if it's + // requeued TCP data it'll be an ArrayBufferView + var queuedLength = queued.data.byteLength || queued.data.length; + var queuedOffset = queued.data.byteOffset || 0; + var queuedBuffer = queued.data.buffer || queued.data; + var bytesRead = Math.min(length, queuedLength); + var res = { + buffer: new Uint8Array(queuedBuffer, queuedOffset, bytesRead), + addr: queued.addr, + port: queued.port + }; + // push back any unread data for TCP connections + if (sock.type === 1 && bytesRead < queuedLength) { + var bytesRemaining = queuedLength - bytesRead; + queued.data = new Uint8Array(queuedBuffer, queuedOffset + bytesRead, bytesRemaining); + sock.recv_queue.unshift(queued); + } + return res; + }}};function _send(fd, buf, len, flags) { + var sock = SOCKFS.getSocket(fd); + if (!sock) { + ___setErrNo(ERRNO_CODES.EBADF); + return -1; + } + // TODO honor flags + return _write(fd, buf, len); + } + function _pwrite(fildes, buf, nbyte, offset) { + // ssize_t pwrite(int fildes, const void *buf, size_t nbyte, off_t offset); + // http://pubs.opengroup.org/onlinepubs/000095399/functions/write.html + var stream = FS.getStream(fildes); + if (!stream) { + ___setErrNo(ERRNO_CODES.EBADF); + return -1; + } + try { + var slab = HEAP8; + return FS.write(stream, slab, buf, nbyte, offset); + } catch (e) { + FS.handleFSError(e); + return -1; + } + }function _write(fildes, buf, nbyte) { + // ssize_t write(int fildes, const void *buf, size_t nbyte); + // http://pubs.opengroup.org/onlinepubs/000095399/functions/write.html + var stream = FS.getStream(fildes); + if (!stream) { + ___setErrNo(ERRNO_CODES.EBADF); + return -1; + } + try { + var slab = HEAP8; + return FS.write(stream, slab, buf, nbyte); + } catch (e) { + FS.handleFSError(e); + return -1; + } + }function _fwrite(ptr, size, nitems, stream) { + // size_t fwrite(const void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream); + // http://pubs.opengroup.org/onlinepubs/000095399/functions/fwrite.html + var bytesToWrite = nitems * size; + if (bytesToWrite == 0) return 0; + var bytesWritten = _write(stream, ptr, bytesToWrite); + if (bytesWritten == -1) { + var streamObj = FS.getStream(stream); + if (streamObj) streamObj.error = true; + return 0; + } else { + return Math.floor(bytesWritten / size); + } + } + Module["_strlen"] = _strlen; + function __reallyNegative(x) { + return x < 0 || (x === 0 && (1/x) === -Infinity); + }function __formatString(format, varargs) { + var textIndex = format; + var argIndex = 0; + function getNextArg(type) { + // NOTE: Explicitly ignoring type safety. Otherwise this fails: + // int x = 4; printf("%c\n", (char)x); + var ret; + if (type === 'double') { + ret = HEAPF64[(((varargs)+(argIndex))>>3)]; + } else if (type == 'i64') { + ret = [HEAP32[(((varargs)+(argIndex))>>2)], + HEAP32[(((varargs)+(argIndex+8))>>2)]]; + argIndex += 8; // each 32-bit chunk is in a 64-bit block + } else { + type = 'i32'; // varargs are always i32, i64, or double + ret = HEAP32[(((varargs)+(argIndex))>>2)]; + } + argIndex += Math.max(Runtime.getNativeFieldSize(type), Runtime.getAlignSize(type, null, true)); + return ret; + } + var ret = []; + var curr, next, currArg; + while(1) { + var startTextIndex = textIndex; + curr = HEAP8[(textIndex)]; + if (curr === 0) break; + next = HEAP8[((textIndex+1)|0)]; + if (curr == 37) { + // Handle flags. + var flagAlwaysSigned = false; + var flagLeftAlign = false; + var flagAlternative = false; + var flagZeroPad = false; + flagsLoop: while (1) { + switch (next) { + case 43: + flagAlwaysSigned = true; + break; + case 45: + flagLeftAlign = true; + break; + case 35: + flagAlternative = true; + break; + case 48: + if (flagZeroPad) { + break flagsLoop; + } else { + flagZeroPad = true; + break; + } + default: + break flagsLoop; + } + textIndex++; + next = HEAP8[((textIndex+1)|0)]; + } + // Handle width. + var width = 0; + if (next == 42) { + width = getNextArg('i32'); + textIndex++; + next = HEAP8[((textIndex+1)|0)]; + } else { + while (next >= 48 && next <= 57) { + width = width * 10 + (next - 48); + textIndex++; + next = HEAP8[((textIndex+1)|0)]; + } + } + // Handle precision. + var precisionSet = false; + if (next == 46) { + var precision = 0; + precisionSet = true; + textIndex++; + next = HEAP8[((textIndex+1)|0)]; + if (next == 42) { + precision = getNextArg('i32'); + textIndex++; + } else { + while(1) { + var precisionChr = HEAP8[((textIndex+1)|0)]; + if (precisionChr < 48 || + precisionChr > 57) break; + precision = precision * 10 + (precisionChr - 48); + textIndex++; + } + } + next = HEAP8[((textIndex+1)|0)]; + } else { + var precision = 6; // Standard default. + } + // Handle integer sizes. WARNING: These assume a 32-bit architecture! + var argSize; + switch (String.fromCharCode(next)) { + case 'h': + var nextNext = HEAP8[((textIndex+2)|0)]; + if (nextNext == 104) { + textIndex++; + argSize = 1; // char (actually i32 in varargs) + } else { + argSize = 2; // short (actually i32 in varargs) + } + break; + case 'l': + var nextNext = HEAP8[((textIndex+2)|0)]; + if (nextNext == 108) { + textIndex++; + argSize = 8; // long long + } else { + argSize = 4; // long + } + break; + case 'L': // long long + case 'q': // int64_t + case 'j': // intmax_t + argSize = 8; + break; + case 'z': // size_t + case 't': // ptrdiff_t + case 'I': // signed ptrdiff_t or unsigned size_t + argSize = 4; + break; + default: + argSize = null; + } + if (argSize) textIndex++; + next = HEAP8[((textIndex+1)|0)]; + // Handle type specifier. + switch (String.fromCharCode(next)) { + case 'd': case 'i': case 'u': case 'o': case 'x': case 'X': case 'p': { + // Integer. + var signed = next == 100 || next == 105; + argSize = argSize || 4; + var currArg = getNextArg('i' + (argSize * 8)); + var origArg = currArg; + var argText; + // Flatten i64-1 [low, high] into a (slightly rounded) double + if (argSize == 8) { + currArg = Runtime.makeBigInt(currArg[0], currArg[1], next == 117); + } + // Truncate to requested size. + if (argSize <= 4) { + var limit = Math.pow(256, argSize) - 1; + currArg = (signed ? reSign : unSign)(currArg & limit, argSize * 8); + } + // Format the number. + var currAbsArg = Math.abs(currArg); + var prefix = ''; + if (next == 100 || next == 105) { + if (argSize == 8 && i64Math) argText = i64Math.stringify(origArg[0], origArg[1], null); else + argText = reSign(currArg, 8 * argSize, 1).toString(10); + } else if (next == 117) { + if (argSize == 8 && i64Math) argText = i64Math.stringify(origArg[0], origArg[1], true); else + argText = unSign(currArg, 8 * argSize, 1).toString(10); + currArg = Math.abs(currArg); + } else if (next == 111) { + argText = (flagAlternative ? '0' : '') + currAbsArg.toString(8); + } else if (next == 120 || next == 88) { + prefix = (flagAlternative && currArg != 0) ? '0x' : ''; + if (argSize == 8 && i64Math) { + if (origArg[1]) { + argText = (origArg[1]>>>0).toString(16); + var lower = (origArg[0]>>>0).toString(16); + while (lower.length < 8) lower = '0' + lower; + argText += lower; + } else { + argText = (origArg[0]>>>0).toString(16); + } + } else + if (currArg < 0) { + // Represent negative numbers in hex as 2's complement. + currArg = -currArg; + argText = (currAbsArg - 1).toString(16); + var buffer = []; + for (var i = 0; i < argText.length; i++) { + buffer.push((0xF - parseInt(argText[i], 16)).toString(16)); + } + argText = buffer.join(''); + while (argText.length < argSize * 2) argText = 'f' + argText; + } else { + argText = currAbsArg.toString(16); + } + if (next == 88) { + prefix = prefix.toUpperCase(); + argText = argText.toUpperCase(); + } + } else if (next == 112) { + if (currAbsArg === 0) { + argText = '(nil)'; + } else { + prefix = '0x'; + argText = currAbsArg.toString(16); + } + } + if (precisionSet) { + while (argText.length < precision) { + argText = '0' + argText; + } + } + // Add sign if needed + if (flagAlwaysSigned) { + if (currArg < 0) { + prefix = '-' + prefix; + } else { + prefix = '+' + prefix; + } + } + // Add padding. + while (prefix.length + argText.length < width) { + if (flagLeftAlign) { + argText += ' '; + } else { + if (flagZeroPad) { + argText = '0' + argText; + } else { + prefix = ' ' + prefix; + } + } + } + // Insert the result into the buffer. + argText = prefix + argText; + argText.split('').forEach(function(chr) { + ret.push(chr.charCodeAt(0)); + }); + break; + } + case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': { + // Float. + var currArg = getNextArg('double'); + var argText; + if (isNaN(currArg)) { + argText = 'nan'; + flagZeroPad = false; + } else if (!isFinite(currArg)) { + argText = (currArg < 0 ? '-' : '') + 'inf'; + flagZeroPad = false; + } else { + var isGeneral = false; + var effectivePrecision = Math.min(precision, 20); + // Convert g/G to f/F or e/E, as per: + // http://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html + if (next == 103 || next == 71) { + isGeneral = true; + precision = precision || 1; + var exponent = parseInt(currArg.toExponential(effectivePrecision).split('e')[1], 10); + if (precision > exponent && exponent >= -4) { + next = ((next == 103) ? 'f' : 'F').charCodeAt(0); + precision -= exponent + 1; + } else { + next = ((next == 103) ? 'e' : 'E').charCodeAt(0); + precision--; + } + effectivePrecision = Math.min(precision, 20); + } + if (next == 101 || next == 69) { + argText = currArg.toExponential(effectivePrecision); + // Make sure the exponent has at least 2 digits. + if (/[eE][-+]\d$/.test(argText)) { + argText = argText.slice(0, -1) + '0' + argText.slice(-1); + } + } else if (next == 102 || next == 70) { + argText = currArg.toFixed(effectivePrecision); + if (currArg === 0 && __reallyNegative(currArg)) { + argText = '-' + argText; + } + } + var parts = argText.split('e'); + if (isGeneral && !flagAlternative) { + // Discard trailing zeros and periods. + while (parts[0].length > 1 && parts[0].indexOf('.') != -1 && + (parts[0].slice(-1) == '0' || parts[0].slice(-1) == '.')) { + parts[0] = parts[0].slice(0, -1); + } + } else { + // Make sure we have a period in alternative mode. + if (flagAlternative && argText.indexOf('.') == -1) parts[0] += '.'; + // Zero pad until required precision. + while (precision > effectivePrecision++) parts[0] += '0'; + } + argText = parts[0] + (parts.length > 1 ? 'e' + parts[1] : ''); + // Capitalize 'E' if needed. + if (next == 69) argText = argText.toUpperCase(); + // Add sign. + if (flagAlwaysSigned && currArg >= 0) { + argText = '+' + argText; + } + } + // Add padding. + while (argText.length < width) { + if (flagLeftAlign) { + argText += ' '; + } else { + if (flagZeroPad && (argText[0] == '-' || argText[0] == '+')) { + argText = argText[0] + '0' + argText.slice(1); + } else { + argText = (flagZeroPad ? '0' : ' ') + argText; + } + } + } + // Adjust case. + if (next < 97) argText = argText.toUpperCase(); + // Insert the result into the buffer. + argText.split('').forEach(function(chr) { + ret.push(chr.charCodeAt(0)); + }); + break; + } + case 's': { + // String. + var arg = getNextArg('i8*'); + var argLength = arg ? _strlen(arg) : '(null)'.length; + if (precisionSet) argLength = Math.min(argLength, precision); + if (!flagLeftAlign) { + while (argLength < width--) { + ret.push(32); + } + } + if (arg) { + for (var i = 0; i < argLength; i++) { + ret.push(HEAPU8[((arg++)|0)]); + } + } else { + ret = ret.concat(intArrayFromString('(null)'.substr(0, argLength), true)); + } + if (flagLeftAlign) { + while (argLength < width--) { + ret.push(32); + } + } + break; + } + case 'c': { + // Character. + if (flagLeftAlign) ret.push(getNextArg('i8')); + while (--width > 0) { + ret.push(32); + } + if (!flagLeftAlign) ret.push(getNextArg('i8')); + break; + } + case 'n': { + // Write the length written so far to the next parameter. + var ptr = getNextArg('i32*'); + HEAP32[((ptr)>>2)]=ret.length + break; + } + case '%': { + // Literal percent sign. + ret.push(curr); + break; + } + default: { + // Unknown specifiers remain untouched. + for (var i = startTextIndex; i < textIndex + 2; i++) { + ret.push(HEAP8[(i)]); + } + } + } + textIndex += 2; + // TODO: Support a/A (hex float) and m (last error) specifiers. + // TODO: Support %1${specifier} for arg selection. + } else { + ret.push(curr); + textIndex += 1; + } + } + return ret; + }function _fprintf(stream, format, varargs) { + // int fprintf(FILE *restrict stream, const char *restrict format, ...); + // http://pubs.opengroup.org/onlinepubs/000095399/functions/printf.html + var result = __formatString(format, varargs); + var stack = Runtime.stackSave(); + var ret = _fwrite(allocate(result, 'i8', ALLOC_STACK), 1, result.length, stream); + Runtime.stackRestore(stack); + return ret; + }function _printf(format, varargs) { + // int printf(const char *restrict format, ...); + // http://pubs.opengroup.org/onlinepubs/000095399/functions/printf.html + var stdout = HEAP32[((_stdout)>>2)]; + return _fprintf(stdout, format, varargs); + } + Module["_memcpy"] = _memcpy;var _llvm_memcpy_p0i8_p0i8_i32=_memcpy; + function ___cxa_guard_acquire(variable) { + if (!HEAP8[(variable)]) { // ignore SAFE_HEAP stuff because llvm mixes i64 and i8 here + HEAP8[(variable)]=1; + return 1; + } + return 0; + } + function ___cxa_guard_release() {} + Module["_memset"] = _memset;var _llvm_memset_p0i8_i64=_memset; + var _sinf=Math.sin; + var _cosf=Math.cos; + var _sqrtf=Math.sqrt; + var _fabsf=Math.abs; + function _llvm_lifetime_start() {} + function _llvm_lifetime_end() {} + function _fmod(x, y) { + return x % y; + }var _fmodf=_fmod; + var _atan2f=Math.atan2; + var _llvm_pow_f32=Math.pow; + var _acosf=Math.acos; + var _llvm_memset_p0i8_i32=_memset; + function _atexit(func, arg) { + __ATEXIT__.unshift({ func: func, arg: arg }); + }var ___cxa_atexit=_atexit; + function ___cxa_guard_abort() {} + function ___cxa_pure_virtual() { + ABORT = true; + throw 'Pure virtual function called!'; + } + function ___assert_func(filename, line, func, condition) { + throw 'Assertion failed: ' + (condition ? Pointer_stringify(condition) : 'unknown condition') + ', at: ' + [filename ? Pointer_stringify(filename) : 'unknown filename', line, func ? Pointer_stringify(func) : 'unknown function'] + ' at ' + new Error().stack; + } + Module["_llvm_uadd_with_overflow_i64"] = _llvm_uadd_with_overflow_i64; + function _gettimeofday(ptr) { + // %struct.timeval = type { i32, i32 } + var now = Date.now(); + HEAP32[((ptr)>>2)]=Math.floor(now/1000); // seconds + HEAP32[(((ptr)+(4))>>2)]=Math.floor((now-1000*Math.floor(now/1000))*1000); // microseconds + return 0; + } + function _abort() { + Module['abort'](); + } + function ___errno_location() { + return ___errno_state; + }var ___errno=___errno_location; + function _sbrk(bytes) { + // Implement a Linux-like 'memory area' for our 'process'. + // Changes the size of the memory area by |bytes|; returns the + // address of the previous top ('break') of the memory area + // We control the "dynamic" memory - DYNAMIC_BASE to DYNAMICTOP + var self = _sbrk; + if (!self.called) { + DYNAMICTOP = alignMemoryPage(DYNAMICTOP); // make sure we start out aligned + self.called = true; + assert(Runtime.dynamicAlloc); + self.alloc = Runtime.dynamicAlloc; + Runtime.dynamicAlloc = function() { abort('cannot dynamically allocate, sbrk now has control') }; + } + var ret = DYNAMICTOP; + if (bytes != 0) self.alloc(bytes); + return ret; // Previous break location. + } + function _sysconf(name) { + // long sysconf(int name); + // http://pubs.opengroup.org/onlinepubs/009695399/functions/sysconf.html + switch(name) { + case 8: return PAGE_SIZE; + case 54: + case 56: + case 21: + case 61: + case 63: + case 22: + case 67: + case 23: + case 24: + case 25: + case 26: + case 27: + case 69: + case 28: + case 101: + case 70: + case 71: + case 29: + case 30: + case 199: + case 75: + case 76: + case 32: + case 43: + case 44: + case 80: + case 46: + case 47: + case 45: + case 48: + case 49: + case 42: + case 82: + case 33: + case 7: + case 108: + case 109: + case 107: + case 112: + case 119: + case 121: + return 200809; + case 13: + case 104: + case 94: + case 95: + case 34: + case 35: + case 77: + case 81: + case 83: + case 84: + case 85: + case 86: + case 87: + case 88: + case 89: + case 90: + case 91: + case 94: + case 95: + case 110: + case 111: + case 113: + case 114: + case 115: + case 116: + case 117: + case 118: + case 120: + case 40: + case 16: + case 79: + case 19: + return -1; + case 92: + case 93: + case 5: + case 72: + case 6: + case 74: + case 92: + case 93: + case 96: + case 97: + case 98: + case 99: + case 102: + case 103: + case 105: + return 1; + case 38: + case 66: + case 50: + case 51: + case 4: + return 1024; + case 15: + case 64: + case 41: + return 32; + case 55: + case 37: + case 17: + return 2147483647; + case 18: + case 1: + return 47839; + case 59: + case 57: + return 99; + case 68: + case 58: + return 2048; + case 0: return 2097152; + case 3: return 65536; + case 14: return 32768; + case 73: return 32767; + case 39: return 16384; + case 60: return 1000; + case 106: return 700; + case 52: return 256; + case 62: return 255; + case 2: return 100; + case 65: return 64; + case 36: return 20; + case 100: return 16; + case 20: return 6; + case 53: return 4; + case 10: return 1; + } + ___setErrNo(ERRNO_CODES.EINVAL); + return -1; + } + function _time(ptr) { + var ret = Math.floor(Date.now()/1000); + if (ptr) { + HEAP32[((ptr)>>2)]=ret + } + return ret; + } + function ___cxa_allocate_exception(size) { + return _malloc(size); + } + function _llvm_eh_exception() { + return HEAP32[((_llvm_eh_exception.buf)>>2)]; + } + function __ZSt18uncaught_exceptionv() { // std::uncaught_exception() + return !!__ZSt18uncaught_exceptionv.uncaught_exception; + } + function ___cxa_is_number_type(type) { + var isNumber = false; + try { if (type == __ZTIi) isNumber = true } catch(e){} + try { if (type == __ZTIj) isNumber = true } catch(e){} + try { if (type == __ZTIl) isNumber = true } catch(e){} + try { if (type == __ZTIm) isNumber = true } catch(e){} + try { if (type == __ZTIx) isNumber = true } catch(e){} + try { if (type == __ZTIy) isNumber = true } catch(e){} + try { if (type == __ZTIf) isNumber = true } catch(e){} + try { if (type == __ZTId) isNumber = true } catch(e){} + try { if (type == __ZTIe) isNumber = true } catch(e){} + try { if (type == __ZTIc) isNumber = true } catch(e){} + try { if (type == __ZTIa) isNumber = true } catch(e){} + try { if (type == __ZTIh) isNumber = true } catch(e){} + try { if (type == __ZTIs) isNumber = true } catch(e){} + try { if (type == __ZTIt) isNumber = true } catch(e){} + return isNumber; + }function ___cxa_does_inherit(definiteType, possibilityType, possibility) { + if (possibility == 0) return false; + if (possibilityType == 0 || possibilityType == definiteType) + return true; + var possibility_type_info; + if (___cxa_is_number_type(possibilityType)) { + possibility_type_info = possibilityType; + } else { + var possibility_type_infoAddr = HEAP32[((possibilityType)>>2)] - 8; + possibility_type_info = HEAP32[((possibility_type_infoAddr)>>2)]; + } + switch (possibility_type_info) { + case 0: // possibility is a pointer + // See if definite type is a pointer + var definite_type_infoAddr = HEAP32[((definiteType)>>2)] - 8; + var definite_type_info = HEAP32[((definite_type_infoAddr)>>2)]; + if (definite_type_info == 0) { + // Also a pointer; compare base types of pointers + var defPointerBaseAddr = definiteType+8; + var defPointerBaseType = HEAP32[((defPointerBaseAddr)>>2)]; + var possPointerBaseAddr = possibilityType+8; + var possPointerBaseType = HEAP32[((possPointerBaseAddr)>>2)]; + return ___cxa_does_inherit(defPointerBaseType, possPointerBaseType, possibility); + } else + return false; // one pointer and one non-pointer + case 1: // class with no base class + return false; + case 2: // class with base class + var parentTypeAddr = possibilityType + 8; + var parentType = HEAP32[((parentTypeAddr)>>2)]; + return ___cxa_does_inherit(definiteType, parentType, possibility); + default: + return false; // some unencountered type + } + } + function ___resumeException(ptr) { + if (HEAP32[((_llvm_eh_exception.buf)>>2)] == 0) HEAP32[((_llvm_eh_exception.buf)>>2)]=ptr; + throw ptr + " - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch.";; + }function ___cxa_find_matching_catch(thrown, throwntype) { + if (thrown == -1) thrown = HEAP32[((_llvm_eh_exception.buf)>>2)]; + if (throwntype == -1) throwntype = HEAP32[(((_llvm_eh_exception.buf)+(4))>>2)]; + var typeArray = Array.prototype.slice.call(arguments, 2); + // If throwntype is a pointer, this means a pointer has been + // thrown. When a pointer is thrown, actually what's thrown + // is a pointer to the pointer. We'll dereference it. + if (throwntype != 0 && !___cxa_is_number_type(throwntype)) { + var throwntypeInfoAddr= HEAP32[((throwntype)>>2)] - 8; + var throwntypeInfo= HEAP32[((throwntypeInfoAddr)>>2)]; + if (throwntypeInfo == 0) + thrown = HEAP32[((thrown)>>2)]; + } + // The different catch blocks are denoted by different types. + // Due to inheritance, those types may not precisely match the + // type of the thrown object. Find one which matches, and + // return the type of the catch block which should be called. + for (var i = 0; i < typeArray.length; i++) { + if (___cxa_does_inherit(typeArray[i], throwntype, thrown)) + return ((asm["setTempRet0"](typeArray[i]),thrown)|0); + } + // Shouldn't happen unless we have bogus data in typeArray + // or encounter a type for which emscripten doesn't have suitable + // typeinfo defined. Best-efforts match just in case. + return ((asm["setTempRet0"](throwntype),thrown)|0); + }function ___cxa_throw(ptr, type, destructor) { + if (!___cxa_throw.initialized) { + try { + HEAP32[((__ZTVN10__cxxabiv119__pointer_type_infoE)>>2)]=0; // Workaround for libcxxabi integration bug + } catch(e){} + try { + HEAP32[((__ZTVN10__cxxabiv117__class_type_infoE)>>2)]=1; // Workaround for libcxxabi integration bug + } catch(e){} + try { + HEAP32[((__ZTVN10__cxxabiv120__si_class_type_infoE)>>2)]=2; // Workaround for libcxxabi integration bug + } catch(e){} + ___cxa_throw.initialized = true; + } + HEAP32[((_llvm_eh_exception.buf)>>2)]=ptr + HEAP32[(((_llvm_eh_exception.buf)+(4))>>2)]=type + HEAP32[(((_llvm_eh_exception.buf)+(8))>>2)]=destructor + if (!("uncaught_exception" in __ZSt18uncaught_exceptionv)) { + __ZSt18uncaught_exceptionv.uncaught_exception = 1; + } else { + __ZSt18uncaught_exceptionv.uncaught_exception++; + } + throw ptr + " - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch.";; + } + function ___cxa_call_unexpected(exception) { + Module.printErr('Unexpected exception thrown, this is not properly supported - aborting'); + ABORT = true; + throw exception; + } + var Browser={mainLoop:{scheduler:null,shouldPause:false,paused:false,queue:[],pause:function () { + Browser.mainLoop.shouldPause = true; + },resume:function () { + if (Browser.mainLoop.paused) { + Browser.mainLoop.paused = false; + Browser.mainLoop.scheduler(); + } + Browser.mainLoop.shouldPause = false; + },updateStatus:function () { + if (Module['setStatus']) { + var message = Module['statusMessage'] || 'Please wait...'; + var remaining = Browser.mainLoop.remainingBlockers; + var expected = Browser.mainLoop.expectedBlockers; + if (remaining) { + if (remaining < expected) { + Module['setStatus'](message + ' (' + (expected - remaining) + '/' + expected + ')'); + } else { + Module['setStatus'](message); + } + } else { + Module['setStatus'](''); + } + } + }},isFullScreen:false,pointerLock:false,moduleContextCreatedCallbacks:[],workers:[],init:function () { + if (!Module["preloadPlugins"]) Module["preloadPlugins"] = []; // needs to exist even in workers + if (Browser.initted || ENVIRONMENT_IS_WORKER) return; + Browser.initted = true; + try { + new Blob(); + Browser.hasBlobConstructor = true; + } catch(e) { + Browser.hasBlobConstructor = false; + console.log("warning: no blob constructor, cannot create blobs with mimetypes"); + } + Browser.BlobBuilder = typeof MozBlobBuilder != "undefined" ? MozBlobBuilder : (typeof WebKitBlobBuilder != "undefined" ? WebKitBlobBuilder : (!Browser.hasBlobConstructor ? console.log("warning: no BlobBuilder") : null)); + Browser.URLObject = typeof window != "undefined" ? (window.URL ? window.URL : window.webkitURL) : undefined; + if (!Module.noImageDecoding && typeof Browser.URLObject === 'undefined') { + console.log("warning: Browser does not support creating object URLs. Built-in browser image decoding will not be available."); + Module.noImageDecoding = true; + } + // Support for plugins that can process preloaded files. You can add more of these to + // your app by creating and appending to Module.preloadPlugins. + // + // Each plugin is asked if it can handle a file based on the file's name. If it can, + // it is given the file's raw data. When it is done, it calls a callback with the file's + // (possibly modified) data. For example, a plugin might decompress a file, or it + // might create some side data structure for use later (like an Image element, etc.). + var imagePlugin = {}; + imagePlugin['canHandle'] = function(name) { + return !Module.noImageDecoding && /\.(jpg|jpeg|png|bmp)$/i.test(name); + }; + imagePlugin['handle'] = function(byteArray, name, onload, onerror) { + var b = null; + if (Browser.hasBlobConstructor) { + try { + b = new Blob([byteArray], { type: Browser.getMimetype(name) }); + if (b.size !== byteArray.length) { // Safari bug #118630 + // Safari's Blob can only take an ArrayBuffer + b = new Blob([(new Uint8Array(byteArray)).buffer], { type: Browser.getMimetype(name) }); + } + } catch(e) { + Runtime.warnOnce('Blob constructor present but fails: ' + e + '; falling back to blob builder'); + } + } + if (!b) { + var bb = new Browser.BlobBuilder(); + bb.append((new Uint8Array(byteArray)).buffer); // we need to pass a buffer, and must copy the array to get the right data range + b = bb.getBlob(); + } + var url = Browser.URLObject.createObjectURL(b); + var img = new Image(); + img.onload = function() { + assert(img.complete, 'Image ' + name + ' could not be decoded'); + var canvas = document.createElement('canvas'); + canvas.width = img.width; + canvas.height = img.height; + var ctx = canvas.getContext('2d'); + ctx.drawImage(img, 0, 0); + Module["preloadedImages"][name] = canvas; + Browser.URLObject.revokeObjectURL(url); + if (onload) onload(byteArray); + }; + img.onerror = function(event) { + console.log('Image ' + url + ' could not be decoded'); + if (onerror) onerror(); + }; + img.src = url; + }; + Module['preloadPlugins'].push(imagePlugin); + var audioPlugin = {}; + audioPlugin['canHandle'] = function(name) { + return !Module.noAudioDecoding && name.substr(-4) in { '.ogg': 1, '.wav': 1, '.mp3': 1 }; + }; + audioPlugin['handle'] = function(byteArray, name, onload, onerror) { + var done = false; + function finish(audio) { + if (done) return; + done = true; + Module["preloadedAudios"][name] = audio; + if (onload) onload(byteArray); + } + function fail() { + if (done) return; + done = true; + Module["preloadedAudios"][name] = new Audio(); // empty shim + if (onerror) onerror(); + } + if (Browser.hasBlobConstructor) { + try { + var b = new Blob([byteArray], { type: Browser.getMimetype(name) }); + } catch(e) { + return fail(); + } + var url = Browser.URLObject.createObjectURL(b); // XXX we never revoke this! + var audio = new Audio(); + audio.addEventListener('canplaythrough', function() { finish(audio) }, false); // use addEventListener due to chromium bug 124926 + audio.onerror = function(event) { + if (done) return; + console.log('warning: browser could not fully decode audio ' + name + ', trying slower base64 approach'); + function encode64(data) { + var BASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + var PAD = '='; + var ret = ''; + var leftchar = 0; + var leftbits = 0; + for (var i = 0; i < data.length; i++) { + leftchar = (leftchar << 8) | data[i]; + leftbits += 8; + while (leftbits >= 6) { + var curr = (leftchar >> (leftbits-6)) & 0x3f; + leftbits -= 6; + ret += BASE[curr]; + } + } + if (leftbits == 2) { + ret += BASE[(leftchar&3) << 4]; + ret += PAD + PAD; + } else if (leftbits == 4) { + ret += BASE[(leftchar&0xf) << 2]; + ret += PAD; + } + return ret; + } + audio.src = 'data:audio/x-' + name.substr(-3) + ';base64,' + encode64(byteArray); + finish(audio); // we don't wait for confirmation this worked - but it's worth trying + }; + audio.src = url; + // workaround for chrome bug 124926 - we do not always get oncanplaythrough or onerror + Browser.safeSetTimeout(function() { + finish(audio); // try to use it even though it is not necessarily ready to play + }, 10000); + } else { + return fail(); + } + }; + Module['preloadPlugins'].push(audioPlugin); + // Canvas event setup + var canvas = Module['canvas']; + canvas.requestPointerLock = canvas['requestPointerLock'] || + canvas['mozRequestPointerLock'] || + canvas['webkitRequestPointerLock']; + canvas.exitPointerLock = document['exitPointerLock'] || + document['mozExitPointerLock'] || + document['webkitExitPointerLock'] || + function(){}; // no-op if function does not exist + canvas.exitPointerLock = canvas.exitPointerLock.bind(document); + function pointerLockChange() { + Browser.pointerLock = document['pointerLockElement'] === canvas || + document['mozPointerLockElement'] === canvas || + document['webkitPointerLockElement'] === canvas; + } + document.addEventListener('pointerlockchange', pointerLockChange, false); + document.addEventListener('mozpointerlockchange', pointerLockChange, false); + document.addEventListener('webkitpointerlockchange', pointerLockChange, false); + if (Module['elementPointerLock']) { + canvas.addEventListener("click", function(ev) { + if (!Browser.pointerLock && canvas.requestPointerLock) { + canvas.requestPointerLock(); + ev.preventDefault(); + } + }, false); + } + },createContext:function (canvas, useWebGL, setInModule) { + var ctx; + try { + if (useWebGL) { + ctx = canvas.getContext('experimental-webgl', { + alpha: false + }); + } else { + ctx = canvas.getContext('2d'); + } + if (!ctx) throw ':('; + } catch (e) { + Module.print('Could not create canvas - ' + e); + return null; + } + if (useWebGL) { + // Set the background of the WebGL canvas to black + canvas.style.backgroundColor = "black"; + // Warn on context loss + canvas.addEventListener('webglcontextlost', function(event) { + alert('WebGL context lost. You will need to reload the page.'); + }, false); + } + if (setInModule) { + Module.ctx = ctx; + Module.useWebGL = useWebGL; + Browser.moduleContextCreatedCallbacks.forEach(function(callback) { callback() }); + Browser.init(); + } + return ctx; + },destroyContext:function (canvas, useWebGL, setInModule) {},fullScreenHandlersInstalled:false,lockPointer:undefined,resizeCanvas:undefined,requestFullScreen:function (lockPointer, resizeCanvas) { + Browser.lockPointer = lockPointer; + Browser.resizeCanvas = resizeCanvas; + if (typeof Browser.lockPointer === 'undefined') Browser.lockPointer = true; + if (typeof Browser.resizeCanvas === 'undefined') Browser.resizeCanvas = false; + var canvas = Module['canvas']; + function fullScreenChange() { + Browser.isFullScreen = false; + if ((document['webkitFullScreenElement'] || document['webkitFullscreenElement'] || + document['mozFullScreenElement'] || document['mozFullscreenElement'] || + document['fullScreenElement'] || document['fullscreenElement']) === canvas) { + canvas.cancelFullScreen = document['cancelFullScreen'] || + document['mozCancelFullScreen'] || + document['webkitCancelFullScreen']; + canvas.cancelFullScreen = canvas.cancelFullScreen.bind(document); + if (Browser.lockPointer) canvas.requestPointerLock(); + Browser.isFullScreen = true; + if (Browser.resizeCanvas) Browser.setFullScreenCanvasSize(); + } else if (Browser.resizeCanvas){ + Browser.setWindowedCanvasSize(); + } + if (Module['onFullScreen']) Module['onFullScreen'](Browser.isFullScreen); + } + if (!Browser.fullScreenHandlersInstalled) { + Browser.fullScreenHandlersInstalled = true; + document.addEventListener('fullscreenchange', fullScreenChange, false); + document.addEventListener('mozfullscreenchange', fullScreenChange, false); + document.addEventListener('webkitfullscreenchange', fullScreenChange, false); + } + canvas.requestFullScreen = canvas['requestFullScreen'] || + canvas['mozRequestFullScreen'] || + (canvas['webkitRequestFullScreen'] ? function() { canvas['webkitRequestFullScreen'](Element['ALLOW_KEYBOARD_INPUT']) } : null); + canvas.requestFullScreen(); + },requestAnimationFrame:function (func) { + if (!window.requestAnimationFrame) { + window.requestAnimationFrame = window['requestAnimationFrame'] || + window['mozRequestAnimationFrame'] || + window['webkitRequestAnimationFrame'] || + window['msRequestAnimationFrame'] || + window['oRequestAnimationFrame'] || + window['setTimeout']; + } + window.requestAnimationFrame(func); + },safeCallback:function (func) { + return function() { + if (!ABORT) return func.apply(null, arguments); + }; + },safeRequestAnimationFrame:function (func) { + return Browser.requestAnimationFrame(function() { + if (!ABORT) func(); + }); + },safeSetTimeout:function (func, timeout) { + return setTimeout(function() { + if (!ABORT) func(); + }, timeout); + },safeSetInterval:function (func, timeout) { + return setInterval(function() { + if (!ABORT) func(); + }, timeout); + },getMimetype:function (name) { + return { + 'jpg': 'image/jpeg', + 'jpeg': 'image/jpeg', + 'png': 'image/png', + 'bmp': 'image/bmp', + 'ogg': 'audio/ogg', + 'wav': 'audio/wav', + 'mp3': 'audio/mpeg' + }[name.substr(name.lastIndexOf('.')+1)]; + },getUserMedia:function (func) { + if(!window.getUserMedia) { + window.getUserMedia = navigator['getUserMedia'] || + navigator['mozGetUserMedia']; + } + window.getUserMedia(func); + },getMovementX:function (event) { + return event['movementX'] || + event['mozMovementX'] || + event['webkitMovementX'] || + 0; + },getMovementY:function (event) { + return event['movementY'] || + event['mozMovementY'] || + event['webkitMovementY'] || + 0; + },mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,calculateMouseEvent:function (event) { // event should be mousemove, mousedown or mouseup + if (Browser.pointerLock) { + // When the pointer is locked, calculate the coordinates + // based on the movement of the mouse. + // Workaround for Firefox bug 764498 + if (event.type != 'mousemove' && + ('mozMovementX' in event)) { + Browser.mouseMovementX = Browser.mouseMovementY = 0; + } else { + Browser.mouseMovementX = Browser.getMovementX(event); + Browser.mouseMovementY = Browser.getMovementY(event); + } + // check if SDL is available + if (typeof SDL != "undefined") { + Browser.mouseX = SDL.mouseX + Browser.mouseMovementX; + Browser.mouseY = SDL.mouseY + Browser.mouseMovementY; + } else { + // just add the mouse delta to the current absolut mouse position + // FIXME: ideally this should be clamped against the canvas size and zero + Browser.mouseX += Browser.mouseMovementX; + Browser.mouseY += Browser.mouseMovementY; + } + } else { + // Otherwise, calculate the movement based on the changes + // in the coordinates. + var rect = Module["canvas"].getBoundingClientRect(); + var x, y; + if (event.type == 'touchstart' || + event.type == 'touchend' || + event.type == 'touchmove') { + var t = event.touches.item(0); + if (t) { + x = t.pageX - (window.scrollX + rect.left); + y = t.pageY - (window.scrollY + rect.top); + } else { + return; + } + } else { + x = event.pageX - (window.scrollX + rect.left); + y = event.pageY - (window.scrollY + rect.top); + } + // the canvas might be CSS-scaled compared to its backbuffer; + // SDL-using content will want mouse coordinates in terms + // of backbuffer units. + var cw = Module["canvas"].width; + var ch = Module["canvas"].height; + x = x * (cw / rect.width); + y = y * (ch / rect.height); + Browser.mouseMovementX = x - Browser.mouseX; + Browser.mouseMovementY = y - Browser.mouseY; + Browser.mouseX = x; + Browser.mouseY = y; + } + },xhrLoad:function (url, onload, onerror) { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.responseType = 'arraybuffer'; + xhr.onload = function() { + if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0 + onload(xhr.response); + } else { + onerror(); + } + }; + xhr.onerror = onerror; + xhr.send(null); + },asyncLoad:function (url, onload, onerror, noRunDep) { + Browser.xhrLoad(url, function(arrayBuffer) { + assert(arrayBuffer, 'Loading data file "' + url + '" failed (no arrayBuffer).'); + onload(new Uint8Array(arrayBuffer)); + if (!noRunDep) removeRunDependency('al ' + url); + }, function(event) { + if (onerror) { + onerror(); + } else { + throw 'Loading data file "' + url + '" failed.'; + } + }); + if (!noRunDep) addRunDependency('al ' + url); + },resizeListeners:[],updateResizeListeners:function () { + var canvas = Module['canvas']; + Browser.resizeListeners.forEach(function(listener) { + listener(canvas.width, canvas.height); + }); + },setCanvasSize:function (width, height, noUpdates) { + var canvas = Module['canvas']; + canvas.width = width; + canvas.height = height; + if (!noUpdates) Browser.updateResizeListeners(); + },windowedWidth:0,windowedHeight:0,setFullScreenCanvasSize:function () { + var canvas = Module['canvas']; + this.windowedWidth = canvas.width; + this.windowedHeight = canvas.height; + canvas.width = screen.width; + canvas.height = screen.height; + // check if SDL is available + if (typeof SDL != "undefined") { + var flags = HEAPU32[((SDL.screen+Runtime.QUANTUM_SIZE*0)>>2)]; + flags = flags | 0x00800000; // set SDL_FULLSCREEN flag + HEAP32[((SDL.screen+Runtime.QUANTUM_SIZE*0)>>2)]=flags + } + Browser.updateResizeListeners(); + },setWindowedCanvasSize:function () { + var canvas = Module['canvas']; + canvas.width = this.windowedWidth; + canvas.height = this.windowedHeight; + // check if SDL is available + if (typeof SDL != "undefined") { + var flags = HEAPU32[((SDL.screen+Runtime.QUANTUM_SIZE*0)>>2)]; + flags = flags & ~0x00800000; // clear SDL_FULLSCREEN flag + HEAP32[((SDL.screen+Runtime.QUANTUM_SIZE*0)>>2)]=flags + } + Browser.updateResizeListeners(); + }}; +FS.staticInit();__ATINIT__.unshift({ func: function() { if (!Module["noFSInit"] && !FS.init.initialized) FS.init() } });__ATMAIN__.push({ func: function() { FS.ignorePermissions = false } });__ATEXIT__.push({ func: function() { FS.quit() } });Module["FS_createFolder"] = FS.createFolder;Module["FS_createPath"] = FS.createPath;Module["FS_createDataFile"] = FS.createDataFile;Module["FS_createPreloadedFile"] = FS.createPreloadedFile;Module["FS_createLazyFile"] = FS.createLazyFile;Module["FS_createLink"] = FS.createLink;Module["FS_createDevice"] = FS.createDevice; +___errno_state = Runtime.staticAlloc(4); HEAP32[((___errno_state)>>2)]=0; +__ATINIT__.unshift({ func: function() { TTY.init() } });__ATEXIT__.push({ func: function() { TTY.shutdown() } });TTY.utf8 = new Runtime.UTF8Processor(); +__ATINIT__.push({ func: function() { SOCKFS.root = FS.mount(SOCKFS, {}, null); } }); +_llvm_eh_exception.buf = allocate(12, "void*", ALLOC_STATIC); +Module["requestFullScreen"] = function(lockPointer, resizeCanvas) { Browser.requestFullScreen(lockPointer, resizeCanvas) }; + Module["requestAnimationFrame"] = function(func) { Browser.requestAnimationFrame(func) }; + Module["setCanvasSize"] = function(width, height, noUpdates) { Browser.setCanvasSize(width, height, noUpdates) }; + Module["pauseMainLoop"] = function() { Browser.mainLoop.pause() }; + Module["resumeMainLoop"] = function() { Browser.mainLoop.resume() }; + Module["getUserMedia"] = function() { Browser.getUserMedia() } +STACK_BASE = STACKTOP = Runtime.alignMemory(STATICTOP); +staticSealed = true; // seal the static portion of memory +STACK_MAX = STACK_BASE + 5242880; +DYNAMIC_BASE = DYNAMICTOP = Runtime.alignMemory(STACK_MAX); +assert(DYNAMIC_BASE < TOTAL_MEMORY); // Stack must fit in TOTAL_MEMORY; allocations from here on may enlarge TOTAL_MEMORY + var ctlz_i8 = allocate([8,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], "i8", ALLOC_DYNAMIC); + var cttz_i8 = allocate([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0], "i8", ALLOC_DYNAMIC); +var Math_min = Math.min; +function invoke_iiiiiiii(index,a1,a2,a3,a4,a5,a6,a7) { + try { + return Module["dynCall_iiiiiiii"](index,a1,a2,a3,a4,a5,a6,a7); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_vif(index,a1,a2) { + try { + Module["dynCall_vif"](index,a1,a2); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_viifii(index,a1,a2,a3,a4,a5) { + try { + Module["dynCall_viifii"](index,a1,a2,a3,a4,a5); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_viiiii(index,a1,a2,a3,a4,a5) { + try { + Module["dynCall_viiiii"](index,a1,a2,a3,a4,a5); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_vi(index,a1) { + try { + Module["dynCall_vi"](index,a1); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_vii(index,a1,a2) { + try { + Module["dynCall_vii"](index,a1,a2); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_viiifii(index,a1,a2,a3,a4,a5,a6) { + try { + Module["dynCall_viiifii"](index,a1,a2,a3,a4,a5,a6); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_vifiii(index,a1,a2,a3,a4,a5) { + try { + Module["dynCall_vifiii"](index,a1,a2,a3,a4,a5); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_ii(index,a1) { + try { + return Module["dynCall_ii"](index,a1); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_viiiiffffiif(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) { + try { + Module["dynCall_viiiiffffiif"](index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_fiii(index,a1,a2,a3) { + try { + return Module["dynCall_fiii"](index,a1,a2,a3); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_viiif(index,a1,a2,a3,a4) { + try { + Module["dynCall_viiif"](index,a1,a2,a3,a4); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_fiiiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) { + try { + return Module["dynCall_fiiiiiiiiiii"](index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_fiifii(index,a1,a2,a3,a4,a5) { + try { + return Module["dynCall_fiifii"](index,a1,a2,a3,a4,a5); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_iii(index,a1,a2) { + try { + return Module["dynCall_iii"](index,a1,a2); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_iiii(index,a1,a2,a3) { + try { + return Module["dynCall_iiii"](index,a1,a2,a3); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_fif(index,a1,a2) { + try { + return Module["dynCall_fif"](index,a1,a2); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_viiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8) { + try { + Module["dynCall_viiiiiiii"](index,a1,a2,a3,a4,a5,a6,a7,a8); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_vifi(index,a1,a2,a3) { + try { + Module["dynCall_vifi"](index,a1,a2,a3); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_viiiiii(index,a1,a2,a3,a4,a5,a6) { + try { + Module["dynCall_viiiiii"](index,a1,a2,a3,a4,a5,a6); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_iiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9) { + try { + return Module["dynCall_iiiiiiiiii"](index,a1,a2,a3,a4,a5,a6,a7,a8,a9); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_viffiii(index,a1,a2,a3,a4,a5,a6) { + try { + Module["dynCall_viffiii"](index,a1,a2,a3,a4,a5,a6); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_iiiiiii(index,a1,a2,a3,a4,a5,a6) { + try { + return Module["dynCall_iiiiiii"](index,a1,a2,a3,a4,a5,a6); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_fiiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) { + try { + return Module["dynCall_fiiiiiiiiii"](index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_fiiiii(index,a1,a2,a3,a4,a5) { + try { + return Module["dynCall_fiiiii"](index,a1,a2,a3,a4,a5); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_iiiiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) { + try { + return Module["dynCall_iiiiiiiiiiii"](index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_vifii(index,a1,a2,a3,a4) { + try { + Module["dynCall_vifii"](index,a1,a2,a3,a4); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_fi(index,a1) { + try { + return Module["dynCall_fi"](index,a1); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_viiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) { + try { + Module["dynCall_viiiiiiiiii"](index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_viiiifffffif(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) { + try { + Module["dynCall_viiiifffffif"](index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_viiiiiffii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9) { + try { + Module["dynCall_viiiiiffii"](index,a1,a2,a3,a4,a5,a6,a7,a8,a9); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_iifif(index,a1,a2,a3,a4) { + try { + return Module["dynCall_iifif"](index,a1,a2,a3,a4); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_iiiii(index,a1,a2,a3,a4) { + try { + return Module["dynCall_iiiii"](index,a1,a2,a3,a4); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_viii(index,a1,a2,a3) { + try { + Module["dynCall_viii"](index,a1,a2,a3); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_viifi(index,a1,a2,a3,a4) { + try { + Module["dynCall_viifi"](index,a1,a2,a3,a4); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_v(index) { + try { + Module["dynCall_v"](index); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_viif(index,a1,a2,a3) { + try { + Module["dynCall_viif"](index,a1,a2,a3); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_iiif(index,a1,a2,a3) { + try { + return Module["dynCall_iiif"](index,a1,a2,a3); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_fiiifii(index,a1,a2,a3,a4,a5,a6) { + try { + return Module["dynCall_fiiifii"](index,a1,a2,a3,a4,a5,a6); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function invoke_viiii(index,a1,a2,a3,a4) { + try { + Module["dynCall_viiii"](index,a1,a2,a3,a4); + } catch(e) { + if (typeof e !== 'number' && e !== 'longjmp') throw e; + asm["setThrew"](1, 0); + } +} +function asmPrintInt(x, y) { + Module.print('int ' + x + ',' + y);// + ' ' + new Error().stack); +} +function asmPrintFloat(x, y) { + Module.print('float ' + x + ',' + y);// + ' ' + new Error().stack); +} +// EMSCRIPTEN_START_ASM +var asmModule = function(global, env, buffer) { + 'use asm'; + var HEAP8 = new global.Int8Array(buffer); + var HEAP16 = new global.Int16Array(buffer); + var HEAP32 = new global.Int32Array(buffer); + var HEAPU8 = new global.Uint8Array(buffer); + var HEAPU16 = new global.Uint16Array(buffer); + var HEAPU32 = new global.Uint32Array(buffer); + var HEAPF32 = new global.Float32Array(buffer); + var HEAPF64 = new global.Float64Array(buffer); + var STACKTOP=env.STACKTOP|0; + var STACK_MAX=env.STACK_MAX|0; + var tempDoublePtr=env.tempDoublePtr|0; + var ABORT=env.ABORT|0; + var cttz_i8=env.cttz_i8|0; + var ctlz_i8=env.ctlz_i8|0; + var __ZTVN10__cxxabiv117__class_type_infoE=env.__ZTVN10__cxxabiv117__class_type_infoE|0; + var __ZTVN10__cxxabiv120__si_class_type_infoE=env.__ZTVN10__cxxabiv120__si_class_type_infoE|0; + var ___dso_handle=env.___dso_handle|0; + var NaN=+env.NaN; + var Infinity=+env.Infinity; + var __THREW__ = 0; + var threwValue = 0; + var setjmpId = 0; + var undef = 0; + var tempInt = 0, tempBigInt = 0, tempBigIntP = 0, tempBigIntS = 0, tempBigIntR = 0.0, tempBigIntI = 0, tempBigIntD = 0, tempValue = 0, tempDouble = 0.0; + var tempRet0 = 0; + var tempRet1 = 0; + var tempRet2 = 0; + var tempRet3 = 0; + var tempRet4 = 0; + var tempRet5 = 0; + var tempRet6 = 0; + var tempRet7 = 0; + var tempRet8 = 0; + var tempRet9 = 0; + var Math_floor=global.Math.floor; + var Math_abs=global.Math.abs; + var Math_sqrt=global.Math.sqrt; + var Math_pow=global.Math.pow; + var Math_cos=global.Math.cos; + var Math_sin=global.Math.sin; + var Math_tan=global.Math.tan; + var Math_acos=global.Math.acos; + var Math_asin=global.Math.asin; + var Math_atan=global.Math.atan; + var Math_atan2=global.Math.atan2; + var Math_exp=global.Math.exp; + var Math_log=global.Math.log; + var Math_ceil=global.Math.ceil; + var Math_imul=global.Math.imul; + var abort=env.abort; + var assert=env.assert; + var asmPrintInt=env.asmPrintInt; + var asmPrintFloat=env.asmPrintFloat; + var Math_min=env.min; + var invoke_iiiiiiii=env.invoke_iiiiiiii; + var invoke_vif=env.invoke_vif; + var invoke_viifii=env.invoke_viifii; + var invoke_viiiii=env.invoke_viiiii; + var invoke_vi=env.invoke_vi; + var invoke_vii=env.invoke_vii; + var invoke_viiifii=env.invoke_viiifii; + var invoke_vifiii=env.invoke_vifiii; + var invoke_ii=env.invoke_ii; + var invoke_viiiiffffiif=env.invoke_viiiiffffiif; + var invoke_fiii=env.invoke_fiii; + var invoke_viiif=env.invoke_viiif; + var invoke_fiiiiiiiiiii=env.invoke_fiiiiiiiiiii; + var invoke_fiifii=env.invoke_fiifii; + var invoke_iii=env.invoke_iii; + var invoke_iiii=env.invoke_iiii; + var invoke_fif=env.invoke_fif; + var invoke_viiiiiiii=env.invoke_viiiiiiii; + var invoke_vifi=env.invoke_vifi; + var invoke_viiiiii=env.invoke_viiiiii; + var invoke_iiiiiiiiii=env.invoke_iiiiiiiiii; + var invoke_viffiii=env.invoke_viffiii; + var invoke_iiiiiii=env.invoke_iiiiiii; + var invoke_fiiiiiiiiii=env.invoke_fiiiiiiiiii; + var invoke_fiiiii=env.invoke_fiiiii; + var invoke_iiiiiiiiiiii=env.invoke_iiiiiiiiiiii; + var invoke_vifii=env.invoke_vifii; + var invoke_fi=env.invoke_fi; + var invoke_viiiiiiiiii=env.invoke_viiiiiiiiii; + var invoke_viiiifffffif=env.invoke_viiiifffffif; + var invoke_viiiiiffii=env.invoke_viiiiiffii; + var invoke_iifif=env.invoke_iifif; + var invoke_iiiii=env.invoke_iiiii; + var invoke_viii=env.invoke_viii; + var invoke_viifi=env.invoke_viifi; + var invoke_v=env.invoke_v; + var invoke_viif=env.invoke_viif; + var invoke_iiif=env.invoke_iiif; + var invoke_fiiifii=env.invoke_fiiifii; + var invoke_viiii=env.invoke_viiii; + var _llvm_lifetime_end=env._llvm_lifetime_end; + var _cosf=env._cosf; + var _fabsf=env._fabsf; + var _sysconf=env._sysconf; + var ___cxa_throw=env.___cxa_throw; + var _atexit=env._atexit; + var _abort=env._abort; + var _fprintf=env._fprintf; + var _llvm_eh_exception=env._llvm_eh_exception; + var _printf=env._printf; + var _acosf=env._acosf; + var _fflush=env._fflush; + var __reallyNegative=env.__reallyNegative; + var _sqrtf=env._sqrtf; + var _llvm_pow_f32=env._llvm_pow_f32; + var ___setErrNo=env.___setErrNo; + var _fwrite=env._fwrite; + var _send=env._send; + var _write=env._write; + var _exit=env._exit; + var _atan2f=env._atan2f; + var ___cxa_pure_virtual=env.___cxa_pure_virtual; + var ___cxa_is_number_type=env.___cxa_is_number_type; + var _time=env._time; + var __formatString=env.__formatString; + var ___cxa_does_inherit=env.___cxa_does_inherit; + var ___cxa_guard_acquire=env.___cxa_guard_acquire; + var __ZSt9terminatev=env.__ZSt9terminatev; + var _gettimeofday=env._gettimeofday; + var ___cxa_find_matching_catch=env.___cxa_find_matching_catch; + var _sinf=env._sinf; + var ___assert_func=env.___assert_func; + var __ZSt18uncaught_exceptionv=env.__ZSt18uncaught_exceptionv; + var _pwrite=env._pwrite; + var ___cxa_call_unexpected=env.___cxa_call_unexpected; + var _sbrk=env._sbrk; + var ___cxa_guard_abort=env.___cxa_guard_abort; + var ___cxa_allocate_exception=env.___cxa_allocate_exception; + var ___errno_location=env.___errno_location; + var ___gxx_personality_v0=env.___gxx_personality_v0; + var _llvm_lifetime_start=env._llvm_lifetime_start; + var _fmod=env._fmod; + var ___cxa_guard_release=env.___cxa_guard_release; + var __exit=env.__exit; + var ___resumeException=env.___resumeException; +// EMSCRIPTEN_START_FUNCS +function __ZN20btConvexHullInternal9shiftFaceEPNS_4FaceEf20btAlignedObjectArrayIPNS_6VertexEE(i1, i2, d3, i4) { + i1 = i1 | 0; + i2 = i2 | 0; + d3 = +d3; + i4 = i4 | 0; + var i5 = 0, i6 = 0, i7 = 0, i8 = 0, i9 = 0, i10 = 0, i11 = 0, i12 = 0, i13 = 0, i14 = 0, d15 = 0.0, d16 = 0.0, d17 = 0.0, i18 = 0, i19 = 0, i20 = 0, i21 = 0, i22 = 0, i23 = 0, i24 = 0, i25 = 0, i26 = 0, i27 = 0, i28 = 0, i29 = 0, i30 = 0, i31 = 0, i32 = 0, i33 = 0, i34 = 0, i35 = 0, i36 = 0, i37 = 0, i38 = 0, i39 = 0, i40 = 0, i41 = 0, i42 = 0, i43 = 0, i44 = 0, i45 = 0, i46 = 0, i47 = 0, i48 = 0, i49 = 0, i50 = 0, i51 = 0, i52 = 0, i53 = 0, i54 = 0, i55 = 0, i56 = 0, i57 = 0, i58 = 0, i59 = 0, i60 = 0, i61 = 0, i62 = 0, i63 = 0, i64 = 0, i65 = 0, i66 = 0, i67 = 0, i68 = 0, i69 = 0, i70 = 0, i71 = 0, i72 = 0, i73 = 0, i74 = 0, i75 = 0, i76 = 0, i77 = 0, i78 = 0, i79 = 0, i80 = 0, i81 = 0, i82 = 0, i83 = 0, i84 = 0, i85 = 0, i86 = 0, i87 = 0, i88 = 0, i89 = 0, i90 = 0, i91 = 0, i92 = 0, i93 = 0, i94 = 0, i95 = 0, i96 = 0, i97 = 0, i98 = 0, i99 = 0, i100 = 0, i101 = 0, i102 = 0, i103 = 0, i104 = 0, i105 = 0, i106 = 0, i107 = 0, i108 = 0, i109 = 0, i110 = 0, i111 = 0, i112 = 0, i113 = 0, i114 = 0, i115 = 0, i116 = 0, i117 = 0, i118 = 0, i119 = 0, i120 = 0, i121 = 0, i122 = 0, i123 = 0, i124 = 0, i125 = 0, i126 = 0, i127 = 0, i128 = 0, i129 = 0, i130 = 0, i131 = 0, i132 = 0, i133 = 0, i134 = 0, i135 = 0, i136 = 0, i137 = 0, i138 = 0, i139 = 0, i140 = 0, i141 = 0, i142 = 0, i143 = 0, i144 = 0, i145 = 0, i146 = 0, i147 = 0, i148 = 0, i149 = 0, i150 = 0, i151 = 0, i152 = 0, i153 = 0, i154 = 0, i155 = 0, i156 = 0, i157 = 0, i158 = 0, i159 = 0, i160 = 0, i161 = 0, i162 = 0, i163 = 0, i164 = 0, i165 = 0, i166 = 0, i167 = 0, i168 = 0, i169 = 0, i170 = 0, i171 = 0, i172 = 0, i173 = 0, i174 = 0, i175 = 0, i176 = 0, i177 = 0, i178 = 0, i179 = 0, i180 = 0, i181 = 0, i182 = 0, i183 = 0, i184 = 0, i185 = 0, i186 = 0, i187 = 0, i188 = 0, i189 = 0, i190 = 0, i191 = 0, i192 = 0, i193 = 0, i194 = 0, i195 = 0, i196 = 0, i197 = 0, i198 = 0, i199 = 0, i200 = 0, i201 = 0, i202 = 0, i203 = 0, i204 = 0, i205 = 0, i206 = 0, i207 = 0, i208 = 0, i209 = 0, i210 = 0, i211 = 0, i212 = 0, i213 = 0, i214 = 0, i215 = 0, i216 = 0, i217 = 0, i218 = 0, i219 = 0, i220 = 0, i221 = 0, i222 = 0, i223 = 0, i224 = 0, i225 = 0, i226 = 0, i227 = 0, i228 = 0, i229 = 0, i230 = 0, i231 = 0, i232 = 0, i233 = 0, i234 = 0, i235 = 0, i236 = 0, i237 = 0, i238 = 0, i239 = 0, i240 = 0, i241 = 0, i242 = 0, i243 = 0, i244 = 0, i245 = 0, i246 = 0, i247 = 0, i248 = 0, i249 = 0, i250 = 0, i251 = 0, i252 = 0, i253 = 0, i254 = 0, i255 = 0, i256 = 0, i257 = 0, i258 = 0, i259 = 0, i260 = 0, i261 = 0, i262 = 0, i263 = 0, i264 = 0, i265 = 0, i266 = 0, i267 = 0, i268 = 0, i269 = 0, i270 = 0, i271 = 0, i272 = 0, i273 = 0, i274 = 0, i275 = 0, i276 = 0, i277 = 0, i278 = 0, i279 = 0, i280 = 0, i281 = 0, i282 = 0, i283 = 0, i284 = 0, i285 = 0, i286 = 0, i287 = 0, i288 = 0, i289 = 0, i290 = 0, i291 = 0, i292 = 0, i293 = 0, i294 = 0, i295 = 0, i296 = 0, i297 = 0, i298 = 0, i299 = 0, i300 = 0, i301 = 0, i302 = 0; + i5 = STACKTOP; + STACKTOP = STACKTOP + 296 | 0; + i6 = i5 | 0; + i7 = i5 + 16 | 0; + i8 = i5 + 32 | 0; + i9 = i5 + 56 | 0; + i10 = i5 + 96 | 0; + i11 = i5 + 136 | 0; + i12 = i5 + 176 | 0; + i13 = i5 + 216 | 0; + i14 = i5 + 256 | 0; + __ZN20btConvexHullInternal11getBtNormalEPNS_4FaceE(i7, i1, i2); + d15 = -0.0 - d3; + d3 = +HEAPF32[i7 >> 2] * d15; + d16 = +HEAPF32[i7 + 4 >> 2] * d15; + d17 = +HEAPF32[i7 + 8 >> 2] * d15; + i7 = i6 | 0; + HEAPF32[i7 >> 2] = d3; + i18 = i6 + 4 | 0; + HEAPF32[i18 >> 2] = d16; + i19 = i6 + 8 | 0; + HEAPF32[i19 >> 2] = d17; + HEAPF32[i6 + 12 >> 2] = 0.0; + d15 = +HEAPF32[i1 >> 2]; + if (d15 > 0.0) { + HEAPF32[i7 >> 2] = d3 / d15; + } + d15 = +HEAPF32[i1 + 4 >> 2]; + if (d15 > 0.0) { + HEAPF32[i18 >> 2] = d16 / d15; + } + d15 = +HEAPF32[i1 + 8 >> 2]; + if (d15 > 0.0) { + HEAPF32[i19 >> 2] = d17 / d15; + } + i19 = ~~+HEAPF32[i6 + (HEAP32[i1 + 108 >> 2] << 2) >> 2]; + i18 = ~~+HEAPF32[i6 + (HEAP32[i1 + 112 >> 2] << 2) >> 2]; + i7 = ~~+HEAPF32[i6 + (HEAP32[i1 + 104 >> 2] << 2) >> 2]; + if ((i18 | i19 | i7 | 0) == 0) { + i20 = 1; + STACKTOP = i5; + return i20 | 0; + } + i6 = i2 + 32 | 0; + i21 = HEAP32[i6 >> 2] | 0; + i22 = i2 + 52 | 0; + i23 = HEAP32[i22 >> 2] | 0; + i24 = Math_imul(i23, i21) | 0; + i25 = i2 + 36 | 0; + i26 = HEAP32[i25 >> 2] | 0; + i27 = i2 + 48 | 0; + i28 = HEAP32[i27 >> 2] | 0; + i29 = i24 - (Math_imul(i28, i26) | 0) | 0; + i24 = i29; + i30 = (i29 | 0) < 0 ? -1 : 0; + i29 = i2 + 44 | 0; + i31 = HEAP32[i29 >> 2] | 0; + i32 = Math_imul(i31, i26) | 0; + i26 = i2 + 28 | 0; + i33 = HEAP32[i26 >> 2] | 0; + i34 = i32 - (Math_imul(i33, i23) | 0) | 0; + i23 = i34; + i32 = (i34 | 0) < 0 ? -1 : 0; + i34 = Math_imul(i33, i28) | 0; + i28 = i34 - (Math_imul(i31, i21) | 0) | 0; + i21 = i28; + i31 = (i28 | 0) < 0 ? -1 : 0; + i28 = i8 | 0; + HEAP32[i28 >> 2] = i24; + HEAP32[i28 + 4 >> 2] = i30; + i28 = i8 + 8 | 0; + HEAP32[i28 >> 2] = i23; + HEAP32[i28 + 4 >> 2] = i32; + i28 = i8 + 16 | 0; + HEAP32[i28 >> 2] = i21; + HEAP32[i28 + 4 >> 2] = i31; + i28 = i2 + 12 | 0; + i34 = HEAP32[i28 >> 2] | 0; + i33 = ___muldi3(i34, (i34 | 0) < 0 ? -1 : 0, i24, i30) | 0; + i35 = tempRet0; + i36 = i2 + 16 | 0; + i37 = HEAP32[i36 >> 2] | 0; + i38 = ___muldi3(i37, (i37 | 0) < 0 ? -1 : 0, i23, i32) | 0; + i39 = _i64Add(i38, tempRet0, i33, i35) | 0; + i35 = tempRet0; + i33 = i2 + 20 | 0; + i38 = HEAP32[i33 >> 2] | 0; + i40 = ___muldi3(i38, (i38 | 0) < 0 ? -1 : 0, i21, i31) | 0; + i41 = _i64Add(i39, i35, i40, tempRet0) | 0; + i40 = tempRet0; + i35 = i34 + i19 | 0; + i19 = i37 + i18 | 0; + i18 = i38 + i7 | 0; + i7 = i35; + i38 = (i35 | 0) < 0 ? -1 : 0; + i37 = ___muldi3(i7, i38, i24, i30) | 0; + i30 = tempRet0; + i24 = i19; + i34 = (i19 | 0) < 0 ? -1 : 0; + i39 = ___muldi3(i24, i34, i23, i32) | 0; + i32 = _i64Add(i39, tempRet0, i37, i30) | 0; + i30 = tempRet0; + i37 = i18; + i39 = (i18 | 0) < 0 ? -1 : 0; + i23 = ___muldi3(i37, i39, i21, i31) | 0; + i31 = _i64Add(i32, i30, i23, tempRet0) | 0; + i23 = tempRet0; + if (!((i23 | 0) < (i40 | 0) | (i23 | 0) == (i40 | 0) & i31 >>> 0 < i41 >>> 0)) { + i20 = 0; + STACKTOP = i5; + return i20 | 0; + } + i41 = HEAP32[i2 + 4 >> 2] | 0; + i40 = HEAP32[i41 + 8 >> 2] | 0; + __ZNK20btConvexHullInternal6Vertex3dotERKNS_7Point64E(i9, i41, i8); + i41 = __ZNK20btConvexHullInternal11Rational1287compareEx(i9, i31, i23) | 0; + i30 = i9; + do { + if ((i41 | 0) > -1) { + i32 = i10; + i21 = i40; + i42 = i41; + i43 = i40; + while (1) { + __ZNK20btConvexHullInternal6Vertex3dotERKNS_7Point64E(i10, HEAP32[i43 + 12 >> 2] | 0, i8); + if ((__ZNK20btConvexHullInternal11Rational1287compareERKS0_(i10, i9) | 0) < 0) { + i44 = __ZNK20btConvexHullInternal11Rational1287compareEx(i10, i31, i23) | 0; + HEAP32[i30 >> 2] = HEAP32[i32 >> 2]; + HEAP32[i30 + 4 >> 2] = HEAP32[i32 + 4 >> 2]; + HEAP32[i30 + 8 >> 2] = HEAP32[i32 + 8 >> 2]; + HEAP32[i30 + 12 >> 2] = HEAP32[i32 + 12 >> 2]; + HEAP32[i30 + 16 >> 2] = HEAP32[i32 + 16 >> 2]; + HEAP32[i30 + 20 >> 2] = HEAP32[i32 + 20 >> 2]; + HEAP32[i30 + 24 >> 2] = HEAP32[i32 + 24 >> 2]; + HEAP32[i30 + 28 >> 2] = HEAP32[i32 + 28 >> 2]; + HEAP32[i30 + 32 >> 2] = HEAP32[i32 + 32 >> 2]; + HEAP8[i30 + 36 | 0] = HEAP8[i32 + 36 | 0] | 0; + i45 = HEAP32[i43 + 8 >> 2] | 0; + if ((i44 | 0) < 0) { + break; + } else { + i46 = i45; + i47 = i44; + i48 = i45; + } + } else { + i46 = i21; + i47 = i42; + i48 = i43; + } + i44 = HEAP32[i48 + 4 >> 2] | 0; + if ((i44 | 0) == (i46 | 0)) { + i20 = 0; + i49 = 1612; + break; + } else { + i21 = i46; + i42 = i47; + i43 = i44; + } + } + if ((i49 | 0) == 1612) { + STACKTOP = i5; + return i20 | 0; + } + if ((i45 | 0) == 0) { + i20 = 0; + } else { + i50 = i45; + i51 = i42; + break; + } + STACKTOP = i5; + return i20 | 0; + } else { + i43 = i11; + i21 = i40; + i32 = i40; + while (1) { + __ZNK20btConvexHullInternal6Vertex3dotERKNS_7Point64E(i11, HEAP32[i32 + 12 >> 2] | 0, i8); + if ((__ZNK20btConvexHullInternal11Rational1287compareERKS0_(i11, i9) | 0) > 0) { + i52 = __ZNK20btConvexHullInternal11Rational1287compareEx(i11, i31, i23) | 0; + if ((i52 | 0) > -1) { + break; + } + HEAP32[i30 >> 2] = HEAP32[i43 >> 2]; + HEAP32[i30 + 4 >> 2] = HEAP32[i43 + 4 >> 2]; + HEAP32[i30 + 8 >> 2] = HEAP32[i43 + 8 >> 2]; + HEAP32[i30 + 12 >> 2] = HEAP32[i43 + 12 >> 2]; + HEAP32[i30 + 16 >> 2] = HEAP32[i43 + 16 >> 2]; + HEAP32[i30 + 20 >> 2] = HEAP32[i43 + 20 >> 2]; + HEAP32[i30 + 24 >> 2] = HEAP32[i43 + 24 >> 2]; + HEAP32[i30 + 28 >> 2] = HEAP32[i43 + 28 >> 2]; + HEAP32[i30 + 32 >> 2] = HEAP32[i43 + 32 >> 2]; + HEAP8[i30 + 36 | 0] = HEAP8[i43 + 36 | 0] | 0; + i44 = HEAP32[i32 + 8 >> 2] | 0; + i53 = i44; + i54 = i44; + } else { + i53 = i21; + i54 = i32; + } + i44 = HEAP32[i54 + 4 >> 2] | 0; + if ((i44 | 0) == (i53 | 0)) { + i20 = 1; + i49 = 1615; + break; + } else { + i21 = i53; + i32 = i44; + } + } + if ((i49 | 0) == 1615) { + STACKTOP = i5; + return i20 | 0; + } + if ((i32 | 0) == 0) { + i20 = 1; + } else { + i50 = i32; + i51 = i52; + break; + } + STACKTOP = i5; + return i20 | 0; + } + } while (0); + L1672 : do { + if ((i51 | 0) == 0) { + i52 = i50 + 8 | 0; + i53 = HEAP32[HEAP32[i52 >> 2] >> 2] | 0; + while (1) { + __ZNK20btConvexHullInternal6Vertex3dotERKNS_7Point64E(i12, HEAP32[i53 + 12 >> 2] | 0, i8); + if ((__ZNK20btConvexHullInternal11Rational1287compareEx(i12, i31, i23) | 0) >= 1) { + break L1672; + } + i54 = HEAP32[i53 >> 2] | 0; + if ((i54 | 0) == (HEAP32[i52 >> 2] | 0)) { + i20 = 1; + break; + } else { + i53 = i54; + } + } + STACKTOP = i5; + return i20 | 0; + } + } while (0); + i12 = i1 + 32 | 0; + i53 = i4 + 4 | 0; + i52 = i4 + 8 | 0; + i32 = i4 + 12 | 0; + i54 = i4 + 16 | 0; + i4 = i1 + 56 | 0; + i30 = i1 + 116 | 0; + i11 = i1 + 48 | 0; + i9 = i1 + 100 | 0; + i40 = i1 + 120 | 0; + i45 = (i35 | 0) < 0; + i47 = _i64Subtract(0, 0, i7, i38) | 0; + i46 = tempRet0; + i48 = (i19 | 0) < 0; + i10 = _i64Subtract(0, 0, i24, i34) | 0; + i41 = tempRet0; + i21 = (i18 | 0) < 0; + i43 = _i64Subtract(0, 0, i37, i39) | 0; + i42 = tempRet0; + i44 = i50; + i50 = i51; + i51 = 0; + i55 = 0; + i56 = 0; + L1679 : while (1) { + i57 = (i50 | 0) == 0; + L1681 : do { + if (i57) { + i58 = HEAP32[HEAP32[i44 + 8 >> 2] >> 2] | 0; + i59 = i44; + i60 = i58; + while (1) { + __ZNK20btConvexHullInternal6Vertex3dotERKNS_7Point64E(i13, HEAP32[i60 + 12 >> 2] | 0, i8); + if ((__ZNK20btConvexHullInternal11Rational1287compareEx(i13, i31, i23) | 0) > -1) { + i61 = i59; + break L1681; + } + i62 = HEAP32[i60 >> 2] | 0; + if ((i62 | 0) == (i58 | 0)) { + i20 = 1; + i49 = 1618; + break L1679; + } else { + i59 = HEAP32[i60 + 8 >> 2] | 0; + i60 = i62; + } + } + } else { + i61 = i44; + } + } while (0); + if ((i51 | 0) == 0) { + i63 = i61; + } else { + if ((i61 | 0) == (i51 | 0)) { + break; + } else { + i63 = i51; + } + } + i60 = i61 + 8 | 0; + i59 = HEAP32[i60 >> 2] | 0; + do { + i59 = HEAP32[(HEAP32[i59 + 8 >> 2] | 0) + 4 >> 2] | 0; + i64 = i59 + 12 | 0; + __ZNK20btConvexHullInternal6Vertex3dotERKNS_7Point64E(i14, HEAP32[i64 >> 2] | 0, i8); + i65 = __ZNK20btConvexHullInternal11Rational1287compareEx(i14, i31, i23) | 0; + } while ((i65 | 0) <= -1); + if ((i65 | 0) > 0) { + i58 = HEAP32[i64 >> 2] | 0; + i62 = i59 + 8 | 0; + i66 = HEAP32[i62 >> 2] | 0; + i67 = i66 + 4 | 0; + i68 = HEAP32[i67 >> 2] | 0; + i69 = i58 + 8 | 0; + if ((i68 | 0) == (i66 | 0)) { + HEAP32[i69 >> 2] = 0; + } else { + HEAP32[i69 >> 2] = i68; + i68 = HEAP32[i67 >> 2] | 0; + i69 = i66 | 0; + i70 = HEAP32[i69 >> 2] | 0; + HEAP32[i68 >> 2] = i70; + HEAP32[i70 + 4 >> 2] = i68; + HEAP32[i69 >> 2] = i66; + HEAP32[i67 >> 2] = i66; + } + i67 = HEAP32[i59 + 16 >> 2] | 0; + i69 = HEAP32[i67 + 32 >> 2] | 0; + i68 = HEAP32[i67 + 52 >> 2] | 0; + i70 = Math_imul(i68, i69) | 0; + i71 = HEAP32[i67 + 36 >> 2] | 0; + i72 = HEAP32[i67 + 48 >> 2] | 0; + i73 = i70 - (Math_imul(i72, i71) | 0) | 0; + i70 = i73; + i74 = (i73 | 0) < 0 ? -1 : 0; + i73 = HEAP32[i67 + 44 >> 2] | 0; + i75 = Math_imul(i73, i71) | 0; + i71 = HEAP32[i67 + 28 >> 2] | 0; + i76 = i75 - (Math_imul(i71, i68) | 0) | 0; + i68 = i76; + i75 = (i76 | 0) < 0 ? -1 : 0; + i76 = Math_imul(i71, i72) | 0; + i72 = i76 - (Math_imul(i73, i69) | 0) | 0; + i69 = i72; + i73 = (i72 | 0) < 0 ? -1 : 0; + i72 = HEAP32[(HEAP32[i62 >> 2] | 0) + 16 >> 2] | 0; + i62 = HEAP32[i72 + 32 >> 2] | 0; + i76 = HEAP32[i72 + 52 >> 2] | 0; + i71 = Math_imul(i76, i62) | 0; + i77 = HEAP32[i72 + 36 >> 2] | 0; + i78 = HEAP32[i72 + 48 >> 2] | 0; + i79 = i71 - (Math_imul(i78, i77) | 0) | 0; + i71 = i79; + i80 = (i79 | 0) < 0 ? -1 : 0; + i79 = HEAP32[i72 + 44 >> 2] | 0; + i81 = Math_imul(i79, i77) | 0; + i77 = HEAP32[i72 + 28 >> 2] | 0; + i82 = i81 - (Math_imul(i77, i76) | 0) | 0; + i76 = i82; + i81 = (i82 | 0) < 0 ? -1 : 0; + i82 = Math_imul(i77, i78) | 0; + i78 = i82 - (Math_imul(i79, i62) | 0) | 0; + i62 = i78; + i79 = (i78 | 0) < 0 ? -1 : 0; + i78 = HEAP32[i26 >> 2] | 0; + i82 = i78; + i77 = (i78 | 0) < 0 ? -1 : 0; + i78 = ___muldi3(i82, i77, i70, i74) | 0; + i83 = tempRet0; + i84 = HEAP32[i6 >> 2] | 0; + i85 = i84; + i86 = (i84 | 0) < 0 ? -1 : 0; + i84 = ___muldi3(i85, i86, i68, i75) | 0; + i87 = _i64Add(i84, tempRet0, i78, i83) | 0; + i83 = tempRet0; + i78 = HEAP32[i25 >> 2] | 0; + i84 = i78; + i88 = (i78 | 0) < 0 ? -1 : 0; + i78 = ___muldi3(i84, i88, i69, i73) | 0; + i89 = _i64Add(i87, i83, i78, tempRet0) | 0; + i78 = tempRet0; + i83 = HEAP32[i29 >> 2] | 0; + i87 = i83; + i90 = (i83 | 0) < 0 ? -1 : 0; + i83 = ___muldi3(i87, i90, i70, i74) | 0; + i91 = tempRet0; + i92 = HEAP32[i27 >> 2] | 0; + i93 = i92; + i94 = (i92 | 0) < 0 ? -1 : 0; + i92 = ___muldi3(i93, i94, i68, i75) | 0; + i95 = _i64Add(i92, tempRet0, i83, i91) | 0; + i91 = tempRet0; + i83 = HEAP32[i22 >> 2] | 0; + i92 = i83; + i96 = (i83 | 0) < 0 ? -1 : 0; + i83 = ___muldi3(i92, i96, i69, i73) | 0; + i97 = _i64Add(i95, i91, i83, tempRet0) | 0; + i83 = tempRet0; + i91 = ___muldi3(i82, i77, i71, i80) | 0; + i77 = tempRet0; + i82 = ___muldi3(i85, i86, i76, i81) | 0; + i86 = _i64Add(i82, tempRet0, i91, i77) | 0; + i77 = tempRet0; + i91 = ___muldi3(i84, i88, i62, i79) | 0; + i88 = _i64Add(i86, i77, i91, tempRet0) | 0; + i91 = tempRet0; + i77 = ___muldi3(i87, i90, i71, i80) | 0; + i90 = tempRet0; + i87 = ___muldi3(i93, i94, i76, i81) | 0; + i94 = _i64Add(i87, tempRet0, i77, i90) | 0; + i90 = tempRet0; + i77 = ___muldi3(i92, i96, i62, i79) | 0; + i96 = _i64Add(i94, i90, i77, tempRet0) | 0; + i77 = tempRet0; + i90 = (HEAP32[i67 + 12 >> 2] | 0) - i35 | 0; + i94 = (HEAP32[i67 + 16 >> 2] | 0) - i19 | 0; + i92 = (HEAP32[i67 + 20 >> 2] | 0) - i18 | 0; + i67 = ___muldi3(i90, (i90 | 0) < 0 ? -1 : 0, i70, i74) | 0; + i74 = tempRet0; + i70 = ___muldi3(i94, (i94 | 0) < 0 ? -1 : 0, i68, i75) | 0; + i75 = _i64Add(i70, tempRet0, i67, i74) | 0; + i74 = tempRet0; + i67 = ___muldi3(i92, (i92 | 0) < 0 ? -1 : 0, i69, i73) | 0; + i73 = _i64Add(i75, i74, i67, tempRet0) | 0; + i67 = tempRet0; + i74 = (HEAP32[i72 + 12 >> 2] | 0) - i35 | 0; + i75 = (HEAP32[i72 + 16 >> 2] | 0) - i19 | 0; + i69 = (HEAP32[i72 + 20 >> 2] | 0) - i18 | 0; + i72 = ___muldi3(i74, (i74 | 0) < 0 ? -1 : 0, i71, i80) | 0; + i80 = tempRet0; + i71 = ___muldi3(i75, (i75 | 0) < 0 ? -1 : 0, i76, i81) | 0; + i81 = _i64Add(i71, tempRet0, i72, i80) | 0; + i80 = tempRet0; + i72 = ___muldi3(i69, (i69 | 0) < 0 ? -1 : 0, i62, i79) | 0; + i79 = _i64Add(i81, i80, i72, tempRet0) | 0; + i72 = tempRet0; + i80 = 0; + i81 = (i78 | 0) < (i80 | 0) | (i78 | 0) == (i80 | 0) & i89 >>> 0 < 0 >>> 0; + i80 = _i64Subtract(0, 0, i89, i78) | 0; + i62 = i81 ? tempRet0 : i78; + i78 = 0; + i69 = (i77 | 0) < (i78 | 0) | (i77 | 0) == (i78 | 0) & i96 >>> 0 < 0 >>> 0; + if (i69) { + i78 = _i64Subtract(0, 0, i96, i77) | 0; + i98 = i81 ^ 1; + i99 = tempRet0; + i100 = i78; + } else { + i98 = i81; + i99 = i77; + i100 = i96; + } + i78 = (i81 ? i80 : i89) | 0; + i89 = i62 & 0; + i80 = i100 | 0; + i71 = i99 & 0; + i76 = ___muldi3(i80, i71, i78, i89) | 0; + i75 = tempRet0; + i74 = i99; + i92 = 0; + i70 = ___muldi3(i74, i92, i78, i89) | 0; + i68 = tempRet0; + i94 = i62; + i62 = 0; + i90 = ___muldi3(i80, i71, i94, i62) | 0; + i71 = tempRet0; + i80 = ___muldi3(i74, i92, i94, i62) | 0; + i92 = tempRet0; + i74 = _i64Add(i70 | 0, i68 & 0, i90 | 0, i71 & 0) | 0; + i90 = tempRet0; + i70 = _i64Add(i68, 0, i80, i92) | 0; + i92 = _i64Add(i70, tempRet0, i71, 0) | 0; + i71 = tempRet0; + i70 = _llvm_uadd_with_overflow_i64(i76 | 0, i75 | 0, 0, i74 | 0) | 0; + i74 = i70; + i70 = tempRet0; + i75 = _i64Add(i92, i71, tempRet1 & 1, 0) | 0; + i71 = _i64Add(i75, tempRet0, i90, 0) | 0; + i90 = tempRet0; + if (i98) { + i75 = _i64Subtract(0, 0, i74, i70) | 0; + i92 = tempRet0; + i76 = _i64Add((i74 | 0) == 0 & (i70 | 0) == 0 & 1, 0, ~i71, ~i90) | 0; + i101 = i92; + i102 = i75; + i103 = tempRet0; + i104 = i76; + } else { + i101 = i70; + i102 = i74; + i103 = i90; + i104 = i71; + } + i71 = 0; + i90 = (i83 | 0) < (i71 | 0) | (i83 | 0) == (i71 | 0) & i97 >>> 0 < 0 >>> 0; + i71 = _i64Subtract(0, 0, i97, i83) | 0; + i74 = i90 ? tempRet0 : i83; + i83 = 0; + i70 = (i91 | 0) < (i83 | 0) | (i91 | 0) == (i83 | 0) & i88 >>> 0 < 0 >>> 0; + if (i70) { + i83 = _i64Subtract(0, 0, i88, i91) | 0; + i105 = i90 ^ 1; + i106 = tempRet0; + i107 = i83; + } else { + i105 = i90; + i106 = i91; + i107 = i88; + } + i83 = (i90 ? i71 : i97) | 0; + i97 = i74 & 0; + i71 = i107 | 0; + i76 = i106 & 0; + i75 = ___muldi3(i71, i76, i83, i97) | 0; + i92 = tempRet0; + i80 = i106; + i68 = 0; + i87 = ___muldi3(i80, i68, i83, i97) | 0; + i93 = tempRet0; + i86 = i74; + i74 = 0; + i84 = ___muldi3(i71, i76, i86, i74) | 0; + i76 = tempRet0; + i71 = ___muldi3(i80, i68, i86, i74) | 0; + i68 = tempRet0; + i80 = _i64Add(i87 | 0, i93 & 0, i84 | 0, i76 & 0) | 0; + i84 = tempRet0; + i87 = _i64Add(i93, 0, i71, i68) | 0; + i68 = _i64Add(i87, tempRet0, i76, 0) | 0; + i76 = tempRet0; + i87 = _llvm_uadd_with_overflow_i64(i75 | 0, i92 | 0, 0, i80 | 0) | 0; + i80 = i87; + i87 = tempRet0; + i92 = _i64Add(i68, i76, tempRet1 & 1, 0) | 0; + i76 = _i64Add(i92, tempRet0, i84, 0) | 0; + i84 = tempRet0; + if (i105) { + i92 = _i64Subtract(0, 0, i80, i87) | 0; + i68 = tempRet0; + i75 = _i64Add((i80 | 0) == 0 & (i87 | 0) == 0 & 1, 0, ~i76, ~i84) | 0; + i108 = i68; + i109 = i92; + i110 = tempRet0; + i111 = i75; + } else { + i108 = i87; + i109 = i80; + i110 = i84; + i111 = i76; + } + i76 = _i64Subtract(0, 0, i109, i108) | 0; + i84 = _llvm_uadd_with_overflow_i64(i102 | 0, i101 | 0, i76 | 0, tempRet0 | 0) | 0; + i76 = i84; + i84 = tempRet0; + i80 = tempRet1 & 1; + i87 = _i64Add(i104, i103, ~i111, ~i110) | 0; + i75 = _i64Add(i87, tempRet0, (i109 | 0) == 0 & (i108 | 0) == 0 & 1, 0) | 0; + i87 = _i64Add(i75, tempRet0, i80, 0) | 0; + i80 = tempRet0; + i75 = __ZN20btConvexHullInternal4PoolINS_6VertexEE9newObjectEv(i12) | 0; + HEAP32[i75 + 100 >> 2] = -1; + HEAP32[i75 + 104 >> 2] = -1; + i92 = HEAP32[i26 >> 2] | 0; + i68 = i92; + i71 = (i92 | 0) < 0 ? -1 : 0; + i92 = ___muldi3(i68, i71, i73, i67) | 0; + i93 = tempRet0; + i82 = 0; + i85 = (i93 | 0) < (i82 | 0) | (i93 | 0) == (i82 | 0) & i92 >>> 0 < 0 >>> 0; + i82 = _i64Subtract(0, 0, i92, i93) | 0; + i95 = i85 ? tempRet0 : i93; + if (i69) { + i93 = _i64Subtract(0, 0, i96, i77) | 0; + i112 = i85 ^ 1; + i113 = tempRet0; + i114 = i93; + } else { + i112 = i85; + i113 = i77; + i114 = i96; + } + i93 = (i85 ? i82 : i92) | 0; + i92 = i95 & 0; + i82 = i114 | 0; + i85 = i113 & 0; + i115 = ___muldi3(i82, i85, i93, i92) | 0; + i116 = tempRet0; + i117 = i113; + i118 = 0; + i119 = ___muldi3(i117, i118, i93, i92) | 0; + i92 = tempRet0; + i93 = i95; + i95 = 0; + i120 = ___muldi3(i82, i85, i93, i95) | 0; + i85 = tempRet0; + i82 = ___muldi3(i117, i118, i93, i95) | 0; + i95 = tempRet0; + i93 = _i64Add(i119 | 0, i92 & 0, i120 | 0, i85 & 0) | 0; + i120 = tempRet0; + i119 = _i64Add(i92, 0, i82, i95) | 0; + i95 = _i64Add(i119, tempRet0, i85, 0) | 0; + i85 = tempRet0; + i119 = _llvm_uadd_with_overflow_i64(i115 | 0, i116 | 0, 0, i93 | 0) | 0; + i93 = i119; + i119 = tempRet0; + i116 = _i64Add(i95, i85, tempRet1 & 1, 0) | 0; + i85 = _i64Add(i116, tempRet0, i120, 0) | 0; + i120 = tempRet0; + if (i112) { + i116 = _i64Subtract(0, 0, i93, i119) | 0; + i95 = tempRet0; + i115 = _i64Add((i93 | 0) == 0 & (i119 | 0) == 0 & 1, 0, ~i85, ~i120) | 0; + i121 = i95; + i122 = i116; + i123 = tempRet0; + i124 = i115; + } else { + i121 = i119; + i122 = i93; + i123 = i120; + i124 = i85; + } + i85 = ___muldi3(i68, i71, i79, i72) | 0; + i71 = tempRet0; + i68 = 0; + i120 = (i71 | 0) < (i68 | 0) | (i71 | 0) == (i68 | 0) & i85 >>> 0 < 0 >>> 0; + i68 = _i64Subtract(0, 0, i85, i71) | 0; + i93 = i120 ? tempRet0 : i71; + i71 = (i120 ? i68 : i85) | 0; + i85 = i93 & 0; + i68 = ___muldi3(i71, i85, i83, i97) | 0; + i119 = tempRet0; + i115 = ___muldi3(i71, i85, i86, i74) | 0; + i85 = tempRet0; + i71 = i93; + i93 = 0; + i116 = ___muldi3(i71, i93, i83, i97) | 0; + i95 = tempRet0; + i82 = ___muldi3(i71, i93, i86, i74) | 0; + i93 = tempRet0; + i71 = _i64Add(i115 | 0, i85 & 0, i116 | 0, i95 & 0) | 0; + i116 = tempRet0; + i115 = _llvm_uadd_with_overflow_i64(i68 | 0, i119 | 0, 0, i71 | 0) | 0; + i71 = i115; + i115 = tempRet0; + i119 = tempRet1 & 1; + i68 = _i64Add(i85, 0, i82, i93) | 0; + i93 = _i64Add(i68, tempRet0, i95, 0) | 0; + i95 = _i64Add(i93, tempRet0, i116, 0) | 0; + i116 = _i64Add(i95, tempRet0, i119, 0) | 0; + i119 = tempRet0; + if (i120 ^ i90) { + i120 = _i64Subtract(0, 0, i71, i115) | 0; + i95 = tempRet0; + i93 = _i64Add((i71 | 0) == 0 & (i115 | 0) == 0 & 1, 0, ~i116, ~i119) | 0; + i125 = i95; + i126 = i120; + i127 = tempRet0; + i128 = i93; + } else { + i125 = i115; + i126 = i71; + i127 = i119; + i128 = i116; + } + i116 = _i64Subtract(0, 0, i126, i125) | 0; + i119 = _llvm_uadd_with_overflow_i64(i122 | 0, i121 | 0, i116 | 0, tempRet0 | 0) | 0; + i116 = tempRet0; + i71 = tempRet1 & 1; + i115 = HEAP32[i29 >> 2] | 0; + i93 = i115; + i120 = (i115 | 0) < 0 ? -1 : 0; + i115 = ___muldi3(i93, i120, i79, i72) | 0; + i95 = tempRet0; + i68 = 0; + i82 = (i95 | 0) < (i68 | 0) | (i95 | 0) == (i68 | 0) & i115 >>> 0 < 0 >>> 0; + i68 = _i64Subtract(0, 0, i115, i95) | 0; + i85 = i82 ? tempRet0 : i95; + i95 = (i82 ? i68 : i115) | 0; + i115 = i85 & 0; + i68 = ___muldi3(i95, i115, i78, i89) | 0; + i92 = tempRet0; + i118 = ___muldi3(i95, i115, i94, i62) | 0; + i115 = tempRet0; + i95 = i85; + i85 = 0; + i117 = ___muldi3(i95, i85, i78, i89) | 0; + i129 = tempRet0; + i130 = ___muldi3(i95, i85, i94, i62) | 0; + i85 = tempRet0; + i95 = _i64Add(i118 | 0, i115 & 0, i117 | 0, i129 & 0) | 0; + i117 = tempRet0; + i118 = _llvm_uadd_with_overflow_i64(i68 | 0, i92 | 0, 0, i95 | 0) | 0; + i95 = i118; + i118 = tempRet0; + i92 = _i64Add(i130, i85, tempRet1 & 1, 0) | 0; + i85 = _i64Add(i92, tempRet0, i115, 0) | 0; + i115 = _i64Add(i85, tempRet0, i129, 0) | 0; + i129 = _i64Add(i115, tempRet0, i117, 0) | 0; + i117 = tempRet0; + if (i82 ^ i81) { + i82 = _i64Subtract(0, 0, i95, i118) | 0; + i115 = tempRet0; + i85 = _i64Add((i95 | 0) == 0 & (i118 | 0) == 0 & 1, 0, ~i129, ~i117) | 0; + i131 = i115; + i132 = i82; + i133 = tempRet0; + i134 = i85; + } else { + i131 = i118; + i132 = i95; + i133 = i117; + i134 = i129; + } + i129 = _llvm_uadd_with_overflow_i64(i119 | 0, i116 | 0, i132 | 0, i131 | 0) | 0; + i116 = tempRet0; + i119 = tempRet1 & 1; + i117 = ___muldi3(i93, i120, i73, i67) | 0; + i120 = tempRet0; + i93 = 0; + i95 = (i120 | 0) < (i93 | 0) | (i120 | 0) == (i93 | 0) & i117 >>> 0 < 0 >>> 0; + i93 = _i64Subtract(0, 0, i117, i120) | 0; + i118 = i95 ? tempRet0 : i120; + if (i70) { + i120 = _i64Subtract(0, 0, i88, i91) | 0; + i135 = i95 ^ 1; + i136 = tempRet0; + i137 = i120; + } else { + i135 = i95; + i136 = i91; + i137 = i88; + } + i120 = (i95 ? i93 : i117) | 0; + i117 = i118 & 0; + i93 = i137 | 0; + i95 = i136 & 0; + i85 = ___muldi3(i93, i95, i120, i117) | 0; + i82 = tempRet0; + i115 = i136; + i92 = 0; + i130 = ___muldi3(i115, i92, i120, i117) | 0; + i117 = tempRet0; + i120 = i118; + i118 = 0; + i68 = ___muldi3(i93, i95, i120, i118) | 0; + i95 = tempRet0; + i93 = ___muldi3(i115, i92, i120, i118) | 0; + i118 = tempRet0; + i120 = _i64Add(i130 | 0, i117 & 0, i68 | 0, i95 & 0) | 0; + i68 = tempRet0; + i130 = _i64Add(i117, 0, i93, i118) | 0; + i118 = _i64Add(i130, tempRet0, i95, 0) | 0; + i95 = tempRet0; + i130 = _llvm_uadd_with_overflow_i64(i85 | 0, i82 | 0, 0, i120 | 0) | 0; + i120 = i130; + i130 = tempRet0; + i82 = _i64Add(i118, i95, tempRet1 & 1, 0) | 0; + i95 = _i64Add(i82, tempRet0, i68, 0) | 0; + i68 = tempRet0; + if (i135) { + i82 = _i64Subtract(0, 0, i120, i130) | 0; + i118 = tempRet0; + i85 = _i64Add((i120 | 0) == 0 & (i130 | 0) == 0 & 1, 0, ~i95, ~i68) | 0; + i138 = i118; + i139 = i82; + i140 = tempRet0; + i141 = i85; + } else { + i138 = i130; + i139 = i120; + i140 = i68; + i141 = i95; + } + i95 = _i64Subtract(0, 0, i139, i138) | 0; + i68 = _llvm_uadd_with_overflow_i64(i129 | 0, i116 | 0, i95 | 0, tempRet0 | 0) | 0; + i95 = tempRet0; + i116 = tempRet1 & 1; + i129 = 0; + i120 = (i80 | 0) < (i129 | 0) | (i80 | 0) == (i129 | 0) & i87 >>> 0 < 0 >>> 0; + if (i120) { + i129 = _i64Subtract(0, 0, i76, i84) | 0; + i130 = tempRet0; + i85 = _i64Add((i76 | 0) == 0 & (i84 | 0) == 0 & 1, 0, ~i87, ~i80) | 0; + i142 = i130; + i143 = i129; + i144 = tempRet0; + i145 = i85; + } else { + i142 = i84; + i143 = i76; + i144 = i80; + i145 = i87; + } + i85 = i45 ? i47 : i7; + i129 = i45 ? i46 : i38; + i130 = i143 | 0; + i82 = i142 & 0; + i118 = i85 | 0; + i93 = i129 & 0; + i117 = ___muldi3(i118, i93, i130, i82) | 0; + i92 = tempRet0; + i115 = i129; + i146 = 0; + i147 = ___muldi3(i115, i146, i130, i82) | 0; + i82 = tempRet0; + i130 = i142; + i148 = 0; + i149 = ___muldi3(i118, i93, i130, i148) | 0; + i93 = tempRet0; + i118 = ___muldi3(i115, i146, i130, i148) | 0; + i148 = tempRet0; + i130 = _i64Add(i147 | 0, i82 & 0, i149 | 0, i93 & 0) | 0; + i149 = tempRet0; + i147 = _llvm_uadd_with_overflow_i64(i117 | 0, i92 | 0, 0, i130 | 0) | 0; + i130 = i147; + i147 = tempRet0; + i92 = tempRet1 & 1; + i117 = ___muldi3(i85, i129, i145, i144) | 0; + i129 = _i64Add(i118, i148, i117, tempRet0) | 0; + i117 = _i64Add(i129, tempRet0, i82, 0) | 0; + i82 = _i64Add(i117, tempRet0, i93, 0) | 0; + i93 = _i64Add(i82, tempRet0, i92, 0) | 0; + i92 = _i64Add(i93, tempRet0, i149, 0) | 0; + i149 = tempRet0; + if (i120 ^ i45) { + i93 = _i64Subtract(0, 0, i130, i147) | 0; + i82 = tempRet0; + i117 = _i64Add((i130 | 0) == 0 & (i147 | 0) == 0 & 1, 0, ~i92, ~i149) | 0; + i150 = i82; + i151 = i93; + i152 = tempRet0; + i153 = i117; + } else { + i150 = i147; + i151 = i130; + i152 = i149; + i153 = i92; + } + i92 = _llvm_uadd_with_overflow_i64(i68 | 0, i95 | 0, i151 | 0, i150 | 0) | 0; + i95 = tempRet0; + i68 = tempRet1 & 1; + i149 = _i64Add(i124, i123, ~i128, ~i127) | 0; + i130 = _i64Add(i149, tempRet0, (i126 | 0) == 0 & (i125 | 0) == 0 & 1, 0) | 0; + i149 = _i64Add(i130, tempRet0, i71, 0) | 0; + i71 = _i64Add(i149, tempRet0, i134, i133) | 0; + i149 = _i64Add(i71, tempRet0, i119, 0) | 0; + i119 = _i64Add(i149, tempRet0, ~i141, ~i140) | 0; + i149 = _i64Add(i119, tempRet0, (i139 | 0) == 0 & (i138 | 0) == 0 & 1, 0) | 0; + i119 = _i64Add(i149, tempRet0, i116, 0) | 0; + i116 = _i64Add(i119, tempRet0, i153, i152) | 0; + i119 = _i64Add(i116, tempRet0, i68, 0) | 0; + i68 = tempRet0; + i116 = HEAP32[i6 >> 2] | 0; + i149 = i116; + i71 = (i116 | 0) < 0 ? -1 : 0; + i116 = ___muldi3(i149, i71, i73, i67) | 0; + i130 = tempRet0; + i147 = 0; + i117 = (i130 | 0) < (i147 | 0) | (i130 | 0) == (i147 | 0) & i116 >>> 0 < 0 >>> 0; + i147 = _i64Subtract(0, 0, i116, i130) | 0; + i93 = i117 ? tempRet0 : i130; + if (i69) { + i130 = _i64Subtract(0, 0, i96, i77) | 0; + i154 = i117 ^ 1; + i155 = tempRet0; + i156 = i130; + } else { + i154 = i117; + i155 = i77; + i156 = i96; + } + i130 = (i117 ? i147 : i116) | 0; + i116 = i93 & 0; + i147 = i156 | 0; + i117 = i155 & 0; + i82 = ___muldi3(i147, i117, i130, i116) | 0; + i129 = tempRet0; + i148 = i155; + i118 = 0; + i85 = ___muldi3(i148, i118, i130, i116) | 0; + i116 = tempRet0; + i130 = i93; + i93 = 0; + i146 = ___muldi3(i147, i117, i130, i93) | 0; + i117 = tempRet0; + i147 = ___muldi3(i148, i118, i130, i93) | 0; + i93 = tempRet0; + i130 = _i64Add(i85 | 0, i116 & 0, i146 | 0, i117 & 0) | 0; + i146 = tempRet0; + i85 = _i64Add(i116, 0, i147, i93) | 0; + i93 = _i64Add(i85, tempRet0, i117, 0) | 0; + i117 = tempRet0; + i85 = _llvm_uadd_with_overflow_i64(i82 | 0, i129 | 0, 0, i130 | 0) | 0; + i130 = i85; + i85 = tempRet0; + i129 = _i64Add(i93, i117, tempRet1 & 1, 0) | 0; + i117 = _i64Add(i129, tempRet0, i146, 0) | 0; + i146 = tempRet0; + if (i154) { + i129 = _i64Subtract(0, 0, i130, i85) | 0; + i93 = tempRet0; + i82 = _i64Add((i130 | 0) == 0 & (i85 | 0) == 0 & 1, 0, ~i117, ~i146) | 0; + i157 = i93; + i158 = i129; + i159 = tempRet0; + i160 = i82; + } else { + i157 = i85; + i158 = i130; + i159 = i146; + i160 = i117; + } + i117 = ___muldi3(i149, i71, i79, i72) | 0; + i71 = tempRet0; + i149 = 0; + i146 = (i71 | 0) < (i149 | 0) | (i71 | 0) == (i149 | 0) & i117 >>> 0 < 0 >>> 0; + i149 = _i64Subtract(0, 0, i117, i71) | 0; + i130 = i146 ? tempRet0 : i71; + i71 = (i146 ? i149 : i117) | 0; + i117 = i130 & 0; + i149 = ___muldi3(i71, i117, i83, i97) | 0; + i85 = tempRet0; + i82 = ___muldi3(i71, i117, i86, i74) | 0; + i117 = tempRet0; + i71 = i130; + i130 = 0; + i129 = ___muldi3(i71, i130, i83, i97) | 0; + i93 = tempRet0; + i147 = ___muldi3(i71, i130, i86, i74) | 0; + i130 = tempRet0; + i71 = _i64Add(i82 | 0, i117 & 0, i129 | 0, i93 & 0) | 0; + i129 = tempRet0; + i82 = _llvm_uadd_with_overflow_i64(i149 | 0, i85 | 0, 0, i71 | 0) | 0; + i71 = i82; + i82 = tempRet0; + i85 = tempRet1 & 1; + i149 = _i64Add(i117, 0, i147, i130) | 0; + i130 = _i64Add(i149, tempRet0, i93, 0) | 0; + i93 = _i64Add(i130, tempRet0, i129, 0) | 0; + i129 = _i64Add(i93, tempRet0, i85, 0) | 0; + i85 = tempRet0; + if (i146 ^ i90) { + i146 = _i64Subtract(0, 0, i71, i82) | 0; + i93 = tempRet0; + i130 = _i64Add((i71 | 0) == 0 & (i82 | 0) == 0 & 1, 0, ~i129, ~i85) | 0; + i161 = i93; + i162 = i146; + i163 = tempRet0; + i164 = i130; + } else { + i161 = i82; + i162 = i71; + i163 = i85; + i164 = i129; + } + i129 = _i64Subtract(0, 0, i162, i161) | 0; + i85 = _llvm_uadd_with_overflow_i64(i158 | 0, i157 | 0, i129 | 0, tempRet0 | 0) | 0; + i129 = tempRet0; + i71 = tempRet1 & 1; + i82 = HEAP32[i27 >> 2] | 0; + i130 = i82; + i146 = (i82 | 0) < 0 ? -1 : 0; + i82 = ___muldi3(i130, i146, i79, i72) | 0; + i93 = tempRet0; + i149 = 0; + i147 = (i93 | 0) < (i149 | 0) | (i93 | 0) == (i149 | 0) & i82 >>> 0 < 0 >>> 0; + i149 = _i64Subtract(0, 0, i82, i93) | 0; + i117 = i147 ? tempRet0 : i93; + i93 = (i147 ? i149 : i82) | 0; + i82 = i117 & 0; + i149 = ___muldi3(i93, i82, i78, i89) | 0; + i116 = tempRet0; + i118 = ___muldi3(i93, i82, i94, i62) | 0; + i82 = tempRet0; + i93 = i117; + i117 = 0; + i148 = ___muldi3(i93, i117, i78, i89) | 0; + i115 = tempRet0; + i165 = ___muldi3(i93, i117, i94, i62) | 0; + i117 = tempRet0; + i93 = _i64Add(i118 | 0, i82 & 0, i148 | 0, i115 & 0) | 0; + i148 = tempRet0; + i118 = _llvm_uadd_with_overflow_i64(i149 | 0, i116 | 0, 0, i93 | 0) | 0; + i93 = i118; + i118 = tempRet0; + i116 = _i64Add(i165, i117, tempRet1 & 1, 0) | 0; + i117 = _i64Add(i116, tempRet0, i82, 0) | 0; + i82 = _i64Add(i117, tempRet0, i115, 0) | 0; + i115 = _i64Add(i82, tempRet0, i148, 0) | 0; + i148 = tempRet0; + if (i147 ^ i81) { + i147 = _i64Subtract(0, 0, i93, i118) | 0; + i82 = tempRet0; + i117 = _i64Add((i93 | 0) == 0 & (i118 | 0) == 0 & 1, 0, ~i115, ~i148) | 0; + i166 = i82; + i167 = i147; + i168 = tempRet0; + i169 = i117; + } else { + i166 = i118; + i167 = i93; + i168 = i148; + i169 = i115; + } + i115 = _llvm_uadd_with_overflow_i64(i85 | 0, i129 | 0, i167 | 0, i166 | 0) | 0; + i129 = tempRet0; + i85 = tempRet1 & 1; + i148 = ___muldi3(i130, i146, i73, i67) | 0; + i146 = tempRet0; + i130 = 0; + i93 = (i146 | 0) < (i130 | 0) | (i146 | 0) == (i130 | 0) & i148 >>> 0 < 0 >>> 0; + i130 = _i64Subtract(0, 0, i148, i146) | 0; + i118 = i93 ? tempRet0 : i146; + if (i70) { + i146 = _i64Subtract(0, 0, i88, i91) | 0; + i170 = i93 ^ 1; + i171 = tempRet0; + i172 = i146; + } else { + i170 = i93; + i171 = i91; + i172 = i88; + } + i146 = (i93 ? i130 : i148) | 0; + i148 = i118 & 0; + i130 = i172 | 0; + i93 = i171 & 0; + i117 = ___muldi3(i130, i93, i146, i148) | 0; + i147 = tempRet0; + i82 = i171; + i116 = 0; + i165 = ___muldi3(i82, i116, i146, i148) | 0; + i148 = tempRet0; + i146 = i118; + i118 = 0; + i149 = ___muldi3(i130, i93, i146, i118) | 0; + i93 = tempRet0; + i130 = ___muldi3(i82, i116, i146, i118) | 0; + i118 = tempRet0; + i146 = _i64Add(i165 | 0, i148 & 0, i149 | 0, i93 & 0) | 0; + i149 = tempRet0; + i165 = _i64Add(i148, 0, i130, i118) | 0; + i118 = _i64Add(i165, tempRet0, i93, 0) | 0; + i93 = tempRet0; + i165 = _llvm_uadd_with_overflow_i64(i117 | 0, i147 | 0, 0, i146 | 0) | 0; + i146 = i165; + i165 = tempRet0; + i147 = _i64Add(i118, i93, tempRet1 & 1, 0) | 0; + i93 = _i64Add(i147, tempRet0, i149, 0) | 0; + i149 = tempRet0; + if (i170) { + i147 = _i64Subtract(0, 0, i146, i165) | 0; + i118 = tempRet0; + i117 = _i64Add((i146 | 0) == 0 & (i165 | 0) == 0 & 1, 0, ~i93, ~i149) | 0; + i173 = i118; + i174 = i147; + i175 = tempRet0; + i176 = i117; + } else { + i173 = i165; + i174 = i146; + i175 = i149; + i176 = i93; + } + i93 = _i64Subtract(0, 0, i174, i173) | 0; + i149 = _llvm_uadd_with_overflow_i64(i115 | 0, i129 | 0, i93 | 0, tempRet0 | 0) | 0; + i93 = tempRet0; + i129 = tempRet1 & 1; + if (i120) { + i115 = _i64Subtract(0, 0, i76, i84) | 0; + i146 = tempRet0; + i165 = _i64Add((i76 | 0) == 0 & (i84 | 0) == 0 & 1, 0, ~i87, ~i80) | 0; + i177 = i146; + i178 = i115; + i179 = tempRet0; + i180 = i165; + } else { + i177 = i84; + i178 = i76; + i179 = i80; + i180 = i87; + } + i165 = i48 ? i10 : i24; + i115 = i48 ? i41 : i34; + i146 = i178 | 0; + i117 = i177 & 0; + i147 = i165 | 0; + i118 = i115 & 0; + i130 = ___muldi3(i147, i118, i146, i117) | 0; + i148 = tempRet0; + i116 = i115; + i82 = 0; + i181 = ___muldi3(i116, i82, i146, i117) | 0; + i117 = tempRet0; + i146 = i177; + i182 = 0; + i183 = ___muldi3(i147, i118, i146, i182) | 0; + i118 = tempRet0; + i147 = ___muldi3(i116, i82, i146, i182) | 0; + i182 = tempRet0; + i146 = _i64Add(i181 | 0, i117 & 0, i183 | 0, i118 & 0) | 0; + i183 = tempRet0; + i181 = _llvm_uadd_with_overflow_i64(i130 | 0, i148 | 0, 0, i146 | 0) | 0; + i146 = i181; + i181 = tempRet0; + i148 = tempRet1 & 1; + i130 = ___muldi3(i165, i115, i180, i179) | 0; + i115 = _i64Add(i147, i182, i130, tempRet0) | 0; + i130 = _i64Add(i115, tempRet0, i117, 0) | 0; + i117 = _i64Add(i130, tempRet0, i118, 0) | 0; + i118 = _i64Add(i117, tempRet0, i148, 0) | 0; + i148 = _i64Add(i118, tempRet0, i183, 0) | 0; + i183 = tempRet0; + if (i120 ^ i48) { + i118 = _i64Subtract(0, 0, i146, i181) | 0; + i117 = tempRet0; + i130 = _i64Add((i146 | 0) == 0 & (i181 | 0) == 0 & 1, 0, ~i148, ~i183) | 0; + i184 = i117; + i185 = i118; + i186 = tempRet0; + i187 = i130; + } else { + i184 = i181; + i185 = i146; + i186 = i183; + i187 = i148; + } + i148 = _llvm_uadd_with_overflow_i64(i149 | 0, i93 | 0, i185 | 0, i184 | 0) | 0; + i93 = tempRet0; + i149 = tempRet1 & 1; + i183 = _i64Add(i160, i159, ~i164, ~i163) | 0; + i146 = _i64Add(i183, tempRet0, (i162 | 0) == 0 & (i161 | 0) == 0 & 1, 0) | 0; + i183 = _i64Add(i146, tempRet0, i71, 0) | 0; + i71 = _i64Add(i183, tempRet0, i169, i168) | 0; + i183 = _i64Add(i71, tempRet0, i85, 0) | 0; + i85 = _i64Add(i183, tempRet0, ~i176, ~i175) | 0; + i183 = _i64Add(i85, tempRet0, (i174 | 0) == 0 & (i173 | 0) == 0 & 1, 0) | 0; + i85 = _i64Add(i183, tempRet0, i129, 0) | 0; + i129 = _i64Add(i85, tempRet0, i187, i186) | 0; + i85 = _i64Add(i129, tempRet0, i149, 0) | 0; + i149 = tempRet0; + i129 = HEAP32[i25 >> 2] | 0; + i183 = i129; + i71 = (i129 | 0) < 0 ? -1 : 0; + i129 = ___muldi3(i183, i71, i73, i67) | 0; + i146 = tempRet0; + i181 = 0; + i130 = (i146 | 0) < (i181 | 0) | (i146 | 0) == (i181 | 0) & i129 >>> 0 < 0 >>> 0; + i181 = _i64Subtract(0, 0, i129, i146) | 0; + i118 = i130 ? tempRet0 : i146; + if (i69) { + i69 = _i64Subtract(0, 0, i96, i77) | 0; + i188 = i130 ^ 1; + i189 = tempRet0; + i190 = i69; + } else { + i188 = i130; + i189 = i77; + i190 = i96; + } + i96 = (i130 ? i181 : i129) | 0; + i129 = i118 & 0; + i181 = i190 | 0; + i130 = i189 & 0; + i77 = ___muldi3(i181, i130, i96, i129) | 0; + i69 = tempRet0; + i146 = i189; + i117 = 0; + i115 = ___muldi3(i146, i117, i96, i129) | 0; + i129 = tempRet0; + i96 = i118; + i118 = 0; + i182 = ___muldi3(i181, i130, i96, i118) | 0; + i130 = tempRet0; + i181 = ___muldi3(i146, i117, i96, i118) | 0; + i118 = tempRet0; + i96 = _i64Add(i115 | 0, i129 & 0, i182 | 0, i130 & 0) | 0; + i182 = tempRet0; + i115 = _i64Add(i129, 0, i181, i118) | 0; + i118 = _i64Add(i115, tempRet0, i130, 0) | 0; + i130 = tempRet0; + i115 = _llvm_uadd_with_overflow_i64(i77 | 0, i69 | 0, 0, i96 | 0) | 0; + i96 = i115; + i115 = tempRet0; + i69 = _i64Add(i118, i130, tempRet1 & 1, 0) | 0; + i130 = _i64Add(i69, tempRet0, i182, 0) | 0; + i182 = tempRet0; + if (i188) { + i69 = _i64Subtract(0, 0, i96, i115) | 0; + i118 = tempRet0; + i77 = _i64Add((i96 | 0) == 0 & (i115 | 0) == 0 & 1, 0, ~i130, ~i182) | 0; + i191 = i118; + i192 = i69; + i193 = tempRet0; + i194 = i77; + } else { + i191 = i115; + i192 = i96; + i193 = i182; + i194 = i130; + } + i130 = ___muldi3(i183, i71, i79, i72) | 0; + i71 = tempRet0; + i183 = 0; + i182 = (i71 | 0) < (i183 | 0) | (i71 | 0) == (i183 | 0) & i130 >>> 0 < 0 >>> 0; + i183 = _i64Subtract(0, 0, i130, i71) | 0; + i96 = i182 ? tempRet0 : i71; + i71 = (i182 ? i183 : i130) | 0; + i130 = i96 & 0; + i183 = ___muldi3(i71, i130, i83, i97) | 0; + i115 = tempRet0; + i77 = ___muldi3(i71, i130, i86, i74) | 0; + i130 = tempRet0; + i71 = i96; + i96 = 0; + i69 = ___muldi3(i71, i96, i83, i97) | 0; + i97 = tempRet0; + i83 = ___muldi3(i71, i96, i86, i74) | 0; + i74 = tempRet0; + i86 = _i64Add(i77 | 0, i130 & 0, i69 | 0, i97 & 0) | 0; + i69 = tempRet0; + i77 = _llvm_uadd_with_overflow_i64(i183 | 0, i115 | 0, 0, i86 | 0) | 0; + i86 = i77; + i77 = tempRet0; + i115 = tempRet1 & 1; + i183 = _i64Add(i130, 0, i83, i74) | 0; + i74 = _i64Add(i183, tempRet0, i97, 0) | 0; + i97 = _i64Add(i74, tempRet0, i69, 0) | 0; + i69 = _i64Add(i97, tempRet0, i115, 0) | 0; + i115 = tempRet0; + if (i182 ^ i90) { + i90 = _i64Subtract(0, 0, i86, i77) | 0; + i182 = tempRet0; + i97 = _i64Add((i86 | 0) == 0 & (i77 | 0) == 0 & 1, 0, ~i69, ~i115) | 0; + i195 = i182; + i196 = i90; + i197 = tempRet0; + i198 = i97; + } else { + i195 = i77; + i196 = i86; + i197 = i115; + i198 = i69; + } + i69 = _i64Subtract(0, 0, i196, i195) | 0; + i115 = _llvm_uadd_with_overflow_i64(i192 | 0, i191 | 0, i69 | 0, tempRet0 | 0) | 0; + i69 = tempRet0; + i86 = tempRet1 & 1; + i77 = HEAP32[i22 >> 2] | 0; + i97 = i77; + i90 = (i77 | 0) < 0 ? -1 : 0; + i77 = ___muldi3(i97, i90, i79, i72) | 0; + i72 = tempRet0; + i79 = 0; + i182 = (i72 | 0) < (i79 | 0) | (i72 | 0) == (i79 | 0) & i77 >>> 0 < 0 >>> 0; + i79 = _i64Subtract(0, 0, i77, i72) | 0; + i74 = i182 ? tempRet0 : i72; + i72 = (i182 ? i79 : i77) | 0; + i77 = i74 & 0; + i79 = ___muldi3(i72, i77, i78, i89) | 0; + i183 = tempRet0; + i83 = ___muldi3(i72, i77, i94, i62) | 0; + i77 = tempRet0; + i72 = i74; + i74 = 0; + i130 = ___muldi3(i72, i74, i78, i89) | 0; + i89 = tempRet0; + i78 = ___muldi3(i72, i74, i94, i62) | 0; + i62 = tempRet0; + i94 = _i64Add(i83 | 0, i77 & 0, i130 | 0, i89 & 0) | 0; + i130 = tempRet0; + i83 = _llvm_uadd_with_overflow_i64(i79 | 0, i183 | 0, 0, i94 | 0) | 0; + i94 = i83; + i83 = tempRet0; + i183 = _i64Add(i78, i62, tempRet1 & 1, 0) | 0; + i62 = _i64Add(i183, tempRet0, i77, 0) | 0; + i77 = _i64Add(i62, tempRet0, i89, 0) | 0; + i89 = _i64Add(i77, tempRet0, i130, 0) | 0; + i130 = tempRet0; + if (i182 ^ i81) { + i81 = _i64Subtract(0, 0, i94, i83) | 0; + i182 = tempRet0; + i77 = _i64Add((i94 | 0) == 0 & (i83 | 0) == 0 & 1, 0, ~i89, ~i130) | 0; + i199 = i182; + i200 = i81; + i201 = tempRet0; + i202 = i77; + } else { + i199 = i83; + i200 = i94; + i201 = i130; + i202 = i89; + } + i89 = _llvm_uadd_with_overflow_i64(i115 | 0, i69 | 0, i200 | 0, i199 | 0) | 0; + i69 = tempRet0; + i115 = tempRet1 & 1; + i130 = ___muldi3(i97, i90, i73, i67) | 0; + i67 = tempRet0; + i73 = 0; + i90 = (i67 | 0) < (i73 | 0) | (i67 | 0) == (i73 | 0) & i130 >>> 0 < 0 >>> 0; + i73 = _i64Subtract(0, 0, i130, i67) | 0; + i97 = i90 ? tempRet0 : i67; + if (i70) { + i70 = _i64Subtract(0, 0, i88, i91) | 0; + i203 = i90 ^ 1; + i204 = tempRet0; + i205 = i70; + } else { + i203 = i90; + i204 = i91; + i205 = i88; + } + i88 = (i90 ? i73 : i130) | 0; + i130 = i97 & 0; + i73 = i205 | 0; + i90 = i204 & 0; + i91 = ___muldi3(i73, i90, i88, i130) | 0; + i70 = tempRet0; + i67 = i204; + i94 = 0; + i83 = ___muldi3(i67, i94, i88, i130) | 0; + i130 = tempRet0; + i88 = i97; + i97 = 0; + i77 = ___muldi3(i73, i90, i88, i97) | 0; + i90 = tempRet0; + i73 = ___muldi3(i67, i94, i88, i97) | 0; + i97 = tempRet0; + i88 = _i64Add(i83 | 0, i130 & 0, i77 | 0, i90 & 0) | 0; + i77 = tempRet0; + i83 = _i64Add(i130, 0, i73, i97) | 0; + i97 = _i64Add(i83, tempRet0, i90, 0) | 0; + i90 = tempRet0; + i83 = _llvm_uadd_with_overflow_i64(i91 | 0, i70 | 0, 0, i88 | 0) | 0; + i88 = i83; + i83 = tempRet0; + i70 = _i64Add(i97, i90, tempRet1 & 1, 0) | 0; + i90 = _i64Add(i70, tempRet0, i77, 0) | 0; + i77 = tempRet0; + if (i203) { + i70 = _i64Subtract(0, 0, i88, i83) | 0; + i97 = tempRet0; + i91 = _i64Add((i88 | 0) == 0 & (i83 | 0) == 0 & 1, 0, ~i90, ~i77) | 0; + i206 = i97; + i207 = i70; + i208 = tempRet0; + i209 = i91; + } else { + i206 = i83; + i207 = i88; + i208 = i77; + i209 = i90; + } + i90 = _i64Subtract(0, 0, i207, i206) | 0; + i77 = _llvm_uadd_with_overflow_i64(i89 | 0, i69 | 0, i90 | 0, tempRet0 | 0) | 0; + i90 = tempRet0; + i69 = tempRet1 & 1; + if (i120) { + i89 = _i64Subtract(0, 0, i76, i84) | 0; + i88 = tempRet0; + i83 = _i64Add((i76 | 0) == 0 & (i84 | 0) == 0 & 1, 0, ~i87, ~i80) | 0; + i210 = i88; + i211 = i89; + i212 = tempRet0; + i213 = i83; + } else { + i210 = i84; + i211 = i76; + i212 = i80; + i213 = i87; + } + i83 = i21 ? i43 : i37; + i89 = i21 ? i42 : i39; + i88 = i211 | 0; + i91 = i210 & 0; + i70 = i83 | 0; + i97 = i89 & 0; + i73 = ___muldi3(i70, i97, i88, i91) | 0; + i130 = tempRet0; + i94 = i89; + i67 = 0; + i81 = ___muldi3(i94, i67, i88, i91) | 0; + i91 = tempRet0; + i88 = i210; + i182 = 0; + i62 = ___muldi3(i70, i97, i88, i182) | 0; + i97 = tempRet0; + i70 = ___muldi3(i94, i67, i88, i182) | 0; + i182 = tempRet0; + i88 = _i64Add(i81 | 0, i91 & 0, i62 | 0, i97 & 0) | 0; + i62 = tempRet0; + i81 = _llvm_uadd_with_overflow_i64(i73 | 0, i130 | 0, 0, i88 | 0) | 0; + i88 = i81; + i81 = tempRet0; + i130 = tempRet1 & 1; + i73 = ___muldi3(i83, i89, i213, i212) | 0; + i89 = _i64Add(i70, i182, i73, tempRet0) | 0; + i73 = _i64Add(i89, tempRet0, i91, 0) | 0; + i91 = _i64Add(i73, tempRet0, i97, 0) | 0; + i97 = _i64Add(i91, tempRet0, i130, 0) | 0; + i130 = _i64Add(i97, tempRet0, i62, 0) | 0; + i62 = tempRet0; + if (i120 ^ i21) { + i120 = _i64Subtract(0, 0, i88, i81) | 0; + i97 = tempRet0; + i91 = _i64Add((i88 | 0) == 0 & (i81 | 0) == 0 & 1, 0, ~i130, ~i62) | 0; + i214 = i97; + i215 = i120; + i216 = tempRet0; + i217 = i91; + } else { + i214 = i81; + i215 = i88; + i216 = i62; + i217 = i130; + } + i130 = _llvm_uadd_with_overflow_i64(i77 | 0, i90 | 0, i215 | 0, i214 | 0) | 0; + i90 = tempRet0; + i77 = tempRet1 & 1; + i62 = _i64Add(i194, i193, ~i198, ~i197) | 0; + i88 = _i64Add(i62, tempRet0, (i196 | 0) == 0 & (i195 | 0) == 0 & 1, 0) | 0; + i62 = _i64Add(i88, tempRet0, i86, 0) | 0; + i86 = _i64Add(i62, tempRet0, i202, i201) | 0; + i62 = _i64Add(i86, tempRet0, i115, 0) | 0; + i115 = _i64Add(i62, tempRet0, ~i209, ~i208) | 0; + i62 = _i64Add(i115, tempRet0, (i207 | 0) == 0 & (i206 | 0) == 0 & 1, 0) | 0; + i115 = _i64Add(i62, tempRet0, i69, 0) | 0; + i69 = _i64Add(i115, tempRet0, i217, i216) | 0; + i115 = _i64Add(i69, tempRet0, i77, 0) | 0; + i77 = i75 + 24 | 0; + HEAP32[i77 >> 2] = i92; + HEAP32[i77 + 4 >> 2] = i95; + i95 = i75 + 32 | 0; + HEAP32[i95 >> 2] = i119; + HEAP32[i95 + 4 >> 2] = i68; + i68 = i75 + 40 | 0; + HEAP32[i68 >> 2] = i148; + HEAP32[i68 + 4 >> 2] = i93; + i93 = i75 + 48 | 0; + HEAP32[i93 >> 2] = i85; + HEAP32[i93 + 4 >> 2] = i149; + i149 = i75 + 56 | 0; + HEAP32[i149 >> 2] = i130; + HEAP32[i149 + 4 >> 2] = i90; + i90 = i75 + 64 | 0; + HEAP32[i90 >> 2] = i115; + HEAP32[i90 + 4 >> 2] = tempRet0; + i90 = i75 + 72 | 0; + i115 = i75 + 72 | 0; + HEAP32[i115 >> 2] = i76; + HEAP32[i115 + 4 >> 2] = i84; + i84 = i75 + 80 | 0; + HEAP32[i84 >> 2] = i87; + HEAP32[i84 + 4 >> 2] = i80; + d15 = +__ZNK20btConvexHullInternal6Int1288toScalarEv(i75 + 24 | 0); + HEAP32[i75 + 88 >> 2] = ~~(d15 / +__ZNK20btConvexHullInternal6Int1288toScalarEv(i90)); + d15 = +__ZNK20btConvexHullInternal6Int1288toScalarEv(i75 + 40 | 0); + HEAP32[i75 + 92 >> 2] = ~~(d15 / +__ZNK20btConvexHullInternal6Int1288toScalarEv(i90)); + d15 = +__ZNK20btConvexHullInternal6Int1288toScalarEv(i75 + 56 | 0); + HEAP32[i75 + 96 >> 2] = ~~(d15 / +__ZNK20btConvexHullInternal6Int1288toScalarEv(i90)); + HEAP32[i64 >> 2] = i75; + HEAP32[i75 + 8 >> 2] = i66; + i66 = HEAP32[i53 >> 2] | 0; + i90 = HEAP32[i52 >> 2] | 0; + do { + if ((i66 | 0) == (i90 | 0)) { + i80 = (i66 | 0) == 0 ? 1 : i66 << 1; + if ((i66 | 0) >= (i80 | 0)) { + i218 = i66; + i219 = i66; + break; + } + if ((i80 | 0) == 0) { + i220 = 0; + i221 = i66; + } else { + i84 = __Z22btAlignedAllocInternalji(i80 << 2, 16) | 0; + i220 = i84; + i221 = HEAP32[i53 >> 2] | 0; + } + if ((i221 | 0) > 0) { + i84 = 0; + do { + i87 = i220 + (i84 << 2) | 0; + if ((i87 | 0) != 0) { + HEAP32[i87 >> 2] = HEAP32[(HEAP32[i32 >> 2] | 0) + (i84 << 2) >> 2]; + } + i84 = i84 + 1 | 0; + } while ((i84 | 0) < (i221 | 0)); + } + i84 = HEAP32[i32 >> 2] | 0; + if ((i84 | 0) == 0) { + i222 = i221; + } else { + if ((HEAP8[i54] | 0) == 0) { + i223 = i221; + } else { + __Z21btAlignedFreeInternalPv(i84); + i223 = HEAP32[i53 >> 2] | 0; + } + HEAP32[i32 >> 2] = 0; + i222 = i223; + } + HEAP8[i54] = 1; + HEAP32[i32 >> 2] = i220; + HEAP32[i52 >> 2] = i80; + i218 = i222; + i219 = i80; + } else { + i218 = i66; + i219 = i90; + } + } while (0); + i90 = (HEAP32[i32 >> 2] | 0) + (i218 << 2) | 0; + if ((i90 | 0) != 0) { + HEAP32[i90 >> 2] = i75; + } + i90 = i218 + 1 | 0; + HEAP32[i53 >> 2] = i90; + do { + if ((i90 | 0) == (i219 | 0)) { + i66 = (i219 | 0) == 0 ? 1 : i219 << 1; + if ((i219 | 0) >= (i66 | 0)) { + i224 = i219; + i225 = i219; + break; + } + if ((i66 | 0) == 0) { + i226 = 0; + i227 = i219; + } else { + i84 = __Z22btAlignedAllocInternalji(i66 << 2, 16) | 0; + i226 = i84; + i227 = HEAP32[i53 >> 2] | 0; + } + if ((i227 | 0) > 0) { + i84 = 0; + do { + i87 = i226 + (i84 << 2) | 0; + if ((i87 | 0) != 0) { + HEAP32[i87 >> 2] = HEAP32[(HEAP32[i32 >> 2] | 0) + (i84 << 2) >> 2]; + } + i84 = i84 + 1 | 0; + } while ((i84 | 0) < (i227 | 0)); + } + i84 = HEAP32[i32 >> 2] | 0; + if ((i84 | 0) == 0) { + i228 = i227; + } else { + if ((HEAP8[i54] | 0) == 0) { + i229 = i227; + } else { + __Z21btAlignedFreeInternalPv(i84); + i229 = HEAP32[i53 >> 2] | 0; + } + HEAP32[i32 >> 2] = 0; + i228 = i229; + } + HEAP8[i54] = 1; + HEAP32[i32 >> 2] = i226; + HEAP32[i52 >> 2] = i66; + i224 = i228; + i225 = i66; + } else { + i224 = i90; + i225 = i219; + } + } while (0); + i90 = (HEAP32[i32 >> 2] | 0) + (i224 << 2) | 0; + if ((i90 | 0) != 0) { + HEAP32[i90 >> 2] = i58; + } + i90 = i224 + 1 | 0; + HEAP32[i53 >> 2] = i90; + do { + if ((i90 | 0) == (i225 | 0)) { + i75 = (i225 | 0) == 0 ? 1 : i225 << 1; + if ((i225 | 0) >= (i75 | 0)) { + i230 = i225; + break; + } + if ((i75 | 0) == 0) { + i231 = 0; + i232 = i225; + } else { + i84 = __Z22btAlignedAllocInternalji(i75 << 2, 16) | 0; + i231 = i84; + i232 = HEAP32[i53 >> 2] | 0; + } + if ((i232 | 0) > 0) { + i84 = 0; + do { + i80 = i231 + (i84 << 2) | 0; + if ((i80 | 0) != 0) { + HEAP32[i80 >> 2] = HEAP32[(HEAP32[i32 >> 2] | 0) + (i84 << 2) >> 2]; + } + i84 = i84 + 1 | 0; + } while ((i84 | 0) < (i232 | 0)); + } + i84 = HEAP32[i32 >> 2] | 0; + if ((i84 | 0) == 0) { + i233 = i232; + } else { + if ((HEAP8[i54] | 0) == 0) { + i234 = i232; + } else { + __Z21btAlignedFreeInternalPv(i84); + i234 = HEAP32[i53 >> 2] | 0; + } + HEAP32[i32 >> 2] = 0; + i233 = i234; + } + HEAP8[i54] = 1; + HEAP32[i32 >> 2] = i231; + HEAP32[i52 >> 2] = i75; + i230 = i233; + } else { + i230 = i90; + } + } while (0); + i90 = (HEAP32[i32 >> 2] | 0) + (i230 << 2) | 0; + if ((i90 | 0) != 0) { + HEAP32[i90 >> 2] = 0; + } + HEAP32[i53 >> 2] = i230 + 1; + } + i90 = (i65 | 0) == 0; + if ((i65 | i50 | 0) == 0) { + i58 = HEAP32[HEAP32[i60 >> 2] >> 2] | 0; + i84 = HEAP32[i64 >> 2] | 0; + if ((HEAP32[i58 + 12 >> 2] | 0) == (i84 | 0)) { + i235 = i58; + } else { + i236 = i84; + i49 = 1401; + } + } else { + i236 = HEAP32[i64 >> 2] | 0; + i49 = 1401; + } + if ((i49 | 0) == 1401) { + i49 = 0; + i84 = HEAP32[i61 + 12 >> 2] | 0; + i58 = __ZN20btConvexHullInternal4PoolINS_4EdgeEE9newObjectEv(i11) | 0; + i66 = __ZN20btConvexHullInternal4PoolINS_4EdgeEE9newObjectEv(i11) | 0; + i80 = i58 + 8 | 0; + HEAP32[i80 >> 2] = i66; + HEAP32[i66 + 8 >> 2] = i58; + HEAP32[i58 + 20 >> 2] = HEAP32[i9 >> 2]; + HEAP32[i66 + 20 >> 2] = HEAP32[i9 >> 2]; + HEAP32[i58 + 12 >> 2] = i236; + HEAP32[i66 + 12 >> 2] = i84; + HEAP32[i58 + 16 >> 2] = 0; + HEAP32[i66 + 16 >> 2] = 0; + i66 = (HEAP32[i30 >> 2] | 0) + 1 | 0; + HEAP32[i30 >> 2] = i66; + if ((i66 | 0) > (HEAP32[i40 >> 2] | 0)) { + HEAP32[i40 >> 2] = i66; + } + if (i57) { + i66 = HEAP32[HEAP32[i60 >> 2] >> 2] | 0; + HEAP32[i58 >> 2] = i66; + HEAP32[i66 + 4 >> 2] = i58; + i49 = 1406; + } else { + if ((i55 | 0) != 0) { + i49 = 1406; + } + } + if ((i49 | 0) == 1406) { + i49 = 0; + i66 = HEAP32[i60 >> 2] | 0; + HEAP32[i66 >> 2] = i58; + HEAP32[i58 + 4 >> 2] = i66; + } + i66 = i59 + 8 | 0; + if (i90) { + i90 = HEAP32[(HEAP32[i66 >> 2] | 0) + 4 >> 2] | 0; + i84 = HEAP32[i80 >> 2] | 0; + HEAP32[i90 >> 2] = i84; + HEAP32[i84 + 4 >> 2] = i90; + } + i90 = HEAP32[i80 >> 2] | 0; + i80 = HEAP32[i66 >> 2] | 0; + HEAP32[i90 >> 2] = i80; + HEAP32[i80 + 4 >> 2] = i90; + i235 = i58; + } + do { + if ((i55 | 0) != 0) { + i58 = i55 + 8 | 0; + i90 = HEAP32[i58 >> 2] | 0; + if ((i50 | 0) > 0) { + HEAP32[i235 >> 2] = i90; + HEAP32[i90 + 4 >> 2] = i235; + break; + } + if ((i235 | 0) == (i90 | 0)) { + break; + } + i90 = i55 + 12 | 0; + i80 = HEAP32[i53 >> 2] | 0; + i66 = HEAP32[i52 >> 2] | 0; + do { + if ((i80 | 0) == (i66 | 0)) { + i84 = (i80 | 0) == 0 ? 1 : i80 << 1; + if ((i80 | 0) >= (i84 | 0)) { + i237 = i80; + i238 = i80; + break; + } + if ((i84 | 0) == 0) { + i239 = 0; + i240 = i80; + } else { + i87 = __Z22btAlignedAllocInternalji(i84 << 2, 16) | 0; + i239 = i87; + i240 = HEAP32[i53 >> 2] | 0; + } + if ((i240 | 0) > 0) { + i87 = 0; + do { + i115 = i239 + (i87 << 2) | 0; + if ((i115 | 0) != 0) { + HEAP32[i115 >> 2] = HEAP32[(HEAP32[i32 >> 2] | 0) + (i87 << 2) >> 2]; + } + i87 = i87 + 1 | 0; + } while ((i87 | 0) < (i240 | 0)); + } + i87 = HEAP32[i32 >> 2] | 0; + if ((i87 | 0) == 0) { + i241 = i240; + } else { + if ((HEAP8[i54] | 0) == 0) { + i242 = i240; + } else { + __Z21btAlignedFreeInternalPv(i87); + i242 = HEAP32[i53 >> 2] | 0; + } + HEAP32[i32 >> 2] = 0; + i241 = i242; + } + HEAP8[i54] = 1; + HEAP32[i32 >> 2] = i239; + HEAP32[i52 >> 2] = i84; + i237 = i241; + i238 = i84; + } else { + i237 = i80; + i238 = i66; + } + } while (0); + i66 = (HEAP32[i32 >> 2] | 0) + (i237 << 2) | 0; + if ((i66 | 0) != 0) { + HEAP32[i66 >> 2] = HEAP32[i90 >> 2]; + } + i66 = i237 + 1 | 0; + HEAP32[i53 >> 2] = i66; + i80 = i235 | 0; + i75 = HEAP32[i80 >> 2] | 0; + if ((i75 | 0) == (HEAP32[i58 >> 2] | 0)) { + i243 = i66; + i244 = i238; + } else { + i66 = i75; + while (1) { + i75 = i66 + 12 | 0; + i87 = HEAP32[i75 >> 2] | 0; + i115 = i66 | 0; + i76 = HEAP32[i115 >> 2] | 0; + i149 = HEAP32[i66 + 8 >> 2] | 0; + if ((i76 | 0) == (i66 | 0)) { + HEAP32[(HEAP32[i149 + 12 >> 2] | 0) + 8 >> 2] = 0; + } else { + i130 = i66 + 4 | 0; + HEAP32[i76 + 4 >> 2] = HEAP32[i130 >> 2]; + HEAP32[HEAP32[i130 >> 2] >> 2] = i76; + HEAP32[(HEAP32[i149 + 12 >> 2] | 0) + 8 >> 2] = i76; + } + i76 = i149 | 0; + i130 = HEAP32[i76 >> 2] | 0; + if ((i130 | 0) == (i149 | 0)) { + HEAP32[(HEAP32[i75 >> 2] | 0) + 8 >> 2] = 0; + } else { + i93 = i149 + 4 | 0; + HEAP32[i130 + 4 >> 2] = HEAP32[i93 >> 2]; + HEAP32[HEAP32[i93 >> 2] >> 2] = i130; + HEAP32[(HEAP32[i75 >> 2] | 0) + 8 >> 2] = i130; + } + _memset(i66 | 0, 0, 20); + HEAP32[i115 >> 2] = HEAP32[i4 >> 2]; + HEAP32[i4 >> 2] = i66; + _memset(i149 | 0, 0, 20); + HEAP32[i76 >> 2] = HEAP32[i4 >> 2]; + HEAP32[i4 >> 2] = i149; + HEAP32[i30 >> 2] = (HEAP32[i30 >> 2] | 0) - 1; + i149 = HEAP32[i53 >> 2] | 0; + i76 = HEAP32[i52 >> 2] | 0; + do { + if ((i149 | 0) == (i76 | 0)) { + i115 = (i149 | 0) == 0 ? 1 : i149 << 1; + if ((i149 | 0) >= (i115 | 0)) { + i245 = i149; + i246 = i149; + break; + } + if ((i115 | 0) == 0) { + i247 = 0; + i248 = i149; + } else { + i130 = __Z22btAlignedAllocInternalji(i115 << 2, 16) | 0; + i247 = i130; + i248 = HEAP32[i53 >> 2] | 0; + } + if ((i248 | 0) > 0) { + i130 = 0; + do { + i75 = i247 + (i130 << 2) | 0; + if ((i75 | 0) != 0) { + HEAP32[i75 >> 2] = HEAP32[(HEAP32[i32 >> 2] | 0) + (i130 << 2) >> 2]; + } + i130 = i130 + 1 | 0; + } while ((i130 | 0) < (i248 | 0)); + } + i130 = HEAP32[i32 >> 2] | 0; + if ((i130 | 0) == 0) { + i249 = i248; + } else { + if ((HEAP8[i54] | 0) == 0) { + i250 = i248; + } else { + __Z21btAlignedFreeInternalPv(i130); + i250 = HEAP32[i53 >> 2] | 0; + } + HEAP32[i32 >> 2] = 0; + i249 = i250; + } + HEAP8[i54] = 1; + HEAP32[i32 >> 2] = i247; + HEAP32[i52 >> 2] = i115; + i245 = i249; + i246 = i115; + } else { + i245 = i149; + i246 = i76; + } + } while (0); + i76 = (HEAP32[i32 >> 2] | 0) + (i245 << 2) | 0; + if ((i76 | 0) != 0) { + HEAP32[i76 >> 2] = i87; + } + i76 = i245 + 1 | 0; + HEAP32[i53 >> 2] = i76; + i149 = HEAP32[i80 >> 2] | 0; + if ((i149 | 0) == (HEAP32[i58 >> 2] | 0)) { + i243 = i76; + i244 = i246; + break; + } else { + i66 = i149; + } + } + } + do { + if ((i243 | 0) == (i244 | 0)) { + i66 = (i244 | 0) == 0 ? 1 : i244 << 1; + if ((i244 | 0) >= (i66 | 0)) { + i251 = i244; + break; + } + if ((i66 | 0) == 0) { + i252 = 0; + i253 = i244; + } else { + i58 = __Z22btAlignedAllocInternalji(i66 << 2, 16) | 0; + i252 = i58; + i253 = HEAP32[i53 >> 2] | 0; + } + if ((i253 | 0) > 0) { + i58 = 0; + do { + i80 = i252 + (i58 << 2) | 0; + if ((i80 | 0) != 0) { + HEAP32[i80 >> 2] = HEAP32[(HEAP32[i32 >> 2] | 0) + (i58 << 2) >> 2]; + } + i58 = i58 + 1 | 0; + } while ((i58 | 0) < (i253 | 0)); + } + i58 = HEAP32[i32 >> 2] | 0; + if ((i58 | 0) == 0) { + i254 = i253; + } else { + if ((HEAP8[i54] | 0) == 0) { + i255 = i253; + } else { + __Z21btAlignedFreeInternalPv(i58); + i255 = HEAP32[i53 >> 2] | 0; + } + HEAP32[i32 >> 2] = 0; + i254 = i255; + } + HEAP8[i54] = 1; + HEAP32[i32 >> 2] = i252; + HEAP32[i52 >> 2] = i66; + i251 = i254; + } else { + i251 = i243; + } + } while (0); + i58 = (HEAP32[i32 >> 2] | 0) + (i251 << 2) | 0; + if ((i58 | 0) != 0) { + HEAP32[i58 >> 2] = 0; + } + HEAP32[i53 >> 2] = i251 + 1; + } + } while (0); + HEAP32[i235 + 16 >> 2] = i2; + HEAP32[(HEAP32[i235 + 8 >> 2] | 0) + 16 >> 2] = HEAP32[i59 + 16 >> 2]; + i44 = i59; + i50 = i65; + i51 = i63; + i55 = i235; + i56 = (i56 | 0) == 0 ? i235 : i56; + } + if ((i49 | 0) == 1618) { + STACKTOP = i5; + return i20 | 0; + } + do { + if ((i50 | 0) > 0) { + HEAP32[(HEAP32[i56 + 8 >> 2] | 0) + 12 >> 2] = HEAP32[i55 + 12 >> 2]; + i235 = HEAP32[i51 + 8 >> 2] | 0; + HEAP32[i235 >> 2] = i56; + HEAP32[i56 + 4 >> 2] = i235; + i235 = HEAP32[i55 + 8 >> 2] | 0; + HEAP32[i56 >> 2] = i235; + HEAP32[i235 + 4 >> 2] = i56; + } else { + i235 = i55 + 8 | 0; + if ((i56 | 0) == (HEAP32[i235 >> 2] | 0)) { + break; + } + i63 = i55 + 12 | 0; + i65 = HEAP32[i53 >> 2] | 0; + i44 = HEAP32[i52 >> 2] | 0; + do { + if ((i65 | 0) == (i44 | 0)) { + i251 = (i65 | 0) == 0 ? 1 : i65 << 1; + if ((i65 | 0) >= (i251 | 0)) { + i256 = i65; + i257 = i65; + break; + } + if ((i251 | 0) == 0) { + i258 = 0; + i259 = i65; + } else { + i243 = __Z22btAlignedAllocInternalji(i251 << 2, 16) | 0; + i258 = i243; + i259 = HEAP32[i53 >> 2] | 0; + } + if ((i259 | 0) > 0) { + i243 = 0; + do { + i254 = i258 + (i243 << 2) | 0; + if ((i254 | 0) != 0) { + HEAP32[i254 >> 2] = HEAP32[(HEAP32[i32 >> 2] | 0) + (i243 << 2) >> 2]; + } + i243 = i243 + 1 | 0; + } while ((i243 | 0) < (i259 | 0)); + } + i243 = HEAP32[i32 >> 2] | 0; + if ((i243 | 0) == 0) { + i260 = i259; + } else { + if ((HEAP8[i54] | 0) == 0) { + i261 = i259; + } else { + __Z21btAlignedFreeInternalPv(i243); + i261 = HEAP32[i53 >> 2] | 0; + } + HEAP32[i32 >> 2] = 0; + i260 = i261; + } + HEAP8[i54] = 1; + HEAP32[i32 >> 2] = i258; + HEAP32[i52 >> 2] = i251; + i256 = i260; + i257 = i251; + } else { + i256 = i65; + i257 = i44; + } + } while (0); + i44 = (HEAP32[i32 >> 2] | 0) + (i256 << 2) | 0; + if ((i44 | 0) != 0) { + HEAP32[i44 >> 2] = HEAP32[i63 >> 2]; + } + i44 = i256 + 1 | 0; + HEAP32[i53 >> 2] = i44; + i65 = i56 | 0; + i59 = HEAP32[i65 >> 2] | 0; + if ((i59 | 0) == (HEAP32[i235 >> 2] | 0)) { + i262 = i44; + i263 = i257; + } else { + i44 = i59; + while (1) { + i59 = i44 + 12 | 0; + i243 = HEAP32[i59 >> 2] | 0; + i254 = i44 | 0; + i252 = HEAP32[i254 >> 2] | 0; + i255 = HEAP32[i44 + 8 >> 2] | 0; + if ((i252 | 0) == (i44 | 0)) { + HEAP32[(HEAP32[i255 + 12 >> 2] | 0) + 8 >> 2] = 0; + } else { + i253 = i44 + 4 | 0; + HEAP32[i252 + 4 >> 2] = HEAP32[i253 >> 2]; + HEAP32[HEAP32[i253 >> 2] >> 2] = i252; + HEAP32[(HEAP32[i255 + 12 >> 2] | 0) + 8 >> 2] = i252; + } + i252 = i255 | 0; + i253 = HEAP32[i252 >> 2] | 0; + if ((i253 | 0) == (i255 | 0)) { + HEAP32[(HEAP32[i59 >> 2] | 0) + 8 >> 2] = 0; + } else { + i244 = i255 + 4 | 0; + HEAP32[i253 + 4 >> 2] = HEAP32[i244 >> 2]; + HEAP32[HEAP32[i244 >> 2] >> 2] = i253; + HEAP32[(HEAP32[i59 >> 2] | 0) + 8 >> 2] = i253; + } + _memset(i44 | 0, 0, 20); + HEAP32[i254 >> 2] = HEAP32[i4 >> 2]; + HEAP32[i4 >> 2] = i44; + _memset(i255 | 0, 0, 20); + HEAP32[i252 >> 2] = HEAP32[i4 >> 2]; + HEAP32[i4 >> 2] = i255; + HEAP32[i30 >> 2] = (HEAP32[i30 >> 2] | 0) - 1; + i255 = HEAP32[i53 >> 2] | 0; + i252 = HEAP32[i52 >> 2] | 0; + do { + if ((i255 | 0) == (i252 | 0)) { + i254 = (i255 | 0) == 0 ? 1 : i255 << 1; + if ((i255 | 0) >= (i254 | 0)) { + i264 = i255; + i265 = i255; + break; + } + if ((i254 | 0) == 0) { + i266 = 0; + i267 = i255; + } else { + i253 = __Z22btAlignedAllocInternalji(i254 << 2, 16) | 0; + i266 = i253; + i267 = HEAP32[i53 >> 2] | 0; + } + if ((i267 | 0) > 0) { + i253 = 0; + do { + i59 = i266 + (i253 << 2) | 0; + if ((i59 | 0) != 0) { + HEAP32[i59 >> 2] = HEAP32[(HEAP32[i32 >> 2] | 0) + (i253 << 2) >> 2]; + } + i253 = i253 + 1 | 0; + } while ((i253 | 0) < (i267 | 0)); + } + i253 = HEAP32[i32 >> 2] | 0; + if ((i253 | 0) == 0) { + i268 = i267; + } else { + if ((HEAP8[i54] | 0) == 0) { + i269 = i267; + } else { + __Z21btAlignedFreeInternalPv(i253); + i269 = HEAP32[i53 >> 2] | 0; + } + HEAP32[i32 >> 2] = 0; + i268 = i269; + } + HEAP8[i54] = 1; + HEAP32[i32 >> 2] = i266; + HEAP32[i52 >> 2] = i254; + i264 = i268; + i265 = i254; + } else { + i264 = i255; + i265 = i252; + } + } while (0); + i252 = (HEAP32[i32 >> 2] | 0) + (i264 << 2) | 0; + if ((i252 | 0) != 0) { + HEAP32[i252 >> 2] = i243; + } + i252 = i264 + 1 | 0; + HEAP32[i53 >> 2] = i252; + i255 = HEAP32[i65 >> 2] | 0; + if ((i255 | 0) == (HEAP32[i235 >> 2] | 0)) { + i262 = i252; + i263 = i265; + break; + } else { + i44 = i255; + } + } + } + do { + if ((i262 | 0) == (i263 | 0)) { + i44 = (i263 | 0) == 0 ? 1 : i263 << 1; + if ((i263 | 0) >= (i44 | 0)) { + i270 = i263; + break; + } + if ((i44 | 0) == 0) { + i271 = 0; + i272 = i263; + } else { + i235 = __Z22btAlignedAllocInternalji(i44 << 2, 16) | 0; + i271 = i235; + i272 = HEAP32[i53 >> 2] | 0; + } + if ((i272 | 0) > 0) { + i235 = 0; + do { + i65 = i271 + (i235 << 2) | 0; + if ((i65 | 0) != 0) { + HEAP32[i65 >> 2] = HEAP32[(HEAP32[i32 >> 2] | 0) + (i235 << 2) >> 2]; + } + i235 = i235 + 1 | 0; + } while ((i235 | 0) < (i272 | 0)); + } + i235 = HEAP32[i32 >> 2] | 0; + if ((i235 | 0) == 0) { + i273 = i272; + } else { + if ((HEAP8[i54] | 0) == 0) { + i274 = i272; + } else { + __Z21btAlignedFreeInternalPv(i235); + i274 = HEAP32[i53 >> 2] | 0; + } + HEAP32[i32 >> 2] = 0; + i273 = i274; + } + HEAP8[i54] = 1; + HEAP32[i32 >> 2] = i271; + HEAP32[i52 >> 2] = i44; + i270 = i273; + } else { + i270 = i262; + } + } while (0); + i235 = (HEAP32[i32 >> 2] | 0) + (i270 << 2) | 0; + if ((i235 | 0) != 0) { + HEAP32[i235 >> 2] = 0; + } + HEAP32[i53 >> 2] = i270 + 1; + } + } while (0); + HEAP32[i1 + 124 >> 2] = HEAP32[HEAP32[i32 >> 2] >> 2]; + i1 = HEAP32[i53 >> 2] | 0; + if ((i1 | 0) > 0) { + i270 = 0; + i262 = i1; + while (1) { + if ((i270 | 0) < (i262 | 0)) { + i273 = i270; + while (1) { + i271 = HEAP32[i32 >> 2] | 0; + i274 = HEAP32[i271 + (i273 << 2) >> 2] | 0; + i272 = i273 + 2 | 0; + i263 = HEAP32[i271 + (i273 + 1 << 2) >> 2] | 0; + do { + if ((i263 | 0) == 0) { + i275 = i272; + } else { + i271 = i274 + 16 | 0; + i265 = i274 + 12 | 0; + i264 = 0; + i268 = i272; + i266 = i263; + while (1) { + i269 = HEAP32[i271 >> 2] | 0; + i267 = i266 + 12 | 0; + i257 = HEAP32[i267 >> 2] | 0; + if ((i269 | 0) == 0) { + HEAP32[i265 >> 2] = i257; + } else { + HEAP32[i269 + 8 >> 2] = i257; + } + i257 = i266 + 16 | 0; + i269 = HEAP32[i257 >> 2] | 0; + if ((i269 | 0) != 0) { + HEAP32[i271 >> 2] = i269; + } + i269 = HEAP32[i267 >> 2] | 0; + if ((i269 | 0) != 0) { + i56 = i269; + do { + HEAP32[i56 + 4 >> 2] = i274; + i56 = HEAP32[i56 + 8 >> 2] | 0; + } while ((i56 | 0) != 0); + } + HEAP32[i267 >> 2] = 0; + HEAP32[i257 >> 2] = 0; + i56 = i266 + 8 | 0; + i115 = HEAP32[i56 >> 2] | 0; + if ((i115 | 0) == 0) { + i276 = i264; + } else { + i269 = i264; + i256 = i115; + while (1) { + i115 = HEAP32[i53 >> 2] | 0; + i260 = HEAP32[i52 >> 2] | 0; + if (i269) { + i277 = i256; + i278 = i115; + i279 = i260; + } else { + do { + if ((i115 | 0) == (i260 | 0)) { + i258 = (i115 | 0) == 0 ? 1 : i115 << 1; + if ((i115 | 0) >= (i258 | 0)) { + i280 = i115; + i281 = i115; + break; + } + if ((i258 | 0) == 0) { + i282 = 0; + i283 = i115; + } else { + i261 = __Z22btAlignedAllocInternalji(i258 << 2, 16) | 0; + i282 = i261; + i283 = HEAP32[i53 >> 2] | 0; + } + if ((i283 | 0) > 0) { + i261 = 0; + do { + i259 = i282 + (i261 << 2) | 0; + if ((i259 | 0) != 0) { + HEAP32[i259 >> 2] = HEAP32[(HEAP32[i32 >> 2] | 0) + (i261 << 2) >> 2]; + } + i261 = i261 + 1 | 0; + } while ((i261 | 0) < (i283 | 0)); + } + i261 = HEAP32[i32 >> 2] | 0; + if ((i261 | 0) == 0) { + i284 = i283; + } else { + if ((HEAP8[i54] | 0) == 0) { + i285 = i283; + } else { + __Z21btAlignedFreeInternalPv(i261); + i285 = HEAP32[i53 >> 2] | 0; + } + HEAP32[i32 >> 2] = 0; + i284 = i285; + } + HEAP8[i54] = 1; + HEAP32[i32 >> 2] = i282; + HEAP32[i52 >> 2] = i258; + i280 = i284; + i281 = i258; + } else { + i280 = i115; + i281 = i260; + } + } while (0); + i260 = (HEAP32[i32 >> 2] | 0) + (i280 << 2) | 0; + if ((i260 | 0) != 0) { + HEAP32[i260 >> 2] = i274; + } + i260 = i280 + 1 | 0; + HEAP32[i53 >> 2] = i260; + i277 = HEAP32[i56 >> 2] | 0; + i278 = i260; + i279 = i281; + } + i260 = i277 + 12 | 0; + do { + if ((i278 | 0) == (i279 | 0)) { + i115 = (i279 | 0) == 0 ? 1 : i279 << 1; + if ((i279 | 0) >= (i115 | 0)) { + i286 = i279; + break; + } + if ((i115 | 0) == 0) { + i287 = 0; + i288 = i279; + } else { + i261 = __Z22btAlignedAllocInternalji(i115 << 2, 16) | 0; + i287 = i261; + i288 = HEAP32[i53 >> 2] | 0; + } + if ((i288 | 0) > 0) { + i261 = 0; + do { + i259 = i287 + (i261 << 2) | 0; + if ((i259 | 0) != 0) { + HEAP32[i259 >> 2] = HEAP32[(HEAP32[i32 >> 2] | 0) + (i261 << 2) >> 2]; + } + i261 = i261 + 1 | 0; + } while ((i261 | 0) < (i288 | 0)); + } + i261 = HEAP32[i32 >> 2] | 0; + if ((i261 | 0) == 0) { + i289 = i288; + } else { + if ((HEAP8[i54] | 0) == 0) { + i290 = i288; + } else { + __Z21btAlignedFreeInternalPv(i261); + i290 = HEAP32[i53 >> 2] | 0; + } + HEAP32[i32 >> 2] = 0; + i289 = i290; + } + HEAP8[i54] = 1; + HEAP32[i32 >> 2] = i287; + HEAP32[i52 >> 2] = i115; + i286 = i289; + } else { + i286 = i278; + } + } while (0); + i261 = (HEAP32[i32 >> 2] | 0) + (i286 << 2) | 0; + if ((i261 | 0) != 0) { + HEAP32[i261 >> 2] = HEAP32[i260 >> 2]; + } + HEAP32[i53 >> 2] = i286 + 1; + i261 = HEAP32[i56 >> 2] | 0; + i258 = i261 | 0; + i259 = HEAP32[i258 >> 2] | 0; + i55 = HEAP32[i261 + 8 >> 2] | 0; + if ((i259 | 0) == (i261 | 0)) { + HEAP32[(HEAP32[i55 + 12 >> 2] | 0) + 8 >> 2] = 0; + } else { + i51 = i261 + 4 | 0; + HEAP32[i259 + 4 >> 2] = HEAP32[i51 >> 2]; + HEAP32[HEAP32[i51 >> 2] >> 2] = i259; + HEAP32[(HEAP32[i55 + 12 >> 2] | 0) + 8 >> 2] = i259; + } + i259 = i55 | 0; + i51 = HEAP32[i259 >> 2] | 0; + if ((i51 | 0) == (i55 | 0)) { + HEAP32[(HEAP32[i261 + 12 >> 2] | 0) + 8 >> 2] = 0; + } else { + i50 = i55 + 4 | 0; + HEAP32[i51 + 4 >> 2] = HEAP32[i50 >> 2]; + HEAP32[HEAP32[i50 >> 2] >> 2] = i51; + HEAP32[(HEAP32[i261 + 12 >> 2] | 0) + 8 >> 2] = i51; + } + _memset(i261 | 0, 0, 20); + HEAP32[i258 >> 2] = HEAP32[i4 >> 2]; + HEAP32[i4 >> 2] = i261; + _memset(i55 | 0, 0, 20); + HEAP32[i259 >> 2] = HEAP32[i4 >> 2]; + HEAP32[i4 >> 2] = i55; + HEAP32[i30 >> 2] = (HEAP32[i30 >> 2] | 0) - 1; + i55 = HEAP32[i56 >> 2] | 0; + if ((i55 | 0) == 0) { + i276 = 1; + break; + } else { + i269 = 1; + i256 = i55; + } + } + } + i291 = i268 + 1 | 0; + i292 = HEAP32[i32 >> 2] | 0; + i256 = HEAP32[i292 + (i268 << 2) >> 2] | 0; + if ((i256 | 0) == 0) { + break; + } else { + i264 = i276; + i268 = i291; + i266 = i256; + } + } + if (!i276) { + i275 = i291; + break; + } + i266 = HEAP32[i53 >> 2] | 0; + do { + if ((i266 | 0) == (HEAP32[i52 >> 2] | 0)) { + i268 = (i266 | 0) == 0 ? 1 : i266 << 1; + if ((i266 | 0) >= (i268 | 0)) { + i293 = i266; + i294 = i292; + break; + } + if ((i268 | 0) == 0) { + i295 = 0; + i296 = i266; + } else { + i264 = __Z22btAlignedAllocInternalji(i268 << 2, 16) | 0; + i295 = i264; + i296 = HEAP32[i53 >> 2] | 0; + } + if ((i296 | 0) > 0) { + i264 = 0; + do { + i271 = i295 + (i264 << 2) | 0; + if ((i271 | 0) != 0) { + HEAP32[i271 >> 2] = HEAP32[(HEAP32[i32 >> 2] | 0) + (i264 << 2) >> 2]; + } + i264 = i264 + 1 | 0; + } while ((i264 | 0) < (i296 | 0)); + } + i264 = HEAP32[i32 >> 2] | 0; + if ((i264 | 0) == 0) { + i297 = i296; + } else { + if ((HEAP8[i54] | 0) == 0) { + i298 = i296; + } else { + __Z21btAlignedFreeInternalPv(i264); + i298 = HEAP32[i53 >> 2] | 0; + } + HEAP32[i32 >> 2] = 0; + i297 = i298; + } + HEAP8[i54] = 1; + HEAP32[i32 >> 2] = i295; + HEAP32[i52 >> 2] = i268; + i293 = i297; + i294 = i295; + } else { + i293 = i266; + i294 = i292; + } + } while (0); + i266 = i294 + (i293 << 2) | 0; + if ((i266 | 0) != 0) { + HEAP32[i266 >> 2] = 0; + } + HEAP32[i53 >> 2] = i293 + 1; + i275 = i291; + } + } while (0); + if ((i275 | 0) < (i262 | 0)) { + i273 = i275; + } else { + break; + } + } + i299 = i275; + i300 = HEAP32[i53 >> 2] | 0; + } else { + i299 = i270; + i300 = i262; + } + if ((i299 | 0) < (i300 | 0)) { + i270 = i299; + i262 = i300; + } else { + break; + } + } + if ((i300 | 0) <= 0) { + i301 = i300; + i49 = 1599; + } + } else { + i301 = i1; + i49 = 1599; + } + do { + if ((i49 | 0) == 1599) { + if ((i301 | 0) >= 0) { + break; + } + if ((HEAP32[i52 >> 2] | 0) < 0) { + i1 = HEAP32[i32 >> 2] | 0; + if ((i1 | 0) != 0) { + if ((HEAP8[i54] | 0) != 0) { + __Z21btAlignedFreeInternalPv(i1); + } + HEAP32[i32 >> 2] = 0; + } + HEAP8[i54] = 1; + HEAP32[i32 >> 2] = 0; + HEAP32[i52 >> 2] = 0; + i302 = i301; + } else { + i302 = i301; + } + do { + i1 = (HEAP32[i32 >> 2] | 0) + (i302 << 2) | 0; + if ((i1 | 0) != 0) { + HEAP32[i1 >> 2] = 0; + } + i302 = i302 + 1 | 0; + } while ((i302 | 0) < 0); + } + } while (0); + HEAP32[i53 >> 2] = 0; + HEAP32[i28 >> 2] = i35; + HEAP32[i36 >> 2] = i19; + HEAP32[i33 >> 2] = i18; + HEAP32[i2 + 24 >> 2] = -1; + i20 = 1; + STACKTOP = i5; + return i20 | 0; +} +function _malloc(i1) { + i1 = i1 | 0; + var i2 = 0, i3 = 0, i4 = 0, i5 = 0, i6 = 0, i7 = 0, i8 = 0, i9 = 0, i10 = 0, i11 = 0, i12 = 0, i13 = 0, i14 = 0, i15 = 0, i16 = 0, i17 = 0, i18 = 0, i19 = 0, i20 = 0, i21 = 0, i22 = 0, i23 = 0, i24 = 0, i25 = 0, i26 = 0, i27 = 0, i28 = 0, i29 = 0, i30 = 0, i31 = 0, i32 = 0, i33 = 0, i34 = 0, i35 = 0, i36 = 0, i37 = 0, i38 = 0, i39 = 0, i40 = 0, i41 = 0, i42 = 0, i43 = 0, i44 = 0, i45 = 0, i46 = 0, i47 = 0, i48 = 0, i49 = 0, i50 = 0, i51 = 0, i52 = 0, i53 = 0, i54 = 0, i55 = 0, i56 = 0, i57 = 0, i58 = 0, i59 = 0, i60 = 0, i61 = 0, i62 = 0, i63 = 0, i64 = 0, i65 = 0, i66 = 0, i67 = 0, i68 = 0, i69 = 0, i70 = 0, i71 = 0, i72 = 0, i73 = 0, i74 = 0, i75 = 0, i76 = 0, i77 = 0, i78 = 0, i79 = 0, i80 = 0, i81 = 0, i82 = 0, i83 = 0, i84 = 0, i85 = 0, i86 = 0; + do { + if (i1 >>> 0 < 245) { + if (i1 >>> 0 < 11) { + i2 = 16; + } else { + i2 = i1 + 11 & -8; + } + i3 = i2 >>> 3; + i4 = HEAP32[3016] | 0; + i5 = i4 >>> (i3 >>> 0); + if ((i5 & 3 | 0) != 0) { + i6 = (i5 & 1 ^ 1) + i3 | 0; + i7 = i6 << 1; + i8 = 12104 + (i7 << 2) | 0; + i9 = 12104 + (i7 + 2 << 2) | 0; + i7 = HEAP32[i9 >> 2] | 0; + i10 = i7 + 8 | 0; + i11 = HEAP32[i10 >> 2] | 0; + do { + if ((i8 | 0) == (i11 | 0)) { + HEAP32[3016] = i4 & ~(1 << i6); + } else { + if (i11 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } + i12 = i11 + 12 | 0; + if ((HEAP32[i12 >> 2] | 0) == (i7 | 0)) { + HEAP32[i12 >> 2] = i8; + HEAP32[i9 >> 2] = i11; + break; + } else { + _abort(); + return 0; + } + } + } while (0); + i11 = i6 << 3; + HEAP32[i7 + 4 >> 2] = i11 | 3; + i9 = i7 + (i11 | 4) | 0; + HEAP32[i9 >> 2] = HEAP32[i9 >> 2] | 1; + i13 = i10; + return i13 | 0; + } + if (i2 >>> 0 <= (HEAP32[3018] | 0) >>> 0) { + i14 = i2; + break; + } + if ((i5 | 0) != 0) { + i9 = 2 << i3; + i11 = i5 << i3 & (i9 | -i9); + i9 = (i11 & -i11) - 1 | 0; + i11 = i9 >>> 12 & 16; + i8 = i9 >>> (i11 >>> 0); + i9 = i8 >>> 5 & 8; + i12 = i8 >>> (i9 >>> 0); + i8 = i12 >>> 2 & 4; + i15 = i12 >>> (i8 >>> 0); + i12 = i15 >>> 1 & 2; + i16 = i15 >>> (i12 >>> 0); + i15 = i16 >>> 1 & 1; + i17 = (i9 | i11 | i8 | i12 | i15) + (i16 >>> (i15 >>> 0)) | 0; + i15 = i17 << 1; + i16 = 12104 + (i15 << 2) | 0; + i12 = 12104 + (i15 + 2 << 2) | 0; + i15 = HEAP32[i12 >> 2] | 0; + i8 = i15 + 8 | 0; + i11 = HEAP32[i8 >> 2] | 0; + do { + if ((i16 | 0) == (i11 | 0)) { + HEAP32[3016] = i4 & ~(1 << i17); + } else { + if (i11 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } + i9 = i11 + 12 | 0; + if ((HEAP32[i9 >> 2] | 0) == (i15 | 0)) { + HEAP32[i9 >> 2] = i16; + HEAP32[i12 >> 2] = i11; + break; + } else { + _abort(); + return 0; + } + } + } while (0); + i11 = i17 << 3; + i12 = i11 - i2 | 0; + HEAP32[i15 + 4 >> 2] = i2 | 3; + i16 = i15; + i4 = i16 + i2 | 0; + HEAP32[i16 + (i2 | 4) >> 2] = i12 | 1; + HEAP32[i16 + i11 >> 2] = i12; + i11 = HEAP32[3018] | 0; + if ((i11 | 0) != 0) { + i16 = HEAP32[3021] | 0; + i3 = i11 >>> 3; + i11 = i3 << 1; + i5 = 12104 + (i11 << 2) | 0; + i10 = HEAP32[3016] | 0; + i7 = 1 << i3; + do { + if ((i10 & i7 | 0) == 0) { + HEAP32[3016] = i10 | i7; + i18 = i5; + i19 = 12104 + (i11 + 2 << 2) | 0; + } else { + i3 = 12104 + (i11 + 2 << 2) | 0; + i6 = HEAP32[i3 >> 2] | 0; + if (i6 >>> 0 >= (HEAP32[3020] | 0) >>> 0) { + i18 = i6; + i19 = i3; + break; + } + _abort(); + return 0; + } + } while (0); + HEAP32[i19 >> 2] = i16; + HEAP32[i18 + 12 >> 2] = i16; + HEAP32[i16 + 8 >> 2] = i18; + HEAP32[i16 + 12 >> 2] = i5; + } + HEAP32[3018] = i12; + HEAP32[3021] = i4; + i13 = i8; + return i13 | 0; + } + i11 = HEAP32[3017] | 0; + if ((i11 | 0) == 0) { + i14 = i2; + break; + } + i7 = (i11 & -i11) - 1 | 0; + i11 = i7 >>> 12 & 16; + i10 = i7 >>> (i11 >>> 0); + i7 = i10 >>> 5 & 8; + i15 = i10 >>> (i7 >>> 0); + i10 = i15 >>> 2 & 4; + i17 = i15 >>> (i10 >>> 0); + i15 = i17 >>> 1 & 2; + i3 = i17 >>> (i15 >>> 0); + i17 = i3 >>> 1 & 1; + i6 = HEAP32[12368 + ((i7 | i11 | i10 | i15 | i17) + (i3 >>> (i17 >>> 0)) << 2) >> 2] | 0; + i17 = i6; + i3 = i6; + i15 = (HEAP32[i6 + 4 >> 2] & -8) - i2 | 0; + while (1) { + i6 = HEAP32[i17 + 16 >> 2] | 0; + if ((i6 | 0) == 0) { + i10 = HEAP32[i17 + 20 >> 2] | 0; + if ((i10 | 0) == 0) { + break; + } else { + i20 = i10; + } + } else { + i20 = i6; + } + i6 = (HEAP32[i20 + 4 >> 2] & -8) - i2 | 0; + i10 = i6 >>> 0 < i15 >>> 0; + i17 = i20; + i3 = i10 ? i20 : i3; + i15 = i10 ? i6 : i15; + } + i17 = i3; + i8 = HEAP32[3020] | 0; + if (i17 >>> 0 < i8 >>> 0) { + _abort(); + return 0; + } + i4 = i17 + i2 | 0; + i12 = i4; + if (i17 >>> 0 >= i4 >>> 0) { + _abort(); + return 0; + } + i4 = HEAP32[i3 + 24 >> 2] | 0; + i5 = HEAP32[i3 + 12 >> 2] | 0; + do { + if ((i5 | 0) == (i3 | 0)) { + i16 = i3 + 20 | 0; + i6 = HEAP32[i16 >> 2] | 0; + if ((i6 | 0) == 0) { + i10 = i3 + 16 | 0; + i11 = HEAP32[i10 >> 2] | 0; + if ((i11 | 0) == 0) { + i21 = 0; + break; + } else { + i22 = i11; + i23 = i10; + } + } else { + i22 = i6; + i23 = i16; + } + while (1) { + i16 = i22 + 20 | 0; + i6 = HEAP32[i16 >> 2] | 0; + if ((i6 | 0) != 0) { + i22 = i6; + i23 = i16; + continue; + } + i16 = i22 + 16 | 0; + i6 = HEAP32[i16 >> 2] | 0; + if ((i6 | 0) == 0) { + break; + } else { + i22 = i6; + i23 = i16; + } + } + if (i23 >>> 0 < i8 >>> 0) { + _abort(); + return 0; + } else { + HEAP32[i23 >> 2] = 0; + i21 = i22; + break; + } + } else { + i16 = HEAP32[i3 + 8 >> 2] | 0; + if (i16 >>> 0 < i8 >>> 0) { + _abort(); + return 0; + } + i6 = i16 + 12 | 0; + if ((HEAP32[i6 >> 2] | 0) != (i3 | 0)) { + _abort(); + return 0; + } + i10 = i5 + 8 | 0; + if ((HEAP32[i10 >> 2] | 0) == (i3 | 0)) { + HEAP32[i6 >> 2] = i5; + HEAP32[i10 >> 2] = i16; + i21 = i5; + break; + } else { + _abort(); + return 0; + } + } + } while (0); + L78 : do { + if ((i4 | 0) != 0) { + i5 = i3 + 28 | 0; + i8 = 12368 + (HEAP32[i5 >> 2] << 2) | 0; + do { + if ((i3 | 0) == (HEAP32[i8 >> 2] | 0)) { + HEAP32[i8 >> 2] = i21; + if ((i21 | 0) != 0) { + break; + } + HEAP32[3017] = HEAP32[3017] & ~(1 << HEAP32[i5 >> 2]); + break L78; + } else { + if (i4 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } + i16 = i4 + 16 | 0; + if ((HEAP32[i16 >> 2] | 0) == (i3 | 0)) { + HEAP32[i16 >> 2] = i21; + } else { + HEAP32[i4 + 20 >> 2] = i21; + } + if ((i21 | 0) == 0) { + break L78; + } + } + } while (0); + if (i21 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } + HEAP32[i21 + 24 >> 2] = i4; + i5 = HEAP32[i3 + 16 >> 2] | 0; + do { + if ((i5 | 0) != 0) { + if (i5 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } else { + HEAP32[i21 + 16 >> 2] = i5; + HEAP32[i5 + 24 >> 2] = i21; + break; + } + } + } while (0); + i5 = HEAP32[i3 + 20 >> 2] | 0; + if ((i5 | 0) == 0) { + break; + } + if (i5 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } else { + HEAP32[i21 + 20 >> 2] = i5; + HEAP32[i5 + 24 >> 2] = i21; + break; + } + } + } while (0); + if (i15 >>> 0 < 16) { + i4 = i15 + i2 | 0; + HEAP32[i3 + 4 >> 2] = i4 | 3; + i5 = i17 + (i4 + 4) | 0; + HEAP32[i5 >> 2] = HEAP32[i5 >> 2] | 1; + } else { + HEAP32[i3 + 4 >> 2] = i2 | 3; + HEAP32[i17 + (i2 | 4) >> 2] = i15 | 1; + HEAP32[i17 + (i15 + i2) >> 2] = i15; + i5 = HEAP32[3018] | 0; + if ((i5 | 0) != 0) { + i4 = HEAP32[3021] | 0; + i8 = i5 >>> 3; + i5 = i8 << 1; + i16 = 12104 + (i5 << 2) | 0; + i10 = HEAP32[3016] | 0; + i6 = 1 << i8; + do { + if ((i10 & i6 | 0) == 0) { + HEAP32[3016] = i10 | i6; + i24 = i16; + i25 = 12104 + (i5 + 2 << 2) | 0; + } else { + i8 = 12104 + (i5 + 2 << 2) | 0; + i11 = HEAP32[i8 >> 2] | 0; + if (i11 >>> 0 >= (HEAP32[3020] | 0) >>> 0) { + i24 = i11; + i25 = i8; + break; + } + _abort(); + return 0; + } + } while (0); + HEAP32[i25 >> 2] = i4; + HEAP32[i24 + 12 >> 2] = i4; + HEAP32[i4 + 8 >> 2] = i24; + HEAP32[i4 + 12 >> 2] = i16; + } + HEAP32[3018] = i15; + HEAP32[3021] = i12; + } + i5 = i3 + 8 | 0; + if ((i5 | 0) == 0) { + i14 = i2; + break; + } else { + i13 = i5; + } + return i13 | 0; + } else { + if (i1 >>> 0 > 4294967231) { + i14 = -1; + break; + } + i5 = i1 + 11 | 0; + i6 = i5 & -8; + i10 = HEAP32[3017] | 0; + if ((i10 | 0) == 0) { + i14 = i6; + break; + } + i17 = -i6 | 0; + i8 = i5 >>> 8; + do { + if ((i8 | 0) == 0) { + i26 = 0; + } else { + if (i6 >>> 0 > 16777215) { + i26 = 31; + break; + } + i5 = (i8 + 1048320 | 0) >>> 16 & 8; + i11 = i8 << i5; + i7 = (i11 + 520192 | 0) >>> 16 & 4; + i9 = i11 << i7; + i11 = (i9 + 245760 | 0) >>> 16 & 2; + i27 = 14 - (i7 | i5 | i11) + (i9 << i11 >>> 15) | 0; + i26 = i6 >>> ((i27 + 7 | 0) >>> 0) & 1 | i27 << 1; + } + } while (0); + i8 = HEAP32[12368 + (i26 << 2) >> 2] | 0; + L126 : do { + if ((i8 | 0) == 0) { + i28 = 0; + i29 = i17; + i30 = 0; + } else { + if ((i26 | 0) == 31) { + i31 = 0; + } else { + i31 = 25 - (i26 >>> 1) | 0; + } + i3 = 0; + i12 = i17; + i15 = i8; + i16 = i6 << i31; + i4 = 0; + while (1) { + i27 = HEAP32[i15 + 4 >> 2] & -8; + i11 = i27 - i6 | 0; + if (i11 >>> 0 < i12 >>> 0) { + if ((i27 | 0) == (i6 | 0)) { + i28 = i15; + i29 = i11; + i30 = i15; + break L126; + } else { + i32 = i15; + i33 = i11; + } + } else { + i32 = i3; + i33 = i12; + } + i11 = HEAP32[i15 + 20 >> 2] | 0; + i27 = HEAP32[i15 + 16 + (i16 >>> 31 << 2) >> 2] | 0; + i9 = (i11 | 0) == 0 | (i11 | 0) == (i27 | 0) ? i4 : i11; + if ((i27 | 0) == 0) { + i28 = i32; + i29 = i33; + i30 = i9; + break; + } else { + i3 = i32; + i12 = i33; + i15 = i27; + i16 = i16 << 1; + i4 = i9; + } + } + } + } while (0); + if ((i30 | 0) == 0 & (i28 | 0) == 0) { + i8 = 2 << i26; + i17 = i10 & (i8 | -i8); + if ((i17 | 0) == 0) { + i14 = i6; + break; + } + i8 = (i17 & -i17) - 1 | 0; + i17 = i8 >>> 12 & 16; + i4 = i8 >>> (i17 >>> 0); + i8 = i4 >>> 5 & 8; + i16 = i4 >>> (i8 >>> 0); + i4 = i16 >>> 2 & 4; + i15 = i16 >>> (i4 >>> 0); + i16 = i15 >>> 1 & 2; + i12 = i15 >>> (i16 >>> 0); + i15 = i12 >>> 1 & 1; + i34 = HEAP32[12368 + ((i8 | i17 | i4 | i16 | i15) + (i12 >>> (i15 >>> 0)) << 2) >> 2] | 0; + } else { + i34 = i30; + } + if ((i34 | 0) == 0) { + i35 = i29; + i36 = i28; + } else { + i15 = i34; + i12 = i29; + i16 = i28; + while (1) { + i4 = (HEAP32[i15 + 4 >> 2] & -8) - i6 | 0; + i17 = i4 >>> 0 < i12 >>> 0; + i8 = i17 ? i4 : i12; + i4 = i17 ? i15 : i16; + i17 = HEAP32[i15 + 16 >> 2] | 0; + if ((i17 | 0) != 0) { + i15 = i17; + i12 = i8; + i16 = i4; + continue; + } + i17 = HEAP32[i15 + 20 >> 2] | 0; + if ((i17 | 0) == 0) { + i35 = i8; + i36 = i4; + break; + } else { + i15 = i17; + i12 = i8; + i16 = i4; + } + } + } + if ((i36 | 0) == 0) { + i14 = i6; + break; + } + if (i35 >>> 0 >= ((HEAP32[3018] | 0) - i6 | 0) >>> 0) { + i14 = i6; + break; + } + i16 = i36; + i12 = HEAP32[3020] | 0; + if (i16 >>> 0 < i12 >>> 0) { + _abort(); + return 0; + } + i15 = i16 + i6 | 0; + i10 = i15; + if (i16 >>> 0 >= i15 >>> 0) { + _abort(); + return 0; + } + i4 = HEAP32[i36 + 24 >> 2] | 0; + i8 = HEAP32[i36 + 12 >> 2] | 0; + do { + if ((i8 | 0) == (i36 | 0)) { + i17 = i36 + 20 | 0; + i3 = HEAP32[i17 >> 2] | 0; + if ((i3 | 0) == 0) { + i9 = i36 + 16 | 0; + i27 = HEAP32[i9 >> 2] | 0; + if ((i27 | 0) == 0) { + i37 = 0; + break; + } else { + i38 = i27; + i39 = i9; + } + } else { + i38 = i3; + i39 = i17; + } + while (1) { + i17 = i38 + 20 | 0; + i3 = HEAP32[i17 >> 2] | 0; + if ((i3 | 0) != 0) { + i38 = i3; + i39 = i17; + continue; + } + i17 = i38 + 16 | 0; + i3 = HEAP32[i17 >> 2] | 0; + if ((i3 | 0) == 0) { + break; + } else { + i38 = i3; + i39 = i17; + } + } + if (i39 >>> 0 < i12 >>> 0) { + _abort(); + return 0; + } else { + HEAP32[i39 >> 2] = 0; + i37 = i38; + break; + } + } else { + i17 = HEAP32[i36 + 8 >> 2] | 0; + if (i17 >>> 0 < i12 >>> 0) { + _abort(); + return 0; + } + i3 = i17 + 12 | 0; + if ((HEAP32[i3 >> 2] | 0) != (i36 | 0)) { + _abort(); + return 0; + } + i9 = i8 + 8 | 0; + if ((HEAP32[i9 >> 2] | 0) == (i36 | 0)) { + HEAP32[i3 >> 2] = i8; + HEAP32[i9 >> 2] = i17; + i37 = i8; + break; + } else { + _abort(); + return 0; + } + } + } while (0); + L176 : do { + if ((i4 | 0) != 0) { + i8 = i36 + 28 | 0; + i12 = 12368 + (HEAP32[i8 >> 2] << 2) | 0; + do { + if ((i36 | 0) == (HEAP32[i12 >> 2] | 0)) { + HEAP32[i12 >> 2] = i37; + if ((i37 | 0) != 0) { + break; + } + HEAP32[3017] = HEAP32[3017] & ~(1 << HEAP32[i8 >> 2]); + break L176; + } else { + if (i4 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } + i17 = i4 + 16 | 0; + if ((HEAP32[i17 >> 2] | 0) == (i36 | 0)) { + HEAP32[i17 >> 2] = i37; + } else { + HEAP32[i4 + 20 >> 2] = i37; + } + if ((i37 | 0) == 0) { + break L176; + } + } + } while (0); + if (i37 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } + HEAP32[i37 + 24 >> 2] = i4; + i8 = HEAP32[i36 + 16 >> 2] | 0; + do { + if ((i8 | 0) != 0) { + if (i8 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } else { + HEAP32[i37 + 16 >> 2] = i8; + HEAP32[i8 + 24 >> 2] = i37; + break; + } + } + } while (0); + i8 = HEAP32[i36 + 20 >> 2] | 0; + if ((i8 | 0) == 0) { + break; + } + if (i8 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } else { + HEAP32[i37 + 20 >> 2] = i8; + HEAP32[i8 + 24 >> 2] = i37; + break; + } + } + } while (0); + do { + if (i35 >>> 0 < 16) { + i4 = i35 + i6 | 0; + HEAP32[i36 + 4 >> 2] = i4 | 3; + i8 = i16 + (i4 + 4) | 0; + HEAP32[i8 >> 2] = HEAP32[i8 >> 2] | 1; + } else { + HEAP32[i36 + 4 >> 2] = i6 | 3; + HEAP32[i16 + (i6 | 4) >> 2] = i35 | 1; + HEAP32[i16 + (i35 + i6) >> 2] = i35; + i8 = i35 >>> 3; + if (i35 >>> 0 < 256) { + i4 = i8 << 1; + i12 = 12104 + (i4 << 2) | 0; + i17 = HEAP32[3016] | 0; + i9 = 1 << i8; + do { + if ((i17 & i9 | 0) == 0) { + HEAP32[3016] = i17 | i9; + i40 = i12; + i41 = 12104 + (i4 + 2 << 2) | 0; + } else { + i8 = 12104 + (i4 + 2 << 2) | 0; + i3 = HEAP32[i8 >> 2] | 0; + if (i3 >>> 0 >= (HEAP32[3020] | 0) >>> 0) { + i40 = i3; + i41 = i8; + break; + } + _abort(); + return 0; + } + } while (0); + HEAP32[i41 >> 2] = i10; + HEAP32[i40 + 12 >> 2] = i10; + HEAP32[i16 + (i6 + 8) >> 2] = i40; + HEAP32[i16 + (i6 + 12) >> 2] = i12; + break; + } + i4 = i15; + i9 = i35 >>> 8; + do { + if ((i9 | 0) == 0) { + i42 = 0; + } else { + if (i35 >>> 0 > 16777215) { + i42 = 31; + break; + } + i17 = (i9 + 1048320 | 0) >>> 16 & 8; + i8 = i9 << i17; + i3 = (i8 + 520192 | 0) >>> 16 & 4; + i27 = i8 << i3; + i8 = (i27 + 245760 | 0) >>> 16 & 2; + i11 = 14 - (i3 | i17 | i8) + (i27 << i8 >>> 15) | 0; + i42 = i35 >>> ((i11 + 7 | 0) >>> 0) & 1 | i11 << 1; + } + } while (0); + i9 = 12368 + (i42 << 2) | 0; + HEAP32[i16 + (i6 + 28) >> 2] = i42; + HEAP32[i16 + (i6 + 20) >> 2] = 0; + HEAP32[i16 + (i6 + 16) >> 2] = 0; + i12 = HEAP32[3017] | 0; + i11 = 1 << i42; + if ((i12 & i11 | 0) == 0) { + HEAP32[3017] = i12 | i11; + HEAP32[i9 >> 2] = i4; + HEAP32[i16 + (i6 + 24) >> 2] = i9; + HEAP32[i16 + (i6 + 12) >> 2] = i4; + HEAP32[i16 + (i6 + 8) >> 2] = i4; + break; + } + if ((i42 | 0) == 31) { + i43 = 0; + } else { + i43 = 25 - (i42 >>> 1) | 0; + } + i11 = i35 << i43; + i12 = HEAP32[i9 >> 2] | 0; + while (1) { + if ((HEAP32[i12 + 4 >> 2] & -8 | 0) == (i35 | 0)) { + break; + } + i44 = i12 + 16 + (i11 >>> 31 << 2) | 0; + i9 = HEAP32[i44 >> 2] | 0; + if ((i9 | 0) == 0) { + i45 = 151; + break; + } else { + i11 = i11 << 1; + i12 = i9; + } + } + if ((i45 | 0) == 151) { + if (i44 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } else { + HEAP32[i44 >> 2] = i4; + HEAP32[i16 + (i6 + 24) >> 2] = i12; + HEAP32[i16 + (i6 + 12) >> 2] = i4; + HEAP32[i16 + (i6 + 8) >> 2] = i4; + break; + } + } + i11 = i12 + 8 | 0; + i9 = HEAP32[i11 >> 2] | 0; + i8 = HEAP32[3020] | 0; + if (i12 >>> 0 < i8 >>> 0) { + _abort(); + return 0; + } + if (i9 >>> 0 < i8 >>> 0) { + _abort(); + return 0; + } else { + HEAP32[i9 + 12 >> 2] = i4; + HEAP32[i11 >> 2] = i4; + HEAP32[i16 + (i6 + 8) >> 2] = i9; + HEAP32[i16 + (i6 + 12) >> 2] = i12; + HEAP32[i16 + (i6 + 24) >> 2] = 0; + break; + } + } + } while (0); + i16 = i36 + 8 | 0; + if ((i16 | 0) == 0) { + i14 = i6; + break; + } else { + i13 = i16; + } + return i13 | 0; + } + } while (0); + i36 = HEAP32[3018] | 0; + if (i14 >>> 0 <= i36 >>> 0) { + i44 = i36 - i14 | 0; + i35 = HEAP32[3021] | 0; + if (i44 >>> 0 > 15) { + i43 = i35; + HEAP32[3021] = i43 + i14; + HEAP32[3018] = i44; + HEAP32[i43 + (i14 + 4) >> 2] = i44 | 1; + HEAP32[i43 + i36 >> 2] = i44; + HEAP32[i35 + 4 >> 2] = i14 | 3; + } else { + HEAP32[3018] = 0; + HEAP32[3021] = 0; + HEAP32[i35 + 4 >> 2] = i36 | 3; + i44 = i35 + (i36 + 4) | 0; + HEAP32[i44 >> 2] = HEAP32[i44 >> 2] | 1; + } + i13 = i35 + 8 | 0; + return i13 | 0; + } + i35 = HEAP32[3019] | 0; + if (i14 >>> 0 < i35 >>> 0) { + i44 = i35 - i14 | 0; + HEAP32[3019] = i44; + i35 = HEAP32[3022] | 0; + i36 = i35; + HEAP32[3022] = i36 + i14; + HEAP32[i36 + (i14 + 4) >> 2] = i44 | 1; + HEAP32[i35 + 4 >> 2] = i14 | 3; + i13 = i35 + 8 | 0; + return i13 | 0; + } + do { + if ((HEAP32[2976] | 0) == 0) { + i35 = _sysconf(8) | 0; + if ((i35 - 1 & i35 | 0) == 0) { + HEAP32[2978] = i35; + HEAP32[2977] = i35; + HEAP32[2979] = -1; + HEAP32[2980] = -1; + HEAP32[2981] = 0; + HEAP32[3127] = 0; + HEAP32[2976] = (_time(0) | 0) & -16 ^ 1431655768; + break; + } else { + _abort(); + return 0; + } + } + } while (0); + i35 = i14 + 48 | 0; + i44 = HEAP32[2978] | 0; + i36 = i14 + 47 | 0; + i43 = i44 + i36 | 0; + i42 = -i44 | 0; + i44 = i43 & i42; + if (i44 >>> 0 <= i14 >>> 0) { + i13 = 0; + return i13 | 0; + } + i40 = HEAP32[3126] | 0; + do { + if ((i40 | 0) != 0) { + i41 = HEAP32[3124] | 0; + i37 = i41 + i44 | 0; + if (i37 >>> 0 <= i41 >>> 0 | i37 >>> 0 > i40 >>> 0) { + i13 = 0; + } else { + break; + } + return i13 | 0; + } + } while (0); + L268 : do { + if ((HEAP32[3127] & 4 | 0) == 0) { + i40 = HEAP32[3022] | 0; + L270 : do { + if ((i40 | 0) == 0) { + i45 = 181; + } else { + i37 = i40; + i41 = 12512; + while (1) { + i46 = i41 | 0; + i38 = HEAP32[i46 >> 2] | 0; + if (i38 >>> 0 <= i37 >>> 0) { + i47 = i41 + 4 | 0; + if ((i38 + (HEAP32[i47 >> 2] | 0) | 0) >>> 0 > i37 >>> 0) { + break; + } + } + i38 = HEAP32[i41 + 8 >> 2] | 0; + if ((i38 | 0) == 0) { + i45 = 181; + break L270; + } else { + i41 = i38; + } + } + if ((i41 | 0) == 0) { + i45 = 181; + break; + } + i37 = i43 - (HEAP32[3019] | 0) & i42; + if (i37 >>> 0 >= 2147483647) { + i48 = 0; + break; + } + i12 = _sbrk(i37 | 0) | 0; + i4 = (i12 | 0) == ((HEAP32[i46 >> 2] | 0) + (HEAP32[i47 >> 2] | 0) | 0); + i49 = i4 ? i12 : -1; + i50 = i4 ? i37 : 0; + i51 = i12; + i52 = i37; + i45 = 190; + } + } while (0); + do { + if ((i45 | 0) == 181) { + i40 = _sbrk(0) | 0; + if ((i40 | 0) == -1) { + i48 = 0; + break; + } + i6 = i40; + i37 = HEAP32[2977] | 0; + i12 = i37 - 1 | 0; + if ((i12 & i6 | 0) == 0) { + i53 = i44; + } else { + i53 = i44 - i6 + (i12 + i6 & -i37) | 0; + } + i37 = HEAP32[3124] | 0; + i6 = i37 + i53 | 0; + if (!(i53 >>> 0 > i14 >>> 0 & i53 >>> 0 < 2147483647)) { + i48 = 0; + break; + } + i12 = HEAP32[3126] | 0; + if ((i12 | 0) != 0) { + if (i6 >>> 0 <= i37 >>> 0 | i6 >>> 0 > i12 >>> 0) { + i48 = 0; + break; + } + } + i12 = _sbrk(i53 | 0) | 0; + i6 = (i12 | 0) == (i40 | 0); + i49 = i6 ? i40 : -1; + i50 = i6 ? i53 : 0; + i51 = i12; + i52 = i53; + i45 = 190; + } + } while (0); + L290 : do { + if ((i45 | 0) == 190) { + i12 = -i52 | 0; + if ((i49 | 0) != -1) { + i54 = i50; + i55 = i49; + i45 = 201; + break L268; + } + do { + if ((i51 | 0) != -1 & i52 >>> 0 < 2147483647 & i52 >>> 0 < i35 >>> 0) { + i6 = HEAP32[2978] | 0; + i40 = i36 - i52 + i6 & -i6; + if (i40 >>> 0 >= 2147483647) { + i56 = i52; + break; + } + if ((_sbrk(i40 | 0) | 0) == -1) { + _sbrk(i12 | 0) | 0; + i48 = i50; + break L290; + } else { + i56 = i40 + i52 | 0; + break; + } + } else { + i56 = i52; + } + } while (0); + if ((i51 | 0) == -1) { + i48 = i50; + } else { + i54 = i56; + i55 = i51; + i45 = 201; + break L268; + } + } + } while (0); + HEAP32[3127] = HEAP32[3127] | 4; + i57 = i48; + i45 = 198; + } else { + i57 = 0; + i45 = 198; + } + } while (0); + do { + if ((i45 | 0) == 198) { + if (i44 >>> 0 >= 2147483647) { + break; + } + i48 = _sbrk(i44 | 0) | 0; + i51 = _sbrk(0) | 0; + if (!((i51 | 0) != -1 & (i48 | 0) != -1 & i48 >>> 0 < i51 >>> 0)) { + break; + } + i56 = i51 - i48 | 0; + i51 = i56 >>> 0 > (i14 + 40 | 0) >>> 0; + i50 = i51 ? i48 : -1; + if ((i50 | 0) != -1) { + i54 = i51 ? i56 : i57; + i55 = i50; + i45 = 201; + } + } + } while (0); + do { + if ((i45 | 0) == 201) { + i57 = (HEAP32[3124] | 0) + i54 | 0; + HEAP32[3124] = i57; + if (i57 >>> 0 > (HEAP32[3125] | 0) >>> 0) { + HEAP32[3125] = i57; + } + i57 = HEAP32[3022] | 0; + L310 : do { + if ((i57 | 0) == 0) { + i44 = HEAP32[3020] | 0; + if ((i44 | 0) == 0 | i55 >>> 0 < i44 >>> 0) { + HEAP32[3020] = i55; + } + HEAP32[3128] = i55; + HEAP32[3129] = i54; + HEAP32[3131] = 0; + HEAP32[3025] = HEAP32[2976]; + HEAP32[3024] = -1; + i44 = 0; + do { + i50 = i44 << 1; + i56 = 12104 + (i50 << 2) | 0; + HEAP32[12104 + (i50 + 3 << 2) >> 2] = i56; + HEAP32[12104 + (i50 + 2 << 2) >> 2] = i56; + i44 = i44 + 1 | 0; + } while (i44 >>> 0 < 32); + i44 = i55 + 8 | 0; + if ((i44 & 7 | 0) == 0) { + i58 = 0; + } else { + i58 = -i44 & 7; + } + i44 = i54 - 40 - i58 | 0; + HEAP32[3022] = i55 + i58; + HEAP32[3019] = i44; + HEAP32[i55 + (i58 + 4) >> 2] = i44 | 1; + HEAP32[i55 + (i54 - 36) >> 2] = 40; + HEAP32[3023] = HEAP32[2980]; + } else { + i44 = 12512; + while (1) { + i59 = HEAP32[i44 >> 2] | 0; + i60 = i44 + 4 | 0; + i61 = HEAP32[i60 >> 2] | 0; + if ((i55 | 0) == (i59 + i61 | 0)) { + i45 = 213; + break; + } + i56 = HEAP32[i44 + 8 >> 2] | 0; + if ((i56 | 0) == 0) { + break; + } else { + i44 = i56; + } + } + do { + if ((i45 | 0) == 213) { + if ((HEAP32[i44 + 12 >> 2] & 8 | 0) != 0) { + break; + } + i56 = i57; + if (!(i56 >>> 0 >= i59 >>> 0 & i56 >>> 0 < i55 >>> 0)) { + break; + } + HEAP32[i60 >> 2] = i61 + i54; + i56 = HEAP32[3022] | 0; + i50 = (HEAP32[3019] | 0) + i54 | 0; + i51 = i56; + i48 = i56 + 8 | 0; + if ((i48 & 7 | 0) == 0) { + i62 = 0; + } else { + i62 = -i48 & 7; + } + i48 = i50 - i62 | 0; + HEAP32[3022] = i51 + i62; + HEAP32[3019] = i48; + HEAP32[i51 + (i62 + 4) >> 2] = i48 | 1; + HEAP32[i51 + (i50 + 4) >> 2] = 40; + HEAP32[3023] = HEAP32[2980]; + break L310; + } + } while (0); + if (i55 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + HEAP32[3020] = i55; + } + i44 = i55 + i54 | 0; + i50 = 12512; + while (1) { + i63 = i50 | 0; + if ((HEAP32[i63 >> 2] | 0) == (i44 | 0)) { + i45 = 223; + break; + } + i51 = HEAP32[i50 + 8 >> 2] | 0; + if ((i51 | 0) == 0) { + break; + } else { + i50 = i51; + } + } + do { + if ((i45 | 0) == 223) { + if ((HEAP32[i50 + 12 >> 2] & 8 | 0) != 0) { + break; + } + HEAP32[i63 >> 2] = i55; + i44 = i50 + 4 | 0; + HEAP32[i44 >> 2] = (HEAP32[i44 >> 2] | 0) + i54; + i44 = i55 + 8 | 0; + if ((i44 & 7 | 0) == 0) { + i64 = 0; + } else { + i64 = -i44 & 7; + } + i44 = i55 + (i54 + 8) | 0; + if ((i44 & 7 | 0) == 0) { + i65 = 0; + } else { + i65 = -i44 & 7; + } + i44 = i55 + (i65 + i54) | 0; + i51 = i44; + i48 = i64 + i14 | 0; + i56 = i55 + i48 | 0; + i52 = i56; + i36 = i44 - (i55 + i64) - i14 | 0; + HEAP32[i55 + (i64 + 4) >> 2] = i14 | 3; + do { + if ((i51 | 0) == (HEAP32[3022] | 0)) { + i35 = (HEAP32[3019] | 0) + i36 | 0; + HEAP32[3019] = i35; + HEAP32[3022] = i52; + HEAP32[i55 + (i48 + 4) >> 2] = i35 | 1; + } else { + if ((i51 | 0) == (HEAP32[3021] | 0)) { + i35 = (HEAP32[3018] | 0) + i36 | 0; + HEAP32[3018] = i35; + HEAP32[3021] = i52; + HEAP32[i55 + (i48 + 4) >> 2] = i35 | 1; + HEAP32[i55 + (i35 + i48) >> 2] = i35; + break; + } + i35 = i54 + 4 | 0; + i49 = HEAP32[i55 + (i35 + i65) >> 2] | 0; + if ((i49 & 3 | 0) == 1) { + i53 = i49 & -8; + i47 = i49 >>> 3; + L355 : do { + if (i49 >>> 0 < 256) { + i46 = HEAP32[i55 + ((i65 | 8) + i54) >> 2] | 0; + i42 = HEAP32[i55 + (i54 + 12 + i65) >> 2] | 0; + i43 = 12104 + (i47 << 1 << 2) | 0; + do { + if ((i46 | 0) != (i43 | 0)) { + if (i46 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } + if ((HEAP32[i46 + 12 >> 2] | 0) == (i51 | 0)) { + break; + } + _abort(); + return 0; + } + } while (0); + if ((i42 | 0) == (i46 | 0)) { + HEAP32[3016] = HEAP32[3016] & ~(1 << i47); + break; + } + do { + if ((i42 | 0) == (i43 | 0)) { + i66 = i42 + 8 | 0; + } else { + if (i42 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } + i12 = i42 + 8 | 0; + if ((HEAP32[i12 >> 2] | 0) == (i51 | 0)) { + i66 = i12; + break; + } + _abort(); + return 0; + } + } while (0); + HEAP32[i46 + 12 >> 2] = i42; + HEAP32[i66 >> 2] = i46; + } else { + i43 = i44; + i12 = HEAP32[i55 + ((i65 | 24) + i54) >> 2] | 0; + i41 = HEAP32[i55 + (i54 + 12 + i65) >> 2] | 0; + do { + if ((i41 | 0) == (i43 | 0)) { + i40 = i65 | 16; + i6 = i55 + (i35 + i40) | 0; + i37 = HEAP32[i6 >> 2] | 0; + if ((i37 | 0) == 0) { + i4 = i55 + (i40 + i54) | 0; + i40 = HEAP32[i4 >> 2] | 0; + if ((i40 | 0) == 0) { + i67 = 0; + break; + } else { + i68 = i40; + i69 = i4; + } + } else { + i68 = i37; + i69 = i6; + } + while (1) { + i6 = i68 + 20 | 0; + i37 = HEAP32[i6 >> 2] | 0; + if ((i37 | 0) != 0) { + i68 = i37; + i69 = i6; + continue; + } + i6 = i68 + 16 | 0; + i37 = HEAP32[i6 >> 2] | 0; + if ((i37 | 0) == 0) { + break; + } else { + i68 = i37; + i69 = i6; + } + } + if (i69 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } else { + HEAP32[i69 >> 2] = 0; + i67 = i68; + break; + } + } else { + i6 = HEAP32[i55 + ((i65 | 8) + i54) >> 2] | 0; + if (i6 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } + i37 = i6 + 12 | 0; + if ((HEAP32[i37 >> 2] | 0) != (i43 | 0)) { + _abort(); + return 0; + } + i4 = i41 + 8 | 0; + if ((HEAP32[i4 >> 2] | 0) == (i43 | 0)) { + HEAP32[i37 >> 2] = i41; + HEAP32[i4 >> 2] = i6; + i67 = i41; + break; + } else { + _abort(); + return 0; + } + } + } while (0); + if ((i12 | 0) == 0) { + break; + } + i41 = i55 + (i54 + 28 + i65) | 0; + i46 = 12368 + (HEAP32[i41 >> 2] << 2) | 0; + do { + if ((i43 | 0) == (HEAP32[i46 >> 2] | 0)) { + HEAP32[i46 >> 2] = i67; + if ((i67 | 0) != 0) { + break; + } + HEAP32[3017] = HEAP32[3017] & ~(1 << HEAP32[i41 >> 2]); + break L355; + } else { + if (i12 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } + i42 = i12 + 16 | 0; + if ((HEAP32[i42 >> 2] | 0) == (i43 | 0)) { + HEAP32[i42 >> 2] = i67; + } else { + HEAP32[i12 + 20 >> 2] = i67; + } + if ((i67 | 0) == 0) { + break L355; + } + } + } while (0); + if (i67 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } + HEAP32[i67 + 24 >> 2] = i12; + i43 = i65 | 16; + i41 = HEAP32[i55 + (i43 + i54) >> 2] | 0; + do { + if ((i41 | 0) != 0) { + if (i41 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } else { + HEAP32[i67 + 16 >> 2] = i41; + HEAP32[i41 + 24 >> 2] = i67; + break; + } + } + } while (0); + i41 = HEAP32[i55 + (i35 + i43) >> 2] | 0; + if ((i41 | 0) == 0) { + break; + } + if (i41 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } else { + HEAP32[i67 + 20 >> 2] = i41; + HEAP32[i41 + 24 >> 2] = i67; + break; + } + } + } while (0); + i70 = i55 + ((i53 | i65) + i54) | 0; + i71 = i53 + i36 | 0; + } else { + i70 = i51; + i71 = i36; + } + i35 = i70 + 4 | 0; + HEAP32[i35 >> 2] = HEAP32[i35 >> 2] & -2; + HEAP32[i55 + (i48 + 4) >> 2] = i71 | 1; + HEAP32[i55 + (i71 + i48) >> 2] = i71; + i35 = i71 >>> 3; + if (i71 >>> 0 < 256) { + i47 = i35 << 1; + i49 = 12104 + (i47 << 2) | 0; + i41 = HEAP32[3016] | 0; + i12 = 1 << i35; + do { + if ((i41 & i12 | 0) == 0) { + HEAP32[3016] = i41 | i12; + i72 = i49; + i73 = 12104 + (i47 + 2 << 2) | 0; + } else { + i35 = 12104 + (i47 + 2 << 2) | 0; + i46 = HEAP32[i35 >> 2] | 0; + if (i46 >>> 0 >= (HEAP32[3020] | 0) >>> 0) { + i72 = i46; + i73 = i35; + break; + } + _abort(); + return 0; + } + } while (0); + HEAP32[i73 >> 2] = i52; + HEAP32[i72 + 12 >> 2] = i52; + HEAP32[i55 + (i48 + 8) >> 2] = i72; + HEAP32[i55 + (i48 + 12) >> 2] = i49; + break; + } + i47 = i56; + i12 = i71 >>> 8; + do { + if ((i12 | 0) == 0) { + i74 = 0; + } else { + if (i71 >>> 0 > 16777215) { + i74 = 31; + break; + } + i41 = (i12 + 1048320 | 0) >>> 16 & 8; + i53 = i12 << i41; + i35 = (i53 + 520192 | 0) >>> 16 & 4; + i46 = i53 << i35; + i53 = (i46 + 245760 | 0) >>> 16 & 2; + i42 = 14 - (i35 | i41 | i53) + (i46 << i53 >>> 15) | 0; + i74 = i71 >>> ((i42 + 7 | 0) >>> 0) & 1 | i42 << 1; + } + } while (0); + i12 = 12368 + (i74 << 2) | 0; + HEAP32[i55 + (i48 + 28) >> 2] = i74; + HEAP32[i55 + (i48 + 20) >> 2] = 0; + HEAP32[i55 + (i48 + 16) >> 2] = 0; + i49 = HEAP32[3017] | 0; + i42 = 1 << i74; + if ((i49 & i42 | 0) == 0) { + HEAP32[3017] = i49 | i42; + HEAP32[i12 >> 2] = i47; + HEAP32[i55 + (i48 + 24) >> 2] = i12; + HEAP32[i55 + (i48 + 12) >> 2] = i47; + HEAP32[i55 + (i48 + 8) >> 2] = i47; + break; + } + if ((i74 | 0) == 31) { + i75 = 0; + } else { + i75 = 25 - (i74 >>> 1) | 0; + } + i42 = i71 << i75; + i49 = HEAP32[i12 >> 2] | 0; + while (1) { + if ((HEAP32[i49 + 4 >> 2] & -8 | 0) == (i71 | 0)) { + break; + } + i76 = i49 + 16 + (i42 >>> 31 << 2) | 0; + i12 = HEAP32[i76 >> 2] | 0; + if ((i12 | 0) == 0) { + i45 = 296; + break; + } else { + i42 = i42 << 1; + i49 = i12; + } + } + if ((i45 | 0) == 296) { + if (i76 >>> 0 < (HEAP32[3020] | 0) >>> 0) { + _abort(); + return 0; + } else { + HEAP32[i76 >> 2] = i47; + HEAP32[i55 + (i48 + 24) >> 2] = i49; + HEAP32[i55 + (i48 + 12) >> 2] = i47; + HEAP32[i55 + (i48 + 8) >> 2] = i47; + break; + } + } + i42 = i49 + 8 | 0; + i12 = HEAP32[i42 >> 2] | 0; + i53 = HEAP32[3020] | 0; + if (i49 >>> 0 < i53 >>> 0) { + _abort(); + return 0; + } + if (i12 >>> 0 < i53 >>> 0) { + _abort(); + return 0; + } else { + HEAP32[i12 + 12 >> 2] = i47; + HEAP32[i42 >> 2] = i47; + HEAP32[i55 + (i48 + 8) >> 2] = i12; + HEAP32[i55 + (i48 + 12) >> 2] = i49; + HEAP32[i55 + (i48 + 24) >> 2] = 0; + break; + }