-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmine.min.wat
1381 lines (1381 loc) · 42.9 KB
/
mine.min.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(module
(type (;0;) (func (param f64) (result f64)))
(type (;1;) (func (result f64)))
(type (;2;) (func))
(type (;3;) (func (result i32)))
(import "env" "cos" (func (;0;) (type 0)))
(import "env" "now" (func (;1;) (type 1)))
(import "env" "random" (func (;2;) (type 1)))
(import "env" "sin" (func (;3;) (type 0)))
(import "env" "sqrt" (func (;4;) (type 0)))
(func (;5;) (type 3) (result i32)
i32.const 16)
(func (;6;) (type 2)
(local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 f64 f64 f64 f64)
i32.const 1211664
set_local 8
i32.const 1
set_local 9
loop ;; label = @1
get_local 9
i32.const 4
i32.eq
set_local 16
block ;; label = @2
block ;; label = @3
call 2
f64.const 0x1.8p+6 (;=96;)
f64.mul
tee_local 21
f64.abs
f64.const 0x1p+31 (;=2.14748e+09;)
f64.lt
br_if 0 (;@3;)
i32.const -2147483648
set_local 18
br 1 (;@2;)
end
get_local 21
i32.trunc_s/f64
set_local 18
end
i32.const 8355711
i32.const 9858122
get_local 16
select
set_local 1
get_local 9
i32.const 1
i32.add
set_local 0
i32.const 255
get_local 18
i32.sub
set_local 17
i32.const 0
set_local 11
get_local 8
set_local 10
loop ;; label = @2
i32.const 8
set_local 13
i32.const 8
get_local 11
tee_local 2
i32.const 15
i32.and
tee_local 16
i32.sub
get_local 16
i32.const -7
i32.add
get_local 16
i32.const 7
i32.lt_u
select
set_local 5
get_local 2
i32.const 3
i32.and
set_local 6
get_local 2
i32.const 1
i32.add
set_local 11
get_local 2
i32.const 4
i32.and
set_local 3
get_local 2
i32.const -33
i32.and
i32.const -1
i32.add
set_local 4
i32.const 81
set_local 12
get_local 10
set_local 14
i32.const 0
set_local 15
loop ;; label = @3
get_local 15
tee_local 18
i32.const 1
i32.add
set_local 15
call 2
set_local 21
block ;; label = @4
block ;; label = @5
block ;; label = @6
block ;; label = @7
block ;; label = @8
block ;; label = @9
block ;; label = @10
block ;; label = @11
block ;; label = @12
block ;; label = @13
block ;; label = @14
block ;; label = @15
block ;; label = @16
block ;; label = @17
block ;; label = @18
get_local 9
i32.const 4
i32.ne
br_if 0 (;@18;)
get_local 21
f64.const 0x1.8p+1 (;=3;)
f64.mul
tee_local 21
f64.abs
f64.const 0x1p+31 (;=2.14748e+09;)
f64.lt
br_if 1 (;@17;)
i32.const 8355711
set_local 16
i32.const -2147483648
br_if 13 (;@5;)
br 2 (;@16;)
end
get_local 9
i32.const -1
i32.add
tee_local 7
i32.const 8
i32.gt_u
set_local 16
get_local 21
f64.const 0x1.8p+6 (;=96;)
f64.mul
tee_local 21
f64.abs
f64.const 0x1p+31 (;=2.14748e+09;)
f64.lt
br_if 2 (;@15;)
i32.const 255
i32.const -2147483648
i32.sub
set_local 17
get_local 16
i32.eqz
br_if 3 (;@14;)
br 6 (;@11;)
end
i32.const 8355711
set_local 16
get_local 21
i32.trunc_s/f64
br_if 11 (;@5;)
end
call 2
f64.const 0x1.8p+6 (;=96;)
f64.mul
tee_local 21
f64.abs
f64.const 0x1p+31 (;=2.14748e+09;)
f64.lt
br_if 2 (;@13;)
i32.const -2147483648
set_local 16
br 3 (;@12;)
end
i32.const 255
get_local 21
i32.trunc_s/f64
i32.sub
set_local 17
get_local 16
br_if 3 (;@11;)
end
i32.const 4210943
set_local 16
block ;; label = @14
block ;; label = @15
block ;; label = @16
get_local 7
br_table 0 (;@16;) 5 (;@11;) 5 (;@11;) 5 (;@11;) 1 (;@15;) 5 (;@11;) 2 (;@14;) 5 (;@11;) 11 (;@5;) 0 (;@16;)
end
i32.const 6990400
set_local 16
get_local 2
get_local 12
get_local 18
i32.mul
i32.const 2
i32.shr_u
i32.const 3
i32.and
tee_local 18
i32.const 18
i32.add
i32.lt_s
br_if 10 (;@5;)
get_local 2
get_local 18
i32.const 19
i32.add
i32.ge_s
br_if 4 (;@11;)
get_local 17
i32.const 1
i32.shl
i32.const 3
i32.div_s
set_local 17
br 4 (;@11;)
end
i32.const 11876885
i32.const 12365733
get_local 3
get_local 18
i32.add
i32.const 7
i32.and
select
i32.const 12365733
get_local 6
select
set_local 16
br 9 (;@5;)
end
get_local 18
i32.const -1
i32.add
i32.const 13
i32.gt_u
br_if 3 (;@10;)
get_local 4
i32.const 14
i32.ge_u
br_if 3 (;@10;)
get_local 5
get_local 13
get_local 18
i32.const -7
i32.add
get_local 18
i32.const 7
i32.lt_s
select
tee_local 16
get_local 5
get_local 16
i32.gt_s
select
i32.const 3
i32.rem_s
i32.const 5
i32.shl
i32.const 196
i32.add
set_local 16
call 2
f64.const 0x1p+5 (;=32;)
f64.mul
tee_local 21
f64.abs
f64.const 0x1p+31 (;=2.14748e+09;)
f64.lt
br_if 4 (;@9;)
i32.const -2147483648
set_local 18
br 5 (;@8;)
end
get_local 21
i32.trunc_s/f64
set_local 16
end
i32.const 255
get_local 16
i32.sub
set_local 17
end
get_local 17
i32.const 2
i32.div_s
get_local 17
get_local 2
i32.const 31
i32.gt_s
select
set_local 18
block ;; label = @11
block ;; label = @12
block ;; label = @13
get_local 9
i32.const 8
i32.ne
br_if 0 (;@13;)
call 2
tee_local 21
get_local 21
f64.add
tee_local 21
f64.abs
f64.const 0x1p+31 (;=2.14748e+09;)
f64.lt
br_if 1 (;@12;)
i32.const -2147483648
set_local 16
br 2 (;@11;)
end
get_local 1
set_local 16
br 8 (;@4;)
end
get_local 21
i32.trunc_s/f64
set_local 16
end
get_local 18
i32.const 255
get_local 16
select
set_local 18
i32.const 5298487
i32.const 0
get_local 16
select
set_local 16
br 6 (;@4;)
end
call 2
tee_local 21
get_local 21
f64.add
tee_local 21
f64.abs
f64.const 0x1p+31 (;=2.14748e+09;)
f64.lt
br_if 2 (;@7;)
i32.const 6771249
set_local 16
i32.const -2147483648
br_if 4 (;@5;)
br 3 (;@6;)
end
get_local 21
i32.trunc_s/f64
set_local 18
end
get_local 16
get_local 18
i32.sub
set_local 17
i32.const 12359778
set_local 16
br 2 (;@5;)
end
i32.const 6771249
set_local 16
get_local 21
i32.trunc_s/f64
br_if 1 (;@5;)
end
get_local 17
i32.const 150
i32.const 0
get_local 18
i32.const 1
i32.and
i32.sub
i32.const 100
i32.and
i32.sub
i32.mul
i32.const 100
i32.div_s
set_local 17
end
get_local 17
i32.const 2
i32.div_s
get_local 17
get_local 2
i32.const 31
i32.gt_s
select
set_local 18
end
get_local 14
get_local 16
i32.const 8
i32.shr_u
i32.const 255
i32.and
get_local 18
i32.mul
i32.const 255
i32.div_s
i32.const 8
i32.shl
get_local 16
i32.const 255
i32.and
get_local 18
i32.mul
i32.const 255
i32.div_s
i32.or
get_local 16
i32.const 16
i32.shr_u
i32.const 255
i32.and
get_local 18
i32.mul
i32.const 255
i32.div_s
i32.const 16
i32.shl
i32.or
i32.store
get_local 12
i32.const 3
i32.add
set_local 12
get_local 13
i32.const -1
i32.add
set_local 13
get_local 14
i32.const 4
i32.add
set_local 14
get_local 15
i32.const 16
i32.lt_s
br_if 0 (;@3;)
end
get_local 10
i32.const 64
i32.add
set_local 10
get_local 11
i32.const 47
i32.le_s
br_if 0 (;@2;)
end
get_local 8
i32.const 3072
i32.add
set_local 8
get_local 0
set_local 9
get_local 0
i32.const 16
i32.lt_s
br_if 0 (;@1;)
end
i32.const 0
set_local 9
block ;; label = @1
loop ;; label = @2
get_local 9
tee_local 13
i32.const 1
i32.add
set_local 9
i32.const 0
set_local 12
loop ;; label = @3
get_local 12
tee_local 16
i32.const 1
i32.add
set_local 12
get_local 16
i32.const 6
i32.shl
get_local 13
i32.or
set_local 17
get_local 16
f64.convert_u/i32
f64.const -0x1.04p+5 (;=-32.5;)
f64.add
f64.const 0x1.999999999999ap-2 (;=0.4;)
f64.mul
tee_local 21
get_local 21
f64.mul
set_local 19
i32.const 0
set_local 18
i32.const 0
set_local 16
loop ;; label = @4
call 2
set_local 22
get_local 17
get_local 18
i32.or
tee_local 14
i32.const 262143
i32.gt_u
br_if 3 (;@1;)
get_local 16
f64.convert_u/i32
f64.const -0x1.04p+5 (;=-32.5;)
f64.add
f64.const 0x1.999999999999ap-2 (;=0.4;)
f64.mul
set_local 21
get_local 14
i32.const 2
i32.shl
i32.const 160016
i32.add
set_local 14
block ;; label = @5
block ;; label = @6
get_local 22
f64.const 0x1p+4 (;=16;)
f64.mul
tee_local 22
f64.abs
f64.const 0x1p+31 (;=2.14748e+09;)
f64.lt
br_if 0 (;@6;)
i32.const -2147483648
set_local 15
br 1 (;@5;)
end
get_local 22
i32.trunc_s/f64
set_local 15
end
get_local 14
get_local 15
i32.store
call 2
set_local 20
block ;; label = @5
get_local 19
get_local 21
get_local 21
f64.mul
f64.add
tee_local 22
call 4
tee_local 21
get_local 21
f64.eq
br_if 0 (;@5;)
get_local 22
call 4
set_local 21
end
block ;; label = @5
get_local 21
call 4
tee_local 22
get_local 22
f64.eq
br_if 0 (;@5;)
get_local 21
call 4
set_local 22
end
get_local 16
i32.const 1
i32.add
set_local 16
block ;; label = @5
get_local 20
get_local 22
f64.const -0x1.999999999999ap-1 (;=-0.8;)
f64.add
f64.gt
i32.eqz
br_if 0 (;@5;)
get_local 14
i32.const 0
i32.store
end
get_local 18
i32.const 4096
i32.add
set_local 18
get_local 16
i32.const 64
i32.lt_u
br_if 0 (;@4;)
end
get_local 12
i32.const 63
i32.le_u
br_if 0 (;@3;)
end
get_local 9
i32.const 64
i32.lt_u
br_if 0 (;@2;)
end
i32.const 0
set_local 18
i32.const 19
set_local 16
loop ;; label = @2
get_local 16
i32.const 255
i32.store8
get_local 16
i32.const 4
i32.add
set_local 16
get_local 18
i32.const 1
i32.add
tee_local 18
i32.const 40000
i32.lt_s
br_if 0 (;@2;)
end
return
end
)
(func (;7;) (type 2)
(local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64)
block ;; label = @1
block ;; label = @2
call 1
tee_local 37
f64.abs
f64.const 0x1p+63 (;=9.22337e+18;)
f64.lt
br_if 0 (;@2;)
i64.const -9223372036854775808
set_local 13
br 1 (;@1;)
end
get_local 37
i64.trunc_s/f64
set_local 13
end
get_local 13
i64.const 10000
i64.rem_s
f64.convert_s/i64
f64.const 0x1.388p+13 (;=10000;)
f64.div
f64.const 0x1.921fb54442d18p+1 (;=3.14159;)
f64.mul
tee_local 37
get_local 37
f64.add
call 3
set_local 37
block ;; label = @1
block ;; label = @2
call 1
tee_local 35
f64.abs
f64.const 0x1p+63 (;=9.22337e+18;)
f64.lt
br_if 0 (;@2;)
i64.const -9223372036854775808
set_local 13
br 1 (;@1;)
end
get_local 35
i64.trunc_s/f64
set_local 13
end
get_local 13
i64.const 10000
i64.rem_s
f64.convert_s/i64
f64.const 0x1.388p+13 (;=10000;)
f64.div
f64.const 0x1.921fb54442d18p+1 (;=3.14159;)
f64.mul
tee_local 35
get_local 35
f64.add
call 0
f64.const 0x1.999999999999ap-2 (;=0.4;)
f64.mul
tee_local 35
call 0
set_local 14
get_local 35
call 3
set_local 15
get_local 37
f64.const 0x1.999999999999ap-2 (;=0.4;)
f64.mul
f64.const 0x1.921fb54442d18p+0 (;=1.5708;)
f64.add
tee_local 37
call 0
set_local 16
get_local 37
call 3
set_local 17
block ;; label = @1
block ;; label = @2
call 1
tee_local 37
f64.abs
f64.const 0x1p+63 (;=9.22337e+18;)
f64.lt
br_if 0 (;@2;)
i64.const -9223372036854775808
set_local 13
br 1 (;@1;)
end
get_local 37
i64.trunc_s/f64
set_local 13
end
block ;; label = @1
block ;; label = @2
get_local 13
i64.const 10000
i64.rem_s
f64.convert_s/i64
f64.const 0x1.388p+13 (;=10000;)
f64.div
f64.const 0x1p+6 (;=64;)
f64.mul
f64.const 0x1.04p+5 (;=32.5;)
f64.add
tee_local 18
f64.abs
f64.const 0x1p+31 (;=2.14748e+09;)
f64.lt
br_if 0 (;@2;)
i32.const -2147483648
set_local 7
br 1 (;@1;)
end
get_local 18
i32.trunc_s/f64
set_local 7
end
get_local 18
get_local 7
f64.convert_s/i32
f64.sub
set_local 19
i32.const 0
set_local 4
block ;; label = @1
block ;; label = @2
block ;; label = @3
block ;; label = @4
loop ;; label = @5
get_local 4
tee_local 7
i32.const 1
i32.add
set_local 4
get_local 17
get_local 7
f64.convert_s/i32
tee_local 20
f64.const -0x1.9p+6 (;=-100;)
f64.add
f64.const 0x1.9p+7 (;=200;)
f64.div
tee_local 37
f64.mul
set_local 22
get_local 16
get_local 37
f64.mul
set_local 21
i32.const 0
set_local 5
loop ;; label = @6
get_local 14
get_local 5
f64.convert_s/i32
tee_local 23
f64.const -0x1.9p+6 (;=-100;)
f64.add
f64.const 0x1.9p+7 (;=200;)
f64.div
tee_local 37
f64.mul
get_local 15
f64.sub
tee_local 24
f64.neg
get_local 24
get_local 24
f64.const 0x0p+0 (;=0;)
f64.lt
tee_local 1
select
set_local 28
get_local 16
get_local 14
get_local 15
get_local 37
f64.mul
f64.add
tee_local 37
f64.mul
get_local 22
f64.sub
tee_local 26
f64.neg
get_local 26
get_local 26
f64.const 0x0p+0 (;=0;)
f64.lt
tee_local 2
select
set_local 29
get_local 21
get_local 17
get_local 37
f64.mul
f64.add
tee_local 25
f64.neg
get_local 25
get_local 25
f64.const 0x0p+0 (;=0;)
f64.lt
tee_local 0
select
set_local 27
get_local 5
i32.const 1
i32.add
set_local 5
f64.const 0x1p+5 (;=32;)
set_local 39
i32.const 255
set_local 11
i32.const 0
set_local 12
i32.const 0
set_local 10
i32.const 0
set_local 6
loop ;; label = @7
f64.const 0x1p-1 (;=0.5;)
set_local 37
block ;; label = @8
block ;; label = @9
block ;; label = @10
get_local 6
i32.const 1
i32.eq
tee_local 8
br_if 0 (;@10;)
get_local 6
i32.const 2
i32.ne
br_if 1 (;@9;)
get_local 29
set_local 35
get_local 2
set_local 7
get_local 26
set_local 36
br 2 (;@8;)
end
get_local 28
set_local 35
get_local 1
set_local 7
get_local 24
set_local 36
br 1 (;@8;)
end
get_local 27
set_local 35
get_local 0
set_local 7
get_local 25
set_local 36
get_local 19
set_local 37
end
f64.const 0x1p+0 (;=1;)
get_local 35
f64.div
tee_local 30
f64.const 0x1p+0 (;=1;)
get_local 37
f64.sub
get_local 37
get_local 36
f64.const 0x0p+0 (;=0;)
f64.gt
select
tee_local 35
f64.mul
set_local 38
get_local 26
get_local 30
f64.mul
tee_local 33
get_local 35
f64.mul
f64.const 0x1.04p+5 (;=32.5;)
f64.add
set_local 37
get_local 24
get_local 30
f64.mul
tee_local 32
get_local 35
f64.mul
f64.const 0x1.04p+5 (;=32.5;)
f64.add
set_local 36
get_local 18
get_local 25
get_local 30
f64.mul
tee_local 31
get_local 35
f64.mul
f64.add
set_local 35
block ;; label = @8
get_local 7
i32.eqz
br_if 0 (;@8;)
block ;; label = @9
block ;; label = @10
get_local 6
i32.const 2
i32.eq
br_if 0 (;@10;)
get_local 8
br_if 1 (;@9;)
get_local 6
br_if 2 (;@8;)
get_local 35
f64.const -0x1p+0 (;=-1;)
f64.add
set_local 35
br 2 (;@8;)
end
get_local 37
f64.const -0x1p+0 (;=-1;)
f64.add
set_local 37
br 1 (;@8;)
end
get_local 36
f64.const -0x1p+0 (;=-1;)
f64.add
set_local 36
end
block ;; label = @8
get_local 38
get_local 39
f64.ge
get_local 38
get_local 38
f64.ne
get_local 39
get_local 39
f64.ne
i32.or
i32.or
br_if 0 (;@8;)
get_local 6
i32.const 2
i32.add
i32.const 3
i32.rem_s
i32.const -12750
i32.mul
i32.const 65025
i32.add
i32.const 255
i32.div_s
set_local 3
loop ;; label = @9