diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-09-08 17:20:23 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-09-09 11:16:54 -0700 |
commit | 1775473f735f40412899676469f3d7e8fbba93dc (patch) | |
tree | 68df0944925eeecd08ec4d78a677c9bb8faf3272 | |
parent | 2065ecbe1ad951dc7263f76040b085019423ada9 (diff) | |
download | binaryen-1775473f735f40412899676469f3d7e8fbba93dc.tar.gz binaryen-1775473f735f40412899676469f3d7e8fbba93dc.tar.bz2 binaryen-1775473f735f40412899676469f3d7e8fbba93dc.zip |
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
-rw-r--r-- | src/ast_utils.h | 27 | ||||
-rw-r--r-- | src/passes/RemoveUnusedBrs.cpp | 109 | ||||
-rw-r--r-- | src/wasm-builder.h | 48 | ||||
-rw-r--r-- | test/emcc_O2_hello_world.fromasm | 1352 | ||||
-rw-r--r-- | test/emcc_O2_hello_world.fromasm.imprecise | 1352 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm | 3775 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm.imprecise | 3775 | ||||
-rw-r--r-- | test/memorygrowth.fromasm | 1317 | ||||
-rw-r--r-- | test/memorygrowth.fromasm.imprecise | 1317 | ||||
-rw-r--r-- | test/passes/remove-unused-brs.txt | 272 | ||||
-rw-r--r-- | test/passes/remove-unused-brs.wast | 201 | ||||
-rw-r--r-- | test/unit.fromasm | 24 | ||||
-rw-r--r-- | test/unit.fromasm.imprecise | 24 |
13 files changed, 6875 insertions, 6718 deletions
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<BreakSeeker, Visitor<BreakSeeker>> { 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, Visitor<BreakSeeker>> { 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<Break>()) { + if (isSimple(br)) return br; + return nullptr; + } + if (auto* block = curr->dynCast<Block>()) { + if (block->list.size() > 0) return getEndingSimpleBreak(block->list.back()); + } + return nullptr; + } + template<typename T> static bool flexibleEqual(Expression* left, Expression* right, T& comparer) { std::vector<Name> 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 <wasm.h> #include <pass.h> #include <ast_utils.h> +#include <wasm-builder.h> namespace wasm { @@ -44,6 +45,9 @@ struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs, Visitor<R // a stack for if-else contents, we merge their outputs std::vector<Flows> ifStack; + // list of all loops, so we can optimize them + std::vector<Loop*> loops; + static void visitAny(RemoveUnusedBrs* self, Expression** currp) { auto* curr = *currp; auto& flows = self->flows; @@ -109,7 +113,7 @@ struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs, Visitor<R // ignore (could be result of a previous cycle) self->valueCanFlow = 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 WalkerPass<PostWalker<RemoveUnusedBrs, Visitor<R self->ifStack.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 WalkerPass<PostWalker<RemoveUnusedBrs, Visitor<R anotherCycle = true; } } + // TODO: if-else can be turned into a br_if as well, if one of the sides is a dead end } // override scan to add a pre and a post check task to all nodes @@ -163,6 +172,99 @@ struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs, Visitor<R } } + // optimizes a loop. returns true if we made changes + bool optimizeLoop(Loop* loop) { + // if a loop ends in + // (loop $in + // (block $out + // if (..) br $in; else br $out; + // ) + // ) + // then our normal opts can remove the break out since it flows directly out + // (and later passes make the if one-armed). however, the simple analysis + // fails on patterns like + // if (..) br $out; + // br $in; + // which is a common way to do a while (1) loop (end it with a jump to the + // top), so we handle that here. Specifically we want to conditionalize + // breaks to the loop top, i.e., put them behind a condition, so that other + // code can flow directly out and thus brs out can be removed. (even if + // the change is to let a break somewhere else flow out, that can still be + // helpful, as it shortens the logical loop. it is also good to generate + // an if-else instead of an if, as it might allow an eqz to be removed + // by flipping arms) + if (!loop->name.is()) return false; + auto* block = loop->body->dynCast<Block>(); + 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<Break>(); + 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<If>()) { + // 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<Break>()) { + // 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 WalkerPass<PostWalker<RemoveUnusedBrs, Visitor<R } } flows.clear(); + // optimize loops (we don't do it while tracking flows, as they can interfere) + for (auto* loop : loops) { + anotherCycle |= optimizeLoop(loop); + } + loops.clear(); if (anotherCycle) worked = true; } while (anotherCycle); // finally, we may have simplified ifs enough to turn them into selects diff --git a/src/wasm-builder.h b/src/wasm-builder.h index 2841585e6..f9b2e73f6 100644 --- a/src/wasm-builder.h +++ b/src/wasm-builder.h @@ -283,6 +283,28 @@ public: return block; } + // ensures the first node is a block, if it isn't already, and merges in the second, + // either as a single element or, if a block, by appending to the first block + Block* blockifyMerge(Expression* any, Expression* append) { + Block* block = nullptr; + if (any) block = any->dynCast<Block>(); + if (!block) { + block = makeBlock(any); + } else { + assert(!isConcreteWasmType(block->type)); + } + auto* other = append->dynCast<Block>(); + 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<Block>(); + 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<Nop>(); + } + } + 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) + ) + (set_local $5 + (select + (get_local $4) + (get_local $27) + (get_local $1) + ) + ) + (set_local $4 + (select + (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) + ) + (set_local $25 (get_local $1) ) + (set_local $29 + (get_local $4) + ) + (br $while-in$20) ) - (set_local $4 - (select + ) + (if + (tee_local $25 + (i32.load offset=20 (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 $29 + (get_local $4) ) + (br $while-in$20) ) - (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 $6 + (get_local $5) ) - (block - (set_local $6 - (get_local $5) - ) - (set_local $12 - (get_local $4) - ) - (br $while-out$19) + (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) ) - (br $while-out$55) + (set_local $11 + (get_local $2) + ) + (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) - ) - (br $while-in$13) + ) + (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) - ) + ) + (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 $6 - (get_local $1) - ) + ) + (block + (set_local $0 + (get_local $11) + ) + (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) + ) + (set_local $5 + (select + (get_local $4) + (get_local $27) + (get_local $1) + ) + ) + (set_local $4 + (select + (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) + ) + (set_local $25 (get_local $1) ) + (set_local $29 + (get_local $4) + ) + (br $while-in$20) ) - (set_local $4 - (select + ) + (if + (tee_local $25 + (i32.load offset=20 (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 $29 + (get_local $4) ) + (br $while-in$20) ) - (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 $6 + (get_local $5) ) - (block - (set_local $6 - (get_local $5) - ) - (set_local $12 - (get_local $4) - ) - (br $while-out$19) + (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) ) - (br $while-out$55) + (set_local $11 + (get_local $2) + ) + (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) - ) - (br $while-in$13) + ) + (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) - ) + ) + (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 $6 - (get_local $1) - ) + ) + (block + (set_local $0 + (get_local $11) + ) + (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 - (i32.store - (get_local $7) - (tee_local $3 - (i32.load - (get_local $13) - ) - ) - ) - (i32.store - (get_local $11) + (block + (set_local $17 + (i32.sub (get_local $3) + (get_local $5) ) - (set_local $5 - (i32.sub + ) + (set_local $1 + (if + (i32.gt_u (get_local $5) - (get_local $1) - ) - ) - (set_local $3 - (i32.add - (get_local $4) - (i32.const 8) + (tee_local $1 + (i32.load offset=4 + (get_local $4) + ) + ) ) - ) - (set_local $6 - (i32.add - (get_local $6) - (i32.const -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) + ) ) - ) - (i32.load offset=12 - (get_local $4) - ) - ) - (if - (i32.eq - (get_local $6) - (i32.const 2) - ) - (block - (i32.store - (get_local $7) - (i32.add - (i32.load + (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) + ) ) - (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 $3 - (get_local $4) - ) - (set_local $6 - (i32.const 2) - ) - (get_local $1) ) - (block - (set_local $3 - (get_local $4) + ) + (i32.store + (get_local $3) + (i32.add + (i32.load + (get_local $3) ) + (get_local $5) + ) + ) + (i32.store offset=4 + (get_local $3) + (i32.sub (get_local $1) + (get_local $5) ) ) - ) - ) - (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) + (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 $43) + ) + (block + (i32.store8 (get_local $52) + (i32.const 48) ) - (get_local $1) + (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) - ) - ) - ) - (br_if $do-once$122 - (i32.and - (get_local $10) - (i32.lt_s - (get_local $12) - (i32.const 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) ) - (block - (set_local $36 - (get_local $7) - ) - (set_local $11 - (i32.const 98) - ) - (br $label$break$L308) + (set_local $11 + (i32.const 98) ) + (br $label$break$L308) ) - (if - (i32.eqz - (i32.and - (i32.load - (get_local $0) - ) - (i32.const 32) - ) - ) - (drop - (call $___fwritex - (get_local $62) - (get_local $5) + ) + (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) + ) + (set_local $4 + (get_local $1) ) - (br $while-out$0) + (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) ) - (br $while-out$10) + (set_local $7 + (get_local $5) + ) + (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 $17 + (select + (get_local $3) + (get_local $25) + (get_local $0) ) - (set_local $3 - (select + ) + (set_local $3 + (select + (get_local $24) + (get_local $28) + (get_local $0) + ) + ) + (if + (tee_local $0 + (i32.load offset=16 (get_local $24) - (get_local $28) - (get_local $0) ) ) - (if - (tee_local $0 - (i32.load offset=16 - (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) - ) - (br $while-in$20) + (set_local $24 + (get_local $0) + ) + (set_local $28 + (get_local $3) ) + (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) - ) - (set_local $24 - (get_local $0) - ) - (set_local $28 - (get_local $3) - ) + ) + (block + (set_local $25 + (get_local $17) ) - (block - (set_local $13 - (get_local $3) - ) - (br $while-out$19) + (set_local $24 + (get_local $0) + ) + (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) ) - (br $while-out$61) + (set_local $9 + (get_local $20) + ) + (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) + ) + (set_local $8 + (get_local $6) ) - (br $while-out$12) + (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 - (i32.store - (get_local $7) - (tee_local $3 - (i32.load - (get_local $13) - ) - ) - ) - (i32.store - (get_local $11) + (block + (set_local $17 + (i32.sub (get_local $3) + (get_local $5) ) - (set_local $5 - (i32.sub + ) + (set_local $1 + (if + (i32.gt_u (get_local $5) - (get_local $1) - ) - ) - (set_local $3 - (i32.add - (get_local $4) - (i32.const 8) + (tee_local $1 + (i32.load offset=4 + (get_local $4) + ) + ) ) - ) - (set_local $6 - (i32.add - (get_local $6) - (i32.const -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) + ) ) - ) - (i32.load offset=12 - (get_local $4) - ) - ) - (if - (i32.eq - (get_local $6) - (i32.const 2) - ) - (block - (i32.store - (get_local $7) - (i32.add - (i32.load + (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) + ) ) - (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 $3 - (get_local $4) - ) - (set_local $6 - (i32.const 2) - ) - (get_local $1) ) - (block - (set_local $3 - (get_local $4) + ) + (i32.store + (get_local $3) + (i32.add + (i32.load + (get_local $3) ) + (get_local $5) + ) + ) + (i32.store offset=4 + (get_local $3) + (i32.sub (get_local $1) + (get_local $5) ) ) - ) - ) - (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) + (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 $43) + ) + (block + (i32.store8 (get_local $52) + (i32.const 48) ) - (get_local $1) + (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) - ) - ) - ) - (br_if $do-once$122 - (i32.and - (get_local $10) - (i32.lt_s - (get_local $12) - (i32.const 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) ) - (block - (set_local $36 - (get_local $7) - ) - (set_local $11 - (i32.const 98) - ) - (br $label$break$L308) + (set_local $11 + (i32.const 98) ) + (br $label$break$L308) ) - (if - (i32.eqz - (i32.and - (i32.load - (get_local $0) - ) - (i32.const 32) - ) - ) - (drop - (call $___fwritex - (get_local $62) - (get_local $5) + ) + (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) + ) + (set_local $4 + (get_local $1) ) - (br $while-out$0) + (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) ) - (br $while-out$10) + (set_local $7 + (get_local $5) + ) + (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 $17 + (select + (get_local $3) + (get_local $25) + (get_local $0) ) - (set_local $3 - (select + ) + (set_local $3 + (select + (get_local $24) + (get_local $28) + (get_local $0) + ) + ) + (if + (tee_local $0 + (i32.load offset=16 (get_local $24) - (get_local $28) - (get_local $0) ) ) - (if - (tee_local $0 - (i32.load offset=16 - (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) - ) - (br $while-in$20) + (set_local $24 + (get_local $0) + ) + (set_local $28 + (get_local $3) ) + (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) - ) - (set_local $24 - (get_local $0) - ) - (set_local $28 - (get_local $3) - ) + ) + (block + (set_local $25 + (get_local $17) ) - (block - (set_local $13 - (get_local $3) - ) - (br $while-out$19) + (set_local $24 + (get_local $0) + ) + (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) ) - (br $while-out$61) + (set_local $9 + (get_local $20) + ) + (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) + ) + (set_local $8 + (get_local $6) ) - (br $while-out$12) + (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) ) - (br $while-out$23) + (set_local $0 + (get_local $14) + ) + (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) ) - (br $while-out$59) + (set_local $0 + (get_local $13) + ) + (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,50 +7071,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 $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) - ) + ) + (block + (set_local $0 + (get_local $11) + ) + (set_local $4 + (get_local $1) ) - (br $while-out$12) + (br $while-in$13) ) - (br $while-in$13) ) ) (if @@ -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) - ) + (if + (i32.eqz + (i32.load8_s + (get_local $0) ) - (block - (set_local $5 - (get_local $4) - ) - (br $label$break$a) + ) + (block + (set_local $5 + (get_local $4) ) + (br $label$break$a) ) - (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) + ) + ) ) ) ) @@ -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) ) - (br $while-out$23) + (set_local $0 + (get_local $14) + ) + (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) ) - (br $while-out$59) + (set_local $0 + (get_local $13) + ) + (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,50 +7069,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 $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) - ) + ) + (block + (set_local $0 + (get_local $11) + ) + (set_local $4 + (get_local $1) ) - (br $while-out$12) + (br $while-in$13) ) - (br $while-in$13) ) ) (if @@ -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) - ) + (if + (i32.eqz + (i32.load8_s + (get_local $0) ) - (block - (set_local $5 - (get_local $4) - ) - (br $label$break$a) + ) + (block + (set_local $5 + (get_local $4) ) + (br $label$break$a) ) - (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) + ) + ) ) ) ) @@ -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) ) ) ) |