clarify the purpose of this project
[nyanglibc.git] / libio / freopen.shared.s
blobc63ebb454aab5ee4068f6a4ebce27984f42ed97b
1 .text
2 #APP
3 memmove = __GI_memmove
4 memset = __GI_memset
5 memcpy = __GI_memcpy
6 #NO_APP
7 .p2align 4,,15
8 .globl freopen
9 .type freopen, @function
10 freopen:
11 .LFB68:
12 pushq %r13
13 pushq %r12
14 movq %rsi, %r12
15 pushq %rbp
16 pushq %rbx
17 movq %rdx, %rbx
18 movq %rdi, %rbp
19 subq $40, %rsp
20 movl (%rdx), %edx
21 andl $32768, %edx
22 jne .L2
23 movq 136(%rbx), %rdi
24 movq %fs:16, %r13
25 cmpq %r13, 8(%rdi)
26 je .L3
27 #APP
28 # 44 "freopen.c" 1
29 movl %fs:24,%eax
30 # 0 "" 2
31 #NO_APP
32 testl %eax, %eax
33 jne .L4
34 movl $1, %edx
35 #APP
36 # 47 "../sysdeps/unix/sysv/linux/x86/lowlevellock.h" 1
37 cmpxchgl %edx, (%rdi)
38 # 0 "" 2
39 #NO_APP
40 .L5:
41 movq 136(%rbx), %rdi
42 movq %r13, 8(%rdi)
43 .L3:
44 addl $1, 4(%rdi)
45 .L2:
46 movq 216(%rbx), %r13
47 leaq __start___libc_IO_vtables(%rip), %rdx
48 leaq __stop___libc_IO_vtables(%rip), %rax
49 subq %rdx, %rax
50 movq %r13, %rcx
51 subq %rdx, %rcx
52 cmpq %rcx, %rax
53 jbe .L8
54 .L10:
55 movq %rbx, %rdi
56 .LEHB0:
57 call *96(%r13)
58 movl (%rbx), %eax
59 testb $32, %ah
60 je .L27
61 testq %rbp, %rbp
62 movl 112(%rbx), %r13d
63 je .L40
64 .L12:
65 orl $32, 116(%rbx)
66 movq %rbx, %rdi
67 call __GI__IO_file_close_it
68 leaq __GI__IO_file_jumps(%rip), %rax
69 movq %rax, 216(%rbx)
70 movq 160(%rbx), %rax
71 testq %rax, %rax
72 je .L13
73 leaq __GI__IO_wfile_jumps(%rip), %rsi
74 movq %rsi, 224(%rax)
75 .L13:
76 movl $1, %ecx
77 movq %r12, %rdx
78 movq %rbp, %rsi
79 movq %rbx, %rdi
80 call __GI__IO_file_fopen
81 testq %rax, %rax
82 je .L14
83 movq %rax, %rdi
84 call __fopen_maybe_mmap
85 andl $-33, 116(%rbx)
86 testq %rax, %rax
87 movq %rax, %rbp
88 je .L15
89 cmpl $-1, %r13d
90 movl $0, 192(%rax)
91 je .L37
92 movl 112(%rax), %edi
93 cmpl %r13d, %edi
94 je .L37
95 movl 116(%rax), %edx
96 movl %r13d, %esi
97 sall $13, %edx
98 andl $524288, %edx
99 call __GI___dup3
100 cmpl $-1, %eax
101 je .L41
102 movl 112(%rbp), %edi
103 call __GI___close
104 movl %r13d, 112(%rbp)
105 .L37:
106 movl (%rbx), %eax
107 jmp .L11
108 .p2align 4,,10
109 .p2align 3
110 .L14:
111 andl $-33, 116(%rbx)
112 .L15:
113 cmpl $-1, %r13d
114 je .L38
115 movl %r13d, %edi
116 call __GI___close
117 .L38:
118 movl (%rbx), %eax
119 xorl %ebp, %ebp
120 .L11:
121 testb $-128, %ah
122 jne .L1
123 movq 136(%rbx), %rdi
124 movl 4(%rdi), %eax
125 subl $1, %eax
126 testl %eax, %eax
127 movl %eax, 4(%rdi)
128 jne .L1
129 movq $0, 8(%rdi)
130 #APP
131 # 885 "../libio/libioP.h" 1
132 movl %fs:24,%edx
133 # 0 "" 2
134 #NO_APP
135 testl %edx, %edx
136 jne .L23
137 subl $1, (%rdi)
138 .L1:
139 addq $40, %rsp
140 movq %rbp, %rax
141 popq %rbx
142 popq %rbp
143 popq %r12
144 popq %r13
146 .p2align 4,,10
147 .p2align 3
148 .L40:
149 movq %rsp, %rsi
150 movl %r13d, %edi
151 call __fd_to_filename
152 movq %rax, %rbp
153 jmp .L12
154 .p2align 4,,10
155 .p2align 3
156 .L41:
157 movq %rbp, %rdi
158 call __GI__IO_file_close_it
159 jmp .L38
160 .p2align 4,,10
161 .p2align 3
162 .L8:
163 call _IO_vtable_check
164 jmp .L10
165 .p2align 4,,10
166 .p2align 3
167 .L27:
168 xorl %ebp, %ebp
169 jmp .L11
170 .p2align 4,,10
171 .p2align 3
172 .L4:
173 movl $1, %ecx
174 movl %edx, %eax
175 lock cmpxchgl %ecx, (%rdi)
176 je .L5
177 call __lll_lock_wait_private
178 .LEHE0:
179 jmp .L5
180 .p2align 4,,10
181 .p2align 3
182 .L23:
183 #APP
184 # 885 "../libio/libioP.h" 1
185 xchgl %eax, (%rdi)
186 # 0 "" 2
187 #NO_APP
188 cmpl $1, %eax
189 jle .L1
190 xorl %r10d, %r10d
191 movl $1, %edx
192 movl $129, %esi
193 movl $202, %eax
194 #APP
195 # 885 "../libio/libioP.h" 1
196 syscall
198 # 0 "" 2
199 #NO_APP
200 jmp .L1
201 .L28:
202 testl $32768, (%rbx)
203 movq %rax, %r8
204 jne .L25
205 movq 136(%rbx), %rdi
206 movl 4(%rdi), %eax
207 subl $1, %eax
208 testl %eax, %eax
209 movl %eax, 4(%rdi)
210 jne .L25
211 movq $0, 8(%rdi)
212 #APP
213 # 885 "../libio/libioP.h" 1
214 movl %fs:24,%edx
215 # 0 "" 2
216 #NO_APP
217 testl %edx, %edx
218 jne .L26
219 subl $1, (%rdi)
220 .L25:
221 movq %r8, %rdi
222 .LEHB1:
223 call _Unwind_Resume@PLT
224 .LEHE1:
225 .L26:
226 #APP
227 # 885 "../libio/libioP.h" 1
228 xchgl %eax, (%rdi)
229 # 0 "" 2
230 #NO_APP
231 subl $1, %eax
232 jle .L25
233 xorl %r10d, %r10d
234 movl $1, %edx
235 movl $129, %esi
236 movl $202, %eax
237 #APP
238 # 885 "../libio/libioP.h" 1
239 syscall
241 # 0 "" 2
242 #NO_APP
243 jmp .L25
244 .LFE68:
245 .globl __gcc_personality_v0
246 .section .gcc_except_table,"a",@progbits
247 .LLSDA68:
248 .byte 0xff
249 .byte 0xff
250 .byte 0x1
251 .uleb128 .LLSDACSE68-.LLSDACSB68
252 .LLSDACSB68:
253 .uleb128 .LEHB0-.LFB68
254 .uleb128 .LEHE0-.LEHB0
255 .uleb128 .L28-.LFB68
256 .uleb128 0
257 .uleb128 .LEHB1-.LFB68
258 .uleb128 .LEHE1-.LEHB1
259 .uleb128 0
260 .uleb128 0
261 .LLSDACSE68:
262 .text
263 .size freopen, .-freopen
264 .hidden DW.ref.__gcc_personality_v0
265 .weak DW.ref.__gcc_personality_v0
266 .section .data.DW.ref.__gcc_personality_v0,"awG",@progbits,DW.ref.__gcc_personality_v0,comdat
267 .align 8
268 .type DW.ref.__gcc_personality_v0, @object
269 .size DW.ref.__gcc_personality_v0, 8
270 DW.ref.__gcc_personality_v0:
271 .quad __gcc_personality_v0
272 .hidden __lll_lock_wait_private
273 .hidden _IO_vtable_check
274 .hidden __fd_to_filename
275 .hidden __fopen_maybe_mmap
276 .hidden __stop___libc_IO_vtables
277 .hidden __start___libc_IO_vtables