Skip to content

Instantly share code, notes, and snippets.

@lxe
Last active November 1, 2016 13:23
Show Gist options
  • Select an option

  • Save lxe/2e13e209113a8a47a525 to your computer and use it in GitHub Desktop.

Select an option

Save lxe/2e13e209113a8a47a525 to your computer and use it in GitHub Desktop.
hello-world-emscripten-closurecompiled.js
// Original Source:
// #include <stdio.h>
//
// int main(int argc, char **argv) {
// printf("Hello World\n");
// return 0;
// }
//
var Module;
Module || (Module = ("undefined" !== typeof Module ? Module : null) || {});
var moduleOverrides = {}, key;
for (key in Module) {
Module.hasOwnProperty(key) && (moduleOverrides[key] = Module[key]);
}
var ENVIRONMENT_IS_NODE = "object" === typeof process && "function" === typeof require, ENVIRONMENT_IS_WEB = "object" === typeof window, ENVIRONMENT_IS_WORKER = "function" === typeof importScripts, ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
if (ENVIRONMENT_IS_NODE) {
Module.print || (Module.print = function(a) {
process.stdout.write(a + "\n");
});
Module.printErr || (Module.printErr = function(a) {
process.stderr.write(a + "\n");
});
var nodeFS = require("fs"), nodePath = require("path");
Module.read = function(a, b) {
a = nodePath.normalize(a);
var d = nodeFS.readFileSync(a);
d || a == nodePath.resolve(a) || (a = path.join(__dirname, "..", "src", a), d = nodeFS.readFileSync(a));
d && !b && (d = d.toString());
return d;
};
Module.readBinary = function(a) {
return Module.read(a, !0);
};
Module.load = function(a) {
globalEval(read(a));
};
Module.thisProgram = 1 < process.argv.length ? process.argv[1].replace(/\\/g, "/") : "unknown-program";
Module.arguments = process.argv.slice(2);
"undefined" !== typeof module && (module.exports = Module);
process.on("uncaughtException", function(a) {
if (!(a instanceof ExitStatus)) {
throw a;
}
});
} else {
if (ENVIRONMENT_IS_SHELL) {
Module.print || (Module.print = print), "undefined" != typeof printErr && (Module.printErr = printErr), Module.read = "undefined" != typeof read ? read : function() {
throw "no read() available (jsc?)";
}, Module.readBinary = function(a) {
if ("function" === typeof readbuffer) {
return new Uint8Array(readbuffer(a));
}
a = read(a, "binary");
assert("object" === typeof a);
return a;
}, "undefined" != typeof scriptArgs ? Module.arguments = scriptArgs : "undefined" != typeof arguments && (Module.arguments = arguments), this.Module = Module;
} else {
if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
Module.read = function(a) {
var b = new XMLHttpRequest;
b.open("GET", a, !1);
b.send(null);
return b.responseText;
};
"undefined" != typeof arguments && (Module.arguments = arguments);
if ("undefined" !== typeof console) {
Module.print || (Module.print = function(a) {
console.log(a);
}), Module.printErr || (Module.printErr = function(a) {
console.log(a);
});
} else {
var TRY_USE_DUMP = !1;
Module.print || (Module.print = TRY_USE_DUMP && "undefined" !== typeof dump ? function(a) {
dump(a);
} : function(a) {
});
}
ENVIRONMENT_IS_WEB ? window.Module = Module : Module.load = importScripts;
} else {
throw "Unknown runtime environment. Where are we?";
}
}
}
function globalEval(a) {
eval.call(null, a);
}
!Module.load && Module.read && (Module.load = function(a) {
globalEval(Module.read(a));
});
Module.print || (Module.print = function() {
});
Module.printErr || (Module.printErr = Module.print);
Module.arguments || (Module.arguments = []);
Module.thisProgram || (Module.thisProgram = "./this.program");
Module.print = Module.print;
Module.printErr = Module.printErr;
Module.preRun = [];
Module.postRun = [];
for (key in moduleOverrides) {
moduleOverrides.hasOwnProperty(key) && (Module[key] = moduleOverrides[key]);
}
var Runtime = {setTempRet0:function(a) {
tempRet0 = a;
}, getTempRet0:function() {
return tempRet0;
}, stackSave:function() {
return STACKTOP;
}, stackRestore:function(a) {
STACKTOP = a;
}, getNativeTypeSize:function(a) {
switch(a) {
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:
return "*" === a[a.length - 1] ? Runtime.QUANTUM_SIZE : "i" === a[0] ? (a = parseInt(a.substr(1)), assert(0 === a % 8), a / 8) : 0;
}
}, getNativeFieldSize:function(a) {
return Math.max(Runtime.getNativeTypeSize(a), Runtime.QUANTUM_SIZE);
}, STACK_ALIGN:16, getAlignSize:function(a, b, d) {
return d || "i64" != a && "double" != a ? a ? Math.min(b || (a ? Runtime.getNativeFieldSize(a) : 0), Runtime.QUANTUM_SIZE) : Math.min(b, 8) : 8;
}, dynCall:function(a, b, d) {
if (d && d.length) {
return assert(d.length == a.length - 1), d.splice || (d = Array.prototype.slice.call(d)), d.splice(0, 0, b), assert("dynCall_" + a in Module, "bad function pointer type - no table for sig '" + a + "'"), Module["dynCall_" + a].apply(null, d);
}
assert(1 == a.length);
assert("dynCall_" + a in Module, "bad function pointer type - no table for sig '" + a + "'");
return Module["dynCall_" + a].call(null, b);
}, functionPointers:[], addFunction:function(a) {
for (var b = 0;b < Runtime.functionPointers.length;b++) {
if (!Runtime.functionPointers[b]) {
return Runtime.functionPointers[b] = a, 2 * (1 + b);
}
}
throw "Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.";
}, removeFunction:function(a) {
Runtime.functionPointers[(a - 2) / 2] = null;
}, getAsmConst:function(a, b) {
Runtime.asmConstCache || (Runtime.asmConstCache = {});
var d = Runtime.asmConstCache[a];
if (d) {
return d;
}
for (var d = [], e = 0;e < b;e++) {
d.push(String.fromCharCode(36) + e);
}
e = Pointer_stringify(a);
'"' === e[0] && (e.indexOf('"', 1) === e.length - 1 ? e = e.substr(1, e.length - 2) : abort("invalid EM_ASM input |" + e + "|. Please use EM_ASM(..code..) (no quotes) or EM_ASM({ ..code($0).. }, input) (to input values)"));
try {
var c = eval("(function(Module, FS) { return function(" + d.join(",") + "){ " + e + " } })")(Module, "undefined" !== typeof FS ? FS : null);
} catch (f) {
throw Module.printErr("error in executing inline EM_ASM code: " + f + " on: \n\n" + e + "\n\nwith args |" + d + "| (make sure to use the right one out of EM_ASM, EM_ASM_ARGS, etc.)"), f;
}
return Runtime.asmConstCache[a] = c;
}, warnOnce:function(a) {
Runtime.warnOnce.shown || (Runtime.warnOnce.shown = {});
Runtime.warnOnce.shown[a] || (Runtime.warnOnce.shown[a] = 1, Module.printErr(a));
}, funcWrappers:{}, getFuncWrapper:function(a, b) {
assert(b);
Runtime.funcWrappers[b] || (Runtime.funcWrappers[b] = {});
var d = Runtime.funcWrappers[b];
d[a] || (d[a] = function() {
return Runtime.dynCall(b, a, arguments);
});
return d[a];
}, UTF8Processor:function() {
var a = [], b = 0;
this.processCChar = function(d) {
d &= 255;
if (0 == a.length) {
if (0 == (d & 128)) {
return String.fromCharCode(d);
}
a.push(d);
b = 192 == (d & 224) ? 1 : 224 == (d & 240) ? 2 : 3;
return "";
}
if (b && (a.push(d), b--, 0 < b)) {
return "";
}
d = a[0];
var e = a[1], c = a[2], f = a[3];
2 == a.length ? d = String.fromCharCode((d & 31) << 6 | e & 63) : 3 == a.length ? d = String.fromCharCode((d & 15) << 12 | (e & 63) << 6 | c & 63) : (d = (d & 7) << 18 | (e & 63) << 12 | (c & 63) << 6 | f & 63, d = String.fromCharCode(((d - 65536) / 1024 | 0) + 55296, (d - 65536) % 1024 + 56320));
a.length = 0;
return d;
};
this.processJSString = function(a) {
a = unescape(encodeURIComponent(a));
for (var b = [], c = 0;c < a.length;c++) {
b.push(a.charCodeAt(c));
}
return b;
};
}, getCompilerSetting:function(a) {
throw "You must build with -s RETAIN_COMPILER_SETTINGS=1 for Runtime.getCompilerSetting or emscripten_get_compiler_setting to work";
}, stackAlloc:function(a) {
var b = STACKTOP;
STACKTOP = STACKTOP + a | 0;
STACKTOP = STACKTOP + 15 & -16;
assert((STACKTOP | 0) < (STACK_MAX | 0) | 0) | 0;
return b;
}, staticAlloc:function(a) {
var b = STATICTOP;
STATICTOP = STATICTOP + (assert(!staticSealed), a) | 0;
STATICTOP = STATICTOP + 15 & -16;
return b;
}, dynamicAlloc:function(a) {
var b = DYNAMICTOP;
DYNAMICTOP = DYNAMICTOP + (assert(0 < DYNAMICTOP), a) | 0;
DYNAMICTOP = DYNAMICTOP + 15 & -16;
DYNAMICTOP >= TOTAL_MEMORY && enlargeMemory();
return b;
}, alignMemory:function(a, b) {
return Math.ceil(a / (b ? b : 16)) * (b ? b : 16);
}, makeBigInt:function(a, b, d) {
return d ? +(a >>> 0) + 4294967296 * +(b >>> 0) : +(a >>> 0) + 4294967296 * +(b | 0);
}, GLOBAL_BASE:8, QUANTUM_SIZE:4, __dummy__:0};
Module.Runtime = Runtime;
var __THREW__ = 0, ABORT = !1, EXITSTATUS = 0, undef = 0, tempValue, tempInt, tempBigInt, tempInt2, tempBigInt2, tempPair, tempBigIntI, tempBigIntR, tempBigIntS, tempBigIntP, tempBigIntD, tempDouble, tempFloat, tempI64, tempI64b, tempRet0, tempRet1, tempRet2, tempRet3, tempRet4, tempRet5, tempRet6, tempRet7, tempRet8, tempRet9;
function assert(a, b) {
a || abort("Assertion failed: " + b);
}
var globalScope = this;
function getCFunc(a) {
var b = Module["_" + a];
if (!b) {
try {
b = eval("_" + a);
} catch (d) {
}
}
assert(b, "Cannot call unknown function " + a + " (perhaps LLVM optimizations or closure removed it?)");
return b;
}
var cwrap, ccall;
(function() {
function a(a) {
a = a.toString().match(e).slice(1);
return{arguments:a[0], body:a[1], returnValue:a[2]};
}
var b = {stackSave:function() {
Runtime.stackSave();
}, stackRestore:function() {
Runtime.stackRestore();
}, arrayToC:function(a) {
var b = Runtime.stackAlloc(a.length);
writeArrayToMemory(a, b);
return b;
}, stringToC:function(a) {
var b = 0;
null !== a && void 0 !== a && 0 !== a && (b = Runtime.stackAlloc((a.length << 2) + 1), writeStringToMemory(a, b));
return b;
}}, d = {string:b.stringToC, array:b.arrayToC};
ccall = function(a, b, c, e) {
var f = getCFunc(a), k = [];
a = 0;
assert("array" !== b, 'Return type should not be "array".');
if (e) {
for (var r = 0;r < e.length;r++) {
var B = d[c[r]];
B ? (0 === a && (a = Runtime.stackSave()), k[r] = B(e[r])) : k[r] = e[r];
}
}
c = f.apply(null, k);
"string" === b && (c = Pointer_stringify(c));
0 !== a && Runtime.stackRestore(a);
return c;
};
var e = /^function\s*\(([^)]*)\)\s*{\s*([^*]*?)[\s;]*(?:return\s*(.*?)[;\s]*)?}$/, c = {}, f;
for (f in b) {
b.hasOwnProperty(f) && (c[f] = a(b[f]));
}
cwrap = function(b, d, e) {
e = e || [];
var f = getCFunc(b);
b = e.every(function(a) {
return "number" === a;
});
var p = "string" !== d;
if (p && b) {
return f;
}
var k = e.map(function(a, b) {
return "$" + b;
});
d = "(function(" + k.join(",") + ") {";
var r = e.length;
if (!b) {
d += "var stack = " + c.stackSave.body + ";";
for (var B = 0;B < r;B++) {
var K = k[B], z = e[B];
"number" !== z && (z = c[z + "ToC"], d += "var " + z.arguments + " = " + K + ";", d += z.body + ";", d += K + "=" + z.returnValue + ";");
}
}
e = a(function() {
return f;
}).returnValue;
d += "var ret = " + e + "(" + k.join(",") + ");";
p || (e = a(function() {
return Pointer_stringify;
}).returnValue, d += "ret = " + e + "(ret);");
b || (d += c.stackRestore.body.replace("()", "(stack)") + ";");
return eval(d + "return ret})");
};
})();
Module.cwrap = cwrap;
Module.ccall = ccall;
function setValue(a, b, d, e) {
d = d || "i8";
"*" === d.charAt(d.length - 1) && (d = "i32");
switch(d) {
case "i1":
HEAP8[a >> 0] = b;
break;
case "i8":
HEAP8[a >> 0] = b;
break;
case "i16":
HEAP16[a >> 1] = b;
break;
case "i32":
HEAP32[a >> 2] = b;
break;
case "i64":
tempI64 = [b >>> 0, (tempDouble = b, 1 <= +Math_abs(tempDouble) ? 0 < tempDouble ? (Math_min(+Math_floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math_ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0)];
HEAP32[a >> 2] = tempI64[0];
HEAP32[a + 4 >> 2] = tempI64[1];
break;
case "float":
HEAPF32[a >> 2] = b;
break;
case "double":
HEAPF64[a >> 3] = b;
break;
default:
abort("invalid type for setValue: " + d);
}
}
Module.setValue = setValue;
function getValue(a, b, d) {
b = b || "i8";
"*" === b.charAt(b.length - 1) && (b = "i32");
switch(b) {
case "i1":
return HEAP8[a >> 0];
case "i8":
return HEAP8[a >> 0];
case "i16":
return HEAP16[a >> 1];
case "i32":
return HEAP32[a >> 2];
case "i64":
return HEAP32[a >> 2];
case "float":
return HEAPF32[a >> 2];
case "double":
return HEAPF64[a >> 3];
default:
abort("invalid type for setValue: " + b);
}
return null;
}
Module.getValue = getValue;
var ALLOC_NORMAL = 0, ALLOC_STACK = 1, ALLOC_STATIC = 2, ALLOC_DYNAMIC = 3, ALLOC_NONE = 4;
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;
function allocate(a, b, d, e) {
var c, f;
"number" === typeof a ? (c = !0, f = a) : (c = !1, f = a.length);
var g = "string" === typeof b ? b : null;
d = d == ALLOC_NONE ? e : [_malloc, Runtime.stackAlloc, Runtime.staticAlloc, Runtime.dynamicAlloc][void 0 === d ? ALLOC_STATIC : d](Math.max(f, g ? 1 : b.length));
if (c) {
e = d;
assert(0 == (d & 3));
for (a = d + (f & -4);e < a;e += 4) {
HEAP32[e >> 2] = 0;
}
for (a = d + f;e < a;) {
HEAP8[e++ >> 0] = 0;
}
return d;
}
if ("i8" === g) {
return a.subarray || a.slice ? HEAPU8.set(a, d) : HEAPU8.set(new Uint8Array(a), d), d;
}
e = 0;
for (var h, l;e < f;) {
var n = a[e];
"function" === typeof n && (n = Runtime.getFunctionIndex(n));
c = g || b[e];
0 === c ? e++ : (assert(c, "Must know what type to store in allocate!"), "i64" == c && (c = "i32"), setValue(d + e, n, c), l !== c && (h = Runtime.getNativeTypeSize(c), l = c), e += h);
}
return d;
}
Module.allocate = allocate;
function Pointer_stringify(a, b) {
if (0 === b || !a) {
return "";
}
for (var d = !1, e, c = 0;;) {
assert(a + c < TOTAL_MEMORY);
e = HEAPU8[a + c >> 0];
if (128 <= e) {
d = !0;
} else {
if (0 == e && !b) {
break;
}
}
c++;
if (b && c == b) {
break;
}
}
b || (b = c);
var f = "";
if (!d) {
for (;0 < b;) {
e = String.fromCharCode.apply(String, HEAPU8.subarray(a, a + Math.min(b, 1024))), f = f ? f + e : e, a += 1024, b -= 1024;
}
return f;
}
d = new Runtime.UTF8Processor;
for (c = 0;c < b;c++) {
assert(a + c < TOTAL_MEMORY), e = HEAPU8[a + c >> 0], f += d.processCChar(e);
}
return f;
}
Module.Pointer_stringify = Pointer_stringify;
function UTF16ToString(a) {
for (var b = 0, d = "";;) {
var e = HEAP16[a + 2 * b >> 1];
if (0 == e) {
return d;
}
++b;
d += String.fromCharCode(e);
}
}
Module.UTF16ToString = UTF16ToString;
function stringToUTF16(a, b) {
for (var d = 0;d < a.length;++d) {
var e = a.charCodeAt(d);
HEAP16[b + 2 * d >> 1] = e;
}
HEAP16[b + 2 * a.length >> 1] = 0;
}
Module.stringToUTF16 = stringToUTF16;
function UTF32ToString(a) {
for (var b = 0, d = "";;) {
var e = HEAP32[a + 4 * b >> 2];
if (0 == e) {
return d;
}
++b;
65536 <= e ? (e -= 65536, d += String.fromCharCode(55296 | e >> 10, 56320 | e & 1023)) : d += String.fromCharCode(e);
}
}
Module.UTF32ToString = UTF32ToString;
function stringToUTF32(a, b) {
for (var d = 0, e = 0;e < a.length;++e) {
var c = a.charCodeAt(e);
if (55296 <= c && 57343 >= c) {
var f = a.charCodeAt(++e), c = 65536 + ((c & 1023) << 10) | f & 1023
}
HEAP32[b + 4 * d >> 2] = c;
++d;
}
HEAP32[b + 4 * d >> 2] = 0;
}
Module.stringToUTF32 = stringToUTF32;
function demangle(a) {
function b(c, d, e) {
d = d || Infinity;
var f = "", g = [], k;
if ("N" === a[h]) {
h++;
"K" === a[h] && h++;
for (k = [];"E" !== a[h];) {
if ("S" === a[h]) {
h++;
var y = a.indexOf("_", h), m = a.substring(h, y) || 0;
k.push(n[m] || "?");
h = y + 1;
} else {
if ("C" === a[h]) {
k.push(k[k.length - 1]), h += 2;
} else {
y = parseInt(a.substr(h));
m = y.toString().length;
if (!y || !m) {
h--;
break;
}
var ia = a.substr(h + m, y);
k.push(ia);
n.push(ia);
h += m + y;
}
}
}
h++;
k = k.join("::");
d--;
if (0 === d) {
return c ? [k] : k;
}
} else {
if (("K" === a[h] || p && "L" === a[h]) && h++, y = parseInt(a.substr(h))) {
m = y.toString().length, k = a.substr(h + m, y), h += m + y;
}
}
p = !1;
"I" === a[h] ? (h++, y = b(!0), m = b(!0, 1, !0), f += m[0] + " " + k + "<" + y.join(", ") + ">") : f = k;
a: for (;h < a.length && 0 < d--;) {
if (k = a[h++], k in l) {
g.push(l[k]);
} else {
switch(k) {
case "P":
g.push(b(!0, 1, !0)[0] + "*");
break;
case "R":
g.push(b(!0, 1, !0)[0] + "&");
break;
case "L":
h++;
y = a.indexOf("E", h) - h;
g.push(a.substr(h, y));
h += y + 2;
break;
case "A":
y = parseInt(a.substr(h));
h += y.toString().length;
if ("_" !== a[h]) {
throw "?";
}
h++;
g.push(b(!0, 1, !0)[0] + " [" + y + "]");
break;
case "E":
break a;
default:
f += "?" + k;
break a;
}
}
}
e || 1 !== g.length || "void" !== g[0] || (g = []);
return c ? (f && g.push(f + "?"), g) : f + ("(" + g.join(", ") + ")");
}
var d = !!Module.___cxa_demangle;
if (d) {
try {
var e = _malloc(a.length);
writeStringToMemory(a.substr(1), e);
var c = _malloc(4), f = Module.___cxa_demangle(e, 0, 0, c);
if (0 === getValue(c, "i32") && f) {
return Pointer_stringify(f);
}
} catch (g) {
} finally {
e && _free(e), c && _free(c), f && _free(f);
}
}
var h = 3, l = {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:"..."}, n = [], p = !0, e = a;
try {
if ("Object._main" == a || "_main" == a) {
return "main()";
}
"number" === typeof a && (a = Pointer_stringify(a));
if ("_" !== a[0] || "_" !== a[1] || "Z" !== a[2]) {
return a;
}
switch(a[3]) {
case "n":
return "operator new()";
case "d":
return "operator delete()";
}
e = b();
} catch (k) {
e += "?";
}
0 <= e.indexOf("?") && !d && Runtime.warnOnce("warning: a problem occurred in builtin C++ name demangling; build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling");
return e;
}
function demangleAll(a) {
return a.replace(/__Z[\w\d_]+/g, function(a) {
var d = demangle(a);
return a === d ? a : a + " [" + d + "]";
});
}
function jsStackTrace() {
var a = Error();
if (!a.stack) {
try {
throw Error(0);
} catch (b) {
a = b;
}
if (!a.stack) {
return "(no stack trace available)";
}
}
return a.stack.toString();
}
function stackTrace() {
return demangleAll(jsStackTrace());
}
Module.stackTrace = stackTrace;
var PAGE_SIZE = 4096;
function alignMemoryPage(a) {
return a + 4095 & -4096;
}
var HEAP, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64, STATIC_BASE = 0, STATICTOP = 0, staticSealed = !1, STACK_BASE = 0, STACKTOP = 0, STACK_MAX = 0, DYNAMIC_BASE = 0, DYNAMICTOP = 0;
function enlargeMemory() {
abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value " + TOTAL_MEMORY + ", (2) compile with ALLOW_MEMORY_GROWTH which adjusts the size at runtime but prevents some optimizations, or (3) set Module.TOTAL_MEMORY before the program runs.");
}
for (var TOTAL_STACK = Module.TOTAL_STACK || 5242880, TOTAL_MEMORY = Module.TOTAL_MEMORY || 16777216, FAST_MEMORY = Module.FAST_MEMORY || 2097152, totalMemory = 65536;totalMemory < TOTAL_MEMORY || totalMemory < 2 * TOTAL_STACK;) {
totalMemory = 16777216 > totalMemory ? 2 * totalMemory : totalMemory + 16777216;
}
totalMemory !== TOTAL_MEMORY && (Module.printErr("increasing TOTAL_MEMORY to " + totalMemory + " to be compliant with the asm.js spec"), TOTAL_MEMORY = totalMemory);
assert("undefined" !== typeof Int32Array && "undefined" !== typeof Float64Array && !!(new Int32Array(1)).subarray && !!(new Int32Array(1)).set, "JS engine does not provide full typed array support");
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);
HEAP32[0] = 255;
assert(255 === HEAPU8[0] && 0 === HEAPU8[3], "Typed arrays 2 must be run on a little-endian system");
Module.HEAP = HEAP;
Module.buffer = buffer;
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(a) {
for (;0 < a.length;) {
var b = a.shift();
if ("function" == typeof b) {
b();
} else {
var d = b.func;
"number" === typeof d ? void 0 === b.arg ? Runtime.dynCall("v", d) : Runtime.dynCall("vi", d, [b.arg]) : d(void 0 === b.arg ? null : b.arg);
}
}
}
var __ATPRERUN__ = [], __ATINIT__ = [], __ATMAIN__ = [], __ATEXIT__ = [], __ATPOSTRUN__ = [], runtimeInitialized = !1, runtimeExited = !1;
function preRun() {
if (Module.preRun) {
for ("function" == typeof Module.preRun && (Module.preRun = [Module.preRun]);Module.preRun.length;) {
addOnPreRun(Module.preRun.shift());
}
}
callRuntimeCallbacks(__ATPRERUN__);
}
function ensureInitRuntime() {
runtimeInitialized || (runtimeInitialized = !0, callRuntimeCallbacks(__ATINIT__));
}
function preMain() {
callRuntimeCallbacks(__ATMAIN__);
}
function exitRuntime() {
callRuntimeCallbacks(__ATEXIT__);
runtimeExited = !0;
}
function postRun() {
if (Module.postRun) {
for ("function" == typeof Module.postRun && (Module.postRun = [Module.postRun]);Module.postRun.length;) {
addOnPostRun(Module.postRun.shift());
}
}
callRuntimeCallbacks(__ATPOSTRUN__);
}
function addOnPreRun(a) {
__ATPRERUN__.unshift(a);
}
Module.addOnPreRun = Module.addOnPreRun = addOnPreRun;
function addOnInit(a) {
__ATINIT__.unshift(a);
}
Module.addOnInit = Module.addOnInit = addOnInit;
function addOnPreMain(a) {
__ATMAIN__.unshift(a);
}
Module.addOnPreMain = Module.addOnPreMain = addOnPreMain;
function addOnExit(a) {
__ATEXIT__.unshift(a);
}
Module.addOnExit = Module.addOnExit = addOnExit;
function addOnPostRun(a) {
__ATPOSTRUN__.unshift(a);
}
Module.addOnPostRun = Module.addOnPostRun = addOnPostRun;
function intArrayFromString(a, b, d) {
a = (new Runtime.UTF8Processor).processJSString(a);
d && (a.length = d);
b || a.push(0);
return a;
}
Module.intArrayFromString = intArrayFromString;
function intArrayToString(a) {
for (var b = [], d = 0;d < a.length;d++) {
var e = a[d];
255 < e && (assert(!1, "Character code " + e + " (" + String.fromCharCode(e) + ") at offset " + d + " not in 0x00-0xFF."), e &= 255);
b.push(String.fromCharCode(e));
}
return b.join("");
}
Module.intArrayToString = intArrayToString;
function writeStringToMemory(a, b, d) {
a = intArrayFromString(a, d);
for (d = 0;d < a.length;) {
HEAP8[b + d >> 0] = a[d], d += 1;
}
}
Module.writeStringToMemory = writeStringToMemory;
function writeArrayToMemory(a, b) {
for (var d = 0;d < a.length;d++) {
HEAP8[b + d >> 0] = a[d];
}
}
Module.writeArrayToMemory = writeArrayToMemory;
function writeAsciiToMemory(a, b, d) {
for (var e = 0;e < a.length;e++) {
assert(a.charCodeAt(e) === a.charCodeAt(e) & 255), HEAP8[b + e >> 0] = a.charCodeAt(e);
}
d || (HEAP8[b + a.length >> 0] = 0);
}
Module.writeAsciiToMemory = writeAsciiToMemory;
function unSign(a, b, d) {
return 0 <= a ? a : 32 >= b ? 2 * Math.abs(1 << b - 1) + a : Math.pow(2, b) + a;
}
function reSign(a, b, d) {
if (0 >= a) {
return a;
}
d = 32 >= b ? Math.abs(1 << b - 1) : Math.pow(2, b - 1);
a >= d && (32 >= b || a > d) && (a = -2 * d + a);
return a;
}
Math.imul && -5 === Math.imul(4294967295, 5) || (Math.imul = function(a, b) {
var d = a & 65535, e = b & 65535;
return d * e + ((a >>> 16) * e + d * (b >>> 16) << 16) | 0;
});
Math.imul = Math.imul;
var Math_abs = Math.abs, Math_cos = Math.cos, Math_sin = Math.sin, Math_tan = Math.tan, Math_acos = Math.acos, Math_asin = Math.asin, Math_atan = Math.atan, Math_atan2 = Math.atan2, Math_exp = Math.exp, Math_log = Math.log, Math_sqrt = Math.sqrt, Math_ceil = Math.ceil, Math_floor = Math.floor, Math_pow = Math.pow, Math_imul = Math.imul, Math_fround = Math.fround, Math_min = Math.min, runDependencies = 0, runDependencyWatcher = null, dependenciesFulfilled = null, runDependencyTracking = {};
function addRunDependency(a) {
runDependencies++;
Module.monitorRunDependencies && Module.monitorRunDependencies(runDependencies);
a ? (assert(!runDependencyTracking[a]), runDependencyTracking[a] = 1, null === runDependencyWatcher && "undefined" !== typeof setInterval && (runDependencyWatcher = setInterval(function() {
if (ABORT) {
clearInterval(runDependencyWatcher), runDependencyWatcher = null;
} else {
var a = !1, d;
for (d in runDependencyTracking) {
a || (a = !0, Module.printErr("still waiting on run dependencies:")), Module.printErr("dependency: " + d);
}
a && Module.printErr("(end of list)");
}
}, 1E4))) : Module.printErr("warning: run dependency added without ID");
}
Module.addRunDependency = addRunDependency;
function removeRunDependency(a) {
runDependencies--;
Module.monitorRunDependencies && Module.monitorRunDependencies(runDependencies);
a ? (assert(runDependencyTracking[a]), delete runDependencyTracking[a]) : Module.printErr("warning: run dependency removed without ID");
0 == runDependencies && (null !== runDependencyWatcher && (clearInterval(runDependencyWatcher), runDependencyWatcher = null), dependenciesFulfilled && (a = dependenciesFulfilled, dependenciesFulfilled = null, a()));
}
Module.removeRunDependency = removeRunDependency;
Module.preloadedImages = {};
Module.preloadedAudios = {};
var memoryInitializer = null, STATIC_BASE = 8, STATICTOP = STATIC_BASE + 528;
__ATINIT__.push();
allocate([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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_NONE, Runtime.GLOBAL_BASE);
var tempDoublePtr = Runtime.alignMemory(allocate(12, "i8", ALLOC_STATIC), 8);
assert(0 == tempDoublePtr % 8);
function copyTempFloat(a) {
HEAP8[tempDoublePtr] = HEAP8[a];
HEAP8[tempDoublePtr + 1] = HEAP8[a + 1];
HEAP8[tempDoublePtr + 2] = HEAP8[a + 2];
HEAP8[tempDoublePtr + 3] = HEAP8[a + 3];
}
function copyTempDouble(a) {
HEAP8[tempDoublePtr] = HEAP8[a];
HEAP8[tempDoublePtr + 1] = HEAP8[a + 1];
HEAP8[tempDoublePtr + 2] = HEAP8[a + 2];
HEAP8[tempDoublePtr + 3] = HEAP8[a + 3];
HEAP8[tempDoublePtr + 4] = HEAP8[a + 4];
HEAP8[tempDoublePtr + 5] = HEAP8[a + 5];
HEAP8[tempDoublePtr + 6] = HEAP8[a + 6];
HEAP8[tempDoublePtr + 7] = HEAP8[a + 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},
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"}, ___errno_state = 0;
function ___setErrNo(a) {
return HEAP32[___errno_state >> 2] = a;
}
var PATH = {splitPath:function(a) {
return/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);
}, normalizeArray:function(a, b) {
for (var d = 0, e = a.length - 1;0 <= e;e--) {
var c = a[e];
"." === c ? a.splice(e, 1) : ".." === c ? (a.splice(e, 1), d++) : d && (a.splice(e, 1), d--);
}
if (b) {
for (;d--;d) {
a.unshift("..");
}
}
return a;
}, normalize:function(a) {
var b = "/" === a.charAt(0), d = "/" === a.substr(-1);
(a = PATH.normalizeArray(a.split("/").filter(function(a) {
return!!a;
}), !b).join("/")) || b || (a = ".");
a && d && (a += "/");
return(b ? "/" : "") + a;
}, dirname:function(a) {
var b = PATH.splitPath(a);
a = b[0];
b = b[1];
if (!a && !b) {
return ".";
}
b && (b = b.substr(0, b.length - 1));
return a + b;
}, basename:function(a) {
if ("/" === a) {
return "/";
}
var b = a.lastIndexOf("/");
return-1 === b ? a : a.substr(b + 1);
}, extname:function(a) {
return PATH.splitPath(a)[3];
}, join:function() {
var a = Array.prototype.slice.call(arguments, 0);
return PATH.normalize(a.join("/"));
}, join2:function(a, b) {
return PATH.normalize(a + "/" + b);
}, resolve:function() {
for (var a = "", b = !1, d = arguments.length - 1;-1 <= d && !b;d--) {
b = 0 <= d ? arguments[d] : FS.cwd();
if ("string" !== typeof b) {
throw new TypeError("Arguments to path.resolve must be strings");
}
if (!b) {
return "";
}
a = b + "/" + a;
b = "/" === b.charAt(0);
}
a = PATH.normalizeArray(a.split("/").filter(function(a) {
return!!a;
}), !b).join("/");
return(b ? "/" : "") + a || ".";
}, relative:function(a, b) {
function d(a) {
for (var b = 0;b < a.length && "" === a[b];b++) {
}
for (var c = a.length - 1;0 <= c && "" === a[c];c--) {
}
return b > c ? [] : a.slice(b, c - b + 1);
}
a = PATH.resolve(a).substr(1);
b = PATH.resolve(b).substr(1);
for (var e = d(a.split("/")), c = d(b.split("/")), f = Math.min(e.length, c.length), g = f, h = 0;h < f;h++) {
if (e[h] !== c[h]) {
g = h;
break;
}
}
f = [];
for (h = g;h < e.length;h++) {
f.push("..");
}
f = f.concat(c.slice(g));
return f.join("/");
}}, TTY = {ttys:[], init:function() {
}, shutdown:function() {
}, register:function(a, b) {
TTY.ttys[a] = {input:[], output:[], ops:b};
FS.registerDevice(a, TTY.stream_ops);
}, stream_ops:{open:function(a) {
var b = TTY.ttys[a.node.rdev];
if (!b) {
throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
}
a.tty = b;
a.seekable = !1;
}, close:function(a) {
a.tty.ops.flush(a.tty);
}, flush:function(a) {
a.tty.ops.flush(a.tty);
}, read:function(a, b, d, e, c) {
if (!a.tty || !a.tty.ops.get_char) {
throw new FS.ErrnoError(ERRNO_CODES.ENXIO);
}
for (var f = c = 0;f < e;f++) {
var g;
try {
g = a.tty.ops.get_char(a.tty);
} catch (h) {
throw new FS.ErrnoError(ERRNO_CODES.EIO);
}
if (void 0 === g && 0 === c) {
throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
}
if (null === g || void 0 === g) {
break;
}
c++;
b[d + f] = g;
}
c && (a.node.timestamp = Date.now());
return c;
}, write:function(a, b, d, e, c) {
if (!a.tty || !a.tty.ops.put_char) {
throw new FS.ErrnoError(ERRNO_CODES.ENXIO);
}
for (c = 0;c < e;c++) {
try {
a.tty.ops.put_char(a.tty, b[d + c]);
} catch (f) {
throw new FS.ErrnoError(ERRNO_CODES.EIO);
}
}
e && (a.node.timestamp = Date.now());
return c;
}}, default_tty_ops:{get_char:function(a) {
if (!a.input.length) {
var b = null;
if (ENVIRONMENT_IS_NODE) {
if (b = process.stdin.read(), !b) {
if (process.stdin._readableState && process.stdin._readableState.ended) {
return null;
}
return;
}
} else {
"undefined" != typeof window && "function" == typeof window.prompt ? (b = window.prompt("Input: "), null !== b && (b += "\n")) : "function" == typeof readline && (b = readline(), null !== b && (b += "\n"));
}
if (!b) {
return null;
}
a.input = intArrayFromString(b, !0);
}
return a.input.shift();
}, flush:function(a) {
a.output && 0 < a.output.length && (Module.print(a.output.join("")), a.output = []);
}, put_char:function(a, b) {
null === b || 10 === b ? (Module.print(a.output.join("")), a.output = []) : a.output.push(TTY.utf8.processCChar(b));
}}, default_tty1_ops:{put_char:function(a, b) {
null === b || 10 === b ? (Module.printErr(a.output.join("")), a.output = []) : a.output.push(TTY.utf8.processCChar(b));
}, flush:function(a) {
a.output && 0 < a.output.length && (Module.printErr(a.output.join("")), a.output = []);
}}}, MEMFS = {ops_table:null, mount:function(a) {
return MEMFS.createNode(null, "/", 16895, 0);
}, createNode:function(a, b, d, e) {
if (FS.isBlkdev(d) || FS.isFIFO(d)) {
throw new FS.ErrnoError(ERRNO_CODES.EPERM);
}
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, 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}});
d = FS.createNode(a, b, d, e);
FS.isDir(d.mode) ? (d.node_ops = MEMFS.ops_table.dir.node, d.stream_ops = MEMFS.ops_table.dir.stream, d.contents = {}) : FS.isFile(d.mode) ? (d.node_ops = MEMFS.ops_table.file.node, d.stream_ops = MEMFS.ops_table.file.stream, d.usedBytes = 0, d.contents = null) : FS.isLink(d.mode) ? (d.node_ops = MEMFS.ops_table.link.node, d.stream_ops = MEMFS.ops_table.link.stream) : FS.isChrdev(d.mode) && (d.node_ops = MEMFS.ops_table.chrdev.node, d.stream_ops = MEMFS.ops_table.chrdev.stream);
d.timestamp = Date.now();
a && (a.contents[b] = d);
return d;
}, getFileDataAsRegularArray:function(a) {
if (a.contents && a.contents.subarray) {
for (var b = [], d = 0;d < a.usedBytes;++d) {
b.push(a.contents[d]);
}
return b;
}
return a.contents;
}, getFileDataAsTypedArray:function(a) {
return a.contents ? a.contents.subarray ? a.contents.subarray(0, a.usedBytes) : new Uint8Array(a.contents) : new Uint8Array;
}, expandFileStorage:function(a, b) {
a.contents && a.contents.subarray && b > a.contents.length && (a.contents = MEMFS.getFileDataAsRegularArray(a), a.usedBytes = a.contents.length);
if (!a.contents || a.contents.subarray) {
var d = a.contents ? a.contents.buffer.byteLength : 0;
d >= b || (b = Math.max(b, d * (1048576 > d ? 2 : 1.125) | 0), 0 != d && (b = Math.max(b, 256)), d = a.contents, a.contents = new Uint8Array(b), 0 < a.usedBytes && a.contents.set(d.subarray(0, a.usedBytes), 0));
} else {
for (!a.contents && 0 < b && (a.contents = []);a.contents.length < b;) {
a.contents.push(0);
}
}
}, resizeFileStorage:function(a, b) {
if (a.usedBytes != b) {
if (0 == b) {
a.contents = null, a.usedBytes = 0;
} else {
if (!a.contents || a.contents.subarray) {
var d = a.contents;
a.contents = new Uint8Array(new ArrayBuffer(b));
d && a.contents.set(d.subarray(0, Math.min(b, a.usedBytes)));
} else {
if (a.contents || (a.contents = []), a.contents.length > b) {
a.contents.length = b;
} else {
for (;a.contents.length < b;) {
a.contents.push(0);
}
}
}
a.usedBytes = b;
}
}
}, node_ops:{getattr:function(a) {
var b = {};
b.dev = FS.isChrdev(a.mode) ? a.id : 1;
b.ino = a.id;
b.mode = a.mode;
b.nlink = 1;
b.uid = 0;
b.gid = 0;
b.rdev = a.rdev;
FS.isDir(a.mode) ? b.size = 4096 : FS.isFile(a.mode) ? b.size = a.usedBytes : FS.isLink(a.mode) ? b.size = a.link.length : b.size = 0;
b.atime = new Date(a.timestamp);
b.mtime = new Date(a.timestamp);
b.ctime = new Date(a.timestamp);
b.blksize = 4096;
b.blocks = Math.ceil(b.size / b.blksize);
return b;
}, setattr:function(a, b) {
void 0 !== b.mode && (a.mode = b.mode);
void 0 !== b.timestamp && (a.timestamp = b.timestamp);
void 0 !== b.size && MEMFS.resizeFileStorage(a, b.size);
}, lookup:function(a, b) {
throw FS.genericErrors[ERRNO_CODES.ENOENT];
}, mknod:function(a, b, d, e) {
return MEMFS.createNode(a, b, d, e);
}, rename:function(a, b, d) {
if (FS.isDir(a.mode)) {
var e;
try {
e = FS.lookupNode(b, d);
} catch (c) {
}
if (e) {
for (var f in e.contents) {
throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
}
}
}
delete a.parent.contents[a.name];
a.name = d;
b.contents[d] = a;
a.parent = b;
}, unlink:function(a, b) {
delete a.contents[b];
}, rmdir:function(a, b) {
var d = FS.lookupNode(a, b), e;
for (e in d.contents) {
throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
}
delete a.contents[b];
}, readdir:function(a) {
var b = [".", ".."], d;
for (d in a.contents) {
a.contents.hasOwnProperty(d) && b.push(d);
}
return b;
}, symlink:function(a, b, d) {
a = MEMFS.createNode(a, b, 41471, 0);
a.link = d;
return a;
}, readlink:function(a) {
if (!FS.isLink(a.mode)) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
return a.link;
}}, stream_ops:{read:function(a, b, d, e, c) {
var f = a.node.contents;
if (c >= a.node.usedBytes) {
return 0;
}
a = Math.min(a.node.usedBytes - c, e);
assert(0 <= a);
if (8 < a && f.subarray) {
b.set(f.subarray(c, c + a), d);
} else {
for (e = 0;e < a;e++) {
b[d + e] = f[c + e];
}
}
return a;
}, write:function(a, b, d, e, c, f) {
if (!e) {
return 0;
}
a = a.node;
a.timestamp = Date.now();
if (b.subarray && (!a.contents || a.contents.subarray)) {
if (f) {
return assert(0 === c, "canOwn must imply no weird position inside the file"), a.contents = b.subarray(d, d + e), a.usedBytes = e;
}
if (0 === a.usedBytes && 0 === c) {
return a.contents = new Uint8Array(b.subarray(d, d + e)), a.usedBytes = e;
}
if (c + e <= a.usedBytes) {
return a.contents.set(b.subarray(d, d + e), c), e;
}
}
MEMFS.expandFileStorage(a, c + e);
if (a.contents.subarray && b.subarray) {
a.contents.set(b.subarray(d, d + e), c);
} else {
for (f = 0;f < e;f++) {
a.contents[c + f] = b[d + f];
}
}
a.usedBytes = Math.max(a.usedBytes, c + e);
return e;
}, llseek:function(a, b, d) {
1 === d ? b += a.position : 2 === d && FS.isFile(a.node.mode) && (b += a.node.usedBytes);
if (0 > b) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
return b;
}, allocate:function(a, b, d) {
MEMFS.expandFileStorage(a.node, b + d);
a.node.usedBytes = Math.max(a.node.usedBytes, b + d);
}, mmap:function(a, b, d, e, c, f, g) {
if (!FS.isFile(a.node.mode)) {
throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
}
d = a.node.contents;
if (g & 2 || d.buffer !== b && d.buffer !== b.buffer) {
if (0 < c || c + e < a.node.usedBytes) {
d = d.subarray ? d.subarray(c, c + e) : Array.prototype.slice.call(d, c, c + e);
}
a = !0;
e = _malloc(e);
if (!e) {
throw new FS.ErrnoError(ERRNO_CODES.ENOMEM);
}
b.set(d, e);
} else {
a = !1, e = d.byteOffset;
}
return{ptr:e, allocated:a};
}}}, IDBFS = {dbs:{}, indexedDB:function() {
if ("undefined" !== typeof indexedDB) {
return indexedDB;
}
var a = null;
"object" === typeof window && (a = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB);
assert(a, "IDBFS used, but indexedDB not supported");
return a;
}, DB_VERSION:21, DB_STORE_NAME:"FILE_DATA", mount:function(a) {
return MEMFS.mount.apply(null, arguments);
}, syncfs:function(a, b, d) {
IDBFS.getLocalSet(a, function(e, c) {
if (e) {
return d(e);
}
IDBFS.getRemoteSet(a, function(a, e) {
if (a) {
return d(a);
}
IDBFS.reconcile(b ? e : c, b ? c : e, d);
});
});
}, getDB:function(a, b) {
var d = IDBFS.dbs[a];
if (d) {
return b(null, d);
}
var e;
try {
e = IDBFS.indexedDB().open(a, IDBFS.DB_VERSION);
} catch (c) {
return b(c);
}
e.onupgradeneeded = function(a) {
var b = a.target.result;
a = a.target.transaction;
(b.objectStoreNames.contains(IDBFS.DB_STORE_NAME) ? a.objectStore(IDBFS.DB_STORE_NAME) : b.createObjectStore(IDBFS.DB_STORE_NAME)).createIndex("timestamp", "timestamp", {unique:!1});
};
e.onsuccess = function() {
d = e.result;
IDBFS.dbs[a] = d;
b(null, d);
};
e.onerror = function() {
b(this.error);
};
}, getLocalSet:function(a, b) {
function d(a) {
return "." !== a && ".." !== a;
}
function e(a) {
return function(b) {
return PATH.join2(a, b);
};
}
for (var c = {}, f = FS.readdir(a.mountpoint).filter(d).map(e(a.mountpoint));f.length;) {
var g = f.pop(), h;
try {
h = FS.stat(g);
} catch (l) {
return b(l);
}
FS.isDir(h.mode) && f.push.apply(f, FS.readdir(g).filter(d).map(e(g)));
c[g] = {timestamp:h.mtime};
}
return b(null, {type:"local", entries:c});
}, getRemoteSet:function(a, b) {
var d = {};
IDBFS.getDB(a.mountpoint, function(a, c) {
if (a) {
return b(a);
}
var f = c.transaction([IDBFS.DB_STORE_NAME], "readonly");
f.onerror = function() {
b(this.error);
};
f.objectStore(IDBFS.DB_STORE_NAME).index("timestamp").openKeyCursor().onsuccess = function(a) {
a = a.target.result;
if (!a) {
return b(null, {type:"remote", db:c, entries:d});
}
d[a.primaryKey] = {timestamp:a.key};
a["continue"]();
};
});
}, loadLocalEntry:function(a, b) {
var d, e;
try {
e = FS.lookupPath(a).node, d = FS.stat(a);
} catch (c) {
return b(c);
}
return FS.isDir(d.mode) ? b(null, {timestamp:d.mtime, mode:d.mode}) : FS.isFile(d.mode) ? (e.contents = MEMFS.getFileDataAsTypedArray(e), b(null, {timestamp:d.mtime, mode:d.mode, contents:e.contents})) : b(Error("node type not supported"));
}, storeLocalEntry:function(a, b, d) {
try {
if (FS.isDir(b.mode)) {
FS.mkdir(a, b.mode);
} else {
if (FS.isFile(b.mode)) {
FS.writeFile(a, b.contents, {encoding:"binary", canOwn:!0});
} else {
return d(Error("node type not supported"));
}
}
FS.chmod(a, b.mode);
FS.utime(a, b.timestamp, b.timestamp);
} catch (e) {
return d(e);
}
d(null);
}, removeLocalEntry:function(a, b) {
try {
FS.lookupPath(a);
var d = FS.stat(a);
FS.isDir(d.mode) ? FS.rmdir(a) : FS.isFile(d.mode) && FS.unlink(a);
} catch (e) {
return b(e);
}
b(null);
}, loadRemoteEntry:function(a, b, d) {
a = a.get(b);
a.onsuccess = function(a) {
d(null, a.target.result);
};
a.onerror = function() {
d(this.error);
};
}, storeRemoteEntry:function(a, b, d, e) {
a = a.put(d, b);
a.onsuccess = function() {
e(null);
};
a.onerror = function() {
e(this.error);
};
}, removeRemoteEntry:function(a, b, d) {
a = a["delete"](b);
a.onsuccess = function() {
d(null);
};
a.onerror = function() {
d(this.error);
};
}, reconcile:function(a, b, d) {
function e(a) {
if (a) {
if (!e.errored) {
return e.errored = !0, d(a);
}
} else {
if (++h >= c) {
return d(null);
}
}
}
var c = 0, f = [];
Object.keys(a.entries).forEach(function(d) {
var e = a.entries[d], g = b.entries[d];
if (!g || e.timestamp > g.timestamp) {
f.push(d), c++;
}
});
var g = [];
Object.keys(b.entries).forEach(function(b) {
a.entries[b] || (g.push(b), c++);
});
if (!c) {
return d(null);
}
var h = 0, l = ("remote" === a.type ? a.db : b.db).transaction([IDBFS.DB_STORE_NAME], "readwrite"), n = l.objectStore(IDBFS.DB_STORE_NAME);
l.onerror = function() {
e(this.error);
};
f.sort().forEach(function(a) {
"local" === b.type ? IDBFS.loadRemoteEntry(n, a, function(b, c) {
if (b) {
return e(b);
}
IDBFS.storeLocalEntry(a, c, e);
}) : IDBFS.loadLocalEntry(a, function(b, c) {
if (b) {
return e(b);
}
IDBFS.storeRemoteEntry(n, a, c, e);
});
});
g.sort().reverse().forEach(function(a) {
"local" === b.type ? IDBFS.removeLocalEntry(a, e) : IDBFS.removeRemoteEntry(n, a, e);
});
}}, NODEFS = {isWindows:!1, staticInit:function() {
NODEFS.isWindows = !!process.platform.match(/^win/);
}, mount:function(a) {
assert(ENVIRONMENT_IS_NODE);
return NODEFS.createNode(null, "/", NODEFS.getMode(a.opts.root), 0);
}, createNode:function(a, b, d, e) {
if (!FS.isDir(d) && !FS.isFile(d) && !FS.isLink(d)) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
a = FS.createNode(a, b, d);
a.node_ops = NODEFS.node_ops;
a.stream_ops = NODEFS.stream_ops;
return a;
}, getMode:function(a) {
var b;
try {
b = fs.lstatSync(a), NODEFS.isWindows && (b.mode |= (b.mode & 146) >> 1);
} catch (d) {
if (!d.code) {
throw d;
}
throw new FS.ErrnoError(ERRNO_CODES[d.code]);
}
return b.mode;
}, realPath:function(a) {
for (var b = [];a.parent !== a;) {
b.push(a.name), a = a.parent;
}
b.push(a.mount.opts.root);
b.reverse();
return PATH.join.apply(null, b);
}, 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(a) {
return a in NODEFS.flagsToPermissionStringMap ? NODEFS.flagsToPermissionStringMap[a] : a;
}, node_ops:{getattr:function(a) {
a = NODEFS.realPath(a);
var b;
try {
b = fs.lstatSync(a);
} catch (d) {
if (!d.code) {
throw d;
}
throw new FS.ErrnoError(ERRNO_CODES[d.code]);
}
NODEFS.isWindows && !b.blksize && (b.blksize = 4096);
NODEFS.isWindows && !b.blocks && (b.blocks = (b.size + b.blksize - 1) / b.blksize | 0);
return{dev:b.dev, ino:b.ino, mode:b.mode, nlink:b.nlink, uid:b.uid, gid:b.gid, rdev:b.rdev, size:b.size, atime:b.atime, mtime:b.mtime, ctime:b.ctime, blksize:b.blksize, blocks:b.blocks};
}, setattr:function(a, b) {
var d = NODEFS.realPath(a);
try {
void 0 !== b.mode && (fs.chmodSync(d, b.mode), a.mode = b.mode);
if (void 0 !== b.timestamp) {
var e = new Date(b.timestamp);
fs.utimesSync(d, e, e);
}
void 0 !== b.size && fs.truncateSync(d, b.size);
} catch (c) {
if (!c.code) {
throw c;
}
throw new FS.ErrnoError(ERRNO_CODES[c.code]);
}
}, lookup:function(a, b) {
var d = PATH.join2(NODEFS.realPath(a), b), d = NODEFS.getMode(d);
return NODEFS.createNode(a, b, d);
}, mknod:function(a, b, d, e) {
a = NODEFS.createNode(a, b, d, e);
b = NODEFS.realPath(a);
try {
FS.isDir(a.mode) ? fs.mkdirSync(b, a.mode) : fs.writeFileSync(b, "", {mode:a.mode});
} catch (c) {
if (!c.code) {
throw c;
}
throw new FS.ErrnoError(ERRNO_CODES[c.code]);
}
return a;
}, rename:function(a, b, d) {
a = NODEFS.realPath(a);
b = PATH.join2(NODEFS.realPath(b), d);
try {
fs.renameSync(a, b);
} catch (e) {
if (!e.code) {
throw e;
}
throw new FS.ErrnoError(ERRNO_CODES[e.code]);
}
}, unlink:function(a, b) {
var d = PATH.join2(NODEFS.realPath(a), b);
try {
fs.unlinkSync(d);
} catch (e) {
if (!e.code) {
throw e;
}
throw new FS.ErrnoError(ERRNO_CODES[e.code]);
}
}, rmdir:function(a, b) {
var d = PATH.join2(NODEFS.realPath(a), b);
try {
fs.rmdirSync(d);
} catch (e) {
if (!e.code) {
throw e;
}
throw new FS.ErrnoError(ERRNO_CODES[e.code]);
}
}, readdir:function(a) {
a = NODEFS.realPath(a);
try {
return fs.readdirSync(a);
} catch (b) {
if (!b.code) {
throw b;
}
throw new FS.ErrnoError(ERRNO_CODES[b.code]);
}
}, symlink:function(a, b, d) {
a = PATH.join2(NODEFS.realPath(a), b);
try {
fs.symlinkSync(d, a);
} catch (e) {
if (!e.code) {
throw e;
}
throw new FS.ErrnoError(ERRNO_CODES[e.code]);
}
}, readlink:function(a) {
a = NODEFS.realPath(a);
try {
return fs.readlinkSync(a);
} catch (b) {
if (!b.code) {
throw b;
}
throw new FS.ErrnoError(ERRNO_CODES[b.code]);
}
}}, stream_ops:{open:function(a) {
var b = NODEFS.realPath(a.node);
try {
FS.isFile(a.node.mode) && (a.nfd = fs.openSync(b, NODEFS.flagsToPermissionString(a.flags)));
} catch (d) {
if (!d.code) {
throw d;
}
throw new FS.ErrnoError(ERRNO_CODES[d.code]);
}
}, close:function(a) {
try {
FS.isFile(a.node.mode) && a.nfd && fs.closeSync(a.nfd);
} catch (b) {
if (!b.code) {
throw b;
}
throw new FS.ErrnoError(ERRNO_CODES[b.code]);
}
}, read:function(a, b, d, e, c) {
if (0 === e) {
return 0;
}
var f = new Buffer(e), g;
try {
g = fs.readSync(a.nfd, f, 0, e, c);
} catch (h) {
throw new FS.ErrnoError(ERRNO_CODES[h.code]);
}
if (0 < g) {
for (a = 0;a < g;a++) {
b[d + a] = f[a];
}
}
return g;
}, write:function(a, b, d, e, c) {
b = new Buffer(b.subarray(d, d + e));
var f;
try {
f = fs.writeSync(a.nfd, b, 0, e, c);
} catch (g) {
throw new FS.ErrnoError(ERRNO_CODES[g.code]);
}
return f;
}, llseek:function(a, b, d) {
if (1 === d) {
b += a.position;
} else {
if (2 === d && FS.isFile(a.node.mode)) {
try {
var e = fs.fstatSync(a.nfd);
b += e.size;
} catch (c) {
throw new FS.ErrnoError(ERRNO_CODES[c.code]);
}
}
}
if (0 > b) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
return b;
}}}, _stdin = allocate(1, "i32*", ALLOC_STATIC), _stdout = allocate(1, "i32*", ALLOC_STATIC), _stderr = allocate(1, "i32*", ALLOC_STATIC);
function _fflush(a) {
}
var FS = {root:null, mounts:[], devices:[null], streams:[], nextInode:1, nameTable:null, currentPath:"/", initialized:!1, ignorePermissions:!0, trackingDelegate:{}, tracking:{openFlags:{READ:1, WRITE:2}}, ErrnoError:null, genericErrors:{}, handleFSError:function(a) {
if (!(a instanceof FS.ErrnoError)) {
throw a + " : " + stackTrace();
}
return ___setErrNo(a.errno);
}, lookupPath:function(a, b) {
a = PATH.resolve(FS.cwd(), a);
b = b || {};
if (!a) {
return{path:"", node:null};
}
var d = {follow_mount:!0, recurse_count:0}, e;
for (e in d) {
void 0 === b[e] && (b[e] = d[e]);
}
if (8 < b.recurse_count) {
throw new FS.ErrnoError(ERRNO_CODES.ELOOP);
}
var d = PATH.normalizeArray(a.split("/").filter(function(a) {
return!!a;
}), !1), c = FS.root;
e = "/";
for (var f = 0;f < d.length;f++) {
var g = f === d.length - 1;
if (g && b.parent) {
break;
}
c = FS.lookupNode(c, d[f]);
e = PATH.join2(e, d[f]);
FS.isMountpoint(c) && (!g || g && b.follow_mount) && (c = c.mounted.root);
if (!g || b.follow) {
for (g = 0;FS.isLink(c.mode);) {
if (c = FS.readlink(e), e = PATH.resolve(PATH.dirname(e), c), c = FS.lookupPath(e, {recurse_count:b.recurse_count}).node, 40 < g++) {
throw new FS.ErrnoError(ERRNO_CODES.ELOOP);
}
}
}
}
return{path:e, node:c};
}, getPath:function(a) {
for (var b;;) {
if (FS.isRoot(a)) {
return a = a.mount.mountpoint, b ? "/" !== a[a.length - 1] ? a + "/" + b : a + b : a;
}
b = b ? a.name + "/" + b : a.name;
a = a.parent;
}
}, hashName:function(a, b) {
for (var d = 0, e = 0;e < b.length;e++) {
d = (d << 5) - d + b.charCodeAt(e) | 0;
}
return(a + d >>> 0) % FS.nameTable.length;
}, hashAddNode:function(a) {
var b = FS.hashName(a.parent.id, a.name);
a.name_next = FS.nameTable[b];
FS.nameTable[b] = a;
}, hashRemoveNode:function(a) {
var b = FS.hashName(a.parent.id, a.name);
if (FS.nameTable[b] === a) {
FS.nameTable[b] = a.name_next;
} else {
for (b = FS.nameTable[b];b;) {
if (b.name_next === a) {
b.name_next = a.name_next;
break;
}
b = b.name_next;
}
}
}, lookupNode:function(a, b) {
var d = FS.mayLookup(a);
if (d) {
throw new FS.ErrnoError(d, a);
}
d = FS.hashName(a.id, b);
for (d = FS.nameTable[d];d;d = d.name_next) {
var e = d.name;
if (d.parent.id === a.id && e === b) {
return d;
}
}
return FS.lookup(a, b);
}, createNode:function(a, b, d, e) {
FS.FSNode || (FS.FSNode = function(a, b, d, e) {
a || (a = this);
this.parent = a;
this.mount = a.mount;
this.mounted = null;
this.id = FS.nextInode++;
this.name = b;
this.mode = d;
this.node_ops = {};
this.stream_ops = {};
this.rdev = e;
}, FS.FSNode.prototype = {}, Object.defineProperties(FS.FSNode.prototype, {read:{get:function() {
return 365 === (this.mode & 365);
}, set:function(a) {
a ? this.mode |= 365 : this.mode &= -366;
}}, write:{get:function() {
return 146 === (this.mode & 146);
}, set:function(a) {
a ? this.mode |= 146 : this.mode &= -147;
}}, isFolder:{get:function() {
return FS.isDir(this.mode);
}}, isDevice:{get:function() {
return FS.isChrdev(this.mode);
}}}));
a = new FS.FSNode(a, b, d, e);
FS.hashAddNode(a);
return a;
}, destroyNode:function(a) {
FS.hashRemoveNode(a);
}, isRoot:function(a) {
return a === a.parent;
}, isMountpoint:function(a) {
return!!a.mounted;
}, isFile:function(a) {
return 32768 === (a & 61440);
}, isDir:function(a) {
return 16384 === (a & 61440);
}, isLink:function(a) {
return 40960 === (a & 61440);
}, isChrdev:function(a) {
return 8192 === (a & 61440);
}, isBlkdev:function(a) {
return 24576 === (a & 61440);
}, isFIFO:function(a) {
return 4096 === (a & 61440);
}, isSocket:function(a) {
return 49152 === (a & 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(a) {
var b = FS.flagModes[a];
if ("undefined" === typeof b) {
throw Error("Unknown file open mode: " + a);
}
return b;
}, flagsToPermissionString:function(a) {
var b = ["r", "w", "rw"][a & 2097155];
a & 512 && (b += "w");
return b;
}, nodePermissions:function(a, b) {
if (FS.ignorePermissions) {
return 0;
}
if (-1 === b.indexOf("r") || a.mode & 292) {
if (-1 !== b.indexOf("w") && !(a.mode & 146) || -1 !== b.indexOf("x") && !(a.mode & 73)) {
return ERRNO_CODES.EACCES;
}
} else {
return ERRNO_CODES.EACCES;
}
return 0;
}, mayLookup:function(a) {
var b = FS.nodePermissions(a, "x");
return b ? b : a.node_ops.lookup ? 0 : ERRNO_CODES.EACCES;
}, mayCreate:function(a, b) {
try {
return FS.lookupNode(a, b), ERRNO_CODES.EEXIST;
} catch (d) {
}
return FS.nodePermissions(a, "wx");
}, mayDelete:function(a, b, d) {
var e;
try {
e = FS.lookupNode(a, b);
} catch (c) {
return c.errno;
}
if (a = FS.nodePermissions(a, "wx")) {
return a;
}
if (d) {
if (!FS.isDir(e.mode)) {
return ERRNO_CODES.ENOTDIR;
}
if (FS.isRoot(e) || FS.getPath(e) === FS.cwd()) {
return ERRNO_CODES.EBUSY;
}
} else {
if (FS.isDir(e.mode)) {
return ERRNO_CODES.EISDIR;
}
}
return 0;
}, mayOpen:function(a, b) {
return a ? FS.isLink(a.mode) ? ERRNO_CODES.ELOOP : FS.isDir(a.mode) && (0 !== (b & 2097155) || b & 512) ? ERRNO_CODES.EISDIR : FS.nodePermissions(a, FS.flagsToPermissionString(b)) : ERRNO_CODES.ENOENT;
}, MAX_OPEN_FDS:4096, nextfd:function(a, b) {
b = b || FS.MAX_OPEN_FDS;
for (var d = a || 0;d <= b;d++) {
if (!FS.streams[d]) {
return d;
}
}
throw new FS.ErrnoError(ERRNO_CODES.EMFILE);
}, getStream:function(a) {
return FS.streams[a];
}, createStream:function(a, b, d) {
FS.FSStream || (FS.FSStream = function() {
}, FS.FSStream.prototype = {}, Object.defineProperties(FS.FSStream.prototype, {object:{get:function() {
return this.node;
}, set:function(a) {
this.node = a;
}}, isRead:{get:function() {
return 1 !== (this.flags & 2097155);
}}, isWrite:{get:function() {
return 0 !== (this.flags & 2097155);
}}, isAppend:{get:function() {
return this.flags & 1024;
}}}));
var e = new FS.FSStream, c;
for (c in a) {
e[c] = a[c];
}
a = e;
b = FS.nextfd(b, d);
a.fd = b;
return FS.streams[b] = a;
}, closeStream:function(a) {
FS.streams[a] = null;
}, getStreamFromPtr:function(a) {
return FS.streams[a - 1];
}, getPtrForStream:function(a) {
return a ? a.fd + 1 : 0;
}, chrdev_stream_ops:{open:function(a) {
var b = FS.getDevice(a.node.rdev);
a.stream_ops = b.stream_ops;
a.stream_ops.open && a.stream_ops.open(a);
}, llseek:function() {
throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
}}, major:function(a) {
return a >> 8;
}, minor:function(a) {
return a & 255;
}, makedev:function(a, b) {
return a << 8 | b;
}, registerDevice:function(a, b) {
FS.devices[a] = {stream_ops:b};
}, getDevice:function(a) {
return FS.devices[a];
}, getMounts:function(a) {
var b = [];
for (a = [a];a.length;) {
var d = a.pop();
b.push(d);
a.push.apply(a, d.mounts);
}
return b;
}, syncfs:function(a, b) {
function d(a) {
if (a) {
if (!d.errored) {
return d.errored = !0, b(a);
}
} else {
++c >= e.length && b(null);
}
}
"function" === typeof a && (b = a, a = !1);
var e = FS.getMounts(FS.root.mount), c = 0;
e.forEach(function(b) {
if (!b.type.syncfs) {
return d(null);
}
b.type.syncfs(b, a, d);
});
}, mount:function(a, b, d) {
var e = "/" === d, c = !d, f;
if (e && FS.root) {
throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
}
if (!e && !c) {
f = FS.lookupPath(d, {follow_mount:!1});
d = f.path;
f = f.node;
if (FS.isMountpoint(f)) {
throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
}
if (!FS.isDir(f.mode)) {
throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
}
}
b = {type:a, opts:b, mountpoint:d, mounts:[]};
a = a.mount(b);
a.mount = b;
b.root = a;
e ? FS.root = a : f && (f.mounted = b, f.mount && f.mount.mounts.push(b));
return a;
}, unmount:function(a) {
a = FS.lookupPath(a, {follow_mount:!1});
if (!FS.isMountpoint(a.node)) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
a = a.node;
var b = a.mounted, d = FS.getMounts(b);
Object.keys(FS.nameTable).forEach(function(a) {
for (a = FS.nameTable[a];a;) {
var b = a.name_next;
-1 !== d.indexOf(a.mount) && FS.destroyNode(a);
a = b;
}
});
a.mounted = null;
b = a.mount.mounts.indexOf(b);
assert(-1 !== b);
a.mount.mounts.splice(b, 1);
}, lookup:function(a, b) {
return a.node_ops.lookup(a, b);
}, mknod:function(a, b, d) {
var e = FS.lookupPath(a, {parent:!0}).node;
a = PATH.basename(a);
if (!a || "." === a || ".." === a) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
var c = FS.mayCreate(e, a);
if (c) {
throw new FS.ErrnoError(c);
}
if (!e.node_ops.mknod) {
throw new FS.ErrnoError(ERRNO_CODES.EPERM);
}
return e.node_ops.mknod(e, a, b, d);
}, create:function(a, b) {
b = (void 0 !== b ? b : 438) & 4095;
b |= 32768;
return FS.mknod(a, b, 0);
}, mkdir:function(a, b) {
b = (void 0 !== b ? b : 511) & 1023;
b |= 16384;
return FS.mknod(a, b, 0);
}, mkdev:function(a, b, d) {
"undefined" === typeof d && (d = b, b = 438);
return FS.mknod(a, b | 8192, d);
}, symlink:function(a, b) {
if (!PATH.resolve(a)) {
throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
}
var d = FS.lookupPath(b, {parent:!0}).node;
if (!d) {
throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
}
var e = PATH.basename(b), c = FS.mayCreate(d, e);
if (c) {
throw new FS.ErrnoError(c);
}
if (!d.node_ops.symlink) {
throw new FS.ErrnoError(ERRNO_CODES.EPERM);
}
return d.node_ops.symlink(d, e, a);
}, rename:function(a, b) {
var d = PATH.dirname(a), e = PATH.dirname(b), c = PATH.basename(a), f = PATH.basename(b), g, h, l;
try {
g = FS.lookupPath(a, {parent:!0}), h = g.node, g = FS.lookupPath(b, {parent:!0}), l = g.node;
} catch (n) {
throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
}
if (!h || !l) {
throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
}
if (h.mount !== l.mount) {
throw new FS.ErrnoError(ERRNO_CODES.EXDEV);
}
g = FS.lookupNode(h, c);
e = PATH.relative(a, e);
if ("." !== e.charAt(0)) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
e = PATH.relative(b, d);
if ("." !== e.charAt(0)) {
throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
}
var p;
try {
p = FS.lookupNode(l, f);
} catch (k) {
}
if (g !== p) {
d = FS.isDir(g.mode);
if (c = FS.mayDelete(h, c, d)) {
throw new FS.ErrnoError(c);
}
if (c = p ? FS.mayDelete(l, f, d) : FS.mayCreate(l, f)) {
throw new FS.ErrnoError(c);
}
if (!h.node_ops.rename) {
throw new FS.ErrnoError(ERRNO_CODES.EPERM);
}
if (FS.isMountpoint(g) || p && FS.isMountpoint(p)) {
throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
}
if (l !== h && (c = FS.nodePermissions(h, "w"))) {
throw new FS.ErrnoError(c);
}
try {
FS.trackingDelegate.willMovePath && FS.trackingDelegate.willMovePath(a, b);
} catch (r) {
console.log("FS.trackingDelegate['willMovePath']('" + a + "', '" + b + "') threw an exception: " + r.message);
}
FS.hashRemoveNode(g);
try {
h.node_ops.rename(g, l, f);
} catch (B) {
throw B;
} finally {
FS.hashAddNode(g);
}
try {
if (FS.trackingDelegate.onMovePath) {
FS.trackingDelegate.onMovePath(a, b);
}
} catch (K) {
console.log("FS.trackingDelegate['onMovePath']('" + a + "', '" + b + "') threw an exception: " + K.message);
}
}
}, rmdir:function(a) {
var b = FS.lookupPath(a, {parent:!0}).node, d = PATH.basename(a), e = FS.lookupNode(b, d), c = FS.mayDelete(b, d, !0);
if (c) {
throw new FS.ErrnoError(c);
}
if (!b.node_ops.rmdir) {
throw new FS.ErrnoError(ERRNO_CODES.EPERM);
}
if (FS.isMountpoint(e)) {
throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
}
try {
FS.trackingDelegate.willDeletePath && FS.trackingDelegate.willDeletePath(a);
} catch (f) {
console.log("FS.trackingDelegate['willDeletePath']('" + a + "') threw an exception: " + f.message);
}
b.node_ops.rmdir(b, d);
FS.destroyNode(e);
try {
if (FS.trackingDelegate.onDeletePath) {
FS.trackingDelegate.onDeletePath(a);
}
} catch (g) {
console.log("FS.trackingDelegate['onDeletePath']('" + a + "') threw an exception: " + g.message);
}
}, readdir:function(a) {
a = FS.lookupPath(a, {follow:!0}).node;
if (!a.node_ops.readdir) {
throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
}
return a.node_ops.readdir(a);
}, unlink:function(a) {
var b = FS.lookupPath(a, {parent:!0}).node, d = PATH.basename(a), e = FS.lookupNode(b, d), c = FS.mayDelete(b, d, !1);
if (c) {
throw c === ERRNO_CODES.EISDIR && (c = ERRNO_CODES.EPERM), new FS.ErrnoError(c);
}
if (!b.node_ops.unlink) {
throw new FS.ErrnoError(ERRNO_CODES.EPERM);
}
if (FS.isMountpoint(e)) {
throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
}
try {
FS.trackingDelegate.willDeletePath && FS.trackingDelegate.willDeletePath(a);
} catch (f) {
console.log("FS.trackingDelegate['willDeletePath']('" + a + "') threw an exception: " + f.message);
}
b.node_ops.unlink(b, d);
FS.destroyNode(e);
try {
if (FS.trackingDelegate.onDeletePath) {
FS.trackingDelegate.onDeletePath(a);
}
} catch (g) {
console.log("FS.trackingDelegate['onDeletePath']('" + a + "') threw an exception: " + g.message);
}
}, readlink:function(a) {
a = FS.lookupPath(a).node;
if (!a) {
throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
}
if (!a.node_ops.readlink) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
return a.node_ops.readlink(a);
}, stat:function(a, b) {
var d = FS.lookupPath(a, {follow:!b}).node;
if (!d) {
throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
}
if (!d.node_ops.getattr) {
throw new FS.ErrnoError(ERRNO_CODES.EPERM);
}
return d.node_ops.getattr(d);
}, lstat:function(a) {
return FS.stat(a, !0);
}, chmod:function(a, b, d) {
a = "string" === typeof a ? FS.lookupPath(a, {follow:!d}).node : a;
if (!a.node_ops.setattr) {
throw new FS.ErrnoError(ERRNO_CODES.EPERM);
}
a.node_ops.setattr(a, {mode:b & 4095 | a.mode & -4096, timestamp:Date.now()});
}, lchmod:function(a, b) {
FS.chmod(a, b, !0);
}, fchmod:function(a, b) {
var d = FS.getStream(a);
if (!d) {
throw new FS.ErrnoError(ERRNO_CODES.EBADF);
}
FS.chmod(d.node, b);
}, chown:function(a, b, d, e) {
a = "string" === typeof a ? FS.lookupPath(a, {follow:!e}).node : a;
if (!a.node_ops.setattr) {
throw new FS.ErrnoError(ERRNO_CODES.EPERM);
}
a.node_ops.setattr(a, {timestamp:Date.now()});
}, lchown:function(a, b, d) {
FS.chown(a, b, d, !0);
}, fchown:function(a, b, d) {
a = FS.getStream(a);
if (!a) {
throw new FS.ErrnoError(ERRNO_CODES.EBADF);
}
FS.chown(a.node, b, d);
}, truncate:function(a, b) {
if (0 > b) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
var d;
d = "string" === typeof a ? FS.lookupPath(a, {follow:!0}).node : a;
if (!d.node_ops.setattr) {
throw new FS.ErrnoError(ERRNO_CODES.EPERM);
}
if (FS.isDir(d.mode)) {
throw new FS.ErrnoError(ERRNO_CODES.EISDIR);
}
if (!FS.isFile(d.mode)) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
var e = FS.nodePermissions(d, "w");
if (e) {
throw new FS.ErrnoError(e);
}
d.node_ops.setattr(d, {size:b, timestamp:Date.now()});
}, ftruncate:function(a, b) {
var d = FS.getStream(a);
if (!d) {
throw new FS.ErrnoError(ERRNO_CODES.EBADF);
}
if (0 === (d.flags & 2097155)) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
FS.truncate(d.node, b);
}, utime:function(a, b, d) {
a = FS.lookupPath(a, {follow:!0}).node;
a.node_ops.setattr(a, {timestamp:Math.max(b, d)});
}, open:function(a, b, d, e, c) {
if ("" === a) {
throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
}
b = "string" === typeof b ? FS.modeStringToFlags(b) : b;
d = b & 64 ? ("undefined" === typeof d ? 438 : d) & 4095 | 32768 : 0;
var f;
if ("object" === typeof a) {
f = a;
} else {
a = PATH.normalize(a);
try {
f = FS.lookupPath(a, {follow:!(b & 131072)}).node;
} catch (g) {
}
}
var h = !1;
if (b & 64) {
if (f) {
if (b & 128) {
throw new FS.ErrnoError(ERRNO_CODES.EEXIST);
}
} else {
f = FS.mknod(a, d, 0), h = !0;
}
}
if (!f) {
throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
}
FS.isChrdev(f.mode) && (b &= -513);
if (!h && (d = FS.mayOpen(f, b))) {
throw new FS.ErrnoError(d);
}
b & 512 && FS.truncate(f, 0);
b &= -641;
e = FS.createStream({node:f, path:FS.getPath(f), flags:b, seekable:!0, position:0, stream_ops:f.stream_ops, ungotten:[], error:!1}, e, c);
e.stream_ops.open && e.stream_ops.open(e);
!Module.logReadFiles || b & 1 || (FS.readFiles || (FS.readFiles = {}), a in FS.readFiles || (FS.readFiles[a] = 1, Module.printErr("read file: " + a)));
try {
FS.trackingDelegate.onOpenFile && (c = 0, 1 !== (b & 2097155) && (c |= FS.tracking.openFlags.READ), 0 !== (b & 2097155) && (c |= FS.tracking.openFlags.WRITE), FS.trackingDelegate.onOpenFile(a, c));
} catch (l) {
console.log("FS.trackingDelegate['onOpenFile']('" + a + "', flags) threw an exception: " + l.message);
}
return e;
}, close:function(a) {
try {
a.stream_ops.close && a.stream_ops.close(a);
} catch (b) {
throw b;
} finally {
FS.closeStream(a.fd);
}
}, llseek:function(a, b, d) {
if (!a.seekable || !a.stream_ops.llseek) {
throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
}
a.position = a.stream_ops.llseek(a, b, d);
a.ungotten = [];
return a.position;
}, read:function(a, b, d, e, c) {
if (0 > e || 0 > c) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
if (1 === (a.flags & 2097155)) {
throw new FS.ErrnoError(ERRNO_CODES.EBADF);
}
if (FS.isDir(a.node.mode)) {
throw new FS.ErrnoError(ERRNO_CODES.EISDIR);
}
if (!a.stream_ops.read) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
var f = !0;
if ("undefined" === typeof c) {
c = a.position, f = !1;
} else {
if (!a.seekable) {
throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
}
}
b = a.stream_ops.read(a, b, d, e, c);
f || (a.position += b);
return b;
}, write:function(a, b, d, e, c, f) {
if (0 > e || 0 > c) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
if (0 === (a.flags & 2097155)) {
throw new FS.ErrnoError(ERRNO_CODES.EBADF);
}
if (FS.isDir(a.node.mode)) {
throw new FS.ErrnoError(ERRNO_CODES.EISDIR);
}
if (!a.stream_ops.write) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
a.flags & 1024 && FS.llseek(a, 0, 2);
var g = !0;
if ("undefined" === typeof c) {
c = a.position, g = !1;
} else {
if (!a.seekable) {
throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
}
}
b = a.stream_ops.write(a, b, d, e, c, f);
g || (a.position += b);
try {
if (a.path && FS.trackingDelegate.onWriteToFile) {
FS.trackingDelegate.onWriteToFile(a.path);
}
} catch (h) {
console.log("FS.trackingDelegate['onWriteToFile']('" + path + "') threw an exception: " + h.message);
}
return b;
}, allocate:function(a, b, d) {
if (0 > b || 0 >= d) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
if (0 === (a.flags & 2097155)) {
throw new FS.ErrnoError(ERRNO_CODES.EBADF);
}
if (!FS.isFile(a.node.mode) && !FS.isDir(node.mode)) {
throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
}
if (!a.stream_ops.allocate) {
throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP);
}
a.stream_ops.allocate(a, b, d);
}, mmap:function(a, b, d, e, c, f, g) {
if (1 === (a.flags & 2097155)) {
throw new FS.ErrnoError(ERRNO_CODES.EACCES);
}
if (!a.stream_ops.mmap) {
throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
}
return a.stream_ops.mmap(a, b, d, e, c, f, g);
}, ioctl:function(a, b, d) {
if (!a.stream_ops.ioctl) {
throw new FS.ErrnoError(ERRNO_CODES.ENOTTY);
}
return a.stream_ops.ioctl(a, b, d);
}, readFile:function(a, b) {
b = b || {};
b.flags = b.flags || "r";
b.encoding = b.encoding || "binary";
if ("utf8" !== b.encoding && "binary" !== b.encoding) {
throw Error('Invalid encoding type "' + b.encoding + '"');
}
var d, e = FS.open(a, b.flags), c = FS.stat(a).size, f = new Uint8Array(c);
FS.read(e, f, 0, c, 0);
if ("utf8" === b.encoding) {
d = "";
for (var g = new Runtime.UTF8Processor, h = 0;h < c;h++) {
d += g.processCChar(f[h]);
}
} else {
"binary" === b.encoding && (d = f);
}
FS.close(e);
return d;
}, writeFile:function(a, b, d) {
d = d || {};
d.flags = d.flags || "w";
d.encoding = d.encoding || "utf8";
if ("utf8" !== d.encoding && "binary" !== d.encoding) {
throw Error('Invalid encoding type "' + d.encoding + '"');
}
a = FS.open(a, d.flags, d.mode);
if ("utf8" === d.encoding) {
var e = new Runtime.UTF8Processor;
b = new Uint8Array(e.processJSString(b));
FS.write(a, b, 0, b.length, 0, d.canOwn);
} else {
"binary" === d.encoding && FS.write(a, b, 0, b.length, 0, d.canOwn);
}
FS.close(a);
}, cwd:function() {
return FS.currentPath;
}, chdir:function(a) {
a = FS.lookupPath(a, {follow:!0});
if (!FS.isDir(a.node.mode)) {
throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
}
var b = FS.nodePermissions(a.node, "x");
if (b) {
throw new FS.ErrnoError(b);
}
FS.currentPath = a.path;
}, createDefaultDirectories:function() {
FS.mkdir("/tmp");
FS.mkdir("/home");
FS.mkdir("/home/web_user");
}, createDefaultDevices:function() {
FS.mkdir("/dev");
FS.registerDevice(FS.makedev(1, 3), {read:function() {
return 0;
}, write:function() {
return 0;
}});
FS.mkdev("/dev/null", FS.makedev(1, 3));
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));
var a;
if ("undefined" !== typeof crypto) {
var b = new Uint8Array(1);
a = function() {
crypto.getRandomValues(b);
return b[0];
};
} else {
a = ENVIRONMENT_IS_NODE ? function() {
return require("crypto").randomBytes(1)[0];
} : function() {
return 256 * Math.random() | 0;
};
}
FS.createDevice("/dev", "random", a);
FS.createDevice("/dev", "urandom", a);
FS.mkdir("/dev/shm");
FS.mkdir("/dev/shm/tmp");
}, createStandardStreams:function() {
Module.stdin ? FS.createDevice("/dev", "stdin", Module.stdin) : FS.symlink("/dev/tty", "/dev/stdin");
Module.stdout ? FS.createDevice("/dev", "stdout", null, Module.stdout) : FS.symlink("/dev/tty", "/dev/stdout");
Module.stderr ? FS.createDevice("/dev", "stderr", null, Module.stderr) : FS.symlink("/dev/tty1", "/dev/stderr");
var a = FS.open("/dev/stdin", "r");
HEAP32[_stdin >> 2] = FS.getPtrForStream(a);
assert(0 === a.fd, "invalid handle for stdin (" + a.fd + ")");
a = FS.open("/dev/stdout", "w");
HEAP32[_stdout >> 2] = FS.getPtrForStream(a);
assert(1 === a.fd, "invalid handle for stdout (" + a.fd + ")");
a = FS.open("/dev/stderr", "w");
HEAP32[_stderr >> 2] = FS.getPtrForStream(a);
assert(2 === a.fd, "invalid handle for stderr (" + a.fd + ")");
}, ensureErrnoError:function() {
FS.ErrnoError || (FS.ErrnoError = function(a, b) {
this.node = b;
this.setErrno = function(a) {
this.errno = a;
for (var b in ERRNO_CODES) {
if (ERRNO_CODES[b] === a) {
this.code = b;
break;
}
}
};
this.setErrno(a);
this.message = ERRNO_MESSAGES[a];
this.stack && (this.stack = demangleAll(this.stack));
}, FS.ErrnoError.prototype = Error(), FS.ErrnoError.prototype.constructor = FS.ErrnoError, [ERRNO_CODES.ENOENT].forEach(function(a) {
FS.genericErrors[a] = new FS.ErrnoError(a);
FS.genericErrors[a].stack = "<generic error, no stack>";
}));
}, staticInit:function() {
FS.ensureErrnoError();
FS.nameTable = Array(4096);
FS.mount(MEMFS, {}, "/");
FS.createDefaultDirectories();
FS.createDefaultDevices();
}, init:function(a, b, d) {
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 = !0;
FS.ensureErrnoError();
Module.stdin = a || Module.stdin;
Module.stdout = b || Module.stdout;
Module.stderr = d || Module.stderr;
FS.createStandardStreams();
}, quit:function() {
FS.init.initialized = !1;
for (var a = 0;a < FS.streams.length;a++) {
var b = FS.streams[a];
b && FS.close(b);
}
}, getMode:function(a, b) {
var d = 0;
a && (d |= 365);
b && (d |= 146);
return d;
}, joinPath:function(a, b) {
var d = PATH.join.apply(null, a);
b && "/" == d[0] && (d = d.substr(1));
return d;
}, absolutePath:function(a, b) {
return PATH.resolve(b, a);
}, standardizePath:function(a) {
return PATH.normalize(a);
}, findObject:function(a, b) {
var d = FS.analyzePath(a, b);
if (d.exists) {
return d.object;
}
___setErrNo(d.error);
return null;
}, analyzePath:function(a, b) {
try {
var d = FS.lookupPath(a, {follow:!b});
a = d.path;
} catch (e) {
}
var c = {isRoot:!1, exists:!1, error:0, name:null, path:null, object:null, parentExists:!1, parentPath:null, parentObject:null};
try {
d = FS.lookupPath(a, {parent:!0}), c.parentExists = !0, c.parentPath = d.path, c.parentObject = d.node, c.name = PATH.basename(a), d = FS.lookupPath(a, {follow:!b}), c.exists = !0, c.path = d.path, c.object = d.node, c.name = d.node.name, c.isRoot = "/" === d.path;
} catch (f) {
c.error = f.errno;
}
return c;
}, createFolder:function(a, b, d, e) {
a = PATH.join2("string" === typeof a ? a : FS.getPath(a), b);
d = FS.getMode(d, e);
return FS.mkdir(a, d);
}, createPath:function(a, b, d, e) {
a = "string" === typeof a ? a : FS.getPath(a);
for (b = b.split("/").reverse();b.length;) {
if (d = b.pop()) {
var c = PATH.join2(a, d);
try {
FS.mkdir(c);
} catch (f) {
}
a = c;
}
}
return c;
}, createFile:function(a, b, d, e, c) {
a = PATH.join2("string" === typeof a ? a : FS.getPath(a), b);
e = FS.getMode(e, c);
return FS.create(a, e);
}, createDataFile:function(a, b, d, e, c, f) {
a = b ? PATH.join2("string" === typeof a ? a : FS.getPath(a), b) : a;
e = FS.getMode(e, c);
c = FS.create(a, e);
if (d) {
if ("string" === typeof d) {
a = Array(d.length);
b = 0;
for (var g = d.length;b < g;++b) {
a[b] = d.charCodeAt(b);
}
d = a;
}
FS.chmod(c, e | 146);
a = FS.open(c, "w");
FS.write(a, d, 0, d.length, 0, f);
FS.close(a);
FS.chmod(c, e);
}
return c;
}, createDevice:function(a, b, d, e) {
a = PATH.join2("string" === typeof a ? a : FS.getPath(a), b);
b = FS.getMode(!!d, !!e);
FS.createDevice.major || (FS.createDevice.major = 64);
var c = FS.makedev(FS.createDevice.major++, 0);
FS.registerDevice(c, {open:function(a) {
a.seekable = !1;
}, close:function(a) {
e && e.buffer && e.buffer.length && e(10);
}, read:function(a, b, c, e, n) {
for (var p = n = 0;p < e;p++) {
var k;
try {
k = d();
} catch (r) {
throw new FS.ErrnoError(ERRNO_CODES.EIO);
}
if (void 0 === k && 0 === n) {
throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
}
if (null === k || void 0 === k) {
break;
}
n++;
b[c + p] = k;
}
n && (a.node.timestamp = Date.now());
return n;
}, write:function(a, b, c, d, n) {
for (n = 0;n < d;n++) {
try {
e(b[c + n]);
} catch (p) {
throw new FS.ErrnoError(ERRNO_CODES.EIO);
}
}
d && (a.node.timestamp = Date.now());
return n;
}});
return FS.mkdev(a, b, c);
}, createLink:function(a, b, d, e, c) {
a = PATH.join2("string" === typeof a ? a : FS.getPath(a), b);
return FS.symlink(d, a);
}, forceLoadFile:function(a) {
if (a.isDevice || a.isFolder || a.link || a.contents) {
return!0;
}
var b = !0;
if ("undefined" !== typeof XMLHttpRequest) {
throw 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.");
}
if (Module.read) {
try {
a.contents = intArrayFromString(Module.read(a.url), !0), a.usedBytes = a.contents.length;
} catch (d) {
b = !1;
}
} else {
throw Error("Cannot load without read() or XMLHttpRequest.");
}
b || ___setErrNo(ERRNO_CODES.EIO);
return b;
}, createLazyFile:function(a, b, d, e, c) {
function f() {
this.lengthKnown = !1;
this.chunks = [];
}
f.prototype.get = function(a) {
if (!(a > this.length - 1 || 0 > a)) {
var b = a % this.chunkSize;
return this.getter(a / this.chunkSize | 0)[b];
}
};
f.prototype.setDataGetter = function(a) {
this.getter = a;
};
f.prototype.cacheLength = function() {
var a = new XMLHttpRequest;
a.open("HEAD", d, !1);
a.send(null);
if (!(200 <= a.status && 300 > a.status || 304 === a.status)) {
throw Error("Couldn't load " + d + ". Status: " + a.status);
}
var b = Number(a.getResponseHeader("Content-length")), c, e = 1048576;
(c = a.getResponseHeader("Accept-Ranges")) && "bytes" === c || (e = b);
var f = this;
f.setDataGetter(function(a) {
var c = a * e, g = (a + 1) * e - 1, g = Math.min(g, b - 1);
if ("undefined" === typeof f.chunks[a]) {
var h = f.chunks;
if (c > g) {
throw Error("invalid range (" + c + ", " + g + ") or no bytes requested!");
}
if (g > b - 1) {
throw Error("only " + b + " bytes available! programmer error!");
}
var k = new XMLHttpRequest;
k.open("GET", d, !1);
b !== e && k.setRequestHeader("Range", "bytes=" + c + "-" + g);
"undefined" != typeof Uint8Array && (k.responseType = "arraybuffer");
k.overrideMimeType && k.overrideMimeType("text/plain; charset=x-user-defined");
k.send(null);
if (!(200 <= k.status && 300 > k.status || 304 === k.status)) {
throw Error("Couldn't load " + d + ". Status: " + k.status);
}
c = void 0 !== k.response ? new Uint8Array(k.response || []) : intArrayFromString(k.responseText || "", !0);
h[a] = c;
}
if ("undefined" === typeof f.chunks[a]) {
throw Error("doXHR failed!");
}
return f.chunks[a];
});
this._length = b;
this._chunkSize = e;
this.lengthKnown = !0;
};
if ("undefined" !== typeof XMLHttpRequest) {
if (!ENVIRONMENT_IS_WORKER) {
throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";
}
var g = new f;
Object.defineProperty(g, "length", {get:function() {
this.lengthKnown || this.cacheLength();
return this._length;
}});
Object.defineProperty(g, "chunkSize", {get:function() {
this.lengthKnown || this.cacheLength();
return this._chunkSize;
}});
g = {isDevice:!1, contents:g};
} else {
g = {isDevice:!1, url:d};
}
var h = FS.createFile(a, b, g, e, c);
g.contents ? h.contents = g.contents : g.url && (h.contents = null, h.url = g.url);
Object.defineProperty(h, "usedBytes", {get:function() {
return this.contents.length;
}});
var l = {};
Object.keys(h.stream_ops).forEach(function(a) {
var b = h.stream_ops[a];
l[a] = function() {
if (!FS.forceLoadFile(h)) {
throw new FS.ErrnoError(ERRNO_CODES.EIO);
}
return b.apply(null, arguments);
};
});
l.read = function(a, b, c, d, e) {
if (!FS.forceLoadFile(h)) {
throw new FS.ErrnoError(ERRNO_CODES.EIO);
}
a = a.node.contents;
if (e >= a.length) {
return 0;
}
d = Math.min(a.length - e, d);
assert(0 <= d);
if (a.slice) {
for (var f = 0;f < d;f++) {
b[c + f] = a[e + f];
}
} else {
for (f = 0;f < d;f++) {
b[c + f] = a.get(e + f);
}
}
return d;
};
h.stream_ops = l;
return h;
}, createPreloadedFile:function(a, b, d, e, c, f, g, h, l) {
function n(d) {
function n(d) {
h || FS.createDataFile(a, b, d, e, c, l);
f && f();
removeRunDependency("cp " + p);
}
var B = !1;
Module.preloadPlugins.forEach(function(a) {
!B && a.canHandle(p) && (a.handle(d, p, n, function() {
g && g();
removeRunDependency("cp " + p);
}), B = !0);
});
B || n(d);
}
Browser.init();
var p = b ? PATH.resolve(PATH.join2(a, b)) : a;
addRunDependency("cp " + p);
"string" == typeof d ? Browser.asyncLoad(d, function(a) {
n(a);
}, g) : n(d);
}, 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(a, b, d) {
b = b || function() {
};
d = d || function() {
};
var e = FS.indexedDB();
try {
var c = e.open(FS.DB_NAME(), FS.DB_VERSION);
} catch (f) {
return d(f);
}
c.onupgradeneeded = function() {
console.log("creating db");
c.result.createObjectStore(FS.DB_STORE_NAME);
};
c.onsuccess = function() {
var e = c.result.transaction([FS.DB_STORE_NAME], "readwrite"), f = e.objectStore(FS.DB_STORE_NAME), l = 0, n = 0, p = a.length;
a.forEach(function(a) {
a = f.put(FS.analyzePath(a).object.contents, a);
a.onsuccess = function() {
l++;
l + n == p && (0 == n ? b() : d());
};
a.onerror = function() {
n++;
l + n == p && (0 == n ? b() : d());
};
});
e.onerror = d;
};
c.onerror = d;
}, loadFilesFromDB:function(a, b, d) {
b = b || function() {
};
d = d || function() {
};
var e = FS.indexedDB();
try {
var c = e.open(FS.DB_NAME(), FS.DB_VERSION);
} catch (f) {
return d(f);
}
c.onupgradeneeded = d;
c.onsuccess = function() {
var e = c.result;
try {
var f = e.transaction([FS.DB_STORE_NAME], "readonly");
} catch (l) {
d(l);
return;
}
var n = f.objectStore(FS.DB_STORE_NAME), p = 0, k = 0, r = a.length;
a.forEach(function(a) {
var c = n.get(a);
c.onsuccess = function() {
FS.analyzePath(a).exists && FS.unlink(a);
FS.createDataFile(PATH.dirname(a), PATH.basename(a), c.result, !0, !0, !0);
p++;
p + k == r && (0 == k ? b() : d());
};
c.onerror = function() {
k++;
p + k == r && (0 == k ? b() : d());
};
});
f.onerror = d;
};
c.onerror = d;
}};
function _mkport() {
throw "TODO";
}
var SOCKFS = {mount:function(a) {
Module.websocket = Module.websocket && "object" === typeof Module.websocket ? Module.websocket : {};
Module.websocket._callbacks = {};
Module.websocket.on = function(a, d) {
"function" === typeof d && (this._callbacks[a] = d);
return this;
};
Module.websocket.emit = function(a, d) {
"function" === typeof this._callbacks[a] && this._callbacks[a].call(this, d);
};
return FS.createNode(null, "/", 16895, 0);
}, createSocket:function(a, b, d) {
d && assert(1 == b == (6 == d));
a = {family:a, type:b, protocol:d, server:null, error:null, peers:{}, pending:[], recv_queue:[], sock_ops:SOCKFS.websocket_sock_ops};
b = SOCKFS.nextname();
d = FS.createNode(SOCKFS.root, b, 49152, 0);
d.sock = a;
b = FS.createStream({path:b, node:d, flags:FS.modeStringToFlags("r+"), seekable:!1, stream_ops:SOCKFS.stream_ops});
a.stream = b;
return a;
}, getSocket:function(a) {
return(a = FS.getStream(a)) && FS.isSocket(a.node.mode) ? a.node.sock : null;
}, stream_ops:{poll:function(a) {
a = a.node.sock;
return a.sock_ops.poll(a);
}, ioctl:function(a, b, d) {
a = a.node.sock;
return a.sock_ops.ioctl(a, b, d);
}, read:function(a, b, d, e, c) {
a = a.node.sock;
e = a.sock_ops.recvmsg(a, e);
if (!e) {
return 0;
}
b.set(e.buffer, d);
return e.buffer.length;
}, write:function(a, b, d, e, c) {
a = a.node.sock;
return a.sock_ops.sendmsg(a, b, d, e);
}, close:function(a) {
a = a.node.sock;
a.sock_ops.close(a);
}}, nextname:function() {
SOCKFS.nextname.current || (SOCKFS.nextname.current = 0);
return "socket[" + SOCKFS.nextname.current++ + "]";
}, websocket_sock_ops:{createPeer:function(a, b, d) {
var e;
"object" === typeof b && (e = b, d = b = null);
if (e) {
if (e._socket) {
b = e._socket.remoteAddress, d = e._socket.remotePort;
} else {
d = /ws[s]?:\/\/([^:]+):(\d+)/.exec(e.url);
if (!d) {
throw Error("WebSocket URL must be in the format ws(s)://address:port");
}
b = d[1];
d = parseInt(d[2], 10);
}
} else {
try {
var c = Module.websocket && "object" === typeof Module.websocket, f = "ws:#".replace("#", "//");
c && "string" === typeof Module.websocket.url && (f = Module.websocket.url);
if ("ws://" === f || "wss://" === f) {
var g = b.split("/"), f = f + g[0] + ":" + d + "/" + g.slice(1).join("/")
}
g = "binary";
c && "string" === typeof Module.websocket.subprotocol && (g = Module.websocket.subprotocol);
var g = g.replace(/^ +| +$/g, "").split(/ *, */), h = ENVIRONMENT_IS_NODE ? {protocol:g.toString()} : g;
e = new (ENVIRONMENT_IS_NODE ? require("ws") : window.WebSocket)(f, h);
e.binaryType = "arraybuffer";
} catch (l) {
throw new FS.ErrnoError(ERRNO_CODES.EHOSTUNREACH);
}
}
b = {addr:b, port:d, socket:e, dgram_send_queue:[]};
SOCKFS.websocket_sock_ops.addPeer(a, b);
SOCKFS.websocket_sock_ops.handlePeerEvents(a, b);
2 === a.type && "undefined" !== typeof a.sport && b.dgram_send_queue.push(new Uint8Array([255, 255, 255, 255, 112, 111, 114, 116, (a.sport & 65280) >> 8, a.sport & 255]));
return b;
}, getPeer:function(a, b, d) {
return a.peers[b + ":" + d];
}, addPeer:function(a, b) {
a.peers[b.addr + ":" + b.port] = b;
}, removePeer:function(a, b) {
delete a.peers[b.addr + ":" + b.port];
}, handlePeerEvents:function(a, b) {
function d(c) {
assert("string" !== typeof c && void 0 !== c.byteLength);
c = new Uint8Array(c);
var d = e;
e = !1;
d && 10 === c.length && 255 === c[0] && 255 === c[1] && 255 === c[2] && 255 === c[3] && 112 === c[4] && 111 === c[5] && 114 === c[6] && 116 === c[7] ? (c = c[8] << 8 | c[9], SOCKFS.websocket_sock_ops.removePeer(a, b), b.port = c, SOCKFS.websocket_sock_ops.addPeer(a, b)) : (a.recv_queue.push({addr:b.addr, port:b.port, data:c}), Module.websocket.emit("message", a.stream.fd));
}
var e = !0, c = function() {
Module.websocket.emit("open", a.stream.fd);
try {
for (var c = b.dgram_send_queue.shift();c;) {
b.socket.send(c), c = b.dgram_send_queue.shift();
}
} catch (d) {
b.socket.close();
}
};
ENVIRONMENT_IS_NODE ? (b.socket.on("open", c), b.socket.on("message", function(a, b) {
b.binary && d((new Uint8Array(a)).buffer);
}), b.socket.on("close", function() {
Module.websocket.emit("close", a.stream.fd);
}), b.socket.on("error", function(b) {
a.error = ERRNO_CODES.ECONNREFUSED;
Module.websocket.emit("error", [a.stream.fd, a.error, "ECONNREFUSED: Connection refused"]);
})) : (b.socket.onopen = c, b.socket.onclose = function() {
Module.websocket.emit("close", a.stream.fd);
}, b.socket.onmessage = function(a) {
d(a.data);
}, b.socket.onerror = function(b) {
a.error = ERRNO_CODES.ECONNREFUSED;
Module.websocket.emit("error", [a.stream.fd, a.error, "ECONNREFUSED: Connection refused"]);
});
}, poll:function(a) {
if (1 === a.type && a.server) {
return a.pending.length ? 65 : 0;
}
var b = 0, d = 1 === a.type ? SOCKFS.websocket_sock_ops.getPeer(a, a.daddr, a.dport) : null;
if (a.recv_queue.length || !d || d && d.socket.readyState === d.socket.CLOSING || d && d.socket.readyState === d.socket.CLOSED) {
b |= 65;
}
if (!d || d && d.socket.readyState === d.socket.OPEN) {
b |= 4;
}
if (d && d.socket.readyState === d.socket.CLOSING || d && d.socket.readyState === d.socket.CLOSED) {
b |= 16;
}
return b;
}, ioctl:function(a, b, d) {
switch(b) {
case 21531:
return b = 0, a.recv_queue.length && (b = a.recv_queue[0].data.length), HEAP32[d >> 2] = b, 0;
default:
return ERRNO_CODES.EINVAL;
}
}, close:function(a) {
if (a.server) {
try {
a.server.close();
} catch (b) {
}
a.server = null;
}
for (var d = Object.keys(a.peers), e = 0;e < d.length;e++) {
var c = a.peers[d[e]];
try {
c.socket.close();
} catch (f) {
}
SOCKFS.websocket_sock_ops.removePeer(a, c);
}
return 0;
}, bind:function(a, b, d) {
if ("undefined" !== typeof a.saddr || "undefined" !== typeof a.sport) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
a.saddr = b;
a.sport = d || _mkport();
if (2 === a.type) {
a.server && (a.server.close(), a.server = null);
try {
a.sock_ops.listen(a, 0);
} catch (e) {
if (!(e instanceof FS.ErrnoError)) {
throw e;
}
if (e.errno !== ERRNO_CODES.EOPNOTSUPP) {
throw e;
}
}
}
}, connect:function(a, b, d) {
if (a.server) {
throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP);
}
if ("undefined" !== typeof a.daddr && "undefined" !== typeof a.dport) {
var e = SOCKFS.websocket_sock_ops.getPeer(a, a.daddr, a.dport);
if (e) {
if (e.socket.readyState === e.socket.CONNECTING) {
throw new FS.ErrnoError(ERRNO_CODES.EALREADY);
}
throw new FS.ErrnoError(ERRNO_CODES.EISCONN);
}
}
b = SOCKFS.websocket_sock_ops.createPeer(a, b, d);
a.daddr = b.addr;
a.dport = b.port;
throw new FS.ErrnoError(ERRNO_CODES.EINPROGRESS);
}, listen:function(a, b) {
if (!ENVIRONMENT_IS_NODE) {
throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP);
}
if (a.server) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
var d = require("ws").Server;
a.server = new d({host:a.saddr, port:a.sport});
Module.websocket.emit("listen", a.stream.fd);
a.server.on("connection", function(b) {
if (1 === a.type) {
var c = SOCKFS.createSocket(a.family, a.type, a.protocol);
b = SOCKFS.websocket_sock_ops.createPeer(c, b);
c.daddr = b.addr;
c.dport = b.port;
a.pending.push(c);
Module.websocket.emit("connection", c.stream.fd);
} else {
SOCKFS.websocket_sock_ops.createPeer(a, b), Module.websocket.emit("connection", a.stream.fd);
}
});
a.server.on("closed", function() {
Module.websocket.emit("close", a.stream.fd);
a.server = null;
});
a.server.on("error", function(b) {
a.error = ERRNO_CODES.EHOSTUNREACH;
Module.websocket.emit("error", [a.stream.fd, a.error, "EHOSTUNREACH: Host is unreachable"]);
});
}, accept:function(a) {
if (!a.server) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
var b = a.pending.shift();
b.stream.flags = a.stream.flags;
return b;
}, getname:function(a, b) {
var d, e;
if (b) {
if (void 0 === a.daddr || void 0 === a.dport) {
throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN);
}
d = a.daddr;
e = a.dport;
} else {
d = a.saddr || 0, e = a.sport || 0;
}
return{addr:d, port:e};
}, sendmsg:function(a, b, d, e, c, f) {
if (2 === a.type) {
if (void 0 === c || void 0 === f) {
c = a.daddr, f = a.dport;
}
if (void 0 === c || void 0 === f) {
throw new FS.ErrnoError(ERRNO_CODES.EDESTADDRREQ);
}
} else {
c = a.daddr, f = a.dport;
}
var g = SOCKFS.websocket_sock_ops.getPeer(a, c, f);
if (1 === a.type) {
if (!g || g.socket.readyState === g.socket.CLOSING || g.socket.readyState === g.socket.CLOSED) {
throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN);
}
if (g.socket.readyState === g.socket.CONNECTING) {
throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
}
}
b = b instanceof Array || b instanceof ArrayBuffer ? b.slice(d, d + e) : b.buffer.slice(b.byteOffset + d, b.byteOffset + d + e);
if (2 === a.type && (!g || g.socket.readyState !== g.socket.OPEN)) {
return g && g.socket.readyState !== g.socket.CLOSING && g.socket.readyState !== g.socket.CLOSED || (g = SOCKFS.websocket_sock_ops.createPeer(a, c, f)), g.dgram_send_queue.push(b), e;
}
try {
return g.socket.send(b), e;
} catch (h) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
}, recvmsg:function(a, b) {
if (1 === a.type && a.server) {
throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN);
}
var d = a.recv_queue.shift();
if (!d) {
if (1 === a.type) {
if (d = SOCKFS.websocket_sock_ops.getPeer(a, a.daddr, a.dport)) {
if (d.socket.readyState === d.socket.CLOSING || d.socket.readyState === d.socket.CLOSED) {
return null;
}
throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
}
throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN);
}
throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
}
var e = d.data.byteLength || d.data.length, c = d.data.byteOffset || 0, f = d.data.buffer || d.data, g = Math.min(b, e), h = {buffer:new Uint8Array(f, c, g), addr:d.addr, port:d.port};
1 === a.type && g < e && (d.data = new Uint8Array(f, c + g, e - g), a.recv_queue.unshift(d));
return h;
}}};
function _send(a, b, d, e) {
return SOCKFS.getSocket(a) ? _write(a, b, d) : (___setErrNo(ERRNO_CODES.EBADF), -1);
}
function _pwrite(a, b, d, e) {
a = FS.getStream(a);
if (!a) {
return ___setErrNo(ERRNO_CODES.EBADF), -1;
}
try {
return FS.write(a, HEAP8, b, d, e);
} catch (c) {
return FS.handleFSError(c), -1;
}
}
function _write(a, b, d) {
a = FS.getStream(a);
if (!a) {
return ___setErrNo(ERRNO_CODES.EBADF), -1;
}
try {
return FS.write(a, HEAP8, b, d);
} catch (e) {
return FS.handleFSError(e), -1;
}
}
function _fileno(a) {
return(a = FS.getStreamFromPtr(a)) ? a.fd : -1;
}
function _fwrite(a, b, d, e) {
d *= b;
if (0 == d) {
return 0;
}
var c = _fileno(e);
a = _write(c, a, d);
if (-1 == a) {
if (b = FS.getStreamFromPtr(e)) {
b.error = !0;
}
return 0;
}
return a / b | 0;
}
Module._strlen = _strlen;
function __reallyNegative(a) {
return 0 > a || 0 === a && -Infinity === 1 / a;
}
function __formatString(a, b) {
function d(a) {
var d;
"double" === a ? d = (HEAP32[tempDoublePtr >> 2] = HEAP32[b + c >> 2], HEAP32[tempDoublePtr + 4 >> 2] = HEAP32[b + (c + 4) >> 2], +HEAPF64[tempDoublePtr >> 3]) : "i64" == a ? d = [HEAP32[b + c >> 2], HEAP32[b + (c + 4) >> 2]] : (a = "i32", d = HEAP32[b + c >> 2]);
c += Runtime.getNativeFieldSize(a);
return d;
}
for (var e = a, c = 0, f = [], g, h;;) {
var l = e;
g = HEAP8[e >> 0];
if (0 === g) {
break;
}
h = HEAP8[e + 1 >> 0];
if (37 == g) {
var n = !1, p = !1, k = !1, r = !1, B = !1;
a: for (;;) {
switch(h) {
case 43:
n = !0;
break;
case 45:
p = !0;
break;
case 35:
k = !0;
break;
case 48:
if (r) {
break a;
} else {
r = !0;
break;
}
;
case 32:
B = !0;
break;
default:
break a;
}
e++;
h = HEAP8[e + 1 >> 0];
}
var K = 0;
if (42 == h) {
K = d("i32"), e++, h = HEAP8[e + 1 >> 0];
} else {
for (;48 <= h && 57 >= h;) {
K = 10 * K + (h - 48), e++, h = HEAP8[e + 1 >> 0];
}
}
var z = !1, F = -1;
if (46 == h) {
F = 0;
z = !0;
e++;
h = HEAP8[e + 1 >> 0];
if (42 == h) {
F = d("i32"), e++;
} else {
for (;;) {
h = HEAP8[e + 1 >> 0];
if (48 > h || 57 < h) {
break;
}
F = 10 * F + (h - 48);
e++;
}
}
h = HEAP8[e + 1 >> 0];
}
0 > F && (F = 6, z = !1);
var w;
switch(String.fromCharCode(h)) {
case "h":
h = HEAP8[e + 2 >> 0];
104 == h ? (e++, w = 1) : w = 2;
break;
case "l":
h = HEAP8[e + 2 >> 0];
108 == h ? (e++, w = 8) : w = 4;
break;
case "L":
;
case "q":
;
case "j":
w = 8;
break;
case "z":
;
case "t":
;
case "I":
w = 4;
break;
default:
w = null;
}
w && e++;
h = HEAP8[e + 1 >> 0];
switch(String.fromCharCode(h)) {
case "d":
;
case "i":
;
case "u":
;
case "o":
;
case "x":
;
case "X":
;
case "p":
l = 100 == h || 105 == h;
w = w || 4;
var y = g = d("i" + 8 * w), m;
8 == w && (g = Runtime.makeBigInt(g[0], g[1], 117 == h));
if (4 >= w) {
var ia = Math.pow(256, w) - 1;
g = (l ? reSign : unSign)(g & ia, 8 * w);
}
ia = Math.abs(g);
l = "";
if (100 == h || 105 == h) {
m = 8 == w && i64Math ? i64Math.stringify(y[0], y[1], null) : reSign(g, 8 * w, 1).toString(10);
} else {
if (117 == h) {
m = 8 == w && i64Math ? i64Math.stringify(y[0], y[1], !0) : unSign(g, 8 * w, 1).toString(10), g = Math.abs(g);
} else {
if (111 == h) {
m = (k ? "0" : "") + ia.toString(8);
} else {
if (120 == h || 88 == h) {
l = k && 0 != g ? "0x" : "";
if (8 == w && i64Math) {
if (y[1]) {
m = (y[1] >>> 0).toString(16);
for (k = (y[0] >>> 0).toString(16);8 > k.length;) {
k = "0" + k;
}
m += k;
} else {
m = (y[0] >>> 0).toString(16);
}
} else {
if (0 > g) {
g = -g;
m = (ia - 1).toString(16);
y = [];
for (k = 0;k < m.length;k++) {
y.push((15 - parseInt(m[k], 16)).toString(16));
}
for (m = y.join("");m.length < 2 * w;) {
m = "f" + m;
}
} else {
m = ia.toString(16);
}
}
88 == h && (l = l.toUpperCase(), m = m.toUpperCase());
} else {
112 == h && (0 === ia ? m = "(nil)" : (l = "0x", m = ia.toString(16)));
}
}
}
}
if (z) {
for (;m.length < F;) {
m = "0" + m;
}
}
0 <= g && (n ? l = "+" + l : B && (l = " " + l));
"-" == m.charAt(0) && (l = "-" + l, m = m.substr(1));
for (;l.length + m.length < K;) {
p ? m += " " : r ? m = "0" + m : l = " " + l;
}
m = l + m;
m.split("").forEach(function(a) {
f.push(a.charCodeAt(0));
});
break;
case "f":
;
case "F":
;
case "e":
;
case "E":
;
case "g":
;
case "G":
g = d("double");
if (isNaN(g)) {
m = "nan", r = !1;
} else {
if (isFinite(g)) {
z = !1;
w = Math.min(F, 20);
if (103 == h || 71 == h) {
z = !0, F = F || 1, w = parseInt(g.toExponential(w).split("e")[1], 10), F > w && -4 <= w ? (h = (103 == h ? "f" : "F").charCodeAt(0), F -= w + 1) : (h = (103 == h ? "e" : "E").charCodeAt(0), F--), w = Math.min(F, 20);
}
if (101 == h || 69 == h) {
m = g.toExponential(w), /[eE][-+]\d$/.test(m) && (m = m.slice(0, -1) + "0" + m.slice(-1));
} else {
if (102 == h || 70 == h) {
m = g.toFixed(w), 0 === g && __reallyNegative(g) && (m = "-" + m);
}
}
l = m.split("e");
if (z && !k) {
for (;1 < l[0].length && -1 != l[0].indexOf(".") && ("0" == l[0].slice(-1) || "." == l[0].slice(-1));) {
l[0] = l[0].slice(0, -1);
}
} else {
for (k && -1 == m.indexOf(".") && (l[0] += ".");F > w++;) {
l[0] += "0";
}
}
m = l[0] + (1 < l.length ? "e" + l[1] : "");
69 == h && (m = m.toUpperCase());
0 <= g && (n ? m = "+" + m : B && (m = " " + m));
} else {
m = (0 > g ? "-" : "") + "inf", r = !1;
}
}
for (;m.length < K;) {
m = p ? m + " " : !r || "-" != m[0] && "+" != m[0] ? (r ? "0" : " ") + m : m[0] + "0" + m.slice(1);
}
97 > h && (m = m.toUpperCase());
m.split("").forEach(function(a) {
f.push(a.charCodeAt(0));
});
break;
case "s":
r = (n = d("i8*")) ? _strlen(n) : 6;
z && (r = Math.min(r, F));
if (!p) {
for (;r < K--;) {
f.push(32);
}
}
if (n) {
for (k = 0;k < r;k++) {
f.push(HEAPU8[n++ >> 0]);
}
} else {
f = f.concat(intArrayFromString("(null)".substr(0, r), !0));
}
if (p) {
for (;r < K--;) {
f.push(32);
}
}
break;
case "c":
for (p && f.push(d("i8"));0 < --K;) {
f.push(32);
}
p || f.push(d("i8"));
break;
case "n":
p = d("i32*");
HEAP32[p >> 2] = f.length;
break;
case "%":
f.push(g);
break;
default:
for (k = l;k < e + 2;k++) {
f.push(HEAP8[k >> 0]);
}
;
}
e += 2;
} else {
f.push(g), e += 1;
}
}
return f;
}
function _fprintf(a, b, d) {
d = __formatString(b, d);
b = Runtime.stackSave();
a = _fwrite(allocate(d, "i8", ALLOC_STACK), 1, d.length, a);
Runtime.stackRestore(b);
return a;
}
function _printf(a, b) {
return _fprintf(HEAP32[_stdout >> 2], a, b);
}
function _sbrk(a) {
var b = _sbrk;
b.called || (DYNAMICTOP = alignMemoryPage(DYNAMICTOP), b.called = !0, assert(Runtime.dynamicAlloc), b.alloc = Runtime.dynamicAlloc, Runtime.dynamicAlloc = function() {
abort("cannot dynamically allocate, sbrk now has control");
});
var d = DYNAMICTOP;
0 != a && b.alloc(a);
return d;
}
function _sysconf(a) {
switch(a) {
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 1E3;
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 "object" === typeof navigator ? navigator.hardwareConcurrency || 1 : 1;
}
___setErrNo(ERRNO_CODES.EINVAL);
return-1;
}
Module._memset = _memset;
function ___errno_location() {
return ___errno_state;
}
function _abort() {
Module.abort();
}
function _emscripten_set_main_loop_timing(a, b) {
Browser.mainLoop.timingMode = a;
Browser.mainLoop.timingValue = b;
if (!Browser.mainLoop.func) {
return console.error("emscripten_set_main_loop_timing: Cannot set timing mode for main loop since a main loop does not exist! Call emscripten_set_main_loop first to set one up."), 1;
}
0 == a ? (Browser.mainLoop.scheduler = function() {
setTimeout(Browser.mainLoop.runner, b);
}, Browser.mainLoop.method = "timeout") : 1 == a && (Browser.mainLoop.scheduler = function() {
Browser.requestAnimationFrame(Browser.mainLoop.runner);
}, Browser.mainLoop.method = "rAF");
return 0;
}
function _emscripten_set_main_loop(a, b, d, e) {
Module.noExitRuntime = !0;
assert(!Browser.mainLoop.func, "emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.");
Browser.mainLoop.func = a;
Browser.mainLoop.arg = e;
var c = Browser.mainLoop.currentlyRunningMainloop;
Browser.mainLoop.runner = function() {
if (!ABORT) {
if (0 < Browser.mainLoop.queue.length) {
var b = Date.now(), d = Browser.mainLoop.queue.shift();
d.func(d.arg);
if (Browser.mainLoop.remainingBlockers) {
var h = Browser.mainLoop.remainingBlockers, l = 0 == h % 1 ? h - 1 : Math.floor(h);
Browser.mainLoop.remainingBlockers = d.counted ? l : (8 * h + (l + .5)) / 9;
}
console.log('main loop blocker "' + d.name + '" took ' + (Date.now() - b) + " ms");
Browser.mainLoop.updateStatus();
setTimeout(Browser.mainLoop.runner, 0);
} else {
c < Browser.mainLoop.currentlyRunningMainloop || (Browser.mainLoop.currentFrameNumber = Browser.mainLoop.currentFrameNumber + 1 | 0, 1 == Browser.mainLoop.timingMode && 1 < Browser.mainLoop.timingValue && 0 != Browser.mainLoop.currentFrameNumber % Browser.mainLoop.timingValue ? Browser.mainLoop.scheduler() : ("timeout" === Browser.mainLoop.method && Module.ctx && (Module.printErr("Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!"),
Browser.mainLoop.method = ""), Browser.mainLoop.runIter(function() {
"undefined" !== typeof e ? Runtime.dynCall("vi", a, [e]) : Runtime.dynCall("v", a);
}), c < Browser.mainLoop.currentlyRunningMainloop || ("object" === typeof SDL && SDL.audio && SDL.audio.queueNewAudioData && SDL.audio.queueNewAudioData(), Browser.mainLoop.scheduler())));
}
}
};
b && 0 < b ? _emscripten_set_main_loop_timing(0, 1E3 / b) : _emscripten_set_main_loop_timing(1, 1);
Browser.mainLoop.scheduler();
if (d) {
throw "SimulateInfiniteLoop";
}
}
var Browser = {mainLoop:{scheduler:null, method:"", currentlyRunningMainloop:0, func:null, arg:0, timingMode:0, timingValue:0, currentFrameNumber:0, queue:[], pause:function() {
Browser.mainLoop.scheduler = null;
Browser.mainLoop.currentlyRunningMainloop++;
}, resume:function() {
Browser.mainLoop.currentlyRunningMainloop++;
var a = Browser.mainLoop.timingMode, b = Browser.mainLoop.timingValue, d = Browser.mainLoop.func;
Browser.mainLoop.func = null;
_emscripten_set_main_loop(d, 0, !1, Browser.mainLoop.arg);
_emscripten_set_main_loop_timing(a, b);
}, updateStatus:function() {
if (Module.setStatus) {
var a = Module.statusMessage || "Please wait...", b = Browser.mainLoop.remainingBlockers, d = Browser.mainLoop.expectedBlockers;
b ? b < d ? Module.setStatus(a + " (" + (d - b) + "/" + d + ")") : Module.setStatus(a) : Module.setStatus("");
}
}, runIter:function(a) {
if (!(ABORT || Module.preMainLoop && !1 === Module.preMainLoop())) {
try {
a();
} catch (b) {
if (b instanceof ExitStatus) {
return;
}
b && "object" === typeof b && b.stack && Module.printErr("exception thrown: " + [b, b.stack]);
throw b;
}
Module.postMainLoop && Module.postMainLoop();
}
}}, isFullScreen:!1, pointerLock:!1, moduleContextCreatedCallbacks:[], workers:[], init:function() {
function a() {
Browser.pointerLock = document.pointerLockElement === d || document.mozPointerLockElement === d || document.webkitPointerLockElement === d || document.msPointerLockElement === d;
}
Module.preloadPlugins || (Module.preloadPlugins = []);
if (!Browser.initted) {
Browser.initted = !0;
try {
new Blob, Browser.hasBlobConstructor = !0;
} catch (b) {
Browser.hasBlobConstructor = !1, console.log("warning: no blob constructor, cannot create blobs with mimetypes");
}
Browser.BlobBuilder = "undefined" != typeof MozBlobBuilder ? MozBlobBuilder : "undefined" != typeof WebKitBlobBuilder ? WebKitBlobBuilder : Browser.hasBlobConstructor ? null : console.log("warning: no BlobBuilder");
Browser.URLObject = "undefined" != typeof window ? window.URL ? window.URL : window.webkitURL : void 0;
Module.noImageDecoding || "undefined" !== typeof Browser.URLObject || (console.log("warning: Browser does not support creating object URLs. Built-in browser image decoding will not be available."), Module.noImageDecoding = !0);
Module.preloadPlugins.push({canHandle:function(a) {
return!Module.noImageDecoding && /\.(jpg|jpeg|png|bmp)$/i.test(a);
}, handle:function(a, b, d, g) {
var h = null;
if (Browser.hasBlobConstructor) {
try {
h = new Blob([a], {type:Browser.getMimetype(b)}), h.size !== a.length && (h = new Blob([(new Uint8Array(a)).buffer], {type:Browser.getMimetype(b)}));
} catch (l) {
Runtime.warnOnce("Blob constructor present but fails: " + l + "; falling back to blob builder");
}
}
h || (h = new Browser.BlobBuilder, h.append((new Uint8Array(a)).buffer), h = h.getBlob());
var n = Browser.URLObject.createObjectURL(h);
assert("string" == typeof n, "createObjectURL must return a url as a string");
var p = new Image;
p.onload = function() {
assert(p.complete, "Image " + b + " could not be decoded");
var g = document.createElement("canvas");
g.width = p.width;
g.height = p.height;
g.getContext("2d").drawImage(p, 0, 0);
Module.preloadedImages[b] = g;
Browser.URLObject.revokeObjectURL(n);
d && d(a);
};
p.onerror = function(a) {
console.log("Image " + n + " could not be decoded");
g && g();
};
p.src = n;
}});
Module.preloadPlugins.push({canHandle:function(a) {
return!Module.noAudioDecoding && a.substr(-4) in {".ogg":1, ".wav":1, ".mp3":1};
}, handle:function(a, b, d, g) {
function h(g) {
n || (n = !0, Module.preloadedAudios[b] = g, d && d(a));
}
function l() {
n || (n = !0, Module.preloadedAudios[b] = new Audio, g && g());
}
var n = !1;
if (Browser.hasBlobConstructor) {
try {
var p = new Blob([a], {type:Browser.getMimetype(b)});
} catch (k) {
return l();
}
p = Browser.URLObject.createObjectURL(p);
assert("string" == typeof p, "createObjectURL must return a url as a string");
var r = new Audio;
r.addEventListener("canplaythrough", function() {
h(r);
}, !1);
r.onerror = function(d) {
if (!n) {
console.log("warning: browser could not fully decode audio " + b + ", trying slower base64 approach");
d = "data:audio/x-" + b.substr(-3) + ";base64,";
for (var f = "", g = 0, k = 0, w = 0;w < a.length;w++) {
for (g = g << 8 | a[w], k += 8;6 <= k;) {
var l = g >> k - 6 & 63, k = k - 6, f = f + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[l]
}
}
2 == k ? (f += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(g & 3) << 4], f += "==") : 4 == k && (f += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(g & 15) << 2], f += "=");
r.src = d + f;
h(r);
}
};
r.src = p;
Browser.safeSetTimeout(function() {
h(r);
}, 1E4);
} else {
return l();
}
}});
var d = Module.canvas;
d && (d.requestPointerLock = d.requestPointerLock || d.mozRequestPointerLock || d.webkitRequestPointerLock || d.msRequestPointerLock || function() {
}, d.exitPointerLock = document.exitPointerLock || document.mozExitPointerLock || document.webkitExitPointerLock || document.msExitPointerLock || function() {
}, d.exitPointerLock = d.exitPointerLock.bind(document), document.addEventListener("pointerlockchange", a, !1), document.addEventListener("mozpointerlockchange", a, !1), document.addEventListener("webkitpointerlockchange", a, !1), document.addEventListener("mspointerlockchange", a, !1), Module.elementPointerLock && d.addEventListener("click", function(a) {
!Browser.pointerLock && d.requestPointerLock && (d.requestPointerLock(), a.preventDefault());
}, !1));
}
}, createContext:function(a, b, d, e) {
if (b && Module.ctx && a == Module.canvas) {
return Module.ctx;
}
var c, f;
if (b) {
f = {antialias:!1, alpha:!1};
if (e) {
for (var g in e) {
f[g] = e[g];
}
}
if (f = GL.createContext(a, f)) {
c = GL.getContext(f).GLctx;
}
a.style.backgroundColor = "black";
} else {
c = a.getContext("2d");
}
if (!c) {
return null;
}
d && (b || assert("undefined" === typeof GLctx, "cannot set in module if GLctx is used, but we are a non-GL context that would replace it"), Module.ctx = c, b && GL.makeContextCurrent(f), Module.useWebGL = b, Browser.moduleContextCreatedCallbacks.forEach(function(a) {
a();
}), Browser.init());
return c;
}, destroyContext:function(a, b, d) {
}, fullScreenHandlersInstalled:!1, lockPointer:void 0, resizeCanvas:void 0, requestFullScreen:function(a, b) {
function d() {
Browser.isFullScreen = !1;
var a = e.parentNode;
(document.webkitFullScreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.mozFullscreenElement || document.fullScreenElement || document.fullscreenElement || document.msFullScreenElement || document.msFullscreenElement || document.webkitCurrentFullScreenElement) === a ? (e.cancelFullScreen = document.cancelFullScreen || document.mozCancelFullScreen || document.webkitCancelFullScreen || document.msExitFullscreen || document.exitFullscreen || function() {
}, e.cancelFullScreen = e.cancelFullScreen.bind(document), Browser.lockPointer && e.requestPointerLock(), Browser.isFullScreen = !0, Browser.resizeCanvas && Browser.setFullScreenCanvasSize()) : (a.parentNode.insertBefore(e, a), a.parentNode.removeChild(a), Browser.resizeCanvas && Browser.setWindowedCanvasSize());
if (Module.onFullScreen) {
Module.onFullScreen(Browser.isFullScreen);
}
Browser.updateCanvasDimensions(e);
}
Browser.lockPointer = a;
Browser.resizeCanvas = b;
"undefined" === typeof Browser.lockPointer && (Browser.lockPointer = !0);
"undefined" === typeof Browser.resizeCanvas && (Browser.resizeCanvas = !1);
var e = Module.canvas;
Browser.fullScreenHandlersInstalled || (Browser.fullScreenHandlersInstalled = !0, document.addEventListener("fullscreenchange", d, !1), document.addEventListener("mozfullscreenchange", d, !1), document.addEventListener("webkitfullscreenchange", d, !1), document.addEventListener("MSFullscreenChange", d, !1));
var c = document.createElement("div");
e.parentNode.insertBefore(c, e);
c.appendChild(e);
c.requestFullScreen = c.requestFullScreen || c.mozRequestFullScreen || c.msRequestFullscreen || (c.webkitRequestFullScreen ? function() {
c.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
} : null);
c.requestFullScreen();
}, nextRAF:0, fakeRequestAnimationFrame:function(a) {
var b = Date.now();
if (0 === Browser.nextRAF) {
Browser.nextRAF = b + 1E3 / 60;
} else {
for (;b + 2 >= Browser.nextRAF;) {
Browser.nextRAF += 1E3 / 60;
}
}
b = Math.max(Browser.nextRAF - b, 0);
setTimeout(a, b);
}, requestAnimationFrame:function(a) {
"undefined" === typeof window ? Browser.fakeRequestAnimationFrame(a) : (window.requestAnimationFrame || (window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame || Browser.fakeRequestAnimationFrame), window.requestAnimationFrame(a));
}, safeCallback:function(a) {
return function() {
if (!ABORT) {
return a.apply(null, arguments);
}
};
}, safeRequestAnimationFrame:function(a) {
return Browser.requestAnimationFrame(function() {
ABORT || a();
});
}, safeSetTimeout:function(a, b) {
Module.noExitRuntime = !0;
return setTimeout(function() {
ABORT || a();
}, b);
}, safeSetInterval:function(a, b) {
Module.noExitRuntime = !0;
return setInterval(function() {
ABORT || a();
}, b);
}, getMimetype:function(a) {
return{jpg:"image/jpeg", jpeg:"image/jpeg", png:"image/png", bmp:"image/bmp", ogg:"audio/ogg", wav:"audio/wav", mp3:"audio/mpeg"}[a.substr(a.lastIndexOf(".") + 1)];
}, getUserMedia:function(a) {
window.getUserMedia || (window.getUserMedia = navigator.getUserMedia || navigator.mozGetUserMedia);
window.getUserMedia(a);
}, getMovementX:function(a) {
return a.movementX || a.mozMovementX || a.webkitMovementX || 0;
}, getMovementY:function(a) {
return a.movementY || a.mozMovementY || a.webkitMovementY || 0;
}, getMouseWheelDelta:function(a) {
var b = 0;
switch(a.type) {
case "DOMMouseScroll":
b = a.detail;
break;
case "mousewheel":
b = a.wheelDelta;
break;
case "wheel":
b = a.deltaY;
break;
default:
throw "unrecognized mouse wheel event: " + a.type;;
}
return b;
}, mouseX:0, mouseY:0, mouseMovementX:0, mouseMovementY:0, touches:{}, lastTouches:{}, calculateMouseEvent:function(a) {
if (Browser.pointerLock) {
"mousemove" != a.type && "mozMovementX" in a ? Browser.mouseMovementX = Browser.mouseMovementY = 0 : (Browser.mouseMovementX = Browser.getMovementX(a), Browser.mouseMovementY = Browser.getMovementY(a)), "undefined" != typeof SDL ? (Browser.mouseX = SDL.mouseX + Browser.mouseMovementX, Browser.mouseY = SDL.mouseY + Browser.mouseMovementY) : (Browser.mouseX += Browser.mouseMovementX, Browser.mouseY += Browser.mouseMovementY);
} else {
var b = Module.canvas.getBoundingClientRect(), d = Module.canvas.width, e = Module.canvas.height, c = "undefined" !== typeof window.scrollX ? window.scrollX : window.pageXOffset, f = "undefined" !== typeof window.scrollY ? window.scrollY : window.pageYOffset;
assert("undefined" !== typeof c && "undefined" !== typeof f, "Unable to retrieve scroll position, mouse positions likely broken.");
if ("touchstart" === a.type || "touchend" === a.type || "touchmove" === a.type) {
var g = a.touch;
if (void 0 !== g) {
if (c = g.pageX - (c + b.left), f = g.pageY - (f + b.top), c *= d / b.width, f *= e / b.height, b = {x:c, y:f}, "touchstart" === a.type) {
Browser.lastTouches[g.identifier] = b, Browser.touches[g.identifier] = b;
} else {
if ("touchend" === a.type || "touchmove" === a.type) {
Browser.lastTouches[g.identifier] = Browser.touches[g.identifier], Browser.touches[g.identifier] = {x:c, y:f};
}
}
}
} else {
g = a.pageX - (c + b.left), a = a.pageY - (f + b.top), g *= d / b.width, a *= e / b.height, Browser.mouseMovementX = g - Browser.mouseX, Browser.mouseMovementY = a - Browser.mouseY, Browser.mouseX = g, Browser.mouseY = a;
}
}
}, xhrLoad:function(a, b, d) {
var e = new XMLHttpRequest;
e.open("GET", a, !0);
e.responseType = "arraybuffer";
e.onload = function() {
200 == e.status || 0 == e.status && e.response ? b(e.response) : d();
};
e.onerror = d;
e.send(null);
}, asyncLoad:function(a, b, d, e) {
Browser.xhrLoad(a, function(c) {
assert(c, 'Loading data file "' + a + '" failed (no arrayBuffer).');
b(new Uint8Array(c));
e || removeRunDependency("al " + a);
}, function(b) {
if (d) {
d();
} else {
throw'Loading data file "' + a + '" failed.';
}
});
e || addRunDependency("al " + a);
}, resizeListeners:[], updateResizeListeners:function() {
var a = Module.canvas;
Browser.resizeListeners.forEach(function(b) {
b(a.width, a.height);
});
}, setCanvasSize:function(a, b, d) {
Browser.updateCanvasDimensions(Module.canvas, a, b);
d || Browser.updateResizeListeners();
}, windowedWidth:0, windowedHeight:0, setFullScreenCanvasSize:function() {
if ("undefined" != typeof SDL) {
var a = HEAPU32[SDL.screen + 0 * Runtime.QUANTUM_SIZE >> 2];
HEAP32[SDL.screen + 0 * Runtime.QUANTUM_SIZE >> 2] = a | 8388608;
}
Browser.updateResizeListeners();
}, setWindowedCanvasSize:function() {
if ("undefined" != typeof SDL) {
var a = HEAPU32[SDL.screen + 0 * Runtime.QUANTUM_SIZE >> 2];
HEAP32[SDL.screen + 0 * Runtime.QUANTUM_SIZE >> 2] = a & -8388609;
}
Browser.updateResizeListeners();
}, updateCanvasDimensions:function(a, b, d) {
b && d ? (a.widthNative = b, a.heightNative = d) : (b = a.widthNative, d = a.heightNative);
var e = b, c = d;
Module.forcedAspectRatio && 0 < Module.forcedAspectRatio && (e / c < Module.forcedAspectRatio ? e = Math.round(c * Module.forcedAspectRatio) : c = Math.round(e / Module.forcedAspectRatio));
if ((document.webkitFullScreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.mozFullscreenElement || document.fullScreenElement || document.fullscreenElement || document.msFullScreenElement || document.msFullscreenElement || document.webkitCurrentFullScreenElement) === a.parentNode && "undefined" != typeof screen) {
var f = Math.min(screen.width / e, screen.height / c), e = Math.round(e * f), c = Math.round(c * f)
}
Browser.resizeCanvas ? (a.width != e && (a.width = e), a.height != c && (a.height = c), "undefined" != typeof a.style && (a.style.removeProperty("width"), a.style.removeProperty("height"))) : (a.width != b && (a.width = b), a.height != d && (a.height = d), "undefined" != typeof a.style && (e != b || c != d ? (a.style.setProperty("width", e + "px", "important"), a.style.setProperty("height", c + "px", "important")) : (a.style.removeProperty("width"), a.style.removeProperty("height"))));
}, wgetRequests:{}, nextWgetRequestHandle:0, getNextWgetRequestHandle:function() {
var a = Browser.nextWgetRequestHandle;
Browser.nextWgetRequestHandle++;
return a;
}};
function _time(a) {
var b = Date.now() / 1E3 | 0;
a && (HEAP32[a >> 2] = b);
return b;
}
function _emscripten_memcpy_big(a, b, d) {
HEAPU8.set(HEAPU8.subarray(b, b + d), a);
return a;
}
Module._memcpy = _memcpy;
FS.staticInit();
__ATINIT__.unshift({func:function() {
Module.noFSInit || FS.init.initialized || FS.init();
}});
__ATMAIN__.push({func:function() {
FS.ignorePermissions = !1;
}});
__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);
}});
Module.requestFullScreen = function(a, b) {
Browser.requestFullScreen(a, b);
};
Module.requestAnimationFrame = function(a) {
Browser.requestAnimationFrame(a);
};
Module.setCanvasSize = function(a, b, d) {
Browser.setCanvasSize(a, b, d);
};
Module.pauseMainLoop = function() {
Browser.mainLoop.pause();
};
Module.resumeMainLoop = function() {
Browser.mainLoop.resume();
};
Module.getUserMedia = function() {
Browser.getUserMedia();
};
STACK_BASE = STACKTOP = Runtime.alignMemory(STATICTOP);
staticSealed = !0;
STACK_MAX = STACK_BASE + TOTAL_STACK;
DYNAMIC_BASE = DYNAMICTOP = Runtime.alignMemory(STACK_MAX);
assert(DYNAMIC_BASE < TOTAL_MEMORY, "TOTAL_MEMORY not big enough for stack");
Module.asmGlobalArg = {Math:Math, Int8Array:Int8Array, Int16Array:Int16Array, Int32Array:Int32Array, Uint8Array:Uint8Array, Uint16Array:Uint16Array, Uint32Array:Uint32Array, Float32Array:Float32Array, Float64Array:Float64Array};
Module.asmLibraryArg = {abort:abort, assert:assert, min:Math_min, _fflush:_fflush, __formatString:__formatString, _printf:_printf, _send:_send, _pwrite:_pwrite, _emscripten_set_main_loop:_emscripten_set_main_loop, _abort:_abort, _emscripten_set_main_loop_timing:_emscripten_set_main_loop_timing, _fwrite:_fwrite, _sbrk:_sbrk, _mkport:_mkport, _fprintf:_fprintf, __reallyNegative:__reallyNegative, _emscripten_memcpy_big:_emscripten_memcpy_big, _fileno:_fileno, _write:_write, _time:_time, _sysconf:_sysconf,
___errno_location:___errno_location, ___setErrNo:___setErrNo, STACKTOP:STACKTOP, STACK_MAX:STACK_MAX, tempDoublePtr:tempDoublePtr, ABORT:ABORT, NaN:NaN, Infinity:Infinity};
var asm = function(a, b, d) {
"almost asm";
var e = new a.Int8Array(d);
new a.Int16Array(d);
var c = new a.Int32Array(d);
new a.Uint8Array(d);
new a.Uint16Array(d);
new a.Uint32Array(d);
new a.Float32Array(d);
new a.Float64Array(d);
var f = b.STACKTOP | 0, g = b.STACK_MAX | 0, h = 0, l = 0, n = b.abort, p = b._printf, k = b._abort, r = b._sbrk, B = b._emscripten_memcpy_big, K = b._time, z = b._sysconf, F = b.___errno_location;
return{_strlen:function(a) {
a |= 0;
for (var b = 0, b = a;e[b >> 0] | 0;) {
b = b + 1 | 0;
}
return b - a | 0;
}, _free:function(a) {
a |= 0;
var b = 0, d = 0, e = 0, g = 0, h = 0, l = 0, n = 0, p = 0, r = 0, B = 0, F = 0, z = 0, K = 0, td = 0, Xa = 0, ud = 0, vd = 0, wd = 0, xd = 0, yd = 0, zd = 0, E = 0, Ad = 0, Bd = 0, Cd = 0, Dd = 0, Ed = 0, Fd = 0, Gd = 0, Hd = 0, Id = 0, Jd = 0, Ya = 0, Kd = 0, xg = 0, Ld = 0, Md = 0, Kb = 0, Lb = 0, Nd = 0, Od = 0, Pd = 0, Qd = 0, Rd = 0, Sd = 0, yg = 0, Mb = 0, ja = 0, Td = 0, zg = 0, Ud = 0, Ag = 0, Vd = 0, Bg = 0, Wd = 0, Aa = 0, Nb = 0, Xd = 0, Yd = 0, Zd = 0, $d = 0, ae = 0, Cg = 0, be =
0, Ba = 0, ce = 0, Dg = 0, de = 0, ee = 0, fe = 0, qa = 0, Ob = 0, ge = 0, Za = 0, ka = 0, he = 0, la = 0, I = 0, ie = 0, Pb = 0, je = 0, ke = 0, Eg = 0, le = 0, me = 0, Fg = 0, Gg = 0, ne = 0, R = 0, Qb = 0, oe = 0, pe = 0, Hg = 0, qe = 0, Ig = 0, Rb = 0, re = 0, Jg = 0, se = 0, Kg = 0, te = 0, ra = 0, ue = 0, Ca = 0, Sb = 0, ve = 0, $a = 0, we = 0, Lg = 0, Tb = 0, xe = 0, ye = 0, Mg = 0, Ub = 0, Ng = 0, Og = 0, ab = 0, bb = 0, Pg = 0, Vb = 0, cb = 0, Qg = 0, ze = 0, Wb = 0, Xb = 0, Ae = 0,
Yb = 0, Zb = 0, Rg = 0, Be = 0, Sg = 0, $b = 0, ac = 0, Ce = 0, bc = 0, cc = 0, Tg = 0, dc = 0, Ug = 0, De = 0, Ee = 0, Fe = 0, ec = 0, ea = 0, Vg = 0, Ti = 0, fc = 0, Ge = 0, Wg = 0, He = 0, Xg = 0, Da = 0, Ui = 0, Ie = 0, Yg = 0, Je = 0, Ea = 0, Ke = 0, Zg = 0, $g = 0, Le = 0, gc = 0, Fa = 0, Me = 0, Ga = 0, ah = 0, ma = 0, bh = 0, Ne = 0, db = 0, ch = 0, Oe = 0, Pe = 0, Vi = 0, Qe = 0, Re = 0, Se = 0, hc = 0, eb = 0, fb = 0, dh = 0, gb = 0, Ha = 0, ic = 0, jc = 0, Te = 0, eh = 0, kc = 0, sa =
0, hb = 0, ta = 0, Ue = 0, fh = 0, gh = 0, Ve = 0, We = 0, ib = 0, Wi = 0, hh = 0, Xe = 0, Ye = 0, Ze = 0, jb = 0, lc = 0, mc = 0, nc = 0, oc = 0, pc = 0, qc = 0, rc = 0, sc = 0, tc = 0, Ia = 0, $e = 0, uc = 0, af = 0, vc = 0, wc = 0, xc = 0, bf = 0, yc = 0, cf = 0, df = 0, ef = 0, kb = 0, ff = 0, zc = 0, gf = 0, Ac = 0, Bc = 0, ih = 0, hf = 0, jf = 0, jh = 0, Cc = 0, kf = 0, Dc = 0, Ec = 0, kh = 0, Ja = 0, lh = 0, lf = 0, Fc = 0, mf = 0, lb = 0, Gc = 0, Xi = 0, mb = 0, mh = 0, nf = 0, aa = 0,
of = 0, Ka = 0, nh = 0, oh = 0, nb = 0, La = 0, Hc = 0, pf = 0, qf = 0, Yi = 0, Ic = 0, rf = 0, ph = 0, ob = 0, Ma = 0, Zi = 0, pb = 0, Jc = 0, Kc = 0, qh = 0, Lc = 0, Mc = 0, rh = 0, Nc = 0, qb = 0, $i = 0, aj = 0, Na = 0, sf = 0, tf = 0, Oc = 0, Pc = 0, uf = 0, bj = 0, sh = 0, Qc = 0, vf = 0, wf = 0, cj = 0, xf = 0, th = 0, na = 0, yf = 0, rb = 0, zf = 0, uh = 0, Oa = 0, Rc = 0, vh = 0, Sc = 0, Af = 0, wh = 0, ua = 0, Bf = 0, dj = 0, Tc = 0, Uc = 0, xh = 0, va = 0, Vc = 0, Wc = 0, yh = 0, Cf =
0, Xc = 0, zh = 0, Df = 0, sb = 0, Ah = 0, Bh = 0, Ef = 0, Ch = 0, Ff = 0, Yc = 0, Zc = 0, Gf = 0, Dh = 0, Hf = 0, If = 0, $c = 0, Jf = 0, G = 0, ad = 0, bd = 0, cd = 0, dd = 0, Kf = 0, ed = 0, Eh = 0, Lf = 0, Fh = 0, fd = 0, O = 0, Mf = 0, tb = 0, Gh = 0, Hh = 0, Nf = 0, Of = 0, Ih = 0, ub = 0, Pf = 0, x = 0, Pa = 0, fa = 0, gd = 0, Qa = 0, ba = 0, P = 0, wa = 0, M = 0, xa = 0, oa = 0, ya = 0, vb = 0, Jh = 0, Qf = 0, Kh = 0, t = 0, L = 0, V = 0, hd = 0, wb = 0, ga = 0, ga = f, Jd = 0 == (a |
0);
if (!Jd) {
Ya = a + -8 | 0;
ea = c[10] | 0;
(oh = Ya >>> 0 < ea >>> 0) && k();
vf = a + -4 | 0;
Rc = c[vf >> 2] | 0;
va = Rc & 3;
(Ef = 1 == (va | 0)) && k();
G = Rc & -8;
n = G + -8 | 0;
O = a + n | 0;
Kd = Rc & 1;
Sd = 0 == (Kd | 0);
do {
if (Sd) {
Aa = c[Ya >> 2] | 0;
if (Dg = 0 == (va | 0)) {
f = ga;
return;
}
z = -8 - Aa | 0;
I = a + z | 0;
R = Aa + G | 0;
(Kg = I >>> 0 < ea >>> 0) && k();
xe = c[11] | 0;
if (Qg = (I | 0) == (xe | 0)) {
xd = G + -4 | 0;
Kb = a + xd | 0;
Lb = c[Kb >> 2] | 0;
Nd = Lb & 3;
Od = 3 == (Nd | 0);
if (!Od) {
t = I;
L = R;
break;
}
c[8] = R;
Pd = Lb & -2;
c[Kb >> 2] = Pd;
Qd = R | 1;
ud = z + 4 | 0;
Rd = a + ud | 0;
c[Rd >> 2] = Qd;
c[O >> 2] = R;
f = ga;
return;
}
ac = Aa >>> 3;
if (Vg = 256 > Aa >>> 0) {
Dd = z + 8 | 0, Je = a + Dd | 0, ma = c[Je >> 2] | 0, Ed = z + 12 | 0, hc = a + Ed | 0, sa = c[hc >> 2] | 0, Xe = ac << 1, sc = (24 + (Xe << 2) | 0) + 40 | 0, cf = (ma | 0) == (sc | 0), cf || ((jf = ma >>> 0 < ea >>> 0) && k(), mf = ma + 12 | 0, nb = c[mf >> 2] | 0, (Zi = (nb | 0) == (I | 0)) || k()), (aj = (sa | 0) == (ma | 0)) ? (tf = 1 << ac, Oc = tf ^ -1, Pc = c[6] | 0, uf = Pc & Oc, c[6] = uf) : ((bj = (sa | 0) == (sc | 0)) ? e = l = sa + 8 | 0 : ((sh = sa >>> 0 < ea >>> 0) && k(),
Qc = sa + 8 | 0, wf = c[Qc >> 2] | 0, (cj = (wf | 0) == (I | 0)) ? e = Qc : k()), xf = ma + 12 | 0, c[xf >> 2] = sa, c[e >> 2] = ma), t = I, L = R;
} else {
vd = z + 24 | 0;
th = a + vd | 0;
na = c[th >> 2] | 0;
wd = z + 12 | 0;
yf = a + wd | 0;
rb = c[yf >> 2] | 0;
zf = (rb | 0) == (I | 0);
do {
if (zf) {
zd = z + 20 | 0;
Tc = a + zd | 0;
Uc = c[Tc >> 2] | 0;
if (xh = 0 == (Uc | 0)) {
if (yd = z + 16 | 0, Vc = a + yd | 0, Wc = c[Vc >> 2] | 0, yh = 0 == (Wc | 0)) {
P = 0;
break;
} else {
ba = Wc, xa = Vc;
}
} else {
ba = Uc, xa = Tc;
}
for (;;) {
if (Cf = ba + 20 | 0, Xc = c[Cf >> 2] | 0, zh = 0 == (Xc | 0)) {
if (Df = ba + 16 | 0, sb = c[Df >> 2] | 0, Ah = 0 == (sb | 0)) {
break;
} else {
ba = sb, xa = Df;
}
} else {
ba = Xc, xa = Cf;
}
}
(Bh = xa >>> 0 < ea >>> 0) ? k() : (c[xa >> 2] = 0, P = ba);
} else {
Cd = z + 8 | 0, uh = a + Cd | 0, Oa = c[uh >> 2] | 0, (vh = Oa >>> 0 < ea >>> 0) && k(), Sc = Oa + 12 | 0, Af = c[Sc >> 2] | 0, (wh = (Af | 0) == (I | 0)) || k(), ua = rb + 8 | 0, Bf = c[ua >> 2] | 0, (dj = (Bf | 0) == (I | 0)) ? (c[Sc >> 2] = rb, c[ua >> 2] = Oa, P = rb) : k();
}
} while (0);
if (Ch = 0 == (na | 0)) {
t = I, L = R;
} else {
E = z + 28 | 0;
Ff = a + E | 0;
Yc = c[Ff >> 2] | 0;
Zc = (24 + (Yc << 2) | 0) + 304 | 0;
Gf = c[Zc >> 2] | 0;
if (Dh = (I | 0) == (Gf | 0)) {
if (c[Zc >> 2] = P, Jh = 0 == (P | 0)) {
Hf = 1 << Yc;
If = Hf ^ -1;
$c = c[7] | 0;
Jf = $c & If;
c[7] = Jf;
t = I;
L = R;
break;
}
} else {
if (ad = c[10] | 0, (bd = na >>> 0 < ad >>> 0) && k(), cd = na + 16 | 0, dd = c[cd >> 2] | 0, (Kf = (dd | 0) == (I | 0)) ? c[cd >> 2] = P : (ed = na + 20 | 0, c[ed >> 2] = P), Eh = 0 == (P | 0)) {
t = I;
L = R;
break;
}
}
Lf = c[10] | 0;
(Fh = P >>> 0 < Lf >>> 0) && k();
fd = P + 24 | 0;
c[fd >> 2] = na;
Ad = z + 16 | 0;
Mf = a + Ad | 0;
tb = c[Mf >> 2] | 0;
Gh = 0 == (tb | 0);
Gh || ((Hh = tb >>> 0 < Lf >>> 0) ? k() : (Nf = P + 16 | 0, c[Nf >> 2] = tb, Of = tb + 24 | 0, c[Of >> 2] = P));
Bd = z + 20 | 0;
Ih = a + Bd | 0;
ub = c[Ih >> 2] | 0;
(Pf = 0 == (ub | 0)) ? (t = I, L = R) : (x = c[10] | 0, (xg = ub >>> 0 < x >>> 0) ? k() : (Ld = P + 20 | 0, c[Ld >> 2] = ub, Md = ub + 24 | 0, c[Md >> 2] = P, t = I, L = R));
}
}
} else {
t = Ya, L = G;
}
} while (0);
(yg = t >>> 0 < O >>> 0) || k();
Xa = G + -4 | 0;
Mb = a + Xa | 0;
ja = c[Mb >> 2] | 0;
Td = ja & 1;
(zg = 0 == (Td | 0)) && k();
Ud = ja & 2;
if (Ag = 0 == (Ud | 0)) {
Vd = c[12] | 0;
if (Bg = (O | 0) == (Vd | 0)) {
Wd = c[9] | 0;
Nb = Wd + L | 0;
c[9] = Nb;
c[12] = t;
Xd = Nb | 1;
Yd = t + 4 | 0;
c[Yd >> 2] = Xd;
Zd = c[11] | 0;
$d = (t | 0) == (Zd | 0);
if (!$d) {
f = ga;
return;
}
c[11] = 0;
c[8] = 0;
f = ga;
return;
}
ae = c[11] | 0;
if (Cg = (O | 0) == (ae | 0)) {
be = c[8] | 0;
Ba = be + L | 0;
c[8] = Ba;
c[11] = t;
ce = Ba | 1;
de = t + 4 | 0;
c[de >> 2] = ce;
ee = t + Ba | 0;
c[ee >> 2] = Ba;
f = ga;
return;
}
fe = ja & -8;
qa = fe + L | 0;
Ob = ja >>> 3;
ge = 256 > ja >>> 0;
do {
if (ge) {
Za = a + G | 0, ka = c[Za >> 2] | 0, td = G | 4, he = a + td | 0, la = c[he >> 2] | 0, ie = Ob << 1, Pb = (24 + (ie << 2) | 0) + 40 | 0, je = (ka | 0) == (Pb | 0), je || (ke = c[10] | 0, (Eg = ka >>> 0 < ke >>> 0) && k(), le = ka + 12 | 0, me = c[le >> 2] | 0, (Fg = (me | 0) == (O | 0)) || k()), (Gg = (la | 0) == (ka | 0)) ? (ne = 1 << Ob, Qb = ne ^ -1, oe = c[6] | 0, pe = oe & Qb, c[6] = pe) : ((Hg = (la | 0) == (Pb | 0)) ? d = h = la + 8 | 0 : (qe = c[10] | 0, (Ig = la >>> 0 < qe >>>
0) && k(), Rb = la + 8 | 0, re = c[Rb >> 2] | 0, (Jg = (re | 0) == (O | 0)) ? d = Rb : k()), se = ka + 12 | 0, c[se >> 2] = la, c[d >> 2] = ka);
} else {
Fd = G + 16 | 0;
te = a + Fd | 0;
ra = c[te >> 2] | 0;
Gd = G | 4;
ue = a + Gd | 0;
Ca = c[ue >> 2] | 0;
Sb = (Ca | 0) == (O | 0);
do {
if (Sb) {
Id = G + 12 | 0;
ab = a + Id | 0;
bb = c[ab >> 2] | 0;
if (Pg = 0 == (bb | 0)) {
if (Hd = G + 8 | 0, Vb = a + Hd | 0, cb = c[Vb >> 2] | 0, ze = 0 == (cb | 0)) {
M = 0;
break;
} else {
wa = cb, oa = Vb;
}
} else {
wa = bb, oa = ab;
}
for (;;) {
if (Wb = wa + 20 | 0, Xb = c[Wb >> 2] | 0, Ae = 0 == (Xb | 0)) {
if (Yb = wa + 16 | 0, Zb = c[Yb >> 2] | 0, Rg = 0 == (Zb | 0)) {
break;
} else {
wa = Zb, oa = Yb;
}
} else {
wa = Xb, oa = Wb;
}
}
Be = c[10] | 0;
(Sg = oa >>> 0 < Be >>> 0) ? k() : (c[oa >> 2] = 0, M = wa);
} else {
ve = a + G | 0, $a = c[ve >> 2] | 0, we = c[10] | 0, (Lg = $a >>> 0 < we >>> 0) && k(), Tb = $a + 12 | 0, ye = c[Tb >> 2] | 0, (Mg = (ye | 0) == (O | 0)) || k(), Ub = Ca + 8 | 0, Ng = c[Ub >> 2] | 0, (Og = (Ng | 0) == (O | 0)) ? (c[Tb >> 2] = Ca, c[Ub >> 2] = $a, M = Ca) : k();
}
} while (0);
$b = 0 == (ra | 0);
if (!$b) {
B = G + 20 | 0;
Ce = a + B | 0;
bc = c[Ce >> 2] | 0;
cc = (24 + (bc << 2) | 0) + 304 | 0;
Tg = c[cc >> 2] | 0;
if (dc = (O | 0) == (Tg | 0)) {
if (c[cc >> 2] = M, Qf = 0 == (M | 0)) {
Ug = 1 << bc;
De = Ug ^ -1;
Ee = c[7] | 0;
Fe = Ee & De;
c[7] = Fe;
break;
}
} else {
if (ec = c[10] | 0, (Ti = ra >>> 0 < ec >>> 0) && k(), fc = ra + 16 | 0, Ge = c[fc >> 2] | 0, (Wg = (Ge | 0) == (O | 0)) ? c[fc >> 2] = M : (He = ra + 20 | 0, c[He >> 2] = M), Xg = 0 == (M | 0)) {
break;
}
}
Da = c[10] | 0;
(Ui = M >>> 0 < Da >>> 0) && k();
Ie = M + 24 | 0;
c[Ie >> 2] = ra;
F = G + 8 | 0;
Yg = a + F | 0;
Ea = c[Yg >> 2] | 0;
Ke = 0 == (Ea | 0);
Ke || ((Zg = Ea >>> 0 < Da >>> 0) ? k() : ($g = M + 16 | 0, c[$g >> 2] = Ea, Le = Ea + 24 | 0, c[Le >> 2] = M));
K = G + 12 | 0;
gc = a + K | 0;
Fa = c[gc >> 2] | 0;
Me = 0 == (Fa | 0);
Me || (Ga = c[10] | 0, (ah = Fa >>> 0 < Ga >>> 0) ? k() : (bh = M + 20 | 0, c[bh >> 2] = Fa, Ne = Fa + 24 | 0, c[Ne >> 2] = M));
}
}
} while (0);
db = qa | 1;
ch = t + 4 | 0;
c[ch >> 2] = db;
Oe = t + qa | 0;
c[Oe >> 2] = qa;
Pe = c[11] | 0;
if (Vi = (t | 0) == (Pe | 0)) {
c[8] = qa;
f = ga;
return;
}
V = qa;
} else {
Qe = ja & -2, c[Mb >> 2] = Qe, Re = L | 1, Se = t + 4 | 0, c[Se >> 2] = Re, eb = t + L | 0, V = c[eb >> 2] = L;
}
fb = V >>> 3;
if (dh = 256 > V >>> 0) {
gb = fb << 1, Ha = (24 + (gb << 2) | 0) + 40 | 0, ic = c[6] | 0, jc = 1 << fb, Te = ic & jc, (eh = 0 == (Te | 0)) ? (kc = ic | jc, c[6] = kc, p = gb + 2 | 0, g = b = (24 + (p << 2) | 0) + 40 | 0, Pa = Ha) : (r = gb + 2 | 0, hb = (24 + (r << 2) | 0) + 40 | 0, ta = c[hb >> 2] | 0, Ue = c[10] | 0, (fh = ta >>> 0 < Ue >>> 0) ? k() : (g = hb, Pa = ta)), c[g >> 2] = t, gh = Pa + 12 | 0, c[gh >> 2] = t, Ve = t + 8 | 0, c[Ve >> 2] = Pa, We = t + 12 | 0, c[We >> 2] = Ha;
} else {
ib = V >>> 8;
(Wi = 0 == (ib | 0)) ? fa = 0 : (hh = 16777215 < V >>> 0) ? fa = 31 : (Ye = ib + 1048320 | 0, Ze = Ye >>> 16, jb = Ze & 8, lc = ib << jb, mc = lc + 520192 | 0, nc = mc >>> 16, oc = nc & 4, pc = oc | jb, qc = lc << oc, rc = qc + 245760 | 0, tc = rc >>> 16, Ia = tc & 2, $e = pc | Ia, uc = 14 - $e | 0, af = qc << Ia, vc = af >>> 15, wc = uc + vc | 0, xc = wc << 1, bf = wc + 7 | 0, yc = V >>> bf, df = yc & 1, fa = ef = df | xc);
kb = (24 + (fa << 2) | 0) + 304 | 0;
ff = t + 28 | 0;
gd = fa;
c[ff >> 2] = gd;
zc = t + 20 | 0;
c[zc >> 2] = 0;
gf = t + 16 | 0;
c[gf >> 2] = 0;
Ac = c[7] | 0;
Bc = 1 << fa;
ih = Ac & Bc;
hf = 0 == (ih | 0);
a: do {
if (hf) {
jh = Ac | Bc, c[7] = jh, c[kb >> 2] = t, Cc = t + 24 | 0, c[Cc >> 2] = kb, kf = t + 12 | 0, c[kf >> 2] = t, Dc = t + 8 | 0, c[Dc >> 2] = t;
} else {
Ec = c[kb >> 2] | 0;
(kh = 31 == (fa | 0)) ? mb = 0 : (Ja = fa >>> 1, mb = lh = 25 - Ja | 0);
lf = Ec + 4 | 0;
Fc = c[lf >> 2] | 0;
lb = Fc & -8;
Gc = (lb | 0) == (V | 0);
b: do {
if (Gc) {
ya = Ec;
} else {
Qa = Xi = V << mb;
for (vb = Ec;;) {
La = Qa >>> 31;
Hc = (vb + (La << 2) | 0) + 16 | 0;
aa = c[Hc >> 2] | 0;
if (pf = 0 == (aa | 0)) {
break;
}
mh = Qa << 1;
nf = aa + 4 | 0;
of = c[nf >> 2] | 0;
Ka = of & -8;
if (nh = (Ka | 0) == (V | 0)) {
ya = aa;
break b;
} else {
Qa = mh, vb = aa;
}
}
qf = c[10] | 0;
if (Yi = Hc >>> 0 < qf >>> 0) {
k();
} else {
c[Hc >> 2] = t;
Ic = t + 24 | 0;
c[Ic >> 2] = vb;
rf = t + 12 | 0;
c[rf >> 2] = t;
ph = t + 8 | 0;
c[ph >> 2] = t;
break a;
}
}
} while (0);
ob = ya + 8 | 0;
Ma = c[ob >> 2] | 0;
pb = c[10] | 0;
Jc = ya >>> 0 >= pb >>> 0;
Kc = Ma >>> 0 >= pb >>> 0;
(Kh = Jc & Kc) ? (qh = Ma + 12 | 0, c[qh >> 2] = t, c[ob >> 2] = t, Lc = t + 8 | 0, c[Lc >> 2] = Ma, Mc = t + 12 | 0, c[Mc >> 2] = ya, rh = t + 24 | 0, c[rh >> 2] = 0) : k();
}
} while (0);
Nc = c[14] | 0;
qb = Nc + -1 | 0;
c[14] = qb;
if ($i = 0 == (qb | 0)) {
for (wb = 480;hd = c[wb >> 2] | 0, Na = 0 == (hd | 0), sf = hd + 8 | 0, !Na;) {
wb = sf;
}
c[14] = -1;
}
}
}
f = ga;
}, _main:function(a, b) {
var c = 0, c = f;
f = f + 16 | 0;
(f | 0) >= (g | 0) && n();
p(8, c | 0) | 0;
f = c;
return 0;
}, _memset:function(a, b, d) {
a |= 0;
b |= 0;
d |= 0;
var f = 0, g = 0, h = 0, k = 0, f = a + d | 0;
if (20 <= (d | 0)) {
b &= 255;
k = a & 3;
g = b | b << 8 | b << 16 | b << 24;
h = f & -4;
if (k) {
for (k = a + 4 - k | 0;(a | 0) < (k | 0);) {
e[a >> 0] = b, a = a + 1 | 0;
}
}
for (;(a | 0) < (h | 0);) {
c[a >> 2] = g, a = a + 4 | 0;
}
}
for (;(a | 0) < (f | 0);) {
e[a >> 0] = b, a = a + 1 | 0;
}
return a - d | 0;
}, _malloc:function(a) {
a |= 0;
var b = 0, d = 0, e = 0, g = 0, h = 0, l = 0, n = 0, p = 0, B = 0, Ri = 0, Si = 0, Au = 0, Bu = 0, td = 0, Xa = 0, ud = 0, vd = 0, wd = 0, xd = 0, yd = 0, zd = 0, E = 0, Ad = 0, Bd = 0, Cd = 0, Dd = 0, Ed = 0, Fd = 0, Gd = 0, Hd = 0, Id = 0, Jd = 0, Ya = 0, Kd = 0, xg = 0, Ld = 0, Md = 0, Kb = 0, Lb = 0, Nd = 0, Od = 0, Pd = 0, Qd = 0, Rd = 0, Sd = 0, yg = 0, Mb = 0, ja = 0, Td = 0, zg = 0, Ud = 0, Ag = 0, Vd = 0, Bg = 0, Wd = 0, Aa = 0, Nb = 0, Xd = 0, Yd = 0, Zd = 0, $d = 0, ae = 0, Cg = 0,
be = 0, Ba = 0, ce = 0, Dg = 0, de = 0, ee = 0, fe = 0, qa = 0, Ob = 0, ge = 0, Za = 0, ka = 0, he = 0, la = 0, I = 0, ie = 0, Pb = 0, je = 0, ke = 0, Eg = 0, le = 0, me = 0, Fg = 0, Gg = 0, ne = 0, R = 0, Qb = 0, oe = 0, pe = 0, Hg = 0, qe = 0, Ig = 0, Rb = 0, re = 0, Jg = 0, se = 0, Kg = 0, te = 0, ra = 0, ue = 0, Ca = 0, Sb = 0, ve = 0, $a = 0, we = 0, Lg = 0, Tb = 0, xe = 0, ye = 0, Mg = 0, Ub = 0, Ng = 0, Og = 0, ab = 0, bb = 0, Pg = 0, Vb = 0, cb = 0, Qg = 0, ze = 0, Wb = 0, Xb = 0, Ae =
0, Yb = 0, Zb = 0, Rg = 0, Be = 0, Sg = 0, $b = 0, ac = 0, Ce = 0, bc = 0, cc = 0, Tg = 0, dc = 0, Ug = 0, De = 0, Ee = 0, Fe = 0, ec = 0, ea = 0, Vg = 0, Ti = 0, fc = 0, Ge = 0, Wg = 0, He = 0, Xg = 0, Da = 0, Ui = 0, Ie = 0, Yg = 0, Je = 0, Ea = 0, Ke = 0, Zg = 0, $g = 0, Le = 0, gc = 0, Fa = 0, Me = 0, Ga = 0, ah = 0, ma = 0, bh = 0, Ne = 0, db = 0, ch = 0, Oe = 0, Pe = 0, Vi = 0, Qe = 0, Re = 0, Se = 0, hc = 0, eb = 0, fb = 0, dh = 0, gb = 0, Ha = 0, ic = 0, jc = 0, Te = 0, eh = 0, kc = 0,
sa = 0, hb = 0, ta = 0, Ue = 0, fh = 0, gh = 0, Ve = 0, We = 0, ib = 0, Wi = 0, hh = 0, Xe = 0, Ye = 0, Ze = 0, jb = 0, lc = 0, mc = 0, nc = 0, oc = 0, pc = 0, qc = 0, rc = 0, sc = 0, tc = 0, Ia = 0, $e = 0, uc = 0, af = 0, vc = 0, wc = 0, xc = 0, bf = 0, yc = 0, cf = 0, df = 0, ef = 0, kb = 0, ff = 0, zc = 0, gf = 0, Ac = 0, Bc = 0, ih = 0, hf = 0, jf = 0, jh = 0, Cc = 0, kf = 0, Dc = 0, Ec = 0, kh = 0, Ja = 0, lh = 0, lf = 0, Fc = 0, mf = 0, lb = 0, Gc = 0, Xi = 0, mb = 0, mh = 0, nf = 0, aa =
0, of = 0, Ka = 0, nh = 0, oh = 0, nb = 0, La = 0, Hc = 0, pf = 0, qf = 0, Yi = 0, Ic = 0, rf = 0, ph = 0, ob = 0, Ma = 0, Zi = 0, pb = 0, Jc = 0, Kc = 0, qh = 0, Lc = 0, Mc = 0, rh = 0, Nc = 0, qb = 0, $i = 0, aj = 0, Na = 0, sf = 0, tf = 0, Oc = 0, Pc = 0, uf = 0, bj = 0, sh = 0, Qc = 0, vf = 0, wf = 0, cj = 0, xf = 0, th = 0, na = 0, yf = 0, rb = 0, zf = 0, uh = 0, Oa = 0, Rc = 0, vh = 0, Sc = 0, Af = 0, wh = 0, ua = 0, Bf = 0, dj = 0, Tc = 0, Uc = 0, xh = 0, va = 0, Vc = 0, Wc = 0, yh = 0,
Cf = 0, Xc = 0, zh = 0, Df = 0, sb = 0, Ah = 0, Bh = 0, Ef = 0, Ch = 0, Ff = 0, Yc = 0, Zc = 0, Gf = 0, Dh = 0, Hf = 0, If = 0, $c = 0, Jf = 0, G = 0, ad = 0, bd = 0, cd = 0, dd = 0, Kf = 0, ed = 0, Eh = 0, Lf = 0, Fh = 0, fd = 0, O = 0, Mf = 0, tb = 0, Gh = 0, Hh = 0, Nf = 0, Of = 0, Ih = 0, ub = 0, Pf = 0, x = 0, Pa = 0, fa = 0, gd = 0, Qa = 0, ba = 0, P = 0, wa = 0, M = 0, xa = 0, oa = 0, ya = 0, vb = 0, Jh = 0, Qf = 0, Kh = 0, t = 0, L = 0, V = 0, hd = 0, wb = 0, ga = 0, sm = 0, tm = 0, um =
0, ej = 0, Cu = 0, vm = 0, wm = 0, xm = 0, ym = 0, Du = 0, zm = 0, fj = 0, Am = 0, Eu = 0, Bm = 0, gj = 0, Fu = 0, Cm = 0, hj = 0, Dm = 0, Em = 0, ij = 0, Lh = 0, Gu = 0, Hu = 0, Fm = 0, Gm = 0, Mh = 0, Hm = 0, Im = 0, Nh = 0, Jm = 0, Km = 0, Lm = 0, Mm = 0, Nm = 0, Om = 0, Iu = 0, Pm = 0, jj = 0, Qm = 0, Rm = 0, Oh = 0, Ju = 0, Sm = 0, Tm = 0, kj = 0, Um = 0, lj = 0, mj = 0, nj = 0, Vm = 0, oj = 0, Wm = 0, pj = 0, Xm = 0, qj = 0, Ym = 0, rj = 0, Zm = 0, $m = 0, sj = 0, an = 0, tj = 0, bn = 0,
uj = 0, cn = 0, dn = 0, en = 0, fn = 0, Ku = 0, gn = 0, Lu = 0, hn = 0, jn = 0, kn = 0, vj = 0, ln = 0, mn = 0, wj = 0, Mu = 0, nn = 0, xj = 0, yj = 0, Nu = 0, on = 0, pn = 0, qn = 0, Ou = 0, Ph = 0, Pu = 0, ca = 0, Qu = 0, Ru = 0, rn = 0, id = 0, sn = 0, Rf = 0, tn = 0, un = 0, Qh = 0, Su = 0, zj = 0, vn = 0, wn = 0, Tu = 0, Aj = 0, xn = 0, Uu = 0, Bj = 0, Cj = 0, Vu = 0, Dj = 0, Ej = 0, Wu = 0, yn = 0, Fj = 0, Gj = 0, Xu = 0, Hj = 0, Ij = 0, Yu = 0, Zu = 0, zn = 0, An = 0, Jj = 0, Kj = 0, Lj =
0, Bn = 0, $u = 0, Cn = 0, Dn = 0, En = 0, Fn = 0, Gn = 0, av = 0, Mj = 0, Hn = 0, In = 0, bv = 0, Jn = 0, cv = 0, Nj = 0, dv = 0, Kn = 0, Ln = 0, Sf = 0, Mn = 0, Tf = 0, Nn = 0, ev = 0, On = 0, Pn = 0, Qn = 0, Uf = 0, Rn = 0, Sn = 0, fv = 0, Tn = 0, Un = 0, Oj = 0, Vn = 0, Pj = 0, Wn = 0, Xn = 0, Qj = 0, Yn = 0, Zn = 0, $n = 0, ao = 0, bo = 0, co = 0, eo = 0, fo = 0, Rj = 0, gv = 0, Rh = 0, Sj = 0, Tj = 0, Uj = 0, go = 0, hv = 0, ho = 0, io = 0, Vj = 0, Wj = 0, jo = 0, iv = 0, ko = 0, lo = 0,
mo = 0, Sh = 0, jv = 0, Xj = 0, kv = 0, no = 0, oo = 0, Yj = 0, Zj = 0, po = 0, qo = 0, ak = 0, ro = 0, bk = 0, so = 0, to = 0, uo = 0, ck = 0, vo = 0, wo = 0, xo = 0, yo = 0, dk = 0, zo = 0, Ao = 0, ek = 0, Bo = 0, Co = 0, lv = 0, Th = 0, Do = 0, Eo = 0, Fo = 0, fk = 0, gk = 0, Go = 0, hk = 0, mv = 0, Ho = 0, Io = 0, Jo = 0, Ko = 0, Uh = 0, nv = 0, Lo = 0, ov = 0, Mo = 0, No = 0, Oo = 0, Po = 0, Qo = 0, pv = 0, ik = 0, Ro = 0, So = 0, Vf = 0, To = 0, Uo = 0, jk = 0, qv = 0, Vo = 0, Vh = 0, rv =
0, Wo = 0, sv = 0, Xo = 0, Yo = 0, Zo = 0, kk = 0, N = 0, $o = 0, Wh = 0, lk = 0, ap = 0, bp = 0, cp = 0, dp = 0, ep = 0, fp = 0, tv = 0, jd = 0, mk = 0, gp = 0, Wf = 0, Ra = 0, uv = 0, hp = 0, ip = 0, jp = 0, kp = 0, lp = 0, mp = 0, np = 0, op = 0, pp = 0, nk = 0, qp = 0, rp = 0, vv = 0, ok = 0, wv = 0, pk = 0, Xf = 0, qk = 0, sp = 0, tp = 0, up = 0, vp = 0, wp = 0, xv = 0, xp = 0, yv = 0, Yf = 0, yp = 0, zp = 0, Ap = 0, zv = 0, Bp = 0, Cp = 0, Dp = 0, Ep = 0, rk = 0, sk = 0, tk = 0, uk = 0,
vk = 0, xb = 0, Fp = 0, wk = 0, Gp = 0, xk = 0, yk = 0, Hp = 0, Ip = 0, Jp = 0, Kp = 0, Lp = 0, Mp = 0, Xh = 0, Np = 0, zk = 0, Op = 0, Ak = 0, Pp = 0, Qp = 0, Av = 0, Rp = 0, Bk = 0, Ck = 0, Bv = 0, Cv = 0, Zf = 0, Dv = 0, Yh = 0, Dk = 0, Ek = 0, Sp = 0, Ev = 0, Tp = 0, Up = 0, Vp = 0, Wp = 0, Xp = 0, Fv = 0, Fk = 0, Gk = 0, Yp = 0, Zp = 0, Hk = 0, Ik = 0, $p = 0, aq = 0, bq = 0, Jk = 0, Gv = 0, cq = 0, dq = 0, $f = 0, Hv = 0, Zh = 0, $h = 0, eq = 0, fq = 0, gq = 0, hq = 0, Iv = 0, Jv = 0, iq =
0, jq = 0, kq = 0, lq = 0, Kk = 0, Lk = 0, mq = 0, nq = 0, oq = 0, ai = 0, Kv = 0, pq = 0, Lv = 0, Mv = 0, Nv = 0, qq = 0, rq = 0, sq = 0, Ov = 0, ag = 0, bi = 0, tq = 0, uq = 0, vq = 0, wq = 0, xq = 0, Mk = 0, yq = 0, zq = 0, Aq = 0, Bq = 0, ci = 0, Cq = 0, Pv = 0, u = 0, Dq = 0, Nk = 0, Eq = 0, di = 0, Fq = 0, Gq = 0, ei = 0, Ok = 0, Hq = 0, Iq = 0, Pk = 0, Jq = 0, Qv = 0, Qk = 0, Rk = 0, Kq = 0, Rv = 0, Lq = 0, Sv = 0, Mq = 0, bg = 0, Sk = 0, Nq = 0, Oq = 0, Pq = 0, Tk = 0, Qq = 0, Uk = 0,
Vk = 0, Wk = 0, Rq = 0, Tv = 0, Sq = 0, Xk = 0, Uv = 0, Tq = 0, Yk = 0, Uq = 0, Vq = 0, Vv = 0, Wq = 0, Xq = 0, Yq = 0, Zq = 0, Zk = 0, Wv = 0, $k = 0, yb = 0, $q = 0, Xv = 0, ar = 0, Yv = 0, br = 0, cg = 0, al = 0, cr = 0, dr = 0, er = 0, bl = 0, fr = 0, cl = 0, Zv = 0, gr = 0, hr = 0, $v = 0, ir = 0, dl = 0, aw = 0, jr = 0, dg = 0, eg = 0, kr = 0, lr = 0, bw = 0, el = 0, mr = 0, nr = 0, cw = 0, fl = 0, or = 0, dw = 0, ew = 0, pr = 0, fw = 0, qr = 0, kd = 0, gw = 0, gl = 0, rr = 0, hw = 0, sr =
0, iw = 0, tr = 0, W = 0, ha = 0, ur = 0, vr = 0, wr = 0, X = 0, fg = 0, xr = 0, yr = 0, zr = 0, Ar = 0, Br = 0, hl = 0, Cr = 0, Dr = 0, Er = 0, jw = 0, Fr = 0, gg = 0, Gr = 0, Hr = 0, Ir = 0, Jr = 0, Kr = 0, hg = 0, Lr = 0, kw = 0, il = 0, jl = 0, Mr = 0, Nr = 0, zb = 0, Or = 0, Pr = 0, Ab = 0, Qr = 0, kl = 0, Rr = 0, lw = 0, ld = 0, Sr = 0, Tr = 0, mw = 0, nw = 0, ow = 0, Ur = 0, Vr = 0, Wr = 0, Xr = 0, pw = 0, qw = 0, ll = 0, Yr = 0, rw = 0, ml = 0, Zr = 0, $r = 0, md = 0, as = 0, ig = 0,
bs = 0, cs = 0, fi = 0, sw = 0, nl = 0, ds = 0, es = 0, tw = 0, ol = 0, gs = 0, uw = 0, pl = 0, ql = 0, vw = 0, rl = 0, sl = 0, ww = 0, xw = 0, tl = 0, ul = 0, yw = 0, vl = 0, wl = 0, zw = 0, Aw = 0, hs = 0, is = 0, js = 0, xl = 0, yl = 0, zl = 0, ks = 0, ls = 0, ms = 0, ns = 0, os = 0, ps = 0, qs = 0, Bw = 0, gi = 0, Al = 0, rs = 0, Cw = 0, ss = 0, Dw = 0, Bl = 0, Ew = 0, ts = 0, us = 0, jg = 0, vs = 0, ws = 0, Fw = 0, xs = 0, ys = 0, zs = 0, kg = 0, As = 0, Bs = 0, Gw = 0, Cs = 0, Ds = 0, Es =
0, Fs = 0, Gs = 0, Cl = 0, Hs = 0, Is = 0, Js = 0, Ks = 0, Ls = 0, Dl = 0, Ms = 0, Hw = 0, hi = 0, El = 0, Fl = 0, Gl = 0, Ns = 0, Iw = 0, Os = 0, Hl = 0, Il = 0, Ps = 0, Qs = 0, Jw = 0, Rs = 0, Ss = 0, Ts = 0, ii = 0, Kw = 0, Lw = 0, Us = 0, Vs = 0, Ws = 0, Jl = 0, Kl = 0, Xs = 0, Ys = 0, Ll = 0, Zs = 0, Ml = 0, $s = 0, at = 0, Nl = 0, bt = 0, ct = 0, dt = 0, et = 0, ft = 0, Ol = 0, gt = 0, ht = 0, it = 0, jt = 0, Mw = 0, kt = 0, ji = 0, lt = 0, mt = 0, nt = 0, Pl = 0, Ql = 0, ot = 0, Nw = 0,
pt = 0, qt = 0, ki = 0, rt = 0, st = 0, li = 0, Ow = 0, tt = 0, Pw = 0, ut = 0, vt = 0, wt = 0, xt = 0, yt = 0, lg = 0, Qw = 0, Rl = 0, zt = 0, At = 0, mg = 0, Bt = 0, Ct = 0, Rw = 0, Dt = 0, mi = 0, Sl = 0, Sw = 0, Et = 0, Tw = 0, Ft = 0, Gt = 0, Ht = 0, Tl = 0, ni = 0, Ul = 0, It = 0, oi = 0, Jt = 0, Kt = 0, Lt = 0, Mt = 0, Nt = 0, Uw = 0, ng = 0, Ot = 0, Pt = 0, pi = 0, Vl = 0, qi = 0, Vw = 0, Qt = 0, Ww = 0, Xw = 0, Wl = 0, Rt = 0, Yw = 0, St = 0, Zw = 0, Xl = 0, Yl = 0, Zl = 0, Tt = 0, $w =
0, Bb = 0, nd = 0, Ut = 0, ax = 0, $l = 0, Vt = 0, am = 0, bx = 0, Wt = 0, cx = 0, Xt = 0, og = 0, bm = 0, Yt = 0, Zt = 0, $t = 0, au = 0, bu = 0, cu = 0, cm = 0, du = 0, dx = 0, dm = 0, ri = 0, eu = 0, ex = 0, fu = 0, gu = 0, fx = 0, hu = 0, Y = 0, iu = 0, em = 0, ju = 0, ku = 0, lu = 0, mu = 0, fm = 0, gx = 0, nu = 0, si = 0, gm = 0, hm = 0, im = 0, ou = 0, hx = 0, pu = 0, jm = 0, km = 0, qu = 0, lm = 0, ix = 0, ru = 0, su = 0, tu = 0, ti = 0, jx = 0, kx = 0, uu = 0, vu = 0, mm = 0, ui = 0,
vi = 0, wi = 0, xi = 0, yi = 0, wu = 0, Sa = 0, Ta = 0, Ua = 0, zi = 0, Ai = 0, Bi = 0, Cb = 0, Db = 0, Eb = 0, S = 0, T = 0, U = 0, od = 0, pd = 0, qd = 0, pg = 0, qg = 0, rg = 0, Ci = 0, Di = 0, Ei = 0, Fi = 0, sg = 0, lx = 0, mx = 0, nx = 0, ox = 0, Gi = 0, Fb = 0, H = 0, A = 0, nm = 0, px = 0, qx = 0, rx = 0, sx = 0, tx = 0, ux = 0, vx = 0, wx = 0, xu = 0, yu = 0, xx = 0, zu = 0, yx = 0, zx = 0, Z = 0, pa = 0, Hi = 0, Ii = 0, tg = 0, Q = 0, ug = 0, om = 0, pm = 0, Ji = 0, Gb = 0, vg = 0,
rd = 0, Hb = 0, Va = 0, Ki = 0, za = 0, Li = 0, Mi = 0, Ib = 0, wg = 0, Ni = 0, Oi = 0, Jb = 0, q = 0, Wa = 0, qm = 0, C = 0, D = 0, rm = 0, Pi = 0, sd = 0, v = 0, Qi = 0, J = 0, da = 0, da = f, Ub = 245 > a >>> 0;
do {
if (Ub) {
(Ng = 11 > a >>> 0) ? N = 16 : (Sc = a + 11 | 0, N = Iu = Sc & -8);
Tf = N >>> 3;
$h = c[6] | 0;
dg = $h >>> Tf;
js = dg & 3;
yt = 0 == (js | 0);
if (!yt) {
return Og = dg & 1, Ze = Og ^ 1, Ia = Ze + Tf | 0, ef = Ia << 1, Cc = (24 + (ef << 2) | 0) + 40 | 0, Jd = ef + 2 | 0, Gc = (24 + (Jd << 2) | 0) + 40 | 0, La = c[Gc >> 2] | 0, pb = La + 8 | 0, Na = c[pb >> 2] | 0, (cj = (Cc | 0) == (Na | 0)) ? (Af = 1 << Ia, yh = Af ^ -1, Yc = $h & yh, c[6] = Yc) : (cd = c[10] | 0, (Gh = Na >>> 0 < cd >>> 0) && k(), Qa = Na + 12 | 0, Kh = c[Qa >> 2] | 0, (Cu = (Kh | 0) == (La | 0)) ? (c[Qa >> 2] = Cc, c[Gc >> 2] = Na) : k()), gj = Ia << 3, Gm = gj | 3, Pm =
La + 4 | 0, c[Pm >> 2] = Gm, Td = gj | 4, mj = La + Td | 0, $m = c[mj >> 2] | 0, gn = $m | 1, c[mj >> 2] = gn, H = pb, f = da, H | 0;
}
xj = c[8] | 0;
if (Ru = N >>> 0 > xj >>> 0) {
wn = 0 == (dg | 0);
if (!wn) {
return yn = dg << Tf, Kj = 2 << Tf, Hn = 0 - Kj | 0, Nn = Kj | Hn, Oj = yn & Nn, co = 0 - Oj | 0, ho = Oj & co, Xj = ho + -1 | 0, so = Xj >>> 12, ek = so & 16, hk = Xj >>> ek, No = hk >>> 5, jk = No & 8, $o = jk | ek, mk = hk >>> jk, np = mk >>> 2, qk = np & 4, zp = $o | qk, vk = mk >>> qk, Lp = vk >>> 1, Bk = Lp & 2, Tp = zp | Bk, Ik = vk >>> Bk, eq = Ik >>> 1, Lk = eq & 1, rq = Tp | Lk, yq = Ik >>> Lk, di = rq + yq | 0, Rk = di << 1, Tk = (24 + (Rk << 2) | 0) + 40 | 0, Ig = Rk + 2 |
0, Yk = (24 + (Ig << 2) | 0) + 40 | 0, yb = c[Yk >> 2] | 0, bl = yb + 8 | 0, eg = c[bl >> 2] | 0, (ew = (Tk | 0) == (eg | 0)) ? (tr = 1 << di, Ar = tr ^ -1, Ir = $h & Ar, c[6] = Ir, ki = xj) : (Or = c[10] | 0, (nw = eg >>> 0 < Or >>> 0) && k(), ml = eg + 12 | 0, ds = c[ml >> 2] | 0, (ww = (ds | 0) == (yb | 0)) ? (c[ml >> 2] = Tk, c[Yk >> 2] = eg, ki = b = c[8] | 0) : k()), xl = di << 3, gi = xl - N | 0, vs = N | 3, Ds = yb + 4 | 0, c[Ds >> 2] = vs, Ms = yb + N | 0, Ps = gi | 1, ue = N |
4, Ws = yb + ue | 0, c[Ws >> 2] = Ps, bt = yb + xl | 0, c[bt >> 2] = gi, kt = 0 == (ki | 0), kt || (lg = c[11] | 0, Sl = ki >>> 3, oi = Sl << 1, Vl = (24 + (oi << 2) | 0) + 40 | 0, Xl = c[6] | 0, am = 1 << Sl, bu = Xl & am, (fx = 0 == (bu | 0)) ? (nu = Xl | am, c[6] = nu, we = oi + 2 | 0, Si = Au = (24 + (we << 2) | 0) + 40 | 0, wi = Vl) : (Lg = oi + 2 | 0, lm = (24 + (Lg << 2) | 0) + 40 | 0, ab = c[lm >> 2] | 0, Zb = c[10] | 0, (Ug = ab >>> 0 < Zb >>> 0) ? k() : (Si = lm, wi = ab)),
c[Si >> 2] = lg, He = wi + 12 | 0, c[He >> 2] = lg, Le = lg + 8 | 0, c[Le >> 2] = wi, Oe = lg + 12 | 0, c[Oe >> 2] = Vl), c[8] = gi, c[11] = Ms, H = bl, f = da, H | 0;
}
Ha = c[7] | 0;
if (gh = 0 == (Ha | 0)) {
A = N;
} else {
Xe = 0 - Ha | 0;
Ye = Ha & Xe;
jb = Ye + -1 | 0;
lc = jb >>> 12;
mc = lc & 16;
nc = jb >>> mc;
oc = nc >>> 5;
pc = oc & 8;
qc = pc | mc;
rc = nc >>> pc;
sc = rc >>> 2;
tc = sc & 4;
$e = qc | tc;
uc = rc >>> tc;
af = uc >>> 1;
vc = af & 2;
wc = $e | vc;
xc = uc >>> vc;
bf = xc >>> 1;
yc = bf & 1;
cf = wc | yc;
df = xc >>> yc;
kb = cf + df | 0;
ff = (24 + (kb << 2) | 0) + 304 | 0;
zc = c[ff >> 2] | 0;
gf = zc + 4 | 0;
Ac = c[gf >> 2] | 0;
Bc = Ac & -8;
pa = ih = Bc - N | 0;
for (D = Mi = zc;;) {
hf = Mi + 16 | 0;
jf = c[hf >> 2] | 0;
if (jh = 0 == (jf | 0)) {
if (kf = Mi + 20 | 0, Dc = c[kf >> 2] | 0, Ec = 0 == (Dc | 0)) {
break;
} else {
Ja = Dc;
}
} else {
Ja = jf;
}
kh = Ja + 4 | 0;
lh = c[kh >> 2] | 0;
lf = lh & -8;
Fc = lf - N | 0;
td = (mf = Fc >>> 0 < pa >>> 0) ? Fc : pa;
Mg = mf ? Ja : D;
pa = td;
Mi = Ja;
D = Mg;
}
lb = c[10] | 0;
(Xi = D >>> 0 < lb >>> 0) && k();
mb = D + N | 0;
(mh = D >>> 0 < mb >>> 0) || k();
nf = D + 24 | 0;
aa = c[nf >> 2] | 0;
of = D + 12 | 0;
Ka = c[of >> 2] | 0;
nh = (Ka | 0) == (D | 0);
do {
if (nh) {
ob = D + 20 | 0;
Ma = c[ob >> 2] | 0;
if (Zi = 0 == (Ma | 0)) {
if (Jc = D + 16 | 0, Kc = c[Jc >> 2] | 0, qh = 0 == (Kc | 0)) {
S = 0;
break;
} else {
Cb = Kc, od = Jc;
}
} else {
Cb = Ma, od = ob;
}
for (;;) {
if (Lc = Cb + 20 | 0, Mc = c[Lc >> 2] | 0, rh = 0 == (Mc | 0)) {
if (Nc = Cb + 16 | 0, qb = c[Nc >> 2] | 0, $i = 0 == (qb | 0)) {
break;
} else {
Cb = qb, od = Nc;
}
} else {
Cb = Mc, od = Lc;
}
}
(aj = od >>> 0 < lb >>> 0) ? k() : (c[od >> 2] = 0, S = Cb);
} else {
oh = D + 8 | 0, nb = c[oh >> 2] | 0, (Hc = nb >>> 0 < lb >>> 0) && k(), pf = nb + 12 | 0, qf = c[pf >> 2] | 0, (Yi = (qf | 0) == (D | 0)) || k(), Ic = Ka + 8 | 0, rf = c[Ic >> 2] | 0, (ph = (rf | 0) == (D | 0)) ? (c[pf >> 2] = Ka, c[Ic >> 2] = nb, S = Ka) : k();
}
} while (0);
sf = 0 == (aa | 0);
do {
if (!sf) {
tf = D + 28 | 0;
Oc = c[tf >> 2] | 0;
Pc = (24 + (Oc << 2) | 0) + 304 | 0;
uf = c[Pc >> 2] | 0;
if (bj = (D | 0) == (uf | 0)) {
if (c[Pc >> 2] = S, lx = 0 == (S | 0)) {
sh = 1 << Oc;
Qc = sh ^ -1;
vf = c[7] | 0;
wf = vf & Qc;
c[7] = wf;
break;
}
} else {
if (xf = c[10] | 0, (th = aa >>> 0 < xf >>> 0) && k(), na = aa + 16 | 0, yf = c[na >> 2] | 0, (rb = (yf | 0) == (D | 0)) ? c[na >> 2] = S : (zf = aa + 20 | 0, c[zf >> 2] = S), uh = 0 == (S | 0)) {
break;
}
}
Oa = c[10] | 0;
(Rc = S >>> 0 < Oa >>> 0) && k();
vh = S + 24 | 0;
c[vh >> 2] = aa;
wh = D + 16 | 0;
ua = c[wh >> 2] | 0;
Bf = 0 == (ua | 0);
Bf || ((dj = ua >>> 0 < Oa >>> 0) ? k() : (Tc = S + 16 | 0, c[Tc >> 2] = ua, Uc = ua + 24 | 0, c[Uc >> 2] = S));
xh = D + 20 | 0;
va = c[xh >> 2] | 0;
Vc = 0 == (va | 0);
Vc || (Wc = c[10] | 0, (Cf = va >>> 0 < Wc >>> 0) ? k() : (Xc = S + 20 | 0, c[Xc >> 2] = va, zh = va + 24 | 0, c[zh >> 2] = S));
}
} while (0);
(Df = 16 > pa >>> 0) ? (sb = pa + N | 0, Ah = sb | 3, Bh = D + 4 | 0, c[Bh >> 2] = Ah, Rb = sb + 4 | 0, Ef = D + Rb | 0, Ch = c[Ef >> 2] | 0, Ff = Ch | 1, c[Ef >> 2] = Ff) : (Zc = N | 3, Gf = D + 4 | 0, c[Gf >> 2] = Zc, Dh = pa | 1, Cd = N | 4, Hf = D + Cd | 0, c[Hf >> 2] = Dh, Ed = pa + N | 0, If = D + Ed | 0, c[If >> 2] = pa, $c = c[8] | 0, Jf = 0 == ($c | 0), Jf || (G = c[11] | 0, ad = $c >>> 3, bd = ad << 1, dd = (24 + (bd << 2) | 0) + 40 | 0, Kf = c[6] | 0, ed = 1 << ad, Eh = Kf &
ed, (Lf = 0 == (Eh | 0)) ? (Fh = Kf | ed, c[6] = Fh, ka = bd + 2 | 0, B = d = (24 + (ka << 2) | 0) + 40 | 0, vi = dd) : (Fg = bd + 2 | 0, fd = (24 + (Fg << 2) | 0) + 40 | 0, O = c[fd >> 2] | 0, Mf = c[10] | 0, (tb = O >>> 0 < Mf >>> 0) ? k() : (B = fd, vi = O)), c[B >> 2] = G, Hh = vi + 12 | 0, c[Hh >> 2] = G, Nf = G + 8 | 0, c[Nf >> 2] = vi, Of = G + 12 | 0, c[Of >> 2] = dd), c[8] = pa, c[11] = mb);
H = Ih = D + 8 | 0;
f = da;
return H | 0;
}
} else {
A = N;
}
} else {
if (ub = 4294967231 < a >>> 0) {
A = -1;
} else {
Pf = a + 11 | 0;
x = Pf & -8;
Pa = c[7] | 0;
fa = 0 == (Pa | 0);
if (!fa) {
gd = 0 - x | 0;
ba = Pf >>> 8;
(P = 0 == (ba | 0)) ? Fb = 0 : (wa = 16777215 < x >>> 0) ? Fb = 31 : (M = ba + 1048320 | 0, xa = M >>> 16, oa = xa & 8, ya = ba << oa, vb = ya + 520192 | 0, Jh = vb >>> 16, Qf = Jh & 4, t = Qf | oa, L = ya << Qf, V = L + 245760 | 0, hd = V >>> 16, wb = hd & 2, ga = t | wb, sm = 14 - ga | 0, tm = L << wb, um = tm >>> 15, ej = sm + um | 0, vm = ej << 1, wm = ej + 7 | 0, xm = x >>> wm, ym = xm & 1, Fb = Du = ym | vm);
zm = (24 + (Fb << 2) | 0) + 304 | 0;
fj = c[zm >> 2] | 0;
Am = 0 == (fj | 0);
a: do {
if (Am) {
tg = gd, sd = wg = 0;
} else {
for ((Eu = 31 == (Fb | 0)) ? hj = 0 : (Bm = Fb >>> 1, hj = Fu = 25 - Bm | 0), Cm = x << hj, Hi = gd, om = 0, Ji = Cm, Ib = fj, rm = 0;;) {
Dm = Ib + 4 | 0;
Em = c[Dm >> 2] | 0;
ij = Em & -8;
Lh = ij - x | 0;
if (Gu = Lh >>> 0 < Hi >>> 0) {
if (Hu = (ij | 0) == (x | 0)) {
tg = Lh;
sd = wg = Ib;
break a;
} else {
Ii = Lh, Pi = Ib;
}
} else {
Ii = Hi, Pi = rm;
}
Fm = Ib + 20 | 0;
Mh = c[Fm >> 2] | 0;
Hm = Ji >>> 31;
Im = (Ib + (Hm << 2) | 0) + 16 | 0;
Nh = c[Im >> 2] | 0;
Jm = 0 == (Mh | 0);
Km = (Mh | 0) == (Nh | 0);
pm = (ux = Jm | Km) ? om : Mh;
Lm = 0 == (Nh | 0);
Mm = Ji << 1;
if (Lm) {
tg = Ii;
wg = pm;
sd = Pi;
break;
} else {
Hi = Ii, om = pm, Ji = Mm, Ib = Nh, rm = Pi;
}
}
}
} while (0);
Nm = 0 == (wg | 0);
Om = 0 == (sd | 0);
if (px = Nm & Om) {
jj = 2 << Fb;
Qm = 0 - jj | 0;
Rm = jj | Qm;
Oh = Pa & Rm;
if (Ju = 0 == (Oh | 0)) {
A = x;
break;
}
Sm = 0 - Oh | 0;
Tm = Oh & Sm;
kj = Tm + -1 | 0;
Um = kj >>> 12;
lj = Um & 16;
nj = kj >>> lj;
Vm = nj >>> 5;
oj = Vm & 8;
Wm = oj | lj;
pj = nj >>> oj;
Xm = pj >>> 2;
qj = Xm & 4;
Ym = Wm | qj;
rj = pj >>> qj;
Zm = rj >>> 1;
sj = Zm & 2;
an = Ym | sj;
tj = rj >>> sj;
bn = tj >>> 1;
uj = bn & 1;
cn = an | uj;
dn = tj >>> uj;
en = cn + dn | 0;
fn = (24 + (en << 2) | 0) + 304 | 0;
Ni = Ku = c[fn >> 2] | 0;
} else {
Ni = wg;
}
if (Lu = 0 == (Ni | 0)) {
Q = tg, v = sd;
} else {
for (ug = tg, Jb = Ni, Qi = sd;;) {
if (hn = Jb + 4 | 0, jn = c[hn >> 2] | 0, kn = jn & -8, vj = kn - x | 0, Xa = (ln = vj >>> 0 < ug >>> 0) ? vj : ug, Oi = ln ? Jb : Qi, mn = Jb + 16 | 0, wj = c[mn >> 2] | 0, Mu = 0 == (wj | 0)) {
if (nn = Jb + 20 | 0, yj = c[nn >> 2] | 0, Nu = 0 == (yj | 0)) {
Q = Xa;
v = Oi;
break;
} else {
ug = Xa, Jb = yj, Qi = Oi;
}
} else {
ug = Xa, Jb = wj, Qi = Oi;
}
}
}
on = 0 == (v | 0);
if (!on && (pn = c[8] | 0, qn = pn - x | 0, Ou = Q >>> 0 < qn >>> 0)) {
Ph = c[10] | 0;
(Pu = v >>> 0 < Ph >>> 0) && k();
ca = v + x | 0;
(Qu = v >>> 0 < ca >>> 0) || k();
rn = v + 24 | 0;
id = c[rn >> 2] | 0;
sn = v + 12 | 0;
Rf = c[sn >> 2] | 0;
tn = (Rf | 0) == (v | 0);
do {
if (tn) {
Bj = v + 20 | 0;
Cj = c[Bj >> 2] | 0;
if (Vu = 0 == (Cj | 0)) {
if (Dj = v + 16 | 0, Ej = c[Dj >> 2] | 0, Wu = 0 == (Ej | 0)) {
U = 0;
break;
} else {
Eb = Ej, qd = Dj;
}
} else {
Eb = Cj, qd = Bj;
}
for (;;) {
if (Fj = Eb + 20 | 0, Gj = c[Fj >> 2] | 0, Xu = 0 == (Gj | 0)) {
if (Hj = Eb + 16 | 0, Ij = c[Hj >> 2] | 0, Yu = 0 == (Ij | 0)) {
break;
} else {
Eb = Ij, qd = Hj;
}
} else {
Eb = Gj, qd = Fj;
}
}
(Zu = qd >>> 0 < Ph >>> 0) ? k() : (c[qd >> 2] = 0, U = Eb);
} else {
un = v + 8 | 0, Qh = c[un >> 2] | 0, (Su = Qh >>> 0 < Ph >>> 0) && k(), zj = Qh + 12 | 0, vn = c[zj >> 2] | 0, (Tu = (vn | 0) == (v | 0)) || k(), Aj = Rf + 8 | 0, xn = c[Aj >> 2] | 0, (Uu = (xn | 0) == (v | 0)) ? (c[zj >> 2] = Rf, c[Aj >> 2] = Qh, U = Rf) : k();
}
} while (0);
zn = 0 == (id | 0);
do {
if (!zn) {
An = v + 28 | 0;
Jj = c[An >> 2] | 0;
Lj = (24 + (Jj << 2) | 0) + 304 | 0;
Bn = c[Lj >> 2] | 0;
if ($u = (v | 0) == (Bn | 0)) {
if (c[Lj >> 2] = U, nx = 0 == (U | 0)) {
Cn = 1 << Jj;
Dn = Cn ^ -1;
En = c[7] | 0;
Fn = En & Dn;
c[7] = Fn;
break;
}
} else {
if (Gn = c[10] | 0, (av = id >>> 0 < Gn >>> 0) && k(), Mj = id + 16 | 0, In = c[Mj >> 2] | 0, (bv = (In | 0) == (v | 0)) ? c[Mj >> 2] = U : (Jn = id + 20 | 0, c[Jn >> 2] = U), cv = 0 == (U | 0)) {
break;
}
}
Nj = c[10] | 0;
(dv = U >>> 0 < Nj >>> 0) && k();
Kn = U + 24 | 0;
c[Kn >> 2] = id;
Ln = v + 16 | 0;
Sf = c[Ln >> 2] | 0;
Mn = 0 == (Sf | 0);
Mn || ((ev = Sf >>> 0 < Nj >>> 0) ? k() : (On = U + 16 | 0, c[On >> 2] = Sf, Pn = Sf + 24 | 0, c[Pn >> 2] = U));
Qn = v + 20 | 0;
Uf = c[Qn >> 2] | 0;
Rn = 0 == (Uf | 0);
Rn || (Sn = c[10] | 0, (fv = Uf >>> 0 < Sn >>> 0) ? k() : (Tn = U + 20 | 0, c[Tn >> 2] = Uf, Un = Uf + 24 | 0, c[Un >> 2] = U));
}
} while (0);
Vn = 16 > Q >>> 0;
a: do {
if (Vn) {
Pj = Q + x | 0, Wn = Pj | 3, Xn = v + 4 | 0, c[Xn >> 2] = Wn, ce = Pj + 4 | 0, Qj = v + ce | 0, Yn = c[Qj >> 2] | 0, Zn = Yn | 1, c[Qj >> 2] = Zn;
} else {
if ($n = x | 3, ao = v + 4 | 0, c[ao >> 2] = $n, bo = Q | 1, Ad = x | 4, eo = v + Ad | 0, c[eo >> 2] = bo, Id = Q + x | 0, fo = v + Id | 0, c[fo >> 2] = Q, Rj = Q >>> 3, gv = 256 > Q >>> 0) {
Rh = Rj << 1, Sj = (24 + (Rh << 2) | 0) + 40 | 0, Tj = c[6] | 0, Uj = 1 << Rj, go = Tj & Uj, (hv = 0 == (go | 0)) ? (io = Tj | Uj, c[6] = io, Yd = Rh + 2 | 0, p = h = (24 + (Yd << 2) | 0) + 40 | 0, yi = Sj) : (be = Rh + 2 | 0, Vj = (24 + (be << 2) | 0) + 40 | 0, Wj = c[Vj >> 2] | 0, jo = c[10] | 0, (iv = Wj >>> 0 < jo >>> 0) ? k() : (p = Vj, yi = Wj)), c[p >> 2] = ca, ko = yi + 12 | 0, c[ko >> 2] = ca, Zd = x + 8 | 0, lo = v + Zd | 0, c[lo >> 2] = yi, ae = x + 12 | 0, mo = v +
ae | 0, c[mo >> 2] = Sj;
} else {
if (Sh = Q >>> 8, (jv = 0 == (Sh | 0)) ? Ta = 0 : (kv = 16777215 < Q >>> 0) ? Ta = 31 : (no = Sh + 1048320 | 0, oo = no >>> 16, Yj = oo & 8, Zj = Sh << Yj, po = Zj + 520192 | 0, qo = po >>> 16, ak = qo & 4, ro = ak | Yj, bk = Zj << ak, to = bk + 245760 | 0, uo = to >>> 16, ck = uo & 2, vo = ro | ck, wo = 14 - vo | 0, xo = bk << ck, yo = xo >>> 15, dk = wo + yo | 0, zo = dk << 1, Ao = dk + 7 | 0, Bo = Q >>> Ao, Co = Bo & 1, Ta = lv = Co | zo), Th = (24 + (Ta << 2) | 0) + 304 |
0, ee = x + 28 | 0, Do = v + ee | 0, c[Do >> 2] = Ta, ne = x + 16 | 0, Eo = v + ne | 0, re = x + 20 | 0, Fo = v + re | 0, c[Fo >> 2] = 0, c[Eo >> 2] = 0, fk = c[7] | 0, gk = 1 << Ta, Go = fk & gk, mv = 0 == (Go | 0)) {
Ho = fk | gk, c[7] = Ho, c[Th >> 2] = ca, te = x + 24 | 0, Io = v + te | 0, c[Io >> 2] = Th, Ca = x + 12 | 0, Jo = v + Ca | 0, c[Jo >> 2] = ca, ve = x + 8 | 0, Ko = v + ve | 0, c[Ko >> 2] = ca;
} else {
Uh = c[Th >> 2] | 0;
(nv = 31 == (Ta | 0)) ? ik = 0 : (Lo = Ta >>> 1, ik = ov = 25 - Lo | 0);
Mo = Uh + 4 | 0;
Oo = c[Mo >> 2] | 0;
Po = Oo & -8;
Qo = (Po | 0) == (Q | 0);
b: do {
if (Qo) {
pg = Uh;
} else {
zi = pv = Q << ik;
for (Di = Uh;;) {
Vo = zi >>> 31;
Vh = (Di + (Vo << 2) | 0) + 16 | 0;
Vf = c[Vh >> 2] | 0;
if (rv = 0 == (Vf | 0)) {
break;
}
Ro = zi << 1;
So = Vf + 4 | 0;
To = c[So >> 2] | 0;
Uo = To & -8;
if (qv = (Uo | 0) == (Q | 0)) {
pg = Vf;
break b;
} else {
zi = Ro, Di = Vf;
}
}
Wo = c[10] | 0;
if (sv = Vh >>> 0 < Wo >>> 0) {
k();
} else {
c[Vh >> 2] = ca;
Rd = x + 24 | 0;
Xo = v + Rd | 0;
c[Xo >> 2] = Di;
Bg = x + 12 | 0;
Yo = v + Bg | 0;
c[Yo >> 2] = ca;
Aa = x + 8 | 0;
Zo = v + Aa | 0;
c[Zo >> 2] = ca;
break a;
}
}
} while (0);
kk = pg + 8 | 0;
Wh = c[kk >> 2] | 0;
lk = c[10] | 0;
ap = pg >>> 0 >= lk >>> 0;
bp = Wh >>> 0 >= lk >>> 0;
(wx = ap & bp) ? (cp = Wh + 12 | 0, c[cp >> 2] = ca, c[kk >> 2] = ca, $a = x + 8 | 0, dp = v + $a | 0, c[dp >> 2] = Wh, Tb = x + 12 | 0, ep = v + Tb | 0, c[ep >> 2] = pg, Ya = x + 24 | 0, fp = v + Ya | 0, c[fp >> 2] = 0) : k();
}
}
}
} while (0);
H = tv = v + 8 | 0;
f = da;
return H | 0;
}
}
A = x;
}
}
} while (0);
jd = c[8] | 0;
gp = jd >>> 0 < A >>> 0;
if (!gp) {
return Wf = jd - A | 0, Ra = c[11] | 0, (uv = 15 < Wf >>> 0) ? (hp = Ra + A | 0, c[11] = hp, c[8] = Wf, ip = Wf | 1, de = A + 4 | 0, jp = Ra + de | 0, c[jp >> 2] = ip, kp = Ra + jd | 0, c[kp >> 2] = Wf, lp = A | 3, mp = Ra + 4 | 0, c[mp >> 2] = lp) : (c[8] = 0, c[11] = 0, op = jd | 3, pp = Ra + 4 | 0, c[pp >> 2] = op, Dd = jd + 4 | 0, nk = Ra + Dd | 0, qp = c[nk >> 2] | 0, rp = qp | 1, c[nk >> 2] = rp), H = vv = Ra + 8 | 0, f = da, H | 0;
}
ok = c[9] | 0;
if (wv = ok >>> 0 > A >>> 0) {
return pk = ok - A | 0, c[9] = pk, Xf = c[12] | 0, sp = Xf + A | 0, c[12] = sp, tp = pk | 1, ud = A + 4 | 0, up = Xf + ud | 0, c[up >> 2] = tp, vp = A | 3, wp = Xf + 4 | 0, c[wp >> 2] = vp, H = xv = Xf + 8 | 0, f = da, H | 0;
}
xp = c[124] | 0;
if (yv = 0 == (xp | 0)) {
Yf = z(30) | 0, yp = Yf + -1 | 0, Ap = yp & Yf, (zv = 0 == (Ap | 0)) ? (c[126] = Yf, c[125] = Yf, c[127] = -1, c[128] = -1, c[129] = 0, c[117] = 0, Bp = K(0) | 0, Cp = Bp & -16, Dp = Cp ^ 1431655768, c[124] = Dp) : k();
}
Ep = A + 48 | 0;
rk = c[126] | 0;
sk = A + 47 | 0;
tk = rk + sk | 0;
uk = 0 - rk | 0;
xb = tk & uk;
Fp = xb >>> 0 > A >>> 0;
if (!Fp) {
return H = 0, f = da, H | 0;
}
wk = c[116] | 0;
Gp = 0 == (wk | 0);
if (!Gp && (xk = c[114] | 0, yk = xk + xb | 0, Hp = yk >>> 0 <= xk >>> 0, Ip = yk >>> 0 > wk >>> 0, tx = Hp | Ip)) {
return H = 0, f = da, H | 0;
}
Jp = c[117] | 0;
Kp = Jp & 4;
Mp = 0 == (Kp | 0);
a: do {
if (Mp) {
Xh = c[12] | 0;
Np = 0 == (Xh | 0);
b: do {
if (Np) {
J = 181;
} else {
for (Gb = 472;;) {
zk = c[Gb >> 2] | 0;
Op = zk >>> 0 > Xh >>> 0;
if (!Op && (Ak = Gb + 4 | 0, Pp = c[Ak >> 2] | 0, Qp = zk + Pp | 0, Av = Qp >>> 0 > Xh >>> 0)) {
break;
}
Rp = Gb + 8 | 0;
Ck = c[Rp >> 2] | 0;
if (Bv = 0 == (Ck | 0)) {
J = 181;
break b;
} else {
Gb = Ck;
}
}
(Cv = 0 == (Gb | 0)) ? J = 181 : (cq = c[9] | 0, dq = tk - cq | 0, $f = dq & uk, (Hv = 2147483647 > $f >>> 0) ? (Zh = r($f | 0) | 0, fq = c[Gb >> 2] | 0, gq = c[Ak >> 2] | 0, hq = fq + gq | 0, (Iv = (Zh | 0) == (hq | 0)) ? (Fi = Zh, Ki = $f, J = 190) : (sg = Zh, za = $f, J = 191)) : Wa = 0);
}
} while (0);
do {
if (181 == (J | 0)) {
if (Zf = r(0) | 0, Dv = -1 == (Zf | 0)) {
Wa = 0;
} else {
if (Yh = Zf, Dk = c[125] | 0, Ek = Dk + -1 | 0, Sp = Ek & Yh, (Ev = 0 == (Sp | 0)) ? Va = xb : (Up = Ek + Yh | 0, Vp = 0 - Dk | 0, Wp = Up & Vp, Xp = xb - Yh | 0, Va = Fv = Xp + Wp | 0), Fk = c[114] | 0, Gk = Fk + Va | 0, Yp = Va >>> 0 > A >>> 0, Zp = 2147483647 > Va >>> 0, sx = Yp & Zp) {
Hk = c[116] | 0;
$p = 0 == (Hk | 0);
if (!$p && (aq = Gk >>> 0 <= Fk >>> 0, bq = Gk >>> 0 > Hk >>> 0, vx = aq | bq)) {
Wa = 0;
break;
}
Jk = r(Va | 0) | 0;
(Gv = (Jk | 0) == (Zf | 0)) ? (Fi = Zf, Ki = Va, J = 190) : (sg = Jk, za = Va, J = 191);
} else {
Wa = 0;
}
}
}
} while (0);
b: do {
if (190 == (J | 0)) {
if (Jv = -1 == (Fi | 0)) {
Wa = Ki;
} else {
q = Fi;
C = Ki;
J = 201;
break a;
}
} else {
if (191 == (J | 0)) {
iq = 0 - za | 0;
jq = -1 != (sg | 0);
kq = 2147483647 > za >>> 0;
zu = jq & kq;
lq = Ep >>> 0 > za >>> 0;
yu = zu & lq;
do {
if (yu) {
if (Kk = c[126] | 0, mq = sk - za | 0, nq = mq + Kk | 0, oq = 0 - Kk | 0, ai = nq & oq, Kv = 2147483647 > ai >>> 0) {
if (pq = r(ai | 0) | 0, Lv = -1 == (pq | 0)) {
r(iq | 0) | 0;
Wa = 0;
break b;
} else {
Li = Mv = ai + za | 0;
}
} else {
Li = za;
}
} else {
Li = za;
}
} while (0);
if (Nv = -1 == (sg | 0)) {
Wa = 0;
} else {
q = sg;
C = Li;
J = 201;
break a;
}
}
}
} while (0);
qq = c[117] | 0;
sq = qq | 4;
c[117] = sq;
qm = Wa;
} else {
qm = 0;
}
J = 198;
} while (0);
198 == (J | 0) && (Ov = 2147483647 > xb >>> 0) && (ag = r(xb | 0) | 0, bi = r(0) | 0, tq = -1 != (ag | 0), uq = -1 != (bi | 0), xu = tq & uq, vq = ag >>> 0 < bi >>> 0, yx = xu & vq) && (wq = bi, xq = ag, Mk = wq - xq | 0, zq = A + 40 | 0, ye = (Aq = Mk >>> 0 > zq >>> 0) ? Mk : qm, Aq && (q = ag, C = ye, J = 201));
if (201 == (J | 0)) {
Bq = c[114] | 0;
ci = Bq + C | 0;
c[114] = ci;
Cq = c[115] | 0;
(Pv = ci >>> 0 > Cq >>> 0) && (c[115] = ci);
u = c[12] | 0;
Dq = 0 == (u | 0);
a: do {
if (Dq) {
Nk = c[10] | 0;
Eq = 0 == (Nk | 0);
Fq = q >>> 0 < Nk >>> 0;
(zx = Eq | Fq) && (c[10] = q);
c[118] = q;
c[119] = C;
c[121] = 0;
Gq = c[124] | 0;
c[15] = Gq;
c[14] = -1;
for (Gi = 0;!(ei = Gi << 1, Ok = (24 + (ei << 2) | 0) + 40 | 0, vd = ei + 3 | 0, Hq = (24 + (vd << 2) | 0) + 40 | 0, c[Hq >> 2] = Ok, Fd = ei + 2 | 0, Iq = (24 + (Fd << 2) | 0) + 40 | 0, c[Iq >> 2] = Ok, Pk = Gi + 1 | 0, ox = 32 == (Pk | 0));) {
Gi = Pk;
}
Jq = C + -40 | 0;
Qk = Qv = q + 8 | 0;
Kq = Qk & 7;
(Rv = 0 == (Kq | 0)) ? bg = 0 : (Lq = 0 - Qk | 0, bg = Sv = Lq & 7);
Mq = q + bg | 0;
Sk = Jq - bg | 0;
c[12] = Mq;
c[9] = Sk;
Nq = Sk | 1;
xd = bg + 4 | 0;
Oq = q + xd | 0;
c[Oq >> 2] = Nq;
fe = C + -36 | 0;
Pq = q + fe | 0;
c[Pq >> 2] = 40;
Qq = c[128] | 0;
c[13] = Qq;
} else {
for (rd = 472;;) {
Uk = c[rd >> 2] | 0;
Vk = rd + 4 | 0;
Wk = c[Vk >> 2] | 0;
Rq = Uk + Wk | 0;
if (Tv = (q | 0) == (Rq | 0)) {
J = 213;
break;
}
Sq = rd + 8 | 0;
Xk = c[Sq >> 2] | 0;
if (Uv = 0 == (Xk | 0)) {
break;
} else {
rd = Xk;
}
}
if (213 == (J | 0) && (Tq = rd + 12 | 0, Uq = c[Tq >> 2] | 0, Vq = Uq & 8, Vv = 0 == (Vq | 0)) && (Wq = u >>> 0 >= Uk >>> 0, Xq = u >>> 0 < q >>> 0, xx = Wq & Xq)) {
Yq = Wk + C | 0;
c[Vk >> 2] = Yq;
Zq = c[9] | 0;
Zk = Zq + C | 0;
$k = Wv = u + 8 | 0;
$q = $k & 7;
(Xv = 0 == ($q | 0)) ? cg = 0 : (ar = 0 - $k | 0, cg = Yv = ar & 7);
br = u + cg | 0;
al = Zk - cg | 0;
c[12] = br;
c[9] = al;
cr = al | 1;
zd = cg + 4 | 0;
dr = u + zd | 0;
c[dr >> 2] = cr;
ge = Zk + 4 | 0;
er = u + ge | 0;
c[er >> 2] = 40;
fr = c[128] | 0;
c[13] = fr;
break;
}
cl = c[10] | 0;
ld = (Zv = q >>> 0 < cl >>> 0) ? c[10] = q : cl;
gr = q + C | 0;
for (Hb = 472;;) {
hr = c[Hb >> 2] | 0;
if ($v = (hr | 0) == (gr | 0)) {
J = 223;
break;
}
ir = Hb + 8 | 0;
dl = c[ir >> 2] | 0;
if (aw = 0 == (dl | 0)) {
break;
} else {
Hb = dl;
}
}
if (223 == (J | 0) && (jr = Hb + 12 | 0, kr = c[jr >> 2] | 0, lr = kr & 8, bw = 0 == (lr | 0))) {
c[Hb >> 2] = q;
el = Hb + 4 | 0;
mr = c[el >> 2] | 0;
nr = mr + C | 0;
c[el >> 2] = nr;
fl = cw = q + 8 | 0;
or = fl & 7;
(dw = 0 == (or | 0)) ? kd = 0 : (pr = 0 - fl | 0, kd = fw = pr & 7);
qr = q + kd | 0;
Ld = C + 8 | 0;
gl = gw = q + Ld | 0;
rr = gl & 7;
(hw = 0 == (rr | 0)) ? W = 0 : (sr = 0 - gl | 0, W = iw = sr & 7);
Md = W + C | 0;
ur = ha = q + Md | 0;
vr = qr;
wr = ur - vr | 0;
E = kd + A | 0;
X = q + E | 0;
fg = wr - A | 0;
xr = A | 3;
Hd = kd + 4 | 0;
yr = q + Hd | 0;
c[yr >> 2] = xr;
zr = (ha | 0) == (u | 0);
b: do {
if (zr) {
Br = c[9] | 0, hl = Br + fg | 0, c[9] = hl, c[12] = X, Cr = hl | 1, Kg = E + 4 | 0, Dr = q + Kg | 0, c[Dr >> 2] = Cr;
} else {
if (Er = c[11] | 0, jw = (ha | 0) == (Er | 0)) {
Fr = c[8] | 0, gg = Fr + fg | 0, c[8] = gg, c[11] = X, Gr = gg | 1, Jg = E + 4 | 0, Hr = q + Jg | 0, c[Hr >> 2] = Gr, se = gg + E | 0, Jr = q + se | 0, c[Jr >> 2] = gg;
} else {
Za = C + 4 | 0;
Kb = Za + W | 0;
Kr = q + Kb | 0;
hg = c[Kr >> 2] | 0;
Lr = hg & 3;
if (kw = 1 == (Lr | 0)) {
il = hg & -8;
jl = hg >>> 3;
Mr = 256 > hg >>> 0;
c: do {
if (Mr) {
Hg = W | 8, Ag = Hg + C | 0, Nr = q + Ag | 0, zb = c[Nr >> 2] | 0, qe = C + 12 | 0, Vd = qe + W | 0, Pr = q + Vd | 0, Ab = c[Pr >> 2] | 0, Qr = jl << 1, kl = (24 + (Qr << 2) | 0) + 40 | 0, Rr = (zb | 0) == (kl | 0), Rr || ((lw = zb >>> 0 < ld >>> 0) && k(), Sr = zb + 12 | 0, Tr = c[Sr >> 2] | 0, (mw = (Tr | 0) == (ha | 0)) || k()), (ow = (Ab | 0) == (zb | 0)) ? (Ur = 1 << jl, Vr = Ur ^ -1, Wr = c[6] | 0, Xr = Wr & Vr, c[6] = Xr) : ((pw = (Ab | 0) == (kl | 0)) ? Ri = Bu = Ab +
8 | 0 : ((qw = Ab >>> 0 < ld >>> 0) && k(), ll = Ab + 8 | 0, Yr = c[ll >> 2] | 0, (rw = (Yr | 0) == (ha | 0)) ? Ri = ll : k()), Zr = zb + 12 | 0, c[Zr >> 2] = Ab, c[Ri >> 2] = zb);
} else {
oe = W | 24;
Lb = oe + C | 0;
$r = q + Lb | 0;
md = c[$r >> 2] | 0;
ra = C + 12 | 0;
Nd = ra + W | 0;
as = q + Nd | 0;
ig = c[as >> 2] | 0;
bs = (ig | 0) == (ha | 0);
do {
if (bs) {
Sb = W | 16;
zg = Za + Sb | 0;
pl = q + zg | 0;
ql = c[pl >> 2] | 0;
if (vw = 0 == (ql | 0)) {
if (Ud = Sb + C | 0, rl = q + Ud | 0, sl = c[rl >> 2] | 0, xw = 0 == (sl | 0)) {
T = 0;
break;
} else {
Db = sl, pd = rl;
}
} else {
Db = ql, pd = pl;
}
for (;;) {
if (tl = Db + 20 | 0, ul = c[tl >> 2] | 0, yw = 0 == (ul | 0)) {
if (vl = Db + 16 | 0, wl = c[vl >> 2] | 0, zw = 0 == (wl | 0)) {
break;
} else {
Db = wl, pd = vl;
}
} else {
Db = ul, pd = tl;
}
}
(Aw = pd >>> 0 < ld >>> 0) ? k() : (c[pd >> 2] = 0, T = Db);
} else {
pe = W | 8, Od = pe + C | 0, cs = q + Od | 0, fi = c[cs >> 2] | 0, (sw = fi >>> 0 < ld >>> 0) && k(), nl = fi + 12 | 0, es = c[nl >> 2] | 0, (tw = (es | 0) == (ha | 0)) || k(), ol = ig + 8 | 0, gs = c[ol >> 2] | 0, (uw = (gs | 0) == (ha | 0)) ? (c[nl >> 2] = ig, c[ol >> 2] = fi, T = ig) : k();
}
} while (0);
hs = 0 == (md | 0);
if (!hs) {
R = C + 28 | 0;
Pd = R + W | 0;
is = q + Pd | 0;
yl = c[is >> 2] | 0;
zl = (24 + (yl << 2) | 0) + 304 | 0;
ks = c[zl >> 2] | 0;
ls = (ha | 0) == (ks | 0);
do {
if (ls) {
if (c[zl >> 2] = T, mx = 0 == (T | 0)) {
ms = 1 << yl;
ns = ms ^ -1;
os = c[7] | 0;
ps = os & ns;
c[7] = ps;
break c;
}
} else {
if (qs = c[10] | 0, (Bw = md >>> 0 < qs >>> 0) && k(), Al = md + 16 | 0, rs = c[Al >> 2] | 0, (Cw = (rs | 0) == (ha | 0)) ? c[Al >> 2] = T : (ss = md + 20 | 0, c[ss >> 2] = T), Dw = 0 == (T | 0)) {
break c;
}
}
} while (0);
Bl = c[10] | 0;
(Ew = T >>> 0 < Bl >>> 0) && k();
ts = T + 24 | 0;
c[ts >> 2] = md;
Qb = W | 16;
Qd = Qb + C | 0;
us = q + Qd | 0;
jg = c[us >> 2] | 0;
ws = 0 == (jg | 0);
ws || ((Fw = jg >>> 0 < Bl >>> 0) ? k() : (xs = T + 16 | 0, c[xs >> 2] = jg, ys = jg + 24 | 0, c[ys >> 2] = T));
Mb = Za + Qb | 0;
zs = q + Mb | 0;
kg = c[zs >> 2] | 0;
As = 0 == (kg | 0);
As || (Bs = c[10] | 0, (Gw = kg >>> 0 < Bs >>> 0) ? k() : (Cs = T + 20 | 0, c[Cs >> 2] = kg, Es = kg + 24 | 0, c[Es >> 2] = T));
}
}
} while (0);
xe = il | W;
ja = xe + C | 0;
Fs = q + ja | 0;
Gs = il + fg | 0;
nm = Fs;
Z = Gs;
} else {
nm = ha, Z = fg;
}
Cl = nm + 4 | 0;
Hs = c[Cl >> 2] | 0;
Is = Hs & -2;
c[Cl >> 2] = Is;
Js = Z | 1;
Kd = E + 4 | 0;
Ks = q + Kd | 0;
c[Ks >> 2] = Js;
yg = Z + E | 0;
Ls = q + yg | 0;
c[Ls >> 2] = Z;
Dl = Z >>> 3;
if (Hw = 256 > Z >>> 0) {
hi = Dl << 1, El = (24 + (hi << 2) | 0) + 40 | 0, Fl = c[6] | 0, Gl = 1 << Dl, Ns = Fl & Gl, (Iw = 0 == (Ns | 0)) ? (Os = Fl | Gl, c[6] = Os, ke = hi + 2 | 0, n = g = (24 + (ke << 2) | 0) + 40 | 0, xi = El) : (me = hi + 2 | 0, Hl = (24 + (me << 2) | 0) + 40 | 0, Il = c[Hl >> 2] | 0, Qs = c[10] | 0, (Jw = Il >>> 0 < Qs >>> 0) ? k() : (n = Hl, xi = Il)), c[n >> 2] = X, Rs = xi + 12 | 0, c[Rs >> 2] = X, Eg = E + 8 | 0, Ss = q + Eg | 0, c[Ss >> 2] = xi, le = E + 12 | 0, Ts = q + le |
0, c[Ts >> 2] = El;
} else {
if (ii = Z >>> 8, (Kw = 0 == (ii | 0)) ? Ua = 0 : (Lw = 16777215 < Z >>> 0) ? Ua = 31 : (Us = ii + 1048320 | 0, Vs = Us >>> 16, Jl = Vs & 8, Kl = ii << Jl, Xs = Kl + 520192 | 0, Ys = Xs >>> 16, Ll = Ys & 4, Zs = Ll | Jl, Ml = Kl << Ll, $s = Ml + 245760 | 0, at = $s >>> 16, Nl = at & 2, ct = Zs | Nl, dt = 14 - ct | 0, et = Ml << Nl, ft = et >>> 15, Ol = dt + ft | 0, gt = Ol << 1, ht = Ol + 7 | 0, it = Z >>> ht, jt = it & 1, Ua = Mw = jt | gt), ji = (24 + (Ua << 2) | 0) + 304 |
0, Wd = E + 28 | 0, lt = q + Wd | 0, c[lt >> 2] = Ua, Nb = E + 16 | 0, mt = q + Nb | 0, Xd = E + 20 | 0, nt = q + Xd | 0, c[nt >> 2] = 0, c[mt >> 2] = 0, Pl = c[7] | 0, Ql = 1 << Ua, ot = Pl & Ql, Nw = 0 == (ot | 0)) {
pt = Pl | Ql, c[7] = pt, c[ji >> 2] = X, $d = E + 24 | 0, qt = q + $d | 0, c[qt >> 2] = ji, Cg = E + 12 | 0, rt = q + Cg | 0, c[rt >> 2] = X, Ba = E + 8 | 0, st = q + Ba | 0, c[st >> 2] = X;
} else {
li = c[ji >> 2] | 0;
(Ow = 31 == (Ua | 0)) ? Rl = 0 : (tt = Ua >>> 1, Rl = Pw = 25 - tt | 0);
ut = li + 4 | 0;
vt = c[ut >> 2] | 0;
wt = vt & -8;
xt = (wt | 0) == (Z | 0);
c: do {
if (xt) {
rg = li;
} else {
Bi = Qw = Z << Rl;
for (Ei = li;;) {
Dt = Bi >>> 31;
mi = (Ei + (Dt << 2) | 0) + 16 | 0;
mg = c[mi >> 2] | 0;
if (Sw = 0 == (mg | 0)) {
break;
}
zt = Bi << 1;
At = mg + 4 | 0;
Bt = c[At >> 2] | 0;
Ct = Bt & -8;
if (Rw = (Ct | 0) == (Z | 0)) {
rg = mg;
break c;
} else {
Bi = zt, Ei = mg;
}
}
Et = c[10] | 0;
if (Tw = mi >>> 0 < Et >>> 0) {
k();
} else {
c[mi >> 2] = X;
ie = E + 24 | 0;
Ft = q + ie | 0;
c[Ft >> 2] = Ei;
Pb = E + 12 | 0;
Gt = q + Pb | 0;
c[Gt >> 2] = X;
je = E + 8 | 0;
Ht = q + je | 0;
c[Ht >> 2] = X;
break b;
}
}
} while (0);
Tl = rg + 8 | 0;
ni = c[Tl >> 2] | 0;
Ul = c[10] | 0;
It = rg >>> 0 >= Ul >>> 0;
Jt = ni >>> 0 >= Ul >>> 0;
(rx = It & Jt) ? (Kt = ni + 12 | 0, c[Kt >> 2] = X, c[Tl >> 2] = X, he = E + 8 | 0, Lt = q + he | 0, c[Lt >> 2] = ni, la = E + 12 | 0, Mt = q + la | 0, c[Mt >> 2] = rg, I = E + 24 | 0, Nt = q + I | 0, c[Nt >> 2] = 0) : k();
}
}
}
}
} while (0);
Dg = kd | 8;
H = Uw = q + Dg | 0;
f = da;
return H | 0;
}
for (vg = 472;;) {
ng = c[vg >> 2] | 0;
Ot = ng >>> 0 > u >>> 0;
if (!Ot && (Pt = vg + 4 | 0, pi = c[Pt >> 2] | 0, qi = ng + pi | 0, Vw = qi >>> 0 > u >>> 0)) {
break;
}
Qt = vg + 8 | 0;
vg = Ww = c[Qt >> 2] | 0;
}
yd = pi + -47 | 0;
Gd = pi + -39 | 0;
Wl = Xw = ng + Gd | 0;
Rt = Wl & 7;
(Yw = 0 == (Rt | 0)) ? Yl = 0 : (St = 0 - Wl | 0, Yl = Zw = St & 7);
Ob = yd + Yl | 0;
Zl = ng + Ob | 0;
Tt = u + 16 | 0;
Bb = ($w = Zl >>> 0 < Tt >>> 0) ? u : Zl;
nd = Bb + 8 | 0;
Ut = C + -40 | 0;
$l = ax = q + 8 | 0;
Vt = $l & 7;
(bx = 0 == (Vt | 0)) ? og = 0 : (Wt = 0 - $l | 0, og = cx = Wt & 7);
Xt = q + og | 0;
bm = Ut - og | 0;
c[12] = Xt;
c[9] = bm;
Yt = bm | 1;
wd = og + 4 | 0;
Zt = q + wd | 0;
c[Zt >> 2] = Yt;
qa = C + -36 | 0;
$t = q + qa | 0;
c[$t >> 2] = 40;
au = c[128] | 0;
c[13] = au;
cu = Bb + 4 | 0;
c[cu >> 2] = 27;
c[nd + 0 >> 2] = c[118] | 0;
c[nd + 4 >> 2] = c[119] | 0;
c[nd + 8 >> 2] = c[120] | 0;
c[nd + 12 >> 2] = c[121] | 0;
c[118] = q;
c[119] = C;
c[121] = 0;
c[120] = nd;
cm = Bb + 28 | 0;
c[cm >> 2] = 7;
du = Bb + 32 | 0;
if (dx = du >>> 0 < qi >>> 0) {
for (ri = cm;;) {
if (dm = ri + 4 | 0, c[dm >> 2] = 7, eu = ri + 8 | 0, ex = eu >>> 0 < qi >>> 0) {
ri = dm;
} else {
break;
}
}
}
fu = (Bb | 0) == (u | 0);
if (!fu) {
if (gu = Bb, hu = u, Y = gu - hu | 0, iu = u + Y | 0, Gg = Y + 4 | 0, em = u + Gg | 0, ju = c[em >> 2] | 0, ku = ju & -2, c[em >> 2] = ku, lu = Y | 1, mu = u + 4 | 0, c[mu >> 2] = lu, c[iu >> 2] = Y, fm = Y >>> 3, gx = 256 > Y >>> 0) {
si = fm << 1, gm = (24 + (si << 2) | 0) + 40 | 0, hm = c[6] | 0, im = 1 << fm, ou = hm & im, (hx = 0 == (ou | 0)) ? (pu = hm | im, c[6] = pu, xg = si + 2 | 0, l = e = (24 + (xg << 2) | 0) + 40 | 0, ui = gm) : (Sd = si + 2 | 0, jm = (24 + (Sd << 2) | 0) + 40 | 0, km = c[jm >> 2] | 0, qu = c[10] | 0, (ix = km >>> 0 < qu >>> 0) ? k() : (l = jm, ui = km)), c[l >> 2] = u, ru = ui + 12 | 0, c[ru >> 2] = u, su = u + 8 | 0, c[su >> 2] = ui, tu = u + 12 | 0, c[tu >> 2] = gm;
} else {
if (ti = Y >>> 8, (jx = 0 == (ti | 0)) ? Sa = 0 : (kx = 16777215 < Y >>> 0) ? Sa = 31 : (uu = ti + 1048320 | 0, vu = uu >>> 16, mm = vu & 8, bb = ti << mm, Pg = bb + 520192 | 0, Vb = Pg >>> 16, cb = Vb & 4, Qg = cb | mm, ze = bb << cb, Wb = ze + 245760 | 0, Xb = Wb >>> 16, Ae = Xb & 2, Yb = Qg | Ae, Rg = 14 - Yb | 0, Be = ze << Ae, Sg = Be >>> 15, $b = Rg + Sg | 0, ac = $b << 1, Ce = $b + 7 | 0, bc = Y >>> Ce, cc = bc & 1, Sa = Tg = cc | ac), dc = (24 + (Sa << 2) | 0) + 304 | 0, De =
u + 28 | 0, wu = Sa, c[De >> 2] = wu, Ee = u + 20 | 0, c[Ee >> 2] = 0, Fe = u + 16 | 0, c[Fe >> 2] = 0, ec = c[7] | 0, ea = 1 << Sa, Vg = ec & ea, Ti = 0 == (Vg | 0)) {
fc = ec | ea, c[7] = fc, c[dc >> 2] = u, Ge = u + 24 | 0, c[Ge >> 2] = dc, Wg = u + 12 | 0, c[Wg >> 2] = u, Xg = u + 8 | 0, c[Xg >> 2] = u;
} else {
Da = c[dc >> 2] | 0;
(Ui = 31 == (Sa | 0)) ? gc = 0 : (Ie = Sa >>> 1, gc = Yg = 25 - Ie | 0);
Je = Da + 4 | 0;
Ea = c[Je >> 2] | 0;
Ke = Ea & -8;
Zg = (Ke | 0) == (Y | 0);
b: do {
if (Zg) {
qg = Da;
} else {
Ai = $g = Y << gc;
for (Ci = Da;;) {
Ne = Ai >>> 31;
db = (Ci + (Ne << 2) | 0) + 16 | 0;
Ga = c[db >> 2] | 0;
if (ch = 0 == (Ga | 0)) {
break;
}
Fa = Ai << 1;
Me = Ga + 4 | 0;
ah = c[Me >> 2] | 0;
ma = ah & -8;
if (bh = (ma | 0) == (Y | 0)) {
qg = Ga;
break b;
} else {
Ai = Fa, Ci = Ga;
}
}
Pe = c[10] | 0;
if (Vi = db >>> 0 < Pe >>> 0) {
k();
} else {
c[db >> 2] = u;
Qe = u + 24 | 0;
c[Qe >> 2] = Ci;
Re = u + 12 | 0;
c[Re >> 2] = u;
Se = u + 8 | 0;
c[Se >> 2] = u;
break a;
}
}
} while (0);
hc = qg + 8 | 0;
eb = c[hc >> 2] | 0;
fb = c[10] | 0;
dh = qg >>> 0 >= fb >>> 0;
gb = eb >>> 0 >= fb >>> 0;
(qx = dh & gb) ? (ic = eb + 12 | 0, c[ic >> 2] = u, c[hc >> 2] = u, jc = u + 8 | 0, c[jc >> 2] = eb, Te = u + 12 | 0, c[Te >> 2] = qg, eh = u + 24 | 0, c[eh >> 2] = 0) : k();
}
}
}
}
} while (0);
kc = c[9] | 0;
if (sa = kc >>> 0 > A >>> 0) {
return hb = kc - A | 0, c[9] = hb, ta = c[12] | 0, Ue = ta + A | 0, c[12] = Ue, fh = hb | 1, Bd = A + 4 | 0, Ve = ta + Bd | 0, c[Ve >> 2] = fh, We = A | 3, ib = ta + 4 | 0, c[ib >> 2] = We, H = Wi = ta + 8 | 0, f = da, H | 0;
}
}
hh = F() | 0;
c[hh >> 2] = 12;
H = 0;
f = da;
return H | 0;
}, _memcpy:function(a, b, d) {
a |= 0;
b |= 0;
d |= 0;
var f = 0;
if (4096 <= (d | 0)) {
return B(a | 0, b | 0, d | 0) | 0;
}
f = a | 0;
if ((a & 3) == (b & 3)) {
for (;a & 3;) {
if (0 == (d | 0)) {
return f | 0;
}
e[a >> 0] = e[b >> 0] | 0;
a = a + 1 | 0;
b = b + 1 | 0;
d = d - 1 | 0;
}
for (;4 <= (d | 0);) {
c[a >> 2] = c[b >> 2] | 0, a = a + 4 | 0, b = b + 4 | 0, d = d - 4 | 0;
}
}
for (;0 < (d | 0);) {
e[a >> 0] = e[b >> 0] | 0, a = a + 1 | 0, b = b + 1 | 0, d = d - 1 | 0;
}
return f | 0;
}, runPostSets:function() {
}, stackAlloc:function(a) {
var b = 0, b = f;
f = f + (a | 0) | 0;
f = f + 15 & -16;
(f | 0) >= (g | 0) && n();
return b | 0;
}, stackSave:function() {
return f | 0;
}, stackRestore:function(a) {
f = a | 0;
}, setThrew:function(a, b) {
0 == (h | 0) && (h = a | 0);
}, setTempRet0:function(a) {
l = a | 0;
}, getTempRet0:function() {
return l | 0;
}};
}(Module.asmGlobalArg, Module.asmLibraryArg, buffer), real__strlen = asm._strlen;
asm._strlen = function() {
assert(runtimeInitialized, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)");
assert(!runtimeExited, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");
return real__strlen.apply(null, arguments);
};
var real__main = asm._main;
asm._main = function() {
assert(runtimeInitialized, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)");
assert(!runtimeExited, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");
return real__main.apply(null, arguments);
};
var real_runPostSets = asm.runPostSets;
asm.runPostSets = function() {
assert(runtimeInitialized, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)");
assert(!runtimeExited, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");
return real_runPostSets.apply(null, arguments);
};
var _strlen = Module._strlen = asm._strlen, _free = Module._free = asm._free, _main = Module._main = asm._main, _memset = Module._memset = asm._memset, _malloc = Module._malloc = asm._malloc, _memcpy = Module._memcpy = asm._memcpy, runPostSets = Module.runPostSets = asm.runPostSets;
Runtime.stackAlloc = asm.stackAlloc;
Runtime.stackSave = asm.stackSave;
Runtime.stackRestore = asm.stackRestore;
Runtime.setTempRet0 = asm.setTempRet0;
Runtime.getTempRet0 = asm.getTempRet0;
var i64Math = null;
if (memoryInitializer) {
if ("function" === typeof Module.locateFile ? memoryInitializer = Module.locateFile(memoryInitializer) : Module.memoryInitializerPrefixURL && (memoryInitializer = Module.memoryInitializerPrefixURL + memoryInitializer), ENVIRONMENT_IS_NODE || ENVIRONMENT_IS_SHELL) {
var data = Module.readBinary(memoryInitializer);
HEAPU8.set(data, STATIC_BASE);
} else {
addRunDependency("memory initializer"), Browser.asyncLoad(memoryInitializer, function(a) {
for (var b = 0;b < a.length;b++) {
assert(0 === HEAPU8[STATIC_BASE + b], "area for memory initializer should not have been touched before it's loaded");
}
HEAPU8.set(a, STATIC_BASE);
removeRunDependency("memory initializer");
}, function(a) {
throw "could not load memory initializer " + memoryInitializer;
});
}
}
function ExitStatus(a) {
this.name = "ExitStatus";
this.message = "Program terminated with exit(" + a + ")";
this.status = a;
}
ExitStatus.prototype = Error();
ExitStatus.prototype.constructor = ExitStatus;
var initialStackTop, preloadStartTime = null, calledMain = !1, dependenciesFulfilled = function runCaller() {
!Module.calledRun && shouldRunNow && run();
Module.calledRun || (dependenciesFulfilled = runCaller);
};
Module.callMain = Module.callMain = function(a) {
function b() {
for (var a = 0;3 > a;a++) {
e.push(0);
}
}
assert(0 == runDependencies, "cannot call main when async dependencies remain! (listen on __ATMAIN__)");
assert(0 == __ATPRERUN__.length, "cannot call main when preRun functions remain to be called");
a = a || [];
ensureInitRuntime();
var d = a.length + 1, e = [allocate(intArrayFromString(Module.thisProgram), "i8", ALLOC_NORMAL)];
b();
for (var c = 0;c < d - 1;c += 1) {
e.push(allocate(intArrayFromString(a[c]), "i8", ALLOC_NORMAL)), b();
}
e.push(0);
e = allocate(e, "i32", ALLOC_NORMAL);
initialStackTop = STACKTOP;
try {
var f = Module._main(d, e, 0);
exit(f);
} catch (g) {
if (!(g instanceof ExitStatus)) {
if ("SimulateInfiniteLoop" == g) {
Module.noExitRuntime = !0;
} else {
throw g && "object" === typeof g && g.stack && Module.printErr("exception thrown: " + [g, g.stack]), g;
}
}
} finally {
calledMain = !0;
}
};
function run(a) {
function b() {
Module.calledRun || (Module.calledRun = !0, ABORT || (ensureInitRuntime(), preMain(), ENVIRONMENT_IS_WEB && null !== preloadStartTime && Module.printErr("pre-main prep time: " + (Date.now() - preloadStartTime) + " ms"), Module._main && shouldRunNow && Module.callMain(a), postRun()));
}
a = a || Module.arguments;
null === preloadStartTime && (preloadStartTime = Date.now());
0 < runDependencies ? Module.printErr("run() called, but dependencies remain, so not running") : (preRun(), 0 < runDependencies || Module.calledRun || (Module.setStatus ? (Module.setStatus("Running..."), setTimeout(function() {
setTimeout(function() {
Module.setStatus("");
}, 1);
b();
}, 1)) : b()));
}
Module.run = Module.run = run;
function exit(a) {
if (Module.noExitRuntime) {
Module.printErr("exit(" + a + ") called, but noExitRuntime, so not exiting");
} else {
throw ABORT = !0, EXITSTATUS = a, STACKTOP = initialStackTop, exitRuntime(), ENVIRONMENT_IS_NODE ? (process.stdout.once("drain", function() {
process.exit(a);
}), console.log(" "), setTimeout(function() {
process.exit(a);
}, 500)) : ENVIRONMENT_IS_SHELL && "function" === typeof quit && quit(a), new ExitStatus(a);
}
}
Module.exit = Module.exit = exit;
function abort(a) {
a && (Module.print(a), Module.printErr(a));
ABORT = !0;
EXITSTATUS = 1;
throw "abort() at " + stackTrace() + "";
}
Module.abort = Module.abort = abort;
if (Module.preInit) {
for ("function" == typeof Module.preInit && (Module.preInit = [Module.preInit]);0 < Module.preInit.length;) {
Module.preInit.pop()();
}
}
var shouldRunNow = !0;
Module.noInitialRun && (shouldRunNow = !1);
run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment