// File: /workspace/github_c_makefile_star2_O1/erikdubbelboer[P]discnt/deps/jemalloc/src/arena.c
// Function: arena_avail_insert
static arena_chunk_t *
arena_chunk_alloc_internal_hard(arena_t *arena, chunk_hooks_t *chunk_hooks,
    bool *zero, bool *commit)
{
	arena_chunk_t *chunk;

	malloc_mutex_unlock(&arena->lock);

	chunk = (arena_chunk_t *)chunk_alloc_wrapper(arena, chunk_hooks, NULL,
	    chunksize, chunksize, zero, commit);
	if (chunk != NULL && !*commit) {
		/* Commit header. */
		if (chunk_hooks->commit(chunk, chunksize, 0, map_bias <<
		    LG_PAGE, arena->ind)) {
			chunk_dalloc_wrapper(arena, chunk_hooks,
			    (void *)chunk, chunksize, *commit);
			chunk = NULL;
		}
	}
	if (chunk != NULL && arena_chunk_register(arena, chunk, *zero)) {
		if (!*commit) {
			/* Undo commit of header. */
			chunk_hooks->decommit(chunk, chunksize, 0, map_bias <<
			    LG_PAGE, arena->ind);
		}
		chunk_dalloc_wrapper(arena, chunk_hooks, (void *)chunk,
		    chunksize, *commit);
		chunk = NULL;
	}

	malloc_mutex_lock(&arena->lock);
	return (chunk);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x838, %rsp            # imm = 0x838
addq 0x4681a(%rip), %rsi     # 0x84550
leaq (%rdx,%rdx,2), %rax
shlq $0x5, %rax
addq %rsi, %rax
xorl %ecx, %ecx
subq 0x467fe(%rip), %rcx     # 0x84548
leaq (%rcx,%rcx,2), %rcx
shlq $0x5, %rcx
leaq (%rax,%rcx), %r13
leaq 0xf8(%rdi), %rsi
movq %rsi, (%rcx,%rax)
movq %rsi, %rdx
orq $0x1, %rdx
movq %rdx, 0x8(%rcx,%rax)
movq %rdi, 0x8(%rsp)
movq 0xf0(%rdi), %rbx
leaq 0x30(%rsp), %r12
movq %rbx, (%r12)
movq %rsi, 0x28(%rsp)
cmpq %rsi, %rbx
je 0x3de91
leaq 0x46909(%rip), %rax     # 0x846a0
movq (%rax), %r14
notq %r14
movq %r14, %rax
andq %r13, %rax
movq 0x467a6(%rip), %rcx     # 0x84550
movq %rax, 0x18(%rsp)
movq %rcx, 0x20(%rsp)
addq %rax, %rcx
movq %r13, %rax
subq %rcx, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rcx
shrq $0x6, %rdx
movq %rdx, 0x10(%rsp)
movabsq $0x7ffffffffffff000, %rbp # imm = 0x7FFFFFFFFFFFF000
movq %r13, %rdi
testb $0x1, %r13b
jne 0x3ddf5
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %rcx
movq 0x68(%rax,%rcx,8), %rdi
shrq %rdi
andq %rbp, %rdi
callq 0x3dfa2
movq %rax, %r15
movq %rbx, %rcx
andq %r14, %rcx
movq 0x20(%rsp), %rax
leaq (%rax,%rcx), %rdx
movq %rbx, %rax
subq %rdx, %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rdx
shrq $0x6, %rdx
movq 0x68(%rcx,%rdx,8), %rdi
shrq %rdi
andq %rbp, %rdi
callq 0x3dfa2
xorl %ecx, %ecx
cmpq %rax, %r15
seta %cl
sbbl $0x0, %ecx
cmpq %rax, %r15
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmovel %edx, %ecx
testb $0x1, %r13b
jne 0x3de67
cmpq %rax, %r15
jne 0x3de67
xorl %ecx, %ecx
cmpq %r13, %rbx
seta %cl
sbbl $0x0, %ecx
negl %ecx
movl %ecx, 0x8(%r12)
testl %ecx, %ecx
js 0x3de7a
movq 0x8(%rbx), %rbx
andq $-0x2, %rbx
jmp 0x3de7d
movq (%rbx), %rbx
movq %rbx, 0x10(%r12)
addq $0x10, %r12
cmpq 0x28(%rsp), %rbx
jne 0x3dddd
movq %r13, (%r12)
addq $-0x10, %r12
leaq 0x30(%rsp), %rax
cmpq %rax, %r12
jb 0x3df7b
movq (%r12), %rdx
movq 0x10(%r12), %rcx
cmpl $0x0, 0x8(%r12)
js 0x3df09
movq 0x8(%rdx), %rdi
andl $0x1, %edi
orq %rcx, %rdi
movq %rdi, 0x8(%rdx)
movq 0x8(%rcx), %rsi
testb $0x1, %sil
je 0x3df65
movq (%rdx), %r8
movq 0x8(%r8), %r9
testb $0x1, %r9b
jne 0x3df45
andl $0x1, %edi
movq %rcx, %r8
andq $-0x2, %r8
movq (%r8), %rcx
orq %rdi, %rcx
movq %rcx, 0x8(%rdx)
movq %rdx, (%r8)
leaq 0x8(%r8), %rcx
movq 0x8(%r8), %r9
andq $-0x2, %r9
orq %rdi, %r9
jmp 0x3df5b
movq %rcx, (%rdx)
movq 0x8(%rcx), %rsi
testb $0x1, %sil
je 0x3df65
movq (%rcx), %rdi
movq 0x8(%rdi), %r8
testb $0x1, %r8b
je 0x3df65
andq $-0x2, %r8
movq %r8, 0x8(%rdi)
movq 0x8(%rcx), %rdi
movq %rdi, %r8
andq $-0x2, %r8
movq %r8, (%rdx)
andl $0x1, %edi
orq %rdx, %rdi
movq %rdi, 0x8(%rcx)
jmp 0x3df68
addq $0x8, %rcx
andq $-0x2, %r9
movq %r9, 0x8(%r8)
movq (%rcx), %r9
andq $-0x2, %r9
movq %rdx, %r8
movq %r9, (%rcx)
orb $0x1, 0x8(%rdx)
movq %r8, %rdx
movq %rdx, %rcx
testb $0x1, %sil
je 0x3df90
movq %rcx, (%r12)
addq $-0x10, %r12
jmp 0x3de9e
movq 0x30(%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rax, 0xf0(%rcx)
andb $-0x2, 0x8(%rax)
addq $0x838, %rsp            # imm = 0x838
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq