// File: /workspace/github_c_makefile_star2_O2/nilyang[P]redis-tdd-annotation/deps/jemalloc/src/arena.c
// Function: arena_avail_insert
static void
arena_avail_insert(arena_t *arena, arena_chunk_t *chunk, size_t pageind,
    size_t npages, bool maybe_adjac_pred, bool maybe_adjac_succ)
{

	assert(npages == (arena_mapbits_unallocated_size_get(chunk, pageind) >>
	    LG_PAGE));

	/*
	 * chunks_dirty is keyed by nruns_{avail,adjac}, so the chunk must be
	 * removed and reinserted even if the run to be inserted is clean.
	 */
	if (chunk->ndirty != 0)
		arena_chunk_dirty_remove(&arena->chunks_dirty, chunk);

	if (maybe_adjac_pred && arena_avail_adjac_pred(chunk, pageind))
		chunk->nruns_adjac++;
	if (maybe_adjac_succ && arena_avail_adjac_succ(chunk, pageind, npages))
		chunk->nruns_adjac++;
	chunk->nruns_avail++;
	assert(chunk->nruns_avail > chunk->nruns_adjac);

	if (arena_mapbits_dirty_get(chunk, pageind) != 0) {
		arena->ndirty += npages;
		chunk->ndirty += npages;
	}
	if (chunk->ndirty != 0)
		arena_chunk_dirty_insert(&arena->chunks_dirty, chunk);

	arena_avail_tree_insert(&arena->runs_avail, arena_mapp_get(chunk,
	    pageind));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x808, %rsp            # imm = 0x808
movl %r9d, %ebp
movl %r8d, %r13d
movq %rcx, %r12
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
cmpq $0x0, 0x18(%rsi)
je 0x7adaa
leaq 0x90(%rbx), %rdi
movq %r15, %rsi
callq 0x7afc3
testb %r13b, %r13b
je 0x7adcf
leaq -0x1(%r14), %rax
leaq 0x61b6e(%rip), %rcx     # 0xdc928
subq (%rcx), %rax
jb 0x7adcf
imulq $0x18, %rax, %rax
testb $0x1, 0x40(%r15,%rax)
jne 0x7adcf
incq 0x28(%r15)
testb %bpl, %bpl
je 0x7ae03
leaq (%r12,%r14), %rax
leaq 0x61aa9(%rip), %rdx     # 0xdc888
leaq 0x61b42(%rip), %rcx     # 0xdc928
movq (%rcx), %rcx
cmpq (%rdx), %rax
je 0x7ae0d
subq %rcx, %rax
imulq $0x18, %rax, %rax
testb $0x1, 0x40(%r15,%rax)
jne 0x7ae0d
incq 0x28(%r15)
jmp 0x7ae0d
leaq 0x61b1e(%rip), %rax     # 0xdc928
movq (%rax), %rcx
incq 0x20(%r15)
movq %r14, %rax
subq %rcx, %rax
imulq $0x18, %rax, %rcx
testb $0x8, 0x40(%r15,%rcx)
jne 0x7ae29
movq 0x18(%r15), %r12
jmp 0x7ae38
addq %r12, 0xf0(%rbx)
addq 0x18(%r15), %r12
movq %r12, 0x18(%r15)
leaq 0x30(%r15), %rbp
testq %r12, %r12
je 0x7ae5d
leaq 0x90(%rbx), %rdi
movq %r15, %rsi
callq 0x7b448
leaq 0x61ad1(%rip), %rax     # 0xdc928
subq (%rax), %r14
movq %r14, %rax
imulq $0x18, %rax, %rax
leaq (%rax,%rbp), %r14
leaq 0x108(%rbx), %r13
movq %r13, (%rbp,%rax)
movq %r13, %rcx
orq $0x1, %rcx
movq %rcx, 0x8(%rbp,%rax)
movq 0x100(%rbx), %r15
leaq -0x10(%rsp), %r12
movq %r15, 0x10(%r12)
cmpq %r13, %r15
je 0x7aebf
movq %r14, %rdi
movq %r15, %rsi
callq 0x7b600
movl %eax, 0x18(%r12)
testl %eax, %eax
js 0x7aeb1
movq 0x8(%r15), %r15
andq $-0x2, %r15
jmp 0x7aeb4
movq (%r15), %r15
movq %r15, 0x20(%r12)
addq $0x10, %r12
jmp 0x7ae8e
movq %r14, 0x10(%r12)
movq %rsp, %rax
cmpq %rax, %r12
jb 0x7afa2
movq (%r12), %rcx
cmpl $0x0, 0x8(%r12)
js 0x7af2a
movq 0x8(%rcx), %rsi
andl $0x1, %esi
orq %r14, %rsi
movq %rsi, 0x8(%rcx)
testb $0x1, 0x8(%r14)
je 0x7afb1
movq (%rcx), %rdx
movq 0x8(%rdx), %rdi
testb $0x1, %dil
jne 0x7af67
andl $0x1, %esi
movq %r14, %rdx
andq $-0x2, %rdx
movq (%rdx), %rdi
orq %rsi, %rdi
movq %rdi, 0x8(%rcx)
movq %rcx, (%rdx)
leaq 0x8(%rdx), %r14
movq 0x8(%rdx), %rdi
andq $-0x2, %rdi
orq %rsi, %rdi
jmp 0x7af7d
movq %r14, (%rcx)
testb $0x1, 0x8(%r14)
je 0x7afb1
movq (%r14), %rdx
movq 0x8(%rdx), %rsi
testb $0x1, %sil
je 0x7af92
andq $-0x2, %rsi
movq %rsi, 0x8(%rdx)
movq (%rcx), %rdx
movq 0x8(%rdx), %rsi
andq $-0x2, %rsi
movq %rsi, (%rcx)
movq 0x8(%rdx), %rsi
andl $0x1, %esi
orq %rcx, %rsi
leaq 0x8(%rdx), %rcx
jmp 0x7af8c
addq $0x8, %r14
andq $-0x2, %rdi
movq %rdi, 0x8(%rdx)
movq (%r14), %rdi
andq $-0x2, %rdi
movq %rcx, %rdx
movq %rdi, (%r14)
movq 0x8(%rcx), %rsi
addq $0x8, %rcx
orq $0x1, %rsi
movq %rsi, (%rcx)
movq %rdx, %rcx
movq %rcx, (%r12)
addq $-0x10, %r12
movq %rcx, %r14
jmp 0x7aec7
movq (%rsp), %rax
movq %rax, 0x100(%rbx)
andb $-0x2, 0x8(%rax)
addq $0x808, %rsp            # imm = 0x808
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq