// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rcx, -0xb0(%rbp)
movq %rdx, -0xa8(%rbp)
movq %rsi, %r10
movq -0xb0(%rbp), %rsi
movq %rdi, %r11
movq -0xa8(%rbp), %rdi
movb 0x20(%rbp), %al
movb 0x18(%rbp), %cl
movb 0x10(%rbp), %dl
movq %r11, -0x10(%rbp)
movq %r10, -0x18(%rbp)
movq %rdi, -0x20(%rbp)
movq %rsi, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
andb $0x1, %dl
movb %dl, -0x39(%rbp)
andb $0x1, %cl
movb %cl, -0x3a(%rbp)
andb $0x1, %al
movb %al, -0x3b(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
movb -0x39(%rbp), %al
andb $0x1, %al
movzbl %al, %r8d
callq 0xb7a10
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0xb7d75
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xb7f5e
cmpq $0x0, -0x38(%rbp)
je 0xb7dcd
movq -0x28(%rbp), %rdi
addq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xb7f70
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0xb7da5
movq $0x0, -0x8(%rbp)
jmp 0xb7f5e
movq -0x58(%rbp), %rdi
movq -0x38(%rbp), %rsi
movb -0x39(%rbp), %cl
movb -0x3a(%rbp), %al
movq -0x10(%rbp), %r8
andb $0x1, %cl
andb $0x1, %al
movzbl %cl, %edx
movzbl %al, %ecx
callq 0xb80d0
movq %rax, -0x48(%rbp)
jmp 0xb7df3
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq -0x30(%rbp), %rsi
movb -0x39(%rbp), %cl
movb -0x3a(%rbp), %al
andb $0x1, %cl
andb $0x1, %al
movzbl %cl, %edx
movzbl %al, %ecx
callq 0xb81c0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0xb7e9e
cmpq $0x0, -0x30(%rbp)
jne 0xb7e12
movq $0x0, -0x8(%rbp)
jmp 0xb7f5e
cmpq $0x0, -0x38(%rbp)
je 0xb7e66
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xb7f70
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0xb7e3e
movq $0x0, -0x8(%rbp)
jmp 0xb7f5e
movq -0x60(%rbp), %rdi
movq -0x38(%rbp), %rsi
movb -0x39(%rbp), %cl
movb -0x3a(%rbp), %al
movq -0x10(%rbp), %r8
andb $0x1, %cl
andb $0x1, %al
movzbl %cl, %edx
movzbl %al, %ecx
callq 0xb80d0
movq %rax, -0x48(%rbp)
jmp 0xb7e88
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movb -0x39(%rbp), %cl
movb -0x3a(%rbp), %al
andb $0x1, %cl
andb $0x1, %al
movzbl %cl, %edx
movzbl %al, %ecx
callq 0xb81c0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0xb7e9c
movq $0x0, -0x8(%rbp)
jmp 0xb7f5e
jmp 0xb7e9e
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0xb7eb5
movq -0x28(%rbp), %rax
movq %rax, -0xb8(%rbp)
jmp 0xb7ec0
movq -0x20(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq $0x4d430001, -0x90(%rbp) # imm = 0x4D430001
movq -0x48(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x80(%rbp)
movq $0x0, -0x78(%rbp)
movq $0x0, -0x70(%rbp)
movq $0x0, -0x68(%rbp)
leaq -0x90(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
rolq $0x3, %rdi
rolq $0xd, %rdi
rolq $0x3d, %rdi
rolq $0x33, %rdi
xchgq %rbx, %rbx
movq %rdx, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0x1fbf0
movq -0x18(%rbp), %rdi
movb -0x3b(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0xb82c0
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax,%rax)