forked from AssemblyScript/assemblyscript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloop-flow.release.wat
140 lines (140 loc) · 2.98 KB
/
loop-flow.release.wat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
(module
(type $0 (func (result i32)))
(type $1 (func (param i32) (result i32)))
(type $2 (func (param i32 i32 i32 i32)))
(type $3 (func))
(import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32)))
(memory $0 1)
(data $0 (i32.const 1036) ",")
(data $0.1 (i32.const 1048) "\02\00\00\00\18\00\00\00l\00o\00o\00p\00-\00f\00l\00o\00w\00.\00t\00s")
(data $1 (i32.const 1084) "\1c")
(data $1.1 (i32.const 1096) "\02\00\00\00\08\00\00\00t\00e\00r\00m")
(export "whileReturn" (func $loop-flow/whileReturn))
(export "whileThrow" (func $loop-flow/whileThrow))
(export "whileContinue" (func $loop-flow/whileContinue))
(export "whileAny" (func $loop-flow/whileAny))
(export "forReturn" (func $loop-flow/whileReturn))
(export "forThrow" (func $loop-flow/forThrow))
(export "forContinue" (func $loop-flow/whileContinue))
(export "forAny" (func $loop-flow/forAny))
(export "doReturn" (func $loop-flow/whileReturn))
(export "doThrow" (func $loop-flow/doThrow))
(export "doAny" (func $loop-flow/doAny))
(export "memory" (memory $0))
(start $~start)
(func $loop-flow/whileReturn (result i32)
i32.const 1
)
(func $loop-flow/whileAny (param $0 i32) (result i32)
loop $while-continue|0 (result i32)
local.get $0
i32.const 1
i32.eq
if (result i32)
i32.const 1
else
local.get $0
i32.const 2
i32.eq
if
i32.const 1104
i32.const 1056
i32.const 24
i32.const 22
call $~lib/builtins/abort
unreachable
else
br $while-continue|0
end
unreachable
end
end
)
(func $loop-flow/forAny (param $0 i32) (result i32)
loop $for-loop|0 (result i32)
local.get $0
i32.const 1
i32.eq
if (result i32)
i32.const 1
else
local.get $0
i32.const 2
i32.eq
if
i32.const 1104
i32.const 1056
i32.const 54
i32.const 22
call $~lib/builtins/abort
unreachable
end
br $for-loop|0
end
end
)
(func $loop-flow/doAny (param $0 i32) (result i32)
loop $do-loop|0 (result i32)
local.get $0
i32.const 1
i32.eq
if (result i32)
i32.const 1
else
local.get $0
i32.const 2
i32.eq
if
i32.const 1104
i32.const 1056
i32.const 78
i32.const 22
call $~lib/builtins/abort
unreachable
end
br $do-loop|0
end
end
)
(func $loop-flow/whileThrow (result i32)
i32.const 1104
i32.const 1056
i32.const 11
i32.const 5
call $~lib/builtins/abort
unreachable
)
(func $loop-flow/whileContinue (result i32)
loop $while-continue|0
br $while-continue|0
end
unreachable
)
(func $loop-flow/forThrow (result i32)
i32.const 1104
i32.const 1056
i32.const 41
i32.const 5
call $~lib/builtins/abort
unreachable
)
(func $loop-flow/doThrow (result i32)
i32.const 1104
i32.const 1056
i32.const 71
i32.const 5
call $~lib/builtins/abort
unreachable
)
(func $~start
i32.const 1
call $loop-flow/whileAny
drop
i32.const 1
call $loop-flow/forAny
drop
i32.const 1
call $loop-flow/doAny
drop
)
)