clarify the purpose of this project
[nyanglibc.git] / libio / iofdopen.s
blobcfcb413c97c6bbc4ec596c94420af7600b562998
1 .text
2 .p2align 4,,15
3 .globl _IO_new_fdopen
4 .type _IO_new_fdopen, @function
5 _IO_new_fdopen:
6 pushq %r15
7 pushq %r14
8 pushq %r13
9 pushq %r12
10 movl %edi, %r12d
11 pushq %rbp
12 pushq %rbx
13 subq $8, %rsp
14 movzbl (%rsi), %eax
15 cmpb $114, %al
16 je .L3
17 cmpb $119, %al
18 je .L23
19 cmpb $97, %al
20 movl $4100, %ebp
21 je .L4
22 .L14:
23 movq __libc_errno@gottpoff(%rip), %rax
24 movl $22, %fs:(%rax)
25 .L45:
26 xorl %r15d, %r15d
27 .L1:
28 addq $8, %rsp
29 movq %r15, %rax
30 popq %rbx
31 popq %rbp
32 popq %r12
33 popq %r13
34 popq %r14
35 popq %r15
36 ret
37 .p2align 4,,10
38 .p2align 3
39 .L23:
40 movl $4, %ebp
41 .L4:
42 leaq 4(%rsi), %rdx
43 xorl %r13d, %r13d
44 .L11:
45 addq $1, %rsi
46 movzbl (%rsi), %eax
47 cmpb $43, %al
48 je .L8
49 cmpb $109, %al
50 je .L9
51 testb %al, %al
52 je .L10
53 cmpq %rdx, %rsi
54 jne .L11
55 .p2align 4,,10
56 .p2align 3
57 .L10:
58 xorl %eax, %eax
59 movl $3, %esi
60 movl %r12d, %edi
61 call __fcntl
62 cmpl $-1, %eax
63 je .L45
64 movl %eax, %edx
65 andl $3, %edx
66 je .L47
67 cmpl $1, %edx
68 jne .L15
69 testb $4, %bpl
70 je .L14
71 .L15:
72 xorl %r14d, %r14d
73 testl $4096, %ebp
74 je .L16
75 testb $4, %ah
76 je .L48
77 .L16:
78 movl $472, %edi
79 call malloc@PLT
80 testq %rax, %rax
81 movq %rax, %rbx
82 je .L45
83 leaq 224(%rax), %rax
84 testl %r13d, %r13d
85 movq %rbx, %r15
86 leaq 240(%rbx), %rcx
87 movq %rax, 136(%rbx)
88 je .L18
89 testb $8, %bpl
90 jne .L19
91 .L18:
92 leaq _IO_wfile_jumps(%rip), %r8
93 xorl %edx, %edx
94 xorl %esi, %esi
95 movq %rbx, %rdi
96 call _IO_no_init@PLT
97 leaq _IO_file_jumps(%rip), %rax
98 .L22:
99 movq %rbx, %rdi
100 movq %rax, 216(%rbx)
101 call _IO_new_file_init_internal
102 movl (%rbx), %eax
103 movl %r12d, 112(%rbx)
104 andl $-4173, %eax
105 orl %ebp, %eax
106 testb %r14b, %r14b
107 movl %eax, (%rbx)
108 je .L1
109 andl $4100, %ebp
110 cmpl $4100, %ebp
111 jne .L1
112 movq 216(%rbx), %rbp
113 movq __start___libc_IO_vtables@GOTPCREL(%rip), %rdx
114 movq __stop___libc_IO_vtables@GOTPCREL(%rip), %rax
115 movq %rbp, %rcx
116 subq %rdx, %rax
117 subq %rdx, %rcx
118 cmpq %rcx, %rax
119 jbe .L49
120 .L21:
121 xorl %esi, %esi
122 movl $2, %edx
123 movq %rbx, %rdi
124 call *128(%rbp)
125 cmpq $-1, %rax
126 jne .L1
127 movq __libc_errno@gottpoff(%rip), %rax
128 cmpl $29, %fs:(%rax)
129 je .L1
130 jmp .L45
131 .p2align 4,,10
132 .p2align 3
133 .L47:
134 testb $8, %bpl
135 jne .L15
136 jmp .L14
137 .p2align 4,,10
138 .p2align 3
139 .L9:
140 cmpq %rdx, %rsi
141 movl $1, %r13d
142 jne .L11
143 jmp .L10
144 .p2align 4,,10
145 .p2align 3
146 .L8:
147 andl $4096, %ebp
148 jmp .L10
149 .p2align 4,,10
150 .p2align 3
151 .L3:
152 movl $8, %ebp
153 jmp .L4
154 .p2align 4,,10
155 .p2align 3
156 .L19:
157 leaq _IO_wfile_jumps_maybe_mmap(%rip), %r8
158 xorl %edx, %edx
159 xorl %esi, %esi
160 movq %rbx, %rdi
161 call _IO_no_init@PLT
162 leaq _IO_file_jumps_maybe_mmap(%rip), %rax
163 jmp .L22
164 .p2align 4,,10
165 .p2align 3
166 .L48:
167 orb $4, %ah
168 movl $4, %esi
169 movl %r12d, %edi
170 movl %eax, %edx
171 xorl %eax, %eax
172 call __fcntl
173 cmpl $-1, %eax
174 je .L45
175 movl $1, %r14d
176 jmp .L16
177 .p2align 4,,10
178 .p2align 3
179 .L49:
180 call _IO_vtable_check
181 jmp .L21
182 .size _IO_new_fdopen, .-_IO_new_fdopen
183 .weak _IO_fdopen
184 .hidden _IO_fdopen
185 .set _IO_fdopen,_IO_new_fdopen
186 .globl __new_fdopen
187 .set __new_fdopen,_IO_new_fdopen
188 .weak fdopen
189 .set fdopen,__new_fdopen
190 .weak __stop___libc_IO_vtables
191 .weak __start___libc_IO_vtables
192 .hidden _IO_vtable_check
193 .hidden _IO_file_jumps_maybe_mmap
194 .hidden _IO_wfile_jumps_maybe_mmap
195 .hidden _IO_new_file_init_internal
196 .hidden _IO_file_jumps
197 .hidden _IO_wfile_jumps
198 .hidden __fcntl