From 2b98366e3f4787fc8d3d21ba0c01a577b8ea0d66 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 6 Sep 2016 16:38:16 -0700 Subject: track globals in EffectAnalyzer --- src/ast_utils.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'src/ast_utils.h') diff --git a/src/ast_utils.h b/src/ast_utils.h index 9b2ff10cd..f7a486332 100644 --- a/src/ast_utils.h +++ b/src/ast_utils.h @@ -92,13 +92,16 @@ struct EffectAnalyzer : public PostWalker localsRead; std::set localsWritten; + std::set globalsRead; + std::set globalsWritten; bool readsMemory = false; bool writesMemory = false; bool accessesLocal() { return localsRead.size() + localsWritten.size() > 0; } + bool accessesGlobal() { return globalsRead.size() + globalsWritten.size() > 0; } bool accessesMemory() { return calls || readsMemory || writesMemory; } - bool hasSideEffects() { return calls || localsWritten.size() > 0 || writesMemory || branches; } - bool hasAnything() { return branches || calls || accessesLocal() || readsMemory || writesMemory; } + bool hasSideEffects() { return calls || localsWritten.size() > 0 || writesMemory || branches || globalsWritten.size() > 0; } + bool hasAnything() { return branches || calls || accessesLocal() || readsMemory || writesMemory || accessesGlobal(); } // checks if these effects would invalidate another set (e.g., if we write, we invalidate someone that reads, they can't be moved past us) bool invalidates(EffectAnalyzer& other) { @@ -115,6 +118,17 @@ struct EffectAnalyzer : public PostWalkerindex); } - void visitGetGlobal(GetGlobal *curr) { readsMemory = true; } // TODO: global-specific - void visitSetGlobal(SetGlobal *curr) { writesMemory = true; } // stuff? + void visitGetGlobal(GetGlobal *curr) { + globalsRead.insert(curr->name); + } + void visitSetGlobal(SetGlobal *curr) { + globalsWritten.insert(curr->name); + } void visitLoad(Load *curr) { readsMemory = true; } void visitStore(Store *curr) { writesMemory = true; } void visitReturn(Return *curr) { branches = true; } -- cgit v1.2.3 From 282369b5430287c2397eb9e3cdd859ad12fa3937 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 7 Sep 2016 15:59:58 -0700 Subject: autodrop if body if no else --- src/ast_utils.h | 7 ++ src/wasm-validator.h | 3 + test/emcc_O2_hello_world.fromasm | 28 +++--- test/emcc_O2_hello_world.fromasm.imprecise | 28 +++--- test/emcc_O2_hello_world.fromasm.imprecise.no-opts | 32 +++---- test/emcc_O2_hello_world.fromasm.no-opts | 32 +++---- test/emcc_hello_world.fromasm | 100 ++++++++++++--------- test/emcc_hello_world.fromasm.imprecise | 100 ++++++++++++--------- test/emcc_hello_world.fromasm.imprecise.no-opts | 100 ++++++++++++--------- test/emcc_hello_world.fromasm.no-opts | 100 ++++++++++++--------- test/example/c-api-kitchen-sink.txt | 8 +- test/example/c-api-kitchen-sink.txt.txt | 4 +- test/memorygrowth.fromasm | 28 +++--- test/memorygrowth.fromasm.imprecise | 28 +++--- test/memorygrowth.fromasm.imprecise.no-opts | 32 +++---- test/memorygrowth.fromasm.no-opts | 32 +++---- test/unit.asm.js | 5 ++ test/unit.fromasm | 16 +++- test/unit.fromasm.imprecise | 16 +++- test/unit.fromasm.imprecise.no-opts | 16 +++- test/unit.fromasm.no-opts | 16 +++- 21 files changed, 448 insertions(+), 283 deletions(-) (limited to 'src/ast_utils.h') diff --git a/src/ast_utils.h b/src/ast_utils.h index f7a486332..5deaa6a2c 100644 --- a/src/ast_utils.h +++ b/src/ast_utils.h @@ -832,6 +832,13 @@ struct AutoDrop : public WalkerPassfinalize(); // we may have changed our type } + void visitIf(If* curr) { + // if without else does not return a value, so the body must be dropped if it is concrete + if (!curr->ifFalse && isConcreteWasmType(curr->ifTrue->type)) { + curr->ifTrue = Builder(*getModule()).makeDrop(curr->ifTrue); + } + } + void visitFunction(Function* curr) { if (curr->result == none && isConcreteWasmType(curr->body->type)) { curr->body = Builder(*getModule()).makeDrop(curr->body); diff --git a/src/wasm-validator.h b/src/wasm-validator.h index 58a30f9a3..e23221337 100644 --- a/src/wasm-validator.h +++ b/src/wasm-validator.h @@ -104,6 +104,9 @@ public: void visitIf(If *curr) { shouldBeTrue(curr->condition->type == unreachable || curr->condition->type == i32 || curr->condition->type == i64, curr, "if condition must be valid"); + if (!curr->ifFalse) { + shouldBeFalse(isConcreteWasmType(curr->ifTrue->type), curr, "if without else must not return a value in body"); + } } // override scan to add a pre and a post check task to all nodes diff --git a/test/emcc_O2_hello_world.fromasm b/test/emcc_O2_hello_world.fromasm index f7fa57f61..18f533f4f 100644 --- a/test/emcc_O2_hello_world.fromasm +++ b/test/emcc_O2_hello_world.fromasm @@ -8980,21 +8980,23 @@ ) ) ) - (call_indirect $FUNCSIG$iiii - (get_local $0) - (i32.sub - (get_local $4) - (get_local $6) - ) - (i32.const 1) - (i32.add - (i32.and - (i32.load offset=40 - (get_local $0) + (drop + (call_indirect $FUNCSIG$iiii + (get_local $0) + (i32.sub + (get_local $4) + (get_local $6) + ) + (i32.const 1) + (i32.add + (i32.and + (i32.load offset=40 + (get_local $0) + ) + (i32.const 7) ) - (i32.const 7) + (i32.const 2) ) - (i32.const 2) ) ) ) diff --git a/test/emcc_O2_hello_world.fromasm.imprecise b/test/emcc_O2_hello_world.fromasm.imprecise index 925aa4813..d4e40feb4 100644 --- a/test/emcc_O2_hello_world.fromasm.imprecise +++ b/test/emcc_O2_hello_world.fromasm.imprecise @@ -8978,21 +8978,23 @@ ) ) ) - (call_indirect $FUNCSIG$iiii - (get_local $0) - (i32.sub - (get_local $4) - (get_local $6) - ) - (i32.const 1) - (i32.add - (i32.and - (i32.load offset=40 - (get_local $0) + (drop + (call_indirect $FUNCSIG$iiii + (get_local $0) + (i32.sub + (get_local $4) + (get_local $6) + ) + (i32.const 1) + (i32.add + (i32.and + (i32.load offset=40 + (get_local $0) + ) + (i32.const 7) ) - (i32.const 7) + (i32.const 2) ) - (i32.const 2) ) ) ) diff --git a/test/emcc_O2_hello_world.fromasm.imprecise.no-opts b/test/emcc_O2_hello_world.fromasm.imprecise.no-opts index b125481a7..d158d27bf 100644 --- a/test/emcc_O2_hello_world.fromasm.imprecise.no-opts +++ b/test/emcc_O2_hello_world.fromasm.imprecise.no-opts @@ -10632,24 +10632,26 @@ (get_local $i6) (get_local $i8) ) - (call_indirect $FUNCSIG$iiii - (get_local $i1) - (i32.sub - (get_local $i6) - (get_local $i8) - ) - (i32.const 1) - (i32.add - (i32.and - (i32.load - (i32.add - (get_local $i1) - (i32.const 40) + (drop + (call_indirect $FUNCSIG$iiii + (get_local $i1) + (i32.sub + (get_local $i6) + (get_local $i8) + ) + (i32.const 1) + (i32.add + (i32.and + (i32.load + (i32.add + (get_local $i1) + (i32.const 40) + ) ) + (i32.const 7) ) - (i32.const 7) + (i32.const 2) ) - (i32.const 2) ) ) ) diff --git a/test/emcc_O2_hello_world.fromasm.no-opts b/test/emcc_O2_hello_world.fromasm.no-opts index 4acb5bc87..618b0f593 100644 --- a/test/emcc_O2_hello_world.fromasm.no-opts +++ b/test/emcc_O2_hello_world.fromasm.no-opts @@ -10633,24 +10633,26 @@ (get_local $i6) (get_local $i8) ) - (call_indirect $FUNCSIG$iiii - (get_local $i1) - (i32.sub - (get_local $i6) - (get_local $i8) - ) - (i32.const 1) - (i32.add - (i32.and - (i32.load - (i32.add - (get_local $i1) - (i32.const 40) + (drop + (call_indirect $FUNCSIG$iiii + (get_local $i1) + (i32.sub + (get_local $i6) + (get_local $i8) + ) + (i32.const 1) + (i32.add + (i32.and + (i32.load + (i32.add + (get_local $i1) + (i32.const 40) + ) ) + (i32.const 7) ) - (i32.const 7) + (i32.const 2) ) - (i32.const 2) ) ) ) diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm index 3b93c26fd..0a40314a8 100644 --- a/test/emcc_hello_world.fromasm +++ b/test/emcc_hello_world.fromasm @@ -3081,10 +3081,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $20) - (get_local $12) - (get_local $0) + (drop + (call $___fwritex + (get_local $20) + (get_local $12) + (get_local $0) + ) ) ) ) @@ -5105,10 +5107,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $10) - (get_local $7) - (get_local $0) + (drop + (call $___fwritex + (get_local $10) + (get_local $7) + (get_local $0) + ) ) ) (call $_pad @@ -5136,10 +5140,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $27) - (get_local $1) - (get_local $0) + (drop + (call $___fwritex + (get_local $27) + (get_local $1) + (get_local $0) + ) ) ) (call $_pad @@ -5169,10 +5175,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $8) - (get_local $1) - (get_local $0) + (drop + (call $___fwritex + (get_local $8) + (get_local $1) + (get_local $0) + ) ) ) (call $_pad @@ -6633,10 +6641,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $50) - (get_local $37) - (get_local $0) + (drop + (call $___fwritex + (get_local $50) + (get_local $37) + (get_local $0) + ) ) ) (call $_pad @@ -6984,10 +6994,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $8) - (i32.const 1) - (get_local $0) + (drop + (call $___fwritex + (get_local $8) + (i32.const 1) + (get_local $0) + ) ) ) (br_if $do-once$122 @@ -7247,10 +7259,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $8) - (i32.const 3) - (get_local $0) + (drop + (call $___fwritex + (get_local $8) + (i32.const 3) + (get_local $0) + ) ) ) (call $_pad @@ -7725,10 +7739,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $62) - (get_local $5) - (get_local $0) + (drop + (call $___fwritex + (get_local $62) + (get_local $5) + (get_local $0) + ) ) ) (if @@ -7959,10 +7975,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $47) - (get_local $41) - (get_local $0) + (drop + (call $___fwritex + (get_local $47) + (get_local $41) + (get_local $0) + ) ) ) (call $_pad @@ -7991,10 +8009,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $46) - (get_local $5) - (get_local $0) + (drop + (call $___fwritex + (get_local $46) + (get_local $5) + (get_local $0) + ) ) ) (call $_pad diff --git a/test/emcc_hello_world.fromasm.imprecise b/test/emcc_hello_world.fromasm.imprecise index 0d1653a62..c13902e50 100644 --- a/test/emcc_hello_world.fromasm.imprecise +++ b/test/emcc_hello_world.fromasm.imprecise @@ -3074,10 +3074,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $20) - (get_local $12) - (get_local $0) + (drop + (call $___fwritex + (get_local $20) + (get_local $12) + (get_local $0) + ) ) ) ) @@ -5098,10 +5100,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $10) - (get_local $7) - (get_local $0) + (drop + (call $___fwritex + (get_local $10) + (get_local $7) + (get_local $0) + ) ) ) (call $_pad @@ -5129,10 +5133,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $27) - (get_local $1) - (get_local $0) + (drop + (call $___fwritex + (get_local $27) + (get_local $1) + (get_local $0) + ) ) ) (call $_pad @@ -5162,10 +5168,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $8) - (get_local $1) - (get_local $0) + (drop + (call $___fwritex + (get_local $8) + (get_local $1) + (get_local $0) + ) ) ) (call $_pad @@ -6626,10 +6634,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $50) - (get_local $37) - (get_local $0) + (drop + (call $___fwritex + (get_local $50) + (get_local $37) + (get_local $0) + ) ) ) (call $_pad @@ -6977,10 +6987,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $8) - (i32.const 1) - (get_local $0) + (drop + (call $___fwritex + (get_local $8) + (i32.const 1) + (get_local $0) + ) ) ) (br_if $do-once$122 @@ -7240,10 +7252,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $8) - (i32.const 3) - (get_local $0) + (drop + (call $___fwritex + (get_local $8) + (i32.const 3) + (get_local $0) + ) ) ) (call $_pad @@ -7718,10 +7732,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $62) - (get_local $5) - (get_local $0) + (drop + (call $___fwritex + (get_local $62) + (get_local $5) + (get_local $0) + ) ) ) (if @@ -7952,10 +7968,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $47) - (get_local $41) - (get_local $0) + (drop + (call $___fwritex + (get_local $47) + (get_local $41) + (get_local $0) + ) ) ) (call $_pad @@ -7984,10 +8002,12 @@ (i32.const 32) ) ) - (call $___fwritex - (get_local $46) - (get_local $5) - (get_local $0) + (drop + (call $___fwritex + (get_local $46) + (get_local $5) + (get_local $0) + ) ) ) (call $_pad diff --git a/test/emcc_hello_world.fromasm.imprecise.no-opts b/test/emcc_hello_world.fromasm.imprecise.no-opts index 45f19f21c..486697a52 100644 --- a/test/emcc_hello_world.fromasm.imprecise.no-opts +++ b/test/emcc_hello_world.fromasm.imprecise.no-opts @@ -6156,10 +6156,12 @@ ) (if (get_local $$tobool$i) - (call $___fwritex - (get_local $$incdec$ptr169275) - (get_local $$sub$ptr$sub) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$incdec$ptr169275) + (get_local $$sub$ptr$sub) + (get_local $$f) + ) ) ) ) @@ -9623,10 +9625,12 @@ ) (if (get_local $$tobool$i$419$i) - (call $___fwritex - (get_local $$prefix$0$add$ptr65$i) - (get_local $$add67$i) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$prefix$0$add$ptr65$i) + (get_local $$add67$i) + (get_local $$f) + ) ) ) (set_local $$xor167$i @@ -9667,10 +9671,12 @@ ) (if (get_local $$tobool$i$425$i) - (call $___fwritex - (get_local $$buf$i) - (get_local $$sub$ptr$sub172$i) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$buf$i) + (get_local $$sub$ptr$sub172$i) + (get_local $$f) + ) ) ) (set_local $$sub$ptr$rhs$cast174$i @@ -9720,10 +9726,12 @@ ) (if (get_local $$tobool$i$431$i) - (call $___fwritex - (get_local $$incdec$ptr115$i) - (get_local $$sub$ptr$sub175$i) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$incdec$ptr115$i) + (get_local $$sub$ptr$sub175$i) + (get_local $$f) + ) ) ) (set_local $$xor186$i @@ -12090,10 +12098,12 @@ ) (if (get_local $$tobool$i$437$i) - (call $___fwritex - (get_local $$prefix$0$i) - (get_local $$pl$0$i) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$prefix$0$i) + (get_local $$pl$0$i) + (get_local $$f) + ) ) ) (set_local $$xor655$i @@ -12650,10 +12660,12 @@ ) (if (get_local $$tobool$i$461$i) - (call $___fwritex - (get_local $$s753$0$i) - (i32.const 1) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$s753$0$i) + (i32.const 1) + (get_local $$f) + ) ) ) (set_local $$cmp777$i @@ -13082,10 +13094,12 @@ ) (if (get_local $$tobool$i$413$i) - (call $___fwritex - (get_local $$s35$0$i) - (i32.const 3) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$s35$0$i) + (i32.const 3) + (get_local $$f) + ) ) ) (set_local $$xor$i @@ -13839,10 +13853,12 @@ ) (if (get_local $$tobool$i$232) - (call $___fwritex - (get_local $$mb) - (get_local $$call411) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$mb) + (get_local $$call411) + (get_local $$f) + ) ) ) (set_local $$cmp404 @@ -14170,10 +14186,12 @@ ) (if (get_local $$tobool$i$245) - (call $___fwritex - (get_local $$prefix$2) - (get_local $$pl$2) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$prefix$2) + (get_local $$pl$2) + (get_local $$f) + ) ) ) (set_local $$xor449 @@ -14215,10 +14233,12 @@ ) (if (get_local $$tobool$i$217) - (call $___fwritex - (get_local $$a$2) - (get_local $$sub$ptr$sub433) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$a$2) + (get_local $$sub$ptr$sub433) + (get_local $$f) + ) ) ) (set_local $$xor457 diff --git a/test/emcc_hello_world.fromasm.no-opts b/test/emcc_hello_world.fromasm.no-opts index ea2bb8801..93f1a73cd 100644 --- a/test/emcc_hello_world.fromasm.no-opts +++ b/test/emcc_hello_world.fromasm.no-opts @@ -6162,10 +6162,12 @@ ) (if (get_local $$tobool$i) - (call $___fwritex - (get_local $$incdec$ptr169275) - (get_local $$sub$ptr$sub) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$incdec$ptr169275) + (get_local $$sub$ptr$sub) + (get_local $$f) + ) ) ) ) @@ -9629,10 +9631,12 @@ ) (if (get_local $$tobool$i$419$i) - (call $___fwritex - (get_local $$prefix$0$add$ptr65$i) - (get_local $$add67$i) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$prefix$0$add$ptr65$i) + (get_local $$add67$i) + (get_local $$f) + ) ) ) (set_local $$xor167$i @@ -9673,10 +9677,12 @@ ) (if (get_local $$tobool$i$425$i) - (call $___fwritex - (get_local $$buf$i) - (get_local $$sub$ptr$sub172$i) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$buf$i) + (get_local $$sub$ptr$sub172$i) + (get_local $$f) + ) ) ) (set_local $$sub$ptr$rhs$cast174$i @@ -9726,10 +9732,12 @@ ) (if (get_local $$tobool$i$431$i) - (call $___fwritex - (get_local $$incdec$ptr115$i) - (get_local $$sub$ptr$sub175$i) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$incdec$ptr115$i) + (get_local $$sub$ptr$sub175$i) + (get_local $$f) + ) ) ) (set_local $$xor186$i @@ -12096,10 +12104,12 @@ ) (if (get_local $$tobool$i$437$i) - (call $___fwritex - (get_local $$prefix$0$i) - (get_local $$pl$0$i) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$prefix$0$i) + (get_local $$pl$0$i) + (get_local $$f) + ) ) ) (set_local $$xor655$i @@ -12656,10 +12666,12 @@ ) (if (get_local $$tobool$i$461$i) - (call $___fwritex - (get_local $$s753$0$i) - (i32.const 1) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$s753$0$i) + (i32.const 1) + (get_local $$f) + ) ) ) (set_local $$cmp777$i @@ -13088,10 +13100,12 @@ ) (if (get_local $$tobool$i$413$i) - (call $___fwritex - (get_local $$s35$0$i) - (i32.const 3) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$s35$0$i) + (i32.const 3) + (get_local $$f) + ) ) ) (set_local $$xor$i @@ -13845,10 +13859,12 @@ ) (if (get_local $$tobool$i$232) - (call $___fwritex - (get_local $$mb) - (get_local $$call411) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$mb) + (get_local $$call411) + (get_local $$f) + ) ) ) (set_local $$cmp404 @@ -14176,10 +14192,12 @@ ) (if (get_local $$tobool$i$245) - (call $___fwritex - (get_local $$prefix$2) - (get_local $$pl$2) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$prefix$2) + (get_local $$pl$2) + (get_local $$f) + ) ) ) (set_local $$xor449 @@ -14221,10 +14239,12 @@ ) (if (get_local $$tobool$i$217) - (call $___fwritex - (get_local $$a$2) - (get_local $$sub$ptr$sub433) - (get_local $$f) + (drop + (call $___fwritex + (get_local $$a$2) + (get_local $$sub$ptr$sub433) + (get_local $$f) + ) ) ) (set_local $$xor457 diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 6544f9f33..574be4965 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -408,7 +408,9 @@ BinaryenFloat64: 4 ) (if (i32.const 4) - (i32.const 5) + (drop + (i32.const 5) + ) ) (drop (loop $in @@ -1999,7 +2001,9 @@ int main() { ) (if (i32.const 4) - (i32.const 5) + (drop + (i32.const 5) + ) ) (drop (loop $in diff --git a/test/example/c-api-kitchen-sink.txt.txt b/test/example/c-api-kitchen-sink.txt.txt index b37814f89..991c8738c 100644 --- a/test/example/c-api-kitchen-sink.txt.txt +++ b/test/example/c-api-kitchen-sink.txt.txt @@ -403,7 +403,9 @@ ) (if (i32.const 4) - (i32.const 5) + (drop + (i32.const 5) + ) ) (drop (loop $in diff --git a/test/memorygrowth.fromasm b/test/memorygrowth.fromasm index d0d1f9214..85105c556 100644 --- a/test/memorygrowth.fromasm +++ b/test/memorygrowth.fromasm @@ -9056,21 +9056,23 @@ ) ) ) - (call_indirect $FUNCSIG$iiii - (get_local $0) - (i32.sub - (get_local $2) - (get_local $6) - ) - (i32.const 1) - (i32.add - (i32.and - (i32.load offset=40 - (get_local $0) + (drop + (call_indirect $FUNCSIG$iiii + (get_local $0) + (i32.sub + (get_local $2) + (get_local $6) + ) + (i32.const 1) + (i32.add + (i32.and + (i32.load offset=40 + (get_local $0) + ) + (i32.const 3) ) - (i32.const 3) + (i32.const 2) ) - (i32.const 2) ) ) ) diff --git a/test/memorygrowth.fromasm.imprecise b/test/memorygrowth.fromasm.imprecise index ce121503e..6e3124830 100644 --- a/test/memorygrowth.fromasm.imprecise +++ b/test/memorygrowth.fromasm.imprecise @@ -9054,21 +9054,23 @@ ) ) ) - (call_indirect $FUNCSIG$iiii - (get_local $0) - (i32.sub - (get_local $2) - (get_local $6) - ) - (i32.const 1) - (i32.add - (i32.and - (i32.load offset=40 - (get_local $0) + (drop + (call_indirect $FUNCSIG$iiii + (get_local $0) + (i32.sub + (get_local $2) + (get_local $6) + ) + (i32.const 1) + (i32.add + (i32.and + (i32.load offset=40 + (get_local $0) + ) + (i32.const 3) ) - (i32.const 3) + (i32.const 2) ) - (i32.const 2) ) ) ) diff --git a/test/memorygrowth.fromasm.imprecise.no-opts b/test/memorygrowth.fromasm.imprecise.no-opts index 347eb4392..064c1d821 100644 --- a/test/memorygrowth.fromasm.imprecise.no-opts +++ b/test/memorygrowth.fromasm.imprecise.no-opts @@ -10686,24 +10686,26 @@ (get_local $f) (get_local $h) ) - (call_indirect $FUNCSIG$iiii - (get_local $a) - (i32.sub - (get_local $f) - (get_local $h) - ) - (i32.const 1) - (i32.add - (i32.and - (i32.load - (i32.add - (get_local $a) - (i32.const 40) + (drop + (call_indirect $FUNCSIG$iiii + (get_local $a) + (i32.sub + (get_local $f) + (get_local $h) + ) + (i32.const 1) + (i32.add + (i32.and + (i32.load + (i32.add + (get_local $a) + (i32.const 40) + ) ) + (i32.const 3) ) - (i32.const 3) + (i32.const 2) ) - (i32.const 2) ) ) ) diff --git a/test/memorygrowth.fromasm.no-opts b/test/memorygrowth.fromasm.no-opts index 9415b19e5..0639416ea 100644 --- a/test/memorygrowth.fromasm.no-opts +++ b/test/memorygrowth.fromasm.no-opts @@ -10687,24 +10687,26 @@ (get_local $f) (get_local $h) ) - (call_indirect $FUNCSIG$iiii - (get_local $a) - (i32.sub - (get_local $f) - (get_local $h) - ) - (i32.const 1) - (i32.add - (i32.and - (i32.load - (i32.add - (get_local $a) - (i32.const 40) + (drop + (call_indirect $FUNCSIG$iiii + (get_local $a) + (i32.sub + (get_local $f) + (get_local $h) + ) + (i32.const 1) + (i32.add + (i32.and + (i32.load + (i32.add + (get_local $a) + (i32.const 40) + ) ) + (i32.const 3) ) - (i32.const 3) + (i32.const 2) ) - (i32.const 2) ) ) ) diff --git a/test/unit.asm.js b/test/unit.asm.js index 893d29a99..721e9e8cc 100644 --- a/test/unit.asm.js +++ b/test/unit.asm.js @@ -14,6 +14,7 @@ function asm(global, env, buffer) { var abort = env.abort; var print = env.print; var h = env.h; + var return_int = env.return_int; var HEAP8 = new global.Int8Array(buffer); var HEAP16 = new global.Int16Array(buffer); @@ -364,6 +365,10 @@ function asm(global, env, buffer) { Int = x; } + function dropCallImport() { + if (1) return_int() | 0; + } + var FUNCTION_TABLE_a = [ z, big_negative, z, z ]; var FUNCTION_TABLE_b = [ w, w, importedDoubles, w ]; var FUNCTION_TABLE_c = [ z, cneg ]; diff --git a/test/unit.fromasm b/test/unit.fromasm index a1103f064..e1956de79 100644 --- a/test/unit.fromasm +++ b/test/unit.fromasm @@ -8,6 +8,7 @@ (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$dd (func (param f64) (result f64))) + (type $FUNCSIG$i (func (result i32))) (import "global" "NaN" (global $t f64)) (import "global" "Infinity" (global $u f64)) (import "env" "tempDoublePtr" (global $tempDoublePtr i32)) @@ -16,6 +17,7 @@ (import "env" "abort" (func $abort (param f64) (result f64))) (import "env" "print" (func $print (param i32))) (import "env" "h" (func $h (param i32))) + (import "env" "return_int" (func $return_int (result i32))) (import "asm2wasm" "f64-to-int" (func $f64-to-int (param f64) (result i32))) (import "asm2wasm" "f64-rem" (func $f64-rem (param f64 f64) (result f64))) (import "asm2wasm" "i32u-div" (func $i32u-div (param i32 i32) (result i32))) @@ -484,8 +486,10 @@ (get_local $1) (i32.const 3) ) - (call $lb - (i32.const 2) + (drop + (call $lb + (i32.const 2) + ) ) ) ) @@ -708,4 +712,12 @@ (get_local $0) ) ) + (func $dropCallImport + (if + (i32.const 1) + (drop + (call_import $return_int) + ) + ) + ) ) diff --git a/test/unit.fromasm.imprecise b/test/unit.fromasm.imprecise index db854cac0..017284aae 100644 --- a/test/unit.fromasm.imprecise +++ b/test/unit.fromasm.imprecise @@ -5,6 +5,7 @@ (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$dd (func (param f64) (result f64))) + (type $FUNCSIG$i (func (result i32))) (import "global" "NaN" (global $t f64)) (import "global" "Infinity" (global $u f64)) (import "env" "tempDoublePtr" (global $tempDoublePtr i32)) @@ -13,6 +14,7 @@ (import "env" "abort" (func $abort (param f64) (result f64))) (import "env" "print" (func $print (param i32))) (import "env" "h" (func $h (param i32))) + (import "env" "return_int" (func $return_int (result i32))) (import "asm2wasm" "f64-rem" (func $f64-rem (param f64 f64) (result f64))) (import "env" "memory" (memory $memory)) (import "env" "table" (table $table)) @@ -465,8 +467,10 @@ (get_local $1) (i32.const 3) ) - (call $lb - (i32.const 2) + (drop + (call $lb + (i32.const 2) + ) ) ) ) @@ -689,4 +693,12 @@ (get_local $0) ) ) + (func $dropCallImport + (if + (i32.const 1) + (drop + (call_import $return_int) + ) + ) + ) ) diff --git a/test/unit.fromasm.imprecise.no-opts b/test/unit.fromasm.imprecise.no-opts index 6c51812e4..814bc52d7 100644 --- a/test/unit.fromasm.imprecise.no-opts +++ b/test/unit.fromasm.imprecise.no-opts @@ -5,6 +5,7 @@ (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$dd (func (param f64) (result f64))) + (type $FUNCSIG$i (func (result i32))) (import "global" "NaN" (global $t f64)) (import "global" "Infinity" (global $u f64)) (import "env" "tempDoublePtr" (global $tempDoublePtr i32)) @@ -13,6 +14,7 @@ (import "env" "abort" (func $abort (param f64) (result f64))) (import "env" "print" (func $print (param i32))) (import "env" "h" (func $h (param i32))) + (import "env" "return_int" (func $return_int (result i32))) (import "asm2wasm" "f64-rem" (func $f64-rem (param f64 f64) (result f64))) (import "env" "memory" (memory $memory)) (import "env" "table" (table $table)) @@ -817,8 +819,10 @@ (get_local $y) (i32.const 3) ) - (call $lb - (i32.const 2) + (drop + (call $lb + (i32.const 2) + ) ) ) ) @@ -1140,4 +1144,12 @@ (get_local $x) ) ) + (func $dropCallImport + (if + (i32.const 1) + (drop + (call_import $return_int) + ) + ) + ) ) diff --git a/test/unit.fromasm.no-opts b/test/unit.fromasm.no-opts index 747c742dd..4205ff1f1 100644 --- a/test/unit.fromasm.no-opts +++ b/test/unit.fromasm.no-opts @@ -7,6 +7,7 @@ (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$dd (func (param f64) (result f64))) + (type $FUNCSIG$i (func (result i32))) (import "global" "NaN" (global $t f64)) (import "global" "Infinity" (global $u f64)) (import "env" "tempDoublePtr" (global $tempDoublePtr i32)) @@ -15,6 +16,7 @@ (import "env" "abort" (func $abort (param f64) (result f64))) (import "env" "print" (func $print (param i32))) (import "env" "h" (func $h (param i32))) + (import "env" "return_int" (func $return_int (result i32))) (import "asm2wasm" "f64-to-int" (func $f64-to-int (param f64) (result i32))) (import "asm2wasm" "f64-rem" (func $f64-rem (param f64 f64) (result f64))) (import "asm2wasm" "i32u-div" (func $i32u-div (param i32 i32) (result i32))) @@ -823,8 +825,10 @@ (get_local $y) (i32.const 3) ) - (call $lb - (i32.const 2) + (drop + (call $lb + (i32.const 2) + ) ) ) ) @@ -1146,4 +1150,12 @@ (get_local $x) ) ) + (func $dropCallImport + (if + (i32.const 1) + (drop + (call_import $return_int) + ) + ) + ) ) -- cgit v1.2.3 From 1775473f735f40412899676469f3d7e8fbba93dc Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 8 Sep 2016 17:20:23 -0700 Subject: optimize loop endings in RemoveUnusedBrs * rotate an if near the end of a loop as it can let a break out flow naturally and be removable * turn a br_if into an if it allows such an optimization in cases where it helps remove other structures --- src/ast_utils.h | 27 +- src/passes/RemoveUnusedBrs.cpp | 109 +- src/wasm-builder.h | 48 + test/emcc_O2_hello_world.fromasm | 1356 +++++----- test/emcc_O2_hello_world.fromasm.imprecise | 1356 +++++----- test/emcc_hello_world.fromasm | 3797 +++++++++++++--------------- test/emcc_hello_world.fromasm.imprecise | 3797 +++++++++++++--------------- test/memorygrowth.fromasm | 1329 +++++----- test/memorygrowth.fromasm.imprecise | 1329 +++++----- test/passes/remove-unused-brs.txt | 272 ++ test/passes/remove-unused-brs.wast | 201 ++ test/unit.fromasm | 24 +- test/unit.fromasm.imprecise | 24 +- 13 files changed, 6913 insertions(+), 6756 deletions(-) (limited to 'src/ast_utils.h') diff --git a/src/ast_utils.h b/src/ast_utils.h index 5deaa6a2c..6b76dd61d 100644 --- a/src/ast_utils.h +++ b/src/ast_utils.h @@ -27,7 +27,7 @@ namespace wasm { struct BreakSeeker : public PostWalker> { Name target; // look for this one XXX looking by name may fall prey to duplicate names - size_t found; + Index found; BreakSeeker(Name target) : target(target), found(false) {} @@ -47,6 +47,12 @@ struct BreakSeeker : public PostWalker> { breakSeeker.walk(tree); return breakSeeker.found > 0; } + + static Index count(Expression* tree, Name target) { + BreakSeeker breakSeeker(target); + breakSeeker.walk(tree); + return breakSeeker.found; + } }; // Finds all functions that are reachable via direct calls. @@ -391,6 +397,25 @@ struct ExpressionAnalyzer { return func->result != none; } + // Checks if a break is a simple - no condition, no value, just a plain branching + static bool isSimple(Break* curr) { + return !curr->condition && !curr->value; + } + + // Checks if an expression ends with a simple break, + // and returns a pointer to it if so. + // (It might also have other internal branches.) + static Expression* getEndingSimpleBreak(Expression* curr) { + if (auto* br = curr->dynCast()) { + if (isSimple(br)) return br; + return nullptr; + } + if (auto* block = curr->dynCast()) { + if (block->list.size() > 0) return getEndingSimpleBreak(block->list.back()); + } + return nullptr; + } + template static bool flexibleEqual(Expression* left, Expression* right, T& comparer) { std::vector nameStack; diff --git a/src/passes/RemoveUnusedBrs.cpp b/src/passes/RemoveUnusedBrs.cpp index 59d3af6fc..a7eb09669 100644 --- a/src/passes/RemoveUnusedBrs.cpp +++ b/src/passes/RemoveUnusedBrs.cpp @@ -21,6 +21,7 @@ #include #include #include +#include namespace wasm { @@ -44,6 +45,9 @@ struct RemoveUnusedBrs : public WalkerPass ifStack; + // list of all loops, so we can optimize them + std::vector loops; + static void visitAny(RemoveUnusedBrs* self, Expression** currp) { auto* curr = *currp; auto& flows = self->flows; @@ -109,7 +113,7 @@ struct RemoveUnusedBrs : public WalkerPassvalueCanFlow = false; } else { - // anything else stops the flow TODO: optimize loops? + // anything else stops the flow flows.clear(); self->valueCanFlow = false; } @@ -123,6 +127,10 @@ struct RemoveUnusedBrs : public WalkerPassifStack.push_back(std::move(self->flows)); } + void visitLoop(Loop* curr) { + loops.push_back(curr); + } + void visitIf(If* curr) { if (!curr->ifFalse) { // if without an else. try to reduce if (condition) br => br_if (condition) @@ -140,6 +148,7 @@ struct RemoveUnusedBrs : public WalkerPassname.is()) return false; + auto* block = loop->body->dynCast(); + if (!block) return false; + // does the last element break to the top of the loop? + auto& list = block->list; + if (list.size() <= 1) return false; + auto* last = list.back()->dynCast(); + if (!last || !ExpressionAnalyzer::isSimple(last) || last->name != loop->name) return false; + // last is a simple break to the top of the loop. if we can conditionalize it, + // it won't block things from flowing out and not needing breaks to do so. + Index i = list.size() - 2; + Builder builder(*getModule()); + while (1) { + auto* curr = list[i]; + if (auto* iff = curr->dynCast()) { + // let's try to move the code going to the top of the loop into the if-else + if (!iff->ifFalse) { + // we need the ifTrue to break, so it cannot reach the code we want to move + if (ExpressionAnalyzer::getEndingSimpleBreak(iff->ifTrue)) { + iff->ifFalse = builder.stealSlice(block, i + 1, list.size()); + return true; + } + } else { + // this is already an if-else. if one side is a dead end, we can append to the other, if + // there is no returned value to concern us + assert(!isConcreteWasmType(iff->type)); // can't be, since in the middle of a block + if (ExpressionAnalyzer::getEndingSimpleBreak(iff->ifTrue)) { + iff->ifFalse = builder.blockifyMerge(iff->ifFalse, builder.stealSlice(block, i + 1, list.size())); + return true; + } else if (ExpressionAnalyzer::getEndingSimpleBreak(iff->ifFalse)) { + iff->ifTrue = builder.blockifyMerge(iff->ifTrue, builder.stealSlice(block, i + 1, list.size())); + return true; + } + } + return false; + } else if (auto* brIf = curr->dynCast()) { + // br_if is similar to if. + if (brIf->condition && !brIf->value && brIf->name != loop->name) { + if (i == list.size() - 2) { + // there is the br_if, and then the br to the top, so just flip them and the condition + brIf->condition = builder.makeUnary(EqZInt32, brIf->condition); + last->name = brIf->name; + brIf->name = loop->name; + return true; + } else { + // there are elements in the middle, + // br_if $somewhere (condition) + // (..more..) + // br $in + // we can convert the br_if to an if. this has a cost, though, + // so only do it if it looks useful, which it definitely is if + // (a) $somewhere is straight out (so the br out vanishes), and + // (b) this br_if is the only branch to that block (so the block will vanish) + if (brIf->name == block->name && BreakSeeker::count(block, block->name) == 1) { + // note that we could drop the last element here, it is a br we know for sure is removable, + // but telling stealSlice to steal all to the end is more efficient, it can just truncate. + list[i] = builder.makeIf(brIf->condition, builder.makeBreak(brIf->name), builder.stealSlice(block, i + 1, list.size())); + return true; + } + } + } + return false; + } + // if there is control flow, we must stop looking + if (EffectAnalyzer(curr).branches) { + return false; + } + if (i == 0) return false; + i--; + } + } + void doWalkFunction(Function* func) { // multiple cycles may be needed bool worked = false; @@ -184,6 +286,11 @@ struct RemoveUnusedBrs : public WalkerPassdynCast(); + if (!block) { + block = makeBlock(any); + } else { + assert(!isConcreteWasmType(block->type)); + } + auto* other = append->dynCast(); + if (!other) { + block->list.push_back(append); + } else { + for (auto* item : other->list) { + block->list.push_back(item); + } + } + block->finalize(); // TODO: move out of if + return block; + } + // a helper for the common pattern of a sequence of two expressions. Similar to // blockify, but does *not* reuse a block if the first is one. Block* makeSequence(Expression* left, Expression* right) { @@ -291,6 +313,32 @@ public: block->finalize(); return block; } + + // Grab a slice out of a block, replacing it with nops, and returning + // either another block with the contents (if more than 1) or a single expression + Expression* stealSlice(Block* input, Index from, Index to) { + Expression* ret; + if (to == from + 1) { + // just one + ret = input->list[from]; + } else { + auto* block = allocator.alloc(); + for (Index i = from; i < to; i++) { + block->list.push_back(input->list[i]); + } + block->finalize(); + ret = block; + } + if (to == input->list.size()) { + input->list.resize(from); + } else { + for (Index i = from; i < to; i++) { + input->list[i] = allocator.alloc(); + } + } + input->finalize(); + return ret; + } }; } // namespace wasm diff --git a/test/emcc_O2_hello_world.fromasm b/test/emcc_O2_hello_world.fromasm index 18f533f4f..393815634 100644 --- a/test/emcc_O2_hello_world.fromasm +++ b/test/emcc_O2_hello_world.fromasm @@ -938,50 +938,47 @@ ) ) (loop $while-in$11 - (block $while-out$10 - (if - (tee_local $19 - (i32.load - (tee_local $16 - (i32.add - (get_local $8) - (i32.const 20) - ) + (if + (tee_local $19 + (i32.load + (tee_local $16 + (i32.add + (get_local $8) + (i32.const 20) ) ) ) - (block - (set_local $8 - (get_local $19) - ) - (set_local $10 - (get_local $16) - ) - (br $while-in$11) + ) + (block + (set_local $8 + (get_local $19) + ) + (set_local $10 + (get_local $16) ) + (br $while-in$11) ) - (if - (tee_local $19 - (i32.load - (tee_local $16 - (i32.add - (get_local $8) - (i32.const 16) - ) + ) + (if + (tee_local $19 + (i32.load + (tee_local $16 + (i32.add + (get_local $8) + (i32.const 16) ) ) ) - (block - (set_local $8 - (get_local $19) - ) - (set_local $10 - (get_local $16) - ) + ) + (block + (set_local $8 + (get_local $19) + ) + (set_local $10 + (get_local $16) ) - (br $while-out$10) + (br $while-in$11) ) - (br $while-in$11) ) ) (if @@ -1569,82 +1566,80 @@ (i32.const 0) ) (loop $while-in$18 - (block $while-out$17 - (if - (i32.lt_u - (tee_local $5 - (i32.sub - (tee_local $18 - (i32.and - (i32.load offset=4 - (get_local $19) - ) - (i32.const -8) + (if + (i32.lt_u + (tee_local $5 + (i32.sub + (tee_local $18 + (i32.and + (i32.load offset=4 + (get_local $19) ) + (i32.const -8) ) - (get_local $2) ) + (get_local $2) ) - (get_local $9) ) - (if - (i32.eq - (get_local $18) - (get_local $2) + (get_local $9) + ) + (if + (i32.eq + (get_local $18) + (get_local $2) + ) + (block + (set_local $27 + (get_local $5) ) - (block - (set_local $27 - (get_local $5) - ) - (set_local $25 - (get_local $19) - ) - (set_local $29 - (get_local $19) - ) - (set_local $9 - (i32.const 90) - ) - (br $label$break$L123) + (set_local $25 + (get_local $19) ) - (block - (set_local $9 - (get_local $5) - ) - (set_local $4 - (get_local $19) - ) + (set_local $29 + (get_local $19) + ) + (set_local $9 + (i32.const 90) + ) + (br $label$break$L123) + ) + (block + (set_local $9 + (get_local $5) + ) + (set_local $4 + (get_local $19) ) ) ) - (set_local $18 - (select - (get_local $8) - (tee_local $5 - (i32.load offset=20 - (get_local $19) - ) + ) + (set_local $18 + (select + (get_local $8) + (tee_local $5 + (i32.load offset=20 + (get_local $19) ) - (i32.or - (i32.eqz - (get_local $5) - ) - (i32.eq - (get_local $5) - (tee_local $19 - (i32.load + ) + (i32.or + (i32.eqz + (get_local $5) + ) + (i32.eq + (get_local $5) + (tee_local $19 + (i32.load + (i32.add (i32.add - (i32.add - (get_local $19) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $1) - (i32.const 31) - ) - (i32.const 2) + (get_local $19) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $1) + (i32.const 31) ) + (i32.const 2) ) ) ) @@ -1652,46 +1647,45 @@ ) ) ) - (if - (tee_local $5 - (i32.eqz - (get_local $19) - ) + ) + (if + (tee_local $5 + (i32.eqz + (get_local $19) ) - (block - (set_local $33 - (get_local $9) - ) - (set_local $34 - (get_local $18) - ) - (set_local $30 - (get_local $4) - ) - (set_local $9 - (i32.const 86) - ) - (br $while-out$17) + ) + (block + (set_local $33 + (get_local $9) ) - (block - (set_local $8 - (get_local $18) - ) - (set_local $1 - (i32.shl - (get_local $1) - (i32.xor - (i32.and - (get_local $5) - (i32.const 1) - ) + (set_local $34 + (get_local $18) + ) + (set_local $30 + (get_local $4) + ) + (set_local $9 + (i32.const 86) + ) + ) + (block + (set_local $8 + (get_local $18) + ) + (set_local $1 + (i32.shl + (get_local $1) + (i32.xor + (i32.and + (get_local $5) (i32.const 1) ) + (i32.const 1) ) ) ) + (br $while-in$18) ) - (br $while-in$18) ) ) ) @@ -1885,84 +1879,81 @@ (i32.const 90) ) (loop $while-in$20 - (block $while-out$19 - (set_local $9 - (i32.const 0) - ) - (set_local $1 - (i32.lt_u - (tee_local $4 - (i32.sub - (i32.and - (i32.load offset=4 - (get_local $25) - ) - (i32.const -8) + (set_local $9 + (i32.const 0) + ) + (set_local $1 + (i32.lt_u + (tee_local $4 + (i32.sub + (i32.and + (i32.load offset=4 + (get_local $25) ) - (get_local $2) + (i32.const -8) ) + (get_local $2) ) - (get_local $27) ) + (get_local $27) ) - (set_local $5 - (select - (get_local $4) - (get_local $27) - (get_local $1) - ) + ) + (set_local $5 + (select + (get_local $4) + (get_local $27) + (get_local $1) ) - (set_local $4 - (select + ) + (set_local $4 + (select + (get_local $25) + (get_local $29) + (get_local $1) + ) + ) + (if + (tee_local $1 + (i32.load offset=16 (get_local $25) - (get_local $29) - (get_local $1) ) ) - (if - (tee_local $1 - (i32.load offset=16 - (get_local $25) - ) + (block + (set_local $27 + (get_local $5) ) - (block - (set_local $27 - (get_local $5) - ) - (set_local $25 - (get_local $1) - ) - (set_local $29 - (get_local $4) - ) - (br $while-in$20) + (set_local $25 + (get_local $1) + ) + (set_local $29 + (get_local $4) ) + (br $while-in$20) ) - (if - (tee_local $25 - (i32.load offset=20 - (get_local $25) - ) + ) + (if + (tee_local $25 + (i32.load offset=20 + (get_local $25) ) - (block - (set_local $27 - (get_local $5) - ) - (set_local $29 - (get_local $4) - ) + ) + (block + (set_local $27 + (get_local $5) ) - (block - (set_local $6 - (get_local $5) - ) - (set_local $12 - (get_local $4) - ) - (br $while-out$19) + (set_local $29 + (get_local $4) + ) + (br $while-in$20) + ) + (block + (set_local $6 + (get_local $5) + ) + (set_local $12 + (get_local $4) ) ) - (br $while-in$20) ) ) ) @@ -2064,50 +2055,47 @@ ) ) (loop $while-in$24 - (block $while-out$23 - (if - (tee_local $16 - (i32.load - (tee_local $0 - (i32.add - (get_local $8) - (i32.const 20) - ) + (if + (tee_local $16 + (i32.load + (tee_local $0 + (i32.add + (get_local $8) + (i32.const 20) ) ) ) - (block - (set_local $8 - (get_local $16) - ) - (set_local $7 - (get_local $0) - ) - (br $while-in$24) + ) + (block + (set_local $8 + (get_local $16) ) + (set_local $7 + (get_local $0) + ) + (br $while-in$24) ) - (if - (tee_local $16 - (i32.load - (tee_local $0 - (i32.add - (get_local $8) - (i32.const 16) - ) + ) + (if + (tee_local $16 + (i32.load + (tee_local $0 + (i32.add + (get_local $8) + (i32.const 16) ) ) ) - (block - (set_local $8 - (get_local $16) - ) - (set_local $7 - (get_local $0) - ) + ) + (block + (set_local $8 + (get_local $16) + ) + (set_local $7 + (get_local $0) ) - (br $while-out$23) + (br $while-in$24) ) - (br $while-in$24) ) ) (if @@ -2712,6 +2700,7 @@ (set_local $1 (get_local $0) ) + (br $while-in$32) ) (block (set_local $23 @@ -2723,10 +2712,8 @@ (set_local $9 (i32.const 145) ) - (br $while-out$31) ) ) - (br $while-in$32) ) ) (if @@ -3235,13 +3222,12 @@ ) ) (if - (i32.eqz - (tee_local $14 - (i32.load offset=8 - (get_local $14) - ) + (tee_local $14 + (i32.load offset=8 + (get_local $14) ) ) + (br $while-in$38) (block (set_local $9 (i32.const 173) @@ -3249,7 +3235,6 @@ (br $label$break$L259) ) ) - (br $while-in$38) ) ) (if @@ -3876,21 +3861,16 @@ ) ) (if - (i32.eqz - (tee_local $3 - (i32.load offset=8 - (get_local $3) - ) + (tee_local $3 + (i32.load offset=8 + (get_local $3) ) ) - (block - (set_local $28 - (i32.const 624) - ) - (br $while-out$48) + (br $while-in$49) + (set_local $28 + (i32.const 624) ) ) - (br $while-in$49) ) ) (if @@ -4136,50 +4116,47 @@ ) ) (loop $while-in$56 - (block $while-out$55 - (if - (tee_local $8 - (i32.load - (tee_local $2 - (i32.add - (get_local $14) - (i32.const 20) - ) + (if + (tee_local $8 + (i32.load + (tee_local $2 + (i32.add + (get_local $14) + (i32.const 20) ) ) ) - (block - (set_local $14 - (get_local $8) - ) - (set_local $11 - (get_local $2) - ) - (br $while-in$56) + ) + (block + (set_local $14 + (get_local $8) + ) + (set_local $11 + (get_local $2) ) + (br $while-in$56) ) - (if - (tee_local $8 - (i32.load - (tee_local $2 - (i32.add - (get_local $14) - (i32.const 16) - ) + ) + (if + (tee_local $8 + (i32.load + (tee_local $2 + (i32.add + (get_local $14) + (i32.const 16) ) ) ) - (block - (set_local $14 - (get_local $8) - ) - (set_local $11 - (get_local $2) - ) + ) + (block + (set_local $14 + (get_local $8) + ) + (set_local $11 + (get_local $2) ) - (br $while-out$55) + (br $while-in$56) ) - (br $while-in$56) ) ) (if @@ -4931,6 +4908,7 @@ (set_local $1 (get_local $7) ) + (br $while-in$70) ) (block (set_local $44 @@ -4942,10 +4920,8 @@ (set_local $9 (i32.const 278) ) - (br $while-out$69) ) ) - (br $while-in$70) ) ) (if @@ -5072,43 +5048,40 @@ ) ) (loop $while-in$72 - (block $while-out$71 + (if (if - (if - (i32.le_u - (tee_local $3 - (i32.load - (get_local $28) - ) + (i32.le_u + (tee_local $3 + (i32.load + (get_local $28) ) - (get_local $13) ) - (i32.gt_u - (tee_local $15 - (i32.add - (get_local $3) - (i32.load offset=4 - (get_local $28) - ) + (get_local $13) + ) + (i32.gt_u + (tee_local $15 + (i32.add + (get_local $3) + (i32.load offset=4 + (get_local $28) ) ) - (get_local $13) - ) - (i32.const 0) - ) - (block - (set_local $5 - (get_local $15) ) - (br $while-out$71) + (get_local $13) ) + (i32.const 0) ) - (set_local $28 - (i32.load offset=8 - (get_local $28) + (set_local $5 + (get_local $15) + ) + (block + (set_local $28 + (i32.load offset=8 + (get_local $28) + ) ) + (br $while-in$72) ) - (br $while-in$72) ) ) (set_local $15 @@ -5665,6 +5638,7 @@ (set_local $1 (get_local $7) ) + (br $while-in$76) ) (block (set_local $46 @@ -5676,10 +5650,8 @@ (set_local $9 (i32.const 304) ) - (br $while-out$75) ) ) - (br $while-in$76) ) ) (if @@ -6355,58 +6327,55 @@ ) ) (loop $while-in$5 - (block $while-out$4 - (if - (tee_local $11 - (i32.load - (tee_local $5 - (i32.add - (get_local $1) - (i32.const 20) - ) + (if + (tee_local $11 + (i32.load + (tee_local $5 + (i32.add + (get_local $1) + (i32.const 20) ) ) ) - (block - (set_local $1 - (get_local $11) - ) - (set_local $6 - (get_local $5) - ) - (br $while-in$5) + ) + (block + (set_local $1 + (get_local $11) ) + (set_local $6 + (get_local $5) + ) + (br $while-in$5) ) - (if - (tee_local $11 - (i32.load - (tee_local $5 - (i32.add - (get_local $1) - (i32.const 16) - ) + ) + (if + (tee_local $11 + (i32.load + (tee_local $5 + (i32.add + (get_local $1) + (i32.const 16) ) ) ) - (block - (set_local $1 - (get_local $11) - ) - (set_local $6 - (get_local $5) - ) + ) + (block + (set_local $1 + (get_local $11) ) - (block - (set_local $5 - (get_local $1) - ) - (set_local $10 - (get_local $6) - ) - (br $while-out$4) + (set_local $6 + (get_local $5) + ) + (br $while-in$5) + ) + (block + (set_local $5 + (get_local $1) + ) + (set_local $10 + (get_local $6) ) ) - (br $while-in$5) ) ) (if @@ -6909,50 +6878,47 @@ ) ) (loop $while-in$13 - (block $while-out$12 - (if - (tee_local $11 - (i32.load - (tee_local $1 - (i32.add - (get_local $0) - (i32.const 20) - ) + (if + (tee_local $11 + (i32.load + (tee_local $1 + (i32.add + (get_local $0) + (i32.const 20) ) ) ) - (block - (set_local $0 - (get_local $11) - ) - (set_local $6 - (get_local $1) + ) + (block + (set_local $0 + (get_local $11) + ) + (set_local $6 + (get_local $1) + ) + (br $while-in$13) + ) + ) + (if + (tee_local $11 + (i32.load + (tee_local $1 + (i32.add + (get_local $0) + (i32.const 16) + ) ) - (br $while-in$13) ) ) - (if - (tee_local $11 - (i32.load - (tee_local $1 - (i32.add - (get_local $0) - (i32.const 16) - ) - ) - ) + (block + (set_local $0 + (get_local $11) ) - (block - (set_local $0 - (get_local $11) - ) - (set_local $6 - (get_local $1) - ) + (set_local $6 + (get_local $1) ) - (br $while-out$12) + (br $while-in$13) ) - (br $while-in$13) ) ) (if @@ -7660,6 +7626,7 @@ (set_local $1 (get_local $7) ) + (br $while-in$19) ) (block (set_local $18 @@ -7671,10 +7638,8 @@ (set_local $0 (i32.const 127) ) - (br $while-out$18) ) ) - (br $while-in$19) ) ) (if @@ -7810,22 +7775,21 @@ ) ) (loop $while-in$21 - (block $while-out$20 - (if - (tee_local $2 - (i32.load - (get_local $0) - ) + (if + (tee_local $2 + (i32.load + (get_local $0) ) + ) + (block (set_local $0 (i32.add (get_local $2) (i32.const 8) ) ) - (br $while-out$20) + (br $while-in$21) ) - (br $while-in$21) ) ) (i32.store @@ -8023,121 +7987,122 @@ (set_local $1 (i32.const 8) ) - (br $while-out$0) - ) - ) - (set_local $10 - (i32.sub - (get_local $5) - (get_local $6) ) - ) - (set_local $3 - (if - (i32.le_u - (get_local $6) - (tee_local $5 - (i32.load offset=4 - (get_local $4) - ) + (block + (set_local $10 + (i32.sub + (get_local $5) + (get_local $6) ) ) - (if - (i32.eq - (get_local $3) - (i32.const 2) - ) - (block - (i32.store - (get_local $9) - (i32.add - (i32.load - (get_local $9) + (set_local $3 + (if + (i32.le_u + (get_local $6) + (tee_local $5 + (i32.load offset=4 + (get_local $4) ) - (get_local $6) ) ) - (set_local $7 - (get_local $4) - ) - (set_local $15 - (i32.const 2) - ) - (get_local $5) - ) - (block - (set_local $7 - (get_local $4) - ) - (set_local $15 - (get_local $3) - ) - (get_local $5) - ) - ) - (block - (i32.store - (get_local $9) - (tee_local $7 - (i32.load - (get_local $8) + (if + (i32.eq + (get_local $3) + (i32.const 2) + ) + (block + (i32.store + (get_local $9) + (i32.add + (i32.load + (get_local $9) + ) + (get_local $6) + ) + ) + (set_local $7 + (get_local $4) + ) + (set_local $15 + (i32.const 2) + ) + (get_local $5) + ) + (block + (set_local $7 + (get_local $4) + ) + (set_local $15 + (get_local $3) + ) + (get_local $5) ) ) - ) - (i32.store - (get_local $14) - (get_local $7) - ) - (set_local $6 - (i32.sub - (get_local $6) - (get_local $5) - ) - ) - (set_local $7 - (i32.add - (get_local $4) - (i32.const 8) + (block + (i32.store + (get_local $9) + (tee_local $7 + (i32.load + (get_local $8) + ) + ) + ) + (i32.store + (get_local $14) + (get_local $7) + ) + (set_local $6 + (i32.sub + (get_local $6) + (get_local $5) + ) + ) + (set_local $7 + (i32.add + (get_local $4) + (i32.const 8) + ) + ) + (set_local $15 + (i32.add + (get_local $3) + (i32.const -1) + ) + ) + (i32.load offset=12 + (get_local $4) + ) ) ) - (set_local $15 - (i32.add - (get_local $3) - (i32.const -1) + ) + (i32.store + (get_local $7) + (i32.add + (i32.load + (get_local $7) ) + (get_local $6) ) - (i32.load offset=12 - (get_local $4) + ) + (i32.store offset=4 + (get_local $7) + (i32.sub + (get_local $3) + (get_local $6) ) ) - ) - ) - (i32.store - (get_local $7) - (i32.add - (i32.load + (set_local $4 (get_local $7) ) - (get_local $6) - ) - ) - (i32.store offset=4 - (get_local $7) - (i32.sub - (get_local $3) - (get_local $6) + (set_local $3 + (get_local $15) + ) + (set_local $5 + (get_local $10) + ) + (br $while-in$1) ) ) - (set_local $4 - (get_local $7) - ) - (set_local $3 - (get_local $15) - ) - (set_local $5 - (get_local $10) - ) - (br $while-in$1) ) ) (if @@ -8328,49 +8293,46 @@ (get_local $1) ) (loop $while-in$3 - (block $while-out$2 - (if - (i32.eqz - (get_local $3) + (if + (i32.eqz + (get_local $3) + ) + (block + (set_local $2 + (get_local $0) ) - (block - (set_local $2 - (get_local $0) - ) - (set_local $3 - (i32.const 0) - ) - (br $label$break$L10 - (get_local $1) - ) + (set_local $3 + (i32.const 0) + ) + (br $label$break$L10 + (get_local $1) ) ) - (if - (i32.eq - (i32.load8_s - (i32.add - (get_local $0) - (tee_local $7 - (i32.add - (get_local $3) - (i32.const -1) - ) + ) + (if + (i32.eq + (i32.load8_s + (i32.add + (get_local $0) + (tee_local $7 + (i32.add + (get_local $3) + (i32.const -1) ) ) ) - (i32.const 10) - ) - (block - (set_local $4 - (get_local $3) - ) - (br $while-out$2) ) + (i32.const 10) + ) + (set_local $4 + (get_local $3) + ) + (block (set_local $3 (get_local $7) ) + (br $while-in$3) ) - (br $while-in$3) ) ) (br_if $label$break$L5 @@ -8524,62 +8486,55 @@ (get_local $0) ) (loop $while-in$3 - (block $while-out$2 - (set_local $0 - (if - (i32.gt_s - (i32.load offset=76 - (get_local $1) - ) - (i32.const -1) - ) - (call $___lockfile + (set_local $0 + (if + (i32.gt_s + (i32.load offset=76 (get_local $1) ) - (i32.const 0) - ) - ) - (set_local $2 - (if - (i32.gt_u - (i32.load offset=20 - (get_local $1) - ) - (i32.load offset=28 - (get_local $1) - ) - ) - (i32.or - (call $___fflush_unlocked - (get_local $1) - ) - (get_local $2) - ) - (get_local $2) + (i32.const -1) ) - ) - (if - (get_local $0) - (call $___unlockfile + (call $___lockfile (get_local $1) ) + (i32.const 0) ) + ) + (set_local $2 (if - (i32.eqz - (tee_local $1 - (i32.load offset=56 - (get_local $1) - ) + (i32.gt_u + (i32.load offset=20 + (get_local $1) + ) + (i32.load offset=28 + (get_local $1) ) ) - (block - (set_local $0 - (get_local $2) + (i32.or + (call $___fflush_unlocked + (get_local $1) ) - (br $while-out$2) + (get_local $2) + ) + (get_local $2) + ) + ) + (if + (get_local $0) + (call $___unlockfile + (get_local $1) + ) + ) + (if + (tee_local $1 + (i32.load offset=56 + (get_local $1) ) ) (br $while-in$3) + (set_local $0 + (get_local $2) + ) ) ) ) @@ -8611,45 +8566,40 @@ (get_local $3) ) (loop $while-in$2 - (block $while-out$1 - (if - (i32.eqz - (i32.load8_s - (get_local $0) - ) + (if + (i32.eqz + (i32.load8_s + (get_local $0) ) - (block - (set_local $5 - (get_local $4) - ) - (br $label$break$L1) + ) + (block + (set_local $5 + (get_local $4) ) + (br $label$break$L1) ) - (if - (i32.eqz - (i32.and - (tee_local $4 - (tee_local $0 - (i32.add - (get_local $0) - (i32.const 1) - ) - ) + ) + (if + (i32.and + (tee_local $4 + (tee_local $0 + (i32.add + (get_local $0) + (i32.const 1) ) - (i32.const 3) - ) - ) - (block - (set_local $2 - (get_local $0) - ) - (set_local $1 - (i32.const 4) ) - (br $while-out$1) ) + (i32.const 3) ) (br $while-in$2) + (block + (set_local $2 + (get_local $0) + ) + (set_local $1 + (i32.const 4) + ) + ) ) ) ) @@ -8673,8 +8623,8 @@ (get_local $2) ) (loop $while-in$4 - (block $while-out$3 - (if + (if + (i32.eqz (i32.and (i32.xor (i32.and @@ -8692,15 +8642,16 @@ (i32.const -16843009) ) ) - (br $while-out$3) + ) + (block (set_local $1 (i32.add (get_local $1) (i32.const 4) ) ) + (br $while-in$4) ) - (br $while-in$4) ) ) (if @@ -8719,22 +8670,21 @@ (get_local $1) ) (loop $while-in$6 - (block $while-out$5 - (if - (i32.load8_s - (tee_local $1 - (i32.add - (get_local $2) - (i32.const 1) - ) + (if + (i32.load8_s + (tee_local $1 + (i32.add + (get_local $2) + (i32.const 1) ) ) + ) + (block (set_local $2 (get_local $1) ) - (br $while-out$5) + (br $while-in$6) ) - (br $while-in$6) ) ) ) @@ -9100,75 +9050,75 @@ ) ) (loop $while-in$3 - (block $while-out$2 - (br_if $while-out$2 - (i32.lt_s - (get_local $2) - (i32.const 4) - ) - ) - (i32.store - (get_local $0) - (i32.load - (get_local $1) - ) + (if + (i32.ge_s + (get_local $2) + (i32.const 4) ) - (set_local $0 - (i32.add + (block + (i32.store (get_local $0) - (i32.const 4) + (i32.load + (get_local $1) + ) ) - ) - (set_local $1 - (i32.add - (get_local $1) - (i32.const 4) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 4) + ) ) - ) - (set_local $2 - (i32.sub - (get_local $2) - (i32.const 4) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 4) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 4) + ) ) + (br $while-in$3) ) - (br $while-in$3) ) ) ) ) (loop $while-in$5 - (block $while-out$4 - (br_if $while-out$4 - (i32.le_s - (get_local $2) - (i32.const 0) - ) - ) - (i32.store8 - (get_local $0) - (i32.load8_s - (get_local $1) - ) + (if + (i32.gt_s + (get_local $2) + (i32.const 0) ) - (set_local $0 - (i32.add + (block + (i32.store8 (get_local $0) - (i32.const 1) + (i32.load8_s + (get_local $1) + ) ) - ) - (set_local $1 - (i32.add - (get_local $1) - (i32.const 1) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) ) - ) - (set_local $2 - (i32.sub - (get_local $2) - (i32.const 1) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) ) + (br $while-in$5) ) - (br $while-in$5) ) ) (get_local $3) @@ -9243,70 +9193,70 @@ ) ) (loop $while-in$1 - (block $while-out$0 - (br_if $while-out$0 - (i32.ge_s - (get_local $0) - (get_local $3) - ) - ) - (i32.store8 + (if + (i32.lt_s (get_local $0) - (get_local $1) + (get_local $3) ) - (set_local $0 - (i32.add + (block + (i32.store8 (get_local $0) - (i32.const 1) + (get_local $1) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) ) + (br $while-in$1) ) - (br $while-in$1) ) ) ) ) (loop $while-in$3 - (block $while-out$2 - (br_if $while-out$2 - (i32.ge_s - (get_local $0) - (get_local $6) - ) - ) - (i32.store + (if + (i32.lt_s (get_local $0) - (get_local $5) + (get_local $6) ) - (set_local $0 - (i32.add + (block + (i32.store (get_local $0) - (i32.const 4) + (get_local $5) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 4) + ) ) + (br $while-in$3) ) - (br $while-in$3) ) ) ) ) (loop $while-in$5 - (block $while-out$4 - (br_if $while-out$4 - (i32.ge_s - (get_local $0) - (get_local $4) - ) - ) - (i32.store8 + (if + (i32.lt_s (get_local $0) - (get_local $1) + (get_local $4) ) - (set_local $0 - (i32.add + (block + (i32.store8 (get_local $0) - (i32.const 1) + (get_local $1) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) ) + (br $while-in$5) ) - (br $while-in$5) ) ) (i32.sub diff --git a/test/emcc_O2_hello_world.fromasm.imprecise b/test/emcc_O2_hello_world.fromasm.imprecise index d4e40feb4..dc9d36780 100644 --- a/test/emcc_O2_hello_world.fromasm.imprecise +++ b/test/emcc_O2_hello_world.fromasm.imprecise @@ -936,50 +936,47 @@ ) ) (loop $while-in$11 - (block $while-out$10 - (if - (tee_local $19 - (i32.load - (tee_local $16 - (i32.add - (get_local $8) - (i32.const 20) - ) + (if + (tee_local $19 + (i32.load + (tee_local $16 + (i32.add + (get_local $8) + (i32.const 20) ) ) ) - (block - (set_local $8 - (get_local $19) - ) - (set_local $10 - (get_local $16) - ) - (br $while-in$11) + ) + (block + (set_local $8 + (get_local $19) + ) + (set_local $10 + (get_local $16) ) + (br $while-in$11) ) - (if - (tee_local $19 - (i32.load - (tee_local $16 - (i32.add - (get_local $8) - (i32.const 16) - ) + ) + (if + (tee_local $19 + (i32.load + (tee_local $16 + (i32.add + (get_local $8) + (i32.const 16) ) ) ) - (block - (set_local $8 - (get_local $19) - ) - (set_local $10 - (get_local $16) - ) + ) + (block + (set_local $8 + (get_local $19) + ) + (set_local $10 + (get_local $16) ) - (br $while-out$10) + (br $while-in$11) ) - (br $while-in$11) ) ) (if @@ -1567,82 +1564,80 @@ (i32.const 0) ) (loop $while-in$18 - (block $while-out$17 - (if - (i32.lt_u - (tee_local $5 - (i32.sub - (tee_local $18 - (i32.and - (i32.load offset=4 - (get_local $19) - ) - (i32.const -8) + (if + (i32.lt_u + (tee_local $5 + (i32.sub + (tee_local $18 + (i32.and + (i32.load offset=4 + (get_local $19) ) + (i32.const -8) ) - (get_local $2) ) + (get_local $2) ) - (get_local $9) ) - (if - (i32.eq - (get_local $18) - (get_local $2) + (get_local $9) + ) + (if + (i32.eq + (get_local $18) + (get_local $2) + ) + (block + (set_local $27 + (get_local $5) ) - (block - (set_local $27 - (get_local $5) - ) - (set_local $25 - (get_local $19) - ) - (set_local $29 - (get_local $19) - ) - (set_local $9 - (i32.const 90) - ) - (br $label$break$L123) + (set_local $25 + (get_local $19) ) - (block - (set_local $9 - (get_local $5) - ) - (set_local $4 - (get_local $19) - ) + (set_local $29 + (get_local $19) + ) + (set_local $9 + (i32.const 90) + ) + (br $label$break$L123) + ) + (block + (set_local $9 + (get_local $5) + ) + (set_local $4 + (get_local $19) ) ) ) - (set_local $18 - (select - (get_local $8) - (tee_local $5 - (i32.load offset=20 - (get_local $19) - ) + ) + (set_local $18 + (select + (get_local $8) + (tee_local $5 + (i32.load offset=20 + (get_local $19) ) - (i32.or - (i32.eqz - (get_local $5) - ) - (i32.eq - (get_local $5) - (tee_local $19 - (i32.load + ) + (i32.or + (i32.eqz + (get_local $5) + ) + (i32.eq + (get_local $5) + (tee_local $19 + (i32.load + (i32.add (i32.add - (i32.add - (get_local $19) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $1) - (i32.const 31) - ) - (i32.const 2) + (get_local $19) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $1) + (i32.const 31) ) + (i32.const 2) ) ) ) @@ -1650,46 +1645,45 @@ ) ) ) - (if - (tee_local $5 - (i32.eqz - (get_local $19) - ) + ) + (if + (tee_local $5 + (i32.eqz + (get_local $19) ) - (block - (set_local $33 - (get_local $9) - ) - (set_local $34 - (get_local $18) - ) - (set_local $30 - (get_local $4) - ) - (set_local $9 - (i32.const 86) - ) - (br $while-out$17) + ) + (block + (set_local $33 + (get_local $9) ) - (block - (set_local $8 - (get_local $18) - ) - (set_local $1 - (i32.shl - (get_local $1) - (i32.xor - (i32.and - (get_local $5) - (i32.const 1) - ) + (set_local $34 + (get_local $18) + ) + (set_local $30 + (get_local $4) + ) + (set_local $9 + (i32.const 86) + ) + ) + (block + (set_local $8 + (get_local $18) + ) + (set_local $1 + (i32.shl + (get_local $1) + (i32.xor + (i32.and + (get_local $5) (i32.const 1) ) + (i32.const 1) ) ) ) + (br $while-in$18) ) - (br $while-in$18) ) ) ) @@ -1883,84 +1877,81 @@ (i32.const 90) ) (loop $while-in$20 - (block $while-out$19 - (set_local $9 - (i32.const 0) - ) - (set_local $1 - (i32.lt_u - (tee_local $4 - (i32.sub - (i32.and - (i32.load offset=4 - (get_local $25) - ) - (i32.const -8) + (set_local $9 + (i32.const 0) + ) + (set_local $1 + (i32.lt_u + (tee_local $4 + (i32.sub + (i32.and + (i32.load offset=4 + (get_local $25) ) - (get_local $2) + (i32.const -8) ) + (get_local $2) ) - (get_local $27) ) + (get_local $27) ) - (set_local $5 - (select - (get_local $4) - (get_local $27) - (get_local $1) - ) + ) + (set_local $5 + (select + (get_local $4) + (get_local $27) + (get_local $1) ) - (set_local $4 - (select + ) + (set_local $4 + (select + (get_local $25) + (get_local $29) + (get_local $1) + ) + ) + (if + (tee_local $1 + (i32.load offset=16 (get_local $25) - (get_local $29) - (get_local $1) ) ) - (if - (tee_local $1 - (i32.load offset=16 - (get_local $25) - ) + (block + (set_local $27 + (get_local $5) ) - (block - (set_local $27 - (get_local $5) - ) - (set_local $25 - (get_local $1) - ) - (set_local $29 - (get_local $4) - ) - (br $while-in$20) + (set_local $25 + (get_local $1) + ) + (set_local $29 + (get_local $4) ) + (br $while-in$20) ) - (if - (tee_local $25 - (i32.load offset=20 - (get_local $25) - ) + ) + (if + (tee_local $25 + (i32.load offset=20 + (get_local $25) ) - (block - (set_local $27 - (get_local $5) - ) - (set_local $29 - (get_local $4) - ) + ) + (block + (set_local $27 + (get_local $5) ) - (block - (set_local $6 - (get_local $5) - ) - (set_local $12 - (get_local $4) - ) - (br $while-out$19) + (set_local $29 + (get_local $4) + ) + (br $while-in$20) + ) + (block + (set_local $6 + (get_local $5) + ) + (set_local $12 + (get_local $4) ) ) - (br $while-in$20) ) ) ) @@ -2062,50 +2053,47 @@ ) ) (loop $while-in$24 - (block $while-out$23 - (if - (tee_local $16 - (i32.load - (tee_local $0 - (i32.add - (get_local $8) - (i32.const 20) - ) + (if + (tee_local $16 + (i32.load + (tee_local $0 + (i32.add + (get_local $8) + (i32.const 20) ) ) ) - (block - (set_local $8 - (get_local $16) - ) - (set_local $7 - (get_local $0) - ) - (br $while-in$24) + ) + (block + (set_local $8 + (get_local $16) ) + (set_local $7 + (get_local $0) + ) + (br $while-in$24) ) - (if - (tee_local $16 - (i32.load - (tee_local $0 - (i32.add - (get_local $8) - (i32.const 16) - ) + ) + (if + (tee_local $16 + (i32.load + (tee_local $0 + (i32.add + (get_local $8) + (i32.const 16) ) ) ) - (block - (set_local $8 - (get_local $16) - ) - (set_local $7 - (get_local $0) - ) + ) + (block + (set_local $8 + (get_local $16) + ) + (set_local $7 + (get_local $0) ) - (br $while-out$23) + (br $while-in$24) ) - (br $while-in$24) ) ) (if @@ -2710,6 +2698,7 @@ (set_local $1 (get_local $0) ) + (br $while-in$32) ) (block (set_local $23 @@ -2721,10 +2710,8 @@ (set_local $9 (i32.const 145) ) - (br $while-out$31) ) ) - (br $while-in$32) ) ) (if @@ -3233,13 +3220,12 @@ ) ) (if - (i32.eqz - (tee_local $14 - (i32.load offset=8 - (get_local $14) - ) + (tee_local $14 + (i32.load offset=8 + (get_local $14) ) ) + (br $while-in$38) (block (set_local $9 (i32.const 173) @@ -3247,7 +3233,6 @@ (br $label$break$L259) ) ) - (br $while-in$38) ) ) (if @@ -3874,21 +3859,16 @@ ) ) (if - (i32.eqz - (tee_local $3 - (i32.load offset=8 - (get_local $3) - ) + (tee_local $3 + (i32.load offset=8 + (get_local $3) ) ) - (block - (set_local $28 - (i32.const 624) - ) - (br $while-out$48) + (br $while-in$49) + (set_local $28 + (i32.const 624) ) ) - (br $while-in$49) ) ) (if @@ -4134,50 +4114,47 @@ ) ) (loop $while-in$56 - (block $while-out$55 - (if - (tee_local $8 - (i32.load - (tee_local $2 - (i32.add - (get_local $14) - (i32.const 20) - ) + (if + (tee_local $8 + (i32.load + (tee_local $2 + (i32.add + (get_local $14) + (i32.const 20) ) ) ) - (block - (set_local $14 - (get_local $8) - ) - (set_local $11 - (get_local $2) - ) - (br $while-in$56) + ) + (block + (set_local $14 + (get_local $8) + ) + (set_local $11 + (get_local $2) ) + (br $while-in$56) ) - (if - (tee_local $8 - (i32.load - (tee_local $2 - (i32.add - (get_local $14) - (i32.const 16) - ) + ) + (if + (tee_local $8 + (i32.load + (tee_local $2 + (i32.add + (get_local $14) + (i32.const 16) ) ) ) - (block - (set_local $14 - (get_local $8) - ) - (set_local $11 - (get_local $2) - ) + ) + (block + (set_local $14 + (get_local $8) + ) + (set_local $11 + (get_local $2) ) - (br $while-out$55) + (br $while-in$56) ) - (br $while-in$56) ) ) (if @@ -4929,6 +4906,7 @@ (set_local $1 (get_local $7) ) + (br $while-in$70) ) (block (set_local $44 @@ -4940,10 +4918,8 @@ (set_local $9 (i32.const 278) ) - (br $while-out$69) ) ) - (br $while-in$70) ) ) (if @@ -5070,43 +5046,40 @@ ) ) (loop $while-in$72 - (block $while-out$71 + (if (if - (if - (i32.le_u - (tee_local $3 - (i32.load - (get_local $28) - ) + (i32.le_u + (tee_local $3 + (i32.load + (get_local $28) ) - (get_local $13) ) - (i32.gt_u - (tee_local $15 - (i32.add - (get_local $3) - (i32.load offset=4 - (get_local $28) - ) + (get_local $13) + ) + (i32.gt_u + (tee_local $15 + (i32.add + (get_local $3) + (i32.load offset=4 + (get_local $28) ) ) - (get_local $13) - ) - (i32.const 0) - ) - (block - (set_local $5 - (get_local $15) ) - (br $while-out$71) + (get_local $13) ) + (i32.const 0) ) - (set_local $28 - (i32.load offset=8 - (get_local $28) + (set_local $5 + (get_local $15) + ) + (block + (set_local $28 + (i32.load offset=8 + (get_local $28) + ) ) + (br $while-in$72) ) - (br $while-in$72) ) ) (set_local $15 @@ -5663,6 +5636,7 @@ (set_local $1 (get_local $7) ) + (br $while-in$76) ) (block (set_local $46 @@ -5674,10 +5648,8 @@ (set_local $9 (i32.const 304) ) - (br $while-out$75) ) ) - (br $while-in$76) ) ) (if @@ -6353,58 +6325,55 @@ ) ) (loop $while-in$5 - (block $while-out$4 - (if - (tee_local $11 - (i32.load - (tee_local $5 - (i32.add - (get_local $1) - (i32.const 20) - ) + (if + (tee_local $11 + (i32.load + (tee_local $5 + (i32.add + (get_local $1) + (i32.const 20) ) ) ) - (block - (set_local $1 - (get_local $11) - ) - (set_local $6 - (get_local $5) - ) - (br $while-in$5) + ) + (block + (set_local $1 + (get_local $11) ) + (set_local $6 + (get_local $5) + ) + (br $while-in$5) ) - (if - (tee_local $11 - (i32.load - (tee_local $5 - (i32.add - (get_local $1) - (i32.const 16) - ) + ) + (if + (tee_local $11 + (i32.load + (tee_local $5 + (i32.add + (get_local $1) + (i32.const 16) ) ) ) - (block - (set_local $1 - (get_local $11) - ) - (set_local $6 - (get_local $5) - ) + ) + (block + (set_local $1 + (get_local $11) ) - (block - (set_local $5 - (get_local $1) - ) - (set_local $10 - (get_local $6) - ) - (br $while-out$4) + (set_local $6 + (get_local $5) + ) + (br $while-in$5) + ) + (block + (set_local $5 + (get_local $1) + ) + (set_local $10 + (get_local $6) ) ) - (br $while-in$5) ) ) (if @@ -6907,50 +6876,47 @@ ) ) (loop $while-in$13 - (block $while-out$12 - (if - (tee_local $11 - (i32.load - (tee_local $1 - (i32.add - (get_local $0) - (i32.const 20) - ) + (if + (tee_local $11 + (i32.load + (tee_local $1 + (i32.add + (get_local $0) + (i32.const 20) ) ) ) - (block - (set_local $0 - (get_local $11) - ) - (set_local $6 - (get_local $1) + ) + (block + (set_local $0 + (get_local $11) + ) + (set_local $6 + (get_local $1) + ) + (br $while-in$13) + ) + ) + (if + (tee_local $11 + (i32.load + (tee_local $1 + (i32.add + (get_local $0) + (i32.const 16) + ) ) - (br $while-in$13) ) ) - (if - (tee_local $11 - (i32.load - (tee_local $1 - (i32.add - (get_local $0) - (i32.const 16) - ) - ) - ) + (block + (set_local $0 + (get_local $11) ) - (block - (set_local $0 - (get_local $11) - ) - (set_local $6 - (get_local $1) - ) + (set_local $6 + (get_local $1) ) - (br $while-out$12) + (br $while-in$13) ) - (br $while-in$13) ) ) (if @@ -7658,6 +7624,7 @@ (set_local $1 (get_local $7) ) + (br $while-in$19) ) (block (set_local $18 @@ -7669,10 +7636,8 @@ (set_local $0 (i32.const 127) ) - (br $while-out$18) ) ) - (br $while-in$19) ) ) (if @@ -7808,22 +7773,21 @@ ) ) (loop $while-in$21 - (block $while-out$20 - (if - (tee_local $2 - (i32.load - (get_local $0) - ) + (if + (tee_local $2 + (i32.load + (get_local $0) ) + ) + (block (set_local $0 (i32.add (get_local $2) (i32.const 8) ) ) - (br $while-out$20) + (br $while-in$21) ) - (br $while-in$21) ) ) (i32.store @@ -8021,121 +7985,122 @@ (set_local $1 (i32.const 8) ) - (br $while-out$0) - ) - ) - (set_local $10 - (i32.sub - (get_local $5) - (get_local $6) ) - ) - (set_local $3 - (if - (i32.le_u - (get_local $6) - (tee_local $5 - (i32.load offset=4 - (get_local $4) - ) + (block + (set_local $10 + (i32.sub + (get_local $5) + (get_local $6) ) ) - (if - (i32.eq - (get_local $3) - (i32.const 2) - ) - (block - (i32.store - (get_local $9) - (i32.add - (i32.load - (get_local $9) + (set_local $3 + (if + (i32.le_u + (get_local $6) + (tee_local $5 + (i32.load offset=4 + (get_local $4) ) - (get_local $6) ) ) - (set_local $7 - (get_local $4) - ) - (set_local $15 - (i32.const 2) - ) - (get_local $5) - ) - (block - (set_local $7 - (get_local $4) - ) - (set_local $15 - (get_local $3) - ) - (get_local $5) - ) - ) - (block - (i32.store - (get_local $9) - (tee_local $7 - (i32.load - (get_local $8) + (if + (i32.eq + (get_local $3) + (i32.const 2) + ) + (block + (i32.store + (get_local $9) + (i32.add + (i32.load + (get_local $9) + ) + (get_local $6) + ) + ) + (set_local $7 + (get_local $4) + ) + (set_local $15 + (i32.const 2) + ) + (get_local $5) + ) + (block + (set_local $7 + (get_local $4) + ) + (set_local $15 + (get_local $3) + ) + (get_local $5) ) ) - ) - (i32.store - (get_local $14) - (get_local $7) - ) - (set_local $6 - (i32.sub - (get_local $6) - (get_local $5) - ) - ) - (set_local $7 - (i32.add - (get_local $4) - (i32.const 8) + (block + (i32.store + (get_local $9) + (tee_local $7 + (i32.load + (get_local $8) + ) + ) + ) + (i32.store + (get_local $14) + (get_local $7) + ) + (set_local $6 + (i32.sub + (get_local $6) + (get_local $5) + ) + ) + (set_local $7 + (i32.add + (get_local $4) + (i32.const 8) + ) + ) + (set_local $15 + (i32.add + (get_local $3) + (i32.const -1) + ) + ) + (i32.load offset=12 + (get_local $4) + ) ) ) - (set_local $15 - (i32.add - (get_local $3) - (i32.const -1) + ) + (i32.store + (get_local $7) + (i32.add + (i32.load + (get_local $7) ) + (get_local $6) ) - (i32.load offset=12 - (get_local $4) + ) + (i32.store offset=4 + (get_local $7) + (i32.sub + (get_local $3) + (get_local $6) ) ) - ) - ) - (i32.store - (get_local $7) - (i32.add - (i32.load + (set_local $4 (get_local $7) ) - (get_local $6) - ) - ) - (i32.store offset=4 - (get_local $7) - (i32.sub - (get_local $3) - (get_local $6) + (set_local $3 + (get_local $15) + ) + (set_local $5 + (get_local $10) + ) + (br $while-in$1) ) ) - (set_local $4 - (get_local $7) - ) - (set_local $3 - (get_local $15) - ) - (set_local $5 - (get_local $10) - ) - (br $while-in$1) ) ) (if @@ -8326,49 +8291,46 @@ (get_local $1) ) (loop $while-in$3 - (block $while-out$2 - (if - (i32.eqz - (get_local $3) + (if + (i32.eqz + (get_local $3) + ) + (block + (set_local $2 + (get_local $0) ) - (block - (set_local $2 - (get_local $0) - ) - (set_local $3 - (i32.const 0) - ) - (br $label$break$L10 - (get_local $1) - ) + (set_local $3 + (i32.const 0) + ) + (br $label$break$L10 + (get_local $1) ) ) - (if - (i32.eq - (i32.load8_s - (i32.add - (get_local $0) - (tee_local $7 - (i32.add - (get_local $3) - (i32.const -1) - ) + ) + (if + (i32.eq + (i32.load8_s + (i32.add + (get_local $0) + (tee_local $7 + (i32.add + (get_local $3) + (i32.const -1) ) ) ) - (i32.const 10) - ) - (block - (set_local $4 - (get_local $3) - ) - (br $while-out$2) ) + (i32.const 10) + ) + (set_local $4 + (get_local $3) + ) + (block (set_local $3 (get_local $7) ) + (br $while-in$3) ) - (br $while-in$3) ) ) (br_if $label$break$L5 @@ -8522,62 +8484,55 @@ (get_local $0) ) (loop $while-in$3 - (block $while-out$2 - (set_local $0 - (if - (i32.gt_s - (i32.load offset=76 - (get_local $1) - ) - (i32.const -1) - ) - (call $___lockfile + (set_local $0 + (if + (i32.gt_s + (i32.load offset=76 (get_local $1) ) - (i32.const 0) - ) - ) - (set_local $2 - (if - (i32.gt_u - (i32.load offset=20 - (get_local $1) - ) - (i32.load offset=28 - (get_local $1) - ) - ) - (i32.or - (call $___fflush_unlocked - (get_local $1) - ) - (get_local $2) - ) - (get_local $2) + (i32.const -1) ) - ) - (if - (get_local $0) - (call $___unlockfile + (call $___lockfile (get_local $1) ) + (i32.const 0) ) + ) + (set_local $2 (if - (i32.eqz - (tee_local $1 - (i32.load offset=56 - (get_local $1) - ) + (i32.gt_u + (i32.load offset=20 + (get_local $1) + ) + (i32.load offset=28 + (get_local $1) ) ) - (block - (set_local $0 - (get_local $2) + (i32.or + (call $___fflush_unlocked + (get_local $1) ) - (br $while-out$2) + (get_local $2) + ) + (get_local $2) + ) + ) + (if + (get_local $0) + (call $___unlockfile + (get_local $1) + ) + ) + (if + (tee_local $1 + (i32.load offset=56 + (get_local $1) ) ) (br $while-in$3) + (set_local $0 + (get_local $2) + ) ) ) ) @@ -8609,45 +8564,40 @@ (get_local $3) ) (loop $while-in$2 - (block $while-out$1 - (if - (i32.eqz - (i32.load8_s - (get_local $0) - ) + (if + (i32.eqz + (i32.load8_s + (get_local $0) ) - (block - (set_local $5 - (get_local $4) - ) - (br $label$break$L1) + ) + (block + (set_local $5 + (get_local $4) ) + (br $label$break$L1) ) - (if - (i32.eqz - (i32.and - (tee_local $4 - (tee_local $0 - (i32.add - (get_local $0) - (i32.const 1) - ) - ) + ) + (if + (i32.and + (tee_local $4 + (tee_local $0 + (i32.add + (get_local $0) + (i32.const 1) ) - (i32.const 3) - ) - ) - (block - (set_local $2 - (get_local $0) - ) - (set_local $1 - (i32.const 4) ) - (br $while-out$1) ) + (i32.const 3) ) (br $while-in$2) + (block + (set_local $2 + (get_local $0) + ) + (set_local $1 + (i32.const 4) + ) + ) ) ) ) @@ -8671,8 +8621,8 @@ (get_local $2) ) (loop $while-in$4 - (block $while-out$3 - (if + (if + (i32.eqz (i32.and (i32.xor (i32.and @@ -8690,15 +8640,16 @@ (i32.const -16843009) ) ) - (br $while-out$3) + ) + (block (set_local $1 (i32.add (get_local $1) (i32.const 4) ) ) + (br $while-in$4) ) - (br $while-in$4) ) ) (if @@ -8717,22 +8668,21 @@ (get_local $1) ) (loop $while-in$6 - (block $while-out$5 - (if - (i32.load8_s - (tee_local $1 - (i32.add - (get_local $2) - (i32.const 1) - ) + (if + (i32.load8_s + (tee_local $1 + (i32.add + (get_local $2) + (i32.const 1) ) ) + ) + (block (set_local $2 (get_local $1) ) - (br $while-out$5) + (br $while-in$6) ) - (br $while-in$6) ) ) ) @@ -9098,75 +9048,75 @@ ) ) (loop $while-in$3 - (block $while-out$2 - (br_if $while-out$2 - (i32.lt_s - (get_local $2) - (i32.const 4) - ) - ) - (i32.store - (get_local $0) - (i32.load - (get_local $1) - ) + (if + (i32.ge_s + (get_local $2) + (i32.const 4) ) - (set_local $0 - (i32.add + (block + (i32.store (get_local $0) - (i32.const 4) + (i32.load + (get_local $1) + ) ) - ) - (set_local $1 - (i32.add - (get_local $1) - (i32.const 4) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 4) + ) ) - ) - (set_local $2 - (i32.sub - (get_local $2) - (i32.const 4) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 4) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 4) + ) ) + (br $while-in$3) ) - (br $while-in$3) ) ) ) ) (loop $while-in$5 - (block $while-out$4 - (br_if $while-out$4 - (i32.le_s - (get_local $2) - (i32.const 0) - ) - ) - (i32.store8 - (get_local $0) - (i32.load8_s - (get_local $1) - ) + (if + (i32.gt_s + (get_local $2) + (i32.const 0) ) - (set_local $0 - (i32.add + (block + (i32.store8 (get_local $0) - (i32.const 1) + (i32.load8_s + (get_local $1) + ) ) - ) - (set_local $1 - (i32.add - (get_local $1) - (i32.const 1) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) ) - ) - (set_local $2 - (i32.sub - (get_local $2) - (i32.const 1) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) ) + (br $while-in$5) ) - (br $while-in$5) ) ) (get_local $3) @@ -9241,70 +9191,70 @@ ) ) (loop $while-in$1 - (block $while-out$0 - (br_if $while-out$0 - (i32.ge_s - (get_local $0) - (get_local $3) - ) - ) - (i32.store8 + (if + (i32.lt_s (get_local $0) - (get_local $1) + (get_local $3) ) - (set_local $0 - (i32.add + (block + (i32.store8 (get_local $0) - (i32.const 1) + (get_local $1) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) ) + (br $while-in$1) ) - (br $while-in$1) ) ) ) ) (loop $while-in$3 - (block $while-out$2 - (br_if $while-out$2 - (i32.ge_s - (get_local $0) - (get_local $6) - ) - ) - (i32.store + (if + (i32.lt_s (get_local $0) - (get_local $5) + (get_local $6) ) - (set_local $0 - (i32.add + (block + (i32.store (get_local $0) - (i32.const 4) + (get_local $5) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 4) + ) ) + (br $while-in$3) ) - (br $while-in$3) ) ) ) ) (loop $while-in$5 - (block $while-out$4 - (br_if $while-out$4 - (i32.ge_s - (get_local $0) - (get_local $4) - ) - ) - (i32.store8 + (if + (i32.lt_s (get_local $0) - (get_local $1) + (get_local $4) ) - (set_local $0 - (i32.add + (block + (i32.store8 (get_local $0) - (i32.const 1) + (get_local $1) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) ) + (br $while-in$5) ) - (br $while-in$5) ) ) (i32.sub diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm index ecf5b9b94..b9f940d52 100644 --- a/test/emcc_hello_world.fromasm +++ b/test/emcc_hello_world.fromasm @@ -422,10 +422,9 @@ (set_local $0 (i32.const 5) ) - (br $while-out$0) ) + (br $while-in$1) ) - (br $while-in$1) ) ) (if @@ -457,55 +456,47 @@ (i32.const 5) ) (loop $while-in$3 - (block $while-out$2 - (loop $while-in$5 - (block $while-out$4 - (set_local $0 - (i32.add - (get_local $2) - (i32.const 1) - ) - ) - (if - (i32.load8_s - (get_local $2) - ) - (set_local $2 - (get_local $0) - ) - (block - (set_local $1 - (get_local $0) - ) - (br $while-out$4) - ) - ) - (br $while-in$5) + (loop $while-in$5 + (set_local $0 + (i32.add + (get_local $2) + (i32.const 1) ) ) (if - (tee_local $0 - (i32.add - (get_local $3) - (i32.const -1) - ) + (i32.load8_s + (get_local $2) ) (block - (set_local $3 - (get_local $0) - ) (set_local $2 - (get_local $1) + (get_local $0) ) + (br $while-in$5) ) - (block - (set_local $5 - (get_local $1) - ) - (br $while-out$2) + (set_local $1 + (get_local $0) + ) + ) + ) + (if + (tee_local $0 + (i32.add + (get_local $3) + (i32.const -1) + ) + ) + (block + (set_local $3 + (get_local $0) + ) + (set_local $2 + (get_local $1) ) + (br $while-in$3) + ) + (set_local $5 + (get_local $1) ) - (br $while-in$3) ) ) ) @@ -790,63 +781,60 @@ (get_local $0) ) (loop $while-in$3 - (block $while-out$2 - (set_local $0 - (if - (i32.gt_s - (i32.load offset=76 - (get_local $1) - ) - (i32.const -1) - ) - (call $___lockfile + (set_local $0 + (if + (i32.gt_s + (i32.load offset=76 (get_local $1) ) - (i32.const 0) + (i32.const -1) + ) + (call $___lockfile + (get_local $1) ) + (i32.const 0) ) - (set_local $2 - (if - (i32.gt_u - (i32.load offset=20 - (get_local $1) - ) - (i32.load offset=28 - (get_local $1) - ) + ) + (set_local $2 + (if + (i32.gt_u + (i32.load offset=20 + (get_local $1) ) - (i32.or - (call $___fflush_unlocked - (get_local $1) - ) - (get_local $2) + (i32.load offset=28 + (get_local $1) + ) + ) + (i32.or + (call $___fflush_unlocked + (get_local $1) ) (get_local $2) ) + (get_local $2) ) - (if - (get_local $0) - (call $___unlockfile + ) + (if + (get_local $0) + (call $___unlockfile + (get_local $1) + ) + ) + (if + (tee_local $0 + (i32.load offset=56 (get_local $1) ) ) - (if - (tee_local $0 - (i32.load offset=56 - (get_local $1) - ) - ) + (block (set_local $1 (get_local $0) ) - (block - (set_local $0 - (get_local $2) - ) - (br $while-out$2) - ) + (br $while-in$3) + ) + (set_local $0 + (get_local $2) ) - (br $while-in$3) ) ) ) @@ -1097,115 +1085,116 @@ (set_local $1 (i32.const 8) ) - (br $while-out$0) - ) - ) - (set_local $17 - (i32.sub - (get_local $3) - (get_local $5) ) - ) - (set_local $1 - (if - (i32.gt_u - (get_local $5) - (tee_local $1 - (i32.load offset=4 - (get_local $4) - ) + (block + (set_local $17 + (i32.sub + (get_local $3) + (get_local $5) ) ) - (block - (i32.store - (get_local $7) - (tee_local $3 - (i32.load - (get_local $13) + (set_local $1 + (if + (i32.gt_u + (get_local $5) + (tee_local $1 + (i32.load offset=4 + (get_local $4) + ) ) ) - ) - (i32.store - (get_local $11) - (get_local $3) - ) - (set_local $5 - (i32.sub - (get_local $5) - (get_local $1) + (block + (i32.store + (get_local $7) + (tee_local $3 + (i32.load + (get_local $13) + ) + ) + ) + (i32.store + (get_local $11) + (get_local $3) + ) + (set_local $5 + (i32.sub + (get_local $5) + (get_local $1) + ) + ) + (set_local $3 + (i32.add + (get_local $4) + (i32.const 8) + ) + ) + (set_local $6 + (i32.add + (get_local $6) + (i32.const -1) + ) + ) + (i32.load offset=12 + (get_local $4) + ) ) - ) - (set_local $3 - (i32.add - (get_local $4) - (i32.const 8) + (if + (i32.eq + (get_local $6) + (i32.const 2) + ) + (block + (i32.store + (get_local $7) + (i32.add + (i32.load + (get_local $7) + ) + (get_local $5) + ) + ) + (set_local $3 + (get_local $4) + ) + (set_local $6 + (i32.const 2) + ) + (get_local $1) + ) + (block + (set_local $3 + (get_local $4) + ) + (get_local $1) + ) ) ) - (set_local $6 - (i32.add - (get_local $6) - (i32.const -1) + ) + (i32.store + (get_local $3) + (i32.add + (i32.load + (get_local $3) ) + (get_local $5) ) - (i32.load offset=12 - (get_local $4) + ) + (i32.store offset=4 + (get_local $3) + (i32.sub + (get_local $1) + (get_local $5) ) ) - (if - (i32.eq - (get_local $6) - (i32.const 2) - ) - (block - (i32.store - (get_local $7) - (i32.add - (i32.load - (get_local $7) - ) - (get_local $5) - ) - ) - (set_local $3 - (get_local $4) - ) - (set_local $6 - (i32.const 2) - ) - (get_local $1) - ) - (block - (set_local $3 - (get_local $4) - ) - (get_local $1) - ) - ) - ) - ) - (i32.store - (get_local $3) - (i32.add - (i32.load + (set_local $4 (get_local $3) ) - (get_local $5) - ) - ) - (i32.store offset=4 - (get_local $3) - (i32.sub - (get_local $1) - (get_local $5) + (set_local $3 + (get_local $17) + ) + (br $while-in$1) ) ) - (set_local $4 - (get_local $3) - ) - (set_local $3 - (get_local $17) - ) - (br $while-in$1) ) ) (if @@ -1691,41 +1680,40 @@ (get_local $1) ) (loop $while-in$3 - (block $while-out$2 - (if - (i32.eqz - (get_local $3) + (if + (i32.eqz + (get_local $3) + ) + (block + (set_local $2 + (i32.const 0) ) - (block - (set_local $2 - (i32.const 0) - ) - (br $label$break$L10 - (get_local $4) - ) + (br $label$break$L10 + (get_local $4) ) ) - (if - (i32.eq - (i32.load8_s - (i32.add - (get_local $0) - (tee_local $6 - (i32.add - (get_local $3) - (i32.const -1) - ) + ) + (if + (i32.ne + (i32.load8_s + (i32.add + (get_local $0) + (tee_local $6 + (i32.add + (get_local $3) + (i32.const -1) ) ) ) - (i32.const 10) ) - (br $while-out$2) + (i32.const 10) + ) + (block (set_local $3 (get_local $6) ) + (br $while-in$3) ) - (br $while-in$3) ) ) (if @@ -2150,79 +2138,78 @@ (get_local $0) ) (loop $while-in$2 - (block $while-out$1 - (if - (i32.eq - (i32.load8_s - (get_local $2) - ) - (i32.shr_s - (i32.shl - (get_local $5) - (i32.const 24) - ) + (if + (i32.eq + (i32.load8_s + (get_local $2) + ) + (i32.shr_s + (i32.shl + (get_local $5) (i32.const 24) ) + (i32.const 24) ) - (block - (set_local $4 - (get_local $3) - ) - (set_local $6 - (get_local $2) - ) - (set_local $3 - (i32.const 6) - ) - (br $label$break$L1) + ) + (block + (set_local $4 + (get_local $3) + ) + (set_local $6 + (get_local $2) ) + (set_local $3 + (i32.const 6) + ) + (br $label$break$L1) ) - (if - (i32.and - (tee_local $3 - (i32.ne - (tee_local $0 - (i32.add - (get_local $3) - (i32.const -1) - ) + ) + (if + (i32.and + (tee_local $3 + (i32.ne + (tee_local $0 + (i32.add + (get_local $3) + (i32.const -1) ) - (i32.const 0) ) + (i32.const 0) ) - (i32.ne - (i32.and - (tee_local $2 - (i32.add - (get_local $2) - (i32.const 1) - ) + ) + (i32.ne + (i32.and + (tee_local $2 + (i32.add + (get_local $2) + (i32.const 1) ) - (i32.const 3) ) - (i32.const 0) + (i32.const 3) ) + (i32.const 0) ) + ) + (block (set_local $3 (get_local $0) ) - (block - (set_local $14 - (get_local $0) - ) - (set_local $11 - (get_local $2) - ) - (set_local $15 - (get_local $3) - ) - (set_local $3 - (i32.const 5) - ) - (br $while-out$1) + (br $while-in$2) + ) + (block + (set_local $14 + (get_local $0) + ) + (set_local $11 + (get_local $2) + ) + (set_local $15 + (get_local $3) + ) + (set_local $3 + (i32.const 5) ) ) - (br $while-in$2) ) ) ) @@ -2350,7 +2337,7 @@ ) ) (if - (i32.le_u + (i32.gt_u (tee_local $4 (i32.add (get_local $4) @@ -2359,6 +2346,7 @@ ) (i32.const 3) ) + (br $while-in$6) (block (set_local $12 (get_local $4) @@ -2372,7 +2360,6 @@ (br $label$break$L11) ) ) - (br $while-in$6) ) ) (set_local $10 @@ -2422,62 +2409,59 @@ ) ) (loop $while-in$8 - (block $while-out$7 - (if - (i32.eq - (i32.load8_s - (get_local $9) - ) - (i32.shr_s - (i32.shl - (get_local $0) - (i32.const 24) - ) + (if + (i32.eq + (i32.load8_s + (get_local $9) + ) + (i32.shr_s + (i32.shl + (get_local $0) (i32.const 24) ) + (i32.const 24) ) - (block - (set_local $7 - (get_local $10) - ) - (set_local $8 - (get_local $9) - ) - (br $label$break$L8) + ) + (block + (set_local $7 + (get_local $10) + ) + (set_local $8 + (get_local $9) ) + (br $label$break$L8) ) - (set_local $2 + ) + (set_local $2 + (i32.add + (get_local $9) + (i32.const 1) + ) + ) + (if + (tee_local $1 (i32.add - (get_local $9) - (i32.const 1) + (get_local $10) + (i32.const -1) ) ) - (if - (tee_local $1 - (i32.add - (get_local $10) - (i32.const -1) - ) + (block + (set_local $10 + (get_local $1) ) - (block - (set_local $10 - (get_local $1) - ) - (set_local $9 - (get_local $2) - ) + (set_local $9 + (get_local $2) ) - (block - (set_local $7 - (i32.const 0) - ) - (set_local $8 - (get_local $2) - ) - (br $while-out$7) + (br $while-in$8) + ) + (block + (set_local $7 + (i32.const 0) + ) + (set_local $8 + (get_local $2) ) ) - (br $while-in$8) ) ) ) @@ -3002,64 +2986,61 @@ (i32.const 9) ) (loop $while-in$8 - (block $while-out$7 - (set_local $11 - (i32.const 0) - ) - (if - (i32.ne - (i32.load8_s offset=1 - (get_local $53) - ) - (i32.const 37) - ) - (block - (set_local $39 - (get_local $53) - ) - (set_local $54 - (get_local $64) - ) - (br $label$break$L12) + (set_local $11 + (i32.const 0) + ) + (if + (i32.ne + (i32.load8_s offset=1 + (get_local $53) ) + (i32.const 37) ) - (set_local $5 - (i32.add + (block + (set_local $39 + (get_local $53) + ) + (set_local $54 (get_local $64) - (i32.const 1) ) + (br $label$break$L12) ) - (if - (i32.eq - (i32.load8_s - (tee_local $1 - (i32.add - (get_local $53) - (i32.const 2) - ) + ) + (set_local $5 + (i32.add + (get_local $64) + (i32.const 1) + ) + ) + (if + (i32.eq + (i32.load8_s + (tee_local $1 + (i32.add + (get_local $53) + (i32.const 2) ) ) - (i32.const 37) ) - (block - (set_local $53 - (get_local $1) - ) - (set_local $64 - (get_local $5) - ) + (i32.const 37) + ) + (block + (set_local $53 + (get_local $1) ) - (block - (set_local $39 - (get_local $1) - ) - (set_local $54 - (get_local $5) - ) - (br $while-out$7) + (set_local $64 + (get_local $5) + ) + (br $while-in$8) + ) + (block + (set_local $39 + (get_local $1) + ) + (set_local $54 + (get_local $5) ) ) - (br $while-in$8) ) ) ) @@ -3202,75 +3183,72 @@ (i32.const 0) ) (loop $while-in$11 - (block $while-out$10 - (br_if $label$break$L25 - (i32.eqz - (i32.and - (i32.shl - (i32.const 1) - (i32.add - (get_local $5) - (i32.const -32) - ) + (br_if $label$break$L25 + (i32.eqz + (i32.and + (i32.shl + (i32.const 1) + (i32.add + (get_local $5) + (i32.const -32) ) - (i32.const 75913) ) + (i32.const 75913) ) ) - (set_local $8 - (i32.or - (i32.shl - (i32.const 1) - (i32.add - (i32.shr_s - (i32.shl - (get_local $1) - (i32.const 24) - ) + ) + (set_local $8 + (i32.or + (i32.shl + (i32.const 1) + (i32.add + (i32.shr_s + (i32.shl + (get_local $1) (i32.const 24) ) - (i32.const -32) + (i32.const 24) ) + (i32.const -32) ) - (get_local $8) ) + (get_local $8) ) - (if - (i32.eq - (i32.and - (tee_local $5 - (i32.shr_s - (i32.shl - (tee_local $1 - (i32.load8_s - (tee_local $6 - (i32.add - (get_local $10) - (i32.const 1) - ) + ) + (if + (i32.eq + (i32.and + (tee_local $5 + (i32.shr_s + (i32.shl + (tee_local $1 + (i32.load8_s + (tee_local $6 + (i32.add + (get_local $10) + (i32.const 1) ) ) ) - (i32.const 24) ) (i32.const 24) ) + (i32.const 24) ) - (i32.const -32) ) - (i32.const 32) + (i32.const -32) ) + (i32.const 32) + ) + (block (set_local $10 (get_local $6) ) - (block - (set_local $10 - (get_local $6) - ) - (br $while-out$10) - ) + (br $while-in$11) + ) + (set_local $10 + (get_local $6) ) - (br $while-in$11) ) ) ) @@ -3495,35 +3473,32 @@ (i32.const 0) ) (loop $while-in$15 - (block $while-out$14 - (set_local $5 - (i32.add - (i32.mul - (get_local $5) - (i32.const 10) - ) - (get_local $6) + (set_local $5 + (i32.add + (i32.mul + (get_local $5) + (i32.const 10) ) + (get_local $6) ) - (br_if $while-out$14 - (i32.ge_u - (tee_local $6 - (i32.add - (i32.load8_s - (tee_local $1 - (i32.add - (get_local $1) - (i32.const 1) - ) + ) + (br_if $while-in$15 + (i32.lt_u + (tee_local $6 + (i32.add + (i32.load8_s + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) ) ) - (i32.const -48) ) + (i32.const -48) ) - (i32.const 10) ) + (i32.const 10) ) - (br $while-in$15) ) ) (if @@ -3636,7 +3611,7 @@ ) ) (if - (i32.ge_u + (i32.lt_u (tee_local $6 (i32.add (i32.load8_s @@ -3652,6 +3627,7 @@ ) (i32.const 10) ) + (br $while-in$18) (block (set_local $9 (get_local $5) @@ -3661,7 +3637,6 @@ ) ) ) - (br $while-in$18) ) ) ) @@ -3788,74 +3763,69 @@ (i32.const 0) ) (loop $while-in$20 - (block $while-out$19 - (if - (i32.gt_u - (tee_local $1 - (i32.add - (i32.load8_s - (get_local $13) - ) - (i32.const -65) + (if + (i32.gt_u + (tee_local $1 + (i32.add + (i32.load8_s + (get_local $13) ) + (i32.const -65) ) - (i32.const 57) - ) - (block - (set_local $23 - (i32.const -1) - ) - (br $label$break$L1) ) + (i32.const 57) ) - (set_local $10 - (i32.add - (get_local $13) - (i32.const 1) + (block + (set_local $23 + (i32.const -1) ) + (br $label$break$L1) ) - (if - (i32.lt_u - (i32.add - (tee_local $5 - (i32.and - (tee_local $1 - (i32.load8_s + ) + (set_local $10 + (i32.add + (get_local $13) + (i32.const 1) + ) + ) + (if + (i32.lt_u + (i32.add + (tee_local $5 + (i32.and + (tee_local $1 + (i32.load8_s + (i32.add (i32.add - (i32.add - (i32.const 3611) - (i32.mul - (get_local $14) - (i32.const 58) - ) + (i32.const 3611) + (i32.mul + (get_local $14) + (i32.const 58) ) - (get_local $1) ) + (get_local $1) ) ) - (i32.const 255) ) + (i32.const 255) ) - (i32.const -1) ) - (i32.const 8) + (i32.const -1) ) - (block - (set_local $13 - (get_local $10) - ) - (set_local $14 - (get_local $5) - ) + (i32.const 8) + ) + (block + (set_local $13 + (get_local $10) ) - (block - (set_local $6 - (get_local $5) - ) - (br $while-out$19) + (set_local $14 + (get_local $5) ) + (br $while-in$20) + ) + (set_local $6 + (get_local $5) ) - (br $while-in$20) ) ) (if @@ -4304,26 +4274,26 @@ (get_local $26) ) (loop $while-in$39 - (block $while-out$38 - (i32.store8 - (tee_local $6 - (i32.add - (get_local $6) - (i32.const -1) - ) + (i32.store8 + (tee_local $6 + (i32.add + (get_local $6) + (i32.const -1) ) - (i32.and - (i32.or - (i32.and - (get_local $5) - (i32.const 7) - ) - (i32.const 48) + ) + (i32.and + (i32.or + (i32.and + (get_local $5) + (i32.const 7) ) - (i32.const 255) + (i32.const 48) ) + (i32.const 255) ) - (br_if $while-out$38 + ) + (br_if $while-in$39 + (i32.eqz (i32.and (i32.eqz (tee_local $5 @@ -4341,7 +4311,6 @@ ) ) ) - (br $while-in$39) ) ) ) @@ -4818,24 +4787,19 @@ (f64.const 8) ) (loop $while-in$61 - (block $while-out$60 - (set_local $28 - (f64.mul - (get_local $28) - (f64.const 16) - ) + (set_local $28 + (f64.mul + (get_local $28) + (f64.const 16) ) - (br_if $while-out$60 - (i32.eqz - (tee_local $1 - (i32.add - (get_local $1) - (i32.const -1) - ) - ) + ) + (br_if $while-in$61 + (tee_local $1 + (i32.add + (get_local $1) + (i32.const -1) ) ) - (br $while-in$61) ) ) (select @@ -4965,95 +4929,90 @@ (get_local $27) ) (loop $while-in$63 - (block $while-out$62 - (i32.store8 - (get_local $13) - (i32.and - (i32.or - (i32.and - (i32.load8_s - (i32.add - (tee_local $1 - (call_import $f64-to-int - (get_local $15) - ) + (i32.store8 + (get_local $13) + (i32.and + (i32.or + (i32.and + (i32.load8_s + (i32.add + (tee_local $1 + (call_import $f64-to-int + (get_local $15) ) - (i32.const 4075) ) + (i32.const 4075) ) - (i32.const 255) ) - (get_local $6) + (i32.const 255) ) - (i32.const 255) + (get_local $6) ) + (i32.const 255) ) - (set_local $15 - (f64.mul - (f64.sub - (get_local $15) - (f64.convert_s/i32 - (get_local $1) - ) + ) + (set_local $15 + (f64.mul + (f64.sub + (get_local $15) + (f64.convert_s/i32 + (get_local $1) ) - (f64.const 16) ) + (f64.const 16) ) - (set_local $13 - (block $do-once$64 - (if - (i32.eq - (i32.sub - (tee_local $1 - (i32.add - (get_local $13) - (i32.const 1) - ) + ) + (set_local $13 + (block $do-once$64 + (if + (i32.eq + (i32.sub + (tee_local $1 + (i32.add + (get_local $13) + (i32.const 1) ) - (get_local $63) ) - (i32.const 1) + (get_local $63) ) - (block - (br_if $do-once$64 - (get_local $1) + (i32.const 1) + ) + (block + (br_if $do-once$64 + (get_local $1) + (i32.and + (get_local $14) (i32.and - (get_local $14) - (i32.and - (get_local $5) - (f64.eq - (get_local $15) - (f64.const 0) - ) + (get_local $5) + (f64.eq + (get_local $15) + (f64.const 0) ) ) ) - (i32.store8 - (get_local $1) - (i32.const 46) - ) - (i32.add - (get_local $13) - (i32.const 2) - ) ) - (get_local $1) + (i32.store8 + (get_local $1) + (i32.const 46) + ) + (i32.add + (get_local $13) + (i32.const 2) + ) ) + (get_local $1) ) ) - (if - (f64.eq - (get_local $15) - (f64.const 0) - ) - (block - (set_local $1 - (get_local $13) - ) - (br $while-out$62) - ) + ) + (if + (f64.ne + (get_local $15) + (f64.const 0) ) (br $while-in$63) + (set_local $1 + (get_local $13) + ) ) ) (call $_pad @@ -5256,44 +5215,39 @@ (get_local $10) ) (loop $while-in$67 - (block $while-out$66 - (i32.store - (get_local $7) - (tee_local $5 - (call_import $f64-to-int - (get_local $15) - ) + (i32.store + (get_local $7) + (tee_local $5 + (call_import $f64-to-int + (get_local $15) ) ) - (set_local $7 - (i32.add - (get_local $7) - (i32.const 4) - ) + ) + (set_local $7 + (i32.add + (get_local $7) + (i32.const 4) ) - (if - (f64.eq - (tee_local $15 - (f64.mul - (f64.sub - (get_local $15) - (f64.convert_u/i32 - (get_local $5) - ) + ) + (if + (f64.ne + (tee_local $15 + (f64.mul + (f64.sub + (get_local $15) + (f64.convert_u/i32 + (get_local $5) ) - (f64.const 1e9) ) + (f64.const 1e9) ) - (f64.const 0) - ) - (block - (set_local $6 - (get_local $7) - ) - (br $while-out$66) ) + (f64.const 0) ) (br $while-in$67) + (set_local $6 + (get_local $7) + ) ) ) (if @@ -5313,121 +5267,120 @@ (get_local $6) ) (loop $while-in$69 - (block $while-out$68 - (set_local $13 - (select - (i32.const 29) + (set_local $13 + (select + (i32.const 29) + (get_local $5) + (i32.gt_s (get_local $5) - (i32.gt_s - (get_local $5) - (i32.const 29) - ) + (i32.const 29) ) ) - (set_local $7 - (block $do-once$70 - (if - (i32.lt_u - (tee_local $7 - (i32.add - (get_local $14) - (i32.const -4) - ) + ) + (set_local $7 + (block $do-once$70 + (if + (i32.lt_u + (tee_local $7 + (i32.add + (get_local $14) + (i32.const -4) ) - (get_local $8) ) (get_local $8) - (block - (set_local $5 - (i32.const 0) - ) - (set_local $9 - (get_local $7) - ) - (loop $while-in$73 - (block $while-out$72 - (set_local $6 - (call $___uremdi3 - (tee_local $5 - (call $_i64Add - (call $_bitshift64Shl - (i32.load - (get_local $9) - ) - (i32.const 0) - (get_local $13) - ) - (get_global $tempRet0) - (get_local $5) - (i32.const 0) + ) + (get_local $8) + (block + (set_local $5 + (i32.const 0) + ) + (set_local $9 + (get_local $7) + ) + (loop $while-in$73 + (set_local $6 + (call $___uremdi3 + (tee_local $5 + (call $_i64Add + (call $_bitshift64Shl + (i32.load + (get_local $9) ) + (i32.const 0) + (get_local $13) ) - (tee_local $7 - (get_global $tempRet0) - ) - (i32.const 1000000000) - (i32.const 0) - ) - ) - (i32.store - (get_local $9) - (get_local $6) - ) - (set_local $5 - (call $___udivdi3 + (get_global $tempRet0) (get_local $5) - (get_local $7) - (i32.const 1000000000) (i32.const 0) ) ) - (if - (i32.lt_u - (tee_local $7 - (i32.add - (get_local $9) - (i32.const -4) - ) - ) - (get_local $8) - ) - (br $while-out$72) - (set_local $9 - (get_local $7) - ) + (tee_local $7 + (get_global $tempRet0) ) - (br $while-in$73) + (i32.const 1000000000) + (i32.const 0) ) ) - (br_if $do-once$70 - (get_local $8) - (i32.eqz + (i32.store + (get_local $9) + (get_local $6) + ) + (set_local $5 + (call $___udivdi3 (get_local $5) + (get_local $7) + (i32.const 1000000000) + (i32.const 0) ) ) - (i32.store - (tee_local $7 - (i32.add - (get_local $8) - (i32.const -4) - ) + (if + (i32.ge_u + (tee_local $7 + (i32.add + (get_local $9) + (i32.const -4) + ) + ) + (get_local $8) ) + (block + (set_local $9 + (get_local $7) + ) + (br $while-in$73) + ) + ) + ) + (br_if $do-once$70 + (get_local $8) + (i32.eqz (get_local $5) ) - (get_local $7) ) + (i32.store + (tee_local $7 + (i32.add + (get_local $8) + (i32.const -4) + ) + ) + (get_local $5) + ) + (get_local $7) ) ) ) - (loop $while-in$75 - (block $while-out$74 - (br_if $while-out$74 - (i32.le_u - (get_local $14) - (get_local $7) - ) + ) + (loop $while-in$75 + (block $while-out$74 + (br_if $while-out$74 + (i32.le_u + (get_local $14) + (get_local $7) ) - (if + ) + (if + (i32.eqz (i32.load (tee_local $5 (i32.add @@ -5436,41 +5389,41 @@ ) ) ) - (br $while-out$74) + ) + (block (set_local $14 (get_local $5) ) + (br $while-in$75) ) - (br $while-in$75) ) ) - (i32.store - (get_local $24) - (tee_local $5 - (i32.sub - (i32.load - (get_local $24) - ) - (get_local $13) + ) + (i32.store + (get_local $24) + (tee_local $5 + (i32.sub + (i32.load + (get_local $24) ) + (get_local $13) ) ) - (if - (i32.gt_s - (get_local $5) - (i32.const 0) - ) + ) + (if + (i32.gt_s + (get_local $5) + (i32.const 0) + ) + (block (set_local $8 (get_local $7) ) - (block - (set_local $6 - (get_local $14) - ) - (br $while-out$68) - ) + (br $while-in$69) + ) + (set_local $6 + (get_local $14) ) - (br $while-in$69) ) ) ) @@ -5509,187 +5462,181 @@ (get_local $6) ) (loop $while-in$77 - (block $while-out$76 - (set_local $9 - (select - (i32.const 9) - (tee_local $5 - (i32.sub - (i32.const 0) - (get_local $5) - ) - ) - (i32.gt_s + (set_local $9 + (select + (i32.const 9) + (tee_local $5 + (i32.sub + (i32.const 0) (get_local $5) - (i32.const 9) ) ) + (i32.gt_s + (get_local $5) + (i32.const 9) + ) ) - (set_local $6 - (select - (i32.add - (tee_local $5 - (select - (get_local $10) - (tee_local $7 - (block $do-once$78 - (if - (i32.lt_u + ) + (set_local $6 + (select + (i32.add + (tee_local $5 + (select + (get_local $10) + (tee_local $7 + (block $do-once$78 + (if + (i32.lt_u + (get_local $7) + (get_local $19) + ) + (block + (set_local $69 + (i32.add + (i32.shl + (i32.const 1) + (get_local $9) + ) + (i32.const -1) + ) + ) + (set_local $29 + (i32.shr_u + (i32.const 1000000000) + (get_local $9) + ) + ) + (set_local $6 + (i32.const 0) + ) + (set_local $14 (get_local $7) - (get_local $19) ) - (block - (set_local $69 + (loop $while-in$81 + (i32.store + (get_local $14) (i32.add - (i32.shl - (i32.const 1) + (i32.shr_u + (tee_local $5 + (i32.load + (get_local $14) + ) + ) (get_local $9) ) - (i32.const -1) - ) - ) - (set_local $29 - (i32.shr_u - (i32.const 1000000000) - (get_local $9) + (get_local $6) ) ) (set_local $6 - (i32.const 0) - ) - (set_local $14 - (get_local $7) + (i32.mul + (i32.and + (get_local $5) + (get_local $69) + ) + (get_local $29) + ) ) - (loop $while-in$81 - (block $while-out$80 - (i32.store - (get_local $14) + (br_if $while-in$81 + (i32.lt_u + (tee_local $14 (i32.add - (i32.shr_u - (tee_local $5 - (i32.load - (get_local $14) - ) - ) - (get_local $9) - ) - (get_local $6) - ) - ) - (set_local $6 - (i32.mul - (i32.and - (get_local $5) - (get_local $69) - ) - (get_local $29) - ) - ) - (br_if $while-out$80 - (i32.ge_u - (tee_local $14 - (i32.add - (get_local $14) - (i32.const 4) - ) - ) - (get_local $19) + (get_local $14) + (i32.const 4) ) ) - (br $while-in$81) + (get_local $19) ) ) - (set_local $5 - (select + ) + (set_local $5 + (select + (get_local $7) + (i32.add (get_local $7) - (i32.add - (get_local $7) - (i32.const 4) - ) - (i32.load - (get_local $7) - ) + (i32.const 4) ) - ) - (br_if $do-once$78 - (get_local $5) - (i32.eqz - (get_local $6) + (i32.load + (get_local $7) ) ) - (i32.store - (get_local $19) + ) + (br_if $do-once$78 + (get_local $5) + (i32.eqz (get_local $6) ) - (set_local $19 - (i32.add - (get_local $19) - (i32.const 4) - ) - ) - (get_local $5) ) - (select - (get_local $7) + (i32.store + (get_local $19) + (get_local $6) + ) + (set_local $19 (i32.add - (get_local $7) + (get_local $19) (i32.const 4) ) - (i32.load - (get_local $7) - ) + ) + (get_local $5) + ) + (select + (get_local $7) + (i32.add + (get_local $7) + (i32.const 4) + ) + (i32.load + (get_local $7) ) ) ) ) - (get_local $13) ) - ) - (i32.shl - (get_local $8) - (i32.const 2) + (get_local $13) ) ) - (get_local $19) - (i32.gt_s - (i32.shr_s - (i32.sub - (get_local $19) - (get_local $5) - ) - (i32.const 2) - ) + (i32.shl (get_local $8) + (i32.const 2) ) ) - ) - (i32.store - (get_local $24) - (tee_local $5 - (i32.add - (i32.load - (get_local $24) + (get_local $19) + (i32.gt_s + (i32.shr_s + (i32.sub + (get_local $19) + (get_local $5) ) - (get_local $9) + (i32.const 2) ) + (get_local $8) ) ) - (if - (i32.lt_s - (get_local $5) - (i32.const 0) + ) + (i32.store + (get_local $24) + (tee_local $5 + (i32.add + (i32.load + (get_local $24) + ) + (get_local $9) ) + ) + ) + (if + (i32.lt_s + (get_local $5) + (i32.const 0) + ) + (block (set_local $19 (get_local $6) ) - (block - (set_local $19 - (get_local $6) - ) - (br $while-out$76) - ) + (br $while-in$77) + ) + (set_local $19 + (get_local $6) ) - (br $while-in$77) ) ) ) @@ -5736,30 +5683,25 @@ ) ) (loop $while-in$85 - (block $while-out$84 - (set_local $6 - (i32.add - (get_local $6) - (i32.const 1) - ) + (set_local $6 + (i32.add + (get_local $6) + (i32.const 1) ) - (if - (i32.lt_u - (get_local $5) - (tee_local $8 - (i32.mul - (get_local $8) - (i32.const 10) - ) - ) - ) - (block - (set_local $14 - (get_local $6) + ) + (if + (i32.lt_u + (get_local $5) + (tee_local $8 + (i32.mul + (get_local $8) + (i32.const 10) ) - (br $while-out$84) ) ) + (set_local $14 + (get_local $6) + ) (br $while-in$85) ) ) @@ -5869,29 +5811,24 @@ (i32.const 10) ) (loop $while-in$87 - (block $while-out$86 - (set_local $5 - (i32.mul - (get_local $5) - (i32.const 10) - ) + (set_local $5 + (i32.mul + (get_local $5) + (i32.const 10) ) - (if - (i32.eq - (tee_local $13 - (i32.add - (get_local $13) - (i32.const 1) - ) - ) - (i32.const 9) - ) - (block - (set_local $12 - (get_local $5) + ) + (if + (i32.eq + (tee_local $13 + (i32.add + (get_local $13) + (i32.const 1) ) - (br $while-out$86) ) + (i32.const 9) + ) + (set_local $12 + (get_local $5) ) (br $while-in$87) ) @@ -6036,55 +5973,52 @@ (i32.const 999999999) ) (loop $while-in$93 - (block $while-out$92 - (i32.store - (get_local $6) - (i32.const 0) - ) - (set_local $7 - (if - (i32.lt_u - (tee_local $6 - (i32.add - (get_local $6) - (i32.const -4) - ) + (i32.store + (get_local $6) + (i32.const 0) + ) + (set_local $7 + (if + (i32.lt_u + (tee_local $6 + (i32.add + (get_local $6) + (i32.const -4) ) - (get_local $7) ) - (block - (i32.store - (tee_local $5 - (i32.add - (get_local $7) - (i32.const -4) - ) + (get_local $7) + ) + (block + (i32.store + (tee_local $5 + (i32.add + (get_local $7) + (i32.const -4) ) - (i32.const 0) ) - (get_local $5) + (i32.const 0) ) - (get_local $7) + (get_local $5) ) + (get_local $7) ) - (i32.store - (get_local $6) - (tee_local $5 - (i32.add - (i32.load - (get_local $6) - ) - (i32.const 1) + ) + (i32.store + (get_local $6) + (tee_local $5 + (i32.add + (i32.load + (get_local $6) ) + (i32.const 1) ) ) - (br_if $while-out$92 - (i32.le_u - (get_local $5) - (i32.const 999999999) - ) + ) + (br_if $while-in$93 + (i32.gt_u + (get_local $5) + (i32.const 999999999) ) - (br $while-in$93) ) ) ) @@ -6120,30 +6054,25 @@ ) ) (loop $while-in$95 - (block $while-out$94 - (set_local $13 - (i32.add - (get_local $13) - (i32.const 1) - ) + (set_local $13 + (i32.add + (get_local $13) + (i32.const 1) ) - (if - (i32.lt_u - (get_local $5) - (tee_local $9 - (i32.mul - (get_local $9) - (i32.const 10) - ) - ) - ) - (block - (set_local $14 - (get_local $13) + ) + (if + (i32.lt_u + (get_local $5) + (tee_local $9 + (i32.mul + (get_local $9) + (i32.const 10) ) - (br $while-out$94) ) ) + (set_local $14 + (get_local $13) + ) (br $while-in$95) ) ) @@ -6214,13 +6143,14 @@ (set_local $19 (get_local $6) ) - (br $while-out$96) ) - (set_local $6 - (get_local $5) + (block + (set_local $6 + (get_local $5) + ) + (br $while-in$97) ) ) - (br $while-in$97) ) ) (set_local $8 @@ -6345,14 +6275,14 @@ ) ) (loop $while-in$103 - (block $while-out$102 - (set_local $6 - (i32.add - (get_local $6) - (i32.const 1) - ) + (set_local $6 + (i32.add + (get_local $6) + (i32.const 1) ) - (br_if $while-out$102 + ) + (br_if $while-in$103 + (i32.eqz (i32.and (call_import $i32u-rem (get_local $1) @@ -6366,7 +6296,6 @@ (i32.const -1) ) ) - (br $while-in$103) ) ) ) @@ -6547,26 +6476,23 @@ (i32.const 2) ) (loop $while-in$105 - (block $while-out$104 - (i32.store8 - (tee_local $5 - (i32.add - (get_local $5) - (i32.const -1) - ) + (i32.store8 + (tee_local $5 + (i32.add + (get_local $5) + (i32.const -1) ) - (i32.const 48) ) - (br_if $while-out$104 - (i32.ge_s - (i32.sub - (get_local $38) - (get_local $5) - ) - (i32.const 2) + (i32.const 48) + ) + (br_if $while-in$105 + (i32.lt_s + (i32.sub + (get_local $38) + (get_local $5) ) + (i32.const 2) ) - (br $while-in$105) ) ) ) @@ -6676,103 +6602,95 @@ ) ) (loop $while-in$109 - (block $while-out$108 - (set_local $5 - (call $_fmt_u - (i32.load - (get_local $7) - ) - (i32.const 0) - (get_local $43) + (set_local $5 + (call $_fmt_u + (i32.load + (get_local $7) ) + (i32.const 0) + (get_local $43) ) - (block $do-once$110 - (if - (i32.eq - (get_local $7) - (get_local $8) + ) + (block $do-once$110 + (if + (i32.eq + (get_local $7) + (get_local $8) + ) + (block + (br_if $do-once$110 + (i32.ne + (get_local $5) + (get_local $43) + ) ) - (block - (br_if $do-once$110 - (i32.ne - (get_local $5) - (get_local $43) - ) + (i32.store8 + (get_local $52) + (i32.const 48) + ) + (set_local $5 + (get_local $52) + ) + ) + (block + (br_if $do-once$110 + (i32.le_u + (get_local $5) + (get_local $27) ) + ) + (loop $while-in$113 (i32.store8 - (get_local $52) + (tee_local $5 + (i32.add + (get_local $5) + (i32.const -1) + ) + ) (i32.const 48) ) - (set_local $5 - (get_local $52) - ) - ) - (block - (br_if $do-once$110 - (i32.le_u + (br_if $while-in$113 + (i32.gt_u (get_local $5) (get_local $27) ) ) - (loop $while-in$113 - (block $while-out$112 - (i32.store8 - (tee_local $5 - (i32.add - (get_local $5) - (i32.const -1) - ) - ) - (i32.const 48) - ) - (br_if $while-out$112 - (i32.le_u - (get_local $5) - (get_local $27) - ) - ) - (br $while-in$113) - ) - ) ) ) ) - (if - (i32.eqz - (i32.and - (i32.load - (get_local $0) - ) - (i32.const 32) - ) - ) - (drop - (call $___fwritex - (get_local $5) - (i32.sub - (get_local $74) - (get_local $5) - ) + ) + (if + (i32.eqz + (i32.and + (i32.load (get_local $0) ) + (i32.const 32) ) ) - (if - (i32.gt_u - (tee_local $7 - (i32.add - (get_local $7) - (i32.const 4) - ) + (drop + (call $___fwritex + (get_local $5) + (i32.sub + (get_local $74) + (get_local $5) ) - (get_local $10) + (get_local $0) ) - (block - (set_local $5 + ) + ) + (if + (i32.gt_u + (tee_local $7 + (i32.add (get_local $7) + (i32.const 4) ) - (br $while-out$108) ) + (get_local $10) + ) + (set_local $5 + (get_local $7) ) (br $while-in$109) ) @@ -6815,98 +6733,92 @@ ) ) (loop $while-in$117 - (block $while-out$116 - (if - (i32.gt_u - (tee_local $1 - (call $_fmt_u - (i32.load - (get_local $5) - ) - (i32.const 0) - (get_local $43) + (if + (i32.gt_u + (tee_local $1 + (call $_fmt_u + (i32.load + (get_local $5) ) + (i32.const 0) + (get_local $43) ) - (get_local $27) ) - (loop $while-in$119 - (block $while-out$118 - (i32.store8 - (tee_local $1 - (i32.add - (get_local $1) - (i32.const -1) - ) - ) - (i32.const 48) - ) - (br_if $while-out$118 - (i32.le_u - (get_local $1) - (get_local $27) - ) + (get_local $27) + ) + (loop $while-in$119 + (i32.store8 + (tee_local $1 + (i32.add + (get_local $1) + (i32.const -1) ) - (br $while-in$119) + ) + (i32.const 48) + ) + (br_if $while-in$119 + (i32.gt_u + (get_local $1) + (get_local $27) ) ) ) - (if - (i32.eqz - (i32.and - (i32.load - (get_local $0) - ) - (i32.const 32) + ) + (if + (i32.eqz + (i32.and + (i32.load + (get_local $0) ) + (i32.const 32) ) - (drop - (call $___fwritex - (get_local $1) - (select - (i32.const 9) + ) + (drop + (call $___fwritex + (get_local $1) + (select + (i32.const 9) + (get_local $12) + (i32.gt_s (get_local $12) - (i32.gt_s - (get_local $12) - (i32.const 9) - ) + (i32.const 9) ) - (get_local $0) ) + (get_local $0) ) ) - (set_local $1 - (i32.add + ) + (set_local $1 + (i32.add + (get_local $12) + (i32.const -9) + ) + ) + (if + (i32.and + (i32.gt_s (get_local $12) - (i32.const -9) + (i32.const 9) ) - ) - (if - (i32.and - (i32.gt_s - (get_local $12) - (i32.const 9) - ) - (i32.lt_u - (tee_local $5 - (i32.add - (get_local $5) - (i32.const 4) - ) + (i32.lt_u + (tee_local $5 + (i32.add + (get_local $5) + (i32.const 4) ) - (get_local $19) ) + (get_local $19) ) + ) + (block (set_local $12 (get_local $1) ) - (block - (set_local $12 - (get_local $1) - ) - (br $while-out$116) - ) + (br $while-in$117) + ) + (set_local $12 + (get_local $1) ) - (br $while-in$117) ) ) ) @@ -6947,71 +6859,45 @@ (get_local $7) ) (loop $while-in$121 - (block $while-out$120 - (set_local $8 - (if - (i32.eq - (tee_local $1 - (call $_fmt_u - (i32.load - (get_local $5) - ) - (i32.const 0) - (get_local $43) - ) - ) - (get_local $43) - ) - (block - (i32.store8 - (get_local $52) - (i32.const 48) - ) - (get_local $52) - ) - (get_local $1) - ) - ) - (block $do-once$122 - (if - (i32.eq - (get_local $5) - (get_local $7) - ) - (block - (set_local $1 - (i32.add - (get_local $8) - (i32.const 1) - ) - ) - (if - (i32.eqz - (i32.and - (i32.load - (get_local $0) - ) - (i32.const 32) - ) - ) - (drop - (call $___fwritex - (get_local $8) - (i32.const 1) - (get_local $0) - ) + (set_local $8 + (if + (i32.eq + (tee_local $1 + (call $_fmt_u + (i32.load + (get_local $5) ) + (i32.const 0) + (get_local $43) ) - (br_if $do-once$122 - (i32.and - (get_local $10) - (i32.lt_s - (get_local $12) - (i32.const 1) - ) - ) + ) + (get_local $43) + ) + (block + (i32.store8 + (get_local $52) + (i32.const 48) + ) + (get_local $52) + ) + (get_local $1) + ) + ) + (block $do-once$122 + (if + (i32.eq + (get_local $5) + (get_local $7) + ) + (block + (set_local $1 + (i32.add + (get_local $8) + (i32.const 1) ) - (br_if $do-once$122 + ) + (if + (i32.eqz (i32.and (i32.load (get_local $0) @@ -7021,106 +6907,124 @@ ) (drop (call $___fwritex - (i32.const 4143) + (get_local $8) (i32.const 1) (get_local $0) ) ) ) - (block - (if - (i32.gt_u - (get_local $8) - (get_local $27) + (br_if $do-once$122 + (i32.and + (get_local $10) + (i32.lt_s + (get_local $12) + (i32.const 1) + ) + ) + ) + (br_if $do-once$122 + (i32.and + (i32.load + (get_local $0) ) + (i32.const 32) + ) + ) + (drop + (call $___fwritex + (i32.const 4143) + (i32.const 1) + (get_local $0) + ) + ) + ) + (block + (if + (i32.gt_u + (get_local $8) + (get_local $27) + ) + (set_local $1 + (get_local $8) + ) + (block (set_local $1 (get_local $8) ) - (block - (set_local $1 - (get_local $8) + (br $do-once$122) + ) + ) + (loop $while-in$125 + (i32.store8 + (tee_local $1 + (i32.add + (get_local $1) + (i32.const -1) ) - (br $do-once$122) ) + (i32.const 48) ) - (loop $while-in$125 - (block $while-out$124 - (i32.store8 - (tee_local $1 - (i32.add - (get_local $1) - (i32.const -1) - ) - ) - (i32.const 48) - ) - (br_if $while-out$124 - (i32.le_u - (get_local $1) - (get_local $27) - ) - ) - (br $while-in$125) + (br_if $while-in$125 + (i32.gt_u + (get_local $1) + (get_local $27) ) ) ) ) ) - (set_local $8 - (i32.sub - (get_local $74) - (get_local $1) - ) + ) + (set_local $8 + (i32.sub + (get_local $74) + (get_local $1) ) - (if - (i32.eqz - (i32.and - (i32.load - (get_local $0) - ) - (i32.const 32) + ) + (if + (i32.eqz + (i32.and + (i32.load + (get_local $0) ) + (i32.const 32) ) - (drop - (call $___fwritex - (get_local $1) - (select - (get_local $8) + ) + (drop + (call $___fwritex + (get_local $1) + (select + (get_local $8) + (get_local $12) + (i32.gt_s (get_local $12) - (i32.gt_s - (get_local $12) - (get_local $8) - ) + (get_local $8) ) - (get_local $0) ) + (get_local $0) ) ) - (br_if $while-out$120 - (i32.eqz - (i32.and - (i32.lt_u - (tee_local $5 - (i32.add - (get_local $5) - (i32.const 4) - ) - ) - (get_local $13) + ) + (br_if $while-in$121 + (i32.and + (i32.lt_u + (tee_local $5 + (i32.add + (get_local $5) + (i32.const 4) ) - (i32.gt_s - (tee_local $12 - (i32.sub - (get_local $12) - (get_local $8) - ) - ) - (i32.const -1) + ) + (get_local $13) + ) + (i32.gt_s + (tee_local $12 + (i32.sub + (get_local $12) + (get_local $8) ) ) + (i32.const -1) ) ) - (br $while-in$121) ) ) ) @@ -7369,34 +7273,34 @@ (get_local $26) ) (loop $while-in$130 - (block $while-out$129 - (i32.store8 - (tee_local $6 - (i32.add - (get_local $6) - (i32.const -1) - ) + (i32.store8 + (tee_local $6 + (i32.add + (get_local $6) + (i32.const -1) ) - (i32.and - (i32.or - (i32.and - (i32.load8_s - (i32.add - (i32.and - (get_local $5) - (i32.const 15) - ) - (i32.const 4075) + ) + (i32.and + (i32.or + (i32.and + (i32.load8_s + (i32.add + (i32.and + (get_local $5) + (i32.const 15) ) + (i32.const 4075) ) - (i32.const 255) ) - (get_local $7) + (i32.const 255) ) - (i32.const 255) + (get_local $7) ) + (i32.const 255) ) - (br_if $while-out$129 + ) + (br_if $while-in$130 + (i32.eqz (i32.and (i32.eqz (tee_local $5 @@ -7414,7 +7318,6 @@ ) ) ) - (br $while-in$130) ) ) (if @@ -7636,17 +7539,16 @@ ) ) ) - (set_local $7 - (get_local $1) - ) (block (set_local $7 (get_local $1) ) - (br $while-out$131) + (br $while-in$132) + ) + (set_local $7 + (get_local $1) ) ) - (br $while-in$132) ) ) (if @@ -7680,92 +7582,91 @@ ) ) (loop $while-in$134 - (block $while-out$133 - (if - (i32.eqz - (tee_local $1 - (i32.load - (get_local $8) - ) - ) - ) - (block - (set_local $36 - (get_local $7) - ) - (set_local $11 - (i32.const 98) + (if + (i32.eqz + (tee_local $1 + (i32.load + (get_local $8) ) - (br $label$break$L308) ) ) - (set_local $8 - (i32.add - (get_local $8) - (i32.const 4) + (block + (set_local $36 + (get_local $7) ) + (set_local $11 + (i32.const 98) + ) + (br $label$break$L308) ) - (if - (i32.gt_s - (tee_local $1 - (i32.add - (tee_local $5 - (call $_wctomb - (get_local $62) - (get_local $1) - ) + ) + (set_local $8 + (i32.add + (get_local $8) + (i32.const 4) + ) + ) + (if + (i32.gt_s + (tee_local $1 + (i32.add + (tee_local $5 + (call $_wctomb + (get_local $62) + (get_local $1) ) - (get_local $6) ) + (get_local $6) ) - (get_local $7) - ) - (block - (set_local $36 - (get_local $7) - ) - (set_local $11 - (i32.const 98) - ) - (br $label$break$L308) ) + (get_local $7) ) - (if - (i32.eqz - (i32.and - (i32.load - (get_local $0) - ) - (i32.const 32) - ) + (block + (set_local $36 + (get_local $7) ) - (drop - (call $___fwritex - (get_local $62) - (get_local $5) + (set_local $11 + (i32.const 98) + ) + (br $label$break$L308) + ) + ) + (if + (i32.eqz + (i32.and + (i32.load (get_local $0) ) + (i32.const 32) ) ) - (if - (i32.lt_u - (get_local $1) - (get_local $7) + (drop + (call $___fwritex + (get_local $62) + (get_local $5) + (get_local $0) ) + ) + ) + (if + (i32.lt_u + (get_local $1) + (get_local $7) + ) + (block (set_local $6 (get_local $1) ) - (block - (set_local $36 - (get_local $7) - ) - (set_local $11 - (i32.const 98) - ) - (br $while-out$133) + (br $while-in$134) + ) + (block + (set_local $36 + (get_local $7) + ) + (set_local $11 + (i32.const 98) ) ) - (br $while-in$134) ) ) ) @@ -8085,7 +7986,7 @@ (get_local $2) ) (if - (i32.ge_s + (i32.lt_s (tee_local $1 (i32.add (get_local $1) @@ -8094,6 +7995,7 @@ ) (i32.const 10) ) + (br $while-in$137) (block (set_local $23 (i32.const 1) @@ -8101,7 +8003,6 @@ (br $label$break$L343) ) ) - (br $while-in$137) ) ) (if @@ -8110,46 +8011,43 @@ (i32.const 10) ) (loop $while-in$139 - (block $while-out$138 - (set_local $0 - (i32.add - (get_local $1) - (i32.const 1) - ) + (set_local $0 + (i32.add + (get_local $1) + (i32.const 1) ) - (if - (i32.load - (i32.add - (get_local $4) - (i32.shl - (get_local $1) - (i32.const 2) - ) - ) - ) - (block - (set_local $23 - (i32.const -1) + ) + (if + (i32.load + (i32.add + (get_local $4) + (i32.shl + (get_local $1) + (i32.const 2) ) - (br $label$break$L343) ) ) - (if - (i32.lt_s - (get_local $0) - (i32.const 10) + (block + (set_local $23 + (i32.const -1) ) + (br $label$break$L343) + ) + ) + (if + (i32.lt_s + (get_local $0) + (i32.const 10) + ) + (block (set_local $1 (get_local $0) ) - (block - (set_local $23 - (i32.const 1) - ) - (br $while-out$138) - ) + (br $while-in$139) + ) + (set_local $23 + (i32.const 1) ) - (br $while-in$139) ) ) (set_local $23 @@ -8601,69 +8499,66 @@ (get_local $1) ) (loop $while-in$1 - (block $while-out$0 - (set_local $0 - (call $___uremdi3 - (get_local $3) - (get_local $4) - (i32.const 10) - (i32.const 0) - ) + (set_local $0 + (call $___uremdi3 + (get_local $3) + (get_local $4) + (i32.const 10) + (i32.const 0) ) - (i32.store8 - (tee_local $2 - (i32.add - (get_local $2) - (i32.const -1) - ) - ) - (i32.and - (i32.or - (get_local $0) - (i32.const 48) - ) - (i32.const 255) + ) + (i32.store8 + (tee_local $2 + (i32.add + (get_local $2) + (i32.const -1) ) ) - (set_local $0 - (call $___udivdi3 - (get_local $3) - (get_local $4) - (i32.const 10) - (i32.const 0) + (i32.and + (i32.or + (get_local $0) + (i32.const 48) ) + (i32.const 255) ) - (set_local $1 - (get_global $tempRet0) + ) + (set_local $0 + (call $___udivdi3 + (get_local $3) + (get_local $4) + (i32.const 10) + (i32.const 0) ) - (if - (i32.or - (i32.gt_u + ) + (set_local $1 + (get_global $tempRet0) + ) + (if + (i32.or + (i32.gt_u + (get_local $4) + (i32.const 9) + ) + (i32.and + (i32.eq (get_local $4) (i32.const 9) ) - (i32.and - (i32.eq - (get_local $4) - (i32.const 9) - ) - (i32.gt_u - (get_local $3) - (i32.const -1) - ) + (i32.gt_u + (get_local $3) + (i32.const -1) ) ) - (block - (set_local $3 - (get_local $0) - ) - (set_local $4 - (get_local $1) - ) + ) + (block + (set_local $3 + (get_local $0) ) - (br $while-out$0) + (set_local $4 + (get_local $1) + ) + (br $while-in$1) ) - (br $while-in$1) ) ) (set_local $3 @@ -8686,53 +8581,50 @@ (get_local $0) ) (loop $while-in$3 - (block $while-out$2 - (i32.store8 - (tee_local $1 - (i32.add - (get_local $1) - (i32.const -1) - ) - ) - (i32.and - (i32.or - (i32.and - (call_import $i32u-rem - (get_local $3) - (i32.const 10) - ) - (i32.const -1) - ) - (i32.const 48) - ) - (i32.const 255) + (i32.store8 + (tee_local $1 + (i32.add + (get_local $1) + (i32.const -1) ) ) - (set_local $0 - (i32.and - (call_import $i32u-div - (get_local $3) - (i32.const 10) + (i32.and + (i32.or + (i32.and + (call_import $i32u-rem + (get_local $3) + (i32.const 10) + ) + (i32.const -1) ) - (i32.const -1) + (i32.const 48) ) + (i32.const 255) ) - (if - (i32.lt_u + ) + (set_local $0 + (i32.and + (call_import $i32u-div (get_local $3) (i32.const 10) ) - (block - (set_local $0 - (get_local $1) - ) - (br $while-out$2) - ) + (i32.const -1) + ) + ) + (if + (i32.lt_u + (get_local $3) + (i32.const 10) + ) + (set_local $0 + (get_local $1) + ) + (block (set_local $3 (get_local $0) ) + (br $while-in$3) ) - (br $while-in$3) ) ) ) @@ -8827,44 +8719,41 @@ (get_local $7) ) (loop $while-in$3 - (block $while-out$2 - (set_local $4 - (i32.eqz - (i32.and - (tee_local $1 - (if - (get_local $4) - (block - (drop - (call $___fwritex - (get_local $5) - (i32.const 256) - (get_local $0) - ) - ) - (i32.load + (set_local $4 + (i32.eqz + (i32.and + (tee_local $1 + (if + (get_local $4) + (block + (drop + (call $___fwritex + (get_local $5) + (i32.const 256) (get_local $0) ) ) - (get_local $1) + (i32.load + (get_local $0) + ) ) + (get_local $1) ) - (i32.const 32) ) + (i32.const 32) ) ) - (br_if $while-out$2 - (i32.le_u - (tee_local $3 - (i32.add - (get_local $3) - (i32.const -256) - ) + ) + (br_if $while-in$3 + (i32.gt_u + (tee_local $3 + (i32.add + (get_local $3) + (i32.const -256) ) - (i32.const 255) ) + (i32.const 255) ) - (br $while-in$3) ) ) (set_local $1 @@ -9750,50 +9639,47 @@ ) ) (loop $while-in$11 - (block $while-out$10 - (if - (tee_local $2 - (i32.load - (tee_local $5 - (i32.add - (get_local $4) - (i32.const 20) - ) + (if + (tee_local $2 + (i32.load + (tee_local $5 + (i32.add + (get_local $4) + (i32.const 20) ) ) ) - (block - (set_local $4 - (get_local $2) - ) - (set_local $7 - (get_local $5) - ) - (br $while-in$11) + ) + (block + (set_local $4 + (get_local $2) ) + (set_local $7 + (get_local $5) + ) + (br $while-in$11) ) - (if - (tee_local $2 - (i32.load - (tee_local $5 - (i32.add - (get_local $4) - (i32.const 16) - ) + ) + (if + (tee_local $2 + (i32.load + (tee_local $5 + (i32.add + (get_local $4) + (i32.const 16) ) ) ) - (block - (set_local $4 - (get_local $2) - ) - (set_local $7 - (get_local $5) - ) + ) + (block + (set_local $4 + (get_local $2) + ) + (set_local $7 + (get_local $5) ) - (br $while-out$10) + (br $while-in$11) ) - (br $while-in$11) ) ) (if @@ -10384,80 +10270,78 @@ (i32.const 0) ) (loop $while-in$18 - (block $while-out$17 - (if - (i32.lt_u - (tee_local $16 - (i32.sub - (tee_local $3 - (i32.and - (i32.load offset=4 - (get_local $23) - ) - (i32.const -8) + (if + (i32.lt_u + (tee_local $16 + (i32.sub + (tee_local $3 + (i32.and + (i32.load offset=4 + (get_local $23) ) + (i32.const -8) ) - (get_local $5) ) + (get_local $5) ) - (get_local $8) ) - (if - (i32.eq - (get_local $3) - (get_local $5) + (get_local $8) + ) + (if + (i32.eq + (get_local $3) + (get_local $5) + ) + (block + (set_local $25 + (get_local $16) ) - (block - (set_local $25 - (get_local $16) - ) - (set_local $24 - (get_local $23) - ) - (set_local $28 - (get_local $23) - ) - (set_local $11 - (i32.const 90) - ) - (br $label$break$L123) + (set_local $24 + (get_local $23) ) - (set_local $35 + (set_local $28 (get_local $23) ) + (set_local $11 + (i32.const 90) + ) + (br $label$break$L123) ) - (set_local $16 - (get_local $8) + (set_local $35 + (get_local $23) ) ) - (set_local $15 - (select - (get_local $15) - (tee_local $3 - (i32.load offset=20 - (get_local $23) - ) + (set_local $16 + (get_local $8) + ) + ) + (set_local $15 + (select + (get_local $15) + (tee_local $3 + (i32.load offset=20 + (get_local $23) ) - (i32.or - (i32.eqz - (get_local $3) - ) - (i32.eq - (get_local $3) - (tee_local $3 - (i32.load + ) + (i32.or + (i32.eqz + (get_local $3) + ) + (i32.eq + (get_local $3) + (tee_local $3 + (i32.load + (i32.add (i32.add - (i32.add - (get_local $23) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $11) - (i32.const 31) - ) - (i32.const 2) + (get_local $23) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $11) + (i32.const 31) ) + (i32.const 2) ) ) ) @@ -10465,49 +10349,48 @@ ) ) ) - (set_local $11 - (i32.shl - (get_local $11) - (i32.xor - (i32.and - (tee_local $8 - (i32.eqz - (get_local $3) - ) + ) + (set_local $11 + (i32.shl + (get_local $11) + (i32.xor + (i32.and + (tee_local $8 + (i32.eqz + (get_local $3) ) - (i32.const 1) ) (i32.const 1) ) + (i32.const 1) ) ) - (if - (get_local $8) - (block - (set_local $30 - (get_local $16) - ) - (set_local $31 - (get_local $15) - ) - (set_local $27 - (get_local $35) - ) - (set_local $11 - (i32.const 86) - ) - (br $while-out$17) + ) + (if + (get_local $8) + (block + (set_local $30 + (get_local $16) ) - (block - (set_local $8 - (get_local $16) - ) - (set_local $23 - (get_local $3) - ) + (set_local $31 + (get_local $15) + ) + (set_local $27 + (get_local $35) + ) + (set_local $11 + (i32.const 86) + ) + ) + (block + (set_local $8 + (get_local $16) + ) + (set_local $23 + (get_local $3) ) + (br $while-in$18) ) - (br $while-in$18) ) ) ) @@ -10701,84 +10584,79 @@ (i32.const 90) ) (loop $while-in$20 - (block $while-out$19 - (set_local $11 - (i32.const 0) - ) - (set_local $0 - (i32.lt_u - (tee_local $3 - (i32.sub - (i32.and - (i32.load offset=4 - (get_local $24) - ) - (i32.const -8) + (set_local $11 + (i32.const 0) + ) + (set_local $0 + (i32.lt_u + (tee_local $3 + (i32.sub + (i32.and + (i32.load offset=4 + (get_local $24) ) - (get_local $5) + (i32.const -8) ) + (get_local $5) ) - (get_local $25) + ) + (get_local $25) + ) + ) + (set_local $17 + (select + (get_local $3) + (get_local $25) + (get_local $0) + ) + ) + (set_local $3 + (select + (get_local $24) + (get_local $28) + (get_local $0) + ) + ) + (if + (tee_local $0 + (i32.load offset=16 + (get_local $24) ) ) - (set_local $17 - (select - (get_local $3) - (get_local $25) - (get_local $0) + (block + (set_local $25 + (get_local $17) ) - ) - (set_local $3 - (select - (get_local $24) - (get_local $28) + (set_local $24 (get_local $0) ) - ) - (if - (tee_local $0 - (i32.load offset=16 - (get_local $24) - ) + (set_local $28 + (get_local $3) ) - (block - (set_local $25 - (get_local $17) - ) - (set_local $24 - (get_local $0) - ) - (set_local $28 - (get_local $3) - ) - (br $while-in$20) + (br $while-in$20) + ) + ) + (if + (tee_local $0 + (i32.load offset=20 + (get_local $24) ) ) - (if - (tee_local $0 - (i32.load offset=20 - (get_local $24) - ) + (block + (set_local $25 + (get_local $17) ) - (block - (set_local $25 - (get_local $17) - ) - (set_local $24 - (get_local $0) - ) - (set_local $28 - (get_local $3) - ) + (set_local $24 + (get_local $0) ) - (block - (set_local $13 - (get_local $3) - ) - (br $while-out$19) + (set_local $28 + (get_local $3) ) + (br $while-in$20) + ) + (set_local $13 + (get_local $3) ) - (br $while-in$20) ) ) ) @@ -10871,50 +10749,47 @@ ) ) (loop $while-in$24 - (block $while-out$23 - (if - (tee_local $2 - (i32.load - (tee_local $8 - (i32.add - (get_local $7) - (i32.const 20) - ) + (if + (tee_local $2 + (i32.load + (tee_local $8 + (i32.add + (get_local $7) + (i32.const 20) ) ) ) - (block - (set_local $7 - (get_local $2) - ) - (set_local $9 - (get_local $8) - ) - (br $while-in$24) + ) + (block + (set_local $7 + (get_local $2) + ) + (set_local $9 + (get_local $8) ) + (br $while-in$24) ) - (if - (tee_local $2 - (i32.load - (tee_local $8 - (i32.add - (get_local $7) - (i32.const 16) - ) + ) + (if + (tee_local $2 + (i32.load + (tee_local $8 + (i32.add + (get_local $7) + (i32.const 16) ) ) ) - (block - (set_local $7 - (get_local $2) - ) - (set_local $9 - (get_local $8) - ) + ) + (block + (set_local $7 + (get_local $2) + ) + (set_local $9 + (get_local $8) ) - (br $while-out$23) + (br $while-in$24) ) - (br $while-in$24) ) ) (if @@ -11553,6 +11428,7 @@ (set_local $2 (get_local $0) ) + (br $while-in$32) ) (block (set_local $41 @@ -11564,10 +11440,8 @@ (set_local $11 (i32.const 145) ) - (br $while-out$31) ) ) - (br $while-in$32) ) ) (if @@ -12038,8 +11912,11 @@ (get_local $16) ) ) - (set_local $16 - (get_local $4) + (block + (set_local $16 + (get_local $4) + ) + (br $while-in$38) ) (block (set_local $11 @@ -12048,7 +11925,6 @@ (br $label$break$L259) ) ) - (br $while-in$38) ) ) (if @@ -12504,12 +12380,13 @@ (get_local $8) ) ) - (set_local $8 - (get_local $4) + (block + (set_local $8 + (get_local $4) + ) + (br $while-in$49) ) - (br $while-out$48) ) - (br $while-in$49) ) ) (if @@ -12667,21 +12544,16 @@ ) ) (if - (i32.eqz - (tee_local $1 - (i32.load offset=8 - (get_local $1) - ) + (tee_local $1 + (i32.load offset=8 + (get_local $1) ) ) - (block - (set_local $26 - (i32.const 624) - ) - (br $while-out$50) + (br $while-in$51) + (set_local $26 + (i32.const 624) ) ) - (br $while-in$51) ) ) (if @@ -13073,50 +12945,47 @@ ) ) (loop $while-in$62 - (block $while-out$61 - (if - (tee_local $1 - (i32.load - (tee_local $20 - (i32.add - (get_local $4) - (i32.const 20) - ) + (if + (tee_local $1 + (i32.load + (tee_local $20 + (i32.add + (get_local $4) + (i32.const 20) ) ) ) - (block - (set_local $4 - (get_local $1) - ) - (set_local $9 - (get_local $20) - ) - (br $while-in$62) + ) + (block + (set_local $4 + (get_local $1) + ) + (set_local $9 + (get_local $20) ) + (br $while-in$62) ) - (if - (tee_local $1 - (i32.load - (tee_local $20 - (i32.add - (get_local $4) - (i32.const 16) - ) + ) + (if + (tee_local $1 + (i32.load + (tee_local $20 + (i32.add + (get_local $4) + (i32.const 16) ) ) ) - (block - (set_local $4 - (get_local $1) - ) - (set_local $9 - (get_local $20) - ) + ) + (block + (set_local $4 + (get_local $1) + ) + (set_local $9 + (get_local $20) ) - (br $while-out$61) + (br $while-in$62) ) - (br $while-in$62) ) ) (if @@ -13757,6 +13626,7 @@ (set_local $2 (get_local $0) ) + (br $while-in$72) ) (block (set_local $45 @@ -13768,10 +13638,8 @@ (set_local $11 (i32.const 278) ) - (br $while-out$71) ) ) - (br $while-in$72) ) ) (if @@ -14078,26 +13946,23 @@ ) ) (loop $while-in$76 - (block $while-out$75 - (i32.store - (tee_local $1 - (i32.add - (get_local $1) - (i32.const 4) - ) + (i32.store + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 4) ) - (i32.const 7) ) - (br_if $while-out$75 - (i32.ge_u - (i32.add - (get_local $1) - (i32.const 4) - ) - (get_local $2) + (i32.const 7) + ) + (br_if $while-in$76 + (i32.lt_u + (i32.add + (get_local $1) + (i32.const 4) ) + (get_local $2) ) - (br $while-in$76) ) ) (if @@ -14472,6 +14337,7 @@ (set_local $4 (get_local $1) ) + (br $while-in$78) ) (block (set_local $46 @@ -14483,10 +14349,8 @@ (set_local $11 (i32.const 304) ) - (br $while-out$77) ) ) - (br $while-in$78) ) ) (if @@ -14625,38 +14489,35 @@ (i32.const 0) ) (loop $while-in$47 - (block $while-out$46 - (i32.store offset=12 - (tee_local $0 - (i32.add - (i32.const 216) + (i32.store offset=12 + (tee_local $0 + (i32.add + (i32.const 216) + (i32.shl (i32.shl - (i32.shl - (get_local $1) - (i32.const 1) - ) - (i32.const 2) + (get_local $1) + (i32.const 1) ) + (i32.const 2) ) ) - (get_local $0) - ) - (i32.store offset=8 - (get_local $0) - (get_local $0) ) - (br_if $while-out$46 - (i32.eq - (tee_local $1 - (i32.add - (get_local $1) - (i32.const 1) - ) + (get_local $0) + ) + (i32.store offset=8 + (get_local $0) + (get_local $0) + ) + (br_if $while-in$47 + (i32.ne + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) ) - (i32.const 32) ) + (i32.const 32) ) - (br $while-in$47) ) ) (i32.store @@ -15165,50 +15026,47 @@ ) ) (loop $while-in$5 - (block $while-out$4 - (if - (tee_local $0 - (i32.load - (tee_local $13 - (i32.add - (get_local $2) - (i32.const 20) - ) + (if + (tee_local $0 + (i32.load + (tee_local $13 + (i32.add + (get_local $2) + (i32.const 20) ) ) ) - (block - (set_local $2 - (get_local $0) - ) - (set_local $6 - (get_local $13) - ) - (br $while-in$5) + ) + (block + (set_local $2 + (get_local $0) + ) + (set_local $6 + (get_local $13) ) + (br $while-in$5) ) - (if - (tee_local $0 - (i32.load - (tee_local $13 - (i32.add - (get_local $2) - (i32.const 16) - ) + ) + (if + (tee_local $0 + (i32.load + (tee_local $13 + (i32.add + (get_local $2) + (i32.const 16) ) ) ) - (block - (set_local $2 - (get_local $0) - ) - (set_local $6 - (get_local $13) - ) + ) + (block + (set_local $2 + (get_local $0) + ) + (set_local $6 + (get_local $13) ) - (br $while-out$4) + (br $while-in$5) ) - (br $while-in$5) ) ) (if @@ -15832,50 +15690,47 @@ ) ) (loop $while-in$13 - (block $while-out$12 - (if - (tee_local $1 - (i32.load - (tee_local $6 - (i32.add - (get_local $2) - (i32.const 20) - ) + (if + (tee_local $1 + (i32.load + (tee_local $6 + (i32.add + (get_local $2) + (i32.const 20) ) ) ) - (block - (set_local $2 - (get_local $1) - ) - (set_local $8 - (get_local $6) - ) - (br $while-in$13) + ) + (block + (set_local $2 + (get_local $1) + ) + (set_local $8 + (get_local $6) ) + (br $while-in$13) ) - (if - (tee_local $1 - (i32.load - (tee_local $6 - (i32.add - (get_local $2) - (i32.const 16) - ) + ) + (if + (tee_local $1 + (i32.load + (tee_local $6 + (i32.add + (get_local $2) + (i32.const 16) ) ) ) - (block - (set_local $2 - (get_local $1) - ) - (set_local $8 - (get_local $6) - ) + ) + (block + (set_local $2 + (get_local $1) ) - (br $while-out$12) + (set_local $8 + (get_local $6) + ) + (br $while-in$13) ) - (br $while-in$13) ) ) (if @@ -16463,6 +16318,7 @@ (set_local $1 (get_local $0) ) + (br $while-in$19) ) (block (set_local $18 @@ -16474,10 +16330,8 @@ (set_local $0 (i32.const 127) ) - (br $while-out$18) ) ) - (br $while-in$19) ) ) (if @@ -16613,23 +16467,18 @@ ) ) (loop $while-in$21 - (block $while-out$20 - (set_local $0 - (i32.add - (tee_local $7 - (i32.load - (get_local $0) - ) + (set_local $0 + (i32.add + (tee_local $7 + (i32.load + (get_local $0) ) - (i32.const 8) - ) - ) - (br_if $while-out$20 - (i32.eqz - (get_local $7) ) + (i32.const 8) ) - (br $while-in$21) + ) + (br_if $while-in$21 + (get_local $7) ) ) (i32.store @@ -16745,70 +16594,70 @@ ) ) (loop $while-in$1 - (block $while-out$0 - (br_if $while-out$0 - (i32.ge_s - (get_local $0) - (get_local $3) - ) - ) - (i32.store8 + (if + (i32.lt_s (get_local $0) - (get_local $1) + (get_local $3) ) - (set_local $0 - (i32.add + (block + (i32.store8 (get_local $0) - (i32.const 1) + (get_local $1) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) ) + (br $while-in$1) ) - (br $while-in$1) ) ) ) ) (loop $while-in$3 - (block $while-out$2 - (br_if $while-out$2 - (i32.ge_s - (get_local $0) - (get_local $6) - ) - ) - (i32.store + (if + (i32.lt_s (get_local $0) - (get_local $5) + (get_local $6) ) - (set_local $0 - (i32.add + (block + (i32.store (get_local $0) - (i32.const 4) + (get_local $5) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 4) + ) ) + (br $while-in$3) ) - (br $while-in$3) ) ) ) ) (loop $while-in$5 - (block $while-out$4 - (br_if $while-out$4 - (i32.ge_s - (get_local $0) - (get_local $4) - ) - ) - (i32.store8 + (if + (i32.lt_s (get_local $0) - (get_local $1) + (get_local $4) ) - (set_local $0 - (i32.add + (block + (i32.store8 (get_local $0) - (i32.const 1) + (get_local $1) ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + (br $while-in$5) ) - (br $while-in$5) ) ) (i32.sub @@ -16998,75 +16847,75 @@ ) ) (loop $while-in$3 - (block $while-out$2 - (br_if $while-out$2 - (i32.lt_s - (get_local $2) - (i32.const 4) - ) - ) - (i32.store - (get_local $0) - (i32.load - (get_local $1) - ) + (if + (i32.ge_s + (get_local $2) + (i32.const 4) ) - (set_local $0 - (i32.add + (block + (i32.store (get_local $0) - (i32.const 4) + (i32.load + (get_local $1) + ) ) - ) - (set_local $1 - (i32.add - (get_local $1) - (i32.const 4) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 4) + ) ) - ) - (set_local $2 - (i32.sub - (get_local $2) - (i32.const 4) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 4) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 4) + ) ) + (br $while-in$3) ) - (br $while-in$3) ) ) ) ) (loop $while-in$5 - (block $while-out$4 - (br_if $while-out$4 - (i32.le_s - (get_local $2) - (i32.const 0) - ) - ) - (i32.store8 - (get_local $0) - (i32.load8_s - (get_local $1) - ) + (if + (i32.gt_s + (get_local $2) + (i32.const 0) ) - (set_local $0 - (i32.add + (block + (i32.store8 (get_local $0) - (i32.const 1) + (i32.load8_s + (get_local $1) + ) ) - ) - (set_local $1 - (i32.add - (get_local $1) - (i32.const 1) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) ) - ) - (set_local $2 - (i32.sub - (get_local $2) - (i32.const 1) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) ) + (br $while-in$5) ) - (br $while-in$5) ) ) (get_local $3) diff --git a/test/emcc_hello_world.fromasm.imprecise b/test/emcc_hello_world.fromasm.imprecise index 815fee11e..8ca2769d6 100644 --- a/test/emcc_hello_world.fromasm.imprecise +++ b/test/emcc_hello_world.fromasm.imprecise @@ -415,10 +415,9 @@ (set_local $0 (i32.const 5) ) - (br $while-out$0) ) + (br $while-in$1) ) - (br $while-in$1) ) ) (if @@ -450,55 +449,47 @@ (i32.const 5) ) (loop $while-in$3 - (block $while-out$2 - (loop $while-in$5 - (block $while-out$4 - (set_local $0 - (i32.add - (get_local $2) - (i32.const 1) - ) - ) - (if - (i32.load8_s - (get_local $2) - ) - (set_local $2 - (get_local $0) - ) - (block - (set_local $1 - (get_local $0) - ) - (br $while-out$4) - ) - ) - (br $while-in$5) + (loop $while-in$5 + (set_local $0 + (i32.add + (get_local $2) + (i32.const 1) ) ) (if - (tee_local $0 - (i32.add - (get_local $3) - (i32.const -1) - ) + (i32.load8_s + (get_local $2) ) (block - (set_local $3 - (get_local $0) - ) (set_local $2 - (get_local $1) + (get_local $0) ) + (br $while-in$5) ) - (block - (set_local $5 - (get_local $1) - ) - (br $while-out$2) + (set_local $1 + (get_local $0) + ) + ) + ) + (if + (tee_local $0 + (i32.add + (get_local $3) + (i32.const -1) + ) + ) + (block + (set_local $3 + (get_local $0) + ) + (set_local $2 + (get_local $1) ) + (br $while-in$3) + ) + (set_local $5 + (get_local $1) ) - (br $while-in$3) ) ) ) @@ -783,63 +774,60 @@ (get_local $0) ) (loop $while-in$3 - (block $while-out$2 - (set_local $0 - (if - (i32.gt_s - (i32.load offset=76 - (get_local $1) - ) - (i32.const -1) - ) - (call $___lockfile + (set_local $0 + (if + (i32.gt_s + (i32.load offset=76 (get_local $1) ) - (i32.const 0) + (i32.const -1) + ) + (call $___lockfile + (get_local $1) ) + (i32.const 0) ) - (set_local $2 - (if - (i32.gt_u - (i32.load offset=20 - (get_local $1) - ) - (i32.load offset=28 - (get_local $1) - ) + ) + (set_local $2 + (if + (i32.gt_u + (i32.load offset=20 + (get_local $1) ) - (i32.or - (call $___fflush_unlocked - (get_local $1) - ) - (get_local $2) + (i32.load offset=28 + (get_local $1) + ) + ) + (i32.or + (call $___fflush_unlocked + (get_local $1) ) (get_local $2) ) + (get_local $2) ) - (if - (get_local $0) - (call $___unlockfile + ) + (if + (get_local $0) + (call $___unlockfile + (get_local $1) + ) + ) + (if + (tee_local $0 + (i32.load offset=56 (get_local $1) ) ) - (if - (tee_local $0 - (i32.load offset=56 - (get_local $1) - ) - ) + (block (set_local $1 (get_local $0) ) - (block - (set_local $0 - (get_local $2) - ) - (br $while-out$2) - ) + (br $while-in$3) + ) + (set_local $0 + (get_local $2) ) - (br $while-in$3) ) ) ) @@ -1090,115 +1078,116 @@ (set_local $1 (i32.const 8) ) - (br $while-out$0) - ) - ) - (set_local $17 - (i32.sub - (get_local $3) - (get_local $5) ) - ) - (set_local $1 - (if - (i32.gt_u - (get_local $5) - (tee_local $1 - (i32.load offset=4 - (get_local $4) - ) + (block + (set_local $17 + (i32.sub + (get_local $3) + (get_local $5) ) ) - (block - (i32.store - (get_local $7) - (tee_local $3 - (i32.load - (get_local $13) + (set_local $1 + (if + (i32.gt_u + (get_local $5) + (tee_local $1 + (i32.load offset=4 + (get_local $4) + ) ) ) - ) - (i32.store - (get_local $11) - (get_local $3) - ) - (set_local $5 - (i32.sub - (get_local $5) - (get_local $1) + (block + (i32.store + (get_local $7) + (tee_local $3 + (i32.load + (get_local $13) + ) + ) + ) + (i32.store + (get_local $11) + (get_local $3) + ) + (set_local $5 + (i32.sub + (get_local $5) + (get_local $1) + ) + ) + (set_local $3 + (i32.add + (get_local $4) + (i32.const 8) + ) + ) + (set_local $6 + (i32.add + (get_local $6) + (i32.const -1) + ) + ) + (i32.load offset=12 + (get_local $4) + ) ) - ) - (set_local $3 - (i32.add - (get_local $4) - (i32.const 8) + (if + (i32.eq + (get_local $6) + (i32.const 2) + ) + (block + (i32.store + (get_local $7) + (i32.add + (i32.load + (get_local $7) + ) + (get_local $5) + ) + ) + (set_local $3 + (get_local $4) + ) + (set_local $6 + (i32.const 2) + ) + (get_local $1) + ) + (block + (set_local $3 + (get_local $4) + ) + (get_local $1) + ) ) ) - (set_local $6 - (i32.add - (get_local $6) - (i32.const -1) + ) + (i32.store + (get_local $3) + (i32.add + (i32.load + (get_local $3) ) + (get_local $5) ) - (i32.load offset=12 - (get_local $4) + ) + (i32.store offset=4 + (get_local $3) + (i32.sub + (get_local $1) + (get_local $5) ) ) - (if - (i32.eq - (get_local $6) - (i32.const 2) - ) - (block - (i32.store - (get_local $7) - (i32.add - (i32.load - (get_local $7) - ) - (get_local $5) - ) - ) - (set_local $3 - (get_local $4) - ) - (set_local $6 - (i32.const 2) - ) - (get_local $1) - ) - (block - (set_local $3 - (get_local $4) - ) - (get_local $1) - ) - ) - ) - ) - (i32.store - (get_local $3) - (i32.add - (i32.load + (set_local $4 (get_local $3) ) - (get_local $5) - ) - ) - (i32.store offset=4 - (get_local $3) - (i32.sub - (get_local $1) - (get_local $5) + (set_local $3 + (get_local $17) + ) + (br $while-in$1) ) ) - (set_local $4 - (get_local $3) - ) - (set_local $3 - (get_local $17) - ) - (br $while-in$1) ) ) (if @@ -1684,41 +1673,40 @@ (get_local $1) ) (loop $while-in$3 - (block $while-out$2 - (if - (i32.eqz - (get_local $3) + (if + (i32.eqz + (get_local $3) + ) + (block + (set_local $2 + (i32.const 0) ) - (block - (set_local $2 - (i32.const 0) - ) - (br $label$break$L10 - (get_local $4) - ) + (br $label$break$L10 + (get_local $4) ) ) - (if - (i32.eq - (i32.load8_s - (i32.add - (get_local $0) - (tee_local $6 - (i32.add - (get_local $3) - (i32.const -1) - ) + ) + (if + (i32.ne + (i32.load8_s + (i32.add + (get_local $0) + (tee_local $6 + (i32.add + (get_local $3) + (i32.const -1) ) ) ) - (i32.const 10) ) - (br $while-out$2) + (i32.const 10) + ) + (block (set_local $3 (get_local $6) ) + (br $while-in$3) ) - (br $while-in$3) ) ) (if @@ -2143,79 +2131,78 @@ (get_local $0) ) (loop $while-in$2 - (block $while-out$1 - (if - (i32.eq - (i32.load8_s - (get_local $2) - ) - (i32.shr_s - (i32.shl - (get_local $5) - (i32.const 24) - ) + (if + (i32.eq + (i32.load8_s + (get_local $2) + ) + (i32.shr_s + (i32.shl + (get_local $5) (i32.const 24) ) + (i32.const 24) ) - (block - (set_local $4 - (get_local $3) - ) - (set_local $6 - (get_local $2) - ) - (set_local $3 - (i32.const 6) - ) - (br $label$break$L1) + ) + (block + (set_local $4 + (get_local $3) + ) + (set_local $6 + (get_local $2) ) + (set_local $3 + (i32.const 6) + ) + (br $label$break$L1) ) - (if - (i32.and - (tee_local $3 - (i32.ne - (tee_local $0 - (i32.add - (get_local $3) - (i32.const -1) - ) + ) + (if + (i32.and + (tee_local $3 + (i32.ne + (tee_local $0 + (i32.add + (get_local $3) + (i32.const -1) ) - (i32.const 0) ) + (i32.const 0) ) - (i32.ne - (i32.and - (tee_local $2 - (i32.add - (get_local $2) - (i32.const 1) - ) + ) + (i32.ne + (i32.and + (tee_local $2 + (i32.add + (get_local $2) + (i32.const 1) ) - (i32.const 3) ) - (i32.const 0) + (i32.const 3) ) + (i32.const 0) ) + ) + (block (set_local $3 (get_local $0) ) - (block - (set_local $14 - (get_local $0) - ) - (set_local $11 - (get_local $2) - ) - (set_local $15 - (get_local $3) - ) - (set_local $3 - (i32.const 5) - ) - (br $while-out$1) + (br $while-in$2) + ) + (block + (set_local $14 + (get_local $0) + ) + (set_local $11 + (get_local $2) + ) + (set_local $15 + (get_local $3) + ) + (set_local $3 + (i32.const 5) ) ) - (br $while-in$2) ) ) ) @@ -2343,7 +2330,7 @@ ) ) (if - (i32.le_u + (i32.gt_u (tee_local $4 (i32.add (get_local $4) @@ -2352,6 +2339,7 @@ ) (i32.const 3) ) + (br $while-in$6) (block (set_local $12 (get_local $4) @@ -2365,7 +2353,6 @@ (br $label$break$L11) ) ) - (br $while-in$6) ) ) (set_local $10 @@ -2415,62 +2402,59 @@ ) ) (loop $while-in$8 - (block $while-out$7 - (if - (i32.eq - (i32.load8_s - (get_local $9) - ) - (i32.shr_s - (i32.shl - (get_local $0) - (i32.const 24) - ) + (if + (i32.eq + (i32.load8_s + (get_local $9) + ) + (i32.shr_s + (i32.shl + (get_local $0) (i32.const 24) ) + (i32.const 24) ) - (block - (set_local $7 - (get_local $10) - ) - (set_local $8 - (get_local $9) - ) - (br $label$break$L8) + ) + (block + (set_local $7 + (get_local $10) + ) + (set_local $8 + (get_local $9) ) + (br $label$break$L8) ) - (set_local $2 + ) + (set_local $2 + (i32.add + (get_local $9) + (i32.const 1) + ) + ) + (if + (tee_local $1 (i32.add - (get_local $9) - (i32.const 1) + (get_local $10) + (i32.const -1) ) ) - (if - (tee_local $1 - (i32.add - (get_local $10) - (i32.const -1) - ) + (block + (set_local $10 + (get_local $1) ) - (block - (set_local $10 - (get_local $1) - ) - (set_local $9 - (get_local $2) - ) + (set_local $9 + (get_local $2) ) - (block - (set_local $7 - (i32.const 0) - ) - (set_local $8 - (get_local $2) - ) - (br $while-out$7) + (br $while-in$8) + ) + (block + (set_local $7 + (i32.const 0) + ) + (set_local $8 + (get_local $2) ) ) - (br $while-in$8) ) ) ) @@ -2995,64 +2979,61 @@ (i32.const 9) ) (loop $while-in$8 - (block $while-out$7 - (set_local $11 - (i32.const 0) - ) - (if - (i32.ne - (i32.load8_s offset=1 - (get_local $53) - ) - (i32.const 37) - ) - (block - (set_local $39 - (get_local $53) - ) - (set_local $54 - (get_local $64) - ) - (br $label$break$L12) + (set_local $11 + (i32.const 0) + ) + (if + (i32.ne + (i32.load8_s offset=1 + (get_local $53) ) + (i32.const 37) ) - (set_local $5 - (i32.add + (block + (set_local $39 + (get_local $53) + ) + (set_local $54 (get_local $64) - (i32.const 1) ) + (br $label$break$L12) ) - (if - (i32.eq - (i32.load8_s - (tee_local $1 - (i32.add - (get_local $53) - (i32.const 2) - ) + ) + (set_local $5 + (i32.add + (get_local $64) + (i32.const 1) + ) + ) + (if + (i32.eq + (i32.load8_s + (tee_local $1 + (i32.add + (get_local $53) + (i32.const 2) ) ) - (i32.const 37) ) - (block - (set_local $53 - (get_local $1) - ) - (set_local $64 - (get_local $5) - ) + (i32.const 37) + ) + (block + (set_local $53 + (get_local $1) ) - (block - (set_local $39 - (get_local $1) - ) - (set_local $54 - (get_local $5) - ) - (br $while-out$7) + (set_local $64 + (get_local $5) + ) + (br $while-in$8) + ) + (block + (set_local $39 + (get_local $1) + ) + (set_local $54 + (get_local $5) ) ) - (br $while-in$8) ) ) ) @@ -3195,75 +3176,72 @@ (i32.const 0) ) (loop $while-in$11 - (block $while-out$10 - (br_if $label$break$L25 - (i32.eqz - (i32.and - (i32.shl - (i32.const 1) - (i32.add - (get_local $5) - (i32.const -32) - ) + (br_if $label$break$L25 + (i32.eqz + (i32.and + (i32.shl + (i32.const 1) + (i32.add + (get_local $5) + (i32.const -32) ) - (i32.const 75913) ) + (i32.const 75913) ) ) - (set_local $8 - (i32.or - (i32.shl - (i32.const 1) - (i32.add - (i32.shr_s - (i32.shl - (get_local $1) - (i32.const 24) - ) + ) + (set_local $8 + (i32.or + (i32.shl + (i32.const 1) + (i32.add + (i32.shr_s + (i32.shl + (get_local $1) (i32.const 24) ) - (i32.const -32) + (i32.const 24) ) + (i32.const -32) ) - (get_local $8) ) + (get_local $8) ) - (if - (i32.eq - (i32.and - (tee_local $5 - (i32.shr_s - (i32.shl - (tee_local $1 - (i32.load8_s - (tee_local $6 - (i32.add - (get_local $10) - (i32.const 1) - ) + ) + (if + (i32.eq + (i32.and + (tee_local $5 + (i32.shr_s + (i32.shl + (tee_local $1 + (i32.load8_s + (tee_local $6 + (i32.add + (get_local $10) + (i32.const 1) ) ) ) - (i32.const 24) ) (i32.const 24) ) + (i32.const 24) ) - (i32.const -32) ) - (i32.const 32) + (i32.const -32) ) + (i32.const 32) + ) + (block (set_local $10 (get_local $6) ) - (block - (set_local $10 - (get_local $6) - ) - (br $while-out$10) - ) + (br $while-in$11) + ) + (set_local $10 + (get_local $6) ) - (br $while-in$11) ) ) ) @@ -3488,35 +3466,32 @@ (i32.const 0) ) (loop $while-in$15 - (block $while-out$14 - (set_local $5 - (i32.add - (i32.mul - (get_local $5) - (i32.const 10) - ) - (get_local $6) + (set_local $5 + (i32.add + (i32.mul + (get_local $5) + (i32.const 10) ) + (get_local $6) ) - (br_if $while-out$14 - (i32.ge_u - (tee_local $6 - (i32.add - (i32.load8_s - (tee_local $1 - (i32.add - (get_local $1) - (i32.const 1) - ) + ) + (br_if $while-in$15 + (i32.lt_u + (tee_local $6 + (i32.add + (i32.load8_s + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) ) ) - (i32.const -48) ) + (i32.const -48) ) - (i32.const 10) ) + (i32.const 10) ) - (br $while-in$15) ) ) (if @@ -3629,7 +3604,7 @@ ) ) (if - (i32.ge_u + (i32.lt_u (tee_local $6 (i32.add (i32.load8_s @@ -3645,6 +3620,7 @@ ) (i32.const 10) ) + (br $while-in$18) (block (set_local $9 (get_local $5) @@ -3654,7 +3630,6 @@ ) ) ) - (br $while-in$18) ) ) ) @@ -3781,74 +3756,69 @@ (i32.const 0) ) (loop $while-in$20 - (block $while-out$19 - (if - (i32.gt_u - (tee_local $1 - (i32.add - (i32.load8_s - (get_local $13) - ) - (i32.const -65) + (if + (i32.gt_u + (tee_local $1 + (i32.add + (i32.load8_s + (get_local $13) ) + (i32.const -65) ) - (i32.const 57) - ) - (block - (set_local $23 - (i32.const -1) - ) - (br $label$break$L1) ) + (i32.const 57) ) - (set_local $10 - (i32.add - (get_local $13) - (i32.const 1) + (block + (set_local $23 + (i32.const -1) ) + (br $label$break$L1) ) - (if - (i32.lt_u - (i32.add - (tee_local $5 - (i32.and - (tee_local $1 - (i32.load8_s + ) + (set_local $10 + (i32.add + (get_local $13) + (i32.const 1) + ) + ) + (if + (i32.lt_u + (i32.add + (tee_local $5 + (i32.and + (tee_local $1 + (i32.load8_s + (i32.add (i32.add - (i32.add - (i32.const 3611) - (i32.mul - (get_local $14) - (i32.const 58) - ) + (i32.const 3611) + (i32.mul + (get_local $14) + (i32.const 58) ) - (get_local $1) ) + (get_local $1) ) ) - (i32.const 255) ) + (i32.const 255) ) - (i32.const -1) ) - (i32.const 8) + (i32.const -1) ) - (block - (set_local $13 - (get_local $10) - ) - (set_local $14 - (get_local $5) - ) + (i32.const 8) + ) + (block + (set_local $13 + (get_local $10) ) - (block - (set_local $6 - (get_local $5) - ) - (br $while-out$19) + (set_local $14 + (get_local $5) ) + (br $while-in$20) + ) + (set_local $6 + (get_local $5) ) - (br $while-in$20) ) ) (if @@ -4297,26 +4267,26 @@ (get_local $26) ) (loop $while-in$39 - (block $while-out$38 - (i32.store8 - (tee_local $6 - (i32.add - (get_local $6) - (i32.const -1) - ) + (i32.store8 + (tee_local $6 + (i32.add + (get_local $6) + (i32.const -1) ) - (i32.and - (i32.or - (i32.and - (get_local $5) - (i32.const 7) - ) - (i32.const 48) + ) + (i32.and + (i32.or + (i32.and + (get_local $5) + (i32.const 7) ) - (i32.const 255) + (i32.const 48) ) + (i32.const 255) ) - (br_if $while-out$38 + ) + (br_if $while-in$39 + (i32.eqz (i32.and (i32.eqz (tee_local $5 @@ -4334,7 +4304,6 @@ ) ) ) - (br $while-in$39) ) ) ) @@ -4811,24 +4780,19 @@ (f64.const 8) ) (loop $while-in$61 - (block $while-out$60 - (set_local $28 - (f64.mul - (get_local $28) - (f64.const 16) - ) + (set_local $28 + (f64.mul + (get_local $28) + (f64.const 16) ) - (br_if $while-out$60 - (i32.eqz - (tee_local $1 - (i32.add - (get_local $1) - (i32.const -1) - ) - ) + ) + (br_if $while-in$61 + (tee_local $1 + (i32.add + (get_local $1) + (i32.const -1) ) ) - (br $while-in$61) ) ) (select @@ -4958,95 +4922,90 @@ (get_local $27) ) (loop $while-in$63 - (block $while-out$62 - (i32.store8 - (get_local $13) - (i32.and - (i32.or - (i32.and - (i32.load8_s - (i32.add - (tee_local $1 - (i32.trunc_s/f64 - (get_local $15) - ) + (i32.store8 + (get_local $13) + (i32.and + (i32.or + (i32.and + (i32.load8_s + (i32.add + (tee_local $1 + (i32.trunc_s/f64 + (get_local $15) ) - (i32.const 4075) ) + (i32.const 4075) ) - (i32.const 255) ) - (get_local $6) + (i32.const 255) ) - (i32.const 255) + (get_local $6) ) + (i32.const 255) ) - (set_local $15 - (f64.mul - (f64.sub - (get_local $15) - (f64.convert_s/i32 - (get_local $1) - ) + ) + (set_local $15 + (f64.mul + (f64.sub + (get_local $15) + (f64.convert_s/i32 + (get_local $1) ) - (f64.const 16) ) + (f64.const 16) ) - (set_local $13 - (block $do-once$64 - (if - (i32.eq - (i32.sub - (tee_local $1 - (i32.add - (get_local $13) - (i32.const 1) - ) + ) + (set_local $13 + (block $do-once$64 + (if + (i32.eq + (i32.sub + (tee_local $1 + (i32.add + (get_local $13) + (i32.const 1) ) - (get_local $63) ) - (i32.const 1) + (get_local $63) ) - (block - (br_if $do-once$64 - (get_local $1) + (i32.const 1) + ) + (block + (br_if $do-once$64 + (get_local $1) + (i32.and + (get_local $14) (i32.and - (get_local $14) - (i32.and - (get_local $5) - (f64.eq - (get_local $15) - (f64.const 0) - ) + (get_local $5) + (f64.eq + (get_local $15) + (f64.const 0) ) ) ) - (i32.store8 - (get_local $1) - (i32.const 46) - ) - (i32.add - (get_local $13) - (i32.const 2) - ) ) - (get_local $1) + (i32.store8 + (get_local $1) + (i32.const 46) + ) + (i32.add + (get_local $13) + (i32.const 2) + ) ) + (get_local $1) ) ) - (if - (f64.eq - (get_local $15) - (f64.const 0) - ) - (block - (set_local $1 - (get_local $13) - ) - (br $while-out$62) - ) + ) + (if + (f64.ne + (get_local $15) + (f64.const 0) ) (br $while-in$63) + (set_local $1 + (get_local $13) + ) ) ) (call $_pad @@ -5249,44 +5208,39 @@ (get_local $10) ) (loop $while-in$67 - (block $while-out$66 - (i32.store - (get_local $7) - (tee_local $5 - (i32.trunc_s/f64 - (get_local $15) - ) + (i32.store + (get_local $7) + (tee_local $5 + (i32.trunc_s/f64 + (get_local $15) ) ) - (set_local $7 - (i32.add - (get_local $7) - (i32.const 4) - ) + ) + (set_local $7 + (i32.add + (get_local $7) + (i32.const 4) ) - (if - (f64.eq - (tee_local $15 - (f64.mul - (f64.sub - (get_local $15) - (f64.convert_u/i32 - (get_local $5) - ) + ) + (if + (f64.ne + (tee_local $15 + (f64.mul + (f64.sub + (get_local $15) + (f64.convert_u/i32 + (get_local $5) ) - (f64.const 1e9) ) + (f64.const 1e9) ) - (f64.const 0) - ) - (block - (set_local $6 - (get_local $7) - ) - (br $while-out$66) ) + (f64.const 0) ) (br $while-in$67) + (set_local $6 + (get_local $7) + ) ) ) (if @@ -5306,121 +5260,120 @@ (get_local $6) ) (loop $while-in$69 - (block $while-out$68 - (set_local $13 - (select - (i32.const 29) + (set_local $13 + (select + (i32.const 29) + (get_local $5) + (i32.gt_s (get_local $5) - (i32.gt_s - (get_local $5) - (i32.const 29) - ) + (i32.const 29) ) ) - (set_local $7 - (block $do-once$70 - (if - (i32.lt_u - (tee_local $7 - (i32.add - (get_local $14) - (i32.const -4) - ) + ) + (set_local $7 + (block $do-once$70 + (if + (i32.lt_u + (tee_local $7 + (i32.add + (get_local $14) + (i32.const -4) ) - (get_local $8) ) (get_local $8) - (block - (set_local $5 - (i32.const 0) - ) - (set_local $9 - (get_local $7) - ) - (loop $while-in$73 - (block $while-out$72 - (set_local $6 - (call $___uremdi3 - (tee_local $5 - (call $_i64Add - (call $_bitshift64Shl - (i32.load - (get_local $9) - ) - (i32.const 0) - (get_local $13) - ) - (get_global $tempRet0) - (get_local $5) - (i32.const 0) + ) + (get_local $8) + (block + (set_local $5 + (i32.const 0) + ) + (set_local $9 + (get_local $7) + ) + (loop $while-in$73 + (set_local $6 + (call $___uremdi3 + (tee_local $5 + (call $_i64Add + (call $_bitshift64Shl + (i32.load + (get_local $9) ) + (i32.const 0) + (get_local $13) ) - (tee_local $7 - (get_global $tempRet0) - ) - (i32.const 1000000000) - (i32.const 0) - ) - ) - (i32.store - (get_local $9) - (get_local $6) - ) - (set_local $5 - (call $___udivdi3 + (get_global $tempRet0) (get_local $5) - (get_local $7) - (i32.const 1000000000) (i32.const 0) ) ) - (if - (i32.lt_u - (tee_local $7 - (i32.add - (get_local $9) - (i32.const -4) - ) - ) - (get_local $8) - ) - (br $while-out$72) - (set_local $9 - (get_local $7) - ) + (tee_local $7 + (get_global $tempRet0) ) - (br $while-in$73) + (i32.const 1000000000) + (i32.const 0) ) ) - (br_if $do-once$70 - (get_local $8) - (i32.eqz + (i32.store + (get_local $9) + (get_local $6) + ) + (set_local $5 + (call $___udivdi3 (get_local $5) + (get_local $7) + (i32.const 1000000000) + (i32.const 0) ) ) - (i32.store - (tee_local $7 - (i32.add - (get_local $8) - (i32.const -4) - ) + (if + (i32.ge_u + (tee_local $7 + (i32.add + (get_local $9) + (i32.const -4) + ) + ) + (get_local $8) ) + (block + (set_local $9 + (get_local $7) + ) + (br $while-in$73) + ) + ) + ) + (br_if $do-once$70 + (get_local $8) + (i32.eqz (get_local $5) ) - (get_local $7) ) + (i32.store + (tee_local $7 + (i32.add + (get_local $8) + (i32.const -4) + ) + ) + (get_local $5) + ) + (get_local $7) ) ) ) - (loop $while-in$75 - (block $while-out$74 - (br_if $while-out$74 - (i32.le_u - (get_local $14) - (get_local $7) - ) + ) + (loop $while-in$75 + (block $while-out$74 + (br_if $while-out$74 + (i32.le_u + (get_local $14) + (get_local $7) ) - (if + ) + (if + (i32.eqz (i32.load (tee_local $5 (i32.add @@ -5429,41 +5382,41 @@ ) ) ) - (br $while-out$74) + ) + (block (set_local $14 (get_local $5) ) + (br $while-in$75) ) - (br $while-in$75) ) ) - (i32.store - (get_local $24) - (tee_local $5 - (i32.sub - (i32.load - (get_local $24) - ) - (get_local $13) + ) + (i32.store + (get_local $24) + (tee_local $5 + (i32.sub + (i32.load + (get_local $24) ) + (get_local $13) ) ) - (if - (i32.gt_s - (get_local $5) - (i32.const 0) - ) + ) + (if + (i32.gt_s + (get_local $5) + (i32.const 0) + ) + (block (set_local $8 (get_local $7) ) - (block - (set_local $6 - (get_local $14) - ) - (br $while-out$68) - ) + (br $while-in$69) + ) + (set_local $6 + (get_local $14) ) - (br $while-in$69) ) ) ) @@ -5502,187 +5455,181 @@ (get_local $6) ) (loop $while-in$77 - (block $while-out$76 - (set_local $9 - (select - (i32.const 9) - (tee_local $5 - (i32.sub - (i32.const 0) - (get_local $5) - ) - ) - (i32.gt_s + (set_local $9 + (select + (i32.const 9) + (tee_local $5 + (i32.sub + (i32.const 0) (get_local $5) - (i32.const 9) ) ) + (i32.gt_s + (get_local $5) + (i32.const 9) + ) ) - (set_local $6 - (select - (i32.add - (tee_local $5 - (select - (get_local $10) - (tee_local $7 - (block $do-once$78 - (if - (i32.lt_u + ) + (set_local $6 + (select + (i32.add + (tee_local $5 + (select + (get_local $10) + (tee_local $7 + (block $do-once$78 + (if + (i32.lt_u + (get_local $7) + (get_local $19) + ) + (block + (set_local $69 + (i32.add + (i32.shl + (i32.const 1) + (get_local $9) + ) + (i32.const -1) + ) + ) + (set_local $29 + (i32.shr_u + (i32.const 1000000000) + (get_local $9) + ) + ) + (set_local $6 + (i32.const 0) + ) + (set_local $14 (get_local $7) - (get_local $19) ) - (block - (set_local $69 + (loop $while-in$81 + (i32.store + (get_local $14) (i32.add - (i32.shl - (i32.const 1) + (i32.shr_u + (tee_local $5 + (i32.load + (get_local $14) + ) + ) (get_local $9) ) - (i32.const -1) - ) - ) - (set_local $29 - (i32.shr_u - (i32.const 1000000000) - (get_local $9) + (get_local $6) ) ) (set_local $6 - (i32.const 0) - ) - (set_local $14 - (get_local $7) + (i32.mul + (i32.and + (get_local $5) + (get_local $69) + ) + (get_local $29) + ) ) - (loop $while-in$81 - (block $while-out$80 - (i32.store - (get_local $14) + (br_if $while-in$81 + (i32.lt_u + (tee_local $14 (i32.add - (i32.shr_u - (tee_local $5 - (i32.load - (get_local $14) - ) - ) - (get_local $9) - ) - (get_local $6) - ) - ) - (set_local $6 - (i32.mul - (i32.and - (get_local $5) - (get_local $69) - ) - (get_local $29) - ) - ) - (br_if $while-out$80 - (i32.ge_u - (tee_local $14 - (i32.add - (get_local $14) - (i32.const 4) - ) - ) - (get_local $19) + (get_local $14) + (i32.const 4) ) ) - (br $while-in$81) + (get_local $19) ) ) - (set_local $5 - (select + ) + (set_local $5 + (select + (get_local $7) + (i32.add (get_local $7) - (i32.add - (get_local $7) - (i32.const 4) - ) - (i32.load - (get_local $7) - ) + (i32.const 4) ) - ) - (br_if $do-once$78 - (get_local $5) - (i32.eqz - (get_local $6) + (i32.load + (get_local $7) ) ) - (i32.store - (get_local $19) + ) + (br_if $do-once$78 + (get_local $5) + (i32.eqz (get_local $6) ) - (set_local $19 - (i32.add - (get_local $19) - (i32.const 4) - ) - ) - (get_local $5) ) - (select - (get_local $7) + (i32.store + (get_local $19) + (get_local $6) + ) + (set_local $19 (i32.add - (get_local $7) + (get_local $19) (i32.const 4) ) - (i32.load - (get_local $7) - ) + ) + (get_local $5) + ) + (select + (get_local $7) + (i32.add + (get_local $7) + (i32.const 4) + ) + (i32.load + (get_local $7) ) ) ) ) - (get_local $13) ) - ) - (i32.shl - (get_local $8) - (i32.const 2) + (get_local $13) ) ) - (get_local $19) - (i32.gt_s - (i32.shr_s - (i32.sub - (get_local $19) - (get_local $5) - ) - (i32.const 2) - ) + (i32.shl (get_local $8) + (i32.const 2) ) ) - ) - (i32.store - (get_local $24) - (tee_local $5 - (i32.add - (i32.load - (get_local $24) + (get_local $19) + (i32.gt_s + (i32.shr_s + (i32.sub + (get_local $19) + (get_local $5) ) - (get_local $9) + (i32.const 2) ) + (get_local $8) ) ) - (if - (i32.lt_s - (get_local $5) - (i32.const 0) + ) + (i32.store + (get_local $24) + (tee_local $5 + (i32.add + (i32.load + (get_local $24) + ) + (get_local $9) ) + ) + ) + (if + (i32.lt_s + (get_local $5) + (i32.const 0) + ) + (block (set_local $19 (get_local $6) ) - (block - (set_local $19 - (get_local $6) - ) - (br $while-out$76) - ) + (br $while-in$77) + ) + (set_local $19 + (get_local $6) ) - (br $while-in$77) ) ) ) @@ -5729,30 +5676,25 @@ ) ) (loop $while-in$85 - (block $while-out$84 - (set_local $6 - (i32.add - (get_local $6) - (i32.const 1) - ) + (set_local $6 + (i32.add + (get_local $6) + (i32.const 1) ) - (if - (i32.lt_u - (get_local $5) - (tee_local $8 - (i32.mul - (get_local $8) - (i32.const 10) - ) - ) - ) - (block - (set_local $14 - (get_local $6) + ) + (if + (i32.lt_u + (get_local $5) + (tee_local $8 + (i32.mul + (get_local $8) + (i32.const 10) ) - (br $while-out$84) ) ) + (set_local $14 + (get_local $6) + ) (br $while-in$85) ) ) @@ -5862,29 +5804,24 @@ (i32.const 10) ) (loop $while-in$87 - (block $while-out$86 - (set_local $5 - (i32.mul - (get_local $5) - (i32.const 10) - ) + (set_local $5 + (i32.mul + (get_local $5) + (i32.const 10) ) - (if - (i32.eq - (tee_local $13 - (i32.add - (get_local $13) - (i32.const 1) - ) - ) - (i32.const 9) - ) - (block - (set_local $12 - (get_local $5) + ) + (if + (i32.eq + (tee_local $13 + (i32.add + (get_local $13) + (i32.const 1) ) - (br $while-out$86) ) + (i32.const 9) + ) + (set_local $12 + (get_local $5) ) (br $while-in$87) ) @@ -6029,55 +5966,52 @@ (i32.const 999999999) ) (loop $while-in$93 - (block $while-out$92 - (i32.store - (get_local $6) - (i32.const 0) - ) - (set_local $7 - (if - (i32.lt_u - (tee_local $6 - (i32.add - (get_local $6) - (i32.const -4) - ) + (i32.store + (get_local $6) + (i32.const 0) + ) + (set_local $7 + (if + (i32.lt_u + (tee_local $6 + (i32.add + (get_local $6) + (i32.const -4) ) - (get_local $7) ) - (block - (i32.store - (tee_local $5 - (i32.add - (get_local $7) - (i32.const -4) - ) + (get_local $7) + ) + (block + (i32.store + (tee_local $5 + (i32.add + (get_local $7) + (i32.const -4) ) - (i32.const 0) ) - (get_local $5) + (i32.const 0) ) - (get_local $7) + (get_local $5) ) + (get_local $7) ) - (i32.store - (get_local $6) - (tee_local $5 - (i32.add - (i32.load - (get_local $6) - ) - (i32.const 1) + ) + (i32.store + (get_local $6) + (tee_local $5 + (i32.add + (i32.load + (get_local $6) ) + (i32.const 1) ) ) - (br_if $while-out$92 - (i32.le_u - (get_local $5) - (i32.const 999999999) - ) + ) + (br_if $while-in$93 + (i32.gt_u + (get_local $5) + (i32.const 999999999) ) - (br $while-in$93) ) ) ) @@ -6113,30 +6047,25 @@ ) ) (loop $while-in$95 - (block $while-out$94 - (set_local $13 - (i32.add - (get_local $13) - (i32.const 1) - ) + (set_local $13 + (i32.add + (get_local $13) + (i32.const 1) ) - (if - (i32.lt_u - (get_local $5) - (tee_local $9 - (i32.mul - (get_local $9) - (i32.const 10) - ) - ) - ) - (block - (set_local $14 - (get_local $13) + ) + (if + (i32.lt_u + (get_local $5) + (tee_local $9 + (i32.mul + (get_local $9) + (i32.const 10) ) - (br $while-out$94) ) ) + (set_local $14 + (get_local $13) + ) (br $while-in$95) ) ) @@ -6207,13 +6136,14 @@ (set_local $19 (get_local $6) ) - (br $while-out$96) ) - (set_local $6 - (get_local $5) + (block + (set_local $6 + (get_local $5) + ) + (br $while-in$97) ) ) - (br $while-in$97) ) ) (set_local $8 @@ -6338,14 +6268,14 @@ ) ) (loop $while-in$103 - (block $while-out$102 - (set_local $6 - (i32.add - (get_local $6) - (i32.const 1) - ) + (set_local $6 + (i32.add + (get_local $6) + (i32.const 1) ) - (br_if $while-out$102 + ) + (br_if $while-in$103 + (i32.eqz (i32.and (i32.rem_u (get_local $1) @@ -6359,7 +6289,6 @@ (i32.const -1) ) ) - (br $while-in$103) ) ) ) @@ -6540,26 +6469,23 @@ (i32.const 2) ) (loop $while-in$105 - (block $while-out$104 - (i32.store8 - (tee_local $5 - (i32.add - (get_local $5) - (i32.const -1) - ) + (i32.store8 + (tee_local $5 + (i32.add + (get_local $5) + (i32.const -1) ) - (i32.const 48) ) - (br_if $while-out$104 - (i32.ge_s - (i32.sub - (get_local $38) - (get_local $5) - ) - (i32.const 2) + (i32.const 48) + ) + (br_if $while-in$105 + (i32.lt_s + (i32.sub + (get_local $38) + (get_local $5) ) + (i32.const 2) ) - (br $while-in$105) ) ) ) @@ -6669,103 +6595,95 @@ ) ) (loop $while-in$109 - (block $while-out$108 - (set_local $5 - (call $_fmt_u - (i32.load - (get_local $7) - ) - (i32.const 0) - (get_local $43) + (set_local $5 + (call $_fmt_u + (i32.load + (get_local $7) ) + (i32.const 0) + (get_local $43) ) - (block $do-once$110 - (if - (i32.eq - (get_local $7) - (get_local $8) + ) + (block $do-once$110 + (if + (i32.eq + (get_local $7) + (get_local $8) + ) + (block + (br_if $do-once$110 + (i32.ne + (get_local $5) + (get_local $43) + ) ) - (block - (br_if $do-once$110 - (i32.ne - (get_local $5) - (get_local $43) - ) + (i32.store8 + (get_local $52) + (i32.const 48) + ) + (set_local $5 + (get_local $52) + ) + ) + (block + (br_if $do-once$110 + (i32.le_u + (get_local $5) + (get_local $27) ) + ) + (loop $while-in$113 (i32.store8 - (get_local $52) + (tee_local $5 + (i32.add + (get_local $5) + (i32.const -1) + ) + ) (i32.const 48) ) - (set_local $5 - (get_local $52) - ) - ) - (block - (br_if $do-once$110 - (i32.le_u + (br_if $while-in$113 + (i32.gt_u (get_local $5) (get_local $27) ) ) - (loop $while-in$113 - (block $while-out$112 - (i32.store8 - (tee_local $5 - (i32.add - (get_local $5) - (i32.const -1) - ) - ) - (i32.const 48) - ) - (br_if $while-out$112 - (i32.le_u - (get_local $5) - (get_local $27) - ) - ) - (br $while-in$113) - ) - ) ) ) ) - (if - (i32.eqz - (i32.and - (i32.load - (get_local $0) - ) - (i32.const 32) - ) - ) - (drop - (call $___fwritex - (get_local $5) - (i32.sub - (get_local $74) - (get_local $5) - ) + ) + (if + (i32.eqz + (i32.and + (i32.load (get_local $0) ) + (i32.const 32) ) ) - (if - (i32.gt_u - (tee_local $7 - (i32.add - (get_local $7) - (i32.const 4) - ) + (drop + (call $___fwritex + (get_local $5) + (i32.sub + (get_local $74) + (get_local $5) ) - (get_local $10) + (get_local $0) ) - (block - (set_local $5 + ) + ) + (if + (i32.gt_u + (tee_local $7 + (i32.add (get_local $7) + (i32.const 4) ) - (br $while-out$108) ) + (get_local $10) + ) + (set_local $5 + (get_local $7) ) (br $while-in$109) ) @@ -6808,98 +6726,92 @@ ) ) (loop $while-in$117 - (block $while-out$116 - (if - (i32.gt_u - (tee_local $1 - (call $_fmt_u - (i32.load - (get_local $5) - ) - (i32.const 0) - (get_local $43) + (if + (i32.gt_u + (tee_local $1 + (call $_fmt_u + (i32.load + (get_local $5) ) + (i32.const 0) + (get_local $43) ) - (get_local $27) ) - (loop $while-in$119 - (block $while-out$118 - (i32.store8 - (tee_local $1 - (i32.add - (get_local $1) - (i32.const -1) - ) - ) - (i32.const 48) - ) - (br_if $while-out$118 - (i32.le_u - (get_local $1) - (get_local $27) - ) + (get_local $27) + ) + (loop $while-in$119 + (i32.store8 + (tee_local $1 + (i32.add + (get_local $1) + (i32.const -1) ) - (br $while-in$119) + ) + (i32.const 48) + ) + (br_if $while-in$119 + (i32.gt_u + (get_local $1) + (get_local $27) ) ) ) - (if - (i32.eqz - (i32.and - (i32.load - (get_local $0) - ) - (i32.const 32) + ) + (if + (i32.eqz + (i32.and + (i32.load + (get_local $0) ) + (i32.const 32) ) - (drop - (call $___fwritex - (get_local $1) - (select - (i32.const 9) + ) + (drop + (call $___fwritex + (get_local $1) + (select + (i32.const 9) + (get_local $12) + (i32.gt_s (get_local $12) - (i32.gt_s - (get_local $12) - (i32.const 9) - ) + (i32.const 9) ) - (get_local $0) ) + (get_local $0) ) ) - (set_local $1 - (i32.add + ) + (set_local $1 + (i32.add + (get_local $12) + (i32.const -9) + ) + ) + (if + (i32.and + (i32.gt_s (get_local $12) - (i32.const -9) + (i32.const 9) ) - ) - (if - (i32.and - (i32.gt_s - (get_local $12) - (i32.const 9) - ) - (i32.lt_u - (tee_local $5 - (i32.add - (get_local $5) - (i32.const 4) - ) + (i32.lt_u + (tee_local $5 + (i32.add + (get_local $5) + (i32.const 4) ) - (get_local $19) ) + (get_local $19) ) + ) + (block (set_local $12 (get_local $1) ) - (block - (set_local $12 - (get_local $1) - ) - (br $while-out$116) - ) + (br $while-in$117) + ) + (set_local $12 + (get_local $1) ) - (br $while-in$117) ) ) ) @@ -6940,71 +6852,45 @@ (get_local $7) ) (loop $while-in$121 - (block $while-out$120 - (set_local $8 - (if - (i32.eq - (tee_local $1 - (call $_fmt_u - (i32.load - (get_local $5) - ) - (i32.const 0) - (get_local $43) - ) - ) - (get_local $43) - ) - (block - (i32.store8 - (get_local $52) - (i32.const 48) - ) - (get_local $52) - ) - (get_local $1) - ) - ) - (block $do-once$122 - (if - (i32.eq - (get_local $5) - (get_local $7) - ) - (block - (set_local $1 - (i32.add - (get_local $8) - (i32.const 1) - ) - ) - (if - (i32.eqz - (i32.and - (i32.load - (get_local $0) - ) - (i32.const 32) - ) - ) - (drop - (call $___fwritex - (get_local $8) - (i32.const 1) - (get_local $0) - ) + (set_local $8 + (if + (i32.eq + (tee_local $1 + (call $_fmt_u + (i32.load + (get_local $5) ) + (i32.const 0) + (get_local $43) ) - (br_if $do-once$122 - (i32.and - (get_local $10) - (i32.lt_s - (get_local $12) - (i32.const 1) - ) - ) + ) + (get_local $43) + ) + (block + (i32.store8 + (get_local $52) + (i32.const 48) + ) + (get_local $52) + ) + (get_local $1) + ) + ) + (block $do-once$122 + (if + (i32.eq + (get_local $5) + (get_local $7) + ) + (block + (set_local $1 + (i32.add + (get_local $8) + (i32.const 1) ) - (br_if $do-once$122 + ) + (if + (i32.eqz (i32.and (i32.load (get_local $0) @@ -7014,106 +6900,124 @@ ) (drop (call $___fwritex - (i32.const 4143) + (get_local $8) (i32.const 1) (get_local $0) ) ) ) - (block - (if - (i32.gt_u - (get_local $8) - (get_local $27) + (br_if $do-once$122 + (i32.and + (get_local $10) + (i32.lt_s + (get_local $12) + (i32.const 1) + ) + ) + ) + (br_if $do-once$122 + (i32.and + (i32.load + (get_local $0) ) + (i32.const 32) + ) + ) + (drop + (call $___fwritex + (i32.const 4143) + (i32.const 1) + (get_local $0) + ) + ) + ) + (block + (if + (i32.gt_u + (get_local $8) + (get_local $27) + ) + (set_local $1 + (get_local $8) + ) + (block (set_local $1 (get_local $8) ) - (block - (set_local $1 - (get_local $8) + (br $do-once$122) + ) + ) + (loop $while-in$125 + (i32.store8 + (tee_local $1 + (i32.add + (get_local $1) + (i32.const -1) ) - (br $do-once$122) ) + (i32.const 48) ) - (loop $while-in$125 - (block $while-out$124 - (i32.store8 - (tee_local $1 - (i32.add - (get_local $1) - (i32.const -1) - ) - ) - (i32.const 48) - ) - (br_if $while-out$124 - (i32.le_u - (get_local $1) - (get_local $27) - ) - ) - (br $while-in$125) + (br_if $while-in$125 + (i32.gt_u + (get_local $1) + (get_local $27) ) ) ) ) ) - (set_local $8 - (i32.sub - (get_local $74) - (get_local $1) - ) + ) + (set_local $8 + (i32.sub + (get_local $74) + (get_local $1) ) - (if - (i32.eqz - (i32.and - (i32.load - (get_local $0) - ) - (i32.const 32) + ) + (if + (i32.eqz + (i32.and + (i32.load + (get_local $0) ) + (i32.const 32) ) - (drop - (call $___fwritex - (get_local $1) - (select - (get_local $8) + ) + (drop + (call $___fwritex + (get_local $1) + (select + (get_local $8) + (get_local $12) + (i32.gt_s (get_local $12) - (i32.gt_s - (get_local $12) - (get_local $8) - ) + (get_local $8) ) - (get_local $0) ) + (get_local $0) ) ) - (br_if $while-out$120 - (i32.eqz - (i32.and - (i32.lt_u - (tee_local $5 - (i32.add - (get_local $5) - (i32.const 4) - ) - ) - (get_local $13) + ) + (br_if $while-in$121 + (i32.and + (i32.lt_u + (tee_local $5 + (i32.add + (get_local $5) + (i32.const 4) ) - (i32.gt_s - (tee_local $12 - (i32.sub - (get_local $12) - (get_local $8) - ) - ) - (i32.const -1) + ) + (get_local $13) + ) + (i32.gt_s + (tee_local $12 + (i32.sub + (get_local $12) + (get_local $8) ) ) + (i32.const -1) ) ) - (br $while-in$121) ) ) ) @@ -7362,34 +7266,34 @@ (get_local $26) ) (loop $while-in$130 - (block $while-out$129 - (i32.store8 - (tee_local $6 - (i32.add - (get_local $6) - (i32.const -1) - ) + (i32.store8 + (tee_local $6 + (i32.add + (get_local $6) + (i32.const -1) ) - (i32.and - (i32.or - (i32.and - (i32.load8_s - (i32.add - (i32.and - (get_local $5) - (i32.const 15) - ) - (i32.const 4075) + ) + (i32.and + (i32.or + (i32.and + (i32.load8_s + (i32.add + (i32.and + (get_local $5) + (i32.const 15) ) + (i32.const 4075) ) - (i32.const 255) ) - (get_local $7) + (i32.const 255) ) - (i32.const 255) + (get_local $7) ) + (i32.const 255) ) - (br_if $while-out$129 + ) + (br_if $while-in$130 + (i32.eqz (i32.and (i32.eqz (tee_local $5 @@ -7407,7 +7311,6 @@ ) ) ) - (br $while-in$130) ) ) (if @@ -7629,17 +7532,16 @@ ) ) ) - (set_local $7 - (get_local $1) - ) (block (set_local $7 (get_local $1) ) - (br $while-out$131) + (br $while-in$132) + ) + (set_local $7 + (get_local $1) ) ) - (br $while-in$132) ) ) (if @@ -7673,92 +7575,91 @@ ) ) (loop $while-in$134 - (block $while-out$133 - (if - (i32.eqz - (tee_local $1 - (i32.load - (get_local $8) - ) - ) - ) - (block - (set_local $36 - (get_local $7) - ) - (set_local $11 - (i32.const 98) + (if + (i32.eqz + (tee_local $1 + (i32.load + (get_local $8) ) - (br $label$break$L308) ) ) - (set_local $8 - (i32.add - (get_local $8) - (i32.const 4) + (block + (set_local $36 + (get_local $7) ) + (set_local $11 + (i32.const 98) + ) + (br $label$break$L308) ) - (if - (i32.gt_s - (tee_local $1 - (i32.add - (tee_local $5 - (call $_wctomb - (get_local $62) - (get_local $1) - ) + ) + (set_local $8 + (i32.add + (get_local $8) + (i32.const 4) + ) + ) + (if + (i32.gt_s + (tee_local $1 + (i32.add + (tee_local $5 + (call $_wctomb + (get_local $62) + (get_local $1) ) - (get_local $6) ) + (get_local $6) ) - (get_local $7) - ) - (block - (set_local $36 - (get_local $7) - ) - (set_local $11 - (i32.const 98) - ) - (br $label$break$L308) ) + (get_local $7) ) - (if - (i32.eqz - (i32.and - (i32.load - (get_local $0) - ) - (i32.const 32) - ) + (block + (set_local $36 + (get_local $7) ) - (drop - (call $___fwritex - (get_local $62) - (get_local $5) + (set_local $11 + (i32.const 98) + ) + (br $label$break$L308) + ) + ) + (if + (i32.eqz + (i32.and + (i32.load (get_local $0) ) + (i32.const 32) ) ) - (if - (i32.lt_u - (get_local $1) - (get_local $7) + (drop + (call $___fwritex + (get_local $62) + (get_local $5) + (get_local $0) ) + ) + ) + (if + (i32.lt_u + (get_local $1) + (get_local $7) + ) + (block (set_local $6 (get_local $1) ) - (block - (set_local $36 - (get_local $7) - ) - (set_local $11 - (i32.const 98) - ) - (br $while-out$133) + (br $while-in$134) + ) + (block + (set_local $36 + (get_local $7) + ) + (set_local $11 + (i32.const 98) ) ) - (br $while-in$134) ) ) ) @@ -8078,7 +7979,7 @@ (get_local $2) ) (if - (i32.ge_s + (i32.lt_s (tee_local $1 (i32.add (get_local $1) @@ -8087,6 +7988,7 @@ ) (i32.const 10) ) + (br $while-in$137) (block (set_local $23 (i32.const 1) @@ -8094,7 +7996,6 @@ (br $label$break$L343) ) ) - (br $while-in$137) ) ) (if @@ -8103,46 +8004,43 @@ (i32.const 10) ) (loop $while-in$139 - (block $while-out$138 - (set_local $0 - (i32.add - (get_local $1) - (i32.const 1) - ) + (set_local $0 + (i32.add + (get_local $1) + (i32.const 1) ) - (if - (i32.load - (i32.add - (get_local $4) - (i32.shl - (get_local $1) - (i32.const 2) - ) - ) - ) - (block - (set_local $23 - (i32.const -1) + ) + (if + (i32.load + (i32.add + (get_local $4) + (i32.shl + (get_local $1) + (i32.const 2) ) - (br $label$break$L343) ) ) - (if - (i32.lt_s - (get_local $0) - (i32.const 10) + (block + (set_local $23 + (i32.const -1) ) + (br $label$break$L343) + ) + ) + (if + (i32.lt_s + (get_local $0) + (i32.const 10) + ) + (block (set_local $1 (get_local $0) ) - (block - (set_local $23 - (i32.const 1) - ) - (br $while-out$138) - ) + (br $while-in$139) + ) + (set_local $23 + (i32.const 1) ) - (br $while-in$139) ) ) (set_local $23 @@ -8594,69 +8492,66 @@ (get_local $1) ) (loop $while-in$1 - (block $while-out$0 - (set_local $0 - (call $___uremdi3 - (get_local $3) - (get_local $4) - (i32.const 10) - (i32.const 0) - ) + (set_local $0 + (call $___uremdi3 + (get_local $3) + (get_local $4) + (i32.const 10) + (i32.const 0) ) - (i32.store8 - (tee_local $2 - (i32.add - (get_local $2) - (i32.const -1) - ) - ) - (i32.and - (i32.or - (get_local $0) - (i32.const 48) - ) - (i32.const 255) + ) + (i32.store8 + (tee_local $2 + (i32.add + (get_local $2) + (i32.const -1) ) ) - (set_local $0 - (call $___udivdi3 - (get_local $3) - (get_local $4) - (i32.const 10) - (i32.const 0) + (i32.and + (i32.or + (get_local $0) + (i32.const 48) ) + (i32.const 255) ) - (set_local $1 - (get_global $tempRet0) + ) + (set_local $0 + (call $___udivdi3 + (get_local $3) + (get_local $4) + (i32.const 10) + (i32.const 0) ) - (if - (i32.or - (i32.gt_u + ) + (set_local $1 + (get_global $tempRet0) + ) + (if + (i32.or + (i32.gt_u + (get_local $4) + (i32.const 9) + ) + (i32.and + (i32.eq (get_local $4) (i32.const 9) ) - (i32.and - (i32.eq - (get_local $4) - (i32.const 9) - ) - (i32.gt_u - (get_local $3) - (i32.const -1) - ) + (i32.gt_u + (get_local $3) + (i32.const -1) ) ) - (block - (set_local $3 - (get_local $0) - ) - (set_local $4 - (get_local $1) - ) + ) + (block + (set_local $3 + (get_local $0) ) - (br $while-out$0) + (set_local $4 + (get_local $1) + ) + (br $while-in$1) ) - (br $while-in$1) ) ) (set_local $3 @@ -8679,53 +8574,50 @@ (get_local $0) ) (loop $while-in$3 - (block $while-out$2 - (i32.store8 - (tee_local $1 - (i32.add - (get_local $1) - (i32.const -1) - ) - ) - (i32.and - (i32.or - (i32.and - (i32.rem_u - (get_local $3) - (i32.const 10) - ) - (i32.const -1) - ) - (i32.const 48) - ) - (i32.const 255) + (i32.store8 + (tee_local $1 + (i32.add + (get_local $1) + (i32.const -1) ) ) - (set_local $0 - (i32.and - (i32.div_u - (get_local $3) - (i32.const 10) + (i32.and + (i32.or + (i32.and + (i32.rem_u + (get_local $3) + (i32.const 10) + ) + (i32.const -1) ) - (i32.const -1) + (i32.const 48) ) + (i32.const 255) ) - (if - (i32.lt_u + ) + (set_local $0 + (i32.and + (i32.div_u (get_local $3) (i32.const 10) ) - (block - (set_local $0 - (get_local $1) - ) - (br $while-out$2) - ) + (i32.const -1) + ) + ) + (if + (i32.lt_u + (get_local $3) + (i32.const 10) + ) + (set_local $0 + (get_local $1) + ) + (block (set_local $3 (get_local $0) ) + (br $while-in$3) ) - (br $while-in$3) ) ) ) @@ -8820,44 +8712,41 @@ (get_local $7) ) (loop $while-in$3 - (block $while-out$2 - (set_local $4 - (i32.eqz - (i32.and - (tee_local $1 - (if - (get_local $4) - (block - (drop - (call $___fwritex - (get_local $5) - (i32.const 256) - (get_local $0) - ) - ) - (i32.load + (set_local $4 + (i32.eqz + (i32.and + (tee_local $1 + (if + (get_local $4) + (block + (drop + (call $___fwritex + (get_local $5) + (i32.const 256) (get_local $0) ) ) - (get_local $1) + (i32.load + (get_local $0) + ) ) + (get_local $1) ) - (i32.const 32) ) + (i32.const 32) ) ) - (br_if $while-out$2 - (i32.le_u - (tee_local $3 - (i32.add - (get_local $3) - (i32.const -256) - ) + ) + (br_if $while-in$3 + (i32.gt_u + (tee_local $3 + (i32.add + (get_local $3) + (i32.const -256) ) - (i32.const 255) ) + (i32.const 255) ) - (br $while-in$3) ) ) (set_local $1 @@ -9743,50 +9632,47 @@ ) ) (loop $while-in$11 - (block $while-out$10 - (if - (tee_local $2 - (i32.load - (tee_local $5 - (i32.add - (get_local $4) - (i32.const 20) - ) + (if + (tee_local $2 + (i32.load + (tee_local $5 + (i32.add + (get_local $4) + (i32.const 20) ) ) ) - (block - (set_local $4 - (get_local $2) - ) - (set_local $7 - (get_local $5) - ) - (br $while-in$11) + ) + (block + (set_local $4 + (get_local $2) ) + (set_local $7 + (get_local $5) + ) + (br $while-in$11) ) - (if - (tee_local $2 - (i32.load - (tee_local $5 - (i32.add - (get_local $4) - (i32.const 16) - ) + ) + (if + (tee_local $2 + (i32.load + (tee_local $5 + (i32.add + (get_local $4) + (i32.const 16) ) ) ) - (block - (set_local $4 - (get_local $2) - ) - (set_local $7 - (get_local $5) - ) + ) + (block + (set_local $4 + (get_local $2) + ) + (set_local $7 + (get_local $5) ) - (br $while-out$10) + (br $while-in$11) ) - (br $while-in$11) ) ) (if @@ -10377,80 +10263,78 @@ (i32.const 0) ) (loop $while-in$18 - (block $while-out$17 - (if - (i32.lt_u - (tee_local $16 - (i32.sub - (tee_local $3 - (i32.and - (i32.load offset=4 - (get_local $23) - ) - (i32.const -8) + (if + (i32.lt_u + (tee_local $16 + (i32.sub + (tee_local $3 + (i32.and + (i32.load offset=4 + (get_local $23) ) + (i32.const -8) ) - (get_local $5) ) + (get_local $5) ) - (get_local $8) ) - (if - (i32.eq - (get_local $3) - (get_local $5) + (get_local $8) + ) + (if + (i32.eq + (get_local $3) + (get_local $5) + ) + (block + (set_local $25 + (get_local $16) ) - (block - (set_local $25 - (get_local $16) - ) - (set_local $24 - (get_local $23) - ) - (set_local $28 - (get_local $23) - ) - (set_local $11 - (i32.const 90) - ) - (br $label$break$L123) + (set_local $24 + (get_local $23) ) - (set_local $35 + (set_local $28 (get_local $23) ) + (set_local $11 + (i32.const 90) + ) + (br $label$break$L123) ) - (set_local $16 - (get_local $8) + (set_local $35 + (get_local $23) ) ) - (set_local $15 - (select - (get_local $15) - (tee_local $3 - (i32.load offset=20 - (get_local $23) - ) + (set_local $16 + (get_local $8) + ) + ) + (set_local $15 + (select + (get_local $15) + (tee_local $3 + (i32.load offset=20 + (get_local $23) ) - (i32.or - (i32.eqz - (get_local $3) - ) - (i32.eq - (get_local $3) - (tee_local $3 - (i32.load + ) + (i32.or + (i32.eqz + (get_local $3) + ) + (i32.eq + (get_local $3) + (tee_local $3 + (i32.load + (i32.add (i32.add - (i32.add - (get_local $23) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $11) - (i32.const 31) - ) - (i32.const 2) + (get_local $23) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $11) + (i32.const 31) ) + (i32.const 2) ) ) ) @@ -10458,49 +10342,48 @@ ) ) ) - (set_local $11 - (i32.shl - (get_local $11) - (i32.xor - (i32.and - (tee_local $8 - (i32.eqz - (get_local $3) - ) + ) + (set_local $11 + (i32.shl + (get_local $11) + (i32.xor + (i32.and + (tee_local $8 + (i32.eqz + (get_local $3) ) - (i32.const 1) ) (i32.const 1) ) + (i32.const 1) ) ) - (if - (get_local $8) - (block - (set_local $30 - (get_local $16) - ) - (set_local $31 - (get_local $15) - ) - (set_local $27 - (get_local $35) - ) - (set_local $11 - (i32.const 86) - ) - (br $while-out$17) + ) + (if + (get_local $8) + (block + (set_local $30 + (get_local $16) ) - (block - (set_local $8 - (get_local $16) - ) - (set_local $23 - (get_local $3) - ) + (set_local $31 + (get_local $15) + ) + (set_local $27 + (get_local $35) + ) + (set_local $11 + (i32.const 86) + ) + ) + (block + (set_local $8 + (get_local $16) + ) + (set_local $23 + (get_local $3) ) + (br $while-in$18) ) - (br $while-in$18) ) ) ) @@ -10694,84 +10577,79 @@ (i32.const 90) ) (loop $while-in$20 - (block $while-out$19 - (set_local $11 - (i32.const 0) - ) - (set_local $0 - (i32.lt_u - (tee_local $3 - (i32.sub - (i32.and - (i32.load offset=4 - (get_local $24) - ) - (i32.const -8) + (set_local $11 + (i32.const 0) + ) + (set_local $0 + (i32.lt_u + (tee_local $3 + (i32.sub + (i32.and + (i32.load offset=4 + (get_local $24) ) - (get_local $5) + (i32.const -8) ) + (get_local $5) ) - (get_local $25) + ) + (get_local $25) + ) + ) + (set_local $17 + (select + (get_local $3) + (get_local $25) + (get_local $0) + ) + ) + (set_local $3 + (select + (get_local $24) + (get_local $28) + (get_local $0) + ) + ) + (if + (tee_local $0 + (i32.load offset=16 + (get_local $24) ) ) - (set_local $17 - (select - (get_local $3) - (get_local $25) - (get_local $0) + (block + (set_local $25 + (get_local $17) ) - ) - (set_local $3 - (select - (get_local $24) - (get_local $28) + (set_local $24 (get_local $0) ) - ) - (if - (tee_local $0 - (i32.load offset=16 - (get_local $24) - ) + (set_local $28 + (get_local $3) ) - (block - (set_local $25 - (get_local $17) - ) - (set_local $24 - (get_local $0) - ) - (set_local $28 - (get_local $3) - ) - (br $while-in$20) + (br $while-in$20) + ) + ) + (if + (tee_local $0 + (i32.load offset=20 + (get_local $24) ) ) - (if - (tee_local $0 - (i32.load offset=20 - (get_local $24) - ) + (block + (set_local $25 + (get_local $17) ) - (block - (set_local $25 - (get_local $17) - ) - (set_local $24 - (get_local $0) - ) - (set_local $28 - (get_local $3) - ) + (set_local $24 + (get_local $0) ) - (block - (set_local $13 - (get_local $3) - ) - (br $while-out$19) + (set_local $28 + (get_local $3) ) + (br $while-in$20) + ) + (set_local $13 + (get_local $3) ) - (br $while-in$20) ) ) ) @@ -10864,50 +10742,47 @@ ) ) (loop $while-in$24 - (block $while-out$23 - (if - (tee_local $2 - (i32.load - (tee_local $8 - (i32.add - (get_local $7) - (i32.const 20) - ) + (if + (tee_local $2 + (i32.load + (tee_local $8 + (i32.add + (get_local $7) + (i32.const 20) ) ) ) - (block - (set_local $7 - (get_local $2) - ) - (set_local $9 - (get_local $8) - ) - (br $while-in$24) + ) + (block + (set_local $7 + (get_local $2) + ) + (set_local $9 + (get_local $8) ) + (br $while-in$24) ) - (if - (tee_local $2 - (i32.load - (tee_local $8 - (i32.add - (get_local $7) - (i32.const 16) - ) + ) + (if + (tee_local $2 + (i32.load + (tee_local $8 + (i32.add + (get_local $7) + (i32.const 16) ) ) ) - (block - (set_local $7 - (get_local $2) - ) - (set_local $9 - (get_local $8) - ) + ) + (block + (set_local $7 + (get_local $2) + ) + (set_local $9 + (get_local $8) ) - (br $while-out$23) + (br $while-in$24) ) - (br $while-in$24) ) ) (if @@ -11546,6 +11421,7 @@ (set_local $2 (get_local $0) ) + (br $while-in$32) ) (block (set_local $41 @@ -11557,10 +11433,8 @@ (set_local $11 (i32.const 145) ) - (br $while-out$31) ) ) - (br $while-in$32) ) ) (if @@ -12031,8 +11905,11 @@ (get_local $16) ) ) - (set_local $16 - (get_local $4) + (block + (set_local $16 + (get_local $4) + ) + (br $while-in$38) ) (block (set_local $11 @@ -12041,7 +11918,6 @@ (br $label$break$L259) ) ) - (br $while-in$38) ) ) (if @@ -12497,12 +12373,13 @@ (get_local $8) ) ) - (set_local $8 - (get_local $4) + (block + (set_local $8 + (get_local $4) + ) + (br $while-in$49) ) - (br $while-out$48) ) - (br $while-in$49) ) ) (if @@ -12660,21 +12537,16 @@ ) ) (if - (i32.eqz - (tee_local $1 - (i32.load offset=8 - (get_local $1) - ) + (tee_local $1 + (i32.load offset=8 + (get_local $1) ) ) - (block - (set_local $26 - (i32.const 624) - ) - (br $while-out$50) + (br $while-in$51) + (set_local $26 + (i32.const 624) ) ) - (br $while-in$51) ) ) (if @@ -13066,50 +12938,47 @@ ) ) (loop $while-in$62 - (block $while-out$61 - (if - (tee_local $1 - (i32.load - (tee_local $20 - (i32.add - (get_local $4) - (i32.const 20) - ) + (if + (tee_local $1 + (i32.load + (tee_local $20 + (i32.add + (get_local $4) + (i32.const 20) ) ) ) - (block - (set_local $4 - (get_local $1) - ) - (set_local $9 - (get_local $20) - ) - (br $while-in$62) + ) + (block + (set_local $4 + (get_local $1) + ) + (set_local $9 + (get_local $20) ) + (br $while-in$62) ) - (if - (tee_local $1 - (i32.load - (tee_local $20 - (i32.add - (get_local $4) - (i32.const 16) - ) + ) + (if + (tee_local $1 + (i32.load + (tee_local $20 + (i32.add + (get_local $4) + (i32.const 16) ) ) ) - (block - (set_local $4 - (get_local $1) - ) - (set_local $9 - (get_local $20) - ) + ) + (block + (set_local $4 + (get_local $1) + ) + (set_local $9 + (get_local $20) ) - (br $while-out$61) + (br $while-in$62) ) - (br $while-in$62) ) ) (if @@ -13750,6 +13619,7 @@ (set_local $2 (get_local $0) ) + (br $while-in$72) ) (block (set_local $45 @@ -13761,10 +13631,8 @@ (set_local $11 (i32.const 278) ) - (br $while-out$71) ) ) - (br $while-in$72) ) ) (if @@ -14071,26 +13939,23 @@ ) ) (loop $while-in$76 - (block $while-out$75 - (i32.store - (tee_local $1 - (i32.add - (get_local $1) - (i32.const 4) - ) + (i32.store + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 4) ) - (i32.const 7) ) - (br_if $while-out$75 - (i32.ge_u - (i32.add - (get_local $1) - (i32.const 4) - ) - (get_local $2) + (i32.const 7) + ) + (br_if $while-in$76 + (i32.lt_u + (i32.add + (get_local $1) + (i32.const 4) ) + (get_local $2) ) - (br $while-in$76) ) ) (if @@ -14465,6 +14330,7 @@ (set_local $4 (get_local $1) ) + (br $while-in$78) ) (block (set_local $46 @@ -14476,10 +14342,8 @@ (set_local $11 (i32.const 304) ) - (br $while-out$77) ) ) - (br $while-in$78) ) ) (if @@ -14618,38 +14482,35 @@ (i32.const 0) ) (loop $while-in$47 - (block $while-out$46 - (i32.store offset=12 - (tee_local $0 - (i32.add - (i32.const 216) + (i32.store offset=12 + (tee_local $0 + (i32.add + (i32.const 216) + (i32.shl (i32.shl - (i32.shl - (get_local $1) - (i32.const 1) - ) - (i32.const 2) + (get_local $1) + (i32.const 1) ) + (i32.const 2) ) ) - (get_local $0) - ) - (i32.store offset=8 - (get_local $0) - (get_local $0) ) - (br_if $while-out$46 - (i32.eq - (tee_local $1 - (i32.add - (get_local $1) - (i32.const 1) - ) + (get_local $0) + ) + (i32.store offset=8 + (get_local $0) + (get_local $0) + ) + (br_if $while-in$47 + (i32.ne + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) ) - (i32.const 32) ) + (i32.const 32) ) - (br $while-in$47) ) ) (i32.store @@ -15158,50 +15019,47 @@ ) ) (loop $while-in$5 - (block $while-out$4 - (if - (tee_local $0 - (i32.load - (tee_local $13 - (i32.add - (get_local $2) - (i32.const 20) - ) + (if + (tee_local $0 + (i32.load + (tee_local $13 + (i32.add + (get_local $2) + (i32.const 20) ) ) ) - (block - (set_local $2 - (get_local $0) - ) - (set_local $6 - (get_local $13) - ) - (br $while-in$5) + ) + (block + (set_local $2 + (get_local $0) + ) + (set_local $6 + (get_local $13) ) + (br $while-in$5) ) - (if - (tee_local $0 - (i32.load - (tee_local $13 - (i32.add - (get_local $2) - (i32.const 16) - ) + ) + (if + (tee_local $0 + (i32.load + (tee_local $13 + (i32.add + (get_local $2) + (i32.const 16) ) ) ) - (block - (set_local $2 - (get_local $0) - ) - (set_local $6 - (get_local $13) - ) + ) + (block + (set_local $2 + (get_local $0) + ) + (set_local $6 + (get_local $13) ) - (br $while-out$4) + (br $while-in$5) ) - (br $while-in$5) ) ) (if @@ -15825,50 +15683,47 @@ ) ) (loop $while-in$13 - (block $while-out$12 - (if - (tee_local $1 - (i32.load - (tee_local $6 - (i32.add - (get_local $2) - (i32.const 20) - ) + (if + (tee_local $1 + (i32.load + (tee_local $6 + (i32.add + (get_local $2) + (i32.const 20) ) ) ) - (block - (set_local $2 - (get_local $1) - ) - (set_local $8 - (get_local $6) - ) - (br $while-in$13) + ) + (block + (set_local $2 + (get_local $1) + ) + (set_local $8 + (get_local $6) ) + (br $while-in$13) ) - (if - (tee_local $1 - (i32.load - (tee_local $6 - (i32.add - (get_local $2) - (i32.const 16) - ) + ) + (if + (tee_local $1 + (i32.load + (tee_local $6 + (i32.add + (get_local $2) + (i32.const 16) ) ) ) - (block - (set_local $2 - (get_local $1) - ) - (set_local $8 - (get_local $6) - ) + ) + (block + (set_local $2 + (get_local $1) ) - (br $while-out$12) + (set_local $8 + (get_local $6) + ) + (br $while-in$13) ) - (br $while-in$13) ) ) (if @@ -16456,6 +16311,7 @@ (set_local $1 (get_local $0) ) + (br $while-in$19) ) (block (set_local $18 @@ -16467,10 +16323,8 @@ (set_local $0 (i32.const 127) ) - (br $while-out$18) ) ) - (br $while-in$19) ) ) (if @@ -16606,23 +16460,18 @@ ) ) (loop $while-in$21 - (block $while-out$20 - (set_local $0 - (i32.add - (tee_local $7 - (i32.load - (get_local $0) - ) + (set_local $0 + (i32.add + (tee_local $7 + (i32.load + (get_local $0) ) - (i32.const 8) - ) - ) - (br_if $while-out$20 - (i32.eqz - (get_local $7) ) + (i32.const 8) ) - (br $while-in$21) + ) + (br_if $while-in$21 + (get_local $7) ) ) (i32.store @@ -16738,70 +16587,70 @@ ) ) (loop $while-in$1 - (block $while-out$0 - (br_if $while-out$0 - (i32.ge_s - (get_local $0) - (get_local $3) - ) - ) - (i32.store8 + (if + (i32.lt_s (get_local $0) - (get_local $1) + (get_local $3) ) - (set_local $0 - (i32.add + (block + (i32.store8 (get_local $0) - (i32.const 1) + (get_local $1) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) ) + (br $while-in$1) ) - (br $while-in$1) ) ) ) ) (loop $while-in$3 - (block $while-out$2 - (br_if $while-out$2 - (i32.ge_s - (get_local $0) - (get_local $6) - ) - ) - (i32.store + (if + (i32.lt_s (get_local $0) - (get_local $5) + (get_local $6) ) - (set_local $0 - (i32.add + (block + (i32.store (get_local $0) - (i32.const 4) + (get_local $5) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 4) + ) ) + (br $while-in$3) ) - (br $while-in$3) ) ) ) ) (loop $while-in$5 - (block $while-out$4 - (br_if $while-out$4 - (i32.ge_s - (get_local $0) - (get_local $4) - ) - ) - (i32.store8 + (if + (i32.lt_s (get_local $0) - (get_local $1) + (get_local $4) ) - (set_local $0 - (i32.add + (block + (i32.store8 (get_local $0) - (i32.const 1) + (get_local $1) ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + (br $while-in$5) ) - (br $while-in$5) ) ) (i32.sub @@ -16991,75 +16840,75 @@ ) ) (loop $while-in$3 - (block $while-out$2 - (br_if $while-out$2 - (i32.lt_s - (get_local $2) - (i32.const 4) - ) - ) - (i32.store - (get_local $0) - (i32.load - (get_local $1) - ) + (if + (i32.ge_s + (get_local $2) + (i32.const 4) ) - (set_local $0 - (i32.add + (block + (i32.store (get_local $0) - (i32.const 4) + (i32.load + (get_local $1) + ) ) - ) - (set_local $1 - (i32.add - (get_local $1) - (i32.const 4) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 4) + ) ) - ) - (set_local $2 - (i32.sub - (get_local $2) - (i32.const 4) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 4) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 4) + ) ) + (br $while-in$3) ) - (br $while-in$3) ) ) ) ) (loop $while-in$5 - (block $while-out$4 - (br_if $while-out$4 - (i32.le_s - (get_local $2) - (i32.const 0) - ) - ) - (i32.store8 - (get_local $0) - (i32.load8_s - (get_local $1) - ) + (if + (i32.gt_s + (get_local $2) + (i32.const 0) ) - (set_local $0 - (i32.add + (block + (i32.store8 (get_local $0) - (i32.const 1) + (i32.load8_s + (get_local $1) + ) ) - ) - (set_local $1 - (i32.add - (get_local $1) - (i32.const 1) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) ) - ) - (set_local $2 - (i32.sub - (get_local $2) - (i32.const 1) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) ) + (br $while-in$5) ) - (br $while-in$5) ) ) (get_local $3) diff --git a/test/memorygrowth.fromasm b/test/memorygrowth.fromasm index 85105c556..61b85f883 100644 --- a/test/memorygrowth.fromasm +++ b/test/memorygrowth.fromasm @@ -964,50 +964,47 @@ ) ) (loop $while-in$11 - (block $while-out$10 - (if - (tee_local $7 - (i32.load - (tee_local $8 - (i32.add - (get_local $11) - (i32.const 20) - ) + (if + (tee_local $7 + (i32.load + (tee_local $8 + (i32.add + (get_local $11) + (i32.const 20) ) ) ) - (block - (set_local $11 - (get_local $7) - ) - (set_local $0 - (get_local $8) - ) - (br $while-in$11) + ) + (block + (set_local $11 + (get_local $7) + ) + (set_local $0 + (get_local $8) ) + (br $while-in$11) ) - (if - (tee_local $7 - (i32.load - (tee_local $8 - (i32.add - (get_local $11) - (i32.const 16) - ) + ) + (if + (tee_local $7 + (i32.load + (tee_local $8 + (i32.add + (get_local $11) + (i32.const 16) ) ) ) - (block - (set_local $11 - (get_local $7) - ) - (set_local $0 - (get_local $8) - ) + ) + (block + (set_local $11 + (get_local $7) + ) + (set_local $0 + (get_local $8) ) - (br $while-out$10) + (br $while-in$11) ) - (br $while-in$11) ) ) (if @@ -1610,90 +1607,88 @@ (i32.const 0) ) (loop $while-in$18 - (block $while-out$17 - (if - (i32.lt_u - (tee_local $29 - (i32.sub - (tee_local $27 - (i32.and - (i32.load offset=4 - (get_local $19) - ) - (i32.const -8) + (if + (i32.lt_u + (tee_local $29 + (i32.sub + (tee_local $27 + (i32.and + (i32.load offset=4 + (get_local $19) ) + (i32.const -8) ) - (get_local $2) ) + (get_local $2) ) - (get_local $7) ) - (if - (i32.eq - (get_local $27) - (get_local $2) + (get_local $7) + ) + (if + (i32.eq + (get_local $27) + (get_local $2) + ) + (block + (set_local $36 + (get_local $29) ) - (block - (set_local $36 - (get_local $29) - ) - (set_local $18 - (get_local $19) - ) - (set_local $17 - (get_local $19) - ) - (set_local $7 - (i32.const 90) - ) - (br $label$break$a) + (set_local $18 + (get_local $19) ) - (block - (set_local $4 - (get_local $29) - ) - (set_local $0 - (get_local $19) - ) + (set_local $17 + (get_local $19) + ) + (set_local $7 + (i32.const 90) ) + (br $label$break$a) ) (block (set_local $4 - (get_local $7) + (get_local $29) ) (set_local $0 - (get_local $5) + (get_local $19) ) ) ) - (set_local $27 - (select - (get_local $25) - (tee_local $29 - (i32.load offset=20 - (get_local $19) - ) + (block + (set_local $4 + (get_local $7) + ) + (set_local $0 + (get_local $5) + ) + ) + ) + (set_local $27 + (select + (get_local $25) + (tee_local $29 + (i32.load offset=20 + (get_local $19) ) - (i32.or - (i32.eqz - (get_local $29) - ) - (i32.eq - (get_local $29) - (tee_local $19 - (i32.load + ) + (i32.or + (i32.eqz + (get_local $29) + ) + (i32.eq + (get_local $29) + (tee_local $19 + (i32.load + (i32.add (i32.add - (i32.add - (get_local $19) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $3) - (i32.const 31) - ) - (i32.const 2) + (get_local $19) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $3) + (i32.const 31) ) + (i32.const 2) ) ) ) @@ -1701,52 +1696,51 @@ ) ) ) - (if - (tee_local $29 - (i32.eqz - (get_local $19) - ) + ) + (if + (tee_local $29 + (i32.eqz + (get_local $19) ) - (block - (set_local $40 - (get_local $4) - ) - (set_local $12 - (get_local $27) - ) - (set_local $38 - (get_local $0) - ) - (set_local $7 - (i32.const 86) - ) - (br $while-out$17) + ) + (block + (set_local $40 + (get_local $4) ) - (block - (set_local $7 - (get_local $4) - ) - (set_local $25 - (get_local $27) - ) - (set_local $3 - (i32.shl - (get_local $3) - (i32.xor - (i32.and - (get_local $29) - (i32.const 1) - ) + (set_local $12 + (get_local $27) + ) + (set_local $38 + (get_local $0) + ) + (set_local $7 + (i32.const 86) + ) + ) + (block + (set_local $7 + (get_local $4) + ) + (set_local $25 + (get_local $27) + ) + (set_local $3 + (i32.shl + (get_local $3) + (i32.xor + (i32.and + (get_local $29) (i32.const 1) ) + (i32.const 1) ) ) - (set_local $5 - (get_local $0) - ) ) + (set_local $5 + (get_local $0) + ) + (br $while-in$18) ) - (br $while-in$18) ) ) ) @@ -1943,84 +1937,81 @@ (i32.const 90) ) (loop $while-in$20 - (block $while-out$19 - (set_local $7 - (i32.const 0) - ) - (set_local $3 - (i32.lt_u - (tee_local $5 - (i32.sub - (i32.and - (i32.load offset=4 - (get_local $18) - ) - (i32.const -8) + (set_local $7 + (i32.const 0) + ) + (set_local $3 + (i32.lt_u + (tee_local $5 + (i32.sub + (i32.and + (i32.load offset=4 + (get_local $18) ) - (get_local $2) + (i32.const -8) ) + (get_local $2) ) - (get_local $36) ) + (get_local $36) ) - (set_local $12 - (select - (get_local $5) - (get_local $36) + ) + (set_local $12 + (select + (get_local $5) + (get_local $36) + (get_local $3) + ) + ) + (set_local $5 + (select + (get_local $18) + (get_local $17) + (get_local $3) + ) + ) + (if + (tee_local $3 + (i32.load offset=16 + (get_local $18) + ) + ) + (block + (set_local $36 + (get_local $12) + ) + (set_local $18 (get_local $3) ) + (set_local $17 + (get_local $5) + ) + (br $while-in$20) ) - (set_local $5 - (select + ) + (if + (tee_local $18 + (i32.load offset=20 (get_local $18) - (get_local $17) - (get_local $3) ) ) - (if - (tee_local $3 - (i32.load offset=16 - (get_local $18) - ) + (block + (set_local $36 + (get_local $12) ) - (block - (set_local $36 - (get_local $12) - ) - (set_local $18 - (get_local $3) - ) - (set_local $17 - (get_local $5) - ) - (br $while-in$20) + (set_local $17 + (get_local $5) ) + (br $while-in$20) ) - (if - (tee_local $18 - (i32.load offset=20 - (get_local $18) - ) - ) - (block - (set_local $36 - (get_local $12) - ) - (set_local $17 - (get_local $5) - ) + (block + (set_local $22 + (get_local $12) ) - (block - (set_local $22 - (get_local $12) - ) - (set_local $9 - (get_local $5) - ) - (br $while-out$19) + (set_local $9 + (get_local $5) ) ) - (br $while-in$20) ) ) ) @@ -2118,50 +2109,47 @@ ) ) (loop $while-in$24 - (block $while-out$23 - (if - (tee_local $16 - (i32.load - (tee_local $14 - (i32.add - (get_local $11) - (i32.const 20) - ) + (if + (tee_local $16 + (i32.load + (tee_local $14 + (i32.add + (get_local $11) + (i32.const 20) ) ) ) - (block - (set_local $11 - (get_local $16) - ) - (set_local $0 - (get_local $14) - ) - (br $while-in$24) + ) + (block + (set_local $11 + (get_local $16) + ) + (set_local $0 + (get_local $14) ) + (br $while-in$24) ) - (if - (tee_local $16 - (i32.load - (tee_local $14 - (i32.add - (get_local $11) - (i32.const 16) - ) + ) + (if + (tee_local $16 + (i32.load + (tee_local $14 + (i32.add + (get_local $11) + (i32.const 16) ) ) ) - (block - (set_local $11 - (get_local $16) - ) - (set_local $0 - (get_local $14) - ) + ) + (block + (set_local $11 + (get_local $16) + ) + (set_local $0 + (get_local $14) ) - (br $while-out$23) + (br $while-in$24) ) - (br $while-in$24) ) ) (if @@ -2797,6 +2785,7 @@ (set_local $14 (get_local $3) ) + (br $while-in$32) ) (block (set_local $6 @@ -2808,10 +2797,8 @@ (set_local $7 (i32.const 145) ) - (br $while-out$31) ) ) - (br $while-in$32) ) ) (if @@ -3286,13 +3273,12 @@ ) ) (if - (i32.eqz - (tee_local $13 - (i32.load offset=8 - (get_local $13) - ) + (tee_local $13 + (i32.load offset=8 + (get_local $13) ) ) + (br $while-in$36) (block (set_local $7 (i32.const 171) @@ -3300,7 +3286,6 @@ (br $label$break$c) ) ) - (br $while-in$36) ) ) (if @@ -3927,21 +3912,16 @@ ) ) (if - (i32.eqz - (tee_local $1 - (i32.load offset=8 - (get_local $1) - ) + (tee_local $1 + (i32.load offset=8 + (get_local $1) ) ) - (block - (set_local $37 - (i32.const 1656) - ) - (br $while-out$48) + (br $while-in$49) + (set_local $37 + (i32.const 1656) ) ) - (br $while-in$49) ) ) (if @@ -4340,50 +4320,47 @@ ) ) (loop $while-in$60 - (block $while-out$59 - (if - (tee_local $20 - (i32.load - (tee_local $13 - (i32.add - (get_local $11) - (i32.const 20) - ) + (if + (tee_local $20 + (i32.load + (tee_local $13 + (i32.add + (get_local $11) + (i32.const 20) ) ) ) - (block - (set_local $11 - (get_local $20) - ) - (set_local $0 - (get_local $13) - ) - (br $while-in$60) + ) + (block + (set_local $11 + (get_local $20) + ) + (set_local $0 + (get_local $13) ) + (br $while-in$60) ) - (if - (tee_local $20 - (i32.load - (tee_local $13 - (i32.add - (get_local $11) - (i32.const 16) - ) + ) + (if + (tee_local $20 + (i32.load + (tee_local $13 + (i32.add + (get_local $11) + (i32.const 16) ) ) ) - (block - (set_local $11 - (get_local $20) - ) - (set_local $0 - (get_local $13) - ) + ) + (block + (set_local $11 + (get_local $20) + ) + (set_local $0 + (get_local $13) ) - (br $while-out$59) + (br $while-in$60) ) - (br $while-in$60) ) ) (if @@ -5017,6 +4994,7 @@ (set_local $6 (get_local $17) ) + (br $while-in$70) ) (block (set_local $48 @@ -5028,10 +5006,8 @@ (set_local $7 (i32.const 276) ) - (br $while-out$69) ) ) - (br $while-in$70) ) ) (if @@ -5729,6 +5705,7 @@ (set_local $17 (get_local $6) ) + (br $while-in$76) ) (block (set_local $26 @@ -5740,10 +5717,8 @@ (set_local $7 (i32.const 302) ) - (br $while-out$75) ) ) - (br $while-in$76) ) ) (if @@ -6425,58 +6400,55 @@ ) ) (loop $while-in$5 - (block $while-out$4 - (if - (tee_local $11 - (i32.load - (tee_local $6 - (i32.add - (get_local $1) - (i32.const 20) - ) + (if + (tee_local $11 + (i32.load + (tee_local $6 + (i32.add + (get_local $1) + (i32.const 20) ) ) ) - (block - (set_local $1 - (get_local $11) - ) - (set_local $4 - (get_local $6) - ) - (br $while-in$5) + ) + (block + (set_local $1 + (get_local $11) ) + (set_local $4 + (get_local $6) + ) + (br $while-in$5) ) - (if - (tee_local $11 - (i32.load - (tee_local $6 - (i32.add - (get_local $1) - (i32.const 16) - ) + ) + (if + (tee_local $11 + (i32.load + (tee_local $6 + (i32.add + (get_local $1) + (i32.const 16) ) ) ) - (block - (set_local $1 - (get_local $11) - ) - (set_local $4 - (get_local $6) - ) + ) + (block + (set_local $1 + (get_local $11) ) - (block - (set_local $6 - (get_local $1) - ) - (set_local $10 - (get_local $4) - ) - (br $while-out$4) + (set_local $4 + (get_local $6) + ) + (br $while-in$5) + ) + (block + (set_local $6 + (get_local $1) + ) + (set_local $10 + (get_local $4) ) ) - (br $while-in$5) ) ) (if @@ -7099,54 +7071,51 @@ ) ) (loop $while-in$13 - (block $while-out$12 - (if - (tee_local $11 - (i32.load - (tee_local $1 - (i32.add - (get_local $0) - (i32.const 20) - ) + (if + (tee_local $11 + (i32.load + (tee_local $1 + (i32.add + (get_local $0) + (i32.const 20) ) ) ) - (block - (set_local $0 - (get_local $11) - ) - (set_local $4 - (get_local $1) - ) - (br $while-in$13) + ) + (block + (set_local $0 + (get_local $11) + ) + (set_local $4 + (get_local $1) ) + (br $while-in$13) ) - (if - (tee_local $11 - (i32.load - (tee_local $1 - (i32.add - (get_local $0) - (i32.const 16) - ) + ) + (if + (tee_local $11 + (i32.load + (tee_local $1 + (i32.add + (get_local $0) + (i32.const 16) ) ) ) - (block - (set_local $0 - (get_local $11) - ) - (set_local $4 - (get_local $1) - ) - ) - (br $while-out$12) ) - (br $while-in$13) - ) - ) - (if - (i32.lt_u + (block + (set_local $0 + (get_local $11) + ) + (set_local $4 + (get_local $1) + ) + (br $while-in$13) + ) + ) + ) + (if + (i32.lt_u (get_local $4) (i32.load (i32.const 1224) @@ -7730,6 +7699,7 @@ (set_local $1 (get_local $12) ) + (br $while-in$19) ) (block (set_local $18 @@ -7741,10 +7711,8 @@ (set_local $0 (i32.const 127) ) - (br $while-out$18) ) ) - (br $while-in$19) ) ) (if @@ -7880,22 +7848,21 @@ ) ) (loop $while-in$21 - (block $while-out$20 - (if - (tee_local $2 - (i32.load - (get_local $0) - ) + (if + (tee_local $2 + (i32.load + (get_local $0) ) + ) + (block (set_local $0 (i32.add (get_local $2) (i32.const 8) ) ) - (br $while-out$20) + (br $while-in$21) ) - (br $while-in$21) ) ) (i32.store @@ -8093,121 +8060,122 @@ (set_local $1 (i32.const 8) ) - (br $while-out$0) - ) - ) - (set_local $10 - (i32.sub - (get_local $5) - (get_local $6) ) - ) - (set_local $3 - (if - (i32.gt_u - (get_local $6) - (tee_local $5 - (i32.load offset=4 - (get_local $4) - ) + (block + (set_local $10 + (i32.sub + (get_local $5) + (get_local $6) ) ) - (block - (i32.store - (get_local $9) - (tee_local $7 - (i32.load - (get_local $8) - ) - ) - ) - (i32.store - (get_local $14) - (get_local $7) - ) - (set_local $6 - (i32.sub + (set_local $3 + (if + (i32.gt_u (get_local $6) - (get_local $5) - ) - ) - (set_local $7 - (i32.add - (get_local $4) - (i32.const 8) + (tee_local $5 + (i32.load offset=4 + (get_local $4) + ) + ) ) - ) - (set_local $15 - (i32.add - (get_local $3) - (i32.const -1) + (block + (i32.store + (get_local $9) + (tee_local $7 + (i32.load + (get_local $8) + ) + ) + ) + (i32.store + (get_local $14) + (get_local $7) + ) + (set_local $6 + (i32.sub + (get_local $6) + (get_local $5) + ) + ) + (set_local $7 + (i32.add + (get_local $4) + (i32.const 8) + ) + ) + (set_local $15 + (i32.add + (get_local $3) + (i32.const -1) + ) + ) + (i32.load offset=12 + (get_local $4) + ) ) - ) - (i32.load offset=12 - (get_local $4) - ) - ) - (if - (i32.eq - (get_local $3) - (i32.const 2) - ) - (block - (i32.store - (get_local $9) - (i32.add - (i32.load + (if + (i32.eq + (get_local $3) + (i32.const 2) + ) + (block + (i32.store (get_local $9) + (i32.add + (i32.load + (get_local $9) + ) + (get_local $6) + ) ) - (get_local $6) + (set_local $7 + (get_local $4) + ) + (set_local $15 + (i32.const 2) + ) + (get_local $5) + ) + (block + (set_local $7 + (get_local $4) + ) + (set_local $15 + (get_local $3) + ) + (get_local $5) ) ) - (set_local $7 - (get_local $4) - ) - (set_local $15 - (i32.const 2) - ) - (get_local $5) ) - (block - (set_local $7 - (get_local $4) - ) - (set_local $15 - (get_local $3) + ) + (i32.store + (get_local $7) + (i32.add + (i32.load + (get_local $7) ) - (get_local $5) + (get_local $6) ) ) - ) - ) - (i32.store - (get_local $7) - (i32.add - (i32.load + (i32.store offset=4 (get_local $7) + (i32.sub + (get_local $3) + (get_local $6) + ) ) - (get_local $6) - ) - ) - (i32.store offset=4 - (get_local $7) - (i32.sub - (get_local $3) - (get_local $6) + (set_local $4 + (get_local $7) + ) + (set_local $3 + (get_local $15) + ) + (set_local $5 + (get_local $10) + ) + (br $while-in$1) ) ) - (set_local $4 - (get_local $7) - ) - (set_local $3 - (get_local $15) - ) - (set_local $5 - (get_local $10) - ) - (br $while-in$1) ) ) (if @@ -8398,49 +8366,46 @@ (get_local $1) ) (loop $while-in$3 - (block $while-out$2 - (if - (i32.eqz - (get_local $3) + (if + (i32.eqz + (get_local $3) + ) + (block + (set_local $2 + (get_local $0) ) - (block - (set_local $2 - (get_local $0) - ) - (set_local $3 - (i32.const 0) - ) - (br $label$break$b - (get_local $1) - ) + (set_local $3 + (i32.const 0) + ) + (br $label$break$b + (get_local $1) ) ) - (if - (i32.eq - (i32.load8_s - (i32.add - (get_local $0) - (tee_local $7 - (i32.add - (get_local $3) - (i32.const -1) - ) + ) + (if + (i32.eq + (i32.load8_s + (i32.add + (get_local $0) + (tee_local $7 + (i32.add + (get_local $3) + (i32.const -1) ) ) ) - (i32.const 10) - ) - (block - (set_local $4 - (get_local $3) - ) - (br $while-out$2) ) + (i32.const 10) + ) + (set_local $4 + (get_local $3) + ) + (block (set_local $3 (get_local $7) ) + (br $while-in$3) ) - (br $while-in$3) ) ) (br_if $label$break$a @@ -8539,45 +8504,40 @@ (get_local $3) ) (loop $while-in$2 - (block $while-out$1 - (if - (i32.eqz - (i32.load8_s - (get_local $0) - ) - ) - (block - (set_local $5 - (get_local $4) - ) - (br $label$break$a) + (if + (i32.eqz + (i32.load8_s + (get_local $0) ) ) - (if - (i32.eqz - (i32.and - (tee_local $4 - (tee_local $0 - (i32.add - (get_local $0) - (i32.const 1) - ) - ) - ) - (i32.const 3) - ) + (block + (set_local $5 + (get_local $4) ) - (block - (set_local $2 - (get_local $0) - ) - (set_local $1 - (i32.const 4) + (br $label$break$a) + ) + ) + (if + (i32.and + (tee_local $4 + (tee_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) ) - (br $while-out$1) ) + (i32.const 3) ) (br $while-in$2) + (block + (set_local $2 + (get_local $0) + ) + (set_local $1 + (i32.const 4) + ) + ) ) ) ) @@ -8601,8 +8561,8 @@ (get_local $2) ) (loop $while-in$4 - (block $while-out$3 - (if + (if + (i32.eqz (i32.and (i32.xor (i32.and @@ -8620,15 +8580,16 @@ (i32.const -16843009) ) ) - (br $while-out$3) + ) + (block (set_local $1 (i32.add (get_local $1) (i32.const 4) ) ) + (br $while-in$4) ) - (br $while-in$4) ) ) (if @@ -8647,22 +8608,21 @@ (get_local $1) ) (loop $while-in$6 - (block $while-out$5 - (if - (i32.load8_s - (tee_local $1 - (i32.add - (get_local $2) - (i32.const 1) - ) + (if + (i32.load8_s + (tee_local $1 + (i32.add + (get_local $2) + (i32.const 1) ) ) + ) + (block (set_local $2 (get_local $1) ) - (br $while-out$5) + (br $while-in$6) ) - (br $while-in$6) ) ) ) @@ -8751,62 +8711,55 @@ (get_local $0) ) (loop $while-in$3 - (block $while-out$2 - (set_local $0 - (if - (i32.gt_s - (i32.load offset=76 - (get_local $1) - ) - (i32.const -1) - ) - (call $Ya + (set_local $0 + (if + (i32.gt_s + (i32.load offset=76 (get_local $1) ) - (i32.const 0) - ) - ) - (set_local $2 - (if - (i32.gt_u - (i32.load offset=20 - (get_local $1) - ) - (i32.load offset=28 - (get_local $1) - ) - ) - (i32.or - (call $$a - (get_local $1) - ) - (get_local $2) - ) - (get_local $2) + (i32.const -1) ) - ) - (if - (get_local $0) - (call $Ta + (call $Ya (get_local $1) ) + (i32.const 0) ) + ) + (set_local $2 (if - (i32.eqz - (tee_local $1 - (i32.load offset=56 - (get_local $1) - ) + (i32.gt_u + (i32.load offset=20 + (get_local $1) + ) + (i32.load offset=28 + (get_local $1) ) ) - (block - (set_local $0 - (get_local $2) + (i32.or + (call $$a + (get_local $1) ) - (br $while-out$2) + (get_local $2) + ) + (get_local $2) + ) + ) + (if + (get_local $0) + (call $Ta + (get_local $1) + ) + ) + (if + (tee_local $1 + (i32.load offset=56 + (get_local $1) ) ) (br $while-in$3) + (set_local $0 + (get_local $2) + ) ) ) ) @@ -9179,75 +9132,75 @@ ) ) (loop $while-in$3 - (block $while-out$2 - (br_if $while-out$2 - (i32.lt_s - (get_local $2) - (i32.const 4) - ) - ) - (i32.store - (get_local $0) - (i32.load - (get_local $1) - ) + (if + (i32.ge_s + (get_local $2) + (i32.const 4) ) - (set_local $0 - (i32.add + (block + (i32.store (get_local $0) - (i32.const 4) + (i32.load + (get_local $1) + ) ) - ) - (set_local $1 - (i32.add - (get_local $1) - (i32.const 4) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 4) + ) ) - ) - (set_local $2 - (i32.sub - (get_local $2) - (i32.const 4) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 4) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 4) + ) ) + (br $while-in$3) ) - (br $while-in$3) ) ) ) ) (loop $while-in$5 - (block $while-out$4 - (br_if $while-out$4 - (i32.le_s - (get_local $2) - (i32.const 0) - ) - ) - (i32.store8 - (get_local $0) - (i32.load8_s - (get_local $1) - ) + (if + (i32.gt_s + (get_local $2) + (i32.const 0) ) - (set_local $0 - (i32.add + (block + (i32.store8 (get_local $0) - (i32.const 1) + (i32.load8_s + (get_local $1) + ) ) - ) - (set_local $1 - (i32.add - (get_local $1) - (i32.const 1) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) ) - ) - (set_local $2 - (i32.sub - (get_local $2) - (i32.const 1) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + (br $while-in$5) ) - (br $while-in$5) ) ) (get_local $3) @@ -9322,70 +9275,70 @@ ) ) (loop $while-in$1 - (block $while-out$0 - (br_if $while-out$0 - (i32.ge_s - (get_local $0) - (get_local $3) - ) - ) - (i32.store8 + (if + (i32.lt_s (get_local $0) - (get_local $1) + (get_local $3) ) - (set_local $0 - (i32.add + (block + (i32.store8 (get_local $0) - (i32.const 1) + (get_local $1) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) ) + (br $while-in$1) ) - (br $while-in$1) ) ) ) ) (loop $while-in$3 - (block $while-out$2 - (br_if $while-out$2 - (i32.ge_s - (get_local $0) - (get_local $6) - ) - ) - (i32.store + (if + (i32.lt_s (get_local $0) - (get_local $5) + (get_local $6) ) - (set_local $0 - (i32.add + (block + (i32.store (get_local $0) - (i32.const 4) + (get_local $5) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 4) + ) ) + (br $while-in$3) ) - (br $while-in$3) ) ) ) ) (loop $while-in$5 - (block $while-out$4 - (br_if $while-out$4 - (i32.ge_s - (get_local $0) - (get_local $4) - ) - ) - (i32.store8 + (if + (i32.lt_s (get_local $0) - (get_local $1) + (get_local $4) ) - (set_local $0 - (i32.add + (block + (i32.store8 (get_local $0) - (i32.const 1) + (get_local $1) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) ) + (br $while-in$5) ) - (br $while-in$5) ) ) (i32.sub diff --git a/test/memorygrowth.fromasm.imprecise b/test/memorygrowth.fromasm.imprecise index 6e3124830..44a4bd01d 100644 --- a/test/memorygrowth.fromasm.imprecise +++ b/test/memorygrowth.fromasm.imprecise @@ -962,50 +962,47 @@ ) ) (loop $while-in$11 - (block $while-out$10 - (if - (tee_local $7 - (i32.load - (tee_local $8 - (i32.add - (get_local $11) - (i32.const 20) - ) + (if + (tee_local $7 + (i32.load + (tee_local $8 + (i32.add + (get_local $11) + (i32.const 20) ) ) ) - (block - (set_local $11 - (get_local $7) - ) - (set_local $0 - (get_local $8) - ) - (br $while-in$11) + ) + (block + (set_local $11 + (get_local $7) + ) + (set_local $0 + (get_local $8) ) + (br $while-in$11) ) - (if - (tee_local $7 - (i32.load - (tee_local $8 - (i32.add - (get_local $11) - (i32.const 16) - ) + ) + (if + (tee_local $7 + (i32.load + (tee_local $8 + (i32.add + (get_local $11) + (i32.const 16) ) ) ) - (block - (set_local $11 - (get_local $7) - ) - (set_local $0 - (get_local $8) - ) + ) + (block + (set_local $11 + (get_local $7) + ) + (set_local $0 + (get_local $8) ) - (br $while-out$10) + (br $while-in$11) ) - (br $while-in$11) ) ) (if @@ -1608,90 +1605,88 @@ (i32.const 0) ) (loop $while-in$18 - (block $while-out$17 - (if - (i32.lt_u - (tee_local $29 - (i32.sub - (tee_local $27 - (i32.and - (i32.load offset=4 - (get_local $19) - ) - (i32.const -8) + (if + (i32.lt_u + (tee_local $29 + (i32.sub + (tee_local $27 + (i32.and + (i32.load offset=4 + (get_local $19) ) + (i32.const -8) ) - (get_local $2) ) + (get_local $2) ) - (get_local $7) ) - (if - (i32.eq - (get_local $27) - (get_local $2) + (get_local $7) + ) + (if + (i32.eq + (get_local $27) + (get_local $2) + ) + (block + (set_local $36 + (get_local $29) ) - (block - (set_local $36 - (get_local $29) - ) - (set_local $18 - (get_local $19) - ) - (set_local $17 - (get_local $19) - ) - (set_local $7 - (i32.const 90) - ) - (br $label$break$a) + (set_local $18 + (get_local $19) ) - (block - (set_local $4 - (get_local $29) - ) - (set_local $0 - (get_local $19) - ) + (set_local $17 + (get_local $19) + ) + (set_local $7 + (i32.const 90) ) + (br $label$break$a) ) (block (set_local $4 - (get_local $7) + (get_local $29) ) (set_local $0 - (get_local $5) + (get_local $19) ) ) ) - (set_local $27 - (select - (get_local $25) - (tee_local $29 - (i32.load offset=20 - (get_local $19) - ) + (block + (set_local $4 + (get_local $7) + ) + (set_local $0 + (get_local $5) + ) + ) + ) + (set_local $27 + (select + (get_local $25) + (tee_local $29 + (i32.load offset=20 + (get_local $19) ) - (i32.or - (i32.eqz - (get_local $29) - ) - (i32.eq - (get_local $29) - (tee_local $19 - (i32.load + ) + (i32.or + (i32.eqz + (get_local $29) + ) + (i32.eq + (get_local $29) + (tee_local $19 + (i32.load + (i32.add (i32.add - (i32.add - (get_local $19) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $3) - (i32.const 31) - ) - (i32.const 2) + (get_local $19) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $3) + (i32.const 31) ) + (i32.const 2) ) ) ) @@ -1699,52 +1694,51 @@ ) ) ) - (if - (tee_local $29 - (i32.eqz - (get_local $19) - ) + ) + (if + (tee_local $29 + (i32.eqz + (get_local $19) ) - (block - (set_local $40 - (get_local $4) - ) - (set_local $12 - (get_local $27) - ) - (set_local $38 - (get_local $0) - ) - (set_local $7 - (i32.const 86) - ) - (br $while-out$17) + ) + (block + (set_local $40 + (get_local $4) ) - (block - (set_local $7 - (get_local $4) - ) - (set_local $25 - (get_local $27) - ) - (set_local $3 - (i32.shl - (get_local $3) - (i32.xor - (i32.and - (get_local $29) - (i32.const 1) - ) + (set_local $12 + (get_local $27) + ) + (set_local $38 + (get_local $0) + ) + (set_local $7 + (i32.const 86) + ) + ) + (block + (set_local $7 + (get_local $4) + ) + (set_local $25 + (get_local $27) + ) + (set_local $3 + (i32.shl + (get_local $3) + (i32.xor + (i32.and + (get_local $29) (i32.const 1) ) + (i32.const 1) ) ) - (set_local $5 - (get_local $0) - ) ) + (set_local $5 + (get_local $0) + ) + (br $while-in$18) ) - (br $while-in$18) ) ) ) @@ -1941,84 +1935,81 @@ (i32.const 90) ) (loop $while-in$20 - (block $while-out$19 - (set_local $7 - (i32.const 0) - ) - (set_local $3 - (i32.lt_u - (tee_local $5 - (i32.sub - (i32.and - (i32.load offset=4 - (get_local $18) - ) - (i32.const -8) + (set_local $7 + (i32.const 0) + ) + (set_local $3 + (i32.lt_u + (tee_local $5 + (i32.sub + (i32.and + (i32.load offset=4 + (get_local $18) ) - (get_local $2) + (i32.const -8) ) + (get_local $2) ) - (get_local $36) ) + (get_local $36) ) - (set_local $12 - (select - (get_local $5) - (get_local $36) + ) + (set_local $12 + (select + (get_local $5) + (get_local $36) + (get_local $3) + ) + ) + (set_local $5 + (select + (get_local $18) + (get_local $17) + (get_local $3) + ) + ) + (if + (tee_local $3 + (i32.load offset=16 + (get_local $18) + ) + ) + (block + (set_local $36 + (get_local $12) + ) + (set_local $18 (get_local $3) ) + (set_local $17 + (get_local $5) + ) + (br $while-in$20) ) - (set_local $5 - (select + ) + (if + (tee_local $18 + (i32.load offset=20 (get_local $18) - (get_local $17) - (get_local $3) ) ) - (if - (tee_local $3 - (i32.load offset=16 - (get_local $18) - ) + (block + (set_local $36 + (get_local $12) ) - (block - (set_local $36 - (get_local $12) - ) - (set_local $18 - (get_local $3) - ) - (set_local $17 - (get_local $5) - ) - (br $while-in$20) + (set_local $17 + (get_local $5) ) + (br $while-in$20) ) - (if - (tee_local $18 - (i32.load offset=20 - (get_local $18) - ) - ) - (block - (set_local $36 - (get_local $12) - ) - (set_local $17 - (get_local $5) - ) + (block + (set_local $22 + (get_local $12) ) - (block - (set_local $22 - (get_local $12) - ) - (set_local $9 - (get_local $5) - ) - (br $while-out$19) + (set_local $9 + (get_local $5) ) ) - (br $while-in$20) ) ) ) @@ -2116,50 +2107,47 @@ ) ) (loop $while-in$24 - (block $while-out$23 - (if - (tee_local $16 - (i32.load - (tee_local $14 - (i32.add - (get_local $11) - (i32.const 20) - ) + (if + (tee_local $16 + (i32.load + (tee_local $14 + (i32.add + (get_local $11) + (i32.const 20) ) ) ) - (block - (set_local $11 - (get_local $16) - ) - (set_local $0 - (get_local $14) - ) - (br $while-in$24) + ) + (block + (set_local $11 + (get_local $16) + ) + (set_local $0 + (get_local $14) ) + (br $while-in$24) ) - (if - (tee_local $16 - (i32.load - (tee_local $14 - (i32.add - (get_local $11) - (i32.const 16) - ) + ) + (if + (tee_local $16 + (i32.load + (tee_local $14 + (i32.add + (get_local $11) + (i32.const 16) ) ) ) - (block - (set_local $11 - (get_local $16) - ) - (set_local $0 - (get_local $14) - ) + ) + (block + (set_local $11 + (get_local $16) + ) + (set_local $0 + (get_local $14) ) - (br $while-out$23) + (br $while-in$24) ) - (br $while-in$24) ) ) (if @@ -2795,6 +2783,7 @@ (set_local $14 (get_local $3) ) + (br $while-in$32) ) (block (set_local $6 @@ -2806,10 +2795,8 @@ (set_local $7 (i32.const 145) ) - (br $while-out$31) ) ) - (br $while-in$32) ) ) (if @@ -3284,13 +3271,12 @@ ) ) (if - (i32.eqz - (tee_local $13 - (i32.load offset=8 - (get_local $13) - ) + (tee_local $13 + (i32.load offset=8 + (get_local $13) ) ) + (br $while-in$36) (block (set_local $7 (i32.const 171) @@ -3298,7 +3284,6 @@ (br $label$break$c) ) ) - (br $while-in$36) ) ) (if @@ -3925,21 +3910,16 @@ ) ) (if - (i32.eqz - (tee_local $1 - (i32.load offset=8 - (get_local $1) - ) + (tee_local $1 + (i32.load offset=8 + (get_local $1) ) ) - (block - (set_local $37 - (i32.const 1656) - ) - (br $while-out$48) + (br $while-in$49) + (set_local $37 + (i32.const 1656) ) ) - (br $while-in$49) ) ) (if @@ -4338,50 +4318,47 @@ ) ) (loop $while-in$60 - (block $while-out$59 - (if - (tee_local $20 - (i32.load - (tee_local $13 - (i32.add - (get_local $11) - (i32.const 20) - ) + (if + (tee_local $20 + (i32.load + (tee_local $13 + (i32.add + (get_local $11) + (i32.const 20) ) ) ) - (block - (set_local $11 - (get_local $20) - ) - (set_local $0 - (get_local $13) - ) - (br $while-in$60) + ) + (block + (set_local $11 + (get_local $20) + ) + (set_local $0 + (get_local $13) ) + (br $while-in$60) ) - (if - (tee_local $20 - (i32.load - (tee_local $13 - (i32.add - (get_local $11) - (i32.const 16) - ) + ) + (if + (tee_local $20 + (i32.load + (tee_local $13 + (i32.add + (get_local $11) + (i32.const 16) ) ) ) - (block - (set_local $11 - (get_local $20) - ) - (set_local $0 - (get_local $13) - ) + ) + (block + (set_local $11 + (get_local $20) + ) + (set_local $0 + (get_local $13) ) - (br $while-out$59) + (br $while-in$60) ) - (br $while-in$60) ) ) (if @@ -5015,6 +4992,7 @@ (set_local $6 (get_local $17) ) + (br $while-in$70) ) (block (set_local $48 @@ -5026,10 +5004,8 @@ (set_local $7 (i32.const 276) ) - (br $while-out$69) ) ) - (br $while-in$70) ) ) (if @@ -5727,6 +5703,7 @@ (set_local $17 (get_local $6) ) + (br $while-in$76) ) (block (set_local $26 @@ -5738,10 +5715,8 @@ (set_local $7 (i32.const 302) ) - (br $while-out$75) ) ) - (br $while-in$76) ) ) (if @@ -6423,58 +6398,55 @@ ) ) (loop $while-in$5 - (block $while-out$4 - (if - (tee_local $11 - (i32.load - (tee_local $6 - (i32.add - (get_local $1) - (i32.const 20) - ) + (if + (tee_local $11 + (i32.load + (tee_local $6 + (i32.add + (get_local $1) + (i32.const 20) ) ) ) - (block - (set_local $1 - (get_local $11) - ) - (set_local $4 - (get_local $6) - ) - (br $while-in$5) + ) + (block + (set_local $1 + (get_local $11) ) + (set_local $4 + (get_local $6) + ) + (br $while-in$5) ) - (if - (tee_local $11 - (i32.load - (tee_local $6 - (i32.add - (get_local $1) - (i32.const 16) - ) + ) + (if + (tee_local $11 + (i32.load + (tee_local $6 + (i32.add + (get_local $1) + (i32.const 16) ) ) ) - (block - (set_local $1 - (get_local $11) - ) - (set_local $4 - (get_local $6) - ) + ) + (block + (set_local $1 + (get_local $11) ) - (block - (set_local $6 - (get_local $1) - ) - (set_local $10 - (get_local $4) - ) - (br $while-out$4) + (set_local $4 + (get_local $6) + ) + (br $while-in$5) + ) + (block + (set_local $6 + (get_local $1) + ) + (set_local $10 + (get_local $4) ) ) - (br $while-in$5) ) ) (if @@ -7097,54 +7069,51 @@ ) ) (loop $while-in$13 - (block $while-out$12 - (if - (tee_local $11 - (i32.load - (tee_local $1 - (i32.add - (get_local $0) - (i32.const 20) - ) + (if + (tee_local $11 + (i32.load + (tee_local $1 + (i32.add + (get_local $0) + (i32.const 20) ) ) ) - (block - (set_local $0 - (get_local $11) - ) - (set_local $4 - (get_local $1) - ) - (br $while-in$13) + ) + (block + (set_local $0 + (get_local $11) + ) + (set_local $4 + (get_local $1) ) + (br $while-in$13) ) - (if - (tee_local $11 - (i32.load - (tee_local $1 - (i32.add - (get_local $0) - (i32.const 16) - ) + ) + (if + (tee_local $11 + (i32.load + (tee_local $1 + (i32.add + (get_local $0) + (i32.const 16) ) ) ) - (block - (set_local $0 - (get_local $11) - ) - (set_local $4 - (get_local $1) - ) - ) - (br $while-out$12) ) - (br $while-in$13) - ) - ) - (if - (i32.lt_u + (block + (set_local $0 + (get_local $11) + ) + (set_local $4 + (get_local $1) + ) + (br $while-in$13) + ) + ) + ) + (if + (i32.lt_u (get_local $4) (i32.load (i32.const 1224) @@ -7728,6 +7697,7 @@ (set_local $1 (get_local $12) ) + (br $while-in$19) ) (block (set_local $18 @@ -7739,10 +7709,8 @@ (set_local $0 (i32.const 127) ) - (br $while-out$18) ) ) - (br $while-in$19) ) ) (if @@ -7878,22 +7846,21 @@ ) ) (loop $while-in$21 - (block $while-out$20 - (if - (tee_local $2 - (i32.load - (get_local $0) - ) + (if + (tee_local $2 + (i32.load + (get_local $0) ) + ) + (block (set_local $0 (i32.add (get_local $2) (i32.const 8) ) ) - (br $while-out$20) + (br $while-in$21) ) - (br $while-in$21) ) ) (i32.store @@ -8091,121 +8058,122 @@ (set_local $1 (i32.const 8) ) - (br $while-out$0) - ) - ) - (set_local $10 - (i32.sub - (get_local $5) - (get_local $6) ) - ) - (set_local $3 - (if - (i32.gt_u - (get_local $6) - (tee_local $5 - (i32.load offset=4 - (get_local $4) - ) + (block + (set_local $10 + (i32.sub + (get_local $5) + (get_local $6) ) ) - (block - (i32.store - (get_local $9) - (tee_local $7 - (i32.load - (get_local $8) - ) - ) - ) - (i32.store - (get_local $14) - (get_local $7) - ) - (set_local $6 - (i32.sub + (set_local $3 + (if + (i32.gt_u (get_local $6) - (get_local $5) - ) - ) - (set_local $7 - (i32.add - (get_local $4) - (i32.const 8) + (tee_local $5 + (i32.load offset=4 + (get_local $4) + ) + ) ) - ) - (set_local $15 - (i32.add - (get_local $3) - (i32.const -1) + (block + (i32.store + (get_local $9) + (tee_local $7 + (i32.load + (get_local $8) + ) + ) + ) + (i32.store + (get_local $14) + (get_local $7) + ) + (set_local $6 + (i32.sub + (get_local $6) + (get_local $5) + ) + ) + (set_local $7 + (i32.add + (get_local $4) + (i32.const 8) + ) + ) + (set_local $15 + (i32.add + (get_local $3) + (i32.const -1) + ) + ) + (i32.load offset=12 + (get_local $4) + ) ) - ) - (i32.load offset=12 - (get_local $4) - ) - ) - (if - (i32.eq - (get_local $3) - (i32.const 2) - ) - (block - (i32.store - (get_local $9) - (i32.add - (i32.load + (if + (i32.eq + (get_local $3) + (i32.const 2) + ) + (block + (i32.store (get_local $9) + (i32.add + (i32.load + (get_local $9) + ) + (get_local $6) + ) ) - (get_local $6) + (set_local $7 + (get_local $4) + ) + (set_local $15 + (i32.const 2) + ) + (get_local $5) + ) + (block + (set_local $7 + (get_local $4) + ) + (set_local $15 + (get_local $3) + ) + (get_local $5) ) ) - (set_local $7 - (get_local $4) - ) - (set_local $15 - (i32.const 2) - ) - (get_local $5) ) - (block - (set_local $7 - (get_local $4) - ) - (set_local $15 - (get_local $3) + ) + (i32.store + (get_local $7) + (i32.add + (i32.load + (get_local $7) ) - (get_local $5) + (get_local $6) ) ) - ) - ) - (i32.store - (get_local $7) - (i32.add - (i32.load + (i32.store offset=4 (get_local $7) + (i32.sub + (get_local $3) + (get_local $6) + ) ) - (get_local $6) - ) - ) - (i32.store offset=4 - (get_local $7) - (i32.sub - (get_local $3) - (get_local $6) + (set_local $4 + (get_local $7) + ) + (set_local $3 + (get_local $15) + ) + (set_local $5 + (get_local $10) + ) + (br $while-in$1) ) ) - (set_local $4 - (get_local $7) - ) - (set_local $3 - (get_local $15) - ) - (set_local $5 - (get_local $10) - ) - (br $while-in$1) ) ) (if @@ -8396,49 +8364,46 @@ (get_local $1) ) (loop $while-in$3 - (block $while-out$2 - (if - (i32.eqz - (get_local $3) + (if + (i32.eqz + (get_local $3) + ) + (block + (set_local $2 + (get_local $0) ) - (block - (set_local $2 - (get_local $0) - ) - (set_local $3 - (i32.const 0) - ) - (br $label$break$b - (get_local $1) - ) + (set_local $3 + (i32.const 0) + ) + (br $label$break$b + (get_local $1) ) ) - (if - (i32.eq - (i32.load8_s - (i32.add - (get_local $0) - (tee_local $7 - (i32.add - (get_local $3) - (i32.const -1) - ) + ) + (if + (i32.eq + (i32.load8_s + (i32.add + (get_local $0) + (tee_local $7 + (i32.add + (get_local $3) + (i32.const -1) ) ) ) - (i32.const 10) - ) - (block - (set_local $4 - (get_local $3) - ) - (br $while-out$2) ) + (i32.const 10) + ) + (set_local $4 + (get_local $3) + ) + (block (set_local $3 (get_local $7) ) + (br $while-in$3) ) - (br $while-in$3) ) ) (br_if $label$break$a @@ -8537,45 +8502,40 @@ (get_local $3) ) (loop $while-in$2 - (block $while-out$1 - (if - (i32.eqz - (i32.load8_s - (get_local $0) - ) - ) - (block - (set_local $5 - (get_local $4) - ) - (br $label$break$a) + (if + (i32.eqz + (i32.load8_s + (get_local $0) ) ) - (if - (i32.eqz - (i32.and - (tee_local $4 - (tee_local $0 - (i32.add - (get_local $0) - (i32.const 1) - ) - ) - ) - (i32.const 3) - ) + (block + (set_local $5 + (get_local $4) ) - (block - (set_local $2 - (get_local $0) - ) - (set_local $1 - (i32.const 4) + (br $label$break$a) + ) + ) + (if + (i32.and + (tee_local $4 + (tee_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) ) - (br $while-out$1) ) + (i32.const 3) ) (br $while-in$2) + (block + (set_local $2 + (get_local $0) + ) + (set_local $1 + (i32.const 4) + ) + ) ) ) ) @@ -8599,8 +8559,8 @@ (get_local $2) ) (loop $while-in$4 - (block $while-out$3 - (if + (if + (i32.eqz (i32.and (i32.xor (i32.and @@ -8618,15 +8578,16 @@ (i32.const -16843009) ) ) - (br $while-out$3) + ) + (block (set_local $1 (i32.add (get_local $1) (i32.const 4) ) ) + (br $while-in$4) ) - (br $while-in$4) ) ) (if @@ -8645,22 +8606,21 @@ (get_local $1) ) (loop $while-in$6 - (block $while-out$5 - (if - (i32.load8_s - (tee_local $1 - (i32.add - (get_local $2) - (i32.const 1) - ) + (if + (i32.load8_s + (tee_local $1 + (i32.add + (get_local $2) + (i32.const 1) ) ) + ) + (block (set_local $2 (get_local $1) ) - (br $while-out$5) + (br $while-in$6) ) - (br $while-in$6) ) ) ) @@ -8749,62 +8709,55 @@ (get_local $0) ) (loop $while-in$3 - (block $while-out$2 - (set_local $0 - (if - (i32.gt_s - (i32.load offset=76 - (get_local $1) - ) - (i32.const -1) - ) - (call $Ya + (set_local $0 + (if + (i32.gt_s + (i32.load offset=76 (get_local $1) ) - (i32.const 0) - ) - ) - (set_local $2 - (if - (i32.gt_u - (i32.load offset=20 - (get_local $1) - ) - (i32.load offset=28 - (get_local $1) - ) - ) - (i32.or - (call $$a - (get_local $1) - ) - (get_local $2) - ) - (get_local $2) + (i32.const -1) ) - ) - (if - (get_local $0) - (call $Ta + (call $Ya (get_local $1) ) + (i32.const 0) ) + ) + (set_local $2 (if - (i32.eqz - (tee_local $1 - (i32.load offset=56 - (get_local $1) - ) + (i32.gt_u + (i32.load offset=20 + (get_local $1) + ) + (i32.load offset=28 + (get_local $1) ) ) - (block - (set_local $0 - (get_local $2) + (i32.or + (call $$a + (get_local $1) ) - (br $while-out$2) + (get_local $2) + ) + (get_local $2) + ) + ) + (if + (get_local $0) + (call $Ta + (get_local $1) + ) + ) + (if + (tee_local $1 + (i32.load offset=56 + (get_local $1) ) ) (br $while-in$3) + (set_local $0 + (get_local $2) + ) ) ) ) @@ -9177,75 +9130,75 @@ ) ) (loop $while-in$3 - (block $while-out$2 - (br_if $while-out$2 - (i32.lt_s - (get_local $2) - (i32.const 4) - ) - ) - (i32.store - (get_local $0) - (i32.load - (get_local $1) - ) + (if + (i32.ge_s + (get_local $2) + (i32.const 4) ) - (set_local $0 - (i32.add + (block + (i32.store (get_local $0) - (i32.const 4) + (i32.load + (get_local $1) + ) ) - ) - (set_local $1 - (i32.add - (get_local $1) - (i32.const 4) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 4) + ) ) - ) - (set_local $2 - (i32.sub - (get_local $2) - (i32.const 4) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 4) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 4) + ) ) + (br $while-in$3) ) - (br $while-in$3) ) ) ) ) (loop $while-in$5 - (block $while-out$4 - (br_if $while-out$4 - (i32.le_s - (get_local $2) - (i32.const 0) - ) - ) - (i32.store8 - (get_local $0) - (i32.load8_s - (get_local $1) - ) + (if + (i32.gt_s + (get_local $2) + (i32.const 0) ) - (set_local $0 - (i32.add + (block + (i32.store8 (get_local $0) - (i32.const 1) + (i32.load8_s + (get_local $1) + ) ) - ) - (set_local $1 - (i32.add - (get_local $1) - (i32.const 1) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) ) - ) - (set_local $2 - (i32.sub - (get_local $2) - (i32.const 1) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + (br $while-in$5) ) - (br $while-in$5) ) ) (get_local $3) @@ -9320,70 +9273,70 @@ ) ) (loop $while-in$1 - (block $while-out$0 - (br_if $while-out$0 - (i32.ge_s - (get_local $0) - (get_local $3) - ) - ) - (i32.store8 + (if + (i32.lt_s (get_local $0) - (get_local $1) + (get_local $3) ) - (set_local $0 - (i32.add + (block + (i32.store8 (get_local $0) - (i32.const 1) + (get_local $1) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) ) + (br $while-in$1) ) - (br $while-in$1) ) ) ) ) (loop $while-in$3 - (block $while-out$2 - (br_if $while-out$2 - (i32.ge_s - (get_local $0) - (get_local $6) - ) - ) - (i32.store + (if + (i32.lt_s (get_local $0) - (get_local $5) + (get_local $6) ) - (set_local $0 - (i32.add + (block + (i32.store (get_local $0) - (i32.const 4) + (get_local $5) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 4) + ) ) + (br $while-in$3) ) - (br $while-in$3) ) ) ) ) (loop $while-in$5 - (block $while-out$4 - (br_if $while-out$4 - (i32.ge_s - (get_local $0) - (get_local $4) - ) - ) - (i32.store8 + (if + (i32.lt_s (get_local $0) - (get_local $1) + (get_local $4) ) - (set_local $0 - (i32.add + (block + (i32.store8 (get_local $0) - (i32.const 1) + (get_local $1) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) ) + (br $while-in$5) ) - (br $while-in$5) ) ) (i32.sub diff --git a/test/passes/remove-unused-brs.txt b/test/passes/remove-unused-brs.txt index 1c5c8e713..ff150f1ac 100644 --- a/test/passes/remove-unused-brs.txt +++ b/test/passes/remove-unused-brs.txt @@ -419,4 +419,276 @@ (i32.const 1) ) ) + (func $loops (type $1) + (loop $in + (block $out + (br_if $in + (i32.eqz + (i32.const 0) + ) + ) + ) + ) + (loop $in + (br $in) + ) + (loop $loop-in1 + (block $out + (br_if $out + (i32.const 0) + ) + ) + ) + (loop $in + (block $out + (br_if $out + (i32.const 0) + ) + ) + ) + (loop $in + (nop) + ) + (loop $in + (block $out + ) + ) + (loop $in + (block $out + (br_if $out + (i32.const 0) + ) + (br_if $in + (i32.const 1) + ) + ) + ) + (loop $in + (block $out + (br_if $in + (i32.const 0) + ) + ) + ) + (loop $in + (block $out + (if + (i32.const 0) + (unreachable) + ) + (br $in) + ) + ) + (loop $in + (block $out + (if + (i32.const 0) + (block $block8 + (call $loops) + ) + (br $in) + ) + ) + ) + (loop $in-todo + (block $out-todo + (if + (i32.const 0) + (nop) + (block + (call $loops) + (br $in-todo) + ) + ) + ) + ) + (loop $in + (block $out + (if + (i32.const 0) + (nop) + (block + (call $loops) + (br $in) + ) + ) + ) + ) + (loop $in + (block $out + (if + (i32.const 0) + (block + (call $loops) + (br $in) + ) + (nop) + ) + ) + ) + (loop $in + (block $out + (if + (i32.const 0) + (block $block15 + (drop + (i32.const 1) + ) + (call $loops) + (br $in) + ) + (nop) + ) + ) + ) + (loop $in + (block $out + (if + (i32.const 0) + (nop) + (block + (call $loops) + (drop + (i32.const 100) + ) + (br $in) + ) + ) + ) + ) + (loop $in + (block $out + (if + (i32.const 0) + (block + (call $loops) + (drop + (i32.const 101) + ) + (br $in) + ) + (nop) + ) + ) + ) + (loop $in + (block $out + (if + (i32.const 0) + (block $block22 + (drop + (i32.const 1) + ) + (call $loops) + (drop + (i32.const 102) + ) + (br $in) + ) + (nop) + ) + ) + ) + (loop $in + (block $out + (if + (i32.const 0) + (br $out) + (call $loops) + ) + (return) + (br $in) + ) + ) + (loop $in + (block $out + (if + (i32.const 0) + (br $out) + (call $loops) + ) + (br $out) + (br $in) + ) + ) + (loop $in + (block $out + (if + (i32.const 0) + (nop) + (block + (call $loops) + (drop + (block $out2 + (i32.const 1) + ) + ) + (br $in) + ) + ) + ) + ) + (loop $in + (block $out + (br_if $in + (i32.eqz + (i32.const 0) + ) + ) + ) + ) + (loop $in-todo2 + (block $out-todo2 + (if + (i32.const 0) + (nop) + (block + (call $loops) + (br $in-todo2) + ) + ) + ) + ) + (loop $in + (block $out + (br $out) + (br $in) + ) + ) + (loop $in + (block $out + (br_if $in + (i32.const 0) + ) + (br $in) + ) + ) + (loop $in-not + (block $out-not + (br_if $out-not + (i32.const -1) + ) + (br_if $out-not + (i32.const 0) + ) + (call $loops) + (br $in-not) + ) + ) + (loop $in-todo2 + (block $out-todo2 + (if + (i32.const 0) + (nop) + (block + (call $loops) + (drop + (i32.const 1) + ) + (br $in-todo2) + ) + ) + ) + ) + ) ) diff --git a/test/passes/remove-unused-brs.wast b/test/passes/remove-unused-brs.wast index f3d20f5e0..87e144096 100644 --- a/test/passes/remove-unused-brs.wast +++ b/test/passes/remove-unused-brs.wast @@ -452,4 +452,205 @@ (i32.const 1) ) ) + (func $loops + (loop $in + (block $out + (if (i32.const 0) (br $out)) + (br $in) ;; we can conditionalize this, and then the br out can vanish + ) + ) + (loop $in + (br $in) + ) + (loop + (block $out + (if (i32.const 0) (br $out)) + (br $out) + ) + ) + (loop $in + (block $out + (if (i32.const 0) (br $out)) + (br $out) + ) + ) + (loop $in) + (loop $in + (block $out) + ) + (loop $in + (block $out + (if (i32.const 0) (br $out)) + (br_if $in (i32.const 1)) + ) + ) + (loop $in + (block $out + (if (i32.const 0) (br $in)) + (br $out) + ) + ) + (loop $in + (block $out + (if (i32.const 0) (unreachable)) + (br $in) + ) + ) + (loop $in + (block $out + (if (i32.const 0) + (block + (call $loops) + (br $out) + ) + ) + (br $in) + ) + ) + (loop $in-todo ;; br_if into if + (block $out-todo + (if (i32.const 0) (br $out-todo)) + (call $loops) + (br $in-todo) + ) + ) + (loop $in + (block $out + (if (i32.const 0) + (br $out) + (call $loops) + ) + (br $in) + ) + ) + (loop $in + (block $out + (if (i32.const 0) + (call $loops) + (br $out) + ) + (br $in) + ) + ) + (loop $in + (block $out + (if (i32.const 0) + (block + (drop (i32.const 1)) + (call $loops) + ) + (br $out) + ) + (br $in) + ) + ) + (loop $in + (block $out + (if (i32.const 0) + (br $out) + (call $loops) + ) + (drop (i32.const 100)) + (br $in) + ) + ) + (loop $in + (block $out + (if (i32.const 0) + (call $loops) + (br $out) + ) + (drop (i32.const 101)) + (br $in) + ) + ) + (loop $in + (block $out + (if (i32.const 0) + (block + (drop (i32.const 1)) + (call $loops) + ) + (br $out) + ) + (drop (i32.const 102)) + (br $in) + ) + ) + (loop $in + (block $out + (if (i32.const 0) + (br $out) + (call $loops) + ) + (return) + (br $in) + ) + ) + (loop $in + (block $out + (if (i32.const 0) + (br $out) + (call $loops) + ) + (br $out) + (br $in) + ) + ) + (loop $in + (block $out + (if (i32.const 0) + (br $out) + (call $loops) + ) + (drop + (block $out2 + (br $out2 (i32.const 1)) + ) + ) + (br $in) + ) + ) + (loop $in + (block $out + (br_if $out (i32.const 0)) + (br $in) + ) + ) + (loop $in-todo2 ;; if-ify + (block $out-todo2 + (br_if $out-todo2 (i32.const 0)) + (call $loops) + (br $in-todo2) + ) + ) + (loop $in + (block $out + (br $out) + (br $in) + ) + ) + (loop $in + (block $out + (br_if $in (i32.const 0)) + (br $in) + ) + ) + (loop $in-not ;; do NOT if-ify, the block can't be removed + (block $out-not + (br_if $out-not (i32.const -1)) + (br_if $out-not (i32.const 0)) + (call $loops) + (br $in-not) + ) + ) + (loop $in-todo2 ;; if-ify a slice with 2 things + (block $out-todo2 + (br_if $out-todo2 (i32.const 0)) + (call $loops) + (drop (i32.const 1)) + (br $in-todo2) + ) + ) + ) ) diff --git a/test/unit.fromasm b/test/unit.fromasm index e1956de79..7b941e731 100644 --- a/test/unit.fromasm +++ b/test/unit.fromasm @@ -293,23 +293,23 @@ (i32.const 1) ) (loop $for-in$1 - (block $for-out$0 - (br_if $for-out$0 - (i32.ge_s - (get_local $0) - (i32.const 200) - ) - ) - (call_import $h + (if + (i32.lt_s (get_local $0) + (i32.const 200) ) - (set_local $0 - (i32.add + (block + (call_import $h (get_local $0) - (i32.const 1) ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + (br $for-in$1) ) - (br $for-in$1) ) ) ) diff --git a/test/unit.fromasm.imprecise b/test/unit.fromasm.imprecise index 017284aae..7b548e2db 100644 --- a/test/unit.fromasm.imprecise +++ b/test/unit.fromasm.imprecise @@ -274,23 +274,23 @@ (i32.const 1) ) (loop $for-in$1 - (block $for-out$0 - (br_if $for-out$0 - (i32.ge_s - (get_local $0) - (i32.const 200) - ) - ) - (call_import $h + (if + (i32.lt_s (get_local $0) + (i32.const 200) ) - (set_local $0 - (i32.add + (block + (call_import $h (get_local $0) - (i32.const 1) ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + (br $for-in$1) ) - (br $for-in$1) ) ) ) -- cgit v1.2.3 From 7c0edee0dec829f6c739533aa4c4631978ff4632 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sat, 10 Sep 2016 14:28:19 -0700 Subject: optimize if-else to br_if when in a block --- src/ast_utils.h | 15 ++ src/passes/RemoveUnusedBrs.cpp | 42 +++++- test/emcc_O2_hello_world.fromasm | 39 +++--- test/emcc_O2_hello_world.fromasm.imprecise | 39 +++--- test/emcc_hello_world.fromasm | 216 ++++++++++++++--------------- test/emcc_hello_world.fromasm.imprecise | 216 ++++++++++++++--------------- test/example/c-api-kitchen-sink.txt | 20 ++- test/example/c-api-kitchen-sink.txt.txt | 10 +- test/example/relooper-fuzz.txt | 56 ++++---- test/memorygrowth.fromasm | 39 +++--- test/memorygrowth.fromasm.imprecise | 39 +++--- test/passes/remove-unused-brs.txt | 57 ++++++-- test/passes/remove-unused-brs.wast | 13 ++ 13 files changed, 426 insertions(+), 375 deletions(-) (limited to 'src/ast_utils.h') diff --git a/src/ast_utils.h b/src/ast_utils.h index 6b76dd61d..e785a8daa 100644 --- a/src/ast_utils.h +++ b/src/ast_utils.h @@ -364,6 +364,21 @@ struct ExpressionManipulator { } copier; return flexibleCopy(original, wasm, copier); } + + // Splice an item into the middle of a block's list + static void spliceIntoBlock(Block* block, Index index, Expression* add) { + auto& list = block->list; + if (index == list.size()) { + list.push_back(add); // simple append + } else { + // we need to make room + list.push_back(nullptr); + for (Index i = list.size() - 1; i > index; i--) { + list[i] = list[i - 1]; + } + list[index] = add; + } + } }; struct ExpressionAnalyzer { diff --git a/src/passes/RemoveUnusedBrs.cpp b/src/passes/RemoveUnusedBrs.cpp index a7eb09669..519f0c5a8 100644 --- a/src/passes/RemoveUnusedBrs.cpp +++ b/src/passes/RemoveUnusedBrs.cpp @@ -274,7 +274,8 @@ struct RemoveUnusedBrs : public WalkerPasscast(); // cannot be a break + auto* flow = (*flows[i])->dynCast(); + if (!flow) continue; if (!flow->value) { // return => nop ExpressionManipulator::nop(flow); @@ -293,9 +294,38 @@ struct RemoveUnusedBrs : public WalkerPass>> { + // perform some final optimizations + struct FinalOptimizer : public WalkerPass>> { + void visitBlock(Block* curr) { + // if a block has an if br else br, we can un-conditionalize the latter, allowing + // the if to become a br_if. + // * note that if not in a block already, then we need to create a block for this, so not useful otherwise + // * note that this only happens at the end of a block, as code after the if is dead + // * note that we do this at the end, because un-conditionalizing can interfere with optimizeLoop()ing. + auto& list = curr->list; + for (Index i = 0; i < list.size(); i++) { + auto* iff = list[i]->dynCast(); + if (!iff || !iff->ifFalse || isConcreteWasmType(iff->type)) continue; // if it lacked an if-false, it would already be a br_if, as that's the easy case + auto* ifTrueBreak = iff->ifTrue->dynCast(); + if (ifTrueBreak && !ifTrueBreak->condition) { + // we are an if-else where the ifTrue is a break without a condition, so we can do this + list[i] = ifTrueBreak; + ifTrueBreak->condition = iff->condition; + ExpressionManipulator::spliceIntoBlock(curr, i + 1, iff->ifFalse); + continue; + } + // otherwise, perhaps we can flip the if + auto* ifFalseBreak = iff->ifFalse->dynCast(); + if (ifFalseBreak && !ifFalseBreak->condition) { + list[i] = ifFalseBreak; + ifFalseBreak->condition = Builder(*getModule()).makeUnary(EqZInt32, iff->condition); + ExpressionManipulator::spliceIntoBlock(curr, i + 1, iff->ifTrue); + continue; + } + } + } void visitIf(If* curr) { + // we may have simplified ifs enough to turn them into selects if (curr->ifFalse && isConcreteWasmType(curr->ifTrue->type) && isConcreteWasmType(curr->ifFalse->type)) { // if with else, consider turning it into a select if there is no control flow // TODO: estimate cost @@ -317,9 +347,9 @@ struct RemoveUnusedBrs : public WalkerPass>> { diff --git a/test/emcc_O2_hello_world.fromasm b/test/emcc_O2_hello_world.fromasm index b90dd4b5a..4966ce28a 100644 --- a/test/emcc_O2_hello_world.fromasm +++ b/test/emcc_O2_hello_world.fromasm @@ -3222,20 +3222,17 @@ (br $while-out$37) ) ) - (if + (br_if $while-in$38 (tee_local $14 (i32.load offset=8 (get_local $14) ) ) - (br $while-in$38) - (block - (set_local $6 - (i32.const 173) - ) - (br $label$break$L259) - ) ) + (set_local $6 + (i32.const 173) + ) + (br $label$break$L259) ) ) (if @@ -3861,16 +3858,15 @@ (br $while-out$48) ) ) - (if + (br_if $while-in$49 (tee_local $1 (i32.load offset=8 (get_local $1) ) ) - (br $while-in$49) - (set_local $28 - (i32.const 624) - ) + ) + (set_local $28 + (i32.const 624) ) ) ) @@ -8569,7 +8565,7 @@ (br $label$break$L1) ) ) - (if + (br_if $while-in$2 (i32.and (tee_local $4 (tee_local $0 @@ -8581,14 +8577,13 @@ ) (i32.const 3) ) - (br $while-in$2) - (block - (set_local $1 - (get_local $0) - ) - (set_local $2 - (i32.const 4) - ) + ) + (block + (set_local $1 + (get_local $0) + ) + (set_local $2 + (i32.const 4) ) ) ) diff --git a/test/emcc_O2_hello_world.fromasm.imprecise b/test/emcc_O2_hello_world.fromasm.imprecise index 78f5a5548..e0f340478 100644 --- a/test/emcc_O2_hello_world.fromasm.imprecise +++ b/test/emcc_O2_hello_world.fromasm.imprecise @@ -3220,20 +3220,17 @@ (br $while-out$37) ) ) - (if + (br_if $while-in$38 (tee_local $14 (i32.load offset=8 (get_local $14) ) ) - (br $while-in$38) - (block - (set_local $6 - (i32.const 173) - ) - (br $label$break$L259) - ) ) + (set_local $6 + (i32.const 173) + ) + (br $label$break$L259) ) ) (if @@ -3859,16 +3856,15 @@ (br $while-out$48) ) ) - (if + (br_if $while-in$49 (tee_local $1 (i32.load offset=8 (get_local $1) ) ) - (br $while-in$49) - (set_local $28 - (i32.const 624) - ) + ) + (set_local $28 + (i32.const 624) ) ) ) @@ -8567,7 +8563,7 @@ (br $label$break$L1) ) ) - (if + (br_if $while-in$2 (i32.and (tee_local $4 (tee_local $0 @@ -8579,14 +8575,13 @@ ) (i32.const 3) ) - (br $while-in$2) - (block - (set_local $1 - (get_local $0) - ) - (set_local $2 - (i32.const 4) - ) + ) + (block + (set_local $1 + (get_local $0) + ) + (set_local $2 + (i32.const 4) ) ) ) diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm index 06b48ffd6..575a33d1c 100644 --- a/test/emcc_hello_world.fromasm +++ b/test/emcc_hello_world.fromasm @@ -402,28 +402,29 @@ (br $while-out$0) ) ) - (if - (i32.eq - (tee_local $2 - (i32.add - (get_local $2) - (i32.const 1) + (br_if $while-in$1 + (i32.eqz + (i32.eq + (tee_local $2 + (i32.add + (get_local $2) + (i32.const 1) + ) ) + (i32.const 87) ) + ) + ) + (block + (set_local $3 (i32.const 87) ) - (block - (set_local $3 - (i32.const 87) - ) - (set_local $1 - (i32.const 775) - ) - (set_local $0 - (i32.const 5) - ) + (set_local $1 + (i32.const 775) + ) + (set_local $0 + (i32.const 5) ) - (br $while-in$1) ) ) ) @@ -2134,7 +2135,7 @@ (br $label$break$L1) ) ) - (if + (br_if $while-in$2 (i32.and (tee_local $3 (i32.ne @@ -2160,20 +2161,19 @@ (i32.const 0) ) ) - (br $while-in$2) - (block - (set_local $13 - (get_local $2) - ) - (set_local $10 - (get_local $0) - ) - (set_local $14 - (get_local $3) - ) - (set_local $3 - (i32.const 5) - ) + ) + (block + (set_local $13 + (get_local $2) + ) + (set_local $10 + (get_local $0) + ) + (set_local $14 + (get_local $3) + ) + (set_local $3 + (i32.const 5) ) ) ) @@ -2298,7 +2298,7 @@ (i32.const 4) ) ) - (if + (br_if $while-in$6 (i32.gt_u (tee_local $5 (i32.add @@ -2308,19 +2308,18 @@ ) (i32.const 3) ) - (br $while-in$6) - (block - (set_local $11 - (get_local $5) - ) - (set_local $12 - (get_local $4) - ) - (set_local $3 - (i32.const 11) - ) - (br $label$break$L11) + ) + (block + (set_local $11 + (get_local $5) + ) + (set_local $12 + (get_local $4) + ) + (set_local $3 + (i32.const 11) ) + (br $label$break$L11) ) ) ) @@ -3545,7 +3544,7 @@ (get_local $5) ) ) - (if + (br_if $while-in$18 (i32.lt_u (tee_local $5 (i32.add @@ -3562,10 +3561,9 @@ ) (i32.const 10) ) - (br $while-in$18) - (br $label$break$L46 - (get_local $10) - ) + ) + (br $label$break$L46 + (get_local $10) ) ) ) @@ -5294,15 +5292,14 @@ ) ) ) - (if + (br_if $while-in$69 (i32.gt_s (get_local $8) (i32.const 0) ) - (br $while-in$69) - (set_local $6 - (get_local $5) - ) + ) + (set_local $6 + (get_local $5) ) ) ) @@ -5552,7 +5549,7 @@ (i32.const 9) ) ) - (if + (br_if $do-once$82 (i32.lt_u (tee_local $8 (i32.load @@ -5561,10 +5558,9 @@ ) (i32.const 10) ) - (br $do-once$82) - (set_local $7 - (i32.const 10) - ) + ) + (set_local $7 + (i32.const 10) ) (loop $while-in$85 (set_local $6 @@ -5954,25 +5950,26 @@ (i32.const 1) ) ) - (if - (i32.lt_u - (get_local $13) - (tee_local $8 - (i32.mul - (get_local $8) - (i32.const 10) + (br_if $while-in$95 + (i32.eqz + (i32.lt_u + (get_local $13) + (tee_local $8 + (i32.mul + (get_local $8) + (i32.const 10) + ) ) ) ) - (block - (set_local $8 - (get_local $5) - ) - (set_local $5 - (get_local $6) - ) + ) + (block + (set_local $8 + (get_local $5) + ) + (set_local $5 + (get_local $6) ) - (br $while-in$95) ) ) ) @@ -7543,19 +7540,18 @@ ) ) ) - (if + (br_if $while-in$134 (i32.lt_u (get_local $7) (get_local $9) ) - (br $while-in$134) - (block - (set_local $35 - (get_local $9) - ) - (set_local $12 - (i32.const 98) - ) + ) + (block + (set_local $35 + (get_local $9) + ) + (set_local $12 + (i32.const 98) ) ) ) @@ -7863,7 +7859,7 @@ (get_local $1) (get_local $2) ) - (if + (br_if $while-in$137 (i32.lt_s (tee_local $0 (i32.add @@ -7873,13 +7869,12 @@ ) (i32.const 10) ) - (br $while-in$137) - (block - (set_local $22 - (i32.const 1) - ) - (br $label$break$L343) + ) + (block + (set_local $22 + (i32.const 1) ) + (br $label$break$L343) ) ) ) @@ -10487,20 +10482,19 @@ (br $while-in$20) ) ) - (if + (br_if $while-in$20 (tee_local $5 (i32.load offset=20 (get_local $5) ) ) - (br $while-in$20) - (block - (set_local $13 - (get_local $7) - ) - (set_local $12 - (get_local $1) - ) + ) + (block + (set_local $13 + (get_local $7) + ) + (set_local $12 + (get_local $1) ) ) ) @@ -11746,19 +11740,18 @@ ) ) ) - (if + (br_if $while-in$38 (tee_local $1 (i32.load offset=8 (get_local $1) ) ) - (br $while-in$38) - (block - (set_local $9 - (i32.const 173) - ) - (br $label$break$L259) + ) + (block + (set_local $9 + (i32.const 173) ) + (br $label$break$L259) ) ) ) @@ -12372,16 +12365,15 @@ (br $while-out$50) ) ) - (if + (br_if $while-in$51 (tee_local $1 (i32.load offset=8 (get_local $1) ) ) - (br $while-in$51) - (set_local $20 - (i32.const 624) - ) + ) + (set_local $20 + (i32.const 624) ) ) ) diff --git a/test/emcc_hello_world.fromasm.imprecise b/test/emcc_hello_world.fromasm.imprecise index e83f2b757..249892261 100644 --- a/test/emcc_hello_world.fromasm.imprecise +++ b/test/emcc_hello_world.fromasm.imprecise @@ -395,28 +395,29 @@ (br $while-out$0) ) ) - (if - (i32.eq - (tee_local $2 - (i32.add - (get_local $2) - (i32.const 1) + (br_if $while-in$1 + (i32.eqz + (i32.eq + (tee_local $2 + (i32.add + (get_local $2) + (i32.const 1) + ) ) + (i32.const 87) ) + ) + ) + (block + (set_local $3 (i32.const 87) ) - (block - (set_local $3 - (i32.const 87) - ) - (set_local $1 - (i32.const 775) - ) - (set_local $0 - (i32.const 5) - ) + (set_local $1 + (i32.const 775) + ) + (set_local $0 + (i32.const 5) ) - (br $while-in$1) ) ) ) @@ -2127,7 +2128,7 @@ (br $label$break$L1) ) ) - (if + (br_if $while-in$2 (i32.and (tee_local $3 (i32.ne @@ -2153,20 +2154,19 @@ (i32.const 0) ) ) - (br $while-in$2) - (block - (set_local $13 - (get_local $2) - ) - (set_local $10 - (get_local $0) - ) - (set_local $14 - (get_local $3) - ) - (set_local $3 - (i32.const 5) - ) + ) + (block + (set_local $13 + (get_local $2) + ) + (set_local $10 + (get_local $0) + ) + (set_local $14 + (get_local $3) + ) + (set_local $3 + (i32.const 5) ) ) ) @@ -2291,7 +2291,7 @@ (i32.const 4) ) ) - (if + (br_if $while-in$6 (i32.gt_u (tee_local $5 (i32.add @@ -2301,19 +2301,18 @@ ) (i32.const 3) ) - (br $while-in$6) - (block - (set_local $11 - (get_local $5) - ) - (set_local $12 - (get_local $4) - ) - (set_local $3 - (i32.const 11) - ) - (br $label$break$L11) + ) + (block + (set_local $11 + (get_local $5) + ) + (set_local $12 + (get_local $4) + ) + (set_local $3 + (i32.const 11) ) + (br $label$break$L11) ) ) ) @@ -3538,7 +3537,7 @@ (get_local $5) ) ) - (if + (br_if $while-in$18 (i32.lt_u (tee_local $5 (i32.add @@ -3555,10 +3554,9 @@ ) (i32.const 10) ) - (br $while-in$18) - (br $label$break$L46 - (get_local $10) - ) + ) + (br $label$break$L46 + (get_local $10) ) ) ) @@ -5287,15 +5285,14 @@ ) ) ) - (if + (br_if $while-in$69 (i32.gt_s (get_local $8) (i32.const 0) ) - (br $while-in$69) - (set_local $6 - (get_local $5) - ) + ) + (set_local $6 + (get_local $5) ) ) ) @@ -5545,7 +5542,7 @@ (i32.const 9) ) ) - (if + (br_if $do-once$82 (i32.lt_u (tee_local $8 (i32.load @@ -5554,10 +5551,9 @@ ) (i32.const 10) ) - (br $do-once$82) - (set_local $7 - (i32.const 10) - ) + ) + (set_local $7 + (i32.const 10) ) (loop $while-in$85 (set_local $6 @@ -5947,25 +5943,26 @@ (i32.const 1) ) ) - (if - (i32.lt_u - (get_local $13) - (tee_local $8 - (i32.mul - (get_local $8) - (i32.const 10) + (br_if $while-in$95 + (i32.eqz + (i32.lt_u + (get_local $13) + (tee_local $8 + (i32.mul + (get_local $8) + (i32.const 10) + ) ) ) ) - (block - (set_local $8 - (get_local $5) - ) - (set_local $5 - (get_local $6) - ) + ) + (block + (set_local $8 + (get_local $5) + ) + (set_local $5 + (get_local $6) ) - (br $while-in$95) ) ) ) @@ -7536,19 +7533,18 @@ ) ) ) - (if + (br_if $while-in$134 (i32.lt_u (get_local $7) (get_local $9) ) - (br $while-in$134) - (block - (set_local $35 - (get_local $9) - ) - (set_local $12 - (i32.const 98) - ) + ) + (block + (set_local $35 + (get_local $9) + ) + (set_local $12 + (i32.const 98) ) ) ) @@ -7856,7 +7852,7 @@ (get_local $1) (get_local $2) ) - (if + (br_if $while-in$137 (i32.lt_s (tee_local $0 (i32.add @@ -7866,13 +7862,12 @@ ) (i32.const 10) ) - (br $while-in$137) - (block - (set_local $22 - (i32.const 1) - ) - (br $label$break$L343) + ) + (block + (set_local $22 + (i32.const 1) ) + (br $label$break$L343) ) ) ) @@ -10480,20 +10475,19 @@ (br $while-in$20) ) ) - (if + (br_if $while-in$20 (tee_local $5 (i32.load offset=20 (get_local $5) ) ) - (br $while-in$20) - (block - (set_local $13 - (get_local $7) - ) - (set_local $12 - (get_local $1) - ) + ) + (block + (set_local $13 + (get_local $7) + ) + (set_local $12 + (get_local $1) ) ) ) @@ -11739,19 +11733,18 @@ ) ) ) - (if + (br_if $while-in$38 (tee_local $1 (i32.load offset=8 (get_local $1) ) ) - (br $while-in$38) - (block - (set_local $9 - (i32.const 173) - ) - (br $label$break$L259) + ) + (block + (set_local $9 + (i32.const 173) ) + (br $label$break$L259) ) ) ) @@ -12365,16 +12358,15 @@ (br $while-out$50) ) ) - (if + (br_if $while-in$51 (tee_local $1 (i32.load offset=8 (get_local $1) ) ) - (br $while-in$51) - (set_local $20 - (i32.const 624) - ) + ) + (set_local $20 + (i32.const 624) ) ) ) diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 574be4965..9f1021b30 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -1104,11 +1104,10 @@ optimized: (call_import $check (i32.const 1) ) - (if + (br_if $shape$0$continue (i32.const 10) - (br $shape$0$continue) - (br $block$3$break) ) + (br $block$3$break) ) ) (call_import $check @@ -1131,11 +1130,10 @@ optimized: (call_import $check (i32.const 2) ) - (if + (br_if $block$4$break (i32.const -6) - (br $block$4$break) - (br $shape$1$continue) ) + (br $shape$1$continue) ) ) (call_import $check @@ -3161,11 +3159,10 @@ optimized: (call_import $check (i32.const 1) ) - (if + (br_if $shape$0$continue (i32.const 10) - (br $shape$0$continue) - (br $block$3$break) ) + (br $block$3$break) ) ) (call_import $check @@ -3188,11 +3185,10 @@ optimized: (call_import $check (i32.const 2) ) - (if + (br_if $block$4$break (i32.const -6) - (br $block$4$break) - (br $shape$1$continue) ) + (br $shape$1$continue) ) ) (call_import $check diff --git a/test/example/c-api-kitchen-sink.txt.txt b/test/example/c-api-kitchen-sink.txt.txt index 991c8738c..022bcc2e3 100644 --- a/test/example/c-api-kitchen-sink.txt.txt +++ b/test/example/c-api-kitchen-sink.txt.txt @@ -1097,11 +1097,10 @@ (call_import $check (i32.const 1) ) - (if + (br_if $shape$0$continue (i32.const 10) - (br $shape$0$continue) - (br $block$3$break) ) + (br $block$3$break) ) ) (call_import $check @@ -1124,11 +1123,10 @@ (call_import $check (i32.const 2) ) - (if + (br_if $block$4$break (i32.const -6) - (br $block$4$break) - (br $shape$1$continue) ) + (br $shape$1$continue) ) ) (call_import $check diff --git a/test/example/relooper-fuzz.txt b/test/example/relooper-fuzz.txt index b46932009..5db33f21e 100644 --- a/test/example/relooper-fuzz.txt +++ b/test/example/relooper-fuzz.txt @@ -478,47 +478,47 @@ (call_import $print (i32.const 5) ) - (if - (i32.rem_u - (call $check) - (i32.const 2) - ) - (block - (set_local $0 - (i32.const 6) + (br_if $shape$3$continue + (i32.eqz + (i32.rem_u + (call $check) + (i32.const 2) ) - (br $shape$3$continue) ) - (br $shape$3$continue) ) + (set_local $0 + (i32.const 6) + ) + (br $shape$3$continue) ) ) (call_import $print (i32.const 4) ) - (if - (i32.rem_u - (tee_local $1 - (call $check) + (br_if $shape$3$continue + (i32.eqz + (i32.rem_u + (tee_local $1 + (call $check) + ) + (i32.const 3) ) - (i32.const 3) ) - (if - (i32.eq - (i32.rem_u - (get_local $1) - (i32.const 3) - ) - (i32.const 1) + ) + (if + (i32.eq + (i32.rem_u + (get_local $1) + (i32.const 3) ) - (block - (set_local $0 - (i32.const 6) - ) - (br $shape$3$continue) + (i32.const 1) + ) + (block + (set_local $0 + (i32.const 6) ) + (br $shape$3$continue) ) - (br $shape$3$continue) ) (call_import $print (i32.const 2) diff --git a/test/memorygrowth.fromasm b/test/memorygrowth.fromasm index 972379b5c..70ef836b0 100644 --- a/test/memorygrowth.fromasm +++ b/test/memorygrowth.fromasm @@ -3253,20 +3253,17 @@ ) ) ) - (if + (br_if $while-in$36 (tee_local $7 (i32.load offset=8 (get_local $7) ) ) - (br $while-in$36) - (block - (set_local $9 - (i32.const 171) - ) - (br $label$break$c) - ) ) + (set_local $9 + (i32.const 171) + ) + (br $label$break$c) ) ) (if @@ -3892,16 +3889,15 @@ (br $while-out$48) ) ) - (if + (br_if $while-in$49 (tee_local $1 (i32.load offset=8 (get_local $1) ) ) - (br $while-in$49) - (set_local $30 - (i32.const 1656) - ) + ) + (set_local $30 + (i32.const 1656) ) ) ) @@ -8478,7 +8474,7 @@ (br $label$break$a) ) ) - (if + (br_if $while-in$2 (i32.and (tee_local $4 (tee_local $0 @@ -8490,14 +8486,13 @@ ) (i32.const 3) ) - (br $while-in$2) - (block - (set_local $1 - (get_local $0) - ) - (set_local $2 - (i32.const 4) - ) + ) + (block + (set_local $1 + (get_local $0) + ) + (set_local $2 + (i32.const 4) ) ) ) diff --git a/test/memorygrowth.fromasm.imprecise b/test/memorygrowth.fromasm.imprecise index aa03ca8e4..4e4891a8d 100644 --- a/test/memorygrowth.fromasm.imprecise +++ b/test/memorygrowth.fromasm.imprecise @@ -3251,20 +3251,17 @@ ) ) ) - (if + (br_if $while-in$36 (tee_local $7 (i32.load offset=8 (get_local $7) ) ) - (br $while-in$36) - (block - (set_local $9 - (i32.const 171) - ) - (br $label$break$c) - ) ) + (set_local $9 + (i32.const 171) + ) + (br $label$break$c) ) ) (if @@ -3890,16 +3887,15 @@ (br $while-out$48) ) ) - (if + (br_if $while-in$49 (tee_local $1 (i32.load offset=8 (get_local $1) ) ) - (br $while-in$49) - (set_local $30 - (i32.const 1656) - ) + ) + (set_local $30 + (i32.const 1656) ) ) ) @@ -8476,7 +8472,7 @@ (br $label$break$a) ) ) - (if + (br_if $while-in$2 (i32.and (tee_local $4 (tee_local $0 @@ -8488,14 +8484,13 @@ ) (i32.const 3) ) - (br $while-in$2) - (block - (set_local $1 - (get_local $0) - ) - (set_local $2 - (i32.const 4) - ) + ) + (block + (set_local $1 + (get_local $0) + ) + (set_local $2 + (i32.const 4) ) ) ) diff --git a/test/passes/remove-unused-brs.txt b/test/passes/remove-unused-brs.txt index ff150f1ac..50f3b3a62 100644 --- a/test/passes/remove-unused-brs.txt +++ b/test/passes/remove-unused-brs.txt @@ -481,12 +481,13 @@ ) (loop $in (block $out - (if - (i32.const 0) - (block $block8 - (call $loops) + (br_if $in + (i32.eqz + (i32.const 0) ) - (br $in) + ) + (block $block8 + (call $loops) ) ) ) @@ -591,22 +592,20 @@ ) (loop $in (block $out - (if + (br_if $out (i32.const 0) - (br $out) - (call $loops) ) + (call $loops) (return) (br $in) ) ) (loop $in (block $out - (if + (br_if $out (i32.const 0) - (br $out) - (call $loops) ) + (call $loops) (br $out) (br $in) ) @@ -691,4 +690,40 @@ ) ) ) + (func $br_if_in_block (type $2) (result i32) + (block $outval + (block $in + (br_if $in + (i32.const 1) + ) + (br $in) + (drop + (i32.const 2) + ) + (br_if $in + (i32.eqz + (i32.const 3) + ) + ) + (unreachable) + (drop + (i32.const 4) + ) + (br_if $in + (i32.const 5) + ) + (unreachable) + (drop + (i32.const 6) + ) + ) + (if + (i32.const 6) + (br $outval + (i32.const 7) + ) + (i32.const 8) + ) + ) + ) ) diff --git a/test/passes/remove-unused-brs.wast b/test/passes/remove-unused-brs.wast index 87e144096..1a0b16477 100644 --- a/test/passes/remove-unused-brs.wast +++ b/test/passes/remove-unused-brs.wast @@ -653,4 +653,17 @@ ) ) ) + (func $br_if_in_block (result i32) + (block $outval + (block $in + (if (i32.const 1) (br $in) (br $in)) + (drop (i32.const 2)) + (if (i32.const 3) (unreachable) (br $in)) + (drop (i32.const 4)) + (if (i32.const 5) (br $in) (unreachable)) + (drop (i32.const 6)) + ) + (if (i32.const 6) (br $outval (i32.const 7)) (i32.const 8)) + ) + ) ) -- cgit v1.2.3 From 4ed9d8f6608d768fe9ef2e2916e770d605e6b0e1 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sun, 11 Sep 2016 20:51:05 -0700 Subject: remove final elements in vacuum carefully: we must preserve a return value if there is one --- src/ast_utils.h | 16 ++++++++++++---- src/passes/Vacuum.cpp | 39 +++++++++++++++++++++++++++++---------- test/passes/vacuum.txt | 26 ++++++++++++++++++++++++++ test/passes/vacuum.wast | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 116 insertions(+), 14 deletions(-) (limited to 'src/ast_utils.h') diff --git a/src/ast_utils.h b/src/ast_utils.h index e785a8daa..f883d5f66 100644 --- a/src/ast_utils.h +++ b/src/ast_utils.h @@ -28,18 +28,26 @@ namespace wasm { struct BreakSeeker : public PostWalker> { Name target; // look for this one XXX looking by name may fall prey to duplicate names Index found; + WasmType valueType; - BreakSeeker(Name target) : target(target), found(false) {} + BreakSeeker(Name target) : target(target), found(0) {} + + void noteFound(Expression* value) { + found++; + if (found == 1) valueType = unreachable; + if (!value) valueType = none; + else if (value->type != unreachable) valueType = value->type; + } void visitBreak(Break *curr) { - if (curr->name == target) found++; + if (curr->name == target) noteFound(curr->value); } void visitSwitch(Switch *curr) { for (auto name : curr->targets) { - if (name == target) found++; + if (name == target) noteFound(curr->value); } - if (curr->default_ == target) found++; + if (curr->default_ == target) noteFound(curr->value); } static bool has(Expression* tree, Name target) { diff --git a/src/passes/Vacuum.cpp b/src/passes/Vacuum.cpp index 592f5a063..0fdd12dec 100644 --- a/src/passes/Vacuum.cpp +++ b/src/passes/Vacuum.cpp @@ -157,7 +157,12 @@ struct Vacuum : public WalkerPass> Break* br = list[z - skip]->dynCast(); Switch* sw = list[z - skip]->dynCast(); if ((br && !br->condition) || sw) { + auto* last = list.back(); list.resize(z - skip + 1); + // if we removed the last one, and it was a return value, it must be returned + if (list.back() != last && isConcreteWasmType(last->type)) { + list.push_back(last); + } needResize = false; break; } @@ -222,18 +227,32 @@ struct Vacuum : public WalkerPass> auto* last = block->list.back(); if (isConcreteWasmType(last->type)) { assert(block->type == last->type); - block->list.back() = last = optimize(last, false); + last = optimize(last, false); if (!last) { - block->list.pop_back(); - // we don't need the drop anymore, let's see what we have left in the block - if (block->list.size() > 1) { - replaceCurrent(block); - } else if (block->list.size() == 1) { - replaceCurrent(block->list[0]); - } else { - ExpressionManipulator::nop(curr); + // we may be able to remove this, if there are no brs + bool canPop = true; + if (block->name.is()) { + BreakSeeker breakSeeker(block->name); + Expression* temp = block; + breakSeeker.walk(temp); + if (breakSeeker.found && breakSeeker.valueType != none) { + canPop = false; + } + } + if (canPop) { + block->list.back() = last; + block->list.pop_back(); + block->type = none; + // we don't need the drop anymore, let's see what we have left in the block + if (block->list.size() > 1) { + replaceCurrent(block); + } else if (block->list.size() == 1) { + replaceCurrent(block->list[0]); + } else { + ExpressionManipulator::nop(curr); + } + return; } - return; } } } diff --git a/test/passes/vacuum.txt b/test/passes/vacuum.txt index 2d274a6d7..04a04efc0 100644 --- a/test/passes/vacuum.txt +++ b/test/passes/vacuum.txt @@ -181,4 +181,30 @@ (func $drop-get-global (type $0) (call $drop-get-global) ) + (func $relooperJumpThreading1 (type $0) + (local $$vararg_ptr5 i32) + (local $$11 i32) + (loop $while-in$1 + (drop + (block $jumpthreading$outer$8 + (block $jumpthreading$inner$8 + (br $jumpthreading$outer$8 + (i32.const 0) + ) + ) + (i32.store + (get_local $$vararg_ptr5) + (get_local $$11) + ) + (i32.const 0) + ) + ) + ) + ) + (func $relooperJumpThreading2 (type $0) + (nop) + ) + (func $relooperJumpThreading3 (type $0) + (nop) + ) ) diff --git a/test/passes/vacuum.wast b/test/passes/vacuum.wast index 5d443380f..84f3eeb6f 100644 --- a/test/passes/vacuum.wast +++ b/test/passes/vacuum.wast @@ -363,4 +363,53 @@ ) ) ) + (func $relooperJumpThreading1 + (local $$vararg_ptr5 i32) + (local $$11 i32) + (loop $while-in$1 + (drop + (block $jumpthreading$outer$8 + (block $jumpthreading$inner$8 + (br $jumpthreading$outer$8 ;; the rest is dead in the outer block, but be careful to leave the return value! + (i32.const 0) + ) + ) + (i32.store + (get_local $$vararg_ptr5) + (get_local $$11) + ) + (i32.const 0) + ) + ) + ) + ) + (func $relooperJumpThreading2 + (loop $while-in$1 + (drop + (block $jumpthreading$outer$8 + (block $jumpthreading$inner$8 + (br $jumpthreading$outer$8 + (i32.const 0) + ) + ) + (i32.const 0) + ) + ) + ) + ) + (func $relooperJumpThreading3 + (loop $while-in$1 + (drop + (block $jumpthreading$outer$8 + (br $jumpthreading$outer$8 ;; code after this is dead, can kill it, but preserve the return value at the end! + (i32.const 0) + ) + (drop (i32.const 3)) + (drop (i32.const 2)) + (drop (i32.const 1)) + (i32.const 0) + ) + ) + ) + ) ) -- cgit v1.2.3 From da407c06333857f153f9fd1dba780dfbc64677bc Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 13 Sep 2016 17:50:17 -0700 Subject: drop if-else arms as necessary --- src/ast_utils.h | 18 +++++++++++--- test/unit.asm.js | 15 ++++++++++++ test/unit.fromasm | 15 ++++++++++-- test/unit.fromasm.imprecise | 15 ++++++++++-- test/unit.fromasm.imprecise.no-opts | 48 +++++++++++++++++++++++++++++++++++-- test/unit.fromasm.no-opts | 48 +++++++++++++++++++++++++++++++++++-- 6 files changed, 148 insertions(+), 11 deletions(-) (limited to 'src/ast_utils.h') diff --git a/src/ast_utils.h b/src/ast_utils.h index f883d5f66..4664f22ae 100644 --- a/src/ast_utils.h +++ b/src/ast_utils.h @@ -881,9 +881,21 @@ struct AutoDrop : public WalkerPassifFalse && isConcreteWasmType(curr->ifTrue->type)) { - curr->ifTrue = Builder(*getModule()).makeDrop(curr->ifTrue); + if (curr->ifFalse) { + if (!isConcreteWasmType(curr->type)) { + // if either side of an if-else not returning a value is concrete, drop it + if (isConcreteWasmType(curr->ifTrue->type)) { + curr->ifTrue = Builder(*getModule()).makeDrop(curr->ifTrue); + } + if (isConcreteWasmType(curr->ifFalse->type)) { + curr->ifFalse = Builder(*getModule()).makeDrop(curr->ifFalse); + } + } + } else { + // if without else does not return a value, so the body must be dropped if it is concrete + if (isConcreteWasmType(curr->ifTrue->type)) { + curr->ifTrue = Builder(*getModule()).makeDrop(curr->ifTrue); + } } } diff --git a/test/unit.asm.js b/test/unit.asm.js index 0decc886c..d4426bd90 100644 --- a/test/unit.asm.js +++ b/test/unit.asm.js @@ -557,6 +557,21 @@ function asm(global, env, buffer) { } } + function jumpThreadDrop() { + var label = 0, temp = 0; + temp = return_int() | 0; + while (1) { + label = 14; + break; + } + if ((label | 0) == 10) { + } else if ((label | 0) == 12) { + return_int() | 0; // drop in the middle of an if-else chain for threading + } else if ((label | 0) == 14) { + } + return temp | 0; + } + var FUNCTION_TABLE_a = [ z, big_negative, z, z ]; var FUNCTION_TABLE_b = [ w, w, importedDoubles, w ]; var FUNCTION_TABLE_c = [ z, cneg ]; diff --git a/test/unit.fromasm b/test/unit.fromasm index 773cbbd9d..6dd442a36 100644 --- a/test/unit.fromasm +++ b/test/unit.fromasm @@ -1002,9 +1002,20 @@ ) ) ) - (call $lb - (i32.const 1) + (drop + (call $lb + (i32.const 1) + ) ) ) ) + (func $jumpThreadDrop (result i32) + (local $0 i32) + (set_local $0 + (call_import $return_int) + ) + (block $jumpthreading$outer$2 + ) + (get_local $0) + ) ) diff --git a/test/unit.fromasm.imprecise b/test/unit.fromasm.imprecise index 80e34dfb9..d007a4d82 100644 --- a/test/unit.fromasm.imprecise +++ b/test/unit.fromasm.imprecise @@ -983,9 +983,20 @@ ) ) ) - (call $lb - (i32.const 1) + (drop + (call $lb + (i32.const 1) + ) ) ) ) + (func $jumpThreadDrop (result i32) + (local $0 i32) + (set_local $0 + (call_import $return_int) + ) + (block $jumpthreading$outer$2 + ) + (get_local $0) + ) ) diff --git a/test/unit.fromasm.imprecise.no-opts b/test/unit.fromasm.imprecise.no-opts index 3e532ef2a..1e8b46835 100644 --- a/test/unit.fromasm.imprecise.no-opts +++ b/test/unit.fromasm.imprecise.no-opts @@ -1572,9 +1572,53 @@ (br $while-in$1) ) ) - (call $lb - (i32.const 1) + (drop + (call $lb + (i32.const 1) + ) + ) + ) + ) + (func $jumpThreadDrop (result i32) + (local $label i32) + (local $temp i32) + (set_local $temp + (call_import $return_int) + ) + (loop $while-in$1 + (block $while-out$0 + (set_local $label + (i32.const 14) + ) + (br $while-out$0) + (br $while-in$1) + ) + ) + (if + (i32.eq + (get_local $label) + (i32.const 10) + ) + (nop) + (if + (i32.eq + (get_local $label) + (i32.const 12) + ) + (drop + (call_import $return_int) + ) + (if + (i32.eq + (get_local $label) + (i32.const 14) + ) + (nop) + ) ) ) + (return + (get_local $temp) + ) ) ) diff --git a/test/unit.fromasm.no-opts b/test/unit.fromasm.no-opts index d2c1beec7..846ef21a0 100644 --- a/test/unit.fromasm.no-opts +++ b/test/unit.fromasm.no-opts @@ -1578,9 +1578,53 @@ (br $while-in$1) ) ) - (call $lb - (i32.const 1) + (drop + (call $lb + (i32.const 1) + ) + ) + ) + ) + (func $jumpThreadDrop (result i32) + (local $label i32) + (local $temp i32) + (set_local $temp + (call_import $return_int) + ) + (loop $while-in$1 + (block $while-out$0 + (set_local $label + (i32.const 14) + ) + (br $while-out$0) + (br $while-in$1) + ) + ) + (if + (i32.eq + (get_local $label) + (i32.const 10) + ) + (nop) + (if + (i32.eq + (get_local $label) + (i32.const 12) + ) + (drop + (call_import $return_int) + ) + (if + (i32.eq + (get_local $label) + (i32.const 14) + ) + (nop) + ) ) ) + (return + (get_local $temp) + ) ) ) -- cgit v1.2.3