// File: /workspace/github_c_makefile_star2_O1/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
subq $0x28, %rsp
movq %r9, %r13
movq %r8, %r12
movq %rcx, %rbp
movq %rdx, %rbx
movq %rsi, 0x20(%rsp)
movq %rdi, %r15
movzbl 0x60(%rsp), %r14d
movq %rdx, %rsi
movq %rcx, %rdx
movq %r8, %rcx
movl %r14d, %r9d
callq 0x10980
testb %al, %al
jne 0x10f81
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, 0x18(%rsp)
movq %rbx, 0x10(%rsp)
leaq 0x3c136(%rip), %rax     # 0x4d0c8
movq (%rax), %rax
cmpq %r13, %rax
cmovaq %rax, %r13
movq %r15, 0x8(%rsp)
movq %r15, %rdi
movq 0x20(%rsp), %rsi
movq %r12, %rdx
movq %r13, %rcx
movl %r14d, %r8d
callq 0x102ae
testq %rax, %rax
je 0x110c9
movq %rax, %rbx
movq 0x18(%rsp), %r14
cmpq %r14, %r12
cmovaeq %r14, %r12
movq %rax, %rdi
movq 0x10(%rsp), %r15
movq %r15, %rsi
movq %r12, %rdx
callq 0xb340
leaq 0x3b53f(%rip), %rax     # 0x4c528
cmpq $0x0, (%rax)
jne 0x110d0
leaq 0x3c0d6(%rip), %rax     # 0x4d0d0
movq (%rax), %rdx
notq %rdx
andq %r15, %rdx
cmpq %r15, %rdx
je 0x110e2
movq 0x68(%rsp), %r12
cmpq $0x3800, %r14           # imm = 0x3800
ja 0x110f4
testq %r12, %r12
je 0x11176
cmpq $0x1000, %r14           # imm = 0x1000
ja 0x1119f
decq %r14
shrq $0x3, %r14
leaq 0x2ad7e(%rip), %rax     # 0x3bdc0
movzbl (%rax,%r14), %ebp
leaq 0x3b4d4(%rip), %rax     # 0x4c522
cmpb $0x1, (%rax)
movl %ebp, %r14d
je 0x111ae
movq %r14, %rax
shlq $0x5, %rax
leaq (%r12,%rax), %r13
addq $0x28, %r13
leaq 0x3c408(%rip), %rax     # 0x4d478
movq (%rax), %rax
movl (%rax,%r14,4), %r8d
cmpl %r8d, 0x10(%r13)
je 0x111c9
movl 0x10(%r13), %eax
incl %eax
movl %eax, 0x10(%r13)
movq 0x18(%r13), %rcx
shlq $0x3, %rax
negq %rax
movq %r15, (%rcx,%rax)
movl 0x18(%r12), %eax
testl %eax, %eax
jle 0x11195
leal -0x1(%rax), %ecx
movl %ecx, 0x18(%r12)
testl %eax, %eax
jg 0x10f6f
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x350b5
jmp 0x10f6f
xorl %ebx, %ebx
jmp 0x10f6f
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x30003
jmp 0x10f6f
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x11227
jmp 0x10f6f
testq %r12, %r12
je 0x111e3
leaq 0x3c39c(%rip), %rax     # 0x4d4a0
movq 0x18(%rsp), %rcx
cmpq %rcx, (%rax)
jb 0x111e3
movq 0x18(%rsp), %rdi
callq 0x1146d
movl %eax, %ebp
leaq 0x3b3fd(%rip), %rax     # 0x4c522
cmpb $0x1, (%rax)
je 0x111fa
movl %ebp, %eax
leaq 0x3c341(%rip), %rcx     # 0x4d478
movq (%rcx), %rcx
movl (%rcx,%rax,4), %ecx
shlq $0x5, %rax
leaq (%r12,%rax), %r14
addq $0x28, %r14
cmpl %ecx, 0x10(%r14)
je 0x1120e
movl 0x10(%r14), %eax
incl %eax
movl %eax, 0x10(%r14)
movq 0x18(%r14), %rcx
shlq $0x3, %rax
negq %rax
movq 0x10(%rsp), %rdx
movq %rdx, (%rcx,%rax)
jmp 0x1109a
movq %r15, %r8
subq %rdx, %r8
shrq $0xc, %r8
movq (%rdx), %rsi
movq 0x8(%rsp), %rdi
movq %r15, %rcx
callq 0xdf6b
jmp 0x10f6f
movl 0x1c(%r12), %ecx
jmp 0x110aa
movq %r14, %rdi
callq 0x1146d
movl %eax, %ebp
jmp 0x11047
movq %r14, %rsi
shlq $0x6, %rsi
addq 0x3ae14(%rip), %rsi     # 0x4bfd0
movq %r15, %rdi
callq 0x2343b
jmp 0x1105a
shrl %r8d
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
movl %ebp, %ecx
callq 0x35162
jmp 0x11081
movq (%rdx), %rsi
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rcx
callq 0xdfd3
jmp 0x10f6f
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x2394d
jmp 0x1112e
shrl %ecx
movq 0x8(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
movq %r12, %r8
callq 0x353a2
jmp 0x11153