// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/deps/jemalloc/src/arena.c
// Function: arena_run_dalloc
static void
arena_run_dalloc(arena_t *arena, arena_run_t *run, bool dirty, bool cleaned)
{
	arena_chunk_t *chunk;
	size_t size, run_ind, run_pages, flag_dirty;

	chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run);
	run_ind = (size_t)(((uintptr_t)run - (uintptr_t)chunk) >> LG_PAGE);
	assert(run_ind >= map_bias);
	assert(run_ind < chunk_npages);
	if (arena_mapbits_large_get(chunk, run_ind) != 0) {
		size = arena_mapbits_large_size_get(chunk, run_ind);
		assert(size == PAGE ||
		    arena_mapbits_large_size_get(chunk,
		    run_ind+(size>>LG_PAGE)-1) == 0);
	} else {
		size_t binind = arena_bin_index(arena, run->bin);
		arena_bin_info_t *bin_info = &arena_bin_info[binind];
		size = bin_info->run_size;
	}
	run_pages = (size >> LG_PAGE);
	if (config_stats) {
		/*
		 * Update stats_cactive if nactive is crossing a chunk
		 * multiple.
		 */
		size_t cactive_diff = CHUNK_CEILING(arena->nactive << LG_PAGE) -
		    CHUNK_CEILING((arena->nactive - run_pages) << LG_PAGE);
		if (cactive_diff != 0)
			stats_cactive_sub(cactive_diff);
	}
	arena->nactive -= run_pages;

	/*
	 * The run is dirty if the caller claims to have dirtied it, as well as
	 * if it was already dirty before being allocated and the caller
	 * doesn't claim to have cleaned it.
	 */
	assert(arena_mapbits_dirty_get(chunk, run_ind) ==
	    arena_mapbits_dirty_get(chunk, run_ind+run_pages-1));
	if (cleaned == false && arena_mapbits_dirty_get(chunk, run_ind) != 0)
		dirty = true;
	flag_dirty = dirty ? CHUNK_MAP_DIRTY : 0;

	/* Mark pages as unallocated in the chunk map. */
	if (dirty) {
		arena_mapbits_unallocated_set(chunk, run_ind, size,
		    CHUNK_MAP_DIRTY);
		arena_mapbits_unallocated_set(chunk, run_ind+run_pages-1, size,
		    CHUNK_MAP_DIRTY);
	} else {
		arena_mapbits_unallocated_set(chunk, run_ind, size,
		    arena_mapbits_unzeroed_get(chunk, run_ind));
		arena_mapbits_unallocated_set(chunk, run_ind+run_pages-1, size,
		    arena_mapbits_unzeroed_get(chunk, run_ind+run_pages-1));
	}

	/* Try to coalesce forward. */
	if (run_ind + run_pages < chunk_npages &&
	    arena_mapbits_allocated_get(chunk, run_ind+run_pages) == 0 &&
	    arena_mapbits_dirty_get(chunk, run_ind+run_pages) == flag_dirty) {
		size_t nrun_size = arena_mapbits_unallocated_size_get(chunk,
		    run_ind+run_pages);
		size_t nrun_pages = nrun_size >> LG_PAGE;

		/*
		 * Remove successor from runs_avail; the coalesced run is
		 * inserted later.
		 */
		assert(arena_mapbits_unallocated_size_get(chunk,
		    run_ind+run_pages+nrun_pages-1) == nrun_size);
		assert(arena_mapbits_dirty_get(chunk,
		    run_ind+run_pages+nrun_pages-1) == flag_dirty);
		arena_avail_remove(arena, chunk, run_ind+run_pages, nrun_pages,
		    false, true);

		size += nrun_size;
		run_pages += nrun_pages;

		arena_mapbits_unallocated_size_set(chunk, run_ind, size);
		arena_mapbits_unallocated_size_set(chunk, run_ind+run_pages-1,
		    size);
	}

	/* Try to coalesce backward. */
	if (run_ind > map_bias && arena_mapbits_allocated_get(chunk, run_ind-1)
	    == 0 && arena_mapbits_dirty_get(chunk, run_ind-1) == flag_dirty) {
		size_t prun_size = arena_mapbits_unallocated_size_get(chunk,
		    run_ind-1);
		size_t prun_pages = prun_size >> LG_PAGE;

		run_ind -= prun_pages;

		/*
		 * Remove predecessor from runs_avail; the coalesced run is
		 * inserted later.
		 */
		assert(arena_mapbits_unallocated_size_get(chunk, run_ind) ==
		    prun_size);
		assert(arena_mapbits_dirty_get(chunk, run_ind) == flag_dirty);
		arena_avail_remove(arena, chunk, run_ind, prun_pages, true,
		    false);

		size += prun_size;
		run_pages += prun_pages;

		arena_mapbits_unallocated_size_set(chunk, run_ind, size);
		arena_mapbits_unallocated_size_set(chunk, run_ind+run_pages-1,
		    size);
	}

	/* Insert into runs_avail, now that coalescing is complete. */
	assert(arena_mapbits_unallocated_size_get(chunk, run_ind) ==
	    arena_mapbits_unallocated_size_get(chunk, run_ind+run_pages-1));
	assert(arena_mapbits_dirty_get(chunk, run_ind) ==
	    arena_mapbits_dirty_get(chunk, run_ind+run_pages-1));
	arena_avail_insert(arena, chunk, run_ind, run_pages, true, true);

	/* Deallocate chunk if it is now completely unused. */
	if (size == arena_maxclass) {
		assert(run_ind == map_bias);
		assert(run_pages == (arena_maxclass >> LG_PAGE));
		arena_chunk_dealloc(arena, chunk);
	}

	/*
	 * It is okay to do dirty page processing here even if the chunk was
	 * deallocated above, since in that case it is the spare.  Waiting
	 * until after possible chunk deallocation to do dirty processing
	 * allows for an old spare to be fully deallocated, thus decreasing the
	 * chances of spuriously crossing the dirty page purging threshold.
	 */
	if (dirty)
		arena_maybe_purge(arena);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movb %cl, %al
