// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/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,
    bool decommitted)
{
	arena_chunk_t *chunk;
	arena_chunk_map_misc_t *miscelm;
	size_t size, run_ind, run_pages, flag_dirty, flag_decommitted;

	chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run);
	miscelm = arena_run_to_miscelm(run);
	run_ind = arena_miscelm_to_pageind(miscelm);
	assert(run_ind >= map_bias);
	assert(run_ind < chunk_npages);
	size = arena_run_size_get(arena, chunk, run, run_ind);
	run_pages = (size >> LG_PAGE);
	arena_cactive_update(arena, 0, run_pages);
	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 && !decommitted && arena_mapbits_dirty_get(chunk, run_ind)
	    != 0)
		dirty = true;
	flag_dirty = dirty ? CHUNK_MAP_DIRTY : 0;
	flag_decommitted = decommitted ? CHUNK_MAP_DECOMMITTED : 0;

	/* Mark pages as unallocated in the chunk map. */
	if (dirty || decommitted) {
		size_t flags = flag_dirty | flag_decommitted;
		arena_mapbits_unallocated_set(chunk, run_ind, size, flags);
		arena_mapbits_unallocated_set(chunk, run_ind+run_pages-1, size,
		    flags);
	} 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));
	}

	arena_run_coalesce(arena, chunk, &size, &run_ind, &run_pages,
	    flag_dirty, flag_decommitted);

	/* 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));
	assert(arena_mapbits_decommitted_get(chunk, run_ind) ==
	    arena_mapbits_decommitted_get(chunk, run_ind+run_pages-1));
	arena_avail_insert(arena, chunk, run_ind, run_pages);

	if (dirty)
		arena_run_dirty_insert(arena, chunk, run_ind, run_pages);

	/* Deallocate chunk if it is now completely unused. */
	if (size == arena_maxrun) {
		assert(run_ind == map_bias);
		assert(run_pages == (arena_maxrun >> LG_PAGE));
		arena_chunk_dalloc(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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %r8d, %r12d
movl %ecx, %r13d
movl %edx, 0x4(%rsp)
movq %rdi, %rbx
leaq 0x30070(%rip), %rax     # 0x576b0
movq (%rax), %r14
notq %r14
leaq -0x10(%rsi), %rax
andq %r14, %rax
andq %rsi, %r14
addq 0x2ff09(%rip), %rax     # 0x57560
negq %rax
addq %rsi, %rax
addq $-0x10, %rax
pushq $0x60
popq %rcx
xorl %edx, %edx
divq %rcx
movq %rax, %rbp
addq 0x2fee5(%rip), %rbp     # 0x57558
movq %r14, %rdi
movq %rbp, %rdx
callq 0x27a9b
movq %rax, %r15
movq %rax, 0x18(%rsp)
shrq $0xc, %r15
movq %rbx, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x27586
movq %rbx, 0x10(%rsp)
movq %r15, 0x8(%rsp)
subq %r15, 0xe0(%rbx)
orl %r12d, %r13d
je 0x276b3
movl 0x4(%rsp), %ebx
jmp 0x276cd
movq %rbp, %rax
subq 0x2fe9b(%rip), %rax     # 0x57558
movb 0x68(%r14,%rax,8), %al
andb $0x10, %al
shrb $0x4, %al
orb 0x4(%rsp), %al
movl %eax, %ebx
movzbl %bl, %esi
shll $0x4, %esi
movzbl %r12b, %ecx
leal (,%rcx,4), %edi
orb %bl, %cl
movq %rbp, %rax
subq 0x2fe6e(%rip), %rax     # 0x57558
cmpb $0x1, %cl
movq 0x18(%rsp), %r15
jne 0x2772a
leaq (%r15,%r15), %rcx
movq %rdi, %rdx
orq %rsi, %rdx
orq %rcx, %rdx
orq $0x1fe0, %rdx           # imm = 0x1FE0
movq %rdx, 0x68(%r14,%rax,8)
movq 0x8(%rsp), %rax
leaq (%rax,%rbp), %r13
movq 0x2fe3b(%rip), %rax     # 0x57558
notq %rax
addq %r13, %rax
movq %rdx, 0x68(%r14,%rax,8)
jmp 0x2776b
movq 0x68(%r14,%rax,8), %rcx
andl $0x8, %ecx
leaq (%r15,%r15), %rdx
orq $0x1fe0, %rdx           # imm = 0x1FE0
orq %rdx, %rcx
movq %rcx, 0x68(%r14,%rax,8)
movq 0x8(%rsp), %rax
leaq (%rax,%rbp), %r13
movq 0x2fe03(%rip), %rax     # 0x57558
notq %rax
addq %r13, %rax
movq 0x68(%r14,%rax,8), %rcx
andl $0x8, %ecx
orq %rdx, %rcx
movq %rcx, 0x68(%r14,%rax,8)
leaq 0x2ff46(%rip), %rcx     # 0x576b8
movq 0x2fddf(%rip), %rax     # 0x57558
cmpq (%rcx), %r13
jae 0x2786a
movq %r13, %rcx
subq %rax, %rcx
movq 0x68(%r14,%rcx,8), %r12
movl %r12d, %ecx
andl $0x4, %ecx
cmpl %edi, %ecx
jne 0x2786a
movl %r12d, %ecx
andl $0x1, %ecx
jne 0x2786a
movl %r12d, %ecx
andl $0x10, %ecx
cmpl %esi, %ecx
jne 0x2786a
movq %rdi, 0x20(%rsp)
movq %rsi, 0x28(%rsp)
movl %ebx, %r15d
movq %r12, %rbx
shrq %rbx
andq $-0x1000, %rbx          # imm = 0xF000
shrq $0xd, %r12
movq 0x10(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x27097
movl %r15d, 0x4(%rsp)
testb %r15b, %r15b
je 0x27800
movq 0x10(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x27543
movq 0x18(%rsp), %r15
addq %rbx, %r15
movq 0x8(%rsp), %rdi
addq %r12, %rdi
movq %rbp, %rax
subq 0x2fd3e(%rip), %rax     # 0x57558
leaq (%r15,%r15), %rcx
movl $0x1fff, %edx           # imm = 0x1FFF
movq 0x68(%r14,%rax,8), %rsi
andq %rdx, %rsi
orq %rcx, %rsi
movq %rsi, 0x68(%r14,%rax,8)
movq 0x2fd1e(%rip), %rax     # 0x57558
notq %rax
addq %rbp, %rax
movq %rdi, 0x8(%rsp)
addq %rdi, %rax
andq 0x68(%r14,%rax,8), %rdx
orq %rcx, %rdx
movq %rdx, 0x68(%r14,%rax,8)
movq 0x2fcfc(%rip), %rax     # 0x57558
movl 0x4(%rsp), %ebx
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdi
cmpq %rax, %rbp
jbe 0x2794d
notq %rax
addq %rbp, %rax
movq 0x68(%r14,%rax,8), %r12
movl %r12d, %eax
andl $0x4, %eax
cmpl %edi, %eax
jne 0x2794d
movl %r12d, %eax
andl $0x1, %eax
jne 0x2794d
movl %r12d, %eax
andl $0x10, %eax
cmpl %esi, %eax
jne 0x2794d
movq %r15, 0x18(%rsp)
movl %ebx, %r15d
movq %r12, %rbx
shrq %rbx
andq $-0x1000, %rbx          # imm = 0xF000
shrq $0xd, %r12
movq %rbp, %r13
subq %r12, %r13
movq 0x10(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x27097
movl %r15d, 0x4(%rsp)
testb %r15b, %r15b
je 0x278f2
movq 0x10(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x27543
movq 0x18(%rsp), %r15
addq %rbx, %r15
movq %r13, %rax
subq 0x2fc54(%rip), %rax     # 0x57558
leaq (%r15,%r15), %rcx
movl $0x1fff, %edx           # imm = 0x1FFF
movq 0x68(%r14,%rax,8), %rsi
andq %rdx, %rsi
orq %rcx, %rsi
movq %rsi, 0x68(%r14,%rax,8)
movq 0x8(%rsp), %rsi
addq %rsi, %rbp
movq 0x2fc2c(%rip), %rax     # 0x57558
notq %rax
addq %rbp, %rax
andq 0x68(%r14,%rax,8), %rdx
addq %rsi, %r12
orq %rcx, %rdx
movq %rdx, 0x68(%r14,%rax,8)
movq %r12, 0x8(%rsp)
movl 0x4(%rsp), %ebx
jmp 0x27950
movq %rbp, %r13
movq 0x10(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x26a1b
testb %bl, %bl
je 0x2797a
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq 0x8(%rsp), %rcx
callq 0x275c6
cmpq 0x2fbe7(%rip), %r15     # 0x57568
jne 0x27a80
movq 0x2fbca(%rip), %rdx     # 0x57558
movq %r12, %rdi
movq %r14, %rsi
callq 0x27097
movq 0xc8(%r12), %r15
testq %r15, %r15
je 0x27a78
movl %ebx, %ebp
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
andq $0x0, 0x60(%rsp)
movaps %xmm0, 0x30(%rsp)
movq %r14, 0xc8(%r12)
testb $0x10, 0x68(%r15)
je 0x279f2
movq 0x2fb7e(%rip), %rdx     # 0x57558
leaq 0x2fcd7(%rip), %rax     # 0x576b8
movq (%rax), %rcx
subq %rdx, %rcx
movq %r12, %rdi
movq %r15, %rsi
callq 0x27543
movq %r15, %rdi
movq %r15, %rsi
callq 0x28f90
movq 0x68(%r15), %rbx
testb $0x4, %bl
je 0x27a38
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x28d7d
leaq 0x2fc8b(%rip), %rax     # 0x576a8
movq (%rax), %rsi
movq 0x2fb31(%rip), %rcx     # 0x57558
shlq $0xc, %rcx
movl (%r12), %r8d
movq %r15, %rdi
xorl %edx, %edx
callq *0x18(%r14)
xorl %r8d, %r8d
testb $0x4, %bl
sete %r8b
leaq 0x2fc5f(%rip), %rbx     # 0x576a8
movq (%rbx), %rcx
leaq 0x30(%rsp), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x29533
movq (%rbx), %rax
subq %rax, 0x30(%r12)
movq 0x2faed(%rip), %rax     # 0x57558
shlq $0xc, %rax
subq %rax, 0x50(%r12)
movl %ebp, %ebx
jmp 0x27a80
movq %r14, 0xc8(%r12)
testb %bl, %bl
je 0x27a8c
movq %r12, %rdi
callq 0x229ef
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq