// File: /workspace/github_c_makefile_star2_O3/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 0x83a4b
leaq 0x90(%rbx), %rdi
movq %r15, %rsi
callq 0x83caa
testb %r13b, %r13b
je 0x83a70
leaq -0x1(%r14), %rax
leaq 0x5becd(%rip), %rcx     # 0xdf928
subq (%rcx), %rax
jb 0x83a70
leaq (%rax,%rax,2), %rax
testb $0x1, 0x40(%r15,%rax,8)
jne 0x83a70
incq 0x28(%r15)
testb %bpl, %bpl
je 0x83aa4
leaq (%r12,%r14), %rax
leaq 0x5be08(%rip), %rdx     # 0xdf888
leaq 0x5bea1(%rip), %rcx     # 0xdf928
movq (%rcx), %rcx
cmpq (%rdx), %rax
je 0x83aae
subq %rcx, %rax
leaq (%rax,%rax,2), %rax
testb $0x1, 0x40(%r15,%rax,8)
jne 0x83aae
incq 0x28(%r15)
jmp 0x83aae
leaq 0x5be7d(%rip), %rax     # 0xdf928
movq (%rax), %rcx
incq 0x20(%r15)
movq %r14, %rax
subq %rcx, %rax
leaq (%rax,%rax,2), %rcx
testb $0x8, 0x40(%r15,%rcx,8)
jne 0x83aca
movq 0x18(%r15), %r12
jmp 0x83ad9
addq %r12, 0xf0(%rbx)
addq 0x18(%r15), %r12
movq %r12, 0x18(%r15)
leaq 0x30(%r15), %r13
testq %r12, %r12
je 0x83afe
leaq 0x90(%rbx), %rdi
movq %r15, %rsi
callq 0x841a0
leaq 0x5be30(%rip), %rax     # 0xdf928
subq (%rax), %r14
movq %r14, %rax
leaq (%rax,%rax,2), %rax
leaq (,%rax,8), %rcx
addq %r13, %rcx
leaq 0x108(%rbx), %rdx
movq %rdx, (%rcx)
movq %rdx, %rax
orq $0x1, %rax
movq %rax, 0x8(%rcx)
movq 0x100(%rbx), %rdi
movq %rsp, %rsi
movq %rdi, (%rsi)
movq %rsi, %rax
cmpq %rdx, %rdi
je 0x83ba0
movq 0x10(%rcx), %rax
movq %rax, %r8
andq $-0x1000, %r8           # imm = 0xF000
xorl %r9d, %r9d
testb $0x1, %al
cmoveq %rcx, %r9
movq %rsp, %rax
movq $-0x1000, %r10          # imm = 0xF000
movq 0x10(%rdi), %r14
andq %r10, %r14
xorl %r11d, %r11d
cmpq %r14, %r8
seta %r11b
sbbl $0x0, %r11d
jne 0x83b7d
xorl %r11d, %r11d
cmpq %rdi, %r9
seta %r11b
sbbl $0x0, %r11d
movl %r11d, 0x8(%rax)
testl %r11d, %r11d
js 0x83b90
movq 0x8(%rdi), %rdi
andq $-0x2, %rdi
jmp 0x83b93
movq (%rdi), %rdi
movq %rdi, 0x10(%rax)
addq $0x10, %rax
cmpq %rdx, %rdi
jne 0x83b58
movq %rcx, (%rax)
addq $-0x10, %rax
cmpq %rsi, %rax
jb 0x83c89
movq %rsp, %rdx
movq (%rax), %rsi
cmpl $0x0, 0x8(%rax)
js 0x83c0b
movq 0x8(%rsi), %r8
andl $0x1, %r8d
orq %rcx, %r8
movq %r8, 0x8(%rsi)
testb $0x1, 0x8(%rcx)
je 0x83c98
movq (%rsi), %rdi
movq 0x8(%rdi), %r9
testb $0x1, %r9b
jne 0x83c4b
andl $0x1, %r8d
movq %rcx, %rdi
andq $-0x2, %rdi
movq (%rdi), %rcx
orq %r8, %rcx
movq %rcx, 0x8(%rsi)
movq %rsi, (%rdi)
leaq 0x8(%rdi), %rcx
movq 0x8(%rdi), %r9
andq $-0x2, %r9
orq %r8, %r9
jmp 0x83c61
movq %rcx, (%rsi)
testb $0x1, 0x8(%rcx)
je 0x83c98
movq (%rcx), %rcx
movq 0x8(%rcx), %rdi
testb $0x1, %dil
je 0x83c76
andq $-0x2, %rdi
movq %rdi, 0x8(%rcx)
movq (%rsi), %rdi
movq 0x8(%rdi), %rcx
andq $-0x2, %rcx
movq %rcx, (%rsi)
movq 0x8(%rdi), %rcx
andl $0x1, %ecx
orq %rsi, %rcx
leaq 0x8(%rdi), %rsi
jmp 0x83c70
addq $0x8, %rcx
andq $-0x2, %r9
movq %r9, 0x8(%rdi)
movq (%rcx), %r9
andq $-0x2, %r9
movq %rsi, %rdi
movq %r9, (%rcx)
movq 0x8(%rsi), %rcx
addq $0x8, %rsi
orq $0x1, %rcx
movq %rcx, (%rsi)
movq %rdi, %rsi
movq %rsi, (%rax)
addq $-0x10, %rax
movq %rsi, %rcx
cmpq %rdx, %rax
jae 0x83bb3
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