PageRenderTime 204ms CodeModel.GetById 42ms RepoModel.GetById 1ms app.codeStats 1ms

/EmTutor/disk_harmonic_map.js

https://github.com/cfwen/extremal
JavaScript | 8820 lines | 6000 code | 2235 blank | 585 comment | 1569 complexity | c7972acae3b376c706ee2722441c2e98 MD5 | raw file
Possible License(s): LGPL-2.1, MPL-2.0-no-copyleft-exception, GPL-2.0, BSD-3-Clause, GPL-3.0
  1. // Note: For maximum-speed code, see "Optimizing Code" on the Emscripten wiki, https://github.com/kripken/emscripten/wiki/Optimizing-Code
  2. // Note: Some Emscripten settings may limit the speed of the generated code.
  3. // The Module object: Our interface to the outside world. We import
  4. // and export values on it, and do the work to get that through
  5. // closure compiler if necessary. There are various ways Module can be used:
  6. // 1. Not defined. We create it here
  7. // 2. A function parameter, function(Module) { ..generated code.. }
  8. // 3. pre-run appended it, var Module = {}; ..generated code..
  9. // 4. External script tag defines var Module.
  10. // We need to do an eval in order to handle the closure compiler
  11. // case, where this code here is minified but Module was defined
  12. // elsewhere (e.g. case 4 above). We also need to check if Module
  13. // already exists (e.g. case 3 above).
  14. // Note that if you want to run closure, and also to use Module
  15. // after the generated code, you will need to define var Module = {};
  16. // before the code. Then that object will be used in the code, and you
  17. // can continue to use Module afterwards as well.
  18. var Module;
  19. if (!Module) Module = eval('(function() { try { return Module || {} } catch(e) { return {} } })()');
  20. // Sometimes an existing Module object exists with properties
  21. // meant to overwrite the default module functionality. Here
  22. // we collect those properties and reapply _after_ we configure
  23. // the current environment's defaults to avoid having to be so
  24. // defensive during initialization.
  25. var moduleOverrides = {};
  26. for (var key in Module) {
  27. if (Module.hasOwnProperty(key)) {
  28. moduleOverrides[key] = Module[key];
  29. }
  30. }
  31. // The environment setup code below is customized to use Module.
  32. // *** Environment setup code ***
  33. var ENVIRONMENT_IS_NODE = typeof process === 'object' && typeof require === 'function';
  34. var ENVIRONMENT_IS_WEB = typeof window === 'object';
  35. var ENVIRONMENT_IS_WORKER = typeof importScripts === 'function';
  36. var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
  37. if (ENVIRONMENT_IS_NODE) {
  38. // Expose functionality in the same simple way that the shells work
  39. // Note that we pollute the global namespace here, otherwise we break in node
  40. if (!Module['print']) Module['print'] = function print(x) {
  41. process['stdout'].write(x + '\n');
  42. };
  43. if (!Module['printErr']) Module['printErr'] = function printErr(x) {
  44. process['stderr'].write(x + '\n');
  45. };
  46. var nodeFS = require('fs');
  47. var nodePath = require('path');
  48. Module['read'] = function read(filename, binary) {
  49. filename = nodePath['normalize'](filename);
  50. var ret = nodeFS['readFileSync'](filename);
  51. // The path is absolute if the normalized version is the same as the resolved.
  52. if (!ret && filename != nodePath['resolve'](filename)) {
  53. filename = path.join(__dirname, '..', 'src', filename);
  54. ret = nodeFS['readFileSync'](filename);
  55. }
  56. if (ret && !binary) ret = ret.toString();
  57. return ret;
  58. };
  59. Module['readBinary'] = function readBinary(filename) { return Module['read'](filename, true) };
  60. Module['load'] = function load(f) {
  61. globalEval(read(f));
  62. };
  63. Module['arguments'] = process['argv'].slice(2);
  64. module['exports'] = Module;
  65. }
  66. else if (ENVIRONMENT_IS_SHELL) {
  67. if (!Module['print']) Module['print'] = print;
  68. if (typeof printErr != 'undefined') Module['printErr'] = printErr; // not present in v8 or older sm
  69. if (typeof read != 'undefined') {
  70. Module['read'] = read;
  71. } else {
  72. Module['read'] = function read() { throw 'no read() available (jsc?)' };
  73. }
  74. Module['readBinary'] = function readBinary(f) {
  75. return read(f, 'binary');
  76. };
  77. if (typeof scriptArgs != 'undefined') {
  78. Module['arguments'] = scriptArgs;
  79. } else if (typeof arguments != 'undefined') {
  80. Module['arguments'] = arguments;
  81. }
  82. this['Module'] = Module;
  83. eval("if (typeof gc === 'function' && gc.toString().indexOf('[native code]') > 0) var gc = undefined"); // wipe out the SpiderMonkey shell 'gc' function, which can confuse closure (uses it as a minified name, and it is then initted to a non-falsey value unexpectedly)
  84. }
  85. else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
  86. Module['read'] = function read(url) {
  87. var xhr = new XMLHttpRequest();
  88. xhr.open('GET', url, false);
  89. xhr.send(null);
  90. return xhr.responseText;
  91. };
  92. if (typeof arguments != 'undefined') {
  93. Module['arguments'] = arguments;
  94. }
  95. if (typeof console !== 'undefined') {
  96. if (!Module['print']) Module['print'] = function print(x) {
  97. console.log(x);
  98. };
  99. if (!Module['printErr']) Module['printErr'] = function printErr(x) {
  100. console.log(x);
  101. };
  102. } else {
  103. // Probably a worker, and without console.log. We can do very little here...
  104. var TRY_USE_DUMP = false;
  105. if (!Module['print']) Module['print'] = (TRY_USE_DUMP && (typeof(dump) !== "undefined") ? (function(x) {
  106. dump(x);
  107. }) : (function(x) {
  108. // self.postMessage(x); // enable this if you want stdout to be sent as messages
  109. }));
  110. }
  111. if (ENVIRONMENT_IS_WEB) {
  112. this['Module'] = Module;
  113. } else {
  114. Module['load'] = importScripts;
  115. }
  116. }
  117. else {
  118. // Unreachable because SHELL is dependant on the others
  119. throw 'Unknown runtime environment. Where are we?';
  120. }
  121. function globalEval(x) {
  122. eval.call(null, x);
  123. }
  124. if (!Module['load'] == 'undefined' && Module['read']) {
  125. Module['load'] = function load(f) {
  126. globalEval(Module['read'](f));
  127. };
  128. }
  129. if (!Module['print']) {
  130. Module['print'] = function(){};
  131. }
  132. if (!Module['printErr']) {
  133. Module['printErr'] = Module['print'];
  134. }
  135. if (!Module['arguments']) {
  136. Module['arguments'] = [];
  137. }
  138. // *** Environment setup code ***
  139. // Closure helpers
  140. Module.print = Module['print'];
  141. Module.printErr = Module['printErr'];
  142. // Callbacks
  143. Module['preRun'] = [];
  144. Module['postRun'] = [];
  145. // Merge back in the overrides
  146. for (var key in moduleOverrides) {
  147. if (moduleOverrides.hasOwnProperty(key)) {
  148. Module[key] = moduleOverrides[key];
  149. }
  150. }
  151. // === Auto-generated preamble library stuff ===
  152. //========================================
  153. // Runtime code shared with compiler
  154. //========================================
  155. var Runtime = {
  156. stackSave: function () {
  157. return STACKTOP;
  158. },
  159. stackRestore: function (stackTop) {
  160. STACKTOP = stackTop;
  161. },
  162. forceAlign: function (target, quantum) {
  163. quantum = quantum || 4;
  164. if (quantum == 1) return target;
  165. if (isNumber(target) && isNumber(quantum)) {
  166. return Math.ceil(target/quantum)*quantum;
  167. } else if (isNumber(quantum) && isPowerOfTwo(quantum)) {
  168. return '(((' +target + ')+' + (quantum-1) + ')&' + -quantum + ')';
  169. }
  170. return 'Math.ceil((' + target + ')/' + quantum + ')*' + quantum;
  171. },
  172. isNumberType: function (type) {
  173. return type in Runtime.INT_TYPES || type in Runtime.FLOAT_TYPES;
  174. },
  175. isPointerType: function isPointerType(type) {
  176. return type[type.length-1] == '*';
  177. },
  178. isStructType: function isStructType(type) {
  179. if (isPointerType(type)) return false;
  180. if (isArrayType(type)) return true;
  181. if (/<?\{ ?[^}]* ?\}>?/.test(type)) return true; // { i32, i8 } etc. - anonymous struct types
  182. // See comment in isStructPointerType()
  183. return type[0] == '%';
  184. },
  185. INT_TYPES: {"i1":0,"i8":0,"i16":0,"i32":0,"i64":0},
  186. FLOAT_TYPES: {"float":0,"double":0},
  187. or64: function (x, y) {
  188. var l = (x | 0) | (y | 0);
  189. var h = (Math.round(x / 4294967296) | Math.round(y / 4294967296)) * 4294967296;
  190. return l + h;
  191. },
  192. and64: function (x, y) {
  193. var l = (x | 0) & (y | 0);
  194. var h = (Math.round(x / 4294967296) & Math.round(y / 4294967296)) * 4294967296;
  195. return l + h;
  196. },
  197. xor64: function (x, y) {
  198. var l = (x | 0) ^ (y | 0);
  199. var h = (Math.round(x / 4294967296) ^ Math.round(y / 4294967296)) * 4294967296;
  200. return l + h;
  201. },
  202. getNativeTypeSize: function (type) {
  203. switch (type) {
  204. case 'i1': case 'i8': return 1;
  205. case 'i16': return 2;
  206. case 'i32': return 4;
  207. case 'i64': return 8;
  208. case 'float': return 4;
  209. case 'double': return 8;
  210. default: {
  211. if (type[type.length-1] === '*') {
  212. return Runtime.QUANTUM_SIZE; // A pointer
  213. } else if (type[0] === 'i') {
  214. var bits = parseInt(type.substr(1));
  215. assert(bits % 8 === 0);
  216. return bits/8;
  217. } else {
  218. return 0;
  219. }
  220. }
  221. }
  222. },
  223. getNativeFieldSize: function (type) {
  224. return Math.max(Runtime.getNativeTypeSize(type), Runtime.QUANTUM_SIZE);
  225. },
  226. dedup: function dedup(items, ident) {
  227. var seen = {};
  228. if (ident) {
  229. return items.filter(function(item) {
  230. if (seen[item[ident]]) return false;
  231. seen[item[ident]] = true;
  232. return true;
  233. });
  234. } else {
  235. return items.filter(function(item) {
  236. if (seen[item]) return false;
  237. seen[item] = true;
  238. return true;
  239. });
  240. }
  241. },
  242. set: function set() {
  243. var args = typeof arguments[0] === 'object' ? arguments[0] : arguments;
  244. var ret = {};
  245. for (var i = 0; i < args.length; i++) {
  246. ret[args[i]] = 0;
  247. }
  248. return ret;
  249. },
  250. STACK_ALIGN: 8,
  251. getAlignSize: function (type, size, vararg) {
  252. // we align i64s and doubles on 64-bit boundaries, unlike x86
  253. if (vararg) return 8;
  254. if (!vararg && (type == 'i64' || type == 'double')) return 8;
  255. if (!type) return Math.min(size, 8); // align structures internally to 64 bits
  256. return Math.min(size || (type ? Runtime.getNativeFieldSize(type) : 0), Runtime.QUANTUM_SIZE);
  257. },
  258. calculateStructAlignment: function calculateStructAlignment(type) {
  259. type.flatSize = 0;
  260. type.alignSize = 0;
  261. var diffs = [];
  262. var prev = -1;
  263. var index = 0;
  264. type.flatIndexes = type.fields.map(function(field) {
  265. index++;
  266. var size, alignSize;
  267. if (Runtime.isNumberType(field) || Runtime.isPointerType(field)) {
  268. size = Runtime.getNativeTypeSize(field); // pack char; char; in structs, also char[X]s.
  269. alignSize = Runtime.getAlignSize(field, size);
  270. } else if (Runtime.isStructType(field)) {
  271. if (field[1] === '0') {
  272. // this is [0 x something]. When inside another structure like here, it must be at the end,
  273. // and it adds no size
  274. // XXX this happens in java-nbody for example... assert(index === type.fields.length, 'zero-length in the middle!');
  275. size = 0;
  276. if (Types.types[field]) {
  277. alignSize = Runtime.getAlignSize(null, Types.types[field].alignSize);
  278. } else {
  279. alignSize = type.alignSize || QUANTUM_SIZE;
  280. }
  281. } else {
  282. size = Types.types[field].flatSize;
  283. alignSize = Runtime.getAlignSize(null, Types.types[field].alignSize);
  284. }
  285. } else if (field[0] == 'b') {
  286. // bN, large number field, like a [N x i8]
  287. size = field.substr(1)|0;
  288. alignSize = 1;
  289. } else if (field[0] === '<') {
  290. // vector type
  291. size = alignSize = Types.types[field].flatSize; // fully aligned
  292. } else if (field[0] === 'i') {
  293. // illegal integer field, that could not be legalized because it is an internal structure field
  294. // it is ok to have such fields, if we just use them as markers of field size and nothing more complex
  295. size = alignSize = parseInt(field.substr(1))/8;
  296. assert(size % 1 === 0, 'cannot handle non-byte-size field ' + field);
  297. } else {
  298. assert(false, 'invalid type for calculateStructAlignment');
  299. }
  300. if (type.packed) alignSize = 1;
  301. type.alignSize = Math.max(type.alignSize, alignSize);
  302. var curr = Runtime.alignMemory(type.flatSize, alignSize); // if necessary, place this on aligned memory
  303. type.flatSize = curr + size;
  304. if (prev >= 0) {
  305. diffs.push(curr-prev);
  306. }
  307. prev = curr;
  308. return curr;
  309. });
  310. if (type.name_ && type.name_[0] === '[') {
  311. // arrays have 2 elements, so we get the proper difference. then we scale here. that way we avoid
  312. // allocating a potentially huge array for [999999 x i8] etc.
  313. type.flatSize = parseInt(type.name_.substr(1))*type.flatSize/2;
  314. }
  315. type.flatSize = Runtime.alignMemory(type.flatSize, type.alignSize);
  316. if (diffs.length == 0) {
  317. type.flatFactor = type.flatSize;
  318. } else if (Runtime.dedup(diffs).length == 1) {
  319. type.flatFactor = diffs[0];
  320. }
  321. type.needsFlattening = (type.flatFactor != 1);
  322. return type.flatIndexes;
  323. },
  324. generateStructInfo: function (struct, typeName, offset) {
  325. var type, alignment;
  326. if (typeName) {
  327. offset = offset || 0;
  328. type = (typeof Types === 'undefined' ? Runtime.typeInfo : Types.types)[typeName];
  329. if (!type) return null;
  330. if (type.fields.length != struct.length) {
  331. printErr('Number of named fields must match the type for ' + typeName + ': possibly duplicate struct names. Cannot return structInfo');
  332. return null;
  333. }
  334. alignment = type.flatIndexes;
  335. } else {
  336. var type = { fields: struct.map(function(item) { return item[0] }) };
  337. alignment = Runtime.calculateStructAlignment(type);
  338. }
  339. var ret = {
  340. __size__: type.flatSize
  341. };
  342. if (typeName) {
  343. struct.forEach(function(item, i) {
  344. if (typeof item === 'string') {
  345. ret[item] = alignment[i] + offset;
  346. } else {
  347. // embedded struct
  348. var key;
  349. for (var k in item) key = k;
  350. ret[key] = Runtime.generateStructInfo(item[key], type.fields[i], alignment[i]);
  351. }
  352. });
  353. } else {
  354. struct.forEach(function(item, i) {
  355. ret[item[1]] = alignment[i];
  356. });
  357. }
  358. return ret;
  359. },
  360. dynCall: function (sig, ptr, args) {
  361. if (args && args.length) {
  362. if (!args.splice) args = Array.prototype.slice.call(args);
  363. args.splice(0, 0, ptr);
  364. return Module['dynCall_' + sig].apply(null, args);
  365. } else {
  366. return Module['dynCall_' + sig].call(null, ptr);
  367. }
  368. },
  369. functionPointers: [],
  370. addFunction: function (func) {
  371. for (var i = 0; i < Runtime.functionPointers.length; i++) {
  372. if (!Runtime.functionPointers[i]) {
  373. Runtime.functionPointers[i] = func;
  374. return 2*(1 + i);
  375. }
  376. }
  377. throw 'Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.';
  378. },
  379. removeFunction: function (index) {
  380. Runtime.functionPointers[(index-2)/2] = null;
  381. },
  382. getAsmConst: function (code, numArgs) {
  383. // code is a constant string on the heap, so we can cache these
  384. if (!Runtime.asmConstCache) Runtime.asmConstCache = {};
  385. var func = Runtime.asmConstCache[code];
  386. if (func) return func;
  387. var args = [];
  388. for (var i = 0; i < numArgs; i++) {
  389. args.push(String.fromCharCode(36) + i); // $0, $1 etc
  390. }
  391. code = Pointer_stringify(code);
  392. if (code[0] === '"') {
  393. // tolerate EM_ASM("..code..") even though EM_ASM(..code..) is correct
  394. if (code.indexOf('"', 1) === code.length-1) {
  395. code = code.substr(1, code.length-2);
  396. } else {
  397. // something invalid happened, e.g. EM_ASM("..code($0)..", input)
  398. abort('invalid EM_ASM input |' + code + '|. Please use EM_ASM(..code..) (no quotes) or EM_ASM({ ..code($0).. }, input) (to input values)');
  399. }
  400. }
  401. return Runtime.asmConstCache[code] = eval('(function(' + args.join(',') + '){ ' + code + ' })'); // new Function does not allow upvars in node
  402. },
  403. warnOnce: function (text) {
  404. if (!Runtime.warnOnce.shown) Runtime.warnOnce.shown = {};
  405. if (!Runtime.warnOnce.shown[text]) {
  406. Runtime.warnOnce.shown[text] = 1;
  407. Module.printErr(text);
  408. }
  409. },
  410. funcWrappers: {},
  411. getFuncWrapper: function (func, sig) {
  412. assert(sig);
  413. if (!Runtime.funcWrappers[func]) {
  414. Runtime.funcWrappers[func] = function dynCall_wrapper() {
  415. return Runtime.dynCall(sig, func, arguments);
  416. };
  417. }
  418. return Runtime.funcWrappers[func];
  419. },
  420. UTF8Processor: function () {
  421. var buffer = [];
  422. var needed = 0;
  423. this.processCChar = function (code) {
  424. code = code & 0xFF;
  425. if (buffer.length == 0) {
  426. if ((code & 0x80) == 0x00) { // 0xxxxxxx
  427. return String.fromCharCode(code);
  428. }
  429. buffer.push(code);
  430. if ((code & 0xE0) == 0xC0) { // 110xxxxx
  431. needed = 1;
  432. } else if ((code & 0xF0) == 0xE0) { // 1110xxxx
  433. needed = 2;
  434. } else { // 11110xxx
  435. needed = 3;
  436. }
  437. return '';
  438. }
  439. if (needed) {
  440. buffer.push(code);
  441. needed--;
  442. if (needed > 0) return '';
  443. }
  444. var c1 = buffer[0];
  445. var c2 = buffer[1];
  446. var c3 = buffer[2];
  447. var c4 = buffer[3];
  448. var ret;
  449. if (buffer.length == 2) {
  450. ret = String.fromCharCode(((c1 & 0x1F) << 6) | (c2 & 0x3F));
  451. } else if (buffer.length == 3) {
  452. ret = String.fromCharCode(((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F));
  453. } else {
  454. // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  455. var codePoint = ((c1 & 0x07) << 18) | ((c2 & 0x3F) << 12) |
  456. ((c3 & 0x3F) << 6) | (c4 & 0x3F);
  457. ret = String.fromCharCode(
  458. Math.floor((codePoint - 0x10000) / 0x400) + 0xD800,
  459. (codePoint - 0x10000) % 0x400 + 0xDC00);
  460. }
  461. buffer.length = 0;
  462. return ret;
  463. }
  464. this.processJSString = function processJSString(string) {
  465. string = unescape(encodeURIComponent(string));
  466. var ret = [];
  467. for (var i = 0; i < string.length; i++) {
  468. ret.push(string.charCodeAt(i));
  469. }
  470. return ret;
  471. }
  472. },
  473. stackAlloc: function (size) { var ret = STACKTOP;STACKTOP = (STACKTOP + size)|0;STACKTOP = (((STACKTOP)+7)&-8); return ret; },
  474. staticAlloc: function (size) { var ret = STATICTOP;STATICTOP = (STATICTOP + size)|0;STATICTOP = (((STATICTOP)+7)&-8); return ret; },
  475. dynamicAlloc: function (size) { var ret = DYNAMICTOP;DYNAMICTOP = (DYNAMICTOP + size)|0;DYNAMICTOP = (((DYNAMICTOP)+7)&-8); if (DYNAMICTOP >= TOTAL_MEMORY) enlargeMemory();; return ret; },
  476. alignMemory: function (size,quantum) { var ret = size = Math.ceil((size)/(quantum ? quantum : 8))*(quantum ? quantum : 8); return ret; },
  477. makeBigInt: function (low,high,unsigned) { var ret = (unsigned ? ((+((low>>>0)))+((+((high>>>0)))*(+4294967296))) : ((+((low>>>0)))+((+((high|0)))*(+4294967296)))); return ret; },
  478. GLOBAL_BASE: 8,
  479. QUANTUM_SIZE: 4,
  480. __dummy__: 0
  481. }
  482. Module['Runtime'] = Runtime;
  483. //========================================
  484. // Runtime essentials
  485. //========================================
  486. var __THREW__ = 0; // Used in checking for thrown exceptions.
  487. var ABORT = false; // whether we are quitting the application. no code should run after this. set in exit() and abort()
  488. var EXITSTATUS = 0;
  489. var undef = 0;
  490. // tempInt is used for 32-bit signed values or smaller. tempBigInt is used
  491. // for 32-bit unsigned values or more than 32 bits. TODO: audit all uses of tempInt
  492. var tempValue, tempInt, tempBigInt, tempInt2, tempBigInt2, tempPair, tempBigIntI, tempBigIntR, tempBigIntS, tempBigIntP, tempBigIntD, tempDouble, tempFloat;
  493. var tempI64, tempI64b;
  494. var tempRet0, tempRet1, tempRet2, tempRet3, tempRet4, tempRet5, tempRet6, tempRet7, tempRet8, tempRet9;
  495. function assert(condition, text) {
  496. if (!condition) {
  497. abort('Assertion failed: ' + text);
  498. }
  499. }
  500. var globalScope = this;
  501. // C calling interface. A convenient way to call C functions (in C files, or
  502. // defined with extern "C").
  503. //
  504. // Note: LLVM optimizations can inline and remove functions, after which you will not be
  505. // able to call them. Closure can also do so. To avoid that, add your function to
  506. // the exports using something like
  507. //
  508. // -s EXPORTED_FUNCTIONS='["_main", "_myfunc"]'
  509. //
  510. // @param ident The name of the C function (note that C++ functions will be name-mangled - use extern "C")
  511. // @param returnType The return type of the function, one of the JS types 'number', 'string' or 'array' (use 'number' for any C pointer, and
  512. // 'array' for JavaScript arrays and typed arrays; note that arrays are 8-bit).
  513. // @param argTypes An array of the types of arguments for the function (if there are no arguments, this can be ommitted). Types are as in returnType,
  514. // except that 'array' is not possible (there is no way for us to know the length of the array)
  515. // @param args An array of the arguments to the function, as native JS values (as in returnType)
  516. // Note that string arguments will be stored on the stack (the JS string will become a C string on the stack).
  517. // @return The return value, as a native JS value (as in returnType)
  518. function ccall(ident, returnType, argTypes, args) {
  519. return ccallFunc(getCFunc(ident), returnType, argTypes, args);
  520. }
  521. Module["ccall"] = ccall;
  522. // Returns the C function with a specified identifier (for C++, you need to do manual name mangling)
  523. function getCFunc(ident) {
  524. try {
  525. var func = Module['_' + ident]; // closure exported function
  526. if (!func) func = eval('_' + ident); // explicit lookup
  527. } catch(e) {
  528. }
  529. assert(func, 'Cannot call unknown function ' + ident + ' (perhaps LLVM optimizations or closure removed it?)');
  530. return func;
  531. }
  532. // Internal function that does a C call using a function, not an identifier
  533. function ccallFunc(func, returnType, argTypes, args) {
  534. var stack = 0;
  535. function toC(value, type) {
  536. if (type == 'string') {
  537. if (value === null || value === undefined || value === 0) return 0; // null string
  538. value = intArrayFromString(value);
  539. type = 'array';
  540. }
  541. if (type == 'array') {
  542. if (!stack) stack = Runtime.stackSave();
  543. var ret = Runtime.stackAlloc(value.length);
  544. writeArrayToMemory(value, ret);
  545. return ret;
  546. }
  547. return value;
  548. }
  549. function fromC(value, type) {
  550. if (type == 'string') {
  551. return Pointer_stringify(value);
  552. }
  553. assert(type != 'array');
  554. return value;
  555. }
  556. var i = 0;
  557. var cArgs = args ? args.map(function(arg) {
  558. return toC(arg, argTypes[i++]);
  559. }) : [];
  560. var ret = fromC(func.apply(null, cArgs), returnType);
  561. if (stack) Runtime.stackRestore(stack);
  562. return ret;
  563. }
  564. // Returns a native JS wrapper for a C function. This is similar to ccall, but
  565. // returns a function you can call repeatedly in a normal way. For example:
  566. //
  567. // var my_function = cwrap('my_c_function', 'number', ['number', 'number']);
  568. // alert(my_function(5, 22));
  569. // alert(my_function(99, 12));
  570. //
  571. function cwrap(ident, returnType, argTypes) {
  572. var func = getCFunc(ident);
  573. return function() {
  574. return ccallFunc(func, returnType, argTypes, Array.prototype.slice.call(arguments));
  575. }
  576. }
  577. Module["cwrap"] = cwrap;
  578. // Sets a value in memory in a dynamic way at run-time. Uses the
  579. // type data. This is the same as makeSetValue, except that
  580. // makeSetValue is done at compile-time and generates the needed
  581. // code then, whereas this function picks the right code at
  582. // run-time.
  583. // Note that setValue and getValue only do *aligned* writes and reads!
  584. // Note that ccall uses JS types as for defining types, while setValue and
  585. // getValue need LLVM types ('i8', 'i32') - this is a lower-level operation
  586. function setValue(ptr, value, type, noSafe) {
  587. type = type || 'i8';
  588. if (type.charAt(type.length-1) === '*') type = 'i32'; // pointers are 32-bit
  589. switch(type) {
  590. case 'i1': HEAP8[(ptr)]=value; break;
  591. case 'i8': HEAP8[(ptr)]=value; break;
  592. case 'i16': HEAP16[((ptr)>>1)]=value; break;
  593. case 'i32': HEAP32[((ptr)>>2)]=value; break;
  594. case 'i64': (tempI64 = [value>>>0,(tempDouble=value,(+(Math_abs(tempDouble))) >= (+1) ? (tempDouble > (+0) ? ((Math_min((+(Math_floor((tempDouble)/(+4294967296)))), (+4294967295)))|0)>>>0 : (~~((+(Math_ceil((tempDouble - +(((~~(tempDouble)))>>>0))/(+4294967296))))))>>>0) : 0)],HEAP32[((ptr)>>2)]=tempI64[0],HEAP32[(((ptr)+(4))>>2)]=tempI64[1]); break;
  595. case 'float': HEAPF32[((ptr)>>2)]=value; break;
  596. case 'double': HEAPF64[((ptr)>>3)]=value; break;
  597. default: abort('invalid type for setValue: ' + type);
  598. }
  599. }
  600. Module['setValue'] = setValue;
  601. // Parallel to setValue.
  602. function getValue(ptr, type, noSafe) {
  603. type = type || 'i8';
  604. if (type.charAt(type.length-1) === '*') type = 'i32'; // pointers are 32-bit
  605. switch(type) {
  606. case 'i1': return HEAP8[(ptr)];
  607. case 'i8': return HEAP8[(ptr)];
  608. case 'i16': return HEAP16[((ptr)>>1)];
  609. case 'i32': return HEAP32[((ptr)>>2)];
  610. case 'i64': return HEAP32[((ptr)>>2)];
  611. case 'float': return HEAPF32[((ptr)>>2)];
  612. case 'double': return HEAPF64[((ptr)>>3)];
  613. default: abort('invalid type for setValue: ' + type);
  614. }
  615. return null;
  616. }
  617. Module['getValue'] = getValue;
  618. var ALLOC_NORMAL = 0; // Tries to use _malloc()
  619. var ALLOC_STACK = 1; // Lives for the duration of the current function call
  620. var ALLOC_STATIC = 2; // Cannot be freed
  621. var ALLOC_DYNAMIC = 3; // Cannot be freed except through sbrk
  622. var ALLOC_NONE = 4; // Do not allocate
  623. Module['ALLOC_NORMAL'] = ALLOC_NORMAL;
  624. Module['ALLOC_STACK'] = ALLOC_STACK;
  625. Module['ALLOC_STATIC'] = ALLOC_STATIC;
  626. Module['ALLOC_DYNAMIC'] = ALLOC_DYNAMIC;
  627. Module['ALLOC_NONE'] = ALLOC_NONE;
  628. // allocate(): This is for internal use. You can use it yourself as well, but the interface
  629. // is a little tricky (see docs right below). The reason is that it is optimized
  630. // for multiple syntaxes to save space in generated code. So you should
  631. // normally not use allocate(), and instead allocate memory using _malloc(),
  632. // initialize it with setValue(), and so forth.
  633. // @slab: An array of data, or a number. If a number, then the size of the block to allocate,
  634. // in *bytes* (note that this is sometimes confusing: the next parameter does not
  635. // affect this!)
  636. // @types: Either an array of types, one for each byte (or 0 if no type at that position),
  637. // or a single type which is used for the entire block. This only matters if there
  638. // is initial data - if @slab is a number, then this does not matter at all and is
  639. // ignored.
  640. // @allocator: How to allocate memory, see ALLOC_*
  641. function allocate(slab, types, allocator, ptr) {
  642. var zeroinit, size;
  643. if (typeof slab === 'number') {
  644. zeroinit = true;
  645. size = slab;
  646. } else {
  647. zeroinit = false;
  648. size = slab.length;
  649. }
  650. var singleType = typeof types === 'string' ? types : null;
  651. var ret;
  652. if (allocator == ALLOC_NONE) {
  653. ret = ptr;
  654. } else {
  655. ret = [_malloc, Runtime.stackAlloc, Runtime.staticAlloc, Runtime.dynamicAlloc][allocator === undefined ? ALLOC_STATIC : allocator](Math.max(size, singleType ? 1 : types.length));
  656. }
  657. if (zeroinit) {
  658. var ptr = ret, stop;
  659. assert((ret & 3) == 0);
  660. stop = ret + (size & ~3);
  661. for (; ptr < stop; ptr += 4) {
  662. HEAP32[((ptr)>>2)]=0;
  663. }
  664. stop = ret + size;
  665. while (ptr < stop) {
  666. HEAP8[((ptr++)|0)]=0;
  667. }
  668. return ret;
  669. }
  670. if (singleType === 'i8') {
  671. if (slab.subarray || slab.slice) {
  672. HEAPU8.set(slab, ret);
  673. } else {
  674. HEAPU8.set(new Uint8Array(slab), ret);
  675. }
  676. return ret;
  677. }
  678. var i = 0, type, typeSize, previousType;
  679. while (i < size) {
  680. var curr = slab[i];
  681. if (typeof curr === 'function') {
  682. curr = Runtime.getFunctionIndex(curr);
  683. }
  684. type = singleType || types[i];
  685. if (type === 0) {
  686. i++;
  687. continue;
  688. }
  689. if (type == 'i64') type = 'i32'; // special case: we have one i32 here, and one i32 later
  690. setValue(ret+i, curr, type);
  691. // no need to look up size unless type changes, so cache it
  692. if (previousType !== type) {
  693. typeSize = Runtime.getNativeTypeSize(type);
  694. previousType = type;
  695. }
  696. i += typeSize;
  697. }
  698. return ret;
  699. }
  700. Module['allocate'] = allocate;
  701. function Pointer_stringify(ptr, /* optional */ length) {
  702. // TODO: use TextDecoder
  703. // Find the length, and check for UTF while doing so
  704. var hasUtf = false;
  705. var t;
  706. var i = 0;
  707. while (1) {
  708. t = HEAPU8[(((ptr)+(i))|0)];
  709. if (t >= 128) hasUtf = true;
  710. else if (t == 0 && !length) break;
  711. i++;
  712. if (length && i == length) break;
  713. }
  714. if (!length) length = i;
  715. var ret = '';
  716. if (!hasUtf) {
  717. var MAX_CHUNK = 1024; // split up into chunks, because .apply on a huge string can overflow the stack
  718. var curr;
  719. while (length > 0) {
  720. curr = String.fromCharCode.apply(String, HEAPU8.subarray(ptr, ptr + Math.min(length, MAX_CHUNK)));
  721. ret = ret ? ret + curr : curr;
  722. ptr += MAX_CHUNK;
  723. length -= MAX_CHUNK;
  724. }
  725. return ret;
  726. }
  727. var utf8 = new Runtime.UTF8Processor();
  728. for (i = 0; i < length; i++) {
  729. t = HEAPU8[(((ptr)+(i))|0)];
  730. ret += utf8.processCChar(t);
  731. }
  732. return ret;
  733. }
  734. Module['Pointer_stringify'] = Pointer_stringify;
  735. // Given a pointer 'ptr' to a null-terminated UTF16LE-encoded string in the emscripten HEAP, returns
  736. // a copy of that string as a Javascript String object.
  737. function UTF16ToString(ptr) {
  738. var i = 0;
  739. var str = '';
  740. while (1) {
  741. var codeUnit = HEAP16[(((ptr)+(i*2))>>1)];
  742. if (codeUnit == 0)
  743. return str;
  744. ++i;
  745. // fromCharCode constructs a character from a UTF-16 code unit, so we can pass the UTF16 string right through.
  746. str += String.fromCharCode(codeUnit);
  747. }
  748. }
  749. Module['UTF16ToString'] = UTF16ToString;
  750. // Copies the given Javascript String object 'str' to the emscripten HEAP at address 'outPtr',
  751. // null-terminated and encoded in UTF16LE form. The copy will require at most (str.length*2+1)*2 bytes of space in the HEAP.
  752. function stringToUTF16(str, outPtr) {
  753. for(var i = 0; i < str.length; ++i) {
  754. // charCodeAt returns a UTF-16 encoded code unit, so it can be directly written to the HEAP.
  755. var codeUnit = str.charCodeAt(i); // possibly a lead surrogate
  756. HEAP16[(((outPtr)+(i*2))>>1)]=codeUnit;
  757. }
  758. // Null-terminate the pointer to the HEAP.
  759. HEAP16[(((outPtr)+(str.length*2))>>1)]=0;
  760. }
  761. Module['stringToUTF16'] = stringToUTF16;
  762. // Given a pointer 'ptr' to a null-terminated UTF32LE-encoded string in the emscripten HEAP, returns
  763. // a copy of that string as a Javascript String object.
  764. function UTF32ToString(ptr) {
  765. var i = 0;
  766. var str = '';
  767. while (1) {
  768. var utf32 = HEAP32[(((ptr)+(i*4))>>2)];
  769. if (utf32 == 0)
  770. return str;
  771. ++i;
  772. // 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.
  773. if (utf32 >= 0x10000) {
  774. var ch = utf32 - 0x10000;
  775. str += String.fromCharCode(0xD800 | (ch >> 10), 0xDC00 | (ch & 0x3FF));
  776. } else {
  777. str += String.fromCharCode(utf32);
  778. }
  779. }
  780. }
  781. Module['UTF32ToString'] = UTF32ToString;
  782. // Copies the given Javascript String object 'str' to the emscripten HEAP at address 'outPtr',
  783. // null-terminated and encoded in UTF32LE form. The copy will require at most (str.length+1)*4 bytes of space in the HEAP,
  784. // but can use less, since str.length does not return the number of characters in the string, but the number of UTF-16 code units in the string.
  785. function stringToUTF32(str, outPtr) {
  786. var iChar = 0;
  787. for(var iCodeUnit = 0; iCodeUnit < str.length; ++iCodeUnit) {
  788. // 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.
  789. var codeUnit = str.charCodeAt(iCodeUnit); // possibly a lead surrogate
  790. if (codeUnit >= 0xD800 && codeUnit <= 0xDFFF) {
  791. var trailSurrogate = str.charCodeAt(++iCodeUnit);
  792. codeUnit = 0x10000 + ((codeUnit & 0x3FF) << 10) | (trailSurrogate & 0x3FF);
  793. }
  794. HEAP32[(((outPtr)+(iChar*4))>>2)]=codeUnit;
  795. ++iChar;
  796. }
  797. // Null-terminate the pointer to the HEAP.
  798. HEAP32[(((outPtr)+(iChar*4))>>2)]=0;
  799. }
  800. Module['stringToUTF32'] = stringToUTF32;
  801. function demangle(func) {
  802. try {
  803. // Special-case the entry point, since its name differs from other name mangling.
  804. if (func == 'Object._main' || func == '_main') {
  805. return 'main()';
  806. }
  807. if (typeof func === 'number') func = Pointer_stringify(func);
  808. if (func[0] !== '_') return func;
  809. if (func[1] !== '_') return func; // C function
  810. if (func[2] !== 'Z') return func;
  811. switch (func[3]) {
  812. case 'n': return 'operator new()';
  813. case 'd': return 'operator delete()';
  814. }
  815. var i = 3;
  816. // params, etc.
  817. var basicTypes = {
  818. 'v': 'void',
  819. 'b': 'bool',
  820. 'c': 'char',
  821. 's': 'short',
  822. 'i': 'int',
  823. 'l': 'long',
  824. 'f': 'float',
  825. 'd': 'double',
  826. 'w': 'wchar_t',
  827. 'a': 'signed char',
  828. 'h': 'unsigned char',
  829. 't': 'unsigned short',
  830. 'j': 'unsigned int',
  831. 'm': 'unsigned long',
  832. 'x': 'long long',
  833. 'y': 'unsigned long long',
  834. 'z': '...'
  835. };
  836. function dump(x) {
  837. //return;
  838. if (x) Module.print(x);
  839. Module.print(func);
  840. var pre = '';
  841. for (var a = 0; a < i; a++) pre += ' ';
  842. Module.print (pre + '^');
  843. }
  844. var subs = [];
  845. function parseNested() {
  846. i++;
  847. if (func[i] === 'K') i++; // ignore const
  848. var parts = [];
  849. while (func[i] !== 'E') {
  850. if (func[i] === 'S') { // substitution
  851. i++;
  852. var next = func.indexOf('_', i);
  853. var num = func.substring(i, next) || 0;
  854. parts.push(subs[num] || '?');
  855. i = next+1;
  856. continue;
  857. }
  858. if (func[i] === 'C') { // constructor
  859. parts.push(parts[parts.length-1]);
  860. i += 2;
  861. continue;
  862. }
  863. var size = parseInt(func.substr(i));
  864. var pre = size.toString().length;
  865. if (!size || !pre) { i--; break; } // counter i++ below us
  866. var curr = func.substr(i + pre, size);
  867. parts.push(curr);
  868. subs.push(curr);
  869. i += pre + size;
  870. }
  871. i++; // skip E
  872. return parts;
  873. }
  874. var first = true;
  875. function parse(rawList, limit, allowVoid) { // main parser
  876. limit = limit || Infinity;
  877. var ret = '', list = [];
  878. function flushList() {
  879. return '(' + list.join(', ') + ')';
  880. }
  881. var name;
  882. if (func[i] === 'N') {
  883. // namespaced N-E
  884. name = parseNested().join('::');
  885. limit--;
  886. if (limit === 0) return rawList ? [name] : name;
  887. } else {
  888. // not namespaced
  889. if (func[i] === 'K' || (first && func[i] === 'L')) i++; // ignore const and first 'L'
  890. var size = parseInt(func.substr(i));
  891. if (size) {
  892. var pre = size.toString().length;
  893. name = func.substr(i + pre, size);
  894. i += pre + size;
  895. }
  896. }
  897. first = false;
  898. if (func[i] === 'I') {
  899. i++;
  900. var iList = parse(true);
  901. var iRet = parse(true, 1, true);
  902. ret += iRet[0] + ' ' + name + '<' + iList.join(', ') + '>';
  903. } else {
  904. ret = name;
  905. }
  906. paramLoop: while (i < func.length && limit-- > 0) {
  907. //dump('paramLoop');
  908. var c = func[i++];
  909. if (c in basicTypes) {
  910. list.push(basicTypes[c]);
  911. } else {
  912. switch (c) {
  913. case 'P': list.push(parse(true, 1, true)[0] + '*'); break; // pointer
  914. case 'R': list.push(parse(true, 1, true)[0] + '&'); break; // reference
  915. case 'L': { // literal
  916. i++; // skip basic type
  917. var end = func.indexOf('E', i);
  918. var size = end - i;
  919. list.push(func.substr(i, size));
  920. i += size + 2; // size + 'EE'
  921. break;
  922. }
  923. case 'A': { // array
  924. var size = parseInt(func.substr(i));
  925. i += size.toString().length;
  926. if (func[i] !== '_') throw '?';
  927. i++; // skip _
  928. list.push(parse(true, 1, true)[0] + ' [' + size + ']');
  929. break;
  930. }
  931. case 'E': break paramLoop;
  932. default: ret += '?' + c; break paramLoop;
  933. }
  934. }
  935. }
  936. if (!allowVoid && list.length === 1 && list[0] === 'void') list = []; // avoid (void)
  937. return rawList ? list : ret + flushList();
  938. }
  939. return parse();
  940. } catch(e) {
  941. return func;
  942. }
  943. }
  944. function demangleAll(text) {
  945. return text.replace(/__Z[\w\d_]+/g, function(x) { var y = demangle(x); return x === y ? x : (x + ' [' + y + ']') });
  946. }
  947. function stackTrace() {
  948. var stack = new Error().stack;
  949. return stack ? demangleAll(stack) : '(no stack trace available)'; // Stack trace is not available at least on IE10 and Safari 6.
  950. }
  951. // Memory management
  952. var PAGE_SIZE = 4096;
  953. function alignMemoryPage(x) {
  954. return (x+4095)&-4096;
  955. }
  956. var HEAP;
  957. var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
  958. var STATIC_BASE = 0, STATICTOP = 0, staticSealed = false; // static area
  959. var STACK_BASE = 0, STACKTOP = 0, STACK_MAX = 0; // stack area
  960. var DYNAMIC_BASE = 0, DYNAMICTOP = 0; // dynamic area handled by sbrk
  961. function enlargeMemory() {
  962. abort('Cannot enlarge memory arrays in asm.js. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value ' + TOTAL_MEMORY + ', or (2) set Module.TOTAL_MEMORY before the program runs.');
  963. }
  964. var TOTAL_STACK = Module['TOTAL_STACK'] || 5242880;
  965. var TOTAL_MEMORY = Module['TOTAL_MEMORY'] || 419430400;
  966. var FAST_MEMORY = Module['FAST_MEMORY'] || 2097152;
  967. var totalMemory = 4096;
  968. while (totalMemory < TOTAL_MEMORY || totalMemory < 2*TOTAL_STACK) {
  969. if (totalMemory < 16*1024*1024) {
  970. totalMemory *= 2;
  971. } else {
  972. totalMemory += 16*1024*1024
  973. }
  974. }
  975. if (totalMemory !== TOTAL_MEMORY) {
  976. Module.printErr('increasing TOTAL_MEMORY to ' + totalMemory + ' to be more reasonable');
  977. TOTAL_MEMORY = totalMemory;
  978. }
  979. // Initialize the runtime's memory
  980. // check for full engine support (use string 'subarray' to avoid closure compiler confusion)
  981. assert(typeof Int32Array !== 'undefined' && typeof Float64Array !== 'undefined' && !!(new Int32Array(1)['subarray']) && !!(new Int32Array(1)['set']),
  982. 'Cannot fallback to non-typed array case: Code is too specialized');
  983. var buffer = new ArrayBuffer(TOTAL_MEMORY);
  984. HEAP8 = new Int8Array(buffer);
  985. HEAP16 = new Int16Array(buffer);
  986. HEAP32 = new Int32Array(buffer);
  987. HEAPU8 = new Uint8Array(buffer);
  988. HEAPU16 = new Uint16Array(buffer);
  989. HEAPU32 = new Uint32Array(buffer);
  990. HEAPF32 = new Float32Array(buffer);
  991. HEAPF64 = new Float64Array(buffer);
  992. // Endianness check (note: assumes compiler arch was little-endian)
  993. HEAP32[0] = 255;
  994. assert(HEAPU8[0] === 255 && HEAPU8[3] === 0, 'Typed arrays 2 must be run on a little-endian system');
  995. Module['HEAP'] = HEAP;
  996. Module['HEAP8'] = HEAP8;
  997. Module['HEAP16'] = HEAP16;
  998. Module['HEAP32'] = HEAP32;
  999. Module['HEAPU8'] = HEAPU8;
  1000. Module['HEAPU16'] = HEAPU16;
  1001. Module['HEAPU32'] = HEAPU32;
  1002. Module['HEAPF32'] = HEAPF32;
  1003. Module['HEAPF64'] = HEAPF64;
  1004. function callRuntimeCallbacks(callbacks) {
  1005. while(callbacks.length > 0) {
  1006. var callback = callbacks.shift();
  1007. if (typeof callback == 'function') {
  1008. callback();
  1009. continue;
  1010. }
  1011. var func = callback.func;
  1012. if (typeof func === 'number') {
  1013. if (callback.arg === undefined) {
  1014. Runtime.dynCall('v', func);
  1015. } else {
  1016. Runtime.dynCall('vi', func, [callback.arg]);
  1017. }
  1018. } else {
  1019. func(callback.arg === undefined ? null : callback.arg);
  1020. }
  1021. }
  1022. }
  1023. var __ATPRERUN__ = []; // functions called before the runtime is initialized
  1024. var __ATINIT__ = []; // functions called during startup
  1025. var __ATMAIN__ = []; // functions called when main() is to be run
  1026. var __ATEXIT__ = []; // functions called during shutdown
  1027. var __ATPOSTRUN__ = []; // functions called after the runtime has exited
  1028. var runtimeInitialized = false;
  1029. function preRun() {
  1030. // compatibility - merge in anything from Module['preRun'] at this time
  1031. if (Module['preRun']) {
  1032. if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']];
  1033. while (Module['preRun'].length) {
  1034. addOnPreRun(Module['preRun'].shift());
  1035. }
  1036. }
  1037. callRuntimeCallbacks(__ATPRERUN__);
  1038. }
  1039. function ensureInitRuntime() {
  1040. if (runtimeInitialized) return;
  1041. runtimeInitialized = true;
  1042. callRuntimeCallbacks(__ATINIT__);
  1043. }
  1044. function preMain() {
  1045. callRuntimeCallbacks(__ATMAIN__);
  1046. }
  1047. function exitRuntime() {
  1048. callRuntimeCallbacks(__ATEXIT__);
  1049. }
  1050. function postRun() {
  1051. // compatibility - merge in anything from Module['postRun'] at this time
  1052. if (Module['postRun']) {
  1053. if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']];
  1054. while (Module['postRun'].length) {
  1055. addOnPostRun(Module['postRun'].shift());
  1056. }
  1057. }
  1058. callRuntimeCallbacks(__ATPOSTRUN__);
  1059. }
  1060. function addOnPreRun(cb) {
  1061. __ATPRERUN__.unshift(cb);
  1062. }
  1063. Module['addOnPreRun'] = Module.addOnPreRun = addOnPreRun;
  1064. function addOnInit(cb) {
  1065. __ATINIT__.unshift(cb);
  1066. }
  1067. Module['addOnInit'] = Module.addOnInit = addOnInit;
  1068. function addOnPreMain(cb) {
  1069. __ATMAIN__.unshift(cb);
  1070. }
  1071. Module['addOnPreMain'] = Module.addOnPreMain = addOnPreMain;
  1072. function addOnExit(cb) {
  1073. __ATEXIT__.unshift(cb);
  1074. }
  1075. Module['addOnExit'] = Module.addOnExit = addOnExit;
  1076. function addOnPostRun(cb) {
  1077. __ATPOSTRUN__.unshift(cb);
  1078. }
  1079. Module['addOnPostRun'] = Module.addOnPostRun = addOnPostRun;
  1080. // Tools
  1081. // This processes a JS string into a C-line array of numbers, 0-terminated.
  1082. // For LLVM-originating strings, see parser.js:parseLLVMString function
  1083. function intArrayFromString(stringy, dontAddNull, length /* optional */) {
  1084. var ret = (new Runtime.UTF8Processor()).processJSString(stringy);
  1085. if (length) {
  1086. ret.length = length;
  1087. }
  1088. if (!dontAddNull) {
  1089. ret.push(0);
  1090. }
  1091. return ret;
  1092. }
  1093. Module['intArrayFromString'] = intArrayFromString;
  1094. function intArrayToString(array) {
  1095. var ret = [];
  1096. for (var i = 0; i < array.length; i++) {
  1097. var chr = array[i];
  1098. if (chr > 0xFF) {
  1099. chr &= 0xFF;
  1100. }
  1101. ret.push(String.fromCharCode(chr));
  1102. }
  1103. return ret.join('');
  1104. }
  1105. Module['intArrayToString'] = intArrayToString;
  1106. // Write a Javascript array to somewhere in the heap
  1107. function writeStringToMemory(string, buffer, dontAddNull) {
  1108. var array = intArrayFromString(string, dontAddNull);
  1109. var i = 0;
  1110. while (i < array.length) {
  1111. var chr = array[i];
  1112. HEAP8[(((buffer)+(i))|0)]=chr;
  1113. i = i + 1;
  1114. }
  1115. }
  1116. Module['writeStringToMemory'] = writeStringToMemory;
  1117. function writeArrayToMemory(array, buffer) {
  1118. for (var i = 0; i < array.length; i++) {
  1119. HEAP8[(((buffer)+(i))|0)]=array[i];
  1120. }
  1121. }
  1122. Module['writeArrayToMemory'] = writeArrayToMemory;
  1123. function writeAsciiToMemory(str, buffer, dontAddNull) {
  1124. for (var i = 0; i < str.length; i++) {
  1125. HEAP8[(((buffer)+(i))|0)]=str.charCodeAt(i);
  1126. }
  1127. if (!dontAddNull) HEAP8[(((buffer)+(str.length))|0)]=0;
  1128. }
  1129. Module['writeAsciiToMemory'] = writeAsciiToMemory;
  1130. function unSign(value, bits, ignore) {
  1131. if (value >= 0) {
  1132. return value;
  1133. }
  1134. 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
  1135. : Math.pow(2, bits) + value;
  1136. }
  1137. function reSign(value, bits, ignore) {
  1138. if (value <= 0) {
  1139. return value;
  1140. }
  1141. var half = bits <= 32 ? Math.abs(1 << (bits-1)) // abs is needed if bits == 32
  1142. : Math.pow(2, bits-1);
  1143. 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
  1144. // but, in general there is no perfect solution here. With 64-bit ints, we get rounding and errors
  1145. // TODO: In i64 mode 1, resign the two parts separately and safely
  1146. value = -2*half + value; // Cannot bitshift half, as it may be at the limit of the bits JS uses in bitshifts
  1147. }
  1148. return value;
  1149. }
  1150. // check for imul support, and also for correctness ( https://bugs.webkit.org/show_bug.cgi?id=126345 )
  1151. if (!Math['imul'] || Math['imul'](0xffffffff, 5) !== -5) Math['imul'] = function imul(a, b) {
  1152. var ah = a >>> 16;
  1153. var al = a & 0xffff;
  1154. var bh = b >>> 16;
  1155. var bl = b & 0xffff;
  1156. return (al*bl + ((ah*bl + al*bh) << 16))|0;
  1157. };
  1158. Math.imul = Math['imul'];
  1159. var Math_abs = Math.abs;
  1160. var Math_cos = Math.cos;
  1161. var Math_sin = Math.sin;
  1162. var Math_tan = Math.tan;
  1163. var Math_acos = Math.acos;
  1164. var Math_asin = Math.asin;
  1165. var Math_atan = Math.atan;
  1166. var Math_atan2 = Math.atan2;
  1167. var Math_exp = Math.exp;
  1168. var Math_log = Math.log;
  1169. var Math_sqrt = Math.sqrt;
  1170. var Math_ceil = Math.ceil;
  1171. var Math_floor = Math.floor;
  1172. var Math_pow = Math.pow;
  1173. var Math_imul = Math.imul;
  1174. var Math_fround = Math.fround;
  1175. var Math_min = Math.min;
  1176. // A counter of dependencies for calling run(). If we need to
  1177. // do asynchronous work before running, increment this and
  1178. // decrement it. Incrementing must happen in a place like
  1179. // PRE_RUN_ADDITIONS (used by emcc to add file preloading).
  1180. // Note that you can add dependencies in preRun, even though
  1181. // it happens right before run - run will be postponed until
  1182. // the dependencies are met.
  1183. var runDependencies = 0;
  1184. var runDependencyWatcher = null;
  1185. var dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled
  1186. function addRunDependency(id) {
  1187. runDependencies++;
  1188. if (Module['monitorRunDependencies']) {
  1189. Module['monitorRunDependencies'](runDependencies);
  1190. }
  1191. }
  1192. Module['addRunDependency'] = addRunDependency;
  1193. function removeRunDependency(id) {
  1194. runDependencies--;
  1195. if (Module['monitorRunDependencies']) {
  1196. Module['monitorRunDependencies'](runDependencies);
  1197. }
  1198. if (runDependencies == 0) {
  1199. if (runDependencyWatcher !== null) {
  1200. clearInterval(runDependencyWatcher);
  1201. runDependencyWatcher = null;
  1202. }
  1203. if (dependenciesFulfilled) {
  1204. var callback = dependenciesFulfilled;
  1205. dependenciesFulfilled = null;
  1206. callback(); // can add another dependenciesFulfilled
  1207. }
  1208. }
  1209. }
  1210. Module['removeRunDependency'] = removeRunDependency;
  1211. Module["preloadedImages"] = {}; // maps url to image data
  1212. Module["preloadedAudios"] = {}; // maps url to audio data
  1213. var memoryInitializer = null;
  1214. // === Body ===
  1215. STATIC_BASE = 8;
  1216. STATICTOP = STATIC_BASE + 28152;
  1217. var _stdout;
  1218. var _stdout=_stdout=allocate(1, "i32*", ALLOC_STATIC);
  1219. var _stdin;
  1220. var _stdin=_stdin=allocate(1, "i32*", ALLOC_STATIC);
  1221. var _stderr;
  1222. var _stderr=_stderr=allocate(1, "i32*", ALLOC_STATIC);
  1223. /* global initializers */ __ATINIT__.push({ func: function() { runPostSets() } },{ func: function() { __GLOBAL__I_a() } });
  1224. var ___dso_handle;
  1225. var ___dso_handle=___dso_handle=allocate(1, "i32*", ALLOC_STATIC);
  1226. var __ZTVN10__cxxabiv120__si_class_type_infoE;
  1227. __ZTVN10__cxxabiv120__si_class_type_infoE=allocate([0,0,0,0,104,89,0,0,16,1,0,0,10,1,0,0,70,0,0,0,166,0,0,0,10,0,0,0,10,0,0,0,2,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0], "i8", ALLOC_STATIC);;
  1228. var __ZTVN10__cxxabiv117__class_type_infoE;
  1229. __ZTVN10__cxxabiv117__class_type_infoE=allocate([0,0,0,0,120,89,0,0,16,1,0,0,90,0,0,0,70,0,0,0,166,0,0,0,10,0,0,0,30,0,0,0,4,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0], "i8", ALLOC_STATIC);;
  1230. var __ZNSt13runtime_errorC1EPKc;
  1231. var __ZNSt13runtime_errorD1Ev;
  1232. var __ZNSt12length_errorD1Ev;
  1233. var __ZNSt3__16localeC1Ev;
  1234. var __ZNSt3__16localeC1ERKS0_;
  1235. var __ZNSt3__16localeD1Ev;
  1236. var __ZNSt8bad_castC1Ev;
  1237. var __ZNSt8bad_castD1Ev;
  1238. var __ZNSt9bad_allocC1Ev;
  1239. var __ZNSt9bad_allocD1Ev;
  1240. /* memory initializer */ allocate([105,110,102,111,58,32,102,97,99,116,111,114,105,122,97,116,105,111,110,32,105,115,32,110,111,116,32,115,117,99,99,101,115,115,102,117,108,0,0,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,112,101,114,102,111,114,109,32,102,97,99,116,111,114,105,122,97,116,105,111,110,46,0,0,0,0,0,101,114,114,111,114,32,111,99,99,117,114,114,101,100,32,105,110,32,116,101,99,104,109,117,108,108,101,114,95,109,97,112,95,119,105,116,104,95,98,111,117,110,100,97,114,121,46,0,100,97,116,97,32,97,114,101,32,110,111,116,32,105,110,32,114,105,103,104,116,32,115,105,122,101,44,32,112,108,101,97,115,101,32,99,104,101,99,107,46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,95,112,137,0,255,9,47,15,10,0,0,0,100,0,0,0,232,3,0,0,16,39,0,0,160,134,1,0,64,66,15,0,128,150,152,0,0,225,245,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,74,117,108,0,0,0,0,0,105,116,45,62,114,111,119,40,41,62,61,48,32,38,38,32,105,116,45,62,114,111,119,40,41,60,109,97,116,46,114,111,119,115,40,41,32,38,38,32,105,116,45,62,99,111,108,40,41,62,61,48,32,38,38,32,105,116,45,62,99,111,108,40,41,60,109,97,116,46,99,111,108,115,40,41,0,0,0,0,105,115,67,111,109,112,114,101,115,115,101,100,40,41,32,38,38,32,34,84,104,105,115,32,102,117,110,99,116,105,111,110,32,100,111,101,115,32,110,111,116,32,109,97,107,101,32,115,101,110,115,101,32,105,110,32,110,111,110,32,99,111,109,112,114,101,115,115,101,100,32,109,111,100,101,46,34,0,0,0,74,117,110,0,0,0,0,0,65,112,114,0,0,0,0,0,77,97,114,0,0,0,0,0,117,110,115,117,112,112,111,114,116,101,100,32,108,111,99,97,108,101,32,102,111,114,32,115,116,97,110,100,97,114,100,32,105,110,112,117,116,0,0,0,70,101,98,0,0,0,0,0,115,112,95,100,103,101,109,118,32,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,97,116,97,95,114,111,119,105,110,100,91,93,0,0,0,74,97,110,0,0,0,0,0,79,0,0,0,0,0,0,0,68,101,99,101,109,98,101,114,0,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,66,106,99,111,108,46,83,116,111,114,101,0,0,0,0,73,108,108,101,103,97,108,32,110,111,114,109,32,115,112,101,99,105,102,105,101,100,46,0,85,0,0,0,0,0,0,0,78,111,118,101,109,98,101,114,0,0,0,0,0,0,0,0,79,99,116,111,98,101,114,0,83,101,112,116,101,109,98,101,114,0,0,0,0,0,0,0,40,105,62,61,48,41,32,38,38,32,40,32,40,40,66,108,111,99,107,82,111,119,115,61,61,49,41,32,38,38,32,40,66,108,111,99,107,67,111,108,115,61,61,88,112,114,84,121,112,101,58,58,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,32,38,38,32,105,60,120,112,114,46,114,111,119,115,40,41,41,32,124,124,40,40,66,108,111,99,107,82,111,119,115,61,61,88,112,114,84,121,112,101,58,58,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,32,38,38,32,40,66,108,111,99,107,67,111,108,115,61,61,49,41,32,38,38,32,105,60,120,112,114,46,99,111,108,115,40,41,41,41,0,0,65,117,103,117,115,116,0,0,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,43,49,93,61,61,48,32,38,38,32,34,89,111,117,32,109,117,115,116,32,99,97,108,108,32,115,116,97,114,116,86,101,99,32,102,111,114,32,101,97,99,104,32,105,110,110,101,114,32,118,101,99,116,111,114,32,115,101,113,117,101,110,116,105,97,108,108,121,34,0,74,117,108,121,0,0,0,0,74,117,110,101,0,0,0,0,77,97,121,0,0,0,0,0,65,112,114,105,108,0,0,0,100,115,112,95,98,108,97,115,50,46,99,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,97,116,97,95,99,111,108,112,116,114,91,93,0,0,0,77,97,114,99,104,0,0,0,76,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,101,100,32,102,111,114,32,98,117,102,32,105,110,32,100,111,117,98,108,101,67,97,108,108,111,99,40,41,10,0,0,0,0,0,0,0,0,115,116,100,58,58,98,97,100,95,99,97,115,116,0,0,0,70,101,98,114,117,97,114,121,0,0,0,0,0,0,0,0,76,0,0,0,0,0,0,0,83,97,102,101,32,109,105,110,105,109,117,109,0,0,0,0,78,111,116,32,105,109,112,108,101,109,101,110,116,101,100,46,0,0,0,0,0,0,0,0,85,110,105,116,0,0,0,0,74,97,110,117,97,114,121,0,68,0,0,0,101,0,0,0,99,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,77,97,112,66,97,115,101,46,104,0,0,0,0,0,0,0,0,78,0,0,0,111,0,0,0,118,0,0,0,0,0,0,0,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,93,61,61,73,110,100,101,120,40,109,95,100,97,116,97,46,115,105,122,101,40,41,41,32,38,38,32,34,89,111,117,32,109,117,115,116,32,99,97,108,108,32,115,116,97,114,116,86,101,99,32,102,111,114,32,101,97,99,104,32,105,110,110,101,114,32,118,101,99,116,111,114,32,115,101,113,117,101,110,116,105,97,108,108,121,34,0,0,0,0,0,0,0,0,79,0,0,0,99,0,0,0,116,0,0,0,0,0,0,0,83,0,0,0,101,0,0,0,112,0,0,0,0,0,0,0,65,0,0,0,117,0,0,0,103,0,0,0,0,0,0,0,74,0,0,0,117,0,0,0,108,0,0,0,0,0,0,0,77,97,108,108,111,99,32,102,97,105,108,115,32,102,111,114,32,119,111,114,107,32,105,110,32,115,112,95,100,116,114,115,118,40,41,46,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,116,95,114,111,119,105,110,100,91,93,0,0,0,0,0,74,0,0,0,117,0,0,0,110,0,0,0,0,0,0,0,85,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,101,100,32,102,111,114,32,98,117,102,32,105,110,32,100,111,117,98,108,101,77,97,108,108,111,99,40,41,10,0,0,0,0,0,0,0,0,77,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,78,0,0,0,0,0,0,0,69,112,115,105,108,111,110,0,69,0,0,0,0,0,0,0,78,111,32,116,114,97,110,115,0,0,0,0,0,0,0,0,65,0,0,0,112,0,0,0,114,0,0,0,0,0,0,0,77,0,0,0,97,0,0,0,114,0,0,0,0,0,0,0,70,0,0,0,101,0,0,0,98,0,0,0,0,0,0,0,40,100,97,116,97,80,116,114,32,61,61,32,48,41,32,124,124,32,40,32,110,98,82,111,119,115,32,62,61,32,48,32,38,38,32,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,124,124,32,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,110,98,82,111,119,115,41,32,38,38,32,110,98,67,111,108,115,32,62,61,32,48,32,38,38,32,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,124,124,32,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,110,98,67,111,108,115,41,41,0,0,0,0,0,0,0,74,0,0,0,97,0,0,0,110,0,0,0,0,0,0,0,105,110,100,101,120,32,62,61,32,48,32,38,38,32,105,110,100,101,120,32,60,32,115,105,122,101,40,41,0,0,0,0,40,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,43,49,93,45,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,93,61,61,48,32,124,124,32,109,95,100,97,116,97,46,105,110,100,101,120,40,109,95,100,97,116,97,46,115,105,122,101,40,41,45,49,41,60,105,110,110,101,114,41,32,38,38,32,34,73,110,118,97,108,105,100,32,111,114,100,101,114,101,100,32,105,110,115,101,114,116,105,111,110,32,40,105,110,118,97,108,105,100,32,105,110,110,101,114,32,105,110,100,101,120,41,34,0,0,0,0,0,0,68,0,0,0,101,0,0,0,99,0,0,0,101,0,0,0,109,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,0,0,0,0,78,0,0,0,111,0,0,0,118,0,0,0,101,0,0,0,109,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,0,0,0,0,79,0,0,0,99,0,0,0,116,0,0,0,111,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,66,108,111,99,107,46,104,0,0,83,0,0,0,101,0,0,0,112,0,0,0,116,0,0,0,101,0,0,0,109,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,116,95,99,111,108,112,116,114,91,93,0,0,0,0,0,0,0,65,0,0,0,117,0,0,0,103,0,0,0,117,0,0,0,115,0,0,0,116,0,0,0,0,0,0,0,0,0,0,0,77,0,0,0,0,0,0,0,74,0,0,0,117,0,0,0,108,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,67,97,110,39,116,32,101,120,112,97,110,100,32,77,101,109,84,121,112,101,32,37,100,58,32,106,99,111,108,32,37,100,10,0,0,0,0,0,0,0,84,0,0,0,0,0,0,0,100,103,115,114,102,115,46,99,0,0,0,0,0,0,0,0,70,0,0,0,0,0,0,0,76,0,0,0,0,0,0,0,69,0,0,0,0,0,0,0,74,0,0,0,117,0,0,0,110,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,105,110,102,105,110,105,116,121,0,0,0,0,0,0,0,0,65,0,0,0,112,0,0,0,114,0,0,0,105,0,0,0,108,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,68,101,110,115,101,67,111,101,102,102,115,66,97,115,101,46,104,0,0,0,0,0,0,0,0,77,0,0,0,97,0,0,0,114,0,0,0,99,0,0,0,104,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,83,112,97,114,115,101,67,111,114,101,47,83,112,97,114,115,101,77,97,116,114,105,120,46,104,0,0,0,0,0,70,0,0,0,101,0,0,0,98,0,0,0,114,0,0,0,117,0,0,0,97,0,0,0,114,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,74,0,0,0,97,0,0,0,110,0,0,0,117,0,0,0,97,0,0,0,114,0,0,0,121,0,0,0,0,0,0,0,80,77,0,0,0,0,0,0,68,84,82,83,86,32,0,0,40,105,62,61,48,41,32,38,38,32,40,32,40,40,66,108,111,99,107,82,111,119,115,61,61,49,41,32,38,38,32,40,66,108,111,99,107,67,111,108,115,61,61,88,112,114,84,121,112,101,58,58,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,32,38,38,32,105,60,120,112,114,46,114,111,119,115,40,41,41,32,124,124,40,40,66,108,111,99,107,82,111,119,115,61,61,88,112,114,84,121,112,101,58,58,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,32,38,38,32,40,66,108,111,99,107,67,111,108,115,61,61,49,41,32,38,38,32,105,60,120,112,114,46,99,111,108,115,40,41,41,41,0,0,115,112,95,100,116,114,115,118,0,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,105,119,111,114,107,91,93,0,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,109,97,114,107,101,114,91,93,0,0,0,0,0,0,0,65,77,0,0,0,0,0,0,82,0,0,0,0,0,0,0,109,97,108,108,111,99,32,102,97,105,108,115,32,102,111,114,32,108,111,99,97,108,32,100,119,111,114,107,112,116,114,91,93,46,0,0,0,0,0,0,85,0,0,0,0,0,0,0,77,97,108,108,111,99,32,102,97,105,108,115,32,102,111,114,32,119,111,114,107,47,114,119,111,114,107,47,105,119,111,114,107,46,0,0,0,0,0,0,100,108,97,110,103,115,46,99,0,0,0,0,0,0,0,0,100,103,115,99,111,110,46,99,0,0,0,0,0,0,0,0,100,103,115,115,118,120,0,0,80,0,0,0,77,0,0,0,0,0,0,0,0,0,0,0,65,0,0,0,77,0,0,0,0,0,0,0,0,0,0,0,85,0,0,0,0,0,0,0,114,111,119,32,62,61,32,48,32,38,38,32,114,111,119,32,60,32,114,111,119,115,40,41,32,38,38,32,99,111,108,32,62,61,32,48,32,38,38,32,99,111,108,32,60,32,99,111,108,115,40,41,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,65,114,114,97,121,46,104,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,115,105,122,101,95,116,40,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,43,49,93,41,32,61,61,32,109,95,100,97,116,97,46,115,105,122,101,40,41,32,38,38,32,34,73,110,118,97,108,105,100,32,111,114,100,101,114,101,100,32,105,110,115,101,114,116,105,111,110,32,40,105,110,118,97,108,105,100,32,111,117,116,101,114,32,105,110,100,101,120,41,34,0,0,0,0,0,100,105,109,32,62,61,32,48,0,0,0,0,0,0,0,0,76,0,0,0,0,0,0,0,67,0,0,0,0,0,0,0,67,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,65,67,115,116,111,114,101,45,62,99,111,108,101,110,100,0,0,0,0,0,0,0,0,67,79,76,65,77,68,32,102,97,105,108,101,100,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,65,115,115,105,103,110,46,104,0,78,0,0,0,0,0,0,0,40,33,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,82,111,119,115,61,61,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,40,33,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,67,111,108,115,61,61,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,40,33,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,61,61,68,121,110,97,109,105,99,32,38,38,32,77,97,120,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,82,111,119,115,60,61,77,97,120,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,40,33,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,61,61,68,121,110,97,109,105,99,32,38,38,32,77,97,120,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,67,111,108,115,60,61,77,97,120,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,110,98,82,111,119,115,62,61,48,32,38,38,32,110,98,67,111,108,115,62,61,48,32,38,38,32,34,73,110,118,97,108,105,100,32,115,105,122,101,115,32,119,104,101,110,32,114,101,115,105,122,105,110,103,32,97,32,109,97,116,114,105,120,32,111,114,32,97,114,114,97,121,46,34,0,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,76,45,62,83,116,111,114,101,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,80,114,111,100,117,99,116,66,97,115,101,46,104,0,0,0,0,100,76,85,87,111,114,107,73,110,105,116,58,32,109,97,108,108,111,99,32,102,97,105,108,115,32,102,111,114,32,108,111,99,97,108,32,105,119,111,114,107,112,116,114,91,93,10,0,77,97,108,108,111,99,32,102,97,105,108,115,32,102,111,114,32,108,111,99,97,108,32,115,111,108,110,91,93,46,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,114,119,111,114,107,46,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,77,97,108,108,111,99,32,102,97,105,108,115,32,102,111,114,32,119,111,114,107,32,97,114,114,97,121,115,32,105,110,32,100,103,115,99,111,110,46,0,78,0,0,0,0,0,0,0,97,95,108,104,115,46,99,111,108,115,40,41,32,61,61,32,97,95,114,104,115,46,114,111,119,115,40,41,32,38,38,32,34,105,110,118,97,108,105,100,32,109,97,116,114,105,120,32,112,114,111,100,117,99,116,34,32,38,38,32,34,105,102,32,121,111,117,32,119,97,110,116,101,100,32,97,32,99,111,101,102,102,45,119,105,115,101,32,111,114,32,97,32,100,111,116,32,112,114,111,100,117,99,116,32,117,115,101,32,116,104,101,32,114,101,115,112,101,99,116,105,118,101,32,101,120,112,108,105,99,105,116,32,102,117,110,99,116,105,111,110,115,34,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,67,119,105,115,101,78,117,108,108,97,114,121,79,112,46,104,0,110,98,82,111,119,115,32,62,61,32,48,32,38,38,32,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,124,124,32,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,110,98,82,111,119,115,41,32,38,38,32,110,98,67,111,108,115,32,62,61,32,48,32,38,38,32,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,124,124,32,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,110,98,67,111,108,115,41,0,0,0,0,117,118,0,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,108,111,99,97,108,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,0,0,0,40,112,60,61,115,116,97,114,116,73,100,32,124,124,32,109,95,100,97,116,97,46,105,110,100,101,120,40,112,45,49,41,33,61,105,110,110,101,114,41,32,38,38,32,34,121,111,117,32,99,97,110,110,111,116,32,105,110,115,101,114,116,32,97,110,32,101,108,101,109,101,110,116,32,116,104,97,116,32,97,108,114,101,97,100,121,32,101,120,105,115,116,44,32,121,111,117,32,109,117,115,116,32,99,97,108,108,32,99,111,101,102,102,82,101,102,32,116,111,32,116,104,105,115,32,101,110,100,34,0,0,0,0,0,0,0,33,105,115,67,111,109,112,114,101,115,115,101,100,40,41,0,69,0,0,0,0,0,0,0,37,0,0,0,73,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,32,0,0,0,37,0,0,0,112,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,80,108,97,105,110,79,98,106,101,99,116,66,97,115,101,46,104,0,0,0,0,0,0,0,0,101,110,100,62,61,115,116,97,114,116,32,38,38,32,34,121,111,117,32,112,114,111,98,97,98,108,121,32,99,97,108,108,101,100,32,99,111,101,102,102,82,101,102,32,111,110,32,97,32,110,111,110,32,102,105,110,97,108,105,122,101,100,32,109,97,116,114,105,120,34,0,0,37,73,58,37,77,58,37,83,32,37,112,0,0,0,0,0,114,111,119,62,61,48,32,38,38,32,114,111,119,60,114,111,119,115,40,41,32,38,38,32,99,111,108,62,61,48,32,38,38,32,99,111,108,60,99,111,108,115,40,41,0,0,0,0,37,0,0,0,97,0,0,0,32,0,0,0,37,0,0,0,98,0,0,0,32,0,0,0,37,0,0,0,100,0,0,0,32,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,32,0,0,0,37,0,0,0,89,0,0,0,0,0,0,0,0,0,0,0,84,0,0,0,0,0,0,0,105,115,67,111,109,112,114,101,115,115,101,100,40,41,32,38,38,32,34,84,104,105,115,32,102,117,110,99,116,105,111,110,32,100,111,101,115,32,110,111,116,32,109,97,107,101,32,115,101,110,115,101,32,105,110,32,110,111,110,32,99,111,109,112,114,101,115,115,101,100,32,109,111,100,101,46,34,0,0,0,84,0,0,0,0,0,0,0,37,97,32,37,98,32,37,100,32,37,72,58,37,77,58,37,83,32,37,89,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,65,67,115,116,111,114,101,45,62,99,111,108,98,101,103,0,0,0,0,0,0,0,0,77,97,108,108,111,99,32,102,97,105,108,115,32,102,111,114,32,112,91,93,0,0,0,0,37,112,0,0,0,0,0,0,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,43,49,93,61,61,48,32,38,38,32,34,89,111,117,32,109,117,115,116,32,99,97,108,108,32,115,116,97,114,116,86,101,99,32,102,111,114,32,101,97,99,104,32,105,110,110,101,114,32,118,101,99,116,111,114,32,115,101,113,117,101,110,116,105,97,108,108,121,34,0,80,0,0,0,0,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,0,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,80,108,97,105,110,79,98,106,101,99,116,66,97,115,101,46,104,0,0,0,0,0,0,0,0,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,93,61,61,73,110,100,101,120,40,109,95,100,97,116,97,46,115,105,122,101,40,41,41,32,38,38,32,34,89,111,117,32,109,117,115,116,32,99,97,108,108,32,115,116,97,114,116,86,101,99,32,102,111,114,32,101,97,99,104,32,105,110,110,101,114,32,118,101,99,116,111,114,32,115,101,113,117,101,110,116,105,97,108,108,121,34,0,0,0,0,0,0,0,0,114,111,119,115,40,41,32,61,61,32,111,116,104,101,114,46,114,111,119,115,40,41,32,38,38,32,99,111,108,115,40,41,32,61,61,32,111,116,104,101,114,46,99,111,108,115,40,41,0,0,0,0,0,0,0,0,100,103,115,116,114,115,46,99,0,0,0,0,0,0,0,0,37,72,58,37,77,58,37,83,0,0,0,0,0,0,0,0,67,0,0,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,83,97,102,101,32,109,105,110,105,109,117,109,0,0,0,0,40,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,43,49,93,45,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,93,61,61,48,32,124,124,32,109,95,100,97,116,97,46,105,110,100,101,120,40,109,95,100,97,116,97,46,115,105,122,101,40,41,45,49,41,60,105,110,110,101,114,41,32,38,38,32,34,73,110,118,97,108,105,100,32,111,114,100,101,114,101,100,32,105,110,115,101,114,116,105,111,110,32,40,105,110,118,97,108,105,100,32,105,110,110,101,114,32,105,110,100,101,120,41,34,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,98,117,102,32,105,110,32,105,110,116,67,97,108,108,111,99,40,41,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,37,0,0,0,109,0,0,0,47,0,0,0,37,0,0,0,100,0,0,0,47,0,0,0,37,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,68,101,110,115,101,67,111,101,102,102,115,66,97,115,101,46,104,0,0,0,0,0,0,0,0,115,116,100,58,58,98,97,100,95,97,108,108,111,99,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,83,112,97,114,115,101,67,111,114,101,47,83,112,97,114,115,101,77,97,116,114,105,120,46,104,0,0,0,0,0,37,109,47,37,100,47,37,121,0,0,0,0,0,0,0,0,115,105,122,101,95,116,40,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,43,49,93,41,32,61,61,32,109,95,100,97,116,97,46,115,105,122,101,40,41,32,38,38,32,34,73,110,118,97,108,105,100,32,111,114,100,101,114,101,100,32,105,110,115,101,114,116,105,111,110,32,40,105,110,118,97,108,105,100,32,111,117,116,101,114,32,105,110,100,101,120,41,34,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,77,97,112,66,97,115,101,46,104,0,0,0,0,0,0,0,0,116,105,109,101,32,101,108,97,112,115,101,100,58,32,37,46,52,102,10,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,40,100,97,116,97,80,116,114,32,61,61,32,48,41,32,124,124,32,40,32,110,98,82,111,119,115,32,62,61,32,48,32,38,38,32,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,124,124,32,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,110,98,82,111,119,115,41,32,38,38,32,110,98,67,111,108,115,32,62,61,32,48,32,38,38,32,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,124,124,32,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,110,98,67,111,108,115,41,41,0,0,0,0,0,0,0,102,0,0,0,97,0,0,0,108,0,0,0,115,0,0,0,101,0,0,0,0,0,0,0,118,101,99,83,105,122,101,32,62,61,32,48,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,77,97,116,114,105,120,46,104,0,102,97,108,115,101,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,82,101,100,117,120,46,104,0,0,40,112,60,61,115,116,97,114,116,73,100,32,124,124,32,109,95,100,97,116,97,46,105,110,100,101,120,40,112,45,49,41,33,61,105,110,110,101,114,41,32,38,38,32,34,121,111,117,32,99,97,110,110,111,116,32,105,110,115,101,114,116,32,97,110,32,101,108,101,109,101,110,116,32,116,104,97,116,32,97,108,114,101,97,100,121,32,101,120,105,115,116,44,32,121,111,117,32,109,117,115,116,32,99,97,108,108,32,99,111,101,102,102,82,101,102,32,116,111,32,116,104,105,115,32,101,110,100,34,0,0,0,0,0,0,0,100,105,109,32,62,61,32,48,0,0,0,0,0,0,0,0,58,32,0,0,0,0,0,0,100,103,115,116,114,115,0,0,116,0,0,0,114,0,0,0,117,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,109,97,116,46,114,111,119,115,40,41,62,48,32,38,38,32,109,97,116,46,99,111,108,115,40,41,62,48,32,38,38,32,34,121,111,117,32,97,114,101,32,117,115,105,110,103,32,97,110,32,101,109,112,116,121,32,109,97,116,114,105,120,34,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,65,115,115,105,103,110,46,104,0,33,105,115,67,111,109,112,114,101,115,115,101,100,40,41,0,109,95,105,110,110,101,114,78,111,110,90,101,114,111,115,91,111,117,116,101,114,93,60,61,40,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,43,49,93,32,45,32,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,93,41,0,0,0,116,114,117,101,0,0,0,0,78,0,0,0,0,0,0,0,100,103,115,114,102,115,0,0,114,111,119,115,40,41,32,61,61,32,111,116,104,101,114,46,114,111,119,115,40,41,32,38,38,32,99,111,108,115,40,41,32,61,61,32,111,116,104,101,114,46,99,111,108,115,40,41,0,0,0,0,0,0,0,0,101,110,100,62,61,115,116,97,114,116,32,38,38,32,34,121,111,117,32,112,114,111,98,97,98,108,121,32,99,97,108,108,101,100,32,99,111,101,102,102,82,101,102,32,111,110,32,97,32,110,111,110,32,102,105,110,97,108,105,122,101,100,32,109,97,116,114,105,120,34,0,0,115,112,95,99,111,108,101,116,114,101,101,46,99,0,0,0,78,0,0,0,0,0,0,0,83,0,0,0,0,0,0,0,33,105,115,67,111,109,112,114,101,115,115,101,100,40,41,0,104,101,97,112,95,114,101,108,97,120,95,115,110,111,100,101,46,99,0,0,0,0,0,0,83,97,102,101,32,109,105,110,105,109,117,109,0,0,0,0,115,112,95,112,114,101,111,114,100,101,114,46,99,0,0,0,109,95,97,110,97,108,121,115,105,115,73,115,79,107,32,38,38,32,34,89,111,117,32,109,117,115,116,32,102,105,114,115,116,32,99,97,108,108,32,97,110,97,108,121,122,101,80,97,116,116,101,114,110,40,41,34,0,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,115,116,97,116,45,62,111,112,115,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,80,108,97,105,110,79,98,106,101,99,116,66,97,115,101,46,104,0,0,0,0,0,0,0,0,103,101,116,95,112,101,114,109,95,99,46,99,0,0,0,0,114,111,119,62,61,48,32,38,38,32,114,111,119,60,114,111,119,115,40,41,32,38,38,32,99,111,108,62,61,48,32,38,38,32,99,111,108,60,99,111,108,115,40,41,0,0,0,0,100,103,115,101,113,117,0,0,66,0,0,0,0,0,0,0,100,117,116,105,108,46,99,0,109,95,105,115,73,110,105,116,105,97,108,105,122,101,100,32,38,38,32,34,68,101,99,111,109,112,111,115,105,116,105,111,110,32,105,115,32,110,111,116,32,105,110,105,116,105,97,108,105,122,101,100,46,34,0,0,117,116,105,108,46,99,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,82,101,100,117,120,46,104,0,0,40,33,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,82,111,119,115,61,61,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,40,33,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,67,111,108,115,61,61,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,40,33,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,61,61,68,121,110,97,109,105,99,32,38,38,32,77,97,120,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,82,111,119,115,60,61,77,97,120,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,40,33,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,61,61,68,121,110,97,109,105,99,32,38,38,32,77,97,120,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,67,111,108,115,60,61,77,97,120,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,110,98,82,111,119,115,62,61,48,32,38,38,32,110,98,67,111,108,115,62,61,48,32,38,38,32,34,73,110,118,97,108,105,100,32,115,105,122,101,115,32,119,104,101,110,32,114,101,115,105,122,105,110,103,32,97,32,109,97,116,114,105,120,32,111,114,32,97,114,114,97,121,46,34,0,0,0,0,0,0,100,109,101,109,111,114,121,46,99,0,0,0,0,0,0,0,77,97,108,108,111,99,32,102,97,105,108,115,32,102,111,114,32,108,111,99,97,108,32,119,111,114,107,91,93,46,0,0,77,0,0,0,0,0,0,0,66,0,0,0,0,0,0,0,118,101,99,83,105,122,101,32,62,61,32,48,0,0,0,0,73,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,115,116,97,116,45,62,117,116,105,109,101,0,0,0,0,100,103,115,99,111,110,0,0,109,97,116,46,114,111,119,115,40,41,62,48,32,38,38,32,109,97,116,46,99,111,108,115,40,41,62,48,32,38,38,32,34,121,111,117,32,97,114,101,32,117,115,105,110,103,32,97,110,32,101,109,112,116,121,32,109,97,116,114,105,120,34,0,67,0,0,0,0,0,0,0,114,111,119,115,40,41,61,61,98,46,114,111,119,115,40,41,32,38,38,32,34,83,117,112,101,114,76,85,58,58,115,111,108,118,101,40,41,58,32,105,110,118,97,108,105,100,32,110,117,109,98,101,114,32,111,102,32,114,111,119,115,32,111,102,32,116,104,101,32,114,105,103,104,116,32,104,97,110,100,32,115,105,100,101,32,109,97,116,114,105,120,32,98,34,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,77,97,112,66,97,115,101,46,104,0,0,0,0,0,0,0,0,105,111,115,95,98,97,115,101,58,58,99,108,101,97,114,0,109,101,109,111,114,121,46,99,0,0,0,0,0,0,0,0,79,0,0,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,114,111,119,32,62,61,32,48,32,38,38,32,114,111,119,32,60,32,114,111,119,115,40,41,32,38,38,32,99,111,108,32,62,61,32,48,32,38,38,32,99,111,108,32,60,32,99,111,108,115,40,41,0,0,0,0,105,110,100,101,120,32,62,61,32,48,32,38,38,32,105,110,100,101,120,32,60,32,115,105,122,101,40,41,0,0,0,0,109,95,105,115,73,110,105,116,105,97,108,105,122,101,100,32,38,38,32,34,83,117,112,101,114,76,85,32,105,115,32,110,111,116,32,105,110,105,116,105,97,108,105,122,101,100,46,34,0,0,0,0,0,0,0,0,118,101,99,83,105,122,101,32,62,61,32,48,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,109,97,114,107,101,114,46,0,0,0,0,0,0,0,0,82,0,0,0,0,0,0,0,42,42,32,79,110,32,101,110,116,114,121,32,116,111,32,37,54,115,44,32,112,97,114,97,109,101,116,101,114,32,110,117,109,98,101,114,32,37,50,100,32,104,97,100,32,97,110,32,105,108,108,101,103,97,108,32,118,97,108,117,101,10,0,0,40,33,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,82,111,119,115,61,61,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,40,33,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,67,111,108,115,61,61,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,40,33,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,61,61,68,121,110,97,109,105,99,32,38,38,32,77,97,120,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,82,111,119,115,60,61,77,97,120,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,40,33,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,61,61,68,121,110,97,109,105,99,32,38,38,32,77,97,120,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,33,61,68,121,110,97,109,105,99,41,32,124,124,32,40,110,98,67,111,108,115,60,61,77,97,120,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,38,38,32,110,98,82,111,119,115,62,61,48,32,38,38,32,110,98,67,111,108,115,62,61,48,32,38,38,32,34,73,110,118,97,108,105,100,32,115,105,122,101,115,32,119,104,101,110,32,114,101,115,105,122,105,110,103,32,97,32,109,97,116,114,105,120,32,111,114,32,97,114,114,97,121,46,34,0,0,0,0,0,0,40,40,83,105,122,101,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,38,38,32,40,77,97,120,83,105,122,101,65,116,67,111,109,112,105,108,101,84,105,109,101,61,61,68,121,110,97,109,105,99,32,124,124,32,115,105,122,101,60,61,77,97,120,83,105,122,101,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,124,124,32,83,105,122,101,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,115,105,122,101,41,32,38,38,32,115,105,122,101,62,61,48,0,0,0,0,0,0,0,115,112,95,105,101,110,118,0,105,110,100,101,120,32,62,61,32,48,32,38,38,32,105,110,100,101,120,32,60,32,115,105,122,101,40,41,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102], "i8", ALLOC_NONE, Runtime.GLOBAL_BASE);
  1241. /* memory initializer */ allocate([97,105,108,115,32,102,111,114,32,108,108,105,115,116,46,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,77,97,116,114,105,120,46,104,0,40,40,83,105,122,101,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,38,38,32,40,77,97,120,83,105,122,101,65,116,67,111,109,112,105,108,101,84,105,109,101,61,61,68,121,110,97,109,105,99,32,124,124,32,115,105,122,101,60,61,77,97,120,83,105,122,101,65,116,67,111,109,112,105,108,101,84,105,109,101,41,41,32,124,124,32,83,105,122,101,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,115,105,122,101,41,32,38,38,32,115,105,122,101,62,61,48,0,0,0,0,0,0,0,105,111,115,116,114,101,97,109,0,0,0,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,113,115,105,122,101,46,0,100,105,109,32,62,61,32,48,0,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,83,112,97,114,115,101,67,111,114,101,47,83,112,97,114,115,101,77,97,116,114,105,120,46,104,0,0,0,0,0,105,116,45,62,114,111,119,40,41,62,61,48,32,38,38,32,105,116,45,62,114,111,119,40,41,60,109,97,116,46,114,111,119,115,40,41,32,38,38,32,105,116,45,62,99,111,108,40,41,62,61,48,32,38,38,32,105,116,45,62,99,111,108,40,41,60,109,97,116,46,99,111,108,115,40,41,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,100,104,101,97,100,46,0,67,0,0,0,0,0,0,0,109,95,105,110,110,101,114,78,111,110,90,101,114,111,115,91,111,117,116,101,114,93,60,61,40,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,43,49,93,32,45,32,109,95,111,117,116,101,114,73,110,100,101,120,91,111,117,116,101,114,93,41,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,68,101,110,115,101,67,111,101,102,102,115,66,97,115,101,46,104,0,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,80,108,97,105,110,79,98,106,101,99,116,66,97,115,101,46,104,0,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,105,110,118,112,46,0,0,118,101,99,116,111,114,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,68,101,110,115,101,67,111,101,102,102,115,66,97,115,101,46,104,0,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,67,119,105,115,101,78,117,108,108,97,114,121,79,112,46,104,0,73,110,118,97,108,105,100,32,73,83,80,69,67,0,0,0,114,111,119,32,62,61,32,48,32,38,38,32,114,111,119,32,60,32,114,111,119,115,40,41,32,38,38,32,99,111,108,32,62,61,32,48,32,38,38,32,99,111,108,32,60,32,99,111,108,115,40,41,0,0,0,0,101,120,112,108,105,99,105,116,108,121,46,10,0,0,0,0,37,46,48,76,102,0,0,0,76,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,68,101,110,115,101,67,111,101,102,102,115,66,97,115,101,46,104,0,0,0,0,0,0,0,0,110,98,82,111,119,115,32,62,61,32,48,32,38,38,32,40,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,124,124,32,82,111,119,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,110,98,82,111,119,115,41,32,38,38,32,110,98,67,111,108,115,32,62,61,32,48,32,38,38,32,40,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,68,121,110,97,109,105,99,32,124,124,32,67,111,108,115,65,116,67,111,109,112,105,108,101,84,105,109,101,32,61,61,32,110,98,67,111,108,115,41,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,98,117,102,32,105,110,32,109,120,67,97,108,108,111,99,73,110,116,40,41,0,0,0,85,0,0,0,0,0,0,0,77,97,116,114,105,120,32,105,115,32,110,111,116,32,115,113,117,97,114,101,0,0,0,0,99,111,100,101,32,111,102,32,114,111,117,116,105,110,101,32,68,76,65,77,67,50,44,32,10,32,111,116,104,101,114,119,105,115,101,32,115,117,112,112,108,121,32,69,77,73,78,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,105,119,111,114,107,91,93,0,0,0,0,0,0,0,0,109,111,110,101,121,95,103,101,116,32,101,114,114,111,114,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,65,67,115,116,111,114,101,0,0,0,0,0,0,0,0,105,110,100,101,120,32,62,61,32,48,32,38,38,32,105,110,100,101,120,32,60,32,115,105,122,101,40,41,0,0,0,0,77,97,108,108,111,99,32,102,97,105,108,115,32,102,111,114,32,65,91,93,0,0,0,0,83,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,98,95,114,111,119,105,110,100,91,93,0,0,0,0,0,83,97,116,0,0,0,0,0,112,108,101,97,115,101,32,99,111,109,109,101,110,116,32,111,117,116,32,10,32,116,104,101,32,73,70,32,98,108,111,99,107,32,97,115,32,109,97,114,107,101,100,32,119,105,116,104,105,110,32,116,104,101,0,0,37,76,102,0,0,0,0,0,70,114,105,0,0,0,0,0,84,104,117,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,65,45,62,83,116,111,114,101,0,0,0,0,0,0,0,33,105,115,67,111,109,112,114,101,115,115,101,100,40,41,0,87,101,100,0,0,0,0,0,84,117,101,0,0,0,0,0,115,105,122,101,61,61,98,46,114,111,119,115,40,41,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,101,120,112,97,110,100,101,114,115,0,0,0,0,0,0,77,111,110,0,0,0,0,0,83,117,110,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,83,117,112,101,114,76,85,83,117,112,112,111,114,116,47,83,117,112,101,114,76,85,83,117,112,112,111,114,116,46,104,0,0,0,0,0,0,0,83,97,116,117,114,100,97,121,0,0,0,0,0,0,0,0,37,115,32,97,116,32,108,105,110,101,32,37,100,32,105,110,32,102,105,108,101,32,37,115,10,0,0,0,0,0,0,0,70,114,105,100,97,121,0,0,82,0,0,0,0,0,0,0,84,104,117,114,115,100,97,121,0,0,0,0,0,0,0,0,80,114,101,99,105,115,105,111,110,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,98,95,99,111,108,112,116,114,91,93,0,0,0,0,0,83,0,0,0,0,0,0,0,87,101,100,110,101,115,100,97,121,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,77,97,112,66,97,115,101,46,104,0,0,0,0,0,0,0,0,73,102,44,32,97,102,116,101,114,32,105,110,115,112,101,99,116,105,111,110,44,32,116,104,101,32,118,97,108,117,101,32,69,77,73,78,32,108,111,111,107,115,32,97,99,99,101,112,116,97,98,108,101,0,0,0,84,117,101,115,100,97,121,0,98,97,115,105,99,95,115,116,114,105,110,103,0,0,0,0,79,0,0,0,0,0,0,0,77,111,110,100,97,121,0,0,73,0,0,0,0,0,0,0,83,117,110,100,97,121,0,0,66,0,0,0,0,0,0,0,115,114,99,47,100,105,115,107,95,104,97,114,109,111,110,105,99,95,109,97,112,46,99,112,112,0,0,0,0,0,0,0,83,0,0,0,97,0,0,0,116,0,0,0,0,0,0,0,117,110,115,112,101,99,105,102,105,101,100,32,105,111,115,116,114,101,97,109,95,99,97,116,101,103,111,114,121,32,101,114,114,111,114,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,98,117,102,32,105,110,32,105,110,116,77,97,108,108,111,99,40,41,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,67,119,105,115,101,66,105,110,97,114,121,79,112,46,104,0,0,70,0,0,0,114,0,0,0,105,0,0,0,0,0,0,0,84,0,0,0,104,0,0,0,117,0,0,0,0,0,0,0,109,95,102,97,99,116,111,114,105,122,97,116,105,111,110,73,115,79,107,32,38,38,32,34,84,104,101,32,100,101,99,111,109,112,111,115,105,116,105,111,110,32,105,115,32,110,111,116,32,105,110,32,97,32,118,97,108,105,100,32,115,116,97,116,101,32,102,111,114,32,115,111,108,118,105,110,103,44,32,121,111,117,32,109,117,115,116,32,102,105,114,115,116,32,99,97,108,108,32,101,105,116,104,101,114,32,99,111,109,112,117,116,101,40,41,32,111,114,32,97,110,97,108,121,122,101,80,97,116,116,101,114,110,40,41,47,102,97,99,116,111,114,105,122,101,40,41,34,0,0,0,0,87,0,0,0,101,0,0,0,100,0,0,0,0,0,0,0,84,0,0,0,117,0,0,0,101,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,116,95,114,111,119,105,110,100,91,93,0,77,0,0,0,111,0,0,0,110,0,0,0,0,0,0,0,69,77,73,78,32,61,32,37,56,105,10,0,0,0,0,0,83,0,0,0,117,0,0,0,110,0,0,0,0,0,0,0,84,114,97,110,115,112,111,115,101,0,0,0,0,0,0,0,83,0,0,0,97,0,0,0,116,0,0,0,117,0,0,0,114,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,77,97,112,66,97,115,101,46,104,0,0,0,0,0,0,0,0,70,0,0,0,114,0,0,0,105,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,83,112,97,114,115,101,67,111,114,101,47,83,112,97,114,115,101,77,97,116,114,105,120,46,104,0,0,0,0,0,84,0,0,0,104,0,0,0,117,0,0,0,114,0,0,0,115,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,119,0,0,0,0,0,0,0,87,0,0,0,101,0,0,0,100,0,0,0,110,0,0,0,101,0,0,0,115,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,97,76,104,115,46,114,111,119,115,40,41,32,61,61,32,97,82,104,115,46,114,111,119,115,40,41,32,38,38,32,97,76,104,115,46,99,111,108,115,40,41,32,61,61,32,97,82,104,115,46,99,111,108,115,40,41,0,0,0,0,0,0,0,0,84,0,0,0,117,0,0,0,101,0,0,0,115,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,77,0,0,0,111,0,0,0,110,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,83,0,0,0,117,0,0,0,110,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,78,111,116,32,105,109,112,108,101,109,101,110,116,101,100,46,0,0,0,0,0,0,0,0,83,85,80,69,82,76,85,95,77,65,76,76,79,67,32,102,97,105,108,115,32,102,111,114,32,116,95,99,111,108,112,116,114,91,93,0,0,0,0,0,68,101,99,0,0,0,0,0,10,10,32,87,65,82,78,73,78,71,46,32,84,104,101,32,118,97,108,117,101,32,69,77,73,78,32,109,97,121,32,98,101,32,105,110,99,111,114,114,101,99,116,58,45,32,0,0,116,104,105,114,100,45,112,97,114,116,121,47,101,105,103,101,110,45,51,46,50,46,49,47,69,105,103,101,110,47,115,114,99,47,67,111,114,101,47,66,108,111,99,107,46,104,0,0,78,111,118,0,0,0,0,0,78,111,110,45,117,110,105,116,0,0,0,0,0,0,0,0,79,99,116,0,0,0,0,0,83,101,112,0,0,0,0,0,118,101,99,83,105,122,101,32,62,61,32,48,0,0,0,0,65,117,103,0,0,0,0,0,98,101,103,105,110,32,99,111,109,112,117,116,105,110,103,0,101,114,114,111,114,32,111,99,99,117,114,114,101,100,32,105,110,32,102,105,108,101,58,32,37,115,44,32,102,117,110,99,116,105,111,110,58,32,37,115,44,32,108,105,110,101,58,32,37,100,10,0,0,0,0,0,95,115,111,108,118,101,0,0,111,112,101,114,97,116,111,114,40,41,0,0,0,0,0,0,115,111,108,118,101,0,0,0,105,110,102,111,0,0,0,0,108,97,122,121,65,115,115,105,103,110,0,0,0,0,0,0,108,97,122,121,65,115,115,105,103,110,0,0,0,0,0,0,115,101,116,95,102,114,111,109,95,116,114,105,112,108,101,116,115,0,0,0,0,0,0,0,115,101,116,95,102,114,111,109,95,116,114,105,112,108,101,116,115,0,0,0,0,0,0,0,114,117,110,0,0,0,0,0,114,117,110,0,0,0,0,0,102,97,99,116,111,114,105,122,101,0,0,0,0,0,0,0,77,97,112,66,97,115,101,0,77,97,112,66,97,115,101,0,77,97,112,66,97,115,101,0,77,97,112,66,97,115,101,0,77,97,112,66,97,115,101,0,77,97,116,114,105,120,0,0,77,97,116,114,105,120,0,0,66,108,111,99,107,0,0,0,66,108,111,99,107,0,0,0,65,114,114,97,121,0,0,0,114,101,115,105,122,101,0,0,114,101,115,105,122,101,0,0,114,101,115,105,122,101,0,0,114,101,115,105,122,101,0,0,111,112,101,114,97,116,111,114,91,93,0,0,0,0,0,0,111,112,101,114,97,116,111,114,91,93,0,0,0,0,0,0,111,112,101,114,97,116,111,114,91,93,0,0,0,0,0,0,111,112,101,114,97,116,111,114,40,41,0,0,0,0,0,0,111,112,101,114,97,116,111,114,91,93,0,0,0,0,0,0,111,112,101,114,97,116,111,114,40,41,0,0,0,0,0,0,111,112,101,114,97,116,111,114,40,41,0,0,0,0,0,0,111,112,101,114,97,116,111,114,40,41,0,0,0,0,0,0,67,119,105,115,101,78,117,108,108,97,114,121,79,112,0,0,67,119,105,115,101,78,117,108,108,97,114,121,79,112,0,0,67,119,105,115,101,66,105,110,97,114,121,79,112,0,0,0,105,110,115,101,114,116,66,97,99,107,85,110,99,111,109,112,114,101,115,115,101,100,0,0,115,117,109,117,112,68,117,112,108,105,99,97,116,101,115,0,115,116,97,114,116,86,101,99,0,0,0,0,0,0,0,0,99,111,101,102,102,82,101,102,0,0,0,0,0,0,0,0,114,101,115,101,114,118,101,0,105,110,115,101,114,116,0,0,105,110,115,101,114,116,66,97,99,107,66,121,79,117,116,101,114,73,110,110,101,114,0,0,105,110,115,101,114,116,85,110,99,111,109,112,114,101,115,115,101,100,0,0,0,0,0,0,105,110,115,101,114,116,66,97,99,107,85,110,99,111,109,112,114,101,115,115,101,100,0,0,115,117,109,117,112,68,117,112,108,105,99,97,116,101,115,0,115,116,97,114,116,86,101,99,0,0,0,0,0,0,0,0,99,111,101,102,102,82,101,102,0,0,0,0,0,0,0,0,114,101,115,101,114,118,101,0,105,110,115,101,114,116,0,0,105,110,115,101,114,116,66,97,99,107,66,121,79,117,116,101,114,73,110,110,101,114,0,0,105,110,115,101,114,116,85,110,99,111,109,112,114,101,115,115,101,100,0,0,0,0,0,0,80,114,111,100,117,99,116,66,97,115,101,0,0,0,0,0,2,0,0,192,3,0,0,192,4,0,0,192,5,0,0,192,6,0,0,192,7,0,0,192,8,0,0,192,9,0,0,192,10,0,0,192,11,0,0,192,12,0,0,192,13,0,0,192,14,0,0,192,15,0,0,192,16,0,0,192,17,0,0,192,18,0,0,192,19,0,0,192,20,0,0,192,21,0,0,192,22,0,0,192,23,0,0,192,24,0,0,192,25,0,0,192,26,0,0,192,27,0,0,192,28,0,0,192,29,0,0,192,30,0,0,192,31,0,0,192,0,0,0,179,1,0,0,195,2,0,0,195,3,0,0,195,4,0,0,195,5,0,0,195,6,0,0,195,7,0,0,195,8,0,0,195,9,0,0,195,10,0,0,195,11,0,0,195,12,0,0,195,13,0,0,211,14,0,0,195,15,0,0,195,0,0,12,187,1,0,12,195,2,0,12,195,3,0,12,195,4,0,12,211,0,0,0,0,100,105,115,107,95,104,97,114,109,111,110,105,99,95,109,97,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,49,50,51,52,53,54,55,56,57,0,0,0,0,0,0,48,49,50,51,52,53,54,55,56,57,0,0,0,0,0,0,37,0,0,0,89,0,0,0,45,0,0,0,37,0,0,0,109,0,0,0,45,0,0,0,37,0,0,0,100,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,0,0,0,0,37,0,0,0,73,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,32,0,0,0,37,0,0,0,112,0,0,0,0,0,0,0,37,0,0,0,109,0,0,0,47,0,0,0,37,0,0,0,100,0,0,0,47,0,0,0,37,0,0,0,121,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,37,72,58,37,77,58,37,83,37,72,58,37,77,0,0,0,37,73,58,37,77,58,37,83,32,37,112,0,0,0,0,0,37,89,45,37,109,45,37,100,37,109,47,37,100,47,37,121,37,72,58,37,77,58,37,83,37,0,0,0,0,0,0,0,37,112,0,0,0,0,0,0,0,0,0,0,32,83,0,0,34,0,0,0,130,0,0,0,70,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,83,0,0,212,0,0,0,176,0,0,0,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,83,0,0,78,0,0,0,30,1,0,0,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,83,0,0,106,0,0,0,8,0,0,0,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,83,0,0,106,0,0,0,22,0,0,0,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,120,83,0,0,182,0,0,0,92,0,0,0,54,0,0,0,2,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,152,83,0,0,20,1,0,0,204,0,0,0,54,0,0,0,4,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,184,83,0,0,174,0,0,0,206,0,0,0,54,0,0,0,8,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,216,83,0,0,22,1,0,0,154,0,0,0,54,0,0,0,6,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,120,84,0,0,18,1,0,0,104,0,0,0,54,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,152,84,0,0,172,0,0,0,122,0,0,0,54,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,184,84,0,0,42,0,0,0,124,0,0,0,54,0,0,0,122,0,0,0,4,0,0,0,30,0,0,0,6,0,0,0,20,0,0,0,54,0,0,0,2,0,0,0,248,255,255,255,184,84,0,0,20,0,0,0,10,0,0,0,32,0,0,0,14,0,0,0,2,0,0,0,30,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,84,0,0,8,1,0,0,250,0,0,0,54,0,0,0,18,0,0,0,16,0,0,0,58,0,0,0,26,0,0,0,18,0,0,0,2,0,0,0,4,0,0,0,248,255,255,255,224,84,0,0,64,0,0,0,104,0,0,0,116,0,0,0,126,0,0,0,92,0,0,0,42,0,0,0,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,85,0,0,84,0,0,0,208,0,0,0,54,0,0,0,46,0,0,0,38,0,0,0,8,0,0,0,44,0,0,0,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,85,0,0,68,0,0,0,74,0,0,0,54,0,0,0,40,0,0,0,78,0,0,0,12,0,0,0,58,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,85,0,0,12,1,0,0,2,0,0,0,54,0,0,0,28,0,0,0,34,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,85,0,0,50,0,0,0,232,0,0,0,54,0,0,0,12,0,0,0,14,0,0,0,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,85,0,0,238,0,0,0,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,85,0,0,32,0,0,0,152,0,0,0,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,85,0,0,6,0,0,0,188,0,0,0,54,0,0,0,8,0,0,0,6,0,0,0,12,0,0,0,4,0,0,0,10,0,0,0,4,0,0,0,2,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,85,0,0,110,0,0,0,20,0,0,0,54,0,0,0,22,0,0,0,26,0,0,0,32,0,0,0,24,0,0,0,22,0,0,0,8,0,0,0,6,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,85,0,0,44,0,0,0,28,0,0,0,54,0,0,0,46,0,0,0,44,0,0,0,36,0,0,0,38,0,0,0,28,0,0,0,42,0,0,0,34,0,0,0,52,0,0,0,50,0,0,0,48,0,0,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,85,0,0,60,0,0,0,4,0,0,0,54,0,0,0,76,0,0,0,68,0,0,0,62,0,0,0,64,0,0,0,56,0,0,0,66,0,0,0,60,0,0,0,74,0,0,0,72,0,0,0,70,0,0,0,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,86,0,0,80,0,0,0,102,0,0,0,54,0,0,0,6,0,0,0,14,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,86,0,0,30,0,0,0,190,0,0,0,54,0,0,0,16,0,0,0,18,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,86,0,0,12,0,0,0,202,0,0,0,54,0,0,0,2,0,0,0,10,0,0,0,14,0,0,0,120,0,0,0,98,0,0,0,24,0,0,0,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,86,0,0,196,0,0,0,146,0,0,0,54,0,0,0,14,0,0,0,16,0,0,0,18,0,0,0,50,0,0,0,8,0,0,0,20,0,0,0,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,86,0,0,196,0,0,0,24,0,0,0,54,0,0,0,6,0,0,0,4,0,0,0,4,0,0,0,96,0,0,0,60,0,0,0,10,0,0,0,130,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,86,0,0,196,0,0,0,112,0,0,0,54,0,0,0,12,0,0,0,8,0,0,0,22,0,0,0,28,0,0,0,68,0,0,0,8,0,0,0,132,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,86,0,0,196,0,0,0,38,0,0,0,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,176,86,0,0,64,0,0,0,170,0,0,0,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,86,0,0,196,0,0,0,86,0,0,0,54,0,0,0,24,0,0,0,2,0,0,0,4,0,0,0,10,0,0,0,16,0,0,0,34,0,0,0,28,0,0,0,8,0,0,0,4,0,0,0,8,0,0,0,14,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,86,0,0,28,1,0,0,40,0,0,0,54,0,0,0,10,0,0,0,6,0,0,0,22,0,0,0,42,0,0,0,8,0,0,0,6,0,0,0,30,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,87,0,0,76,0,0,0,246,0,0,0,72,0,0,0,2,0,0,0,18,0,0,0,40,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,32,87,0,0,220,0,0,0,24,1,0,0,56,0,0,0,248,255,255,255,32,87,0,0,52,0,0,0,66,0,0,0,192,255,255,255,192,255,255,255,32,87,0,0,218,0,0,0,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,87,0,0,196,0,0,0,94,0,0,0,54,0,0,0,12,0,0,0,8,0,0,0,22,0,0,0,28,0,0,0,68,0,0,0,8,0,0,0,132,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,87,0,0,196,0,0,0,178,0,0,0,54,0,0,0,12,0,0,0,8,0,0,0,22,0,0,0,28,0,0,0,68,0,0,0,8,0,0,0,132,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,87,0,0,56,0,0,0,236,0,0,0,62,0,0,0,44,0,0,0,28,0,0,0,2,0,0,0,48,0,0,0,80,0,0,0,22,0,0,0,124,0,0,0,12,0,0,0,30,0,0,0,20,0,0,0,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,87,0,0,144,0,0,0,2,1,0,0,20,0,0,0,26,0,0,0,16,0,0,0,16,0,0,0,82,0,0,0,100,0,0,0,38,0,0,0,26,0,0,0,24,0,0,0,6,0,0,0,2,0,0,0,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,87,0,0,10,0,0,0,134,0,0,0,62,0,0,0,44,0,0,0,32,0,0,0,12,0,0,0,48,0,0,0,80,0,0,0,22,0,0,0,6,0,0,0,12,0,0,0,34,0,0,0,20,0,0,0,24,0,0,0,0,0,0,0,0,0,0,0,104,0,0,0,0,0,0,0,120,87,0,0,132,0,0,0,114,0,0,0,152,255,255,255,152,255,255,255,120,87,0,0,96,0,0,0,194,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,200,87,0,0,48,0,0,0,230,0,0,0,252,255,255,255,252,255,255,255,200,87,0,0,160,0,0,0,142,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,224,87,0,0,240,0,0,0,4,1,0,0,252,255,255,255,252,255,255,255,224,87,0,0,120,0,0,0,216,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,248,87,0,0,98,0,0,0,32,1,0,0,248,255,255,255,248,255,255,255,248,87,0,0,198,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,16,88,0,0,118,0,0,0,228,0,0,0,248,255,255,255,248,255,255,255,16,88,0,0,150,0,0,0,58,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,88,0,0,234,0,0,0,72,0,0,0,46,0,0,0,32,0,0,0,18,0,0,0,4,0,0,0,44,0,0,0,80,0,0,0,22,0,0,0,86,0,0,0,12,0,0,0,20,0,0,0,20,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,88,0,0,226,0,0,0,200,0,0,0,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,88,0,0,14,1,0,0,254,0,0,0,16,0,0,0,26,0,0,0,16,0,0,0,16,0,0,0,56,0,0,0,100,0,0,0,38,0,0,0,26,0,0,0,24,0,0,0,6,0,0,0,36,0,0,0,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,88,0,0,168,0,0,0,192,0,0,0,38,0,0,0,44,0,0,0,32,0,0,0,12,0,0,0,84,0,0,0,80,0,0,0,22,0,0,0,6,0,0,0,12,0,0,0,34,0,0,0,46,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,88,0,0,248,0,0,0,158,0,0,0,54,0,0,0,62,0,0,0,118,0,0,0,36,0,0,0,80,0,0,0,4,0,0,0,32,0,0,0,52,0,0,0,24,0,0,0,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,88,0,0,116,0,0,0,62,0,0,0,54,0,0,0,110,0,0,0,4,0,0,0,68,0,0,0,76,0,0,0,78,0,0,0,26,0,0,0,114,0,0,0,54,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,88,0,0,252,0,0,0,128,0,0,0,54,0,0,0,16,0,0,0,58,0,0,0,6,0,0,0,48,0,0,0,82,0,0,0,56,0,0,0,90,0,0,0,60,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,0,0,82,0,0,0,186,0,0,0,54,0,0,0,102,0,0,0,106,0,0,0,30,0,0,0,74,0,0,0,28,0,0,0,22,0,0,0,74,0,0,0,72,0,0,0,70,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,89,0,0,100,0,0,0,18,0,0,0,40,0,0,0,26,0,0,0,16,0,0,0,16,0,0,0,82,0,0,0,100,0,0,0,38,0,0,0,66,0,0,0,76,0,0,0,12,0,0,0,2,0,0,0,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,89,0,0,16,0,0,0,242,0,0,0,66,0,0,0,44,0,0,0,32,0,0,0,12,0,0,0,48,0,0,0,80,0,0,0,22,0,0,0,94,0,0,0,22,0,0,0,2,0,0,0,20,0,0,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,88,89,0,0,16,1,0,0,214,0,0,0,70,0,0,0,166,0,0,0,10,0,0,0,2,0,0,0,6,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,83,116,57,116,121,112,101,95,105,110,102,111,0,0,0,0,83,116,57,101,120,99,101,112,116,105,111,110,0,0,0,0,83,116,57,98,97,100,95,97,108,108,111,99,0,0,0,0,83,116,56,98,97,100,95,99,97,115,116,0,0,0,0,0,83,116,49,51,114,117,110,116,105,109,101,95,101,114,114,111,114,0,0,0,0,0,0,0,83,116,49,50,108,101,110,103,116,104,95,101,114,114,111,114,0,0,0,0,0,0,0,0,83,116,49,49,108,111,103,105,99,95,101,114,114,111,114,0,78,83,116,51,95,95,49,57,116,105,109,101,95,98,97,115,101,69,0,0,0,0,0,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,112,117,116,73,119,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,0,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,112,117,116,73,99,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,0,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,103,101,116,73,119,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,0,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,103,101,116,73,99,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,0,0,78,83,116,51,95,95,49,57,98,97,115,105,99,95,105,111,115,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,57,98,97,115,105,99,95,105,111,115,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,112,117,116,73,119,69,69,0,0,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,112,117,116,73,99,69,69,0,0,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,103,101,116,73,119,69,69,0,0,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,103,101,116,73,99,69,69,0,0,0,78,83,116,51,95,95,49,56,116,105,109,101,95,112,117,116,73,119,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,0,0,0,78,83,116,51,95,95,49,56,116,105,109,101,95,112,117,116,73,99,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,0,0,0,78,83,116,51,95,95,49,56,116,105,109,101,95,103,101,116,73,119,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,0,0,0,78,83,116,51,95,95,49,56,116,105,109,101,95,103,101,116,73,99,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,0,0,0,78,83,116,51,95,95,49,56,110,117,109,112,117,110,99,116,73,119,69,69,0,0,0,0,78,83,116,51,95,95,49,56,110,117,109,112,117,110,99,116,73,99,69,69,0,0,0,0,78,83,116,51,95,95,49,56,109,101,115,115,97,103,101,115,73,119,69,69,0,0,0,0,78,83,116,51,95,95,49,56,109,101,115,115,97,103,101,115,73,99,69,69,0,0,0,0,78,83,116,51,95,95,49,56,105,111,115,95,98,97,115,101,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,56,105,111,115,95,98,97,115,101,55,102,97,105,108,117,114,101,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,55,110,117,109,95,112,117,116,73,119,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,55,110,117,109,95,112,117,116,73,99,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,55,110,117,109,95,103,101,116,73,119,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,55,110,117,109,95,103,101,116,73,99,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,55,99,111,108,108,97,116,101,73,119,69,69,0,0,0,0,0,78,83,116,51,95,95,49,55,99,111,108,108,97,116,101,73,99,69,69,0,0,0,0,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,119,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,99,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,68,115,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,0,0,0,0,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,68,105,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,0,0,0,0,0,78,83,116,51,95,95,49,54,108,111,99,97,108,101,53,102,97,99,101,116,69,0,0,0,78,83,116,51,95,95,49,54,108,111,99,97,108,101,53,95,95,105,109,112,69,0,0,0,78,83,116,51,95,95,49,53,99,116,121,112,101,73,119,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,53,99,116,121,112,101,73,99,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,50,48,95,95,116,105,109,101,95,103,101,116,95,99,95,115,116,111,114,97,103,101,73,119,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,50,48,95,95,116,105,109,101,95,103,101,116,95,99,95,115,116,111,114,97,103,101,73,99,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,57,95,95,105,111,115,116,114,101,97,109,95,99,97,116,101,103,111,114,121,69,0,0,0,78,83,116,51,95,95,49,49,56,98,97,115,105,99,95,115,116,114,105,110,103,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,99,69,69,69,69,0,0,0,0,78,83,116,51,95,95,49,49,55,95,95,119,105,100,101,110,95,102,114,111,109,95,117,116,102,56,73,76,106,51,50,69,69,69,0,0,0,0,0,0,78,83,116,51,95,95,49,49,54,95,95,110,97,114,114,111,119,95,116,111,95,117,116,102,56,73,76,106,51,50,69,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,53,98,97,115,105,99,95,115,116,114,105,110,103,98,117,102,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,99,69,69,69,69,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,53,98,97,115,105,99,95,115,116,114,101,97,109,98,117,102,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,53,98,97,115,105,99,95,115,116,114,101,97,109,98,117,102,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,52,101,114,114,111,114,95,99,97,116,101,103,111,114,121,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,52,98,97,115,105,99,95,111,102,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,78,83,116,51,95,95,49,49,52,98,97,115,105,99,95,105,111,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,78,83,116,51,95,95,49,49,52,95,95,115,104,97,114,101,100,95,99,111,117,110,116,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,52,95,95,110,117,109,95,112,117,116,95,98,97,115,101,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,52,95,95,110,117,109,95,103,101,116,95,98,97,115,101,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,51,109,101,115,115,97,103,101,115,95,98,97,115,101,69,0,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,111,115,116,114,101,97,109,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,0,0,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,111,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,0,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,105,115,116,114,101,97,109,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115], "i8", ALLOC_NONE, Runtime.GLOBAL_BASE+10240);
  1242. /* memory initializer */ allocate([73,119,69,69,69,69,0,0,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,105,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,0,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,102,105,108,101,98,117,102,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,0,78,83,116,51,95,95,49,49,50,115,121,115,116,101,109,95,101,114,114,111,114,69,0,0,78,83,116,51,95,95,49,49,50,99,111,100,101,99,118,116,95,98,97,115,101,69,0,0,78,83,116,51,95,95,49,49,50,95,95,100,111,95,109,101,115,115,97,103,101,69,0,0,78,83,116,51,95,95,49,49,49,95,95,115,116,100,111,117,116,98,117,102,73,119,69,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,49,95,95,115,116,100,111,117,116,98,117,102,73,99,69,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,112,117,116,73,119,69,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,112,117,116,73,99,69,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,103,101,116,73,119,69,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,103,101,116,73,99,69,69,0,0,0,0,0,0,0,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,119,76,98,49,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,119,76,98,48,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,99,76,98,49,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,99,76,98,48,69,69,69,0,0,0,0,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,95,98,97,115,101,69,0,0,0,0,78,83,116,51,95,95,49,49,48,99,116,121,112,101,95,98,97,115,101,69,0,0,0,0,78,83,116,51,95,95,49,49,48,95,95,116,105,109,101,95,112,117,116,69,0,0,0,0,78,83,116,51,95,95,49,49,48,95,95,115,116,100,105,110,98,117,102,73,119,69,69,0,78,83,116,51,95,95,49,49,48,95,95,115,116,100,105,110,98,117,102,73,99,69,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,49,95,95,118,109,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,0,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,48,95,95,115,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,0,0,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,0,0,0,0,0,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,54,95,95,115,104,105,109,95,116,121,112,101,95,105,110,102,111,69,0,0,0,0,0,0,0,0,0,0,0,0,72,70,0,0,0,0,0,0,88,70,0,0,0,0,0,0,104,70,0,0,24,83,0,0,0,0,0,0,0,0,0,0,120,70,0,0,24,83,0,0,0,0,0,0,0,0,0,0,136,70,0,0,24,83,0,0,0,0,0,0,0,0,0,0,160,70,0,0,96,83,0,0,0,0,0,0,0,0,0,0,184,70,0,0,24,83,0,0,0,0,0,0,0,0,0,0,200,70,0,0,32,70,0,0,224,70,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,128,88,0,0,0,0,0,0,32,70,0,0,40,71,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,136,88,0,0,0,0,0,0,32,70,0,0,112,71,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,144,88,0,0,0,0,0,0,32,70,0,0,184,71,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,152,88,0,0,0,0,0,0,0,0,0,0,0,72,0,0,104,85,0,0,0,0,0,0,0,0,0,0,48,72,0,0,104,85,0,0,0,0,0,0,32,70,0,0,96,72,0,0,0,0,0,0,1,0,0,0,176,87,0,0,0,0,0,0,32,70,0,0,120,72,0,0,0,0,0,0,1,0,0,0,176,87,0,0,0,0,0,0,32,70,0,0,144,72,0,0,0,0,0,0,1,0,0,0,184,87,0,0,0,0,0,0,32,70,0,0,168,72,0,0,0,0,0,0,1,0,0,0,184,87,0,0,0,0,0,0,32,70,0,0,192,72,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,48,89,0,0,0,8,0,0,32,70,0,0,8,73,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,48,89,0,0,0,8,0,0,32,70,0,0,80,73,0,0,0,0,0,0,3,0,0,0,160,86,0,0,2,0,0,0,112,83,0,0,2,0,0,0,0,87,0,0,0,8,0,0,32,70,0,0,152,73,0,0,0,0,0,0,3,0,0,0,160,86,0,0,2,0,0,0,112,83,0,0,2,0,0,0,8,87,0,0,0,8,0,0,0,0,0,0,224,73,0,0,160,86,0,0,0,0,0,0,0,0,0,0,248,73,0,0,160,86,0,0,0,0,0,0,32,70,0,0,16,74,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,192,87,0,0,2,0,0,0,32,70,0,0,40,74,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,192,87,0,0,2,0,0,0,0,0,0,0,64,74,0,0,0,0,0,0,88,74,0,0,56,88,0,0,0,0,0,0,32,70,0,0,120,74,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,24,84,0,0,0,0,0,0,32,70,0,0,192,74,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,48,84,0,0,0,0,0,0,32,70,0,0,8,75,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,72,84,0,0,0,0,0,0,32,70,0,0,80,75,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,96,84,0,0,0,0,0,0,0,0,0,0,152,75,0,0,160,86,0,0,0,0,0,0,0,0,0,0,176,75,0,0,160,86,0,0,0,0,0,0,32,70,0,0,200,75,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,72,88,0,0,2,0,0,0,32,70,0,0,240,75,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,72,88,0,0,2,0,0,0,32,70,0,0,24,76,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,72,88,0,0,2,0,0,0,32,70,0,0,64,76,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,72,88,0,0,2,0,0,0,0,0,0,0,104,76,0,0,168,87,0,0,0,0,0,0,0,0,0,0,128,76,0,0,160,86,0,0,0,0,0,0,32,70,0,0,152,76,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,40,89,0,0,2,0,0,0,32,70,0,0,176,76,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,40,89,0,0,2,0,0,0,0,0,0,0,200,76,0,0,0,0,0,0,240,76,0,0,0,0,0,0,24,77,0,0,80,88,0,0,0,0,0,0,0,0,0,0,56,77,0,0,136,87,0,0,0,0,0,0,0,0,0,0,128,77,0,0,128,86,0,0,0,0,0,0,0,0,0,0,168,77,0,0,128,86,0,0,0,0,0,0,0,0,0,0,208,77,0,0,104,87,0,0,0,0,0,0,0,0,0,0,24,78,0,0,0,0,0,0,80,78,0,0,0,0,0,0,136,78,0,0,0,0,0,0,168,78,0,0,224,87,0,0,0,0,0,0,32,70,0,0,216,78,0,0,3,0,0,0,2,0,0,0,16,88,0,0,2,0,0,0,224,87,0,0,2,8,0,0,0,0,0,0,8,79,0,0,0,0,0,0,40,79,0,0,0,0,0,0,72,79,0,0,0,0,0,0,104,79,0,0,32,70,0,0,128,79,0,0,0,0,0,0,1,0,0,0,248,83,0,0,3,244,255,255,32,70,0,0,176,79,0,0,0,0,0,0,1,0,0,0,8,84,0,0,3,244,255,255,32,70,0,0,224,79,0,0,0,0,0,0,1,0,0,0,248,83,0,0,3,244,255,255,32,70,0,0,16,80,0,0,0,0,0,0,1,0,0,0,8,84,0,0,3,244,255,255,0,0,0,0,64,80,0,0,104,87,0,0,0,0,0,0,0,0,0,0,112,80,0,0,64,83,0,0,0,0,0,0,0,0,0,0,136,80,0,0,0,0,0,0,160,80,0,0,112,87,0,0,0,0,0,0,0,0,0,0,184,80,0,0,96,87,0,0,0,0,0,0,0,0,0,0,216,80,0,0,104,87,0,0,0,0,0,0,0,0,0,0,248,80,0,0,0,0,0,0,24,81,0,0,0,0,0,0,56,81,0,0,0,0,0,0,88,81,0,0,32,70,0,0,120,81,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,32,89,0,0,2,0,0,0,32,70,0,0,152,81,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,32,89,0,0,2,0,0,0,32,70,0,0,184,81,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,32,89,0,0,2,0,0,0,32,70,0,0,216,81,0,0,0,0,0,0,2,0,0,0,160,86,0,0,2,0,0,0,32,89,0,0,2,0,0,0,0,0,0,0,248,81,0,0,0,0,0,0,16,82,0,0,0,0,0,0,40,82,0,0,0,0,0,0,64,82,0,0,96,87,0,0,0,0,0,0,0,0,0,0,88,82,0,0,104,87,0,0,0,0,0,0,0,0,0,0,112,82,0,0,120,89,0,0,0,0,0,0,0,0,0,0,152,82,0,0,120,89,0,0,0,0,0,0,0,0,0,0,192,82,0,0,136,89,0,0,0,0,0,0,0,0,0,0,232,82,0,0,16,83,0,0,0,0,0,0,64,0,0,0,0,0,0,0,16,88,0,0,118,0,0,0,228,0,0,0,192,255,255,255,192,255,255,255,16,88,0,0,150,0,0,0,58,0,0,0,104,0,0,0,0,0,0,0,224,87,0,0,240,0,0,0,4,1,0,0,152,255,255,255,152,255,255,255,224,87,0,0,120,0,0,0,216,0,0,0,48,49,50,51,52,53,54,55,56,57,97,98,99,100,101,102,65,66,67,68,69,70,120,88,43,45,112,80,105,73,110,78,0,0,0,0,0,0,0,0], "i8", ALLOC_NONE, Runtime.GLOBAL_BASE+20480);
  1243. var tempDoublePtr = Runtime.alignMemory(allocate(12, "i8", ALLOC_STATIC), 8);
  1244. assert(tempDoublePtr % 8 == 0);
  1245. function copyTempFloat(ptr) { // functions, because inlining this code increases code size too much
  1246. HEAP8[tempDoublePtr] = HEAP8[ptr];
  1247. HEAP8[tempDoublePtr+1] = HEAP8[ptr+1];
  1248. HEAP8[tempDoublePtr+2] = HEAP8[ptr+2];
  1249. HEAP8[tempDoublePtr+3] = HEAP8[ptr+3];
  1250. }
  1251. function copyTempDouble(ptr) {
  1252. HEAP8[tempDoublePtr] = HEAP8[ptr];
  1253. HEAP8[tempDoublePtr+1] = HEAP8[ptr+1];
  1254. HEAP8[tempDoublePtr+2] = HEAP8[ptr+2];
  1255. HEAP8[tempDoublePtr+3] = HEAP8[ptr+3];
  1256. HEAP8[tempDoublePtr+4] = HEAP8[ptr+4];
  1257. HEAP8[tempDoublePtr+5] = HEAP8[ptr+5];
  1258. HEAP8[tempDoublePtr+6] = HEAP8[ptr+6];
  1259. HEAP8[tempDoublePtr+7] = HEAP8[ptr+7];
  1260. }
  1261. 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};
  1262. 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"};
  1263. var ___errno_state=0;function ___setErrNo(value) {
  1264. // For convenient setting and returning of errno.
  1265. HEAP32[((___errno_state)>>2)]=value;
  1266. return value;
  1267. }
  1268. var PATH={splitPath:function (filename) {
  1269. var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
  1270. return splitPathRe.exec(filename).slice(1);
  1271. },normalizeArray:function (parts, allowAboveRoot) {
  1272. // if the path tries to go above the root, `up` ends up > 0
  1273. var up = 0;
  1274. for (var i = parts.length - 1; i >= 0; i--) {
  1275. var last = parts[i];
  1276. if (last === '.') {
  1277. parts.splice(i, 1);
  1278. } else if (last === '..') {
  1279. parts.splice(i, 1);
  1280. up++;
  1281. } else if (up) {
  1282. parts.splice(i, 1);
  1283. up--;
  1284. }
  1285. }
  1286. // if the path is allowed to go above the root, restore leading ..s
  1287. if (allowAboveRoot) {
  1288. for (; up--; up) {
  1289. parts.unshift('..');
  1290. }
  1291. }
  1292. return parts;
  1293. },normalize:function (path) {
  1294. var isAbsolute = path.charAt(0) === '/',
  1295. trailingSlash = path.substr(-1) === '/';
  1296. // Normalize the path
  1297. path = PATH.normalizeArray(path.split('/').filter(function(p) {
  1298. return !!p;
  1299. }), !isAbsolute).join('/');
  1300. if (!path && !isAbsolute) {
  1301. path = '.';
  1302. }
  1303. if (path && trailingSlash) {
  1304. path += '/';
  1305. }
  1306. return (isAbsolute ? '/' : '') + path;
  1307. },dirname:function (path) {
  1308. var result = PATH.splitPath(path),
  1309. root = result[0],
  1310. dir = result[1];
  1311. if (!root && !dir) {
  1312. // No dirname whatsoever
  1313. return '.';
  1314. }
  1315. if (dir) {
  1316. // It has a dirname, strip trailing slash
  1317. dir = dir.substr(0, dir.length - 1);
  1318. }
  1319. return root + dir;
  1320. },basename:function (path) {
  1321. // EMSCRIPTEN return '/'' for '/', not an empty string
  1322. if (path === '/') return '/';
  1323. var lastSlash = path.lastIndexOf('/');
  1324. if (lastSlash === -1) return path;
  1325. return path.substr(lastSlash+1);
  1326. },extname:function (path) {
  1327. return PATH.splitPath(path)[3];
  1328. },join:function () {
  1329. var paths = Array.prototype.slice.call(arguments, 0);
  1330. return PATH.normalize(paths.join('/'));
  1331. },join2:function (l, r) {
  1332. return PATH.normalize(l + '/' + r);
  1333. },resolve:function () {
  1334. var resolvedPath = '',
  1335. resolvedAbsolute = false;
  1336. for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
  1337. var path = (i >= 0) ? arguments[i] : FS.cwd();
  1338. // Skip empty and invalid entries
  1339. if (typeof path !== 'string') {
  1340. throw new TypeError('Arguments to path.resolve must be strings');
  1341. } else if (!path) {
  1342. continue;
  1343. }
  1344. resolvedPath = path + '/' + resolvedPath;
  1345. resolvedAbsolute = path.charAt(0) === '/';
  1346. }
  1347. // At this point the path should be resolved to a full absolute path, but
  1348. // handle relative paths to be safe (might happen when process.cwd() fails)
  1349. resolvedPath = PATH.normalizeArray(resolvedPath.split('/').filter(function(p) {
  1350. return !!p;
  1351. }), !resolvedAbsolute).join('/');
  1352. return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
  1353. },relative:function (from, to) {
  1354. from = PATH.resolve(from).substr(1);
  1355. to = PATH.resolve(to).substr(1);
  1356. function trim(arr) {
  1357. var start = 0;
  1358. for (; start < arr.length; start++) {
  1359. if (arr[start] !== '') break;
  1360. }
  1361. var end = arr.length - 1;
  1362. for (; end >= 0; end--) {
  1363. if (arr[end] !== '') break;
  1364. }
  1365. if (start > end) return [];
  1366. return arr.slice(start, end - start + 1);
  1367. }
  1368. var fromParts = trim(from.split('/'));
  1369. var toParts = trim(to.split('/'));
  1370. var length = Math.min(fromParts.length, toParts.length);
  1371. var samePartsLength = length;
  1372. for (var i = 0; i < length; i++) {
  1373. if (fromParts[i] !== toParts[i]) {
  1374. samePartsLength = i;
  1375. break;
  1376. }
  1377. }
  1378. var outputParts = [];
  1379. for (var i = samePartsLength; i < fromParts.length; i++) {
  1380. outputParts.push('..');
  1381. }
  1382. outputParts = outputParts.concat(toParts.slice(samePartsLength));
  1383. return outputParts.join('/');
  1384. }};
  1385. var TTY={ttys:[],init:function () {
  1386. // https://github.com/kripken/emscripten/pull/1555
  1387. // if (ENVIRONMENT_IS_NODE) {
  1388. // // currently, FS.init does not distinguish if process.stdin is a file or TTY
  1389. // // device, it always assumes it's a TTY device. because of this, we're forcing
  1390. // // process.stdin to UTF8 encoding to at least make stdin reading compatible
  1391. // // with text files until FS.init can be refactored.
  1392. // process['stdin']['setEncoding']('utf8');
  1393. // }
  1394. },shutdown:function () {
  1395. // https://github.com/kripken/emscripten/pull/1555
  1396. // if (ENVIRONMENT_IS_NODE) {
  1397. // // inolen: any idea as to why node -e 'process.stdin.read()' wouldn't exit immediately (with process.stdin being a tty)?
  1398. // // 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
  1399. // // inolen: I thought read() in that case was a synchronous operation that just grabbed some amount of buffered data if it exists?
  1400. // // isaacs: it is. but it also triggers a _read() call, which calls readStart() on the handle
  1401. // // isaacs: do process.stdin.pause() and i'd think it'd probably close the pending call
  1402. // process['stdin']['pause']();
  1403. // }
  1404. },register:function (dev, ops) {
  1405. TTY.ttys[dev] = { input: [], output: [], ops: ops };
  1406. FS.registerDevice(dev, TTY.stream_ops);
  1407. },stream_ops:{open:function (stream) {
  1408. var tty = TTY.ttys[stream.node.rdev];
  1409. if (!tty) {
  1410. throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
  1411. }
  1412. stream.tty = tty;
  1413. stream.seekable = false;
  1414. },close:function (stream) {
  1415. // flush any pending line data
  1416. if (stream.tty.output.length) {
  1417. stream.tty.ops.put_char(stream.tty, 10);
  1418. }
  1419. },read:function (stream, buffer, offset, length, pos /* ignored */) {
  1420. if (!stream.tty || !stream.tty.ops.get_char) {
  1421. throw new FS.ErrnoError(ERRNO_CODES.ENXIO);
  1422. }
  1423. var bytesRead = 0;
  1424. for (var i = 0; i < length; i++) {
  1425. var result;
  1426. try {
  1427. result = stream.tty.ops.get_char(stream.tty);
  1428. } catch (e) {
  1429. throw new FS.ErrnoError(ERRNO_CODES.EIO);
  1430. }
  1431. if (result === undefined && bytesRead === 0) {
  1432. throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
  1433. }
  1434. if (result === null || result === undefined) break;
  1435. bytesRead++;
  1436. buffer[offset+i] = result;
  1437. }
  1438. if (bytesRead) {
  1439. stream.node.timestamp = Date.now();
  1440. }
  1441. return bytesRead;
  1442. },write:function (stream, buffer, offset, length, pos) {
  1443. if (!stream.tty || !stream.tty.ops.put_char) {
  1444. throw new FS.ErrnoError(ERRNO_CODES.ENXIO);
  1445. }
  1446. for (var i = 0; i < length; i++) {
  1447. try {
  1448. stream.tty.ops.put_char(stream.tty, buffer[offset+i]);
  1449. } catch (e) {
  1450. throw new FS.ErrnoError(ERRNO_CODES.EIO);
  1451. }
  1452. }
  1453. if (length) {
  1454. stream.node.timestamp = Date.now();
  1455. }
  1456. return i;
  1457. }},default_tty_ops:{get_char:function (tty) {
  1458. if (!tty.input.length) {
  1459. var result = null;
  1460. if (ENVIRONMENT_IS_NODE) {
  1461. result = process['stdin']['read']();
  1462. if (!result) {
  1463. if (process['stdin']['_readableState'] && process['stdin']['_readableState']['ended']) {
  1464. return null; // EOF
  1465. }
  1466. return undefined; // no data available
  1467. }
  1468. } else if (typeof window != 'undefined' &&
  1469. typeof window.prompt == 'function') {
  1470. // Browser.
  1471. result = window.prompt('Input: '); // returns null on cancel
  1472. if (result !== null) {
  1473. result += '\n';
  1474. }
  1475. } else if (typeof readline == 'function') {
  1476. // Command line.
  1477. result = readline();
  1478. if (result !== null) {
  1479. result += '\n';
  1480. }
  1481. }
  1482. if (!result) {
  1483. return null;
  1484. }
  1485. tty.input = intArrayFromString(result, true);
  1486. }
  1487. return tty.input.shift();
  1488. },put_char:function (tty, val) {
  1489. if (val === null || val === 10) {
  1490. Module['print'](tty.output.join(''));
  1491. tty.output = [];
  1492. } else {
  1493. tty.output.push(TTY.utf8.processCChar(val));
  1494. }
  1495. }},default_tty1_ops:{put_char:function (tty, val) {
  1496. if (val === null || val === 10) {
  1497. Module['printErr'](tty.output.join(''));
  1498. tty.output = [];
  1499. } else {
  1500. tty.output.push(TTY.utf8.processCChar(val));
  1501. }
  1502. }}};
  1503. var MEMFS={ops_table:null,CONTENT_OWNING:1,CONTENT_FLEXIBLE:2,CONTENT_FIXED:3,mount:function (mount) {
  1504. return MEMFS.createNode(null, '/', 16384 | 0777, 0);
  1505. },createNode:function (parent, name, mode, dev) {
  1506. if (FS.isBlkdev(mode) || FS.isFIFO(mode)) {
  1507. // no supported
  1508. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  1509. }
  1510. if (!MEMFS.ops_table) {
  1511. MEMFS.ops_table = {
  1512. dir: {
  1513. node: {
  1514. getattr: MEMFS.node_ops.getattr,
  1515. setattr: MEMFS.node_ops.setattr,
  1516. lookup: MEMFS.node_ops.lookup,
  1517. mknod: MEMFS.node_ops.mknod,
  1518. mknod: MEMFS.node_ops.mknod,
  1519. rename: MEMFS.node_ops.rename,
  1520. unlink: MEMFS.node_ops.unlink,
  1521. rmdir: MEMFS.node_ops.rmdir,
  1522. readdir: MEMFS.node_ops.readdir,
  1523. symlink: MEMFS.node_ops.symlink
  1524. },
  1525. stream: {
  1526. llseek: MEMFS.stream_ops.llseek
  1527. }
  1528. },
  1529. file: {
  1530. node: {
  1531. getattr: MEMFS.node_ops.getattr,
  1532. setattr: MEMFS.node_ops.setattr
  1533. },
  1534. stream: {
  1535. llseek: MEMFS.stream_ops.llseek,
  1536. read: MEMFS.stream_ops.read,
  1537. write: MEMFS.stream_ops.write,
  1538. allocate: MEMFS.stream_ops.allocate,
  1539. mmap: MEMFS.stream_ops.mmap
  1540. }
  1541. },
  1542. link: {
  1543. node: {
  1544. getattr: MEMFS.node_ops.getattr,
  1545. setattr: MEMFS.node_ops.setattr,
  1546. readlink: MEMFS.node_ops.readlink
  1547. },
  1548. stream: {}
  1549. },
  1550. chrdev: {
  1551. node: {
  1552. getattr: MEMFS.node_ops.getattr,
  1553. setattr: MEMFS.node_ops.setattr
  1554. },
  1555. stream: FS.chrdev_stream_ops
  1556. },
  1557. };
  1558. }
  1559. var node = FS.createNode(parent, name, mode, dev);
  1560. if (FS.isDir(node.mode)) {
  1561. node.node_ops = MEMFS.ops_table.dir.node;
  1562. node.stream_ops = MEMFS.ops_table.dir.stream;
  1563. node.contents = {};
  1564. } else if (FS.isFile(node.mode)) {
  1565. node.node_ops = MEMFS.ops_table.file.node;
  1566. node.stream_ops = MEMFS.ops_table.file.stream;
  1567. node.contents = [];
  1568. node.contentMode = MEMFS.CONTENT_FLEXIBLE;
  1569. } else if (FS.isLink(node.mode)) {
  1570. node.node_ops = MEMFS.ops_table.link.node;
  1571. node.stream_ops = MEMFS.ops_table.link.stream;
  1572. } else if (FS.isChrdev(node.mode)) {
  1573. node.node_ops = MEMFS.ops_table.chrdev.node;
  1574. node.stream_ops = MEMFS.ops_table.chrdev.stream;
  1575. }
  1576. node.timestamp = Date.now();
  1577. // add the new node to the parent
  1578. if (parent) {
  1579. parent.contents[name] = node;
  1580. }
  1581. return node;
  1582. },ensureFlexible:function (node) {
  1583. if (node.contentMode !== MEMFS.CONTENT_FLEXIBLE) {
  1584. var contents = node.contents;
  1585. node.contents = Array.prototype.slice.call(contents);
  1586. node.contentMode = MEMFS.CONTENT_FLEXIBLE;
  1587. }
  1588. },node_ops:{getattr:function (node) {
  1589. var attr = {};
  1590. // device numbers reuse inode numbers.
  1591. attr.dev = FS.isChrdev(node.mode) ? node.id : 1;
  1592. attr.ino = node.id;
  1593. attr.mode = node.mode;
  1594. attr.nlink = 1;
  1595. attr.uid = 0;
  1596. attr.gid = 0;
  1597. attr.rdev = node.rdev;
  1598. if (FS.isDir(node.mode)) {
  1599. attr.size = 4096;
  1600. } else if (FS.isFile(node.mode)) {
  1601. attr.size = node.contents.length;
  1602. } else if (FS.isLink(node.mode)) {
  1603. attr.size = node.link.length;
  1604. } else {
  1605. attr.size = 0;
  1606. }
  1607. attr.atime = new Date(node.timestamp);
  1608. attr.mtime = new Date(node.timestamp);
  1609. attr.ctime = new Date(node.timestamp);
  1610. // NOTE: In our implementation, st_blocks = Math.ceil(st_size/st_blksize),
  1611. // but this is not required by the standard.
  1612. attr.blksize = 4096;
  1613. attr.blocks = Math.ceil(attr.size / attr.blksize);
  1614. return attr;
  1615. },setattr:function (node, attr) {
  1616. if (attr.mode !== undefined) {
  1617. node.mode = attr.mode;
  1618. }
  1619. if (attr.timestamp !== undefined) {
  1620. node.timestamp = attr.timestamp;
  1621. }
  1622. if (attr.size !== undefined) {
  1623. MEMFS.ensureFlexible(node);
  1624. var contents = node.contents;
  1625. if (attr.size < contents.length) contents.length = attr.size;
  1626. else while (attr.size > contents.length) contents.push(0);
  1627. }
  1628. },lookup:function (parent, name) {
  1629. throw FS.genericErrors[ERRNO_CODES.ENOENT];
  1630. },mknod:function (parent, name, mode, dev) {
  1631. return MEMFS.createNode(parent, name, mode, dev);
  1632. },rename:function (old_node, new_dir, new_name) {
  1633. // if we're overwriting a directory at new_name, make sure it's empty.
  1634. if (FS.isDir(old_node.mode)) {
  1635. var new_node;
  1636. try {
  1637. new_node = FS.lookupNode(new_dir, new_name);
  1638. } catch (e) {
  1639. }
  1640. if (new_node) {
  1641. for (var i in new_node.contents) {
  1642. throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
  1643. }
  1644. }
  1645. }
  1646. // do the internal rewiring
  1647. delete old_node.parent.contents[old_node.name];
  1648. old_node.name = new_name;
  1649. new_dir.contents[new_name] = old_node;
  1650. old_node.parent = new_dir;
  1651. },unlink:function (parent, name) {
  1652. delete parent.contents[name];
  1653. },rmdir:function (parent, name) {
  1654. var node = FS.lookupNode(parent, name);
  1655. for (var i in node.contents) {
  1656. throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
  1657. }
  1658. delete parent.contents[name];
  1659. },readdir:function (node) {
  1660. var entries = ['.', '..']
  1661. for (var key in node.contents) {
  1662. if (!node.contents.hasOwnProperty(key)) {
  1663. continue;
  1664. }
  1665. entries.push(key);
  1666. }
  1667. return entries;
  1668. },symlink:function (parent, newname, oldpath) {
  1669. var node = MEMFS.createNode(parent, newname, 0777 | 40960, 0);
  1670. node.link = oldpath;
  1671. return node;
  1672. },readlink:function (node) {
  1673. if (!FS.isLink(node.mode)) {
  1674. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  1675. }
  1676. return node.link;
  1677. }},stream_ops:{read:function (stream, buffer, offset, length, position) {
  1678. var contents = stream.node.contents;
  1679. if (position >= contents.length)
  1680. return 0;
  1681. var size = Math.min(contents.length - position, length);
  1682. assert(size >= 0);
  1683. if (size > 8 && contents.subarray) { // non-trivial, and typed array
  1684. buffer.set(contents.subarray(position, position + size), offset);
  1685. } else
  1686. {
  1687. for (var i = 0; i < size; i++) {
  1688. buffer[offset + i] = contents[position + i];
  1689. }
  1690. }
  1691. return size;
  1692. },write:function (stream, buffer, offset, length, position, canOwn) {
  1693. var node = stream.node;
  1694. node.timestamp = Date.now();
  1695. var contents = node.contents;
  1696. if (length && contents.length === 0 && position === 0 && buffer.subarray) {
  1697. // just replace it with the new data
  1698. if (canOwn && offset === 0) {
  1699. node.contents = buffer; // this could be a subarray of Emscripten HEAP, or allocated from some other source.
  1700. node.contentMode = (buffer.buffer === HEAP8.buffer) ? MEMFS.CONTENT_OWNING : MEMFS.CONTENT_FIXED;
  1701. } else {
  1702. node.contents = new Uint8Array(buffer.subarray(offset, offset+length));
  1703. node.contentMode = MEMFS.CONTENT_FIXED;
  1704. }
  1705. return length;
  1706. }
  1707. MEMFS.ensureFlexible(node);
  1708. var contents = node.contents;
  1709. while (contents.length < position) contents.push(0);
  1710. for (var i = 0; i < length; i++) {
  1711. contents[position + i] = buffer[offset + i];
  1712. }
  1713. return length;
  1714. },llseek:function (stream, offset, whence) {
  1715. var position = offset;
  1716. if (whence === 1) { // SEEK_CUR.
  1717. position += stream.position;
  1718. } else if (whence === 2) { // SEEK_END.
  1719. if (FS.isFile(stream.node.mode)) {
  1720. position += stream.node.contents.length;
  1721. }
  1722. }
  1723. if (position < 0) {
  1724. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  1725. }
  1726. stream.ungotten = [];
  1727. stream.position = position;
  1728. return position;
  1729. },allocate:function (stream, offset, length) {
  1730. MEMFS.ensureFlexible(stream.node);
  1731. var contents = stream.node.contents;
  1732. var limit = offset + length;
  1733. while (limit > contents.length) contents.push(0);
  1734. },mmap:function (stream, buffer, offset, length, position, prot, flags) {
  1735. if (!FS.isFile(stream.node.mode)) {
  1736. throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
  1737. }
  1738. var ptr;
  1739. var allocated;
  1740. var contents = stream.node.contents;
  1741. // Only make a new copy when MAP_PRIVATE is specified.
  1742. if ( !(flags & 2) &&
  1743. (contents.buffer === buffer || contents.buffer === buffer.buffer) ) {
  1744. // We can't emulate MAP_SHARED when the file is not backed by the buffer
  1745. // we're mapping to (e.g. the HEAP buffer).
  1746. allocated = false;
  1747. ptr = contents.byteOffset;
  1748. } else {
  1749. // Try to avoid unnecessary slices.
  1750. if (position > 0 || position + length < contents.length) {
  1751. if (contents.subarray) {
  1752. contents = contents.subarray(position, position + length);
  1753. } else {
  1754. contents = Array.prototype.slice.call(contents, position, position + length);
  1755. }
  1756. }
  1757. allocated = true;
  1758. ptr = _malloc(length);
  1759. if (!ptr) {
  1760. throw new FS.ErrnoError(ERRNO_CODES.ENOMEM);
  1761. }
  1762. buffer.set(contents, ptr);
  1763. }
  1764. return { ptr: ptr, allocated: allocated };
  1765. }}};
  1766. var IDBFS={dbs:{},indexedDB:function () {
  1767. return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
  1768. },DB_VERSION:21,DB_STORE_NAME:"FILE_DATA",mount:function (mount) {
  1769. // reuse all of the core MEMFS functionality
  1770. return MEMFS.mount.apply(null, arguments);
  1771. },syncfs:function (mount, populate, callback) {
  1772. IDBFS.getLocalSet(mount, function(err, local) {
  1773. if (err) return callback(err);
  1774. IDBFS.getRemoteSet(mount, function(err, remote) {
  1775. if (err) return callback(err);
  1776. var src = populate ? remote : local;
  1777. var dst = populate ? local : remote;
  1778. IDBFS.reconcile(src, dst, callback);
  1779. });
  1780. });
  1781. },getDB:function (name, callback) {
  1782. // check the cache first
  1783. var db = IDBFS.dbs[name];
  1784. if (db) {
  1785. return callback(null, db);
  1786. }
  1787. var req;
  1788. try {
  1789. req = IDBFS.indexedDB().open(name, IDBFS.DB_VERSION);
  1790. } catch (e) {
  1791. return callback(e);
  1792. }
  1793. req.onupgradeneeded = function(e) {
  1794. var db = e.target.result;
  1795. var transaction = e.target.transaction;
  1796. var fileStore;
  1797. if (db.objectStoreNames.contains(IDBFS.DB_STORE_NAME)) {
  1798. fileStore = transaction.objectStore(IDBFS.DB_STORE_NAME);
  1799. } else {
  1800. fileStore = db.createObjectStore(IDBFS.DB_STORE_NAME);
  1801. }
  1802. fileStore.createIndex('timestamp', 'timestamp', { unique: false });
  1803. };
  1804. req.onsuccess = function() {
  1805. db = req.result;
  1806. // add to the cache
  1807. IDBFS.dbs[name] = db;
  1808. callback(null, db);
  1809. };
  1810. req.onerror = function() {
  1811. callback(this.error);
  1812. };
  1813. },getLocalSet:function (mount, callback) {
  1814. var entries = {};
  1815. function isRealDir(p) {
  1816. return p !== '.' && p !== '..';
  1817. };
  1818. function toAbsolute(root) {
  1819. return function(p) {
  1820. return PATH.join2(root, p);
  1821. }
  1822. };
  1823. var check = FS.readdir(mount.mountpoint).filter(isRealDir).map(toAbsolute(mount.mountpoint));
  1824. while (check.length) {
  1825. var path = check.pop();
  1826. var stat;
  1827. try {
  1828. stat = FS.stat(path);
  1829. } catch (e) {
  1830. return callback(e);
  1831. }
  1832. if (FS.isDir(stat.mode)) {
  1833. check.push.apply(check, FS.readdir(path).filter(isRealDir).map(toAbsolute(path)));
  1834. }
  1835. entries[path] = { timestamp: stat.mtime };
  1836. }
  1837. return callback(null, { type: 'local', entries: entries });
  1838. },getRemoteSet:function (mount, callback) {
  1839. var entries = {};
  1840. IDBFS.getDB(mount.mountpoint, function(err, db) {
  1841. if (err) return callback(err);
  1842. var transaction = db.transaction([IDBFS.DB_STORE_NAME], 'readonly');
  1843. transaction.onerror = function() { callback(this.error); };
  1844. var store = transaction.objectStore(IDBFS.DB_STORE_NAME);
  1845. var index = store.index('timestamp');
  1846. index.openKeyCursor().onsuccess = function(event) {
  1847. var cursor = event.target.result;
  1848. if (!cursor) {
  1849. return callback(null, { type: 'remote', db: db, entries: entries });
  1850. }
  1851. entries[cursor.primaryKey] = { timestamp: cursor.key };
  1852. cursor.continue();
  1853. };
  1854. });
  1855. },loadLocalEntry:function (path, callback) {
  1856. var stat, node;
  1857. try {
  1858. var lookup = FS.lookupPath(path);
  1859. node = lookup.node;
  1860. stat = FS.stat(path);
  1861. } catch (e) {
  1862. return callback(e);
  1863. }
  1864. if (FS.isDir(stat.mode)) {
  1865. return callback(null, { timestamp: stat.mtime, mode: stat.mode });
  1866. } else if (FS.isFile(stat.mode)) {
  1867. return callback(null, { timestamp: stat.mtime, mode: stat.mode, contents: node.contents });
  1868. } else {
  1869. return callback(new Error('node type not supported'));
  1870. }
  1871. },storeLocalEntry:function (path, entry, callback) {
  1872. try {
  1873. if (FS.isDir(entry.mode)) {
  1874. FS.mkdir(path, entry.mode);
  1875. } else if (FS.isFile(entry.mode)) {
  1876. FS.writeFile(path, entry.contents, { encoding: 'binary', canOwn: true });
  1877. } else {
  1878. return callback(new Error('node type not supported'));
  1879. }
  1880. FS.utime(path, entry.timestamp, entry.timestamp);
  1881. } catch (e) {
  1882. return callback(e);
  1883. }
  1884. callback(null);
  1885. },removeLocalEntry:function (path, callback) {
  1886. try {
  1887. var lookup = FS.lookupPath(path);
  1888. var stat = FS.stat(path);
  1889. if (FS.isDir(stat.mode)) {
  1890. FS.rmdir(path);
  1891. } else if (FS.isFile(stat.mode)) {
  1892. FS.unlink(path);
  1893. }
  1894. } catch (e) {
  1895. return callback(e);
  1896. }
  1897. callback(null);
  1898. },loadRemoteEntry:function (store, path, callback) {
  1899. var req = store.get(path);
  1900. req.onsuccess = function(event) { callback(null, event.target.result); };
  1901. req.onerror = function() { callback(this.error); };
  1902. },storeRemoteEntry:function (store, path, entry, callback) {
  1903. var req = store.put(entry, path);
  1904. req.onsuccess = function() { callback(null); };
  1905. req.onerror = function() { callback(this.error); };
  1906. },removeRemoteEntry:function (store, path, callback) {
  1907. var req = store.delete(path);
  1908. req.onsuccess = function() { callback(null); };
  1909. req.onerror = function() { callback(this.error); };
  1910. },reconcile:function (src, dst, callback) {
  1911. var total = 0;
  1912. var create = [];
  1913. Object.keys(src.entries).forEach(function (key) {
  1914. var e = src.entries[key];
  1915. var e2 = dst.entries[key];
  1916. if (!e2 || e.timestamp > e2.timestamp) {
  1917. create.push(key);
  1918. total++;
  1919. }
  1920. });
  1921. var remove = [];
  1922. Object.keys(dst.entries).forEach(function (key) {
  1923. var e = dst.entries[key];
  1924. var e2 = src.entries[key];
  1925. if (!e2) {
  1926. remove.push(key);
  1927. total++;
  1928. }
  1929. });
  1930. if (!total) {
  1931. return callback(null);
  1932. }
  1933. var errored = false;
  1934. var completed = 0;
  1935. var db = src.type === 'remote' ? src.db : dst.db;
  1936. var transaction = db.transaction([IDBFS.DB_STORE_NAME], 'readwrite');
  1937. var store = transaction.objectStore(IDBFS.DB_STORE_NAME);
  1938. function done(err) {
  1939. if (err) {
  1940. if (!done.errored) {
  1941. done.errored = true;
  1942. return callback(err);
  1943. }
  1944. return;
  1945. }
  1946. if (++completed >= total) {
  1947. return callback(null);
  1948. }
  1949. };
  1950. transaction.onerror = function() { done(this.error); };
  1951. // sort paths in ascending order so directory entries are created
  1952. // before the files inside them
  1953. create.sort().forEach(function (path) {
  1954. if (dst.type === 'local') {
  1955. IDBFS.loadRemoteEntry(store, path, function (err, entry) {
  1956. if (err) return done(err);
  1957. IDBFS.storeLocalEntry(path, entry, done);
  1958. });
  1959. } else {
  1960. IDBFS.loadLocalEntry(path, function (err, entry) {
  1961. if (err) return done(err);
  1962. IDBFS.storeRemoteEntry(store, path, entry, done);
  1963. });
  1964. }
  1965. });
  1966. // sort paths in descending order so files are deleted before their
  1967. // parent directories
  1968. remove.sort().reverse().forEach(function(path) {
  1969. if (dst.type === 'local') {
  1970. IDBFS.removeLocalEntry(path, done);
  1971. } else {
  1972. IDBFS.removeRemoteEntry(store, path, done);
  1973. }
  1974. });
  1975. }};
  1976. var NODEFS={isWindows:false,staticInit:function () {
  1977. NODEFS.isWindows = !!process.platform.match(/^win/);
  1978. },mount:function (mount) {
  1979. assert(ENVIRONMENT_IS_NODE);
  1980. return NODEFS.createNode(null, '/', NODEFS.getMode(mount.opts.root), 0);
  1981. },createNode:function (parent, name, mode, dev) {
  1982. if (!FS.isDir(mode) && !FS.isFile(mode) && !FS.isLink(mode)) {
  1983. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  1984. }
  1985. var node = FS.createNode(parent, name, mode);
  1986. node.node_ops = NODEFS.node_ops;
  1987. node.stream_ops = NODEFS.stream_ops;
  1988. return node;
  1989. },getMode:function (path) {
  1990. var stat;
  1991. try {
  1992. stat = fs.lstatSync(path);
  1993. if (NODEFS.isWindows) {
  1994. // On Windows, directories return permission bits 'rw-rw-rw-', even though they have 'rwxrwxrwx', so
  1995. // propagate write bits to execute bits.
  1996. stat.mode = stat.mode | ((stat.mode & 146) >> 1);
  1997. }
  1998. } catch (e) {
  1999. if (!e.code) throw e;
  2000. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2001. }
  2002. return stat.mode;
  2003. },realPath:function (node) {
  2004. var parts = [];
  2005. while (node.parent !== node) {
  2006. parts.push(node.name);
  2007. node = node.parent;
  2008. }
  2009. parts.push(node.mount.opts.root);
  2010. parts.reverse();
  2011. return PATH.join.apply(null, parts);
  2012. },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) {
  2013. if (flags in NODEFS.flagsToPermissionStringMap) {
  2014. return NODEFS.flagsToPermissionStringMap[flags];
  2015. } else {
  2016. return flags;
  2017. }
  2018. },node_ops:{getattr:function (node) {
  2019. var path = NODEFS.realPath(node);
  2020. var stat;
  2021. try {
  2022. stat = fs.lstatSync(path);
  2023. } catch (e) {
  2024. if (!e.code) throw e;
  2025. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2026. }
  2027. // node.js v0.10.20 doesn't report blksize and blocks on Windows. Fake them with default blksize of 4096.
  2028. // See http://support.microsoft.com/kb/140365
  2029. if (NODEFS.isWindows && !stat.blksize) {
  2030. stat.blksize = 4096;
  2031. }
  2032. if (NODEFS.isWindows && !stat.blocks) {
  2033. stat.blocks = (stat.size+stat.blksize-1)/stat.blksize|0;
  2034. }
  2035. return {
  2036. dev: stat.dev,
  2037. ino: stat.ino,
  2038. mode: stat.mode,
  2039. nlink: stat.nlink,
  2040. uid: stat.uid,
  2041. gid: stat.gid,
  2042. rdev: stat.rdev,
  2043. size: stat.size,
  2044. atime: stat.atime,
  2045. mtime: stat.mtime,
  2046. ctime: stat.ctime,
  2047. blksize: stat.blksize,
  2048. blocks: stat.blocks
  2049. };
  2050. },setattr:function (node, attr) {
  2051. var path = NODEFS.realPath(node);
  2052. try {
  2053. if (attr.mode !== undefined) {
  2054. fs.chmodSync(path, attr.mode);
  2055. // update the common node structure mode as well
  2056. node.mode = attr.mode;
  2057. }
  2058. if (attr.timestamp !== undefined) {
  2059. var date = new Date(attr.timestamp);
  2060. fs.utimesSync(path, date, date);
  2061. }
  2062. if (attr.size !== undefined) {
  2063. fs.truncateSync(path, attr.size);
  2064. }
  2065. } catch (e) {
  2066. if (!e.code) throw e;
  2067. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2068. }
  2069. },lookup:function (parent, name) {
  2070. var path = PATH.join2(NODEFS.realPath(parent), name);
  2071. var mode = NODEFS.getMode(path);
  2072. return NODEFS.createNode(parent, name, mode);
  2073. },mknod:function (parent, name, mode, dev) {
  2074. var node = NODEFS.createNode(parent, name, mode, dev);
  2075. // create the backing node for this in the fs root as well
  2076. var path = NODEFS.realPath(node);
  2077. try {
  2078. if (FS.isDir(node.mode)) {
  2079. fs.mkdirSync(path, node.mode);
  2080. } else {
  2081. fs.writeFileSync(path, '', { mode: node.mode });
  2082. }
  2083. } catch (e) {
  2084. if (!e.code) throw e;
  2085. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2086. }
  2087. return node;
  2088. },rename:function (oldNode, newDir, newName) {
  2089. var oldPath = NODEFS.realPath(oldNode);
  2090. var newPath = PATH.join2(NODEFS.realPath(newDir), newName);
  2091. try {
  2092. fs.renameSync(oldPath, newPath);
  2093. } catch (e) {
  2094. if (!e.code) throw e;
  2095. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2096. }
  2097. },unlink:function (parent, name) {
  2098. var path = PATH.join2(NODEFS.realPath(parent), name);
  2099. try {
  2100. fs.unlinkSync(path);
  2101. } catch (e) {
  2102. if (!e.code) throw e;
  2103. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2104. }
  2105. },rmdir:function (parent, name) {
  2106. var path = PATH.join2(NODEFS.realPath(parent), name);
  2107. try {
  2108. fs.rmdirSync(path);
  2109. } catch (e) {
  2110. if (!e.code) throw e;
  2111. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2112. }
  2113. },readdir:function (node) {
  2114. var path = NODEFS.realPath(node);
  2115. try {
  2116. return fs.readdirSync(path);
  2117. } catch (e) {
  2118. if (!e.code) throw e;
  2119. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2120. }
  2121. },symlink:function (parent, newName, oldPath) {
  2122. var newPath = PATH.join2(NODEFS.realPath(parent), newName);
  2123. try {
  2124. fs.symlinkSync(oldPath, newPath);
  2125. } catch (e) {
  2126. if (!e.code) throw e;
  2127. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2128. }
  2129. },readlink:function (node) {
  2130. var path = NODEFS.realPath(node);
  2131. try {
  2132. return fs.readlinkSync(path);
  2133. } catch (e) {
  2134. if (!e.code) throw e;
  2135. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2136. }
  2137. }},stream_ops:{open:function (stream) {
  2138. var path = NODEFS.realPath(stream.node);
  2139. try {
  2140. if (FS.isFile(stream.node.mode)) {
  2141. stream.nfd = fs.openSync(path, NODEFS.flagsToPermissionString(stream.flags));
  2142. }
  2143. } catch (e) {
  2144. if (!e.code) throw e;
  2145. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2146. }
  2147. },close:function (stream) {
  2148. try {
  2149. if (FS.isFile(stream.node.mode) && stream.nfd) {
  2150. fs.closeSync(stream.nfd);
  2151. }
  2152. } catch (e) {
  2153. if (!e.code) throw e;
  2154. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2155. }
  2156. },read:function (stream, buffer, offset, length, position) {
  2157. // FIXME this is terrible.
  2158. var nbuffer = new Buffer(length);
  2159. var res;
  2160. try {
  2161. res = fs.readSync(stream.nfd, nbuffer, 0, length, position);
  2162. } catch (e) {
  2163. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2164. }
  2165. if (res > 0) {
  2166. for (var i = 0; i < res; i++) {
  2167. buffer[offset + i] = nbuffer[i];
  2168. }
  2169. }
  2170. return res;
  2171. },write:function (stream, buffer, offset, length, position) {
  2172. // FIXME this is terrible.
  2173. var nbuffer = new Buffer(buffer.subarray(offset, offset + length));
  2174. var res;
  2175. try {
  2176. res = fs.writeSync(stream.nfd, nbuffer, 0, length, position);
  2177. } catch (e) {
  2178. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2179. }
  2180. return res;
  2181. },llseek:function (stream, offset, whence) {
  2182. var position = offset;
  2183. if (whence === 1) { // SEEK_CUR.
  2184. position += stream.position;
  2185. } else if (whence === 2) { // SEEK_END.
  2186. if (FS.isFile(stream.node.mode)) {
  2187. try {
  2188. var stat = fs.fstatSync(stream.nfd);
  2189. position += stat.size;
  2190. } catch (e) {
  2191. throw new FS.ErrnoError(ERRNO_CODES[e.code]);
  2192. }
  2193. }
  2194. }
  2195. if (position < 0) {
  2196. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2197. }
  2198. stream.position = position;
  2199. return position;
  2200. }}};
  2201. var _stdin=allocate(1, "i32*", ALLOC_STATIC);
  2202. var _stdout=allocate(1, "i32*", ALLOC_STATIC);
  2203. var _stderr=allocate(1, "i32*", ALLOC_STATIC);
  2204. function _fflush(stream) {
  2205. // int fflush(FILE *stream);
  2206. // http://pubs.opengroup.org/onlinepubs/000095399/functions/fflush.html
  2207. // we don't currently perform any user-space buffering of data
  2208. }var FS={root:null,mounts:[],devices:[null],streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},handleFSError:function (e) {
  2209. if (!(e instanceof FS.ErrnoError)) throw e + ' : ' + stackTrace();
  2210. return ___setErrNo(e.errno);
  2211. },lookupPath:function (path, opts) {
  2212. path = PATH.resolve(FS.cwd(), path);
  2213. opts = opts || {};
  2214. var defaults = {
  2215. follow_mount: true,
  2216. recurse_count: 0
  2217. };
  2218. for (var key in defaults) {
  2219. if (opts[key] === undefined) {
  2220. opts[key] = defaults[key];
  2221. }
  2222. }
  2223. if (opts.recurse_count > 8) { // max recursive lookup of 8
  2224. throw new FS.ErrnoError(ERRNO_CODES.ELOOP);
  2225. }
  2226. // split the path
  2227. var parts = PATH.normalizeArray(path.split('/').filter(function(p) {
  2228. return !!p;
  2229. }), false);
  2230. // start at the root
  2231. var current = FS.root;
  2232. var current_path = '/';
  2233. for (var i = 0; i < parts.length; i++) {
  2234. var islast = (i === parts.length-1);
  2235. if (islast && opts.parent) {
  2236. // stop resolving
  2237. break;
  2238. }
  2239. current = FS.lookupNode(current, parts[i]);
  2240. current_path = PATH.join2(current_path, parts[i]);
  2241. // jump to the mount's root node if this is a mountpoint
  2242. if (FS.isMountpoint(current)) {
  2243. if (!islast || (islast && opts.follow_mount)) {
  2244. current = current.mounted.root;
  2245. }
  2246. }
  2247. // by default, lookupPath will not follow a symlink if it is the final path component.
  2248. // setting opts.follow = true will override this behavior.
  2249. if (!islast || opts.follow) {
  2250. var count = 0;
  2251. while (FS.isLink(current.mode)) {
  2252. var link = FS.readlink(current_path);
  2253. current_path = PATH.resolve(PATH.dirname(current_path), link);
  2254. var lookup = FS.lookupPath(current_path, { recurse_count: opts.recurse_count });
  2255. current = lookup.node;
  2256. if (count++ > 40) { // limit max consecutive symlinks to 40 (SYMLOOP_MAX).
  2257. throw new FS.ErrnoError(ERRNO_CODES.ELOOP);
  2258. }
  2259. }
  2260. }
  2261. }
  2262. return { path: current_path, node: current };
  2263. },getPath:function (node) {
  2264. var path;
  2265. while (true) {
  2266. if (FS.isRoot(node)) {
  2267. var mount = node.mount.mountpoint;
  2268. if (!path) return mount;
  2269. return mount[mount.length-1] !== '/' ? mount + '/' + path : mount + path;
  2270. }
  2271. path = path ? node.name + '/' + path : node.name;
  2272. node = node.parent;
  2273. }
  2274. },hashName:function (parentid, name) {
  2275. var hash = 0;
  2276. for (var i = 0; i < name.length; i++) {
  2277. hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0;
  2278. }
  2279. return ((parentid + hash) >>> 0) % FS.nameTable.length;
  2280. },hashAddNode:function (node) {
  2281. var hash = FS.hashName(node.parent.id, node.name);
  2282. node.name_next = FS.nameTable[hash];
  2283. FS.nameTable[hash] = node;
  2284. },hashRemoveNode:function (node) {
  2285. var hash = FS.hashName(node.parent.id, node.name);
  2286. if (FS.nameTable[hash] === node) {
  2287. FS.nameTable[hash] = node.name_next;
  2288. } else {
  2289. var current = FS.nameTable[hash];
  2290. while (current) {
  2291. if (current.name_next === node) {
  2292. current.name_next = node.name_next;
  2293. break;
  2294. }
  2295. current = current.name_next;
  2296. }
  2297. }
  2298. },lookupNode:function (parent, name) {
  2299. var err = FS.mayLookup(parent);
  2300. if (err) {
  2301. throw new FS.ErrnoError(err);
  2302. }
  2303. var hash = FS.hashName(parent.id, name);
  2304. for (var node = FS.nameTable[hash]; node; node = node.name_next) {
  2305. var nodeName = node.name;
  2306. if (node.parent.id === parent.id && nodeName === name) {
  2307. return node;
  2308. }
  2309. }
  2310. // if we failed to find it in the cache, call into the VFS
  2311. return FS.lookup(parent, name);
  2312. },createNode:function (parent, name, mode, rdev) {
  2313. if (!FS.FSNode) {
  2314. FS.FSNode = function(parent, name, mode, rdev) {
  2315. if (!parent) {
  2316. parent = this; // root node sets parent to itself
  2317. }
  2318. this.parent = parent;
  2319. this.mount = parent.mount;
  2320. this.mounted = null;
  2321. this.id = FS.nextInode++;
  2322. this.name = name;
  2323. this.mode = mode;
  2324. this.node_ops = {};
  2325. this.stream_ops = {};
  2326. this.rdev = rdev;
  2327. };
  2328. FS.FSNode.prototype = {};
  2329. // compatibility
  2330. var readMode = 292 | 73;
  2331. var writeMode = 146;
  2332. // NOTE we must use Object.defineProperties instead of individual calls to
  2333. // Object.defineProperty in order to make closure compiler happy
  2334. Object.defineProperties(FS.FSNode.prototype, {
  2335. read: {
  2336. get: function() { return (this.mode & readMode) === readMode; },
  2337. set: function(val) { val ? this.mode |= readMode : this.mode &= ~readMode; }
  2338. },
  2339. write: {
  2340. get: function() { return (this.mode & writeMode) === writeMode; },
  2341. set: function(val) { val ? this.mode |= writeMode : this.mode &= ~writeMode; }
  2342. },
  2343. isFolder: {
  2344. get: function() { return FS.isDir(this.mode); },
  2345. },
  2346. isDevice: {
  2347. get: function() { return FS.isChrdev(this.mode); },
  2348. },
  2349. });
  2350. }
  2351. var node = new FS.FSNode(parent, name, mode, rdev);
  2352. FS.hashAddNode(node);
  2353. return node;
  2354. },destroyNode:function (node) {
  2355. FS.hashRemoveNode(node);
  2356. },isRoot:function (node) {
  2357. return node === node.parent;
  2358. },isMountpoint:function (node) {
  2359. return !!node.mounted;
  2360. },isFile:function (mode) {
  2361. return (mode & 61440) === 32768;
  2362. },isDir:function (mode) {
  2363. return (mode & 61440) === 16384;
  2364. },isLink:function (mode) {
  2365. return (mode & 61440) === 40960;
  2366. },isChrdev:function (mode) {
  2367. return (mode & 61440) === 8192;
  2368. },isBlkdev:function (mode) {
  2369. return (mode & 61440) === 24576;
  2370. },isFIFO:function (mode) {
  2371. return (mode & 61440) === 4096;
  2372. },isSocket:function (mode) {
  2373. return (mode & 49152) === 49152;
  2374. },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) {
  2375. var flags = FS.flagModes[str];
  2376. if (typeof flags === 'undefined') {
  2377. throw new Error('Unknown file open mode: ' + str);
  2378. }
  2379. return flags;
  2380. },flagsToPermissionString:function (flag) {
  2381. var accmode = flag & 2097155;
  2382. var perms = ['r', 'w', 'rw'][accmode];
  2383. if ((flag & 512)) {
  2384. perms += 'w';
  2385. }
  2386. return perms;
  2387. },nodePermissions:function (node, perms) {
  2388. if (FS.ignorePermissions) {
  2389. return 0;
  2390. }
  2391. // return 0 if any user, group or owner bits are set.
  2392. if (perms.indexOf('r') !== -1 && !(node.mode & 292)) {
  2393. return ERRNO_CODES.EACCES;
  2394. } else if (perms.indexOf('w') !== -1 && !(node.mode & 146)) {
  2395. return ERRNO_CODES.EACCES;
  2396. } else if (perms.indexOf('x') !== -1 && !(node.mode & 73)) {
  2397. return ERRNO_CODES.EACCES;
  2398. }
  2399. return 0;
  2400. },mayLookup:function (dir) {
  2401. return FS.nodePermissions(dir, 'x');
  2402. },mayCreate:function (dir, name) {
  2403. try {
  2404. var node = FS.lookupNode(dir, name);
  2405. return ERRNO_CODES.EEXIST;
  2406. } catch (e) {
  2407. }
  2408. return FS.nodePermissions(dir, 'wx');
  2409. },mayDelete:function (dir, name, isdir) {
  2410. var node;
  2411. try {
  2412. node = FS.lookupNode(dir, name);
  2413. } catch (e) {
  2414. return e.errno;
  2415. }
  2416. var err = FS.nodePermissions(dir, 'wx');
  2417. if (err) {
  2418. return err;
  2419. }
  2420. if (isdir) {
  2421. if (!FS.isDir(node.mode)) {
  2422. return ERRNO_CODES.ENOTDIR;
  2423. }
  2424. if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) {
  2425. return ERRNO_CODES.EBUSY;
  2426. }
  2427. } else {
  2428. if (FS.isDir(node.mode)) {
  2429. return ERRNO_CODES.EISDIR;
  2430. }
  2431. }
  2432. return 0;
  2433. },mayOpen:function (node, flags) {
  2434. if (!node) {
  2435. return ERRNO_CODES.ENOENT;
  2436. }
  2437. if (FS.isLink(node.mode)) {
  2438. return ERRNO_CODES.ELOOP;
  2439. } else if (FS.isDir(node.mode)) {
  2440. if ((flags & 2097155) !== 0 || // opening for write
  2441. (flags & 512)) {
  2442. return ERRNO_CODES.EISDIR;
  2443. }
  2444. }
  2445. return FS.nodePermissions(node, FS.flagsToPermissionString(flags));
  2446. },MAX_OPEN_FDS:4096,nextfd:function (fd_start, fd_end) {
  2447. fd_start = fd_start || 0;
  2448. fd_end = fd_end || FS.MAX_OPEN_FDS;
  2449. for (var fd = fd_start; fd <= fd_end; fd++) {
  2450. if (!FS.streams[fd]) {
  2451. return fd;
  2452. }
  2453. }
  2454. throw new FS.ErrnoError(ERRNO_CODES.EMFILE);
  2455. },getStream:function (fd) {
  2456. return FS.streams[fd];
  2457. },createStream:function (stream, fd_start, fd_end) {
  2458. if (!FS.FSStream) {
  2459. FS.FSStream = function(){};
  2460. FS.FSStream.prototype = {};
  2461. // compatibility
  2462. Object.defineProperties(FS.FSStream.prototype, {
  2463. object: {
  2464. get: function() { return this.node; },
  2465. set: function(val) { this.node = val; }
  2466. },
  2467. isRead: {
  2468. get: function() { return (this.flags & 2097155) !== 1; }
  2469. },
  2470. isWrite: {
  2471. get: function() { return (this.flags & 2097155) !== 0; }
  2472. },
  2473. isAppend: {
  2474. get: function() { return (this.flags & 1024); }
  2475. }
  2476. });
  2477. }
  2478. if (stream.__proto__) {
  2479. // reuse the object
  2480. stream.__proto__ = FS.FSStream.prototype;
  2481. } else {
  2482. var newStream = new FS.FSStream();
  2483. for (var p in stream) {
  2484. newStream[p] = stream[p];
  2485. }
  2486. stream = newStream;
  2487. }
  2488. var fd = FS.nextfd(fd_start, fd_end);
  2489. stream.fd = fd;
  2490. FS.streams[fd] = stream;
  2491. return stream;
  2492. },closeStream:function (fd) {
  2493. FS.streams[fd] = null;
  2494. },getStreamFromPtr:function (ptr) {
  2495. return FS.streams[ptr - 1];
  2496. },getPtrForStream:function (stream) {
  2497. return stream ? stream.fd + 1 : 0;
  2498. },chrdev_stream_ops:{open:function (stream) {
  2499. var device = FS.getDevice(stream.node.rdev);
  2500. // override node's stream ops with the device's
  2501. stream.stream_ops = device.stream_ops;
  2502. // forward the open call
  2503. if (stream.stream_ops.open) {
  2504. stream.stream_ops.open(stream);
  2505. }
  2506. },llseek:function () {
  2507. throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
  2508. }},major:function (dev) {
  2509. return ((dev) >> 8);
  2510. },minor:function (dev) {
  2511. return ((dev) & 0xff);
  2512. },makedev:function (ma, mi) {
  2513. return ((ma) << 8 | (mi));
  2514. },registerDevice:function (dev, ops) {
  2515. FS.devices[dev] = { stream_ops: ops };
  2516. },getDevice:function (dev) {
  2517. return FS.devices[dev];
  2518. },getMounts:function (mount) {
  2519. var mounts = [];
  2520. var check = [mount];
  2521. while (check.length) {
  2522. var m = check.pop();
  2523. mounts.push(m);
  2524. check.push.apply(check, m.mounts);
  2525. }
  2526. return mounts;
  2527. },syncfs:function (populate, callback) {
  2528. if (typeof(populate) === 'function') {
  2529. callback = populate;
  2530. populate = false;
  2531. }
  2532. var mounts = FS.getMounts(FS.root.mount);
  2533. var completed = 0;
  2534. function done(err) {
  2535. if (err) {
  2536. if (!done.errored) {
  2537. done.errored = true;
  2538. return callback(err);
  2539. }
  2540. return;
  2541. }
  2542. if (++completed >= mounts.length) {
  2543. callback(null);
  2544. }
  2545. };
  2546. // sync all mounts
  2547. mounts.forEach(function (mount) {
  2548. if (!mount.type.syncfs) {
  2549. return done(null);
  2550. }
  2551. mount.type.syncfs(mount, populate, done);
  2552. });
  2553. },mount:function (type, opts, mountpoint) {
  2554. var root = mountpoint === '/';
  2555. var pseudo = !mountpoint;
  2556. var node;
  2557. if (root && FS.root) {
  2558. throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
  2559. } else if (!root && !pseudo) {
  2560. var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
  2561. mountpoint = lookup.path; // use the absolute path
  2562. node = lookup.node;
  2563. if (FS.isMountpoint(node)) {
  2564. throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
  2565. }
  2566. if (!FS.isDir(node.mode)) {
  2567. throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
  2568. }
  2569. }
  2570. var mount = {
  2571. type: type,
  2572. opts: opts,
  2573. mountpoint: mountpoint,
  2574. mounts: []
  2575. };
  2576. // create a root node for the fs
  2577. var mountRoot = type.mount(mount);
  2578. mountRoot.mount = mount;
  2579. mount.root = mountRoot;
  2580. if (root) {
  2581. FS.root = mountRoot;
  2582. } else if (node) {
  2583. // set as a mountpoint
  2584. node.mounted = mount;
  2585. // add the new mount to the current mount's children
  2586. if (node.mount) {
  2587. node.mount.mounts.push(mount);
  2588. }
  2589. }
  2590. return mountRoot;
  2591. },unmount:function (mountpoint) {
  2592. var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
  2593. if (!FS.isMountpoint(lookup.node)) {
  2594. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2595. }
  2596. // destroy the nodes for this mount, and all its child mounts
  2597. var node = lookup.node;
  2598. var mount = node.mounted;
  2599. var mounts = FS.getMounts(mount);
  2600. Object.keys(FS.nameTable).forEach(function (hash) {
  2601. var current = FS.nameTable[hash];
  2602. while (current) {
  2603. var next = current.name_next;
  2604. if (mounts.indexOf(current.mount) !== -1) {
  2605. FS.destroyNode(current);
  2606. }
  2607. current = next;
  2608. }
  2609. });
  2610. // no longer a mountpoint
  2611. node.mounted = null;
  2612. // remove this mount from the child mounts
  2613. var idx = node.mount.mounts.indexOf(mount);
  2614. assert(idx !== -1);
  2615. node.mount.mounts.splice(idx, 1);
  2616. },lookup:function (parent, name) {
  2617. return parent.node_ops.lookup(parent, name);
  2618. },mknod:function (path, mode, dev) {
  2619. var lookup = FS.lookupPath(path, { parent: true });
  2620. var parent = lookup.node;
  2621. var name = PATH.basename(path);
  2622. var err = FS.mayCreate(parent, name);
  2623. if (err) {
  2624. throw new FS.ErrnoError(err);
  2625. }
  2626. if (!parent.node_ops.mknod) {
  2627. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2628. }
  2629. return parent.node_ops.mknod(parent, name, mode, dev);
  2630. },create:function (path, mode) {
  2631. mode = mode !== undefined ? mode : 0666;
  2632. mode &= 4095;
  2633. mode |= 32768;
  2634. return FS.mknod(path, mode, 0);
  2635. },mkdir:function (path, mode) {
  2636. mode = mode !== undefined ? mode : 0777;
  2637. mode &= 511 | 512;
  2638. mode |= 16384;
  2639. return FS.mknod(path, mode, 0);
  2640. },mkdev:function (path, mode, dev) {
  2641. if (typeof(dev) === 'undefined') {
  2642. dev = mode;
  2643. mode = 0666;
  2644. }
  2645. mode |= 8192;
  2646. return FS.mknod(path, mode, dev);
  2647. },symlink:function (oldpath, newpath) {
  2648. var lookup = FS.lookupPath(newpath, { parent: true });
  2649. var parent = lookup.node;
  2650. var newname = PATH.basename(newpath);
  2651. var err = FS.mayCreate(parent, newname);
  2652. if (err) {
  2653. throw new FS.ErrnoError(err);
  2654. }
  2655. if (!parent.node_ops.symlink) {
  2656. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2657. }
  2658. return parent.node_ops.symlink(parent, newname, oldpath);
  2659. },rename:function (old_path, new_path) {
  2660. var old_dirname = PATH.dirname(old_path);
  2661. var new_dirname = PATH.dirname(new_path);
  2662. var old_name = PATH.basename(old_path);
  2663. var new_name = PATH.basename(new_path);
  2664. // parents must exist
  2665. var lookup, old_dir, new_dir;
  2666. try {
  2667. lookup = FS.lookupPath(old_path, { parent: true });
  2668. old_dir = lookup.node;
  2669. lookup = FS.lookupPath(new_path, { parent: true });
  2670. new_dir = lookup.node;
  2671. } catch (e) {
  2672. throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
  2673. }
  2674. // need to be part of the same mount
  2675. if (old_dir.mount !== new_dir.mount) {
  2676. throw new FS.ErrnoError(ERRNO_CODES.EXDEV);
  2677. }
  2678. // source must exist
  2679. var old_node = FS.lookupNode(old_dir, old_name);
  2680. // old path should not be an ancestor of the new path
  2681. var relative = PATH.relative(old_path, new_dirname);
  2682. if (relative.charAt(0) !== '.') {
  2683. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2684. }
  2685. // new path should not be an ancestor of the old path
  2686. relative = PATH.relative(new_path, old_dirname);
  2687. if (relative.charAt(0) !== '.') {
  2688. throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
  2689. }
  2690. // see if the new path already exists
  2691. var new_node;
  2692. try {
  2693. new_node = FS.lookupNode(new_dir, new_name);
  2694. } catch (e) {
  2695. // not fatal
  2696. }
  2697. // early out if nothing needs to change
  2698. if (old_node === new_node) {
  2699. return;
  2700. }
  2701. // we'll need to delete the old entry
  2702. var isdir = FS.isDir(old_node.mode);
  2703. var err = FS.mayDelete(old_dir, old_name, isdir);
  2704. if (err) {
  2705. throw new FS.ErrnoError(err);
  2706. }
  2707. // need delete permissions if we'll be overwriting.
  2708. // need create permissions if new doesn't already exist.
  2709. err = new_node ?
  2710. FS.mayDelete(new_dir, new_name, isdir) :
  2711. FS.mayCreate(new_dir, new_name);
  2712. if (err) {
  2713. throw new FS.ErrnoError(err);
  2714. }
  2715. if (!old_dir.node_ops.rename) {
  2716. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2717. }
  2718. if (FS.isMountpoint(old_node) || (new_node && FS.isMountpoint(new_node))) {
  2719. throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
  2720. }
  2721. // if we are going to change the parent, check write permissions
  2722. if (new_dir !== old_dir) {
  2723. err = FS.nodePermissions(old_dir, 'w');
  2724. if (err) {
  2725. throw new FS.ErrnoError(err);
  2726. }
  2727. }
  2728. // remove the node from the lookup hash
  2729. FS.hashRemoveNode(old_node);
  2730. // do the underlying fs rename
  2731. try {
  2732. old_dir.node_ops.rename(old_node, new_dir, new_name);
  2733. } catch (e) {
  2734. throw e;
  2735. } finally {
  2736. // add the node back to the hash (in case node_ops.rename
  2737. // changed its name)
  2738. FS.hashAddNode(old_node);
  2739. }
  2740. },rmdir:function (path) {
  2741. var lookup = FS.lookupPath(path, { parent: true });
  2742. var parent = lookup.node;
  2743. var name = PATH.basename(path);
  2744. var node = FS.lookupNode(parent, name);
  2745. var err = FS.mayDelete(parent, name, true);
  2746. if (err) {
  2747. throw new FS.ErrnoError(err);
  2748. }
  2749. if (!parent.node_ops.rmdir) {
  2750. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2751. }
  2752. if (FS.isMountpoint(node)) {
  2753. throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
  2754. }
  2755. parent.node_ops.rmdir(parent, name);
  2756. FS.destroyNode(node);
  2757. },readdir:function (path) {
  2758. var lookup = FS.lookupPath(path, { follow: true });
  2759. var node = lookup.node;
  2760. if (!node.node_ops.readdir) {
  2761. throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
  2762. }
  2763. return node.node_ops.readdir(node);
  2764. },unlink:function (path) {
  2765. var lookup = FS.lookupPath(path, { parent: true });
  2766. var parent = lookup.node;
  2767. var name = PATH.basename(path);
  2768. var node = FS.lookupNode(parent, name);
  2769. var err = FS.mayDelete(parent, name, false);
  2770. if (err) {
  2771. // POSIX says unlink should set EPERM, not EISDIR
  2772. if (err === ERRNO_CODES.EISDIR) err = ERRNO_CODES.EPERM;
  2773. throw new FS.ErrnoError(err);
  2774. }
  2775. if (!parent.node_ops.unlink) {
  2776. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2777. }
  2778. if (FS.isMountpoint(node)) {
  2779. throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
  2780. }
  2781. parent.node_ops.unlink(parent, name);
  2782. FS.destroyNode(node);
  2783. },readlink:function (path) {
  2784. var lookup = FS.lookupPath(path);
  2785. var link = lookup.node;
  2786. if (!link.node_ops.readlink) {
  2787. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2788. }
  2789. return link.node_ops.readlink(link);
  2790. },stat:function (path, dontFollow) {
  2791. var lookup = FS.lookupPath(path, { follow: !dontFollow });
  2792. var node = lookup.node;
  2793. if (!node.node_ops.getattr) {
  2794. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2795. }
  2796. return node.node_ops.getattr(node);
  2797. },lstat:function (path) {
  2798. return FS.stat(path, true);
  2799. },chmod:function (path, mode, dontFollow) {
  2800. var node;
  2801. if (typeof path === 'string') {
  2802. var lookup = FS.lookupPath(path, { follow: !dontFollow });
  2803. node = lookup.node;
  2804. } else {
  2805. node = path;
  2806. }
  2807. if (!node.node_ops.setattr) {
  2808. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2809. }
  2810. node.node_ops.setattr(node, {
  2811. mode: (mode & 4095) | (node.mode & ~4095),
  2812. timestamp: Date.now()
  2813. });
  2814. },lchmod:function (path, mode) {
  2815. FS.chmod(path, mode, true);
  2816. },fchmod:function (fd, mode) {
  2817. var stream = FS.getStream(fd);
  2818. if (!stream) {
  2819. throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  2820. }
  2821. FS.chmod(stream.node, mode);
  2822. },chown:function (path, uid, gid, dontFollow) {
  2823. var node;
  2824. if (typeof path === 'string') {
  2825. var lookup = FS.lookupPath(path, { follow: !dontFollow });
  2826. node = lookup.node;
  2827. } else {
  2828. node = path;
  2829. }
  2830. if (!node.node_ops.setattr) {
  2831. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2832. }
  2833. node.node_ops.setattr(node, {
  2834. timestamp: Date.now()
  2835. // we ignore the uid / gid for now
  2836. });
  2837. },lchown:function (path, uid, gid) {
  2838. FS.chown(path, uid, gid, true);
  2839. },fchown:function (fd, uid, gid) {
  2840. var stream = FS.getStream(fd);
  2841. if (!stream) {
  2842. throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  2843. }
  2844. FS.chown(stream.node, uid, gid);
  2845. },truncate:function (path, len) {
  2846. if (len < 0) {
  2847. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2848. }
  2849. var node;
  2850. if (typeof path === 'string') {
  2851. var lookup = FS.lookupPath(path, { follow: true });
  2852. node = lookup.node;
  2853. } else {
  2854. node = path;
  2855. }
  2856. if (!node.node_ops.setattr) {
  2857. throw new FS.ErrnoError(ERRNO_CODES.EPERM);
  2858. }
  2859. if (FS.isDir(node.mode)) {
  2860. throw new FS.ErrnoError(ERRNO_CODES.EISDIR);
  2861. }
  2862. if (!FS.isFile(node.mode)) {
  2863. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2864. }
  2865. var err = FS.nodePermissions(node, 'w');
  2866. if (err) {
  2867. throw new FS.ErrnoError(err);
  2868. }
  2869. node.node_ops.setattr(node, {
  2870. size: len,
  2871. timestamp: Date.now()
  2872. });
  2873. },ftruncate:function (fd, len) {
  2874. var stream = FS.getStream(fd);
  2875. if (!stream) {
  2876. throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  2877. }
  2878. if ((stream.flags & 2097155) === 0) {
  2879. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2880. }
  2881. FS.truncate(stream.node, len);
  2882. },utime:function (path, atime, mtime) {
  2883. var lookup = FS.lookupPath(path, { follow: true });
  2884. var node = lookup.node;
  2885. node.node_ops.setattr(node, {
  2886. timestamp: Math.max(atime, mtime)
  2887. });
  2888. },open:function (path, flags, mode, fd_start, fd_end) {
  2889. flags = typeof flags === 'string' ? FS.modeStringToFlags(flags) : flags;
  2890. mode = typeof mode === 'undefined' ? 0666 : mode;
  2891. if ((flags & 64)) {
  2892. mode = (mode & 4095) | 32768;
  2893. } else {
  2894. mode = 0;
  2895. }
  2896. var node;
  2897. if (typeof path === 'object') {
  2898. node = path;
  2899. } else {
  2900. path = PATH.normalize(path);
  2901. try {
  2902. var lookup = FS.lookupPath(path, {
  2903. follow: !(flags & 131072)
  2904. });
  2905. node = lookup.node;
  2906. } catch (e) {
  2907. // ignore
  2908. }
  2909. }
  2910. // perhaps we need to create the node
  2911. if ((flags & 64)) {
  2912. if (node) {
  2913. // if O_CREAT and O_EXCL are set, error out if the node already exists
  2914. if ((flags & 128)) {
  2915. throw new FS.ErrnoError(ERRNO_CODES.EEXIST);
  2916. }
  2917. } else {
  2918. // node doesn't exist, try to create it
  2919. node = FS.mknod(path, mode, 0);
  2920. }
  2921. }
  2922. if (!node) {
  2923. throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
  2924. }
  2925. // can't truncate a device
  2926. if (FS.isChrdev(node.mode)) {
  2927. flags &= ~512;
  2928. }
  2929. // check permissions
  2930. var err = FS.mayOpen(node, flags);
  2931. if (err) {
  2932. throw new FS.ErrnoError(err);
  2933. }
  2934. // do truncation if necessary
  2935. if ((flags & 512)) {
  2936. FS.truncate(node, 0);
  2937. }
  2938. // we've already handled these, don't pass down to the underlying vfs
  2939. flags &= ~(128 | 512);
  2940. // register the stream with the filesystem
  2941. var stream = FS.createStream({
  2942. node: node,
  2943. path: FS.getPath(node), // we want the absolute path to the node
  2944. flags: flags,
  2945. seekable: true,
  2946. position: 0,
  2947. stream_ops: node.stream_ops,
  2948. // used by the file family libc calls (fopen, fwrite, ferror, etc.)
  2949. ungotten: [],
  2950. error: false
  2951. }, fd_start, fd_end);
  2952. // call the new stream's open function
  2953. if (stream.stream_ops.open) {
  2954. stream.stream_ops.open(stream);
  2955. }
  2956. if (Module['logReadFiles'] && !(flags & 1)) {
  2957. if (!FS.readFiles) FS.readFiles = {};
  2958. if (!(path in FS.readFiles)) {
  2959. FS.readFiles[path] = 1;
  2960. Module['printErr']('read file: ' + path);
  2961. }
  2962. }
  2963. return stream;
  2964. },close:function (stream) {
  2965. try {
  2966. if (stream.stream_ops.close) {
  2967. stream.stream_ops.close(stream);
  2968. }
  2969. } catch (e) {
  2970. throw e;
  2971. } finally {
  2972. FS.closeStream(stream.fd);
  2973. }
  2974. },llseek:function (stream, offset, whence) {
  2975. if (!stream.seekable || !stream.stream_ops.llseek) {
  2976. throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
  2977. }
  2978. return stream.stream_ops.llseek(stream, offset, whence);
  2979. },read:function (stream, buffer, offset, length, position) {
  2980. if (length < 0 || position < 0) {
  2981. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2982. }
  2983. if ((stream.flags & 2097155) === 1) {
  2984. throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  2985. }
  2986. if (FS.isDir(stream.node.mode)) {
  2987. throw new FS.ErrnoError(ERRNO_CODES.EISDIR);
  2988. }
  2989. if (!stream.stream_ops.read) {
  2990. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  2991. }
  2992. var seeking = true;
  2993. if (typeof position === 'undefined') {
  2994. position = stream.position;
  2995. seeking = false;
  2996. } else if (!stream.seekable) {
  2997. throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
  2998. }
  2999. var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position);
  3000. if (!seeking) stream.position += bytesRead;
  3001. return bytesRead;
  3002. },write:function (stream, buffer, offset, length, position, canOwn) {
  3003. if (length < 0 || position < 0) {
  3004. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3005. }
  3006. if ((stream.flags & 2097155) === 0) {
  3007. throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  3008. }
  3009. if (FS.isDir(stream.node.mode)) {
  3010. throw new FS.ErrnoError(ERRNO_CODES.EISDIR);
  3011. }
  3012. if (!stream.stream_ops.write) {
  3013. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3014. }
  3015. var seeking = true;
  3016. if (typeof position === 'undefined') {
  3017. position = stream.position;
  3018. seeking = false;
  3019. } else if (!stream.seekable) {
  3020. throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);
  3021. }
  3022. if (stream.flags & 1024) {
  3023. // seek to the end before writing in append mode
  3024. FS.llseek(stream, 0, 2);
  3025. }
  3026. var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn);
  3027. if (!seeking) stream.position += bytesWritten;
  3028. return bytesWritten;
  3029. },allocate:function (stream, offset, length) {
  3030. if (offset < 0 || length <= 0) {
  3031. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3032. }
  3033. if ((stream.flags & 2097155) === 0) {
  3034. throw new FS.ErrnoError(ERRNO_CODES.EBADF);
  3035. }
  3036. if (!FS.isFile(stream.node.mode) && !FS.isDir(node.mode)) {
  3037. throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
  3038. }
  3039. if (!stream.stream_ops.allocate) {
  3040. throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP);
  3041. }
  3042. stream.stream_ops.allocate(stream, offset, length);
  3043. },mmap:function (stream, buffer, offset, length, position, prot, flags) {
  3044. // TODO if PROT is PROT_WRITE, make sure we have write access
  3045. if ((stream.flags & 2097155) === 1) {
  3046. throw new FS.ErrnoError(ERRNO_CODES.EACCES);
  3047. }
  3048. if (!stream.stream_ops.mmap) {
  3049. throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
  3050. }
  3051. return stream.stream_ops.mmap(stream, buffer, offset, length, position, prot, flags);
  3052. },ioctl:function (stream, cmd, arg) {
  3053. if (!stream.stream_ops.ioctl) {
  3054. throw new FS.ErrnoError(ERRNO_CODES.ENOTTY);
  3055. }
  3056. return stream.stream_ops.ioctl(stream, cmd, arg);
  3057. },readFile:function (path, opts) {
  3058. opts = opts || {};
  3059. opts.flags = opts.flags || 'r';
  3060. opts.encoding = opts.encoding || 'binary';
  3061. if (opts.encoding !== 'utf8' && opts.encoding !== 'binary') {
  3062. throw new Error('Invalid encoding type "' + opts.encoding + '"');
  3063. }
  3064. var ret;
  3065. var stream = FS.open(path, opts.flags);
  3066. var stat = FS.stat(path);
  3067. var length = stat.size;
  3068. var buf = new Uint8Array(length);
  3069. FS.read(stream, buf, 0, length, 0);
  3070. if (opts.encoding === 'utf8') {
  3071. ret = '';
  3072. var utf8 = new Runtime.UTF8Processor();
  3073. for (var i = 0; i < length; i++) {
  3074. ret += utf8.processCChar(buf[i]);
  3075. }
  3076. } else if (opts.encoding === 'binary') {
  3077. ret = buf;
  3078. }
  3079. FS.close(stream);
  3080. return ret;
  3081. },writeFile:function (path, data, opts) {
  3082. opts = opts || {};
  3083. opts.flags = opts.flags || 'w';
  3084. opts.encoding = opts.encoding || 'utf8';
  3085. if (opts.encoding !== 'utf8' && opts.encoding !== 'binary') {
  3086. throw new Error('Invalid encoding type "' + opts.encoding + '"');
  3087. }
  3088. var stream = FS.open(path, opts.flags, opts.mode);
  3089. if (opts.encoding === 'utf8') {
  3090. var utf8 = new Runtime.UTF8Processor();
  3091. var buf = new Uint8Array(utf8.processJSString(data));
  3092. FS.write(stream, buf, 0, buf.length, 0, opts.canOwn);
  3093. } else if (opts.encoding === 'binary') {
  3094. FS.write(stream, data, 0, data.length, 0, opts.canOwn);
  3095. }
  3096. FS.close(stream);
  3097. },cwd:function () {
  3098. return FS.currentPath;
  3099. },chdir:function (path) {
  3100. var lookup = FS.lookupPath(path, { follow: true });
  3101. if (!FS.isDir(lookup.node.mode)) {
  3102. throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);
  3103. }
  3104. var err = FS.nodePermissions(lookup.node, 'x');
  3105. if (err) {
  3106. throw new FS.ErrnoError(err);
  3107. }
  3108. FS.currentPath = lookup.path;
  3109. },createDefaultDirectories:function () {
  3110. FS.mkdir('/tmp');
  3111. },createDefaultDevices:function () {
  3112. // create /dev
  3113. FS.mkdir('/dev');
  3114. // setup /dev/null
  3115. FS.registerDevice(FS.makedev(1, 3), {
  3116. read: function() { return 0; },
  3117. write: function() { return 0; }
  3118. });
  3119. FS.mkdev('/dev/null', FS.makedev(1, 3));
  3120. // setup /dev/tty and /dev/tty1
  3121. // stderr needs to print output using Module['printErr']
  3122. // so we register a second tty just for it.
  3123. TTY.register(FS.makedev(5, 0), TTY.default_tty_ops);
  3124. TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops);
  3125. FS.mkdev('/dev/tty', FS.makedev(5, 0));
  3126. FS.mkdev('/dev/tty1', FS.makedev(6, 0));
  3127. // we're not going to emulate the actual shm device,
  3128. // just create the tmp dirs that reside in it commonly
  3129. FS.mkdir('/dev/shm');
  3130. FS.mkdir('/dev/shm/tmp');
  3131. },createStandardStreams:function () {
  3132. // TODO deprecate the old functionality of a single
  3133. // input / output callback and that utilizes FS.createDevice
  3134. // and instead require a unique set of stream ops
  3135. // by default, we symlink the standard streams to the
  3136. // default tty devices. however, if the standard streams
  3137. // have been overwritten we create a unique device for
  3138. // them instead.
  3139. if (Module['stdin']) {
  3140. FS.createDevice('/dev', 'stdin', Module['stdin']);
  3141. } else {
  3142. FS.symlink('/dev/tty', '/dev/stdin');
  3143. }
  3144. if (Module['stdout']) {
  3145. FS.createDevice('/dev', 'stdout', null, Module['stdout']);
  3146. } else {
  3147. FS.symlink('/dev/tty', '/dev/stdout');
  3148. }
  3149. if (Module['stderr']) {
  3150. FS.createDevice('/dev', 'stderr', null, Module['stderr']);
  3151. } else {
  3152. FS.symlink('/dev/tty1', '/dev/stderr');
  3153. }
  3154. // open default streams for the stdin, stdout and stderr devices
  3155. var stdin = FS.open('/dev/stdin', 'r');
  3156. HEAP32[((_stdin)>>2)]=FS.getPtrForStream(stdin);
  3157. assert(stdin.fd === 0, 'invalid handle for stdin (' + stdin.fd + ')');
  3158. var stdout = FS.open('/dev/stdout', 'w');
  3159. HEAP32[((_stdout)>>2)]=FS.getPtrForStream(stdout);
  3160. assert(stdout.fd === 1, 'invalid handle for stdout (' + stdout.fd + ')');
  3161. var stderr = FS.open('/dev/stderr', 'w');
  3162. HEAP32[((_stderr)>>2)]=FS.getPtrForStream(stderr);
  3163. assert(stderr.fd === 2, 'invalid handle for stderr (' + stderr.fd + ')');
  3164. },ensureErrnoError:function () {
  3165. if (FS.ErrnoError) return;
  3166. FS.ErrnoError = function ErrnoError(errno) {
  3167. this.errno = errno;
  3168. for (var key in ERRNO_CODES) {
  3169. if (ERRNO_CODES[key] === errno) {
  3170. this.code = key;
  3171. break;
  3172. }
  3173. }
  3174. this.message = ERRNO_MESSAGES[errno];
  3175. };
  3176. FS.ErrnoError.prototype = new Error();
  3177. FS.ErrnoError.prototype.constructor = FS.ErrnoError;
  3178. // Some errors may happen quite a bit, to avoid overhead we reuse them (and suffer a lack of stack info)
  3179. [ERRNO_CODES.ENOENT].forEach(function(code) {
  3180. FS.genericErrors[code] = new FS.ErrnoError(code);
  3181. FS.genericErrors[code].stack = '<generic error, no stack>';
  3182. });
  3183. },staticInit:function () {
  3184. FS.ensureErrnoError();
  3185. FS.nameTable = new Array(4096);
  3186. FS.mount(MEMFS, {}, '/');
  3187. FS.createDefaultDirectories();
  3188. FS.createDefaultDevices();
  3189. },init:function (input, output, error) {
  3190. 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)');
  3191. FS.init.initialized = true;
  3192. FS.ensureErrnoError();
  3193. // Allow Module.stdin etc. to provide defaults, if none explicitly passed to us here
  3194. Module['stdin'] = input || Module['stdin'];
  3195. Module['stdout'] = output || Module['stdout'];
  3196. Module['stderr'] = error || Module['stderr'];
  3197. FS.createStandardStreams();
  3198. },quit:function () {
  3199. FS.init.initialized = false;
  3200. for (var i = 0; i < FS.streams.length; i++) {
  3201. var stream = FS.streams[i];
  3202. if (!stream) {
  3203. continue;
  3204. }
  3205. FS.close(stream);
  3206. }
  3207. },getMode:function (canRead, canWrite) {
  3208. var mode = 0;
  3209. if (canRead) mode |= 292 | 73;
  3210. if (canWrite) mode |= 146;
  3211. return mode;
  3212. },joinPath:function (parts, forceRelative) {
  3213. var path = PATH.join.apply(null, parts);
  3214. if (forceRelative && path[0] == '/') path = path.substr(1);
  3215. return path;
  3216. },absolutePath:function (relative, base) {
  3217. return PATH.resolve(base, relative);
  3218. },standardizePath:function (path) {
  3219. return PATH.normalize(path);
  3220. },findObject:function (path, dontResolveLastLink) {
  3221. var ret = FS.analyzePath(path, dontResolveLastLink);
  3222. if (ret.exists) {
  3223. return ret.object;
  3224. } else {
  3225. ___setErrNo(ret.error);
  3226. return null;
  3227. }
  3228. },analyzePath:function (path, dontResolveLastLink) {
  3229. // operate from within the context of the symlink's target
  3230. try {
  3231. var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
  3232. path = lookup.path;
  3233. } catch (e) {
  3234. }
  3235. var ret = {
  3236. isRoot: false, exists: false, error: 0, name: null, path: null, object: null,
  3237. parentExists: false, parentPath: null, parentObject: null
  3238. };
  3239. try {
  3240. var lookup = FS.lookupPath(path, { parent: true });
  3241. ret.parentExists = true;
  3242. ret.parentPath = lookup.path;
  3243. ret.parentObject = lookup.node;
  3244. ret.name = PATH.basename(path);
  3245. lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
  3246. ret.exists = true;
  3247. ret.path = lookup.path;
  3248. ret.object = lookup.node;
  3249. ret.name = lookup.node.name;
  3250. ret.isRoot = lookup.path === '/';
  3251. } catch (e) {
  3252. ret.error = e.errno;
  3253. };
  3254. return ret;
  3255. },createFolder:function (parent, name, canRead, canWrite) {
  3256. var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
  3257. var mode = FS.getMode(canRead, canWrite);
  3258. return FS.mkdir(path, mode);
  3259. },createPath:function (parent, path, canRead, canWrite) {
  3260. parent = typeof parent === 'string' ? parent : FS.getPath(parent);
  3261. var parts = path.split('/').reverse();
  3262. while (parts.length) {
  3263. var part = parts.pop();
  3264. if (!part) continue;
  3265. var current = PATH.join2(parent, part);
  3266. try {
  3267. FS.mkdir(current);
  3268. } catch (e) {
  3269. // ignore EEXIST
  3270. }
  3271. parent = current;
  3272. }
  3273. return current;
  3274. },createFile:function (parent, name, properties, canRead, canWrite) {
  3275. var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
  3276. var mode = FS.getMode(canRead, canWrite);
  3277. return FS.create(path, mode);
  3278. },createDataFile:function (parent, name, data, canRead, canWrite, canOwn) {
  3279. var path = name ? PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name) : parent;
  3280. var mode = FS.getMode(canRead, canWrite);
  3281. var node = FS.create(path, mode);
  3282. if (data) {
  3283. if (typeof data === 'string') {
  3284. var arr = new Array(data.length);
  3285. for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i);
  3286. data = arr;
  3287. }
  3288. // make sure we can write to the file
  3289. FS.chmod(node, mode | 146);
  3290. var stream = FS.open(node, 'w');
  3291. FS.write(stream, data, 0, data.length, 0, canOwn);
  3292. FS.close(stream);
  3293. FS.chmod(node, mode);
  3294. }
  3295. return node;
  3296. },createDevice:function (parent, name, input, output) {
  3297. var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
  3298. var mode = FS.getMode(!!input, !!output);
  3299. if (!FS.createDevice.major) FS.createDevice.major = 64;
  3300. var dev = FS.makedev(FS.createDevice.major++, 0);
  3301. // Create a fake device that a set of stream ops to emulate
  3302. // the old behavior.
  3303. FS.registerDevice(dev, {
  3304. open: function(stream) {
  3305. stream.seekable = false;
  3306. },
  3307. close: function(stream) {
  3308. // flush any pending line data
  3309. if (output && output.buffer && output.buffer.length) {
  3310. output(10);
  3311. }
  3312. },
  3313. read: function(stream, buffer, offset, length, pos /* ignored */) {
  3314. var bytesRead = 0;
  3315. for (var i = 0; i < length; i++) {
  3316. var result;
  3317. try {
  3318. result = input();
  3319. } catch (e) {
  3320. throw new FS.ErrnoError(ERRNO_CODES.EIO);
  3321. }
  3322. if (result === undefined && bytesRead === 0) {
  3323. throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
  3324. }
  3325. if (result === null || result === undefined) break;
  3326. bytesRead++;
  3327. buffer[offset+i] = result;
  3328. }
  3329. if (bytesRead) {
  3330. stream.node.timestamp = Date.now();
  3331. }
  3332. return bytesRead;
  3333. },
  3334. write: function(stream, buffer, offset, length, pos) {
  3335. for (var i = 0; i < length; i++) {
  3336. try {
  3337. output(buffer[offset+i]);
  3338. } catch (e) {
  3339. throw new FS.ErrnoError(ERRNO_CODES.EIO);
  3340. }
  3341. }
  3342. if (length) {
  3343. stream.node.timestamp = Date.now();
  3344. }
  3345. return i;
  3346. }
  3347. });
  3348. return FS.mkdev(path, mode, dev);
  3349. },createLink:function (parent, name, target, canRead, canWrite) {
  3350. var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name);
  3351. return FS.symlink(target, path);
  3352. },forceLoadFile:function (obj) {
  3353. if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true;
  3354. var success = true;
  3355. if (typeof XMLHttpRequest !== 'undefined') {
  3356. 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.");
  3357. } else if (Module['read']) {
  3358. // Command-line.
  3359. try {
  3360. // WARNING: Can't read binary files in V8's d8 or tracemonkey's js, as
  3361. // read() will try to parse UTF8.
  3362. obj.contents = intArrayFromString(Module['read'](obj.url), true);
  3363. } catch (e) {
  3364. success = false;
  3365. }
  3366. } else {
  3367. throw new Error('Cannot load without read() or XMLHttpRequest.');
  3368. }
  3369. if (!success) ___setErrNo(ERRNO_CODES.EIO);
  3370. return success;
  3371. },createLazyFile:function (parent, name, url, canRead, canWrite) {
  3372. if (typeof XMLHttpRequest !== 'undefined') {
  3373. if (!ENVIRONMENT_IS_WORKER) throw 'Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc';
  3374. // Lazy chunked Uint8Array (implements get and length from Uint8Array). Actual getting is abstracted away for eventual reuse.
  3375. function LazyUint8Array() {
  3376. this.lengthKnown = false;
  3377. this.chunks = []; // Loaded chunks. Index is the chunk number
  3378. }
  3379. LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) {
  3380. if (idx > this.length-1 || idx < 0) {
  3381. return undefined;
  3382. }
  3383. var chunkOffset = idx % this.chunkSize;
  3384. var chunkNum = Math.floor(idx / this.chunkSize);
  3385. return this.getter(chunkNum)[chunkOffset];
  3386. }
  3387. LazyUint8Array.prototype.setDataGetter = function LazyUint8Array_setDataGetter(getter) {
  3388. this.getter = getter;
  3389. }
  3390. LazyUint8Array.prototype.cacheLength = function LazyUint8Array_cacheLength() {
  3391. // Find length
  3392. var xhr = new XMLHttpRequest();
  3393. xhr.open('HEAD', url, false);
  3394. xhr.send(null);
  3395. if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
  3396. var datalength = Number(xhr.getResponseHeader("Content-length"));
  3397. var header;
  3398. var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes";
  3399. var chunkSize = 1024*1024; // Chunk size in bytes
  3400. if (!hasByteServing) chunkSize = datalength;
  3401. // Function to get a range from the remote URL.
  3402. var doXHR = (function(from, to) {
  3403. if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!");
  3404. if (to > datalength-1) throw new Error("only " + datalength + " bytes available! programmer error!");
  3405. // TODO: Use mozResponseArrayBuffer, responseStream, etc. if available.
  3406. var xhr = new XMLHttpRequest();
  3407. xhr.open('GET', url, false);
  3408. if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to);
  3409. // Some hints to the browser that we want binary data.
  3410. if (typeof Uint8Array != 'undefined') xhr.responseType = 'arraybuffer';
  3411. if (xhr.overrideMimeType) {
  3412. xhr.overrideMimeType('text/plain; charset=x-user-defined');
  3413. }
  3414. xhr.send(null);
  3415. if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
  3416. if (xhr.response !== undefined) {
  3417. return new Uint8Array(xhr.response || []);
  3418. } else {
  3419. return intArrayFromString(xhr.responseText || '', true);
  3420. }
  3421. });
  3422. var lazyArray = this;
  3423. lazyArray.setDataGetter(function(chunkNum) {
  3424. var start = chunkNum * chunkSize;
  3425. var end = (chunkNum+1) * chunkSize - 1; // including this byte
  3426. end = Math.min(end, datalength-1); // if datalength-1 is selected, this is the last block
  3427. if (typeof(lazyArray.chunks[chunkNum]) === "undefined") {
  3428. lazyArray.chunks[chunkNum] = doXHR(start, end);
  3429. }
  3430. if (typeof(lazyArray.chunks[chunkNum]) === "undefined") throw new Error("doXHR failed!");
  3431. return lazyArray.chunks[chunkNum];
  3432. });
  3433. this._length = datalength;
  3434. this._chunkSize = chunkSize;
  3435. this.lengthKnown = true;
  3436. }
  3437. var lazyArray = new LazyUint8Array();
  3438. Object.defineProperty(lazyArray, "length", {
  3439. get: function() {
  3440. if(!this.lengthKnown) {
  3441. this.cacheLength();
  3442. }
  3443. return this._length;
  3444. }
  3445. });
  3446. Object.defineProperty(lazyArray, "chunkSize", {
  3447. get: function() {
  3448. if(!this.lengthKnown) {
  3449. this.cacheLength();
  3450. }
  3451. return this._chunkSize;
  3452. }
  3453. });
  3454. var properties = { isDevice: false, contents: lazyArray };
  3455. } else {
  3456. var properties = { isDevice: false, url: url };
  3457. }
  3458. var node = FS.createFile(parent, name, properties, canRead, canWrite);
  3459. // This is a total hack, but I want to get this lazy file code out of the
  3460. // core of MEMFS. If we want to keep this lazy file concept I feel it should
  3461. // be its own thin LAZYFS proxying calls to MEMFS.
  3462. if (properties.contents) {
  3463. node.contents = properties.contents;
  3464. } else if (properties.url) {
  3465. node.contents = null;
  3466. node.url = properties.url;
  3467. }
  3468. // override each stream op with one that tries to force load the lazy file first
  3469. var stream_ops = {};
  3470. var keys = Object.keys(node.stream_ops);
  3471. keys.forEach(function(key) {
  3472. var fn = node.stream_ops[key];
  3473. stream_ops[key] = function forceLoadLazyFile() {
  3474. if (!FS.forceLoadFile(node)) {
  3475. throw new FS.ErrnoError(ERRNO_CODES.EIO);
  3476. }
  3477. return fn.apply(null, arguments);
  3478. };
  3479. });
  3480. // use a custom read function
  3481. stream_ops.read = function stream_ops_read(stream, buffer, offset, length, position) {
  3482. if (!FS.forceLoadFile(node)) {
  3483. throw new FS.ErrnoError(ERRNO_CODES.EIO);
  3484. }
  3485. var contents = stream.node.contents;
  3486. if (position >= contents.length)
  3487. return 0;
  3488. var size = Math.min(contents.length - position, length);
  3489. assert(size >= 0);
  3490. if (contents.slice) { // normal array
  3491. for (var i = 0; i < size; i++) {
  3492. buffer[offset + i] = contents[position + i];
  3493. }
  3494. } else {
  3495. for (var i = 0; i < size; i++) { // LazyUint8Array from sync binary XHR
  3496. buffer[offset + i] = contents.get(position + i);
  3497. }
  3498. }
  3499. return size;
  3500. };
  3501. node.stream_ops = stream_ops;
  3502. return node;
  3503. },createPreloadedFile:function (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn) {
  3504. Browser.init();
  3505. // TODO we should allow people to just pass in a complete filename instead
  3506. // of parent and name being that we just join them anyways
  3507. var fullname = name ? PATH.resolve(PATH.join2(parent, name)) : parent;
  3508. function processData(byteArray) {
  3509. function finish(byteArray) {
  3510. if (!dontCreateFile) {
  3511. FS.createDataFile(parent, name, byteArray, canRead, canWrite, canOwn);
  3512. }
  3513. if (onload) onload();
  3514. removeRunDependency('cp ' + fullname);
  3515. }
  3516. var handled = false;
  3517. Module['preloadPlugins'].forEach(function(plugin) {
  3518. if (handled) return;
  3519. if (plugin['canHandle'](fullname)) {
  3520. plugin['handle'](byteArray, fullname, finish, function() {
  3521. if (onerror) onerror();
  3522. removeRunDependency('cp ' + fullname);
  3523. });
  3524. handled = true;
  3525. }
  3526. });
  3527. if (!handled) finish(byteArray);
  3528. }
  3529. addRunDependency('cp ' + fullname);
  3530. if (typeof url == 'string') {
  3531. Browser.asyncLoad(url, function(byteArray) {
  3532. processData(byteArray);
  3533. }, onerror);
  3534. } else {
  3535. processData(url);
  3536. }
  3537. },indexedDB:function () {
  3538. return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
  3539. },DB_NAME:function () {
  3540. return 'EM_FS_' + window.location.pathname;
  3541. },DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:function (paths, onload, onerror) {
  3542. onload = onload || function(){};
  3543. onerror = onerror || function(){};
  3544. var indexedDB = FS.indexedDB();
  3545. try {
  3546. var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION);
  3547. } catch (e) {
  3548. return onerror(e);
  3549. }
  3550. openRequest.onupgradeneeded = function openRequest_onupgradeneeded() {
  3551. console.log('creating db');
  3552. var db = openRequest.result;
  3553. db.createObjectStore(FS.DB_STORE_NAME);
  3554. };
  3555. openRequest.onsuccess = function openRequest_onsuccess() {
  3556. var db = openRequest.result;
  3557. var transaction = db.transaction([FS.DB_STORE_NAME], 'readwrite');
  3558. var files = transaction.objectStore(FS.DB_STORE_NAME);
  3559. var ok = 0, fail = 0, total = paths.length;
  3560. function finish() {
  3561. if (fail == 0) onload(); else onerror();
  3562. }
  3563. paths.forEach(function(path) {
  3564. var putRequest = files.put(FS.analyzePath(path).object.contents, path);
  3565. putRequest.onsuccess = function putRequest_onsuccess() { ok++; if (ok + fail == total) finish() };
  3566. putRequest.onerror = function putRequest_onerror() { fail++; if (ok + fail == total) finish() };
  3567. });
  3568. transaction.onerror = onerror;
  3569. };
  3570. openRequest.onerror = onerror;
  3571. },loadFilesFromDB:function (paths, onload, onerror) {
  3572. onload = onload || function(){};
  3573. onerror = onerror || function(){};
  3574. var indexedDB = FS.indexedDB();
  3575. try {
  3576. var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION);
  3577. } catch (e) {
  3578. return onerror(e);
  3579. }
  3580. openRequest.onupgradeneeded = onerror; // no database to load from
  3581. openRequest.onsuccess = function openRequest_onsuccess() {
  3582. var db = openRequest.result;
  3583. try {
  3584. var transaction = db.transaction([FS.DB_STORE_NAME], 'readonly');
  3585. } catch(e) {
  3586. onerror(e);
  3587. return;
  3588. }
  3589. var files = transaction.objectStore(FS.DB_STORE_NAME);
  3590. var ok = 0, fail = 0, total = paths.length;
  3591. function finish() {
  3592. if (fail == 0) onload(); else onerror();
  3593. }
  3594. paths.forEach(function(path) {
  3595. var getRequest = files.get(path);
  3596. getRequest.onsuccess = function getRequest_onsuccess() {
  3597. if (FS.analyzePath(path).exists) {
  3598. FS.unlink(path);
  3599. }
  3600. FS.createDataFile(PATH.dirname(path), PATH.basename(path), getRequest.result, true, true, true);
  3601. ok++;
  3602. if (ok + fail == total) finish();
  3603. };
  3604. getRequest.onerror = function getRequest_onerror() { fail++; if (ok + fail == total) finish() };
  3605. });
  3606. transaction.onerror = onerror;
  3607. };
  3608. openRequest.onerror = onerror;
  3609. }};
  3610. function _mkport() { throw 'TODO' }var SOCKFS={mount:function (mount) {
  3611. return FS.createNode(null, '/', 16384 | 0777, 0);
  3612. },createSocket:function (family, type, protocol) {
  3613. var streaming = type == 1;
  3614. if (protocol) {
  3615. assert(streaming == (protocol == 6)); // if SOCK_STREAM, must be tcp
  3616. }
  3617. // create our internal socket structure
  3618. var sock = {
  3619. family: family,
  3620. type: type,
  3621. protocol: protocol,
  3622. server: null,
  3623. peers: {},
  3624. pending: [],
  3625. recv_queue: [],
  3626. sock_ops: SOCKFS.websocket_sock_ops
  3627. };
  3628. // create the filesystem node to store the socket structure
  3629. var name = SOCKFS.nextname();
  3630. var node = FS.createNode(SOCKFS.root, name, 49152, 0);
  3631. node.sock = sock;
  3632. // and the wrapping stream that enables library functions such
  3633. // as read and write to indirectly interact with the socket
  3634. var stream = FS.createStream({
  3635. path: name,
  3636. node: node,
  3637. flags: FS.modeStringToFlags('r+'),
  3638. seekable: false,
  3639. stream_ops: SOCKFS.stream_ops
  3640. });
  3641. // map the new stream to the socket structure (sockets have a 1:1
  3642. // relationship with a stream)
  3643. sock.stream = stream;
  3644. return sock;
  3645. },getSocket:function (fd) {
  3646. var stream = FS.getStream(fd);
  3647. if (!stream || !FS.isSocket(stream.node.mode)) {
  3648. return null;
  3649. }
  3650. return stream.node.sock;
  3651. },stream_ops:{poll:function (stream) {
  3652. var sock = stream.node.sock;
  3653. return sock.sock_ops.poll(sock);
  3654. },ioctl:function (stream, request, varargs) {
  3655. var sock = stream.node.sock;
  3656. return sock.sock_ops.ioctl(sock, request, varargs);
  3657. },read:function (stream, buffer, offset, length, position /* ignored */) {
  3658. var sock = stream.node.sock;
  3659. var msg = sock.sock_ops.recvmsg(sock, length);
  3660. if (!msg) {
  3661. // socket is closed
  3662. return 0;
  3663. }
  3664. buffer.set(msg.buffer, offset);
  3665. return msg.buffer.length;
  3666. },write:function (stream, buffer, offset, length, position /* ignored */) {
  3667. var sock = stream.node.sock;
  3668. return sock.sock_ops.sendmsg(sock, buffer, offset, length);
  3669. },close:function (stream) {
  3670. var sock = stream.node.sock;
  3671. sock.sock_ops.close(sock);
  3672. }},nextname:function () {
  3673. if (!SOCKFS.nextname.current) {
  3674. SOCKFS.nextname.current = 0;
  3675. }
  3676. return 'socket[' + (SOCKFS.nextname.current++) + ']';
  3677. },websocket_sock_ops:{createPeer:function (sock, addr, port) {
  3678. var ws;
  3679. if (typeof addr === 'object') {
  3680. ws = addr;
  3681. addr = null;
  3682. port = null;
  3683. }
  3684. if (ws) {
  3685. // for sockets that've already connected (e.g. we're the server)
  3686. // we can inspect the _socket property for the address
  3687. if (ws._socket) {
  3688. addr = ws._socket.remoteAddress;
  3689. port = ws._socket.remotePort;
  3690. }
  3691. // if we're just now initializing a connection to the remote,
  3692. // inspect the url property
  3693. else {
  3694. var result = /ws[s]?:\/\/([^:]+):(\d+)/.exec(ws.url);
  3695. if (!result) {
  3696. throw new Error('WebSocket URL must be in the format ws(s)://address:port');
  3697. }
  3698. addr = result[1];
  3699. port = parseInt(result[2], 10);
  3700. }
  3701. } else {
  3702. // create the actual websocket object and connect
  3703. try {
  3704. var url = 'ws://' + addr + ':' + port;
  3705. // the node ws library API is slightly different than the browser's
  3706. var opts = ENVIRONMENT_IS_NODE ? {headers: {'websocket-protocol': ['binary']}} : ['binary'];
  3707. // If node we use the ws library.
  3708. var WebSocket = ENVIRONMENT_IS_NODE ? require('ws') : window['WebSocket'];
  3709. ws = new WebSocket(url, opts);
  3710. ws.binaryType = 'arraybuffer';
  3711. } catch (e) {
  3712. throw new FS.ErrnoError(ERRNO_CODES.EHOSTUNREACH);
  3713. }
  3714. }
  3715. var peer = {
  3716. addr: addr,
  3717. port: port,
  3718. socket: ws,
  3719. dgram_send_queue: []
  3720. };
  3721. SOCKFS.websocket_sock_ops.addPeer(sock, peer);
  3722. SOCKFS.websocket_sock_ops.handlePeerEvents(sock, peer);
  3723. // if this is a bound dgram socket, send the port number first to allow
  3724. // us to override the ephemeral port reported to us by remotePort on the
  3725. // remote end.
  3726. if (sock.type === 2 && typeof sock.sport !== 'undefined') {
  3727. peer.dgram_send_queue.push(new Uint8Array([
  3728. 255, 255, 255, 255,
  3729. 'p'.charCodeAt(0), 'o'.charCodeAt(0), 'r'.charCodeAt(0), 't'.charCodeAt(0),
  3730. ((sock.sport & 0xff00) >> 8) , (sock.sport & 0xff)
  3731. ]));
  3732. }
  3733. return peer;
  3734. },getPeer:function (sock, addr, port) {
  3735. return sock.peers[addr + ':' + port];
  3736. },addPeer:function (sock, peer) {
  3737. sock.peers[peer.addr + ':' + peer.port] = peer;
  3738. },removePeer:function (sock, peer) {
  3739. delete sock.peers[peer.addr + ':' + peer.port];
  3740. },handlePeerEvents:function (sock, peer) {
  3741. var first = true;
  3742. var handleOpen = function () {
  3743. try {
  3744. var queued = peer.dgram_send_queue.shift();
  3745. while (queued) {
  3746. peer.socket.send(queued);
  3747. queued = peer.dgram_send_queue.shift();
  3748. }
  3749. } catch (e) {
  3750. // not much we can do here in the way of proper error handling as we've already
  3751. // lied and said this data was sent. shut it down.
  3752. peer.socket.close();
  3753. }
  3754. };
  3755. function handleMessage(data) {
  3756. assert(typeof data !== 'string' && data.byteLength !== undefined); // must receive an ArrayBuffer
  3757. data = new Uint8Array(data); // make a typed array view on the array buffer
  3758. // if this is the port message, override the peer's port with it
  3759. var wasfirst = first;
  3760. first = false;
  3761. if (wasfirst &&
  3762. data.length === 10 &&
  3763. data[0] === 255 && data[1] === 255 && data[2] === 255 && data[3] === 255 &&
  3764. data[4] === 'p'.charCodeAt(0) && data[5] === 'o'.charCodeAt(0) && data[6] === 'r'.charCodeAt(0) && data[7] === 't'.charCodeAt(0)) {
  3765. // update the peer's port and it's key in the peer map
  3766. var newport = ((data[8] << 8) | data[9]);
  3767. SOCKFS.websocket_sock_ops.removePeer(sock, peer);
  3768. peer.port = newport;
  3769. SOCKFS.websocket_sock_ops.addPeer(sock, peer);
  3770. return;
  3771. }
  3772. sock.recv_queue.push({ addr: peer.addr, port: peer.port, data: data });
  3773. };
  3774. if (ENVIRONMENT_IS_NODE) {
  3775. peer.socket.on('open', handleOpen);
  3776. peer.socket.on('message', function(data, flags) {
  3777. if (!flags.binary) {
  3778. return;
  3779. }
  3780. handleMessage((new Uint8Array(data)).buffer); // copy from node Buffer -> ArrayBuffer
  3781. });
  3782. peer.socket.on('error', function() {
  3783. // don't throw
  3784. });
  3785. } else {
  3786. peer.socket.onopen = handleOpen;
  3787. peer.socket.onmessage = function peer_socket_onmessage(event) {
  3788. handleMessage(event.data);
  3789. };
  3790. }
  3791. },poll:function (sock) {
  3792. if (sock.type === 1 && sock.server) {
  3793. // listen sockets should only say they're available for reading
  3794. // if there are pending clients.
  3795. return sock.pending.length ? (64 | 1) : 0;
  3796. }
  3797. var mask = 0;
  3798. var dest = sock.type === 1 ? // we only care about the socket state for connection-based sockets
  3799. SOCKFS.websocket_sock_ops.getPeer(sock, sock.daddr, sock.dport) :
  3800. null;
  3801. if (sock.recv_queue.length ||
  3802. !dest || // connection-less sockets are always ready to read
  3803. (dest && dest.socket.readyState === dest.socket.CLOSING) ||
  3804. (dest && dest.socket.readyState === dest.socket.CLOSED)) { // let recv return 0 once closed
  3805. mask |= (64 | 1);
  3806. }
  3807. if (!dest || // connection-less sockets are always ready to write
  3808. (dest && dest.socket.readyState === dest.socket.OPEN)) {
  3809. mask |= 4;
  3810. }
  3811. if ((dest && dest.socket.readyState === dest.socket.CLOSING) ||
  3812. (dest && dest.socket.readyState === dest.socket.CLOSED)) {
  3813. mask |= 16;
  3814. }
  3815. return mask;
  3816. },ioctl:function (sock, request, arg) {
  3817. switch (request) {
  3818. case 21531:
  3819. var bytes = 0;
  3820. if (sock.recv_queue.length) {
  3821. bytes = sock.recv_queue[0].data.length;
  3822. }
  3823. HEAP32[((arg)>>2)]=bytes;
  3824. return 0;
  3825. default:
  3826. return ERRNO_CODES.EINVAL;
  3827. }
  3828. },close:function (sock) {
  3829. // if we've spawned a listen server, close it
  3830. if (sock.server) {
  3831. try {
  3832. sock.server.close();
  3833. } catch (e) {
  3834. }
  3835. sock.server = null;
  3836. }
  3837. // close any peer connections
  3838. var peers = Object.keys(sock.peers);
  3839. for (var i = 0; i < peers.length; i++) {
  3840. var peer = sock.peers[peers[i]];
  3841. try {
  3842. peer.socket.close();
  3843. } catch (e) {
  3844. }
  3845. SOCKFS.websocket_sock_ops.removePeer(sock, peer);
  3846. }
  3847. return 0;
  3848. },bind:function (sock, addr, port) {
  3849. if (typeof sock.saddr !== 'undefined' || typeof sock.sport !== 'undefined') {
  3850. throw new FS.ErrnoError(ERRNO_CODES.EINVAL); // already bound
  3851. }
  3852. sock.saddr = addr;
  3853. sock.sport = port || _mkport();
  3854. // in order to emulate dgram sockets, we need to launch a listen server when
  3855. // binding on a connection-less socket
  3856. // note: this is only required on the server side
  3857. if (sock.type === 2) {
  3858. // close the existing server if it exists
  3859. if (sock.server) {
  3860. sock.server.close();
  3861. sock.server = null;
  3862. }
  3863. // swallow error operation not supported error that occurs when binding in the
  3864. // browser where this isn't supported
  3865. try {
  3866. sock.sock_ops.listen(sock, 0);
  3867. } catch (e) {
  3868. if (!(e instanceof FS.ErrnoError)) throw e;
  3869. if (e.errno !== ERRNO_CODES.EOPNOTSUPP) throw e;
  3870. }
  3871. }
  3872. },connect:function (sock, addr, port) {
  3873. if (sock.server) {
  3874. throw new FS.ErrnoError(ERRNO_CODS.EOPNOTSUPP);
  3875. }
  3876. // TODO autobind
  3877. // if (!sock.addr && sock.type == 2) {
  3878. // }
  3879. // early out if we're already connected / in the middle of connecting
  3880. if (typeof sock.daddr !== 'undefined' && typeof sock.dport !== 'undefined') {
  3881. var dest = SOCKFS.websocket_sock_ops.getPeer(sock, sock.daddr, sock.dport);
  3882. if (dest) {
  3883. if (dest.socket.readyState === dest.socket.CONNECTING) {
  3884. throw new FS.ErrnoError(ERRNO_CODES.EALREADY);
  3885. } else {
  3886. throw new FS.ErrnoError(ERRNO_CODES.EISCONN);
  3887. }
  3888. }
  3889. }
  3890. // add the socket to our peer list and set our
  3891. // destination address / port to match
  3892. var peer = SOCKFS.websocket_sock_ops.createPeer(sock, addr, port);
  3893. sock.daddr = peer.addr;
  3894. sock.dport = peer.port;
  3895. // always "fail" in non-blocking mode
  3896. throw new FS.ErrnoError(ERRNO_CODES.EINPROGRESS);
  3897. },listen:function (sock, backlog) {
  3898. if (!ENVIRONMENT_IS_NODE) {
  3899. throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP);
  3900. }
  3901. if (sock.server) {
  3902. throw new FS.ErrnoError(ERRNO_CODES.EINVAL); // already listening
  3903. }
  3904. var WebSocketServer = require('ws').Server;
  3905. var host = sock.saddr;
  3906. sock.server = new WebSocketServer({
  3907. host: host,
  3908. port: sock.sport
  3909. // TODO support backlog
  3910. });
  3911. sock.server.on('connection', function(ws) {
  3912. if (sock.type === 1) {
  3913. var newsock = SOCKFS.createSocket(sock.family, sock.type, sock.protocol);
  3914. // create a peer on the new socket
  3915. var peer = SOCKFS.websocket_sock_ops.createPeer(newsock, ws);
  3916. newsock.daddr = peer.addr;
  3917. newsock.dport = peer.port;
  3918. // push to queue for accept to pick up
  3919. sock.pending.push(newsock);
  3920. } else {
  3921. // create a peer on the listen socket so calling sendto
  3922. // with the listen socket and an address will resolve
  3923. // to the correct client
  3924. SOCKFS.websocket_sock_ops.createPeer(sock, ws);
  3925. }
  3926. });
  3927. sock.server.on('closed', function() {
  3928. sock.server = null;
  3929. });
  3930. sock.server.on('error', function() {
  3931. // don't throw
  3932. });
  3933. },accept:function (listensock) {
  3934. if (!listensock.server) {
  3935. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  3936. }
  3937. var newsock = listensock.pending.shift();
  3938. newsock.stream.flags = listensock.stream.flags;
  3939. return newsock;
  3940. },getname:function (sock, peer) {
  3941. var addr, port;
  3942. if (peer) {
  3943. if (sock.daddr === undefined || sock.dport === undefined) {
  3944. throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN);
  3945. }
  3946. addr = sock.daddr;
  3947. port = sock.dport;
  3948. } else {
  3949. // TODO saddr and sport will be set for bind()'d UDP sockets, but what
  3950. // should we be returning for TCP sockets that've been connect()'d?
  3951. addr = sock.saddr || 0;
  3952. port = sock.sport || 0;
  3953. }
  3954. return { addr: addr, port: port };
  3955. },sendmsg:function (sock, buffer, offset, length, addr, port) {
  3956. if (sock.type === 2) {
  3957. // connection-less sockets will honor the message address,
  3958. // and otherwise fall back to the bound destination address
  3959. if (addr === undefined || port === undefined) {
  3960. addr = sock.daddr;
  3961. port = sock.dport;
  3962. }
  3963. // if there was no address to fall back to, error out
  3964. if (addr === undefined || port === undefined) {
  3965. throw new FS.ErrnoError(ERRNO_CODES.EDESTADDRREQ);
  3966. }
  3967. } else {
  3968. // connection-based sockets will only use the bound
  3969. addr = sock.daddr;
  3970. port = sock.dport;
  3971. }
  3972. // find the peer for the destination address
  3973. var dest = SOCKFS.websocket_sock_ops.getPeer(sock, addr, port);
  3974. // early out if not connected with a connection-based socket
  3975. if (sock.type === 1) {
  3976. if (!dest || dest.socket.readyState === dest.socket.CLOSING || dest.socket.readyState === dest.socket.CLOSED) {
  3977. throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN);
  3978. } else if (dest.socket.readyState === dest.socket.CONNECTING) {
  3979. throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
  3980. }
  3981. }
  3982. // create a copy of the incoming data to send, as the WebSocket API
  3983. // doesn't work entirely with an ArrayBufferView, it'll just send
  3984. // the entire underlying buffer
  3985. var data;
  3986. if (buffer instanceof Array || buffer instanceof ArrayBuffer) {
  3987. data = buffer.slice(offset, offset + length);
  3988. } else { // ArrayBufferView
  3989. data = buffer.buffer.slice(buffer.byteOffset + offset, buffer.byteOffset + offset + length);
  3990. }
  3991. // if we're emulating a connection-less dgram socket and don't have
  3992. // a cached connection, queue the buffer to send upon connect and
  3993. // lie, saying the data was sent now.
  3994. if (sock.type === 2) {
  3995. if (!dest || dest.socket.readyState !== dest.socket.OPEN) {
  3996. // if we're not connected, open a new connection
  3997. if (!dest || dest.socket.readyState === dest.socket.CLOSING || dest.socket.readyState === dest.socket.CLOSED) {
  3998. dest = SOCKFS.websocket_sock_ops.createPeer(sock, addr, port);
  3999. }
  4000. dest.dgram_send_queue.push(data);
  4001. return length;
  4002. }
  4003. }
  4004. try {
  4005. // send the actual data
  4006. dest.socket.send(data);
  4007. return length;
  4008. } catch (e) {
  4009. throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
  4010. }
  4011. },recvmsg:function (sock, length) {
  4012. // http://pubs.opengroup.org/onlinepubs/7908799/xns/recvmsg.html
  4013. if (sock.type === 1 && sock.server) {
  4014. // tcp servers should not be recv()'ing on the listen socket
  4015. throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN);
  4016. }
  4017. var queued = sock.recv_queue.shift();
  4018. if (!queued) {
  4019. if (sock.type === 1) {
  4020. var dest = SOCKFS.websocket_sock_ops.getPeer(sock, sock.daddr, sock.dport);
  4021. if (!dest) {
  4022. // if we have a destination address but are not connected, error out
  4023. throw new FS.ErrnoError(ERRNO_CODES.ENOTCONN);
  4024. }
  4025. else if (dest.socket.readyState === dest.socket.CLOSING || dest.socket.readyState === dest.socket.CLOSED) {
  4026. // return null if the socket has closed
  4027. return null;
  4028. }
  4029. else {
  4030. // else, our socket is in a valid state but truly has nothing available
  4031. throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
  4032. }
  4033. } else {
  4034. throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
  4035. }
  4036. }
  4037. // queued.data will be an ArrayBuffer if it's unadulterated, but if it's
  4038. // requeued TCP data it'll be an ArrayBufferView
  4039. var queuedLength = queued.data.byteLength || queued.data.length;
  4040. var queuedOffset = queued.data.byteOffset || 0;
  4041. var queuedBuffer = queued.data.buffer || queued.data;
  4042. var bytesRead = Math.min(length, queuedLength);
  4043. var res = {
  4044. buffer: new Uint8Array(queuedBuffer, queuedOffset, bytesRead),
  4045. addr: queued.addr,
  4046. port: queued.port
  4047. };
  4048. // push back any unread data for TCP connections
  4049. if (sock.type === 1 && bytesRead < queuedLength) {
  4050. var bytesRemaining = queuedLength - bytesRead;
  4051. queued.data = new Uint8Array(queuedBuffer, queuedOffset + bytesRead, bytesRemaining);
  4052. sock.recv_queue.unshift(queued);
  4053. }
  4054. return res;
  4055. }}};function _send(fd, buf, len, flags) {
  4056. var sock = SOCKFS.getSocket(fd);
  4057. if (!sock) {
  4058. ___setErrNo(ERRNO_CODES.EBADF);
  4059. return -1;
  4060. }
  4061. // TODO honor flags
  4062. return _write(fd, buf, len);
  4063. }
  4064. function _pwrite(fildes, buf, nbyte, offset) {
  4065. // ssize_t pwrite(int fildes, const void *buf, size_t nbyte, off_t offset);
  4066. // http://pubs.opengroup.org/onlinepubs/000095399/functions/write.html
  4067. var stream = FS.getStream(fildes);
  4068. if (!stream) {
  4069. ___setErrNo(ERRNO_CODES.EBADF);
  4070. return -1;
  4071. }
  4072. try {
  4073. var slab = HEAP8;
  4074. return FS.write(stream, slab, buf, nbyte, offset);
  4075. } catch (e) {
  4076. FS.handleFSError(e);
  4077. return -1;
  4078. }
  4079. }function _write(fildes, buf, nbyte) {
  4080. // ssize_t write(int fildes, const void *buf, size_t nbyte);
  4081. // http://pubs.opengroup.org/onlinepubs/000095399/functions/write.html
  4082. var stream = FS.getStream(fildes);
  4083. if (!stream) {
  4084. ___setErrNo(ERRNO_CODES.EBADF);
  4085. return -1;
  4086. }
  4087. try {
  4088. var slab = HEAP8;
  4089. return FS.write(stream, slab, buf, nbyte);
  4090. } catch (e) {
  4091. FS.handleFSError(e);
  4092. return -1;
  4093. }
  4094. }
  4095. function _fileno(stream) {
  4096. // int fileno(FILE *stream);
  4097. // http://pubs.opengroup.org/onlinepubs/000095399/functions/fileno.html
  4098. return FS.getStreamFromPtr(stream).fd;
  4099. }function _fwrite(ptr, size, nitems, stream) {
  4100. // size_t fwrite(const void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream);
  4101. // http://pubs.opengroup.org/onlinepubs/000095399/functions/fwrite.html
  4102. var bytesToWrite = nitems * size;
  4103. if (bytesToWrite == 0) return 0;
  4104. var fd = _fileno(stream);
  4105. var bytesWritten = _write(fd, ptr, bytesToWrite);
  4106. if (bytesWritten == -1) {
  4107. var streamObj = FS.getStreamFromPtr(stream);
  4108. if (streamObj) streamObj.error = true;
  4109. return 0;
  4110. } else {
  4111. return Math.floor(bytesWritten / size);
  4112. }
  4113. }
  4114. Module["_strlen"] = _strlen;
  4115. function __reallyNegative(x) {
  4116. return x < 0 || (x === 0 && (1/x) === -Infinity);
  4117. }function __formatString(format, varargs) {
  4118. var textIndex = format;
  4119. var argIndex = 0;
  4120. function getNextArg(type) {
  4121. // NOTE: Explicitly ignoring type safety. Otherwise this fails:
  4122. // int x = 4; printf("%c\n", (char)x);
  4123. var ret;
  4124. if (type === 'double') {
  4125. ret = HEAPF64[(((varargs)+(argIndex))>>3)];
  4126. } else if (type == 'i64') {
  4127. ret = [HEAP32[(((varargs)+(argIndex))>>2)],
  4128. HEAP32[(((varargs)+(argIndex+8))>>2)]];
  4129. argIndex += 8; // each 32-bit chunk is in a 64-bit block
  4130. } else {
  4131. type = 'i32'; // varargs are always i32, i64, or double
  4132. ret = HEAP32[(((varargs)+(argIndex))>>2)];
  4133. }
  4134. argIndex += Math.max(Runtime.getNativeFieldSize(type), Runtime.getAlignSize(type, null, true));
  4135. return ret;
  4136. }
  4137. var ret = [];
  4138. var curr, next, currArg;
  4139. while(1) {
  4140. var startTextIndex = textIndex;
  4141. curr = HEAP8[(textIndex)];
  4142. if (curr === 0) break;
  4143. next = HEAP8[((textIndex+1)|0)];
  4144. if (curr == 37) {
  4145. // Handle flags.
  4146. var flagAlwaysSigned = false;
  4147. var flagLeftAlign = false;
  4148. var flagAlternative = false;
  4149. var flagZeroPad = false;
  4150. var flagPadSign = false;
  4151. flagsLoop: while (1) {
  4152. switch (next) {
  4153. case 43:
  4154. flagAlwaysSigned = true;
  4155. break;
  4156. case 45:
  4157. flagLeftAlign = true;
  4158. break;
  4159. case 35:
  4160. flagAlternative = true;
  4161. break;
  4162. case 48:
  4163. if (flagZeroPad) {
  4164. break flagsLoop;
  4165. } else {
  4166. flagZeroPad = true;
  4167. break;
  4168. }
  4169. case 32:
  4170. flagPadSign = true;
  4171. break;
  4172. default:
  4173. break flagsLoop;
  4174. }
  4175. textIndex++;
  4176. next = HEAP8[((textIndex+1)|0)];
  4177. }
  4178. // Handle width.
  4179. var width = 0;
  4180. if (next == 42) {
  4181. width = getNextArg('i32');
  4182. textIndex++;
  4183. next = HEAP8[((textIndex+1)|0)];
  4184. } else {
  4185. while (next >= 48 && next <= 57) {
  4186. width = width * 10 + (next - 48);
  4187. textIndex++;
  4188. next = HEAP8[((textIndex+1)|0)];
  4189. }
  4190. }
  4191. // Handle precision.
  4192. var precisionSet = false, precision = -1;
  4193. if (next == 46) {
  4194. precision = 0;
  4195. precisionSet = true;
  4196. textIndex++;
  4197. next = HEAP8[((textIndex+1)|0)];
  4198. if (next == 42) {
  4199. precision = getNextArg('i32');
  4200. textIndex++;
  4201. } else {
  4202. while(1) {
  4203. var precisionChr = HEAP8[((textIndex+1)|0)];
  4204. if (precisionChr < 48 ||
  4205. precisionChr > 57) break;
  4206. precision = precision * 10 + (precisionChr - 48);
  4207. textIndex++;
  4208. }
  4209. }
  4210. next = HEAP8[((textIndex+1)|0)];
  4211. }
  4212. if (precision === -1) {
  4213. precision = 6; // Standard default.
  4214. precisionSet = false;
  4215. }
  4216. // Handle integer sizes. WARNING: These assume a 32-bit architecture!
  4217. var argSize;
  4218. switch (String.fromCharCode(next)) {
  4219. case 'h':
  4220. var nextNext = HEAP8[((textIndex+2)|0)];
  4221. if (nextNext == 104) {
  4222. textIndex++;
  4223. argSize = 1; // char (actually i32 in varargs)
  4224. } else {
  4225. argSize = 2; // short (actually i32 in varargs)
  4226. }
  4227. break;
  4228. case 'l':
  4229. var nextNext = HEAP8[((textIndex+2)|0)];
  4230. if (nextNext == 108) {
  4231. textIndex++;
  4232. argSize = 8; // long long
  4233. } else {
  4234. argSize = 4; // long
  4235. }
  4236. break;
  4237. case 'L': // long long
  4238. case 'q': // int64_t
  4239. case 'j': // intmax_t
  4240. argSize = 8;
  4241. break;
  4242. case 'z': // size_t
  4243. case 't': // ptrdiff_t
  4244. case 'I': // signed ptrdiff_t or unsigned size_t
  4245. argSize = 4;
  4246. break;
  4247. default:
  4248. argSize = null;
  4249. }
  4250. if (argSize) textIndex++;
  4251. next = HEAP8[((textIndex+1)|0)];
  4252. // Handle type specifier.
  4253. switch (String.fromCharCode(next)) {
  4254. case 'd': case 'i': case 'u': case 'o': case 'x': case 'X': case 'p': {
  4255. // Integer.
  4256. var signed = next == 100 || next == 105;
  4257. argSize = argSize || 4;
  4258. var currArg = getNextArg('i' + (argSize * 8));
  4259. var origArg = currArg;
  4260. var argText;
  4261. // Flatten i64-1 [low, high] into a (slightly rounded) double
  4262. if (argSize == 8) {
  4263. currArg = Runtime.makeBigInt(currArg[0], currArg[1], next == 117);
  4264. }
  4265. // Truncate to requested size.
  4266. if (argSize <= 4) {
  4267. var limit = Math.pow(256, argSize) - 1;
  4268. currArg = (signed ? reSign : unSign)(currArg & limit, argSize * 8);
  4269. }
  4270. // Format the number.
  4271. var currAbsArg = Math.abs(currArg);
  4272. var prefix = '';
  4273. if (next == 100 || next == 105) {
  4274. if (argSize == 8 && i64Math) argText = i64Math.stringify(origArg[0], origArg[1], null); else
  4275. argText = reSign(currArg, 8 * argSize, 1).toString(10);
  4276. } else if (next == 117) {
  4277. if (argSize == 8 && i64Math) argText = i64Math.stringify(origArg[0], origArg[1], true); else
  4278. argText = unSign(currArg, 8 * argSize, 1).toString(10);
  4279. currArg = Math.abs(currArg);
  4280. } else if (next == 111) {
  4281. argText = (flagAlternative ? '0' : '') + currAbsArg.toString(8);
  4282. } else if (next == 120 || next == 88) {
  4283. prefix = (flagAlternative && currArg != 0) ? '0x' : '';
  4284. if (argSize == 8 && i64Math) {
  4285. if (origArg[1]) {
  4286. argText = (origArg[1]>>>0).toString(16);
  4287. var lower = (origArg[0]>>>0).toString(16);
  4288. while (lower.length < 8) lower = '0' + lower;
  4289. argText += lower;
  4290. } else {
  4291. argText = (origArg[0]>>>0).toString(16);
  4292. }
  4293. } else
  4294. if (currArg < 0) {
  4295. // Represent negative numbers in hex as 2's complement.
  4296. currArg = -currArg;
  4297. argText = (currAbsArg - 1).toString(16);
  4298. var buffer = [];
  4299. for (var i = 0; i < argText.length; i++) {
  4300. buffer.push((0xF - parseInt(argText[i], 16)).toString(16));
  4301. }
  4302. argText = buffer.join('');
  4303. while (argText.length < argSize * 2) argText = 'f' + argText;
  4304. } else {
  4305. argText = currAbsArg.toString(16);
  4306. }
  4307. if (next == 88) {
  4308. prefix = prefix.toUpperCase();
  4309. argText = argText.toUpperCase();
  4310. }
  4311. } else if (next == 112) {
  4312. if (currAbsArg === 0) {
  4313. argText = '(nil)';
  4314. } else {
  4315. prefix = '0x';
  4316. argText = currAbsArg.toString(16);
  4317. }
  4318. }
  4319. if (precisionSet) {
  4320. while (argText.length < precision) {
  4321. argText = '0' + argText;
  4322. }
  4323. }
  4324. // Add sign if needed
  4325. if (currArg >= 0) {
  4326. if (flagAlwaysSigned) {
  4327. prefix = '+' + prefix;
  4328. } else if (flagPadSign) {
  4329. prefix = ' ' + prefix;
  4330. }
  4331. }
  4332. // Move sign to prefix so we zero-pad after the sign
  4333. if (argText.charAt(0) == '-') {
  4334. prefix = '-' + prefix;
  4335. argText = argText.substr(1);
  4336. }
  4337. // Add padding.
  4338. while (prefix.length + argText.length < width) {
  4339. if (flagLeftAlign) {
  4340. argText += ' ';
  4341. } else {
  4342. if (flagZeroPad) {
  4343. argText = '0' + argText;
  4344. } else {
  4345. prefix = ' ' + prefix;
  4346. }
  4347. }
  4348. }
  4349. // Insert the result into the buffer.
  4350. argText = prefix + argText;
  4351. argText.split('').forEach(function(chr) {
  4352. ret.push(chr.charCodeAt(0));
  4353. });
  4354. break;
  4355. }
  4356. case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': {
  4357. // Float.
  4358. var currArg = getNextArg('double');
  4359. var argText;
  4360. if (isNaN(currArg)) {
  4361. argText = 'nan';
  4362. flagZeroPad = false;
  4363. } else if (!isFinite(currArg)) {
  4364. argText = (currArg < 0 ? '-' : '') + 'inf';
  4365. flagZeroPad = false;
  4366. } else {
  4367. var isGeneral = false;
  4368. var effectivePrecision = Math.min(precision, 20);
  4369. // Convert g/G to f/F or e/E, as per:
  4370. // http://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html
  4371. if (next == 103 || next == 71) {
  4372. isGeneral = true;
  4373. precision = precision || 1;
  4374. var exponent = parseInt(currArg.toExponential(effectivePrecision).split('e')[1], 10);
  4375. if (precision > exponent && exponent >= -4) {
  4376. next = ((next == 103) ? 'f' : 'F').charCodeAt(0);
  4377. precision -= exponent + 1;
  4378. } else {
  4379. next = ((next == 103) ? 'e' : 'E').charCodeAt(0);
  4380. precision--;
  4381. }
  4382. effectivePrecision = Math.min(precision, 20);
  4383. }
  4384. if (next == 101 || next == 69) {
  4385. argText = currArg.toExponential(effectivePrecision);
  4386. // Make sure the exponent has at least 2 digits.
  4387. if (/[eE][-+]\d$/.test(argText)) {
  4388. argText = argText.slice(0, -1) + '0' + argText.slice(-1);
  4389. }
  4390. } else if (next == 102 || next == 70) {
  4391. argText = currArg.toFixed(effectivePrecision);
  4392. if (currArg === 0 && __reallyNegative(currArg)) {
  4393. argText = '-' + argText;
  4394. }
  4395. }
  4396. var parts = argText.split('e');
  4397. if (isGeneral && !flagAlternative) {
  4398. // Discard trailing zeros and periods.
  4399. while (parts[0].length > 1 && parts[0].indexOf('.') != -1 &&
  4400. (parts[0].slice(-1) == '0' || parts[0].slice(-1) == '.')) {
  4401. parts[0] = parts[0].slice(0, -1);
  4402. }
  4403. } else {
  4404. // Make sure we have a period in alternative mode.
  4405. if (flagAlternative && argText.indexOf('.') == -1) parts[0] += '.';
  4406. // Zero pad until required precision.
  4407. while (precision > effectivePrecision++) parts[0] += '0';
  4408. }
  4409. argText = parts[0] + (parts.length > 1 ? 'e' + parts[1] : '');
  4410. // Capitalize 'E' if needed.
  4411. if (next == 69) argText = argText.toUpperCase();
  4412. // Add sign.
  4413. if (currArg >= 0) {
  4414. if (flagAlwaysSigned) {
  4415. argText = '+' + argText;
  4416. } else if (flagPadSign) {
  4417. argText = ' ' + argText;
  4418. }
  4419. }
  4420. }
  4421. // Add padding.
  4422. while (argText.length < width) {
  4423. if (flagLeftAlign) {
  4424. argText += ' ';
  4425. } else {
  4426. if (flagZeroPad && (argText[0] == '-' || argText[0] == '+')) {
  4427. argText = argText[0] + '0' + argText.slice(1);
  4428. } else {
  4429. argText = (flagZeroPad ? '0' : ' ') + argText;
  4430. }
  4431. }
  4432. }
  4433. // Adjust case.
  4434. if (next < 97) argText = argText.toUpperCase();
  4435. // Insert the result into the buffer.
  4436. argText.split('').forEach(function(chr) {
  4437. ret.push(chr.charCodeAt(0));
  4438. });
  4439. break;
  4440. }
  4441. case 's': {
  4442. // String.
  4443. var arg = getNextArg('i8*');
  4444. var argLength = arg ? _strlen(arg) : '(null)'.length;
  4445. if (precisionSet) argLength = Math.min(argLength, precision);
  4446. if (!flagLeftAlign) {
  4447. while (argLength < width--) {
  4448. ret.push(32);
  4449. }
  4450. }
  4451. if (arg) {
  4452. for (var i = 0; i < argLength; i++) {
  4453. ret.push(HEAPU8[((arg++)|0)]);
  4454. }
  4455. } else {
  4456. ret = ret.concat(intArrayFromString('(null)'.substr(0, argLength), true));
  4457. }
  4458. if (flagLeftAlign) {
  4459. while (argLength < width--) {
  4460. ret.push(32);
  4461. }
  4462. }
  4463. break;
  4464. }
  4465. case 'c': {
  4466. // Character.
  4467. if (flagLeftAlign) ret.push(getNextArg('i8'));
  4468. while (--width > 0) {
  4469. ret.push(32);
  4470. }
  4471. if (!flagLeftAlign) ret.push(getNextArg('i8'));
  4472. break;
  4473. }
  4474. case 'n': {
  4475. // Write the length written so far to the next parameter.
  4476. var ptr = getNextArg('i32*');
  4477. HEAP32[((ptr)>>2)]=ret.length;
  4478. break;
  4479. }
  4480. case '%': {
  4481. // Literal percent sign.
  4482. ret.push(curr);
  4483. break;
  4484. }
  4485. default: {
  4486. // Unknown specifiers remain untouched.
  4487. for (var i = startTextIndex; i < textIndex + 2; i++) {
  4488. ret.push(HEAP8[(i)]);
  4489. }
  4490. }
  4491. }
  4492. textIndex += 2;
  4493. // TODO: Support a/A (hex float) and m (last error) specifiers.
  4494. // TODO: Support %1${specifier} for arg selection.
  4495. } else {
  4496. ret.push(curr);
  4497. textIndex += 1;
  4498. }
  4499. }
  4500. return ret;
  4501. }function _fprintf(stream, format, varargs) {
  4502. // int fprintf(FILE *restrict stream, const char *restrict format, ...);
  4503. // http://pubs.opengroup.org/onlinepubs/000095399/functions/printf.html
  4504. var result = __formatString(format, varargs);
  4505. var stack = Runtime.stackSave();
  4506. var ret = _fwrite(allocate(result, 'i8', ALLOC_STACK), 1, result.length, stream);
  4507. Runtime.stackRestore(stack);
  4508. return ret;
  4509. }function _printf(format, varargs) {
  4510. // int printf(const char *restrict format, ...);
  4511. // http://pubs.opengroup.org/onlinepubs/000095399/functions/printf.html
  4512. var stdout = HEAP32[((_stdout)>>2)];
  4513. return _fprintf(stdout, format, varargs);
  4514. }
  4515. function __ZSt18uncaught_exceptionv() { // std::uncaught_exception()
  4516. return !!__ZSt18uncaught_exceptionv.uncaught_exception;
  4517. }
  4518. function ___cxa_is_number_type(type) {
  4519. var isNumber = false;
  4520. try { if (type == __ZTIi) isNumber = true } catch(e){}
  4521. try { if (type == __ZTIj) isNumber = true } catch(e){}
  4522. try { if (type == __ZTIl) isNumber = true } catch(e){}
  4523. try { if (type == __ZTIm) isNumber = true } catch(e){}
  4524. try { if (type == __ZTIx) isNumber = true } catch(e){}
  4525. try { if (type == __ZTIy) isNumber = true } catch(e){}
  4526. try { if (type == __ZTIf) isNumber = true } catch(e){}
  4527. try { if (type == __ZTId) isNumber = true } catch(e){}
  4528. try { if (type == __ZTIe) isNumber = true } catch(e){}
  4529. try { if (type == __ZTIc) isNumber = true } catch(e){}
  4530. try { if (type == __ZTIa) isNumber = true } catch(e){}
  4531. try { if (type == __ZTIh) isNumber = true } catch(e){}
  4532. try { if (type == __ZTIs) isNumber = true } catch(e){}
  4533. try { if (type == __ZTIt) isNumber = true } catch(e){}
  4534. return isNumber;
  4535. }function ___cxa_does_inherit(definiteType, possibilityType, possibility) {
  4536. if (possibility == 0) return false;
  4537. if (possibilityType == 0 || possibilityType == definiteType)
  4538. return true;
  4539. var possibility_type_info;
  4540. if (___cxa_is_number_type(possibilityType)) {
  4541. possibility_type_info = possibilityType;
  4542. } else {
  4543. var possibility_type_infoAddr = HEAP32[((possibilityType)>>2)] - 8;
  4544. possibility_type_info = HEAP32[((possibility_type_infoAddr)>>2)];
  4545. }
  4546. switch (possibility_type_info) {
  4547. case 0: // possibility is a pointer
  4548. // See if definite type is a pointer
  4549. var definite_type_infoAddr = HEAP32[((definiteType)>>2)] - 8;
  4550. var definite_type_info = HEAP32[((definite_type_infoAddr)>>2)];
  4551. if (definite_type_info == 0) {
  4552. // Also a pointer; compare base types of pointers
  4553. var defPointerBaseAddr = definiteType+8;
  4554. var defPointerBaseType = HEAP32[((defPointerBaseAddr)>>2)];
  4555. var possPointerBaseAddr = possibilityType+8;
  4556. var possPointerBaseType = HEAP32[((possPointerBaseAddr)>>2)];
  4557. return ___cxa_does_inherit(defPointerBaseType, possPointerBaseType, possibility);
  4558. } else
  4559. return false; // one pointer and one non-pointer
  4560. case 1: // class with no base class
  4561. return false;
  4562. case 2: // class with base class
  4563. var parentTypeAddr = possibilityType + 8;
  4564. var parentType = HEAP32[((parentTypeAddr)>>2)];
  4565. return ___cxa_does_inherit(definiteType, parentType, possibility);
  4566. default:
  4567. return false; // some unencountered type
  4568. }
  4569. }
  4570. function ___resumeException(ptr) {
  4571. if (!___cxa_last_thrown_exception) { ___cxa_last_thrown_exception = ptr; }
  4572. throw ptr + " - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch.";
  4573. }
  4574. var ___cxa_last_thrown_exception=0;
  4575. var ___cxa_exception_header_size=8;function ___cxa_find_matching_catch(thrown, throwntype) {
  4576. if (thrown == -1) thrown = ___cxa_last_thrown_exception;
  4577. header = thrown - ___cxa_exception_header_size;
  4578. if (throwntype == -1) throwntype = HEAP32[((header)>>2)];
  4579. var typeArray = Array.prototype.slice.call(arguments, 2);
  4580. // If throwntype is a pointer, this means a pointer has been
  4581. // thrown. When a pointer is thrown, actually what's thrown
  4582. // is a pointer to the pointer. We'll dereference it.
  4583. if (throwntype != 0 && !___cxa_is_number_type(throwntype)) {
  4584. var throwntypeInfoAddr= HEAP32[((throwntype)>>2)] - 8;
  4585. var throwntypeInfo= HEAP32[((throwntypeInfoAddr)>>2)];
  4586. if (throwntypeInfo == 0)
  4587. thrown = HEAP32[((thrown)>>2)];
  4588. }
  4589. // The different catch blocks are denoted by different types.
  4590. // Due to inheritance, those types may not precisely match the
  4591. // type of the thrown object. Find one which matches, and
  4592. // return the type of the catch block which should be called.
  4593. for (var i = 0; i < typeArray.length; i++) {
  4594. if (___cxa_does_inherit(typeArray[i], throwntype, thrown))
  4595. return ((asm["setTempRet0"](typeArray[i]),thrown)|0);
  4596. }
  4597. // Shouldn't happen unless we have bogus data in typeArray
  4598. // or encounter a type for which emscripten doesn't have suitable
  4599. // typeinfo defined. Best-efforts match just in case.
  4600. return ((asm["setTempRet0"](throwntype),thrown)|0);
  4601. }function ___gxx_personality_v0() {
  4602. }
  4603. function _clock() {
  4604. if (_clock.start === undefined) _clock.start = Date.now();
  4605. return Math.floor((Date.now() - _clock.start) * (1000000/1000));
  4606. }
  4607. function __exit(status) {
  4608. // void _exit(int status);
  4609. // http://pubs.opengroup.org/onlinepubs/000095399/functions/exit.html
  4610. Module['exit'](status);
  4611. }function _exit(status) {
  4612. __exit(status);
  4613. }function __ZSt9terminatev() {
  4614. _exit(-1234);
  4615. }
  4616. function ___assert_fail(condition, filename, line, func) {
  4617. ABORT = true;
  4618. throw 'Assertion failed: ' + Pointer_stringify(condition) + ', at: ' + [filename ? Pointer_stringify(filename) : 'unknown filename', line, func ? Pointer_stringify(func) : 'unknown function'] + ' at ' + stackTrace();
  4619. }
  4620. function _emscripten_memcpy_big(dest, src, num) {
  4621. HEAPU8.set(HEAPU8.subarray(src, src+num), dest);
  4622. return dest;
  4623. }
  4624. Module["_memcpy"] = _memcpy;var _llvm_memcpy_p0i8_p0i8_i32=_memcpy;
  4625. function ___cxa_allocate_exception(size) {
  4626. var ptr = _malloc(size + ___cxa_exception_header_size);
  4627. return ptr + ___cxa_exception_header_size;
  4628. }
  4629. function ___cxa_free_exception(ptr) {
  4630. try {
  4631. return _free(ptr - ___cxa_exception_header_size);
  4632. } catch(e) { // XXX FIXME
  4633. }
  4634. }
  4635. function ___cxa_throw(ptr, type, destructor) {
  4636. if (!___cxa_throw.initialized) {
  4637. try {
  4638. HEAP32[((__ZTVN10__cxxabiv119__pointer_type_infoE)>>2)]=0; // Workaround for libcxxabi integration bug
  4639. } catch(e){}
  4640. try {
  4641. HEAP32[((__ZTVN10__cxxabiv117__class_type_infoE)>>2)]=1; // Workaround for libcxxabi integration bug
  4642. } catch(e){}
  4643. try {
  4644. HEAP32[((__ZTVN10__cxxabiv120__si_class_type_infoE)>>2)]=2; // Workaround for libcxxabi integration bug
  4645. } catch(e){}
  4646. ___cxa_throw.initialized = true;
  4647. }
  4648. var header = ptr - ___cxa_exception_header_size;
  4649. HEAP32[((header)>>2)]=type;
  4650. HEAP32[(((header)+(4))>>2)]=destructor;
  4651. ___cxa_last_thrown_exception = ptr;
  4652. if (!("uncaught_exception" in __ZSt18uncaught_exceptionv)) {
  4653. __ZSt18uncaught_exceptionv.uncaught_exception = 1;
  4654. } else {
  4655. __ZSt18uncaught_exceptionv.uncaught_exception++;
  4656. }
  4657. throw ptr + " - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch.";
  4658. }
  4659. function ___cxa_call_unexpected(exception) {
  4660. Module.printErr('Unexpected exception thrown, this is not properly supported - aborting');
  4661. ABORT = true;
  4662. throw exception;
  4663. }
  4664. var ___cxa_caught_exceptions=[];function ___cxa_begin_catch(ptr) {
  4665. __ZSt18uncaught_exceptionv.uncaught_exception--;
  4666. ___cxa_caught_exceptions.push(___cxa_last_thrown_exception);
  4667. return ptr;
  4668. }
  4669. function ___cxa_end_catch() {
  4670. if (___cxa_end_catch.rethrown) {
  4671. ___cxa_end_catch.rethrown = false;
  4672. return;
  4673. }
  4674. // Clear state flag.
  4675. asm['setThrew'](0);
  4676. // Call destructor if one is registered then clear it.
  4677. var ptr = ___cxa_caught_exceptions.pop();
  4678. if (ptr) {
  4679. header = ptr - ___cxa_exception_header_size;
  4680. var destructor = HEAP32[(((header)+(4))>>2)];
  4681. if (destructor) {
  4682. Runtime.dynCall('vi', destructor, [ptr]);
  4683. HEAP32[(((header)+(4))>>2)]=0;
  4684. }
  4685. ___cxa_free_exception(ptr);
  4686. ___cxa_last_thrown_exception = 0;
  4687. }
  4688. }
  4689. Module["_memset"] = _memset;var _llvm_memset_p0i8_i32=_memset;
  4690. Module["_memmove"] = _memmove;var _llvm_memmove_p0i8_p0i8_i32=_memmove;
  4691. function _recv(fd, buf, len, flags) {
  4692. var sock = SOCKFS.getSocket(fd);
  4693. if (!sock) {
  4694. ___setErrNo(ERRNO_CODES.EBADF);
  4695. return -1;
  4696. }
  4697. // TODO honor flags
  4698. return _read(fd, buf, len);
  4699. }
  4700. function _pread(fildes, buf, nbyte, offset) {
  4701. // ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset);
  4702. // http://pubs.opengroup.org/onlinepubs/000095399/functions/read.html
  4703. var stream = FS.getStream(fildes);
  4704. if (!stream) {
  4705. ___setErrNo(ERRNO_CODES.EBADF);
  4706. return -1;
  4707. }
  4708. try {
  4709. var slab = HEAP8;
  4710. return FS.read(stream, slab, buf, nbyte, offset);
  4711. } catch (e) {
  4712. FS.handleFSError(e);
  4713. return -1;
  4714. }
  4715. }function _read(fildes, buf, nbyte) {
  4716. // ssize_t read(int fildes, void *buf, size_t nbyte);
  4717. // http://pubs.opengroup.org/onlinepubs/000095399/functions/read.html
  4718. var stream = FS.getStream(fildes);
  4719. if (!stream) {
  4720. ___setErrNo(ERRNO_CODES.EBADF);
  4721. return -1;
  4722. }
  4723. try {
  4724. var slab = HEAP8;
  4725. return FS.read(stream, slab, buf, nbyte);
  4726. } catch (e) {
  4727. FS.handleFSError(e);
  4728. return -1;
  4729. }
  4730. }function _fread(ptr, size, nitems, stream) {
  4731. // size_t fread(void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream);
  4732. // http://pubs.opengroup.org/onlinepubs/000095399/functions/fread.html
  4733. var bytesToRead = nitems * size;
  4734. if (bytesToRead == 0) {
  4735. return 0;
  4736. }
  4737. var bytesRead = 0;
  4738. var streamObj = FS.getStreamFromPtr(stream);
  4739. if (!streamObj) {
  4740. ___setErrNo(ERRNO_CODES.EBADF);
  4741. return 0;
  4742. }
  4743. while (streamObj.ungotten.length && bytesToRead > 0) {
  4744. HEAP8[((ptr++)|0)]=streamObj.ungotten.pop();
  4745. bytesToRead--;
  4746. bytesRead++;
  4747. }
  4748. var err = _read(streamObj.fd, ptr, bytesToRead);
  4749. if (err == -1) {
  4750. if (streamObj) streamObj.error = true;
  4751. return 0;
  4752. }
  4753. bytesRead += err;
  4754. if (bytesRead < bytesToRead) streamObj.eof = true;
  4755. return Math.floor(bytesRead / size);
  4756. }
  4757. function _lseek(fildes, offset, whence) {
  4758. // off_t lseek(int fildes, off_t offset, int whence);
  4759. // http://pubs.opengroup.org/onlinepubs/000095399/functions/lseek.html
  4760. var stream = FS.getStream(fildes);
  4761. if (!stream) {
  4762. ___setErrNo(ERRNO_CODES.EBADF);
  4763. return -1;
  4764. }
  4765. try {
  4766. return FS.llseek(stream, offset, whence);
  4767. } catch (e) {
  4768. FS.handleFSError(e);
  4769. return -1;
  4770. }
  4771. }function _fseek(stream, offset, whence) {
  4772. // int fseek(FILE *stream, long offset, int whence);
  4773. // http://pubs.opengroup.org/onlinepubs/000095399/functions/fseek.html
  4774. var fd = _fileno(stream);
  4775. var ret = _lseek(fd, offset, whence);
  4776. if (ret == -1) {
  4777. return -1;
  4778. }
  4779. stream = FS.getStreamFromPtr(stream);
  4780. stream.eof = false;
  4781. return 0;
  4782. }var _fseeko=_fseek;
  4783. function _ftell(stream) {
  4784. // long ftell(FILE *stream);
  4785. // http://pubs.opengroup.org/onlinepubs/000095399/functions/ftell.html
  4786. stream = FS.getStreamFromPtr(stream);
  4787. if (!stream) {
  4788. ___setErrNo(ERRNO_CODES.EBADF);
  4789. return -1;
  4790. }
  4791. if (FS.isChrdev(stream.node.mode)) {
  4792. ___setErrNo(ERRNO_CODES.ESPIPE);
  4793. return -1;
  4794. } else {
  4795. return stream.position;
  4796. }
  4797. }var _ftello=_ftell;
  4798. function _close(fildes) {
  4799. // int close(int fildes);
  4800. // http://pubs.opengroup.org/onlinepubs/000095399/functions/close.html
  4801. var stream = FS.getStream(fildes);
  4802. if (!stream) {
  4803. ___setErrNo(ERRNO_CODES.EBADF);
  4804. return -1;
  4805. }
  4806. try {
  4807. FS.close(stream);
  4808. return 0;
  4809. } catch (e) {
  4810. FS.handleFSError(e);
  4811. return -1;
  4812. }
  4813. }
  4814. function _fsync(fildes) {
  4815. // int fsync(int fildes);
  4816. // http://pubs.opengroup.org/onlinepubs/000095399/functions/fsync.html
  4817. var stream = FS.getStream(fildes);
  4818. if (stream) {
  4819. // We write directly to the file system, so there's nothing to do here.
  4820. return 0;
  4821. } else {
  4822. ___setErrNo(ERRNO_CODES.EBADF);
  4823. return -1;
  4824. }
  4825. }function _fclose(stream) {
  4826. // int fclose(FILE *stream);
  4827. // http://pubs.opengroup.org/onlinepubs/000095399/functions/fclose.html
  4828. var fd = _fileno(stream);
  4829. _fsync(fd);
  4830. return _close(fd);
  4831. }
  4832. function _open(path, oflag, varargs) {
  4833. // int open(const char *path, int oflag, ...);
  4834. // http://pubs.opengroup.org/onlinepubs/009695399/functions/open.html
  4835. var mode = HEAP32[((varargs)>>2)];
  4836. path = Pointer_stringify(path);
  4837. try {
  4838. var stream = FS.open(path, oflag, mode);
  4839. return stream.fd;
  4840. } catch (e) {
  4841. FS.handleFSError(e);
  4842. return -1;
  4843. }
  4844. }function _fopen(filename, mode) {
  4845. // FILE *fopen(const char *restrict filename, const char *restrict mode);
  4846. // http://pubs.opengroup.org/onlinepubs/000095399/functions/fopen.html
  4847. var flags;
  4848. mode = Pointer_stringify(mode);
  4849. if (mode[0] == 'r') {
  4850. if (mode.indexOf('+') != -1) {
  4851. flags = 2;
  4852. } else {
  4853. flags = 0;
  4854. }
  4855. } else if (mode[0] == 'w') {
  4856. if (mode.indexOf('+') != -1) {
  4857. flags = 2;
  4858. } else {
  4859. flags = 1;
  4860. }
  4861. flags |= 64;
  4862. flags |= 512;
  4863. } else if (mode[0] == 'a') {
  4864. if (mode.indexOf('+') != -1) {
  4865. flags = 2;
  4866. } else {
  4867. flags = 1;
  4868. }
  4869. flags |= 64;
  4870. flags |= 1024;
  4871. } else {
  4872. ___setErrNo(ERRNO_CODES.EINVAL);
  4873. return 0;
  4874. }
  4875. var fd = _open(filename, flags, allocate([0x1FF, 0, 0, 0], 'i32', ALLOC_STACK)); // All creation permissions.
  4876. return fd === -1 ? 0 : FS.getPtrForStream(FS.getStream(fd));
  4877. }
  4878. function _llvm_lifetime_start() {}
  4879. function _llvm_lifetime_end() {}
  4880. var _llvm_memset_p0i8_i64=_memset;
  4881. function _fputs(s, stream) {
  4882. // int fputs(const char *restrict s, FILE *restrict stream);
  4883. // http://pubs.opengroup.org/onlinepubs/000095399/functions/fputs.html
  4884. var fd = _fileno(stream);
  4885. return _write(fd, s, _strlen(s));
  4886. }
  4887. function _fputc(c, stream) {
  4888. // int fputc(int c, FILE *stream);
  4889. // http://pubs.opengroup.org/onlinepubs/000095399/functions/fputc.html
  4890. var chr = unSign(c & 0xFF);
  4891. HEAP8[((_fputc.ret)|0)]=chr;
  4892. var fd = _fileno(stream);
  4893. var ret = _write(fd, _fputc.ret, 1);
  4894. if (ret == -1) {
  4895. var streamObj = FS.getStreamFromPtr(stream);
  4896. if (streamObj) streamObj.error = true;
  4897. return -1;
  4898. } else {
  4899. return chr;
  4900. }
  4901. }function _puts(s) {
  4902. // int puts(const char *s);
  4903. // http://pubs.opengroup.org/onlinepubs/000095399/functions/puts.html
  4904. // NOTE: puts() always writes an extra newline.
  4905. var stdout = HEAP32[((_stdout)>>2)];
  4906. var ret = _fputs(s, stdout);
  4907. if (ret < 0) {
  4908. return ret;
  4909. } else {
  4910. var newlineRet = _fputc(10, stdout);
  4911. return (newlineRet < 0) ? -1 : ret + 1;
  4912. }
  4913. }
  4914. var _cos=Math_cos;
  4915. var _sin=Math_sin;
  4916. function _llvm_umul_with_overflow_i32(x, y) {
  4917. x = x>>>0;
  4918. y = y>>>0;
  4919. return ((asm["setTempRet0"](x*y > 4294967295),(x*y)>>>0)|0);
  4920. }
  4921. var _sqrt=Math_sqrt;
  4922. function _snprintf(s, n, format, varargs) {
  4923. // int snprintf(char *restrict s, size_t n, const char *restrict format, ...);
  4924. // http://pubs.opengroup.org/onlinepubs/000095399/functions/printf.html
  4925. var result = __formatString(format, varargs);
  4926. var limit = (n === undefined) ? result.length
  4927. : Math.min(result.length, Math.max(n - 1, 0));
  4928. if (s < 0) {
  4929. s = -s;
  4930. var buf = _malloc(limit+1);
  4931. HEAP32[((s)>>2)]=buf;
  4932. s = buf;
  4933. }
  4934. for (var i = 0; i < limit; i++) {
  4935. HEAP8[(((s)+(i))|0)]=result[i];
  4936. }
  4937. if (limit < n || (n === undefined)) HEAP8[(((s)+(i))|0)]=0;
  4938. return result.length;
  4939. }function _sprintf(s, format, varargs) {
  4940. // int sprintf(char *restrict s, const char *restrict format, ...);
  4941. // http://pubs.opengroup.org/onlinepubs/000095399/functions/printf.html
  4942. return _snprintf(s, undefined, format, varargs);
  4943. }
  4944. var _fabs=Math_abs;
  4945. var _floor=Math_floor;
  4946. function _sysconf(name) {
  4947. // long sysconf(int name);
  4948. // http://pubs.opengroup.org/onlinepubs/009695399/functions/sysconf.html
  4949. switch(name) {
  4950. case 30: return PAGE_SIZE;
  4951. case 132:
  4952. case 133:
  4953. case 12:
  4954. case 137:
  4955. case 138:
  4956. case 15:
  4957. case 235:
  4958. case 16:
  4959. case 17:
  4960. case 18:
  4961. case 19:
  4962. case 20:
  4963. case 149:
  4964. case 13:
  4965. case 10:
  4966. case 236:
  4967. case 153:
  4968. case 9:
  4969. case 21:
  4970. case 22:
  4971. case 159:
  4972. case 154:
  4973. case 14:
  4974. case 77:
  4975. case 78:
  4976. case 139:
  4977. case 80:
  4978. case 81:
  4979. case 79:
  4980. case 82:
  4981. case 68:
  4982. case 67:
  4983. case 164:
  4984. case 11:
  4985. case 29:
  4986. case 47:
  4987. case 48:
  4988. case 95:
  4989. case 52:
  4990. case 51:
  4991. case 46:
  4992. return 200809;
  4993. case 27:
  4994. case 246:
  4995. case 127:
  4996. case 128:
  4997. case 23:
  4998. case 24:
  4999. case 160:
  5000. case 161:
  5001. case 181:
  5002. case 182:
  5003. case 242:
  5004. case 183:
  5005. case 184:
  5006. case 243:
  5007. case 244:
  5008. case 245:
  5009. case 165:
  5010. case 178:
  5011. case 179:
  5012. case 49:
  5013. case 50:
  5014. case 168:
  5015. case 169:
  5016. case 175:
  5017. case 170:
  5018. case 171:
  5019. case 172:
  5020. case 97:
  5021. case 76:
  5022. case 32:
  5023. case 173:
  5024. case 35:
  5025. return -1;
  5026. case 176:
  5027. case 177:
  5028. case 7:
  5029. case 155:
  5030. case 8:
  5031. case 157:
  5032. case 125:
  5033. case 126:
  5034. case 92:
  5035. case 93:
  5036. case 129:
  5037. case 130:
  5038. case 131:
  5039. case 94:
  5040. case 91:
  5041. return 1;
  5042. case 74:
  5043. case 60:
  5044. case 69:
  5045. case 70:
  5046. case 4:
  5047. return 1024;
  5048. case 31:
  5049. case 42:
  5050. case 72:
  5051. return 32;
  5052. case 87:
  5053. case 26:
  5054. case 33:
  5055. return 2147483647;
  5056. case 34:
  5057. case 1:
  5058. return 47839;
  5059. case 38:
  5060. case 36:
  5061. return 99;
  5062. case 43:
  5063. case 37:
  5064. return 2048;
  5065. case 0: return 2097152;
  5066. case 3: return 65536;
  5067. case 28: return 32768;
  5068. case 44: return 32767;
  5069. case 75: return 16384;
  5070. case 39: return 1000;
  5071. case 89: return 700;
  5072. case 71: return 256;
  5073. case 40: return 255;
  5074. case 2: return 100;
  5075. case 180: return 64;
  5076. case 25: return 20;
  5077. case 5: return 16;
  5078. case 6: return 6;
  5079. case 73: return 4;
  5080. case 84: return 1;
  5081. }
  5082. ___setErrNo(ERRNO_CODES.EINVAL);
  5083. return -1;
  5084. }
  5085. function _times(buffer) {
  5086. // clock_t times(struct tms *buffer);
  5087. // http://pubs.opengroup.org/onlinepubs/009695399/functions/times.html
  5088. // NOTE: This is fake, since we can't calculate real CPU time usage in JS.
  5089. if (buffer !== 0) {
  5090. _memset(buffer, 0, 16);
  5091. }
  5092. return 0;
  5093. }
  5094. function _pthread_mutex_lock() {}
  5095. function _pthread_mutex_unlock() {}
  5096. function ___cxa_guard_acquire(variable) {
  5097. if (!HEAP8[(variable)]) { // ignore SAFE_HEAP stuff because llvm mixes i64 and i8 here
  5098. HEAP8[(variable)]=1;
  5099. return 1;
  5100. }
  5101. return 0;
  5102. }
  5103. function ___cxa_guard_release() {}
  5104. function _pthread_cond_broadcast() {
  5105. return 0;
  5106. }
  5107. function _pthread_cond_wait() {
  5108. return 0;
  5109. }
  5110. function _atexit(func, arg) {
  5111. __ATEXIT__.unshift({ func: func, arg: arg });
  5112. }var ___cxa_atexit=_atexit;
  5113. function _ungetc(c, stream) {
  5114. // int ungetc(int c, FILE *stream);
  5115. // http://pubs.opengroup.org/onlinepubs/000095399/functions/ungetc.html
  5116. stream = FS.getStreamFromPtr(stream);
  5117. if (!stream) {
  5118. return -1;
  5119. }
  5120. if (c === -1) {
  5121. // do nothing for EOF character
  5122. return c;
  5123. }
  5124. c = unSign(c & 0xFF);
  5125. stream.ungotten.push(c);
  5126. stream.eof = false;
  5127. return c;
  5128. }
  5129. function _fgetc(stream) {
  5130. // int fgetc(FILE *stream);
  5131. // http://pubs.opengroup.org/onlinepubs/000095399/functions/fgetc.html
  5132. var streamObj = FS.getStreamFromPtr(stream);
  5133. if (!streamObj) return -1;
  5134. if (streamObj.eof || streamObj.error) return -1;
  5135. var ret = _fread(_fgetc.ret, 1, 1, stream);
  5136. if (ret == 0) {
  5137. return -1;
  5138. } else if (ret == -1) {
  5139. streamObj.error = true;
  5140. return -1;
  5141. } else {
  5142. return HEAPU8[((_fgetc.ret)|0)];
  5143. }
  5144. }var _getc=_fgetc;
  5145. function __ZNSt9exceptionD2Ev() {}
  5146. function ___errno_location() {
  5147. return ___errno_state;
  5148. }
  5149. function _strerror_r(errnum, strerrbuf, buflen) {
  5150. if (errnum in ERRNO_MESSAGES) {
  5151. if (ERRNO_MESSAGES[errnum].length > buflen - 1) {
  5152. return ___setErrNo(ERRNO_CODES.ERANGE);
  5153. } else {
  5154. var msg = ERRNO_MESSAGES[errnum];
  5155. writeAsciiToMemory(msg, strerrbuf);
  5156. return 0;
  5157. }
  5158. } else {
  5159. return ___setErrNo(ERRNO_CODES.EINVAL);
  5160. }
  5161. }function _strerror(errnum) {
  5162. if (!_strerror.buffer) _strerror.buffer = _malloc(256);
  5163. _strerror_r(errnum, _strerror.buffer, 256);
  5164. return _strerror.buffer;
  5165. }
  5166. function _abort() {
  5167. Module['abort']();
  5168. }
  5169. function ___cxa_rethrow() {
  5170. ___cxa_end_catch.rethrown = true;
  5171. var ptr = ___cxa_caught_exceptions.pop();
  5172. throw ptr + " - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch.";
  5173. }
  5174. function ___cxa_guard_abort() {}
  5175. function _isxdigit(chr) {
  5176. return (chr >= 48 && chr <= 57) ||
  5177. (chr >= 97 && chr <= 102) ||
  5178. (chr >= 65 && chr <= 70);
  5179. }function _isxdigit_l(chr) {
  5180. return _isxdigit(chr); // no locale support yet
  5181. }
  5182. function _isdigit(chr) {
  5183. return chr >= 48 && chr <= 57;
  5184. }function _isdigit_l(chr) {
  5185. return _isdigit(chr); // no locale support yet
  5186. }
  5187. function __getFloat(text) {
  5188. return /^[+-]?[0-9]*\.?[0-9]+([eE][+-]?[0-9]+)?/.exec(text);
  5189. }function __scanString(format, get, unget, varargs) {
  5190. if (!__scanString.whiteSpace) {
  5191. __scanString.whiteSpace = {};
  5192. __scanString.whiteSpace[32] = 1;
  5193. __scanString.whiteSpace[9] = 1;
  5194. __scanString.whiteSpace[10] = 1;
  5195. __scanString.whiteSpace[11] = 1;
  5196. __scanString.whiteSpace[12] = 1;
  5197. __scanString.whiteSpace[13] = 1;
  5198. }
  5199. // Supports %x, %4x, %d.%d, %lld, %s, %f, %lf.
  5200. // TODO: Support all format specifiers.
  5201. format = Pointer_stringify(format);
  5202. var soFar = 0;
  5203. if (format.indexOf('%n') >= 0) {
  5204. // need to track soFar
  5205. var _get = get;
  5206. get = function get() {
  5207. soFar++;
  5208. return _get();
  5209. }
  5210. var _unget = unget;
  5211. unget = function unget() {
  5212. soFar--;
  5213. return _unget();
  5214. }
  5215. }
  5216. var formatIndex = 0;
  5217. var argsi = 0;
  5218. var fields = 0;
  5219. var argIndex = 0;
  5220. var next;
  5221. mainLoop:
  5222. for (var formatIndex = 0; formatIndex < format.length;) {
  5223. if (format[formatIndex] === '%' && format[formatIndex+1] == 'n') {
  5224. var argPtr = HEAP32[(((varargs)+(argIndex))>>2)];
  5225. argIndex += Runtime.getAlignSize('void*', null, true);
  5226. HEAP32[((argPtr)>>2)]=soFar;
  5227. formatIndex += 2;
  5228. continue;
  5229. }
  5230. if (format[formatIndex] === '%') {
  5231. var nextC = format.indexOf('c', formatIndex+1);
  5232. if (nextC > 0) {
  5233. var maxx = 1;
  5234. if (nextC > formatIndex+1) {
  5235. var sub = format.substring(formatIndex+1, nextC);
  5236. maxx = parseInt(sub);
  5237. if (maxx != sub) maxx = 0;
  5238. }
  5239. if (maxx) {
  5240. var argPtr = HEAP32[(((varargs)+(argIndex))>>2)];
  5241. argIndex += Runtime.getAlignSize('void*', null, true);
  5242. fields++;
  5243. for (var i = 0; i < maxx; i++) {
  5244. next = get();
  5245. HEAP8[((argPtr++)|0)]=next;
  5246. if (next === 0) return i > 0 ? fields : fields-1; // we failed to read the full length of this field
  5247. }
  5248. formatIndex += nextC - formatIndex + 1;
  5249. continue;
  5250. }
  5251. }
  5252. }
  5253. // handle %[...]
  5254. if (format[formatIndex] === '%' && format.indexOf('[', formatIndex+1) > 0) {
  5255. var match = /\%([0-9]*)\[(\^)?(\]?[^\]]*)\]/.exec(format.substring(formatIndex));
  5256. if (match) {
  5257. var maxNumCharacters = parseInt(match[1]) || Infinity;
  5258. var negateScanList = (match[2] === '^');
  5259. var scanList = match[3];
  5260. // expand "middle" dashs into character sets
  5261. var middleDashMatch;
  5262. while ((middleDashMatch = /([^\-])\-([^\-])/.exec(scanList))) {
  5263. var rangeStartCharCode = middleDashMatch[1].charCodeAt(0);
  5264. var rangeEndCharCode = middleDashMatch[2].charCodeAt(0);
  5265. for (var expanded = ''; rangeStartCharCode <= rangeEndCharCode; expanded += String.fromCharCode(rangeStartCharCode++));
  5266. scanList = scanList.replace(middleDashMatch[1] + '-' + middleDashMatch[2], expanded);
  5267. }
  5268. var argPtr = HEAP32[(((varargs)+(argIndex))>>2)];
  5269. argIndex += Runtime.getAlignSize('void*', null, true);
  5270. fields++;
  5271. for (var i = 0; i < maxNumCharacters; i++) {
  5272. next = get();
  5273. if (negateScanList) {
  5274. if (scanList.indexOf(String.fromCharCode(next)) < 0) {
  5275. HEAP8[((argPtr++)|0)]=next;
  5276. } else {
  5277. unget();
  5278. break;
  5279. }
  5280. } else {
  5281. if (scanList.indexOf(String.fromCharCode(next)) >= 0) {
  5282. HEAP8[((argPtr++)|0)]=next;
  5283. } else {
  5284. unget();
  5285. break;
  5286. }
  5287. }
  5288. }
  5289. // write out null-terminating character
  5290. HEAP8[((argPtr++)|0)]=0;
  5291. formatIndex += match[0].length;
  5292. continue;
  5293. }
  5294. }
  5295. // remove whitespace
  5296. while (1) {
  5297. next = get();
  5298. if (next == 0) return fields;
  5299. if (!(next in __scanString.whiteSpace)) break;
  5300. }
  5301. unget();
  5302. if (format[formatIndex] === '%') {
  5303. formatIndex++;
  5304. var suppressAssignment = false;
  5305. if (format[formatIndex] == '*') {
  5306. suppressAssignment = true;
  5307. formatIndex++;
  5308. }
  5309. var maxSpecifierStart = formatIndex;
  5310. while (format[formatIndex].charCodeAt(0) >= 48 &&
  5311. format[formatIndex].charCodeAt(0) <= 57) {
  5312. formatIndex++;
  5313. }
  5314. var max_;
  5315. if (formatIndex != maxSpecifierStart) {
  5316. max_ = parseInt(format.slice(maxSpecifierStart, formatIndex), 10);
  5317. }
  5318. var long_ = false;
  5319. var half = false;
  5320. var longLong = false;
  5321. if (format[formatIndex] == 'l') {
  5322. long_ = true;
  5323. formatIndex++;
  5324. if (format[formatIndex] == 'l') {
  5325. longLong = true;
  5326. formatIndex++;
  5327. }
  5328. } else if (format[formatIndex] == 'h') {
  5329. half = true;
  5330. formatIndex++;
  5331. }
  5332. var type = format[formatIndex];
  5333. formatIndex++;
  5334. var curr = 0;
  5335. var buffer = [];
  5336. // Read characters according to the format. floats are trickier, they may be in an unfloat state in the middle, then be a valid float later
  5337. if (type == 'f' || type == 'e' || type == 'g' ||
  5338. type == 'F' || type == 'E' || type == 'G') {
  5339. next = get();
  5340. while (next > 0 && (!(next in __scanString.whiteSpace))) {
  5341. buffer.push(String.fromCharCode(next));
  5342. next = get();
  5343. }
  5344. var m = __getFloat(buffer.join(''));
  5345. var last = m ? m[0].length : 0;
  5346. for (var i = 0; i < buffer.length - last + 1; i++) {
  5347. unget();
  5348. }
  5349. buffer.length = last;
  5350. } else {
  5351. next = get();
  5352. var first = true;
  5353. // Strip the optional 0x prefix for %x.
  5354. if ((type == 'x' || type == 'X') && (next == 48)) {
  5355. var peek = get();
  5356. if (peek == 120 || peek == 88) {
  5357. next = get();
  5358. } else {
  5359. unget();
  5360. }
  5361. }
  5362. while ((curr < max_ || isNaN(max_)) && next > 0) {
  5363. if (!(next in __scanString.whiteSpace) && // stop on whitespace
  5364. (type == 's' ||
  5365. ((type === 'd' || type == 'u' || type == 'i') && ((next >= 48 && next <= 57) ||
  5366. (first && next == 45))) ||
  5367. ((type === 'x' || type === 'X') && (next >= 48 && next <= 57 ||
  5368. next >= 97 && next <= 102 ||
  5369. next >= 65 && next <= 70))) &&
  5370. (formatIndex >= format.length || next !== format[formatIndex].charCodeAt(0))) { // Stop when we read something that is coming up
  5371. buffer.push(String.fromCharCode(next));
  5372. next = get();
  5373. curr++;
  5374. first = false;
  5375. } else {
  5376. break;
  5377. }
  5378. }
  5379. unget();
  5380. }
  5381. if (buffer.length === 0) return 0; // Failure.
  5382. if (suppressAssignment) continue;
  5383. var text = buffer.join('');
  5384. var argPtr = HEAP32[(((varargs)+(argIndex))>>2)];
  5385. argIndex += Runtime.getAlignSize('void*', null, true);
  5386. switch (type) {
  5387. case 'd': case 'u': case 'i':
  5388. if (half) {
  5389. HEAP16[((argPtr)>>1)]=parseInt(text, 10);
  5390. } else if (longLong) {
  5391. (tempI64 = [parseInt(text, 10)>>>0,(tempDouble=parseInt(text, 10),(+(Math_abs(tempDouble))) >= (+1) ? (tempDouble > (+0) ? ((Math_min((+(Math_floor((tempDouble)/(+4294967296)))), (+4294967295)))|0)>>>0 : (~~((+(Math_ceil((tempDouble - +(((~~(tempDouble)))>>>0))/(+4294967296))))))>>>0) : 0)],HEAP32[((argPtr)>>2)]=tempI64[0],HEAP32[(((argPtr)+(4))>>2)]=tempI64[1]);
  5392. } else {
  5393. HEAP32[((argPtr)>>2)]=parseInt(text, 10);
  5394. }
  5395. break;
  5396. case 'X':
  5397. case 'x':
  5398. HEAP32[((argPtr)>>2)]=parseInt(text, 16);
  5399. break;
  5400. case 'F':
  5401. case 'f':
  5402. case 'E':
  5403. case 'e':
  5404. case 'G':
  5405. case 'g':
  5406. case 'E':
  5407. // fallthrough intended
  5408. if (long_) {
  5409. HEAPF64[((argPtr)>>3)]=parseFloat(text);
  5410. } else {
  5411. HEAPF32[((argPtr)>>2)]=parseFloat(text);
  5412. }
  5413. break;
  5414. case 's':
  5415. var array = intArrayFromString(text);
  5416. for (var j = 0; j < array.length; j++) {
  5417. HEAP8[(((argPtr)+(j))|0)]=array[j];
  5418. }
  5419. break;
  5420. }
  5421. fields++;
  5422. } else if (format[formatIndex].charCodeAt(0) in __scanString.whiteSpace) {
  5423. next = get();
  5424. while (next in __scanString.whiteSpace) {
  5425. if (next <= 0) break mainLoop; // End of input.
  5426. next = get();
  5427. }
  5428. unget(next);
  5429. formatIndex++;
  5430. } else {
  5431. // Not a specifier.
  5432. next = get();
  5433. if (format[formatIndex].charCodeAt(0) !== next) {
  5434. unget(next);
  5435. break mainLoop;
  5436. }
  5437. formatIndex++;
  5438. }
  5439. }
  5440. return fields;
  5441. }function _sscanf(s, format, varargs) {
  5442. // int sscanf(const char *restrict s, const char *restrict format, ... );
  5443. // http://pubs.opengroup.org/onlinepubs/000095399/functions/scanf.html
  5444. var index = 0;
  5445. function get() { return HEAP8[(((s)+(index++))|0)]; };
  5446. function unget() { index--; };
  5447. return __scanString(format, get, unget, varargs);
  5448. }
  5449. function _catopen(name, oflag) {
  5450. // nl_catd catopen (const char *name, int oflag)
  5451. return -1;
  5452. }
  5453. function _catgets(catd, set_id, msg_id, s) {
  5454. // char *catgets (nl_catd catd, int set_id, int msg_id, const char *s)
  5455. return s;
  5456. }
  5457. function _catclose(catd) {
  5458. // int catclose (nl_catd catd)
  5459. return 0;
  5460. }
  5461. function _newlocale(mask, locale, base) {
  5462. return _malloc(4);
  5463. }
  5464. function _freelocale(locale) {
  5465. _free(locale);
  5466. }
  5467. function ___ctype_b_loc() {
  5468. // http://refspecs.freestandards.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/baselib---ctype-b-loc.html
  5469. var me = ___ctype_b_loc;
  5470. if (!me.ret) {
  5471. var values = [
  5472. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  5473. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  5474. 0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,8195,8194,8194,8194,8194,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,24577,49156,49156,49156,
  5475. 49156,49156,49156,49156,49156,49156,49156,49156,49156,49156,49156,49156,55304,55304,55304,55304,55304,55304,55304,55304,
  5476. 55304,55304,49156,49156,49156,49156,49156,49156,49156,54536,54536,54536,54536,54536,54536,50440,50440,50440,50440,50440,
  5477. 50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,50440,49156,49156,49156,49156,49156,
  5478. 49156,54792,54792,54792,54792,54792,54792,50696,50696,50696,50696,50696,50696,50696,50696,50696,50696,50696,50696,50696,
  5479. 50696,50696,50696,50696,50696,50696,50696,49156,49156,49156,49156,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  5480. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  5481. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  5482. ];
  5483. var i16size = 2;
  5484. var arr = _malloc(values.length * i16size);
  5485. for (var i = 0; i < values.length; i++) {
  5486. HEAP16[(((arr)+(i * i16size))>>1)]=values[i];
  5487. }
  5488. me.ret = allocate([arr + 128 * i16size], 'i16*', ALLOC_NORMAL);
  5489. }
  5490. return me.ret;
  5491. }
  5492. function ___ctype_tolower_loc() {
  5493. // http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/libutil---ctype-tolower-loc.html
  5494. var me = ___ctype_tolower_loc;
  5495. if (!me.ret) {
  5496. var values = [
  5497. 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,
  5498. 158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,
  5499. 188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,
  5500. 218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,
  5501. 248,249,250,251,252,253,254,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,
  5502. 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,97,98,99,100,101,102,103,
  5503. 104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,91,92,93,94,95,96,97,98,99,100,101,102,103,
  5504. 104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,
  5505. 134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,
  5506. 164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
  5507. 194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
  5508. 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,
  5509. 254,255
  5510. ];
  5511. var i32size = 4;
  5512. var arr = _malloc(values.length * i32size);
  5513. for (var i = 0; i < values.length; i++) {
  5514. HEAP32[(((arr)+(i * i32size))>>2)]=values[i];
  5515. }
  5516. me.ret = allocate([arr + 128 * i32size], 'i32*', ALLOC_NORMAL);
  5517. }
  5518. return me.ret;
  5519. }
  5520. function ___ctype_toupper_loc() {
  5521. // http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/libutil---ctype-toupper-loc.html
  5522. var me = ___ctype_toupper_loc;
  5523. if (!me.ret) {
  5524. var values = [
  5525. 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,
  5526. 158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,
  5527. 188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,
  5528. 218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,
  5529. 248,249,250,251,252,253,254,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,
  5530. 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,
  5531. 73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,
  5532. 81,82,83,84,85,86,87,88,89,90,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,
  5533. 145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,
  5534. 175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,
  5535. 205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,
  5536. 235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
  5537. ];
  5538. var i32size = 4;
  5539. var arr = _malloc(values.length * i32size);
  5540. for (var i = 0; i < values.length; i++) {
  5541. HEAP32[(((arr)+(i * i32size))>>2)]=values[i];
  5542. }
  5543. me.ret = allocate([arr + 128 * i32size], 'i32*', ALLOC_NORMAL);
  5544. }
  5545. return me.ret;
  5546. }
  5547. function __isLeapYear(year) {
  5548. return year%4 === 0 && (year%100 !== 0 || year%400 === 0);
  5549. }
  5550. function __arraySum(array, index) {
  5551. var sum = 0;
  5552. for (var i = 0; i <= index; sum += array[i++]);
  5553. return sum;
  5554. }
  5555. var __MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31];
  5556. var __MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];function __addDays(date, days) {
  5557. var newDate = new Date(date.getTime());
  5558. while(days > 0) {
  5559. var leap = __isLeapYear(newDate.getFullYear());
  5560. var currentMonth = newDate.getMonth();
  5561. var daysInCurrentMonth = (leap ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR)[currentMonth];
  5562. if (days > daysInCurrentMonth-newDate.getDate()) {
  5563. // we spill over to next month
  5564. days -= (daysInCurrentMonth-newDate.getDate()+1);
  5565. newDate.setDate(1);
  5566. if (currentMonth < 11) {
  5567. newDate.setMonth(currentMonth+1)
  5568. } else {
  5569. newDate.setMonth(0);
  5570. newDate.setFullYear(newDate.getFullYear()+1);
  5571. }
  5572. } else {
  5573. // we stay in current month
  5574. newDate.setDate(newDate.getDate()+days);
  5575. return newDate;
  5576. }
  5577. }
  5578. return newDate;
  5579. }function _strftime(s, maxsize, format, tm) {
  5580. // size_t strftime(char *restrict s, size_t maxsize, const char *restrict format, const struct tm *restrict timeptr);
  5581. // http://pubs.opengroup.org/onlinepubs/009695399/functions/strftime.html
  5582. var date = {
  5583. tm_sec: HEAP32[((tm)>>2)],
  5584. tm_min: HEAP32[(((tm)+(4))>>2)],
  5585. tm_hour: HEAP32[(((tm)+(8))>>2)],
  5586. tm_mday: HEAP32[(((tm)+(12))>>2)],
  5587. tm_mon: HEAP32[(((tm)+(16))>>2)],
  5588. tm_year: HEAP32[(((tm)+(20))>>2)],
  5589. tm_wday: HEAP32[(((tm)+(24))>>2)],
  5590. tm_yday: HEAP32[(((tm)+(28))>>2)],
  5591. tm_isdst: HEAP32[(((tm)+(32))>>2)]
  5592. };
  5593. var pattern = Pointer_stringify(format);
  5594. // expand format
  5595. var EXPANSION_RULES_1 = {
  5596. '%c': '%a %b %d %H:%M:%S %Y', // Replaced by the locale's appropriate date and time representation - e.g., Mon Aug 3 14:02:01 2013
  5597. '%D': '%m/%d/%y', // Equivalent to %m / %d / %y
  5598. '%F': '%Y-%m-%d', // Equivalent to %Y - %m - %d
  5599. '%h': '%b', // Equivalent to %b
  5600. '%r': '%I:%M:%S %p', // Replaced by the time in a.m. and p.m. notation
  5601. '%R': '%H:%M', // Replaced by the time in 24-hour notation
  5602. '%T': '%H:%M:%S', // Replaced by the time
  5603. '%x': '%m/%d/%y', // Replaced by the locale's appropriate date representation
  5604. '%X': '%H:%M:%S', // Replaced by the locale's appropriate date representation
  5605. };
  5606. for (var rule in EXPANSION_RULES_1) {
  5607. pattern = pattern.replace(new RegExp(rule, 'g'), EXPANSION_RULES_1[rule]);
  5608. }
  5609. var WEEKDAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
  5610. var MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
  5611. function leadingSomething(value, digits, character) {
  5612. var str = typeof value === 'number' ? value.toString() : (value || '');
  5613. while (str.length < digits) {
  5614. str = character[0]+str;
  5615. }
  5616. return str;
  5617. };
  5618. function leadingNulls(value, digits) {
  5619. return leadingSomething(value, digits, '0');
  5620. };
  5621. function compareByDay(date1, date2) {
  5622. function sgn(value) {
  5623. return value < 0 ? -1 : (value > 0 ? 1 : 0);
  5624. };
  5625. var compare;
  5626. if ((compare = sgn(date1.getFullYear()-date2.getFullYear())) === 0) {
  5627. if ((compare = sgn(date1.getMonth()-date2.getMonth())) === 0) {
  5628. compare = sgn(date1.getDate()-date2.getDate());
  5629. }
  5630. }
  5631. return compare;
  5632. };
  5633. function getFirstWeekStartDate(janFourth) {
  5634. switch (janFourth.getDay()) {
  5635. case 0: // Sunday
  5636. return new Date(janFourth.getFullYear()-1, 11, 29);
  5637. case 1: // Monday
  5638. return janFourth;
  5639. case 2: // Tuesday
  5640. return new Date(janFourth.getFullYear(), 0, 3);
  5641. case 3: // Wednesday
  5642. return new Date(janFourth.getFullYear(), 0, 2);
  5643. case 4: // Thursday
  5644. return new Date(janFourth.getFullYear(), 0, 1);
  5645. case 5: // Friday
  5646. return new Date(janFourth.getFullYear()-1, 11, 31);
  5647. case 6: // Saturday
  5648. return new Date(janFourth.getFullYear()-1, 11, 30);
  5649. }
  5650. };
  5651. function getWeekBasedYear(date) {
  5652. var thisDate = __addDays(new Date(date.tm_year+1900, 0, 1), date.tm_yday);
  5653. var janFourthThisYear = new Date(thisDate.getFullYear(), 0, 4);
  5654. var janFourthNextYear = new Date(thisDate.getFullYear()+1, 0, 4);
  5655. var firstWeekStartThisYear = getFirstWeekStartDate(janFourthThisYear);
  5656. var firstWeekStartNextYear = getFirstWeekStartDate(janFourthNextYear);
  5657. if (compareByDay(firstWeekStartThisYear, thisDate) <= 0) {
  5658. // this date is after the start of the first week of this year
  5659. if (compareByDay(firstWeekStartNextYear, thisDate) <= 0) {
  5660. return thisDate.getFullYear()+1;
  5661. } else {
  5662. return thisDate.getFullYear();
  5663. }
  5664. } else {
  5665. return thisDate.getFullYear()-1;
  5666. }
  5667. };
  5668. var EXPANSION_RULES_2 = {
  5669. '%a': function(date) {
  5670. return WEEKDAYS[date.tm_wday].substring(0,3);
  5671. },
  5672. '%A': function(date) {
  5673. return WEEKDAYS[date.tm_wday];
  5674. },
  5675. '%b': function(date) {
  5676. return MONTHS[date.tm_mon].substring(0,3);
  5677. },
  5678. '%B': function(date) {
  5679. return MONTHS[date.tm_mon];
  5680. },
  5681. '%C': function(date) {
  5682. var year = date.tm_year+1900;
  5683. return leadingNulls(Math.floor(year/100),2);
  5684. },
  5685. '%d': function(date) {
  5686. return leadingNulls(date.tm_mday, 2);
  5687. },
  5688. '%e': function(date) {
  5689. return leadingSomething(date.tm_mday, 2, ' ');
  5690. },
  5691. '%g': function(date) {
  5692. // %g, %G, and %V give values according to the ISO 8601:2000 standard week-based year.
  5693. // In this system, weeks begin on a Monday and week 1 of the year is the week that includes
  5694. // January 4th, which is also the week that includes the first Thursday of the year, and
  5695. // is also the first week that contains at least four days in the year.
  5696. // If the first Monday of January is the 2nd, 3rd, or 4th, the preceding days are part of
  5697. // the last week of the preceding year; thus, for Saturday 2nd January 1999,
  5698. // %G is replaced by 1998 and %V is replaced by 53. If December 29th, 30th,
  5699. // or 31st is a Monday, it and any following days are part of week 1 of the following year.
  5700. // Thus, for Tuesday 30th December 1997, %G is replaced by 1998 and %V is replaced by 01.
  5701. return getWeekBasedYear(date).toString().substring(2);
  5702. },
  5703. '%G': function(date) {
  5704. return getWeekBasedYear(date);
  5705. },
  5706. '%H': function(date) {
  5707. return leadingNulls(date.tm_hour, 2);
  5708. },
  5709. '%I': function(date) {
  5710. return leadingNulls(date.tm_hour < 13 ? date.tm_hour : date.tm_hour-12, 2);
  5711. },
  5712. '%j': function(date) {
  5713. // Day of the year (001-366)
  5714. return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, date.tm_mon-1), 3);
  5715. },
  5716. '%m': function(date) {
  5717. return leadingNulls(date.tm_mon+1, 2);
  5718. },
  5719. '%M': function(date) {
  5720. return leadingNulls(date.tm_min, 2);
  5721. },
  5722. '%n': function() {
  5723. return '\n';
  5724. },
  5725. '%p': function(date) {
  5726. if (date.tm_hour > 0 && date.tm_hour < 13) {
  5727. return 'AM';
  5728. } else {
  5729. return 'PM';
  5730. }
  5731. },
  5732. '%S': function(date) {
  5733. return leadingNulls(date.tm_sec, 2);
  5734. },
  5735. '%t': function() {
  5736. return '\t';
  5737. },
  5738. '%u': function(date) {
  5739. var day = new Date(date.tm_year+1900, date.tm_mon+1, date.tm_mday, 0, 0, 0, 0);
  5740. return day.getDay() || 7;
  5741. },
  5742. '%U': function(date) {
  5743. // Replaced by the week number of the year as a decimal number [00,53].
  5744. // The first Sunday of January is the first day of week 1;
  5745. // days in the new year before this are in week 0. [ tm_year, tm_wday, tm_yday]
  5746. var janFirst = new Date(date.tm_year+1900, 0, 1);
  5747. var firstSunday = janFirst.getDay() === 0 ? janFirst : __addDays(janFirst, 7-janFirst.getDay());
  5748. var endDate = new Date(date.tm_year+1900, date.tm_mon, date.tm_mday);
  5749. // is target date after the first Sunday?
  5750. if (compareByDay(firstSunday, endDate) < 0) {
  5751. // calculate difference in days between first Sunday and endDate
  5752. var februaryFirstUntilEndMonth = __arraySum(__isLeapYear(endDate.getFullYear()) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, endDate.getMonth()-1)-31;
  5753. var firstSundayUntilEndJanuary = 31-firstSunday.getDate();
  5754. var days = firstSundayUntilEndJanuary+februaryFirstUntilEndMonth+endDate.getDate();
  5755. return leadingNulls(Math.ceil(days/7), 2);
  5756. }
  5757. return compareByDay(firstSunday, janFirst) === 0 ? '01': '00';
  5758. },
  5759. '%V': function(date) {
  5760. // Replaced by the week number of the year (Monday as the first day of the week)
  5761. // as a decimal number [01,53]. If the week containing 1 January has four
  5762. // or more days in the new year, then it is considered week 1.
  5763. // Otherwise, it is the last week of the previous year, and the next week is week 1.
  5764. // Both January 4th and the first Thursday of January are always in week 1. [ tm_year, tm_wday, tm_yday]
  5765. var janFourthThisYear = new Date(date.tm_year+1900, 0, 4);
  5766. var janFourthNextYear = new Date(date.tm_year+1901, 0, 4);
  5767. var firstWeekStartThisYear = getFirstWeekStartDate(janFourthThisYear);
  5768. var firstWeekStartNextYear = getFirstWeekStartDate(janFourthNextYear);
  5769. var endDate = __addDays(new Date(date.tm_year+1900, 0, 1), date.tm_yday);
  5770. if (compareByDay(endDate, firstWeekStartThisYear) < 0) {
  5771. // if given date is before this years first week, then it belongs to the 53rd week of last year
  5772. return '53';
  5773. }
  5774. if (compareByDay(firstWeekStartNextYear, endDate) <= 0) {
  5775. // if given date is after next years first week, then it belongs to the 01th week of next year
  5776. return '01';
  5777. }
  5778. // given date is in between CW 01..53 of this calendar year
  5779. var daysDifference;
  5780. if (firstWeekStartThisYear.getFullYear() < date.tm_year+1900) {
  5781. // first CW of this year starts last year
  5782. daysDifference = date.tm_yday+32-firstWeekStartThisYear.getDate()
  5783. } else {
  5784. // first CW of this year starts this year
  5785. daysDifference = date.tm_yday+1-firstWeekStartThisYear.getDate();
  5786. }
  5787. return leadingNulls(Math.ceil(daysDifference/7), 2);
  5788. },
  5789. '%w': function(date) {
  5790. var day = new Date(date.tm_year+1900, date.tm_mon+1, date.tm_mday, 0, 0, 0, 0);
  5791. return day.getDay();
  5792. },
  5793. '%W': function(date) {
  5794. // Replaced by the week number of the year as a decimal number [00,53].
  5795. // The first Monday of January is the first day of week 1;
  5796. // days in the new year before this are in week 0. [ tm_year, tm_wday, tm_yday]
  5797. var janFirst = new Date(date.tm_year, 0, 1);
  5798. var firstMonday = janFirst.getDay() === 1 ? janFirst : __addDays(janFirst, janFirst.getDay() === 0 ? 1 : 7-janFirst.getDay()+1);
  5799. var endDate = new Date(date.tm_year+1900, date.tm_mon, date.tm_mday);
  5800. // is target date after the first Monday?
  5801. if (compareByDay(firstMonday, endDate) < 0) {
  5802. var februaryFirstUntilEndMonth = __arraySum(__isLeapYear(endDate.getFullYear()) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, endDate.getMonth()-1)-31;
  5803. var firstMondayUntilEndJanuary = 31-firstMonday.getDate();
  5804. var days = firstMondayUntilEndJanuary+februaryFirstUntilEndMonth+endDate.getDate();
  5805. return leadingNulls(Math.ceil(days/7), 2);
  5806. }
  5807. return compareByDay(firstMonday, janFirst) === 0 ? '01': '00';
  5808. },
  5809. '%y': function(date) {
  5810. // Replaced by the last two digits of the year as a decimal number [00,99]. [ tm_year]
  5811. return (date.tm_year+1900).toString().substring(2);
  5812. },
  5813. '%Y': function(date) {
  5814. // Replaced by the year as a decimal number (for example, 1997). [ tm_year]
  5815. return date.tm_year+1900;
  5816. },
  5817. '%z': function(date) {
  5818. // Replaced by the offset from UTC in the ISO 8601:2000 standard format ( +hhmm or -hhmm ),
  5819. // or by no characters if no timezone is determinable.
  5820. // For example, "-0430" means 4 hours 30 minutes behind UTC (west of Greenwich).
  5821. // If tm_isdst is zero, the standard time offset is used.
  5822. // If tm_isdst is greater than zero, the daylight savings time offset is used.
  5823. // If tm_isdst is negative, no characters are returned.
  5824. // FIXME: we cannot determine time zone (or can we?)
  5825. return '';
  5826. },
  5827. '%Z': function(date) {
  5828. // Replaced by the timezone name or abbreviation, or by no bytes if no timezone information exists. [ tm_isdst]
  5829. // FIXME: we cannot determine time zone (or can we?)
  5830. return '';
  5831. },
  5832. '%%': function() {
  5833. return '%';
  5834. }
  5835. };
  5836. for (var rule in EXPANSION_RULES_2) {
  5837. if (pattern.indexOf(rule) >= 0) {
  5838. pattern = pattern.replace(new RegExp(rule, 'g'), EXPANSION_RULES_2[rule](date));
  5839. }
  5840. }
  5841. var bytes = intArrayFromString(pattern, false);
  5842. if (bytes.length > maxsize) {
  5843. return 0;
  5844. }
  5845. writeArrayToMemory(bytes, s);
  5846. return bytes.length-1;
  5847. }function _strftime_l(s, maxsize, format, tm) {
  5848. return _strftime(s, maxsize, format, tm); // no locale support yet
  5849. }
  5850. function _isspace(chr) {
  5851. return (chr == 32) || (chr >= 9 && chr <= 13);
  5852. }
  5853. function __parseInt64(str, endptr, base, min, max, unsign) {
  5854. var isNegative = false;
  5855. // Skip space.
  5856. while (_isspace(HEAP8[(str)])) str++;
  5857. // Check for a plus/minus sign.
  5858. if (HEAP8[(str)] == 45) {
  5859. str++;
  5860. isNegative = true;
  5861. } else if (HEAP8[(str)] == 43) {
  5862. str++;
  5863. }
  5864. // Find base.
  5865. var ok = false;
  5866. var finalBase = base;
  5867. if (!finalBase) {
  5868. if (HEAP8[(str)] == 48) {
  5869. if (HEAP8[((str+1)|0)] == 120 ||
  5870. HEAP8[((str+1)|0)] == 88) {
  5871. finalBase = 16;
  5872. str += 2;
  5873. } else {
  5874. finalBase = 8;
  5875. ok = true; // we saw an initial zero, perhaps the entire thing is just "0"
  5876. }
  5877. }
  5878. } else if (finalBase==16) {
  5879. if (HEAP8[(str)] == 48) {
  5880. if (HEAP8[((str+1)|0)] == 120 ||
  5881. HEAP8[((str+1)|0)] == 88) {
  5882. str += 2;
  5883. }
  5884. }
  5885. }
  5886. if (!finalBase) finalBase = 10;
  5887. var start = str;
  5888. // Get digits.
  5889. var chr;
  5890. while ((chr = HEAP8[(str)]) != 0) {
  5891. var digit = parseInt(String.fromCharCode(chr), finalBase);
  5892. if (isNaN(digit)) {
  5893. break;
  5894. } else {
  5895. str++;
  5896. ok = true;
  5897. }
  5898. }
  5899. if (!ok) {
  5900. ___setErrNo(ERRNO_CODES.EINVAL);
  5901. return ((asm["setTempRet0"](0),0)|0);
  5902. }
  5903. // Set end pointer.
  5904. if (endptr) {
  5905. HEAP32[((endptr)>>2)]=str;
  5906. }
  5907. try {
  5908. var numberString = isNegative ? '-'+Pointer_stringify(start, str - start) : Pointer_stringify(start, str - start);
  5909. i64Math.fromString(numberString, finalBase, min, max, unsign);
  5910. } catch(e) {
  5911. ___setErrNo(ERRNO_CODES.ERANGE); // not quite correct
  5912. }
  5913. return ((asm["setTempRet0"](((HEAP32[(((tempDoublePtr)+(4))>>2)])|0)),((HEAP32[((tempDoublePtr)>>2)])|0))|0);
  5914. }function _strtoull(str, endptr, base) {
  5915. return __parseInt64(str, endptr, base, 0, '18446744073709551615', true); // ULONG_MAX.
  5916. }function _strtoull_l(str, endptr, base) {
  5917. return _strtoull(str, endptr, base); // no locale support yet
  5918. }
  5919. function _strtoll(str, endptr, base) {
  5920. return __parseInt64(str, endptr, base, '-9223372036854775808', '9223372036854775807'); // LLONG_MIN, LLONG_MAX.
  5921. }function _strtoll_l(str, endptr, base) {
  5922. return _strtoll(str, endptr, base); // no locale support yet
  5923. }
  5924. function _uselocale(locale) {
  5925. return 0;
  5926. }
  5927. var _llvm_va_start=undefined;
  5928. function _asprintf(s, format, varargs) {
  5929. return _sprintf(-s, format, varargs);
  5930. }function _vasprintf(s, format, va_arg) {
  5931. return _asprintf(s, format, HEAP32[((va_arg)>>2)]);
  5932. }
  5933. function _llvm_va_end() {}
  5934. function _vsnprintf(s, n, format, va_arg) {
  5935. return _snprintf(s, n, format, HEAP32[((va_arg)>>2)]);
  5936. }
  5937. function _vsscanf(s, format, va_arg) {
  5938. return _sscanf(s, format, HEAP32[((va_arg)>>2)]);
  5939. }
  5940. function _sbrk(bytes) {
  5941. // Implement a Linux-like 'memory area' for our 'process'.
  5942. // Changes the size of the memory area by |bytes|; returns the
  5943. // address of the previous top ('break') of the memory area
  5944. // We control the "dynamic" memory - DYNAMIC_BASE to DYNAMICTOP
  5945. var self = _sbrk;
  5946. if (!self.called) {
  5947. DYNAMICTOP = alignMemoryPage(DYNAMICTOP); // make sure we start out aligned
  5948. self.called = true;
  5949. assert(Runtime.dynamicAlloc);
  5950. self.alloc = Runtime.dynamicAlloc;
  5951. Runtime.dynamicAlloc = function() { abort('cannot dynamically allocate, sbrk now has control') };
  5952. }
  5953. var ret = DYNAMICTOP;
  5954. if (bytes != 0) self.alloc(bytes);
  5955. return ret; // Previous break location.
  5956. }
  5957. function _time(ptr) {
  5958. var ret = Math.floor(Date.now()/1000);
  5959. if (ptr) {
  5960. HEAP32[((ptr)>>2)]=ret;
  5961. }
  5962. return ret;
  5963. }
  5964. function _copysign(a, b) {
  5965. return __reallyNegative(a) === __reallyNegative(b) ? a : -a;
  5966. }var _copysignl=_copysign;
  5967. function _fmod(x, y) {
  5968. return x % y;
  5969. }var _fmodl=_fmod;
  5970. var Browser={mainLoop:{scheduler:null,method:"",shouldPause:false,paused:false,queue:[],pause:function () {
  5971. Browser.mainLoop.shouldPause = true;
  5972. },resume:function () {
  5973. if (Browser.mainLoop.paused) {
  5974. Browser.mainLoop.paused = false;
  5975. Browser.mainLoop.scheduler();
  5976. }
  5977. Browser.mainLoop.shouldPause = false;
  5978. },updateStatus:function () {
  5979. if (Module['setStatus']) {
  5980. var message = Module['statusMessage'] || 'Please wait...';
  5981. var remaining = Browser.mainLoop.remainingBlockers;
  5982. var expected = Browser.mainLoop.expectedBlockers;
  5983. if (remaining) {
  5984. if (remaining < expected) {
  5985. Module['setStatus'](message + ' (' + (expected - remaining) + '/' + expected + ')');
  5986. } else {
  5987. Module['setStatus'](message);
  5988. }
  5989. } else {
  5990. Module['setStatus']('');
  5991. }
  5992. }
  5993. }},isFullScreen:false,pointerLock:false,moduleContextCreatedCallbacks:[],workers:[],init:function () {
  5994. if (!Module["preloadPlugins"]) Module["preloadPlugins"] = []; // needs to exist even in workers
  5995. if (Browser.initted || ENVIRONMENT_IS_WORKER) return;
  5996. Browser.initted = true;
  5997. try {
  5998. new Blob();
  5999. Browser.hasBlobConstructor = true;
  6000. } catch(e) {
  6001. Browser.hasBlobConstructor = false;
  6002. console.log("warning: no blob constructor, cannot create blobs with mimetypes");
  6003. }
  6004. Browser.BlobBuilder = typeof MozBlobBuilder != "undefined" ? MozBlobBuilder : (typeof WebKitBlobBuilder != "undefined" ? WebKitBlobBuilder : (!Browser.hasBlobConstructor ? console.log("warning: no BlobBuilder") : null));
  6005. Browser.URLObject = typeof window != "undefined" ? (window.URL ? window.URL : window.webkitURL) : undefined;
  6006. if (!Module.noImageDecoding && typeof Browser.URLObject === 'undefined') {
  6007. console.log("warning: Browser does not support creating object URLs. Built-in browser image decoding will not be available.");
  6008. Module.noImageDecoding = true;
  6009. }
  6010. // Support for plugins that can process preloaded files. You can add more of these to
  6011. // your app by creating and appending to Module.preloadPlugins.
  6012. //
  6013. // Each plugin is asked if it can handle a file based on the file's name. If it can,
  6014. // it is given the file's raw data. When it is done, it calls a callback with the file's
  6015. // (possibly modified) data. For example, a plugin might decompress a file, or it
  6016. // might create some side data structure for use later (like an Image element, etc.).
  6017. var imagePlugin = {};
  6018. imagePlugin['canHandle'] = function imagePlugin_canHandle(name) {
  6019. return !Module.noImageDecoding && /\.(jpg|jpeg|png|bmp)$/i.test(name);
  6020. };
  6021. imagePlugin['handle'] = function imagePlugin_handle(byteArray, name, onload, onerror) {
  6022. var b = null;
  6023. if (Browser.hasBlobConstructor) {
  6024. try {
  6025. b = new Blob([byteArray], { type: Browser.getMimetype(name) });
  6026. if (b.size !== byteArray.length) { // Safari bug #118630
  6027. // Safari's Blob can only take an ArrayBuffer
  6028. b = new Blob([(new Uint8Array(byteArray)).buffer], { type: Browser.getMimetype(name) });
  6029. }
  6030. } catch(e) {
  6031. Runtime.warnOnce('Blob constructor present but fails: ' + e + '; falling back to blob builder');
  6032. }
  6033. }
  6034. if (!b) {
  6035. var bb = new Browser.BlobBuilder();
  6036. bb.append((new Uint8Array(byteArray)).buffer); // we need to pass a buffer, and must copy the array to get the right data range
  6037. b = bb.getBlob();
  6038. }
  6039. var url = Browser.URLObject.createObjectURL(b);
  6040. var img = new Image();
  6041. img.onload = function img_onload() {
  6042. assert(img.complete, 'Image ' + name + ' could not be decoded');
  6043. var canvas = document.createElement('canvas');
  6044. canvas.width = img.width;
  6045. canvas.height = img.height;
  6046. var ctx = canvas.getContext('2d');
  6047. ctx.drawImage(img, 0, 0);
  6048. Module["preloadedImages"][name] = canvas;
  6049. Browser.URLObject.revokeObjectURL(url);
  6050. if (onload) onload(byteArray);
  6051. };
  6052. img.onerror = function img_onerror(event) {
  6053. console.log('Image ' + url + ' could not be decoded');
  6054. if (onerror) onerror();
  6055. };
  6056. img.src = url;
  6057. };
  6058. Module['preloadPlugins'].push(imagePlugin);
  6059. var audioPlugin = {};
  6060. audioPlugin['canHandle'] = function audioPlugin_canHandle(name) {
  6061. return !Module.noAudioDecoding && name.substr(-4) in { '.ogg': 1, '.wav': 1, '.mp3': 1 };
  6062. };
  6063. audioPlugin['handle'] = function audioPlugin_handle(byteArray, name, onload, onerror) {
  6064. var done = false;
  6065. function finish(audio) {
  6066. if (done) return;
  6067. done = true;
  6068. Module["preloadedAudios"][name] = audio;
  6069. if (onload) onload(byteArray);
  6070. }
  6071. function fail() {
  6072. if (done) return;
  6073. done = true;
  6074. Module["preloadedAudios"][name] = new Audio(); // empty shim
  6075. if (onerror) onerror();
  6076. }
  6077. if (Browser.hasBlobConstructor) {
  6078. try {
  6079. var b = new Blob([byteArray], { type: Browser.getMimetype(name) });
  6080. } catch(e) {
  6081. return fail();
  6082. }
  6083. var url = Browser.URLObject.createObjectURL(b); // XXX we never revoke this!
  6084. var audio = new Audio();
  6085. audio.addEventListener('canplaythrough', function() { finish(audio) }, false); // use addEventListener due to chromium bug 124926
  6086. audio.onerror = function audio_onerror(event) {
  6087. if (done) return;
  6088. console.log('warning: browser could not fully decode audio ' + name + ', trying slower base64 approach');
  6089. function encode64(data) {
  6090. var BASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  6091. var PAD = '=';
  6092. var ret = '';
  6093. var leftchar = 0;
  6094. var leftbits = 0;
  6095. for (var i = 0; i < data.length; i++) {
  6096. leftchar = (leftchar << 8) | data[i];
  6097. leftbits += 8;
  6098. while (leftbits >= 6) {
  6099. var curr = (leftchar >> (leftbits-6)) & 0x3f;
  6100. leftbits -= 6;
  6101. ret += BASE[curr];
  6102. }
  6103. }
  6104. if (leftbits == 2) {
  6105. ret += BASE[(leftchar&3) << 4];
  6106. ret += PAD + PAD;
  6107. } else if (leftbits == 4) {
  6108. ret += BASE[(leftchar&0xf) << 2];
  6109. ret += PAD;
  6110. }
  6111. return ret;
  6112. }
  6113. audio.src = 'data:audio/x-' + name.substr(-3) + ';base64,' + encode64(byteArray);
  6114. finish(audio); // we don't wait for confirmation this worked - but it's worth trying
  6115. };
  6116. audio.src = url;
  6117. // workaround for chrome bug 124926 - we do not always get oncanplaythrough or onerror
  6118. Browser.safeSetTimeout(function() {
  6119. finish(audio); // try to use it even though it is not necessarily ready to play
  6120. }, 10000);
  6121. } else {
  6122. return fail();
  6123. }
  6124. };
  6125. Module['preloadPlugins'].push(audioPlugin);
  6126. // Canvas event setup
  6127. var canvas = Module['canvas'];
  6128. canvas.requestPointerLock = canvas['requestPointerLock'] ||
  6129. canvas['mozRequestPointerLock'] ||
  6130. canvas['webkitRequestPointerLock'];
  6131. canvas.exitPointerLock = document['exitPointerLock'] ||
  6132. document['mozExitPointerLock'] ||
  6133. document['webkitExitPointerLock'] ||
  6134. function(){}; // no-op if function does not exist
  6135. canvas.exitPointerLock = canvas.exitPointerLock.bind(document);
  6136. function pointerLockChange() {
  6137. Browser.pointerLock = document['pointerLockElement'] === canvas ||
  6138. document['mozPointerLockElement'] === canvas ||
  6139. document['webkitPointerLockElement'] === canvas;
  6140. }
  6141. document.addEventListener('pointerlockchange', pointerLockChange, false);
  6142. document.addEventListener('mozpointerlockchange', pointerLockChange, false);
  6143. document.addEventListener('webkitpointerlockchange', pointerLockChange, false);
  6144. if (Module['elementPointerLock']) {
  6145. canvas.addEventListener("click", function(ev) {
  6146. if (!Browser.pointerLock && canvas.requestPointerLock) {
  6147. canvas.requestPointerLock();
  6148. ev.preventDefault();
  6149. }
  6150. }, false);
  6151. }
  6152. },createContext:function (canvas, useWebGL, setInModule, webGLContextAttributes) {
  6153. var ctx;
  6154. try {
  6155. if (useWebGL) {
  6156. var contextAttributes = {
  6157. antialias: false,
  6158. alpha: false
  6159. };
  6160. if (webGLContextAttributes) {
  6161. for (var attribute in webGLContextAttributes) {
  6162. contextAttributes[attribute] = webGLContextAttributes[attribute];
  6163. }
  6164. }
  6165. var errorInfo = '?';
  6166. function onContextCreationError(event) {
  6167. errorInfo = event.statusMessage || errorInfo;
  6168. }
  6169. canvas.addEventListener('webglcontextcreationerror', onContextCreationError, false);
  6170. try {
  6171. ['experimental-webgl', 'webgl'].some(function(webglId) {
  6172. return ctx = canvas.getContext(webglId, contextAttributes);
  6173. });
  6174. } finally {
  6175. canvas.removeEventListener('webglcontextcreationerror', onContextCreationError, false);
  6176. }
  6177. } else {
  6178. ctx = canvas.getContext('2d');
  6179. }
  6180. if (!ctx) throw ':(';
  6181. } catch (e) {
  6182. Module.print('Could not create canvas: ' + [errorInfo, e]);
  6183. return null;
  6184. }
  6185. if (useWebGL) {
  6186. // Set the background of the WebGL canvas to black
  6187. canvas.style.backgroundColor = "black";
  6188. // Warn on context loss
  6189. canvas.addEventListener('webglcontextlost', function(event) {
  6190. alert('WebGL context lost. You will need to reload the page.');
  6191. }, false);
  6192. }
  6193. if (setInModule) {
  6194. GLctx = Module.ctx = ctx;
  6195. Module.useWebGL = useWebGL;
  6196. Browser.moduleContextCreatedCallbacks.forEach(function(callback) { callback() });
  6197. Browser.init();
  6198. }
  6199. return ctx;
  6200. },destroyContext:function (canvas, useWebGL, setInModule) {},fullScreenHandlersInstalled:false,lockPointer:undefined,resizeCanvas:undefined,requestFullScreen:function (lockPointer, resizeCanvas) {
  6201. Browser.lockPointer = lockPointer;
  6202. Browser.resizeCanvas = resizeCanvas;
  6203. if (typeof Browser.lockPointer === 'undefined') Browser.lockPointer = true;
  6204. if (typeof Browser.resizeCanvas === 'undefined') Browser.resizeCanvas = false;
  6205. var canvas = Module['canvas'];
  6206. function fullScreenChange() {
  6207. Browser.isFullScreen = false;
  6208. if ((document['webkitFullScreenElement'] || document['webkitFullscreenElement'] ||
  6209. document['mozFullScreenElement'] || document['mozFullscreenElement'] ||
  6210. document['fullScreenElement'] || document['fullscreenElement']) === canvas) {
  6211. canvas.cancelFullScreen = document['cancelFullScreen'] ||
  6212. document['mozCancelFullScreen'] ||
  6213. document['webkitCancelFullScreen'];
  6214. canvas.cancelFullScreen = canvas.cancelFullScreen.bind(document);
  6215. if (Browser.lockPointer) canvas.requestPointerLock();
  6216. Browser.isFullScreen = true;
  6217. if (Browser.resizeCanvas) Browser.setFullScreenCanvasSize();
  6218. } else if (Browser.resizeCanvas){
  6219. Browser.setWindowedCanvasSize();
  6220. }
  6221. if (Module['onFullScreen']) Module['onFullScreen'](Browser.isFullScreen);
  6222. }
  6223. if (!Browser.fullScreenHandlersInstalled) {
  6224. Browser.fullScreenHandlersInstalled = true;
  6225. document.addEventListener('fullscreenchange', fullScreenChange, false);
  6226. document.addEventListener('mozfullscreenchange', fullScreenChange, false);
  6227. document.addEventListener('webkitfullscreenchange', fullScreenChange, false);
  6228. }
  6229. canvas.requestFullScreen = canvas['requestFullScreen'] ||
  6230. canvas['mozRequestFullScreen'] ||
  6231. (canvas['webkitRequestFullScreen'] ? function() { canvas['webkitRequestFullScreen'](Element['ALLOW_KEYBOARD_INPUT']) } : null);
  6232. canvas.requestFullScreen();
  6233. },requestAnimationFrame:function requestAnimationFrame(func) {
  6234. if (typeof window === 'undefined') { // Provide fallback to setTimeout if window is undefined (e.g. in Node.js)
  6235. setTimeout(func, 1000/60);
  6236. } else {
  6237. if (!window.requestAnimationFrame) {
  6238. window.requestAnimationFrame = window['requestAnimationFrame'] ||
  6239. window['mozRequestAnimationFrame'] ||
  6240. window['webkitRequestAnimationFrame'] ||
  6241. window['msRequestAnimationFrame'] ||
  6242. window['oRequestAnimationFrame'] ||
  6243. window['setTimeout'];
  6244. }
  6245. window.requestAnimationFrame(func);
  6246. }
  6247. },safeCallback:function (func) {
  6248. return function() {
  6249. if (!ABORT) return func.apply(null, arguments);
  6250. };
  6251. },safeRequestAnimationFrame:function (func) {
  6252. return Browser.requestAnimationFrame(function() {
  6253. if (!ABORT) func();
  6254. });
  6255. },safeSetTimeout:function (func, timeout) {
  6256. return setTimeout(function() {
  6257. if (!ABORT) func();
  6258. }, timeout);
  6259. },safeSetInterval:function (func, timeout) {
  6260. return setInterval(function() {
  6261. if (!ABORT) func();
  6262. }, timeout);
  6263. },getMimetype:function (name) {
  6264. return {
  6265. 'jpg': 'image/jpeg',
  6266. 'jpeg': 'image/jpeg',
  6267. 'png': 'image/png',
  6268. 'bmp': 'image/bmp',
  6269. 'ogg': 'audio/ogg',
  6270. 'wav': 'audio/wav',
  6271. 'mp3': 'audio/mpeg'
  6272. }[name.substr(name.lastIndexOf('.')+1)];
  6273. },getUserMedia:function (func) {
  6274. if(!window.getUserMedia) {
  6275. window.getUserMedia = navigator['getUserMedia'] ||
  6276. navigator['mozGetUserMedia'];
  6277. }
  6278. window.getUserMedia(func);
  6279. },getMovementX:function (event) {
  6280. return event['movementX'] ||
  6281. event['mozMovementX'] ||
  6282. event['webkitMovementX'] ||
  6283. 0;
  6284. },getMovementY:function (event) {
  6285. return event['movementY'] ||
  6286. event['mozMovementY'] ||
  6287. event['webkitMovementY'] ||
  6288. 0;
  6289. },getMouseWheelDelta:function (event) {
  6290. return Math.max(-1, Math.min(1, event.type === 'DOMMouseScroll' ? event.detail : -event.wheelDelta));
  6291. },mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,calculateMouseEvent:function (event) { // event should be mousemove, mousedown or mouseup
  6292. if (Browser.pointerLock) {
  6293. // When the pointer is locked, calculate the coordinates
  6294. // based on the movement of the mouse.
  6295. // Workaround for Firefox bug 764498
  6296. if (event.type != 'mousemove' &&
  6297. ('mozMovementX' in event)) {
  6298. Browser.mouseMovementX = Browser.mouseMovementY = 0;
  6299. } else {
  6300. Browser.mouseMovementX = Browser.getMovementX(event);
  6301. Browser.mouseMovementY = Browser.getMovementY(event);
  6302. }
  6303. // check if SDL is available
  6304. if (typeof SDL != "undefined") {
  6305. Browser.mouseX = SDL.mouseX + Browser.mouseMovementX;
  6306. Browser.mouseY = SDL.mouseY + Browser.mouseMovementY;
  6307. } else {
  6308. // just add the mouse delta to the current absolut mouse position
  6309. // FIXME: ideally this should be clamped against the canvas size and zero
  6310. Browser.mouseX += Browser.mouseMovementX;
  6311. Browser.mouseY += Browser.mouseMovementY;
  6312. }
  6313. } else {
  6314. // Otherwise, calculate the movement based on the changes
  6315. // in the coordinates.
  6316. var rect = Module["canvas"].getBoundingClientRect();
  6317. var x, y;
  6318. // Neither .scrollX or .pageXOffset are defined in a spec, but
  6319. // we prefer .scrollX because it is currently in a spec draft.
  6320. // (see: http://www.w3.org/TR/2013/WD-cssom-view-20131217/)
  6321. var scrollX = ((typeof window.scrollX !== 'undefined') ? window.scrollX : window.pageXOffset);
  6322. var scrollY = ((typeof window.scrollY !== 'undefined') ? window.scrollY : window.pageYOffset);
  6323. if (event.type == 'touchstart' ||
  6324. event.type == 'touchend' ||
  6325. event.type == 'touchmove') {
  6326. var t = event.touches.item(0);
  6327. if (t) {
  6328. x = t.pageX - (scrollX + rect.left);
  6329. y = t.pageY - (scrollY + rect.top);
  6330. } else {
  6331. return;
  6332. }
  6333. } else {
  6334. x = event.pageX - (scrollX + rect.left);
  6335. y = event.pageY - (scrollY + rect.top);
  6336. }
  6337. // the canvas might be CSS-scaled compared to its backbuffer;
  6338. // SDL-using content will want mouse coordinates in terms
  6339. // of backbuffer units.
  6340. var cw = Module["canvas"].width;
  6341. var ch = Module["canvas"].height;
  6342. x = x * (cw / rect.width);
  6343. y = y * (ch / rect.height);
  6344. Browser.mouseMovementX = x - Browser.mouseX;
  6345. Browser.mouseMovementY = y - Browser.mouseY;
  6346. Browser.mouseX = x;
  6347. Browser.mouseY = y;
  6348. }
  6349. },xhrLoad:function (url, onload, onerror) {
  6350. var xhr = new XMLHttpRequest();
  6351. xhr.open('GET', url, true);
  6352. xhr.responseType = 'arraybuffer';
  6353. xhr.onload = function xhr_onload() {
  6354. if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0
  6355. onload(xhr.response);
  6356. } else {
  6357. onerror();
  6358. }
  6359. };
  6360. xhr.onerror = onerror;
  6361. xhr.send(null);
  6362. },asyncLoad:function (url, onload, onerror, noRunDep) {
  6363. Browser.xhrLoad(url, function(arrayBuffer) {
  6364. assert(arrayBuffer, 'Loading data file "' + url + '" failed (no arrayBuffer).');
  6365. onload(new Uint8Array(arrayBuffer));
  6366. if (!noRunDep) removeRunDependency('al ' + url);
  6367. }, function(event) {
  6368. if (onerror) {
  6369. onerror();
  6370. } else {
  6371. throw 'Loading data file "' + url + '" failed.';
  6372. }
  6373. });
  6374. if (!noRunDep) addRunDependency('al ' + url);
  6375. },resizeListeners:[],updateResizeListeners:function () {
  6376. var canvas = Module['canvas'];
  6377. Browser.resizeListeners.forEach(function(listener) {
  6378. listener(canvas.width, canvas.height);
  6379. });
  6380. },setCanvasSize:function (width, height, noUpdates) {
  6381. var canvas = Module['canvas'];
  6382. canvas.width = width;
  6383. canvas.height = height;
  6384. if (!noUpdates) Browser.updateResizeListeners();
  6385. },windowedWidth:0,windowedHeight:0,setFullScreenCanvasSize:function () {
  6386. var canvas = Module['canvas'];
  6387. this.windowedWidth = canvas.width;
  6388. this.windowedHeight = canvas.height;
  6389. canvas.width = screen.width;
  6390. canvas.height = screen.height;
  6391. // check if SDL is available
  6392. if (typeof SDL != "undefined") {
  6393. var flags = HEAPU32[((SDL.screen+Runtime.QUANTUM_SIZE*0)>>2)];
  6394. flags = flags | 0x00800000; // set SDL_FULLSCREEN flag
  6395. HEAP32[((SDL.screen+Runtime.QUANTUM_SIZE*0)>>2)]=flags
  6396. }
  6397. Browser.updateResizeListeners();
  6398. },setWindowedCanvasSize:function () {
  6399. var canvas = Module['canvas'];
  6400. canvas.width = this.windowedWidth;
  6401. canvas.height = this.windowedHeight;
  6402. // check if SDL is available
  6403. if (typeof SDL != "undefined") {
  6404. var flags = HEAPU32[((SDL.screen+Runtime.QUANTUM_SIZE*0)>>2)];
  6405. flags = flags & ~0x00800000; // clear SDL_FULLSCREEN flag
  6406. HEAP32[((SDL.screen+Runtime.QUANTUM_SIZE*0)>>2)]=flags
  6407. }
  6408. Browser.updateResizeListeners();
  6409. }};
  6410. FS.staticInit();__ATINIT__.unshift({ func: function() { if (!Module["noFSInit"] && !FS.init.initialized) FS.init() } });__ATMAIN__.push({ func: function() { FS.ignorePermissions = false } });__ATEXIT__.push({ func: function() { FS.quit() } });Module["FS_createFolder"] = FS.createFolder;Module["FS_createPath"] = FS.createPath;Module["FS_createDataFile"] = FS.createDataFile;Module["FS_createPreloadedFile"] = FS.createPreloadedFile;Module["FS_createLazyFile"] = FS.createLazyFile;Module["FS_createLink"] = FS.createLink;Module["FS_createDevice"] = FS.createDevice;
  6411. ___errno_state = Runtime.staticAlloc(4); HEAP32[((___errno_state)>>2)]=0;
  6412. __ATINIT__.unshift({ func: function() { TTY.init() } });__ATEXIT__.push({ func: function() { TTY.shutdown() } });TTY.utf8 = new Runtime.UTF8Processor();
  6413. if (ENVIRONMENT_IS_NODE) { var fs = require("fs"); NODEFS.staticInit(); }
  6414. __ATINIT__.push({ func: function() { SOCKFS.root = FS.mount(SOCKFS, {}, null); } });
  6415. _fputc.ret = allocate([0], "i8", ALLOC_STATIC);
  6416. _fgetc.ret = allocate([0], "i8", ALLOC_STATIC);
  6417. Module["requestFullScreen"] = function Module_requestFullScreen(lockPointer, resizeCanvas) { Browser.requestFullScreen(lockPointer, resizeCanvas) };
  6418. Module["requestAnimationFrame"] = function Module_requestAnimationFrame(func) { Browser.requestAnimationFrame(func) };
  6419. Module["setCanvasSize"] = function Module_setCanvasSize(width, height, noUpdates) { Browser.setCanvasSize(width, height, noUpdates) };
  6420. Module["pauseMainLoop"] = function Module_pauseMainLoop() { Browser.mainLoop.pause() };
  6421. Module["resumeMainLoop"] = function Module_resumeMainLoop() { Browser.mainLoop.resume() };
  6422. Module["getUserMedia"] = function Module_getUserMedia() { Browser.getUserMedia() }
  6423. STACK_BASE = STACKTOP = Runtime.alignMemory(STATICTOP);
  6424. staticSealed = true; // seal the static portion of memory
  6425. STACK_MAX = STACK_BASE + 5242880;
  6426. DYNAMIC_BASE = DYNAMICTOP = Runtime.alignMemory(STACK_MAX);
  6427. assert(DYNAMIC_BASE < TOTAL_MEMORY, "TOTAL_MEMORY not big enough for stack");
  6428. var ctlz_i8 = allocate([8,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], "i8", ALLOC_DYNAMIC);
  6429. var cttz_i8 = allocate([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0], "i8", ALLOC_DYNAMIC);
  6430. var Math_min = Math.min;
  6431. function invoke_viiiii(index,a1,a2,a3,a4,a5) {
  6432. try {
  6433. Module["dynCall_viiiii"](index,a1,a2,a3,a4,a5);
  6434. } catch(e) {
  6435. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  6436. asm["setThrew"](1, 0);
  6437. }
  6438. }
  6439. function invoke_viiiiiii(index,a1,a2,a3,a4,a5,a6,a7) {
  6440. try {
  6441. Module["dynCall_viiiiiii"](index,a1,a2,a3,a4,a5,a6,a7);
  6442. } catch(e) {
  6443. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  6444. asm["setThrew"](1, 0);
  6445. }
  6446. }
  6447. function invoke_vi(index,a1) {
  6448. try {
  6449. Module["dynCall_vi"](index,a1);
  6450. } catch(e) {
  6451. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  6452. asm["setThrew"](1, 0);
  6453. }
  6454. }
  6455. function invoke_vii(index,a1,a2) {
  6456. try {
  6457. Module["dynCall_vii"](index,a1,a2);
  6458. } catch(e) {
  6459. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  6460. asm["setThrew"](1, 0);
  6461. }
  6462. }
  6463. function invoke_iii(index,a1,a2) {
  6464. try {
  6465. return Module["dynCall_iii"](index,a1,a2);
  6466. } catch(e) {
  6467. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  6468. asm["setThrew"](1, 0);
  6469. }
  6470. }
  6471. function invoke_iiii(index,a1,a2,a3) {
  6472. try {
  6473. return Module["dynCall_iiii"](index,a1,a2,a3);
  6474. } catch(e) {
  6475. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  6476. asm["setThrew"](1, 0);
  6477. }
  6478. }
  6479. function invoke_viiiiiid(index,a1,a2,a3,a4,a5,a6,a7) {
  6480. try {
  6481. Module["dynCall_viiiiiid"](index,a1,a2,a3,a4,a5,a6,a7);
  6482. } catch(e) {
  6483. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  6484. asm["setThrew"](1, 0);
  6485. }
  6486. }
  6487. function invoke_ii(index,a1) {
  6488. try {
  6489. return Module["dynCall_ii"](index,a1);
  6490. } catch(e) {
  6491. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  6492. asm["setThrew"](1, 0);
  6493. }
  6494. }
  6495. function invoke_viii(index,a1,a2,a3) {
  6496. try {
  6497. Module["dynCall_viii"](index,a1,a2,a3);
  6498. } catch(e) {
  6499. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  6500. asm["setThrew"](1, 0);
  6501. }
  6502. }
  6503. function invoke_viiiiid(index,a1,a2,a3,a4,a5,a6) {
  6504. try {
  6505. Module["dynCall_viiiiid"](index,a1,a2,a3,a4,a5,a6);
  6506. } catch(e) {
  6507. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  6508. asm["setThrew"](1, 0);
  6509. }
  6510. }
  6511. function invoke_v(index) {
  6512. try {
  6513. Module["dynCall_v"](index);
  6514. } catch(e) {
  6515. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  6516. asm["setThrew"](1, 0);
  6517. }
  6518. }
  6519. function invoke_iiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8) {
  6520. try {
  6521. return Module["dynCall_iiiiiiiii"](index,a1,a2,a3,a4,a5,a6,a7,a8);
  6522. } catch(e) {
  6523. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  6524. asm["setThrew"](1, 0);
  6525. }
  6526. }
  6527. function invoke_viiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9) {
  6528. try {
  6529. Module["dynCall_viiiiiiiii"](index,a1,a2,a3,a4,a5,a6,a7,a8,a9);
  6530. } catch(e) {
  6531. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  6532. asm["setThrew"](1, 0);
  6533. }
  6534. }
  6535. function invoke_viiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8) {
  6536. try {
  6537. Module["dynCall_viiiiiiii"](index,a1,a2,a3,a4,a5,a6,a7,a8);
  6538. } catch(e) {
  6539. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  6540. asm["setThrew"](1, 0);
  6541. }
  6542. }
  6543. function invoke_viiiiii(index,a1,a2,a3,a4,a5,a6) {
  6544. try {
  6545. Module["dynCall_viiiiii"](index,a1,a2,a3,a4,a5,a6);
  6546. } catch(e) {
  6547. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  6548. asm["setThrew"](1, 0);
  6549. }
  6550. }
  6551. function invoke_iiiii(index,a1,a2,a3,a4) {
  6552. try {
  6553. return Module["dynCall_iiiii"](index,a1,a2,a3,a4);
  6554. } catch(e) {
  6555. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  6556. asm["setThrew"](1, 0);
  6557. }
  6558. }
  6559. function invoke_iiiiii(index,a1,a2,a3,a4,a5) {
  6560. try {
  6561. return Module["dynCall_iiiiii"](index,a1,a2,a3,a4,a5);
  6562. } catch(e) {
  6563. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  6564. asm["setThrew"](1, 0);
  6565. }
  6566. }
  6567. function invoke_viiii(index,a1,a2,a3,a4) {
  6568. try {
  6569. Module["dynCall_viiii"](index,a1,a2,a3,a4);
  6570. } catch(e) {
  6571. if (typeof e !== 'number' && e !== 'longjmp') throw e;
  6572. asm["setThrew"](1, 0);
  6573. }
  6574. }
  6575. function asmPrintInt(x, y) {
  6576. Module.print('int ' + x + ',' + y);// + ' ' + new Error().stack);
  6577. }
  6578. function asmPrintFloat(x, y) {
  6579. Module.print('float ' + x + ',' + y);// + ' ' + new Error().stack);
  6580. }
  6581. // EMSCRIPTEN_START_ASM
  6582. var asm=(function(global,env,buffer){"use asm";var a=new global.Int8Array(buffer);var b=new global.Int16Array(buffer);var c=new global.Int32Array(buffer);var d=new global.Uint8Array(buffer);var e=new global.Uint16Array(buffer);var f=new global.Uint32Array(buffer);var g=new global.Float32Array(buffer);var h=new global.Float64Array(buffer);var i=env.STACKTOP|0;var j=env.STACK_MAX|0;var k=env.tempDoublePtr|0;var l=env.ABORT|0;var m=env.cttz_i8|0;var n=env.ctlz_i8|0;var o=env._stdin|0;var p=env._stdout|0;var q=env.__ZTVN10__cxxabiv117__class_type_infoE|0;var r=env.__ZTVN10__cxxabiv120__si_class_type_infoE|0;var s=env._stderr|0;var t=env.___dso_handle|0;var u=+env.NaN;var v=+env.Infinity;var w=0;var x=0;var y=0;var z=0;var A=0,B=0,C=0,D=0,E=0.0,F=0,G=0,H=0,I=0.0;var J=0;var K=0;var L=0;var M=0;var N=0;var O=0;var P=0;var Q=0;var R=0;var S=0;var T=global.Math.floor;var U=global.Math.abs;var V=global.Math.sqrt;var W=global.Math.pow;var X=global.Math.cos;var Y=global.Math.sin;var Z=global.Math.tan;var _=global.Math.acos;var $=global.Math.asin;var aa=global.Math.atan;var ba=global.Math.atan2;var ca=global.Math.exp;var da=global.Math.log;var ea=global.Math.ceil;var fa=global.Math.imul;var ga=env.abort;var ha=env.assert;var ia=env.asmPrintInt;var ja=env.asmPrintFloat;var ka=env.min;var la=env.invoke_viiiii;var ma=env.invoke_viiiiiii;var na=env.invoke_vi;var oa=env.invoke_vii;var pa=env.invoke_iii;var qa=env.invoke_iiii;var ra=env.invoke_viiiiiid;var sa=env.invoke_ii;var ta=env.invoke_viii;var ua=env.invoke_viiiiid;var va=env.invoke_v;var wa=env.invoke_iiiiiiiii;var xa=env.invoke_viiiiiiiii;var ya=env.invoke_viiiiiiii;var za=env.invoke_viiiiii;var Aa=env.invoke_iiiii;var Ba=env.invoke_iiiiii;var Ca=env.invoke_viiii;var Da=env._llvm_lifetime_end;var Ea=env._lseek;var Fa=env.__scanString;var Ga=env._fclose;var Ha=env._pthread_mutex_lock;var Ia=env.___cxa_end_catch;var Ja=env._strtoull;var Ka=env._fflush;var La=env._fputc;var Ma=env._fwrite;var Na=env._send;var Oa=env._fputs;var Pa=env._llvm_umul_with_overflow_i32;var Qa=env._isspace;var Ra=env._read;var Sa=env._isxdigit_l;var Ta=env._fileno;var Ua=env._fsync;var Va=env.___cxa_guard_abort;var Wa=env._newlocale;var Xa=env.___gxx_personality_v0;var Ya=env._pthread_cond_wait;var Za=env.___cxa_rethrow;var _a=env._fmod;var $a=env.___resumeException;var ab=env._llvm_va_end;var bb=env._vsscanf;var cb=env._snprintf;var db=env._fgetc;var eb=env.__getFloat;var fb=env._atexit;var gb=env.___cxa_free_exception;var hb=env._close;var ib=env._isdigit_l;var jb=env._clock;var kb=env.___setErrNo;var lb=env._isxdigit;var mb=env._ftell;var nb=env._exit;var ob=env._sprintf;var pb=env.___ctype_b_loc;var qb=env._freelocale;var rb=env._catgets;var sb=env.__isLeapYear;var tb=env._asprintf;var ub=env.___cxa_is_number_type;var vb=env.___cxa_does_inherit;var wb=env.___cxa_guard_acquire;var xb=env.___cxa_begin_catch;var yb=env._emscripten_memcpy_big;var zb=env._recv;var Ab=env.__parseInt64;var Bb=env.__ZSt18uncaught_exceptionv;var Cb=env._cos;var Db=env.__ZNSt9exceptionD2Ev;var Eb=env._times;var Fb=env._mkport;var Gb=env._copysign;var Hb=env.__exit;var Ib=env._strftime;var Jb=env.___cxa_throw;var Kb=env._printf;var Lb=env._pread;var Mb=env._fopen;var Nb=env._open;var Ob=env._strtoull_l;var Pb=env.__arraySum;var Qb=env._sysconf;var Rb=env._puts;var Sb=env._strtoll_l;var Tb=env.___cxa_find_matching_catch;var Ub=env.__formatString;var Vb=env._pthread_cond_broadcast;var Wb=env.__ZSt9terminatev;var Xb=env._pthread_mutex_unlock;var Yb=env.___cxa_call_unexpected;var Zb=env._sbrk;var _b=env.___errno_location;var $b=env._strerror;var ac=env._catclose;var bc=env._llvm_lifetime_start;var cc=env.___cxa_guard_release;var dc=env._ungetc;var ec=env._uselocale;var fc=env._vsnprintf;var gc=env._sscanf;var hc=env.___assert_fail;var ic=env._fread;var jc=env._strftime_l;var kc=env._abort;var lc=env._fprintf;var mc=env._isdigit;var nc=env._strtoll;var oc=env.__reallyNegative;var pc=env.__addDays;var qc=env._fabs;var rc=env._floor;var sc=env._fseek;var tc=env._sqrt;var uc=env._write;var vc=env.___cxa_allocate_exception;var wc=env._sin;var xc=env._vasprintf;var yc=env._catopen;var zc=env.___ctype_toupper_loc;var Ac=env.___ctype_tolower_loc;var Bc=env._pwrite;var Cc=env._strerror_r;var Dc=env._time;var Ec=0.0;
  6583. // EMSCRIPTEN_START_FUNCS
  6584. function ig(a,b,d,e,f,g,h,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0;k=i;i=i+1280|0;l=k+768|0;m=k+1024|0;n=kf((((a|0)>(b|0)?a:b)<<2)+4|0)|0;o=n;if((n|0)==0){p=k|0;ob(p|0,5288,(q=i,i=i+24|0,c[q>>2]=3528,c[q+8>>2]=88,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(p)}p=kf((a<<2)+4|0)|0;r=p;if((p|0)==0){s=k+256|0;ob(s|0,5288,(q=i,i=i+24|0,c[q>>2]=2816,c[q+8>>2]=90,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(s)}s=kf(d<<2)|0;d=s;if((s|0)==0){t=k+512|0;ob(t|0,5288,(q=i,i=i+24|0,c[q>>2]=1984,c[q+8>>2]=92,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(t)}t=(a|0)>0;if(t){Gq(n|0,0,a<<2|0)|0}u=(b|0)>0;if(u){v=0;w=c[e>>2]|0;while(1){x=v+1|0;y=e+(x<<2)|0;z=c[y>>2]|0;if((w|0)<(z|0)){A=w;while(1){B=o+(c[f+(A<<2)>>2]<<2)|0;c[B>>2]=(c[B>>2]|0)+1;B=A+1|0;C=c[y>>2]|0;if((B|0)<(C|0)){A=B}else{D=C;break}}}else{D=z}if((x|0)<(b|0)){v=x;w=D}else{break}}}c[r>>2]=0;a:do{if(t){D=0;w=0;while(1){v=o+(D<<2)|0;A=D+1|0;y=r+(A<<2)|0;c[y>>2]=(c[v>>2]|0)+w;c[v>>2]=w;if((A|0)>=(a|0)){break a}D=A;w=c[y>>2]|0}}}while(0);do{if(u){a=0;t=c[e>>2]|0;while(1){w=a+1|0;D=e+(w<<2)|0;x=c[D>>2]|0;if((t|0)<(x|0)){z=t;while(1){y=o+(c[f+(z<<2)>>2]<<2)|0;c[d+(c[y>>2]<<2)>>2]=a;c[y>>2]=(c[y>>2]|0)+1;y=z+1|0;A=c[D>>2]|0;if((y|0)<(A|0)){z=y}else{E=A;break}}}else{E=x}if((w|0)<(b|0)){a=w;t=E}else{break}}if(!u){F=0;break}Gq(n|0,-1|0,b<<2|0)|0;t=0;a=0;while(1){c[o+(a<<2)>>2]=a;z=c[e+(a<<2)>>2]|0;D=a+1|0;A=e+(D<<2)|0;y=c[A>>2]|0;if((z|0)<(y|0)){v=t;C=z;z=y;while(1){y=c[f+(C<<2)>>2]|0;B=c[r+(y<<2)>>2]|0;G=r+(y+1<<2)|0;y=c[G>>2]|0;if((B|0)<(y|0)){H=B;B=v;I=y;while(1){y=o+(c[d+(H<<2)>>2]<<2)|0;if((c[y>>2]|0)==(a|0)){J=B;K=I}else{c[y>>2]=a;J=B+1|0;K=c[G>>2]|0}y=H+1|0;if((y|0)<(K|0)){H=y;B=J;I=K}else{break}}L=J;M=c[A>>2]|0}else{L=v;M=z}I=C+1|0;if((I|0)<(M|0)){v=L;C=I;z=M}else{N=L;break}}}else{N=t}if((D|0)<(b|0)){t=N;a=D}else{F=N;break}}}else{F=0}}while(0);c[g>>2]=F;F=kf((b<<2)+4|0)|0;c[h>>2]=F;if((F|0)==0){F=l|0;ob(F|0,5288,(q=i,i=i+24|0,c[q>>2]=1472,c[q+8>>2]=154,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(F)}F=c[g>>2]|0;do{if((F|0)!=0){g=kf(F<<2)|0;c[j>>2]=g;if((g|0)!=0){break}g=m|0;ob(g|0,5288,(q=i,i=i+24|0,c[q>>2]=976,c[q+8>>2]=157,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(g)}}while(0);q=c[h>>2]|0;h=c[j>>2]|0;if(!u){O=0;P=q+(b<<2)|0;c[P>>2]=O;lf(n);lf(p);lf(s);i=k;return}Gq(n|0,-1|0,b<<2|0)|0;u=0;j=0;while(1){c[q+(j<<2)>>2]=u;c[o+(j<<2)>>2]=j;m=c[e+(j<<2)>>2]|0;F=j+1|0;g=e+(F<<2)|0;l=c[g>>2]|0;if((m|0)<(l|0)){N=u;L=m;m=l;while(1){l=c[f+(L<<2)>>2]|0;M=c[r+(l<<2)>>2]|0;J=r+(l+1<<2)|0;l=c[J>>2]|0;if((M|0)<(l|0)){K=M;M=N;E=l;while(1){l=c[d+(K<<2)>>2]|0;a=o+(l<<2)|0;if((c[a>>2]|0)==(j|0)){Q=M;R=E}else{c[a>>2]=j;c[h+(M<<2)>>2]=l;Q=M+1|0;R=c[J>>2]|0}l=K+1|0;if((l|0)<(R|0)){K=l;M=Q;E=R}else{break}}S=Q;T=c[g>>2]|0}else{S=N;T=m}E=L+1|0;if((E|0)<(T|0)){N=S;L=E;m=T}else{U=S;break}}}else{U=u}if((F|0)<(b|0)){u=U;j=F}else{O=U;break}}P=q+(b<<2)|0;c[P>>2]=O;lf(n);lf(p);lf(s);i=k;return}function jg(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0;j=i;i=i+1280|0;k=j+768|0;l=j+1024|0;m=a<<2;n=kf(m)|0;o=n;if((n|0)==0){p=j|0;ob(p|0,5288,(q=i,i=i+24|0,c[q>>2]=3528,c[q+8>>2]=222,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(p)}p=m+4|0;m=kf(p)|0;r=m;if((m|0)==0){s=j+256|0;ob(s|0,5288,(q=i,i=i+24|0,c[q>>2]=13360,c[q+8>>2]=224,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(s)}s=kf(b<<2)|0;b=s;if((s|0)==0){t=j+512|0;ob(t|0,5288,(q=i,i=i+24|0,c[q>>2]=12800,c[q+8>>2]=226,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(t)}t=(a|0)>0;do{if(t){Gq(n|0,0,a<<2|0)|0;u=0;v=c[d>>2]|0;while(1){w=u+1|0;x=d+(w<<2)|0;y=c[x>>2]|0;if((v|0)<(y|0)){z=v;while(1){A=o+(c[e+(z<<2)>>2]<<2)|0;c[A>>2]=(c[A>>2]|0)+1;A=z+1|0;B=c[x>>2]|0;if((A|0)<(B|0)){z=A}else{C=B;break}}}else{C=y}if((w|0)<(a|0)){u=w;v=C}else{break}}c[r>>2]=0;if(t){D=0;E=0}else{F=0;break}while(1){v=o+(D<<2)|0;u=D+1|0;z=r+(u<<2)|0;c[z>>2]=(c[v>>2]|0)+E;c[v>>2]=E;if((u|0)>=(a|0)){break}D=u;E=c[z>>2]|0}if(!t){F=0;break}z=0;u=c[d>>2]|0;while(1){v=z+1|0;x=d+(v<<2)|0;B=c[x>>2]|0;if((u|0)<(B|0)){A=u;while(1){G=o+(c[e+(A<<2)>>2]<<2)|0;c[b+(c[G>>2]<<2)>>2]=z;c[G>>2]=(c[G>>2]|0)+1;G=A+1|0;H=c[x>>2]|0;if((G|0)<(H|0)){A=G}else{I=H;break}}}else{I=B}if((v|0)<(a|0)){z=v;u=I}else{break}}if(!t){F=0;break}Gq(n|0,-1|0,a<<2|0)|0;u=0;z=0;while(1){c[o+(z<<2)>>2]=z;A=c[d+(z<<2)>>2]|0;x=z+1|0;w=d+(x<<2)|0;y=c[w>>2]|0;if((A|0)<(y|0)){H=u;G=A;A=y;while(1){y=o+(c[e+(G<<2)>>2]<<2)|0;if((c[y>>2]|0)==(z|0)){J=H;K=A}else{c[y>>2]=z;J=H+1|0;K=c[w>>2]|0}y=G+1|0;if((y|0)<(K|0)){H=J;G=y;A=K}else{L=J;break}}}else{L=u}A=c[r+(z<<2)>>2]|0;G=r+(x<<2)|0;H=c[G>>2]|0;if((A|0)<(H|0)){w=L;v=A;A=H;while(1){H=o+(c[b+(v<<2)>>2]<<2)|0;if((c[H>>2]|0)==(z|0)){M=w;N=A}else{c[H>>2]=z;M=w+1|0;N=c[G>>2]|0}H=v+1|0;if((H|0)<(N|0)){w=M;v=H;A=N}else{O=M;break}}}else{O=L}if((x|0)<(a|0)){u=O;z=x}else{F=O;break}}}else{c[r>>2]=0;F=0}}while(0);c[f>>2]=F;F=kf(p)|0;c[g>>2]=F;if((F|0)==0){F=k|0;ob(F|0,5288,(q=i,i=i+24|0,c[q>>2]=12152,c[q+8>>2]=289,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(F)}F=c[f>>2]|0;do{if((F|0)!=0){f=kf(F<<2)|0;c[h>>2]=f;if((f|0)!=0){break}f=l|0;ob(f|0,5288,(q=i,i=i+24|0,c[q>>2]=11712,c[q+8>>2]=292,c[q+16>>2]=8312,q)|0)|0;i=q;Ze(f)}}while(0);if(!t){P=0;Q=c[g>>2]|0;R=Q+(a<<2)|0;c[R>>2]=P;lf(n);lf(m);lf(s);i=j;return}Gq(n|0,-1|0,a<<2|0)|0;t=c[g>>2]|0;g=0;q=0;while(1){c[t+(q<<2)>>2]=g;c[o+(q<<2)>>2]=q;l=c[d+(q<<2)>>2]|0;F=q+1|0;f=d+(F<<2)|0;k=c[f>>2]|0;if((l|0)<(k|0)){p=g;O=l;l=k;while(1){k=c[e+(O<<2)>>2]|0;L=o+(k<<2)|0;if((c[L>>2]|0)==(q|0)){S=p;T=l}else{c[L>>2]=q;c[(c[h>>2]|0)+(p<<2)>>2]=k;S=p+1|0;T=c[f>>2]|0}k=O+1|0;if((k|0)<(T|0)){p=S;O=k;l=T}else{U=S;break}}}else{U=g}l=c[r+(q<<2)>>2]|0;O=r+(F<<2)|0;p=c[O>>2]|0;if((l|0)<(p|0)){f=U;k=l;l=p;while(1){p=c[b+(k<<2)>>2]|0;L=o+(p<<2)|0;if((c[L>>2]|0)==(q|0)){V=f;W=l}else{c[L>>2]=q;c[(c[h>>2]|0)+(f<<2)>>2]=p;V=f+1|0;W=c[O>>2]|0}p=k+1|0;if((p|0)<(W|0)){f=V;k=p;l=W}else{X=V;break}}}else{X=U}if((F|0)<(a|0)){g=X;q=F}else{P=X;Q=t;break}}R=Q+(a<<2)|0;c[R>>2]=P;lf(n);lf(m);lf(s);i=j;return}function kg(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;e=i;i=i+1848|0;f=e|0;g=e+8|0;h=e+16|0;j=e+24|0;k=e+32|0;l=e+40|0;m=e+48|0;n=e+56|0;o=e+312|0;p=e+568|0;q=e+824|0;r=e+1080|0;s=e+1336|0;t=e+1592|0;u=c[b+20>>2]|0;c[g>>2]=0;v=c[b+12>>2]|0;w=c[b+16>>2]|0;c[f>>2]=w;+gg();if((a|0)==3){hg(v,w,c[u>>2]|0,c[u+12>>2]|0,c[u+8>>2]|0,d);i=e;return}else if((a|0)==1){ig(v,w,c[u>>2]|0,c[u+12>>2]|0,c[u+8>>2]|0,g,h,m);+gg()}else if((a|0)==2){if((v|0)==(w|0)){x=v}else{v=n|0;ob(v|0,5288,(y=i,i=i+24|0,c[y>>2]=11480,c[y+8>>2]=395,c[y+16>>2]=8312,y)|0)|0;i=y;Ze(v);x=c[f>>2]|0}jg(x,c[u>>2]|0,c[u+12>>2]|0,c[u+8>>2]|0,g,h,m);+gg()}else if((a|0)==0){if((w|0)>0){z=0}else{i=e;return}do{c[d+(z<<2)>>2]=z;z=z+1|0;}while((z|0)<(w|0));i=e;return}else{w=o|0;ob(w|0,5288,(y=i,i=i+24|0,c[y>>2]=11096,c[y+8>>2]=411,c[y+16>>2]=8312,y)|0)|0;i=y;Ze(w)}w=c[g>>2]|0;if((w|0)==0){g=c[f>>2]|0;if((g|0)>0){o=0;do{c[d+(o<<2)>>2]=o;o=o+1|0;}while((o|0)<(g|0))}A=c[h>>2]|0}else{+gg();c[j>>2]=0;c[k>>2]=2147483647;g=c[f>>2]|0;o=kf(g<<2)|0;z=o;if((o|0)==0){a=p|0;ob(a|0,5288,(y=i,i=i+24|0,c[y>>2]=10936,c[y+8>>2]=422,c[y+16>>2]=8312,y)|0)|0;i=y;Ze(a);B=c[f>>2]|0;C=c[j>>2]|0}else{B=g;C=0}g=kf(C+B<<2)|0;a=g;if((g|0)==0){p=q|0;ob(p|0,5288,(y=i,i=i+24|0,c[y>>2]=10696,c[y+8>>2]=424,c[y+16>>2]=8312,y)|0)|0;i=y;Ze(p);D=c[f>>2]|0;E=c[j>>2]|0}else{D=B;E=C}C=kf(E+D<<2)|0;E=C;if((C|0)==0){B=r|0;ob(B|0,5288,(y=i,i=i+24|0,c[y>>2]=10504,c[y+8>>2]=426,c[y+16>>2]=8312,y)|0)|0;i=y;Ze(B);F=c[f>>2]|0}else{F=D}D=kf(F<<2)|0;B=D;if((D|0)==0){r=s|0;ob(r|0,5288,(y=i,i=i+24|0,c[y>>2]=10232,c[y+8>>2]=428,c[y+16>>2]=8312,y)|0)|0;i=y;Ze(r);G=c[f>>2]|0}else{G=F}F=kf(G<<2)|0;r=F;if((F|0)==0){s=t|0;ob(s|0,5288,(y=i,i=i+24|0,c[y>>2]=9520,c[y+8>>2]=430,c[y+16>>2]=8312,y)|0)|0;i=y;Ze(s);H=c[f>>2]|0}else{H=G}if((H|0)>=0){H=c[h>>2]|0;G=0;do{s=H+(G<<2)|0;c[s>>2]=(c[s>>2]|0)+1;G=G+1|0;}while((G|0)<=(c[f>>2]|0))}G=c[m>>2]|0;if((w|0)>0){m=0;do{H=G+(m<<2)|0;c[H>>2]=(c[H>>2]|0)+1;m=m+1|0;}while((m|0)<(w|0))}w=c[h>>2]|0;lg(f,w,G,d,z,j,a,E,B,r,k,l)|0;l=c[f>>2]|0;if((l|0)>0){f=0;do{k=d+(f<<2)|0;c[k>>2]=(c[k>>2]|0)-1;f=f+1|0;}while((f|0)<(l|0))}lf(o);lf(g);lf(C);lf(D);lf(F);lf(G);+gg();A=w}lf(A);i=e;return}function lg(a,b,d,e,f,g,h,i,j,k,l,m){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;if((c[a>>2]|0)<1){return 0}c[m>>2]=0;mg(a,b,0,h,e,f,i,j,k)|0;c[5862]=1;n=c[h>>2]|0;c[5864]=n;if((n|0)<1){o=1}else{p=n;while(1){c[5866]=p;n=p-1|0;c[5864]=c[e+(n<<2)>>2];c[k+(n<<2)>>2]=c[l>>2];c[e+((c[5866]|0)-1<<2)>>2]=-(c[5862]|0);n=(c[5862]|0)+1|0;c[5862]=n;q=c[5864]|0;if((q|0)<1){o=n;break}else{p=q}}}a:do{if((o|0)<=(c[a>>2]|0)){c[5860]=1;c[h>>2]=0;c[5870]=2;p=2;while(1){if((c[h+(p-1<<2)>>2]|0)<=0){q=p+1|0;c[5870]=q;p=q;continue}c[5868]=(c[g>>2]|0)+p;c[5874]=0;q=p;while(1){n=h+(q-1<<2)|0;r=c[n>>2]|0;c[5866]=r;if((r|0)<=0){s=q+1|0;c[5870]=s;if((s|0)>(c[5868]|0)){break}else{q=s;continue}}s=c[e+(r-1<<2)>>2]|0;c[5864]=s;c[n>>2]=s;s=c[5864]|0;if((s|0)>0){c[f+(s-1<<2)>>2]=-(c[5870]|0)}c[e+((c[5866]|0)-1<<2)>>2]=-(c[5862]|0);c[m>>2]=(c[m>>2]|0)-2+(c[5870]|0)+(c[i+((c[5866]|0)-1<<2)>>2]|0);if(((c[i+((c[5866]|0)-1<<2)>>2]|0)+(c[5862]|0)|0)>(c[a>>2]|0)){break a}s=(c[5860]|0)+1|0;c[5860]=s;do{if((s|0)>=(c[l>>2]|0)){c[5860]=1;n=c[a>>2]|0;c[5872]=1;if((n|0)<1){break}else{t=1}do{r=k+(t-1<<2)|0;if((c[r>>2]|0)<(c[l>>2]|0)){c[r>>2]=0;u=c[5872]|0}else{u=t}t=u+1|0;c[5872]=t;}while((t|0)<=(n|0))}}while(0);ng(23464,b,d,h,e,f,i,j,k,l,23440)|0;s=(c[5866]|0)-1|0;c[5862]=(c[5862]|0)+(c[i+(s<<2)>>2]|0);c[j+(s<<2)>>2]=c[5874];c[5874]=c[5866];if(!((c[g>>2]|0)>-1)){break}q=c[5870]|0}if((c[5862]|0)>(c[a>>2]|0)){break a}og(23496,a,b,d,g,23480,h,e,f,i,j,k,l,23440)|0;p=c[5870]|0}}}while(0);pg(a,f,e,i)|0;return 0}function mg(a,b,d,e,f,g,h,i,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,l=0;d=c[a>>2]|0;c[5814]=1;if((d|0)>=1){k=1;do{c[e+(k-1<<2)>>2]=0;c[h+((c[5814]|0)-1<<2)>>2]=1;c[j+((c[5814]|0)-1<<2)>>2]=0;c[i+((c[5814]|0)-1<<2)>>2]=0;k=(c[5814]|0)+1|0;c[5814]=k;}while((k|0)<=(d|0))}d=c[a>>2]|0;c[5814]=1;if((d|0)<1){return 0}else{l=1}do{a=l-1|0;k=(c[b+(l<<2)>>2]|0)-(c[b+(a<<2)>>2]|0)|0;c[5816]=k+1;i=c[e+(k<<2)>>2]|0;c[5818]=i;c[f+(a<<2)>>2]=i;c[e+((c[5816]|0)-1<<2)>>2]=c[5814];i=c[5818]|0;if((i|0)>0){c[g+(i-1<<2)>>2]=c[5814]}c[g+((c[5814]|0)-1<<2)>>2]=-(c[5816]|0);l=(c[5814]|0)+1|0;c[5814]=l;}while((l|0)<=(d|0));return 0}function ng(a,b,d,e,f,g,h,i,j,k,l){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0;c[j+((c[a>>2]|0)-1<<2)>>2]=c[l>>2];m=c[b+((c[a>>2]|0)-1<<2)>>2]|0;c[5844]=m;n=(c[b+(c[a>>2]<<2)>>2]|0)-1|0;c[5846]=n;c[5850]=0;c[5824]=m;c[5826]=n;c[5848]=m;do{if((m|0)<=(n|0)){o=m;do{p=c[d+(o-1<<2)>>2]|0;c[5834]=p;if((p|0)==0){break}q=j+(p-1<<2)|0;p=c[l>>2]|0;do{if((c[q>>2]|0)<(p|0)){c[q>>2]=p;r=c[5834]|0;s=r-1|0;if((c[f+(s<<2)>>2]|0)<0){c[i+(s<<2)>>2]=c[5850];c[5850]=c[5834];break}else{c[d+((c[5824]|0)-1<<2)>>2]=r;c[5824]=(c[5824]|0)+1;break}}}while(0);o=(c[5848]|0)+1|0;c[5848]=o;}while((o|0)<=(n|0));o=c[5850]|0;if((o|0)<1){break}else{t=o}do{c[d+((c[5826]|0)-1<<2)>>2]=-t;o=c[5850]|0;c[5836]=o;p=c[b+(o-1<<2)>>2]|0;c[5838]=p;q=(c[b+(o<<2)>>2]|0)-1|0;c[5840]=q;c[5842]=p;a:do{if((p|0)<=(q|0)){o=p;r=q;do{s=o;while(1){u=c[d+(s-1<<2)>>2]|0;c[5832]=u;v=-u|0;c[5836]=v;if((u|0)<0){break}if((u|0)==0){break a}w=u-1|0;x=j+(w<<2)|0;y=c[l>>2]|0;do{if((c[x>>2]|0)<(y|0)){if((c[f+(w<<2)>>2]|0)<0){z=s;break}c[x>>2]=y;A=c[5824]|0;B=c[5826]|0;if((A|0)<(B|0)){C=A}else{A=B;while(1){B=c[d+(A-1<<2)>>2]|0;D=-B|0;c[5836]=D;E=c[b+(~B<<2)>>2]|0;c[5824]=E;B=(c[b+(D<<2)>>2]|0)-1|0;c[5826]=B;if((E|0)<(B|0)){C=E;break}else{A=B}}}c[d+(C-1<<2)>>2]=c[5832];c[5824]=(c[5824]|0)+1;z=c[5842]|0}else{z=s}}while(0);s=z+1|0;c[5842]=s;if((s|0)>(r|0)){break a}}o=c[b+(~u<<2)>>2]|0;c[5838]=o;r=(c[b+(v<<2)>>2]|0)-1|0;c[5840]=r;c[5842]=o;}while((o|0)<=(r|0))}}while(0);t=c[i+((c[5850]|0)-1<<2)>>2]|0;c[5850]=t;}while((t|0)>=1)}}while(0);t=c[5824]|0;if((t|0)<=(c[5826]|0)){c[d+(t-1<<2)>>2]=0}t=c[a>>2]|0;c[5836]=t;i=c[b+(t-1<<2)>>2]|0;c[5844]=i;v=(c[b+(t<<2)>>2]|0)-1|0;c[5846]=v;c[5848]=i;if((i|0)>(v|0)){return 0}else{F=i;G=v}b:while(1){v=F;while(1){H=c[d+(v-1<<2)>>2]|0;c[5822]=H;I=-H|0;c[5836]=I;if((H|0)<0){break}if((H|0)==0){J=46;break b}i=H-1|0;t=c[g+(i<<2)>>2]|0;c[5828]=t;do{if((t|0)!=0){if((t|0)==(-(c[k>>2]|0)|0)){break}u=c[f+(i<<2)>>2]|0;c[5830]=u;if((u|0)>0){c[g+(u-1<<2)>>2]=t;K=c[5828]|0}else{K=t}if((K|0)>0){c[f+(K-1<<2)>>2]=c[5830];L=c[5828]|0}else{L=K}if((L|0)>=0){break}c[e+(~L<<2)>>2]=c[5830]}}while(0);t=c[5822]|0;i=c[b+(t-1<<2)>>2]|0;c[5838]=i;u=(c[b+(t<<2)>>2]|0)-1|0;c[5840]=u;c[5820]=i;c[5842]=i;c:do{if((i|0)>(u|0)){M=i}else{t=i;z=i;while(1){C=c[d+(t-1<<2)>>2]|0;c[5834]=C;if((C|0)==0){M=z;break c}if((c[j+(C-1<<2)>>2]|0)<(c[l>>2]|0)){c[d+(z-1<<2)>>2]=C;C=(c[5820]|0)+1|0;c[5820]=C;N=C;O=c[5842]|0}else{N=z;O=t}C=O+1|0;c[5842]=C;if((C|0)>(u|0)){M=N;break}else{t=C;z=N}}}}while(0);u=M-(c[5838]|0)|0;do{if((u|0)>0){c[f+((c[5822]|0)-1<<2)>>2]=u+1;c[g+((c[5822]|0)-1<<2)>>2]=0;c[d+((c[5820]|0)-1<<2)>>2]=c[a>>2];i=c[5820]|0;z=i+1|0;c[5820]=z;if((z|0)>(c[5840]|0)){break}c[d+(i<<2)>>2]=0}else{i=h+((c[a>>2]|0)-1<<2)|0;c[i>>2]=(c[i>>2]|0)+(c[h+((c[5822]|0)-1<<2)>>2]|0);c[h+((c[5822]|0)-1<<2)>>2]=0;c[j+((c[5822]|0)-1<<2)>>2]=c[k>>2];c[f+((c[5822]|0)-1<<2)>>2]=-(c[a>>2]|0);c[g+((c[5822]|0)-1<<2)>>2]=-(c[k>>2]|0)}}while(0);u=(c[5848]|0)+1|0;c[5848]=u;if((u|0)>(G|0)){J=46;break b}else{v=u}}v=c[b+(~H<<2)>>2]|0;c[5844]=v;u=(c[b+(I<<2)>>2]|0)-1|0;c[5846]=u;c[5848]=v;if((v|0)>(u|0)){J=46;break}else{F=v;G=u}}if((J|0)==46){return 0}return 0}function og(b,d,e,f,g,h,i,j,k,l,m,n,o,p){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;var q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0;q=(c[g>>2]|0)+(c[h>>2]|0)|0;c[5780]=q;g=c[b>>2]|0;c[5796]=g;if((g|0)<1){return 0}else{r=g;s=q}while(1){q=s+(c[p>>2]|0)|0;c[5778]=q;if((q|0)<(c[o>>2]|0)){t=r}else{c[p>>2]=1;q=c[d>>2]|0;c[5790]=1;if((q|0)>=1){g=1;do{b=n+(g-1<<2)|0;if((c[b>>2]|0)<(c[o>>2]|0)){c[b>>2]=0;u=c[5790]|0}else{u=g}g=u+1|0;c[5790]=g;}while((g|0)<=(q|0))}c[5778]=(c[5780]|0)+(c[p>>2]|0);t=c[5796]|0}c[5772]=0;c[5770]=0;c[5798]=0;c[5782]=t;q=c[e+(t-1<<2)>>2]|0;c[5788]=q;g=(c[e+(t<<2)>>2]|0)-1|0;c[5790]=q;a:do{if((q|0)<=(g|0)){b=q;v=g;do{w=b;while(1){x=c[f+(w-1<<2)>>2]|0;c[5794]=x;y=-x|0;c[5782]=y;if((x|0)<0){break}if((x|0)==0){break a}z=x-1|0;A=c[l+(z<<2)>>2]|0;do{if((A|0)!=0){c[5798]=(c[5798]|0)+A;c[n+(z<<2)>>2]=c[5778];B=(c[5794]|0)-1|0;if((c[k+(B<<2)>>2]|0)!=0){break}if((c[j+(B<<2)>>2]|0)==2){c[m+(B<<2)>>2]=c[5772];c[5772]=c[5794];break}else{c[m+(B<<2)>>2]=c[5770];c[5770]=c[5794];break}}}while(0);w=(c[5790]|0)+1|0;c[5790]=w;if((w|0)>(v|0)){break a}}b=c[e+(~x<<2)>>2]|0;c[5788]=b;v=(c[e+(y<<2)>>2]|0)-1|0;c[5790]=b;}while((b|0)<=(v|0))}}while(0);g=c[5772]|0;c[5794]=g;q=g;b:while(1){c:do{if((q|0)<1){g=c[5770]|0;c[5794]=g;C=g}else{if((c[k+(q-1<<2)>>2]|0)!=0){g=c[m+((c[5794]|0)-1<<2)>>2]|0;c[5794]=g;q=g;continue b}c[p>>2]=(c[p>>2]|0)+1;g=c[5798]|0;c[5800]=g;v=c[5794]|0;b=c[e+(v-1<<2)>>2]|0;c[5788]=b;w=c[f+(b-1<<2)>>2]|0;c[5776]=w;if((w|0)==(c[5796]|0)){z=c[f+(b<<2)>>2]|0;c[5776]=z;D=z}else{D=w}c[5782]=D;w=D-1|0;if((c[j+(w<<2)>>2]|0)>=0){c[5800]=g+(c[l+(w<<2)>>2]|0);E=1;F=62;break}g=c[e+(w<<2)>>2]|0;c[5788]=g;w=(c[e+(D<<2)>>2]|0)-1|0;c[5790]=g;if((g|0)>(w|0)){E=1;F=62;break}else{G=g;H=w;I=v}while(1){v=G;w=I;d:while(1){J=c[f+(v-1<<2)>>2]|0;c[5774]=J;K=-J|0;c[5782]=K;do{if((J|0)!=(w|0)){if((J|0)<0){break d}if((J|0)==0){E=1;F=62;break c}g=J-1|0;z=c[l+(g<<2)>>2]|0;if((z|0)==0){break}b=n+(g<<2)|0;A=c[p>>2]|0;if((c[b>>2]|0)<(A|0)){c[b>>2]=A;c[5800]=(c[5800]|0)+(c[l+((c[5774]|0)-1<<2)>>2]|0);break}A=k+(g<<2)|0;if((c[A>>2]|0)!=0){break}if((c[j+(g<<2)>>2]|0)==2){g=l+(w-1<<2)|0;c[g>>2]=(c[g>>2]|0)+z;c[l+((c[5774]|0)-1<<2)>>2]=0;c[n+((c[5774]|0)-1<<2)>>2]=c[o>>2];c[j+((c[5774]|0)-1<<2)>>2]=-(c[5794]|0);c[k+((c[5774]|0)-1<<2)>>2]=-(c[o>>2]|0);break}else{c[A>>2]=-(c[o>>2]|0);break}}}while(0);A=(c[5790]|0)+1|0;c[5790]=A;if((A|0)>(H|0)){E=1;F=62;break c}v=A;w=c[5794]|0}v=c[e+(~J<<2)>>2]|0;c[5788]=v;A=(c[e+(K<<2)>>2]|0)-1|0;c[5790]=v;if((v|0)>(A|0)){E=1;F=62;break}else{G=v;H=A;I=w}}}}while(0);e:while(1){if((F|0)==62){F=0;A=(c[5794]|0)-1|0;v=(c[5800]|0)-(c[l+(A<<2)>>2]|0)|0;c[5800]=v+1;z=c[i+(v<<2)>>2]|0;c[5792]=z;c[j+(A<<2)>>2]=z;c[k+((c[5794]|0)-1<<2)>>2]=-(c[5800]|0);z=c[5792]|0;if((z|0)>0){c[k+(z-1<<2)>>2]=c[5794]}c[i+((c[5800]|0)-1<<2)>>2]=c[5794];z=c[5800]|0;if((z|0)<(c[h>>2]|0)){c[h>>2]=z;z=c[m+((c[5794]|0)-1<<2)>>2]|0;c[5794]=z;if(E){q=z;continue b}else{C=z;continue}}else{z=c[m+((c[5794]|0)-1<<2)>>2]|0;c[5794]=z;if(E){q=z;continue b}else{C=z;continue}}}if((C|0)<1){break b}if((c[k+(C-1<<2)>>2]|0)!=0){z=c[m+((c[5794]|0)-1<<2)>>2]|0;c[5794]=z;C=z;continue}c[p>>2]=(c[p>>2]|0)+1;c[5800]=c[5798];z=c[5794]|0;A=c[e+(z-1<<2)>>2]|0;c[5788]=A;v=(c[e+(z<<2)>>2]|0)-1|0;c[5790]=A;if((A|0)>(v|0)){E=0;F=62;continue}else{L=A}while(1){A=c[f+(L-1<<2)>>2]|0;c[5776]=A;if((A|0)==0){E=0;F=62;continue e}z=n+(A-1<<2)|0;A=c[p>>2]|0;f:do{if((c[z>>2]|0)<(A|0)){c[z>>2]=A;g=c[5776]|0;c[5782]=g;b=g-1|0;if((c[j+(b<<2)>>2]|0)>=0){c[5800]=(c[5800]|0)+(c[l+(b<<2)>>2]|0);break}B=c[e+(b<<2)>>2]|0;c[5784]=B;b=(c[e+(g<<2)>>2]|0)-1|0;c[5786]=B;if((B|0)>(b|0)){break}else{M=B;N=b}do{b=M;while(1){O=c[f+(b-1<<2)>>2]|0;c[5774]=O;P=-O|0;c[5782]=P;if((O|0)<0){break}if((O|0)==0){break f}B=n+(O-1<<2)|0;g=c[p>>2]|0;if((c[B>>2]|0)<(g|0)){c[B>>2]=g;c[5800]=(c[5800]|0)+(c[l+((c[5774]|0)-1<<2)>>2]|0);Q=c[5786]|0}else{Q=b}b=Q+1|0;c[5786]=b;if((b|0)>(N|0)){break f}}M=c[e+(~O<<2)>>2]|0;c[5784]=M;N=(c[e+(P<<2)>>2]|0)-1|0;c[5786]=M;}while((M|0)<=(N|0))}}while(0);A=(c[5790]|0)+1|0;c[5790]=A;if((A|0)>(v|0)){E=0;F=62;continue e}else{L=A}}}}c[p>>2]=c[5778];q=c[m+((c[5796]|0)-1<<2)>>2]|0;c[5796]=q;if((q|0)<1){break}r=q;s=c[5780]|0}a[192]=0;return 0}function pg(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;f=c[a>>2]|0;c[5808]=1;if((f|0)>=1){g=1;do{h=g-1|0;i=c[e+(h<<2)>>2]|0;c[5806]=i;do{if((i|0)<1){c[b+(h<<2)>>2]=c[d+(h<<2)>>2];if((c[5806]|0)<=0){break}j=c[5808]|0;k=5}else{j=g;k=5}}while(0);if((k|0)==5){k=0;h=j-1|0;c[b+(h<<2)>>2]=-(c[d+(h<<2)>>2]|0)}g=(c[5808]|0)+1|0;c[5808]=g;}while((g|0)<=(f|0))}f=c[a>>2]|0;c[5808]=1;if((f|0)>=1){g=1;do{j=g-1|0;do{if((c[b+(j<<2)>>2]|0)>0){l=g}else{k=g;while(1){c[5812]=k;m=b+(k-1<<2)|0;e=c[m>>2]|0;if((e|0)>0){break}else{k=-e|0}}c[5802]=k;e=c[m>>2]|0;c[5804]=e+1;c[d+(j<<2)>>2]=~e;c[b+((c[5802]|0)-1<<2)>>2]=c[5804];e=c[5808]|0;c[5812]=e;h=-(c[b+(e-1<<2)>>2]|0)|0;c[5810]=h;if((h|0)<1){l=e;break}else{n=e}do{c[b+(n-1<<2)>>2]=-(c[5802]|0);n=c[5810]|0;c[5812]=n;e=-(c[b+(n-1<<2)>>2]|0)|0;c[5810]=e;}while((e|0)>=1);l=c[5808]|0}}while(0);g=l+1|0;c[5808]=g;}while((g|0)<=(f|0))}f=c[a>>2]|0;c[5808]=1;if((f|0)<1){return 0}else{o=1}do{a=d+(o-1<<2)|0;g=-(c[a>>2]|0)|0;c[5804]=g;c[a>>2]=g;c[b+((c[5804]|0)-1<<2)>>2]=c[5808];o=(c[5808]|0)+1|0;c[5808]=o;}while((o|0)<=(f|0));return 0}function qg(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;g=i;i=i+1024|0;h=g+768|0;j=b+16|0;k=c[j>>2]|0;c[f>>2]=1;c[f+4>>2]=c[b+4>>2];c[f+8>>2]=c[b+8>>2];l=b+12|0;c[f+12>>2]=c[l>>2];c[f+16>>2]=c[j>>2];m=c[b+20>>2]|0;b=kf(20)|0;c[f+20>>2]=b;if((b|0)==0){f=g|0;ob(f|0,4840,(n=i,i=i+24|0,c[n>>2]=11608,c[n+8>>2]=81,c[n+16>>2]=8128,n)|0)|0;i=n;Ze(f)}c[b>>2]=c[m>>2];c[b+4>>2]=c[m+4>>2];f=b+8|0;c[f>>2]=c[m+8>>2];o=k<<2;p=kf(o)|0;q=b+12|0;c[q>>2]=p;if((p|0)==0){p=g+256|0;ob(p|0,4840,(n=i,i=i+24|0,c[n>>2]=5960,c[n+8>>2]=86,c[n+16>>2]=8128,n)|0)|0;i=n;Ze(p)}p=kf(o)|0;r=b+16|0;c[r>>2]=p;if((p|0)==0){p=g+512|0;ob(p|0,4840,(n=i,i=i+24|0,c[n>>2]=4032,c[n+8>>2]=88,c[n+16>>2]=8128,n)|0)|0;i=n;Ze(p)}p=(k|0)>0;if(p){b=c[m+12>>2]|0;m=c[q>>2]|0;s=c[r>>2]|0;t=0;do{u=d+(t<<2)|0;c[m+(c[u>>2]<<2)>>2]=c[b+(t<<2)>>2];t=t+1|0;c[s+(c[u>>2]<<2)>>2]=c[b+(t<<2)>>2];}while((t|0)<(k|0))}if((c[a>>2]|0)!=0){i=g;return}zg(c[q>>2]|0,c[r>>2]|0,c[f>>2]|0,c[l>>2]|0,c[j>>2]|0,e)|0;if((c[a+32>>2]|0)!=0){i=g;return}a=Ag(k,e)|0;j=kf(o+4|0)|0;o=j;if((j|0)==0){l=h|0;ob(l|0,4840,(n=i,i=i+24|0,c[n>>2]=3488,c[n+8>>2]=159,c[n+16>>2]=8128,n)|0)|0;i=n;Ze(l)}do{if(p){l=0;do{c[o+(c[a+(l<<2)>>2]<<2)>>2]=c[a+(c[e+(l<<2)>>2]<<2)>>2];l=l+1|0;}while((l|0)<(k|0));if(p){v=0}else{break}do{c[e+(v<<2)>>2]=c[o+(v<<2)>>2];v=v+1|0;}while((v|0)<(k|0));if(!p){break}l=c[q>>2]|0;n=0;do{c[o+(c[a+(n<<2)>>2]<<2)>>2]=c[l+(n<<2)>>2];n=n+1|0;}while((n|0)<(k|0));if(!p){break}n=c[q>>2]|0;l=0;do{c[n+(l<<2)>>2]=c[o+(l<<2)>>2];l=l+1|0;}while((l|0)<(k|0));if(!p){break}l=c[r>>2]|0;n=0;do{c[o+(c[a+(n<<2)>>2]<<2)>>2]=c[l+(n<<2)>>2];n=n+1|0;}while((n|0)<(k|0));if(!p){break}n=c[r>>2]|0;l=0;do{c[n+(l<<2)>>2]=c[o+(l<<2)>>2];l=l+1|0;}while((l|0)<(k|0));if(p){w=0}else{break}do{c[o+(w<<2)>>2]=c[a+(c[d+(w<<2)>>2]<<2)>>2];w=w+1|0;}while((w|0)<(k|0));if(p){x=0}else{break}do{c[d+(x<<2)>>2]=c[o+(x<<2)>>2];x=x+1|0;}while((x|0)<(k|0))}}while(0);lf(a);lf(j);i=g;return}function rg(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0;jf(f,a,-1);g=(a|0)>0;if(!g){return}Gq(e|0,0,a<<2|0)|0;h=0;do{i=c[b+(h<<2)>>2]|0;if((i|0)!=(a|0)){j=e+(i<<2)|0;c[j>>2]=(c[e+(h<<2)>>2]|0)+1+(c[j>>2]|0)}h=h+1|0;}while((h|0)<(a|0));if(g){k=0}else{return}while(1){g=k;while(1){h=c[b+(g<<2)>>2]|0;if((h|0)==(a|0)){break}if((c[e+(h<<2)>>2]|0)<(d|0)){g=h}else{break}}c[f+(k<<2)>>2]=g;h=g;do{h=h+1|0;l=(h|0)<(a|0);}while((c[e+(h<<2)>>2]|0)!=0&l);if(l){k=h}else{break}}return}function sg(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;g=i;h=e;j=i;i=i+256|0;k=pf((a*3|0)+2|0)|0;if((k|0)==0){l=j|0;ob(l|0,4568,(j=i,i=i+24|0,c[j>>2]=11552,c[j+8>>2]=54,c[j+16>>2]=8088,j)|0)|0;i=j;Ze(l)}l=a+1|0;j=l<<1;m=Ag(a,b)|0;if((l|0)>0){n=0;do{c[k+((c[m+(n<<2)>>2]|0)+l<<2)>>2]=n;n=n+1|0;}while((n|0)<(l|0))}n=(a|0)>0;do{if(n){o=0;do{p=b+(o<<2)|0;c[k+(c[m+(o<<2)>>2]<<2)>>2]=c[m+(c[p>>2]<<2)>>2];c[k+(o+j<<2)>>2]=c[p>>2];o=o+1|0;}while((o|0)<(a|0));if(n){q=0}else{break}do{c[b+(q<<2)>>2]=c[k+(q<<2)>>2];q=q+1|0;}while((q|0)<(a|0));jf(f,a,-1);if(!n){r=m;lf(r);s=k;lf(s);i=g;return}Gq(h|0,0,a<<2|0)|0;o=0;do{p=c[b+(o<<2)>>2]|0;if((p|0)!=(a|0)){t=e+(p<<2)|0;c[t>>2]=(c[e+(o<<2)>>2]|0)+1+(c[t>>2]|0)}o=o+1|0;}while((o|0)<(a|0));if(n){u=0}else{r=m;lf(r);s=k;lf(s);i=g;return}while(1){o=u;while(1){t=c[b+(o<<2)>>2]|0;if((t|0)==(a|0)){break}if((c[e+(t<<2)>>2]|0)<(d|0)){o=t}else{break}}t=(u|0)>(o|0);if(t){v=a}else{p=a;w=u;while(1){x=c[k+(w+l<<2)>>2]|0;y=(p|0)<(x|0)?p:x;x=w+1|0;if((x|0)>(o|0)){v=y;break}else{p=y;w=x}}}w=c[k+(o+l<<2)>>2]|0;do{if((w-v|0)==(o-u|0)){c[f+(v<<2)>>2]=w;z=o}else{if(t){z=o;break}else{A=u}while(1){p=c[k+(A+l<<2)>>2]|0;if((c[e+(A<<2)>>2]|0)==0){c[f+(p<<2)>>2]=p}p=A+1|0;if((p|0)>(o|0)){z=o;break}else{A=p}}}}while(0);do{z=z+1|0;B=(z|0)<(a|0);}while((c[e+(z<<2)>>2]|0)!=0&B);if(B){u=z}else{break}}if(n){C=0}else{r=m;lf(r);s=k;lf(s);i=g;return}do{c[b+(C<<2)>>2]=c[k+(C+j<<2)>>2];C=C+1|0;}while((C|0)<(a|0));r=m;lf(r);s=k;lf(s);i=g;return}}while(0);jf(f,a,-1);r=m;lf(r);s=k;lf(s);i=g;return}function tg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;if((b|a|c|0)<0){d=-1;return d|0}d=(a<<1)+c+(((b<<4)+16|0)>>>2)+(((c*24|0)+24|0)>>>2)+((a|0)/5|0)|0;return d|0}function ug(a){a=a|0;if((a|0)==0){return}Gq(a|0,0,160)|0;h[a>>3]=.5;h[a+8>>3]=.5;return}function vg(a,b,d,e,f,g,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0.0,Q=0.0,R=0.0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0,db=0,eb=0,fb=0,gb=0,hb=0,ib=0,jb=0;k=i;i=i+160|0;l=k|0;if((j|0)==0){m=0;i=k;return m|0}n=j+12|0;o=j+16|0;Gq(j|0,0,80)|0;c[o>>2]=-1;p=j+20|0;c[p>>2]=-1;if((e|0)==0){c[n>>2]=-1;m=0;i=k;return m|0}if((f|0)==0){c[n>>2]=-2;m=0;i=k;return m|0}if((a|0)<0){c[n>>2]=-3;c[o>>2]=a;m=0;i=k;return m|0}if((b|0)<0){c[n>>2]=-4;c[o>>2]=b;m=0;i=k;return m|0}q=f+(b<<2)|0;r=c[q>>2]|0;if((r|0)<0){c[n>>2]=-5;c[o>>2]=r;m=0;i=k;return m|0}if((c[f>>2]|0)!=0){c[n>>2]=-6;c[o>>2]=c[f>>2];m=0;i=k;return m|0}if((g|0)==0){s=l|0;Gq(l|0,0,160)|0;h[s>>3]=.5;h[l+8>>3]=.5;t=s}else{t=g}g=((b*24|0)+24|0)>>>2;s=((a<<4)+16|0)>>>2;l=r<<1;r=s+b+g+l|0;if((r|0)>(d|0)){c[n>>2]=-7;c[o>>2]=r;c[p>>2]=d;m=0;i=k;return m|0}r=d-s|0;s=r-g|0;g=e+(s<<2)|0;d=g;u=e+(r<<2)|0;v=u;w=(b|0)>0;a:do{if(w){x=0;y=0;while(1){c[d+(x*24|0)>>2]=y;z=x+1|0;A=f+(z<<2)|0;B=(c[A>>2]|0)-(c[f+(x<<2)>>2]|0)|0;C=d+(x*24|0)+4|0;c[C>>2]=B;if((B|0)<0){break}c[d+(x*24|0)+8>>2]=1;c[d+(x*24|0)+12>>2]=0;c[d+(x*24|0)+16>>2]=-1;c[d+(x*24|0)+20>>2]=-1;if((z|0)>=(b|0)){break a}x=z;y=c[A>>2]|0}c[n>>2]=-8;c[o>>2]=x;c[p>>2]=c[C>>2];m=0;i=k;return m|0}}while(0);C=j+24|0;c[C>>2]=0;y=(a|0)>0;if(y){A=0;do{c[v+(A<<4)+4>>2]=0;c[v+(A<<4)+12>>2]=-1;A=A+1|0;}while((A|0)<(a|0))}b:do{if(w){A=0;c:while(1){z=c[f+(A<<2)>>2]|0;B=A+1|0;D=c[f+(B<<2)>>2]|0;E=e+(D<<2)|0;if((z|0)<(D|0)){D=d+(A*24|0)+4|0;F=e+(z<<2)|0;z=-1;while(1){G=F+4|0;H=c[F>>2]|0;if(!((H|0)>-1&(H|0)<(a|0))){break c}I=v+(H<<4)+12|0;if((H|0)>(z|0)){J=c[I>>2]|0;if((J|0)==(A|0)){K=33}else{L=J}}else{K=33}if((K|0)==33){K=0;c[n>>2]=1;c[o>>2]=A;c[p>>2]=H;c[C>>2]=(c[C>>2]|0)+1;L=c[I>>2]|0}if((L|0)==(A|0)){c[D>>2]=(c[D>>2]|0)-1}else{J=v+(H<<4)+4|0;c[J>>2]=(c[J>>2]|0)+1}c[I>>2]=A;if(G>>>0<E>>>0){F=G;z=H}else{break}}}if((B|0)<(b|0)){A=B}else{break b}}c[n>>2]=-9;c[o>>2]=A;c[p>>2]=H;c[C>>2]=a;m=0;i=k;return m|0}}while(0);C=c[q>>2]|0;c[u>>2]=C;c[e+(r+2<<2)>>2]=C;c[e+(r+3<<2)>>2]=-1;if((a|0)>1){r=1;u=C;do{u=(c[v+(r-1<<4)+4>>2]|0)+u|0;c[v+(r<<4)>>2]=u;c[v+(r<<4)+8>>2]=u;c[v+(r<<4)+12>>2]=-1;r=r+1|0;}while((r|0)<(a|0))}do{if((c[n>>2]|0)==1){if(w){M=0}else{break}while(1){r=c[f+(M<<2)>>2]|0;u=M+1|0;C=c[f+(u<<2)>>2]|0;q=e+(C<<2)|0;if((r|0)<(C|0)){C=e+(r<<2)|0;while(1){r=C+4|0;H=c[C>>2]|0;p=v+(H<<4)+12|0;if((c[p>>2]|0)!=(M|0)){o=v+(H<<4)+8|0;H=c[o>>2]|0;c[o>>2]=H+1;c[e+(H<<2)>>2]=M;c[p>>2]=M}if(r>>>0<q>>>0){C=r}else{break}}}if((u|0)<(b|0)){M=u}else{break}}}else{if(w){N=0}else{break}while(1){A=c[f+(N<<2)>>2]|0;C=N+1|0;q=c[f+(C<<2)>>2]|0;B=e+(q<<2)|0;if((A|0)<(q|0)){q=e+(A<<2)|0;while(1){A=q+4|0;r=v+(c[q>>2]<<4)+8|0;p=c[r>>2]|0;c[r>>2]=p+1;c[e+(p<<2)>>2]=N;if(A>>>0<B>>>0){q=A}else{break}}}if((C|0)<(b|0)){N=C}else{break}}}}while(0);if(y){N=0;do{c[v+(N<<4)+12>>2]=0;c[v+(N<<4)+8>>2]=c[v+(N<<4)+4>>2];N=N+1|0;}while((N|0)<(a|0))}do{if((c[n>>2]|0)==1){c[g>>2]=0;c[f>>2]=0;if((b|0)>1){N=1;do{M=N-1|0;q=(c[d+(M*24|0)+4>>2]|0)+(c[d+(M*24|0)>>2]|0)|0;c[d+(N*24|0)>>2]=q;c[f+(N<<2)>>2]=q;N=N+1|0;}while((N|0)<(b|0))}if(y){O=0}else{break}do{N=c[v+(O<<4)>>2]|0;q=(c[v+(O<<4)+4>>2]|0)+N|0;M=e+(q<<2)|0;if((N|0)<(q|0)){q=e+(N<<2)|0;while(1){N=q+4|0;B=f+(c[q>>2]<<2)|0;u=c[B>>2]|0;c[B>>2]=u+1;c[e+(u<<2)>>2]=O;if(N>>>0<M>>>0){q=N}else{break}}}O=O+1|0;}while((O|0)<(a|0))}}while(0);O=f;P=+(b|0);Q=P*+h[t>>3];R=Q<P?Q:P;g=R<0.0?0:~~R;R=+(a|0);P=R*+h[t+8>>3];Q=P<R?P:R;t=Q<0.0?0:~~Q;n=b-1|0;if(w){q=b;M=n;while(1){if((c[d+(M*24|0)+4>>2]|0)==0){C=q-1|0;c[d+(M*24|0)+12>>2]=C;c[d+(M*24|0)>>2]=-1;S=C}else{S=q}if((M|0)>0){q=S;M=M-1|0}else{T=S;U=n;break}}while(1){S=d+(U*24|0)|0;M=c[S>>2]|0;do{if((M|0)<0){V=T}else{q=c[d+(U*24|0)+4>>2]|0;if((q|0)<=(t|0)){V=T;break}C=T-1|0;c[d+(U*24|0)+12>>2]=C;N=q+M|0;q=e+(N<<2)|0;if((M|0)<(N|0)){N=e+(M<<2)|0;while(1){u=N+4|0;B=v+(c[N>>2]<<4)+8|0;c[B>>2]=(c[B>>2]|0)-1;if(u>>>0<q>>>0){N=u}else{break}}}c[S>>2]=-1;V=C}}while(0);if((U|0)>0){T=V;U=U-1|0}else{W=V;break}}}else{W=b}if(y){V=a;U=0;T=0;while(1){t=c[v+(U<<4)+8>>2]|0;if((t|0)>(g|0)|(t|0)==0){c[v+(U<<4)+12>>2]=-1;X=T;Y=V-1|0}else{X=(T|0)>(t|0)?T:t;Y=V}t=U+1|0;if((t|0)<(a|0)){V=Y;U=t;T=X}else{Z=Y;_=X;break}}}else{Z=a;_=0}do{if(w){X=W;Y=n;while(1){T=d+(Y*24|0)|0;U=c[T>>2]|0;do{if((U|0)<0){$=X}else{V=e+(U<<2)|0;g=d+(Y*24|0)+4|0;t=e+((c[g>>2]|0)+U<<2)|0;S=V;M=0;N=V;d:while(1){V=S;while(1){if(!(V>>>0<t>>>0)){break d}aa=V+4|0;ba=c[V>>2]|0;if((c[v+(ba<<4)+12>>2]|0)<0){V=aa}else{break}}c[N>>2]=ba;V=M-1+(c[v+(ba<<4)+8>>2]|0)|0;S=aa;M=(V|0)<(b|0)?V:b;N=N+4|0}S=N-(e+(c[T>>2]<<2))>>2;if((S|0)==0){t=X-1|0;c[d+(Y*24|0)+12>>2]=t;c[T>>2]=-1;$=t;break}else{c[g>>2]=S;c[d+(Y*24|0)+12>>2]=M;$=X;break}}}while(0);if((Y|0)>0){X=$;Y=Y-1|0}else{break}}Gq(O|0,-1|0,(b<<2)+4|0)|0;if(w){ca=n}else{da=$;break}while(1){if((c[d+(ca*24|0)>>2]|0)>-1){Y=f+(c[d+(ca*24|0)+12>>2]<<2)|0;X=c[Y>>2]|0;c[d+(ca*24|0)+16>>2]=-1;c[d+(ca*24|0)+20>>2]=X;if(!((X|0)==-1)){c[d+(X*24|0)+16>>2]=ca}c[Y>>2]=ca}if((ca|0)>0){ca=ca-1|0}else{da=$;break}}}else{Gq(O|0,-1|0,(b<<2)+4|0)|0;da=W}}while(0);W=2147483647-b|0;if(y){O=0;do{$=v+(O<<4)+12|0;if((c[$>>2]|0)>-1){c[$>>2]=0}O=O+1|0;}while((O|0)<(a|0))}if((da|0)>0){O=y^1;$=b+1|0;ca=e;n=1;aa=0;ba=0;Y=l;l=_;_=0;while(1){X=aa;while(1){ea=f+(X<<2)|0;fa=c[ea>>2]|0;if((fa|0)==-1&(X|0)<(b|0)){X=X+1|0}else{break}}T=c[d+(fa*24|0)+20>>2]|0;c[ea>>2]=T;if(!((T|0)==-1)){c[d+(T*24|0)+16>>2]=-1}T=d+(fa*24|0)+12|0;U=c[T>>2]|0;c[T>>2]=ba;T=d+(fa*24|0)+8|0;C=c[T>>2]|0;S=C+ba|0;t=b-S|0;do{if((((U|0)<(t|0)?U:t)+Y|0)<(s|0)){ga=_;ha=Y;ia=n}else{V=e+(Y<<2)|0;if(w){q=e;u=0;while(1){B=d+(u*24|0)|0;A=c[B>>2]|0;if((A|0)>-1){p=q-ca>>2;c[B>>2]=p;r=d+(u*24|0)+4|0;H=c[r>>2]|0;if((H|0)>0){o=e+(A<<2)|0;A=q;L=0;while(1){K=c[o>>2]|0;if((c[v+(K<<4)+12>>2]|0)>-1){c[A>>2]=K;ja=A+4|0}else{ja=A}K=L+1|0;if((K|0)<(H|0)){o=o+4|0;A=ja;L=K}else{break}}ka=ja;la=c[B>>2]|0}else{ka=q;la=p}c[r>>2]=ka-(e+(la<<2))>>2;ma=ka}else{ma=q}L=u+1|0;if((L|0)<(b|0)){q=ma;u=L}else{na=ma;break}}}else{na=e}if(y){u=0;while(1){q=v+(u<<4)+12|0;do{if((c[q>>2]|0)>-1){if((c[v+(u<<4)+4>>2]|0)==0){c[q>>2]=-1;break}else{L=e+(c[v+(u<<4)>>2]<<2)|0;c[q>>2]=c[L>>2];c[L>>2]=~u;break}}}while(0);q=u+1|0;if((q|0)<(a|0)){u=q}else{oa=na;pa=na;break}}}else{oa=na;pa=na}e:while(1){u=pa;while(1){if(!(u>>>0<V>>>0)){break e}qa=c[u>>2]|0;if((qa|0)<0){break}else{u=u+4|0}}q=~qa;c[u>>2]=c[v+(q<<4)+12>>2];r=oa-ca>>2;p=v+(q<<4)|0;c[p>>2]=r;B=v+(q<<4)+4|0;q=c[B>>2]|0;if((q|0)>0){L=u;A=oa;o=0;while(1){H=c[L>>2]|0;if((c[d+(H*24|0)>>2]|0)>-1){c[A>>2]=H;ra=A+4|0}else{ra=A}H=o+1|0;if((H|0)<(q|0)){L=L+4|0;A=ra;o=H}else{break}}sa=u+(q<<2)|0;ta=ra;ua=c[p>>2]|0}else{sa=u;ta=oa;ua=r}c[B>>2]=ta-(e+(ua<<2))>>2;oa=ta;pa=sa}V=oa-ca>>2;o=_+1|0;if(y){va=0}else{ga=o;ha=V;ia=1;break}while(1){A=v+(va<<4)+12|0;if((c[A>>2]|0)>-1){c[A>>2]=0}A=va+1|0;if((A|0)<(a|0)){va=A}else{ga=o;ha=V;ia=1;break}}}}while(0);c[T>>2]=-C;t=d+(fa*24|0)|0;U=c[t>>2]|0;V=d+(fa*24|0)+4|0;o=e+((c[V>>2]|0)+U<<2)|0;A=ha;L=e+(U<<2)|0;U=0;f:while(1){H=L;while(1){if(!(H>>>0<o>>>0)){break f}wa=H+4|0;M=c[H>>2]|0;if((c[v+(M<<4)+12>>2]|0)<0){H=wa;continue}xa=c[v+(M<<4)>>2]|0;g=(c[v+(M<<4)+4>>2]|0)+xa|0;ya=e+(g<<2)|0;if((xa|0)<(g|0)){break}else{H=wa}}H=U;g=e+(xa<<2)|0;M=A;while(1){N=g;while(1){za=N+4|0;Aa=c[N>>2]|0;Ba=d+(Aa*24|0)+8|0;Ca=c[Ba>>2]|0;if((Ca|0)>0){if((c[d+(Aa*24|0)>>2]|0)>-1){break}}if(za>>>0<ya>>>0){N=za}else{A=M;L=wa;U=H;continue f}}c[Ba>>2]=-Ca;N=M+1|0;c[e+(M<<2)>>2]=Aa;B=Ca+H|0;if(za>>>0<ya>>>0){H=B;g=za;M=N}else{A=N;L=wa;U=B;continue f}}}c[T>>2]=C;L=(l|0)>(U|0)?l:U;o=c[t>>2]|0;M=(c[V>>2]|0)+o|0;g=e+(M<<2)|0;if((o|0)<(M|0)){M=e+(o<<2)|0;while(1){o=M+4|0;c[v+(c[M>>2]<<4)+12>>2]=-1;if(o>>>0<g>>>0){M=o}else{break}}}if((A-ha|0)>0){Da=c[e+(c[t>>2]<<2)>>2]|0}else{Da=-1}M=e+(ha<<2)|0;g=e+(A<<2)|0;if((ha|0)<(A|0)){V=M;while(1){C=V+4|0;T=c[V>>2]|0;o=d+(T*24|0)+8|0;H=c[o>>2]|0;c[o>>2]=-H;o=c[d+(T*24|0)+16>>2]|0;B=c[d+(T*24|0)+20>>2]|0;if((o|0)==-1){c[f+(c[d+(T*24|0)+12>>2]<<2)>>2]=B}else{c[d+(o*24|0)+20>>2]=B}if(!((B|0)==-1)){c[d+(B*24|0)+16>>2]=o}o=c[d+(T*24|0)>>2]|0;B=(c[d+(T*24|0)+4>>2]|0)+o|0;T=e+(B<<2)|0;if((o|0)<(B|0)){B=e+(o<<2)|0;while(1){o=B+4|0;N=c[B>>2]|0;r=v+(N<<4)+12|0;u=c[r>>2]|0;do{if((u|0)>=0){p=u-ia|0;if((p|0)<0){Ea=c[v+(N<<4)+8>>2]|0}else{Ea=p}p=Ea+H|0;if((p|0)==0){c[r>>2]=-1;break}else{c[r>>2]=p+ia;break}}}while(0);if(o>>>0<T>>>0){B=o}else{break}}}if(C>>>0<g>>>0){V=C}else{Fa=U;Ga=M;Ha=S;break}}g:while(1){V=Ga;while(1){Ia=c[V>>2]|0;Ja=d+(Ia*24|0)|0;B=c[Ja>>2]|0;T=e+(B<<2)|0;H=d+(Ia*24|0)+4|0;r=e+((c[H>>2]|0)+B<<2)|0;B=T;N=0;u=0;p=T;h:while(1){T=B;while(1){if(!(T>>>0<r>>>0)){break h}Ka=T+4|0;La=c[T>>2]|0;Ma=c[v+(La<<4)+12>>2]|0;if((Ma|0)<0){T=Ka}else{break}}c[p>>2]=La;T=Ma-ia+u|0;B=Ka;N=La+N|0;u=(T|0)<(b|0)?T:b;p=p+4|0}Na=V+4|0;B=p-(e+(c[Ja>>2]<<2))>>2;c[H>>2]=B;if((B|0)==0){break}c[d+(Ia*24|0)+12>>2]=u;B=(N>>>0)%($>>>0)|0;r=f+(B<<2)|0;o=c[r>>2]|0;if((o|0)>-1){T=d+(o*24|0)+16|0;q=c[T>>2]|0;c[T>>2]=Ia;Oa=q}else{c[r>>2]=-2-Ia;Oa=-2-o|0}c[d+(Ia*24|0)+20>>2]=Oa;c[d+(Ia*24|0)+16>>2]=B;if(Na>>>0<g>>>0){V=Na}else{Pa=Fa;Qa=Ha;break g}}c[Ja>>2]=-1;V=c[d+(Ia*24|0)+8>>2]|0;C=Fa-V|0;c[d+(Ia*24|0)+12>>2]=Ha;B=V+Ha|0;if(Na>>>0<g>>>0){Fa=C;Ga=Na;Ha=B}else{Pa=C;Qa=B;break}}B=M;while(1){C=B+4|0;V=c[B>>2]|0;do{if((c[d+(V*24|0)>>2]|0)>=0){o=f+(c[d+(V*24|0)+16>>2]<<2)|0;r=c[o>>2]|0;q=(r|0)>-1;if(q){Ra=c[d+(r*24|0)+16>>2]|0}else{Ra=-2-r|0}i:do{if(!((Ra|0)==-1)){T=Ra;do{K=c[d+(T*24|0)+4>>2]|0;x=d+(T*24|0)+20|0;z=c[x>>2]|0;if((z|0)==-1){break i}F=d+(T*24|0)+12|0;E=d+(T*24|0)|0;D=d+(T*24|0)+8|0;j:do{if((K|0)>0){G=T;I=z;while(1){do{if((c[d+(I*24|0)+4>>2]|0)==(K|0)){J=d+(I*24|0)+12|0;if((c[J>>2]|0)!=(c[F>>2]|0)){Sa=I;break}Ta=d+(I*24|0)|0;Ua=e+(c[Ta>>2]<<2)|0;Va=e+(c[E>>2]<<2)|0;Wa=0;while(1){if((c[Va>>2]|0)!=(c[Ua>>2]|0)){Xa=Wa;break}Ya=Wa+1|0;if((Ya|0)<(K|0)){Ua=Ua+4|0;Va=Va+4|0;Wa=Ya}else{Xa=Ya;break}}if((Xa|0)!=(K|0)){Sa=I;break}Wa=d+(I*24|0)+8|0;c[D>>2]=(c[D>>2]|0)+(c[Wa>>2]|0);c[Wa>>2]=T;c[Ta>>2]=-2;c[J>>2]=-1;c[d+(G*24|0)+20>>2]=c[d+(I*24|0)+20>>2];Sa=G}else{Sa=I}}while(0);Wa=c[d+(I*24|0)+20>>2]|0;if((Wa|0)==-1){break}else{G=Sa;I=Wa}}}else{if((K|0)==0){Za=T;_a=z}else{I=z;while(1){I=c[d+(I*24|0)+20>>2]|0;if((I|0)==-1){break j}}}while(1){do{if((c[d+(_a*24|0)+4>>2]|0)==0){I=d+(_a*24|0)+12|0;if((c[I>>2]|0)!=(c[F>>2]|0)){$a=_a;break}G=d+(_a*24|0)+8|0;c[D>>2]=(c[D>>2]|0)+(c[G>>2]|0);c[G>>2]=T;c[d+(_a*24|0)>>2]=-2;c[I>>2]=-1;c[d+(Za*24|0)+20>>2]=c[d+(_a*24|0)+20>>2];$a=Za}else{$a=_a}}while(0);I=c[d+(_a*24|0)+20>>2]|0;if((I|0)==-1){break}else{Za=$a;_a=I}}}}while(0);T=c[x>>2]|0;}while(!((T|0)==-1))}}while(0);if(q){c[d+(r*24|0)+16>>2]=-1;break}else{c[o>>2]=-1;break}}}while(0);if(C>>>0<g>>>0){B=C}else{ab=Qa;bb=Pa;break}}}else{ab=S;bb=U}c[t>>2]=-1;B=ia+1+L|0;V=(B|0)<(W|0);if(V|O){cb=V?B:1}else{B=0;while(1){V=v+(B<<4)+12|0;if((c[V>>2]|0)>-1){c[V>>2]=0}V=B+1|0;if((V|0)<(a|0)){B=V}else{cb=1;break}}}B=b-ab|0;t=X;U=M;S=M;k:while(1){V=U;while(1){if(!(V>>>0<g>>>0)){break k}db=V+4|0;eb=c[V>>2]|0;fb=d+(eb*24|0)|0;if((c[fb>>2]|0)<0){V=db}else{break}}c[S>>2]=eb;V=c[fb>>2]|0;C=d+(eb*24|0)+4|0;N=c[C>>2]|0;c[C>>2]=N+1;c[e+(N+V<<2)>>2]=Da;V=d+(eb*24|0)+12|0;N=c[d+(eb*24|0)+8>>2]|0;C=B-N|0;u=(c[V>>2]|0)+bb-N|0;N=(u|0)<(C|0)?u:C;c[V>>2]=N;V=f+(N<<2)|0;C=c[V>>2]|0;c[d+(eb*24|0)+20>>2]=C;c[d+(eb*24|0)+16>>2]=-1;if(!((C|0)==-1)){c[d+(C*24|0)+16>>2]=eb}c[V>>2]=eb;t=(t|0)<(N|0)?t:N;U=db;S=S+4|0}if((bb|0)>0){c[v+(Da<<4)>>2]=ha;c[v+(Da<<4)+4>>2]=S-M>>2;c[v+(Da<<4)+8>>2]=bb;c[v+(Da<<4)+12>>2]=0}if((ab|0)<(da|0)){n=cb;aa=t;ba=ab;Y=A;l=L;_=ga}else{gb=ga;break}}}else{gb=0}if(w){w=0;while(1){do{if(!((c[d+(w*24|0)>>2]|0)==-1)){if((c[d+(w*24|0)+12>>2]|0)==-1){hb=w}else{break}do{hb=c[d+(hb*24|0)+8>>2]|0;}while(!((c[d+(hb*24|0)>>2]|0)==-1));ga=d+(hb*24|0)+12|0;_=c[ga>>2]|0;l=w;while(1){ib=_+1|0;c[d+(l*24|0)+12>>2]=_;c[d+(l*24|0)+8>>2]=hb;if((c[ga>>2]|0)==-1){_=ib;l=hb}else{break}}c[ga>>2]=ib}}while(0);L=w+1|0;if((L|0)<(b|0)){w=L}else{jb=0;break}}do{c[f+(c[d+(jb*24|0)+12>>2]<<2)>>2]=jb;jb=jb+1|0;}while((jb|0)<(b|0))}c[j>>2]=a-Z;c[j+4>>2]=b-da;c[j+8>>2]=gb;m=1;i=k;return m|0}function wg(b,c){b=b|0;c=c|0;var d=0,e=0,f=0;d=a[b]|0;b=d&255;e=a[c]|0;c=e&255;if(d<<24>>24==e<<24>>24){f=1;return f|0}f=(((d-97&255)>>>0<26>>>0?b-32|0:b)|0)==(((e-97&255)>>>0<26>>>0?c-32|0:c)|0)|0;return f|0}function xg(a,b,d,e,f,j,k,l){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0,G=0,H=0,I=0,J=0,K=0.0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0.0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0.0,Z=0.0,_=0,$=0,aa=0,ba=0.0,ca=0,da=0,ea=0,ga=0,ha=0.0,ia=0.0,ja=0,ka=0,la=0.0,ma=0,na=0.0,oa=0;m=i;i=i+288|0;n=m|0;o=m+8|0;p=m+16|0;q=m+24|0;r=m+32|0;c[n>>2]=1;c[l>>2]=0;do{if((wg(a,4008)|0)==0){if((wg(a,11472)|0)!=0){s=4;break}c[l>>2]=-1;t=-1}else{s=4}}while(0);a:do{if((s|0)==4){do{if((wg(b,8056)|0)==0){if((wg(b,5928)|0)!=0){break}if((wg(b,4024)|0)!=0){break}c[l>>2]=-2;t=-2;break a}}while(0);do{if((wg(d,11472)|0)==0){if((wg(d,8056)|0)!=0){break}c[l>>2]=-3;t=-3;break a}}while(0);u=e+12|0;v=c[u>>2]|0;if((v|0)!=(c[e+16>>2]|0)|(v|0)<0){c[l>>2]=-4;t=-4;break}w=f+12|0;x=c[w>>2]|0;if((x|0)!=(c[f+16>>2]|0)|(x|0)<0){c[l>>2]=-5;t=-5;break}x=c[l>>2]|0;if((x|0)!=0){t=x;break}x=c[e+20>>2]|0;y=c[x+8>>2]|0;z=c[f+20>>2]|0;A=c[z+4>>2]|0;B=Tf(v)|0;if((B|0)==0){v=r|0;ob(v|0,2784,(C=i,i=i+24|0,c[C>>2]=1944,c[C+8>>2]=121,c[C+16>>2]=1456,C)|0)|0;i=C;Ze(v)}v=(wg(b,8056)|0)==0;C=(wg(a,4008)|0)!=0;b:do{if(v){if(C){if((c[u>>2]|0)==0){i=m;return 0}D=c[x+4>>2]|0;if(!((D|0)>-1)){E=0.0;break}F=x+28|0;G=x+20|0;H=x+12|0;I=x+16|0;J=D;K=0.0;while(1){D=c[F>>2]|0;L=c[D+(J<<2)>>2]|0;M=c[G>>2]|0;N=c[M+(L<<2)>>2]|0;O=(c[M+(L+1<<2)>>2]|0)-N|0;c[o>>2]=O;M=J+1|0;P=D+(M<<2)|0;D=(c[P>>2]|0)-L|0;c[p>>2]=D;Q=c[(c[H>>2]|0)+(L<<2)>>2]|0;R=K+ +(fa(D<<1,O-D|0)|0);if((L|0)<(c[P>>2]|0)){P=L;O=Q;while(1){S=O+D|0;c[q>>2]=S;T=P+1|0;U=c[(c[H>>2]|0)+(T<<2)>>2]|0;if((S|0)<(U|0)){V=c[I>>2]|0;W=j+(P<<3)|0;X=S;S=D+N|0;Y=+h[W>>3];while(1){Z=Y- +h[j+(c[V+(S<<2)>>2]<<3)>>3]*+h[y+(X<<3)>>3];h[W>>3]=Z;_=X+1|0;c[q>>2]=_;$=c[(c[H>>2]|0)+(T<<2)>>2]|0;if((_|0)<($|0)){X=_;S=S+1|0;Y=Z}else{aa=$;break}}}else{aa=U}if((T|0)<(c[(c[F>>2]|0)+(M<<2)>>2]|0)){P=T;O=aa}else{break}}}if((D|0)>1){Y=R+ +(fa(D-1|0,D)|0);Fg(4008,5928,11472,p,y+(Q<<3)|0,o,j+(L<<3)|0,n)|0;ba=Y}else{ba=R}if((J|0)<=0){E=ba;break b}J=J-1|0;K=ba}}if((c[w>>2]|0)==0){i=m;return 0}J=x+4|0;if((c[J>>2]|0)<0){E=0.0;break}F=x+28|0;H=x+20|0;I=x+12|0;G=z+12|0;O=z+8|0;P=0;K=0.0;while(1){M=c[F>>2]|0;N=c[M+(P<<2)>>2]|0;S=c[H>>2]|0;c[o>>2]=(c[S+(N+1<<2)>>2]|0)-(c[S+(N<<2)>>2]|0);S=P+1|0;X=M+(S<<2)|0;M=(c[X>>2]|0)-N|0;c[p>>2]=M;W=c[(c[I>>2]|0)+(N<<2)>>2]|0;if((N|0)<(c[X>>2]|0)){X=N;Y=K;V=c[G>>2]|0;while(1){$=X+1|0;_=c[V+(X<<2)>>2]|0;Z=Y+ +((c[V+($<<2)>>2]|0)-_<<1|0);c[q>>2]=_;ca=c[G>>2]|0;if((_|0)<(c[ca+($<<2)>>2]|0)){da=c[O>>2]|0;ea=j+(X<<3)|0;ga=_;ha=+h[ea>>3];while(1){ia=ha- +h[j+(c[da+(ga<<2)>>2]<<3)>>3]*+h[A+(ga<<3)>>3];h[ea>>3]=ia;_=ga+1|0;c[q>>2]=_;ja=c[G>>2]|0;if((_|0)<(c[ja+($<<2)>>2]|0)){ga=_;ha=ia}else{ka=ja;break}}}else{ka=ca}if(($|0)<(c[(c[F>>2]|0)+(S<<2)>>2]|0)){X=$;Y=Z;V=ka}else{la=Z;break}}}else{la=K}Y=la+ +(fa(M+1|0,M)|0);V=y+(W<<3)|0;if((M|0)==1){X=j+(N<<3)|0;h[X>>3]=+h[X>>3]/+h[V>>3]}else{Fg(11472,5928,8056,p,V,o,j+(N<<3)|0,n)|0}if((S|0)>(c[J>>2]|0)){E=Y;break}else{P=S;K=Y}}}else{if(C){if((c[u>>2]|0)==0){i=m;return 0}P=x+4|0;if((c[P>>2]|0)<0){E=0.0;break}J=x+28|0;F=x+20|0;G=x+12|0;O=x+16|0;I=0;K=0.0;while(1){H=c[J>>2]|0;V=c[H+(I<<2)>>2]|0;X=c[F>>2]|0;L=c[X+(V<<2)>>2]|0;Q=X+(V+1<<2)|0;X=(c[Q>>2]|0)-L|0;c[o>>2]=X;D=I+1|0;ga=(c[H+(D<<2)>>2]|0)-V|0;c[p>>2]=ga;H=c[(c[G>>2]|0)+(V<<2)>>2]|0;ea=X-ga|0;Y=K+ +(fa(ga-1|0,ga)|0)+ +(fa(ga<<1,ea)|0);do{if((ga|0)==1){da=L+1|0;T=c[Q>>2]|0;if((da|0)>=(T|0)){break}U=c[O>>2]|0;ja=j+(V<<3)|0;_=H;ma=da;do{_=_+1|0;da=j+(c[U+(ma<<2)>>2]<<3)|0;h[da>>3]=+h[da>>3]- +h[ja>>3]*+h[y+(_<<3)>>3];ma=ma+1|0;}while((ma|0)<(T|0))}else{T=j+(V<<3)|0;Xf(X,ga,y+(H<<3)|0,T);ma=c[o>>2]|0;_=c[p>>2]|0;Zf(ma,ma-_|0,_,y+(_+H<<3)|0,T,B);T=c[p>>2]|0;c[q>>2]=0;if((ea|0)<=0){break}_=c[O>>2]|0;ma=T+L|0;T=0;while(1){ja=B+(T<<3)|0;U=j+(c[_+(ma<<2)>>2]<<3)|0;h[U>>3]=+h[U>>3]- +h[ja>>3];h[ja>>3]=0.0;ja=T+1|0;c[q>>2]=ja;if((ja|0)<(ea|0)){ma=ma+1|0;T=ja}else{break}}}}while(0);if((D|0)>(c[P>>2]|0)){E=Y;break b}else{I=D;K=Y}}}if((c[w>>2]|0)==0){i=m;return 0}I=c[x+4>>2]|0;if(!((I|0)>-1)){E=0.0;break}P=x+28|0;O=x+20|0;G=x+12|0;F=z+12|0;J=z+8|0;ea=I;K=0.0;while(1){I=c[P>>2]|0;L=c[I+(ea<<2)>>2]|0;H=L+1|0;ga=c[O>>2]|0;X=(c[ga+(H<<2)>>2]|0)-(c[ga+(L<<2)>>2]|0)|0;c[o>>2]=X;ga=ea+1|0;V=(c[I+(ga<<2)>>2]|0)-L|0;c[p>>2]=V;Z=K+ +(fa(V+1|0,V)|0);I=y+(c[(c[G>>2]|0)+(L<<2)>>2]<<3)|0;c:do{if((V|0)==1){Q=j+(L<<3)|0;R=+h[Q>>3]/+h[I>>3];h[Q>>3]=R;S=c[(c[F>>2]|0)+(L<<2)>>2]|0;c[q>>2]=S;if((S|0)>=(c[(c[F>>2]|0)+(H<<2)>>2]|0)){na=Z;break}N=c[J>>2]|0;M=S;ha=R;while(1){S=j+(c[N+(M<<2)>>2]<<3)|0;h[S>>3]=+h[S>>3]-ha*+h[A+(M<<3)>>3];S=M+1|0;c[q>>2]=S;if((S|0)>=(c[(c[F>>2]|0)+(H<<2)>>2]|0)){na=Z;break c}M=S;ha=+h[Q>>3]}}else{Yf(X,V,I,j+(L<<3)|0);if((L|0)>=(c[(c[P>>2]|0)+(ga<<2)>>2]|0)){na=Z;break}Q=L;ha=Z;M=c[F>>2]|0;while(1){N=Q+1|0;S=c[M+(Q<<2)>>2]|0;R=ha+ +((c[M+(N<<2)>>2]|0)-S<<1|0);c[q>>2]=S;W=c[F>>2]|0;if((S|0)<(c[W+(N<<2)>>2]|0)){T=c[J>>2]|0;ma=j+(Q<<3)|0;_=S;while(1){S=j+(c[T+(_<<2)>>2]<<3)|0;h[S>>3]=+h[S>>3]- +h[ma>>3]*+h[A+(_<<3)>>3];S=_+1|0;c[q>>2]=S;ja=c[F>>2]|0;if((S|0)<(c[ja+(N<<2)>>2]|0)){_=S}else{oa=ja;break}}}else{oa=W}if((N|0)<(c[(c[P>>2]|0)+(ga<<2)>>2]|0)){Q=N;ha=R;M=oa}else{na=R;break}}}}while(0);if((ea|0)<=0){E=na;break b}ea=ea-1|0;K=na}}}while(0);A=(c[k+8>>2]|0)+44|0;g[A>>2]=E+ +g[A>>2];lf(B);i=m;return 0}}while(0);c[q>>2]=-t;sf(3472,q)|0;i=m;return 0}function yg(a,b,d,e,f,g,j,k){a=a|0;b=+b;d=d|0;e=e|0;f=f|0;g=+g;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0.0,Q=0,R=0.0,S=0,T=0.0,U=0;l=i;m=j;n=i;i=i+4|0;i=i+7&-8;o=i;i=i+256|0;p=i;i=i+256|0;q=wg(a,8056)|0;r=c[d+20>>2]|0;s=c[r+4>>2]|0;c[n>>2]=0;t=(q|0)!=0;do{if(t){u=5}else{if((wg(a,5928)|0)!=0){u=5;break}if((wg(a,4024)|0)!=0){u=5;break}c[n>>2]=1}}while(0);a:do{if((u|0)==5){q=d+12|0;v=c[q>>2]|0;do{if((v|0)>=0){w=d+16|0;x=c[w>>2]|0;if((x|0)<0){break}if((f|0)==0){c[n>>2]=5;break a}if((k|0)==0){c[n>>2]=8;break a}if((c[n>>2]|0)!=0){break a}if((v|0)==0|(x|0)==0){i=l;return 0}x=b==0.0;if(x&g==1.0){i=l;return 0}y=(wg(a,8056)|0)==0;z=c[(y?w:q)>>2]|0;if((f|0)>0){A=0}else{A=fa(1-(c[(y?q:w)>>2]|0)|0,f)|0}if((k|0)>0){B=0}else{B=fa(1-z|0,k)|0}do{if(g!=1.0){y=g==0.0;C=(z|0)>0;if((k|0)==1){if(y){if(!C){break}Gq(m|0,0,z<<3|0)|0;break}else{if(C){D=0}else{break}do{E=j+(D<<3)|0;h[E>>3]=+h[E>>3]*g;D=D+1|0;}while((D|0)<(z|0))}}else{if(y){if(C){F=0;G=B}else{break}while(1){h[j+(G<<3)>>3]=0.0;E=F+1|0;if((E|0)<(z|0)){F=E;G=G+k|0}else{break}}}else{if(C){H=0;I=B}else{break}while(1){y=j+(I<<3)|0;h[y>>3]=+h[y>>3]*g;y=H+1|0;if((y|0)<(z|0)){H=y;I=I+k|0}else{break}}}}}}while(0);if(x){i=l;return 0}if(!t){if((f|0)!=1){z=p|0;ob(z|0,2784,(J=i,i=i+24|0,c[J>>2]=13336,c[J+8>>2]=470,c[J+16>>2]=1456,J)|0)|0;i=J;Ze(z);i=l;return 0}z=c[w>>2]|0;if((z|0)<=0){i=l;return 0}C=c[r+12>>2]|0;y=r+8|0;E=0;K=B;L=c[C>>2]|0;while(1){M=E+1|0;N=c[C+(M<<2)>>2]|0;if((L|0)<(N|0)){O=c[y>>2]|0;P=0.0;Q=L;while(1){R=P+ +h[s+(Q<<3)>>3]*+h[e+(c[O+(Q<<2)>>2]<<3)>>3];S=Q+1|0;if((S|0)<(N|0)){P=R;Q=S}else{T=R;break}}}else{T=0.0}Q=j+(K<<3)|0;h[Q>>3]=T*b+ +h[Q>>3];if((M|0)<(z|0)){E=M;K=K+k|0;L=N}else{break}}i=l;return 0}if((k|0)!=1){L=o|0;ob(L|0,2784,(J=i,i=i+24|0,c[J>>2]=13336,c[J+8>>2]=454,c[J+16>>2]=1456,J)|0)|0;i=J;Ze(L);i=l;return 0}L=c[w>>2]|0;if((L|0)<=0){i=l;return 0}K=r+12|0;E=r+8|0;z=0;y=A;while(1){P=+h[e+(y<<3)>>3];do{if(P!=0.0){R=P*b;C=c[K>>2]|0;x=c[C+(z<<2)>>2]|0;Q=z+1|0;O=c[C+(Q<<2)>>2]|0;if((x|0)>=(O|0)){U=Q;break}C=c[E>>2]|0;S=x;while(1){x=j+(c[C+(S<<2)>>2]<<3)|0;h[x>>3]=+h[x>>3]+R*+h[s+(S<<3)>>3];x=S+1|0;if((x|0)<(O|0)){S=x}else{U=Q;break}}}else{U=z+1|0}}while(0);if((U|0)<(L|0)){z=U;y=y+f|0}else{break}}i=l;return 0}}while(0);c[n>>2]=3}}while(0);sf(960,n)|0;i=l;return 0}function zg(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;h=i;i=i+256|0;j=h|0;k=f<<2;l=kf(k)|0;m=l;if((l|0)==0){ob(j|0,3856,(n=i,i=i+24|0,c[n>>2]=11424,c[n+8>>2]=57,c[n+16>>2]=8040,n)|0)|0;i=n;Ze(j)}o=(f|0)>0;if(o){Gq(l|0,0,k|0)|0}p=kf(k)|0;q=p;if((p|0)==0){ob(j|0,3856,(n=i,i=i+24|0,c[n>>2]=11424,c[n+8>>2]=57,c[n+16>>2]=8040,n)|0)|0;i=n;Ze(j)}if(o){Gq(p|0,0,k|0)|0}k=e<<2;r=kf(k)|0;s=r;if((r|0)==0){ob(j|0,3856,(n=i,i=i+24|0,c[n>>2]=11424,c[n+8>>2]=57,c[n+16>>2]=8040,n)|0)|0;i=n;Ze(j)}if((e|0)>0){Gq(r|0,0,k|0)|0;k=0;while(1){j=k+1|0;c[s+(k<<2)>>2]=f;if((j|0)<(e|0)){k=j}else{break}}}if(o){t=0}else{lf(l);lf(r);lf(p);i=h;return 0}do{k=c[a+(t<<2)>>2]|0;e=b+(t<<2)|0;if((k|0)<(c[e>>2]|0)){j=k;do{k=s+(c[d+(j<<2)>>2]<<2)|0;n=c[k>>2]|0;c[k>>2]=(n|0)<(t|0)?n:t;j=j+1|0;}while((j|0)<(c[e>>2]|0))}t=t+1|0;}while((t|0)<(f|0));if(o){u=0}else{lf(l);lf(r);lf(p);i=h;return 0}do{c[q+(u<<2)>>2]=u;c[m+(u<<2)>>2]=u;c[g+(u<<2)>>2]=f;o=c[a+(u<<2)>>2]|0;t=b+(u<<2)|0;if((o|0)<(c[t>>2]|0)){e=u;j=o;while(1){o=c[s+(c[d+(j<<2)>>2]<<2)>>2]|0;do{if((o|0)<(u|0)){n=c[q+(o<<2)>>2]|0;k=c[q+(n<<2)>>2]|0;if((k|0)==(n|0)){v=n}else{n=o;w=k;while(1){c[q+(n<<2)>>2]=w;k=c[q+(w<<2)>>2]|0;x=c[q+(k<<2)>>2]|0;if((x|0)==(k|0)){v=k;break}else{n=w;w=x}}}w=m+(v<<2)|0;n=c[w>>2]|0;if((n|0)==(u|0)){y=e;break}c[g+(n<<2)>>2]=u;c[q+(e<<2)>>2]=v;c[w>>2]=u;y=v}else{y=e}}while(0);o=j+1|0;if((o|0)<(c[t>>2]|0)){e=y;j=o}else{break}}}u=u+1|0;}while((u|0)<(f|0));lf(l);lf(r);lf(p);i=h;return 0}function Ag(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;d=i;i=i+256|0;e=a+1|0;f=d|0;g=e<<2;h=kf(g)|0;j=h;if((h|0)==0){ob(f|0,3856,(k=i,i=i+24|0,c[k>>2]=11424,c[k+8>>2]=57,c[k+16>>2]=8040,k)|0)|0;i=k;Ze(f)}l=(e|0)>0;if(l){Gq(h|0,0,g|0)|0}m=kf(g)|0;n=m;if((m|0)==0){ob(f|0,3856,(k=i,i=i+24|0,c[k>>2]=11424,c[k+8>>2]=57,c[k+16>>2]=8040,k)|0)|0;i=k;Ze(f)}if(l){Gq(m|0,0,g|0)|0}o=kf(g)|0;p=o;if((o|0)==0){ob(f|0,3856,(k=i,i=i+24|0,c[k>>2]=11424,c[k+8>>2]=57,c[k+16>>2]=8040,k)|0)|0;i=k;Ze(f)}if(l){Gq(o|0,0,g|0)|0}do{if((a|0)<0){q=0;r=a}else{Gq(h|0,-1|0,(a<<2)+4|0)|0;if((a|0)>0){s=a}else{q=0;r=0;break}while(1){g=s-1|0;o=j+(c[b+(g<<2)>>2]<<2)|0;c[n+(g<<2)>>2]=c[o>>2];c[o>>2]=g;if((g|0)>0){s=g}else{q=0;r=a;break}}}}while(0);while(1){if((q|0)==(a|0)){t=21;break}else{u=r}while(1){s=c[j+(u<<2)>>2]|0;if((s|0)==-1){break}else{u=s}}c[p+(u<<2)>>2]=q;s=c[n+(u<<2)>>2]|0;g=q+1|0;if((s|0)==-1){o=u;l=g;while(1){f=c[b+(o<<2)>>2]|0;c[p+(f<<2)>>2]=l;k=c[n+(f<<2)>>2]|0;v=l+1|0;if((k|0)==-1){o=f;l=v}else{w=k;x=v;break}}}else{w=s;x=g}if((x|0)==(e|0)){t=21;break}else{q=x;r=w}}if((t|0)==21){lf(h);lf(m);i=d;return p|0}return 0}function Bg(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,i=0.0,j=0.0,k=0,l=0,m=0.0,n=0.0,o=0.0,p=0,q=0.0,r=0.0,s=0,t=0,u=0.0,v=0,w=0.0,x=0.0,y=0,z=0.0;e=c[a>>2]|0;if((e|0)<1){f=0;return f|0}g=c[d>>2]|0;if((g|0)<1){f=0;return f|0}if((e|0)==1){f=1;return f|0}if((g|0)==1){i=+h[b>>3];if(i<0.0){j=-0.0-i}else{j=i}h[25]=j;c[5858]=2;if((c[a>>2]|0)<2){f=1;return f|0}else{k=2;l=1;m=j}while(1){j=+h[b+(k-1<<3)>>3];g=j<0.0;if(g){n=-0.0-j}else{n=j}if(n>m){if(g){o=-0.0-j}else{o=j}h[25]=o;p=k;q=o}else{p=l;q=m}g=k+1|0;c[5858]=g;if((g|0)>(c[a>>2]|0)){f=p;break}else{k=g;l=p;m=q}}return f|0}else{c[5856]=1;q=+h[b>>3];if(q<0.0){r=-0.0-q}else{r=q}h[25]=r;p=(c[d>>2]|0)+1|0;c[5856]=p;c[5858]=2;if((c[a>>2]|0)<2){f=1;return f|0}else{s=1;t=p;u=r;v=2}while(1){r=+h[b+(t-1<<3)>>3];p=r<0.0;if(p){w=-0.0-r}else{w=r}if(w>u){if(p){x=-0.0-r}else{x=r}h[25]=x;y=v;z=x}else{y=s;z=u}p=t+(c[d>>2]|0)|0;c[5856]=p;l=v+1|0;c[5858]=l;if((l|0)>(c[a>>2]|0)){f=y;break}else{s=y;t=p;u=z;v=l}}return f|0}return 0}function Cg(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0.0,g=0,i=0,j=0,k=0.0,l=0,m=0.0,n=0.0,o=0,p=0,q=0.0,r=0.0,s=0.0,t=0,u=0.0,v=0.0,w=0.0,x=0.0,y=0.0,z=0.0,A=0.0;h[89]=0.0;e=c[a>>2]|0;if((e|0)<1){f=0.0;return+f}g=c[d>>2]|0;if((g|0)<1){f=0.0;return+f}if((g|0)!=1){i=fa(g,e)|0;c[6006]=i;c[6010]=1;g=c[d>>2]|0;if((g|0)<0?(i|0)<2:(i|0)>0){j=1;k=0.0;l=g}else{f=0.0;return+f}while(1){m=+h[b+(j-1<<3)>>3];if(m<0.0){n=-0.0-m}else{n=m}m=n+k;h[89]=m;g=j+l|0;c[6010]=g;o=c[d>>2]|0;if((o|0)<0?(g|0)>=(i|0):(g|0)<=(i|0)){j=g;k=m;l=o}else{f=m;break}}return+f}l=(e|0)%6|0;c[6008]=l;do{if((l|0)==0){p=0;q=0.0}else{c[6010]=1;if((l|0)<1){r=0.0}else{e=1;k=0.0;do{n=+h[b+(e-1<<3)>>3];if(n<0.0){s=-0.0-n}else{s=n}k=s+k;h[89]=k;e=e+1|0;}while((e|0)<=(l|0));c[6010]=e;r=k}if((c[a>>2]|0)<6){f=r}else{p=l;q=r;break}return+f}}while(0);l=p+1|0;c[6010]=l;if((l|0)>(c[a>>2]|0)){f=q;return+f}else{t=l;u=q}while(1){q=+h[b+(t-1<<3)>>3];if(q<0.0){v=-0.0-q}else{v=q}q=+h[b+(t<<3)>>3];if(q<0.0){w=-0.0-q}else{w=q}q=+h[b+(t+1<<3)>>3];if(q<0.0){x=-0.0-q}else{x=q}q=+h[b+(t+2<<3)>>3];if(q<0.0){y=-0.0-q}else{y=q}q=+h[b+(t+3<<3)>>3];if(q<0.0){z=-0.0-q}else{z=q}q=+h[b+(t+4<<3)>>3];if(q<0.0){A=-0.0-q}else{A=q}q=u+v+w+x+y+z+A;h[89]=q;l=t+6|0;c[6010]=l;if((l|0)>(c[a>>2]|0)){f=q;break}else{t=l;u=q}}return+f}function Dg(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var i=0,j=0.0,k=0,l=0,m=0,n=0,o=0.0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0.0;i=c[a>>2]|0;if((i|0)<1){return 0}j=+h[b>>3];if(j==0.0){return 0}do{if((c[e>>2]|0)==1){if((c[g>>2]|0)!=1){break}k=(i|0)%4|0;c[5998]=k;do{if((k|0)==0){l=0}else{c[6004]=1;if((k|0)>=1){m=0;n=1;o=j;while(1){p=f+(m<<3)|0;h[p>>3]=+h[p>>3]+o*+h[d+(m<<3)>>3];q=n+1|0;if((q|0)>(k|0)){break}m=n;n=q;o=+h[b>>3]}c[6004]=q}if((c[a>>2]|0)>=4){l=k;break}return 0}}while(0);k=l+1|0;c[6004]=k;if((k|0)>(c[a>>2]|0)){return 0}else{r=k}do{k=r-1|0;n=f+(k<<3)|0;h[n>>3]=+h[n>>3]+ +h[b>>3]*+h[d+(k<<3)>>3];k=f+(r<<3)|0;h[k>>3]=+h[k>>3]+ +h[b>>3]*+h[d+(r<<3)>>3];k=r+1|0;n=f+(k<<3)|0;h[n>>3]=+h[n>>3]+ +h[b>>3]*+h[d+(k<<3)>>3];k=r+2|0;n=f+(k<<3)|0;h[n>>3]=+h[n>>3]+ +h[b>>3]*+h[d+(k<<3)>>3];r=r+4|0;c[6004]=r;}while((r|0)<=(c[a>>2]|0));return 0}}while(0);c[6002]=1;c[6e3]=1;r=c[e>>2]|0;if((r|0)<0){l=(fa(1-(c[a>>2]|0)|0,r)|0)+1|0;c[6002]=l;s=l}else{s=1}l=c[g>>2]|0;if((l|0)<0){r=(fa(1-(c[a>>2]|0)|0,l)|0)+1|0;c[6e3]=r;t=r}else{t=1}c[6004]=1;if((c[a>>2]|0)<1){return 0}else{u=s;v=t;w=2;x=j}while(1){t=f+(v-1<<3)|0;h[t>>3]=x*+h[d+(u-1<<3)>>3]+ +h[t>>3];t=u+(c[e>>2]|0)|0;c[6002]=t;s=v+(c[g>>2]|0)|0;c[6e3]=s;c[6004]=w;if((w|0)>(c[a>>2]|0)){break}u=t;v=s;w=w+1|0;x=+h[b>>3]}return 0}function Eg(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;g=c[a>>2]|0;if((g|0)<1){return 0}do{if((c[d>>2]|0)==1){if((c[f>>2]|0)!=1){break}i=(g|0)%7|0;c[5988]=i;do{if((i|0)==0){j=0}else{c[5994]=1;if((i|0)>=1){k=1;do{l=k-1|0;h[e+(l<<3)>>3]=+h[b+(l<<3)>>3];k=k+1|0;}while((k|0)<=(i|0));c[5994]=k}if((c[a>>2]|0)>=7){j=i;break}return 0}}while(0);i=j+1|0;c[5994]=i;if((i|0)>(c[a>>2]|0)){return 0}else{m=i}do{i=m-1|0;h[e+(i<<3)>>3]=+h[b+(i<<3)>>3];h[e+(m<<3)>>3]=+h[b+(m<<3)>>3];i=m+1|0;h[e+(i<<3)>>3]=+h[b+(i<<3)>>3];i=m+2|0;h[e+(i<<3)>>3]=+h[b+(i<<3)>>3];i=m+3|0;h[e+(i<<3)>>3]=+h[b+(i<<3)>>3];i=m+4|0;h[e+(i<<3)>>3]=+h[b+(i<<3)>>3];i=m+5|0;h[e+(i<<3)>>3]=+h[b+(i<<3)>>3];m=m+7|0;c[5994]=m;}while((m|0)<=(c[a>>2]|0));return 0}}while(0);c[5992]=1;c[5990]=1;m=c[d>>2]|0;if((m|0)<0){j=(fa(1-(c[a>>2]|0)|0,m)|0)+1|0;c[5992]=j;n=j}else{n=1}j=c[f>>2]|0;if((j|0)<0){m=(fa(1-(c[a>>2]|0)|0,j)|0)+1|0;c[5990]=m;o=m}else{o=1}c[5994]=1;if((c[a>>2]|0)<1){return 0}else{p=n;q=o;r=1}do{h[e+(q-1<<3)>>3]=+h[b+(p-1<<3)>>3];p=p+(c[d>>2]|0)|0;c[5992]=p;q=q+(c[f>>2]|0)|0;c[5990]=q;r=r+1|0;c[5994]=r;}while((r|0)<=(c[a>>2]|0));return 0}function Fg(a,b,d,e,f,g,i,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;i=i|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0.0,s=0.0,t=0,u=0.0,v=0,w=0.0,x=0.0,y=0,z=0,A=0,B=0.0,C=0,D=0,E=0,F=0,G=0.0,H=0,I=0.0,J=0.0,K=0,L=0,M=0.0,N=0,O=0.0,P=0,Q=0.0,R=0,S=0,T=0,U=0.0,V=0,W=0,X=0.0,Y=0,Z=0,_=0,$=0.0,aa=0,ba=0,ca=0.0,da=0,ea=0,ga=0.0,ha=0,ia=0,ja=0,ka=0.0,la=0,ma=0,na=0.0,oa=0;c[5886]=0;do{if((wg(a,3744)|0)==0){if((wg(a,11192)|0)!=0){k=4;break}c[5886]=1}else{k=4}}while(0);a:do{if((k|0)==4){do{if((wg(b,7896)|0)==0){if((wg(b,5840)|0)!=0){break}if((wg(b,4016)|0)!=0){break}c[5886]=2;break a}}while(0);do{if((wg(d,3744)|0)==0){if((wg(d,7896)|0)!=0){break}c[5886]=3;break a}}while(0);l=c[e>>2]|0;if((l|0)<0){c[5886]=4;break}if((c[g>>2]|0)<(((l|0)>1?l:1)|0)){c[5886]=6;break}if((c[j>>2]|0)==0){c[5886]=8;break}if((c[5886]|0)!=0){break}if((l|0)==0){return 0}c[5876]=wg(d,7896)|0;l=c[j>>2]|0;do{if((l|0)<1){c[5878]=1-(fa((c[e>>2]|0)-1|0,l)|0)}else{if((l|0)==1){break}c[5878]=1}}while(0);l=(wg(b,7896)|0)==0;m=(wg(a,3744)|0)!=0;n=c[j>>2]|0;o=(n|0)==1;if(l){if(m){if(o){c[5882]=1;if((c[e>>2]|0)<1){return 0}else{p=1}do{l=p-1|0;q=i+(l<<3)|0;r=+h[q>>3];h[26]=r;c[5888]=1;if((l|0)<1){s=r}else{t=1;u=r;while(1){v=t-1|0;r=+h[f+((fa(c[g>>2]|0,l)|0)+v<<3)>>3];w=u-r*+h[i+(v<<3)>>3];h[26]=w;v=t+1|0;c[5888]=v;if((v|0)>(l|0)){s=w;break}else{t=v;u=w}}}if((c[5876]|0)==0){x=s}else{u=s/+h[f+((fa(c[g>>2]|0,l)|0)+l<<3)>>3];h[26]=u;x=u}h[q>>3]=x;p=p+1|0;c[5882]=p;}while((p|0)<=(c[e>>2]|0));return 0}else{t=c[5878]|0;c[5880]=t;c[5882]=1;if((c[e>>2]|0)<1){return 0}else{y=t;z=1}do{v=i+(y-1<<3)|0;u=+h[v>>3];h[26]=u;c[5884]=t;c[5888]=1;A=z-1|0;if((A|0)<1){B=u}else{C=1;D=t;w=u;while(1){u=+h[f+(C-1+(fa(c[g>>2]|0,A)|0)<<3)>>3];r=w-u*+h[i+(D-1<<3)>>3];h[26]=r;E=D+(c[j>>2]|0)|0;c[5884]=E;F=C+1|0;c[5888]=F;if((F|0)>(A|0)){B=r;break}else{C=F;D=E;w=r}}}if((c[5876]|0)==0){G=B}else{w=B/+h[f+((fa(c[g>>2]|0,A)|0)+A<<3)>>3];h[26]=w;G=w}h[v>>3]=G;y=y+(c[j>>2]|0)|0;c[5880]=y;z=z+1|0;c[5882]=z;}while((z|0)<=(c[e>>2]|0));return 0}}else{t=c[e>>2]|0;if(o){c[5882]=t;if((t|0)>0){H=t}else{return 0}while(1){D=H-1|0;C=i+(D<<3)|0;w=+h[C>>3];h[26]=w;q=c[e>>2]|0;c[5888]=q;l=H+1|0;if((q|0)<(l|0)){I=w}else{E=q;r=w;while(1){q=E-1|0;w=+h[f+((fa(c[g>>2]|0,D)|0)+q<<3)>>3];u=r-w*+h[i+(q<<3)>>3];h[26]=u;c[5888]=q;if((q|0)<(l|0)){I=u;break}else{E=q;r=u}}}if((c[5876]|0)==0){J=I}else{r=I/+h[f+((fa(c[g>>2]|0,D)|0)+D<<3)>>3];h[26]=r;J=r}h[C>>3]=J;c[5882]=D;if((D|0)>0){H=D}else{break}}return 0}else{E=fa(t-1|0,n)|0;l=(c[5878]|0)+E|0;c[5878]=l;c[5880]=l;E=c[e>>2]|0;c[5882]=E;if((E|0)>0){K=l;L=E}else{return 0}do{E=i+(K-1<<3)|0;r=+h[E>>3];h[26]=r;c[5884]=l;v=c[e>>2]|0;c[5888]=v;A=L+1|0;if((v|0)<(A|0)){M=r}else{q=v;v=l;u=r;while(1){F=q-1|0;r=+h[f+(F+(fa(c[g>>2]|0,L-1|0)|0)<<3)>>3];w=u-r*+h[i+(v-1<<3)>>3];h[26]=w;N=v-(c[j>>2]|0)|0;c[5884]=N;c[5888]=F;if((F|0)<(A|0)){M=w;break}else{q=F;v=N;u=w}}}L=L-1|0;if((c[5876]|0)==0){O=M}else{u=M/+h[f+((fa(c[g>>2]|0,L)|0)+L<<3)>>3];h[26]=u;O=u}h[E>>3]=O;K=K-(c[j>>2]|0)|0;c[5880]=K;c[5882]=L;}while((L|0)>0);return 0}}}if(!m){if(o){c[5882]=1;if((c[e>>2]|0)<1){return 0}else{P=1}while(1){l=P-1|0;t=i+(l<<3)|0;u=+h[t>>3];b:do{if(u!=0.0){if((c[5876]|0)==0){Q=u}else{w=u/+h[f+((fa(c[g>>2]|0,l)|0)+l<<3)>>3];h[t>>3]=w;Q=w}h[26]=Q;v=P+1|0;c[5888]=v;if((v|0)>(c[e>>2]|0)){R=v;break}else{S=P;T=v;U=Q}while(1){w=U*+h[f+((fa(l,c[g>>2]|0)|0)+S<<3)>>3];q=i+(S<<3)|0;h[q>>3]=+h[q>>3]-w;q=T+1|0;c[5888]=q;if((q|0)>(c[e>>2]|0)){R=v;break b}S=T;T=q;U=+h[26]}}else{R=P+1|0}}while(0);c[5882]=R;if((R|0)>(c[e>>2]|0)){break}else{P=R}}return 0}else{m=c[5878]|0;c[5880]=m;c[5882]=1;if((c[e>>2]|0)<1){return 0}else{V=1;W=m}while(1){m=i+(W-1<<3)|0;u=+h[m>>3];c:do{if(u!=0.0){if((c[5876]|0)==0){X=u}else{l=V-1|0;w=u/+h[f+((fa(c[g>>2]|0,l)|0)+l<<3)>>3];h[m>>3]=w;X=w}h[26]=X;c[5884]=W;l=V+1|0;c[5888]=l;if((l|0)>(c[e>>2]|0)){Y=l;break}else{Z=W;_=l;$=X}while(1){t=Z+(c[j>>2]|0)|0;c[5884]=t;w=$*+h[f+(_-1+(fa(V-1|0,c[g>>2]|0)|0)<<3)>>3];E=i+(t-1<<3)|0;h[E>>3]=+h[E>>3]-w;E=_+1|0;c[5888]=E;if((E|0)>(c[e>>2]|0)){Y=l;break c}Z=t;_=E;$=+h[26]}}else{Y=V+1|0}}while(0);m=W+(c[j>>2]|0)|0;c[5880]=m;c[5882]=Y;if((Y|0)>(c[e>>2]|0)){break}else{V=Y;W=m}}return 0}}if(o){m=c[e>>2]|0;c[5882]=m;if((m|0)>0){aa=m}else{return 0}d:while(1){ba=aa-1|0;m=i+(ba<<3)|0;u=+h[m>>3];e:do{if(u!=0.0){if((c[5876]|0)==0){ca=u}else{w=u/+h[f+((fa(c[g>>2]|0,ba)|0)+ba<<3)>>3];h[m>>3]=w;ca=w}h[26]=ca;c[5888]=ba;if((ba|0)>0){da=aa;ea=ba;ga=ca}else{break d}while(1){l=da-2|0;w=ga*+h[f+((fa(ba,c[g>>2]|0)|0)+l<<3)>>3];E=i+(l<<3)|0;h[E>>3]=+h[E>>3]-w;E=ea-1|0;c[5888]=E;if((E|0)<=0){break e}da=ea;ea=E;ga=+h[26]}}}while(0);c[5882]=ba;if((ba|0)>0){aa=ba}else{k=92;break}}if((k|0)==92){return 0}c[5882]=ba;return 0}o=(fa((c[e>>2]|0)-1|0,n)|0)+(c[5878]|0)|0;c[5880]=o;m=c[e>>2]|0;c[5882]=m;if((m|0)>0){ha=m;ia=o}else{return 0}f:while(1){o=i+(ia-1<<3)|0;u=+h[o>>3];g:do{if(u!=0.0){ja=ha-1|0;if((c[5876]|0)==0){ka=u}else{w=u/+h[f+((fa(c[g>>2]|0,ja)|0)+ja<<3)>>3];h[o>>3]=w;ka=w}h[26]=ka;c[5884]=ia;c[5888]=ja;if((ja|0)>0){la=ia;ma=ja;na=ka}else{break f}while(1){m=la-(c[j>>2]|0)|0;c[5884]=m;E=ma-1|0;w=na*+h[f+(E+(fa(ja,c[g>>2]|0)|0)<<3)>>3];l=i+(m-1<<3)|0;h[l>>3]=+h[l>>3]-w;c[5888]=E;if((E|0)<=0){oa=ja;break g}la=m;ma=E;na=+h[26]}}else{oa=ha-1|0}}while(0);o=ia-(c[j>>2]|0)|0;c[5880]=o;c[5882]=oa;if((oa|0)>0){ha=oa;ia=o}else{k=92;break}}if((k|0)==92){return 0}c[5880]=ia-(c[j>>2]|0);c[5882]=ja;return 0}}while(0);sf(3296,23544)|0;return 0}function Gg(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0;b=i;i=i+32|0;d=b|0;e=b+8|0;f=b+16|0;g=b+24|0;h=c[o>>2]|0;ah(26840,h,26968);c[6958]=17260;c[6960]=17280;c[6959]=0;gi(27840,26840);c[6978]=0;c[6979]=-1;j=c[p>>2]|0;c[6686]=16992;pn(26748);Gq(26752,0,24)|0;c[6686]=17480;c[6694]=j;qn(g,26748);k=un(g,27168)|0;l=k;rn(g);c[6695]=l;c[6696]=26976;a[26788]=(Mc[c[(c[k>>2]|0)+28>>2]&255](l)|0)&1;c[6892]=17164;c[6893]=17184;gi(27572,26744);c[6911]=0;c[6912]=-1;l=c[s>>2]|0;c[6698]=16992;pn(26796);Gq(26800,0,24)|0;c[6698]=17480;c[6706]=l;qn(f,26796);k=un(f,27168)|0;g=k;rn(f);c[6707]=g;c[6708]=26984;a[26836]=(Mc[c[(c[k>>2]|0)+28>>2]&255](g)|0)&1;c[6936]=17164;c[6937]=17184;gi(27748,26792);c[6955]=0;c[6956]=-1;g=c[(c[(c[6936]|0)-12>>2]|0)+27768>>2]|0;c[6914]=17164;c[6915]=17184;gi(27660,g);c[6933]=0;c[6934]=-1;c[(c[(c[6958]|0)-12>>2]|0)+27904>>2]=27568;g=(c[(c[6936]|0)-12>>2]|0)+27748|0;c[g>>2]=c[g>>2]|8192;c[(c[(c[6936]|0)-12>>2]|0)+27816>>2]=27568;Og(26688,h,26992);c[6870]=17212;c[6872]=17232;c[6871]=0;gi(27488,26688);c[6890]=0;c[6891]=-1;c[6648]=16920;pn(26596);Gq(26600,0,24)|0;c[6648]=17408;c[6656]=j;qn(e,26596);j=un(e,27160)|0;h=j;rn(e);c[6657]=h;c[6658]=27e3;a[26636]=(Mc[c[(c[j>>2]|0)+28>>2]&255](h)|0)&1;c[6800]=17116;c[6801]=17136;gi(27204,26592);c[6819]=0;c[6820]=-1;c[6660]=16920;pn(26644);Gq(26648,0,24)|0;c[6660]=17408;c[6668]=l;qn(d,26644);l=un(d,27160)|0;h=l;rn(d);c[6669]=h;c[6670]=27008;a[26684]=(Mc[c[(c[l>>2]|0)+28>>2]&255](h)|0)&1;c[6844]=17116;c[6845]=17136;gi(27380,26640);c[6863]=0;c[6864]=-1;h=c[(c[(c[6844]|0)-12>>2]|0)+27400>>2]|0;c[6822]=17116;c[6823]=17136;gi(27292,h);c[6841]=0;c[6842]=-1;c[(c[(c[6870]|0)-12>>2]|0)+27552>>2]=27200;h=(c[(c[6844]|0)-12>>2]|0)+27380|0;c[h>>2]=c[h>>2]|8192;c[(c[(c[6844]|0)-12>>2]|0)+27448>>2]=27200;i=b;return}function Hg(a){a=a|0;Ni(27568)|0;Ni(27656)|0;Ti(27200)|0;Ti(27288)|0;return}function Ig(a){a=a|0;c[a>>2]=16920;rn(a+4|0);return}function Jg(a){a=a|0;c[a>>2]=16920;rn(a+4|0);oq(a);return}function Kg(b,d){b=b|0;d=d|0;var e=0;Mc[c[(c[b>>2]|0)+24>>2]&255](b)|0;e=un(d,27160)|0;d=e;c[b+36>>2]=d;a[b+44|0]=(Mc[c[(c[e>>2]|0)+28>>2]&255](d)|0)&1;return}function Lg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;b=i;i=i+16|0;d=b|0;e=b+8|0;f=a+36|0;g=a+40|0;h=d|0;j=d+8|0;k=d;d=a+32|0;while(1){a=c[f>>2]|0;l=Vc[c[(c[a>>2]|0)+20>>2]&31](a,c[g>>2]|0,h,j,e)|0;a=(c[e>>2]|0)-k|0;if((Ma(h|0,1,a|0,c[d>>2]|0)|0)!=(a|0)){m=-1;n=5;break}if((l|0)==2){m=-1;n=5;break}else if((l|0)!=1){n=4;break}}if((n|0)==4){m=((Ka(c[d>>2]|0)|0)!=0)<<31>>31;i=b;return m|0}else if((n|0)==5){i=b;return m|0}return 0}function Mg(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;if((a[b+44|0]|0)!=0){f=Ma(d|0,4,e|0,c[b+32>>2]|0)|0;return f|0}g=b;if((e|0)>0){h=d;i=0}else{f=0;return f|0}while(1){if((Jc[c[(c[g>>2]|0)+52>>2]&63](b,c[h>>2]|0)|0)==-1){f=i;j=6;break}d=i+1|0;if((d|0)<(e|0)){h=h+4|0;i=d}else{f=d;j=6;break}}if((j|0)==6){return f|0}return 0}function Ng(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;e=i;i=i+32|0;f=e|0;g=e+8|0;h=e+16|0;j=e+24|0;k=(d|0)==-1;a:do{if(!k){c[g>>2]=d;if((a[b+44|0]|0)!=0){if((Ma(g|0,4,1,c[b+32>>2]|0)|0)==1){break}else{l=-1}i=e;return l|0}m=f|0;c[h>>2]=m;n=g+4|0;o=b+36|0;p=b+40|0;q=f+8|0;r=f;s=b+32|0;t=g;while(1){u=c[o>>2]|0;v=Qc[c[(c[u>>2]|0)+12>>2]&31](u,c[p>>2]|0,t,n,j,m,q,h)|0;if((c[j>>2]|0)==(t|0)){l=-1;w=12;break}if((v|0)==3){w=7;break}u=(v|0)==1;if(!(v>>>0<2>>>0)){l=-1;w=12;break}v=(c[h>>2]|0)-r|0;if((Ma(m|0,1,v|0,c[s>>2]|0)|0)!=(v|0)){l=-1;w=12;break}if(u){t=u?c[j>>2]|0:t}else{break a}}if((w|0)==7){if((Ma(t|0,1,1,c[s>>2]|0)|0)==1){break}else{l=-1}i=e;return l|0}else if((w|0)==12){i=e;return l|0}}}while(0);l=k?0:d;i=e;return l|0}function Og(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;f=i;i=i+8|0;g=f|0;h=b|0;c[h>>2]=16920;j=b+4|0;pn(j);Gq(b+8|0,0,24)|0;c[h>>2]=17808;c[b+32>>2]=d;c[b+40>>2]=e;c[b+48>>2]=-1;a[b+52|0]=0;qn(g,j);j=un(g,27160)|0;e=j;d=b+36|0;c[d>>2]=e;h=b+44|0;c[h>>2]=Mc[c[(c[j>>2]|0)+24>>2]&255](e)|0;e=c[d>>2]|0;a[b+53|0]=(Mc[c[(c[e>>2]|0)+28>>2]&255](e)|0)&1;if((c[h>>2]|0)<=8){rn(g);i=f;return}Am(912);rn(g);i=f;return}function Pg(a){a=a|0;c[a>>2]=16920;rn(a+4|0);return}function Qg(a){a=a|0;c[a>>2]=16920;rn(a+4|0);oq(a);return}function Rg(b,d){b=b|0;d=d|0;var e=0,f=0,g=0;e=un(d,27160)|0;d=e;f=b+36|0;c[f>>2]=d;g=b+44|0;c[g>>2]=Mc[c[(c[e>>2]|0)+24>>2]&255](d)|0;d=c[f>>2]|0;a[b+53|0]=(Mc[c[(c[d>>2]|0)+28>>2]&255](d)|0)&1;if((c[g>>2]|0)<=8){return}Am(912);return}function Sg(a){a=a|0;return Vg(a,0)|0}function Tg(a){a=a|0;return Vg(a,1)|0}function Ug(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;e=i;i=i+32|0;f=e|0;g=e+8|0;h=e+16|0;j=e+24|0;k=b+52|0;l=(a[k]|0)!=0;if((d|0)==-1){if(l){m=-1;i=e;return m|0}n=c[b+48>>2]|0;a[k]=(n|0)!=-1|0;m=n;i=e;return m|0}n=b+48|0;a:do{if(l){c[h>>2]=c[n>>2];o=c[b+36>>2]|0;p=f|0;q=Qc[c[(c[o>>2]|0)+12>>2]&31](o,c[b+40>>2]|0,h,h+4|0,j,p,f+8|0,g)|0;if((q|0)==3){a[p]=c[n>>2];c[g>>2]=f+1}else if((q|0)==2|(q|0)==1){m=-1;i=e;return m|0}q=b+32|0;while(1){o=c[g>>2]|0;if(!(o>>>0>p>>>0)){break a}r=o-1|0;c[g>>2]=r;if((dc(a[r]|0,c[q>>2]|0)|0)==-1){m=-1;break}}i=e;return m|0}}while(0);c[n>>2]=d;a[k]=1;m=d;i=e;return m|0}function Vg(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;e=i;i=i+32|0;f=e|0;g=e+8|0;h=e+16|0;j=e+24|0;k=b+52|0;if((a[k]|0)!=0){l=b+48|0;m=c[l>>2]|0;if(!d){n=m;i=e;return n|0}c[l>>2]=-1;a[k]=0;n=m;i=e;return n|0}m=c[b+44>>2]|0;k=(m|0)>1?m:1;a:do{if((k|0)>0){m=b+32|0;l=0;while(1){o=db(c[m>>2]|0)|0;if((o|0)==-1){n=-1;break}a[f+l|0]=o;l=l+1|0;if((l|0)>=(k|0)){break a}}i=e;return n|0}}while(0);b:do{if((a[b+53|0]|0)==0){l=b+40|0;m=b+36|0;o=f|0;p=g+4|0;q=b+32|0;r=k;while(1){s=c[l>>2]|0;t=s;u=c[t>>2]|0;v=c[t+4>>2]|0;t=c[m>>2]|0;w=f+r|0;x=Qc[c[(c[t>>2]|0)+16>>2]&31](t,s,o,w,h,g,p,j)|0;if((x|0)==3){y=14;break}else if((x|0)==2){n=-1;y=22;break}else if((x|0)!=1){z=r;break b}x=c[l>>2]|0;c[x>>2]=u;c[x+4>>2]=v;if((r|0)==8){n=-1;y=22;break}v=db(c[q>>2]|0)|0;if((v|0)==-1){n=-1;y=22;break}a[w]=v;r=r+1|0}if((y|0)==14){c[g>>2]=a[o]|0;z=r;break}else if((y|0)==22){i=e;return n|0}}else{c[g>>2]=a[f|0]|0;z=k}}while(0);if(d){d=c[g>>2]|0;c[b+48>>2]=d;n=d;i=e;return n|0}d=b+32|0;b=z;while(1){if((b|0)<=0){break}z=b-1|0;if((dc(a[f+z|0]|0,c[d>>2]|0)|0)==-1){n=-1;y=22;break}else{b=z}}if((y|0)==22){i=e;return n|0}n=c[g>>2]|0;i=e;return n|0}function Wg(a){a=a|0;c[a>>2]=16992;rn(a+4|0);return}function Xg(a){a=a|0;c[a>>2]=16992;rn(a+4|0);oq(a);return}function Yg(b,d){b=b|0;d=d|0;var e=0;Mc[c[(c[b>>2]|0)+24>>2]&255](b)|0;e=un(d,27168)|0;d=e;c[b+36>>2]=d;a[b+44|0]=(Mc[c[(c[e>>2]|0)+28>>2]&255](d)|0)&1;return}function Zg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;b=i;i=i+16|0;d=b|0;e=b+8|0;f=a+36|0;g=a+40|0;h=d|0;j=d+8|0;k=d;d=a+32|0;while(1){a=c[f>>2]|0;l=Vc[c[(c[a>>2]|0)+20>>2]&31](a,c[g>>2]|0,h,j,e)|0;a=(c[e>>2]|0)-k|0;if((Ma(h|0,1,a|0,c[d>>2]|0)|0)!=(a|0)){m=-1;n=5;break}if((l|0)==2){m=-1;n=5;break}else if((l|0)!=1){n=4;break}}if((n|0)==4){m=((Ka(c[d>>2]|0)|0)!=0)<<31>>31;i=b;return m|0}else if((n|0)==5){i=b;return m|0}return 0}function _g(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0;if((a[b+44|0]|0)!=0){g=Ma(e|0,1,f|0,c[b+32>>2]|0)|0;return g|0}h=b;if((f|0)>0){i=e;j=0}else{g=0;return g|0}while(1){if((Jc[c[(c[h>>2]|0)+52>>2]&63](b,d[i]|0)|0)==-1){g=j;k=6;break}e=j+1|0;if((e|0)<(f|0)){i=i+1|0;j=e}else{g=e;k=6;break}}if((k|0)==6){return g|0}return 0}function $g(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;e=i;i=i+32|0;f=e|0;g=e+8|0;h=e+16|0;j=e+24|0;k=(d|0)==-1;a:do{if(!k){a[g]=d;if((a[b+44|0]|0)!=0){if((Ma(g|0,1,1,c[b+32>>2]|0)|0)==1){break}else{l=-1}i=e;return l|0}m=f|0;c[h>>2]=m;n=g+1|0;o=b+36|0;p=b+40|0;q=f+8|0;r=f;s=b+32|0;t=g;while(1){u=c[o>>2]|0;v=Qc[c[(c[u>>2]|0)+12>>2]&31](u,c[p>>2]|0,t,n,j,m,q,h)|0;if((c[j>>2]|0)==(t|0)){l=-1;w=12;break}if((v|0)==3){w=7;break}u=(v|0)==1;if(!(v>>>0<2>>>0)){l=-1;w=12;break}v=(c[h>>2]|0)-r|0;if((Ma(m|0,1,v|0,c[s>>2]|0)|0)!=(v|0)){l=-1;w=12;break}if(u){t=u?c[j>>2]|0:t}else{break a}}if((w|0)==7){if((Ma(t|0,1,1,c[s>>2]|0)|0)==1){break}else{l=-1}i=e;return l|0}else if((w|0)==12){i=e;return l|0}}}while(0);l=k?0:d;i=e;return l|0}function ah(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;f=i;i=i+8|0;g=f|0;h=b|0;c[h>>2]=16992;j=b+4|0;pn(j);Gq(b+8|0,0,24)|0;c[h>>2]=17880;c[b+32>>2]=d;c[b+40>>2]=e;c[b+48>>2]=-1;a[b+52|0]=0;qn(g,j);j=un(g,27168)|0;e=j;d=b+36|0;c[d>>2]=e;h=b+44|0;c[h>>2]=Mc[c[(c[j>>2]|0)+24>>2]&255](e)|0;e=c[d>>2]|0;a[b+53|0]=(Mc[c[(c[e>>2]|0)+28>>2]&255](e)|0)&1;if((c[h>>2]|0)<=8){rn(g);i=f;return}Am(912);rn(g);i=f;return}function bh(a){a=a|0;c[a>>2]=16992;rn(a+4|0);return}function ch(a){a=a|0;c[a>>2]=16992;rn(a+4|0);oq(a);return}function dh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0;e=un(d,27168)|0;d=e;f=b+36|0;c[f>>2]=d;g=b+44|0;c[g>>2]=Mc[c[(c[e>>2]|0)+24>>2]&255](d)|0;d=c[f>>2]|0;a[b+53|0]=(Mc[c[(c[d>>2]|0)+28>>2]&255](d)|0)&1;if((c[g>>2]|0)<=8){return}Am(912);return}function eh(a){a=a|0;return hh(a,0)|0}function fh(a){a=a|0;return hh(a,1)|0}function gh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;e=i;i=i+32|0;f=e|0;g=e+8|0;h=e+16|0;j=e+24|0;k=b+52|0;l=(a[k]|0)!=0;if((d|0)==-1){if(l){m=-1;i=e;return m|0}n=c[b+48>>2]|0;a[k]=(n|0)!=-1|0;m=n;i=e;return m|0}n=b+48|0;a:do{if(l){a[h]=c[n>>2];o=c[b+36>>2]|0;p=f|0;q=Qc[c[(c[o>>2]|0)+12>>2]&31](o,c[b+40>>2]|0,h,h+1|0,j,p,f+8|0,g)|0;if((q|0)==3){a[p]=c[n>>2];c[g>>2]=f+1}else if((q|0)==2|(q|0)==1){m=-1;i=e;return m|0}q=b+32|0;while(1){o=c[g>>2]|0;if(!(o>>>0>p>>>0)){break a}r=o-1|0;c[g>>2]=r;if((dc(a[r]|0,c[q>>2]|0)|0)==-1){m=-1;break}}i=e;return m|0}}while(0);c[n>>2]=d;a[k]=1;m=d;i=e;return m|0}function hh(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;f=i;i=i+32|0;g=f|0;h=f+8|0;j=f+16|0;k=f+24|0;l=b+52|0;if((a[l]|0)!=0){m=b+48|0;n=c[m>>2]|0;if(!e){o=n;i=f;return o|0}c[m>>2]=-1;a[l]=0;o=n;i=f;return o|0}n=c[b+44>>2]|0;l=(n|0)>1?n:1;a:do{if((l|0)>0){n=b+32|0;m=0;while(1){p=db(c[n>>2]|0)|0;if((p|0)==-1){o=-1;break}a[g+m|0]=p;m=m+1|0;if((m|0)>=(l|0)){break a}}i=f;return o|0}}while(0);b:do{if((a[b+53|0]|0)==0){m=b+40|0;n=b+36|0;p=g|0;q=h+1|0;r=b+32|0;s=l;while(1){t=c[m>>2]|0;u=t;v=c[u>>2]|0;w=c[u+4>>2]|0;u=c[n>>2]|0;x=g+s|0;y=Qc[c[(c[u>>2]|0)+16>>2]&31](u,t,p,x,j,h,q,k)|0;if((y|0)==3){z=14;break}else if((y|0)==2){o=-1;z=23;break}else if((y|0)!=1){A=s;break b}y=c[m>>2]|0;c[y>>2]=v;c[y+4>>2]=w;if((s|0)==8){o=-1;z=23;break}w=db(c[r>>2]|0)|0;if((w|0)==-1){o=-1;z=23;break}a[x]=w;s=s+1|0}if((z|0)==14){a[h]=a[p]|0;A=s;break}else if((z|0)==23){i=f;return o|0}}else{a[h]=a[g|0]|0;A=l}}while(0);do{if(e){l=a[h]|0;c[b+48>>2]=l&255;B=l}else{l=b+32|0;k=A;while(1){if((k|0)<=0){z=21;break}j=k-1|0;if((dc(d[g+j|0]|0,c[l>>2]|0)|0)==-1){o=-1;z=23;break}else{k=j}}if((z|0)==21){B=a[h]|0;break}else if((z|0)==23){i=f;return o|0}}}while(0);o=B&255;i=f;return o|0}function ih(){Gg(0);fb(156,27920,t|0)|0;return}function jh(a){a=a|0;return}function kh(a){a=a|0;var b=0;b=a+4|0;H=c[b>>2]|0,c[b>>2]=H+1,H;return}function lh(a){a=a|0;var b=0,d=0;b=a+4|0;if(((H=c[b>>2]|0,c[b>>2]=H+ -1,H)|0)!=0){d=0;return d|0}Hc[c[(c[a>>2]|0)+8>>2]&511](a);d=1;return d|0}function mh(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;c[a>>2]=15152;d=a+4|0;if((d|0)==0){return}a=Eq(b|0)|0;e=nq(a+13|0)|0;c[e+4>>2]=a;c[e>>2]=a;f=e+12|0;c[d>>2]=f;c[e+8>>2]=0;Fq(f|0,b|0,a+1|0)|0;return}function nh(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=15152;b=a+4|0;d=(c[b>>2]|0)-4|0;do{if(((H=c[d>>2]|0,c[d>>2]=H+ -1,H)-1|0)<0){e=(c[b>>2]|0)-12|0;if((e|0)==0){break}pq(e)}}while(0);oq(a);return}function oh(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=15152;b=a+4|0;d=(c[b>>2]|0)-4|0;if(((H=c[d>>2]|0,c[d>>2]=H+ -1,H)-1|0)>=0){e=a|0;return}d=(c[b>>2]|0)-12|0;if((d|0)==0){e=a|0;return}pq(d);e=a|0;return}function ph(a){a=a|0;return c[a+4>>2]|0}function qh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0;c[b>>2]=15088;e=b+4|0;if((e|0)==0){return}if((a[d]&1)==0){f=d+1|0}else{f=c[d+8>>2]|0}d=Eq(f|0)|0;b=nq(d+13|0)|0;c[b+4>>2]=d;c[b>>2]=d;g=b+12|0;c[e>>2]=g;c[b+8>>2]=0;Fq(g|0,f|0,d+1|0)|0;return}function rh(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;c[a>>2]=15088;d=a+4|0;if((d|0)==0){return}a=Eq(b|0)|0;e=nq(a+13|0)|0;c[e+4>>2]=a;c[e>>2]=a;f=e+12|0;c[d>>2]=f;c[e+8>>2]=0;Fq(f|0,b|0,a+1|0)|0;return}function sh(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=15088;b=a+4|0;d=(c[b>>2]|0)-4|0;do{if(((H=c[d>>2]|0,c[d>>2]=H+ -1,H)-1|0)<0){e=(c[b>>2]|0)-12|0;if((e|0)==0){break}pq(e)}}while(0);oq(a);return}function th(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=15088;b=a+4|0;d=(c[b>>2]|0)-4|0;if(((H=c[d>>2]|0,c[d>>2]=H+ -1,H)-1|0)>=0){e=a|0;return}d=(c[b>>2]|0)-12|0;if((d|0)==0){e=a|0;return}pq(d);e=a|0;return}function uh(a){a=a|0;return c[a+4>>2]|0}function vh(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=15152;b=a+4|0;d=(c[b>>2]|0)-4|0;do{if(((H=c[d>>2]|0,c[d>>2]=H+ -1,H)-1|0)<0){e=(c[b>>2]|0)-12|0;if((e|0)==0){break}pq(e)}}while(0);oq(a);return}function wh(a){a=a|0;return}function xh(a,b,d){a=a|0;b=b|0;d=d|0;c[a>>2]=d;c[a+4>>2]=b;return}function yh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;e=i;i=i+8|0;f=e|0;Nc[c[(c[a>>2]|0)+12>>2]&7](f,a,b);if((c[f+4>>2]|0)!=(c[d+4>>2]|0)){g=0;i=e;return g|0}g=(c[f>>2]|0)==(c[d>>2]|0);i=e;return g|0}function zh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;if((c[b+4>>2]|0)!=(a|0)){e=0;return e|0}e=(c[b>>2]|0)==(d|0);return e|0}function Ah(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;d=$b(e|0)|0;e=Eq(d|0)|0;if(e>>>0>4294967279>>>0){Gh(0)}if(e>>>0<11>>>0){a[b]=e<<1;f=b+1|0;Fq(f|0,d|0,e)|0;g=f+e|0;a[g]=0;return}else{h=e+16&-16;i=mq(h)|0;c[b+8>>2]=i;c[b>>2]=h|1;c[b+4>>2]=e;f=i;Fq(f|0,d|0,e)|0;g=f+e|0;a[g]=0;return}}function Bh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;f=i;i=i+16|0;g=f|0;h=d|0;j=c[h>>2]|0;k=e;do{if((j|0)!=0){l=a[k]|0;if((l&1)==0){m=(l&255)>>>1}else{m=c[e+4>>2]|0}if((m|0)==0){n=j}else{Rh(e,7648,2)|0;n=c[h>>2]|0}l=c[d+4>>2]|0;Nc[c[(c[l>>2]|0)+24>>2]&7](g,l,n);l=g;o=a[l]|0;if((o&1)==0){p=(o&255)>>>1;q=g+1|0}else{p=c[g+4>>2]|0;q=c[g+8>>2]|0}Rh(e,q,p)|0;if((a[l]&1)==0){break}oq(c[g+8>>2]|0)}}while(0);g=b;c[g>>2]=c[k>>2];c[g+4>>2]=c[k+4>>2];c[g+8>>2]=c[k+8>>2];Gq(k|0,0,12)|0;i=f;return}function Ch(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;f=i;i=i+32|0;g=d;d=i;i=i+8|0;c[d>>2]=c[g>>2];c[d+4>>2]=c[g+4>>2];g=f|0;h=f+16|0;j=Eq(e|0)|0;if(j>>>0>4294967279>>>0){Gh(0)}if(j>>>0<11>>>0){a[h]=j<<1;k=h+1|0}else{l=j+16&-16;m=mq(l)|0;c[h+8>>2]=m;c[h>>2]=l|1;c[h+4>>2]=j;k=m}Fq(k|0,e|0,j)|0;a[k+j|0]=0;Bh(g,d,h);qh(b|0,g);if(!((a[g]&1)==0)){oq(c[g+8>>2]|0)}if((a[h]&1)==0){n=b|0;c[n>>2]=17376;o=b+8|0;p=d;q=o;r=p|0;s=c[r>>2]|0;t=p+4|0;u=c[t>>2]|0;v=q|0;c[v>>2]=s;w=q+4|0;c[w>>2]=u;i=f;return}oq(c[h+8>>2]|0);n=b|0;c[n>>2]=17376;o=b+8|0;p=d;q=o;r=p|0;s=c[r>>2]|0;t=p+4|0;u=c[t>>2]|0;v=q|0;c[v>>2]=s;w=q+4|0;c[w>>2]=u;i=f;return}function Dh(a){a=a|0;th(a|0);oq(a);return}function Eh(a){a=a|0;th(a|0);return}function Fh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e;if((c[a>>2]|0)==1){do{Ya(26920,26896)|0;}while((c[a>>2]|0)==1)}if((c[a>>2]|0)!=0){f;return}c[a>>2]=1;g;Hc[d&511](b);h;c[a>>2]=-1;i;Vb(26920)|0;return}function Gh(a){a=a|0;a=vc(8)|0;mh(a,12336);c[a>>2]=15120;Jb(a|0,21328,36)}function Hh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=d;if((a[e]&1)==0){f=b;c[f>>2]=c[e>>2];c[f+4>>2]=c[e+4>>2];c[f+8>>2]=c[e+8>>2];return}e=c[d+8>>2]|0;f=c[d+4>>2]|0;if(f>>>0>4294967279>>>0){Gh(0)}if(f>>>0<11>>>0){a[b]=f<<1;g=b+1|0}else{d=f+16&-16;h=mq(d)|0;c[b+8>>2]=h;c[b>>2]=d|1;c[b+4>>2]=f;g=h}Fq(g|0,e|0,f)|0;a[g+f|0]=0;return}function Ih(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;if(e>>>0>4294967279>>>0){Gh(0)}if(e>>>0<11>>>0){a[b]=e<<1;f=b+1|0;Fq(f|0,d|0,e)|0;g=f+e|0;a[g]=0;return}else{h=e+16&-16;i=mq(h)|0;c[b+8>>2]=i;c[b>>2]=h|1;c[b+4>>2]=e;f=i;Fq(f|0,d|0,e)|0;g=f+e|0;a[g]=0;return}}function Jh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;if(d>>>0>4294967279>>>0){Gh(0)}if(d>>>0<11>>>0){a[b]=d<<1;f=b+1|0;Gq(f|0,e|0,d|0)|0;g=f+d|0;a[g]=0;return}else{h=d+16&-16;i=mq(h)|0;c[b+8>>2]=i;c[b>>2]=h|1;c[b+4>>2]=d;f=i;Gq(f|0,e|0,d|0)|0;g=f+d|0;a[g]=0;return}}function Kh(b){b=b|0;if((a[b]&1)==0){return}oq(c[b+8>>2]|0);return}function Lh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;if((b|0)==(d|0)){return b|0}e=a[d]|0;if((e&1)==0){f=(e&255)>>>1;g=d+1|0}else{f=c[d+4>>2]|0;g=c[d+8>>2]|0}d=b;e=a[d]|0;if((e&1)==0){h=10;i=e}else{e=c[b>>2]|0;h=(e&-2)-1|0;i=e&255}e=(i&1)==0;if(h>>>0<f>>>0){if(e){j=(i&255)>>>1}else{j=c[b+4>>2]|0}Sh(b,h,f-h|0,j,0,j,f,g);return b|0}if(e){k=b+1|0}else{k=c[b+8>>2]|0}Hq(k|0,g|0,f|0)|0;a[k+f|0]=0;if((a[d]&1)==0){a[d]=f<<1;return b|0}else{c[b+4>>2]=f;return b|0}return 0}function Mh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=Eq(d|0)|0;f=b;g=a[f]|0;if((g&1)==0){h=10;i=g}else{g=c[b>>2]|0;h=(g&-2)-1|0;i=g&255}g=(i&1)==0;if(h>>>0<e>>>0){if(g){j=(i&255)>>>1}else{j=c[b+4>>2]|0}Sh(b,h,e-h|0,j,0,j,e,d);return b|0}if(g){k=b+1|0}else{k=c[b+8>>2]|0}Hq(k|0,d|0,e|0)|0;a[k+e|0]=0;if((a[f]&1)==0){a[f]=e<<1;return b|0}else{c[b+4>>2]=e;return b|0}return 0}function Nh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=b;g=a[f]|0;h=(g&1)==0;if(h){i=(g&255)>>>1}else{i=c[b+4>>2]|0}if(i>>>0<d>>>0){Oh(b,d-i|0,e)|0;return}if(h){a[b+1+d|0]=0;a[f]=d<<1;return}else{a[(c[b+8>>2]|0)+d|0]=0;c[b+4>>2]=d;return}}function Oh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0;if((d|0)==0){return b|0}f=b;g=a[f]|0;if((g&1)==0){h=10;i=g}else{g=c[b>>2]|0;h=(g&-2)-1|0;i=g&255}if((i&1)==0){j=(i&255)>>>1}else{j=c[b+4>>2]|0}if((h-j|0)>>>0<d>>>0){Th(b,h,d-h+j|0,j,j,0,0);k=a[f]|0}else{k=i}if((k&1)==0){l=b+1|0}else{l=c[b+8>>2]|0}Gq(l+j|0,e|0,d|0)|0;e=j+d|0;if((a[f]&1)==0){a[f]=e<<1}else{c[b+4>>2]=e}a[l+e|0]=0;return b|0}function Ph(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;if(d>>>0>4294967279>>>0){Gh(0)}e=b;f=a[e]|0;if((f&1)==0){g=10;h=f}else{f=c[b>>2]|0;g=(f&-2)-1|0;h=f&255}if((h&1)==0){i=(h&255)>>>1}else{i=c[b+4>>2]|0}f=i>>>0>d>>>0?i:d;if(f>>>0<11>>>0){j=10}else{j=(f+16&-16)-1|0}if((j|0)==(g|0)){return}do{if((j|0)==10){k=b+1|0;l=c[b+8>>2]|0;m=1;n=0}else{f=j+1|0;if(j>>>0>g>>>0){o=mq(f)|0}else{o=mq(f)|0}if((h&1)==0){k=o;l=b+1|0;m=0;n=1;break}else{k=o;l=c[b+8>>2]|0;m=1;n=1;break}}}while(0);if((h&1)==0){p=(h&255)>>>1}else{p=c[b+4>>2]|0}Fq(k|0,l|0,p+1|0)|0;if(m){oq(l)}if(n){c[b>>2]=j+1|1;c[b+4>>2]=i;c[b+8>>2]=k;return}else{a[e]=i<<1;return}}function Qh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;e=b;f=a[e]|0;g=(f&1)!=0;if(g){h=c[b+4>>2]|0;i=(c[b>>2]&-2)-1|0}else{h=(f&255)>>>1;i=10}if((h|0)==(i|0)){Th(b,i,1,i,i,0,0);if((a[e]&1)==0){j=7}else{j=8}}else{if(g){j=8}else{j=7}}if((j|0)==7){a[e]=(h<<1)+2;k=b+1|0;l=h+1|0;m=k+h|0;a[m]=d;n=k+l|0;a[n]=0;return}else if((j|0)==8){j=c[b+8>>2]|0;e=h+1|0;c[b+4>>2]=e;k=j;l=e;m=k+h|0;a[m]=d;n=k+l|0;a[n]=0;return}}function Rh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;f=b;g=a[f]|0;if((g&1)==0){h=10;i=g}else{g=c[b>>2]|0;h=(g&-2)-1|0;i=g&255}if((i&1)==0){j=(i&255)>>>1}else{j=c[b+4>>2]|0}if((h-j|0)>>>0<e>>>0){Sh(b,h,e-h+j|0,j,j,0,e,d);return b|0}if((e|0)==0){return b|0}if((i&1)==0){k=b+1|0}else{k=c[b+8>>2]|0}Fq(k+j|0,d|0,e)|0;d=j+e|0;if((a[f]&1)==0){a[f]=d<<1}else{c[b+4>>2]=d}a[k+d|0]=0;return b|0}function Sh(b,d,e,f,g,h,i,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;if((-18-d|0)>>>0<e>>>0){Gh(0)}if((a[b]&1)==0){k=b+1|0}else{k=c[b+8>>2]|0}do{if(d>>>0<2147483623>>>0){l=e+d|0;m=d<<1;n=l>>>0<m>>>0?m:l;if(n>>>0<11>>>0){o=11;break}o=n+16&-16}else{o=-17}}while(0);e=mq(o)|0;if((g|0)!=0){Fq(e|0,k|0,g)|0}if((i|0)!=0){Fq(e+g|0,j|0,i)|0}j=f-h|0;if((j|0)!=(g|0)){Fq(e+(i+g)|0,k+(h+g)|0,j-g|0)|0}if((d|0)==10){p=b+8|0;c[p>>2]=e;q=o|1;r=b|0;c[r>>2]=q;s=j+i|0;t=b+4|0;c[t>>2]=s;u=e+s|0;a[u]=0;return}oq(k);p=b+8|0;c[p>>2]=e;q=o|1;r=b|0;c[r>>2]=q;s=j+i|0;t=b+4|0;c[t>>2]=s;u=e+s|0;a[u]=0;return}function Th(b,d,e,f,g,h,i){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;if((-17-d|0)>>>0<e>>>0){Gh(0)}if((a[b]&1)==0){j=b+1|0}else{j=c[b+8>>2]|0}do{if(d>>>0<2147483623>>>0){k=e+d|0;l=d<<1;m=k>>>0<l>>>0?l:k;if(m>>>0<11>>>0){n=11;break}n=m+16&-16}else{n=-17}}while(0);e=mq(n)|0;if((g|0)!=0){Fq(e|0,j|0,g)|0}m=f-h|0;if((m|0)!=(g|0)){Fq(e+(i+g)|0,j+(h+g)|0,m-g|0)|0}if((d|0)==10){o=b+8|0;c[o>>2]=e;p=n|1;q=b|0;c[q>>2]=p;return}oq(j);o=b+8|0;c[o>>2]=e;p=n|1;q=b|0;c[q>>2]=p;return}function Uh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;if(e>>>0>1073741807>>>0){Gh(0)}if(e>>>0<2>>>0){a[b]=e<<1;f=b+4|0;g=Ip(f,d,e)|0;h=f+(e<<2)|0;c[h>>2]=0;return}else{i=e+4&-4;j=mq(i<<2)|0;c[b+8>>2]=j;c[b>>2]=i|1;c[b+4>>2]=e;f=j;g=Ip(f,d,e)|0;h=f+(e<<2)|0;c[h>>2]=0;return}}function Vh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;if(d>>>0>1073741807>>>0){Gh(0)}if(d>>>0<2>>>0){a[b]=d<<1;f=b+4|0;g=Kp(f,e,d)|0;h=f+(d<<2)|0;c[h>>2]=0;return}else{i=d+4&-4;j=mq(i<<2)|0;c[b+8>>2]=j;c[b>>2]=i|1;c[b+4>>2]=d;f=j;g=Kp(f,e,d)|0;h=f+(d<<2)|0;c[h>>2]=0;return}}function Wh(b){b=b|0;if((a[b]&1)==0){return}oq(c[b+8>>2]|0);return}function Xh(a,b){a=a|0;b=b|0;return Yh(a,b,Hp(b)|0)|0}function Yh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;f=b;g=a[f]|0;if((g&1)==0){h=1;i=g}else{g=c[b>>2]|0;h=(g&-2)-1|0;i=g&255}g=(i&1)==0;if(h>>>0<e>>>0){if(g){j=(i&255)>>>1}else{j=c[b+4>>2]|0}$h(b,h,e-h|0,j,0,j,e,d);return b|0}if(g){k=b+4|0}else{k=c[b+8>>2]|0}Jp(k,d,e)|0;c[k+(e<<2)>>2]=0;if((a[f]&1)==0){a[f]=e<<1;return b|0}else{c[b+4>>2]=e;return b|0}return 0}function Zh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;if(d>>>0>1073741807>>>0){Gh(0)}e=b;f=a[e]|0;if((f&1)==0){g=1;h=f}else{f=c[b>>2]|0;g=(f&-2)-1|0;h=f&255}if((h&1)==0){i=(h&255)>>>1}else{i=c[b+4>>2]|0}f=i>>>0>d>>>0?i:d;if(f>>>0<2>>>0){j=1}else{j=(f+4&-4)-1|0}if((j|0)==(g|0)){return}do{if((j|0)==1){k=b+4|0;l=c[b+8>>2]|0;m=1;n=0}else{f=(j<<2)+4|0;if(j>>>0>g>>>0){o=mq(f)|0}else{o=mq(f)|0}f=o;if((h&1)==0){k=f;l=b+4|0;m=0;n=1;break}else{k=f;l=c[b+8>>2]|0;m=1;n=1;break}}}while(0);if((h&1)==0){p=(h&255)>>>1}else{p=c[b+4>>2]|0}Ip(k,l,p+1|0)|0;if(m){oq(l)}if(n){c[b>>2]=j+1|1;c[b+4>>2]=i;c[b+8>>2]=k;return}else{a[e]=i<<1;return}}function _h(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;e=b;f=a[e]|0;g=(f&1)!=0;if(g){h=c[b+4>>2]|0;i=(c[b>>2]&-2)-1|0}else{h=(f&255)>>>1;i=1}if((h|0)==(i|0)){ai(b,i,1,i,i,0,0);if((a[e]&1)==0){j=7}else{j=8}}else{if(g){j=8}else{j=7}}if((j|0)==7){a[e]=(h<<1)+2;k=b+4|0;l=h+1|0;m=k+(h<<2)|0;c[m>>2]=d;n=k+(l<<2)|0;c[n>>2]=0;return}else if((j|0)==8){j=c[b+8>>2]|0;e=h+1|0;c[b+4>>2]=e;k=j;l=e;m=k+(h<<2)|0;c[m>>2]=d;n=k+(l<<2)|0;c[n>>2]=0;return}}function $h(b,d,e,f,g,h,i,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;if((1073741806-d|0)>>>0<e>>>0){Gh(0)}if((a[b]&1)==0){k=b+4|0}else{k=c[b+8>>2]|0}do{if(d>>>0<536870887>>>0){l=e+d|0;m=d<<1;n=l>>>0<m>>>0?m:l;if(n>>>0<2>>>0){o=2;break}o=n+4&-4}else{o=1073741807}}while(0);e=mq(o<<2)|0;if((g|0)!=0){Ip(e,k,g)|0}if((i|0)!=0){Ip(e+(g<<2)|0,j,i)|0}j=f-h|0;if((j|0)!=(g|0)){Ip(e+(i+g<<2)|0,k+(h+g<<2)|0,j-g|0)|0}if((d|0)==1){p=b+8|0;c[p>>2]=e;q=o|1;r=b|0;c[r>>2]=q;s=j+i|0;t=b+4|0;c[t>>2]=s;u=e+(s<<2)|0;c[u>>2]=0;return}oq(k);p=b+8|0;c[p>>2]=e;q=o|1;r=b|0;c[r>>2]=q;s=j+i|0;t=b+4|0;c[t>>2]=s;u=e+(s<<2)|0;c[u>>2]=0;return}function ai(b,d,e,f,g,h,i){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;if((1073741807-d|0)>>>0<e>>>0){Gh(0)}if((a[b]&1)==0){j=b+4|0}else{j=c[b+8>>2]|0}do{if(d>>>0<536870887>>>0){k=e+d|0;l=d<<1;m=k>>>0<l>>>0?l:k;if(m>>>0<2>>>0){n=2;break}n=m+4&-4}else{n=1073741807}}while(0);e=mq(n<<2)|0;if((g|0)!=0){Ip(e,j,g)|0}m=f-h|0;if((m|0)!=(g|0)){Ip(e+(i+g<<2)|0,j+(h+g<<2)|0,m-g|0)|0}if((d|0)==1){o=b+8|0;c[o>>2]=e;p=n|1;q=b|0;c[q>>2]=p;return}oq(j);o=b+8|0;c[o>>2]=e;p=n|1;q=b|0;c[q>>2]=p;return}function bi(b,d){b=b|0;d=d|0;var e=0,f=0,g=0;e=i;i=i+8|0;f=e|0;g=(c[b+24>>2]|0)==0;if(g){c[b+16>>2]=d|1}else{c[b+16>>2]=d}if(((g&1|d)&c[b+20>>2]|0)==0){i=e;return}e=vc(16)|0;do{if((a[28040]|0)==0){if((wb(28040)|0)==0){break}c[6512]=16616;fb(76,26048,t|0)|0}}while(0);b=Kq(26048,0,32)|0;c[f>>2]=b&0|1;c[f+4>>2]=J|0;Ch(e,f,9288);c[e>>2]=15800;Jb(e|0,21872,32)}function ci(a){a=a|0;var b=0,d=0,e=0,f=0;c[a>>2]=15776;b=c[a+40>>2]|0;d=a+32|0;e=a+36|0;if((b|0)!=0){f=b;do{f=f-1|0;Nc[c[(c[d>>2]|0)+(f<<2)>>2]&7](0,a,c[(c[e>>2]|0)+(f<<2)>>2]|0);}while((f|0)!=0)}rn(a+28|0);gq(c[d>>2]|0);gq(c[e>>2]|0);gq(c[a+48>>2]|0);gq(c[a+60>>2]|0);return}function di(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=c[a+40>>2]|0;if((d|0)==0){return}e=a+32|0;f=a+36|0;g=d;do{g=g-1|0;Nc[c[(c[e>>2]|0)+(g<<2)>>2]&7](b,a,c[(c[f>>2]|0)+(g<<2)>>2]|0);}while((g|0)!=0);return}function ei(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;d=a+44|0;e=b+40|0;f=c[e>>2]|0;do{if((c[d>>2]|0)>>>0<f>>>0){g=f<<2;h=fq(g)|0;if((h|0)==0){i=vc(4)|0;qq(i);Jb(i|0,21280,140)}i=fq(g)|0;if((i|0)!=0){j=i;k=h;break}h=vc(4)|0;qq(h);Jb(h|0,21280,140)}else{j=0;k=0}}while(0);f=a+56|0;h=b+52|0;i=c[h>>2]|0;do{if((c[f>>2]|0)>>>0<i>>>0){g=fq(i<<2)|0;if((g|0)!=0){l=g;break}g=vc(4)|0;qq(g);Jb(g|0,21280,140)}else{l=0}}while(0);i=a+68|0;g=b+64|0;m=c[g>>2]|0;do{if((c[i>>2]|0)>>>0<m>>>0){n=fq(m<<2)|0;if((n|0)!=0){o=n;break}n=vc(4)|0;qq(n);Jb(n|0,21280,140)}else{o=0}}while(0);c[a+4>>2]=c[b+4>>2];c[a+8>>2]=c[b+8>>2];c[a+12>>2]=c[b+12>>2];sn(a+28|0,b+28|0)|0;if((c[d>>2]|0)>>>0<(c[e>>2]|0)>>>0){m=a+32|0;gq(c[m>>2]|0);c[m>>2]=k;m=a+36|0;gq(c[m>>2]|0);c[m>>2]=j;c[d>>2]=c[e>>2];p=0;q=0}else{p=j;q=k}k=a+40|0;c[k>>2]=0;if((c[e>>2]|0)!=0){j=b+32|0;d=a+32|0;m=b+36|0;n=a+36|0;r=0;do{c[(c[d>>2]|0)+(r<<2)>>2]=c[(c[j>>2]|0)+(r<<2)>>2];c[(c[n>>2]|0)+(r<<2)>>2]=c[(c[m>>2]|0)+(r<<2)>>2];r=(c[k>>2]|0)+1|0;c[k>>2]=r;}while(r>>>0<(c[e>>2]|0)>>>0)}if((c[f>>2]|0)>>>0<(c[h>>2]|0)>>>0){e=a+48|0;gq(c[e>>2]|0);c[e>>2]=l;c[f>>2]=c[h>>2];s=0}else{s=l}l=a+52|0;c[l>>2]=0;if((c[h>>2]|0)!=0){f=c[b+48>>2]|0;e=c[a+48>>2]|0;r=0;do{c[e+(r<<2)>>2]=c[f+(r<<2)>>2];r=r+1|0;c[l>>2]=r;}while(r>>>0<(c[h>>2]|0)>>>0)}if((c[i>>2]|0)>>>0<(c[g>>2]|0)>>>0){h=a+60|0;gq(c[h>>2]|0);c[h>>2]=o;c[i>>2]=c[g>>2];t=0}else{t=o}o=a+64|0;c[o>>2]=0;if((c[g>>2]|0)!=0){i=b+60|0;b=a+60|0;a=0;do{c[(c[b>>2]|0)+(a<<2)>>2]=c[(c[i>>2]|0)+(a<<2)>>2];a=a+1|0;c[o>>2]=a;}while(a>>>0<(c[g>>2]|0)>>>0)}if((t|0)!=0){gq(t)}if((s|0)!=0){gq(s)}if((p|0)!=0){gq(p)}if((q|0)==0){return}gq(q);return}function fi(a,b){a=a|0;b=b|0;qn(a,b+28|0);return}function gi(a,b){a=a|0;b=b|0;c[a+24>>2]=b;c[a+16>>2]=(b|0)==0;c[a+20>>2]=0;c[a+4>>2]=4098;c[a+12>>2]=0;c[a+8>>2]=6;b=a+28|0;Gq(a+32|0,0,40)|0;if((b|0)==0){return}pn(b);return}function hi(a){a=a|0;c[a>>2]=16992;rn(a+4|0);oq(a);return}function ii(a){a=a|0;c[a>>2]=16992;rn(a+4|0);return}function ji(a,b){a=a|0;b=b|0;return}function ki(a,b,c){a=a|0;b=b|0;c=c|0;return a|0}function li(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;g=a;c[g>>2]=0;c[g+4>>2]=0;g=a+8|0;c[g>>2]=-1;c[g+4>>2]=-1;return}function mi(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;e=i;b=d;d=i;i=i+16|0;c[d>>2]=c[b>>2];c[d+4>>2]=c[b+4>>2];c[d+8>>2]=c[b+8>>2];c[d+12>>2]=c[b+12>>2];b=a;c[b>>2]=0;c[b+4>>2]=0;b=a+8|0;c[b>>2]=-1;c[b+4>>2]=-1;i=e;return}function ni(a){a=a|0;return 0}function oi(a){a=a|0;return 0}function pi(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;f=b;if((e|0)<=0){g=0;return g|0}h=b+12|0;i=b+16|0;j=d;d=0;while(1){k=c[h>>2]|0;if(k>>>0<(c[i>>2]|0)>>>0){c[h>>2]=k+1;l=a[k]|0}else{k=Mc[c[(c[f>>2]|0)+40>>2]&255](b)|0;if((k|0)==-1){g=d;m=8;break}l=k&255}a[j]=l;k=d+1|0;if((k|0)<(e|0)){j=j+1|0;d=k}else{g=k;m=8;break}}if((m|0)==8){return g|0}return 0}function qi(a){a=a|0;return-1|0}function ri(a){a=a|0;var b=0,e=0;if((Mc[c[(c[a>>2]|0)+36>>2]&255](a)|0)==-1){b=-1;return b|0}e=a+12|0;a=c[e>>2]|0;c[e>>2]=a+1;b=d[a]|0;return b|0}function si(a,b){a=a|0;b=b|0;return-1|0}function ti(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=b;if((f|0)<=0){h=0;return h|0}i=b+24|0;j=b+28|0;k=0;l=e;while(1){e=c[i>>2]|0;if(e>>>0<(c[j>>2]|0)>>>0){m=a[l]|0;c[i>>2]=e+1;a[e]=m}else{if((Jc[c[(c[g>>2]|0)+52>>2]&63](b,d[l]|0)|0)==-1){h=k;n=7;break}}m=k+1|0;if((m|0)<(f|0)){k=m;l=l+1|0}else{h=m;n=7;break}}if((n|0)==7){return h|0}return 0}function ui(a,b){a=a|0;b=b|0;return-1|0}function vi(a){a=a|0;c[a>>2]=16920;rn(a+4|0);oq(a);return}function wi(a){a=a|0;c[a>>2]=16920;rn(a+4|0);return}function xi(a,b){a=a|0;b=b|0;return}function yi(a,b,c){a=a|0;b=b|0;c=c|0;return a|0}function zi(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;g=a;c[g>>2]=0;c[g+4>>2]=0;g=a+8|0;c[g>>2]=-1;c[g+4>>2]=-1;return}function Ai(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;e=i;b=d;d=i;i=i+16|0;c[d>>2]=c[b>>2];c[d+4>>2]=c[b+4>>2];c[d+8>>2]=c[b+8>>2];c[d+12>>2]=c[b+12>>2];b=a;c[b>>2]=0;c[b+4>>2]=0;b=a+8|0;c[b>>2]=-1;c[b+4>>2]=-1;i=e;return}function Bi(a){a=a|0;return 0}function Ci(a){a=a|0;return 0}function Di(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;e=a;if((d|0)<=0){f=0;return f|0}g=a+12|0;h=a+16|0;i=b;b=0;while(1){j=c[g>>2]|0;if(j>>>0<(c[h>>2]|0)>>>0){c[g>>2]=j+4;k=c[j>>2]|0}else{j=Mc[c[(c[e>>2]|0)+40>>2]&255](a)|0;if((j|0)==-1){f=b;l=7;break}else{k=j}}c[i>>2]=k;j=b+1|0;if((j|0)<(d|0)){i=i+4|0;b=j}else{f=j;l=7;break}}if((l|0)==7){return f|0}return 0}function Ei(a){a=a|0;return-1|0}function Fi(a){a=a|0;var b=0,d=0;if((Mc[c[(c[a>>2]|0)+36>>2]&255](a)|0)==-1){b=-1;return b|0}d=a+12|0;a=c[d>>2]|0;c[d>>2]=a+4;b=c[a>>2]|0;return b|0}function Gi(a,b){a=a|0;b=b|0;return-1|0}function Hi(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;e=a;if((d|0)<=0){f=0;return f|0}g=a+24|0;h=a+28|0;i=0;j=b;while(1){b=c[g>>2]|0;if(b>>>0<(c[h>>2]|0)>>>0){k=c[j>>2]|0;c[g>>2]=b+4;c[b>>2]=k}else{if((Jc[c[(c[e>>2]|0)+52>>2]&63](a,c[j>>2]|0)|0)==-1){f=i;l=8;break}}k=i+1|0;if((k|0)>=(d|0)){f=k;l=8;break}i=k;j=j+4|0}if((l|0)==8){return f|0}return 0}function Ii(a,b){a=a|0;b=b|0;return-1|0}function Ji(a){a=a|0;ci(a+8|0);oq(a);return}function Ki(a){a=a|0;ci(a+8|0);return}function Li(a){a=a|0;var b=0,d=0;b=a;d=c[(c[a>>2]|0)-12>>2]|0;ci(b+(d+8)|0);oq(b+d|0);return}function Mi(a){a=a|0;ci(a+((c[(c[a>>2]|0)-12>>2]|0)+8)|0);return}function Ni(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0;d=i;i=i+8|0;e=d|0;f=b;g=c[(c[f>>2]|0)-12>>2]|0;h=b;if((c[h+(g+24)>>2]|0)==0){i=d;return b|0}j=e|0;a[j]=0;c[e+4>>2]=b;do{if((c[h+(g+16)>>2]|0)==0){k=c[h+(g+72)>>2]|0;if((k|0)==0){l=g}else{Ni(k)|0;l=c[(c[f>>2]|0)-12>>2]|0}a[j]=1;k=c[h+(l+24)>>2]|0;if(!((Mc[c[(c[k>>2]|0)+24>>2]&255](k)|0)==-1)){break}k=c[(c[f>>2]|0)-12>>2]|0;bi(h+k|0,c[h+(k+16)>>2]|1)}}while(0);Yi(e);i=d;return b|0}function Oi(a){a=a|0;var b=0;b=a+16|0;c[b>>2]=c[b>>2]|1;if((c[a+20>>2]&1|0)==0){return}else{Za()}}function Pi(a){a=a|0;ci(a+8|0);oq(a);return}function Qi(a){a=a|0;ci(a+8|0);return}function Ri(a){a=a|0;var b=0,d=0;b=a;d=c[(c[a>>2]|0)-12>>2]|0;ci(b+(d+8)|0);oq(b+d|0);return}function Si(a){a=a|0;ci(a+((c[(c[a>>2]|0)-12>>2]|0)+8)|0);return}function Ti(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0;d=i;i=i+8|0;e=d|0;f=b;g=c[(c[f>>2]|0)-12>>2]|0;h=b;if((c[h+(g+24)>>2]|0)==0){i=d;return b|0}j=e|0;a[j]=0;c[e+4>>2]=b;do{if((c[h+(g+16)>>2]|0)==0){k=c[h+(g+72)>>2]|0;if((k|0)==0){l=g}else{Ti(k)|0;l=c[(c[f>>2]|0)-12>>2]|0}a[j]=1;k=c[h+(l+24)>>2]|0;if(!((Mc[c[(c[k>>2]|0)+24>>2]&255](k)|0)==-1)){break}k=c[(c[f>>2]|0)-12>>2]|0;bi(h+k|0,c[h+(k+16)>>2]|1)}}while(0);dj(e);i=d;return b|0}function Ui(a){a=a|0;ci(a+4|0);oq(a);return}function Vi(a){a=a|0;ci(a+4|0);return}function Wi(a){a=a|0;var b=0,d=0;b=a;d=c[(c[a>>2]|0)-12>>2]|0;ci(b+(d+4)|0);oq(b+d|0);return}function Xi(a){a=a|0;ci(a+((c[(c[a>>2]|0)-12>>2]|0)+4)|0);return}function Yi(a){a=a|0;var b=0,d=0,e=0;b=a+4|0;a=c[b>>2]|0;d=c[(c[a>>2]|0)-12>>2]|0;e=a;if((c[e+(d+24)>>2]|0)==0){return}if((c[e+(d+16)>>2]|0)!=0){return}if((c[e+(d+4)>>2]&8192|0)==0){return}if(Bb()|0){return}d=c[b>>2]|0;e=c[d+((c[(c[d>>2]|0)-12>>2]|0)+24)>>2]|0;if(!((Mc[c[(c[e>>2]|0)+24>>2]&255](e)|0)==-1)){return}e=c[b>>2]|0;b=c[(c[e>>2]|0)-12>>2]|0;d=e;bi(d+b|0,c[d+(b+16)>>2]|1);return}function Zi(b,d){b=b|0;d=+d;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;e=i;i=i+40|0;f=e|0;g=e+8|0;h=e+16|0;j=e+24|0;k=e+32|0;l=h|0;a[l]=0;c[h+4>>2]=b;m=b;n=c[(c[m>>2]|0)-12>>2]|0;o=b;do{if((c[o+(n+16)>>2]|0)==0){p=c[o+(n+72)>>2]|0;if((p|0)==0){q=n}else{Ni(p)|0;q=c[(c[m>>2]|0)-12>>2]|0}a[l]=1;qn(j,o+(q+28)|0);p=un(j,27120)|0;rn(j);r=c[(c[m>>2]|0)-12>>2]|0;s=c[o+(r+24)>>2]|0;t=o+(r+76)|0;u=c[t>>2]|0;if((u|0)==-1){qn(g,o+(r+28)|0);v=un(g,27472)|0;w=Jc[c[(c[v>>2]|0)+28>>2]&63](v,32)|0;rn(g);c[t>>2]=w<<24>>24;x=w}else{x=u&255}u=c[(c[p>>2]|0)+32>>2]|0;c[f>>2]=s;Oc[u&15](k,p,f,o+r|0,x,d);if((c[k>>2]|0)!=0){break}r=c[(c[m>>2]|0)-12>>2]|0;bi(o+r|0,c[o+(r+16)>>2]|5)}}while(0);Yi(h);i=e;return b|0}function _i(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;e=i;i=i+8|0;f=e|0;g=f|0;a[g]=0;c[f+4>>2]=b;h=b;j=c[h>>2]|0;k=c[j-12>>2]|0;l=b;do{if((c[l+(k+16)>>2]|0)==0){m=c[l+(k+72)>>2]|0;if((m|0)==0){n=j;o=k}else{Ni(m)|0;m=c[h>>2]|0;n=m;o=c[m-12>>2]|0}a[g]=1;m=c[l+(o+24)>>2]|0;p=m;if((m|0)==0){q=n}else{r=m+24|0;s=c[r>>2]|0;if((s|0)!=(c[m+28>>2]|0)){c[r>>2]=s+1;a[s]=d;break}if(!((Jc[c[(c[m>>2]|0)+52>>2]&63](p,d&255)|0)==-1)){break}q=c[h>>2]|0}p=c[q-12>>2]|0;bi(l+p|0,c[l+(p+16)>>2]|1)}}while(0);Yi(f);i=e;return b|0}function $i(a){a=a|0;ci(a+4|0);oq(a);return}function aj(a){a=a|0;ci(a+4|0);return}function bj(a){a=a|0;var b=0,d=0;b=a;d=c[(c[a>>2]|0)-12>>2]|0;ci(b+(d+4)|0);oq(b+d|0);return}function cj(a){a=a|0;ci(a+((c[(c[a>>2]|0)-12>>2]|0)+4)|0);return}function dj(a){a=a|0;var b=0,d=0,e=0;b=a+4|0;a=c[b>>2]|0;d=c[(c[a>>2]|0)-12>>2]|0;e=a;if((c[e+(d+24)>>2]|0)==0){return}if((c[e+(d+16)>>2]|0)!=0){return}if((c[e+(d+4)>>2]&8192|0)==0){return}if(Bb()|0){return}d=c[b>>2]|0;e=c[d+((c[(c[d>>2]|0)-12>>2]|0)+24)>>2]|0;if(!((Mc[c[(c[e>>2]|0)+24>>2]&255](e)|0)==-1)){return}e=c[b>>2]|0;b=c[(c[e>>2]|0)-12>>2]|0;d=e;bi(d+b|0,c[d+(b+16)>>2]|1);return}function ej(a){a=a|0;return 10456}function fj(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)==1){Ih(a,12440,35);return}else{Ah(a,b|0,c);return}}function gj(a){a=a|0;wh(a|0);return}function hj(a){a=a|0;Eh(a|0);oq(a);return}function ij(a){a=a|0;Eh(a|0);return}function jj(a){a=a|0;ci(a);oq(a);return}function kj(a){a=a|0;wh(a|0);oq(a);return}function lj(a){a=a|0;jh(a|0);oq(a);return}function mj(a){a=a|0;jh(a|0);return}function nj(a){a=a|0;jh(a|0);return}function oj(b,c,d,e,f){b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0;a:do{if((e|0)==(f|0)){g=c}else{b=c;h=e;while(1){if((b|0)==(d|0)){i=-1;j=7;break}k=a[b]|0;l=a[h]|0;if(k<<24>>24<l<<24>>24){i=-1;j=7;break}if(l<<24>>24<k<<24>>24){i=1;j=7;break}k=b+1|0;l=h+1|0;if((l|0)==(f|0)){g=k;break a}else{b=k;h=l}}if((j|0)==7){return i|0}}}while(0);i=(g|0)!=(d|0)|0;return i|0}function pj(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;d=e;g=f-d|0;if(g>>>0>4294967279>>>0){Gh(b)}if(g>>>0<11>>>0){a[b]=g<<1;h=b+1|0}else{i=g+16&-16;j=mq(i)|0;c[b+8>>2]=j;c[b>>2]=i|1;c[b+4>>2]=g;h=j}if((e|0)==(f|0)){k=h;a[k]=0;return}else{l=h;m=e}while(1){a[l]=a[m]|0;e=m+1|0;if((e|0)==(f|0)){break}else{l=l+1|0;m=e}}k=h+(f+(-d|0))|0;a[k]=0;return}function qj(b,c,d){b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0;if((c|0)==(d|0)){e=0;return e|0}else{f=c;g=0}while(1){c=(a[f]|0)+(g<<4)|0;b=c&-268435456;h=(b>>>24|b)^c;c=f+1|0;if((c|0)==(d|0)){e=h;break}else{f=c;g=h}}return e|0}function rj(a){a=a|0;jh(a|0);oq(a);return}function sj(a){a=a|0;jh(a|0);return}function tj(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0;a:do{if((e|0)==(f|0)){g=b}else{a=b;h=e;while(1){if((a|0)==(d|0)){i=-1;j=7;break}k=c[a>>2]|0;l=c[h>>2]|0;if((k|0)<(l|0)){i=-1;j=7;break}if((l|0)<(k|0)){i=1;j=7;break}k=a+4|0;l=h+4|0;if((l|0)==(f|0)){g=k;break a}else{a=k;h=l}}if((j|0)==7){return i|0}}}while(0);i=(g|0)!=(d|0)|0;return i|0}function uj(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0;d=e;g=f-d|0;h=g>>2;if(h>>>0>1073741807>>>0){Gh(b)}if(h>>>0<2>>>0){a[b]=g>>>1;i=b+4|0}else{g=h+4&-4;j=mq(g<<2)|0;c[b+8>>2]=j;c[b>>2]=g|1;c[b+4>>2]=h;i=j}if((e|0)==(f|0)){k=i;c[k>>2]=0;return}j=f-4+(-d|0)|0;d=i;h=e;while(1){c[d>>2]=c[h>>2];e=h+4|0;if((e|0)==(f|0)){break}else{d=d+4|0;h=e}}k=i+((j>>>2)+1<<2)|0;c[k>>2]=0;return}function vj(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;if((b|0)==(d|0)){e=0;return e|0}else{f=b;g=0}while(1){b=(c[f>>2]|0)+(g<<4)|0;a=b&-268435456;h=(a>>>24|a)^b;b=f+4|0;if((b|0)==(d|0)){e=h;break}else{f=b;g=h}}return e|0}function wj(a){a=a|0;jh(a|0);oq(a);return}function xj(a){a=a|0;jh(a|0);return}function yj(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;k=i;i=i+112|0;l=e;e=i;i=i+4|0;i=i+7&-8;c[e>>2]=c[l>>2];l=f;f=i;i=i+4|0;i=i+7&-8;c[f>>2]=c[l>>2];l=k|0;m=k+16|0;n=k+32|0;o=k+40|0;p=k+48|0;q=k+56|0;r=k+64|0;s=k+72|0;t=k+80|0;u=k+104|0;if((c[g+4>>2]&1|0)==0){c[n>>2]=-1;v=c[(c[d>>2]|0)+16>>2]|0;w=e|0;c[p>>2]=c[w>>2];c[q>>2]=c[f>>2];Gc[v&127](o,d,p,q,g,h,n);q=c[o>>2]|0;c[w>>2]=q;w=c[n>>2]|0;if((w|0)==0){a[j]=0}else if((w|0)==1){a[j]=1}else{a[j]=1;c[h>>2]=4}c[b>>2]=q;i=k;return}fi(r,g);q=r|0;r=c[q>>2]|0;if(!((c[6868]|0)==-1)){c[m>>2]=27472;c[m+4>>2]=14;c[m+8>>2]=0;Fh(27472,m,108)}m=(c[6869]|0)-1|0;w=c[r+8>>2]|0;do{if((c[r+12>>2]|0)-w>>2>>>0>m>>>0){n=c[w+(m<<2)>>2]|0;if((n|0)==0){break}o=n;lh(c[q>>2]|0)|0;fi(s,g);n=s|0;p=c[n>>2]|0;if(!((c[6772]|0)==-1)){c[l>>2]=27088;c[l+4>>2]=14;c[l+8>>2]=0;Fh(27088,l,108)}d=(c[6773]|0)-1|0;v=c[p+8>>2]|0;do{if((c[p+12>>2]|0)-v>>2>>>0>d>>>0){x=c[v+(d<<2)>>2]|0;if((x|0)==0){break}y=x;lh(c[n>>2]|0)|0;z=t|0;A=x;Ic[c[(c[A>>2]|0)+24>>2]&127](z,y);Ic[c[(c[A>>2]|0)+28>>2]&127](t+12|0,y);c[u>>2]=c[f>>2];a[j]=(zj(e,u,z,t+24|0,o,h,1)|0)==(z|0)|0;c[b>>2]=c[e>>2];Kh(t+12|0);Kh(t|0);i=k;return}}while(0);o=vc(4)|0;Mp(o);Jb(o|0,21296,148)}}while(0);k=vc(4)|0;Mp(k);Jb(k|0,21296,148)}function zj(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;k=i;i=i+104|0;l=d;d=i;i=i+4|0;i=i+7&-8;c[d>>2]=c[l>>2];l=(f-e|0)/12|0;m=k|0;do{if(l>>>0>100>>>0){n=fq(l)|0;if((n|0)!=0){o=n;p=n;break}uq();o=0;p=0}else{o=m;p=0}}while(0);m=(e|0)==(f|0);if(m){q=l;r=0}else{n=l;l=0;s=o;t=e;while(1){u=a[t]|0;if((u&1)==0){v=(u&255)>>>1}else{v=c[t+4>>2]|0}if((v|0)==0){a[s]=2;w=l+1|0;x=n-1|0}else{a[s]=1;w=l;x=n}u=t+12|0;if((u|0)==(f|0)){q=x;r=w;break}else{n=x;l=w;s=s+1|0;t=u}}}t=b|0;b=d|0;d=g;s=0;w=r;r=q;a:while(1){q=c[t>>2]|0;do{if((q|0)==0){y=0}else{if((c[q+12>>2]|0)!=(c[q+16>>2]|0)){y=q;break}if((Mc[c[(c[q>>2]|0)+36>>2]&255](q)|0)==-1){c[t>>2]=0;y=0;break}else{y=c[t>>2]|0;break}}}while(0);q=(y|0)==0;l=c[b>>2]|0;do{if((l|0)==0){z=0}else{if((c[l+12>>2]|0)!=(c[l+16>>2]|0)){z=l;break}if(!((Mc[c[(c[l>>2]|0)+36>>2]&255](l)|0)==-1)){z=l;break}c[b>>2]=0;z=0}}while(0);A=(z|0)==0;B=c[t>>2]|0;if(!((q^A)&(r|0)!=0)){break}l=c[B+12>>2]|0;if((l|0)==(c[B+16>>2]|0)){C=(Mc[c[(c[B>>2]|0)+36>>2]&255](B)|0)&255}else{C=a[l]|0}if(j){D=C}else{D=Jc[c[(c[d>>2]|0)+12>>2]&63](g,C)|0}l=s+1|0;if(m){s=l;w=w;r=r;continue}b:do{if(j){x=r;n=w;v=o;u=0;E=e;while(1){do{if((a[v]|0)==1){F=a[E]|0;G=(F&1)==0;if(G){H=E+1|0}else{H=c[E+8>>2]|0}if(!(D<<24>>24==(a[H+s|0]|0))){a[v]=0;I=u;J=n;K=x-1|0;break}if(G){L=(F&255)>>>1}else{L=c[E+4>>2]|0}if((L|0)!=(l|0)){I=1;J=n;K=x;break}a[v]=2;I=1;J=n+1|0;K=x-1|0}else{I=u;J=n;K=x}}while(0);F=E+12|0;if((F|0)==(f|0)){M=K;N=J;O=I;break b}x=K;n=J;v=v+1|0;u=I;E=F}}else{E=r;u=w;v=o;n=0;x=e;while(1){do{if((a[v]|0)==1){F=x;if((a[F]&1)==0){P=x+1|0}else{P=c[x+8>>2]|0}if(!(D<<24>>24==(Jc[c[(c[d>>2]|0)+12>>2]&63](g,a[P+s|0]|0)|0)<<24>>24)){a[v]=0;Q=n;R=u;S=E-1|0;break}G=a[F]|0;if((G&1)==0){T=(G&255)>>>1}else{T=c[x+4>>2]|0}if((T|0)!=(l|0)){Q=1;R=u;S=E;break}a[v]=2;Q=1;R=u+1|0;S=E-1|0}else{Q=n;R=u;S=E}}while(0);G=x+12|0;if((G|0)==(f|0)){M=S;N=R;O=Q;break b}E=S;u=R;v=v+1|0;n=Q;x=G}}}while(0);if(!O){s=l;w=N;r=M;continue}q=c[t>>2]|0;x=q+12|0;n=c[x>>2]|0;if((n|0)==(c[q+16>>2]|0)){Mc[c[(c[q>>2]|0)+40>>2]&255](q)|0}else{c[x>>2]=n+1}if((M+N|0)>>>0<2>>>0){s=l;w=N;r=M;continue}else{U=N;V=o;W=e}while(1){do{if((a[V]|0)==2){n=a[W]|0;if((n&1)==0){X=(n&255)>>>1}else{X=c[W+4>>2]|0}if((X|0)==(l|0)){Y=U;break}a[V]=0;Y=U-1|0}else{Y=U}}while(0);n=W+12|0;if((n|0)==(f|0)){s=l;w=Y;r=M;continue a}else{U=Y;V=V+1|0;W=n}}}do{if((B|0)==0){Z=0}else{if((c[B+12>>2]|0)!=(c[B+16>>2]|0)){Z=B;break}if((Mc[c[(c[B>>2]|0)+36>>2]&255](B)|0)==-1){c[t>>2]=0;Z=0;break}else{Z=c[t>>2]|0;break}}}while(0);t=(Z|0)==0;do{if(A){_=91}else{if((c[z+12>>2]|0)!=(c[z+16>>2]|0)){if(t){break}else{_=93;break}}if((Mc[c[(c[z>>2]|0)+36>>2]&255](z)|0)==-1){c[b>>2]=0;_=91;break}else{if(t){break}else{_=93;break}}}}while(0);if((_|0)==91){if(t){_=93}}if((_|0)==93){c[h>>2]=c[h>>2]|2}c:do{if(m){_=98}else{t=o;b=e;while(1){if((a[t]|0)==2){$=b;break c}z=b+12|0;if((z|0)==(f|0)){_=98;break c}t=t+1|0;b=z}}}while(0);if((_|0)==98){c[h>>2]=c[h>>2]|4;$=f}if((p|0)==0){i=k;return $|0}gq(p);i=k;return $|0}function Aj(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0;b=i;i=i+16|0;j=d;d=i;i=i+4|0;i=i+7&-8;c[d>>2]=c[j>>2];j=e;e=i;i=i+4|0;i=i+7&-8;c[e>>2]=c[j>>2];j=b|0;k=b+8|0;c[j>>2]=c[d>>2];c[k>>2]=c[e>>2];Bj(a,0,j,k,f,g,h);i=b;return}function Bj(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0;d=i;i=i+256|0;k=e;e=i;i=i+4|0;i=i+7&-8;c[e>>2]=c[k>>2];k=f;f=i;i=i+4|0;i=i+7&-8;c[f>>2]=c[k>>2];k=d|0;l=d+32|0;m=d+40|0;n=d+56|0;o=d+72|0;p=d+80|0;q=d+240|0;r=d+248|0;s=c[g+4>>2]&74;if((s|0)==0){t=0}else if((s|0)==64){t=8}else if((s|0)==8){t=16}else{t=10}s=k|0;rk(m,g,s,l);g=n;Gq(g|0,0,12)|0;Nh(n,10,0);if((a[g]&1)==0){k=n+1|0;u=k;v=k;w=n+8|0}else{k=n+8|0;u=c[k>>2]|0;v=n+1|0;w=k}c[o>>2]=u;k=p|0;c[q>>2]=k;c[r>>2]=0;x=e|0;e=f|0;f=n|0;y=n+4|0;z=a[l]|0;l=u;u=c[x>>2]|0;a:while(1){do{if((u|0)==0){A=0}else{if((c[u+12>>2]|0)!=(c[u+16>>2]|0)){A=u;break}if(!((Mc[c[(c[u>>2]|0)+36>>2]&255](u)|0)==-1)){A=u;break}c[x>>2]=0;A=0}}while(0);B=(A|0)==0;C=c[e>>2]|0;do{if((C|0)==0){D=21}else{if((c[C+12>>2]|0)!=(c[C+16>>2]|0)){if(B){E=C;break}else{F=l;G=C;break a}}if((Mc[c[(c[C>>2]|0)+36>>2]&255](C)|0)==-1){c[e>>2]=0;D=21;break}else{if(B){E=C;break}else{F=l;G=C;break a}}}}while(0);if((D|0)==21){D=0;if(B){F=l;G=0;break}else{E=0}}C=a[g]|0;H=(C&1)==0;if(H){I=(C&255)>>>1}else{I=c[y>>2]|0}if(((c[o>>2]|0)-l|0)==(I|0)){if(H){J=(C&255)>>>1;K=(C&255)>>>1}else{C=c[y>>2]|0;J=C;K=C}Nh(n,J<<1,0);if((a[g]&1)==0){L=10}else{L=(c[f>>2]&-2)-1|0}Nh(n,L,0);if((a[g]&1)==0){M=v}else{M=c[w>>2]|0}c[o>>2]=M+K;N=M}else{N=l}C=A+12|0;H=c[C>>2]|0;O=A+16|0;if((H|0)==(c[O>>2]|0)){P=(Mc[c[(c[A>>2]|0)+36>>2]&255](A)|0)&255}else{P=a[H]|0}if((Tj(P,t,N,o,r,z,m,k,q,s)|0)!=0){F=N;G=E;break}H=c[C>>2]|0;if((H|0)==(c[O>>2]|0)){Mc[c[(c[A>>2]|0)+40>>2]&255](A)|0;l=N;u=A;continue}else{c[C>>2]=H+1;l=N;u=A;continue}}u=a[m]|0;if((u&1)==0){Q=(u&255)>>>1}else{Q=c[m+4>>2]|0}do{if((Q|0)!=0){u=c[q>>2]|0;if((u-p|0)>=160){break}N=c[r>>2]|0;c[q>>2]=u+4;c[u>>2]=N}}while(0);c[j>>2]=qp(F,c[o>>2]|0,h,t)|0;Em(m,k,c[q>>2]|0,h);do{if((A|0)==0){R=0}else{if((c[A+12>>2]|0)!=(c[A+16>>2]|0)){R=A;break}if(!((Mc[c[(c[A>>2]|0)+36>>2]&255](A)|0)==-1)){R=A;break}c[x>>2]=0;R=0}}while(0);x=(R|0)==0;do{if((G|0)==0){D=66}else{if((c[G+12>>2]|0)!=(c[G+16>>2]|0)){if(!x){break}S=b|0;c[S>>2]=R;Kh(n);Kh(m);i=d;return}if((Mc[c[(c[G>>2]|0)+36>>2]&255](G)|0)==-1){c[e>>2]=0;D=66;break}if(!(x^(G|0)==0)){break}S=b|0;c[S>>2]=R;Kh(n);Kh(m);i=d;return}}while(0);do{if((D|0)==66){if(x){break}S=b|0;c[S>>2]=R;Kh(n);Kh(m);i=d;return}}while(0);c[h>>2]=c[h>>2]|2;S=b|0;c[S>>2]=R;Kh(n);Kh(m);i=d;return}function Cj(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0;b=i;i=i+16|0;j=d;d=i;i=i+4|0;i=i+7&-8;c[d>>2]=c[j>>2];j=e;e=i;i=i+4|0;i=i+7&-8;c[e>>2]=c[j>>2];j=b|0;k=b+8|0;c[j>>2]=c[d>>2];c[k>>2]=c[e>>2];Dj(a,0,j,k,f,g,h);i=b;return}function Dj(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0;d=i;i=i+256|0;k=e;e=i;i=i+4|0;i=i+7&-8;c[e>>2]=c[k>>2];k=f;f=i;i=i+4|0;i=i+7&-8;c[f>>2]=c[k>>2];k=d|0;l=d+32|0;m=d+40|0;n=d+56|0;o=d+72|0;p=d+80|0;q=d+240|0;r=d+248|0;s=c[g+4>>2]&74;if((s|0)==64){t=8}else if((s|0)==8){t=16}else if((s|0)==0){t=0}else{t=10}s=k|0;rk(m,g,s,l);g=n;Gq(g|0,0,12)|0;Nh(n,10,0);if((a[g]&1)==0){k=n+1|0;u=k;v=k;w=n+8|0}else{k=n+8|0;u=c[k>>2]|0;v=n+1|0;w=k}c[o>>2]=u;k=p|0;c[q>>2]=k;c[r>>2]=0;x=e|0;e=f|0;f=n|0;y=n+4|0;z=a[l]|0;l=u;u=c[x>>2]|0;a:while(1){do{if((u|0)==0){A=0}else{if((c[u+12>>2]|0)!=(c[u+16>>2]|0)){A=u;break}if(!((Mc[c[(c[u>>2]|0)+36>>2]&255](u)|0)==-1)){A=u;break}c[x>>2]=0;A=0}}while(0);B=(A|0)==0;C=c[e>>2]|0;do{if((C|0)==0){D=21}else{if((c[C+12>>2]|0)!=(c[C+16>>2]|0)){if(B){E=C;break}else{F=l;G=C;break a}}if((Mc[c[(c[C>>2]|0)+36>>2]&255](C)|0)==-1){c[e>>2]=0;D=21;break}else{if(B){E=C;break}else{F=l;G=C;break a}}}}while(0);if((D|0)==21){D=0;if(B){F=l;G=0;break}else{E=0}}C=a[g]|0;H=(C&1)==0;if(H){I=(C&255)>>>1}else{I=c[y>>2]|0}if(((c[o>>2]|0)-l|0)==(I|0)){if(H){K=(C&255)>>>1;L=(C&255)>>>1}else{C=c[y>>2]|0;K=C;L=C}Nh(n,K<<1,0);if((a[g]&1)==0){M=10}else{M=(c[f>>2]&-2)-1|0}Nh(n,M,0);if((a[g]&1)==0){N=v}else{N=c[w>>2]|0}c[o>>2]=N+L;O=N}else{O=l}C=A+12|0;H=c[C>>2]|0;P=A+16|0;if((H|0)==(c[P>>2]|0)){Q=(Mc[c[(c[A>>2]|0)+36>>2]&255](A)|0)&255}else{Q=a[H]|0}if((Tj(Q,t,O,o,r,z,m,k,q,s)|0)!=0){F=O;G=E;break}H=c[C>>2]|0;if((H|0)==(c[P>>2]|0)){Mc[c[(c[A>>2]|0)+40>>2]&255](A)|0;l=O;u=A;continue}else{c[C>>2]=H+1;l=O;u=A;continue}}u=a[m]|0;if((u&1)==0){R=(u&255)>>>1}else{R=c[m+4>>2]|0}do{if((R|0)!=0){u=c[q>>2]|0;if((u-p|0)>=160){break}O=c[r>>2]|0;c[q>>2]=u+4;c[u>>2]=O}}while(0);r=pp(F,c[o>>2]|0,h,t)|0;c[j>>2]=r;c[j+4>>2]=J;Em(m,k,c[q>>2]|0,h);do{if((A|0)==0){S=0}else{if((c[A+12>>2]|0)!=(c[A+16>>2]|0)){S=A;break}if(!((Mc[c[(c[A>>2]|0)+36>>2]&255](A)|0)==-1)){S=A;break}c[x>>2]=0;S=0}}while(0);x=(S|0)==0;do{if((G|0)==0){D=66}else{if((c[G+12>>2]|0)!=(c[G+16>>2]|0)){if(!x){break}T=b|0;c[T>>2]=S;Kh(n);Kh(m);i=d;return}if((Mc[c[(c[G>>2]|0)+36>>2]&255](G)|0)==-1){c[e>>2]=0;D=66;break}if(!(x^(G|0)==0)){break}T=b|0;c[T>>2]=S;Kh(n);Kh(m);i=d;return}}while(0);do{if((D|0)==66){if(x){break}T=b|0;c[T>>2]=S;Kh(n);Kh(m);i=d;return}}while(0);c[h>>2]=c[h>>2]|2;T=b|0;c[T>>2]=S;Kh(n);Kh(m);i=d;return}function Ej(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0;b=i;i=i+16|0;j=d;d=i;i=i+4|0;i=i+7&-8;c[d>>2]=c[j>>2];j=e;e=i;i=i+4|0;i=i+7&-8;c[e>>2]=c[j>>2];j=b|0;k=b+8|0;c[j>>2]=c[d>>2];c[k>>2]=c[e>>2];Fj(a,0,j,k,f,g,h);i=b;return}function Fj(d,e,f,g,h,j,k){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0;e=i;i=i+256|0;l=f;f=i;i=i+4|0;i=i+7&-8;c[f>>2]=c[l>>2];l=g;g=i;i=i+4|0;i=i+7&-8;c[g>>2]=c[l>>2];l=e|0;m=e+32|0;n=e+40|0;o=e+56|0;p=e+72|0;q=e+80|0;r=e+240|0;s=e+248|0;t=c[h+4>>2]&74;if((t|0)==0){u=0}else if((t|0)==64){u=8}else if((t|0)==8){u=16}else{u=10}t=l|0;rk(n,h,t,m);h=o;Gq(h|0,0,12)|0;Nh(o,10,0);if((a[h]&1)==0){l=o+1|0;v=l;w=l;x=o+8|0}else{l=o+8|0;v=c[l>>2]|0;w=o+1|0;x=l}c[p>>2]=v;l=q|0;c[r>>2]=l;c[s>>2]=0;y=f|0;f=g|0;g=o|0;z=o+4|0;A=a[m]|0;m=v;v=c[y>>2]|0;a:while(1){do{if((v|0)==0){B=0}else{if((c[v+12>>2]|0)!=(c[v+16>>2]|0)){B=v;break}if(!((Mc[c[(c[v>>2]|0)+36>>2]&255](v)|0)==-1)){B=v;break}c[y>>2]=0;B=0}}while(0);C=(B|0)==0;D=c[f>>2]|0;do{if((D|0)==0){E=21}else{if((c[D+12>>2]|0)!=(c[D+16>>2]|0)){if(C){F=D;break}else{G=m;H=D;break a}}if((Mc[c[(c[D>>2]|0)+36>>2]&255](D)|0)==-1){c[f>>2]=0;E=21;break}else{if(C){F=D;break}else{G=m;H=D;break a}}}}while(0);if((E|0)==21){E=0;if(C){G=m;H=0;break}else{F=0}}D=a[h]|0;I=(D&1)==0;if(I){J=(D&255)>>>1}else{J=c[z>>2]|0}if(((c[p>>2]|0)-m|0)==(J|0)){if(I){K=(D&255)>>>1;L=(D&255)>>>1}else{D=c[z>>2]|0;K=D;L=D}Nh(o,K<<1,0);if((a[h]&1)==0){M=10}else{M=(c[g>>2]&-2)-1|0}Nh(o,M,0);if((a[h]&1)==0){N=w}else{N=c[x>>2]|0}c[p>>2]=N+L;O=N}else{O=m}D=B+12|0;I=c[D>>2]|0;P=B+16|0;if((I|0)==(c[P>>2]|0)){Q=(Mc[c[(c[B>>2]|0)+36>>2]&255](B)|0)&255}else{Q=a[I]|0}if((Tj(Q,u,O,p,s,A,n,l,r,t)|0)!=0){G=O;H=F;break}I=c[D>>2]|0;if((I|0)==(c[P>>2]|0)){Mc[c[(c[B>>2]|0)+40>>2]&255](B)|0;m=O;v=B;continue}else{c[D>>2]=I+1;m=O;v=B;continue}}v=a[n]|0;if((v&1)==0){R=(v&255)>>>1}else{R=c[n+4>>2]|0}do{if((R|0)!=0){v=c[r>>2]|0;if((v-q|0)>=160){break}O=c[s>>2]|0;c[r>>2]=v+4;c[v>>2]=O}}while(0);b[k>>1]=op(G,c[p>>2]|0,j,u)|0;Em(n,l,c[r>>2]|0,j);do{if((B|0)==0){S=0}else{if((c[B+12>>2]|0)!=(c[B+16>>2]|0)){S=B;break}if(!((Mc[c[(c[B>>2]|0)+36>>2]&255](B)|0)==-1)){S=B;break}c[y>>2]=0;S=0}}while(0);y=(S|0)==0;do{if((H|0)==0){E=66}else{if((c[H+12>>2]|0)!=(c[H+16>>2]|0)){if(!y){break}T=d|0;c[T>>2]=S;Kh(o);Kh(n);i=e;return}if((Mc[c[(c[H>>2]|0)+36>>2]&255](H)|0)==-1){c[f>>2]=0;E=66;break}if(!(y^(H|0)==0)){break}T=d|0;c[T>>2]=S;Kh(o);Kh(n);i=e;return}}while(0);do{if((E|0)==66){if(y){break}T=d|0;c[T>>2]=S;Kh(o);Kh(n);i=e;return}}while(0);c[j>>2]=c[j>>2]|2;T=d|0;c[T>>2]=S;Kh(o);Kh(n);i=e;return}
  6585. function Oe(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;d=i;i=i+8|0;e=d|0;f=c[b+4>>2]|0;g=c[b+4>>2]|0;b=c[g+4>>2]|0;h=c[g+8>>2]|0;g=h<<2;j=g+4|0;k=fq(j)|0;l=k;if((k|0)==0){_d();return 0}Gq(k|0,0,j|0)|0;if(!((h|0)>-1)){hc(9504,9232,138,13816);return 0}j=(h|0)>0;if(j){Gq(k|0,0,g|0)|0}k=f+4|0;m=c[k>>2]|0;if((m|0)>0){n=c[f+24>>2]|0;o=c[f+12>>2]|0;p=c[f+16>>2]|0;if((p|0)==0){q=0;r=m;while(1){s=c[o+(q<<2)>>2]|0;t=c[o+(q+1<<2)>>2]|0;if((s|0)<(t|0)){u=s;do{s=l+(c[n+(u<<2)>>2]<<2)|0;c[s>>2]=(c[s>>2]|0)+1;u=u+1|0;}while((u|0)<(t|0));v=c[k>>2]|0}else{v=r}t=q+1|0;if((t|0)<(v|0)){q=t;r=v}else{break}}}else{v=0;r=m;while(1){m=c[o+(v<<2)>>2]|0;q=c[p+(v<<2)>>2]|0;t=q+m|0;if((q|0)>0){q=m;do{m=l+(c[n+(q<<2)>>2]<<2)|0;c[m>>2]=(c[m>>2]|0)+1;q=q+1|0;}while((q|0)<(t|0));w=c[k>>2]|0}else{w=r}t=v+1|0;if((t|0)<(w|0)){v=t;r=w}else{break}}}}if(h>>>0>1073741823>>>0){_d();return 0}if((kq(e,16,g)|0)==0){x=c[e>>2]|0}else{c[e>>2]=0;x=0}if(!((x|0)!=0|(g|0)==0)){_d();return 0}g=x;do{if(j){e=0;w=0;do{r=l+(w<<2)|0;v=c[r>>2]|0;c[r>>2]=e;c[g+(w<<2)>>2]=e;e=v+e|0;w=w+1|0;}while((w|0)<(h|0));c[l+(h<<2)>>2]=e;if((e|0)==0){y=0;z=0;A=0;B=0;break}w=~~(+(e>>>0>>>0)*0.0)+e|0;v=Pa(w|0,4)|0;r=J?-1:v;v=nq(r)|0;y=v;z=nq(r)|0;A=w;B=e}else{c[l+(h<<2)>>2]=0;y=0;z=0;A=0;B=0}}while(0);j=c[k>>2]|0;a:do{if((j|0)>0){w=c[f+20>>2]|0;r=c[f+24>>2]|0;v=c[f+12>>2]|0;n=c[f+16>>2]|0;b:do{if((n|0)==0){p=0;o=j;while(1){t=c[v+(p<<2)>>2]|0;q=c[v+(p+1<<2)>>2]|0;if((t|0)<(q|0)){m=t;do{t=c[r+(m<<2)>>2]|0;if(!((t|0)>-1&(h|0)>(t|0))){break b}u=g+(t<<2)|0;t=c[u>>2]|0;c[u>>2]=t+1;c[z+(t<<2)>>2]=p;c[y+(t<<2)>>2]=c[w+(m<<2)>>2];m=m+1|0;}while((m|0)<(q|0));C=c[k>>2]|0}else{C=o}q=p+1|0;if((q|0)<(C|0)){p=q;o=C}else{break a}}}else{o=0;p=j;while(1){q=c[v+(o<<2)>>2]|0;m=c[n+(o<<2)>>2]|0;t=m+q|0;if((m|0)>0){m=q;do{q=c[r+(m<<2)>>2]|0;if(!((q|0)>-1&(h|0)>(q|0))){break b}u=g+(q<<2)|0;q=c[u>>2]|0;c[u>>2]=q+1;c[z+(q<<2)>>2]=o;c[y+(q<<2)>>2]=c[w+(m<<2)>>2];m=m+1|0;}while((m|0)<(t|0));D=c[k>>2]|0}else{D=p}t=o+1|0;if((t|0)<(D|0)){o=t;p=D}else{break a}}}}while(0);hc(2408,10808,378,13904);return 0}}while(0);D=a+12|0;k=c[D>>2]|0;c[D>>2]=l;c[a+8>>2]=b;c[a+4>>2]=h;h=a+16|0;b=c[h>>2]|0;c[h>>2]=0;h=a+20|0;l=c[h>>2]|0;c[h>>2]=y;y=a+24|0;h=c[y>>2]|0;c[y>>2]=z;c[a+28>>2]=B;c[a+32>>2]=A;gq(x);gq(k);gq(b);if((l|0)!=0){pq(l)}if((h|0)==0){i=d;return a|0}pq(h);i=d;return a|0}function Pe(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=i;i=i+16|0;f=e|0;if(!((b|0)>-1)){hc(8328,3152,222,14160);return 0}if(!((c[a+8>>2]|0)>(b|0)&(d|0)>-1)){hc(8328,3152,222,14160);return 0}g=c[a+4>>2]|0;if((g|0)<=(d|0)){hc(8328,3152,222,14160);return 0}if((c[a+16>>2]|0)!=0){h=Qe(a,b,d)|0;i=e;return h|0}c[f>>2]=g;c[f+8>>2]=2;if(!((g|0)>-1)){hc(11264,11040,63,14048);return 0}Se(a,f);h=Qe(a,b,d)|0;i=e;return h|0}function Qe(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;e=i;i=i+8|0;f=e|0;g=a+16|0;h=c[g>>2]|0;if((h|0)==0){hc(7800,3152,1121,14192);return 0}j=a+12|0;k=c[j>>2]|0;l=c[k+(d<<2)>>2]|0;m=c[h+(d<<2)>>2]|0;if((m|0)<((c[k+(d+1<<2)>>2]|0)-l|0)){n=l;o=h;p=m}else{c[f>>2]=d;c[f+4>>2]=(m|0)>2?m:2;Re(a,f);f=c[g>>2]|0;n=c[(c[j>>2]|0)+(d<<2)>>2]|0;o=f;p=c[f+(d<<2)>>2]|0}f=o+(d<<2)|0;d=p+n|0;o=c[a+24>>2]|0;j=a+20|0;a:do{if((p|0)>0){a=d;while(1){g=a-1|0;q=c[o+(g<<2)>>2]|0;if((q|0)<=(b|0)){break}c[o+(a<<2)>>2]=q;m=c[j>>2]|0;c[m+(a<<2)>>2]=c[m+(g<<2)>>2];if((g|0)>(n|0)){a=g}else{r=g;break a}}if((q|0)!=(b|0)){r=a;break}hc(7496,3152,1142,14192);return 0}else{r=d}}while(0);c[f>>2]=(c[f>>2]|0)+1;c[o+(r<<2)>>2]=b;b=(c[j>>2]|0)+(r<<2)|0;c[b>>2]=0;i=e;return b|0}function Re(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;d=a+16|0;e=c[d>>2]|0;f=a+4|0;g=c[f>>2]|0;h=g<<2;if((e|0)!=0){i=fq(h+4|0)|0;j=i;if((i|0)==0){_d()}if((g|0)>0){i=c[a+12>>2]|0;k=b+4|0;l=c[b>>2]|0;m=0;n=0;while(1){c[j+(n<<2)>>2]=m;o=n+1|0;p=c[e+(n<<2)>>2]|0;q=(c[i+(o<<2)>>2]|0)-(c[i+(n<<2)>>2]|0)-p|0;if((l|0)==(n|0)){r=c[k>>2]|0}else{r=0}s=p+m+((r|0)<(q|0)?q:r)|0;if((o|0)<(g|0)){m=s;n=o}else{t=s;break}}}else{t=0}c[j+(g<<2)>>2]=t;n=a+20|0;Ge(n,t,0.0);t=c[f>>2]|0;m=c[a+12>>2]|0;if((t|0)>0){r=a+24|0;k=n|0;n=t;do{n=n-1|0;t=j+(n<<2)|0;l=c[t>>2]|0;i=m+(n<<2)|0;e=c[i>>2]|0;a:do{if((l-e|0)>0){s=c[(c[d>>2]|0)+(n<<2)>>2]|0;if((s|0)<=0){break}o=c[r>>2]|0;q=c[k>>2]|0;p=s;s=l;u=e;while(1){v=p-1|0;c[o+(s+v<<2)>>2]=c[o+(u+v<<2)>>2];c[q+((c[t>>2]|0)+v<<2)>>2]=c[q+((c[i>>2]|0)+v<<2)>>2];if((v|0)<=0){break a}p=v;s=c[t>>2]|0;u=c[i>>2]|0}}}while(0);}while((n|0)>0)}c[a+12>>2]=j;gq(m);return}m=fq(h)|0;h=m;c[d>>2]=h;if((m|0)==0){_d()}if((g|0)>0){m=b+4|0;j=c[a+12>>2]|0;n=c[b>>2]|0;k=0;r=0;i=0;while(1){c[h+(k<<2)>>2]=r;t=(n|0)==(k|0);if(t){w=c[m>>2]|0}else{w=0}e=k+1|0;l=w+r+(c[j+(e<<2)>>2]|0)-(c[j+(k<<2)>>2]|0)|0;if(t){x=c[m>>2]|0}else{x=0}t=x+i|0;if((e|0)<(g|0)){k=e;r=l;i=t}else{y=t;break}}}else{y=0}i=a+20|0;r=c[a+28>>2]|0;k=r+y|0;y=a+32|0;if(k>>>0>(c[y>>2]|0)>>>0){x=Pa(k|0,4)|0;m=J?-1:x;x=nq(m)|0;j=nq(m)|0;m=i|0;w=c[m>>2]|0;n=w;t=(r>>>0<k>>>0?r:k)<<2;Fq(x|0,n|0,t)|0;r=a+24|0;l=c[r>>2]|0;Fq(j|0,l|0,t)|0;if((w|0)==0){z=l}else{pq(n);z=c[r>>2]|0}if((z|0)!=0){pq(z)}c[m>>2]=x;c[r>>2]=j;c[y>>2]=k;A=c[f>>2]|0}else{A=g}g=c[a+12>>2]|0;if((A|0)>0){k=c[d>>2]|0;y=a+24|0;a=i|0;j=c[g+(A<<2)>>2]|0;r=A;while(1){x=r-1|0;m=g+(x<<2)|0;z=c[m>>2]|0;n=j-z|0;if((n|0)>0){l=c[y>>2]|0;w=h+(x<<2)|0;t=c[a>>2]|0;e=n;u=z;while(1){s=e-1|0;c[l+((c[w>>2]|0)+s<<2)>>2]=c[l+(u+s<<2)>>2];c[t+((c[w>>2]|0)+s<<2)>>2]=c[t+((c[m>>2]|0)+s<<2)>>2];p=c[m>>2]|0;if((s|0)>0){e=s;u=p}else{B=p;C=w;break}}}else{B=z;C=h+(x<<2)|0}c[m>>2]=c[C>>2];c[k+(x<<2)>>2]=n;if((x|0)>0){j=B;r=x}else{break}}D=c[f>>2]|0;E=k}else{D=A;E=c[d>>2]|0}d=D-1|0;if((c[b>>2]|0)==(d|0)){F=c[b+4>>2]|0}else{F=0}c[g+(D<<2)>>2]=(c[E+(d<<2)>>2]|0)+(c[g+(d<<2)>>2]|0)+F;Ge(i,c[g+(c[f>>2]<<2)>>2]|0,0.0);return}function Se(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;d=a+16|0;e=c[d>>2]|0;f=a+4|0;g=c[f>>2]|0;h=g<<2;if((e|0)!=0){i=fq(h+4|0)|0;j=i;if((i|0)==0){_d()}a:do{if((g|0)>0){i=c[a+12>>2]|0;k=b|0;l=b+8|0;m=0;n=0;while(1){c[j+(n<<2)>>2]=m;o=n+1|0;p=c[e+(n<<2)>>2]|0;q=(c[i+(o<<2)>>2]|0)-(c[i+(n<<2)>>2]|0)-p|0;if((c[k>>2]|0)<=(n|0)){break}r=c[l>>2]|0;s=p+m+((r|0)<(q|0)?q:r)|0;if((o|0)<(g|0)){m=s;n=o}else{t=s;break a}}hc(2408,10808,156,13904)}else{t=0}}while(0);c[j+(g<<2)>>2]=t;e=a+20|0;Ge(e,t,0.0);t=c[f>>2]|0;n=c[a+12>>2]|0;if((t|0)>0){m=a+24|0;l=e|0;e=t;do{e=e-1|0;t=j+(e<<2)|0;k=c[t>>2]|0;i=n+(e<<2)|0;s=c[i>>2]|0;b:do{if((k-s|0)>0){o=c[(c[d>>2]|0)+(e<<2)>>2]|0;if((o|0)<=0){break}r=c[m>>2]|0;q=c[l>>2]|0;p=o;o=k;u=s;while(1){v=p-1|0;c[r+(o+v<<2)>>2]=c[r+(u+v<<2)>>2];c[q+((c[t>>2]|0)+v<<2)>>2]=c[q+((c[i>>2]|0)+v<<2)>>2];if((v|0)<=0){break b}p=v;o=c[t>>2]|0;u=c[i>>2]|0}}}while(0);}while((e|0)>0)}c[a+12>>2]=j;gq(n);return}n=fq(h)|0;h=n;c[d>>2]=h;if((n|0)==0){_d()}c:do{if((g|0)>0){n=b|0;j=b+8|0;e=a+12|0;l=0;m=0;i=0;while(1){c[h+(l<<2)>>2]=m;if((c[n>>2]|0)<=(l|0)){break}t=c[j>>2]|0;s=l+1|0;k=c[e>>2]|0;u=t+m-(c[k+(l<<2)>>2]|0)+(c[k+(s<<2)>>2]|0)|0;k=t+i|0;if((s|0)<(g|0)){l=s;m=u;i=k}else{w=k;break c}}hc(2408,10808,156,13904)}else{w=0}}while(0);i=a+20|0;m=c[a+28>>2]|0;l=m+w|0;w=a+32|0;if(l>>>0>(c[w>>2]|0)>>>0){e=Pa(l|0,4)|0;j=J?-1:e;e=nq(j)|0;n=nq(j)|0;j=i|0;k=c[j>>2]|0;u=k;s=(m>>>0<l>>>0?m:l)<<2;Fq(e|0,u|0,s)|0;m=a+24|0;t=c[m>>2]|0;Fq(n|0,t|0,s)|0;if((k|0)==0){x=t}else{pq(u);x=c[m>>2]|0}if((x|0)!=0){pq(x)}c[j>>2]=e;c[m>>2]=n;c[w>>2]=l;y=c[f>>2]|0}else{y=g}g=c[a+12>>2]|0;if((y|0)>0){l=c[d>>2]|0;w=a+24|0;a=i|0;n=c[g+(y<<2)>>2]|0;m=y;while(1){e=m-1|0;j=g+(e<<2)|0;x=c[j>>2]|0;u=n-x|0;if((u|0)>0){t=c[w>>2]|0;k=h+(e<<2)|0;s=c[a>>2]|0;o=u;p=x;while(1){q=o-1|0;c[t+((c[k>>2]|0)+q<<2)>>2]=c[t+(p+q<<2)>>2];c[s+((c[k>>2]|0)+q<<2)>>2]=c[s+((c[j>>2]|0)+q<<2)>>2];r=c[j>>2]|0;if((q|0)>0){o=q;p=r}else{z=r;A=k;break}}}else{z=x;A=h+(e<<2)|0}c[j>>2]=c[A>>2];c[l+(e<<2)>>2]=u;if((e|0)>0){n=z;m=e}else{break}}B=c[f>>2]|0;C=l}else{B=y;C=c[d>>2]|0}d=B-1|0;y=(c[C+(d<<2)>>2]|0)+(c[g+(d<<2)>>2]|0)|0;if((B|0)<=0){hc(2408,10808,156,13904)}if((c[b>>2]|0)<=(d|0)){hc(2408,10808,156,13904)}c[g+(B<<2)>>2]=y+(c[b+8>>2]|0);Ge(i,c[g+(c[f>>2]<<2)>>2]|0,0.0);return}function Te(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0;e=i;i=i+208|0;f=e|0;g=e+16|0;h=e+32|0;j=e+48|0;k=e+64|0;l=e+80|0;m=e+96|0;n=e+112|0;o=e+128|0;p=e+144|0;q=e+160|0;r=e+176|0;s=e+184|0;t=e+192|0;u=e+200|0;v=d+4|0;w=c[v>>2]|0;if((w|0)<=0){hc(9064,8464,175,13768);return 0}x=d|0;d=c[x>>2]|0;y=c[d>>2]|0;if((w|0)>1){z=y;A=1;while(1){B=c[d+(A<<2)>>2]|0;C=(z|0)<(B|0)?B:z;B=A+1|0;if((B|0)<(w|0)){z=C;A=B}else{D=C;E=0;break}}}else{D=y;E=0}do{y=c[d+(E+w<<2)>>2]|0;D=(D|0)<(y|0)?y:D;E=E+1|0;}while((E|0)<(w|0));E=w<<1;y=D;D=0;do{A=c[d+(D+E<<2)>>2]|0;y=(y|0)<(A|0)?A:y;D=D+1|0;}while((D|0)<(w|0));D=y+1|0;c[a+8>>2]=D;y=a+28|0;c[y>>2]=0;E=a+4|0;d=c[E>>2]|0;do{if((d|0)!=(D|0)|(d|0)==0){A=a+12|0;gq(c[A>>2]|0);z=fq((D<<2)+4|0)|0;c[A>>2]=z;if((z|0)==0){_d();return 0}else{c[E>>2]=D;break}}}while(0);d=a+16|0;z=c[d>>2]|0;if((z|0)==0){F=D}else{gq(z);c[d>>2]=0;F=c[E>>2]|0}z=a+12|0;Gq(c[z>>2]|0,0,(F<<2)+4|0)|0;c[b+8>>2]=D;F=b+28|0;c[F>>2]=0;A=b+4|0;C=c[A>>2]|0;do{if((C|0)!=(D|0)|(C|0)==0){B=b+12|0;gq(c[B>>2]|0);G=fq((D<<2)+4|0)|0;c[B>>2]=G;if((G|0)==0){_d();return 0}else{c[A>>2]=D;break}}}while(0);C=b+16|0;G=c[C>>2]|0;if((G|0)==0){H=D}else{gq(G);c[C>>2]=0;H=c[A>>2]|0}G=b+12|0;Gq(c[G>>2]|0,0,(H<<2)+4|0)|0;H=f|0;c[H>>2]=0;D=f+4|0;c[D>>2]=0;B=f+8|0;c[B>>2]=0;I=w*6|0;if((I|0)!=0){J=mq(w*72|0)|0;c[H>>2]=J;c[D>>2]=J;c[B>>2]=J+(I*12|0)}I=g|0;c[I>>2]=0;J=g+4|0;c[J>>2]=0;K=g+8|0;c[K>>2]=0;L=w*3|0;if((L|0)!=0){M=mq(w*36|0)|0;c[I>>2]=M;c[J>>2]=M;c[K>>2]=M+(L*12|0)}L=h|0;M=h+4|0;N=h+8|0;O=j|0;P=j+4|0;Q=j+8|0;R=k|0;S=k+4|0;T=k+8|0;U=l|0;V=l+4|0;W=l+8|0;X=m|0;Y=m+4|0;Z=m+8|0;_=n|0;$=n+4|0;aa=n+8|0;ba=o|0;ca=o+4|0;da=o+8|0;ea=p|0;fa=p+4|0;ga=p+8|0;ha=q|0;ia=q+4|0;ja=q+8|0;ka=q;la=p;ma=o;na=n;oa=m;pa=l;qa=k;ra=j;sa=h;ta=0;do{ua=c[v>>2]|0;if((ua|0)<=(ta|0)){va=28;break}wa=c[x>>2]|0;xa=c[wa+(ta<<2)>>2]|0;ya=c[wa+(ua+ta<<2)>>2]|0;za=c[wa+((ua<<1)+ta<<2)>>2]|0;c[L>>2]=xa;c[M>>2]=ya;c[N>>2]=1;ua=c[D>>2]|0;if((ua|0)==(c[B>>2]|0)){Ye(f,h);Aa=c[D>>2]|0}else{if((ua|0)==0){Ba=0}else{wa=ua;c[wa>>2]=c[sa>>2];c[wa+4>>2]=c[sa+4>>2];c[wa+8>>2]=c[sa+8>>2];Ba=c[D>>2]|0}wa=Ba+12|0;c[D>>2]=wa;Aa=wa}c[O>>2]=ya;c[P>>2]=za;c[Q>>2]=1;if((Aa|0)==(c[B>>2]|0)){Ye(f,j);Ca=c[D>>2]|0}else{if((Aa|0)==0){Da=0}else{wa=Aa;c[wa>>2]=c[ra>>2];c[wa+4>>2]=c[ra+4>>2];c[wa+8>>2]=c[ra+8>>2];Da=c[D>>2]|0}wa=Da+12|0;c[D>>2]=wa;Ca=wa}c[R>>2]=za;c[S>>2]=xa;c[T>>2]=1;if((Ca|0)==(c[B>>2]|0)){Ye(f,k);Ea=c[D>>2]|0}else{if((Ca|0)==0){Fa=0}else{wa=Ca;c[wa>>2]=c[qa>>2];c[wa+4>>2]=c[qa+4>>2];c[wa+8>>2]=c[qa+8>>2];Fa=c[D>>2]|0}wa=Fa+12|0;c[D>>2]=wa;Ea=wa}c[U>>2]=ya;c[V>>2]=xa;c[W>>2]=1;if((Ea|0)==(c[B>>2]|0)){Ye(f,l);Ga=c[D>>2]|0}else{if((Ea|0)==0){Ha=0}else{wa=Ea;c[wa>>2]=c[pa>>2];c[wa+4>>2]=c[pa+4>>2];c[wa+8>>2]=c[pa+8>>2];Ha=c[D>>2]|0}wa=Ha+12|0;c[D>>2]=wa;Ga=wa}c[X>>2]=za;c[Y>>2]=ya;c[Z>>2]=1;if((Ga|0)==(c[B>>2]|0)){Ye(f,m);Ia=c[D>>2]|0}else{if((Ga|0)==0){Ja=0}else{wa=Ga;c[wa>>2]=c[oa>>2];c[wa+4>>2]=c[oa+4>>2];c[wa+8>>2]=c[oa+8>>2];Ja=c[D>>2]|0}wa=Ja+12|0;c[D>>2]=wa;Ia=wa}c[_>>2]=xa;c[$>>2]=za;c[aa>>2]=1;if((Ia|0)==(c[B>>2]|0)){Ye(f,n)}else{if((Ia|0)==0){Ka=0}else{wa=Ia;c[wa>>2]=c[na>>2];c[wa+4>>2]=c[na+4>>2];c[wa+8>>2]=c[na+8>>2];Ka=c[D>>2]|0}c[D>>2]=Ka+12}c[ba>>2]=xa;c[ca>>2]=ya;c[da>>2]=ta;wa=c[J>>2]|0;if((wa|0)==(c[K>>2]|0)){Ye(g,o);La=c[J>>2]|0}else{if((wa|0)==0){Ma=0}else{ua=wa;c[ua>>2]=c[ma>>2];c[ua+4>>2]=c[ma+4>>2];c[ua+8>>2]=c[ma+8>>2];Ma=c[J>>2]|0}ua=Ma+12|0;c[J>>2]=ua;La=ua}c[ea>>2]=ya;c[fa>>2]=za;c[ga>>2]=ta;if((La|0)==(c[K>>2]|0)){Ye(g,p);Na=c[J>>2]|0}else{if((La|0)==0){Oa=0}else{ya=La;c[ya>>2]=c[la>>2];c[ya+4>>2]=c[la+4>>2];c[ya+8>>2]=c[la+8>>2];Oa=c[J>>2]|0}ya=Oa+12|0;c[J>>2]=ya;Na=ya}c[ha>>2]=za;c[ia>>2]=xa;c[ja>>2]=ta;if((Na|0)==(c[K>>2]|0)){Ye(g,q)}else{if((Na|0)==0){Pa=0}else{xa=Na;c[xa>>2]=c[ka>>2];c[xa+4>>2]=c[ka+4>>2];c[xa+8>>2]=c[ka+8>>2];Pa=c[J>>2]|0}c[J>>2]=Pa+12}ta=ta+1|0;}while((ta|0)<(w|0));if((va|0)==28){hc(9360,6792,114,13952);return 0}c[r>>2]=c[H>>2];c[s>>2]=c[D>>2];Ue(r,s,a,0);do{if((c[d>>2]|0)==0){a=c[y>>2]|0;s=c[E>>2]|0;r=s;while(1){if(!((r|0)>-1)){break}if((c[(c[z>>2]|0)+(r<<2)>>2]|0)==0){r=r-1|0}else{break}}va=r+1|0;if((va|0)>(s|0)){break}w=c[z>>2]|0;ta=va;do{c[w+(ta<<2)>>2]=a;ta=ta+1|0;}while((ta|0)<=(c[E>>2]|0))}}while(0);c[t>>2]=c[I>>2];c[u>>2]=c[J>>2];Ue(t,u,b,0);do{if((c[C>>2]|0)==0){b=c[F>>2]|0;u=c[A>>2]|0;t=u;while(1){if(!((t|0)>-1)){break}if((c[(c[G>>2]|0)+(t<<2)>>2]|0)==0){t=t-1|0}else{break}}E=t+1|0;if((E|0)>(u|0)){break}z=c[G>>2]|0;y=E;do{c[z+(y<<2)>>2]=b;y=y+1|0;}while((y|0)<=(c[A>>2]|0))}}while(0);A=c[I>>2]|0;if((A|0)!=0){I=c[J>>2]|0;if((I|0)!=(A|0)){c[J>>2]=I+(~(((I-12+(-A|0)|0)>>>0)/12|0)*12|0)}oq(A)}A=c[H>>2]|0;if((A|0)==0){i=e;return 0}H=c[D>>2]|0;if((H|0)!=(A|0)){c[D>>2]=H+(~(((H-12+(-A|0)|0)>>>0)/12|0)*12|0)}oq(A);i=e;return 0}function Ue(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;f=i;i=i+56|0;g=f|0;h=f+8|0;j=f+48|0;k=e+8|0;l=c[k>>2]|0;m=e+4|0;n=c[m>>2]|0;a[h|0]=0;o=h+4|0;Gq(o|0,0,32)|0;c[h+8>>2]=n;c[h+28>>2]=0;n=fq((l<<2)+4|0)|0;c[h+12>>2]=n;if((n|0)==0){_d()}c[o>>2]=l;o=h+16|0;p=h+12|0;Gq(n|0,0,(l<<2)+4|0)|0;n=b|0;b=d|0;if((c[n>>2]|0)!=(c[b>>2]|0)){d=j|0;if(l>>>0>1073741823>>>0){_d()}q=l<<2;if((kq(g,16,q)|0)==0){r=c[g>>2]|0}else{c[g>>2]=0;r=0}if(!((r|0)!=0|(q|0)==0)){_d()}q=r;c[d>>2]=q;g=j+4|0;c[g>>2]=l;if(!((l|0)>-1)){hc(10536,10264,225,13832)}c[g>>2]=l;if((l|0)>0){Gq(r|0,0,l<<2|0)|0}r=c[n>>2]|0;g=c[b>>2]|0;a:do{if((r|0)!=(g|0)){s=r;while(1){t=c[s>>2]|0;if(!((t|0)>-1)){u=25;break}if((t|0)>=(c[k>>2]|0)){u=25;break}v=c[s+4>>2]|0;if(!((v|0)>-1)){u=25;break}if((v|0)>=(c[m>>2]|0)){u=25;break}if((l|0)<=(t|0)){u=31;break}v=q+(t<<2)|0;c[v>>2]=(c[v>>2]|0)+1;s=s+12|0;if((s|0)==(g|0)){break a}}if((u|0)==25){hc(728,13024,952,13712)}else if((u|0)==31){hc(9416,6792,394,13952)}}}while(0);Xe(h,j);j=c[n>>2]|0;n=c[b>>2]|0;b:do{if((j|0)!=(n|0)){b=c[o>>2]|0;u=c[p>>2]|0;g=c[h+24>>2]|0;q=c[h+20>>2]|0;if((b|0)==0){hc(11880,13024,842,14080)}else{w=j}while(1){l=c[w>>2]|0;m=b+(l<<2)|0;k=c[m>>2]|0;r=c[u+(l<<2)>>2]|0;if((k|0)>((c[u+(l+1<<2)>>2]|0)-r|0)){break}l=c[w+4>>2]|0;s=c[w+8>>2]|0;c[m>>2]=k+1;m=r+k|0;c[g+(m<<2)>>2]=l;c[q+(m<<2)>>2]=s;w=w+12|0;if((w|0)==(n|0)){break b}}hc(10736,13024,843,14080)}}while(0);Ve(h);gq(c[d>>2]|0)}We(e,h|0)|0;gq(c[p>>2]|0);gq(c[o>>2]|0);o=c[h+20>>2]|0;if((o|0)!=0){pq(o)}o=c[h+24>>2]|0;if((o|0)==0){i=f;return}pq(o);i=f;return}function Ve(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;b=i;i=i+8|0;d=b|0;e=a+16|0;if((c[e>>2]|0)==0){hc(11880,13024,1020,14104)}f=c[a+8>>2]|0;if(f>>>0>1073741823>>>0){_d()}g=f<<2;if((kq(d,16,g)|0)==0){h=c[d>>2]|0}else{c[d>>2]=0;h=0}if(!((h|0)!=0|(g|0)==0)){_d()}g=h;if(!((f|0)>-1)){hc(10536,10264,225,13832)}if((f|0)>0){Gq(h|0,-1|0,f<<2|0)|0}d=a+4|0;j=c[d>>2]|0;k=a+12|0;l=c[k>>2]|0;m=c[e>>2]|0;a:do{if((j|0)>0){n=a+24|0;o=a+20|0;p=0;q=0;b:while(1){r=l+(p<<2)|0;s=c[r>>2]|0;t=c[m+(p<<2)>>2]|0;u=t+s|0;if((t|0)>0){t=c[n>>2]|0;v=s;s=q;while(1){w=t+(v<<2)|0;x=c[w>>2]|0;if(!((x|0)>-1&(f|0)>(x|0))){break b}y=g+(x<<2)|0;x=c[y>>2]|0;z=c[o>>2]|0;A=c[z+(v<<2)>>2]|0;if((x|0)<(q|0)){c[z+(s<<2)>>2]=A;c[t+(s<<2)>>2]=c[w>>2];c[y>>2]=s;B=s+1|0}else{y=z+(x<<2)|0;c[y>>2]=(c[y>>2]|0)+A;B=s}A=v+1|0;if((A|0)<(u|0)){v=A;s=B}else{C=B;break}}}else{C=q}c[r>>2]=q;s=p+1|0;v=c[d>>2]|0;if((s|0)<(v|0)){p=s;q=C}else{D=C;E=v;break a}}hc(9416,6792,394,13952)}else{D=0;E=j}}while(0);c[l+(E<<2)>>2]=D;gq(m);c[e>>2]=0;Ge(a+20|0,c[(c[k>>2]|0)+(c[d>>2]<<2)>>2]|0,0.0);gq(h);i=b;return}function We(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;d=i;i=i+8|0;e=d|0;f=b+4|0;g=c[f>>2]|0;h=c[b+8>>2]|0;j=h<<2;k=j+4|0;l=fq(k)|0;m=l;if((l|0)==0){_d();return 0}Gq(l|0,0,k|0)|0;if(!((h|0)>-1)){hc(13544,12936,138,13808);return 0}k=(h|0)>0;if(k){Gq(l|0,0,j|0)|0}if((g|0)>0){l=c[b+24>>2]|0;n=c[b+12>>2]|0;o=c[b+16>>2]|0;if((o|0)==0){p=0;do{q=c[n+(p<<2)>>2]|0;r=c[n+(p+1<<2)>>2]|0;if((q|0)<(r|0)){s=q;do{q=m+(c[l+(s<<2)>>2]<<2)|0;c[q>>2]=(c[q>>2]|0)+1;s=s+1|0;}while((s|0)<(r|0))}p=p+1|0;}while((p|0)<(g|0))}else{p=0;do{r=c[n+(p<<2)>>2]|0;s=c[o+(p<<2)>>2]|0;q=s+r|0;if((s|0)>0){s=r;do{r=m+(c[l+(s<<2)>>2]<<2)|0;c[r>>2]=(c[r>>2]|0)+1;s=s+1|0;}while((s|0)<(q|0))}p=p+1|0;}while((p|0)<(g|0))}}if(h>>>0>1073741823>>>0){_d();return 0}if((kq(e,16,j)|0)==0){t=c[e>>2]|0}else{c[e>>2]=0;t=0}if(!((t|0)!=0|(j|0)==0)){_d();return 0}j=t;do{if(k){e=0;p=0;do{l=m+(p<<2)|0;o=c[l>>2]|0;c[l>>2]=e;c[j+(p<<2)>>2]=e;e=o+e|0;p=p+1|0;}while((p|0)<(h|0));c[m+(h<<2)>>2]=e;if((e|0)==0){u=0;v=0;w=0;x=0;break}p=~~(+(e>>>0>>>0)*0.0)+e|0;o=Pa(p|0,4)|0;l=J?-1:o;o=nq(l)|0;u=o;v=nq(l)|0;w=p;x=e}else{c[m+(h<<2)>>2]=0;u=0;v=0;w=0;x=0}}while(0);k=c[f>>2]|0;a:do{if((k|0)>0){p=c[b+20>>2]|0;l=c[b+24>>2]|0;o=c[b+12>>2]|0;n=c[b+16>>2]|0;b:do{if((n|0)==0){q=0;s=k;while(1){r=c[o+(q<<2)>>2]|0;y=c[o+(q+1<<2)>>2]|0;if((r|0)<(y|0)){z=r;do{r=c[l+(z<<2)>>2]|0;if(!((r|0)>-1&(h|0)>(r|0))){break b}A=j+(r<<2)|0;r=c[A>>2]|0;c[A>>2]=r+1;c[v+(r<<2)>>2]=q;c[u+(r<<2)>>2]=c[p+(z<<2)>>2];z=z+1|0;}while((z|0)<(y|0));B=c[f>>2]|0}else{B=s}y=q+1|0;if((y|0)<(B|0)){q=y;s=B}else{break a}}}else{s=0;q=k;while(1){y=c[o+(s<<2)>>2]|0;z=c[n+(s<<2)>>2]|0;r=z+y|0;if((z|0)>0){z=y;do{y=c[l+(z<<2)>>2]|0;if(!((y|0)>-1&(h|0)>(y|0))){break b}A=j+(y<<2)|0;y=c[A>>2]|0;c[A>>2]=y+1;c[v+(y<<2)>>2]=s;c[u+(y<<2)>>2]=c[p+(z<<2)>>2];z=z+1|0;}while((z|0)<(r|0));C=c[f>>2]|0}else{C=q}r=s+1|0;if((r|0)<(C|0)){s=r;q=C}else{break a}}}}while(0);hc(9416,6792,378,13920);return 0}}while(0);C=a+12|0;f=c[C>>2]|0;c[C>>2]=m;c[a+8>>2]=g;c[a+4>>2]=h;h=a+16|0;g=c[h>>2]|0;c[h>>2]=0;h=a+20|0;m=c[h>>2]|0;c[h>>2]=u;u=a+24|0;h=c[u>>2]|0;c[u>>2]=v;c[a+28>>2]=x;c[a+32>>2]=w;gq(t);gq(f);gq(g);if((m|0)!=0){pq(m)}if((h|0)==0){i=d;return a|0}pq(h);i=d;return a|0}function Xe(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;d=a+16|0;e=c[d>>2]|0;f=a+4|0;g=c[f>>2]|0;h=g<<2;if((e|0)!=0){i=fq(h+4|0)|0;j=i;if((i|0)==0){_d()}a:do{if((g|0)>0){i=c[a+12>>2]|0;k=b+4|0;l=b|0;m=0;n=0;while(1){c[j+(n<<2)>>2]=m;o=n+1|0;p=c[e+(n<<2)>>2]|0;q=(c[i+(o<<2)>>2]|0)-(c[i+(n<<2)>>2]|0)-p|0;if((c[k>>2]|0)<=(n|0)){break}r=c[(c[l>>2]|0)+(n<<2)>>2]|0;s=p+m+((r|0)<(q|0)?q:r)|0;if((o|0)<(g|0)){m=s;n=o}else{t=s;break a}}hc(9416,6792,156,13920)}else{t=0}}while(0);c[j+(g<<2)>>2]=t;e=a+20|0;Ge(e,t,0.0);t=c[f>>2]|0;n=c[a+12>>2]|0;if((t|0)>0){m=a+24|0;l=e|0;e=t;do{e=e-1|0;t=j+(e<<2)|0;k=c[t>>2]|0;i=n+(e<<2)|0;s=c[i>>2]|0;b:do{if((k-s|0)>0){o=c[(c[d>>2]|0)+(e<<2)>>2]|0;if((o|0)<=0){break}r=c[m>>2]|0;q=c[l>>2]|0;p=o;o=k;u=s;while(1){v=p-1|0;c[r+(o+v<<2)>>2]=c[r+(u+v<<2)>>2];c[q+((c[t>>2]|0)+v<<2)>>2]=c[q+((c[i>>2]|0)+v<<2)>>2];if((v|0)<=0){break b}p=v;o=c[t>>2]|0;u=c[i>>2]|0}}}while(0);}while((e|0)>0)}c[a+12>>2]=j;gq(n);return}n=fq(h)|0;h=n;c[d>>2]=h;if((n|0)==0){_d()}c:do{if((g|0)>0){n=b+4|0;j=b|0;e=a+12|0;l=0;m=0;i=0;while(1){c[h+(l<<2)>>2]=m;if((c[n>>2]|0)<=(l|0)){break}t=c[(c[j>>2]|0)+(l<<2)>>2]|0;s=l+1|0;k=c[e>>2]|0;u=t+m-(c[k+(l<<2)>>2]|0)+(c[k+(s<<2)>>2]|0)|0;k=t+i|0;if((s|0)<(g|0)){l=s;m=u;i=k}else{w=k;break c}}hc(9416,6792,156,13920)}else{w=0}}while(0);i=a+20|0;m=c[a+28>>2]|0;l=m+w|0;w=a+32|0;if(l>>>0>(c[w>>2]|0)>>>0){e=Pa(l|0,4)|0;j=J?-1:e;e=nq(j)|0;n=nq(j)|0;j=i|0;k=c[j>>2]|0;u=k;s=(m>>>0<l>>>0?m:l)<<2;Fq(e|0,u|0,s)|0;m=a+24|0;t=c[m>>2]|0;Fq(n|0,t|0,s)|0;if((k|0)==0){x=t}else{pq(u);x=c[m>>2]|0}if((x|0)!=0){pq(x)}c[j>>2]=e;c[m>>2]=n;c[w>>2]=l;y=c[f>>2]|0}else{y=g}g=c[a+12>>2]|0;if((y|0)>0){l=c[d>>2]|0;w=a+24|0;a=i|0;n=c[g+(y<<2)>>2]|0;m=y;while(1){e=m-1|0;j=g+(e<<2)|0;x=c[j>>2]|0;u=n-x|0;if((u|0)>0){t=c[w>>2]|0;k=h+(e<<2)|0;s=c[a>>2]|0;o=u;p=x;while(1){q=o-1|0;c[t+((c[k>>2]|0)+q<<2)>>2]=c[t+(p+q<<2)>>2];c[s+((c[k>>2]|0)+q<<2)>>2]=c[s+((c[j>>2]|0)+q<<2)>>2];r=c[j>>2]|0;if((q|0)>0){o=q;p=r}else{z=r;A=k;break}}}else{z=x;A=h+(e<<2)|0}c[j>>2]=c[A>>2];c[l+(e<<2)>>2]=u;if((e|0)>0){n=z;m=e}else{break}}B=c[f>>2]|0;C=l}else{B=y;C=c[d>>2]|0}d=B-1|0;y=(c[C+(d<<2)>>2]|0)+(c[g+(d<<2)>>2]|0)|0;if((B|0)<=0){hc(9416,6792,156,13920)}if((c[b+4>>2]|0)<=(d|0)){hc(9416,6792,156,13920)}c[g+(B<<2)>>2]=y+(c[(c[b>>2]|0)+(d<<2)>>2]|0);Ge(i,c[g+(c[f>>2]<<2)>>2]|0,0.0);return}function Ye(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=a+4|0;e=a|0;f=c[e>>2]|0;g=f;h=(c[d>>2]|0)-g|0;i=(h|0)/12|0;j=i+1|0;if(j>>>0>357913941>>>0){jn(0)}k=a+8|0;a=((c[k>>2]|0)-g|0)/12|0;if(a>>>0<178956970>>>0){g=a<<1;a=g>>>0<j>>>0?j:g;if((a|0)==0){l=0;m=0}else{n=a;o=5}}else{n=357913941;o=5}if((o|0)==5){l=mq(n*12|0)|0;m=n}n=l+(i*12|0)|0;if((n|0)!=0){o=n;n=b;c[o>>2]=c[n>>2];c[o+4>>2]=c[n+4>>2];c[o+8>>2]=c[n+8>>2]}n=l+((((h|0)/-12|0)+i|0)*12|0)|0;i=f;Fq(n|0,i|0,h)|0;c[e>>2]=n;c[d>>2]=l+(j*12|0);c[k>>2]=l+(m*12|0);if((f|0)==0){return}oq(i);return}function Ze(a){a=a|0;lc(c[s>>2]|0,a|0,(a=i,i=i+1|0,i=i+7&-8,c[a>>2]=0,a)|0)|0;i=a;nb(-1|0)}function _e(a){a=a|0;c[a>>2]=0;c[a+4>>2]=1;c[a+8>>2]=3;c[a+12>>2]=0;c[a+16>>2]=0;h[a+24>>3]=1.0;c[a+32>>2]=0;c[a+36>>2]=0;c[a+40>>2]=0;c[a+120>>2]=1;return}function $e(a){a=a|0;lf(c[a+20>>2]|0);return}function af(a){a=a|0;var b=0;b=a+20|0;lf(c[(c[b>>2]|0)+8>>2]|0);lf(c[(c[b>>2]|0)+12>>2]|0);lf(c[(c[b>>2]|0)+4>>2]|0);lf(c[b>>2]|0);return}function bf(a){a=a|0;var b=0;b=a+20|0;lf(c[(c[b>>2]|0)+16>>2]|0);lf(c[(c[b>>2]|0)+20>>2]|0);lf(c[(c[b>>2]|0)+8>>2]|0);lf(c[(c[b>>2]|0)+12>>2]|0);lf(c[(c[b>>2]|0)+24>>2]|0);lf(c[(c[b>>2]|0)+28>>2]|0);lf(c[b>>2]|0);return}function cf(a){a=a|0;var b=0;b=a+20|0;lf(c[(c[b>>2]|0)+12>>2]|0);lf(c[(c[b>>2]|0)+16>>2]|0);lf(c[b>>2]|0);return}function df(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;if((a|0)>0){e=0}else{return}do{c[d+(c[b+(e<<2)>>2]<<2)>>2]=-1;e=e+1|0;}while((e|0)<(a|0));return}function ef(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;b=c[f>>2]|0;g=c[f+12>>2]|0;c[d>>2]=0;c[e>>2]=c[(c[f+32>>2]|0)+(a<<2)>>2];h=c[(c[f+4>>2]|0)+(a<<2)>>2]|0;if((a|0)<1|(h|0)<0){return}a=0;f=c[b>>2]|0;while(1){i=a+1|0;j=b+(i<<2)|0;k=c[j>>2]|0;if((f|0)<(k|0)){l=1-f|0;m=(c[g+(f+1<<2)>>2]|0)-(c[g+(f<<2)>>2]|0)|0;n=f;while(1){c[d>>2]=(c[d>>2]|0)+m;c[e>>2]=l+n+(c[e>>2]|0);o=n+1|0;p=c[j>>2]|0;if((o|0)<(p|0)){m=m-1|0;n=o}else{q=p;break}}}else{q=k}if((i|0)>(h|0)){break}else{a=i;f=q}}return}function ff(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;if((a|0)<2){return}e=c[d>>2]|0;f=c[d+8>>2]|0;g=c[d+12>>2]|0;h=c[(c[d+4>>2]|0)+(a<<2)>>2]|0;if((h|0)<0){i=0}else{d=0;j=0;k=c[e>>2]|0;while(1){l=g+(k<<2)|0;m=c[l>>2]|0;c[l>>2]=j;l=k+1|0;n=g+(l<<2)|0;if((m|0)<(c[n>>2]|0)){o=m;m=j;while(1){c[f+(m<<2)>>2]=c[b+(c[f+(o<<2)>>2]<<2)>>2];p=m+1|0;q=o+1|0;if((q|0)<(c[n>>2]|0)){o=q;m=p}else{r=p;break}}}else{r=j}m=d+1|0;o=e+(m<<2)|0;n=c[o>>2]|0;if((l|0)<(n|0)){p=l;while(1){c[g+(p<<2)>>2]=r;q=p+1|0;s=c[o>>2]|0;if((q|0)<(s|0)){p=q}else{t=s;break}}}else{t=n}if((m|0)>(h|0)){i=r;break}else{d=m;j=r;k=t}}}c[g+(a<<2)>>2]=i;return}function gf(a){a=a|0;var b=0,d=0,e=0,f=0,j=0,k=0;b=i;i=i+512|0;d=rf(1)|0;e=rf(2)|0;c[a>>2]=qf(((d|0)>(e|0)?d:e)+1|0)|0;e=kf(128)|0;d=a+4|0;c[d>>2]=e;if((e|0)==0){e=b|0;ob(e|0,9328,(f=i,i=i+24|0,c[f>>2]=9016,c[f+8>>2]=305,c[f+16>>2]=8456,f)|0)|0;i=f;Ze(e)}e=kf(64)|0;j=e;c[a+8>>2]=j;if((e|0)==0){k=b+256|0;ob(k|0,9328,(f=i,i=i+24|0,c[f>>2]=8208,c[f+8>>2]=307,c[f+16>>2]=8456,f)|0)|0;i=f;Ze(k)}else{k=c[d>>2]|0;h[k>>3]=0.0;g[j>>2]=0.0;h[k+8>>3]=0.0;g[e+4>>2]=0.0;h[k+16>>3]=0.0;g[e+8>>2]=0.0;h[k+24>>3]=0.0;g[e+12>>2]=0.0;h[k+32>>3]=0.0;g[e+16>>2]=0.0;h[k+40>>3]=0.0;g[e+20>>2]=0.0;h[k+48>>3]=0.0;g[e+24>>2]=0.0;h[k+56>>3]=0.0;g[e+28>>2]=0.0;h[k+64>>3]=0.0;g[e+32>>2]=0.0;h[k+72>>3]=0.0;g[e+36>>2]=0.0;h[k+80>>3]=0.0;g[e+40>>2]=0.0;h[k+88>>3]=0.0;g[e+44>>2]=0.0;h[k+96>>3]=0.0;g[e+48>>2]=0.0;h[k+104>>3]=0.0;g[e+52>>2]=0.0;h[k+112>>3]=0.0;g[e+56>>2]=0.0;h[k+120>>3]=0.0;g[e+60>>2]=0.0;c[a+12>>2]=0;c[a+16>>2]=0;c[a+20>>2]=0;i=b;return}}function hf(a){a=a|0;lf(c[a>>2]|0);lf(c[a+4>>2]|0);lf(c[a+8>>2]|0);return}function jf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;if((b|0)>0){e=0}else{return}do{c[a+(e<<2)>>2]=d;e=e+1|0;}while((e|0)<(b|0));return}function kf(a){a=a|0;return fq(a)|0}function lf(a){a=a|0;gq(a);return}function mf(a,b,d,e,f,g,h,i,j,k,l){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;c[f>>2]=e;c[g>>2]=e+(a<<2);g=a<<1;c[h>>2]=e+(g<<2);h=g+a|0;c[i>>2]=e+(h<<2);g=fa(d,a)|0;a=g+h|0;c[j>>2]=e+(a<<2);h=a+g|0;c[k>>2]=e+(h<<2);c[l>>2]=e+(h+b<<2);jf(c[i>>2]|0,g,-1);jf(c[j>>2]|0,g,-1);return}function nf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=b;b=d;if((a|0)>0){f=0}else{return}do{c[b+(f<<2)>>2]=c[e+(f<<2)>>2];f=f+1|0;}while((f|0)<(a|0));return}function of(b,c,d){b=b|0;c=c|0;d=d|0;var e=0;e=d-1|0;if((e|0)<0){return}d=b+e|0;b=c+e|0;while(1){a[b]=a[d]|0;e=b-1|0;if(e>>>0<c>>>0){break}else{d=d-1|0;b=e}}return}function pf(a){a=a|0;var b=0,d=0,e=0;b=i;i=i+256|0;d=fq(a<<2)|0;a=d;if((d|0)!=0){i=b;return a|0}d=b|0;ob(d|0,10472,(e=i,i=i+24|0,c[e>>2]=12480,c[e+8>>2]=138,c[e+16>>2]=9304,e)|0)|0;i=e;Ze(d);i=b;return a|0}function qf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=i;i=i+256|0;d=fq(a<<2)|0;e=d;if((d|0)==0){f=b|0;ob(f|0,10472,(g=i,i=i+24|0,c[g>>2]=6672,c[g+8>>2]=149,c[g+16>>2]=9304,g)|0)|0;i=g;Ze(f)}if((a|0)<=0){i=b;return e|0}Gq(d|0,0,a<<2|0)|0;i=b;return e|0}function rf(a){a=a|0;var b=0,d=0,e=0;b=i;i=i+8|0;d=b|0;switch(a|0){case 1:{e=12;break};case 2:{e=6;break};case 3:{e=100;break};case 4:{e=200;break};case 5:{e=60;break};case 6:{e=20;break};case 7:{e=10;break};default:{c[d>>2]=1;sf(10192,d)|0;e=0}}i=b;return e|0}function sf(a,b){a=a|0;b=b|0;var d=0,e=0;d=i;e=c[b>>2]|0;Kb(9568,(b=i,i=i+16|0,c[b>>2]=a,c[b+8>>2]=e,b)|0)|0;i=b;i=d;return 0}function tf(b,d,e,f,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z){b=b|0;d=d|0;e=e|0;f=f|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;t=t|0;u=u|0;v=v|0;w=w|0;x=x|0;y=y|0;z=z|0;var A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0.0,Z=0.0,_=0,$=0,aa=0.0,ba=0,ca=0,da=0,ea=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0.0,oa=0.0,pa=0.0,qa=0.0,ra=0,sa=0.0,ta=0.0,ua=0,va=0,wa=0.0,xa=0.0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0;A=i;i=i+72|0;B=A|0;C=A+24|0;D=A+32|0;E=A+40|0;F=A+48|0;G=A+56|0;H=A+64|0;I=c[r+20>>2]|0;J=c[s+20>>2]|0;K=c[I+4>>2]|0;L=c[J+4>>2]|0;M=I;I=c[M>>2]|0;N=J;J=c[N>>2]|0;O=r+16|0;P=c[O>>2]|0;c[z>>2]=0;Q=b|0;R=(c[Q>>2]|0)!=3;S=b+4|0;T=c[S>>2]|0;U=b+12|0;V=(c[U>>2]|0)==0;if(R){a[k]=78;W=0;X=0;Y=0.0;Z=0.0}else{if((wg(k,9560)|0)==0){_=(wg(k,12384)|0)!=0|0}else{_=1}if((wg(k,9128)|0)==0){$=(wg(k,12384)|0)!=0|0}else{$=1}aa=+$f(6512);W=$;X=_;Y=aa;Z=1.0/aa}_=c[Q>>2]|0;do{if(_>>>0<4>>>0){ba=12}else{if((c[U>>2]|0)>>>0<3>>>0){ba=12;break}if((c[S>>2]|0)>>>0<2>>>0){ba=12;break}c[z>>2]=-1;ca=-1}}while(0);a:do{if((ba|0)==12){S=d+12|0;$=c[S>>2]|0;da=d+16|0;do{if(!(($|0)!=(c[da>>2]|0)|($|0)<0)){ea=d|0;ga=c[ea>>2]|0;if(!((ga|0)==0|(ga|0)==2)){break}ga=d+4|0;if((c[ga>>2]|0)!=1){break}ha=d+8|0;if((c[ha>>2]|0)!=0){break}ia=(X|0)==0;ja=(W|0)==0;do{if((_|0)==3&ia&ja){if((wg(k,4912)|0)!=0){break}c[z>>2]=-6;ca=-6;break a}}while(0);do{if(!ia){ka=c[S>>2]|0;la=(ka|0)>0;if(la){ma=0;aa=0.0;na=Z;while(1){oa=+h[l+(ma<<3)>>3];pa=na<oa?na:oa;qa=aa>oa?aa:oa;ra=ma+1|0;if((ra|0)<(ka|0)){ma=ra;aa=qa;na=pa}else{sa=qa;ta=pa;break}}}else{sa=0.0;ta=Z}if(!(ta>0.0)){c[z>>2]=-7;break}if(la){h[H>>3]=(ta>Y?ta:Y)/(sa<Z?sa:Z);break}else{h[H>>3]=1.0;break}}}while(0);ia=c[z>>2]|0;ma=(ia|0)==0;do{if(ja){if(!ma){ca=ia;break a}}else{if(!ma){ca=ia;break a}ka=c[S>>2]|0;ra=(ka|0)>0;if(ra){ua=0;na=0.0;aa=Z;while(1){pa=+h[m+(ua<<3)>>3];qa=aa<pa?aa:pa;oa=na>pa?na:pa;va=ua+1|0;if((va|0)<(ka|0)){ua=va;na=oa;aa=qa}else{wa=oa;xa=qa;break}}}else{wa=0.0;xa=Z}if(!(xa>0.0)){c[z>>2]=-8;ca=-8;break a}if(ra){h[G>>3]=(xa>Y?xa:Y)/(wa<Z?wa:Z);break}else{h[G>>3]=1.0;break}}}while(0);b:do{if((q|0)<-1){c[z>>2]=-12;ya=-12}else{ia=c[O>>2]|0;if((ia|0)<0){c[z>>2]=-13;ya=-13;break}if((ia|0)<=0){ya=0;break}ia=c[S>>2]|0;do{if((c[M>>2]|0)>=(((ia|0)<0?0:ia)|0)){if((c[r>>2]|0)!=6){break}if((c[r+4>>2]|0)!=1){break}if((c[r+8>>2]|0)==0){ya=0;break b}}}while(0);c[z>>2]=-13;ya=-13}}while(0);ia=c[s+16>>2]|0;if((ia|0)<0){c[z>>2]=-14;ca=-14;break a}c:do{if((ia|0)>0){ra=c[S>>2]|0;do{if((c[N>>2]|0)>=(((ra|0)<0?0:ra)|0)){ma=c[O>>2]|0;if(!((ma|0)==0|(ma|0)==(ia|0))){break}if((c[s>>2]|0)!=6){break}if((c[s+4>>2]|0)!=1){break}if((c[s+8>>2]|0)==0){break c}}}while(0);c[z>>2]=-14;ca=-14;break a}}while(0);if((ya|0)!=0){ca=ya;break a}ia=rf(1)|0;ra=rf(2)|0;ma=c[y+4>>2]|0;if((c[ea>>2]|0)==2){ja=c[d+20>>2]|0;ua=kf(24)|0;Uf(ua,c[da>>2]|0,c[S>>2]|0,c[ja>>2]|0,c[ja+4>>2]|0,c[ja+8>>2]|0,c[ja+12>>2]|0,0,c[ga>>2]|0,c[ha>>2]|0);za=ua;Aa=V^1;Ba=V&1}else{za=d;Aa=V;Ba=c[U>>2]|0}if((T|0)!=1|R^1){Ca=W;Da=X}else{aa=+gg();wf(za,l,m,H,G,F,E);do{if((c[E>>2]|0)==0){xf(za,l,m,+h[H>>3],+h[G>>3],+h[F>>3],k);if((wg(k,9560)|0)==0){Ea=(wg(k,12384)|0)!=0|0}else{Ea=1}if((wg(k,9128)|0)!=0){Fa=1;Ga=Ea;break}Fa=(wg(k,12384)|0)!=0|0;Ga=Ea}else{Fa=W;Ga=X}}while(0);h[ma+32>>3]=+gg()-aa;Ca=Fa;Da=Ga}do{if(R){na=+gg();ha=c[b+8>>2]|0;do{if((ha|0)!=7){if((c[Q>>2]|0)!=0){break}kg(ha,za,e)}}while(0);h[ma>>3]=+gg()-na;qa=+gg();qg(b,za,e,j,B);h[ma+24>>3]=+gg()-qa;qa=+gg();Af(b,B,ra,ia,j,p,q,e,f,n,o,y,z);h[ma+56>>3]=+gg()-qa;if(!((q|0)==-1)){break}g[x+4>>2]=+((c[z>>2]|0)-(c[da>>2]|0)|0);i=A;return}}while(0);do{if((c[b+36>>2]|0)!=0){ia=c[z>>2]|0;ra=c[da>>2]|0;if((ia|0)<=0){h[t>>3]=+yf(ra,za,e,n,o);break}if((ia|0)>(ra|0)){i=A;return}h[t>>3]=+yf(ia,za,e,n,o);i=A;return}}while(0);ia=b+40|0;if((c[ia>>2]|0)!=0){aa=+gg();ra=C|0;a[ra]=Aa?49:73;uf(ra,n,o,+vf(ra,za),u,y,z);h[ma+80>>3]=+gg()-aa}do{if((P|0)>0){do{if(Aa){if((Da|0)==0){break}ra=c[S>>2]|0;ha=(ra|0)>0;ga=0;do{if(ha){ua=fa(ga,I)|0;ja=(ra|0)>1;ka=0;do{la=K+(ka+ua<<3)|0;h[la>>3]=+h[l+(ka<<3)>>3]*+h[la>>3];ka=ka+1|0;}while((ka|0)<(ra|0));Ha=ja?ra:1}else{Ha=0}ga=ga+1|0;}while((ga|0)<(P|0));c[D>>2]=Ha}else{if((Ca|0)==0){break}ga=c[S>>2]|0;ra=(ga|0)>0;ha=0;do{if(ra){ka=fa(ha,I)|0;ua=(ga|0)>1;la=0;do{va=K+(la+ka<<3)|0;h[va>>3]=+h[m+(la<<3)>>3]*+h[va>>3];la=la+1|0;}while((la|0)<(ga|0));Ia=ua?ga:1}else{Ia=0}ha=ha+1|0;}while((ha|0)<(P|0));c[D>>2]=Ia}}while(0);ha=c[r+12>>2]|0;if((ha|0)>0){ga=0;while(1){ra=fa(ga,I)|0;la=fa(ga,J)|0;ka=(ha|0)>1;ja=0;do{h[L+(ja+la<<3)>>3]=+h[K+(ja+ra<<3)>>3];ja=ja+1|0;}while((ja|0)<(ha|0));ja=ga+1|0;if((ja|0)<(P|0)){ga=ja}else{Ja=ka?ha:1;break}}}else{Ja=0}c[D>>2]=Ja;na=+gg();Bf(Ba,n,o,e,f,s,y,z);h[ma+88>>3]=+gg()-na;na=+gg();if((c[b+16>>2]|0)==0){ha=0;do{h[w+(ha<<3)>>3]=1.0;h[v+(ha<<3)>>3]=1.0;ha=ha+1|0;}while((ha|0)<(P|0))}else{zf(Ba,za,n,o,e,f,k,l,m,r,s,v,w,y,z)}h[ma+96>>3]=+gg()-na;if(Aa){if((Ca|0)==0){break}ha=c[S>>2]|0;if((ha|0)>0){ga=0;while(1){ja=fa(ga,J)|0;ra=(ha|0)>1;la=0;do{va=L+(la+ja<<3)|0;h[va>>3]=+h[m+(la<<3)>>3]*+h[va>>3];la=la+1|0;}while((la|0)<(ha|0));la=ga+1|0;if((la|0)<(P|0)){ga=la}else{Ka=ra?ha:1;break}}}else{Ka=0}c[D>>2]=Ka;break}else{if((Da|0)==0){break}ha=c[S>>2]|0;if((ha|0)>0){ga=0;while(1){la=fa(ga,J)|0;ja=(ha|0)>1;ka=0;do{va=L+(ka+la<<3)|0;h[va>>3]=+h[l+(ka<<3)>>3]*+h[va>>3];ka=ka+1|0;}while((ka|0)<(ha|0));ka=ga+1|0;if((ka|0)<(P|0)){ga=ka}else{La=ja?ha:1;break}}}else{La=0}c[D>>2]=La;break}}}while(0);do{if((c[ia>>2]|0)!=0){na=+h[u>>3];if(!(na<+$f(2992))){break}c[z>>2]=(c[da>>2]|0)+1}}while(0);if(R){Lf(n,o,x)|0;cf(B)}if((c[ea>>2]|0)!=2){i=A;return}$e(za);lf(za);i=A;return}}while(0);c[z>>2]=-2;ca=-2}}while(0);c[D>>2]=-ca;sf(3704,D)|0;i=A;return}function uf(b,d,e,f,g,j,k){b=b|0;d=d|0;e=e|0;f=+f;g=g|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0.0;l=i;i=i+280|0;m=l|0;n=l+8|0;o=l+16|0;p=l+24|0;c[k>>2]=0;do{if((a[b]|0)==49){q=1;r=5}else{if((wg(b,9320)|0)!=0){q=1;r=5;break}if((wg(b,12368)|0)!=0){q=2;r=5;break}c[k>>2]=-1;s=-1}}while(0);a:do{if((r|0)==5){b=d+12|0;t=c[b>>2]|0;do{if((t|0)>=0){if((t|0)!=(c[d+16>>2]|0)){break}if((c[d>>2]|0)!=3){break}if((c[d+4>>2]|0)!=1){break}if((c[d+8>>2]|0)!=1){break}u=c[e+12>>2]|0;do{if((u|0)>=0){if((u|0)!=(c[e+16>>2]|0)){break}if((c[e>>2]|0)!=0){break}if((c[e+4>>2]|0)!=1){break}if((c[e+8>>2]|0)!=4){break}v=c[k>>2]|0;if((v|0)!=0){s=v;break a}h[g>>3]=0.0;if((t|0)==0|(u|0)==0){h[g>>3]=1.0;i=l;return}v=Tf(t*3|0)|0;w=pf(c[b>>2]|0)|0;if((v|0)==0|(w|0)==0){x=p|0;ob(x|0,6480,(y=i,i=i+24|0,c[y>>2]=4872,c[y+8>>2]=117,c[y+16>>2]=3688,y)|0)|0;i=y;Ze(x)}h[o>>3]=0.0;c[m>>2]=0;do{_f(b,v+(c[b>>2]<<3)|0,v,w,o,m)|0;x=c[m>>2]|0;if((x|0)==0){break}if((x|0)==(q|0)){xg(2984,2144,1664,d,e,v,j,k)|0;xg(1112,2144,13512,d,e,v,j,k)|0}else{xg(1112,12880,13512,d,e,v,j,k)|0;xg(2984,12880,1664,d,e,v,j,k)|0}}while((c[m>>2]|0)!=0);z=+h[o>>3];if(z!=0.0){h[g>>3]=1.0/z/f}lf(v);lf(w);i=l;return}}while(0);c[k>>2]=-3;s=-3;break a}}while(0);c[k>>2]=-2;s=-2}}while(0);c[n>>2]=-s;sf(9056,n)|0;i=l;return}function vf(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0.0,q=0,r=0.0,s=0,t=0,u=0,v=0.0,w=0,x=0.0,y=0.0,z=0,A=0.0,B=0,C=0,D=0,E=0,F=0,G=0.0,H=0.0;e=i;i=i+768|0;f=e|0;g=e+256|0;j=e+512|0;k=c[d+20>>2]|0;l=c[k+4>>2]|0;m=d+12|0;n=c[m>>2]|0;o=d+16|0;d=c[o>>2]|0;if((((n|0)<(d|0)?n:d)|0)==0){p=0.0;i=e;return+p}if((wg(b,8976)|0)!=0){d=c[o>>2]|0;if((d|0)<=0){p=0.0;i=e;return+p}n=c[k+12>>2]|0;q=0;r=0.0;s=c[n>>2]|0;while(1){t=q+1|0;u=c[n+(t<<2)>>2]|0;if((s|0)<(u|0)){v=r;w=s;while(1){x=+U(+(+h[l+(w<<3)>>3]));y=v>x?v:x;z=w+1|0;if((z|0)<(u|0)){v=y;w=z}else{A=y;break}}}else{A=r}if((t|0)<(d|0)){q=t;r=A;s=u}else{p=A;break}}i=e;return+p}do{if((wg(b,12352)|0)==0){if((a[b]|0)==49){break}if((wg(b,9008)|0)==0){do{if((wg(b,2976)|0)==0){if((wg(b,2136)|0)!=0){break}s=j|0;ob(s|0,6448,(B=i,i=i+24|0,c[B>>2]=1088,c[B+8>>2]=114,c[B+16>>2]=3672,B)|0)|0;i=B;Ze(s);p=0.0;i=e;return+p}}while(0);u=g|0;ob(u|0,6448,(B=i,i=i+24|0,c[B>>2]=1640,c[B+8>>2]=112,c[B+16>>2]=3672,B)|0)|0;i=B;Ze(u);p=0.0;i=e;return+p}u=kf(c[m>>2]<<3)|0;t=u;if((u|0)==0){s=f|0;ob(s|0,6448,(B=i,i=i+24|0,c[B>>2]=4808,c[B+8>>2]=97,c[B+16>>2]=3672,B)|0)|0;i=B;Ze(s)}s=c[m>>2]|0;if((s|0)>0){Gq(u|0,0,((s|0)>1?s<<3:8)|0)|0}s=c[o>>2]|0;if((s|0)>0){q=c[k+12>>2]|0;d=k+8|0;n=0;w=c[q>>2]|0;while(1){z=n+1|0;C=c[q+(z<<2)>>2]|0;if((w|0)<(C|0)){D=c[d>>2]|0;E=w;do{A=+U(+(+h[l+(E<<3)>>3]));F=t+(c[D+(E<<2)>>2]<<3)|0;h[F>>3]=A+ +h[F>>3];E=E+1|0;}while((E|0)<(C|0))}if((z|0)<(s|0)){n=z;w=C}else{break}}}w=c[m>>2]|0;if((w|0)>0){A=0.0;n=0;while(1){r=+h[t+(n<<3)>>3];v=A>r?A:r;s=n+1|0;if((s|0)<(w|0)){A=v;n=s}else{G=v;break}}}else{G=0.0}lf(u);p=G;i=e;return+p}}while(0);m=c[o>>2]|0;if((m|0)<=0){p=0.0;i=e;return+p}o=c[k+12>>2]|0;k=0;G=0.0;B=c[o>>2]|0;while(1){f=k+1|0;g=c[o+(f<<2)>>2]|0;if((B|0)<(g|0)){A=0.0;j=B;while(1){v=A+ +U(+(+h[l+(j<<3)>>3]));b=j+1|0;if((b|0)<(g|0)){A=v;j=b}else{H=v;break}}}else{H=0.0}A=G>H?G:H;if((f|0)<(m|0)){k=f;G=A;B=g}else{p=A;break}}i=e;return+p}function wf(a,b,d,e,f,g,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0.0,t=0.0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0.0,J=0.0,K=0,L=0,M=0.0,N=0.0,O=0.0,P=0,Q=0,R=0.0,S=0.0,T=0.0,V=0,W=0,X=0,Y=0,Z=0.0,_=0.0,$=0,aa=0,ba=0,ca=0;k=i;l=d;m=i;i=i+4|0;i=i+7&-8;c[j>>2]=0;n=a+12|0;o=c[n>>2]|0;do{if((o|0)>=0){p=a+16|0;q=c[p>>2]|0;if((q|0)<0){break}if((c[a>>2]|0)!=0){break}if((c[a+4>>2]|0)!=1){break}if((c[a+8>>2]|0)!=0){break}if((o|0)==0|(q|0)==0){h[e>>3]=1.0;h[f>>3]=1.0;h[g>>3]=0.0;i=k;return}q=c[a+20>>2]|0;r=c[q+4>>2]|0;s=+$f(12192);t=1.0/s;c[m>>2]=0;u=c[n>>2]|0;v=(u|0)>0;if(v){w=(u|0)>1;x=0;do{h[b+(x<<3)>>3]=0.0;x=x+1|0;}while((x|0)<(u|0));c[m>>2]=w?u:1}x=c[p>>2]|0;y=(x|0)>0;if(y){z=q+12|0;A=q+8|0;B=0;C=c[z>>2]|0;while(1){D=c[C+(B<<2)>>2]|0;c[m>>2]=D;E=B+1|0;F=c[z>>2]|0;if((D|0)<(c[F+(E<<2)>>2]|0)){G=c[A>>2]|0;H=D;while(1){D=b+(c[G+(H<<2)>>2]<<3)|0;I=+h[D>>3];J=+U(+(+h[r+(H<<3)>>3]));h[D>>3]=I>J?I:J;D=H+1|0;c[m>>2]=D;K=c[z>>2]|0;if((D|0)<(c[K+(E<<2)>>2]|0)){H=D}else{L=K;break}}}else{L=F}if((E|0)<(x|0)){B=E;C=L}else{break}}}c[m>>2]=0;if(v){C=(u|0)>1;B=0;J=t;I=0.0;do{M=+h[b+(B<<3)>>3];I=I>M?I:M;J=J<M?J:M;B=B+1|0;}while((B|0)<(u|0));c[m>>2]=C?u:1;N=J;O=I}else{N=t;O=0.0}h[g>>3]=O;c[m>>2]=0;a:do{if(N==0.0){if(v){P=0}else{break}while(1){Q=P+1|0;if(+h[b+(P<<3)>>3]==0.0){break}c[m>>2]=Q;if((Q|0)<(u|0)){P=Q}else{break a}}c[j>>2]=Q;i=k;return}else{if(v){E=(u|0)>1;F=0;do{M=+h[b+(F<<3)>>3];R=M>s?M:s;h[b+(F<<3)>>3]=1.0/(R<t?R:t);F=F+1|0;}while((F|0)<(u|0));c[m>>2]=E?u:1}h[e>>3]=(N>s?N:s)/(O<t?O:t)}}while(0);do{if(y){Gq(l|0,0,((x|0)>1?x<<3:8)|0)|0;u=c[p>>2]|0;v=(u|0)>0;if(!v){S=t;T=0.0;V=0;W=u;break}C=q+12|0;F=q+8|0;B=0;z=c[C>>2]|0;while(1){A=c[z+(B<<2)>>2]|0;c[m>>2]=A;w=B+1|0;H=c[C>>2]|0;if((A|0)<(c[H+(w<<2)>>2]|0)){G=c[F>>2]|0;K=d+(B<<3)|0;D=A;I=+h[K>>3];while(1){J=+U(+(+h[r+(D<<3)>>3]));R=J*+h[b+(c[G+(D<<2)>>2]<<3)>>3];J=I>R?I:R;h[K>>3]=J;A=D+1|0;c[m>>2]=A;X=c[C>>2]|0;if((A|0)<(c[X+(w<<2)>>2]|0)){D=A;I=J}else{Y=X;break}}}else{Y=H}if((w|0)<(u|0)){B=w;z=Y}else{break}}if(v){Z=t;_=0.0;$=0}else{S=t;T=0.0;V=0;W=u;break}while(1){I=+h[d+($<<3)>>3];J=_>I?_:I;R=Z<I?Z:I;z=$+1|0;if((z|0)<(u|0)){Z=R;_=J;$=z}else{S=R;T=J;V=1;W=u;break}}}else{S=t;T=0.0;V=0;W=x}}while(0);if(S==0.0){aa=0}else{if(V){x=0;do{r=d+(x<<3)|0;J=+h[r>>3];R=J>s?J:s;h[r>>3]=1.0/(R<t?R:t);x=x+1|0;}while((x|0)<(W|0))}h[f>>3]=(S>s?S:s)/(T<t?T:t);i=k;return}while(1){if((aa|0)>=(W|0)){ba=49;break}ca=aa+1|0;if(+h[d+(aa<<3)>>3]==0.0){break}else{aa=ca}}if((ba|0)==49){i=k;return}c[j>>2]=ca+(c[n>>2]|0);i=k;return}}while(0);c[j>>2]=-1;c[m>>2]=1;sf(8376,m)|0;i=k;return}function xf(b,d,e,f,g,i,j){b=b|0;d=d|0;e=e|0;f=+f;g=+g;i=+i;j=j|0;var k=0,l=0,m=0,n=0.0,o=0.0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;do{if((c[b+12>>2]|0)>=1){k=b+16|0;if((c[k>>2]|0)<1){break}l=c[b+20>>2]|0;m=c[l+4>>2]|0;n=+$f(8112);o=n/+$f(12136);p=g<.1;if(!(f<.1|o>i|1.0/o<i)){if(!p){a[j]=78;return}q=c[k>>2]|0;if((q|0)>0){r=c[l+12>>2]|0;s=0;t=c[r>>2]|0;while(1){o=+h[e+(s<<3)>>3];u=s+1|0;v=c[r+(u<<2)>>2]|0;if((t|0)<(v|0)){w=t;do{x=m+(w<<3)|0;h[x>>3]=o*+h[x>>3];w=w+1|0;}while((w|0)<(v|0))}if((u|0)<(q|0)){s=u;t=v}else{break}}}a[j]=67;return}t=c[k>>2]|0;s=(t|0)>0;if(p){if(s){q=c[l+12>>2]|0;r=l+8|0;w=0;x=c[q>>2]|0;while(1){o=+h[e+(w<<3)>>3];y=w+1|0;z=c[q+(y<<2)>>2]|0;if((x|0)<(z|0)){A=c[r>>2]|0;B=x;do{C=m+(B<<3)|0;h[C>>3]=+h[C>>3]*o*+h[d+(c[A+(B<<2)>>2]<<3)>>3];B=B+1|0;}while((B|0)<(z|0))}if((y|0)<(t|0)){w=y;x=z}else{break}}}a[j]=66;return}else{if(s){x=c[l+12>>2]|0;w=l+8|0;r=0;q=c[x>>2]|0;while(1){p=r+1|0;k=c[x+(p<<2)>>2]|0;if((q|0)<(k|0)){B=c[w>>2]|0;A=q;do{v=m+(A<<3)|0;h[v>>3]=+h[d+(c[B+(A<<2)>>2]<<3)>>3]*+h[v>>3];A=A+1|0;}while((A|0)<(k|0))}if((p|0)<(t|0)){r=p;q=k}else{break}}}a[j]=82;return}}}while(0);a[j]=78;return}function yf(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0.0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0.0,r=0.0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0.0,G=0.0,H=0.0,I=0.0,J=0,K=0.0,L=0.0,M=0.0,N=0.0,O=0;g=1.0/+$f(8064);i=c[b+20>>2]|0;j=c[e+20>>2]|0;e=c[f+20>>2]|0;f=c[i+4>>2]|0;k=c[j+8>>2]|0;l=c[e+4>>2]|0;m=b+16|0;b=kf(c[m>>2]<<2)|0;n=b;if((c[m>>2]|0)>0){o=0;do{c[n+(c[d+(o<<2)>>2]<<2)>>2]=o;o=o+1|0;}while((o|0)<(c[m>>2]|0))}m=c[j+4>>2]|0;o=j+28|0;d=j+20|0;p=j+12|0;j=i+12|0;i=e+12|0;q=g;e=0;while(1){if((e|0)>(m|0)){r=q;s=18;break}t=c[o>>2]|0;u=c[t+(e<<2)>>2]|0;v=c[d>>2]|0;w=(c[v+(u+1<<2)>>2]|0)-(c[v+(u<<2)>>2]|0)|0;v=e+1|0;x=c[t+(v<<2)>>2]|0;t=(u|0)<(a|0);if((u|0)<(x|0)&t){y=c[j>>2]|0;z=c[i>>2]|0;A=u;g=q;B=1;C=k+(c[(c[p>>2]|0)+(u<<2)>>2]<<3)|0;while(1){u=c[n+(A<<2)>>2]|0;D=c[y+(u<<2)>>2]|0;E=c[y+(u+1<<2)>>2]|0;if((D|0)<(E|0)){u=D;F=0.0;while(1){G=+U(+(+h[f+(u<<3)>>3]));H=F>G?F:G;D=u+1|0;if((D|0)<(E|0)){u=D;F=H}else{I=H;break}}}else{I=0.0}u=c[z+(A<<2)>>2]|0;E=A+1|0;D=c[z+(E<<2)>>2]|0;if((u|0)<(D|0)){J=u;F=0.0;while(1){H=+U(+(+h[l+(J<<3)>>3]));G=F>H?F:H;u=J+1|0;if((u|0)<(D|0)){J=u;F=G}else{K=G;break}}}else{K=0.0}if((B|0)>0){J=0;F=K;while(1){G=+U(+(+h[C+(J<<3)>>3]));H=F>G?F:G;D=J+1|0;if((D|0)<(B|0)){J=D;F=H}else{L=H;break}}}else{L=K}if(L==0.0){M=g<1.0?g:1.0}else{F=I/L;M=g<F?g:F}J=(E|0)<(a|0);if((E|0)<(x|0)&J){A=E;g=M;B=B+1|0;C=C+(w<<3)|0}else{N=M;O=J;break}}}else{N=q;O=t}if(O){q=N;e=v}else{r=N;s=18;break}}if((s|0)==18){lf(b);return+r}return 0.0}function zf(b,d,e,f,g,j,k,l,m,n,o,p,q,r,s){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;var t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0.0,ga=0.0,ha=0.0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0.0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0.0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0.0,Oa=0,Pa=0,Qa=0.0,Ra=0,Sa=0.0,Ta=0,Ua=0.0,Va=0.0,Wa=0,Xa=0.0,Ya=0,Za=0.0,_a=0,$a=0.0,ab=0;t=i;i=i+576|0;u=t|0;v=t+8|0;w=t+16|0;x=t+40|0;y=t+48|0;z=t+56|0;A=t+64|0;B=t+320|0;c[u>>2]=1;h[v>>3]=1.0;C=c[d+20>>2]|0;D=c[C+4>>2]|0;E=c[n+20>>2]|0;F=c[o+20>>2]|0;G=c[E+4>>2]|0;H=c[F+4>>2]|0;I=c[E>>2]|0;E=c[F>>2]|0;F=c[n+16>>2]|0;c[s>>2]=0;J=(b|0)==0;K=J^1;a:do{if((b-1|0)>>>0>1>>>0&K){c[s>>2]=-1;L=-1}else{M=d+12|0;N=c[M>>2]|0;O=d+16|0;do{if(!((N|0)!=(c[O>>2]|0)|(N|0)<0)){if((c[d>>2]|0)!=0){break}if((c[d+4>>2]|0)!=1){break}if((c[d+8>>2]|0)!=0){break}P=c[e+12>>2]|0;do{if(!((P|0)!=(c[e+16>>2]|0)|(P|0)<0)){if((c[e>>2]|0)!=3){break}if((c[e+4>>2]|0)!=1){break}if((c[e+8>>2]|0)!=1){break}Q=c[f+12>>2]|0;do{if(!((Q|0)!=(c[f+16>>2]|0)|(Q|0)<0)){if((c[f>>2]|0)!=0){break}if((c[f+4>>2]|0)!=1){break}if((c[f+8>>2]|0)!=4){break}do{if((I|0)>=(N|0)){R=n|0;if((c[R>>2]|0)!=6){break}S=n+4|0;if((c[S>>2]|0)!=1){break}T=n+8|0;if((c[T>>2]|0)!=0){break}do{if((E|0)>=(N|0)){if((c[o>>2]|0)!=6){break}if((c[o+4>>2]|0)!=1){break}if((c[o+8>>2]|0)!=0){break}if((N|0)==0|(F|0)==0){if((F|0)>0){V=0}else{i=t;return}do{h[p+(V<<3)>>3]=0.0;h[q+(V<<3)>>3]=0.0;V=V+1|0;}while((V|0)<(F|0));i=t;return}if((wg(k,12112)|0)==0){W=(wg(k,8984)|0)==0}else{W=0}if((wg(k,6440)|0)==0){X=(wg(k,8984)|0)==0}else{X=0}Y=Sf(c[M>>2]<<1)|0;Z=kf(c[M>>2]<<3)|0;_=Z;$=pf(c[M>>2]<<1)|0;if((Y|0)==0|(Z|0)==0|($|0)==0){aa=A|0;ob(aa|0,4776,(ba=i,i=i+24|0,c[ba>>2]=3632,c[ba+8>>2]=222,c[ba+16>>2]=2960,ba)|0)|0;i=ba;Ze(aa)}aa=z|0;ca=J&1;a[aa]=J?78:84;da=(c[O>>2]|0)+1|0;ea=+$f(2128);ga=+(da|0)*+$f(1624);ha=ga/ea;c[y>>2]=0;if((c[M>>2]|0)>0){da=0;do{c[$+(da<<2)>>2]=0;da=(c[y>>2]|0)+1|0;c[y>>2]=da;}while((da|0)<(c[M>>2]|0))}da=c[O>>2]|0;ia=(da|0)>0;do{if(J){if(!ia){break}ja=C+12|0;ka=C+8|0;la=0;ma=c[ja>>2]|0;na=da;while(1){oa=c[ma+(la<<2)>>2]|0;c[y>>2]=oa;pa=la+1|0;qa=c[ja>>2]|0;if((oa|0)<(c[qa+(pa<<2)>>2]|0)){ra=c[ka>>2]|0;sa=oa;do{oa=$+(c[ra+(sa<<2)>>2]<<2)|0;c[oa>>2]=(c[oa>>2]|0)+1;sa=(c[y>>2]|0)+1|0;c[y>>2]=sa;ta=c[ja>>2]|0;}while((sa|0)<(c[ta+(pa<<2)>>2]|0));ua=ta;va=c[O>>2]|0}else{ua=qa;va=na}if((pa|0)<(va|0)){la=pa;ma=ua;na=va}else{break}}}else{if(!ia){break}na=c[C+12>>2]|0;ma=0;while(1){la=ma+1|0;c[$+(ma<<2)>>2]=(c[na+(la<<2)>>2]|0)-(c[na+(ma<<2)>>2]|0);if((la|0)<(c[O>>2]|0)){ma=la}else{break}}}}while(0);c[w>>2]=c[R>>2];c[w+4>>2]=c[S>>2];c[w+8>>2]=c[T>>2];c[w+12>>2]=c[n+12>>2];c[w+16>>2]=1;ia=kf(8)|0;da=w+20|0;c[da>>2]=ia;if((ia|0)==0){ma=B|0;ob(ma|0,4776,(ba=i,i=i+24|0,c[ba>>2]=1048,c[ba+8>>2]=259,c[ba+16>>2]=2960,ba)|0)|0;i=ba;Ze(ma);wa=c[da>>2]|0}else{wa=ia}c[wa>>2]=I;ia=Y;c[wa+4>>2]=ia;if((F|0)>0){ma=C+12|0;na=C+8|0;la=r+16|0;ja=X|K;ka=J|W;sa=0;do{ra=fa(sa,I)|0;oa=G+(ra<<3)|0;xa=fa(sa,E)|0;ya=H+(xa<<3)|0;za=q+(sa<<3)|0;Aa=0;Ba=3.0;while(1){Eg(M,oa,u,Y,u)|0;Ca=c[u>>2]|0;yg(aa,-1.0,d,ya,Ca,+h[v>>3],Y,Ca)|0;c[y>>2]=0;Ca=c[M>>2]|0;Da=(Ca|0)>0;if(Da){Ea=(Ca|0)>1;Fa=0;do{h[_+(Fa<<3)>>3]=+U(+(+h[G+(Fa+ra<<3)>>3]));Fa=Fa+1|0;}while((Fa|0)<(Ca|0));c[y>>2]=Ea?Ca:1}Fa=c[O>>2]|0;pa=(Fa|0)>0;do{if(J){if(!pa){break}qa=0;Ga=c[ma>>2]|0;while(1){Ha=+U(+(+h[H+(qa+xa<<3)>>3]));Ia=c[Ga+(qa<<2)>>2]|0;c[y>>2]=Ia;Ja=qa+1|0;Ka=c[ma>>2]|0;if((Ia|0)<(c[Ka+(Ja<<2)>>2]|0)){La=c[na>>2]|0;Ma=Ia;while(1){Na=Ha*+U(+(+h[D+(Ma<<3)>>3]));Ia=_+(c[La+(Ma<<2)>>2]<<3)|0;h[Ia>>3]=Na+ +h[Ia>>3];Ia=Ma+1|0;c[y>>2]=Ia;Oa=c[ma>>2]|0;if((Ia|0)<(c[Oa+(Ja<<2)>>2]|0)){Ma=Ia}else{Pa=Oa;break}}}else{Pa=Ka}if((Ja|0)<(Fa|0)){qa=Ja;Ga=Pa}else{break}}}else{if(!pa){break}Ga=0;qa=c[ma>>2]|0;while(1){Ma=c[qa+(Ga<<2)>>2]|0;c[y>>2]=Ma;La=Ga+1|0;Oa=c[ma>>2]|0;if((Ma|0)<(c[Oa+(La<<2)>>2]|0)){Ia=Ma;Ha=0.0;while(1){Na=+U(+(+h[D+(Ia<<3)>>3]));Qa=Ha+Na*+U(+(+h[H+((c[(c[na>>2]|0)+(Ia<<2)>>2]|0)+xa<<3)>>3]));Ma=Ia+1|0;c[y>>2]=Ma;Ra=c[ma>>2]|0;if((Ma|0)<(c[Ra+(La<<2)>>2]|0)){Ia=Ma;Ha=Qa}else{Sa=Qa;Ta=Ra;break}}}else{Sa=0.0;Ta=Oa}Ia=_+(Ga<<3)|0;h[Ia>>3]=Sa+ +h[Ia>>3];if((La|0)<(Fa|0)){Ga=La;qa=Ta}else{break}}}}while(0);c[y>>2]=0;if(Da){Fa=(Ca|0)>1;Ha=0.0;pa=0;while(1){Qa=+h[_+(pa<<3)>>3];do{if(Qa>ha){Na=+U(+(+h[Y+(pa<<3)>>3]))/Qa;Ua=Ha>Na?Ha:Na}else{if(!(Qa!=0.0)){Ua=Ha;break}Na=(ga+ +U(+(+h[Y+(pa<<3)>>3])))/Qa;Ua=Ha>Na?Ha:Na}}while(0);Ea=pa+1|0;if((Ea|0)<(Ca|0)){Ha=Ua;pa=Ea}else{break}}c[y>>2]=Fa?Ca:1;Va=Ua}else{Va=0.0}h[za>>3]=Va;if(!(Va*2.0<=Ba&Va>ea&(Aa|0)<5)){break}Bf(b,e,f,g,j,w,r,s);Dg(M,v,Y,u,ya,u)|0;Aa=Aa+1|0;Ba=+h[za>>3]}c[la>>2]=Aa;c[y>>2]=0;za=c[M>>2]|0;ya=(za|0)>0;if(ya){oa=(za|0)>1;pa=0;do{h[_+(pa<<3)>>3]=+U(+(+h[G+(pa+ra<<3)>>3]));pa=pa+1|0;}while((pa|0)<(za|0));c[y>>2]=oa?za:1}pa=c[O>>2]|0;ra=(pa|0)>0;do{if(J){if(!ra){break}Aa=0;Da=c[ma>>2]|0;while(1){Ba=+U(+(+h[H+(Aa+xa<<3)>>3]));Ea=c[Da+(Aa<<2)>>2]|0;c[y>>2]=Ea;qa=Aa+1|0;Ga=c[ma>>2]|0;if((Ea|0)<(c[Ga+(qa<<2)>>2]|0)){Ia=c[na>>2]|0;Ja=Ea;while(1){Ha=Ba*+U(+(+h[D+(Ja<<3)>>3]));Ea=_+(c[Ia+(Ja<<2)>>2]<<3)|0;h[Ea>>3]=Ha+ +h[Ea>>3];Ea=Ja+1|0;c[y>>2]=Ea;Ka=c[ma>>2]|0;if((Ea|0)<(c[Ka+(qa<<2)>>2]|0)){Ja=Ea}else{Wa=Ka;break}}}else{Wa=Ga}if((qa|0)<(pa|0)){Aa=qa;Da=Wa}else{break}}}else{if(!ra){break}Da=0;Aa=c[ma>>2]|0;while(1){Ca=c[Aa+(Da<<2)>>2]|0;c[y>>2]=Ca;Fa=Da+1|0;Ja=c[ma>>2]|0;if((Ca|0)<(c[Ja+(Fa<<2)>>2]|0)){Ia=Ca;Ba=0.0;while(1){Ha=+U(+(+h[H+((c[(c[na>>2]|0)+(Ia<<2)>>2]|0)+xa<<3)>>3]));Qa=Ba+Ha*+U(+(+h[D+(Ia<<3)>>3]));Ca=Ia+1|0;c[y>>2]=Ca;Ka=c[ma>>2]|0;if((Ca|0)<(c[Ka+(Fa<<2)>>2]|0)){Ia=Ca;Ba=Qa}else{Xa=Qa;Ya=Ka;break}}}else{Xa=0.0;Ya=Ja}Ia=_+(Da<<3)|0;h[Ia>>3]=Xa+ +h[Ia>>3];if((Fa|0)<(pa|0)){Da=Fa;Aa=Ya}else{break}}}}while(0);c[y>>2]=0;if(ya){pa=0;while(1){ra=_+(pa<<3)|0;Ba=+h[ra>>3];Qa=+U(+(+h[Y+(pa<<3)>>3]));Ha=Qa+Ba*ea*+((c[$+(pa<<2)>>2]|0)+1|0);if(Ba>ha){Za=Ha}else{Za=ga+Ha}h[ra>>3]=Za;ra=pa+1|0;c[y>>2]=ra;oa=c[M>>2]|0;if((ra|0)<(oa|0)){pa=ra}else{_a=oa;break}}}else{_a=za}c[x>>2]=0;pa=p+(sa<<3)|0;ya=_a;b:while(1){_f(M,Y+(ya<<3)|0,Y,$+(ya<<2)|0,pa,x)|0;oa=c[x>>2]|0;do{if((oa|0)==0){break b}else if((oa|0)==1){do{if(ja){if(ka){break}c[y>>2]=0;ra=c[M>>2]|0;if((ra|0)<=0){break}Aa=(ra|0)>1;Da=0;do{Ia=Y+(Da<<3)|0;h[Ia>>3]=+h[l+(Da<<3)>>3]*+h[Ia>>3];Da=Da+1|0;}while((Da|0)<(ra|0));c[y>>2]=Aa?ra:1}else{c[y>>2]=0;Da=c[O>>2]|0;if((Da|0)<=0){break}La=(Da|0)>1;Oa=0;do{Ia=Y+(Oa<<3)|0;h[Ia>>3]=+h[m+(Oa<<3)>>3]*+h[Ia>>3];Oa=Oa+1|0;}while((Oa|0)<(Da|0));c[y>>2]=La?Da:1}}while(0);Bf(ca,e,f,g,j,w,r,s);c[y>>2]=0;Fa=c[M>>2]|0;if((Fa|0)<=0){break}Ja=(Fa|0)>1;Oa=0;do{ra=Y+(Oa<<3)|0;h[ra>>3]=+h[_+(Oa<<3)>>3]*+h[ra>>3];Oa=Oa+1|0;}while((Oa|0)<(Fa|0));c[y>>2]=Ja?Fa:1}else{c[y>>2]=0;Oa=c[M>>2]|0;if((Oa|0)>0){ra=(Oa|0)>1;Aa=0;do{Ia=Y+(Aa<<3)|0;h[Ia>>3]=+h[_+(Aa<<3)>>3]*+h[Ia>>3];Aa=Aa+1|0;}while((Aa|0)<(Oa|0));c[y>>2]=ra?Oa:1}Bf(b,e,f,g,j,w,r,s);if(!ja){c[y>>2]=0;Aa=c[O>>2]|0;if((Aa|0)<=0){break}Fa=(Aa|0)>1;Ja=0;do{Ia=Y+(Ja<<3)|0;h[Ia>>3]=+h[m+(Ja<<3)>>3]*+h[Ia>>3];Ja=Ja+1|0;}while((Ja|0)<(Aa|0));c[y>>2]=Fa?Aa:1;break}if(ka){break}c[y>>2]=0;Ja=c[O>>2]|0;if((Ja|0)<=0){break}Oa=(Ja|0)>1;ra=0;do{Ia=Y+(ra<<3)|0;h[Ia>>3]=+h[l+(ra<<3)>>3]*+h[Ia>>3];ra=ra+1|0;}while((ra|0)<(Ja|0));c[y>>2]=Oa?Ja:1}}while(0);if((c[x>>2]|0)==0){break}ya=c[M>>2]|0}c[y>>2]=0;ya=c[M>>2]|0;za=(ya|0)>0;do{if(ja){if(ka){if(!za){break}oa=(ya|0)>1;ra=0;Ha=0.0;do{Ba=+U(+(+h[H+(ra+xa<<3)>>3]));Ha=Ha>Ba?Ha:Ba;ra=ra+1|0;}while((ra|0)<(ya|0));c[y>>2]=oa?ya:1;$a=Ha;ab=148;break}else{if(!za){break}ra=(ya|0)>1;Aa=0;Ba=0.0;do{Qa=+h[l+(Aa<<3)>>3]*+U(+(+h[H+(Aa+xa<<3)>>3]));Ba=Ba>Qa?Ba:Qa;Aa=Aa+1|0;}while((Aa|0)<(ya|0));c[y>>2]=ra?ya:1;$a=Ba;ab=148;break}}else{if(!za){break}Aa=(ya|0)>1;oa=0;Ha=0.0;do{Qa=+h[m+(oa<<3)>>3]*+U(+(+h[H+(oa+xa<<3)>>3]));Ha=Ha>Qa?Ha:Qa;oa=oa+1|0;}while((oa|0)<(ya|0));c[y>>2]=Aa?ya:1;$a=Ha;ab=148}}while(0);do{if((ab|0)==148){ab=0;if(!($a!=0.0)){break}h[pa>>3]=+h[pa>>3]/$a}}while(0);sa=sa+1|0;}while((sa|0)<(F|0))}lf(ia);lf(Z);lf($);lf(c[da>>2]|0);i=t;return}}while(0);c[s>>2]=-11;L=-11;break a}}while(0);c[s>>2]=-10;L=-10;break a}}while(0);c[s>>2]=-4;L=-4;break a}}while(0);c[s>>2]=-3;L=-3;break a}}while(0);c[s>>2]=-2;L=-2}}while(0);c[y>>2]=-L;sf(7904,y)|0;i=t;return}function Af(a,b,d,e,f,j,k,l,m,n,o,p,q){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;var r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0.0,L=0,M=0.0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0;r=i;i=i+144|0;s=r|0;t=r+8|0;u=r+16|0;v=r+24|0;w=r+32|0;x=r+40|0;y=r+48|0;z=r+56|0;A=r+64|0;B=r+72|0;C=r+80|0;D=r+88|0;E=r+96|0;F=r+104|0;G=r+112|0;H=r+120|0;I=r+128|0;J=r+136|0;K=+(rf(6)|0);L=c[a>>2]|0;M=+h[a+24>>3];N=c[p>>2]|0;O=c[p+8>>2]|0;P=b+12|0;Q=c[P>>2]|0;R=c[b+16>>2]|0;S=(Q|0)<(R|0)?Q:R;T=c[b+20>>2]|0;U=c[T+4>>2]|0;V=c[T+8>>2]|0;W=c[T+12>>2]|0;X=c[T+16>>2]|0;Y=Mf(L,j,k,Q,R,c[T>>2]|0,e,K,n,o,23864,s,t)|0;c[q>>2]=Y;if((Y|0)!=0){i=r;return}Y=c[5966]|0;T=c[5967]|0;k=c[5969]|0;j=c[5971]|0;Z=c[5974]|0;mf(Q,R,e,c[s>>2]|0,u,w,x,v,y,z,A);Pf(Q,e,c[t>>2]|0,B,C);_=(L|0)==2;c[H>>2]=_&1;do{if(_){L=pf(Q)|0;if((Q|0)>0){$=0}else{aa=L;ba=1;break}while(1){c[L+(c[m+($<<2)>>2]<<2)>>2]=$;ca=$+1|0;if((ca|0)<(Q|0)){$=ca}else{aa=L;ba=1;break}}}else{aa=0;ba=0}}while(0);$=pf(R)|0;if((R|0)>0){L=0;do{c[$+(c[l+(L<<2)>>2]<<2)>>2]=L;L=L+1|0;}while((L|0)<(R|0))}L=pf(R)|0;l=c[A>>2]|0;if((c[a+32>>2]|0)==1){sg(R,f,d,l,L)}else{rg(R,f,d,l,L)}jf(m