// File: /workspace/github_c_makefile_star2_O3/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 0x101d6
testb %al, %al
jne 0x1078b
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 0x3c92c(%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 0xfbbb
testq %rax, %rax
je 0x108ba
movq %rax, %rbx
movq 0x18(%rsp), %r15
cmpq %r15, %r12
cmovaeq %r15, %r12
movq %rax, %rdi
movq 0x10(%rsp), %r14
movq %r14, %rsi
movq %r12, %rdx
callq 0xb340
leaq 0x3bd35(%rip), %rax     # 0x4c528
cmpq $0x0, (%rax)
jne 0x108c1
leaq 0x3c8cc(%rip), %rax     # 0x4d0d0
movq (%rax), %rdx
notq %rdx
andq %r14, %rdx
cmpq %r14, %rdx
je 0x108d3
movq 0x68(%rsp), %r12
cmpq $0x3800, %r15           # imm = 0x3800
ja 0x108e5
testq %r12, %r12
je 0x10966
cmpq $0x1000, %r15           # imm = 0x1000
ja 0x109a1
decq %r15
shrq $0x3, %r15
leaq 0x2b5f4(%rip), %rax     # 0x3be40
movzbl (%rax,%r15), %eax
leaq 0x3bcca(%rip), %rcx     # 0x4c522
movl %eax, %r13d
cmpb $0x1, (%rcx)
je 0x109ae
movq %r13, %rax
shlq $0x5, %rax
leaq (%r12,%rax), %rbp
addq $0x28, %rbp
leaq 0x3cbfe(%rip), %rax     # 0x4d478
movq (%rax), %rax
movl 0x10(%rbp), %r8d
cmpl (%rax,%r13,4), %r8d
je 0x109c9
incl %r8d
movl %r8d, 0x10(%rbp)
movq 0x18(%rbp), %rax
shlq $0x3, %r8
negq %r8
movq %r14, (%rax,%r8)
movl 0x18(%r12), %eax
testl %eax, %eax
jle 0x10985
decl %eax
movl %eax, 0x18(%r12)
jmp 0x10779
xorl %ebx, %ebx
jmp 0x10779
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x2fdfa
jmp 0x10779
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x10a30
jmp 0x10779
testq %r12, %r12
je 0x109e8
leaq 0x3cbab(%rip), %rax     # 0x4d4a0
movq 0x18(%rsp), %rcx
cmpq %rcx, (%rax)
jb 0x109e8
movq 0x18(%rsp), %rdi
callq 0x10c42
movl %eax, %ebp
leaq 0x3bc0c(%rip), %rax     # 0x4c522
cmpb $0x1, (%rax)
je 0x109ff
movl %ebp, %eax
movq %rax, %rcx
shlq $0x5, %rcx
leaq (%r12,%rcx), %r13
addq $0x28, %r13
leaq 0x3cb41(%rip), %rcx     # 0x4d478
movq (%rcx), %rdx
movl 0x10(%r13), %ecx
cmpl (%rdx,%rax,4), %ecx
je 0x10a13
incl %ecx
movl %ecx, 0x10(%r13)
movq 0x18(%r13), %rax
shlq $0x3, %rcx
negq %rcx
movq 0x10(%rsp), %rdx
movq %rdx, (%rax,%rcx)
jmp 0x108a1
movq %r14, %r8
subq %rdx, %r8
shrq $0xc, %r8
movq (%rdx), %rsi
movq 0x8(%rsp), %rdi
movq %r14, %rcx
callq 0xd9f4
jmp 0x10779
movl 0x1c(%r12), %eax
movl %eax, 0x18(%r12)
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x35571
jmp 0x10779
movq %r15, %rdi
callq 0x10c42
jmp 0x10851
movq %r13, %rsi
shlq $0x6, %rsi
addq 0x3b614(%rip), %rsi     # 0x4bfd0
movq %r14, %rdi
callq 0x2333e
jmp 0x10864
shrl %r8d
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %rbp, %rdx
movl %r13d, %ecx
callq 0x3561b
movl 0x10(%rbp), %r8d
jmp 0x1088b
movq (%rdx), %rsi
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rcx
callq 0xda57
jmp 0x10779
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x23843
jmp 0x1091f
shrl %ecx
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movl %ebp, %edx
movq %r12, %r8
callq 0x35853
movl 0x10(%r13), %ecx
jmp 0x10947