-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.s
236 lines (232 loc) · 4.75 KB
/
example.s
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
.text
.file "example.c"
.section .text.test,"",@
.globl test # -- Begin function test
.globaltype __stack_pointer, i32
.functype sleep (i32) -> (i32)
.functype printf (i32, i32) -> (i32)
.functype thrd_exit (i32) -> ()
.functype thrd_create (i32, i32, i32) -> (i32)
.functype thrd_join (i32, i32) -> (i32)
.functype getTempRet0 () -> (i32)
.import_module getTempRet0, env
.import_name getTempRet0, getTempRet0
.functype setTempRet0 (i32) -> ()
.import_module setTempRet0, env
.import_name setTempRet0, setTempRet0
.type test,@function
test: # @test
.functype test (i32) -> (i32)
.local i32, i32, i32, i32, i32, i32, i32, i32
# %bb.0:
global.get __stack_pointer
local.set 1
i32.const 16
local.set 2
local.get 1
local.get 2
i32.sub
local.set 3
local.get 3
global.set __stack_pointer
local.get 3
local.get 0
i32.store 12
i32.const 1
local.set 4
local.get 4
call sleep
drop
global.get variable1@GOT@TLS
local.set 5
local.get 5
i32.load 0
local.set 6
local.get 3
local.get 6
i32.store 0
i32.const .L.str
local.set 7
local.get 7
local.get 3
call printf
drop
i32.const 0
local.set 8
local.get 8
call thrd_exit
unreachable
end_function
.Lfunc_end0:
.size test, .Lfunc_end0-test
# -- End function
.section .text.__original_main,"",@
.globl __original_main # -- Begin function __original_main
.type __original_main,@function
__original_main: # @__original_main
.functype __original_main () -> (i32)
.local i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32
# %bb.0:
global.get __stack_pointer
local.set 0
i32.const 32
local.set 1
local.get 0
local.get 1
i32.sub
local.set 2
local.get 2
global.set __stack_pointer
i32.const 0
local.set 3
local.get 2
local.get 3
i32.store 28
global.get variable1@GOT@TLS
local.set 4
local.get 4
i32.load 0
local.set 5
local.get 2
local.get 5
i32.store 0
i32.const .L.str.1
local.set 6
local.get 6
local.get 2
call printf
drop
i32.const test
local.set 7
i32.const 24
local.set 8
local.get 2
local.get 8
i32.add
local.set 9
local.get 9
local.get 7
local.get 3
call thrd_create
drop
local.get 4
i32.load 0
local.set 10
i32.const 1
local.set 11
local.get 10
local.get 11
i32.add
local.set 12
local.get 4
local.get 12
i32.store 0
local.get 4
i32.load 0
local.set 13
local.get 2
local.get 13
i32.store 16
i32.const .L.str.2
local.set 14
i32.const 16
local.set 15
local.get 2
local.get 15
i32.add
local.set 16
local.get 14
local.get 16
call printf
drop
local.get 2
i32.load 24
local.set 17
i32.const 0
local.set 18
local.get 17
local.get 18
call thrd_join
drop
i32.const 0
local.set 19
i32.const 32
local.set 20
local.get 2
local.get 20
i32.add
local.set 21
local.get 21
global.set __stack_pointer
local.get 19
return
end_function
.Lfunc_end1:
.size __original_main, .Lfunc_end1-__original_main
# -- End function
.section .text.main,"",@
.globl main # -- Begin function main
.type main,@function
main: # @main
.functype main (i32, i32) -> (i32)
.local i32
# %bb.0:
call __original_main
local.set 2
local.get 2
return
end_function
.Lfunc_end2:
.size main, .Lfunc_end2-main
# -- End function
.type variable1,@object # @variable1
.section .tdata.variable1,"T",@
.globl variable1
.p2align 2
variable1:
.int32 1 # 0x1
.size variable1, 4
.type .L.str,@object # @.str
.section .rodata..L.str,"S",@
.L.str:
.asciz "in thread, variable1: %d\n"
.size .L.str, 26
.type .L.str.1,@object # @.str.1
.section .rodata..L.str.1,"S",@
.L.str.1:
.asciz "main, variable1 before: %d\n"
.size .L.str.1, 28
.type .L.str.2,@object # @.str.2
.section .rodata..L.str.2,"S",@
.L.str.2:
.asciz "main, variable1 after: %d\n"
.size .L.str.2, 27
.ident "clang version 14.0.0 (https://github.com/llvm/llvm-project 4348cd42c385e71b63e5da7e492172cff6a79d7b)"
.no_dead_strip __indirect_function_table
.size __THREW__, 4
.size __threwValue, 4
.section .custom_section.producers,"",@
.int8 1
.int8 12
.ascii "processed-by"
.int8 1
.int8 5
.ascii "clang"
.int8 86
.ascii "14.0.0 (https://github.com/llvm/llvm-project 4348cd42c385e71b63e5da7e492172cff6a79d7b)"
.section .rodata..L.str.2,"S",@
.section .custom_section.target_features,"",@
.int8 4
.int8 43
.int8 7
.ascii "atomics"
.int8 43
.int8 11
.ascii "bulk-memory"
.int8 43
.int8 15
.ascii "mutable-globals"
.int8 43
.int8 8
.ascii "sign-ext"
.section .rodata..L.str.2,"S",@