// File: /workspace/github_c_makefile_star2_O2/zhou-yuxin[P]redis-aof-no-cow/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;

	/* The following should have been caught by callers. */
	assert(usize > 0 && usize <= HUGE_MAXCLASS);

	/* Try to avoid moving the allocation. */
	if (!huge_ralloc_no_move(tsd_tsdn(tsd), 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_tsdn(tsd), arena, usize, alignment,
	    zero);
	if (ret == NULL)
		return (NULL);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movq %r8, %r12
movq %rcx, %r13
movq %rdx, %r15
movq %rsi, %r14
movzbl 0x40(%rsp), %ebp
movq %rdi, (%rsp)
movq %rdx, %rsi
movq %rcx, %rdx
movq %r8, %rcx
movl %ebp, %r9d
callq 0x2869c
testb %al, %al
je 0x28d49
leaq 0x2039b(%rip), %rax     # 0x490c8
cmpq %rbx, (%rax)
jae 0x28d51
movq (%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %rbx, %rcx
movl %ebp, %r8d
callq 0x2809e
jmp 0x28d62
movq %r15, %rbx
jmp 0x28e50
movq (%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
movl %ebp, %ecx
callq 0x2808c
movq %rax, %rbx
testq %rax, %rax
je 0x28e4e
cmpq %r13, %r12
cmovaeq %r13, %r12
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xb340
leaq 0x1f79e(%rip), %rax     # 0x48528
cmpq $0x0, (%rax)
jne 0x28e62
leaq 0x20335(%rip), %rax     # 0x490d0
movq (%rax), %rdx
notq %rdx
andq %r15, %rdx
cmpq %r15, %rdx
je 0x28e70
movq 0x48(%rsp), %r12
cmpq $0x3800, %r13           # imm = 0x3800
ja 0x28e7e
testq %r12, %r12
je 0x28ef3
cmpq $0x1000, %r13           # imm = 0x1000
ja 0x28f2c
decq %r13
shrq $0x3, %r13
leaq 0xdbdd(%rip), %rax      # 0x369c0
movzbl (%rax,%r13), %eax
leaq 0x1f733(%rip), %rcx     # 0x48522
movl %eax, %r13d
cmpb $0x1, (%rcx)
je 0x28f39
movq %r13, %rax
shlq $0x5, %rax
leaq (%r12,%rax), %rbp
addq $0x28, %rbp
leaq 0x20667(%rip), %rax     # 0x49478
movq (%rax), %rax
movl 0x10(%rbp), %r8d
cmpl (%rax,%r13,4), %r8d
je 0x28f54
incl %r8d
movl %r8d, 0x10(%rbp)
movq 0x18(%rbp), %rax
shlq $0x3, %r8
negq %r8
movq %r15, (%rax,%r8)
movl 0x18(%r12), %eax
testl %eax, %eax
jle 0x28f11
decl %eax
movl %eax, 0x18(%r12)
jmp 0x28e50
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 %r15, %rsi
callq 0x2af4b
jmp 0x28e50
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x28fb2
jmp 0x28e50
testq %r12, %r12
je 0x28f72
leaq 0x20612(%rip), %rax     # 0x494a0
cmpq %r13, (%rax)
jb 0x28f72
movq %r13, %rdi
callq 0x293ae
movl %eax, %ebp
leaq 0x1f67a(%rip), %rax     # 0x48522
cmpb $0x1, (%rax)
je 0x28f86
movl %ebp, %eax
movq %rax, %rcx
shlq $0x5, %rcx
leaq (%r12,%rcx), %r13
addq $0x28, %r13
leaq 0x205af(%rip), %rcx     # 0x49478
movq (%rcx), %rdx
movl 0x10(%r13), %ecx
cmpl (%rdx,%rax,4), %ecx
je 0x28f96
incl %ecx
movl %ecx, 0x10(%r13)
movq 0x18(%r13), %rax
shlq $0x3, %rcx
negq %rcx
movq %r15, (%rax,%rcx)
jmp 0x28e38
movq %r15, %r8
subq %rdx, %r8
shrq $0xc, %r8
movq (%rdx), %rsi
movq (%rsp), %rdi
movq %r15, %rcx
callq 0x1ca94
jmp 0x28e50
movl 0x1c(%r12), %eax
movl %eax, 0x18(%r12)
movq (%rsp), %rdi
movq %r12, %rsi
callq 0x30129
jmp 0x28e50
movq %r13, %rdi
callq 0x293ae
jmp 0x28de8
movq %r13, %rsi
shlq $0x6, %rsi
addq 0x1f091(%rip), %rsi     # 0x47fd8
movq %r15, %rdi
callq 0x1b8a9
jmp 0x28dfb
shrl %r8d
movq (%rsp), %rdi
movq %r12, %rsi
movq %rbp, %rdx
movl %r13d, %ecx
callq 0x301d3
movl 0x10(%rbp), %r8d
jmp 0x28e22
movq (%rdx), %rsi
movq (%rsp), %rdi
movq %r15, %rcx
callq 0x1cc1f
jmp 0x28e50
movq %r15, %rdi
movq %r13, %rsi
callq 0x1cae2
jmp 0x28eb1
shrl %ecx
movq (%rsp), %rdi
movq %r13, %rsi
movl %ebp, %edx
movq %r12, %r8
callq 0x303be
movl 0x10(%r13), %ecx
jmp 0x28ed9