// File: /workspace/github_c_makefile_star2_O1/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 0x836a6
leaq 0x90(%rbx), %rdi
movq %r15, %rsi
callq 0x838ea
testb %r13b, %r13b
je 0x836cb
leaq -0x1(%r14), %rax
leaq 0x5c272(%rip), %rcx     # 0xdf928
subq (%rcx), %rax
jb 0x836cb
leaq (%rax,%rax,2), %rax
testb $0x1, 0x40(%r15,%rax,8)
jne 0x836cb
incq 0x28(%r15)
testb %bpl, %bpl
je 0x836fa
leaq (%r12,%r14), %rax
leaq 0x5c1ad(%rip), %rcx     # 0xdf888
cmpq (%rcx), %rax
je 0x836fa
leaq 0x5c241(%rip), %rcx     # 0xdf928
subq (%rcx), %rax
leaq (%rax,%rax,2), %rax
testb $0x1, 0x40(%r15,%rax,8)
jne 0x836fa
incq 0x28(%r15)
incq 0x20(%r15)
leaq 0x5c223(%rip), %r13     # 0xdf928
movq %r14, %rax
subq (%r13), %rax
leaq (%rax,%rax,2), %rax
testb $0x8, 0x40(%r15,%rax,8)
je 0x83723
addq %r12, 0xf0(%rbx)
addq %r12, 0x18(%r15)
leaq 0x30(%r15), %r12
cmpq $0x0, 0x18(%r15)
je 0x8373d
leaq 0x90(%rbx), %rdi
movq %r15, %rsi
callq 0x83dfc
subq (%r13), %r14
leaq (%r14,%r14,2), %rax
leaq (%r12,%rax,8), %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 0x837dc
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 0x837b9
xorl %r11d, %r11d
cmpq %rdi, %r9
seta %r11b
sbbl $0x0, %r11d
movl %r11d, 0x8(%rax)
testl %r11d, %r11d
js 0x837cc
movq 0x8(%rdi), %rdi
andq $-0x2, %rdi
jmp 0x837cf
movq (%rdi), %rdi
movq %rdi, 0x10(%rax)
addq $0x10, %rax
cmpq %rdx, %rdi
jne 0x83794
movq %rcx, (%rax)
addq $-0x10, %rax
cmpq %rsi, %rax
jb 0x838c9
movq %rsp, %rcx
movq (%rax), %rdx
movq 0x10(%rax), %rsi
cmpl $0x0, 0x8(%rax)
js 0x8384f
movq 0x8(%rdx), %r8
andl $0x1, %r8d
orq %rsi, %r8
movq %r8, 0x8(%rdx)
movq 0x8(%rsi), %rdi
testb $0x1, %dil
je 0x838b3
movq (%rdx), %r9
movq 0x8(%r9), %r10
testb $0x1, %r10b
jne 0x83893
andl $0x1, %r8d
movq %rsi, %r9
andq $-0x2, %r9
movq (%r9), %rsi
orq %r8, %rsi
movq %rsi, 0x8(%rdx)
movq %rdx, (%r9)
leaq 0x8(%r9), %rsi
movq 0x8(%r9), %r10
andq $-0x2, %r10
orq %r8, %r10
jmp 0x838a9
movq %rsi, (%rdx)
movq 0x8(%rsi), %rdi
testb $0x1, %dil
je 0x838b3
movq (%rsi), %rsi
movq 0x8(%rsi), %r8
testb $0x1, %r8b
je 0x838b3
andq $-0x2, %r8
movq %r8, 0x8(%rsi)
movq (%rdx), %rsi
movq 0x8(%rsi), %r8
andq $-0x2, %r8
movq %r8, (%rdx)
movq 0x8(%rsi), %r8
andl $0x1, %r8d
orq %rdx, %r8
movq %r8, 0x8(%rsi)
movq %rsi, %rdx
jmp 0x838b3
addq $0x8, %rsi
andq $-0x2, %r10
movq %r10, 0x8(%r9)
movq (%rsi), %r10
andq $-0x2, %r10
movq %rdx, %r9
movq %r10, (%rsi)
orb $0x1, 0x8(%rdx)
movq %r9, %rdx
testb $0x1, %dil
je 0x838d8
movq %rdx, (%rax)
addq $-0x10, %rax
cmpq %rcx, %rax
jae 0x837ef
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