1(module
2  (type $FUNCSIG$vf (func (param f32)))
3  (type $FUNCSIG$v (func))
4  (type $FUNCSIG$id (func (param f64) (result i32)))
5  (type $FUNCSIG$ddd (func (param f64 f64) (result f64)))
6  (type $4 (func (result f64)))
7  (type $5 (func (result i32)))
8  (type $6 (func (param i32) (result i32)))
9  (type $7 (func (param f64) (result f64)))
10  (type $8 (func (result i64)))
11  (type $9 (func (param i32 i64)))
12  (import "env" "_emscripten_asm_const_vi" (func $_emscripten_asm_const_vi))
13  (import "asm2wasm" "f64-to-int" (func $f64-to-int (param f64) (result i32)))
14  (import "asm2wasm" "f64-rem" (func $f64-rem (param f64 f64) (result f64)))
15  (table 10 funcref)
16  (elem (i32.const 0) $z $big_negative $z $z $w $w $importedDoubles $w $z $cneg)
17  (memory $0 4096 4096)
18  (data (i32.const 1026) "\14\00")
19  (export "big_negative" (func $big_negative))
20  (func $big_negative (type $FUNCSIG$v)
21    (local $temp f64)
22    (block $block0
23      (local.set $temp
24        (f64.const -2147483648)
25      )
26      (local.set $temp
27        (f64.const -2147483648)
28      )
29      (local.set $temp
30        (f64.const -21474836480)
31      )
32      (local.set $temp
33        (f64.const 0.039625)
34      )
35      (local.set $temp
36        (f64.const -0.039625)
37      )
38    )
39  )
40  (func $importedDoubles (type $4) (result f64)
41    (local $temp f64)
42    (block $topmost (result f64)
43      (local.set $temp
44        (f64.add
45          (f64.add
46            (f64.add
47              (f64.load
48                (i32.const 8)
49              )
50              (f64.load
51                (i32.const 16)
52              )
53            )
54            (f64.neg
55              (f64.load
56                (i32.const 16)
57              )
58            )
59          )
60          (f64.neg
61            (f64.load
62              (i32.const 8)
63            )
64          )
65        )
66      )
67      (if
68        (i32.gt_s
69          (i32.load
70            (i32.const 24)
71          )
72          (i32.const 0)
73        )
74        (br $topmost
75          (f64.const -3.4)
76        )
77      )
78      (if
79        (f64.gt
80          (f64.load
81            (i32.const 32)
82          )
83          (f64.const 0)
84        )
85        (br $topmost
86          (f64.const 5.6)
87        )
88      )
89      (f64.const 1.2)
90    )
91  )
92  (func $doubleCompares (type $FUNCSIG$ddd) (param $x f64) (param $y f64) (result f64)
93    (local $t f64)
94    (local $Int f64)
95    (local $Double i32)
96    (block $topmost (result f64)
97      (if
98        (f64.gt
99          (local.get $x)
100          (f64.const 0)
101        )
102        (br $topmost
103          (f64.const 1.2)
104        )
105      )
106      (if
107        (f64.gt
108          (local.get $Int)
109          (f64.const 0)
110        )
111        (br $topmost
112          (f64.const -3.4)
113        )
114      )
115      (if
116        (i32.gt_s
117          (local.get $Double)
118          (i32.const 0)
119        )
120        (br $topmost
121          (f64.const 5.6)
122        )
123      )
124      (if
125        (f64.lt
126          (local.get $x)
127          (local.get $y)
128        )
129        (br $topmost
130          (local.get $x)
131        )
132      )
133      (local.get $y)
134    )
135  )
136  (func $intOps (type $5) (result i32)
137    (local $x i32)
138    (i32.eq
139      (local.get $x)
140      (i32.const 0)
141    )
142  )
143  (func $hexLiterals (type $FUNCSIG$v)
144    (drop
145      (i32.add
146        (i32.add
147          (i32.const 0)
148          (i32.const 313249263)
149        )
150        (i32.const -19088752)
151      )
152    )
153  )
154  (func $conversions (type $FUNCSIG$v)
155    (local $i i32)
156    (local $d f64)
157    (block $block0
158      (local.set $i
159        (call $f64-to-int
160          (local.get $d)
161        )
162      )
163      (local.set $d
164        (f64.convert_i32_s
165          (local.get $i)
166        )
167      )
168      (local.set $d
169        (f64.convert_i32_u
170          (i32.shr_u
171            (local.get $i)
172            (i32.const 0)
173          )
174        )
175      )
176    )
177  )
178  (func $seq (type $FUNCSIG$v)
179    (local $J f64)
180    (local.set $J
181      (f64.sub
182        (block $block0 (result f64)
183          (drop
184            (f64.const 0.1)
185          )
186          (f64.const 5.1)
187        )
188        (block $block1 (result f64)
189          (drop
190            (f64.const 3.2)
191          )
192          (f64.const 4.2)
193        )
194      )
195    )
196  )
197  (func $switcher (type $6) (param $x i32) (result i32)
198    (block $topmost (result i32)
199      (block $switch$0
200        (block $switch-default$3
201          (block $switch-case$2
202            (block $switch-case$1
203              (br_table $switch-case$1 $switch-case$2 $switch-default$3
204                (i32.sub
205                  (local.get $x)
206                  (i32.const 1)
207                )
208              )
209            )
210            (br $topmost
211              (i32.const 1)
212            )
213          )
214          (br $topmost
215            (i32.const 2)
216          )
217        )
218        (nop)
219      )
220      (block $switch$4
221        (block $switch-default$7
222          (block $switch-case$6
223            (block $switch-case$5
224              (br_table $switch-case$6 $switch-default$7 $switch-default$7 $switch-default$7 $switch-default$7 $switch-default$7 $switch-default$7 $switch-case$5 $switch-default$7
225                (i32.sub
226                  (local.get $x)
227                  (i32.const 5)
228                )
229              )
230            )
231            (br $topmost
232              (i32.const 121)
233            )
234          )
235          (br $topmost
236            (i32.const 51)
237          )
238        )
239        (nop)
240      )
241      (block $label$break$Lout
242        (block $switch-default$16
243          (block $switch-case$15
244            (block $switch-case$12
245              (block $switch-case$9
246                (block $switch-case$8
247                  (br_table $switch-case$15 $switch-default$16 $switch-default$16 $switch-case$12 $switch-default$16 $switch-default$16 $switch-default$16 $switch-default$16 $switch-case$9 $switch-default$16 $switch-case$8 $switch-default$16
248                    (i32.sub
249                      (local.get $x)
250                      (i32.const 2)
251                    )
252                  )
253                )
254                (br $label$break$Lout)
255              )
256              (br $label$break$Lout)
257            )
258            (block $while-out$10
259              (loop $while-in$11
260                (block $block1
261                  (br $while-out$10)
262                  (br $while-in$11)
263                )
264              )
265              (br $label$break$Lout)
266            )
267          )
268          (block $while-out$13
269            (loop $while-in$14
270              (block $block3
271                (br $label$break$Lout)
272                (br $while-in$14)
273              )
274            )
275            (br $label$break$Lout)
276          )
277        )
278        (nop)
279      )
280      (i32.const 0)
281    )
282  )
283  (func $blocker (type $FUNCSIG$v)
284    (block $label$break$L
285      (br $label$break$L)
286    )
287  )
288  (func $frem (type $4) (result f64)
289    (call $f64-rem
290      (f64.const 5.5)
291      (f64.const 1.2)
292    )
293  )
294  (func $big_uint_div_u (type $5) (result i32)
295    (local $x i32)
296    (block $topmost (result i32)
297      (local.set $x
298        (i32.and
299          (i32.div_u
300            (i32.const -1)
301            (i32.const 2)
302          )
303          (i32.const -1)
304        )
305      )
306      (local.get $x)
307    )
308  )
309  (func $fr (type $FUNCSIG$vf) (param $x f32)
310    (local $y f32)
311    (local $z f64)
312    (block $block0
313      (drop
314        (f32.demote_f64
315          (local.get $z)
316        )
317      )
318      (drop
319        (local.get $y)
320      )
321      (drop
322        (f32.const 5)
323      )
324      (drop
325        (f32.const 0)
326      )
327      (drop
328        (f32.const 5)
329      )
330      (drop
331        (f32.const 0)
332      )
333    )
334  )
335  (func $negZero (type $4) (result f64)
336    (f64.const -0)
337  )
338  (func $abs (type $FUNCSIG$v)
339    (local $x i32)
340    (local $y f64)
341    (local $z f32)
342    (local $asm2wasm_i32_temp i32)
343    (block $block0
344      (local.set $x
345        (block $block1 (result i32)
346          (local.set $asm2wasm_i32_temp
347            (i32.const 0)
348          )
349          (select
350            (i32.sub
351              (i32.const 0)
352              (local.get $asm2wasm_i32_temp)
353            )
354            (local.get $asm2wasm_i32_temp)
355            (i32.lt_s
356              (local.get $asm2wasm_i32_temp)
357              (i32.const 0)
358            )
359          )
360        )
361      )
362      (local.set $y
363        (f64.abs
364          (f64.const 0)
365        )
366      )
367      (local.set $z
368        (f32.abs
369          (f32.const 0)
370        )
371      )
372    )
373  )
374  (func $neg (type $FUNCSIG$v)
375    (local $x f32)
376    (block $block0
377      (local.set $x
378        (f32.neg
379          (local.get $x)
380        )
381      )
382      (call_indirect (type $FUNCSIG$vf)
383        (local.get $x)
384        (i32.add
385          (i32.and
386            (i32.const 1)
387            (i32.const 7)
388          )
389          (i32.const 8)
390        )
391      )
392    )
393  )
394  (func $cneg (type $FUNCSIG$vf) (param $x f32)
395    (call_indirect (type $FUNCSIG$vf)
396      (local.get $x)
397      (i32.add
398        (i32.and
399          (i32.const 1)
400          (i32.const 7)
401        )
402        (i32.const 8)
403      )
404    )
405  )
406  (func $___syscall_ret (type $FUNCSIG$v)
407    (local $$0 i32)
408    (drop
409      (i32.gt_u
410        (i32.shr_u
411          (local.get $$0)
412          (i32.const 0)
413        )
414        (i32.const -4096)
415      )
416    )
417  )
418  (func $z (type $FUNCSIG$v)
419    (nop)
420  )
421  (func $w (type $FUNCSIG$v)
422    (nop)
423  )
424  (func $block_and_after (type $5) (result i32)
425    (block $waka
426      (drop
427        (i32.const 1)
428      )
429      (br $waka)
430    )
431    (i32.const 0)
432  )
433  (func $loop-roundtrip (type $7) (param $0 f64) (result f64)
434    (loop $loop-in1 (result f64)
435      (drop
436        (local.get $0)
437      )
438      (local.get $0)
439    )
440  )
441  (func $big-i64 (type $8) (result i64)
442    (i64.const -9218868437227405313)
443  )
444  (func $i64-store32 (type $9) (param $0 i32) (param $1 i64)
445    (i64.store32
446      (local.get $0)
447      (local.get $1)
448    )
449  )
450  (func $return-unreachable (result i32)
451    (return (i32.const 1))
452  )
453  (func $unreachable-block (result i32)
454    (f64.abs
455      (block ;; note no type - valid in binaryen IR, in wasm must be i32
456        (drop (i32.const 1))
457        (return (i32.const 2))
458      )
459    )
460  )
461  (func $unreachable-block-toplevel (result i32)
462    (block ;; note no type - valid in binaryen IR, in wasm must be i32
463      (drop (i32.const 1))
464      (return (i32.const 2))
465    )
466  )
467  (func $unreachable-block0 (result i32)
468    (f64.abs
469      (block ;; note no type - valid in binaryen IR, in wasm must be i32
470        (return (i32.const 2))
471      )
472    )
473  )
474  (func $unreachable-block0-toplevel (result i32)
475    (block ;; note no type - valid in binaryen IR, in wasm must be i32
476      (return (i32.const 2))
477    )
478  )
479  (func $unreachable-block-with-br (result i32)
480    (block $block ;; unreachable type due to last element having that type, but the block is exitable
481      (drop (i32.const 1))
482      (br $block)
483    )
484    (i32.const 1)
485  )
486  (func $unreachable-if (result i32)
487    (f64.abs
488      (if ;; note no type - valid in binaryen IR, in wasm must be i32
489        (i32.const 3)
490        (return (i32.const 2))
491        (return (i32.const 1))
492      )
493    )
494  )
495  (func $unreachable-if-toplevel (result i32)
496    (if ;; note no type - valid in binaryen IR, in wasm must be i32
497      (i32.const 3)
498      (return (i32.const 2))
499      (return (i32.const 1))
500    )
501  )
502  (func $unreachable-loop (result i32)
503    (f64.abs
504      (loop ;; note no type - valid in binaryen IR, in wasm must be i32
505        (nop)
506        (return (i32.const 1))
507      )
508    )
509  )
510  (func $unreachable-loop0 (result i32)
511    (f64.abs
512      (loop ;; note no type - valid in binaryen IR, in wasm must be i32
513        (return (i32.const 1))
514      )
515    )
516  )
517  (func $unreachable-loop-toplevel (result i32)
518    (loop ;; note no type - valid in binaryen IR, in wasm must be i32
519      (nop)
520      (return (i32.const 1))
521    )
522  )
523  (func $unreachable-loop0-toplevel (result i32)
524    (loop ;; note no type - valid in binaryen IR, in wasm must be i32
525      (return (i32.const 1))
526    )
527  )
528  (func $unreachable-ifs
529    (if (unreachable) (nop))
530    (if (unreachable) (unreachable))
531    (if (unreachable) (nop) (nop))
532    (if (unreachable) (unreachable) (nop))
533    (if (unreachable) (nop) (unreachable))
534    (if (unreachable) (unreachable) (unreachable))
535    ;;
536    (if (i32.const 1) (unreachable) (nop))
537    (if (i32.const 1) (nop) (unreachable))
538    (if (i32.const 1) (unreachable) (unreachable))
539  )
540  (func $unreachable-if-arm
541    (if
542      (i32.const 1)
543      (block
544        (nop)
545      )
546      (block
547        (unreachable)
548        (drop
549          (i32.const 1)
550        )
551      )
552    )
553  )
554  (func $local-to-stack (param $x i32) (result i32)
555    (local $temp i32)
556    (local.set $temp (call $local-to-stack (i32.const 1))) ;; this set could just be on the stack
557    (drop (call $local-to-stack (i32.const 2)))
558    (local.get $temp)
559  )
560  (func $local-to-stack-1 (param $x i32) (result i32)
561    (local $temp i32)
562    (local.set $temp (call $local-to-stack (i32.const 1)))
563    (drop (call $local-to-stack (i32.const 2)))
564    (i32.eqz
565      (local.get $temp)
566    )
567  )
568  (func $local-to-stack-1b (param $x i32) (result i32)
569    (local $temp i32)
570    (local.set $temp (call $local-to-stack (i32.const 1)))
571    (drop (call $local-to-stack (i32.const 2)))
572    (i32.add
573      (local.get $temp)
574      (i32.const 3)
575    )
576  )
577  (func $local-to-stack-1c-no (param $x i32) (result i32)
578    (local $temp i32)
579    (local.set $temp (call $local-to-stack (i32.const 1)))
580    (drop (call $local-to-stack (i32.const 2)))
581    (i32.add
582      (i32.const 3) ;; this is in the way
583      (local.get $temp)
584    )
585  )
586  (func $local-to-stack-2-no (param $x i32) (result i32)
587    (local $temp i32)
588    (local.set $temp (call $local-to-stack (i32.const 1)))
589    (drop (call $local-to-stack (i32.const 2)))
590    (i32.add
591      (local.get $temp)
592      (local.get $temp) ;; a second use - so cannot stack it
593    )
594  )
595  (func $local-to-stack-3-no (param $x i32) (result i32)
596    (local $temp i32)
597    (if (i32.const 1)
598      (local.set $temp (call $local-to-stack (i32.const 1)))
599      (local.set $temp (call $local-to-stack (i32.const 2))) ;; two sets for that get
600    )
601    (drop (call $local-to-stack (i32.const 3)))
602    (local.get $temp)
603  )
604  (func $local-to-stack-multi-4 (param $x i32) (result i32)
605    (local $temp1 i32)
606    (local $temp2 i32)
607    (local.set $temp1 (call $local-to-stack-multi-4 (i32.const 1)))
608    (drop (call $local-to-stack-multi-4 (i32.const 2)))
609    (drop (local.get $temp1))
610    (local.set $temp1 (call $local-to-stack-multi-4 (i32.const 3))) ;; same local, used later
611    (drop (call $local-to-stack-multi-4 (i32.const 4)))
612    (local.get $temp1)
613  )
614  (func $local-to-stack-multi-5 (param $x i32) (result i32)
615    (local $temp1 i32)
616    (local $temp2 i32)
617    (local.set $temp1 (call $local-to-stack-multi-4 (i32.const 1)))
618    (drop (call $local-to-stack-multi-4 (i32.const 2)))
619    (drop (local.get $temp1))
620    (local.set $temp2 (call $local-to-stack-multi-4 (i32.const 3))) ;; different local, used later
621    (drop (call $local-to-stack-multi-4 (i32.const 4)))
622    (local.get $temp2)
623  )
624  (func $local-to-stack-multi-6-justone (param $x i32) (result i32)
625    (local $temp1 i32)
626    (local $temp2 i32)
627    (local.set $temp1 (call $local-to-stack-multi-4 (i32.const 1)))
628    (drop (call $local-to-stack-multi-4 (i32.const 2)))
629    (drop (local.get $temp1))
630    (local.set $temp2 (call $local-to-stack-multi-4 (i32.const 3))) ;; different local, used later
631    (drop (call $local-to-stack-multi-4 (i32.const 4)))
632    (i32.add
633      (local.get $temp2)
634      (local.get $temp2)
635    )
636  )
637  (func $local-to-stack-multi-7-justone (param $x i32) (result i32)
638    (local $temp1 i32)
639    (local $temp2 i32)
640    (local.set $temp1 (call $local-to-stack-multi-4 (i32.const 1)))
641    (drop (call $local-to-stack-multi-4 (i32.const 2)))
642    (drop
643      (i32.add
644        (local.get $temp1)
645        (local.get $temp1)
646      )
647    )
648    (local.set $temp2 (call $local-to-stack-multi-4 (i32.const 3))) ;; different local, used later
649    (drop (call $local-to-stack-multi-4 (i32.const 4)))
650    (local.get $temp2)
651  )
652  (func $local-to-stack-overlapping-multi-8-no (param $x i32) (result i32)
653    (local $temp1 i32)
654    (local $temp2 i32)
655    (local.set $temp1 (call $local-to-stack-multi-4 (i32.const 1)))
656    (local.set $temp2 (call $local-to-stack-multi-4 (i32.const 1)))
657    (drop (call $local-to-stack-multi-4 (i32.const 3)))
658    (i32.add
659      (local.get $temp2) ;; the timing
660      (local.get $temp1) ;; it sucks
661    )
662  )
663  (func $local-to-stack-overlapping-multi-9-yes (param $x i32) (result i32)
664    (local $temp1 i32)
665    (local $temp2 i32)
666    (local.set $temp1 (call $local-to-stack-multi-4 (i32.const 1)))
667    (local.set $temp2 (call $local-to-stack-multi-4 (i32.const 1)))
668    (drop (call $local-to-stack-multi-4 (i32.const 3)))
669    (i32.add
670      (local.get $temp1) ;; the stars align
671      (local.get $temp2) ;; and a time presents itself
672    )
673  )
674  (func $local-to-stack-through-control-flow
675    (local $temp1 i32)
676    (local $temp2 i32)
677    (local.set $temp2 (call $local-to-stack-multi-4 (i32.const 0)))
678    (local.set $temp1 (call $local-to-stack-multi-4 (i32.const 1)))
679    (if (i32.const 0) (nop))
680    (drop (local.get $temp1))
681    (local.set $temp1 (call $local-to-stack-multi-4 (i32.const 2)))
682    (block $block (br $block))
683    (drop (local.get $temp1))
684    (drop (local.get $temp2))
685  )
686  (func $local-to-stack-in-control-flow
687    (local $temp1 i32)
688    (if (i32.const 0)
689      (block
690        (local.set $temp1 (call $local-to-stack-multi-4 (i32.const 0)))
691        (drop (local.get $temp1))
692      )
693      (block
694        (local.set $temp1 (call $local-to-stack-multi-4 (i32.const 1)))
695        (drop (local.get $temp1))
696      )
697    )
698  )
699  (func $remove-block (param $x i32) (result i32)
700   (local $temp i32)
701   (i32.add
702    (call $remove-block (i32.const 0))
703    (i32.eqz
704     (block (result i32) ;; after we use the stack instead of the local, we can remove this block
705      (local.set $temp (call $remove-block (i32.const 1)))
706      (drop (call $remove-block (i32.const 2)))
707      (local.get $temp)
708     )
709    )
710   )
711  )
712)
713