forked from WebAssembly/binaryen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
recursive.wast
87 lines (86 loc) · 1.68 KB
/
recursive.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
(module
(type $0 (func (param i32 i32) (result i32)))
(type $1 (func (result i32)))
(type $2 (func))
(import "env" "printf" (func $printf (param i32 i32) (result i32)))
(global $global$0 (mut i32) (i32.const 66128))
(global $global$1 i32 (i32.const 66128))
(global $global$2 i32 (i32.const 587))
(table 1 1 anyfunc)
(memory $0 2)
(data (i32.const 568) "%d:%d\n\00Result: %d\n\00")
(export "memory" (memory $0))
(export "__wasm_call_ctors" (func $__wasm_call_ctors))
(export "main" (func $main))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
(func $foo (; 1 ;) (type $0) (param $var$0 i32) (param $var$1 i32) (result i32)
(local $var$2 i32)
(set_global $global$0
(tee_local $var$2
(i32.sub
(get_global $global$0)
(i32.const 16)
)
)
)
(i32.store offset=4
(get_local $var$2)
(get_local $var$1)
)
(i32.store
(get_local $var$2)
(get_local $var$0)
)
(drop
(call $printf
(i32.const 568)
(get_local $var$2)
)
)
(set_global $global$0
(i32.add
(get_local $var$2)
(i32.const 16)
)
)
(i32.add
(get_local $var$1)
(get_local $var$0)
)
)
(func $main (; 2 ;) (type $1) (result i32)
(local $var$0 i32)
(set_global $global$0
(tee_local $var$0
(i32.sub
(get_global $global$0)
(i32.const 16)
)
)
)
(i32.store
(get_local $var$0)
(call $foo
(i32.const 1)
(i32.const 2)
)
)
(drop
(call $printf
(i32.const 575)
(get_local $var$0)
)
)
(set_global $global$0
(i32.add
(get_local $var$0)
(i32.const 16)
)
)
(i32.const 0)
)
(func $__wasm_call_ctors (; 3 ;) (type $2)
)
;; custom section "linking", size 3
)