// File: /workspace/github_c_makefile_star2_O1/erikdubbelboer[P]discnt/deps/jemalloc/src/huge.c
// Function: je_huge_ralloc
void *
huge_ralloc(tsd_t *tsd, arena_t *arena, void *ptr, size_t oldsize, size_t usize,
    size_t alignment, bool zero, tcache_t *tcache)
{
	void *ret;
	size_t copysize;

	/* Try to avoid moving the allocation. */
	if (!huge_ralloc_no_move(ptr, oldsize, usize, usize, zero))
		return (ptr);

	/*
	 * usize and oldsize are different enough that we need to use a
	 * different size class.  In that case, fall back to allocating new
	 * space and copying.
	 */
	ret = huge_ralloc_move_helper(tsd, arena, usize, alignment, zero,
	    tcache);
	if (ret == NULL)
		return (NULL);

	copysize = (usize < oldsize) ? usize : oldsize;
	memcpy(ret, ptr, copysize);
	isqalloc(tsd, ptr, oldsize, tcache);
	return (ret);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movq %r8, %rbp
movq %rcx, %r13
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, (%rsp)
movzbl 0x40(%rsp), %r12d
movq %rdx, %rdi
movq %rcx, %rsi
movq %r8, %rdx
movq %r8, %rcx
movl %r12d, %r8d
callq 0x480f3
testb %al, %al
je 0x4873c
movq 0x48(%rsp), %r9
leaq 0x3c06d(%rip), %rax     # 0x84698
cmpq %rbx, (%rax)
jb 0x48755
movq (%rsp), %rdi
movq %r14, %rsi
movq %rbp, %rdx
movl %r12d, %ecx
movq %r9, %r14
movq %r9, %r8
callq 0x48064
movq %rax, %rbx
testq %rax, %rax
je 0x48741
cmpq %r13, %rbp
cmovaeq %r13, %rbp
movq %rbx, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x12520
leaq 0x3b0c4(%rip), %rax     # 0x83738
cmpq $0x0, (%rax)
jne 0x48772
leaq 0x3c01b(%rip), %rax     # 0x846a0
movq (%rax), %rsi
notq %rsi
andq %r15, %rsi
cmpq %r15, %rsi
je 0x48780
cmpq $0x3800, %r13           # imm = 0x3800
movq %r14, %r9
ja 0x48791
testq %r9, %r9
je 0x48823
cmpq $0x1000, %r13           # imm = 0x1000
ja 0x4883d
decq %r13
shrq $0x3, %r13
leaq 0x11135(%rip), %rax     # 0x59800
movzbl (%rax,%r13), %ebp
leaq 0x3b05b(%rip), %rax     # 0x83732
cmpb $0x1, (%rax)
movl %ebp, %r12d
je 0x48852
movq %r12, %rax
shlq $0x5, %rax
leaq (%r9,%rax), %r14
addq $0x20, %r14
leaq 0x3c6a7(%rip), %rax     # 0x84da0
movq (%rax), %rax
movl (%rax,%r12,4), %r8d
cmpl %r8d, 0x10(%r14)
je 0x48874
movq 0x18(%r14), %rax
movl 0x10(%r14), %ecx
movq %r15, (%rax,%rcx,8)
leal 0x1(%rcx), %eax
movl %eax, 0x10(%r14)
movl 0x18(%r9), %eax
incl %eax
movl %eax, 0x18(%r9)
cmpl $0xe4, %eax
jne 0x48743
movq (%rsp), %rdi
movq %r9, %rsi
callq 0x4e7cd
jmp 0x48743
movq %r15, %rbx
jmp 0x48743
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rsp), %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
movl %r12d, %r8d
movq %r9, %r14
callq 0x14d1b
jmp 0x4864c
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x4aed0
jmp 0x48743
movq (%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x488cb
jmp 0x48743
testq %r9, %r9
je 0x48893
leaq 0x3c62f(%rip), %rax     # 0x84dd0
cmpq %r13, (%rax)
jb 0x48893
movq %r9, %r12
movq %r13, %rdi
callq 0x48d7b
movl %eax, %ebp
leaq 0x3af74(%rip), %rax     # 0x83732
cmpb $0x1, (%rax)
je 0x488a3
movl %ebp, %eax
leaq 0x3c5d0(%rip), %rcx     # 0x84da0
movq (%rcx), %rcx
movl (%rcx,%rax,4), %ecx
shlq $0x5, %rax
movq %r12, %r8
leaq (%r12,%rax), %r14
addq $0x20, %r14
cmpl %ecx, 0x10(%r14)
je 0x488b3
movq 0x18(%r14), %rax
movl 0x10(%r14), %ecx
movq %r15, (%rax,%rcx,8)
leal 0x1(%rcx), %eax
movl %eax, 0x10(%r14)
movl 0x18(%r8), %eax
incl %eax
movl %eax, 0x18(%r8)
cmpl $0xe4, %eax
jne 0x48743
movq (%rsp), %rdi
movq %r12, %rsi
jmp 0x48735
movq %r15, %rcx
subq %rsi, %rcx
shrq $0xc, %rcx
movq (%rsi), %rdi
movq %r15, %rdx
callq 0x3b9e8
jmp 0x48743
movq %r13, %rdi
movq %r9, %r14
callq 0x48d7b
movq %r14, %r9
movl %eax, %ebp
jmp 0x486d0
leaq (%r12,%r12,2), %rsi
shlq $0x5, %rsi
addq 0x25767(%rip), %rsi     # 0x6dfc8
movq %r15, %rdi
movq %r9, %r14
callq 0x3b00b
movq %r14, %r9
jmp 0x486e3
shrl %r8d
movq (%rsp), %rdi
movq %r9, %rsi
movq %r14, %rdx
movl %ebp, %ecx
movq %r9, %r12
callq 0x4e87e
movq %r12, %r9
jmp 0x4870a
movq (%rsi), %rdi
movq %r15, %rdx
callq 0x3bb14
jmp 0x48743
movq %r15, %rdi
movq %r13, %rsi
callq 0x3b9ed
jmp 0x487c7
shrl %ecx
movq (%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x4ea32
movq %r12, %r8
jmp 0x487ef