movb %dl, %cl
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
andb $0x1, %cl
movb %cl, -0x11(%rbp)
andb $0x1, %al
movb %al, -0x12(%rbp)
movq -0x10(%rbp), %rax
leaq 0x71c63(%rip), %rcx     # 0x1291d0
movq (%rcx), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
subq %rcx, %rax
shrq $0xc, %rax
movq %rax, -0x30(%rbp)
jmp 0xb7590
jmp 0xb7592
jmp 0xb7594
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0xba040
cmpq $0x0, %rax
je 0xb75bc
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0xb7500
movq %rax, -0x28(%rbp)
jmp 0xb75ba
jmp 0xb75ef
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0xba070
movq %rax, -0x48(%rbp)
leaq 0x70f79(%rip), %rax     # 0x128550
imulq $0x68, -0x48(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
shrq $0xc, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0xe8(%rax), %rax
shlq $0xc, %rax
leaq 0x71bbf(%rip), %rcx     # 0x1291d0
addq (%rcx), %rax
leaq 0x71bb5(%rip), %rcx     # 0x1291d0
movq (%rcx), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq -0x8(%rbp), %rcx
movq 0xe8(%rcx), %rcx
subq -0x38(%rbp), %rcx
shlq $0xc, %rcx
leaq 0x71b91(%rip), %rdx     # 0x1291d0
addq (%rdx), %rcx
leaq 0x71b87(%rip), %rdx     # 0x1291d0
movq (%rdx), %rdx
xorq $-0x1, %rdx
andq %rdx, %rcx
subq %rcx, %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
je 0xb766a
movq -0x58(%rbp), %rdi
callq 0xbe8a0
movq -0x38(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0xe8(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0xe8(%rax)
jmp 0xb7685
movb -0x12(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xb76a9
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0xb9ad0
cmpq $0x0, %rax
je 0xb76a9
movb $0x1, -0x11(%rbp)
movb -0x11(%rbp), %dl
xorl %eax, %eax
movl $0x8, %ecx
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, -0x40(%rbp)
testb $0x1, -0x11(%rbp)
je 0xb76fd
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rdx
movl $0x8, %ecx
callq 0xba100
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq -0x38(%rbp), %rsi
subq $0x1, %rsi
movq -0x28(%rbp), %rdx
movl $0x8, %ecx
callq 0xba100
jmp 0xb779d
movq -0x20(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0xbbda0
movq -0xa8(%rbp), %rdi
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
movq %rax, %rcx
callq 0xba100
movq -0x20(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x30(%rbp), %rax
addq -0x38(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x88(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq -0x38(%rbp), %rsi
subq $0x1, %rsi
callq 0xbbda0
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq -0x80(%rbp), %rdx
movq %rax, %rcx
callq 0xba100
movq -0x30(%rbp), %rax
addq -0x38(%rbp), %rax
leaq 0x71a2c(%rip), %rcx     # 0x1291d8
cmpq (%rcx), %rax
jae 0xb7876
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq -0x38(%rbp), %rsi
callq 0xb9a60
cmpq $0x0, %rax
jne 0xb7876
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq -0x38(%rbp), %rsi
callq 0xb9ad0
cmpq -0x40(%rbp), %rax
jne 0xb7876
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq -0x38(%rbp), %rsi
callq 0xb9a90
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
shrq $0xc, %rax
movq %rax, -0x68(%rbp)
jmp 0xb780e
jmp 0xb7810
jmp 0xb7812
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rdx
addq -0x38(%rbp), %rdx
movq -0x68(%rbp), %rcx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0xbbc00
movq -0x60(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x68(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0xbe8d0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq -0x38(%rbp), %rsi
subq $0x1, %rsi
movq -0x28(%rbp), %rdx
callq 0xbe8d0
movq -0x30(%rbp), %rax
leaq 0x719f7(%rip), %rcx     # 0x129278
cmpq (%rcx), %rax
jbe 0xb7956
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
subq $0x1, %rsi
callq 0xb9a60
cmpq $0x0, %rax
jne 0xb7956
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
subq $0x1, %rsi
callq 0xb9ad0
cmpq -0x40(%rbp), %rax
jne 0xb7956
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
subq $0x1, %rsi
callq 0xb9a90
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
shrq $0xc, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rcx
movq -0x30(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x30(%rbp)
jmp 0xb78f2
jmp 0xb78f4
jmp 0xb78f6
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x78(%rbp), %rcx
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0xbbc00
movq -0x70(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x78(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0xbe8d0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq -0x38(%rbp), %rsi
subq $0x1, %rsi
movq -0x28(%rbp), %rdx
callq 0xbe8d0
jmp 0xb7958
jmp 0xb795a
jmp 0xb795c
jmp 0xb795e
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rcx
movl $0x1, %r9d
movl %r9d, %r8d
callq 0xba150
movq -0x28(%rbp), %rax
leaq 0x718f9(%rip), %rcx     # 0x129280
cmpq (%rcx), %rax
jne 0xb79a1
jmp 0xb798e
jmp 0xb7990
jmp 0xb7992
jmp 0xb7994
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xbe920
testb $0x1, -0x11(%rbp)
je 0xb79b0
movq -0x8(%rbp), %rdi
callq 0xbea10
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)