/EmTutor/disk_harmonic_map.js
JavaScript | 8820 lines | 6000 code | 2235 blank | 585 comment | 1569 complexity | c7972acae3b376c706ee2722441c2e98 MD5 | raw file
Possible License(s): LGPL-2.1, MPL-2.0-no-copyleft-exception, GPL-2.0, BSD-3-Clause, GPL-3.0
- // 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 ENVIRONMENT_IS_NODE = typeof process === 'object' && typeof require === 'function';
- var ENVIRONMENT_IS_WEB = typeof window === 'object';
- var ENVIRONMENT_IS_WORKER = typeof importScripts === 'function';
- var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
- if (ENVIRONMENT_IS_NODE) {
- // Expose functionality in the same simple way that the shells work
- // Note that we pollute the global namespace here, otherwise we break in node
- if (!Module['print']) Module['print'] = function print(x) {
- process['stdout'].write(x + '\n');
- };
- if (!Module['printErr']) Module['printErr'] = function printErr(x) {
- process['stderr'].write(x + '\n');
- };
- var nodeFS = require('fs');
- var nodePath = require('path');
- Module['read'] = function read(filename, binary) {
- filename = nodePath['normalize'](filename);
- var ret = nodeFS['readFileSync'](filename);
- // The path is absolute if the normalized version is the same as the resolved.
- if (!ret && filename != nodePath['resolve'](filename)) {
- filename = path.join(__dirname, '..', 'src', filename);
- ret = nodeFS['readFileSync'](filename);
- }
- if (ret && !binary) ret = ret.toString();
- return ret;
- };
- Module['readBinary'] = function readBinary(filename) { return Module['read'](filename, true) };
- Module['load'] = function load(f) {
- globalEval(read(f));
- };
- Module['arguments'] = process['argv'].slice(2);
- module['exports'] = Module;
- }
- else if (ENVIRONMENT_IS_SHELL) {
- if (!Module['print']) Module['print'] = print;
- 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 read() { throw 'no read() available (jsc?)' };
- }
- Module['readBinary'] = function readBinary(f) {
- return read(f, 'binary');
- };
- if (typeof scriptArgs != 'undefined') {
- Module['arguments'] = scriptArgs;
- } else if (typeof arguments != 'undefined') {
- Module['arguments'] = arguments;
- }
- this['Module'] = Module;
- eval("if (typeof gc === 'function' && gc.toString().indexOf('[native code]') > 0) var gc = undefined"); // wipe out the SpiderMonkey shell 'gc' function, which can confuse closure (uses it as a minified name, and it is then initted to a non-falsey value unexpectedly)
- }
- else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
- Module['read'] = function read(url) {
- var xhr = new XMLHttpRequest();
- xhr.open('GET', url, false);
- xhr.send(null);
- return xhr.responseText;
- };
- if (typeof arguments != 'undefined') {
- Module['arguments'] = arguments;
- }
- if (typeof console !== 'undefined') {
- if (!Module['print']) Module['print'] = function print(x) {
- console.log(x);
- };
- if (!Module['printErr']) Module['printErr'] = function printErr(x) {
- console.log(x);
- };
- } else {
- // Probably a worker, and without console.log. We can do very little here...
- var TRY_USE_DUMP = false;
- if (!Module['print']) Module['print'] = (TRY_USE_DUMP && (typeof(dump) !== "undefined") ? (function(x) {
- dump(x);
- }) : (function(x) {
- // self.postMessage(x); // enable this if you want stdout to be sent as messages
- }));
- }
- if (ENVIRONMENT_IS_WEB) {
- this['Module'] = Module;
- } else {
- Module['load'] = importScripts;
- }
- }
- else {
- // Unreachable because SHELL is dependant on the others
- throw 'Unknown runtime environment. Where are we?';
- }
- function globalEval(x) {
- eval.call(null, x);
- }
- if (!Module['load'] == 'undefined' && Module['read']) {
- Module['load'] = function load(f) {
- globalEval(Module['read'](f));
- };
- }
- if (!Module['print']) {
- Module['print'] = function(){};
- }
- if (!Module['printErr']) {
- Module['printErr'] = Module['print'];
- }
- if (!Module['arguments']) {
- Module['arguments'] = [];
- }
- // *** 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)) {
- return '(((' +target + ')+' + (quantum-1) + ')&' + -quantum + ')';
- }
- 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) {
- switch (type) {
- case 'i1': case 'i8': return 1;
- case 'i16': return 2;
- case 'i32': return 4;
- case 'i64': return 8;
- case 'float': return 4;
- case 'double': return 8;
- default: {
- if (type[type.length-1] === '*') {
- return Runtime.QUANTUM_SIZE; // A pointer
- } else if (type[0] === 'i') {
- var bits = parseInt(type.substr(1));
- assert(bits % 8 === 0);
- return bits/8;
- } else {
- return 0;
- }
- }
- }
- },
- 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 (vararg) return 8;
- if (!vararg && (type == 'i64' || type == 'double')) 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 if (field[0] === '<') {
- // vector type
- size = alignSize = Types.types[field].flatSize; // fully aligned
- } else if (field[0] === 'i') {
- // illegal integer field, that could not be legalized because it is an internal structure field
- // it is ok to have such fields, if we just use them as markers of field size and nothing more complex
- size = alignSize = parseInt(field.substr(1))/8;
- assert(size % 1 === 0, 'cannot handle non-byte-size field ' + field);
- } else {
- assert(false, 'invalid type for calculateStructAlignment');
- }
- 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;
- });
- if (type.name_ && type.name_[0] === '[') {
- // arrays have 2 elements, so we get the proper difference. then we scale here. that way we avoid
- // allocating a potentially huge array for [999999 x i8] etc.
- type.flatSize = parseInt(type.name_.substr(1))*type.flatSize/2;
- }
- 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*(1 + 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;
- },
- getAsmConst: function (code, numArgs) {
- // code is a constant string on the heap, so we can cache these
- if (!Runtime.asmConstCache) Runtime.asmConstCache = {};
- var func = Runtime.asmConstCache[code];
- if (func) return func;
- var args = [];
- for (var i = 0; i < numArgs; i++) {
- args.push(String.fromCharCode(36) + i); // $0, $1 etc
- }
- code = Pointer_stringify(code);
- if (code[0] === '"') {
- // tolerate EM_ASM("..code..") even though EM_ASM(..code..) is correct
- if (code.indexOf('"', 1) === code.length-1) {
- code = code.substr(1, code.length-2);
- } else {
- // something invalid happened, e.g. EM_ASM("..code($0)..", input)
- abort('invalid EM_ASM input |' + code + '|. Please use EM_ASM(..code..) (no quotes) or EM_ASM({ ..code($0).. }, input) (to input values)');
- }
- }
- return Runtime.asmConstCache[code] = eval('(function(' + args.join(',') + '){ ' + code + ' })'); // new Function does not allow upvars in node
- },
- 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 dynCall_wrapper() {
- 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 processJSString(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)&-8); return ret; },
- staticAlloc: function (size) { var ret = STATICTOP;STATICTOP = (STATICTOP + size)|0;STATICTOP = (((STATICTOP)+7)&-8); return ret; },
- dynamicAlloc: function (size) { var ret = DYNAMICTOP;DYNAMICTOP = (DYNAMICTOP + size)|0;DYNAMICTOP = (((DYNAMICTOP)+7)&-8); 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
- }
- Module['Runtime'] = Runtime;
- //========================================
- // 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, tempDouble, tempFloat;
- 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
- value = intArrayFromString(value);
- type = 'array';
- }
- 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;
- function demangle(func) {
- try {
- // Special-case the entry point, since its name differs from other name mangling.
- if (func == 'Object._main' || func == '_main') {
- return 'main()';
- }
- if (typeof func === 'number') func = Pointer_stringify(func);
- if (func[0] !== '_') return func;
- if (func[1] !== '_') return func; // C function
- if (func[2] !== 'Z') return func;
- switch (func[3]) {
- case 'n': return 'operator new()';
- case 'd': return 'operator delete()';
- }
- var i = 3;
- // params, etc.
- var basicTypes = {
- 'v': 'void',
- 'b': 'bool',
- 'c': 'char',
- 's': 'short',
- 'i': 'int',
- 'l': 'long',
- 'f': 'float',
- 'd': 'double',
- 'w': 'wchar_t',
- 'a': 'signed char',
- 'h': 'unsigned char',
- 't': 'unsigned short',
- 'j': 'unsigned int',
- 'm': 'unsigned long',
- 'x': 'long long',
- 'y': 'unsigned long long',
- 'z': '...'
- };
- function dump(x) {
- //return;
- if (x) Module.print(x);
- Module.print(func);
- var pre = '';
- for (var a = 0; a < i; a++) pre += ' ';
- Module.print (pre + '^');
- }
- var subs = [];
- function parseNested() {
- i++;
- if (func[i] === 'K') i++; // ignore const
- var parts = [];
- while (func[i] !== 'E') {
- if (func[i] === 'S') { // substitution
- i++;
- var next = func.indexOf('_', i);
- var num = func.substring(i, next) || 0;
- parts.push(subs[num] || '?');
- i = next+1;
- continue;
- }
- if (func[i] === 'C') { // constructor
- parts.push(parts[parts.length-1]);
- i += 2;
- continue;
- }
- var size = parseInt(func.substr(i));
- var pre = size.toString().length;
- if (!size || !pre) { i--; break; } // counter i++ below us
- var curr = func.substr(i + pre, size);
- parts.push(curr);
- subs.push(curr);
- i += pre + size;
- }
- i++; // skip E
- return parts;
- }
- var first = true;
- function parse(rawList, limit, allowVoid) { // main parser
- limit = limit || Infinity;
- var ret = '', list = [];
- function flushList() {
- return '(' + list.join(', ') + ')';
- }
- var name;
- if (func[i] === 'N') {
- // namespaced N-E
- name = parseNested().join('::');
- limit--;
- if (limit === 0) return rawList ? [name] : name;
- } else {
- // not namespaced
- if (func[i] === 'K' || (first && func[i] === 'L')) i++; // ignore const and first 'L'
- var size = parseInt(func.substr(i));
- if (size) {
- var pre = size.toString().length;
- name = func.substr(i + pre, size);
- i += pre + size;
- }
- }
- first = false;
- if (func[i] === 'I') {
- i++;
- var iList = parse(true);
- var iRet = parse(true, 1, true);
- ret += iRet[0] + ' ' + name + '<' + iList.join(', ') + '>';
- } else {
- ret = name;
- }
- paramLoop: while (i < func.length && limit-- > 0) {
- //dump('paramLoop');
- var c = func[i++];
- if (c in basicTypes) {
- list.push(basicTypes[c]);
- } else {
- switch (c) {
- case 'P': list.push(parse(true, 1, true)[0] + '*'); break; // pointer
- case 'R': list.push(parse(true, 1, true)[0] + '&'); break; // reference
- case 'L': { // literal
- i++; // skip basic type
- var end = func.indexOf('E', i);
- var size = end - i;
- list.push(func.substr(i, size));
- i += size + 2; // size + 'EE'
- break;
- }
- case 'A': { // array
- var size = parseInt(func.substr(i));
- i += size.toString().length;
- if (func[i] !== '_') throw '?';
- i++; // skip _
- list.push(parse(true, 1, true)[0] + ' [' + size + ']');
- break;
- }
- case 'E': break paramLoop;
- default: ret += '?' + c; break paramLoop;
- }
- }
- }
- if (!allowVoid && list.length === 1 && list[0] === 'void') list = []; // avoid (void)
- return rawList ? list : ret + flushList();
- }
- return parse();
- } catch(e) {
- return func;
- }
- }
- function demangleAll(text) {
- return text.replace(/__Z[\w\d_]+/g, function(x) { var y = demangle(x); return x === y ? x : (x + ' [' + y + ']') });
- }
- function stackTrace() {
- var stack = new Error().stack;
- return stack ? demangleAll(stack) : '(no stack trace available)'; // Stack trace is not available at least on IE10 and Safari 6.
- }
- // Memory management
- var PAGE_SIZE = 4096;
- function alignMemoryPage(x) {
- return (x+4095)&-4096;
- }
- 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'] || 419430400;
- var FAST_MEMORY = Module['FAST_MEMORY'] || 2097152;
- var totalMemory = 4096;
- while (totalMemory < TOTAL_MEMORY || totalMemory < 2*TOTAL_STACK) {
- if (totalMemory < 16*1024*1024) {
- totalMemory *= 2;
- } else {
- totalMemory += 16*1024*1024
- }
- }
- if (totalMemory !== TOTAL_MEMORY) {
- Module.printErr('increasing TOTAL_MEMORY to ' + totalMemory + ' to be more reasonable');
- TOTAL_MEMORY = totalMemory;
- }
- // Initialize the runtime's memory
- // check for full engine support (use string 'subarray' to avoid closure compiler confusion)
- assert(typeof Int32Array !== 'undefined' && typeof Float64Array !== 'undefined' && !!(new Int32Array(1)['subarray']) && !!(new Int32Array(1)['set']),
- 'Cannot fallback to non-typed array case: Code is too specialized');
- 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 writeAsciiToMemory(str, buffer, dontAddNull) {
- for (var i = 0; i < str.length; i++) {
- HEAP8[(((buffer)+(i))|0)]=str.charCodeAt(i);
- }
- if (!dontAddNull) HEAP8[(((buffer)+(str.length))|0)]=0;
- }
- Module['writeAsciiToMemory'] = writeAsciiToMemory;
- function unSign(value, bits, ignore) {
- 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) {
- 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;
- }
- // check for imul support, and also for correctness ( https://bugs.webkit.org/show_bug.cgi?id=126345 )
- if (!Math['imul'] || Math['imul'](0xffffffff, 5) !== -5) Math['imul'] = function imul(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'];
- var Math_abs = Math.abs;
- var Math_cos = Math.cos;
- var Math_sin = Math.sin;
- var Math_tan = Math.tan;
- var Math_acos = Math.acos;
- var Math_asin = Math.asin;
- var Math_atan = Math.atan;
- var Math_atan2 = Math.atan2;
- var Math_exp = Math.exp;
- var Math_log = Math.log;
- var Math_sqrt = Math.sqrt;
- var Math_ceil = Math.ceil;
- var Math_floor = Math.floor;
- var Math_pow = Math.pow;
- var Math_imul = Math.imul;
- var Math_fround = Math.fround;
- var Math_min = Math.min;
- // 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 runDependencyWatcher = null;
- var dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled
- function addRunDependency(id) {
- runDependencies++;
- if (Module['monitorRunDependencies']) {
- Module['monitorRunDependencies'](runDependencies);
- }
- }
- Module['addRunDependency'] = addRunDependency;
- function removeRunDependency(id) {
- runDependencies--;
- if (Module['monitorRunDependencies']) {
- Module['monitorRunDependencies'](runDependencies);
- }
- if (runDependencies == 0) {
- if (runDependencyWatcher !== null) {
- clearInterval(runDependencyWatcher);
- runDependencyWatcher = null;
- }
- if (dependenciesFulfilled) {
- var callback = dependenciesFulfilled;
- dependenciesFulfilled = null;
- callback(); // can add another dependenciesFulfilled
- }
- }
- }
- Module['removeRunDependency'] = removeRunDependency;
- Module["preloadedImages"] = {}; // maps url to image data
- Module["preloadedAudios"] = {}; // maps url to audio data
- var memoryInitializer = null;
- // === Body ===
- STATIC_BASE = 8;
- STATICTOP = STATIC_BASE + 28152;
- var _stdout;
- var _stdout=_stdout=allocate(1, "i32*", ALLOC_STATIC);
- var _stdin;
- var _stdin=_stdin=allocate(1, "i32*", ALLOC_STATIC);
- var _stderr;
- var _stderr=_stderr=allocate(1, "i32*", ALLOC_STATIC);
- /* global initializers */ __ATINIT__.push({ func: function() { runPostSets() } },{ func: function() { __GLOBAL__I_a() } });
- var ___dso_handle;
- var ___dso_handle=___dso_handle=allocate(1, "i32*", ALLOC_STATIC);
- var __ZTVN10__cxxabiv120__si_class_type_infoE;
- __ZTVN10__cxxabiv120__si_class_type_infoE=allocate([0,0,0,0,104,89,0,0,16,1,0,0,10,1,0,0,70,0,0,0,166,0,0,0,10,0,0,0,10,0,0,0,2,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0], "i8", ALLOC_STATIC);;
- var __ZTVN10__cxxabiv117__class_type_infoE;
- __ZTVN10__cxxabiv117__class_type_infoE=allocate([0,0,0,0,120,89,0,0,16,1,0,0,90,0,0,0,70,0,0,0,166,0,0,0,10,0,0,0,30,0,0,0,4,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0], "i8", ALLOC_STATIC);;
- var __ZNSt13runtime_errorC1EPKc;
- var __ZNSt13runtime_errorD1Ev;
- var __ZNSt12length_errorD1Ev;
- var __ZNSt3__16localeC1Ev;
- var __ZNSt3__16localeC1ERKS0_;
- var __ZNSt3__16localeD1Ev;
- var __ZNSt8bad_castC1Ev;
- var __ZNSt8bad_castD1Ev;
- var __ZNSt9bad_allocC1Ev;
- var __ZNSt9bad_allocD1Ev;
- /* memory initializer */ allocate([105,110,102,111,58,32,102,97,99,116,111,114,105,122,97,116,105,111,110,32,105,115,32,110,111,116,32,115,117,99,99,101,115,115,102,117,108,0,0,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,112,101,114,102,111,114,109,32,102,97,99,116,111,114,105,122,97,116,105,111,110,46,0,0,0,0,0,101,114,114,111,114,32,111,99,99,117,114,114,101,100,32,105,110,32,116,101,99,104,109,117,108,108,101,114,95,109,97,112,95,119,105,116,104,95,98,111,117,110,100,97,114,121,46,0,100,97,116,97,32,97,114,101,32,110,111,116,32,105,110,32,114,105,103,104,116,32,115,105,122,101,44,32,112,108,101,97,115,101,32,99,104,101,99,107,46,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,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,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,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,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,95,112,137,0,255,9,47,15,10,0,0,0,100,0,0,0,232,3,0,0,16,39,0,0,160,134,1,0,64,66,15,0,128,150,152,0,0,225,245,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,74,117,108,0,0,0,0,0,105,116,45,62,114,111,119,40,41,62,61,48,32,38,38,32,105,116,45,62,114,111,119,40,41,60,109,97,116,46,114,111,119,115,40,41,32,38,38,32,105,116,45,62,99,111,108,40,41,62,61,48,32,38,38,32,105,116,45,62,99,111,108,40,41,60,109,97,116,46,99,111,108,115,40,41,0,0,0,0,105,115,67,111,109,112,114,101,115,115,101,100,40,41,32,38,38,32,34,84,104,105,115,32,102,117,110,99,116,105,111,110,32,100,111,101,115,32,110,111,116,32,109,97,107,101,32,115,101,110,115,101,32,105,110,32,110,111,110,32,99,111,109,112,114,101,115,115,101,100,32,109,111,100,101,46,34,0,0,0,74,117,110,0,0,0,0,0,65,112,114,0,0,0,0,0,77,97,114,0,0,0,0,0,117,110,115,117,112,112,111,114,116,101,100,32,108,111,99,97,108,101,32,102,111,114,32,115,116,97,110,100,97,114,100,32,105,110,112,117,116,0,0,0,70,101,98,0,0,0,0,0,115,112,95,100,103,101,109,118,32,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,97,116,97,95,114,111,119,105,110,100,91,93,0,0,0,74,97,110,0,0,0,0,0,79,0,0,0,0,0,0,0,68,101,99,101,109,98,101,114,0,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,66,106,99,111,108,46,83,116,111,114,101,0,0,0,0,73,108,108,101,103,97,108,32,110,111,114,109,32,115,112,101,99,105,102,105,101,100,46,0,85,0,0,0,0,0,0,0,78,111,118,101,109,98,101,114,0,0,0,0,0,0,0,0,79,99,116,111,98,101,114,0,83,101,112,116,101,109,98,101,114,0,0,0,0,0,0,0,40,105,62,61,48,41,32,38,38,32,40,32,40,40,66,108,111,99,107,82,111,119,115,61,61,49,41,32,38,38,32,40,66,108,111,99,107,67,111,108,115,61,61,88,112,114,84,121,112,101,58,58,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,32,38,38,32,105,60,120,112,114,46,114,111,119,115,40,41,41,32,124,124,40,40,66,108,111,99,107,82,111,119,115,61,61,88,112,114,84,121,112,101,58,58,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,32,38,38,32,40,66,108,111,99,107,67,111,108,115,61,61,49,41,32,38,38,32,105,60,120,112,114,46,99,111,108,115,40,41,41,41,0,0,65,117,103,117,115,116,0,0,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,43,49,93,61,61,48,32,38,38,32,34,89,111,117,32,109,117,115,116,32,99,97,108,108,32,115,116,97,114,116,86,101,99,32,102,111,114,32,101,97,99,104,32,105,110,110,101,114,32,118,101,99,116,111,114,32,115,101,113,117,101,110,116,105,97,108,108,121,34,0,74,117,108,121,0,0,0,0,74,117,110,101,0,0,0,0,77,97,121,0,0,0,0,0,65,112,114,105,108,0,0,0,100,115,112,95,98,108,97,115,50,46,99,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,97,116,97,95,99,111,108,112,116,114,91,93,0,0,0,77,97,114,99,104,0,0,0,76,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,101,100,32,102,111,114,32,98,117,102,32,105,110,32,100,111,117,98,108,101,67,97,108,108,111,99,40,41,10,0,0,0,0,0,0,0,0,115,116,100,58,58,98,97,100,95,99,97,115,116,0,0,0,70,101,98,114,117,97,114,121,0,0,0,0,0,0,0,0,76,0,0,0,0,0,0,0,83,97,102,101,32,109,105,110,105,109,117,109,0,0,0,0,78,111,116,32,105,109,112,108,101,109,101,110,116,101,100,46,0,0,0,0,0,0,0,0,85,110,105,116,0,0,0,0,74,97,110,117,97,114,121,0,68,0,0,0,101,0,0,0,99,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,77,97,112,66,97,115,101,46,104,0,0,0,0,0,0,0,0,78,0,0,0,111,0,0,0,118,0,0,0,0,0,0,0,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,93,61,61,73,110,100,101,120,40,109,95,100,97,116,97,46,115,105,122,101,40,41,41,32,38,38,32,34,89,111,117,32,109,117,115,116,32,99,97,108,108,32,115,116,97,114,116,86,101,99,32,102,111,114,32,101,97,99,104,32,105,110,110,101,114,32,118,101,99,116,111,114,32,115,101,113,117,101,110,116,105,97,108,108,121,34,0,0,0,0,0,0,0,0,79,0,0,0,99,0,0,0,116,0,0,0,0,0,0,0,83,0,0,0,101,0,0,0,112,0,0,0,0,0,0,0,65,0,0,0,117,0,0,0,103,0,0,0,0,0,0,0,74,0,0,0,117,0,0,0,108,0,0,0,0,0,0,0,77,97,108,108,111,99,32,102,97,105,108,115,32,102,111,114,32,119,111,114,107,32,105,110,32,115,112,95,100,116,114,115,118,40,41,46,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,116,95,114,111,119,105,110,100,91,93,0,0,0,0,0,74,0,0,0,117,0,0,0,110,0,0,0,0,0,0,0,85,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,101,100,32,102,111,114,32,98,117,102,32,105,110,32,100,111,117,98,108,101,77,97,108,108,111,99,40,41,10,0,0,0,0,0,0,0,0,77,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,78,0,0,0,0,0,0,0,69,112,115,105,108,111,110,0,69,0,0,0,0,0,0,0,78,111,32,116,114,97,110,115,0,0,0,0,0,0,0,0,65,0,0,0,112,0,0,0,114,0,0,0,0,0,0,0,77,0,0,0,97,0,0,0,114,0,0,0,0,0,0,0,70,0,0,0,101,0,0,0,98,0,0,0,0,0,0,0,40,100,97,116,97,80,116,114,32,61,61,32,48,41,32,124,124,32,40,32,110,98,82,111,119,115,32,62,61,32,48,32,38,38,32,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,124,124,32,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,110,98,82,111,119,115,41,32,38,38,32,110,98,67,111,108,115,32,62,61,32,48,32,38,38,32,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,124,124,32,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,110,98,67,111,108,115,41,41,0,0,0,0,0,0,0,74,0,0,0,97,0,0,0,110,0,0,0,0,0,0,0,105,110,100,101,120,32,62,61,32,48,32,38,38,32,105,110,100,101,120,32,60,32,115,105,122,101,40,41,0,0,0,0,40,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,43,49,93,45,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,93,61,61,48,32,124,124,32,109,95,100,97,116,97,46,105,110,100,101,120,40,109,95,100,97,116,97,46,115,105,122,101,40,41,45,49,41,60,105,110,110,101,114,41,32,38,38,32,34,73,110,118,97,108,105,100,32,111,114,100,101,114,101,100,32,105,110,115,101,114,116,105,111,110,32,40,105,110,118,97,108,105,100,32,105,110,110,101,114,32,105,110,100,101,120,41,34,0,0,0,0,0,0,68,0,0,0,101,0,0,0,99,0,0,0,101,0,0,0,109,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,0,0,0,0,78,0,0,0,111,0,0,0,118,0,0,0,101,0,0,0,109,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,0,0,0,0,79,0,0,0,99,0,0,0,116,0,0,0,111,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,66,108,111,99,107,46,104,0,0,83,0,0,0,101,0,0,0,112,0,0,0,116,0,0,0,101,0,0,0,109,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,116,95,99,111,108,112,116,114,91,93,0,0,0,0,0,0,0,65,0,0,0,117,0,0,0,103,0,0,0,117,0,0,0,115,0,0,0,116,0,0,0,0,0,0,0,0,0,0,0,77,0,0,0,0,0,0,0,74,0,0,0,117,0,0,0,108,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,67,97,110,39,116,32,101,120,112,97,110,100,32,77,101,109,84,121,112,101,32,37,100,58,32,106,99,111,108,32,37,100,10,0,0,0,0,0,0,0,84,0,0,0,0,0,0,0,100,103,115,114,102,115,46,99,0,0,0,0,0,0,0,0,70,0,0,0,0,0,0,0,76,0,0,0,0,0,0,0,69,0,0,0,0,0,0,0,74,0,0,0,117,0,0,0,110,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,105,110,102,105,110,105,116,121,0,0,0,0,0,0,0,0,65,0,0,0,112,0,0,0,114,0,0,0,105,0,0,0,108,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,68,101,110,115,101,67,111,101,102,102,115,66,97,115,101,46,104,0,0,0,0,0,0,0,0,77,0,0,0,97,0,0,0,114,0,0,0,99,0,0,0,104,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,83,112,97,114,115,101,67,111,114,101,47,83,112,97,114,115,101,77,97,116,114,105,120,46,104,0,0,0,0,0,70,0,0,0,101,0,0,0,98,0,0,0,114,0,0,0,117,0,0,0,97,0,0,0,114,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,74,0,0,0,97,0,0,0,110,0,0,0,117,0,0,0,97,0,0,0,114,0,0,0,121,0,0,0,0,0,0,0,80,77,0,0,0,0,0,0,68,84,82,83,86,32,0,0,40,105,62,61,48,41,32,38,38,32,40,32,40,40,66,108,111,99,107,82,111,119,115,61,61,49,41,32,38,38,32,40,66,108,111,99,107,67,111,108,115,61,61,88,112,114,84,121,112,101,58,58,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,32,38,38,32,105,60,120,112,114,46,114,111,119,115,40,41,41,32,124,124,40,40,66,108,111,99,107,82,111,119,115,61,61,88,112,114,84,121,112,101,58,58,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,32,38,38,32,40,66,108,111,99,107,67,111,108,115,61,61,49,41,32,38,38,32,105,60,120,112,114,46,99,111,108,115,40,41,41,41,0,0,115,112,95,100,116,114,115,118,0,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,105,119,111,114,107,91,93,0,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,109,97,114,107,101,114,91,93,0,0,0,0,0,0,0,65,77,0,0,0,0,0,0,82,0,0,0,0,0,0,0,109,97,108,108,111,99,32,102,97,105,108,115,32,102,111,114,32,108,111,99,97,108,32,100,119,111,114,107,112,116,114,91,93,46,0,0,0,0,0,0,85,0,0,0,0,0,0,0,77,97,108,108,111,99,32,102,97,105,108,115,32,102,111,114,32,119,111,114,107,47,114,119,111,114,107,47,105,119,111,114,107,46,0,0,0,0,0,0,100,108,97,110,103,115,46,99,0,0,0,0,0,0,0,0,100,103,115,99,111,110,46,99,0,0,0,0,0,0,0,0,100,103,115,115,118,120,0,0,80,0,0,0,77,0,0,0,0,0,0,0,0,0,0,0,65,0,0,0,77,0,0,0,0,0,0,0,0,0,0,0,85,0,0,0,0,0,0,0,114,111,119,32,62,61,32,48,32,38,38,32,114,111,119,32,60,32,114,111,119,115,40,41,32,38,38,32,99,111,108,32,62,61,32,48,32,38,38,32,99,111,108,32,60,32,99,111,108,115,40,41,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,65,114,114,97,121,46,104,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,115,105,122,101,95,116,40,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,43,49,93,41,32,61,61,32,109,95,100,97,116,97,46,115,105,122,101,40,41,32,38,38,32,34,73,110,118,97,108,105,100,32,111,114,100,101,114,101,100,32,105,110,115,101,114,116,105,111,110,32,40,105,110,118,97,108,105,100,32,111,117,116,101,114,32,105,110,100,101,120,41,34,0,0,0,0,0,100,105,109,32,62,61,32,48,0,0,0,0,0,0,0,0,76,0,0,0,0,0,0,0,67,0,0,0,0,0,0,0,67,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,65,67,115,116,111,114,101,45,62,99,111,108,101,110,100,0,0,0,0,0,0,0,0,67,79,76,65,77,68,32,102,97,105,108,101,100,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,65,115,115,105,103,110,46,104,0,78,0,0,0,0,0,0,0,40,33,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,82,111,119,115,61,61,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,40,33,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,67,111,108,115,61,61,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,40,33,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,61,61,68,121,110,97,109,105,99,32,38,38,32,77,97,120,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,82,111,119,115,60,61,77,97,120,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,40,33,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,61,61,68,121,110,97,109,105,99,32,38,38,32,77,97,120,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,67,111,108,115,60,61,77,97,120,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,110,98,82,111,119,115,62,61,48,32,38,38,32,110,98,67,111,108,115,62,61,48,32,38,38,32,34,73,110,118,97,108,105,100,32,115,105,122,101,115,32,119,104,101,110,32,114,101,115,105,122,105,110,103,32,97,32,109,97,116,114,105,120,32,111,114,32,97,114,114,97,121,46,34,0,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,76,45,62,83,116,111,114,101,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,80,114,111,100,117,99,116,66,97,115,101,46,104,0,0,0,0,100,76,85,87,111,114,107,73,110,105,116,58,32,109,97,108,108,111,99,32,102,97,105,108,115,32,102,111,114,32,108,111,99,97,108,32,105,119,111,114,107,112,116,114,91,93,10,0,77,97,108,108,111,99,32,102,97,105,108,115,32,102,111,114,32,108,111,99,97,108,32,115,111,108,110,91,93,46,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,114,119,111,114,107,46,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,77,97,108,108,111,99,32,102,97,105,108,115,32,102,111,114,32,119,111,114,107,32,97,114,114,97,121,115,32,105,110,32,100,103,115,99,111,110,46,0,78,0,0,0,0,0,0,0,97,95,108,104,115,46,99,111,108,115,40,41,32,61,61,32,97,95,114,104,115,46,114,111,119,115,40,41,32,38,38,32,34,105,110,118,97,108,105,100,32,109,97,116,114,105,120,32,112,114,111,100,117,99,116,34,32,38,38,32,34,105,102,32,121,111,117,32,119,97,110,116,101,100,32,97,32,99,111,101,102,102,45,119,105,115,101,32,111,114,32,97,32,100,111,116,32,112,114,111,100,117,99,116,32,117,115,101,32,116,104,101,32,114,101,115,112,101,99,116,105,118,101,32,101,120,112,108,105,99,105,116,32,102,117,110,99,116,105,111,110,115,34,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,67,119,105,115,101,78,117,108,108,97,114,121,79,112,46,104,0,110,98,82,111,119,115,32,62,61,32,48,32,38,38,32,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,124,124,32,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,110,98,82,111,119,115,41,32,38,38,32,110,98,67,111,108,115,32,62,61,32,48,32,38,38,32,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,124,124,32,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,110,98,67,111,108,115,41,0,0,0,0,117,118,0,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,108,111,99,97,108,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,0,0,0,40,112,60,61,115,116,97,114,116,73,100,32,124,124,32,109,95,100,97,116,97,46,105,110,100,101,120,40,112,45,49,41,33,61,105,110,110,101,114,41,32,38,38,32,34,121,111,117,32,99,97,110,110,111,116,32,105,110,115,101,114,116,32,97,110,32,101,108,101,109,101,110,116,32,116,104,97,116,32,97,108,114,101,97,100,121,32,101,120,105,115,116,44,32,121,111,117,32,109,117,115,116,32,99,97,108,108,32,99,111,101,102,102,82,101,102,32,116,111,32,116,104,105,115,32,101,110,100,34,0,0,0,0,0,0,0,33,105,115,67,111,109,112,114,101,115,115,101,100,40,41,0,69,0,0,0,0,0,0,0,37,0,0,0,73,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,32,0,0,0,37,0,0,0,112,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,80,108,97,105,110,79,98,106,101,99,116,66,97,115,101,46,104,0,0,0,0,0,0,0,0,101,110,100,62,61,115,116,97,114,116,32,38,38,32,34,121,111,117,32,112,114,111,98,97,98,108,121,32,99,97,108,108,101,100,32,99,111,101,102,102,82,101,102,32,111,110,32,97,32,110,111,110,32,102,105,110,97,108,105,122,101,100,32,109,97,116,114,105,120,34,0,0,37,73,58,37,77,58,37,83,32,37,112,0,0,0,0,0,114,111,119,62,61,48,32,38,38,32,114,111,119,60,114,111,119,115,40,41,32,38,38,32,99,111,108,62,61,48,32,38,38,32,99,111,108,60,99,111,108,115,40,41,0,0,0,0,37,0,0,0,97,0,0,0,32,0,0,0,37,0,0,0,98,0,0,0,32,0,0,0,37,0,0,0,100,0,0,0,32,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,32,0,0,0,37,0,0,0,89,0,0,0,0,0,0,0,0,0,0,0,84,0,0,0,0,0,0,0,105,115,67,111,109,112,114,101,115,115,101,100,40,41,32,38,38,32,34,84,104,105,115,32,102,117,110,99,116,105,111,110,32,100,111,101,115,32,110,111,116,32,109,97,107,101,32,115,101,110,115,101,32,105,110,32,110,111,110,32,99,111,109,112,114,101,115,115,101,100,32,109,111,100,101,46,34,0,0,0,84,0,0,0,0,0,0,0,37,97,32,37,98,32,37,100,32,37,72,58,37,77,58,37,83,32,37,89,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,65,67,115,116,111,114,101,45,62,99,111,108,98,101,103,0,0,0,0,0,0,0,0,77,97,108,108,111,99,32,102,97,105,108,115,32,102,111,114,32,112,91,93,0,0,0,0,37,112,0,0,0,0,0,0,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,43,49,93,61,61,48,32,38,38,32,34,89,111,117,32,109,117,115,116,32,99,97,108,108,32,115,116,97,114,116,86,101,99,32,102,111,114,32,101,97,99,104,32,105,110,110,101,114,32,118,101,99,116,111,114,32,115,101,113,117,101,110,116,105,97,108,108,121,34,0,80,0,0,0,0,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,0,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,80,108,97,105,110,79,98,106,101,99,116,66,97,115,101,46,104,0,0,0,0,0,0,0,0,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,93,61,61,73,110,100,101,120,40,109,95,100,97,116,97,46,115,105,122,101,40,41,41,32,38,38,32,34,89,111,117,32,109,117,115,116,32,99,97,108,108,32,115,116,97,114,116,86,101,99,32,102,111,114,32,101,97,99,104,32,105,110,110,101,114,32,118,101,99,116,111,114,32,115,101,113,117,101,110,116,105,97,108,108,121,34,0,0,0,0,0,0,0,0,114,111,119,115,40,41,32,61,61,32,111,116,104,101,114,46,114,111,119,115,40,41,32,38,38,32,99,111,108,115,40,41,32,61,61,32,111,116,104,101,114,46,99,111,108,115,40,41,0,0,0,0,0,0,0,0,100,103,115,116,114,115,46,99,0,0,0,0,0,0,0,0,37,72,58,37,77,58,37,83,0,0,0,0,0,0,0,0,67,0,0,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,83,97,102,101,32,109,105,110,105,109,117,109,0,0,0,0,40,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,43,49,93,45,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,93,61,61,48,32,124,124,32,109,95,100,97,116,97,46,105,110,100,101,120,40,109,95,100,97,116,97,46,115,105,122,101,40,41,45,49,41,60,105,110,110,101,114,41,32,38,38,32,34,73,110,118,97,108,105,100,32,111,114,100,101,114,101,100,32,105,110,115,101,114,116,105,111,110,32,40,105,110,118,97,108,105,100,32,105,110,110,101,114,32,105,110,100,101,120,41,34,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,98,117,102,32,105,110,32,105,110,116,67,97,108,108,111,99,40,41,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,37,0,0,0,109,0,0,0,47,0,0,0,37,0,0,0,100,0,0,0,47,0,0,0,37,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,68,101,110,115,101,67,111,101,102,102,115,66,97,115,101,46,104,0,0,0,0,0,0,0,0,115,116,100,58,58,98,97,100,95,97,108,108,111,99,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,83,112,97,114,115,101,67,111,114,101,47,83,112,97,114,115,101,77,97,116,114,105,120,46,104,0,0,0,0,0,37,109,47,37,100,47,37,121,0,0,0,0,0,0,0,0,115,105,122,101,95,116,40,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,43,49,93,41,32,61,61,32,109,95,100,97,116,97,46,115,105,122,101,40,41,32,38,38,32,34,73,110,118,97,108,105,100,32,111,114,100,101,114,101,100,32,105,110,115,101,114,116,105,111,110,32,40,105,110,118,97,108,105,100,32,111,117,116,101,114,32,105,110,100,101,120,41,34,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,77,97,112,66,97,115,101,46,104,0,0,0,0,0,0,0,0,116,105,109,101,32,101,108,97,112,115,101,100,58,32,37,46,52,102,10,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,40,100,97,116,97,80,116,114,32,61,61,32,48,41,32,124,124,32,40,32,110,98,82,111,119,115,32,62,61,32,48,32,38,38,32,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,124,124,32,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,110,98,82,111,119,115,41,32,38,38,32,110,98,67,111,108,115,32,62,61,32,48,32,38,38,32,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,124,124,32,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,110,98,67,111,108,115,41,41,0,0,0,0,0,0,0,102,0,0,0,97,0,0,0,108,0,0,0,115,0,0,0,101,0,0,0,0,0,0,0,118,101,99,83,105,122,101,32,62,61,32,48,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,77,97,116,114,105,120,46,104,0,102,97,108,115,101,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,82,101,100,117,120,46,104,0,0,40,112,60,61,115,116,97,114,116,73,100,32,124,124,32,109,95,100,97,116,97,46,105,110,100,101,120,40,112,45,49,41,33,61,105,110,110,101,114,41,32,38,38,32,34,121,111,117,32,99,97,110,110,111,116,32,105,110,115,101,114,116,32,97,110,32,101,108,101,109,101,110,116,32,116,104,97,116,32,97,108,114,101,97,100,121,32,101,120,105,115,116,44,32,121,111,117,32,109,117,115,116,32,99,97,108,108,32,99,111,101,102,102,82,101,102,32,116,111,32,116,104,105,115,32,101,110,100,34,0,0,0,0,0,0,0,100,105,109,32,62,61,32,48,0,0,0,0,0,0,0,0,58,32,0,0,0,0,0,0,100,103,115,116,114,115,0,0,116,0,0,0,114,0,0,0,117,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,109,97,116,46,114,111,119,115,40,41,62,48,32,38,38,32,109,97,116,46,99,111,108,115,40,41,62,48,32,38,38,32,34,121,111,117,32,97,114,101,32,117,115,105,110,103,32,97,110,32,101,109,112,116,121,32,109,97,116,114,105,120,34,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,65,115,115,105,103,110,46,104,0,33,105,115,67,111,109,112,114,101,115,115,101,100,40,41,0,109,95,105,110,110,101,114,78,111,110,90,101,114,111,115,91,111,117,116,101,114,93,60,61,40,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,43,49,93,32,45,32,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,93,41,0,0,0,116,114,117,101,0,0,0,0,78,0,0,0,0,0,0,0,100,103,115,114,102,115,0,0,114,111,119,115,40,41,32,61,61,32,111,116,104,101,114,46,114,111,119,115,40,41,32,38,38,32,99,111,108,115,40,41,32,61,61,32,111,116,104,101,114,46,99,111,108,115,40,41,0,0,0,0,0,0,0,0,101,110,100,62,61,115,116,97,114,116,32,38,38,32,34,121,111,117,32,112,114,111,98,97,98,108,121,32,99,97,108,108,101,100,32,99,111,101,102,102,82,101,102,32,111,110,32,97,32,110,111,110,32,102,105,110,97,108,105,122,101,100,32,109,97,116,114,105,120,34,0,0,115,112,95,99,111,108,101,116,114,101,101,46,99,0,0,0,78,0,0,0,0,0,0,0,83,0,0,0,0,0,0,0,33,105,115,67,111,109,112,114,101,115,115,101,100,40,41,0,104,101,97,112,95,114,101,108,97,120,95,115,110,111,100,101,46,99,0,0,0,0,0,0,83,97,102,101,32,109,105,110,105,109,117,109,0,0,0,0,115,112,95,112,114,101,111,114,100,101,114,46,99,0,0,0,109,95,97,110,97,108,121,115,105,115,73,115,79,107,32,38,38,32,34,89,111,117,32,109,117,115,116,32,102,105,114,115,116,32,99,97,108,108,32,97,110,97,108,121,122,101,80,97,116,116,101,114,110,40,41,34,0,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,115,116,97,116,45,62,111,112,115,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,80,108,97,105,110,79,98,106,101,99,116,66,97,115,101,46,104,0,0,0,0,0,0,0,0,103,101,116,95,112,101,114,109,95,99,46,99,0,0,0,0,114,111,119,62,61,48,32,38,38,32,114,111,119,60,114,111,119,115,40,41,32,38,38,32,99,111,108,62,61,48,32,38,38,32,99,111,108,60,99,111,108,115,40,41,0,0,0,0,100,103,115,101,113,117,0,0,66,0,0,0,0,0,0,0,100,117,116,105,108,46,99,0,109,95,105,115,73,110,105,116,105,97,108,105,122,101,100,32,38,38,32,34,68,101,99,111,109,112,111,115,105,116,105,111,110,32,105,115,32,110,111,116,32,105,110,105,116,105,97,108,105,122,101,100,46,34,0,0,117,116,105,108,46,99,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,82,101,100,117,120,46,104,0,0,40,33,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,82,111,119,115,61,61,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,40,33,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,67,111,108,115,61,61,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,40,33,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,61,61,68,121,110,97,109,105,99,32,38,38,32,77,97,120,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,82,111,119,115,60,61,77,97,120,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,40,33,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,61,61,68,121,110,97,109,105,99,32,38,38,32,77,97,120,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,67,111,108,115,60,61,77,97,120,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,110,98,82,111,119,115,62,61,48,32,38,38,32,110,98,67,111,108,115,62,61,48,32,38,38,32,34,73,110,118,97,108,105,100,32,115,105,122,101,115,32,119,104,101,110,32,114,101,115,105,122,105,110,103,32,97,32,109,97,116,114,105,120,32,111,114,32,97,114,114,97,121,46,34,0,0,0,0,0,0,100,109,101,109,111,114,121,46,99,0,0,0,0,0,0,0,77,97,108,108,111,99,32,102,97,105,108,115,32,102,111,114,32,108,111,99,97,108,32,119,111,114,107,91,93,46,0,0,77,0,0,0,0,0,0,0,66,0,0,0,0,0,0,0,118,101,99,83,105,122,101,32,62,61,32,48,0,0,0,0,73,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,115,116,97,116,45,62,117,116,105,109,101,0,0,0,0,100,103,115,99,111,110,0,0,109,97,116,46,114,111,119,115,40,41,62,48,32,38,38,32,109,97,116,46,99,111,108,115,40,41,62,48,32,38,38,32,34,121,111,117,32,97,114,101,32,117,115,105,110,103,32,97,110,32,101,109,112,116,121,32,109,97,116,114,105,120,34,0,67,0,0,0,0,0,0,0,114,111,119,115,40,41,61,61,98,46,114,111,119,115,40,41,32,38,38,32,34,83,117,112,101,114,76,85,58,58,115,111,108,118,101,40,41,58,32,105,110,118,97,108,105,100,32,110,117,109,98,101,114,32,111,102,32,114,111,119,115,32,111,102,32,116,104,101,32,114,105,103,104,116,32,104,97,110,100,32,115,105,100,101,32,109,97,116,114,105,120,32,98,34,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,77,97,112,66,97,115,101,46,104,0,0,0,0,0,0,0,0,105,111,115,95,98,97,115,101,58,58,99,108,101,97,114,0,109,101,109,111,114,121,46,99,0,0,0,0,0,0,0,0,79,0,0,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,114,111,119,32,62,61,32,48,32,38,38,32,114,111,119,32,60,32,114,111,119,115,40,41,32,38,38,32,99,111,108,32,62,61,32,48,32,38,38,32,99,111,108,32,60,32,99,111,108,115,40,41,0,0,0,0,105,110,100,101,120,32,62,61,32,48,32,38,38,32,105,110,100,101,120,32,60,32,115,105,122,101,40,41,0,0,0,0,109,95,105,115,73,110,105,116,105,97,108,105,122,101,100,32,38,38,32,34,83,117,112,101,114,76,85,32,105,115,32,110,111,116,32,105,110,105,116,105,97,108,105,122,101,100,46,34,0,0,0,0,0,0,0,0,118,101,99,83,105,122,101,32,62,61,32,48,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,109,97,114,107,101,114,46,0,0,0,0,0,0,0,0,82,0,0,0,0,0,0,0,42,42,32,79,110,32,101,110,116,114,121,32,116,111,32,37,54,115,44,32,112,97,114,97,109,101,116,101,114,32,110,117,109,98,101,114,32,37,50,100,32,104,97,100,32,97,110,32,105,108,108,101,103,97,108,32,118,97,108,117,101,10,0,0,40,33,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,82,111,119,115,61,61,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,40,33,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,67,111,108,115,61,61,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,40,33,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,61,61,68,121,110,97,109,105,99,32,38,38,32,77,97,120,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,82,111,119,115,60,61,77,97,120,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,40,33,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,61,61,68,121,110,97,109,105,99,32,38,38,32,77,97,120,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,67,111,108,115,60,61,77,97,120,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,110,98,82,111,119,115,62,61,48,32,38,38,32,110,98,67,111,108,115,62,61,48,32,38,38,32,34,73,110,118,97,108,105,100,32,115,105,122,101,115,32,119,104,101,110,32,114,101,115,105,122,105,110,103,32,97,32,109,97,116,114,105,120,32,111,114,32,97,114,114,97,121,46,34,0,0,0,0,0,0,40,40,83,105,122,101,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,38,38,32,40,77,97,120,83,105,122,101,65,116,67,111,109,112,105,108,101,84,105,109,101,61,61,68,121,110,97,109,105,99,32,124,124,32,115,105,122,101,60,61,77,97,120,83,105,122,101,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,124,124,32,83,105,122,101,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,115,105,122,101,41,32,38,38,32,115,105,122,101,62,61,48,0,0,0,0,0,0,0,115,112,95,105,101,110,118,0,105,110,100,101,120,32,62,61,32,48,32,38,38,32,105,110,100,101,120,32,60,32,115,105,122,101,40,41,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102], "i8", ALLOC_NONE, Runtime.GLOBAL_BASE);
- /* memory initializer */ allocate([97,105,108,115,32,102,111,114,32,108,108,105,115,116,46,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,77,97,116,114,105,120,46,104,0,40,40,83,105,122,101,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,38,38,32,40,77,97,120,83,105,122,101,65,116,67,111,109,112,105,108,101,84,105,109,101,61,61,68,121,110,97,109,105,99,32,124,124,32,115,105,122,101,60,61,77,97,120,83,105,122,101,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,124,124,32,83,105,122,101,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,115,105,122,101,41,32,38,38,32,115,105,122,101,62,61,48,0,0,0,0,0,0,0,105,111,115,116,114,101,97,109,0,0,0,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,113,115,105,122,101,46,0,100,105,109,32,62,61,32,48,0,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,83,112,97,114,115,101,67,111,114,101,47,83,112,97,114,115,101,77,97,116,114,105,120,46,104,0,0,0,0,0,105,116,45,62,114,111,119,40,41,62,61,48,32,38,38,32,105,116,45,62,114,111,119,40,41,60,109,97,116,46,114,111,119,115,40,41,32,38,38,32,105,116,45,62,99,111,108,40,41,62,61,48,32,38,38,32,105,116,45,62,99,111,108,40,41,60,109,97,116,46,99,111,108,115,40,41,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,100,104,101,97,100,46,0,67,0,0,0,0,0,0,0,109,95,105,110,110,101,114,78,111,110,90,101,114,111,115,91,111,117,116,101,114,93,60,61,40,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,43,49,93,32,45,32,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,93,41,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,68,101,110,115,101,67,111,101,102,102,115,66,97,115,101,46,104,0,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,80,108,97,105,110,79,98,106,101,99,116,66,97,115,101,46,104,0,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,105,110,118,112,46,0,0,118,101,99,116,111,114,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,68,101,110,115,101,67,111,101,102,102,115,66,97,115,101,46,104,0,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,67,119,105,115,101,78,117,108,108,97,114,121,79,112,46,104,0,73,110,118,97,108,105,100,32,73,83,80,69,67,0,0,0,114,111,119,32,62,61,32,48,32,38,38,32,114,111,119,32,60,32,114,111,119,115,40,41,32,38,38,32,99,111,108,32,62,61,32,48,32,38,38,32,99,111,108,32,60,32,99,111,108,115,40,41,0,0,0,0,101,120,112,108,105,99,105,116,108,121,46,10,0,0,0,0,37,46,48,76,102,0,0,0,76,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,68,101,110,115,101,67,111,101,102,102,115,66,97,115,101,46,104,0,0,0,0,0,0,0,0,110,98,82,111,119,115,32,62,61,32,48,32,38,38,32,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,124,124,32,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,110,98,82,111,119,115,41,32,38,38,32,110,98,67,111,108,115,32,62,61,32,48,32,38,38,32,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,124,124,32,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,110,98,67,111,108,115,41,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,98,117,102,32,105,110,32,109,120,67,97,108,108,111,99,73,110,116,40,41,0,0,0,85,0,0,0,0,0,0,0,77,97,116,114,105,120,32,105,115,32,110,111,116,32,115,113,117,97,114,101,0,0,0,0,99,111,100,101,32,111,102,32,114,111,117,116,105,110,101,32,68,76,65,77,67,50,44,32,10,32,111,116,104,101,114,119,105,115,101,32,115,117,112,112,108,121,32,69,77,73,78,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,105,119,111,114,107,91,93,0,0,0,0,0,0,0,0,109,111,110,101,121,95,103,101,116,32,101,114,114,111,114,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,65,67,115,116,111,114,101,0,0,0,0,0,0,0,0,105,110,100,101,120,32,62,61,32,48,32,38,38,32,105,110,100,101,120,32,60,32,115,105,122,101,40,41,0,0,0,0,77,97,108,108,111,99,32,102,97,105,108,115,32,102,111,114,32,65,91,93,0,0,0,0,83,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,98,95,114,111,119,105,110,100,91,93,0,0,0,0,0,83,97,116,0,0,0,0,0,112,108,101,97,115,101,32,99,111,109,109,101,110,116,32,111,117,116,32,10,32,116,104,101,32,73,70,32,98,108,111,99,107,32,97,115,32,109,97,114,107,101,100,32,119,105,116,104,105,110,32,116,104,101,0,0,37,76,102,0,0,0,0,0,70,114,105,0,0,0,0,0,84,104,117,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,65,45,62,83,116,111,114,101,0,0,0,0,0,0,0,33,105,115,67,111,109,112,114,101,115,115,101,100,40,41,0,87,101,100,0,0,0,0,0,84,117,101,0,0,0,0,0,115,105,122,101,61,61,98,46,114,111,119,115,40,41,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,101,120,112,97,110,100,101,114,115,0,0,0,0,0,0,77,111,110,0,0,0,0,0,83,117,110,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,83,117,112,101,114,76,85,83,117,112,112,111,114,116,47,83,117,112,101,114,76,85,83,117,112,112,111,114,116,46,104,0,0,0,0,0,0,0,83,97,116,117,114,100,97,121,0,0,0,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,70,114,105,100,97,121,0,0,82,0,0,0,0,0,0,0,84,104,117,114,115,100,97,121,0,0,0,0,0,0,0,0,80,114,101,99,105,115,105,111,110,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,98,95,99,111,108,112,116,114,91,93,0,0,0,0,0,83,0,0,0,0,0,0,0,87,101,100,110,101,115,100,97,121,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,77,97,112,66,97,115,101,46,104,0,0,0,0,0,0,0,0,73,102,44,32,97,102,116,101,114,32,105,110,115,112,101,99,116,105,111,110,44,32,116,104,101,32,118,97,108,117,101,32,69,77,73,78,32,108,111,111,107,115,32,97,99,99,101,112,116,97,98,108,101,0,0,0,84,117,101,115,100,97,121,0,98,97,115,105,99,95,115,116,114,105,110,103,0,0,0,0,79,0,0,0,0,0,0,0,77,111,110,100,97,121,0,0,73,0,0,0,0,0,0,0,83,117,110,100,97,121,0,0,66,0,0,0,0,0,0,0,115,114,99,47,100,105,115,107,95,104,97,114,109,111,110,105,99,95,109,97,112,46,99,112,112,0,0,0,0,0,0,0,83,0,0,0,97,0,0,0,116,0,0,0,0,0,0,0,117,110,115,112,101,99,105,102,105,101,100,32,105,111,115,116,114,101,97,109,95,99,97,116,101,103,111,114,121,32,101,114,114,111,114,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,98,117,102,32,105,110,32,105,110,116,77,97,108,108,111,99,40,41,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,67,119,105,115,101,66,105,110,97,114,121,79,112,46,104,0,0,70,0,0,0,114,0,0,0,105,0,0,0,0,0,0,0,84,0,0,0,104,0,0,0,117,0,0,0,0,0,0,0,109,95,102,97,99,116,111,114,105,122,97,116,105,111,110,73,115,79,107,32,38,38,32,34,84,104,101,32,100,101,99,111,109,112,111,115,105,116,105,111,110,32,105,115,32,110,111,116,32,105,110,32,97,32,118,97,108,105,100,32,115,116,97,116,101,32,102,111,114,32,115,111,108,118,105,110,103,44,32,121,111,117,32,109,117,115,116,32,102,105,114,115,116,32,99,97,108,108,32,101,105,116,104,101,114,32,99,111,109,112,117,116,101,40,41,32,111,114,32,97,110,97,108,121,122,101,80,97,116,116,101,114,110,40,41,47,102,97,99,116,111,114,105,122,101,40,41,34,0,0,0,0,87,0,0,0,101,0,0,0,100,0,0,0,0,0,0,0,84,0,0,0,117,0,0,0,101,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,116,95,114,111,119,105,110,100,91,93,0,77,0,0,0,111,0,0,0,110,0,0,0,0,0,0,0,69,77,73,78,32,61,32,37,56,105,10,0,0,0,0,0,83,0,0,0,117,0,0,0,110,0,0,0,0,0,0,0,84,114,97,110,115,112,111,115,101,0,0,0,0,0,0,0,83,0,0,0,97,0,0,0,116,0,0,0,117,0,0,0,114,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,77,97,112,66,97,115,101,46,104,0,0,0,0,0,0,0,0,70,0,0,0,114,0,0,0,105,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,83,112,97,114,115,101,67,111,114,101,47,83,112,97,114,115,101,77,97,116,114,105,120,46,104,0,0,0,0,0,84,0,0,0,104,0,0,0,117,0,0,0,114,0,0,0,115,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,119,0,0,0,0,0,0,0,87,0,0,0,101,0,0,0,100,0,0,0,110,0,0,0,101,0,0,0,115,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,97,76,104,115,46,114,111,119,115,40,41,32,61,61,32,97,82,104,115,46,114,111,119,115,40,41,32,38,38,32,97,76,104,115,46,99,111,108,115,40,41,32,61,61,32,97,82,104,115,46,99,111,108,115,40,41,0,0,0,0,0,0,0,0,84,0,0,0,117,0,0,0,101,0,0,0,115,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,77,0,0,0,111,0,0,0,110,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,83,0,0,0,117,0,0,0,110,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,78,111,116,32,105,109,112,108,101,109,101,110,116,101,100,46,0,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,116,95,99,111,108,112,116,114,91,93,0,0,0,0,0,68,101,99,0,0,0,0,0,10,10,32,87,65,82,78,73,78,71,46,32,84,104,101,32,118,97,108,117,101,32,69,77,73,78,32,109,97,121,32,98,101,32,105,110,99,111,114,114,101,99,116,58,45,32,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,66,108,111,99,107,46,104,0,0,78,111,118,0,0,0,0,0,78,111,110,45,117,110,105,116,0,0,0,0,0,0,0,0,79,99,116,0,0,0,0,0,83,101,112,0,0,0,0,0,118,101,99,83,105,122,101,32,62,61,32,48,0,0,0,0,65,117,103,0,0,0,0,0,98,101,103,105,110,32,99,111,109,112,117,116,105,110,103,0,101,114,114,111,114,32,111,99,99,117,114,114,101,100,32,105,110,32,102,105,108,101,58,32,37,115,44,32,102,117,110,99,116,105,111,110,58,32,37,115,44,32,108,105,110,101,58,32,37,100,10,0,0,0,0,0,95,115,111,108,118,101,0,0,111,112,101,114,97,116,111,114,40,41,0,0,0,0,0,0,115,111,108,118,101,0,0,0,105,110,102,111,0,0,0,0,108,97,122,121,65,115,115,105,103,110,0,0,0,0,0,0,108,97,122,121,65,115,115,105,103,110,0,0,0,0,0,0,115,101,116,95,102,114,111,109,95,116,114,105,112,108,101,116,115,0,0,0,0,0,0,0,115,101,116,95,102,114,111,109,95,116,114,105,112,108,101,116,115,0,0,0,0,0,0,0,114,117,110,0,0,0,0,0,114,117,110,0,0,0,0,0,102,97,99,116,111,114,105,122,101,0,0,0,0,0,0,0,77,97,112,66,97,115,101,0,77,97,112,66,97,115,101,0,77,97,112,66,97,115,101,0,77,97,112,66,97,115,101,0,77,97,112,66,97,115,101,0,77,97,116,114,105,120,0,0,77,97,116,114,105,120,0,0,66,108,111,99,107,0,0,0,66,108,111,99,107,0,0,0,65,114,114,97,121,0,0,0,114,101,115,105,122,101,0,0,114,101,115,105,122,101,0,0,114,101,115,105,122,101,0,0,114,101,115,105,122,101,0,0,111,112,101,114,97,116,111,114,91,93,0,0,0,0,0,0,111,112,101,114,97,116,111,114,91,93,0,0,0,0,0,0,111,112,101,114,97,116,111,114,91,93,0,0,0,0,0,0,111,112,101,114,97,116,111,114,40,41,0,0,0,0,0,0,111,112,101,114,97,116,111,114,91,93,0,0,0,0,0,0,111,112,101,114,97,116,111,114,40,41,0,0,0,0,0,0,111,112,101,114,97,116,111,114,40,41,0,0,0,0,0,0,111,112,101,114,97,116,111,114,40,41,0,0,0,0,0,0,67,119,105,115,101,78,117,108,108,97,114,121,79,112,0,0,67,119,105,115,101,78,117,108,108,97,114,121,79,112,0,0,67,119,105,115,101,66,105,110,97,114,121,79,112,0,0,0,105,110,115,101,114,116,66,97,99,107,85,110,99,111,109,112,114,101,115,115,101,100,0,0,115,117,109,117,112,68,117,112,108,105,99,97,116,101,115,0,115,116,97,114,116,86,101,99,0,0,0,0,0,0,0,0,99,111,101,102,102,82,101,102,0,0,0,0,0,0,0,0,114,101,115,101,114,118,101,0,105,110,115,101,114,116,0,0,105,110,115,101,114,116,66,97,99,107,66,121,79,117,116,101,114,73,110,110,101,114,0,0,105,110,115,101,114,116,85,110,99,111,109,112,114,101,115,115,101,100,0,0,0,0,0,0,105,110,115,101,114,116,66,97,99,107,85,110,99,111,109,112,114,101,115,115,101,100,0,0,115,117,109,117,112,68,117,112,108,105,99,97,116,101,115,0,115,116,97,114,116,86,101,99,0,0,0,0,0,0,0,0,99,111,101,102,102,82,101,102,0,0,0,0,0,0,0,0,114,101,115,101,114,118,101,0,105,110,115,101,114,116,0,0,105,110,115,101,114,116,66,97,99,107,66,121,79,117,116,101,114,73,110,110,101,114,0,0,105,110,115,101,114,116,85,110,99,111,109,112,114,101,115,115,101,100,0,0,0,0,0,0,80,114,111,100,117,99,116,66,97,115,101,0,0,0,0,0,2,0,0,192,3,0,0,192,4,0,0,192,5,0,0,192,6,0,0,192,7,0,0,192,8,0,0,192,9,0,0,192,10,0,0,192,11,0,0,192,12,0,0,192,13,0,0,192,14,0,0,192,15,0,0,192,16,0,0,192,17,0,0,192,18,0,0,192,19,0,0,192,20,0,0,192,21,0,0,192,22,0,0,192,23,0,0,192,24,0,0,192,25,0,0,192,26,0,0,192,27,0,0,192,28,0,0,192,29,0,0,192,30,0,0,192,31,0,0,192,0,0,0,179,1,0,0,195,2,0,0,195,3,0,0,195,4,0,0,195,5,0,0,195,6,0,0,195,7,0,0,195,8,0,0,195,9,0,0,195,10,0,0,195,11,0,0,195,12,0,0,195,13,0,0,211,14,0,0,195,15,0,0,195,0,0,12,187,1,0,12,195,2,0,12,195,3,0,12,195,4,0,12,211,0,0,0,0,100,105,115,107,95,104,97,114,109,111,110,105,99,95,109,97,112,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,48,49,50,51,52,53,54,55,56,57,0,0,0,0,0,0,48,49,50,51,52,53,54,55,56,57,0,0,0,0,0,0,37,0,0,0,89,0,0,0,45,0,0,0,37,0,0,0,109,0,0,0,45,0,0,0,37,0,0,0,100,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,0,0,0,0,37,0,0,0,73,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,32,0,0,0,37,0,0,0,112,0,0,0,0,0,0,0,37,0,0,0,109,0,0,0,47,0,0,0,37,0,0,0,100,0,0,0,47,0,0,0,37,0,0,0,121,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,37,72,58,37,77,58,37,83,37,72,58,37,77,0,0,0,37,73,58,37,77,58,37,83,32,37,112,0,0,0,0,0,37,89,45,37,109,45,37,100,37,109,47,37,100,47,37,121,37,72,58,37,77,58,37,83,37,0,0,0,0,0,0,0,37,112,0,0,0,0,0,0,0,0,0,0,32,83,0,0,34,0,0,0,130,0,0,0,70,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,83,0,0,212,0,0,0,176,0,0,0,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,83,0,0,78,0,0,0,30,1,0,0,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,83,0,0,106,0,0,0,8,0,0,0,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,83,0,0,106,0,0,0,22,0,0,0,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,120,83,0,0,182,0,0,0,92,0,0,0,54,0,0,0,2,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,152,83,0,0,20,1,0,0,204,0,0,0,54,0,0,0,4,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,184,83,0,0,174,0,0,0,206,0,0,0,54,0,0,0,8,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,216,83,0,0,22,1,0,0,154,0,0,0,54,0,0,0,6,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,120,84,0,0,18,1,0,0,104,0,0,0,54,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,152,84,0,0,172,0,0,0,122,0,0,0,54,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,184,84,0,0,42,0,0,0,124,0,0,0,54,0,0,0,122,0,0,0,4,0,0,0,30,0,0,0,6,0,0,0,20,0,0,0,54,0,0,0,2,0,0,0,248,255,255,255,184,84,0,0,20,0,0,0,10,0,0,0,32,0,0,0,14,0,0,0,2,0,0,0,30,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,84,0,0,8,1,0,0,250,0,0,0,54,0,0,0,18,0,0,0,16,0,0,0,58,0,0,0,26,0,0,0,18,0,0,0,2,0,0,0,4,0,0,0,248,255,255,255,224,84,0,0,64,0,0,0,104,0,0,0,116,0,0,0,126,0,0,0,92,0,0,0,42,0,0,0,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,85,0,0,84,0,0,0,208,0,0,0,54,0,0,0,46,0,0,0,38,0,0,0,8,0,0,0,44,0,0,0,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,85,0,0,68,0,0,0,74,0,0,0,54,0,0,0,40,0,0,0,78,0,0,0,12,0,0,0,58,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,85,0,0,12,1,0,0,2,0,0,0,54,0,0,0,28,0,0,0,34,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,85,0,0,50,0,0,0,232,0,0,0,54,0,0,0,12,0,0,0,14,0,0,0,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,85,0,0,238,0,0,0,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,85,0,0,32,0,0,0,152,0,0,0,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,85,0,0,6,0,0,0,188,0,0,0,54,0,0,0,8,0,0,0,6,0,0,0,12,0,0,0,4,0,0,0,10,0,0,0,4,0,0,0,2,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,85,0,0,110,0,0,0,20,0,0,0,54,0,0,0,22,0,0,0,26,0,0,0,32,0,0,0,24,0,0,0,22,0,0,0,8,0,0,0,6,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,85,0,0,44,0,0,0,28,0,0,0,54,0,0,0,46,0,0,0,44,0,0,0,36,0,0,0,38,0,0,0,28,0,0,0,42,0,0,0,34,0,0,0,52,0,0,0,50,0,0,0,48,0,0,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,85,0,0,60,0,0,0,4,0,0,0,54,0,0,0,76,0,0,0,68,0,0,0,62,0,0,0,64,0,0,0,56,0,0,0,66,0,0,0,60,0,0,0,74,0,0,0,72,0,0,0,70,0,0,0,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,86,0,0,80,0,0,0,102,0,0,0,54,0,0,0,6,0,0,0,14,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,86,0,0,30,0,0,0,190,0,0,0,54,0,0,0,16,0,0,0,18,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,86,0,0,12,0,0,0,202,0,0,0,54,0,0,0,2,0,0,0,10,0,0,0,14,0,0,0,120,0,0,0,98,0,0,0,24,0,0,0,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,86,0,0,196,0,0,0,146,0,0,0,54,0,0,0,14,0,0,0,16,0,0,0,18,0,0,0,50,0,0,0,8,0,0,0,20,0,0,0,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,86,0,0,196,0,0,0,24,0,0,0,54,0,0,0,6,0,0,0,4,0,0,0,4,0,0,0,96,0,0,0,60,0,0,0,10,0,0,0,130,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,86,0,0,196,0,0,0,112,0,0,0,54,0,0,0,12,0,0,0,8,0,0,0,22,0,0,0,28,0,0,0,68,0,0,0,8,0,0,0,132,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,86,0,0,196,0,0,0,38,0,0,0,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,176,86,0,0,64,0,0,0,170,0,0,0,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,86,0,0,196,0,0,0,86,0,0,0,54,0,0,0,24,0,0,0,2,0,0,0,4,0,0,0,10,0,0,0,16,0,0,0,34,0,0,0,28,0,0,0,8,0,0,0,4,0,0,0,8,0,0,0,14,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,86,0,0,28,1,0,0,40,0,0,0,54,0,0,0,10,0,0,0,6,0,0,0,22,0,0,0,42,0,0,0,8,0,0,0,6,0,0,0,30,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,87,0,0,76,0,0,0,246,0,0,0,72,0,0,0,2,0,0,0,18,0,0,0,40,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,32,87,0,0,220,0,0,0,24,1,0,0,56,0,0,0,248,255,255,255,32,87,0,0,52,0,0,0,66,0,0,0,192,255,255,255,192,255,255,255,32,87,0,0,218,0,0,0,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,87,0,0,196,0,0,0,94,0,0,0,54,0,0,0,12,0,0,0,8,0,0,0,22,0,0,0,28,0,0,0,68,0,0,0,8,0,0,0,132,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,87,0,0,196,0,0,0,178,0,0,0,54,0,0,0,12,0,0,0,8,0,0,0,22,0,0,0,28,0,0,0,68,0,0,0,8,0,0,0,132,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,87,0,0,56,0,0,0,236,0,0,0,62,0,0,0,44,0,0,0,28,0,0,0,2,0,0,0,48,0,0,0,80,0,0,0,22,0,0,0,124,0,0,0,12,0,0,0,30,0,0,0,20,0,0,0,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,87,0,0,144,0,0,0,2,1,0,0,20,0,0,0,26,0,0,0,16,0,0,0,16,0,0,0,82,0,0,0,100,0,0,0,38,0,0,0,26,0,0,0,24,0,0,0,6,0,0,0,2,0,0,0,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,87,0,0,10,0,0,0,134,0,0,0,62,0,0,0,44,0,0,0,32,0,0,0,12,0,0,0,48,0,0,0,80,0,0,0,22,0,0,0,6,0,0,0,12,0,0,0,34,0,0,0,20,0,0,0,24,0,0,0,0,0,0,0,0,0,0,0,104,0,0,0,0,0,0,0,120,87,0,0,132,0,0,0,114,0,0,0,152,255,255,255,152,255,255,255,120,87,0,0,96,0,0,0,194,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,200,87,0,0,48,0,0,0,230,0,0,0,252,255,255,255,252,255,255,255,200,87,0,0,160,0,0,0,142,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,224,87,0,0,240,0,0,0,4,1,0,0,252,255,255,255,252,255,255,255,224,87,0,0,120,0,0,0,216,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,248,87,0,0,98,0,0,0,32,1,0,0,248,255,255,255,248,255,255,255,248,87,0,0,198,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,16,88,0,0,118,0,0,0,228,0,0,0,248,255,255,255,248,255,255,255,16,88,0,0,150,0,0,0,58,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,88,0,0,234,0,0,0,72,0,0,0,46,0,0,0,32,0,0,0,18,0,0,0,4,0,0,0,44,0,0,0,80,0,0,0,22,0,0,0,86,0,0,0,12,0,0,0,20,0,0,0,20,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,88,0,0,226,0,0,0,200,0,0,0,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,88,0,0,14,1,0,0,254,0,0,0,16,0,0,0,26,0,0,0,16,0,0,0,16,0,0,0,56,0,0,0,100,0,0,0,38,0,0,0,26,0,0,0,24,0,0,0,6,0,0,0,36,0,0,0,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,88,0,0,168,0,0,0,192,0,0,0,38,0,0,0,44,0,0,0,32,0,0,0,12,0,0,0,84,0,0,0,80,0,0,0,22,0,0,0,6,0,0,0,12,0,0,0,34,0,0,0,46,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,88,0,0,248,0,0,0,158,0,0,0,54,0,0,0,62,0,0,0,118,0,0,0,36,0,0,0,80,0,0,0,4,0,0,0,32,0,0,0,52,0,0,0,24,0,0,0,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,88,0,0,116,0,0,0,62,0,0,0,54,0,0,0,110,0,0,0,4,0,0,0,68,0,0,0,76,0,0,0,78,0,0,0,26,0,0,0,114,0,0,0,54,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,88,0,0,252,0,0,0,128,0,0,0,54,0,0,0,16,0,0,0,58,0,0,0,6,0,0,0,48,0,0,0,82,0,0,0,56,0,0,0,90,0,0,0,60,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,0,0,82,0,0,0,186,0,0,0,54,0,0,0,102,0,0,0,106,0,0,0,30,0,0,0,74,0,0,0,28,0,0,0,22,0,0,0,74,0,0,0,72,0,0,0,70,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,89,0,0,100,0,0,0,18,0,0,0,40,0,0,0,26,0,0,0,16,0,0,0,16,0,0,0,82,0,0,0,100,0,0,0,38,0,0,0,66,0,0,0,76,0,0,0,12,0,0,0,2,0,0,0,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,89,0,0,16,0,0,0,242,0,0,0,66,0,0,0,44,0,0,0,32,0,0,0,12,0,0,0,48,0,0,0,80,0,0,0,22,0,0,0,94,0,0,0,22,0,0,0,2,0,0,0,20,0,0,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,88,89,0,0,16,1,0,0,214,0,0,0,70,0,0,0,166,0,0,0,10,0,0,0,2,0,0,0,6,0,0,0,8,0,0,0,0,0,0,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,83,116,56,98,97,100,95,99,97,115,116,0,0,0,0,0,83,116,49,51,114,117,110,116,105,109,101,95,101,114,114,111,114,0,0,0,0,0,0,0,83,116,49,50,108,101,110,103,116,104,95,101,114,114,111,114,0,0,0,0,0,0,0,0,83,116,49,49,108,111,103,105,99,95,101,114,114,111,114,0,78,83,116,51,95,95,49,57,116,105,109,101,95,98,97,115,101,69,0,0,0,0,0,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,112,117,116,73,119,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,0,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,112,117,116,73,99,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,0,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,103,101,116,73,119,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,0,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,103,101,116,73,99,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,0,0,78,83,116,51,95,95,49,57,98,97,115,105,99,95,105,111,115,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,57,98,97,115,105,99,95,105,111,115,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,112,117,116,73,119,69,69,0,0,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,112,117,116,73,99,69,69,0,0,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,103,101,116,73,119,69,69,0,0,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,103,101,116,73,99,69,69,0,0,0,78,83,116,51,95,95,49,56,116,105,109,101,95,112,117,116,73,119,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,0,0,0,78,83,116,51,95,95,49,56,116,105,109,101,95,112,117,116,73,99,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,0,0,0,78,83,116,51,95,95,49,56,116,105,109,101,95,103,101,116,73,119,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,0,0,0,78,83,116,51,95,95,49,56,116,105,109,101,95,103,101,116,73,99,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,0,0,0,78,83,116,51,95,95,49,56,110,117,109,112,117,110,99,116,73,119,69,69,0,0,0,0,78,83,116,51,95,95,49,56,110,117,109,112,117,110,99,116,73,99,69,69,0,0,0,0,78,83,116,51,95,95,49,56,109,101,115,115,97,103,101,115,73,119,69,69,0,0,0,0,78,83,116,51,95,95,49,56,109,101,115,115,97,103,101,115,73,99,69,69,0,0,0,0,78,83,116,51,95,95,49,56,105,111,115,95,98,97,115,101,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,56,105,111,115,95,98,97,115,101,55,102,97,105,108,117,114,101,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,55,110,117,109,95,112,117,116,73,119,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,55,110,117,109,95,112,117,116,73,99,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,55,110,117,109,95,103,101,116,73,119,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,55,110,117,109,95,103,101,116,73,99,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,55,99,111,108,108,97,116,101,73,119,69,69,0,0,0,0,0,78,83,116,51,95,95,49,55,99,111,108,108,97,116,101,73,99,69,69,0,0,0,0,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,119,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,99,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,68,115,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,0,0,0,0,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,68,105,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,0,0,0,0,0,78,83,116,51,95,95,49,54,108,111,99,97,108,101,53,102,97,99,101,116,69,0,0,0,78,83,116,51,95,95,49,54,108,111,99,97,108,101,53,95,95,105,109,112,69,0,0,0,78,83,116,51,95,95,49,53,99,116,121,112,101,73,119,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,53,99,116,121,112,101,73,99,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,50,48,95,95,116,105,109,101,95,103,101,116,95,99,95,115,116,111,114,97,103,101,73,119,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,50,48,95,95,116,105,109,101,95,103,101,116,95,99,95,115,116,111,114,97,103,101,73,99,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,57,95,95,105,111,115,116,114,101,97,109,95,99,97,116,101,103,111,114,121,69,0,0,0,78,83,116,51,95,95,49,49,56,98,97,115,105,99,95,115,116,114,105,110,103,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,99,69,69,69,69,0,0,0,0,78,83,116,51,95,95,49,49,55,95,95,119,105,100,101,110,95,102,114,111,109,95,117,116,102,56,73,76,106,51,50,69,69,69,0,0,0,0,0,0,78,83,116,51,95,95,49,49,54,95,95,110,97,114,114,111,119,95,116,111,95,117,116,102,56,73,76,106,51,50,69,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,53,98,97,115,105,99,95,115,116,114,105,110,103,98,117,102,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,99,69,69,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,53,98,97,115,105,99,95,115,116,114,101,97,109,98,117,102,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,53,98,97,115,105,99,95,115,116,114,101,97,109,98,117,102,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,52,101,114,114,111,114,95,99,97,116,101,103,111,114,121,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,52,98,97,115,105,99,95,111,102,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,78,83,116,51,95,95,49,49,52,98,97,115,105,99,95,105,111,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,78,83,116,51,95,95,49,49,52,95,95,115,104,97,114,101,100,95,99,111,117,110,116,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,52,95,95,110,117,109,95,112,117,116,95,98,97,115,101,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,52,95,95,110,117,109,95,103,101,116,95,98,97,115,101,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,51,109,101,115,115,97,103,101,115,95,98,97,115,101,69,0,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,111,115,116,114,101,97,109,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,0,0,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,111,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,0,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,105,115,116,114,101,97,109,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115], "i8", ALLOC_NONE, Runtime.GLOBAL_BASE+10240);
- /* memory initializer */ allocate([73,119,69,69,69,69,0,0,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,105,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,0,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,102,105,108,101,98,117,102,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,0,78,83,116,51,95,95,49,49,50,115,121,115,116,101,109,95,101,114,114,111,114,69,0,0,78,83,116,51,95,95,49,49,50,99,111,100,101,99,118,116,95,98,97,115,101,69,0,0,78,83,116,51,95,95,49,49,50,95,95,100,111,95,109,101,115,115,97,103,101,69,0,0,78,83,116,51,95,95,49,49,49,95,95,115,116,100,111,117,116,98,117,102,73,119,69,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,49,95,95,115,116,100,111,117,116,98,117,102,73,99,69,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,112,117,116,73,119,69,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,112,117,116,73,99,69,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,103,101,116,73,119,69,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,103,101,116,73,99,69,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,119,76,98,49,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,119,76,98,48,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,99,76,98,49,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,99,76,98,48,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,95,98,97,115,101,69,0,0,0,0,78,83,116,51,95,95,49,49,48,99,116,121,112,101,95,98,97,115,101,69,0,0,0,0,78,83,116,51,95,95,49,49,48,95,95,116,105,109,101,95,112,117,116,69,0,0,0,0,78,83,116,51,95,95,49,49,48,95,95,115,116,100,105,110,98,117,102,73,119,69,69,0,78,83,116,51,95,95,49,49,48,95,95,115,116,100,105,110,98,117,102,73,99,69,69,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,0,0,0,0,72,70,0,0,0,0,0,0,88,70,0,0,0,0,0,0,104,70,0,0,24,83,0,0,0,0,0,0,0,0,0,0,120,70,0,0,24,83,0,0,0,0,0,0,0,0,0,0,136,70,0,0,24,83,0,0,0,0,0,0,0,0,0,0,160,70,0,0,96,83,0,0,0,0,0,0,0,0,0,0,184,70,0,0,24,83,0,0,0,0,0,0,0,0,0,0,200,70,0,0,32,70,0,0,224,70,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,128,88,0,0,0,0,0,0,32,70,0,0,40,71,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,136,88,0,0,0,0,0,0,32,70,0,0,112,71,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,144,88,0,0,0,0,0,0,32,70,0,0,184,71,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,152,88,0,0,0,0,0,0,0,0,0,0,0,72,0,0,104,85,0,0,0,0,0,0,0,0,0,0,48,72,0,0,104,85,0,0,0,0,0,0,32,70,0,0,96,72,0,0,0,0,0,0,1,0,0,0,176,87,0,0,0,0,0,0,32,70,0,0,120,72,0,0,0,0,0,0,1,0,0,0,176,87,0,0,0,0,0,0,32,70,0,0,144,72,0,0,0,0,0,0,1,0,0,0,184,87,0,0,0,0,0,0,32,70,0,0,168,72,0,0,0,0,0,0,1,0,0,0,184,87,0,0,0,0,0,0,32,70,0,0,192,72,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,48,89,0,0,0,8,0,0,32,70,0,0,8,73,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,48,89,0,0,0,8,0,0,32,70,0,0,80,73,0,0,0,0,0,0,3,0,0,0,160,86,0,0,2,0,0,0,112,83,0,0,2,0,0,0,0,87,0,0,0,8,0,0,32,70,0,0,152,73,0,0,0,0,0,0,3,0,0,0,160,86,0,0,2,0,0,0,112,83,0,0,2,0,0,0,8,87,0,0,0,8,0,0,0,0,0,0,224,73,0,0,160,86,0,0,0,0,0,0,0,0,0,0,248,73,0,0,160,86,0,0,0,0,0,0,32,70,0,0,16,74,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,192,87,0,0,2,0,0,0,32,70,0,0,40,74,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,192,87,0,0,2,0,0,0,0,0,0,0,64,74,0,0,0,0,0,0,88,74,0,0,56,88,0,0,0,0,0,0,32,70,0,0,120,74,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,24,84,0,0,0,0,0,0,32,70,0,0,192,74,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,48,84,0,0,0,0,0,0,32,70,0,0,8,75,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,72,84,0,0,0,0,0,0,32,70,0,0,80,75,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,96,84,0,0,0,0,0,0,0,0,0,0,152,75,0,0,160,86,0,0,0,0,0,0,0,0,0,0,176,75,0,0,160,86,0,0,0,0,0,0,32,70,0,0,200,75,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,72,88,0,0,2,0,0,0,32,70,0,0,240,75,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,72,88,0,0,2,0,0,0,32,70,0,0,24,76,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,72,88,0,0,2,0,0,0,32,70,0,0,64,76,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,72,88,0,0,2,0,0,0,0,0,0,0,104,76,0,0,168,87,0,0,0,0,0,0,0,0,0,0,128,76,0,0,160,86,0,0,0,0,0,0,32,70,0,0,152,76,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,40,89,0,0,2,0,0,0,32,70,0,0,176,76,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,40,89,0,0,2,0,0,0,0,0,0,0,200,76,0,0,0,0,0,0,240,76,0,0,0,0,0,0,24,77,0,0,80,88,0,0,0,0,0,0,0,0,0,0,56,77,0,0,136,87,0,0,0,0,0,0,0,0,0,0,128,77,0,0,128,86,0,0,0,0,0,0,0,0,0,0,168,77,0,0,128,86,0,0,0,0,0,0,0,0,0,0,208,77,0,0,104,87,0,0,0,0,0,0,0,0,0,0,24,78,0,0,0,0,0,0,80,78,0,0,0,0,0,0,136,78,0,0,0,0,0,0,168,78,0,0,224,87,0,0,0,0,0,0,32,70,0,0,216,78,0,0,3,0,0,0,2,0,0,0,16,88,0,0,2,0,0,0,224,87,0,0,2,8,0,0,0,0,0,0,8,79,0,0,0,0,0,0,40,79,0,0,0,0,0,0,72,79,0,0,0,0,0,0,104,79,0,0,32,70,0,0,128,79,0,0,0,0,0,0,1,0,0,0,248,83,0,0,3,244,255,255,32,70,0,0,176,79,0,0,0,0,0,0,1,0,0,0,8,84,0,0,3,244,255,255,32,70,0,0,224,79,0,0,0,0,0,0,1,0,0,0,248,83,0,0,3,244,255,255,32,70,0,0,16,80,0,0,0,0,0,0,1,0,0,0,8,84,0,0,3,244,255,255,0,0,0,0,64,80,0,0,104,87,0,0,0,0,0,0,0,0,0,0,112,80,0,0,64,83,0,0,0,0,0,0,0,0,0,0,136,80,0,0,0,0,0,0,160,80,0,0,112,87,0,0,0,0,0,0,0,0,0,0,184,80,0,0,96,87,0,0,0,0,0,0,0,0,0,0,216,80,0,0,104,87,0,0,0,0,0,0,0,0,0,0,248,80,0,0,0,0,0,0,24,81,0,0,0,0,0,0,56,81,0,0,0,0,0,0,88,81,0,0,32,70,0,0,120,81,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,32,89,0,0,2,0,0,0,32,70,0,0,152,81,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,32,89,0,0,2,0,0,0,32,70,0,0,184,81,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,32,89,0,0,2,0,0,0,32,70,0,0,216,81,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,32,89,0,0,2,0,0,0,0,0,0,0,248,81,0,0,0,0,0,0,16,82,0,0,0,0,0,0,40,82,0,0,0,0,0,0,64,82,0,0,96,87,0,0,0,0,0,0,0,0,0,0,88,82,0,0,104,87,0,0,0,0,0,0,0,0,0,0,112,82,0,0,120,89,0,0,0,0,0,0,0,0,0,0,152,82,0,0,120,89,0,0,0,0,0,0,0,0,0,0,192,82,0,0,136,89,0,0,0,0,0,0,0,0,0,0,232,82,0,0,16,83,0,0,0,0,0,0,64,0,0,0,0,0,0,0,16,88,0,0,118,0,0,0,228,0,0,0,192,255,255,255,192,255,255,255,16,88,0,0,150,0,0,0,58,0,0,0,104,0,0,0,0,0,0,0,224,87,0,0,240,0,0,0,4,1,0,0,152,255,255,255,152,255,255,255,224,87,0,0,120,0,0,0,216,0,0,0,48,49,50,51,52,53,54,55,56,57,97,98,99,100,101,102,65,66,67,68,69,70,120,88,43,45,112,80,105,73,110,78,0,0,0,0,0,0,0,0], "i8", ALLOC_NONE, Runtime.GLOBAL_BASE+20480);
- 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];
- }
-
-
-
-
- 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:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,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:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86};
-
- 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:"File locking deadlock error",36:"File or path name too long",37:"No record locks available",38:"Function not implemented",39:"Directory not empty",40:"Too many symbolic links",42:"No message of desired type",43:"Identifier removed",44:"Channel number out of range",45:"Level 2 not synchronized",46:"Level 3 halted",47:"Level 3 reset",48:"Link number out of range",49:"Protocol driver not attached",50:"No CSI structure available",51:"Level 2 halted",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",57:"Invalid slot",59:"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",72:"Multihop attempted",73:"Cross mount point (not really error)",74:"Trying to read unreadable message",75:"Value too large for defined data type",76:"Given log. name not unique",77:"f.d. invalid for this operation",78:"Remote address changed",79:"Can access a needed shared lib",80:"Accessing a corrupted shared lib",81:".lib section in a.out corrupted",82:"Attempting to link in too many libs",83:"Attempting to exec a shared library",84:"Illegal byte sequence",86:"Streams pipe error",87:"Too many users",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Unknown protocol",94:"Socket type not supported",95:"Not supported",96:"Protocol family not supported",97:"Address family not supported by protocol family",98:"Address already in use",99:"Address not available",100:"Network interface is not configured",101:"Network is unreachable",102:"Connection reset by network",103:"Connection aborted",104:"Connection reset by peer",105:"No buffer space available",106:"Socket is already connected",107:"Socket is not connected",108:"Can't send after socket shutdown",109:"Too many references",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"Host is unreachable",114:"Socket already connected",115:"Connection already in progress",116:"Stale file handle",122:"Quota exceeded",123:"No medium (in tape drive)",125:"Operation canceled",130:"Previous owner died",131:"State not recoverable"};
-
-
- var ___errno_state=0;function ___setErrNo(value) {
- // For convenient setting and returning of errno.
- HEAP32[((___errno_state)>>2)]=value;
- return value;
- }
-
- 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) {
- // EMSCRIPTEN return '/'' for '/', not an empty string
- if (path === '/') return '/';
- var lastSlash = path.lastIndexOf('/');
- if (lastSlash === -1) return path;
- return path.substr(lastSlash+1);
- },extname:function (path) {
- return PATH.splitPath(path)[3];
- },join:function () {
- var paths = Array.prototype.slice.call(arguments, 0);
- return PATH.normalize(paths.join('/'));
- },join2:function (l, r) {
- return PATH.normalize(l + '/' + r);
- },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={ops_table:null,CONTENT_OWNING:1,CONTENT_FLEXIBLE:2,CONTENT_FIXED:3,mount:function (mount) {
- return MEMFS.createNode(null, '/', 16384 | 0777, 0);
- },createNode:function (parent, name, mode, dev) {
- if (FS.isBlkdev(mode) || FS.isFIFO(mode)) {
- // no supported
- throw new FS.ErrnoError(ERRNO_CODES.EPERM);
- }
- if (!MEMFS.ops_table) {
- MEMFS.ops_table = {
- dir: {
- node: {
- 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
- },
- stream: {
- llseek: MEMFS.stream_ops.llseek
- }
- },
- file: {
- node: {
- getattr: MEMFS.node_ops.getattr,
- setattr: MEMFS.node_ops.setattr
- },
- stream: {
- 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
- }
- },
- link: {
- node: {
- getattr: MEMFS.node_ops.getattr,
- setattr: MEMFS.node_ops.setattr,
- readlink: MEMFS.node_ops.readlink
- },
- stream: {}
- },
- chrdev: {
- node: {
- getattr: MEMFS.node_ops.getattr,
- setattr: MEMFS.node_ops.setattr
- },
- stream: FS.chrdev_stream_ops
- },
- };
- }
- var node = FS.createNode(parent, name, mode, dev);
- if (FS.isDir(node.mode)) {
- node.node_ops = MEMFS.ops_table.dir.node;
- node.stream_ops = MEMFS.ops_table.dir.stream;
- node.contents = {};
- } else if (FS.isFile(node.mode)) {
- node.node_ops = MEMFS.ops_table.file.node;
- node.stream_ops = MEMFS.ops_table.file.stream;
- node.contents = [];
- node.contentMode = MEMFS.CONTENT_FLEXIBLE;
- } else if (FS.isLink(node.mode)) {
- node.node_ops = MEMFS.ops_table.link.node;
- node.stream_ops = MEMFS.ops_table.link.stream;
- } else if (FS.isChrdev(node.mode)) {
- node.node_ops = MEMFS.ops_table.chrdev.node;
- node.stream_ops = MEMFS.ops_table.chrdev.stream;
- }
- node.timestamp = Date.now();
- // add the new node to the parent
- if (parent) {
- parent.contents[name] = node;
- }
- return node;
- },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;
- }
- },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 FS.genericErrors[ERRNO_CODES.ENOENT];
- },mknod:function (parent, name, mode, dev) {
- return MEMFS.createNode(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;
- old_node.parent = new_dir;
- },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.createNode(parent, newname, 0777 | 40960, 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;
- if (position >= contents.length)
- return 0;
- var size = Math.min(contents.length - position, length);
- assert(size >= 0);
- 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
- if (canOwn && offset === 0) {
- node.contents = buffer; // this could be a subarray of Emscripten HEAP, or allocated from some other source.
- node.contentMode = (buffer.buffer === HEAP8.buffer) ? MEMFS.CONTENT_OWNING : MEMFS.CONTENT_FIXED;
- } 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 & 2) &&
- (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 IDBFS={dbs:{},indexedDB:function () {
- return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
- },DB_VERSION:21,DB_STORE_NAME:"FILE_DATA",mount:function (mount) {
- // reuse all of the core MEMFS functionality
- return MEMFS.mount.apply(null, arguments);
- },syncfs:function (mount, populate, callback) {
- IDBFS.getLocalSet(mount, function(err, local) {
- if (err) return callback(err);
-
- IDBFS.getRemoteSet(mount, function(err, remote) {
- if (err) return callback(err);
-
- var src = populate ? remote : local;
- var dst = populate ? local : remote;
-
- IDBFS.reconcile(src, dst, callback);
- });
- });
- },getDB:function (name, callback) {
- // check the cache first
- var db = IDBFS.dbs[name];
- if (db) {
- return callback(null, db);
- }
-
- var req;
- try {
- req = IDBFS.indexedDB().open(name, IDBFS.DB_VERSION);
- } catch (e) {
- return callback(e);
- }
- req.onupgradeneeded = function(e) {
- var db = e.target.result;
- var transaction = e.target.transaction;
-
- var fileStore;
-
- if (db.objectStoreNames.contains(IDBFS.DB_STORE_NAME)) {
- fileStore = transaction.objectStore(IDBFS.DB_STORE_NAME);
- } else {
- fileStore = db.createObjectStore(IDBFS.DB_STORE_NAME);
- }
-
- fileStore.createIndex('timestamp', 'timestamp', { unique: false });
- };
- req.onsuccess = function() {
- db = req.result;
-
- // add to the cache
- IDBFS.dbs[name] = db;
- callback(null, db);
- };
- req.onerror = function() {
- callback(this.error);
- };
- },getLocalSet:function (mount, callback) {
- var entries = {};
-
- function isRealDir(p) {
- return p !== '.' && p !== '..';
- };
- function toAbsolute(root) {
- return function(p) {
- return PATH.join2(root, p);
- }
- };
-
- var check = FS.readdir(mount.mountpoint).filter(isRealDir).map(toAbsolute(mount.mountpoint));
-
- while (check.length) {
- var path = check.pop();
- var stat;
-
- try {
- stat = FS.stat(path);
- } catch (e) {
- return callback(e);
- }
-
- if (FS.isDir(stat.mode)) {
- check.push.apply(check, FS.readdir(path).filter(isRealDir).map(toAbsolute(path)));
- }
-
- entries[path] = { timestamp: stat.mtime };
- }
-
- return callback(null, { type: 'local', entries: entries });
- },getRemoteSet:function (mount, callback) {
- var entries = {};
-
- IDBFS.getDB(mount.mountpoint, function(err, db) {
- if (err) return callback(err);
-
- var transaction = db.transaction([IDBFS.DB_STORE_NAME], 'readonly');
- transaction.onerror = function() { callback(this.error); };
-
- var store = transaction.objectStore(IDBFS.DB_STORE_NAME);
- var index = store.index('timestamp');
-
- index.openKeyCursor().onsuccess = function(event) {
- var cursor = event.target.result;
-
- if (!cursor) {
- return callback(null, { type: 'remote', db: db, entries: entries });
- }
-
- entries[cursor.primaryKey] = { timestamp: cursor.key };
-
- cursor.continue();
- };
- });
- },loadLocalEntry:function (path, callback) {
- var stat, node;
-
- try {
- var lookup = FS.lookupPath(path);
- node = lookup.node;
- stat = FS.stat(path);
- } catch (e) {
- return callback(e);
- }
-
- if (FS.isDir(stat.mode)) {
- return callback(null, { timestamp: stat.mtime, mode: stat.mode });
- } else if (FS.isFile(stat.mode)) {
- return callback(null, { timestamp: stat.mtime, mode: stat.mode, contents: node.contents });
- } else {
- return callback(new Error('node type not supported'));
- }
- },storeLocalEntry:function (path, entry, callback) {
- try {
- if (FS.isDir(entry.mode)) {
- FS.mkdir(path, entry.mode);
- } else if (FS.isFile(entry.mode)) {
- FS.writeFile(path, entry.contents, { encoding: 'binary', canOwn: true });
- } else {
- return callback(new Error('node type not supported'));
- }
-
- FS.utime(path, entry.timestamp, entry.timestamp);
- } catch (e) {
- return callback(e);
- }
-
- callback(null);
- },removeLocalEntry:function (path, callback) {
- try {
- var lookup = FS.lookupPath(path);
- var stat = FS.stat(path);
-
- if (FS.isDir(stat.mode)) {
- FS.rmdir(path);
- } else if (FS.isFile(stat.mode)) {
- FS.unlink(path);
- }
- } catch (e) {
- return callback(e);
- }
-
- callback(null);
- },loadRemoteEntry:function (store, path, callback) {
- var req = store.get(path);
- req.onsuccess = function(event) { callback(null, event.target.result); };
- req.onerror = function() { callback(this.error); };
- },storeRemoteEntry:function (store, path, entry, callback) {
- var req = store.put(entry, path);
- req.onsuccess = function() { callback(null); };
- req.onerror = function() { callback(this.error); };
- },removeRemoteEntry:function (store, path, callback) {
- var req = store.delete(path);
- req.onsuccess = function() { callback(null); };
- req.onerror = function() { callback(this.error); };
- },reconcile:function (src, dst, callback) {
- var total = 0;
-
- var create = [];
- Object.keys(src.entries).forEach(function (key) {
- var e = src.entries[key];
- var e2 = dst.entries[key];
- if (!e2 || e.timestamp > e2.timestamp) {
- create.push(key);
- total++;
- }
- });
-
- var remove = [];
- Object.keys(dst.entries).forEach(function (key) {
- var e = dst.entries[key];
- var e2 = src.entries[key];
- if (!e2) {
- remove.push(key);
- total++;
- }
- });
-
- if (!total) {
- return callback(null);
- }
-
- var errored = false;
- var completed = 0;
- var db = src.type === 'remote' ? src.db : dst.db;
- var transaction = db.transaction([IDBFS.DB_STORE_NAME], 'readwrite');
- var store = transaction.objectStore(IDBFS.DB_STORE_NAME);
-
- function done(err) {
- if (err) {
- if (!done.errored) {
- done.errored = true;
- return callback(err);
- }
- return;
- }
- if (++completed >= total) {
- return callback(null);
- }
- };
-
- transaction.onerror = function() { done(this.error); };
-
- // sort paths in ascending order so directory entries are created
- // before the files inside them
- create.sort().forEach(function (path) {
- if (dst.type === 'local') {
- IDBFS.loadRemoteEntry(store, path, function (err, entry) {
- if (err) return done(err);
- IDBFS.storeLocalEntry(path, entry, done);
- });
- } else {
- IDBFS.loadLocalEntry(path, function (err, entry) {
- if (err) return done(err);
- IDBFS.storeRemoteEntry(store, path, entry, done);
- });
- }
- });
-
- // sort paths in descending order so files are deleted before their
- // parent directories
- remove.sort().reverse().forEach(function(path) {
- if (dst.type === 'local') {
- IDBFS.removeLocalEntry(path, done);
- } else {
- IDBFS.removeRemoteEntry(store, path, done);
- }
- });
- }};
-
- var NODEFS={isWindows:false,staticInit:function () {
- NODEFS.isWindows = !!process.platform.match(/^win/);
- },mount:function (mount) {
- assert(ENVIRONMENT_IS_NODE);
- return NODEFS.createNode(null, '/', NODEFS.getMode(mount.opts.root), 0);
- },createNode:function (parent, name, mode, dev) {
- if (!FS.isDir(mode) && !FS.isFile(mode) && !FS.isLink(mode)) {
- throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
- }
- var node = FS.createNode(parent, name, mode);
- node.node_ops = NODEFS.node_ops;
- node.stream_ops = NODEFS.stream_ops;
- return node;
- },getMode:function (path) {
- var stat;
- try {
- stat = fs.lstatSync(path);
- if (NODEFS.isWindows) {
- // On Windows, directories return permission bits 'rw-rw-rw-', even though they have 'rwxrwxrwx', so
- // propagate write bits to execute bits.
- stat.mode = stat.mode | ((stat.mode & 146) >> 1);
- }
- } catch (e) {
- if (!e.code) throw e;
- throw new FS.ErrnoError(ERRNO_CODES[e.code]);
- }
- return stat.mode;
- },realPath:function (node) {
- var parts = [];
- while (node.parent !== node) {
- parts.push(node.name);
- node = node.parent;
- }
- parts.push(node.mount.opts.root);
- parts.reverse();
- return PATH.join.apply(null, parts);
- },flagsToPermissionStringMap:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},flagsToPermissionString:function (flags) {
- if (flags in NODEFS.flagsToPermissionStringMap) {
- return NODEFS.flagsToPermissionStringMap[flags];
- } else {
- return flags;
- }
- },node_ops:{getattr:function (node) {
- var path = NODEFS.realPath(node);
- var stat;
- try {
- stat = fs.lstatSync(path);
- } catch (e) {
- if (!e.code) throw e;
- throw new FS.ErrnoError(ERRNO_CODES[e.code]);
- }
- // node.js v0.10.20 doesn't report blksize and blocks on Windows. Fake them with default blksize of 4096.
- // See http://support.microsoft.com/kb/140365
- if (NODEFS.isWindows && !stat.blksize) {
- stat.blksize = 4096;
- }
- if (NODEFS.isWindows && !stat.blocks) {
- stat.blocks = (stat.size+stat.blksize-1)/stat.blksize|0;
- }
- return {
- dev: stat.dev,
- ino: stat.ino,
- mode: stat.mode,
- nlink: stat.nlink,
- uid: stat.uid,
- gid: stat.gid,
- rdev: stat.rdev,
- size: stat.size,
- atime: stat.atime,
- mtime: stat.mtime,
- ctime: stat.ctime,
- blksize: stat.blksize,
- blocks: stat.blocks
- };
- },setattr:function (node, attr) {
- var path = NODEFS.realPath(node);
- try {
- if (attr.mode !== undefined) {
- fs.chmodSync(path, attr.mode);
- // update the common node structure mode as well
- node.mode = attr.mode;
- }
- if (attr.timestamp !== undefined) {
- var date = new Date(attr.timestamp);
- fs.utimesSync(path, date, date);
- }
- if (attr.size !== undefined) {
- fs.truncateSync(path, attr.size);
- }
- } catch (e) {
- if (!e.code) throw e;
- throw new FS.ErrnoError(ERRNO_CODES[e.code]);
- }
- },lookup:function (parent, name) {
- var path = PATH.join2(NODEFS.realPath(parent), name);
- var mode = NODEFS.getMode(path);
- return NODEFS.createNode(parent, name, mode);
- },mknod:function (parent, name, mode, dev) {
- var node = NODEFS.createNode(parent, name, mode, dev);
- // create the backing node for this in the fs root as well
- var path = NODEFS.realPath(node);
- try {
- if (FS.isDir(node.mode)) {
- fs.mkdirSync(path, node.mode);
- } else {
- fs.writeFileSync(path, '', { mode: node.mode });
- }
- } catch (e) {
- if (!e.code) throw e;
- throw new FS.ErrnoError(ERRNO_CODES[e.code]);
- }
- return node;
- },rename:function (oldNode, newDir, newName) {
- var oldPath = NODEFS.realPath(oldNode);
- var newPath = PATH.join2(NODEFS.realPath(newDir), newName);
- try {
- fs.renameSync(oldPath, newPath);
- } catch (e) {
- if (!e.code) throw e;
- throw new FS.ErrnoError(ERRNO_CODES[e.code]);
- }
- },unlink:function (parent, name) {
- var path = PATH.join2(NODEFS.realPath(parent), name);
- try {
- fs.unlinkSync(path);
- } catch (e) {
- if (!e.code) throw e;
- throw new FS.ErrnoError(ERRNO_CODES[e.code]);
- }
- },rmdir:function (parent, name) {
- var path = PATH.join2(NODEFS.realPath(parent), name);
- try {
- fs.rmdirSync(path);
- } catch (e) {
- if (!e.code) throw e;
- throw new FS.ErrnoError(ERRNO_CODES[e.code]);
- }
- },readdir:function (node) {
- var path = NODEFS.realPath(node);
- try {
- return fs.readdirSync(path);
- } catch (e) {
- if (!e.code) throw e;
- throw new FS.ErrnoError(ERRNO_CODES[e.code]);
- }
- },symlink:function (parent, newName, oldPath) {
- var newPath = PATH.join2(NODEFS.realPath(parent), newName);
- try {
- fs.symlinkSync(oldPath, newPath);
- } catch (e) {
- if (!e.code) throw e;
- throw new FS.ErrnoError(ERRNO_CODES[e.code]);
- }
- },readlink:function (node) {
- var path = NODEFS.realPath(node);
- try {
- return fs.readlinkSync(path);
- } catch (e) {
- if (!e.code) throw e;
- throw new FS.ErrnoError(ERRNO_CODES[e.code]);
- }
- }},stream_ops:{open:function (stream) {
- var path = NODEFS.realPath(stream.node);
- try {
- if (FS.isFile(stream.node.mode)) {
- stream.nfd = fs.openSync(path, NODEFS.flagsToPermissionString(stream.flags));
- }
- } catch (e) {
- if (!e.code) throw e;
- throw new FS.ErrnoError(ERRNO_CODES[e.code]);
- }
- },close:function (stream) {
- try {
- if (FS.isFile(stream.node.mode) && stream.nfd) {
- fs.closeSync(stream.nfd);
- }
- } catch (e) {
- if (!e.code) throw e;
- throw new FS.ErrnoError(ERRNO_CODES[e.code]);
- }
- },read:function (stream, buffer, offset, length, position) {
- // FIXME this is terrible.
- var nbuffer = new Buffer(length);
- var res;
- try {
- res = fs.readSync(stream.nfd, nbuffer, 0, length, position);
- } catch (e) {
- throw new FS.ErrnoError(ERRNO_CODES[e.code]);
- }
- if (res > 0) {
- for (var i = 0; i < res; i++) {
- buffer[offset + i] = nbuffer[i];
- }
- }
- return res;
- },write:function (stream, buffer, offset, length, position) {
- // FIXME this is terrible.
- var nbuffer = new Buffer(buffer.subarray(offset, offset + length));
- var res;
- try {
- res = fs.writeSync(stream.nfd, nbuffer, 0, length, position);
- } catch (e) {
- throw new FS.ErrnoError(ERRNO_CODES[e.code]);
- }
- return res;
- },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)) {
- try {
- var stat = fs.fstatSync(stream.nfd);
- position += stat.size;
- } catch (e) {
- throw new FS.ErrnoError(ERRNO_CODES[e.code]);
- }
- }
- }
-
- if (position < 0) {
- throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
- }
-
- stream.position = position;
- return position;
- }}};
-
- 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,mounts:[],devices:[null],streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},handleFSError:function (e) {
- if (!(e instanceof FS.ErrnoError)) throw e + ' : ' + stackTrace();
- return ___setErrNo(e.errno);
- },lookupPath:function (path, opts) {
- path = PATH.resolve(FS.cwd(), path);
- opts = opts || {};
-
- var defaults = {
- follow_mount: true,
- recurse_count: 0
- };
- for (var key in defaults) {
- if (opts[key] === undefined) {
- opts[key] = defaults[key];
- }
- }
-
- 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.join2(current_path, parts[i]);
-
- // jump to the mount's root node if this is a mountpoint
- if (FS.isMountpoint(current)) {
- if (!islast || (islast && opts.follow_mount)) {
- current = current.mounted.root;
- }
- }
-
- // 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)) {
- var mount = node.mount.mountpoint;
- if (!path) return mount;
- return mount[mount.length-1] !== '/' ? mount + '/' + path : mount + path;
- }
- path = path ? 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) {
- var nodeName = node.name;
- if (node.parent.id === parent.id && nodeName === 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) {
- if (!FS.FSNode) {
- FS.FSNode = function(parent, name, mode, rdev) {
- if (!parent) {
- parent = this; // root node sets parent to itself
- }
- this.parent = parent;
- this.mount = parent.mount;
- this.mounted = null;
- this.id = FS.nextInode++;
- this.name = name;
- this.mode = mode;
- this.node_ops = {};
- this.stream_ops = {};
- this.rdev = rdev;
- };
-
- FS.FSNode.prototype = {};
-
- // 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(FS.FSNode.prototype, {
- read: {
- get: function() { return (this.mode & readMode) === readMode; },
- set: function(val) { val ? this.mode |= readMode : this.mode &= ~readMode; }
- },
- write: {
- get: function() { return (this.mode & writeMode) === writeMode; },
- set: function(val) { val ? this.mode |= writeMode : this.mode &= ~writeMode; }
- },
- isFolder: {
- get: function() { return FS.isDir(this.mode); },
- },
- isDevice: {
- get: function() { return FS.isChrdev(this.mode); },
- },
- });
- }
-
- var node = new FS.FSNode(parent, name, mode, rdev);
-
- 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 & 61440) === 32768;
- },isDir:function (mode) {
- return (mode & 61440) === 16384;
- },isLink:function (mode) {
- return (mode & 61440) === 40960;
- },isChrdev:function (mode) {
- return (mode & 61440) === 8192;
- },isBlkdev:function (mode) {
- return (mode & 61440) === 24576;
- },isFIFO:function (mode) {
- return (mode & 61440) === 4096;
- },isSocket:function (mode) {
- return (mode & 49152) === 49152;
- },flagModes:{"r":0,"rs":1052672,"r+":2,"w":577,"wx":705,"xw":705,"w+":578,"wx+":706,"xw+":706,"a":1089,"ax":1217,"xa":1217,"a+":1090,"ax+":1218,"xa+":1218},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 & 2097155;
- var perms = ['r', 'w', 'rw'][accmode];
- if ((flag & 512)) {
- 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.cwd()) {
- 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 & 2097155) !== 0 || // opening for write
- (flags & 512)) {
- 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 || 0;
- 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) {
- if (!FS.FSStream) {
- FS.FSStream = function(){};
- FS.FSStream.prototype = {};
- // compatibility
- Object.defineProperties(FS.FSStream.prototype, {
- object: {
- get: function() { return this.node; },
- set: function(val) { this.node = val; }
- },
- isRead: {
- get: function() { return (this.flags & 2097155) !== 1; }
- },
- isWrite: {
- get: function() { return (this.flags & 2097155) !== 0; }
- },
- isAppend: {
- get: function() { return (this.flags & 1024); }
- }
- });
- }
- if (stream.__proto__) {
- // reuse the object
- stream.__proto__ = FS.FSStream.prototype;
- } else {
- var newStream = new FS.FSStream();
- for (var p in stream) {
- newStream[p] = stream[p];
- }
- stream = newStream;
- }
- var fd = FS.nextfd(fd_start, fd_end);
- stream.fd = fd;
- FS.streams[fd] = stream;
- return stream;
- },closeStream:function (fd) {
- FS.streams[fd] = null;
- },getStreamFromPtr:function (ptr) {
- return FS.streams[ptr - 1];
- },getPtrForStream:function (stream) {
- return stream ? stream.fd + 1 : 0;
- },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];
- },getMounts:function (mount) {
- var mounts = [];
- var check = [mount];
-
- while (check.length) {
- var m = check.pop();
-
- mounts.push(m);
-
- check.push.apply(check, m.mounts);
- }
-
- return mounts;
- },syncfs:function (populate, callback) {
- if (typeof(populate) === 'function') {
- callback = populate;
- populate = false;
- }
-
- var mounts = FS.getMounts(FS.root.mount);
- var completed = 0;
-
- function done(err) {
- if (err) {
- if (!done.errored) {
- done.errored = true;
- return callback(err);
- }
- return;
- }
- if (++completed >= mounts.length) {
- callback(null);
- }
- };
-
- // sync all mounts
- mounts.forEach(function (mount) {
- if (!mount.type.syncfs) {
- return done(null);
- }
- mount.type.syncfs(mount, populate, done);
- });
- },mount:function (type, opts, mountpoint) {
- var root = mountpoint === '/';
- var pseudo = !mountpoint;
- var node;
-
- if (root && FS.root) {
- throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
- } else if (!root && !pseudo) {
- var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
-
- mountpoint = lookup.path; // use the absolute path
- node = lookup.node;
-
- if (FS.isMountpoint(node)) {
- throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
- }
-
- if (!FS.isDir(node.mode)) {
- throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
- }
- }
-
- var mount = {
- type: type,
- opts: opts,
- mountpoint: mountpoint,
- mounts: []
- };
-
- // create a root node for the fs
- var mountRoot = type.mount(mount);
- mountRoot.mount = mount;
- mount.root = mountRoot;
-
- if (root) {
- FS.root = mountRoot;
- } else if (node) {
- // set as a mountpoint
- node.mounted = mount;
-
- // add the new mount to the current mount's children
- if (node.mount) {
- node.mount.mounts.push(mount);
- }
- }
-
- return mountRoot;
- },unmount:function (mountpoint) {
- var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
-
- if (!FS.isMountpoint(lookup.node)) {
- throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
- }
-
- // destroy the nodes for this mount, and all its child mounts
- var node = lookup.node;
- var mount = node.mounted;
- var mounts = FS.getMounts(mount);
-
- Object.keys(FS.nameTable).forEach(function (hash) {
- var current = FS.nameTable[hash];
-
- while (current) {
- var next = current.name_next;
-
- if (mounts.indexOf(current.mount) !== -1) {
- FS.destroyNode(current);
- }
-
- current = next;
- }
- });
-
- // no longer a mountpoint
- node.mounted = null;
-
- // remove this mount from the child mounts
- var idx = node.mount.mounts.indexOf(mount);
- assert(idx !== -1);
- node.mount.mounts.splice(idx, 1);
- },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 |= 32768;
- return FS.mknod(path, mode, 0);
- },mkdir:function (path, mode) {
- mode = mode !== undefined ? mode : 0777;
- mode &= 511 | 512;
- mode |= 16384;
- return FS.mknod(path, mode, 0);
- },mkdev:function (path, mode, dev) {
- if (typeof(dev) === 'undefined') {
- dev = mode;
- mode = 0666;
- }
- mode |= 8192;
- 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);
- 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 & 2097155) === 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) {
- flags = typeof flags === 'string' ? FS.modeStringToFlags(flags) : flags;
- mode = typeof mode === 'undefined' ? 0666 : mode;
- if ((flags & 64)) {
- mode = (mode & 4095) | 32768;
- } else {
- mode = 0;
- }
- var node;
- if (typeof path === 'object') {
- node = path;
- } else {
- path = PATH.normalize(path);
- try {
- var lookup = FS.lookupPath(path, {
- follow: !(flags & 131072)
- });
- node = lookup.node;
- } catch (e) {
- // ignore
- }
- }
- // perhaps we need to create the node
- if ((flags & 64)) {
- if (node) {
- // if O_CREAT and O_EXCL are set, error out if the node already exists
- if ((flags & 128)) {
- 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 &= ~512;
- }
- // check permissions
- var err = FS.mayOpen(node, flags);
- if (err) {
- throw new FS.ErrnoError(err);
- }
- // do truncation if necessary
- if ((flags & 512)) {
- FS.truncate(node, 0);
- }
- // we've already handled these, don't pass down to the underlying vfs
- flags &= ~(128 | 512);
-
- // register the stream with the filesystem
- var stream = FS.createStream({
- node: node,
- path: FS.getPath(node), // we want the absolute path to the 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);
- }
- if (Module['logReadFiles'] && !(flags & 1)) {
- if (!FS.readFiles) FS.readFiles = {};
- if (!(path in FS.readFiles)) {
- FS.readFiles[path] = 1;
- Module['printErr']('read file: ' + path);
- }
- }
- 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 & 2097155) === 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 & 2097155) === 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 & 1024) {
- // 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 & 2097155) === 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 & 2097155) === 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';
- if (opts.encoding !== 'utf8' && opts.encoding !== 'binary') {
- throw new Error('Invalid encoding type "' + opts.encoding + '"');
- }
- 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;
- }
- FS.close(stream);
- return ret;
- },writeFile:function (path, data, opts) {
- opts = opts || {};
- opts.flags = opts.flags || 'w';
- opts.encoding = opts.encoding || 'utf8';
- if (opts.encoding !== 'utf8' && opts.encoding !== 'binary') {
- throw new Error('Invalid encoding type "' + opts.encoding + '"');
- }
- 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, opts.canOwn);
- } else if (opts.encoding === 'binary') {
- FS.write(stream, data, 0, data.length, 0, opts.canOwn);
- }
- FS.close(stream);
- },cwd:function () {
- return FS.currentPath;
- },chdir:function (path) {
- var lookup = FS.lookupPath(path, { follow: true });
- if (!FS.isDir(lookup.node.mode)) {
- throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
- }
- var err = FS.nodePermissions(lookup.node, 'x');
- if (err) {
- throw new FS.ErrnoError(err);
- }
- FS.currentPath = lookup.path;
- },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)]=FS.getPtrForStream(stdin);
- assert(stdin.fd === 0, 'invalid handle for stdin (' + stdin.fd + ')');
-
- var stdout = FS.open('/dev/stdout', 'w');
- HEAP32[((_stdout)>>2)]=FS.getPtrForStream(stdout);
- assert(stdout.fd === 1, 'invalid handle for stdout (' + stdout.fd + ')');
-
- var stderr = FS.open('/dev/stderr', 'w');
- HEAP32[((_stderr)>>2)]=FS.getPtrForStream(stderr);
- assert(stderr.fd === 2, 'invalid handle for stderr (' + stderr.fd + ')');
- },ensureErrnoError:function () {
- if (FS.ErrnoError) return;
- FS.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];
- };
- FS.ErrnoError.prototype = new Error();
- FS.ErrnoError.prototype.constructor = FS.ErrnoError;
- // Some errors may happen quite a bit, to avoid overhead we reuse them (and suffer a lack of stack info)
- [ERRNO_CODES.ENOENT].forEach(function(code) {
- FS.genericErrors[code] = new FS.ErrnoError(code);
- FS.genericErrors[code].stack = '<generic error, no stack>';
- });
- },staticInit:function () {
- FS.ensureErrnoError();
-
- FS.nameTable = new Array(4096);
-
- 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;
-
- FS.ensureErrnoError();
-
- // 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.join2(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.join2(parent, part);
- try {
- FS.mkdir(current);
- } catch (e) {
- // ignore EEXIST
- }
- parent = current;
- }
- return current;
- },createFile:function (parent, name, properties, canRead, canWrite) {
- var path = PATH.join2(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.join2(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(node, mode | 146);
- var stream = FS.open(node, 'w');
- FS.write(stream, data, 0, data.length, 0, canOwn);
- FS.close(stream);
- FS.chmod(node, mode);
- }
- return node;
- },createDevice:function (parent, name, input, output) {
- var path = PATH.join2(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.join2(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.
- function LazyUint8Array() {
- this.lengthKnown = false;
- this.chunks = []; // Loaded chunks. Index is the chunk number
- }
- LazyUint8Array.prototype.get = function LazyUint8Array_get(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 LazyUint8Array_setDataGetter(getter) {
- this.getter = getter;
- }
- LazyUint8Array.prototype.cacheLength = function LazyUint8Array_cacheLength() {
- // 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 forceLoadLazyFile() {
- 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_ops_read(stream, buffer, offset, length, position) {
- if (!FS.forceLoadFile(node)) {
- throw new FS.ErrnoError(ERRNO_CODES.EIO);
- }
- var contents = stream.node.contents;
- if (position >= contents.length)
- return 0;
- var size = Math.min(contents.length - position, length);
- assert(size >= 0);
- 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.join2(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 openRequest_onupgradeneeded() {
- console.log('creating db');
- var db = openRequest.result;
- db.createObjectStore(FS.DB_STORE_NAME);
- };
- openRequest.onsuccess = function openRequest_onsuccess() {
- 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 putRequest_onsuccess() { ok++; if (ok + fail == total) finish() };
- putRequest.onerror = function putRequest_onerror() { 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 openRequest_onsuccess() {
- 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 getRequest_onsuccess() {
- 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 getRequest_onerror() { fail++; if (ok + fail == total) finish() };
- });
- transaction.onerror = onerror;
- };
- openRequest.onerror = onerror;
- }};
-
-
-
-
- function _mkport() { throw 'TODO' }var SOCKFS={mount:function (mount) {
- return FS.createNode(null, '/', 16384 | 0777, 0);
- },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, 49152, 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);
- }},nextname:function () {
- if (!SOCKFS.nextname.current) {
- SOCKFS.nextname.current = 0;
- }
- return 'socket[' + (SOCKFS.nextname.current++) + ']';
- },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 ? {headers: {'websocket-protocol': ['binary']}} : ['binary'];
- // If node we use the ws library.
- var WebSocket = ENVIRONMENT_IS_NODE ? require('ws') : window['WebSocket'];
- 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();
- }
- };
-
- function handleMessage(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 peer_socket_onmessage(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 ? (64 | 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 |= (64 | 1);
- }
-
- if (!dest || // connection-less sockets are always ready to write
- (dest && dest.socket.readyState === dest.socket.OPEN)) {
- mask |= 4;
- }
-
- 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 21531:
- 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 _fileno(stream) {
- // int fileno(FILE *stream);
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/fileno.html
- return FS.getStreamFromPtr(stream).fd;
- }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 fd = _fileno(stream);
- var bytesWritten = _write(fd, ptr, bytesToWrite);
- if (bytesWritten == -1) {
- var streamObj = FS.getStreamFromPtr(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;
- var flagPadSign = 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;
- }
- case 32:
- flagPadSign = 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, precision = -1;
- if (next == 46) {
- 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)];
- }
- if (precision === -1) {
- precision = 6; // Standard default.
- precisionSet = false;
- }
-
- // 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 (currArg >= 0) {
- if (flagAlwaysSigned) {
- prefix = '+' + prefix;
- } else if (flagPadSign) {
- prefix = ' ' + prefix;
- }
- }
-
- // Move sign to prefix so we zero-pad after the sign
- if (argText.charAt(0) == '-') {
- prefix = '-' + prefix;
- argText = argText.substr(1);
- }
-
- // 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 (currArg >= 0) {
- if (flagAlwaysSigned) {
- argText = '+' + argText;
- } else if (flagPadSign) {
- 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);
- }
-
- 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 (!___cxa_last_thrown_exception) { ___cxa_last_thrown_exception = 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.";
- }
-
- var ___cxa_last_thrown_exception=0;
-
- var ___cxa_exception_header_size=8;function ___cxa_find_matching_catch(thrown, throwntype) {
- if (thrown == -1) thrown = ___cxa_last_thrown_exception;
- header = thrown - ___cxa_exception_header_size;
- if (throwntype == -1) throwntype = HEAP32[((header)>>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 ___gxx_personality_v0() {
- }
- function _clock() {
- if (_clock.start === undefined) _clock.start = Date.now();
- return Math.floor((Date.now() - _clock.start) * (1000000/1000));
- }
-
-
- function __exit(status) {
- // void _exit(int status);
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/exit.html
- Module['exit'](status);
- }function _exit(status) {
- __exit(status);
- }function __ZSt9terminatev() {
- _exit(-1234);
- }
- function ___assert_fail(condition, filename, line, func) {
- ABORT = true;
- throw 'Assertion failed: ' + Pointer_stringify(condition) + ', at: ' + [filename ? Pointer_stringify(filename) : 'unknown filename', line, func ? Pointer_stringify(func) : 'unknown function'] + ' at ' + stackTrace();
- }
-
-
- function _emscripten_memcpy_big(dest, src, num) {
- HEAPU8.set(HEAPU8.subarray(src, src+num), dest);
- return dest;
- }
- Module["_memcpy"] = _memcpy;var _llvm_memcpy_p0i8_p0i8_i32=_memcpy;
- function ___cxa_allocate_exception(size) {
- var ptr = _malloc(size + ___cxa_exception_header_size);
- return ptr + ___cxa_exception_header_size;
- }
- function ___cxa_free_exception(ptr) {
- try {
- return _free(ptr - ___cxa_exception_header_size);
- } catch(e) { // XXX FIXME
- }
- }
- 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;
- }
- var header = ptr - ___cxa_exception_header_size;
- HEAP32[((header)>>2)]=type;
- HEAP32[(((header)+(4))>>2)]=destructor;
- ___cxa_last_thrown_exception = ptr;
- 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 ___cxa_caught_exceptions=[];function ___cxa_begin_catch(ptr) {
- __ZSt18uncaught_exceptionv.uncaught_exception--;
- ___cxa_caught_exceptions.push(___cxa_last_thrown_exception);
- return ptr;
- }
- function ___cxa_end_catch() {
- if (___cxa_end_catch.rethrown) {
- ___cxa_end_catch.rethrown = false;
- return;
- }
- // Clear state flag.
- asm['setThrew'](0);
- // Call destructor if one is registered then clear it.
- var ptr = ___cxa_caught_exceptions.pop();
- if (ptr) {
- header = ptr - ___cxa_exception_header_size;
- var destructor = HEAP32[(((header)+(4))>>2)];
- if (destructor) {
- Runtime.dynCall('vi', destructor, [ptr]);
- HEAP32[(((header)+(4))>>2)]=0;
- }
- ___cxa_free_exception(ptr);
- ___cxa_last_thrown_exception = 0;
- }
- }
-
-
- Module["_memset"] = _memset;var _llvm_memset_p0i8_i32=_memset;
-
-
- Module["_memmove"] = _memmove;var _llvm_memmove_p0i8_p0i8_i32=_memmove;
-
-
- function _recv(fd, buf, len, flags) {
- var sock = SOCKFS.getSocket(fd);
- if (!sock) {
- ___setErrNo(ERRNO_CODES.EBADF);
- return -1;
- }
- // TODO honor flags
- return _read(fd, buf, len);
- }
-
- function _pread(fildes, buf, nbyte, offset) {
- // ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset);
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/read.html
- var stream = FS.getStream(fildes);
- if (!stream) {
- ___setErrNo(ERRNO_CODES.EBADF);
- return -1;
- }
- try {
- var slab = HEAP8;
- return FS.read(stream, slab, buf, nbyte, offset);
- } catch (e) {
- FS.handleFSError(e);
- return -1;
- }
- }function _read(fildes, buf, nbyte) {
- // ssize_t read(int fildes, void *buf, size_t nbyte);
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/read.html
- var stream = FS.getStream(fildes);
- if (!stream) {
- ___setErrNo(ERRNO_CODES.EBADF);
- return -1;
- }
-
-
- try {
- var slab = HEAP8;
- return FS.read(stream, slab, buf, nbyte);
- } catch (e) {
- FS.handleFSError(e);
- return -1;
- }
- }function _fread(ptr, size, nitems, stream) {
- // size_t fread(void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream);
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/fread.html
- var bytesToRead = nitems * size;
- if (bytesToRead == 0) {
- return 0;
- }
- var bytesRead = 0;
- var streamObj = FS.getStreamFromPtr(stream);
- if (!streamObj) {
- ___setErrNo(ERRNO_CODES.EBADF);
- return 0;
- }
- while (streamObj.ungotten.length && bytesToRead > 0) {
- HEAP8[((ptr++)|0)]=streamObj.ungotten.pop();
- bytesToRead--;
- bytesRead++;
- }
- var err = _read(streamObj.fd, ptr, bytesToRead);
- if (err == -1) {
- if (streamObj) streamObj.error = true;
- return 0;
- }
- bytesRead += err;
- if (bytesRead < bytesToRead) streamObj.eof = true;
- return Math.floor(bytesRead / size);
- }
-
-
- function _lseek(fildes, offset, whence) {
- // off_t lseek(int fildes, off_t offset, int whence);
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/lseek.html
- var stream = FS.getStream(fildes);
- if (!stream) {
- ___setErrNo(ERRNO_CODES.EBADF);
- return -1;
- }
- try {
- return FS.llseek(stream, offset, whence);
- } catch (e) {
- FS.handleFSError(e);
- return -1;
- }
- }function _fseek(stream, offset, whence) {
- // int fseek(FILE *stream, long offset, int whence);
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/fseek.html
- var fd = _fileno(stream);
- var ret = _lseek(fd, offset, whence);
- if (ret == -1) {
- return -1;
- }
- stream = FS.getStreamFromPtr(stream);
- stream.eof = false;
- return 0;
- }var _fseeko=_fseek;
-
- function _ftell(stream) {
- // long ftell(FILE *stream);
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/ftell.html
- stream = FS.getStreamFromPtr(stream);
- if (!stream) {
- ___setErrNo(ERRNO_CODES.EBADF);
- return -1;
- }
- if (FS.isChrdev(stream.node.mode)) {
- ___setErrNo(ERRNO_CODES.ESPIPE);
- return -1;
- } else {
- return stream.position;
- }
- }var _ftello=_ftell;
-
- function _close(fildes) {
- // int close(int fildes);
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/close.html
- var stream = FS.getStream(fildes);
- if (!stream) {
- ___setErrNo(ERRNO_CODES.EBADF);
- return -1;
- }
- try {
- FS.close(stream);
- return 0;
- } catch (e) {
- FS.handleFSError(e);
- return -1;
- }
- }
-
- function _fsync(fildes) {
- // int fsync(int fildes);
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/fsync.html
- var stream = FS.getStream(fildes);
- if (stream) {
- // We write directly to the file system, so there's nothing to do here.
- return 0;
- } else {
- ___setErrNo(ERRNO_CODES.EBADF);
- return -1;
- }
- }function _fclose(stream) {
- // int fclose(FILE *stream);
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/fclose.html
- var fd = _fileno(stream);
- _fsync(fd);
- return _close(fd);
- }
-
- function _open(path, oflag, varargs) {
- // int open(const char *path, int oflag, ...);
- // http://pubs.opengroup.org/onlinepubs/009695399/functions/open.html
- var mode = HEAP32[((varargs)>>2)];
- path = Pointer_stringify(path);
- try {
- var stream = FS.open(path, oflag, mode);
- return stream.fd;
- } catch (e) {
- FS.handleFSError(e);
- return -1;
- }
- }function _fopen(filename, mode) {
- // FILE *fopen(const char *restrict filename, const char *restrict mode);
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/fopen.html
- var flags;
- mode = Pointer_stringify(mode);
- if (mode[0] == 'r') {
- if (mode.indexOf('+') != -1) {
- flags = 2;
- } else {
- flags = 0;
- }
- } else if (mode[0] == 'w') {
- if (mode.indexOf('+') != -1) {
- flags = 2;
- } else {
- flags = 1;
- }
- flags |= 64;
- flags |= 512;
- } else if (mode[0] == 'a') {
- if (mode.indexOf('+') != -1) {
- flags = 2;
- } else {
- flags = 1;
- }
- flags |= 64;
- flags |= 1024;
- } else {
- ___setErrNo(ERRNO_CODES.EINVAL);
- return 0;
- }
- var fd = _open(filename, flags, allocate([0x1FF, 0, 0, 0], 'i32', ALLOC_STACK)); // All creation permissions.
- return fd === -1 ? 0 : FS.getPtrForStream(FS.getStream(fd));
- }
- function _llvm_lifetime_start() {}
- function _llvm_lifetime_end() {}
- var _llvm_memset_p0i8_i64=_memset;
-
- function _fputs(s, stream) {
- // int fputs(const char *restrict s, FILE *restrict stream);
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/fputs.html
- var fd = _fileno(stream);
- return _write(fd, s, _strlen(s));
- }
-
- function _fputc(c, stream) {
- // int fputc(int c, FILE *stream);
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/fputc.html
- var chr = unSign(c & 0xFF);
- HEAP8[((_fputc.ret)|0)]=chr;
- var fd = _fileno(stream);
- var ret = _write(fd, _fputc.ret, 1);
- if (ret == -1) {
- var streamObj = FS.getStreamFromPtr(stream);
- if (streamObj) streamObj.error = true;
- return -1;
- } else {
- return chr;
- }
- }function _puts(s) {
- // int puts(const char *s);
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/puts.html
- // NOTE: puts() always writes an extra newline.
- var stdout = HEAP32[((_stdout)>>2)];
- var ret = _fputs(s, stdout);
- if (ret < 0) {
- return ret;
- } else {
- var newlineRet = _fputc(10, stdout);
- return (newlineRet < 0) ? -1 : ret + 1;
- }
- }
- var _cos=Math_cos;
- var _sin=Math_sin;
- function _llvm_umul_with_overflow_i32(x, y) {
- x = x>>>0;
- y = y>>>0;
- return ((asm["setTempRet0"](x*y > 4294967295),(x*y)>>>0)|0);
- }
- var _sqrt=Math_sqrt;
-
- function _snprintf(s, n, format, varargs) {
- // int snprintf(char *restrict s, size_t n, const char *restrict format, ...);
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/printf.html
- var result = __formatString(format, varargs);
- var limit = (n === undefined) ? result.length
- : Math.min(result.length, Math.max(n - 1, 0));
- if (s < 0) {
- s = -s;
- var buf = _malloc(limit+1);
- HEAP32[((s)>>2)]=buf;
- s = buf;
- }
- for (var i = 0; i < limit; i++) {
- HEAP8[(((s)+(i))|0)]=result[i];
- }
- if (limit < n || (n === undefined)) HEAP8[(((s)+(i))|0)]=0;
- return result.length;
- }function _sprintf(s, format, varargs) {
- // int sprintf(char *restrict s, const char *restrict format, ...);
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/printf.html
- return _snprintf(s, undefined, format, varargs);
- }
- var _fabs=Math_abs;
- var _floor=Math_floor;
- function _sysconf(name) {
- // long sysconf(int name);
- // http://pubs.opengroup.org/onlinepubs/009695399/functions/sysconf.html
- switch(name) {
- case 30: return PAGE_SIZE;
- case 132:
- case 133:
- case 12:
- case 137:
- case 138:
- case 15:
- case 235:
- case 16:
- case 17:
- case 18:
- case 19:
- case 20:
- case 149:
- case 13:
- case 10:
- case 236:
- case 153:
- case 9:
- case 21:
- case 22:
- case 159:
- case 154:
- case 14:
- case 77:
- case 78:
- case 139:
- case 80:
- case 81:
- case 79:
- case 82:
- case 68:
- case 67:
- case 164:
- case 11:
- case 29:
- case 47:
- case 48:
- case 95:
- case 52:
- case 51:
- case 46:
- return 200809;
- case 27:
- case 246:
- case 127:
- case 128:
- case 23:
- case 24:
- case 160:
- case 161:
- case 181:
- case 182:
- case 242:
- case 183:
- case 184:
- case 243:
- case 244:
- case 245:
- case 165:
- case 178:
- case 179:
- case 49:
- case 50:
- case 168:
- case 169:
- case 175:
- case 170:
- case 171:
- case 172:
- case 97:
- case 76:
- case 32:
- case 173:
- case 35:
- return -1;
- case 176:
- case 177:
- case 7:
- case 155:
- case 8:
- case 157:
- case 125:
- case 126:
- case 92:
- case 93:
- case 129:
- case 130:
- case 131:
- case 94:
- case 91:
- return 1;
- case 74:
- case 60:
- case 69:
- case 70:
- case 4:
- return 1024;
- case 31:
- case 42:
- case 72:
- return 32;
- case 87:
- case 26:
- case 33:
- return 2147483647;
- case 34:
- case 1:
- return 47839;
- case 38:
- case 36:
- return 99;
- case 43:
- case 37:
- return 2048;
- case 0: return 2097152;
- case 3: return 65536;
- case 28: return 32768;
- case 44: return 32767;
- case 75: return 16384;
- case 39: return 1000;
- case 89: return 700;
- case 71: return 256;
- case 40: return 255;
- case 2: return 100;
- case 180: return 64;
- case 25: return 20;
- case 5: return 16;
- case 6: return 6;
- case 73: return 4;
- case 84: return 1;
- }
- ___setErrNo(ERRNO_CODES.EINVAL);
- return -1;
- }
- function _times(buffer) {
- // clock_t times(struct tms *buffer);
- // http://pubs.opengroup.org/onlinepubs/009695399/functions/times.html
- // NOTE: This is fake, since we can't calculate real CPU time usage in JS.
- if (buffer !== 0) {
- _memset(buffer, 0, 16);
- }
- return 0;
- }
- function _pthread_mutex_lock() {}
- function _pthread_mutex_unlock() {}
- 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() {}
- function _pthread_cond_broadcast() {
- return 0;
- }
- function _pthread_cond_wait() {
- return 0;
- }
-
- function _atexit(func, arg) {
- __ATEXIT__.unshift({ func: func, arg: arg });
- }var ___cxa_atexit=_atexit;
- function _ungetc(c, stream) {
- // int ungetc(int c, FILE *stream);
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/ungetc.html
- stream = FS.getStreamFromPtr(stream);
- if (!stream) {
- return -1;
- }
- if (c === -1) {
- // do nothing for EOF character
- return c;
- }
- c = unSign(c & 0xFF);
- stream.ungotten.push(c);
- stream.eof = false;
- return c;
- }
-
- function _fgetc(stream) {
- // int fgetc(FILE *stream);
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/fgetc.html
- var streamObj = FS.getStreamFromPtr(stream);
- if (!streamObj) return -1;
- if (streamObj.eof || streamObj.error) return -1;
- var ret = _fread(_fgetc.ret, 1, 1, stream);
- if (ret == 0) {
- return -1;
- } else if (ret == -1) {
- streamObj.error = true;
- return -1;
- } else {
- return HEAPU8[((_fgetc.ret)|0)];
- }
- }var _getc=_fgetc;
- function __ZNSt9exceptionD2Ev() {}
- function ___errno_location() {
- return ___errno_state;
- }
-
- function _strerror_r(errnum, strerrbuf, buflen) {
- if (errnum in ERRNO_MESSAGES) {
- if (ERRNO_MESSAGES[errnum].length > buflen - 1) {
- return ___setErrNo(ERRNO_CODES.ERANGE);
- } else {
- var msg = ERRNO_MESSAGES[errnum];
- writeAsciiToMemory(msg, strerrbuf);
- return 0;
- }
- } else {
- return ___setErrNo(ERRNO_CODES.EINVAL);
- }
- }function _strerror(errnum) {
- if (!_strerror.buffer) _strerror.buffer = _malloc(256);
- _strerror_r(errnum, _strerror.buffer, 256);
- return _strerror.buffer;
- }
- function _abort() {
- Module['abort']();
- }
- function ___cxa_rethrow() {
- ___cxa_end_catch.rethrown = true;
- var ptr = ___cxa_caught_exceptions.pop();
- 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_guard_abort() {}
-
- function _isxdigit(chr) {
- return (chr >= 48 && chr <= 57) ||
- (chr >= 97 && chr <= 102) ||
- (chr >= 65 && chr <= 70);
- }function _isxdigit_l(chr) {
- return _isxdigit(chr); // no locale support yet
- }
-
- function _isdigit(chr) {
- return chr >= 48 && chr <= 57;
- }function _isdigit_l(chr) {
- return _isdigit(chr); // no locale support yet
- }
-
-
- function __getFloat(text) {
- return /^[+-]?[0-9]*\.?[0-9]+([eE][+-]?[0-9]+)?/.exec(text);
- }function __scanString(format, get, unget, varargs) {
- if (!__scanString.whiteSpace) {
- __scanString.whiteSpace = {};
- __scanString.whiteSpace[32] = 1;
- __scanString.whiteSpace[9] = 1;
- __scanString.whiteSpace[10] = 1;
- __scanString.whiteSpace[11] = 1;
- __scanString.whiteSpace[12] = 1;
- __scanString.whiteSpace[13] = 1;
- }
- // Supports %x, %4x, %d.%d, %lld, %s, %f, %lf.
- // TODO: Support all format specifiers.
- format = Pointer_stringify(format);
- var soFar = 0;
- if (format.indexOf('%n') >= 0) {
- // need to track soFar
- var _get = get;
- get = function get() {
- soFar++;
- return _get();
- }
- var _unget = unget;
- unget = function unget() {
- soFar--;
- return _unget();
- }
- }
- var formatIndex = 0;
- var argsi = 0;
- var fields = 0;
- var argIndex = 0;
- var next;
-
- mainLoop:
- for (var formatIndex = 0; formatIndex < format.length;) {
- if (format[formatIndex] === '%' && format[formatIndex+1] == 'n') {
- var argPtr = HEAP32[(((varargs)+(argIndex))>>2)];
- argIndex += Runtime.getAlignSize('void*', null, true);
- HEAP32[((argPtr)>>2)]=soFar;
- formatIndex += 2;
- continue;
- }
-
- if (format[formatIndex] === '%') {
- var nextC = format.indexOf('c', formatIndex+1);
- if (nextC > 0) {
- var maxx = 1;
- if (nextC > formatIndex+1) {
- var sub = format.substring(formatIndex+1, nextC);
- maxx = parseInt(sub);
- if (maxx != sub) maxx = 0;
- }
- if (maxx) {
- var argPtr = HEAP32[(((varargs)+(argIndex))>>2)];
- argIndex += Runtime.getAlignSize('void*', null, true);
- fields++;
- for (var i = 0; i < maxx; i++) {
- next = get();
- HEAP8[((argPtr++)|0)]=next;
- if (next === 0) return i > 0 ? fields : fields-1; // we failed to read the full length of this field
- }
- formatIndex += nextC - formatIndex + 1;
- continue;
- }
- }
- }
-
- // handle %[...]
- if (format[formatIndex] === '%' && format.indexOf('[', formatIndex+1) > 0) {
- var match = /\%([0-9]*)\[(\^)?(\]?[^\]]*)\]/.exec(format.substring(formatIndex));
- if (match) {
- var maxNumCharacters = parseInt(match[1]) || Infinity;
- var negateScanList = (match[2] === '^');
- var scanList = match[3];
-
- // expand "middle" dashs into character sets
- var middleDashMatch;
- while ((middleDashMatch = /([^\-])\-([^\-])/.exec(scanList))) {
- var rangeStartCharCode = middleDashMatch[1].charCodeAt(0);
- var rangeEndCharCode = middleDashMatch[2].charCodeAt(0);
- for (var expanded = ''; rangeStartCharCode <= rangeEndCharCode; expanded += String.fromCharCode(rangeStartCharCode++));
- scanList = scanList.replace(middleDashMatch[1] + '-' + middleDashMatch[2], expanded);
- }
-
- var argPtr = HEAP32[(((varargs)+(argIndex))>>2)];
- argIndex += Runtime.getAlignSize('void*', null, true);
- fields++;
-
- for (var i = 0; i < maxNumCharacters; i++) {
- next = get();
- if (negateScanList) {
- if (scanList.indexOf(String.fromCharCode(next)) < 0) {
- HEAP8[((argPtr++)|0)]=next;
- } else {
- unget();
- break;
- }
- } else {
- if (scanList.indexOf(String.fromCharCode(next)) >= 0) {
- HEAP8[((argPtr++)|0)]=next;
- } else {
- unget();
- break;
- }
- }
- }
-
- // write out null-terminating character
- HEAP8[((argPtr++)|0)]=0;
- formatIndex += match[0].length;
-
- continue;
- }
- }
- // remove whitespace
- while (1) {
- next = get();
- if (next == 0) return fields;
- if (!(next in __scanString.whiteSpace)) break;
- }
- unget();
-
- if (format[formatIndex] === '%') {
- formatIndex++;
- var suppressAssignment = false;
- if (format[formatIndex] == '*') {
- suppressAssignment = true;
- formatIndex++;
- }
- var maxSpecifierStart = formatIndex;
- while (format[formatIndex].charCodeAt(0) >= 48 &&
- format[formatIndex].charCodeAt(0) <= 57) {
- formatIndex++;
- }
- var max_;
- if (formatIndex != maxSpecifierStart) {
- max_ = parseInt(format.slice(maxSpecifierStart, formatIndex), 10);
- }
- var long_ = false;
- var half = false;
- var longLong = false;
- if (format[formatIndex] == 'l') {
- long_ = true;
- formatIndex++;
- if (format[formatIndex] == 'l') {
- longLong = true;
- formatIndex++;
- }
- } else if (format[formatIndex] == 'h') {
- half = true;
- formatIndex++;
- }
- var type = format[formatIndex];
- formatIndex++;
- var curr = 0;
- var buffer = [];
- // Read characters according to the format. floats are trickier, they may be in an unfloat state in the middle, then be a valid float later
- if (type == 'f' || type == 'e' || type == 'g' ||
- type == 'F' || type == 'E' || type == 'G') {
- next = get();
- while (next > 0 && (!(next in __scanString.whiteSpace))) {
- buffer.push(String.fromCharCode(next));
- next = get();
- }
- var m = __getFloat(buffer.join(''));
- var last = m ? m[0].length : 0;
- for (var i = 0; i < buffer.length - last + 1; i++) {
- unget();
- }
- buffer.length = last;
- } else {
- next = get();
- var first = true;
-
- // Strip the optional 0x prefix for %x.
- if ((type == 'x' || type == 'X') && (next == 48)) {
- var peek = get();
- if (peek == 120 || peek == 88) {
- next = get();
- } else {
- unget();
- }
- }
-
- while ((curr < max_ || isNaN(max_)) && next > 0) {
- if (!(next in __scanString.whiteSpace) && // stop on whitespace
- (type == 's' ||
- ((type === 'd' || type == 'u' || type == 'i') && ((next >= 48 && next <= 57) ||
- (first && next == 45))) ||
- ((type === 'x' || type === 'X') && (next >= 48 && next <= 57 ||
- next >= 97 && next <= 102 ||
- next >= 65 && next <= 70))) &&
- (formatIndex >= format.length || next !== format[formatIndex].charCodeAt(0))) { // Stop when we read something that is coming up
- buffer.push(String.fromCharCode(next));
- next = get();
- curr++;
- first = false;
- } else {
- break;
- }
- }
- unget();
- }
- if (buffer.length === 0) return 0; // Failure.
- if (suppressAssignment) continue;
-
- var text = buffer.join('');
- var argPtr = HEAP32[(((varargs)+(argIndex))>>2)];
- argIndex += Runtime.getAlignSize('void*', null, true);
- switch (type) {
- case 'd': case 'u': case 'i':
- if (half) {
- HEAP16[((argPtr)>>1)]=parseInt(text, 10);
- } else if (longLong) {
- (tempI64 = [parseInt(text, 10)>>>0,(tempDouble=parseInt(text, 10),(+(Math_abs(tempDouble))) >= (+1) ? (tempDouble > (+0) ? ((Math_min((+(Math_floor((tempDouble)/(+4294967296)))), (+4294967295)))|0)>>>0 : (~~((+(Math_ceil((tempDouble - +(((~~(tempDouble)))>>>0))/(+4294967296))))))>>>0) : 0)],HEAP32[((argPtr)>>2)]=tempI64[0],HEAP32[(((argPtr)+(4))>>2)]=tempI64[1]);
- } else {
- HEAP32[((argPtr)>>2)]=parseInt(text, 10);
- }
- break;
- case 'X':
- case 'x':
- HEAP32[((argPtr)>>2)]=parseInt(text, 16);
- break;
- case 'F':
- case 'f':
- case 'E':
- case 'e':
- case 'G':
- case 'g':
- case 'E':
- // fallthrough intended
- if (long_) {
- HEAPF64[((argPtr)>>3)]=parseFloat(text);
- } else {
- HEAPF32[((argPtr)>>2)]=parseFloat(text);
- }
- break;
- case 's':
- var array = intArrayFromString(text);
- for (var j = 0; j < array.length; j++) {
- HEAP8[(((argPtr)+(j))|0)]=array[j];
- }
- break;
- }
- fields++;
- } else if (format[formatIndex].charCodeAt(0) in __scanString.whiteSpace) {
- next = get();
- while (next in __scanString.whiteSpace) {
- if (next <= 0) break mainLoop; // End of input.
- next = get();
- }
- unget(next);
- formatIndex++;
- } else {
- // Not a specifier.
- next = get();
- if (format[formatIndex].charCodeAt(0) !== next) {
- unget(next);
- break mainLoop;
- }
- formatIndex++;
- }
- }
- return fields;
- }function _sscanf(s, format, varargs) {
- // int sscanf(const char *restrict s, const char *restrict format, ... );
- // http://pubs.opengroup.org/onlinepubs/000095399/functions/scanf.html
- var index = 0;
- function get() { return HEAP8[(((s)+(index++))|0)]; };
- function unget() { index--; };
- return __scanString(format, get, unget, varargs);
- }
- function _catopen(name, oflag) {
- // nl_catd catopen (const char *name, int oflag)
- return -1;
- }
- function _catgets(catd, set_id, msg_id, s) {
- // char *catgets (nl_catd catd, int set_id, int msg_id, const char *s)
- return s;
- }
- function _catclose(catd) {
- // int catclose (nl_catd catd)
- return 0;
- }
- function _newlocale(mask, locale, base) {
- return _malloc(4);
- }
- function _freelocale(locale) {
- _free(locale);
- }
- function ___ctype_b_loc() {
- // http://refspecs.freestandards.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/baselib---ctype-b-loc.html
- var me = ___ctype_b_loc;
- if (!me.ret) {
- var values = [
- 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,2,2,2,2,2,2,2,2,2,8195,8194,8194,8194,8194,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,24577,49156,49156,49156,
- 49156,49156,49156,49156,49156,49156,49156,49156,49156,49156,49156,49156,55304,55304,55304,55304,55304,55304,55304,55304,
- 55304,55304,49156,49156,49156,49156,49156,49156,49156,54536,54536,54536,54536,54536,54536,50440,50440,50440,50440,50440,
- 50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,49156,49156,49156,49156,49156,
- 49156,54792,54792,54792,54792,54792,54792,50696,50696,50696,50696,50696,50696,50696,50696,50696,50696,50696,50696,50696,
- 50696,50696,50696,50696,50696,50696,50696,49156,49156,49156,49156,2,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
- ];
- var i16size = 2;
- var arr = _malloc(values.length * i16size);
- for (var i = 0; i < values.length; i++) {
- HEAP16[(((arr)+(i * i16size))>>1)]=values[i];
- }
- me.ret = allocate([arr + 128 * i16size], 'i16*', ALLOC_NORMAL);
- }
- return me.ret;
- }
- function ___ctype_tolower_loc() {
- // http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/libutil---ctype-tolower-loc.html
- var me = ___ctype_tolower_loc;
- if (!me.ret) {
- var values = [
- 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,
- 158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,
- 188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,
- 218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,
- 248,249,250,251,252,253,254,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,
- 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,97,98,99,100,101,102,103,
- 104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,91,92,93,94,95,96,97,98,99,100,101,102,103,
- 104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,
- 134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,
- 164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
- 194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
- 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,
- 254,255
- ];
- var i32size = 4;
- var arr = _malloc(values.length * i32size);
- for (var i = 0; i < values.length; i++) {
- HEAP32[(((arr)+(i * i32size))>>2)]=values[i];
- }
- me.ret = allocate([arr + 128 * i32size], 'i32*', ALLOC_NORMAL);
- }
- return me.ret;
- }
- function ___ctype_toupper_loc() {
- // http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/libutil---ctype-toupper-loc.html
- var me = ___ctype_toupper_loc;
- if (!me.ret) {
- var values = [
- 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,
- 158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,
- 188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,
- 218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,
- 248,249,250,251,252,253,254,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,
- 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,
- 73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,
- 81,82,83,84,85,86,87,88,89,90,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,
- 145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,
- 175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,
- 205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,
- 235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
- ];
- var i32size = 4;
- var arr = _malloc(values.length * i32size);
- for (var i = 0; i < values.length; i++) {
- HEAP32[(((arr)+(i * i32size))>>2)]=values[i];
- }
- me.ret = allocate([arr + 128 * i32size], 'i32*', ALLOC_NORMAL);
- }
- return me.ret;
- }
-
-
- function __isLeapYear(year) {
- return year%4 === 0 && (year%100 !== 0 || year%400 === 0);
- }
-
- function __arraySum(array, index) {
- var sum = 0;
- for (var i = 0; i <= index; sum += array[i++]);
- return sum;
- }
-
-
- var __MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31];
-
- var __MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];function __addDays(date, days) {
- var newDate = new Date(date.getTime());
- while(days > 0) {
- var leap = __isLeapYear(newDate.getFullYear());
- var currentMonth = newDate.getMonth();
- var daysInCurrentMonth = (leap ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR)[currentMonth];
-
- if (days > daysInCurrentMonth-newDate.getDate()) {
- // we spill over to next month
- days -= (daysInCurrentMonth-newDate.getDate()+1);
- newDate.setDate(1);
- if (currentMonth < 11) {
- newDate.setMonth(currentMonth+1)
- } else {
- newDate.setMonth(0);
- newDate.setFullYear(newDate.getFullYear()+1);
- }
- } else {
- // we stay in current month
- newDate.setDate(newDate.getDate()+days);
- return newDate;
- }
- }
-
- return newDate;
- }function _strftime(s, maxsize, format, tm) {
- // size_t strftime(char *restrict s, size_t maxsize, const char *restrict format, const struct tm *restrict timeptr);
- // http://pubs.opengroup.org/onlinepubs/009695399/functions/strftime.html
-
- var date = {
- tm_sec: HEAP32[((tm)>>2)],
- tm_min: HEAP32[(((tm)+(4))>>2)],
- tm_hour: HEAP32[(((tm)+(8))>>2)],
- tm_mday: HEAP32[(((tm)+(12))>>2)],
- tm_mon: HEAP32[(((tm)+(16))>>2)],
- tm_year: HEAP32[(((tm)+(20))>>2)],
- tm_wday: HEAP32[(((tm)+(24))>>2)],
- tm_yday: HEAP32[(((tm)+(28))>>2)],
- tm_isdst: HEAP32[(((tm)+(32))>>2)]
- };
-
- var pattern = Pointer_stringify(format);
-
- // expand format
- var EXPANSION_RULES_1 = {
- '%c': '%a %b %d %H:%M:%S %Y', // Replaced by the locale's appropriate date and time representation - e.g., Mon Aug 3 14:02:01 2013
- '%D': '%m/%d/%y', // Equivalent to %m / %d / %y
- '%F': '%Y-%m-%d', // Equivalent to %Y - %m - %d
- '%h': '%b', // Equivalent to %b
- '%r': '%I:%M:%S %p', // Replaced by the time in a.m. and p.m. notation
- '%R': '%H:%M', // Replaced by the time in 24-hour notation
- '%T': '%H:%M:%S', // Replaced by the time
- '%x': '%m/%d/%y', // Replaced by the locale's appropriate date representation
- '%X': '%H:%M:%S', // Replaced by the locale's appropriate date representation
- };
- for (var rule in EXPANSION_RULES_1) {
- pattern = pattern.replace(new RegExp(rule, 'g'), EXPANSION_RULES_1[rule]);
- }
-
- var WEEKDAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
- var MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
-
- function leadingSomething(value, digits, character) {
- var str = typeof value === 'number' ? value.toString() : (value || '');
- while (str.length < digits) {
- str = character[0]+str;
- }
- return str;
- };
-
- function leadingNulls(value, digits) {
- return leadingSomething(value, digits, '0');
- };
-
- function compareByDay(date1, date2) {
- function sgn(value) {
- return value < 0 ? -1 : (value > 0 ? 1 : 0);
- };
-
- var compare;
- if ((compare = sgn(date1.getFullYear()-date2.getFullYear())) === 0) {
- if ((compare = sgn(date1.getMonth()-date2.getMonth())) === 0) {
- compare = sgn(date1.getDate()-date2.getDate());
- }
- }
- return compare;
- };
-
- function getFirstWeekStartDate(janFourth) {
- switch (janFourth.getDay()) {
- case 0: // Sunday
- return new Date(janFourth.getFullYear()-1, 11, 29);
- case 1: // Monday
- return janFourth;
- case 2: // Tuesday
- return new Date(janFourth.getFullYear(), 0, 3);
- case 3: // Wednesday
- return new Date(janFourth.getFullYear(), 0, 2);
- case 4: // Thursday
- return new Date(janFourth.getFullYear(), 0, 1);
- case 5: // Friday
- return new Date(janFourth.getFullYear()-1, 11, 31);
- case 6: // Saturday
- return new Date(janFourth.getFullYear()-1, 11, 30);
- }
- };
-
- function getWeekBasedYear(date) {
- var thisDate = __addDays(new Date(date.tm_year+1900, 0, 1), date.tm_yday);
-
- var janFourthThisYear = new Date(thisDate.getFullYear(), 0, 4);
- var janFourthNextYear = new Date(thisDate.getFullYear()+1, 0, 4);
-
- var firstWeekStartThisYear = getFirstWeekStartDate(janFourthThisYear);
- var firstWeekStartNextYear = getFirstWeekStartDate(janFourthNextYear);
-
- if (compareByDay(firstWeekStartThisYear, thisDate) <= 0) {
- // this date is after the start of the first week of this year
- if (compareByDay(firstWeekStartNextYear, thisDate) <= 0) {
- return thisDate.getFullYear()+1;
- } else {
- return thisDate.getFullYear();
- }
- } else {
- return thisDate.getFullYear()-1;
- }
- };
-
- var EXPANSION_RULES_2 = {
- '%a': function(date) {
- return WEEKDAYS[date.tm_wday].substring(0,3);
- },
- '%A': function(date) {
- return WEEKDAYS[date.tm_wday];
- },
- '%b': function(date) {
- return MONTHS[date.tm_mon].substring(0,3);
- },
- '%B': function(date) {
- return MONTHS[date.tm_mon];
- },
- '%C': function(date) {
- var year = date.tm_year+1900;
- return leadingNulls(Math.floor(year/100),2);
- },
- '%d': function(date) {
- return leadingNulls(date.tm_mday, 2);
- },
- '%e': function(date) {
- return leadingSomething(date.tm_mday, 2, ' ');
- },
- '%g': function(date) {
- // %g, %G, and %V give values according to the ISO 8601:2000 standard week-based year.
- // In this system, weeks begin on a Monday and week 1 of the year is the week that includes
- // January 4th, which is also the week that includes the first Thursday of the year, and
- // is also the first week that contains at least four days in the year.
- // If the first Monday of January is the 2nd, 3rd, or 4th, the preceding days are part of
- // the last week of the preceding year; thus, for Saturday 2nd January 1999,
- // %G is replaced by 1998 and %V is replaced by 53. If December 29th, 30th,
- // or 31st is a Monday, it and any following days are part of week 1 of the following year.
- // Thus, for Tuesday 30th December 1997, %G is replaced by 1998 and %V is replaced by 01.
-
- return getWeekBasedYear(date).toString().substring(2);
- },
- '%G': function(date) {
- return getWeekBasedYear(date);
- },
- '%H': function(date) {
- return leadingNulls(date.tm_hour, 2);
- },
- '%I': function(date) {
- return leadingNulls(date.tm_hour < 13 ? date.tm_hour : date.tm_hour-12, 2);
- },
- '%j': function(date) {
- // Day of the year (001-366)
- return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, date.tm_mon-1), 3);
- },
- '%m': function(date) {
- return leadingNulls(date.tm_mon+1, 2);
- },
- '%M': function(date) {
- return leadingNulls(date.tm_min, 2);
- },
- '%n': function() {
- return '\n';
- },
- '%p': function(date) {
- if (date.tm_hour > 0 && date.tm_hour < 13) {
- return 'AM';
- } else {
- return 'PM';
- }
- },
- '%S': function(date) {
- return leadingNulls(date.tm_sec, 2);
- },
- '%t': function() {
- return '\t';
- },
- '%u': function(date) {
- var day = new Date(date.tm_year+1900, date.tm_mon+1, date.tm_mday, 0, 0, 0, 0);
- return day.getDay() || 7;
- },
- '%U': function(date) {
- // Replaced by the week number of the year as a decimal number [00,53].
- // The first Sunday of January is the first day of week 1;
- // days in the new year before this are in week 0. [ tm_year, tm_wday, tm_yday]
- var janFirst = new Date(date.tm_year+1900, 0, 1);
- var firstSunday = janFirst.getDay() === 0 ? janFirst : __addDays(janFirst, 7-janFirst.getDay());
- var endDate = new Date(date.tm_year+1900, date.tm_mon, date.tm_mday);
-
- // is target date after the first Sunday?
- if (compareByDay(firstSunday, endDate) < 0) {
- // calculate difference in days between first Sunday and endDate
- var februaryFirstUntilEndMonth = __arraySum(__isLeapYear(endDate.getFullYear()) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, endDate.getMonth()-1)-31;
- var firstSundayUntilEndJanuary = 31-firstSunday.getDate();
- var days = firstSundayUntilEndJanuary+februaryFirstUntilEndMonth+endDate.getDate();
- return leadingNulls(Math.ceil(days/7), 2);
- }
-
- return compareByDay(firstSunday, janFirst) === 0 ? '01': '00';
- },
- '%V': function(date) {
- // Replaced by the week number of the year (Monday as the first day of the week)
- // as a decimal number [01,53]. If the week containing 1 January has four
- // or more days in the new year, then it is considered week 1.
- // Otherwise, it is the last week of the previous year, and the next week is week 1.
- // Both January 4th and the first Thursday of January are always in week 1. [ tm_year, tm_wday, tm_yday]
- var janFourthThisYear = new Date(date.tm_year+1900, 0, 4);
- var janFourthNextYear = new Date(date.tm_year+1901, 0, 4);
-
- var firstWeekStartThisYear = getFirstWeekStartDate(janFourthThisYear);
- var firstWeekStartNextYear = getFirstWeekStartDate(janFourthNextYear);
-
- var endDate = __addDays(new Date(date.tm_year+1900, 0, 1), date.tm_yday);
-
- if (compareByDay(endDate, firstWeekStartThisYear) < 0) {
- // if given date is before this years first week, then it belongs to the 53rd week of last year
- return '53';
- }
-
- if (compareByDay(firstWeekStartNextYear, endDate) <= 0) {
- // if given date is after next years first week, then it belongs to the 01th week of next year
- return '01';
- }
-
- // given date is in between CW 01..53 of this calendar year
- var daysDifference;
- if (firstWeekStartThisYear.getFullYear() < date.tm_year+1900) {
- // first CW of this year starts last year
- daysDifference = date.tm_yday+32-firstWeekStartThisYear.getDate()
- } else {
- // first CW of this year starts this year
- daysDifference = date.tm_yday+1-firstWeekStartThisYear.getDate();
- }
- return leadingNulls(Math.ceil(daysDifference/7), 2);
- },
- '%w': function(date) {
- var day = new Date(date.tm_year+1900, date.tm_mon+1, date.tm_mday, 0, 0, 0, 0);
- return day.getDay();
- },
- '%W': function(date) {
- // Replaced by the week number of the year as a decimal number [00,53].
- // The first Monday of January is the first day of week 1;
- // days in the new year before this are in week 0. [ tm_year, tm_wday, tm_yday]
- var janFirst = new Date(date.tm_year, 0, 1);
- var firstMonday = janFirst.getDay() === 1 ? janFirst : __addDays(janFirst, janFirst.getDay() === 0 ? 1 : 7-janFirst.getDay()+1);
- var endDate = new Date(date.tm_year+1900, date.tm_mon, date.tm_mday);
-
- // is target date after the first Monday?
- if (compareByDay(firstMonday, endDate) < 0) {
- var februaryFirstUntilEndMonth = __arraySum(__isLeapYear(endDate.getFullYear()) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, endDate.getMonth()-1)-31;
- var firstMondayUntilEndJanuary = 31-firstMonday.getDate();
- var days = firstMondayUntilEndJanuary+februaryFirstUntilEndMonth+endDate.getDate();
- return leadingNulls(Math.ceil(days/7), 2);
- }
- return compareByDay(firstMonday, janFirst) === 0 ? '01': '00';
- },
- '%y': function(date) {
- // Replaced by the last two digits of the year as a decimal number [00,99]. [ tm_year]
- return (date.tm_year+1900).toString().substring(2);
- },
- '%Y': function(date) {
- // Replaced by the year as a decimal number (for example, 1997). [ tm_year]
- return date.tm_year+1900;
- },
- '%z': function(date) {
- // Replaced by the offset from UTC in the ISO 8601:2000 standard format ( +hhmm or -hhmm ),
- // or by no characters if no timezone is determinable.
- // For example, "-0430" means 4 hours 30 minutes behind UTC (west of Greenwich).
- // If tm_isdst is zero, the standard time offset is used.
- // If tm_isdst is greater than zero, the daylight savings time offset is used.
- // If tm_isdst is negative, no characters are returned.
- // FIXME: we cannot determine time zone (or can we?)
- return '';
- },
- '%Z': function(date) {
- // Replaced by the timezone name or abbreviation, or by no bytes if no timezone information exists. [ tm_isdst]
- // FIXME: we cannot determine time zone (or can we?)
- return '';
- },
- '%%': function() {
- return '%';
- }
- };
- for (var rule in EXPANSION_RULES_2) {
- if (pattern.indexOf(rule) >= 0) {
- pattern = pattern.replace(new RegExp(rule, 'g'), EXPANSION_RULES_2[rule](date));
- }
- }
-
- var bytes = intArrayFromString(pattern, false);
- if (bytes.length > maxsize) {
- return 0;
- }
-
- writeArrayToMemory(bytes, s);
- return bytes.length-1;
- }function _strftime_l(s, maxsize, format, tm) {
- return _strftime(s, maxsize, format, tm); // no locale support yet
- }
-
-
-
- function _isspace(chr) {
- return (chr == 32) || (chr >= 9 && chr <= 13);
- }
- function __parseInt64(str, endptr, base, min, max, unsign) {
- var isNegative = false;
- // Skip space.
- while (_isspace(HEAP8[(str)])) str++;
-
- // Check for a plus/minus sign.
- if (HEAP8[(str)] == 45) {
- str++;
- isNegative = true;
- } else if (HEAP8[(str)] == 43) {
- str++;
- }
-
- // Find base.
- var ok = false;
- var finalBase = base;
- if (!finalBase) {
- if (HEAP8[(str)] == 48) {
- if (HEAP8[((str+1)|0)] == 120 ||
- HEAP8[((str+1)|0)] == 88) {
- finalBase = 16;
- str += 2;
- } else {
- finalBase = 8;
- ok = true; // we saw an initial zero, perhaps the entire thing is just "0"
- }
- }
- } else if (finalBase==16) {
- if (HEAP8[(str)] == 48) {
- if (HEAP8[((str+1)|0)] == 120 ||
- HEAP8[((str+1)|0)] == 88) {
- str += 2;
- }
- }
- }
- if (!finalBase) finalBase = 10;
- var start = str;
-
- // Get digits.
- var chr;
- while ((chr = HEAP8[(str)]) != 0) {
- var digit = parseInt(String.fromCharCode(chr), finalBase);
- if (isNaN(digit)) {
- break;
- } else {
- str++;
- ok = true;
- }
- }
-
- if (!ok) {
- ___setErrNo(ERRNO_CODES.EINVAL);
- return ((asm["setTempRet0"](0),0)|0);
- }
-
- // Set end pointer.
- if (endptr) {
- HEAP32[((endptr)>>2)]=str;
- }
-
- try {
- var numberString = isNegative ? '-'+Pointer_stringify(start, str - start) : Pointer_stringify(start, str - start);
- i64Math.fromString(numberString, finalBase, min, max, unsign);
- } catch(e) {
- ___setErrNo(ERRNO_CODES.ERANGE); // not quite correct
- }
-
- return ((asm["setTempRet0"](((HEAP32[(((tempDoublePtr)+(4))>>2)])|0)),((HEAP32[((tempDoublePtr)>>2)])|0))|0);
- }function _strtoull(str, endptr, base) {
- return __parseInt64(str, endptr, base, 0, '18446744073709551615', true); // ULONG_MAX.
- }function _strtoull_l(str, endptr, base) {
- return _strtoull(str, endptr, base); // no locale support yet
- }
-
- function _strtoll(str, endptr, base) {
- return __parseInt64(str, endptr, base, '-9223372036854775808', '9223372036854775807'); // LLONG_MIN, LLONG_MAX.
- }function _strtoll_l(str, endptr, base) {
- return _strtoll(str, endptr, base); // no locale support yet
- }
- function _uselocale(locale) {
- return 0;
- }
- var _llvm_va_start=undefined;
-
- function _asprintf(s, format, varargs) {
- return _sprintf(-s, format, varargs);
- }function _vasprintf(s, format, va_arg) {
- return _asprintf(s, format, HEAP32[((va_arg)>>2)]);
- }
- function _llvm_va_end() {}
- function _vsnprintf(s, n, format, va_arg) {
- return _snprintf(s, n, format, HEAP32[((va_arg)>>2)]);
- }
- function _vsscanf(s, format, va_arg) {
- return _sscanf(s, format, HEAP32[((va_arg)>>2)]);
- }
- 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 _time(ptr) {
- var ret = Math.floor(Date.now()/1000);
- if (ptr) {
- HEAP32[((ptr)>>2)]=ret;
- }
- return ret;
- }
-
- function _copysign(a, b) {
- return __reallyNegative(a) === __reallyNegative(b) ? a : -a;
- }var _copysignl=_copysign;
-
- function _fmod(x, y) {
- return x % y;
- }var _fmodl=_fmod;
- var Browser={mainLoop:{scheduler:null,method:"",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 imagePlugin_canHandle(name) {
- return !Module.noImageDecoding && /\.(jpg|jpeg|png|bmp)$/i.test(name);
- };
- imagePlugin['handle'] = function imagePlugin_handle(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 img_onload() {
- 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 img_onerror(event) {
- console.log('Image ' + url + ' could not be decoded');
- if (onerror) onerror();
- };
- img.src = url;
- };
- Module['preloadPlugins'].push(imagePlugin);
-
- var audioPlugin = {};
- audioPlugin['canHandle'] = function audioPlugin_canHandle(name) {
- return !Module.noAudioDecoding && name.substr(-4) in { '.ogg': 1, '.wav': 1, '.mp3': 1 };
- };
- audioPlugin['handle'] = function audioPlugin_handle(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 audio_onerror(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, webGLContextAttributes) {
- var ctx;
- try {
- if (useWebGL) {
- var contextAttributes = {
- antialias: false,
- alpha: false
- };
-
- if (webGLContextAttributes) {
- for (var attribute in webGLContextAttributes) {
- contextAttributes[attribute] = webGLContextAttributes[attribute];
- }
- }
-
-
- var errorInfo = '?';
- function onContextCreationError(event) {
- errorInfo = event.statusMessage || errorInfo;
- }
- canvas.addEventListener('webglcontextcreationerror', onContextCreationError, false);
- try {
- ['experimental-webgl', 'webgl'].some(function(webglId) {
- return ctx = canvas.getContext(webglId, contextAttributes);
- });
- } finally {
- canvas.removeEventListener('webglcontextcreationerror', onContextCreationError, false);
- }
- } else {
- ctx = canvas.getContext('2d');
- }
- if (!ctx) throw ':(';
- } catch (e) {
- Module.print('Could not create canvas: ' + [errorInfo, 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) {
- GLctx = 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 requestAnimationFrame(func) {
- if (typeof window === 'undefined') { // Provide fallback to setTimeout if window is undefined (e.g. in Node.js)
- setTimeout(func, 1000/60);
- } else {
- 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;
- },getMouseWheelDelta:function (event) {
- return Math.max(-1, Math.min(1, event.type === 'DOMMouseScroll' ? event.detail : -event.wheelDelta));
- },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;
-
- // Neither .scrollX or .pageXOffset are defined in a spec, but
- // we prefer .scrollX because it is currently in a spec draft.
- // (see: http://www.w3.org/TR/2013/WD-cssom-view-20131217/)
- var scrollX = ((typeof window.scrollX !== 'undefined') ? window.scrollX : window.pageXOffset);
- var scrollY = ((typeof window.scrollY !== 'undefined') ? window.scrollY : window.pageYOffset);
- if (event.type == 'touchstart' ||
- event.type == 'touchend' ||
- event.type == 'touchmove') {
- var t = event.touches.item(0);
- if (t) {
- x = t.pageX - (scrollX + rect.left);
- y = t.pageY - (scrollY + rect.top);
- } else {
- return;
- }
- } else {
- x = event.pageX - (scrollX + rect.left);
- y = event.pageY - (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 xhr_onload() {
- 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();
- if (ENVIRONMENT_IS_NODE) { var fs = require("fs"); NODEFS.staticInit(); }
- __ATINIT__.push({ func: function() { SOCKFS.root = FS.mount(SOCKFS, {}, null); } });
- _fputc.ret = allocate([0], "i8", ALLOC_STATIC);
- _fgetc.ret = allocate([0], "i8", ALLOC_STATIC);
- Module["requestFullScreen"] = function Module_requestFullScreen(lockPointer, resizeCanvas) { Browser.requestFullScreen(lockPointer, resizeCanvas) };
- Module["requestAnimationFrame"] = function Module_requestAnimationFrame(func) { Browser.requestAnimationFrame(func) };
- Module["setCanvasSize"] = function Module_setCanvasSize(width, height, noUpdates) { Browser.setCanvasSize(width, height, noUpdates) };
- Module["pauseMainLoop"] = function Module_pauseMainLoop() { Browser.mainLoop.pause() };
- Module["resumeMainLoop"] = function Module_resumeMainLoop() { Browser.mainLoop.resume() };
- Module["getUserMedia"] = function Module_getUserMedia() { 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, "TOTAL_MEMORY not big enough for stack");
- 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_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_viiiiiii(index,a1,a2,a3,a4,a5,a6,a7) {
- try {
- Module["dynCall_viiiiiii"](index,a1,a2,a3,a4,a5,a6,a7);
- } 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_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_viiiiiid(index,a1,a2,a3,a4,a5,a6,a7) {
- try {
- Module["dynCall_viiiiiid"](index,a1,a2,a3,a4,a5,a6,a7);
- } 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_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_viiiiid(index,a1,a2,a3,a4,a5,a6) {
- try {
- Module["dynCall_viiiiid"](index,a1,a2,a3,a4,a5,a6);
- } 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_iiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8) {
- try {
- return Module["dynCall_iiiiiiiii"](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_viiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9) {
- try {
- Module["dynCall_viiiiiiiii"](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_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_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_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_iiiiii(index,a1,a2,a3,a4,a5) {
- try {
- return Module["dynCall_iiiiii"](index,a1,a2,a3,a4,a5);
- } 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 asm=(function(global,env,buffer){"use asm";var a=new global.Int8Array(buffer);var b=new global.Int16Array(buffer);var c=new global.Int32Array(buffer);var d=new global.Uint8Array(buffer);var e=new global.Uint16Array(buffer);var f=new global.Uint32Array(buffer);var g=new global.Float32Array(buffer);var h=new global.Float64Array(buffer);var i=env.STACKTOP|0;var j=env.STACK_MAX|0;var k=env.tempDoublePtr|0;var l=env.ABORT|0;var m=env.cttz_i8|0;var n=env.ctlz_i8|0;var o=env._stdin|0;var p=env._stdout|0;var q=env.__ZTVN10__cxxabiv117__class_type_infoE|0;var r=env.__ZTVN10__cxxabiv120__si_class_type_infoE|0;var s=env._stderr|0;var t=env.___dso_handle|0;var u=+env.NaN;var v=+env.Infinity;var w=0;var x=0;var y=0;var z=0;var A=0,B=0,C=0,D=0,E=0.0,F=0,G=0,H=0,I=0.0;var J=0;var K=0;var L=0;var M=0;var N=0;var O=0;var P=0;var Q=0;var R=0;var S=0;var T=global.Math.floor;var U=global.Math.abs;var V=global.Math.sqrt;var W=global.Math.pow;var X=global.Math.cos;var Y=global.Math.sin;var Z=global.Math.tan;var _=global.Math.acos;var $=global.Math.asin;var aa=global.Math.atan;var ba=global.Math.atan2;var ca=global.Math.exp;var da=global.Math.log;var ea=global.Math.ceil;var fa=global.Math.imul;var ga=env.abort;var ha=env.assert;var ia=env.asmPrintInt;var ja=env.asmPrintFloat;var ka=env.min;var la=env.invoke_viiiii;var ma=env.invoke_viiiiiii;var na=env.invoke_vi;var oa=env.invoke_vii;var pa=env.invoke_iii;var qa=env.invoke_iiii;var ra=env.invoke_viiiiiid;var sa=env.invoke_ii;var ta=env.invoke_viii;var ua=env.invoke_viiiiid;var va=env.invoke_v;var wa=env.invoke_iiiiiiiii;var xa=env.invoke_viiiiiiiii;var ya=env.invoke_viiiiiiii;var za=env.invoke_viiiiii;var Aa=env.invoke_iiiii;var Ba=env.invoke_iiiiii;var Ca=env.invoke_viiii;var Da=env._llvm_lifetime_end;var Ea=env._lseek;var Fa=env.__scanString;var Ga=env._fclose;var Ha=env._pthread_mutex_lock;var Ia=env.___cxa_end_catch;var Ja=env._strtoull;var Ka=env._fflush;var La=env._fputc;var Ma=env._fwrite;var Na=env._send;var Oa=env._fputs;var Pa=env._llvm_umul_with_overflow_i32;var Qa=env._isspace;var Ra=env._read;var Sa=env._isxdigit_l;var Ta=env._fileno;var Ua=env._fsync;var Va=env.___cxa_guard_abort;var Wa=env._newlocale;var Xa=env.___gxx_personality_v0;var Ya=env._pthread_cond_wait;var Za=env.___cxa_rethrow;var _a=env._fmod;var $a=env.___resumeException;var ab=env._llvm_va_end;var bb=env._vsscanf;var cb=env._snprintf;var db=env._fgetc;var eb=env.__getFloat;var fb=env._atexit;var gb=env.___cxa_free_exception;var hb=env._close;var ib=env._isdigit_l;var jb=env._clock;var kb=env.___setErrNo;var lb=env._isxdigit;var mb=env._ftell;var nb=env._exit;var ob=env._sprintf;var pb=env.___ctype_b_loc;var qb=env._freelocale;var rb=env._catgets;var sb=env.__isLeapYear;var tb=env._asprintf;var ub=env.___cxa_is_number_type;var vb=env.___cxa_does_inherit;var wb=env.___cxa_guard_acquire;var xb=env.___cxa_begin_catch;var yb=env._emscripten_memcpy_big;var zb=env._recv;var Ab=env.__parseInt64;var Bb=env.__ZSt18uncaught_exceptionv;var Cb=env._cos;var Db=env.__ZNSt9exceptionD2Ev;var Eb=env._times;var Fb=env._mkport;var Gb=env._copysign;var Hb=env.__exit;var Ib=env._strftime;var Jb=env.___cxa_throw;var Kb=env._printf;var Lb=env._pread;var Mb=env._fopen;var Nb=env._open;var Ob=env._strtoull_l;var Pb=env.__arraySum;var Qb=env._sysconf;var Rb=env._puts;var Sb=env._strtoll_l;var Tb=env.___cxa_find_matching_catch;var Ub=env.__formatString;var Vb=env._pthread_cond_broadcast;var Wb=env.__ZSt9terminatev;var Xb=env._pthread_mutex_unlock;var Yb=env.___cxa_call_unexpected;var Zb=env._sbrk;var _b=env.___errno_location;var $b=env._strerror;var ac=env._catclose;var bc=env._llvm_lifetime_start;var cc=env.___cxa_guard_release;var dc=env._ungetc;var ec=env._uselocale;var fc=env._vsnprintf;var gc=env._sscanf;var hc=env.___assert_fail;var ic=env._fread;var jc=env._strftime_l;var kc=env._abort;var lc=env._fprintf;var mc=env._isdigit;var nc=env._strtoll;var oc=env.__reallyNegative;var pc=env.__addDays;var qc=env._fabs;var rc=env._floor;var sc=env._fseek;var tc=env._sqrt;var uc=env._write;var vc=env.___cxa_allocate_exception;var wc=env._sin;var xc=env._vasprintf;var yc=env._catopen;var zc=env.___ctype_toupper_loc;var Ac=env.___ctype_tolower_loc;var Bc=env._pwrite;var Cc=env._strerror_r;var Dc=env._time;var Ec=0.0;
- // EMSCRIPTEN_START_FUNCS
- function ig(a,b,d,e,f,g,h,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0;k=i;i=i+1280|0;l=k+768|0;m=k+1024|0;n=kf((((a|0)>(b|0)?a:b)<<2)+4|0)|0;o=n;if((n|0)==0){p=k|0;ob(p|0,5288,(q=i,i=i+24|0,c[q>>2]=3528,c[q+8>>2]=88,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(p)}p=kf((a<<2)+4|0)|0;r=p;if((p|0)==0){s=k+256|0;ob(s|0,5288,(q=i,i=i+24|0,c[q>>2]=2816,c[q+8>>2]=90,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(s)}s=kf(d<<2)|0;d=s;if((s|0)==0){t=k+512|0;ob(t|0,5288,(q=i,i=i+24|0,c[q>>2]=1984,c[q+8>>2]=92,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(t)}t=(a|0)>0;if(t){Gq(n|0,0,a<<2|0)|0}u=(b|0)>0;if(u){v=0;w=c[e>>2]|0;while(1){x=v+1|0;y=e+(x<<2)|0;z=c[y>>2]|0;if((w|0)<(z|0)){A=w;while(1){B=o+(c[f+(A<<2)>>2]<<2)|0;c[B>>2]=(c[B>>2]|0)+1;B=A+1|0;C=c[y>>2]|0;if((B|0)<(C|0)){A=B}else{D=C;break}}}else{D=z}if((x|0)<(b|0)){v=x;w=D}else{break}}}c[r>>2]=0;a:do{if(t){D=0;w=0;while(1){v=o+(D<<2)|0;A=D+1|0;y=r+(A<<2)|0;c[y>>2]=(c[v>>2]|0)+w;c[v>>2]=w;if((A|0)>=(a|0)){break a}D=A;w=c[y>>2]|0}}}while(0);do{if(u){a=0;t=c[e>>2]|0;while(1){w=a+1|0;D=e+(w<<2)|0;x=c[D>>2]|0;if((t|0)<(x|0)){z=t;while(1){y=o+(c[f+(z<<2)>>2]<<2)|0;c[d+(c[y>>2]<<2)>>2]=a;c[y>>2]=(c[y>>2]|0)+1;y=z+1|0;A=c[D>>2]|0;if((y|0)<(A|0)){z=y}else{E=A;break}}}else{E=x}if((w|0)<(b|0)){a=w;t=E}else{break}}if(!u){F=0;break}Gq(n|0,-1|0,b<<2|0)|0;t=0;a=0;while(1){c[o+(a<<2)>>2]=a;z=c[e+(a<<2)>>2]|0;D=a+1|0;A=e+(D<<2)|0;y=c[A>>2]|0;if((z|0)<(y|0)){v=t;C=z;z=y;while(1){y=c[f+(C<<2)>>2]|0;B=c[r+(y<<2)>>2]|0;G=r+(y+1<<2)|0;y=c[G>>2]|0;if((B|0)<(y|0)){H=B;B=v;I=y;while(1){y=o+(c[d+(H<<2)>>2]<<2)|0;if((c[y>>2]|0)==(a|0)){J=B;K=I}else{c[y>>2]=a;J=B+1|0;K=c[G>>2]|0}y=H+1|0;if((y|0)<(K|0)){H=y;B=J;I=K}else{break}}L=J;M=c[A>>2]|0}else{L=v;M=z}I=C+1|0;if((I|0)<(M|0)){v=L;C=I;z=M}else{N=L;break}}}else{N=t}if((D|0)<(b|0)){t=N;a=D}else{F=N;break}}}else{F=0}}while(0);c[g>>2]=F;F=kf((b<<2)+4|0)|0;c[h>>2]=F;if((F|0)==0){F=l|0;ob(F|0,5288,(q=i,i=i+24|0,c[q>>2]=1472,c[q+8>>2]=154,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(F)}F=c[g>>2]|0;do{if((F|0)!=0){g=kf(F<<2)|0;c[j>>2]=g;if((g|0)!=0){break}g=m|0;ob(g|0,5288,(q=i,i=i+24|0,c[q>>2]=976,c[q+8>>2]=157,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(g)}}while(0);q=c[h>>2]|0;h=c[j>>2]|0;if(!u){O=0;P=q+(b<<2)|0;c[P>>2]=O;lf(n);lf(p);lf(s);i=k;return}Gq(n|0,-1|0,b<<2|0)|0;u=0;j=0;while(1){c[q+(j<<2)>>2]=u;c[o+(j<<2)>>2]=j;m=c[e+(j<<2)>>2]|0;F=j+1|0;g=e+(F<<2)|0;l=c[g>>2]|0;if((m|0)<(l|0)){N=u;L=m;m=l;while(1){l=c[f+(L<<2)>>2]|0;M=c[r+(l<<2)>>2]|0;J=r+(l+1<<2)|0;l=c[J>>2]|0;if((M|0)<(l|0)){K=M;M=N;E=l;while(1){l=c[d+(K<<2)>>2]|0;a=o+(l<<2)|0;if((c[a>>2]|0)==(j|0)){Q=M;R=E}else{c[a>>2]=j;c[h+(M<<2)>>2]=l;Q=M+1|0;R=c[J>>2]|0}l=K+1|0;if((l|0)<(R|0)){K=l;M=Q;E=R}else{break}}S=Q;T=c[g>>2]|0}else{S=N;T=m}E=L+1|0;if((E|0)<(T|0)){N=S;L=E;m=T}else{U=S;break}}}else{U=u}if((F|0)<(b|0)){u=U;j=F}else{O=U;break}}P=q+(b<<2)|0;c[P>>2]=O;lf(n);lf(p);lf(s);i=k;return}function jg(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0;j=i;i=i+1280|0;k=j+768|0;l=j+1024|0;m=a<<2;n=kf(m)|0;o=n;if((n|0)==0){p=j|0;ob(p|0,5288,(q=i,i=i+24|0,c[q>>2]=3528,c[q+8>>2]=222,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(p)}p=m+4|0;m=kf(p)|0;r=m;if((m|0)==0){s=j+256|0;ob(s|0,5288,(q=i,i=i+24|0,c[q>>2]=13360,c[q+8>>2]=224,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(s)}s=kf(b<<2)|0;b=s;if((s|0)==0){t=j+512|0;ob(t|0,5288,(q=i,i=i+24|0,c[q>>2]=12800,c[q+8>>2]=226,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(t)}t=(a|0)>0;do{if(t){Gq(n|0,0,a<<2|0)|0;u=0;v=c[d>>2]|0;while(1){w=u+1|0;x=d+(w<<2)|0;y=c[x>>2]|0;if((v|0)<(y|0)){z=v;while(1){A=o+(c[e+(z<<2)>>2]<<2)|0;c[A>>2]=(c[A>>2]|0)+1;A=z+1|0;B=c[x>>2]|0;if((A|0)<(B|0)){z=A}else{C=B;break}}}else{C=y}if((w|0)<(a|0)){u=w;v=C}else{break}}c[r>>2]=0;if(t){D=0;E=0}else{F=0;break}while(1){v=o+(D<<2)|0;u=D+1|0;z=r+(u<<2)|0;c[z>>2]=(c[v>>2]|0)+E;c[v>>2]=E;if((u|0)>=(a|0)){break}D=u;E=c[z>>2]|0}if(!t){F=0;break}z=0;u=c[d>>2]|0;while(1){v=z+1|0;x=d+(v<<2)|0;B=c[x>>2]|0;if((u|0)<(B|0)){A=u;while(1){G=o+(c[e+(A<<2)>>2]<<2)|0;c[b+(c[G>>2]<<2)>>2]=z;c[G>>2]=(c[G>>2]|0)+1;G=A+1|0;H=c[x>>2]|0;if((G|0)<(H|0)){A=G}else{I=H;break}}}else{I=B}if((v|0)<(a|0)){z=v;u=I}else{break}}if(!t){F=0;break}Gq(n|0,-1|0,a<<2|0)|0;u=0;z=0;while(1){c[o+(z<<2)>>2]=z;A=c[d+(z<<2)>>2]|0;x=z+1|0;w=d+(x<<2)|0;y=c[w>>2]|0;if((A|0)<(y|0)){H=u;G=A;A=y;while(1){y=o+(c[e+(G<<2)>>2]<<2)|0;if((c[y>>2]|0)==(z|0)){J=H;K=A}else{c[y>>2]=z;J=H+1|0;K=c[w>>2]|0}y=G+1|0;if((y|0)<(K|0)){H=J;G=y;A=K}else{L=J;break}}}else{L=u}A=c[r+(z<<2)>>2]|0;G=r+(x<<2)|0;H=c[G>>2]|0;if((A|0)<(H|0)){w=L;v=A;A=H;while(1){H=o+(c[b+(v<<2)>>2]<<2)|0;if((c[H>>2]|0)==(z|0)){M=w;N=A}else{c[H>>2]=z;M=w+1|0;N=c[G>>2]|0}H=v+1|0;if((H|0)<(N|0)){w=M;v=H;A=N}else{O=M;break}}}else{O=L}if((x|0)<(a|0)){u=O;z=x}else{F=O;break}}}else{c[r>>2]=0;F=0}}while(0);c[f>>2]=F;F=kf(p)|0;c[g>>2]=F;if((F|0)==0){F=k|0;ob(F|0,5288,(q=i,i=i+24|0,c[q>>2]=12152,c[q+8>>2]=289,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(F)}F=c[f>>2]|0;do{if((F|0)!=0){f=kf(F<<2)|0;c[h>>2]=f;if((f|0)!=0){break}f=l|0;ob(f|0,5288,(q=i,i=i+24|0,c[q>>2]=11712,c[q+8>>2]=292,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(f)}}while(0);if(!t){P=0;Q=c[g>>2]|0;R=Q+(a<<2)|0;c[R>>2]=P;lf(n);lf(m);lf(s);i=j;return}Gq(n|0,-1|0,a<<2|0)|0;t=c[g>>2]|0;g=0;q=0;while(1){c[t+(q<<2)>>2]=g;c[o+(q<<2)>>2]=q;l=c[d+(q<<2)>>2]|0;F=q+1|0;f=d+(F<<2)|0;k=c[f>>2]|0;if((l|0)<(k|0)){p=g;O=l;l=k;while(1){k=c[e+(O<<2)>>2]|0;L=o+(k<<2)|0;if((c[L>>2]|0)==(q|0)){S=p;T=l}else{c[L>>2]=q;c[(c[h>>2]|0)+(p<<2)>>2]=k;S=p+1|0;T=c[f>>2]|0}k=O+1|0;if((k|0)<(T|0)){p=S;O=k;l=T}else{U=S;break}}}else{U=g}l=c[r+(q<<2)>>2]|0;O=r+(F<<2)|0;p=c[O>>2]|0;if((l|0)<(p|0)){f=U;k=l;l=p;while(1){p=c[b+(k<<2)>>2]|0;L=o+(p<<2)|0;if((c[L>>2]|0)==(q|0)){V=f;W=l}else{c[L>>2]=q;c[(c[h>>2]|0)+(f<<2)>>2]=p;V=f+1|0;W=c[O>>2]|0}p=k+1|0;if((p|0)<(W|0)){f=V;k=p;l=W}else{X=V;break}}}else{X=U}if((F|0)<(a|0)){g=X;q=F}else{P=X;Q=t;break}}R=Q+(a<<2)|0;c[R>>2]=P;lf(n);lf(m);lf(s);i=j;return}function kg(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;e=i;i=i+1848|0;f=e|0;g=e+8|0;h=e+16|0;j=e+24|0;k=e+32|0;l=e+40|0;m=e+48|0;n=e+56|0;o=e+312|0;p=e+568|0;q=e+824|0;r=e+1080|0;s=e+1336|0;t=e+1592|0;u=c[b+20>>2]|0;c[g>>2]=0;v=c[b+12>>2]|0;w=c[b+16>>2]|0;c[f>>2]=w;+gg();if((a|0)==3){hg(v,w,c[u>>2]|0,c[u+12>>2]|0,c[u+8>>2]|0,d);i=e;return}else if((a|0)==1){ig(v,w,c[u>>2]|0,c[u+12>>2]|0,c[u+8>>2]|0,g,h,m);+gg()}else if((a|0)==2){if((v|0)==(w|0)){x=v}else{v=n|0;ob(v|0,5288,(y=i,i=i+24|0,c[y>>2]=11480,c[y+8>>2]=395,c[y+16>>2]=8312,y)|0)|0;i=y;Ze(v);x=c[f>>2]|0}jg(x,c[u>>2]|0,c[u+12>>2]|0,c[u+8>>2]|0,g,h,m);+gg()}else if((a|0)==0){if((w|0)>0){z=0}else{i=e;return}do{c[d+(z<<2)>>2]=z;z=z+1|0;}while((z|0)<(w|0));i=e;return}else{w=o|0;ob(w|0,5288,(y=i,i=i+24|0,c[y>>2]=11096,c[y+8>>2]=411,c[y+16>>2]=8312,y)|0)|0;i=y;Ze(w)}w=c[g>>2]|0;if((w|0)==0){g=c[f>>2]|0;if((g|0)>0){o=0;do{c[d+(o<<2)>>2]=o;o=o+1|0;}while((o|0)<(g|0))}A=c[h>>2]|0}else{+gg();c[j>>2]=0;c[k>>2]=2147483647;g=c[f>>2]|0;o=kf(g<<2)|0;z=o;if((o|0)==0){a=p|0;ob(a|0,5288,(y=i,i=i+24|0,c[y>>2]=10936,c[y+8>>2]=422,c[y+16>>2]=8312,y)|0)|0;i=y;Ze(a);B=c[f>>2]|0;C=c[j>>2]|0}else{B=g;C=0}g=kf(C+B<<2)|0;a=g;if((g|0)==0){p=q|0;ob(p|0,5288,(y=i,i=i+24|0,c[y>>2]=10696,c[y+8>>2]=424,c[y+16>>2]=8312,y)|0)|0;i=y;Ze(p);D=c[f>>2]|0;E=c[j>>2]|0}else{D=B;E=C}C=kf(E+D<<2)|0;E=C;if((C|0)==0){B=r|0;ob(B|0,5288,(y=i,i=i+24|0,c[y>>2]=10504,c[y+8>>2]=426,c[y+16>>2]=8312,y)|0)|0;i=y;Ze(B);F=c[f>>2]|0}else{F=D}D=kf(F<<2)|0;B=D;if((D|0)==0){r=s|0;ob(r|0,5288,(y=i,i=i+24|0,c[y>>2]=10232,c[y+8>>2]=428,c[y+16>>2]=8312,y)|0)|0;i=y;Ze(r);G=c[f>>2]|0}else{G=F}F=kf(G<<2)|0;r=F;if((F|0)==0){s=t|0;ob(s|0,5288,(y=i,i=i+24|0,c[y>>2]=9520,c[y+8>>2]=430,c[y+16>>2]=8312,y)|0)|0;i=y;Ze(s);H=c[f>>2]|0}else{H=G}if((H|0)>=0){H=c[h>>2]|0;G=0;do{s=H+(G<<2)|0;c[s>>2]=(c[s>>2]|0)+1;G=G+1|0;}while((G|0)<=(c[f>>2]|0))}G=c[m>>2]|0;if((w|0)>0){m=0;do{H=G+(m<<2)|0;c[H>>2]=(c[H>>2]|0)+1;m=m+1|0;}while((m|0)<(w|0))}w=c[h>>2]|0;lg(f,w,G,d,z,j,a,E,B,r,k,l)|0;l=c[f>>2]|0;if((l|0)>0){f=0;do{k=d+(f<<2)|0;c[k>>2]=(c[k>>2]|0)-1;f=f+1|0;}while((f|0)<(l|0))}lf(o);lf(g);lf(C);lf(D);lf(F);lf(G);+gg();A=w}lf(A);i=e;return}function lg(a,b,d,e,f,g,h,i,j,k,l,m){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;if((c[a>>2]|0)<1){return 0}c[m>>2]=0;mg(a,b,0,h,e,f,i,j,k)|0;c[5862]=1;n=c[h>>2]|0;c[5864]=n;if((n|0)<1){o=1}else{p=n;while(1){c[5866]=p;n=p-1|0;c[5864]=c[e+(n<<2)>>2];c[k+(n<<2)>>2]=c[l>>2];c[e+((c[5866]|0)-1<<2)>>2]=-(c[5862]|0);n=(c[5862]|0)+1|0;c[5862]=n;q=c[5864]|0;if((q|0)<1){o=n;break}else{p=q}}}a:do{if((o|0)<=(c[a>>2]|0)){c[5860]=1;c[h>>2]=0;c[5870]=2;p=2;while(1){if((c[h+(p-1<<2)>>2]|0)<=0){q=p+1|0;c[5870]=q;p=q;continue}c[5868]=(c[g>>2]|0)+p;c[5874]=0;q=p;while(1){n=h+(q-1<<2)|0;r=c[n>>2]|0;c[5866]=r;if((r|0)<=0){s=q+1|0;c[5870]=s;if((s|0)>(c[5868]|0)){break}else{q=s;continue}}s=c[e+(r-1<<2)>>2]|0;c[5864]=s;c[n>>2]=s;s=c[5864]|0;if((s|0)>0){c[f+(s-1<<2)>>2]=-(c[5870]|0)}c[e+((c[5866]|0)-1<<2)>>2]=-(c[5862]|0);c[m>>2]=(c[m>>2]|0)-2+(c[5870]|0)+(c[i+((c[5866]|0)-1<<2)>>2]|0);if(((c[i+((c[5866]|0)-1<<2)>>2]|0)+(c[5862]|0)|0)>(c[a>>2]|0)){break a}s=(c[5860]|0)+1|0;c[5860]=s;do{if((s|0)>=(c[l>>2]|0)){c[5860]=1;n=c[a>>2]|0;c[5872]=1;if((n|0)<1){break}else{t=1}do{r=k+(t-1<<2)|0;if((c[r>>2]|0)<(c[l>>2]|0)){c[r>>2]=0;u=c[5872]|0}else{u=t}t=u+1|0;c[5872]=t;}while((t|0)<=(n|0))}}while(0);ng(23464,b,d,h,e,f,i,j,k,l,23440)|0;s=(c[5866]|0)-1|0;c[5862]=(c[5862]|0)+(c[i+(s<<2)>>2]|0);c[j+(s<<2)>>2]=c[5874];c[5874]=c[5866];if(!((c[g>>2]|0)>-1)){break}q=c[5870]|0}if((c[5862]|0)>(c[a>>2]|0)){break a}og(23496,a,b,d,g,23480,h,e,f,i,j,k,l,23440)|0;p=c[5870]|0}}}while(0);pg(a,f,e,i)|0;return 0}function mg(a,b,d,e,f,g,h,i,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,l=0;d=c[a>>2]|0;c[5814]=1;if((d|0)>=1){k=1;do{c[e+(k-1<<2)>>2]=0;c[h+((c[5814]|0)-1<<2)>>2]=1;c[j+((c[5814]|0)-1<<2)>>2]=0;c[i+((c[5814]|0)-1<<2)>>2]=0;k=(c[5814]|0)+1|0;c[5814]=k;}while((k|0)<=(d|0))}d=c[a>>2]|0;c[5814]=1;if((d|0)<1){return 0}else{l=1}do{a=l-1|0;k=(c[b+(l<<2)>>2]|0)-(c[b+(a<<2)>>2]|0)|0;c[5816]=k+1;i=c[e+(k<<2)>>2]|0;c[5818]=i;c[f+(a<<2)>>2]=i;c[e+((c[5816]|0)-1<<2)>>2]=c[5814];i=c[5818]|0;if((i|0)>0){c[g+(i-1<<2)>>2]=c[5814]}c[g+((c[5814]|0)-1<<2)>>2]=-(c[5816]|0);l=(c[5814]|0)+1|0;c[5814]=l;}while((l|0)<=(d|0));return 0}function ng(a,b,d,e,f,g,h,i,j,k,l){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0;c[j+((c[a>>2]|0)-1<<2)>>2]=c[l>>2];m=c[b+((c[a>>2]|0)-1<<2)>>2]|0;c[5844]=m;n=(c[b+(c[a>>2]<<2)>>2]|0)-1|0;c[5846]=n;c[5850]=0;c[5824]=m;c[5826]=n;c[5848]=m;do{if((m|0)<=(n|0)){o=m;do{p=c[d+(o-1<<2)>>2]|0;c[5834]=p;if((p|0)==0){break}q=j+(p-1<<2)|0;p=c[l>>2]|0;do{if((c[q>>2]|0)<(p|0)){c[q>>2]=p;r=c[5834]|0;s=r-1|0;if((c[f+(s<<2)>>2]|0)<0){c[i+(s<<2)>>2]=c[5850];c[5850]=c[5834];break}else{c[d+((c[5824]|0)-1<<2)>>2]=r;c[5824]=(c[5824]|0)+1;break}}}while(0);o=(c[5848]|0)+1|0;c[5848]=o;}while((o|0)<=(n|0));o=c[5850]|0;if((o|0)<1){break}else{t=o}do{c[d+((c[5826]|0)-1<<2)>>2]=-t;o=c[5850]|0;c[5836]=o;p=c[b+(o-1<<2)>>2]|0;c[5838]=p;q=(c[b+(o<<2)>>2]|0)-1|0;c[5840]=q;c[5842]=p;a:do{if((p|0)<=(q|0)){o=p;r=q;do{s=o;while(1){u=c[d+(s-1<<2)>>2]|0;c[5832]=u;v=-u|0;c[5836]=v;if((u|0)<0){break}if((u|0)==0){break a}w=u-1|0;x=j+(w<<2)|0;y=c[l>>2]|0;do{if((c[x>>2]|0)<(y|0)){if((c[f+(w<<2)>>2]|0)<0){z=s;break}c[x>>2]=y;A=c[5824]|0;B=c[5826]|0;if((A|0)<(B|0)){C=A}else{A=B;while(1){B=c[d+(A-1<<2)>>2]|0;D=-B|0;c[5836]=D;E=c[b+(~B<<2)>>2]|0;c[5824]=E;B=(c[b+(D<<2)>>2]|0)-1|0;c[5826]=B;if((E|0)<(B|0)){C=E;break}else{A=B}}}c[d+(C-1<<2)>>2]=c[5832];c[5824]=(c[5824]|0)+1;z=c[5842]|0}else{z=s}}while(0);s=z+1|0;c[5842]=s;if((s|0)>(r|0)){break a}}o=c[b+(~u<<2)>>2]|0;c[5838]=o;r=(c[b+(v<<2)>>2]|0)-1|0;c[5840]=r;c[5842]=o;}while((o|0)<=(r|0))}}while(0);t=c[i+((c[5850]|0)-1<<2)>>2]|0;c[5850]=t;}while((t|0)>=1)}}while(0);t=c[5824]|0;if((t|0)<=(c[5826]|0)){c[d+(t-1<<2)>>2]=0}t=c[a>>2]|0;c[5836]=t;i=c[b+(t-1<<2)>>2]|0;c[5844]=i;v=(c[b+(t<<2)>>2]|0)-1|0;c[5846]=v;c[5848]=i;if((i|0)>(v|0)){return 0}else{F=i;G=v}b:while(1){v=F;while(1){H=c[d+(v-1<<2)>>2]|0;c[5822]=H;I=-H|0;c[5836]=I;if((H|0)<0){break}if((H|0)==0){J=46;break b}i=H-1|0;t=c[g+(i<<2)>>2]|0;c[5828]=t;do{if((t|0)!=0){if((t|0)==(-(c[k>>2]|0)|0)){break}u=c[f+(i<<2)>>2]|0;c[5830]=u;if((u|0)>0){c[g+(u-1<<2)>>2]=t;K=c[5828]|0}else{K=t}if((K|0)>0){c[f+(K-1<<2)>>2]=c[5830];L=c[5828]|0}else{L=K}if((L|0)>=0){break}c[e+(~L<<2)>>2]=c[5830]}}while(0);t=c[5822]|0;i=c[b+(t-1<<2)>>2]|0;c[5838]=i;u=(c[b+(t<<2)>>2]|0)-1|0;c[5840]=u;c[5820]=i;c[5842]=i;c:do{if((i|0)>(u|0)){M=i}else{t=i;z=i;while(1){C=c[d+(t-1<<2)>>2]|0;c[5834]=C;if((C|0)==0){M=z;break c}if((c[j+(C-1<<2)>>2]|0)<(c[l>>2]|0)){c[d+(z-1<<2)>>2]=C;C=(c[5820]|0)+1|0;c[5820]=C;N=C;O=c[5842]|0}else{N=z;O=t}C=O+1|0;c[5842]=C;if((C|0)>(u|0)){M=N;break}else{t=C;z=N}}}}while(0);u=M-(c[5838]|0)|0;do{if((u|0)>0){c[f+((c[5822]|0)-1<<2)>>2]=u+1;c[g+((c[5822]|0)-1<<2)>>2]=0;c[d+((c[5820]|0)-1<<2)>>2]=c[a>>2];i=c[5820]|0;z=i+1|0;c[5820]=z;if((z|0)>(c[5840]|0)){break}c[d+(i<<2)>>2]=0}else{i=h+((c[a>>2]|0)-1<<2)|0;c[i>>2]=(c[i>>2]|0)+(c[h+((c[5822]|0)-1<<2)>>2]|0);c[h+((c[5822]|0)-1<<2)>>2]=0;c[j+((c[5822]|0)-1<<2)>>2]=c[k>>2];c[f+((c[5822]|0)-1<<2)>>2]=-(c[a>>2]|0);c[g+((c[5822]|0)-1<<2)>>2]=-(c[k>>2]|0)}}while(0);u=(c[5848]|0)+1|0;c[5848]=u;if((u|0)>(G|0)){J=46;break b}else{v=u}}v=c[b+(~H<<2)>>2]|0;c[5844]=v;u=(c[b+(I<<2)>>2]|0)-1|0;c[5846]=u;c[5848]=v;if((v|0)>(u|0)){J=46;break}else{F=v;G=u}}if((J|0)==46){return 0}return 0}function og(b,d,e,f,g,h,i,j,k,l,m,n,o,p){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;var q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0;q=(c[g>>2]|0)+(c[h>>2]|0)|0;c[5780]=q;g=c[b>>2]|0;c[5796]=g;if((g|0)<1){return 0}else{r=g;s=q}while(1){q=s+(c[p>>2]|0)|0;c[5778]=q;if((q|0)<(c[o>>2]|0)){t=r}else{c[p>>2]=1;q=c[d>>2]|0;c[5790]=1;if((q|0)>=1){g=1;do{b=n+(g-1<<2)|0;if((c[b>>2]|0)<(c[o>>2]|0)){c[b>>2]=0;u=c[5790]|0}else{u=g}g=u+1|0;c[5790]=g;}while((g|0)<=(q|0))}c[5778]=(c[5780]|0)+(c[p>>2]|0);t=c[5796]|0}c[5772]=0;c[5770]=0;c[5798]=0;c[5782]=t;q=c[e+(t-1<<2)>>2]|0;c[5788]=q;g=(c[e+(t<<2)>>2]|0)-1|0;c[5790]=q;a:do{if((q|0)<=(g|0)){b=q;v=g;do{w=b;while(1){x=c[f+(w-1<<2)>>2]|0;c[5794]=x;y=-x|0;c[5782]=y;if((x|0)<0){break}if((x|0)==0){break a}z=x-1|0;A=c[l+(z<<2)>>2]|0;do{if((A|0)!=0){c[5798]=(c[5798]|0)+A;c[n+(z<<2)>>2]=c[5778];B=(c[5794]|0)-1|0;if((c[k+(B<<2)>>2]|0)!=0){break}if((c[j+(B<<2)>>2]|0)==2){c[m+(B<<2)>>2]=c[5772];c[5772]=c[5794];break}else{c[m+(B<<2)>>2]=c[5770];c[5770]=c[5794];break}}}while(0);w=(c[5790]|0)+1|0;c[5790]=w;if((w|0)>(v|0)){break a}}b=c[e+(~x<<2)>>2]|0;c[5788]=b;v=(c[e+(y<<2)>>2]|0)-1|0;c[5790]=b;}while((b|0)<=(v|0))}}while(0);g=c[5772]|0;c[5794]=g;q=g;b:while(1){c:do{if((q|0)<1){g=c[5770]|0;c[5794]=g;C=g}else{if((c[k+(q-1<<2)>>2]|0)!=0){g=c[m+((c[5794]|0)-1<<2)>>2]|0;c[5794]=g;q=g;continue b}c[p>>2]=(c[p>>2]|0)+1;g=c[5798]|0;c[5800]=g;v=c[5794]|0;b=c[e+(v-1<<2)>>2]|0;c[5788]=b;w=c[f+(b-1<<2)>>2]|0;c[5776]=w;if((w|0)==(c[5796]|0)){z=c[f+(b<<2)>>2]|0;c[5776]=z;D=z}else{D=w}c[5782]=D;w=D-1|0;if((c[j+(w<<2)>>2]|0)>=0){c[5800]=g+(c[l+(w<<2)>>2]|0);E=1;F=62;break}g=c[e+(w<<2)>>2]|0;c[5788]=g;w=(c[e+(D<<2)>>2]|0)-1|0;c[5790]=g;if((g|0)>(w|0)){E=1;F=62;break}else{G=g;H=w;I=v}while(1){v=G;w=I;d:while(1){J=c[f+(v-1<<2)>>2]|0;c[5774]=J;K=-J|0;c[5782]=K;do{if((J|0)!=(w|0)){if((J|0)<0){break d}if((J|0)==0){E=1;F=62;break c}g=J-1|0;z=c[l+(g<<2)>>2]|0;if((z|0)==0){break}b=n+(g<<2)|0;A=c[p>>2]|0;if((c[b>>2]|0)<(A|0)){c[b>>2]=A;c[5800]=(c[5800]|0)+(c[l+((c[5774]|0)-1<<2)>>2]|0);break}A=k+(g<<2)|0;if((c[A>>2]|0)!=0){break}if((c[j+(g<<2)>>2]|0)==2){g=l+(w-1<<2)|0;c[g>>2]=(c[g>>2]|0)+z;c[l+((c[5774]|0)-1<<2)>>2]=0;c[n+((c[5774]|0)-1<<2)>>2]=c[o>>2];c[j+((c[5774]|0)-1<<2)>>2]=-(c[5794]|0);c[k+((c[5774]|0)-1<<2)>>2]=-(c[o>>2]|0);break}else{c[A>>2]=-(c[o>>2]|0);break}}}while(0);A=(c[5790]|0)+1|0;c[5790]=A;if((A|0)>(H|0)){E=1;F=62;break c}v=A;w=c[5794]|0}v=c[e+(~J<<2)>>2]|0;c[5788]=v;A=(c[e+(K<<2)>>2]|0)-1|0;c[5790]=v;if((v|0)>(A|0)){E=1;F=62;break}else{G=v;H=A;I=w}}}}while(0);e:while(1){if((F|0)==62){F=0;A=(c[5794]|0)-1|0;v=(c[5800]|0)-(c[l+(A<<2)>>2]|0)|0;c[5800]=v+1;z=c[i+(v<<2)>>2]|0;c[5792]=z;c[j+(A<<2)>>2]=z;c[k+((c[5794]|0)-1<<2)>>2]=-(c[5800]|0);z=c[5792]|0;if((z|0)>0){c[k+(z-1<<2)>>2]=c[5794]}c[i+((c[5800]|0)-1<<2)>>2]=c[5794];z=c[5800]|0;if((z|0)<(c[h>>2]|0)){c[h>>2]=z;z=c[m+((c[5794]|0)-1<<2)>>2]|0;c[5794]=z;if(E){q=z;continue b}else{C=z;continue}}else{z=c[m+((c[5794]|0)-1<<2)>>2]|0;c[5794]=z;if(E){q=z;continue b}else{C=z;continue}}}if((C|0)<1){break b}if((c[k+(C-1<<2)>>2]|0)!=0){z=c[m+((c[5794]|0)-1<<2)>>2]|0;c[5794]=z;C=z;continue}c[p>>2]=(c[p>>2]|0)+1;c[5800]=c[5798];z=c[5794]|0;A=c[e+(z-1<<2)>>2]|0;c[5788]=A;v=(c[e+(z<<2)>>2]|0)-1|0;c[5790]=A;if((A|0)>(v|0)){E=0;F=62;continue}else{L=A}while(1){A=c[f+(L-1<<2)>>2]|0;c[5776]=A;if((A|0)==0){E=0;F=62;continue e}z=n+(A-1<<2)|0;A=c[p>>2]|0;f:do{if((c[z>>2]|0)<(A|0)){c[z>>2]=A;g=c[5776]|0;c[5782]=g;b=g-1|0;if((c[j+(b<<2)>>2]|0)>=0){c[5800]=(c[5800]|0)+(c[l+(b<<2)>>2]|0);break}B=c[e+(b<<2)>>2]|0;c[5784]=B;b=(c[e+(g<<2)>>2]|0)-1|0;c[5786]=B;if((B|0)>(b|0)){break}else{M=B;N=b}do{b=M;while(1){O=c[f+(b-1<<2)>>2]|0;c[5774]=O;P=-O|0;c[5782]=P;if((O|0)<0){break}if((O|0)==0){break f}B=n+(O-1<<2)|0;g=c[p>>2]|0;if((c[B>>2]|0)<(g|0)){c[B>>2]=g;c[5800]=(c[5800]|0)+(c[l+((c[5774]|0)-1<<2)>>2]|0);Q=c[5786]|0}else{Q=b}b=Q+1|0;c[5786]=b;if((b|0)>(N|0)){break f}}M=c[e+(~O<<2)>>2]|0;c[5784]=M;N=(c[e+(P<<2)>>2]|0)-1|0;c[5786]=M;}while((M|0)<=(N|0))}}while(0);A=(c[5790]|0)+1|0;c[5790]=A;if((A|0)>(v|0)){E=0;F=62;continue e}else{L=A}}}}c[p>>2]=c[5778];q=c[m+((c[5796]|0)-1<<2)>>2]|0;c[5796]=q;if((q|0)<1){break}r=q;s=c[5780]|0}a[192]=0;return 0}function pg(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;f=c[a>>2]|0;c[5808]=1;if((f|0)>=1){g=1;do{h=g-1|0;i=c[e+(h<<2)>>2]|0;c[5806]=i;do{if((i|0)<1){c[b+(h<<2)>>2]=c[d+(h<<2)>>2];if((c[5806]|0)<=0){break}j=c[5808]|0;k=5}else{j=g;k=5}}while(0);if((k|0)==5){k=0;h=j-1|0;c[b+(h<<2)>>2]=-(c[d+(h<<2)>>2]|0)}g=(c[5808]|0)+1|0;c[5808]=g;}while((g|0)<=(f|0))}f=c[a>>2]|0;c[5808]=1;if((f|0)>=1){g=1;do{j=g-1|0;do{if((c[b+(j<<2)>>2]|0)>0){l=g}else{k=g;while(1){c[5812]=k;m=b+(k-1<<2)|0;e=c[m>>2]|0;if((e|0)>0){break}else{k=-e|0}}c[5802]=k;e=c[m>>2]|0;c[5804]=e+1;c[d+(j<<2)>>2]=~e;c[b+((c[5802]|0)-1<<2)>>2]=c[5804];e=c[5808]|0;c[5812]=e;h=-(c[b+(e-1<<2)>>2]|0)|0;c[5810]=h;if((h|0)<1){l=e;break}else{n=e}do{c[b+(n-1<<2)>>2]=-(c[5802]|0);n=c[5810]|0;c[5812]=n;e=-(c[b+(n-1<<2)>>2]|0)|0;c[5810]=e;}while((e|0)>=1);l=c[5808]|0}}while(0);g=l+1|0;c[5808]=g;}while((g|0)<=(f|0))}f=c[a>>2]|0;c[5808]=1;if((f|0)<1){return 0}else{o=1}do{a=d+(o-1<<2)|0;g=-(c[a>>2]|0)|0;c[5804]=g;c[a>>2]=g;c[b+((c[5804]|0)-1<<2)>>2]=c[5808];o=(c[5808]|0)+1|0;c[5808]=o;}while((o|0)<=(f|0));return 0}function qg(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;g=i;i=i+1024|0;h=g+768|0;j=b+16|0;k=c[j>>2]|0;c[f>>2]=1;c[f+4>>2]=c[b+4>>2];c[f+8>>2]=c[b+8>>2];l=b+12|0;c[f+12>>2]=c[l>>2];c[f+16>>2]=c[j>>2];m=c[b+20>>2]|0;b=kf(20)|0;c[f+20>>2]=b;if((b|0)==0){f=g|0;ob(f|0,4840,(n=i,i=i+24|0,c[n>>2]=11608,c[n+8>>2]=81,c[n+16>>2]=8128,n)|0)|0;i=n;Ze(f)}c[b>>2]=c[m>>2];c[b+4>>2]=c[m+4>>2];f=b+8|0;c[f>>2]=c[m+8>>2];o=k<<2;p=kf(o)|0;q=b+12|0;c[q>>2]=p;if((p|0)==0){p=g+256|0;ob(p|0,4840,(n=i,i=i+24|0,c[n>>2]=5960,c[n+8>>2]=86,c[n+16>>2]=8128,n)|0)|0;i=n;Ze(p)}p=kf(o)|0;r=b+16|0;c[r>>2]=p;if((p|0)==0){p=g+512|0;ob(p|0,4840,(n=i,i=i+24|0,c[n>>2]=4032,c[n+8>>2]=88,c[n+16>>2]=8128,n)|0)|0;i=n;Ze(p)}p=(k|0)>0;if(p){b=c[m+12>>2]|0;m=c[q>>2]|0;s=c[r>>2]|0;t=0;do{u=d+(t<<2)|0;c[m+(c[u>>2]<<2)>>2]=c[b+(t<<2)>>2];t=t+1|0;c[s+(c[u>>2]<<2)>>2]=c[b+(t<<2)>>2];}while((t|0)<(k|0))}if((c[a>>2]|0)!=0){i=g;return}zg(c[q>>2]|0,c[r>>2]|0,c[f>>2]|0,c[l>>2]|0,c[j>>2]|0,e)|0;if((c[a+32>>2]|0)!=0){i=g;return}a=Ag(k,e)|0;j=kf(o+4|0)|0;o=j;if((j|0)==0){l=h|0;ob(l|0,4840,(n=i,i=i+24|0,c[n>>2]=3488,c[n+8>>2]=159,c[n+16>>2]=8128,n)|0)|0;i=n;Ze(l)}do{if(p){l=0;do{c[o+(c[a+(l<<2)>>2]<<2)>>2]=c[a+(c[e+(l<<2)>>2]<<2)>>2];l=l+1|0;}while((l|0)<(k|0));if(p){v=0}else{break}do{c[e+(v<<2)>>2]=c[o+(v<<2)>>2];v=v+1|0;}while((v|0)<(k|0));if(!p){break}l=c[q>>2]|0;n=0;do{c[o+(c[a+(n<<2)>>2]<<2)>>2]=c[l+(n<<2)>>2];n=n+1|0;}while((n|0)<(k|0));if(!p){break}n=c[q>>2]|0;l=0;do{c[n+(l<<2)>>2]=c[o+(l<<2)>>2];l=l+1|0;}while((l|0)<(k|0));if(!p){break}l=c[r>>2]|0;n=0;do{c[o+(c[a+(n<<2)>>2]<<2)>>2]=c[l+(n<<2)>>2];n=n+1|0;}while((n|0)<(k|0));if(!p){break}n=c[r>>2]|0;l=0;do{c[n+(l<<2)>>2]=c[o+(l<<2)>>2];l=l+1|0;}while((l|0)<(k|0));if(p){w=0}else{break}do{c[o+(w<<2)>>2]=c[a+(c[d+(w<<2)>>2]<<2)>>2];w=w+1|0;}while((w|0)<(k|0));if(p){x=0}else{break}do{c[d+(x<<2)>>2]=c[o+(x<<2)>>2];x=x+1|0;}while((x|0)<(k|0))}}while(0);lf(a);lf(j);i=g;return}function rg(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0;jf(f,a,-1);g=(a|0)>0;if(!g){return}Gq(e|0,0,a<<2|0)|0;h=0;do{i=c[b+(h<<2)>>2]|0;if((i|0)!=(a|0)){j=e+(i<<2)|0;c[j>>2]=(c[e+(h<<2)>>2]|0)+1+(c[j>>2]|0)}h=h+1|0;}while((h|0)<(a|0));if(g){k=0}else{return}while(1){g=k;while(1){h=c[b+(g<<2)>>2]|0;if((h|0)==(a|0)){break}if((c[e+(h<<2)>>2]|0)<(d|0)){g=h}else{break}}c[f+(k<<2)>>2]=g;h=g;do{h=h+1|0;l=(h|0)<(a|0);}while((c[e+(h<<2)>>2]|0)!=0&l);if(l){k=h}else{break}}return}function sg(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;g=i;h=e;j=i;i=i+256|0;k=pf((a*3|0)+2|0)|0;if((k|0)==0){l=j|0;ob(l|0,4568,(j=i,i=i+24|0,c[j>>2]=11552,c[j+8>>2]=54,c[j+16>>2]=8088,j)|0)|0;i=j;Ze(l)}l=a+1|0;j=l<<1;m=Ag(a,b)|0;if((l|0)>0){n=0;do{c[k+((c[m+(n<<2)>>2]|0)+l<<2)>>2]=n;n=n+1|0;}while((n|0)<(l|0))}n=(a|0)>0;do{if(n){o=0;do{p=b+(o<<2)|0;c[k+(c[m+(o<<2)>>2]<<2)>>2]=c[m+(c[p>>2]<<2)>>2];c[k+(o+j<<2)>>2]=c[p>>2];o=o+1|0;}while((o|0)<(a|0));if(n){q=0}else{break}do{c[b+(q<<2)>>2]=c[k+(q<<2)>>2];q=q+1|0;}while((q|0)<(a|0));jf(f,a,-1);if(!n){r=m;lf(r);s=k;lf(s);i=g;return}Gq(h|0,0,a<<2|0)|0;o=0;do{p=c[b+(o<<2)>>2]|0;if((p|0)!=(a|0)){t=e+(p<<2)|0;c[t>>2]=(c[e+(o<<2)>>2]|0)+1+(c[t>>2]|0)}o=o+1|0;}while((o|0)<(a|0));if(n){u=0}else{r=m;lf(r);s=k;lf(s);i=g;return}while(1){o=u;while(1){t=c[b+(o<<2)>>2]|0;if((t|0)==(a|0)){break}if((c[e+(t<<2)>>2]|0)<(d|0)){o=t}else{break}}t=(u|0)>(o|0);if(t){v=a}else{p=a;w=u;while(1){x=c[k+(w+l<<2)>>2]|0;y=(p|0)<(x|0)?p:x;x=w+1|0;if((x|0)>(o|0)){v=y;break}else{p=y;w=x}}}w=c[k+(o+l<<2)>>2]|0;do{if((w-v|0)==(o-u|0)){c[f+(v<<2)>>2]=w;z=o}else{if(t){z=o;break}else{A=u}while(1){p=c[k+(A+l<<2)>>2]|0;if((c[e+(A<<2)>>2]|0)==0){c[f+(p<<2)>>2]=p}p=A+1|0;if((p|0)>(o|0)){z=o;break}else{A=p}}}}while(0);do{z=z+1|0;B=(z|0)<(a|0);}while((c[e+(z<<2)>>2]|0)!=0&B);if(B){u=z}else{break}}if(n){C=0}else{r=m;lf(r);s=k;lf(s);i=g;return}do{c[b+(C<<2)>>2]=c[k+(C+j<<2)>>2];C=C+1|0;}while((C|0)<(a|0));r=m;lf(r);s=k;lf(s);i=g;return}}while(0);jf(f,a,-1);r=m;lf(r);s=k;lf(s);i=g;return}function tg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;if((b|a|c|0)<0){d=-1;return d|0}d=(a<<1)+c+(((b<<4)+16|0)>>>2)+(((c*24|0)+24|0)>>>2)+((a|0)/5|0)|0;return d|0}function ug(a){a=a|0;if((a|0)==0){return}Gq(a|0,0,160)|0;h[a>>3]=.5;h[a+8>>3]=.5;return}function vg(a,b,d,e,f,g,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0.0,Q=0.0,R=0.0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0,db=0,eb=0,fb=0,gb=0,hb=0,ib=0,jb=0;k=i;i=i+160|0;l=k|0;if((j|0)==0){m=0;i=k;return m|0}n=j+12|0;o=j+16|0;Gq(j|0,0,80)|0;c[o>>2]=-1;p=j+20|0;c[p>>2]=-1;if((e|0)==0){c[n>>2]=-1;m=0;i=k;return m|0}if((f|0)==0){c[n>>2]=-2;m=0;i=k;return m|0}if((a|0)<0){c[n>>2]=-3;c[o>>2]=a;m=0;i=k;return m|0}if((b|0)<0){c[n>>2]=-4;c[o>>2]=b;m=0;i=k;return m|0}q=f+(b<<2)|0;r=c[q>>2]|0;if((r|0)<0){c[n>>2]=-5;c[o>>2]=r;m=0;i=k;return m|0}if((c[f>>2]|0)!=0){c[n>>2]=-6;c[o>>2]=c[f>>2];m=0;i=k;return m|0}if((g|0)==0){s=l|0;Gq(l|0,0,160)|0;h[s>>3]=.5;h[l+8>>3]=.5;t=s}else{t=g}g=((b*24|0)+24|0)>>>2;s=((a<<4)+16|0)>>>2;l=r<<1;r=s+b+g+l|0;if((r|0)>(d|0)){c[n>>2]=-7;c[o>>2]=r;c[p>>2]=d;m=0;i=k;return m|0}r=d-s|0;s=r-g|0;g=e+(s<<2)|0;d=g;u=e+(r<<2)|0;v=u;w=(b|0)>0;a:do{if(w){x=0;y=0;while(1){c[d+(x*24|0)>>2]=y;z=x+1|0;A=f+(z<<2)|0;B=(c[A>>2]|0)-(c[f+(x<<2)>>2]|0)|0;C=d+(x*24|0)+4|0;c[C>>2]=B;if((B|0)<0){break}c[d+(x*24|0)+8>>2]=1;c[d+(x*24|0)+12>>2]=0;c[d+(x*24|0)+16>>2]=-1;c[d+(x*24|0)+20>>2]=-1;if((z|0)>=(b|0)){break a}x=z;y=c[A>>2]|0}c[n>>2]=-8;c[o>>2]=x;c[p>>2]=c[C>>2];m=0;i=k;return m|0}}while(0);C=j+24|0;c[C>>2]=0;y=(a|0)>0;if(y){A=0;do{c[v+(A<<4)+4>>2]=0;c[v+(A<<4)+12>>2]=-1;A=A+1|0;}while((A|0)<(a|0))}b:do{if(w){A=0;c:while(1){z=c[f+(A<<2)>>2]|0;B=A+1|0;D=c[f+(B<<2)>>2]|0;E=e+(D<<2)|0;if((z|0)<(D|0)){D=d+(A*24|0)+4|0;F=e+(z<<2)|0;z=-1;while(1){G=F+4|0;H=c[F>>2]|0;if(!((H|0)>-1&(H|0)<(a|0))){break c}I=v+(H<<4)+12|0;if((H|0)>(z|0)){J=c[I>>2]|0;if((J|0)==(A|0)){K=33}else{L=J}}else{K=33}if((K|0)==33){K=0;c[n>>2]=1;c[o>>2]=A;c[p>>2]=H;c[C>>2]=(c[C>>2]|0)+1;L=c[I>>2]|0}if((L|0)==(A|0)){c[D>>2]=(c[D>>2]|0)-1}else{J=v+(H<<4)+4|0;c[J>>2]=(c[J>>2]|0)+1}c[I>>2]=A;if(G>>>0<E>>>0){F=G;z=H}else{break}}}if((B|0)<(b|0)){A=B}else{break b}}c[n>>2]=-9;c[o>>2]=A;c[p>>2]=H;c[C>>2]=a;m=0;i=k;return m|0}}while(0);C=c[q>>2]|0;c[u>>2]=C;c[e+(r+2<<2)>>2]=C;c[e+(r+3<<2)>>2]=-1;if((a|0)>1){r=1;u=C;do{u=(c[v+(r-1<<4)+4>>2]|0)+u|0;c[v+(r<<4)>>2]=u;c[v+(r<<4)+8>>2]=u;c[v+(r<<4)+12>>2]=-1;r=r+1|0;}while((r|0)<(a|0))}do{if((c[n>>2]|0)==1){if(w){M=0}else{break}while(1){r=c[f+(M<<2)>>2]|0;u=M+1|0;C=c[f+(u<<2)>>2]|0;q=e+(C<<2)|0;if((r|0)<(C|0)){C=e+(r<<2)|0;while(1){r=C+4|0;H=c[C>>2]|0;p=v+(H<<4)+12|0;if((c[p>>2]|0)!=(M|0)){o=v+(H<<4)+8|0;H=c[o>>2]|0;c[o>>2]=H+1;c[e+(H<<2)>>2]=M;c[p>>2]=M}if(r>>>0<q>>>0){C=r}else{break}}}if((u|0)<(b|0)){M=u}else{break}}}else{if(w){N=0}else{break}while(1){A=c[f+(N<<2)>>2]|0;C=N+1|0;q=c[f+(C<<2)>>2]|0;B=e+(q<<2)|0;if((A|0)<(q|0)){q=e+(A<<2)|0;while(1){A=q+4|0;r=v+(c[q>>2]<<4)+8|0;p=c[r>>2]|0;c[r>>2]=p+1;c[e+(p<<2)>>2]=N;if(A>>>0<B>>>0){q=A}else{break}}}if((C|0)<(b|0)){N=C}else{break}}}}while(0);if(y){N=0;do{c[v+(N<<4)+12>>2]=0;c[v+(N<<4)+8>>2]=c[v+(N<<4)+4>>2];N=N+1|0;}while((N|0)<(a|0))}do{if((c[n>>2]|0)==1){c[g>>2]=0;c[f>>2]=0;if((b|0)>1){N=1;do{M=N-1|0;q=(c[d+(M*24|0)+4>>2]|0)+(c[d+(M*24|0)>>2]|0)|0;c[d+(N*24|0)>>2]=q;c[f+(N<<2)>>2]=q;N=N+1|0;}while((N|0)<(b|0))}if(y){O=0}else{break}do{N=c[v+(O<<4)>>2]|0;q=(c[v+(O<<4)+4>>2]|0)+N|0;M=e+(q<<2)|0;if((N|0)<(q|0)){q=e+(N<<2)|0;while(1){N=q+4|0;B=f+(c[q>>2]<<2)|0;u=c[B>>2]|0;c[B>>2]=u+1;c[e+(u<<2)>>2]=O;if(N>>>0<M>>>0){q=N}else{break}}}O=O+1|0;}while((O|0)<(a|0))}}while(0);O=f;P=+(b|0);Q=P*+h[t>>3];R=Q<P?Q:P;g=R<0.0?0:~~R;R=+(a|0);P=R*+h[t+8>>3];Q=P<R?P:R;t=Q<0.0?0:~~Q;n=b-1|0;if(w){q=b;M=n;while(1){if((c[d+(M*24|0)+4>>2]|0)==0){C=q-1|0;c[d+(M*24|0)+12>>2]=C;c[d+(M*24|0)>>2]=-1;S=C}else{S=q}if((M|0)>0){q=S;M=M-1|0}else{T=S;U=n;break}}while(1){S=d+(U*24|0)|0;M=c[S>>2]|0;do{if((M|0)<0){V=T}else{q=c[d+(U*24|0)+4>>2]|0;if((q|0)<=(t|0)){V=T;break}C=T-1|0;c[d+(U*24|0)+12>>2]=C;N=q+M|0;q=e+(N<<2)|0;if((M|0)<(N|0)){N=e+(M<<2)|0;while(1){u=N+4|0;B=v+(c[N>>2]<<4)+8|0;c[B>>2]=(c[B>>2]|0)-1;if(u>>>0<q>>>0){N=u}else{break}}}c[S>>2]=-1;V=C}}while(0);if((U|0)>0){T=V;U=U-1|0}else{W=V;break}}}else{W=b}if(y){V=a;U=0;T=0;while(1){t=c[v+(U<<4)+8>>2]|0;if((t|0)>(g|0)|(t|0)==0){c[v+(U<<4)+12>>2]=-1;X=T;Y=V-1|0}else{X=(T|0)>(t|0)?T:t;Y=V}t=U+1|0;if((t|0)<(a|0)){V=Y;U=t;T=X}else{Z=Y;_=X;break}}}else{Z=a;_=0}do{if(w){X=W;Y=n;while(1){T=d+(Y*24|0)|0;U=c[T>>2]|0;do{if((U|0)<0){$=X}else{V=e+(U<<2)|0;g=d+(Y*24|0)+4|0;t=e+((c[g>>2]|0)+U<<2)|0;S=V;M=0;N=V;d:while(1){V=S;while(1){if(!(V>>>0<t>>>0)){break d}aa=V+4|0;ba=c[V>>2]|0;if((c[v+(ba<<4)+12>>2]|0)<0){V=aa}else{break}}c[N>>2]=ba;V=M-1+(c[v+(ba<<4)+8>>2]|0)|0;S=aa;M=(V|0)<(b|0)?V:b;N=N+4|0}S=N-(e+(c[T>>2]<<2))>>2;if((S|0)==0){t=X-1|0;c[d+(Y*24|0)+12>>2]=t;c[T>>2]=-1;$=t;break}else{c[g>>2]=S;c[d+(Y*24|0)+12>>2]=M;$=X;break}}}while(0);if((Y|0)>0){X=$;Y=Y-1|0}else{break}}Gq(O|0,-1|0,(b<<2)+4|0)|0;if(w){ca=n}else{da=$;break}while(1){if((c[d+(ca*24|0)>>2]|0)>-1){Y=f+(c[d+(ca*24|0)+12>>2]<<2)|0;X=c[Y>>2]|0;c[d+(ca*24|0)+16>>2]=-1;c[d+(ca*24|0)+20>>2]=X;if(!((X|0)==-1)){c[d+(X*24|0)+16>>2]=ca}c[Y>>2]=ca}if((ca|0)>0){ca=ca-1|0}else{da=$;break}}}else{Gq(O|0,-1|0,(b<<2)+4|0)|0;da=W}}while(0);W=2147483647-b|0;if(y){O=0;do{$=v+(O<<4)+12|0;if((c[$>>2]|0)>-1){c[$>>2]=0}O=O+1|0;}while((O|0)<(a|0))}if((da|0)>0){O=y^1;$=b+1|0;ca=e;n=1;aa=0;ba=0;Y=l;l=_;_=0;while(1){X=aa;while(1){ea=f+(X<<2)|0;fa=c[ea>>2]|0;if((fa|0)==-1&(X|0)<(b|0)){X=X+1|0}else{break}}T=c[d+(fa*24|0)+20>>2]|0;c[ea>>2]=T;if(!((T|0)==-1)){c[d+(T*24|0)+16>>2]=-1}T=d+(fa*24|0)+12|0;U=c[T>>2]|0;c[T>>2]=ba;T=d+(fa*24|0)+8|0;C=c[T>>2]|0;S=C+ba|0;t=b-S|0;do{if((((U|0)<(t|0)?U:t)+Y|0)<(s|0)){ga=_;ha=Y;ia=n}else{V=e+(Y<<2)|0;if(w){q=e;u=0;while(1){B=d+(u*24|0)|0;A=c[B>>2]|0;if((A|0)>-1){p=q-ca>>2;c[B>>2]=p;r=d+(u*24|0)+4|0;H=c[r>>2]|0;if((H|0)>0){o=e+(A<<2)|0;A=q;L=0;while(1){K=c[o>>2]|0;if((c[v+(K<<4)+12>>2]|0)>-1){c[A>>2]=K;ja=A+4|0}else{ja=A}K=L+1|0;if((K|0)<(H|0)){o=o+4|0;A=ja;L=K}else{break}}ka=ja;la=c[B>>2]|0}else{ka=q;la=p}c[r>>2]=ka-(e+(la<<2))>>2;ma=ka}else{ma=q}L=u+1|0;if((L|0)<(b|0)){q=ma;u=L}else{na=ma;break}}}else{na=e}if(y){u=0;while(1){q=v+(u<<4)+12|0;do{if((c[q>>2]|0)>-1){if((c[v+(u<<4)+4>>2]|0)==0){c[q>>2]=-1;break}else{L=e+(c[v+(u<<4)>>2]<<2)|0;c[q>>2]=c[L>>2];c[L>>2]=~u;break}}}while(0);q=u+1|0;if((q|0)<(a|0)){u=q}else{oa=na;pa=na;break}}}else{oa=na;pa=na}e:while(1){u=pa;while(1){if(!(u>>>0<V>>>0)){break e}qa=c[u>>2]|0;if((qa|0)<0){break}else{u=u+4|0}}q=~qa;c[u>>2]=c[v+(q<<4)+12>>2];r=oa-ca>>2;p=v+(q<<4)|0;c[p>>2]=r;B=v+(q<<4)+4|0;q=c[B>>2]|0;if((q|0)>0){L=u;A=oa;o=0;while(1){H=c[L>>2]|0;if((c[d+(H*24|0)>>2]|0)>-1){c[A>>2]=H;ra=A+4|0}else{ra=A}H=o+1|0;if((H|0)<(q|0)){L=L+4|0;A=ra;o=H}else{break}}sa=u+(q<<2)|0;ta=ra;ua=c[p>>2]|0}else{sa=u;ta=oa;ua=r}c[B>>2]=ta-(e+(ua<<2))>>2;oa=ta;pa=sa}V=oa-ca>>2;o=_+1|0;if(y){va=0}else{ga=o;ha=V;ia=1;break}while(1){A=v+(va<<4)+12|0;if((c[A>>2]|0)>-1){c[A>>2]=0}A=va+1|0;if((A|0)<(a|0)){va=A}else{ga=o;ha=V;ia=1;break}}}}while(0);c[T>>2]=-C;t=d+(fa*24|0)|0;U=c[t>>2]|0;V=d+(fa*24|0)+4|0;o=e+((c[V>>2]|0)+U<<2)|0;A=ha;L=e+(U<<2)|0;U=0;f:while(1){H=L;while(1){if(!(H>>>0<o>>>0)){break f}wa=H+4|0;M=c[H>>2]|0;if((c[v+(M<<4)+12>>2]|0)<0){H=wa;continue}xa=c[v+(M<<4)>>2]|0;g=(c[v+(M<<4)+4>>2]|0)+xa|0;ya=e+(g<<2)|0;if((xa|0)<(g|0)){break}else{H=wa}}H=U;g=e+(xa<<2)|0;M=A;while(1){N=g;while(1){za=N+4|0;Aa=c[N>>2]|0;Ba=d+(Aa*24|0)+8|0;Ca=c[Ba>>2]|0;if((Ca|0)>0){if((c[d+(Aa*24|0)>>2]|0)>-1){break}}if(za>>>0<ya>>>0){N=za}else{A=M;L=wa;U=H;continue f}}c[Ba>>2]=-Ca;N=M+1|0;c[e+(M<<2)>>2]=Aa;B=Ca+H|0;if(za>>>0<ya>>>0){H=B;g=za;M=N}else{A=N;L=wa;U=B;continue f}}}c[T>>2]=C;L=(l|0)>(U|0)?l:U;o=c[t>>2]|0;M=(c[V>>2]|0)+o|0;g=e+(M<<2)|0;if((o|0)<(M|0)){M=e+(o<<2)|0;while(1){o=M+4|0;c[v+(c[M>>2]<<4)+12>>2]=-1;if(o>>>0<g>>>0){M=o}else{break}}}if((A-ha|0)>0){Da=c[e+(c[t>>2]<<2)>>2]|0}else{Da=-1}M=e+(ha<<2)|0;g=e+(A<<2)|0;if((ha|0)<(A|0)){V=M;while(1){C=V+4|0;T=c[V>>2]|0;o=d+(T*24|0)+8|0;H=c[o>>2]|0;c[o>>2]=-H;o=c[d+(T*24|0)+16>>2]|0;B=c[d+(T*24|0)+20>>2]|0;if((o|0)==-1){c[f+(c[d+(T*24|0)+12>>2]<<2)>>2]=B}else{c[d+(o*24|0)+20>>2]=B}if(!((B|0)==-1)){c[d+(B*24|0)+16>>2]=o}o=c[d+(T*24|0)>>2]|0;B=(c[d+(T*24|0)+4>>2]|0)+o|0;T=e+(B<<2)|0;if((o|0)<(B|0)){B=e+(o<<2)|0;while(1){o=B+4|0;N=c[B>>2]|0;r=v+(N<<4)+12|0;u=c[r>>2]|0;do{if((u|0)>=0){p=u-ia|0;if((p|0)<0){Ea=c[v+(N<<4)+8>>2]|0}else{Ea=p}p=Ea+H|0;if((p|0)==0){c[r>>2]=-1;break}else{c[r>>2]=p+ia;break}}}while(0);if(o>>>0<T>>>0){B=o}else{break}}}if(C>>>0<g>>>0){V=C}else{Fa=U;Ga=M;Ha=S;break}}g:while(1){V=Ga;while(1){Ia=c[V>>2]|0;Ja=d+(Ia*24|0)|0;B=c[Ja>>2]|0;T=e+(B<<2)|0;H=d+(Ia*24|0)+4|0;r=e+((c[H>>2]|0)+B<<2)|0;B=T;N=0;u=0;p=T;h:while(1){T=B;while(1){if(!(T>>>0<r>>>0)){break h}Ka=T+4|0;La=c[T>>2]|0;Ma=c[v+(La<<4)+12>>2]|0;if((Ma|0)<0){T=Ka}else{break}}c[p>>2]=La;T=Ma-ia+u|0;B=Ka;N=La+N|0;u=(T|0)<(b|0)?T:b;p=p+4|0}Na=V+4|0;B=p-(e+(c[Ja>>2]<<2))>>2;c[H>>2]=B;if((B|0)==0){break}c[d+(Ia*24|0)+12>>2]=u;B=(N>>>0)%($>>>0)|0;r=f+(B<<2)|0;o=c[r>>2]|0;if((o|0)>-1){T=d+(o*24|0)+16|0;q=c[T>>2]|0;c[T>>2]=Ia;Oa=q}else{c[r>>2]=-2-Ia;Oa=-2-o|0}c[d+(Ia*24|0)+20>>2]=Oa;c[d+(Ia*24|0)+16>>2]=B;if(Na>>>0<g>>>0){V=Na}else{Pa=Fa;Qa=Ha;break g}}c[Ja>>2]=-1;V=c[d+(Ia*24|0)+8>>2]|0;C=Fa-V|0;c[d+(Ia*24|0)+12>>2]=Ha;B=V+Ha|0;if(Na>>>0<g>>>0){Fa=C;Ga=Na;Ha=B}else{Pa=C;Qa=B;break}}B=M;while(1){C=B+4|0;V=c[B>>2]|0;do{if((c[d+(V*24|0)>>2]|0)>=0){o=f+(c[d+(V*24|0)+16>>2]<<2)|0;r=c[o>>2]|0;q=(r|0)>-1;if(q){Ra=c[d+(r*24|0)+16>>2]|0}else{Ra=-2-r|0}i:do{if(!((Ra|0)==-1)){T=Ra;do{K=c[d+(T*24|0)+4>>2]|0;x=d+(T*24|0)+20|0;z=c[x>>2]|0;if((z|0)==-1){break i}F=d+(T*24|0)+12|0;E=d+(T*24|0)|0;D=d+(T*24|0)+8|0;j:do{if((K|0)>0){G=T;I=z;while(1){do{if((c[d+(I*24|0)+4>>2]|0)==(K|0)){J=d+(I*24|0)+12|0;if((c[J>>2]|0)!=(c[F>>2]|0)){Sa=I;break}Ta=d+(I*24|0)|0;Ua=e+(c[Ta>>2]<<2)|0;Va=e+(c[E>>2]<<2)|0;Wa=0;while(1){if((c[Va>>2]|0)!=(c[Ua>>2]|0)){Xa=Wa;break}Ya=Wa+1|0;if((Ya|0)<(K|0)){Ua=Ua+4|0;Va=Va+4|0;Wa=Ya}else{Xa=Ya;break}}if((Xa|0)!=(K|0)){Sa=I;break}Wa=d+(I*24|0)+8|0;c[D>>2]=(c[D>>2]|0)+(c[Wa>>2]|0);c[Wa>>2]=T;c[Ta>>2]=-2;c[J>>2]=-1;c[d+(G*24|0)+20>>2]=c[d+(I*24|0)+20>>2];Sa=G}else{Sa=I}}while(0);Wa=c[d+(I*24|0)+20>>2]|0;if((Wa|0)==-1){break}else{G=Sa;I=Wa}}}else{if((K|0)==0){Za=T;_a=z}else{I=z;while(1){I=c[d+(I*24|0)+20>>2]|0;if((I|0)==-1){break j}}}while(1){do{if((c[d+(_a*24|0)+4>>2]|0)==0){I=d+(_a*24|0)+12|0;if((c[I>>2]|0)!=(c[F>>2]|0)){$a=_a;break}G=d+(_a*24|0)+8|0;c[D>>2]=(c[D>>2]|0)+(c[G>>2]|0);c[G>>2]=T;c[d+(_a*24|0)>>2]=-2;c[I>>2]=-1;c[d+(Za*24|0)+20>>2]=c[d+(_a*24|0)+20>>2];$a=Za}else{$a=_a}}while(0);I=c[d+(_a*24|0)+20>>2]|0;if((I|0)==-1){break}else{Za=$a;_a=I}}}}while(0);T=c[x>>2]|0;}while(!((T|0)==-1))}}while(0);if(q){c[d+(r*24|0)+16>>2]=-1;break}else{c[o>>2]=-1;break}}}while(0);if(C>>>0<g>>>0){B=C}else{ab=Qa;bb=Pa;break}}}else{ab=S;bb=U}c[t>>2]=-1;B=ia+1+L|0;V=(B|0)<(W|0);if(V|O){cb=V?B:1}else{B=0;while(1){V=v+(B<<4)+12|0;if((c[V>>2]|0)>-1){c[V>>2]=0}V=B+1|0;if((V|0)<(a|0)){B=V}else{cb=1;break}}}B=b-ab|0;t=X;U=M;S=M;k:while(1){V=U;while(1){if(!(V>>>0<g>>>0)){break k}db=V+4|0;eb=c[V>>2]|0;fb=d+(eb*24|0)|0;if((c[fb>>2]|0)<0){V=db}else{break}}c[S>>2]=eb;V=c[fb>>2]|0;C=d+(eb*24|0)+4|0;N=c[C>>2]|0;c[C>>2]=N+1;c[e+(N+V<<2)>>2]=Da;V=d+(eb*24|0)+12|0;N=c[d+(eb*24|0)+8>>2]|0;C=B-N|0;u=(c[V>>2]|0)+bb-N|0;N=(u|0)<(C|0)?u:C;c[V>>2]=N;V=f+(N<<2)|0;C=c[V>>2]|0;c[d+(eb*24|0)+20>>2]=C;c[d+(eb*24|0)+16>>2]=-1;if(!((C|0)==-1)){c[d+(C*24|0)+16>>2]=eb}c[V>>2]=eb;t=(t|0)<(N|0)?t:N;U=db;S=S+4|0}if((bb|0)>0){c[v+(Da<<4)>>2]=ha;c[v+(Da<<4)+4>>2]=S-M>>2;c[v+(Da<<4)+8>>2]=bb;c[v+(Da<<4)+12>>2]=0}if((ab|0)<(da|0)){n=cb;aa=t;ba=ab;Y=A;l=L;_=ga}else{gb=ga;break}}}else{gb=0}if(w){w=0;while(1){do{if(!((c[d+(w*24|0)>>2]|0)==-1)){if((c[d+(w*24|0)+12>>2]|0)==-1){hb=w}else{break}do{hb=c[d+(hb*24|0)+8>>2]|0;}while(!((c[d+(hb*24|0)>>2]|0)==-1));ga=d+(hb*24|0)+12|0;_=c[ga>>2]|0;l=w;while(1){ib=_+1|0;c[d+(l*24|0)+12>>2]=_;c[d+(l*24|0)+8>>2]=hb;if((c[ga>>2]|0)==-1){_=ib;l=hb}else{break}}c[ga>>2]=ib}}while(0);L=w+1|0;if((L|0)<(b|0)){w=L}else{jb=0;break}}do{c[f+(c[d+(jb*24|0)+12>>2]<<2)>>2]=jb;jb=jb+1|0;}while((jb|0)<(b|0))}c[j>>2]=a-Z;c[j+4>>2]=b-da;c[j+8>>2]=gb;m=1;i=k;return m|0}function wg(b,c){b=b|0;c=c|0;var d=0,e=0,f=0;d=a[b]|0;b=d&255;e=a[c]|0;c=e&255;if(d<<24>>24==e<<24>>24){f=1;return f|0}f=(((d-97&255)>>>0<26>>>0?b-32|0:b)|0)==(((e-97&255)>>>0<26>>>0?c-32|0:c)|0)|0;return f|0}function xg(a,b,d,e,f,j,k,l){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0,G=0,H=0,I=0,J=0,K=0.0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0.0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0.0,Z=0.0,_=0,$=0,aa=0,ba=0.0,ca=0,da=0,ea=0,ga=0,ha=0.0,ia=0.0,ja=0,ka=0,la=0.0,ma=0,na=0.0,oa=0;m=i;i=i+288|0;n=m|0;o=m+8|0;p=m+16|0;q=m+24|0;r=m+32|0;c[n>>2]=1;c[l>>2]=0;do{if((wg(a,4008)|0)==0){if((wg(a,11472)|0)!=0){s=4;break}c[l>>2]=-1;t=-1}else{s=4}}while(0);a:do{if((s|0)==4){do{if((wg(b,8056)|0)==0){if((wg(b,5928)|0)!=0){break}if((wg(b,4024)|0)!=0){break}c[l>>2]=-2;t=-2;break a}}while(0);do{if((wg(d,11472)|0)==0){if((wg(d,8056)|0)!=0){break}c[l>>2]=-3;t=-3;break a}}while(0);u=e+12|0;v=c[u>>2]|0;if((v|0)!=(c[e+16>>2]|0)|(v|0)<0){c[l>>2]=-4;t=-4;break}w=f+12|0;x=c[w>>2]|0;if((x|0)!=(c[f+16>>2]|0)|(x|0)<0){c[l>>2]=-5;t=-5;break}x=c[l>>2]|0;if((x|0)!=0){t=x;break}x=c[e+20>>2]|0;y=c[x+8>>2]|0;z=c[f+20>>2]|0;A=c[z+4>>2]|0;B=Tf(v)|0;if((B|0)==0){v=r|0;ob(v|0,2784,(C=i,i=i+24|0,c[C>>2]=1944,c[C+8>>2]=121,c[C+16>>2]=1456,C)|0)|0;i=C;Ze(v)}v=(wg(b,8056)|0)==0;C=(wg(a,4008)|0)!=0;b:do{if(v){if(C){if((c[u>>2]|0)==0){i=m;return 0}D=c[x+4>>2]|0;if(!((D|0)>-1)){E=0.0;break}F=x+28|0;G=x+20|0;H=x+12|0;I=x+16|0;J=D;K=0.0;while(1){D=c[F>>2]|0;L=c[D+(J<<2)>>2]|0;M=c[G>>2]|0;N=c[M+(L<<2)>>2]|0;O=(c[M+(L+1<<2)>>2]|0)-N|0;c[o>>2]=O;M=J+1|0;P=D+(M<<2)|0;D=(c[P>>2]|0)-L|0;c[p>>2]=D;Q=c[(c[H>>2]|0)+(L<<2)>>2]|0;R=K+ +(fa(D<<1,O-D|0)|0);if((L|0)<(c[P>>2]|0)){P=L;O=Q;while(1){S=O+D|0;c[q>>2]=S;T=P+1|0;U=c[(c[H>>2]|0)+(T<<2)>>2]|0;if((S|0)<(U|0)){V=c[I>>2]|0;W=j+(P<<3)|0;X=S;S=D+N|0;Y=+h[W>>3];while(1){Z=Y- +h[j+(c[V+(S<<2)>>2]<<3)>>3]*+h[y+(X<<3)>>3];h[W>>3]=Z;_=X+1|0;c[q>>2]=_;$=c[(c[H>>2]|0)+(T<<2)>>2]|0;if((_|0)<($|0)){X=_;S=S+1|0;Y=Z}else{aa=$;break}}}else{aa=U}if((T|0)<(c[(c[F>>2]|0)+(M<<2)>>2]|0)){P=T;O=aa}else{break}}}if((D|0)>1){Y=R+ +(fa(D-1|0,D)|0);Fg(4008,5928,11472,p,y+(Q<<3)|0,o,j+(L<<3)|0,n)|0;ba=Y}else{ba=R}if((J|0)<=0){E=ba;break b}J=J-1|0;K=ba}}if((c[w>>2]|0)==0){i=m;return 0}J=x+4|0;if((c[J>>2]|0)<0){E=0.0;break}F=x+28|0;H=x+20|0;I=x+12|0;G=z+12|0;O=z+8|0;P=0;K=0.0;while(1){M=c[F>>2]|0;N=c[M+(P<<2)>>2]|0;S=c[H>>2]|0;c[o>>2]=(c[S+(N+1<<2)>>2]|0)-(c[S+(N<<2)>>2]|0);S=P+1|0;X=M+(S<<2)|0;M=(c[X>>2]|0)-N|0;c[p>>2]=M;W=c[(c[I>>2]|0)+(N<<2)>>2]|0;if((N|0)<(c[X>>2]|0)){X=N;Y=K;V=c[G>>2]|0;while(1){$=X+1|0;_=c[V+(X<<2)>>2]|0;Z=Y+ +((c[V+($<<2)>>2]|0)-_<<1|0);c[q>>2]=_;ca=c[G>>2]|0;if((_|0)<(c[ca+($<<2)>>2]|0)){da=c[O>>2]|0;ea=j+(X<<3)|0;ga=_;ha=+h[ea>>3];while(1){ia=ha- +h[j+(c[da+(ga<<2)>>2]<<3)>>3]*+h[A+(ga<<3)>>3];h[ea>>3]=ia;_=ga+1|0;c[q>>2]=_;ja=c[G>>2]|0;if((_|0)<(c[ja+($<<2)>>2]|0)){ga=_;ha=ia}else{ka=ja;break}}}else{ka=ca}if(($|0)<(c[(c[F>>2]|0)+(S<<2)>>2]|0)){X=$;Y=Z;V=ka}else{la=Z;break}}}else{la=K}Y=la+ +(fa(M+1|0,M)|0);V=y+(W<<3)|0;if((M|0)==1){X=j+(N<<3)|0;h[X>>3]=+h[X>>3]/+h[V>>3]}else{Fg(11472,5928,8056,p,V,o,j+(N<<3)|0,n)|0}if((S|0)>(c[J>>2]|0)){E=Y;break}else{P=S;K=Y}}}else{if(C){if((c[u>>2]|0)==0){i=m;return 0}P=x+4|0;if((c[P>>2]|0)<0){E=0.0;break}J=x+28|0;F=x+20|0;G=x+12|0;O=x+16|0;I=0;K=0.0;while(1){H=c[J>>2]|0;V=c[H+(I<<2)>>2]|0;X=c[F>>2]|0;L=c[X+(V<<2)>>2]|0;Q=X+(V+1<<2)|0;X=(c[Q>>2]|0)-L|0;c[o>>2]=X;D=I+1|0;ga=(c[H+(D<<2)>>2]|0)-V|0;c[p>>2]=ga;H=c[(c[G>>2]|0)+(V<<2)>>2]|0;ea=X-ga|0;Y=K+ +(fa(ga-1|0,ga)|0)+ +(fa(ga<<1,ea)|0);do{if((ga|0)==1){da=L+1|0;T=c[Q>>2]|0;if((da|0)>=(T|0)){break}U=c[O>>2]|0;ja=j+(V<<3)|0;_=H;ma=da;do{_=_+1|0;da=j+(c[U+(ma<<2)>>2]<<3)|0;h[da>>3]=+h[da>>3]- +h[ja>>3]*+h[y+(_<<3)>>3];ma=ma+1|0;}while((ma|0)<(T|0))}else{T=j+(V<<3)|0;Xf(X,ga,y+(H<<3)|0,T);ma=c[o>>2]|0;_=c[p>>2]|0;Zf(ma,ma-_|0,_,y+(_+H<<3)|0,T,B);T=c[p>>2]|0;c[q>>2]=0;if((ea|0)<=0){break}_=c[O>>2]|0;ma=T+L|0;T=0;while(1){ja=B+(T<<3)|0;U=j+(c[_+(ma<<2)>>2]<<3)|0;h[U>>3]=+h[U>>3]- +h[ja>>3];h[ja>>3]=0.0;ja=T+1|0;c[q>>2]=ja;if((ja|0)<(ea|0)){ma=ma+1|0;T=ja}else{break}}}}while(0);if((D|0)>(c[P>>2]|0)){E=Y;break b}else{I=D;K=Y}}}if((c[w>>2]|0)==0){i=m;return 0}I=c[x+4>>2]|0;if(!((I|0)>-1)){E=0.0;break}P=x+28|0;O=x+20|0;G=x+12|0;F=z+12|0;J=z+8|0;ea=I;K=0.0;while(1){I=c[P>>2]|0;L=c[I+(ea<<2)>>2]|0;H=L+1|0;ga=c[O>>2]|0;X=(c[ga+(H<<2)>>2]|0)-(c[ga+(L<<2)>>2]|0)|0;c[o>>2]=X;ga=ea+1|0;V=(c[I+(ga<<2)>>2]|0)-L|0;c[p>>2]=V;Z=K+ +(fa(V+1|0,V)|0);I=y+(c[(c[G>>2]|0)+(L<<2)>>2]<<3)|0;c:do{if((V|0)==1){Q=j+(L<<3)|0;R=+h[Q>>3]/+h[I>>3];h[Q>>3]=R;S=c[(c[F>>2]|0)+(L<<2)>>2]|0;c[q>>2]=S;if((S|0)>=(c[(c[F>>2]|0)+(H<<2)>>2]|0)){na=Z;break}N=c[J>>2]|0;M=S;ha=R;while(1){S=j+(c[N+(M<<2)>>2]<<3)|0;h[S>>3]=+h[S>>3]-ha*+h[A+(M<<3)>>3];S=M+1|0;c[q>>2]=S;if((S|0)>=(c[(c[F>>2]|0)+(H<<2)>>2]|0)){na=Z;break c}M=S;ha=+h[Q>>3]}}else{Yf(X,V,I,j+(L<<3)|0);if((L|0)>=(c[(c[P>>2]|0)+(ga<<2)>>2]|0)){na=Z;break}Q=L;ha=Z;M=c[F>>2]|0;while(1){N=Q+1|0;S=c[M+(Q<<2)>>2]|0;R=ha+ +((c[M+(N<<2)>>2]|0)-S<<1|0);c[q>>2]=S;W=c[F>>2]|0;if((S|0)<(c[W+(N<<2)>>2]|0)){T=c[J>>2]|0;ma=j+(Q<<3)|0;_=S;while(1){S=j+(c[T+(_<<2)>>2]<<3)|0;h[S>>3]=+h[S>>3]- +h[ma>>3]*+h[A+(_<<3)>>3];S=_+1|0;c[q>>2]=S;ja=c[F>>2]|0;if((S|0)<(c[ja+(N<<2)>>2]|0)){_=S}else{oa=ja;break}}}else{oa=W}if((N|0)<(c[(c[P>>2]|0)+(ga<<2)>>2]|0)){Q=N;ha=R;M=oa}else{na=R;break}}}}while(0);if((ea|0)<=0){E=na;break b}ea=ea-1|0;K=na}}}while(0);A=(c[k+8>>2]|0)+44|0;g[A>>2]=E+ +g[A>>2];lf(B);i=m;return 0}}while(0);c[q>>2]=-t;sf(3472,q)|0;i=m;return 0}function yg(a,b,d,e,f,g,j,k){a=a|0;b=+b;d=d|0;e=e|0;f=f|0;g=+g;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0.0,Q=0,R=0.0,S=0,T=0.0,U=0;l=i;m=j;n=i;i=i+4|0;i=i+7&-8;o=i;i=i+256|0;p=i;i=i+256|0;q=wg(a,8056)|0;r=c[d+20>>2]|0;s=c[r+4>>2]|0;c[n>>2]=0;t=(q|0)!=0;do{if(t){u=5}else{if((wg(a,5928)|0)!=0){u=5;break}if((wg(a,4024)|0)!=0){u=5;break}c[n>>2]=1}}while(0);a:do{if((u|0)==5){q=d+12|0;v=c[q>>2]|0;do{if((v|0)>=0){w=d+16|0;x=c[w>>2]|0;if((x|0)<0){break}if((f|0)==0){c[n>>2]=5;break a}if((k|0)==0){c[n>>2]=8;break a}if((c[n>>2]|0)!=0){break a}if((v|0)==0|(x|0)==0){i=l;return 0}x=b==0.0;if(x&g==1.0){i=l;return 0}y=(wg(a,8056)|0)==0;z=c[(y?w:q)>>2]|0;if((f|0)>0){A=0}else{A=fa(1-(c[(y?q:w)>>2]|0)|0,f)|0}if((k|0)>0){B=0}else{B=fa(1-z|0,k)|0}do{if(g!=1.0){y=g==0.0;C=(z|0)>0;if((k|0)==1){if(y){if(!C){break}Gq(m|0,0,z<<3|0)|0;break}else{if(C){D=0}else{break}do{E=j+(D<<3)|0;h[E>>3]=+h[E>>3]*g;D=D+1|0;}while((D|0)<(z|0))}}else{if(y){if(C){F=0;G=B}else{break}while(1){h[j+(G<<3)>>3]=0.0;E=F+1|0;if((E|0)<(z|0)){F=E;G=G+k|0}else{break}}}else{if(C){H=0;I=B}else{break}while(1){y=j+(I<<3)|0;h[y>>3]=+h[y>>3]*g;y=H+1|0;if((y|0)<(z|0)){H=y;I=I+k|0}else{break}}}}}}while(0);if(x){i=l;return 0}if(!t){if((f|0)!=1){z=p|0;ob(z|0,2784,(J=i,i=i+24|0,c[J>>2]=13336,c[J+8>>2]=470,c[J+16>>2]=1456,J)|0)|0;i=J;Ze(z);i=l;return 0}z=c[w>>2]|0;if((z|0)<=0){i=l;return 0}C=c[r+12>>2]|0;y=r+8|0;E=0;K=B;L=c[C>>2]|0;while(1){M=E+1|0;N=c[C+(M<<2)>>2]|0;if((L|0)<(N|0)){O=c[y>>2]|0;P=0.0;Q=L;while(1){R=P+ +h[s+(Q<<3)>>3]*+h[e+(c[O+(Q<<2)>>2]<<3)>>3];S=Q+1|0;if((S|0)<(N|0)){P=R;Q=S}else{T=R;break}}}else{T=0.0}Q=j+(K<<3)|0;h[Q>>3]=T*b+ +h[Q>>3];if((M|0)<(z|0)){E=M;K=K+k|0;L=N}else{break}}i=l;return 0}if((k|0)!=1){L=o|0;ob(L|0,2784,(J=i,i=i+24|0,c[J>>2]=13336,c[J+8>>2]=454,c[J+16>>2]=1456,J)|0)|0;i=J;Ze(L);i=l;return 0}L=c[w>>2]|0;if((L|0)<=0){i=l;return 0}K=r+12|0;E=r+8|0;z=0;y=A;while(1){P=+h[e+(y<<3)>>3];do{if(P!=0.0){R=P*b;C=c[K>>2]|0;x=c[C+(z<<2)>>2]|0;Q=z+1|0;O=c[C+(Q<<2)>>2]|0;if((x|0)>=(O|0)){U=Q;break}C=c[E>>2]|0;S=x;while(1){x=j+(c[C+(S<<2)>>2]<<3)|0;h[x>>3]=+h[x>>3]+R*+h[s+(S<<3)>>3];x=S+1|0;if((x|0)<(O|0)){S=x}else{U=Q;break}}}else{U=z+1|0}}while(0);if((U|0)<(L|0)){z=U;y=y+f|0}else{break}}i=l;return 0}}while(0);c[n>>2]=3}}while(0);sf(960,n)|0;i=l;return 0}function zg(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;h=i;i=i+256|0;j=h|0;k=f<<2;l=kf(k)|0;m=l;if((l|0)==0){ob(j|0,3856,(n=i,i=i+24|0,c[n>>2]=11424,c[n+8>>2]=57,c[n+16>>2]=8040,n)|0)|0;i=n;Ze(j)}o=(f|0)>0;if(o){Gq(l|0,0,k|0)|0}p=kf(k)|0;q=p;if((p|0)==0){ob(j|0,3856,(n=i,i=i+24|0,c[n>>2]=11424,c[n+8>>2]=57,c[n+16>>2]=8040,n)|0)|0;i=n;Ze(j)}if(o){Gq(p|0,0,k|0)|0}k=e<<2;r=kf(k)|0;s=r;if((r|0)==0){ob(j|0,3856,(n=i,i=i+24|0,c[n>>2]=11424,c[n+8>>2]=57,c[n+16>>2]=8040,n)|0)|0;i=n;Ze(j)}if((e|0)>0){Gq(r|0,0,k|0)|0;k=0;while(1){j=k+1|0;c[s+(k<<2)>>2]=f;if((j|0)<(e|0)){k=j}else{break}}}if(o){t=0}else{lf(l);lf(r);lf(p);i=h;return 0}do{k=c[a+(t<<2)>>2]|0;e=b+(t<<2)|0;if((k|0)<(c[e>>2]|0)){j=k;do{k=s+(c[d+(j<<2)>>2]<<2)|0;n=c[k>>2]|0;c[k>>2]=(n|0)<(t|0)?n:t;j=j+1|0;}while((j|0)<(c[e>>2]|0))}t=t+1|0;}while((t|0)<(f|0));if(o){u=0}else{lf(l);lf(r);lf(p);i=h;return 0}do{c[q+(u<<2)>>2]=u;c[m+(u<<2)>>2]=u;c[g+(u<<2)>>2]=f;o=c[a+(u<<2)>>2]|0;t=b+(u<<2)|0;if((o|0)<(c[t>>2]|0)){e=u;j=o;while(1){o=c[s+(c[d+(j<<2)>>2]<<2)>>2]|0;do{if((o|0)<(u|0)){n=c[q+(o<<2)>>2]|0;k=c[q+(n<<2)>>2]|0;if((k|0)==(n|0)){v=n}else{n=o;w=k;while(1){c[q+(n<<2)>>2]=w;k=c[q+(w<<2)>>2]|0;x=c[q+(k<<2)>>2]|0;if((x|0)==(k|0)){v=k;break}else{n=w;w=x}}}w=m+(v<<2)|0;n=c[w>>2]|0;if((n|0)==(u|0)){y=e;break}c[g+(n<<2)>>2]=u;c[q+(e<<2)>>2]=v;c[w>>2]=u;y=v}else{y=e}}while(0);o=j+1|0;if((o|0)<(c[t>>2]|0)){e=y;j=o}else{break}}}u=u+1|0;}while((u|0)<(f|0));lf(l);lf(r);lf(p);i=h;return 0}function Ag(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;d=i;i=i+256|0;e=a+1|0;f=d|0;g=e<<2;h=kf(g)|0;j=h;if((h|0)==0){ob(f|0,3856,(k=i,i=i+24|0,c[k>>2]=11424,c[k+8>>2]=57,c[k+16>>2]=8040,k)|0)|0;i=k;Ze(f)}l=(e|0)>0;if(l){Gq(h|0,0,g|0)|0}m=kf(g)|0;n=m;if((m|0)==0){ob(f|0,3856,(k=i,i=i+24|0,c[k>>2]=11424,c[k+8>>2]=57,c[k+16>>2]=8040,k)|0)|0;i=k;Ze(f)}if(l){Gq(m|0,0,g|0)|0}o=kf(g)|0;p=o;if((o|0)==0){ob(f|0,3856,(k=i,i=i+24|0,c[k>>2]=11424,c[k+8>>2]=57,c[k+16>>2]=8040,k)|0)|0;i=k;Ze(f)}if(l){Gq(o|0,0,g|0)|0}do{if((a|0)<0){q=0;r=a}else{Gq(h|0,-1|0,(a<<2)+4|0)|0;if((a|0)>0){s=a}else{q=0;r=0;break}while(1){g=s-1|0;o=j+(c[b+(g<<2)>>2]<<2)|0;c[n+(g<<2)>>2]=c[o>>2];c[o>>2]=g;if((g|0)>0){s=g}else{q=0;r=a;break}}}}while(0);while(1){if((q|0)==(a|0)){t=21;break}else{u=r}while(1){s=c[j+(u<<2)>>2]|0;if((s|0)==-1){break}else{u=s}}c[p+(u<<2)>>2]=q;s=c[n+(u<<2)>>2]|0;g=q+1|0;if((s|0)==-1){o=u;l=g;while(1){f=c[b+(o<<2)>>2]|0;c[p+(f<<2)>>2]=l;k=c[n+(f<<2)>>2]|0;v=l+1|0;if((k|0)==-1){o=f;l=v}else{w=k;x=v;break}}}else{w=s;x=g}if((x|0)==(e|0)){t=21;break}else{q=x;r=w}}if((t|0)==21){lf(h);lf(m);i=d;return p|0}return 0}function Bg(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,i=0.0,j=0.0,k=0,l=0,m=0.0,n=0.0,o=0.0,p=0,q=0.0,r=0.0,s=0,t=0,u=0.0,v=0,w=0.0,x=0.0,y=0,z=0.0;e=c[a>>2]|0;if((e|0)<1){f=0;return f|0}g=c[d>>2]|0;if((g|0)<1){f=0;return f|0}if((e|0)==1){f=1;return f|0}if((g|0)==1){i=+h[b>>3];if(i<0.0){j=-0.0-i}else{j=i}h[25]=j;c[5858]=2;if((c[a>>2]|0)<2){f=1;return f|0}else{k=2;l=1;m=j}while(1){j=+h[b+(k-1<<3)>>3];g=j<0.0;if(g){n=-0.0-j}else{n=j}if(n>m){if(g){o=-0.0-j}else{o=j}h[25]=o;p=k;q=o}else{p=l;q=m}g=k+1|0;c[5858]=g;if((g|0)>(c[a>>2]|0)){f=p;break}else{k=g;l=p;m=q}}return f|0}else{c[5856]=1;q=+h[b>>3];if(q<0.0){r=-0.0-q}else{r=q}h[25]=r;p=(c[d>>2]|0)+1|0;c[5856]=p;c[5858]=2;if((c[a>>2]|0)<2){f=1;return f|0}else{s=1;t=p;u=r;v=2}while(1){r=+h[b+(t-1<<3)>>3];p=r<0.0;if(p){w=-0.0-r}else{w=r}if(w>u){if(p){x=-0.0-r}else{x=r}h[25]=x;y=v;z=x}else{y=s;z=u}p=t+(c[d>>2]|0)|0;c[5856]=p;l=v+1|0;c[5858]=l;if((l|0)>(c[a>>2]|0)){f=y;break}else{s=y;t=p;u=z;v=l}}return f|0}return 0}function Cg(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0.0,g=0,i=0,j=0,k=0.0,l=0,m=0.0,n=0.0,o=0,p=0,q=0.0,r=0.0,s=0.0,t=0,u=0.0,v=0.0,w=0.0,x=0.0,y=0.0,z=0.0,A=0.0;h[89]=0.0;e=c[a>>2]|0;if((e|0)<1){f=0.0;return+f}g=c[d>>2]|0;if((g|0)<1){f=0.0;return+f}if((g|0)!=1){i=fa(g,e)|0;c[6006]=i;c[6010]=1;g=c[d>>2]|0;if((g|0)<0?(i|0)<2:(i|0)>0){j=1;k=0.0;l=g}else{f=0.0;return+f}while(1){m=+h[b+(j-1<<3)>>3];if(m<0.0){n=-0.0-m}else{n=m}m=n+k;h[89]=m;g=j+l|0;c[6010]=g;o=c[d>>2]|0;if((o|0)<0?(g|0)>=(i|0):(g|0)<=(i|0)){j=g;k=m;l=o}else{f=m;break}}return+f}l=(e|0)%6|0;c[6008]=l;do{if((l|0)==0){p=0;q=0.0}else{c[6010]=1;if((l|0)<1){r=0.0}else{e=1;k=0.0;do{n=+h[b+(e-1<<3)>>3];if(n<0.0){s=-0.0-n}else{s=n}k=s+k;h[89]=k;e=e+1|0;}while((e|0)<=(l|0));c[6010]=e;r=k}if((c[a>>2]|0)<6){f=r}else{p=l;q=r;break}return+f}}while(0);l=p+1|0;c[6010]=l;if((l|0)>(c[a>>2]|0)){f=q;return+f}else{t=l;u=q}while(1){q=+h[b+(t-1<<3)>>3];if(q<0.0){v=-0.0-q}else{v=q}q=+h[b+(t<<3)>>3];if(q<0.0){w=-0.0-q}else{w=q}q=+h[b+(t+1<<3)>>3];if(q<0.0){x=-0.0-q}else{x=q}q=+h[b+(t+2<<3)>>3];if(q<0.0){y=-0.0-q}else{y=q}q=+h[b+(t+3<<3)>>3];if(q<0.0){z=-0.0-q}else{z=q}q=+h[b+(t+4<<3)>>3];if(q<0.0){A=-0.0-q}else{A=q}q=u+v+w+x+y+z+A;h[89]=q;l=t+6|0;c[6010]=l;if((l|0)>(c[a>>2]|0)){f=q;break}else{t=l;u=q}}return+f}function Dg(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var i=0,j=0.0,k=0,l=0,m=0,n=0,o=0.0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0.0;i=c[a>>2]|0;if((i|0)<1){return 0}j=+h[b>>3];if(j==0.0){return 0}do{if((c[e>>2]|0)==1){if((c[g>>2]|0)!=1){break}k=(i|0)%4|0;c[5998]=k;do{if((k|0)==0){l=0}else{c[6004]=1;if((k|0)>=1){m=0;n=1;o=j;while(1){p=f+(m<<3)|0;h[p>>3]=+h[p>>3]+o*+h[d+(m<<3)>>3];q=n+1|0;if((q|0)>(k|0)){break}m=n;n=q;o=+h[b>>3]}c[6004]=q}if((c[a>>2]|0)>=4){l=k;break}return 0}}while(0);k=l+1|0;c[6004]=k;if((k|0)>(c[a>>2]|0)){return 0}else{r=k}do{k=r-1|0;n=f+(k<<3)|0;h[n>>3]=+h[n>>3]+ +h[b>>3]*+h[d+(k<<3)>>3];k=f+(r<<3)|0;h[k>>3]=+h[k>>3]+ +h[b>>3]*+h[d+(r<<3)>>3];k=r+1|0;n=f+(k<<3)|0;h[n>>3]=+h[n>>3]+ +h[b>>3]*+h[d+(k<<3)>>3];k=r+2|0;n=f+(k<<3)|0;h[n>>3]=+h[n>>3]+ +h[b>>3]*+h[d+(k<<3)>>3];r=r+4|0;c[6004]=r;}while((r|0)<=(c[a>>2]|0));return 0}}while(0);c[6002]=1;c[6e3]=1;r=c[e>>2]|0;if((r|0)<0){l=(fa(1-(c[a>>2]|0)|0,r)|0)+1|0;c[6002]=l;s=l}else{s=1}l=c[g>>2]|0;if((l|0)<0){r=(fa(1-(c[a>>2]|0)|0,l)|0)+1|0;c[6e3]=r;t=r}else{t=1}c[6004]=1;if((c[a>>2]|0)<1){return 0}else{u=s;v=t;w=2;x=j}while(1){t=f+(v-1<<3)|0;h[t>>3]=x*+h[d+(u-1<<3)>>3]+ +h[t>>3];t=u+(c[e>>2]|0)|0;c[6002]=t;s=v+(c[g>>2]|0)|0;c[6e3]=s;c[6004]=w;if((w|0)>(c[a>>2]|0)){break}u=t;v=s;w=w+1|0;x=+h[b>>3]}return 0}function Eg(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;g=c[a>>2]|0;if((g|0)<1){return 0}do{if((c[d>>2]|0)==1){if((c[f>>2]|0)!=1){break}i=(g|0)%7|0;c[5988]=i;do{if((i|0)==0){j=0}else{c[5994]=1;if((i|0)>=1){k=1;do{l=k-1|0;h[e+(l<<3)>>3]=+h[b+(l<<3)>>3];k=k+1|0;}while((k|0)<=(i|0));c[5994]=k}if((c[a>>2]|0)>=7){j=i;break}return 0}}while(0);i=j+1|0;c[5994]=i;if((i|0)>(c[a>>2]|0)){return 0}else{m=i}do{i=m-1|0;h[e+(i<<3)>>3]=+h[b+(i<<3)>>3];h[e+(m<<3)>>3]=+h[b+(m<<3)>>3];i=m+1|0;h[e+(i<<3)>>3]=+h[b+(i<<3)>>3];i=m+2|0;h[e+(i<<3)>>3]=+h[b+(i<<3)>>3];i=m+3|0;h[e+(i<<3)>>3]=+h[b+(i<<3)>>3];i=m+4|0;h[e+(i<<3)>>3]=+h[b+(i<<3)>>3];i=m+5|0;h[e+(i<<3)>>3]=+h[b+(i<<3)>>3];m=m+7|0;c[5994]=m;}while((m|0)<=(c[a>>2]|0));return 0}}while(0);c[5992]=1;c[5990]=1;m=c[d>>2]|0;if((m|0)<0){j=(fa(1-(c[a>>2]|0)|0,m)|0)+1|0;c[5992]=j;n=j}else{n=1}j=c[f>>2]|0;if((j|0)<0){m=(fa(1-(c[a>>2]|0)|0,j)|0)+1|0;c[5990]=m;o=m}else{o=1}c[5994]=1;if((c[a>>2]|0)<1){return 0}else{p=n;q=o;r=1}do{h[e+(q-1<<3)>>3]=+h[b+(p-1<<3)>>3];p=p+(c[d>>2]|0)|0;c[5992]=p;q=q+(c[f>>2]|0)|0;c[5990]=q;r=r+1|0;c[5994]=r;}while((r|0)<=(c[a>>2]|0));return 0}function Fg(a,b,d,e,f,g,i,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;i=i|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0.0,s=0.0,t=0,u=0.0,v=0,w=0.0,x=0.0,y=0,z=0,A=0,B=0.0,C=0,D=0,E=0,F=0,G=0.0,H=0,I=0.0,J=0.0,K=0,L=0,M=0.0,N=0,O=0.0,P=0,Q=0.0,R=0,S=0,T=0,U=0.0,V=0,W=0,X=0.0,Y=0,Z=0,_=0,$=0.0,aa=0,ba=0,ca=0.0,da=0,ea=0,ga=0.0,ha=0,ia=0,ja=0,ka=0.0,la=0,ma=0,na=0.0,oa=0;c[5886]=0;do{if((wg(a,3744)|0)==0){if((wg(a,11192)|0)!=0){k=4;break}c[5886]=1}else{k=4}}while(0);a:do{if((k|0)==4){do{if((wg(b,7896)|0)==0){if((wg(b,5840)|0)!=0){break}if((wg(b,4016)|0)!=0){break}c[5886]=2;break a}}while(0);do{if((wg(d,3744)|0)==0){if((wg(d,7896)|0)!=0){break}c[5886]=3;break a}}while(0);l=c[e>>2]|0;if((l|0)<0){c[5886]=4;break}if((c[g>>2]|0)<(((l|0)>1?l:1)|0)){c[5886]=6;break}if((c[j>>2]|0)==0){c[5886]=8;break}if((c[5886]|0)!=0){break}if((l|0)==0){return 0}c[5876]=wg(d,7896)|0;l=c[j>>2]|0;do{if((l|0)<1){c[5878]=1-(fa((c[e>>2]|0)-1|0,l)|0)}else{if((l|0)==1){break}c[5878]=1}}while(0);l=(wg(b,7896)|0)==0;m=(wg(a,3744)|0)!=0;n=c[j>>2]|0;o=(n|0)==1;if(l){if(m){if(o){c[5882]=1;if((c[e>>2]|0)<1){return 0}else{p=1}do{l=p-1|0;q=i+(l<<3)|0;r=+h[q>>3];h[26]=r;c[5888]=1;if((l|0)<1){s=r}else{t=1;u=r;while(1){v=t-1|0;r=+h[f+((fa(c[g>>2]|0,l)|0)+v<<3)>>3];w=u-r*+h[i+(v<<3)>>3];h[26]=w;v=t+1|0;c[5888]=v;if((v|0)>(l|0)){s=w;break}else{t=v;u=w}}}if((c[5876]|0)==0){x=s}else{u=s/+h[f+((fa(c[g>>2]|0,l)|0)+l<<3)>>3];h[26]=u;x=u}h[q>>3]=x;p=p+1|0;c[5882]=p;}while((p|0)<=(c[e>>2]|0));return 0}else{t=c[5878]|0;c[5880]=t;c[5882]=1;if((c[e>>2]|0)<1){return 0}else{y=t;z=1}do{v=i+(y-1<<3)|0;u=+h[v>>3];h[26]=u;c[5884]=t;c[5888]=1;A=z-1|0;if((A|0)<1){B=u}else{C=1;D=t;w=u;while(1){u=+h[f+(C-1+(fa(c[g>>2]|0,A)|0)<<3)>>3];r=w-u*+h[i+(D-1<<3)>>3];h[26]=r;E=D+(c[j>>2]|0)|0;c[5884]=E;F=C+1|0;c[5888]=F;if((F|0)>(A|0)){B=r;break}else{C=F;D=E;w=r}}}if((c[5876]|0)==0){G=B}else{w=B/+h[f+((fa(c[g>>2]|0,A)|0)+A<<3)>>3];h[26]=w;G=w}h[v>>3]=G;y=y+(c[j>>2]|0)|0;c[5880]=y;z=z+1|0;c[5882]=z;}while((z|0)<=(c[e>>2]|0));return 0}}else{t=c[e>>2]|0;if(o){c[5882]=t;if((t|0)>0){H=t}else{return 0}while(1){D=H-1|0;C=i+(D<<3)|0;w=+h[C>>3];h[26]=w;q=c[e>>2]|0;c[5888]=q;l=H+1|0;if((q|0)<(l|0)){I=w}else{E=q;r=w;while(1){q=E-1|0;w=+h[f+((fa(c[g>>2]|0,D)|0)+q<<3)>>3];u=r-w*+h[i+(q<<3)>>3];h[26]=u;c[5888]=q;if((q|0)<(l|0)){I=u;break}else{E=q;r=u}}}if((c[5876]|0)==0){J=I}else{r=I/+h[f+((fa(c[g>>2]|0,D)|0)+D<<3)>>3];h[26]=r;J=r}h[C>>3]=J;c[5882]=D;if((D|0)>0){H=D}else{break}}return 0}else{E=fa(t-1|0,n)|0;l=(c[5878]|0)+E|0;c[5878]=l;c[5880]=l;E=c[e>>2]|0;c[5882]=E;if((E|0)>0){K=l;L=E}else{return 0}do{E=i+(K-1<<3)|0;r=+h[E>>3];h[26]=r;c[5884]=l;v=c[e>>2]|0;c[5888]=v;A=L+1|0;if((v|0)<(A|0)){M=r}else{q=v;v=l;u=r;while(1){F=q-1|0;r=+h[f+(F+(fa(c[g>>2]|0,L-1|0)|0)<<3)>>3];w=u-r*+h[i+(v-1<<3)>>3];h[26]=w;N=v-(c[j>>2]|0)|0;c[5884]=N;c[5888]=F;if((F|0)<(A|0)){M=w;break}else{q=F;v=N;u=w}}}L=L-1|0;if((c[5876]|0)==0){O=M}else{u=M/+h[f+((fa(c[g>>2]|0,L)|0)+L<<3)>>3];h[26]=u;O=u}h[E>>3]=O;K=K-(c[j>>2]|0)|0;c[5880]=K;c[5882]=L;}while((L|0)>0);return 0}}}if(!m){if(o){c[5882]=1;if((c[e>>2]|0)<1){return 0}else{P=1}while(1){l=P-1|0;t=i+(l<<3)|0;u=+h[t>>3];b:do{if(u!=0.0){if((c[5876]|0)==0){Q=u}else{w=u/+h[f+((fa(c[g>>2]|0,l)|0)+l<<3)>>3];h[t>>3]=w;Q=w}h[26]=Q;v=P+1|0;c[5888]=v;if((v|0)>(c[e>>2]|0)){R=v;break}else{S=P;T=v;U=Q}while(1){w=U*+h[f+((fa(l,c[g>>2]|0)|0)+S<<3)>>3];q=i+(S<<3)|0;h[q>>3]=+h[q>>3]-w;q=T+1|0;c[5888]=q;if((q|0)>(c[e>>2]|0)){R=v;break b}S=T;T=q;U=+h[26]}}else{R=P+1|0}}while(0);c[5882]=R;if((R|0)>(c[e>>2]|0)){break}else{P=R}}return 0}else{m=c[5878]|0;c[5880]=m;c[5882]=1;if((c[e>>2]|0)<1){return 0}else{V=1;W=m}while(1){m=i+(W-1<<3)|0;u=+h[m>>3];c:do{if(u!=0.0){if((c[5876]|0)==0){X=u}else{l=V-1|0;w=u/+h[f+((fa(c[g>>2]|0,l)|0)+l<<3)>>3];h[m>>3]=w;X=w}h[26]=X;c[5884]=W;l=V+1|0;c[5888]=l;if((l|0)>(c[e>>2]|0)){Y=l;break}else{Z=W;_=l;$=X}while(1){t=Z+(c[j>>2]|0)|0;c[5884]=t;w=$*+h[f+(_-1+(fa(V-1|0,c[g>>2]|0)|0)<<3)>>3];E=i+(t-1<<3)|0;h[E>>3]=+h[E>>3]-w;E=_+1|0;c[5888]=E;if((E|0)>(c[e>>2]|0)){Y=l;break c}Z=t;_=E;$=+h[26]}}else{Y=V+1|0}}while(0);m=W+(c[j>>2]|0)|0;c[5880]=m;c[5882]=Y;if((Y|0)>(c[e>>2]|0)){break}else{V=Y;W=m}}return 0}}if(o){m=c[e>>2]|0;c[5882]=m;if((m|0)>0){aa=m}else{return 0}d:while(1){ba=aa-1|0;m=i+(ba<<3)|0;u=+h[m>>3];e:do{if(u!=0.0){if((c[5876]|0)==0){ca=u}else{w=u/+h[f+((fa(c[g>>2]|0,ba)|0)+ba<<3)>>3];h[m>>3]=w;ca=w}h[26]=ca;c[5888]=ba;if((ba|0)>0){da=aa;ea=ba;ga=ca}else{break d}while(1){l=da-2|0;w=ga*+h[f+((fa(ba,c[g>>2]|0)|0)+l<<3)>>3];E=i+(l<<3)|0;h[E>>3]=+h[E>>3]-w;E=ea-1|0;c[5888]=E;if((E|0)<=0){break e}da=ea;ea=E;ga=+h[26]}}}while(0);c[5882]=ba;if((ba|0)>0){aa=ba}else{k=92;break}}if((k|0)==92){return 0}c[5882]=ba;return 0}o=(fa((c[e>>2]|0)-1|0,n)|0)+(c[5878]|0)|0;c[5880]=o;m=c[e>>2]|0;c[5882]=m;if((m|0)>0){ha=m;ia=o}else{return 0}f:while(1){o=i+(ia-1<<3)|0;u=+h[o>>3];g:do{if(u!=0.0){ja=ha-1|0;if((c[5876]|0)==0){ka=u}else{w=u/+h[f+((fa(c[g>>2]|0,ja)|0)+ja<<3)>>3];h[o>>3]=w;ka=w}h[26]=ka;c[5884]=ia;c[5888]=ja;if((ja|0)>0){la=ia;ma=ja;na=ka}else{break f}while(1){m=la-(c[j>>2]|0)|0;c[5884]=m;E=ma-1|0;w=na*+h[f+(E+(fa(ja,c[g>>2]|0)|0)<<3)>>3];l=i+(m-1<<3)|0;h[l>>3]=+h[l>>3]-w;c[5888]=E;if((E|0)<=0){oa=ja;break g}la=m;ma=E;na=+h[26]}}else{oa=ha-1|0}}while(0);o=ia-(c[j>>2]|0)|0;c[5880]=o;c[5882]=oa;if((oa|0)>0){ha=oa;ia=o}else{k=92;break}}if((k|0)==92){return 0}c[5880]=ia-(c[j>>2]|0);c[5882]=ja;return 0}}while(0);sf(3296,23544)|0;return 0}function Gg(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0;b=i;i=i+32|0;d=b|0;e=b+8|0;f=b+16|0;g=b+24|0;h=c[o>>2]|0;ah(26840,h,26968);c[6958]=17260;c[6960]=17280;c[6959]=0;gi(27840,26840);c[6978]=0;c[6979]=-1;j=c[p>>2]|0;c[6686]=16992;pn(26748);Gq(26752,0,24)|0;c[6686]=17480;c[6694]=j;qn(g,26748);k=un(g,27168)|0;l=k;rn(g);c[6695]=l;c[6696]=26976;a[26788]=(Mc[c[(c[k>>2]|0)+28>>2]&255](l)|0)&1;c[6892]=17164;c[6893]=17184;gi(27572,26744);c[6911]=0;c[6912]=-1;l=c[s>>2]|0;c[6698]=16992;pn(26796);Gq(26800,0,24)|0;c[6698]=17480;c[6706]=l;qn(f,26796);k=un(f,27168)|0;g=k;rn(f);c[6707]=g;c[6708]=26984;a[26836]=(Mc[c[(c[k>>2]|0)+28>>2]&255](g)|0)&1;c[6936]=17164;c[6937]=17184;gi(27748,26792);c[6955]=0;c[6956]=-1;g=c[(c[(c[6936]|0)-12>>2]|0)+27768>>2]|0;c[6914]=17164;c[6915]=17184;gi(27660,g);c[6933]=0;c[6934]=-1;c[(c[(c[6958]|0)-12>>2]|0)+27904>>2]=27568;g=(c[(c[6936]|0)-12>>2]|0)+27748|0;c[g>>2]=c[g>>2]|8192;c[(c[(c[6936]|0)-12>>2]|0)+27816>>2]=27568;Og(26688,h,26992);c[6870]=17212;c[6872]=17232;c[6871]=0;gi(27488,26688);c[6890]=0;c[6891]=-1;c[6648]=16920;pn(26596);Gq(26600,0,24)|0;c[6648]=17408;c[6656]=j;qn(e,26596);j=un(e,27160)|0;h=j;rn(e);c[6657]=h;c[6658]=27e3;a[26636]=(Mc[c[(c[j>>2]|0)+28>>2]&255](h)|0)&1;c[6800]=17116;c[6801]=17136;gi(27204,26592);c[6819]=0;c[6820]=-1;c[6660]=16920;pn(26644);Gq(26648,0,24)|0;c[6660]=17408;c[6668]=l;qn(d,26644);l=un(d,27160)|0;h=l;rn(d);c[6669]=h;c[6670]=27008;a[26684]=(Mc[c[(c[l>>2]|0)+28>>2]&255](h)|0)&1;c[6844]=17116;c[6845]=17136;gi(27380,26640);c[6863]=0;c[6864]=-1;h=c[(c[(c[6844]|0)-12>>2]|0)+27400>>2]|0;c[6822]=17116;c[6823]=17136;gi(27292,h);c[6841]=0;c[6842]=-1;c[(c[(c[6870]|0)-12>>2]|0)+27552>>2]=27200;h=(c[(c[6844]|0)-12>>2]|0)+27380|0;c[h>>2]=c[h>>2]|8192;c[(c[(c[6844]|0)-12>>2]|0)+27448>>2]=27200;i=b;return}function Hg(a){a=a|0;Ni(27568)|0;Ni(27656)|0;Ti(27200)|0;Ti(27288)|0;return}function Ig(a){a=a|0;c[a>>2]=16920;rn(a+4|0);return}function Jg(a){a=a|0;c[a>>2]=16920;rn(a+4|0);oq(a);return}function Kg(b,d){b=b|0;d=d|0;var e=0;Mc[c[(c[b>>2]|0)+24>>2]&255](b)|0;e=un(d,27160)|0;d=e;c[b+36>>2]=d;a[b+44|0]=(Mc[c[(c[e>>2]|0)+28>>2]&255](d)|0)&1;return}function Lg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;b=i;i=i+16|0;d=b|0;e=b+8|0;f=a+36|0;g=a+40|0;h=d|0;j=d+8|0;k=d;d=a+32|0;while(1){a=c[f>>2]|0;l=Vc[c[(c[a>>2]|0)+20>>2]&31](a,c[g>>2]|0,h,j,e)|0;a=(c[e>>2]|0)-k|0;if((Ma(h|0,1,a|0,c[d>>2]|0)|0)!=(a|0)){m=-1;n=5;break}if((l|0)==2){m=-1;n=5;break}else if((l|0)!=1){n=4;break}}if((n|0)==4){m=((Ka(c[d>>2]|0)|0)!=0)<<31>>31;i=b;return m|0}else if((n|0)==5){i=b;return m|0}return 0}function Mg(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;if((a[b+44|0]|0)!=0){f=Ma(d|0,4,e|0,c[b+32>>2]|0)|0;return f|0}g=b;if((e|0)>0){h=d;i=0}else{f=0;return f|0}while(1){if((Jc[c[(c[g>>2]|0)+52>>2]&63](b,c[h>>2]|0)|0)==-1){f=i;j=6;break}d=i+1|0;if((d|0)<(e|0)){h=h+4|0;i=d}else{f=d;j=6;break}}if((j|0)==6){return f|0}return 0}function Ng(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;e=i;i=i+32|0;f=e|0;g=e+8|0;h=e+16|0;j=e+24|0;k=(d|0)==-1;a:do{if(!k){c[g>>2]=d;if((a[b+44|0]|0)!=0){if((Ma(g|0,4,1,c[b+32>>2]|0)|0)==1){break}else{l=-1}i=e;return l|0}m=f|0;c[h>>2]=m;n=g+4|0;o=b+36|0;p=b+40|0;q=f+8|0;r=f;s=b+32|0;t=g;while(1){u=c[o>>2]|0;v=Qc[c[(c[u>>2]|0)+12>>2]&31](u,c[p>>2]|0,t,n,j,m,q,h)|0;if((c[j>>2]|0)==(t|0)){l=-1;w=12;break}if((v|0)==3){w=7;break}u=(v|0)==1;if(!(v>>>0<2>>>0)){l=-1;w=12;break}v=(c[h>>2]|0)-r|0;if((Ma(m|0,1,v|0,c[s>>2]|0)|0)!=(v|0)){l=-1;w=12;break}if(u){t=u?c[j>>2]|0:t}else{break a}}if((w|0)==7){if((Ma(t|0,1,1,c[s>>2]|0)|0)==1){break}else{l=-1}i=e;return l|0}else if((w|0)==12){i=e;return l|0}}}while(0);l=k?0:d;i=e;return l|0}function Og(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;f=i;i=i+8|0;g=f|0;h=b|0;c[h>>2]=16920;j=b+4|0;pn(j);Gq(b+8|0,0,24)|0;c[h>>2]=17808;c[b+32>>2]=d;c[b+40>>2]=e;c[b+48>>2]=-1;a[b+52|0]=0;qn(g,j);j=un(g,27160)|0;e=j;d=b+36|0;c[d>>2]=e;h=b+44|0;c[h>>2]=Mc[c[(c[j>>2]|0)+24>>2]&255](e)|0;e=c[d>>2]|0;a[b+53|0]=(Mc[c[(c[e>>2]|0)+28>>2]&255](e)|0)&1;if((c[h>>2]|0)<=8){rn(g);i=f;return}Am(912);rn(g);i=f;return}function Pg(a){a=a|0;c[a>>2]=16920;rn(a+4|0);return}function Qg(a){a=a|0;c[a>>2]=16920;rn(a+4|0);oq(a);return}function Rg(b,d){b=b|0;d=d|0;var e=0,f=0,g=0;e=un(d,27160)|0;d=e;f=b+36|0;c[f>>2]=d;g=b+44|0;c[g>>2]=Mc[c[(c[e>>2]|0)+24>>2]&255](d)|0;d=c[f>>2]|0;a[b+53|0]=(Mc[c[(c[d>>2]|0)+28>>2]&255](d)|0)&1;if((c[g>>2]|0)<=8){return}Am(912);return}function Sg(a){a=a|0;return Vg(a,0)|0}function Tg(a){a=a|0;return Vg(a,1)|0}function Ug(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;e=i;i=i+32|0;f=e|0;g=e+8|0;h=e+16|0;j=e+24|0;k=b+52|0;l=(a[k]|0)!=0;if((d|0)==-1){if(l){m=-1;i=e;return m|0}n=c[b+48>>2]|0;a[k]=(n|0)!=-1|0;m=n;i=e;return m|0}n=b+48|0;a:do{if(l){c[h>>2]=c[n>>2];o=c[b+36>>2]|0;p=f|0;q=Qc[c[(c[o>>2]|0)+12>>2]&31](o,c[b+40>>2]|0,h,h+4|0,j,p,f+8|0,g)|0;if((q|0)==3){a[p]=c[n>>2];c[g>>2]=f+1}else if((q|0)==2|(q|0)==1){m=-1;i=e;return m|0}q=b+32|0;while(1){o=c[g>>2]|0;if(!(o>>>0>p>>>0)){break a}r=o-1|0;c[g>>2]=r;if((dc(a[r]|0,c[q>>2]|0)|0)==-1){m=-1;break}}i=e;return m|0}}while(0);c[n>>2]=d;a[k]=1;m=d;i=e;return m|0}function Vg(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;e=i;i=i+32|0;f=e|0;g=e+8|0;h=e+16|0;j=e+24|0;k=b+52|0;if((a[k]|0)!=0){l=b+48|0;m=c[l>>2]|0;if(!d){n=m;i=e;return n|0}c[l>>2]=-1;a[k]=0;n=m;i=e;return n|0}m=c[b+44>>2]|0;k=(m|0)>1?m:1;a:do{if((k|0)>0){m=b+32|0;l=0;while(1){o=db(c[m>>2]|0)|0;if((o|0)==-1){n=-1;break}a[f+l|0]=o;l=l+1|0;if((l|0)>=(k|0)){break a}}i=e;return n|0}}while(0);b:do{if((a[b+53|0]|0)==0){l=b+40|0;m=b+36|0;o=f|0;p=g+4|0;q=b+32|0;r=k;while(1){s=c[l>>2]|0;t=s;u=c[t>>2]|0;v=c[t+4>>2]|0;t=c[m>>2]|0;w=f+r|0;x=Qc[c[(c[t>>2]|0)+16>>2]&31](t,s,o,w,h,g,p,j)|0;if((x|0)==3){y=14;break}else if((x|0)==2){n=-1;y=22;break}else if((x|0)!=1){z=r;break b}x=c[l>>2]|0;c[x>>2]=u;c[x+4>>2]=v;if((r|0)==8){n=-1;y=22;break}v=db(c[q>>2]|0)|0;if((v|0)==-1){n=-1;y=22;break}a[w]=v;r=r+1|0}if((y|0)==14){c[g>>2]=a[o]|0;z=r;break}else if((y|0)==22){i=e;return n|0}}else{c[g>>2]=a[f|0]|0;z=k}}while(0);if(d){d=c[g>>2]|0;c[b+48>>2]=d;n=d;i=e;return n|0}d=b+32|0;b=z;while(1){if((b|0)<=0){break}z=b-1|0;if((dc(a[f+z|0]|0,c[d>>2]|0)|0)==-1){n=-1;y=22;break}else{b=z}}if((y|0)==22){i=e;return n|0}n=c[g>>2]|0;i=e;return n|0}function Wg(a){a=a|0;c[a>>2]=16992;rn(a+4|0);return}function Xg(a){a=a|0;c[a>>2]=16992;rn(a+4|0);oq(a);return}function Yg(b,d){b=b|0;d=d|0;var e=0;Mc[c[(c[b>>2]|0)+24>>2]&255](b)|0;e=un(d,27168)|0;d=e;c[b+36>>2]=d;a[b+44|0]=(Mc[c[(c[e>>2]|0)+28>>2]&255](d)|0)&1;return}function Zg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;b=i;i=i+16|0;d=b|0;e=b+8|0;f=a+36|0;g=a+40|0;h=d|0;j=d+8|0;k=d;d=a+32|0;while(1){a=c[f>>2]|0;l=Vc[c[(c[a>>2]|0)+20>>2]&31](a,c[g>>2]|0,h,j,e)|0;a=(c[e>>2]|0)-k|0;if((Ma(h|0,1,a|0,c[d>>2]|0)|0)!=(a|0)){m=-1;n=5;break}if((l|0)==2){m=-1;n=5;break}else if((l|0)!=1){n=4;break}}if((n|0)==4){m=((Ka(c[d>>2]|0)|0)!=0)<<31>>31;i=b;return m|0}else if((n|0)==5){i=b;return m|0}return 0}function _g(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0;if((a[b+44|0]|0)!=0){g=Ma(e|0,1,f|0,c[b+32>>2]|0)|0;return g|0}h=b;if((f|0)>0){i=e;j=0}else{g=0;return g|0}while(1){if((Jc[c[(c[h>>2]|0)+52>>2]&63](b,d[i]|0)|0)==-1){g=j;k=6;break}e=j+1|0;if((e|0)<(f|0)){i=i+1|0;j=e}else{g=e;k=6;break}}if((k|0)==6){return g|0}return 0}function $g(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;e=i;i=i+32|0;f=e|0;g=e+8|0;h=e+16|0;j=e+24|0;k=(d|0)==-1;a:do{if(!k){a[g]=d;if((a[b+44|0]|0)!=0){if((Ma(g|0,1,1,c[b+32>>2]|0)|0)==1){break}else{l=-1}i=e;return l|0}m=f|0;c[h>>2]=m;n=g+1|0;o=b+36|0;p=b+40|0;q=f+8|0;r=f;s=b+32|0;t=g;while(1){u=c[o>>2]|0;v=Qc[c[(c[u>>2]|0)+12>>2]&31](u,c[p>>2]|0,t,n,j,m,q,h)|0;if((c[j>>2]|0)==(t|0)){l=-1;w=12;break}if((v|0)==3){w=7;break}u=(v|0)==1;if(!(v>>>0<2>>>0)){l=-1;w=12;break}v=(c[h>>2]|0)-r|0;if((Ma(m|0,1,v|0,c[s>>2]|0)|0)!=(v|0)){l=-1;w=12;break}if(u){t=u?c[j>>2]|0:t}else{break a}}if((w|0)==7){if((Ma(t|0,1,1,c[s>>2]|0)|0)==1){break}else{l=-1}i=e;return l|0}else if((w|0)==12){i=e;return l|0}}}while(0);l=k?0:d;i=e;return l|0}function ah(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;f=i;i=i+8|0;g=f|0;h=b|0;c[h>>2]=16992;j=b+4|0;pn(j);Gq(b+8|0,0,24)|0;c[h>>2]=17880;c[b+32>>2]=d;c[b+40>>2]=e;c[b+48>>2]=-1;a[b+52|0]=0;qn(g,j);j=un(g,27168)|0;e=j;d=b+36|0;c[d>>2]=e;h=b+44|0;c[h>>2]=Mc[c[(c[j>>2]|0)+24>>2]&255](e)|0;e=c[d>>2]|0;a[b+53|0]=(Mc[c[(c[e>>2]|0)+28>>2]&255](e)|0)&1;if((c[h>>2]|0)<=8){rn(g);i=f;return}Am(912);rn(g);i=f;return}function bh(a){a=a|0;c[a>>2]=16992;rn(a+4|0);return}function ch(a){a=a|0;c[a>>2]=16992;rn(a+4|0);oq(a);return}function dh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0;e=un(d,27168)|0;d=e;f=b+36|0;c[f>>2]=d;g=b+44|0;c[g>>2]=Mc[c[(c[e>>2]|0)+24>>2]&255](d)|0;d=c[f>>2]|0;a[b+53|0]=(Mc[c[(c[d>>2]|0)+28>>2]&255](d)|0)&1;if((c[g>>2]|0)<=8){return}Am(912);return}function eh(a){a=a|0;return hh(a,0)|0}function fh(a){a=a|0;return hh(a,1)|0}function gh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;e=i;i=i+32|0;f=e|0;g=e+8|0;h=e+16|0;j=e+24|0;k=b+52|0;l=(a[k]|0)!=0;if((d|0)==-1){if(l){m=-1;i=e;return m|0}n=c[b+48>>2]|0;a[k]=(n|0)!=-1|0;m=n;i=e;return m|0}n=b+48|0;a:do{if(l){a[h]=c[n>>2];o=c[b+36>>2]|0;p=f|0;q=Qc[c[(c[o>>2]|0)+12>>2]&31](o,c[b+40>>2]|0,h,h+1|0,j,p,f+8|0,g)|0;if((q|0)==3){a[p]=c[n>>2];c[g>>2]=f+1}else if((q|0)==2|(q|0)==1){m=-1;i=e;return m|0}q=b+32|0;while(1){o=c[g>>2]|0;if(!(o>>>0>p>>>0)){break a}r=o-1|0;c[g>>2]=r;if((dc(a[r]|0,c[q>>2]|0)|0)==-1){m=-1;break}}i=e;return m|0}}while(0);c[n>>2]=d;a[k]=1;m=d;i=e;return m|0}function hh(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;f=i;i=i+32|0;g=f|0;h=f+8|0;j=f+16|0;k=f+24|0;l=b+52|0;if((a[l]|0)!=0){m=b+48|0;n=c[m>>2]|0;if(!e){o=n;i=f;return o|0}c[m>>2]=-1;a[l]=0;o=n;i=f;return o|0}n=c[b+44>>2]|0;l=(n|0)>1?n:1;a:do{if((l|0)>0){n=b+32|0;m=0;while(1){p=db(c[n>>2]|0)|0;if((p|0)==-1){o=-1;break}a[g+m|0]=p;m=m+1|0;if((m|0)>=(l|0)){break a}}i=f;return o|0}}while(0);b:do{if((a[b+53|0]|0)==0){m=b+40|0;n=b+36|0;p=g|0;q=h+1|0;r=b+32|0;s=l;while(1){t=c[m>>2]|0;u=t;v=c[u>>2]|0;w=c[u+4>>2]|0;u=c[n>>2]|0;x=g+s|0;y=Qc[c[(c[u>>2]|0)+16>>2]&31](u,t,p,x,j,h,q,k)|0;if((y|0)==3){z=14;break}else if((y|0)==2){o=-1;z=23;break}else if((y|0)!=1){A=s;break b}y=c[m>>2]|0;c[y>>2]=v;c[y+4>>2]=w;if((s|0)==8){o=-1;z=23;break}w=db(c[r>>2]|0)|0;if((w|0)==-1){o=-1;z=23;break}a[x]=w;s=s+1|0}if((z|0)==14){a[h]=a[p]|0;A=s;break}else if((z|0)==23){i=f;return o|0}}else{a[h]=a[g|0]|0;A=l}}while(0);do{if(e){l=a[h]|0;c[b+48>>2]=l&255;B=l}else{l=b+32|0;k=A;while(1){if((k|0)<=0){z=21;break}j=k-1|0;if((dc(d[g+j|0]|0,c[l>>2]|0)|0)==-1){o=-1;z=23;break}else{k=j}}if((z|0)==21){B=a[h]|0;break}else if((z|0)==23){i=f;return o|0}}}while(0);o=B&255;i=f;return o|0}function ih(){Gg(0);fb(156,27920,t|0)|0;return}function jh(a){a=a|0;return}function kh(a){a=a|0;var b=0;b=a+4|0;H=c[b>>2]|0,c[b>>2]=H+1,H;return}function lh(a){a=a|0;var b=0,d=0;b=a+4|0;if(((H=c[b>>2]|0,c[b>>2]=H+ -1,H)|0)!=0){d=0;return d|0}Hc[c[(c[a>>2]|0)+8>>2]&511](a);d=1;return d|0}function mh(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;c[a>>2]=15152;d=a+4|0;if((d|0)==0){return}a=Eq(b|0)|0;e=nq(a+13|0)|0;c[e+4>>2]=a;c[e>>2]=a;f=e+12|0;c[d>>2]=f;c[e+8>>2]=0;Fq(f|0,b|0,a+1|0)|0;return}function nh(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=15152;b=a+4|0;d=(c[b>>2]|0)-4|0;do{if(((H=c[d>>2]|0,c[d>>2]=H+ -1,H)-1|0)<0){e=(c[b>>2]|0)-12|0;if((e|0)==0){break}pq(e)}}while(0);oq(a);return}function oh(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=15152;b=a+4|0;d=(c[b>>2]|0)-4|0;if(((H=c[d>>2]|0,c[d>>2]=H+ -1,H)-1|0)>=0){e=a|0;return}d=(c[b>>2]|0)-12|0;if((d|0)==0){e=a|0;return}pq(d);e=a|0;return}function ph(a){a=a|0;return c[a+4>>2]|0}function qh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0;c[b>>2]=15088;e=b+4|0;if((e|0)==0){return}if((a[d]&1)==0){f=d+1|0}else{f=c[d+8>>2]|0}d=Eq(f|0)|0;b=nq(d+13|0)|0;c[b+4>>2]=d;c[b>>2]=d;g=b+12|0;c[e>>2]=g;c[b+8>>2]=0;Fq(g|0,f|0,d+1|0)|0;return}function rh(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;c[a>>2]=15088;d=a+4|0;if((d|0)==0){return}a=Eq(b|0)|0;e=nq(a+13|0)|0;c[e+4>>2]=a;c[e>>2]=a;f=e+12|0;c[d>>2]=f;c[e+8>>2]=0;Fq(f|0,b|0,a+1|0)|0;return}function sh(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=15088;b=a+4|0;d=(c[b>>2]|0)-4|0;do{if(((H=c[d>>2]|0,c[d>>2]=H+ -1,H)-1|0)<0){e=(c[b>>2]|0)-12|0;if((e|0)==0){break}pq(e)}}while(0);oq(a);return}function th(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=15088;b=a+4|0;d=(c[b>>2]|0)-4|0;if(((H=c[d>>2]|0,c[d>>2]=H+ -1,H)-1|0)>=0){e=a|0;return}d=(c[b>>2]|0)-12|0;if((d|0)==0){e=a|0;return}pq(d);e=a|0;return}function uh(a){a=a|0;return c[a+4>>2]|0}function vh(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=15152;b=a+4|0;d=(c[b>>2]|0)-4|0;do{if(((H=c[d>>2]|0,c[d>>2]=H+ -1,H)-1|0)<0){e=(c[b>>2]|0)-12|0;if((e|0)==0){break}pq(e)}}while(0);oq(a);return}function wh(a){a=a|0;return}function xh(a,b,d){a=a|0;b=b|0;d=d|0;c[a>>2]=d;c[a+4>>2]=b;return}function yh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;e=i;i=i+8|0;f=e|0;Nc[c[(c[a>>2]|0)+12>>2]&7](f,a,b);if((c[f+4>>2]|0)!=(c[d+4>>2]|0)){g=0;i=e;return g|0}g=(c[f>>2]|0)==(c[d>>2]|0);i=e;return g|0}function zh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;if((c[b+4>>2]|0)!=(a|0)){e=0;return e|0}e=(c[b>>2]|0)==(d|0);return e|0}function Ah(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;d=$b(e|0)|0;e=Eq(d|0)|0;if(e>>>0>4294967279>>>0){Gh(0)}if(e>>>0<11>>>0){a[b]=e<<1;f=b+1|0;Fq(f|0,d|0,e)|0;g=f+e|0;a[g]=0;return}else{h=e+16&-16;i=mq(h)|0;c[b+8>>2]=i;c[b>>2]=h|1;c[b+4>>2]=e;f=i;Fq(f|0,d|0,e)|0;g=f+e|0;a[g]=0;return}}function Bh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;f=i;i=i+16|0;g=f|0;h=d|0;j=c[h>>2]|0;k=e;do{if((j|0)!=0){l=a[k]|0;if((l&1)==0){m=(l&255)>>>1}else{m=c[e+4>>2]|0}if((m|0)==0){n=j}else{Rh(e,7648,2)|0;n=c[h>>2]|0}l=c[d+4>>2]|0;Nc[c[(c[l>>2]|0)+24>>2]&7](g,l,n);l=g;o=a[l]|0;if((o&1)==0){p=(o&255)>>>1;q=g+1|0}else{p=c[g+4>>2]|0;q=c[g+8>>2]|0}Rh(e,q,p)|0;if((a[l]&1)==0){break}oq(c[g+8>>2]|0)}}while(0);g=b;c[g>>2]=c[k>>2];c[g+4>>2]=c[k+4>>2];c[g+8>>2]=c[k+8>>2];Gq(k|0,0,12)|0;i=f;return}function Ch(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;f=i;i=i+32|0;g=d;d=i;i=i+8|0;c[d>>2]=c[g>>2];c[d+4>>2]=c[g+4>>2];g=f|0;h=f+16|0;j=Eq(e|0)|0;if(j>>>0>4294967279>>>0){Gh(0)}if(j>>>0<11>>>0){a[h]=j<<1;k=h+1|0}else{l=j+16&-16;m=mq(l)|0;c[h+8>>2]=m;c[h>>2]=l|1;c[h+4>>2]=j;k=m}Fq(k|0,e|0,j)|0;a[k+j|0]=0;Bh(g,d,h);qh(b|0,g);if(!((a[g]&1)==0)){oq(c[g+8>>2]|0)}if((a[h]&1)==0){n=b|0;c[n>>2]=17376;o=b+8|0;p=d;q=o;r=p|0;s=c[r>>2]|0;t=p+4|0;u=c[t>>2]|0;v=q|0;c[v>>2]=s;w=q+4|0;c[w>>2]=u;i=f;return}oq(c[h+8>>2]|0);n=b|0;c[n>>2]=17376;o=b+8|0;p=d;q=o;r=p|0;s=c[r>>2]|0;t=p+4|0;u=c[t>>2]|0;v=q|0;c[v>>2]=s;w=q+4|0;c[w>>2]=u;i=f;return}function Dh(a){a=a|0;th(a|0);oq(a);return}function Eh(a){a=a|0;th(a|0);return}function Fh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e;if((c[a>>2]|0)==1){do{Ya(26920,26896)|0;}while((c[a>>2]|0)==1)}if((c[a>>2]|0)!=0){f;return}c[a>>2]=1;g;Hc[d&511](b);h;c[a>>2]=-1;i;Vb(26920)|0;return}function Gh(a){a=a|0;a=vc(8)|0;mh(a,12336);c[a>>2]=15120;Jb(a|0,21328,36)}function Hh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=d;if((a[e]&1)==0){f=b;c[f>>2]=c[e>>2];c[f+4>>2]=c[e+4>>2];c[f+8>>2]=c[e+8>>2];return}e=c[d+8>>2]|0;f=c[d+4>>2]|0;if(f>>>0>4294967279>>>0){Gh(0)}if(f>>>0<11>>>0){a[b]=f<<1;g=b+1|0}else{d=f+16&-16;h=mq(d)|0;c[b+8>>2]=h;c[b>>2]=d|1;c[b+4>>2]=f;g=h}Fq(g|0,e|0,f)|0;a[g+f|0]=0;return}function Ih(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;if(e>>>0>4294967279>>>0){Gh(0)}if(e>>>0<11>>>0){a[b]=e<<1;f=b+1|0;Fq(f|0,d|0,e)|0;g=f+e|0;a[g]=0;return}else{h=e+16&-16;i=mq(h)|0;c[b+8>>2]=i;c[b>>2]=h|1;c[b+4>>2]=e;f=i;Fq(f|0,d|0,e)|0;g=f+e|0;a[g]=0;return}}function Jh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;if(d>>>0>4294967279>>>0){Gh(0)}if(d>>>0<11>>>0){a[b]=d<<1;f=b+1|0;Gq(f|0,e|0,d|0)|0;g=f+d|0;a[g]=0;return}else{h=d+16&-16;i=mq(h)|0;c[b+8>>2]=i;c[b>>2]=h|1;c[b+4>>2]=d;f=i;Gq(f|0,e|0,d|0)|0;g=f+d|0;a[g]=0;return}}function Kh(b){b=b|0;if((a[b]&1)==0){return}oq(c[b+8>>2]|0);return}function Lh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;if((b|0)==(d|0)){return b|0}e=a[d]|0;if((e&1)==0){f=(e&255)>>>1;g=d+1|0}else{f=c[d+4>>2]|0;g=c[d+8>>2]|0}d=b;e=a[d]|0;if((e&1)==0){h=10;i=e}else{e=c[b>>2]|0;h=(e&-2)-1|0;i=e&255}e=(i&1)==0;if(h>>>0<f>>>0){if(e){j=(i&255)>>>1}else{j=c[b+4>>2]|0}Sh(b,h,f-h|0,j,0,j,f,g);return b|0}if(e){k=b+1|0}else{k=c[b+8>>2]|0}Hq(k|0,g|0,f|0)|0;a[k+f|0]=0;if((a[d]&1)==0){a[d]=f<<1;return b|0}else{c[b+4>>2]=f;return b|0}return 0}function Mh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=Eq(d|0)|0;f=b;g=a[f]|0;if((g&1)==0){h=10;i=g}else{g=c[b>>2]|0;h=(g&-2)-1|0;i=g&255}g=(i&1)==0;if(h>>>0<e>>>0){if(g){j=(i&255)>>>1}else{j=c[b+4>>2]|0}Sh(b,h,e-h|0,j,0,j,e,d);return b|0}if(g){k=b+1|0}else{k=c[b+8>>2]|0}Hq(k|0,d|0,e|0)|0;a[k+e|0]=0;if((a[f]&1)==0){a[f]=e<<1;return b|0}else{c[b+4>>2]=e;return b|0}return 0}function Nh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=b;g=a[f]|0;h=(g&1)==0;if(h){i=(g&255)>>>1}else{i=c[b+4>>2]|0}if(i>>>0<d>>>0){Oh(b,d-i|0,e)|0;return}if(h){a[b+1+d|0]=0;a[f]=d<<1;return}else{a[(c[b+8>>2]|0)+d|0]=0;c[b+4>>2]=d;return}}function Oh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0;if((d|0)==0){return b|0}f=b;g=a[f]|0;if((g&1)==0){h=10;i=g}else{g=c[b>>2]|0;h=(g&-2)-1|0;i=g&255}if((i&1)==0){j=(i&255)>>>1}else{j=c[b+4>>2]|0}if((h-j|0)>>>0<d>>>0){Th(b,h,d-h+j|0,j,j,0,0);k=a[f]|0}else{k=i}if((k&1)==0){l=b+1|0}else{l=c[b+8>>2]|0}Gq(l+j|0,e|0,d|0)|0;e=j+d|0;if((a[f]&1)==0){a[f]=e<<1}else{c[b+4>>2]=e}a[l+e|0]=0;return b|0}function Ph(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;if(d>>>0>4294967279>>>0){Gh(0)}e=b;f=a[e]|0;if((f&1)==0){g=10;h=f}else{f=c[b>>2]|0;g=(f&-2)-1|0;h=f&255}if((h&1)==0){i=(h&255)>>>1}else{i=c[b+4>>2]|0}f=i>>>0>d>>>0?i:d;if(f>>>0<11>>>0){j=10}else{j=(f+16&-16)-1|0}if((j|0)==(g|0)){return}do{if((j|0)==10){k=b+1|0;l=c[b+8>>2]|0;m=1;n=0}else{f=j+1|0;if(j>>>0>g>>>0){o=mq(f)|0}else{o=mq(f)|0}if((h&1)==0){k=o;l=b+1|0;m=0;n=1;break}else{k=o;l=c[b+8>>2]|0;m=1;n=1;break}}}while(0);if((h&1)==0){p=(h&255)>>>1}else{p=c[b+4>>2]|0}Fq(k|0,l|0,p+1|0)|0;if(m){oq(l)}if(n){c[b>>2]=j+1|1;c[b+4>>2]=i;c[b+8>>2]=k;return}else{a[e]=i<<1;return}}function Qh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;e=b;f=a[e]|0;g=(f&1)!=0;if(g){h=c[b+4>>2]|0;i=(c[b>>2]&-2)-1|0}else{h=(f&255)>>>1;i=10}if((h|0)==(i|0)){Th(b,i,1,i,i,0,0);if((a[e]&1)==0){j=7}else{j=8}}else{if(g){j=8}else{j=7}}if((j|0)==7){a[e]=(h<<1)+2;k=b+1|0;l=h+1|0;m=k+h|0;a[m]=d;n=k+l|0;a[n]=0;return}else if((j|0)==8){j=c[b+8>>2]|0;e=h+1|0;c[b+4>>2]=e;k=j;l=e;m=k+h|0;a[m]=d;n=k+l|0;a[n]=0;return}}function Rh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;f=b;g=a[f]|0;if((g&1)==0){h=10;i=g}else{g=c[b>>2]|0;h=(g&-2)-1|0;i=g&255}if((i&1)==0){j=(i&255)>>>1}else{j=c[b+4>>2]|0}if((h-j|0)>>>0<e>>>0){Sh(b,h,e-h+j|0,j,j,0,e,d);return b|0}if((e|0)==0){return b|0}if((i&1)==0){k=b+1|0}else{k=c[b+8>>2]|0}Fq(k+j|0,d|0,e)|0;d=j+e|0;if((a[f]&1)==0){a[f]=d<<1}else{c[b+4>>2]=d}a[k+d|0]=0;return b|0}function Sh(b,d,e,f,g,h,i,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;if((-18-d|0)>>>0<e>>>0){Gh(0)}if((a[b]&1)==0){k=b+1|0}else{k=c[b+8>>2]|0}do{if(d>>>0<2147483623>>>0){l=e+d|0;m=d<<1;n=l>>>0<m>>>0?m:l;if(n>>>0<11>>>0){o=11;break}o=n+16&-16}else{o=-17}}while(0);e=mq(o)|0;if((g|0)!=0){Fq(e|0,k|0,g)|0}if((i|0)!=0){Fq(e+g|0,j|0,i)|0}j=f-h|0;if((j|0)!=(g|0)){Fq(e+(i+g)|0,k+(h+g)|0,j-g|0)|0}if((d|0)==10){p=b+8|0;c[p>>2]=e;q=o|1;r=b|0;c[r>>2]=q;s=j+i|0;t=b+4|0;c[t>>2]=s;u=e+s|0;a[u]=0;return}oq(k);p=b+8|0;c[p>>2]=e;q=o|1;r=b|0;c[r>>2]=q;s=j+i|0;t=b+4|0;c[t>>2]=s;u=e+s|0;a[u]=0;return}function Th(b,d,e,f,g,h,i){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;if((-17-d|0)>>>0<e>>>0){Gh(0)}if((a[b]&1)==0){j=b+1|0}else{j=c[b+8>>2]|0}do{if(d>>>0<2147483623>>>0){k=e+d|0;l=d<<1;m=k>>>0<l>>>0?l:k;if(m>>>0<11>>>0){n=11;break}n=m+16&-16}else{n=-17}}while(0);e=mq(n)|0;if((g|0)!=0){Fq(e|0,j|0,g)|0}m=f-h|0;if((m|0)!=(g|0)){Fq(e+(i+g)|0,j+(h+g)|0,m-g|0)|0}if((d|0)==10){o=b+8|0;c[o>>2]=e;p=n|1;q=b|0;c[q>>2]=p;return}oq(j);o=b+8|0;c[o>>2]=e;p=n|1;q=b|0;c[q>>2]=p;return}function Uh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;if(e>>>0>1073741807>>>0){Gh(0)}if(e>>>0<2>>>0){a[b]=e<<1;f=b+4|0;g=Ip(f,d,e)|0;h=f+(e<<2)|0;c[h>>2]=0;return}else{i=e+4&-4;j=mq(i<<2)|0;c[b+8>>2]=j;c[b>>2]=i|1;c[b+4>>2]=e;f=j;g=Ip(f,d,e)|0;h=f+(e<<2)|0;c[h>>2]=0;return}}function Vh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;if(d>>>0>1073741807>>>0){Gh(0)}if(d>>>0<2>>>0){a[b]=d<<1;f=b+4|0;g=Kp(f,e,d)|0;h=f+(d<<2)|0;c[h>>2]=0;return}else{i=d+4&-4;j=mq(i<<2)|0;c[b+8>>2]=j;c[b>>2]=i|1;c[b+4>>2]=d;f=j;g=Kp(f,e,d)|0;h=f+(d<<2)|0;c[h>>2]=0;return}}function Wh(b){b=b|0;if((a[b]&1)==0){return}oq(c[b+8>>2]|0);return}function Xh(a,b){a=a|0;b=b|0;return Yh(a,b,Hp(b)|0)|0}function Yh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;f=b;g=a[f]|0;if((g&1)==0){h=1;i=g}else{g=c[b>>2]|0;h=(g&-2)-1|0;i=g&255}g=(i&1)==0;if(h>>>0<e>>>0){if(g){j=(i&255)>>>1}else{j=c[b+4>>2]|0}$h(b,h,e-h|0,j,0,j,e,d);return b|0}if(g){k=b+4|0}else{k=c[b+8>>2]|0}Jp(k,d,e)|0;c[k+(e<<2)>>2]=0;if((a[f]&1)==0){a[f]=e<<1;return b|0}else{c[b+4>>2]=e;return b|0}return 0}function Zh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;if(d>>>0>1073741807>>>0){Gh(0)}e=b;f=a[e]|0;if((f&1)==0){g=1;h=f}else{f=c[b>>2]|0;g=(f&-2)-1|0;h=f&255}if((h&1)==0){i=(h&255)>>>1}else{i=c[b+4>>2]|0}f=i>>>0>d>>>0?i:d;if(f>>>0<2>>>0){j=1}else{j=(f+4&-4)-1|0}if((j|0)==(g|0)){return}do{if((j|0)==1){k=b+4|0;l=c[b+8>>2]|0;m=1;n=0}else{f=(j<<2)+4|0;if(j>>>0>g>>>0){o=mq(f)|0}else{o=mq(f)|0}f=o;if((h&1)==0){k=f;l=b+4|0;m=0;n=1;break}else{k=f;l=c[b+8>>2]|0;m=1;n=1;break}}}while(0);if((h&1)==0){p=(h&255)>>>1}else{p=c[b+4>>2]|0}Ip(k,l,p+1|0)|0;if(m){oq(l)}if(n){c[b>>2]=j+1|1;c[b+4>>2]=i;c[b+8>>2]=k;return}else{a[e]=i<<1;return}}function _h(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;e=b;f=a[e]|0;g=(f&1)!=0;if(g){h=c[b+4>>2]|0;i=(c[b>>2]&-2)-1|0}else{h=(f&255)>>>1;i=1}if((h|0)==(i|0)){ai(b,i,1,i,i,0,0);if((a[e]&1)==0){j=7}else{j=8}}else{if(g){j=8}else{j=7}}if((j|0)==7){a[e]=(h<<1)+2;k=b+4|0;l=h+1|0;m=k+(h<<2)|0;c[m>>2]=d;n=k+(l<<2)|0;c[n>>2]=0;return}else if((j|0)==8){j=c[b+8>>2]|0;e=h+1|0;c[b+4>>2]=e;k=j;l=e;m=k+(h<<2)|0;c[m>>2]=d;n=k+(l<<2)|0;c[n>>2]=0;return}}function $h(b,d,e,f,g,h,i,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;if((1073741806-d|0)>>>0<e>>>0){Gh(0)}if((a[b]&1)==0){k=b+4|0}else{k=c[b+8>>2]|0}do{if(d>>>0<536870887>>>0){l=e+d|0;m=d<<1;n=l>>>0<m>>>0?m:l;if(n>>>0<2>>>0){o=2;break}o=n+4&-4}else{o=1073741807}}while(0);e=mq(o<<2)|0;if((g|0)!=0){Ip(e,k,g)|0}if((i|0)!=0){Ip(e+(g<<2)|0,j,i)|0}j=f-h|0;if((j|0)!=(g|0)){Ip(e+(i+g<<2)|0,k+(h+g<<2)|0,j-g|0)|0}if((d|0)==1){p=b+8|0;c[p>>2]=e;q=o|1;r=b|0;c[r>>2]=q;s=j+i|0;t=b+4|0;c[t>>2]=s;u=e+(s<<2)|0;c[u>>2]=0;return}oq(k);p=b+8|0;c[p>>2]=e;q=o|1;r=b|0;c[r>>2]=q;s=j+i|0;t=b+4|0;c[t>>2]=s;u=e+(s<<2)|0;c[u>>2]=0;return}function ai(b,d,e,f,g,h,i){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;if((1073741807-d|0)>>>0<e>>>0){Gh(0)}if((a[b]&1)==0){j=b+4|0}else{j=c[b+8>>2]|0}do{if(d>>>0<536870887>>>0){k=e+d|0;l=d<<1;m=k>>>0<l>>>0?l:k;if(m>>>0<2>>>0){n=2;break}n=m+4&-4}else{n=1073741807}}while(0);e=mq(n<<2)|0;if((g|0)!=0){Ip(e,j,g)|0}m=f-h|0;if((m|0)!=(g|0)){Ip(e+(i+g<<2)|0,j+(h+g<<2)|0,m-g|0)|0}if((d|0)==1){o=b+8|0;c[o>>2]=e;p=n|1;q=b|0;c[q>>2]=p;return}oq(j);o=b+8|0;c[o>>2]=e;p=n|1;q=b|0;c[q>>2]=p;return}function bi(b,d){b=b|0;d=d|0;var e=0,f=0,g=0;e=i;i=i+8|0;f=e|0;g=(c[b+24>>2]|0)==0;if(g){c[b+16>>2]=d|1}else{c[b+16>>2]=d}if(((g&1|d)&c[b+20>>2]|0)==0){i=e;return}e=vc(16)|0;do{if((a[28040]|0)==0){if((wb(28040)|0)==0){break}c[6512]=16616;fb(76,26048,t|0)|0}}while(0);b=Kq(26048,0,32)|0;c[f>>2]=b&0|1;c[f+4>>2]=J|0;Ch(e,f,9288);c[e>>2]=15800;Jb(e|0,21872,32)}function ci(a){a=a|0;var b=0,d=0,e=0,f=0;c[a>>2]=15776;b=c[a+40>>2]|0;d=a+32|0;e=a+36|0;if((b|0)!=0){f=b;do{f=f-1|0;Nc[c[(c[d>>2]|0)+(f<<2)>>2]&7](0,a,c[(c[e>>2]|0)+(f<<2)>>2]|0);}while((f|0)!=0)}rn(a+28|0);gq(c[d>>2]|0);gq(c[e>>2]|0);gq(c[a+48>>2]|0);gq(c[a+60>>2]|0);return}function di(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=c[a+40>>2]|0;if((d|0)==0){return}e=a+32|0;f=a+36|0;g=d;do{g=g-1|0;Nc[c[(c[e>>2]|0)+(g<<2)>>2]&7](b,a,c[(c[f>>2]|0)+(g<<2)>>2]|0);}while((g|0)!=0);return}function ei(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;d=a+44|0;e=b+40|0;f=c[e>>2]|0;do{if((c[d>>2]|0)>>>0<f>>>0){g=f<<2;h=fq(g)|0;if((h|0)==0){i=vc(4)|0;qq(i);Jb(i|0,21280,140)}i=fq(g)|0;if((i|0)!=0){j=i;k=h;break}h=vc(4)|0;qq(h);Jb(h|0,21280,140)}else{j=0;k=0}}while(0);f=a+56|0;h=b+52|0;i=c[h>>2]|0;do{if((c[f>>2]|0)>>>0<i>>>0){g=fq(i<<2)|0;if((g|0)!=0){l=g;break}g=vc(4)|0;qq(g);Jb(g|0,21280,140)}else{l=0}}while(0);i=a+68|0;g=b+64|0;m=c[g>>2]|0;do{if((c[i>>2]|0)>>>0<m>>>0){n=fq(m<<2)|0;if((n|0)!=0){o=n;break}n=vc(4)|0;qq(n);Jb(n|0,21280,140)}else{o=0}}while(0);c[a+4>>2]=c[b+4>>2];c[a+8>>2]=c[b+8>>2];c[a+12>>2]=c[b+12>>2];sn(a+28|0,b+28|0)|0;if((c[d>>2]|0)>>>0<(c[e>>2]|0)>>>0){m=a+32|0;gq(c[m>>2]|0);c[m>>2]=k;m=a+36|0;gq(c[m>>2]|0);c[m>>2]=j;c[d>>2]=c[e>>2];p=0;q=0}else{p=j;q=k}k=a+40|0;c[k>>2]=0;if((c[e>>2]|0)!=0){j=b+32|0;d=a+32|0;m=b+36|0;n=a+36|0;r=0;do{c[(c[d>>2]|0)+(r<<2)>>2]=c[(c[j>>2]|0)+(r<<2)>>2];c[(c[n>>2]|0)+(r<<2)>>2]=c[(c[m>>2]|0)+(r<<2)>>2];r=(c[k>>2]|0)+1|0;c[k>>2]=r;}while(r>>>0<(c[e>>2]|0)>>>0)}if((c[f>>2]|0)>>>0<(c[h>>2]|0)>>>0){e=a+48|0;gq(c[e>>2]|0);c[e>>2]=l;c[f>>2]=c[h>>2];s=0}else{s=l}l=a+52|0;c[l>>2]=0;if((c[h>>2]|0)!=0){f=c[b+48>>2]|0;e=c[a+48>>2]|0;r=0;do{c[e+(r<<2)>>2]=c[f+(r<<2)>>2];r=r+1|0;c[l>>2]=r;}while(r>>>0<(c[h>>2]|0)>>>0)}if((c[i>>2]|0)>>>0<(c[g>>2]|0)>>>0){h=a+60|0;gq(c[h>>2]|0);c[h>>2]=o;c[i>>2]=c[g>>2];t=0}else{t=o}o=a+64|0;c[o>>2]=0;if((c[g>>2]|0)!=0){i=b+60|0;b=a+60|0;a=0;do{c[(c[b>>2]|0)+(a<<2)>>2]=c[(c[i>>2]|0)+(a<<2)>>2];a=a+1|0;c[o>>2]=a;}while(a>>>0<(c[g>>2]|0)>>>0)}if((t|0)!=0){gq(t)}if((s|0)!=0){gq(s)}if((p|0)!=0){gq(p)}if((q|0)==0){return}gq(q);return}function fi(a,b){a=a|0;b=b|0;qn(a,b+28|0);return}function gi(a,b){a=a|0;b=b|0;c[a+24>>2]=b;c[a+16>>2]=(b|0)==0;c[a+20>>2]=0;c[a+4>>2]=4098;c[a+12>>2]=0;c[a+8>>2]=6;b=a+28|0;Gq(a+32|0,0,40)|0;if((b|0)==0){return}pn(b);return}function hi(a){a=a|0;c[a>>2]=16992;rn(a+4|0);oq(a);return}function ii(a){a=a|0;c[a>>2]=16992;rn(a+4|0);return}function ji(a,b){a=a|0;b=b|0;return}function ki(a,b,c){a=a|0;b=b|0;c=c|0;return a|0}function li(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;g=a;c[g>>2]=0;c[g+4>>2]=0;g=a+8|0;c[g>>2]=-1;c[g+4>>2]=-1;return}function mi(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;e=i;b=d;d=i;i=i+16|0;c[d>>2]=c[b>>2];c[d+4>>2]=c[b+4>>2];c[d+8>>2]=c[b+8>>2];c[d+12>>2]=c[b+12>>2];b=a;c[b>>2]=0;c[b+4>>2]=0;b=a+8|0;c[b>>2]=-1;c[b+4>>2]=-1;i=e;return}function ni(a){a=a|0;return 0}function oi(a){a=a|0;return 0}function pi(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;f=b;if((e|0)<=0){g=0;return g|0}h=b+12|0;i=b+16|0;j=d;d=0;while(1){k=c[h>>2]|0;if(k>>>0<(c[i>>2]|0)>>>0){c[h>>2]=k+1;l=a[k]|0}else{k=Mc[c[(c[f>>2]|0)+40>>2]&255](b)|0;if((k|0)==-1){g=d;m=8;break}l=k&255}a[j]=l;k=d+1|0;if((k|0)<(e|0)){j=j+1|0;d=k}else{g=k;m=8;break}}if((m|0)==8){return g|0}return 0}function qi(a){a=a|0;return-1|0}function ri(a){a=a|0;var b=0,e=0;if((Mc[c[(c[a>>2]|0)+36>>2]&255](a)|0)==-1){b=-1;return b|0}e=a+12|0;a=c[e>>2]|0;c[e>>2]=a+1;b=d[a]|0;return b|0}function si(a,b){a=a|0;b=b|0;return-1|0}function ti(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=b;if((f|0)<=0){h=0;return h|0}i=b+24|0;j=b+28|0;k=0;l=e;while(1){e=c[i>>2]|0;if(e>>>0<(c[j>>2]|0)>>>0){m=a[l]|0;c[i>>2]=e+1;a[e]=m}else{if((Jc[c[(c[g>>2]|0)+52>>2]&63](b,d[l]|0)|0)==-1){h=k;n=7;break}}m=k+1|0;if((m|0)<(f|0)){k=m;l=l+1|0}else{h=m;n=7;break}}if((n|0)==7){return h|0}return 0}function ui(a,b){a=a|0;b=b|0;return-1|0}function vi(a){a=a|0;c[a>>2]=16920;rn(a+4|0);oq(a);return}function wi(a){a=a|0;c[a>>2]=16920;rn(a+4|0);return}function xi(a,b){a=a|0;b=b|0;return}function yi(a,b,c){a=a|0;b=b|0;c=c|0;return a|0}function zi(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;g=a;c[g>>2]=0;c[g+4>>2]=0;g=a+8|0;c[g>>2]=-1;c[g+4>>2]=-1;return}function Ai(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;e=i;b=d;d=i;i=i+16|0;c[d>>2]=c[b>>2];c[d+4>>2]=c[b+4>>2];c[d+8>>2]=c[b+8>>2];c[d+12>>2]=c[b+12>>2];b=a;c[b>>2]=0;c[b+4>>2]=0;b=a+8|0;c[b>>2]=-1;c[b+4>>2]=-1;i=e;return}function Bi(a){a=a|0;return 0}function Ci(a){a=a|0;return 0}function Di(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;e=a;if((d|0)<=0){f=0;return f|0}g=a+12|0;h=a+16|0;i=b;b=0;while(1){j=c[g>>2]|0;if(j>>>0<(c[h>>2]|0)>>>0){c[g>>2]=j+4;k=c[j>>2]|0}else{j=Mc[c[(c[e>>2]|0)+40>>2]&255](a)|0;if((j|0)==-1){f=b;l=7;break}else{k=j}}c[i>>2]=k;j=b+1|0;if((j|0)<(d|0)){i=i+4|0;b=j}else{f=j;l=7;break}}if((l|0)==7){return f|0}return 0}function Ei(a){a=a|0;return-1|0}function Fi(a){a=a|0;var b=0,d=0;if((Mc[c[(c[a>>2]|0)+36>>2]&255](a)|0)==-1){b=-1;return b|0}d=a+12|0;a=c[d>>2]|0;c[d>>2]=a+4;b=c[a>>2]|0;return b|0}function Gi(a,b){a=a|0;b=b|0;return-1|0}function Hi(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;e=a;if((d|0)<=0){f=0;return f|0}g=a+24|0;h=a+28|0;i=0;j=b;while(1){b=c[g>>2]|0;if(b>>>0<(c[h>>2]|0)>>>0){k=c[j>>2]|0;c[g>>2]=b+4;c[b>>2]=k}else{if((Jc[c[(c[e>>2]|0)+52>>2]&63](a,c[j>>2]|0)|0)==-1){f=i;l=8;break}}k=i+1|0;if((k|0)>=(d|0)){f=k;l=8;break}i=k;j=j+4|0}if((l|0)==8){return f|0}return 0}function Ii(a,b){a=a|0;b=b|0;return-1|0}function Ji(a){a=a|0;ci(a+8|0);oq(a);return}function Ki(a){a=a|0;ci(a+8|0);return}function Li(a){a=a|0;var b=0,d=0;b=a;d=c[(c[a>>2]|0)-12>>2]|0;ci(b+(d+8)|0);oq(b+d|0);return}function Mi(a){a=a|0;ci(a+((c[(c[a>>2]|0)-12>>2]|0)+8)|0);return}function Ni(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0;d=i;i=i+8|0;e=d|0;f=b;g=c[(c[f>>2]|0)-12>>2]|0;h=b;if((c[h+(g+24)>>2]|0)==0){i=d;return b|0}j=e|0;a[j]=0;c[e+4>>2]=b;do{if((c[h+(g+16)>>2]|0)==0){k=c[h+(g+72)>>2]|0;if((k|0)==0){l=g}else{Ni(k)|0;l=c[(c[f>>2]|0)-12>>2]|0}a[j]=1;k=c[h+(l+24)>>2]|0;if(!((Mc[c[(c[k>>2]|0)+24>>2]&255](k)|0)==-1)){break}k=c[(c[f>>2]|0)-12>>2]|0;bi(h+k|0,c[h+(k+16)>>2]|1)}}while(0);Yi(e);i=d;return b|0}function Oi(a){a=a|0;var b=0;b=a+16|0;c[b>>2]=c[b>>2]|1;if((c[a+20>>2]&1|0)==0){return}else{Za()}}function Pi(a){a=a|0;ci(a+8|0);oq(a);return}function Qi(a){a=a|0;ci(a+8|0);return}function Ri(a){a=a|0;var b=0,d=0;b=a;d=c[(c[a>>2]|0)-12>>2]|0;ci(b+(d+8)|0);oq(b+d|0);return}function Si(a){a=a|0;ci(a+((c[(c[a>>2]|0)-12>>2]|0)+8)|0);return}function Ti(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0;d=i;i=i+8|0;e=d|0;f=b;g=c[(c[f>>2]|0)-12>>2]|0;h=b;if((c[h+(g+24)>>2]|0)==0){i=d;return b|0}j=e|0;a[j]=0;c[e+4>>2]=b;do{if((c[h+(g+16)>>2]|0)==0){k=c[h+(g+72)>>2]|0;if((k|0)==0){l=g}else{Ti(k)|0;l=c[(c[f>>2]|0)-12>>2]|0}a[j]=1;k=c[h+(l+24)>>2]|0;if(!((Mc[c[(c[k>>2]|0)+24>>2]&255](k)|0)==-1)){break}k=c[(c[f>>2]|0)-12>>2]|0;bi(h+k|0,c[h+(k+16)>>2]|1)}}while(0);dj(e);i=d;return b|0}function Ui(a){a=a|0;ci(a+4|0);oq(a);return}function Vi(a){a=a|0;ci(a+4|0);return}function Wi(a){a=a|0;var b=0,d=0;b=a;d=c[(c[a>>2]|0)-12>>2]|0;ci(b+(d+4)|0);oq(b+d|0);return}function Xi(a){a=a|0;ci(a+((c[(c[a>>2]|0)-12>>2]|0)+4)|0);return}function Yi(a){a=a|0;var b=0,d=0,e=0;b=a+4|0;a=c[b>>2]|0;d=c[(c[a>>2]|0)-12>>2]|0;e=a;if((c[e+(d+24)>>2]|0)==0){return}if((c[e+(d+16)>>2]|0)!=0){return}if((c[e+(d+4)>>2]&8192|0)==0){return}if(Bb()|0){return}d=c[b>>2]|0;e=c[d+((c[(c[d>>2]|0)-12>>2]|0)+24)>>2]|0;if(!((Mc[c[(c[e>>2]|0)+24>>2]&255](e)|0)==-1)){return}e=c[b>>2]|0;b=c[(c[e>>2]|0)-12>>2]|0;d=e;bi(d+b|0,c[d+(b+16)>>2]|1);return}function Zi(b,d){b=b|0;d=+d;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;e=i;i=i+40|0;f=e|0;g=e+8|0;h=e+16|0;j=e+24|0;k=e+32|0;l=h|0;a[l]=0;c[h+4>>2]=b;m=b;n=c[(c[m>>2]|0)-12>>2]|0;o=b;do{if((c[o+(n+16)>>2]|0)==0){p=c[o+(n+72)>>2]|0;if((p|0)==0){q=n}else{Ni(p)|0;q=c[(c[m>>2]|0)-12>>2]|0}a[l]=1;qn(j,o+(q+28)|0);p=un(j,27120)|0;rn(j);r=c[(c[m>>2]|0)-12>>2]|0;s=c[o+(r+24)>>2]|0;t=o+(r+76)|0;u=c[t>>2]|0;if((u|0)==-1){qn(g,o+(r+28)|0);v=un(g,27472)|0;w=Jc[c[(c[v>>2]|0)+28>>2]&63](v,32)|0;rn(g);c[t>>2]=w<<24>>24;x=w}else{x=u&255}u=c[(c[p>>2]|0)+32>>2]|0;c[f>>2]=s;Oc[u&15](k,p,f,o+r|0,x,d);if((c[k>>2]|0)!=0){break}r=c[(c[m>>2]|0)-12>>2]|0;bi(o+r|0,c[o+(r+16)>>2]|5)}}while(0);Yi(h);i=e;return b|0}function _i(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;e=i;i=i+8|0;f=e|0;g=f|0;a[g]=0;c[f+4>>2]=b;h=b;j=c[h>>2]|0;k=c[j-12>>2]|0;l=b;do{if((c[l+(k+16)>>2]|0)==0){m=c[l+(k+72)>>2]|0;if((m|0)==0){n=j;o=k}else{Ni(m)|0;m=c[h>>2]|0;n=m;o=c[m-12>>2]|0}a[g]=1;m=c[l+(o+24)>>2]|0;p=m;if((m|0)==0){q=n}else{r=m+24|0;s=c[r>>2]|0;if((s|0)!=(c[m+28>>2]|0)){c[r>>2]=s+1;a[s]=d;break}if(!((Jc[c[(c[m>>2]|0)+52>>2]&63](p,d&255)|0)==-1)){break}q=c[h>>2]|0}p=c[q-12>>2]|0;bi(l+p|0,c[l+(p+16)>>2]|1)}}while(0);Yi(f);i=e;return b|0}function $i(a){a=a|0;ci(a+4|0);oq(a);return}function aj(a){a=a|0;ci(a+4|0);return}function bj(a){a=a|0;var b=0,d=0;b=a;d=c[(c[a>>2]|0)-12>>2]|0;ci(b+(d+4)|0);oq(b+d|0);return}function cj(a){a=a|0;ci(a+((c[(c[a>>2]|0)-12>>2]|0)+4)|0);return}function dj(a){a=a|0;var b=0,d=0,e=0;b=a+4|0;a=c[b>>2]|0;d=c[(c[a>>2]|0)-12>>2]|0;e=a;if((c[e+(d+24)>>2]|0)==0){return}if((c[e+(d+16)>>2]|0)!=0){return}if((c[e+(d+4)>>2]&8192|0)==0){return}if(Bb()|0){return}d=c[b>>2]|0;e=c[d+((c[(c[d>>2]|0)-12>>2]|0)+24)>>2]|0;if(!((Mc[c[(c[e>>2]|0)+24>>2]&255](e)|0)==-1)){return}e=c[b>>2]|0;b=c[(c[e>>2]|0)-12>>2]|0;d=e;bi(d+b|0,c[d+(b+16)>>2]|1);return}function ej(a){a=a|0;return 10456}function fj(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)==1){Ih(a,12440,35);return}else{Ah(a,b|0,c);return}}function gj(a){a=a|0;wh(a|0);return}function hj(a){a=a|0;Eh(a|0);oq(a);return}function ij(a){a=a|0;Eh(a|0);return}function jj(a){a=a|0;ci(a);oq(a);return}function kj(a){a=a|0;wh(a|0);oq(a);return}function lj(a){a=a|0;jh(a|0);oq(a);return}function mj(a){a=a|0;jh(a|0);return}function nj(a){a=a|0;jh(a|0);return}function oj(b,c,d,e,f){b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0;a:do{if((e|0)==(f|0)){g=c}else{b=c;h=e;while(1){if((b|0)==(d|0)){i=-1;j=7;break}k=a[b]|0;l=a[h]|0;if(k<<24>>24<l<<24>>24){i=-1;j=7;break}if(l<<24>>24<k<<24>>24){i=1;j=7;break}k=b+1|0;l=h+1|0;if((l|0)==(f|0)){g=k;break a}else{b=k;h=l}}if((j|0)==7){return i|0}}}while(0);i=(g|0)!=(d|0)|0;return i|0}function pj(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;d=e;g=f-d|0;if(g>>>0>4294967279>>>0){Gh(b)}if(g>>>0<11>>>0){a[b]=g<<1;h=b+1|0}else{i=g+16&-16;j=mq(i)|0;c[b+8>>2]=j;c[b>>2]=i|1;c[b+4>>2]=g;h=j}if((e|0)==(f|0)){k=h;a[k]=0;return}else{l=h;m=e}while(1){a[l]=a[m]|0;e=m+1|0;if((e|0)==(f|0)){break}else{l=l+1|0;m=e}}k=h+(f+(-d|0))|0;a[k]=0;return}function qj(b,c,d){b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0;if((c|0)==(d|0)){e=0;return e|0}else{f=c;g=0}while(1){c=(a[f]|0)+(g<<4)|0;b=c&-268435456;h=(b>>>24|b)^c;c=f+1|0;if((c|0)==(d|0)){e=h;break}else{f=c;g=h}}return e|0}function rj(a){a=a|0;jh(a|0);oq(a);return}function sj(a){a=a|0;jh(a|0);return}function tj(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0;a:do{if((e|0)==(f|0)){g=b}else{a=b;h=e;while(1){if((a|0)==(d|0)){i=-1;j=7;break}k=c[a>>2]|0;l=c[h>>2]|0;if((k|0)<(l|0)){i=-1;j=7;break}if((l|0)<(k|0)){i=1;j=7;break}k=a+4|0;l=h+4|0;if((l|0)==(f|0)){g=k;break a}else{a=k;h=l}}if((j|0)==7){return i|0}}}while(0);i=(g|0)!=(d|0)|0;return i|0}function uj(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0;d=e;g=f-d|0;h=g>>2;if(h>>>0>1073741807>>>0){Gh(b)}if(h>>>0<2>>>0){a[b]=g>>>1;i=b+4|0}else{g=h+4&-4;j=mq(g<<2)|0;c[b+8>>2]=j;c[b>>2]=g|1;c[b+4>>2]=h;i=j}if((e|0)==(f|0)){k=i;c[k>>2]=0;return}j=f-4+(-d|0)|0;d=i;h=e;while(1){c[d>>2]=c[h>>2];e=h+4|0;if((e|0)==(f|0)){break}else{d=d+4|0;h=e}}k=i+((j>>>2)+1<<2)|0;c[k>>2]=0;return}function vj(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;if((b|0)==(d|0)){e=0;return e|0}else{f=b;g=0}while(1){b=(c[f>>2]|0)+(g<<4)|0;a=b&-268435456;h=(a>>>24|a)^b;b=f+4|0;if((b|0)==(d|0)){e=h;break}else{f=b;g=h}}return e|0}function wj(a){a=a|0;jh(a|0);oq(a);return}function xj(a){a=a|0;jh(a|0);return}function yj(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;k=i;i=i+112|0;l=e;e=i;i=i+4|0;i=i+7&-8;c[e>>2]=c[l>>2];l=f;f=i;i=i+4|0;i=i+7&-8;c[f>>2]=c[l>>2];l=k|0;m=k+16|0;n=k+32|0;o=k+40|0;p=k+48|0;q=k+56|0;r=k+64|0;s=k+72|0;t=k+80|0;u=k+104|0;if((c[g+4>>2]&1|0)==0){c[n>>2]=-1;v=c[(c[d>>2]|0)+16>>2]|0;w=e|0;c[p>>2]=c[w>>2];c[q>>2]=c[f>>2];Gc[v&127](o,d,p,q,g,h,n);q=c[o>>2]|0;c[w>>2]=q;w=c[n>>2]|0;if((w|0)==0){a[j]=0}else if((w|0)==1){a[j]=1}else{a[j]=1;c[h>>2]=4}c[b>>2]=q;i=k;return}fi(r,g);q=r|0;r=c[q>>2]|0;if(!((c[6868]|0)==-1)){c[m>>2]=27472;c[m+4>>2]=14;c[m+8>>2]=0;Fh(27472,m,108)}m=(c[6869]|0)-1|0;w=c[r+8>>2]|0;do{if((c[r+12>>2]|0)-w>>2>>>0>m>>>0){n=c[w+(m<<2)>>2]|0;if((n|0)==0){break}o=n;lh(c[q>>2]|0)|0;fi(s,g);n=s|0;p=c[n>>2]|0;if(!((c[6772]|0)==-1)){c[l>>2]=27088;c[l+4>>2]=14;c[l+8>>2]=0;Fh(27088,l,108)}d=(c[6773]|0)-1|0;v=c[p+8>>2]|0;do{if((c[p+12>>2]|0)-v>>2>>>0>d>>>0){x=c[v+(d<<2)>>2]|0;if((x|0)==0){break}y=x;lh(c[n>>2]|0)|0;z=t|0;A=x;Ic[c[(c[A>>2]|0)+24>>2]&127](z,y);Ic[c[(c[A>>2]|0)+28>>2]&127](t+12|0,y);c[u>>2]=c[f>>2];a[j]=(zj(e,u,z,t+24|0,o,h,1)|0)==(z|0)|0;c[b>>2]=c[e>>2];Kh(t+12|0);Kh(t|0);i=k;return}}while(0);o=vc(4)|0;Mp(o);Jb(o|0,21296,148)}}while(0);k=vc(4)|0;Mp(k);Jb(k|0,21296,148)}function zj(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;k=i;i=i+104|0;l=d;d=i;i=i+4|0;i=i+7&-8;c[d>>2]=c[l>>2];l=(f-e|0)/12|0;m=k|0;do{if(l>>>0>100>>>0){n=fq(l)|0;if((n|0)!=0){o=n;p=n;break}uq();o=0;p=0}else{o=m;p=0}}while(0);m=(e|0)==(f|0);if(m){q=l;r=0}else{n=l;l=0;s=o;t=e;while(1){u=a[t]|0;if((u&1)==0){v=(u&255)>>>1}else{v=c[t+4>>2]|0}if((v|0)==0){a[s]=2;w=l+1|0;x=n-1|0}else{a[s]=1;w=l;x=n}u=t+12|0;if((u|0)==(f|0)){q=x;r=w;break}else{n=x;l=w;s=s+1|0;t=u}}}t=b|0;b=d|0;d=g;s=0;w=r;r=q;a:while(1){q=c[t>>2]|0;do{if((q|0)==0){y=0}else{if((c[q+12>>2]|0)!=(c[q+16>>2]|0)){y=q;break}if((Mc[c[(c[q>>2]|0)+36>>2]&255](q)|0)==-1){c[t>>2]=0;y=0;break}else{y=c[t>>2]|0;break}}}while(0);q=(y|0)==0;l=c[b>>2]|0;do{if((l|0)==0){z=0}else{if((c[l+12>>2]|0)!=(c[l+16>>2]|0)){z=l;break}if(!((Mc[c[(c[l>>2]|0)+36>>2]&255](l)|0)==-1)){z=l;break}c[b>>2]=0;z=0}}while(0);A=(z|0)==0;B=c[t>>2]|0;if(!((q^A)&(r|0)!=0)){break}l=c[B+12>>2]|0;if((l|0)==(c[B+16>>2]|0)){C=(Mc[c[(c[B>>2]|0)+36>>2]&255](B)|0)&255}else{C=a[l]|0}if(j){D=C}else{D=Jc[c[(c[d>>2]|0)+12>>2]&63](g,C)|0}l=s+1|0;if(m){s=l;w=w;r=r;continue}b:do{if(j){x=r;n=w;v=o;u=0;E=e;while(1){do{if((a[v]|0)==1){F=a[E]|0;G=(F&1)==0;if(G){H=E+1|0}else{H=c[E+8>>2]|0}if(!(D<<24>>24==(a[H+s|0]|0))){a[v]=0;I=u;J=n;K=x-1|0;break}if(G){L=(F&255)>>>1}else{L=c[E+4>>2]|0}if((L|0)!=(l|0)){I=1;J=n;K=x;break}a[v]=2;I=1;J=n+1|0;K=x-1|0}else{I=u;J=n;K=x}}while(0);F=E+12|0;if((F|0)==(f|0)){M=K;N=J;O=I;break b}x=K;n=J;v=v+1|0;u=I;E=F}}else{E=r;u=w;v=o;n=0;x=e;while(1){do{if((a[v]|0)==1){F=x;if((a[F]&1)==0){P=x+1|0}else{P=c[x+8>>2]|0}if(!(D<<24>>24==(Jc[c[(c[d>>2]|0)+12>>2]&63](g,a[P+s|0]|0)|0)<<24>>24)){a[v]=0;Q=n;R=u;S=E-1|0;break}G=a[F]|0;if((G&1)==0){T=(G&255)>>>1}else{T=c[x+4>>2]|0}if((T|0)!=(l|0)){Q=1;R=u;S=E;break}a[v]=2;Q=1;R=u+1|0;S=E-1|0}else{Q=n;R=u;S=E}}while(0);G=x+12|0;if((G|0)==(f|0)){M=S;N=R;O=Q;break b}E=S;u=R;v=v+1|0;n=Q;x=G}}}while(0);if(!O){s=l;w=N;r=M;continue}q=c[t>>2]|0;x=q+12|0;n=c[x>>2]|0;if((n|0)==(c[q+16>>2]|0)){Mc[c[(c[q>>2]|0)+40>>2]&255](q)|0}else{c[x>>2]=n+1}if((M+N|0)>>>0<2>>>0){s=l;w=N;r=M;continue}else{U=N;V=o;W=e}while(1){do{if((a[V]|0)==2){n=a[W]|0;if((n&1)==0){X=(n&255)>>>1}else{X=c[W+4>>2]|0}if((X|0)==(l|0)){Y=U;break}a[V]=0;Y=U-1|0}else{Y=U}}while(0);n=W+12|0;if((n|0)==(f|0)){s=l;w=Y;r=M;continue a}else{U=Y;V=V+1|0;W=n}}}do{if((B|0)==0){Z=0}else{if((c[B+12>>2]|0)!=(c[B+16>>2]|0)){Z=B;break}if((Mc[c[(c[B>>2]|0)+36>>2]&255](B)|0)==-1){c[t>>2]=0;Z=0;break}else{Z=c[t>>2]|0;break}}}while(0);t=(Z|0)==0;do{if(A){_=91}else{if((c[z+12>>2]|0)!=(c[z+16>>2]|0)){if(t){break}else{_=93;break}}if((Mc[c[(c[z>>2]|0)+36>>2]&255](z)|0)==-1){c[b>>2]=0;_=91;break}else{if(t){break}else{_=93;break}}}}while(0);if((_|0)==91){if(t){_=93}}if((_|0)==93){c[h>>2]=c[h>>2]|2}c:do{if(m){_=98}else{t=o;b=e;while(1){if((a[t]|0)==2){$=b;break c}z=b+12|0;if((z|0)==(f|0)){_=98;break c}t=t+1|0;b=z}}}while(0);if((_|0)==98){c[h>>2]=c[h>>2]|4;$=f}if((p|0)==0){i=k;return $|0}gq(p);i=k;return $|0}function Aj(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0;b=i;i=i+16|0;j=d;d=i;i=i+4|0;i=i+7&-8;c[d>>2]=c[j>>2];j=e;e=i;i=i+4|0;i=i+7&-8;c[e>>2]=c[j>>2];j=b|0;k=b+8|0;c[j>>2]=c[d>>2];c[k>>2]=c[e>>2];Bj(a,0,j,k,f,g,h);i=b;return}function Bj(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0;d=i;i=i+256|0;k=e;e=i;i=i+4|0;i=i+7&-8;c[e>>2]=c[k>>2];k=f;f=i;i=i+4|0;i=i+7&-8;c[f>>2]=c[k>>2];k=d|0;l=d+32|0;m=d+40|0;n=d+56|0;o=d+72|0;p=d+80|0;q=d+240|0;r=d+248|0;s=c[g+4>>2]&74;if((s|0)==0){t=0}else if((s|0)==64){t=8}else if((s|0)==8){t=16}else{t=10}s=k|0;rk(m,g,s,l);g=n;Gq(g|0,0,12)|0;Nh(n,10,0);if((a[g]&1)==0){k=n+1|0;u=k;v=k;w=n+8|0}else{k=n+8|0;u=c[k>>2]|0;v=n+1|0;w=k}c[o>>2]=u;k=p|0;c[q>>2]=k;c[r>>2]=0;x=e|0;e=f|0;f=n|0;y=n+4|0;z=a[l]|0;l=u;u=c[x>>2]|0;a:while(1){do{if((u|0)==0){A=0}else{if((c[u+12>>2]|0)!=(c[u+16>>2]|0)){A=u;break}if(!((Mc[c[(c[u>>2]|0)+36>>2]&255](u)|0)==-1)){A=u;break}c[x>>2]=0;A=0}}while(0);B=(A|0)==0;C=c[e>>2]|0;do{if((C|0)==0){D=21}else{if((c[C+12>>2]|0)!=(c[C+16>>2]|0)){if(B){E=C;break}else{F=l;G=C;break a}}if((Mc[c[(c[C>>2]|0)+36>>2]&255](C)|0)==-1){c[e>>2]=0;D=21;break}else{if(B){E=C;break}else{F=l;G=C;break a}}}}while(0);if((D|0)==21){D=0;if(B){F=l;G=0;break}else{E=0}}C=a[g]|0;H=(C&1)==0;if(H){I=(C&255)>>>1}else{I=c[y>>2]|0}if(((c[o>>2]|0)-l|0)==(I|0)){if(H){J=(C&255)>>>1;K=(C&255)>>>1}else{C=c[y>>2]|0;J=C;K=C}Nh(n,J<<1,0);if((a[g]&1)==0){L=10}else{L=(c[f>>2]&-2)-1|0}Nh(n,L,0);if((a[g]&1)==0){M=v}else{M=c[w>>2]|0}c[o>>2]=M+K;N=M}else{N=l}C=A+12|0;H=c[C>>2]|0;O=A+16|0;if((H|0)==(c[O>>2]|0)){P=(Mc[c[(c[A>>2]|0)+36>>2]&255](A)|0)&255}else{P=a[H]|0}if((Tj(P,t,N,o,r,z,m,k,q,s)|0)!=0){F=N;G=E;break}H=c[C>>2]|0;if((H|0)==(c[O>>2]|0)){Mc[c[(c[A>>2]|0)+40>>2]&255](A)|0;l=N;u=A;continue}else{c[C>>2]=H+1;l=N;u=A;continue}}u=a[m]|0;if((u&1)==0){Q=(u&255)>>>1}else{Q=c[m+4>>2]|0}do{if((Q|0)!=0){u=c[q>>2]|0;if((u-p|0)>=160){break}N=c[r>>2]|0;c[q>>2]=u+4;c[u>>2]=N}}while(0);c[j>>2]=qp(F,c[o>>2]|0,h,t)|0;Em(m,k,c[q>>2]|0,h);do{if((A|0)==0){R=0}else{if((c[A+12>>2]|0)!=(c[A+16>>2]|0)){R=A;break}if(!((Mc[c[(c[A>>2]|0)+36>>2]&255](A)|0)==-1)){R=A;break}c[x>>2]=0;R=0}}while(0);x=(R|0)==0;do{if((G|0)==0){D=66}else{if((c[G+12>>2]|0)!=(c[G+16>>2]|0)){if(!x){break}S=b|0;c[S>>2]=R;Kh(n);Kh(m);i=d;return}if((Mc[c[(c[G>>2]|0)+36>>2]&255](G)|0)==-1){c[e>>2]=0;D=66;break}if(!(x^(G|0)==0)){break}S=b|0;c[S>>2]=R;Kh(n);Kh(m);i=d;return}}while(0);do{if((D|0)==66){if(x){break}S=b|0;c[S>>2]=R;Kh(n);Kh(m);i=d;return}}while(0);c[h>>2]=c[h>>2]|2;S=b|0;c[S>>2]=R;Kh(n);Kh(m);i=d;return}function Cj(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0;b=i;i=i+16|0;j=d;d=i;i=i+4|0;i=i+7&-8;c[d>>2]=c[j>>2];j=e;e=i;i=i+4|0;i=i+7&-8;c[e>>2]=c[j>>2];j=b|0;k=b+8|0;c[j>>2]=c[d>>2];c[k>>2]=c[e>>2];Dj(a,0,j,k,f,g,h);i=b;return}function Dj(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0;d=i;i=i+256|0;k=e;e=i;i=i+4|0;i=i+7&-8;c[e>>2]=c[k>>2];k=f;f=i;i=i+4|0;i=i+7&-8;c[f>>2]=c[k>>2];k=d|0;l=d+32|0;m=d+40|0;n=d+56|0;o=d+72|0;p=d+80|0;q=d+240|0;r=d+248|0;s=c[g+4>>2]&74;if((s|0)==64){t=8}else if((s|0)==8){t=16}else if((s|0)==0){t=0}else{t=10}s=k|0;rk(m,g,s,l);g=n;Gq(g|0,0,12)|0;Nh(n,10,0);if((a[g]&1)==0){k=n+1|0;u=k;v=k;w=n+8|0}else{k=n+8|0;u=c[k>>2]|0;v=n+1|0;w=k}c[o>>2]=u;k=p|0;c[q>>2]=k;c[r>>2]=0;x=e|0;e=f|0;f=n|0;y=n+4|0;z=a[l]|0;l=u;u=c[x>>2]|0;a:while(1){do{if((u|0)==0){A=0}else{if((c[u+12>>2]|0)!=(c[u+16>>2]|0)){A=u;break}if(!((Mc[c[(c[u>>2]|0)+36>>2]&255](u)|0)==-1)){A=u;break}c[x>>2]=0;A=0}}while(0);B=(A|0)==0;C=c[e>>2]|0;do{if((C|0)==0){D=21}else{if((c[C+12>>2]|0)!=(c[C+16>>2]|0)){if(B){E=C;break}else{F=l;G=C;break a}}if((Mc[c[(c[C>>2]|0)+36>>2]&255](C)|0)==-1){c[e>>2]=0;D=21;break}else{if(B){E=C;break}else{F=l;G=C;break a}}}}while(0);if((D|0)==21){D=0;if(B){F=l;G=0;break}else{E=0}}C=a[g]|0;H=(C&1)==0;if(H){I=(C&255)>>>1}else{I=c[y>>2]|0}if(((c[o>>2]|0)-l|0)==(I|0)){if(H){K=(C&255)>>>1;L=(C&255)>>>1}else{C=c[y>>2]|0;K=C;L=C}Nh(n,K<<1,0);if((a[g]&1)==0){M=10}else{M=(c[f>>2]&-2)-1|0}Nh(n,M,0);if((a[g]&1)==0){N=v}else{N=c[w>>2]|0}c[o>>2]=N+L;O=N}else{O=l}C=A+12|0;H=c[C>>2]|0;P=A+16|0;if((H|0)==(c[P>>2]|0)){Q=(Mc[c[(c[A>>2]|0)+36>>2]&255](A)|0)&255}else{Q=a[H]|0}if((Tj(Q,t,O,o,r,z,m,k,q,s)|0)!=0){F=O;G=E;break}H=c[C>>2]|0;if((H|0)==(c[P>>2]|0)){Mc[c[(c[A>>2]|0)+40>>2]&255](A)|0;l=O;u=A;continue}else{c[C>>2]=H+1;l=O;u=A;continue}}u=a[m]|0;if((u&1)==0){R=(u&255)>>>1}else{R=c[m+4>>2]|0}do{if((R|0)!=0){u=c[q>>2]|0;if((u-p|0)>=160){break}O=c[r>>2]|0;c[q>>2]=u+4;c[u>>2]=O}}while(0);r=pp(F,c[o>>2]|0,h,t)|0;c[j>>2]=r;c[j+4>>2]=J;Em(m,k,c[q>>2]|0,h);do{if((A|0)==0){S=0}else{if((c[A+12>>2]|0)!=(c[A+16>>2]|0)){S=A;break}if(!((Mc[c[(c[A>>2]|0)+36>>2]&255](A)|0)==-1)){S=A;break}c[x>>2]=0;S=0}}while(0);x=(S|0)==0;do{if((G|0)==0){D=66}else{if((c[G+12>>2]|0)!=(c[G+16>>2]|0)){if(!x){break}T=b|0;c[T>>2]=S;Kh(n);Kh(m);i=d;return}if((Mc[c[(c[G>>2]|0)+36>>2]&255](G)|0)==-1){c[e>>2]=0;D=66;break}if(!(x^(G|0)==0)){break}T=b|0;c[T>>2]=S;Kh(n);Kh(m);i=d;return}}while(0);do{if((D|0)==66){if(x){break}T=b|0;c[T>>2]=S;Kh(n);Kh(m);i=d;return}}while(0);c[h>>2]=c[h>>2]|2;T=b|0;c[T>>2]=S;Kh(n);Kh(m);i=d;return}function Ej(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0;b=i;i=i+16|0;j=d;d=i;i=i+4|0;i=i+7&-8;c[d>>2]=c[j>>2];j=e;e=i;i=i+4|0;i=i+7&-8;c[e>>2]=c[j>>2];j=b|0;k=b+8|0;c[j>>2]=c[d>>2];c[k>>2]=c[e>>2];Fj(a,0,j,k,f,g,h);i=b;return}function Fj(d,e,f,g,h,j,k){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0;e=i;i=i+256|0;l=f;f=i;i=i+4|0;i=i+7&-8;c[f>>2]=c[l>>2];l=g;g=i;i=i+4|0;i=i+7&-8;c[g>>2]=c[l>>2];l=e|0;m=e+32|0;n=e+40|0;o=e+56|0;p=e+72|0;q=e+80|0;r=e+240|0;s=e+248|0;t=c[h+4>>2]&74;if((t|0)==0){u=0}else if((t|0)==64){u=8}else if((t|0)==8){u=16}else{u=10}t=l|0;rk(n,h,t,m);h=o;Gq(h|0,0,12)|0;Nh(o,10,0);if((a[h]&1)==0){l=o+1|0;v=l;w=l;x=o+8|0}else{l=o+8|0;v=c[l>>2]|0;w=o+1|0;x=l}c[p>>2]=v;l=q|0;c[r>>2]=l;c[s>>2]=0;y=f|0;f=g|0;g=o|0;z=o+4|0;A=a[m]|0;m=v;v=c[y>>2]|0;a:while(1){do{if((v|0)==0){B=0}else{if((c[v+12>>2]|0)!=(c[v+16>>2]|0)){B=v;break}if(!((Mc[c[(c[v>>2]|0)+36>>2]&255](v)|0)==-1)){B=v;break}c[y>>2]=0;B=0}}while(0);C=(B|0)==0;D=c[f>>2]|0;do{if((D|0)==0){E=21}else{if((c[D+12>>2]|0)!=(c[D+16>>2]|0)){if(C){F=D;break}else{G=m;H=D;break a}}if((Mc[c[(c[D>>2]|0)+36>>2]&255](D)|0)==-1){c[f>>2]=0;E=21;break}else{if(C){F=D;break}else{G=m;H=D;break a}}}}while(0);if((E|0)==21){E=0;if(C){G=m;H=0;break}else{F=0}}D=a[h]|0;I=(D&1)==0;if(I){J=(D&255)>>>1}else{J=c[z>>2]|0}if(((c[p>>2]|0)-m|0)==(J|0)){if(I){K=(D&255)>>>1;L=(D&255)>>>1}else{D=c[z>>2]|0;K=D;L=D}Nh(o,K<<1,0);if((a[h]&1)==0){M=10}else{M=(c[g>>2]&-2)-1|0}Nh(o,M,0);if((a[h]&1)==0){N=w}else{N=c[x>>2]|0}c[p>>2]=N+L;O=N}else{O=m}D=B+12|0;I=c[D>>2]|0;P=B+16|0;if((I|0)==(c[P>>2]|0)){Q=(Mc[c[(c[B>>2]|0)+36>>2]&255](B)|0)&255}else{Q=a[I]|0}if((Tj(Q,u,O,p,s,A,n,l,r,t)|0)!=0){G=O;H=F;break}I=c[D>>2]|0;if((I|0)==(c[P>>2]|0)){Mc[c[(c[B>>2]|0)+40>>2]&255](B)|0;m=O;v=B;continue}else{c[D>>2]=I+1;m=O;v=B;continue}}v=a[n]|0;if((v&1)==0){R=(v&255)>>>1}else{R=c[n+4>>2]|0}do{if((R|0)!=0){v=c[r>>2]|0;if((v-q|0)>=160){break}O=c[s>>2]|0;c[r>>2]=v+4;c[v>>2]=O}}while(0);b[k>>1]=op(G,c[p>>2]|0,j,u)|0;Em(n,l,c[r>>2]|0,j);do{if((B|0)==0){S=0}else{if((c[B+12>>2]|0)!=(c[B+16>>2]|0)){S=B;break}if(!((Mc[c[(c[B>>2]|0)+36>>2]&255](B)|0)==-1)){S=B;break}c[y>>2]=0;S=0}}while(0);y=(S|0)==0;do{if((H|0)==0){E=66}else{if((c[H+12>>2]|0)!=(c[H+16>>2]|0)){if(!y){break}T=d|0;c[T>>2]=S;Kh(o);Kh(n);i=e;return}if((Mc[c[(c[H>>2]|0)+36>>2]&255](H)|0)==-1){c[f>>2]=0;E=66;break}if(!(y^(H|0)==0)){break}T=d|0;c[T>>2]=S;Kh(o);Kh(n);i=e;return}}while(0);do{if((E|0)==66){if(y){break}T=d|0;c[T>>2]=S;Kh(o);Kh(n);i=e;return}}while(0);c[j>>2]=c[j>>2]|2;T=d|0;c[T>>2]=S;Kh(o);Kh(n);i=e;return}
- function Oe(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;d=i;i=i+8|0;e=d|0;f=c[b+4>>2]|0;g=c[b+4>>2]|0;b=c[g+4>>2]|0;h=c[g+8>>2]|0;g=h<<2;j=g+4|0;k=fq(j)|0;l=k;if((k|0)==0){_d();return 0}Gq(k|0,0,j|0)|0;if(!((h|0)>-1)){hc(9504,9232,138,13816);return 0}j=(h|0)>0;if(j){Gq(k|0,0,g|0)|0}k=f+4|0;m=c[k>>2]|0;if((m|0)>0){n=c[f+24>>2]|0;o=c[f+12>>2]|0;p=c[f+16>>2]|0;if((p|0)==0){q=0;r=m;while(1){s=c[o+(q<<2)>>2]|0;t=c[o+(q+1<<2)>>2]|0;if((s|0)<(t|0)){u=s;do{s=l+(c[n+(u<<2)>>2]<<2)|0;c[s>>2]=(c[s>>2]|0)+1;u=u+1|0;}while((u|0)<(t|0));v=c[k>>2]|0}else{v=r}t=q+1|0;if((t|0)<(v|0)){q=t;r=v}else{break}}}else{v=0;r=m;while(1){m=c[o+(v<<2)>>2]|0;q=c[p+(v<<2)>>2]|0;t=q+m|0;if((q|0)>0){q=m;do{m=l+(c[n+(q<<2)>>2]<<2)|0;c[m>>2]=(c[m>>2]|0)+1;q=q+1|0;}while((q|0)<(t|0));w=c[k>>2]|0}else{w=r}t=v+1|0;if((t|0)<(w|0)){v=t;r=w}else{break}}}}if(h>>>0>1073741823>>>0){_d();return 0}if((kq(e,16,g)|0)==0){x=c[e>>2]|0}else{c[e>>2]=0;x=0}if(!((x|0)!=0|(g|0)==0)){_d();return 0}g=x;do{if(j){e=0;w=0;do{r=l+(w<<2)|0;v=c[r>>2]|0;c[r>>2]=e;c[g+(w<<2)>>2]=e;e=v+e|0;w=w+1|0;}while((w|0)<(h|0));c[l+(h<<2)>>2]=e;if((e|0)==0){y=0;z=0;A=0;B=0;break}w=~~(+(e>>>0>>>0)*0.0)+e|0;v=Pa(w|0,4)|0;r=J?-1:v;v=nq(r)|0;y=v;z=nq(r)|0;A=w;B=e}else{c[l+(h<<2)>>2]=0;y=0;z=0;A=0;B=0}}while(0);j=c[k>>2]|0;a:do{if((j|0)>0){w=c[f+20>>2]|0;r=c[f+24>>2]|0;v=c[f+12>>2]|0;n=c[f+16>>2]|0;b:do{if((n|0)==0){p=0;o=j;while(1){t=c[v+(p<<2)>>2]|0;q=c[v+(p+1<<2)>>2]|0;if((t|0)<(q|0)){m=t;do{t=c[r+(m<<2)>>2]|0;if(!((t|0)>-1&(h|0)>(t|0))){break b}u=g+(t<<2)|0;t=c[u>>2]|0;c[u>>2]=t+1;c[z+(t<<2)>>2]=p;c[y+(t<<2)>>2]=c[w+(m<<2)>>2];m=m+1|0;}while((m|0)<(q|0));C=c[k>>2]|0}else{C=o}q=p+1|0;if((q|0)<(C|0)){p=q;o=C}else{break a}}}else{o=0;p=j;while(1){q=c[v+(o<<2)>>2]|0;m=c[n+(o<<2)>>2]|0;t=m+q|0;if((m|0)>0){m=q;do{q=c[r+(m<<2)>>2]|0;if(!((q|0)>-1&(h|0)>(q|0))){break b}u=g+(q<<2)|0;q=c[u>>2]|0;c[u>>2]=q+1;c[z+(q<<2)>>2]=o;c[y+(q<<2)>>2]=c[w+(m<<2)>>2];m=m+1|0;}while((m|0)<(t|0));D=c[k>>2]|0}else{D=p}t=o+1|0;if((t|0)<(D|0)){o=t;p=D}else{break a}}}}while(0);hc(2408,10808,378,13904);return 0}}while(0);D=a+12|0;k=c[D>>2]|0;c[D>>2]=l;c[a+8>>2]=b;c[a+4>>2]=h;h=a+16|0;b=c[h>>2]|0;c[h>>2]=0;h=a+20|0;l=c[h>>2]|0;c[h>>2]=y;y=a+24|0;h=c[y>>2]|0;c[y>>2]=z;c[a+28>>2]=B;c[a+32>>2]=A;gq(x);gq(k);gq(b);if((l|0)!=0){pq(l)}if((h|0)==0){i=d;return a|0}pq(h);i=d;return a|0}function Pe(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=i;i=i+16|0;f=e|0;if(!((b|0)>-1)){hc(8328,3152,222,14160);return 0}if(!((c[a+8>>2]|0)>(b|0)&(d|0)>-1)){hc(8328,3152,222,14160);return 0}g=c[a+4>>2]|0;if((g|0)<=(d|0)){hc(8328,3152,222,14160);return 0}if((c[a+16>>2]|0)!=0){h=Qe(a,b,d)|0;i=e;return h|0}c[f>>2]=g;c[f+8>>2]=2;if(!((g|0)>-1)){hc(11264,11040,63,14048);return 0}Se(a,f);h=Qe(a,b,d)|0;i=e;return h|0}function Qe(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;e=i;i=i+8|0;f=e|0;g=a+16|0;h=c[g>>2]|0;if((h|0)==0){hc(7800,3152,1121,14192);return 0}j=a+12|0;k=c[j>>2]|0;l=c[k+(d<<2)>>2]|0;m=c[h+(d<<2)>>2]|0;if((m|0)<((c[k+(d+1<<2)>>2]|0)-l|0)){n=l;o=h;p=m}else{c[f>>2]=d;c[f+4>>2]=(m|0)>2?m:2;Re(a,f);f=c[g>>2]|0;n=c[(c[j>>2]|0)+(d<<2)>>2]|0;o=f;p=c[f+(d<<2)>>2]|0}f=o+(d<<2)|0;d=p+n|0;o=c[a+24>>2]|0;j=a+20|0;a:do{if((p|0)>0){a=d;while(1){g=a-1|0;q=c[o+(g<<2)>>2]|0;if((q|0)<=(b|0)){break}c[o+(a<<2)>>2]=q;m=c[j>>2]|0;c[m+(a<<2)>>2]=c[m+(g<<2)>>2];if((g|0)>(n|0)){a=g}else{r=g;break a}}if((q|0)!=(b|0)){r=a;break}hc(7496,3152,1142,14192);return 0}else{r=d}}while(0);c[f>>2]=(c[f>>2]|0)+1;c[o+(r<<2)>>2]=b;b=(c[j>>2]|0)+(r<<2)|0;c[b>>2]=0;i=e;return b|0}function Re(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;d=a+16|0;e=c[d>>2]|0;f=a+4|0;g=c[f>>2]|0;h=g<<2;if((e|0)!=0){i=fq(h+4|0)|0;j=i;if((i|0)==0){_d()}if((g|0)>0){i=c[a+12>>2]|0;k=b+4|0;l=c[b>>2]|0;m=0;n=0;while(1){c[j+(n<<2)>>2]=m;o=n+1|0;p=c[e+(n<<2)>>2]|0;q=(c[i+(o<<2)>>2]|0)-(c[i+(n<<2)>>2]|0)-p|0;if((l|0)==(n|0)){r=c[k>>2]|0}else{r=0}s=p+m+((r|0)<(q|0)?q:r)|0;if((o|0)<(g|0)){m=s;n=o}else{t=s;break}}}else{t=0}c[j+(g<<2)>>2]=t;n=a+20|0;Ge(n,t,0.0);t=c[f>>2]|0;m=c[a+12>>2]|0;if((t|0)>0){r=a+24|0;k=n|0;n=t;do{n=n-1|0;t=j+(n<<2)|0;l=c[t>>2]|0;i=m+(n<<2)|0;e=c[i>>2]|0;a:do{if((l-e|0)>0){s=c[(c[d>>2]|0)+(n<<2)>>2]|0;if((s|0)<=0){break}o=c[r>>2]|0;q=c[k>>2]|0;p=s;s=l;u=e;while(1){v=p-1|0;c[o+(s+v<<2)>>2]=c[o+(u+v<<2)>>2];c[q+((c[t>>2]|0)+v<<2)>>2]=c[q+((c[i>>2]|0)+v<<2)>>2];if((v|0)<=0){break a}p=v;s=c[t>>2]|0;u=c[i>>2]|0}}}while(0);}while((n|0)>0)}c[a+12>>2]=j;gq(m);return}m=fq(h)|0;h=m;c[d>>2]=h;if((m|0)==0){_d()}if((g|0)>0){m=b+4|0;j=c[a+12>>2]|0;n=c[b>>2]|0;k=0;r=0;i=0;while(1){c[h+(k<<2)>>2]=r;t=(n|0)==(k|0);if(t){w=c[m>>2]|0}else{w=0}e=k+1|0;l=w+r+(c[j+(e<<2)>>2]|0)-(c[j+(k<<2)>>2]|0)|0;if(t){x=c[m>>2]|0}else{x=0}t=x+i|0;if((e|0)<(g|0)){k=e;r=l;i=t}else{y=t;break}}}else{y=0}i=a+20|0;r=c[a+28>>2]|0;k=r+y|0;y=a+32|0;if(k>>>0>(c[y>>2]|0)>>>0){x=Pa(k|0,4)|0;m=J?-1:x;x=nq(m)|0;j=nq(m)|0;m=i|0;w=c[m>>2]|0;n=w;t=(r>>>0<k>>>0?r:k)<<2;Fq(x|0,n|0,t)|0;r=a+24|0;l=c[r>>2]|0;Fq(j|0,l|0,t)|0;if((w|0)==0){z=l}else{pq(n);z=c[r>>2]|0}if((z|0)!=0){pq(z)}c[m>>2]=x;c[r>>2]=j;c[y>>2]=k;A=c[f>>2]|0}else{A=g}g=c[a+12>>2]|0;if((A|0)>0){k=c[d>>2]|0;y=a+24|0;a=i|0;j=c[g+(A<<2)>>2]|0;r=A;while(1){x=r-1|0;m=g+(x<<2)|0;z=c[m>>2]|0;n=j-z|0;if((n|0)>0){l=c[y>>2]|0;w=h+(x<<2)|0;t=c[a>>2]|0;e=n;u=z;while(1){s=e-1|0;c[l+((c[w>>2]|0)+s<<2)>>2]=c[l+(u+s<<2)>>2];c[t+((c[w>>2]|0)+s<<2)>>2]=c[t+((c[m>>2]|0)+s<<2)>>2];p=c[m>>2]|0;if((s|0)>0){e=s;u=p}else{B=p;C=w;break}}}else{B=z;C=h+(x<<2)|0}c[m>>2]=c[C>>2];c[k+(x<<2)>>2]=n;if((x|0)>0){j=B;r=x}else{break}}D=c[f>>2]|0;E=k}else{D=A;E=c[d>>2]|0}d=D-1|0;if((c[b>>2]|0)==(d|0)){F=c[b+4>>2]|0}else{F=0}c[g+(D<<2)>>2]=(c[E+(d<<2)>>2]|0)+(c[g+(d<<2)>>2]|0)+F;Ge(i,c[g+(c[f>>2]<<2)>>2]|0,0.0);return}function Se(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;d=a+16|0;e=c[d>>2]|0;f=a+4|0;g=c[f>>2]|0;h=g<<2;if((e|0)!=0){i=fq(h+4|0)|0;j=i;if((i|0)==0){_d()}a:do{if((g|0)>0){i=c[a+12>>2]|0;k=b|0;l=b+8|0;m=0;n=0;while(1){c[j+(n<<2)>>2]=m;o=n+1|0;p=c[e+(n<<2)>>2]|0;q=(c[i+(o<<2)>>2]|0)-(c[i+(n<<2)>>2]|0)-p|0;if((c[k>>2]|0)<=(n|0)){break}r=c[l>>2]|0;s=p+m+((r|0)<(q|0)?q:r)|0;if((o|0)<(g|0)){m=s;n=o}else{t=s;break a}}hc(2408,10808,156,13904)}else{t=0}}while(0);c[j+(g<<2)>>2]=t;e=a+20|0;Ge(e,t,0.0);t=c[f>>2]|0;n=c[a+12>>2]|0;if((t|0)>0){m=a+24|0;l=e|0;e=t;do{e=e-1|0;t=j+(e<<2)|0;k=c[t>>2]|0;i=n+(e<<2)|0;s=c[i>>2]|0;b:do{if((k-s|0)>0){o=c[(c[d>>2]|0)+(e<<2)>>2]|0;if((o|0)<=0){break}r=c[m>>2]|0;q=c[l>>2]|0;p=o;o=k;u=s;while(1){v=p-1|0;c[r+(o+v<<2)>>2]=c[r+(u+v<<2)>>2];c[q+((c[t>>2]|0)+v<<2)>>2]=c[q+((c[i>>2]|0)+v<<2)>>2];if((v|0)<=0){break b}p=v;o=c[t>>2]|0;u=c[i>>2]|0}}}while(0);}while((e|0)>0)}c[a+12>>2]=j;gq(n);return}n=fq(h)|0;h=n;c[d>>2]=h;if((n|0)==0){_d()}c:do{if((g|0)>0){n=b|0;j=b+8|0;e=a+12|0;l=0;m=0;i=0;while(1){c[h+(l<<2)>>2]=m;if((c[n>>2]|0)<=(l|0)){break}t=c[j>>2]|0;s=l+1|0;k=c[e>>2]|0;u=t+m-(c[k+(l<<2)>>2]|0)+(c[k+(s<<2)>>2]|0)|0;k=t+i|0;if((s|0)<(g|0)){l=s;m=u;i=k}else{w=k;break c}}hc(2408,10808,156,13904)}else{w=0}}while(0);i=a+20|0;m=c[a+28>>2]|0;l=m+w|0;w=a+32|0;if(l>>>0>(c[w>>2]|0)>>>0){e=Pa(l|0,4)|0;j=J?-1:e;e=nq(j)|0;n=nq(j)|0;j=i|0;k=c[j>>2]|0;u=k;s=(m>>>0<l>>>0?m:l)<<2;Fq(e|0,u|0,s)|0;m=a+24|0;t=c[m>>2]|0;Fq(n|0,t|0,s)|0;if((k|0)==0){x=t}else{pq(u);x=c[m>>2]|0}if((x|0)!=0){pq(x)}c[j>>2]=e;c[m>>2]=n;c[w>>2]=l;y=c[f>>2]|0}else{y=g}g=c[a+12>>2]|0;if((y|0)>0){l=c[d>>2]|0;w=a+24|0;a=i|0;n=c[g+(y<<2)>>2]|0;m=y;while(1){e=m-1|0;j=g+(e<<2)|0;x=c[j>>2]|0;u=n-x|0;if((u|0)>0){t=c[w>>2]|0;k=h+(e<<2)|0;s=c[a>>2]|0;o=u;p=x;while(1){q=o-1|0;c[t+((c[k>>2]|0)+q<<2)>>2]=c[t+(p+q<<2)>>2];c[s+((c[k>>2]|0)+q<<2)>>2]=c[s+((c[j>>2]|0)+q<<2)>>2];r=c[j>>2]|0;if((q|0)>0){o=q;p=r}else{z=r;A=k;break}}}else{z=x;A=h+(e<<2)|0}c[j>>2]=c[A>>2];c[l+(e<<2)>>2]=u;if((e|0)>0){n=z;m=e}else{break}}B=c[f>>2]|0;C=l}else{B=y;C=c[d>>2]|0}d=B-1|0;y=(c[C+(d<<2)>>2]|0)+(c[g+(d<<2)>>2]|0)|0;if((B|0)<=0){hc(2408,10808,156,13904)}if((c[b>>2]|0)<=(d|0)){hc(2408,10808,156,13904)}c[g+(B<<2)>>2]=y+(c[b+8>>2]|0);Ge(i,c[g+(c[f>>2]<<2)>>2]|0,0.0);return}function Te(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0;e=i;i=i+208|0;f=e|0;g=e+16|0;h=e+32|0;j=e+48|0;k=e+64|0;l=e+80|0;m=e+96|0;n=e+112|0;o=e+128|0;p=e+144|0;q=e+160|0;r=e+176|0;s=e+184|0;t=e+192|0;u=e+200|0;v=d+4|0;w=c[v>>2]|0;if((w|0)<=0){hc(9064,8464,175,13768);return 0}x=d|0;d=c[x>>2]|0;y=c[d>>2]|0;if((w|0)>1){z=y;A=1;while(1){B=c[d+(A<<2)>>2]|0;C=(z|0)<(B|0)?B:z;B=A+1|0;if((B|0)<(w|0)){z=C;A=B}else{D=C;E=0;break}}}else{D=y;E=0}do{y=c[d+(E+w<<2)>>2]|0;D=(D|0)<(y|0)?y:D;E=E+1|0;}while((E|0)<(w|0));E=w<<1;y=D;D=0;do{A=c[d+(D+E<<2)>>2]|0;y=(y|0)<(A|0)?A:y;D=D+1|0;}while((D|0)<(w|0));D=y+1|0;c[a+8>>2]=D;y=a+28|0;c[y>>2]=0;E=a+4|0;d=c[E>>2]|0;do{if((d|0)!=(D|0)|(d|0)==0){A=a+12|0;gq(c[A>>2]|0);z=fq((D<<2)+4|0)|0;c[A>>2]=z;if((z|0)==0){_d();return 0}else{c[E>>2]=D;break}}}while(0);d=a+16|0;z=c[d>>2]|0;if((z|0)==0){F=D}else{gq(z);c[d>>2]=0;F=c[E>>2]|0}z=a+12|0;Gq(c[z>>2]|0,0,(F<<2)+4|0)|0;c[b+8>>2]=D;F=b+28|0;c[F>>2]=0;A=b+4|0;C=c[A>>2]|0;do{if((C|0)!=(D|0)|(C|0)==0){B=b+12|0;gq(c[B>>2]|0);G=fq((D<<2)+4|0)|0;c[B>>2]=G;if((G|0)==0){_d();return 0}else{c[A>>2]=D;break}}}while(0);C=b+16|0;G=c[C>>2]|0;if((G|0)==0){H=D}else{gq(G);c[C>>2]=0;H=c[A>>2]|0}G=b+12|0;Gq(c[G>>2]|0,0,(H<<2)+4|0)|0;H=f|0;c[H>>2]=0;D=f+4|0;c[D>>2]=0;B=f+8|0;c[B>>2]=0;I=w*6|0;if((I|0)!=0){J=mq(w*72|0)|0;c[H>>2]=J;c[D>>2]=J;c[B>>2]=J+(I*12|0)}I=g|0;c[I>>2]=0;J=g+4|0;c[J>>2]=0;K=g+8|0;c[K>>2]=0;L=w*3|0;if((L|0)!=0){M=mq(w*36|0)|0;c[I>>2]=M;c[J>>2]=M;c[K>>2]=M+(L*12|0)}L=h|0;M=h+4|0;N=h+8|0;O=j|0;P=j+4|0;Q=j+8|0;R=k|0;S=k+4|0;T=k+8|0;U=l|0;V=l+4|0;W=l+8|0;X=m|0;Y=m+4|0;Z=m+8|0;_=n|0;$=n+4|0;aa=n+8|0;ba=o|0;ca=o+4|0;da=o+8|0;ea=p|0;fa=p+4|0;ga=p+8|0;ha=q|0;ia=q+4|0;ja=q+8|0;ka=q;la=p;ma=o;na=n;oa=m;pa=l;qa=k;ra=j;sa=h;ta=0;do{ua=c[v>>2]|0;if((ua|0)<=(ta|0)){va=28;break}wa=c[x>>2]|0;xa=c[wa+(ta<<2)>>2]|0;ya=c[wa+(ua+ta<<2)>>2]|0;za=c[wa+((ua<<1)+ta<<2)>>2]|0;c[L>>2]=xa;c[M>>2]=ya;c[N>>2]=1;ua=c[D>>2]|0;if((ua|0)==(c[B>>2]|0)){Ye(f,h);Aa=c[D>>2]|0}else{if((ua|0)==0){Ba=0}else{wa=ua;c[wa>>2]=c[sa>>2];c[wa+4>>2]=c[sa+4>>2];c[wa+8>>2]=c[sa+8>>2];Ba=c[D>>2]|0}wa=Ba+12|0;c[D>>2]=wa;Aa=wa}c[O>>2]=ya;c[P>>2]=za;c[Q>>2]=1;if((Aa|0)==(c[B>>2]|0)){Ye(f,j);Ca=c[D>>2]|0}else{if((Aa|0)==0){Da=0}else{wa=Aa;c[wa>>2]=c[ra>>2];c[wa+4>>2]=c[ra+4>>2];c[wa+8>>2]=c[ra+8>>2];Da=c[D>>2]|0}wa=Da+12|0;c[D>>2]=wa;Ca=wa}c[R>>2]=za;c[S>>2]=xa;c[T>>2]=1;if((Ca|0)==(c[B>>2]|0)){Ye(f,k);Ea=c[D>>2]|0}else{if((Ca|0)==0){Fa=0}else{wa=Ca;c[wa>>2]=c[qa>>2];c[wa+4>>2]=c[qa+4>>2];c[wa+8>>2]=c[qa+8>>2];Fa=c[D>>2]|0}wa=Fa+12|0;c[D>>2]=wa;Ea=wa}c[U>>2]=ya;c[V>>2]=xa;c[W>>2]=1;if((Ea|0)==(c[B>>2]|0)){Ye(f,l);Ga=c[D>>2]|0}else{if((Ea|0)==0){Ha=0}else{wa=Ea;c[wa>>2]=c[pa>>2];c[wa+4>>2]=c[pa+4>>2];c[wa+8>>2]=c[pa+8>>2];Ha=c[D>>2]|0}wa=Ha+12|0;c[D>>2]=wa;Ga=wa}c[X>>2]=za;c[Y>>2]=ya;c[Z>>2]=1;if((Ga|0)==(c[B>>2]|0)){Ye(f,m);Ia=c[D>>2]|0}else{if((Ga|0)==0){Ja=0}else{wa=Ga;c[wa>>2]=c[oa>>2];c[wa+4>>2]=c[oa+4>>2];c[wa+8>>2]=c[oa+8>>2];Ja=c[D>>2]|0}wa=Ja+12|0;c[D>>2]=wa;Ia=wa}c[_>>2]=xa;c[$>>2]=za;c[aa>>2]=1;if((Ia|0)==(c[B>>2]|0)){Ye(f,n)}else{if((Ia|0)==0){Ka=0}else{wa=Ia;c[wa>>2]=c[na>>2];c[wa+4>>2]=c[na+4>>2];c[wa+8>>2]=c[na+8>>2];Ka=c[D>>2]|0}c[D>>2]=Ka+12}c[ba>>2]=xa;c[ca>>2]=ya;c[da>>2]=ta;wa=c[J>>2]|0;if((wa|0)==(c[K>>2]|0)){Ye(g,o);La=c[J>>2]|0}else{if((wa|0)==0){Ma=0}else{ua=wa;c[ua>>2]=c[ma>>2];c[ua+4>>2]=c[ma+4>>2];c[ua+8>>2]=c[ma+8>>2];Ma=c[J>>2]|0}ua=Ma+12|0;c[J>>2]=ua;La=ua}c[ea>>2]=ya;c[fa>>2]=za;c[ga>>2]=ta;if((La|0)==(c[K>>2]|0)){Ye(g,p);Na=c[J>>2]|0}else{if((La|0)==0){Oa=0}else{ya=La;c[ya>>2]=c[la>>2];c[ya+4>>2]=c[la+4>>2];c[ya+8>>2]=c[la+8>>2];Oa=c[J>>2]|0}ya=Oa+12|0;c[J>>2]=ya;Na=ya}c[ha>>2]=za;c[ia>>2]=xa;c[ja>>2]=ta;if((Na|0)==(c[K>>2]|0)){Ye(g,q)}else{if((Na|0)==0){Pa=0}else{xa=Na;c[xa>>2]=c[ka>>2];c[xa+4>>2]=c[ka+4>>2];c[xa+8>>2]=c[ka+8>>2];Pa=c[J>>2]|0}c[J>>2]=Pa+12}ta=ta+1|0;}while((ta|0)<(w|0));if((va|0)==28){hc(9360,6792,114,13952);return 0}c[r>>2]=c[H>>2];c[s>>2]=c[D>>2];Ue(r,s,a,0);do{if((c[d>>2]|0)==0){a=c[y>>2]|0;s=c[E>>2]|0;r=s;while(1){if(!((r|0)>-1)){break}if((c[(c[z>>2]|0)+(r<<2)>>2]|0)==0){r=r-1|0}else{break}}va=r+1|0;if((va|0)>(s|0)){break}w=c[z>>2]|0;ta=va;do{c[w+(ta<<2)>>2]=a;ta=ta+1|0;}while((ta|0)<=(c[E>>2]|0))}}while(0);c[t>>2]=c[I>>2];c[u>>2]=c[J>>2];Ue(t,u,b,0);do{if((c[C>>2]|0)==0){b=c[F>>2]|0;u=c[A>>2]|0;t=u;while(1){if(!((t|0)>-1)){break}if((c[(c[G>>2]|0)+(t<<2)>>2]|0)==0){t=t-1|0}else{break}}E=t+1|0;if((E|0)>(u|0)){break}z=c[G>>2]|0;y=E;do{c[z+(y<<2)>>2]=b;y=y+1|0;}while((y|0)<=(c[A>>2]|0))}}while(0);A=c[I>>2]|0;if((A|0)!=0){I=c[J>>2]|0;if((I|0)!=(A|0)){c[J>>2]=I+(~(((I-12+(-A|0)|0)>>>0)/12|0)*12|0)}oq(A)}A=c[H>>2]|0;if((A|0)==0){i=e;return 0}H=c[D>>2]|0;if((H|0)!=(A|0)){c[D>>2]=H+(~(((H-12+(-A|0)|0)>>>0)/12|0)*12|0)}oq(A);i=e;return 0}function Ue(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;f=i;i=i+56|0;g=f|0;h=f+8|0;j=f+48|0;k=e+8|0;l=c[k>>2]|0;m=e+4|0;n=c[m>>2]|0;a[h|0]=0;o=h+4|0;Gq(o|0,0,32)|0;c[h+8>>2]=n;c[h+28>>2]=0;n=fq((l<<2)+4|0)|0;c[h+12>>2]=n;if((n|0)==0){_d()}c[o>>2]=l;o=h+16|0;p=h+12|0;Gq(n|0,0,(l<<2)+4|0)|0;n=b|0;b=d|0;if((c[n>>2]|0)!=(c[b>>2]|0)){d=j|0;if(l>>>0>1073741823>>>0){_d()}q=l<<2;if((kq(g,16,q)|0)==0){r=c[g>>2]|0}else{c[g>>2]=0;r=0}if(!((r|0)!=0|(q|0)==0)){_d()}q=r;c[d>>2]=q;g=j+4|0;c[g>>2]=l;if(!((l|0)>-1)){hc(10536,10264,225,13832)}c[g>>2]=l;if((l|0)>0){Gq(r|0,0,l<<2|0)|0}r=c[n>>2]|0;g=c[b>>2]|0;a:do{if((r|0)!=(g|0)){s=r;while(1){t=c[s>>2]|0;if(!((t|0)>-1)){u=25;break}if((t|0)>=(c[k>>2]|0)){u=25;break}v=c[s+4>>2]|0;if(!((v|0)>-1)){u=25;break}if((v|0)>=(c[m>>2]|0)){u=25;break}if((l|0)<=(t|0)){u=31;break}v=q+(t<<2)|0;c[v>>2]=(c[v>>2]|0)+1;s=s+12|0;if((s|0)==(g|0)){break a}}if((u|0)==25){hc(728,13024,952,13712)}else if((u|0)==31){hc(9416,6792,394,13952)}}}while(0);Xe(h,j);j=c[n>>2]|0;n=c[b>>2]|0;b:do{if((j|0)!=(n|0)){b=c[o>>2]|0;u=c[p>>2]|0;g=c[h+24>>2]|0;q=c[h+20>>2]|0;if((b|0)==0){hc(11880,13024,842,14080)}else{w=j}while(1){l=c[w>>2]|0;m=b+(l<<2)|0;k=c[m>>2]|0;r=c[u+(l<<2)>>2]|0;if((k|0)>((c[u+(l+1<<2)>>2]|0)-r|0)){break}l=c[w+4>>2]|0;s=c[w+8>>2]|0;c[m>>2]=k+1;m=r+k|0;c[g+(m<<2)>>2]=l;c[q+(m<<2)>>2]=s;w=w+12|0;if((w|0)==(n|0)){break b}}hc(10736,13024,843,14080)}}while(0);Ve(h);gq(c[d>>2]|0)}We(e,h|0)|0;gq(c[p>>2]|0);gq(c[o>>2]|0);o=c[h+20>>2]|0;if((o|0)!=0){pq(o)}o=c[h+24>>2]|0;if((o|0)==0){i=f;return}pq(o);i=f;return}function Ve(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;b=i;i=i+8|0;d=b|0;e=a+16|0;if((c[e>>2]|0)==0){hc(11880,13024,1020,14104)}f=c[a+8>>2]|0;if(f>>>0>1073741823>>>0){_d()}g=f<<2;if((kq(d,16,g)|0)==0){h=c[d>>2]|0}else{c[d>>2]=0;h=0}if(!((h|0)!=0|(g|0)==0)){_d()}g=h;if(!((f|0)>-1)){hc(10536,10264,225,13832)}if((f|0)>0){Gq(h|0,-1|0,f<<2|0)|0}d=a+4|0;j=c[d>>2]|0;k=a+12|0;l=c[k>>2]|0;m=c[e>>2]|0;a:do{if((j|0)>0){n=a+24|0;o=a+20|0;p=0;q=0;b:while(1){r=l+(p<<2)|0;s=c[r>>2]|0;t=c[m+(p<<2)>>2]|0;u=t+s|0;if((t|0)>0){t=c[n>>2]|0;v=s;s=q;while(1){w=t+(v<<2)|0;x=c[w>>2]|0;if(!((x|0)>-1&(f|0)>(x|0))){break b}y=g+(x<<2)|0;x=c[y>>2]|0;z=c[o>>2]|0;A=c[z+(v<<2)>>2]|0;if((x|0)<(q|0)){c[z+(s<<2)>>2]=A;c[t+(s<<2)>>2]=c[w>>2];c[y>>2]=s;B=s+1|0}else{y=z+(x<<2)|0;c[y>>2]=(c[y>>2]|0)+A;B=s}A=v+1|0;if((A|0)<(u|0)){v=A;s=B}else{C=B;break}}}else{C=q}c[r>>2]=q;s=p+1|0;v=c[d>>2]|0;if((s|0)<(v|0)){p=s;q=C}else{D=C;E=v;break a}}hc(9416,6792,394,13952)}else{D=0;E=j}}while(0);c[l+(E<<2)>>2]=D;gq(m);c[e>>2]=0;Ge(a+20|0,c[(c[k>>2]|0)+(c[d>>2]<<2)>>2]|0,0.0);gq(h);i=b;return}function We(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;d=i;i=i+8|0;e=d|0;f=b+4|0;g=c[f>>2]|0;h=c[b+8>>2]|0;j=h<<2;k=j+4|0;l=fq(k)|0;m=l;if((l|0)==0){_d();return 0}Gq(l|0,0,k|0)|0;if(!((h|0)>-1)){hc(13544,12936,138,13808);return 0}k=(h|0)>0;if(k){Gq(l|0,0,j|0)|0}if((g|0)>0){l=c[b+24>>2]|0;n=c[b+12>>2]|0;o=c[b+16>>2]|0;if((o|0)==0){p=0;do{q=c[n+(p<<2)>>2]|0;r=c[n+(p+1<<2)>>2]|0;if((q|0)<(r|0)){s=q;do{q=m+(c[l+(s<<2)>>2]<<2)|0;c[q>>2]=(c[q>>2]|0)+1;s=s+1|0;}while((s|0)<(r|0))}p=p+1|0;}while((p|0)<(g|0))}else{p=0;do{r=c[n+(p<<2)>>2]|0;s=c[o+(p<<2)>>2]|0;q=s+r|0;if((s|0)>0){s=r;do{r=m+(c[l+(s<<2)>>2]<<2)|0;c[r>>2]=(c[r>>2]|0)+1;s=s+1|0;}while((s|0)<(q|0))}p=p+1|0;}while((p|0)<(g|0))}}if(h>>>0>1073741823>>>0){_d();return 0}if((kq(e,16,j)|0)==0){t=c[e>>2]|0}else{c[e>>2]=0;t=0}if(!((t|0)!=0|(j|0)==0)){_d();return 0}j=t;do{if(k){e=0;p=0;do{l=m+(p<<2)|0;o=c[l>>2]|0;c[l>>2]=e;c[j+(p<<2)>>2]=e;e=o+e|0;p=p+1|0;}while((p|0)<(h|0));c[m+(h<<2)>>2]=e;if((e|0)==0){u=0;v=0;w=0;x=0;break}p=~~(+(e>>>0>>>0)*0.0)+e|0;o=Pa(p|0,4)|0;l=J?-1:o;o=nq(l)|0;u=o;v=nq(l)|0;w=p;x=e}else{c[m+(h<<2)>>2]=0;u=0;v=0;w=0;x=0}}while(0);k=c[f>>2]|0;a:do{if((k|0)>0){p=c[b+20>>2]|0;l=c[b+24>>2]|0;o=c[b+12>>2]|0;n=c[b+16>>2]|0;b:do{if((n|0)==0){q=0;s=k;while(1){r=c[o+(q<<2)>>2]|0;y=c[o+(q+1<<2)>>2]|0;if((r|0)<(y|0)){z=r;do{r=c[l+(z<<2)>>2]|0;if(!((r|0)>-1&(h|0)>(r|0))){break b}A=j+(r<<2)|0;r=c[A>>2]|0;c[A>>2]=r+1;c[v+(r<<2)>>2]=q;c[u+(r<<2)>>2]=c[p+(z<<2)>>2];z=z+1|0;}while((z|0)<(y|0));B=c[f>>2]|0}else{B=s}y=q+1|0;if((y|0)<(B|0)){q=y;s=B}else{break a}}}else{s=0;q=k;while(1){y=c[o+(s<<2)>>2]|0;z=c[n+(s<<2)>>2]|0;r=z+y|0;if((z|0)>0){z=y;do{y=c[l+(z<<2)>>2]|0;if(!((y|0)>-1&(h|0)>(y|0))){break b}A=j+(y<<2)|0;y=c[A>>2]|0;c[A>>2]=y+1;c[v+(y<<2)>>2]=s;c[u+(y<<2)>>2]=c[p+(z<<2)>>2];z=z+1|0;}while((z|0)<(r|0));C=c[f>>2]|0}else{C=q}r=s+1|0;if((r|0)<(C|0)){s=r;q=C}else{break a}}}}while(0);hc(9416,6792,378,13920);return 0}}while(0);C=a+12|0;f=c[C>>2]|0;c[C>>2]=m;c[a+8>>2]=g;c[a+4>>2]=h;h=a+16|0;g=c[h>>2]|0;c[h>>2]=0;h=a+20|0;m=c[h>>2]|0;c[h>>2]=u;u=a+24|0;h=c[u>>2]|0;c[u>>2]=v;c[a+28>>2]=x;c[a+32>>2]=w;gq(t);gq(f);gq(g);if((m|0)!=0){pq(m)}if((h|0)==0){i=d;return a|0}pq(h);i=d;return a|0}function Xe(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;d=a+16|0;e=c[d>>2]|0;f=a+4|0;g=c[f>>2]|0;h=g<<2;if((e|0)!=0){i=fq(h+4|0)|0;j=i;if((i|0)==0){_d()}a:do{if((g|0)>0){i=c[a+12>>2]|0;k=b+4|0;l=b|0;m=0;n=0;while(1){c[j+(n<<2)>>2]=m;o=n+1|0;p=c[e+(n<<2)>>2]|0;q=(c[i+(o<<2)>>2]|0)-(c[i+(n<<2)>>2]|0)-p|0;if((c[k>>2]|0)<=(n|0)){break}r=c[(c[l>>2]|0)+(n<<2)>>2]|0;s=p+m+((r|0)<(q|0)?q:r)|0;if((o|0)<(g|0)){m=s;n=o}else{t=s;break a}}hc(9416,6792,156,13920)}else{t=0}}while(0);c[j+(g<<2)>>2]=t;e=a+20|0;Ge(e,t,0.0);t=c[f>>2]|0;n=c[a+12>>2]|0;if((t|0)>0){m=a+24|0;l=e|0;e=t;do{e=e-1|0;t=j+(e<<2)|0;k=c[t>>2]|0;i=n+(e<<2)|0;s=c[i>>2]|0;b:do{if((k-s|0)>0){o=c[(c[d>>2]|0)+(e<<2)>>2]|0;if((o|0)<=0){break}r=c[m>>2]|0;q=c[l>>2]|0;p=o;o=k;u=s;while(1){v=p-1|0;c[r+(o+v<<2)>>2]=c[r+(u+v<<2)>>2];c[q+((c[t>>2]|0)+v<<2)>>2]=c[q+((c[i>>2]|0)+v<<2)>>2];if((v|0)<=0){break b}p=v;o=c[t>>2]|0;u=c[i>>2]|0}}}while(0);}while((e|0)>0)}c[a+12>>2]=j;gq(n);return}n=fq(h)|0;h=n;c[d>>2]=h;if((n|0)==0){_d()}c:do{if((g|0)>0){n=b+4|0;j=b|0;e=a+12|0;l=0;m=0;i=0;while(1){c[h+(l<<2)>>2]=m;if((c[n>>2]|0)<=(l|0)){break}t=c[(c[j>>2]|0)+(l<<2)>>2]|0;s=l+1|0;k=c[e>>2]|0;u=t+m-(c[k+(l<<2)>>2]|0)+(c[k+(s<<2)>>2]|0)|0;k=t+i|0;if((s|0)<(g|0)){l=s;m=u;i=k}else{w=k;break c}}hc(9416,6792,156,13920)}else{w=0}}while(0);i=a+20|0;m=c[a+28>>2]|0;l=m+w|0;w=a+32|0;if(l>>>0>(c[w>>2]|0)>>>0){e=Pa(l|0,4)|0;j=J?-1:e;e=nq(j)|0;n=nq(j)|0;j=i|0;k=c[j>>2]|0;u=k;s=(m>>>0<l>>>0?m:l)<<2;Fq(e|0,u|0,s)|0;m=a+24|0;t=c[m>>2]|0;Fq(n|0,t|0,s)|0;if((k|0)==0){x=t}else{pq(u);x=c[m>>2]|0}if((x|0)!=0){pq(x)}c[j>>2]=e;c[m>>2]=n;c[w>>2]=l;y=c[f>>2]|0}else{y=g}g=c[a+12>>2]|0;if((y|0)>0){l=c[d>>2]|0;w=a+24|0;a=i|0;n=c[g+(y<<2)>>2]|0;m=y;while(1){e=m-1|0;j=g+(e<<2)|0;x=c[j>>2]|0;u=n-x|0;if((u|0)>0){t=c[w>>2]|0;k=h+(e<<2)|0;s=c[a>>2]|0;o=u;p=x;while(1){q=o-1|0;c[t+((c[k>>2]|0)+q<<2)>>2]=c[t+(p+q<<2)>>2];c[s+((c[k>>2]|0)+q<<2)>>2]=c[s+((c[j>>2]|0)+q<<2)>>2];r=c[j>>2]|0;if((q|0)>0){o=q;p=r}else{z=r;A=k;break}}}else{z=x;A=h+(e<<2)|0}c[j>>2]=c[A>>2];c[l+(e<<2)>>2]=u;if((e|0)>0){n=z;m=e}else{break}}B=c[f>>2]|0;C=l}else{B=y;C=c[d>>2]|0}d=B-1|0;y=(c[C+(d<<2)>>2]|0)+(c[g+(d<<2)>>2]|0)|0;if((B|0)<=0){hc(9416,6792,156,13920)}if((c[b+4>>2]|0)<=(d|0)){hc(9416,6792,156,13920)}c[g+(B<<2)>>2]=y+(c[(c[b>>2]|0)+(d<<2)>>2]|0);Ge(i,c[g+(c[f>>2]<<2)>>2]|0,0.0);return}function Ye(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=a+4|0;e=a|0;f=c[e>>2]|0;g=f;h=(c[d>>2]|0)-g|0;i=(h|0)/12|0;j=i+1|0;if(j>>>0>357913941>>>0){jn(0)}k=a+8|0;a=((c[k>>2]|0)-g|0)/12|0;if(a>>>0<178956970>>>0){g=a<<1;a=g>>>0<j>>>0?j:g;if((a|0)==0){l=0;m=0}else{n=a;o=5}}else{n=357913941;o=5}if((o|0)==5){l=mq(n*12|0)|0;m=n}n=l+(i*12|0)|0;if((n|0)!=0){o=n;n=b;c[o>>2]=c[n>>2];c[o+4>>2]=c[n+4>>2];c[o+8>>2]=c[n+8>>2]}n=l+((((h|0)/-12|0)+i|0)*12|0)|0;i=f;Fq(n|0,i|0,h)|0;c[e>>2]=n;c[d>>2]=l+(j*12|0);c[k>>2]=l+(m*12|0);if((f|0)==0){return}oq(i);return}function Ze(a){a=a|0;lc(c[s>>2]|0,a|0,(a=i,i=i+1|0,i=i+7&-8,c[a>>2]=0,a)|0)|0;i=a;nb(-1|0)}function _e(a){a=a|0;c[a>>2]=0;c[a+4>>2]=1;c[a+8>>2]=3;c[a+12>>2]=0;c[a+16>>2]=0;h[a+24>>3]=1.0;c[a+32>>2]=0;c[a+36>>2]=0;c[a+40>>2]=0;c[a+120>>2]=1;return}function $e(a){a=a|0;lf(c[a+20>>2]|0);return}function af(a){a=a|0;var b=0;b=a+20|0;lf(c[(c[b>>2]|0)+8>>2]|0);lf(c[(c[b>>2]|0)+12>>2]|0);lf(c[(c[b>>2]|0)+4>>2]|0);lf(c[b>>2]|0);return}function bf(a){a=a|0;var b=0;b=a+20|0;lf(c[(c[b>>2]|0)+16>>2]|0);lf(c[(c[b>>2]|0)+20>>2]|0);lf(c[(c[b>>2]|0)+8>>2]|0);lf(c[(c[b>>2]|0)+12>>2]|0);lf(c[(c[b>>2]|0)+24>>2]|0);lf(c[(c[b>>2]|0)+28>>2]|0);lf(c[b>>2]|0);return}function cf(a){a=a|0;var b=0;b=a+20|0;lf(c[(c[b>>2]|0)+12>>2]|0);lf(c[(c[b>>2]|0)+16>>2]|0);lf(c[b>>2]|0);return}function df(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;if((a|0)>0){e=0}else{return}do{c[d+(c[b+(e<<2)>>2]<<2)>>2]=-1;e=e+1|0;}while((e|0)<(a|0));return}function ef(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;b=c[f>>2]|0;g=c[f+12>>2]|0;c[d>>2]=0;c[e>>2]=c[(c[f+32>>2]|0)+(a<<2)>>2];h=c[(c[f+4>>2]|0)+(a<<2)>>2]|0;if((a|0)<1|(h|0)<0){return}a=0;f=c[b>>2]|0;while(1){i=a+1|0;j=b+(i<<2)|0;k=c[j>>2]|0;if((f|0)<(k|0)){l=1-f|0;m=(c[g+(f+1<<2)>>2]|0)-(c[g+(f<<2)>>2]|0)|0;n=f;while(1){c[d>>2]=(c[d>>2]|0)+m;c[e>>2]=l+n+(c[e>>2]|0);o=n+1|0;p=c[j>>2]|0;if((o|0)<(p|0)){m=m-1|0;n=o}else{q=p;break}}}else{q=k}if((i|0)>(h|0)){break}else{a=i;f=q}}return}function ff(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;if((a|0)<2){return}e=c[d>>2]|0;f=c[d+8>>2]|0;g=c[d+12>>2]|0;h=c[(c[d+4>>2]|0)+(a<<2)>>2]|0;if((h|0)<0){i=0}else{d=0;j=0;k=c[e>>2]|0;while(1){l=g+(k<<2)|0;m=c[l>>2]|0;c[l>>2]=j;l=k+1|0;n=g+(l<<2)|0;if((m|0)<(c[n>>2]|0)){o=m;m=j;while(1){c[f+(m<<2)>>2]=c[b+(c[f+(o<<2)>>2]<<2)>>2];p=m+1|0;q=o+1|0;if((q|0)<(c[n>>2]|0)){o=q;m=p}else{r=p;break}}}else{r=j}m=d+1|0;o=e+(m<<2)|0;n=c[o>>2]|0;if((l|0)<(n|0)){p=l;while(1){c[g+(p<<2)>>2]=r;q=p+1|0;s=c[o>>2]|0;if((q|0)<(s|0)){p=q}else{t=s;break}}}else{t=n}if((m|0)>(h|0)){i=r;break}else{d=m;j=r;k=t}}}c[g+(a<<2)>>2]=i;return}function gf(a){a=a|0;var b=0,d=0,e=0,f=0,j=0,k=0;b=i;i=i+512|0;d=rf(1)|0;e=rf(2)|0;c[a>>2]=qf(((d|0)>(e|0)?d:e)+1|0)|0;e=kf(128)|0;d=a+4|0;c[d>>2]=e;if((e|0)==0){e=b|0;ob(e|0,9328,(f=i,i=i+24|0,c[f>>2]=9016,c[f+8>>2]=305,c[f+16>>2]=8456,f)|0)|0;i=f;Ze(e)}e=kf(64)|0;j=e;c[a+8>>2]=j;if((e|0)==0){k=b+256|0;ob(k|0,9328,(f=i,i=i+24|0,c[f>>2]=8208,c[f+8>>2]=307,c[f+16>>2]=8456,f)|0)|0;i=f;Ze(k)}else{k=c[d>>2]|0;h[k>>3]=0.0;g[j>>2]=0.0;h[k+8>>3]=0.0;g[e+4>>2]=0.0;h[k+16>>3]=0.0;g[e+8>>2]=0.0;h[k+24>>3]=0.0;g[e+12>>2]=0.0;h[k+32>>3]=0.0;g[e+16>>2]=0.0;h[k+40>>3]=0.0;g[e+20>>2]=0.0;h[k+48>>3]=0.0;g[e+24>>2]=0.0;h[k+56>>3]=0.0;g[e+28>>2]=0.0;h[k+64>>3]=0.0;g[e+32>>2]=0.0;h[k+72>>3]=0.0;g[e+36>>2]=0.0;h[k+80>>3]=0.0;g[e+40>>2]=0.0;h[k+88>>3]=0.0;g[e+44>>2]=0.0;h[k+96>>3]=0.0;g[e+48>>2]=0.0;h[k+104>>3]=0.0;g[e+52>>2]=0.0;h[k+112>>3]=0.0;g[e+56>>2]=0.0;h[k+120>>3]=0.0;g[e+60>>2]=0.0;c[a+12>>2]=0;c[a+16>>2]=0;c[a+20>>2]=0;i=b;return}}function hf(a){a=a|0;lf(c[a>>2]|0);lf(c[a+4>>2]|0);lf(c[a+8>>2]|0);return}function jf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;if((b|0)>0){e=0}else{return}do{c[a+(e<<2)>>2]=d;e=e+1|0;}while((e|0)<(b|0));return}function kf(a){a=a|0;return fq(a)|0}function lf(a){a=a|0;gq(a);return}function mf(a,b,d,e,f,g,h,i,j,k,l){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;c[f>>2]=e;c[g>>2]=e+(a<<2);g=a<<1;c[h>>2]=e+(g<<2);h=g+a|0;c[i>>2]=e+(h<<2);g=fa(d,a)|0;a=g+h|0;c[j>>2]=e+(a<<2);h=a+g|0;c[k>>2]=e+(h<<2);c[l>>2]=e+(h+b<<2);jf(c[i>>2]|0,g,-1);jf(c[j>>2]|0,g,-1);return}function nf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=b;b=d;if((a|0)>0){f=0}else{return}do{c[b+(f<<2)>>2]=c[e+(f<<2)>>2];f=f+1|0;}while((f|0)<(a|0));return}function of(b,c,d){b=b|0;c=c|0;d=d|0;var e=0;e=d-1|0;if((e|0)<0){return}d=b+e|0;b=c+e|0;while(1){a[b]=a[d]|0;e=b-1|0;if(e>>>0<c>>>0){break}else{d=d-1|0;b=e}}return}function pf(a){a=a|0;var b=0,d=0,e=0;b=i;i=i+256|0;d=fq(a<<2)|0;a=d;if((d|0)!=0){i=b;return a|0}d=b|0;ob(d|0,10472,(e=i,i=i+24|0,c[e>>2]=12480,c[e+8>>2]=138,c[e+16>>2]=9304,e)|0)|0;i=e;Ze(d);i=b;return a|0}function qf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=i;i=i+256|0;d=fq(a<<2)|0;e=d;if((d|0)==0){f=b|0;ob(f|0,10472,(g=i,i=i+24|0,c[g>>2]=6672,c[g+8>>2]=149,c[g+16>>2]=9304,g)|0)|0;i=g;Ze(f)}if((a|0)<=0){i=b;return e|0}Gq(d|0,0,a<<2|0)|0;i=b;return e|0}function rf(a){a=a|0;var b=0,d=0,e=0;b=i;i=i+8|0;d=b|0;switch(a|0){case 1:{e=12;break};case 2:{e=6;break};case 3:{e=100;break};case 4:{e=200;break};case 5:{e=60;break};case 6:{e=20;break};case 7:{e=10;break};default:{c[d>>2]=1;sf(10192,d)|0;e=0}}i=b;return e|0}function sf(a,b){a=a|0;b=b|0;var d=0,e=0;d=i;e=c[b>>2]|0;Kb(9568,(b=i,i=i+16|0,c[b>>2]=a,c[b+8>>2]=e,b)|0)|0;i=b;i=d;return 0}function tf(b,d,e,f,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z){b=b|0;d=d|0;e=e|0;f=f|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;t=t|0;u=u|0;v=v|0;w=w|0;x=x|0;y=y|0;z=z|0;var A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0.0,Z=0.0,_=0,$=0,aa=0.0,ba=0,ca=0,da=0,ea=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0.0,oa=0.0,pa=0.0,qa=0.0,ra=0,sa=0.0,ta=0.0,ua=0,va=0,wa=0.0,xa=0.0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0;A=i;i=i+72|0;B=A|0;C=A+24|0;D=A+32|0;E=A+40|0;F=A+48|0;G=A+56|0;H=A+64|0;I=c[r+20>>2]|0;J=c[s+20>>2]|0;K=c[I+4>>2]|0;L=c[J+4>>2]|0;M=I;I=c[M>>2]|0;N=J;J=c[N>>2]|0;O=r+16|0;P=c[O>>2]|0;c[z>>2]=0;Q=b|0;R=(c[Q>>2]|0)!=3;S=b+4|0;T=c[S>>2]|0;U=b+12|0;V=(c[U>>2]|0)==0;if(R){a[k]=78;W=0;X=0;Y=0.0;Z=0.0}else{if((wg(k,9560)|0)==0){_=(wg(k,12384)|0)!=0|0}else{_=1}if((wg(k,9128)|0)==0){$=(wg(k,12384)|0)!=0|0}else{$=1}aa=+$f(6512);W=$;X=_;Y=aa;Z=1.0/aa}_=c[Q>>2]|0;do{if(_>>>0<4>>>0){ba=12}else{if((c[U>>2]|0)>>>0<3>>>0){ba=12;break}if((c[S>>2]|0)>>>0<2>>>0){ba=12;break}c[z>>2]=-1;ca=-1}}while(0);a:do{if((ba|0)==12){S=d+12|0;$=c[S>>2]|0;da=d+16|0;do{if(!(($|0)!=(c[da>>2]|0)|($|0)<0)){ea=d|0;ga=c[ea>>2]|0;if(!((ga|0)==0|(ga|0)==2)){break}ga=d+4|0;if((c[ga>>2]|0)!=1){break}ha=d+8|0;if((c[ha>>2]|0)!=0){break}ia=(X|0)==0;ja=(W|0)==0;do{if((_|0)==3&ia&ja){if((wg(k,4912)|0)!=0){break}c[z>>2]=-6;ca=-6;break a}}while(0);do{if(!ia){ka=c[S>>2]|0;la=(ka|0)>0;if(la){ma=0;aa=0.0;na=Z;while(1){oa=+h[l+(ma<<3)>>3];pa=na<oa?na:oa;qa=aa>oa?aa:oa;ra=ma+1|0;if((ra|0)<(ka|0)){ma=ra;aa=qa;na=pa}else{sa=qa;ta=pa;break}}}else{sa=0.0;ta=Z}if(!(ta>0.0)){c[z>>2]=-7;break}if(la){h[H>>3]=(ta>Y?ta:Y)/(sa<Z?sa:Z);break}else{h[H>>3]=1.0;break}}}while(0);ia=c[z>>2]|0;ma=(ia|0)==0;do{if(ja){if(!ma){ca=ia;break a}}else{if(!ma){ca=ia;break a}ka=c[S>>2]|0;ra=(ka|0)>0;if(ra){ua=0;na=0.0;aa=Z;while(1){pa=+h[m+(ua<<3)>>3];qa=aa<pa?aa:pa;oa=na>pa?na:pa;va=ua+1|0;if((va|0)<(ka|0)){ua=va;na=oa;aa=qa}else{wa=oa;xa=qa;break}}}else{wa=0.0;xa=Z}if(!(xa>0.0)){c[z>>2]=-8;ca=-8;break a}if(ra){h[G>>3]=(xa>Y?xa:Y)/(wa<Z?wa:Z);break}else{h[G>>3]=1.0;break}}}while(0);b:do{if((q|0)<-1){c[z>>2]=-12;ya=-12}else{ia=c[O>>2]|0;if((ia|0)<0){c[z>>2]=-13;ya=-13;break}if((ia|0)<=0){ya=0;break}ia=c[S>>2]|0;do{if((c[M>>2]|0)>=(((ia|0)<0?0:ia)|0)){if((c[r>>2]|0)!=6){break}if((c[r+4>>2]|0)!=1){break}if((c[r+8>>2]|0)==0){ya=0;break b}}}while(0);c[z>>2]=-13;ya=-13}}while(0);ia=c[s+16>>2]|0;if((ia|0)<0){c[z>>2]=-14;ca=-14;break a}c:do{if((ia|0)>0){ra=c[S>>2]|0;do{if((c[N>>2]|0)>=(((ra|0)<0?0:ra)|0)){ma=c[O>>2]|0;if(!((ma|0)==0|(ma|0)==(ia|0))){break}if((c[s>>2]|0)!=6){break}if((c[s+4>>2]|0)!=1){break}if((c[s+8>>2]|0)==0){break c}}}while(0);c[z>>2]=-14;ca=-14;break a}}while(0);if((ya|0)!=0){ca=ya;break a}ia=rf(1)|0;ra=rf(2)|0;ma=c[y+4>>2]|0;if((c[ea>>2]|0)==2){ja=c[d+20>>2]|0;ua=kf(24)|0;Uf(ua,c[da>>2]|0,c[S>>2]|0,c[ja>>2]|0,c[ja+4>>2]|0,c[ja+8>>2]|0,c[ja+12>>2]|0,0,c[ga>>2]|0,c[ha>>2]|0);za=ua;Aa=V^1;Ba=V&1}else{za=d;Aa=V;Ba=c[U>>2]|0}if((T|0)!=1|R^1){Ca=W;Da=X}else{aa=+gg();wf(za,l,m,H,G,F,E);do{if((c[E>>2]|0)==0){xf(za,l,m,+h[H>>3],+h[G>>3],+h[F>>3],k);if((wg(k,9560)|0)==0){Ea=(wg(k,12384)|0)!=0|0}else{Ea=1}if((wg(k,9128)|0)!=0){Fa=1;Ga=Ea;break}Fa=(wg(k,12384)|0)!=0|0;Ga=Ea}else{Fa=W;Ga=X}}while(0);h[ma+32>>3]=+gg()-aa;Ca=Fa;Da=Ga}do{if(R){na=+gg();ha=c[b+8>>2]|0;do{if((ha|0)!=7){if((c[Q>>2]|0)!=0){break}kg(ha,za,e)}}while(0);h[ma>>3]=+gg()-na;qa=+gg();qg(b,za,e,j,B);h[ma+24>>3]=+gg()-qa;qa=+gg();Af(b,B,ra,ia,j,p,q,e,f,n,o,y,z);h[ma+56>>3]=+gg()-qa;if(!((q|0)==-1)){break}g[x+4>>2]=+((c[z>>2]|0)-(c[da>>2]|0)|0);i=A;return}}while(0);do{if((c[b+36>>2]|0)!=0){ia=c[z>>2]|0;ra=c[da>>2]|0;if((ia|0)<=0){h[t>>3]=+yf(ra,za,e,n,o);break}if((ia|0)>(ra|0)){i=A;return}h[t>>3]=+yf(ia,za,e,n,o);i=A;return}}while(0);ia=b+40|0;if((c[ia>>2]|0)!=0){aa=+gg();ra=C|0;a[ra]=Aa?49:73;uf(ra,n,o,+vf(ra,za),u,y,z);h[ma+80>>3]=+gg()-aa}do{if((P|0)>0){do{if(Aa){if((Da|0)==0){break}ra=c[S>>2]|0;ha=(ra|0)>0;ga=0;do{if(ha){ua=fa(ga,I)|0;ja=(ra|0)>1;ka=0;do{la=K+(ka+ua<<3)|0;h[la>>3]=+h[l+(ka<<3)>>3]*+h[la>>3];ka=ka+1|0;}while((ka|0)<(ra|0));Ha=ja?ra:1}else{Ha=0}ga=ga+1|0;}while((ga|0)<(P|0));c[D>>2]=Ha}else{if((Ca|0)==0){break}ga=c[S>>2]|0;ra=(ga|0)>0;ha=0;do{if(ra){ka=fa(ha,I)|0;ua=(ga|0)>1;la=0;do{va=K+(la+ka<<3)|0;h[va>>3]=+h[m+(la<<3)>>3]*+h[va>>3];la=la+1|0;}while((la|0)<(ga|0));Ia=ua?ga:1}else{Ia=0}ha=ha+1|0;}while((ha|0)<(P|0));c[D>>2]=Ia}}while(0);ha=c[r+12>>2]|0;if((ha|0)>0){ga=0;while(1){ra=fa(ga,I)|0;la=fa(ga,J)|0;ka=(ha|0)>1;ja=0;do{h[L+(ja+la<<3)>>3]=+h[K+(ja+ra<<3)>>3];ja=ja+1|0;}while((ja|0)<(ha|0));ja=ga+1|0;if((ja|0)<(P|0)){ga=ja}else{Ja=ka?ha:1;break}}}else{Ja=0}c[D>>2]=Ja;na=+gg();Bf(Ba,n,o,e,f,s,y,z);h[ma+88>>3]=+gg()-na;na=+gg();if((c[b+16>>2]|0)==0){ha=0;do{h[w+(ha<<3)>>3]=1.0;h[v+(ha<<3)>>3]=1.0;ha=ha+1|0;}while((ha|0)<(P|0))}else{zf(Ba,za,n,o,e,f,k,l,m,r,s,v,w,y,z)}h[ma+96>>3]=+gg()-na;if(Aa){if((Ca|0)==0){break}ha=c[S>>2]|0;if((ha|0)>0){ga=0;while(1){ja=fa(ga,J)|0;ra=(ha|0)>1;la=0;do{va=L+(la+ja<<3)|0;h[va>>3]=+h[m+(la<<3)>>3]*+h[va>>3];la=la+1|0;}while((la|0)<(ha|0));la=ga+1|0;if((la|0)<(P|0)){ga=la}else{Ka=ra?ha:1;break}}}else{Ka=0}c[D>>2]=Ka;break}else{if((Da|0)==0){break}ha=c[S>>2]|0;if((ha|0)>0){ga=0;while(1){la=fa(ga,J)|0;ja=(ha|0)>1;ka=0;do{va=L+(ka+la<<3)|0;h[va>>3]=+h[l+(ka<<3)>>3]*+h[va>>3];ka=ka+1|0;}while((ka|0)<(ha|0));ka=ga+1|0;if((ka|0)<(P|0)){ga=ka}else{La=ja?ha:1;break}}}else{La=0}c[D>>2]=La;break}}}while(0);do{if((c[ia>>2]|0)!=0){na=+h[u>>3];if(!(na<+$f(2992))){break}c[z>>2]=(c[da>>2]|0)+1}}while(0);if(R){Lf(n,o,x)|0;cf(B)}if((c[ea>>2]|0)!=2){i=A;return}$e(za);lf(za);i=A;return}}while(0);c[z>>2]=-2;ca=-2}}while(0);c[D>>2]=-ca;sf(3704,D)|0;i=A;return}function uf(b,d,e,f,g,j,k){b=b|0;d=d|0;e=e|0;f=+f;g=g|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0.0;l=i;i=i+280|0;m=l|0;n=l+8|0;o=l+16|0;p=l+24|0;c[k>>2]=0;do{if((a[b]|0)==49){q=1;r=5}else{if((wg(b,9320)|0)!=0){q=1;r=5;break}if((wg(b,12368)|0)!=0){q=2;r=5;break}c[k>>2]=-1;s=-1}}while(0);a:do{if((r|0)==5){b=d+12|0;t=c[b>>2]|0;do{if((t|0)>=0){if((t|0)!=(c[d+16>>2]|0)){break}if((c[d>>2]|0)!=3){break}if((c[d+4>>2]|0)!=1){break}if((c[d+8>>2]|0)!=1){break}u=c[e+12>>2]|0;do{if((u|0)>=0){if((u|0)!=(c[e+16>>2]|0)){break}if((c[e>>2]|0)!=0){break}if((c[e+4>>2]|0)!=1){break}if((c[e+8>>2]|0)!=4){break}v=c[k>>2]|0;if((v|0)!=0){s=v;break a}h[g>>3]=0.0;if((t|0)==0|(u|0)==0){h[g>>3]=1.0;i=l;return}v=Tf(t*3|0)|0;w=pf(c[b>>2]|0)|0;if((v|0)==0|(w|0)==0){x=p|0;ob(x|0,6480,(y=i,i=i+24|0,c[y>>2]=4872,c[y+8>>2]=117,c[y+16>>2]=3688,y)|0)|0;i=y;Ze(x)}h[o>>3]=0.0;c[m>>2]=0;do{_f(b,v+(c[b>>2]<<3)|0,v,w,o,m)|0;x=c[m>>2]|0;if((x|0)==0){break}if((x|0)==(q|0)){xg(2984,2144,1664,d,e,v,j,k)|0;xg(1112,2144,13512,d,e,v,j,k)|0}else{xg(1112,12880,13512,d,e,v,j,k)|0;xg(2984,12880,1664,d,e,v,j,k)|0}}while((c[m>>2]|0)!=0);z=+h[o>>3];if(z!=0.0){h[g>>3]=1.0/z/f}lf(v);lf(w);i=l;return}}while(0);c[k>>2]=-3;s=-3;break a}}while(0);c[k>>2]=-2;s=-2}}while(0);c[n>>2]=-s;sf(9056,n)|0;i=l;return}function vf(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0.0,q=0,r=0.0,s=0,t=0,u=0,v=0.0,w=0,x=0.0,y=0.0,z=0,A=0.0,B=0,C=0,D=0,E=0,F=0,G=0.0,H=0.0;e=i;i=i+768|0;f=e|0;g=e+256|0;j=e+512|0;k=c[d+20>>2]|0;l=c[k+4>>2]|0;m=d+12|0;n=c[m>>2]|0;o=d+16|0;d=c[o>>2]|0;if((((n|0)<(d|0)?n:d)|0)==0){p=0.0;i=e;return+p}if((wg(b,8976)|0)!=0){d=c[o>>2]|0;if((d|0)<=0){p=0.0;i=e;return+p}n=c[k+12>>2]|0;q=0;r=0.0;s=c[n>>2]|0;while(1){t=q+1|0;u=c[n+(t<<2)>>2]|0;if((s|0)<(u|0)){v=r;w=s;while(1){x=+U(+(+h[l+(w<<3)>>3]));y=v>x?v:x;z=w+1|0;if((z|0)<(u|0)){v=y;w=z}else{A=y;break}}}else{A=r}if((t|0)<(d|0)){q=t;r=A;s=u}else{p=A;break}}i=e;return+p}do{if((wg(b,12352)|0)==0){if((a[b]|0)==49){break}if((wg(b,9008)|0)==0){do{if((wg(b,2976)|0)==0){if((wg(b,2136)|0)!=0){break}s=j|0;ob(s|0,6448,(B=i,i=i+24|0,c[B>>2]=1088,c[B+8>>2]=114,c[B+16>>2]=3672,B)|0)|0;i=B;Ze(s);p=0.0;i=e;return+p}}while(0);u=g|0;ob(u|0,6448,(B=i,i=i+24|0,c[B>>2]=1640,c[B+8>>2]=112,c[B+16>>2]=3672,B)|0)|0;i=B;Ze(u);p=0.0;i=e;return+p}u=kf(c[m>>2]<<3)|0;t=u;if((u|0)==0){s=f|0;ob(s|0,6448,(B=i,i=i+24|0,c[B>>2]=4808,c[B+8>>2]=97,c[B+16>>2]=3672,B)|0)|0;i=B;Ze(s)}s=c[m>>2]|0;if((s|0)>0){Gq(u|0,0,((s|0)>1?s<<3:8)|0)|0}s=c[o>>2]|0;if((s|0)>0){q=c[k+12>>2]|0;d=k+8|0;n=0;w=c[q>>2]|0;while(1){z=n+1|0;C=c[q+(z<<2)>>2]|0;if((w|0)<(C|0)){D=c[d>>2]|0;E=w;do{A=+U(+(+h[l+(E<<3)>>3]));F=t+(c[D+(E<<2)>>2]<<3)|0;h[F>>3]=A+ +h[F>>3];E=E+1|0;}while((E|0)<(C|0))}if((z|0)<(s|0)){n=z;w=C}else{break}}}w=c[m>>2]|0;if((w|0)>0){A=0.0;n=0;while(1){r=+h[t+(n<<3)>>3];v=A>r?A:r;s=n+1|0;if((s|0)<(w|0)){A=v;n=s}else{G=v;break}}}else{G=0.0}lf(u);p=G;i=e;return+p}}while(0);m=c[o>>2]|0;if((m|0)<=0){p=0.0;i=e;return+p}o=c[k+12>>2]|0;k=0;G=0.0;B=c[o>>2]|0;while(1){f=k+1|0;g=c[o+(f<<2)>>2]|0;if((B|0)<(g|0)){A=0.0;j=B;while(1){v=A+ +U(+(+h[l+(j<<3)>>3]));b=j+1|0;if((b|0)<(g|0)){A=v;j=b}else{H=v;break}}}else{H=0.0}A=G>H?G:H;if((f|0)<(m|0)){k=f;G=A;B=g}else{p=A;break}}i=e;return+p}function wf(a,b,d,e,f,g,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0.0,t=0.0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0.0,J=0.0,K=0,L=0,M=0.0,N=0.0,O=0.0,P=0,Q=0,R=0.0,S=0.0,T=0.0,V=0,W=0,X=0,Y=0,Z=0.0,_=0.0,$=0,aa=0,ba=0,ca=0;k=i;l=d;m=i;i=i+4|0;i=i+7&-8;c[j>>2]=0;n=a+12|0;o=c[n>>2]|0;do{if((o|0)>=0){p=a+16|0;q=c[p>>2]|0;if((q|0)<0){break}if((c[a>>2]|0)!=0){break}if((c[a+4>>2]|0)!=1){break}if((c[a+8>>2]|0)!=0){break}if((o|0)==0|(q|0)==0){h[e>>3]=1.0;h[f>>3]=1.0;h[g>>3]=0.0;i=k;return}q=c[a+20>>2]|0;r=c[q+4>>2]|0;s=+$f(12192);t=1.0/s;c[m>>2]=0;u=c[n>>2]|0;v=(u|0)>0;if(v){w=(u|0)>1;x=0;do{h[b+(x<<3)>>3]=0.0;x=x+1|0;}while((x|0)<(u|0));c[m>>2]=w?u:1}x=c[p>>2]|0;y=(x|0)>0;if(y){z=q+12|0;A=q+8|0;B=0;C=c[z>>2]|0;while(1){D=c[C+(B<<2)>>2]|0;c[m>>2]=D;E=B+1|0;F=c[z>>2]|0;if((D|0)<(c[F+(E<<2)>>2]|0)){G=c[A>>2]|0;H=D;while(1){D=b+(c[G+(H<<2)>>2]<<3)|0;I=+h[D>>3];J=+U(+(+h[r+(H<<3)>>3]));h[D>>3]=I>J?I:J;D=H+1|0;c[m>>2]=D;K=c[z>>2]|0;if((D|0)<(c[K+(E<<2)>>2]|0)){H=D}else{L=K;break}}}else{L=F}if((E|0)<(x|0)){B=E;C=L}else{break}}}c[m>>2]=0;if(v){C=(u|0)>1;B=0;J=t;I=0.0;do{M=+h[b+(B<<3)>>3];I=I>M?I:M;J=J<M?J:M;B=B+1|0;}while((B|0)<(u|0));c[m>>2]=C?u:1;N=J;O=I}else{N=t;O=0.0}h[g>>3]=O;c[m>>2]=0;a:do{if(N==0.0){if(v){P=0}else{break}while(1){Q=P+1|0;if(+h[b+(P<<3)>>3]==0.0){break}c[m>>2]=Q;if((Q|0)<(u|0)){P=Q}else{break a}}c[j>>2]=Q;i=k;return}else{if(v){E=(u|0)>1;F=0;do{M=+h[b+(F<<3)>>3];R=M>s?M:s;h[b+(F<<3)>>3]=1.0/(R<t?R:t);F=F+1|0;}while((F|0)<(u|0));c[m>>2]=E?u:1}h[e>>3]=(N>s?N:s)/(O<t?O:t)}}while(0);do{if(y){Gq(l|0,0,((x|0)>1?x<<3:8)|0)|0;u=c[p>>2]|0;v=(u|0)>0;if(!v){S=t;T=0.0;V=0;W=u;break}C=q+12|0;F=q+8|0;B=0;z=c[C>>2]|0;while(1){A=c[z+(B<<2)>>2]|0;c[m>>2]=A;w=B+1|0;H=c[C>>2]|0;if((A|0)<(c[H+(w<<2)>>2]|0)){G=c[F>>2]|0;K=d+(B<<3)|0;D=A;I=+h[K>>3];while(1){J=+U(+(+h[r+(D<<3)>>3]));R=J*+h[b+(c[G+(D<<2)>>2]<<3)>>3];J=I>R?I:R;h[K>>3]=J;A=D+1|0;c[m>>2]=A;X=c[C>>2]|0;if((A|0)<(c[X+(w<<2)>>2]|0)){D=A;I=J}else{Y=X;break}}}else{Y=H}if((w|0)<(u|0)){B=w;z=Y}else{break}}if(v){Z=t;_=0.0;$=0}else{S=t;T=0.0;V=0;W=u;break}while(1){I=+h[d+($<<3)>>3];J=_>I?_:I;R=Z<I?Z:I;z=$+1|0;if((z|0)<(u|0)){Z=R;_=J;$=z}else{S=R;T=J;V=1;W=u;break}}}else{S=t;T=0.0;V=0;W=x}}while(0);if(S==0.0){aa=0}else{if(V){x=0;do{r=d+(x<<3)|0;J=+h[r>>3];R=J>s?J:s;h[r>>3]=1.0/(R<t?R:t);x=x+1|0;}while((x|0)<(W|0))}h[f>>3]=(S>s?S:s)/(T<t?T:t);i=k;return}while(1){if((aa|0)>=(W|0)){ba=49;break}ca=aa+1|0;if(+h[d+(aa<<3)>>3]==0.0){break}else{aa=ca}}if((ba|0)==49){i=k;return}c[j>>2]=ca+(c[n>>2]|0);i=k;return}}while(0);c[j>>2]=-1;c[m>>2]=1;sf(8376,m)|0;i=k;return}function xf(b,d,e,f,g,i,j){b=b|0;d=d|0;e=e|0;f=+f;g=+g;i=+i;j=j|0;var k=0,l=0,m=0,n=0.0,o=0.0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;do{if((c[b+12>>2]|0)>=1){k=b+16|0;if((c[k>>2]|0)<1){break}l=c[b+20>>2]|0;m=c[l+4>>2]|0;n=+$f(8112);o=n/+$f(12136);p=g<.1;if(!(f<.1|o>i|1.0/o<i)){if(!p){a[j]=78;return}q=c[k>>2]|0;if((q|0)>0){r=c[l+12>>2]|0;s=0;t=c[r>>2]|0;while(1){o=+h[e+(s<<3)>>3];u=s+1|0;v=c[r+(u<<2)>>2]|0;if((t|0)<(v|0)){w=t;do{x=m+(w<<3)|0;h[x>>3]=o*+h[x>>3];w=w+1|0;}while((w|0)<(v|0))}if((u|0)<(q|0)){s=u;t=v}else{break}}}a[j]=67;return}t=c[k>>2]|0;s=(t|0)>0;if(p){if(s){q=c[l+12>>2]|0;r=l+8|0;w=0;x=c[q>>2]|0;while(1){o=+h[e+(w<<3)>>3];y=w+1|0;z=c[q+(y<<2)>>2]|0;if((x|0)<(z|0)){A=c[r>>2]|0;B=x;do{C=m+(B<<3)|0;h[C>>3]=+h[C>>3]*o*+h[d+(c[A+(B<<2)>>2]<<3)>>3];B=B+1|0;}while((B|0)<(z|0))}if((y|0)<(t|0)){w=y;x=z}else{break}}}a[j]=66;return}else{if(s){x=c[l+12>>2]|0;w=l+8|0;r=0;q=c[x>>2]|0;while(1){p=r+1|0;k=c[x+(p<<2)>>2]|0;if((q|0)<(k|0)){B=c[w>>2]|0;A=q;do{v=m+(A<<3)|0;h[v>>3]=+h[d+(c[B+(A<<2)>>2]<<3)>>3]*+h[v>>3];A=A+1|0;}while((A|0)<(k|0))}if((p|0)<(t|0)){r=p;q=k}else{break}}}a[j]=82;return}}}while(0);a[j]=78;return}function yf(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0.0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0.0,r=0.0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0.0,G=0.0,H=0.0,I=0.0,J=0,K=0.0,L=0.0,M=0.0,N=0.0,O=0;g=1.0/+$f(8064);i=c[b+20>>2]|0;j=c[e+20>>2]|0;e=c[f+20>>2]|0;f=c[i+4>>2]|0;k=c[j+8>>2]|0;l=c[e+4>>2]|0;m=b+16|0;b=kf(c[m>>2]<<2)|0;n=b;if((c[m>>2]|0)>0){o=0;do{c[n+(c[d+(o<<2)>>2]<<2)>>2]=o;o=o+1|0;}while((o|0)<(c[m>>2]|0))}m=c[j+4>>2]|0;o=j+28|0;d=j+20|0;p=j+12|0;j=i+12|0;i=e+12|0;q=g;e=0;while(1){if((e|0)>(m|0)){r=q;s=18;break}t=c[o>>2]|0;u=c[t+(e<<2)>>2]|0;v=c[d>>2]|0;w=(c[v+(u+1<<2)>>2]|0)-(c[v+(u<<2)>>2]|0)|0;v=e+1|0;x=c[t+(v<<2)>>2]|0;t=(u|0)<(a|0);if((u|0)<(x|0)&t){y=c[j>>2]|0;z=c[i>>2]|0;A=u;g=q;B=1;C=k+(c[(c[p>>2]|0)+(u<<2)>>2]<<3)|0;while(1){u=c[n+(A<<2)>>2]|0;D=c[y+(u<<2)>>2]|0;E=c[y+(u+1<<2)>>2]|0;if((D|0)<(E|0)){u=D;F=0.0;while(1){G=+U(+(+h[f+(u<<3)>>3]));H=F>G?F:G;D=u+1|0;if((D|0)<(E|0)){u=D;F=H}else{I=H;break}}}else{I=0.0}u=c[z+(A<<2)>>2]|0;E=A+1|0;D=c[z+(E<<2)>>2]|0;if((u|0)<(D|0)){J=u;F=0.0;while(1){H=+U(+(+h[l+(J<<3)>>3]));G=F>H?F:H;u=J+1|0;if((u|0)<(D|0)){J=u;F=G}else{K=G;break}}}else{K=0.0}if((B|0)>0){J=0;F=K;while(1){G=+U(+(+h[C+(J<<3)>>3]));H=F>G?F:G;D=J+1|0;if((D|0)<(B|0)){J=D;F=H}else{L=H;break}}}else{L=K}if(L==0.0){M=g<1.0?g:1.0}else{F=I/L;M=g<F?g:F}J=(E|0)<(a|0);if((E|0)<(x|0)&J){A=E;g=M;B=B+1|0;C=C+(w<<3)|0}else{N=M;O=J;break}}}else{N=q;O=t}if(O){q=N;e=v}else{r=N;s=18;break}}if((s|0)==18){lf(b);return+r}return 0.0}function zf(b,d,e,f,g,j,k,l,m,n,o,p,q,r,s){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;var t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0.0,ga=0.0,ha=0.0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0.0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0.0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0.0,Oa=0,Pa=0,Qa=0.0,Ra=0,Sa=0.0,Ta=0,Ua=0.0,Va=0.0,Wa=0,Xa=0.0,Ya=0,Za=0.0,_a=0,$a=0.0,ab=0;t=i;i=i+576|0;u=t|0;v=t+8|0;w=t+16|0;x=t+40|0;y=t+48|0;z=t+56|0;A=t+64|0;B=t+320|0;c[u>>2]=1;h[v>>3]=1.0;C=c[d+20>>2]|0;D=c[C+4>>2]|0;E=c[n+20>>2]|0;F=c[o+20>>2]|0;G=c[E+4>>2]|0;H=c[F+4>>2]|0;I=c[E>>2]|0;E=c[F>>2]|0;F=c[n+16>>2]|0;c[s>>2]=0;J=(b|0)==0;K=J^1;a:do{if((b-1|0)>>>0>1>>>0&K){c[s>>2]=-1;L=-1}else{M=d+12|0;N=c[M>>2]|0;O=d+16|0;do{if(!((N|0)!=(c[O>>2]|0)|(N|0)<0)){if((c[d>>2]|0)!=0){break}if((c[d+4>>2]|0)!=1){break}if((c[d+8>>2]|0)!=0){break}P=c[e+12>>2]|0;do{if(!((P|0)!=(c[e+16>>2]|0)|(P|0)<0)){if((c[e>>2]|0)!=3){break}if((c[e+4>>2]|0)!=1){break}if((c[e+8>>2]|0)!=1){break}Q=c[f+12>>2]|0;do{if(!((Q|0)!=(c[f+16>>2]|0)|(Q|0)<0)){if((c[f>>2]|0)!=0){break}if((c[f+4>>2]|0)!=1){break}if((c[f+8>>2]|0)!=4){break}do{if((I|0)>=(N|0)){R=n|0;if((c[R>>2]|0)!=6){break}S=n+4|0;if((c[S>>2]|0)!=1){break}T=n+8|0;if((c[T>>2]|0)!=0){break}do{if((E|0)>=(N|0)){if((c[o>>2]|0)!=6){break}if((c[o+4>>2]|0)!=1){break}if((c[o+8>>2]|0)!=0){break}if((N|0)==0|(F|0)==0){if((F|0)>0){V=0}else{i=t;return}do{h[p+(V<<3)>>3]=0.0;h[q+(V<<3)>>3]=0.0;V=V+1|0;}while((V|0)<(F|0));i=t;return}if((wg(k,12112)|0)==0){W=(wg(k,8984)|0)==0}else{W=0}if((wg(k,6440)|0)==0){X=(wg(k,8984)|0)==0}else{X=0}Y=Sf(c[M>>2]<<1)|0;Z=kf(c[M>>2]<<3)|0;_=Z;$=pf(c[M>>2]<<1)|0;if((Y|0)==0|(Z|0)==0|($|0)==0){aa=A|0;ob(aa|0,4776,(ba=i,i=i+24|0,c[ba>>2]=3632,c[ba+8>>2]=222,c[ba+16>>2]=2960,ba)|0)|0;i=ba;Ze(aa)}aa=z|0;ca=J&1;a[aa]=J?78:84;da=(c[O>>2]|0)+1|0;ea=+$f(2128);ga=+(da|0)*+$f(1624);ha=ga/ea;c[y>>2]=0;if((c[M>>2]|0)>0){da=0;do{c[$+(da<<2)>>2]=0;da=(c[y>>2]|0)+1|0;c[y>>2]=da;}while((da|0)<(c[M>>2]|0))}da=c[O>>2]|0;ia=(da|0)>0;do{if(J){if(!ia){break}ja=C+12|0;ka=C+8|0;la=0;ma=c[ja>>2]|0;na=da;while(1){oa=c[ma+(la<<2)>>2]|0;c[y>>2]=oa;pa=la+1|0;qa=c[ja>>2]|0;if((oa|0)<(c[qa+(pa<<2)>>2]|0)){ra=c[ka>>2]|0;sa=oa;do{oa=$+(c[ra+(sa<<2)>>2]<<2)|0;c[oa>>2]=(c[oa>>2]|0)+1;sa=(c[y>>2]|0)+1|0;c[y>>2]=sa;ta=c[ja>>2]|0;}while((sa|0)<(c[ta+(pa<<2)>>2]|0));ua=ta;va=c[O>>2]|0}else{ua=qa;va=na}if((pa|0)<(va|0)){la=pa;ma=ua;na=va}else{break}}}else{if(!ia){break}na=c[C+12>>2]|0;ma=0;while(1){la=ma+1|0;c[$+(ma<<2)>>2]=(c[na+(la<<2)>>2]|0)-(c[na+(ma<<2)>>2]|0);if((la|0)<(c[O>>2]|0)){ma=la}else{break}}}}while(0);c[w>>2]=c[R>>2];c[w+4>>2]=c[S>>2];c[w+8>>2]=c[T>>2];c[w+12>>2]=c[n+12>>2];c[w+16>>2]=1;ia=kf(8)|0;da=w+20|0;c[da>>2]=ia;if((ia|0)==0){ma=B|0;ob(ma|0,4776,(ba=i,i=i+24|0,c[ba>>2]=1048,c[ba+8>>2]=259,c[ba+16>>2]=2960,ba)|0)|0;i=ba;Ze(ma);wa=c[da>>2]|0}else{wa=ia}c[wa>>2]=I;ia=Y;c[wa+4>>2]=ia;if((F|0)>0){ma=C+12|0;na=C+8|0;la=r+16|0;ja=X|K;ka=J|W;sa=0;do{ra=fa(sa,I)|0;oa=G+(ra<<3)|0;xa=fa(sa,E)|0;ya=H+(xa<<3)|0;za=q+(sa<<3)|0;Aa=0;Ba=3.0;while(1){Eg(M,oa,u,Y,u)|0;Ca=c[u>>2]|0;yg(aa,-1.0,d,ya,Ca,+h[v>>3],Y,Ca)|0;c[y>>2]=0;Ca=c[M>>2]|0;Da=(Ca|0)>0;if(Da){Ea=(Ca|0)>1;Fa=0;do{h[_+(Fa<<3)>>3]=+U(+(+h[G+(Fa+ra<<3)>>3]));Fa=Fa+1|0;}while((Fa|0)<(Ca|0));c[y>>2]=Ea?Ca:1}Fa=c[O>>2]|0;pa=(Fa|0)>0;do{if(J){if(!pa){break}qa=0;Ga=c[ma>>2]|0;while(1){Ha=+U(+(+h[H+(qa+xa<<3)>>3]));Ia=c[Ga+(qa<<2)>>2]|0;c[y>>2]=Ia;Ja=qa+1|0;Ka=c[ma>>2]|0;if((Ia|0)<(c[Ka+(Ja<<2)>>2]|0)){La=c[na>>2]|0;Ma=Ia;while(1){Na=Ha*+U(+(+h[D+(Ma<<3)>>3]));Ia=_+(c[La+(Ma<<2)>>2]<<3)|0;h[Ia>>3]=Na+ +h[Ia>>3];Ia=Ma+1|0;c[y>>2]=Ia;Oa=c[ma>>2]|0;if((Ia|0)<(c[Oa+(Ja<<2)>>2]|0)){Ma=Ia}else{Pa=Oa;break}}}else{Pa=Ka}if((Ja|0)<(Fa|0)){qa=Ja;Ga=Pa}else{break}}}else{if(!pa){break}Ga=0;qa=c[ma>>2]|0;while(1){Ma=c[qa+(Ga<<2)>>2]|0;c[y>>2]=Ma;La=Ga+1|0;Oa=c[ma>>2]|0;if((Ma|0)<(c[Oa+(La<<2)>>2]|0)){Ia=Ma;Ha=0.0;while(1){Na=+U(+(+h[D+(Ia<<3)>>3]));Qa=Ha+Na*+U(+(+h[H+((c[(c[na>>2]|0)+(Ia<<2)>>2]|0)+xa<<3)>>3]));Ma=Ia+1|0;c[y>>2]=Ma;Ra=c[ma>>2]|0;if((Ma|0)<(c[Ra+(La<<2)>>2]|0)){Ia=Ma;Ha=Qa}else{Sa=Qa;Ta=Ra;break}}}else{Sa=0.0;Ta=Oa}Ia=_+(Ga<<3)|0;h[Ia>>3]=Sa+ +h[Ia>>3];if((La|0)<(Fa|0)){Ga=La;qa=Ta}else{break}}}}while(0);c[y>>2]=0;if(Da){Fa=(Ca|0)>1;Ha=0.0;pa=0;while(1){Qa=+h[_+(pa<<3)>>3];do{if(Qa>ha){Na=+U(+(+h[Y+(pa<<3)>>3]))/Qa;Ua=Ha>Na?Ha:Na}else{if(!(Qa!=0.0)){Ua=Ha;break}Na=(ga+ +U(+(+h[Y+(pa<<3)>>3])))/Qa;Ua=Ha>Na?Ha:Na}}while(0);Ea=pa+1|0;if((Ea|0)<(Ca|0)){Ha=Ua;pa=Ea}else{break}}c[y>>2]=Fa?Ca:1;Va=Ua}else{Va=0.0}h[za>>3]=Va;if(!(Va*2.0<=Ba&Va>ea&(Aa|0)<5)){break}Bf(b,e,f,g,j,w,r,s);Dg(M,v,Y,u,ya,u)|0;Aa=Aa+1|0;Ba=+h[za>>3]}c[la>>2]=Aa;c[y>>2]=0;za=c[M>>2]|0;ya=(za|0)>0;if(ya){oa=(za|0)>1;pa=0;do{h[_+(pa<<3)>>3]=+U(+(+h[G+(pa+ra<<3)>>3]));pa=pa+1|0;}while((pa|0)<(za|0));c[y>>2]=oa?za:1}pa=c[O>>2]|0;ra=(pa|0)>0;do{if(J){if(!ra){break}Aa=0;Da=c[ma>>2]|0;while(1){Ba=+U(+(+h[H+(Aa+xa<<3)>>3]));Ea=c[Da+(Aa<<2)>>2]|0;c[y>>2]=Ea;qa=Aa+1|0;Ga=c[ma>>2]|0;if((Ea|0)<(c[Ga+(qa<<2)>>2]|0)){Ia=c[na>>2]|0;Ja=Ea;while(1){Ha=Ba*+U(+(+h[D+(Ja<<3)>>3]));Ea=_+(c[Ia+(Ja<<2)>>2]<<3)|0;h[Ea>>3]=Ha+ +h[Ea>>3];Ea=Ja+1|0;c[y>>2]=Ea;Ka=c[ma>>2]|0;if((Ea|0)<(c[Ka+(qa<<2)>>2]|0)){Ja=Ea}else{Wa=Ka;break}}}else{Wa=Ga}if((qa|0)<(pa|0)){Aa=qa;Da=Wa}else{break}}}else{if(!ra){break}Da=0;Aa=c[ma>>2]|0;while(1){Ca=c[Aa+(Da<<2)>>2]|0;c[y>>2]=Ca;Fa=Da+1|0;Ja=c[ma>>2]|0;if((Ca|0)<(c[Ja+(Fa<<2)>>2]|0)){Ia=Ca;Ba=0.0;while(1){Ha=+U(+(+h[H+((c[(c[na>>2]|0)+(Ia<<2)>>2]|0)+xa<<3)>>3]));Qa=Ba+Ha*+U(+(+h[D+(Ia<<3)>>3]));Ca=Ia+1|0;c[y>>2]=Ca;Ka=c[ma>>2]|0;if((Ca|0)<(c[Ka+(Fa<<2)>>2]|0)){Ia=Ca;Ba=Qa}else{Xa=Qa;Ya=Ka;break}}}else{Xa=0.0;Ya=Ja}Ia=_+(Da<<3)|0;h[Ia>>3]=Xa+ +h[Ia>>3];if((Fa|0)<(pa|0)){Da=Fa;Aa=Ya}else{break}}}}while(0);c[y>>2]=0;if(ya){pa=0;while(1){ra=_+(pa<<3)|0;Ba=+h[ra>>3];Qa=+U(+(+h[Y+(pa<<3)>>3]));Ha=Qa+Ba*ea*+((c[$+(pa<<2)>>2]|0)+1|0);if(Ba>ha){Za=Ha}else{Za=ga+Ha}h[ra>>3]=Za;ra=pa+1|0;c[y>>2]=ra;oa=c[M>>2]|0;if((ra|0)<(oa|0)){pa=ra}else{_a=oa;break}}}else{_a=za}c[x>>2]=0;pa=p+(sa<<3)|0;ya=_a;b:while(1){_f(M,Y+(ya<<3)|0,Y,$+(ya<<2)|0,pa,x)|0;oa=c[x>>2]|0;do{if((oa|0)==0){break b}else if((oa|0)==1){do{if(ja){if(ka){break}c[y>>2]=0;ra=c[M>>2]|0;if((ra|0)<=0){break}Aa=(ra|0)>1;Da=0;do{Ia=Y+(Da<<3)|0;h[Ia>>3]=+h[l+(Da<<3)>>3]*+h[Ia>>3];Da=Da+1|0;}while((Da|0)<(ra|0));c[y>>2]=Aa?ra:1}else{c[y>>2]=0;Da=c[O>>2]|0;if((Da|0)<=0){break}La=(Da|0)>1;Oa=0;do{Ia=Y+(Oa<<3)|0;h[Ia>>3]=+h[m+(Oa<<3)>>3]*+h[Ia>>3];Oa=Oa+1|0;}while((Oa|0)<(Da|0));c[y>>2]=La?Da:1}}while(0);Bf(ca,e,f,g,j,w,r,s);c[y>>2]=0;Fa=c[M>>2]|0;if((Fa|0)<=0){break}Ja=(Fa|0)>1;Oa=0;do{ra=Y+(Oa<<3)|0;h[ra>>3]=+h[_+(Oa<<3)>>3]*+h[ra>>3];Oa=Oa+1|0;}while((Oa|0)<(Fa|0));c[y>>2]=Ja?Fa:1}else{c[y>>2]=0;Oa=c[M>>2]|0;if((Oa|0)>0){ra=(Oa|0)>1;Aa=0;do{Ia=Y+(Aa<<3)|0;h[Ia>>3]=+h[_+(Aa<<3)>>3]*+h[Ia>>3];Aa=Aa+1|0;}while((Aa|0)<(Oa|0));c[y>>2]=ra?Oa:1}Bf(b,e,f,g,j,w,r,s);if(!ja){c[y>>2]=0;Aa=c[O>>2]|0;if((Aa|0)<=0){break}Fa=(Aa|0)>1;Ja=0;do{Ia=Y+(Ja<<3)|0;h[Ia>>3]=+h[m+(Ja<<3)>>3]*+h[Ia>>3];Ja=Ja+1|0;}while((Ja|0)<(Aa|0));c[y>>2]=Fa?Aa:1;break}if(ka){break}c[y>>2]=0;Ja=c[O>>2]|0;if((Ja|0)<=0){break}Oa=(Ja|0)>1;ra=0;do{Ia=Y+(ra<<3)|0;h[Ia>>3]=+h[l+(ra<<3)>>3]*+h[Ia>>3];ra=ra+1|0;}while((ra|0)<(Ja|0));c[y>>2]=Oa?Ja:1}}while(0);if((c[x>>2]|0)==0){break}ya=c[M>>2]|0}c[y>>2]=0;ya=c[M>>2]|0;za=(ya|0)>0;do{if(ja){if(ka){if(!za){break}oa=(ya|0)>1;ra=0;Ha=0.0;do{Ba=+U(+(+h[H+(ra+xa<<3)>>3]));Ha=Ha>Ba?Ha:Ba;ra=ra+1|0;}while((ra|0)<(ya|0));c[y>>2]=oa?ya:1;$a=Ha;ab=148;break}else{if(!za){break}ra=(ya|0)>1;Aa=0;Ba=0.0;do{Qa=+h[l+(Aa<<3)>>3]*+U(+(+h[H+(Aa+xa<<3)>>3]));Ba=Ba>Qa?Ba:Qa;Aa=Aa+1|0;}while((Aa|0)<(ya|0));c[y>>2]=ra?ya:1;$a=Ba;ab=148;break}}else{if(!za){break}Aa=(ya|0)>1;oa=0;Ha=0.0;do{Qa=+h[m+(oa<<3)>>3]*+U(+(+h[H+(oa+xa<<3)>>3]));Ha=Ha>Qa?Ha:Qa;oa=oa+1|0;}while((oa|0)<(ya|0));c[y>>2]=Aa?ya:1;$a=Ha;ab=148}}while(0);do{if((ab|0)==148){ab=0;if(!($a!=0.0)){break}h[pa>>3]=+h[pa>>3]/$a}}while(0);sa=sa+1|0;}while((sa|0)<(F|0))}lf(ia);lf(Z);lf($);lf(c[da>>2]|0);i=t;return}}while(0);c[s>>2]=-11;L=-11;break a}}while(0);c[s>>2]=-10;L=-10;break a}}while(0);c[s>>2]=-4;L=-4;break a}}while(0);c[s>>2]=-3;L=-3;break a}}while(0);c[s>>2]=-2;L=-2}}while(0);c[y>>2]=-L;sf(7904,y)|0;i=t;return}function Af(a,b,d,e,f,j,k,l,m,n,o,p,q){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;var r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0.0,L=0,M=0.0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0;r=i;i=i+144|0;s=r|0;t=r+8|0;u=r+16|0;v=r+24|0;w=r+32|0;x=r+40|0;y=r+48|0;z=r+56|0;A=r+64|0;B=r+72|0;C=r+80|0;D=r+88|0;E=r+96|0;F=r+104|0;G=r+112|0;H=r+120|0;I=r+128|0;J=r+136|0;K=+(rf(6)|0);L=c[a>>2]|0;M=+h[a+24>>3];N=c[p>>2]|0;O=c[p+8>>2]|0;P=b+12|0;Q=c[P>>2]|0;R=c[b+16>>2]|0;S=(Q|0)<(R|0)?Q:R;T=c[b+20>>2]|0;U=c[T+4>>2]|0;V=c[T+8>>2]|0;W=c[T+12>>2]|0;X=c[T+16>>2]|0;Y=Mf(L,j,k,Q,R,c[T>>2]|0,e,K,n,o,23864,s,t)|0;c[q>>2]=Y;if((Y|0)!=0){i=r;return}Y=c[5966]|0;T=c[5967]|0;k=c[5969]|0;j=c[5971]|0;Z=c[5974]|0;mf(Q,R,e,c[s>>2]|0,u,w,x,v,y,z,A);Pf(Q,e,c[t>>2]|0,B,C);_=(L|0)==2;c[H>>2]=_&1;do{if(_){L=pf(Q)|0;if((Q|0)>0){$=0}else{aa=L;ba=1;break}while(1){c[L+(c[m+($<<2)>>2]<<2)>>2]=$;ca=$+1|0;if((ca|0)<(Q|0)){$=ca}else{aa=L;ba=1;break}}}else{aa=0;ba=0}}while(0);$=pf(R)|0;if((R|0)>0){L=0;do{c[$+(c[l+(L<<2)>>2]<<2)>>2]=L;L=L+1|0;}while((L|0)<(R|0))}L=pf(R)|0;l=c[A>>2]|0;if((c[a+32>>2]|0)==1){sg(R,f,d,l,L)}else{rg(R,f,d,l,L)}jf(m