// File: /workspace/github_c_makefile_star2_O3/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, %r15
movq %rcx, %r12
movq %rdx, %rbp
movq 0x78(%rsp), %rax
movq %rax, 0x20(%rsp)
movb 0x70(%rsp), %r14b
cmpq $0x1000, %r8            # imm = 0x1000
ja 0xe685
decq %r8
shrq $0x3, %r8
leaq 0x2db7e(%rip), %rax     # 0x3be40
movzbl (%rax,%r8), %eax
leaq 0x2d3f2(%rip), %rcx     # 0x3b6c0
movq (%rcx,%rax,8), %r13
testq %r13, %r13
je 0xeb96
cmpq 0x3ecbe(%rip), %r13     # 0x4cfa0
ja 0xe6cb
movq %rsi, 0x28(%rsp)
movzbl %r14b, %ebx
movq %rdi, 0x8(%rsp)
movq %rbp, %rsi
movq %r12, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
movl %ebx, %r9d
callq 0xdaec
testb %al, %al
je 0xeb98
movq %rbp, 0x10(%rsp)
testq %r15, %r15
je 0xe4b3
cmpq $0xfff, %r15            # imm = 0xFFF
ja 0xe378
cmpq $0x3800, %r13           # imm = 0x3800
ja 0xe378
leaq (%r15,%r13), %rcx
decq %rcx
movq %r15, %rax
negq %rax
andq %rcx, %rax
cmpq $0x1000, %rax           # imm = 0x1000
ja 0xe9f4
decq %rax
shrq $0x3, %rax
leaq 0x2dae4(%rip), %rcx     # 0x3be40
movzbl (%rcx,%rax), %eax
leaq 0x2d359(%rip), %rcx     # 0x3b6c0
movq (%rcx,%rax,8), %rdx
cmpq $0x4000, %rdx           # imm = 0x4000
jb 0xe46f
leaq 0x3ed49(%rip), %rax     # 0x4d0c8
movq (%rax), %rsi
movq %r15, %rax
cmpq %r13, 0x3ec14(%rip)     # 0x4cfa0
jb 0xe3ff
movq %r15, %rax
cmpq %r15, %rsi
jbe 0xe3ff
leaq 0xfff(%r15), %rax
andq $-0x1000, %rax          # imm = 0xF000
movl $0x4000, %edx           # imm = 0x4000
cmpq $0x4001, %r13           # imm = 0x4001
jb 0xe3f2
movabsq $0x7000000000000000, %rcx # imm = 0x7000000000000000
cmpq %rcx, %r13
ja 0xea38
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 0x3ebd3(%rip), %rcx     # 0x4cfd0
jbe 0xe46f
movabsq $0x7000000000000000, %rcx # imm = 0x7000000000000000
cmpq %rcx, %rax
ja 0xeb96
leaq 0x3ecb7(%rip), %rcx     # 0x4d0d0
movq (%rcx), %rdx
cmpq %r13, %rsi
jae 0xe455
cmpq $0x1000, %r13           # imm = 0x1000
ja 0xea3f
leaq -0x1(%r13), %rcx
shrq $0x3, %rcx
leaq 0x2da03(%rip), %rsi     # 0x3be40
movzbl (%rsi,%rcx), %ecx
leaq 0x2d278(%rip), %rsi     # 0x3b6c0
movq (%rsi,%rcx,8), %rsi
cmpq %r13, %rsi
jb 0xeb96
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 0xeb96
movq 0x8(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %r15, %rcx
movl %ebx, %r8d
movq 0x20(%rsp), %r14
movq %r14, %r9
callq 0xcfd4
movq %rax, %rbp
movq 0x10(%rsp), %rsi
jmp 0xe586
cmpq $0x1000, %r13           # imm = 0x1000
movq 0x10(%rsp), %rsi
ja 0xe864
leaq -0x1(%r13), %rax
shrq $0x3, %rax
leaq 0x2d96c(%rip), %rcx     # 0x3be40
movzbl (%rcx,%rax), %r8d
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0xe920
movl %r8d, %r15d
cmpq $0x3800, %r13           # imm = 0x3800
ja 0xe879
movq %r15, %rax
shlq $0x5, %rax
movq 0x20(%rsp), %rcx
leaq (%rcx,%rax), %rbx
addq $0x28, %rbx
movl 0x10(%rbx), %eax
testq %rax, %rax
je 0xe964
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 0xe9c0
leaq 0x2d182(%rip), %rax     # 0x3b6c0
movq (%rax,%r15,8), %rdx
leaq 0x3dfd8(%rip), %rax     # 0x4c521
movb (%rax), %al
testb %r14b, %r14b
jne 0xe9b1
testb %al, %al
jne 0xe9c8
leaq 0x3dfd0(%rip), %rax     # 0x4c533
cmpb $0x1, (%rax)
je 0xe9b9
incq (%rbx)
movq 0x20(%rsp), %r14
movl 0x18(%r14), %eax
testl %eax, %eax
jle 0xe94a
decl %eax
movl %eax, 0x18(%r14)
testq %rbp, %rbp
je 0xeb96
cmpq %r12, %r13
cmovaeq %r12, %r13
leaq 0x3dfff(%rip), %rax     # 0x4c59c
cmpb $0x1, (%rax)
je 0xe6ea
movq %rbp, %rdi
movq %r13, %rdx
movq %rsi, %rbx
callq 0xb340
leaq 0x3df6d(%rip), %rax     # 0x4c528
cmpq $0x0, (%rax)
jne 0xe6ff
leaq 0x3eb04(%rip), %rax     # 0x4d0d0
movq (%rax), %rdx
notq %rdx
andq %rbx, %rdx
cmpq %rbx, %rdx
movq %rbx, %rcx
je 0xe711
cmpq $0x3800, %r12           # imm = 0x3800
ja 0xe723
testq %r14, %r14
je 0xe7b5
cmpq $0x1000, %r12           # imm = 0x1000
ja 0xe7d1
decq %r12
shrq $0x3, %r12
leaq 0x2d82e(%rip), %rax     # 0x3be40
movzbl (%rax,%r12), %eax
leaq 0x3df04(%rip), %rdx     # 0x4c522
movl %eax, %ebx
cmpb $0x1, (%rdx)
movq 0x8(%rsp), %rdi
je 0xe7e3
movq %rbx, %rax
shlq $0x5, %rax
leaq (%r14,%rax), %r12
addq $0x28, %r12
leaq 0x3ee34(%rip), %rax     # 0x4d478
movq (%rax), %rax
movl 0x10(%r12), %r8d
cmpl (%rax,%rbx,4), %r8d
je 0xe82b
incl %r8d
movl %r8d, 0x10(%r12)
movq 0x18(%r12), %rax
shlq $0x3, %r8
negq %r8
movq %rcx, (%rax,%r8)
movl 0x18(%r14), %eax
testl %eax, %eax
jle 0xe84a
decl %eax
movl %eax, 0x18(%r14)
jmp 0xeb98
movabsq $0x7000000000000000, %rax # imm = 0x7000000000000000
cmpq %rax, %r8
ja 0xeb96
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 0xe2d2
movq %rbp, %rdx
movq %r12, %rcx
movq %r13, %r8
movq %r15, %r9
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1073c
movq %rbp, %rdi
movq %r13, %rsi
callq 0x376c2
movq 0x10(%rsp), %rsi
jmp 0xe5a6
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x2fdfa
jmp 0xeb98
movq 0x8(%rsp), %rdi
movq %rcx, %rsi
callq 0x10a30
jmp 0xeb98
testq %r14, %r14
je 0xea26
leaq 0x3ed6d(%rip), %rax     # 0x4d4a0
cmpq %r12, (%rax)
jb 0xea26
movq %r12, %rdi
callq 0xf6d1
movl %eax, %ebx
leaq 0x3ddd5(%rip), %rax     # 0x4c522
cmpb $0x1, (%rax)
je 0xeb42
movl %ebx, %eax
movq %rax, %rcx
shlq $0x5, %rcx
leaq (%r14,%rcx), %r12
addq $0x28, %r12
leaq 0x3ed0a(%rip), %rcx     # 0x4d478
movq (%rcx), %rdx
movl 0x10(%r12), %ecx
cmpl (%rdx,%rax,4), %ecx
je 0xeb57
incl %ecx
movl %ecx, 0x10(%r12)
movq 0x18(%r12), %rax
shlq $0x3, %rcx
negq %rcx
movq 0x10(%rsp), %rdx
movq %rdx, (%rax,%rcx)
movq 0x20(%rsp), %rsi
movl 0x18(%rsi), %eax
testl %eax, %eax
jle 0xeb77
decl %eax
movl %eax, 0x18(%rsi)
jmp 0xeb98
movq %rcx, %r8
subq %rdx, %r8
shrq $0xc, %r8
movq (%rdx), %rsi
movq 0x8(%rsp), %rdi
callq 0xd9f4
jmp 0xeb98
movq %r12, %rdi
callq 0xf6d1
movq 0x10(%rsp), %rcx
jmp 0xe617
movq %rbx, %r14
shlq $0x6, %r14
leaq 0x3ddef(%rip), %r15     # 0x4c5e0
leaq (%r15,%r14), %rsi
movq %rcx, %r12
subq 0x8(%r14,%r15), %r12
movq %rcx, %rdi
xorl %edx, %edx
callq 0x2336b
movq 0x10(%r14,%r15), %rdx
movq 0x20(%rsp), %r14
pushq $0x5a
popq %rsi
movq %r12, %rdi
callq 0xb230
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %rdi
jmp 0xe62e
shrl %r8d
movq %r14, %rsi
movq %r12, %rdx
movl %ebx, %ecx
callq 0x3561b
movq 0x10(%rsp), %rcx
movl 0x10(%r12), %r8d
jmp 0xe656
movl 0x1c(%r14), %eax
movl %eax, 0x18(%r14)
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x35571
jmp 0xeb98
movq %r13, %rdi
callq 0xf6d1
movq 0x10(%rsp), %rsi
movl %eax, %r8d
jmp 0xe4d9
leaq 0x3ec20(%rip), %rax     # 0x4d4a0
cmpq %r13, (%rax)
jb 0xe920
movl %r8d, 0x34(%rsp)
movq %r15, %rax
shlq $0x5, %rax
movq 0x20(%rsp), %rcx
leaq (%rcx,%rax), %rsi
addq $0x28, %rsi
movl 0x10(%rsi), %eax
testq %rax, %rax
je 0xea92
movq 0x18(%rsi), %rcx
movq %rax, %rdx
shlq $0x3, %rdx
negq %rdx
movq (%rcx,%rdx), %rbp
decl %eax
movl %eax, 0x10(%rsi)
movq %rsi, %rbx
cmpl 0x8(%rsi), %eax
jl 0xeb28
leaq 0x2cde8(%rip), %rax     # 0x3b6c0
movq (%rax,%r15,8), %rdx
testb %r14b, %r14b
jne 0xea88
leaq 0x3dc35(%rip), %rax     # 0x4c521
cmpb $0x1, (%rax)
je 0xeb30
leaq 0x3dc37(%rip), %rax     # 0x4c533
cmpb $0x1, (%rax)
je 0xea88
incq (%rbx)
movq 0x20(%rsp), %r14
movl 0x18(%r14), %eax
testl %eax, %eax
jle 0xe94a
decl %eax
movl %eax, 0x18(%r14)
jmp 0xe4a9
movq 0x8(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %r13, %rdx
movl %r8d, %ecx
movl %ebx, %r8d
callq 0xccb3
movq 0x10(%rsp), %rsi
movq %rax, %rbp
movq 0x20(%rsp), %r14
jmp 0xe586
movl 0x1c(%r14), %eax
movl %eax, 0x18(%r14)
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x35571
jmp 0xe4a9
orl $-0x1, 0x8(%rbx)
movq 0x28(%rsp), %rsi
testq %rsi, %rsi
movq 0x8(%rsp), %rdi
jne 0xe984
movq 0x30(%rdi), %rsi
testq %rsi, %rsi
je 0xeb87
leaq 0x1f(%rsp), %r9
movq 0x20(%rsp), %rdx
movq %rbx, %rcx
callq 0x35a74
movq %rax, %rbp
leaq 0x1f(%rsp), %rax
cmpb $0x0, (%rax)
je 0xeb96
movq 0x10(%rsp), %rsi
jmp 0xe537
testb %al, %al
jne 0xeadb
movq %rbp, %rdi
xorl %esi, %esi
jmp 0xe9e5
movl %eax, 0x8(%rbx)
jmp 0xe537
shlq $0x6, %r15
leaq 0x3dc0d(%rip), %rax     # 0x4c5e0
movq %rbp, %rdi
subq 0x8(%r15,%rax), %rdi
movq 0x10(%r15,%rax), %rdx
movl $0xa5, %esi
callq 0xb230
movq 0x10(%rsp), %rsi
jmp 0xe56c
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 0xe36b
movq (%rdx), %rsi
movq 0x8(%rsp), %rdi
callq 0xda57
jmp 0xeb98
xorl %edx, %edx
jmp 0xe3f2
movabsq $0x7000000000000000, %rcx # imm = 0x7000000000000000
cmpq %rcx, %r13
ja 0xebaa
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 0xe44c
movq %rbp, %rdi
xorl %esi, %esi
jmp 0xeb38
orl $-0x1, 0x8(%rsi)
cmpq $0x0, 0x28(%rsp)
jne 0xeab5
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rax
movq %rax, 0x28(%rsp)
testq %rax, %rax
je 0xebb1
movq 0x8(%rsp), %rdi
movq 0x28(%rsp), %rsi
movl 0x34(%rsp), %edx
movl %ebx, %ecx
callq 0xcaea
movq %rax, %rbp
testq %rax, %rax
jne 0xe908
jmp 0xeb96
shlq $0x6, %r15
leaq 0x3dafa(%rip), %rax     # 0x4c5e0
movq 0x8(%r15,%rax), %r14
movq %rbp, %rdi
subq %r14, %rdi
movl $0xa5, %esi
movq %rdx, 0x28(%rsp)
movq %r14, %rdx
callq 0xb230
leaq 0x3dad6(%rip), %rax     # 0x4c5e0
movq (%r15,%rax), %rdi
addq %rbp, %rdi
movl $0xa5, %esi
movq %r14, %rdx
callq 0xb230
movq 0x28(%rsp), %rdx
jmp 0xe9b9
movl %eax, 0x8(%rbx)
jmp 0xe8d1
movq %rbp, %rdi
movl $0xa5, %esi
callq 0xb230
jmp 0xe905
pushq $0x5a
popq %rsi
movq 0x10(%rsp), %rdi
movq %r12, %rdx
callq 0xb230
jmp 0xe756
shrl %ecx
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movl %ebx, %edx
movq 0x20(%rsp), %r8
callq 0x35853
movl 0x10(%r12), %ecx
jmp 0xe77f
movl 0x1c(%rsi), %eax
movl %eax, 0x18(%rsi)
movq 0x8(%rsp), %rdi
jmp 0xe85a
movl %r8d, %ebp
xorl %esi, %esi
callq 0x1af15
testq %rax, %rax
jne 0xebce
xorl %ebp, %ebp
movq %rbp, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %esi, %esi
jmp 0xe44c
xorl %ebp, %ebp
movq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x1af15
movq %rax, 0x28(%rsp)
testq %rax, %rax
je 0xeb98
jmp 0xeab5
movq %rax, %rsi
movq 0x8(%rsp), %rdi
movl %ebp, %r8d
jmp 0xe984