// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/deps/jemalloc/src/arena.c
// Function: arena_run_split_remove
static void
arena_run_split_remove(arena_t *arena, arena_chunk_t *chunk, size_t run_ind,
    size_t flag_dirty, size_t flag_decommitted, size_t need_pages)
{
	size_t total_pages, rem_pages;

	assert(flag_dirty == 0 || flag_decommitted == 0);

	total_pages = arena_mapbits_unallocated_size_get(chunk, run_ind) >>
	    LG_PAGE;
	assert(arena_mapbits_dirty_get(chunk, run_ind+total_pages-1) ==
	    flag_dirty);
	assert(need_pages <= total_pages);
	rem_pages = total_pages - need_pages;

	arena_avail_remove(arena, chunk, run_ind, total_pages);
	if (flag_dirty != 0)
		arena_run_dirty_remove(arena, chunk, run_ind, total_pages);
	arena_nactive_add(arena, need_pages);

	/* Keep track of trailing unused pages for later use. */
	if (rem_pages > 0) {
		size_t flags = flag_dirty | flag_decommitted;
		size_t flag_unzeroed_mask = (flags == 0) ?  CHUNK_MAP_UNZEROED :
		    0;

		arena_mapbits_unallocated_set(chunk, run_ind+need_pages,
		    (rem_pages << LG_PAGE), flags |
		    (arena_mapbits_unzeroed_get(chunk, run_ind+need_pages) &
		    flag_unzeroed_mask));
		arena_mapbits_unallocated_set(chunk, run_ind+total_pages-1,
		    (rem_pages << LG_PAGE), flags |
		    (arena_mapbits_unzeroed_get(chunk, run_ind+total_pages-1) &
		    flag_unzeroed_mask));
		if (flag_dirty != 0) {
			arena_run_dirty_insert(arena, chunk, run_ind+need_pages,
			    rem_pages);
		}
		arena_avail_insert(arena, chunk, run_ind+need_pages, rem_pages);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movq %r8, (%rsp)
movq %rcx, %r12
movq %rdx, %rbp
movq %rsi, %r14
movq %rdi, %r15
movq %rdx, %rax
subq 0x27cfc(%rip), %rax     # 0x4cfc0
movq 0x78(%rsi,%rax,8), %r13
shrq $0xd, %r13
callq 0xf390
testq %r12, %r12
je 0x2532e
movq 0x27cea(%rip), %rax     # 0x4cfc8
addq %r14, %rax
leaq (,%rbp,2), %rcx
addq %rbp, %rcx
shlq $0x5, %rcx
addq %rax, %rcx
xorl %eax, %eax
subq 0x27cc4(%rip), %rax     # 0x4cfc0
leaq (%rax,%rax,2), %rax
shlq $0x5, %rax
addq %rcx, %rax
addq $0x18, %rax
movq (%rax), %rcx
movq 0x8(%rax), %rdx
movq %rcx, (%rdx)
movq (%rax), %rcx
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rcx)
movq %rax, (%rax)
movq %rax, 0x8(%rax)
subq %r13, 0x130(%r15)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x21d1e
cmpq %rbx, %r13
jne 0x2534d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rax
subq %rbx, %rax
xorl %ecx, %ecx
movq (%rsp), %r8
orq %r12, %r8
sete %cl
shll $0x3, %ecx
addq %rbp, %rbx
movq %rax, %rdx
shlq $0xd, %rdx
movq %rbx, %rsi
subq 0x27c4a(%rip), %rsi     # 0x4cfc0
movl 0x78(%r14,%rsi,8), %edi
andl %ecx, %edi
orq %rdx, %rdi
orq $0x1fe0, %r8            # imm = 0x1FE0
orq %r8, %rdi
movq %rdi, 0x78(%r14,%rsi,8)
addq %rbp, %r13
movq 0x27c27(%rip), %rsi     # 0x4cfc0
notq %rsi
addq %r13, %rsi
andl 0x78(%r14,%rsi,8), %ecx
orq %rdx, %rcx
orq %r8, %rcx
movq %rcx, 0x78(%r14,%rsi,8)
testq %r12, %r12
je 0x25416
movq 0x27c0d(%rip), %rcx     # 0x4cfc8
addq %r14, %rcx
leaq (%rbx,%rbx,2), %rdx
shlq $0x5, %rdx
addq %rcx, %rdx
xorl %ecx, %ecx
subq 0x27bee(%rip), %rcx     # 0x4cfc0
leaq (%rcx,%rcx,2), %rcx
shlq $0x5, %rcx
addq %rdx, %rcx
addq $0x18, %rcx
movq %rcx, (%rcx)
movq %rcx, 0x8(%rcx)
leaq 0x138(%r15), %rdx
movq 0x140(%r15), %rsi
movq %rcx, (%rsi)
movq 0x8(%rcx), %rdi
movq %rdx, (%rdi)
movq 0x8(%rcx), %rdx
movq %rdx, 0x140(%r15)
movq %rsi, 0x8(%rcx)
addq %rax, 0x130(%r15)
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf21e