// File: /workspace/github_c_makefile_star2_O2/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, %r15
movq %rsi, %r12
movq %rdi, %rbx
pushq $0x1
popq %rbp
shlq %cl, %rbp
movq %fs:0x0, %r14
addq 0x30d58(%rip), %r14     # 0x47ff0
cmpq $0x0, 0x31288(%rip)     # 0x48528
jne 0x17400
movq 0x30d43(%rip), %rdx     # 0x47ff0
movl %fs:(%rdx), %eax
testl %eax, %eax
je 0x17496
cmpl $0x2, %eax
je 0x17543
leaq 0x31e08(%rip), %rdi     # 0x490d0
movq (%rdi), %rax
notq %rax
andq %rbx, %rax
cmpq %rbx, %rax
je 0x1743c
movq %rbx, %rsi
subq %rax, %rsi
shrq $0xc, %rsi
leaq 0x31cd5(%rip), %rdx     # 0x48fc0
subq (%rdx), %rsi
movq 0x78(%rax,%rsi,8), %r13
movl %r13d, %eax
shrl $0x5, %eax
movl $0xff, %edx
andl %edx, %eax
cmpl %edx, %eax
je 0x1745c
movl %eax, %eax
leaq 0x1ef2f(%rip), %rdx     # 0x36240
movq (%rdx,%rax,8), %r13
movabsq $0x7000000000000000, %rax # imm = 0x7000000000000000
cmpq %rax, %r12
ja 0x17378
subq %r12, %rax
cmpq %r15, %rax
jb 0x17472
andq $-0x2, %rbp
cmpb $0x1, 0x31261(%rip)     # 0x4859c
je 0x1747a
testq %rbp, %rbp
je 0x1734e
decq %rbp
testq %rbx, %rbp
jne 0x17378
movq %rdi, %rbp
movl %ecx, 0x4(%rsp)
movl %ecx, %r9d
andl $0x40, %r9d
shrl $0x6, %r9d
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r12, %rcx
movq %r15, %r8
callq 0x1cc9f
testb %al, %al
je 0x1737d
movq %r13, %r15
jmp 0x173ee
movq (%rbp), %rax
notq %rax
andq %rbx, %rax
cmpq %rbx, %rax
je 0x174a2
movq %rbx, %rcx
subq %rax, %rcx
shrq $0xc, %rcx
leaq 0x31c1f(%rip), %rdx     # 0x48fc0
subq (%rdx), %rcx
movq 0x78(%rax,%rcx,8), %r15
movl %r15d, %eax
shrl $0x5, %eax
movl $0xff, %ecx
andl %ecx, %eax
cmpl %ecx, %eax
je 0x1752d
movl %eax, %eax
leaq 0x1ee79(%rip), %rcx     # 0x36240
movq (%rcx,%rax,8), %r15
movq 0x30c1e(%rip), %rbp     # 0x47ff0
cmpq %r13, %r15
je 0x17378
addq %r15, %fs:0x10(%rbp)
addq %r13, %fs:0x18(%rbp)
cmpb $0x1, 0x311b4(%rip)     # 0x4859c
je 0x174b5
movq %r15, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x30be9(%rip), %r13     # 0x47ff0
movl %fs:(%r13), %eax
testl %eax, %eax
je 0x1758a
cmpl $0x2, %eax
je 0x17595
cmpq $0x0, %fs:0x50(%r13)
jne 0x172a6
movq %r14, %rdi
movl %ecx, %r13d
callq 0x2ac50
movl %r13d, %ecx
jmp 0x172a6
movq %r14, %rdi
movq %rbx, %rsi
movl %ecx, %r13d
callq 0x292e1
leaq 0x31c7f(%rip), %rdi     # 0x490d0
movl %r13d, %ecx
movq %rax, %r13
jmp 0x17315
shrq %r13
andq $-0x1000, %r13          # imm = 0xF000
addq $-0x1000, %r13          # imm = 0xF000
jmp 0x17315
movq %rax, %r15
jmp 0x17330
movq %r13, %rdi
movl %ecx, 0x4(%rsp)
callq 0x1532f
leaq 0x31c43(%rip), %rdi     # 0x490d0
movl 0x4(%rsp), %ecx
jmp 0x17341
movl $0x1, %fs:(%rdx)
jmp 0x1754a
movq %r14, %rdi
movq %rbx, %rsi
callq 0x292e1
movq %rax, %r15
jmp 0x173cb
movq %r14, %rdi
movq %rbx, %rsi
callq 0x13779
leaq 0x10(%rsp), %rcx
movq $0x130b, (%rcx)         # imm = 0x130B
movq %rbx, 0x8(%rcx)
movq %r13, 0x10(%rcx)
movq %r15, 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 0x173ee
movq %r15, %rsi
subq %r13, %rsi
jbe 0x173ee
addq %rbx, %r13
movq %r13, %rdi
callq 0x324d8
jmp 0x173ee
shrq %r15
andq $-0x1000, %r15          # imm = 0xF000
addq $-0x1000, %r15          # imm = 0xF000
jmp 0x173cb
movl $0x3, %fs:(%rdx)
leaq 0x31f83(%rip), %rax     # 0x494d4
movl (%rax), %edi
movq %r14, %rsi
movl %ecx, %r13d
callq 0xb5b0
movl %r13d, %ecx
testl %eax, %eax
je 0x172c1
leaq 0x1f811(%rip), %rdi     # 0x36d81
callq 0x3126c
movl %r13d, %ecx
cmpb $0x1, 0x30fa1(%rip)     # 0x48520
jne 0x172c1
callq 0xb070
movl $0x1, %fs:(%r13)
jmp 0x1759e
movl $0x3, %fs:(%r13)
leaq 0x31f2f(%rip), %rax     # 0x494d4
movl (%rax), %edi
movq %r14, %rsi
movl %ecx, 0x4(%rsp)
callq 0xb5b0
movl 0x4(%rsp), %ecx
testl %eax, %eax
je 0x1741d
leaq 0x1f7bb(%rip), %rdi     # 0x36d81
callq 0x3126c
movl 0x4(%rsp), %ecx
cmpb $0x1, 0x30f4a(%rip)     # 0x48520
jne 0x1741d
jmp 0x17585