diff --git a/examples/n-body/assembly/index.ts b/examples/n-body/assembly/index.ts index 5b689cc5..735deadc 100644 --- a/examples/n-body/assembly/index.ts +++ b/examples/n-body/assembly/index.ts @@ -120,7 +120,7 @@ class NBodySystem { let dz = iz - bodyj.z; let distanceSq = dx * dx + dy * dy + dz * dz; - let distance = sqrt(distanceSq); + let distance = Math.sqrt(distanceSq); let mag = dt / (distanceSq * distance); let bim = bodyim * mag; @@ -170,7 +170,7 @@ class NBodySystem { let dx = ix - bodyj.x; let dy = iy - bodyj.y; let dz = iz - bodyj.z; - let distance = sqrt(dx * dx + dy * dy + dz * dz); + let distance = Math.sqrt(dx * dx + dy * dy + dz * dz); e -= bim * bodyj.mass / distance; } } @@ -178,17 +178,21 @@ class NBodySystem { } } -var bodies = new Array(); -bodies.push(Sun()); -bodies.push(Jupiter()); -bodies.push(Saturn()); -bodies.push(Uranus()); -bodies.push(Neptune()); +var system: NBodySystem; -var system = new NBodySystem(bodies); +export function init(): void { + var bodies = new Array(); + bodies.push(Sun()); + bodies.push(Jupiter()); + bodies.push(Saturn()); + bodies.push(Uranus()); + bodies.push(Neptune()); + system = new NBodySystem(bodies); +} export function getBody(index: i32): Body | null { - return index < bodies.length ? bodies[index] : null; + var bodies = system.bodies; + return index < bodies.length ? bodies[index] : null; } export function step(): f64 { @@ -196,7 +200,6 @@ export function step(): f64 { return system.energy(); } -export function bench(steps: i32): f64 { - for (let i = 0; i < steps; i++) system.advance(0.01); - return system.energy(); +export function bench(steps: u32): void { + for (let i: u32 = 0; i < steps; i++) system.advance(0.01); } diff --git a/examples/n-body/assembly/tsconfig.json b/examples/n-body/assembly/tsconfig.json index f45d47d2..449ca07c 100644 --- a/examples/n-body/assembly/tsconfig.json +++ b/examples/n-body/assembly/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../std/assembly.d.ts", + "extends": "../../../std/assembly.json", "include": [ "./**/*.ts" ] diff --git a/examples/n-body/build/index.js b/examples/n-body/build/index.js new file mode 100644 index 00000000..f5cca780 --- /dev/null +++ b/examples/n-body/build/index.js @@ -0,0 +1,142 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +require("allocator/arena"); +const SOLAR_MASS = 4.0 * Math.PI * Math.PI; +const DAYS_PER_YEAR = 365.24; +class Body { + constructor(x, y, z, vx, vy, vz, mass) { + this.x = x; + this.y = y; + this.z = z; + this.vx = vx; + this.vy = vy; + this.vz = vz; + this.mass = mass; + } + offsetMomentum(px, py, pz) { + this.vx = -px / SOLAR_MASS; + this.vy = -py / SOLAR_MASS; + this.vz = -pz / SOLAR_MASS; + return this; + } +} +function Sun() { + return new Body(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SOLAR_MASS); +} +function Jupiter() { + return new Body(4.84143144246472090e+00, -1.16032004402742839e+00, -1.03622044471123109e-01, 1.66007664274403694e-03 * DAYS_PER_YEAR, 7.69901118419740425e-03 * DAYS_PER_YEAR, -6.90460016972063023e-05 * DAYS_PER_YEAR, 9.54791938424326609e-04 * SOLAR_MASS); +} +function Saturn() { + return new Body(8.34336671824457987e+00, 4.12479856412430479e+00, -4.03523417114321381e-01, -2.76742510726862411e-03 * DAYS_PER_YEAR, 4.99852801234917238e-03 * DAYS_PER_YEAR, 2.30417297573763929e-05 * DAYS_PER_YEAR, 2.85885980666130812e-04 * SOLAR_MASS); +} +function Uranus() { + return new Body(1.28943695621391310e+01, -1.51111514016986312e+01, -2.23307578892655734e-01, 2.96460137564761618e-03 * DAYS_PER_YEAR, 2.37847173959480950e-03 * DAYS_PER_YEAR, -2.96589568540237556e-05 * DAYS_PER_YEAR, 4.36624404335156298e-05 * SOLAR_MASS); +} +function Neptune() { + return new Body(1.53796971148509165e+01, -2.59193146099879641e+01, 1.79258772950371181e-01, 2.68067772490389322e-03 * DAYS_PER_YEAR, 1.62824170038242295e-03 * DAYS_PER_YEAR, -9.51592254519715870e-05 * DAYS_PER_YEAR, 5.15138902046611451e-05 * SOLAR_MASS); +} +class NBodySystem { + constructor(bodies) { + var px = 0.0; + var py = 0.0; + var pz = 0.0; + var size = bodies.length; + for (let i = 0; i < size; i++) { + let b = bodies[i]; + let m = b.mass; + px += b.vx * m; + py += b.vy * m; + pz += b.vz * m; + } + this.bodies = bodies; + this.bodies[0].offsetMomentum(px, py, pz); + } + advance(dt) { + var bodies = this.bodies; + var size = bodies.length; + for (let i = 0; i < size; ++i) { + let bodyi = bodies[i]; + let ix = bodyi.x; + let iy = bodyi.y; + let iz = bodyi.z; + let bivx = bodyi.vx; + let bivy = bodyi.vy; + let bivz = bodyi.vz; + let bodyim = bodyi.mass; + for (let j = i + 1; j < size; ++j) { + let bodyj = bodies[j]; + let dx = ix - bodyj.x; + let dy = iy - bodyj.y; + let dz = iz - bodyj.z; + let distanceSq = dx * dx + dy * dy + dz * dz; + let distance = Math.sqrt(distanceSq); + let mag = dt / (distanceSq * distance); + let bim = bodyim * mag; + let bjm = bodyj.mass * mag; + bivx -= dx * bjm; + bivy -= dy * bjm; + bivz -= dz * bjm; + bodyj.vx += dx * bim; + bodyj.vy += dy * bim; + bodyj.vz += dz * bim; + } + bodyi.vx = bivx; + bodyi.vy = bivy; + bodyi.vz = bivz; + bodyi.x += dt * bivx; + bodyi.y += dt * bivy; + bodyi.z += dt * bivz; + } + } + energy() { + var e = 0.0; + var bodies = this.bodies; + var size = bodies.length; + for (let i = 0; i < size; ++i) { + let bodyi = bodies[i]; + let ix = bodyi.x; + let iy = bodyi.y; + let iz = bodyi.z; + let vx = bodyi.vx; + let vy = bodyi.vy; + let vz = bodyi.vz; + let bim = bodyi.mass; + e += 0.5 * bim * (vx * vx + vy * vy + vz * vz); + for (let j = i + 1; j < size; ++j) { + let bodyj = bodies[j]; + let dx = ix - bodyj.x; + let dy = iy - bodyj.y; + let dz = iz - bodyj.z; + let distance = Math.sqrt(dx * dx + dy * dy + dz * dz); + e -= bim * bodyj.mass / distance; + } + } + return e; + } +} +var system; +function init() { + var bodies = new Array(); + bodies.push(Sun()); + bodies.push(Jupiter()); + bodies.push(Saturn()); + bodies.push(Uranus()); + bodies.push(Neptune()); + system = new NBodySystem(bodies); +} +exports.init = init; +function getBody(index) { + var bodies = system.bodies; + return index < bodies.length ? bodies[index] : null; +} +exports.getBody = getBody; +function step() { + system.advance(0.01); + return system.energy(); +} +exports.step = step; +function bench(steps) { + for (let i = 0; i < steps; i++) + system.advance(0.01); +} +exports.bench = bench; diff --git a/examples/n-body/build/optimized.asm.js b/examples/n-body/build/optimized.asm.js new file mode 100644 index 00000000..c1b2c153 --- /dev/null +++ b/examples/n-body/build/optimized.asm.js @@ -0,0 +1,958 @@ +function asmFunc(global, env, buffer) { + "almost asm"; + var HEAP8 = new global.Int8Array(buffer); + var HEAP16 = new global.Int16Array(buffer); + var HEAP32 = new global.Int32Array(buffer); + var HEAPU8 = new global.Uint8Array(buffer); + var HEAPU16 = new global.Uint16Array(buffer); + var HEAPU32 = new global.Uint32Array(buffer); + var HEAPF32 = new global.Float32Array(buffer); + var HEAPF64 = new global.Float64Array(buffer); + var Math_imul = global.Math.imul; + var Math_fround = global.Math.fround; + var Math_abs = global.Math.abs; + var Math_clz32 = global.Math.clz32; + var Math_min = global.Math.min; + var Math_max = global.Math.max; + var abort = env.abort; + var $lib_allocator_arena_startOffset = 0; + var $lib_allocator_arena_offset = 0; + var assembly_index_system = 0; + var $argc = 0; + var HEAP_BASE = 36; + var i64toi32_i32$HIGH_BITS = 0; + function $lib_allocator_arena_allocate_memory($0) { + $0 = $0 | 0; + var $1 = 0, $2 = 0, $3 = 0, $4 = 0, wasm2asm_i32$0 = 0, wasm2asm_i32$1 = 0, wasm2asm_i32$2 = 0; + if ($0) { + if ($0 >>> 0 > 1073741824 >>> 0) abort(); + $1 = $lib_allocator_arena_offset; + $2 = (($1 + $0 | 0) + 7 | 0) & 4294967288 | 0; + $0 = __wasm_current_memory(); + if ($2 >>> 0 > ($0 << 16 | 0) >>> 0) { + $3 = ((($2 - $1 | 0) + 65535 | 0) & 4294901760 | 0) >>> 16 | 0; + $4 = $3; + if ((__wasm_grow_memory((wasm2asm_i32$2 = ($0 | 0) > ($4 | 0), wasm2asm_i32$0 = $0, wasm2asm_i32$1 = $4, wasm2asm_i32$2 ? wasm2asm_i32$0 : wasm2asm_i32$1) | 0) | 0) < (0 | 0)) if ((__wasm_grow_memory($3 | 0) | 0) < (0 | 0)) abort();; + } + $lib_allocator_arena_offset = $2; + return $1 | 0; + } + return 0 | 0; + } + + function $lib_internal_arraybuffer_allocUnsafe($0) { + $0 = $0 | 0; + var $1 = 0; + $1 = $0; + $1 = $lib_allocator_arena_allocate_memory(1 << (32 - Math_clz32($1 + 7 | 0) | 0) | 0 | 0) | 0; + HEAP32[$1 >> 2] = $0; + return $1 | 0; + } + + function $lib_array_Array_Body__constructor($0, $1) { + $0 = $0 | 0; + $1 = $1 | 0; + var $2 = 0, $3 = 0; + if ($1 >>> 0 > 268435454 >>> 0) { + abort(0 | 0, 4 | 0, 23 | 0, 39 | 0); + abort(); + } + if ($0) $3 = $0; else { + $2 = $lib_allocator_arena_allocate_memory(8 | 0) | 0; + HEAP32[$2 >> 2] = 0; + HEAP32[($2 + 4 | 0) >> 2] = 0; + $0 = $2; + $3 = $0; + } + HEAP32[$3 >> 2] = $lib_internal_arraybuffer_allocUnsafe($1 << 2 | 0 | 0) | 0; + HEAP32[($0 + 4 | 0) >> 2] = $1; + return $0 | 0; + } + + function assembly_index_Body_constructor($0, $1, $2, $3, $4, $5, $6, $7) { + $0 = $0 | 0; + $1 = +$1; + $2 = +$2; + $3 = +$3; + $4 = +$4; + $5 = +$5; + $6 = +$6; + $7 = +$7; + var $8 = 0, $9 = 0; + if ($0) $9 = $0; else { + $8 = $lib_allocator_arena_allocate_memory(56 | 0) | 0; + HEAPF64[$8 >> 3] = $1; + HEAPF64[($8 + 8 | 0) >> 3] = $2; + HEAPF64[($8 + 16 | 0) >> 3] = $3; + HEAPF64[($8 + 24 | 0) >> 3] = $4; + HEAPF64[($8 + 32 | 0) >> 3] = $5; + HEAPF64[($8 + 40 | 0) >> 3] = $6; + HEAPF64[($8 + 48 | 0) >> 3] = $7; + $9 = $8; + } + return $9 | 0; + } + + function $lib_memory_set_memory($0, $1, $2) { + $0 = $0 | 0; + $1 = $1 | 0; + $2 = $2 | 0; + var i64toi32_i32$3 = 0, i64toi32_i32$2 = 0, $4 = 0, i64toi32_i32$5 = 0, $3 = 0, $3$hi = 0, i64toi32_i32$1 = 0, i64toi32_i32$4 = 0, $11 = 0, i64toi32_i32$0 = 0, wasm2asm_i32$0 = 0, wasm2asm_i32$1 = 0; + if (($2 | 0) == (0 | 0)) return; + HEAP8[$0 >> 0] = $1; + HEAP8[(($0 + $2 | 0) - 1 | 0) >> 0] = $1; + if ($2 >>> 0 <= 2 >>> 0) return; + HEAP8[($0 + 1 | 0) >> 0] = $1; + HEAP8[($0 + 2 | 0) >> 0] = $1; + HEAP8[(($0 + $2 | 0) - 2 | 0) >> 0] = $1; + HEAP8[(($0 + $2 | 0) - 3 | 0) >> 0] = $1; + if ($2 >>> 0 <= 6 >>> 0) return; + HEAP8[($0 + 3 | 0) >> 0] = $1; + HEAP8[(($0 + $2 | 0) - 4 | 0) >> 0] = $1; + if ($2 >>> 0 <= 8 >>> 0) return; + $4 = (0 - $0 | 0) & 3 | 0; + $0 = $0 + $4 | 0; + $1 = Math_imul($1, 16843009); + HEAP32[$0 >> 2] = $1; + $2 = ($2 - $4 | 0) & 4294967292 | 0; + HEAP32[(($0 + $2 | 0) - 4 | 0) >> 2] = $1; + if ($2 >>> 0 <= 8 >>> 0) return; + HEAP32[($0 + 4 | 0) >> 2] = $1; + HEAP32[($0 + 8 | 0) >> 2] = $1; + HEAP32[(($0 + $2 | 0) - 12 | 0) >> 2] = $1; + HEAP32[(($0 + $2 | 0) - 8 | 0) >> 2] = $1; + if ($2 >>> 0 <= 24 >>> 0) return; + HEAP32[($0 + 12 | 0) >> 2] = $1; + HEAP32[($0 + 16 | 0) >> 2] = $1; + HEAP32[($0 + 20 | 0) >> 2] = $1; + HEAP32[($0 + 24 | 0) >> 2] = $1; + HEAP32[(($0 + $2 | 0) - 28 | 0) >> 2] = $1; + HEAP32[(($0 + $2 | 0) - 24 | 0) >> 2] = $1; + HEAP32[(($0 + $2 | 0) - 20 | 0) >> 2] = $1; + HEAP32[(($0 + $2 | 0) - 16 | 0) >> 2] = $1; + $4 = ($0 & 4 | 0) + 24 | 0; + $0 = $0 + $4 | 0; + $2 = $2 - $4 | 0; + i64toi32_i32$0 = 0; + i64toi32_i32$3 = $1; + i64toi32_i32$1 = 0; + i64toi32_i32$3 = $1; + i64toi32_i32$2 = 0; + i64toi32_i32$4 = 32; + i64toi32_i32$5 = i64toi32_i32$4 & 31 | 0; + if (32 >>> 0 <= (i64toi32_i32$4 & 63 | 0) >>> 0) { + i64toi32_i32$2 = i64toi32_i32$3 << i64toi32_i32$5 | 0; + $11 = 0; + } else { + i64toi32_i32$2 = ((1 << i64toi32_i32$5 | 0) - 1 | 0) & (i64toi32_i32$3 >>> (32 - i64toi32_i32$5 | 0) | 0) | 0 | (i64toi32_i32$1 << i64toi32_i32$5 | 0) | 0; + $11 = i64toi32_i32$3 << i64toi32_i32$5 | 0; + } + i64toi32_i32$1 = $11; + i64toi32_i32$2 = i64toi32_i32$0 | i64toi32_i32$2 | 0; + $3 = i64toi32_i32$3 | i64toi32_i32$1 | 0; + $3$hi = i64toi32_i32$2; + continue_0 : do { + if ($2 >>> 0 >= 32 >>> 0) { + i64toi32_i32$3 = $0; + i64toi32_i32$2 = $3$hi; + HEAP32[i64toi32_i32$3 >> 2] = $3; + (wasm2asm_i32$0 = i64toi32_i32$3, wasm2asm_i32$1 = i64toi32_i32$2), ((HEAP8[(wasm2asm_i32$0 + 4 | 0) >> 0] = wasm2asm_i32$1 & 255 | 0, HEAP8[(wasm2asm_i32$0 + 5 | 0) >> 0] = (wasm2asm_i32$1 >>> 8 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$0 + 6 | 0) >> 0] = (wasm2asm_i32$1 >>> 16 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$0 + 7 | 0) >> 0] = (wasm2asm_i32$1 >>> 24 | 0) & 255 | 0; + i64toi32_i32$3 = $0 + 8 | 0; + i64toi32_i32$2 = $3$hi; + HEAP32[i64toi32_i32$3 >> 2] = $3; + (wasm2asm_i32$0 = i64toi32_i32$3, wasm2asm_i32$1 = i64toi32_i32$2), ((HEAP8[(wasm2asm_i32$0 + 4 | 0) >> 0] = wasm2asm_i32$1 & 255 | 0, HEAP8[(wasm2asm_i32$0 + 5 | 0) >> 0] = (wasm2asm_i32$1 >>> 8 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$0 + 6 | 0) >> 0] = (wasm2asm_i32$1 >>> 16 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$0 + 7 | 0) >> 0] = (wasm2asm_i32$1 >>> 24 | 0) & 255 | 0; + i64toi32_i32$3 = $0 + 16 | 0; + i64toi32_i32$2 = $3$hi; + HEAP32[i64toi32_i32$3 >> 2] = $3; + (wasm2asm_i32$0 = i64toi32_i32$3, wasm2asm_i32$1 = i64toi32_i32$2), ((HEAP8[(wasm2asm_i32$0 + 4 | 0) >> 0] = wasm2asm_i32$1 & 255 | 0, HEAP8[(wasm2asm_i32$0 + 5 | 0) >> 0] = (wasm2asm_i32$1 >>> 8 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$0 + 6 | 0) >> 0] = (wasm2asm_i32$1 >>> 16 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$0 + 7 | 0) >> 0] = (wasm2asm_i32$1 >>> 24 | 0) & 255 | 0; + i64toi32_i32$3 = $0 + 24 | 0; + i64toi32_i32$2 = $3$hi; + HEAP32[i64toi32_i32$3 >> 2] = $3; + (wasm2asm_i32$0 = i64toi32_i32$3, wasm2asm_i32$1 = i64toi32_i32$2), ((HEAP8[(wasm2asm_i32$0 + 4 | 0) >> 0] = wasm2asm_i32$1 & 255 | 0, HEAP8[(wasm2asm_i32$0 + 5 | 0) >> 0] = (wasm2asm_i32$1 >>> 8 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$0 + 6 | 0) >> 0] = (wasm2asm_i32$1 >>> 16 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$0 + 7 | 0) >> 0] = (wasm2asm_i32$1 >>> 24 | 0) & 255 | 0; + $2 = $2 - 32 | 0; + $0 = $0 + 32 | 0; + continue continue_0; + } + break continue_0; + } while (1); + } + + function $lib_memory_copy_memory($0, $1, $2) { + $0 = $0 | 0; + $1 = $1 | 0; + $2 = $2 | 0; + var $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $25 = 0, $26 = 0, $27 = 0, $28 = 0, $29 = 0, $30 = 0, $31 = 0, $32 = 0, $33 = 0, $34 = 0, $35 = 0, $36 = 0, $37 = 0, $38 = 0, $39 = 0, $40 = 0, $41 = 0, $42 = 0, $43 = 0, $44 = 0; + continue_0 : do { + if ($2) $5 = $1 & 3 | 0; else $5 = $2; + if ($5) { + $3 = $0; + $0 = $3 + 1 | 0; + $6 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$6 >> 0] = HEAPU8[$3 >> 0] | 0; + $2 = $2 - 1 | 0; + continue continue_0; + } + break continue_0; + } while (1); + if (($0 & 3 | 0 | 0) == (0 | 0)) { + continue_1 : do { + if ($2 >>> 0 >= 16 >>> 0) { + HEAP32[$0 >> 2] = HEAPU32[$1 >> 2] | 0; + HEAP32[($0 + 4 | 0) >> 2] = HEAPU32[($1 + 4 | 0) >> 2] | 0; + HEAP32[($0 + 8 | 0) >> 2] = HEAPU32[($1 + 8 | 0) >> 2] | 0; + HEAP32[($0 + 12 | 0) >> 2] = HEAPU32[($1 + 12 | 0) >> 2] | 0; + $1 = $1 + 16 | 0; + $0 = $0 + 16 | 0; + $2 = $2 - 16 | 0; + continue continue_1; + } + break continue_1; + } while (1); + if ($2 & 8 | 0) { + HEAP32[$0 >> 2] = HEAPU32[$1 >> 2] | 0; + HEAP32[($0 + 4 | 0) >> 2] = HEAPU32[($1 + 4 | 0) >> 2] | 0; + $0 = $0 + 8 | 0; + $1 = $1 + 8 | 0; + } + if ($2 & 4 | 0) { + HEAP32[$0 >> 2] = HEAPU32[$1 >> 2] | 0; + $0 = $0 + 4 | 0; + $1 = $1 + 4 | 0; + } + if ($2 & 2 | 0) { + HEAP16[$0 >> 1] = HEAPU16[$1 >> 1] | 0; + $0 = $0 + 2 | 0; + $1 = $1 + 2 | 0; + } + if ($2 & 1 | 0) { + $3 = $0; + $7 = $3; + $3 = $1; + HEAP8[$7 >> 0] = HEAPU8[$3 >> 0] | 0; + } + return; + } + if ($2 >>> 0 >= 32 >>> 0) break_2 : { + case2_2 : { + case1_2 : { + case0_2 : { + tablify_0 : { + switch (($0 & 3 | 0) - 1 | 0 | 0) { + case 0: + break case0_2; + case 1: + break case1_2; + case 2: + break case2_2; + default: + break tablify_0; + }; + }; + break break_2; + }; + $4 = HEAPU32[$1 >> 2] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $8 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$8 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $9 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$9 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $10 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$10 >> 0] = HEAPU8[$3 >> 0] | 0; + $2 = $2 - 3 | 0; + continue_3 : do { + if ($2 >>> 0 >= 17 >>> 0) { + $3 = HEAPU32[($1 + 1 | 0) >> 2] | 0; + HEAP32[$0 >> 2] = $4 >>> 24 | 0 | ($3 << 8 | 0) | 0; + $4 = HEAPU32[($1 + 5 | 0) >> 2] | 0; + HEAP32[($0 + 4 | 0) >> 2] = $3 >>> 24 | 0 | ($4 << 8 | 0) | 0; + $3 = HEAPU32[($1 + 9 | 0) >> 2] | 0; + HEAP32[($0 + 8 | 0) >> 2] = $4 >>> 24 | 0 | ($3 << 8 | 0) | 0; + $4 = HEAPU32[($1 + 13 | 0) >> 2] | 0; + HEAP32[($0 + 12 | 0) >> 2] = $3 >>> 24 | 0 | ($4 << 8 | 0) | 0; + $1 = $1 + 16 | 0; + $0 = $0 + 16 | 0; + $2 = $2 - 16 | 0; + continue continue_3; + } + break continue_3; + } while (1); + break break_2; + }; + $4 = HEAPU32[$1 >> 2] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $11 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$11 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $12 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$12 >> 0] = HEAPU8[$3 >> 0] | 0; + $2 = $2 - 2 | 0; + continue_4 : do { + if ($2 >>> 0 >= 18 >>> 0) { + $3 = HEAPU32[($1 + 2 | 0) >> 2] | 0; + HEAP32[$0 >> 2] = $4 >>> 16 | 0 | ($3 << 16 | 0) | 0; + $4 = HEAPU32[($1 + 6 | 0) >> 2] | 0; + HEAP32[($0 + 4 | 0) >> 2] = $3 >>> 16 | 0 | ($4 << 16 | 0) | 0; + $3 = HEAPU32[($1 + 10 | 0) >> 2] | 0; + HEAP32[($0 + 8 | 0) >> 2] = $4 >>> 16 | 0 | ($3 << 16 | 0) | 0; + $4 = HEAPU32[($1 + 14 | 0) >> 2] | 0; + HEAP32[($0 + 12 | 0) >> 2] = $3 >>> 16 | 0 | ($4 << 16 | 0) | 0; + $1 = $1 + 16 | 0; + $0 = $0 + 16 | 0; + $2 = $2 - 16 | 0; + continue continue_4; + } + break continue_4; + } while (1); + break break_2; + }; + $4 = HEAPU32[$1 >> 2] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $13 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$13 >> 0] = HEAPU8[$3 >> 0] | 0; + $2 = $2 - 1 | 0; + continue_5 : do { + if ($2 >>> 0 >= 19 >>> 0) { + $3 = HEAPU32[($1 + 3 | 0) >> 2] | 0; + HEAP32[$0 >> 2] = $4 >>> 8 | 0 | ($3 << 24 | 0) | 0; + $4 = HEAPU32[($1 + 7 | 0) >> 2] | 0; + HEAP32[($0 + 4 | 0) >> 2] = $3 >>> 8 | 0 | ($4 << 24 | 0) | 0; + $3 = HEAPU32[($1 + 11 | 0) >> 2] | 0; + HEAP32[($0 + 8 | 0) >> 2] = $4 >>> 8 | 0 | ($3 << 24 | 0) | 0; + $4 = HEAPU32[($1 + 15 | 0) >> 2] | 0; + HEAP32[($0 + 12 | 0) >> 2] = $3 >>> 8 | 0 | ($4 << 24 | 0) | 0; + $1 = $1 + 16 | 0; + $0 = $0 + 16 | 0; + $2 = $2 - 16 | 0; + continue continue_5; + } + break continue_5; + } while (1); + }; + if ($2 & 16 | 0) { + $3 = $0; + $0 = $3 + 1 | 0; + $14 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$14 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $15 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$15 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $16 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$16 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $17 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$17 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $18 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$18 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $19 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$19 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $20 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$20 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $21 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$21 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $22 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$22 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $23 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$23 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $24 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$24 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $25 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$25 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $26 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$26 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $27 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$27 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $28 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$28 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $29 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$29 >> 0] = HEAPU8[$3 >> 0] | 0; + } + if ($2 & 8 | 0) { + $3 = $0; + $0 = $3 + 1 | 0; + $30 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$30 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $31 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$31 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $32 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$32 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $33 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$33 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $34 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$34 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $35 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$35 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $36 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$36 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $37 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$37 >> 0] = HEAPU8[$3 >> 0] | 0; + } + if ($2 & 4 | 0) { + $3 = $0; + $0 = $3 + 1 | 0; + $38 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$38 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $39 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$39 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $40 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$40 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $41 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$41 >> 0] = HEAPU8[$3 >> 0] | 0; + } + if ($2 & 2 | 0) { + $3 = $0; + $0 = $3 + 1 | 0; + $42 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$42 >> 0] = HEAPU8[$3 >> 0] | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $43 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$43 >> 0] = HEAPU8[$3 >> 0] | 0; + } + if ($2 & 1 | 0) { + $3 = $0; + $44 = $3; + $3 = $1; + HEAP8[$44 >> 0] = HEAPU8[$3 >> 0] | 0; + } + } + + function $lib_memory_move_memory($0, $1, $2) { + $0 = $0 | 0; + $1 = $1 | 0; + $2 = $2 | 0; + var $3 = 0, i64toi32_i32$1 = 0, i64toi32_i32$0 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $10 = 0, wasm2asm_i32$0 = 0, wasm2asm_i32$1 = 0; + if (($0 | 0) == ($1 | 0)) return; + $3 = ($1 + $2 | 0) >>> 0 <= $0 >>> 0; + if ($3) $6 = $3; else $6 = ($0 + $2 | 0) >>> 0 <= $1 >>> 0; + if ($6 & 1 | 0) { + $lib_memory_copy_memory($0 | 0, $1 | 0, $2 | 0); + return; + } + if ($0 >>> 0 < $1 >>> 0) { + if (($1 & 7 | 0 | 0) == ($0 & 7 | 0 | 0)) { + continue_0 : do { + if ($0 & 7 | 0) { + if (($2 | 0) == (0 | 0)) return; + $2 = $2 - 1 | 0; + $3 = $0; + $0 = $3 + 1 | 0; + $7 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$7 >> 0] = HEAPU8[$3 >> 0] | 0; + continue continue_0; + } + break continue_0; + } while (1); + continue_1 : do { + if ($2 >>> 0 >= 8 >>> 0) { + i64toi32_i32$1 = $0; + $8 = i64toi32_i32$1; + i64toi32_i32$1 = $1; + i64toi32_i32$0 = (wasm2asm_i32$0 = i64toi32_i32$1, HEAPU8[(wasm2asm_i32$0 + 4 | 0) >> 0] | 0 | 0 | (HEAPU8[(wasm2asm_i32$0 + 5 | 0) >> 0] | 0 | 0) << 8 | (HEAPU8[(wasm2asm_i32$0 + 6 | 0) >> 0] | 0 | 0) << 16 | (HEAPU8[(wasm2asm_i32$0 + 7 | 0) >> 0] | 0 | 0) << 24); + HEAP32[$8 >> 2] = HEAPU32[i64toi32_i32$1 >> 2] | 0; + (wasm2asm_i32$0 = i64toi32_i32$1, wasm2asm_i32$1 = i64toi32_i32$0), ((HEAP8[(wasm2asm_i32$0 + 4 | 0) >> 0] = wasm2asm_i32$1 & 255 | 0, HEAP8[(wasm2asm_i32$0 + 5 | 0) >> 0] = (wasm2asm_i32$1 >>> 8 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$0 + 6 | 0) >> 0] = (wasm2asm_i32$1 >>> 16 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$0 + 7 | 0) >> 0] = (wasm2asm_i32$1 >>> 24 | 0) & 255 | 0; + $2 = $2 - 8 | 0; + $0 = $0 + 8 | 0; + $1 = $1 + 8 | 0; + continue continue_1; + } + break continue_1; + } while (1); + } + continue_2 : do { + if ($2) { + $3 = $0; + $0 = $3 + 1 | 0; + $9 = $3; + $3 = $1; + $1 = $3 + 1 | 0; + HEAP8[$9 >> 0] = HEAPU8[$3 >> 0] | 0; + $2 = $2 - 1 | 0; + continue continue_2; + } + break continue_2; + } while (1); + } else { + if (($1 & 7 | 0 | 0) == ($0 & 7 | 0 | 0)) { + continue_3 : do { + if (($0 + $2 | 0) & 7 | 0) { + if (($2 | 0) == (0 | 0)) return; + $2 = $2 - 1 | 0; + HEAP8[($0 + $2 | 0) >> 0] = HEAPU8[($1 + $2 | 0) >> 0] | 0; + continue continue_3; + } + break continue_3; + } while (1); + continue_4 : do { + if ($2 >>> 0 >= 8 >>> 0) { + $2 = $2 - 8 | 0; + i64toi32_i32$1 = $0 + $2 | 0; + $10 = i64toi32_i32$1; + i64toi32_i32$1 = $1 + $2 | 0; + i64toi32_i32$0 = (wasm2asm_i32$0 = i64toi32_i32$1, HEAPU8[(wasm2asm_i32$0 + 4 | 0) >> 0] | 0 | 0 | (HEAPU8[(wasm2asm_i32$0 + 5 | 0) >> 0] | 0 | 0) << 8 | (HEAPU8[(wasm2asm_i32$0 + 6 | 0) >> 0] | 0 | 0) << 16 | (HEAPU8[(wasm2asm_i32$0 + 7 | 0) >> 0] | 0 | 0) << 24); + HEAP32[$10 >> 2] = HEAPU32[i64toi32_i32$1 >> 2] | 0; + (wasm2asm_i32$0 = i64toi32_i32$1, wasm2asm_i32$1 = i64toi32_i32$0), ((HEAP8[(wasm2asm_i32$0 + 4 | 0) >> 0] = wasm2asm_i32$1 & 255 | 0, HEAP8[(wasm2asm_i32$0 + 5 | 0) >> 0] = (wasm2asm_i32$1 >>> 8 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$0 + 6 | 0) >> 0] = (wasm2asm_i32$1 >>> 16 | 0) & 255 | 0), HEAP8[(wasm2asm_i32$0 + 7 | 0) >> 0] = (wasm2asm_i32$1 >>> 24 | 0) & 255 | 0; + continue continue_4; + } + break continue_4; + } while (1); + } + continue_5 : do { + if ($2) { + $2 = $2 - 1 | 0; + HEAP8[($0 + $2 | 0) >> 0] = HEAPU8[($1 + $2 | 0) >> 0] | 0; + continue continue_5; + } + break continue_5; + } while (1); + } + } + + function $lib_internal_arraybuffer_reallocUnsafe($0, $1) { + $0 = $0 | 0; + $1 = $1 | 0; + var $2 = 0, $3 = 0; + $2 = HEAP32[$0 >> 2] | 0; + if (($1 | 0) > ($2 | 0)) { + $3 = $2; + if (($1 | 0) <= ((1 << (32 - Math_clz32($3 + 7 | 0) | 0) | 0) - 8 | 0 | 0)) { + HEAP32[$0 >> 2] = $1; + $lib_memory_set_memory(($0 + 8 | 0) + $2 | 0 | 0, 0 | 0, $1 - $2 | 0 | 0); + } else { + $3 = $lib_internal_arraybuffer_allocUnsafe($1 | 0) | 0; + $lib_memory_move_memory($3 + 8 | 0 | 0, $0 + 8 | 0 | 0, $2 | 0); + $lib_memory_set_memory(($3 + 8 | 0) + $2 | 0 | 0, 0 | 0, $1 - $2 | 0 | 0); + return $3 | 0; + } + } else if (($1 | 0) < ($2 | 0)) HEAP32[$0 >> 2] = $1;; + return $0 | 0; + } + + function $lib_array_Array_Body__push($0, $1) { + $0 = $0 | 0; + $1 = $1 | 0; + var $4 = 0, $2 = 0, $3 = 0; + $2 = HEAP32[($0 + 4 | 0) >> 2] | 0; + $3 = $2 + 1 | 0; + $4 = HEAPU32[$0 >> 2] | 0; + if ($2 >>> 0 >= ((HEAP32[$4 >> 2] | 0) >>> 2 | 0) >>> 0) { + if ($2 >>> 0 >= 268435454 >>> 0) { + abort(0 | 0, 4 | 0, 128 | 0, 42 | 0); + abort(); + } + $4 = $lib_internal_arraybuffer_reallocUnsafe($4 | 0, $3 << 2 | 0 | 0) | 0; + HEAP32[$0 >> 2] = $4; + } + HEAP32[($0 + 4 | 0) >> 2] = $3; + HEAP32[(($4 + ($2 << 2 | 0) | 0) + 8 | 0) >> 2] = $1; + return $3 | 0; + } + + function $lib_array_Array_Body____get($0, $1) { + $0 = $0 | 0; + $1 = $1 | 0; + var $2 = 0; + $2 = HEAPU32[$0 >> 2] | 0; + if ($1 >>> 0 >= ((HEAP32[$2 >> 2] | 0) >>> 2 | 0) >>> 0) { + abort(0 | 0, 4 | 0, 64 | 0, 37 | 0); + abort(); + } + return HEAPU32[(($2 + ($1 << 2 | 0) | 0) + 8 | 0) >> 2] | 0 | 0; + } + + function assembly_index_NBodySystem_constructor($0, $1) { + $0 = $0 | 0; + $1 = $1 | 0; + var $3 = 0, $2 = 0, $4 = 0.0, $5 = 0.0, $6 = 0.0, $7 = 0.0, $8 = 0, $8 = 0; + $3 = $1; + $8 = HEAP32[($3 + 4 | 0) >> 2] | 0; + continue_0 : do { + if (($2 | 0) < ($8 | 0)) { + $3 = $lib_array_Array_Body____get($1 | 0, $2 | 0) | 0; + $4 = +HEAPF64[($3 + 48 | 0) >> 3]; + $5 = $5 + +HEAPF64[($3 + 24 | 0) >> 3] * $4; + $6 = $6 + +HEAPF64[($3 + 32 | 0) >> 3] * $4; + $7 = $7 + +HEAPF64[($3 + 40 | 0) >> 3] * $4; + $2 = $2 + 1 | 0; + continue continue_0; + } + break continue_0; + } while (1); + if ($0) $8 = $0; else { + $2 = $lib_allocator_arena_allocate_memory(4 | 0) | 0; + HEAP32[$2 >> 2] = 0; + $0 = $2; + $8 = $0; + } + HEAP32[$8 >> 2] = $1; + $1 = $lib_array_Array_Body____get(HEAPU32[$0 >> 2] | 0 | 0, 0 | 0) | 0; + HEAPF64[($1 + 24 | 0) >> 3] = -$5 / 39.47841760435743; + HEAPF64[($1 + 32 | 0) >> 3] = -$6 / 39.47841760435743; + HEAPF64[($1 + 40 | 0) >> 3] = -$7 / 39.47841760435743; + return $0 | 0; + } + + function assembly_index_init() { + var $0 = 0; + $argc = 0; + $1of1 : { + $0of1 : { + oob : { + switch ($argc | 0) { + case 0: + break $0of1; + case 1: + break $1of1; + default: + break oob; + }; + }; + abort(); + }; + }; + $0 = $lib_array_Array_Body__constructor(0 | 0, 0 | 0) | 0; + $lib_array_Array_Body__push($0 | 0, assembly_index_Body_constructor(0 | 0, +(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(39.47841760435743)) | 0 | 0) | 0; + $lib_array_Array_Body__push($0 | 0, assembly_index_Body_constructor(0 | 0, +(4.841431442464721), +(-1.1603200440274284), +(-.10362204447112311), +(.606326392995832), +(2.81198684491626), +(-.02521836165988763), +(.03769367487038949)) | 0 | 0) | 0; + $lib_array_Array_Body__push($0 | 0, assembly_index_Body_constructor(0 | 0, +(8.34336671824458), +(4.124798564124305), +(-.4035234171143214), +(-1.0107743461787924), +(1.8256623712304119), +(.008415761376584154), +(.011286326131968767)) | 0 | 0) | 0; + $lib_array_Array_Body__push($0 | 0, assembly_index_Body_constructor(0 | 0, +(12.894369562139131), +(-15.111151401698631), +(-.22330757889265573), +(1.0827910064415354), +(.8687130181696082), +(-.010832637401363636), +(1.7237240570597112e-03)) | 0 | 0) | 0; + $lib_array_Array_Body__push($0 | 0, assembly_index_Body_constructor(0 | 0, +(15.379697114850917), +(-25.919314609987964), +(.17925877295037118), +(.979090732243898), +(.5946989986476762), +(-.034755955504078104), +(2.0336868699246304e-03)) | 0 | 0) | 0; + assembly_index_system = assembly_index_NBodySystem_constructor(0 | 0, $0 | 0) | 0; + } + + function assembly_index_getBody($0) { + $0 = $0 | 0; + var $1 = 0, $2 = 0; + $1 = HEAPU32[assembly_index_system >> 2] | 0; + if ($0 >>> 0 < (HEAP32[($1 + 4 | 0) >> 2] | 0) >>> 0) $2 = $lib_array_Array_Body____get($1 | 0, $0 | 0) | 0; else $2 = 0; + return $2 | 0; + } + + function assembly_index_NBodySystem_advance($0, $1) { + $0 = $0 | 0; + $1 = +$1; + var $2 = 0, $3 = 0.0, $4 = 0.0, $5 = 0, $6 = 0.0, $7 = 0.0, $8 = 0.0, $9 = 0, $10 = 0.0, $11 = 0.0, $12 = 0.0, $13 = 0, $14 = 0, $15 = 0.0, $16 = 0.0, $17 = 0.0, $18 = 0.0; + $13 = HEAPU32[$0 >> 2] | 0; + $0 = $13; + $14 = HEAP32[($0 + 4 | 0) >> 2] | 0; + continue_0 : do { + if (($5 | 0) < ($14 | 0)) { + $0 = $lib_array_Array_Body____get($13 | 0, $5 | 0) | 0; + $15 = +HEAPF64[$0 >> 3]; + $16 = +HEAPF64[($0 + 8 | 0) >> 3]; + $17 = +HEAPF64[($0 + 16 | 0) >> 3]; + $6 = +HEAPF64[($0 + 24 | 0) >> 3]; + $7 = +HEAPF64[($0 + 32 | 0) >> 3]; + $8 = +HEAPF64[($0 + 40 | 0) >> 3]; + $18 = +HEAPF64[($0 + 48 | 0) >> 3]; + $9 = $5 + 1 | 0; + continue_1 : do { + if (($9 | 0) < ($14 | 0)) { + $2 = $lib_array_Array_Body____get($13 | 0, $9 | 0) | 0; + $10 = $15 - +HEAPF64[$2 >> 3]; + $11 = $16 - +HEAPF64[($2 + 8 | 0) >> 3]; + $12 = $17 - +HEAPF64[($2 + 16 | 0) >> 3]; + $3 = $10 * $10 + $11 * $11 + $12 * $12; + $4 = Math_sqrt($3); + $3 = $1 / ($3 * $4); + $4 = $18 * $3; + $3 = +HEAPF64[($2 + 48 | 0) >> 3] * $3; + $6 = $6 - $10 * $3; + $7 = $7 - $11 * $3; + $8 = $8 - $12 * $3; + HEAPF64[($2 + 24 | 0) >> 3] = +HEAPF64[($2 + 24 | 0) >> 3] + $10 * $4; + HEAPF64[($2 + 32 | 0) >> 3] = +HEAPF64[($2 + 32 | 0) >> 3] + $11 * $4; + HEAPF64[($2 + 40 | 0) >> 3] = +HEAPF64[($2 + 40 | 0) >> 3] + $12 * $4; + $9 = $9 + 1 | 0; + continue continue_1; + } + break continue_1; + } while (1); + HEAPF64[($0 + 24 | 0) >> 3] = $6; + HEAPF64[($0 + 32 | 0) >> 3] = $7; + HEAPF64[($0 + 40 | 0) >> 3] = $8; + HEAPF64[$0 >> 3] = +HEAPF64[$0 >> 3] + $1 * $6; + HEAPF64[($0 + 8 | 0) >> 3] = +HEAPF64[($0 + 8 | 0) >> 3] + $1 * $7; + HEAPF64[($0 + 16 | 0) >> 3] = +HEAPF64[($0 + 16 | 0) >> 3] + $1 * $8; + $5 = $5 + 1 | 0; + continue continue_0; + } + break continue_0; + } while (1); + } + + function assembly_index_NBodySystem_energy($0) { + $0 = $0 | 0; + var $1 = 0.0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $10 = 0.0, $6 = 0.0, $7 = 0.0, $8 = 0.0, $9 = 0.0, $11 = 0.0, $12 = 0.0, $13 = 0.0, $14 = 0.0, $15 = 0.0; + $4 = HEAPU32[$0 >> 2] | 0; + $0 = $4; + $5 = HEAP32[($0 + 4 | 0) >> 2] | 0; + continue_0 : do { + if (($2 | 0) < ($5 | 0)) { + $0 = $lib_array_Array_Body____get($4 | 0, $2 | 0) | 0; + $7 = +HEAPF64[$0 >> 3]; + $8 = +HEAPF64[($0 + 8 | 0) >> 3]; + $9 = +HEAPF64[($0 + 16 | 0) >> 3]; + $11 = $1; + $10 = +HEAPF64[($0 + 48 | 0) >> 3]; + $1 = +HEAPF64[($0 + 24 | 0) >> 3]; + $12 = $1 * $1; + $1 = +HEAPF64[($0 + 32 | 0) >> 3]; + $13 = $12 + $1 * $1; + $1 = +HEAPF64[($0 + 40 | 0) >> 3]; + $1 = $11 + .5 * $10 * ($13 + $1 * $1); + $0 = $2 + 1 | 0; + continue_1 : do { + if (($0 | 0) < ($5 | 0)) { + $3 = $lib_array_Array_Body____get($4 | 0, $0 | 0) | 0; + $6 = $7 - +HEAPF64[$3 >> 3]; + $14 = $1; + $1 = $8 - +HEAPF64[($3 + 8 | 0) >> 3]; + $15 = $6 * $6 + $1 * $1; + $1 = $9 - +HEAPF64[($3 + 16 | 0) >> 3]; + $1 = $14 - $10 * +HEAPF64[($3 + 48 | 0) >> 3] / Math_sqrt($15 + $1 * $1); + $0 = $0 + 1 | 0; + continue continue_1; + } + break continue_1; + } while (1); + $2 = $2 + 1 | 0; + continue continue_0; + } + break continue_0; + } while (1); + return +$1; + } + + function assembly_index_step() { + assembly_index_NBodySystem_advance(assembly_index_system | 0, +(.01)); + return +(+assembly_index_NBodySystem_energy(assembly_index_system | 0)); + } + + function assembly_index_bench($0) { + $0 = $0 | 0; + var $1 = 0; + continue_0 : do { + if ($1 >>> 0 < $0 >>> 0) { + assembly_index_NBodySystem_advance(assembly_index_system | 0, +(.01)); + $1 = $1 + 1 | 0; + continue continue_0; + } + break continue_0; + } while (1); + } + + function start() { + $lib_allocator_arena_startOffset = (HEAP_BASE + 7 | 0) & 4294967288 | 0; + $lib_allocator_arena_offset = $lib_allocator_arena_startOffset; + } + + function __wasm_ctz_i32(x) { + x = x | 0; + var $1 = 0; + if ((x | 0) == (0 | 0)) $1 = 32; else $1 = 31 - Math_clz32(x ^ (x - 1 | 0) | 0) | 0; + return $1 | 0; + } + + function __wasm_popcnt_i32(x) { + x = x | 0; + var count = 0, $2 = 0; + count = 0; + b : { + l : do { + $2 = count; + if ((x | 0) == (0 | 0)) break b; + x = x & (x - 1 | 0) | 0; + count = count + 1 | 0; + continue l; + break l; + } while (1); + }; + return $2 | 0; + } + + function __wasm_rotl_i32(x, k) { + x = x | 0; + k = k | 0; + return ((4294967295 >>> (k & 31 | 0) | 0) & x | 0) << (k & 31 | 0) | 0 | (((4294967295 << (32 - (k & 31 | 0) | 0) | 0) & x | 0) >>> (32 - (k & 31 | 0) | 0) | 0) | 0 | 0; + } + + function __wasm_rotr_i32(x, k) { + x = x | 0; + k = k | 0; + return ((4294967295 << (k & 31 | 0) | 0) & x | 0) >>> (k & 31 | 0) | 0 | (((4294967295 >>> (32 - (k & 31 | 0) | 0) | 0) & x | 0) << (32 - (k & 31 | 0) | 0) | 0) | 0 | 0; + } + + function __wasm_grow_memory(pagesToAdd) { + pagesToAdd = pagesToAdd | 0; + var oldPages = __wasm_current_memory() | 0; + var newPages = oldPages + pagesToAdd | 0; + if ((oldPages < newPages) && (newPages < 65535)) { + var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536)); + var newHEAP8 = new global.Int8Array(newBuffer); + newHEAP8.set(HEAP8); + HEAP8 = newHEAP8; + HEAP16 = new global.Int16Array(newBuffer); + HEAP32 = new global.Int32Array(newBuffer); + HEAPU8 = new global.Uint8Array(newBuffer); + HEAPU16 = new global.Uint16Array(newBuffer); + HEAPU32 = new global.Uint32Array(newBuffer); + HEAPF32 = new global.Float32Array(newBuffer); + HEAPF64 = new global.Float64Array(newBuffer); + buffer = newBuffer; + } + return oldPages; + } + + function __wasm_current_memory() { + return buffer.byteLength / 65536 | 0; + } + + return { + init: assembly_index_init, + getBody: assembly_index_getBody, + step: assembly_index_step, + bench: assembly_index_bench, + memory: Object.create(Object.prototype, { + grow: { + value: __wasm_grow_memory + }, + buffer: { + get: function () { + return buffer; + } + + } + }) + }; +} diff --git a/examples/n-body/build/optimized.wasm b/examples/n-body/build/optimized.wasm index f69a5d79..0788d10e 100644 Binary files a/examples/n-body/build/optimized.wasm and b/examples/n-body/build/optimized.wasm differ diff --git a/examples/n-body/build/optimized.wat b/examples/n-body/build/optimized.wat index a73fdf0b..28954660 100644 --- a/examples/n-body/build/optimized.wat +++ b/examples/n-body/build/optimized.wat @@ -1,5 +1,6 @@ (module (type $F (func (result f64))) + (type $v (func)) (type $iii (func (param i32 i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $ii (func (param i32) (result i32))) @@ -7,16 +8,17 @@ (type $iiiv (func (param i32 i32 i32))) (type $iFv (func (param i32 f64))) (type $iF (func (param i32) (result f64))) - (type $v (func)) + (type $iv (func (param i32))) (import "env" "abort" (func $abort (param i32 i32 i32 i32))) (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) - (global $~argc (mut i32) (i32.const 0)) - (global $assembly/index/bodies (mut i32) (i32.const 0)) (global $assembly/index/system (mut i32) (i32.const 0)) + (global $~argc (mut i32) (i32.const 0)) (global $HEAP_BASE i32 (i32.const 36)) + (global $i64toi32_i32$HIGH_BITS (mut i32) (i32.const 0)) (memory $0 1) (data (i32.const 4) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s") + (export "init" (func $assembly/index/init)) (export "getBody" (func $assembly/index/getBody)) (export "step" (func $assembly/index/step)) (export "bench" (func $assembly/index/bench)) @@ -27,138 +29,111 @@ (local $2 i32) (local $3 i32) (local $4 i32) - ;;@ ~lib/allocator/arena.ts:17:2 + (local $wasm2asm_i32$0 i32) + (local $wasm2asm_i32$1 i32) + (local $wasm2asm_i32$2 i32) (if - ;;@ ~lib/allocator/arena.ts:17:6 (get_local $0) - ;;@ ~lib/allocator/arena.ts:17:12 (block - ;;@ ~lib/allocator/arena.ts:18:4 (if - ;;@ ~lib/allocator/arena.ts:18:8 (i32.gt_u (get_local $0) - ;;@ ~lib/allocator/arena.ts:18:15 (i32.const 1073741824) ) - ;;@ ~lib/allocator/arena.ts:18:28 (unreachable) ) - ;;@ ~lib/allocator/arena.ts:22:4 - (if - ;;@ ~lib/allocator/arena.ts:22:8 - (i32.gt_u - ;;@ ~lib/allocator/arena.ts:20:4 - (tee_local $2 - ;;@ ~lib/allocator/arena.ts:20:17 - (i32.and + (block + (set_local $1 + (get_global $~lib/allocator/arena/offset) + ) + (set_local $2 + (i32.and + (i32.add (i32.add - ;;@ ~lib/allocator/arena.ts:20:18 - (i32.add - ;;@ ~lib/allocator/arena.ts:19:4 - (tee_local $1 - ;;@ ~lib/allocator/arena.ts:19:14 - (get_global $~lib/allocator/arena/offset) - ) - ;;@ ~lib/allocator/arena.ts:20:24 - (get_local $0) - ) - ;;@ ~lib/allocator/arena.ts:20:31 - (i32.const 7) + (get_local $1) + (get_local $0) ) - (i32.const -8) + (i32.const 7) ) - ) - ;;@ ~lib/allocator/arena.ts:22:17 - (i32.shl - ;;@ ~lib/allocator/arena.ts:21:4 - (tee_local $0 - ;;@ ~lib/allocator/arena.ts:21:22 - (current_memory) - ) - ;;@ ~lib/allocator/arena.ts:22:39 - (i32.const 16) + (i32.const -8) ) ) - ;;@ ~lib/allocator/arena.ts:25:6 + (set_local $0 + (current_memory) + ) (if - ;;@ ~lib/allocator/arena.ts:25:10 - (i32.lt_s - (grow_memory - ;;@ ~lib/allocator/arena.ts:24:24 - (select - ;;@ ~lib/allocator/arena.ts:24:28 - (get_local $0) - (tee_local $4 - ;;@ ~lib/allocator/arena.ts:23:6 - (tee_local $3 - ;;@ ~lib/allocator/arena.ts:23:24 - (i32.shr_u - (i32.and - ;;@ ~lib/allocator/arena.ts:23:25 - (i32.add - ;;@ ~lib/allocator/arena.ts:23:26 - (i32.sub - (get_local $2) - ;;@ ~lib/allocator/arena.ts:23:35 - (get_local $1) - ) - ;;@ ~lib/allocator/arena.ts:23:41 - (i32.const 65535) - ) - (i32.const -65536) - ) - ;;@ ~lib/allocator/arena.ts:23:64 - (i32.const 16) + (i32.gt_u + (get_local $2) + (i32.shl + (get_local $0) + (i32.const 16) + ) + ) + (block + (set_local $3 + (i32.shr_u + (i32.and + (i32.add + (i32.sub + (get_local $2) + (get_local $1) + ) + (i32.const 65535) + ) + (i32.const -65536) + ) + (i32.const 16) + ) + ) + (set_local $4 + (get_local $3) + ) + (if + (i32.lt_s + (grow_memory + (select + (get_local $0) + (get_local $4) + (i32.gt_s + (get_local $0) + (get_local $4) ) ) ) - (i32.gt_s - (get_local $0) - (get_local $4) + (i32.const 0) + ) + (if + (i32.lt_s + (grow_memory + (get_local $3) + ) + (i32.const 0) ) + (unreachable) ) ) - ;;@ ~lib/allocator/arena.ts:25:37 - (i32.const 0) - ) - ;;@ ~lib/allocator/arena.ts:26:8 - (if - ;;@ ~lib/allocator/arena.ts:26:12 - (i32.lt_s - (grow_memory - ;;@ ~lib/allocator/arena.ts:26:24 - (get_local $3) - ) - ;;@ ~lib/allocator/arena.ts:26:39 - (i32.const 0) - ) - ;;@ ~lib/allocator/arena.ts:27:10 - (unreachable) ) ) ) - ;;@ ~lib/allocator/arena.ts:31:4 (set_global $~lib/allocator/arena/offset - ;;@ ~lib/allocator/arena.ts:31:13 (get_local $2) ) - ;;@ ~lib/allocator/arena.ts:32:11 (return (get_local $1) ) ) ) - ;;@ ~lib/allocator/arena.ts:34:9 - (i32.const 0) + (return + (i32.const 0) + ) ) (func $~lib/internal/arraybuffer/allocUnsafe (; 2 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) - ;;@ ~lib/internal/arraybuffer.ts:24:2 - (i32.store - ;;@ ~lib/internal/arraybuffer.ts:23:2 - (tee_local $1 - ;;@ ~lib/internal/arraybuffer.ts:23:15 + (block + (set_local $1 + (get_local $0) + ) + (set_local $1 (call $~lib/allocator/arena/allocate_memory (i32.shl (i32.const 1) @@ -166,10 +141,7 @@ (i32.const 32) (i32.clz (i32.add - (tee_local $1 - ;;@ ~lib/internal/arraybuffer.ts:23:43 - (get_local $0) - ) + (get_local $1) (i32.const 7) ) ) @@ -177,606 +149,609 @@ ) ) ) - ;;@ ~lib/internal/arraybuffer.ts:24:21 - (get_local $0) + (i32.store + (get_local $1) + (get_local $0) + ) + ) + (return + (get_local $1) ) - ;;@ ~lib/internal/arraybuffer.ts:25:9 - (get_local $1) ) (func $~lib/array/Array#constructor (; 3 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) - ;;@ ~lib/array.ts:23:4 - (if - ;;@ ~lib/array.ts:23:8 - (i32.gt_u - (get_local $1) - ;;@ ~lib/array.ts:23:22 - (i32.const 268435454) - ) - ;;@ ~lib/array.ts:23:39 - (block - (call $abort - (i32.const 0) - (i32.const 4) - (i32.const 23) - (i32.const 39) + (local $3 i32) + (block + (if + (i32.gt_u + (get_local $1) + (i32.const 268435454) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 23) + (i32.const 39) + ) + (unreachable) ) - (unreachable) ) - ) - ;;@ ~lib/array.ts:24:4 - (i32.store - (if (result i32) + (if (get_local $0) - (get_local $0) - (block (result i32) - (i32.store - (tee_local $2 + (set_local $3 + (get_local $0) + ) + (block + (block + (set_local $2 (call $~lib/allocator/arena/allocate_memory (i32.const 8) ) ) - (i32.const 0) + (i32.store + (get_local $2) + (i32.const 0) + ) + (i32.store offset=4 + (get_local $2) + (i32.const 0) + ) + (set_local $0 + (get_local $2) + ) ) - (i32.store offset=4 - (get_local $2) - (i32.const 0) - ) - (tee_local $0 - (get_local $2) + (set_local $3 + (get_local $0) ) ) ) - ;;@ ~lib/array.ts:24:19 - (call $~lib/internal/arraybuffer/allocUnsafe - ;;@ ~lib/array.ts:24:31 - (i32.shl - (get_local $1) - ;;@ ~lib/array.ts:24:41 - (i32.const 2) + (i32.store + (get_local $3) + (call $~lib/internal/arraybuffer/allocUnsafe + (i32.shl + (get_local $1) + (i32.const 2) + ) ) ) + (i32.store offset=4 + (get_local $0) + (get_local $1) + ) ) - ;;@ ~lib/array.ts:25:4 - (i32.store offset=4 + (return (get_local $0) - ;;@ ~lib/array.ts:25:19 - (get_local $1) ) - (get_local $0) ) (func $assembly/index/Body#constructor (; 4 ;) (type $iFFFFFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (param $7 f64) (result i32) (local $8 i32) - (if (result i32) + (local $9 i32) + (if (get_local $0) - (get_local $0) - (block (result i32) - (f64.store - (tee_local $8 + (set_local $9 + (get_local $0) + ) + (block + (block + (set_local $8 (call $~lib/allocator/arena/allocate_memory (i32.const 56) ) ) - (get_local $1) + (f64.store + (get_local $8) + (get_local $1) + ) + (f64.store offset=8 + (get_local $8) + (get_local $2) + ) + (f64.store offset=16 + (get_local $8) + (get_local $3) + ) + (f64.store offset=24 + (get_local $8) + (get_local $4) + ) + (f64.store offset=32 + (get_local $8) + (get_local $5) + ) + (f64.store offset=40 + (get_local $8) + (get_local $6) + ) + (f64.store offset=48 + (get_local $8) + (get_local $7) + ) ) - (f64.store offset=8 + (set_local $9 (get_local $8) - (get_local $2) ) - (f64.store offset=16 - (get_local $8) - (get_local $3) - ) - (f64.store offset=24 - (get_local $8) - (get_local $4) - ) - (f64.store offset=32 - (get_local $8) - (get_local $5) - ) - (f64.store offset=40 - (get_local $8) - (get_local $6) - ) - (f64.store offset=48 - (get_local $8) - (get_local $7) - ) - (get_local $8) ) ) + (return + (get_local $9) + ) ) (func $~lib/memory/set_memory (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i64) + (local $i64toi32_i32$3 i32) + (local $i64toi32_i32$2 i32) (local $4 i32) - ;;@ ~lib/memory.ts:196:2 + (local $i64toi32_i32$5 i32) + (local $3 i32) + (local $3$hi i32) + (local $i64toi32_i32$1 i32) + (local $i64toi32_i32$4 i32) + (local $11 i32) + (local $i64toi32_i32$0 i32) + (local $wasm2asm_i32$0 i32) + (local $wasm2asm_i32$1 i32) (if - ;;@ ~lib/memory.ts:196:6 (i32.eqz - ;;@ ~lib/memory.ts:196:7 (get_local $2) ) - ;;@ ~lib/memory.ts:196:10 (return) ) - ;;@ ~lib/memory.ts:197:2 (i32.store8 - ;;@ ~lib/memory.ts:197:12 (get_local $0) - ;;@ ~lib/memory.ts:197:18 (get_local $1) ) - ;;@ ~lib/memory.ts:198:2 (i32.store8 - ;;@ ~lib/memory.ts:198:12 (i32.sub (i32.add (get_local $0) - ;;@ ~lib/memory.ts:198:19 (get_local $2) ) - ;;@ ~lib/memory.ts:198:23 (i32.const 1) ) - ;;@ ~lib/memory.ts:198:26 (get_local $1) ) - ;;@ ~lib/memory.ts:199:2 (if - ;;@ ~lib/memory.ts:199:6 (i32.le_u (get_local $2) - ;;@ ~lib/memory.ts:199:11 (i32.const 2) ) - ;;@ ~lib/memory.ts:199:14 (return) ) - ;;@ ~lib/memory.ts:201:2 (i32.store8 - ;;@ ~lib/memory.ts:201:12 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:201:19 (i32.const 1) ) - ;;@ ~lib/memory.ts:201:22 (get_local $1) ) - ;;@ ~lib/memory.ts:202:2 (i32.store8 - ;;@ ~lib/memory.ts:202:12 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:202:19 (i32.const 2) ) - ;;@ ~lib/memory.ts:202:22 (get_local $1) ) - ;;@ ~lib/memory.ts:203:2 (i32.store8 - ;;@ ~lib/memory.ts:203:12 (i32.sub (i32.add (get_local $0) - ;;@ ~lib/memory.ts:203:19 (get_local $2) ) - ;;@ ~lib/memory.ts:203:23 (i32.const 2) ) - ;;@ ~lib/memory.ts:203:26 (get_local $1) ) - ;;@ ~lib/memory.ts:204:2 (i32.store8 - ;;@ ~lib/memory.ts:204:12 (i32.sub (i32.add (get_local $0) - ;;@ ~lib/memory.ts:204:19 (get_local $2) ) - ;;@ ~lib/memory.ts:204:23 (i32.const 3) ) - ;;@ ~lib/memory.ts:204:26 (get_local $1) ) - ;;@ ~lib/memory.ts:205:2 (if - ;;@ ~lib/memory.ts:205:6 (i32.le_u (get_local $2) - ;;@ ~lib/memory.ts:205:11 (i32.const 6) ) - ;;@ ~lib/memory.ts:205:14 (return) ) - ;;@ ~lib/memory.ts:206:2 (i32.store8 - ;;@ ~lib/memory.ts:206:12 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:206:19 (i32.const 3) ) - ;;@ ~lib/memory.ts:206:22 (get_local $1) ) - ;;@ ~lib/memory.ts:207:2 (i32.store8 - ;;@ ~lib/memory.ts:207:12 (i32.sub (i32.add (get_local $0) - ;;@ ~lib/memory.ts:207:19 (get_local $2) ) - ;;@ ~lib/memory.ts:207:23 (i32.const 4) ) - ;;@ ~lib/memory.ts:207:26 (get_local $1) ) - ;;@ ~lib/memory.ts:208:2 (if - ;;@ ~lib/memory.ts:208:6 (i32.le_u (get_local $2) - ;;@ ~lib/memory.ts:208:11 (i32.const 8) ) - ;;@ ~lib/memory.ts:208:14 (return) ) - ;;@ ~lib/memory.ts:219:2 - (i32.store - ;;@ ~lib/memory.ts:212:2 - (tee_local $0 - (i32.add + (set_local $4 + (i32.and + (i32.sub + (i32.const 0) (get_local $0) - ;;@ ~lib/memory.ts:211:2 - (tee_local $4 - ;;@ ~lib/memory.ts:211:17 - (i32.and - (i32.sub - (i32.const 0) - ;;@ ~lib/memory.ts:211:18 - (get_local $0) - ) - ;;@ ~lib/memory.ts:211:25 - (i32.const 3) - ) - ) - ) - ) - ;;@ ~lib/memory.ts:216:2 - (tee_local $1 - ;;@ ~lib/memory.ts:216:17 - (i32.mul - ;;@ ~lib/memory.ts:216:33 - (get_local $1) - (i32.const 16843009) ) + (i32.const 3) ) ) - ;;@ ~lib/memory.ts:220:2 - (i32.store - ;;@ ~lib/memory.ts:220:13 - (i32.sub - (i32.add - (get_local $0) - ;;@ ~lib/memory.ts:214:2 - (tee_local $2 - (i32.and - (i32.sub - ;;@ ~lib/memory.ts:213:2 - (get_local $2) - ;;@ ~lib/memory.ts:213:7 - (get_local $4) - ) - ;;@ ~lib/memory.ts:214:7 - (i32.const -4) - ) - ) - ) - ;;@ ~lib/memory.ts:220:24 - (i32.const 4) - ) - ;;@ ~lib/memory.ts:220:27 - (get_local $1) - ) - ;;@ ~lib/memory.ts:221:2 - (if - ;;@ ~lib/memory.ts:221:6 - (i32.le_u - (get_local $2) - ;;@ ~lib/memory.ts:221:11 - (i32.const 8) - ) - ;;@ ~lib/memory.ts:221:14 - (return) - ) - ;;@ ~lib/memory.ts:222:2 - (i32.store - ;;@ ~lib/memory.ts:222:13 - (i32.add - (get_local $0) - ;;@ ~lib/memory.ts:222:20 - (i32.const 4) - ) - ;;@ ~lib/memory.ts:222:23 - (get_local $1) - ) - ;;@ ~lib/memory.ts:223:2 - (i32.store - ;;@ ~lib/memory.ts:223:13 - (i32.add - (get_local $0) - ;;@ ~lib/memory.ts:223:20 - (i32.const 8) - ) - ;;@ ~lib/memory.ts:223:23 - (get_local $1) - ) - ;;@ ~lib/memory.ts:224:2 - (i32.store - ;;@ ~lib/memory.ts:224:13 - (i32.sub - (i32.add - (get_local $0) - ;;@ ~lib/memory.ts:224:20 - (get_local $2) - ) - ;;@ ~lib/memory.ts:224:24 - (i32.const 12) - ) - ;;@ ~lib/memory.ts:224:28 - (get_local $1) - ) - ;;@ ~lib/memory.ts:225:2 - (i32.store - ;;@ ~lib/memory.ts:225:13 - (i32.sub - (i32.add - (get_local $0) - ;;@ ~lib/memory.ts:225:20 - (get_local $2) - ) - ;;@ ~lib/memory.ts:225:24 - (i32.const 8) - ) - ;;@ ~lib/memory.ts:225:27 - (get_local $1) - ) - ;;@ ~lib/memory.ts:226:2 - (if - ;;@ ~lib/memory.ts:226:6 - (i32.le_u - (get_local $2) - ;;@ ~lib/memory.ts:226:11 - (i32.const 24) - ) - ;;@ ~lib/memory.ts:226:15 - (return) - ) - ;;@ ~lib/memory.ts:227:2 - (i32.store - ;;@ ~lib/memory.ts:227:13 - (i32.add - (get_local $0) - ;;@ ~lib/memory.ts:227:20 - (i32.const 12) - ) - ;;@ ~lib/memory.ts:227:24 - (get_local $1) - ) - ;;@ ~lib/memory.ts:228:2 - (i32.store - ;;@ ~lib/memory.ts:228:13 - (i32.add - (get_local $0) - ;;@ ~lib/memory.ts:228:20 - (i32.const 16) - ) - ;;@ ~lib/memory.ts:228:24 - (get_local $1) - ) - ;;@ ~lib/memory.ts:229:2 - (i32.store - ;;@ ~lib/memory.ts:229:13 - (i32.add - (get_local $0) - ;;@ ~lib/memory.ts:229:20 - (i32.const 20) - ) - ;;@ ~lib/memory.ts:229:24 - (get_local $1) - ) - ;;@ ~lib/memory.ts:230:2 - (i32.store - ;;@ ~lib/memory.ts:230:13 - (i32.add - (get_local $0) - ;;@ ~lib/memory.ts:230:20 - (i32.const 24) - ) - ;;@ ~lib/memory.ts:230:24 - (get_local $1) - ) - ;;@ ~lib/memory.ts:231:2 - (i32.store - ;;@ ~lib/memory.ts:231:13 - (i32.sub - (i32.add - (get_local $0) - ;;@ ~lib/memory.ts:231:20 - (get_local $2) - ) - ;;@ ~lib/memory.ts:231:24 - (i32.const 28) - ) - ;;@ ~lib/memory.ts:231:28 - (get_local $1) - ) - ;;@ ~lib/memory.ts:232:2 - (i32.store - ;;@ ~lib/memory.ts:232:13 - (i32.sub - (i32.add - (get_local $0) - ;;@ ~lib/memory.ts:232:20 - (get_local $2) - ) - ;;@ ~lib/memory.ts:232:24 - (i32.const 24) - ) - ;;@ ~lib/memory.ts:232:28 - (get_local $1) - ) - ;;@ ~lib/memory.ts:233:2 - (i32.store - ;;@ ~lib/memory.ts:233:13 - (i32.sub - (i32.add - (get_local $0) - ;;@ ~lib/memory.ts:233:20 - (get_local $2) - ) - ;;@ ~lib/memory.ts:233:24 - (i32.const 20) - ) - ;;@ ~lib/memory.ts:233:28 - (get_local $1) - ) - ;;@ ~lib/memory.ts:234:2 - (i32.store - ;;@ ~lib/memory.ts:234:13 - (i32.sub - (i32.add - (get_local $0) - ;;@ ~lib/memory.ts:234:20 - (get_local $2) - ) - ;;@ ~lib/memory.ts:234:24 - (i32.const 16) - ) - ;;@ ~lib/memory.ts:234:28 - (get_local $1) - ) - ;;@ ~lib/memory.ts:238:2 (set_local $0 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:237:2 - (tee_local $4 - ;;@ ~lib/memory.ts:237:6 - (i32.add - ;;@ ~lib/memory.ts:237:11 - (i32.and - ;;@ ~lib/memory.ts:237:12 - (get_local $0) - ;;@ ~lib/memory.ts:237:19 - (i32.const 4) - ) - ;;@ ~lib/memory.ts:237:6 - (i32.const 24) - ) - ) - ) - ) - ;;@ ~lib/memory.ts:239:2 - (set_local $2 - (i32.sub - (get_local $2) - ;;@ ~lib/memory.ts:239:7 (get_local $4) ) ) - ;;@ ~lib/memory.ts:242:2 - (set_local $3 - ;;@ ~lib/memory.ts:242:17 - (i64.or - (i64.extend_u/i32 + (set_local $1 + (i32.mul + (get_local $1) + (i32.const 16843009) + ) + ) + (i32.store + (get_local $0) + (get_local $1) + ) + (set_local $2 + (i32.and + (i32.sub + (get_local $2) + (get_local $4) + ) + (i32.const -4) + ) + ) + (i32.store + (i32.sub + (i32.add + (get_local $0) + (get_local $2) + ) + (i32.const 4) + ) + (get_local $1) + ) + (if + (i32.le_u + (get_local $2) + (i32.const 8) + ) + (return) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 4) + ) + (get_local $1) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 8) + ) + (get_local $1) + ) + (i32.store + (i32.sub + (i32.add + (get_local $0) + (get_local $2) + ) + (i32.const 12) + ) + (get_local $1) + ) + (i32.store + (i32.sub + (i32.add + (get_local $0) + (get_local $2) + ) + (i32.const 8) + ) + (get_local $1) + ) + (if + (i32.le_u + (get_local $2) + (i32.const 24) + ) + (return) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 12) + ) + (get_local $1) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 16) + ) + (get_local $1) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 20) + ) + (get_local $1) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 24) + ) + (get_local $1) + ) + (i32.store + (i32.sub + (i32.add + (get_local $0) + (get_local $2) + ) + (i32.const 28) + ) + (get_local $1) + ) + (i32.store + (i32.sub + (i32.add + (get_local $0) + (get_local $2) + ) + (i32.const 24) + ) + (get_local $1) + ) + (i32.store + (i32.sub + (i32.add + (get_local $0) + (get_local $2) + ) + (i32.const 20) + ) + (get_local $1) + ) + (i32.store + (i32.sub + (i32.add + (get_local $0) + (get_local $2) + ) + (i32.const 16) + ) + (get_local $1) + ) + (set_local $4 + (i32.add + (i32.and + (get_local $0) + (i32.const 4) + ) + (i32.const 24) + ) + ) + (set_local $0 + (i32.add + (get_local $0) + (get_local $4) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (get_local $4) + ) + ) + (block + (block + (set_local $i64toi32_i32$0 + (i32.const 0) + ) + (set_local $i64toi32_i32$3 (get_local $1) ) - ;;@ ~lib/memory.ts:242:28 - (i64.shl - ;;@ ~lib/memory.ts:242:29 - (i64.extend_u/i32 + (block + (set_local $i64toi32_i32$1 + (i32.const 0) + ) + (set_local $i64toi32_i32$3 (get_local $1) ) - ;;@ ~lib/memory.ts:242:41 - (i64.const 32) + (set_local $i64toi32_i32$2 + (i32.const 0) + ) + (set_local $i64toi32_i32$4 + (i32.const 32) + ) + (set_local $i64toi32_i32$5 + (i32.and + (get_local $i64toi32_i32$4) + (i32.const 31) + ) + ) + (if + (i32.le_u + (i32.const 32) + (i32.and + (get_local $i64toi32_i32$4) + (i32.const 63) + ) + ) + (block + (set_local $i64toi32_i32$2 + (i32.shl + (get_local $i64toi32_i32$3) + (get_local $i64toi32_i32$5) + ) + ) + (set_local $11 + (i32.const 0) + ) + ) + (block + (set_local $i64toi32_i32$2 + (i32.or + (i32.and + (i32.sub + (i32.shl + (i32.const 1) + (get_local $i64toi32_i32$5) + ) + (i32.const 1) + ) + (i32.shr_u + (get_local $i64toi32_i32$3) + (i32.sub + (i32.const 32) + (get_local $i64toi32_i32$5) + ) + ) + ) + (i32.shl + (get_local $i64toi32_i32$1) + (get_local $i64toi32_i32$5) + ) + ) + ) + (set_local $11 + (i32.shl + (get_local $i64toi32_i32$3) + (get_local $i64toi32_i32$5) + ) + ) + ) + ) ) + (set_local $i64toi32_i32$1 + (get_local $11) + ) + (set_local $i64toi32_i32$2 + (i32.or + (get_local $i64toi32_i32$0) + (get_local $i64toi32_i32$2) + ) + ) + ) + (set_local $3 + (i32.or + (get_local $i64toi32_i32$3) + (get_local $i64toi32_i32$1) + ) + ) + (set_local $3$hi + (get_local $i64toi32_i32$2) ) ) (loop $continue|0 (if - ;;@ ~lib/memory.ts:243:9 (i32.ge_u (get_local $2) - ;;@ ~lib/memory.ts:243:14 (i32.const 32) ) (block - ;;@ ~lib/memory.ts:244:4 - (i64.store - ;;@ ~lib/memory.ts:244:15 - (get_local $0) - ;;@ ~lib/memory.ts:244:21 - (get_local $3) - ) - ;;@ ~lib/memory.ts:245:4 - (i64.store - ;;@ ~lib/memory.ts:245:15 - (i32.add + (block + (set_local $i64toi32_i32$3 (get_local $0) - ;;@ ~lib/memory.ts:245:22 - (i32.const 8) ) - ;;@ ~lib/memory.ts:245:25 - (get_local $3) - ) - ;;@ ~lib/memory.ts:246:4 - (i64.store - ;;@ ~lib/memory.ts:246:15 - (i32.add - (get_local $0) - ;;@ ~lib/memory.ts:246:22 - (i32.const 16) + (set_local $i64toi32_i32$2 + (get_local $3$hi) ) - ;;@ ~lib/memory.ts:246:26 - (get_local $3) - ) - ;;@ ~lib/memory.ts:247:4 - (i64.store - ;;@ ~lib/memory.ts:247:15 - (i32.add - (get_local $0) - ;;@ ~lib/memory.ts:247:22 - (i32.const 24) + (i32.store + (get_local $i64toi32_i32$3) + (get_local $3) + ) + (i32.store offset=4 align=1 + (get_local $i64toi32_i32$3) + (get_local $i64toi32_i32$2) + ) + ) + (block + (set_local $i64toi32_i32$3 + (i32.add + (get_local $0) + (i32.const 8) + ) + ) + (set_local $i64toi32_i32$2 + (get_local $3$hi) + ) + (i32.store + (get_local $i64toi32_i32$3) + (get_local $3) + ) + (i32.store offset=4 align=1 + (get_local $i64toi32_i32$3) + (get_local $i64toi32_i32$2) + ) + ) + (block + (set_local $i64toi32_i32$3 + (i32.add + (get_local $0) + (i32.const 16) + ) + ) + (set_local $i64toi32_i32$2 + (get_local $3$hi) + ) + (i32.store + (get_local $i64toi32_i32$3) + (get_local $3) + ) + (i32.store offset=4 align=1 + (get_local $i64toi32_i32$3) + (get_local $i64toi32_i32$2) + ) + ) + (block + (set_local $i64toi32_i32$3 + (i32.add + (get_local $0) + (i32.const 24) + ) + ) + (set_local $i64toi32_i32$2 + (get_local $3$hi) + ) + (i32.store + (get_local $i64toi32_i32$3) + (get_local $3) + ) + (i32.store offset=4 align=1 + (get_local $i64toi32_i32$3) + (get_local $i64toi32_i32$2) ) - ;;@ ~lib/memory.ts:247:26 - (get_local $3) ) - ;;@ ~lib/memory.ts:248:4 (set_local $2 (i32.sub (get_local $2) - ;;@ ~lib/memory.ts:248:9 (i32.const 32) ) ) - ;;@ ~lib/memory.ts:249:4 (set_local $0 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:249:12 (i32.const 32) ) ) @@ -788,50 +763,91 @@ (func $~lib/memory/copy_memory (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + (local $14 i32) + (local $15 i32) + (local $16 i32) + (local $17 i32) + (local $18 i32) + (local $19 i32) + (local $20 i32) + (local $21 i32) + (local $22 i32) + (local $23 i32) + (local $24 i32) + (local $25 i32) + (local $26 i32) + (local $27 i32) + (local $28 i32) + (local $29 i32) + (local $30 i32) + (local $31 i32) + (local $32 i32) + (local $33 i32) + (local $34 i32) + (local $35 i32) + (local $36 i32) + (local $37 i32) + (local $38 i32) + (local $39 i32) + (local $40 i32) + (local $41 i32) + (local $42 i32) + (local $43 i32) + (local $44 i32) (loop $continue|0 (if - ;;@ ~lib/memory.ts:8:9 - (if (result i32) - (get_local $2) - ;;@ ~lib/memory.ts:8:14 + (get_local $2) + (set_local $5 (i32.and - ;;@ ~lib/memory.ts:8:15 (get_local $1) - ;;@ ~lib/memory.ts:8:21 (i32.const 3) ) + ) + (set_local $5 (get_local $2) ) + ) + (if + (get_local $5) (block + (set_local $3 + (get_local $0) + ) (set_local $0 (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:9:14 - (get_local $0) - ) + (get_local $3) (i32.const 1) ) ) - ;;@ ~lib/memory.ts:9:4 - (i32.store8 + (set_local $6 (get_local $3) - ;;@ ~lib/memory.ts:9:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:9:22 - (i32.load8_u + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add (get_local $3) + (i32.const 1) ) ) ) - ;;@ ~lib/memory.ts:10:4 + (i32.store8 + (get_local $6) + (i32.load8_u + (get_local $3) + ) + ) (set_local $2 (i32.sub (get_local $2) @@ -842,113 +858,78 @@ ) ) ) - ;;@ ~lib/memory.ts:14:2 (if (i32.eqz - ;;@ ~lib/memory.ts:14:6 (i32.and - ;;@ ~lib/memory.ts:14:7 (get_local $0) - ;;@ ~lib/memory.ts:14:14 (i32.const 3) ) ) - ;;@ ~lib/memory.ts:14:23 (block (loop $continue|1 (if - ;;@ ~lib/memory.ts:15:11 (i32.ge_u (get_local $2) - ;;@ ~lib/memory.ts:15:16 (i32.const 16) ) (block - ;;@ ~lib/memory.ts:16:6 (i32.store - ;;@ ~lib/memory.ts:16:17 (get_local $0) - ;;@ ~lib/memory.ts:16:28 (i32.load - ;;@ ~lib/memory.ts:16:38 (get_local $1) ) ) - ;;@ ~lib/memory.ts:17:6 (i32.store - ;;@ ~lib/memory.ts:17:17 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:17:25 (i32.const 4) ) - ;;@ ~lib/memory.ts:17:28 (i32.load - ;;@ ~lib/memory.ts:17:38 (i32.add (get_local $1) - ;;@ ~lib/memory.ts:17:45 (i32.const 4) ) ) ) - ;;@ ~lib/memory.ts:18:6 (i32.store - ;;@ ~lib/memory.ts:18:17 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:18:25 (i32.const 8) ) - ;;@ ~lib/memory.ts:18:28 (i32.load - ;;@ ~lib/memory.ts:18:38 (i32.add (get_local $1) - ;;@ ~lib/memory.ts:18:45 (i32.const 8) ) ) ) - ;;@ ~lib/memory.ts:19:6 (i32.store - ;;@ ~lib/memory.ts:19:17 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:19:24 (i32.const 12) ) - ;;@ ~lib/memory.ts:19:28 (i32.load - ;;@ ~lib/memory.ts:19:38 (i32.add (get_local $1) - ;;@ ~lib/memory.ts:19:44 (i32.const 12) ) ) ) - ;;@ ~lib/memory.ts:20:6 (set_local $1 (i32.add (get_local $1) - ;;@ ~lib/memory.ts:20:13 (i32.const 16) ) ) - ;;@ ~lib/memory.ts:20:17 (set_local $0 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:20:25 (i32.const 16) ) ) - ;;@ ~lib/memory.ts:20:29 (set_local $2 (i32.sub (get_local $2) - ;;@ ~lib/memory.ts:20:34 (i32.const 16) ) ) @@ -956,180 +937,127 @@ ) ) ) - ;;@ ~lib/memory.ts:22:4 (if - ;;@ ~lib/memory.ts:22:8 (i32.and (get_local $2) - ;;@ ~lib/memory.ts:22:12 (i32.const 8) ) - ;;@ ~lib/memory.ts:22:15 (block - ;;@ ~lib/memory.ts:23:6 (i32.store - ;;@ ~lib/memory.ts:23:17 (get_local $0) - ;;@ ~lib/memory.ts:23:27 (i32.load - ;;@ ~lib/memory.ts:23:37 (get_local $1) ) ) - ;;@ ~lib/memory.ts:24:6 (i32.store - ;;@ ~lib/memory.ts:24:17 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:24:24 (i32.const 4) ) - ;;@ ~lib/memory.ts:24:27 (i32.load - ;;@ ~lib/memory.ts:24:37 (i32.add (get_local $1) - ;;@ ~lib/memory.ts:24:43 (i32.const 4) ) ) ) - ;;@ ~lib/memory.ts:25:6 (set_local $0 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:25:14 (i32.const 8) ) ) - ;;@ ~lib/memory.ts:25:17 (set_local $1 (i32.add (get_local $1) - ;;@ ~lib/memory.ts:25:24 (i32.const 8) ) ) ) ) - ;;@ ~lib/memory.ts:27:4 (if - ;;@ ~lib/memory.ts:27:8 (i32.and (get_local $2) - ;;@ ~lib/memory.ts:27:12 (i32.const 4) ) - ;;@ ~lib/memory.ts:27:15 (block - ;;@ ~lib/memory.ts:28:6 (i32.store - ;;@ ~lib/memory.ts:28:17 (get_local $0) - ;;@ ~lib/memory.ts:28:23 (i32.load - ;;@ ~lib/memory.ts:28:33 (get_local $1) ) ) - ;;@ ~lib/memory.ts:29:6 (set_local $0 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:29:14 (i32.const 4) ) ) - ;;@ ~lib/memory.ts:29:17 (set_local $1 (i32.add (get_local $1) - ;;@ ~lib/memory.ts:29:24 (i32.const 4) ) ) ) ) - ;;@ ~lib/memory.ts:31:4 (if - ;;@ ~lib/memory.ts:31:8 (i32.and (get_local $2) - ;;@ ~lib/memory.ts:31:12 (i32.const 2) ) - ;;@ ~lib/memory.ts:31:15 (block - ;;@ ~lib/memory.ts:32:6 (i32.store16 - ;;@ ~lib/memory.ts:32:17 (get_local $0) - ;;@ ~lib/memory.ts:32:23 (i32.load16_u - ;;@ ~lib/memory.ts:32:33 (get_local $1) ) ) - ;;@ ~lib/memory.ts:33:6 (set_local $0 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:33:14 (i32.const 2) ) ) - ;;@ ~lib/memory.ts:33:17 (set_local $1 (i32.add (get_local $1) - ;;@ ~lib/memory.ts:33:24 (i32.const 2) ) ) ) ) - ;;@ ~lib/memory.ts:35:4 (if - ;;@ ~lib/memory.ts:35:8 (i32.and (get_local $2) - ;;@ ~lib/memory.ts:35:12 (i32.const 1) ) - ;;@ ~lib/memory.ts:36:16 (block (set_local $3 (get_local $0) ) - ;;@ ~lib/memory.ts:36:6 - (i32.store8 + (set_local $7 (get_local $3) - ;;@ ~lib/memory.ts:36:33 - (block (result i32) - (set_local $3 - (get_local $1) - ) - ;;@ ~lib/memory.ts:36:24 - (i32.load8_u - (get_local $3) - ) + ) + (set_local $3 + (get_local $1) + ) + (i32.store8 + (get_local $7) + (i32.load8_u + (get_local $3) ) ) ) ) - ;;@ ~lib/memory.ts:38:4 (return) ) ) - ;;@ ~lib/memory.ts:43:2 (if - ;;@ ~lib/memory.ts:43:6 (i32.ge_u (get_local $2) - ;;@ ~lib/memory.ts:43:11 (i32.const 32) ) - ;;@ ~lib/memory.ts:44:4 (block $break|2 (block $case2|2 (block $case1|2 @@ -1137,10 +1065,8 @@ (block $tablify|0 (br_table $case0|2 $case1|2 $case2|2 $tablify|0 (i32.sub - ;;@ ~lib/memory.ts:44:12 (i32.and (get_local $0) - ;;@ ~lib/memory.ts:44:19 (i32.const 3) ) (i32.const 1) @@ -1149,268 +1075,219 @@ ) (br $break|2) ) - ;;@ ~lib/memory.ts:47:8 (set_local $4 - ;;@ ~lib/memory.ts:47:12 (i32.load - ;;@ ~lib/memory.ts:47:22 (get_local $1) ) ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:48:18 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:48:8 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:48:35 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:48:26 - (i32.load8_u - (get_local $3) - ) - ) + (set_local $3 + (get_local $0) ) (set_local $0 (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:49:18 - (get_local $0) - ) + (get_local $3) (i32.const 1) ) ) - ;;@ ~lib/memory.ts:49:8 - (i32.store8 + (set_local $8 (get_local $3) - ;;@ ~lib/memory.ts:49:35 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:49:26 - (i32.load8_u + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add (get_local $3) + (i32.const 1) ) ) ) + (i32.store8 + (get_local $8) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) (set_local $0 (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:50:18 - (get_local $0) - ) + (get_local $3) (i32.const 1) ) ) - ;;@ ~lib/memory.ts:50:8 - (i32.store8 + (set_local $9 (get_local $3) - ;;@ ~lib/memory.ts:50:35 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:50:26 - (i32.load8_u + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add (get_local $3) + (i32.const 1) ) ) ) - ;;@ ~lib/memory.ts:51:8 + (i32.store8 + (get_local $9) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $10 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $10) + (i32.load8_u + (get_local $3) + ) + ) (set_local $2 (i32.sub (get_local $2) - ;;@ ~lib/memory.ts:51:13 (i32.const 3) ) ) (loop $continue|3 (if - ;;@ ~lib/memory.ts:52:15 (i32.ge_u (get_local $2) - ;;@ ~lib/memory.ts:52:20 (i32.const 17) ) (block - ;;@ ~lib/memory.ts:54:10 + (set_local $3 + (i32.load + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) (i32.store - ;;@ ~lib/memory.ts:54:21 (get_local $0) - ;;@ ~lib/memory.ts:54:27 (i32.or (i32.shr_u (get_local $4) - ;;@ ~lib/memory.ts:54:32 (i32.const 24) ) - ;;@ ~lib/memory.ts:54:37 (i32.shl - ;;@ ~lib/memory.ts:53:10 - (tee_local $3 - ;;@ ~lib/memory.ts:53:14 - (i32.load - ;;@ ~lib/memory.ts:53:24 - (i32.add - (get_local $1) - ;;@ ~lib/memory.ts:53:30 - (i32.const 1) - ) - ) - ) - ;;@ ~lib/memory.ts:54:42 + (get_local $3) (i32.const 8) ) ) ) - ;;@ ~lib/memory.ts:56:10 + (set_local $4 + (i32.load + (i32.add + (get_local $1) + (i32.const 5) + ) + ) + ) (i32.store - ;;@ ~lib/memory.ts:56:21 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:56:28 (i32.const 4) ) - ;;@ ~lib/memory.ts:56:31 (i32.or (i32.shr_u (get_local $3) - ;;@ ~lib/memory.ts:56:36 (i32.const 24) ) - ;;@ ~lib/memory.ts:56:41 (i32.shl - ;;@ ~lib/memory.ts:55:10 - (tee_local $4 - ;;@ ~lib/memory.ts:55:14 - (i32.load - ;;@ ~lib/memory.ts:55:24 - (i32.add - (get_local $1) - ;;@ ~lib/memory.ts:55:30 - (i32.const 5) - ) - ) - ) - ;;@ ~lib/memory.ts:56:46 + (get_local $4) (i32.const 8) ) ) ) - ;;@ ~lib/memory.ts:58:10 + (set_local $3 + (i32.load + (i32.add + (get_local $1) + (i32.const 9) + ) + ) + ) (i32.store - ;;@ ~lib/memory.ts:58:21 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:58:28 (i32.const 8) ) - ;;@ ~lib/memory.ts:58:31 (i32.or (i32.shr_u (get_local $4) - ;;@ ~lib/memory.ts:58:36 (i32.const 24) ) - ;;@ ~lib/memory.ts:58:41 (i32.shl - ;;@ ~lib/memory.ts:57:10 - (tee_local $3 - ;;@ ~lib/memory.ts:57:14 - (i32.load - ;;@ ~lib/memory.ts:57:24 - (i32.add - (get_local $1) - ;;@ ~lib/memory.ts:57:30 - (i32.const 9) - ) - ) - ) - ;;@ ~lib/memory.ts:58:46 + (get_local $3) (i32.const 8) ) ) ) - ;;@ ~lib/memory.ts:60:10 + (set_local $4 + (i32.load + (i32.add + (get_local $1) + (i32.const 13) + ) + ) + ) (i32.store - ;;@ ~lib/memory.ts:60:21 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:60:28 (i32.const 12) ) - ;;@ ~lib/memory.ts:60:32 (i32.or (i32.shr_u (get_local $3) - ;;@ ~lib/memory.ts:60:37 (i32.const 24) ) - ;;@ ~lib/memory.ts:60:42 (i32.shl - ;;@ ~lib/memory.ts:59:10 - (tee_local $4 - ;;@ ~lib/memory.ts:59:14 - (i32.load - ;;@ ~lib/memory.ts:59:24 - (i32.add - (get_local $1) - ;;@ ~lib/memory.ts:59:30 - (i32.const 13) - ) - ) - ) - ;;@ ~lib/memory.ts:60:47 + (get_local $4) (i32.const 8) ) ) ) - ;;@ ~lib/memory.ts:61:10 (set_local $1 (i32.add (get_local $1) - ;;@ ~lib/memory.ts:61:17 (i32.const 16) ) ) - ;;@ ~lib/memory.ts:61:21 (set_local $0 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:61:29 (i32.const 16) ) ) - ;;@ ~lib/memory.ts:61:33 (set_local $2 (i32.sub (get_local $2) - ;;@ ~lib/memory.ts:61:38 (i32.const 16) ) ) @@ -1418,243 +1295,192 @@ ) ) ) - ;;@ ~lib/memory.ts:63:8 (br $break|2) ) - ;;@ ~lib/memory.ts:66:8 (set_local $4 - ;;@ ~lib/memory.ts:66:12 (i32.load - ;;@ ~lib/memory.ts:66:22 (get_local $1) ) ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:67:18 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:67:8 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:67:35 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:67:26 - (i32.load8_u - (get_local $3) - ) - ) + (set_local $3 + (get_local $0) ) (set_local $0 (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:68:18 - (get_local $0) - ) + (get_local $3) (i32.const 1) ) ) - ;;@ ~lib/memory.ts:68:8 - (i32.store8 + (set_local $11 (get_local $3) - ;;@ ~lib/memory.ts:68:35 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:68:26 - (i32.load8_u + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add (get_local $3) + (i32.const 1) ) ) ) - ;;@ ~lib/memory.ts:69:8 + (i32.store8 + (get_local $11) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $12 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $12) + (i32.load8_u + (get_local $3) + ) + ) (set_local $2 (i32.sub (get_local $2) - ;;@ ~lib/memory.ts:69:13 (i32.const 2) ) ) (loop $continue|4 (if - ;;@ ~lib/memory.ts:70:15 (i32.ge_u (get_local $2) - ;;@ ~lib/memory.ts:70:20 (i32.const 18) ) (block - ;;@ ~lib/memory.ts:72:10 + (set_local $3 + (i32.load + (i32.add + (get_local $1) + (i32.const 2) + ) + ) + ) (i32.store - ;;@ ~lib/memory.ts:72:21 (get_local $0) - ;;@ ~lib/memory.ts:72:27 (i32.or (i32.shr_u (get_local $4) - ;;@ ~lib/memory.ts:72:32 (i32.const 16) ) - ;;@ ~lib/memory.ts:72:37 (i32.shl - ;;@ ~lib/memory.ts:71:10 - (tee_local $3 - ;;@ ~lib/memory.ts:71:14 - (i32.load - ;;@ ~lib/memory.ts:71:24 - (i32.add - (get_local $1) - ;;@ ~lib/memory.ts:71:30 - (i32.const 2) - ) - ) - ) - ;;@ ~lib/memory.ts:72:42 + (get_local $3) (i32.const 16) ) ) ) - ;;@ ~lib/memory.ts:74:10 + (set_local $4 + (i32.load + (i32.add + (get_local $1) + (i32.const 6) + ) + ) + ) (i32.store - ;;@ ~lib/memory.ts:74:21 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:74:28 (i32.const 4) ) - ;;@ ~lib/memory.ts:74:31 (i32.or (i32.shr_u (get_local $3) - ;;@ ~lib/memory.ts:74:36 (i32.const 16) ) - ;;@ ~lib/memory.ts:74:41 (i32.shl - ;;@ ~lib/memory.ts:73:10 - (tee_local $4 - ;;@ ~lib/memory.ts:73:14 - (i32.load - ;;@ ~lib/memory.ts:73:24 - (i32.add - (get_local $1) - ;;@ ~lib/memory.ts:73:30 - (i32.const 6) - ) - ) - ) - ;;@ ~lib/memory.ts:74:46 + (get_local $4) (i32.const 16) ) ) ) - ;;@ ~lib/memory.ts:76:10 + (set_local $3 + (i32.load + (i32.add + (get_local $1) + (i32.const 10) + ) + ) + ) (i32.store - ;;@ ~lib/memory.ts:76:21 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:76:28 (i32.const 8) ) - ;;@ ~lib/memory.ts:76:31 (i32.or (i32.shr_u (get_local $4) - ;;@ ~lib/memory.ts:76:36 (i32.const 16) ) - ;;@ ~lib/memory.ts:76:41 (i32.shl - ;;@ ~lib/memory.ts:75:10 - (tee_local $3 - ;;@ ~lib/memory.ts:75:14 - (i32.load - ;;@ ~lib/memory.ts:75:24 - (i32.add - (get_local $1) - ;;@ ~lib/memory.ts:75:30 - (i32.const 10) - ) - ) - ) - ;;@ ~lib/memory.ts:76:46 + (get_local $3) (i32.const 16) ) ) ) - ;;@ ~lib/memory.ts:78:10 + (set_local $4 + (i32.load + (i32.add + (get_local $1) + (i32.const 14) + ) + ) + ) (i32.store - ;;@ ~lib/memory.ts:78:21 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:78:28 (i32.const 12) ) - ;;@ ~lib/memory.ts:78:32 (i32.or (i32.shr_u (get_local $3) - ;;@ ~lib/memory.ts:78:37 (i32.const 16) ) - ;;@ ~lib/memory.ts:78:42 (i32.shl - ;;@ ~lib/memory.ts:77:10 - (tee_local $4 - ;;@ ~lib/memory.ts:77:14 - (i32.load - ;;@ ~lib/memory.ts:77:24 - (i32.add - (get_local $1) - ;;@ ~lib/memory.ts:77:30 - (i32.const 14) - ) - ) - ) - ;;@ ~lib/memory.ts:78:47 + (get_local $4) (i32.const 16) ) ) ) - ;;@ ~lib/memory.ts:79:10 (set_local $1 (i32.add (get_local $1) - ;;@ ~lib/memory.ts:79:17 (i32.const 16) ) ) - ;;@ ~lib/memory.ts:79:21 (set_local $0 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:79:29 (i32.const 16) ) ) - ;;@ ~lib/memory.ts:79:33 (set_local $2 (i32.sub (get_local $2) - ;;@ ~lib/memory.ts:79:38 (i32.const 16) ) ) @@ -1662,215 +1488,163 @@ ) ) ) - ;;@ ~lib/memory.ts:81:8 (br $break|2) ) - ;;@ ~lib/memory.ts:84:8 (set_local $4 - ;;@ ~lib/memory.ts:84:12 (i32.load - ;;@ ~lib/memory.ts:84:22 (get_local $1) ) ) + (set_local $3 + (get_local $0) + ) (set_local $0 (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:85:18 - (get_local $0) - ) + (get_local $3) (i32.const 1) ) ) - ;;@ ~lib/memory.ts:85:8 - (i32.store8 + (set_local $13 (get_local $3) - ;;@ ~lib/memory.ts:85:35 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:85:26 - (i32.load8_u + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add (get_local $3) + (i32.const 1) ) ) ) - ;;@ ~lib/memory.ts:86:8 + (i32.store8 + (get_local $13) + (i32.load8_u + (get_local $3) + ) + ) (set_local $2 (i32.sub (get_local $2) - ;;@ ~lib/memory.ts:86:13 (i32.const 1) ) ) (loop $continue|5 (if - ;;@ ~lib/memory.ts:87:15 (i32.ge_u (get_local $2) - ;;@ ~lib/memory.ts:87:20 (i32.const 19) ) (block - ;;@ ~lib/memory.ts:89:10 + (set_local $3 + (i32.load + (i32.add + (get_local $1) + (i32.const 3) + ) + ) + ) (i32.store - ;;@ ~lib/memory.ts:89:21 (get_local $0) - ;;@ ~lib/memory.ts:89:27 (i32.or (i32.shr_u (get_local $4) - ;;@ ~lib/memory.ts:89:32 (i32.const 8) ) - ;;@ ~lib/memory.ts:89:36 (i32.shl - ;;@ ~lib/memory.ts:88:10 - (tee_local $3 - ;;@ ~lib/memory.ts:88:14 - (i32.load - ;;@ ~lib/memory.ts:88:24 - (i32.add - (get_local $1) - ;;@ ~lib/memory.ts:88:30 - (i32.const 3) - ) - ) - ) - ;;@ ~lib/memory.ts:89:41 + (get_local $3) (i32.const 24) ) ) ) - ;;@ ~lib/memory.ts:91:10 + (set_local $4 + (i32.load + (i32.add + (get_local $1) + (i32.const 7) + ) + ) + ) (i32.store - ;;@ ~lib/memory.ts:91:21 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:91:28 (i32.const 4) ) - ;;@ ~lib/memory.ts:91:31 (i32.or (i32.shr_u (get_local $3) - ;;@ ~lib/memory.ts:91:36 (i32.const 8) ) - ;;@ ~lib/memory.ts:91:40 (i32.shl - ;;@ ~lib/memory.ts:90:10 - (tee_local $4 - ;;@ ~lib/memory.ts:90:14 - (i32.load - ;;@ ~lib/memory.ts:90:24 - (i32.add - (get_local $1) - ;;@ ~lib/memory.ts:90:30 - (i32.const 7) - ) - ) - ) - ;;@ ~lib/memory.ts:91:45 + (get_local $4) (i32.const 24) ) ) ) - ;;@ ~lib/memory.ts:93:10 + (set_local $3 + (i32.load + (i32.add + (get_local $1) + (i32.const 11) + ) + ) + ) (i32.store - ;;@ ~lib/memory.ts:93:21 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:93:28 (i32.const 8) ) - ;;@ ~lib/memory.ts:93:31 (i32.or (i32.shr_u (get_local $4) - ;;@ ~lib/memory.ts:93:36 (i32.const 8) ) - ;;@ ~lib/memory.ts:93:40 (i32.shl - ;;@ ~lib/memory.ts:92:10 - (tee_local $3 - ;;@ ~lib/memory.ts:92:14 - (i32.load - ;;@ ~lib/memory.ts:92:24 - (i32.add - (get_local $1) - ;;@ ~lib/memory.ts:92:30 - (i32.const 11) - ) - ) - ) - ;;@ ~lib/memory.ts:93:45 + (get_local $3) (i32.const 24) ) ) ) - ;;@ ~lib/memory.ts:95:10 + (set_local $4 + (i32.load + (i32.add + (get_local $1) + (i32.const 15) + ) + ) + ) (i32.store - ;;@ ~lib/memory.ts:95:21 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:95:28 (i32.const 12) ) - ;;@ ~lib/memory.ts:95:32 (i32.or (i32.shr_u (get_local $3) - ;;@ ~lib/memory.ts:95:37 (i32.const 8) ) - ;;@ ~lib/memory.ts:95:41 (i32.shl - ;;@ ~lib/memory.ts:94:10 - (tee_local $4 - ;;@ ~lib/memory.ts:94:14 - (i32.load - ;;@ ~lib/memory.ts:94:24 - (i32.add - (get_local $1) - ;;@ ~lib/memory.ts:94:30 - (i32.const 15) - ) - ) - ) - ;;@ ~lib/memory.ts:95:46 + (get_local $4) (i32.const 24) ) ) ) - ;;@ ~lib/memory.ts:96:10 (set_local $1 (i32.add (get_local $1) - ;;@ ~lib/memory.ts:96:17 (i32.const 16) ) ) - ;;@ ~lib/memory.ts:96:21 (set_local $0 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:96:29 (i32.const 16) ) ) - ;;@ ~lib/memory.ts:96:33 (set_local $2 (i32.sub (get_local $2) - ;;@ ~lib/memory.ts:96:38 (i32.const 16) ) ) @@ -1880,1111 +1654,1112 @@ ) ) ) - ;;@ ~lib/memory.ts:104:2 (if - ;;@ ~lib/memory.ts:104:6 (i32.and (get_local $2) - ;;@ ~lib/memory.ts:104:10 (i32.const 16) ) - ;;@ ~lib/memory.ts:104:14 - (block - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:105:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:105:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:105:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:105:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:106:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:106:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:106:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:106:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:107:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:107:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:107:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:107:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:108:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:108:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:108:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:108:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:109:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:109:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:109:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:109:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:110:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:110:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:110:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:110:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:111:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:111:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:111:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:111:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:112:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:112:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:112:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:112:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:113:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:113:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:113:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:113:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:114:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:114:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:114:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:114:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:115:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:115:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:115:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:115:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:116:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:116:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:116:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:116:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:117:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:117:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:117:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:117:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:118:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:118:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:118:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:118:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:119:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:119:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:119:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:119:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:120:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:120:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:120:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:120:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - ) - ) - ;;@ ~lib/memory.ts:122:2 - (if - ;;@ ~lib/memory.ts:122:6 - (i32.and - (get_local $2) - ;;@ ~lib/memory.ts:122:10 - (i32.const 8) - ) - ;;@ ~lib/memory.ts:122:13 - (block - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:123:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:123:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:123:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:123:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:124:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:124:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:124:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:124:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:125:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:125:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:125:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:125:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:126:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:126:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:126:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:126:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:127:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:127:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:127:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:127:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:128:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:128:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:128:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:128:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:129:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:129:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:129:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:129:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:130:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:130:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:130:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:130:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - ) - ) - ;;@ ~lib/memory.ts:132:2 - (if - ;;@ ~lib/memory.ts:132:6 - (i32.and - (get_local $2) - ;;@ ~lib/memory.ts:132:10 - (i32.const 4) - ) - ;;@ ~lib/memory.ts:132:13 - (block - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:133:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:133:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:133:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:133:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:134:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:134:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:134:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:134:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:135:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:135:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:135:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:135:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:136:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:136:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:136:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:136:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - ) - ) - ;;@ ~lib/memory.ts:138:2 - (if - ;;@ ~lib/memory.ts:138:6 - (i32.and - (get_local $2) - ;;@ ~lib/memory.ts:138:10 - (i32.const 2) - ) - ;;@ ~lib/memory.ts:138:13 - (block - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:139:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:139:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:139:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:139:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - (set_local $0 - (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:140:14 - (get_local $0) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:140:4 - (i32.store8 - (get_local $3) - ;;@ ~lib/memory.ts:140:31 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:140:22 - (i32.load8_u - (get_local $3) - ) - ) - ) - ) - ) - ;;@ ~lib/memory.ts:142:2 - (if - ;;@ ~lib/memory.ts:142:6 - (i32.and - (get_local $2) - ;;@ ~lib/memory.ts:142:10 - (i32.const 1) - ) - ;;@ ~lib/memory.ts:143:14 (block (set_local $3 (get_local $0) ) - ;;@ ~lib/memory.ts:143:4 - (i32.store8 + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $14 (get_local $3) - ;;@ ~lib/memory.ts:143:31 - (block (result i32) - (set_local $3 - (get_local $1) - ) - ;;@ ~lib/memory.ts:143:22 - (i32.load8_u + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add (get_local $3) + (i32.const 1) ) ) ) + (i32.store8 + (get_local $14) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $15 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $15) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $16 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $16) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $17 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $17) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $18 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $18) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $19 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $19) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $20 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $20) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $21 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $21) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $22 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $22) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $23 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $23) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $24 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $24) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $25 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $25) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $26 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $26) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $27 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $27) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $28 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $28) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $29 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $29) + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + (if + (i32.and + (get_local $2) + (i32.const 8) + ) + (block + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $30 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $30) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $31 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $31) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $32 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $32) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $33 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $33) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $34 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $34) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $35 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $35) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $36 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $36) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $37 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $37) + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + (if + (i32.and + (get_local $2) + (i32.const 4) + ) + (block + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $38 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $38) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $39 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $39) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $40 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $40) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $41 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $41) + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + (if + (i32.and + (get_local $2) + (i32.const 2) + ) + (block + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $42 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $42) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (set_local $43 + (get_local $3) + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $43) + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + (if + (i32.and + (get_local $2) + (i32.const 1) + ) + (block + (set_local $3 + (get_local $0) + ) + (set_local $44 + (get_local $3) + ) + (set_local $3 + (get_local $1) + ) + (i32.store8 + (get_local $44) + (i32.load8_u + (get_local $3) + ) + ) ) ) ) (func $~lib/memory/move_memory (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) - ;;@ ~lib/memory.ts:151:2 + (local $i64toi32_i32$1 i32) + (local $i64toi32_i32$0 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $wasm2asm_i32$0 i32) + (local $wasm2asm_i32$1 i32) (if - ;;@ ~lib/memory.ts:151:6 (i32.eq (get_local $0) - ;;@ ~lib/memory.ts:151:14 (get_local $1) ) - ;;@ ~lib/memory.ts:151:19 (return) ) - ;;@ ~lib/memory.ts:152:2 - (if - ;;@ ~lib/memory.ts:152:6 - (i32.and - (if (result i32) - (tee_local $3 - (i32.le_u - (i32.add - (get_local $1) - ;;@ ~lib/memory.ts:152:12 - (get_local $2) - ) - ;;@ ~lib/memory.ts:152:17 - (get_local $0) - ) - ) - (get_local $3) - ;;@ ~lib/memory.ts:152:25 + (block + (block + (set_local $3 (i32.le_u (i32.add - (get_local $0) - ;;@ ~lib/memory.ts:152:32 + (get_local $1) (get_local $2) ) - ;;@ ~lib/memory.ts:152:37 - (get_local $1) + (get_local $0) ) ) - (i32.const 1) - ) - ;;@ ~lib/memory.ts:152:42 - (block - ;;@ ~lib/memory.ts:153:4 - (call $~lib/memory/copy_memory - ;;@ ~lib/memory.ts:153:16 - (get_local $0) - ;;@ ~lib/memory.ts:153:22 - (get_local $1) - ;;@ ~lib/memory.ts:153:27 - (get_local $2) + (if + (get_local $3) + (set_local $6 + (get_local $3) + ) + (set_local $6 + (i32.le_u + (i32.add + (get_local $0) + (get_local $2) + ) + (get_local $1) + ) + ) + ) + ) + (if + (i32.and + (get_local $6) + (i32.const 1) + ) + (block + (call $~lib/memory/copy_memory + (get_local $0) + (get_local $1) + (get_local $2) + ) + (return) ) - ;;@ ~lib/memory.ts:154:4 - (return) ) ) - ;;@ ~lib/memory.ts:156:2 (if - ;;@ ~lib/memory.ts:156:6 (i32.lt_u (get_local $0) - ;;@ ~lib/memory.ts:156:13 (get_local $1) ) - ;;@ ~lib/memory.ts:156:18 (block - ;;@ ~lib/memory.ts:157:4 (if - ;;@ ~lib/memory.ts:157:8 (i32.eq (i32.and - ;;@ ~lib/memory.ts:157:9 (get_local $1) - ;;@ ~lib/memory.ts:157:15 (i32.const 7) ) - ;;@ ~lib/memory.ts:157:21 (i32.and - ;;@ ~lib/memory.ts:157:22 (get_local $0) - ;;@ ~lib/memory.ts:157:29 (i32.const 7) ) ) - ;;@ ~lib/memory.ts:157:33 (block (loop $continue|0 (if - ;;@ ~lib/memory.ts:158:13 (i32.and (get_local $0) - ;;@ ~lib/memory.ts:158:20 (i32.const 7) ) (block - ;;@ ~lib/memory.ts:159:8 (if - ;;@ ~lib/memory.ts:159:12 (i32.eqz - ;;@ ~lib/memory.ts:159:13 (get_local $2) ) - ;;@ ~lib/memory.ts:159:16 (return) ) - ;;@ ~lib/memory.ts:160:8 (set_local $2 (i32.sub - ;;@ ~lib/memory.ts:160:10 (get_local $2) (i32.const 1) ) ) + (set_local $3 + (get_local $0) + ) (set_local $0 (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:161:18 - (get_local $0) - ) + (get_local $3) (i32.const 1) ) ) - ;;@ ~lib/memory.ts:161:8 - (i32.store8 + (set_local $7 (get_local $3) - ;;@ ~lib/memory.ts:161:35 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:161:26 - (i32.load8_u + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add (get_local $3) + (i32.const 1) ) ) ) + (i32.store8 + (get_local $7) + (i32.load8_u + (get_local $3) + ) + ) (br $continue|0) ) ) ) (loop $continue|1 (if - ;;@ ~lib/memory.ts:163:13 (i32.ge_u (get_local $2) - ;;@ ~lib/memory.ts:163:18 (i32.const 8) ) (block - ;;@ ~lib/memory.ts:164:8 - (i64.store - ;;@ ~lib/memory.ts:164:19 - (get_local $0) - ;;@ ~lib/memory.ts:164:25 - (i64.load - ;;@ ~lib/memory.ts:164:35 - (get_local $1) + (block + (set_local $i64toi32_i32$1 + (get_local $0) + ) + (set_local $8 + (get_local $i64toi32_i32$1) + ) + (block + (set_local $i64toi32_i32$1 + (get_local $1) + ) + (set_local $i64toi32_i32$0 + (i32.load offset=4 align=1 + (get_local $i64toi32_i32$1) + ) + ) + ) + (i32.store + (get_local $8) + (i32.load + (get_local $i64toi32_i32$1) + ) + ) + (i32.store offset=4 align=1 + (get_local $i64toi32_i32$1) + (get_local $i64toi32_i32$0) ) ) - ;;@ ~lib/memory.ts:165:8 (set_local $2 (i32.sub (get_local $2) - ;;@ ~lib/memory.ts:165:16 (i32.const 8) ) ) - ;;@ ~lib/memory.ts:166:8 (set_local $0 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:166:16 (i32.const 8) ) ) - ;;@ ~lib/memory.ts:167:8 (set_local $1 (i32.add (get_local $1) - ;;@ ~lib/memory.ts:167:16 (i32.const 8) ) ) @@ -2996,41 +2771,39 @@ ) (loop $continue|2 (if - ;;@ ~lib/memory.ts:170:11 (get_local $2) (block + (set_local $3 + (get_local $0) + ) (set_local $0 (i32.add - (tee_local $3 - ;;@ ~lib/memory.ts:171:16 - (get_local $0) - ) + (get_local $3) (i32.const 1) ) ) - ;;@ ~lib/memory.ts:171:6 - (i32.store8 + (set_local $9 (get_local $3) - ;;@ ~lib/memory.ts:171:33 - (block (result i32) - (set_local $1 - (i32.add - (tee_local $3 - (get_local $1) - ) - (i32.const 1) - ) - ) - ;;@ ~lib/memory.ts:171:24 - (i32.load8_u + ) + (block + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add (get_local $3) + (i32.const 1) ) ) ) - ;;@ ~lib/memory.ts:172:6 + (i32.store8 + (get_local $9) + (i32.load8_u + (get_local $3) + ) + ) (set_local $2 (i32.sub - ;;@ ~lib/memory.ts:172:8 (get_local $2) (i32.const 1) ) @@ -3040,72 +2813,49 @@ ) ) ) - ;;@ ~lib/memory.ts:174:9 (block - ;;@ ~lib/memory.ts:175:4 (if - ;;@ ~lib/memory.ts:175:8 (i32.eq (i32.and - ;;@ ~lib/memory.ts:175:9 (get_local $1) - ;;@ ~lib/memory.ts:175:15 (i32.const 7) ) - ;;@ ~lib/memory.ts:175:21 (i32.and - ;;@ ~lib/memory.ts:175:22 (get_local $0) - ;;@ ~lib/memory.ts:175:29 (i32.const 7) ) ) - ;;@ ~lib/memory.ts:175:33 (block (loop $continue|3 (if - ;;@ ~lib/memory.ts:176:13 (i32.and (i32.add - ;;@ ~lib/memory.ts:176:14 (get_local $0) - ;;@ ~lib/memory.ts:176:21 (get_local $2) ) - ;;@ ~lib/memory.ts:176:26 (i32.const 7) ) (block - ;;@ ~lib/memory.ts:177:8 (if - ;;@ ~lib/memory.ts:177:12 (i32.eqz - ;;@ ~lib/memory.ts:177:13 (get_local $2) ) - ;;@ ~lib/memory.ts:177:16 (return) ) - ;;@ ~lib/memory.ts:178:8 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) (i32.store8 - ;;@ ~lib/memory.ts:178:18 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:178:25 - (tee_local $2 - (i32.sub - ;;@ ~lib/memory.ts:178:27 - (get_local $2) - (i32.const 1) - ) - ) + (get_local $2) ) - ;;@ ~lib/memory.ts:178:30 (i32.load8_u - ;;@ ~lib/memory.ts:178:39 (i32.add (get_local $1) - ;;@ ~lib/memory.ts:178:45 (get_local $2) ) ) @@ -3116,36 +2866,50 @@ ) (loop $continue|4 (if - ;;@ ~lib/memory.ts:180:13 (i32.ge_u (get_local $2) - ;;@ ~lib/memory.ts:180:18 (i32.const 8) ) (block - ;;@ ~lib/memory.ts:182:8 - (i64.store - ;;@ ~lib/memory.ts:182:19 - (i32.add - (get_local $0) - ;;@ ~lib/memory.ts:181:8 - (tee_local $2 - (i32.sub + (block + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 8) + ) + ) + (set_local $i64toi32_i32$1 + (i32.add + (get_local $0) + (get_local $2) + ) + ) + (set_local $10 + (get_local $i64toi32_i32$1) + ) + (block + (set_local $i64toi32_i32$1 + (i32.add + (get_local $1) (get_local $2) - ;;@ ~lib/memory.ts:181:13 - (i32.const 8) + ) + ) + (set_local $i64toi32_i32$0 + (i32.load offset=4 align=1 + (get_local $i64toi32_i32$1) ) ) ) - ;;@ ~lib/memory.ts:182:29 - (i64.load - ;;@ ~lib/memory.ts:182:39 - (i32.add - (get_local $1) - ;;@ ~lib/memory.ts:182:45 - (get_local $2) + (i32.store + (get_local $10) + (i32.load + (get_local $i64toi32_i32$1) ) ) + (i32.store offset=4 align=1 + (get_local $i64toi32_i32$1) + (get_local $i64toi32_i32$0) + ) ) (br $continue|4) ) @@ -3155,29 +2919,22 @@ ) (loop $continue|5 (if - ;;@ ~lib/memory.ts:185:11 (get_local $2) (block - ;;@ ~lib/memory.ts:186:6 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) (i32.store8 - ;;@ ~lib/memory.ts:186:16 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:186:23 - (tee_local $2 - (i32.sub - ;;@ ~lib/memory.ts:186:25 - (get_local $2) - (i32.const 1) - ) - ) + (get_local $2) ) - ;;@ ~lib/memory.ts:186:28 (i32.load8_u - ;;@ ~lib/memory.ts:186:37 (i32.add (get_local $1) - ;;@ ~lib/memory.ts:186:43 (get_local $2) ) ) @@ -3192,1200 +2949,411 @@ (func $~lib/internal/arraybuffer/reallocUnsafe (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) - ;;@ ~lib/internal/arraybuffer.ts:31:2 - (if - ;;@ ~lib/internal/arraybuffer.ts:31:6 - (i32.gt_s - (get_local $1) - ;;@ ~lib/internal/arraybuffer.ts:30:2 - (tee_local $2 - ;;@ ~lib/internal/arraybuffer.ts:30:22 - (i32.load - (get_local $0) - ) + (block + (set_local $2 + (i32.load + (get_local $0) ) ) - ;;@ ~lib/internal/arraybuffer.ts:33:4 (if - ;;@ ~lib/internal/arraybuffer.ts:33:8 - (i32.le_s + (i32.gt_s (get_local $1) - ;;@ ~lib/internal/arraybuffer.ts:33:25 - (i32.sub - (i32.shl - (i32.const 1) + (get_local $2) + ) + (block + (set_local $3 + (get_local $2) + ) + (if + (i32.le_s + (get_local $1) (i32.sub - (i32.const 32) - (i32.clz - (i32.add - (tee_local $3 - ;;@ ~lib/internal/arraybuffer.ts:33:43 - (get_local $2) + (i32.shl + (i32.const 1) + (i32.sub + (i32.const 32) + (i32.clz + (i32.add + (get_local $3) + (i32.const 7) + ) ) - (i32.const 7) ) ) + (i32.const 8) + ) + ) + (block + (i32.store + (get_local $0) + (get_local $1) + ) + (call $~lib/memory/set_memory + (i32.add + (i32.add + (get_local $0) + (i32.const 8) + ) + (get_local $2) + ) + (i32.const 0) + (i32.sub + (get_local $1) + (get_local $2) + ) ) ) - ;;@ ~lib/internal/arraybuffer.ts:33:60 - (i32.const 8) - ) - ) - ;;@ ~lib/internal/arraybuffer.ts:33:74 - (block - ;;@ ~lib/internal/arraybuffer.ts:34:6 - (i32.store - ;;@ ~lib/internal/arraybuffer.ts:34:17 - (get_local $0) - ;;@ ~lib/internal/arraybuffer.ts:34:44 - (get_local $1) - ) - ;;@ ~lib/internal/arraybuffer.ts:35:6 - (call $~lib/memory/set_memory - ;;@ ~lib/internal/arraybuffer.ts:36:8 - (i32.add - (i32.add - (get_local $0) - ;;@ ~lib/internal/arraybuffer.ts:36:36 - (i32.const 8) - ) - ;;@ ~lib/internal/arraybuffer.ts:36:50 - (get_local $2) - ) - ;;@ ~lib/internal/arraybuffer.ts:37:8 - (i32.const 0) - ;;@ ~lib/internal/arraybuffer.ts:38:8 - (i32.sub - ;;@ ~lib/internal/arraybuffer.ts:38:16 - (get_local $1) - ;;@ ~lib/internal/arraybuffer.ts:38:32 - (get_local $2) - ) - ) - ) - ;;@ ~lib/internal/arraybuffer.ts:40:11 - (block - ;;@ ~lib/internal/arraybuffer.ts:42:6 - (call $~lib/memory/move_memory - ;;@ ~lib/internal/arraybuffer.ts:43:8 - (i32.add - ;;@ ~lib/internal/arraybuffer.ts:41:6 - (tee_local $3 - ;;@ ~lib/internal/arraybuffer.ts:41:22 + (block + (set_local $3 (call $~lib/internal/arraybuffer/allocUnsafe - ;;@ ~lib/internal/arraybuffer.ts:41:34 (get_local $1) ) ) - ;;@ ~lib/internal/arraybuffer.ts:43:39 - (i32.const 8) + (call $~lib/memory/move_memory + (i32.add + (get_local $3) + (i32.const 8) + ) + (i32.add + (get_local $0) + (i32.const 8) + ) + (get_local $2) + ) + (call $~lib/memory/set_memory + (i32.add + (i32.add + (get_local $3) + (i32.const 8) + ) + (get_local $2) + ) + (i32.const 0) + (i32.sub + (get_local $1) + (get_local $2) + ) + ) + (return + (get_local $3) + ) ) - ;;@ ~lib/internal/arraybuffer.ts:44:8 - (i32.add - (get_local $0) - ;;@ ~lib/internal/arraybuffer.ts:44:36 - (i32.const 8) - ) - ;;@ ~lib/internal/arraybuffer.ts:45:8 + ) + ) + (if + (i32.lt_s + (get_local $1) (get_local $2) ) - ;;@ ~lib/internal/arraybuffer.ts:47:6 - (call $~lib/memory/set_memory - ;;@ ~lib/internal/arraybuffer.ts:48:8 - (i32.add - (i32.add - (get_local $3) - ;;@ ~lib/internal/arraybuffer.ts:48:39 - (i32.const 8) - ) - ;;@ ~lib/internal/arraybuffer.ts:48:53 - (get_local $2) - ) - ;;@ ~lib/internal/arraybuffer.ts:49:8 - (i32.const 0) - ;;@ ~lib/internal/arraybuffer.ts:50:8 - (i32.sub - ;;@ ~lib/internal/arraybuffer.ts:50:16 - (get_local $1) - ;;@ ~lib/internal/arraybuffer.ts:50:32 - (get_local $2) - ) + (i32.store + (get_local $0) + (get_local $1) ) - ;;@ ~lib/internal/arraybuffer.ts:52:13 - (return - (get_local $3) - ) - ) - ) - ;;@ ~lib/internal/arraybuffer.ts:54:9 - (if - ;;@ ~lib/internal/arraybuffer.ts:54:13 - (i32.lt_s - (get_local $1) - ;;@ ~lib/internal/arraybuffer.ts:54:29 - (get_local $2) - ) - ;;@ ~lib/internal/arraybuffer.ts:57:4 - (i32.store - ;;@ ~lib/internal/arraybuffer.ts:57:15 - (get_local $0) - ;;@ ~lib/internal/arraybuffer.ts:57:42 - (get_local $1) ) ) ) - ;;@ ~lib/internal/arraybuffer.ts:59:9 - (get_local $0) + (return + (get_local $0) + ) ) (func $~lib/array/Array#push (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $4 i32) (local $2 i32) (local $3 i32) - (local $4 i32) - ;;@ ~lib/array.ts:125:4 - (set_local $3 - ;;@ ~lib/array.ts:125:20 - (i32.add - ;;@ ~lib/array.ts:122:4 - (tee_local $2 - ;;@ ~lib/array.ts:122:17 - (i32.load offset=4 + (block + (set_local $2 + (i32.load offset=4 + (get_local $0) + ) + ) + (set_local $3 + (i32.add + (get_local $2) + (i32.const 1) + ) + ) + (block + (set_local $4 + (i32.load (get_local $0) ) ) - ;;@ ~lib/array.ts:125:29 - (i32.const 1) - ) - ) - ;;@ ~lib/array.ts:126:4 - (if - ;;@ ~lib/array.ts:126:8 - (i32.ge_u - (get_local $2) - ;;@ ~lib/array.ts:124:19 - (i32.shr_u - (i32.load - ;;@ ~lib/array.ts:123:4 - (tee_local $4 - ;;@ ~lib/array.ts:123:17 - (i32.load - (get_local $0) - ) - ) - ) - ;;@ ~lib/array.ts:124:41 - (i32.const 2) - ) - ) - ;;@ ~lib/array.ts:126:38 - (block - ;;@ ~lib/array.ts:128:6 (if - ;;@ ~lib/array.ts:128:10 (i32.ge_u (get_local $2) - ;;@ ~lib/array.ts:128:25 - (i32.const 268435454) - ) - ;;@ ~lib/array.ts:128:42 - (block - (call $abort - (i32.const 0) - (i32.const 4) - (i32.const 128) - (i32.const 42) + (i32.shr_u + (i32.load + (get_local $4) + ) + (i32.const 2) ) - (unreachable) ) - ) - ;;@ ~lib/array.ts:130:6 - (i32.store - (get_local $0) - ;;@ ~lib/array.ts:129:6 - (tee_local $4 - ;;@ ~lib/array.ts:129:15 - (call $~lib/internal/arraybuffer/reallocUnsafe - ;;@ ~lib/array.ts:129:29 - (get_local $4) - ;;@ ~lib/array.ts:129:37 - (i32.shl - (get_local $3) - ;;@ ~lib/array.ts:129:50 - (i32.const 2) + (block + (if + (i32.ge_u + (get_local $2) + (i32.const 268435454) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 128) + (i32.const 42) + ) + (unreachable) ) ) + (set_local $4 + (call $~lib/internal/arraybuffer/reallocUnsafe + (get_local $4) + (i32.shl + (get_local $3) + (i32.const 2) + ) + ) + ) + (i32.store + (get_local $0) + (get_local $4) + ) ) ) ) + (i32.store offset=4 + (get_local $0) + (get_local $3) + ) + (i32.store offset=8 + (i32.add + (get_local $4) + (i32.shl + (get_local $2) + (i32.const 2) + ) + ) + (get_local $1) + ) ) - ;;@ ~lib/array.ts:132:4 - (i32.store offset=4 - (get_local $0) - ;;@ ~lib/array.ts:132:19 + (return (get_local $3) ) - ;;@ ~lib/internal/arraybuffer.ts:69:2 - (i32.store offset=8 - ;;@ ~lib/internal/arraybuffer.ts:69:11 - (i32.add - ;;@ ~lib/array.ts:133:19 - (get_local $4) - ;;@ ~lib/internal/arraybuffer.ts:69:39 - (i32.shl - ;;@ ~lib/array.ts:133:27 - (get_local $2) - ;;@ ~lib/internal/arraybuffer.ts:69:56 - (i32.const 2) - ) - ) - ;;@ ~lib/array.ts:133:35 - (get_local $1) - ) - ;;@ ~lib/array.ts:134:11 - (get_local $3) ) (func $~lib/array/Array#__get (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) - ;;@ ~lib/array.ts:64:4 - (if - ;;@ ~lib/array.ts:64:8 - (i32.ge_u - (get_local $1) - ;;@ ~lib/array.ts:63:19 - (i32.shr_u - (i32.load - ;;@ ~lib/array.ts:62:4 - (tee_local $2 - ;;@ ~lib/array.ts:62:17 - (i32.load - (get_local $0) - ) - ) - ) - ;;@ ~lib/array.ts:63:41 - (i32.const 2) + (block + (set_local $2 + (i32.load + (get_local $0) ) ) - ;;@ ~lib/array.ts:64:37 - (block - (call $abort - (i32.const 0) - (i32.const 4) - (i32.const 64) - (i32.const 37) + (if + (i32.ge_u + (get_local $1) + (i32.shr_u + (i32.load + (get_local $2) + ) + (i32.const 2) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 64) + (i32.const 37) + ) + (unreachable) ) - (unreachable) ) ) - ;;@ ~lib/internal/arraybuffer.ts:64:9 - (i32.load offset=8 - ;;@ ~lib/internal/arraybuffer.ts:64:17 - (i32.add - ;;@ ~lib/array.ts:66:25 - (get_local $2) - ;;@ ~lib/internal/arraybuffer.ts:64:45 - (i32.shl - ;;@ ~lib/array.ts:66:33 - (get_local $1) - ;;@ ~lib/internal/arraybuffer.ts:64:62 - (i32.const 2) + (return + (i32.load offset=8 + (i32.add + (get_local $2) + (i32.shl + (get_local $1) + (i32.const 2) + ) ) ) ) ) (func $assembly/index/NBodySystem#constructor (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) (local $3 i32) + (local $2 i32) (local $4 f64) (local $5 f64) (local $6 f64) (local $7 f64) (local $8 i32) - ;;@ assembly/index.ts:88:4 - (set_local $8 - (i32.load offset=4 - (tee_local $3 - ;;@ assembly/index.ts:88:15 - (get_local $1) + (local $8 i32) + (block + (set_local $3 + (get_local $1) + ) + (set_local $8 + (i32.load offset=4 + (get_local $3) + ) + ) + (loop $continue|0 + (if + (i32.lt_s + (get_local $2) + (get_local $8) + ) + (block + (set_local $3 + (call $~lib/array/Array#__get + (get_local $1) + (get_local $2) + ) + ) + (set_local $4 + (f64.load offset=48 + (get_local $3) + ) + ) + (set_local $5 + (f64.add + (get_local $5) + (f64.mul + (f64.load offset=24 + (get_local $3) + ) + (get_local $4) + ) + ) + ) + (set_local $6 + (f64.add + (get_local $6) + (f64.mul + (f64.load offset=32 + (get_local $3) + ) + (get_local $4) + ) + ) + ) + (set_local $7 + (f64.add + (get_local $7) + (f64.mul + (f64.load offset=40 + (get_local $3) + ) + (get_local $4) + ) + ) + ) + (set_local $2 + (i32.add + (get_local $2) + (i32.const 1) + ) + ) + (br $continue|0) + ) ) ) - ) - (loop $continue|0 (if - ;;@ assembly/index.ts:89:20 - (i32.lt_s - (get_local $2) - ;;@ assembly/index.ts:89:24 - (get_local $8) + (get_local $0) + (set_local $8 + (get_local $0) ) (block - ;;@ assembly/index.ts:91:6 - (set_local $4 - ;;@ assembly/index.ts:91:14 - (f64.load offset=48 - ;;@ assembly/index.ts:90:6 - (tee_local $3 - ;;@ assembly/index.ts:90:14 - (call $~lib/array/Array#__get - (get_local $1) - ;;@ assembly/index.ts:90:21 - (get_local $2) - ) - ) - ) - ) - ;;@ assembly/index.ts:92:6 - (set_local $5 - (f64.add - (get_local $5) - ;;@ assembly/index.ts:92:12 - (f64.mul - (f64.load offset=24 - (get_local $3) - ) - ;;@ assembly/index.ts:92:19 - (get_local $4) - ) - ) - ) - ;;@ assembly/index.ts:93:6 - (set_local $6 - (f64.add - (get_local $6) - ;;@ assembly/index.ts:93:12 - (f64.mul - (f64.load offset=32 - (get_local $3) - ) - ;;@ assembly/index.ts:93:19 - (get_local $4) - ) - ) - ) - ;;@ assembly/index.ts:94:6 - (set_local $7 - (f64.add - (get_local $7) - ;;@ assembly/index.ts:94:12 - (f64.mul - (f64.load offset=40 - (get_local $3) - ) - ;;@ assembly/index.ts:94:19 - (get_local $4) - ) - ) - ) - ;;@ assembly/index.ts:89:30 - (set_local $2 - (i32.add - (get_local $2) - (i32.const 1) - ) - ) - (br $continue|0) - ) - ) - ) - ;;@ assembly/index.ts:96:4 - (i32.store - (if (result i32) - (get_local $0) - (get_local $0) - (block (result i32) - (i32.store - (tee_local $2 + (block + (set_local $2 (call $~lib/allocator/arena/allocate_memory (i32.const 4) ) ) - (i32.const 0) + (i32.store + (get_local $2) + (i32.const 0) + ) + (set_local $0 + (get_local $2) + ) ) - (tee_local $0 - (get_local $2) + (set_local $8 + (get_local $0) ) ) ) - ;;@ assembly/index.ts:96:18 - (get_local $1) - ) - (f64.store offset=24 - (tee_local $1 - ;;@ assembly/index.ts:97:4 + (i32.store + (get_local $8) + (get_local $1) + ) + (set_local $1 (call $~lib/array/Array#__get (i32.load (get_local $0) ) - ;;@ assembly/index.ts:97:16 (i32.const 0) ) ) - (f64.div - (f64.neg - (get_local $5) - ) - (f64.const 39.47841760435743) - ) - ) - (f64.store offset=32 - (get_local $1) - (f64.div - (f64.neg - (get_local $6) - ) - (f64.const 39.47841760435743) - ) - ) - (f64.store offset=40 - (get_local $1) - (f64.div - (f64.neg - (get_local $7) - ) - (f64.const 39.47841760435743) - ) - ) - (get_local $0) - ) - (func $assembly/index/getBody (; 12 ;) (type $ii) (param $0 i32) (result i32) - ;;@ assembly/index.ts:191:9 - (if (result i32) - (i32.lt_s - (get_local $0) - (i32.load offset=4 - ;;@ assembly/index.ts:191:17 - (get_global $assembly/index/bodies) - ) - ) - ;;@ assembly/index.ts:191:33 - (call $~lib/array/Array#__get - (get_global $assembly/index/bodies) - ;;@ assembly/index.ts:191:40 - (get_local $0) - ) - ;;@ assembly/index.ts:191:49 - (i32.const 0) - ) - ) - (func $assembly/index/NBodySystem#advance (; 13 ;) (type $iFv) (param $0 i32) (param $1 f64) - (local $2 i32) - (local $3 f64) - (local $4 i32) - (local $5 f64) - (local $6 f64) - (local $7 f64) - (local $8 i32) - (local $9 f64) - (local $10 f64) - (local $11 f64) - (local $12 f64) - (local $13 i32) - (local $14 i32) - (local $15 f64) - (local $16 f64) - (local $17 f64) - (local $18 f64) - ;;@ assembly/index.ts:102:4 - (set_local $14 - (i32.load offset=4 - (tee_local $0 - ;;@ assembly/index.ts:101:4 - (tee_local $13 - ;;@ assembly/index.ts:101:17 - (i32.load - (get_local $0) - ) - ) - ) - ) - ) - (loop $continue|0 - (if - ;;@ assembly/index.ts:104:20 - (i32.lt_s - (get_local $4) - ;;@ assembly/index.ts:104:24 - (get_local $14) - ) - (block - ;;@ assembly/index.ts:107:6 - (set_local $15 - ;;@ assembly/index.ts:107:15 - (f64.load - ;;@ assembly/index.ts:105:6 - (tee_local $0 - ;;@ assembly/index.ts:105:18 - (call $~lib/array/Array#__get - (get_local $13) - ;;@ assembly/index.ts:105:25 - (get_local $4) - ) - ) - ) - ) - ;;@ assembly/index.ts:108:6 - (set_local $16 - ;;@ assembly/index.ts:108:15 - (f64.load offset=8 - (get_local $0) - ) - ) - ;;@ assembly/index.ts:109:6 - (set_local $17 - ;;@ assembly/index.ts:109:15 - (f64.load offset=16 - (get_local $0) - ) - ) - ;;@ assembly/index.ts:111:6 - (set_local $5 - ;;@ assembly/index.ts:111:17 - (f64.load offset=24 - (get_local $0) - ) - ) - ;;@ assembly/index.ts:112:6 - (set_local $6 - ;;@ assembly/index.ts:112:17 - (f64.load offset=32 - (get_local $0) - ) - ) - ;;@ assembly/index.ts:113:6 - (set_local $7 - ;;@ assembly/index.ts:113:17 - (f64.load offset=40 - (get_local $0) - ) - ) - ;;@ assembly/index.ts:115:6 - (set_local $18 - ;;@ assembly/index.ts:115:19 - (f64.load offset=48 - (get_local $0) - ) - ) - ;;@ assembly/index.ts:116:11 - (set_local $8 - ;;@ assembly/index.ts:116:19 - (i32.add - (get_local $4) - ;;@ assembly/index.ts:116:23 - (i32.const 1) - ) - ) - (loop $continue|1 - (if - ;;@ assembly/index.ts:116:26 - (i32.lt_s - (get_local $8) - ;;@ assembly/index.ts:116:30 - (get_local $14) - ) - (block - ;;@ assembly/index.ts:126:8 - (set_local $3 - ;;@ assembly/index.ts:126:18 - (f64.mul - (get_local $18) - ;;@ assembly/index.ts:124:8 - (tee_local $9 - ;;@ assembly/index.ts:124:18 - (f64.div - (get_local $1) - ;;@ assembly/index.ts:124:23 - (f64.mul - ;;@ assembly/index.ts:122:8 - (tee_local $3 - ;;@ assembly/index.ts:122:25 - (f64.add - (f64.add - (f64.mul - ;;@ assembly/index.ts:118:8 - (tee_local $10 - ;;@ assembly/index.ts:118:17 - (f64.sub - (get_local $15) - ;;@ assembly/index.ts:118:22 - (f64.load - ;;@ assembly/index.ts:117:8 - (tee_local $2 - ;;@ assembly/index.ts:117:20 - (call $~lib/array/Array#__get - (get_local $13) - ;;@ assembly/index.ts:117:27 - (get_local $8) - ) - ) - ) - ) - ) - ;;@ assembly/index.ts:122:30 - (get_local $10) - ) - ;;@ assembly/index.ts:122:35 - (f64.mul - ;;@ assembly/index.ts:119:8 - (tee_local $11 - ;;@ assembly/index.ts:119:17 - (f64.sub - (get_local $16) - ;;@ assembly/index.ts:119:22 - (f64.load offset=8 - (get_local $2) - ) - ) - ) - ;;@ assembly/index.ts:122:40 - (get_local $11) - ) - ) - ;;@ assembly/index.ts:122:45 - (f64.mul - ;;@ assembly/index.ts:120:8 - (tee_local $12 - ;;@ assembly/index.ts:120:17 - (f64.sub - (get_local $17) - ;;@ assembly/index.ts:120:22 - (f64.load offset=16 - (get_local $2) - ) - ) - ) - ;;@ assembly/index.ts:122:50 - (get_local $12) - ) - ) - ) - ;;@ assembly/index.ts:123:23 - (f64.sqrt - ;;@ assembly/index.ts:123:28 - (get_local $3) - ) - ) - ) - ) - ) - ) - ;;@ assembly/index.ts:129:8 - (set_local $5 - (f64.sub - (get_local $5) - ;;@ assembly/index.ts:129:16 - (f64.mul - (get_local $10) - ;;@ assembly/index.ts:127:8 - (tee_local $9 - ;;@ assembly/index.ts:127:18 - (f64.mul - (f64.load offset=48 - (get_local $2) - ) - ;;@ assembly/index.ts:127:31 - (get_local $9) - ) - ) - ) - ) - ) - ;;@ assembly/index.ts:130:8 - (set_local $6 - (f64.sub - (get_local $6) - ;;@ assembly/index.ts:130:16 - (f64.mul - (get_local $11) - ;;@ assembly/index.ts:130:21 - (get_local $9) - ) - ) - ) - ;;@ assembly/index.ts:131:8 - (set_local $7 - (f64.sub - (get_local $7) - ;;@ assembly/index.ts:131:16 - (f64.mul - (get_local $12) - ;;@ assembly/index.ts:131:21 - (get_local $9) - ) - ) - ) - ;;@ assembly/index.ts:133:8 - (f64.store offset=24 - (get_local $2) - (f64.add - (f64.load offset=24 - (get_local $2) - ) - ;;@ assembly/index.ts:133:20 - (f64.mul - (get_local $10) - ;;@ assembly/index.ts:133:25 - (get_local $3) - ) - ) - ) - ;;@ assembly/index.ts:134:8 - (f64.store offset=32 - (get_local $2) - (f64.add - (f64.load offset=32 - (get_local $2) - ) - ;;@ assembly/index.ts:134:20 - (f64.mul - (get_local $11) - ;;@ assembly/index.ts:134:25 - (get_local $3) - ) - ) - ) - ;;@ assembly/index.ts:135:8 - (f64.store offset=40 - (get_local $2) - (f64.add - (f64.load offset=40 - (get_local $2) - ) - ;;@ assembly/index.ts:135:20 - (f64.mul - (get_local $12) - ;;@ assembly/index.ts:135:25 - (get_local $3) - ) - ) - ) - ;;@ assembly/index.ts:116:36 - (set_local $8 - (i32.add - ;;@ assembly/index.ts:116:38 - (get_local $8) - (i32.const 1) - ) - ) - (br $continue|1) - ) - ) - ) - ;;@ assembly/index.ts:138:6 - (f64.store offset=24 - (get_local $0) - ;;@ assembly/index.ts:138:17 + (f64.store offset=24 + (get_local $1) + (f64.div + (f64.neg (get_local $5) ) - ;;@ assembly/index.ts:139:6 - (f64.store offset=32 - (get_local $0) - ;;@ assembly/index.ts:139:17 + (f64.const 39.47841760435743) + ) + ) + (f64.store offset=32 + (get_local $1) + (f64.div + (f64.neg (get_local $6) ) - ;;@ assembly/index.ts:140:6 - (f64.store offset=40 - (get_local $0) - ;;@ assembly/index.ts:140:17 + (f64.const 39.47841760435743) + ) + ) + (f64.store offset=40 + (get_local $1) + (f64.div + (f64.neg (get_local $7) ) - ;;@ assembly/index.ts:142:6 - (f64.store - (get_local $0) - (f64.add - (f64.load - (get_local $0) - ) - ;;@ assembly/index.ts:142:17 - (f64.mul - (get_local $1) - ;;@ assembly/index.ts:142:22 - (get_local $5) - ) - ) - ) - ;;@ assembly/index.ts:143:6 - (f64.store offset=8 - (get_local $0) - (f64.add - (f64.load offset=8 - (get_local $0) - ) - ;;@ assembly/index.ts:143:17 - (f64.mul - (get_local $1) - ;;@ assembly/index.ts:143:22 - (get_local $6) - ) - ) - ) - ;;@ assembly/index.ts:144:6 - (f64.store offset=16 - (get_local $0) - (f64.add - (f64.load offset=16 - (get_local $0) - ) - ;;@ assembly/index.ts:144:17 - (f64.mul - (get_local $1) - ;;@ assembly/index.ts:144:22 - (get_local $7) - ) - ) - ) - ;;@ assembly/index.ts:104:30 - (set_local $4 - (i32.add - ;;@ assembly/index.ts:104:32 - (get_local $4) - (i32.const 1) - ) - ) - (br $continue|0) + (f64.const 39.47841760435743) ) ) ) + (return + (get_local $0) + ) ) - (func $assembly/index/NBodySystem#energy (; 14 ;) (type $iF) (param $0 i32) (result f64) - (local $1 f64) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 f64) - (local $7 f64) - (local $8 f64) - (local $9 f64) - (local $10 f64) - ;;@ assembly/index.ts:151:4 - (set_local $5 - (i32.load offset=4 - (tee_local $0 - ;;@ assembly/index.ts:150:4 - (tee_local $4 - ;;@ assembly/index.ts:150:17 - (i32.load - (get_local $0) + (func $assembly/index/init (; 12 ;) (type $v) + (local $0 i32) + (block + (set_global $~argc + (i32.const 0) + ) + (block $1of1 + (block $0of1 + (block $oob + (br_table $0of1 $1of1 $oob + (get_global $~argc) ) ) + (unreachable) ) ) - ) - (loop $continue|0 - (if - ;;@ assembly/index.ts:153:20 - (i32.lt_s - (get_local $2) - ;;@ assembly/index.ts:153:24 - (get_local $5) - ) - (block - ;;@ assembly/index.ts:156:6 - (set_local $7 - ;;@ assembly/index.ts:156:15 - (f64.load - ;;@ assembly/index.ts:154:6 - (tee_local $0 - ;;@ assembly/index.ts:154:18 - (call $~lib/array/Array#__get - (get_local $4) - ;;@ assembly/index.ts:154:25 - (get_local $2) - ) - ) - ) - ) - ;;@ assembly/index.ts:157:6 - (set_local $8 - ;;@ assembly/index.ts:157:15 - (f64.load offset=8 - (get_local $0) - ) - ) - ;;@ assembly/index.ts:158:6 - (set_local $9 - ;;@ assembly/index.ts:158:15 - (f64.load offset=16 - (get_local $0) - ) - ) - ;;@ assembly/index.ts:166:6 - (set_local $1 - (f64.add - (get_local $1) - ;;@ assembly/index.ts:166:11 - (f64.mul - (f64.mul - (f64.const 0.5) - ;;@ assembly/index.ts:164:6 - (tee_local $10 - ;;@ assembly/index.ts:164:16 - (f64.load offset=48 - (get_local $0) - ) - ) - ) - ;;@ assembly/index.ts:166:23 - (f64.add - ;;@ assembly/index.ts:166:24 - (f64.add - (f64.mul - ;;@ assembly/index.ts:160:6 - (tee_local $1 - ;;@ assembly/index.ts:160:15 - (f64.load offset=24 - (get_local $0) - ) - ) - ;;@ assembly/index.ts:166:29 - (get_local $1) - ) - ;;@ assembly/index.ts:166:34 - (f64.mul - ;;@ assembly/index.ts:161:6 - (tee_local $1 - ;;@ assembly/index.ts:161:15 - (f64.load offset=32 - (get_local $0) - ) - ) - ;;@ assembly/index.ts:166:39 - (get_local $1) - ) - ) - ;;@ assembly/index.ts:166:44 - (f64.mul - ;;@ assembly/index.ts:162:6 - (tee_local $1 - ;;@ assembly/index.ts:162:15 - (f64.load offset=40 - (get_local $0) - ) - ) - ;;@ assembly/index.ts:166:49 - (get_local $1) - ) - ) - ) - ) - ) - ;;@ assembly/index.ts:168:11 - (set_local $0 - ;;@ assembly/index.ts:168:19 - (i32.add - (get_local $2) - ;;@ assembly/index.ts:168:23 - (i32.const 1) - ) - ) - (loop $continue|1 - (if - ;;@ assembly/index.ts:168:26 - (i32.lt_s - (get_local $0) - ;;@ assembly/index.ts:168:30 - (get_local $5) - ) - (block - ;;@ assembly/index.ts:170:8 - (set_local $6 - ;;@ assembly/index.ts:170:17 - (f64.sub - (get_local $7) - ;;@ assembly/index.ts:170:22 - (f64.load - ;;@ assembly/index.ts:169:8 - (tee_local $3 - ;;@ assembly/index.ts:169:20 - (call $~lib/array/Array#__get - (get_local $4) - ;;@ assembly/index.ts:169:27 - (get_local $0) - ) - ) - ) - ) - ) - ;;@ assembly/index.ts:174:8 - (set_local $1 - (f64.sub - (get_local $1) - ;;@ assembly/index.ts:174:13 - (f64.div - (f64.mul - (get_local $10) - ;;@ assembly/index.ts:174:19 - (f64.load offset=48 - (get_local $3) - ) - ) - ;;@ assembly/index.ts:173:23 - (f64.sqrt - ;;@ assembly/index.ts:173:28 - (f64.add - (f64.add - (f64.mul - (get_local $6) - ;;@ assembly/index.ts:173:33 - (get_local $6) - ) - ;;@ assembly/index.ts:173:38 - (f64.mul - ;;@ assembly/index.ts:171:8 - (tee_local $1 - ;;@ assembly/index.ts:171:17 - (f64.sub - (get_local $8) - ;;@ assembly/index.ts:171:22 - (f64.load offset=8 - (get_local $3) - ) - ) - ) - ;;@ assembly/index.ts:173:43 - (get_local $1) - ) - ) - ;;@ assembly/index.ts:173:48 - (f64.mul - ;;@ assembly/index.ts:172:8 - (tee_local $1 - ;;@ assembly/index.ts:172:17 - (f64.sub - (get_local $9) - ;;@ assembly/index.ts:172:22 - (f64.load offset=16 - (get_local $3) - ) - ) - ) - ;;@ assembly/index.ts:173:53 - (get_local $1) - ) - ) - ) - ) - ) - ) - ;;@ assembly/index.ts:168:36 - (set_local $0 - (i32.add - ;;@ assembly/index.ts:168:38 - (get_local $0) - (i32.const 1) - ) - ) - (br $continue|1) - ) - ) - ) - ;;@ assembly/index.ts:153:30 - (set_local $2 - (i32.add - ;;@ assembly/index.ts:153:32 - (get_local $2) - (i32.const 1) - ) - ) - (br $continue|0) - ) - ) - ) - ;;@ assembly/index.ts:177:11 - (get_local $1) - ) - (func $assembly/index/step (; 15 ;) (type $F) (result f64) - ;;@ assembly/index.ts:195:9 - (call $assembly/index/NBodySystem#advance - ;;@ assembly/index.ts:195:2 - (get_global $assembly/index/system) - ;;@ assembly/index.ts:195:17 - (f64.const 0.01) - ) - ;;@ assembly/index.ts:196:16 - (call $assembly/index/NBodySystem#energy - ;;@ assembly/index.ts:196:9 - (get_global $assembly/index/system) - ) - ) - (func $assembly/index/bench (; 16 ;) (type $iF) (param $0 i32) (result f64) - (local $1 i32) - (loop $continue|0 - (if - ;;@ assembly/index.ts:200:18 - (i32.lt_s - (get_local $1) - ;;@ assembly/index.ts:200:22 - (get_local $0) - ) - (block - ;;@ assembly/index.ts:200:41 - (call $assembly/index/NBodySystem#advance - ;;@ assembly/index.ts:200:34 - (get_global $assembly/index/system) - ;;@ assembly/index.ts:200:49 - (f64.const 0.01) - ) - ;;@ assembly/index.ts:200:29 - (set_local $1 - (i32.add - (get_local $1) - (i32.const 1) - ) - ) - (br $continue|0) - ) - ) - ) - ;;@ assembly/index.ts:201:16 - (call $assembly/index/NBodySystem#energy - ;;@ assembly/index.ts:201:9 - (get_global $assembly/index/system) - ) - ) - (func $start (; 17 ;) (type $v) - (set_global $~lib/allocator/arena/startOffset - ;;@ ~lib/allocator/arena.ts:12:25 - (i32.and - (i32.add - ;;@ ~lib/allocator/arena.ts:12:26 - (get_global $HEAP_BASE) - ;;@ ~lib/allocator/arena.ts:12:38 - (i32.const 7) - ) - (i32.const -8) - ) - ) - (set_global $~lib/allocator/arena/offset - ;;@ ~lib/allocator/arena.ts:13:20 - (get_global $~lib/allocator/arena/startOffset) - ) - (set_global $assembly/index/bodies - ;;@ assembly/index.ts:181:13 - (block (result i32) - (set_global $~argc - (i32.const 0) - ) - (block $1of1 - (block $0of1 - (block $oob - (br_table $0of1 $1of1 $oob - (get_global $~argc) - ) - ) - (unreachable) - ) - ) + (set_local $0 (call $~lib/array/Array#constructor (i32.const 0) (i32.const 0) ) ) ) - ;;@ assembly/index.ts:182:7 (drop (call $~lib/array/Array#push - ;;@ assembly/index.ts:182:0 - (get_global $assembly/index/bodies) + (get_local $0) (call $assembly/index/Body#constructor (i32.const 0) (f64.const 0) @@ -4398,11 +3366,9 @@ ) ) ) - ;;@ assembly/index.ts:183:7 (drop (call $~lib/array/Array#push - ;;@ assembly/index.ts:183:0 - (get_global $assembly/index/bodies) + (get_local $0) (call $assembly/index/Body#constructor (i32.const 0) (f64.const 4.841431442464721) @@ -4415,11 +3381,9 @@ ) ) ) - ;;@ assembly/index.ts:184:7 (drop (call $~lib/array/Array#push - ;;@ assembly/index.ts:184:0 - (get_global $assembly/index/bodies) + (get_local $0) (call $assembly/index/Body#constructor (i32.const 0) (f64.const 8.34336671824458) @@ -4432,11 +3396,9 @@ ) ) ) - ;;@ assembly/index.ts:185:7 (drop (call $~lib/array/Array#push - ;;@ assembly/index.ts:185:0 - (get_global $assembly/index/bodies) + (get_local $0) (call $assembly/index/Body#constructor (i32.const 0) (f64.const 12.894369562139131) @@ -4449,11 +3411,9 @@ ) ) ) - ;;@ assembly/index.ts:186:7 (drop (call $~lib/array/Array#push - ;;@ assembly/index.ts:186:0 - (get_global $assembly/index/bodies) + (get_local $0) (call $assembly/index/Body#constructor (i32.const 0) (f64.const 15.379697114850917) @@ -4467,11 +3427,764 @@ ) ) (set_global $assembly/index/system - ;;@ assembly/index.ts:188:13 (call $assembly/index/NBodySystem#constructor (i32.const 0) - ;;@ assembly/index.ts:188:29 - (get_global $assembly/index/bodies) + (get_local $0) + ) + ) + ) + (func $assembly/index/getBody (; 13 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (block + (set_local $1 + (i32.load + (get_global $assembly/index/system) + ) + ) + (if + (i32.lt_u + (get_local $0) + (i32.load offset=4 + (get_local $1) + ) + ) + (set_local $2 + (call $~lib/array/Array#__get + (get_local $1) + (get_local $0) + ) + ) + (set_local $2 + (i32.const 0) + ) + ) + ) + (return + (get_local $2) + ) + ) + (func $assembly/index/NBodySystem#advance (; 14 ;) (type $iFv) (param $0 i32) (param $1 f64) + (local $2 i32) + (local $3 f64) + (local $4 f64) + (local $5 i32) + (local $6 f64) + (local $7 f64) + (local $8 f64) + (local $9 i32) + (local $10 f64) + (local $11 f64) + (local $12 f64) + (local $13 i32) + (local $14 i32) + (local $15 f64) + (local $16 f64) + (local $17 f64) + (local $18 f64) + (set_local $13 + (i32.load + (get_local $0) + ) + ) + (set_local $0 + (get_local $13) + ) + (set_local $14 + (i32.load offset=4 + (get_local $0) + ) + ) + (loop $continue|0 + (if + (i32.lt_s + (get_local $5) + (get_local $14) + ) + (block + (set_local $0 + (call $~lib/array/Array#__get + (get_local $13) + (get_local $5) + ) + ) + (set_local $15 + (f64.load + (get_local $0) + ) + ) + (set_local $16 + (f64.load offset=8 + (get_local $0) + ) + ) + (set_local $17 + (f64.load offset=16 + (get_local $0) + ) + ) + (set_local $6 + (f64.load offset=24 + (get_local $0) + ) + ) + (set_local $7 + (f64.load offset=32 + (get_local $0) + ) + ) + (set_local $8 + (f64.load offset=40 + (get_local $0) + ) + ) + (set_local $18 + (f64.load offset=48 + (get_local $0) + ) + ) + (set_local $9 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (loop $continue|1 + (if + (i32.lt_s + (get_local $9) + (get_local $14) + ) + (block + (set_local $2 + (call $~lib/array/Array#__get + (get_local $13) + (get_local $9) + ) + ) + (set_local $10 + (f64.sub + (get_local $15) + (f64.load + (get_local $2) + ) + ) + ) + (set_local $11 + (f64.sub + (get_local $16) + (f64.load offset=8 + (get_local $2) + ) + ) + ) + (set_local $12 + (f64.sub + (get_local $17) + (f64.load offset=16 + (get_local $2) + ) + ) + ) + (set_local $3 + (f64.add + (f64.add + (f64.mul + (get_local $10) + (get_local $10) + ) + (f64.mul + (get_local $11) + (get_local $11) + ) + ) + (f64.mul + (get_local $12) + (get_local $12) + ) + ) + ) + (set_local $4 + (f64.sqrt + (get_local $3) + ) + ) + (set_local $3 + (f64.div + (get_local $1) + (f64.mul + (get_local $3) + (get_local $4) + ) + ) + ) + (set_local $4 + (f64.mul + (get_local $18) + (get_local $3) + ) + ) + (set_local $3 + (f64.mul + (f64.load offset=48 + (get_local $2) + ) + (get_local $3) + ) + ) + (set_local $6 + (f64.sub + (get_local $6) + (f64.mul + (get_local $10) + (get_local $3) + ) + ) + ) + (set_local $7 + (f64.sub + (get_local $7) + (f64.mul + (get_local $11) + (get_local $3) + ) + ) + ) + (set_local $8 + (f64.sub + (get_local $8) + (f64.mul + (get_local $12) + (get_local $3) + ) + ) + ) + (f64.store offset=24 + (get_local $2) + (f64.add + (f64.load offset=24 + (get_local $2) + ) + (f64.mul + (get_local $10) + (get_local $4) + ) + ) + ) + (f64.store offset=32 + (get_local $2) + (f64.add + (f64.load offset=32 + (get_local $2) + ) + (f64.mul + (get_local $11) + (get_local $4) + ) + ) + ) + (f64.store offset=40 + (get_local $2) + (f64.add + (f64.load offset=40 + (get_local $2) + ) + (f64.mul + (get_local $12) + (get_local $4) + ) + ) + ) + (set_local $9 + (i32.add + (get_local $9) + (i32.const 1) + ) + ) + (br $continue|1) + ) + ) + ) + (f64.store offset=24 + (get_local $0) + (get_local $6) + ) + (f64.store offset=32 + (get_local $0) + (get_local $7) + ) + (f64.store offset=40 + (get_local $0) + (get_local $8) + ) + (f64.store + (get_local $0) + (f64.add + (f64.load + (get_local $0) + ) + (f64.mul + (get_local $1) + (get_local $6) + ) + ) + ) + (f64.store offset=8 + (get_local $0) + (f64.add + (f64.load offset=8 + (get_local $0) + ) + (f64.mul + (get_local $1) + (get_local $7) + ) + ) + ) + (f64.store offset=16 + (get_local $0) + (f64.add + (f64.load offset=16 + (get_local $0) + ) + (f64.mul + (get_local $1) + (get_local $8) + ) + ) + ) + (set_local $5 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (br $continue|0) + ) + ) + ) + ) + (func $assembly/index/NBodySystem#energy (; 15 ;) (type $iF) (param $0 i32) (result f64) + (local $1 f64) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $10 f64) + (local $6 f64) + (local $7 f64) + (local $8 f64) + (local $9 f64) + (local $11 f64) + (local $12 f64) + (local $13 f64) + (local $14 f64) + (local $15 f64) + (block + (set_local $4 + (i32.load + (get_local $0) + ) + ) + (set_local $0 + (get_local $4) + ) + (set_local $5 + (i32.load offset=4 + (get_local $0) + ) + ) + (loop $continue|0 + (if + (i32.lt_s + (get_local $2) + (get_local $5) + ) + (block + (set_local $0 + (call $~lib/array/Array#__get + (get_local $4) + (get_local $2) + ) + ) + (set_local $7 + (f64.load + (get_local $0) + ) + ) + (set_local $8 + (f64.load offset=8 + (get_local $0) + ) + ) + (set_local $9 + (f64.load offset=16 + (get_local $0) + ) + ) + (set_local $11 + (get_local $1) + ) + (set_local $10 + (f64.load offset=48 + (get_local $0) + ) + ) + (set_local $1 + (f64.load offset=24 + (get_local $0) + ) + ) + (set_local $12 + (f64.mul + (get_local $1) + (get_local $1) + ) + ) + (set_local $1 + (f64.load offset=32 + (get_local $0) + ) + ) + (set_local $13 + (f64.add + (get_local $12) + (f64.mul + (get_local $1) + (get_local $1) + ) + ) + ) + (set_local $1 + (f64.load offset=40 + (get_local $0) + ) + ) + (set_local $1 + (f64.add + (get_local $11) + (f64.mul + (f64.mul + (f64.const 0.5) + (get_local $10) + ) + (f64.add + (get_local $13) + (f64.mul + (get_local $1) + (get_local $1) + ) + ) + ) + ) + ) + (set_local $0 + (i32.add + (get_local $2) + (i32.const 1) + ) + ) + (loop $continue|1 + (if + (i32.lt_s + (get_local $0) + (get_local $5) + ) + (block + (set_local $3 + (call $~lib/array/Array#__get + (get_local $4) + (get_local $0) + ) + ) + (set_local $6 + (f64.sub + (get_local $7) + (f64.load + (get_local $3) + ) + ) + ) + (set_local $14 + (get_local $1) + ) + (set_local $1 + (f64.sub + (get_local $8) + (f64.load offset=8 + (get_local $3) + ) + ) + ) + (set_local $15 + (f64.add + (f64.mul + (get_local $6) + (get_local $6) + ) + (f64.mul + (get_local $1) + (get_local $1) + ) + ) + ) + (set_local $1 + (f64.sub + (get_local $9) + (f64.load offset=16 + (get_local $3) + ) + ) + ) + (set_local $1 + (f64.sub + (get_local $14) + (f64.div + (f64.mul + (get_local $10) + (f64.load offset=48 + (get_local $3) + ) + ) + (f64.sqrt + (f64.add + (get_local $15) + (f64.mul + (get_local $1) + (get_local $1) + ) + ) + ) + ) + ) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + (br $continue|1) + ) + ) + ) + (set_local $2 + (i32.add + (get_local $2) + (i32.const 1) + ) + ) + (br $continue|0) + ) + ) + ) + ) + (return + (get_local $1) + ) + ) + (func $assembly/index/step (; 16 ;) (type $F) (result f64) + (call $assembly/index/NBodySystem#advance + (get_global $assembly/index/system) + (f64.const 0.01) + ) + (return + (call $assembly/index/NBodySystem#energy + (get_global $assembly/index/system) + ) + ) + ) + (func $assembly/index/bench (; 17 ;) (type $iv) (param $0 i32) + (local $1 i32) + (loop $continue|0 + (if + (i32.lt_u + (get_local $1) + (get_local $0) + ) + (block + (call $assembly/index/NBodySystem#advance + (get_global $assembly/index/system) + (f64.const 0.01) + ) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + (br $continue|0) + ) + ) + ) + ) + (func $start (; 18 ;) (type $v) + (set_global $~lib/allocator/arena/startOffset + (i32.and + (i32.add + (get_global $HEAP_BASE) + (i32.const 7) + ) + (i32.const -8) + ) + ) + (set_global $~lib/allocator/arena/offset + (get_global $~lib/allocator/arena/startOffset) + ) + ) + (func $__wasm_ctz_i32 (; 19 ;) (param $x i32) (result i32) + (local $1 i32) + (if + (i32.eqz + (get_local $x) + ) + (set_local $1 + (i32.const 32) + ) + (set_local $1 + (i32.sub + (i32.const 31) + (i32.clz + (i32.xor + (get_local $x) + (i32.sub + (get_local $x) + (i32.const 1) + ) + ) + ) + ) + ) + ) + (return + (get_local $1) + ) + ) + (func $__wasm_popcnt_i32 (; 20 ;) (param $x i32) (result i32) + (local $count i32) + (local $2 i32) + (block + (set_local $count + (i32.const 0) + ) + (block $b + (loop $l + (set_local $2 + (get_local $count) + ) + (br_if $b + (i32.eqz + (get_local $x) + ) + ) + (set_local $x + (i32.and + (get_local $x) + (i32.sub + (get_local $x) + (i32.const 1) + ) + ) + ) + (set_local $count + (i32.add + (get_local $count) + (i32.const 1) + ) + ) + (br $l) + ) + ) + ) + (return + (get_local $2) + ) + ) + (func $__wasm_rotl_i32 (; 21 ;) (param $x i32) (param $k i32) (result i32) + (return + (i32.or + (i32.shl + (i32.and + (i32.shr_u + (i32.const -1) + (i32.and + (get_local $k) + (i32.const 31) + ) + ) + (get_local $x) + ) + (i32.and + (get_local $k) + (i32.const 31) + ) + ) + (i32.shr_u + (i32.and + (i32.shl + (i32.const -1) + (i32.sub + (i32.const 32) + (i32.and + (get_local $k) + (i32.const 31) + ) + ) + ) + (get_local $x) + ) + (i32.sub + (i32.const 32) + (i32.and + (get_local $k) + (i32.const 31) + ) + ) + ) + ) + ) + ) + (func $__wasm_rotr_i32 (; 22 ;) (param $x i32) (param $k i32) (result i32) + (return + (i32.or + (i32.shr_u + (i32.and + (i32.shl + (i32.const -1) + (i32.and + (get_local $k) + (i32.const 31) + ) + ) + (get_local $x) + ) + (i32.and + (get_local $k) + (i32.const 31) + ) + ) + (i32.shl + (i32.and + (i32.shr_u + (i32.const -1) + (i32.sub + (i32.const 32) + (i32.and + (get_local $k) + (i32.const 31) + ) + ) + ) + (get_local $x) + ) + (i32.sub + (i32.const 32) + (i32.and + (get_local $k) + (i32.const 31) + ) + ) + ) ) ) ) diff --git a/examples/n-body/build/untouched.wat b/examples/n-body/build/untouched.wat index e06c3d3c..5f9a17ea 100644 --- a/examples/n-body/build/untouched.wat +++ b/examples/n-body/build/untouched.wat @@ -1,6 +1,7 @@ (module (type $i (func (result i32))) (type $F (func (result f64))) + (type $v (func)) (type $iii (func (param i32 i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $ii (func (param i32) (result i32))) @@ -9,7 +10,7 @@ (type $iFFFi (func (param i32 f64 f64 f64) (result i32))) (type $iFv (func (param i32 f64))) (type $iF (func (param i32) (result f64))) - (type $v (func)) + (type $iv (func (param i32))) (import "env" "abort" (func $abort (param i32 i32 i32 i32))) (global $~lib/internal/allocator/AL_BITS i32 (i32.const 3)) (global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8)) @@ -19,15 +20,15 @@ (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) (global $assembly/index/SOLAR_MASS f64 (f64.const 39.47841760435743)) (global $assembly/index/DAYS_PER_YEAR f64 (f64.const 365.24)) + (global $assembly/index/system (mut i32) (i32.const 0)) (global $~lib/internal/arraybuffer/HEADER_SIZE i32 (i32.const 8)) (global $~lib/internal/arraybuffer/MAX_BLENGTH i32 (i32.const 1073741816)) (global $~argc (mut i32) (i32.const 0)) - (global $assembly/index/bodies (mut i32) (i32.const 0)) - (global $assembly/index/system (mut i32) (i32.const 0)) (global $HEAP_BASE i32 (i32.const 96)) (memory $0 1) (data (i32.const 4) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00") (data (i32.const 36) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") + (export "init" (func $assembly/index/init)) (export "getBody" (func $assembly/index/getBody)) (export "step" (func $assembly/index/step)) (export "bench" (func $assembly/index/bench)) @@ -4407,30 +4408,109 @@ ) (get_local $0) ) - (func $assembly/index/getBody (; 21 ;) (type $ii) (param $0 i32) (result i32) - ;;@ assembly/index.ts:191:49 + (func $assembly/index/init (; 21 ;) (type $v) + (local $0 i32) + ;;@ assembly/index.ts:184:2 + (set_local $0 + ;;@ assembly/index.ts:184:15 + (block (result i32) + (set_global $~argc + (i32.const 0) + ) + (call $~lib/array/Array#constructor|trampoline + (i32.const 0) + (i32.const 0) + ) + ) + ) + ;;@ assembly/index.ts:185:9 + (drop + (call $~lib/array/Array#push + ;;@ assembly/index.ts:185:2 + (get_local $0) + ;;@ assembly/index.ts:185:14 + (call $assembly/index/Sun) + ) + ) + ;;@ assembly/index.ts:186:9 + (drop + (call $~lib/array/Array#push + ;;@ assembly/index.ts:186:2 + (get_local $0) + ;;@ assembly/index.ts:186:14 + (call $assembly/index/Jupiter) + ) + ) + ;;@ assembly/index.ts:187:9 + (drop + (call $~lib/array/Array#push + ;;@ assembly/index.ts:187:2 + (get_local $0) + ;;@ assembly/index.ts:187:14 + (call $assembly/index/Saturn) + ) + ) + ;;@ assembly/index.ts:188:9 + (drop + (call $~lib/array/Array#push + ;;@ assembly/index.ts:188:2 + (get_local $0) + ;;@ assembly/index.ts:188:14 + (call $assembly/index/Uranus) + ) + ) + ;;@ assembly/index.ts:189:9 + (drop + (call $~lib/array/Array#push + ;;@ assembly/index.ts:189:2 + (get_local $0) + ;;@ assembly/index.ts:189:14 + (call $assembly/index/Neptune) + ) + ) + ;;@ assembly/index.ts:190:2 + (set_global $assembly/index/system + ;;@ assembly/index.ts:190:11 + (call $assembly/index/NBodySystem#constructor + (i32.const 0) + ;;@ assembly/index.ts:190:27 + (get_local $0) + ) + ) + ) + (func $assembly/index/getBody (; 22 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + ;;@ assembly/index.ts:194:2 + (set_local $1 + ;;@ assembly/index.ts:194:15 + (i32.load + (get_global $assembly/index/system) + ) + ) + ;;@ assembly/index.ts:195:59 (return - ;;@ assembly/index.ts:191:9 + ;;@ assembly/index.ts:195:9 (if (result i32) - (i32.lt_s + (i32.lt_u (get_local $0) - ;;@ assembly/index.ts:191:17 + ;;@ assembly/index.ts:195:22 (call $~lib/array/Array#get:length - (get_global $assembly/index/bodies) + ;;@ assembly/index.ts:195:27 + (get_local $1) ) ) - ;;@ assembly/index.ts:191:33 + ;;@ assembly/index.ts:195:43 (call $~lib/array/Array#__get - (get_global $assembly/index/bodies) - ;;@ assembly/index.ts:191:40 + (get_local $1) + ;;@ assembly/index.ts:195:50 (get_local $0) ) - ;;@ assembly/index.ts:191:49 + ;;@ assembly/index.ts:195:59 (i32.const 0) ) ) ) - (func $assembly/index/NBodySystem#advance (; 22 ;) (type $iFv) (param $0 i32) (param $1 f64) + (func $assembly/index/NBodySystem#advance (; 23 ;) (type $iFv) (param $0 i32) (param $1 f64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4631,10 +4711,20 @@ ) ;;@ assembly/index.ts:123:8 (set_local $19 - ;;@ assembly/index.ts:123:23 - (f64.sqrt - ;;@ assembly/index.ts:123:28 - (get_local $18) + ;;@ assembly/index.ts:123:28 + (block $~lib/math/NativeMath.sqrt|inlined.0 (result f64) + (set_local $19 + ;;@ assembly/index.ts:123:33 + (get_local $18) + ) + ;;@ ~lib/math.ts:1076:30 + (br $~lib/math/NativeMath.sqrt|inlined.0 + ;;@ ~lib/math.ts:1076:11 + (f64.sqrt + ;;@ ~lib/math.ts:1076:29 + (get_local $19) + ) + ) ) ) ;;@ assembly/index.ts:124:8 @@ -4844,7 +4934,7 @@ ) ) ) - (func $assembly/index/NBodySystem#energy (; 23 ;) (type $iF) (param $0 i32) (result f64) + (func $assembly/index/NBodySystem#energy (; 24 ;) (type $iF) (param $0 i32) (result f64) (local $1 f64) (local $2 i32) (local $3 i32) @@ -5059,28 +5149,38 @@ ) ;;@ assembly/index.ts:173:8 (set_local $18 - ;;@ assembly/index.ts:173:23 - (f64.sqrt - ;;@ assembly/index.ts:173:28 - (f64.add + ;;@ assembly/index.ts:173:28 + (block $~lib/math/NativeMath.sqrt|inlined.1 (result f64) + (set_local $18 + ;;@ assembly/index.ts:173:33 (f64.add - (f64.mul - (get_local $15) - ;;@ assembly/index.ts:173:33 - (get_local $15) - ) - ;;@ assembly/index.ts:173:38 - (f64.mul - (get_local $16) + (f64.add + (f64.mul + (get_local $15) + ;;@ assembly/index.ts:173:38 + (get_local $15) + ) ;;@ assembly/index.ts:173:43 - (get_local $16) + (f64.mul + (get_local $16) + ;;@ assembly/index.ts:173:48 + (get_local $16) + ) + ) + ;;@ assembly/index.ts:173:53 + (f64.mul + (get_local $17) + ;;@ assembly/index.ts:173:58 + (get_local $17) ) ) - ;;@ assembly/index.ts:173:48 - (f64.mul - (get_local $17) - ;;@ assembly/index.ts:173:53 - (get_local $17) + ) + ;;@ ~lib/math.ts:1076:30 + (br $~lib/math/NativeMath.sqrt|inlined.1 + ;;@ ~lib/math.ts:1076:11 + (f64.sqrt + ;;@ ~lib/math.ts:1076:29 + (get_local $18) ) ) ) @@ -5136,49 +5236,49 @@ (get_local $1) ) ) - (func $assembly/index/step (; 24 ;) (type $F) (result f64) - ;;@ assembly/index.ts:195:9 + (func $assembly/index/step (; 25 ;) (type $F) (result f64) + ;;@ assembly/index.ts:199:9 (call $assembly/index/NBodySystem#advance - ;;@ assembly/index.ts:195:2 + ;;@ assembly/index.ts:199:2 (get_global $assembly/index/system) - ;;@ assembly/index.ts:195:17 + ;;@ assembly/index.ts:199:17 (f64.const 0.01) ) - ;;@ assembly/index.ts:196:23 + ;;@ assembly/index.ts:200:23 (return - ;;@ assembly/index.ts:196:16 + ;;@ assembly/index.ts:200:16 (call $assembly/index/NBodySystem#energy - ;;@ assembly/index.ts:196:9 + ;;@ assembly/index.ts:200:9 (get_global $assembly/index/system) ) ) ) - (func $assembly/index/bench (; 25 ;) (type $iF) (param $0 i32) (result f64) + (func $assembly/index/bench (; 26 ;) (type $iv) (param $0 i32) (local $1 i32) - ;;@ assembly/index.ts:200:2 + ;;@ assembly/index.ts:204:2 (block $break|0 - ;;@ assembly/index.ts:200:7 + ;;@ assembly/index.ts:204:7 (set_local $1 - ;;@ assembly/index.ts:200:15 + ;;@ assembly/index.ts:204:20 (i32.const 0) ) (loop $continue|0 (if - ;;@ assembly/index.ts:200:18 - (i32.lt_s + ;;@ assembly/index.ts:204:23 + (i32.lt_u (get_local $1) - ;;@ assembly/index.ts:200:22 + ;;@ assembly/index.ts:204:27 (get_local $0) ) (block - ;;@ assembly/index.ts:200:41 + ;;@ assembly/index.ts:204:46 (call $assembly/index/NBodySystem#advance - ;;@ assembly/index.ts:200:34 + ;;@ assembly/index.ts:204:39 (get_global $assembly/index/system) - ;;@ assembly/index.ts:200:49 + ;;@ assembly/index.ts:204:54 (f64.const 0.01) ) - ;;@ assembly/index.ts:200:29 + ;;@ assembly/index.ts:204:34 (set_local $1 (i32.add (get_local $1) @@ -5190,16 +5290,8 @@ ) ) ) - ;;@ assembly/index.ts:201:23 - (return - ;;@ assembly/index.ts:201:16 - (call $assembly/index/NBodySystem#energy - ;;@ assembly/index.ts:201:9 - (get_global $assembly/index/system) - ) - ) ) - (func $start (; 26 ;) (type $v) + (func $start (; 27 ;) (type $v) (set_global $~lib/allocator/arena/startOffset ;;@ ~lib/allocator/arena.ts:12:25 (i32.and @@ -5221,70 +5313,5 @@ ;;@ ~lib/allocator/arena.ts:13:20 (get_global $~lib/allocator/arena/startOffset) ) - (set_global $assembly/index/bodies - ;;@ assembly/index.ts:181:13 - (block (result i32) - (set_global $~argc - (i32.const 0) - ) - (call $~lib/array/Array#constructor|trampoline - (i32.const 0) - (i32.const 0) - ) - ) - ) - ;;@ assembly/index.ts:182:7 - (drop - (call $~lib/array/Array#push - ;;@ assembly/index.ts:182:0 - (get_global $assembly/index/bodies) - ;;@ assembly/index.ts:182:12 - (call $assembly/index/Sun) - ) - ) - ;;@ assembly/index.ts:183:7 - (drop - (call $~lib/array/Array#push - ;;@ assembly/index.ts:183:0 - (get_global $assembly/index/bodies) - ;;@ assembly/index.ts:183:12 - (call $assembly/index/Jupiter) - ) - ) - ;;@ assembly/index.ts:184:7 - (drop - (call $~lib/array/Array#push - ;;@ assembly/index.ts:184:0 - (get_global $assembly/index/bodies) - ;;@ assembly/index.ts:184:12 - (call $assembly/index/Saturn) - ) - ) - ;;@ assembly/index.ts:185:7 - (drop - (call $~lib/array/Array#push - ;;@ assembly/index.ts:185:0 - (get_global $assembly/index/bodies) - ;;@ assembly/index.ts:185:12 - (call $assembly/index/Uranus) - ) - ) - ;;@ assembly/index.ts:186:7 - (drop - (call $~lib/array/Array#push - ;;@ assembly/index.ts:186:0 - (get_global $assembly/index/bodies) - ;;@ assembly/index.ts:186:12 - (call $assembly/index/Neptune) - ) - ) - (set_global $assembly/index/system - ;;@ assembly/index.ts:188:13 - (call $assembly/index/NBodySystem#constructor - (i32.const 0) - ;;@ assembly/index.ts:188:29 - (get_global $assembly/index/bodies) - ) - ) ) ) diff --git a/examples/n-body/index.html b/examples/n-body/index.html index 1ba843d7..827d33e1 100644 --- a/examples/n-body/index.html +++ b/examples/n-body/index.html @@ -45,6 +45,8 @@ fetch("build/optimized.wasm") var exports = module.instance.exports; var mem = new Float64Array(exports.memory.buffer); + exports.init(); + // Update about 30 times a second (function update() { setTimeout(update, 1000 / 30); diff --git a/examples/n-body/package.json b/examples/n-body/package.json index 7baf0131..7401256c 100644 --- a/examples/n-body/package.json +++ b/examples/n-body/package.json @@ -4,8 +4,9 @@ "private": true, "scripts": { "asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --sourceMap --validate", - "asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -O3 --sourceMap --validate --noDebug --noAssert", + "asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -a build/optimized.asm.js -O3 --validate --noDebug --noAssert", "asbuild": "npm run asbuild:untouched && npm run asbuild:optimized", + "tsbuild": "tsc -p assembly -t ES2017 -m commonjs --outDir build", "server": "http-server . -o -c-1", "test": "node tests" }, diff --git a/examples/n-body/tests/index.js b/examples/n-body/tests/index.js index 5d0f7026..117f66d7 100644 --- a/examples/n-body/tests/index.js +++ b/examples/n-body/tests/index.js @@ -1,10 +1,59 @@ -var nbody = require(".."); +const fs = require("fs"); -var steps = process.argv.length > 2 ? parseInt(process.argv[2], 10) : 1000000; -console.log("Performing " + steps + " steps ..."); +// Load WASM version +const nbodyWASM = require("../index.js"); -var start = process.hrtime(); -var energy = nbody.bench(steps); -var time = process.hrtime(start); +// Load ASMJS version +src = fs.readFileSync(__dirname + "/../build/optimized.asm.js", "utf8"); +if (src.indexOf("var Math_sqrt =") < 0) { // currently missing in asm.js output + let p = src.indexOf(" var abort = env.abort;"); + src = src.substring(0, p) + " var Math_sqrt = global.Math.sqrt;\n " + src.substring(p); +} +var nbodyASMJS = eval("0," + src)({ + Int8Array, + Int16Array, + Int32Array, + Uint8Array, + Uint16Array, + Uint32Array, + Float32Array, + Float64Array, + Math +}, { + abort: function() { throw Error(); } +}, new ArrayBuffer(0x10000)); -console.log("Took " + (time[0] * 1e3 + time[1] / 1e6) + "ms (energy=" + energy + ")"); +// Load JS version +var src = fs.readFileSync(__dirname + "/../build/index.js", "utf8"); +var nbodyJS = (new Function("require", "exports", src + " return exports;"))(function() {}, {}); + +function test(nbody, steps) { + nbody.init(); + var start = process.hrtime(); + nbody.bench(steps); + return process.hrtime(start); +} + +var steps = process.argv.length > 2 ? parseInt(process.argv[2], 10) : 10000000; + +console.log("Warming up ..."); +test(nbodyWASM, 100000); +test(nbodyASMJS, 100000); +test(nbodyJS, 100000); + +setTimeout(() => { + var time; + + console.log("Performing " + steps + " steps (WASM) ..."); + time = test(nbodyWASM, steps); + console.log("Took " + (time[0] * 1e3 + time[1] / 1e6) + "ms"); + + console.log("Performing " + steps + " steps (ASMJS) ..."); + time = test(nbodyASMJS, steps); + console.log("Took " + (time[0] * 1e3 + time[1] / 1e6) + "ms"); + + console.log("Performing " + steps + " steps (JS) ..."); + time = test(nbodyJS, steps); + console.log("Took " + (time[0] * 1e3 + time[1] / 1e6) + "ms"); + +}, 1000);