// File: /workspace/github_c_makefile_star2_O2/zhou-yuxin[P]redis-aof-no-cow/deps/jemalloc/src/arena.c
// Function: je_arena_ralloc
void *
arena_ralloc(tsd_t *tsd, arena_t *arena, void *ptr, size_t oldsize, size_t size,
    size_t alignment, bool zero, tcache_t *tcache)
{
	void *ret;
	size_t usize;

	usize = s2u(size);
	if (unlikely(usize == 0 || size > HUGE_MAXCLASS))
		return (NULL);

	if (likely(usize <= large_maxclass)) {
		size_t copysize;

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

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

		/*
		 * Junk/zero-filling were already done by
		 * ipalloc()/arena_malloc().
		 */

		copysize = (usize < oldsize) ? usize : oldsize;
		JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(ret, copysize);
		memcpy(ret, ptr, copysize);
		isqalloc(tsd, ptr, oldsize, tcache, true);
	} else {
		ret = huge_ralloc(tsd, arena, ptr, oldsize, usize, alignment,
		    zero, tcache);
	}
	return (ret);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %rbx
movq %rcx, %r12
movq %rdx, %rbp
movq 0x78(%rsp), %rdx
movb 0x70(%rsp), %r14b
cmpq $0x1000, %r8            # imm = 0x1000
ja 0x1d842
decq %r8
shrq $0x3, %r8
leaq 0x1953b(%rip), %rax     # 0x369c0
movzbl (%rax,%r8), %eax
leaq 0x18daf(%rip), %rcx     # 0x36240
movq (%rcx,%rax,8), %r13
testq %r13, %r13
je 0x1dc6b
cmpq 0x2bafb(%rip), %r13     # 0x48fa0
ja 0x1d888
movq %rsi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movzbl %r14b, %r15d
movq %rdi, 0x8(%rsp)
movq %rbp, %rsi
movq %r12, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
movl %r15d, %r9d
callq 0x1cc9f
testb %al, %al
je 0x1dc6d
movq %rbp, (%rsp)
testq %rbx, %rbx
je 0x1d679
cmpq $0xfff, %rbx            # imm = 0xFFF
ja 0x1d53f
cmpq $0x3800, %r13           # imm = 0x3800
ja 0x1d53f
leaq (%rbx,%r13), %rcx
decq %rcx
movq %rbx, %rax
negq %rax
andq %rcx, %rax
cmpq $0x1000, %rax           # imm = 0x1000
ja 0x1db97
decq %rax
shrq $0x3, %rax
leaq 0x1949d(%rip), %rcx     # 0x369c0
movzbl (%rcx,%rax), %eax
leaq 0x18d12(%rip), %rcx     # 0x36240
movq (%rcx,%rax,8), %rdx
cmpq $0x4000, %rdx           # imm = 0x4000
jb 0x1d636
leaq 0x2bb82(%rip), %rax     # 0x490c8
movq (%rax), %rsi
movq %rbx, %rax
cmpq %r13, 0x2ba4d(%rip)     # 0x48fa0
jb 0x1d5c6
movq %rbx, %rax
cmpq %rbx, %rsi
jbe 0x1d5c6
leaq 0xfff(%rbx), %rax
andq $-0x1000, %rax          # imm = 0xF000
movl $0x4000, %edx           # imm = 0x4000
cmpq $0x4001, %r13           # imm = 0x4001
jb 0x1d5b9
movabsq $0x7000000000000000, %rcx # imm = 0x7000000000000000
cmpq %rcx, %r13
ja 0x1dbdb
leaq -0x1(,%r13,2), %rcx
bsrq %rcx, %rdi
movl %edi, %ecx
addb $-0x3, %cl
pushq $-0x1
popq %rdx
shlq %cl, %rdx
cmpl $0x6, %edi
notq %rdx
pushq $0x7
popq %rcx
cmovbq %rcx, %rdx
leaq (%rdx,%r13), %rcx
notq %rdx
andq %rcx, %rdx
leaq (%rdx,%rax), %rcx
cmpq 0x2ba0c(%rip), %rcx     # 0x48fd0
jbe 0x1d636
movabsq $0x7000000000000000, %rcx # imm = 0x7000000000000000
cmpq %rcx, %rax
ja 0x1dc6b
leaq 0x2baf0(%rip), %rcx     # 0x490d0
movq (%rcx), %rdx
cmpq %r13, %rsi
jae 0x1d61c
cmpq $0x1000, %r13           # imm = 0x1000
ja 0x1dbe2
leaq -0x1(%r13), %rcx
shrq $0x3, %rcx
leaq 0x193bc(%rip), %rsi     # 0x369c0
movzbl (%rsi,%rcx), %ecx
leaq 0x18c31(%rip), %rsi     # 0x36240
movq (%rsi,%rcx,8), %rsi
cmpq %r13, %rsi
jb 0x1dc6b
addq %rdx, %rax
notq %rdx
andq %rax, %rdx
movl $0xfff, %eax            # imm = 0xFFF
subq %rdx, %rax
xorl %edx, %edx
cmpq %rsi, %rax
cmovaeq %rsi, %rdx
movabsq $-0x7000000000000001, %rax # imm = 0x8FFFFFFFFFFFFFFF
leaq (%rdx,%rax), %rcx
incq %rax
cmpq %rax, %rcx
jb 0x1dc6b
movq 0x8(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq %rbx, %rcx
movl %r15d, %r8d
movq 0x18(%rsp), %r15
movq %r15, %r9
callq 0x1be89
movq %rax, %rbp
movq (%rsp), %rsi
jmp 0x1d743
cmpq $0x1000, %r13           # imm = 0x1000
movq (%rsp), %rsi
ja 0x1d9fc
leaq -0x1(%r13), %rax
shrq $0x3, %rax
leaq 0x19327(%rip), %rcx     # 0x369c0
movzbl (%rcx,%rax), %ecx
cmpq $0x0, 0x18(%rsp)
je 0x1dab3
movl %ecx, %r8d
cmpq $0x3800, %r13           # imm = 0x3800
ja 0x1da0f
movq %r8, %rax
shlq $0x5, %rax
movq 0x18(%rsp), %r15
leaq (%r15,%rax), %rbx
addq $0x28, %rbx
movl 0x10(%rbx), %eax
testq %rax, %rax
je 0x1daf3
movq 0x18(%rbx), %rcx
movq %rax, %rdx
shlq $0x3, %rdx
negq %rdx
movq (%rcx,%rdx), %rbp
decl %eax
movl %eax, 0x10(%rbx)
cmpl 0x8(%rbx), %eax
jl 0x1db64
leaq 0x18b40(%rip), %rax     # 0x36240
movq (%rax,%r8,8), %rdx
leaq 0x2ae16(%rip), %rax     # 0x48521
movb (%rax), %al
testb %r14b, %r14b
jne 0x1db55
testb %al, %al
jne 0x1db6c
leaq 0x2ae0e(%rip), %rax     # 0x48533
cmpb $0x1, (%rax)
je 0x1db5d
incq (%rbx)
movl 0x18(%r15), %eax
testl %eax, %eax
jle 0x1dad9
decl %eax
movl %eax, 0x18(%r15)
testq %rbp, %rbp
je 0x1dc6b
cmpq %r12, %r13
cmovaeq %r12, %r13
leaq 0x2ae42(%rip), %rax     # 0x4859c
cmpb $0x1, (%rax)
je 0x1d8a7
movq %rbp, %rdi
movq %r13, %rdx
movq %rsi, %rbx
callq 0xb340
leaq 0x2adb0(%rip), %rax     # 0x48528
cmpq $0x0, (%rax)
jne 0x1d8bb
leaq 0x2b947(%rip), %rax     # 0x490d0
movq (%rax), %rdx
notq %rdx
andq %rbx, %rdx
cmpq %rbx, %rdx
movq %rbx, %rcx
je 0x1d8cd
cmpq $0x3800, %r12           # imm = 0x3800
ja 0x1d8df
testq %r15, %r15
je 0x1d970
cmpq $0x1000, %r12           # imm = 0x1000
ja 0x1d98c
decq %r12
shrq $0x3, %r12
leaq 0x191f1(%rip), %rax     # 0x369c0
movzbl (%rax,%r12), %eax
leaq 0x2ad47(%rip), %rdx     # 0x48522
movl %eax, %ebx
cmpb $0x1, (%rdx)
movq 0x8(%rsp), %rdi
je 0x1d99d
movq %rbx, %rax
shlq $0x5, %rax
leaq (%r15,%rax), %r12
addq $0x28, %r12
leaq 0x2bc77(%rip), %rax     # 0x49478
movq (%rax), %rax
movl 0x10(%r12), %r8d
cmpl (%rax,%rbx,4), %r8d
je 0x1d9c4
incl %r8d
movl %r8d, 0x10(%r12)
movq 0x18(%r12), %rax
shlq $0x3, %r8
negq %r8
movq %rcx, (%rax,%r8)
movl 0x18(%r15), %eax
testl %eax, %eax
jle 0x1d9e2
decl %eax
movl %eax, 0x18(%r15)
jmp 0x1dc6d
movabsq $0x7000000000000000, %rax # imm = 0x7000000000000000
cmpq %rax, %r8
ja 0x1dc6b
leaq -0x1(,%r8,2), %rax
bsrq %rax, %rax
movl %eax, %ecx
addb $-0x3, %cl
pushq $-0x1
popq %r13
shlq %cl, %r13
cmpl $0x6, %eax
notq %r13
pushq $0x7
popq %rax
cmovbq %rax, %r13
addq %r13, %r8
notq %r13
andq %r8, %r13
jmp 0x1d495
movq %rbp, %rdx
movq %r12, %rcx
movq %r13, %r8
movq %rbx, %r9
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x28cee
movq %rbp, %rdi
movq %r13, %rsi
callq 0x32496
movq (%rsp), %rsi
jmp 0x1d763
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x2af4b
jmp 0x1dc6d
movq 0x8(%rsp), %rdi
movq %rcx, %rsi
callq 0x28fb2
jmp 0x1dc6d
testq %r15, %r15
je 0x1dbc9
leaq 0x2bbb1(%rip), %rax     # 0x494a0
cmpq %r12, (%rax)
jb 0x1dbc9
movq %r12, %rdi
callq 0x20acc
movl %eax, %ebx
leaq 0x2ac19(%rip), %rax     # 0x48522
cmpb $0x1, (%rax)
je 0x1dcf0
movl %ebx, %eax
movq %rax, %rcx
shlq $0x5, %rcx
leaq (%r15,%rcx), %r12
addq $0x28, %r12
leaq 0x2bb4e(%rip), %rcx     # 0x49478
movq (%rcx), %rdx
movl 0x10(%r12), %ecx
cmpl (%rdx,%rax,4), %ecx
je 0x1dd04
incl %ecx
movl %ecx, 0x10(%r12)
movq 0x18(%r12), %rax
shlq $0x3, %rcx
negq %rcx
movq (%rsp), %rdx
movq %rdx, (%rax,%rcx)
movq 0x18(%rsp), %rsi
movl 0x18(%rsi), %eax
testl %eax, %eax
jle 0x1dd24
decl %eax
movl %eax, 0x18(%rsi)
jmp 0x1dc6d
movq %rcx, %r8
subq %rdx, %r8
shrq $0xc, %r8
movq (%rdx), %rsi
movq 0x8(%rsp), %rdi
callq 0x1ca94
jmp 0x1dc6d
movq %r12, %rdi
callq 0x20acc
movq (%rsp), %rcx
jmp 0x1d7d4
movq %rbx, %rax
shlq $0x6, %rax
leaq 0x2ac35(%rip), %rsi     # 0x485e0
addq %rax, %rsi
movq %rcx, %rdi
callq 0x1b8a9
movq (%rsp), %rcx
movq 0x8(%rsp), %rdi
jmp 0x1d7eb
shrl %r8d
movq %r15, %rsi
movq %r12, %rdx
movl %ebx, %ecx
callq 0x301d3
movq (%rsp), %rcx
movl 0x10(%r12), %r8d
jmp 0x1d813
movl 0x1c(%r15), %eax
movl %eax, 0x18(%r15)
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x30129
jmp 0x1dc6d
movq %r13, %rdi
callq 0x20acc
movq (%rsp), %rsi
movl %eax, %ecx
jmp 0x1d69d
leaq 0x2ba8a(%rip), %rax     # 0x494a0
cmpq %r13, (%rax)
jb 0x1dab3
movl %ecx, %ebp
movq %r8, %rax
shlq $0x5, %rax
movq 0x18(%rsp), %rcx
leaq (%rcx,%rax), %rbx
addq $0x28, %rbx
movl 0x10(%rbx), %eax
testq %rax, %rax
je 0x1dc35
movq %r8, %rsi
movq 0x18(%rbx), %rcx
movq %rax, %rdx
shlq $0x3, %rdx
negq %rdx
movq (%rcx,%rdx), %rbp
decl %eax
movl %eax, 0x10(%rbx)
cmpl 0x8(%rbx), %eax
jl 0x1dcd6
leaq 0x187d5(%rip), %rax     # 0x36240
movq (%rax,%rsi,8), %rdx
testb %r14b, %r14b
jne 0x1dc2b
leaq 0x2aaa2(%rip), %rax     # 0x48521
cmpb $0x1, (%rax)
je 0x1dcde
leaq 0x2aaa4(%rip), %rax     # 0x48533
cmpb $0x1, (%rax)
je 0x1dc2b
incq (%rbx)
movq 0x18(%rsp), %r15
movl 0x18(%r15), %eax
testl %eax, %eax
jle 0x1dad9
decl %eax
movl %eax, 0x18(%r15)
jmp 0x1d670
movq 0x8(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq %r13, %rdx
movl %r15d, %r8d
callq 0x1bc0d
movq (%rsp), %rsi
movq %rax, %rbp
movq 0x18(%rsp), %r15
jmp 0x1d743
movl 0x1c(%r15), %eax
movl %eax, 0x18(%r15)
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x30129
jmp 0x1d670
movl %ecx, 0x28(%rsp)
movq %r8, 0x30(%rsp)
orl $-0x1, 0x8(%rbx)
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
movq 0x20(%rsp), %rsi
callq 0x1be70
testq %rax, %rax
je 0x1dc6b
leaq 0x17(%rsp), %r9
movq %rbp, %rdi
movq %rax, %rsi
movq %r15, %rdx
movq %rbx, %rcx
movl 0x28(%rsp), %r8d
callq 0x30591
movq %rax, %rbp
leaq 0x17(%rsp), %rax
cmpb $0x0, (%rax)
je 0x1dc6b
movq (%rsp), %rsi
movq 0x30(%rsp), %r8
jmp 0x1d6f9
testb %al, %al
jne 0x1dc7f
movq %rbp, %rdi
xorl %esi, %esi
jmp 0x1db89
movl %eax, 0x8(%rbx)
jmp 0x1d6f9
shlq $0x6, %r8
leaq 0x2aa69(%rip), %rax     # 0x485e0
movq %rbp, %rdi
subq 0x8(%r8,%rax), %rdi
movq 0x10(%r8,%rax), %rdx
movl $0xa5, %esi
callq 0xb230
movq (%rsp), %rsi
jmp 0x1d72e
leaq -0x1(,%rax,2), %rcx
bsrq %rcx, %rsi
movl %esi, %ecx
addb $-0x3, %cl
pushq $-0x1
popq %rdx
shlq %cl, %rdx
cmpl $0x6, %esi
notq %rdx
pushq $0x7
popq %rcx
cmovbq %rcx, %rdx
addq %rdx, %rax
notq %rdx
andq %rax, %rdx
jmp 0x1d532
movq (%rdx), %rsi
movq 0x8(%rsp), %rdi
callq 0x1cc1f
jmp 0x1dc6d
xorl %edx, %edx
jmp 0x1d5b9
movabsq $0x7000000000000000, %rcx # imm = 0x7000000000000000
cmpq %rcx, %r13
ja 0x1dd34
leaq -0x1(,%r13,2), %rcx
bsrq %rcx, %rsi
movl %esi, %ecx
addb $-0x3, %cl
pushq $-0x1
popq %rdi
shlq %cl, %rdi
cmpl $0x6, %esi
notq %rdi
pushq $0x7
popq %rcx
cmovbq %rcx, %rdi
leaq (%rdi,%r13), %rcx
notq %rdi
andq %rcx, %rdi
movq %rdi, %rsi
jmp 0x1d613
movq %rbp, %rdi
xorl %esi, %esi
jmp 0x1dce6
orl $-0x1, 0x8(%rbx)
movq 0x8(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x1be70
testq %rax, %rax
je 0x1dc6b
movq 0x8(%rsp), %rdi
movq %rax, %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0x1b9d9
movq %rax, %rbp
testq %rax, %rax
jne 0x1da9b
xorl %ebp, %ebp
movq %rbp, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r8, %r14
shlq $0x6, %r14
leaq 0x2a953(%rip), %rax     # 0x485e0
movq 0x8(%r14,%rax), %rax
movq %rax, 0x28(%rsp)
movq %rbp, %rdi
subq %rax, %rdi
movl $0xa5, %esi
movq %rdx, 0x20(%rsp)
movq %rax, %rdx
callq 0xb230
leaq 0x2a92a(%rip), %rax     # 0x485e0
movq (%r14,%rax), %rdi
addq %rbp, %rdi
movl $0xa5, %esi
movq 0x28(%rsp), %rdx
callq 0xb230
movq 0x20(%rsp), %rdx
jmp 0x1db5d
movl %eax, 0x8(%rbx)
jmp 0x1da64
movq %rbp, %rdi
movl $0xa5, %esi
callq 0xb230
jmp 0x1da98
pushq $0x5a
popq %rsi
movq (%rsp), %rdi
movq %r12, %rdx
callq 0xb230
jmp 0x1d912
shrl %ecx
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movl %ebx, %edx
movq 0x18(%rsp), %r8
callq 0x303be
movl 0x10(%r12), %ecx
jmp 0x1d93b
movl 0x1c(%rsi), %eax
movl %eax, 0x18(%rsi)
movq 0x8(%rsp), %rdi
jmp 0x1d9f2
xorl %esi, %esi
jmp 0x1d613