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