michael@0: Module = {}; michael@0: var Runtime = { michael@0: alignMemory: function alignMemory(size, quantum) { michael@0: return Math.ceil((size) / (quantum ? quantum : 4)) * (quantum ? quantum : 4); michael@0: }, michael@0: } michael@0: function assert(condition, text) { michael@0: throw text; michael@0: } michael@0: STACK_ROOT = STACKTOP = Runtime.alignMemory(1); michael@0: function _main() { michael@0: var __stackBase__ = STACKTOP; michael@0: var label; michael@0: label = 2; michael@0: while (1) { michael@0: switch (label) { michael@0: case 2: michael@0: var $f = __stackBase__; michael@0: var $1 = __stackBase__ + 12; michael@0: var $2 = __stackBase__ + 24; michael@0: var $3 = $f | 0; michael@0: var $4 = $f + 4 | 0; michael@0: var $5 = $f + 8 | 0; michael@0: var $_0 = $1 | 0; michael@0: var $_1 = $1 + 4 | 0; michael@0: var $_2 = $1 + 8 | 0; michael@0: var $j_012 = 0; michael@0: label = 4; michael@0: break; michael@0: case 4: michael@0: assertEq($_2, 24); michael@0: if (($j_012 | 0) != 110) { michael@0: var $j_012 = $j_012 + 1; michael@0: break; michael@0: } michael@0: var $23 = $i_014 + 1 | 0; michael@0: if (($23 | 0) != 110) { michael@0: var $i_014 = $23; michael@0: var $j_012 = 0; michael@0: label = 4; michael@0: break; michael@0: } michael@0: default: michael@0: assert(0, "bad label: " + label); michael@0: } michael@0: } michael@0: } michael@0: try { michael@0: _main(0, [], 0); michael@0: assertEq(0, 1); michael@0: } catch(e) { michael@0: assertEq(e, "bad label: 4"); michael@0: }