clarify the purpose of this project
[nyanglibc.git] / string / argz-replace.s
blob3c07c8cb504304d33ab5f1186fbbe657ad3c1e3d
1 .text
2 .p2align 4,,15
3 .type str_append, @function
4 str_append:
5 pushq %r15
6 pushq %r14
7 movq %rdx, %r15
8 pushq %r13
9 pushq %r12
10 movq %rcx, %r14
11 pushq %rbp
12 pushq %rbx
13 movq %rdi, %rbx
14 movq %rsi, %rbp
15 subq $8, %rsp
16 movq (%rsi), %r13
17 movq (%rdi), %rdi
18 addq %rcx, %r13
19 leaq 1(%r13), %rsi
20 call realloc@PLT
21 testq %rax, %rax
22 je .L2
23 movq 0(%rbp), %rdi
24 movq %rax, %r12
25 movq %r14, %rdx
26 movq %r15, %rsi
27 addq %rax, %rdi
28 call __mempcpy@PLT
29 movb $0, (%rax)
30 movq %r12, (%rbx)
31 movq %r13, 0(%rbp)
32 addq $8, %rsp
33 popq %rbx
34 popq %rbp
35 popq %r12
36 popq %r13
37 popq %r14
38 popq %r15
39 ret
40 .p2align 4,,10
41 .p2align 3
42 .L2:
43 movq (%rbx), %rdi
44 call free@PLT
45 movq $0, (%rbx)
46 addq $8, %rsp
47 popq %rbx
48 popq %rbp
49 popq %r12
50 popq %r13
51 popq %r14
52 popq %r15
53 ret
54 .size str_append, .-str_append
55 .p2align 4,,15
56 .globl __argz_replace
57 .hidden __argz_replace
58 .type __argz_replace, @function
59 __argz_replace:
60 pushq %r15
61 pushq %r14
62 pushq %r13
63 pushq %r12
64 pushq %rbp
65 pushq %rbx
66 xorl %ebp, %ebp
67 subq $120, %rsp
68 testq %rdx, %rdx
69 je .L6
70 cmpb $0, (%rdx)
71 je .L6
72 movq (%rdi), %rax
73 movq %rcx, %r13
74 movq %rdi, 64(%rsp)
75 movq %rdx, %rdi
76 movq %r8, 48(%rsp)
77 movq %rdx, (%rsp)
78 movq %rsi, 72(%rsp)
79 movq $0, 80(%rsp)
80 leaq 96(%rsp), %r14
81 movq %rax, 8(%rsp)
82 movq (%rsi), %rax
83 xorl %ebx, %ebx
84 movq $0, 88(%rsp)
85 movq %rax, 24(%rsp)
86 call strlen
87 movq %r13, %rdi
88 movq %rax, 40(%rsp)
89 call strlen
90 movq %rax, %r15
91 leaq 88(%rsp), %rax
92 movl $1, 20(%rsp)
93 movq %rax, 56(%rsp)
94 .p2align 4,,10
95 .p2align 3
96 .L8:
97 movq 8(%rsp), %rbp
98 addq 24(%rsp), %rbp
99 .L21:
100 testq %rbx, %rbx
101 je .L23
102 cmpq %rbx, %rbp
103 ja .L54
104 .L24:
105 movl 20(%rsp), %eax
106 xorl %ebp, %ebp
107 testl %eax, %eax
108 je .L55
109 .L6:
110 addq $120, %rsp
111 movl %ebp, %eax
112 popq %rbx
113 popq %rbp
114 popq %r12
115 popq %r13
116 popq %r14
117 popq %r15
119 .p2align 4,,10
120 .p2align 3
121 .L54:
122 movq %rbx, %rdi
123 call strlen@PLT
124 leaq 1(%rbx,%rax), %rbx
125 cmpq %rbx, %rbp
126 jbe .L24
127 .L25:
128 testq %rbx, %rbx
129 je .L24
130 movq (%rsp), %rsi
131 movq %rbx, %rdi
132 call strstr
133 testq %rax, %rax
134 jne .L56
135 movl 20(%rsp), %edx
136 testl %edx, %edx
137 jne .L21
138 leaq 80(%rsp), %r12
139 movq 56(%rsp), %rsi
140 movq %rbx, %rdx
141 movq %r12, %rdi
142 call __argz_add
143 movl %eax, %ebp
144 .L20:
145 testl %ebp, %ebp
146 je .L8
147 cmpq $0, 88(%rsp)
148 je .L6
149 movq 80(%rsp), %rdi
150 call free@PLT
151 jmp .L6
152 .p2align 4,,10
153 .p2align 3
154 .L56:
155 movq 40(%rsp), %rcx
156 movq %rbx, %rdi
157 leaq 104(%rsp), %r12
158 leaq (%rax,%rcx), %rbp
159 subq %rbx, %rax
160 movq %rax, %rsi
161 movq %rax, 96(%rsp)
162 call __strndup
163 movq %rbx, 32(%rsp)
164 movq %rax, 104(%rsp)
165 movq %rbp, %rbx
166 .L10:
167 testq %rbx, %rbx
168 setne %bpl
169 .p2align 4,,10
170 .p2align 3
171 .L11:
172 testq %rax, %rax
173 je .L33
174 testb %bpl, %bpl
175 je .L33
176 movq %r15, %rcx
177 movq %r13, %rdx
178 movq %r14, %rsi
179 movq %r12, %rdi
180 call str_append
181 movq 104(%rsp), %rax
182 testq %rax, %rax
183 je .L11
184 movq (%rsp), %rsi
185 movq %rbx, %rdi
186 call strstr
187 testq %rax, %rax
188 movq %rax, %rbp
189 je .L12
190 movq %rax, %rcx
191 movq %rbx, %rdx
192 movq %r14, %rsi
193 subq %rbx, %rcx
194 movq %r12, %rdi
195 call str_append
196 movq 40(%rsp), %rax
197 leaq 0(%rbp,%rax), %rbx
198 .L13:
199 movq 104(%rsp), %rax
200 jmp .L10
201 .p2align 4,,10
202 .p2align 3
203 .L33:
204 testq %rax, %rax
205 movq 32(%rsp), %rbx
206 movl $12, %ebp
207 je .L16
208 cmpq %rbx, 8(%rsp)
209 leaq 80(%rsp), %r12
210 jnb .L17
211 movl 20(%rsp), %ecx
212 testl %ecx, %ecx
213 jne .L57
214 .L17:
215 movq 56(%rsp), %rsi
216 movq %rax, %rdx
217 movq %r12, %rdi
218 call __argz_add
219 movl %eax, %ebp
220 .L18:
221 movq 104(%rsp), %rdi
222 call free@PLT
223 movl $0, 20(%rsp)
224 .L16:
225 movq 48(%rsp), %rax
226 testq %rax, %rax
227 je .L20
228 addl $1, (%rax)
229 jmp .L20
230 .p2align 4,,10
231 .p2align 3
232 .L23:
233 cmpq $0, 24(%rsp)
234 je .L24
235 movq 8(%rsp), %rbx
236 jmp .L25
237 .p2align 4,,10
238 .p2align 3
239 .L12:
240 movq %rbx, %rdi
241 call strlen
242 movq %rbx, %rdx
243 movq %rax, %rcx
244 movq %r14, %rsi
245 movq %r12, %rdi
246 xorl %ebx, %ebx
247 call str_append
248 jmp .L13
249 .L55:
250 movq 8(%rsp), %rdi
251 xorl %ebp, %ebp
252 call free@PLT
253 movq 80(%rsp), %rax
254 movq 64(%rsp), %rcx
255 movq %rax, (%rcx)
256 movq 88(%rsp), %rax
257 movq 72(%rsp), %rcx
258 movq %rax, (%rcx)
259 jmp .L6
260 .L57:
261 movq 8(%rsp), %rdx
262 movq 56(%rsp), %rsi
263 movq %rbx, %rcx
264 movq %r12, %rdi
265 subq %rdx, %rcx
266 call __argz_append
267 testl %eax, %eax
268 movl %eax, %ebp
269 jne .L18
270 movq 104(%rsp), %rax
271 jmp .L17
272 .size __argz_replace, .-__argz_replace
273 .weak argz_replace
274 .set argz_replace,__argz_replace
275 .hidden __argz_append
276 .hidden __strndup
277 .hidden __argz_add
278 .hidden strstr
279 .hidden strlen