clarify the purpose of this project
[nyanglibc.git] / string / argz-insert.s
blobd4fde9442aa99cf7f4721df2d09c7f6716af6571
1 .text
2 .p2align 4,,15
3 .globl __argz_insert
4 .hidden __argz_insert
5 .type __argz_insert, @function
6 __argz_insert:
7 pushq %r15
8 pushq %r14
9 movq %rsi, %r14
10 pushq %r13
11 pushq %r12
12 movq %rdi, %r12
13 pushq %rbp
14 pushq %rbx
15 subq $40, %rsp
16 testq %rdx, %rdx
17 je .L14
18 movq (%rdi), %rbp
19 movq %rdx, %rbx
20 movl $22, %eax
21 cmpq %rdx, %rbp
22 ja .L1
23 movq (%rsi), %r15
24 leaq 0(%rbp,%r15), %rdx
25 cmpq %rdx, %rbx
26 jnb .L1
27 cmpq %rbx, %rbp
28 jb .L12
29 .L4:
30 movq %rcx, %rdi
31 movq %rcx, 8(%rsp)
32 call strlen
33 leaq 1(%rax), %r13
34 movq %rbp, %rdi
35 leaq (%r15,%r13), %rax
36 movq %rax, %rsi
37 movq %rax, (%rsp)
38 call realloc@PLT
39 movq %rax, %r10
40 movl $12, %eax
41 testq %r10, %r10
42 je .L1
43 movq %rbx, %r9
44 subq (%r12), %r9
45 subq %rbp, %rbx
46 movq %r15, %rdx
47 movq %r10, 24(%rsp)
48 subq %rbx, %rdx
49 addq %r10, %r9
50 leaq (%r9,%r13), %rdi
51 movq %r9, %rsi
52 movq %r9, 16(%rsp)
53 call memmove
54 movq 8(%rsp), %rcx
55 movq 16(%rsp), %r9
56 movq %r13, %rdx
57 movq %rcx, %rsi
58 movq %r9, %rdi
59 call memmove
60 movq (%rsp), %rax
61 movq 24(%rsp), %r10
62 movq %r10, (%r12)
63 movq %rax, (%r14)
64 xorl %eax, %eax
65 .L1:
66 addq $40, %rsp
67 popq %rbx
68 popq %rbp
69 popq %r12
70 popq %r13
71 popq %r14
72 popq %r15
73 ret
74 .p2align 4,,10
75 .p2align 3
76 .L5:
77 subq $1, %rbx
78 .L12:
79 cmpb $0, -1(%rbx)
80 jne .L5
81 jmp .L4
82 .p2align 4,,10
83 .p2align 3
84 .L14:
85 addq $40, %rsp
86 movq %rcx, %rdx
87 popq %rbx
88 popq %rbp
89 popq %r12
90 popq %r13
91 popq %r14
92 popq %r15
93 jmp __argz_add
94 .size __argz_insert, .-__argz_insert
95 .weak argz_insert
96 .set argz_insert,__argz_insert
97 .hidden __argz_add
98 .hidden memmove
99 .hidden strlen