|
1 | 1 | (module
|
2 | 2 | (type (;0;) (func (param i32) (result)))
|
3 |
| - (type (;1;) (func (param i64) (result))) |
4 |
| - (type (;2;) (func (param f32) (result))) |
| 3 | + (type (;1;) (func (param i32 i32 i32 i32) (result i32))) |
| 4 | + (type (;2;) (func (param i64) (result))) |
5 | 5 | (type (;3;) (func (param f64) (result)))
|
6 |
| - (type (;4;) (func (param i32 i32) (result))) |
| 6 | + (type (;4;) (func (param) (result))) |
7 | 7 | (type (;5;) (func (param) (result)))
|
8 |
| - (type (;6;) (func (param i32) (result))) |
9 |
| - (type (;7;) (func (param) (result))) |
10 |
| - (type (;8;) (func (param) (result))) |
11 |
| - (type (;9;) (func (param) (result))) |
12 |
| - (import "js" "print_i32" (func (;0;) (type 0))) |
13 |
| - (import "js" "print_i64" (func (;1;) (type 1))) |
14 |
| - (import "js" "print_f32" (func (;2;) (type 2))) |
15 |
| - (import "js" "print_f64" (func (;3;) (type 3))) |
16 |
| - (import "js" "print_str" (func (;4;) (type 4))) |
17 |
| - (import "js" "flush_buf" (func (;5;) (type 5))) |
18 |
| - (import "js" "set_exit_code" (func (;6;) (type 6))) |
19 |
| - (import "js" "memory" (memory (;0;) 100 100)) |
20 |
| - (func $7 (type 7) (param) (result) |
| 8 | + (type (;6;) (func (param) (result))) |
| 9 | + (import "wasi_snapshot_preview1" "proc_exit" (func (;0;) (type 0))) |
| 10 | + (import "wasi_snapshot_preview1" "fd_write" (func (;1;) (type 1))) |
| 11 | + (func $2 (type 2) (param i64) (result) |
| 12 | + (local i64 i64 i64 i64) |
| 13 | + local.get 0 |
| 14 | + i64.const 0 |
| 15 | + i64.eq |
| 16 | + if |
| 17 | + i32.const 1 |
| 18 | + i32.const 52 |
| 19 | + i32.const 1 |
| 20 | + i32.const 0 |
| 21 | + call 1 |
| 22 | + drop |
| 23 | + return |
| 24 | + else |
| 25 | + end |
| 26 | + local.get 0 |
| 27 | + i64.const 0 |
| 28 | + i64.lt_s |
| 29 | + if |
| 30 | + i32.const 1 |
| 31 | + i32.const 28 |
| 32 | + i32.const 1 |
| 33 | + i32.const 0 |
| 34 | + call 1 |
| 35 | + drop |
| 36 | + local.get 0 |
| 37 | + i64.const -1 |
| 38 | + i64.mul |
| 39 | + local.set 0 |
| 40 | + else |
| 41 | + end |
| 42 | + local.get 0 |
| 43 | + local.set 4 |
| 44 | + i64.const 0 |
| 45 | + local.set 1 |
| 46 | + loop |
| 47 | + local.get 0 |
| 48 | + i64.const 0 |
| 49 | + i64.gt_s |
| 50 | + if |
| 51 | + local.get 1 |
| 52 | + i64.const 1 |
| 53 | + i64.add |
| 54 | + local.set 1 |
| 55 | + local.get 0 |
| 56 | + i64.const 10 |
| 57 | + i64.div_s |
| 58 | + local.set 0 |
| 59 | + br 1 |
| 60 | + else |
| 61 | + end |
| 62 | + end |
| 63 | + loop |
| 64 | + local.get 1 |
| 65 | + i64.const 0 |
| 66 | + i64.gt_s |
| 67 | + if |
| 68 | + local.get 1 |
| 69 | + i64.const 1 |
| 70 | + i64.sub |
| 71 | + local.set 1 |
| 72 | + i64.const 1 |
| 73 | + local.set 2 |
| 74 | + i64.const 0 |
| 75 | + local.set 3 |
| 76 | + loop |
| 77 | + local.get 3 |
| 78 | + local.get 1 |
| 79 | + i64.lt_s |
| 80 | + if |
| 81 | + local.get 3 |
| 82 | + i64.const 1 |
| 83 | + i64.add |
| 84 | + local.set 3 |
| 85 | + local.get 2 |
| 86 | + i64.const 10 |
| 87 | + i64.mul |
| 88 | + local.set 2 |
| 89 | + br 1 |
| 90 | + else |
| 91 | + end |
| 92 | + end |
| 93 | + local.get 4 |
| 94 | + local.get 2 |
| 95 | + i64.div_s |
| 96 | + i64.const 10 |
| 97 | + i64.rem_s |
| 98 | + i64.const 12 |
| 99 | + i64.mul |
| 100 | + i64.const 52 |
| 101 | + i64.add |
| 102 | + local.set 0 |
| 103 | + i32.const 1 |
| 104 | + local.get 0 |
| 105 | + i32.wrap_i64 |
| 106 | + i32.const 1 |
| 107 | + i32.const 0 |
| 108 | + call 1 |
| 109 | + drop |
| 110 | + br 1 |
| 111 | + else |
| 112 | + end |
| 113 | + end |
| 114 | + return |
| 115 | + ) |
| 116 | + (func $3 (type 3) (param f64) (result) |
| 117 | + (local i64 i64 i64) |
| 118 | + local.get 0 |
| 119 | + f64.const 0.000000 |
| 120 | + f64.lt |
| 121 | + if |
| 122 | + i32.const 1 |
| 123 | + i32.const 28 |
| 124 | + i32.const 1 |
| 125 | + i32.const 0 |
| 126 | + call 1 |
| 127 | + drop |
| 128 | + local.get 0 |
| 129 | + f64.const -1.000000 |
| 130 | + f64.mul |
| 131 | + local.set 0 |
| 132 | + else |
| 133 | + end |
| 134 | + local.get 0 |
| 135 | + i64.trunc_f64_s |
| 136 | + call 2 |
| 137 | + i32.const 1 |
| 138 | + i32.const 40 |
| 139 | + i32.const 1 |
| 140 | + i32.const 0 |
| 141 | + call 1 |
| 142 | + drop |
| 143 | + local.get 0 |
| 144 | + local.get 0 |
| 145 | + i64.trunc_f64_s |
| 146 | + f64.convert_i64_s |
| 147 | + f64.sub |
| 148 | + f64.const 100000000.000000 |
| 149 | + f64.mul |
| 150 | + i64.trunc_f64_s |
| 151 | + local.set 2 |
| 152 | + local.get 2 |
| 153 | + local.set 3 |
| 154 | + i64.const 0 |
| 155 | + local.set 1 |
| 156 | + loop |
| 157 | + local.get 2 |
| 158 | + i64.const 0 |
| 159 | + i64.gt_s |
| 160 | + if |
| 161 | + local.get 1 |
| 162 | + i64.const 1 |
| 163 | + i64.add |
| 164 | + local.set 1 |
| 165 | + local.get 2 |
| 166 | + f64.convert_i64_s |
| 167 | + i64.const 10 |
| 168 | + f64.convert_i64_s |
| 169 | + f64.div |
| 170 | + i64.trunc_f64_s |
| 171 | + local.set 2 |
| 172 | + br 1 |
| 173 | + else |
| 174 | + end |
| 175 | + end |
| 176 | + loop |
| 177 | + local.get 1 |
| 178 | + i64.const 8 |
| 179 | + i64.lt_s |
| 180 | + if |
| 181 | + local.get 1 |
| 182 | + i64.const 1 |
| 183 | + i64.add |
| 184 | + local.set 1 |
| 185 | + i32.const 1 |
| 186 | + i32.const 52 |
| 187 | + i32.const 1 |
| 188 | + i32.const 0 |
| 189 | + call 1 |
| 190 | + drop |
| 191 | + br 1 |
| 192 | + else |
| 193 | + end |
| 194 | + end |
| 195 | + local.get 3 |
| 196 | + call 2 |
| 197 | + return |
| 198 | + ) |
| 199 | + (func $4 (type 4) (param) (result) |
21 | 200 | (local)
|
22 |
| - call 8 |
| 201 | + call 5 |
23 | 202 | return
|
24 | 203 | )
|
25 |
| - (func $8 (type 8) (param) (result) |
| 204 | + (func $5 (type 5) (param) (result) |
26 | 205 | (local i32)
|
27 | 206 | i32.const 1
|
28 |
| - call 0 |
29 |
| - call 5 |
| 207 | + i64.extend_i32_s |
| 208 | + call 2 |
| 209 | + i32.const 1 |
| 210 | + i32.const 16 |
| 211 | + i32.const 1 |
30 | 212 | i32.const 0
|
31 |
| - call 0 |
32 |
| - call 5 |
| 213 | + call 1 |
| 214 | + drop |
| 215 | + i32.const 0 |
| 216 | + i64.extend_i32_s |
| 217 | + call 2 |
| 218 | + i32.const 1 |
| 219 | + i32.const 16 |
| 220 | + i32.const 1 |
| 221 | + i32.const 0 |
| 222 | + call 1 |
| 223 | + drop |
33 | 224 | i32.const 1
|
34 | 225 | local.set 0
|
35 | 226 | local.get 0
|
36 |
| - call 0 |
37 |
| - call 5 |
| 227 | + i64.extend_i32_s |
| 228 | + call 2 |
| 229 | + i32.const 1 |
| 230 | + i32.const 16 |
| 231 | + i32.const 1 |
| 232 | + i32.const 0 |
| 233 | + call 1 |
| 234 | + drop |
38 | 235 | i32.const 0
|
39 | 236 | local.set 0
|
40 | 237 | local.get 0
|
41 |
| - call 0 |
42 |
| - call 5 |
| 238 | + i64.extend_i32_s |
| 239 | + call 2 |
| 240 | + i32.const 1 |
| 241 | + i32.const 16 |
| 242 | + i32.const 1 |
| 243 | + i32.const 0 |
| 244 | + call 1 |
| 245 | + drop |
43 | 246 | return
|
44 | 247 | )
|
45 |
| - (func $9 (type 9) (param) (result) |
| 248 | + (func $6 (type 6) (param) (result) |
46 | 249 | (local)
|
47 |
| - call 7 |
| 250 | + call 4 |
48 | 251 | i32.const 0
|
49 |
| - call 6 |
| 252 | + call 0 |
50 | 253 | return
|
51 | 254 | )
|
52 |
| - (export "_lpython_main_program" (func $7)) |
53 |
| - (export "test_bool" (func $8)) |
54 |
| - (export "_lcompilers_main" (func $9)) |
| 255 | + (memory (;0;) 100 100) |
| 256 | + (export "memory" (memory 0)) |
| 257 | + (export "print_i64" (func 2)) |
| 258 | + (export "print_f64" (func 3)) |
| 259 | + (export "_lpython_main_program" (func 4)) |
| 260 | + (export "test_bool" (func 5)) |
| 261 | + (export "_start" (func 6)) |
| 262 | + (data (;0;) (i32.const 4) "\0c\00\00\00\01\00\00\00") |
| 263 | + (data (;1;) (i32.const 12) " ") |
| 264 | + (data (;2;) (i32.const 16) "\18\00\00\00\01\00\00\00") |
| 265 | + (data (;3;) (i32.const 24) "\0a ") |
| 266 | + (data (;4;) (i32.const 28) "\24\00\00\00\01\00\00\00") |
| 267 | + (data (;5;) (i32.const 36) "- ") |
| 268 | + (data (;6;) (i32.const 40) "\30\00\00\00\01\00\00\00") |
| 269 | + (data (;7;) (i32.const 48) ". ") |
| 270 | + (data (;8;) (i32.const 52) "\3c\00\00\00\01\00\00\00") |
| 271 | + (data (;9;) (i32.const 60) "0 ") |
| 272 | + (data (;10;) (i32.const 64) "\48\00\00\00\01\00\00\00") |
| 273 | + (data (;11;) (i32.const 72) "1 ") |
| 274 | + (data (;12;) (i32.const 76) "\54\00\00\00\01\00\00\00") |
| 275 | + (data (;13;) (i32.const 84) "2 ") |
| 276 | + (data (;14;) (i32.const 88) "\60\00\00\00\01\00\00\00") |
| 277 | + (data (;15;) (i32.const 96) "3 ") |
| 278 | + (data (;16;) (i32.const 100) "\6c\00\00\00\01\00\00\00") |
| 279 | + (data (;17;) (i32.const 108) "4 ") |
| 280 | + (data (;18;) (i32.const 112) "\78\00\00\00\01\00\00\00") |
| 281 | + (data (;19;) (i32.const 120) "5 ") |
| 282 | + (data (;20;) (i32.const 124) "\84\00\00\00\01\00\00\00") |
| 283 | + (data (;21;) (i32.const 132) "6 ") |
| 284 | + (data (;22;) (i32.const 136) "\90\00\00\00\01\00\00\00") |
| 285 | + (data (;23;) (i32.const 144) "7 ") |
| 286 | + (data (;24;) (i32.const 148) "\9c\00\00\00\01\00\00\00") |
| 287 | + (data (;25;) (i32.const 156) "8 ") |
| 288 | + (data (;26;) (i32.const 160) "\a8\00\00\00\01\00\00\00") |
| 289 | + (data (;27;) (i32.const 168) "9 ") |
55 | 290 | )
|
0 commit comments