clarify the purpose of this project
[nyanglibc.git] / malloc / dynarray_resize.shared.s
blob9b34d5b2306b3f5bed37cdca5070af0bd13ba1ee
1 .text
2 #APP
3 memmove = __GI_memmove
4 memset = __GI_memset
5 memcpy = __GI_memcpy
6 #NO_APP
7 .p2align 4,,15
8 .globl __GI___libc_dynarray_resize
9 .hidden __GI___libc_dynarray_resize
10 .type __GI___libc_dynarray_resize, @function
11 __GI___libc_dynarray_resize:
12 cmpq %rsi, 8(%rdi)
13 jnb .L23
14 movq %rsi, %rax
15 movq %rdx, %r8
16 mulq %rcx
17 jo .L5
18 pushq %rbp
19 pushq %rbx
20 movq %rdi, %rbp
21 movq %rsi, %rbx
22 subq $24, %rsp
23 movq 16(%rdi), %rdi
24 cmpq %rdi, %r8
25 je .L24
26 movq %rax, %rsi
27 call realloc@PLT
28 testq %rax, %rax
29 movq %rax, %r9
30 je .L10
31 .L9:
32 movq %r9, 16(%rbp)
33 movq %rbx, 8(%rbp)
34 movl $1, %eax
35 movq %rbx, 0(%rbp)
36 .L1:
37 addq $24, %rsp
38 popq %rbx
39 popq %rbp
40 ret
41 .p2align 4,,10
42 .p2align 3
43 .L23:
44 movq %rsi, (%rdi)
45 movl $1, %eax
46 ret
47 .p2align 4,,10
48 .p2align 3
49 .L24:
50 movq %rax, %rdi
51 movq %rcx, 8(%rsp)
52 movq %r8, (%rsp)
53 call malloc@PLT
54 testq %rax, %rax
55 movq %rax, %r9
56 movq (%rsp), %r8
57 movq 8(%rsp), %rcx
58 je .L10
59 testq %r8, %r8
60 je .L9
61 movq 0(%rbp), %rdx
62 movq %r8, %rsi
63 movq %rax, %rdi
64 imulq %rcx, %rdx
65 call __GI_memcpy@PLT
66 movq %rax, %r9
67 jmp .L9
68 .p2align 4,,10
69 .p2align 3
70 .L10:
71 xorl %eax, %eax
72 jmp .L1
73 .L5:
74 movq __libc_errno@gottpoff(%rip), %rax
75 movl $12, %fs:(%rax)
76 xorl %eax, %eax
77 ret
78 .size __GI___libc_dynarray_resize, .-__GI___libc_dynarray_resize
79 .globl __libc_dynarray_resize
80 .set __libc_dynarray_resize,__GI___libc_dynarray_resize