-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfor.optimized.wat
122 lines (122 loc) · 1.85 KB
/
for.optimized.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
(module
(type $iiiiv (func (param i32 i32 i32 i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $for/i (mut i32) (i32.const 0))
(memory $0 1)
(data (i32.const 4) "\06\00\00\00f\00o\00r\00.\00t\00s")
(export "memory" (memory $0))
(start $start)
(func $start (; 1 ;) (type $v)
(local $0 i32)
(set_global $for/i
(i32.const 0)
)
(loop $continue|0
(if
(i32.lt_s
(get_global $for/i)
(i32.const 10)
)
(block
(set_global $for/i
(i32.add
(get_global $for/i)
(i32.const 1)
)
)
(br $continue|0)
)
)
)
(if
(i32.ne
(get_global $for/i)
(i32.const 10)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 5)
(i32.const 0)
)
(unreachable)
)
)
(loop $continue|1
(if
(i32.lt_s
(get_local $0)
(i32.const 10)
)
(block
(set_local $0
(i32.add
(get_local $0)
(i32.const 1)
)
)
(br $continue|1)
)
)
)
(loop $continue|2
(if
(i32.gt_s
(get_global $for/i)
(i32.const 0)
)
(block
(set_global $for/i
(i32.sub
(get_global $for/i)
(i32.const 1)
)
)
(br $continue|2)
)
)
)
(if
(get_global $for/i)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 12)
(i32.const 0)
)
(unreachable)
)
)
(block $break|3
(loop $continue|3
(br_if $break|3
(i32.eq
(get_global $for/i)
(i32.const 10)
)
)
(set_global $for/i
(i32.add
(get_global $for/i)
(i32.const 1)
)
)
(br $continue|3)
)
)
(loop $continue|4
(set_global $for/i
(i32.sub
(get_global $for/i)
(i32.const 1)
)
)
(br_if $continue|4
(get_global $for/i)
)
)
)
)