// File: /workspace/github_c_makefile_star2_O2/nilyang[P]redis-tdd-annotation/deps/jemalloc/include/jemalloc/internal/jemalloc_internal.h
// Function: irallocx
JEMALLOC_INLINE void *
irallocx(void *ptr, size_t size, size_t extra, size_t alignment, bool zero,
    bool no_move, bool try_tcache_alloc, bool try_tcache_dalloc, arena_t *arena)
{
	void *ret;
	size_t oldsize;

	assert(ptr != NULL);
	assert(size != 0);

	oldsize = isalloc(ptr, config_prof);

	if (alignment != 0 && ((uintptr_t)ptr & ((uintptr_t)alignment-1))
	    != 0) {
		size_t usize, copysize;

		/*
		 * Existing object alignment is inadequate; allocate new space
		 * and copy.
		 */
		if (no_move)
			return (NULL);
		usize = sa2u(size + extra, alignment);
		if (usize == 0)
			return (NULL);
		ret = ipallocx(usize, alignment, zero, try_tcache_alloc, arena);
		if (ret == NULL) {
			if (extra == 0)
				return (NULL);
			/* Try again, without extra this time. */
			usize = sa2u(size, alignment);
			if (usize == 0)
				return (NULL);
			ret = ipallocx(usize, alignment, zero, try_tcache_alloc,
			    arena);
			if (ret == NULL)
				return (NULL);
		}
		/*
		 * 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;
		memcpy(ret, ptr, copysize);
		iqallocx(ptr, try_tcache_dalloc);
		return (ret);
	}

	if (no_move) {
		if (size <= arena_maxclass) {
			return (arena_ralloc_no_move(ptr, oldsize, size,
			    extra, zero));
		} else {
			return (huge_ralloc_no_move(ptr, oldsize, size,
			    extra));
		}
	} else {
		if (size + extra <= arena_maxclass) {
			return (arena_ralloc(arena, ptr, oldsize, size, extra,
			    alignment, zero, try_tcache_alloc,
			    try_tcache_dalloc));
		} else {
			return (huge_ralloc(ptr, oldsize, size, extra,
			    alignment, zero, try_tcache_dalloc));
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %r15d
movl %r8d, %ebp
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %r14
movq 0x58(%rsp), %rax
movq %rax, 0x8(%rsp)
movb 0x50(%rsp), %al
movb %al, 0x7(%rsp)
callq 0x76240
movq %rax, %rdx
testq %r12, %r12
je 0x76f80
leaq -0x1(%r12), %rax
testq %r14, %rax
je 0x76f80
testb %r15b, %r15b
jne 0x7706b
movq %rdx, 0x10(%rsp)
leaq (%rbx,%r13), %rdi
movq %r12, %rsi
callq 0x76af9
testq %rax, %rax
je 0x7706b
movzbl %bpl, %r15d
pushq $0x1
popq %rcx
movq %rax, %rdi
movq %r12, %rsi
movl %r15d, %edx
movq 0x8(%rsp), %r8
callq 0x779f0
testq %rax, %rax
je 0x77037
movq %rax, %rbp
movq 0x10(%rsp), %r15
cmpq %rbx, %r15
cmovbq %r15, %rbx
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x1fbd0
movzbl 0x7(%rsp), %esi
movq %r14, %rdi
callq 0x7715e
jmp 0x7706d
testb %r15b, %r15b
je 0x76fb0
leaq 0x659a4(%rip), %rax     # 0xdc930
cmpq %rbx, (%rax)
jae 0x76fe6
movq %r14, %rdi
movq %rdx, %rsi
movq %rbx, %rdx
movq %r13, %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x82634
leaq (%rbx,%r13), %rax
leaq 0x65975(%rip), %rcx     # 0xdc930
cmpq (%rcx), %rax
jbe 0x77009
movzbl %bpl, %r9d
movq %r14, %rdi
movq %rdx, %rsi
movq %rbx, %rdx
movq %r13, %rcx
movq %r12, %r8
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x826a3
movzbl %bpl, %r8d
movq %r14, %rdi
movq %rdx, %rsi
movq %rbx, %rdx
movq %r13, %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x79335
subq $0x8, %rsp
movzbl 0xf(%rsp), %eax
movzbl %bpl, %r10d
movq 0x10(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rcx
movq %r13, %r8
movq %r12, %r9
pushq %rax
pushq $0x1
pushq %r10
callq 0x796d0
addq $0x38, %rsp
jmp 0x77074
testq %r13, %r13
je 0x7706b
movq %rbx, %rdi
movq %r12, %rsi
callq 0x76af9
testq %rax, %rax
je 0x7706b
pushq $0x1
popq %rcx
movq %rax, %rdi
movq %r12, %rsi
movl %r15d, %edx
movq 0x8(%rsp), %r8
callq 0x779f0
testq %rax, %rax
jne 0x76f51
xorl %ebp, %ebp
movq %rbp, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq