// File: /workspace/github_c_makefile_star2_O1/erikdubbelboer[P]discnt/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();

	old_usize = isalloc(ptr, config_prof);

	/* Clamp extra if necessary to avoid (size + extra) overflow. */
	if (unlikely(size + extra > HUGE_MAXCLASS)) {
		/* Check for size overflow. */
		if (unlikely(size > HUGE_MAXCLASS)) {
			usize = old_usize;
			goto label_not_resized;
		}
		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(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(false, ptr, usize, false, ptr, old_usize,
	    old_rzsize, false, zero);
label_not_resized:
	UTRACE(ptr, size, ptr);
	return (usize);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r9
movl $0x1, %ebx
shlq %cl, %rbx
movq %rsi, %r13
movq %rdi, %r14
cmpq $0x0, 0x4b9af(%rip)     # 0x83738
jne 0x37eef
movq 0x36252(%rip), %rdi     # 0x6dfe8
movq %fs:0x0, %rsi
addq %rdi, %rsi
movl %fs:(%rdi), %eax
testl %eax, %eax
je 0x37feb
cmpl $0x2, %eax
je 0x3801f
leaq 0x4c8e3(%rip), %r8      # 0x846a0
movq (%r8), %rax
notq %rax
andq %r14, %rax
cmpq %r14, %rax
je 0x37f03
movq %r14, %rsi
subq %rax, %rsi
shrq $0xc, %rsi
leaq 0x4c768(%rip), %rdx     # 0x84548
subq (%rdx), %rsi
movq 0x68(%rax,%rsi,8), %r15
movl %r15d, %eax
shrl $0x5, %eax
movl $0xff, %edx
andl %edx, %eax
cmpl %edx, %eax
je 0x37f60
movl %eax, %eax
leaq 0x2127a(%rip), %rdx     # 0x59080
movq (%rdx,%rax,8), %r15
movabsq $-0x2000000000000000, %rax # imm = 0xE000000000000000
leaq (%r9,%r13), %rdx
cmpq %rax, %rdx
ja 0x37f2a
andq $-0x2, %rbx
cmpb $0x1, 0x4b968(%rip)     # 0x83794
je 0x37f3b
testq %rbx, %rbx
je 0x37e42
decq %rbx
movq %r15, %rbp
testq %r14, %rbx
jne 0x37ec1
movl %ecx, %ebx
movq %r8, %rbp
movl %ecx, %r8d
andl $0x40, %r8d
shrl $0x6, %r8d
movq %rdi, %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %r9, %rcx
callq 0x3bb54
movq %rbp, %rdx
movq %r12, %rdi
movl %ebx, %ecx
movq %r15, %rbp
testb %al, %al
jne 0x37ec1
movq (%rdx), %rax
notq %rax
andq %r14, %rax
cmpq %r14, %rax
je 0x37ff4
movq %r14, %rsi
subq %rax, %rsi
shrq $0xc, %rsi
leaq 0x4c6b0(%rip), %rdx     # 0x84548
subq (%rdx), %rsi
movq 0x68(%rax,%rsi,8), %rbp
movl %ebp, %eax
shrl $0x5, %eax
movl $0xff, %edx
andl %edx, %eax
cmpl %edx, %eax
je 0x38009
movl %eax, %eax
leaq 0x211c3(%rip), %rdx     # 0x59080
movq (%rdx,%rax,8), %rbp
cmpq %r15, %rbp
je 0x37edd
addq %rbp, %fs:0x10(%rdi)
addq %r15, %fs:0x18(%rdi)
cmpb $0x1, 0x4b8bd(%rip)     # 0x83794
je 0x37f76
movq %rbp, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ecx, %ebp
movq %r9, %r15
callq 0x13770
movq %r15, %r9
movl %ebp, %ecx
jmp 0x37d8f
movq %rdi, %r15
movq %r14, %rdi
movl %ecx, %ebp
movq %r9, %r12
callq 0x48cd7
leaq 0x4c786(%rip), %r8      # 0x846a0
movq %r12, %r9
movq %r15, %rdi
movl %ebp, %ecx
movq %rax, %r15
jmp 0x37e0a
subq %r13, %rax
jb 0x38072
movq %rax, %r9
jmp 0x37e21
movq %r15, %rdi
movl %ecx, %ebp
movq %r9, %r12
callq 0x363f8
leaq 0x4c751(%rip), %r8      # 0x846a0
movq %r12, %r9
movq 0x3608f(%rip), %rdi     # 0x6dfe8
movl %ebp, %ecx
jmp 0x37e32
shrq %r15
andq $-0x1000, %r15          # imm = 0xF000
addq $-0x1000, %r15          # imm = 0xF000
jmp 0x37e0a
movq %r14, %rdi
movl %ecx, %ebx
callq 0x350e7
leaq 0x10(%rsp), %rcx
movq $0x130b, (%rcx)         # imm = 0x130B
movq %r14, 0x8(%rcx)
movq %r15, 0x10(%rcx)
movq %rbp, 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, %bl
je 0x37edd
movq %rbp, %rsi
subq %r15, %rsi
jbe 0x37edd
addq %r14, %r15
movq %r15, %rdi
callq 0x50824
jmp 0x37edd
movl $0x1, %fs:(%rdi)
jmp 0x38026
movq %r14, %rdi
callq 0x48cd7
movq %r12, %rdi
movl %ebx, %ecx
movq %rax, %rbp
jmp 0x37ec1
shrq %rbp
andq $-0x1000, %rbp          # imm = 0xF000
addq $-0x1000, %rbp          # imm = 0xF000
jmp 0x37ec1
movl $0x3, %fs:(%rdi)
leaq 0x4cdd7(%rip), %rax     # 0x84e04
movq %rdi, %r15
movl (%rax), %edi
movl %ecx, %ebp
movq %r9, %r12
callq 0x12990
movq %r12, %r9
movq %r15, %rdi
movl %ebp, %ecx
testl %eax, %eax
je 0x37db6
leaq 0x21b61(%rip), %rdi     # 0x59bb4
callq 0x4f37c
movq %r12, %r9
movq %r15, %rdi
movl %ebp, %ecx
cmpb $0x1, 0x4b6c9(%rip)     # 0x83730
jne 0x37db6
callq 0x120c0
movq %r15, %rbp
jmp 0x37edd