// File: /workspace/github_c_makefile_star2_O3/zhou-yuxin[P]redis-aof-no-cow/deps/jemalloc/src/jemalloc.c
// Function: je_xallocx
JEMALLOC_NOTHROW
je_xallocx(void *ptr, size_t size, size_t extra, int flags)
{
	tsd_t *tsd;
	size_t usize, old_usize;
	UNUSED size_t old_rzsize JEMALLOC_CC_SILENCE_INIT(0);
	size_t alignment = MALLOCX_ALIGN_GET(flags);
	bool zero = flags & MALLOCX_ZERO;

	assert(ptr != NULL);
	assert(size != 0);
	assert(SIZE_T_MAX - size >= extra);
	assert(malloc_initialized() || IS_INITIALIZER);
	malloc_thread_init();
	tsd = tsd_fetch();
	witness_assert_lockless(tsd_tsdn(tsd));

	old_usize = isalloc(tsd_tsdn(tsd), ptr, config_prof);

	/*
	 * The API explicitly absolves itself of protecting against (size +
	 * extra) numerical overflow, but we may need to clamp extra to avoid
	 * exceeding HUGE_MAXCLASS.
	 *
	 * Ordinarily, size limit checking is handled deeper down, but here we
	 * have to check as part of (size + extra) clamping, since we need the
	 * clamped value in the above helper functions.
	 */
	if (unlikely(size > HUGE_MAXCLASS)) {
		usize = old_usize;
		goto label_not_resized;
	}
	if (unlikely(HUGE_MAXCLASS - size < extra))
		extra = HUGE_MAXCLASS - size;

	if (config_valgrind && unlikely(in_valgrind))
		old_rzsize = u2rz(old_usize);

	if (config_prof && opt_prof) {
		usize = ixallocx_prof(tsd, ptr, old_usize, size, extra,
		    alignment, zero);
	} else {
		usize = ixallocx_helper(tsd_tsdn(tsd), ptr, old_usize, size,
		    extra, alignment, zero);
	}
	if (unlikely(usize == old_usize))
		goto label_not_resized;

	if (config_stats) {
		*tsd_thread_allocatedp_get(tsd) += usize;
		*tsd_thread_deallocatedp_get(tsd) += old_usize;
	}
	JEMALLOC_VALGRIND_REALLOC(no, tsd_tsdn(tsd), ptr, usize, no, ptr,
	    old_usize, old_rzsize, no, zero);
label_not_resized:
	UTRACE(ptr, size, ptr);
	witness_assert_lockless(tsd_tsdn(tsd));
	return (usize);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
movl $0x1, %ebp
shlq %cl, %rbp
movq %fs:0x0, %r14
addq 0x2cfeb(%rip), %r14     # 0x4bfe8
cmpq $0x0, 0x2d523(%rip)     # 0x4c528
jne 0x1f165
movq 0x2cfd6(%rip), %rdx     # 0x4bfe8
movl %fs:(%rdx), %eax
testl %eax, %eax
je 0x1f1d2
cmpl $0x2, %eax
je 0x1f27f
leaq 0x2e0a3(%rip), %rdi     # 0x4d0d0
movq (%rdi), %rax
notq %rax
andq %rbx, %rax
cmpq %rbx, %rax
je 0x1f178
movq %rbx, %rsi
subq %rax, %rsi
shrq $0xc, %rsi
leaq 0x2df70(%rip), %rdx     # 0x4cfc0
subq (%rdx), %rsi
movq 0x78(%rax,%rsi,8), %r15
movl %r15d, %eax
shrl $0x5, %eax
movl $0xff, %edx
andl %edx, %eax
cmpl %edx, %eax
je 0x1f198
movl %eax, %eax
leaq 0x1c64a(%rip), %rdx     # 0x3b6c0
movq (%rdx,%rax,8), %r15
movabsq $0x7000000000000000, %rax # imm = 0x7000000000000000
cmpq %rax, %r13
ja 0x1f0dd
subq %r13, %rax
cmpq %r12, %rax
jb 0x1f1ae
andq $-0x2, %rbp
cmpb $0x1, 0x2d4fc(%rip)     # 0x4c59c
je 0x1f1b6
testq %rbp, %rbp
je 0x1f0b3
decq %rbp
testq %rbx, %rbp
jne 0x1f0dd
movq %rdi, %rbp
movl %ecx, 0x4(%rsp)
movl %ecx, %r9d
andl $0x40, %r9d
shrl $0x6, %r9d
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r13, %rcx
movq %r12, %r8
callq 0xdaec
testb %al, %al
je 0x1f0e2
movq %r15, %r12
jmp 0x1f153
movq (%rbp), %rax
notq %rax
andq %rbx, %rax
cmpq %rbx, %rax
je 0x1f1de
movq %rbx, %rcx
subq %rax, %rcx
shrq $0xc, %rcx
leaq 0x2deba(%rip), %rdx     # 0x4cfc0
subq (%rdx), %rcx
movq 0x78(%rax,%rcx,8), %r12
movl %r12d, %eax
shrl $0x5, %eax
movl $0xff, %ecx
andl %ecx, %eax
cmpl %ecx, %eax
je 0x1f269
movl %eax, %eax
leaq 0x1c594(%rip), %rcx     # 0x3b6c0
movq (%rcx,%rax,8), %r12
movq 0x2ceb1(%rip), %rbp     # 0x4bfe8
cmpq %r15, %r12
je 0x1f0dd
addq %r12, %fs:0x10(%rbp)
addq %r15, %fs:0x18(%rbp)
cmpb $0x1, 0x2d44f(%rip)     # 0x4c59c
je 0x1f1f1
movq %r12, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
movl %ecx, %r15d
callq 0xc1d2
movl %r15d, %ecx
jmp 0x1f00b
movq %r14, %rdi
movq %rbx, %rsi
movl %ecx, %r15d
callq 0x2e344
leaq 0x2df43(%rip), %rdi     # 0x4d0d0
movl %r15d, %ecx
movq %rax, %r15
jmp 0x1f07a
shrq %r15
andq $-0x1000, %r15          # imm = 0xF000
addq $-0x1000, %r15          # imm = 0xF000
jmp 0x1f07a
movq %rax, %r12
jmp 0x1f095
movq %r15, %rdi
movl %ecx, 0x4(%rsp)
callq 0x1d22e
leaq 0x2df07(%rip), %rdi     # 0x4d0d0
movl 0x4(%rsp), %ecx
jmp 0x1f0a6
movl $0x1, %fs:(%rdx)
jmp 0x1f286
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2e344
movq %rax, %r12
jmp 0x1f130
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1b9d9
leaq 0x10(%rsp), %rcx
movq $0x130b, (%rcx)         # imm = 0x130B
movq %rbx, 0x8(%rcx)
movq %r15, 0x10(%rcx)
movq %r12, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movq $0x0, 0x28(%rcx)
movq %rcx, %rax
xorl %edx, %edx
rolq $0x3, %rdi
rolq $0xd, %rdi
rolq $0x3d, %rdi
rolq $0x33, %rdi
xchgq %rbx, %rbx
movq %rdx, 0x8(%rsp)
movq 0x8(%rsp), %rax
testb $0x40, 0x4(%rsp)
je 0x1f153
movq %r12, %rsi
subq %r15, %rsi
jbe 0x1f153
addq %rbx, %r15
movq %r15, %rdi
callq 0x37704
jmp 0x1f153
shrq %r12
andq $-0x1000, %r12          # imm = 0xF000
addq $-0x1000, %r12          # imm = 0xF000
jmp 0x1f130
movl $0x3, %fs:(%rdx)
leaq 0x2e247(%rip), %rax     # 0x4d4d4
movl (%rax), %edi
movq %r14, %rsi
movl %ecx, %r15d
callq 0xb5b0
movl %r15d, %ecx
testl %eax, %eax
je 0x1f026
leaq 0x1cf55(%rip), %rdi     # 0x3c201
callq 0x3645c
movl %r15d, %ecx
cmpb $0x1, 0x2d265(%rip)     # 0x4c520
jne 0x1f026
callq 0xb070