clarify the purpose of this project
[nyanglibc.git] / malloc / dynarray_finalize.s
blob52f248f50f60baa3b3a5bb76f8d3e07ab4bae771
1 .text
2 .p2align 4,,15
3 .globl __libc_dynarray_finalize
4 .hidden __libc_dynarray_finalize
5 .type __libc_dynarray_finalize, @function
6 __libc_dynarray_finalize:
7 cmpq $-1, 8(%rdi)
8 je .L19
9 pushq %r15
10 pushq %r14
11 pushq %r13
12 pushq %r12
13 movq %rsi, %r13
14 pushq %rbp
15 pushq %rbx
16 movq %rcx, %rbp
17 movq %rdi, %rbx
18 subq $8, %rsp
19 movq (%rdi), %r14
20 testq %r14, %r14
21 jne .L4
22 movq 16(%rdi), %rdi
23 cmpq %rsi, %rdi
24 je .L5
25 call free@PLT
26 .L5:
27 movq $0, 0(%rbp)
28 movq $0, 8(%rbp)
29 movl $1, %eax
30 .L1:
31 addq $8, %rsp
32 popq %rbx
33 popq %rbp
34 popq %r12
35 popq %r13
36 popq %r14
37 popq %r15
38 ret
39 .p2align 4,,10
40 .p2align 3
41 .L4:
42 imulq %r14, %rdx
43 movq %rdx, %rdi
44 movq %rdx, %r12
45 call malloc@PLT
46 movq %rax, %r15
47 xorl %eax, %eax
48 testq %r15, %r15
49 je .L1
50 movq 16(%rbx), %rbx
51 testq %rbx, %rbx
52 je .L7
53 movq %r12, %rdx
54 movq %rbx, %rsi
55 movq %r15, %rdi
56 call memcpy@PLT
57 .L7:
58 cmpq %r13, %rbx
59 je .L8
60 movq %rbx, %rdi
61 call free@PLT
62 .L8:
63 movq %r15, 0(%rbp)
64 movq %r14, 8(%rbp)
65 addq $8, %rsp
66 popq %rbx
67 movl $1, %eax
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 .L19:
77 xorl %eax, %eax
78 ret
79 .size __libc_dynarray_finalize, .-__libc_dynarray_finalize