// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/deps/jemalloc/src/arena.c
// Function: arena_chunk_alloc
static arena_chunk_t *
arena_chunk_alloc(arena_t *arena)
{
	arena_chunk_t *chunk;
	size_t i;

	if (arena->spare != NULL) {
		chunk = arena->spare;
		arena->spare = NULL;

		assert(arena_mapbits_allocated_get(chunk, map_bias) == 0);
		assert(arena_mapbits_allocated_get(chunk, chunk_npages-1) == 0);
		assert(arena_mapbits_unallocated_size_get(chunk, map_bias) ==
		    arena_maxclass);
		assert(arena_mapbits_unallocated_size_get(chunk,
		    chunk_npages-1) == arena_maxclass);
		assert(arena_mapbits_dirty_get(chunk, map_bias) ==
		    arena_mapbits_dirty_get(chunk, chunk_npages-1));
	} else {
		bool zero;
		size_t unzeroed;

		zero = false;
		malloc_mutex_unlock(&arena->lock);
		chunk = (arena_chunk_t *)chunk_alloc(chunksize, chunksize,
		    false, &zero, arena->dss_prec);
		malloc_mutex_lock(&arena->lock);
		if (chunk == NULL)
			return (NULL);
		if (config_stats)
			arena->stats.mapped += chunksize;

		chunk->arena = arena;

		/*
		 * Claim that no pages are in use, since the header is merely
		 * overhead.
		 */
		chunk->ndirty = 0;

		chunk->nruns_avail = 0;
		chunk->nruns_adjac = 0;

		/*
		 * Initialize the map to contain one maximal free untouched run.
		 * Mark the pages as zeroed iff chunk_alloc() returned a zeroed
		 * chunk.
		 */
		unzeroed = zero ? 0 : CHUNK_MAP_UNZEROED;
		arena_mapbits_unallocated_set(chunk, map_bias, arena_maxclass,
		    unzeroed);
		/*
		 * There is no need to initialize the internal page map entries
		 * unless the chunk is not zeroed.
		 */
		if (zero == false) {
			for (i = map_bias+1; i < chunk_npages-1; i++)
				arena_mapbits_unzeroed_set(chunk, i, unzeroed);
		} else if (config_debug) {
			for (i = map_bias+1; i < chunk_npages-1; i++) {
				assert(arena_mapbits_unzeroed_get(chunk, i) ==
				    unzeroed);
			}
		}
		arena_mapbits_unallocated_set(chunk, chunk_npages-1,
		    arena_maxclass, unzeroed);
	}

	/* Insert the run into the runs_avail tree. */
	arena_avail_insert(arena, chunk, map_bias, chunk_npages-map_bias,
	    false, false);

	return (chunk);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0xe0(%rax)
je 0xb98bf
movq -0x10(%rbp), %rax
movq 0xe0(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, 0xe0(%rax)
jmp 0xb98aa
jmp 0xb98ac
jmp 0xb98ae
jmp 0xb98b0
jmp 0xb98b2
jmp 0xb98b4
jmp 0xb98b6
jmp 0xb98b8
jmp 0xb98ba
jmp 0xb9a18
movb $0x0, -0x21(%rbp)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0xb5ee0
leaq 0x6f8d9(%rip), %rax     # 0x1291b0
movq (%rax), %rdi
leaq 0x6f8cf(%rip), %rax     # 0x1291b0
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movl 0x88(%rax), %r8d
xorl %edx, %edx
leaq -0x21(%rbp), %rcx
callq 0xc0250
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0xb5d20
cmpq $0x0, -0x18(%rbp)
jne 0xb991f
movq $0x0, -0x8(%rbp)
jmp 0xb9a51
leaq 0x6f88a(%rip), %rax     # 0x1291b0
movq (%rax), %rcx
movq -0x10(%rbp), %rax
addq 0x30(%rax), %rcx
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x28(%rax)
movb -0x21(%rbp), %dl
movl $0x4, %eax
xorl %ecx, %ecx
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x6f8f4(%rip), %rax     # 0x129278
movq (%rax), %rsi
leaq 0x6f8f2(%rip), %rax     # 0x129280
movq (%rax), %rdx
movq -0x30(%rbp), %rcx
callq 0xba100
movb -0x21(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xb99f1
leaq 0x6f8ca(%rip), %rax     # 0x129278
movq (%rax), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
leaq 0x6f814(%rip), %rcx     # 0x1291d8
movq (%rcx), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0xb99ef
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0xba0b0
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0xb99b9
jmp 0xb99f3
jmp 0xb99f3
movq -0x18(%rbp), %rdi
leaq 0x6f7da(%rip), %rax     # 0x1291d8
movq (%rax), %rsi
subq $0x1, %rsi
leaq 0x6f874(%rip), %rax     # 0x129280
movq (%rax), %rdx
movq -0x30(%rbp), %rcx
callq 0xba100
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0x6f851(%rip), %rax     # 0x129278
movq (%rax), %rdx
leaq 0x6f7a7(%rip), %rax     # 0x1291d8
movq (%rax), %rcx
leaq 0x6f83d(%rip), %rax     # 0x129278
subq (%rax), %rcx
xorl %r9d, %r9d
movl %r9d, %r8d
callq 0xba150
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)