// File: /workspace/github_c_makefile_star2_O3/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, %rbx
movq %r8, %r12
movq %rcx, %r14
movq %rdx, %r13
movq %rsi, %rbp
movq %rdi, (%rsp)
movzbl 0x90(%rsp), %r15d
movq %rsi, %rdi
movq %rdx, %rsi
movq %rcx, %rdx
movq %r8, %rcx
movl %r15d, %r8d
callq 0x81c86
testq %rax, %rax
jne 0x8214c
movq %r13, 0x10(%rsp)
movq %rbp, 0x8(%rsp)
movb 0x98(%rsp), %r9b
leaq (%r12,%r14), %rsi
testq %rbx, %rbx
movq %rbx, %rdx
movq %r14, %rbp
je 0x820a9
leaq (%rsi,%rdx), %rax
decq %rax
movq %rdx, %r14
negq %r14
andq %rax, %r14
cmpq %rsi, %r14
jae 0x8215b
xorl %eax, %eax
jmp 0x8214c
movq %r12, %rbx
movq %rdx, %r12
movl %r9d, %r13d
movzbl %r9b, %ecx
movq (%rsp), %r14
movq %r14, %rdi
movl %r15d, %edx
callq 0x82763
movq %rax, %rdi
testq %rdi, %rdi
movq 0x10(%rsp), %rcx
je 0x821b3
cmpq %rcx, %rbp
cmovbq %rbp, %rcx
leaq 0x20(%rsp), %rax
movq $0x4d430001, (%rax)     # imm = 0x4D430001
movq %rdi, 0x8(%rax)
movq %rcx, 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 %rdi, %r14
movq 0x8(%rsp), %r13
movq %r13, %rsi
movq %rcx, %rdx
callq 0x1fbd0
leaq 0x5ca28(%rip), %rax     # 0xdeb60
cmpq %rbx, (%rax)
je 0x8228e
movq %r13, %rdi
callq 0x8da50
movq %r14, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5d7ce(%rip), %rax     # 0xdf930
movq (%rax), %rax
cmpq %rax, %r14
seta %cl
cmpq $0x1001, %rdx           # imm = 0x1001
setae %dil
orb %cl, %dil
jne 0x82238
cmpq $0xe00, %r14            # imm = 0xE00
ja 0x8234d
decq %r14
shrq $0x3, %r14
leaq 0x21026(%rip), %rcx     # 0xa31c0
movzbl (%r14,%rcx), %ecx
imulq $0x68, %rcx, %rcx
leaq 0x5ca56(%rip), %rsi     # 0xdec00
movq (%rcx,%rsi), %r14
jmp 0x8235b
testq %rbx, %rbx
je 0x820a2
testq %r12, %r12
je 0x823ec
movq %r12, %rdx
leaq (%r12,%rbp), %rax
decq %rax
movq %r12, %rbx
negq %rbx
andq %rax, %rbx
cmpq %rbp, %rbx
jb 0x820a2
leaq 0x5d748(%rip), %rax     # 0xdf930
movq (%rax), %rax
cmpq %rax, %rbx
seta %cl
cmpq $0x1001, %rdx           # imm = 0x1001
setae %dil
orb %cl, %dil
jne 0x824cc
cmpq $0xe00, %rbx            # imm = 0xE00
ja 0x826bf
decq %rbx
shrq $0x3, %rbx
leaq 0x20fa0(%rip), %rcx     # 0xa31c0
movzbl (%rbx,%rcx), %ecx
imulq $0x68, %rcx, %rcx
leaq 0x5c9d1(%rip), %rdi     # 0xdec00
movq (%rcx,%rdi), %rbx
jmp 0x826cd
leaq 0xfff(%rsi), %r14
andq $-0x1000, %r14          # imm = 0xF000
cmpq %rsi, %r14
jb 0x820a2
leaq 0xfff(%rdx), %rcx
andq $-0x1000, %rcx          # imm = 0xF000
addq %r14, %rcx
jb 0x820a2
addq $-0x1000, %rcx          # imm = 0xF000
cmpq %rax, %rcx
jbe 0x8235b
leaq 0x5d603(%rip), %rcx     # 0xdf880
movq (%rcx), %rcx
addq %rcx, %r14
notq %rcx
andq %rcx, %r14
jmp 0x8235b
leaq 0x5d5eb(%rip), %rax     # 0xdf880
movq (%rax), %rbx
notq %rbx
andq %r13, %rbx
cmpq %r13, %rbx
je 0x823da
movb 0xa0(%rsp), %al
subq %rbx, %r13
shrq $0xc, %r13
leaq 0x5d66c(%rip), %r12     # 0xdf928
movq %r13, %rcx
subq (%r12), %rcx
movq (%rbx), %r15
leaq (%rcx,%rcx,2), %rcx
movq 0x40(%rbx,%rcx,8), %rbp
testb $0x2, %bpl
jne 0x8241a
testb %al, %al
je 0x825db
movq 0x43c70(%rip), %rax     # 0xc5f58
movq %fs:0x0, %rsi
addq %rax, %rsi
movq %fs:(%rax), %rcx
cmpq $0x3, %rcx
ja 0x8253c
jb 0x825db
jne 0x82545
movq $0x2, %fs:(%rax)
leaq 0x6e893(%rip), %rax     # 0xf0bb0
movl (%rax), %edi
callq 0x1f1c0
testl %eax, %eax
je 0x825db
leaq 0x20e3b(%rip), %rdi     # 0xa316e
callq 0x915d4
leaq 0x5c81b(%rip), %rax     # 0xdeb5a
cmpb $0x1, (%rax)
jne 0x825db
jmp 0x824a8
addq $0xfff, %r14            # imm = 0xFFF
andq $-0x1000, %r14          # imm = 0xF000
testq %r14, %r14
je 0x820a2
cmpq $0x1000, %rdx           # imm = 0x1000
ja 0x8238e
cmpq %r14, %rax
jb 0x8238e
movq %r12, %rbx
movq %rdx, %r12
movl %r9d, %r13d
movzbl %r9b, %ecx
movq (%rsp), %rdi
movq %r14, %rsi
movq %rdi, %r14
jmp 0x820bd
movq %r12, %rbx
movl %r9d, %r13d
cmpq %r14, %rax
jb 0x824ad
movq (%rsp), %rax
movq %rax, %rdi
testq %rax, %rax
jne 0x823c7
movq 0x43b88(%rip), %rax     # 0xc5f38
movq %fs:(%rax), %rdi
testq %rdi, %rdi
jne 0x823c7
movq %rdx, %r12
callq 0x7c4da
movq %r12, %rdx
movq %rax, %rdi
movq %r14, %rsi
movq %rdx, %r12
movl %r15d, %ecx
callq 0x8104f
jmp 0x82530
movq %r13, %rdi
movl $0x1, %esi
callq 0x8bdfd
jmp 0x82149
movzbl %r13b, %ecx
movq %r14, %rdi
movq %rbp, %r12
movq %rbp, %rsi
movl %r15d, %edx
callq 0x82763
movq %rax, %rdi
testq %rax, %rax
movq 0x10(%rsp), %rcx
movq %r12, %rbp
jne 0x820d6
jmp 0x820a2
testb %al, %al
movq 0x8(%rsp), %r13
je 0x82698
movq %rbp, %rdx
andq $-0x1000, %rdx          # imm = 0xF000
leaq 0x6e770(%rip), %rax     # 0xf0ba8
cmpq (%rax), %rdx
ja 0x82698
movq 0x43b10(%rip), %rax     # 0xc5f58
movq %fs:0x0, %rsi
addq %rax, %rsi
movq %fs:(%rax), %r12
cmpq $0x3, %r12
ja 0x82606
jb 0x82698
jne 0x8260f
movq $0x2, %fs:(%rax)
leaq 0x6e733(%rip), %rax     # 0xf0bb0
movl (%rax), %edi
callq 0x1f1c0
testl %eax, %eax
je 0x82698
leaq 0x20cdb(%rip), %rdi     # 0xa316e
callq 0x915d4
leaq 0x5c6bb(%rip), %rax     # 0xdeb5a
cmpb $0x1, (%rax)
jne 0x82698
callq 0x1f1b0
leaq 0x5d3ac(%rip), %rax     # 0xdf860
cmpq %rdx, (%rax)
jae 0x82522
movq %r14, %rdi
movq %rdx, %r12
movq %rdx, %rsi
movl %r15d, %edx
callq 0x8b92d
jmp 0x82530
leaq 0xfff(%rbp), %rbx
andq $-0x1000, %rbx          # imm = 0xF000
cmpq %rbp, %rbx
jb 0x820a2
leaq 0xfff(%rdx), %rcx
andq $-0x1000, %rcx          # imm = 0xF000
addq %rbx, %rcx
jb 0x820a2
addq $-0x1000, %rcx          # imm = 0xF000
cmpq %rax, %rcx
jbe 0x826cd
leaq 0x5d36f(%rip), %rcx     # 0xdf880
movq (%rcx), %rcx
addq %rcx, %rbx
notq %rcx
andq %rcx, %rbx
jmp 0x826cd
movq %rdx, %r12
movq %r14, %rdi
movl %r15d, %esi
callq 0x8b91c
movq %rax, %rdi
movq (%rsp), %r14
jmp 0x820c8
testq %rcx, %rcx
je 0x825db
shrl $0x4, %ebp
movzbl %bpl, %ebx
leaq 0x5c608(%rip), %rax     # 0xdeb5b
cmpb $0x1, (%rax)
movq 0x8(%rsp), %r12
jne 0x82579
imulq $0x68, %rbx, %rax
leaq 0x5c698(%rip), %rsi     # 0xdec00
addq %rax, %rsi
movq %r12, %rdi
movq %rcx, %r15
callq 0x80b41
movq %r15, %rcx
movl %ebx, %eax
shll $0x5, %eax
leaq (%rcx,%rax), %r15
addq $0x28, %r15
leaq 0x6e603(%rip), %rax     # 0xf0b90
movq (%rax), %rax
movl 0x10(%r15), %edx
cmpl (%rax,%rbx,4), %edx
jne 0x825b0
shrl %edx
movq %r15, %rdi
movq %rbx, %rsi
movq %rcx, %rbx
callq 0x90bee
movq %rbx, %rcx
movl 0x10(%r15), %edx
movq 0x18(%r15), %rax
movl %edx, %esi
movq %r12, (%rax,%rsi,8)
incl %edx
movl %edx, 0x10(%r15)
movl 0x20(%rcx), %eax
incl %eax
movl %eax, 0x20(%rcx)
cmpl $0x125, %eax            # imm = 0x125
jne 0x82149
movq %rcx, %rdi
jmp 0x8268e
leaq 0x30(%rbx), %rax
movq %r13, %rcx
subq (%r12), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %r8
movq %r15, %rdi
movq %rbx, %rsi
movq 0x8(%rsp), %rdx
movq %r13, %rcx
callq 0x8173d
jmp 0x82149
testq %r12, %r12
je 0x82698
shrq $0xc, %rbp
leaq 0x1b(%rbp), %r15
leaq 0x5c53d(%rip), %rax     # 0xdeb5b
cmpb $0x1, (%rax)
jne 0x82630
movq %r13, %rdi
movl $0x5a, %esi
callq 0x1f110
movq %r15, %rax
shlq $0x5, %rax
leaq (%r12,%rax), %rbx
addq $0x28, %rbx
leaq 0x6e54a(%rip), %rax     # 0xf0b90
movq (%rax), %rax
movl 0x10(%rbx), %edx
cmpl 0x6c(%rax,%rbp,4), %edx
jne 0x82665
shrl %edx
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rcx
callq 0x90dea
movl 0x10(%rbx), %edx
movq 0x18(%rbx), %rax
movl %edx, %ecx
movq %r13, (%rax,%rcx,8)
incl %edx
movl %edx, 0x10(%rbx)
movl 0x20(%r12), %eax
incl %eax
movl %eax, 0x20(%r12)
cmpl $0x125, %eax            # imm = 0x125
jne 0x82149
movq %r12, %rdi
callq 0x90b49
jmp 0x82149
leaq 0x8(%r15), %r12
movq %r12, %rdi
callq 0x1faa0
movq %r15, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x817bf
movq %r12, %rdi
callq 0x1fbb0
jmp 0x82149
addq $0xfff, %rbx            # imm = 0xFFF
andq $-0x1000, %rbx          # imm = 0xF000
testq %rbx, %rbx
je 0x820a2
cmpq $0x1000, %rdx           # imm = 0x1000
ja 0x826f6
cmpq %rbx, %rax
jb 0x826f6
movq %rbp, %r12
movzbl %r13b, %ecx
movq %r14, %rdi
movq %rbx, %rsi
jmp 0x823f9
movq %rbp, %r12
cmpq %rbx, %rax
jb 0x82734
testq %r14, %r14
jne 0x82721
movq 0x4382e(%rip), %rax     # 0xc5f38
movq %fs:(%rax), %r14
testq %r14, %r14
jne 0x82721
movq %rdx, %r14
callq 0x7c4da
movq %r14, %rdx
movq %rax, %r14
movq %r14, %rdi
movq %rbx, %rsi
movl %r15d, %ecx
callq 0x8104f
jmp 0x82401
leaq 0x5d125(%rip), %rax     # 0xdf860
cmpq %rdx, (%rax)
jae 0x82753
movq %rbx, %rdi
movq %rdx, %rsi
movl %r15d, %edx
callq 0x8b92d
jmp 0x82401
movq %rbx, %rdi
movl %r15d, %esi
callq 0x8b91c
jmp 0x82401