diff --git a/std/assembly.d.ts b/std/assembly.d.ts index f1ca8b01..70ee4ff2 100644 --- a/std/assembly.d.ts +++ b/std/assembly.d.ts @@ -175,6 +175,11 @@ declare function free_memory(ptr: usize): void; /** Emits an unreachable operation that results in a runtime error when executed. Both a statement and an expression of any type. */ declare function unreachable(): any; // sic +/** [Polyfill] Performs the sign-agnostic reverse bytes **/ +declare function bswap(value: T): T; +/** [Polyfill] Performs the sign-agnostic reverse bytes only for last 16-bit **/ +declare function bswap16(value: T): T; + /** NaN (not a number) as a 32-bit or 64-bit float depending on context. */ declare const NaN: f32 | f64; /** Positive infinity as a 32-bit or 64-bit float depending on context. */ diff --git a/std/assembly/error.ts b/std/assembly/error.ts index 004bdfbe..2d42648f 100644 --- a/std/assembly/error.ts +++ b/std/assembly/error.ts @@ -12,3 +12,7 @@ export class Error { export class RangeError extends Error { name: string = "RangeError"; } + +export class TypeError extends Error { + name: string = "TypeError"; +} diff --git a/std/assembly/polyfills.ts b/std/assembly/polyfills.ts new file mode 100644 index 00000000..26296cd3 --- /dev/null +++ b/std/assembly/polyfills.ts @@ -0,0 +1,31 @@ +export function bswap(value: T): T { + assert(sizeof() == 1 || sizeof() == 2 || sizeof() == 4 || sizeof() == 8); + + if (sizeof() == 2) { + return bswap16(value); + } else if (sizeof() == 4) { + return ( + rotl(value & 0xFF00FF00, 8) | + rotr(value & 0x00FF00FF, 8) + ); + } else if (sizeof() == 8) { + var a: u64 = (value >> 8) & 0x00FF00FF00FF00FF; + var b: u64 = (value & 0x00FF00FF00FF00FF) << 8; + var v: u64 = a | b; + + a = (v >> 16) & 0x0000FFFF0000FFFF; + b = (v & 0x0000FFFF0000FFFF) << 16; + + return rotr(a | b, 32); + } + return value; +} + +export function bswap16(value: T): T { + assert(sizeof() == 1 || sizeof() == 2 || sizeof() == 4); + + if (sizeof() == 2 || sizeof() == 4) { + return (((value << 8) & 0xFF00) | ((value >> 8) & 0x00FF) | (value & 0xFFFF0000)); + } + return value; +} diff --git a/std/portable.d.ts b/std/portable.d.ts index 407f60c6..d62c1cc6 100644 --- a/std/portable.d.ts +++ b/std/portable.d.ts @@ -129,6 +129,11 @@ declare function store(ptr: usize, value: T, constantOffset?: usize): vo /** Emits an unreachable operation that results in a runtime error when executed. */ declare function unreachable(): any; // sic +/** [Polyfill] Performs the sign-agnostic reverse bytes **/ +declare function bswap(value: T): T; +/** [Polyfill] Performs the sign-agnostic reverse bytes only for last 16-bit **/ +declare function bswap16(value: T): T; + /** Changes the type of any value of `usize` kind to another one of `usize` kind. Useful for casting class instances to their pointer values and vice-versa. Beware that this is unsafe.*/ declare function changetype(value: any): T; /** Traps if the specified value is not true-ish, otherwise returns the value. */ diff --git a/std/portable.js b/std/portable.js index f575c91c..d2039e38 100644 --- a/std/portable.js +++ b/std/portable.js @@ -71,6 +71,19 @@ globalScope["select"] = function select(ifTrue, ifFalse, condition) { return con globalScope["sqrt"] = Math.sqrt; globalScope["trunc"] = Math.trunc; +globalScope["bswap"] = function bswap(value) { + var a = value >> 8 & 0x00FF00FF; + var b = (value & 0x00FF00FF) << 8; + value = a | b; + a = value >> 16 & 0x0000FFFF; + b = (value & 0x0000FFFF) << 16; + return a | b; +} + +globalScope["bswap16"] = function bswap16(value) { + return ((value << 8) & 0xFF00) | ((value >> 8) & 0x00FF) | (value & 0xFFFF0000); +} + function UnreachableError() { if (Error.captureStackTrace) Error.captureStackTrace(this, UnreachableError); diff --git a/tests/compiler/std/polyfills.optimized.wat b/tests/compiler/std/polyfills.optimized.wat new file mode 100644 index 00000000..8c118c32 --- /dev/null +++ b/tests/compiler/std/polyfills.optimized.wat @@ -0,0 +1,707 @@ +(module + (type $iiiiv (func (param i32 i32 i32 i32))) + (type $ii (func (param i32) (result i32))) + (type $II (func (param i64) (result i64))) + (type $v (func)) + (import "env" "abort" (func $abort (param i32 i32 i32 i32))) + (memory $0 1) + (data (i32.const 4) "\12\00\00\00(\00l\00i\00b\00)\00/\00p\00o\00l\00y\00f\00i\00l\00l\00s\00.\00t\00s") + (data (i32.const 44) "\10\00\00\00s\00t\00d\00/\00p\00o\00l\00y\00f\00i\00l\00l\00s\00.\00t\00s") + (export "memory" (memory $0)) + (start $start) + (func "$(lib)/polyfills/bswap16" (; 1 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (if + (i32.eqz + (i32.and + (if (result i32) + (tee_local $1 + (i32.and + (i32.const 1) + (i32.const 1) + ) + ) + (get_local $1) + (i32.const 0) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 25) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.and + (if (result i32) + (tee_local $1 + (i32.const 1) + ) + (get_local $1) + (i32.const 0) + ) + (i32.const 1) + ) + (return + (i32.or + (i32.or + (i32.and + (i32.shl + (get_local $0) + (i32.const 8) + ) + (i32.const 65280) + ) + (i32.and + (i32.shr_u + (get_local $0) + (i32.const 8) + ) + (i32.const 255) + ) + ) + (i32.and + (get_local $0) + (i32.const 0) + ) + ) + ) + ) + (get_local $0) + ) + (func "$(lib)/polyfills/bswap" (; 2 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (if + (i32.eqz + (i32.and + (if (result i32) + (tee_local $1 + (i32.and + (if (result i32) + (tee_local $1 + (i32.and + (i32.const 1) + (i32.const 1) + ) + ) + (get_local $1) + (i32.const 0) + ) + (i32.const 1) + ) + ) + (get_local $1) + (i32.const 0) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 2) + (i32.const 2) + ) + (unreachable) + ) + ) + (call "$(lib)/polyfills/bswap16" + (get_local $0) + ) + ) + (func "$(lib)/polyfills/bswap16" (; 3 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (if + (i32.eqz + (i32.and + (if (result i32) + (tee_local $1 + (i32.and + (i32.const 1) + (i32.const 1) + ) + ) + (get_local $1) + (i32.const 0) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 25) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.and + (if (result i32) + (tee_local $1 + (i32.const 1) + ) + (get_local $1) + (i32.const 0) + ) + (i32.const 1) + ) + (return + (i32.shr_s + (i32.shl + (i32.or + (i32.or + (i32.shr_s + (i32.shl + (i32.and + (i32.shr_s + (i32.shl + (get_local $0) + (i32.const 24) + ) + (i32.const 16) + ) + (i32.const -256) + ) + (i32.const 16) + ) + (i32.const 16) + ) + (i32.and + (i32.shr_s + (get_local $0) + (i32.const 8) + ) + (i32.const 255) + ) + ) + (i32.and + (get_local $0) + (i32.const 0) + ) + ) + (i32.const 16) + ) + (i32.const 16) + ) + ) + ) + (get_local $0) + ) + (func "$(lib)/polyfills/bswap" (; 4 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (if + (i32.eqz + (i32.and + (if (result i32) + (tee_local $1 + (i32.and + (if (result i32) + (tee_local $1 + (i32.and + (i32.const 1) + (i32.const 1) + ) + ) + (get_local $1) + (i32.const 0) + ) + (i32.const 1) + ) + ) + (get_local $1) + (i32.const 0) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 2) + (i32.const 2) + ) + (unreachable) + ) + ) + (call "$(lib)/polyfills/bswap16" + (get_local $0) + ) + ) + (func "$(lib)/polyfills/bswap16" (; 5 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (if + (i32.eqz + (i32.and + (if (result i32) + (tee_local $1 + (i32.and + (i32.const 0) + (i32.const 1) + ) + ) + (get_local $1) + (i32.const 1) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 25) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.and + (if (result i32) + (tee_local $1 + (i32.const 0) + ) + (get_local $1) + (i32.const 1) + ) + (i32.const 1) + ) + (return + (i32.or + (i32.or + (i32.and + (i32.shl + (get_local $0) + (i32.const 8) + ) + (i32.const 65280) + ) + (i32.and + (i32.shr_u + (get_local $0) + (i32.const 8) + ) + (i32.const 255) + ) + ) + (i32.and + (get_local $0) + (i32.const -65536) + ) + ) + ) + ) + (get_local $0) + ) + (func "$(lib)/polyfills/bswap" (; 6 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (if + (i32.eqz + (i32.and + (if (result i32) + (tee_local $1 + (i32.and + (if (result i32) + (tee_local $1 + (i32.and + (i32.const 0) + (i32.const 1) + ) + ) + (get_local $1) + (i32.const 1) + ) + (i32.const 1) + ) + ) + (get_local $1) + (i32.const 0) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 2) + (i32.const 2) + ) + (unreachable) + ) + ) + (i32.or + (i32.rotl + (i32.and + (get_local $0) + (i32.const -16711936) + ) + (i32.const 8) + ) + (i32.rotr + (i32.and + (get_local $0) + (i32.const 16711935) + ) + (i32.const 8) + ) + ) + ) + (func "$(lib)/polyfills/bswap16" (; 7 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (if + (i32.eqz + (i32.and + (if (result i32) + (tee_local $1 + (i32.and + (i32.const 0) + (i32.const 1) + ) + ) + (get_local $1) + (i32.const 1) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 25) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.and + (if (result i32) + (tee_local $1 + (i32.const 0) + ) + (get_local $1) + (i32.const 1) + ) + (i32.const 1) + ) + (return + (i32.or + (i32.or + (i32.and + (i32.shl + (get_local $0) + (i32.const 8) + ) + (i32.const 65280) + ) + (i32.and + (i32.shr_s + (get_local $0) + (i32.const 8) + ) + (i32.const 255) + ) + ) + (i32.and + (get_local $0) + (i32.const -65536) + ) + ) + ) + ) + (get_local $0) + ) + (func "$(lib)/polyfills/bswap" (; 8 ;) (type $II) (param $0 i64) (result i64) + (local $1 i32) + (if + (i32.eqz + (i32.and + (if (result i32) + (tee_local $1 + (i32.and + (if (result i32) + (tee_local $1 + (i32.and + (i32.const 0) + (i32.const 1) + ) + ) + (get_local $1) + (i32.const 0) + ) + (i32.const 1) + ) + ) + (get_local $1) + (i32.const 1) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 2) + (i32.const 2) + ) + (unreachable) + ) + ) + (i64.rotr + (i64.or + (i64.and + (i64.shr_u + (tee_local $0 + (i64.or + (i64.and + (i64.shr_u + (get_local $0) + (i64.const 8) + ) + (i64.const 71777214294589695) + ) + (i64.shl + (i64.and + (get_local $0) + (i64.const 71777214294589695) + ) + (i64.const 8) + ) + ) + ) + (i64.const 16) + ) + (i64.const 281470681808895) + ) + (i64.shl + (i64.and + (get_local $0) + (i64.const 281470681808895) + ) + (i64.const 16) + ) + ) + (i64.const 32) + ) + ) + (func $start (; 9 ;) (type $v) + (if + (i32.ne + (call "$(lib)/polyfills/bswap" + (i32.const 43707) + ) + (i32.const 48042) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 4) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.ne + (call "$(lib)/polyfills/bswap" + (i32.const -21829) + ) + (i32.const -17494) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 5) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.ne + (call "$(lib)/polyfills/bswap" + (i32.const -1430532899) + ) + (i32.const -573785174) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 8) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.ne + (call "$(lib)/polyfills/bswap" + (i32.const -1430532899) + ) + (i32.const -573785174) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 9) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i64.ne + (call "$(lib)/polyfills/bswap" + (i64.const 4822679907192029) + ) + (i64.const -2464388556401798912) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 12) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i64.ne + (call "$(lib)/polyfills/bswap" + (i64.const 4822679907192029) + ) + (i64.const -2464388556401798912) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 13) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.ne + (call "$(lib)/polyfills/bswap" + (i32.const -1430532899) + ) + (i32.const -573785174) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 16) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.ne + (call "$(lib)/polyfills/bswap" + (i32.const -1430532899) + ) + (i32.const -573785174) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 17) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.ne + (call "$(lib)/polyfills/bswap16" + (i32.const 43707) + ) + (i32.const 48042) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 20) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.ne + (call "$(lib)/polyfills/bswap16" + (i32.const -21829) + ) + (i32.const -17494) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 21) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.ne + (call "$(lib)/polyfills/bswap16" + (i32.const -7820613) + ) + (i32.const -7816278) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 24) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.ne + (call "$(lib)/polyfills/bswap16" + (i32.const -7820613) + ) + (i32.const -7816278) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 25) + (i32.const 0) + ) + (unreachable) + ) + ) + ) +) diff --git a/tests/compiler/std/polyfills.ts b/tests/compiler/std/polyfills.ts new file mode 100644 index 00000000..24a0a10a --- /dev/null +++ b/tests/compiler/std/polyfills.ts @@ -0,0 +1,25 @@ +// bswap / bswap16 tests + +// check bswap for i16/u16 +assert(bswap(0xaabb) == 0xbbaa); +assert(bswap(0xaabb) == 0xbbaa); + +// check bswap for i32/u32 +assert(bswap(0xaabbccdd) == 0xddccbbaa); +assert(bswap(0xaabbccdd) == 0xddccbbaa); + +// check bswap for i64/u64 +assert(bswap(0x00112233aabbccdd) == 0xddccbbaa33221100); +assert(bswap(0x00112233aabbccdd) == 0xddccbbaa33221100); + +// check bswap for i32/u32 +assert(bswap(0xaabbccdd) == 0xddccbbaa); +assert(bswap(0xaabbccdd) == 0xddccbbaa); + +// check bswap16 for i16/u16 +assert(bswap16(0xaabb) == 0xbbaa); +assert(bswap16(0xaabb) == 0xbbaa); + +// check bswap16 for i32/u32 +assert(bswap16(0xff88aabb) == 0xff88bbaa); +assert(bswap16(0xff88aabb) == 0xff88bbaa); diff --git a/tests/compiler/std/polyfills.untouched.wat b/tests/compiler/std/polyfills.untouched.wat new file mode 100644 index 00000000..c7d0a0ab --- /dev/null +++ b/tests/compiler/std/polyfills.untouched.wat @@ -0,0 +1,2511 @@ +(module + (type $iiiiv (func (param i32 i32 i32 i32))) + (type $ii (func (param i32) (result i32))) + (type $II (func (param i64) (result i64))) + (type $v (func)) + (import "env" "abort" (func $abort (param i32 i32 i32 i32))) + (global $HEAP_BASE i32 (i32.const 80)) + (memory $0 1) + (data (i32.const 4) "\12\00\00\00(\00l\00i\00b\00)\00/\00p\00o\00l\00y\00f\00i\00l\00l\00s\00.\00t\00s\00") + (data (i32.const 44) "\10\00\00\00s\00t\00d\00/\00p\00o\00l\00y\00f\00i\00l\00l\00s\00.\00t\00s\00") + (export "memory" (memory $0)) + (start $start) + (func "$(lib)/polyfills/bswap16" (; 1 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (if + (i32.eqz + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 2) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 2) + (i32.const 2) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 2) + (i32.const 4) + ) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 25) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 2) + (i32.const 2) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 2) + (i32.const 4) + ) + ) + (i32.const 1) + ) + (return + (i32.and + (i32.or + (i32.or + (i32.and + (i32.and + (i32.and + (i32.shl + (get_local $0) + (i32.const 8) + ) + (i32.const 65535) + ) + (i32.const 65280) + ) + (i32.const 65535) + ) + (i32.and + (i32.and + (i32.shr_u + (get_local $0) + (i32.const 8) + ) + (i32.const 255) + ) + (i32.const 65535) + ) + ) + (i32.and + (i32.and + (get_local $0) + (i32.and + (i32.wrap/i64 + (i64.const 4294901760) + ) + (i32.const 65535) + ) + ) + (i32.const 65535) + ) + ) + (i32.const 65535) + ) + ) + ) + (return + (get_local $0) + ) + ) + (func "$(lib)/polyfills/bswap" (; 2 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i64) + (local $3 i64) + (local $4 i64) + (if + (i32.eqz + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 2) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 2) + (i32.const 2) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 2) + (i32.const 4) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 2) + (i32.const 8) + ) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 2) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.eq + (i32.const 2) + (i32.const 2) + ) + (return + (call "$(lib)/polyfills/bswap16" + (get_local $0) + ) + ) + (if + (i32.eq + (i32.const 2) + (i32.const 4) + ) + (return + (i32.and + (i32.or + (i32.rotl + (i32.and + (get_local $0) + (i32.const -16711936) + ) + (i32.const 8) + ) + (i32.rotr + (i32.and + (get_local $0) + (i32.const 16711935) + ) + (i32.const 8) + ) + ) + (i32.const 65535) + ) + ) + (if + (i32.eq + (i32.const 2) + (i32.const 8) + ) + (block + (set_local $2 + (i64.and + (i64.shr_u + (i64.extend_u/i32 + (get_local $0) + ) + (i64.const 8) + ) + (i64.const 71777214294589695) + ) + ) + (set_local $3 + (i64.shl + (i64.and + (i64.extend_u/i32 + (get_local $0) + ) + (i64.const 71777214294589695) + ) + (i64.const 8) + ) + ) + (set_local $4 + (i64.or + (get_local $2) + (get_local $3) + ) + ) + (set_local $2 + (i64.and + (i64.shr_u + (get_local $4) + (i64.const 16) + ) + (i64.const 281470681808895) + ) + ) + (set_local $3 + (i64.shl + (i64.and + (get_local $4) + (i64.const 281470681808895) + ) + (i64.const 16) + ) + ) + (return + (i32.and + (i32.wrap/i64 + (i64.rotr + (i64.or + (get_local $2) + (get_local $3) + ) + (i64.const 32) + ) + ) + (i32.const 65535) + ) + ) + ) + ) + ) + ) + (return + (get_local $0) + ) + ) + (func "$(lib)/polyfills/bswap16" (; 3 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (if + (i32.eqz + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 2) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 2) + (i32.const 2) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 2) + (i32.const 4) + ) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 25) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 2) + (i32.const 2) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 2) + (i32.const 4) + ) + ) + (i32.const 1) + ) + (return + (i32.shr_s + (i32.shl + (i32.or + (i32.or + (i32.shr_s + (i32.shl + (i32.and + (i32.shr_s + (i32.shl + (i32.shl + (get_local $0) + (i32.const 8) + ) + (i32.const 16) + ) + (i32.const 16) + ) + (i32.shr_s + (i32.shl + (i32.const 65280) + (i32.const 16) + ) + (i32.const 16) + ) + ) + (i32.const 16) + ) + (i32.const 16) + ) + (i32.shr_s + (i32.shl + (i32.and + (i32.shr_s + (get_local $0) + (i32.const 8) + ) + (i32.const 255) + ) + (i32.const 16) + ) + (i32.const 16) + ) + ) + (i32.shr_s + (i32.shl + (i32.and + (get_local $0) + (i32.shr_s + (i32.shl + (i32.wrap/i64 + (i64.const 4294901760) + ) + (i32.const 16) + ) + (i32.const 16) + ) + ) + (i32.const 16) + ) + (i32.const 16) + ) + ) + (i32.const 16) + ) + (i32.const 16) + ) + ) + ) + (return + (get_local $0) + ) + ) + (func "$(lib)/polyfills/bswap" (; 4 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i64) + (local $3 i64) + (local $4 i64) + (if + (i32.eqz + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 2) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 2) + (i32.const 2) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 2) + (i32.const 4) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 2) + (i32.const 8) + ) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 2) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.eq + (i32.const 2) + (i32.const 2) + ) + (return + (call "$(lib)/polyfills/bswap16" + (get_local $0) + ) + ) + (if + (i32.eq + (i32.const 2) + (i32.const 4) + ) + (return + (i32.shr_s + (i32.shl + (i32.or + (i32.rotl + (i32.and + (get_local $0) + (i32.const -16711936) + ) + (i32.const 8) + ) + (i32.rotr + (i32.and + (get_local $0) + (i32.const 16711935) + ) + (i32.const 8) + ) + ) + (i32.const 16) + ) + (i32.const 16) + ) + ) + (if + (i32.eq + (i32.const 2) + (i32.const 8) + ) + (block + (set_local $2 + (i64.and + (i64.shr_u + (i64.extend_u/i32 + (get_local $0) + ) + (i64.const 8) + ) + (i64.const 71777214294589695) + ) + ) + (set_local $3 + (i64.shl + (i64.and + (i64.extend_u/i32 + (get_local $0) + ) + (i64.const 71777214294589695) + ) + (i64.const 8) + ) + ) + (set_local $4 + (i64.or + (get_local $2) + (get_local $3) + ) + ) + (set_local $2 + (i64.and + (i64.shr_u + (get_local $4) + (i64.const 16) + ) + (i64.const 281470681808895) + ) + ) + (set_local $3 + (i64.shl + (i64.and + (get_local $4) + (i64.const 281470681808895) + ) + (i64.const 16) + ) + ) + (return + (i32.shr_s + (i32.shl + (i32.wrap/i64 + (i64.rotr + (i64.or + (get_local $2) + (get_local $3) + ) + (i64.const 32) + ) + ) + (i32.const 16) + ) + (i32.const 16) + ) + ) + ) + ) + ) + ) + (return + (get_local $0) + ) + ) + (func "$(lib)/polyfills/bswap16" (; 5 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (if + (i32.eqz + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 4) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 2) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 4) + ) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 25) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 4) + (i32.const 2) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 4) + ) + ) + (i32.const 1) + ) + (return + (i32.or + (i32.or + (i32.and + (i32.shl + (get_local $0) + (i32.const 8) + ) + (i32.const 65280) + ) + (i32.and + (i32.shr_u + (get_local $0) + (i32.const 8) + ) + (i32.const 255) + ) + ) + (i32.and + (get_local $0) + (i32.const -65536) + ) + ) + ) + ) + (return + (get_local $0) + ) + ) + (func "$(lib)/polyfills/bswap" (; 6 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i64) + (local $3 i64) + (local $4 i64) + (if + (i32.eqz + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 4) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 2) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 4) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 8) + ) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 2) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.eq + (i32.const 4) + (i32.const 2) + ) + (return + (call "$(lib)/polyfills/bswap16" + (get_local $0) + ) + ) + (if + (i32.eq + (i32.const 4) + (i32.const 4) + ) + (return + (i32.or + (i32.rotl + (i32.and + (get_local $0) + (i32.const -16711936) + ) + (i32.const 8) + ) + (i32.rotr + (i32.and + (get_local $0) + (i32.const 16711935) + ) + (i32.const 8) + ) + ) + ) + (if + (i32.eq + (i32.const 4) + (i32.const 8) + ) + (block + (set_local $2 + (i64.and + (i64.shr_u + (i64.extend_u/i32 + (get_local $0) + ) + (i64.const 8) + ) + (i64.const 71777214294589695) + ) + ) + (set_local $3 + (i64.shl + (i64.and + (i64.extend_u/i32 + (get_local $0) + ) + (i64.const 71777214294589695) + ) + (i64.const 8) + ) + ) + (set_local $4 + (i64.or + (get_local $2) + (get_local $3) + ) + ) + (set_local $2 + (i64.and + (i64.shr_u + (get_local $4) + (i64.const 16) + ) + (i64.const 281470681808895) + ) + ) + (set_local $3 + (i64.shl + (i64.and + (get_local $4) + (i64.const 281470681808895) + ) + (i64.const 16) + ) + ) + (return + (i32.wrap/i64 + (i64.rotr + (i64.or + (get_local $2) + (get_local $3) + ) + (i64.const 32) + ) + ) + ) + ) + ) + ) + ) + (return + (get_local $0) + ) + ) + (func "$(lib)/polyfills/bswap16" (; 7 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (if + (i32.eqz + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 4) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 2) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 4) + ) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 25) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 4) + (i32.const 2) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 4) + ) + ) + (i32.const 1) + ) + (return + (i32.or + (i32.or + (i32.and + (i32.shl + (get_local $0) + (i32.const 8) + ) + (i32.const 65280) + ) + (i32.and + (i32.shr_s + (get_local $0) + (i32.const 8) + ) + (i32.const 255) + ) + ) + (i32.and + (get_local $0) + (i32.wrap/i64 + (i64.const 4294901760) + ) + ) + ) + ) + ) + (return + (get_local $0) + ) + ) + (func "$(lib)/polyfills/bswap" (; 8 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i64) + (local $3 i64) + (local $4 i64) + (if + (i32.eqz + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 4) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 2) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 4) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 8) + ) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 2) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.eq + (i32.const 4) + (i32.const 2) + ) + (return + (call "$(lib)/polyfills/bswap16" + (get_local $0) + ) + ) + (if + (i32.eq + (i32.const 4) + (i32.const 4) + ) + (return + (i32.or + (i32.rotl + (i32.and + (get_local $0) + (i32.const -16711936) + ) + (i32.const 8) + ) + (i32.rotr + (i32.and + (get_local $0) + (i32.const 16711935) + ) + (i32.const 8) + ) + ) + ) + (if + (i32.eq + (i32.const 4) + (i32.const 8) + ) + (block + (set_local $2 + (i64.and + (i64.shr_u + (i64.extend_u/i32 + (get_local $0) + ) + (i64.const 8) + ) + (i64.const 71777214294589695) + ) + ) + (set_local $3 + (i64.shl + (i64.and + (i64.extend_u/i32 + (get_local $0) + ) + (i64.const 71777214294589695) + ) + (i64.const 8) + ) + ) + (set_local $4 + (i64.or + (get_local $2) + (get_local $3) + ) + ) + (set_local $2 + (i64.and + (i64.shr_u + (get_local $4) + (i64.const 16) + ) + (i64.const 281470681808895) + ) + ) + (set_local $3 + (i64.shl + (i64.and + (get_local $4) + (i64.const 281470681808895) + ) + (i64.const 16) + ) + ) + (return + (i32.wrap/i64 + (i64.rotr + (i64.or + (get_local $2) + (get_local $3) + ) + (i64.const 32) + ) + ) + ) + ) + ) + ) + ) + (return + (get_local $0) + ) + ) + (func "$(lib)/polyfills/bswap16" (; 9 ;) (type $II) (param $0 i64) (result i64) + (local $1 i32) + (if + (i32.eqz + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 8) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 8) + (i32.const 2) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 8) + (i32.const 4) + ) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 25) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 8) + (i32.const 2) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 8) + (i32.const 4) + ) + ) + (i32.const 1) + ) + (return + (i64.or + (i64.or + (i64.and + (i64.shl + (get_local $0) + (i64.const 8) + ) + (i64.const 65280) + ) + (i64.and + (i64.shr_u + (get_local $0) + (i64.const 8) + ) + (i64.const 255) + ) + ) + (i64.and + (get_local $0) + (i64.const 4294901760) + ) + ) + ) + ) + (return + (get_local $0) + ) + ) + (func "$(lib)/polyfills/bswap" (; 10 ;) (type $II) (param $0 i64) (result i64) + (local $1 i32) + (local $2 i64) + (local $3 i64) + (local $4 i64) + (if + (i32.eqz + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 8) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 8) + (i32.const 2) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 8) + (i32.const 4) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 8) + (i32.const 8) + ) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 2) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.eq + (i32.const 8) + (i32.const 2) + ) + (return + (call "$(lib)/polyfills/bswap16" + (get_local $0) + ) + ) + (if + (i32.eq + (i32.const 8) + (i32.const 4) + ) + (return + (i64.extend_u/i32 + (i32.or + (i32.rotl + (i32.and + (i32.wrap/i64 + (get_local $0) + ) + (i32.const -16711936) + ) + (i32.const 8) + ) + (i32.rotr + (i32.and + (i32.wrap/i64 + (get_local $0) + ) + (i32.const 16711935) + ) + (i32.const 8) + ) + ) + ) + ) + (if + (i32.eq + (i32.const 8) + (i32.const 8) + ) + (block + (set_local $2 + (i64.and + (i64.shr_u + (get_local $0) + (i64.const 8) + ) + (i64.const 71777214294589695) + ) + ) + (set_local $3 + (i64.shl + (i64.and + (get_local $0) + (i64.const 71777214294589695) + ) + (i64.const 8) + ) + ) + (set_local $4 + (i64.or + (get_local $2) + (get_local $3) + ) + ) + (set_local $2 + (i64.and + (i64.shr_u + (get_local $4) + (i64.const 16) + ) + (i64.const 281470681808895) + ) + ) + (set_local $3 + (i64.shl + (i64.and + (get_local $4) + (i64.const 281470681808895) + ) + (i64.const 16) + ) + ) + (return + (i64.rotr + (i64.or + (get_local $2) + (get_local $3) + ) + (i64.const 32) + ) + ) + ) + ) + ) + ) + (return + (get_local $0) + ) + ) + (func "$(lib)/polyfills/bswap16" (; 11 ;) (type $II) (param $0 i64) (result i64) + (local $1 i32) + (if + (i32.eqz + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 8) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 8) + (i32.const 2) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 8) + (i32.const 4) + ) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 25) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 8) + (i32.const 2) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 8) + (i32.const 4) + ) + ) + (i32.const 1) + ) + (return + (i64.or + (i64.or + (i64.and + (i64.shl + (get_local $0) + (i64.const 8) + ) + (i64.const 65280) + ) + (i64.and + (i64.shr_s + (get_local $0) + (i64.const 8) + ) + (i64.const 255) + ) + ) + (i64.and + (get_local $0) + (i64.const 4294901760) + ) + ) + ) + ) + (return + (get_local $0) + ) + ) + (func "$(lib)/polyfills/bswap" (; 12 ;) (type $II) (param $0 i64) (result i64) + (local $1 i32) + (local $2 i64) + (local $3 i64) + (local $4 i64) + (if + (i32.eqz + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 8) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 8) + (i32.const 2) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 8) + (i32.const 4) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 8) + (i32.const 8) + ) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 2) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.eq + (i32.const 8) + (i32.const 2) + ) + (return + (call "$(lib)/polyfills/bswap16" + (get_local $0) + ) + ) + (if + (i32.eq + (i32.const 8) + (i32.const 4) + ) + (return + (i64.extend_s/i32 + (i32.or + (i32.rotl + (i32.and + (i32.wrap/i64 + (get_local $0) + ) + (i32.const -16711936) + ) + (i32.const 8) + ) + (i32.rotr + (i32.and + (i32.wrap/i64 + (get_local $0) + ) + (i32.const 16711935) + ) + (i32.const 8) + ) + ) + ) + ) + (if + (i32.eq + (i32.const 8) + (i32.const 8) + ) + (block + (set_local $2 + (i64.and + (i64.shr_u + (get_local $0) + (i64.const 8) + ) + (i64.const 71777214294589695) + ) + ) + (set_local $3 + (i64.shl + (i64.and + (get_local $0) + (i64.const 71777214294589695) + ) + (i64.const 8) + ) + ) + (set_local $4 + (i64.or + (get_local $2) + (get_local $3) + ) + ) + (set_local $2 + (i64.and + (i64.shr_u + (get_local $4) + (i64.const 16) + ) + (i64.const 281470681808895) + ) + ) + (set_local $3 + (i64.shl + (i64.and + (get_local $4) + (i64.const 281470681808895) + ) + (i64.const 16) + ) + ) + (return + (i64.rotr + (i64.or + (get_local $2) + (get_local $3) + ) + (i64.const 32) + ) + ) + ) + ) + ) + ) + (return + (get_local $0) + ) + ) + (func "$(lib)/polyfills/bswap16" (; 13 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (if + (i32.eqz + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 4) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 2) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 4) + ) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 25) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 4) + (i32.const 2) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 4) + ) + ) + (i32.const 1) + ) + (return + (i32.or + (i32.or + (i32.and + (i32.shl + (get_local $0) + (i32.const 8) + ) + (i32.const 65280) + ) + (i32.and + (i32.shr_u + (get_local $0) + (i32.const 8) + ) + (i32.const 255) + ) + ) + (i32.and + (get_local $0) + (i32.const -65536) + ) + ) + ) + ) + (return + (get_local $0) + ) + ) + (func "$(lib)/polyfills/bswap" (; 14 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i64) + (local $3 i64) + (local $4 i64) + (if + (i32.eqz + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 4) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 2) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 4) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 8) + ) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 2) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.eq + (i32.const 4) + (i32.const 2) + ) + (return + (call "$(lib)/polyfills/bswap16" + (get_local $0) + ) + ) + (if + (i32.eq + (i32.const 4) + (i32.const 4) + ) + (return + (i32.or + (i32.rotl + (i32.and + (get_local $0) + (i32.const -16711936) + ) + (i32.const 8) + ) + (i32.rotr + (i32.and + (get_local $0) + (i32.const 16711935) + ) + (i32.const 8) + ) + ) + ) + (if + (i32.eq + (i32.const 4) + (i32.const 8) + ) + (block + (set_local $2 + (i64.and + (i64.shr_u + (i64.extend_u/i32 + (get_local $0) + ) + (i64.const 8) + ) + (i64.const 71777214294589695) + ) + ) + (set_local $3 + (i64.shl + (i64.and + (i64.extend_u/i32 + (get_local $0) + ) + (i64.const 71777214294589695) + ) + (i64.const 8) + ) + ) + (set_local $4 + (i64.or + (get_local $2) + (get_local $3) + ) + ) + (set_local $2 + (i64.and + (i64.shr_u + (get_local $4) + (i64.const 16) + ) + (i64.const 281470681808895) + ) + ) + (set_local $3 + (i64.shl + (i64.and + (get_local $4) + (i64.const 281470681808895) + ) + (i64.const 16) + ) + ) + (return + (i32.wrap/i64 + (i64.rotr + (i64.or + (get_local $2) + (get_local $3) + ) + (i64.const 32) + ) + ) + ) + ) + ) + ) + ) + (return + (get_local $0) + ) + ) + (func "$(lib)/polyfills/bswap16" (; 15 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (if + (i32.eqz + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 4) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 2) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 4) + ) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 25) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 4) + (i32.const 2) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 4) + ) + ) + (i32.const 1) + ) + (return + (i32.or + (i32.or + (i32.and + (i32.shl + (get_local $0) + (i32.const 8) + ) + (i32.const 65280) + ) + (i32.and + (i32.shr_s + (get_local $0) + (i32.const 8) + ) + (i32.const 255) + ) + ) + (i32.and + (get_local $0) + (i32.const -65536) + ) + ) + ) + ) + (return + (get_local $0) + ) + ) + (func "$(lib)/polyfills/bswap" (; 16 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i64) + (local $3 i64) + (local $4 i64) + (if + (i32.eqz + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.and + (if (result i32) + (i32.ne + (tee_local $1 + (i32.eq + (i32.const 4) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 2) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 4) + ) + ) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (get_local $1) + (i32.eq + (i32.const 4) + (i32.const 8) + ) + ) + (i32.const 1) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 4) + (i32.const 2) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.eq + (i32.const 4) + (i32.const 2) + ) + (return + (call "$(lib)/polyfills/bswap16" + (get_local $0) + ) + ) + (if + (i32.eq + (i32.const 4) + (i32.const 4) + ) + (return + (i32.or + (i32.rotl + (i32.and + (get_local $0) + (i32.const -16711936) + ) + (i32.const 8) + ) + (i32.rotr + (i32.and + (get_local $0) + (i32.const 16711935) + ) + (i32.const 8) + ) + ) + ) + (if + (i32.eq + (i32.const 4) + (i32.const 8) + ) + (block + (set_local $2 + (i64.and + (i64.shr_u + (i64.extend_u/i32 + (get_local $0) + ) + (i64.const 8) + ) + (i64.const 71777214294589695) + ) + ) + (set_local $3 + (i64.shl + (i64.and + (i64.extend_u/i32 + (get_local $0) + ) + (i64.const 71777214294589695) + ) + (i64.const 8) + ) + ) + (set_local $4 + (i64.or + (get_local $2) + (get_local $3) + ) + ) + (set_local $2 + (i64.and + (i64.shr_u + (get_local $4) + (i64.const 16) + ) + (i64.const 281470681808895) + ) + ) + (set_local $3 + (i64.shl + (i64.and + (get_local $4) + (i64.const 281470681808895) + ) + (i64.const 16) + ) + ) + (return + (i32.wrap/i64 + (i64.rotr + (i64.or + (get_local $2) + (get_local $3) + ) + (i64.const 32) + ) + ) + ) + ) + ) + ) + ) + (return + (get_local $0) + ) + ) + (func $start (; 17 ;) (type $v) + (if + (i32.eqz + (i32.eq + (call "$(lib)/polyfills/bswap" + (i32.const 43707) + ) + (i32.const 48042) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 4) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eq + (call "$(lib)/polyfills/bswap" + (i32.shr_s + (i32.shl + (i32.const 43707) + (i32.const 16) + ) + (i32.const 16) + ) + ) + (i32.shr_s + (i32.shl + (i32.const 48042) + (i32.const 16) + ) + (i32.const 16) + ) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 5) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eq + (call "$(lib)/polyfills/bswap" + (i32.const -1430532899) + ) + (i32.const -573785174) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 8) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eq + (call "$(lib)/polyfills/bswap" + (i32.wrap/i64 + (i64.const 2864434397) + ) + ) + (i32.wrap/i64 + (i64.const 3721182122) + ) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 9) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i64.eq + (call "$(lib)/polyfills/bswap" + (i64.const 4822679907192029) + ) + (i64.const -2464388556401798912) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 12) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i64.eq + (call "$(lib)/polyfills/bswap" + (i64.const 4822679907192029) + ) + (i64.const -2464388556401798912) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 13) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eq + (call "$(lib)/polyfills/bswap" + (i32.const -1430532899) + ) + (i32.const -573785174) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 16) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eq + (call "$(lib)/polyfills/bswap" + (i32.const -1430532899) + ) + (i32.const -573785174) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 17) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eq + (call "$(lib)/polyfills/bswap16" + (i32.const 43707) + ) + (i32.const 48042) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 20) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eq + (call "$(lib)/polyfills/bswap16" + (i32.shr_s + (i32.shl + (i32.const 43707) + (i32.const 16) + ) + (i32.const 16) + ) + ) + (i32.shr_s + (i32.shl + (i32.const 48042) + (i32.const 16) + ) + (i32.const 16) + ) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 21) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eq + (call "$(lib)/polyfills/bswap16" + (i32.const -7820613) + ) + (i32.const -7816278) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 24) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eq + (call "$(lib)/polyfills/bswap16" + (i32.wrap/i64 + (i64.const 4287146683) + ) + ) + (i32.wrap/i64 + (i64.const 4287151018) + ) + ) + ) + (block + (call $abort + (i32.const 0) + (i32.const 44) + (i32.const 25) + (i32.const 0) + ) + (unreachable) + ) + ) + ) +)