diff options
Diffstat (limited to 'test')
52 files changed, 7065 insertions, 0 deletions
diff --git a/test/fixtures/outside.txt b/test/fixtures/outside.txt new file mode 100644 index 0000000000..044c4b9614 --- /dev/null +++ b/test/fixtures/outside.txt @@ -0,0 +1,2 @@ +this file is part of the WASI tests. it exists outside of the sandbox, and +should be inaccessible from the WASI tests. diff --git a/test/fixtures/wasi/input.txt b/test/fixtures/wasi/input.txt new file mode 100644 index 0000000000..4c38053764 --- /dev/null +++ b/test/fixtures/wasi/input.txt @@ -0,0 +1 @@ +hello from input.txt diff --git a/test/fixtures/wasi/notadir b/test/fixtures/wasi/notadir new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/fixtures/wasi/notadir diff --git a/test/fixtures/wasi/simple-wasi.wasm b/test/fixtures/wasi/simple-wasi.wasm Binary files differnew file mode 100755 index 0000000000..334d3a3dca --- /dev/null +++ b/test/fixtures/wasi/simple-wasi.wasm diff --git a/test/fixtures/wasi/simple-wasi.wat b/test/fixtures/wasi/simple-wasi.wat new file mode 100644 index 0000000000..318f390c76 --- /dev/null +++ b/test/fixtures/wasi/simple-wasi.wat @@ -0,0 +1,6533 @@ +(module + (type (;0;) (func (param i32 i32 i32) (result i32))) + (type (;1;) (func (param i32 i64 i32) (result i64))) + (type (;2;) (func (param i32 i32) (result i32))) + (type (;3;) (func (param i32))) + (type (;4;) (func (param i32) (result i32))) + (type (;5;) (func (param i32 i32 i32 i32) (result i32))) + (type (;6;) (func (param i32 i64 i32 i32) (result i32))) + (type (;7;) (func)) + (type (;8;) (func (result i32))) + (import "wasi_unstable" "fd_prestat_get" (func (;0;) (type 2))) + (import "wasi_unstable" "fd_prestat_dir_name" (func (;1;) (type 0))) + (import "wasi_unstable" "environ_sizes_get" (func (;2;) (type 2))) + (import "wasi_unstable" "environ_get" (func (;3;) (type 2))) + (import "wasi_unstable" "args_sizes_get" (func (;4;) (type 2))) + (import "wasi_unstable" "args_get" (func (;5;) (type 2))) + (import "wasi_unstable" "proc_exit" (func (;6;) (type 3))) + (import "wasi_unstable" "fd_fdstat_get" (func (;7;) (type 2))) + (import "wasi_unstable" "fd_close" (func (;8;) (type 4))) + (import "wasi_unstable" "fd_write" (func (;9;) (type 5))) + (import "wasi_unstable" "fd_seek" (func (;10;) (type 6))) + (func (;11;) (type 7)) + (func (;12;) (type 7) + (local i32 i32 i32 i32) + get_global 0 + i32.const 16 + i32.sub + tee_local 0 + set_global 0 + call 23 + i32.const 3 + set_local 1 + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + block ;; label = @4 + loop ;; label = @5 + get_local 1 + get_local 0 + call 0 + tee_local 2 + i32.const 8 + i32.eq + br_if 1 (;@4;) + get_local 2 + br_if 3 (;@2;) + block ;; label = @6 + get_local 0 + i32.load8_u + br_if 0 (;@6;) + get_local 0 + i32.load offset=4 + i32.const 1 + i32.add + call 14 + tee_local 2 + i32.eqz + br_if 4 (;@2;) + get_local 1 + get_local 2 + get_local 0 + i32.load offset=4 + call 1 + br_if 3 (;@3;) + get_local 2 + get_local 0 + i32.load offset=4 + i32.add + i32.const 0 + i32.store8 + get_local 1 + get_local 2 + call 24 + set_local 3 + get_local 2 + call 16 + get_local 3 + br_if 4 (;@2;) + end + get_local 1 + i32.const 1 + i32.add + tee_local 1 + br_if 0 (;@5;) + end + end + block ;; label = @4 + get_local 0 + get_local 0 + i32.const 12 + i32.add + call 2 + br_if 0 (;@4;) + i32.const 0 + get_local 0 + i32.load + i32.const 2 + i32.shl + i32.const 4 + i32.add + call 14 + i32.store offset=1544 + get_local 0 + i32.load offset=12 + call 14 + tee_local 1 + i32.eqz + br_if 0 (;@4;) + i32.const 0 + i32.load offset=1544 + tee_local 2 + i32.eqz + br_if 0 (;@4;) + get_local 2 + get_local 0 + i32.load + i32.const 2 + i32.shl + i32.add + i32.const 0 + i32.store + i32.const 0 + i32.load offset=1544 + get_local 1 + call 3 + br_if 0 (;@4;) + block ;; label = @5 + block ;; label = @6 + block ;; label = @7 + get_local 0 + i32.const 12 + i32.add + get_local 0 + call 4 + br_if 0 (;@7;) + get_local 0 + i32.load offset=12 + tee_local 1 + i32.eqz + br_if 1 (;@6;) + get_local 1 + i32.const 2 + i32.shl + i32.const 4 + i32.add + call 14 + set_local 1 + get_local 0 + i32.load + call 14 + set_local 2 + get_local 1 + i32.eqz + br_if 0 (;@7;) + get_local 2 + i32.eqz + br_if 0 (;@7;) + get_local 1 + i32.const 0 + i32.store + get_local 1 + get_local 2 + call 5 + i32.eqz + br_if 2 (;@5;) + end + i32.const 71 + call 19 + unreachable + end + end + call 11 + get_local 0 + i32.load offset=12 + get_local 1 + call 13 + set_local 1 + call 27 + get_local 1 + br_if 3 (;@1;) + get_local 0 + i32.const 16 + i32.add + set_global 0 + return + end + i32.const 71 + call 19 + unreachable + end + get_local 2 + call 16 + end + i32.const 71 + call 19 + unreachable + end + get_local 1 + call 19 + unreachable) + (func (;13;) (type 2) (param i32 i32) (result i32) + i32.const 1024 + call 35 + drop + i32.const 0) + (func (;14;) (type 4) (param i32) (result i32) + get_local 0 + call 15) + (func (;15;) (type 4) (param i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) + get_global 0 + i32.const 16 + i32.sub + tee_local 1 + set_global 0 + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + block ;; label = @4 + block ;; label = @5 + block ;; label = @6 + block ;; label = @7 + block ;; label = @8 + block ;; label = @9 + block ;; label = @10 + block ;; label = @11 + block ;; label = @12 + block ;; label = @13 + block ;; label = @14 + block ;; label = @15 + block ;; label = @16 + block ;; label = @17 + block ;; label = @18 + block ;; label = @19 + block ;; label = @20 + block ;; label = @21 + block ;; label = @22 + block ;; label = @23 + block ;; label = @24 + block ;; label = @25 + block ;; label = @26 + block ;; label = @27 + block ;; label = @28 + block ;; label = @29 + block ;; label = @30 + block ;; label = @31 + block ;; label = @32 + block ;; label = @33 + block ;; label = @34 + block ;; label = @35 + block ;; label = @36 + block ;; label = @37 + block ;; label = @38 + get_local 0 + i32.const 244 + i32.gt_u + br_if 0 (;@38;) + i32.const 0 + i32.load offset=1040 + tee_local 2 + i32.const 16 + get_local 0 + i32.const 11 + i32.add + i32.const -8 + i32.and + get_local 0 + i32.const 11 + i32.lt_u + select + tee_local 3 + i32.const 3 + i32.shr_u + tee_local 4 + i32.shr_u + tee_local 0 + i32.const 3 + i32.and + i32.eqz + br_if 1 (;@37;) + get_local 0 + i32.const -1 + i32.xor + i32.const 1 + i32.and + get_local 4 + i32.add + tee_local 5 + i32.const 3 + i32.shl + tee_local 6 + i32.const 1088 + i32.add + i32.load + tee_local 4 + i32.const 8 + i32.add + set_local 0 + get_local 4 + i32.load offset=8 + tee_local 3 + get_local 6 + i32.const 1080 + i32.add + tee_local 6 + i32.eq + br_if 2 (;@36;) + get_local 3 + get_local 6 + i32.store offset=12 + get_local 6 + i32.const 8 + i32.add + get_local 3 + i32.store + br 3 (;@35;) + end + i32.const -1 + set_local 3 + get_local 0 + i32.const -65 + i32.gt_u + br_if 14 (;@23;) + get_local 0 + i32.const 11 + i32.add + tee_local 0 + i32.const -8 + i32.and + set_local 3 + i32.const 0 + i32.load offset=1044 + tee_local 7 + i32.eqz + br_if 14 (;@23;) + i32.const 0 + set_local 8 + block ;; label = @38 + get_local 0 + i32.const 8 + i32.shr_u + tee_local 0 + i32.eqz + br_if 0 (;@38;) + i32.const 31 + set_local 8 + get_local 3 + i32.const 16777215 + i32.gt_u + br_if 0 (;@38;) + get_local 3 + i32.const 14 + get_local 0 + get_local 0 + i32.const 1048320 + i32.add + i32.const 16 + i32.shr_u + i32.const 8 + i32.and + tee_local 4 + i32.shl + tee_local 0 + i32.const 520192 + i32.add + i32.const 16 + i32.shr_u + i32.const 4 + i32.and + tee_local 5 + get_local 4 + i32.or + get_local 0 + get_local 5 + i32.shl + tee_local 0 + i32.const 245760 + i32.add + i32.const 16 + i32.shr_u + i32.const 2 + i32.and + tee_local 4 + i32.or + i32.sub + get_local 0 + get_local 4 + i32.shl + i32.const 15 + i32.shr_u + i32.add + tee_local 0 + i32.const 7 + i32.add + i32.shr_u + i32.const 1 + i32.and + get_local 0 + i32.const 1 + i32.shl + i32.or + set_local 8 + end + i32.const 0 + get_local 3 + i32.sub + set_local 5 + get_local 8 + i32.const 2 + i32.shl + i32.const 1344 + i32.add + i32.load + tee_local 4 + i32.eqz + br_if 3 (;@34;) + get_local 3 + i32.const 0 + i32.const 25 + get_local 8 + i32.const 1 + i32.shr_u + i32.sub + get_local 8 + i32.const 31 + i32.eq + select + i32.shl + set_local 6 + i32.const 0 + set_local 0 + i32.const 0 + set_local 9 + loop ;; label = @38 + block ;; label = @39 + get_local 4 + i32.load offset=4 + i32.const -8 + i32.and + get_local 3 + i32.sub + tee_local 2 + get_local 5 + i32.ge_u + br_if 0 (;@39;) + get_local 2 + set_local 5 + get_local 4 + set_local 9 + get_local 2 + i32.eqz + br_if 8 (;@31;) + end + get_local 0 + get_local 4 + i32.const 20 + i32.add + i32.load + tee_local 2 + get_local 2 + get_local 4 + get_local 6 + i32.const 29 + i32.shr_u + i32.const 4 + i32.and + i32.add + i32.const 16 + i32.add + i32.load + tee_local 4 + i32.eq + select + get_local 0 + get_local 2 + select + set_local 0 + get_local 6 + get_local 4 + i32.const 0 + i32.ne + i32.shl + set_local 6 + get_local 4 + br_if 0 (;@38;) + end + get_local 0 + get_local 9 + i32.or + i32.eqz + br_if 4 (;@33;) + br 11 (;@26;) + end + get_local 3 + i32.const 0 + i32.load offset=1048 + tee_local 7 + i32.le_u + br_if 13 (;@23;) + get_local 0 + i32.eqz + br_if 4 (;@32;) + get_local 0 + get_local 4 + i32.shl + i32.const 2 + get_local 4 + i32.shl + tee_local 0 + i32.const 0 + get_local 0 + i32.sub + i32.or + i32.and + tee_local 0 + i32.const 0 + get_local 0 + i32.sub + i32.and + i32.const -1 + i32.add + tee_local 0 + get_local 0 + i32.const 12 + i32.shr_u + i32.const 16 + i32.and + tee_local 0 + i32.shr_u + tee_local 4 + i32.const 5 + i32.shr_u + i32.const 8 + i32.and + tee_local 5 + get_local 0 + i32.or + get_local 4 + get_local 5 + i32.shr_u + tee_local 0 + i32.const 2 + i32.shr_u + i32.const 4 + i32.and + tee_local 4 + i32.or + get_local 0 + get_local 4 + i32.shr_u + tee_local 0 + i32.const 1 + i32.shr_u + i32.const 2 + i32.and + tee_local 4 + i32.or + get_local 0 + get_local 4 + i32.shr_u + tee_local 0 + i32.const 1 + i32.shr_u + i32.const 1 + i32.and + tee_local 4 + i32.or + get_local 0 + get_local 4 + i32.shr_u + i32.add + tee_local 5 + i32.const 3 + i32.shl + tee_local 6 + i32.const 1088 + i32.add + i32.load + tee_local 4 + i32.load offset=8 + tee_local 0 + get_local 6 + i32.const 1080 + i32.add + tee_local 6 + i32.eq + br_if 6 (;@30;) + get_local 0 + get_local 6 + i32.store offset=12 + get_local 6 + i32.const 8 + i32.add + get_local 0 + i32.store + br 7 (;@29;) + end + i32.const 0 + get_local 2 + i32.const -2 + get_local 5 + i32.rotl + i32.and + i32.store offset=1040 + end + get_local 4 + get_local 5 + i32.const 3 + i32.shl + tee_local 5 + i32.const 3 + i32.or + i32.store offset=4 + get_local 4 + get_local 5 + i32.add + tee_local 4 + get_local 4 + i32.load offset=4 + i32.const 1 + i32.or + i32.store offset=4 + br 33 (;@1;) + end + i32.const 0 + set_local 0 + i32.const 0 + set_local 9 + i32.const 0 + i32.const 0 + i32.or + br_if 7 (;@26;) + end + i32.const 2 + get_local 8 + i32.shl + tee_local 0 + i32.const 0 + get_local 0 + i32.sub + i32.or + get_local 7 + i32.and + tee_local 0 + i32.eqz + br_if 9 (;@23;) + get_local 0 + i32.const 0 + get_local 0 + i32.sub + i32.and + i32.const -1 + i32.add + tee_local 0 + get_local 0 + i32.const 12 + i32.shr_u + i32.const 16 + i32.and + tee_local 0 + i32.shr_u + tee_local 4 + i32.const 5 + i32.shr_u + i32.const 8 + i32.and + tee_local 6 + get_local 0 + i32.or + get_local 4 + get_local 6 + i32.shr_u + tee_local 0 + i32.const 2 + i32.shr_u + i32.const 4 + i32.and + tee_local 4 + i32.or + get_local 0 + get_local 4 + i32.shr_u + tee_local 0 + i32.const 1 + i32.shr_u + i32.const 2 + i32.and + tee_local 4 + i32.or + get_local 0 + get_local 4 + i32.shr_u + tee_local 0 + i32.const 1 + i32.shr_u + i32.const 1 + i32.and + tee_local 4 + i32.or + get_local 0 + get_local 4 + i32.shr_u + i32.add + i32.const 2 + i32.shl + i32.const 1344 + i32.add + i32.load + tee_local 0 + br_if 7 (;@25;) + br 8 (;@24;) + end + i32.const 0 + i32.load offset=1044 + tee_local 10 + i32.eqz + br_if 8 (;@23;) + get_local 10 + i32.const 0 + get_local 10 + i32.sub + i32.and + i32.const -1 + i32.add + tee_local 0 + get_local 0 + i32.const 12 + i32.shr_u + i32.const 16 + i32.and + tee_local 0 + i32.shr_u + tee_local 4 + i32.const 5 + i32.shr_u + i32.const 8 + i32.and + tee_local 5 + get_local 0 + i32.or + get_local 4 + get_local 5 + i32.shr_u + tee_local 0 + i32.const 2 + i32.shr_u + i32.const 4 + i32.and + tee_local 4 + i32.or + get_local 0 + get_local 4 + i32.shr_u + tee_local 0 + i32.const 1 + i32.shr_u + i32.const 2 + i32.and + tee_local 4 + i32.or + get_local 0 + get_local 4 + i32.shr_u + tee_local 0 + i32.const 1 + i32.shr_u + i32.const 1 + i32.and + tee_local 4 + i32.or + get_local 0 + get_local 4 + i32.shr_u + i32.add + i32.const 2 + i32.shl + i32.const 1344 + i32.add + i32.load + tee_local 6 + i32.load offset=4 + i32.const -8 + i32.and + get_local 3 + i32.sub + set_local 5 + get_local 6 + tee_local 9 + i32.load offset=16 + tee_local 0 + i32.eqz + br_if 3 (;@28;) + i32.const 1 + set_local 4 + br 4 (;@27;) + end + i32.const 0 + set_local 5 + get_local 4 + set_local 9 + get_local 4 + set_local 0 + br 5 (;@25;) + end + i32.const 0 + get_local 2 + i32.const -2 + get_local 5 + i32.rotl + i32.and + tee_local 2 + i32.store offset=1040 + end + get_local 4 + i32.const 8 + i32.add + set_local 0 + get_local 4 + get_local 3 + i32.const 3 + i32.or + i32.store offset=4 + get_local 4 + get_local 5 + i32.const 3 + i32.shl + tee_local 5 + i32.add + get_local 5 + get_local 3 + i32.sub + tee_local 5 + i32.store + get_local 4 + get_local 3 + i32.add + tee_local 6 + get_local 5 + i32.const 1 + i32.or + i32.store offset=4 + block ;; label = @29 + get_local 7 + i32.eqz + br_if 0 (;@29;) + get_local 7 + i32.const 3 + i32.shr_u + tee_local 9 + i32.const 3 + i32.shl + i32.const 1080 + i32.add + set_local 3 + i32.const 0 + i32.load offset=1060 + set_local 4 + block ;; label = @30 + block ;; label = @31 + get_local 2 + i32.const 1 + get_local 9 + i32.shl + tee_local 9 + i32.and + i32.eqz + br_if 0 (;@31;) + get_local 3 + i32.load offset=8 + set_local 9 + br 1 (;@30;) + end + i32.const 0 + get_local 2 + get_local 9 + i32.or + i32.store offset=1040 + get_local 3 + set_local 9 + end + get_local 9 + get_local 4 + i32.store offset=12 + get_local 3 + get_local 4 + i32.store offset=8 + get_local 4 + get_local 3 + i32.store offset=12 + get_local 4 + get_local 9 + i32.store offset=8 + end + i32.const 0 + get_local 6 + i32.store offset=1060 + i32.const 0 + get_local 5 + i32.store offset=1048 + br 27 (;@1;) + end + i32.const 0 + set_local 4 + end + block ;; label = @27 + block ;; label = @28 + loop ;; label = @29 + block ;; label = @30 + block ;; label = @31 + block ;; label = @32 + block ;; label = @33 + get_local 4 + br_table 1 (;@32;) 0 (;@33;) 0 (;@33;) + end + get_local 0 + i32.load offset=4 + i32.const -8 + i32.and + get_local 3 + i32.sub + tee_local 4 + get_local 5 + get_local 4 + get_local 5 + i32.lt_u + tee_local 4 + select + set_local 5 + get_local 0 + get_local 6 + get_local 4 + select + set_local 6 + get_local 0 + tee_local 9 + i32.load offset=16 + tee_local 0 + br_if 1 (;@31;) + i32.const 0 + set_local 4 + br 3 (;@29;) + end + get_local 9 + i32.const 20 + i32.add + i32.load + tee_local 0 + br_if 1 (;@30;) + get_local 6 + get_local 3 + i32.add + tee_local 11 + get_local 6 + i32.le_u + br_if 8 (;@23;) + get_local 6 + i32.load offset=24 + set_local 12 + block ;; label = @32 + get_local 6 + i32.load offset=12 + tee_local 9 + get_local 6 + i32.eq + br_if 0 (;@32;) + get_local 6 + i32.load offset=8 + tee_local 0 + get_local 9 + i32.store offset=12 + get_local 9 + get_local 0 + i32.store offset=8 + get_local 12 + br_if 4 (;@28;) + br 5 (;@27;) + end + block ;; label = @32 + block ;; label = @33 + get_local 6 + i32.const 20 + i32.add + tee_local 4 + i32.load + tee_local 0 + br_if 0 (;@33;) + get_local 6 + i32.load offset=16 + tee_local 0 + i32.eqz + br_if 1 (;@32;) + get_local 6 + i32.const 16 + i32.add + set_local 4 + end + loop ;; label = @33 + get_local 4 + set_local 8 + get_local 0 + tee_local 9 + i32.const 20 + i32.add + tee_local 4 + i32.load + tee_local 0 + br_if 0 (;@33;) + get_local 9 + i32.const 16 + i32.add + set_local 4 + get_local 9 + i32.load offset=16 + tee_local 0 + br_if 0 (;@33;) + end + get_local 8 + i32.const 0 + i32.store + get_local 12 + i32.eqz + br_if 5 (;@27;) + br 4 (;@28;) + end + i32.const 0 + set_local 9 + get_local 12 + br_if 3 (;@28;) + br 4 (;@27;) + end + i32.const 1 + set_local 4 + br 1 (;@29;) + end + i32.const 1 + set_local 4 + br 0 (;@29;) + end + end + block ;; label = @28 + block ;; label = @29 + block ;; label = @30 + get_local 6 + get_local 6 + i32.load offset=28 + tee_local 4 + i32.const 2 + i32.shl + i32.const 1344 + i32.add + tee_local 0 + i32.load + i32.eq + br_if 0 (;@30;) + get_local 12 + i32.const 16 + i32.const 20 + get_local 12 + i32.load offset=16 + get_local 6 + i32.eq + select + i32.add + get_local 9 + i32.store + get_local 9 + br_if 1 (;@29;) + br 3 (;@27;) + end + get_local 0 + get_local 9 + i32.store + get_local 9 + i32.eqz + br_if 1 (;@28;) + end + get_local 9 + get_local 12 + i32.store offset=24 + block ;; label = @29 + get_local 6 + i32.load offset=16 + tee_local 0 + i32.eqz + br_if 0 (;@29;) + get_local 9 + get_local 0 + i32.store offset=16 + get_local 0 + get_local 9 + i32.store offset=24 + end + get_local 6 + i32.const 20 + i32.add + i32.load + tee_local 0 + i32.eqz + br_if 1 (;@27;) + get_local 9 + i32.const 20 + i32.add + get_local 0 + i32.store + get_local 0 + get_local 9 + i32.store offset=24 + br 1 (;@27;) + end + i32.const 0 + get_local 10 + i32.const -2 + get_local 4 + i32.rotl + i32.and + i32.store offset=1044 + end + block ;; label = @27 + block ;; label = @28 + get_local 5 + i32.const 15 + i32.gt_u + br_if 0 (;@28;) + get_local 6 + get_local 5 + get_local 3 + i32.add + tee_local 0 + i32.const 3 + i32.or + i32.store offset=4 + get_local 6 + get_local 0 + i32.add + tee_local 0 + get_local 0 + i32.load offset=4 + i32.const 1 + i32.or + i32.store offset=4 + br 1 (;@27;) + end + get_local 11 + get_local 5 + i32.const 1 + i32.or + i32.store offset=4 + get_local 6 + get_local 3 + i32.const 3 + i32.or + i32.store offset=4 + get_local 11 + get_local 5 + i32.add + get_local 5 + i32.store + block ;; label = @28 + get_local 7 + i32.eqz + br_if 0 (;@28;) + get_local 7 + i32.const 3 + i32.shr_u + tee_local 3 + i32.const 3 + i32.shl + i32.const 1080 + i32.add + set_local 4 + i32.const 0 + i32.load offset=1060 + set_local 0 + block ;; label = @29 + block ;; label = @30 + i32.const 1 + get_local 3 + i32.shl + tee_local 3 + get_local 2 + i32.and + i32.eqz + br_if 0 (;@30;) + get_local 4 + i32.load offset=8 + set_local 3 + br 1 (;@29;) + end + i32.const 0 + get_local 3 + get_local 2 + i32.or + i32.store offset=1040 + get_local 4 + set_local 3 + end + get_local 3 + get_local 0 + i32.store offset=12 + get_local 4 + get_local 0 + i32.store offset=8 + get_local 0 + get_local 4 + i32.store offset=12 + get_local 0 + get_local 3 + i32.store offset=8 + end + i32.const 0 + get_local 11 + i32.store offset=1060 + i32.const 0 + get_local 5 + i32.store offset=1048 + end + get_local 6 + i32.const 8 + i32.add + set_local 0 + br 25 (;@1;) + end + get_local 0 + i32.eqz + br_if 1 (;@24;) + end + loop ;; label = @25 + get_local 0 + i32.load offset=4 + i32.const -8 + i32.and + get_local 3 + i32.sub + tee_local 2 + get_local 5 + i32.lt_u + set_local 6 + block ;; label = @26 + get_local 0 + i32.load offset=16 + tee_local 4 + br_if 0 (;@26;) + get_local 0 + i32.const 20 + i32.add + i32.load + set_local 4 + end + get_local 2 + get_local 5 + get_local 6 + select + set_local 5 + get_local 0 + get_local 9 + get_local 6 + select + set_local 9 + get_local 4 + set_local 0 + get_local 4 + br_if 0 (;@25;) + end + end + get_local 9 + i32.eqz + br_if 0 (;@23;) + get_local 5 + i32.const 0 + i32.load offset=1048 + get_local 3 + i32.sub + i32.ge_u + br_if 0 (;@23;) + get_local 9 + get_local 3 + i32.add + tee_local 8 + get_local 9 + i32.le_u + br_if 0 (;@23;) + get_local 9 + i32.load offset=24 + set_local 10 + get_local 9 + i32.load offset=12 + tee_local 6 + get_local 9 + i32.eq + br_if 1 (;@22;) + get_local 9 + i32.load offset=8 + tee_local 0 + get_local 6 + i32.store offset=12 + get_local 6 + get_local 0 + i32.store offset=8 + get_local 10 + br_if 20 (;@3;) + br 21 (;@2;) + end + block ;; label = @23 + block ;; label = @24 + block ;; label = @25 + block ;; label = @26 + block ;; label = @27 + block ;; label = @28 + i32.const 0 + i32.load offset=1048 + tee_local 0 + get_local 3 + i32.ge_u + br_if 0 (;@28;) + i32.const 0 + i32.load offset=1052 + tee_local 6 + get_local 3 + i32.le_u + br_if 1 (;@27;) + i32.const 0 + i32.load offset=1064 + tee_local 0 + get_local 3 + i32.add + tee_local 4 + get_local 6 + get_local 3 + i32.sub + tee_local 5 + i32.const 1 + i32.or + i32.store offset=4 + i32.const 0 + get_local 5 + i32.store offset=1052 + i32.const 0 + get_local 4 + i32.store offset=1064 + get_local 0 + get_local 3 + i32.const 3 + i32.or + i32.store offset=4 + get_local 0 + i32.const 8 + i32.add + set_local 0 + br 27 (;@1;) + end + i32.const 0 + i32.load offset=1060 + set_local 4 + get_local 0 + get_local 3 + i32.sub + tee_local 5 + i32.const 16 + i32.lt_u + br_if 1 (;@26;) + get_local 4 + get_local 3 + i32.add + tee_local 6 + get_local 5 + i32.const 1 + i32.or + i32.store offset=4 + i32.const 0 + get_local 5 + i32.store offset=1048 + i32.const 0 + get_local 6 + i32.store offset=1060 + get_local 4 + get_local 0 + i32.add + get_local 5 + i32.store + get_local 4 + get_local 3 + i32.const 3 + i32.or + i32.store offset=4 + br 2 (;@25;) + end + i32.const 0 + i32.load offset=1512 + i32.eqz + br_if 2 (;@24;) + i32.const 0 + i32.load offset=1520 + set_local 4 + br 3 (;@23;) + end + get_local 4 + get_local 0 + i32.const 3 + i32.or + i32.store offset=4 + get_local 4 + get_local 0 + i32.add + tee_local 0 + get_local 0 + i32.load offset=4 + i32.const 1 + i32.or + i32.store offset=4 + i32.const 0 + i32.const 0 + i32.store offset=1060 + i32.const 0 + i32.const 0 + i32.store offset=1048 + end + get_local 4 + i32.const 8 + i32.add + set_local 0 + br 23 (;@1;) + end + i32.const 0 + i64.const -1 + i64.store offset=1524 align=4 + i32.const 0 + i64.const 281474976776192 + i64.store offset=1516 align=4 + i32.const 0 + get_local 1 + i32.const 12 + i32.add + i32.const -16 + i32.and + i32.const 1431655768 + i32.xor + i32.store offset=1512 + i32.const 0 + i32.const 0 + i32.store offset=1532 + i32.const 0 + i32.const 0 + i32.store offset=1484 + i32.const 65536 + set_local 4 + end + i32.const 0 + set_local 0 + block ;; label = @23 + block ;; label = @24 + get_local 4 + get_local 3 + i32.const 47 + i32.add + tee_local 7 + i32.add + tee_local 2 + i32.const 0 + get_local 4 + i32.sub + tee_local 8 + i32.and + tee_local 9 + get_local 3 + i32.le_u + br_if 0 (;@24;) + block ;; label = @25 + i32.const 0 + i32.load offset=1480 + tee_local 0 + i32.eqz + br_if 0 (;@25;) + i32.const 0 + i32.load offset=1472 + tee_local 4 + get_local 9 + i32.add + tee_local 5 + get_local 4 + i32.le_u + br_if 2 (;@23;) + get_local 5 + get_local 0 + i32.gt_u + br_if 2 (;@23;) + end + i32.const 0 + i32.load8_u offset=1484 + i32.const 4 + i32.and + br_if 10 (;@14;) + block ;; label = @25 + i32.const 0 + i32.load offset=1064 + tee_local 4 + i32.eqz + br_if 0 (;@25;) + i32.const 1488 + set_local 0 + loop ;; label = @26 + block ;; label = @27 + get_local 0 + i32.load + tee_local 5 + get_local 4 + i32.gt_u + br_if 0 (;@27;) + get_local 5 + get_local 0 + i32.load offset=4 + i32.add + get_local 4 + i32.gt_u + br_if 6 (;@21;) + end + get_local 0 + i32.load offset=8 + tee_local 0 + br_if 0 (;@26;) + end + end + i32.const 0 + call 25 + tee_local 6 + i32.const -1 + i32.eq + br_if 9 (;@15;) + get_local 9 + set_local 2 + block ;; label = @25 + i32.const 0 + i32.load offset=1516 + tee_local 0 + i32.const -1 + i32.add + tee_local 4 + get_local 6 + i32.and + i32.eqz + br_if 0 (;@25;) + get_local 9 + get_local 6 + i32.sub + get_local 4 + get_local 6 + i32.add + i32.const 0 + get_local 0 + i32.sub + i32.and + i32.add + set_local 2 + end + get_local 2 + get_local 3 + i32.le_u + br_if 9 (;@15;) + get_local 2 + i32.const 2147483646 + i32.gt_u + br_if 9 (;@15;) + block ;; label = @25 + i32.const 0 + i32.load offset=1480 + tee_local 0 + i32.eqz + br_if 0 (;@25;) + i32.const 0 + i32.load offset=1472 + tee_local 4 + get_local 2 + i32.add + tee_local 5 + get_local 4 + i32.le_u + br_if 10 (;@15;) + get_local 5 + get_local 0 + i32.gt_u + br_if 10 (;@15;) + end + get_local 2 + call 25 + tee_local 0 + get_local 6 + i32.ne + br_if 4 (;@20;) + br 11 (;@13;) + end + i32.const 0 + i32.const 48 + i32.store offset=1536 + br 22 (;@1;) + end + i32.const 0 + set_local 0 + i32.const 0 + i32.const 48 + i32.store offset=1536 + br 21 (;@1;) + end + block ;; label = @22 + get_local 9 + i32.const 20 + i32.add + tee_local 4 + i32.load + tee_local 0 + br_if 0 (;@22;) + get_local 9 + i32.load offset=16 + tee_local 0 + i32.eqz + br_if 3 (;@19;) + get_local 9 + i32.const 16 + i32.add + set_local 4 + end + loop ;; label = @22 + get_local 4 + set_local 2 + get_local 0 + tee_local 6 + i32.const 20 + i32.add + tee_local 4 + i32.load + tee_local 0 + br_if 0 (;@22;) + get_local 6 + i32.const 16 + i32.add + set_local 4 + get_local 6 + i32.load offset=16 + tee_local 0 + br_if 0 (;@22;) + end + get_local 2 + i32.const 0 + i32.store + get_local 10 + i32.eqz + br_if 19 (;@2;) + br 18 (;@3;) + end + get_local 2 + get_local 6 + i32.sub + get_local 8 + i32.and + tee_local 2 + i32.const 2147483646 + i32.gt_u + br_if 5 (;@15;) + get_local 2 + call 25 + tee_local 6 + get_local 0 + i32.load + get_local 0 + i32.load offset=4 + i32.add + i32.eq + br_if 3 (;@17;) + get_local 6 + set_local 0 + end + get_local 0 + set_local 6 + get_local 3 + i32.const 48 + i32.add + get_local 2 + i32.le_u + br_if 1 (;@18;) + get_local 2 + i32.const 2147483646 + i32.gt_u + br_if 1 (;@18;) + get_local 6 + i32.const -1 + i32.eq + br_if 1 (;@18;) + get_local 7 + get_local 2 + i32.sub + i32.const 0 + i32.load offset=1520 + tee_local 0 + i32.add + i32.const 0 + get_local 0 + i32.sub + i32.and + tee_local 0 + i32.const 2147483646 + i32.gt_u + br_if 6 (;@13;) + get_local 0 + call 25 + i32.const -1 + i32.eq + br_if 3 (;@16;) + get_local 0 + get_local 2 + i32.add + set_local 2 + br 6 (;@13;) + end + i32.const 0 + set_local 6 + get_local 10 + br_if 15 (;@3;) + br 16 (;@2;) + end + get_local 6 + i32.const -1 + i32.ne + br_if 4 (;@13;) + br 2 (;@15;) + end + get_local 6 + i32.const -1 + i32.ne + br_if 3 (;@13;) + br 1 (;@15;) + end + i32.const 0 + get_local 2 + i32.sub + call 25 + drop + end + i32.const 0 + i32.const 0 + i32.load offset=1484 + i32.const 4 + i32.or + i32.store offset=1484 + end + get_local 9 + i32.const 2147483646 + i32.gt_u + br_if 1 (;@12;) + get_local 9 + call 25 + tee_local 6 + i32.const 0 + call 25 + tee_local 0 + i32.ge_u + br_if 1 (;@12;) + get_local 6 + i32.const -1 + i32.eq + br_if 1 (;@12;) + get_local 0 + i32.const -1 + i32.eq + br_if 1 (;@12;) + get_local 0 + get_local 6 + i32.sub + tee_local 2 + get_local 3 + i32.const 40 + i32.add + i32.le_u + br_if 1 (;@12;) + end + i32.const 0 + i32.const 0 + i32.load offset=1472 + get_local 2 + i32.add + tee_local 0 + i32.store offset=1472 + block ;; label = @13 + get_local 0 + i32.const 0 + i32.load offset=1476 + i32.le_u + br_if 0 (;@13;) + i32.const 0 + get_local 0 + i32.store offset=1476 + end + block ;; label = @13 + block ;; label = @14 + block ;; label = @15 + block ;; label = @16 + i32.const 0 + i32.load offset=1064 + tee_local 4 + i32.eqz + br_if 0 (;@16;) + i32.const 1488 + set_local 0 + loop ;; label = @17 + get_local 6 + get_local 0 + i32.load + tee_local 5 + get_local 0 + i32.load offset=4 + tee_local 9 + i32.add + i32.eq + br_if 2 (;@15;) + get_local 0 + i32.load offset=8 + tee_local 0 + br_if 0 (;@17;) + br 3 (;@14;) + end + end + block ;; label = @16 + block ;; label = @17 + i32.const 0 + i32.load offset=1056 + tee_local 0 + i32.eqz + br_if 0 (;@17;) + get_local 6 + get_local 0 + i32.ge_u + br_if 1 (;@16;) + end + i32.const 0 + get_local 6 + i32.store offset=1056 + end + i32.const 0 + set_local 0 + i32.const 0 + get_local 2 + i32.store offset=1492 + i32.const 0 + get_local 6 + i32.store offset=1488 + i32.const 0 + i32.const -1 + i32.store offset=1072 + i32.const 0 + i32.const 0 + i32.load offset=1512 + i32.store offset=1076 + i32.const 0 + i32.const 0 + i32.store offset=1500 + loop ;; label = @16 + get_local 0 + i32.const 1088 + i32.add + get_local 0 + i32.const 1080 + i32.add + tee_local 4 + i32.store + get_local 0 + i32.const 1092 + i32.add + get_local 4 + i32.store + get_local 0 + i32.const 8 + i32.add + tee_local 0 + i32.const 256 + i32.ne + br_if 0 (;@16;) + end + get_local 6 + i32.const -8 + get_local 6 + i32.sub + i32.const 7 + i32.and + i32.const 0 + get_local 6 + i32.const 8 + i32.add + i32.const 7 + i32.and + select + tee_local 0 + i32.add + tee_local 4 + get_local 2 + i32.const -40 + i32.add + tee_local 5 + get_local 0 + i32.sub + tee_local 0 + i32.const 1 + i32.or + i32.store offset=4 + i32.const 0 + i32.const 0 + i32.load offset=1528 + i32.store offset=1068 + i32.const 0 + get_local 0 + i32.store offset=1052 + i32.const 0 + get_local 4 + i32.store offset=1064 + get_local 6 + get_local 5 + i32.add + i32.const 40 + i32.store offset=4 + br 2 (;@13;) + end + get_local 0 + i32.load8_u offset=12 + i32.const 8 + i32.and + br_if 0 (;@14;) + get_local 6 + get_local 4 + i32.le_u + br_if 0 (;@14;) + get_local 5 + get_local 4 + i32.gt_u + br_if 0 (;@14;) + get_local 4 + i32.const -8 + get_local 4 + i32.sub + i32.const 7 + i32.and + i32.const 0 + get_local 4 + i32.const 8 + i32.add + i32.const 7 + i32.and + select + tee_local 5 + i32.add + tee_local 6 + i32.const 0 + i32.load offset=1052 + get_local 2 + i32.add + tee_local 8 + get_local 5 + i32.sub + tee_local 5 + i32.const 1 + i32.or + i32.store offset=4 + get_local 0 + i32.const 4 + i32.add + get_local 9 + get_local 2 + i32.add + i32.store + i32.const 0 + i32.const 0 + i32.load offset=1528 + i32.store offset=1068 + i32.const 0 + get_local 5 + i32.store offset=1052 + i32.const 0 + get_local 6 + i32.store offset=1064 + get_local 4 + get_local 8 + i32.add + i32.const 40 + i32.store offset=4 + br 1 (;@13;) + end + block ;; label = @14 + get_local 6 + i32.const 0 + i32.load offset=1056 + i32.ge_u + br_if 0 (;@14;) + i32.const 0 + get_local 6 + i32.store offset=1056 + end + get_local 6 + get_local 2 + i32.add + set_local 5 + i32.const 1488 + set_local 0 + block ;; label = @14 + block ;; label = @15 + block ;; label = @16 + block ;; label = @17 + block ;; label = @18 + block ;; label = @19 + block ;; label = @20 + block ;; label = @21 + loop ;; label = @22 + get_local 0 + i32.load + get_local 5 + i32.eq + br_if 1 (;@21;) + get_local 0 + i32.load offset=8 + tee_local 0 + br_if 0 (;@22;) + br 2 (;@20;) + end + end + get_local 0 + i32.load8_u offset=12 + i32.const 8 + i32.and + br_if 0 (;@20;) + get_local 0 + get_local 6 + i32.store + get_local 0 + get_local 0 + i32.load offset=4 + get_local 2 + i32.add + i32.store offset=4 + get_local 6 + i32.const -8 + get_local 6 + i32.sub + i32.const 7 + i32.and + i32.const 0 + get_local 6 + i32.const 8 + i32.add + i32.const 7 + i32.and + select + i32.add + tee_local 2 + get_local 3 + i32.const 3 + i32.or + i32.store offset=4 + get_local 5 + i32.const -8 + get_local 5 + i32.sub + i32.const 7 + i32.and + i32.const 0 + get_local 5 + i32.const 8 + i32.add + i32.const 7 + i32.and + select + i32.add + tee_local 6 + get_local 2 + i32.sub + get_local 3 + i32.sub + set_local 0 + get_local 2 + get_local 3 + i32.add + set_local 5 + get_local 4 + get_local 6 + i32.eq + br_if 1 (;@19;) + i32.const 0 + i32.load offset=1060 + get_local 6 + i32.eq + br_if 9 (;@11;) + get_local 6 + i32.load offset=4 + tee_local 4 + i32.const 3 + i32.and + i32.const 1 + i32.ne + br_if 15 (;@5;) + get_local 4 + i32.const -8 + i32.and + set_local 7 + get_local 4 + i32.const 255 + i32.gt_u + br_if 10 (;@10;) + get_local 6 + i32.load offset=12 + tee_local 3 + get_local 6 + i32.load offset=8 + tee_local 9 + i32.eq + br_if 11 (;@9;) + get_local 3 + get_local 9 + i32.store offset=8 + get_local 9 + get_local 3 + i32.store offset=12 + br 14 (;@6;) + end + i32.const 1488 + set_local 0 + block ;; label = @20 + loop ;; label = @21 + block ;; label = @22 + get_local 0 + i32.load + tee_local 5 + get_local 4 + i32.gt_u + br_if 0 (;@22;) + get_local 5 + get_local 0 + i32.load offset=4 + i32.add + tee_local 5 + get_local 4 + i32.gt_u + br_if 2 (;@20;) + end + get_local 0 + i32.load offset=8 + set_local 0 + br 0 (;@21;) + end + end + get_local 6 + i32.const -8 + get_local 6 + i32.sub + i32.const 7 + i32.and + i32.const 0 + get_local 6 + i32.const 8 + i32.add + i32.const 7 + i32.and + select + tee_local 0 + i32.add + tee_local 8 + get_local 2 + i32.const -40 + i32.add + tee_local 9 + get_local 0 + i32.sub + tee_local 0 + i32.const 1 + i32.or + i32.store offset=4 + get_local 6 + get_local 9 + i32.add + i32.const 40 + i32.store offset=4 + get_local 4 + get_local 5 + i32.const 39 + get_local 5 + i32.sub + i32.const 7 + i32.and + i32.const 0 + get_local 5 + i32.const -39 + i32.add + i32.const 7 + i32.and + select + i32.add + i32.const -47 + i32.add + tee_local 9 + get_local 9 + get_local 4 + i32.const 16 + i32.add + i32.lt_u + select + tee_local 9 + i32.const 27 + i32.store offset=4 + i32.const 0 + i32.const 0 + i32.load offset=1528 + i32.store offset=1068 + i32.const 0 + get_local 0 + i32.store offset=1052 + i32.const 0 + get_local 8 + i32.store offset=1064 + get_local 9 + i32.const 16 + i32.add + i32.const 0 + i64.load offset=1496 align=4 + i64.store align=4 + get_local 9 + i32.const 0 + i64.load offset=1488 align=4 + i64.store offset=8 align=4 + i32.const 0 + get_local 2 + i32.store offset=1492 + i32.const 0 + get_local 6 + i32.store offset=1488 + i32.const 0 + get_local 9 + i32.const 8 + i32.add + i32.store offset=1496 + i32.const 0 + i32.const 0 + i32.store offset=1500 + get_local 9 + i32.const 28 + i32.add + set_local 0 + loop ;; label = @20 + get_local 0 + i32.const 7 + i32.store + get_local 0 + i32.const 4 + i32.add + tee_local 0 + get_local 5 + i32.lt_u + br_if 0 (;@20;) + end + get_local 9 + get_local 4 + i32.eq + br_if 6 (;@13;) + get_local 9 + i32.const 4 + i32.add + tee_local 0 + get_local 0 + i32.load + i32.const -2 + i32.and + i32.store + get_local 9 + get_local 9 + get_local 4 + i32.sub + tee_local 2 + i32.store + get_local 4 + get_local 2 + i32.const 1 + i32.or + i32.store offset=4 + block ;; label = @20 + get_local 2 + i32.const 255 + i32.gt_u + br_if 0 (;@20;) + get_local 2 + i32.const 3 + i32.shr_u + tee_local 5 + i32.const 3 + i32.shl + i32.const 1080 + i32.add + set_local 0 + i32.const 0 + i32.load offset=1040 + tee_local 6 + i32.const 1 + get_local 5 + i32.shl + tee_local 5 + i32.and + i32.eqz + br_if 2 (;@18;) + get_local 0 + i32.load offset=8 + set_local 5 + br 3 (;@17;) + end + i32.const 0 + set_local 0 + block ;; label = @20 + get_local 2 + i32.const 8 + i32.shr_u + tee_local 5 + i32.eqz + br_if 0 (;@20;) + i32.const 31 + set_local 0 + get_local 2 + i32.const 16777215 + i32.gt_u + br_if 0 (;@20;) + get_local 2 + i32.const 14 + get_local 5 + get_local 5 + i32.const 1048320 + i32.add + i32.const 16 + i32.shr_u + i32.const 8 + i32.and + tee_local 0 + i32.shl + tee_local 5 + i32.const 520192 + i32.add + i32.const 16 + i32.shr_u + i32.const 4 + i32.and + tee_local 6 + get_local 0 + i32.or + get_local 5 + get_local 6 + i32.shl + tee_local 0 + i32.const 245760 + i32.add + i32.const 16 + i32.shr_u + i32.const 2 + i32.and + tee_local 5 + i32.or + i32.sub + get_local 0 + get_local 5 + i32.shl + i32.const 15 + i32.shr_u + i32.add + tee_local 0 + i32.const 7 + i32.add + i32.shr_u + i32.const 1 + i32.and + get_local 0 + i32.const 1 + i32.shl + i32.or + set_local 0 + end + get_local 4 + i64.const 0 + i64.store offset=16 align=4 + get_local 4 + i32.const 28 + i32.add + get_local 0 + i32.store + get_local 0 + i32.const 2 + i32.shl + i32.const 1344 + i32.add + set_local 5 + i32.const 0 + i32.load offset=1044 + tee_local 6 + i32.const 1 + get_local 0 + i32.shl + tee_local 9 + i32.and + i32.eqz + br_if 3 (;@16;) + get_local 2 + i32.const 0 + i32.const 25 + get_local 0 + i32.const 1 + i32.shr_u + i32.sub + get_local 0 + i32.const 31 + i32.eq + select + i32.shl + set_local 0 + get_local 5 + i32.load + set_local 6 + loop ;; label = @20 + get_local 6 + tee_local 5 + i32.load offset=4 + i32.const -8 + i32.and + get_local 2 + i32.eq + br_if 6 (;@14;) + get_local 0 + i32.const 29 + i32.shr_u + set_local 6 + get_local 0 + i32.const 1 + i32.shl + set_local 0 + get_local 5 + get_local 6 + i32.const 4 + i32.and + i32.add + i32.const 16 + i32.add + tee_local 9 + i32.load + tee_local 6 + br_if 0 (;@20;) + end + get_local 9 + get_local 4 + i32.store + get_local 4 + i32.const 24 + i32.add + get_local 5 + i32.store + br 4 (;@15;) + end + i32.const 0 + get_local 5 + i32.store offset=1064 + i32.const 0 + i32.const 0 + i32.load offset=1052 + get_local 0 + i32.add + tee_local 0 + i32.store offset=1052 + get_local 5 + get_local 0 + i32.const 1 + i32.or + i32.store offset=4 + br 14 (;@4;) + end + i32.const 0 + get_local 6 + get_local 5 + i32.or + i32.store offset=1040 + get_local 0 + set_local 5 + end + get_local 5 + get_local 4 + i32.store offset=12 + get_local 0 + get_local 4 + i32.store offset=8 + get_local 4 + get_local 0 + i32.store offset=12 + get_local 4 + get_local 5 + i32.store offset=8 + br 3 (;@13;) + end + get_local 5 + get_local 4 + i32.store + i32.const 0 + get_local 6 + get_local 9 + i32.or + i32.store offset=1044 + get_local 4 + i32.const 24 + i32.add + get_local 5 + i32.store + end + get_local 4 + get_local 4 + i32.store offset=12 + get_local 4 + get_local 4 + i32.store offset=8 + br 1 (;@13;) + end + get_local 5 + i32.load offset=8 + tee_local 0 + get_local 4 + i32.store offset=12 + get_local 5 + get_local 4 + i32.store offset=8 + get_local 4 + i32.const 24 + i32.add + i32.const 0 + i32.store + get_local 4 + get_local 5 + i32.store offset=12 + get_local 4 + get_local 0 + i32.store offset=8 + end + i32.const 0 + i32.load offset=1052 + tee_local 0 + get_local 3 + i32.le_u + br_if 0 (;@12;) + i32.const 0 + i32.load offset=1064 + tee_local 4 + get_local 3 + i32.add + tee_local 5 + get_local 0 + get_local 3 + i32.sub + tee_local 0 + i32.const 1 + i32.or + i32.store offset=4 + i32.const 0 + get_local 0 + i32.store offset=1052 + i32.const 0 + get_local 5 + i32.store offset=1064 + get_local 4 + get_local 3 + i32.const 3 + i32.or + i32.store offset=4 + get_local 4 + i32.const 8 + i32.add + set_local 0 + br 11 (;@1;) + end + i32.const 0 + set_local 0 + i32.const 0 + i32.const 48 + i32.store offset=1536 + br 10 (;@1;) + end + i32.const 0 + get_local 5 + i32.store offset=1060 + i32.const 0 + i32.const 0 + i32.load offset=1048 + get_local 0 + i32.add + tee_local 0 + i32.store offset=1048 + get_local 5 + get_local 0 + i32.const 1 + i32.or + i32.store offset=4 + get_local 5 + get_local 0 + i32.add + get_local 0 + i32.store + br 6 (;@4;) + end + get_local 6 + i32.load offset=24 + set_local 10 + get_local 6 + i32.load offset=12 + tee_local 9 + get_local 6 + i32.eq + br_if 1 (;@8;) + get_local 6 + i32.load offset=8 + tee_local 4 + get_local 9 + i32.store offset=12 + get_local 9 + get_local 4 + i32.store offset=8 + get_local 10 + br_if 2 (;@7;) + br 3 (;@6;) + end + i32.const 0 + i32.const 0 + i32.load offset=1040 + i32.const -2 + get_local 4 + i32.const 3 + i32.shr_u + i32.rotl + i32.and + i32.store offset=1040 + br 2 (;@6;) + end + block ;; label = @8 + block ;; label = @9 + get_local 6 + i32.const 20 + i32.add + tee_local 4 + i32.load + tee_local 3 + br_if 0 (;@9;) + get_local 6 + i32.const 16 + i32.add + tee_local 4 + i32.load + tee_local 3 + i32.eqz + br_if 1 (;@8;) + end + loop ;; label = @9 + get_local 4 + set_local 8 + get_local 3 + tee_local 9 + i32.const 20 + i32.add + tee_local 4 + i32.load + tee_local 3 + br_if 0 (;@9;) + get_local 9 + i32.const 16 + i32.add + set_local 4 + get_local 9 + i32.load offset=16 + tee_local 3 + br_if 0 (;@9;) + end + get_local 8 + i32.const 0 + i32.store + get_local 10 + i32.eqz + br_if 2 (;@6;) + br 1 (;@7;) + end + i32.const 0 + set_local 9 + get_local 10 + i32.eqz + br_if 1 (;@6;) + end + block ;; label = @7 + block ;; label = @8 + block ;; label = @9 + get_local 6 + i32.load offset=28 + tee_local 3 + i32.const 2 + i32.shl + i32.const 1344 + i32.add + tee_local 4 + i32.load + get_local 6 + i32.eq + br_if 0 (;@9;) + get_local 10 + i32.const 16 + i32.const 20 + get_local 10 + i32.load offset=16 + get_local 6 + i32.eq + select + i32.add + get_local 9 + i32.store + get_local 9 + br_if 1 (;@8;) + br 3 (;@6;) + end + get_local 4 + get_local 9 + i32.store + get_local 9 + i32.eqz + br_if 1 (;@7;) + end + get_local 9 + get_local 10 + i32.store offset=24 + block ;; label = @8 + get_local 6 + i32.load offset=16 + tee_local 4 + i32.eqz + br_if 0 (;@8;) + get_local 9 + get_local 4 + i32.store offset=16 + get_local 4 + get_local 9 + i32.store offset=24 + end + get_local 6 + i32.const 20 + i32.add + i32.load + tee_local 4 + i32.eqz + br_if 1 (;@6;) + get_local 9 + i32.const 20 + i32.add + get_local 4 + i32.store + get_local 4 + get_local 9 + i32.store offset=24 + br 1 (;@6;) + end + i32.const 0 + i32.const 0 + i32.load offset=1044 + i32.const -2 + get_local 3 + i32.rotl + i32.and + i32.store offset=1044 + end + get_local 7 + get_local 0 + i32.add + set_local 0 + get_local 6 + get_local 7 + i32.add + set_local 6 + end + get_local 6 + get_local 6 + i32.load offset=4 + i32.const -2 + i32.and + i32.store offset=4 + get_local 5 + get_local 0 + i32.add + get_local 0 + i32.store + get_local 5 + get_local 0 + i32.const 1 + i32.or + i32.store offset=4 + block ;; label = @5 + block ;; label = @6 + block ;; label = @7 + block ;; label = @8 + block ;; label = @9 + block ;; label = @10 + get_local 0 + i32.const 255 + i32.gt_u + br_if 0 (;@10;) + get_local 0 + i32.const 3 + i32.shr_u + tee_local 4 + i32.const 3 + i32.shl + i32.const 1080 + i32.add + set_local 0 + i32.const 0 + i32.load offset=1040 + tee_local 3 + i32.const 1 + get_local 4 + i32.shl + tee_local 4 + i32.and + i32.eqz + br_if 1 (;@9;) + get_local 0 + i32.load offset=8 + set_local 4 + br 2 (;@8;) + end + i32.const 0 + set_local 4 + block ;; label = @10 + get_local 0 + i32.const 8 + i32.shr_u + tee_local 3 + i32.eqz + br_if 0 (;@10;) + i32.const 31 + set_local 4 + get_local 0 + i32.const 16777215 + i32.gt_u + br_if 0 (;@10;) + get_local 0 + i32.const 14 + get_local 3 + get_local 3 + i32.const 1048320 + i32.add + i32.const 16 + i32.shr_u + i32.const 8 + i32.and + tee_local 4 + i32.shl + tee_local 3 + i32.const 520192 + i32.add + i32.const 16 + i32.shr_u + i32.const 4 + i32.and + tee_local 6 + get_local 4 + i32.or + get_local 3 + get_local 6 + i32.shl + tee_local 4 + i32.const 245760 + i32.add + i32.const 16 + i32.shr_u + i32.const 2 + i32.and + tee_local 3 + i32.or + i32.sub + get_local 4 + get_local 3 + i32.shl + i32.const 15 + i32.shr_u + i32.add + tee_local 4 + i32.const 7 + i32.add + i32.shr_u + i32.const 1 + i32.and + get_local 4 + i32.const 1 + i32.shl + i32.or + set_local 4 + end + get_local 5 + get_local 4 + i32.store offset=28 + get_local 5 + i64.const 0 + i64.store offset=16 align=4 + get_local 4 + i32.const 2 + i32.shl + i32.const 1344 + i32.add + set_local 3 + i32.const 0 + i32.load offset=1044 + tee_local 6 + i32.const 1 + get_local 4 + i32.shl + tee_local 9 + i32.and + i32.eqz + br_if 2 (;@7;) + get_local 0 + i32.const 0 + i32.const 25 + get_local 4 + i32.const 1 + i32.shr_u + i32.sub + get_local 4 + i32.const 31 + i32.eq + select + i32.shl + set_local 4 + get_local 3 + i32.load + set_local 6 + loop ;; label = @10 + get_local 6 + tee_local 3 + i32.load offset=4 + i32.const -8 + i32.and + get_local 0 + i32.eq + br_if 5 (;@5;) + get_local 4 + i32.const 29 + i32.shr_u + set_local 6 + get_local 4 + i32.const 1 + i32.shl + set_local 4 + get_local 3 + get_local 6 + i32.const 4 + i32.and + i32.add + i32.const 16 + i32.add + tee_local 9 + i32.load + tee_local 6 + br_if 0 (;@10;) + end + get_local 9 + get_local 5 + i32.store + get_local 5 + get_local 3 + i32.store offset=24 + br 3 (;@6;) + end + i32.const 0 + get_local 3 + get_local 4 + i32.or + i32.store offset=1040 + get_local 0 + set_local 4 + end + get_local 4 + get_local 5 + i32.store offset=12 + get_local 0 + get_local 5 + i32.store offset=8 + get_local 5 + get_local 0 + i32.store offset=12 + get_local 5 + get_local 4 + i32.store offset=8 + br 3 (;@4;) + end + get_local 3 + get_local 5 + i32.store + i32.const 0 + get_local 6 + get_local 9 + i32.or + i32.store offset=1044 + get_local 5 + get_local 3 + i32.store offset=24 + end + get_local 5 + get_local 5 + i32.store offset=12 + get_local 5 + get_local 5 + i32.store offset=8 + br 1 (;@4;) + end + get_local 3 + i32.load offset=8 + tee_local 0 + get_local 5 + i32.store offset=12 + get_local 3 + get_local 5 + i32.store offset=8 + get_local 5 + i32.const 0 + i32.store offset=24 + get_local 5 + get_local 3 + i32.store offset=12 + get_local 5 + get_local 0 + i32.store offset=8 + end + get_local 2 + i32.const 8 + i32.add + set_local 0 + br 2 (;@1;) + end + block ;; label = @3 + block ;; label = @4 + block ;; label = @5 + get_local 9 + get_local 9 + i32.load offset=28 + tee_local 4 + i32.const 2 + i32.shl + i32.const 1344 + i32.add + tee_local 0 + i32.load + i32.eq + br_if 0 (;@5;) + get_local 10 + i32.const 16 + i32.const 20 + get_local 10 + i32.load offset=16 + get_local 9 + i32.eq + select + i32.add + get_local 6 + i32.store + get_local 6 + br_if 1 (;@4;) + br 3 (;@2;) + end + get_local 0 + get_local 6 + i32.store + get_local 6 + i32.eqz + br_if 1 (;@3;) + end + get_local 6 + get_local 10 + i32.store offset=24 + block ;; label = @4 + get_local 9 + i32.load offset=16 + tee_local 0 + i32.eqz + br_if 0 (;@4;) + get_local 6 + get_local 0 + i32.store offset=16 + get_local 0 + get_local 6 + i32.store offset=24 + end + get_local 9 + i32.const 20 + i32.add + i32.load + tee_local 0 + i32.eqz + br_if 1 (;@2;) + get_local 6 + i32.const 20 + i32.add + get_local 0 + i32.store + get_local 0 + get_local 6 + i32.store offset=24 + br 1 (;@2;) + end + i32.const 0 + get_local 7 + i32.const -2 + get_local 4 + i32.rotl + i32.and + tee_local 7 + i32.store offset=1044 + end + block ;; label = @2 + block ;; label = @3 + get_local 5 + i32.const 15 + i32.gt_u + br_if 0 (;@3;) + get_local 9 + get_local 5 + get_local 3 + i32.add + tee_local 0 + i32.const 3 + i32.or + i32.store offset=4 + get_local 9 + get_local 0 + i32.add + tee_local 0 + get_local 0 + i32.load offset=4 + i32.const 1 + i32.or + i32.store offset=4 + br 1 (;@2;) + end + get_local 8 + get_local 5 + i32.const 1 + i32.or + i32.store offset=4 + get_local 9 + get_local 3 + i32.const 3 + i32.or + i32.store offset=4 + get_local 8 + get_local 5 + i32.add + get_local 5 + i32.store + block ;; label = @3 + block ;; label = @4 + block ;; label = @5 + block ;; label = @6 + block ;; label = @7 + get_local 5 + i32.const 255 + i32.gt_u + br_if 0 (;@7;) + get_local 5 + i32.const 3 + i32.shr_u + tee_local 4 + i32.const 3 + i32.shl + i32.const 1080 + i32.add + set_local 0 + i32.const 0 + i32.load offset=1040 + tee_local 5 + i32.const 1 + get_local 4 + i32.shl + tee_local 4 + i32.and + i32.eqz + br_if 1 (;@6;) + get_local 0 + i32.load offset=8 + set_local 4 + br 2 (;@5;) + end + get_local 5 + i32.const 8 + i32.shr_u + tee_local 4 + i32.eqz + br_if 2 (;@4;) + i32.const 31 + set_local 0 + get_local 5 + i32.const 16777215 + i32.gt_u + br_if 3 (;@3;) + get_local 5 + i32.const 14 + get_local 4 + get_local 4 + i32.const 1048320 + i32.add + i32.const 16 + i32.shr_u + i32.const 8 + i32.and + tee_local 0 + i32.shl + tee_local 4 + i32.const 520192 + i32.add + i32.const 16 + i32.shr_u + i32.const 4 + i32.and + tee_local 3 + get_local 0 + i32.or + get_local 4 + get_local 3 + i32.shl + tee_local 0 + i32.const 245760 + i32.add + i32.const 16 + i32.shr_u + i32.const 2 + i32.and + tee_local 4 + i32.or + i32.sub + get_local 0 + get_local 4 + i32.shl + i32.const 15 + i32.shr_u + i32.add + tee_local 0 + i32.const 7 + i32.add + i32.shr_u + i32.const 1 + i32.and + get_local 0 + i32.const 1 + i32.shl + i32.or + set_local 0 + br 3 (;@3;) + end + i32.const 0 + get_local 5 + get_local 4 + i32.or + i32.store offset=1040 + get_local 0 + set_local 4 + end + get_local 4 + get_local 8 + i32.store offset=12 + get_local 0 + get_local 8 + i32.store offset=8 + get_local 8 + get_local 0 + i32.store offset=12 + get_local 8 + get_local 4 + i32.store offset=8 + br 2 (;@2;) + end + i32.const 0 + set_local 0 + end + get_local 8 + get_local 0 + i32.store offset=28 + get_local 8 + i64.const 0 + i64.store offset=16 align=4 + get_local 0 + i32.const 2 + i32.shl + i32.const 1344 + i32.add + set_local 4 + block ;; label = @3 + block ;; label = @4 + block ;; label = @5 + get_local 7 + i32.const 1 + get_local 0 + i32.shl + tee_local 3 + i32.and + i32.eqz + br_if 0 (;@5;) + get_local 5 + i32.const 0 + i32.const 25 + get_local 0 + i32.const 1 + i32.shr_u + i32.sub + get_local 0 + i32.const 31 + i32.eq + select + i32.shl + set_local 0 + get_local 4 + i32.load + set_local 3 + loop ;; label = @6 + get_local 3 + tee_local 4 + i32.load offset=4 + i32.const -8 + i32.and + get_local 5 + i32.eq + br_if 3 (;@3;) + get_local 0 + i32.const 29 + i32.shr_u + set_local 3 + get_local 0 + i32.const 1 + i32.shl + set_local 0 + get_local 4 + get_local 3 + i32.const 4 + i32.and + i32.add + i32.const 16 + i32.add + tee_local 6 + i32.load + tee_local 3 + br_if 0 (;@6;) + end + get_local 6 + get_local 8 + i32.store + get_local 8 + get_local 4 + i32.store offset=24 + br 1 (;@4;) + end + get_local 4 + get_local 8 + i32.store + i32.const 0 + get_local 7 + get_local 3 + i32.or + i32.store offset=1044 + get_local 8 + get_local 4 + i32.store offset=24 + end + get_local 8 + get_local 8 + i32.store offset=12 + get_local 8 + get_local 8 + i32.store offset=8 + br 1 (;@2;) + end + get_local 4 + i32.load offset=8 + tee_local 0 + get_local 8 + i32.store offset=12 + get_local 4 + get_local 8 + i32.store offset=8 + get_local 8 + i32.const 0 + i32.store offset=24 + get_local 8 + get_local 4 + i32.store offset=12 + get_local 8 + get_local 0 + i32.store offset=8 + end + get_local 9 + i32.const 8 + i32.add + set_local 0 + end + get_local 1 + i32.const 16 + i32.add + set_global 0 + get_local 0) + (func (;16;) (type 3) (param i32) + get_local 0 + call 17) + (func (;17;) (type 3) (param i32) + (local i32 i32 i32 i32 i32 i32 i32) + block ;; label = @1 + block ;; label = @2 + get_local 0 + i32.eqz + br_if 0 (;@2;) + get_local 0 + i32.const -8 + i32.add + tee_local 1 + get_local 0 + i32.const -4 + i32.add + i32.load + tee_local 2 + i32.const -8 + i32.and + tee_local 0 + i32.add + set_local 3 + block ;; label = @3 + block ;; label = @4 + get_local 2 + i32.const 1 + i32.and + br_if 0 (;@4;) + get_local 2 + i32.const 3 + i32.and + i32.eqz + br_if 2 (;@2;) + get_local 1 + get_local 1 + i32.load + tee_local 2 + i32.sub + tee_local 1 + i32.const 0 + i32.load offset=1056 + i32.lt_u + br_if 2 (;@2;) + get_local 2 + get_local 0 + i32.add + set_local 0 + block ;; label = @5 + block ;; label = @6 + block ;; label = @7 + block ;; label = @8 + block ;; label = @9 + i32.const 0 + i32.load offset=1060 + get_local 1 + i32.eq + br_if 0 (;@9;) + get_local 2 + i32.const 255 + i32.gt_u + br_if 1 (;@8;) + get_local 1 + i32.load offset=12 + tee_local 4 + get_local 1 + i32.load offset=8 + tee_local 5 + i32.eq + br_if 2 (;@7;) + get_local 4 + get_local 5 + i32.store offset=8 + get_local 5 + get_local 4 + i32.store offset=12 + get_local 1 + get_local 3 + i32.lt_u + br_if 6 (;@3;) + br 7 (;@2;) + end + get_local 3 + i32.load offset=4 + tee_local 2 + i32.const 3 + i32.and + i32.const 3 + i32.ne + br_if 4 (;@4;) + get_local 3 + i32.const 4 + i32.add + get_local 2 + i32.const -2 + i32.and + i32.store + i32.const 0 + get_local 0 + i32.store offset=1048 + get_local 1 + get_local 0 + i32.add + get_local 0 + i32.store + get_local 1 + get_local 0 + i32.const 1 + i32.or + i32.store offset=4 + return + end + get_local 1 + i32.load offset=24 + set_local 6 + get_local 1 + i32.load offset=12 + tee_local 5 + get_local 1 + i32.eq + br_if 1 (;@6;) + get_local 1 + i32.load offset=8 + tee_local 2 + get_local 5 + i32.store offset=12 + get_local 5 + get_local 2 + i32.store offset=8 + get_local 6 + br_if 2 (;@5;) + br 3 (;@4;) + end + i32.const 0 + i32.const 0 + i32.load offset=1040 + i32.const -2 + get_local 2 + i32.const 3 + i32.shr_u + i32.rotl + i32.and + i32.store offset=1040 + get_local 1 + get_local 3 + i32.lt_u + br_if 3 (;@3;) + br 4 (;@2;) + end + block ;; label = @6 + block ;; label = @7 + get_local 1 + i32.const 20 + i32.add + tee_local 2 + i32.load + tee_local 4 + br_if 0 (;@7;) + get_local 1 + i32.const 16 + i32.add + tee_local 2 + i32.load + tee_local 4 + i32.eqz + br_if 1 (;@6;) + end + loop ;; label = @7 + get_local 2 + set_local 7 + get_local 4 + tee_local 5 + i32.const 20 + i32.add + tee_local 2 + i32.load + tee_local 4 + br_if 0 (;@7;) + get_local 5 + i32.const 16 + i32.add + set_local 2 + get_local 5 + i32.load offset=16 + tee_local 4 + br_if 0 (;@7;) + end + get_local 7 + i32.const 0 + i32.store + get_local 6 + i32.eqz + br_if 2 (;@4;) + br 1 (;@5;) + end + i32.const 0 + set_local 5 + get_local 6 + i32.eqz + br_if 1 (;@4;) + end + block ;; label = @5 + block ;; label = @6 + block ;; label = @7 + get_local 1 + i32.load offset=28 + tee_local 4 + i32.const 2 + i32.shl + i32.const 1344 + i32.add + tee_local 2 + i32.load + get_local 1 + i32.eq + br_if 0 (;@7;) + get_local 6 + i32.const 16 + i32.const 20 + get_local 6 + i32.load offset=16 + get_local 1 + i32.eq + select + i32.add + get_local 5 + i32.store + get_local 5 + br_if 1 (;@6;) + br 3 (;@4;) + end + get_local 2 + get_local 5 + i32.store + get_local 5 + i32.eqz + br_if 1 (;@5;) + end + get_local 5 + get_local 6 + i32.store offset=24 + block ;; label = @6 + get_local 1 + i32.load offset=16 + tee_local 2 + i32.eqz + br_if 0 (;@6;) + get_local 5 + get_local 2 + i32.store offset=16 + get_local 2 + get_local 5 + i32.store offset=24 + end + get_local 1 + i32.const 20 + i32.add + i32.load + tee_local 2 + i32.eqz + br_if 1 (;@4;) + get_local 5 + i32.const 20 + i32.add + get_local 2 + i32.store + get_local 2 + get_local 5 + i32.store offset=24 + get_local 1 + get_local 3 + i32.lt_u + br_if 2 (;@3;) + br 3 (;@2;) + end + i32.const 0 + i32.const 0 + i32.load offset=1044 + i32.const -2 + get_local 4 + i32.rotl + i32.and + i32.store offset=1044 + end + get_local 1 + get_local 3 + i32.ge_u + br_if 1 (;@2;) + end + get_local 3 + i32.load offset=4 + tee_local 2 + i32.const 1 + i32.and + i32.eqz + br_if 0 (;@2;) + block ;; label = @3 + block ;; label = @4 + block ;; label = @5 + block ;; label = @6 + block ;; label = @7 + block ;; label = @8 + block ;; label = @9 + block ;; label = @10 + block ;; label = @11 + get_local 2 + i32.const 2 + i32.and + br_if 0 (;@11;) + i32.const 0 + i32.load offset=1064 + get_local 3 + i32.eq + br_if 1 (;@10;) + i32.const 0 + i32.load offset=1060 + get_local 3 + i32.eq + br_if 2 (;@9;) + get_local 2 + i32.const -8 + i32.and + get_local 0 + i32.add + set_local 0 + get_local 2 + i32.const 255 + i32.gt_u + br_if 3 (;@8;) + get_local 3 + i32.load offset=12 + tee_local 4 + get_local 3 + i32.load offset=8 + tee_local 5 + i32.eq + br_if 4 (;@7;) + get_local 4 + get_local 5 + i32.store offset=8 + get_local 5 + get_local 4 + i32.store offset=12 + br 7 (;@4;) + end + get_local 3 + i32.const 4 + i32.add + get_local 2 + i32.const -2 + i32.and + i32.store + get_local 1 + get_local 0 + i32.add + get_local 0 + i32.store + get_local 1 + get_local 0 + i32.const 1 + i32.or + i32.store offset=4 + br 7 (;@3;) + end + i32.const 0 + get_local 1 + i32.store offset=1064 + i32.const 0 + i32.const 0 + i32.load offset=1052 + get_local 0 + i32.add + tee_local 0 + i32.store offset=1052 + get_local 1 + get_local 0 + i32.const 1 + i32.or + i32.store offset=4 + get_local 1 + i32.const 0 + i32.load offset=1060 + i32.ne + br_if 7 (;@2;) + i32.const 0 + i32.const 0 + i32.store offset=1048 + i32.const 0 + i32.const 0 + i32.store offset=1060 + return + end + i32.const 0 + get_local 1 + i32.store offset=1060 + i32.const 0 + i32.const 0 + i32.load offset=1048 + get_local 0 + i32.add + tee_local 0 + i32.store offset=1048 + get_local 1 + get_local 0 + i32.const 1 + i32.or + i32.store offset=4 + get_local 1 + get_local 0 + i32.add + get_local 0 + i32.store + return + end + get_local 3 + i32.load offset=24 + set_local 6 + get_local 3 + i32.load offset=12 + tee_local 5 + get_local 3 + i32.eq + br_if 1 (;@6;) + get_local 3 + i32.load offset=8 + tee_local 2 + get_local 5 + i32.store offset=12 + get_local 5 + get_local 2 + i32.store offset=8 + get_local 6 + br_if 2 (;@5;) + br 3 (;@4;) + end + i32.const 0 + i32.const 0 + i32.load offset=1040 + i32.const -2 + get_local 2 + i32.const 3 + i32.shr_u + i32.rotl + i32.and + i32.store offset=1040 + br 2 (;@4;) + end + block ;; label = @6 + block ;; label = @7 + get_local 3 + i32.const 20 + i32.add + tee_local 2 + i32.load + tee_local 4 + br_if 0 (;@7;) + get_local 3 + i32.const 16 + i32.add + tee_local 2 + i32.load + tee_local 4 + i32.eqz + br_if 1 (;@6;) + end + loop ;; label = @7 + get_local 2 + set_local 7 + get_local 4 + tee_local 5 + i32.const 20 + i32.add + tee_local 2 + i32.load + tee_local 4 + br_if 0 (;@7;) + get_local 5 + i32.const 16 + i32.add + set_local 2 + get_local 5 + i32.load offset=16 + tee_local 4 + br_if 0 (;@7;) + end + get_local 7 + i32.const 0 + i32.store + get_local 6 + i32.eqz + br_if 2 (;@4;) + br 1 (;@5;) + end + i32.const 0 + set_local 5 + get_local 6 + i32.eqz + br_if 1 (;@4;) + end + block ;; label = @5 + block ;; label = @6 + block ;; label = @7 + get_local 3 + i32.load offset=28 + tee_local 4 + i32.const 2 + i32.shl + i32.const 1344 + i32.add + tee_local 2 + i32.load + get_local 3 + i32.eq + br_if 0 (;@7;) + get_local 6 + i32.const 16 + i32.const 20 + get_local 6 + i32.load offset=16 + get_local 3 + i32.eq + select + i32.add + get_local 5 + i32.store + get_local 5 + br_if 1 (;@6;) + br 3 (;@4;) + end + get_local 2 + get_local 5 + i32.store + get_local 5 + i32.eqz + br_if 1 (;@5;) + end + get_local 5 + get_local 6 + i32.store offset=24 + block ;; label = @6 + get_local 3 + i32.load offset=16 + tee_local 2 + i32.eqz + br_if 0 (;@6;) + get_local 5 + get_local 2 + i32.store offset=16 + get_local 2 + get_local 5 + i32.store offset=24 + end + get_local 3 + i32.const 20 + i32.add + i32.load + tee_local 2 + i32.eqz + br_if 1 (;@4;) + get_local 5 + i32.const 20 + i32.add + get_local 2 + i32.store + get_local 2 + get_local 5 + i32.store offset=24 + br 1 (;@4;) + end + i32.const 0 + i32.const 0 + i32.load offset=1044 + i32.const -2 + get_local 4 + i32.rotl + i32.and + i32.store offset=1044 + end + get_local 1 + get_local 0 + i32.add + get_local 0 + i32.store + get_local 1 + get_local 0 + i32.const 1 + i32.or + i32.store offset=4 + get_local 1 + i32.const 0 + i32.load offset=1060 + i32.ne + br_if 0 (;@3;) + i32.const 0 + get_local 0 + i32.store offset=1048 + return + end + block ;; label = @3 + block ;; label = @4 + block ;; label = @5 + block ;; label = @6 + block ;; label = @7 + block ;; label = @8 + block ;; label = @9 + get_local 0 + i32.const 255 + i32.gt_u + br_if 0 (;@9;) + get_local 0 + i32.const 3 + i32.shr_u + tee_local 2 + i32.const 3 + i32.shl + i32.const 1080 + i32.add + set_local 0 + i32.const 0 + i32.load offset=1040 + tee_local 4 + i32.const 1 + get_local 2 + i32.shl + tee_local 2 + i32.and + i32.eqz + br_if 1 (;@8;) + get_local 0 + i32.load offset=8 + set_local 2 + br 2 (;@7;) + end + i32.const 0 + set_local 2 + block ;; label = @9 + get_local 0 + i32.const 8 + i32.shr_u + tee_local 4 + i32.eqz + br_if 0 (;@9;) + i32.const 31 + set_local 2 + get_local 0 + i32.const 16777215 + i32.gt_u + br_if 0 (;@9;) + get_local 0 + i32.const 14 + get_local 4 + get_local 4 + i32.const 1048320 + i32.add + i32.const 16 + i32.shr_u + i32.const 8 + i32.and + tee_local 2 + i32.shl + tee_local 4 + i32.const 520192 + i32.add + i32.const 16 + i32.shr_u + i32.const 4 + i32.and + tee_local 5 + get_local 2 + i32.or + get_local 4 + get_local 5 + i32.shl + tee_local 2 + i32.const 245760 + i32.add + i32.const 16 + i32.shr_u + i32.const 2 + i32.and + tee_local 4 + i32.or + i32.sub + get_local 2 + get_local 4 + i32.shl + i32.const 15 + i32.shr_u + i32.add + tee_local 2 + i32.const 7 + i32.add + i32.shr_u + i32.const 1 + i32.and + get_local 2 + i32.const 1 + i32.shl + i32.or + set_local 2 + end + get_local 1 + i64.const 0 + i64.store offset=16 align=4 + get_local 1 + i32.const 28 + i32.add + get_local 2 + i32.store + get_local 2 + i32.const 2 + i32.shl + i32.const 1344 + i32.add + set_local 4 + i32.const 0 + i32.load offset=1044 + tee_local 5 + i32.const 1 + get_local 2 + i32.shl + tee_local 3 + i32.and + i32.eqz + br_if 2 (;@6;) + get_local 0 + i32.const 0 + i32.const 25 + get_local 2 + i32.const 1 + i32.shr_u + i32.sub + get_local 2 + i32.const 31 + i32.eq + select + i32.shl + set_local 2 + get_local 4 + i32.load + set_local 5 + loop ;; label = @9 + get_local 5 + tee_local 4 + i32.load offset=4 + i32.const -8 + i32.and + get_local 0 + i32.eq + br_if 5 (;@4;) + get_local 2 + i32.const 29 + i32.shr_u + set_local 5 + get_local 2 + i32.const 1 + i32.shl + set_local 2 + get_local 4 + get_local 5 + i32.const 4 + i32.and + i32.add + i32.const 16 + i32.add + tee_local 3 + i32.load + tee_local 5 + br_if 0 (;@9;) + end + get_local 3 + get_local 1 + i32.store + get_local 1 + i32.const 24 + i32.add + get_local 4 + i32.store + br 3 (;@5;) + end + i32.const 0 + get_local 4 + get_local 2 + i32.or + i32.store offset=1040 + get_local 0 + set_local 2 + end + get_local 2 + get_local 1 + i32.store offset=12 + get_local 0 + get_local 1 + i32.store offset=8 + get_local 1 + get_local 0 + i32.store offset=12 + get_local 1 + get_local 2 + i32.store offset=8 + return + end + get_local 4 + get_local 1 + i32.store + i32.const 0 + get_local 5 + get_local 3 + i32.or + i32.store offset=1044 + get_local 1 + i32.const 24 + i32.add + get_local 4 + i32.store + end + get_local 1 + get_local 1 + i32.store offset=12 + get_local 1 + get_local 1 + i32.store offset=8 + br 1 (;@3;) + end + get_local 4 + i32.load offset=8 + tee_local 0 + get_local 1 + i32.store offset=12 + get_local 4 + get_local 1 + i32.store offset=8 + get_local 1 + i32.const 24 + i32.add + i32.const 0 + i32.store + get_local 1 + get_local 4 + i32.store offset=12 + get_local 1 + get_local 0 + i32.store offset=8 + end + i32.const 0 + i32.const 0 + i32.load offset=1072 + i32.const -1 + i32.add + tee_local 1 + i32.store offset=1072 + get_local 1 + i32.eqz + br_if 1 (;@1;) + end + return + end + i32.const 1496 + set_local 1 + loop ;; label = @1 + get_local 1 + i32.load + tee_local 0 + i32.const 8 + i32.add + set_local 1 + get_local 0 + br_if 0 (;@1;) + end + i32.const 0 + i32.const -1 + i32.store offset=1072) + (func (;18;) (type 2) (param i32 i32) (result i32) + (local i32) + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + get_local 0 + i32.eqz + br_if 0 (;@3;) + get_local 1 + get_local 0 + i32.mul + set_local 2 + block ;; label = @4 + get_local 1 + get_local 0 + i32.or + i32.const 65536 + i32.lt_u + br_if 0 (;@4;) + get_local 2 + i32.const -1 + get_local 2 + get_local 0 + i32.div_u + get_local 1 + i32.eq + select + set_local 2 + end + get_local 2 + call 15 + tee_local 0 + br_if 1 (;@2;) + br 2 (;@1;) + end + i32.const 0 + set_local 2 + i32.const 0 + call 15 + tee_local 0 + i32.eqz + br_if 1 (;@1;) + end + get_local 0 + i32.const -4 + i32.add + i32.load8_u + i32.const 3 + i32.and + i32.eqz + br_if 0 (;@1;) + get_local 0 + i32.const 0 + get_local 2 + call 44 + drop + end + get_local 0) + (func (;19;) (type 3) (param i32) + get_local 0 + call 6 + unreachable) + (func (;20;) (type 7) + unreachable + unreachable) + (func (;21;) (type 4) (param i32) (result i32) + block ;; label = @1 + get_local 0 + call 8 + tee_local 0 + i32.eqz + br_if 0 (;@1;) + i32.const 0 + get_local 0 + i32.store offset=1536 + i32.const -1 + return + end + i32.const 0) + (func (;22;) (type 3) (param i32) + (local i32 i32) + block ;; label = @1 + get_local 0 + i32.load + i32.const 0 + i32.le_s + br_if 0 (;@1;) + get_local 0 + i32.load offset=12 + tee_local 1 + get_local 0 + i32.load offset=8 + tee_local 2 + i32.gt_u + br_if 0 (;@1;) + get_local 0 + i32.load offset=4 + set_local 0 + block ;; label = @2 + get_local 2 + i32.eqz + br_if 0 (;@2;) + get_local 0 + i32.eqz + br_if 1 (;@1;) + end + block ;; label = @2 + get_local 1 + i32.eqz + br_if 0 (;@2;) + i32.const 0 + set_local 2 + loop ;; label = @3 + get_local 0 + i32.load + i32.eqz + br_if 2 (;@1;) + get_local 0 + i32.const 4 + i32.add + i32.load + i32.const -1 + i32.le_s + br_if 2 (;@1;) + get_local 0 + i32.const 24 + i32.add + set_local 0 + get_local 2 + i32.const 1 + i32.add + tee_local 2 + get_local 1 + i32.lt_u + br_if 0 (;@3;) + end + end + return + end + call 20 + unreachable) + (func (;23;) (type 7) + (local i32 i32) + block ;; label = @1 + i32.const 16 + call 14 + tee_local 0 + i32.eqz + br_if 0 (;@1;) + get_local 0 + i32.const 24 + i32.const 4 + call 18 + tee_local 1 + i32.store offset=4 + block ;; label = @2 + get_local 1 + i32.eqz + br_if 0 (;@2;) + get_local 0 + i64.const 4 + i64.store offset=8 align=4 + get_local 0 + i32.const 1 + i32.store + get_local 0 + call 22 + i32.const 0 + get_local 0 + i32.store offset=1540 + get_local 0 + call 22 + return + end + get_local 0 + call 16 + end + i32.const 0 + i32.const 0 + i32.store offset=1540 + unreachable + unreachable) + (func (;24;) (type 2) (param i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32) + get_global 0 + i32.const 32 + i32.sub + tee_local 2 + set_global 0 + i32.const 0 + i32.load offset=1540 + call 22 + i32.const -1 + set_local 3 + block ;; label = @1 + get_local 1 + i32.eqz + br_if 0 (;@1;) + i32.const 0 + i32.load offset=1540 + tee_local 4 + call 22 + get_local 0 + i32.const 0 + i32.lt_s + br_if 0 (;@1;) + block ;; label = @2 + block ;; label = @3 + get_local 4 + i32.load offset=12 + tee_local 5 + get_local 4 + i32.load offset=8 + i32.ne + br_if 0 (;@3;) + i32.const 24 + get_local 5 + i32.const 1 + i32.shl + call 18 + tee_local 6 + i32.eqz + br_if 2 (;@1;) + get_local 6 + get_local 4 + i32.load offset=4 + get_local 4 + i32.const 12 + i32.add + tee_local 5 + i32.load + i32.const 24 + i32.mul + call 43 + drop + get_local 4 + i32.load offset=4 + call 16 + get_local 4 + get_local 6 + i32.store offset=4 + get_local 4 + i32.const 8 + i32.add + tee_local 7 + get_local 7 + i32.load + i32.const 1 + i32.shl + i32.store + get_local 5 + i32.load + set_local 5 + br 1 (;@2;) + end + get_local 4 + i32.load offset=4 + set_local 6 + end + get_local 4 + i32.const 12 + i32.add + get_local 5 + i32.const 1 + i32.add + i32.store + get_local 1 + call 45 + set_local 7 + get_local 6 + get_local 5 + i32.const 24 + i32.mul + i32.add + tee_local 1 + get_local 0 + i32.store offset=4 + get_local 1 + get_local 7 + i32.store + block ;; label = @2 + get_local 0 + get_local 2 + i32.const 8 + i32.add + call 7 + tee_local 0 + i32.eqz + br_if 0 (;@2;) + i32.const 0 + get_local 0 + i32.store offset=1536 + br 1 (;@1;) + end + get_local 1 + get_local 2 + i64.load offset=16 + i64.store offset=8 + get_local 1 + get_local 2 + i64.load offset=24 + i64.store offset=16 + get_local 4 + call 22 + get_local 4 + call 22 + i32.const 0 + set_local 3 + i32.const 0 + get_local 4 + i32.store offset=1540 + end + get_local 2 + i32.const 32 + i32.add + set_global 0 + get_local 3) + (func (;25;) (type 4) (param i32) (result i32) + block ;; label = @1 + get_local 0 + i32.const 65535 + i32.and + br_if 0 (;@1;) + get_local 0 + i32.const -1 + i32.le_s + br_if 0 (;@1;) + block ;; label = @2 + get_local 0 + i32.const 16 + i32.shr_u + grow_memory + tee_local 0 + i32.const -1 + i32.eq + br_if 0 (;@2;) + get_local 0 + i32.const 16 + i32.shl + return + end + i32.const 0 + i32.const 48 + i32.store offset=1536 + i32.const -1 + return + end + call 20 + unreachable) + (func (;26;) (type 7)) + (func (;27;) (type 7) + call 26 + call 29) + (func (;28;) (type 8) (result i32) + i32.const 1548) + (func (;29;) (type 7) + (local i32 i32 i32) + block ;; label = @1 + call 28 + i32.load + tee_local 0 + i32.eqz + br_if 0 (;@1;) + loop ;; label = @2 + block ;; label = @3 + get_local 0 + i32.load offset=20 + get_local 0 + i32.load offset=24 + i32.eq + br_if 0 (;@3;) + get_local 0 + i32.const 0 + i32.const 0 + get_local 0 + i32.load offset=32 + call_indirect (type 0) + drop + end + block ;; label = @3 + get_local 0 + i32.load offset=4 + tee_local 1 + get_local 0 + i32.load offset=8 + tee_local 2 + i32.eq + br_if 0 (;@3;) + get_local 0 + get_local 1 + get_local 2 + i32.sub + i64.extend_s/i32 + i32.const 0 + get_local 0 + i32.load offset=36 + call_indirect (type 1) + drop + end + get_local 0 + i32.load offset=52 + tee_local 0 + br_if 0 (;@2;) + end + end + block ;; label = @1 + i32.const 0 + i32.load offset=1552 + tee_local 0 + i32.eqz + br_if 0 (;@1;) + block ;; label = @2 + get_local 0 + i32.load offset=20 + get_local 0 + i32.load offset=24 + i32.eq + br_if 0 (;@2;) + get_local 0 + i32.const 0 + i32.const 0 + get_local 0 + i32.load offset=32 + call_indirect (type 0) + drop + end + get_local 0 + i32.load offset=4 + tee_local 1 + get_local 0 + i32.load offset=8 + tee_local 2 + i32.eq + br_if 0 (;@1;) + get_local 0 + get_local 1 + get_local 2 + i32.sub + i64.extend_s/i32 + i32.const 0 + get_local 0 + i32.load offset=36 + call_indirect (type 1) + drop + end + block ;; label = @1 + i32.const 0 + i32.load offset=2712 + tee_local 0 + i32.eqz + br_if 0 (;@1;) + block ;; label = @2 + get_local 0 + i32.load offset=20 + get_local 0 + i32.load offset=24 + i32.eq + br_if 0 (;@2;) + get_local 0 + i32.const 0 + i32.const 0 + get_local 0 + i32.load offset=32 + call_indirect (type 0) + drop + end + get_local 0 + i32.load offset=4 + tee_local 1 + get_local 0 + i32.load offset=8 + tee_local 2 + i32.eq + br_if 0 (;@1;) + get_local 0 + get_local 1 + get_local 2 + i32.sub + i64.extend_s/i32 + i32.const 0 + get_local 0 + i32.load offset=36 + call_indirect (type 1) + drop + end + block ;; label = @1 + i32.const 0 + i32.load offset=1552 + tee_local 0 + i32.eqz + br_if 0 (;@1;) + block ;; label = @2 + get_local 0 + i32.load offset=20 + get_local 0 + i32.load offset=24 + i32.eq + br_if 0 (;@2;) + get_local 0 + i32.const 0 + i32.const 0 + get_local 0 + i32.load offset=32 + call_indirect (type 0) + drop + end + get_local 0 + i32.load offset=4 + tee_local 1 + get_local 0 + i32.load offset=8 + tee_local 2 + i32.eq + br_if 0 (;@1;) + get_local 0 + get_local 1 + get_local 2 + i32.sub + i64.extend_s/i32 + i32.const 0 + get_local 0 + i32.load offset=36 + call_indirect (type 1) + drop + end) + (func (;30;) (type 4) (param i32) (result i32) + (local i32) + get_local 0 + get_local 0 + i32.load offset=60 + tee_local 1 + i32.const -1 + i32.add + get_local 1 + i32.or + i32.store offset=60 + block ;; label = @1 + get_local 0 + i32.load + tee_local 1 + i32.const 8 + i32.and + br_if 0 (;@1;) + get_local 0 + i64.const 0 + i64.store offset=4 align=4 + get_local 0 + get_local 0 + i32.load offset=40 + tee_local 1 + i32.store offset=24 + get_local 0 + get_local 1 + i32.store offset=20 + get_local 0 + get_local 1 + get_local 0 + i32.load offset=44 + i32.add + i32.store offset=16 + i32.const 0 + return + end + get_local 0 + get_local 1 + i32.const 32 + i32.or + i32.store + i32.const -1) + (func (;31;) (type 0) (param i32 i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32) + block ;; label = @1 + block ;; label = @2 + get_local 2 + i32.load offset=16 + tee_local 3 + br_if 0 (;@2;) + i32.const 0 + set_local 6 + get_local 2 + call 30 + br_if 1 (;@1;) + get_local 2 + i32.const 16 + i32.add + i32.load + set_local 3 + end + block ;; label = @2 + get_local 3 + get_local 2 + i32.load offset=20 + tee_local 4 + i32.sub + get_local 1 + i32.ge_u + br_if 0 (;@2;) + get_local 2 + get_local 0 + get_local 1 + get_local 2 + i32.load offset=32 + call_indirect (type 0) + return + end + i32.const 0 + set_local 5 + block ;; label = @2 + get_local 2 + i32.load offset=64 + i32.const 0 + i32.lt_s + br_if 0 (;@2;) + i32.const 0 + set_local 5 + get_local 0 + set_local 6 + i32.const 0 + set_local 3 + loop ;; label = @3 + get_local 1 + get_local 3 + i32.eq + br_if 1 (;@2;) + get_local 3 + i32.const 1 + i32.add + set_local 3 + get_local 6 + get_local 1 + i32.add + set_local 7 + get_local 6 + i32.const -1 + i32.add + tee_local 8 + set_local 6 + get_local 7 + i32.const -1 + i32.add + i32.load8_u + i32.const 10 + i32.ne + br_if 0 (;@3;) + end + get_local 2 + get_local 0 + get_local 1 + get_local 3 + i32.sub + i32.const 1 + i32.add + tee_local 5 + get_local 2 + i32.load offset=32 + call_indirect (type 0) + tee_local 6 + get_local 5 + i32.lt_u + br_if 1 (;@1;) + get_local 8 + get_local 1 + i32.add + i32.const 1 + i32.add + set_local 0 + get_local 2 + i32.const 20 + i32.add + i32.load + set_local 4 + get_local 3 + i32.const -1 + i32.add + set_local 1 + end + get_local 4 + get_local 0 + get_local 1 + call 43 + drop + get_local 2 + i32.const 20 + i32.add + tee_local 3 + get_local 3 + i32.load + get_local 1 + i32.add + i32.store + get_local 5 + get_local 1 + i32.add + return + end + get_local 6) + (func (;32;) (type 5) (param i32 i32 i32 i32) (result i32) + (local i32) + block ;; label = @1 + get_local 0 + get_local 2 + get_local 1 + i32.mul + tee_local 4 + get_local 3 + call 31 + tee_local 0 + get_local 4 + i32.ne + br_if 0 (;@1;) + get_local 2 + i32.const 0 + get_local 1 + select + return + end + get_local 0 + get_local 1 + i32.div_u) + (func (;33;) (type 2) (param i32 i32) (result i32) + (local i32) + i32.const -1 + i32.const 0 + get_local 0 + call 46 + tee_local 2 + get_local 0 + i32.const 1 + get_local 2 + get_local 1 + call 32 + i32.ne + select) + (func (;34;) (type 2) (param i32 i32) (result i32) + (local i32 i32 i32) + get_global 0 + i32.const 16 + i32.sub + tee_local 2 + set_global 0 + get_local 2 + get_local 1 + i32.store8 offset=15 + block ;; label = @1 + block ;; label = @2 + get_local 0 + i32.load offset=16 + tee_local 3 + br_if 0 (;@2;) + i32.const -1 + set_local 3 + get_local 0 + call 30 + br_if 1 (;@1;) + get_local 0 + i32.const 16 + i32.add + i32.load + set_local 3 + end + block ;; label = @2 + block ;; label = @3 + get_local 0 + i32.load offset=20 + tee_local 4 + get_local 3 + i32.eq + br_if 0 (;@3;) + get_local 0 + i32.load offset=64 + get_local 1 + i32.const 255 + i32.and + tee_local 3 + i32.ne + br_if 1 (;@2;) + end + i32.const -1 + set_local 3 + get_local 0 + get_local 2 + i32.const 15 + i32.add + i32.const 1 + get_local 0 + i32.load offset=32 + call_indirect (type 0) + i32.const 1 + i32.ne + br_if 1 (;@1;) + get_local 2 + i32.load8_u offset=15 + set_local 3 + br 1 (;@1;) + end + get_local 0 + i32.const 20 + i32.add + get_local 4 + i32.const 1 + i32.add + i32.store + get_local 4 + get_local 1 + i32.store8 + end + get_local 2 + i32.const 16 + i32.add + set_global 0 + get_local 3) + (func (;35;) (type 4) (param i32) (result i32) + block ;; label = @1 + get_local 0 + i32.const 2600 + call 33 + i32.const 0 + i32.lt_s + br_if 0 (;@1;) + block ;; label = @2 + i32.const 0 + i32.load offset=2664 + i32.const 10 + i32.eq + br_if 0 (;@2;) + i32.const 0 + i32.load offset=2620 + tee_local 0 + i32.const 0 + i32.load offset=2616 + i32.eq + br_if 0 (;@2;) + i32.const 0 + get_local 0 + i32.const 1 + i32.add + i32.store offset=2620 + get_local 0 + i32.const 10 + i32.store8 + i32.const 0 + return + end + i32.const 2600 + i32.const 10 + call 34 + i32.const 31 + i32.shr_s + return + end + i32.const -1) + (func (;36;) (type 4) (param i32) (result i32) + get_local 0 + i32.load offset=56 + call 21) + (func (;37;) (type 0) (param i32 i32 i32) (result i32) + (local i32 i32) + get_global 0 + i32.const 16 + i32.sub + tee_local 3 + set_global 0 + i32.const -1 + set_local 4 + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + get_local 2 + i32.const -1 + i32.le_s + br_if 0 (;@3;) + get_local 0 + get_local 1 + get_local 2 + get_local 3 + i32.const 12 + i32.add + call 9 + tee_local 2 + i32.eqz + br_if 1 (;@2;) + i32.const 0 + get_local 2 + i32.store offset=1536 + i32.const -1 + set_local 4 + br 2 (;@1;) + end + i32.const 0 + i32.const 28 + i32.store offset=1536 + br 1 (;@1;) + end + get_local 3 + i32.load offset=12 + set_local 4 + end + get_local 3 + i32.const 16 + i32.add + set_global 0 + get_local 4) + (func (;38;) (type 0) (param i32 i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32) + get_global 0 + i32.const 16 + i32.sub + tee_local 3 + set_global 0 + get_local 3 + get_local 2 + i32.store offset=12 + get_local 3 + get_local 1 + i32.store offset=8 + get_local 3 + get_local 0 + i32.load offset=24 + tee_local 1 + i32.store + get_local 3 + get_local 0 + i32.load offset=20 + get_local 1 + i32.sub + tee_local 1 + i32.store offset=4 + i32.const 2 + set_local 4 + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + get_local 1 + get_local 2 + i32.add + tee_local 5 + get_local 0 + i32.load offset=56 + get_local 3 + i32.const 2 + call 37 + tee_local 6 + i32.eq + br_if 0 (;@3;) + get_local 3 + set_local 1 + get_local 0 + i32.const 56 + i32.add + set_local 7 + loop ;; label = @4 + get_local 6 + i32.const -1 + i32.le_s + br_if 2 (;@2;) + get_local 1 + i32.const 8 + i32.add + get_local 1 + get_local 6 + get_local 1 + i32.load offset=4 + tee_local 8 + i32.gt_u + tee_local 9 + select + tee_local 1 + get_local 1 + i32.load + get_local 6 + get_local 8 + i32.const 0 + get_local 9 + select + i32.sub + tee_local 8 + i32.add + i32.store + get_local 1 + get_local 1 + i32.load offset=4 + get_local 8 + i32.sub + i32.store offset=4 + get_local 5 + get_local 6 + i32.sub + set_local 5 + get_local 7 + i32.load + get_local 1 + get_local 4 + get_local 9 + i32.sub + tee_local 4 + call 37 + tee_local 9 + set_local 6 + get_local 5 + get_local 9 + i32.ne + br_if 0 (;@4;) + end + end + get_local 0 + i32.const 24 + i32.add + get_local 0 + i32.load offset=40 + tee_local 1 + i32.store + get_local 0 + i32.const 20 + i32.add + get_local 1 + i32.store + get_local 0 + get_local 1 + get_local 0 + i32.load offset=44 + i32.add + i32.store offset=16 + get_local 2 + set_local 6 + br 1 (;@1;) + end + get_local 0 + i64.const 0 + i64.store offset=16 + i32.const 0 + set_local 6 + get_local 0 + i32.const 24 + i32.add + i32.const 0 + i32.store + get_local 0 + get_local 0 + i32.load + i32.const 32 + i32.or + i32.store + get_local 4 + i32.const 2 + i32.eq + br_if 0 (;@1;) + get_local 2 + get_local 1 + i32.load offset=4 + i32.sub + set_local 6 + end + get_local 3 + i32.const 16 + i32.add + set_global 0 + get_local 6) + (func (;39;) (type 4) (param i32) (result i32) + (local i32 i32) + get_global 0 + i32.const 32 + i32.sub + tee_local 1 + set_global 0 + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + get_local 0 + get_local 1 + i32.const 8 + i32.add + call 7 + tee_local 0 + br_if 0 (;@3;) + i32.const 59 + set_local 0 + get_local 1 + i32.load8_u offset=8 + i32.const 2 + i32.ne + br_if 0 (;@3;) + get_local 1 + i32.load8_u offset=16 + i32.const 36 + i32.and + i32.eqz + br_if 1 (;@2;) + end + i32.const 0 + set_local 2 + i32.const 0 + get_local 0 + i32.store offset=1536 + br 1 (;@1;) + end + i32.const 1 + set_local 2 + end + get_local 1 + i32.const 32 + i32.add + set_global 0 + get_local 2) + (func (;40;) (type 0) (param i32 i32 i32) (result i32) + get_local 0 + i32.const 1 + i32.store offset=32 + block ;; label = @1 + block ;; label = @2 + get_local 0 + i32.load8_u + i32.const 64 + i32.and + br_if 0 (;@2;) + get_local 0 + i32.load offset=56 + call 39 + i32.eqz + br_if 1 (;@1;) + end + get_local 0 + get_local 1 + get_local 2 + call 38 + return + end + get_local 0 + i32.const -1 + i32.store offset=64 + get_local 0 + get_local 1 + get_local 2 + call 38) + (func (;41;) (type 1) (param i32 i64 i32) (result i64) + (local i32) + get_global 0 + i32.const 16 + i32.sub + tee_local 3 + set_global 0 + block ;; label = @1 + block ;; label = @2 + get_local 0 + get_local 1 + get_local 2 + i32.const 255 + i32.and + get_local 3 + i32.const 8 + i32.add + call 10 + tee_local 0 + i32.eqz + br_if 0 (;@2;) + i32.const 0 + i32.const 70 + get_local 0 + get_local 0 + i32.const 76 + i32.eq + select + i32.store offset=1536 + i64.const -1 + set_local 1 + br 1 (;@1;) + end + get_local 3 + i64.load offset=8 + set_local 1 + end + get_local 3 + i32.const 16 + i32.add + set_global 0 + get_local 1) + (func (;42;) (type 1) (param i32 i64 i32) (result i64) + get_local 0 + i32.load offset=56 + get_local 1 + get_local 2 + call 41) + (func (;43;) (type 0) (param i32 i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32 i32 i32) + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + block ;; label = @4 + get_local 2 + i32.eqz + br_if 0 (;@4;) + get_local 1 + i32.const 3 + i32.and + i32.eqz + br_if 0 (;@4;) + get_local 0 + set_local 3 + block ;; label = @5 + loop ;; label = @6 + get_local 3 + get_local 1 + i32.load8_u + i32.store8 + get_local 2 + i32.const -1 + i32.add + set_local 4 + get_local 3 + i32.const 1 + i32.add + set_local 3 + get_local 1 + i32.const 1 + i32.add + set_local 1 + get_local 2 + i32.const 1 + i32.eq + br_if 1 (;@5;) + get_local 4 + set_local 2 + get_local 1 + i32.const 3 + i32.and + br_if 0 (;@6;) + end + end + get_local 3 + i32.const 3 + i32.and + tee_local 2 + i32.eqz + br_if 1 (;@3;) + br 2 (;@2;) + end + get_local 2 + set_local 4 + get_local 0 + tee_local 3 + i32.const 3 + i32.and + tee_local 2 + br_if 1 (;@2;) + end + block ;; label = @3 + block ;; label = @4 + get_local 4 + i32.const 16 + i32.lt_u + br_if 0 (;@4;) + get_local 4 + i32.const -16 + i32.add + set_local 2 + loop ;; label = @5 + get_local 3 + get_local 1 + i32.load + i32.store + get_local 3 + i32.const 4 + i32.add + get_local 1 + i32.const 4 + i32.add + i32.load + i32.store + get_local 3 + i32.const 8 + i32.add + get_local 1 + i32.const 8 + i32.add + i32.load + i32.store + get_local 3 + i32.const 12 + i32.add + get_local 1 + i32.const 12 + i32.add + i32.load + i32.store + get_local 3 + i32.const 16 + i32.add + set_local 3 + get_local 1 + i32.const 16 + i32.add + set_local 1 + get_local 4 + i32.const -16 + i32.add + tee_local 4 + i32.const 15 + i32.gt_u + br_if 0 (;@5;) + br 2 (;@3;) + end + end + get_local 4 + set_local 2 + end + block ;; label = @3 + get_local 2 + i32.const 8 + i32.and + i32.eqz + br_if 0 (;@3;) + get_local 3 + get_local 1 + i64.load align=4 + i64.store align=4 + get_local 1 + i32.const 8 + i32.add + set_local 1 + get_local 3 + i32.const 8 + i32.add + set_local 3 + end + block ;; label = @3 + get_local 2 + i32.const 4 + i32.and + i32.eqz + br_if 0 (;@3;) + get_local 3 + get_local 1 + i32.load + i32.store + get_local 1 + i32.const 4 + i32.add + set_local 1 + get_local 3 + i32.const 4 + i32.add + set_local 3 + end + block ;; label = @3 + get_local 2 + i32.const 2 + i32.and + i32.eqz + br_if 0 (;@3;) + get_local 3 + get_local 1 + i32.load8_u + i32.store8 + get_local 3 + get_local 1 + i32.load8_u offset=1 + i32.store8 offset=1 + get_local 3 + i32.const 2 + i32.add + set_local 3 + get_local 1 + i32.const 2 + i32.add + set_local 1 + end + get_local 2 + i32.const 1 + i32.and + i32.eqz + br_if 1 (;@1;) + get_local 3 + get_local 1 + i32.load8_u + i32.store8 + get_local 0 + return + end + block ;; label = @2 + get_local 4 + i32.const 32 + i32.lt_u + br_if 0 (;@2;) + block ;; label = @3 + block ;; label = @4 + get_local 2 + i32.const 3 + i32.eq + br_if 0 (;@4;) + get_local 2 + i32.const 2 + i32.eq + br_if 1 (;@3;) + get_local 2 + i32.const 1 + i32.ne + br_if 2 (;@2;) + get_local 3 + get_local 1 + i32.load8_u offset=1 + i32.store8 offset=1 + get_local 3 + get_local 1 + i32.load + tee_local 5 + i32.store8 + get_local 3 + get_local 1 + i32.load8_u offset=2 + i32.store8 offset=2 + get_local 4 + i32.const -3 + i32.add + set_local 6 + get_local 3 + i32.const 3 + i32.add + set_local 7 + get_local 4 + i32.const -20 + i32.add + i32.const -16 + i32.and + set_local 8 + i32.const 0 + set_local 2 + loop ;; label = @5 + get_local 7 + get_local 2 + i32.add + tee_local 3 + get_local 1 + get_local 2 + i32.add + tee_local 9 + i32.const 4 + i32.add + i32.load + tee_local 10 + i32.const 8 + i32.shl + get_local 5 + i32.const 24 + i32.shr_u + i32.or + i32.store + get_local 3 + i32.const 4 + i32.add + get_local 9 + i32.const 8 + i32.add + i32.load + tee_local 5 + i32.const 8 + i32.shl + get_local 10 + i32.const 24 + i32.shr_u + i32.or + i32.store + get_local 3 + i32.const 8 + i32.add + get_local 9 + i32.const 12 + i32.add + i32.load + tee_local 10 + i32.const 8 + i32.shl + get_local 5 + i32.const 24 + i32.shr_u + i32.or + i32.store + get_local 3 + i32.const 12 + i32.add + get_local 9 + i32.const 16 + i32.add + i32.load + tee_local 5 + i32.const 8 + i32.shl + get_local 10 + i32.const 24 + i32.shr_u + i32.or + i32.store + get_local 2 + i32.const 16 + i32.add + set_local 2 + get_local 6 + i32.const -16 + i32.add + tee_local 6 + i32.const 16 + i32.gt_u + br_if 0 (;@5;) + end + get_local 7 + get_local 2 + i32.add + set_local 3 + get_local 1 + get_local 2 + i32.add + i32.const 3 + i32.add + set_local 1 + get_local 4 + i32.const -19 + i32.add + get_local 8 + i32.sub + set_local 4 + br 2 (;@2;) + end + get_local 3 + get_local 1 + i32.load + tee_local 5 + i32.store8 + get_local 4 + i32.const -1 + i32.add + set_local 6 + get_local 3 + i32.const 1 + i32.add + set_local 7 + get_local 4 + i32.const -20 + i32.add + i32.const -16 + i32.and + set_local 8 + i32.const 0 + set_local 2 + loop ;; label = @4 + get_local 7 + get_local 2 + i32.add + tee_local 3 + get_local 1 + get_local 2 + i32.add + tee_local 9 + i32.const 4 + i32.add + i32.load + tee_local 10 + i32.const 24 + i32.shl + get_local 5 + i32.const 8 + i32.shr_u + i32.or + i32.store + get_local 3 + i32.const 4 + i32.add + get_local 9 + i32.const 8 + i32.add + i32.load + tee_local 5 + i32.const 24 + i32.shl + get_local 10 + i32.const 8 + i32.shr_u + i32.or + i32.store + get_local 3 + i32.const 8 + i32.add + get_local 9 + i32.const 12 + i32.add + i32.load + tee_local 10 + i32.const 24 + i32.shl + get_local 5 + i32.const 8 + i32.shr_u + i32.or + i32.store + get_local 3 + i32.const 12 + i32.add + get_local 9 + i32.const 16 + i32.add + i32.load + tee_local 5 + i32.const 24 + i32.shl + get_local 10 + i32.const 8 + i32.shr_u + i32.or + i32.store + get_local 2 + i32.const 16 + i32.add + set_local 2 + get_local 6 + i32.const -16 + i32.add + tee_local 6 + i32.const 18 + i32.gt_u + br_if 0 (;@4;) + end + get_local 7 + get_local 2 + i32.add + set_local 3 + get_local 1 + get_local 2 + i32.add + i32.const 1 + i32.add + set_local 1 + get_local 4 + i32.const -17 + i32.add + get_local 8 + i32.sub + set_local 4 + br 1 (;@2;) + end + get_local 3 + get_local 1 + i32.load + tee_local 5 + i32.store8 + get_local 3 + get_local 1 + i32.load8_u offset=1 + i32.store8 offset=1 + get_local 4 + i32.const -2 + i32.add + set_local 6 + get_local 3 + i32.const 2 + i32.add + set_local 7 + get_local 4 + i32.const -20 + i32.add + i32.const -16 + i32.and + set_local 8 + i32.const 0 + set_local 2 + loop ;; label = @3 + get_local 7 + get_local 2 + i32.add + tee_local 3 + get_local 1 + get_local 2 + i32.add + tee_local 9 + i32.const 4 + i32.add + i32.load + tee_local 10 + i32.const 16 + i32.shl + get_local 5 + i32.const 16 + i32.shr_u + i32.or + i32.store + get_local 3 + i32.const 4 + i32.add + get_local 9 + i32.const 8 + i32.add + i32.load + tee_local 5 + i32.const 16 + i32.shl + get_local 10 + i32.const 16 + i32.shr_u + i32.or + i32.store + get_local 3 + i32.const 8 + i32.add + get_local 9 + i32.const 12 + i32.add + i32.load + tee_local 10 + i32.const 16 + i32.shl + get_local 5 + i32.const 16 + i32.shr_u + i32.or + i32.store + get_local 3 + i32.const 12 + i32.add + get_local 9 + i32.const 16 + i32.add + i32.load + tee_local 5 + i32.const 16 + i32.shl + get_local 10 + i32.const 16 + i32.shr_u + i32.or + i32.store + get_local 2 + i32.const 16 + i32.add + set_local 2 + get_local 6 + i32.const -16 + i32.add + tee_local 6 + i32.const 17 + i32.gt_u + br_if 0 (;@3;) + end + get_local 7 + get_local 2 + i32.add + set_local 3 + get_local 1 + get_local 2 + i32.add + i32.const 2 + i32.add + set_local 1 + get_local 4 + i32.const -18 + i32.add + get_local 8 + i32.sub + set_local 4 + end + block ;; label = @2 + get_local 4 + i32.const 16 + i32.and + i32.eqz + br_if 0 (;@2;) + get_local 3 + get_local 1 + i32.load16_u align=1 + i32.store16 align=1 + get_local 3 + get_local 1 + i32.load8_u offset=2 + i32.store8 offset=2 + get_local 3 + get_local 1 + i32.load8_u offset=3 + i32.store8 offset=3 + get_local 3 + get_local 1 + i32.load8_u offset=4 + i32.store8 offset=4 + get_local 3 + get_local 1 + i32.load8_u offset=5 + i32.store8 offset=5 + get_local 3 + get_local 1 + i32.load8_u offset=6 + i32.store8 offset=6 + get_local 3 + get_local 1 + i32.load8_u offset=7 + i32.store8 offset=7 + get_local 3 + get_local 1 + i32.load8_u offset=8 + i32.store8 offset=8 + get_local 3 + get_local 1 + i32.load8_u offset=9 + i32.store8 offset=9 + get_local 3 + get_local 1 + i32.load8_u offset=10 + i32.store8 offset=10 + get_local 3 + get_local 1 + i32.load8_u offset=11 + i32.store8 offset=11 + get_local 3 + get_local 1 + i32.load8_u offset=12 + i32.store8 offset=12 + get_local 3 + get_local 1 + i32.load8_u offset=13 + i32.store8 offset=13 + get_local 3 + get_local 1 + i32.load8_u offset=14 + i32.store8 offset=14 + get_local 3 + get_local 1 + i32.load8_u offset=15 + i32.store8 offset=15 + get_local 3 + i32.const 16 + i32.add + set_local 3 + get_local 1 + i32.const 16 + i32.add + set_local 1 + end + block ;; label = @2 + get_local 4 + i32.const 8 + i32.and + i32.eqz + br_if 0 (;@2;) + get_local 3 + get_local 1 + i32.load8_u + i32.store8 + get_local 3 + get_local 1 + i32.load8_u offset=1 + i32.store8 offset=1 + get_local 3 + get_local 1 + i32.load8_u offset=2 + i32.store8 offset=2 + get_local 3 + get_local 1 + i32.load8_u offset=3 + i32.store8 offset=3 + get_local 3 + get_local 1 + i32.load8_u offset=4 + i32.store8 offset=4 + get_local 3 + get_local 1 + i32.load8_u offset=5 + i32.store8 offset=5 + get_local 3 + get_local 1 + i32.load8_u offset=6 + i32.store8 offset=6 + get_local 3 + get_local 1 + i32.load8_u offset=7 + i32.store8 offset=7 + get_local 3 + i32.const 8 + i32.add + set_local 3 + get_local 1 + i32.const 8 + i32.add + set_local 1 + end + block ;; label = @2 + get_local 4 + i32.const 4 + i32.and + i32.eqz + br_if 0 (;@2;) + get_local 3 + get_local 1 + i32.load8_u + i32.store8 + get_local 3 + get_local 1 + i32.load8_u offset=1 + i32.store8 offset=1 + get_local 3 + get_local 1 + i32.load8_u offset=2 + i32.store8 offset=2 + get_local 3 + get_local 1 + i32.load8_u offset=3 + i32.store8 offset=3 + get_local 3 + i32.const 4 + i32.add + set_local 3 + get_local 1 + i32.const 4 + i32.add + set_local 1 + end + block ;; label = @2 + get_local 4 + i32.const 2 + i32.and + i32.eqz + br_if 0 (;@2;) + get_local 3 + get_local 1 + i32.load8_u + i32.store8 + get_local 3 + get_local 1 + i32.load8_u offset=1 + i32.store8 offset=1 + get_local 3 + i32.const 2 + i32.add + set_local 3 + get_local 1 + i32.const 2 + i32.add + set_local 1 + end + get_local 4 + i32.const 1 + i32.and + i32.eqz + br_if 0 (;@1;) + get_local 3 + get_local 1 + i32.load8_u + i32.store8 + end + get_local 0) + (func (;44;) (type 0) (param i32 i32 i32) (result i32) + (local i32 i32 i32 i64) + block ;; label = @1 + get_local 2 + i32.eqz + br_if 0 (;@1;) + get_local 0 + get_local 1 + i32.store8 + get_local 0 + get_local 2 + i32.add + tee_local 3 + i32.const -1 + i32.add + get_local 1 + i32.store8 + get_local 2 + i32.const 3 + i32.lt_u + br_if 0 (;@1;) + get_local 0 + get_local 1 + i32.store8 offset=2 + get_local 0 + get_local 1 + i32.store8 offset=1 + get_local 3 + i32.const -3 + i32.add + get_local 1 + i32.store8 + get_local 3 + i32.const -2 + i32.add + get_local 1 + i32.store8 + get_local 2 + i32.const 7 + i32.lt_u + br_if 0 (;@1;) + get_local 0 + get_local 1 + i32.store8 offset=3 + get_local 3 + i32.const -4 + i32.add + get_local 1 + i32.store8 + get_local 2 + i32.const 9 + i32.lt_u + br_if 0 (;@1;) + get_local 0 + i32.const 0 + get_local 0 + i32.sub + i32.const 3 + i32.and + tee_local 4 + i32.add + tee_local 3 + get_local 1 + i32.const 255 + i32.and + i32.const 16843009 + i32.mul + tee_local 1 + i32.store + get_local 3 + get_local 2 + get_local 4 + i32.sub + i32.const -4 + i32.and + tee_local 4 + i32.add + tee_local 2 + i32.const -4 + i32.add + get_local 1 + i32.store + get_local 4 + i32.const 9 + i32.lt_u + br_if 0 (;@1;) + get_local 3 + get_local 1 + i32.store offset=8 + get_local 3 + get_local 1 + i32.store offset=4 + get_local 2 + i32.const -8 + i32.add + get_local 1 + i32.store + get_local 2 + i32.const -12 + i32.add + get_local 1 + i32.store + get_local 4 + i32.const 25 + i32.lt_u + br_if 0 (;@1;) + get_local 3 + get_local 1 + i32.store offset=24 + get_local 3 + get_local 1 + i32.store offset=20 + get_local 3 + get_local 1 + i32.store offset=16 + get_local 3 + get_local 1 + i32.store offset=12 + get_local 2 + i32.const -16 + i32.add + get_local 1 + i32.store + get_local 2 + i32.const -20 + i32.add + get_local 1 + i32.store + get_local 2 + i32.const -24 + i32.add + get_local 1 + i32.store + get_local 2 + i32.const -28 + i32.add + get_local 1 + i32.store + get_local 4 + get_local 3 + i32.const 4 + i32.and + i32.const 24 + i32.or + tee_local 5 + i32.sub + tee_local 2 + i32.const 32 + i32.lt_u + br_if 0 (;@1;) + get_local 1 + i64.extend_u/i32 + tee_local 6 + i64.const 32 + i64.shl + get_local 6 + i64.or + set_local 6 + get_local 3 + get_local 5 + i32.add + set_local 1 + loop ;; label = @2 + get_local 1 + get_local 6 + i64.store + get_local 1 + i32.const 24 + i32.add + get_local 6 + i64.store + get_local 1 + i32.const 16 + i32.add + get_local 6 + i64.store + get_local 1 + i32.const 8 + i32.add + get_local 6 + i64.store + get_local 1 + i32.const 32 + i32.add + set_local 1 + get_local 2 + i32.const -32 + i32.add + tee_local 2 + i32.const 31 + i32.gt_u + br_if 0 (;@2;) + end + end + get_local 0) + (func (;45;) (type 4) (param i32) (result i32) + (local i32 i32) + block ;; label = @1 + get_local 0 + call 46 + i32.const 1 + i32.add + tee_local 1 + call 14 + tee_local 2 + i32.eqz + br_if 0 (;@1;) + get_local 2 + get_local 0 + get_local 1 + call 43 + return + end + i32.const 0) + (func (;46;) (type 4) (param i32) (result i32) + (local i32 i32 i32) + get_local 0 + set_local 1 + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + get_local 0 + i32.const 3 + i32.and + i32.eqz + br_if 0 (;@3;) + get_local 0 + i32.load8_u + i32.eqz + br_if 1 (;@2;) + get_local 0 + i32.const 1 + i32.add + set_local 1 + loop ;; label = @4 + get_local 1 + i32.const 3 + i32.and + i32.eqz + br_if 1 (;@3;) + get_local 1 + i32.load8_u + set_local 2 + get_local 1 + i32.const 1 + i32.add + tee_local 3 + set_local 1 + get_local 2 + br_if 0 (;@4;) + end + get_local 3 + i32.const -1 + i32.add + get_local 0 + i32.sub + return + end + get_local 1 + i32.const -4 + i32.add + set_local 1 + loop ;; label = @3 + get_local 1 + i32.const 4 + i32.add + tee_local 1 + i32.load + tee_local 2 + i32.const -1 + i32.xor + get_local 2 + i32.const -16843009 + i32.add + i32.and + i32.const -2139062144 + i32.and + i32.eqz + br_if 0 (;@3;) + end + get_local 2 + i32.const 255 + i32.and + i32.eqz + br_if 1 (;@1;) + loop ;; label = @3 + get_local 1 + i32.load8_u offset=1 + set_local 2 + get_local 1 + i32.const 1 + i32.add + tee_local 3 + set_local 1 + get_local 2 + br_if 0 (;@3;) + end + get_local 3 + get_local 0 + i32.sub + return + end + get_local 0 + get_local 0 + i32.sub + return + end + get_local 1 + get_local 0 + i32.sub) + (table (;0;) 5 5 anyfunc) + (memory (;0;) 2) + (global (;0;) (mut i32) (i32.const 68256)) + (global (;1;) i32 (i32.const 68256)) + (global (;2;) i32 (i32.const 2716)) + (export "memory" (memory 0)) + (export "__heap_base" (global 1)) + (export "__data_end" (global 2)) + (export "_start" (func 12)) + (elem (i32.const 1) 38 36 40 42) + (data (i32.const 1024) "simple-wasi...\00") + (data (i32.const 1040) "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (data (i32.const 2600) "\05\00\00\00\00\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\03\00\00\00\04\00\00\00(\06\00\00\00\04\00\00\00\00\00\00\00\00\00\00\01\00\00\00\00\00\00\00\0a\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00(\0a\00\00")) diff --git a/test/fixtures/wasi/subdir/input_link.txt b/test/fixtures/wasi/subdir/input_link.txt new file mode 120000 index 0000000000..4a6d09bf82 --- /dev/null +++ b/test/fixtures/wasi/subdir/input_link.txt @@ -0,0 +1 @@ +../input.txt
\ No newline at end of file diff --git a/test/fixtures/wasi/subdir/loop1 b/test/fixtures/wasi/subdir/loop1 new file mode 120000 index 0000000000..433d7fdbce --- /dev/null +++ b/test/fixtures/wasi/subdir/loop1 @@ -0,0 +1 @@ +./loop2
\ No newline at end of file diff --git a/test/fixtures/wasi/subdir/loop2 b/test/fixtures/wasi/subdir/loop2 new file mode 120000 index 0000000000..2907735afc --- /dev/null +++ b/test/fixtures/wasi/subdir/loop2 @@ -0,0 +1 @@ +./loop1
\ No newline at end of file diff --git a/test/fixtures/wasi/subdir/outside.txt b/test/fixtures/wasi/subdir/outside.txt new file mode 120000 index 0000000000..2e06947067 --- /dev/null +++ b/test/fixtures/wasi/subdir/outside.txt @@ -0,0 +1 @@ +../../outside.txt
\ No newline at end of file diff --git a/test/wasi/Makefile b/test/wasi/Makefile new file mode 100644 index 0000000000..42d3b4e3fa --- /dev/null +++ b/test/wasi/Makefile @@ -0,0 +1,12 @@ +CC = /opt/wasi-sdk/bin/clang +TARGET = wasm32-unknown-wasi +SYSROOT = + +OBJ = $(patsubst c/%.c, wasm/%.wasm, $(wildcard c/*.c)) +all: $(OBJ) + +wasm/%.wasm : c/%.c + $(CC) $< --target=$(TARGET) --sysroot=$(SYSROOT) -s -o $@ + +.PHONY clean: + rm -f $(OBJ) diff --git a/test/wasi/README.md b/test/wasi/README.md new file mode 100644 index 0000000000..ccb02d095e --- /dev/null +++ b/test/wasi/README.md @@ -0,0 +1,8 @@ +# WASI Tests + +Compile with clang and `wasm32-wasi` target. The clang version used must be +built with wasi-libc. You can specify the location for clang and the sysroot +if needed when running make: +```console +$ make CC=/usr/local/opt/llvm/bin/clang SYSROOT=/path/to/wasi-libc/sysroot +``` diff --git a/test/wasi/c/cant_dotdot.c b/test/wasi/c/cant_dotdot.c new file mode 100644 index 0000000000..e2722062cd --- /dev/null +++ b/test/wasi/c/cant_dotdot.c @@ -0,0 +1,11 @@ +#include <assert.h> +#include <errno.h> +#include <stdio.h> + +int main() { + FILE* file = fopen("/sandbox/../outside.txt", "r"); + assert(file == NULL); + assert(errno == ENOTCAPABLE); + + return 0; +} diff --git a/test/wasi/c/clock_getres.c b/test/wasi/c/clock_getres.c new file mode 100644 index 0000000000..eaac02c665 --- /dev/null +++ b/test/wasi/c/clock_getres.c @@ -0,0 +1,17 @@ +#include <assert.h> +#include <time.h> + +int main() { + struct timespec ts; + int r; + + // supported clocks + r = clock_getres(CLOCK_REALTIME, &ts); + assert(r == 0); + r = clock_getres(CLOCK_MONOTONIC, &ts); + assert(r == 0); + r = clock_getres(CLOCK_PROCESS_CPUTIME_ID, &ts); + assert(r == 0); + r = clock_getres(CLOCK_THREAD_CPUTIME_ID, &ts); + assert(r == 0); +} diff --git a/test/wasi/c/exitcode.c b/test/wasi/c/exitcode.c new file mode 100644 index 0000000000..9c44b0de74 --- /dev/null +++ b/test/wasi/c/exitcode.c @@ -0,0 +1,3 @@ +int main() { + return 120; +} diff --git a/test/wasi/c/fd_prestat_get_refresh.c b/test/wasi/c/fd_prestat_get_refresh.c new file mode 100644 index 0000000000..fb644ab49b --- /dev/null +++ b/test/wasi/c/fd_prestat_get_refresh.c @@ -0,0 +1,8 @@ +#include <unistd.h> + +int main(void) { + isatty(1); + __builtin_wasm_memory_grow(0, 1); + isatty(1); + return 0; +} diff --git a/test/wasi/c/follow_symlink.c b/test/wasi/c/follow_symlink.c new file mode 100644 index 0000000000..badb0ee267 --- /dev/null +++ b/test/wasi/c/follow_symlink.c @@ -0,0 +1,14 @@ +#include <assert.h> +#include <stdio.h> + +int main() { + FILE* file = fopen("/sandbox/subdir/input_link.txt", "r"); + assert(file != NULL); + + char c = fgetc(file); + while (c != EOF) { + int wrote = fputc(c, stdout); + assert(wrote != EOF); + c = fgetc(file); + } +} diff --git a/test/wasi/c/getentropy.c b/test/wasi/c/getentropy.c new file mode 100644 index 0000000000..75547e1c47 --- /dev/null +++ b/test/wasi/c/getentropy.c @@ -0,0 +1,18 @@ +#include <assert.h> +#include <unistd.h> + +int main() { + char buf[256] = {0}; + int r = getentropy(buf, 256); + assert(r == 0); + + for (int i = 0; i < 256; i++) { + if (buf[i] != 0) { + return 0; + } + } + + // if this ever is reached, we either have a bug or should buy a lottery + // ticket + return 1; +} diff --git a/test/wasi/c/getrusage.c b/test/wasi/c/getrusage.c new file mode 100644 index 0000000000..ad1e430b85 --- /dev/null +++ b/test/wasi/c/getrusage.c @@ -0,0 +1,34 @@ +#include <assert.h> +#include <sys/resource.h> + +int main() { + struct rusage ru1; + struct rusage ru2; + long long s1; + long long us1; + long long s2; + long long us2; + int r; + int success = 0; + + r = getrusage(RUSAGE_SELF, &ru1); + assert(r == 0); + s1 = ru1.ru_utime.tv_sec; + us1 = ru1.ru_utime.tv_usec; + + for (int i = 0; i < 10000; i++) { + r = getrusage(RUSAGE_SELF, &ru2); + assert(r == 0); + s2 = ru2.ru_utime.tv_sec; + us2 = ru2.ru_utime.tv_usec; + assert(s1 <= s2); + + // Verify that some time has passed. + if (s2 > s1 || (s2 == s1 && us2 > us1)) { + success = 1; + break; + } + } + + assert(success == 1); +} diff --git a/test/wasi/c/gettimeofday.c b/test/wasi/c/gettimeofday.c new file mode 100644 index 0000000000..209a54e498 --- /dev/null +++ b/test/wasi/c/gettimeofday.c @@ -0,0 +1,35 @@ +#include <assert.h> +#include <stdlib.h> +#include <sys/time.h> + +int main() { + struct timeval tv1; + struct timeval tv2; + long long s1; + long long us1; + long long s2; + long long us2; + int r; + int success = 0; + + r = gettimeofday(&tv1, NULL); + assert(r == 0); + s1 = tv1.tv_sec; + us1 = tv1.tv_usec; + + for (int i = 0; i < 10000; i++) { + r = gettimeofday(&tv2, NULL); + assert(r == 0); + s2 = tv2.tv_sec; + us2 = tv2.tv_usec; + assert(s1 <= s2); + + // Verify that some time has passed. + if (s2 > s1 || (s2 == s1 && us2 > us1)) { + success = 1; + break; + } + } + + assert(success == 1); +} diff --git a/test/wasi/c/notdir.c b/test/wasi/c/notdir.c new file mode 100644 index 0000000000..03f369ffd3 --- /dev/null +++ b/test/wasi/c/notdir.c @@ -0,0 +1,11 @@ +#include <assert.h> +#include <dirent.h> +#include <errno.h> + +int main() { + DIR* dir = opendir("/sandbox/notadir"); + assert(dir == NULL); + assert(errno == ENOTDIR); + + return 0; +} diff --git a/test/wasi/c/poll.c b/test/wasi/c/poll.c new file mode 100644 index 0000000000..6b6ef71fd6 --- /dev/null +++ b/test/wasi/c/poll.c @@ -0,0 +1,31 @@ +#include <assert.h> +#include <poll.h> +#include <time.h> +#include <unistd.h> + +int main(void) { + struct pollfd fds[2]; + time_t before, now; + int ret; + + fds[0] = (struct pollfd){.fd = 1, .events = POLLOUT, .revents = 0}; + fds[1] = (struct pollfd){.fd = 2, .events = POLLOUT, .revents = 0}; + + ret = poll(fds, 2, -1); + assert(ret == 2); + assert(fds[0].revents == POLLOUT); + assert(fds[1].revents == POLLOUT); + + fds[0] = (struct pollfd){.fd = 0, .events = POLLIN, .revents = 0}; + time(&before); + ret = poll(fds, 1, 2000); + time(&now); + assert(ret == 0); + assert(now - before >= 2); + + sleep(1); + time(&now); + assert(now - before >= 3); + + return 0; +} diff --git a/test/wasi/c/preopen_populates.c b/test/wasi/c/preopen_populates.c new file mode 100644 index 0000000000..03b2213bb9 --- /dev/null +++ b/test/wasi/c/preopen_populates.c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/test/wasi/c/read_file.c b/test/wasi/c/read_file.c new file mode 100644 index 0000000000..40023e29e2 --- /dev/null +++ b/test/wasi/c/read_file.c @@ -0,0 +1,14 @@ +#include <assert.h> +#include <stdio.h> + +int main() { + FILE* file = fopen("/sandbox/input.txt", "r"); + assert(file != NULL); + + char c = fgetc(file); + while (c != EOF) { + int wrote = fputc(c, stdout); + assert(wrote != EOF); + c = fgetc(file); + } +} diff --git a/test/wasi/c/read_file_twice.c b/test/wasi/c/read_file_twice.c new file mode 100644 index 0000000000..e295e38a3b --- /dev/null +++ b/test/wasi/c/read_file_twice.c @@ -0,0 +1,16 @@ +#include <assert.h> +#include <stdio.h> + +int main() { + for (int i = 0; i < 2; i++) { + FILE* file = fopen("/sandbox/input.txt", "r"); + assert(file != NULL); + + char c = fgetc(file); + while (c != EOF) { + int wrote = fputc(c, stdout); + assert(wrote != EOF); + c = fgetc(file); + } + } +} diff --git a/test/wasi/c/stat.c b/test/wasi/c/stat.c new file mode 100644 index 0000000000..fd3854937b --- /dev/null +++ b/test/wasi/c/stat.c @@ -0,0 +1,53 @@ +#include <sys/stat.h> + +#include <assert.h> +#include <fcntl.h> +#include <time.h> +#include <unistd.h> + +#define BASE_DIR "/tmp" +#define OUTPUT_DIR BASE_DIR "/testdir" +#define PATH OUTPUT_DIR "/output.txt" +#define SIZE 500 + +int main(void) { + struct stat st; + int fd; + int ret; + off_t pos; + + (void)st; + ret = mkdir(OUTPUT_DIR, 0755); + assert(ret == 0); + + fd = open(PATH, O_CREAT | O_WRONLY, 0666); + assert(fd != -1); + + pos = lseek(fd, SIZE - 1, SEEK_SET); + assert(pos == SIZE - 1); + + ret = (int)write(fd, "", 1); + assert(ret == 1); + + ret = fstat(fd, &st); + assert(ret == 0); + assert(st.st_size == SIZE); + + ret = close(fd); + assert(ret == 0); + + ret = access(PATH, R_OK); + assert(ret == 0); + + ret = stat(PATH, &st); + assert(ret == 0); + assert(st.st_size == SIZE); + + ret = unlink(PATH); + assert(ret == 0); + + ret = stat(PATH, &st); + assert(ret == -1); + + return 0; +} diff --git a/test/wasi/c/stdin.c b/test/wasi/c/stdin.c new file mode 100644 index 0000000000..5a81ea1265 --- /dev/null +++ b/test/wasi/c/stdin.c @@ -0,0 +1,13 @@ +#include <stdio.h> + +int main(void) { + char x[32]; + + if (fgets(x, sizeof x, stdin) == NULL) { + return ferror(stdin); + } + if (fputs(x, stdout) == EOF) { + return ferror(stdout); + } + return 0; +} diff --git a/test/wasi/c/symlink_escape.c b/test/wasi/c/symlink_escape.c new file mode 100644 index 0000000000..32dcc64eeb --- /dev/null +++ b/test/wasi/c/symlink_escape.c @@ -0,0 +1,9 @@ +#include <assert.h> +#include <errno.h> +#include <stdio.h> + +int main() { + FILE* file = fopen("/sandbox/subdir/outside.txt", "r"); + assert(file == NULL); + assert(errno == ENOTCAPABLE); +} diff --git a/test/wasi/c/symlink_loop.c b/test/wasi/c/symlink_loop.c new file mode 100644 index 0000000000..23bd70ba60 --- /dev/null +++ b/test/wasi/c/symlink_loop.c @@ -0,0 +1,9 @@ +#include <assert.h> +#include <errno.h> +#include <stdio.h> + +int main() { + FILE* file = fopen("/sandbox/subdir/loop1", "r"); + assert(file == NULL); + assert(errno == ELOOP); +} diff --git a/test/wasi/c/write_file.c b/test/wasi/c/write_file.c new file mode 100644 index 0000000000..c4cf30cf29 --- /dev/null +++ b/test/wasi/c/write_file.c @@ -0,0 +1,15 @@ +#include <assert.h> +#include <stdio.h> +#include <string.h> + +static char* message = "hello, file!"; + +int main() { + FILE* file = fopen("/tmp/output.txt", "w"); + assert(file != NULL); + + int nwritten = fprintf(file, "%s", message); + assert(nwritten == strlen(message)); + int r = fclose(file); + assert(r == 0); +} diff --git a/test/wasi/test-wasi-binding.js b/test/wasi/test-wasi-binding.js new file mode 100644 index 0000000000..876c8a15a7 --- /dev/null +++ b/test/wasi/test-wasi-binding.js @@ -0,0 +1,19 @@ +// Flags: --experimental-wasi-unstable-preview0 +'use strict'; + +const common = require('../common'); + +const assert = require('assert'); +const fixtures = require('../common/fixtures'); +const buffer = fixtures.readSync(['wasi', 'simple-wasi.wasm']); +const { WASI } = require('wasi'); +const wasi = new WASI({ args: [], env: process.env }); +const importObject = { + wasi_unstable: wasi.wasiImport +}; + +WebAssembly.instantiate(buffer, importObject) +.then(common.mustCall((results) => { + assert(results.instance.exports._start); + wasi.start(results.instance); +})); diff --git a/test/wasi/test-wasi-symlinks.js b/test/wasi/test-wasi-symlinks.js new file mode 100644 index 0000000000..3829464198 --- /dev/null +++ b/test/wasi/test-wasi-symlinks.js @@ -0,0 +1,78 @@ +'use strict'; +const common = require('../common'); +const fs = require('fs'); +const path = require('path'); + +if (process.argv[2] === 'wasi-child') { + common.expectWarning('ExperimentalWarning', + 'WASI is an experimental feature. This feature could ' + + 'change at any time'); + + const { WASI } = require('wasi'); + const wasmDir = path.join(__dirname, 'wasm'); + const wasi = new WASI({ + args: [], + env: process.env, + preopens: { + '/sandbox': process.argv[4] + } + }); + const importObject = { wasi_unstable: wasi.wasiImport }; + const modulePath = path.join(wasmDir, `${process.argv[3]}.wasm`); + const buffer = fs.readFileSync(modulePath); + + (async () => { + const { instance } = await WebAssembly.instantiate(buffer, importObject); + + wasi.start(instance); + })(); +} else { + if (!common.canCreateSymLink()) { + common.skip('insufficient privileges'); + } + + const assert = require('assert'); + const cp = require('child_process'); + const tmpdir = require('../../test/common/tmpdir'); + + // Setup the sandbox environment. + tmpdir.refresh(); + const sandbox = path.join(tmpdir.path, 'sandbox'); + const sandboxedFile = path.join(sandbox, 'input.txt'); + const externalFile = path.join(tmpdir.path, 'outside.txt'); + const sandboxedDir = path.join(sandbox, 'subdir'); + const sandboxedSymlink = path.join(sandboxedDir, 'input_link.txt'); + const escapingSymlink = path.join(sandboxedDir, 'outside.txt'); + const loopSymlink1 = path.join(sandboxedDir, 'loop1'); + const loopSymlink2 = path.join(sandboxedDir, 'loop2'); + + fs.mkdirSync(sandbox); + fs.mkdirSync(sandboxedDir); + fs.writeFileSync(sandboxedFile, 'hello from input.txt', 'utf8'); + fs.writeFileSync(externalFile, 'this should be inaccessible', 'utf8'); + fs.symlinkSync(sandboxedFile, sandboxedSymlink, 'file'); + fs.symlinkSync(externalFile, escapingSymlink, 'file'); + fs.symlinkSync(loopSymlink2, loopSymlink1, 'file'); + fs.symlinkSync(loopSymlink1, loopSymlink2, 'file'); + + function runWASI(options) { + console.log('executing', options.test); + const opts = { env: { ...process.env, NODE_DEBUG_NATIVE: 'wasi' } }; + const child = cp.spawnSync(process.execPath, [ + '--experimental-wasi-unstable-preview0', + '--experimental-wasm-bigint', + __filename, + 'wasi-child', + options.test, + sandbox + ], opts); + console.log(child.stderr.toString()); + assert.strictEqual(child.status, 0); + assert.strictEqual(child.signal, null); + assert.strictEqual(child.stdout.toString(), options.stdout || ''); + } + + runWASI({ test: 'follow_symlink', stdout: 'hello from input.txt' }); + runWASI({ test: 'symlink_escape' }); + runWASI({ test: 'symlink_loop' }); +} diff --git a/test/wasi/test-wasi.js b/test/wasi/test-wasi.js new file mode 100644 index 0000000000..fa2e0894c9 --- /dev/null +++ b/test/wasi/test-wasi.js @@ -0,0 +1,81 @@ +'use strict'; +const common = require('../common'); + +if (process.argv[2] === 'wasi-child') { + const fixtures = require('../common/fixtures'); + const tmpdir = require('../../test/common/tmpdir'); + const fs = require('fs'); + const path = require('path'); + + common.expectWarning('ExperimentalWarning', + 'WASI is an experimental feature. This feature could ' + + 'change at any time'); + + const { WASI } = require('wasi'); + tmpdir.refresh(); + const wasmDir = path.join(__dirname, 'wasm'); + const wasi = new WASI({ + args: [], + env: process.env, + preopens: { + '/sandbox': fixtures.path('wasi'), + '/tmp': tmpdir.path + } + }); + const importObject = { wasi_unstable: wasi.wasiImport }; + const modulePath = path.join(wasmDir, `${process.argv[3]}.wasm`); + const buffer = fs.readFileSync(modulePath); + + (async () => { + const { instance } = await WebAssembly.instantiate(buffer, importObject); + + wasi.start(instance); + })(); +} else { + const assert = require('assert'); + const cp = require('child_process'); + const { EOL } = require('os'); + + function runWASI(options) { + console.log('executing', options.test); + const opts = { env: { ...process.env, NODE_DEBUG_NATIVE: 'wasi' } }; + + if (options.stdin !== undefined) + opts.input = options.stdin; + + const child = cp.spawnSync(process.execPath, [ + '--experimental-wasi-unstable-preview0', + '--experimental-wasm-bigint', + __filename, + 'wasi-child', + options.test + ], opts); + console.log(child.stderr.toString()); + assert.strictEqual(child.status, options.exitCode || 0); + assert.strictEqual(child.signal, null); + assert.strictEqual(child.stdout.toString(), options.stdout || ''); + } + + runWASI({ test: 'cant_dotdot' }); + runWASI({ test: 'clock_getres' }); + runWASI({ test: 'exitcode', exitCode: 120 }); + runWASI({ test: 'fd_prestat_get_refresh' }); + runWASI({ test: 'getentropy' }); + runWASI({ test: 'getrusage' }); + runWASI({ test: 'gettimeofday' }); + runWASI({ test: 'notdir' }); + // runWASI({ test: 'poll' }); + runWASI({ test: 'preopen_populates' }); + runWASI({ test: 'read_file', stdout: `hello from input.txt${EOL}` }); + runWASI({ + test: 'read_file_twice', + stdout: `hello from input.txt${EOL}hello from input.txt${EOL}` + }); + runWASI({ test: 'stat' }); + runWASI({ test: 'write_file' }); + + // Tests that are currently unsupported on Windows. + if (!common.isWindows) { + runWASI({ test: 'stdin', stdin: 'hello world', stdout: 'hello world' }); + } +} diff --git a/test/wasi/testcfg.py b/test/wasi/testcfg.py new file mode 100644 index 0000000000..ec6cbc5fe3 --- /dev/null +++ b/test/wasi/testcfg.py @@ -0,0 +1,6 @@ +import sys, os +sys.path.append(os.path.join(os.path.dirname(__file__), '..')) +import testpy + +def GetConfiguration(context, root): + return testpy.ParallelTestConfiguration(context, root, 'wasi') diff --git a/test/wasi/wasi.status b/test/wasi/wasi.status new file mode 100644 index 0000000000..12212e8f72 --- /dev/null +++ b/test/wasi/wasi.status @@ -0,0 +1,7 @@ +prefix wasi + +# To mark a test as flaky, list the test name in the appropriate section +# below, without ".js", followed by ": PASS,FLAKY". Example: +# sample-test : PASS,FLAKY + +[true] # This section applies to all platforms diff --git a/test/wasi/wasm/cant_dotdot.wasm b/test/wasi/wasm/cant_dotdot.wasm Binary files differnew file mode 100755 index 0000000000..61e202d691 --- /dev/null +++ b/test/wasi/wasm/cant_dotdot.wasm diff --git a/test/wasi/wasm/clock_getres.wasm b/test/wasi/wasm/clock_getres.wasm Binary files differnew file mode 100755 index 0000000000..fac14edb04 --- /dev/null +++ b/test/wasi/wasm/clock_getres.wasm diff --git a/test/wasi/wasm/exitcode.wasm b/test/wasi/wasm/exitcode.wasm Binary files differnew file mode 100755 index 0000000000..b2d9ef5e11 --- /dev/null +++ b/test/wasi/wasm/exitcode.wasm diff --git a/test/wasi/wasm/fd_prestat_get_refresh.wasm b/test/wasi/wasm/fd_prestat_get_refresh.wasm Binary files differnew file mode 100755 index 0000000000..cf4bb97c3b --- /dev/null +++ b/test/wasi/wasm/fd_prestat_get_refresh.wasm diff --git a/test/wasi/wasm/follow_symlink.wasm b/test/wasi/wasm/follow_symlink.wasm Binary files differnew file mode 100755 index 0000000000..48cf8da1eb --- /dev/null +++ b/test/wasi/wasm/follow_symlink.wasm diff --git a/test/wasi/wasm/getentropy.wasm b/test/wasi/wasm/getentropy.wasm Binary files differnew file mode 100755 index 0000000000..6e3e8c8a8e --- /dev/null +++ b/test/wasi/wasm/getentropy.wasm diff --git a/test/wasi/wasm/getrusage.wasm b/test/wasi/wasm/getrusage.wasm Binary files differnew file mode 100755 index 0000000000..524e809175 --- /dev/null +++ b/test/wasi/wasm/getrusage.wasm diff --git a/test/wasi/wasm/gettimeofday.wasm b/test/wasi/wasm/gettimeofday.wasm Binary files differnew file mode 100755 index 0000000000..94627f0086 --- /dev/null +++ b/test/wasi/wasm/gettimeofday.wasm diff --git a/test/wasi/wasm/notdir.wasm b/test/wasi/wasm/notdir.wasm Binary files differnew file mode 100755 index 0000000000..f83a790ddc --- /dev/null +++ b/test/wasi/wasm/notdir.wasm diff --git a/test/wasi/wasm/poll.wasm b/test/wasi/wasm/poll.wasm Binary files differnew file mode 100755 index 0000000000..98d0736762 --- /dev/null +++ b/test/wasi/wasm/poll.wasm diff --git a/test/wasi/wasm/preopen_populates.wasm b/test/wasi/wasm/preopen_populates.wasm Binary files differnew file mode 100755 index 0000000000..e7c34bc964 --- /dev/null +++ b/test/wasi/wasm/preopen_populates.wasm diff --git a/test/wasi/wasm/read_file.wasm b/test/wasi/wasm/read_file.wasm Binary files differnew file mode 100755 index 0000000000..2b9db77d27 --- /dev/null +++ b/test/wasi/wasm/read_file.wasm diff --git a/test/wasi/wasm/read_file_twice.wasm b/test/wasi/wasm/read_file_twice.wasm Binary files differnew file mode 100755 index 0000000000..cd075a4de7 --- /dev/null +++ b/test/wasi/wasm/read_file_twice.wasm diff --git a/test/wasi/wasm/stat.wasm b/test/wasi/wasm/stat.wasm Binary files differnew file mode 100755 index 0000000000..9007334d37 --- /dev/null +++ b/test/wasi/wasm/stat.wasm diff --git a/test/wasi/wasm/stdin.wasm b/test/wasi/wasm/stdin.wasm Binary files differnew file mode 100755 index 0000000000..7264608753 --- /dev/null +++ b/test/wasi/wasm/stdin.wasm diff --git a/test/wasi/wasm/symlink_escape.wasm b/test/wasi/wasm/symlink_escape.wasm Binary files differnew file mode 100755 index 0000000000..0cdb8327a1 --- /dev/null +++ b/test/wasi/wasm/symlink_escape.wasm diff --git a/test/wasi/wasm/symlink_loop.wasm b/test/wasi/wasm/symlink_loop.wasm Binary files differnew file mode 100755 index 0000000000..3883d5278c --- /dev/null +++ b/test/wasi/wasm/symlink_loop.wasm diff --git a/test/wasi/wasm/write_file.wasm b/test/wasi/wasm/write_file.wasm Binary files differnew file mode 100755 index 0000000000..500405e0fb --- /dev/null +++ b/test/wasi/wasm/write_file.wasm |