// File: /workspace/github_c_makefile_star2_O2/nilyang[P]redis-tdd-annotation/deps/jemalloc/src/arena.c
// Function: arena_ralloc
void *
arena_ralloc(arena_t *arena, void *ptr, size_t oldsize, size_t size,
    size_t extra, size_t alignment, bool zero, bool try_tcache_alloc,
    bool try_tcache_dalloc)
{
	void *ret;
	size_t copysize;

	/* Try to avoid moving the allocation. */
	ret = arena_ralloc_no_move(ptr, oldsize, size, extra, zero);
	if (ret != NULL)
		return (ret);

	/*
	 * size and oldsize are different enough that we need to move the
	 * object.  In that case, fall back to allocating new space and
	 * copying.
	 */
	if (alignment != 0) {
		size_t usize = sa2u(size + extra, alignment);
		if (usize == 0)
			return (NULL);
		ret = ipallocx(usize, alignment, zero, try_tcache_alloc, arena);
	} else
		ret = arena_malloc(arena, size + extra, zero, try_tcache_alloc);

	if (ret == NULL) {
		if (extra == 0)
			return (NULL);
		/* Try again, this time without extra. */
		if (alignment != 0) {
			size_t usize = sa2u(size, alignment);
			if (usize == 0)
				return (NULL);
			ret = ipallocx(usize, alignment, zero, try_tcache_alloc,
			    arena);
		} else
			ret = arena_malloc(arena, size, zero, try_tcache_alloc);

		if (ret == NULL)
			return (NULL);
	}

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

	/*
	 * Copy at most size bytes (not size+extra), since the caller has no
	 * expectation that the extra bytes will be reliably preserved.
	 */
	copysize = (size < oldsize) ? size : oldsize;
	VALGRIND_MAKE_MEM_UNDEFINED(ret, copysize);
	memcpy(ret, ptr, copysize);
	iqallocx(ptr, try_tcache_dalloc);
	return (ret);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r9, %r15
movq %r8, %rbp
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, 0x30(%rsp)
movzbl 0xb0(%rsp), %r13d
movq %rsi, %rdi
movq %rdx, %rsi
movq %rcx, %rdx
movq %r8, %rcx
movl %r13d, %r8d
callq 0x79335
testq %rax, %rax
jne 0x79976
movl %r13d, 0x14(%rsp)
movq %r12, 0x28(%rsp)
movq 0x30(%rsp), %r12
movq %r14, 0x8(%rsp)
movq %rbx, %r14
leaq (%rbx,%rbp), %rsi
movzbl 0xb8(%rsp), %r13d
testq %r15, %r15
je 0x7977b
movq %rsi, %rdi
movq %r15, %rsi
callq 0x79a5f
testq %rax, %rax
je 0x79974
movq %rbp, 0x20(%rsp)
movq %rax, %rdi
movq %r15, 0x18(%rsp)
movq %r15, %rsi
movl 0x14(%rsp), %ebx
movl %ebx, %edx
movl %r13d, %ecx
movq %r12, %r15
movq %r12, %r8
callq 0x79b13
jmp 0x79799
movq %rbp, 0x20(%rsp)
movq %r15, 0x18(%rsp)
movq %r12, %r15
movq %r12, %rdi
movl 0x14(%rsp), %ebx
movl %ebx, %edx
movl %r13d, %ecx
callq 0x79ba4
movq %rax, %rcx
testq %rax, %rax
movq 0x28(%rsp), %rbp
je 0x79820
cmpq %rbp, %r14
cmovbq %r14, %rbp
leaq 0x40(%rsp), %rax
movq $0x4d430001, (%rax)     # imm = 0x4D430001
movq %rcx, 0x8(%rax)
movq %rbp, 0x10(%rax)
xorl %ebx, %ebx
movq %rbx, 0x18(%rax)
movq %rbx, 0x20(%rax)
movq %rbx, 0x28(%rax)
xorl %edx, %edx
rolq $0x3, %rdi
rolq $0xd, %rdi
rolq $0x3d, %rdi
rolq $0x33, %rdi
xchgq %rbx, %rbx
movq %rdx, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq %rcx, %r14
movq %rcx, %rdi
movq 0x8(%rsp), %r13
movq %r13, %rsi
movq %rbp, %rdx
callq 0x1fbd0
leaq 0x62355(%rip), %rax     # 0xdbb60
cmpq %rbx, (%rax)
je 0x79868
movq %r13, %rdi
callq 0x842d8
movq %r14, %rax
jmp 0x79976
cmpq $0x0, 0x20(%rsp)
je 0x79974
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
je 0x79958
movq %r14, %rdi
movq %rsi, %rbx
callq 0x79a5f
testq %rax, %rax
je 0x79974
movq %rax, %rdi
movq %rbx, %rsi
movl 0x14(%rsp), %edx
movl %r13d, %ecx
movq %r15, %r8
callq 0x79b13
jmp 0x79968
leaq 0x63011(%rip), %rax     # 0xdc880
movq (%rax), %rbx
notq %rbx
andq %r13, %rbx
cmpq %r13, %rbx
je 0x79948
movb 0xc0(%rsp), %al
subq %rbx, %r13
shrq $0xc, %r13
leaq 0x63092(%rip), %rcx     # 0xdc928
movq %r13, %rdx
subq (%rcx), %rdx
movq (%rbx), %r12
imulq $0x18, %rdx, %rcx
movq 0x40(%rbx,%rcx), %rbp
testb $0x2, %bpl
jne 0x79985
testb %al, %al
je 0x79a47
xorl %edi, %edi
callq 0x7c477
testq %rax, %rax
je 0x79a47
movq %rax, %r15
shrl $0x4, %ebp
movzbl %bpl, %ebx
leaq 0x62280(%rip), %rax     # 0xdbb5b
cmpb $0x1, (%rax)
movq 0x8(%rsp), %r13
jne 0x798fb
imulq $0x68, %rbx, %rax
leaq 0x62310(%rip), %rsi     # 0xdbc00
addq %rax, %rsi
movq %r13, %rdi
callq 0x7833d
movl %ebx, %eax
shll $0x5, %eax
leaq (%r15,%rax), %r12
addq $0x28, %r12
leaq 0x74281(%rip), %rcx     # 0xedb90
movq (%rcx), %rcx
movl 0x38(%r15,%rax), %edx
cmpl (%rcx,%rbx,4), %edx
jne 0x79931
shrl %edx
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rcx
callq 0x870f5
movl 0x10(%r12), %edx
movq 0x18(%r12), %rax
movl %edx, %ecx
movq %r13, (%rax,%rcx,8)
incl %edx
movl %edx, 0x10(%r12)
jmp 0x79a25
pushq $0x1
popq %rsi
movq %r13, %rdi
callq 0x82936
jmp 0x79818
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
movl %r13d, %ecx
callq 0x79ba4
movq %rax, %rcx
testq %rax, %rax
jne 0x797a6
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb %al, %al
je 0x79a32
movq %rbp, %r13
andq $-0x1000, %r13          # imm = 0xF000
leaq 0x7420a(%rip), %rax     # 0xedba8
cmpq (%rax), %r13
ja 0x79a32
xorl %edi, %edi
callq 0x7c477
testq %rax, %rax
je 0x79a32
movq %rax, %r15
shrq $0xc, %rbp
leaq 0x1b(%rbp), %r12
leaq 0x62196(%rip), %rax     # 0xdbb5b
cmpb $0x1, (%rax)
jne 0x799da
pushq $0x5a
popq %rsi
movq 0x8(%rsp), %rdi
movq %r13, %rdx
callq 0x1f110
movq %r12, %rax
shlq $0x5, %rax
leaq (%r15,%rax), %rbx
addq $0x28, %rbx
leaq 0x741a0(%rip), %rcx     # 0xedb90
movq (%rcx), %rcx
movl 0x38(%r15,%rax), %edx
cmpl 0x6c(%rcx,%rbp,4), %edx
jne 0x79a11
shrl %edx
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rcx
callq 0x872d5
movl 0x10(%rbx), %edx
movq 0x8(%rsp), %rsi
movq 0x18(%rbx), %rax
movl %edx, %ecx
movq %rsi, (%rax,%rcx,8)
incl %edx
movl %edx, 0x10(%rbx)
movq %r15, %rdi
callq 0x7c57d
jmp 0x79818
movq %r12, %rdi
movq %rbx, %rsi
movq 0x8(%rsp), %rdx
callq 0x792f7
jmp 0x79818
movq %r12, %rdi
movq %rbx, %rsi
movq 0x8(%rsp), %rdx
movq %r13, %rcx
callq 0x78e5d
jmp 0x79818