clarify the purpose of this project
[nyanglibc.git] / resolv / inet_pton.s
blobf5255e35cc08dc54e408ce91e92f0373cc6c2a47
1 .text
2 .p2align 4,,15
3 .type inet_pton4, @function
4 inet_pton4:
5 cmpq %rsi, %rdi
6 movb $0, -4(%rsp)
7 jnb .L7
8 leaq -4(%rsp), %r8
9 xorl %r10d, %r10d
10 xorl %r9d, %r9d
11 jmp .L2
12 .p2align 4,,10
13 .p2align 3
14 .L19:
15 movzbl (%r8), %eax
16 testl %r9d, %r9d
17 movl %eax, %r11d
18 leal (%rax,%rax,4), %eax
19 leal (%rcx,%rax,2), %eax
20 je .L17
21 cmpl $255, %eax
22 ja .L7
23 testb %r11b, %r11b
24 je .L7
25 movb %al, (%r8)
26 .L8:
27 cmpq %rdi, %rsi
28 je .L18
29 .L2:
30 addq $1, %rdi
31 movsbl -1(%rdi), %eax
32 leal -48(%rax), %ecx
33 cmpl $9, %ecx
34 jbe .L19
35 cmpl $46, %eax
36 sete %al
37 testb %r9b, %al
38 je .L7
39 cmpl $4, %r10d
40 je .L7
41 movb $0, 1(%r8)
42 xorl %r9d, %r9d
43 addq $1, %r8
44 cmpq %rdi, %rsi
45 jne .L2
46 .L18:
47 cmpl $3, %r10d
48 jle .L7
49 movl -4(%rsp), %eax
50 movl %eax, (%rdx)
51 movl $1, %eax
52 ret
53 .p2align 4,,10
54 .p2align 3
55 .L17:
56 cmpl $255, %eax
57 ja .L7
58 addl $1, %r10d
59 movb %al, (%r8)
60 cmpl $4, %r10d
61 jg .L7
62 movl $1, %r9d
63 jmp .L8
64 .p2align 4,,10
65 .p2align 3
66 .L7:
67 xorl %eax, %eax
68 ret
69 .size inet_pton4, .-inet_pton4
70 .p2align 4,,15
71 .globl __inet_pton_length
72 .hidden __inet_pton_length
73 .type __inet_pton_length, @function
74 __inet_pton_length:
75 pushq %r14
76 pushq %r12
77 movq %rsi, %rax
78 pushq %rbp
79 pushq %rbx
80 subq $40, %rsp
81 cmpl $2, %edi
82 je .L22
83 cmpl $10, %edi
84 jne .L49
85 leaq (%rsi,%rdx), %rsi
86 pxor %xmm0, %xmm0
87 leaq 16(%rsp), %rdi
88 cmpq %rax, %rsi
89 movaps %xmm0, 16(%rsp)
90 movq %rdi, %r11
91 je .L28
92 cmpb $58, (%rax)
93 je .L50
94 .L27:
95 cmpq %rax, %rsi
96 leaq 16(%rdi), %r14
97 jbe .L30
98 movq %rax, %rdi
99 xorl %ebp, %ebp
100 xorl %edx, %edx
101 xorl %r12d, %r12d
102 .L29:
103 addq $1, %rax
104 movsbl -1(%rax), %r9d
105 leal -48(%r9), %r10d
106 movl %r9d, %r8d
107 cmpb $9, %r10b
108 ja .L31
109 leal -48(%r9), %r8d
110 .L32:
111 testl %r8d, %r8d
112 js .L34
113 cmpq $4, %r12
114 je .L28
115 sall $4, %edx
116 orl %r8d, %edx
117 cmpl $65535, %edx
118 ja .L28
119 addq $1, %r12
120 .L35:
121 cmpq %rax, %rsi
122 jne .L29
123 testq %r12, %r12
124 je .L42
125 leaq 2(%r11), %r12
126 cmpq %r12, %r14
127 jb .L28
128 movzbl %dh, %eax
129 movb %dl, 1(%r11)
130 movb %al, (%r11)
131 .L39:
132 testq %rbp, %rbp
133 je .L43
134 cmpq %r12, %r14
135 movq %rcx, 8(%rsp)
136 je .L28
137 movq %r12, %rdx
138 movq %r14, %rbx
139 movq %rbp, %rsi
140 subq %rbp, %rdx
141 subq %rdx, %rbx
142 movq %rbx, %rdi
143 subq %rbp, %rbx
144 call memmove
145 movq %rbx, %rdx
146 xorl %esi, %esi
147 movq %rbp, %rdi
148 call memset@PLT
149 movq 8(%rsp), %rcx
150 .L40:
151 movdqa 16(%rsp), %xmm0
152 movl $1, %eax
153 movups %xmm0, (%rcx)
154 jmp .L20
155 .p2align 4,,10
156 .p2align 3
157 .L49:
158 movq __libc_errno@gottpoff(%rip), %rax
159 movl $97, %fs:(%rax)
160 movl $-1, %eax
161 .L20:
162 addq $40, %rsp
163 popq %rbx
164 popq %rbp
165 popq %r12
166 popq %r14
168 .p2align 4,,10
169 .p2align 3
170 .L22:
171 leaq (%rsi,%rdx), %rsi
172 movq %rax, %rdi
173 movq %rcx, %rdx
174 call inet_pton4
175 addq $40, %rsp
176 popq %rbx
177 popq %rbp
178 popq %r12
179 popq %r14
181 .L43:
182 movq %r12, %r11
183 .L30:
184 cmpq %r11, %r14
185 je .L40
186 .p2align 4,,10
187 .p2align 3
188 .L28:
189 xorl %eax, %eax
190 .L52:
191 addq $40, %rsp
192 popq %rbx
193 popq %rbp
194 popq %r12
195 popq %r14
197 .p2align 4,,10
198 .p2align 3
199 .L50:
200 leaq 1(%rax), %rdx
201 cmpq %rdx, %rsi
202 je .L28
203 cmpb $58, 1(%rax)
204 jne .L28
205 movq %rdx, %rax
206 jmp .L27
207 .p2align 4,,10
208 .p2align 3
209 .L31:
210 leal -97(%r9), %r10d
211 cmpb $5, %r10b
212 ja .L33
213 leal -87(%r9), %r8d
214 jmp .L32
215 .p2align 4,,10
216 .p2align 3
217 .L33:
218 subl $65, %r8d
219 cmpb $5, %r8b
220 jbe .L51
221 .L34:
222 cmpl $58, %r9d
223 jne .L36
224 testq %r12, %r12
225 jne .L37
226 testq %rbp, %rbp
227 jne .L28
228 movq %rax, %rdi
229 movq %r11, %rbp
230 jmp .L35
231 .p2align 4,,10
232 .p2align 3
233 .L37:
234 cmpq %rax, %rsi
235 je .L28
236 leaq 2(%r11), %r8
237 cmpq %r8, %r14
238 jb .L28
239 movzbl %dh, %ebx
240 movb %dl, 1(%r11)
241 movq %rax, %rdi
242 movb %bl, (%r11)
243 xorl %edx, %edx
244 movq %r8, %r11
245 xorl %r12d, %r12d
246 jmp .L29
247 .p2align 4,,10
248 .p2align 3
249 .L51:
250 leal -55(%r9), %r8d
251 jmp .L32
252 .L36:
253 cmpl $46, %r9d
254 jne .L28
255 leaq 4(%r11), %r12
256 cmpq %r12, %r14
257 jb .L28
258 movq %r11, %rdx
259 movq %rcx, 8(%rsp)
260 call inet_pton4
261 testl %eax, %eax
262 movq 8(%rsp), %rcx
263 jg .L39
264 xorl %eax, %eax
265 jmp .L52
266 .L42:
267 movq %r11, %r12
268 jmp .L39
269 .size __inet_pton_length, .-__inet_pton_length
270 .p2align 4,,15
271 .globl __inet_pton
272 .hidden __inet_pton
273 .type __inet_pton, @function
274 __inet_pton:
275 pushq %r12
276 pushq %rbp
277 movq %rdx, %r12
278 pushq %rbx
279 movl %edi, %ebp
280 movq %rsi, %rbx
281 movq %rsi, %rdi
282 call strlen
283 movq %r12, %rcx
284 movq %rbx, %rsi
285 movl %ebp, %edi
286 popq %rbx
287 popq %rbp
288 popq %r12
289 movq %rax, %rdx
290 jmp __inet_pton_length
291 .size __inet_pton, .-__inet_pton
292 .weak inet_pton
293 .hidden inet_pton
294 .set inet_pton,__inet_pton
295 .hidden strlen
296 .hidden memmove