forked from WebAssembly/binaryen
/
basics.wast
108 lines (108 loc) · 2.66 KB
/
basics.wast
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
(module
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$v (func))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(import "env" "puts" (func $puts (param i32)))
(import "env" "memory" (memory $0 1))
(table 2 2 anyfunc)
(elem (i32.const 0) $__wasm_nullptr $main)
(data (i32.const 16) "hello, world!\n\00")
(data (i32.const 32) "vcq")
(data (i32.const 48) "\16\00\00\00")
(export "main" (func $main))
(export "dynCall_iii" (func $dynCall_iii))
(func $main (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(call $puts
(i32.const 16)
)
(block $label$0
(block $label$1
(br_if $label$1
(i32.ne
(i32.sub
(get_local $0)
(i32.and
(i32.add
(get_local $0)
(i32.shr_u
(i32.shr_s
(get_local $0)
(i32.const 31)
)
(i32.const 30)
)
)
(i32.const -4)
)
)
(i32.const 1)
)
)
(block $label$2
(loop $label$3
(set_local $0
(i32.add
(i32.gt_s
(get_local $0)
(i32.const 10)
)
(get_local $0)
)
)
(block $label$4
(br_if $label$4
(i32.ne
(i32.rem_s
(get_local $0)
(i32.const 5)
)
(i32.const 3)
)
)
(set_local $0
(i32.add
(i32.rem_s
(get_local $0)
(i32.const 111)
)
(get_local $0)
)
)
)
(br_if $label$1
(i32.eq
(i32.rem_s
(get_local $0)
(i32.const 7)
)
(i32.const 0)
)
)
(br $label$3)
)
)
)
(set_local $0
(i32.add
(get_local $0)
(i32.const -12)
)
)
(drop
(i32.const 1)
)
)
(get_local $0)
)
(func $__wasm_nullptr (type $FUNCSIG$v)
(unreachable)
)
(func $dynCall_iii (param $fptr i32) (param $0 i32) (param $1 i32) (result i32)
(call_indirect $FUNCSIG$iii
(get_local $0)
(get_local $1)
(get_local $fptr)
)
)
)
;; METADATA: { "asmConsts": {},"staticBump": 52, "initializers": [] }