// File: /workspace/github_c_makefile_star2_O1/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 $0x58, %rsp
movq %r9, %r12
movq %r8, %r13
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
movzbl 0x90(%rsp), %ebp
movq %rsi, %rdi
movq %rdx, %rsi
movq %rcx, %rdx
movq %r8, %rcx
movl %ebp, %r8d
callq 0x8195e
testq %rax, %rax
jne 0x82225
movl %ebp, 0x4(%rsp)
movb 0x98(%rsp), %dil
leaq (%r14,%r13), %rsi
testq %r12, %r12
movq %r12, %rbp
movq %r13, %r9
je 0x81da2
movq %rbx, 0x10(%rsp)
leaq (%rsi,%rbp), %rax
decq %rax
movq %rbp, %r13
negq %r13
andq %rax, %r13
cmpq %rsi, %r13
jae 0x81dc8
xorl %r13d, %r13d
testq %r13, %r13
je 0x81e1f
leaq 0x5dbcd(%rip), %rax     # 0xdf930
movq (%rax), %rax
cmpq $0x1000, %rbp           # imm = 0x1000
ja 0x81e29
cmpq %r13, %rax
jb 0x81e29
movl %edi, %r12d
movzbl %dil, %ecx
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movl 0x4(%rsp), %edx
movq %r9, %rbx
callq 0x8243c
movq %rbx, %r9
movq %rax, %rcx
jmp 0x81f08
movl %edi, %r12d
movzbl %dil, %ecx
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %edx
movq %r9, %r13
callq 0x8243c
movq %r13, %r9
movq %rax, %rcx
movq %rbx, %r13
jmp 0x81f16
leaq 0x5db61(%rip), %rax     # 0xdf930
movq (%rax), %rax
cmpq %rax, %r13
seta %cl
cmpq $0x1001, %rbp           # imm = 0x1001
setae %dl
orb %cl, %dl
jne 0x81e75
cmpq $0xe00, %r13            # imm = 0xE00
ja 0x81ee8
decq %r13
shrq $0x3, %r13
leaq 0x212bb(%rip), %rax     # 0xa30c0
movzbl (%r13,%rax), %eax
imulq $0x68, %rax, %rax
leaq 0x5cdea(%rip), %rcx     # 0xdec00
movq (%rax,%rcx), %r13
jmp 0x81d53
movl %edi, %r12d
xorl %ecx, %ecx
jmp 0x81f08
movq %r9, %rbx
movl %edi, %r12d
cmpq %r13, %rax
jb 0x81ecb
movq 0x8(%rsp), %rax
movq %rax, %rdi
testq %rax, %rax
movl 0x4(%rsp), %ecx
jne 0x81e65
movq 0x440e8(%rip), %rax     # 0xc5f38
movq %fs:(%rax), %rdi
testq %rdi, %rdi
jne 0x81e65
callq 0x7c332
movl 0x4(%rsp), %ecx
movq %rax, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x80d53
jmp 0x81f02
leaq 0xfff(%rsi), %r13
andq $-0x1000, %r13          # imm = 0xF000
cmpq %rsi, %r13
jb 0x81d50
leaq 0xfff(%rbp), %rcx
andq $-0x1000, %rcx          # imm = 0xF000
addq %r13, %rcx
jb 0x81d50
addq $-0x1000, %rcx          # imm = 0xF000
cmpq %rax, %rcx
jbe 0x81d53
leaq 0x5d9c6(%rip), %rax     # 0xdf880
movq (%rax), %rax
addq %rax, %r13
notq %rax
andq %rax, %r13
jmp 0x81d53
leaq 0x5d98e(%rip), %rax     # 0xdf860
cmpq %rbp, (%rax)
movl 0x4(%rsp), %edx
movq %r13, %rdi
jae 0x81efb
movq %rbp, %rsi
callq 0x8b6b5
jmp 0x81f02
addq $0xfff, %r13            # imm = 0xFFF
andq $-0x1000, %r13          # imm = 0xF000
jmp 0x81d53
movl %edx, %esi
callq 0x8b6a4
movq %rax, %rcx
movq %rbx, %r9
testq %r13, %r13
movq 0x10(%rsp), %r13
je 0x82223
testq %rcx, %rcx
je 0x81f94
cmpq %r15, %r14
cmovbq %r14, %r15
leaq 0x20(%rsp), %rax
movq $0x4d430001, (%rax)     # imm = 0x4D430001
movq %rcx, 0x8(%rax)
movq %r15, 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, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq %rcx, %r14
movq %rcx, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x1fbd0
leaq 0x5cbe5(%rip), %rax     # 0xdeb60
cmpq %rbx, (%rax)
je 0x82004
movq %r13, %rdi
callq 0x8d814
movq %r14, %rax
jmp 0x82225
testq %r9, %r9
je 0x82223
testq %rbp, %rbp
je 0x82088
leaq (%r14,%rbp), %rax
decq %rax
movq %rbp, %rbx
negq %rbx
andq %rax, %rbx
cmpq %r14, %rbx
jae 0x820ea
xorl %ebx, %ebx
testq %rbx, %rbx
je 0x8213b
leaq 0x5d95f(%rip), %rax     # 0xdf930
movq (%rax), %rax
cmpq $0x1000, %rbp           # imm = 0x1000
ja 0x82142
cmpq %rbx, %rax
jb 0x82142
movzbl %r12b, %ecx
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movl 0x4(%rsp), %edx
callq 0x8243c
jmp 0x82212
leaq 0x5d875(%rip), %rax     # 0xdf880
movq (%rax), %rbx
notq %rbx
andq %r13, %rbx
cmpq %r13, %rbx
je 0x82076
movb 0xa0(%rsp), %al
movq %r13, 0x10(%rsp)
subq %rbx, %r13
shrq $0xc, %r13
leaq 0x5d8f5(%rip), %r15     # 0xdf928
movq %r13, %rcx
subq (%r15), %rcx
movq (%rbx), %rdi
leaq (%rcx,%rcx,2), %rcx
movq 0x40(%rbx,%rcx,8), %rbp
testb $0x2, %bpl
jne 0x820a5
testb %al, %al
je 0x822f9
movq 0x43efe(%rip), %rax     # 0xc5f58
movq %fs:(%rax), %r12
cmpq $0x3, %r12
ja 0x82285
jae 0x82234
xorl %r12d, %r12d
jmp 0x82285
movq %r13, %rdi
movl $0x1, %esi
callq 0x8bb7e
jmp 0x81f8c
movzbl %r12b, %ecx
movq 0x8(%rsp), %rdi
movq %r14, %rsi
movl 0x4(%rsp), %edx
callq 0x8243c
movq %rax, %rcx
jmp 0x8221a
testb %al, %al
je 0x8240b
movq %rbp, %r13
andq $-0x1000, %r13          # imm = 0xF000
leaq 0x6eaea(%rip), %rax     # 0xf0ba8
cmpq (%rax), %r13
ja 0x8240b
movq 0x43e8a(%rip), %rax     # 0xc5f58
movq %fs:(%rax), %r12
cmpq $0x3, %r12
ja 0x8236d
jae 0x82320
xorl %r12d, %r12d
jmp 0x8236d
leaq 0x5d83f(%rip), %rax     # 0xdf930
movq (%rax), %rax
cmpq %rax, %rbx
seta %cl
cmpq $0x1001, %rbp           # imm = 0x1001
setae %dl
orb %cl, %dl
jne 0x82185
cmpq $0xe00, %rbx            # imm = 0xE00
ja 0x821f8
decq %rbx
shrq $0x3, %rbx
leaq 0x20f9d(%rip), %rax     # 0xa30c0
movzbl (%rbx,%rax), %eax
imulq $0x68, %rax, %rax
leaq 0x5cace(%rip), %rcx     # 0xdec00
movq (%rax,%rcx), %rbx
jmp 0x81fc1
xorl %ecx, %ecx
jmp 0x82215
cmpq %rbx, %rax
jb 0x821db
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
movl 0x4(%rsp), %ecx
jne 0x82175
movq 0x43dd8(%rip), %rax     # 0xc5f38
movq %fs:(%rax), %rdi
testq %rdi, %rdi
jne 0x82175
callq 0x7c332
movl 0x4(%rsp), %ecx
movq %rax, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x80d53
jmp 0x82212
leaq 0xfff(%r14), %rbx
andq $-0x1000, %rbx          # imm = 0xF000
cmpq %r14, %rbx
jb 0x81fbf
leaq 0xfff(%rbp), %rcx
andq $-0x1000, %rcx          # imm = 0xF000
addq %rbx, %rcx
jb 0x81fbf
addq $-0x1000, %rcx          # imm = 0xF000
cmpq %rax, %rcx
jbe 0x81fc1
leaq 0x5d6b6(%rip), %rax     # 0xdf880
movq (%rax), %rax
addq %rax, %rbx
notq %rax
andq %rax, %rbx
jmp 0x81fc1
leaq 0x5d67e(%rip), %rax     # 0xdf860
cmpq %rbp, (%rax)
movl 0x4(%rsp), %edx
movq %rbx, %rdi
jae 0x8220b
movq %rbp, %rsi
callq 0x8b6b5
jmp 0x82212
addq $0xfff, %rbx            # imm = 0xFFF
andq $-0x1000, %rbx          # imm = 0xF000
jmp 0x81fc1
movl %edx, %esi
callq 0x8b6a4
movq %rax, %rcx
testq %rbx, %rbx
je 0x82223
testq %rcx, %rcx
jne 0x81f1b
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jne 0x82285
movq %rdi, 0x8(%rsp)
movq %fs:0x0, %rsi
addq %rax, %rsi
movq $0x2, %fs:(%rax)
leaq 0x6e95a(%rip), %rax     # 0xf0bb0
movl (%rax), %edi
callq 0x1f1c0
testl %eax, %eax
je 0x8227d
leaq 0x20e2e(%rip), %rdi     # 0xa3096
callq 0x9124c
leaq 0x5c8e6(%rip), %rax     # 0xdeb5a
cmpb $0x1, (%rax)
je 0x82437
xorl %r12d, %r12d
movq 0x8(%rsp), %rdi
testq %r12, %r12
je 0x822f9
shrl $0x4, %ebp
movzbl %bpl, %ebx
leaq 0x5c8c3(%rip), %rax     # 0xdeb5b
cmpb $0x1, (%rax)
movq 0x10(%rsp), %r13
jne 0x822b8
imulq $0x68, %rbx, %rax
leaq 0x5c953(%rip), %rsi     # 0xdec00
addq %rax, %rsi
movq %r13, %rdi
callq 0x8085a
movl %ebx, %eax
shll $0x5, %eax
leaq (%r12,%rax), %r15
addq $0x28, %r15
leaq 0x6e8c4(%rip), %rax     # 0xf0b90
movq (%rax), %rax
movl (%rax,%rbx,4), %edx
cmpl %edx, 0x10(%r15)
jne 0x822e8
shrl %edx
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rcx
callq 0x908bd
movq 0x18(%r15), %rax
movl 0x10(%r15), %ecx
movq %r13, (%rax,%rcx,8)
jmp 0x823e0
leaq 0x30(%rbx), %rax
movq %r13, %rcx
subq (%r15), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %r8
movq %rbx, %rsi
movq 0x10(%rsp), %rdx
movq %r13, %rcx
callq 0x8141b
jmp 0x81f8c
jne 0x8236d
movq %rdi, %r15
movq %fs:0x0, %rsi
addq %rax, %rsi
movq $0x2, %fs:(%rax)
leaq 0x6e870(%rip), %rax     # 0xf0bb0
movl (%rax), %edi
callq 0x1f1c0
testl %eax, %eax
je 0x82367
leaq 0x20d44(%rip), %rdi     # 0xa3096
callq 0x9124c
leaq 0x5c7fc(%rip), %rax     # 0xdeb5a
cmpb $0x1, (%rax)
je 0x82437
xorl %r12d, %r12d
movq %r15, %rdi
testq %r12, %r12
je 0x8240b
shrq $0xc, %rbp
leaq 0x1b(%rbp), %rbx
leaq 0x5c7d6(%rip), %rax     # 0xdeb5b
cmpb $0x1, (%rax)
jne 0x8239c
movq 0x10(%rsp), %rdi
movl $0x5a, %esi
movq %r13, %rdx
callq 0x1f110
movq %rbx, %rax
shlq $0x5, %rax
leaq (%r12,%rax), %r15
addq $0x28, %r15
leaq 0x6e7de(%rip), %rax     # 0xf0b90
movq (%rax), %rax
movl 0x6c(%rax,%rbp,4), %edx
cmpl %edx, 0x10(%r15)
jne 0x823cf
shrl %edx
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rcx
callq 0x90ac1
movq 0x18(%r15), %rax
movl 0x10(%r15), %ecx
movq 0x10(%rsp), %rdx
movq %rdx, (%rax,%rcx,8)
leal 0x1(%rcx), %eax
movl %eax, 0x10(%r15)
movl 0x20(%r12), %eax
incl %eax
movl %eax, 0x20(%r12)
cmpl $0x125, %eax            # imm = 0x125
jne 0x81f8c
movq %r12, %rdi
callq 0x90815
jmp 0x81f8c
leaq 0x8(%rdi), %r12
movq %rdi, %r15
movq %r12, %rdi
callq 0x1faa0
movq %r15, %rdi
movq %rbx, %rsi
movq 0x10(%rsp), %rdx
callq 0x8149d
movq %r12, %rdi
callq 0x1fbb0
jmp 0x81f8c
callq 0x1f1b0