Advertisement
Guest User

StackClash.js

a guest
Jun 29th, 2017
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 446.86 KB | None | 0 0
  1. // The Module object: Our interface to the outside world. We import
  2. // and export values on it, and do the work to get that through
  3. // closure compiler if necessary. There are various ways Module can be used:
  4. // 1. Not defined. We create it here
  5. // 2. A function parameter, function(Module) { ..generated code.. }
  6. // 3. pre-run appended it, var Module = {}; ..generated code..
  7. // 4. External script tag defines var Module.
  8. // We need to do an eval in order to handle the closure compiler
  9. // case, where this code here is minified but Module was defined
  10. // elsewhere (e.g. case 4 above). We also need to check if Module
  11. // already exists (e.g. case 3 above).
  12. // Note that if you want to run closure, and also to use Module
  13. // after the generated code, you will need to define var Module = {};
  14. // before the code. Then that object will be used in the code, and you
  15. // can continue to use Module afterwards as well.
  16. var Module;
  17. if (!Module) Module = (typeof Module !== 'undefined' ? Module : null) || {};
  18.  
  19. // Sometimes an existing Module object exists with properties
  20. // meant to overwrite the default module functionality. Here
  21. // we collect those properties and reapply _after_ we configure
  22. // the current environment's defaults to avoid having to be so
  23. // defensive during initialization.
  24. var moduleOverrides = {};
  25. for (var key in Module) {
  26. if (Module.hasOwnProperty(key)) {
  27. moduleOverrides[key] = Module[key];
  28. }
  29. }
  30.  
  31. // The environment setup code below is customized to use Module.
  32. // *** Environment setup code ***
  33. var ENVIRONMENT_IS_WEB = false;
  34. var ENVIRONMENT_IS_WORKER = false;
  35. var ENVIRONMENT_IS_NODE = false;
  36. var ENVIRONMENT_IS_SHELL = false;
  37.  
  38. // Three configurations we can be running in:
  39. // 1) We could be the application main() thread running in the main JS UI thread. (ENVIRONMENT_IS_WORKER == false and ENVIRONMENT_IS_PTHREAD == false)
  40. // 2) We could be the application main() thread proxied to worker. (with Emscripten -s PROXY_TO_WORKER=1) (ENVIRONMENT_IS_WORKER == true, ENVIRONMENT_IS_PTHREAD == false)
  41. // 3) We could be an application pthread running in a worker. (ENVIRONMENT_IS_WORKER == true and ENVIRONMENT_IS_PTHREAD == true)
  42.  
  43. if (Module['ENVIRONMENT']) {
  44. if (Module['ENVIRONMENT'] === 'WEB') {
  45. ENVIRONMENT_IS_WEB = true;
  46. } else if (Module['ENVIRONMENT'] === 'WORKER') {
  47. ENVIRONMENT_IS_WORKER = true;
  48. } else if (Module['ENVIRONMENT'] === 'NODE') {
  49. ENVIRONMENT_IS_NODE = true;
  50. } else if (Module['ENVIRONMENT'] === 'SHELL') {
  51. ENVIRONMENT_IS_SHELL = true;
  52. } else {
  53. throw new Error('The provided Module[\'ENVIRONMENT\'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.');
  54. }
  55. } else {
  56. ENVIRONMENT_IS_WEB = typeof window === 'object';
  57. ENVIRONMENT_IS_WORKER = typeof importScripts === 'function';
  58. ENVIRONMENT_IS_NODE = typeof process === 'object' && typeof require === 'function' && !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_WORKER;
  59. ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
  60. }
  61.  
  62.  
  63. if (ENVIRONMENT_IS_NODE) {
  64. // Expose functionality in the same simple way that the shells work
  65. // Note that we pollute the global namespace here, otherwise we break in node
  66. if (!Module['print']) Module['print'] = console.log;
  67. if (!Module['printErr']) Module['printErr'] = console.warn;
  68.  
  69. var nodeFS;
  70. var nodePath;
  71.  
  72. Module['read'] = function read(filename, binary) {
  73. if (!nodeFS) nodeFS = require('fs');
  74. if (!nodePath) nodePath = require('path');
  75. filename = nodePath['normalize'](filename);
  76. var ret = nodeFS['readFileSync'](filename);
  77. return binary ? ret : ret.toString();
  78. };
  79.  
  80. Module['readBinary'] = function readBinary(filename) {
  81. var ret = Module['read'](filename, true);
  82. if (!ret.buffer) {
  83. ret = new Uint8Array(ret);
  84. }
  85. assert(ret.buffer);
  86. return ret;
  87. };
  88.  
  89. Module['load'] = function load(f) {
  90. globalEval(read(f));
  91. };
  92.  
  93. if (!Module['thisProgram']) {
  94. if (process['argv'].length > 1) {
  95. Module['thisProgram'] = process['argv'][1].replace(/\\/g, '/');
  96. } else {
  97. Module['thisProgram'] = 'unknown-program';
  98. }
  99. }
  100.  
  101. Module['arguments'] = process['argv'].slice(2);
  102.  
  103. if (typeof module !== 'undefined') {
  104. module['exports'] = Module;
  105. }
  106.  
  107. process['on']('uncaughtException', function(ex) {
  108. // suppress ExitStatus exceptions from showing an error
  109. if (!(ex instanceof ExitStatus)) {
  110. throw ex;
  111. }
  112. });
  113.  
  114. Module['inspect'] = function () { return '[Emscripten Module object]'; };
  115. }
  116. else if (ENVIRONMENT_IS_SHELL) {
  117. if (!Module['print']) Module['print'] = print;
  118. if (typeof printErr != 'undefined') Module['printErr'] = printErr; // not present in v8 or older sm
  119.  
  120. if (typeof read != 'undefined') {
  121. Module['read'] = read;
  122. } else {
  123. Module['read'] = function read() { throw 'no read() available' };
  124. }
  125.  
  126. Module['readBinary'] = function readBinary(f) {
  127. if (typeof readbuffer === 'function') {
  128. return new Uint8Array(readbuffer(f));
  129. }
  130. var data = read(f, 'binary');
  131. assert(typeof data === 'object');
  132. return data;
  133. };
  134.  
  135. if (typeof scriptArgs != 'undefined') {
  136. Module['arguments'] = scriptArgs;
  137. } else if (typeof arguments != 'undefined') {
  138. Module['arguments'] = arguments;
  139. }
  140.  
  141. }
  142. else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
  143. Module['read'] = function read(url) {
  144. var xhr = new XMLHttpRequest();
  145. xhr.open('GET', url, false);
  146. xhr.send(null);
  147. return xhr.responseText;
  148. };
  149.  
  150. Module['readAsync'] = function readAsync(url, onload, onerror) {
  151. var xhr = new XMLHttpRequest();
  152. xhr.open('GET', url, true);
  153. xhr.responseType = 'arraybuffer';
  154. xhr.onload = function xhr_onload() {
  155. if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0
  156. onload(xhr.response);
  157. } else {
  158. onerror();
  159. }
  160. };
  161. xhr.onerror = onerror;
  162. xhr.send(null);
  163. };
  164.  
  165. if (typeof arguments != 'undefined') {
  166. Module['arguments'] = arguments;
  167. }
  168.  
  169. if (typeof console !== 'undefined') {
  170. if (!Module['print']) Module['print'] = function print(x) {
  171. console.log(x);
  172. };
  173. if (!Module['printErr']) Module['printErr'] = function printErr(x) {
  174. console.warn(x);
  175. };
  176. } else {
  177. // Probably a worker, and without console.log. We can do very little here...
  178. var TRY_USE_DUMP = false;
  179. if (!Module['print']) Module['print'] = (TRY_USE_DUMP && (typeof(dump) !== "undefined") ? (function(x) {
  180. dump(x);
  181. }) : (function(x) {
  182. // self.postMessage(x); // enable this if you want stdout to be sent as messages
  183. }));
  184. }
  185.  
  186. if (ENVIRONMENT_IS_WORKER) {
  187. Module['load'] = importScripts;
  188. }
  189.  
  190. if (typeof Module['setWindowTitle'] === 'undefined') {
  191. Module['setWindowTitle'] = function(title) { document.title = title };
  192. }
  193. }
  194. else {
  195. // Unreachable because SHELL is dependant on the others
  196. throw 'Unknown runtime environment. Where are we?';
  197. }
  198.  
  199. function globalEval(x) {
  200. eval.call(null, x);
  201. }
  202. if (!Module['load'] && Module['read']) {
  203. Module['load'] = function load(f) {
  204. globalEval(Module['read'](f));
  205. };
  206. }
  207. if (!Module['print']) {
  208. Module['print'] = function(){};
  209. }
  210. if (!Module['printErr']) {
  211. Module['printErr'] = Module['print'];
  212. }
  213. if (!Module['arguments']) {
  214. Module['arguments'] = [];
  215. }
  216. if (!Module['thisProgram']) {
  217. Module['thisProgram'] = './this.program';
  218. }
  219.  
  220. // *** Environment setup code ***
  221.  
  222. // Closure helpers
  223. Module.print = Module['print'];
  224. Module.printErr = Module['printErr'];
  225.  
  226. // Callbacks
  227. Module['preRun'] = [];
  228. Module['postRun'] = [];
  229.  
  230. // Merge back in the overrides
  231. for (var key in moduleOverrides) {
  232. if (moduleOverrides.hasOwnProperty(key)) {
  233. Module[key] = moduleOverrides[key];
  234. }
  235. }
  236. // Free the object hierarchy contained in the overrides, this lets the GC
  237. // reclaim data used e.g. in memoryInitializerRequest, which is a large typed array.
  238. moduleOverrides = undefined;
  239.  
  240.  
  241.  
  242. // {{PREAMBLE_ADDITIONS}}
  243.  
  244. // === Preamble library stuff ===
  245.  
  246. // Documentation for the public APIs defined in this file must be updated in:
  247. // site/source/docs/api_reference/preamble.js.rst
  248. // A prebuilt local version of the documentation is available at:
  249. // site/build/text/docs/api_reference/preamble.js.txt
  250. // You can also build docs locally as HTML or other formats in site/
  251. // An online HTML version (which may be of a different version of Emscripten)
  252. // is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html
  253.  
  254. //========================================
  255. // Runtime code shared with compiler
  256. //========================================
  257.  
  258. var Runtime = {
  259. setTempRet0: function (value) {
  260. tempRet0 = value;
  261. },
  262. getTempRet0: function () {
  263. return tempRet0;
  264. },
  265. stackSave: function () {
  266. return STACKTOP;
  267. },
  268. stackRestore: function (stackTop) {
  269. STACKTOP = stackTop;
  270. },
  271. getNativeTypeSize: function (type) {
  272. switch (type) {
  273. case 'i1': case 'i8': return 1;
  274. case 'i16': return 2;
  275. case 'i32': return 4;
  276. case 'i64': return 8;
  277. case 'float': return 4;
  278. case 'double': return 8;
  279. default: {
  280. if (type[type.length-1] === '*') {
  281. return Runtime.QUANTUM_SIZE; // A pointer
  282. } else if (type[0] === 'i') {
  283. var bits = parseInt(type.substr(1));
  284. assert(bits % 8 === 0);
  285. return bits/8;
  286. } else {
  287. return 0;
  288. }
  289. }
  290. }
  291. },
  292. getNativeFieldSize: function (type) {
  293. return Math.max(Runtime.getNativeTypeSize(type), Runtime.QUANTUM_SIZE);
  294. },
  295. STACK_ALIGN: 16,
  296. prepVararg: function (ptr, type) {
  297. if (type === 'double' || type === 'i64') {
  298. // move so the load is aligned
  299. if (ptr & 7) {
  300. assert((ptr & 7) === 4);
  301. ptr += 4;
  302. }
  303. } else {
  304. assert((ptr & 3) === 0);
  305. }
  306. return ptr;
  307. },
  308. getAlignSize: function (type, size, vararg) {
  309. // we align i64s and doubles on 64-bit boundaries, unlike x86
  310. if (!vararg && (type == 'i64' || type == 'double')) return 8;
  311. if (!type) return Math.min(size, 8); // align structures internally to 64 bits
  312. return Math.min(size || (type ? Runtime.getNativeFieldSize(type) : 0), Runtime.QUANTUM_SIZE);
  313. },
  314. dynCall: function (sig, ptr, args) {
  315. if (args && args.length) {
  316. assert(args.length == sig.length-1);
  317. assert(('dynCall_' + sig) in Module, 'bad function pointer type - no table for sig \'' + sig + '\'');
  318. return Module['dynCall_' + sig].apply(null, [ptr].concat(args));
  319. } else {
  320. assert(sig.length == 1);
  321. assert(('dynCall_' + sig) in Module, 'bad function pointer type - no table for sig \'' + sig + '\'');
  322. return Module['dynCall_' + sig].call(null, ptr);
  323. }
  324. },
  325. functionPointers: [],
  326. addFunction: function (func) {
  327. for (var i = 0; i < Runtime.functionPointers.length; i++) {
  328. if (!Runtime.functionPointers[i]) {
  329. Runtime.functionPointers[i] = func;
  330. return 2*(1 + i);
  331. }
  332. }
  333. throw 'Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.';
  334. },
  335. removeFunction: function (index) {
  336. Runtime.functionPointers[(index-2)/2] = null;
  337. },
  338. warnOnce: function (text) {
  339. if (!Runtime.warnOnce.shown) Runtime.warnOnce.shown = {};
  340. if (!Runtime.warnOnce.shown[text]) {
  341. Runtime.warnOnce.shown[text] = 1;
  342. Module.printErr(text);
  343. }
  344. },
  345. funcWrappers: {},
  346. getFuncWrapper: function (func, sig) {
  347. assert(sig);
  348. if (!Runtime.funcWrappers[sig]) {
  349. Runtime.funcWrappers[sig] = {};
  350. }
  351. var sigCache = Runtime.funcWrappers[sig];
  352. if (!sigCache[func]) {
  353. // optimize away arguments usage in common cases
  354. if (sig.length === 1) {
  355. sigCache[func] = function dynCall_wrapper() {
  356. return Runtime.dynCall(sig, func);
  357. };
  358. } else if (sig.length === 2) {
  359. sigCache[func] = function dynCall_wrapper(arg) {
  360. return Runtime.dynCall(sig, func, [arg]);
  361. };
  362. } else {
  363. // general case
  364. sigCache[func] = function dynCall_wrapper() {
  365. return Runtime.dynCall(sig, func, Array.prototype.slice.call(arguments));
  366. };
  367. }
  368. }
  369. return sigCache[func];
  370. },
  371. getCompilerSetting: function (name) {
  372. throw 'You must build with -s RETAIN_COMPILER_SETTINGS=1 for Runtime.getCompilerSetting or emscripten_get_compiler_setting to work';
  373. },
  374. stackAlloc: function (size) { var ret = STACKTOP;STACKTOP = (STACKTOP + size)|0;STACKTOP = (((STACKTOP)+15)&-16);(assert((((STACKTOP|0) < (STACK_MAX|0))|0))|0); return ret; },
  375. staticAlloc: function (size) { var ret = STATICTOP;STATICTOP = (STATICTOP + (assert(!staticSealed),size))|0;STATICTOP = (((STATICTOP)+15)&-16); return ret; },
  376. dynamicAlloc: function (size) { assert(DYNAMICTOP_PTR);var ret = HEAP32[DYNAMICTOP_PTR>>2];var end = (((ret + size + 15)|0) & -16);HEAP32[DYNAMICTOP_PTR>>2] = end;if (end >= TOTAL_MEMORY) {var success = enlargeMemory();if (!success) {HEAP32[DYNAMICTOP_PTR>>2] = ret;return 0;}}return ret;},
  377. alignMemory: function (size,quantum) { var ret = size = Math.ceil((size)/(quantum ? quantum : 16))*(quantum ? quantum : 16); return ret; },
  378. makeBigInt: function (low,high,unsigned) { var ret = (unsigned ? ((+((low>>>0)))+((+((high>>>0)))*4294967296.0)) : ((+((low>>>0)))+((+((high|0)))*4294967296.0))); return ret; },
  379. GLOBAL_BASE: 8,
  380. QUANTUM_SIZE: 4,
  381. __dummy__: 0
  382. }
  383.  
  384.  
  385.  
  386. Module["Runtime"] = Runtime;
  387.  
  388.  
  389.  
  390. //========================================
  391. // Runtime essentials
  392. //========================================
  393.  
  394. var ABORT = 0; // whether we are quitting the application. no code should run after this. set in exit() and abort()
  395. var EXITSTATUS = 0;
  396.  
  397. function assert(condition, text) {
  398. if (!condition) {
  399. abort('Assertion failed: ' + text);
  400. }
  401. }
  402.  
  403. var globalScope = this;
  404.  
  405. // Returns the C function with a specified identifier (for C++, you need to do manual name mangling)
  406. function getCFunc(ident) {
  407. var func = Module['_' + ident]; // closure exported function
  408. if (!func) {
  409. try { func = eval('_' + ident); } catch(e) {}
  410. }
  411. assert(func, 'Cannot call unknown function ' + ident + ' (perhaps LLVM optimizations or closure removed it?)');
  412. return func;
  413. }
  414.  
  415. var cwrap, ccall;
  416. (function(){
  417. var JSfuncs = {
  418. // Helpers for cwrap -- it can't refer to Runtime directly because it might
  419. // be renamed by closure, instead it calls JSfuncs['stackSave'].body to find
  420. // out what the minified function name is.
  421. 'stackSave': function() {
  422. Runtime.stackSave()
  423. },
  424. 'stackRestore': function() {
  425. Runtime.stackRestore()
  426. },
  427. // type conversion from js to c
  428. 'arrayToC' : function(arr) {
  429. var ret = Runtime.stackAlloc(arr.length);
  430. writeArrayToMemory(arr, ret);
  431. return ret;
  432. },
  433. 'stringToC' : function(str) {
  434. var ret = 0;
  435. if (str !== null && str !== undefined && str !== 0) { // null string
  436. // at most 4 bytes per UTF-8 code point, +1 for the trailing '\0'
  437. var len = (str.length << 2) + 1;
  438. ret = Runtime.stackAlloc(len);
  439. stringToUTF8(str, ret, len);
  440. }
  441. return ret;
  442. }
  443. };
  444. // For fast lookup of conversion functions
  445. var toC = {'string' : JSfuncs['stringToC'], 'array' : JSfuncs['arrayToC']};
  446.  
  447. // C calling interface.
  448. ccall = function ccallFunc(ident, returnType, argTypes, args, opts) {
  449. var func = getCFunc(ident);
  450. var cArgs = [];
  451. var stack = 0;
  452. assert(returnType !== 'array', 'Return type should not be "array".');
  453. if (args) {
  454. for (var i = 0; i < args.length; i++) {
  455. var converter = toC[argTypes[i]];
  456. if (converter) {
  457. if (stack === 0) stack = Runtime.stackSave();
  458. cArgs[i] = converter(args[i]);
  459. } else {
  460. cArgs[i] = args[i];
  461. }
  462. }
  463. }
  464. var ret = func.apply(null, cArgs);
  465. if ((!opts || !opts.async) && typeof EmterpreterAsync === 'object') {
  466. assert(!EmterpreterAsync.state, 'cannot start async op with normal JS calling ccall');
  467. }
  468. if (opts && opts.async) assert(!returnType, 'async ccalls cannot return values');
  469. if (returnType === 'string') ret = Pointer_stringify(ret);
  470. if (stack !== 0) {
  471. if (opts && opts.async) {
  472. EmterpreterAsync.asyncFinalizers.push(function() {
  473. Runtime.stackRestore(stack);
  474. });
  475. return;
  476. }
  477. Runtime.stackRestore(stack);
  478. }
  479. return ret;
  480. }
  481.  
  482. var sourceRegex = /^function\s*[a-zA-Z$_0-9]*\s*\(([^)]*)\)\s*{\s*([^*]*?)[\s;]*(?:return\s*(.*?)[;\s]*)?}$/;
  483. function parseJSFunc(jsfunc) {
  484. // Match the body and the return value of a javascript function source
  485. var parsed = jsfunc.toString().match(sourceRegex).slice(1);
  486. return {arguments : parsed[0], body : parsed[1], returnValue: parsed[2]}
  487. }
  488.  
  489. // sources of useful functions. we create this lazily as it can trigger a source decompression on this entire file
  490. var JSsource = null;
  491. function ensureJSsource() {
  492. if (!JSsource) {
  493. JSsource = {};
  494. for (var fun in JSfuncs) {
  495. if (JSfuncs.hasOwnProperty(fun)) {
  496. // Elements of toCsource are arrays of three items:
  497. // the code, and the return value
  498. JSsource[fun] = parseJSFunc(JSfuncs[fun]);
  499. }
  500. }
  501. }
  502. }
  503.  
  504. cwrap = function cwrap(ident, returnType, argTypes) {
  505. argTypes = argTypes || [];
  506. var cfunc = getCFunc(ident);
  507. // When the function takes numbers and returns a number, we can just return
  508. // the original function
  509. var numericArgs = argTypes.every(function(type){ return type === 'number'});
  510. var numericRet = (returnType !== 'string');
  511. if ( numericRet && numericArgs) {
  512. return cfunc;
  513. }
  514. // Creation of the arguments list (["$1","$2",...,"$nargs"])
  515. var argNames = argTypes.map(function(x,i){return '$'+i});
  516. var funcstr = "(function(" + argNames.join(',') + ") {";
  517. var nargs = argTypes.length;
  518. if (!numericArgs) {
  519. // Generate the code needed to convert the arguments from javascript
  520. // values to pointers
  521. ensureJSsource();
  522. funcstr += 'var stack = ' + JSsource['stackSave'].body + ';';
  523. for (var i = 0; i < nargs; i++) {
  524. var arg = argNames[i], type = argTypes[i];
  525. if (type === 'number') continue;
  526. var convertCode = JSsource[type + 'ToC']; // [code, return]
  527. funcstr += 'var ' + convertCode.arguments + ' = ' + arg + ';';
  528. funcstr += convertCode.body + ';';
  529. funcstr += arg + '=(' + convertCode.returnValue + ');';
  530. }
  531. }
  532.  
  533. // When the code is compressed, the name of cfunc is not literally 'cfunc' anymore
  534. var cfuncname = parseJSFunc(function(){return cfunc}).returnValue;
  535. // Call the function
  536. funcstr += 'var ret = ' + cfuncname + '(' + argNames.join(',') + ');';
  537. if (!numericRet) { // Return type can only by 'string' or 'number'
  538. // Convert the result to a string
  539. var strgfy = parseJSFunc(function(){return Pointer_stringify}).returnValue;
  540. funcstr += 'ret = ' + strgfy + '(ret);';
  541. }
  542. funcstr += "if (typeof EmterpreterAsync === 'object') { assert(!EmterpreterAsync.state, 'cannot start async op with normal JS calling cwrap') }";
  543. if (!numericArgs) {
  544. // If we had a stack, restore it
  545. ensureJSsource();
  546. funcstr += JSsource['stackRestore'].body.replace('()', '(stack)') + ';';
  547. }
  548. funcstr += 'return ret})';
  549. return eval(funcstr);
  550. };
  551. })();
  552. Module["ccall"] = ccall;
  553. Module["cwrap"] = cwrap;
  554.  
  555. function setValue(ptr, value, type, noSafe) {
  556. type = type || 'i8';
  557. if (type.charAt(type.length-1) === '*') type = 'i32'; // pointers are 32-bit
  558. switch(type) {
  559. case 'i1': HEAP8[((ptr)>>0)]=value; break;
  560. case 'i8': HEAP8[((ptr)>>0)]=value; break;
  561. case 'i16': HEAP16[((ptr)>>1)]=value; break;
  562. case 'i32': HEAP32[((ptr)>>2)]=value; break;
  563. case 'i64': (tempI64 = [value>>>0,(tempDouble=value,(+(Math_abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? ((Math_min((+(Math_floor((tempDouble)/4294967296.0))), 4294967295.0))|0)>>>0 : (~~((+(Math_ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)],HEAP32[((ptr)>>2)]=tempI64[0],HEAP32[(((ptr)+(4))>>2)]=tempI64[1]); break;
  564. case 'float': HEAPF32[((ptr)>>2)]=value; break;
  565. case 'double': HEAPF64[((ptr)>>3)]=value; break;
  566. default: abort('invalid type for setValue: ' + type);
  567. }
  568. }
  569. Module["setValue"] = setValue;
  570.  
  571.  
  572. function getValue(ptr, type, noSafe) {
  573. type = type || 'i8';
  574. if (type.charAt(type.length-1) === '*') type = 'i32'; // pointers are 32-bit
  575. switch(type) {
  576. case 'i1': return HEAP8[((ptr)>>0)];
  577. case 'i8': return HEAP8[((ptr)>>0)];
  578. case 'i16': return HEAP16[((ptr)>>1)];
  579. case 'i32': return HEAP32[((ptr)>>2)];
  580. case 'i64': return HEAP32[((ptr)>>2)];
  581. case 'float': return HEAPF32[((ptr)>>2)];
  582. case 'double': return HEAPF64[((ptr)>>3)];
  583. default: abort('invalid type for setValue: ' + type);
  584. }
  585. return null;
  586. }
  587. Module["getValue"] = getValue;
  588.  
  589. var ALLOC_NORMAL = 0; // Tries to use _malloc()
  590. var ALLOC_STACK = 1; // Lives for the duration of the current function call
  591. var ALLOC_STATIC = 2; // Cannot be freed
  592. var ALLOC_DYNAMIC = 3; // Cannot be freed except through sbrk
  593. var ALLOC_NONE = 4; // Do not allocate
  594. Module["ALLOC_NORMAL"] = ALLOC_NORMAL;
  595. Module["ALLOC_STACK"] = ALLOC_STACK;
  596. Module["ALLOC_STATIC"] = ALLOC_STATIC;
  597. Module["ALLOC_DYNAMIC"] = ALLOC_DYNAMIC;
  598. Module["ALLOC_NONE"] = ALLOC_NONE;
  599.  
  600. // allocate(): This is for internal use. You can use it yourself as well, but the interface
  601. // is a little tricky (see docs right below). The reason is that it is optimized
  602. // for multiple syntaxes to save space in generated code. So you should
  603. // normally not use allocate(), and instead allocate memory using _malloc(),
  604. // initialize it with setValue(), and so forth.
  605. // @slab: An array of data, or a number. If a number, then the size of the block to allocate,
  606. // in *bytes* (note that this is sometimes confusing: the next parameter does not
  607. // affect this!)
  608. // @types: Either an array of types, one for each byte (or 0 if no type at that position),
  609. // or a single type which is used for the entire block. This only matters if there
  610. // is initial data - if @slab is a number, then this does not matter at all and is
  611. // ignored.
  612. // @allocator: How to allocate memory, see ALLOC_*
  613. function allocate(slab, types, allocator, ptr) {
  614. var zeroinit, size;
  615. if (typeof slab === 'number') {
  616. zeroinit = true;
  617. size = slab;
  618. } else {
  619. zeroinit = false;
  620. size = slab.length;
  621. }
  622.  
  623. var singleType = typeof types === 'string' ? types : null;
  624.  
  625. var ret;
  626. if (allocator == ALLOC_NONE) {
  627. ret = ptr;
  628. } else {
  629. ret = [typeof _malloc === 'function' ? _malloc : Runtime.staticAlloc, Runtime.stackAlloc, Runtime.staticAlloc, Runtime.dynamicAlloc][allocator === undefined ? ALLOC_STATIC : allocator](Math.max(size, singleType ? 1 : types.length));
  630. }
  631.  
  632. if (zeroinit) {
  633. var ptr = ret, stop;
  634. assert((ret & 3) == 0);
  635. stop = ret + (size & ~3);
  636. for (; ptr < stop; ptr += 4) {
  637. HEAP32[((ptr)>>2)]=0;
  638. }
  639. stop = ret + size;
  640. while (ptr < stop) {
  641. HEAP8[((ptr++)>>0)]=0;
  642. }
  643. return ret;
  644. }
  645.  
  646. if (singleType === 'i8') {
  647. if (slab.subarray || slab.slice) {
  648. HEAPU8.set(slab, ret);
  649. } else {
  650. HEAPU8.set(new Uint8Array(slab), ret);
  651. }
  652. return ret;
  653. }
  654.  
  655. var i = 0, type, typeSize, previousType;
  656. while (i < size) {
  657. var curr = slab[i];
  658.  
  659. if (typeof curr === 'function') {
  660. curr = Runtime.getFunctionIndex(curr);
  661. }
  662.  
  663. type = singleType || types[i];
  664. if (type === 0) {
  665. i++;
  666. continue;
  667. }
  668. assert(type, 'Must know what type to store in allocate!');
  669.  
  670. if (type == 'i64') type = 'i32'; // special case: we have one i32 here, and one i32 later
  671.  
  672. setValue(ret+i, curr, type);
  673.  
  674. // no need to look up size unless type changes, so cache it
  675. if (previousType !== type) {
  676. typeSize = Runtime.getNativeTypeSize(type);
  677. previousType = type;
  678. }
  679. i += typeSize;
  680. }
  681.  
  682. return ret;
  683. }
  684. Module["allocate"] = allocate;
  685.  
  686. // Allocate memory during any stage of startup - static memory early on, dynamic memory later, malloc when ready
  687. function getMemory(size) {
  688. if (!staticSealed) return Runtime.staticAlloc(size);
  689. if (!runtimeInitialized) return Runtime.dynamicAlloc(size);
  690. return _malloc(size);
  691. }
  692. Module["getMemory"] = getMemory;
  693.  
  694. function Pointer_stringify(ptr, /* optional */ length) {
  695. if (length === 0 || !ptr) return '';
  696. // TODO: use TextDecoder
  697. // Find the length, and check for UTF while doing so
  698. var hasUtf = 0;
  699. var t;
  700. var i = 0;
  701. while (1) {
  702. assert(ptr + i < TOTAL_MEMORY);
  703. t = HEAPU8[(((ptr)+(i))>>0)];
  704. hasUtf |= t;
  705. if (t == 0 && !length) break;
  706. i++;
  707. if (length && i == length) break;
  708. }
  709. if (!length) length = i;
  710.  
  711. var ret = '';
  712.  
  713. if (hasUtf < 128) {
  714. var MAX_CHUNK = 1024; // split up into chunks, because .apply on a huge string can overflow the stack
  715. var curr;
  716. while (length > 0) {
  717. curr = String.fromCharCode.apply(String, HEAPU8.subarray(ptr, ptr + Math.min(length, MAX_CHUNK)));
  718. ret = ret ? ret + curr : curr;
  719. ptr += MAX_CHUNK;
  720. length -= MAX_CHUNK;
  721. }
  722. return ret;
  723. }
  724. return Module['UTF8ToString'](ptr);
  725. }
  726. Module["Pointer_stringify"] = Pointer_stringify;
  727.  
  728. // Given a pointer 'ptr' to a null-terminated ASCII-encoded string in the emscripten HEAP, returns
  729. // a copy of that string as a Javascript String object.
  730.  
  731. function AsciiToString(ptr) {
  732. var str = '';
  733. while (1) {
  734. var ch = HEAP8[((ptr++)>>0)];
  735. if (!ch) return str;
  736. str += String.fromCharCode(ch);
  737. }
  738. }
  739. Module["AsciiToString"] = AsciiToString;
  740.  
  741. // Copies the given Javascript String object 'str' to the emscripten HEAP at address 'outPtr',
  742. // null-terminated and encoded in ASCII form. The copy will require at most str.length+1 bytes of space in the HEAP.
  743.  
  744. function stringToAscii(str, outPtr) {
  745. return writeAsciiToMemory(str, outPtr, false);
  746. }
  747. Module["stringToAscii"] = stringToAscii;
  748.  
  749. // Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the given array that contains uint8 values, returns
  750. // a copy of that string as a Javascript String object.
  751.  
  752. var UTF8Decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf8') : undefined;
  753. function UTF8ArrayToString(u8Array, idx) {
  754. var endPtr = idx;
  755. // TextDecoder needs to know the byte length in advance, it doesn't stop on null terminator by itself.
  756. // Also, use the length info to avoid running tiny strings through TextDecoder, since .subarray() allocates garbage.
  757. while (u8Array[endPtr]) ++endPtr;
  758.  
  759. if (endPtr - idx > 16 && u8Array.subarray && UTF8Decoder) {
  760. return UTF8Decoder.decode(u8Array.subarray(idx, endPtr));
  761. } else {
  762. var u0, u1, u2, u3, u4, u5;
  763.  
  764. var str = '';
  765. while (1) {
  766. // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description and https://www.ietf.org/rfc/rfc2279.txt and https://tools.ietf.org/html/rfc3629
  767. u0 = u8Array[idx++];
  768. if (!u0) return str;
  769. if (!(u0 & 0x80)) { str += String.fromCharCode(u0); continue; }
  770. u1 = u8Array[idx++] & 63;
  771. if ((u0 & 0xE0) == 0xC0) { str += String.fromCharCode(((u0 & 31) << 6) | u1); continue; }
  772. u2 = u8Array[idx++] & 63;
  773. if ((u0 & 0xF0) == 0xE0) {
  774. u0 = ((u0 & 15) << 12) | (u1 << 6) | u2;
  775. } else {
  776. u3 = u8Array[idx++] & 63;
  777. if ((u0 & 0xF8) == 0xF0) {
  778. u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | u3;
  779. } else {
  780. u4 = u8Array[idx++] & 63;
  781. if ((u0 & 0xFC) == 0xF8) {
  782. u0 = ((u0 & 3) << 24) | (u1 << 18) | (u2 << 12) | (u3 << 6) | u4;
  783. } else {
  784. u5 = u8Array[idx++] & 63;
  785. u0 = ((u0 & 1) << 30) | (u1 << 24) | (u2 << 18) | (u3 << 12) | (u4 << 6) | u5;
  786. }
  787. }
  788. }
  789. if (u0 < 0x10000) {
  790. str += String.fromCharCode(u0);
  791. } else {
  792. var ch = u0 - 0x10000;
  793. str += String.fromCharCode(0xD800 | (ch >> 10), 0xDC00 | (ch & 0x3FF));
  794. }
  795. }
  796. }
  797. }
  798. Module["UTF8ArrayToString"] = UTF8ArrayToString;
  799.  
  800. // Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the emscripten HEAP, returns
  801. // a copy of that string as a Javascript String object.
  802.  
  803. function UTF8ToString(ptr) {
  804. return UTF8ArrayToString(HEAPU8,ptr);
  805. }
  806. Module["UTF8ToString"] = UTF8ToString;
  807.  
  808. // Copies the given Javascript String object 'str' to the given byte array at address 'outIdx',
  809. // encoded in UTF8 form and null-terminated. The copy will require at most str.length*4+1 bytes of space in the HEAP.
  810. // Use the function lengthBytesUTF8 to compute the exact number of bytes (excluding null terminator) that this function will write.
  811. // Parameters:
  812. // str: the Javascript string to copy.
  813. // outU8Array: the array to copy to. Each index in this array is assumed to be one 8-byte element.
  814. // outIdx: The starting offset in the array to begin the copying.
  815. // maxBytesToWrite: The maximum number of bytes this function can write to the array. This count should include the null
  816. // terminator, i.e. if maxBytesToWrite=1, only the null terminator will be written and nothing else.
  817. // maxBytesToWrite=0 does not write any bytes to the output, not even the null terminator.
  818. // Returns the number of bytes written, EXCLUDING the null terminator.
  819.  
  820. function stringToUTF8Array(str, outU8Array, outIdx, maxBytesToWrite) {
  821. if (!(maxBytesToWrite > 0)) // Parameter maxBytesToWrite is not optional. Negative values, 0, null, undefined and false each don't write out any bytes.
  822. return 0;
  823.  
  824. var startIdx = outIdx;
  825. var endIdx = outIdx + maxBytesToWrite - 1; // -1 for string null terminator.
  826. for (var i = 0; i < str.length; ++i) {
  827. // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code unit, not a Unicode code point of the character! So decode UTF16->UTF32->UTF8.
  828. // See http://unicode.org/faq/utf_bom.html#utf16-3
  829. // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description and https://www.ietf.org/rfc/rfc2279.txt and https://tools.ietf.org/html/rfc3629
  830. var u = str.charCodeAt(i); // possibly a lead surrogate
  831. if (u >= 0xD800 && u <= 0xDFFF) u = 0x10000 + ((u & 0x3FF) << 10) | (str.charCodeAt(++i) & 0x3FF);
  832. if (u <= 0x7F) {
  833. if (outIdx >= endIdx) break;
  834. outU8Array[outIdx++] = u;
  835. } else if (u <= 0x7FF) {
  836. if (outIdx + 1 >= endIdx) break;
  837. outU8Array[outIdx++] = 0xC0 | (u >> 6);
  838. outU8Array[outIdx++] = 0x80 | (u & 63);
  839. } else if (u <= 0xFFFF) {
  840. if (outIdx + 2 >= endIdx) break;
  841. outU8Array[outIdx++] = 0xE0 | (u >> 12);
  842. outU8Array[outIdx++] = 0x80 | ((u >> 6) & 63);
  843. outU8Array[outIdx++] = 0x80 | (u & 63);
  844. } else if (u <= 0x1FFFFF) {
  845. if (outIdx + 3 >= endIdx) break;
  846. outU8Array[outIdx++] = 0xF0 | (u >> 18);
  847. outU8Array[outIdx++] = 0x80 | ((u >> 12) & 63);
  848. outU8Array[outIdx++] = 0x80 | ((u >> 6) & 63);
  849. outU8Array[outIdx++] = 0x80 | (u & 63);
  850. } else if (u <= 0x3FFFFFF) {
  851. if (outIdx + 4 >= endIdx) break;
  852. outU8Array[outIdx++] = 0xF8 | (u >> 24);
  853. outU8Array[outIdx++] = 0x80 | ((u >> 18) & 63);
  854. outU8Array[outIdx++] = 0x80 | ((u >> 12) & 63);
  855. outU8Array[outIdx++] = 0x80 | ((u >> 6) & 63);
  856. outU8Array[outIdx++] = 0x80 | (u & 63);
  857. } else {
  858. if (outIdx + 5 >= endIdx) break;
  859. outU8Array[outIdx++] = 0xFC | (u >> 30);
  860. outU8Array[outIdx++] = 0x80 | ((u >> 24) & 63);
  861. outU8Array[outIdx++] = 0x80 | ((u >> 18) & 63);
  862. outU8Array[outIdx++] = 0x80 | ((u >> 12) & 63);
  863. outU8Array[outIdx++] = 0x80 | ((u >> 6) & 63);
  864. outU8Array[outIdx++] = 0x80 | (u & 63);
  865. }
  866. }
  867. // Null-terminate the pointer to the buffer.
  868. outU8Array[outIdx] = 0;
  869. return outIdx - startIdx;
  870. }
  871. Module["stringToUTF8Array"] = stringToUTF8Array;
  872.  
  873. // Copies the given Javascript String object 'str' to the emscripten HEAP at address 'outPtr',
  874. // null-terminated and encoded in UTF8 form. The copy will require at most str.length*4+1 bytes of space in the HEAP.
  875. // Use the function lengthBytesUTF8 to compute the exact number of bytes (excluding null terminator) that this function will write.
  876. // Returns the number of bytes written, EXCLUDING the null terminator.
  877.  
  878. function stringToUTF8(str, outPtr, maxBytesToWrite) {
  879. assert(typeof maxBytesToWrite == 'number', 'stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!');
  880. return stringToUTF8Array(str, HEAPU8,outPtr, maxBytesToWrite);
  881. }
  882. Module["stringToUTF8"] = stringToUTF8;
  883.  
  884. // Returns the number of bytes the given Javascript string takes if encoded as a UTF8 byte array, EXCLUDING the null terminator byte.
  885.  
  886. function lengthBytesUTF8(str) {
  887. var len = 0;
  888. for (var i = 0; i < str.length; ++i) {
  889. // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code unit, not a Unicode code point of the character! So decode UTF16->UTF32->UTF8.
  890. // See http://unicode.org/faq/utf_bom.html#utf16-3
  891. var u = str.charCodeAt(i); // possibly a lead surrogate
  892. if (u >= 0xD800 && u <= 0xDFFF) u = 0x10000 + ((u & 0x3FF) << 10) | (str.charCodeAt(++i) & 0x3FF);
  893. if (u <= 0x7F) {
  894. ++len;
  895. } else if (u <= 0x7FF) {
  896. len += 2;
  897. } else if (u <= 0xFFFF) {
  898. len += 3;
  899. } else if (u <= 0x1FFFFF) {
  900. len += 4;
  901. } else if (u <= 0x3FFFFFF) {
  902. len += 5;
  903. } else {
  904. len += 6;
  905. }
  906. }
  907. return len;
  908. }
  909. Module["lengthBytesUTF8"] = lengthBytesUTF8;
  910.  
  911. // Given a pointer 'ptr' to a null-terminated UTF16LE-encoded string in the emscripten HEAP, returns
  912. // a copy of that string as a Javascript String object.
  913.  
  914. var UTF16Decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-16le') : undefined;
  915. function UTF16ToString(ptr) {
  916. assert(ptr % 2 == 0, 'Pointer passed to UTF16ToString must be aligned to two bytes!');
  917. var endPtr = ptr;
  918. // TextDecoder needs to know the byte length in advance, it doesn't stop on null terminator by itself.
  919. // Also, use the length info to avoid running tiny strings through TextDecoder, since .subarray() allocates garbage.
  920. var idx = endPtr >> 1;
  921. while (HEAP16[idx]) ++idx;
  922. endPtr = idx << 1;
  923.  
  924. if (endPtr - ptr > 32 && UTF16Decoder) {
  925. return UTF16Decoder.decode(HEAPU8.subarray(ptr, endPtr));
  926. } else {
  927. var i = 0;
  928.  
  929. var str = '';
  930. while (1) {
  931. var codeUnit = HEAP16[(((ptr)+(i*2))>>1)];
  932. if (codeUnit == 0) return str;
  933. ++i;
  934. // fromCharCode constructs a character from a UTF-16 code unit, so we can pass the UTF16 string right through.
  935. str += String.fromCharCode(codeUnit);
  936. }
  937. }
  938. }
  939.  
  940.  
  941. // Copies the given Javascript String object 'str' to the emscripten HEAP at address 'outPtr',
  942. // null-terminated and encoded in UTF16 form. The copy will require at most str.length*4+2 bytes of space in the HEAP.
  943. // Use the function lengthBytesUTF16() to compute the exact number of bytes (excluding null terminator) that this function will write.
  944. // Parameters:
  945. // str: the Javascript string to copy.
  946. // outPtr: Byte address in Emscripten HEAP where to write the string to.
  947. // maxBytesToWrite: The maximum number of bytes this function can write to the array. This count should include the null
  948. // terminator, i.e. if maxBytesToWrite=2, only the null terminator will be written and nothing else.
  949. // maxBytesToWrite<2 does not write any bytes to the output, not even the null terminator.
  950. // Returns the number of bytes written, EXCLUDING the null terminator.
  951.  
  952. function stringToUTF16(str, outPtr, maxBytesToWrite) {
  953. assert(outPtr % 2 == 0, 'Pointer passed to stringToUTF16 must be aligned to two bytes!');
  954. assert(typeof maxBytesToWrite == 'number', 'stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!');
  955. // Backwards compatibility: if max bytes is not specified, assume unsafe unbounded write is allowed.
  956. if (maxBytesToWrite === undefined) {
  957. maxBytesToWrite = 0x7FFFFFFF;
  958. }
  959. if (maxBytesToWrite < 2) return 0;
  960. maxBytesToWrite -= 2; // Null terminator.
  961. var startPtr = outPtr;
  962. var numCharsToWrite = (maxBytesToWrite < str.length*2) ? (maxBytesToWrite / 2) : str.length;
  963. for (var i = 0; i < numCharsToWrite; ++i) {
  964. // charCodeAt returns a UTF-16 encoded code unit, so it can be directly written to the HEAP.
  965. var codeUnit = str.charCodeAt(i); // possibly a lead surrogate
  966. HEAP16[((outPtr)>>1)]=codeUnit;
  967. outPtr += 2;
  968. }
  969. // Null-terminate the pointer to the HEAP.
  970. HEAP16[((outPtr)>>1)]=0;
  971. return outPtr - startPtr;
  972. }
  973.  
  974.  
  975. // Returns the number of bytes the given Javascript string takes if encoded as a UTF16 byte array, EXCLUDING the null terminator byte.
  976.  
  977. function lengthBytesUTF16(str) {
  978. return str.length*2;
  979. }
  980.  
  981.  
  982. function UTF32ToString(ptr) {
  983. assert(ptr % 4 == 0, 'Pointer passed to UTF32ToString must be aligned to four bytes!');
  984. var i = 0;
  985.  
  986. var str = '';
  987. while (1) {
  988. var utf32 = HEAP32[(((ptr)+(i*4))>>2)];
  989. if (utf32 == 0)
  990. return str;
  991. ++i;
  992. // Gotcha: fromCharCode constructs a character from a UTF-16 encoded code (pair), not from a Unicode code point! So encode the code point to UTF-16 for constructing.
  993. // See http://unicode.org/faq/utf_bom.html#utf16-3
  994. if (utf32 >= 0x10000) {
  995. var ch = utf32 - 0x10000;
  996. str += String.fromCharCode(0xD800 | (ch >> 10), 0xDC00 | (ch & 0x3FF));
  997. } else {
  998. str += String.fromCharCode(utf32);
  999. }
  1000. }
  1001. }
  1002.  
  1003.  
  1004. // Copies the given Javascript String object 'str' to the emscripten HEAP at address 'outPtr',
  1005. // null-terminated and encoded in UTF32 form. The copy will require at most str.length*4+4 bytes of space in the HEAP.
  1006. // Use the function lengthBytesUTF32() to compute the exact number of bytes (excluding null terminator) that this function will write.
  1007. // Parameters:
  1008. // str: the Javascript string to copy.
  1009. // outPtr: Byte address in Emscripten HEAP where to write the string to.
  1010. // maxBytesToWrite: The maximum number of bytes this function can write to the array. This count should include the null
  1011. // terminator, i.e. if maxBytesToWrite=4, only the null terminator will be written and nothing else.
  1012. // maxBytesToWrite<4 does not write any bytes to the output, not even the null terminator.
  1013. // Returns the number of bytes written, EXCLUDING the null terminator.
  1014.  
  1015. function stringToUTF32(str, outPtr, maxBytesToWrite) {
  1016. assert(outPtr % 4 == 0, 'Pointer passed to stringToUTF32 must be aligned to four bytes!');
  1017. assert(typeof maxBytesToWrite == 'number', 'stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!');
  1018. // Backwards compatibility: if max bytes is not specified, assume unsafe unbounded write is allowed.
  1019. if (maxBytesToWrite === undefined) {
  1020. maxBytesToWrite = 0x7FFFFFFF;
  1021. }
  1022. if (maxBytesToWrite < 4) return 0;
  1023. var startPtr = outPtr;
  1024. var endPtr = startPtr + maxBytesToWrite - 4;
  1025. for (var i = 0; i < str.length; ++i) {
  1026. // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code unit, not a Unicode code point of the character! We must decode the string to UTF-32 to the heap.
  1027. // See http://unicode.org/faq/utf_bom.html#utf16-3
  1028. var codeUnit = str.charCodeAt(i); // possibly a lead surrogate
  1029. if (codeUnit >= 0xD800 && codeUnit <= 0xDFFF) {
  1030. var trailSurrogate = str.charCodeAt(++i);
  1031. codeUnit = 0x10000 + ((codeUnit & 0x3FF) << 10) | (trailSurrogate & 0x3FF);
  1032. }
  1033. HEAP32[((outPtr)>>2)]=codeUnit;
  1034. outPtr += 4;
  1035. if (outPtr + 4 > endPtr) break;
  1036. }
  1037. // Null-terminate the pointer to the HEAP.
  1038. HEAP32[((outPtr)>>2)]=0;
  1039. return outPtr - startPtr;
  1040. }
  1041.  
  1042.  
  1043. // Returns the number of bytes the given Javascript string takes if encoded as a UTF16 byte array, EXCLUDING the null terminator byte.
  1044.  
  1045. function lengthBytesUTF32(str) {
  1046. var len = 0;
  1047. for (var i = 0; i < str.length; ++i) {
  1048. // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code unit, not a Unicode code point of the character! We must decode the string to UTF-32 to the heap.
  1049. // See http://unicode.org/faq/utf_bom.html#utf16-3
  1050. var codeUnit = str.charCodeAt(i);
  1051. if (codeUnit >= 0xD800 && codeUnit <= 0xDFFF) ++i; // possibly a lead surrogate, so skip over the tail surrogate.
  1052. len += 4;
  1053. }
  1054.  
  1055. return len;
  1056. }
  1057.  
  1058.  
  1059. function demangle(func) {
  1060. var hasLibcxxabi = !!Module['___cxa_demangle'];
  1061. if (hasLibcxxabi) {
  1062. try {
  1063. var s = func.substr(1);
  1064. var len = lengthBytesUTF8(s)+1;
  1065. var buf = _malloc(len);
  1066. stringToUTF8(s, buf, len);
  1067. var status = _malloc(4);
  1068. var ret = Module['___cxa_demangle'](buf, 0, 0, status);
  1069. if (getValue(status, 'i32') === 0 && ret) {
  1070. return Pointer_stringify(ret);
  1071. }
  1072. // otherwise, libcxxabi failed
  1073. } catch(e) {
  1074. // ignore problems here
  1075. } finally {
  1076. if (buf) _free(buf);
  1077. if (status) _free(status);
  1078. if (ret) _free(ret);
  1079. }
  1080. // failure when using libcxxabi, don't demangle
  1081. return func;
  1082. }
  1083. Runtime.warnOnce('warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling');
  1084. return func;
  1085. }
  1086.  
  1087. function demangleAll(text) {
  1088. return text.replace(/__Z[\w\d_]+/g, function(x) { var y = demangle(x); return x === y ? x : (x + ' [' + y + ']') });
  1089. }
  1090.  
  1091. function jsStackTrace() {
  1092. var err = new Error();
  1093. if (!err.stack) {
  1094. // IE10+ special cases: It does have callstack info, but it is only populated if an Error object is thrown,
  1095. // so try that as a special-case.
  1096. try {
  1097. throw new Error(0);
  1098. } catch(e) {
  1099. err = e;
  1100. }
  1101. if (!err.stack) {
  1102. return '(no stack trace available)';
  1103. }
  1104. }
  1105. return err.stack.toString();
  1106. }
  1107.  
  1108. function stackTrace() {
  1109. var js = jsStackTrace();
  1110. if (Module['extraStackTrace']) js += '\n' + Module['extraStackTrace']();
  1111. return demangleAll(js);
  1112. }
  1113. Module["stackTrace"] = stackTrace;
  1114.  
  1115. // Memory management
  1116.  
  1117. var PAGE_SIZE = 4096;
  1118.  
  1119. function alignMemoryPage(x) {
  1120. if (x % 4096 > 0) {
  1121. x += (4096 - (x % 4096));
  1122. }
  1123. return x;
  1124. }
  1125.  
  1126. var HEAP;
  1127. var buffer;
  1128. var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
  1129.  
  1130. function updateGlobalBuffer(buf) {
  1131. Module['buffer'] = buffer = buf;
  1132. }
  1133.  
  1134. function updateGlobalBufferViews() {
  1135. Module['HEAP8'] = HEAP8 = new Int8Array(buffer);
  1136. Module['HEAP16'] = HEAP16 = new Int16Array(buffer);
  1137. Module['HEAP32'] = HEAP32 = new Int32Array(buffer);
  1138. Module['HEAPU8'] = HEAPU8 = new Uint8Array(buffer);
  1139. Module['HEAPU16'] = HEAPU16 = new Uint16Array(buffer);
  1140. Module['HEAPU32'] = HEAPU32 = new Uint32Array(buffer);
  1141. Module['HEAPF32'] = HEAPF32 = new Float32Array(buffer);
  1142. Module['HEAPF64'] = HEAPF64 = new Float64Array(buffer);
  1143. }
  1144.  
  1145. var STATIC_BASE, STATICTOP, staticSealed; // static area
  1146. var STACK_BASE, STACKTOP, STACK_MAX; // stack area
  1147. var DYNAMIC_BASE, DYNAMICTOP_PTR; // dynamic area handled by sbrk
  1148.  
  1149. STATIC_BASE = STATICTOP = STACK_BASE = STACKTOP = STACK_MAX = DYNAMIC_BASE = DYNAMICTOP_PTR = 0;
  1150. staticSealed = false;
  1151.  
  1152.  
  1153. // Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode.
  1154. function writeStackCookie() {
  1155. assert((STACK_MAX & 3) == 0);
  1156. HEAPU32[(STACK_MAX >> 2)-1] = 0x02135467;
  1157. HEAPU32[(STACK_MAX >> 2)-2] = 0x89BACDFE;
  1158. }
  1159.  
  1160. function checkStackCookie() {
  1161. if (HEAPU32[(STACK_MAX >> 2)-1] != 0x02135467 || HEAPU32[(STACK_MAX >> 2)-2] != 0x89BACDFE) {
  1162. abort('Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x' + HEAPU32[(STACK_MAX >> 2)-2].toString(16) + ' ' + HEAPU32[(STACK_MAX >> 2)-1].toString(16));
  1163. }
  1164. // Also test the global address 0 for integrity. This check is not compatible with SAFE_SPLIT_MEMORY though, since that mode already tests all address 0 accesses on its own.
  1165. if (HEAP32[0] !== 0x63736d65 /* 'emsc' */) throw 'Runtime error: The application has corrupted its heap memory area (address zero)!';
  1166. }
  1167.  
  1168. function abortStackOverflow(allocSize) {
  1169. abort('Stack overflow! Attempted to allocate ' + allocSize + ' bytes on the stack, but stack has only ' + (STACK_MAX - asm.stackSave() + allocSize) + ' bytes available!');
  1170. }
  1171.  
  1172. function abortOnCannotGrowMemory() {
  1173. 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 -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ');
  1174. }
  1175.  
  1176.  
  1177. function enlargeMemory() {
  1178. abortOnCannotGrowMemory();
  1179. }
  1180.  
  1181.  
  1182. var TOTAL_STACK = Module['TOTAL_STACK'] || 5242880;
  1183. var TOTAL_MEMORY = Module['TOTAL_MEMORY'] || 16777216;
  1184.  
  1185. var WASM_PAGE_SIZE = 64 * 1024;
  1186.  
  1187. var totalMemory = WASM_PAGE_SIZE;
  1188. while (totalMemory < TOTAL_MEMORY || totalMemory < 2*TOTAL_STACK) {
  1189. if (totalMemory < 16*1024*1024) {
  1190. totalMemory *= 2;
  1191. } else {
  1192. totalMemory += 16*1024*1024;
  1193. }
  1194. }
  1195. if (totalMemory !== TOTAL_MEMORY) {
  1196. Module.printErr('increasing TOTAL_MEMORY to ' + totalMemory + ' to be compliant with the asm.js spec (and given that TOTAL_STACK=' + TOTAL_STACK + ')');
  1197. TOTAL_MEMORY = totalMemory;
  1198. }
  1199.  
  1200. // Initialize the runtime's memory
  1201. // check for full engine support (use string 'subarray' to avoid closure compiler confusion)
  1202. assert(typeof Int32Array !== 'undefined' && typeof Float64Array !== 'undefined' && !!(new Int32Array(1)['subarray']) && !!(new Int32Array(1)['set']),
  1203. 'JS engine does not provide full typed array support');
  1204.  
  1205.  
  1206.  
  1207. // Use a provided buffer, if there is one, or else allocate a new one
  1208. if (Module['buffer']) {
  1209. buffer = Module['buffer'];
  1210. assert(buffer.byteLength === TOTAL_MEMORY, 'provided buffer should be ' + TOTAL_MEMORY + ' bytes, but it is ' + buffer.byteLength);
  1211. } else {
  1212. // Use a WebAssembly memory where available
  1213. {
  1214. buffer = new ArrayBuffer(TOTAL_MEMORY);
  1215. }
  1216. assert(buffer.byteLength === TOTAL_MEMORY);
  1217. }
  1218. updateGlobalBufferViews();
  1219.  
  1220.  
  1221. function getTotalMemory() {
  1222. return TOTAL_MEMORY;
  1223. }
  1224.  
  1225. // Endianness check (note: assumes compiler arch was little-endian)
  1226. HEAP32[0] = 0x63736d65; /* 'emsc' */
  1227. HEAP16[1] = 0x6373;
  1228. if (HEAPU8[2] !== 0x73 || HEAPU8[3] !== 0x63) throw 'Runtime error: expected the system to be little-endian!';
  1229.  
  1230. Module['HEAP'] = HEAP;
  1231. Module['buffer'] = buffer;
  1232. Module['HEAP8'] = HEAP8;
  1233. Module['HEAP16'] = HEAP16;
  1234. Module['HEAP32'] = HEAP32;
  1235. Module['HEAPU8'] = HEAPU8;
  1236. Module['HEAPU16'] = HEAPU16;
  1237. Module['HEAPU32'] = HEAPU32;
  1238. Module['HEAPF32'] = HEAPF32;
  1239. Module['HEAPF64'] = HEAPF64;
  1240.  
  1241. function callRuntimeCallbacks(callbacks) {
  1242. while(callbacks.length > 0) {
  1243. var callback = callbacks.shift();
  1244. if (typeof callback == 'function') {
  1245. callback();
  1246. continue;
  1247. }
  1248. var func = callback.func;
  1249. if (typeof func === 'number') {
  1250. if (callback.arg === undefined) {
  1251. Runtime.dynCall('v', func);
  1252. } else {
  1253. Runtime.dynCall('vi', func, [callback.arg]);
  1254. }
  1255. } else {
  1256. func(callback.arg === undefined ? null : callback.arg);
  1257. }
  1258. }
  1259. }
  1260.  
  1261. var __ATPRERUN__ = []; // functions called before the runtime is initialized
  1262. var __ATINIT__ = []; // functions called during startup
  1263. var __ATMAIN__ = []; // functions called when main() is to be run
  1264. var __ATEXIT__ = []; // functions called during shutdown
  1265. var __ATPOSTRUN__ = []; // functions called after the runtime has exited
  1266.  
  1267. var runtimeInitialized = false;
  1268. var runtimeExited = false;
  1269.  
  1270.  
  1271. function preRun() {
  1272. // compatibility - merge in anything from Module['preRun'] at this time
  1273. if (Module['preRun']) {
  1274. if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']];
  1275. while (Module['preRun'].length) {
  1276. addOnPreRun(Module['preRun'].shift());
  1277. }
  1278. }
  1279. callRuntimeCallbacks(__ATPRERUN__);
  1280. }
  1281.  
  1282. function ensureInitRuntime() {
  1283. checkStackCookie();
  1284. if (runtimeInitialized) return;
  1285. runtimeInitialized = true;
  1286. callRuntimeCallbacks(__ATINIT__);
  1287. }
  1288.  
  1289. function preMain() {
  1290. checkStackCookie();
  1291. callRuntimeCallbacks(__ATMAIN__);
  1292. }
  1293.  
  1294. function exitRuntime() {
  1295. checkStackCookie();
  1296. callRuntimeCallbacks(__ATEXIT__);
  1297. runtimeExited = true;
  1298. }
  1299.  
  1300. function postRun() {
  1301. checkStackCookie();
  1302. // compatibility - merge in anything from Module['postRun'] at this time
  1303. if (Module['postRun']) {
  1304. if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']];
  1305. while (Module['postRun'].length) {
  1306. addOnPostRun(Module['postRun'].shift());
  1307. }
  1308. }
  1309. callRuntimeCallbacks(__ATPOSTRUN__);
  1310. }
  1311.  
  1312. function addOnPreRun(cb) {
  1313. __ATPRERUN__.unshift(cb);
  1314. }
  1315. Module["addOnPreRun"] = addOnPreRun;
  1316.  
  1317. function addOnInit(cb) {
  1318. __ATINIT__.unshift(cb);
  1319. }
  1320. Module["addOnInit"] = addOnInit;
  1321.  
  1322. function addOnPreMain(cb) {
  1323. __ATMAIN__.unshift(cb);
  1324. }
  1325. Module["addOnPreMain"] = addOnPreMain;
  1326.  
  1327. function addOnExit(cb) {
  1328. __ATEXIT__.unshift(cb);
  1329. }
  1330. Module["addOnExit"] = addOnExit;
  1331.  
  1332. function addOnPostRun(cb) {
  1333. __ATPOSTRUN__.unshift(cb);
  1334. }
  1335. Module["addOnPostRun"] = addOnPostRun;
  1336.  
  1337. // Tools
  1338.  
  1339.  
  1340. function intArrayFromString(stringy, dontAddNull, length /* optional */) {
  1341. var len = length > 0 ? length : lengthBytesUTF8(stringy)+1;
  1342. var u8array = new Array(len);
  1343. var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length);
  1344. if (dontAddNull) u8array.length = numBytesWritten;
  1345. return u8array;
  1346. }
  1347. Module["intArrayFromString"] = intArrayFromString;
  1348.  
  1349. function intArrayToString(array) {
  1350. var ret = [];
  1351. for (var i = 0; i < array.length; i++) {
  1352. var chr = array[i];
  1353. if (chr > 0xFF) {
  1354. assert(false, 'Character code ' + chr + ' (' + String.fromCharCode(chr) + ') at offset ' + i + ' not in 0x00-0xFF.');
  1355. chr &= 0xFF;
  1356. }
  1357. ret.push(String.fromCharCode(chr));
  1358. }
  1359. return ret.join('');
  1360. }
  1361. Module["intArrayToString"] = intArrayToString;
  1362.  
  1363. // Deprecated: This function should not be called because it is unsafe and does not provide
  1364. // a maximum length limit of how many bytes it is allowed to write. Prefer calling the
  1365. // function stringToUTF8Array() instead, which takes in a maximum length that can be used
  1366. // to be secure from out of bounds writes.
  1367. function writeStringToMemory(string, buffer, dontAddNull) {
  1368. Runtime.warnOnce('writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!');
  1369.  
  1370. var lastChar, end;
  1371. if (dontAddNull) {
  1372. // stringToUTF8Array always appends null. If we don't want to do that, remember the
  1373. // character that existed at the location where the null will be placed, and restore
  1374. // that after the write (below).
  1375. end = buffer + lengthBytesUTF8(string);
  1376. lastChar = HEAP8[end];
  1377. }
  1378. stringToUTF8(string, buffer, Infinity);
  1379. if (dontAddNull) HEAP8[end] = lastChar; // Restore the value under the null character.
  1380. }
  1381. Module["writeStringToMemory"] = writeStringToMemory;
  1382.  
  1383. function writeArrayToMemory(array, buffer) {
  1384. assert(array.length >= 0, 'writeArrayToMemory array must have a length (should be an array or typed array)')
  1385. HEAP8.set(array, buffer);
  1386. }
  1387. Module["writeArrayToMemory"] = writeArrayToMemory;
  1388.  
  1389. function writeAsciiToMemory(str, buffer, dontAddNull) {
  1390. for (var i = 0; i < str.length; ++i) {
  1391. assert(str.charCodeAt(i) === str.charCodeAt(i)&0xff);
  1392. HEAP8[((buffer++)>>0)]=str.charCodeAt(i);
  1393. }
  1394. // Null-terminate the pointer to the HEAP.
  1395. if (!dontAddNull) HEAP8[((buffer)>>0)]=0;
  1396. }
  1397. Module["writeAsciiToMemory"] = writeAsciiToMemory;
  1398.  
  1399. function unSign(value, bits, ignore) {
  1400. if (value >= 0) {
  1401. return value;
  1402. }
  1403. return bits <= 32 ? 2*Math.abs(1 << (bits-1)) + value // Need some trickery, since if bits == 32, we are right at the limit of the bits JS uses in bitshifts
  1404. : Math.pow(2, bits) + value;
  1405. }
  1406. function reSign(value, bits, ignore) {
  1407. if (value <= 0) {
  1408. return value;
  1409. }
  1410. var half = bits <= 32 ? Math.abs(1 << (bits-1)) // abs is needed if bits == 32
  1411. : Math.pow(2, bits-1);
  1412. if (value >= half && (bits <= 32 || value > half)) { // for huge values, we can hit the precision limit and always get true here. so don't do that
  1413. // but, in general there is no perfect solution here. With 64-bit ints, we get rounding and errors
  1414. // TODO: In i64 mode 1, resign the two parts separately and safely
  1415. value = -2*half + value; // Cannot bitshift half, as it may be at the limit of the bits JS uses in bitshifts
  1416. }
  1417. return value;
  1418. }
  1419.  
  1420.  
  1421. // check for imul support, and also for correctness ( https://bugs.webkit.org/show_bug.cgi?id=126345 )
  1422. if (!Math['imul'] || Math['imul'](0xffffffff, 5) !== -5) Math['imul'] = function imul(a, b) {
  1423. var ah = a >>> 16;
  1424. var al = a & 0xffff;
  1425. var bh = b >>> 16;
  1426. var bl = b & 0xffff;
  1427. return (al*bl + ((ah*bl + al*bh) << 16))|0;
  1428. };
  1429. Math.imul = Math['imul'];
  1430.  
  1431.  
  1432. if (!Math['clz32']) Math['clz32'] = function(x) {
  1433. x = x >>> 0;
  1434. for (var i = 0; i < 32; i++) {
  1435. if (x & (1 << (31 - i))) return i;
  1436. }
  1437. return 32;
  1438. };
  1439. Math.clz32 = Math['clz32']
  1440.  
  1441. if (!Math['trunc']) Math['trunc'] = function(x) {
  1442. return x < 0 ? Math.ceil(x) : Math.floor(x);
  1443. };
  1444. Math.trunc = Math['trunc'];
  1445.  
  1446. var Math_abs = Math.abs;
  1447. var Math_cos = Math.cos;
  1448. var Math_sin = Math.sin;
  1449. var Math_tan = Math.tan;
  1450. var Math_acos = Math.acos;
  1451. var Math_asin = Math.asin;
  1452. var Math_atan = Math.atan;
  1453. var Math_atan2 = Math.atan2;
  1454. var Math_exp = Math.exp;
  1455. var Math_log = Math.log;
  1456. var Math_sqrt = Math.sqrt;
  1457. var Math_ceil = Math.ceil;
  1458. var Math_floor = Math.floor;
  1459. var Math_pow = Math.pow;
  1460. var Math_imul = Math.imul;
  1461. var Math_fround = Math.fround;
  1462. var Math_round = Math.round;
  1463. var Math_min = Math.min;
  1464. var Math_clz32 = Math.clz32;
  1465. var Math_trunc = Math.trunc;
  1466.  
  1467. // A counter of dependencies for calling run(). If we need to
  1468. // do asynchronous work before running, increment this and
  1469. // decrement it. Incrementing must happen in a place like
  1470. // PRE_RUN_ADDITIONS (used by emcc to add file preloading).
  1471. // Note that you can add dependencies in preRun, even though
  1472. // it happens right before run - run will be postponed until
  1473. // the dependencies are met.
  1474. var runDependencies = 0;
  1475. var runDependencyWatcher = null;
  1476. var dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled
  1477. var runDependencyTracking = {};
  1478.  
  1479. function getUniqueRunDependency(id) {
  1480. var orig = id;
  1481. while (1) {
  1482. if (!runDependencyTracking[id]) return id;
  1483. id = orig + Math.random();
  1484. }
  1485. return id;
  1486. }
  1487.  
  1488. function addRunDependency(id) {
  1489. runDependencies++;
  1490. if (Module['monitorRunDependencies']) {
  1491. Module['monitorRunDependencies'](runDependencies);
  1492. }
  1493. if (id) {
  1494. assert(!runDependencyTracking[id]);
  1495. runDependencyTracking[id] = 1;
  1496. if (runDependencyWatcher === null && typeof setInterval !== 'undefined') {
  1497. // Check for missing dependencies every few seconds
  1498. runDependencyWatcher = setInterval(function() {
  1499. if (ABORT) {
  1500. clearInterval(runDependencyWatcher);
  1501. runDependencyWatcher = null;
  1502. return;
  1503. }
  1504. var shown = false;
  1505. for (var dep in runDependencyTracking) {
  1506. if (!shown) {
  1507. shown = true;
  1508. Module.printErr('still waiting on run dependencies:');
  1509. }
  1510. Module.printErr('dependency: ' + dep);
  1511. }
  1512. if (shown) {
  1513. Module.printErr('(end of list)');
  1514. }
  1515. }, 10000);
  1516. }
  1517. } else {
  1518. Module.printErr('warning: run dependency added without ID');
  1519. }
  1520. }
  1521. Module["addRunDependency"] = addRunDependency;
  1522.  
  1523. function removeRunDependency(id) {
  1524. runDependencies--;
  1525. if (Module['monitorRunDependencies']) {
  1526. Module['monitorRunDependencies'](runDependencies);
  1527. }
  1528. if (id) {
  1529. assert(runDependencyTracking[id]);
  1530. delete runDependencyTracking[id];
  1531. } else {
  1532. Module.printErr('warning: run dependency removed without ID');
  1533. }
  1534. if (runDependencies == 0) {
  1535. if (runDependencyWatcher !== null) {
  1536. clearInterval(runDependencyWatcher);
  1537. runDependencyWatcher = null;
  1538. }
  1539. if (dependenciesFulfilled) {
  1540. var callback = dependenciesFulfilled;
  1541. dependenciesFulfilled = null;
  1542. callback(); // can add another dependenciesFulfilled
  1543. }
  1544. }
  1545. }
  1546. Module["removeRunDependency"] = removeRunDependency;
  1547.  
  1548. Module["preloadedImages"] = {}; // maps url to image data
  1549. Module["preloadedAudios"] = {}; // maps url to audio data
  1550.  
  1551.  
  1552.  
  1553. var memoryInitializer = null;
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559. // === Body ===
  1560.  
  1561. var ASM_CONSTS = [];
  1562.  
  1563.  
  1564.  
  1565.  
  1566. STATIC_BASE = 8;
  1567.  
  1568. STATICTOP = STATIC_BASE + 4320;
  1569. /* global initializers */ __ATINIT__.push();
  1570.  
  1571.  
  1572. /* memory initializer */ allocate([12,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,208,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,3,0,0,0,216,12,0,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,100,105,101,100,32,105,110,32,37,115,58,32,37,117,10,0,109,97,105,110,0,99,104,97,114,32,97,116,32,37,112,58,32,37,48,50,120,10,0,17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,46,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116,32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0], "i8", ALLOC_NONE, Runtime.GLOBAL_BASE);
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578. /* no memory initializer */
  1579. var tempDoublePtr = STATICTOP; STATICTOP += 16;
  1580.  
  1581. assert(tempDoublePtr % 8 == 0);
  1582.  
  1583. function copyTempFloat(ptr) { // functions, because inlining this code increases code size too much
  1584.  
  1585. HEAP8[tempDoublePtr] = HEAP8[ptr];
  1586.  
  1587. HEAP8[tempDoublePtr+1] = HEAP8[ptr+1];
  1588.  
  1589. HEAP8[tempDoublePtr+2] = HEAP8[ptr+2];
  1590.  
  1591. HEAP8[tempDoublePtr+3] = HEAP8[ptr+3];
  1592.  
  1593. }
  1594.  
  1595. function copyTempDouble(ptr) {
  1596.  
  1597. HEAP8[tempDoublePtr] = HEAP8[ptr];
  1598.  
  1599. HEAP8[tempDoublePtr+1] = HEAP8[ptr+1];
  1600.  
  1601. HEAP8[tempDoublePtr+2] = HEAP8[ptr+2];
  1602.  
  1603. HEAP8[tempDoublePtr+3] = HEAP8[ptr+3];
  1604.  
  1605. HEAP8[tempDoublePtr+4] = HEAP8[ptr+4];
  1606.  
  1607. HEAP8[tempDoublePtr+5] = HEAP8[ptr+5];
  1608.  
  1609. HEAP8[tempDoublePtr+6] = HEAP8[ptr+6];
  1610.  
  1611. HEAP8[tempDoublePtr+7] = HEAP8[ptr+7];
  1612.  
  1613. }
  1614.  
  1615. // {{PRE_LIBRARY}}
  1616.  
  1617.  
  1618.  
  1619. Module["_i64Subtract"] = _i64Subtract;
  1620.  
  1621.  
  1622. Module["_i64Add"] = _i64Add;
  1623.  
  1624.  
  1625. Module["_memset"] = _memset;
  1626.  
  1627. function _pthread_cleanup_push(routine, arg) {
  1628. __ATEXIT__.push(function() { Runtime.dynCall('vi', routine, [arg]) })
  1629. _pthread_cleanup_push.level = __ATEXIT__.length;
  1630. }
  1631.  
  1632.  
  1633. Module["_bitshift64Lshr"] = _bitshift64Lshr;
  1634.  
  1635.  
  1636.  
  1637.  
  1638. 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};
  1639.  
  1640. var ERRNO_MESSAGES={0:"Success",1:"Not super-user",2:"No such file or directory",3:"No such process",4:"Interrupted system call",5:"I/O error",6:"No such device or address",7:"Arg list too long",8:"Exec format error",9:"Bad file number",10:"No children",11:"No more processes",12:"Not enough core",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Mount device busy",17:"File exists",18:"Cross-device link",19:"No such device",20:"Not a directory",21:"Is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",25:"Not a typewriter",26:"Text file busy",27:"File too large",28:"No space left on device",29:"Illegal seek",30:"Read only file system",31:"Too many links",32:"Broken pipe",33:"Math arg out of domain of func",34:"Math result not representable",35:"File locking deadlock error",36:"File or path name too long",37:"No record locks available",38:"Function not implemented",39:"Directory not empty",40:"Too many symbolic links",42:"No message of desired type",43:"Identifier removed",44:"Channel number out of range",45:"Level 2 not synchronized",46:"Level 3 halted",47:"Level 3 reset",48:"Link number out of range",49:"Protocol driver not attached",50:"No CSI structure available",51:"Level 2 halted",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",57:"Invalid slot",59:"Bad font file fmt",60:"Device not a stream",61:"No data (for no delay io)",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",65:"Package not installed",66:"The object is remote",67:"The link has been severed",68:"Advertise error",69:"Srmount error",70:"Communication error on send",71:"Protocol error",72:"Multihop attempted",73:"Cross mount point (not really error)",74:"Trying to read unreadable message",75:"Value too large for defined data type",76:"Given log. name not unique",77:"f.d. invalid for this operation",78:"Remote address changed",79:"Can access a needed shared lib",80:"Accessing a corrupted shared lib",81:".lib section in a.out corrupted",82:"Attempting to link in too many libs",83:"Attempting to exec a shared library",84:"Illegal byte sequence",86:"Streams pipe error",87:"Too many users",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Unknown protocol",94:"Socket type not supported",95:"Not supported",96:"Protocol family not supported",97:"Address family not supported by protocol family",98:"Address already in use",99:"Address not available",100:"Network interface is not configured",101:"Network is unreachable",102:"Connection reset by network",103:"Connection aborted",104:"Connection reset by peer",105:"No buffer space available",106:"Socket is already connected",107:"Socket is not connected",108:"Can't send after socket shutdown",109:"Too many references",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"Host is unreachable",114:"Socket already connected",115:"Connection already in progress",116:"Stale file handle",122:"Quota exceeded",123:"No medium (in tape drive)",125:"Operation canceled",130:"Previous owner died",131:"State not recoverable"};
  1641.  
  1642. function ___setErrNo(value) {
  1643. if (Module['___errno_location']) HEAP32[((Module['___errno_location']())>>2)]=value;
  1644. else Module.printErr('failed to set errno from JS');
  1645. return value;
  1646. }
  1647.  
  1648. var PATH={splitPath:function (filename) {
  1649. var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
  1650. return splitPathRe.exec(filename).slice(1);
  1651. },normalizeArray:function (parts, allowAboveRoot) {
  1652. // if the path tries to go above the root, `up` ends up > 0
  1653. var up = 0;
  1654. for (var i = parts.length - 1; i >= 0; i--) {
  1655. var last = parts[i];
  1656. if (last === '.') {
  1657. parts.splice(i, 1);
  1658. } else if (last === '..') {
  1659. parts.splice(i, 1);
  1660. up++;
  1661. } else if (up) {
  1662. parts.splice(i, 1);
  1663. up--;
  1664. }
  1665. }
  1666. // if the path is allowed to go above the root, restore leading ..s
  1667. if (allowAboveRoot) {
  1668. for (; up--; up) {
  1669. parts.unshift('..');
  1670. }
  1671. }
  1672. return parts;
  1673. },normalize:function (path) {
  1674. var isAbsolute = path.charAt(0) === '/',
  1675. trailingSlash = path.substr(-1) === '/';
  1676. // Normalize the path
  1677. path = PATH.normalizeArray(path.split('/').filter(function(p) {
  1678. return !!p;
  1679. }), !isAbsolute).join('/');
  1680. if (!path && !isAbsolute) {
  1681. path = '.';
  1682. }
  1683. if (path && trailingSlash) {
  1684. path += '/';
  1685. }
  1686. return (isAbsolute ? '/' : '') + path;
  1687. },dirname:function (path) {
  1688. var result = PATH.splitPath(path),
  1689. root = result[0],
  1690. dir = result[1];
  1691. if (!root && !dir) {
  1692. // No dirname whatsoever
  1693. return '.';
  1694. }
  1695. if (dir) {
  1696. // It has a dirname, strip trailing slash
  1697. dir = dir.substr(0, dir.length - 1);
  1698. }
  1699. return root + dir;
  1700. },basename:function (path) {
  1701. // EMSCRIPTEN return '/'' for '/', not an empty string
  1702. if (path === '/') return '/';
  1703. var lastSlash = path.lastIndexOf('/');
  1704. if (lastSlash === -1) return path;
  1705. return path.substr(lastSlash+1);
  1706. },extname:function (path) {
  1707. return PATH.splitPath(path)[3];
  1708. },join:function () {
  1709. var paths = Array.prototype.slice.call(arguments, 0);
  1710. return PATH.normalize(paths.join('/'));
  1711. },join2:function (l, r) {
  1712. return PATH.normalize(l + '/' + r);
  1713. },resolve:function () {
  1714. var resolvedPath = '',
  1715. resolvedAbsolute = false;
  1716. for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
  1717. var path = (i >= 0) ? arguments[i] : FS.cwd();
  1718. // Skip empty and invalid entries
  1719. if (typeof path !== 'string') {
  1720. throw new TypeError('Arguments to path.resolve must be strings');
  1721. } else if (!path) {
  1722. return ''; // an invalid portion invalidates the whole thing
  1723. }
  1724. resolvedPath = path + '/' + resolvedPath;
  1725. resolvedAbsolute = path.charAt(0) === '/';
  1726. }
  1727. // At this point the path should be resolved to a full absolute path, but
  1728. // handle relative paths to be safe (might happen when process.cwd() fails)
  1729. resolvedPath = PATH.normalizeArray(resolvedPath.split('/').filter(function(p) {
  1730. return !!p;
  1731. }), !resolvedAbsolute).join('/');
  1732. return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
  1733. },relative:function (from, to) {
  1734. from = PATH.resolve(from).substr(1);
  1735. to = PATH.resolve(to).substr(1);
  1736. function trim(arr) {
  1737. var start = 0;
  1738. for (; start < arr.length; start++) {
  1739. if (arr[start] !== '') break;
  1740. }
  1741. var end = arr.length - 1;
  1742. for (; end >= 0; end--) {
  1743. if (arr[end] !== '') break;
  1744. }
  1745. if (start > end) return [];
  1746. return arr.slice(start, end - start + 1);
  1747. }
  1748. var fromParts = trim(from.split('/'));
  1749. var toParts = trim(to.split('/'));
  1750. var length = Math.min(fromParts.length, toParts.length);
  1751. var samePartsLength = length;
  1752. for (var i = 0; i < length; i++) {
  1753. if (fromParts[i] !== toParts[i]) {
  1754. samePartsLength = i;
  1755. break;
  1756. }
  1757. }
  1758. var outputParts = [];
  1759. for (var i = samePartsLength; i < fromParts.length; i++) {
  1760. outputParts.push('..');
  1761. }
  1762. outputParts = outputParts.concat(toParts.slice(samePartsLength));
  1763. return outputParts.join('/');
  1764. }};
  1765.  
  1766. var TTY={ttys:[],init:function () {
  1767. // https://github.com/kripken/emscripten/pull/1555
  1768. // if (ENVIRONMENT_IS_NODE) {
  1769. // // currently, FS.init does not distinguish if process.stdin is a file or TTY
  1770. // // device, it always assumes it's a TTY device. because of this, we're forcing
  1771. // // process.stdin to UTF8 encoding to at least make stdin reading compatible
  1772. // // with text files until FS.init can be refactored.
  1773. // process['stdin']['setEncoding']('utf8');
  1774. // }
  1775. },shutdown:function () {
  1776. // https://github.com/kripken/emscripten/pull/1555
  1777. // if (ENVIRONMENT_IS_NODE) {
  1778. // // inolen: any idea as to why node -e 'process.stdin.read()' wouldn't exit immediately (with process.stdin being a tty)?
  1779. // // isaacs: because now it's reading from the stream, you've expressed interest in it, so that read() kicks off a _read() which creates a ReadReq operation
  1780. // // inolen: I thought read() in that case was a synchronous operation that just grabbed some amount of buffered data if it exists?
  1781. // // isaacs: it is. but it also triggers a _read() call, which calls readStart() on the handle
  1782. // // isaacs: do process.stdin.pause() and i'd think it'd probably close the pending call
  1783. // process['stdin']['pause']();
  1784. // }
  1785. },register:function (dev, ops) {
  1786. TTY.ttys[dev] = { input: [], output: [], ops: ops };
  1787. FS.registerDevice(dev, TTY.stream_ops);
  1788. },stream_ops:{open:function (stream) {
  1789. var tty = TTY.ttys[stream.node.rdev];
  1790. if (!tty) {
  1791. throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
  1792. }
  1793. stream.tty = tty;
  1794. stream.seekable = false;
  1795. },close:function (stream) {
  1796. // flush any pending line data
  1797. stream.tty.ops.flush(stream.tty);
  1798. },flush:function (stream) {
  1799. stream.tty.ops.flush(stream.tty);
  1800. },read:function (stream, buffer, offset, length, pos /* ignored */) {
  1801. if (!stream.tty || !stream.tty.ops.get_char) {
  1802. throw new FS.ErrnoError(ERRNO_CODES.ENXIO);
  1803. }
  1804. var bytesRead = 0;
  1805. for (var i = 0; i < length; i++) {
  1806. var result;
  1807. try {
  1808. result = stream.tty.ops.get_char(stream.tty);
  1809. } catch (e) {
  1810. throw new FS.ErrnoError(ERRNO_CODES.EIO);
  1811. }
  1812. if (result === undefined && bytesRead === 0) {
  1813. throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
  1814. }
  1815. if (result === null || result === undefined) break;
  1816. bytesRead++;
  1817. buffer[offset+i] = result;
  1818. }
  1819. if (bytesRead) {
  1820. stream.node.timestamp = Date.now();
  1821. }
  1822. return bytesRead;
  1823. },write:function (stream, buffer, offset, length, pos) {
  1824. if (!stream.tty || !stream.tty.ops.put_char) {
  1825. throw new FS.ErrnoError(ERRNO_CODES.ENXIO);
  1826. }
  1827. for (var i = 0; i < length; i++) {
  1828. try {
  1829. stream.tty.ops.put_char(stream.tty, buffer[offset+i]);
  1830. } catch (e) {
  1831. throw new FS.ErrnoError(ERRNO_CODES.EIO);
  1832. }
  1833. }
  1834. if (length) {
  1835. stream.node.timestamp = Date.now();
  1836. }
  1837. return i;
  1838. }},default_tty_ops:{get_char:function (tty) {
  1839. if (!tty.input.length) {
  1840. var result = null;
  1841. if (ENVIRONMENT_IS_NODE) {
  1842. // we will read data by chunks of BUFSIZE
  1843. var BUFSIZE = 256;
  1844. var buf = new Buffer(BUFSIZE);
  1845. var bytesRead = 0;
  1846.  
  1847. var isPosixPlatform = (process.platform != 'win32'); // Node doesn't offer a direct check, so test by exclusion
  1848.  
  1849. var fd = process.stdin.fd;
  1850. if (isPosixPlatform) {
  1851. // Linux and Mac cannot use process.stdin.fd (which isn't set up as sync)
  1852. var usingDevice = false;
  1853. try {
  1854. fd = fs.openSync('/dev/stdin', 'r');
  1855. usingDevice = true;
  1856. } catch (e) {}
  1857. }
  1858.  
  1859. try {
  1860. bytesRead = fs.readSync(fd, buf, 0, BUFSIZE, null);
  1861. } catch(e) {
  1862. // Cross-platform differences: on Windows, reading EOF throws an exception, but on other OSes,
  1863. // reading EOF returns 0. Uniformize behavior by treating the EOF exception to return 0.
  1864. if (e.toString().indexOf('EOF') != -1) bytesRead = 0;
  1865. else throw e;
  1866. }
  1867.  
  1868. if (usingDevice) { fs.closeSync(fd); }
  1869. if (bytesRead > 0) {
  1870. result = buf.slice(0, bytesRead).toString('utf-8');
  1871. } else {
  1872. result = null;
  1873. }
  1874.  
  1875. } else if (typeof window != 'undefined' &&
  1876. typeof window.prompt == 'function') {
  1877. // Browser.
  1878. result = window.prompt('Input: '); // returns null on cancel
  1879. if (result !== null) {
  1880. result += '\n';
  1881. }
  1882. } else if (typeof readline == 'function') {
  1883. // Command line.
  1884. result = readline();
  1885. if (result !== null) {
  1886. result += '\n';
  1887. }
  1888. }
  1889. if (!result) {
  1890. return null;
  1891. }
  1892. tty.input = intArrayFromString(result, true);
  1893. }
  1894. return tty.input.shift();
  1895. },put_char:function (tty, val) {
  1896. if (val === null || val === 10) {
  1897. Module['print'](UTF8ArrayToString(tty.output, 0));
  1898. tty.output = [];
  1899. } else {
  1900. if (val != 0) tty.output.push(val); // val == 0 would cut text output off in the middle.
  1901. }
  1902. },flush:function (tty) {
  1903. if (tty.output && tty.output.length > 0) {
  1904. Module['print'](UTF8ArrayToString(tty.output, 0));
  1905. tty.output = [];
  1906. }
  1907. }},default_tty1_ops:{put_char:function (tty, val) {
  1908. if (val === null || val === 10) {
  1909. Module['printErr'](UTF8ArrayToString(tty.output, 0));
  1910. tty.output = [];
  1911. } else {
  1912. if (val != 0) tty.output.push(val);
  1913. }
  1914. },flush:function (tty) {
  1915. if (tty.output && tty.output.length > 0) {
  1916. Module['printErr'](UTF8ArrayToString(tty.output, 0));
  1917. tty.output = [];
  1918. }
  1919. }}};
  1920.  
  1921. var MEMFS={ops_table:null,mount:function (mount) {
  1922. return MEMFS.createNode(null, '/', 16384 | 511 /* 0777 */, 0);
  1923. },createNode:function (parent, name, mode, dev) {
  1924. if (FS.isBlkdev(mode) || FS.isFIFO(mode)) {
  1925. // no supported
  1926. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  1927. }
  1928. if (!MEMFS.ops_table) {
  1929. MEMFS.ops_table = {
  1930. dir: {
  1931. node: {
  1932. getattr: MEMFS.node_ops.getattr,
  1933. setattr: MEMFS.node_ops.setattr,
  1934. lookup: MEMFS.node_ops.lookup,
  1935. mknod: MEMFS.node_ops.mknod,
  1936. rename: MEMFS.node_ops.rename,
  1937. unlink: MEMFS.node_ops.unlink,
  1938. rmdir: MEMFS.node_ops.rmdir,
  1939. readdir: MEMFS.node_ops.readdir,
  1940. symlink: MEMFS.node_ops.symlink
  1941. },
  1942. stream: {
  1943. llseek: MEMFS.stream_ops.llseek
  1944. }
  1945. },
  1946. file: {
  1947. node: {
  1948. getattr: MEMFS.node_ops.getattr,
  1949. setattr: MEMFS.node_ops.setattr
  1950. },
  1951. stream: {
  1952. llseek: MEMFS.stream_ops.llseek,
  1953. read: MEMFS.stream_ops.read,
  1954. write: MEMFS.stream_ops.write,
  1955. allocate: MEMFS.stream_ops.allocate,
  1956. mmap: MEMFS.stream_ops.mmap,
  1957. msync: MEMFS.stream_ops.msync
  1958. }
  1959. },
  1960. link: {
  1961. node: {
  1962. getattr: MEMFS.node_ops.getattr,
  1963. setattr: MEMFS.node_ops.setattr,
  1964. readlink: MEMFS.node_ops.readlink
  1965. },
  1966. stream: {}
  1967. },
  1968. chrdev: {
  1969. node: {
  1970. getattr: MEMFS.node_ops.getattr,
  1971. setattr: MEMFS.node_ops.setattr
  1972. },
  1973. stream: FS.chrdev_stream_ops
  1974. }
  1975. };
  1976. }
  1977. var node = FS.createNode(parent, name, mode, dev);
  1978. if (FS.isDir(node.mode)) {
  1979. node.node_ops = MEMFS.ops_table.dir.node;
  1980. node.stream_ops = MEMFS.ops_table.dir.stream;
  1981. node.contents = {};
  1982. } else if (FS.isFile(node.mode)) {
  1983. node.node_ops = MEMFS.ops_table.file.node;
  1984. node.stream_ops = MEMFS.ops_table.file.stream;
  1985. node.usedBytes = 0; // The actual number of bytes used in the typed array, as opposed to contents.length which gives the whole capacity.
  1986. // When the byte data of the file is populated, this will point to either a typed array, or a normal JS array. Typed arrays are preferred
  1987. // for performance, and used by default. However, typed arrays are not resizable like normal JS arrays are, so there is a small disk size
  1988. // penalty involved for appending file writes that continuously grow a file similar to std::vector capacity vs used -scheme.
  1989. node.contents = null;
  1990. } else if (FS.isLink(node.mode)) {
  1991. node.node_ops = MEMFS.ops_table.link.node;
  1992. node.stream_ops = MEMFS.ops_table.link.stream;
  1993. } else if (FS.isChrdev(node.mode)) {
  1994. node.node_ops = MEMFS.ops_table.chrdev.node;
  1995. node.stream_ops = MEMFS.ops_table.chrdev.stream;
  1996. }
  1997. node.timestamp = Date.now();
  1998. // add the new node to the parent
  1999. if (parent) {
  2000. parent.contents[name] = node;
  2001. }
  2002. return node;
  2003. },getFileDataAsRegularArray:function (node) {
  2004. if (node.contents && node.contents.subarray) {
  2005. var arr = [];
  2006. for (var i = 0; i < node.usedBytes; ++i) arr.push(node.contents[i]);
  2007. return arr; // Returns a copy of the original data.
  2008. }
  2009. return node.contents; // No-op, the file contents are already in a JS array. Return as-is.
  2010. },getFileDataAsTypedArray:function (node) {
  2011. if (!node.contents) return new Uint8Array;
  2012. if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes); // Make sure to not return excess unused bytes.
  2013. return new Uint8Array(node.contents);
  2014. },expandFileStorage:function (node, newCapacity) {
  2015. // If we are asked to expand the size of a file that already exists, revert to using a standard JS array to store the file
  2016. // instead of a typed array. This makes resizing the array more flexible because we can just .push() elements at the back to
  2017. // increase the size.
  2018. if (node.contents && node.contents.subarray && newCapacity > node.contents.length) {
  2019. node.contents = MEMFS.getFileDataAsRegularArray(node);
  2020. node.usedBytes = node.contents.length; // We might be writing to a lazy-loaded file which had overridden this property, so force-reset it.
  2021. }
  2022.  
  2023. if (!node.contents || node.contents.subarray) { // Keep using a typed array if creating a new storage, or if old one was a typed array as well.
  2024. var prevCapacity = node.contents ? node.contents.length : 0;
  2025. if (prevCapacity >= newCapacity) return; // No need to expand, the storage was already large enough.
  2026. // Don't expand strictly to the given requested limit if it's only a very small increase, but instead geometrically grow capacity.
  2027. // For small filesizes (<1MB), perform size*2 geometric increase, but for large sizes, do a much more conservative size*1.125 increase to
  2028. // avoid overshooting the allocation cap by a very large margin.
  2029. var CAPACITY_DOUBLING_MAX = 1024 * 1024;
  2030. newCapacity = Math.max(newCapacity, (prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2.0 : 1.125)) | 0);
  2031. if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); // At minimum allocate 256b for each file when expanding.
  2032. var oldContents = node.contents;
  2033. node.contents = new Uint8Array(newCapacity); // Allocate new storage.
  2034. if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0); // Copy old data over to the new storage.
  2035. return;
  2036. }
  2037. // Not using a typed array to back the file storage. Use a standard JS array instead.
  2038. if (!node.contents && newCapacity > 0) node.contents = [];
  2039. while (node.contents.length < newCapacity) node.contents.push(0);
  2040. },resizeFileStorage:function (node, newSize) {
  2041. if (node.usedBytes == newSize) return;
  2042. if (newSize == 0) {
  2043. node.contents = null; // Fully decommit when requesting a resize to zero.
  2044. node.usedBytes = 0;
  2045. return;
  2046. }
  2047. if (!node.contents || node.contents.subarray) { // Resize a typed array if that is being used as the backing store.
  2048. var oldContents = node.contents;
  2049. node.contents = new Uint8Array(new ArrayBuffer(newSize)); // Allocate new storage.
  2050. if (oldContents) {
  2051. node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes))); // Copy old data over to the new storage.
  2052. }
  2053. node.usedBytes = newSize;
  2054. return;
  2055. }
  2056. // Backing with a JS array.
  2057. if (!node.contents) node.contents = [];
  2058. if (node.contents.length > newSize) node.contents.length = newSize;
  2059. else while (node.contents.length < newSize) node.contents.push(0);
  2060. node.usedBytes = newSize;
  2061. },node_ops:{getattr:function (node) {
  2062. var attr = {};
  2063. // device numbers reuse inode numbers.
  2064. attr.dev = FS.isChrdev(node.mode) ? node.id : 1;
  2065. attr.ino = node.id;
  2066. attr.mode = node.mode;
  2067. attr.nlink = 1;
  2068. attr.uid = 0;
  2069. attr.gid = 0;
  2070. attr.rdev = node.rdev;
  2071. if (FS.isDir(node.mode)) {
  2072. attr.size = 4096;
  2073. } else if (FS.isFile(node.mode)) {
  2074. attr.size = node.usedBytes;
  2075. } else if (FS.isLink(node.mode)) {
  2076. attr.size = node.link.length;
  2077. } else {
  2078. attr.size = 0;
  2079. }
  2080. attr.atime = new Date(node.timestamp);
  2081. attr.mtime = new Date(node.timestamp);
  2082. attr.ctime = new Date(node.timestamp);
  2083. // NOTE: In our implementation, st_blocks = Math.ceil(st_size/st_blksize),
  2084. // but this is not required by the standard.
  2085. attr.blksize = 4096;
  2086. attr.blocks = Math.ceil(attr.size / attr.blksize);
  2087. return attr;
  2088. },setattr:function (node, attr) {
  2089. if (attr.mode !== undefined) {
  2090. node.mode = attr.mode;
  2091. }
  2092. if (attr.timestamp !== undefined) {
  2093. node.timestamp = attr.timestamp;
  2094. }
  2095. if (attr.size !== undefined) {
  2096. MEMFS.resizeFileStorage(node, attr.size);
  2097. }
  2098. },lookup:function (parent, name) {
  2099. throw FS.genericErrors[ERRNO_CODES.ENOENT];
  2100. },mknod:function (parent, name, mode, dev) {
  2101. return MEMFS.createNode(parent, name, mode, dev);
  2102. },rename:function (old_node, new_dir, new_name) {
  2103. // if we're overwriting a directory at new_name, make sure it's empty.
  2104. if (FS.isDir(old_node.mode)) {
  2105. var new_node;
  2106. try {
  2107. new_node = FS.lookupNode(new_dir, new_name);
  2108. } catch (e) {
  2109. }
  2110. if (new_node) {
  2111. for (var i in new_node.contents) {
  2112. throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
  2113. }
  2114. }
  2115. }
  2116. // do the internal rewiring
  2117. delete old_node.parent.contents[old_node.name];
  2118. old_node.name = new_name;
  2119. new_dir.contents[new_name] = old_node;
  2120. old_node.parent = new_dir;
  2121. },unlink:function (parent, name) {
  2122. delete parent.contents[name];
  2123. },rmdir:function (parent, name) {
  2124. var node = FS.lookupNode(parent, name);
  2125. for (var i in node.contents) {
  2126. throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
  2127. }
  2128. delete parent.contents[name];
  2129. },readdir:function (node) {
  2130. var entries = ['.', '..']
  2131. for (var key in node.contents) {
  2132. if (!node.contents.hasOwnProperty(key)) {
  2133. continue;
  2134. }
  2135. entries.push(key);
  2136. }
  2137. return entries;
  2138. },symlink:function (parent, newname, oldpath) {
  2139. var node = MEMFS.createNode(parent, newname, 511 /* 0777 */ | 40960, 0);
  2140. node.link = oldpath;
  2141. return node;
  2142. },readlink:function (node) {
  2143. if (!FS.isLink(node.mode)) {
  2144. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2145. }
  2146. return node.link;
  2147. }},stream_ops:{read:function (stream, buffer, offset, length, position) {
  2148. var contents = stream.node.contents;
  2149. if (position >= stream.node.usedBytes) return 0;
  2150. var size = Math.min(stream.node.usedBytes - position, length);
  2151. assert(size >= 0);
  2152. if (size > 8 && contents.subarray) { // non-trivial, and typed array
  2153. buffer.set(contents.subarray(position, position + size), offset);
  2154. } else {
  2155. for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i];
  2156. }
  2157. return size;
  2158. },write:function (stream, buffer, offset, length, position, canOwn) {
  2159. if (!length) return 0;
  2160. var node = stream.node;
  2161. node.timestamp = Date.now();
  2162.  
  2163. if (buffer.subarray && (!node.contents || node.contents.subarray)) { // This write is from a typed array to a typed array?
  2164. if (canOwn) {
  2165. assert(position === 0, 'canOwn must imply no weird position inside the file');
  2166. node.contents = buffer.subarray(offset, offset + length);
  2167. node.usedBytes = length;
  2168. return length;
  2169. } else if (node.usedBytes === 0 && position === 0) { // If this is a simple first write to an empty file, do a fast set since we don't need to care about old data.
  2170. node.contents = new Uint8Array(buffer.subarray(offset, offset + length));
  2171. node.usedBytes = length;
  2172. return length;
  2173. } else if (position + length <= node.usedBytes) { // Writing to an already allocated and used subrange of the file?
  2174. node.contents.set(buffer.subarray(offset, offset + length), position);
  2175. return length;
  2176. }
  2177. }
  2178.  
  2179. // Appending to an existing file and we need to reallocate, or source data did not come as a typed array.
  2180. MEMFS.expandFileStorage(node, position+length);
  2181. if (node.contents.subarray && buffer.subarray) node.contents.set(buffer.subarray(offset, offset + length), position); // Use typed array write if available.
  2182. else {
  2183. for (var i = 0; i < length; i++) {
  2184. node.contents[position + i] = buffer[offset + i]; // Or fall back to manual write if not.
  2185. }
  2186. }
  2187. node.usedBytes = Math.max(node.usedBytes, position+length);
  2188. return length;
  2189. },llseek:function (stream, offset, whence) {
  2190. var position = offset;
  2191. if (whence === 1) { // SEEK_CUR.
  2192. position += stream.position;
  2193. } else if (whence === 2) { // SEEK_END.
  2194. if (FS.isFile(stream.node.mode)) {
  2195. position += stream.node.usedBytes;
  2196. }
  2197. }
  2198. if (position < 0) {
  2199. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2200. }
  2201. return position;
  2202. },allocate:function (stream, offset, length) {
  2203. MEMFS.expandFileStorage(stream.node, offset + length);
  2204. stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length);
  2205. },mmap:function (stream, buffer, offset, length, position, prot, flags) {
  2206. if (!FS.isFile(stream.node.mode)) {
  2207. throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
  2208. }
  2209. var ptr;
  2210. var allocated;
  2211. var contents = stream.node.contents;
  2212. // Only make a new copy when MAP_PRIVATE is specified.
  2213. if ( !(flags & 2) &&
  2214. (contents.buffer === buffer || contents.buffer === buffer.buffer) ) {
  2215. // We can't emulate MAP_SHARED when the file is not backed by the buffer
  2216. // we're mapping to (e.g. the HEAP buffer).
  2217. allocated = false;
  2218. ptr = contents.byteOffset;
  2219. } else {
  2220. // Try to avoid unnecessary slices.
  2221. if (position > 0 || position + length < stream.node.usedBytes) {
  2222. if (contents.subarray) {
  2223. contents = contents.subarray(position, position + length);
  2224. } else {
  2225. contents = Array.prototype.slice.call(contents, position, position + length);
  2226. }
  2227. }
  2228. allocated = true;
  2229. ptr = _malloc(length);
  2230. if (!ptr) {
  2231. throw new FS.ErrnoError(ERRNO_CODES.ENOMEM);
  2232. }
  2233. buffer.set(contents, ptr);
  2234. }
  2235. return { ptr: ptr, allocated: allocated };
  2236. },msync:function (stream, buffer, offset, length, mmapFlags) {
  2237. if (!FS.isFile(stream.node.mode)) {
  2238. throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
  2239. }
  2240. if (mmapFlags & 2) {
  2241. // MAP_PRIVATE calls need not to be synced back to underlying fs
  2242. return 0;
  2243. }
  2244.  
  2245. var bytesWritten = MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false);
  2246. // should we check if bytesWritten and length are the same?
  2247. return 0;
  2248. }}};
  2249.  
  2250. var IDBFS={dbs:{},indexedDB:function () {
  2251. if (typeof indexedDB !== 'undefined') return indexedDB;
  2252. var ret = null;
  2253. if (typeof window === 'object') ret = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
  2254. assert(ret, 'IDBFS used, but indexedDB not supported');
  2255. return ret;
  2256. },DB_VERSION:21,DB_STORE_NAME:"FILE_DATA",mount:function (mount) {
  2257. // reuse all of the core MEMFS functionality
  2258. return MEMFS.mount.apply(null, arguments);
  2259. },syncfs:function (mount, populate, callback) {
  2260. IDBFS.getLocalSet(mount, function(err, local) {
  2261. if (err) return callback(err);
  2262.  
  2263. IDBFS.getRemoteSet(mount, function(err, remote) {
  2264. if (err) return callback(err);
  2265.  
  2266. var src = populate ? remote : local;
  2267. var dst = populate ? local : remote;
  2268.  
  2269. IDBFS.reconcile(src, dst, callback);
  2270. });
  2271. });
  2272. },getDB:function (name, callback) {
  2273. // check the cache first
  2274. var db = IDBFS.dbs[name];
  2275. if (db) {
  2276. return callback(null, db);
  2277. }
  2278.  
  2279. var req;
  2280. try {
  2281. req = IDBFS.indexedDB().open(name, IDBFS.DB_VERSION);
  2282. } catch (e) {
  2283. return callback(e);
  2284. }
  2285. if (!req) {
  2286. return callback("Unable to connect to IndexedDB");
  2287. }
  2288. req.onupgradeneeded = function(e) {
  2289. var db = e.target.result;
  2290. var transaction = e.target.transaction;
  2291.  
  2292. var fileStore;
  2293.  
  2294. if (db.objectStoreNames.contains(IDBFS.DB_STORE_NAME)) {
  2295. fileStore = transaction.objectStore(IDBFS.DB_STORE_NAME);
  2296. } else {
  2297. fileStore = db.createObjectStore(IDBFS.DB_STORE_NAME);
  2298. }
  2299.  
  2300. if (!fileStore.indexNames.contains('timestamp')) {
  2301. fileStore.createIndex('timestamp', 'timestamp', { unique: false });
  2302. }
  2303. };
  2304. req.onsuccess = function() {
  2305. db = req.result;
  2306.  
  2307. // add to the cache
  2308. IDBFS.dbs[name] = db;
  2309. callback(null, db);
  2310. };
  2311. req.onerror = function(e) {
  2312. callback(this.error);
  2313. e.preventDefault();
  2314. };
  2315. },getLocalSet:function (mount, callback) {
  2316. var entries = {};
  2317.  
  2318. function isRealDir(p) {
  2319. return p !== '.' && p !== '..';
  2320. };
  2321. function toAbsolute(root) {
  2322. return function(p) {
  2323. return PATH.join2(root, p);
  2324. }
  2325. };
  2326.  
  2327. var check = FS.readdir(mount.mountpoint).filter(isRealDir).map(toAbsolute(mount.mountpoint));
  2328.  
  2329. while (check.length) {
  2330. var path = check.pop();
  2331. var stat;
  2332.  
  2333. try {
  2334. stat = FS.stat(path);
  2335. } catch (e) {
  2336. return callback(e);
  2337. }
  2338.  
  2339. if (FS.isDir(stat.mode)) {
  2340. check.push.apply(check, FS.readdir(path).filter(isRealDir).map(toAbsolute(path)));
  2341. }
  2342.  
  2343. entries[path] = { timestamp: stat.mtime };
  2344. }
  2345.  
  2346. return callback(null, { type: 'local', entries: entries });
  2347. },getRemoteSet:function (mount, callback) {
  2348. var entries = {};
  2349.  
  2350. IDBFS.getDB(mount.mountpoint, function(err, db) {
  2351. if (err) return callback(err);
  2352.  
  2353. var transaction = db.transaction([IDBFS.DB_STORE_NAME], 'readonly');
  2354. transaction.onerror = function(e) {
  2355. callback(this.error);
  2356. e.preventDefault();
  2357. };
  2358.  
  2359. var store = transaction.objectStore(IDBFS.DB_STORE_NAME);
  2360. var index = store.index('timestamp');
  2361.  
  2362. index.openKeyCursor().onsuccess = function(event) {
  2363. var cursor = event.target.result;
  2364.  
  2365. if (!cursor) {
  2366. return callback(null, { type: 'remote', db: db, entries: entries });
  2367. }
  2368.  
  2369. entries[cursor.primaryKey] = { timestamp: cursor.key };
  2370.  
  2371. cursor.continue();
  2372. };
  2373. });
  2374. },loadLocalEntry:function (path, callback) {
  2375. var stat, node;
  2376.  
  2377. try {
  2378. var lookup = FS.lookupPath(path);
  2379. node = lookup.node;
  2380. stat = FS.stat(path);
  2381. } catch (e) {
  2382. return callback(e);
  2383. }
  2384.  
  2385. if (FS.isDir(stat.mode)) {
  2386. return callback(null, { timestamp: stat.mtime, mode: stat.mode });
  2387. } else if (FS.isFile(stat.mode)) {
  2388. // Performance consideration: storing a normal JavaScript array to a IndexedDB is much slower than storing a typed array.
  2389. // Therefore always convert the file contents to a typed array first before writing the data to IndexedDB.
  2390. node.contents = MEMFS.getFileDataAsTypedArray(node);
  2391. return callback(null, { timestamp: stat.mtime, mode: stat.mode, contents: node.contents });
  2392. } else {
  2393. return callback(new Error('node type not supported'));
  2394. }
  2395. },storeLocalEntry:function (path, entry, callback) {
  2396. try {
  2397. if (FS.isDir(entry.mode)) {
  2398. FS.mkdir(path, entry.mode);
  2399. } else if (FS.isFile(entry.mode)) {
  2400. FS.writeFile(path, entry.contents, { encoding: 'binary', canOwn: true });
  2401. } else {
  2402. return callback(new Error('node type not supported'));
  2403. }
  2404.  
  2405. FS.chmod(path, entry.mode);
  2406. FS.utime(path, entry.timestamp, entry.timestamp);
  2407. } catch (e) {
  2408. return callback(e);
  2409. }
  2410.  
  2411. callback(null);
  2412. },removeLocalEntry:function (path, callback) {
  2413. try {
  2414. var lookup = FS.lookupPath(path);
  2415. var stat = FS.stat(path);
  2416.  
  2417. if (FS.isDir(stat.mode)) {
  2418. FS.rmdir(path);
  2419. } else if (FS.isFile(stat.mode)) {
  2420. FS.unlink(path);
  2421. }
  2422. } catch (e) {
  2423. return callback(e);
  2424. }
  2425.  
  2426. callback(null);
  2427. },loadRemoteEntry:function (store, path, callback) {
  2428. var req = store.get(path);
  2429. req.onsuccess = function(event) { callback(null, event.target.result); };
  2430. req.onerror = function(e) {
  2431. callback(this.error);
  2432. e.preventDefault();
  2433. };
  2434. },storeRemoteEntry:function (store, path, entry, callback) {
  2435. var req = store.put(entry, path);
  2436. req.onsuccess = function() { callback(null); };
  2437. req.onerror = function(e) {
  2438. callback(this.error);
  2439. e.preventDefault();
  2440. };
  2441. },removeRemoteEntry:function (store, path, callback) {
  2442. var req = store.delete(path);
  2443. req.onsuccess = function() { callback(null); };
  2444. req.onerror = function(e) {
  2445. callback(this.error);
  2446. e.preventDefault();
  2447. };
  2448. },reconcile:function (src, dst, callback) {
  2449. var total = 0;
  2450.  
  2451. var create = [];
  2452. Object.keys(src.entries).forEach(function (key) {
  2453. var e = src.entries[key];
  2454. var e2 = dst.entries[key];
  2455. if (!e2 || e.timestamp > e2.timestamp) {
  2456. create.push(key);
  2457. total++;
  2458. }
  2459. });
  2460.  
  2461. var remove = [];
  2462. Object.keys(dst.entries).forEach(function (key) {
  2463. var e = dst.entries[key];
  2464. var e2 = src.entries[key];
  2465. if (!e2) {
  2466. remove.push(key);
  2467. total++;
  2468. }
  2469. });
  2470.  
  2471. if (!total) {
  2472. return callback(null);
  2473. }
  2474.  
  2475. var errored = false;
  2476. var completed = 0;
  2477. var db = src.type === 'remote' ? src.db : dst.db;
  2478. var transaction = db.transaction([IDBFS.DB_STORE_NAME], 'readwrite');
  2479. var store = transaction.objectStore(IDBFS.DB_STORE_NAME);
  2480.  
  2481. function done(err) {
  2482. if (err) {
  2483. if (!done.errored) {
  2484. done.errored = true;
  2485. return callback(err);
  2486. }
  2487. return;
  2488. }
  2489. if (++completed >= total) {
  2490. return callback(null);
  2491. }
  2492. };
  2493.  
  2494. transaction.onerror = function(e) {
  2495. done(this.error);
  2496. e.preventDefault();
  2497. };
  2498.  
  2499. // sort paths in ascending order so directory entries are created
  2500. // before the files inside them
  2501. create.sort().forEach(function (path) {
  2502. if (dst.type === 'local') {
  2503. IDBFS.loadRemoteEntry(store, path, function (err, entry) {
  2504. if (err) return done(err);
  2505. IDBFS.storeLocalEntry(path, entry, done);
  2506. });
  2507. } else {
  2508. IDBFS.loadLocalEntry(path, function (err, entry) {
  2509. if (err) return done(err);
  2510. IDBFS.storeRemoteEntry(store, path, entry, done);
  2511. });
  2512. }
  2513. });
  2514.  
  2515. // sort paths in descending order so files are deleted before their
  2516. // parent directories
  2517. remove.sort().reverse().forEach(function(path) {
  2518. if (dst.type === 'local') {
  2519. IDBFS.removeLocalEntry(path, done);
  2520. } else {
  2521. IDBFS.removeRemoteEntry(store, path, done);
  2522. }
  2523. });
  2524. }};
  2525.  
  2526. var NODEFS={isWindows:false,staticInit:function () {
  2527. NODEFS.isWindows = !!process.platform.match(/^win/);
  2528. },mount:function (mount) {
  2529. assert(ENVIRONMENT_IS_NODE);
  2530. return NODEFS.createNode(null, '/', NODEFS.getMode(mount.opts.root), 0);
  2531. },createNode:function (parent, name, mode, dev) {
  2532. if (!FS.isDir(mode) && !FS.isFile(mode) && !FS.isLink(mode)) {
  2533. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2534. }
  2535. var node = FS.createNode(parent, name, mode);
  2536. node.node_ops = NODEFS.node_ops;
  2537. node.stream_ops = NODEFS.stream_ops;
  2538. return node;
  2539. },getMode:function (path) {
  2540. var stat;
  2541. try {
  2542. stat = fs.lstatSync(path);
  2543. if (NODEFS.isWindows) {
  2544. // On Windows, directories return permission bits 'rw-rw-rw-', even though they have 'rwxrwxrwx', so
  2545. // propagate write bits to execute bits.
  2546. stat.mode = stat.mode | ((stat.mode & 146) >> 1);
  2547. }
  2548. } catch (e) {
  2549. if (!e.code) throw e;
  2550. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2551. }
  2552. return stat.mode;
  2553. },realPath:function (node) {
  2554. var parts = [];
  2555. while (node.parent !== node) {
  2556. parts.push(node.name);
  2557. node = node.parent;
  2558. }
  2559. parts.push(node.mount.opts.root);
  2560. parts.reverse();
  2561. return PATH.join.apply(null, parts);
  2562. },flagsToPermissionStringMap:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},flagsToPermissionString:function (flags) {
  2563. flags &= ~0x200000 /*O_PATH*/; // Ignore this flag from musl, otherwise node.js fails to open the file.
  2564. flags &= ~0x800 /*O_NONBLOCK*/; // Ignore this flag from musl, otherwise node.js fails to open the file.
  2565. flags &= ~0x8000 /*O_LARGEFILE*/; // Ignore this flag from musl, otherwise node.js fails to open the file.
  2566. flags &= ~0x80000 /*O_CLOEXEC*/; // Some applications may pass it; it makes no sense for a single process.
  2567. if (flags in NODEFS.flagsToPermissionStringMap) {
  2568. return NODEFS.flagsToPermissionStringMap[flags];
  2569. } else {
  2570. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2571. }
  2572. },node_ops:{getattr:function (node) {
  2573. var path = NODEFS.realPath(node);
  2574. var stat;
  2575. try {
  2576. stat = fs.lstatSync(path);
  2577. } catch (e) {
  2578. if (!e.code) throw e;
  2579. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2580. }
  2581. // node.js v0.10.20 doesn't report blksize and blocks on Windows. Fake them with default blksize of 4096.
  2582. // See http://support.microsoft.com/kb/140365
  2583. if (NODEFS.isWindows && !stat.blksize) {
  2584. stat.blksize = 4096;
  2585. }
  2586. if (NODEFS.isWindows && !stat.blocks) {
  2587. stat.blocks = (stat.size+stat.blksize-1)/stat.blksize|0;
  2588. }
  2589. return {
  2590. dev: stat.dev,
  2591. ino: stat.ino,
  2592. mode: stat.mode,
  2593. nlink: stat.nlink,
  2594. uid: stat.uid,
  2595. gid: stat.gid,
  2596. rdev: stat.rdev,
  2597. size: stat.size,
  2598. atime: stat.atime,
  2599. mtime: stat.mtime,
  2600. ctime: stat.ctime,
  2601. blksize: stat.blksize,
  2602. blocks: stat.blocks
  2603. };
  2604. },setattr:function (node, attr) {
  2605. var path = NODEFS.realPath(node);
  2606. try {
  2607. if (attr.mode !== undefined) {
  2608. fs.chmodSync(path, attr.mode);
  2609. // update the common node structure mode as well
  2610. node.mode = attr.mode;
  2611. }
  2612. if (attr.timestamp !== undefined) {
  2613. var date = new Date(attr.timestamp);
  2614. fs.utimesSync(path, date, date);
  2615. }
  2616. if (attr.size !== undefined) {
  2617. fs.truncateSync(path, attr.size);
  2618. }
  2619. } catch (e) {
  2620. if (!e.code) throw e;
  2621. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2622. }
  2623. },lookup:function (parent, name) {
  2624. var path = PATH.join2(NODEFS.realPath(parent), name);
  2625. var mode = NODEFS.getMode(path);
  2626. return NODEFS.createNode(parent, name, mode);
  2627. },mknod:function (parent, name, mode, dev) {
  2628. var node = NODEFS.createNode(parent, name, mode, dev);
  2629. // create the backing node for this in the fs root as well
  2630. var path = NODEFS.realPath(node);
  2631. try {
  2632. if (FS.isDir(node.mode)) {
  2633. fs.mkdirSync(path, node.mode);
  2634. } else {
  2635. fs.writeFileSync(path, '', { mode: node.mode });
  2636. }
  2637. } catch (e) {
  2638. if (!e.code) throw e;
  2639. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2640. }
  2641. return node;
  2642. },rename:function (oldNode, newDir, newName) {
  2643. var oldPath = NODEFS.realPath(oldNode);
  2644. var newPath = PATH.join2(NODEFS.realPath(newDir), newName);
  2645. try {
  2646. fs.renameSync(oldPath, newPath);
  2647. } catch (e) {
  2648. if (!e.code) throw e;
  2649. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2650. }
  2651. },unlink:function (parent, name) {
  2652. var path = PATH.join2(NODEFS.realPath(parent), name);
  2653. try {
  2654. fs.unlinkSync(path);
  2655. } catch (e) {
  2656. if (!e.code) throw e;
  2657. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2658. }
  2659. },rmdir:function (parent, name) {
  2660. var path = PATH.join2(NODEFS.realPath(parent), name);
  2661. try {
  2662. fs.rmdirSync(path);
  2663. } catch (e) {
  2664. if (!e.code) throw e;
  2665. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2666. }
  2667. },readdir:function (node) {
  2668. var path = NODEFS.realPath(node);
  2669. try {
  2670. return fs.readdirSync(path);
  2671. } catch (e) {
  2672. if (!e.code) throw e;
  2673. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2674. }
  2675. },symlink:function (parent, newName, oldPath) {
  2676. var newPath = PATH.join2(NODEFS.realPath(parent), newName);
  2677. try {
  2678. fs.symlinkSync(oldPath, newPath);
  2679. } catch (e) {
  2680. if (!e.code) throw e;
  2681. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2682. }
  2683. },readlink:function (node) {
  2684. var path = NODEFS.realPath(node);
  2685. try {
  2686. path = fs.readlinkSync(path);
  2687. path = NODEJS_PATH.relative(NODEJS_PATH.resolve(node.mount.opts.root), path);
  2688. return path;
  2689. } catch (e) {
  2690. if (!e.code) throw e;
  2691. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2692. }
  2693. }},stream_ops:{open:function (stream) {
  2694. var path = NODEFS.realPath(stream.node);
  2695. try {
  2696. if (FS.isFile(stream.node.mode)) {
  2697. stream.nfd = fs.openSync(path, NODEFS.flagsToPermissionString(stream.flags));
  2698. }
  2699. } catch (e) {
  2700. if (!e.code) throw e;
  2701. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2702. }
  2703. },close:function (stream) {
  2704. try {
  2705. if (FS.isFile(stream.node.mode) && stream.nfd) {
  2706. fs.closeSync(stream.nfd);
  2707. }
  2708. } catch (e) {
  2709. if (!e.code) throw e;
  2710. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2711. }
  2712. },read:function (stream, buffer, offset, length, position) {
  2713. if (length === 0) return 0; // node errors on 0 length reads
  2714. // FIXME this is terrible.
  2715. var nbuffer = new Buffer(length);
  2716. var res;
  2717. try {
  2718. res = fs.readSync(stream.nfd, nbuffer, 0, length, position);
  2719. } catch (e) {
  2720. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2721. }
  2722. if (res > 0) {
  2723. for (var i = 0; i < res; i++) {
  2724. buffer[offset + i] = nbuffer[i];
  2725. }
  2726. }
  2727. return res;
  2728. },write:function (stream, buffer, offset, length, position) {
  2729. // FIXME this is terrible.
  2730. var nbuffer = new Buffer(buffer.subarray(offset, offset + length));
  2731. var res;
  2732. try {
  2733. res = fs.writeSync(stream.nfd, nbuffer, 0, length, position);
  2734. } catch (e) {
  2735. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2736. }
  2737. return res;
  2738. },llseek:function (stream, offset, whence) {
  2739. var position = offset;
  2740. if (whence === 1) { // SEEK_CUR.
  2741. position += stream.position;
  2742. } else if (whence === 2) { // SEEK_END.
  2743. if (FS.isFile(stream.node.mode)) {
  2744. try {
  2745. var stat = fs.fstatSync(stream.nfd);
  2746. position += stat.size;
  2747. } catch (e) {
  2748. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2749. }
  2750. }
  2751. }
  2752.  
  2753. if (position < 0) {
  2754. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2755. }
  2756.  
  2757. return position;
  2758. }}};
  2759.  
  2760. var WORKERFS={DIR_MODE:16895,FILE_MODE:33279,reader:null,mount:function (mount) {
  2761. assert(ENVIRONMENT_IS_WORKER);
  2762. if (!WORKERFS.reader) WORKERFS.reader = new FileReaderSync();
  2763. var root = WORKERFS.createNode(null, '/', WORKERFS.DIR_MODE, 0);
  2764. var createdParents = {};
  2765. function ensureParent(path) {
  2766. // return the parent node, creating subdirs as necessary
  2767. var parts = path.split('/');
  2768. var parent = root;
  2769. for (var i = 0; i < parts.length-1; i++) {
  2770. var curr = parts.slice(0, i+1).join('/');
  2771. // Issue 4254: Using curr as a node name will prevent the node
  2772. // from being found in FS.nameTable when FS.open is called on
  2773. // a path which holds a child of this node,
  2774. // given that all FS functions assume node names
  2775. // are just their corresponding parts within their given path,
  2776. // rather than incremental aggregates which include their parent's
  2777. // directories.
  2778. if (!createdParents[curr]) {
  2779. createdParents[curr] = WORKERFS.createNode(parent, parts[i], WORKERFS.DIR_MODE, 0);
  2780. }
  2781. parent = createdParents[curr];
  2782. }
  2783. return parent;
  2784. }
  2785. function base(path) {
  2786. var parts = path.split('/');
  2787. return parts[parts.length-1];
  2788. }
  2789. // We also accept FileList here, by using Array.prototype
  2790. Array.prototype.forEach.call(mount.opts["files"] || [], function(file) {
  2791. WORKERFS.createNode(ensureParent(file.name), base(file.name), WORKERFS.FILE_MODE, 0, file, file.lastModifiedDate);
  2792. });
  2793. (mount.opts["blobs"] || []).forEach(function(obj) {
  2794. WORKERFS.createNode(ensureParent(obj["name"]), base(obj["name"]), WORKERFS.FILE_MODE, 0, obj["data"]);
  2795. });
  2796. (mount.opts["packages"] || []).forEach(function(pack) {
  2797. pack['metadata'].files.forEach(function(file) {
  2798. var name = file.filename.substr(1); // remove initial slash
  2799. WORKERFS.createNode(ensureParent(name), base(name), WORKERFS.FILE_MODE, 0, pack['blob'].slice(file.start, file.end));
  2800. });
  2801. });
  2802. return root;
  2803. },createNode:function (parent, name, mode, dev, contents, mtime) {
  2804. var node = FS.createNode(parent, name, mode);
  2805. node.mode = mode;
  2806. node.node_ops = WORKERFS.node_ops;
  2807. node.stream_ops = WORKERFS.stream_ops;
  2808. node.timestamp = (mtime || new Date).getTime();
  2809. assert(WORKERFS.FILE_MODE !== WORKERFS.DIR_MODE);
  2810. if (mode === WORKERFS.FILE_MODE) {
  2811. node.size = contents.size;
  2812. node.contents = contents;
  2813. } else {
  2814. node.size = 4096;
  2815. node.contents = {};
  2816. }
  2817. if (parent) {
  2818. parent.contents[name] = node;
  2819. }
  2820. return node;
  2821. },node_ops:{getattr:function (node) {
  2822. return {
  2823. dev: 1,
  2824. ino: undefined,
  2825. mode: node.mode,
  2826. nlink: 1,
  2827. uid: 0,
  2828. gid: 0,
  2829. rdev: undefined,
  2830. size: node.size,
  2831. atime: new Date(node.timestamp),
  2832. mtime: new Date(node.timestamp),
  2833. ctime: new Date(node.timestamp),
  2834. blksize: 4096,
  2835. blocks: Math.ceil(node.size / 4096),
  2836. };
  2837. },setattr:function (node, attr) {
  2838. if (attr.mode !== undefined) {
  2839. node.mode = attr.mode;
  2840. }
  2841. if (attr.timestamp !== undefined) {
  2842. node.timestamp = attr.timestamp;
  2843. }
  2844. },lookup:function (parent, name) {
  2845. throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
  2846. },mknod:function (parent, name, mode, dev) {
  2847. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2848. },rename:function (oldNode, newDir, newName) {
  2849. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2850. },unlink:function (parent, name) {
  2851. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2852. },rmdir:function (parent, name) {
  2853. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2854. },readdir:function (node) {
  2855. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2856. },symlink:function (parent, newName, oldPath) {
  2857. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2858. },readlink:function (node) {
  2859. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2860. }},stream_ops:{read:function (stream, buffer, offset, length, position) {
  2861. if (position >= stream.node.size) return 0;
  2862. var chunk = stream.node.contents.slice(position, position + length);
  2863. var ab = WORKERFS.reader.readAsArrayBuffer(chunk);
  2864. buffer.set(new Uint8Array(ab), offset);
  2865. return chunk.size;
  2866. },write:function (stream, buffer, offset, length, position) {
  2867. throw new FS.ErrnoError(ERRNO_CODES.EIO);
  2868. },llseek:function (stream, offset, whence) {
  2869. var position = offset;
  2870. if (whence === 1) { // SEEK_CUR.
  2871. position += stream.position;
  2872. } else if (whence === 2) { // SEEK_END.
  2873. if (FS.isFile(stream.node.mode)) {
  2874. position += stream.node.size;
  2875. }
  2876. }
  2877. if (position < 0) {
  2878. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2879. }
  2880. return position;
  2881. }}};
  2882.  
  2883. var _stdin=STATICTOP; STATICTOP += 16;;
  2884.  
  2885. var _stdout=STATICTOP; STATICTOP += 16;;
  2886.  
  2887. var _stderr=STATICTOP; STATICTOP += 16;;var FS={root:null,mounts:[],devices:[null],streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,handleFSError:function (e) {
  2888. if (!(e instanceof FS.ErrnoError)) throw e + ' : ' + stackTrace();
  2889. return ___setErrNo(e.errno);
  2890. },lookupPath:function (path, opts) {
  2891. path = PATH.resolve(FS.cwd(), path);
  2892. opts = opts || {};
  2893.  
  2894. if (!path) return { path: '', node: null };
  2895.  
  2896. var defaults = {
  2897. follow_mount: true,
  2898. recurse_count: 0
  2899. };
  2900. for (var key in defaults) {
  2901. if (opts[key] === undefined) {
  2902. opts[key] = defaults[key];
  2903. }
  2904. }
  2905.  
  2906. if (opts.recurse_count > 8) { // max recursive lookup of 8
  2907. throw new FS.ErrnoError(ERRNO_CODES.ELOOP);
  2908. }
  2909.  
  2910. // split the path
  2911. var parts = PATH.normalizeArray(path.split('/').filter(function(p) {
  2912. return !!p;
  2913. }), false);
  2914.  
  2915. // start at the root
  2916. var current = FS.root;
  2917. var current_path = '/';
  2918.  
  2919. for (var i = 0; i < parts.length; i++) {
  2920. var islast = (i === parts.length-1);
  2921. if (islast && opts.parent) {
  2922. // stop resolving
  2923. break;
  2924. }
  2925.  
  2926. current = FS.lookupNode(current, parts[i]);
  2927. current_path = PATH.join2(current_path, parts[i]);
  2928.  
  2929. // jump to the mount's root node if this is a mountpoint
  2930. if (FS.isMountpoint(current)) {
  2931. if (!islast || (islast && opts.follow_mount)) {
  2932. current = current.mounted.root;
  2933. }
  2934. }
  2935.  
  2936. // by default, lookupPath will not follow a symlink if it is the final path component.
  2937. // setting opts.follow = true will override this behavior.
  2938. if (!islast || opts.follow) {
  2939. var count = 0;
  2940. while (FS.isLink(current.mode)) {
  2941. var link = FS.readlink(current_path);
  2942. current_path = PATH.resolve(PATH.dirname(current_path), link);
  2943.  
  2944. var lookup = FS.lookupPath(current_path, { recurse_count: opts.recurse_count });
  2945. current = lookup.node;
  2946.  
  2947. if (count++ > 40) { // limit max consecutive symlinks to 40 (SYMLOOP_MAX).
  2948. throw new FS.ErrnoError(ERRNO_CODES.ELOOP);
  2949. }
  2950. }
  2951. }
  2952. }
  2953.  
  2954. return { path: current_path, node: current };
  2955. },getPath:function (node) {
  2956. var path;
  2957. while (true) {
  2958. if (FS.isRoot(node)) {
  2959. var mount = node.mount.mountpoint;
  2960. if (!path) return mount;
  2961. return mount[mount.length-1] !== '/' ? mount + '/' + path : mount + path;
  2962. }
  2963. path = path ? node.name + '/' + path : node.name;
  2964. node = node.parent;
  2965. }
  2966. },hashName:function (parentid, name) {
  2967. var hash = 0;
  2968.  
  2969.  
  2970. for (var i = 0; i < name.length; i++) {
  2971. hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0;
  2972. }
  2973. return ((parentid + hash) >>> 0) % FS.nameTable.length;
  2974. },hashAddNode:function (node) {
  2975. var hash = FS.hashName(node.parent.id, node.name);
  2976. node.name_next = FS.nameTable[hash];
  2977. FS.nameTable[hash] = node;
  2978. },hashRemoveNode:function (node) {
  2979. var hash = FS.hashName(node.parent.id, node.name);
  2980. if (FS.nameTable[hash] === node) {
  2981. FS.nameTable[hash] = node.name_next;
  2982. } else {
  2983. var current = FS.nameTable[hash];
  2984. while (current) {
  2985. if (current.name_next === node) {
  2986. current.name_next = node.name_next;
  2987. break;
  2988. }
  2989. current = current.name_next;
  2990. }
  2991. }
  2992. },lookupNode:function (parent, name) {
  2993. var err = FS.mayLookup(parent);
  2994. if (err) {
  2995. throw new FS.ErrnoError(err, parent);
  2996. }
  2997. var hash = FS.hashName(parent.id, name);
  2998. for (var node = FS.nameTable[hash]; node; node = node.name_next) {
  2999. var nodeName = node.name;
  3000. if (node.parent.id === parent.id && nodeName === name) {
  3001. return node;
  3002. }
  3003. }
  3004. // if we failed to find it in the cache, call into the VFS
  3005. return FS.lookup(parent, name);
  3006. },createNode:function (parent, name, mode, rdev) {
  3007. if (!FS.FSNode) {
  3008. FS.FSNode = function(parent, name, mode, rdev) {
  3009. if (!parent) {
  3010. parent = this; // root node sets parent to itself
  3011. }
  3012. this.parent = parent;
  3013. this.mount = parent.mount;
  3014. this.mounted = null;
  3015. this.id = FS.nextInode++;
  3016. this.name = name;
  3017. this.mode = mode;
  3018. this.node_ops = {};
  3019. this.stream_ops = {};
  3020. this.rdev = rdev;
  3021. };
  3022.  
  3023. FS.FSNode.prototype = {};
  3024.  
  3025. // compatibility
  3026. var readMode = 292 | 73;
  3027. var writeMode = 146;
  3028.  
  3029. // NOTE we must use Object.defineProperties instead of individual calls to
  3030. // Object.defineProperty in order to make closure compiler happy
  3031. Object.defineProperties(FS.FSNode.prototype, {
  3032. read: {
  3033. get: function() { return (this.mode & readMode) === readMode; },
  3034. set: function(val) { val ? this.mode |= readMode : this.mode &= ~readMode; }
  3035. },
  3036. write: {
  3037. get: function() { return (this.mode & writeMode) === writeMode; },
  3038. set: function(val) { val ? this.mode |= writeMode : this.mode &= ~writeMode; }
  3039. },
  3040. isFolder: {
  3041. get: function() { return FS.isDir(this.mode); }
  3042. },
  3043. isDevice: {
  3044. get: function() { return FS.isChrdev(this.mode); }
  3045. }
  3046. });
  3047. }
  3048.  
  3049. var node = new FS.FSNode(parent, name, mode, rdev);
  3050.  
  3051. FS.hashAddNode(node);
  3052.  
  3053. return node;
  3054. },destroyNode:function (node) {
  3055. FS.hashRemoveNode(node);
  3056. },isRoot:function (node) {
  3057. return node === node.parent;
  3058. },isMountpoint:function (node) {
  3059. return !!node.mounted;
  3060. },isFile:function (mode) {
  3061. return (mode & 61440) === 32768;
  3062. },isDir:function (mode) {
  3063. return (mode & 61440) === 16384;
  3064. },isLink:function (mode) {
  3065. return (mode & 61440) === 40960;
  3066. },isChrdev:function (mode) {
  3067. return (mode & 61440) === 8192;
  3068. },isBlkdev:function (mode) {
  3069. return (mode & 61440) === 24576;
  3070. },isFIFO:function (mode) {
  3071. return (mode & 61440) === 4096;
  3072. },isSocket:function (mode) {
  3073. return (mode & 49152) === 49152;
  3074. },flagModes:{"r":0,"rs":1052672,"r+":2,"w":577,"wx":705,"xw":705,"w+":578,"wx+":706,"xw+":706,"a":1089,"ax":1217,"xa":1217,"a+":1090,"ax+":1218,"xa+":1218},modeStringToFlags:function (str) {
  3075. var flags = FS.flagModes[str];
  3076. if (typeof flags === 'undefined') {
  3077. throw new Error('Unknown file open mode: ' + str);
  3078. }
  3079. return flags;
  3080. },flagsToPermissionString:function (flag) {
  3081. var perms = ['r', 'w', 'rw'][flag & 3];
  3082. if ((flag & 512)) {
  3083. perms += 'w';
  3084. }
  3085. return perms;
  3086. },nodePermissions:function (node, perms) {
  3087. if (FS.ignorePermissions) {
  3088. return 0;
  3089. }
  3090. // return 0 if any user, group or owner bits are set.
  3091. if (perms.indexOf('r') !== -1 && !(node.mode & 292)) {
  3092. return ERRNO_CODES.EACCES;
  3093. } else if (perms.indexOf('w') !== -1 && !(node.mode & 146)) {
  3094. return ERRNO_CODES.EACCES;
  3095. } else if (perms.indexOf('x') !== -1 && !(node.mode & 73)) {
  3096. return ERRNO_CODES.EACCES;
  3097. }
  3098. return 0;
  3099. },mayLookup:function (dir) {
  3100. var err = FS.nodePermissions(dir, 'x');
  3101. if (err) return err;
  3102. if (!dir.node_ops.lookup) return ERRNO_CODES.EACCES;
  3103. return 0;
  3104. },mayCreate:function (dir, name) {
  3105. try {
  3106. var node = FS.lookupNode(dir, name);
  3107. return ERRNO_CODES.EEXIST;
  3108. } catch (e) {
  3109. }
  3110. return FS.nodePermissions(dir, 'wx');
  3111. },mayDelete:function (dir, name, isdir) {
  3112. var node;
  3113. try {
  3114. node = FS.lookupNode(dir, name);
  3115. } catch (e) {
  3116. return e.errno;
  3117. }
  3118. var err = FS.nodePermissions(dir, 'wx');
  3119. if (err) {
  3120. return err;
  3121. }
  3122. if (isdir) {
  3123. if (!FS.isDir(node.mode)) {
  3124. return ERRNO_CODES.ENOTDIR;
  3125. }
  3126. if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) {
  3127. return ERRNO_CODES.EBUSY;
  3128. }
  3129. } else {
  3130. if (FS.isDir(node.mode)) {
  3131. return ERRNO_CODES.EISDIR;
  3132. }
  3133. }
  3134. return 0;
  3135. },mayOpen:function (node, flags) {
  3136. if (!node) {
  3137. return ERRNO_CODES.ENOENT;
  3138. }
  3139. if (FS.isLink(node.mode)) {
  3140. return ERRNO_CODES.ELOOP;
  3141. } else if (FS.isDir(node.mode)) {
  3142. if (FS.flagsToPermissionString(flags) !== 'r' || // opening for write
  3143. (flags & 512)) { // TODO: check for O_SEARCH? (== search for dir only)
  3144. return ERRNO_CODES.EISDIR;
  3145. }
  3146. }
  3147. return FS.nodePermissions(node, FS.flagsToPermissionString(flags));
  3148. },MAX_OPEN_FDS:4096,nextfd:function (fd_start, fd_end) {
  3149. fd_start = fd_start || 0;
  3150. fd_end = fd_end || FS.MAX_OPEN_FDS;
  3151. for (var fd = fd_start; fd <= fd_end; fd++) {
  3152. if (!FS.streams[fd]) {
  3153. return fd;
  3154. }
  3155. }
  3156. throw new FS.ErrnoError(ERRNO_CODES.EMFILE);
  3157. },getStream:function (fd) {
  3158. return FS.streams[fd];
  3159. },createStream:function (stream, fd_start, fd_end) {
  3160. if (!FS.FSStream) {
  3161. FS.FSStream = function(){};
  3162. FS.FSStream.prototype = {};
  3163. // compatibility
  3164. Object.defineProperties(FS.FSStream.prototype, {
  3165. object: {
  3166. get: function() { return this.node; },
  3167. set: function(val) { this.node = val; }
  3168. },
  3169. isRead: {
  3170. get: function() { return (this.flags & 2097155) !== 1; }
  3171. },
  3172. isWrite: {
  3173. get: function() { return (this.flags & 2097155) !== 0; }
  3174. },
  3175. isAppend: {
  3176. get: function() { return (this.flags & 1024); }
  3177. }
  3178. });
  3179. }
  3180. // clone it, so we can return an instance of FSStream
  3181. var newStream = new FS.FSStream();
  3182. for (var p in stream) {
  3183. newStream[p] = stream[p];
  3184. }
  3185. stream = newStream;
  3186. var fd = FS.nextfd(fd_start, fd_end);
  3187. stream.fd = fd;
  3188. FS.streams[fd] = stream;
  3189. return stream;
  3190. },closeStream:function (fd) {
  3191. FS.streams[fd] = null;
  3192. },chrdev_stream_ops:{open:function (stream) {
  3193. var device = FS.getDevice(stream.node.rdev);
  3194. // override node's stream ops with the device's
  3195. stream.stream_ops = device.stream_ops;
  3196. // forward the open call
  3197. if (stream.stream_ops.open) {
  3198. stream.stream_ops.open(stream);
  3199. }
  3200. },llseek:function () {
  3201. throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
  3202. }},major:function (dev) {
  3203. return ((dev) >> 8);
  3204. },minor:function (dev) {
  3205. return ((dev) & 0xff);
  3206. },makedev:function (ma, mi) {
  3207. return ((ma) << 8 | (mi));
  3208. },registerDevice:function (dev, ops) {
  3209. FS.devices[dev] = { stream_ops: ops };
  3210. },getDevice:function (dev) {
  3211. return FS.devices[dev];
  3212. },getMounts:function (mount) {
  3213. var mounts = [];
  3214. var check = [mount];
  3215.  
  3216. while (check.length) {
  3217. var m = check.pop();
  3218.  
  3219. mounts.push(m);
  3220.  
  3221. check.push.apply(check, m.mounts);
  3222. }
  3223.  
  3224. return mounts;
  3225. },syncfs:function (populate, callback) {
  3226. if (typeof(populate) === 'function') {
  3227. callback = populate;
  3228. populate = false;
  3229. }
  3230.  
  3231. FS.syncFSRequests++;
  3232.  
  3233. if (FS.syncFSRequests > 1) {
  3234. console.log('warning: ' + FS.syncFSRequests + ' FS.syncfs operations in flight at once, probably just doing extra work');
  3235. }
  3236.  
  3237. var mounts = FS.getMounts(FS.root.mount);
  3238. var completed = 0;
  3239.  
  3240. function doCallback(err) {
  3241. assert(FS.syncFSRequests > 0);
  3242. FS.syncFSRequests--;
  3243. return callback(err);
  3244. }
  3245.  
  3246. function done(err) {
  3247. if (err) {
  3248. if (!done.errored) {
  3249. done.errored = true;
  3250. return doCallback(err);
  3251. }
  3252. return;
  3253. }
  3254. if (++completed >= mounts.length) {
  3255. doCallback(null);
  3256. }
  3257. };
  3258.  
  3259. // sync all mounts
  3260. mounts.forEach(function (mount) {
  3261. if (!mount.type.syncfs) {
  3262. return done(null);
  3263. }
  3264. mount.type.syncfs(mount, populate, done);
  3265. });
  3266. },mount:function (type, opts, mountpoint) {
  3267. var root = mountpoint === '/';
  3268. var pseudo = !mountpoint;
  3269. var node;
  3270.  
  3271. if (root && FS.root) {
  3272. throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
  3273. } else if (!root && !pseudo) {
  3274. var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
  3275.  
  3276. mountpoint = lookup.path; // use the absolute path
  3277. node = lookup.node;
  3278.  
  3279. if (FS.isMountpoint(node)) {
  3280. throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
  3281. }
  3282.  
  3283. if (!FS.isDir(node.mode)) {
  3284. throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
  3285. }
  3286. }
  3287.  
  3288. var mount = {
  3289. type: type,
  3290. opts: opts,
  3291. mountpoint: mountpoint,
  3292. mounts: []
  3293. };
  3294.  
  3295. // create a root node for the fs
  3296. var mountRoot = type.mount(mount);
  3297. mountRoot.mount = mount;
  3298. mount.root = mountRoot;
  3299.  
  3300. if (root) {
  3301. FS.root = mountRoot;
  3302. } else if (node) {
  3303. // set as a mountpoint
  3304. node.mounted = mount;
  3305.  
  3306. // add the new mount to the current mount's children
  3307. if (node.mount) {
  3308. node.mount.mounts.push(mount);
  3309. }
  3310. }
  3311.  
  3312. return mountRoot;
  3313. },unmount:function (mountpoint) {
  3314. var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
  3315.  
  3316. if (!FS.isMountpoint(lookup.node)) {
  3317. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3318. }
  3319.  
  3320. // destroy the nodes for this mount, and all its child mounts
  3321. var node = lookup.node;
  3322. var mount = node.mounted;
  3323. var mounts = FS.getMounts(mount);
  3324.  
  3325. Object.keys(FS.nameTable).forEach(function (hash) {
  3326. var current = FS.nameTable[hash];
  3327.  
  3328. while (current) {
  3329. var next = current.name_next;
  3330.  
  3331. if (mounts.indexOf(current.mount) !== -1) {
  3332. FS.destroyNode(current);
  3333. }
  3334.  
  3335. current = next;
  3336. }
  3337. });
  3338.  
  3339. // no longer a mountpoint
  3340. node.mounted = null;
  3341.  
  3342. // remove this mount from the child mounts
  3343. var idx = node.mount.mounts.indexOf(mount);
  3344. assert(idx !== -1);
  3345. node.mount.mounts.splice(idx, 1);
  3346. },lookup:function (parent, name) {
  3347. return parent.node_ops.lookup(parent, name);
  3348. },mknod:function (path, mode, dev) {
  3349. var lookup = FS.lookupPath(path, { parent: true });
  3350. var parent = lookup.node;
  3351. var name = PATH.basename(path);
  3352. if (!name || name === '.' || name === '..') {
  3353. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3354. }
  3355. var err = FS.mayCreate(parent, name);
  3356. if (err) {
  3357. throw new FS.ErrnoError(err);
  3358. }
  3359. if (!parent.node_ops.mknod) {
  3360. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  3361. }
  3362. return parent.node_ops.mknod(parent, name, mode, dev);
  3363. },create:function (path, mode) {
  3364. mode = mode !== undefined ? mode : 438 /* 0666 */;
  3365. mode &= 4095;
  3366. mode |= 32768;
  3367. return FS.mknod(path, mode, 0);
  3368. },mkdir:function (path, mode) {
  3369. mode = mode !== undefined ? mode : 511 /* 0777 */;
  3370. mode &= 511 | 512;
  3371. mode |= 16384;
  3372. return FS.mknod(path, mode, 0);
  3373. },mkdirTree:function (path, mode) {
  3374. var dirs = path.split('/');
  3375. var d = '';
  3376. for (var i = 0; i < dirs.length; ++i) {
  3377. if (!dirs[i]) continue;
  3378. d += '/' + dirs[i];
  3379. try {
  3380. FS.mkdir(d, mode);
  3381. } catch(e) {
  3382. if (e.errno != ERRNO_CODES.EEXIST) throw e;
  3383. }
  3384. }
  3385. },mkdev:function (path, mode, dev) {
  3386. if (typeof(dev) === 'undefined') {
  3387. dev = mode;
  3388. mode = 438 /* 0666 */;
  3389. }
  3390. mode |= 8192;
  3391. return FS.mknod(path, mode, dev);
  3392. },symlink:function (oldpath, newpath) {
  3393. if (!PATH.resolve(oldpath)) {
  3394. throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
  3395. }
  3396. var lookup = FS.lookupPath(newpath, { parent: true });
  3397. var parent = lookup.node;
  3398. if (!parent) {
  3399. throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
  3400. }
  3401. var newname = PATH.basename(newpath);
  3402. var err = FS.mayCreate(parent, newname);
  3403. if (err) {
  3404. throw new FS.ErrnoError(err);
  3405. }
  3406. if (!parent.node_ops.symlink) {
  3407. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  3408. }
  3409. return parent.node_ops.symlink(parent, newname, oldpath);
  3410. },rename:function (old_path, new_path) {
  3411. var old_dirname = PATH.dirname(old_path);
  3412. var new_dirname = PATH.dirname(new_path);
  3413. var old_name = PATH.basename(old_path);
  3414. var new_name = PATH.basename(new_path);
  3415. // parents must exist
  3416. var lookup, old_dir, new_dir;
  3417. try {
  3418. lookup = FS.lookupPath(old_path, { parent: true });
  3419. old_dir = lookup.node;
  3420. lookup = FS.lookupPath(new_path, { parent: true });
  3421. new_dir = lookup.node;
  3422. } catch (e) {
  3423. throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
  3424. }
  3425. if (!old_dir || !new_dir) throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
  3426. // need to be part of the same mount
  3427. if (old_dir.mount !== new_dir.mount) {
  3428. throw new FS.ErrnoError(ERRNO_CODES.EXDEV);
  3429. }
  3430. // source must exist
  3431. var old_node = FS.lookupNode(old_dir, old_name);
  3432. // old path should not be an ancestor of the new path
  3433. var relative = PATH.relative(old_path, new_dirname);
  3434. if (relative.charAt(0) !== '.') {
  3435. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3436. }
  3437. // new path should not be an ancestor of the old path
  3438. relative = PATH.relative(new_path, old_dirname);
  3439. if (relative.charAt(0) !== '.') {
  3440. throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
  3441. }
  3442. // see if the new path already exists
  3443. var new_node;
  3444. try {
  3445. new_node = FS.lookupNode(new_dir, new_name);
  3446. } catch (e) {
  3447. // not fatal
  3448. }
  3449. // early out if nothing needs to change
  3450. if (old_node === new_node) {
  3451. return;
  3452. }
  3453. // we'll need to delete the old entry
  3454. var isdir = FS.isDir(old_node.mode);
  3455. var err = FS.mayDelete(old_dir, old_name, isdir);
  3456. if (err) {
  3457. throw new FS.ErrnoError(err);
  3458. }
  3459. // need delete permissions if we'll be overwriting.
  3460. // need create permissions if new doesn't already exist.
  3461. err = new_node ?
  3462. FS.mayDelete(new_dir, new_name, isdir) :
  3463. FS.mayCreate(new_dir, new_name);
  3464. if (err) {
  3465. throw new FS.ErrnoError(err);
  3466. }
  3467. if (!old_dir.node_ops.rename) {
  3468. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  3469. }
  3470. if (FS.isMountpoint(old_node) || (new_node && FS.isMountpoint(new_node))) {
  3471. throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
  3472. }
  3473. // if we are going to change the parent, check write permissions
  3474. if (new_dir !== old_dir) {
  3475. err = FS.nodePermissions(old_dir, 'w');
  3476. if (err) {
  3477. throw new FS.ErrnoError(err);
  3478. }
  3479. }
  3480. try {
  3481. if (FS.trackingDelegate['willMovePath']) {
  3482. FS.trackingDelegate['willMovePath'](old_path, new_path);
  3483. }
  3484. } catch(e) {
  3485. console.log("FS.trackingDelegate['willMovePath']('"+old_path+"', '"+new_path+"') threw an exception: " + e.message);
  3486. }
  3487. // remove the node from the lookup hash
  3488. FS.hashRemoveNode(old_node);
  3489. // do the underlying fs rename
  3490. try {
  3491. old_dir.node_ops.rename(old_node, new_dir, new_name);
  3492. } catch (e) {
  3493. throw e;
  3494. } finally {
  3495. // add the node back to the hash (in case node_ops.rename
  3496. // changed its name)
  3497. FS.hashAddNode(old_node);
  3498. }
  3499. try {
  3500. if (FS.trackingDelegate['onMovePath']) FS.trackingDelegate['onMovePath'](old_path, new_path);
  3501. } catch(e) {
  3502. console.log("FS.trackingDelegate['onMovePath']('"+old_path+"', '"+new_path+"') threw an exception: " + e.message);
  3503. }
  3504. },rmdir:function (path) {
  3505. var lookup = FS.lookupPath(path, { parent: true });
  3506. var parent = lookup.node;
  3507. var name = PATH.basename(path);
  3508. var node = FS.lookupNode(parent, name);
  3509. var err = FS.mayDelete(parent, name, true);
  3510. if (err) {
  3511. throw new FS.ErrnoError(err);
  3512. }
  3513. if (!parent.node_ops.rmdir) {
  3514. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  3515. }
  3516. if (FS.isMountpoint(node)) {
  3517. throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
  3518. }
  3519. try {
  3520. if (FS.trackingDelegate['willDeletePath']) {
  3521. FS.trackingDelegate['willDeletePath'](path);
  3522. }
  3523. } catch(e) {
  3524. console.log("FS.trackingDelegate['willDeletePath']('"+path+"') threw an exception: " + e.message);
  3525. }
  3526. parent.node_ops.rmdir(parent, name);
  3527. FS.destroyNode(node);
  3528. try {
  3529. if (FS.trackingDelegate['onDeletePath']) FS.trackingDelegate['onDeletePath'](path);
  3530. } catch(e) {
  3531. console.log("FS.trackingDelegate['onDeletePath']('"+path+"') threw an exception: " + e.message);
  3532. }
  3533. },readdir:function (path) {
  3534. var lookup = FS.lookupPath(path, { follow: true });
  3535. var node = lookup.node;
  3536. if (!node.node_ops.readdir) {
  3537. throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
  3538. }
  3539. return node.node_ops.readdir(node);
  3540. },unlink:function (path) {
  3541. var lookup = FS.lookupPath(path, { parent: true });
  3542. var parent = lookup.node;
  3543. var name = PATH.basename(path);
  3544. var node = FS.lookupNode(parent, name);
  3545. var err = FS.mayDelete(parent, name, false);
  3546. if (err) {
  3547. // According to POSIX, we should map EISDIR to EPERM, but
  3548. // we instead do what Linux does (and we must, as we use
  3549. // the musl linux libc).
  3550. throw new FS.ErrnoError(err);
  3551. }
  3552. if (!parent.node_ops.unlink) {
  3553. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  3554. }
  3555. if (FS.isMountpoint(node)) {
  3556. throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
  3557. }
  3558. try {
  3559. if (FS.trackingDelegate['willDeletePath']) {
  3560. FS.trackingDelegate['willDeletePath'](path);
  3561. }
  3562. } catch(e) {
  3563. console.log("FS.trackingDelegate['willDeletePath']('"+path+"') threw an exception: " + e.message);
  3564. }
  3565. parent.node_ops.unlink(parent, name);
  3566. FS.destroyNode(node);
  3567. try {
  3568. if (FS.trackingDelegate['onDeletePath']) FS.trackingDelegate['onDeletePath'](path);
  3569. } catch(e) {
  3570. console.log("FS.trackingDelegate['onDeletePath']('"+path+"') threw an exception: " + e.message);
  3571. }
  3572. },readlink:function (path) {
  3573. var lookup = FS.lookupPath(path);
  3574. var link = lookup.node;
  3575. if (!link) {
  3576. throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
  3577. }
  3578. if (!link.node_ops.readlink) {
  3579. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3580. }
  3581. return PATH.resolve(FS.getPath(link.parent), link.node_ops.readlink(link));
  3582. },stat:function (path, dontFollow) {
  3583. var lookup = FS.lookupPath(path, { follow: !dontFollow });
  3584. var node = lookup.node;
  3585. if (!node) {
  3586. throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
  3587. }
  3588. if (!node.node_ops.getattr) {
  3589. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  3590. }
  3591. return node.node_ops.getattr(node);
  3592. },lstat:function (path) {
  3593. return FS.stat(path, true);
  3594. },chmod:function (path, mode, dontFollow) {
  3595. var node;
  3596. if (typeof path === 'string') {
  3597. var lookup = FS.lookupPath(path, { follow: !dontFollow });
  3598. node = lookup.node;
  3599. } else {
  3600. node = path;
  3601. }
  3602. if (!node.node_ops.setattr) {
  3603. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  3604. }
  3605. node.node_ops.setattr(node, {
  3606. mode: (mode & 4095) | (node.mode & ~4095),
  3607. timestamp: Date.now()
  3608. });
  3609. },lchmod:function (path, mode) {
  3610. FS.chmod(path, mode, true);
  3611. },fchmod:function (fd, mode) {
  3612. var stream = FS.getStream(fd);
  3613. if (!stream) {
  3614. throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  3615. }
  3616. FS.chmod(stream.node, mode);
  3617. },chown:function (path, uid, gid, dontFollow) {
  3618. var node;
  3619. if (typeof path === 'string') {
  3620. var lookup = FS.lookupPath(path, { follow: !dontFollow });
  3621. node = lookup.node;
  3622. } else {
  3623. node = path;
  3624. }
  3625. if (!node.node_ops.setattr) {
  3626. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  3627. }
  3628. node.node_ops.setattr(node, {
  3629. timestamp: Date.now()
  3630. // we ignore the uid / gid for now
  3631. });
  3632. },lchown:function (path, uid, gid) {
  3633. FS.chown(path, uid, gid, true);
  3634. },fchown:function (fd, uid, gid) {
  3635. var stream = FS.getStream(fd);
  3636. if (!stream) {
  3637. throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  3638. }
  3639. FS.chown(stream.node, uid, gid);
  3640. },truncate:function (path, len) {
  3641. if (len < 0) {
  3642. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3643. }
  3644. var node;
  3645. if (typeof path === 'string') {
  3646. var lookup = FS.lookupPath(path, { follow: true });
  3647. node = lookup.node;
  3648. } else {
  3649. node = path;
  3650. }
  3651. if (!node.node_ops.setattr) {
  3652. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  3653. }
  3654. if (FS.isDir(node.mode)) {
  3655. throw new FS.ErrnoError(ERRNO_CODES.EISDIR);
  3656. }
  3657. if (!FS.isFile(node.mode)) {
  3658. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3659. }
  3660. var err = FS.nodePermissions(node, 'w');
  3661. if (err) {
  3662. throw new FS.ErrnoError(err);
  3663. }
  3664. node.node_ops.setattr(node, {
  3665. size: len,
  3666. timestamp: Date.now()
  3667. });
  3668. },ftruncate:function (fd, len) {
  3669. var stream = FS.getStream(fd);
  3670. if (!stream) {
  3671. throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  3672. }
  3673. if ((stream.flags & 2097155) === 0) {
  3674. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3675. }
  3676. FS.truncate(stream.node, len);
  3677. },utime:function (path, atime, mtime) {
  3678. var lookup = FS.lookupPath(path, { follow: true });
  3679. var node = lookup.node;
  3680. node.node_ops.setattr(node, {
  3681. timestamp: Math.max(atime, mtime)
  3682. });
  3683. },open:function (path, flags, mode, fd_start, fd_end) {
  3684. if (path === "") {
  3685. throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
  3686. }
  3687. flags = typeof flags === 'string' ? FS.modeStringToFlags(flags) : flags;
  3688. mode = typeof mode === 'undefined' ? 438 /* 0666 */ : mode;
  3689. if ((flags & 64)) {
  3690. mode = (mode & 4095) | 32768;
  3691. } else {
  3692. mode = 0;
  3693. }
  3694. var node;
  3695. if (typeof path === 'object') {
  3696. node = path;
  3697. } else {
  3698. path = PATH.normalize(path);
  3699. try {
  3700. var lookup = FS.lookupPath(path, {
  3701. follow: !(flags & 131072)
  3702. });
  3703. node = lookup.node;
  3704. } catch (e) {
  3705. // ignore
  3706. }
  3707. }
  3708. // perhaps we need to create the node
  3709. var created = false;
  3710. if ((flags & 64)) {
  3711. if (node) {
  3712. // if O_CREAT and O_EXCL are set, error out if the node already exists
  3713. if ((flags & 128)) {
  3714. throw new FS.ErrnoError(ERRNO_CODES.EEXIST);
  3715. }
  3716. } else {
  3717. // node doesn't exist, try to create it
  3718. node = FS.mknod(path, mode, 0);
  3719. created = true;
  3720. }
  3721. }
  3722. if (!node) {
  3723. throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
  3724. }
  3725. // can't truncate a device
  3726. if (FS.isChrdev(node.mode)) {
  3727. flags &= ~512;
  3728. }
  3729. // if asked only for a directory, then this must be one
  3730. if ((flags & 65536) && !FS.isDir(node.mode)) {
  3731. throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
  3732. }
  3733. // check permissions, if this is not a file we just created now (it is ok to
  3734. // create and write to a file with read-only permissions; it is read-only
  3735. // for later use)
  3736. if (!created) {
  3737. var err = FS.mayOpen(node, flags);
  3738. if (err) {
  3739. throw new FS.ErrnoError(err);
  3740. }
  3741. }
  3742. // do truncation if necessary
  3743. if ((flags & 512)) {
  3744. FS.truncate(node, 0);
  3745. }
  3746. // we've already handled these, don't pass down to the underlying vfs
  3747. flags &= ~(128 | 512);
  3748.  
  3749. // register the stream with the filesystem
  3750. var stream = FS.createStream({
  3751. node: node,
  3752. path: FS.getPath(node), // we want the absolute path to the node
  3753. flags: flags,
  3754. seekable: true,
  3755. position: 0,
  3756. stream_ops: node.stream_ops,
  3757. // used by the file family libc calls (fopen, fwrite, ferror, etc.)
  3758. ungotten: [],
  3759. error: false
  3760. }, fd_start, fd_end);
  3761. // call the new stream's open function
  3762. if (stream.stream_ops.open) {
  3763. stream.stream_ops.open(stream);
  3764. }
  3765. if (Module['logReadFiles'] && !(flags & 1)) {
  3766. if (!FS.readFiles) FS.readFiles = {};
  3767. if (!(path in FS.readFiles)) {
  3768. FS.readFiles[path] = 1;
  3769. Module['printErr']('read file: ' + path);
  3770. }
  3771. }
  3772. try {
  3773. if (FS.trackingDelegate['onOpenFile']) {
  3774. var trackingFlags = 0;
  3775. if ((flags & 2097155) !== 1) {
  3776. trackingFlags |= FS.tracking.openFlags.READ;
  3777. }
  3778. if ((flags & 2097155) !== 0) {
  3779. trackingFlags |= FS.tracking.openFlags.WRITE;
  3780. }
  3781. FS.trackingDelegate['onOpenFile'](path, trackingFlags);
  3782. }
  3783. } catch(e) {
  3784. console.log("FS.trackingDelegate['onOpenFile']('"+path+"', flags) threw an exception: " + e.message);
  3785. }
  3786. return stream;
  3787. },close:function (stream) {
  3788. if (stream.getdents) stream.getdents = null; // free readdir state
  3789. try {
  3790. if (stream.stream_ops.close) {
  3791. stream.stream_ops.close(stream);
  3792. }
  3793. } catch (e) {
  3794. throw e;
  3795. } finally {
  3796. FS.closeStream(stream.fd);
  3797. }
  3798. },llseek:function (stream, offset, whence) {
  3799. if (!stream.seekable || !stream.stream_ops.llseek) {
  3800. throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
  3801. }
  3802. stream.position = stream.stream_ops.llseek(stream, offset, whence);
  3803. stream.ungotten = [];
  3804. return stream.position;
  3805. },read:function (stream, buffer, offset, length, position) {
  3806. if (length < 0 || position < 0) {
  3807. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3808. }
  3809. if ((stream.flags & 2097155) === 1) {
  3810. throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  3811. }
  3812. if (FS.isDir(stream.node.mode)) {
  3813. throw new FS.ErrnoError(ERRNO_CODES.EISDIR);
  3814. }
  3815. if (!stream.stream_ops.read) {
  3816. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3817. }
  3818. var seeking = true;
  3819. if (typeof position === 'undefined') {
  3820. position = stream.position;
  3821. seeking = false;
  3822. } else if (!stream.seekable) {
  3823. throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
  3824. }
  3825. var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position);
  3826. if (!seeking) stream.position += bytesRead;
  3827. return bytesRead;
  3828. },write:function (stream, buffer, offset, length, position, canOwn) {
  3829. if (length < 0 || position < 0) {
  3830. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3831. }
  3832. if ((stream.flags & 2097155) === 0) {
  3833. throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  3834. }
  3835. if (FS.isDir(stream.node.mode)) {
  3836. throw new FS.ErrnoError(ERRNO_CODES.EISDIR);
  3837. }
  3838. if (!stream.stream_ops.write) {
  3839. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3840. }
  3841. if (stream.flags & 1024) {
  3842. // seek to the end before writing in append mode
  3843. FS.llseek(stream, 0, 2);
  3844. }
  3845. var seeking = true;
  3846. if (typeof position === 'undefined') {
  3847. position = stream.position;
  3848. seeking = false;
  3849. } else if (!stream.seekable) {
  3850. throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
  3851. }
  3852. var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn);
  3853. if (!seeking) stream.position += bytesWritten;
  3854. try {
  3855. if (stream.path && FS.trackingDelegate['onWriteToFile']) FS.trackingDelegate['onWriteToFile'](stream.path);
  3856. } catch(e) {
  3857. console.log("FS.trackingDelegate['onWriteToFile']('"+path+"') threw an exception: " + e.message);
  3858. }
  3859. return bytesWritten;
  3860. },allocate:function (stream, offset, length) {
  3861. if (offset < 0 || length <= 0) {
  3862. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3863. }
  3864. if ((stream.flags & 2097155) === 0) {
  3865. throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  3866. }
  3867. if (!FS.isFile(stream.node.mode) && !FS.isDir(node.mode)) {
  3868. throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
  3869. }
  3870. if (!stream.stream_ops.allocate) {
  3871. throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP);
  3872. }
  3873. stream.stream_ops.allocate(stream, offset, length);
  3874. },mmap:function (stream, buffer, offset, length, position, prot, flags) {
  3875. // TODO if PROT is PROT_WRITE, make sure we have write access
  3876. if ((stream.flags & 2097155) === 1) {
  3877. throw new FS.ErrnoError(ERRNO_CODES.EACCES);
  3878. }
  3879. if (!stream.stream_ops.mmap) {
  3880. throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
  3881. }
  3882. return stream.stream_ops.mmap(stream, buffer, offset, length, position, prot, flags);
  3883. },msync:function (stream, buffer, offset, length, mmapFlags) {
  3884. if (!stream || !stream.stream_ops.msync) {
  3885. return 0;
  3886. }
  3887. return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags);
  3888. },munmap:function (stream) {
  3889. return 0;
  3890. },ioctl:function (stream, cmd, arg) {
  3891. if (!stream.stream_ops.ioctl) {
  3892. throw new FS.ErrnoError(ERRNO_CODES.ENOTTY);
  3893. }
  3894. return stream.stream_ops.ioctl(stream, cmd, arg);
  3895. },readFile:function (path, opts) {
  3896. opts = opts || {};
  3897. opts.flags = opts.flags || 'r';
  3898. opts.encoding = opts.encoding || 'binary';
  3899. if (opts.encoding !== 'utf8' && opts.encoding !== 'binary') {
  3900. throw new Error('Invalid encoding type "' + opts.encoding + '"');
  3901. }
  3902. var ret;
  3903. var stream = FS.open(path, opts.flags);
  3904. var stat = FS.stat(path);
  3905. var length = stat.size;
  3906. var buf = new Uint8Array(length);
  3907. FS.read(stream, buf, 0, length, 0);
  3908. if (opts.encoding === 'utf8') {
  3909. ret = UTF8ArrayToString(buf, 0);
  3910. } else if (opts.encoding === 'binary') {
  3911. ret = buf;
  3912. }
  3913. FS.close(stream);
  3914. return ret;
  3915. },writeFile:function (path, data, opts) {
  3916. opts = opts || {};
  3917. opts.flags = opts.flags || 'w';
  3918. opts.encoding = opts.encoding || 'utf8';
  3919. if (opts.encoding !== 'utf8' && opts.encoding !== 'binary') {
  3920. throw new Error('Invalid encoding type "' + opts.encoding + '"');
  3921. }
  3922. var stream = FS.open(path, opts.flags, opts.mode);
  3923. if (opts.encoding === 'utf8') {
  3924. var buf = new Uint8Array(lengthBytesUTF8(data)+1);
  3925. var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length);
  3926. FS.write(stream, buf, 0, actualNumBytes, 0, opts.canOwn);
  3927. } else if (opts.encoding === 'binary') {
  3928. FS.write(stream, data, 0, data.length, 0, opts.canOwn);
  3929. }
  3930. FS.close(stream);
  3931. },cwd:function () {
  3932. return FS.currentPath;
  3933. },chdir:function (path) {
  3934. var lookup = FS.lookupPath(path, { follow: true });
  3935. if (lookup.node === null) {
  3936. throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
  3937. }
  3938. if (!FS.isDir(lookup.node.mode)) {
  3939. throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
  3940. }
  3941. var err = FS.nodePermissions(lookup.node, 'x');
  3942. if (err) {
  3943. throw new FS.ErrnoError(err);
  3944. }
  3945. FS.currentPath = lookup.path;
  3946. },createDefaultDirectories:function () {
  3947. FS.mkdir('/tmp');
  3948. FS.mkdir('/home');
  3949. FS.mkdir('/home/web_user');
  3950. },createDefaultDevices:function () {
  3951. // create /dev
  3952. FS.mkdir('/dev');
  3953. // setup /dev/null
  3954. FS.registerDevice(FS.makedev(1, 3), {
  3955. read: function() { return 0; },
  3956. write: function(stream, buffer, offset, length, pos) { return length; }
  3957. });
  3958. FS.mkdev('/dev/null', FS.makedev(1, 3));
  3959. // setup /dev/tty and /dev/tty1
  3960. // stderr needs to print output using Module['printErr']
  3961. // so we register a second tty just for it.
  3962. TTY.register(FS.makedev(5, 0), TTY.default_tty_ops);
  3963. TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops);
  3964. FS.mkdev('/dev/tty', FS.makedev(5, 0));
  3965. FS.mkdev('/dev/tty1', FS.makedev(6, 0));
  3966. // setup /dev/[u]random
  3967. var random_device;
  3968. if (typeof crypto !== 'undefined') {
  3969. // for modern web browsers
  3970. var randomBuffer = new Uint8Array(1);
  3971. random_device = function() { crypto.getRandomValues(randomBuffer); return randomBuffer[0]; };
  3972. } else if (ENVIRONMENT_IS_NODE) {
  3973. // for nodejs
  3974. random_device = function() { return require('crypto').randomBytes(1)[0]; };
  3975. } else {
  3976. // default for ES5 platforms
  3977. random_device = function() { return (Math.random()*256)|0; };
  3978. }
  3979. FS.createDevice('/dev', 'random', random_device);
  3980. FS.createDevice('/dev', 'urandom', random_device);
  3981. // we're not going to emulate the actual shm device,
  3982. // just create the tmp dirs that reside in it commonly
  3983. FS.mkdir('/dev/shm');
  3984. FS.mkdir('/dev/shm/tmp');
  3985. },createSpecialDirectories:function () {
  3986. // create /proc/self/fd which allows /proc/self/fd/6 => readlink gives the name of the stream for fd 6 (see test_unistd_ttyname)
  3987. FS.mkdir('/proc');
  3988. FS.mkdir('/proc/self');
  3989. FS.mkdir('/proc/self/fd');
  3990. FS.mount({
  3991. mount: function() {
  3992. var node = FS.createNode('/proc/self', 'fd', 16384 | 511 /* 0777 */, 73);
  3993. node.node_ops = {
  3994. lookup: function(parent, name) {
  3995. var fd = +name;
  3996. var stream = FS.getStream(fd);
  3997. if (!stream) throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  3998. var ret = {
  3999. parent: null,
  4000. mount: { mountpoint: 'fake' },
  4001. node_ops: { readlink: function() { return stream.path } }
  4002. };
  4003. ret.parent = ret; // make it look like a simple root node
  4004. return ret;
  4005. }
  4006. };
  4007. return node;
  4008. }
  4009. }, {}, '/proc/self/fd');
  4010. },createStandardStreams:function () {
  4011. // TODO deprecate the old functionality of a single
  4012. // input / output callback and that utilizes FS.createDevice
  4013. // and instead require a unique set of stream ops
  4014.  
  4015. // by default, we symlink the standard streams to the
  4016. // default tty devices. however, if the standard streams
  4017. // have been overwritten we create a unique device for
  4018. // them instead.
  4019. if (Module['stdin']) {
  4020. FS.createDevice('/dev', 'stdin', Module['stdin']);
  4021. } else {
  4022. FS.symlink('/dev/tty', '/dev/stdin');
  4023. }
  4024. if (Module['stdout']) {
  4025. FS.createDevice('/dev', 'stdout', null, Module['stdout']);
  4026. } else {
  4027. FS.symlink('/dev/tty', '/dev/stdout');
  4028. }
  4029. if (Module['stderr']) {
  4030. FS.createDevice('/dev', 'stderr', null, Module['stderr']);
  4031. } else {
  4032. FS.symlink('/dev/tty1', '/dev/stderr');
  4033. }
  4034.  
  4035. // open default streams for the stdin, stdout and stderr devices
  4036. var stdin = FS.open('/dev/stdin', 'r');
  4037. assert(stdin.fd === 0, 'invalid handle for stdin (' + stdin.fd + ')');
  4038.  
  4039. var stdout = FS.open('/dev/stdout', 'w');
  4040. assert(stdout.fd === 1, 'invalid handle for stdout (' + stdout.fd + ')');
  4041.  
  4042. var stderr = FS.open('/dev/stderr', 'w');
  4043. assert(stderr.fd === 2, 'invalid handle for stderr (' + stderr.fd + ')');
  4044. },ensureErrnoError:function () {
  4045. if (FS.ErrnoError) return;
  4046. FS.ErrnoError = function ErrnoError(errno, node) {
  4047. //Module.printErr(stackTrace()); // useful for debugging
  4048. this.node = node;
  4049. this.setErrno = function(errno) {
  4050. this.errno = errno;
  4051. for (var key in ERRNO_CODES) {
  4052. if (ERRNO_CODES[key] === errno) {
  4053. this.code = key;
  4054. break;
  4055. }
  4056. }
  4057. };
  4058. this.setErrno(errno);
  4059. this.message = ERRNO_MESSAGES[errno];
  4060. if (this.stack) this.stack = demangleAll(this.stack);
  4061. };
  4062. FS.ErrnoError.prototype = new Error();
  4063. FS.ErrnoError.prototype.constructor = FS.ErrnoError;
  4064. // Some errors may happen quite a bit, to avoid overhead we reuse them (and suffer a lack of stack info)
  4065. [ERRNO_CODES.ENOENT].forEach(function(code) {
  4066. FS.genericErrors[code] = new FS.ErrnoError(code);
  4067. FS.genericErrors[code].stack = '<generic error, no stack>';
  4068. });
  4069. },staticInit:function () {
  4070. FS.ensureErrnoError();
  4071.  
  4072. FS.nameTable = new Array(4096);
  4073.  
  4074. FS.mount(MEMFS, {}, '/');
  4075.  
  4076. FS.createDefaultDirectories();
  4077. FS.createDefaultDevices();
  4078. FS.createSpecialDirectories();
  4079.  
  4080. FS.filesystems = {
  4081. 'MEMFS': MEMFS,
  4082. 'IDBFS': IDBFS,
  4083. 'NODEFS': NODEFS,
  4084. 'WORKERFS': WORKERFS,
  4085. };
  4086. },init:function (input, output, error) {
  4087. 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)');
  4088. FS.init.initialized = true;
  4089.  
  4090. FS.ensureErrnoError();
  4091.  
  4092. // Allow Module.stdin etc. to provide defaults, if none explicitly passed to us here
  4093. Module['stdin'] = input || Module['stdin'];
  4094. Module['stdout'] = output || Module['stdout'];
  4095. Module['stderr'] = error || Module['stderr'];
  4096.  
  4097. FS.createStandardStreams();
  4098. },quit:function () {
  4099. FS.init.initialized = false;
  4100. // force-flush all streams, so we get musl std streams printed out
  4101. var fflush = Module['_fflush'];
  4102. if (fflush) fflush(0);
  4103. // close all of our streams
  4104. for (var i = 0; i < FS.streams.length; i++) {
  4105. var stream = FS.streams[i];
  4106. if (!stream) {
  4107. continue;
  4108. }
  4109. FS.close(stream);
  4110. }
  4111. },getMode:function (canRead, canWrite) {
  4112. var mode = 0;
  4113. if (canRead) mode |= 292 | 73;
  4114. if (canWrite) mode |= 146;
  4115. return mode;
  4116. },joinPath:function (parts, forceRelative) {
  4117. var path = PATH.join.apply(null, parts);
  4118. if (forceRelative && path[0] == '/') path = path.substr(1);
  4119. return path;
  4120. },absolutePath:function (relative, base) {
  4121. return PATH.resolve(base, relative);
  4122. },standardizePath:function (path) {
  4123. return PATH.normalize(path);
  4124. },findObject:function (path, dontResolveLastLink) {
  4125. var ret = FS.analyzePath(path, dontResolveLastLink);
  4126. if (ret.exists) {
  4127. return ret.object;
  4128. } else {
  4129. ___setErrNo(ret.error);
  4130. return null;
  4131. }
  4132. },analyzePath:function (path, dontResolveLastLink) {
  4133. // operate from within the context of the symlink's target
  4134. try {
  4135. var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
  4136. path = lookup.path;
  4137. } catch (e) {
  4138. }
  4139. var ret = {
  4140. isRoot: false, exists: false, error: 0, name: null, path: null, object: null,
  4141. parentExists: false, parentPath: null, parentObject: null
  4142. };
  4143. try {
  4144. var lookup = FS.lookupPath(path, { parent: true });
  4145. ret.parentExists = true;
  4146. ret.parentPath = lookup.path;
  4147. ret.parentObject = lookup.node;
  4148. ret.name = PATH.basename(path);
  4149. lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
  4150. ret.exists = true;
  4151. ret.path = lookup.path;
  4152. ret.object = lookup.node;
  4153. ret.name = lookup.node.name;
  4154. ret.isRoot = lookup.path === '/';
  4155. } catch (e) {
  4156. ret.error = e.errno;
  4157. };
  4158. return ret;
  4159. },createFolder:function (parent, name, canRead, canWrite) {
  4160. var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
  4161. var mode = FS.getMode(canRead, canWrite);
  4162. return FS.mkdir(path, mode);
  4163. },createPath:function (parent, path, canRead, canWrite) {
  4164. parent = typeof parent === 'string' ? parent : FS.getPath(parent);
  4165. var parts = path.split('/').reverse();
  4166. while (parts.length) {
  4167. var part = parts.pop();
  4168. if (!part) continue;
  4169. var current = PATH.join2(parent, part);
  4170. try {
  4171. FS.mkdir(current);
  4172. } catch (e) {
  4173. // ignore EEXIST
  4174. }
  4175. parent = current;
  4176. }
  4177. return current;
  4178. },createFile:function (parent, name, properties, canRead, canWrite) {
  4179. var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
  4180. var mode = FS.getMode(canRead, canWrite);
  4181. return FS.create(path, mode);
  4182. },createDataFile:function (parent, name, data, canRead, canWrite, canOwn) {
  4183. var path = name ? PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name) : parent;
  4184. var mode = FS.getMode(canRead, canWrite);
  4185. var node = FS.create(path, mode);
  4186. if (data) {
  4187. if (typeof data === 'string') {
  4188. var arr = new Array(data.length);
  4189. for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i);
  4190. data = arr;
  4191. }
  4192. // make sure we can write to the file
  4193. FS.chmod(node, mode | 146);
  4194. var stream = FS.open(node, 'w');
  4195. FS.write(stream, data, 0, data.length, 0, canOwn);
  4196. FS.close(stream);
  4197. FS.chmod(node, mode);
  4198. }
  4199. return node;
  4200. },createDevice:function (parent, name, input, output) {
  4201. var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
  4202. var mode = FS.getMode(!!input, !!output);
  4203. if (!FS.createDevice.major) FS.createDevice.major = 64;
  4204. var dev = FS.makedev(FS.createDevice.major++, 0);
  4205. // Create a fake device that a set of stream ops to emulate
  4206. // the old behavior.
  4207. FS.registerDevice(dev, {
  4208. open: function(stream) {
  4209. stream.seekable = false;
  4210. },
  4211. close: function(stream) {
  4212. // flush any pending line data
  4213. if (output && output.buffer && output.buffer.length) {
  4214. output(10);
  4215. }
  4216. },
  4217. read: function(stream, buffer, offset, length, pos /* ignored */) {
  4218. var bytesRead = 0;
  4219. for (var i = 0; i < length; i++) {
  4220. var result;
  4221. try {
  4222. result = input();
  4223. } catch (e) {
  4224. throw new FS.ErrnoError(ERRNO_CODES.EIO);
  4225. }
  4226. if (result === undefined && bytesRead === 0) {
  4227. throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
  4228. }
  4229. if (result === null || result === undefined) break;
  4230. bytesRead++;
  4231. buffer[offset+i] = result;
  4232. }
  4233. if (bytesRead) {
  4234. stream.node.timestamp = Date.now();
  4235. }
  4236. return bytesRead;
  4237. },
  4238. write: function(stream, buffer, offset, length, pos) {
  4239. for (var i = 0; i < length; i++) {
  4240. try {
  4241. output(buffer[offset+i]);
  4242. } catch (e) {
  4243. throw new FS.ErrnoError(ERRNO_CODES.EIO);
  4244. }
  4245. }
  4246. if (length) {
  4247. stream.node.timestamp = Date.now();
  4248. }
  4249. return i;
  4250. }
  4251. });
  4252. return FS.mkdev(path, mode, dev);
  4253. },createLink:function (parent, name, target, canRead, canWrite) {
  4254. var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
  4255. return FS.symlink(target, path);
  4256. },forceLoadFile:function (obj) {
  4257. if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true;
  4258. var success = true;
  4259. if (typeof XMLHttpRequest !== 'undefined') {
  4260. throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");
  4261. } else if (Module['read']) {
  4262. // Command-line.
  4263. try {
  4264. // WARNING: Can't read binary files in V8's d8 or tracemonkey's js, as
  4265. // read() will try to parse UTF8.
  4266. obj.contents = intArrayFromString(Module['read'](obj.url), true);
  4267. obj.usedBytes = obj.contents.length;
  4268. } catch (e) {
  4269. success = false;
  4270. }
  4271. } else {
  4272. throw new Error('Cannot load without read() or XMLHttpRequest.');
  4273. }
  4274. if (!success) ___setErrNo(ERRNO_CODES.EIO);
  4275. return success;
  4276. },createLazyFile:function (parent, name, url, canRead, canWrite) {
  4277. // Lazy chunked Uint8Array (implements get and length from Uint8Array). Actual getting is abstracted away for eventual reuse.
  4278. function LazyUint8Array() {
  4279. this.lengthKnown = false;
  4280. this.chunks = []; // Loaded chunks. Index is the chunk number
  4281. }
  4282. LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) {
  4283. if (idx > this.length-1 || idx < 0) {
  4284. return undefined;
  4285. }
  4286. var chunkOffset = idx % this.chunkSize;
  4287. var chunkNum = (idx / this.chunkSize)|0;
  4288. return this.getter(chunkNum)[chunkOffset];
  4289. }
  4290. LazyUint8Array.prototype.setDataGetter = function LazyUint8Array_setDataGetter(getter) {
  4291. this.getter = getter;
  4292. }
  4293. LazyUint8Array.prototype.cacheLength = function LazyUint8Array_cacheLength() {
  4294. // Find length
  4295. var xhr = new XMLHttpRequest();
  4296. xhr.open('HEAD', url, false);
  4297. xhr.send(null);
  4298. if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
  4299. var datalength = Number(xhr.getResponseHeader("Content-length"));
  4300. var header;
  4301. var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes";
  4302. var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip";
  4303.  
  4304. var chunkSize = 1024*1024; // Chunk size in bytes
  4305.  
  4306. if (!hasByteServing) chunkSize = datalength;
  4307.  
  4308. // Function to get a range from the remote URL.
  4309. var doXHR = (function(from, to) {
  4310. if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!");
  4311. if (to > datalength-1) throw new Error("only " + datalength + " bytes available! programmer error!");
  4312.  
  4313. // TODO: Use mozResponseArrayBuffer, responseStream, etc. if available.
  4314. var xhr = new XMLHttpRequest();
  4315. xhr.open('GET', url, false);
  4316. if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to);
  4317.  
  4318. // Some hints to the browser that we want binary data.
  4319. if (typeof Uint8Array != 'undefined') xhr.responseType = 'arraybuffer';
  4320. if (xhr.overrideMimeType) {
  4321. xhr.overrideMimeType('text/plain; charset=x-user-defined');
  4322. }
  4323.  
  4324. xhr.send(null);
  4325. if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
  4326. if (xhr.response !== undefined) {
  4327. return new Uint8Array(xhr.response || []);
  4328. } else {
  4329. return intArrayFromString(xhr.responseText || '', true);
  4330. }
  4331. });
  4332. var lazyArray = this;
  4333. lazyArray.setDataGetter(function(chunkNum) {
  4334. var start = chunkNum * chunkSize;
  4335. var end = (chunkNum+1) * chunkSize - 1; // including this byte
  4336. end = Math.min(end, datalength-1); // if datalength-1 is selected, this is the last block
  4337. if (typeof(lazyArray.chunks[chunkNum]) === "undefined") {
  4338. lazyArray.chunks[chunkNum] = doXHR(start, end);
  4339. }
  4340. if (typeof(lazyArray.chunks[chunkNum]) === "undefined") throw new Error("doXHR failed!");
  4341. return lazyArray.chunks[chunkNum];
  4342. });
  4343.  
  4344. if (usesGzip || !datalength) {
  4345. // if the server uses gzip or doesn't supply the length, we have to download the whole file to get the (uncompressed) length
  4346. chunkSize = datalength = 1; // this will force getter(0)/doXHR do download the whole file
  4347. datalength = this.getter(0).length;
  4348. chunkSize = datalength;
  4349. console.log("LazyFiles on gzip forces download of the whole file when length is accessed");
  4350. }
  4351.  
  4352. this._length = datalength;
  4353. this._chunkSize = chunkSize;
  4354. this.lengthKnown = true;
  4355. }
  4356. if (typeof XMLHttpRequest !== 'undefined') {
  4357. if (!ENVIRONMENT_IS_WORKER) throw 'Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc';
  4358. var lazyArray = new LazyUint8Array();
  4359. Object.defineProperties(lazyArray, {
  4360. length: {
  4361. get: function() {
  4362. if(!this.lengthKnown) {
  4363. this.cacheLength();
  4364. }
  4365. return this._length;
  4366. }
  4367. },
  4368. chunkSize: {
  4369. get: function() {
  4370. if(!this.lengthKnown) {
  4371. this.cacheLength();
  4372. }
  4373. return this._chunkSize;
  4374. }
  4375. }
  4376. });
  4377.  
  4378. var properties = { isDevice: false, contents: lazyArray };
  4379. } else {
  4380. var properties = { isDevice: false, url: url };
  4381. }
  4382.  
  4383. var node = FS.createFile(parent, name, properties, canRead, canWrite);
  4384. // This is a total hack, but I want to get this lazy file code out of the
  4385. // core of MEMFS. If we want to keep this lazy file concept I feel it should
  4386. // be its own thin LAZYFS proxying calls to MEMFS.
  4387. if (properties.contents) {
  4388. node.contents = properties.contents;
  4389. } else if (properties.url) {
  4390. node.contents = null;
  4391. node.url = properties.url;
  4392. }
  4393. // Add a function that defers querying the file size until it is asked the first time.
  4394. Object.defineProperties(node, {
  4395. usedBytes: {
  4396. get: function() { return this.contents.length; }
  4397. }
  4398. });
  4399. // override each stream op with one that tries to force load the lazy file first
  4400. var stream_ops = {};
  4401. var keys = Object.keys(node.stream_ops);
  4402. keys.forEach(function(key) {
  4403. var fn = node.stream_ops[key];
  4404. stream_ops[key] = function forceLoadLazyFile() {
  4405. if (!FS.forceLoadFile(node)) {
  4406. throw new FS.ErrnoError(ERRNO_CODES.EIO);
  4407. }
  4408. return fn.apply(null, arguments);
  4409. };
  4410. });
  4411. // use a custom read function
  4412. stream_ops.read = function stream_ops_read(stream, buffer, offset, length, position) {
  4413. if (!FS.forceLoadFile(node)) {
  4414. throw new FS.ErrnoError(ERRNO_CODES.EIO);
  4415. }
  4416. var contents = stream.node.contents;
  4417. if (position >= contents.length)
  4418. return 0;
  4419. var size = Math.min(contents.length - position, length);
  4420. assert(size >= 0);
  4421. if (contents.slice) { // normal array
  4422. for (var i = 0; i < size; i++) {
  4423. buffer[offset + i] = contents[position + i];
  4424. }
  4425. } else {
  4426. for (var i = 0; i < size; i++) { // LazyUint8Array from sync binary XHR
  4427. buffer[offset + i] = contents.get(position + i);
  4428. }
  4429. }
  4430. return size;
  4431. };
  4432. node.stream_ops = stream_ops;
  4433. return node;
  4434. },createPreloadedFile:function (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) {
  4435. Browser.init(); // XXX perhaps this method should move onto Browser?
  4436. // TODO we should allow people to just pass in a complete filename instead
  4437. // of parent and name being that we just join them anyways
  4438. var fullname = name ? PATH.resolve(PATH.join2(parent, name)) : parent;
  4439. var dep = getUniqueRunDependency('cp ' + fullname); // might have several active requests for the same fullname
  4440. function processData(byteArray) {
  4441. function finish(byteArray) {
  4442. if (preFinish) preFinish();
  4443. if (!dontCreateFile) {
  4444. FS.createDataFile(parent, name, byteArray, canRead, canWrite, canOwn);
  4445. }
  4446. if (onload) onload();
  4447. removeRunDependency(dep);
  4448. }
  4449. var handled = false;
  4450. Module['preloadPlugins'].forEach(function(plugin) {
  4451. if (handled) return;
  4452. if (plugin['canHandle'](fullname)) {
  4453. plugin['handle'](byteArray, fullname, finish, function() {
  4454. if (onerror) onerror();
  4455. removeRunDependency(dep);
  4456. });
  4457. handled = true;
  4458. }
  4459. });
  4460. if (!handled) finish(byteArray);
  4461. }
  4462. addRunDependency(dep);
  4463. if (typeof url == 'string') {
  4464. Browser.asyncLoad(url, function(byteArray) {
  4465. processData(byteArray);
  4466. }, onerror);
  4467. } else {
  4468. processData(url);
  4469. }
  4470. },indexedDB:function () {
  4471. return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
  4472. },DB_NAME:function () {
  4473. return 'EM_FS_' + window.location.pathname;
  4474. },DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:function (paths, onload, onerror) {
  4475. onload = onload || function(){};
  4476. onerror = onerror || function(){};
  4477. var indexedDB = FS.indexedDB();
  4478. try {
  4479. var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION);
  4480. } catch (e) {
  4481. return onerror(e);
  4482. }
  4483. openRequest.onupgradeneeded = function openRequest_onupgradeneeded() {
  4484. console.log('creating db');
  4485. var db = openRequest.result;
  4486. db.createObjectStore(FS.DB_STORE_NAME);
  4487. };
  4488. openRequest.onsuccess = function openRequest_onsuccess() {
  4489. var db = openRequest.result;
  4490. var transaction = db.transaction([FS.DB_STORE_NAME], 'readwrite');
  4491. var files = transaction.objectStore(FS.DB_STORE_NAME);
  4492. var ok = 0, fail = 0, total = paths.length;
  4493. function finish() {
  4494. if (fail == 0) onload(); else onerror();
  4495. }
  4496. paths.forEach(function(path) {
  4497. var putRequest = files.put(FS.analyzePath(path).object.contents, path);
  4498. putRequest.onsuccess = function putRequest_onsuccess() { ok++; if (ok + fail == total) finish() };
  4499. putRequest.onerror = function putRequest_onerror() { fail++; if (ok + fail == total) finish() };
  4500. });
  4501. transaction.onerror = onerror;
  4502. };
  4503. openRequest.onerror = onerror;
  4504. },loadFilesFromDB:function (paths, onload, onerror) {
  4505. onload = onload || function(){};
  4506. onerror = onerror || function(){};
  4507. var indexedDB = FS.indexedDB();
  4508. try {
  4509. var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION);
  4510. } catch (e) {
  4511. return onerror(e);
  4512. }
  4513. openRequest.onupgradeneeded = onerror; // no database to load from
  4514. openRequest.onsuccess = function openRequest_onsuccess() {
  4515. var db = openRequest.result;
  4516. try {
  4517. var transaction = db.transaction([FS.DB_STORE_NAME], 'readonly');
  4518. } catch(e) {
  4519. onerror(e);
  4520. return;
  4521. }
  4522. var files = transaction.objectStore(FS.DB_STORE_NAME);
  4523. var ok = 0, fail = 0, total = paths.length;
  4524. function finish() {
  4525. if (fail == 0) onload(); else onerror();
  4526. }
  4527. paths.forEach(function(path) {
  4528. var getRequest = files.get(path);
  4529. getRequest.onsuccess = function getRequest_onsuccess() {
  4530. if (FS.analyzePath(path).exists) {
  4531. FS.unlink(path);
  4532. }
  4533. FS.createDataFile(PATH.dirname(path), PATH.basename(path), getRequest.result, true, true, true);
  4534. ok++;
  4535. if (ok + fail == total) finish();
  4536. };
  4537. getRequest.onerror = function getRequest_onerror() { fail++; if (ok + fail == total) finish() };
  4538. });
  4539. transaction.onerror = onerror;
  4540. };
  4541. openRequest.onerror = onerror;
  4542. }};var SYSCALLS={DEFAULT_POLLMASK:5,mappings:{},umask:511,calculateAt:function (dirfd, path) {
  4543. if (path[0] !== '/') {
  4544. // relative path
  4545. var dir;
  4546. if (dirfd === -100) {
  4547. dir = FS.cwd();
  4548. } else {
  4549. var dirstream = FS.getStream(dirfd);
  4550. if (!dirstream) throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  4551. dir = dirstream.path;
  4552. }
  4553. path = PATH.join2(dir, path);
  4554. }
  4555. return path;
  4556. },doStat:function (func, path, buf) {
  4557. try {
  4558. var stat = func(path);
  4559. } catch (e) {
  4560. if (e && e.node && PATH.normalize(path) !== PATH.normalize(FS.getPath(e.node))) {
  4561. // an error occurred while trying to look up the path; we should just report ENOTDIR
  4562. return -ERRNO_CODES.ENOTDIR;
  4563. }
  4564. throw e;
  4565. }
  4566. HEAP32[((buf)>>2)]=stat.dev;
  4567. HEAP32[(((buf)+(4))>>2)]=0;
  4568. HEAP32[(((buf)+(8))>>2)]=stat.ino;
  4569. HEAP32[(((buf)+(12))>>2)]=stat.mode;
  4570. HEAP32[(((buf)+(16))>>2)]=stat.nlink;
  4571. HEAP32[(((buf)+(20))>>2)]=stat.uid;
  4572. HEAP32[(((buf)+(24))>>2)]=stat.gid;
  4573. HEAP32[(((buf)+(28))>>2)]=stat.rdev;
  4574. HEAP32[(((buf)+(32))>>2)]=0;
  4575. HEAP32[(((buf)+(36))>>2)]=stat.size;
  4576. HEAP32[(((buf)+(40))>>2)]=4096;
  4577. HEAP32[(((buf)+(44))>>2)]=stat.blocks;
  4578. HEAP32[(((buf)+(48))>>2)]=(stat.atime.getTime() / 1000)|0;
  4579. HEAP32[(((buf)+(52))>>2)]=0;
  4580. HEAP32[(((buf)+(56))>>2)]=(stat.mtime.getTime() / 1000)|0;
  4581. HEAP32[(((buf)+(60))>>2)]=0;
  4582. HEAP32[(((buf)+(64))>>2)]=(stat.ctime.getTime() / 1000)|0;
  4583. HEAP32[(((buf)+(68))>>2)]=0;
  4584. HEAP32[(((buf)+(72))>>2)]=stat.ino;
  4585. return 0;
  4586. },doMsync:function (addr, stream, len, flags) {
  4587. var buffer = new Uint8Array(HEAPU8.subarray(addr, addr + len));
  4588. FS.msync(stream, buffer, 0, len, flags);
  4589. },doMkdir:function (path, mode) {
  4590. // remove a trailing slash, if one - /a/b/ has basename of '', but
  4591. // we want to create b in the context of this function
  4592. path = PATH.normalize(path);
  4593. if (path[path.length-1] === '/') path = path.substr(0, path.length-1);
  4594. FS.mkdir(path, mode, 0);
  4595. return 0;
  4596. },doMknod:function (path, mode, dev) {
  4597. // we don't want this in the JS API as it uses mknod to create all nodes.
  4598. switch (mode & 61440) {
  4599. case 32768:
  4600. case 8192:
  4601. case 24576:
  4602. case 4096:
  4603. case 49152:
  4604. break;
  4605. default: return -ERRNO_CODES.EINVAL;
  4606. }
  4607. FS.mknod(path, mode, dev);
  4608. return 0;
  4609. },doReadlink:function (path, buf, bufsize) {
  4610. if (bufsize <= 0) return -ERRNO_CODES.EINVAL;
  4611. var ret = FS.readlink(path);
  4612.  
  4613. var len = Math.min(bufsize, lengthBytesUTF8(ret));
  4614. var endChar = HEAP8[buf+len];
  4615. stringToUTF8(ret, buf, bufsize+1);
  4616. // readlink is one of the rare functions that write out a C string, but does never append a null to the output buffer(!)
  4617. // stringToUTF8() always appends a null byte, so restore the character under the null byte after the write.
  4618. HEAP8[buf+len] = endChar;
  4619.  
  4620. return len;
  4621. },doAccess:function (path, amode) {
  4622. if (amode & ~7) {
  4623. // need a valid mode
  4624. return -ERRNO_CODES.EINVAL;
  4625. }
  4626. var node;
  4627. var lookup = FS.lookupPath(path, { follow: true });
  4628. node = lookup.node;
  4629. var perms = '';
  4630. if (amode & 4) perms += 'r';
  4631. if (amode & 2) perms += 'w';
  4632. if (amode & 1) perms += 'x';
  4633. if (perms /* otherwise, they've just passed F_OK */ && FS.nodePermissions(node, perms)) {
  4634. return -ERRNO_CODES.EACCES;
  4635. }
  4636. return 0;
  4637. },doDup:function (path, flags, suggestFD) {
  4638. var suggest = FS.getStream(suggestFD);
  4639. if (suggest) FS.close(suggest);
  4640. return FS.open(path, flags, 0, suggestFD, suggestFD).fd;
  4641. },doReadv:function (stream, iov, iovcnt, offset) {
  4642. var ret = 0;
  4643. for (var i = 0; i < iovcnt; i++) {
  4644. var ptr = HEAP32[(((iov)+(i*8))>>2)];
  4645. var len = HEAP32[(((iov)+(i*8 + 4))>>2)];
  4646. var curr = FS.read(stream, HEAP8,ptr, len, offset);
  4647. if (curr < 0) return -1;
  4648. ret += curr;
  4649. if (curr < len) break; // nothing more to read
  4650. }
  4651. return ret;
  4652. },doWritev:function (stream, iov, iovcnt, offset) {
  4653. var ret = 0;
  4654. for (var i = 0; i < iovcnt; i++) {
  4655. var ptr = HEAP32[(((iov)+(i*8))>>2)];
  4656. var len = HEAP32[(((iov)+(i*8 + 4))>>2)];
  4657. var curr = FS.write(stream, HEAP8,ptr, len, offset);
  4658. if (curr < 0) return -1;
  4659. ret += curr;
  4660. }
  4661. return ret;
  4662. },varargs:0,get:function (varargs) {
  4663. SYSCALLS.varargs += 4;
  4664. var ret = HEAP32[(((SYSCALLS.varargs)-(4))>>2)];
  4665. return ret;
  4666. },getStr:function () {
  4667. var ret = Pointer_stringify(SYSCALLS.get());
  4668. return ret;
  4669. },getStreamFromFD:function () {
  4670. var stream = FS.getStream(SYSCALLS.get());
  4671. if (!stream) throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  4672. return stream;
  4673. },getSocketFromFD:function () {
  4674. var socket = SOCKFS.getSocket(SYSCALLS.get());
  4675. if (!socket) throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  4676. return socket;
  4677. },getSocketAddress:function (allowNull) {
  4678. var addrp = SYSCALLS.get(), addrlen = SYSCALLS.get();
  4679. if (allowNull && addrp === 0) return null;
  4680. var info = __read_sockaddr(addrp, addrlen);
  4681. if (info.errno) throw new FS.ErrnoError(info.errno);
  4682. info.addr = DNS.lookup_addr(info.addr) || info.addr;
  4683. return info;
  4684. },get64:function () {
  4685. var low = SYSCALLS.get(), high = SYSCALLS.get();
  4686. if (low >= 0) assert(high === 0);
  4687. else assert(high === -1);
  4688. return low;
  4689. },getZero:function () {
  4690. assert(SYSCALLS.get() === 0);
  4691. }};function ___syscall191(which, varargs) {SYSCALLS.varargs = varargs;
  4692. try {
  4693. // ugetrlimit
  4694. var resource = SYSCALLS.get(), rlim = SYSCALLS.get();
  4695. HEAP32[((rlim)>>2)]=-1; // RLIM_INFINITY
  4696. HEAP32[(((rlim)+(4))>>2)]=-1; // RLIM_INFINITY
  4697. HEAP32[(((rlim)+(8))>>2)]=-1; // RLIM_INFINITY
  4698. HEAP32[(((rlim)+(12))>>2)]=-1; // RLIM_INFINITY
  4699. return 0; // just report no limits
  4700. } catch (e) {
  4701. if (typeof FS === 'undefined' || !(e instanceof FS.ErrnoError)) abort(e);
  4702. return -e.errno;
  4703. }
  4704. }
  4705.  
  4706.  
  4707. Module["_bitshift64Shl"] = _bitshift64Shl;
  4708.  
  4709. function _pthread_cleanup_pop() {
  4710. assert(_pthread_cleanup_push.level == __ATEXIT__.length, 'cannot pop if something else added meanwhile!');
  4711. __ATEXIT__.pop();
  4712. _pthread_cleanup_push.level = __ATEXIT__.length;
  4713. }
  4714.  
  4715. function _abort() {
  4716. Module['abort']();
  4717. }
  4718.  
  4719. function ___lock() {}
  4720.  
  4721. function ___unlock() {}
  4722.  
  4723. function ___syscall6(which, varargs) {SYSCALLS.varargs = varargs;
  4724. try {
  4725. // close
  4726. var stream = SYSCALLS.getStreamFromFD();
  4727. FS.close(stream);
  4728. return 0;
  4729. } catch (e) {
  4730. if (typeof FS === 'undefined' || !(e instanceof FS.ErrnoError)) abort(e);
  4731. return -e.errno;
  4732. }
  4733. }
  4734.  
  4735.  
  4736.  
  4737. var cttz_i8 = allocate([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0], "i8", ALLOC_STATIC);
  4738. Module["_llvm_cttz_i32"] = _llvm_cttz_i32;
  4739. Module["___udivmoddi4"] = ___udivmoddi4;
  4740. Module["___udivdi3"] = ___udivdi3;
  4741.  
  4742.  
  4743.  
  4744. Module["___muldsi3"] = ___muldsi3;
  4745. Module["___muldi3"] = ___muldi3;
  4746.  
  4747.  
  4748. Module["_sbrk"] = _sbrk;
  4749.  
  4750. function ___syscall146(which, varargs) {SYSCALLS.varargs = varargs;
  4751. try {
  4752. // writev
  4753. var stream = SYSCALLS.getStreamFromFD(), iov = SYSCALLS.get(), iovcnt = SYSCALLS.get();
  4754. return SYSCALLS.doWritev(stream, iov, iovcnt);
  4755. } catch (e) {
  4756. if (typeof FS === 'undefined' || !(e instanceof FS.ErrnoError)) abort(e);
  4757. return -e.errno;
  4758. }
  4759. }
  4760.  
  4761.  
  4762. Module["___uremdi3"] = ___uremdi3;
  4763.  
  4764.  
  4765. function _emscripten_memcpy_big(dest, src, num) {
  4766. HEAPU8.set(HEAPU8.subarray(src, src+num), dest);
  4767. return dest;
  4768. }
  4769. Module["_memcpy"] = _memcpy;
  4770.  
  4771. function ___syscall340(which, varargs) {SYSCALLS.varargs = varargs;
  4772. try {
  4773. // prlimit64
  4774. var pid = SYSCALLS.get(), resource = SYSCALLS.get(), new_limit = SYSCALLS.get(), old_limit = SYSCALLS.get();
  4775. if (old_limit) { // just report no limits
  4776. HEAP32[((old_limit)>>2)]=-1; // RLIM_INFINITY
  4777. HEAP32[(((old_limit)+(4))>>2)]=-1; // RLIM_INFINITY
  4778. HEAP32[(((old_limit)+(8))>>2)]=-1; // RLIM_INFINITY
  4779. HEAP32[(((old_limit)+(12))>>2)]=-1; // RLIM_INFINITY
  4780. }
  4781. return 0;
  4782. } catch (e) {
  4783. if (typeof FS === 'undefined' || !(e instanceof FS.ErrnoError)) abort(e);
  4784. return -e.errno;
  4785. }
  4786. }
  4787.  
  4788. function ___syscall192(which, varargs) {SYSCALLS.varargs = varargs;
  4789. try {
  4790. // mmap2
  4791. var addr = SYSCALLS.get(), len = SYSCALLS.get(), prot = SYSCALLS.get(), flags = SYSCALLS.get(), fd = SYSCALLS.get(), off = SYSCALLS.get()
  4792. off <<= 12; // undo pgoffset
  4793. var ptr;
  4794. var allocated = false;
  4795. if (fd === -1) {
  4796. ptr = _malloc(len);
  4797. if (!ptr) return -ERRNO_CODES.ENOMEM;
  4798. _memset(ptr, 0, len);
  4799. allocated = true;
  4800. } else {
  4801. var info = FS.getStream(fd);
  4802. if (!info) return -ERRNO_CODES.EBADF;
  4803. var res = FS.mmap(info, HEAPU8, addr, len, off, prot, flags);
  4804. ptr = res.ptr;
  4805. allocated = res.allocated;
  4806. }
  4807. SYSCALLS.mappings[ptr] = { malloc: ptr, len: len, allocated: allocated, fd: fd, flags: flags };
  4808. return ptr;
  4809. } catch (e) {
  4810. if (typeof FS === 'undefined' || !(e instanceof FS.ErrnoError)) abort(e);
  4811. return -e.errno;
  4812. }
  4813. }
  4814.  
  4815.  
  4816. function __exit(status) {
  4817. // void _exit(int status);
  4818. // http://pubs.opengroup.org/onlinepubs/000095399/functions/exit.html
  4819. Module['exit'](status);
  4820. }function _exit(status) {
  4821. __exit(status);
  4822. }
  4823.  
  4824.  
  4825. function _execl(/* ... */) {
  4826. // int execl(const char *path, const char *arg0, ... /*, (char *)0 */);
  4827. // http://pubs.opengroup.org/onlinepubs/009695399/functions/exec.html
  4828. // We don't support executing external code.
  4829. ___setErrNo(ERRNO_CODES.ENOEXEC);
  4830. return -1;
  4831. }function _execve() {
  4832. return _execl.apply(null, arguments)
  4833. }
  4834.  
  4835.  
  4836. Module["_pthread_self"] = _pthread_self;
  4837.  
  4838. function ___syscall140(which, varargs) {SYSCALLS.varargs = varargs;
  4839. try {
  4840. // llseek
  4841. var stream = SYSCALLS.getStreamFromFD(), offset_high = SYSCALLS.get(), offset_low = SYSCALLS.get(), result = SYSCALLS.get(), whence = SYSCALLS.get();
  4842. var offset = offset_low;
  4843. assert(offset_high === 0);
  4844. FS.llseek(stream, offset, whence);
  4845. HEAP32[((result)>>2)]=stream.position;
  4846. if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null; // reset readdir state
  4847. return 0;
  4848. } catch (e) {
  4849. if (typeof FS === 'undefined' || !(e instanceof FS.ErrnoError)) abort(e);
  4850. return -e.errno;
  4851. }
  4852. }
  4853.  
  4854. function ___syscall75(which, varargs) {SYSCALLS.varargs = varargs;
  4855. try {
  4856. // setrlimit
  4857. return 0; // no-op
  4858. } catch (e) {
  4859. if (typeof FS === 'undefined' || !(e instanceof FS.ErrnoError)) abort(e);
  4860. return -e.errno;
  4861. }
  4862. }
  4863.  
  4864. function ___syscall54(which, varargs) {SYSCALLS.varargs = varargs;
  4865. try {
  4866. // ioctl
  4867. var stream = SYSCALLS.getStreamFromFD(), op = SYSCALLS.get();
  4868. switch (op) {
  4869. case 21505: {
  4870. if (!stream.tty) return -ERRNO_CODES.ENOTTY;
  4871. return 0;
  4872. }
  4873. case 21506: {
  4874. if (!stream.tty) return -ERRNO_CODES.ENOTTY;
  4875. return 0; // no-op, not actually adjusting terminal settings
  4876. }
  4877. case 21519: {
  4878. if (!stream.tty) return -ERRNO_CODES.ENOTTY;
  4879. var argp = SYSCALLS.get();
  4880. HEAP32[((argp)>>2)]=0;
  4881. return 0;
  4882. }
  4883. case 21520: {
  4884. if (!stream.tty) return -ERRNO_CODES.ENOTTY;
  4885. return -ERRNO_CODES.EINVAL; // not supported
  4886. }
  4887. case 21531: {
  4888. var argp = SYSCALLS.get();
  4889. return FS.ioctl(stream, op, argp);
  4890. }
  4891. default: abort('bad ioctl syscall ' + op);
  4892. }
  4893. } catch (e) {
  4894. if (typeof FS === 'undefined' || !(e instanceof FS.ErrnoError)) abort(e);
  4895. return -e.errno;
  4896. }
  4897. }
  4898. FS.staticInit();__ATINIT__.unshift(function() { if (!Module["noFSInit"] && !FS.init.initialized) FS.init() });__ATMAIN__.push(function() { FS.ignorePermissions = false });__ATEXIT__.push(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;Module["FS_unlink"] = FS.unlink;;
  4899. __ATINIT__.unshift(function() { TTY.init() });__ATEXIT__.push(function() { TTY.shutdown() });;
  4900. if (ENVIRONMENT_IS_NODE) { var fs = require("fs"); var NODEJS_PATH = require("path"); NODEFS.staticInit(); };
  4901. DYNAMICTOP_PTR = allocate(1, "i32", ALLOC_STATIC);
  4902.  
  4903. STACK_BASE = STACKTOP = Runtime.alignMemory(STATICTOP);
  4904.  
  4905. STACK_MAX = STACK_BASE + TOTAL_STACK;
  4906.  
  4907. DYNAMIC_BASE = Runtime.alignMemory(STACK_MAX);
  4908.  
  4909. HEAP32[DYNAMICTOP_PTR>>2] = DYNAMIC_BASE;
  4910.  
  4911. staticSealed = true; // seal the static portion of memory
  4912.  
  4913. assert(DYNAMIC_BASE < TOTAL_MEMORY, "TOTAL_MEMORY not big enough for stack");
  4914.  
  4915.  
  4916.  
  4917. function nullFunc_ii(x) { Module["printErr"]("Invalid function pointer called with signature 'ii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"); Module["printErr"]("Build with ASSERTIONS=2 for more info.");abort(x) }
  4918.  
  4919. function nullFunc_iiii(x) { Module["printErr"]("Invalid function pointer called with signature 'iiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"); Module["printErr"]("Build with ASSERTIONS=2 for more info.");abort(x) }
  4920.  
  4921. function nullFunc_vi(x) { Module["printErr"]("Invalid function pointer called with signature 'vi'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"); Module["printErr"]("Build with ASSERTIONS=2 for more info.");abort(x) }
  4922.  
  4923. function invoke_ii(index,a1) {
  4924. try {
  4925. return Module["dynCall_ii"](index,a1);
  4926. } catch(e) {
  4927. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  4928. asm["setThrew"](1, 0);
  4929. }
  4930. }
  4931.  
  4932. function invoke_iiii(index,a1,a2,a3) {
  4933. try {
  4934. return Module["dynCall_iiii"](index,a1,a2,a3);
  4935. } catch(e) {
  4936. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  4937. asm["setThrew"](1, 0);
  4938. }
  4939. }
  4940.  
  4941. function invoke_vi(index,a1) {
  4942. try {
  4943. Module["dynCall_vi"](index,a1);
  4944. } catch(e) {
  4945. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  4946. asm["setThrew"](1, 0);
  4947. }
  4948. }
  4949.  
  4950. Module.asmGlobalArg = { "Math": Math, "Int8Array": Int8Array, "Int16Array": Int16Array, "Int32Array": Int32Array, "Uint8Array": Uint8Array, "Uint16Array": Uint16Array, "Uint32Array": Uint32Array, "Float32Array": Float32Array, "Float64Array": Float64Array, "NaN": NaN, "Infinity": Infinity };
  4951.  
  4952. Module.asmLibraryArg = { "abort": abort, "assert": assert, "enlargeMemory": enlargeMemory, "getTotalMemory": getTotalMemory, "abortOnCannotGrowMemory": abortOnCannotGrowMemory, "abortStackOverflow": abortStackOverflow, "nullFunc_ii": nullFunc_ii, "nullFunc_iiii": nullFunc_iiii, "nullFunc_vi": nullFunc_vi, "invoke_ii": invoke_ii, "invoke_iiii": invoke_iiii, "invoke_vi": invoke_vi, "_pthread_cleanup_pop": _pthread_cleanup_pop, "_execve": _execve, "___syscall340": ___syscall340, "___lock": ___lock, "___syscall75": ___syscall75, "_abort": _abort, "___setErrNo": ___setErrNo, "___syscall6": ___syscall6, "___syscall192": ___syscall192, "___syscall191": ___syscall191, "___syscall146": ___syscall146, "_pthread_cleanup_push": _pthread_cleanup_push, "_emscripten_memcpy_big": _emscripten_memcpy_big, "___syscall54": ___syscall54, "___unlock": ___unlock, "___syscall140": ___syscall140, "_exit": _exit, "__exit": __exit, "_execl": _execl, "STACKTOP": STACKTOP, "STACK_MAX": STACK_MAX, "DYNAMICTOP_PTR": DYNAMICTOP_PTR, "tempDoublePtr": tempDoublePtr, "ABORT": ABORT, "cttz_i8": cttz_i8 };
  4953. // EMSCRIPTEN_START_ASM
  4954. var asm = (function(global, env, buffer) {
  4955. 'almost asm';
  4956.  
  4957.  
  4958. var HEAP8 = new global.Int8Array(buffer);
  4959. var HEAP16 = new global.Int16Array(buffer);
  4960. var HEAP32 = new global.Int32Array(buffer);
  4961. var HEAPU8 = new global.Uint8Array(buffer);
  4962. var HEAPU16 = new global.Uint16Array(buffer);
  4963. var HEAPU32 = new global.Uint32Array(buffer);
  4964. var HEAPF32 = new global.Float32Array(buffer);
  4965. var HEAPF64 = new global.Float64Array(buffer);
  4966.  
  4967.  
  4968. var STACKTOP=env.STACKTOP|0;
  4969. var STACK_MAX=env.STACK_MAX|0;
  4970. var DYNAMICTOP_PTR=env.DYNAMICTOP_PTR|0;
  4971. var tempDoublePtr=env.tempDoublePtr|0;
  4972. var ABORT=env.ABORT|0;
  4973. var cttz_i8=env.cttz_i8|0;
  4974.  
  4975. var __THREW__ = 0;
  4976. var threwValue = 0;
  4977. var setjmpId = 0;
  4978. var undef = 0;
  4979. var nan = global.NaN, inf = global.Infinity;
  4980. var tempInt = 0, tempBigInt = 0, tempBigIntP = 0, tempBigIntS = 0, tempBigIntR = 0.0, tempBigIntI = 0, tempBigIntD = 0, tempValue = 0, tempDouble = 0.0;
  4981. var tempRet0 = 0;
  4982.  
  4983. var Math_floor=global.Math.floor;
  4984. var Math_abs=global.Math.abs;
  4985. var Math_sqrt=global.Math.sqrt;
  4986. var Math_pow=global.Math.pow;
  4987. var Math_cos=global.Math.cos;
  4988. var Math_sin=global.Math.sin;
  4989. var Math_tan=global.Math.tan;
  4990. var Math_acos=global.Math.acos;
  4991. var Math_asin=global.Math.asin;
  4992. var Math_atan=global.Math.atan;
  4993. var Math_atan2=global.Math.atan2;
  4994. var Math_exp=global.Math.exp;
  4995. var Math_log=global.Math.log;
  4996. var Math_ceil=global.Math.ceil;
  4997. var Math_imul=global.Math.imul;
  4998. var Math_min=global.Math.min;
  4999. var Math_max=global.Math.max;
  5000. var Math_clz32=global.Math.clz32;
  5001. var abort=env.abort;
  5002. var assert=env.assert;
  5003. var enlargeMemory=env.enlargeMemory;
  5004. var getTotalMemory=env.getTotalMemory;
  5005. var abortOnCannotGrowMemory=env.abortOnCannotGrowMemory;
  5006. var abortStackOverflow=env.abortStackOverflow;
  5007. var nullFunc_ii=env.nullFunc_ii;
  5008. var nullFunc_iiii=env.nullFunc_iiii;
  5009. var nullFunc_vi=env.nullFunc_vi;
  5010. var invoke_ii=env.invoke_ii;
  5011. var invoke_iiii=env.invoke_iiii;
  5012. var invoke_vi=env.invoke_vi;
  5013. var _pthread_cleanup_pop=env._pthread_cleanup_pop;
  5014. var _execve=env._execve;
  5015. var ___syscall340=env.___syscall340;
  5016. var ___lock=env.___lock;
  5017. var ___syscall75=env.___syscall75;
  5018. var _abort=env._abort;
  5019. var ___setErrNo=env.___setErrNo;
  5020. var ___syscall6=env.___syscall6;
  5021. var ___syscall192=env.___syscall192;
  5022. var ___syscall191=env.___syscall191;
  5023. var ___syscall146=env.___syscall146;
  5024. var _pthread_cleanup_push=env._pthread_cleanup_push;
  5025. var _emscripten_memcpy_big=env._emscripten_memcpy_big;
  5026. var ___syscall54=env.___syscall54;
  5027. var ___unlock=env.___unlock;
  5028. var ___syscall140=env.___syscall140;
  5029. var _exit=env._exit;
  5030. var __exit=env.__exit;
  5031. var _execl=env._execl;
  5032. var tempFloat = 0.0;
  5033.  
  5034. // EMSCRIPTEN_START_FUNCS
  5035.  
  5036. function stackAlloc(size) {
  5037. size = size|0;
  5038. var ret = 0;
  5039. ret = STACKTOP;
  5040. STACKTOP = (STACKTOP + size)|0;
  5041. STACKTOP = (STACKTOP + 15)&-16;
  5042. if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(size|0);
  5043.  
  5044. return ret|0;
  5045. }
  5046. function stackSave() {
  5047. return STACKTOP|0;
  5048. }
  5049. function stackRestore(top) {
  5050. top = top|0;
  5051. STACKTOP = top;
  5052. }
  5053. function establishStackSpace(stackBase, stackMax) {
  5054. stackBase = stackBase|0;
  5055. stackMax = stackMax|0;
  5056. STACKTOP = stackBase;
  5057. STACK_MAX = stackMax;
  5058. }
  5059.  
  5060. function setThrew(threw, value) {
  5061. threw = threw|0;
  5062. value = value|0;
  5063. if ((__THREW__|0) == 0) {
  5064. __THREW__ = threw;
  5065. threwValue = value;
  5066. }
  5067. }
  5068.  
  5069. function setTempRet0(value) {
  5070. value = value|0;
  5071. tempRet0 = value;
  5072. }
  5073. function getTempRet0() {
  5074. return tempRet0|0;
  5075. }
  5076.  
  5077. function _main($0,$1) {
  5078. $0 = $0|0;
  5079. $1 = $1|0;
  5080. var $10 = 0, $100 = 0, $101 = 0, $102 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0;
  5081. var $26 = 0, $27 = 0, $28 = 0, $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0;
  5082. var $44 = 0, $45 = 0, $46 = 0, $47 = 0, $48 = 0, $49 = 0, $5 = 0, $50 = 0, $51 = 0, $52 = 0, $53 = 0, $54 = 0, $55 = 0, $56 = 0, $57 = 0, $58 = 0, $59 = 0, $6 = 0, $60 = 0, $61 = 0;
  5083. var $62 = 0, $63 = 0, $64 = 0, $65 = 0, $66 = 0, $67 = 0, $68 = 0, $69 = 0, $7 = 0, $70 = 0, $71 = 0, $72 = 0, $73 = 0, $74 = 0, $75 = 0, $76 = 0, $77 = 0, $78 = 0, $79 = 0, $8 = 0;
  5084. var $80 = 0, $81 = 0, $82 = 0, $83 = 0, $84 = 0, $85 = 0, $86 = 0, $87 = 0, $88 = 0, $89 = 0, $9 = 0, $90 = 0, $91 = 0, $92 = 0, $93 = 0, $94 = 0, $95 = 0, $96 = 0, $97 = 0, $98 = 0;
  5085. var $99 = 0, $vararg_buffer = 0, $vararg_buffer10 = 0, $vararg_buffer14 = 0, $vararg_buffer18 = 0, $vararg_buffer2 = 0, $vararg_buffer22 = 0, $vararg_buffer26 = 0, $vararg_buffer6 = 0, $vararg_ptr1 = 0, $vararg_ptr13 = 0, $vararg_ptr17 = 0, $vararg_ptr21 = 0, $vararg_ptr25 = 0, $vararg_ptr29 = 0, $vararg_ptr5 = 0, $vararg_ptr9 = 0, label = 0, sp = 0;
  5086. sp = STACKTOP;
  5087. STACKTOP = STACKTOP + 96|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(96|0);
  5088. $vararg_buffer26 = sp + 72|0;
  5089. $vararg_buffer22 = sp + 64|0;
  5090. $vararg_buffer18 = sp + 56|0;
  5091. $vararg_buffer14 = sp + 48|0;
  5092. $vararg_buffer10 = sp + 40|0;
  5093. $vararg_buffer6 = sp + 32|0;
  5094. $vararg_buffer2 = sp + 24|0;
  5095. $vararg_buffer = sp + 16|0;
  5096. $5 = sp;
  5097. $2 = 0;
  5098. $3 = $0;
  5099. $4 = $1;
  5100. $7 = (_setrlimit(4,2712)|0);
  5101. $8 = ($7|0)!=(0);
  5102. if ($8) {
  5103. $9 = HEAP32[2]|0;
  5104. HEAP32[$vararg_buffer>>2] = 260;
  5105. $vararg_ptr1 = ((($vararg_buffer)) + 4|0);
  5106. HEAP32[$vararg_ptr1>>2] = 18;
  5107. (_fprintf($9,244,$vararg_buffer)|0);
  5108. _exit(1);
  5109. // unreachable;
  5110. }
  5111. $10 = (_getrlimit(3,$5)|0);
  5112. $11 = ($10|0)!=(0);
  5113. if ($11) {
  5114. $12 = HEAP32[2]|0;
  5115. HEAP32[$vararg_buffer2>>2] = 260;
  5116. $vararg_ptr5 = ((($vararg_buffer2)) + 4|0);
  5117. HEAP32[$vararg_ptr5>>2] = 21;
  5118. (_fprintf($12,244,$vararg_buffer2)|0);
  5119. _exit(1);
  5120. // unreachable;
  5121. }
  5122. $13 = $5;
  5123. $14 = $13;
  5124. $15 = HEAP32[$14>>2]|0;
  5125. $16 = (($13) + 4)|0;
  5126. $17 = $16;
  5127. $18 = HEAP32[$17>>2]|0;
  5128. $19 = ((($5)) + 8|0);
  5129. $20 = $19;
  5130. $21 = $20;
  5131. $22 = HEAP32[$21>>2]|0;
  5132. $23 = (($20) + 4)|0;
  5133. $24 = $23;
  5134. $25 = HEAP32[$24>>2]|0;
  5135. $26 = (___udivdi3(($22|0),($25|0),3,0)|0);
  5136. $27 = tempRet0;
  5137. $28 = ($18>>>0)>($27>>>0);
  5138. $29 = ($15>>>0)>($26>>>0);
  5139. $30 = ($18|0)==($27|0);
  5140. $31 = $30 & $29;
  5141. $32 = $28 | $31;
  5142. if ($32) {
  5143. $33 = ((($5)) + 8|0);
  5144. $34 = $33;
  5145. $35 = $34;
  5146. $36 = HEAP32[$35>>2]|0;
  5147. $37 = (($34) + 4)|0;
  5148. $38 = $37;
  5149. $39 = HEAP32[$38>>2]|0;
  5150. $40 = (___udivdi3(($36|0),($39|0),3,0)|0);
  5151. $41 = tempRet0;
  5152. $42 = $5;
  5153. $43 = $42;
  5154. HEAP32[$43>>2] = $40;
  5155. $44 = (($42) + 4)|0;
  5156. $45 = $44;
  5157. HEAP32[$45>>2] = $41;
  5158. $46 = (_setrlimit(3,$5)|0);
  5159. $47 = ($46|0)!=(0);
  5160. if ($47) {
  5161. $48 = HEAP32[2]|0;
  5162. HEAP32[$vararg_buffer6>>2] = 260;
  5163. $vararg_ptr9 = ((($vararg_buffer6)) + 4|0);
  5164. HEAP32[$vararg_ptr9>>2] = 24;
  5165. (_fprintf($48,244,$vararg_buffer6)|0);
  5166. _exit(1);
  5167. // unreachable;
  5168. } else {
  5169. $49 = $4;
  5170. $50 = HEAP32[$49>>2]|0;
  5171. $51 = $4;
  5172. (_execve(($50|0),($51|0),(0|0))|0);
  5173. $52 = HEAP32[2]|0;
  5174. HEAP32[$vararg_buffer10>>2] = 260;
  5175. $vararg_ptr13 = ((($vararg_buffer10)) + 4|0);
  5176. HEAP32[$vararg_ptr13>>2] = 26;
  5177. (_fprintf($52,244,$vararg_buffer10)|0);
  5178. _exit(1);
  5179. // unreachable;
  5180. }
  5181. }
  5182. $6 = 0;
  5183. while(1) {
  5184. $53 = (___mmap(0,4096,0,34,-1,0)|0);
  5185. $6 = $53;
  5186. $54 = $6;
  5187. $55 = ($54|0)==((-1)|0);
  5188. if ($55) {
  5189. label = 11;
  5190. break;
  5191. }
  5192. $57 = $5;
  5193. $58 = $6;
  5194. $59 = $58;
  5195. $60 = ($57>>>0)<($59>>>0);
  5196. if ($60) {
  5197. label = 13;
  5198. break;
  5199. }
  5200. $62 = $5;
  5201. $63 = $6;
  5202. $64 = $63;
  5203. $65 = (($62) - ($64))|0;
  5204. $66 = ((($5)) + 8|0);
  5205. $67 = $66;
  5206. $68 = $67;
  5207. $69 = HEAP32[$68>>2]|0;
  5208. $70 = (($67) + 4)|0;
  5209. $71 = $70;
  5210. $72 = HEAP32[$71>>2]|0;
  5211. $73 = (___udivdi3(($69|0),($72|0),3,0)|0);
  5212. $74 = tempRet0;
  5213. $75 = (___muldi3(($73|0),($74|0),2,0)|0);
  5214. $76 = tempRet0;
  5215. $77 = (0)<($76>>>0);
  5216. $78 = ($65>>>0)<($75>>>0);
  5217. $79 = (0)==($76|0);
  5218. $80 = $79 & $78;
  5219. $81 = $77 | $80;
  5220. if ($81) {
  5221. label = 15;
  5222. break;
  5223. }
  5224. }
  5225. if ((label|0) == 11) {
  5226. $56 = HEAP32[2]|0;
  5227. HEAP32[$vararg_buffer14>>2] = 260;
  5228. $vararg_ptr17 = ((($vararg_buffer14)) + 4|0);
  5229. HEAP32[$vararg_ptr17>>2] = 31;
  5230. (_fprintf($56,244,$vararg_buffer14)|0);
  5231. _exit(1);
  5232. // unreachable;
  5233. }
  5234. else if ((label|0) == 13) {
  5235. $61 = HEAP32[2]|0;
  5236. HEAP32[$vararg_buffer18>>2] = 260;
  5237. $vararg_ptr21 = ((($vararg_buffer18)) + 4|0);
  5238. HEAP32[$vararg_ptr21>>2] = 32;
  5239. (_fprintf($61,244,$vararg_buffer18)|0);
  5240. _exit(1);
  5241. // unreachable;
  5242. }
  5243. else if ((label|0) == 15) {
  5244. $82 = $3;
  5245. $83 = ($82|0)>(1);
  5246. if (!($83)) {
  5247. $98 = $6;
  5248. HEAP8[$98>>0] = 65;
  5249. $99 = $6;
  5250. $100 = $6;
  5251. $101 = HEAP8[$100>>0]|0;
  5252. $102 = $101 << 24 >> 24;
  5253. HEAP32[$vararg_buffer26>>2] = $99;
  5254. $vararg_ptr29 = ((($vararg_buffer26)) + 4|0);
  5255. HEAP32[$vararg_ptr29>>2] = $102;
  5256. (_printf(265,$vararg_buffer26)|0);
  5257. _exit(0);
  5258. // unreachable;
  5259. }
  5260. $84 = ((($5)) + 8|0);
  5261. $85 = $84;
  5262. $86 = $85;
  5263. $87 = HEAP32[$86>>2]|0;
  5264. $88 = (($85) + 4)|0;
  5265. $89 = $88;
  5266. $90 = HEAP32[$89>>2]|0;
  5267. $91 = $5;
  5268. $92 = $91;
  5269. HEAP32[$92>>2] = $87;
  5270. $93 = (($91) + 4)|0;
  5271. $94 = $93;
  5272. HEAP32[$94>>2] = $90;
  5273. $95 = (_setrlimit(3,$5)|0);
  5274. $96 = ($95|0)!=(0);
  5275. if ($96) {
  5276. $97 = HEAP32[2]|0;
  5277. HEAP32[$vararg_buffer22>>2] = 260;
  5278. $vararg_ptr25 = ((($vararg_buffer22)) + 4|0);
  5279. HEAP32[$vararg_ptr25>>2] = 37;
  5280. (_fprintf($97,244,$vararg_buffer22)|0);
  5281. _exit(1);
  5282. // unreachable;
  5283. } else {
  5284. $98 = $6;
  5285. HEAP8[$98>>0] = 65;
  5286. $99 = $6;
  5287. $100 = $6;
  5288. $101 = HEAP8[$100>>0]|0;
  5289. $102 = $101 << 24 >> 24;
  5290. HEAP32[$vararg_buffer26>>2] = $99;
  5291. $vararg_ptr29 = ((($vararg_buffer26)) + 4|0);
  5292. HEAP32[$vararg_ptr29>>2] = $102;
  5293. (_printf(265,$vararg_buffer26)|0);
  5294. _exit(0);
  5295. // unreachable;
  5296. }
  5297. }
  5298. return (0)|0;
  5299. }
  5300. function ___stdio_close($0) {
  5301. $0 = $0|0;
  5302. var $1 = 0, $2 = 0, $3 = 0, $4 = 0, $vararg_buffer = 0, label = 0, sp = 0;
  5303. sp = STACKTOP;
  5304. STACKTOP = STACKTOP + 16|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(16|0);
  5305. $vararg_buffer = sp;
  5306. $1 = ((($0)) + 60|0);
  5307. $2 = HEAP32[$1>>2]|0;
  5308. HEAP32[$vararg_buffer>>2] = $2;
  5309. $3 = (___syscall6(6,($vararg_buffer|0))|0);
  5310. $4 = (___syscall_ret($3)|0);
  5311. STACKTOP = sp;return ($4|0);
  5312. }
  5313. function ___stdio_write($0,$1,$2) {
  5314. $0 = $0|0;
  5315. $1 = $1|0;
  5316. $2 = $2|0;
  5317. var $$0 = 0, $$056 = 0, $$058 = 0, $$059 = 0, $$061 = 0, $$1 = 0, $$157 = 0, $$160 = 0, $$phi$trans$insert = 0, $$pre = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0;
  5318. var $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0, $27 = 0, $28 = 0, $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0;
  5319. var $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0, $45 = 0, $46 = 0, $47 = 0, $48 = 0, $49 = 0, $5 = 0, $50 = 0, $51 = 0, $52 = 0, $53 = 0, $6 = 0, $7 = 0, $8 = 0;
  5320. var $9 = 0, $vararg_buffer = 0, $vararg_buffer3 = 0, $vararg_ptr1 = 0, $vararg_ptr2 = 0, $vararg_ptr6 = 0, $vararg_ptr7 = 0, label = 0, sp = 0;
  5321. sp = STACKTOP;
  5322. STACKTOP = STACKTOP + 48|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(48|0);
  5323. $vararg_buffer3 = sp + 16|0;
  5324. $vararg_buffer = sp;
  5325. $3 = sp + 32|0;
  5326. $4 = ((($0)) + 28|0);
  5327. $5 = HEAP32[$4>>2]|0;
  5328. HEAP32[$3>>2] = $5;
  5329. $6 = ((($3)) + 4|0);
  5330. $7 = ((($0)) + 20|0);
  5331. $8 = HEAP32[$7>>2]|0;
  5332. $9 = (($8) - ($5))|0;
  5333. HEAP32[$6>>2] = $9;
  5334. $10 = ((($3)) + 8|0);
  5335. HEAP32[$10>>2] = $1;
  5336. $11 = ((($3)) + 12|0);
  5337. HEAP32[$11>>2] = $2;
  5338. $12 = (($9) + ($2))|0;
  5339. $13 = ((($0)) + 60|0);
  5340. $14 = ((($0)) + 44|0);
  5341. $$056 = 2;$$058 = $12;$$059 = $3;
  5342. while(1) {
  5343. $15 = HEAP32[682]|0;
  5344. $16 = ($15|0)==(0|0);
  5345. if ($16) {
  5346. $20 = HEAP32[$13>>2]|0;
  5347. HEAP32[$vararg_buffer3>>2] = $20;
  5348. $vararg_ptr6 = ((($vararg_buffer3)) + 4|0);
  5349. HEAP32[$vararg_ptr6>>2] = $$059;
  5350. $vararg_ptr7 = ((($vararg_buffer3)) + 8|0);
  5351. HEAP32[$vararg_ptr7>>2] = $$056;
  5352. $21 = (___syscall146(146,($vararg_buffer3|0))|0);
  5353. $22 = (___syscall_ret($21)|0);
  5354. $$0 = $22;
  5355. } else {
  5356. _pthread_cleanup_push((5|0),($0|0));
  5357. $17 = HEAP32[$13>>2]|0;
  5358. HEAP32[$vararg_buffer>>2] = $17;
  5359. $vararg_ptr1 = ((($vararg_buffer)) + 4|0);
  5360. HEAP32[$vararg_ptr1>>2] = $$059;
  5361. $vararg_ptr2 = ((($vararg_buffer)) + 8|0);
  5362. HEAP32[$vararg_ptr2>>2] = $$056;
  5363. $18 = (___syscall146(146,($vararg_buffer|0))|0);
  5364. $19 = (___syscall_ret($18)|0);
  5365. _pthread_cleanup_pop(0);
  5366. $$0 = $19;
  5367. }
  5368. $23 = ($$058|0)==($$0|0);
  5369. if ($23) {
  5370. label = 6;
  5371. break;
  5372. }
  5373. $30 = ($$0|0)<(0);
  5374. if ($30) {
  5375. label = 8;
  5376. break;
  5377. }
  5378. $38 = (($$058) - ($$0))|0;
  5379. $39 = ((($$059)) + 4|0);
  5380. $40 = HEAP32[$39>>2]|0;
  5381. $41 = ($$0>>>0)>($40>>>0);
  5382. if ($41) {
  5383. $42 = HEAP32[$14>>2]|0;
  5384. HEAP32[$4>>2] = $42;
  5385. HEAP32[$7>>2] = $42;
  5386. $43 = (($$0) - ($40))|0;
  5387. $44 = ((($$059)) + 8|0);
  5388. $45 = (($$056) + -1)|0;
  5389. $$phi$trans$insert = ((($$059)) + 12|0);
  5390. $$pre = HEAP32[$$phi$trans$insert>>2]|0;
  5391. $$1 = $43;$$157 = $45;$$160 = $44;$53 = $$pre;
  5392. } else {
  5393. $46 = ($$056|0)==(2);
  5394. if ($46) {
  5395. $47 = HEAP32[$4>>2]|0;
  5396. $48 = (($47) + ($$0)|0);
  5397. HEAP32[$4>>2] = $48;
  5398. $$1 = $$0;$$157 = 2;$$160 = $$059;$53 = $40;
  5399. } else {
  5400. $$1 = $$0;$$157 = $$056;$$160 = $$059;$53 = $40;
  5401. }
  5402. }
  5403. $49 = HEAP32[$$160>>2]|0;
  5404. $50 = (($49) + ($$1)|0);
  5405. HEAP32[$$160>>2] = $50;
  5406. $51 = ((($$160)) + 4|0);
  5407. $52 = (($53) - ($$1))|0;
  5408. HEAP32[$51>>2] = $52;
  5409. $$056 = $$157;$$058 = $38;$$059 = $$160;
  5410. }
  5411. if ((label|0) == 6) {
  5412. $24 = HEAP32[$14>>2]|0;
  5413. $25 = ((($0)) + 48|0);
  5414. $26 = HEAP32[$25>>2]|0;
  5415. $27 = (($24) + ($26)|0);
  5416. $28 = ((($0)) + 16|0);
  5417. HEAP32[$28>>2] = $27;
  5418. $29 = $24;
  5419. HEAP32[$4>>2] = $29;
  5420. HEAP32[$7>>2] = $29;
  5421. $$061 = $2;
  5422. }
  5423. else if ((label|0) == 8) {
  5424. $31 = ((($0)) + 16|0);
  5425. HEAP32[$31>>2] = 0;
  5426. HEAP32[$4>>2] = 0;
  5427. HEAP32[$7>>2] = 0;
  5428. $32 = HEAP32[$0>>2]|0;
  5429. $33 = $32 | 32;
  5430. HEAP32[$0>>2] = $33;
  5431. $34 = ($$056|0)==(2);
  5432. if ($34) {
  5433. $$061 = 0;
  5434. } else {
  5435. $35 = ((($$059)) + 4|0);
  5436. $36 = HEAP32[$35>>2]|0;
  5437. $37 = (($2) - ($36))|0;
  5438. $$061 = $37;
  5439. }
  5440. }
  5441. STACKTOP = sp;return ($$061|0);
  5442. }
  5443. function ___stdio_seek($0,$1,$2) {
  5444. $0 = $0|0;
  5445. $1 = $1|0;
  5446. $2 = $2|0;
  5447. var $$pre = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $vararg_buffer = 0, $vararg_ptr1 = 0, $vararg_ptr2 = 0, $vararg_ptr3 = 0, $vararg_ptr4 = 0, label = 0, sp = 0;
  5448. sp = STACKTOP;
  5449. STACKTOP = STACKTOP + 32|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(32|0);
  5450. $vararg_buffer = sp;
  5451. $3 = sp + 20|0;
  5452. $4 = ((($0)) + 60|0);
  5453. $5 = HEAP32[$4>>2]|0;
  5454. HEAP32[$vararg_buffer>>2] = $5;
  5455. $vararg_ptr1 = ((($vararg_buffer)) + 4|0);
  5456. HEAP32[$vararg_ptr1>>2] = 0;
  5457. $vararg_ptr2 = ((($vararg_buffer)) + 8|0);
  5458. HEAP32[$vararg_ptr2>>2] = $1;
  5459. $vararg_ptr3 = ((($vararg_buffer)) + 12|0);
  5460. HEAP32[$vararg_ptr3>>2] = $3;
  5461. $vararg_ptr4 = ((($vararg_buffer)) + 16|0);
  5462. HEAP32[$vararg_ptr4>>2] = $2;
  5463. $6 = (___syscall140(140,($vararg_buffer|0))|0);
  5464. $7 = (___syscall_ret($6)|0);
  5465. $8 = ($7|0)<(0);
  5466. if ($8) {
  5467. HEAP32[$3>>2] = -1;
  5468. $9 = -1;
  5469. } else {
  5470. $$pre = HEAP32[$3>>2]|0;
  5471. $9 = $$pre;
  5472. }
  5473. STACKTOP = sp;return ($9|0);
  5474. }
  5475. function ___syscall_ret($0) {
  5476. $0 = $0|0;
  5477. var $$0 = 0, $1 = 0, $2 = 0, $3 = 0, label = 0, sp = 0;
  5478. sp = STACKTOP;
  5479. $1 = ($0>>>0)>(4294963200);
  5480. if ($1) {
  5481. $2 = (0 - ($0))|0;
  5482. $3 = (___errno_location()|0);
  5483. HEAP32[$3>>2] = $2;
  5484. $$0 = -1;
  5485. } else {
  5486. $$0 = $0;
  5487. }
  5488. return ($$0|0);
  5489. }
  5490. function ___errno_location() {
  5491. var $$0 = 0, $0 = 0, $1 = 0, $2 = 0, $3 = 0, $4 = 0, label = 0, sp = 0;
  5492. sp = STACKTOP;
  5493. $0 = HEAP32[682]|0;
  5494. $1 = ($0|0)==(0|0);
  5495. if ($1) {
  5496. $$0 = 2772;
  5497. } else {
  5498. $2 = (_pthread_self()|0);
  5499. $3 = ((($2)) + 64|0);
  5500. $4 = HEAP32[$3>>2]|0;
  5501. $$0 = $4;
  5502. }
  5503. return ($$0|0);
  5504. }
  5505. function _cleanup_522($0) {
  5506. $0 = $0|0;
  5507. var $1 = 0, $2 = 0, $3 = 0, label = 0, sp = 0;
  5508. sp = STACKTOP;
  5509. $1 = ((($0)) + 68|0);
  5510. $2 = HEAP32[$1>>2]|0;
  5511. $3 = ($2|0)==(0);
  5512. if ($3) {
  5513. ___unlockfile($0);
  5514. }
  5515. return;
  5516. }
  5517. function ___unlockfile($0) {
  5518. $0 = $0|0;
  5519. var label = 0, sp = 0;
  5520. sp = STACKTOP;
  5521. return;
  5522. }
  5523. function ___stdout_write($0,$1,$2) {
  5524. $0 = $0|0;
  5525. $1 = $1|0;
  5526. $2 = $2|0;
  5527. var $10 = 0, $11 = 0, $12 = 0, $13 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $vararg_buffer = 0, $vararg_ptr1 = 0, $vararg_ptr2 = 0, label = 0, sp = 0;
  5528. sp = STACKTOP;
  5529. STACKTOP = STACKTOP + 80|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(80|0);
  5530. $vararg_buffer = sp;
  5531. $3 = sp + 12|0;
  5532. $4 = ((($0)) + 36|0);
  5533. HEAP32[$4>>2] = 2;
  5534. $5 = HEAP32[$0>>2]|0;
  5535. $6 = $5 & 64;
  5536. $7 = ($6|0)==(0);
  5537. if ($7) {
  5538. $8 = ((($0)) + 60|0);
  5539. $9 = HEAP32[$8>>2]|0;
  5540. HEAP32[$vararg_buffer>>2] = $9;
  5541. $vararg_ptr1 = ((($vararg_buffer)) + 4|0);
  5542. HEAP32[$vararg_ptr1>>2] = 21505;
  5543. $vararg_ptr2 = ((($vararg_buffer)) + 8|0);
  5544. HEAP32[$vararg_ptr2>>2] = $3;
  5545. $10 = (___syscall54(54,($vararg_buffer|0))|0);
  5546. $11 = ($10|0)==(0);
  5547. if (!($11)) {
  5548. $12 = ((($0)) + 75|0);
  5549. HEAP8[$12>>0] = -1;
  5550. }
  5551. }
  5552. $13 = (___stdio_write($0,$1,$2)|0);
  5553. STACKTOP = sp;return ($13|0);
  5554. }
  5555. function ___synccall($0,$1) {
  5556. $0 = $0|0;
  5557. $1 = $1|0;
  5558. var label = 0, sp = 0;
  5559. sp = STACKTOP;
  5560. FUNCTION_TABLE_vi[$0 & 7]($1);
  5561. return;
  5562. }
  5563. function _vfprintf($0,$1,$2) {
  5564. $0 = $0|0;
  5565. $1 = $1|0;
  5566. $2 = $2|0;
  5567. var $$ = 0, $$0 = 0, $$1 = 0, $$1$ = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0;
  5568. var $26 = 0, $27 = 0, $28 = 0, $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $5 = 0, $6 = 0, $7 = 0;
  5569. var $8 = 0, $9 = 0, $vacopy_currentptr = 0, dest = 0, label = 0, sp = 0, stop = 0;
  5570. sp = STACKTOP;
  5571. STACKTOP = STACKTOP + 224|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(224|0);
  5572. $3 = sp + 120|0;
  5573. $4 = sp + 80|0;
  5574. $5 = sp;
  5575. $6 = sp + 136|0;
  5576. dest=$4; stop=dest+40|0; do { HEAP32[dest>>2]=0|0; dest=dest+4|0; } while ((dest|0) < (stop|0));
  5577. $vacopy_currentptr = HEAP32[$2>>2]|0;
  5578. HEAP32[$3>>2] = $vacopy_currentptr;
  5579. $7 = (_printf_core(0,$1,$3,$5,$4)|0);
  5580. $8 = ($7|0)<(0);
  5581. if ($8) {
  5582. $$0 = -1;
  5583. } else {
  5584. $9 = ((($0)) + 76|0);
  5585. $10 = HEAP32[$9>>2]|0;
  5586. $11 = ($10|0)>(-1);
  5587. if ($11) {
  5588. $12 = (___lockfile($0)|0);
  5589. $40 = $12;
  5590. } else {
  5591. $40 = 0;
  5592. }
  5593. $13 = HEAP32[$0>>2]|0;
  5594. $14 = $13 & 32;
  5595. $15 = ((($0)) + 74|0);
  5596. $16 = HEAP8[$15>>0]|0;
  5597. $17 = ($16<<24>>24)<(1);
  5598. if ($17) {
  5599. $18 = $13 & -33;
  5600. HEAP32[$0>>2] = $18;
  5601. }
  5602. $19 = ((($0)) + 48|0);
  5603. $20 = HEAP32[$19>>2]|0;
  5604. $21 = ($20|0)==(0);
  5605. if ($21) {
  5606. $23 = ((($0)) + 44|0);
  5607. $24 = HEAP32[$23>>2]|0;
  5608. HEAP32[$23>>2] = $6;
  5609. $25 = ((($0)) + 28|0);
  5610. HEAP32[$25>>2] = $6;
  5611. $26 = ((($0)) + 20|0);
  5612. HEAP32[$26>>2] = $6;
  5613. HEAP32[$19>>2] = 80;
  5614. $27 = ((($6)) + 80|0);
  5615. $28 = ((($0)) + 16|0);
  5616. HEAP32[$28>>2] = $27;
  5617. $29 = (_printf_core($0,$1,$3,$5,$4)|0);
  5618. $30 = ($24|0)==(0|0);
  5619. if ($30) {
  5620. $$1 = $29;
  5621. } else {
  5622. $31 = ((($0)) + 36|0);
  5623. $32 = HEAP32[$31>>2]|0;
  5624. (FUNCTION_TABLE_iiii[$32 & 7]($0,0,0)|0);
  5625. $33 = HEAP32[$26>>2]|0;
  5626. $34 = ($33|0)==(0|0);
  5627. $$ = $34 ? -1 : $29;
  5628. HEAP32[$23>>2] = $24;
  5629. HEAP32[$19>>2] = 0;
  5630. HEAP32[$28>>2] = 0;
  5631. HEAP32[$25>>2] = 0;
  5632. HEAP32[$26>>2] = 0;
  5633. $$1 = $$;
  5634. }
  5635. } else {
  5636. $22 = (_printf_core($0,$1,$3,$5,$4)|0);
  5637. $$1 = $22;
  5638. }
  5639. $35 = HEAP32[$0>>2]|0;
  5640. $36 = $35 & 32;
  5641. $37 = ($36|0)==(0);
  5642. $$1$ = $37 ? $$1 : -1;
  5643. $38 = $35 | $14;
  5644. HEAP32[$0>>2] = $38;
  5645. $39 = ($40|0)==(0);
  5646. if (!($39)) {
  5647. ___unlockfile($0);
  5648. }
  5649. $$0 = $$1$;
  5650. }
  5651. STACKTOP = sp;return ($$0|0);
  5652. }
  5653. function _printf_core($0,$1,$2,$3,$4) {
  5654. $0 = $0|0;
  5655. $1 = $1|0;
  5656. $2 = $2|0;
  5657. $3 = $3|0;
  5658. $4 = $4|0;
  5659. var $$ = 0, $$$0259 = 0, $$$0262 = 0, $$$0269 = 0, $$$3484$i = 0, $$$3484705$i = 0, $$$3484706$i = 0, $$$3501$i = 0, $$$4266 = 0, $$$4502$i = 0, $$$5 = 0, $$$i = 0, $$0 = 0, $$0$i = 0, $$0$lcssa$i300 = 0, $$0228 = 0, $$0229396 = 0, $$0232 = 0, $$0235 = 0, $$0237 = 0;
  5660. var $$0240$lcssa = 0, $$0240$lcssa460 = 0, $$0240395 = 0, $$0243 = 0, $$0247 = 0, $$0249$lcssa = 0, $$0249383 = 0, $$0252 = 0, $$0253 = 0, $$0254 = 0, $$0254$ = 0, $$0259 = 0, $$0262342 = 0, $$0262390 = 0, $$0269 = 0, $$0269$phi = 0, $$0321 = 0, $$0463$lcssa$i = 0, $$0463594$i = 0, $$0464603$i = 0;
  5661. var $$0466$i = 0.0, $$0470$i = 0, $$0471$i = 0.0, $$0479$i = 0, $$0487652$i = 0, $$0488$i = 0, $$0488663$i = 0, $$0488665$i = 0, $$0496$$9$i = 0, $$0497664$i = 0, $$0498$i = 0, $$05$lcssa$i = 0, $$0509592$i = 0.0, $$0510$i = 0, $$0511$i = 0, $$0514647$i = 0, $$0520$i = 0, $$0522$$i = 0, $$0522$i = 0, $$0524$i = 0;
  5662. var $$0526$i = 0, $$0528$i = 0, $$0528639$i = 0, $$0528641$i = 0, $$0531646$i = 0, $$056$i = 0, $$06$i = 0, $$06$i290 = 0, $$06$i298 = 0, $$1 = 0, $$1230407 = 0, $$1233 = 0, $$1236 = 0, $$1238 = 0, $$1241406 = 0, $$1244394 = 0, $$1248 = 0, $$1250 = 0, $$1255 = 0, $$1260 = 0;
  5663. var $$1263 = 0, $$1263$ = 0, $$1270 = 0, $$1322 = 0, $$1465$i = 0, $$1467$i = 0.0, $$1469$i = 0.0, $$1472$i = 0.0, $$1480$i = 0, $$1482$lcssa$i = 0, $$1482671$i = 0, $$1489651$i = 0, $$1499$lcssa$i = 0, $$1499670$i = 0, $$1508593$i = 0, $$1512$lcssa$i = 0, $$1512617$i = 0, $$1515$i = 0, $$1521$i = 0, $$1525$i = 0;
  5664. var $$1527$i = 0, $$1529624$i = 0, $$1532$lcssa$i = 0, $$1532640$i = 0, $$1607$i = 0, $$2 = 0, $$2$i = 0, $$2234 = 0, $$2239 = 0, $$2242381 = 0, $$2245 = 0, $$2251 = 0, $$2256 = 0, $$2256$ = 0, $$2261 = 0, $$2271 = 0, $$2323$lcssa = 0, $$2323382 = 0, $$2473$i = 0.0, $$2476$$545$i = 0;
  5665. var $$2476$$547$i = 0, $$2476$i = 0, $$2483$ph$i = 0, $$2490$lcssa$i = 0, $$2490632$i = 0, $$2500$i = 0, $$2513$i = 0, $$2516628$i = 0, $$2530$i = 0, $$2533627$i = 0, $$3$i = 0.0, $$3257 = 0, $$3265 = 0, $$3272 = 0, $$331 = 0, $$332 = 0, $$333 = 0, $$3379 = 0, $$3477$i = 0, $$3484$lcssa$i = 0;
  5666. var $$3484658$i = 0, $$3501$lcssa$i = 0, $$3501657$i = 0, $$3534623$i = 0, $$4$i = 0.0, $$4258458 = 0, $$4266 = 0, $$4325 = 0, $$4478$lcssa$i = 0, $$4478600$i = 0, $$4492$i = 0, $$4502$i = 0, $$4518$i = 0, $$5 = 0, $$5$lcssa$i = 0, $$537$i = 0, $$538$$i = 0, $$538$i = 0, $$541$i = 0.0, $$544$i = 0;
  5667. var $$546$i = 0, $$5486$lcssa$i = 0, $$5486633$i = 0, $$5493606$i = 0, $$5519$ph$i = 0, $$553$i = 0, $$554$i = 0, $$557$i = 0.0, $$5611$i = 0, $$6 = 0, $$6$i = 0, $$6268 = 0, $$6494599$i = 0, $$7 = 0, $$7495610$i = 0, $$7505$$i = 0, $$7505$i = 0, $$7505$ph$i = 0, $$8$i = 0, $$9$ph$i = 0;
  5668. var $$lcssa683$i = 0, $$neg$i = 0, $$neg572$i = 0, $$pn$i = 0, $$pr = 0, $$pr$i = 0, $$pr571$i = 0, $$pre = 0, $$pre$i = 0, $$pre$phi704$iZ2D = 0, $$pre452 = 0, $$pre453 = 0, $$pre454 = 0, $$pre697$i = 0, $$pre700$i = 0, $$pre703$i = 0, $10 = 0, $100 = 0, $101 = 0, $102 = 0;
  5669. var $103 = 0, $104 = 0, $105 = 0, $106 = 0, $107 = 0, $108 = 0, $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0, $116 = 0, $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0;
  5670. var $121 = 0, $122 = 0, $123 = 0, $124 = 0, $125 = 0, $126 = 0, $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0, $131 = 0, $132 = 0, $133 = 0, $134 = 0, $135 = 0, $136 = 0, $137 = 0, $138 = 0, $139 = 0;
  5671. var $14 = 0, $140 = 0, $141 = 0, $142 = 0, $143 = 0, $144 = 0, $145 = 0, $146 = 0, $147 = 0, $148 = 0, $149 = 0, $15 = 0, $150 = 0, $151 = 0, $152 = 0, $153 = 0, $154 = 0, $155 = 0, $156 = 0, $157 = 0;
  5672. var $158 = 0, $159 = 0, $16 = 0, $160 = 0, $161 = 0, $162 = 0, $163 = 0, $164 = 0, $165 = 0, $166 = 0, $167 = 0, $168 = 0, $169 = 0, $17 = 0, $170 = 0, $171 = 0, $172 = 0, $173 = 0, $174 = 0, $175 = 0;
  5673. var $176 = 0, $177 = 0, $178 = 0, $179 = 0, $18 = 0, $180 = 0, $181 = 0, $182 = 0, $183 = 0, $184 = 0, $185 = 0, $186 = 0, $187 = 0, $188 = 0, $189 = 0, $19 = 0, $190 = 0, $191 = 0, $192 = 0, $193 = 0;
  5674. var $194 = 0, $195 = 0, $196 = 0, $197 = 0, $198 = 0, $199 = 0, $20 = 0, $200 = 0, $201 = 0, $202 = 0, $203 = 0, $204 = 0, $205 = 0, $206 = 0, $207 = 0, $208 = 0, $209 = 0, $21 = 0, $210 = 0, $211 = 0;
  5675. var $212 = 0, $213 = 0, $214 = 0, $215 = 0, $216 = 0, $217 = 0, $218 = 0, $219 = 0, $22 = 0, $220 = 0, $221 = 0, $222 = 0, $223 = 0, $224 = 0, $225 = 0, $226 = 0, $227 = 0, $228 = 0, $229 = 0, $23 = 0;
  5676. var $230 = 0, $231 = 0, $232 = 0, $233 = 0, $234 = 0, $235 = 0, $236 = 0, $237 = 0, $238 = 0, $239 = 0, $24 = 0, $240 = 0, $241 = 0, $242 = 0, $243 = 0, $244 = 0, $245 = 0, $246 = 0, $247 = 0, $248 = 0;
  5677. var $249 = 0, $25 = 0, $250 = 0, $251 = 0, $252 = 0, $253 = 0, $254 = 0, $255 = 0, $256 = 0, $257 = 0, $258 = 0, $259 = 0, $26 = 0, $260 = 0, $261 = 0, $262 = 0, $263 = 0, $264 = 0, $265 = 0, $266 = 0;
  5678. var $267 = 0, $268 = 0, $269 = 0, $27 = 0, $270 = 0, $271 = 0, $272 = 0, $273 = 0, $274 = 0, $275 = 0, $276 = 0, $277 = 0, $278 = 0, $279 = 0, $28 = 0, $280 = 0, $281 = 0, $282 = 0, $283 = 0, $284 = 0;
  5679. var $285 = 0, $286 = 0, $287 = 0, $288 = 0, $289 = 0, $29 = 0, $290 = 0, $291 = 0, $292 = 0, $293 = 0, $294 = 0, $295 = 0, $296 = 0, $297 = 0, $298 = 0, $299 = 0, $30 = 0, $300 = 0, $301 = 0, $302 = 0;
  5680. var $303 = 0, $304 = 0, $305 = 0, $306 = 0, $307 = 0, $308 = 0, $309 = 0, $31 = 0, $310 = 0, $311 = 0, $312 = 0, $313 = 0, $314 = 0, $315 = 0, $316 = 0, $317 = 0, $318 = 0, $319 = 0, $32 = 0, $320 = 0;
  5681. var $321 = 0, $322 = 0, $323 = 0, $324 = 0, $325 = 0, $326 = 0, $327 = 0, $328 = 0, $329 = 0, $33 = 0, $330 = 0, $331 = 0, $332 = 0, $333 = 0, $334 = 0, $335 = 0, $336 = 0, $337 = 0, $338 = 0, $339 = 0;
  5682. var $34 = 0, $340 = 0, $341 = 0, $342 = 0, $343 = 0, $344 = 0, $345 = 0, $346 = 0, $347 = 0, $348 = 0, $349 = 0, $35 = 0, $350 = 0, $351 = 0, $352 = 0, $353 = 0, $354 = 0, $355 = 0, $356 = 0, $357 = 0;
  5683. var $358 = 0, $359 = 0, $36 = 0, $360 = 0, $361 = 0, $362 = 0, $363 = 0, $364 = 0, $365 = 0, $366 = 0, $367 = 0, $368 = 0, $369 = 0, $37 = 0, $370 = 0, $371 = 0.0, $372 = 0, $373 = 0, $374 = 0, $375 = 0.0;
  5684. var $376 = 0, $377 = 0, $378 = 0, $379 = 0, $38 = 0, $380 = 0, $381 = 0, $382 = 0, $383 = 0, $384 = 0, $385 = 0, $386 = 0, $387 = 0, $388 = 0, $389 = 0, $39 = 0, $390 = 0, $391 = 0, $392 = 0, $393 = 0;
  5685. var $394 = 0, $395 = 0, $396 = 0, $397 = 0, $398 = 0, $399 = 0, $40 = 0, $400 = 0, $401 = 0, $402 = 0, $403 = 0.0, $404 = 0.0, $405 = 0, $406 = 0, $407 = 0, $408 = 0, $409 = 0, $41 = 0, $410 = 0, $411 = 0;
  5686. var $412 = 0, $413 = 0, $414 = 0, $415 = 0, $416 = 0, $417 = 0, $418 = 0, $419 = 0.0, $42 = 0, $420 = 0, $421 = 0, $422 = 0, $423 = 0.0, $424 = 0.0, $425 = 0.0, $426 = 0.0, $427 = 0.0, $428 = 0.0, $429 = 0, $43 = 0;
  5687. var $430 = 0, $431 = 0, $432 = 0, $433 = 0, $434 = 0, $435 = 0, $436 = 0, $437 = 0, $438 = 0, $439 = 0, $44 = 0, $440 = 0, $441 = 0, $442 = 0, $443 = 0, $444 = 0, $445 = 0, $446 = 0, $447 = 0, $448 = 0;
  5688. var $449 = 0, $45 = 0, $450 = 0, $451 = 0, $452 = 0, $453 = 0, $454 = 0.0, $455 = 0.0, $456 = 0.0, $457 = 0, $458 = 0, $459 = 0, $46 = 0, $460 = 0, $461 = 0, $462 = 0, $463 = 0, $464 = 0, $465 = 0, $466 = 0;
  5689. var $467 = 0, $468 = 0, $469 = 0, $47 = 0, $470 = 0, $471 = 0, $472 = 0, $473 = 0, $474 = 0, $475 = 0, $476 = 0, $477 = 0, $478 = 0, $479 = 0, $48 = 0, $480 = 0, $481 = 0, $482 = 0, $483 = 0, $484 = 0;
  5690. var $485 = 0, $486 = 0, $487 = 0.0, $488 = 0, $489 = 0, $49 = 0, $490 = 0, $491 = 0, $492 = 0, $493 = 0.0, $494 = 0.0, $495 = 0.0, $496 = 0, $497 = 0, $498 = 0, $499 = 0, $5 = 0, $50 = 0, $500 = 0, $501 = 0;
  5691. var $502 = 0, $503 = 0, $504 = 0, $505 = 0, $506 = 0, $507 = 0, $508 = 0, $509 = 0, $51 = 0, $510 = 0, $511 = 0, $512 = 0, $513 = 0, $514 = 0, $515 = 0, $516 = 0, $517 = 0, $518 = 0, $519 = 0, $52 = 0;
  5692. var $520 = 0, $521 = 0, $522 = 0, $523 = 0, $524 = 0, $525 = 0, $526 = 0, $527 = 0, $528 = 0, $529 = 0, $53 = 0, $530 = 0, $531 = 0, $532 = 0, $533 = 0, $534 = 0, $535 = 0, $536 = 0, $537 = 0, $538 = 0;
  5693. var $539 = 0, $54 = 0, $540 = 0, $541 = 0, $542 = 0, $543 = 0, $544 = 0, $545 = 0, $546 = 0, $547 = 0, $548 = 0, $549 = 0, $55 = 0, $550 = 0, $551 = 0, $552 = 0, $553 = 0, $554 = 0, $555 = 0, $556 = 0;
  5694. var $557 = 0, $558 = 0, $559 = 0, $56 = 0, $560 = 0, $561 = 0, $562 = 0, $563 = 0, $564 = 0, $565 = 0, $566 = 0, $567 = 0, $568 = 0, $569 = 0, $57 = 0, $570 = 0, $571 = 0, $572 = 0, $573 = 0, $574 = 0;
  5695. var $575 = 0, $576 = 0, $577 = 0, $578 = 0, $579 = 0, $58 = 0, $580 = 0, $581 = 0, $582 = 0, $583 = 0, $584 = 0, $585 = 0, $586 = 0, $587 = 0, $588 = 0, $589 = 0, $59 = 0, $590 = 0, $591 = 0, $592 = 0;
  5696. var $593 = 0, $594 = 0, $595 = 0, $596 = 0, $597 = 0, $598 = 0, $599 = 0, $6 = 0, $60 = 0, $600 = 0, $601 = 0, $602 = 0, $603 = 0, $604 = 0, $605 = 0.0, $606 = 0.0, $607 = 0, $608 = 0.0, $609 = 0, $61 = 0;
  5697. var $610 = 0, $611 = 0, $612 = 0, $613 = 0, $614 = 0, $615 = 0, $616 = 0, $617 = 0, $618 = 0, $619 = 0, $62 = 0, $620 = 0, $621 = 0, $622 = 0, $623 = 0, $624 = 0, $625 = 0, $626 = 0, $627 = 0, $628 = 0;
  5698. var $629 = 0, $63 = 0, $630 = 0, $631 = 0, $632 = 0, $633 = 0, $634 = 0, $635 = 0, $636 = 0, $637 = 0, $638 = 0, $639 = 0, $64 = 0, $640 = 0, $641 = 0, $642 = 0, $643 = 0, $644 = 0, $645 = 0, $646 = 0;
  5699. var $647 = 0, $648 = 0, $649 = 0, $65 = 0, $650 = 0, $651 = 0, $652 = 0, $653 = 0, $654 = 0, $655 = 0, $656 = 0, $657 = 0, $658 = 0, $659 = 0, $66 = 0, $660 = 0, $661 = 0, $662 = 0, $663 = 0, $664 = 0;
  5700. var $665 = 0, $666 = 0, $667 = 0, $668 = 0, $669 = 0, $67 = 0, $670 = 0, $671 = 0, $672 = 0, $673 = 0, $674 = 0, $675 = 0, $676 = 0, $677 = 0, $678 = 0, $679 = 0, $68 = 0, $680 = 0, $681 = 0, $682 = 0;
  5701. var $683 = 0, $684 = 0, $685 = 0, $686 = 0, $687 = 0, $688 = 0, $689 = 0, $69 = 0, $690 = 0, $691 = 0, $692 = 0, $693 = 0, $694 = 0, $695 = 0, $696 = 0, $697 = 0, $698 = 0, $699 = 0, $7 = 0, $70 = 0;
  5702. var $700 = 0, $701 = 0, $702 = 0, $703 = 0, $704 = 0, $705 = 0, $706 = 0, $707 = 0, $708 = 0, $709 = 0, $71 = 0, $710 = 0, $711 = 0, $712 = 0, $713 = 0, $714 = 0, $715 = 0, $716 = 0, $717 = 0, $718 = 0;
  5703. var $719 = 0, $72 = 0, $720 = 0, $721 = 0, $722 = 0, $723 = 0, $724 = 0, $725 = 0, $726 = 0, $727 = 0, $728 = 0, $729 = 0, $73 = 0, $730 = 0, $731 = 0, $732 = 0, $733 = 0, $734 = 0, $735 = 0, $736 = 0;
  5704. var $737 = 0, $738 = 0, $739 = 0, $74 = 0, $740 = 0, $741 = 0, $742 = 0, $743 = 0, $744 = 0, $745 = 0, $746 = 0, $747 = 0, $748 = 0, $749 = 0, $75 = 0, $750 = 0, $751 = 0, $752 = 0, $753 = 0, $754 = 0;
  5705. var $755 = 0, $756 = 0, $757 = 0, $758 = 0, $759 = 0, $76 = 0, $760 = 0, $761 = 0, $762 = 0, $763 = 0, $764 = 0, $765 = 0, $766 = 0, $767 = 0, $768 = 0, $769 = 0, $77 = 0, $770 = 0, $771 = 0, $772 = 0;
  5706. var $773 = 0, $774 = 0, $775 = 0, $776 = 0, $777 = 0, $778 = 0, $779 = 0, $78 = 0, $780 = 0, $781 = 0, $782 = 0, $783 = 0, $784 = 0, $785 = 0, $786 = 0, $787 = 0, $788 = 0, $789 = 0, $79 = 0, $790 = 0;
  5707. var $791 = 0, $792 = 0, $793 = 0, $794 = 0, $795 = 0, $796 = 0, $797 = 0, $798 = 0, $799 = 0, $8 = 0, $80 = 0, $800 = 0, $801 = 0, $802 = 0, $803 = 0, $804 = 0, $805 = 0, $806 = 0, $807 = 0, $808 = 0;
  5708. var $809 = 0, $81 = 0, $82 = 0, $83 = 0, $84 = 0, $85 = 0, $86 = 0, $87 = 0, $88 = 0, $89 = 0, $9 = 0, $90 = 0, $91 = 0, $92 = 0, $93 = 0, $94 = 0, $95 = 0, $96 = 0, $97 = 0, $98 = 0;
  5709. var $99 = 0, $arglist_current = 0, $arglist_current2 = 0, $arglist_next = 0, $arglist_next3 = 0, $exitcond$i = 0, $expanded = 0, $expanded10 = 0, $expanded11 = 0, $expanded13 = 0, $expanded14 = 0, $expanded15 = 0, $expanded4 = 0, $expanded6 = 0, $expanded7 = 0, $expanded8 = 0, $isdigit = 0, $isdigit$i = 0, $isdigit$i292 = 0, $isdigit275 = 0;
  5710. var $isdigit277 = 0, $isdigit5$i = 0, $isdigit5$i288 = 0, $isdigittmp = 0, $isdigittmp$ = 0, $isdigittmp$i = 0, $isdigittmp$i291 = 0, $isdigittmp274 = 0, $isdigittmp276 = 0, $isdigittmp4$i = 0, $isdigittmp4$i287 = 0, $isdigittmp7$i = 0, $isdigittmp7$i289 = 0, $notlhs$i = 0, $notrhs$i = 0, $or$cond = 0, $or$cond$i = 0, $or$cond280 = 0, $or$cond282 = 0, $or$cond285 = 0;
  5711. var $or$cond3$not$i = 0, $or$cond412 = 0, $or$cond540$i = 0, $or$cond543$i = 0, $or$cond552$i = 0, $or$cond6$i = 0, $scevgep694$i = 0, $scevgep694695$i = 0, $storemerge = 0, $storemerge273345 = 0, $storemerge273389 = 0, $storemerge278 = 0, $sum = 0, $trunc = 0, label = 0, sp = 0;
  5712. sp = STACKTOP;
  5713. STACKTOP = STACKTOP + 624|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(624|0);
  5714. $5 = sp + 24|0;
  5715. $6 = sp + 16|0;
  5716. $7 = sp + 588|0;
  5717. $8 = sp + 576|0;
  5718. $9 = sp;
  5719. $10 = sp + 536|0;
  5720. $11 = sp + 8|0;
  5721. $12 = sp + 528|0;
  5722. $13 = ($0|0)!=(0|0);
  5723. $14 = ((($10)) + 40|0);
  5724. $15 = $14;
  5725. $16 = ((($10)) + 39|0);
  5726. $17 = ((($11)) + 4|0);
  5727. $18 = $7;
  5728. $19 = (0 - ($18))|0;
  5729. $20 = ((($8)) + 12|0);
  5730. $21 = ((($8)) + 11|0);
  5731. $22 = $20;
  5732. $23 = (($22) - ($18))|0;
  5733. $24 = (-2 - ($18))|0;
  5734. $25 = (($22) + 2)|0;
  5735. $26 = ((($5)) + 288|0);
  5736. $27 = ((($7)) + 9|0);
  5737. $28 = $27;
  5738. $29 = ((($7)) + 8|0);
  5739. $$0243 = 0;$$0247 = 0;$$0269 = 0;$$0321 = $1;
  5740. L1: while(1) {
  5741. $30 = ($$0247|0)>(-1);
  5742. do {
  5743. if ($30) {
  5744. $31 = (2147483647 - ($$0247))|0;
  5745. $32 = ($$0243|0)>($31|0);
  5746. if ($32) {
  5747. $33 = (___errno_location()|0);
  5748. HEAP32[$33>>2] = 75;
  5749. $$1248 = -1;
  5750. break;
  5751. } else {
  5752. $34 = (($$0243) + ($$0247))|0;
  5753. $$1248 = $34;
  5754. break;
  5755. }
  5756. } else {
  5757. $$1248 = $$0247;
  5758. }
  5759. } while(0);
  5760. $35 = HEAP8[$$0321>>0]|0;
  5761. $36 = ($35<<24>>24)==(0);
  5762. if ($36) {
  5763. label = 243;
  5764. break;
  5765. } else {
  5766. $$1322 = $$0321;$37 = $35;
  5767. }
  5768. L9: while(1) {
  5769. switch ($37<<24>>24) {
  5770. case 37: {
  5771. $$0249383 = $$1322;$$2323382 = $$1322;
  5772. label = 9;
  5773. break L9;
  5774. break;
  5775. }
  5776. case 0: {
  5777. $$0249$lcssa = $$1322;$$2323$lcssa = $$1322;
  5778. break L9;
  5779. break;
  5780. }
  5781. default: {
  5782. }
  5783. }
  5784. $38 = ((($$1322)) + 1|0);
  5785. $$pre = HEAP8[$38>>0]|0;
  5786. $$1322 = $38;$37 = $$pre;
  5787. }
  5788. L12: do {
  5789. if ((label|0) == 9) {
  5790. while(1) {
  5791. label = 0;
  5792. $39 = ((($$2323382)) + 1|0);
  5793. $40 = HEAP8[$39>>0]|0;
  5794. $41 = ($40<<24>>24)==(37);
  5795. if (!($41)) {
  5796. $$0249$lcssa = $$0249383;$$2323$lcssa = $$2323382;
  5797. break L12;
  5798. }
  5799. $42 = ((($$0249383)) + 1|0);
  5800. $43 = ((($$2323382)) + 2|0);
  5801. $44 = HEAP8[$43>>0]|0;
  5802. $45 = ($44<<24>>24)==(37);
  5803. if ($45) {
  5804. $$0249383 = $42;$$2323382 = $43;
  5805. label = 9;
  5806. } else {
  5807. $$0249$lcssa = $42;$$2323$lcssa = $43;
  5808. break;
  5809. }
  5810. }
  5811. }
  5812. } while(0);
  5813. $46 = $$0249$lcssa;
  5814. $47 = $$0321;
  5815. $48 = (($46) - ($47))|0;
  5816. if ($13) {
  5817. $49 = HEAP32[$0>>2]|0;
  5818. $50 = $49 & 32;
  5819. $51 = ($50|0)==(0);
  5820. if ($51) {
  5821. (___fwritex($$0321,$48,$0)|0);
  5822. }
  5823. }
  5824. $52 = ($48|0)==(0);
  5825. if (!($52)) {
  5826. $$0269$phi = $$0269;$$0243 = $48;$$0247 = $$1248;$$0321 = $$2323$lcssa;$$0269 = $$0269$phi;
  5827. continue;
  5828. }
  5829. $53 = ((($$2323$lcssa)) + 1|0);
  5830. $54 = HEAP8[$53>>0]|0;
  5831. $55 = $54 << 24 >> 24;
  5832. $isdigittmp = (($55) + -48)|0;
  5833. $isdigit = ($isdigittmp>>>0)<(10);
  5834. if ($isdigit) {
  5835. $56 = ((($$2323$lcssa)) + 2|0);
  5836. $57 = HEAP8[$56>>0]|0;
  5837. $58 = ($57<<24>>24)==(36);
  5838. $59 = ((($$2323$lcssa)) + 3|0);
  5839. $$331 = $58 ? $59 : $53;
  5840. $$$0269 = $58 ? 1 : $$0269;
  5841. $isdigittmp$ = $58 ? $isdigittmp : -1;
  5842. $$pre452 = HEAP8[$$331>>0]|0;
  5843. $$0253 = $isdigittmp$;$$1270 = $$$0269;$61 = $$pre452;$storemerge = $$331;
  5844. } else {
  5845. $$0253 = -1;$$1270 = $$0269;$61 = $54;$storemerge = $53;
  5846. }
  5847. $60 = $61 << 24 >> 24;
  5848. $62 = (($60) + -32)|0;
  5849. $63 = ($62>>>0)<(32);
  5850. L25: do {
  5851. if ($63) {
  5852. $$0262390 = 0;$65 = $62;$69 = $61;$storemerge273389 = $storemerge;
  5853. while(1) {
  5854. $64 = 1 << $65;
  5855. $66 = $64 & 75913;
  5856. $67 = ($66|0)==(0);
  5857. if ($67) {
  5858. $$0262342 = $$0262390;$79 = $69;$storemerge273345 = $storemerge273389;
  5859. break L25;
  5860. }
  5861. $68 = $69 << 24 >> 24;
  5862. $70 = (($68) + -32)|0;
  5863. $71 = 1 << $70;
  5864. $72 = $71 | $$0262390;
  5865. $73 = ((($storemerge273389)) + 1|0);
  5866. $74 = HEAP8[$73>>0]|0;
  5867. $75 = $74 << 24 >> 24;
  5868. $76 = (($75) + -32)|0;
  5869. $77 = ($76>>>0)<(32);
  5870. if ($77) {
  5871. $$0262390 = $72;$65 = $76;$69 = $74;$storemerge273389 = $73;
  5872. } else {
  5873. $$0262342 = $72;$79 = $74;$storemerge273345 = $73;
  5874. break;
  5875. }
  5876. }
  5877. } else {
  5878. $$0262342 = 0;$79 = $61;$storemerge273345 = $storemerge;
  5879. }
  5880. } while(0);
  5881. $78 = ($79<<24>>24)==(42);
  5882. do {
  5883. if ($78) {
  5884. $80 = ((($storemerge273345)) + 1|0);
  5885. $81 = HEAP8[$80>>0]|0;
  5886. $82 = $81 << 24 >> 24;
  5887. $isdigittmp276 = (($82) + -48)|0;
  5888. $isdigit277 = ($isdigittmp276>>>0)<(10);
  5889. if ($isdigit277) {
  5890. $83 = ((($storemerge273345)) + 2|0);
  5891. $84 = HEAP8[$83>>0]|0;
  5892. $85 = ($84<<24>>24)==(36);
  5893. if ($85) {
  5894. $86 = (($4) + ($isdigittmp276<<2)|0);
  5895. HEAP32[$86>>2] = 10;
  5896. $87 = HEAP8[$80>>0]|0;
  5897. $88 = $87 << 24 >> 24;
  5898. $89 = (($88) + -48)|0;
  5899. $90 = (($3) + ($89<<3)|0);
  5900. $91 = $90;
  5901. $92 = $91;
  5902. $93 = HEAP32[$92>>2]|0;
  5903. $94 = (($91) + 4)|0;
  5904. $95 = $94;
  5905. $96 = HEAP32[$95>>2]|0;
  5906. $97 = ((($storemerge273345)) + 3|0);
  5907. $$0259 = $93;$$2271 = 1;$storemerge278 = $97;
  5908. } else {
  5909. label = 24;
  5910. }
  5911. } else {
  5912. label = 24;
  5913. }
  5914. if ((label|0) == 24) {
  5915. label = 0;
  5916. $98 = ($$1270|0)==(0);
  5917. if (!($98)) {
  5918. $$0 = -1;
  5919. break L1;
  5920. }
  5921. if (!($13)) {
  5922. $$1260 = 0;$$1263 = $$0262342;$$3272 = 0;$$4325 = $80;$$pr = $81;
  5923. break;
  5924. }
  5925. $arglist_current = HEAP32[$2>>2]|0;
  5926. $99 = $arglist_current;
  5927. $100 = ((0) + 4|0);
  5928. $expanded4 = $100;
  5929. $expanded = (($expanded4) - 1)|0;
  5930. $101 = (($99) + ($expanded))|0;
  5931. $102 = ((0) + 4|0);
  5932. $expanded8 = $102;
  5933. $expanded7 = (($expanded8) - 1)|0;
  5934. $expanded6 = $expanded7 ^ -1;
  5935. $103 = $101 & $expanded6;
  5936. $104 = $103;
  5937. $105 = HEAP32[$104>>2]|0;
  5938. $arglist_next = ((($104)) + 4|0);
  5939. HEAP32[$2>>2] = $arglist_next;
  5940. $$0259 = $105;$$2271 = 0;$storemerge278 = $80;
  5941. }
  5942. $106 = ($$0259|0)<(0);
  5943. $107 = $$0262342 | 8192;
  5944. $108 = (0 - ($$0259))|0;
  5945. $$$0262 = $106 ? $107 : $$0262342;
  5946. $$$0259 = $106 ? $108 : $$0259;
  5947. $$pre453 = HEAP8[$storemerge278>>0]|0;
  5948. $$1260 = $$$0259;$$1263 = $$$0262;$$3272 = $$2271;$$4325 = $storemerge278;$$pr = $$pre453;
  5949. } else {
  5950. $109 = $79 << 24 >> 24;
  5951. $isdigittmp4$i = (($109) + -48)|0;
  5952. $isdigit5$i = ($isdigittmp4$i>>>0)<(10);
  5953. if ($isdigit5$i) {
  5954. $$06$i = 0;$113 = $storemerge273345;$isdigittmp7$i = $isdigittmp4$i;
  5955. while(1) {
  5956. $110 = ($$06$i*10)|0;
  5957. $111 = (($110) + ($isdigittmp7$i))|0;
  5958. $112 = ((($113)) + 1|0);
  5959. $114 = HEAP8[$112>>0]|0;
  5960. $115 = $114 << 24 >> 24;
  5961. $isdigittmp$i = (($115) + -48)|0;
  5962. $isdigit$i = ($isdigittmp$i>>>0)<(10);
  5963. if ($isdigit$i) {
  5964. $$06$i = $111;$113 = $112;$isdigittmp7$i = $isdigittmp$i;
  5965. } else {
  5966. break;
  5967. }
  5968. }
  5969. $116 = ($111|0)<(0);
  5970. if ($116) {
  5971. $$0 = -1;
  5972. break L1;
  5973. } else {
  5974. $$1260 = $111;$$1263 = $$0262342;$$3272 = $$1270;$$4325 = $112;$$pr = $114;
  5975. }
  5976. } else {
  5977. $$1260 = 0;$$1263 = $$0262342;$$3272 = $$1270;$$4325 = $storemerge273345;$$pr = $79;
  5978. }
  5979. }
  5980. } while(0);
  5981. $117 = ($$pr<<24>>24)==(46);
  5982. L45: do {
  5983. if ($117) {
  5984. $118 = ((($$4325)) + 1|0);
  5985. $119 = HEAP8[$118>>0]|0;
  5986. $120 = ($119<<24>>24)==(42);
  5987. if (!($120)) {
  5988. $147 = $119 << 24 >> 24;
  5989. $isdigittmp4$i287 = (($147) + -48)|0;
  5990. $isdigit5$i288 = ($isdigittmp4$i287>>>0)<(10);
  5991. if ($isdigit5$i288) {
  5992. $$06$i290 = 0;$151 = $118;$isdigittmp7$i289 = $isdigittmp4$i287;
  5993. } else {
  5994. $$0254 = 0;$$6 = $118;
  5995. break;
  5996. }
  5997. while(1) {
  5998. $148 = ($$06$i290*10)|0;
  5999. $149 = (($148) + ($isdigittmp7$i289))|0;
  6000. $150 = ((($151)) + 1|0);
  6001. $152 = HEAP8[$150>>0]|0;
  6002. $153 = $152 << 24 >> 24;
  6003. $isdigittmp$i291 = (($153) + -48)|0;
  6004. $isdigit$i292 = ($isdigittmp$i291>>>0)<(10);
  6005. if ($isdigit$i292) {
  6006. $$06$i290 = $149;$151 = $150;$isdigittmp7$i289 = $isdigittmp$i291;
  6007. } else {
  6008. $$0254 = $149;$$6 = $150;
  6009. break L45;
  6010. }
  6011. }
  6012. }
  6013. $121 = ((($$4325)) + 2|0);
  6014. $122 = HEAP8[$121>>0]|0;
  6015. $123 = $122 << 24 >> 24;
  6016. $isdigittmp274 = (($123) + -48)|0;
  6017. $isdigit275 = ($isdigittmp274>>>0)<(10);
  6018. if ($isdigit275) {
  6019. $124 = ((($$4325)) + 3|0);
  6020. $125 = HEAP8[$124>>0]|0;
  6021. $126 = ($125<<24>>24)==(36);
  6022. if ($126) {
  6023. $127 = (($4) + ($isdigittmp274<<2)|0);
  6024. HEAP32[$127>>2] = 10;
  6025. $128 = HEAP8[$121>>0]|0;
  6026. $129 = $128 << 24 >> 24;
  6027. $130 = (($129) + -48)|0;
  6028. $131 = (($3) + ($130<<3)|0);
  6029. $132 = $131;
  6030. $133 = $132;
  6031. $134 = HEAP32[$133>>2]|0;
  6032. $135 = (($132) + 4)|0;
  6033. $136 = $135;
  6034. $137 = HEAP32[$136>>2]|0;
  6035. $138 = ((($$4325)) + 4|0);
  6036. $$0254 = $134;$$6 = $138;
  6037. break;
  6038. }
  6039. }
  6040. $139 = ($$3272|0)==(0);
  6041. if (!($139)) {
  6042. $$0 = -1;
  6043. break L1;
  6044. }
  6045. if ($13) {
  6046. $arglist_current2 = HEAP32[$2>>2]|0;
  6047. $140 = $arglist_current2;
  6048. $141 = ((0) + 4|0);
  6049. $expanded11 = $141;
  6050. $expanded10 = (($expanded11) - 1)|0;
  6051. $142 = (($140) + ($expanded10))|0;
  6052. $143 = ((0) + 4|0);
  6053. $expanded15 = $143;
  6054. $expanded14 = (($expanded15) - 1)|0;
  6055. $expanded13 = $expanded14 ^ -1;
  6056. $144 = $142 & $expanded13;
  6057. $145 = $144;
  6058. $146 = HEAP32[$145>>2]|0;
  6059. $arglist_next3 = ((($145)) + 4|0);
  6060. HEAP32[$2>>2] = $arglist_next3;
  6061. $$0254 = $146;$$6 = $121;
  6062. } else {
  6063. $$0254 = 0;$$6 = $121;
  6064. }
  6065. } else {
  6066. $$0254 = -1;$$6 = $$4325;
  6067. }
  6068. } while(0);
  6069. $$0252 = 0;$$7 = $$6;
  6070. while(1) {
  6071. $154 = HEAP8[$$7>>0]|0;
  6072. $155 = $154 << 24 >> 24;
  6073. $156 = (($155) + -65)|0;
  6074. $157 = ($156>>>0)>(57);
  6075. if ($157) {
  6076. $$0 = -1;
  6077. break L1;
  6078. }
  6079. $158 = ((($$7)) + 1|0);
  6080. $159 = ((283 + (($$0252*58)|0)|0) + ($156)|0);
  6081. $160 = HEAP8[$159>>0]|0;
  6082. $161 = $160&255;
  6083. $162 = (($161) + -1)|0;
  6084. $163 = ($162>>>0)<(8);
  6085. if ($163) {
  6086. $$0252 = $161;$$7 = $158;
  6087. } else {
  6088. break;
  6089. }
  6090. }
  6091. $164 = ($160<<24>>24)==(0);
  6092. if ($164) {
  6093. $$0 = -1;
  6094. break;
  6095. }
  6096. $165 = ($160<<24>>24)==(19);
  6097. $166 = ($$0253|0)>(-1);
  6098. do {
  6099. if ($165) {
  6100. if ($166) {
  6101. $$0 = -1;
  6102. break L1;
  6103. } else {
  6104. label = 51;
  6105. }
  6106. } else {
  6107. if ($166) {
  6108. $167 = (($4) + ($$0253<<2)|0);
  6109. HEAP32[$167>>2] = $161;
  6110. $168 = (($3) + ($$0253<<3)|0);
  6111. $169 = $168;
  6112. $170 = $169;
  6113. $171 = HEAP32[$170>>2]|0;
  6114. $172 = (($169) + 4)|0;
  6115. $173 = $172;
  6116. $174 = HEAP32[$173>>2]|0;
  6117. $175 = $9;
  6118. $176 = $175;
  6119. HEAP32[$176>>2] = $171;
  6120. $177 = (($175) + 4)|0;
  6121. $178 = $177;
  6122. HEAP32[$178>>2] = $174;
  6123. label = 51;
  6124. break;
  6125. }
  6126. if (!($13)) {
  6127. $$0 = 0;
  6128. break L1;
  6129. }
  6130. _pop_arg($9,$161,$2);
  6131. }
  6132. } while(0);
  6133. if ((label|0) == 51) {
  6134. label = 0;
  6135. if (!($13)) {
  6136. $$0243 = 0;$$0247 = $$1248;$$0269 = $$3272;$$0321 = $158;
  6137. continue;
  6138. }
  6139. }
  6140. $179 = HEAP8[$$7>>0]|0;
  6141. $180 = $179 << 24 >> 24;
  6142. $181 = ($$0252|0)!=(0);
  6143. $182 = $180 & 15;
  6144. $183 = ($182|0)==(3);
  6145. $or$cond280 = $181 & $183;
  6146. $184 = $180 & -33;
  6147. $$0235 = $or$cond280 ? $184 : $180;
  6148. $185 = $$1263 & 8192;
  6149. $186 = ($185|0)==(0);
  6150. $187 = $$1263 & -65537;
  6151. $$1263$ = $186 ? $$1263 : $187;
  6152. L74: do {
  6153. switch ($$0235|0) {
  6154. case 110: {
  6155. $trunc = $$0252&255;
  6156. switch ($trunc<<24>>24) {
  6157. case 0: {
  6158. $194 = HEAP32[$9>>2]|0;
  6159. HEAP32[$194>>2] = $$1248;
  6160. $$0243 = 0;$$0247 = $$1248;$$0269 = $$3272;$$0321 = $158;
  6161. continue L1;
  6162. break;
  6163. }
  6164. case 1: {
  6165. $195 = HEAP32[$9>>2]|0;
  6166. HEAP32[$195>>2] = $$1248;
  6167. $$0243 = 0;$$0247 = $$1248;$$0269 = $$3272;$$0321 = $158;
  6168. continue L1;
  6169. break;
  6170. }
  6171. case 2: {
  6172. $196 = ($$1248|0)<(0);
  6173. $197 = $196 << 31 >> 31;
  6174. $198 = HEAP32[$9>>2]|0;
  6175. $199 = $198;
  6176. $200 = $199;
  6177. HEAP32[$200>>2] = $$1248;
  6178. $201 = (($199) + 4)|0;
  6179. $202 = $201;
  6180. HEAP32[$202>>2] = $197;
  6181. $$0243 = 0;$$0247 = $$1248;$$0269 = $$3272;$$0321 = $158;
  6182. continue L1;
  6183. break;
  6184. }
  6185. case 3: {
  6186. $203 = $$1248&65535;
  6187. $204 = HEAP32[$9>>2]|0;
  6188. HEAP16[$204>>1] = $203;
  6189. $$0243 = 0;$$0247 = $$1248;$$0269 = $$3272;$$0321 = $158;
  6190. continue L1;
  6191. break;
  6192. }
  6193. case 4: {
  6194. $205 = $$1248&255;
  6195. $206 = HEAP32[$9>>2]|0;
  6196. HEAP8[$206>>0] = $205;
  6197. $$0243 = 0;$$0247 = $$1248;$$0269 = $$3272;$$0321 = $158;
  6198. continue L1;
  6199. break;
  6200. }
  6201. case 6: {
  6202. $207 = HEAP32[$9>>2]|0;
  6203. HEAP32[$207>>2] = $$1248;
  6204. $$0243 = 0;$$0247 = $$1248;$$0269 = $$3272;$$0321 = $158;
  6205. continue L1;
  6206. break;
  6207. }
  6208. case 7: {
  6209. $208 = ($$1248|0)<(0);
  6210. $209 = $208 << 31 >> 31;
  6211. $210 = HEAP32[$9>>2]|0;
  6212. $211 = $210;
  6213. $212 = $211;
  6214. HEAP32[$212>>2] = $$1248;
  6215. $213 = (($211) + 4)|0;
  6216. $214 = $213;
  6217. HEAP32[$214>>2] = $209;
  6218. $$0243 = 0;$$0247 = $$1248;$$0269 = $$3272;$$0321 = $158;
  6219. continue L1;
  6220. break;
  6221. }
  6222. default: {
  6223. $$0243 = 0;$$0247 = $$1248;$$0269 = $$3272;$$0321 = $158;
  6224. continue L1;
  6225. }
  6226. }
  6227. break;
  6228. }
  6229. case 112: {
  6230. $215 = ($$0254>>>0)>(8);
  6231. $216 = $215 ? $$0254 : 8;
  6232. $217 = $$1263$ | 8;
  6233. $$1236 = 120;$$1255 = $216;$$3265 = $217;
  6234. label = 63;
  6235. break;
  6236. }
  6237. case 88: case 120: {
  6238. $$1236 = $$0235;$$1255 = $$0254;$$3265 = $$1263$;
  6239. label = 63;
  6240. break;
  6241. }
  6242. case 111: {
  6243. $257 = $9;
  6244. $258 = $257;
  6245. $259 = HEAP32[$258>>2]|0;
  6246. $260 = (($257) + 4)|0;
  6247. $261 = $260;
  6248. $262 = HEAP32[$261>>2]|0;
  6249. $263 = ($259|0)==(0);
  6250. $264 = ($262|0)==(0);
  6251. $265 = $263 & $264;
  6252. if ($265) {
  6253. $$0$lcssa$i300 = $14;
  6254. } else {
  6255. $$06$i298 = $14;$267 = $259;$271 = $262;
  6256. while(1) {
  6257. $266 = $267 & 7;
  6258. $268 = $266 | 48;
  6259. $269 = $268&255;
  6260. $270 = ((($$06$i298)) + -1|0);
  6261. HEAP8[$270>>0] = $269;
  6262. $272 = (_bitshift64Lshr(($267|0),($271|0),3)|0);
  6263. $273 = tempRet0;
  6264. $274 = ($272|0)==(0);
  6265. $275 = ($273|0)==(0);
  6266. $276 = $274 & $275;
  6267. if ($276) {
  6268. $$0$lcssa$i300 = $270;
  6269. break;
  6270. } else {
  6271. $$06$i298 = $270;$267 = $272;$271 = $273;
  6272. }
  6273. }
  6274. }
  6275. $277 = $$1263$ & 8;
  6276. $278 = ($277|0)==(0);
  6277. if ($278) {
  6278. $$0228 = $$0$lcssa$i300;$$1233 = 0;$$1238 = 763;$$2256 = $$0254;$$4266 = $$1263$;
  6279. label = 76;
  6280. } else {
  6281. $279 = $$0$lcssa$i300;
  6282. $280 = (($15) - ($279))|0;
  6283. $281 = ($$0254|0)>($280|0);
  6284. $282 = (($280) + 1)|0;
  6285. $$0254$ = $281 ? $$0254 : $282;
  6286. $$0228 = $$0$lcssa$i300;$$1233 = 0;$$1238 = 763;$$2256 = $$0254$;$$4266 = $$1263$;
  6287. label = 76;
  6288. }
  6289. break;
  6290. }
  6291. case 105: case 100: {
  6292. $283 = $9;
  6293. $284 = $283;
  6294. $285 = HEAP32[$284>>2]|0;
  6295. $286 = (($283) + 4)|0;
  6296. $287 = $286;
  6297. $288 = HEAP32[$287>>2]|0;
  6298. $289 = ($288|0)<(0);
  6299. if ($289) {
  6300. $290 = (_i64Subtract(0,0,($285|0),($288|0))|0);
  6301. $291 = tempRet0;
  6302. $292 = $9;
  6303. $293 = $292;
  6304. HEAP32[$293>>2] = $290;
  6305. $294 = (($292) + 4)|0;
  6306. $295 = $294;
  6307. HEAP32[$295>>2] = $291;
  6308. $$0232 = 1;$$0237 = 763;$300 = $290;$301 = $291;
  6309. label = 75;
  6310. break L74;
  6311. }
  6312. $296 = $$1263$ & 2048;
  6313. $297 = ($296|0)==(0);
  6314. if ($297) {
  6315. $298 = $$1263$ & 1;
  6316. $299 = ($298|0)==(0);
  6317. $$ = $299 ? 763 : (765);
  6318. $$0232 = $298;$$0237 = $$;$300 = $285;$301 = $288;
  6319. label = 75;
  6320. } else {
  6321. $$0232 = 1;$$0237 = (764);$300 = $285;$301 = $288;
  6322. label = 75;
  6323. }
  6324. break;
  6325. }
  6326. case 117: {
  6327. $188 = $9;
  6328. $189 = $188;
  6329. $190 = HEAP32[$189>>2]|0;
  6330. $191 = (($188) + 4)|0;
  6331. $192 = $191;
  6332. $193 = HEAP32[$192>>2]|0;
  6333. $$0232 = 0;$$0237 = 763;$300 = $190;$301 = $193;
  6334. label = 75;
  6335. break;
  6336. }
  6337. case 99: {
  6338. $321 = $9;
  6339. $322 = $321;
  6340. $323 = HEAP32[$322>>2]|0;
  6341. $324 = (($321) + 4)|0;
  6342. $325 = $324;
  6343. $326 = HEAP32[$325>>2]|0;
  6344. $327 = $323&255;
  6345. HEAP8[$16>>0] = $327;
  6346. $$2 = $16;$$2234 = 0;$$2239 = 763;$$2251 = $14;$$5 = 1;$$6268 = $187;
  6347. break;
  6348. }
  6349. case 109: {
  6350. $328 = (___errno_location()|0);
  6351. $329 = HEAP32[$328>>2]|0;
  6352. $330 = (_strerror($329)|0);
  6353. $$1 = $330;
  6354. label = 81;
  6355. break;
  6356. }
  6357. case 115: {
  6358. $331 = HEAP32[$9>>2]|0;
  6359. $332 = ($331|0)!=(0|0);
  6360. $333 = $332 ? $331 : 773;
  6361. $$1 = $333;
  6362. label = 81;
  6363. break;
  6364. }
  6365. case 67: {
  6366. $340 = $9;
  6367. $341 = $340;
  6368. $342 = HEAP32[$341>>2]|0;
  6369. $343 = (($340) + 4)|0;
  6370. $344 = $343;
  6371. $345 = HEAP32[$344>>2]|0;
  6372. HEAP32[$11>>2] = $342;
  6373. HEAP32[$17>>2] = 0;
  6374. HEAP32[$9>>2] = $11;
  6375. $$4258458 = -1;$809 = $11;
  6376. label = 85;
  6377. break;
  6378. }
  6379. case 83: {
  6380. $$pre454 = HEAP32[$9>>2]|0;
  6381. $346 = ($$0254|0)==(0);
  6382. if ($346) {
  6383. _pad($0,32,$$1260,0,$$1263$);
  6384. $$0240$lcssa460 = 0;
  6385. label = 96;
  6386. } else {
  6387. $$4258458 = $$0254;$809 = $$pre454;
  6388. label = 85;
  6389. }
  6390. break;
  6391. }
  6392. case 65: case 71: case 70: case 69: case 97: case 103: case 102: case 101: {
  6393. $371 = +HEAPF64[$9>>3];
  6394. HEAP32[$6>>2] = 0;
  6395. HEAPF64[tempDoublePtr>>3] = $371;$372 = HEAP32[tempDoublePtr>>2]|0;
  6396. $373 = HEAP32[tempDoublePtr+4>>2]|0;
  6397. $374 = ($373|0)<(0);
  6398. if ($374) {
  6399. $375 = -$371;
  6400. $$0471$i = $375;$$0520$i = 1;$$0522$i = 780;
  6401. } else {
  6402. $376 = $$1263$ & 2048;
  6403. $377 = ($376|0)==(0);
  6404. $378 = $$1263$ & 1;
  6405. if ($377) {
  6406. $379 = ($378|0)==(0);
  6407. $$$i = $379 ? (781) : (786);
  6408. $$0471$i = $371;$$0520$i = $378;$$0522$i = $$$i;
  6409. } else {
  6410. $$0471$i = $371;$$0520$i = 1;$$0522$i = (783);
  6411. }
  6412. }
  6413. HEAPF64[tempDoublePtr>>3] = $$0471$i;$380 = HEAP32[tempDoublePtr>>2]|0;
  6414. $381 = HEAP32[tempDoublePtr+4>>2]|0;
  6415. $382 = $381 & 2146435072;
  6416. $383 = ($382>>>0)<(2146435072);
  6417. $384 = (0)<(0);
  6418. $385 = ($382|0)==(2146435072);
  6419. $386 = $385 & $384;
  6420. $387 = $383 | $386;
  6421. do {
  6422. if ($387) {
  6423. $403 = (+_frexpl($$0471$i,$6));
  6424. $404 = $403 * 2.0;
  6425. $405 = $404 != 0.0;
  6426. if ($405) {
  6427. $406 = HEAP32[$6>>2]|0;
  6428. $407 = (($406) + -1)|0;
  6429. HEAP32[$6>>2] = $407;
  6430. }
  6431. $408 = $$0235 | 32;
  6432. $409 = ($408|0)==(97);
  6433. if ($409) {
  6434. $410 = $$0235 & 32;
  6435. $411 = ($410|0)==(0);
  6436. $412 = ((($$0522$i)) + 9|0);
  6437. $$0522$$i = $411 ? $$0522$i : $412;
  6438. $413 = $$0520$i | 2;
  6439. $414 = ($$0254>>>0)>(11);
  6440. $415 = (12 - ($$0254))|0;
  6441. $416 = ($415|0)==(0);
  6442. $417 = $414 | $416;
  6443. do {
  6444. if ($417) {
  6445. $$1472$i = $404;
  6446. } else {
  6447. $$0509592$i = 8.0;$$1508593$i = $415;
  6448. while(1) {
  6449. $418 = (($$1508593$i) + -1)|0;
  6450. $419 = $$0509592$i * 16.0;
  6451. $420 = ($418|0)==(0);
  6452. if ($420) {
  6453. break;
  6454. } else {
  6455. $$0509592$i = $419;$$1508593$i = $418;
  6456. }
  6457. }
  6458. $421 = HEAP8[$$0522$$i>>0]|0;
  6459. $422 = ($421<<24>>24)==(45);
  6460. if ($422) {
  6461. $423 = -$404;
  6462. $424 = $423 - $419;
  6463. $425 = $419 + $424;
  6464. $426 = -$425;
  6465. $$1472$i = $426;
  6466. break;
  6467. } else {
  6468. $427 = $404 + $419;
  6469. $428 = $427 - $419;
  6470. $$1472$i = $428;
  6471. break;
  6472. }
  6473. }
  6474. } while(0);
  6475. $429 = HEAP32[$6>>2]|0;
  6476. $430 = ($429|0)<(0);
  6477. $431 = (0 - ($429))|0;
  6478. $432 = $430 ? $431 : $429;
  6479. $433 = ($432|0)<(0);
  6480. $434 = $433 << 31 >> 31;
  6481. $435 = (_fmt_u($432,$434,$20)|0);
  6482. $436 = ($435|0)==($20|0);
  6483. if ($436) {
  6484. HEAP8[$21>>0] = 48;
  6485. $$0511$i = $21;
  6486. } else {
  6487. $$0511$i = $435;
  6488. }
  6489. $437 = $429 >> 31;
  6490. $438 = $437 & 2;
  6491. $439 = (($438) + 43)|0;
  6492. $440 = $439&255;
  6493. $441 = ((($$0511$i)) + -1|0);
  6494. HEAP8[$441>>0] = $440;
  6495. $442 = (($$0235) + 15)|0;
  6496. $443 = $442&255;
  6497. $444 = ((($$0511$i)) + -2|0);
  6498. HEAP8[$444>>0] = $443;
  6499. $notrhs$i = ($$0254|0)<(1);
  6500. $445 = $$1263$ & 8;
  6501. $446 = ($445|0)==(0);
  6502. $$0524$i = $7;$$2473$i = $$1472$i;
  6503. while(1) {
  6504. $447 = (~~(($$2473$i)));
  6505. $448 = (747 + ($447)|0);
  6506. $449 = HEAP8[$448>>0]|0;
  6507. $450 = $449&255;
  6508. $451 = $450 | $410;
  6509. $452 = $451&255;
  6510. $453 = ((($$0524$i)) + 1|0);
  6511. HEAP8[$$0524$i>>0] = $452;
  6512. $454 = (+($447|0));
  6513. $455 = $$2473$i - $454;
  6514. $456 = $455 * 16.0;
  6515. $457 = $453;
  6516. $458 = (($457) - ($18))|0;
  6517. $459 = ($458|0)==(1);
  6518. do {
  6519. if ($459) {
  6520. $notlhs$i = $456 == 0.0;
  6521. $or$cond3$not$i = $notrhs$i & $notlhs$i;
  6522. $or$cond$i = $446 & $or$cond3$not$i;
  6523. if ($or$cond$i) {
  6524. $$1525$i = $453;
  6525. break;
  6526. }
  6527. $460 = ((($$0524$i)) + 2|0);
  6528. HEAP8[$453>>0] = 46;
  6529. $$1525$i = $460;
  6530. } else {
  6531. $$1525$i = $453;
  6532. }
  6533. } while(0);
  6534. $461 = $456 != 0.0;
  6535. if ($461) {
  6536. $$0524$i = $$1525$i;$$2473$i = $456;
  6537. } else {
  6538. break;
  6539. }
  6540. }
  6541. $462 = ($$0254|0)!=(0);
  6542. $$pre700$i = $$1525$i;
  6543. $463 = (($24) + ($$pre700$i))|0;
  6544. $464 = ($463|0)<($$0254|0);
  6545. $or$cond412 = $462 & $464;
  6546. $465 = $444;
  6547. $466 = (($25) + ($$0254))|0;
  6548. $467 = (($466) - ($465))|0;
  6549. $468 = (($23) - ($465))|0;
  6550. $469 = (($468) + ($$pre700$i))|0;
  6551. $$0526$i = $or$cond412 ? $467 : $469;
  6552. $470 = (($$0526$i) + ($413))|0;
  6553. _pad($0,32,$$1260,$470,$$1263$);
  6554. $471 = HEAP32[$0>>2]|0;
  6555. $472 = $471 & 32;
  6556. $473 = ($472|0)==(0);
  6557. if ($473) {
  6558. (___fwritex($$0522$$i,$413,$0)|0);
  6559. }
  6560. $474 = $$1263$ ^ 65536;
  6561. _pad($0,48,$$1260,$470,$474);
  6562. $475 = (($$pre700$i) - ($18))|0;
  6563. $476 = HEAP32[$0>>2]|0;
  6564. $477 = $476 & 32;
  6565. $478 = ($477|0)==(0);
  6566. if ($478) {
  6567. (___fwritex($7,$475,$0)|0);
  6568. }
  6569. $479 = (($22) - ($465))|0;
  6570. $sum = (($475) + ($479))|0;
  6571. $480 = (($$0526$i) - ($sum))|0;
  6572. _pad($0,48,$480,0,0);
  6573. $481 = HEAP32[$0>>2]|0;
  6574. $482 = $481 & 32;
  6575. $483 = ($482|0)==(0);
  6576. if ($483) {
  6577. (___fwritex($444,$479,$0)|0);
  6578. }
  6579. $484 = $$1263$ ^ 8192;
  6580. _pad($0,32,$$1260,$470,$484);
  6581. $485 = ($470|0)<($$1260|0);
  6582. $$537$i = $485 ? $$1260 : $470;
  6583. $$0470$i = $$537$i;
  6584. break;
  6585. }
  6586. $486 = ($$0254|0)<(0);
  6587. $$538$i = $486 ? 6 : $$0254;
  6588. if ($405) {
  6589. $487 = $404 * 268435456.0;
  6590. $488 = HEAP32[$6>>2]|0;
  6591. $489 = (($488) + -28)|0;
  6592. HEAP32[$6>>2] = $489;
  6593. $$3$i = $487;$$pr$i = $489;
  6594. } else {
  6595. $$pre697$i = HEAP32[$6>>2]|0;
  6596. $$3$i = $404;$$pr$i = $$pre697$i;
  6597. }
  6598. $490 = ($$pr$i|0)<(0);
  6599. $$554$i = $490 ? $5 : $26;
  6600. $$0498$i = $$554$i;$$4$i = $$3$i;
  6601. while(1) {
  6602. $491 = (~~(($$4$i))>>>0);
  6603. HEAP32[$$0498$i>>2] = $491;
  6604. $492 = ((($$0498$i)) + 4|0);
  6605. $493 = (+($491>>>0));
  6606. $494 = $$4$i - $493;
  6607. $495 = $494 * 1.0E+9;
  6608. $496 = $495 != 0.0;
  6609. if ($496) {
  6610. $$0498$i = $492;$$4$i = $495;
  6611. } else {
  6612. break;
  6613. }
  6614. }
  6615. $497 = ($$pr$i|0)>(0);
  6616. if ($497) {
  6617. $$1482671$i = $$554$i;$$1499670$i = $492;$499 = $$pr$i;
  6618. while(1) {
  6619. $498 = ($499|0)>(29);
  6620. $500 = $498 ? 29 : $499;
  6621. $$0488663$i = ((($$1499670$i)) + -4|0);
  6622. $501 = ($$0488663$i>>>0)<($$1482671$i>>>0);
  6623. do {
  6624. if ($501) {
  6625. $$2483$ph$i = $$1482671$i;
  6626. } else {
  6627. $$0488665$i = $$0488663$i;$$0497664$i = 0;
  6628. while(1) {
  6629. $502 = HEAP32[$$0488665$i>>2]|0;
  6630. $503 = (_bitshift64Shl(($502|0),0,($500|0))|0);
  6631. $504 = tempRet0;
  6632. $505 = (_i64Add(($503|0),($504|0),($$0497664$i|0),0)|0);
  6633. $506 = tempRet0;
  6634. $507 = (___uremdi3(($505|0),($506|0),1000000000,0)|0);
  6635. $508 = tempRet0;
  6636. HEAP32[$$0488665$i>>2] = $507;
  6637. $509 = (___udivdi3(($505|0),($506|0),1000000000,0)|0);
  6638. $510 = tempRet0;
  6639. $$0488$i = ((($$0488665$i)) + -4|0);
  6640. $511 = ($$0488$i>>>0)<($$1482671$i>>>0);
  6641. if ($511) {
  6642. break;
  6643. } else {
  6644. $$0488665$i = $$0488$i;$$0497664$i = $509;
  6645. }
  6646. }
  6647. $512 = ($509|0)==(0);
  6648. if ($512) {
  6649. $$2483$ph$i = $$1482671$i;
  6650. break;
  6651. }
  6652. $513 = ((($$1482671$i)) + -4|0);
  6653. HEAP32[$513>>2] = $509;
  6654. $$2483$ph$i = $513;
  6655. }
  6656. } while(0);
  6657. $$2500$i = $$1499670$i;
  6658. while(1) {
  6659. $514 = ($$2500$i>>>0)>($$2483$ph$i>>>0);
  6660. if (!($514)) {
  6661. break;
  6662. }
  6663. $515 = ((($$2500$i)) + -4|0);
  6664. $516 = HEAP32[$515>>2]|0;
  6665. $517 = ($516|0)==(0);
  6666. if ($517) {
  6667. $$2500$i = $515;
  6668. } else {
  6669. break;
  6670. }
  6671. }
  6672. $518 = HEAP32[$6>>2]|0;
  6673. $519 = (($518) - ($500))|0;
  6674. HEAP32[$6>>2] = $519;
  6675. $520 = ($519|0)>(0);
  6676. if ($520) {
  6677. $$1482671$i = $$2483$ph$i;$$1499670$i = $$2500$i;$499 = $519;
  6678. } else {
  6679. $$1482$lcssa$i = $$2483$ph$i;$$1499$lcssa$i = $$2500$i;$$pr571$i = $519;
  6680. break;
  6681. }
  6682. }
  6683. } else {
  6684. $$1482$lcssa$i = $$554$i;$$1499$lcssa$i = $492;$$pr571$i = $$pr$i;
  6685. }
  6686. $521 = ($$pr571$i|0)<(0);
  6687. if ($521) {
  6688. $522 = (($$538$i) + 25)|0;
  6689. $523 = (($522|0) / 9)&-1;
  6690. $524 = (($523) + 1)|0;
  6691. $525 = ($408|0)==(102);
  6692. $$3484658$i = $$1482$lcssa$i;$$3501657$i = $$1499$lcssa$i;$527 = $$pr571$i;
  6693. while(1) {
  6694. $526 = (0 - ($527))|0;
  6695. $528 = ($526|0)>(9);
  6696. $529 = $528 ? 9 : $526;
  6697. $530 = ($$3484658$i>>>0)<($$3501657$i>>>0);
  6698. do {
  6699. if ($530) {
  6700. $534 = 1 << $529;
  6701. $535 = (($534) + -1)|0;
  6702. $536 = 1000000000 >>> $529;
  6703. $$0487652$i = 0;$$1489651$i = $$3484658$i;
  6704. while(1) {
  6705. $537 = HEAP32[$$1489651$i>>2]|0;
  6706. $538 = $537 & $535;
  6707. $539 = $537 >>> $529;
  6708. $540 = (($539) + ($$0487652$i))|0;
  6709. HEAP32[$$1489651$i>>2] = $540;
  6710. $541 = Math_imul($538, $536)|0;
  6711. $542 = ((($$1489651$i)) + 4|0);
  6712. $543 = ($542>>>0)<($$3501657$i>>>0);
  6713. if ($543) {
  6714. $$0487652$i = $541;$$1489651$i = $542;
  6715. } else {
  6716. break;
  6717. }
  6718. }
  6719. $544 = HEAP32[$$3484658$i>>2]|0;
  6720. $545 = ($544|0)==(0);
  6721. $546 = ((($$3484658$i)) + 4|0);
  6722. $$$3484$i = $545 ? $546 : $$3484658$i;
  6723. $547 = ($541|0)==(0);
  6724. if ($547) {
  6725. $$$3484706$i = $$$3484$i;$$4502$i = $$3501657$i;
  6726. break;
  6727. }
  6728. $548 = ((($$3501657$i)) + 4|0);
  6729. HEAP32[$$3501657$i>>2] = $541;
  6730. $$$3484706$i = $$$3484$i;$$4502$i = $548;
  6731. } else {
  6732. $531 = HEAP32[$$3484658$i>>2]|0;
  6733. $532 = ($531|0)==(0);
  6734. $533 = ((($$3484658$i)) + 4|0);
  6735. $$$3484705$i = $532 ? $533 : $$3484658$i;
  6736. $$$3484706$i = $$$3484705$i;$$4502$i = $$3501657$i;
  6737. }
  6738. } while(0);
  6739. $549 = $525 ? $$554$i : $$$3484706$i;
  6740. $550 = $$4502$i;
  6741. $551 = $549;
  6742. $552 = (($550) - ($551))|0;
  6743. $553 = $552 >> 2;
  6744. $554 = ($553|0)>($524|0);
  6745. $555 = (($549) + ($524<<2)|0);
  6746. $$$4502$i = $554 ? $555 : $$4502$i;
  6747. $556 = HEAP32[$6>>2]|0;
  6748. $557 = (($556) + ($529))|0;
  6749. HEAP32[$6>>2] = $557;
  6750. $558 = ($557|0)<(0);
  6751. if ($558) {
  6752. $$3484658$i = $$$3484706$i;$$3501657$i = $$$4502$i;$527 = $557;
  6753. } else {
  6754. $$3484$lcssa$i = $$$3484706$i;$$3501$lcssa$i = $$$4502$i;
  6755. break;
  6756. }
  6757. }
  6758. } else {
  6759. $$3484$lcssa$i = $$1482$lcssa$i;$$3501$lcssa$i = $$1499$lcssa$i;
  6760. }
  6761. $559 = ($$3484$lcssa$i>>>0)<($$3501$lcssa$i>>>0);
  6762. $560 = $$554$i;
  6763. do {
  6764. if ($559) {
  6765. $561 = $$3484$lcssa$i;
  6766. $562 = (($560) - ($561))|0;
  6767. $563 = $562 >> 2;
  6768. $564 = ($563*9)|0;
  6769. $565 = HEAP32[$$3484$lcssa$i>>2]|0;
  6770. $566 = ($565>>>0)<(10);
  6771. if ($566) {
  6772. $$1515$i = $564;
  6773. break;
  6774. } else {
  6775. $$0514647$i = $564;$$0531646$i = 10;
  6776. }
  6777. while(1) {
  6778. $567 = ($$0531646$i*10)|0;
  6779. $568 = (($$0514647$i) + 1)|0;
  6780. $569 = ($565>>>0)<($567>>>0);
  6781. if ($569) {
  6782. $$1515$i = $568;
  6783. break;
  6784. } else {
  6785. $$0514647$i = $568;$$0531646$i = $567;
  6786. }
  6787. }
  6788. } else {
  6789. $$1515$i = 0;
  6790. }
  6791. } while(0);
  6792. $570 = ($408|0)!=(102);
  6793. $571 = $570 ? $$1515$i : 0;
  6794. $572 = (($$538$i) - ($571))|0;
  6795. $573 = ($408|0)==(103);
  6796. $574 = ($$538$i|0)!=(0);
  6797. $575 = $574 & $573;
  6798. $$neg$i = $575 << 31 >> 31;
  6799. $576 = (($572) + ($$neg$i))|0;
  6800. $577 = $$3501$lcssa$i;
  6801. $578 = (($577) - ($560))|0;
  6802. $579 = $578 >> 2;
  6803. $580 = ($579*9)|0;
  6804. $581 = (($580) + -9)|0;
  6805. $582 = ($576|0)<($581|0);
  6806. if ($582) {
  6807. $583 = ((($$554$i)) + 4|0);
  6808. $584 = (($576) + 9216)|0;
  6809. $585 = (($584|0) / 9)&-1;
  6810. $586 = (($585) + -1024)|0;
  6811. $587 = (($583) + ($586<<2)|0);
  6812. $588 = (($584|0) % 9)&-1;
  6813. $$0528639$i = (($588) + 1)|0;
  6814. $589 = ($$0528639$i|0)<(9);
  6815. if ($589) {
  6816. $$0528641$i = $$0528639$i;$$1532640$i = 10;
  6817. while(1) {
  6818. $590 = ($$1532640$i*10)|0;
  6819. $$0528$i = (($$0528641$i) + 1)|0;
  6820. $exitcond$i = ($$0528$i|0)==(9);
  6821. if ($exitcond$i) {
  6822. $$1532$lcssa$i = $590;
  6823. break;
  6824. } else {
  6825. $$0528641$i = $$0528$i;$$1532640$i = $590;
  6826. }
  6827. }
  6828. } else {
  6829. $$1532$lcssa$i = 10;
  6830. }
  6831. $591 = HEAP32[$587>>2]|0;
  6832. $592 = (($591>>>0) % ($$1532$lcssa$i>>>0))&-1;
  6833. $593 = ($592|0)==(0);
  6834. $594 = ((($587)) + 4|0);
  6835. $595 = ($594|0)==($$3501$lcssa$i|0);
  6836. $or$cond540$i = $595 & $593;
  6837. do {
  6838. if ($or$cond540$i) {
  6839. $$4492$i = $587;$$4518$i = $$1515$i;$$8$i = $$3484$lcssa$i;
  6840. } else {
  6841. $596 = (($591>>>0) / ($$1532$lcssa$i>>>0))&-1;
  6842. $597 = $596 & 1;
  6843. $598 = ($597|0)==(0);
  6844. $$541$i = $598 ? 9007199254740992.0 : 9007199254740994.0;
  6845. $599 = (($$1532$lcssa$i|0) / 2)&-1;
  6846. $600 = ($592>>>0)<($599>>>0);
  6847. if ($600) {
  6848. $$0466$i = 0.5;
  6849. } else {
  6850. $601 = ($592|0)==($599|0);
  6851. $or$cond543$i = $595 & $601;
  6852. $$557$i = $or$cond543$i ? 1.0 : 1.5;
  6853. $$0466$i = $$557$i;
  6854. }
  6855. $602 = ($$0520$i|0)==(0);
  6856. do {
  6857. if ($602) {
  6858. $$1467$i = $$0466$i;$$1469$i = $$541$i;
  6859. } else {
  6860. $603 = HEAP8[$$0522$i>>0]|0;
  6861. $604 = ($603<<24>>24)==(45);
  6862. if (!($604)) {
  6863. $$1467$i = $$0466$i;$$1469$i = $$541$i;
  6864. break;
  6865. }
  6866. $605 = -$$541$i;
  6867. $606 = -$$0466$i;
  6868. $$1467$i = $606;$$1469$i = $605;
  6869. }
  6870. } while(0);
  6871. $607 = (($591) - ($592))|0;
  6872. HEAP32[$587>>2] = $607;
  6873. $608 = $$1469$i + $$1467$i;
  6874. $609 = $608 != $$1469$i;
  6875. if (!($609)) {
  6876. $$4492$i = $587;$$4518$i = $$1515$i;$$8$i = $$3484$lcssa$i;
  6877. break;
  6878. }
  6879. $610 = (($607) + ($$1532$lcssa$i))|0;
  6880. HEAP32[$587>>2] = $610;
  6881. $611 = ($610>>>0)>(999999999);
  6882. if ($611) {
  6883. $$2490632$i = $587;$$5486633$i = $$3484$lcssa$i;
  6884. while(1) {
  6885. $612 = ((($$2490632$i)) + -4|0);
  6886. HEAP32[$$2490632$i>>2] = 0;
  6887. $613 = ($612>>>0)<($$5486633$i>>>0);
  6888. if ($613) {
  6889. $614 = ((($$5486633$i)) + -4|0);
  6890. HEAP32[$614>>2] = 0;
  6891. $$6$i = $614;
  6892. } else {
  6893. $$6$i = $$5486633$i;
  6894. }
  6895. $615 = HEAP32[$612>>2]|0;
  6896. $616 = (($615) + 1)|0;
  6897. HEAP32[$612>>2] = $616;
  6898. $617 = ($616>>>0)>(999999999);
  6899. if ($617) {
  6900. $$2490632$i = $612;$$5486633$i = $$6$i;
  6901. } else {
  6902. $$2490$lcssa$i = $612;$$5486$lcssa$i = $$6$i;
  6903. break;
  6904. }
  6905. }
  6906. } else {
  6907. $$2490$lcssa$i = $587;$$5486$lcssa$i = $$3484$lcssa$i;
  6908. }
  6909. $618 = $$5486$lcssa$i;
  6910. $619 = (($560) - ($618))|0;
  6911. $620 = $619 >> 2;
  6912. $621 = ($620*9)|0;
  6913. $622 = HEAP32[$$5486$lcssa$i>>2]|0;
  6914. $623 = ($622>>>0)<(10);
  6915. if ($623) {
  6916. $$4492$i = $$2490$lcssa$i;$$4518$i = $621;$$8$i = $$5486$lcssa$i;
  6917. break;
  6918. } else {
  6919. $$2516628$i = $621;$$2533627$i = 10;
  6920. }
  6921. while(1) {
  6922. $624 = ($$2533627$i*10)|0;
  6923. $625 = (($$2516628$i) + 1)|0;
  6924. $626 = ($622>>>0)<($624>>>0);
  6925. if ($626) {
  6926. $$4492$i = $$2490$lcssa$i;$$4518$i = $625;$$8$i = $$5486$lcssa$i;
  6927. break;
  6928. } else {
  6929. $$2516628$i = $625;$$2533627$i = $624;
  6930. }
  6931. }
  6932. }
  6933. } while(0);
  6934. $627 = ((($$4492$i)) + 4|0);
  6935. $628 = ($$3501$lcssa$i>>>0)>($627>>>0);
  6936. $$$3501$i = $628 ? $627 : $$3501$lcssa$i;
  6937. $$5519$ph$i = $$4518$i;$$7505$ph$i = $$$3501$i;$$9$ph$i = $$8$i;
  6938. } else {
  6939. $$5519$ph$i = $$1515$i;$$7505$ph$i = $$3501$lcssa$i;$$9$ph$i = $$3484$lcssa$i;
  6940. }
  6941. $629 = (0 - ($$5519$ph$i))|0;
  6942. $$7505$i = $$7505$ph$i;
  6943. while(1) {
  6944. $630 = ($$7505$i>>>0)>($$9$ph$i>>>0);
  6945. if (!($630)) {
  6946. $$lcssa683$i = 0;
  6947. break;
  6948. }
  6949. $631 = ((($$7505$i)) + -4|0);
  6950. $632 = HEAP32[$631>>2]|0;
  6951. $633 = ($632|0)==(0);
  6952. if ($633) {
  6953. $$7505$i = $631;
  6954. } else {
  6955. $$lcssa683$i = 1;
  6956. break;
  6957. }
  6958. }
  6959. do {
  6960. if ($573) {
  6961. $634 = $574&1;
  6962. $635 = $634 ^ 1;
  6963. $$538$$i = (($635) + ($$538$i))|0;
  6964. $636 = ($$538$$i|0)>($$5519$ph$i|0);
  6965. $637 = ($$5519$ph$i|0)>(-5);
  6966. $or$cond6$i = $636 & $637;
  6967. if ($or$cond6$i) {
  6968. $638 = (($$0235) + -1)|0;
  6969. $$neg572$i = (($$538$$i) + -1)|0;
  6970. $639 = (($$neg572$i) - ($$5519$ph$i))|0;
  6971. $$0479$i = $638;$$2476$i = $639;
  6972. } else {
  6973. $640 = (($$0235) + -2)|0;
  6974. $641 = (($$538$$i) + -1)|0;
  6975. $$0479$i = $640;$$2476$i = $641;
  6976. }
  6977. $642 = $$1263$ & 8;
  6978. $643 = ($642|0)==(0);
  6979. if (!($643)) {
  6980. $$1480$i = $$0479$i;$$3477$i = $$2476$i;$$pre$phi704$iZ2D = $642;
  6981. break;
  6982. }
  6983. do {
  6984. if ($$lcssa683$i) {
  6985. $644 = ((($$7505$i)) + -4|0);
  6986. $645 = HEAP32[$644>>2]|0;
  6987. $646 = ($645|0)==(0);
  6988. if ($646) {
  6989. $$2530$i = 9;
  6990. break;
  6991. }
  6992. $647 = (($645>>>0) % 10)&-1;
  6993. $648 = ($647|0)==(0);
  6994. if ($648) {
  6995. $$1529624$i = 0;$$3534623$i = 10;
  6996. } else {
  6997. $$2530$i = 0;
  6998. break;
  6999. }
  7000. while(1) {
  7001. $649 = ($$3534623$i*10)|0;
  7002. $650 = (($$1529624$i) + 1)|0;
  7003. $651 = (($645>>>0) % ($649>>>0))&-1;
  7004. $652 = ($651|0)==(0);
  7005. if ($652) {
  7006. $$1529624$i = $650;$$3534623$i = $649;
  7007. } else {
  7008. $$2530$i = $650;
  7009. break;
  7010. }
  7011. }
  7012. } else {
  7013. $$2530$i = 9;
  7014. }
  7015. } while(0);
  7016. $653 = $$0479$i | 32;
  7017. $654 = ($653|0)==(102);
  7018. $655 = $$7505$i;
  7019. $656 = (($655) - ($560))|0;
  7020. $657 = $656 >> 2;
  7021. $658 = ($657*9)|0;
  7022. $659 = (($658) + -9)|0;
  7023. if ($654) {
  7024. $660 = (($659) - ($$2530$i))|0;
  7025. $661 = ($660|0)<(0);
  7026. $$544$i = $661 ? 0 : $660;
  7027. $662 = ($$2476$i|0)<($$544$i|0);
  7028. $$2476$$545$i = $662 ? $$2476$i : $$544$i;
  7029. $$1480$i = $$0479$i;$$3477$i = $$2476$$545$i;$$pre$phi704$iZ2D = 0;
  7030. break;
  7031. } else {
  7032. $663 = (($659) + ($$5519$ph$i))|0;
  7033. $664 = (($663) - ($$2530$i))|0;
  7034. $665 = ($664|0)<(0);
  7035. $$546$i = $665 ? 0 : $664;
  7036. $666 = ($$2476$i|0)<($$546$i|0);
  7037. $$2476$$547$i = $666 ? $$2476$i : $$546$i;
  7038. $$1480$i = $$0479$i;$$3477$i = $$2476$$547$i;$$pre$phi704$iZ2D = 0;
  7039. break;
  7040. }
  7041. } else {
  7042. $$pre703$i = $$1263$ & 8;
  7043. $$1480$i = $$0235;$$3477$i = $$538$i;$$pre$phi704$iZ2D = $$pre703$i;
  7044. }
  7045. } while(0);
  7046. $667 = $$3477$i | $$pre$phi704$iZ2D;
  7047. $668 = ($667|0)!=(0);
  7048. $669 = $668&1;
  7049. $670 = $$1480$i | 32;
  7050. $671 = ($670|0)==(102);
  7051. if ($671) {
  7052. $672 = ($$5519$ph$i|0)>(0);
  7053. $673 = $672 ? $$5519$ph$i : 0;
  7054. $$2513$i = 0;$$pn$i = $673;
  7055. } else {
  7056. $674 = ($$5519$ph$i|0)<(0);
  7057. $675 = $674 ? $629 : $$5519$ph$i;
  7058. $676 = ($675|0)<(0);
  7059. $677 = $676 << 31 >> 31;
  7060. $678 = (_fmt_u($675,$677,$20)|0);
  7061. $679 = $678;
  7062. $680 = (($22) - ($679))|0;
  7063. $681 = ($680|0)<(2);
  7064. if ($681) {
  7065. $$1512617$i = $678;
  7066. while(1) {
  7067. $682 = ((($$1512617$i)) + -1|0);
  7068. HEAP8[$682>>0] = 48;
  7069. $683 = $682;
  7070. $684 = (($22) - ($683))|0;
  7071. $685 = ($684|0)<(2);
  7072. if ($685) {
  7073. $$1512617$i = $682;
  7074. } else {
  7075. $$1512$lcssa$i = $682;
  7076. break;
  7077. }
  7078. }
  7079. } else {
  7080. $$1512$lcssa$i = $678;
  7081. }
  7082. $686 = $$5519$ph$i >> 31;
  7083. $687 = $686 & 2;
  7084. $688 = (($687) + 43)|0;
  7085. $689 = $688&255;
  7086. $690 = ((($$1512$lcssa$i)) + -1|0);
  7087. HEAP8[$690>>0] = $689;
  7088. $691 = $$1480$i&255;
  7089. $692 = ((($$1512$lcssa$i)) + -2|0);
  7090. HEAP8[$692>>0] = $691;
  7091. $693 = $692;
  7092. $694 = (($22) - ($693))|0;
  7093. $$2513$i = $692;$$pn$i = $694;
  7094. }
  7095. $695 = (($$0520$i) + 1)|0;
  7096. $696 = (($695) + ($$3477$i))|0;
  7097. $$1527$i = (($696) + ($669))|0;
  7098. $697 = (($$1527$i) + ($$pn$i))|0;
  7099. _pad($0,32,$$1260,$697,$$1263$);
  7100. $698 = HEAP32[$0>>2]|0;
  7101. $699 = $698 & 32;
  7102. $700 = ($699|0)==(0);
  7103. if ($700) {
  7104. (___fwritex($$0522$i,$$0520$i,$0)|0);
  7105. }
  7106. $701 = $$1263$ ^ 65536;
  7107. _pad($0,48,$$1260,$697,$701);
  7108. do {
  7109. if ($671) {
  7110. $702 = ($$9$ph$i>>>0)>($$554$i>>>0);
  7111. $$0496$$9$i = $702 ? $$554$i : $$9$ph$i;
  7112. $$5493606$i = $$0496$$9$i;
  7113. while(1) {
  7114. $703 = HEAP32[$$5493606$i>>2]|0;
  7115. $704 = (_fmt_u($703,0,$27)|0);
  7116. $705 = ($$5493606$i|0)==($$0496$$9$i|0);
  7117. do {
  7118. if ($705) {
  7119. $711 = ($704|0)==($27|0);
  7120. if (!($711)) {
  7121. $$1465$i = $704;
  7122. break;
  7123. }
  7124. HEAP8[$29>>0] = 48;
  7125. $$1465$i = $29;
  7126. } else {
  7127. $706 = ($704>>>0)>($7>>>0);
  7128. if (!($706)) {
  7129. $$1465$i = $704;
  7130. break;
  7131. }
  7132. $707 = $704;
  7133. $708 = (($707) - ($18))|0;
  7134. _memset(($7|0),48,($708|0))|0;
  7135. $$0464603$i = $704;
  7136. while(1) {
  7137. $709 = ((($$0464603$i)) + -1|0);
  7138. $710 = ($709>>>0)>($7>>>0);
  7139. if ($710) {
  7140. $$0464603$i = $709;
  7141. } else {
  7142. $$1465$i = $709;
  7143. break;
  7144. }
  7145. }
  7146. }
  7147. } while(0);
  7148. $712 = HEAP32[$0>>2]|0;
  7149. $713 = $712 & 32;
  7150. $714 = ($713|0)==(0);
  7151. if ($714) {
  7152. $715 = $$1465$i;
  7153. $716 = (($28) - ($715))|0;
  7154. (___fwritex($$1465$i,$716,$0)|0);
  7155. }
  7156. $717 = ((($$5493606$i)) + 4|0);
  7157. $718 = ($717>>>0)>($$554$i>>>0);
  7158. if ($718) {
  7159. break;
  7160. } else {
  7161. $$5493606$i = $717;
  7162. }
  7163. }
  7164. $719 = ($667|0)==(0);
  7165. do {
  7166. if (!($719)) {
  7167. $720 = HEAP32[$0>>2]|0;
  7168. $721 = $720 & 32;
  7169. $722 = ($721|0)==(0);
  7170. if (!($722)) {
  7171. break;
  7172. }
  7173. (___fwritex(815,1,$0)|0);
  7174. }
  7175. } while(0);
  7176. $723 = ($717>>>0)<($$7505$i>>>0);
  7177. $724 = ($$3477$i|0)>(0);
  7178. $725 = $724 & $723;
  7179. if ($725) {
  7180. $$4478600$i = $$3477$i;$$6494599$i = $717;
  7181. while(1) {
  7182. $726 = HEAP32[$$6494599$i>>2]|0;
  7183. $727 = (_fmt_u($726,0,$27)|0);
  7184. $728 = ($727>>>0)>($7>>>0);
  7185. if ($728) {
  7186. $729 = $727;
  7187. $730 = (($729) - ($18))|0;
  7188. _memset(($7|0),48,($730|0))|0;
  7189. $$0463594$i = $727;
  7190. while(1) {
  7191. $731 = ((($$0463594$i)) + -1|0);
  7192. $732 = ($731>>>0)>($7>>>0);
  7193. if ($732) {
  7194. $$0463594$i = $731;
  7195. } else {
  7196. $$0463$lcssa$i = $731;
  7197. break;
  7198. }
  7199. }
  7200. } else {
  7201. $$0463$lcssa$i = $727;
  7202. }
  7203. $733 = HEAP32[$0>>2]|0;
  7204. $734 = $733 & 32;
  7205. $735 = ($734|0)==(0);
  7206. if ($735) {
  7207. $736 = ($$4478600$i|0)>(9);
  7208. $737 = $736 ? 9 : $$4478600$i;
  7209. (___fwritex($$0463$lcssa$i,$737,$0)|0);
  7210. }
  7211. $738 = ((($$6494599$i)) + 4|0);
  7212. $739 = (($$4478600$i) + -9)|0;
  7213. $740 = ($738>>>0)<($$7505$i>>>0);
  7214. $741 = ($$4478600$i|0)>(9);
  7215. $742 = $741 & $740;
  7216. if ($742) {
  7217. $$4478600$i = $739;$$6494599$i = $738;
  7218. } else {
  7219. $$4478$lcssa$i = $739;
  7220. break;
  7221. }
  7222. }
  7223. } else {
  7224. $$4478$lcssa$i = $$3477$i;
  7225. }
  7226. $743 = (($$4478$lcssa$i) + 9)|0;
  7227. _pad($0,48,$743,9,0);
  7228. } else {
  7229. $744 = ((($$9$ph$i)) + 4|0);
  7230. $$7505$$i = $$lcssa683$i ? $$7505$i : $744;
  7231. $745 = ($$3477$i|0)>(-1);
  7232. if ($745) {
  7233. $746 = ($$pre$phi704$iZ2D|0)==(0);
  7234. $$5611$i = $$3477$i;$$7495610$i = $$9$ph$i;
  7235. while(1) {
  7236. $747 = HEAP32[$$7495610$i>>2]|0;
  7237. $748 = (_fmt_u($747,0,$27)|0);
  7238. $749 = ($748|0)==($27|0);
  7239. if ($749) {
  7240. HEAP8[$29>>0] = 48;
  7241. $$0$i = $29;
  7242. } else {
  7243. $$0$i = $748;
  7244. }
  7245. $750 = ($$7495610$i|0)==($$9$ph$i|0);
  7246. do {
  7247. if ($750) {
  7248. $754 = ((($$0$i)) + 1|0);
  7249. $755 = HEAP32[$0>>2]|0;
  7250. $756 = $755 & 32;
  7251. $757 = ($756|0)==(0);
  7252. if ($757) {
  7253. (___fwritex($$0$i,1,$0)|0);
  7254. }
  7255. $758 = ($$5611$i|0)<(1);
  7256. $or$cond552$i = $746 & $758;
  7257. if ($or$cond552$i) {
  7258. $$2$i = $754;
  7259. break;
  7260. }
  7261. $759 = HEAP32[$0>>2]|0;
  7262. $760 = $759 & 32;
  7263. $761 = ($760|0)==(0);
  7264. if (!($761)) {
  7265. $$2$i = $754;
  7266. break;
  7267. }
  7268. (___fwritex(815,1,$0)|0);
  7269. $$2$i = $754;
  7270. } else {
  7271. $751 = ($$0$i>>>0)>($7>>>0);
  7272. if (!($751)) {
  7273. $$2$i = $$0$i;
  7274. break;
  7275. }
  7276. $scevgep694$i = (($$0$i) + ($19)|0);
  7277. $scevgep694695$i = $scevgep694$i;
  7278. _memset(($7|0),48,($scevgep694695$i|0))|0;
  7279. $$1607$i = $$0$i;
  7280. while(1) {
  7281. $752 = ((($$1607$i)) + -1|0);
  7282. $753 = ($752>>>0)>($7>>>0);
  7283. if ($753) {
  7284. $$1607$i = $752;
  7285. } else {
  7286. $$2$i = $752;
  7287. break;
  7288. }
  7289. }
  7290. }
  7291. } while(0);
  7292. $762 = $$2$i;
  7293. $763 = (($28) - ($762))|0;
  7294. $764 = HEAP32[$0>>2]|0;
  7295. $765 = $764 & 32;
  7296. $766 = ($765|0)==(0);
  7297. if ($766) {
  7298. $767 = ($$5611$i|0)>($763|0);
  7299. $768 = $767 ? $763 : $$5611$i;
  7300. (___fwritex($$2$i,$768,$0)|0);
  7301. }
  7302. $769 = (($$5611$i) - ($763))|0;
  7303. $770 = ((($$7495610$i)) + 4|0);
  7304. $771 = ($770>>>0)<($$7505$$i>>>0);
  7305. $772 = ($769|0)>(-1);
  7306. $773 = $771 & $772;
  7307. if ($773) {
  7308. $$5611$i = $769;$$7495610$i = $770;
  7309. } else {
  7310. $$5$lcssa$i = $769;
  7311. break;
  7312. }
  7313. }
  7314. } else {
  7315. $$5$lcssa$i = $$3477$i;
  7316. }
  7317. $774 = (($$5$lcssa$i) + 18)|0;
  7318. _pad($0,48,$774,18,0);
  7319. $775 = HEAP32[$0>>2]|0;
  7320. $776 = $775 & 32;
  7321. $777 = ($776|0)==(0);
  7322. if (!($777)) {
  7323. break;
  7324. }
  7325. $778 = $$2513$i;
  7326. $779 = (($22) - ($778))|0;
  7327. (___fwritex($$2513$i,$779,$0)|0);
  7328. }
  7329. } while(0);
  7330. $780 = $$1263$ ^ 8192;
  7331. _pad($0,32,$$1260,$697,$780);
  7332. $781 = ($697|0)<($$1260|0);
  7333. $$553$i = $781 ? $$1260 : $697;
  7334. $$0470$i = $$553$i;
  7335. } else {
  7336. $388 = $$0235 & 32;
  7337. $389 = ($388|0)!=(0);
  7338. $390 = $389 ? 799 : 803;
  7339. $391 = ($$0471$i != $$0471$i) | (0.0 != 0.0);
  7340. $392 = $389 ? 807 : 811;
  7341. $$1521$i = $391 ? 0 : $$0520$i;
  7342. $$0510$i = $391 ? $392 : $390;
  7343. $393 = (($$1521$i) + 3)|0;
  7344. _pad($0,32,$$1260,$393,$187);
  7345. $394 = HEAP32[$0>>2]|0;
  7346. $395 = $394 & 32;
  7347. $396 = ($395|0)==(0);
  7348. if ($396) {
  7349. (___fwritex($$0522$i,$$1521$i,$0)|0);
  7350. $$pre$i = HEAP32[$0>>2]|0;
  7351. $398 = $$pre$i;
  7352. } else {
  7353. $398 = $394;
  7354. }
  7355. $397 = $398 & 32;
  7356. $399 = ($397|0)==(0);
  7357. if ($399) {
  7358. (___fwritex($$0510$i,3,$0)|0);
  7359. }
  7360. $400 = $$1263$ ^ 8192;
  7361. _pad($0,32,$$1260,$393,$400);
  7362. $401 = ($393|0)<($$1260|0);
  7363. $402 = $401 ? $$1260 : $393;
  7364. $$0470$i = $402;
  7365. }
  7366. } while(0);
  7367. $$0243 = $$0470$i;$$0247 = $$1248;$$0269 = $$3272;$$0321 = $158;
  7368. continue L1;
  7369. break;
  7370. }
  7371. default: {
  7372. $$2 = $$0321;$$2234 = 0;$$2239 = 763;$$2251 = $14;$$5 = $$0254;$$6268 = $$1263$;
  7373. }
  7374. }
  7375. } while(0);
  7376. L310: do {
  7377. if ((label|0) == 63) {
  7378. label = 0;
  7379. $218 = $9;
  7380. $219 = $218;
  7381. $220 = HEAP32[$219>>2]|0;
  7382. $221 = (($218) + 4)|0;
  7383. $222 = $221;
  7384. $223 = HEAP32[$222>>2]|0;
  7385. $224 = $$1236 & 32;
  7386. $225 = ($220|0)==(0);
  7387. $226 = ($223|0)==(0);
  7388. $227 = $225 & $226;
  7389. if ($227) {
  7390. $$05$lcssa$i = $14;$249 = 0;$251 = 0;
  7391. } else {
  7392. $$056$i = $14;$229 = $220;$236 = $223;
  7393. while(1) {
  7394. $228 = $229 & 15;
  7395. $230 = (747 + ($228)|0);
  7396. $231 = HEAP8[$230>>0]|0;
  7397. $232 = $231&255;
  7398. $233 = $232 | $224;
  7399. $234 = $233&255;
  7400. $235 = ((($$056$i)) + -1|0);
  7401. HEAP8[$235>>0] = $234;
  7402. $237 = (_bitshift64Lshr(($229|0),($236|0),4)|0);
  7403. $238 = tempRet0;
  7404. $239 = ($237|0)==(0);
  7405. $240 = ($238|0)==(0);
  7406. $241 = $239 & $240;
  7407. if ($241) {
  7408. break;
  7409. } else {
  7410. $$056$i = $235;$229 = $237;$236 = $238;
  7411. }
  7412. }
  7413. $242 = $9;
  7414. $243 = $242;
  7415. $244 = HEAP32[$243>>2]|0;
  7416. $245 = (($242) + 4)|0;
  7417. $246 = $245;
  7418. $247 = HEAP32[$246>>2]|0;
  7419. $$05$lcssa$i = $235;$249 = $244;$251 = $247;
  7420. }
  7421. $248 = ($249|0)==(0);
  7422. $250 = ($251|0)==(0);
  7423. $252 = $248 & $250;
  7424. $253 = $$3265 & 8;
  7425. $254 = ($253|0)==(0);
  7426. $or$cond282 = $254 | $252;
  7427. $255 = $$1236 >> 4;
  7428. $256 = (763 + ($255)|0);
  7429. $$332 = $or$cond282 ? 763 : $256;
  7430. $$333 = $or$cond282 ? 0 : 2;
  7431. $$0228 = $$05$lcssa$i;$$1233 = $$333;$$1238 = $$332;$$2256 = $$1255;$$4266 = $$3265;
  7432. label = 76;
  7433. }
  7434. else if ((label|0) == 75) {
  7435. label = 0;
  7436. $302 = (_fmt_u($300,$301,$14)|0);
  7437. $$0228 = $302;$$1233 = $$0232;$$1238 = $$0237;$$2256 = $$0254;$$4266 = $$1263$;
  7438. label = 76;
  7439. }
  7440. else if ((label|0) == 81) {
  7441. label = 0;
  7442. $334 = (_memchr($$1,0,$$0254)|0);
  7443. $335 = ($334|0)==(0|0);
  7444. $336 = $334;
  7445. $337 = $$1;
  7446. $338 = (($336) - ($337))|0;
  7447. $339 = (($$1) + ($$0254)|0);
  7448. $$3257 = $335 ? $$0254 : $338;
  7449. $$1250 = $335 ? $339 : $334;
  7450. $$2 = $$1;$$2234 = 0;$$2239 = 763;$$2251 = $$1250;$$5 = $$3257;$$6268 = $187;
  7451. }
  7452. else if ((label|0) == 85) {
  7453. label = 0;
  7454. $$0229396 = $809;$$0240395 = 0;$$1244394 = 0;
  7455. while(1) {
  7456. $347 = HEAP32[$$0229396>>2]|0;
  7457. $348 = ($347|0)==(0);
  7458. if ($348) {
  7459. $$0240$lcssa = $$0240395;$$2245 = $$1244394;
  7460. break;
  7461. }
  7462. $349 = (_wctomb($12,$347)|0);
  7463. $350 = ($349|0)<(0);
  7464. $351 = (($$4258458) - ($$0240395))|0;
  7465. $352 = ($349>>>0)>($351>>>0);
  7466. $or$cond285 = $350 | $352;
  7467. if ($or$cond285) {
  7468. $$0240$lcssa = $$0240395;$$2245 = $349;
  7469. break;
  7470. }
  7471. $353 = ((($$0229396)) + 4|0);
  7472. $354 = (($349) + ($$0240395))|0;
  7473. $355 = ($$4258458>>>0)>($354>>>0);
  7474. if ($355) {
  7475. $$0229396 = $353;$$0240395 = $354;$$1244394 = $349;
  7476. } else {
  7477. $$0240$lcssa = $354;$$2245 = $349;
  7478. break;
  7479. }
  7480. }
  7481. $356 = ($$2245|0)<(0);
  7482. if ($356) {
  7483. $$0 = -1;
  7484. break L1;
  7485. }
  7486. _pad($0,32,$$1260,$$0240$lcssa,$$1263$);
  7487. $357 = ($$0240$lcssa|0)==(0);
  7488. if ($357) {
  7489. $$0240$lcssa460 = 0;
  7490. label = 96;
  7491. } else {
  7492. $$1230407 = $809;$$1241406 = 0;
  7493. while(1) {
  7494. $358 = HEAP32[$$1230407>>2]|0;
  7495. $359 = ($358|0)==(0);
  7496. if ($359) {
  7497. $$0240$lcssa460 = $$0240$lcssa;
  7498. label = 96;
  7499. break L310;
  7500. }
  7501. $360 = ((($$1230407)) + 4|0);
  7502. $361 = (_wctomb($12,$358)|0);
  7503. $362 = (($361) + ($$1241406))|0;
  7504. $363 = ($362|0)>($$0240$lcssa|0);
  7505. if ($363) {
  7506. $$0240$lcssa460 = $$0240$lcssa;
  7507. label = 96;
  7508. break L310;
  7509. }
  7510. $364 = HEAP32[$0>>2]|0;
  7511. $365 = $364 & 32;
  7512. $366 = ($365|0)==(0);
  7513. if ($366) {
  7514. (___fwritex($12,$361,$0)|0);
  7515. }
  7516. $367 = ($362>>>0)<($$0240$lcssa>>>0);
  7517. if ($367) {
  7518. $$1230407 = $360;$$1241406 = $362;
  7519. } else {
  7520. $$0240$lcssa460 = $$0240$lcssa;
  7521. label = 96;
  7522. break;
  7523. }
  7524. }
  7525. }
  7526. }
  7527. } while(0);
  7528. if ((label|0) == 96) {
  7529. label = 0;
  7530. $368 = $$1263$ ^ 8192;
  7531. _pad($0,32,$$1260,$$0240$lcssa460,$368);
  7532. $369 = ($$1260|0)>($$0240$lcssa460|0);
  7533. $370 = $369 ? $$1260 : $$0240$lcssa460;
  7534. $$0243 = $370;$$0247 = $$1248;$$0269 = $$3272;$$0321 = $158;
  7535. continue;
  7536. }
  7537. if ((label|0) == 76) {
  7538. label = 0;
  7539. $303 = ($$2256|0)>(-1);
  7540. $304 = $$4266 & -65537;
  7541. $$$4266 = $303 ? $304 : $$4266;
  7542. $305 = $9;
  7543. $306 = $305;
  7544. $307 = HEAP32[$306>>2]|0;
  7545. $308 = (($305) + 4)|0;
  7546. $309 = $308;
  7547. $310 = HEAP32[$309>>2]|0;
  7548. $311 = ($307|0)!=(0);
  7549. $312 = ($310|0)!=(0);
  7550. $313 = $311 | $312;
  7551. $314 = ($$2256|0)!=(0);
  7552. $or$cond = $314 | $313;
  7553. if ($or$cond) {
  7554. $315 = $$0228;
  7555. $316 = (($15) - ($315))|0;
  7556. $317 = $313&1;
  7557. $318 = $317 ^ 1;
  7558. $319 = (($318) + ($316))|0;
  7559. $320 = ($$2256|0)>($319|0);
  7560. $$2256$ = $320 ? $$2256 : $319;
  7561. $$2 = $$0228;$$2234 = $$1233;$$2239 = $$1238;$$2251 = $14;$$5 = $$2256$;$$6268 = $$$4266;
  7562. } else {
  7563. $$2 = $14;$$2234 = $$1233;$$2239 = $$1238;$$2251 = $14;$$5 = 0;$$6268 = $$$4266;
  7564. }
  7565. }
  7566. $782 = $$2251;
  7567. $783 = $$2;
  7568. $784 = (($782) - ($783))|0;
  7569. $785 = ($$5|0)<($784|0);
  7570. $$$5 = $785 ? $784 : $$5;
  7571. $786 = (($$$5) + ($$2234))|0;
  7572. $787 = ($$1260|0)<($786|0);
  7573. $$2261 = $787 ? $786 : $$1260;
  7574. _pad($0,32,$$2261,$786,$$6268);
  7575. $788 = HEAP32[$0>>2]|0;
  7576. $789 = $788 & 32;
  7577. $790 = ($789|0)==(0);
  7578. if ($790) {
  7579. (___fwritex($$2239,$$2234,$0)|0);
  7580. }
  7581. $791 = $$6268 ^ 65536;
  7582. _pad($0,48,$$2261,$786,$791);
  7583. _pad($0,48,$$$5,$784,0);
  7584. $792 = HEAP32[$0>>2]|0;
  7585. $793 = $792 & 32;
  7586. $794 = ($793|0)==(0);
  7587. if ($794) {
  7588. (___fwritex($$2,$784,$0)|0);
  7589. }
  7590. $795 = $$6268 ^ 8192;
  7591. _pad($0,32,$$2261,$786,$795);
  7592. $$0243 = $$2261;$$0247 = $$1248;$$0269 = $$3272;$$0321 = $158;
  7593. }
  7594. L345: do {
  7595. if ((label|0) == 243) {
  7596. $796 = ($0|0)==(0|0);
  7597. if ($796) {
  7598. $797 = ($$0269|0)==(0);
  7599. if ($797) {
  7600. $$0 = 0;
  7601. } else {
  7602. $$2242381 = 1;
  7603. while(1) {
  7604. $798 = (($4) + ($$2242381<<2)|0);
  7605. $799 = HEAP32[$798>>2]|0;
  7606. $800 = ($799|0)==(0);
  7607. if ($800) {
  7608. $$3379 = $$2242381;
  7609. break;
  7610. }
  7611. $801 = (($3) + ($$2242381<<3)|0);
  7612. _pop_arg($801,$799,$2);
  7613. $802 = (($$2242381) + 1)|0;
  7614. $803 = ($802|0)<(10);
  7615. if ($803) {
  7616. $$2242381 = $802;
  7617. } else {
  7618. $$0 = 1;
  7619. break L345;
  7620. }
  7621. }
  7622. while(1) {
  7623. $806 = (($4) + ($$3379<<2)|0);
  7624. $807 = HEAP32[$806>>2]|0;
  7625. $808 = ($807|0)==(0);
  7626. $805 = (($$3379) + 1)|0;
  7627. if (!($808)) {
  7628. $$0 = -1;
  7629. break L345;
  7630. }
  7631. $804 = ($805|0)<(10);
  7632. if ($804) {
  7633. $$3379 = $805;
  7634. } else {
  7635. $$0 = 1;
  7636. break;
  7637. }
  7638. }
  7639. }
  7640. } else {
  7641. $$0 = $$1248;
  7642. }
  7643. }
  7644. } while(0);
  7645. STACKTOP = sp;return ($$0|0);
  7646. }
  7647. function ___lockfile($0) {
  7648. $0 = $0|0;
  7649. var label = 0, sp = 0;
  7650. sp = STACKTOP;
  7651. return 0;
  7652. }
  7653. function ___fwritex($0,$1,$2) {
  7654. $0 = $0|0;
  7655. $1 = $1|0;
  7656. $2 = $2|0;
  7657. var $$0 = 0, $$032 = 0, $$033 = 0, $$034 = 0, $$1 = 0, $$pre = 0, $$pre38 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $20 = 0, $21 = 0, $22 = 0;
  7658. var $23 = 0, $24 = 0, $25 = 0, $26 = 0, $27 = 0, $28 = 0, $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0;
  7659. var label = 0, sp = 0;
  7660. sp = STACKTOP;
  7661. $3 = ((($2)) + 16|0);
  7662. $4 = HEAP32[$3>>2]|0;
  7663. $5 = ($4|0)==(0|0);
  7664. if ($5) {
  7665. $7 = (___towrite($2)|0);
  7666. $8 = ($7|0)==(0);
  7667. if ($8) {
  7668. $$pre = HEAP32[$3>>2]|0;
  7669. $12 = $$pre;
  7670. label = 5;
  7671. } else {
  7672. $$032 = 0;
  7673. }
  7674. } else {
  7675. $6 = $4;
  7676. $12 = $6;
  7677. label = 5;
  7678. }
  7679. L5: do {
  7680. if ((label|0) == 5) {
  7681. $9 = ((($2)) + 20|0);
  7682. $10 = HEAP32[$9>>2]|0;
  7683. $11 = (($12) - ($10))|0;
  7684. $13 = ($11>>>0)<($1>>>0);
  7685. $14 = $10;
  7686. if ($13) {
  7687. $15 = ((($2)) + 36|0);
  7688. $16 = HEAP32[$15>>2]|0;
  7689. $17 = (FUNCTION_TABLE_iiii[$16 & 7]($2,$0,$1)|0);
  7690. $$032 = $17;
  7691. break;
  7692. }
  7693. $18 = ((($2)) + 75|0);
  7694. $19 = HEAP8[$18>>0]|0;
  7695. $20 = ($19<<24>>24)>(-1);
  7696. L10: do {
  7697. if ($20) {
  7698. $$0 = $1;
  7699. while(1) {
  7700. $21 = ($$0|0)==(0);
  7701. if ($21) {
  7702. $$033 = $1;$$034 = $0;$$1 = 0;$32 = $14;
  7703. break L10;
  7704. }
  7705. $22 = (($$0) + -1)|0;
  7706. $23 = (($0) + ($22)|0);
  7707. $24 = HEAP8[$23>>0]|0;
  7708. $25 = ($24<<24>>24)==(10);
  7709. if ($25) {
  7710. break;
  7711. } else {
  7712. $$0 = $22;
  7713. }
  7714. }
  7715. $26 = ((($2)) + 36|0);
  7716. $27 = HEAP32[$26>>2]|0;
  7717. $28 = (FUNCTION_TABLE_iiii[$27 & 7]($2,$0,$$0)|0);
  7718. $29 = ($28>>>0)<($$0>>>0);
  7719. if ($29) {
  7720. $$032 = $$0;
  7721. break L5;
  7722. }
  7723. $30 = (($0) + ($$0)|0);
  7724. $31 = (($1) - ($$0))|0;
  7725. $$pre38 = HEAP32[$9>>2]|0;
  7726. $$033 = $31;$$034 = $30;$$1 = $$0;$32 = $$pre38;
  7727. } else {
  7728. $$033 = $1;$$034 = $0;$$1 = 0;$32 = $14;
  7729. }
  7730. } while(0);
  7731. _memcpy(($32|0),($$034|0),($$033|0))|0;
  7732. $33 = HEAP32[$9>>2]|0;
  7733. $34 = (($33) + ($$033)|0);
  7734. HEAP32[$9>>2] = $34;
  7735. $35 = (($$1) + ($$033))|0;
  7736. $$032 = $35;
  7737. }
  7738. } while(0);
  7739. return ($$032|0);
  7740. }
  7741. function _pop_arg($0,$1,$2) {
  7742. $0 = $0|0;
  7743. $1 = $1|0;
  7744. $2 = $2|0;
  7745. var $$mask = 0, $$mask31 = 0, $10 = 0, $100 = 0, $101 = 0, $102 = 0, $103 = 0, $104 = 0, $105 = 0, $106 = 0, $107 = 0, $108 = 0, $109 = 0.0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0;
  7746. var $116 = 0.0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0, $27 = 0, $28 = 0, $29 = 0, $3 = 0;
  7747. var $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0, $45 = 0, $46 = 0, $47 = 0, $48 = 0;
  7748. var $49 = 0, $5 = 0, $50 = 0, $51 = 0, $52 = 0, $53 = 0, $54 = 0, $55 = 0, $56 = 0, $57 = 0, $58 = 0, $59 = 0, $6 = 0, $60 = 0, $61 = 0, $62 = 0, $63 = 0, $64 = 0, $65 = 0, $66 = 0;
  7749. var $67 = 0, $68 = 0, $69 = 0, $7 = 0, $70 = 0, $71 = 0, $72 = 0, $73 = 0, $74 = 0, $75 = 0, $76 = 0, $77 = 0, $78 = 0, $79 = 0, $8 = 0, $80 = 0, $81 = 0, $82 = 0, $83 = 0, $84 = 0;
  7750. var $85 = 0, $86 = 0, $87 = 0, $88 = 0, $89 = 0, $9 = 0, $90 = 0, $91 = 0, $92 = 0, $93 = 0, $94 = 0, $95 = 0, $96 = 0, $97 = 0, $98 = 0, $99 = 0, $arglist_current = 0, $arglist_current11 = 0, $arglist_current14 = 0, $arglist_current17 = 0;
  7751. var $arglist_current2 = 0, $arglist_current20 = 0, $arglist_current23 = 0, $arglist_current26 = 0, $arglist_current5 = 0, $arglist_current8 = 0, $arglist_next = 0, $arglist_next12 = 0, $arglist_next15 = 0, $arglist_next18 = 0, $arglist_next21 = 0, $arglist_next24 = 0, $arglist_next27 = 0, $arglist_next3 = 0, $arglist_next6 = 0, $arglist_next9 = 0, $expanded = 0, $expanded28 = 0, $expanded30 = 0, $expanded31 = 0;
  7752. var $expanded32 = 0, $expanded34 = 0, $expanded35 = 0, $expanded37 = 0, $expanded38 = 0, $expanded39 = 0, $expanded41 = 0, $expanded42 = 0, $expanded44 = 0, $expanded45 = 0, $expanded46 = 0, $expanded48 = 0, $expanded49 = 0, $expanded51 = 0, $expanded52 = 0, $expanded53 = 0, $expanded55 = 0, $expanded56 = 0, $expanded58 = 0, $expanded59 = 0;
  7753. var $expanded60 = 0, $expanded62 = 0, $expanded63 = 0, $expanded65 = 0, $expanded66 = 0, $expanded67 = 0, $expanded69 = 0, $expanded70 = 0, $expanded72 = 0, $expanded73 = 0, $expanded74 = 0, $expanded76 = 0, $expanded77 = 0, $expanded79 = 0, $expanded80 = 0, $expanded81 = 0, $expanded83 = 0, $expanded84 = 0, $expanded86 = 0, $expanded87 = 0;
  7754. var $expanded88 = 0, $expanded90 = 0, $expanded91 = 0, $expanded93 = 0, $expanded94 = 0, $expanded95 = 0, label = 0, sp = 0;
  7755. sp = STACKTOP;
  7756. $3 = ($1>>>0)>(20);
  7757. L1: do {
  7758. if (!($3)) {
  7759. do {
  7760. switch ($1|0) {
  7761. case 9: {
  7762. $arglist_current = HEAP32[$2>>2]|0;
  7763. $4 = $arglist_current;
  7764. $5 = ((0) + 4|0);
  7765. $expanded28 = $5;
  7766. $expanded = (($expanded28) - 1)|0;
  7767. $6 = (($4) + ($expanded))|0;
  7768. $7 = ((0) + 4|0);
  7769. $expanded32 = $7;
  7770. $expanded31 = (($expanded32) - 1)|0;
  7771. $expanded30 = $expanded31 ^ -1;
  7772. $8 = $6 & $expanded30;
  7773. $9 = $8;
  7774. $10 = HEAP32[$9>>2]|0;
  7775. $arglist_next = ((($9)) + 4|0);
  7776. HEAP32[$2>>2] = $arglist_next;
  7777. HEAP32[$0>>2] = $10;
  7778. break L1;
  7779. break;
  7780. }
  7781. case 10: {
  7782. $arglist_current2 = HEAP32[$2>>2]|0;
  7783. $11 = $arglist_current2;
  7784. $12 = ((0) + 4|0);
  7785. $expanded35 = $12;
  7786. $expanded34 = (($expanded35) - 1)|0;
  7787. $13 = (($11) + ($expanded34))|0;
  7788. $14 = ((0) + 4|0);
  7789. $expanded39 = $14;
  7790. $expanded38 = (($expanded39) - 1)|0;
  7791. $expanded37 = $expanded38 ^ -1;
  7792. $15 = $13 & $expanded37;
  7793. $16 = $15;
  7794. $17 = HEAP32[$16>>2]|0;
  7795. $arglist_next3 = ((($16)) + 4|0);
  7796. HEAP32[$2>>2] = $arglist_next3;
  7797. $18 = ($17|0)<(0);
  7798. $19 = $18 << 31 >> 31;
  7799. $20 = $0;
  7800. $21 = $20;
  7801. HEAP32[$21>>2] = $17;
  7802. $22 = (($20) + 4)|0;
  7803. $23 = $22;
  7804. HEAP32[$23>>2] = $19;
  7805. break L1;
  7806. break;
  7807. }
  7808. case 11: {
  7809. $arglist_current5 = HEAP32[$2>>2]|0;
  7810. $24 = $arglist_current5;
  7811. $25 = ((0) + 4|0);
  7812. $expanded42 = $25;
  7813. $expanded41 = (($expanded42) - 1)|0;
  7814. $26 = (($24) + ($expanded41))|0;
  7815. $27 = ((0) + 4|0);
  7816. $expanded46 = $27;
  7817. $expanded45 = (($expanded46) - 1)|0;
  7818. $expanded44 = $expanded45 ^ -1;
  7819. $28 = $26 & $expanded44;
  7820. $29 = $28;
  7821. $30 = HEAP32[$29>>2]|0;
  7822. $arglist_next6 = ((($29)) + 4|0);
  7823. HEAP32[$2>>2] = $arglist_next6;
  7824. $31 = $0;
  7825. $32 = $31;
  7826. HEAP32[$32>>2] = $30;
  7827. $33 = (($31) + 4)|0;
  7828. $34 = $33;
  7829. HEAP32[$34>>2] = 0;
  7830. break L1;
  7831. break;
  7832. }
  7833. case 12: {
  7834. $arglist_current8 = HEAP32[$2>>2]|0;
  7835. $35 = $arglist_current8;
  7836. $36 = ((0) + 8|0);
  7837. $expanded49 = $36;
  7838. $expanded48 = (($expanded49) - 1)|0;
  7839. $37 = (($35) + ($expanded48))|0;
  7840. $38 = ((0) + 8|0);
  7841. $expanded53 = $38;
  7842. $expanded52 = (($expanded53) - 1)|0;
  7843. $expanded51 = $expanded52 ^ -1;
  7844. $39 = $37 & $expanded51;
  7845. $40 = $39;
  7846. $41 = $40;
  7847. $42 = $41;
  7848. $43 = HEAP32[$42>>2]|0;
  7849. $44 = (($41) + 4)|0;
  7850. $45 = $44;
  7851. $46 = HEAP32[$45>>2]|0;
  7852. $arglist_next9 = ((($40)) + 8|0);
  7853. HEAP32[$2>>2] = $arglist_next9;
  7854. $47 = $0;
  7855. $48 = $47;
  7856. HEAP32[$48>>2] = $43;
  7857. $49 = (($47) + 4)|0;
  7858. $50 = $49;
  7859. HEAP32[$50>>2] = $46;
  7860. break L1;
  7861. break;
  7862. }
  7863. case 13: {
  7864. $arglist_current11 = HEAP32[$2>>2]|0;
  7865. $51 = $arglist_current11;
  7866. $52 = ((0) + 4|0);
  7867. $expanded56 = $52;
  7868. $expanded55 = (($expanded56) - 1)|0;
  7869. $53 = (($51) + ($expanded55))|0;
  7870. $54 = ((0) + 4|0);
  7871. $expanded60 = $54;
  7872. $expanded59 = (($expanded60) - 1)|0;
  7873. $expanded58 = $expanded59 ^ -1;
  7874. $55 = $53 & $expanded58;
  7875. $56 = $55;
  7876. $57 = HEAP32[$56>>2]|0;
  7877. $arglist_next12 = ((($56)) + 4|0);
  7878. HEAP32[$2>>2] = $arglist_next12;
  7879. $58 = $57&65535;
  7880. $59 = $58 << 16 >> 16;
  7881. $60 = ($59|0)<(0);
  7882. $61 = $60 << 31 >> 31;
  7883. $62 = $0;
  7884. $63 = $62;
  7885. HEAP32[$63>>2] = $59;
  7886. $64 = (($62) + 4)|0;
  7887. $65 = $64;
  7888. HEAP32[$65>>2] = $61;
  7889. break L1;
  7890. break;
  7891. }
  7892. case 14: {
  7893. $arglist_current14 = HEAP32[$2>>2]|0;
  7894. $66 = $arglist_current14;
  7895. $67 = ((0) + 4|0);
  7896. $expanded63 = $67;
  7897. $expanded62 = (($expanded63) - 1)|0;
  7898. $68 = (($66) + ($expanded62))|0;
  7899. $69 = ((0) + 4|0);
  7900. $expanded67 = $69;
  7901. $expanded66 = (($expanded67) - 1)|0;
  7902. $expanded65 = $expanded66 ^ -1;
  7903. $70 = $68 & $expanded65;
  7904. $71 = $70;
  7905. $72 = HEAP32[$71>>2]|0;
  7906. $arglist_next15 = ((($71)) + 4|0);
  7907. HEAP32[$2>>2] = $arglist_next15;
  7908. $$mask31 = $72 & 65535;
  7909. $73 = $0;
  7910. $74 = $73;
  7911. HEAP32[$74>>2] = $$mask31;
  7912. $75 = (($73) + 4)|0;
  7913. $76 = $75;
  7914. HEAP32[$76>>2] = 0;
  7915. break L1;
  7916. break;
  7917. }
  7918. case 15: {
  7919. $arglist_current17 = HEAP32[$2>>2]|0;
  7920. $77 = $arglist_current17;
  7921. $78 = ((0) + 4|0);
  7922. $expanded70 = $78;
  7923. $expanded69 = (($expanded70) - 1)|0;
  7924. $79 = (($77) + ($expanded69))|0;
  7925. $80 = ((0) + 4|0);
  7926. $expanded74 = $80;
  7927. $expanded73 = (($expanded74) - 1)|0;
  7928. $expanded72 = $expanded73 ^ -1;
  7929. $81 = $79 & $expanded72;
  7930. $82 = $81;
  7931. $83 = HEAP32[$82>>2]|0;
  7932. $arglist_next18 = ((($82)) + 4|0);
  7933. HEAP32[$2>>2] = $arglist_next18;
  7934. $84 = $83&255;
  7935. $85 = $84 << 24 >> 24;
  7936. $86 = ($85|0)<(0);
  7937. $87 = $86 << 31 >> 31;
  7938. $88 = $0;
  7939. $89 = $88;
  7940. HEAP32[$89>>2] = $85;
  7941. $90 = (($88) + 4)|0;
  7942. $91 = $90;
  7943. HEAP32[$91>>2] = $87;
  7944. break L1;
  7945. break;
  7946. }
  7947. case 16: {
  7948. $arglist_current20 = HEAP32[$2>>2]|0;
  7949. $92 = $arglist_current20;
  7950. $93 = ((0) + 4|0);
  7951. $expanded77 = $93;
  7952. $expanded76 = (($expanded77) - 1)|0;
  7953. $94 = (($92) + ($expanded76))|0;
  7954. $95 = ((0) + 4|0);
  7955. $expanded81 = $95;
  7956. $expanded80 = (($expanded81) - 1)|0;
  7957. $expanded79 = $expanded80 ^ -1;
  7958. $96 = $94 & $expanded79;
  7959. $97 = $96;
  7960. $98 = HEAP32[$97>>2]|0;
  7961. $arglist_next21 = ((($97)) + 4|0);
  7962. HEAP32[$2>>2] = $arglist_next21;
  7963. $$mask = $98 & 255;
  7964. $99 = $0;
  7965. $100 = $99;
  7966. HEAP32[$100>>2] = $$mask;
  7967. $101 = (($99) + 4)|0;
  7968. $102 = $101;
  7969. HEAP32[$102>>2] = 0;
  7970. break L1;
  7971. break;
  7972. }
  7973. case 17: {
  7974. $arglist_current23 = HEAP32[$2>>2]|0;
  7975. $103 = $arglist_current23;
  7976. $104 = ((0) + 8|0);
  7977. $expanded84 = $104;
  7978. $expanded83 = (($expanded84) - 1)|0;
  7979. $105 = (($103) + ($expanded83))|0;
  7980. $106 = ((0) + 8|0);
  7981. $expanded88 = $106;
  7982. $expanded87 = (($expanded88) - 1)|0;
  7983. $expanded86 = $expanded87 ^ -1;
  7984. $107 = $105 & $expanded86;
  7985. $108 = $107;
  7986. $109 = +HEAPF64[$108>>3];
  7987. $arglist_next24 = ((($108)) + 8|0);
  7988. HEAP32[$2>>2] = $arglist_next24;
  7989. HEAPF64[$0>>3] = $109;
  7990. break L1;
  7991. break;
  7992. }
  7993. case 18: {
  7994. $arglist_current26 = HEAP32[$2>>2]|0;
  7995. $110 = $arglist_current26;
  7996. $111 = ((0) + 8|0);
  7997. $expanded91 = $111;
  7998. $expanded90 = (($expanded91) - 1)|0;
  7999. $112 = (($110) + ($expanded90))|0;
  8000. $113 = ((0) + 8|0);
  8001. $expanded95 = $113;
  8002. $expanded94 = (($expanded95) - 1)|0;
  8003. $expanded93 = $expanded94 ^ -1;
  8004. $114 = $112 & $expanded93;
  8005. $115 = $114;
  8006. $116 = +HEAPF64[$115>>3];
  8007. $arglist_next27 = ((($115)) + 8|0);
  8008. HEAP32[$2>>2] = $arglist_next27;
  8009. HEAPF64[$0>>3] = $116;
  8010. break L1;
  8011. break;
  8012. }
  8013. default: {
  8014. break L1;
  8015. }
  8016. }
  8017. } while(0);
  8018. }
  8019. } while(0);
  8020. return;
  8021. }
  8022. function _fmt_u($0,$1,$2) {
  8023. $0 = $0|0;
  8024. $1 = $1|0;
  8025. $2 = $2|0;
  8026. var $$010$lcssa$off0 = 0, $$012 = 0, $$09$lcssa = 0, $$0914 = 0, $$1$lcssa = 0, $$111 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0;
  8027. var $24 = 0, $25 = 0, $26 = 0, $27 = 0, $28 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, label = 0, sp = 0;
  8028. sp = STACKTOP;
  8029. $3 = ($1>>>0)>(0);
  8030. $4 = ($0>>>0)>(4294967295);
  8031. $5 = ($1|0)==(0);
  8032. $6 = $5 & $4;
  8033. $7 = $3 | $6;
  8034. if ($7) {
  8035. $$0914 = $2;$8 = $0;$9 = $1;
  8036. while(1) {
  8037. $10 = (___uremdi3(($8|0),($9|0),10,0)|0);
  8038. $11 = tempRet0;
  8039. $12 = $10 | 48;
  8040. $13 = $12&255;
  8041. $14 = ((($$0914)) + -1|0);
  8042. HEAP8[$14>>0] = $13;
  8043. $15 = (___udivdi3(($8|0),($9|0),10,0)|0);
  8044. $16 = tempRet0;
  8045. $17 = ($9>>>0)>(9);
  8046. $18 = ($8>>>0)>(4294967295);
  8047. $19 = ($9|0)==(9);
  8048. $20 = $19 & $18;
  8049. $21 = $17 | $20;
  8050. if ($21) {
  8051. $$0914 = $14;$8 = $15;$9 = $16;
  8052. } else {
  8053. break;
  8054. }
  8055. }
  8056. $$010$lcssa$off0 = $15;$$09$lcssa = $14;
  8057. } else {
  8058. $$010$lcssa$off0 = $0;$$09$lcssa = $2;
  8059. }
  8060. $22 = ($$010$lcssa$off0|0)==(0);
  8061. if ($22) {
  8062. $$1$lcssa = $$09$lcssa;
  8063. } else {
  8064. $$012 = $$010$lcssa$off0;$$111 = $$09$lcssa;
  8065. while(1) {
  8066. $23 = (($$012>>>0) % 10)&-1;
  8067. $24 = $23 | 48;
  8068. $25 = $24&255;
  8069. $26 = ((($$111)) + -1|0);
  8070. HEAP8[$26>>0] = $25;
  8071. $27 = (($$012>>>0) / 10)&-1;
  8072. $28 = ($$012>>>0)<(10);
  8073. if ($28) {
  8074. $$1$lcssa = $26;
  8075. break;
  8076. } else {
  8077. $$012 = $27;$$111 = $26;
  8078. }
  8079. }
  8080. }
  8081. return ($$1$lcssa|0);
  8082. }
  8083. function _strerror($0) {
  8084. $0 = $0|0;
  8085. var $$011$lcssa = 0, $$01113 = 0, $$015 = 0, $$112 = 0, $$114 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, label = 0, sp = 0;
  8086. sp = STACKTOP;
  8087. $$015 = 0;
  8088. while(1) {
  8089. $2 = (817 + ($$015)|0);
  8090. $3 = HEAP8[$2>>0]|0;
  8091. $4 = $3&255;
  8092. $5 = ($4|0)==($0|0);
  8093. if ($5) {
  8094. label = 2;
  8095. break;
  8096. }
  8097. $6 = (($$015) + 1)|0;
  8098. $7 = ($6|0)==(87);
  8099. if ($7) {
  8100. $$01113 = 905;$$114 = 87;
  8101. label = 5;
  8102. break;
  8103. } else {
  8104. $$015 = $6;
  8105. }
  8106. }
  8107. if ((label|0) == 2) {
  8108. $1 = ($$015|0)==(0);
  8109. if ($1) {
  8110. $$011$lcssa = 905;
  8111. } else {
  8112. $$01113 = 905;$$114 = $$015;
  8113. label = 5;
  8114. }
  8115. }
  8116. if ((label|0) == 5) {
  8117. while(1) {
  8118. label = 0;
  8119. $$112 = $$01113;
  8120. while(1) {
  8121. $8 = HEAP8[$$112>>0]|0;
  8122. $9 = ($8<<24>>24)==(0);
  8123. $10 = ((($$112)) + 1|0);
  8124. if ($9) {
  8125. break;
  8126. } else {
  8127. $$112 = $10;
  8128. }
  8129. }
  8130. $11 = (($$114) + -1)|0;
  8131. $12 = ($11|0)==(0);
  8132. if ($12) {
  8133. $$011$lcssa = $10;
  8134. break;
  8135. } else {
  8136. $$01113 = $10;$$114 = $11;
  8137. label = 5;
  8138. }
  8139. }
  8140. }
  8141. return ($$011$lcssa|0);
  8142. }
  8143. function _memchr($0,$1,$2) {
  8144. $0 = $0|0;
  8145. $1 = $1|0;
  8146. $2 = $2|0;
  8147. var $$0$lcssa = 0, $$035$lcssa = 0, $$035$lcssa65 = 0, $$03555 = 0, $$036$lcssa = 0, $$036$lcssa64 = 0, $$03654 = 0, $$046 = 0, $$137$lcssa = 0, $$13745 = 0, $$140 = 0, $$2 = 0, $$23839 = 0, $$3 = 0, $$lcssa = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0;
  8148. var $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0, $27 = 0, $28 = 0, $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0;
  8149. var $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $or$cond = 0, $or$cond53 = 0, label = 0, sp = 0;
  8150. sp = STACKTOP;
  8151. $3 = $1 & 255;
  8152. $4 = $0;
  8153. $5 = $4 & 3;
  8154. $6 = ($5|0)!=(0);
  8155. $7 = ($2|0)!=(0);
  8156. $or$cond53 = $7 & $6;
  8157. L1: do {
  8158. if ($or$cond53) {
  8159. $8 = $1&255;
  8160. $$03555 = $0;$$03654 = $2;
  8161. while(1) {
  8162. $9 = HEAP8[$$03555>>0]|0;
  8163. $10 = ($9<<24>>24)==($8<<24>>24);
  8164. if ($10) {
  8165. $$035$lcssa65 = $$03555;$$036$lcssa64 = $$03654;
  8166. label = 6;
  8167. break L1;
  8168. }
  8169. $11 = ((($$03555)) + 1|0);
  8170. $12 = (($$03654) + -1)|0;
  8171. $13 = $11;
  8172. $14 = $13 & 3;
  8173. $15 = ($14|0)!=(0);
  8174. $16 = ($12|0)!=(0);
  8175. $or$cond = $16 & $15;
  8176. if ($or$cond) {
  8177. $$03555 = $11;$$03654 = $12;
  8178. } else {
  8179. $$035$lcssa = $11;$$036$lcssa = $12;$$lcssa = $16;
  8180. label = 5;
  8181. break;
  8182. }
  8183. }
  8184. } else {
  8185. $$035$lcssa = $0;$$036$lcssa = $2;$$lcssa = $7;
  8186. label = 5;
  8187. }
  8188. } while(0);
  8189. if ((label|0) == 5) {
  8190. if ($$lcssa) {
  8191. $$035$lcssa65 = $$035$lcssa;$$036$lcssa64 = $$036$lcssa;
  8192. label = 6;
  8193. } else {
  8194. $$2 = $$035$lcssa;$$3 = 0;
  8195. }
  8196. }
  8197. L8: do {
  8198. if ((label|0) == 6) {
  8199. $17 = HEAP8[$$035$lcssa65>>0]|0;
  8200. $18 = $1&255;
  8201. $19 = ($17<<24>>24)==($18<<24>>24);
  8202. if ($19) {
  8203. $$2 = $$035$lcssa65;$$3 = $$036$lcssa64;
  8204. } else {
  8205. $20 = Math_imul($3, 16843009)|0;
  8206. $21 = ($$036$lcssa64>>>0)>(3);
  8207. L11: do {
  8208. if ($21) {
  8209. $$046 = $$035$lcssa65;$$13745 = $$036$lcssa64;
  8210. while(1) {
  8211. $22 = HEAP32[$$046>>2]|0;
  8212. $23 = $22 ^ $20;
  8213. $24 = (($23) + -16843009)|0;
  8214. $25 = $23 & -2139062144;
  8215. $26 = $25 ^ -2139062144;
  8216. $27 = $26 & $24;
  8217. $28 = ($27|0)==(0);
  8218. if (!($28)) {
  8219. break;
  8220. }
  8221. $29 = ((($$046)) + 4|0);
  8222. $30 = (($$13745) + -4)|0;
  8223. $31 = ($30>>>0)>(3);
  8224. if ($31) {
  8225. $$046 = $29;$$13745 = $30;
  8226. } else {
  8227. $$0$lcssa = $29;$$137$lcssa = $30;
  8228. label = 11;
  8229. break L11;
  8230. }
  8231. }
  8232. $$140 = $$046;$$23839 = $$13745;
  8233. } else {
  8234. $$0$lcssa = $$035$lcssa65;$$137$lcssa = $$036$lcssa64;
  8235. label = 11;
  8236. }
  8237. } while(0);
  8238. if ((label|0) == 11) {
  8239. $32 = ($$137$lcssa|0)==(0);
  8240. if ($32) {
  8241. $$2 = $$0$lcssa;$$3 = 0;
  8242. break;
  8243. } else {
  8244. $$140 = $$0$lcssa;$$23839 = $$137$lcssa;
  8245. }
  8246. }
  8247. while(1) {
  8248. $33 = HEAP8[$$140>>0]|0;
  8249. $34 = ($33<<24>>24)==($18<<24>>24);
  8250. if ($34) {
  8251. $$2 = $$140;$$3 = $$23839;
  8252. break L8;
  8253. }
  8254. $35 = ((($$140)) + 1|0);
  8255. $36 = (($$23839) + -1)|0;
  8256. $37 = ($36|0)==(0);
  8257. if ($37) {
  8258. $$2 = $35;$$3 = 0;
  8259. break;
  8260. } else {
  8261. $$140 = $35;$$23839 = $36;
  8262. }
  8263. }
  8264. }
  8265. }
  8266. } while(0);
  8267. $38 = ($$3|0)!=(0);
  8268. $39 = $38 ? $$2 : 0;
  8269. return ($39|0);
  8270. }
  8271. function _pad($0,$1,$2,$3,$4) {
  8272. $0 = $0|0;
  8273. $1 = $1|0;
  8274. $2 = $2|0;
  8275. $3 = $3|0;
  8276. $4 = $4|0;
  8277. var $$0$lcssa16 = 0, $$012 = 0, $$pre = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $5 = 0, $6 = 0;
  8278. var $7 = 0, $8 = 0, $9 = 0, $or$cond = 0, label = 0, sp = 0;
  8279. sp = STACKTOP;
  8280. STACKTOP = STACKTOP + 256|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(256|0);
  8281. $5 = sp;
  8282. $6 = $4 & 73728;
  8283. $7 = ($6|0)==(0);
  8284. $8 = ($2|0)>($3|0);
  8285. $or$cond = $8 & $7;
  8286. do {
  8287. if ($or$cond) {
  8288. $9 = (($2) - ($3))|0;
  8289. $10 = ($9>>>0)>(256);
  8290. $11 = $10 ? 256 : $9;
  8291. _memset(($5|0),($1|0),($11|0))|0;
  8292. $12 = ($9>>>0)>(255);
  8293. $13 = HEAP32[$0>>2]|0;
  8294. $14 = $13 & 32;
  8295. $15 = ($14|0)==(0);
  8296. if ($12) {
  8297. $16 = (($2) - ($3))|0;
  8298. $$012 = $9;$23 = $13;$24 = $15;
  8299. while(1) {
  8300. if ($24) {
  8301. (___fwritex($5,256,$0)|0);
  8302. $$pre = HEAP32[$0>>2]|0;
  8303. $20 = $$pre;
  8304. } else {
  8305. $20 = $23;
  8306. }
  8307. $17 = (($$012) + -256)|0;
  8308. $18 = ($17>>>0)>(255);
  8309. $19 = $20 & 32;
  8310. $21 = ($19|0)==(0);
  8311. if ($18) {
  8312. $$012 = $17;$23 = $20;$24 = $21;
  8313. } else {
  8314. break;
  8315. }
  8316. }
  8317. $22 = $16 & 255;
  8318. if ($21) {
  8319. $$0$lcssa16 = $22;
  8320. } else {
  8321. break;
  8322. }
  8323. } else {
  8324. if ($15) {
  8325. $$0$lcssa16 = $9;
  8326. } else {
  8327. break;
  8328. }
  8329. }
  8330. (___fwritex($5,$$0$lcssa16,$0)|0);
  8331. }
  8332. } while(0);
  8333. STACKTOP = sp;return;
  8334. }
  8335. function _wctomb($0,$1) {
  8336. $0 = $0|0;
  8337. $1 = $1|0;
  8338. var $$0 = 0, $2 = 0, $3 = 0, label = 0, sp = 0;
  8339. sp = STACKTOP;
  8340. $2 = ($0|0)==(0|0);
  8341. if ($2) {
  8342. $$0 = 0;
  8343. } else {
  8344. $3 = (_wcrtomb($0,$1,0)|0);
  8345. $$0 = $3;
  8346. }
  8347. return ($$0|0);
  8348. }
  8349. function _frexpl($0,$1) {
  8350. $0 = +$0;
  8351. $1 = $1|0;
  8352. var $2 = 0.0, label = 0, sp = 0;
  8353. sp = STACKTOP;
  8354. $2 = (+_frexp($0,$1));
  8355. return (+$2);
  8356. }
  8357. function _frexp($0,$1) {
  8358. $0 = +$0;
  8359. $1 = $1|0;
  8360. var $$0 = 0.0, $$016 = 0.0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0.0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0.0, $9 = 0.0, $storemerge = 0, $trunc$clear = 0, label = 0;
  8361. var sp = 0;
  8362. sp = STACKTOP;
  8363. HEAPF64[tempDoublePtr>>3] = $0;$2 = HEAP32[tempDoublePtr>>2]|0;
  8364. $3 = HEAP32[tempDoublePtr+4>>2]|0;
  8365. $4 = (_bitshift64Lshr(($2|0),($3|0),52)|0);
  8366. $5 = tempRet0;
  8367. $6 = $4&65535;
  8368. $trunc$clear = $6 & 2047;
  8369. switch ($trunc$clear<<16>>16) {
  8370. case 0: {
  8371. $7 = $0 != 0.0;
  8372. if ($7) {
  8373. $8 = $0 * 1.8446744073709552E+19;
  8374. $9 = (+_frexp($8,$1));
  8375. $10 = HEAP32[$1>>2]|0;
  8376. $11 = (($10) + -64)|0;
  8377. $$016 = $9;$storemerge = $11;
  8378. } else {
  8379. $$016 = $0;$storemerge = 0;
  8380. }
  8381. HEAP32[$1>>2] = $storemerge;
  8382. $$0 = $$016;
  8383. break;
  8384. }
  8385. case 2047: {
  8386. $$0 = $0;
  8387. break;
  8388. }
  8389. default: {
  8390. $12 = $4 & 2047;
  8391. $13 = (($12) + -1022)|0;
  8392. HEAP32[$1>>2] = $13;
  8393. $14 = $3 & -2146435073;
  8394. $15 = $14 | 1071644672;
  8395. HEAP32[tempDoublePtr>>2] = $2;HEAP32[tempDoublePtr+4>>2] = $15;$16 = +HEAPF64[tempDoublePtr>>3];
  8396. $$0 = $16;
  8397. }
  8398. }
  8399. return (+$$0);
  8400. }
  8401. function _wcrtomb($0,$1,$2) {
  8402. $0 = $0|0;
  8403. $1 = $1|0;
  8404. $2 = $2|0;
  8405. var $$0 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0, $27 = 0, $28 = 0;
  8406. var $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0, $45 = 0, $46 = 0;
  8407. var $47 = 0, $48 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $or$cond = 0, label = 0, sp = 0;
  8408. sp = STACKTOP;
  8409. $3 = ($0|0)==(0|0);
  8410. do {
  8411. if ($3) {
  8412. $$0 = 1;
  8413. } else {
  8414. $4 = ($1>>>0)<(128);
  8415. if ($4) {
  8416. $5 = $1&255;
  8417. HEAP8[$0>>0] = $5;
  8418. $$0 = 1;
  8419. break;
  8420. }
  8421. $6 = ($1>>>0)<(2048);
  8422. if ($6) {
  8423. $7 = $1 >>> 6;
  8424. $8 = $7 | 192;
  8425. $9 = $8&255;
  8426. $10 = ((($0)) + 1|0);
  8427. HEAP8[$0>>0] = $9;
  8428. $11 = $1 & 63;
  8429. $12 = $11 | 128;
  8430. $13 = $12&255;
  8431. HEAP8[$10>>0] = $13;
  8432. $$0 = 2;
  8433. break;
  8434. }
  8435. $14 = ($1>>>0)<(55296);
  8436. $15 = $1 & -8192;
  8437. $16 = ($15|0)==(57344);
  8438. $or$cond = $14 | $16;
  8439. if ($or$cond) {
  8440. $17 = $1 >>> 12;
  8441. $18 = $17 | 224;
  8442. $19 = $18&255;
  8443. $20 = ((($0)) + 1|0);
  8444. HEAP8[$0>>0] = $19;
  8445. $21 = $1 >>> 6;
  8446. $22 = $21 & 63;
  8447. $23 = $22 | 128;
  8448. $24 = $23&255;
  8449. $25 = ((($0)) + 2|0);
  8450. HEAP8[$20>>0] = $24;
  8451. $26 = $1 & 63;
  8452. $27 = $26 | 128;
  8453. $28 = $27&255;
  8454. HEAP8[$25>>0] = $28;
  8455. $$0 = 3;
  8456. break;
  8457. }
  8458. $29 = (($1) + -65536)|0;
  8459. $30 = ($29>>>0)<(1048576);
  8460. if ($30) {
  8461. $31 = $1 >>> 18;
  8462. $32 = $31 | 240;
  8463. $33 = $32&255;
  8464. $34 = ((($0)) + 1|0);
  8465. HEAP8[$0>>0] = $33;
  8466. $35 = $1 >>> 12;
  8467. $36 = $35 & 63;
  8468. $37 = $36 | 128;
  8469. $38 = $37&255;
  8470. $39 = ((($0)) + 2|0);
  8471. HEAP8[$34>>0] = $38;
  8472. $40 = $1 >>> 6;
  8473. $41 = $40 & 63;
  8474. $42 = $41 | 128;
  8475. $43 = $42&255;
  8476. $44 = ((($0)) + 3|0);
  8477. HEAP8[$39>>0] = $43;
  8478. $45 = $1 & 63;
  8479. $46 = $45 | 128;
  8480. $47 = $46&255;
  8481. HEAP8[$44>>0] = $47;
  8482. $$0 = 4;
  8483. break;
  8484. } else {
  8485. $48 = (___errno_location()|0);
  8486. HEAP32[$48>>2] = 84;
  8487. $$0 = -1;
  8488. break;
  8489. }
  8490. }
  8491. } while(0);
  8492. return ($$0|0);
  8493. }
  8494. function ___towrite($0) {
  8495. $0 = $0|0;
  8496. var $$0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0;
  8497. var $8 = 0, $9 = 0, label = 0, sp = 0;
  8498. sp = STACKTOP;
  8499. $1 = ((($0)) + 74|0);
  8500. $2 = HEAP8[$1>>0]|0;
  8501. $3 = $2 << 24 >> 24;
  8502. $4 = (($3) + 255)|0;
  8503. $5 = $4 | $3;
  8504. $6 = $5&255;
  8505. HEAP8[$1>>0] = $6;
  8506. $7 = HEAP32[$0>>2]|0;
  8507. $8 = $7 & 8;
  8508. $9 = ($8|0)==(0);
  8509. if ($9) {
  8510. $11 = ((($0)) + 8|0);
  8511. HEAP32[$11>>2] = 0;
  8512. $12 = ((($0)) + 4|0);
  8513. HEAP32[$12>>2] = 0;
  8514. $13 = ((($0)) + 44|0);
  8515. $14 = HEAP32[$13>>2]|0;
  8516. $15 = ((($0)) + 28|0);
  8517. HEAP32[$15>>2] = $14;
  8518. $16 = ((($0)) + 20|0);
  8519. HEAP32[$16>>2] = $14;
  8520. $17 = $14;
  8521. $18 = ((($0)) + 48|0);
  8522. $19 = HEAP32[$18>>2]|0;
  8523. $20 = (($17) + ($19)|0);
  8524. $21 = ((($0)) + 16|0);
  8525. HEAP32[$21>>2] = $20;
  8526. $$0 = 0;
  8527. } else {
  8528. $10 = $7 | 32;
  8529. HEAP32[$0>>2] = $10;
  8530. $$0 = -1;
  8531. }
  8532. return ($$0|0);
  8533. }
  8534. function _getrlimit($0,$1) {
  8535. $0 = $0|0;
  8536. $1 = $1|0;
  8537. var $$0 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0, $27 = 0;
  8538. var $28 = 0, $29 = 0, $3 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0, $45 = 0;
  8539. var $46 = 0, $47 = 0, $48 = 0, $49 = 0, $5 = 0, $50 = 0, $51 = 0, $52 = 0, $53 = 0, $54 = 0, $55 = 0, $56 = 0, $57 = 0, $58 = 0, $59 = 0, $6 = 0, $60 = 0, $61 = 0, $62 = 0, $63 = 0;
  8540. var $64 = 0, $7 = 0, $8 = 0, $9 = 0, $vararg_buffer = 0, $vararg_buffer4 = 0, $vararg_ptr1 = 0, $vararg_ptr2 = 0, $vararg_ptr3 = 0, $vararg_ptr7 = 0, label = 0, sp = 0;
  8541. sp = STACKTOP;
  8542. STACKTOP = STACKTOP + 32|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(32|0);
  8543. $vararg_buffer4 = sp + 16|0;
  8544. $vararg_buffer = sp;
  8545. $2 = sp + 24|0;
  8546. HEAP32[$vararg_buffer>>2] = 0;
  8547. $vararg_ptr1 = ((($vararg_buffer)) + 4|0);
  8548. HEAP32[$vararg_ptr1>>2] = $0;
  8549. $vararg_ptr2 = ((($vararg_buffer)) + 8|0);
  8550. HEAP32[$vararg_ptr2>>2] = 0;
  8551. $vararg_ptr3 = ((($vararg_buffer)) + 12|0);
  8552. HEAP32[$vararg_ptr3>>2] = $1;
  8553. $3 = (___syscall340(340,($vararg_buffer|0))|0);
  8554. $4 = (___syscall_ret($3)|0);
  8555. $5 = ($4|0)==(0);
  8556. if ($5) {
  8557. $6 = $1;
  8558. $7 = $6;
  8559. $8 = HEAP32[$7>>2]|0;
  8560. $9 = (($6) + 4)|0;
  8561. $10 = $9;
  8562. $11 = HEAP32[$10>>2]|0;
  8563. $12 = ($8|0)==(-1);
  8564. $13 = ($11|0)==(-1);
  8565. $14 = $12 & $13;
  8566. if ($14) {
  8567. $15 = $1;
  8568. $16 = $15;
  8569. HEAP32[$16>>2] = -1;
  8570. $17 = (($15) + 4)|0;
  8571. $18 = $17;
  8572. HEAP32[$18>>2] = -1;
  8573. }
  8574. $19 = ((($1)) + 8|0);
  8575. $20 = $19;
  8576. $21 = $20;
  8577. $22 = HEAP32[$21>>2]|0;
  8578. $23 = (($20) + 4)|0;
  8579. $24 = $23;
  8580. $25 = HEAP32[$24>>2]|0;
  8581. $26 = ($22|0)==(-1);
  8582. $27 = ($25|0)==(-1);
  8583. $28 = $26 & $27;
  8584. if ($28) {
  8585. $29 = $19;
  8586. $30 = $29;
  8587. HEAP32[$30>>2] = -1;
  8588. $31 = (($29) + 4)|0;
  8589. $32 = $31;
  8590. HEAP32[$32>>2] = -1;
  8591. $$0 = 0;
  8592. } else {
  8593. $$0 = 0;
  8594. }
  8595. } else {
  8596. $33 = (___errno_location()|0);
  8597. $34 = HEAP32[$33>>2]|0;
  8598. $35 = ($34|0)==(38);
  8599. if ($35) {
  8600. HEAP32[$vararg_buffer4>>2] = $0;
  8601. $vararg_ptr7 = ((($vararg_buffer4)) + 4|0);
  8602. HEAP32[$vararg_ptr7>>2] = $2;
  8603. $36 = (___syscall191(191,($vararg_buffer4|0))|0);
  8604. $37 = (___syscall_ret($36)|0);
  8605. $38 = ($37|0)<(0);
  8606. if ($38) {
  8607. $$0 = -1;
  8608. } else {
  8609. $39 = HEAP32[$2>>2]|0;
  8610. $40 = ($39|0)==(-1);
  8611. $41 = $40 ? -1 : $39;
  8612. $42 = $40 ? -1 : 0;
  8613. $43 = $1;
  8614. $44 = $43;
  8615. HEAP32[$44>>2] = $41;
  8616. $45 = (($43) + 4)|0;
  8617. $46 = $45;
  8618. HEAP32[$46>>2] = $42;
  8619. $47 = ((($2)) + 4|0);
  8620. $48 = HEAP32[$47>>2]|0;
  8621. $49 = ($48|0)==(-1);
  8622. $50 = $49 ? -1 : $48;
  8623. $51 = $49 ? -1 : 0;
  8624. $52 = ((($1)) + 8|0);
  8625. $53 = $52;
  8626. $54 = $53;
  8627. HEAP32[$54>>2] = $50;
  8628. $55 = (($53) + 4)|0;
  8629. $56 = $55;
  8630. HEAP32[$56>>2] = $51;
  8631. if ($40) {
  8632. $57 = $1;
  8633. $58 = $57;
  8634. HEAP32[$58>>2] = -1;
  8635. $59 = (($57) + 4)|0;
  8636. $60 = $59;
  8637. HEAP32[$60>>2] = -1;
  8638. }
  8639. if ($49) {
  8640. $61 = $52;
  8641. $62 = $61;
  8642. HEAP32[$62>>2] = -1;
  8643. $63 = (($61) + 4)|0;
  8644. $64 = $63;
  8645. HEAP32[$64>>2] = -1;
  8646. $$0 = 0;
  8647. } else {
  8648. $$0 = 0;
  8649. }
  8650. }
  8651. } else {
  8652. $$0 = $4;
  8653. }
  8654. }
  8655. STACKTOP = sp;return ($$0|0);
  8656. }
  8657. function _fflush($0) {
  8658. $0 = $0|0;
  8659. var $$0 = 0, $$023 = 0, $$02325 = 0, $$02327 = 0, $$024$lcssa = 0, $$02426 = 0, $$1 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0;
  8660. var $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0, $27 = 0, $28 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $phitmp = 0, label = 0, sp = 0;
  8661. sp = STACKTOP;
  8662. $1 = ($0|0)==(0|0);
  8663. do {
  8664. if ($1) {
  8665. $8 = HEAP32[60]|0;
  8666. $9 = ($8|0)==(0|0);
  8667. if ($9) {
  8668. $28 = 0;
  8669. } else {
  8670. $10 = HEAP32[60]|0;
  8671. $11 = (_fflush($10)|0);
  8672. $28 = $11;
  8673. }
  8674. ___lock(((2756)|0));
  8675. $$02325 = HEAP32[(2752)>>2]|0;
  8676. $12 = ($$02325|0)==(0|0);
  8677. if ($12) {
  8678. $$024$lcssa = $28;
  8679. } else {
  8680. $$02327 = $$02325;$$02426 = $28;
  8681. while(1) {
  8682. $13 = ((($$02327)) + 76|0);
  8683. $14 = HEAP32[$13>>2]|0;
  8684. $15 = ($14|0)>(-1);
  8685. if ($15) {
  8686. $16 = (___lockfile($$02327)|0);
  8687. $25 = $16;
  8688. } else {
  8689. $25 = 0;
  8690. }
  8691. $17 = ((($$02327)) + 20|0);
  8692. $18 = HEAP32[$17>>2]|0;
  8693. $19 = ((($$02327)) + 28|0);
  8694. $20 = HEAP32[$19>>2]|0;
  8695. $21 = ($18>>>0)>($20>>>0);
  8696. if ($21) {
  8697. $22 = (___fflush_unlocked($$02327)|0);
  8698. $23 = $22 | $$02426;
  8699. $$1 = $23;
  8700. } else {
  8701. $$1 = $$02426;
  8702. }
  8703. $24 = ($25|0)==(0);
  8704. if (!($24)) {
  8705. ___unlockfile($$02327);
  8706. }
  8707. $26 = ((($$02327)) + 56|0);
  8708. $$023 = HEAP32[$26>>2]|0;
  8709. $27 = ($$023|0)==(0|0);
  8710. if ($27) {
  8711. $$024$lcssa = $$1;
  8712. break;
  8713. } else {
  8714. $$02327 = $$023;$$02426 = $$1;
  8715. }
  8716. }
  8717. }
  8718. ___unlock(((2756)|0));
  8719. $$0 = $$024$lcssa;
  8720. } else {
  8721. $2 = ((($0)) + 76|0);
  8722. $3 = HEAP32[$2>>2]|0;
  8723. $4 = ($3|0)>(-1);
  8724. if (!($4)) {
  8725. $5 = (___fflush_unlocked($0)|0);
  8726. $$0 = $5;
  8727. break;
  8728. }
  8729. $6 = (___lockfile($0)|0);
  8730. $phitmp = ($6|0)==(0);
  8731. $7 = (___fflush_unlocked($0)|0);
  8732. if ($phitmp) {
  8733. $$0 = $7;
  8734. } else {
  8735. ___unlockfile($0);
  8736. $$0 = $7;
  8737. }
  8738. }
  8739. } while(0);
  8740. return ($$0|0);
  8741. }
  8742. function ___fflush_unlocked($0) {
  8743. $0 = $0|0;
  8744. var $$0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0;
  8745. var $9 = 0, label = 0, sp = 0;
  8746. sp = STACKTOP;
  8747. $1 = ((($0)) + 20|0);
  8748. $2 = HEAP32[$1>>2]|0;
  8749. $3 = ((($0)) + 28|0);
  8750. $4 = HEAP32[$3>>2]|0;
  8751. $5 = ($2>>>0)>($4>>>0);
  8752. if ($5) {
  8753. $6 = ((($0)) + 36|0);
  8754. $7 = HEAP32[$6>>2]|0;
  8755. (FUNCTION_TABLE_iiii[$7 & 7]($0,0,0)|0);
  8756. $8 = HEAP32[$1>>2]|0;
  8757. $9 = ($8|0)==(0|0);
  8758. if ($9) {
  8759. $$0 = -1;
  8760. } else {
  8761. label = 3;
  8762. }
  8763. } else {
  8764. label = 3;
  8765. }
  8766. if ((label|0) == 3) {
  8767. $10 = ((($0)) + 4|0);
  8768. $11 = HEAP32[$10>>2]|0;
  8769. $12 = ((($0)) + 8|0);
  8770. $13 = HEAP32[$12>>2]|0;
  8771. $14 = ($11>>>0)<($13>>>0);
  8772. if ($14) {
  8773. $15 = ((($0)) + 40|0);
  8774. $16 = HEAP32[$15>>2]|0;
  8775. $17 = $11;
  8776. $18 = $13;
  8777. $19 = (($17) - ($18))|0;
  8778. (FUNCTION_TABLE_iiii[$16 & 7]($0,$19,1)|0);
  8779. }
  8780. $20 = ((($0)) + 16|0);
  8781. HEAP32[$20>>2] = 0;
  8782. HEAP32[$3>>2] = 0;
  8783. HEAP32[$1>>2] = 0;
  8784. HEAP32[$12>>2] = 0;
  8785. HEAP32[$10>>2] = 0;
  8786. $$0 = 0;
  8787. }
  8788. return ($$0|0);
  8789. }
  8790. function _fprintf($0,$1,$varargs) {
  8791. $0 = $0|0;
  8792. $1 = $1|0;
  8793. $varargs = $varargs|0;
  8794. var $2 = 0, $3 = 0, label = 0, sp = 0;
  8795. sp = STACKTOP;
  8796. STACKTOP = STACKTOP + 16|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(16|0);
  8797. $2 = sp;
  8798. HEAP32[$2>>2] = $varargs;
  8799. $3 = (_vfprintf($0,$1,$2)|0);
  8800. STACKTOP = sp;return ($3|0);
  8801. }
  8802. function ___setrlimit($0,$1) {
  8803. $0 = $0|0;
  8804. $1 = $1|0;
  8805. var $$0 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0, $27 = 0;
  8806. var $28 = 0, $29 = 0, $3 = 0, $30 = 0, $31 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $vararg_buffer = 0, $vararg_buffer4 = 0, $vararg_ptr1 = 0, $vararg_ptr2 = 0, $vararg_ptr3 = 0, $vararg_ptr7 = 0, label = 0, sp = 0;
  8807. sp = STACKTOP;
  8808. STACKTOP = STACKTOP + 32|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(32|0);
  8809. $vararg_buffer4 = sp + 16|0;
  8810. $vararg_buffer = sp;
  8811. $2 = sp + 24|0;
  8812. HEAP32[$vararg_buffer>>2] = 0;
  8813. $vararg_ptr1 = ((($vararg_buffer)) + 4|0);
  8814. HEAP32[$vararg_ptr1>>2] = $0;
  8815. $vararg_ptr2 = ((($vararg_buffer)) + 8|0);
  8816. HEAP32[$vararg_ptr2>>2] = $1;
  8817. $vararg_ptr3 = ((($vararg_buffer)) + 12|0);
  8818. HEAP32[$vararg_ptr3>>2] = 0;
  8819. $3 = (___syscall340(340,($vararg_buffer|0))|0);
  8820. $4 = ($3|0)==(-38);
  8821. if ($4) {
  8822. $5 = $1;
  8823. $6 = $5;
  8824. $7 = HEAP32[$6>>2]|0;
  8825. $8 = (($5) + 4)|0;
  8826. $9 = $8;
  8827. $10 = HEAP32[$9>>2]|0;
  8828. $11 = ($10>>>0)<(0);
  8829. $12 = ($7>>>0)<(4294967295);
  8830. $13 = ($10|0)==(0);
  8831. $14 = $13 & $12;
  8832. $15 = $11 | $14;
  8833. $16 = $15 ? $7 : -1;
  8834. $15 ? $10 : 0;
  8835. HEAP32[$2>>2] = $16;
  8836. $17 = ((($1)) + 8|0);
  8837. $18 = $17;
  8838. $19 = $18;
  8839. $20 = HEAP32[$19>>2]|0;
  8840. $21 = (($18) + 4)|0;
  8841. $22 = $21;
  8842. $23 = HEAP32[$22>>2]|0;
  8843. $24 = ($23>>>0)<(0);
  8844. $25 = ($20>>>0)<(4294967295);
  8845. $26 = ($23|0)==(0);
  8846. $27 = $26 & $25;
  8847. $28 = $24 | $27;
  8848. $29 = $28 ? $20 : -1;
  8849. $28 ? $23 : 0;
  8850. $30 = ((($2)) + 4|0);
  8851. HEAP32[$30>>2] = $29;
  8852. HEAP32[$vararg_buffer4>>2] = $0;
  8853. $vararg_ptr7 = ((($vararg_buffer4)) + 4|0);
  8854. HEAP32[$vararg_ptr7>>2] = $2;
  8855. $31 = (___syscall75(75,($vararg_buffer4|0))|0);
  8856. $$0 = $31;
  8857. } else {
  8858. $$0 = $3;
  8859. }
  8860. STACKTOP = sp;return ($$0|0);
  8861. }
  8862. function _setrlimit($0,$1) {
  8863. $0 = $0|0;
  8864. $1 = $1|0;
  8865. var $$0 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, label = 0, sp = 0;
  8866. sp = STACKTOP;
  8867. STACKTOP = STACKTOP + 16|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(16|0);
  8868. $2 = sp;
  8869. HEAP32[$2>>2] = $1;
  8870. $3 = ((($2)) + 4|0);
  8871. HEAP32[$3>>2] = $0;
  8872. $4 = ((($2)) + 8|0);
  8873. HEAP32[$4>>2] = 0;
  8874. ___synccall(6,$2);
  8875. $5 = HEAP32[$4>>2]|0;
  8876. $6 = ($5|0)==(0);
  8877. if ($6) {
  8878. $$0 = 0;
  8879. } else {
  8880. $7 = (___errno_location()|0);
  8881. HEAP32[$7>>2] = $5;
  8882. $$0 = -1;
  8883. }
  8884. STACKTOP = sp;return ($$0|0);
  8885. }
  8886. function _do_setrlimit($0) {
  8887. $0 = $0|0;
  8888. var $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, label = 0, sp = 0;
  8889. sp = STACKTOP;
  8890. $1 = ((($0)) + 8|0);
  8891. $2 = HEAP32[$1>>2]|0;
  8892. $3 = ($2|0)==(0);
  8893. if ($3) {
  8894. $4 = ((($0)) + 4|0);
  8895. $5 = HEAP32[$4>>2]|0;
  8896. $6 = HEAP32[$0>>2]|0;
  8897. $7 = (___setrlimit($5,$6)|0);
  8898. $8 = (0 - ($7))|0;
  8899. HEAP32[$1>>2] = $8;
  8900. }
  8901. return;
  8902. }
  8903. function ___mmap($0,$1,$2,$3,$4,$5) {
  8904. $0 = $0|0;
  8905. $1 = $1|0;
  8906. $2 = $2|0;
  8907. $3 = $3|0;
  8908. $4 = $4|0;
  8909. $5 = $5|0;
  8910. var $$0 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $20 = 0, $21 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $vararg_buffer = 0, $vararg_ptr1 = 0, $vararg_ptr2 = 0;
  8911. var $vararg_ptr3 = 0, $vararg_ptr4 = 0, $vararg_ptr5 = 0, label = 0, sp = 0;
  8912. sp = STACKTOP;
  8913. STACKTOP = STACKTOP + 32|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(32|0);
  8914. $vararg_buffer = sp;
  8915. $6 = ($5|0)<(0);
  8916. $7 = $6 << 31 >> 31;
  8917. $8 = $5 & 4095;
  8918. $9 = $7 & -4096;
  8919. $10 = ($8|0)==(0);
  8920. $11 = ($9|0)==(0);
  8921. $12 = $10 & $11;
  8922. do {
  8923. if ($12) {
  8924. $14 = ($1>>>0)>(2147483646);
  8925. if ($14) {
  8926. $15 = (___errno_location()|0);
  8927. HEAP32[$15>>2] = 12;
  8928. $$0 = (-1);
  8929. break;
  8930. }
  8931. $16 = $3 & 16;
  8932. $17 = ($16|0)!=(0);
  8933. if ($17) {
  8934. _dummy1(-1);
  8935. }
  8936. $18 = $5 >> 12;
  8937. HEAP32[$vararg_buffer>>2] = $0;
  8938. $vararg_ptr1 = ((($vararg_buffer)) + 4|0);
  8939. HEAP32[$vararg_ptr1>>2] = $1;
  8940. $vararg_ptr2 = ((($vararg_buffer)) + 8|0);
  8941. HEAP32[$vararg_ptr2>>2] = $2;
  8942. $vararg_ptr3 = ((($vararg_buffer)) + 12|0);
  8943. HEAP32[$vararg_ptr3>>2] = $3;
  8944. $vararg_ptr4 = ((($vararg_buffer)) + 16|0);
  8945. HEAP32[$vararg_ptr4>>2] = $4;
  8946. $vararg_ptr5 = ((($vararg_buffer)) + 20|0);
  8947. HEAP32[$vararg_ptr5>>2] = $18;
  8948. $19 = (___syscall192(192,($vararg_buffer|0))|0);
  8949. $20 = (___syscall_ret($19)|0);
  8950. $21 = $20;
  8951. if ($17) {
  8952. _dummy0();
  8953. $$0 = $21;
  8954. } else {
  8955. $$0 = $21;
  8956. }
  8957. } else {
  8958. $13 = (___errno_location()|0);
  8959. HEAP32[$13>>2] = 22;
  8960. $$0 = (-1);
  8961. }
  8962. } while(0);
  8963. STACKTOP = sp;return ($$0|0);
  8964. }
  8965. function _dummy0() {
  8966. var label = 0, sp = 0;
  8967. sp = STACKTOP;
  8968. return;
  8969. }
  8970. function _dummy1($0) {
  8971. $0 = $0|0;
  8972. var label = 0, sp = 0;
  8973. sp = STACKTOP;
  8974. return;
  8975. }
  8976. function _printf($0,$varargs) {
  8977. $0 = $0|0;
  8978. $varargs = $varargs|0;
  8979. var $1 = 0, $2 = 0, $3 = 0, label = 0, sp = 0;
  8980. sp = STACKTOP;
  8981. STACKTOP = STACKTOP + 16|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(16|0);
  8982. $1 = sp;
  8983. HEAP32[$1>>2] = $varargs;
  8984. $2 = HEAP32[31]|0;
  8985. $3 = (_vfprintf($2,$0,$1)|0);
  8986. STACKTOP = sp;return ($3|0);
  8987. }
  8988. function _malloc($0) {
  8989. $0 = $0|0;
  8990. var $$$0190$i = 0, $$$0191$i = 0, $$$4349$i = 0, $$$i = 0, $$0 = 0, $$0$i$i = 0, $$0$i$i$i = 0, $$0$i17$i = 0, $$0$i18$i = 0, $$01$i$i = 0, $$0187$i = 0, $$0189$i = 0, $$0190$i = 0, $$0191$i = 0, $$0197 = 0, $$0199 = 0, $$0206$i$i = 0, $$0207$i$i = 0, $$0211$i$i = 0, $$0212$i$i = 0;
  8991. var $$024370$i = 0, $$0286$i$i = 0, $$0287$i$i = 0, $$0288$i$i = 0, $$0294$i$i = 0, $$0295$i$i = 0, $$0340$i = 0, $$0342$i = 0, $$0343$i = 0, $$0345$i = 0, $$0351$i = 0, $$0356$i = 0, $$0357$$i = 0, $$0357$i = 0, $$0359$i = 0, $$0360$i = 0, $$0366$i = 0, $$1194$i = 0, $$1196$i = 0, $$124469$i = 0;
  8992. var $$1290$i$i = 0, $$1292$i$i = 0, $$1341$i = 0, $$1346$i = 0, $$1361$i = 0, $$1368$i = 0, $$1372$i = 0, $$2247$ph$i = 0, $$2253$ph$i = 0, $$2353$i = 0, $$3$i = 0, $$3$i$i = 0, $$3$i201 = 0, $$3348$i = 0, $$3370$i = 0, $$4$lcssa$i = 0, $$413$i = 0, $$4349$lcssa$i = 0, $$434912$i = 0, $$4355$$4$i = 0;
  8993. var $$4355$ph$i = 0, $$435511$i = 0, $$5256$i = 0, $$723947$i = 0, $$748$i = 0, $$not$i = 0, $$pre = 0, $$pre$i = 0, $$pre$i$i = 0, $$pre$i19$i = 0, $$pre$i205 = 0, $$pre$i208 = 0, $$pre$phi$i$iZ2D = 0, $$pre$phi$i20$iZ2D = 0, $$pre$phi$i206Z2D = 0, $$pre$phi$iZ2D = 0, $$pre$phi10$i$iZ2D = 0, $$pre$phiZ2D = 0, $$pre9$i$i = 0, $1 = 0;
  8994. var $10 = 0, $100 = 0, $1000 = 0, $1001 = 0, $1002 = 0, $1003 = 0, $1004 = 0, $1005 = 0, $1006 = 0, $1007 = 0, $1008 = 0, $1009 = 0, $101 = 0, $1010 = 0, $1011 = 0, $1012 = 0, $1013 = 0, $1014 = 0, $1015 = 0, $1016 = 0;
  8995. var $1017 = 0, $1018 = 0, $1019 = 0, $102 = 0, $1020 = 0, $1021 = 0, $1022 = 0, $1023 = 0, $1024 = 0, $1025 = 0, $1026 = 0, $1027 = 0, $1028 = 0, $1029 = 0, $103 = 0, $1030 = 0, $1031 = 0, $1032 = 0, $1033 = 0, $1034 = 0;
  8996. var $1035 = 0, $1036 = 0, $1037 = 0, $1038 = 0, $1039 = 0, $104 = 0, $1040 = 0, $1041 = 0, $1042 = 0, $1043 = 0, $1044 = 0, $1045 = 0, $1046 = 0, $1047 = 0, $1048 = 0, $1049 = 0, $105 = 0, $1050 = 0, $1051 = 0, $1052 = 0;
  8997. var $1053 = 0, $1054 = 0, $1055 = 0, $106 = 0, $107 = 0, $108 = 0, $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0, $116 = 0, $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0;
  8998. var $121 = 0, $122 = 0, $123 = 0, $124 = 0, $125 = 0, $126 = 0, $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0, $131 = 0, $132 = 0, $133 = 0, $134 = 0, $135 = 0, $136 = 0, $137 = 0, $138 = 0, $139 = 0;
  8999. var $14 = 0, $140 = 0, $141 = 0, $142 = 0, $143 = 0, $144 = 0, $145 = 0, $146 = 0, $147 = 0, $148 = 0, $149 = 0, $15 = 0, $150 = 0, $151 = 0, $152 = 0, $153 = 0, $154 = 0, $155 = 0, $156 = 0, $157 = 0;
  9000. var $158 = 0, $159 = 0, $16 = 0, $160 = 0, $161 = 0, $162 = 0, $163 = 0, $164 = 0, $165 = 0, $166 = 0, $167 = 0, $168 = 0, $169 = 0, $17 = 0, $170 = 0, $171 = 0, $172 = 0, $173 = 0, $174 = 0, $175 = 0;
  9001. var $176 = 0, $177 = 0, $178 = 0, $179 = 0, $18 = 0, $180 = 0, $181 = 0, $182 = 0, $183 = 0, $184 = 0, $185 = 0, $186 = 0, $187 = 0, $188 = 0, $189 = 0, $19 = 0, $190 = 0, $191 = 0, $192 = 0, $193 = 0;
  9002. var $194 = 0, $195 = 0, $196 = 0, $197 = 0, $198 = 0, $199 = 0, $2 = 0, $20 = 0, $200 = 0, $201 = 0, $202 = 0, $203 = 0, $204 = 0, $205 = 0, $206 = 0, $207 = 0, $208 = 0, $209 = 0, $21 = 0, $210 = 0;
  9003. var $211 = 0, $212 = 0, $213 = 0, $214 = 0, $215 = 0, $216 = 0, $217 = 0, $218 = 0, $219 = 0, $22 = 0, $220 = 0, $221 = 0, $222 = 0, $223 = 0, $224 = 0, $225 = 0, $226 = 0, $227 = 0, $228 = 0, $229 = 0;
  9004. var $23 = 0, $230 = 0, $231 = 0, $232 = 0, $233 = 0, $234 = 0, $235 = 0, $236 = 0, $237 = 0, $238 = 0, $239 = 0, $24 = 0, $240 = 0, $241 = 0, $242 = 0, $243 = 0, $244 = 0, $245 = 0, $246 = 0, $247 = 0;
  9005. var $248 = 0, $249 = 0, $25 = 0, $250 = 0, $251 = 0, $252 = 0, $253 = 0, $254 = 0, $255 = 0, $256 = 0, $257 = 0, $258 = 0, $259 = 0, $26 = 0, $260 = 0, $261 = 0, $262 = 0, $263 = 0, $264 = 0, $265 = 0;
  9006. var $266 = 0, $267 = 0, $268 = 0, $269 = 0, $27 = 0, $270 = 0, $271 = 0, $272 = 0, $273 = 0, $274 = 0, $275 = 0, $276 = 0, $277 = 0, $278 = 0, $279 = 0, $28 = 0, $280 = 0, $281 = 0, $282 = 0, $283 = 0;
  9007. var $284 = 0, $285 = 0, $286 = 0, $287 = 0, $288 = 0, $289 = 0, $29 = 0, $290 = 0, $291 = 0, $292 = 0, $293 = 0, $294 = 0, $295 = 0, $296 = 0, $297 = 0, $298 = 0, $299 = 0, $3 = 0, $30 = 0, $300 = 0;
  9008. var $301 = 0, $302 = 0, $303 = 0, $304 = 0, $305 = 0, $306 = 0, $307 = 0, $308 = 0, $309 = 0, $31 = 0, $310 = 0, $311 = 0, $312 = 0, $313 = 0, $314 = 0, $315 = 0, $316 = 0, $317 = 0, $318 = 0, $319 = 0;
  9009. var $32 = 0, $320 = 0, $321 = 0, $322 = 0, $323 = 0, $324 = 0, $325 = 0, $326 = 0, $327 = 0, $328 = 0, $329 = 0, $33 = 0, $330 = 0, $331 = 0, $332 = 0, $333 = 0, $334 = 0, $335 = 0, $336 = 0, $337 = 0;
  9010. var $338 = 0, $339 = 0, $34 = 0, $340 = 0, $341 = 0, $342 = 0, $343 = 0, $344 = 0, $345 = 0, $346 = 0, $347 = 0, $348 = 0, $349 = 0, $35 = 0, $350 = 0, $351 = 0, $352 = 0, $353 = 0, $354 = 0, $355 = 0;
  9011. var $356 = 0, $357 = 0, $358 = 0, $359 = 0, $36 = 0, $360 = 0, $361 = 0, $362 = 0, $363 = 0, $364 = 0, $365 = 0, $366 = 0, $367 = 0, $368 = 0, $369 = 0, $37 = 0, $370 = 0, $371 = 0, $372 = 0, $373 = 0;
  9012. var $374 = 0, $375 = 0, $376 = 0, $377 = 0, $378 = 0, $379 = 0, $38 = 0, $380 = 0, $381 = 0, $382 = 0, $383 = 0, $384 = 0, $385 = 0, $386 = 0, $387 = 0, $388 = 0, $389 = 0, $39 = 0, $390 = 0, $391 = 0;
  9013. var $392 = 0, $393 = 0, $394 = 0, $395 = 0, $396 = 0, $397 = 0, $398 = 0, $399 = 0, $4 = 0, $40 = 0, $400 = 0, $401 = 0, $402 = 0, $403 = 0, $404 = 0, $405 = 0, $406 = 0, $407 = 0, $408 = 0, $409 = 0;
  9014. var $41 = 0, $410 = 0, $411 = 0, $412 = 0, $413 = 0, $414 = 0, $415 = 0, $416 = 0, $417 = 0, $418 = 0, $419 = 0, $42 = 0, $420 = 0, $421 = 0, $422 = 0, $423 = 0, $424 = 0, $425 = 0, $426 = 0, $427 = 0;
  9015. var $428 = 0, $429 = 0, $43 = 0, $430 = 0, $431 = 0, $432 = 0, $433 = 0, $434 = 0, $435 = 0, $436 = 0, $437 = 0, $438 = 0, $439 = 0, $44 = 0, $440 = 0, $441 = 0, $442 = 0, $443 = 0, $444 = 0, $445 = 0;
  9016. var $446 = 0, $447 = 0, $448 = 0, $449 = 0, $45 = 0, $450 = 0, $451 = 0, $452 = 0, $453 = 0, $454 = 0, $455 = 0, $456 = 0, $457 = 0, $458 = 0, $459 = 0, $46 = 0, $460 = 0, $461 = 0, $462 = 0, $463 = 0;
  9017. var $464 = 0, $465 = 0, $466 = 0, $467 = 0, $468 = 0, $469 = 0, $47 = 0, $470 = 0, $471 = 0, $472 = 0, $473 = 0, $474 = 0, $475 = 0, $476 = 0, $477 = 0, $478 = 0, $479 = 0, $48 = 0, $480 = 0, $481 = 0;
  9018. var $482 = 0, $483 = 0, $484 = 0, $485 = 0, $486 = 0, $487 = 0, $488 = 0, $489 = 0, $49 = 0, $490 = 0, $491 = 0, $492 = 0, $493 = 0, $494 = 0, $495 = 0, $496 = 0, $497 = 0, $498 = 0, $499 = 0, $5 = 0;
  9019. var $50 = 0, $500 = 0, $501 = 0, $502 = 0, $503 = 0, $504 = 0, $505 = 0, $506 = 0, $507 = 0, $508 = 0, $509 = 0, $51 = 0, $510 = 0, $511 = 0, $512 = 0, $513 = 0, $514 = 0, $515 = 0, $516 = 0, $517 = 0;
  9020. var $518 = 0, $519 = 0, $52 = 0, $520 = 0, $521 = 0, $522 = 0, $523 = 0, $524 = 0, $525 = 0, $526 = 0, $527 = 0, $528 = 0, $529 = 0, $53 = 0, $530 = 0, $531 = 0, $532 = 0, $533 = 0, $534 = 0, $535 = 0;
  9021. var $536 = 0, $537 = 0, $538 = 0, $539 = 0, $54 = 0, $540 = 0, $541 = 0, $542 = 0, $543 = 0, $544 = 0, $545 = 0, $546 = 0, $547 = 0, $548 = 0, $549 = 0, $55 = 0, $550 = 0, $551 = 0, $552 = 0, $553 = 0;
  9022. var $554 = 0, $555 = 0, $556 = 0, $557 = 0, $558 = 0, $559 = 0, $56 = 0, $560 = 0, $561 = 0, $562 = 0, $563 = 0, $564 = 0, $565 = 0, $566 = 0, $567 = 0, $568 = 0, $569 = 0, $57 = 0, $570 = 0, $571 = 0;
  9023. var $572 = 0, $573 = 0, $574 = 0, $575 = 0, $576 = 0, $577 = 0, $578 = 0, $579 = 0, $58 = 0, $580 = 0, $581 = 0, $582 = 0, $583 = 0, $584 = 0, $585 = 0, $586 = 0, $587 = 0, $588 = 0, $589 = 0, $59 = 0;
  9024. var $590 = 0, $591 = 0, $592 = 0, $593 = 0, $594 = 0, $595 = 0, $596 = 0, $597 = 0, $598 = 0, $599 = 0, $6 = 0, $60 = 0, $600 = 0, $601 = 0, $602 = 0, $603 = 0, $604 = 0, $605 = 0, $606 = 0, $607 = 0;
  9025. var $608 = 0, $609 = 0, $61 = 0, $610 = 0, $611 = 0, $612 = 0, $613 = 0, $614 = 0, $615 = 0, $616 = 0, $617 = 0, $618 = 0, $619 = 0, $62 = 0, $620 = 0, $621 = 0, $622 = 0, $623 = 0, $624 = 0, $625 = 0;
  9026. var $626 = 0, $627 = 0, $628 = 0, $629 = 0, $63 = 0, $630 = 0, $631 = 0, $632 = 0, $633 = 0, $634 = 0, $635 = 0, $636 = 0, $637 = 0, $638 = 0, $639 = 0, $64 = 0, $640 = 0, $641 = 0, $642 = 0, $643 = 0;
  9027. var $644 = 0, $645 = 0, $646 = 0, $647 = 0, $648 = 0, $649 = 0, $65 = 0, $650 = 0, $651 = 0, $652 = 0, $653 = 0, $654 = 0, $655 = 0, $656 = 0, $657 = 0, $658 = 0, $659 = 0, $66 = 0, $660 = 0, $661 = 0;
  9028. var $662 = 0, $663 = 0, $664 = 0, $665 = 0, $666 = 0, $667 = 0, $668 = 0, $669 = 0, $67 = 0, $670 = 0, $671 = 0, $672 = 0, $673 = 0, $674 = 0, $675 = 0, $676 = 0, $677 = 0, $678 = 0, $679 = 0, $68 = 0;
  9029. var $680 = 0, $681 = 0, $682 = 0, $683 = 0, $684 = 0, $685 = 0, $686 = 0, $687 = 0, $688 = 0, $689 = 0, $69 = 0, $690 = 0, $691 = 0, $692 = 0, $693 = 0, $694 = 0, $695 = 0, $696 = 0, $697 = 0, $698 = 0;
  9030. var $699 = 0, $7 = 0, $70 = 0, $700 = 0, $701 = 0, $702 = 0, $703 = 0, $704 = 0, $705 = 0, $706 = 0, $707 = 0, $708 = 0, $709 = 0, $71 = 0, $710 = 0, $711 = 0, $712 = 0, $713 = 0, $714 = 0, $715 = 0;
  9031. var $716 = 0, $717 = 0, $718 = 0, $719 = 0, $72 = 0, $720 = 0, $721 = 0, $722 = 0, $723 = 0, $724 = 0, $725 = 0, $726 = 0, $727 = 0, $728 = 0, $729 = 0, $73 = 0, $730 = 0, $731 = 0, $732 = 0, $733 = 0;
  9032. var $734 = 0, $735 = 0, $736 = 0, $737 = 0, $738 = 0, $739 = 0, $74 = 0, $740 = 0, $741 = 0, $742 = 0, $743 = 0, $744 = 0, $745 = 0, $746 = 0, $747 = 0, $748 = 0, $749 = 0, $75 = 0, $750 = 0, $751 = 0;
  9033. var $752 = 0, $753 = 0, $754 = 0, $755 = 0, $756 = 0, $757 = 0, $758 = 0, $759 = 0, $76 = 0, $760 = 0, $761 = 0, $762 = 0, $763 = 0, $764 = 0, $765 = 0, $766 = 0, $767 = 0, $768 = 0, $769 = 0, $77 = 0;
  9034. var $770 = 0, $771 = 0, $772 = 0, $773 = 0, $774 = 0, $775 = 0, $776 = 0, $777 = 0, $778 = 0, $779 = 0, $78 = 0, $780 = 0, $781 = 0, $782 = 0, $783 = 0, $784 = 0, $785 = 0, $786 = 0, $787 = 0, $788 = 0;
  9035. var $789 = 0, $79 = 0, $790 = 0, $791 = 0, $792 = 0, $793 = 0, $794 = 0, $795 = 0, $796 = 0, $797 = 0, $798 = 0, $799 = 0, $8 = 0, $80 = 0, $800 = 0, $801 = 0, $802 = 0, $803 = 0, $804 = 0, $805 = 0;
  9036. var $806 = 0, $807 = 0, $808 = 0, $809 = 0, $81 = 0, $810 = 0, $811 = 0, $812 = 0, $813 = 0, $814 = 0, $815 = 0, $816 = 0, $817 = 0, $818 = 0, $819 = 0, $82 = 0, $820 = 0, $821 = 0, $822 = 0, $823 = 0;
  9037. var $824 = 0, $825 = 0, $826 = 0, $827 = 0, $828 = 0, $829 = 0, $83 = 0, $830 = 0, $831 = 0, $832 = 0, $833 = 0, $834 = 0, $835 = 0, $836 = 0, $837 = 0, $838 = 0, $839 = 0, $84 = 0, $840 = 0, $841 = 0;
  9038. var $842 = 0, $843 = 0, $844 = 0, $845 = 0, $846 = 0, $847 = 0, $848 = 0, $849 = 0, $85 = 0, $850 = 0, $851 = 0, $852 = 0, $853 = 0, $854 = 0, $855 = 0, $856 = 0, $857 = 0, $858 = 0, $859 = 0, $86 = 0;
  9039. var $860 = 0, $861 = 0, $862 = 0, $863 = 0, $864 = 0, $865 = 0, $866 = 0, $867 = 0, $868 = 0, $869 = 0, $87 = 0, $870 = 0, $871 = 0, $872 = 0, $873 = 0, $874 = 0, $875 = 0, $876 = 0, $877 = 0, $878 = 0;
  9040. var $879 = 0, $88 = 0, $880 = 0, $881 = 0, $882 = 0, $883 = 0, $884 = 0, $885 = 0, $886 = 0, $887 = 0, $888 = 0, $889 = 0, $89 = 0, $890 = 0, $891 = 0, $892 = 0, $893 = 0, $894 = 0, $895 = 0, $896 = 0;
  9041. var $897 = 0, $898 = 0, $899 = 0, $9 = 0, $90 = 0, $900 = 0, $901 = 0, $902 = 0, $903 = 0, $904 = 0, $905 = 0, $906 = 0, $907 = 0, $908 = 0, $909 = 0, $91 = 0, $910 = 0, $911 = 0, $912 = 0, $913 = 0;
  9042. var $914 = 0, $915 = 0, $916 = 0, $917 = 0, $918 = 0, $919 = 0, $92 = 0, $920 = 0, $921 = 0, $922 = 0, $923 = 0, $924 = 0, $925 = 0, $926 = 0, $927 = 0, $928 = 0, $929 = 0, $93 = 0, $930 = 0, $931 = 0;
  9043. var $932 = 0, $933 = 0, $934 = 0, $935 = 0, $936 = 0, $937 = 0, $938 = 0, $939 = 0, $94 = 0, $940 = 0, $941 = 0, $942 = 0, $943 = 0, $944 = 0, $945 = 0, $946 = 0, $947 = 0, $948 = 0, $949 = 0, $95 = 0;
  9044. var $950 = 0, $951 = 0, $952 = 0, $953 = 0, $954 = 0, $955 = 0, $956 = 0, $957 = 0, $958 = 0, $959 = 0, $96 = 0, $960 = 0, $961 = 0, $962 = 0, $963 = 0, $964 = 0, $965 = 0, $966 = 0, $967 = 0, $968 = 0;
  9045. var $969 = 0, $97 = 0, $970 = 0, $971 = 0, $972 = 0, $973 = 0, $974 = 0, $975 = 0, $976 = 0, $977 = 0, $978 = 0, $979 = 0, $98 = 0, $980 = 0, $981 = 0, $982 = 0, $983 = 0, $984 = 0, $985 = 0, $986 = 0;
  9046. var $987 = 0, $988 = 0, $989 = 0, $99 = 0, $990 = 0, $991 = 0, $992 = 0, $993 = 0, $994 = 0, $995 = 0, $996 = 0, $997 = 0, $998 = 0, $999 = 0, $cond$i = 0, $cond$i$i = 0, $cond$i204 = 0, $exitcond$i$i = 0, $not$$i$i = 0, $not$$i22$i = 0;
  9047. var $not$7$i = 0, $or$cond$i = 0, $or$cond$i211 = 0, $or$cond1$i = 0, $or$cond1$i210 = 0, $or$cond10$i = 0, $or$cond11$i = 0, $or$cond12$i = 0, $or$cond2$i = 0, $or$cond5$i = 0, $or$cond50$i = 0, $or$cond7$i = 0, label = 0, sp = 0;
  9048. sp = STACKTOP;
  9049. STACKTOP = STACKTOP + 16|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(16|0);
  9050. $1 = sp;
  9051. $2 = ($0>>>0)<(245);
  9052. do {
  9053. if ($2) {
  9054. $3 = ($0>>>0)<(11);
  9055. $4 = (($0) + 11)|0;
  9056. $5 = $4 & -8;
  9057. $6 = $3 ? 16 : $5;
  9058. $7 = $6 >>> 3;
  9059. $8 = HEAP32[694]|0;
  9060. $9 = $8 >>> $7;
  9061. $10 = $9 & 3;
  9062. $11 = ($10|0)==(0);
  9063. if (!($11)) {
  9064. $12 = $9 & 1;
  9065. $13 = $12 ^ 1;
  9066. $14 = (($13) + ($7))|0;
  9067. $15 = $14 << 1;
  9068. $16 = (2816 + ($15<<2)|0);
  9069. $17 = ((($16)) + 8|0);
  9070. $18 = HEAP32[$17>>2]|0;
  9071. $19 = ((($18)) + 8|0);
  9072. $20 = HEAP32[$19>>2]|0;
  9073. $21 = ($16|0)==($20|0);
  9074. do {
  9075. if ($21) {
  9076. $22 = 1 << $14;
  9077. $23 = $22 ^ -1;
  9078. $24 = $8 & $23;
  9079. HEAP32[694] = $24;
  9080. } else {
  9081. $25 = HEAP32[(2792)>>2]|0;
  9082. $26 = ($20>>>0)<($25>>>0);
  9083. if ($26) {
  9084. _abort();
  9085. // unreachable;
  9086. }
  9087. $27 = ((($20)) + 12|0);
  9088. $28 = HEAP32[$27>>2]|0;
  9089. $29 = ($28|0)==($18|0);
  9090. if ($29) {
  9091. HEAP32[$27>>2] = $16;
  9092. HEAP32[$17>>2] = $20;
  9093. break;
  9094. } else {
  9095. _abort();
  9096. // unreachable;
  9097. }
  9098. }
  9099. } while(0);
  9100. $30 = $14 << 3;
  9101. $31 = $30 | 3;
  9102. $32 = ((($18)) + 4|0);
  9103. HEAP32[$32>>2] = $31;
  9104. $33 = (($18) + ($30)|0);
  9105. $34 = ((($33)) + 4|0);
  9106. $35 = HEAP32[$34>>2]|0;
  9107. $36 = $35 | 1;
  9108. HEAP32[$34>>2] = $36;
  9109. $$0 = $19;
  9110. STACKTOP = sp;return ($$0|0);
  9111. }
  9112. $37 = HEAP32[(2784)>>2]|0;
  9113. $38 = ($6>>>0)>($37>>>0);
  9114. if ($38) {
  9115. $39 = ($9|0)==(0);
  9116. if (!($39)) {
  9117. $40 = $9 << $7;
  9118. $41 = 2 << $7;
  9119. $42 = (0 - ($41))|0;
  9120. $43 = $41 | $42;
  9121. $44 = $40 & $43;
  9122. $45 = (0 - ($44))|0;
  9123. $46 = $44 & $45;
  9124. $47 = (($46) + -1)|0;
  9125. $48 = $47 >>> 12;
  9126. $49 = $48 & 16;
  9127. $50 = $47 >>> $49;
  9128. $51 = $50 >>> 5;
  9129. $52 = $51 & 8;
  9130. $53 = $52 | $49;
  9131. $54 = $50 >>> $52;
  9132. $55 = $54 >>> 2;
  9133. $56 = $55 & 4;
  9134. $57 = $53 | $56;
  9135. $58 = $54 >>> $56;
  9136. $59 = $58 >>> 1;
  9137. $60 = $59 & 2;
  9138. $61 = $57 | $60;
  9139. $62 = $58 >>> $60;
  9140. $63 = $62 >>> 1;
  9141. $64 = $63 & 1;
  9142. $65 = $61 | $64;
  9143. $66 = $62 >>> $64;
  9144. $67 = (($65) + ($66))|0;
  9145. $68 = $67 << 1;
  9146. $69 = (2816 + ($68<<2)|0);
  9147. $70 = ((($69)) + 8|0);
  9148. $71 = HEAP32[$70>>2]|0;
  9149. $72 = ((($71)) + 8|0);
  9150. $73 = HEAP32[$72>>2]|0;
  9151. $74 = ($69|0)==($73|0);
  9152. do {
  9153. if ($74) {
  9154. $75 = 1 << $67;
  9155. $76 = $75 ^ -1;
  9156. $77 = $8 & $76;
  9157. HEAP32[694] = $77;
  9158. $98 = $77;
  9159. } else {
  9160. $78 = HEAP32[(2792)>>2]|0;
  9161. $79 = ($73>>>0)<($78>>>0);
  9162. if ($79) {
  9163. _abort();
  9164. // unreachable;
  9165. }
  9166. $80 = ((($73)) + 12|0);
  9167. $81 = HEAP32[$80>>2]|0;
  9168. $82 = ($81|0)==($71|0);
  9169. if ($82) {
  9170. HEAP32[$80>>2] = $69;
  9171. HEAP32[$70>>2] = $73;
  9172. $98 = $8;
  9173. break;
  9174. } else {
  9175. _abort();
  9176. // unreachable;
  9177. }
  9178. }
  9179. } while(0);
  9180. $83 = $67 << 3;
  9181. $84 = (($83) - ($6))|0;
  9182. $85 = $6 | 3;
  9183. $86 = ((($71)) + 4|0);
  9184. HEAP32[$86>>2] = $85;
  9185. $87 = (($71) + ($6)|0);
  9186. $88 = $84 | 1;
  9187. $89 = ((($87)) + 4|0);
  9188. HEAP32[$89>>2] = $88;
  9189. $90 = (($87) + ($84)|0);
  9190. HEAP32[$90>>2] = $84;
  9191. $91 = ($37|0)==(0);
  9192. if (!($91)) {
  9193. $92 = HEAP32[(2796)>>2]|0;
  9194. $93 = $37 >>> 3;
  9195. $94 = $93 << 1;
  9196. $95 = (2816 + ($94<<2)|0);
  9197. $96 = 1 << $93;
  9198. $97 = $98 & $96;
  9199. $99 = ($97|0)==(0);
  9200. if ($99) {
  9201. $100 = $98 | $96;
  9202. HEAP32[694] = $100;
  9203. $$pre = ((($95)) + 8|0);
  9204. $$0199 = $95;$$pre$phiZ2D = $$pre;
  9205. } else {
  9206. $101 = ((($95)) + 8|0);
  9207. $102 = HEAP32[$101>>2]|0;
  9208. $103 = HEAP32[(2792)>>2]|0;
  9209. $104 = ($102>>>0)<($103>>>0);
  9210. if ($104) {
  9211. _abort();
  9212. // unreachable;
  9213. } else {
  9214. $$0199 = $102;$$pre$phiZ2D = $101;
  9215. }
  9216. }
  9217. HEAP32[$$pre$phiZ2D>>2] = $92;
  9218. $105 = ((($$0199)) + 12|0);
  9219. HEAP32[$105>>2] = $92;
  9220. $106 = ((($92)) + 8|0);
  9221. HEAP32[$106>>2] = $$0199;
  9222. $107 = ((($92)) + 12|0);
  9223. HEAP32[$107>>2] = $95;
  9224. }
  9225. HEAP32[(2784)>>2] = $84;
  9226. HEAP32[(2796)>>2] = $87;
  9227. $$0 = $72;
  9228. STACKTOP = sp;return ($$0|0);
  9229. }
  9230. $108 = HEAP32[(2780)>>2]|0;
  9231. $109 = ($108|0)==(0);
  9232. if ($109) {
  9233. $$0197 = $6;
  9234. } else {
  9235. $110 = (0 - ($108))|0;
  9236. $111 = $108 & $110;
  9237. $112 = (($111) + -1)|0;
  9238. $113 = $112 >>> 12;
  9239. $114 = $113 & 16;
  9240. $115 = $112 >>> $114;
  9241. $116 = $115 >>> 5;
  9242. $117 = $116 & 8;
  9243. $118 = $117 | $114;
  9244. $119 = $115 >>> $117;
  9245. $120 = $119 >>> 2;
  9246. $121 = $120 & 4;
  9247. $122 = $118 | $121;
  9248. $123 = $119 >>> $121;
  9249. $124 = $123 >>> 1;
  9250. $125 = $124 & 2;
  9251. $126 = $122 | $125;
  9252. $127 = $123 >>> $125;
  9253. $128 = $127 >>> 1;
  9254. $129 = $128 & 1;
  9255. $130 = $126 | $129;
  9256. $131 = $127 >>> $129;
  9257. $132 = (($130) + ($131))|0;
  9258. $133 = (3080 + ($132<<2)|0);
  9259. $134 = HEAP32[$133>>2]|0;
  9260. $135 = ((($134)) + 4|0);
  9261. $136 = HEAP32[$135>>2]|0;
  9262. $137 = $136 & -8;
  9263. $138 = (($137) - ($6))|0;
  9264. $$0189$i = $134;$$0190$i = $134;$$0191$i = $138;
  9265. while(1) {
  9266. $139 = ((($$0189$i)) + 16|0);
  9267. $140 = HEAP32[$139>>2]|0;
  9268. $141 = ($140|0)==(0|0);
  9269. if ($141) {
  9270. $142 = ((($$0189$i)) + 20|0);
  9271. $143 = HEAP32[$142>>2]|0;
  9272. $144 = ($143|0)==(0|0);
  9273. if ($144) {
  9274. break;
  9275. } else {
  9276. $146 = $143;
  9277. }
  9278. } else {
  9279. $146 = $140;
  9280. }
  9281. $145 = ((($146)) + 4|0);
  9282. $147 = HEAP32[$145>>2]|0;
  9283. $148 = $147 & -8;
  9284. $149 = (($148) - ($6))|0;
  9285. $150 = ($149>>>0)<($$0191$i>>>0);
  9286. $$$0191$i = $150 ? $149 : $$0191$i;
  9287. $$$0190$i = $150 ? $146 : $$0190$i;
  9288. $$0189$i = $146;$$0190$i = $$$0190$i;$$0191$i = $$$0191$i;
  9289. }
  9290. $151 = HEAP32[(2792)>>2]|0;
  9291. $152 = ($$0190$i>>>0)<($151>>>0);
  9292. if ($152) {
  9293. _abort();
  9294. // unreachable;
  9295. }
  9296. $153 = (($$0190$i) + ($6)|0);
  9297. $154 = ($$0190$i>>>0)<($153>>>0);
  9298. if (!($154)) {
  9299. _abort();
  9300. // unreachable;
  9301. }
  9302. $155 = ((($$0190$i)) + 24|0);
  9303. $156 = HEAP32[$155>>2]|0;
  9304. $157 = ((($$0190$i)) + 12|0);
  9305. $158 = HEAP32[$157>>2]|0;
  9306. $159 = ($158|0)==($$0190$i|0);
  9307. do {
  9308. if ($159) {
  9309. $169 = ((($$0190$i)) + 20|0);
  9310. $170 = HEAP32[$169>>2]|0;
  9311. $171 = ($170|0)==(0|0);
  9312. if ($171) {
  9313. $172 = ((($$0190$i)) + 16|0);
  9314. $173 = HEAP32[$172>>2]|0;
  9315. $174 = ($173|0)==(0|0);
  9316. if ($174) {
  9317. $$3$i = 0;
  9318. break;
  9319. } else {
  9320. $$1194$i = $173;$$1196$i = $172;
  9321. }
  9322. } else {
  9323. $$1194$i = $170;$$1196$i = $169;
  9324. }
  9325. while(1) {
  9326. $175 = ((($$1194$i)) + 20|0);
  9327. $176 = HEAP32[$175>>2]|0;
  9328. $177 = ($176|0)==(0|0);
  9329. if (!($177)) {
  9330. $$1194$i = $176;$$1196$i = $175;
  9331. continue;
  9332. }
  9333. $178 = ((($$1194$i)) + 16|0);
  9334. $179 = HEAP32[$178>>2]|0;
  9335. $180 = ($179|0)==(0|0);
  9336. if ($180) {
  9337. break;
  9338. } else {
  9339. $$1194$i = $179;$$1196$i = $178;
  9340. }
  9341. }
  9342. $181 = ($$1196$i>>>0)<($151>>>0);
  9343. if ($181) {
  9344. _abort();
  9345. // unreachable;
  9346. } else {
  9347. HEAP32[$$1196$i>>2] = 0;
  9348. $$3$i = $$1194$i;
  9349. break;
  9350. }
  9351. } else {
  9352. $160 = ((($$0190$i)) + 8|0);
  9353. $161 = HEAP32[$160>>2]|0;
  9354. $162 = ($161>>>0)<($151>>>0);
  9355. if ($162) {
  9356. _abort();
  9357. // unreachable;
  9358. }
  9359. $163 = ((($161)) + 12|0);
  9360. $164 = HEAP32[$163>>2]|0;
  9361. $165 = ($164|0)==($$0190$i|0);
  9362. if (!($165)) {
  9363. _abort();
  9364. // unreachable;
  9365. }
  9366. $166 = ((($158)) + 8|0);
  9367. $167 = HEAP32[$166>>2]|0;
  9368. $168 = ($167|0)==($$0190$i|0);
  9369. if ($168) {
  9370. HEAP32[$163>>2] = $158;
  9371. HEAP32[$166>>2] = $161;
  9372. $$3$i = $158;
  9373. break;
  9374. } else {
  9375. _abort();
  9376. // unreachable;
  9377. }
  9378. }
  9379. } while(0);
  9380. $182 = ($156|0)==(0|0);
  9381. do {
  9382. if (!($182)) {
  9383. $183 = ((($$0190$i)) + 28|0);
  9384. $184 = HEAP32[$183>>2]|0;
  9385. $185 = (3080 + ($184<<2)|0);
  9386. $186 = HEAP32[$185>>2]|0;
  9387. $187 = ($$0190$i|0)==($186|0);
  9388. if ($187) {
  9389. HEAP32[$185>>2] = $$3$i;
  9390. $cond$i = ($$3$i|0)==(0|0);
  9391. if ($cond$i) {
  9392. $188 = 1 << $184;
  9393. $189 = $188 ^ -1;
  9394. $190 = $108 & $189;
  9395. HEAP32[(2780)>>2] = $190;
  9396. break;
  9397. }
  9398. } else {
  9399. $191 = HEAP32[(2792)>>2]|0;
  9400. $192 = ($156>>>0)<($191>>>0);
  9401. if ($192) {
  9402. _abort();
  9403. // unreachable;
  9404. }
  9405. $193 = ((($156)) + 16|0);
  9406. $194 = HEAP32[$193>>2]|0;
  9407. $195 = ($194|0)==($$0190$i|0);
  9408. if ($195) {
  9409. HEAP32[$193>>2] = $$3$i;
  9410. } else {
  9411. $196 = ((($156)) + 20|0);
  9412. HEAP32[$196>>2] = $$3$i;
  9413. }
  9414. $197 = ($$3$i|0)==(0|0);
  9415. if ($197) {
  9416. break;
  9417. }
  9418. }
  9419. $198 = HEAP32[(2792)>>2]|0;
  9420. $199 = ($$3$i>>>0)<($198>>>0);
  9421. if ($199) {
  9422. _abort();
  9423. // unreachable;
  9424. }
  9425. $200 = ((($$3$i)) + 24|0);
  9426. HEAP32[$200>>2] = $156;
  9427. $201 = ((($$0190$i)) + 16|0);
  9428. $202 = HEAP32[$201>>2]|0;
  9429. $203 = ($202|0)==(0|0);
  9430. do {
  9431. if (!($203)) {
  9432. $204 = ($202>>>0)<($198>>>0);
  9433. if ($204) {
  9434. _abort();
  9435. // unreachable;
  9436. } else {
  9437. $205 = ((($$3$i)) + 16|0);
  9438. HEAP32[$205>>2] = $202;
  9439. $206 = ((($202)) + 24|0);
  9440. HEAP32[$206>>2] = $$3$i;
  9441. break;
  9442. }
  9443. }
  9444. } while(0);
  9445. $207 = ((($$0190$i)) + 20|0);
  9446. $208 = HEAP32[$207>>2]|0;
  9447. $209 = ($208|0)==(0|0);
  9448. if (!($209)) {
  9449. $210 = HEAP32[(2792)>>2]|0;
  9450. $211 = ($208>>>0)<($210>>>0);
  9451. if ($211) {
  9452. _abort();
  9453. // unreachable;
  9454. } else {
  9455. $212 = ((($$3$i)) + 20|0);
  9456. HEAP32[$212>>2] = $208;
  9457. $213 = ((($208)) + 24|0);
  9458. HEAP32[$213>>2] = $$3$i;
  9459. break;
  9460. }
  9461. }
  9462. }
  9463. } while(0);
  9464. $214 = ($$0191$i>>>0)<(16);
  9465. if ($214) {
  9466. $215 = (($$0191$i) + ($6))|0;
  9467. $216 = $215 | 3;
  9468. $217 = ((($$0190$i)) + 4|0);
  9469. HEAP32[$217>>2] = $216;
  9470. $218 = (($$0190$i) + ($215)|0);
  9471. $219 = ((($218)) + 4|0);
  9472. $220 = HEAP32[$219>>2]|0;
  9473. $221 = $220 | 1;
  9474. HEAP32[$219>>2] = $221;
  9475. } else {
  9476. $222 = $6 | 3;
  9477. $223 = ((($$0190$i)) + 4|0);
  9478. HEAP32[$223>>2] = $222;
  9479. $224 = $$0191$i | 1;
  9480. $225 = ((($153)) + 4|0);
  9481. HEAP32[$225>>2] = $224;
  9482. $226 = (($153) + ($$0191$i)|0);
  9483. HEAP32[$226>>2] = $$0191$i;
  9484. $227 = ($37|0)==(0);
  9485. if (!($227)) {
  9486. $228 = HEAP32[(2796)>>2]|0;
  9487. $229 = $37 >>> 3;
  9488. $230 = $229 << 1;
  9489. $231 = (2816 + ($230<<2)|0);
  9490. $232 = 1 << $229;
  9491. $233 = $8 & $232;
  9492. $234 = ($233|0)==(0);
  9493. if ($234) {
  9494. $235 = $8 | $232;
  9495. HEAP32[694] = $235;
  9496. $$pre$i = ((($231)) + 8|0);
  9497. $$0187$i = $231;$$pre$phi$iZ2D = $$pre$i;
  9498. } else {
  9499. $236 = ((($231)) + 8|0);
  9500. $237 = HEAP32[$236>>2]|0;
  9501. $238 = HEAP32[(2792)>>2]|0;
  9502. $239 = ($237>>>0)<($238>>>0);
  9503. if ($239) {
  9504. _abort();
  9505. // unreachable;
  9506. } else {
  9507. $$0187$i = $237;$$pre$phi$iZ2D = $236;
  9508. }
  9509. }
  9510. HEAP32[$$pre$phi$iZ2D>>2] = $228;
  9511. $240 = ((($$0187$i)) + 12|0);
  9512. HEAP32[$240>>2] = $228;
  9513. $241 = ((($228)) + 8|0);
  9514. HEAP32[$241>>2] = $$0187$i;
  9515. $242 = ((($228)) + 12|0);
  9516. HEAP32[$242>>2] = $231;
  9517. }
  9518. HEAP32[(2784)>>2] = $$0191$i;
  9519. HEAP32[(2796)>>2] = $153;
  9520. }
  9521. $243 = ((($$0190$i)) + 8|0);
  9522. $$0 = $243;
  9523. STACKTOP = sp;return ($$0|0);
  9524. }
  9525. } else {
  9526. $$0197 = $6;
  9527. }
  9528. } else {
  9529. $244 = ($0>>>0)>(4294967231);
  9530. if ($244) {
  9531. $$0197 = -1;
  9532. } else {
  9533. $245 = (($0) + 11)|0;
  9534. $246 = $245 & -8;
  9535. $247 = HEAP32[(2780)>>2]|0;
  9536. $248 = ($247|0)==(0);
  9537. if ($248) {
  9538. $$0197 = $246;
  9539. } else {
  9540. $249 = (0 - ($246))|0;
  9541. $250 = $245 >>> 8;
  9542. $251 = ($250|0)==(0);
  9543. if ($251) {
  9544. $$0356$i = 0;
  9545. } else {
  9546. $252 = ($246>>>0)>(16777215);
  9547. if ($252) {
  9548. $$0356$i = 31;
  9549. } else {
  9550. $253 = (($250) + 1048320)|0;
  9551. $254 = $253 >>> 16;
  9552. $255 = $254 & 8;
  9553. $256 = $250 << $255;
  9554. $257 = (($256) + 520192)|0;
  9555. $258 = $257 >>> 16;
  9556. $259 = $258 & 4;
  9557. $260 = $259 | $255;
  9558. $261 = $256 << $259;
  9559. $262 = (($261) + 245760)|0;
  9560. $263 = $262 >>> 16;
  9561. $264 = $263 & 2;
  9562. $265 = $260 | $264;
  9563. $266 = (14 - ($265))|0;
  9564. $267 = $261 << $264;
  9565. $268 = $267 >>> 15;
  9566. $269 = (($266) + ($268))|0;
  9567. $270 = $269 << 1;
  9568. $271 = (($269) + 7)|0;
  9569. $272 = $246 >>> $271;
  9570. $273 = $272 & 1;
  9571. $274 = $273 | $270;
  9572. $$0356$i = $274;
  9573. }
  9574. }
  9575. $275 = (3080 + ($$0356$i<<2)|0);
  9576. $276 = HEAP32[$275>>2]|0;
  9577. $277 = ($276|0)==(0|0);
  9578. L123: do {
  9579. if ($277) {
  9580. $$2353$i = 0;$$3$i201 = 0;$$3348$i = $249;
  9581. label = 86;
  9582. } else {
  9583. $278 = ($$0356$i|0)==(31);
  9584. $279 = $$0356$i >>> 1;
  9585. $280 = (25 - ($279))|0;
  9586. $281 = $278 ? 0 : $280;
  9587. $282 = $246 << $281;
  9588. $$0340$i = 0;$$0345$i = $249;$$0351$i = $276;$$0357$i = $282;$$0360$i = 0;
  9589. while(1) {
  9590. $283 = ((($$0351$i)) + 4|0);
  9591. $284 = HEAP32[$283>>2]|0;
  9592. $285 = $284 & -8;
  9593. $286 = (($285) - ($246))|0;
  9594. $287 = ($286>>>0)<($$0345$i>>>0);
  9595. if ($287) {
  9596. $288 = ($286|0)==(0);
  9597. if ($288) {
  9598. $$413$i = $$0351$i;$$434912$i = 0;$$435511$i = $$0351$i;
  9599. label = 90;
  9600. break L123;
  9601. } else {
  9602. $$1341$i = $$0351$i;$$1346$i = $286;
  9603. }
  9604. } else {
  9605. $$1341$i = $$0340$i;$$1346$i = $$0345$i;
  9606. }
  9607. $289 = ((($$0351$i)) + 20|0);
  9608. $290 = HEAP32[$289>>2]|0;
  9609. $291 = $$0357$i >>> 31;
  9610. $292 = (((($$0351$i)) + 16|0) + ($291<<2)|0);
  9611. $293 = HEAP32[$292>>2]|0;
  9612. $294 = ($290|0)==(0|0);
  9613. $295 = ($290|0)==($293|0);
  9614. $or$cond1$i = $294 | $295;
  9615. $$1361$i = $or$cond1$i ? $$0360$i : $290;
  9616. $296 = ($293|0)==(0|0);
  9617. $297 = $296&1;
  9618. $298 = $297 ^ 1;
  9619. $$0357$$i = $$0357$i << $298;
  9620. if ($296) {
  9621. $$2353$i = $$1361$i;$$3$i201 = $$1341$i;$$3348$i = $$1346$i;
  9622. label = 86;
  9623. break;
  9624. } else {
  9625. $$0340$i = $$1341$i;$$0345$i = $$1346$i;$$0351$i = $293;$$0357$i = $$0357$$i;$$0360$i = $$1361$i;
  9626. }
  9627. }
  9628. }
  9629. } while(0);
  9630. if ((label|0) == 86) {
  9631. $299 = ($$2353$i|0)==(0|0);
  9632. $300 = ($$3$i201|0)==(0|0);
  9633. $or$cond$i = $299 & $300;
  9634. if ($or$cond$i) {
  9635. $301 = 2 << $$0356$i;
  9636. $302 = (0 - ($301))|0;
  9637. $303 = $301 | $302;
  9638. $304 = $247 & $303;
  9639. $305 = ($304|0)==(0);
  9640. if ($305) {
  9641. $$0197 = $246;
  9642. break;
  9643. }
  9644. $306 = (0 - ($304))|0;
  9645. $307 = $304 & $306;
  9646. $308 = (($307) + -1)|0;
  9647. $309 = $308 >>> 12;
  9648. $310 = $309 & 16;
  9649. $311 = $308 >>> $310;
  9650. $312 = $311 >>> 5;
  9651. $313 = $312 & 8;
  9652. $314 = $313 | $310;
  9653. $315 = $311 >>> $313;
  9654. $316 = $315 >>> 2;
  9655. $317 = $316 & 4;
  9656. $318 = $314 | $317;
  9657. $319 = $315 >>> $317;
  9658. $320 = $319 >>> 1;
  9659. $321 = $320 & 2;
  9660. $322 = $318 | $321;
  9661. $323 = $319 >>> $321;
  9662. $324 = $323 >>> 1;
  9663. $325 = $324 & 1;
  9664. $326 = $322 | $325;
  9665. $327 = $323 >>> $325;
  9666. $328 = (($326) + ($327))|0;
  9667. $329 = (3080 + ($328<<2)|0);
  9668. $330 = HEAP32[$329>>2]|0;
  9669. $$4355$ph$i = $330;
  9670. } else {
  9671. $$4355$ph$i = $$2353$i;
  9672. }
  9673. $331 = ($$4355$ph$i|0)==(0|0);
  9674. if ($331) {
  9675. $$4$lcssa$i = $$3$i201;$$4349$lcssa$i = $$3348$i;
  9676. } else {
  9677. $$413$i = $$3$i201;$$434912$i = $$3348$i;$$435511$i = $$4355$ph$i;
  9678. label = 90;
  9679. }
  9680. }
  9681. if ((label|0) == 90) {
  9682. while(1) {
  9683. label = 0;
  9684. $332 = ((($$435511$i)) + 4|0);
  9685. $333 = HEAP32[$332>>2]|0;
  9686. $334 = $333 & -8;
  9687. $335 = (($334) - ($246))|0;
  9688. $336 = ($335>>>0)<($$434912$i>>>0);
  9689. $$$4349$i = $336 ? $335 : $$434912$i;
  9690. $$4355$$4$i = $336 ? $$435511$i : $$413$i;
  9691. $337 = ((($$435511$i)) + 16|0);
  9692. $338 = HEAP32[$337>>2]|0;
  9693. $339 = ($338|0)==(0|0);
  9694. if (!($339)) {
  9695. $$413$i = $$4355$$4$i;$$434912$i = $$$4349$i;$$435511$i = $338;
  9696. label = 90;
  9697. continue;
  9698. }
  9699. $340 = ((($$435511$i)) + 20|0);
  9700. $341 = HEAP32[$340>>2]|0;
  9701. $342 = ($341|0)==(0|0);
  9702. if ($342) {
  9703. $$4$lcssa$i = $$4355$$4$i;$$4349$lcssa$i = $$$4349$i;
  9704. break;
  9705. } else {
  9706. $$413$i = $$4355$$4$i;$$434912$i = $$$4349$i;$$435511$i = $341;
  9707. label = 90;
  9708. }
  9709. }
  9710. }
  9711. $343 = ($$4$lcssa$i|0)==(0|0);
  9712. if ($343) {
  9713. $$0197 = $246;
  9714. } else {
  9715. $344 = HEAP32[(2784)>>2]|0;
  9716. $345 = (($344) - ($246))|0;
  9717. $346 = ($$4349$lcssa$i>>>0)<($345>>>0);
  9718. if ($346) {
  9719. $347 = HEAP32[(2792)>>2]|0;
  9720. $348 = ($$4$lcssa$i>>>0)<($347>>>0);
  9721. if ($348) {
  9722. _abort();
  9723. // unreachable;
  9724. }
  9725. $349 = (($$4$lcssa$i) + ($246)|0);
  9726. $350 = ($$4$lcssa$i>>>0)<($349>>>0);
  9727. if (!($350)) {
  9728. _abort();
  9729. // unreachable;
  9730. }
  9731. $351 = ((($$4$lcssa$i)) + 24|0);
  9732. $352 = HEAP32[$351>>2]|0;
  9733. $353 = ((($$4$lcssa$i)) + 12|0);
  9734. $354 = HEAP32[$353>>2]|0;
  9735. $355 = ($354|0)==($$4$lcssa$i|0);
  9736. do {
  9737. if ($355) {
  9738. $365 = ((($$4$lcssa$i)) + 20|0);
  9739. $366 = HEAP32[$365>>2]|0;
  9740. $367 = ($366|0)==(0|0);
  9741. if ($367) {
  9742. $368 = ((($$4$lcssa$i)) + 16|0);
  9743. $369 = HEAP32[$368>>2]|0;
  9744. $370 = ($369|0)==(0|0);
  9745. if ($370) {
  9746. $$3370$i = 0;
  9747. break;
  9748. } else {
  9749. $$1368$i = $369;$$1372$i = $368;
  9750. }
  9751. } else {
  9752. $$1368$i = $366;$$1372$i = $365;
  9753. }
  9754. while(1) {
  9755. $371 = ((($$1368$i)) + 20|0);
  9756. $372 = HEAP32[$371>>2]|0;
  9757. $373 = ($372|0)==(0|0);
  9758. if (!($373)) {
  9759. $$1368$i = $372;$$1372$i = $371;
  9760. continue;
  9761. }
  9762. $374 = ((($$1368$i)) + 16|0);
  9763. $375 = HEAP32[$374>>2]|0;
  9764. $376 = ($375|0)==(0|0);
  9765. if ($376) {
  9766. break;
  9767. } else {
  9768. $$1368$i = $375;$$1372$i = $374;
  9769. }
  9770. }
  9771. $377 = ($$1372$i>>>0)<($347>>>0);
  9772. if ($377) {
  9773. _abort();
  9774. // unreachable;
  9775. } else {
  9776. HEAP32[$$1372$i>>2] = 0;
  9777. $$3370$i = $$1368$i;
  9778. break;
  9779. }
  9780. } else {
  9781. $356 = ((($$4$lcssa$i)) + 8|0);
  9782. $357 = HEAP32[$356>>2]|0;
  9783. $358 = ($357>>>0)<($347>>>0);
  9784. if ($358) {
  9785. _abort();
  9786. // unreachable;
  9787. }
  9788. $359 = ((($357)) + 12|0);
  9789. $360 = HEAP32[$359>>2]|0;
  9790. $361 = ($360|0)==($$4$lcssa$i|0);
  9791. if (!($361)) {
  9792. _abort();
  9793. // unreachable;
  9794. }
  9795. $362 = ((($354)) + 8|0);
  9796. $363 = HEAP32[$362>>2]|0;
  9797. $364 = ($363|0)==($$4$lcssa$i|0);
  9798. if ($364) {
  9799. HEAP32[$359>>2] = $354;
  9800. HEAP32[$362>>2] = $357;
  9801. $$3370$i = $354;
  9802. break;
  9803. } else {
  9804. _abort();
  9805. // unreachable;
  9806. }
  9807. }
  9808. } while(0);
  9809. $378 = ($352|0)==(0|0);
  9810. do {
  9811. if ($378) {
  9812. $470 = $247;
  9813. } else {
  9814. $379 = ((($$4$lcssa$i)) + 28|0);
  9815. $380 = HEAP32[$379>>2]|0;
  9816. $381 = (3080 + ($380<<2)|0);
  9817. $382 = HEAP32[$381>>2]|0;
  9818. $383 = ($$4$lcssa$i|0)==($382|0);
  9819. if ($383) {
  9820. HEAP32[$381>>2] = $$3370$i;
  9821. $cond$i204 = ($$3370$i|0)==(0|0);
  9822. if ($cond$i204) {
  9823. $384 = 1 << $380;
  9824. $385 = $384 ^ -1;
  9825. $386 = $247 & $385;
  9826. HEAP32[(2780)>>2] = $386;
  9827. $470 = $386;
  9828. break;
  9829. }
  9830. } else {
  9831. $387 = HEAP32[(2792)>>2]|0;
  9832. $388 = ($352>>>0)<($387>>>0);
  9833. if ($388) {
  9834. _abort();
  9835. // unreachable;
  9836. }
  9837. $389 = ((($352)) + 16|0);
  9838. $390 = HEAP32[$389>>2]|0;
  9839. $391 = ($390|0)==($$4$lcssa$i|0);
  9840. if ($391) {
  9841. HEAP32[$389>>2] = $$3370$i;
  9842. } else {
  9843. $392 = ((($352)) + 20|0);
  9844. HEAP32[$392>>2] = $$3370$i;
  9845. }
  9846. $393 = ($$3370$i|0)==(0|0);
  9847. if ($393) {
  9848. $470 = $247;
  9849. break;
  9850. }
  9851. }
  9852. $394 = HEAP32[(2792)>>2]|0;
  9853. $395 = ($$3370$i>>>0)<($394>>>0);
  9854. if ($395) {
  9855. _abort();
  9856. // unreachable;
  9857. }
  9858. $396 = ((($$3370$i)) + 24|0);
  9859. HEAP32[$396>>2] = $352;
  9860. $397 = ((($$4$lcssa$i)) + 16|0);
  9861. $398 = HEAP32[$397>>2]|0;
  9862. $399 = ($398|0)==(0|0);
  9863. do {
  9864. if (!($399)) {
  9865. $400 = ($398>>>0)<($394>>>0);
  9866. if ($400) {
  9867. _abort();
  9868. // unreachable;
  9869. } else {
  9870. $401 = ((($$3370$i)) + 16|0);
  9871. HEAP32[$401>>2] = $398;
  9872. $402 = ((($398)) + 24|0);
  9873. HEAP32[$402>>2] = $$3370$i;
  9874. break;
  9875. }
  9876. }
  9877. } while(0);
  9878. $403 = ((($$4$lcssa$i)) + 20|0);
  9879. $404 = HEAP32[$403>>2]|0;
  9880. $405 = ($404|0)==(0|0);
  9881. if ($405) {
  9882. $470 = $247;
  9883. } else {
  9884. $406 = HEAP32[(2792)>>2]|0;
  9885. $407 = ($404>>>0)<($406>>>0);
  9886. if ($407) {
  9887. _abort();
  9888. // unreachable;
  9889. } else {
  9890. $408 = ((($$3370$i)) + 20|0);
  9891. HEAP32[$408>>2] = $404;
  9892. $409 = ((($404)) + 24|0);
  9893. HEAP32[$409>>2] = $$3370$i;
  9894. $470 = $247;
  9895. break;
  9896. }
  9897. }
  9898. }
  9899. } while(0);
  9900. $410 = ($$4349$lcssa$i>>>0)<(16);
  9901. do {
  9902. if ($410) {
  9903. $411 = (($$4349$lcssa$i) + ($246))|0;
  9904. $412 = $411 | 3;
  9905. $413 = ((($$4$lcssa$i)) + 4|0);
  9906. HEAP32[$413>>2] = $412;
  9907. $414 = (($$4$lcssa$i) + ($411)|0);
  9908. $415 = ((($414)) + 4|0);
  9909. $416 = HEAP32[$415>>2]|0;
  9910. $417 = $416 | 1;
  9911. HEAP32[$415>>2] = $417;
  9912. } else {
  9913. $418 = $246 | 3;
  9914. $419 = ((($$4$lcssa$i)) + 4|0);
  9915. HEAP32[$419>>2] = $418;
  9916. $420 = $$4349$lcssa$i | 1;
  9917. $421 = ((($349)) + 4|0);
  9918. HEAP32[$421>>2] = $420;
  9919. $422 = (($349) + ($$4349$lcssa$i)|0);
  9920. HEAP32[$422>>2] = $$4349$lcssa$i;
  9921. $423 = $$4349$lcssa$i >>> 3;
  9922. $424 = ($$4349$lcssa$i>>>0)<(256);
  9923. if ($424) {
  9924. $425 = $423 << 1;
  9925. $426 = (2816 + ($425<<2)|0);
  9926. $427 = HEAP32[694]|0;
  9927. $428 = 1 << $423;
  9928. $429 = $427 & $428;
  9929. $430 = ($429|0)==(0);
  9930. if ($430) {
  9931. $431 = $427 | $428;
  9932. HEAP32[694] = $431;
  9933. $$pre$i205 = ((($426)) + 8|0);
  9934. $$0366$i = $426;$$pre$phi$i206Z2D = $$pre$i205;
  9935. } else {
  9936. $432 = ((($426)) + 8|0);
  9937. $433 = HEAP32[$432>>2]|0;
  9938. $434 = HEAP32[(2792)>>2]|0;
  9939. $435 = ($433>>>0)<($434>>>0);
  9940. if ($435) {
  9941. _abort();
  9942. // unreachable;
  9943. } else {
  9944. $$0366$i = $433;$$pre$phi$i206Z2D = $432;
  9945. }
  9946. }
  9947. HEAP32[$$pre$phi$i206Z2D>>2] = $349;
  9948. $436 = ((($$0366$i)) + 12|0);
  9949. HEAP32[$436>>2] = $349;
  9950. $437 = ((($349)) + 8|0);
  9951. HEAP32[$437>>2] = $$0366$i;
  9952. $438 = ((($349)) + 12|0);
  9953. HEAP32[$438>>2] = $426;
  9954. break;
  9955. }
  9956. $439 = $$4349$lcssa$i >>> 8;
  9957. $440 = ($439|0)==(0);
  9958. if ($440) {
  9959. $$0359$i = 0;
  9960. } else {
  9961. $441 = ($$4349$lcssa$i>>>0)>(16777215);
  9962. if ($441) {
  9963. $$0359$i = 31;
  9964. } else {
  9965. $442 = (($439) + 1048320)|0;
  9966. $443 = $442 >>> 16;
  9967. $444 = $443 & 8;
  9968. $445 = $439 << $444;
  9969. $446 = (($445) + 520192)|0;
  9970. $447 = $446 >>> 16;
  9971. $448 = $447 & 4;
  9972. $449 = $448 | $444;
  9973. $450 = $445 << $448;
  9974. $451 = (($450) + 245760)|0;
  9975. $452 = $451 >>> 16;
  9976. $453 = $452 & 2;
  9977. $454 = $449 | $453;
  9978. $455 = (14 - ($454))|0;
  9979. $456 = $450 << $453;
  9980. $457 = $456 >>> 15;
  9981. $458 = (($455) + ($457))|0;
  9982. $459 = $458 << 1;
  9983. $460 = (($458) + 7)|0;
  9984. $461 = $$4349$lcssa$i >>> $460;
  9985. $462 = $461 & 1;
  9986. $463 = $462 | $459;
  9987. $$0359$i = $463;
  9988. }
  9989. }
  9990. $464 = (3080 + ($$0359$i<<2)|0);
  9991. $465 = ((($349)) + 28|0);
  9992. HEAP32[$465>>2] = $$0359$i;
  9993. $466 = ((($349)) + 16|0);
  9994. $467 = ((($466)) + 4|0);
  9995. HEAP32[$467>>2] = 0;
  9996. HEAP32[$466>>2] = 0;
  9997. $468 = 1 << $$0359$i;
  9998. $469 = $470 & $468;
  9999. $471 = ($469|0)==(0);
  10000. if ($471) {
  10001. $472 = $470 | $468;
  10002. HEAP32[(2780)>>2] = $472;
  10003. HEAP32[$464>>2] = $349;
  10004. $473 = ((($349)) + 24|0);
  10005. HEAP32[$473>>2] = $464;
  10006. $474 = ((($349)) + 12|0);
  10007. HEAP32[$474>>2] = $349;
  10008. $475 = ((($349)) + 8|0);
  10009. HEAP32[$475>>2] = $349;
  10010. break;
  10011. }
  10012. $476 = HEAP32[$464>>2]|0;
  10013. $477 = ($$0359$i|0)==(31);
  10014. $478 = $$0359$i >>> 1;
  10015. $479 = (25 - ($478))|0;
  10016. $480 = $477 ? 0 : $479;
  10017. $481 = $$4349$lcssa$i << $480;
  10018. $$0342$i = $481;$$0343$i = $476;
  10019. while(1) {
  10020. $482 = ((($$0343$i)) + 4|0);
  10021. $483 = HEAP32[$482>>2]|0;
  10022. $484 = $483 & -8;
  10023. $485 = ($484|0)==($$4349$lcssa$i|0);
  10024. if ($485) {
  10025. label = 148;
  10026. break;
  10027. }
  10028. $486 = $$0342$i >>> 31;
  10029. $487 = (((($$0343$i)) + 16|0) + ($486<<2)|0);
  10030. $488 = $$0342$i << 1;
  10031. $489 = HEAP32[$487>>2]|0;
  10032. $490 = ($489|0)==(0|0);
  10033. if ($490) {
  10034. label = 145;
  10035. break;
  10036. } else {
  10037. $$0342$i = $488;$$0343$i = $489;
  10038. }
  10039. }
  10040. if ((label|0) == 145) {
  10041. $491 = HEAP32[(2792)>>2]|0;
  10042. $492 = ($487>>>0)<($491>>>0);
  10043. if ($492) {
  10044. _abort();
  10045. // unreachable;
  10046. } else {
  10047. HEAP32[$487>>2] = $349;
  10048. $493 = ((($349)) + 24|0);
  10049. HEAP32[$493>>2] = $$0343$i;
  10050. $494 = ((($349)) + 12|0);
  10051. HEAP32[$494>>2] = $349;
  10052. $495 = ((($349)) + 8|0);
  10053. HEAP32[$495>>2] = $349;
  10054. break;
  10055. }
  10056. }
  10057. else if ((label|0) == 148) {
  10058. $496 = ((($$0343$i)) + 8|0);
  10059. $497 = HEAP32[$496>>2]|0;
  10060. $498 = HEAP32[(2792)>>2]|0;
  10061. $499 = ($497>>>0)>=($498>>>0);
  10062. $not$7$i = ($$0343$i>>>0)>=($498>>>0);
  10063. $500 = $499 & $not$7$i;
  10064. if ($500) {
  10065. $501 = ((($497)) + 12|0);
  10066. HEAP32[$501>>2] = $349;
  10067. HEAP32[$496>>2] = $349;
  10068. $502 = ((($349)) + 8|0);
  10069. HEAP32[$502>>2] = $497;
  10070. $503 = ((($349)) + 12|0);
  10071. HEAP32[$503>>2] = $$0343$i;
  10072. $504 = ((($349)) + 24|0);
  10073. HEAP32[$504>>2] = 0;
  10074. break;
  10075. } else {
  10076. _abort();
  10077. // unreachable;
  10078. }
  10079. }
  10080. }
  10081. } while(0);
  10082. $505 = ((($$4$lcssa$i)) + 8|0);
  10083. $$0 = $505;
  10084. STACKTOP = sp;return ($$0|0);
  10085. } else {
  10086. $$0197 = $246;
  10087. }
  10088. }
  10089. }
  10090. }
  10091. }
  10092. } while(0);
  10093. $506 = HEAP32[(2784)>>2]|0;
  10094. $507 = ($506>>>0)<($$0197>>>0);
  10095. if (!($507)) {
  10096. $508 = (($506) - ($$0197))|0;
  10097. $509 = HEAP32[(2796)>>2]|0;
  10098. $510 = ($508>>>0)>(15);
  10099. if ($510) {
  10100. $511 = (($509) + ($$0197)|0);
  10101. HEAP32[(2796)>>2] = $511;
  10102. HEAP32[(2784)>>2] = $508;
  10103. $512 = $508 | 1;
  10104. $513 = ((($511)) + 4|0);
  10105. HEAP32[$513>>2] = $512;
  10106. $514 = (($511) + ($508)|0);
  10107. HEAP32[$514>>2] = $508;
  10108. $515 = $$0197 | 3;
  10109. $516 = ((($509)) + 4|0);
  10110. HEAP32[$516>>2] = $515;
  10111. } else {
  10112. HEAP32[(2784)>>2] = 0;
  10113. HEAP32[(2796)>>2] = 0;
  10114. $517 = $506 | 3;
  10115. $518 = ((($509)) + 4|0);
  10116. HEAP32[$518>>2] = $517;
  10117. $519 = (($509) + ($506)|0);
  10118. $520 = ((($519)) + 4|0);
  10119. $521 = HEAP32[$520>>2]|0;
  10120. $522 = $521 | 1;
  10121. HEAP32[$520>>2] = $522;
  10122. }
  10123. $523 = ((($509)) + 8|0);
  10124. $$0 = $523;
  10125. STACKTOP = sp;return ($$0|0);
  10126. }
  10127. $524 = HEAP32[(2788)>>2]|0;
  10128. $525 = ($524>>>0)>($$0197>>>0);
  10129. if ($525) {
  10130. $526 = (($524) - ($$0197))|0;
  10131. HEAP32[(2788)>>2] = $526;
  10132. $527 = HEAP32[(2800)>>2]|0;
  10133. $528 = (($527) + ($$0197)|0);
  10134. HEAP32[(2800)>>2] = $528;
  10135. $529 = $526 | 1;
  10136. $530 = ((($528)) + 4|0);
  10137. HEAP32[$530>>2] = $529;
  10138. $531 = $$0197 | 3;
  10139. $532 = ((($527)) + 4|0);
  10140. HEAP32[$532>>2] = $531;
  10141. $533 = ((($527)) + 8|0);
  10142. $$0 = $533;
  10143. STACKTOP = sp;return ($$0|0);
  10144. }
  10145. $534 = HEAP32[812]|0;
  10146. $535 = ($534|0)==(0);
  10147. if ($535) {
  10148. HEAP32[(3256)>>2] = 4096;
  10149. HEAP32[(3252)>>2] = 4096;
  10150. HEAP32[(3260)>>2] = -1;
  10151. HEAP32[(3264)>>2] = -1;
  10152. HEAP32[(3268)>>2] = 0;
  10153. HEAP32[(3220)>>2] = 0;
  10154. $536 = $1;
  10155. $537 = $536 & -16;
  10156. $538 = $537 ^ 1431655768;
  10157. HEAP32[$1>>2] = $538;
  10158. HEAP32[812] = $538;
  10159. $542 = 4096;
  10160. } else {
  10161. $$pre$i208 = HEAP32[(3256)>>2]|0;
  10162. $542 = $$pre$i208;
  10163. }
  10164. $539 = (($$0197) + 48)|0;
  10165. $540 = (($$0197) + 47)|0;
  10166. $541 = (($542) + ($540))|0;
  10167. $543 = (0 - ($542))|0;
  10168. $544 = $541 & $543;
  10169. $545 = ($544>>>0)>($$0197>>>0);
  10170. if (!($545)) {
  10171. $$0 = 0;
  10172. STACKTOP = sp;return ($$0|0);
  10173. }
  10174. $546 = HEAP32[(3216)>>2]|0;
  10175. $547 = ($546|0)==(0);
  10176. if (!($547)) {
  10177. $548 = HEAP32[(3208)>>2]|0;
  10178. $549 = (($548) + ($544))|0;
  10179. $550 = ($549>>>0)<=($548>>>0);
  10180. $551 = ($549>>>0)>($546>>>0);
  10181. $or$cond1$i210 = $550 | $551;
  10182. if ($or$cond1$i210) {
  10183. $$0 = 0;
  10184. STACKTOP = sp;return ($$0|0);
  10185. }
  10186. }
  10187. $552 = HEAP32[(3220)>>2]|0;
  10188. $553 = $552 & 4;
  10189. $554 = ($553|0)==(0);
  10190. L255: do {
  10191. if ($554) {
  10192. $555 = HEAP32[(2800)>>2]|0;
  10193. $556 = ($555|0)==(0|0);
  10194. L257: do {
  10195. if ($556) {
  10196. label = 172;
  10197. } else {
  10198. $$0$i17$i = (3224);
  10199. while(1) {
  10200. $557 = HEAP32[$$0$i17$i>>2]|0;
  10201. $558 = ($557>>>0)>($555>>>0);
  10202. if (!($558)) {
  10203. $559 = ((($$0$i17$i)) + 4|0);
  10204. $560 = HEAP32[$559>>2]|0;
  10205. $561 = (($557) + ($560)|0);
  10206. $562 = ($561>>>0)>($555>>>0);
  10207. if ($562) {
  10208. break;
  10209. }
  10210. }
  10211. $563 = ((($$0$i17$i)) + 8|0);
  10212. $564 = HEAP32[$563>>2]|0;
  10213. $565 = ($564|0)==(0|0);
  10214. if ($565) {
  10215. label = 172;
  10216. break L257;
  10217. } else {
  10218. $$0$i17$i = $564;
  10219. }
  10220. }
  10221. $588 = (($541) - ($524))|0;
  10222. $589 = $588 & $543;
  10223. $590 = ($589>>>0)<(2147483647);
  10224. if ($590) {
  10225. $591 = (_sbrk(($589|0))|0);
  10226. $592 = HEAP32[$$0$i17$i>>2]|0;
  10227. $593 = HEAP32[$559>>2]|0;
  10228. $594 = (($592) + ($593)|0);
  10229. $595 = ($591|0)==($594|0);
  10230. if ($595) {
  10231. $596 = ($591|0)==((-1)|0);
  10232. if (!($596)) {
  10233. $$723947$i = $589;$$748$i = $591;
  10234. label = 190;
  10235. break L255;
  10236. }
  10237. } else {
  10238. $$2247$ph$i = $591;$$2253$ph$i = $589;
  10239. label = 180;
  10240. }
  10241. }
  10242. }
  10243. } while(0);
  10244. do {
  10245. if ((label|0) == 172) {
  10246. $566 = (_sbrk(0)|0);
  10247. $567 = ($566|0)==((-1)|0);
  10248. if (!($567)) {
  10249. $568 = $566;
  10250. $569 = HEAP32[(3252)>>2]|0;
  10251. $570 = (($569) + -1)|0;
  10252. $571 = $570 & $568;
  10253. $572 = ($571|0)==(0);
  10254. $573 = (($570) + ($568))|0;
  10255. $574 = (0 - ($569))|0;
  10256. $575 = $573 & $574;
  10257. $576 = (($575) - ($568))|0;
  10258. $577 = $572 ? 0 : $576;
  10259. $$$i = (($577) + ($544))|0;
  10260. $578 = HEAP32[(3208)>>2]|0;
  10261. $579 = (($$$i) + ($578))|0;
  10262. $580 = ($$$i>>>0)>($$0197>>>0);
  10263. $581 = ($$$i>>>0)<(2147483647);
  10264. $or$cond$i211 = $580 & $581;
  10265. if ($or$cond$i211) {
  10266. $582 = HEAP32[(3216)>>2]|0;
  10267. $583 = ($582|0)==(0);
  10268. if (!($583)) {
  10269. $584 = ($579>>>0)<=($578>>>0);
  10270. $585 = ($579>>>0)>($582>>>0);
  10271. $or$cond2$i = $584 | $585;
  10272. if ($or$cond2$i) {
  10273. break;
  10274. }
  10275. }
  10276. $586 = (_sbrk(($$$i|0))|0);
  10277. $587 = ($586|0)==($566|0);
  10278. if ($587) {
  10279. $$723947$i = $$$i;$$748$i = $566;
  10280. label = 190;
  10281. break L255;
  10282. } else {
  10283. $$2247$ph$i = $586;$$2253$ph$i = $$$i;
  10284. label = 180;
  10285. }
  10286. }
  10287. }
  10288. }
  10289. } while(0);
  10290. L274: do {
  10291. if ((label|0) == 180) {
  10292. $597 = (0 - ($$2253$ph$i))|0;
  10293. $598 = ($$2247$ph$i|0)!=((-1)|0);
  10294. $599 = ($$2253$ph$i>>>0)<(2147483647);
  10295. $or$cond7$i = $599 & $598;
  10296. $600 = ($539>>>0)>($$2253$ph$i>>>0);
  10297. $or$cond10$i = $600 & $or$cond7$i;
  10298. do {
  10299. if ($or$cond10$i) {
  10300. $601 = HEAP32[(3256)>>2]|0;
  10301. $602 = (($540) - ($$2253$ph$i))|0;
  10302. $603 = (($602) + ($601))|0;
  10303. $604 = (0 - ($601))|0;
  10304. $605 = $603 & $604;
  10305. $606 = ($605>>>0)<(2147483647);
  10306. if ($606) {
  10307. $607 = (_sbrk(($605|0))|0);
  10308. $608 = ($607|0)==((-1)|0);
  10309. if ($608) {
  10310. (_sbrk(($597|0))|0);
  10311. break L274;
  10312. } else {
  10313. $609 = (($605) + ($$2253$ph$i))|0;
  10314. $$5256$i = $609;
  10315. break;
  10316. }
  10317. } else {
  10318. $$5256$i = $$2253$ph$i;
  10319. }
  10320. } else {
  10321. $$5256$i = $$2253$ph$i;
  10322. }
  10323. } while(0);
  10324. $610 = ($$2247$ph$i|0)==((-1)|0);
  10325. if (!($610)) {
  10326. $$723947$i = $$5256$i;$$748$i = $$2247$ph$i;
  10327. label = 190;
  10328. break L255;
  10329. }
  10330. }
  10331. } while(0);
  10332. $611 = HEAP32[(3220)>>2]|0;
  10333. $612 = $611 | 4;
  10334. HEAP32[(3220)>>2] = $612;
  10335. label = 187;
  10336. } else {
  10337. label = 187;
  10338. }
  10339. } while(0);
  10340. if ((label|0) == 187) {
  10341. $613 = ($544>>>0)<(2147483647);
  10342. if ($613) {
  10343. $614 = (_sbrk(($544|0))|0);
  10344. $615 = (_sbrk(0)|0);
  10345. $616 = ($614|0)!=((-1)|0);
  10346. $617 = ($615|0)!=((-1)|0);
  10347. $or$cond5$i = $616 & $617;
  10348. $618 = ($614>>>0)<($615>>>0);
  10349. $or$cond11$i = $618 & $or$cond5$i;
  10350. if ($or$cond11$i) {
  10351. $619 = $615;
  10352. $620 = $614;
  10353. $621 = (($619) - ($620))|0;
  10354. $622 = (($$0197) + 40)|0;
  10355. $$not$i = ($621>>>0)>($622>>>0);
  10356. if ($$not$i) {
  10357. $$723947$i = $621;$$748$i = $614;
  10358. label = 190;
  10359. }
  10360. }
  10361. }
  10362. }
  10363. if ((label|0) == 190) {
  10364. $623 = HEAP32[(3208)>>2]|0;
  10365. $624 = (($623) + ($$723947$i))|0;
  10366. HEAP32[(3208)>>2] = $624;
  10367. $625 = HEAP32[(3212)>>2]|0;
  10368. $626 = ($624>>>0)>($625>>>0);
  10369. if ($626) {
  10370. HEAP32[(3212)>>2] = $624;
  10371. }
  10372. $627 = HEAP32[(2800)>>2]|0;
  10373. $628 = ($627|0)==(0|0);
  10374. do {
  10375. if ($628) {
  10376. $629 = HEAP32[(2792)>>2]|0;
  10377. $630 = ($629|0)==(0|0);
  10378. $631 = ($$748$i>>>0)<($629>>>0);
  10379. $or$cond12$i = $630 | $631;
  10380. if ($or$cond12$i) {
  10381. HEAP32[(2792)>>2] = $$748$i;
  10382. }
  10383. HEAP32[(3224)>>2] = $$748$i;
  10384. HEAP32[(3228)>>2] = $$723947$i;
  10385. HEAP32[(3236)>>2] = 0;
  10386. $632 = HEAP32[812]|0;
  10387. HEAP32[(2812)>>2] = $632;
  10388. HEAP32[(2808)>>2] = -1;
  10389. $$01$i$i = 0;
  10390. while(1) {
  10391. $633 = $$01$i$i << 1;
  10392. $634 = (2816 + ($633<<2)|0);
  10393. $635 = ((($634)) + 12|0);
  10394. HEAP32[$635>>2] = $634;
  10395. $636 = ((($634)) + 8|0);
  10396. HEAP32[$636>>2] = $634;
  10397. $637 = (($$01$i$i) + 1)|0;
  10398. $exitcond$i$i = ($637|0)==(32);
  10399. if ($exitcond$i$i) {
  10400. break;
  10401. } else {
  10402. $$01$i$i = $637;
  10403. }
  10404. }
  10405. $638 = (($$723947$i) + -40)|0;
  10406. $639 = ((($$748$i)) + 8|0);
  10407. $640 = $639;
  10408. $641 = $640 & 7;
  10409. $642 = ($641|0)==(0);
  10410. $643 = (0 - ($640))|0;
  10411. $644 = $643 & 7;
  10412. $645 = $642 ? 0 : $644;
  10413. $646 = (($$748$i) + ($645)|0);
  10414. $647 = (($638) - ($645))|0;
  10415. HEAP32[(2800)>>2] = $646;
  10416. HEAP32[(2788)>>2] = $647;
  10417. $648 = $647 | 1;
  10418. $649 = ((($646)) + 4|0);
  10419. HEAP32[$649>>2] = $648;
  10420. $650 = (($646) + ($647)|0);
  10421. $651 = ((($650)) + 4|0);
  10422. HEAP32[$651>>2] = 40;
  10423. $652 = HEAP32[(3264)>>2]|0;
  10424. HEAP32[(2804)>>2] = $652;
  10425. } else {
  10426. $$024370$i = (3224);
  10427. while(1) {
  10428. $653 = HEAP32[$$024370$i>>2]|0;
  10429. $654 = ((($$024370$i)) + 4|0);
  10430. $655 = HEAP32[$654>>2]|0;
  10431. $656 = (($653) + ($655)|0);
  10432. $657 = ($$748$i|0)==($656|0);
  10433. if ($657) {
  10434. label = 200;
  10435. break;
  10436. }
  10437. $658 = ((($$024370$i)) + 8|0);
  10438. $659 = HEAP32[$658>>2]|0;
  10439. $660 = ($659|0)==(0|0);
  10440. if ($660) {
  10441. break;
  10442. } else {
  10443. $$024370$i = $659;
  10444. }
  10445. }
  10446. if ((label|0) == 200) {
  10447. $661 = ((($$024370$i)) + 12|0);
  10448. $662 = HEAP32[$661>>2]|0;
  10449. $663 = $662 & 8;
  10450. $664 = ($663|0)==(0);
  10451. if ($664) {
  10452. $665 = ($627>>>0)>=($653>>>0);
  10453. $666 = ($627>>>0)<($$748$i>>>0);
  10454. $or$cond50$i = $666 & $665;
  10455. if ($or$cond50$i) {
  10456. $667 = (($655) + ($$723947$i))|0;
  10457. HEAP32[$654>>2] = $667;
  10458. $668 = HEAP32[(2788)>>2]|0;
  10459. $669 = ((($627)) + 8|0);
  10460. $670 = $669;
  10461. $671 = $670 & 7;
  10462. $672 = ($671|0)==(0);
  10463. $673 = (0 - ($670))|0;
  10464. $674 = $673 & 7;
  10465. $675 = $672 ? 0 : $674;
  10466. $676 = (($627) + ($675)|0);
  10467. $677 = (($$723947$i) - ($675))|0;
  10468. $678 = (($677) + ($668))|0;
  10469. HEAP32[(2800)>>2] = $676;
  10470. HEAP32[(2788)>>2] = $678;
  10471. $679 = $678 | 1;
  10472. $680 = ((($676)) + 4|0);
  10473. HEAP32[$680>>2] = $679;
  10474. $681 = (($676) + ($678)|0);
  10475. $682 = ((($681)) + 4|0);
  10476. HEAP32[$682>>2] = 40;
  10477. $683 = HEAP32[(3264)>>2]|0;
  10478. HEAP32[(2804)>>2] = $683;
  10479. break;
  10480. }
  10481. }
  10482. }
  10483. $684 = HEAP32[(2792)>>2]|0;
  10484. $685 = ($$748$i>>>0)<($684>>>0);
  10485. if ($685) {
  10486. HEAP32[(2792)>>2] = $$748$i;
  10487. $749 = $$748$i;
  10488. } else {
  10489. $749 = $684;
  10490. }
  10491. $686 = (($$748$i) + ($$723947$i)|0);
  10492. $$124469$i = (3224);
  10493. while(1) {
  10494. $687 = HEAP32[$$124469$i>>2]|0;
  10495. $688 = ($687|0)==($686|0);
  10496. if ($688) {
  10497. label = 208;
  10498. break;
  10499. }
  10500. $689 = ((($$124469$i)) + 8|0);
  10501. $690 = HEAP32[$689>>2]|0;
  10502. $691 = ($690|0)==(0|0);
  10503. if ($691) {
  10504. $$0$i$i$i = (3224);
  10505. break;
  10506. } else {
  10507. $$124469$i = $690;
  10508. }
  10509. }
  10510. if ((label|0) == 208) {
  10511. $692 = ((($$124469$i)) + 12|0);
  10512. $693 = HEAP32[$692>>2]|0;
  10513. $694 = $693 & 8;
  10514. $695 = ($694|0)==(0);
  10515. if ($695) {
  10516. HEAP32[$$124469$i>>2] = $$748$i;
  10517. $696 = ((($$124469$i)) + 4|0);
  10518. $697 = HEAP32[$696>>2]|0;
  10519. $698 = (($697) + ($$723947$i))|0;
  10520. HEAP32[$696>>2] = $698;
  10521. $699 = ((($$748$i)) + 8|0);
  10522. $700 = $699;
  10523. $701 = $700 & 7;
  10524. $702 = ($701|0)==(0);
  10525. $703 = (0 - ($700))|0;
  10526. $704 = $703 & 7;
  10527. $705 = $702 ? 0 : $704;
  10528. $706 = (($$748$i) + ($705)|0);
  10529. $707 = ((($686)) + 8|0);
  10530. $708 = $707;
  10531. $709 = $708 & 7;
  10532. $710 = ($709|0)==(0);
  10533. $711 = (0 - ($708))|0;
  10534. $712 = $711 & 7;
  10535. $713 = $710 ? 0 : $712;
  10536. $714 = (($686) + ($713)|0);
  10537. $715 = $714;
  10538. $716 = $706;
  10539. $717 = (($715) - ($716))|0;
  10540. $718 = (($706) + ($$0197)|0);
  10541. $719 = (($717) - ($$0197))|0;
  10542. $720 = $$0197 | 3;
  10543. $721 = ((($706)) + 4|0);
  10544. HEAP32[$721>>2] = $720;
  10545. $722 = ($714|0)==($627|0);
  10546. do {
  10547. if ($722) {
  10548. $723 = HEAP32[(2788)>>2]|0;
  10549. $724 = (($723) + ($719))|0;
  10550. HEAP32[(2788)>>2] = $724;
  10551. HEAP32[(2800)>>2] = $718;
  10552. $725 = $724 | 1;
  10553. $726 = ((($718)) + 4|0);
  10554. HEAP32[$726>>2] = $725;
  10555. } else {
  10556. $727 = HEAP32[(2796)>>2]|0;
  10557. $728 = ($714|0)==($727|0);
  10558. if ($728) {
  10559. $729 = HEAP32[(2784)>>2]|0;
  10560. $730 = (($729) + ($719))|0;
  10561. HEAP32[(2784)>>2] = $730;
  10562. HEAP32[(2796)>>2] = $718;
  10563. $731 = $730 | 1;
  10564. $732 = ((($718)) + 4|0);
  10565. HEAP32[$732>>2] = $731;
  10566. $733 = (($718) + ($730)|0);
  10567. HEAP32[$733>>2] = $730;
  10568. break;
  10569. }
  10570. $734 = ((($714)) + 4|0);
  10571. $735 = HEAP32[$734>>2]|0;
  10572. $736 = $735 & 3;
  10573. $737 = ($736|0)==(1);
  10574. if ($737) {
  10575. $738 = $735 & -8;
  10576. $739 = $735 >>> 3;
  10577. $740 = ($735>>>0)<(256);
  10578. L326: do {
  10579. if ($740) {
  10580. $741 = ((($714)) + 8|0);
  10581. $742 = HEAP32[$741>>2]|0;
  10582. $743 = ((($714)) + 12|0);
  10583. $744 = HEAP32[$743>>2]|0;
  10584. $745 = $739 << 1;
  10585. $746 = (2816 + ($745<<2)|0);
  10586. $747 = ($742|0)==($746|0);
  10587. do {
  10588. if (!($747)) {
  10589. $748 = ($742>>>0)<($749>>>0);
  10590. if ($748) {
  10591. _abort();
  10592. // unreachable;
  10593. }
  10594. $750 = ((($742)) + 12|0);
  10595. $751 = HEAP32[$750>>2]|0;
  10596. $752 = ($751|0)==($714|0);
  10597. if ($752) {
  10598. break;
  10599. }
  10600. _abort();
  10601. // unreachable;
  10602. }
  10603. } while(0);
  10604. $753 = ($744|0)==($742|0);
  10605. if ($753) {
  10606. $754 = 1 << $739;
  10607. $755 = $754 ^ -1;
  10608. $756 = HEAP32[694]|0;
  10609. $757 = $756 & $755;
  10610. HEAP32[694] = $757;
  10611. break;
  10612. }
  10613. $758 = ($744|0)==($746|0);
  10614. do {
  10615. if ($758) {
  10616. $$pre9$i$i = ((($744)) + 8|0);
  10617. $$pre$phi10$i$iZ2D = $$pre9$i$i;
  10618. } else {
  10619. $759 = ($744>>>0)<($749>>>0);
  10620. if ($759) {
  10621. _abort();
  10622. // unreachable;
  10623. }
  10624. $760 = ((($744)) + 8|0);
  10625. $761 = HEAP32[$760>>2]|0;
  10626. $762 = ($761|0)==($714|0);
  10627. if ($762) {
  10628. $$pre$phi10$i$iZ2D = $760;
  10629. break;
  10630. }
  10631. _abort();
  10632. // unreachable;
  10633. }
  10634. } while(0);
  10635. $763 = ((($742)) + 12|0);
  10636. HEAP32[$763>>2] = $744;
  10637. HEAP32[$$pre$phi10$i$iZ2D>>2] = $742;
  10638. } else {
  10639. $764 = ((($714)) + 24|0);
  10640. $765 = HEAP32[$764>>2]|0;
  10641. $766 = ((($714)) + 12|0);
  10642. $767 = HEAP32[$766>>2]|0;
  10643. $768 = ($767|0)==($714|0);
  10644. do {
  10645. if ($768) {
  10646. $778 = ((($714)) + 16|0);
  10647. $779 = ((($778)) + 4|0);
  10648. $780 = HEAP32[$779>>2]|0;
  10649. $781 = ($780|0)==(0|0);
  10650. if ($781) {
  10651. $782 = HEAP32[$778>>2]|0;
  10652. $783 = ($782|0)==(0|0);
  10653. if ($783) {
  10654. $$3$i$i = 0;
  10655. break;
  10656. } else {
  10657. $$1290$i$i = $782;$$1292$i$i = $778;
  10658. }
  10659. } else {
  10660. $$1290$i$i = $780;$$1292$i$i = $779;
  10661. }
  10662. while(1) {
  10663. $784 = ((($$1290$i$i)) + 20|0);
  10664. $785 = HEAP32[$784>>2]|0;
  10665. $786 = ($785|0)==(0|0);
  10666. if (!($786)) {
  10667. $$1290$i$i = $785;$$1292$i$i = $784;
  10668. continue;
  10669. }
  10670. $787 = ((($$1290$i$i)) + 16|0);
  10671. $788 = HEAP32[$787>>2]|0;
  10672. $789 = ($788|0)==(0|0);
  10673. if ($789) {
  10674. break;
  10675. } else {
  10676. $$1290$i$i = $788;$$1292$i$i = $787;
  10677. }
  10678. }
  10679. $790 = ($$1292$i$i>>>0)<($749>>>0);
  10680. if ($790) {
  10681. _abort();
  10682. // unreachable;
  10683. } else {
  10684. HEAP32[$$1292$i$i>>2] = 0;
  10685. $$3$i$i = $$1290$i$i;
  10686. break;
  10687. }
  10688. } else {
  10689. $769 = ((($714)) + 8|0);
  10690. $770 = HEAP32[$769>>2]|0;
  10691. $771 = ($770>>>0)<($749>>>0);
  10692. if ($771) {
  10693. _abort();
  10694. // unreachable;
  10695. }
  10696. $772 = ((($770)) + 12|0);
  10697. $773 = HEAP32[$772>>2]|0;
  10698. $774 = ($773|0)==($714|0);
  10699. if (!($774)) {
  10700. _abort();
  10701. // unreachable;
  10702. }
  10703. $775 = ((($767)) + 8|0);
  10704. $776 = HEAP32[$775>>2]|0;
  10705. $777 = ($776|0)==($714|0);
  10706. if ($777) {
  10707. HEAP32[$772>>2] = $767;
  10708. HEAP32[$775>>2] = $770;
  10709. $$3$i$i = $767;
  10710. break;
  10711. } else {
  10712. _abort();
  10713. // unreachable;
  10714. }
  10715. }
  10716. } while(0);
  10717. $791 = ($765|0)==(0|0);
  10718. if ($791) {
  10719. break;
  10720. }
  10721. $792 = ((($714)) + 28|0);
  10722. $793 = HEAP32[$792>>2]|0;
  10723. $794 = (3080 + ($793<<2)|0);
  10724. $795 = HEAP32[$794>>2]|0;
  10725. $796 = ($714|0)==($795|0);
  10726. do {
  10727. if ($796) {
  10728. HEAP32[$794>>2] = $$3$i$i;
  10729. $cond$i$i = ($$3$i$i|0)==(0|0);
  10730. if (!($cond$i$i)) {
  10731. break;
  10732. }
  10733. $797 = 1 << $793;
  10734. $798 = $797 ^ -1;
  10735. $799 = HEAP32[(2780)>>2]|0;
  10736. $800 = $799 & $798;
  10737. HEAP32[(2780)>>2] = $800;
  10738. break L326;
  10739. } else {
  10740. $801 = HEAP32[(2792)>>2]|0;
  10741. $802 = ($765>>>0)<($801>>>0);
  10742. if ($802) {
  10743. _abort();
  10744. // unreachable;
  10745. }
  10746. $803 = ((($765)) + 16|0);
  10747. $804 = HEAP32[$803>>2]|0;
  10748. $805 = ($804|0)==($714|0);
  10749. if ($805) {
  10750. HEAP32[$803>>2] = $$3$i$i;
  10751. } else {
  10752. $806 = ((($765)) + 20|0);
  10753. HEAP32[$806>>2] = $$3$i$i;
  10754. }
  10755. $807 = ($$3$i$i|0)==(0|0);
  10756. if ($807) {
  10757. break L326;
  10758. }
  10759. }
  10760. } while(0);
  10761. $808 = HEAP32[(2792)>>2]|0;
  10762. $809 = ($$3$i$i>>>0)<($808>>>0);
  10763. if ($809) {
  10764. _abort();
  10765. // unreachable;
  10766. }
  10767. $810 = ((($$3$i$i)) + 24|0);
  10768. HEAP32[$810>>2] = $765;
  10769. $811 = ((($714)) + 16|0);
  10770. $812 = HEAP32[$811>>2]|0;
  10771. $813 = ($812|0)==(0|0);
  10772. do {
  10773. if (!($813)) {
  10774. $814 = ($812>>>0)<($808>>>0);
  10775. if ($814) {
  10776. _abort();
  10777. // unreachable;
  10778. } else {
  10779. $815 = ((($$3$i$i)) + 16|0);
  10780. HEAP32[$815>>2] = $812;
  10781. $816 = ((($812)) + 24|0);
  10782. HEAP32[$816>>2] = $$3$i$i;
  10783. break;
  10784. }
  10785. }
  10786. } while(0);
  10787. $817 = ((($811)) + 4|0);
  10788. $818 = HEAP32[$817>>2]|0;
  10789. $819 = ($818|0)==(0|0);
  10790. if ($819) {
  10791. break;
  10792. }
  10793. $820 = HEAP32[(2792)>>2]|0;
  10794. $821 = ($818>>>0)<($820>>>0);
  10795. if ($821) {
  10796. _abort();
  10797. // unreachable;
  10798. } else {
  10799. $822 = ((($$3$i$i)) + 20|0);
  10800. HEAP32[$822>>2] = $818;
  10801. $823 = ((($818)) + 24|0);
  10802. HEAP32[$823>>2] = $$3$i$i;
  10803. break;
  10804. }
  10805. }
  10806. } while(0);
  10807. $824 = (($714) + ($738)|0);
  10808. $825 = (($738) + ($719))|0;
  10809. $$0$i18$i = $824;$$0286$i$i = $825;
  10810. } else {
  10811. $$0$i18$i = $714;$$0286$i$i = $719;
  10812. }
  10813. $826 = ((($$0$i18$i)) + 4|0);
  10814. $827 = HEAP32[$826>>2]|0;
  10815. $828 = $827 & -2;
  10816. HEAP32[$826>>2] = $828;
  10817. $829 = $$0286$i$i | 1;
  10818. $830 = ((($718)) + 4|0);
  10819. HEAP32[$830>>2] = $829;
  10820. $831 = (($718) + ($$0286$i$i)|0);
  10821. HEAP32[$831>>2] = $$0286$i$i;
  10822. $832 = $$0286$i$i >>> 3;
  10823. $833 = ($$0286$i$i>>>0)<(256);
  10824. if ($833) {
  10825. $834 = $832 << 1;
  10826. $835 = (2816 + ($834<<2)|0);
  10827. $836 = HEAP32[694]|0;
  10828. $837 = 1 << $832;
  10829. $838 = $836 & $837;
  10830. $839 = ($838|0)==(0);
  10831. do {
  10832. if ($839) {
  10833. $840 = $836 | $837;
  10834. HEAP32[694] = $840;
  10835. $$pre$i19$i = ((($835)) + 8|0);
  10836. $$0294$i$i = $835;$$pre$phi$i20$iZ2D = $$pre$i19$i;
  10837. } else {
  10838. $841 = ((($835)) + 8|0);
  10839. $842 = HEAP32[$841>>2]|0;
  10840. $843 = HEAP32[(2792)>>2]|0;
  10841. $844 = ($842>>>0)<($843>>>0);
  10842. if (!($844)) {
  10843. $$0294$i$i = $842;$$pre$phi$i20$iZ2D = $841;
  10844. break;
  10845. }
  10846. _abort();
  10847. // unreachable;
  10848. }
  10849. } while(0);
  10850. HEAP32[$$pre$phi$i20$iZ2D>>2] = $718;
  10851. $845 = ((($$0294$i$i)) + 12|0);
  10852. HEAP32[$845>>2] = $718;
  10853. $846 = ((($718)) + 8|0);
  10854. HEAP32[$846>>2] = $$0294$i$i;
  10855. $847 = ((($718)) + 12|0);
  10856. HEAP32[$847>>2] = $835;
  10857. break;
  10858. }
  10859. $848 = $$0286$i$i >>> 8;
  10860. $849 = ($848|0)==(0);
  10861. do {
  10862. if ($849) {
  10863. $$0295$i$i = 0;
  10864. } else {
  10865. $850 = ($$0286$i$i>>>0)>(16777215);
  10866. if ($850) {
  10867. $$0295$i$i = 31;
  10868. break;
  10869. }
  10870. $851 = (($848) + 1048320)|0;
  10871. $852 = $851 >>> 16;
  10872. $853 = $852 & 8;
  10873. $854 = $848 << $853;
  10874. $855 = (($854) + 520192)|0;
  10875. $856 = $855 >>> 16;
  10876. $857 = $856 & 4;
  10877. $858 = $857 | $853;
  10878. $859 = $854 << $857;
  10879. $860 = (($859) + 245760)|0;
  10880. $861 = $860 >>> 16;
  10881. $862 = $861 & 2;
  10882. $863 = $858 | $862;
  10883. $864 = (14 - ($863))|0;
  10884. $865 = $859 << $862;
  10885. $866 = $865 >>> 15;
  10886. $867 = (($864) + ($866))|0;
  10887. $868 = $867 << 1;
  10888. $869 = (($867) + 7)|0;
  10889. $870 = $$0286$i$i >>> $869;
  10890. $871 = $870 & 1;
  10891. $872 = $871 | $868;
  10892. $$0295$i$i = $872;
  10893. }
  10894. } while(0);
  10895. $873 = (3080 + ($$0295$i$i<<2)|0);
  10896. $874 = ((($718)) + 28|0);
  10897. HEAP32[$874>>2] = $$0295$i$i;
  10898. $875 = ((($718)) + 16|0);
  10899. $876 = ((($875)) + 4|0);
  10900. HEAP32[$876>>2] = 0;
  10901. HEAP32[$875>>2] = 0;
  10902. $877 = HEAP32[(2780)>>2]|0;
  10903. $878 = 1 << $$0295$i$i;
  10904. $879 = $877 & $878;
  10905. $880 = ($879|0)==(0);
  10906. if ($880) {
  10907. $881 = $877 | $878;
  10908. HEAP32[(2780)>>2] = $881;
  10909. HEAP32[$873>>2] = $718;
  10910. $882 = ((($718)) + 24|0);
  10911. HEAP32[$882>>2] = $873;
  10912. $883 = ((($718)) + 12|0);
  10913. HEAP32[$883>>2] = $718;
  10914. $884 = ((($718)) + 8|0);
  10915. HEAP32[$884>>2] = $718;
  10916. break;
  10917. }
  10918. $885 = HEAP32[$873>>2]|0;
  10919. $886 = ($$0295$i$i|0)==(31);
  10920. $887 = $$0295$i$i >>> 1;
  10921. $888 = (25 - ($887))|0;
  10922. $889 = $886 ? 0 : $888;
  10923. $890 = $$0286$i$i << $889;
  10924. $$0287$i$i = $890;$$0288$i$i = $885;
  10925. while(1) {
  10926. $891 = ((($$0288$i$i)) + 4|0);
  10927. $892 = HEAP32[$891>>2]|0;
  10928. $893 = $892 & -8;
  10929. $894 = ($893|0)==($$0286$i$i|0);
  10930. if ($894) {
  10931. label = 278;
  10932. break;
  10933. }
  10934. $895 = $$0287$i$i >>> 31;
  10935. $896 = (((($$0288$i$i)) + 16|0) + ($895<<2)|0);
  10936. $897 = $$0287$i$i << 1;
  10937. $898 = HEAP32[$896>>2]|0;
  10938. $899 = ($898|0)==(0|0);
  10939. if ($899) {
  10940. label = 275;
  10941. break;
  10942. } else {
  10943. $$0287$i$i = $897;$$0288$i$i = $898;
  10944. }
  10945. }
  10946. if ((label|0) == 275) {
  10947. $900 = HEAP32[(2792)>>2]|0;
  10948. $901 = ($896>>>0)<($900>>>0);
  10949. if ($901) {
  10950. _abort();
  10951. // unreachable;
  10952. } else {
  10953. HEAP32[$896>>2] = $718;
  10954. $902 = ((($718)) + 24|0);
  10955. HEAP32[$902>>2] = $$0288$i$i;
  10956. $903 = ((($718)) + 12|0);
  10957. HEAP32[$903>>2] = $718;
  10958. $904 = ((($718)) + 8|0);
  10959. HEAP32[$904>>2] = $718;
  10960. break;
  10961. }
  10962. }
  10963. else if ((label|0) == 278) {
  10964. $905 = ((($$0288$i$i)) + 8|0);
  10965. $906 = HEAP32[$905>>2]|0;
  10966. $907 = HEAP32[(2792)>>2]|0;
  10967. $908 = ($906>>>0)>=($907>>>0);
  10968. $not$$i22$i = ($$0288$i$i>>>0)>=($907>>>0);
  10969. $909 = $908 & $not$$i22$i;
  10970. if ($909) {
  10971. $910 = ((($906)) + 12|0);
  10972. HEAP32[$910>>2] = $718;
  10973. HEAP32[$905>>2] = $718;
  10974. $911 = ((($718)) + 8|0);
  10975. HEAP32[$911>>2] = $906;
  10976. $912 = ((($718)) + 12|0);
  10977. HEAP32[$912>>2] = $$0288$i$i;
  10978. $913 = ((($718)) + 24|0);
  10979. HEAP32[$913>>2] = 0;
  10980. break;
  10981. } else {
  10982. _abort();
  10983. // unreachable;
  10984. }
  10985. }
  10986. }
  10987. } while(0);
  10988. $1044 = ((($706)) + 8|0);
  10989. $$0 = $1044;
  10990. STACKTOP = sp;return ($$0|0);
  10991. } else {
  10992. $$0$i$i$i = (3224);
  10993. }
  10994. }
  10995. while(1) {
  10996. $914 = HEAP32[$$0$i$i$i>>2]|0;
  10997. $915 = ($914>>>0)>($627>>>0);
  10998. if (!($915)) {
  10999. $916 = ((($$0$i$i$i)) + 4|0);
  11000. $917 = HEAP32[$916>>2]|0;
  11001. $918 = (($914) + ($917)|0);
  11002. $919 = ($918>>>0)>($627>>>0);
  11003. if ($919) {
  11004. break;
  11005. }
  11006. }
  11007. $920 = ((($$0$i$i$i)) + 8|0);
  11008. $921 = HEAP32[$920>>2]|0;
  11009. $$0$i$i$i = $921;
  11010. }
  11011. $922 = ((($918)) + -47|0);
  11012. $923 = ((($922)) + 8|0);
  11013. $924 = $923;
  11014. $925 = $924 & 7;
  11015. $926 = ($925|0)==(0);
  11016. $927 = (0 - ($924))|0;
  11017. $928 = $927 & 7;
  11018. $929 = $926 ? 0 : $928;
  11019. $930 = (($922) + ($929)|0);
  11020. $931 = ((($627)) + 16|0);
  11021. $932 = ($930>>>0)<($931>>>0);
  11022. $933 = $932 ? $627 : $930;
  11023. $934 = ((($933)) + 8|0);
  11024. $935 = ((($933)) + 24|0);
  11025. $936 = (($$723947$i) + -40)|0;
  11026. $937 = ((($$748$i)) + 8|0);
  11027. $938 = $937;
  11028. $939 = $938 & 7;
  11029. $940 = ($939|0)==(0);
  11030. $941 = (0 - ($938))|0;
  11031. $942 = $941 & 7;
  11032. $943 = $940 ? 0 : $942;
  11033. $944 = (($$748$i) + ($943)|0);
  11034. $945 = (($936) - ($943))|0;
  11035. HEAP32[(2800)>>2] = $944;
  11036. HEAP32[(2788)>>2] = $945;
  11037. $946 = $945 | 1;
  11038. $947 = ((($944)) + 4|0);
  11039. HEAP32[$947>>2] = $946;
  11040. $948 = (($944) + ($945)|0);
  11041. $949 = ((($948)) + 4|0);
  11042. HEAP32[$949>>2] = 40;
  11043. $950 = HEAP32[(3264)>>2]|0;
  11044. HEAP32[(2804)>>2] = $950;
  11045. $951 = ((($933)) + 4|0);
  11046. HEAP32[$951>>2] = 27;
  11047. ;HEAP32[$934>>2]=HEAP32[(3224)>>2]|0;HEAP32[$934+4>>2]=HEAP32[(3224)+4>>2]|0;HEAP32[$934+8>>2]=HEAP32[(3224)+8>>2]|0;HEAP32[$934+12>>2]=HEAP32[(3224)+12>>2]|0;
  11048. HEAP32[(3224)>>2] = $$748$i;
  11049. HEAP32[(3228)>>2] = $$723947$i;
  11050. HEAP32[(3236)>>2] = 0;
  11051. HEAP32[(3232)>>2] = $934;
  11052. $$0$i$i = $935;
  11053. while(1) {
  11054. $952 = ((($$0$i$i)) + 4|0);
  11055. HEAP32[$952>>2] = 7;
  11056. $953 = ((($952)) + 4|0);
  11057. $954 = ($953>>>0)<($918>>>0);
  11058. if ($954) {
  11059. $$0$i$i = $952;
  11060. } else {
  11061. break;
  11062. }
  11063. }
  11064. $955 = ($933|0)==($627|0);
  11065. if (!($955)) {
  11066. $956 = $933;
  11067. $957 = $627;
  11068. $958 = (($956) - ($957))|0;
  11069. $959 = HEAP32[$951>>2]|0;
  11070. $960 = $959 & -2;
  11071. HEAP32[$951>>2] = $960;
  11072. $961 = $958 | 1;
  11073. $962 = ((($627)) + 4|0);
  11074. HEAP32[$962>>2] = $961;
  11075. HEAP32[$933>>2] = $958;
  11076. $963 = $958 >>> 3;
  11077. $964 = ($958>>>0)<(256);
  11078. if ($964) {
  11079. $965 = $963 << 1;
  11080. $966 = (2816 + ($965<<2)|0);
  11081. $967 = HEAP32[694]|0;
  11082. $968 = 1 << $963;
  11083. $969 = $967 & $968;
  11084. $970 = ($969|0)==(0);
  11085. if ($970) {
  11086. $971 = $967 | $968;
  11087. HEAP32[694] = $971;
  11088. $$pre$i$i = ((($966)) + 8|0);
  11089. $$0211$i$i = $966;$$pre$phi$i$iZ2D = $$pre$i$i;
  11090. } else {
  11091. $972 = ((($966)) + 8|0);
  11092. $973 = HEAP32[$972>>2]|0;
  11093. $974 = HEAP32[(2792)>>2]|0;
  11094. $975 = ($973>>>0)<($974>>>0);
  11095. if ($975) {
  11096. _abort();
  11097. // unreachable;
  11098. } else {
  11099. $$0211$i$i = $973;$$pre$phi$i$iZ2D = $972;
  11100. }
  11101. }
  11102. HEAP32[$$pre$phi$i$iZ2D>>2] = $627;
  11103. $976 = ((($$0211$i$i)) + 12|0);
  11104. HEAP32[$976>>2] = $627;
  11105. $977 = ((($627)) + 8|0);
  11106. HEAP32[$977>>2] = $$0211$i$i;
  11107. $978 = ((($627)) + 12|0);
  11108. HEAP32[$978>>2] = $966;
  11109. break;
  11110. }
  11111. $979 = $958 >>> 8;
  11112. $980 = ($979|0)==(0);
  11113. if ($980) {
  11114. $$0212$i$i = 0;
  11115. } else {
  11116. $981 = ($958>>>0)>(16777215);
  11117. if ($981) {
  11118. $$0212$i$i = 31;
  11119. } else {
  11120. $982 = (($979) + 1048320)|0;
  11121. $983 = $982 >>> 16;
  11122. $984 = $983 & 8;
  11123. $985 = $979 << $984;
  11124. $986 = (($985) + 520192)|0;
  11125. $987 = $986 >>> 16;
  11126. $988 = $987 & 4;
  11127. $989 = $988 | $984;
  11128. $990 = $985 << $988;
  11129. $991 = (($990) + 245760)|0;
  11130. $992 = $991 >>> 16;
  11131. $993 = $992 & 2;
  11132. $994 = $989 | $993;
  11133. $995 = (14 - ($994))|0;
  11134. $996 = $990 << $993;
  11135. $997 = $996 >>> 15;
  11136. $998 = (($995) + ($997))|0;
  11137. $999 = $998 << 1;
  11138. $1000 = (($998) + 7)|0;
  11139. $1001 = $958 >>> $1000;
  11140. $1002 = $1001 & 1;
  11141. $1003 = $1002 | $999;
  11142. $$0212$i$i = $1003;
  11143. }
  11144. }
  11145. $1004 = (3080 + ($$0212$i$i<<2)|0);
  11146. $1005 = ((($627)) + 28|0);
  11147. HEAP32[$1005>>2] = $$0212$i$i;
  11148. $1006 = ((($627)) + 20|0);
  11149. HEAP32[$1006>>2] = 0;
  11150. HEAP32[$931>>2] = 0;
  11151. $1007 = HEAP32[(2780)>>2]|0;
  11152. $1008 = 1 << $$0212$i$i;
  11153. $1009 = $1007 & $1008;
  11154. $1010 = ($1009|0)==(0);
  11155. if ($1010) {
  11156. $1011 = $1007 | $1008;
  11157. HEAP32[(2780)>>2] = $1011;
  11158. HEAP32[$1004>>2] = $627;
  11159. $1012 = ((($627)) + 24|0);
  11160. HEAP32[$1012>>2] = $1004;
  11161. $1013 = ((($627)) + 12|0);
  11162. HEAP32[$1013>>2] = $627;
  11163. $1014 = ((($627)) + 8|0);
  11164. HEAP32[$1014>>2] = $627;
  11165. break;
  11166. }
  11167. $1015 = HEAP32[$1004>>2]|0;
  11168. $1016 = ($$0212$i$i|0)==(31);
  11169. $1017 = $$0212$i$i >>> 1;
  11170. $1018 = (25 - ($1017))|0;
  11171. $1019 = $1016 ? 0 : $1018;
  11172. $1020 = $958 << $1019;
  11173. $$0206$i$i = $1020;$$0207$i$i = $1015;
  11174. while(1) {
  11175. $1021 = ((($$0207$i$i)) + 4|0);
  11176. $1022 = HEAP32[$1021>>2]|0;
  11177. $1023 = $1022 & -8;
  11178. $1024 = ($1023|0)==($958|0);
  11179. if ($1024) {
  11180. label = 304;
  11181. break;
  11182. }
  11183. $1025 = $$0206$i$i >>> 31;
  11184. $1026 = (((($$0207$i$i)) + 16|0) + ($1025<<2)|0);
  11185. $1027 = $$0206$i$i << 1;
  11186. $1028 = HEAP32[$1026>>2]|0;
  11187. $1029 = ($1028|0)==(0|0);
  11188. if ($1029) {
  11189. label = 301;
  11190. break;
  11191. } else {
  11192. $$0206$i$i = $1027;$$0207$i$i = $1028;
  11193. }
  11194. }
  11195. if ((label|0) == 301) {
  11196. $1030 = HEAP32[(2792)>>2]|0;
  11197. $1031 = ($1026>>>0)<($1030>>>0);
  11198. if ($1031) {
  11199. _abort();
  11200. // unreachable;
  11201. } else {
  11202. HEAP32[$1026>>2] = $627;
  11203. $1032 = ((($627)) + 24|0);
  11204. HEAP32[$1032>>2] = $$0207$i$i;
  11205. $1033 = ((($627)) + 12|0);
  11206. HEAP32[$1033>>2] = $627;
  11207. $1034 = ((($627)) + 8|0);
  11208. HEAP32[$1034>>2] = $627;
  11209. break;
  11210. }
  11211. }
  11212. else if ((label|0) == 304) {
  11213. $1035 = ((($$0207$i$i)) + 8|0);
  11214. $1036 = HEAP32[$1035>>2]|0;
  11215. $1037 = HEAP32[(2792)>>2]|0;
  11216. $1038 = ($1036>>>0)>=($1037>>>0);
  11217. $not$$i$i = ($$0207$i$i>>>0)>=($1037>>>0);
  11218. $1039 = $1038 & $not$$i$i;
  11219. if ($1039) {
  11220. $1040 = ((($1036)) + 12|0);
  11221. HEAP32[$1040>>2] = $627;
  11222. HEAP32[$1035>>2] = $627;
  11223. $1041 = ((($627)) + 8|0);
  11224. HEAP32[$1041>>2] = $1036;
  11225. $1042 = ((($627)) + 12|0);
  11226. HEAP32[$1042>>2] = $$0207$i$i;
  11227. $1043 = ((($627)) + 24|0);
  11228. HEAP32[$1043>>2] = 0;
  11229. break;
  11230. } else {
  11231. _abort();
  11232. // unreachable;
  11233. }
  11234. }
  11235. }
  11236. }
  11237. } while(0);
  11238. $1045 = HEAP32[(2788)>>2]|0;
  11239. $1046 = ($1045>>>0)>($$0197>>>0);
  11240. if ($1046) {
  11241. $1047 = (($1045) - ($$0197))|0;
  11242. HEAP32[(2788)>>2] = $1047;
  11243. $1048 = HEAP32[(2800)>>2]|0;
  11244. $1049 = (($1048) + ($$0197)|0);
  11245. HEAP32[(2800)>>2] = $1049;
  11246. $1050 = $1047 | 1;
  11247. $1051 = ((($1049)) + 4|0);
  11248. HEAP32[$1051>>2] = $1050;
  11249. $1052 = $$0197 | 3;
  11250. $1053 = ((($1048)) + 4|0);
  11251. HEAP32[$1053>>2] = $1052;
  11252. $1054 = ((($1048)) + 8|0);
  11253. $$0 = $1054;
  11254. STACKTOP = sp;return ($$0|0);
  11255. }
  11256. }
  11257. $1055 = (___errno_location()|0);
  11258. HEAP32[$1055>>2] = 12;
  11259. $$0 = 0;
  11260. STACKTOP = sp;return ($$0|0);
  11261. }
  11262. function _free($0) {
  11263. $0 = $0|0;
  11264. var $$0211$i = 0, $$0211$in$i = 0, $$0381 = 0, $$0382 = 0, $$0394 = 0, $$0401 = 0, $$1 = 0, $$1380 = 0, $$1385 = 0, $$1388 = 0, $$1396 = 0, $$1400 = 0, $$2 = 0, $$3 = 0, $$3398 = 0, $$pre = 0, $$pre$phi439Z2D = 0, $$pre$phi441Z2D = 0, $$pre$phiZ2D = 0, $$pre438 = 0;
  11265. var $$pre440 = 0, $1 = 0, $10 = 0, $100 = 0, $101 = 0, $102 = 0, $103 = 0, $104 = 0, $105 = 0, $106 = 0, $107 = 0, $108 = 0, $109 = 0, $11 = 0, $110 = 0, $111 = 0, $112 = 0, $113 = 0, $114 = 0, $115 = 0;
  11266. var $116 = 0, $117 = 0, $118 = 0, $119 = 0, $12 = 0, $120 = 0, $121 = 0, $122 = 0, $123 = 0, $124 = 0, $125 = 0, $126 = 0, $127 = 0, $128 = 0, $129 = 0, $13 = 0, $130 = 0, $131 = 0, $132 = 0, $133 = 0;
  11267. var $134 = 0, $135 = 0, $136 = 0, $137 = 0, $138 = 0, $139 = 0, $14 = 0, $140 = 0, $141 = 0, $142 = 0, $143 = 0, $144 = 0, $145 = 0, $146 = 0, $147 = 0, $148 = 0, $149 = 0, $15 = 0, $150 = 0, $151 = 0;
  11268. var $152 = 0, $153 = 0, $154 = 0, $155 = 0, $156 = 0, $157 = 0, $158 = 0, $159 = 0, $16 = 0, $160 = 0, $161 = 0, $162 = 0, $163 = 0, $164 = 0, $165 = 0, $166 = 0, $167 = 0, $168 = 0, $169 = 0, $17 = 0;
  11269. var $170 = 0, $171 = 0, $172 = 0, $173 = 0, $174 = 0, $175 = 0, $176 = 0, $177 = 0, $178 = 0, $179 = 0, $18 = 0, $180 = 0, $181 = 0, $182 = 0, $183 = 0, $184 = 0, $185 = 0, $186 = 0, $187 = 0, $188 = 0;
  11270. var $189 = 0, $19 = 0, $190 = 0, $191 = 0, $192 = 0, $193 = 0, $194 = 0, $195 = 0, $196 = 0, $197 = 0, $198 = 0, $199 = 0, $2 = 0, $20 = 0, $200 = 0, $201 = 0, $202 = 0, $203 = 0, $204 = 0, $205 = 0;
  11271. var $206 = 0, $207 = 0, $208 = 0, $209 = 0, $21 = 0, $210 = 0, $211 = 0, $212 = 0, $213 = 0, $214 = 0, $215 = 0, $216 = 0, $217 = 0, $218 = 0, $219 = 0, $22 = 0, $220 = 0, $221 = 0, $222 = 0, $223 = 0;
  11272. var $224 = 0, $225 = 0, $226 = 0, $227 = 0, $228 = 0, $229 = 0, $23 = 0, $230 = 0, $231 = 0, $232 = 0, $233 = 0, $234 = 0, $235 = 0, $236 = 0, $237 = 0, $238 = 0, $239 = 0, $24 = 0, $240 = 0, $241 = 0;
  11273. var $242 = 0, $243 = 0, $244 = 0, $245 = 0, $246 = 0, $247 = 0, $248 = 0, $249 = 0, $25 = 0, $250 = 0, $251 = 0, $252 = 0, $253 = 0, $254 = 0, $255 = 0, $256 = 0, $257 = 0, $258 = 0, $259 = 0, $26 = 0;
  11274. var $260 = 0, $261 = 0, $262 = 0, $263 = 0, $264 = 0, $265 = 0, $266 = 0, $267 = 0, $268 = 0, $269 = 0, $27 = 0, $270 = 0, $271 = 0, $272 = 0, $273 = 0, $274 = 0, $275 = 0, $276 = 0, $277 = 0, $278 = 0;
  11275. var $279 = 0, $28 = 0, $280 = 0, $281 = 0, $282 = 0, $283 = 0, $284 = 0, $285 = 0, $286 = 0, $287 = 0, $288 = 0, $289 = 0, $29 = 0, $290 = 0, $291 = 0, $292 = 0, $293 = 0, $294 = 0, $295 = 0, $296 = 0;
  11276. var $297 = 0, $298 = 0, $299 = 0, $3 = 0, $30 = 0, $300 = 0, $301 = 0, $302 = 0, $303 = 0, $304 = 0, $305 = 0, $306 = 0, $307 = 0, $308 = 0, $309 = 0, $31 = 0, $310 = 0, $311 = 0, $312 = 0, $313 = 0;
  11277. var $314 = 0, $315 = 0, $316 = 0, $317 = 0, $318 = 0, $319 = 0, $32 = 0, $320 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $4 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0;
  11278. var $44 = 0, $45 = 0, $46 = 0, $47 = 0, $48 = 0, $49 = 0, $5 = 0, $50 = 0, $51 = 0, $52 = 0, $53 = 0, $54 = 0, $55 = 0, $56 = 0, $57 = 0, $58 = 0, $59 = 0, $6 = 0, $60 = 0, $61 = 0;
  11279. var $62 = 0, $63 = 0, $64 = 0, $65 = 0, $66 = 0, $67 = 0, $68 = 0, $69 = 0, $7 = 0, $70 = 0, $71 = 0, $72 = 0, $73 = 0, $74 = 0, $75 = 0, $76 = 0, $77 = 0, $78 = 0, $79 = 0, $8 = 0;
  11280. var $80 = 0, $81 = 0, $82 = 0, $83 = 0, $84 = 0, $85 = 0, $86 = 0, $87 = 0, $88 = 0, $89 = 0, $9 = 0, $90 = 0, $91 = 0, $92 = 0, $93 = 0, $94 = 0, $95 = 0, $96 = 0, $97 = 0, $98 = 0;
  11281. var $99 = 0, $cond418 = 0, $cond419 = 0, $not$ = 0, label = 0, sp = 0;
  11282. sp = STACKTOP;
  11283. $1 = ($0|0)==(0|0);
  11284. if ($1) {
  11285. return;
  11286. }
  11287. $2 = ((($0)) + -8|0);
  11288. $3 = HEAP32[(2792)>>2]|0;
  11289. $4 = ($2>>>0)<($3>>>0);
  11290. if ($4) {
  11291. _abort();
  11292. // unreachable;
  11293. }
  11294. $5 = ((($0)) + -4|0);
  11295. $6 = HEAP32[$5>>2]|0;
  11296. $7 = $6 & 3;
  11297. $8 = ($7|0)==(1);
  11298. if ($8) {
  11299. _abort();
  11300. // unreachable;
  11301. }
  11302. $9 = $6 & -8;
  11303. $10 = (($2) + ($9)|0);
  11304. $11 = $6 & 1;
  11305. $12 = ($11|0)==(0);
  11306. do {
  11307. if ($12) {
  11308. $13 = HEAP32[$2>>2]|0;
  11309. $14 = ($7|0)==(0);
  11310. if ($14) {
  11311. return;
  11312. }
  11313. $15 = (0 - ($13))|0;
  11314. $16 = (($2) + ($15)|0);
  11315. $17 = (($13) + ($9))|0;
  11316. $18 = ($16>>>0)<($3>>>0);
  11317. if ($18) {
  11318. _abort();
  11319. // unreachable;
  11320. }
  11321. $19 = HEAP32[(2796)>>2]|0;
  11322. $20 = ($16|0)==($19|0);
  11323. if ($20) {
  11324. $105 = ((($10)) + 4|0);
  11325. $106 = HEAP32[$105>>2]|0;
  11326. $107 = $106 & 3;
  11327. $108 = ($107|0)==(3);
  11328. if (!($108)) {
  11329. $$1 = $16;$$1380 = $17;
  11330. break;
  11331. }
  11332. HEAP32[(2784)>>2] = $17;
  11333. $109 = $106 & -2;
  11334. HEAP32[$105>>2] = $109;
  11335. $110 = $17 | 1;
  11336. $111 = ((($16)) + 4|0);
  11337. HEAP32[$111>>2] = $110;
  11338. $112 = (($16) + ($17)|0);
  11339. HEAP32[$112>>2] = $17;
  11340. return;
  11341. }
  11342. $21 = $13 >>> 3;
  11343. $22 = ($13>>>0)<(256);
  11344. if ($22) {
  11345. $23 = ((($16)) + 8|0);
  11346. $24 = HEAP32[$23>>2]|0;
  11347. $25 = ((($16)) + 12|0);
  11348. $26 = HEAP32[$25>>2]|0;
  11349. $27 = $21 << 1;
  11350. $28 = (2816 + ($27<<2)|0);
  11351. $29 = ($24|0)==($28|0);
  11352. if (!($29)) {
  11353. $30 = ($24>>>0)<($3>>>0);
  11354. if ($30) {
  11355. _abort();
  11356. // unreachable;
  11357. }
  11358. $31 = ((($24)) + 12|0);
  11359. $32 = HEAP32[$31>>2]|0;
  11360. $33 = ($32|0)==($16|0);
  11361. if (!($33)) {
  11362. _abort();
  11363. // unreachable;
  11364. }
  11365. }
  11366. $34 = ($26|0)==($24|0);
  11367. if ($34) {
  11368. $35 = 1 << $21;
  11369. $36 = $35 ^ -1;
  11370. $37 = HEAP32[694]|0;
  11371. $38 = $37 & $36;
  11372. HEAP32[694] = $38;
  11373. $$1 = $16;$$1380 = $17;
  11374. break;
  11375. }
  11376. $39 = ($26|0)==($28|0);
  11377. if ($39) {
  11378. $$pre440 = ((($26)) + 8|0);
  11379. $$pre$phi441Z2D = $$pre440;
  11380. } else {
  11381. $40 = ($26>>>0)<($3>>>0);
  11382. if ($40) {
  11383. _abort();
  11384. // unreachable;
  11385. }
  11386. $41 = ((($26)) + 8|0);
  11387. $42 = HEAP32[$41>>2]|0;
  11388. $43 = ($42|0)==($16|0);
  11389. if ($43) {
  11390. $$pre$phi441Z2D = $41;
  11391. } else {
  11392. _abort();
  11393. // unreachable;
  11394. }
  11395. }
  11396. $44 = ((($24)) + 12|0);
  11397. HEAP32[$44>>2] = $26;
  11398. HEAP32[$$pre$phi441Z2D>>2] = $24;
  11399. $$1 = $16;$$1380 = $17;
  11400. break;
  11401. }
  11402. $45 = ((($16)) + 24|0);
  11403. $46 = HEAP32[$45>>2]|0;
  11404. $47 = ((($16)) + 12|0);
  11405. $48 = HEAP32[$47>>2]|0;
  11406. $49 = ($48|0)==($16|0);
  11407. do {
  11408. if ($49) {
  11409. $59 = ((($16)) + 16|0);
  11410. $60 = ((($59)) + 4|0);
  11411. $61 = HEAP32[$60>>2]|0;
  11412. $62 = ($61|0)==(0|0);
  11413. if ($62) {
  11414. $63 = HEAP32[$59>>2]|0;
  11415. $64 = ($63|0)==(0|0);
  11416. if ($64) {
  11417. $$3 = 0;
  11418. break;
  11419. } else {
  11420. $$1385 = $63;$$1388 = $59;
  11421. }
  11422. } else {
  11423. $$1385 = $61;$$1388 = $60;
  11424. }
  11425. while(1) {
  11426. $65 = ((($$1385)) + 20|0);
  11427. $66 = HEAP32[$65>>2]|0;
  11428. $67 = ($66|0)==(0|0);
  11429. if (!($67)) {
  11430. $$1385 = $66;$$1388 = $65;
  11431. continue;
  11432. }
  11433. $68 = ((($$1385)) + 16|0);
  11434. $69 = HEAP32[$68>>2]|0;
  11435. $70 = ($69|0)==(0|0);
  11436. if ($70) {
  11437. break;
  11438. } else {
  11439. $$1385 = $69;$$1388 = $68;
  11440. }
  11441. }
  11442. $71 = ($$1388>>>0)<($3>>>0);
  11443. if ($71) {
  11444. _abort();
  11445. // unreachable;
  11446. } else {
  11447. HEAP32[$$1388>>2] = 0;
  11448. $$3 = $$1385;
  11449. break;
  11450. }
  11451. } else {
  11452. $50 = ((($16)) + 8|0);
  11453. $51 = HEAP32[$50>>2]|0;
  11454. $52 = ($51>>>0)<($3>>>0);
  11455. if ($52) {
  11456. _abort();
  11457. // unreachable;
  11458. }
  11459. $53 = ((($51)) + 12|0);
  11460. $54 = HEAP32[$53>>2]|0;
  11461. $55 = ($54|0)==($16|0);
  11462. if (!($55)) {
  11463. _abort();
  11464. // unreachable;
  11465. }
  11466. $56 = ((($48)) + 8|0);
  11467. $57 = HEAP32[$56>>2]|0;
  11468. $58 = ($57|0)==($16|0);
  11469. if ($58) {
  11470. HEAP32[$53>>2] = $48;
  11471. HEAP32[$56>>2] = $51;
  11472. $$3 = $48;
  11473. break;
  11474. } else {
  11475. _abort();
  11476. // unreachable;
  11477. }
  11478. }
  11479. } while(0);
  11480. $72 = ($46|0)==(0|0);
  11481. if ($72) {
  11482. $$1 = $16;$$1380 = $17;
  11483. } else {
  11484. $73 = ((($16)) + 28|0);
  11485. $74 = HEAP32[$73>>2]|0;
  11486. $75 = (3080 + ($74<<2)|0);
  11487. $76 = HEAP32[$75>>2]|0;
  11488. $77 = ($16|0)==($76|0);
  11489. if ($77) {
  11490. HEAP32[$75>>2] = $$3;
  11491. $cond418 = ($$3|0)==(0|0);
  11492. if ($cond418) {
  11493. $78 = 1 << $74;
  11494. $79 = $78 ^ -1;
  11495. $80 = HEAP32[(2780)>>2]|0;
  11496. $81 = $80 & $79;
  11497. HEAP32[(2780)>>2] = $81;
  11498. $$1 = $16;$$1380 = $17;
  11499. break;
  11500. }
  11501. } else {
  11502. $82 = HEAP32[(2792)>>2]|0;
  11503. $83 = ($46>>>0)<($82>>>0);
  11504. if ($83) {
  11505. _abort();
  11506. // unreachable;
  11507. }
  11508. $84 = ((($46)) + 16|0);
  11509. $85 = HEAP32[$84>>2]|0;
  11510. $86 = ($85|0)==($16|0);
  11511. if ($86) {
  11512. HEAP32[$84>>2] = $$3;
  11513. } else {
  11514. $87 = ((($46)) + 20|0);
  11515. HEAP32[$87>>2] = $$3;
  11516. }
  11517. $88 = ($$3|0)==(0|0);
  11518. if ($88) {
  11519. $$1 = $16;$$1380 = $17;
  11520. break;
  11521. }
  11522. }
  11523. $89 = HEAP32[(2792)>>2]|0;
  11524. $90 = ($$3>>>0)<($89>>>0);
  11525. if ($90) {
  11526. _abort();
  11527. // unreachable;
  11528. }
  11529. $91 = ((($$3)) + 24|0);
  11530. HEAP32[$91>>2] = $46;
  11531. $92 = ((($16)) + 16|0);
  11532. $93 = HEAP32[$92>>2]|0;
  11533. $94 = ($93|0)==(0|0);
  11534. do {
  11535. if (!($94)) {
  11536. $95 = ($93>>>0)<($89>>>0);
  11537. if ($95) {
  11538. _abort();
  11539. // unreachable;
  11540. } else {
  11541. $96 = ((($$3)) + 16|0);
  11542. HEAP32[$96>>2] = $93;
  11543. $97 = ((($93)) + 24|0);
  11544. HEAP32[$97>>2] = $$3;
  11545. break;
  11546. }
  11547. }
  11548. } while(0);
  11549. $98 = ((($92)) + 4|0);
  11550. $99 = HEAP32[$98>>2]|0;
  11551. $100 = ($99|0)==(0|0);
  11552. if ($100) {
  11553. $$1 = $16;$$1380 = $17;
  11554. } else {
  11555. $101 = HEAP32[(2792)>>2]|0;
  11556. $102 = ($99>>>0)<($101>>>0);
  11557. if ($102) {
  11558. _abort();
  11559. // unreachable;
  11560. } else {
  11561. $103 = ((($$3)) + 20|0);
  11562. HEAP32[$103>>2] = $99;
  11563. $104 = ((($99)) + 24|0);
  11564. HEAP32[$104>>2] = $$3;
  11565. $$1 = $16;$$1380 = $17;
  11566. break;
  11567. }
  11568. }
  11569. }
  11570. } else {
  11571. $$1 = $2;$$1380 = $9;
  11572. }
  11573. } while(0);
  11574. $113 = ($$1>>>0)<($10>>>0);
  11575. if (!($113)) {
  11576. _abort();
  11577. // unreachable;
  11578. }
  11579. $114 = ((($10)) + 4|0);
  11580. $115 = HEAP32[$114>>2]|0;
  11581. $116 = $115 & 1;
  11582. $117 = ($116|0)==(0);
  11583. if ($117) {
  11584. _abort();
  11585. // unreachable;
  11586. }
  11587. $118 = $115 & 2;
  11588. $119 = ($118|0)==(0);
  11589. if ($119) {
  11590. $120 = HEAP32[(2800)>>2]|0;
  11591. $121 = ($10|0)==($120|0);
  11592. if ($121) {
  11593. $122 = HEAP32[(2788)>>2]|0;
  11594. $123 = (($122) + ($$1380))|0;
  11595. HEAP32[(2788)>>2] = $123;
  11596. HEAP32[(2800)>>2] = $$1;
  11597. $124 = $123 | 1;
  11598. $125 = ((($$1)) + 4|0);
  11599. HEAP32[$125>>2] = $124;
  11600. $126 = HEAP32[(2796)>>2]|0;
  11601. $127 = ($$1|0)==($126|0);
  11602. if (!($127)) {
  11603. return;
  11604. }
  11605. HEAP32[(2796)>>2] = 0;
  11606. HEAP32[(2784)>>2] = 0;
  11607. return;
  11608. }
  11609. $128 = HEAP32[(2796)>>2]|0;
  11610. $129 = ($10|0)==($128|0);
  11611. if ($129) {
  11612. $130 = HEAP32[(2784)>>2]|0;
  11613. $131 = (($130) + ($$1380))|0;
  11614. HEAP32[(2784)>>2] = $131;
  11615. HEAP32[(2796)>>2] = $$1;
  11616. $132 = $131 | 1;
  11617. $133 = ((($$1)) + 4|0);
  11618. HEAP32[$133>>2] = $132;
  11619. $134 = (($$1) + ($131)|0);
  11620. HEAP32[$134>>2] = $131;
  11621. return;
  11622. }
  11623. $135 = $115 & -8;
  11624. $136 = (($135) + ($$1380))|0;
  11625. $137 = $115 >>> 3;
  11626. $138 = ($115>>>0)<(256);
  11627. do {
  11628. if ($138) {
  11629. $139 = ((($10)) + 8|0);
  11630. $140 = HEAP32[$139>>2]|0;
  11631. $141 = ((($10)) + 12|0);
  11632. $142 = HEAP32[$141>>2]|0;
  11633. $143 = $137 << 1;
  11634. $144 = (2816 + ($143<<2)|0);
  11635. $145 = ($140|0)==($144|0);
  11636. if (!($145)) {
  11637. $146 = HEAP32[(2792)>>2]|0;
  11638. $147 = ($140>>>0)<($146>>>0);
  11639. if ($147) {
  11640. _abort();
  11641. // unreachable;
  11642. }
  11643. $148 = ((($140)) + 12|0);
  11644. $149 = HEAP32[$148>>2]|0;
  11645. $150 = ($149|0)==($10|0);
  11646. if (!($150)) {
  11647. _abort();
  11648. // unreachable;
  11649. }
  11650. }
  11651. $151 = ($142|0)==($140|0);
  11652. if ($151) {
  11653. $152 = 1 << $137;
  11654. $153 = $152 ^ -1;
  11655. $154 = HEAP32[694]|0;
  11656. $155 = $154 & $153;
  11657. HEAP32[694] = $155;
  11658. break;
  11659. }
  11660. $156 = ($142|0)==($144|0);
  11661. if ($156) {
  11662. $$pre438 = ((($142)) + 8|0);
  11663. $$pre$phi439Z2D = $$pre438;
  11664. } else {
  11665. $157 = HEAP32[(2792)>>2]|0;
  11666. $158 = ($142>>>0)<($157>>>0);
  11667. if ($158) {
  11668. _abort();
  11669. // unreachable;
  11670. }
  11671. $159 = ((($142)) + 8|0);
  11672. $160 = HEAP32[$159>>2]|0;
  11673. $161 = ($160|0)==($10|0);
  11674. if ($161) {
  11675. $$pre$phi439Z2D = $159;
  11676. } else {
  11677. _abort();
  11678. // unreachable;
  11679. }
  11680. }
  11681. $162 = ((($140)) + 12|0);
  11682. HEAP32[$162>>2] = $142;
  11683. HEAP32[$$pre$phi439Z2D>>2] = $140;
  11684. } else {
  11685. $163 = ((($10)) + 24|0);
  11686. $164 = HEAP32[$163>>2]|0;
  11687. $165 = ((($10)) + 12|0);
  11688. $166 = HEAP32[$165>>2]|0;
  11689. $167 = ($166|0)==($10|0);
  11690. do {
  11691. if ($167) {
  11692. $178 = ((($10)) + 16|0);
  11693. $179 = ((($178)) + 4|0);
  11694. $180 = HEAP32[$179>>2]|0;
  11695. $181 = ($180|0)==(0|0);
  11696. if ($181) {
  11697. $182 = HEAP32[$178>>2]|0;
  11698. $183 = ($182|0)==(0|0);
  11699. if ($183) {
  11700. $$3398 = 0;
  11701. break;
  11702. } else {
  11703. $$1396 = $182;$$1400 = $178;
  11704. }
  11705. } else {
  11706. $$1396 = $180;$$1400 = $179;
  11707. }
  11708. while(1) {
  11709. $184 = ((($$1396)) + 20|0);
  11710. $185 = HEAP32[$184>>2]|0;
  11711. $186 = ($185|0)==(0|0);
  11712. if (!($186)) {
  11713. $$1396 = $185;$$1400 = $184;
  11714. continue;
  11715. }
  11716. $187 = ((($$1396)) + 16|0);
  11717. $188 = HEAP32[$187>>2]|0;
  11718. $189 = ($188|0)==(0|0);
  11719. if ($189) {
  11720. break;
  11721. } else {
  11722. $$1396 = $188;$$1400 = $187;
  11723. }
  11724. }
  11725. $190 = HEAP32[(2792)>>2]|0;
  11726. $191 = ($$1400>>>0)<($190>>>0);
  11727. if ($191) {
  11728. _abort();
  11729. // unreachable;
  11730. } else {
  11731. HEAP32[$$1400>>2] = 0;
  11732. $$3398 = $$1396;
  11733. break;
  11734. }
  11735. } else {
  11736. $168 = ((($10)) + 8|0);
  11737. $169 = HEAP32[$168>>2]|0;
  11738. $170 = HEAP32[(2792)>>2]|0;
  11739. $171 = ($169>>>0)<($170>>>0);
  11740. if ($171) {
  11741. _abort();
  11742. // unreachable;
  11743. }
  11744. $172 = ((($169)) + 12|0);
  11745. $173 = HEAP32[$172>>2]|0;
  11746. $174 = ($173|0)==($10|0);
  11747. if (!($174)) {
  11748. _abort();
  11749. // unreachable;
  11750. }
  11751. $175 = ((($166)) + 8|0);
  11752. $176 = HEAP32[$175>>2]|0;
  11753. $177 = ($176|0)==($10|0);
  11754. if ($177) {
  11755. HEAP32[$172>>2] = $166;
  11756. HEAP32[$175>>2] = $169;
  11757. $$3398 = $166;
  11758. break;
  11759. } else {
  11760. _abort();
  11761. // unreachable;
  11762. }
  11763. }
  11764. } while(0);
  11765. $192 = ($164|0)==(0|0);
  11766. if (!($192)) {
  11767. $193 = ((($10)) + 28|0);
  11768. $194 = HEAP32[$193>>2]|0;
  11769. $195 = (3080 + ($194<<2)|0);
  11770. $196 = HEAP32[$195>>2]|0;
  11771. $197 = ($10|0)==($196|0);
  11772. if ($197) {
  11773. HEAP32[$195>>2] = $$3398;
  11774. $cond419 = ($$3398|0)==(0|0);
  11775. if ($cond419) {
  11776. $198 = 1 << $194;
  11777. $199 = $198 ^ -1;
  11778. $200 = HEAP32[(2780)>>2]|0;
  11779. $201 = $200 & $199;
  11780. HEAP32[(2780)>>2] = $201;
  11781. break;
  11782. }
  11783. } else {
  11784. $202 = HEAP32[(2792)>>2]|0;
  11785. $203 = ($164>>>0)<($202>>>0);
  11786. if ($203) {
  11787. _abort();
  11788. // unreachable;
  11789. }
  11790. $204 = ((($164)) + 16|0);
  11791. $205 = HEAP32[$204>>2]|0;
  11792. $206 = ($205|0)==($10|0);
  11793. if ($206) {
  11794. HEAP32[$204>>2] = $$3398;
  11795. } else {
  11796. $207 = ((($164)) + 20|0);
  11797. HEAP32[$207>>2] = $$3398;
  11798. }
  11799. $208 = ($$3398|0)==(0|0);
  11800. if ($208) {
  11801. break;
  11802. }
  11803. }
  11804. $209 = HEAP32[(2792)>>2]|0;
  11805. $210 = ($$3398>>>0)<($209>>>0);
  11806. if ($210) {
  11807. _abort();
  11808. // unreachable;
  11809. }
  11810. $211 = ((($$3398)) + 24|0);
  11811. HEAP32[$211>>2] = $164;
  11812. $212 = ((($10)) + 16|0);
  11813. $213 = HEAP32[$212>>2]|0;
  11814. $214 = ($213|0)==(0|0);
  11815. do {
  11816. if (!($214)) {
  11817. $215 = ($213>>>0)<($209>>>0);
  11818. if ($215) {
  11819. _abort();
  11820. // unreachable;
  11821. } else {
  11822. $216 = ((($$3398)) + 16|0);
  11823. HEAP32[$216>>2] = $213;
  11824. $217 = ((($213)) + 24|0);
  11825. HEAP32[$217>>2] = $$3398;
  11826. break;
  11827. }
  11828. }
  11829. } while(0);
  11830. $218 = ((($212)) + 4|0);
  11831. $219 = HEAP32[$218>>2]|0;
  11832. $220 = ($219|0)==(0|0);
  11833. if (!($220)) {
  11834. $221 = HEAP32[(2792)>>2]|0;
  11835. $222 = ($219>>>0)<($221>>>0);
  11836. if ($222) {
  11837. _abort();
  11838. // unreachable;
  11839. } else {
  11840. $223 = ((($$3398)) + 20|0);
  11841. HEAP32[$223>>2] = $219;
  11842. $224 = ((($219)) + 24|0);
  11843. HEAP32[$224>>2] = $$3398;
  11844. break;
  11845. }
  11846. }
  11847. }
  11848. }
  11849. } while(0);
  11850. $225 = $136 | 1;
  11851. $226 = ((($$1)) + 4|0);
  11852. HEAP32[$226>>2] = $225;
  11853. $227 = (($$1) + ($136)|0);
  11854. HEAP32[$227>>2] = $136;
  11855. $228 = HEAP32[(2796)>>2]|0;
  11856. $229 = ($$1|0)==($228|0);
  11857. if ($229) {
  11858. HEAP32[(2784)>>2] = $136;
  11859. return;
  11860. } else {
  11861. $$2 = $136;
  11862. }
  11863. } else {
  11864. $230 = $115 & -2;
  11865. HEAP32[$114>>2] = $230;
  11866. $231 = $$1380 | 1;
  11867. $232 = ((($$1)) + 4|0);
  11868. HEAP32[$232>>2] = $231;
  11869. $233 = (($$1) + ($$1380)|0);
  11870. HEAP32[$233>>2] = $$1380;
  11871. $$2 = $$1380;
  11872. }
  11873. $234 = $$2 >>> 3;
  11874. $235 = ($$2>>>0)<(256);
  11875. if ($235) {
  11876. $236 = $234 << 1;
  11877. $237 = (2816 + ($236<<2)|0);
  11878. $238 = HEAP32[694]|0;
  11879. $239 = 1 << $234;
  11880. $240 = $238 & $239;
  11881. $241 = ($240|0)==(0);
  11882. if ($241) {
  11883. $242 = $238 | $239;
  11884. HEAP32[694] = $242;
  11885. $$pre = ((($237)) + 8|0);
  11886. $$0401 = $237;$$pre$phiZ2D = $$pre;
  11887. } else {
  11888. $243 = ((($237)) + 8|0);
  11889. $244 = HEAP32[$243>>2]|0;
  11890. $245 = HEAP32[(2792)>>2]|0;
  11891. $246 = ($244>>>0)<($245>>>0);
  11892. if ($246) {
  11893. _abort();
  11894. // unreachable;
  11895. } else {
  11896. $$0401 = $244;$$pre$phiZ2D = $243;
  11897. }
  11898. }
  11899. HEAP32[$$pre$phiZ2D>>2] = $$1;
  11900. $247 = ((($$0401)) + 12|0);
  11901. HEAP32[$247>>2] = $$1;
  11902. $248 = ((($$1)) + 8|0);
  11903. HEAP32[$248>>2] = $$0401;
  11904. $249 = ((($$1)) + 12|0);
  11905. HEAP32[$249>>2] = $237;
  11906. return;
  11907. }
  11908. $250 = $$2 >>> 8;
  11909. $251 = ($250|0)==(0);
  11910. if ($251) {
  11911. $$0394 = 0;
  11912. } else {
  11913. $252 = ($$2>>>0)>(16777215);
  11914. if ($252) {
  11915. $$0394 = 31;
  11916. } else {
  11917. $253 = (($250) + 1048320)|0;
  11918. $254 = $253 >>> 16;
  11919. $255 = $254 & 8;
  11920. $256 = $250 << $255;
  11921. $257 = (($256) + 520192)|0;
  11922. $258 = $257 >>> 16;
  11923. $259 = $258 & 4;
  11924. $260 = $259 | $255;
  11925. $261 = $256 << $259;
  11926. $262 = (($261) + 245760)|0;
  11927. $263 = $262 >>> 16;
  11928. $264 = $263 & 2;
  11929. $265 = $260 | $264;
  11930. $266 = (14 - ($265))|0;
  11931. $267 = $261 << $264;
  11932. $268 = $267 >>> 15;
  11933. $269 = (($266) + ($268))|0;
  11934. $270 = $269 << 1;
  11935. $271 = (($269) + 7)|0;
  11936. $272 = $$2 >>> $271;
  11937. $273 = $272 & 1;
  11938. $274 = $273 | $270;
  11939. $$0394 = $274;
  11940. }
  11941. }
  11942. $275 = (3080 + ($$0394<<2)|0);
  11943. $276 = ((($$1)) + 28|0);
  11944. HEAP32[$276>>2] = $$0394;
  11945. $277 = ((($$1)) + 16|0);
  11946. $278 = ((($$1)) + 20|0);
  11947. HEAP32[$278>>2] = 0;
  11948. HEAP32[$277>>2] = 0;
  11949. $279 = HEAP32[(2780)>>2]|0;
  11950. $280 = 1 << $$0394;
  11951. $281 = $279 & $280;
  11952. $282 = ($281|0)==(0);
  11953. do {
  11954. if ($282) {
  11955. $283 = $279 | $280;
  11956. HEAP32[(2780)>>2] = $283;
  11957. HEAP32[$275>>2] = $$1;
  11958. $284 = ((($$1)) + 24|0);
  11959. HEAP32[$284>>2] = $275;
  11960. $285 = ((($$1)) + 12|0);
  11961. HEAP32[$285>>2] = $$1;
  11962. $286 = ((($$1)) + 8|0);
  11963. HEAP32[$286>>2] = $$1;
  11964. } else {
  11965. $287 = HEAP32[$275>>2]|0;
  11966. $288 = ($$0394|0)==(31);
  11967. $289 = $$0394 >>> 1;
  11968. $290 = (25 - ($289))|0;
  11969. $291 = $288 ? 0 : $290;
  11970. $292 = $$2 << $291;
  11971. $$0381 = $292;$$0382 = $287;
  11972. while(1) {
  11973. $293 = ((($$0382)) + 4|0);
  11974. $294 = HEAP32[$293>>2]|0;
  11975. $295 = $294 & -8;
  11976. $296 = ($295|0)==($$2|0);
  11977. if ($296) {
  11978. label = 130;
  11979. break;
  11980. }
  11981. $297 = $$0381 >>> 31;
  11982. $298 = (((($$0382)) + 16|0) + ($297<<2)|0);
  11983. $299 = $$0381 << 1;
  11984. $300 = HEAP32[$298>>2]|0;
  11985. $301 = ($300|0)==(0|0);
  11986. if ($301) {
  11987. label = 127;
  11988. break;
  11989. } else {
  11990. $$0381 = $299;$$0382 = $300;
  11991. }
  11992. }
  11993. if ((label|0) == 127) {
  11994. $302 = HEAP32[(2792)>>2]|0;
  11995. $303 = ($298>>>0)<($302>>>0);
  11996. if ($303) {
  11997. _abort();
  11998. // unreachable;
  11999. } else {
  12000. HEAP32[$298>>2] = $$1;
  12001. $304 = ((($$1)) + 24|0);
  12002. HEAP32[$304>>2] = $$0382;
  12003. $305 = ((($$1)) + 12|0);
  12004. HEAP32[$305>>2] = $$1;
  12005. $306 = ((($$1)) + 8|0);
  12006. HEAP32[$306>>2] = $$1;
  12007. break;
  12008. }
  12009. }
  12010. else if ((label|0) == 130) {
  12011. $307 = ((($$0382)) + 8|0);
  12012. $308 = HEAP32[$307>>2]|0;
  12013. $309 = HEAP32[(2792)>>2]|0;
  12014. $310 = ($308>>>0)>=($309>>>0);
  12015. $not$ = ($$0382>>>0)>=($309>>>0);
  12016. $311 = $310 & $not$;
  12017. if ($311) {
  12018. $312 = ((($308)) + 12|0);
  12019. HEAP32[$312>>2] = $$1;
  12020. HEAP32[$307>>2] = $$1;
  12021. $313 = ((($$1)) + 8|0);
  12022. HEAP32[$313>>2] = $308;
  12023. $314 = ((($$1)) + 12|0);
  12024. HEAP32[$314>>2] = $$0382;
  12025. $315 = ((($$1)) + 24|0);
  12026. HEAP32[$315>>2] = 0;
  12027. break;
  12028. } else {
  12029. _abort();
  12030. // unreachable;
  12031. }
  12032. }
  12033. }
  12034. } while(0);
  12035. $316 = HEAP32[(2808)>>2]|0;
  12036. $317 = (($316) + -1)|0;
  12037. HEAP32[(2808)>>2] = $317;
  12038. $318 = ($317|0)==(0);
  12039. if ($318) {
  12040. $$0211$in$i = (3232);
  12041. } else {
  12042. return;
  12043. }
  12044. while(1) {
  12045. $$0211$i = HEAP32[$$0211$in$i>>2]|0;
  12046. $319 = ($$0211$i|0)==(0|0);
  12047. $320 = ((($$0211$i)) + 8|0);
  12048. if ($319) {
  12049. break;
  12050. } else {
  12051. $$0211$in$i = $320;
  12052. }
  12053. }
  12054. HEAP32[(2808)>>2] = -1;
  12055. return;
  12056. }
  12057. function runPostSets() {
  12058. }
  12059. function _i64Subtract(a, b, c, d) {
  12060. a = a|0; b = b|0; c = c|0; d = d|0;
  12061. var l = 0, h = 0;
  12062. l = (a - c)>>>0;
  12063. h = (b - d)>>>0;
  12064. h = (b - d - (((c>>>0) > (a>>>0))|0))>>>0; // Borrow one from high word to low word on underflow.
  12065. return ((tempRet0 = h,l|0)|0);
  12066. }
  12067. function _i64Add(a, b, c, d) {
  12068. /*
  12069. x = a + b*2^32
  12070. y = c + d*2^32
  12071. result = l + h*2^32
  12072. */
  12073. a = a|0; b = b|0; c = c|0; d = d|0;
  12074. var l = 0, h = 0;
  12075. l = (a + c)>>>0;
  12076. h = (b + d + (((l>>>0) < (a>>>0))|0))>>>0; // Add carry from low word to high word on overflow.
  12077. return ((tempRet0 = h,l|0)|0);
  12078. }
  12079. function _memset(ptr, value, num) {
  12080. ptr = ptr|0; value = value|0; num = num|0;
  12081. var stop = 0, value4 = 0, stop4 = 0, unaligned = 0;
  12082. stop = (ptr + num)|0;
  12083. if ((num|0) >= 20) {
  12084. // This is unaligned, but quite large, so work hard to get to aligned settings
  12085. value = value & 0xff;
  12086. unaligned = ptr & 3;
  12087. value4 = value | (value << 8) | (value << 16) | (value << 24);
  12088. stop4 = stop & ~3;
  12089. if (unaligned) {
  12090. unaligned = (ptr + 4 - unaligned)|0;
  12091. while ((ptr|0) < (unaligned|0)) { // no need to check for stop, since we have large num
  12092. HEAP8[((ptr)>>0)]=value;
  12093. ptr = (ptr+1)|0;
  12094. }
  12095. }
  12096. while ((ptr|0) < (stop4|0)) {
  12097. HEAP32[((ptr)>>2)]=value4;
  12098. ptr = (ptr+4)|0;
  12099. }
  12100. }
  12101. while ((ptr|0) < (stop|0)) {
  12102. HEAP8[((ptr)>>0)]=value;
  12103. ptr = (ptr+1)|0;
  12104. }
  12105. return (ptr-num)|0;
  12106. }
  12107. function _bitshift64Lshr(low, high, bits) {
  12108. low = low|0; high = high|0; bits = bits|0;
  12109. var ander = 0;
  12110. if ((bits|0) < 32) {
  12111. ander = ((1 << bits) - 1)|0;
  12112. tempRet0 = high >>> bits;
  12113. return (low >>> bits) | ((high&ander) << (32 - bits));
  12114. }
  12115. tempRet0 = 0;
  12116. return (high >>> (bits - 32))|0;
  12117. }
  12118. function _bitshift64Shl(low, high, bits) {
  12119. low = low|0; high = high|0; bits = bits|0;
  12120. var ander = 0;
  12121. if ((bits|0) < 32) {
  12122. ander = ((1 << bits) - 1)|0;
  12123. tempRet0 = (high << bits) | ((low&(ander << (32 - bits))) >>> (32 - bits));
  12124. return low << bits;
  12125. }
  12126. tempRet0 = low << (bits - 32);
  12127. return 0;
  12128. }
  12129. function _llvm_cttz_i32(x) {
  12130. x = x|0;
  12131. var ret = 0;
  12132. ret = ((HEAP8[(((cttz_i8)+(x & 0xff))>>0)])|0);
  12133. if ((ret|0) < 8) return ret|0;
  12134. ret = ((HEAP8[(((cttz_i8)+((x >> 8)&0xff))>>0)])|0);
  12135. if ((ret|0) < 8) return (ret + 8)|0;
  12136. ret = ((HEAP8[(((cttz_i8)+((x >> 16)&0xff))>>0)])|0);
  12137. if ((ret|0) < 8) return (ret + 16)|0;
  12138. return (((HEAP8[(((cttz_i8)+(x >>> 24))>>0)])|0) + 24)|0;
  12139. }
  12140. function ___udivmoddi4($a$0, $a$1, $b$0, $b$1, $rem) {
  12141. $a$0 = $a$0 | 0;
  12142. $a$1 = $a$1 | 0;
  12143. $b$0 = $b$0 | 0;
  12144. $b$1 = $b$1 | 0;
  12145. $rem = $rem | 0;
  12146. var $n_sroa_0_0_extract_trunc = 0, $n_sroa_1_4_extract_shift$0 = 0, $n_sroa_1_4_extract_trunc = 0, $d_sroa_0_0_extract_trunc = 0, $d_sroa_1_4_extract_shift$0 = 0, $d_sroa_1_4_extract_trunc = 0, $4 = 0, $17 = 0, $37 = 0, $49 = 0, $51 = 0, $57 = 0, $58 = 0, $66 = 0, $78 = 0, $86 = 0, $88 = 0, $89 = 0, $91 = 0, $92 = 0, $95 = 0, $105 = 0, $117 = 0, $119 = 0, $125 = 0, $126 = 0, $130 = 0, $q_sroa_1_1_ph = 0, $q_sroa_0_1_ph = 0, $r_sroa_1_1_ph = 0, $r_sroa_0_1_ph = 0, $sr_1_ph = 0, $d_sroa_0_0_insert_insert99$0 = 0, $d_sroa_0_0_insert_insert99$1 = 0, $137$0 = 0, $137$1 = 0, $carry_0203 = 0, $sr_1202 = 0, $r_sroa_0_1201 = 0, $r_sroa_1_1200 = 0, $q_sroa_0_1199 = 0, $q_sroa_1_1198 = 0, $147 = 0, $149 = 0, $r_sroa_0_0_insert_insert42$0 = 0, $r_sroa_0_0_insert_insert42$1 = 0, $150$1 = 0, $151$0 = 0, $152 = 0, $154$0 = 0, $r_sroa_0_0_extract_trunc = 0, $r_sroa_1_4_extract_trunc = 0, $155 = 0, $carry_0_lcssa$0 = 0, $carry_0_lcssa$1 = 0, $r_sroa_0_1_lcssa = 0, $r_sroa_1_1_lcssa = 0, $q_sroa_0_1_lcssa = 0, $q_sroa_1_1_lcssa = 0, $q_sroa_0_0_insert_ext75$0 = 0, $q_sroa_0_0_insert_ext75$1 = 0, $q_sroa_0_0_insert_insert77$1 = 0, $_0$0 = 0, $_0$1 = 0;
  12147. $n_sroa_0_0_extract_trunc = $a$0;
  12148. $n_sroa_1_4_extract_shift$0 = $a$1;
  12149. $n_sroa_1_4_extract_trunc = $n_sroa_1_4_extract_shift$0;
  12150. $d_sroa_0_0_extract_trunc = $b$0;
  12151. $d_sroa_1_4_extract_shift$0 = $b$1;
  12152. $d_sroa_1_4_extract_trunc = $d_sroa_1_4_extract_shift$0;
  12153. if (($n_sroa_1_4_extract_trunc | 0) == 0) {
  12154. $4 = ($rem | 0) != 0;
  12155. if (($d_sroa_1_4_extract_trunc | 0) == 0) {
  12156. if ($4) {
  12157. HEAP32[$rem >> 2] = ($n_sroa_0_0_extract_trunc >>> 0) % ($d_sroa_0_0_extract_trunc >>> 0);
  12158. HEAP32[$rem + 4 >> 2] = 0;
  12159. }
  12160. $_0$1 = 0;
  12161. $_0$0 = ($n_sroa_0_0_extract_trunc >>> 0) / ($d_sroa_0_0_extract_trunc >>> 0) >>> 0;
  12162. return (tempRet0 = $_0$1, $_0$0) | 0;
  12163. } else {
  12164. if (!$4) {
  12165. $_0$1 = 0;
  12166. $_0$0 = 0;
  12167. return (tempRet0 = $_0$1, $_0$0) | 0;
  12168. }
  12169. HEAP32[$rem >> 2] = $a$0 & -1;
  12170. HEAP32[$rem + 4 >> 2] = $a$1 & 0;
  12171. $_0$1 = 0;
  12172. $_0$0 = 0;
  12173. return (tempRet0 = $_0$1, $_0$0) | 0;
  12174. }
  12175. }
  12176. $17 = ($d_sroa_1_4_extract_trunc | 0) == 0;
  12177. do {
  12178. if (($d_sroa_0_0_extract_trunc | 0) == 0) {
  12179. if ($17) {
  12180. if (($rem | 0) != 0) {
  12181. HEAP32[$rem >> 2] = ($n_sroa_1_4_extract_trunc >>> 0) % ($d_sroa_0_0_extract_trunc >>> 0);
  12182. HEAP32[$rem + 4 >> 2] = 0;
  12183. }
  12184. $_0$1 = 0;
  12185. $_0$0 = ($n_sroa_1_4_extract_trunc >>> 0) / ($d_sroa_0_0_extract_trunc >>> 0) >>> 0;
  12186. return (tempRet0 = $_0$1, $_0$0) | 0;
  12187. }
  12188. if (($n_sroa_0_0_extract_trunc | 0) == 0) {
  12189. if (($rem | 0) != 0) {
  12190. HEAP32[$rem >> 2] = 0;
  12191. HEAP32[$rem + 4 >> 2] = ($n_sroa_1_4_extract_trunc >>> 0) % ($d_sroa_1_4_extract_trunc >>> 0);
  12192. }
  12193. $_0$1 = 0;
  12194. $_0$0 = ($n_sroa_1_4_extract_trunc >>> 0) / ($d_sroa_1_4_extract_trunc >>> 0) >>> 0;
  12195. return (tempRet0 = $_0$1, $_0$0) | 0;
  12196. }
  12197. $37 = $d_sroa_1_4_extract_trunc - 1 | 0;
  12198. if (($37 & $d_sroa_1_4_extract_trunc | 0) == 0) {
  12199. if (($rem | 0) != 0) {
  12200. HEAP32[$rem >> 2] = 0 | $a$0 & -1;
  12201. HEAP32[$rem + 4 >> 2] = $37 & $n_sroa_1_4_extract_trunc | $a$1 & 0;
  12202. }
  12203. $_0$1 = 0;
  12204. $_0$0 = $n_sroa_1_4_extract_trunc >>> ((_llvm_cttz_i32($d_sroa_1_4_extract_trunc | 0) | 0) >>> 0);
  12205. return (tempRet0 = $_0$1, $_0$0) | 0;
  12206. }
  12207. $49 = Math_clz32($d_sroa_1_4_extract_trunc | 0) | 0;
  12208. $51 = $49 - (Math_clz32($n_sroa_1_4_extract_trunc | 0) | 0) | 0;
  12209. if ($51 >>> 0 <= 30) {
  12210. $57 = $51 + 1 | 0;
  12211. $58 = 31 - $51 | 0;
  12212. $sr_1_ph = $57;
  12213. $r_sroa_0_1_ph = $n_sroa_1_4_extract_trunc << $58 | $n_sroa_0_0_extract_trunc >>> ($57 >>> 0);
  12214. $r_sroa_1_1_ph = $n_sroa_1_4_extract_trunc >>> ($57 >>> 0);
  12215. $q_sroa_0_1_ph = 0;
  12216. $q_sroa_1_1_ph = $n_sroa_0_0_extract_trunc << $58;
  12217. break;
  12218. }
  12219. if (($rem | 0) == 0) {
  12220. $_0$1 = 0;
  12221. $_0$0 = 0;
  12222. return (tempRet0 = $_0$1, $_0$0) | 0;
  12223. }
  12224. HEAP32[$rem >> 2] = 0 | $a$0 & -1;
  12225. HEAP32[$rem + 4 >> 2] = $n_sroa_1_4_extract_shift$0 | $a$1 & 0;
  12226. $_0$1 = 0;
  12227. $_0$0 = 0;
  12228. return (tempRet0 = $_0$1, $_0$0) | 0;
  12229. } else {
  12230. if (!$17) {
  12231. $117 = Math_clz32($d_sroa_1_4_extract_trunc | 0) | 0;
  12232. $119 = $117 - (Math_clz32($n_sroa_1_4_extract_trunc | 0) | 0) | 0;
  12233. if ($119 >>> 0 <= 31) {
  12234. $125 = $119 + 1 | 0;
  12235. $126 = 31 - $119 | 0;
  12236. $130 = $119 - 31 >> 31;
  12237. $sr_1_ph = $125;
  12238. $r_sroa_0_1_ph = $n_sroa_0_0_extract_trunc >>> ($125 >>> 0) & $130 | $n_sroa_1_4_extract_trunc << $126;
  12239. $r_sroa_1_1_ph = $n_sroa_1_4_extract_trunc >>> ($125 >>> 0) & $130;
  12240. $q_sroa_0_1_ph = 0;
  12241. $q_sroa_1_1_ph = $n_sroa_0_0_extract_trunc << $126;
  12242. break;
  12243. }
  12244. if (($rem | 0) == 0) {
  12245. $_0$1 = 0;
  12246. $_0$0 = 0;
  12247. return (tempRet0 = $_0$1, $_0$0) | 0;
  12248. }
  12249. HEAP32[$rem >> 2] = 0 | $a$0 & -1;
  12250. HEAP32[$rem + 4 >> 2] = $n_sroa_1_4_extract_shift$0 | $a$1 & 0;
  12251. $_0$1 = 0;
  12252. $_0$0 = 0;
  12253. return (tempRet0 = $_0$1, $_0$0) | 0;
  12254. }
  12255. $66 = $d_sroa_0_0_extract_trunc - 1 | 0;
  12256. if (($66 & $d_sroa_0_0_extract_trunc | 0) != 0) {
  12257. $86 = (Math_clz32($d_sroa_0_0_extract_trunc | 0) | 0) + 33 | 0;
  12258. $88 = $86 - (Math_clz32($n_sroa_1_4_extract_trunc | 0) | 0) | 0;
  12259. $89 = 64 - $88 | 0;
  12260. $91 = 32 - $88 | 0;
  12261. $92 = $91 >> 31;
  12262. $95 = $88 - 32 | 0;
  12263. $105 = $95 >> 31;
  12264. $sr_1_ph = $88;
  12265. $r_sroa_0_1_ph = $91 - 1 >> 31 & $n_sroa_1_4_extract_trunc >>> ($95 >>> 0) | ($n_sroa_1_4_extract_trunc << $91 | $n_sroa_0_0_extract_trunc >>> ($88 >>> 0)) & $105;
  12266. $r_sroa_1_1_ph = $105 & $n_sroa_1_4_extract_trunc >>> ($88 >>> 0);
  12267. $q_sroa_0_1_ph = $n_sroa_0_0_extract_trunc << $89 & $92;
  12268. $q_sroa_1_1_ph = ($n_sroa_1_4_extract_trunc << $89 | $n_sroa_0_0_extract_trunc >>> ($95 >>> 0)) & $92 | $n_sroa_0_0_extract_trunc << $91 & $88 - 33 >> 31;
  12269. break;
  12270. }
  12271. if (($rem | 0) != 0) {
  12272. HEAP32[$rem >> 2] = $66 & $n_sroa_0_0_extract_trunc;
  12273. HEAP32[$rem + 4 >> 2] = 0;
  12274. }
  12275. if (($d_sroa_0_0_extract_trunc | 0) == 1) {
  12276. $_0$1 = $n_sroa_1_4_extract_shift$0 | $a$1 & 0;
  12277. $_0$0 = 0 | $a$0 & -1;
  12278. return (tempRet0 = $_0$1, $_0$0) | 0;
  12279. } else {
  12280. $78 = _llvm_cttz_i32($d_sroa_0_0_extract_trunc | 0) | 0;
  12281. $_0$1 = 0 | $n_sroa_1_4_extract_trunc >>> ($78 >>> 0);
  12282. $_0$0 = $n_sroa_1_4_extract_trunc << 32 - $78 | $n_sroa_0_0_extract_trunc >>> ($78 >>> 0) | 0;
  12283. return (tempRet0 = $_0$1, $_0$0) | 0;
  12284. }
  12285. }
  12286. } while (0);
  12287. if (($sr_1_ph | 0) == 0) {
  12288. $q_sroa_1_1_lcssa = $q_sroa_1_1_ph;
  12289. $q_sroa_0_1_lcssa = $q_sroa_0_1_ph;
  12290. $r_sroa_1_1_lcssa = $r_sroa_1_1_ph;
  12291. $r_sroa_0_1_lcssa = $r_sroa_0_1_ph;
  12292. $carry_0_lcssa$1 = 0;
  12293. $carry_0_lcssa$0 = 0;
  12294. } else {
  12295. $d_sroa_0_0_insert_insert99$0 = 0 | $b$0 & -1;
  12296. $d_sroa_0_0_insert_insert99$1 = $d_sroa_1_4_extract_shift$0 | $b$1 & 0;
  12297. $137$0 = _i64Add($d_sroa_0_0_insert_insert99$0 | 0, $d_sroa_0_0_insert_insert99$1 | 0, -1, -1) | 0;
  12298. $137$1 = tempRet0;
  12299. $q_sroa_1_1198 = $q_sroa_1_1_ph;
  12300. $q_sroa_0_1199 = $q_sroa_0_1_ph;
  12301. $r_sroa_1_1200 = $r_sroa_1_1_ph;
  12302. $r_sroa_0_1201 = $r_sroa_0_1_ph;
  12303. $sr_1202 = $sr_1_ph;
  12304. $carry_0203 = 0;
  12305. while (1) {
  12306. $147 = $q_sroa_0_1199 >>> 31 | $q_sroa_1_1198 << 1;
  12307. $149 = $carry_0203 | $q_sroa_0_1199 << 1;
  12308. $r_sroa_0_0_insert_insert42$0 = 0 | ($r_sroa_0_1201 << 1 | $q_sroa_1_1198 >>> 31);
  12309. $r_sroa_0_0_insert_insert42$1 = $r_sroa_0_1201 >>> 31 | $r_sroa_1_1200 << 1 | 0;
  12310. _i64Subtract($137$0 | 0, $137$1 | 0, $r_sroa_0_0_insert_insert42$0 | 0, $r_sroa_0_0_insert_insert42$1 | 0) | 0;
  12311. $150$1 = tempRet0;
  12312. $151$0 = $150$1 >> 31 | (($150$1 | 0) < 0 ? -1 : 0) << 1;
  12313. $152 = $151$0 & 1;
  12314. $154$0 = _i64Subtract($r_sroa_0_0_insert_insert42$0 | 0, $r_sroa_0_0_insert_insert42$1 | 0, $151$0 & $d_sroa_0_0_insert_insert99$0 | 0, ((($150$1 | 0) < 0 ? -1 : 0) >> 31 | (($150$1 | 0) < 0 ? -1 : 0) << 1) & $d_sroa_0_0_insert_insert99$1 | 0) | 0;
  12315. $r_sroa_0_0_extract_trunc = $154$0;
  12316. $r_sroa_1_4_extract_trunc = tempRet0;
  12317. $155 = $sr_1202 - 1 | 0;
  12318. if (($155 | 0) == 0) {
  12319. break;
  12320. } else {
  12321. $q_sroa_1_1198 = $147;
  12322. $q_sroa_0_1199 = $149;
  12323. $r_sroa_1_1200 = $r_sroa_1_4_extract_trunc;
  12324. $r_sroa_0_1201 = $r_sroa_0_0_extract_trunc;
  12325. $sr_1202 = $155;
  12326. $carry_0203 = $152;
  12327. }
  12328. }
  12329. $q_sroa_1_1_lcssa = $147;
  12330. $q_sroa_0_1_lcssa = $149;
  12331. $r_sroa_1_1_lcssa = $r_sroa_1_4_extract_trunc;
  12332. $r_sroa_0_1_lcssa = $r_sroa_0_0_extract_trunc;
  12333. $carry_0_lcssa$1 = 0;
  12334. $carry_0_lcssa$0 = $152;
  12335. }
  12336. $q_sroa_0_0_insert_ext75$0 = $q_sroa_0_1_lcssa;
  12337. $q_sroa_0_0_insert_ext75$1 = 0;
  12338. $q_sroa_0_0_insert_insert77$1 = $q_sroa_1_1_lcssa | $q_sroa_0_0_insert_ext75$1;
  12339. if (($rem | 0) != 0) {
  12340. HEAP32[$rem >> 2] = 0 | $r_sroa_0_1_lcssa;
  12341. HEAP32[$rem + 4 >> 2] = $r_sroa_1_1_lcssa | 0;
  12342. }
  12343. $_0$1 = (0 | $q_sroa_0_0_insert_ext75$0) >>> 31 | $q_sroa_0_0_insert_insert77$1 << 1 | ($q_sroa_0_0_insert_ext75$1 << 1 | $q_sroa_0_0_insert_ext75$0 >>> 31) & 0 | $carry_0_lcssa$1;
  12344. $_0$0 = ($q_sroa_0_0_insert_ext75$0 << 1 | 0 >>> 31) & -2 | $carry_0_lcssa$0;
  12345. return (tempRet0 = $_0$1, $_0$0) | 0;
  12346. }
  12347. function ___udivdi3($a$0, $a$1, $b$0, $b$1) {
  12348. $a$0 = $a$0 | 0;
  12349. $a$1 = $a$1 | 0;
  12350. $b$0 = $b$0 | 0;
  12351. $b$1 = $b$1 | 0;
  12352. var $1$0 = 0;
  12353. $1$0 = ___udivmoddi4($a$0, $a$1, $b$0, $b$1, 0) | 0;
  12354. return $1$0 | 0;
  12355. }
  12356. function ___muldsi3($a, $b) {
  12357. $a = $a | 0;
  12358. $b = $b | 0;
  12359. var $1 = 0, $2 = 0, $3 = 0, $6 = 0, $8 = 0, $11 = 0, $12 = 0;
  12360. $1 = $a & 65535;
  12361. $2 = $b & 65535;
  12362. $3 = Math_imul($2, $1) | 0;
  12363. $6 = $a >>> 16;
  12364. $8 = ($3 >>> 16) + (Math_imul($2, $6) | 0) | 0;
  12365. $11 = $b >>> 16;
  12366. $12 = Math_imul($11, $1) | 0;
  12367. return (tempRet0 = (($8 >>> 16) + (Math_imul($11, $6) | 0) | 0) + ((($8 & 65535) + $12 | 0) >>> 16) | 0, 0 | ($8 + $12 << 16 | $3 & 65535)) | 0;
  12368. }
  12369. function ___muldi3($a$0, $a$1, $b$0, $b$1) {
  12370. $a$0 = $a$0 | 0;
  12371. $a$1 = $a$1 | 0;
  12372. $b$0 = $b$0 | 0;
  12373. $b$1 = $b$1 | 0;
  12374. var $x_sroa_0_0_extract_trunc = 0, $y_sroa_0_0_extract_trunc = 0, $1$0 = 0, $1$1 = 0, $2 = 0;
  12375. $x_sroa_0_0_extract_trunc = $a$0;
  12376. $y_sroa_0_0_extract_trunc = $b$0;
  12377. $1$0 = ___muldsi3($x_sroa_0_0_extract_trunc, $y_sroa_0_0_extract_trunc) | 0;
  12378. $1$1 = tempRet0;
  12379. $2 = Math_imul($a$1, $y_sroa_0_0_extract_trunc) | 0;
  12380. return (tempRet0 = ((Math_imul($b$1, $x_sroa_0_0_extract_trunc) | 0) + $2 | 0) + $1$1 | $1$1 & 0, 0 | $1$0 & -1) | 0;
  12381. }
  12382. function _sbrk(increment) {
  12383. increment = increment|0;
  12384. var oldDynamicTop = 0;
  12385. var oldDynamicTopOnChange = 0;
  12386. var newDynamicTop = 0;
  12387. var totalMemory = 0;
  12388. increment = ((increment + 15) & -16)|0;
  12389. oldDynamicTop = HEAP32[DYNAMICTOP_PTR>>2]|0;
  12390. newDynamicTop = oldDynamicTop + increment | 0;
  12391.  
  12392. if (((increment|0) > 0 & (newDynamicTop|0) < (oldDynamicTop|0)) // Detect and fail if we would wrap around signed 32-bit int.
  12393. | (newDynamicTop|0) < 0) { // Also underflow, sbrk() should be able to be used to subtract.
  12394. abortOnCannotGrowMemory()|0;
  12395. ___setErrNo(12);
  12396. return -1;
  12397. }
  12398.  
  12399. HEAP32[DYNAMICTOP_PTR>>2] = newDynamicTop;
  12400. totalMemory = getTotalMemory()|0;
  12401. if ((newDynamicTop|0) > (totalMemory|0)) {
  12402. if ((enlargeMemory()|0) == 0) {
  12403. ___setErrNo(12);
  12404. HEAP32[DYNAMICTOP_PTR>>2] = oldDynamicTop;
  12405. return -1;
  12406. }
  12407. }
  12408. return oldDynamicTop|0;
  12409. }
  12410. function ___uremdi3($a$0, $a$1, $b$0, $b$1) {
  12411. $a$0 = $a$0 | 0;
  12412. $a$1 = $a$1 | 0;
  12413. $b$0 = $b$0 | 0;
  12414. $b$1 = $b$1 | 0;
  12415. var $rem = 0, __stackBase__ = 0;
  12416. __stackBase__ = STACKTOP;
  12417. STACKTOP = STACKTOP + 16 | 0;
  12418. $rem = __stackBase__ | 0;
  12419. ___udivmoddi4($a$0, $a$1, $b$0, $b$1, $rem) | 0;
  12420. STACKTOP = __stackBase__;
  12421. return (tempRet0 = HEAP32[$rem + 4 >> 2] | 0, HEAP32[$rem >> 2] | 0) | 0;
  12422. }
  12423. function _memcpy(dest, src, num) {
  12424. dest = dest|0; src = src|0; num = num|0;
  12425. var ret = 0;
  12426. if ((num|0) >= 4096) return _emscripten_memcpy_big(dest|0, src|0, num|0)|0;
  12427. ret = dest|0;
  12428. if ((dest&3) == (src&3)) {
  12429. while (dest & 3) {
  12430. if ((num|0) == 0) return ret|0;
  12431. HEAP8[((dest)>>0)]=((HEAP8[((src)>>0)])|0);
  12432. dest = (dest+1)|0;
  12433. src = (src+1)|0;
  12434. num = (num-1)|0;
  12435. }
  12436. while ((num|0) >= 4) {
  12437. HEAP32[((dest)>>2)]=((HEAP32[((src)>>2)])|0);
  12438. dest = (dest+4)|0;
  12439. src = (src+4)|0;
  12440. num = (num-4)|0;
  12441. }
  12442. }
  12443. while ((num|0) > 0) {
  12444. HEAP8[((dest)>>0)]=((HEAP8[((src)>>0)])|0);
  12445. dest = (dest+1)|0;
  12446. src = (src+1)|0;
  12447. num = (num-1)|0;
  12448. }
  12449. return ret|0;
  12450. }
  12451. function _pthread_self() {
  12452. return 0;
  12453. }
  12454.  
  12455.  
  12456. function dynCall_ii(index,a1) {
  12457. index = index|0;
  12458. a1=a1|0;
  12459. return FUNCTION_TABLE_ii[index&1](a1|0)|0;
  12460. }
  12461.  
  12462.  
  12463. function dynCall_iiii(index,a1,a2,a3) {
  12464. index = index|0;
  12465. a1=a1|0; a2=a2|0; a3=a3|0;
  12466. return FUNCTION_TABLE_iiii[index&7](a1|0,a2|0,a3|0)|0;
  12467. }
  12468.  
  12469.  
  12470. function dynCall_vi(index,a1) {
  12471. index = index|0;
  12472. a1=a1|0;
  12473. FUNCTION_TABLE_vi[index&7](a1|0);
  12474. }
  12475.  
  12476. function b0(p0) {
  12477. p0 = p0|0; nullFunc_ii(0);return 0;
  12478. }
  12479. function b1(p0,p1,p2) {
  12480. p0 = p0|0;p1 = p1|0;p2 = p2|0; nullFunc_iiii(1);return 0;
  12481. }
  12482. function b2(p0) {
  12483. p0 = p0|0; nullFunc_vi(2);
  12484. }
  12485.  
  12486. // EMSCRIPTEN_END_FUNCS
  12487. var FUNCTION_TABLE_ii = [b0,___stdio_close];
  12488. var FUNCTION_TABLE_iiii = [b1,b1,___stdio_write,___stdio_seek,___stdout_write,b1,b1,b1];
  12489. var FUNCTION_TABLE_vi = [b2,b2,b2,b2,b2,_cleanup_522,_do_setrlimit,b2];
  12490.  
  12491. return { ___muldsi3: ___muldsi3, _sbrk: _sbrk, _i64Subtract: _i64Subtract, _free: _free, _main: _main, _i64Add: _i64Add, _pthread_self: _pthread_self, _memset: _memset, _llvm_cttz_i32: _llvm_cttz_i32, _malloc: _malloc, _memcpy: _memcpy, ___muldi3: ___muldi3, _bitshift64Shl: _bitshift64Shl, _bitshift64Lshr: _bitshift64Lshr, _fflush: _fflush, ___udivdi3: ___udivdi3, ___uremdi3: ___uremdi3, ___errno_location: ___errno_location, ___udivmoddi4: ___udivmoddi4, runPostSets: runPostSets, stackAlloc: stackAlloc, stackSave: stackSave, stackRestore: stackRestore, establishStackSpace: establishStackSpace, setThrew: setThrew, setTempRet0: setTempRet0, getTempRet0: getTempRet0, dynCall_ii: dynCall_ii, dynCall_iiii: dynCall_iiii, dynCall_vi: dynCall_vi };
  12492. })
  12493. // EMSCRIPTEN_END_ASM
  12494. (Module.asmGlobalArg, Module.asmLibraryArg, buffer);
  12495.  
  12496. var real____muldsi3 = asm["___muldsi3"]; asm["___muldsi3"] = function() {
  12497. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  12498. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  12499. return real____muldsi3.apply(null, arguments);
  12500. };
  12501.  
  12502. var real__malloc = asm["_malloc"]; asm["_malloc"] = function() {
  12503. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  12504. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  12505. return real__malloc.apply(null, arguments);
  12506. };
  12507.  
  12508. var real__i64Subtract = asm["_i64Subtract"]; asm["_i64Subtract"] = function() {
  12509. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  12510. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  12511. return real__i64Subtract.apply(null, arguments);
  12512. };
  12513.  
  12514. var real__free = asm["_free"]; asm["_free"] = function() {
  12515. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  12516. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  12517. return real__free.apply(null, arguments);
  12518. };
  12519.  
  12520. var real__main = asm["_main"]; asm["_main"] = function() {
  12521. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  12522. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  12523. return real__main.apply(null, arguments);
  12524. };
  12525.  
  12526. var real__i64Add = asm["_i64Add"]; asm["_i64Add"] = function() {
  12527. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  12528. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  12529. return real__i64Add.apply(null, arguments);
  12530. };
  12531.  
  12532. var real____udivmoddi4 = asm["___udivmoddi4"]; asm["___udivmoddi4"] = function() {
  12533. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  12534. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  12535. return real____udivmoddi4.apply(null, arguments);
  12536. };
  12537.  
  12538. var real__pthread_self = asm["_pthread_self"]; asm["_pthread_self"] = function() {
  12539. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  12540. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  12541. return real__pthread_self.apply(null, arguments);
  12542. };
  12543.  
  12544. var real__llvm_cttz_i32 = asm["_llvm_cttz_i32"]; asm["_llvm_cttz_i32"] = function() {
  12545. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  12546. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  12547. return real__llvm_cttz_i32.apply(null, arguments);
  12548. };
  12549.  
  12550. var real__sbrk = asm["_sbrk"]; asm["_sbrk"] = function() {
  12551. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  12552. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  12553. return real__sbrk.apply(null, arguments);
  12554. };
  12555.  
  12556. var real____muldi3 = asm["___muldi3"]; asm["___muldi3"] = function() {
  12557. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  12558. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  12559. return real____muldi3.apply(null, arguments);
  12560. };
  12561.  
  12562. var real__bitshift64Lshr = asm["_bitshift64Lshr"]; asm["_bitshift64Lshr"] = function() {
  12563. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  12564. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  12565. return real__bitshift64Lshr.apply(null, arguments);
  12566. };
  12567.  
  12568. var real__fflush = asm["_fflush"]; asm["_fflush"] = function() {
  12569. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  12570. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  12571. return real__fflush.apply(null, arguments);
  12572. };
  12573.  
  12574. var real____udivdi3 = asm["___udivdi3"]; asm["___udivdi3"] = function() {
  12575. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  12576. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  12577. return real____udivdi3.apply(null, arguments);
  12578. };
  12579.  
  12580. var real____uremdi3 = asm["___uremdi3"]; asm["___uremdi3"] = function() {
  12581. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  12582. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  12583. return real____uremdi3.apply(null, arguments);
  12584. };
  12585.  
  12586. var real____errno_location = asm["___errno_location"]; asm["___errno_location"] = function() {
  12587. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  12588. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  12589. return real____errno_location.apply(null, arguments);
  12590. };
  12591.  
  12592. var real__bitshift64Shl = asm["_bitshift64Shl"]; asm["_bitshift64Shl"] = function() {
  12593. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  12594. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  12595. return real__bitshift64Shl.apply(null, arguments);
  12596. };
  12597. var ___muldsi3 = Module["___muldsi3"] = asm["___muldsi3"];
  12598. var _malloc = Module["_malloc"] = asm["_malloc"];
  12599. var _i64Subtract = Module["_i64Subtract"] = asm["_i64Subtract"];
  12600. var _free = Module["_free"] = asm["_free"];
  12601. var _main = Module["_main"] = asm["_main"];
  12602. var _i64Add = Module["_i64Add"] = asm["_i64Add"];
  12603. var runPostSets = Module["runPostSets"] = asm["runPostSets"];
  12604. var ___udivmoddi4 = Module["___udivmoddi4"] = asm["___udivmoddi4"];
  12605. var _pthread_self = Module["_pthread_self"] = asm["_pthread_self"];
  12606. var _memset = Module["_memset"] = asm["_memset"];
  12607. var _llvm_cttz_i32 = Module["_llvm_cttz_i32"] = asm["_llvm_cttz_i32"];
  12608. var _sbrk = Module["_sbrk"] = asm["_sbrk"];
  12609. var _memcpy = Module["_memcpy"] = asm["_memcpy"];
  12610. var ___muldi3 = Module["___muldi3"] = asm["___muldi3"];
  12611. var _bitshift64Lshr = Module["_bitshift64Lshr"] = asm["_bitshift64Lshr"];
  12612. var _fflush = Module["_fflush"] = asm["_fflush"];
  12613. var ___udivdi3 = Module["___udivdi3"] = asm["___udivdi3"];
  12614. var ___uremdi3 = Module["___uremdi3"] = asm["___uremdi3"];
  12615. var ___errno_location = Module["___errno_location"] = asm["___errno_location"];
  12616. var _bitshift64Shl = Module["_bitshift64Shl"] = asm["_bitshift64Shl"];
  12617. var dynCall_ii = Module["dynCall_ii"] = asm["dynCall_ii"];
  12618. var dynCall_iiii = Module["dynCall_iiii"] = asm["dynCall_iiii"];
  12619. var dynCall_vi = Module["dynCall_vi"] = asm["dynCall_vi"];
  12620. ;
  12621.  
  12622. Runtime.stackAlloc = asm['stackAlloc'];
  12623. Runtime.stackSave = asm['stackSave'];
  12624. Runtime.stackRestore = asm['stackRestore'];
  12625. Runtime.establishStackSpace = asm['establishStackSpace'];
  12626.  
  12627. Runtime.setTempRet0 = asm['setTempRet0'];
  12628. Runtime.getTempRet0 = asm['getTempRet0'];
  12629.  
  12630.  
  12631.  
  12632. // === Auto-generated postamble setup entry stuff ===
  12633.  
  12634.  
  12635.  
  12636.  
  12637.  
  12638. function ExitStatus(status) {
  12639. this.name = "ExitStatus";
  12640. this.message = "Program terminated with exit(" + status + ")";
  12641. this.status = status;
  12642. };
  12643. ExitStatus.prototype = new Error();
  12644. ExitStatus.prototype.constructor = ExitStatus;
  12645.  
  12646. var initialStackTop;
  12647. var preloadStartTime = null;
  12648. var calledMain = false;
  12649.  
  12650. dependenciesFulfilled = function runCaller() {
  12651. // If run has never been called, and we should call run (INVOKE_RUN is true, and Module.noInitialRun is not false)
  12652. if (!Module['calledRun']) run();
  12653. if (!Module['calledRun']) dependenciesFulfilled = runCaller; // try this again later, after new deps are fulfilled
  12654. }
  12655.  
  12656. Module['callMain'] = Module.callMain = function callMain(args) {
  12657. assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on __ATMAIN__)');
  12658. assert(__ATPRERUN__.length == 0, 'cannot call main when preRun functions remain to be called');
  12659.  
  12660. args = args || [];
  12661.  
  12662. ensureInitRuntime();
  12663.  
  12664. var argc = args.length+1;
  12665. function pad() {
  12666. for (var i = 0; i < 4-1; i++) {
  12667. argv.push(0);
  12668. }
  12669. }
  12670. var argv = [allocate(intArrayFromString(Module['thisProgram']), 'i8', ALLOC_NORMAL) ];
  12671. pad();
  12672. for (var i = 0; i < argc-1; i = i + 1) {
  12673. argv.push(allocate(intArrayFromString(args[i]), 'i8', ALLOC_NORMAL));
  12674. pad();
  12675. }
  12676. argv.push(0);
  12677. argv = allocate(argv, 'i32', ALLOC_NORMAL);
  12678.  
  12679.  
  12680. try {
  12681.  
  12682. var ret = Module['_main'](argc, argv, 0);
  12683.  
  12684.  
  12685. // if we're not running an evented main loop, it's time to exit
  12686. exit(ret, /* implicit = */ true);
  12687. }
  12688. catch(e) {
  12689. if (e instanceof ExitStatus) {
  12690. // exit() throws this once it's done to make sure execution
  12691. // has been stopped completely
  12692. return;
  12693. } else if (e == 'SimulateInfiniteLoop') {
  12694. // running an evented main loop, don't immediately exit
  12695. Module['noExitRuntime'] = true;
  12696. return;
  12697. } else {
  12698. if (e && typeof e === 'object' && e.stack) Module.printErr('exception thrown: ' + [e, e.stack]);
  12699. throw e;
  12700. }
  12701. } finally {
  12702. calledMain = true;
  12703. }
  12704. }
  12705.  
  12706.  
  12707.  
  12708.  
  12709. function run(args) {
  12710. args = args || Module['arguments'];
  12711.  
  12712. if (preloadStartTime === null) preloadStartTime = Date.now();
  12713.  
  12714. if (runDependencies > 0) {
  12715. Module.printErr('run() called, but dependencies remain, so not running');
  12716. return;
  12717. }
  12718.  
  12719. writeStackCookie();
  12720.  
  12721. preRun();
  12722.  
  12723. if (runDependencies > 0) return; // a preRun added a dependency, run will be called later
  12724. if (Module['calledRun']) return; // run may have just been called through dependencies being fulfilled just in this very frame
  12725.  
  12726. function doRun() {
  12727. if (Module['calledRun']) return; // run may have just been called while the async setStatus time below was happening
  12728. Module['calledRun'] = true;
  12729.  
  12730. if (ABORT) return;
  12731.  
  12732. ensureInitRuntime();
  12733.  
  12734. preMain();
  12735.  
  12736. if (ENVIRONMENT_IS_WEB && preloadStartTime !== null) {
  12737. Module.printErr('pre-main prep time: ' + (Date.now() - preloadStartTime) + ' ms');
  12738. }
  12739.  
  12740. if (Module['onRuntimeInitialized']) Module['onRuntimeInitialized']();
  12741.  
  12742. if (Module['_main'] && shouldRunNow) Module['callMain'](args);
  12743.  
  12744. postRun();
  12745. }
  12746.  
  12747. if (Module['setStatus']) {
  12748. Module['setStatus']('Running...');
  12749. setTimeout(function() {
  12750. setTimeout(function() {
  12751. Module['setStatus']('');
  12752. }, 1);
  12753. doRun();
  12754. }, 1);
  12755. } else {
  12756. doRun();
  12757. }
  12758. checkStackCookie();
  12759. }
  12760. Module['run'] = Module.run = run;
  12761.  
  12762. function exit(status, implicit) {
  12763. if (implicit && Module['noExitRuntime']) {
  12764. Module.printErr('exit(' + status + ') implicitly called by end of main(), but noExitRuntime, so not exiting the runtime (you can use emscripten_force_exit, if you want to force a true shutdown)');
  12765. return;
  12766. }
  12767.  
  12768. if (Module['noExitRuntime']) {
  12769. Module.printErr('exit(' + status + ') called, but noExitRuntime, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)');
  12770. } else {
  12771.  
  12772. ABORT = true;
  12773. EXITSTATUS = status;
  12774. STACKTOP = initialStackTop;
  12775.  
  12776. exitRuntime();
  12777.  
  12778. if (Module['onExit']) Module['onExit'](status);
  12779. }
  12780.  
  12781. if (ENVIRONMENT_IS_NODE) {
  12782. process['exit'](status);
  12783. } else if (ENVIRONMENT_IS_SHELL && typeof quit === 'function') {
  12784. quit(status);
  12785. }
  12786. // if we reach here, we must throw an exception to halt the current execution
  12787. throw new ExitStatus(status);
  12788. }
  12789. Module['exit'] = Module.exit = exit;
  12790.  
  12791. var abortDecorators = [];
  12792.  
  12793. function abort(what) {
  12794. if (what !== undefined) {
  12795. Module.print(what);
  12796. Module.printErr(what);
  12797. what = JSON.stringify(what)
  12798. } else {
  12799. what = '';
  12800. }
  12801.  
  12802. ABORT = true;
  12803. EXITSTATUS = 1;
  12804.  
  12805. var extra = '';
  12806.  
  12807. var output = 'abort(' + what + ') at ' + stackTrace() + extra;
  12808. if (abortDecorators) {
  12809. abortDecorators.forEach(function(decorator) {
  12810. output = decorator(output, what);
  12811. });
  12812. }
  12813. throw output;
  12814. }
  12815. Module['abort'] = Module.abort = abort;
  12816.  
  12817. // {{PRE_RUN_ADDITIONS}}
  12818.  
  12819. if (Module['preInit']) {
  12820. if (typeof Module['preInit'] == 'function') Module['preInit'] = [Module['preInit']];
  12821. while (Module['preInit'].length > 0) {
  12822. Module['preInit'].pop()();
  12823. }
  12824. }
  12825.  
  12826. // shouldRunNow refers to calling main(), not run().
  12827. var shouldRunNow = true;
  12828. if (Module['noInitialRun']) {
  12829. shouldRunNow = false;
  12830. }
  12831.  
  12832.  
  12833. run();
  12834.  
  12835. // {{POST_RUN_ADDITIONS}}
  12836.  
  12837.  
  12838.  
  12839.  
  12840.  
  12841. // {{MODULE_ADDITIONS}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement