// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/deps/jemalloc/src/huge.c
// Function: je_huge_ralloc
void *
huge_ralloc(tsd_t *tsd, arena_t *arena, void *ptr, size_t oldsize, size_t usize,
    size_t alignment, bool zero, tcache_t *tcache)
{
	void *ret;
	size_t copysize;

	/* Try to avoid moving the allocation. */
	if (!huge_ralloc_no_move(ptr, oldsize, usize, usize, zero))
		return (ptr);

	/*
	 * usize and oldsize are different enough that we need to use a
	 * different size class.  In that case, fall back to allocating new
	 * space and copying.
	 */
	ret = huge_ralloc_move_helper(tsd, arena, usize, alignment, zero,
	    tcache);
	if (ret == NULL)
		return (NULL);

	copysize = (usize < oldsize) ? usize : oldsize;
	memcpy(ret, ptr, copysize);
	isqalloc(tsd, ptr, oldsize, tcache);
	return (ret);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movq %r8, %rbp
movq %rcx, %r13
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, (%rsp)
movzbl 0x40(%rsp), %r12d
movq %rdx, %rdi
movq %rcx, %rsi
movq %r8, %rdx
movq %r8, %rcx
movl %r12d, %r8d
callq 0x305d2
testb %al, %al
je 0x30b40
movq 0x48(%rsp), %r9
leaq 0x26b87(%rip), %rax     # 0x576a8
cmpq %rbx, (%rax)
jae 0x30b48
movq (%rsp), %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
movl %r12d, %r8d
movq %r9, %r14
callq 0x2fe11
jmp 0x30b60
movq %r15, %rbx
jmp 0x30c51
movq (%rsp), %rdi
movq %r14, %rsi
movq %rbp, %rdx
movl %r12d, %ecx
movq %r9, %r14
movq %r9, %r8
callq 0x2fd7c
movq %rax, %rbx
testq %rax, %rax
je 0x30c4f
cmpq %r13, %rbp
cmovaeq %r13, %rbp
movq %rbx, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x10400
leaq 0x25aa0(%rip), %rax     # 0x56628
cmpq $0x0, (%rax)
jne 0x30c63
leaq 0x26b17(%rip), %rax     # 0x576b0
movq (%rax), %rsi
notq %rsi
andq %r15, %rsi
cmpq %r15, %rsi
je 0x30c71
cmpq $0x3800, %r13           # imm = 0x3800
movq %r14, %r9
ja 0x30c82
testq %r9, %r9
je 0x30d11
cmpq $0x1000, %r13           # imm = 0x1000
ja 0x30d2b
decq %r13
shrq $0x3, %r13
leaq 0x11f21(%rip), %rax     # 0x42b00
movzbl (%rax,%r13), %eax
leaq 0x25a37(%rip), %rcx     # 0x56622
movl %eax, %r13d
cmpb $0x1, (%rcx)
je 0x30d3e
movq %r13, %rax
shlq $0x5, %rax
leaq (%r9,%rax), %rbp
addq $0x20, %rbp
leaq 0x271a3(%rip), %rax     # 0x57db0
movq (%rax), %rax
movl 0x10(%rbp), %r8d
cmpl (%rax,%r13,4), %r8d
je 0x30d5c
movq 0x18(%rbp), %rax
movl %r8d, %ecx
movq %r15, (%rax,%rcx,8)
incl %r8d
movl %r8d, 0x10(%rbp)
movl 0x18(%r9), %eax
incl %eax
movl %eax, 0x18(%r9)
cmpl $0xd3, %eax
jne 0x30c51
movq (%rsp), %rdi
movq %r9, %rsi
callq 0x36f85
jmp 0x30c51
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x3366e
jmp 0x30c51
movq (%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x30dbc
jmp 0x30c51
testq %r9, %r9
je 0x30d80
leaq 0x2714e(%rip), %rax     # 0x57de0
cmpq %r13, (%rax)
jb 0x30d80
movq %r9, %r14
movq %r13, %rdi
callq 0x31263
movl %eax, %ebp
leaq 0x25973(%rip), %rax     # 0x56622
cmpb $0x1, (%rax)
je 0x30d90
movl %ebp, %eax
movq %rax, %rcx
shlq $0x5, %rcx
leaq (%r14,%rcx), %r13
addq $0x20, %r13
leaq 0x270e0(%rip), %rcx     # 0x57db0
movq (%rcx), %rdx
movl 0x10(%r13), %ecx
cmpl (%rdx,%rax,4), %ecx
je 0x30da0
movq 0x18(%r13), %rax
movl %ecx, %edx
movq %r15, (%rax,%rdx,8)
incl %ecx
movl %ecx, 0x10(%r13)
movl 0x18(%r14), %eax
incl %eax
movl %eax, 0x18(%r14)
cmpl $0xd3, %eax
jne 0x30c51
movq (%rsp), %rdi
movq %r14, %rsi
jmp 0x30c48
movq %r15, %rcx
subq %rsi, %rcx
shrq $0xc, %rcx
movq (%rsi), %rdi
movq %r15, %rdx
callq 0x244f0
jmp 0x30c51
movq %r13, %rdi
movq %r9, %r14
callq 0x31263
movq %r14, %r9
jmp 0x30be4
imulq $0x60, %r13, %rsi
addq 0x2328f(%rip), %rsi     # 0x53fd8
movq %r15, %rdi
movq %r9, %r14
callq 0x233ee
movq %r14, %r9
jmp 0x30bf7
shrl %r8d
movq (%rsp), %rdi
movq %r9, %rsi
movq %rbp, %rdx
movl %r13d, %ecx
movq %r9, %r14
callq 0x37034
movq %r14, %r9
movl 0x10(%rbp), %r8d
jmp 0x30c1e
movq (%rsi), %rdi
movq %r15, %rdx
callq 0x24608
jmp 0x30c51
movq %r15, %rdi
movq %r13, %rsi
callq 0x244f5
jmp 0x30cb8
shrl %ecx
movq (%rsp), %rdi
movq %r13, %rsi
movl %ebp, %edx
movq %r14, %r8
callq 0x371b7
movl 0x10(%r13), %ecx
jmp 0x30ce0