// File: /workspace/github_c_makefile_star2_O1/erikdubbelboer[P]discnt/deps/jemalloc/src/arena.c
// Function: je_arena_chunk_ralloc_huge_expand
bool
arena_chunk_ralloc_huge_expand(arena_t *arena, void *chunk, size_t oldsize,
    size_t usize, bool *zero)
{
	bool err;
	chunk_hooks_t chunk_hooks = chunk_hooks_get(arena);
	void *nchunk = (void *)((uintptr_t)chunk + CHUNK_CEILING(oldsize));
	size_t udiff = usize - oldsize;
	size_t cdiff = CHUNK_CEILING(usize) - CHUNK_CEILING(oldsize);

	malloc_mutex_lock(&arena->lock);

	/* Optimistically update stats. */
	if (config_stats) {
		arena_huge_ralloc_stats_update(arena, oldsize, usize);
		arena->stats.mapped += cdiff;
	}
	arena->nactive += (udiff >> LG_PAGE);

	err = (chunk_alloc_cache(arena, &arena->chunk_hooks, nchunk, cdiff,
	    chunksize, zero, true) == NULL);
	malloc_mutex_unlock(&arena->lock);
	if (err) {
		err = arena_chunk_ralloc_huge_expand_hard(arena, &chunk_hooks,
		    chunk, oldsize, usize, zero, nchunk, udiff,
		    cdiff);
	} else if (chunk_hooks.merge(chunk, CHUNK_CEILING(oldsize), nchunk,
	    cdiff, true, arena->ind)) {
		chunk_dalloc_arena(arena, &chunk_hooks, nchunk, cdiff, *zero,
		    true);
		err = true;
	}

	if (config_stats && !err)
		stats_cactive_add(udiff);
	return (err);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r8, 0x28(%rsp)
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, 0x20(%rsp)
movq %rdi, %rbx
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x403f3
leaq 0x4a5c9(%rip), %rax     # 0x846a0
movq (%rax), %r14
leaq (%r14,%r12), %r13
movq %r14, %rax
notq %rax
andq %rax, %r13
movq %r15, %rbp
subq %r12, %rbp
addq %r15, %r14
andq %rax, %r14
subq %r13, %r14
addq 0x20(%rsp), %r13
leaq 0x8(%rbx), %rdi
movq %rdi, 0x40(%rsp)
callq 0x12960
movq %rbx, %rdi
movq %r12, 0x38(%rsp)
movq %r12, %rsi
callq 0x39eb3
movq %rbx, %rdi
movq %r15, 0x30(%rsp)
movq %r15, %rsi
callq 0x39d9f
addq %r14, 0x30(%rbx)
movq %rbp, 0x48(%rsp)
shrq $0xc, %rbp
addq %rbp, 0xe0(%rbx)
leaq 0x418(%rbx), %rsi
leaq 0x4a54d(%rip), %r12     # 0x84698
movq (%r12), %r8
movl $0x1, (%rsp)
movq %rbx, %rdi
movq %r13, 0x18(%rsp)
movq %r13, %rdx
movq %r14, %rcx
movq 0x28(%rsp), %r9
callq 0x406a5
movq %rax, %r15
movq 0x40(%rsp), %rdi
callq 0x125c0
testq %r15, %r15
je 0x3a19f
movq 0x28(%rsp), %r15
leaq 0x4a514(%rip), %rax     # 0x846a0
movq (%rax), %rsi
movq 0x38(%rsp), %rax
addq %rsi, %rax
notq %rsi
andq %rax, %rsi
jmp 0x3a1eb
movq %r12, %rcx
movq 0x38(%rsp), %r12
leaq 0x17(%rsp), %rax
movb $0x1, (%rax)
movq (%rcx), %r8
movq %rax, (%rsp)
leaq 0x50(%rsp), %rsi
movq %rbx, %rdi
movq 0x18(%rsp), %rdx
movq %r14, %rcx
movq 0x28(%rsp), %r15
movq %r15, %r9
callq 0x40b77
testq %rax, %rax
je 0x3a231
leaq 0x4a4c1(%rip), %rax     # 0x846a0
movq (%rax), %rsi
addq %rsi, %r12
notq %rsi
andq %r12, %rsi
movl (%rbx), %r9d
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rdx
movq %r14, %rcx
movl $0x1, %r8d
callq *0x80(%rsp)
testb %al, %al
je 0x3a22d
movzbl (%r15), %r8d
leaq 0x50(%rsp), %rsi
movq %rbx, %rdi
movq 0x18(%rsp), %rdx
movq %r14, %rcx
movl $0x1, %r9d
callq 0x40fec
jmp 0x3a2ab
xorl %eax, %eax
jmp 0x3a2ad
movq 0x40(%rsp), %r13
movq %r13, %rdi
callq 0x12960
cmpq $0x1000, %r12           # imm = 0x1000
ja 0x3a2d4
leaq -0x1(%r12), %rax
shrq $0x3, %rax
leaq 0x1f5a5(%rip), %rcx     # 0x59800
movzbl (%rcx,%rax), %eax
movq 0x30(%rsp), %rsi
subl 0x4a2d6(%rip), %eax     # 0x84540
addl $-0x24, %eax
decq 0x90(%rbx)
addq %r12, 0x80(%rbx)
movq 0xa0(%rbx), %rcx
leaq (%rax,%rax,2), %rax
decq 0x8(%rcx,%rax,8)
incq 0x10(%rcx,%rax,8)
movq %rbx, %rdi
callq 0x3d97c
subq %r14, 0x30(%rbx)
subq %rbp, 0xe0(%rbx)
movq %r13, %rdi
callq 0x125c0
movb $0x1, %al
testb %al, %al
jne 0x3a2c2
leaq 0x4aae0(%rip), %rcx     # 0x84d98
movq 0x48(%rsp), %rdx
lock
xaddq %rdx, (%rcx)
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
callq 0x3fb29
jmp 0x3a25f