// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/deps/jemalloc/src/arena.c
// Function: arena_purge_stashed
static size_t
arena_purge_stashed(arena_t *arena, chunk_hooks_t *chunk_hooks,
    arena_runs_dirty_link_t *purge_runs_sentinel,
    extent_node_t *purge_chunks_sentinel)
{
	size_t npurged, nmadvise;
	arena_runs_dirty_link_t *rdelm;
	extent_node_t *chunkselm;

	if (config_stats)
		nmadvise = 0;
	npurged = 0;

	malloc_mutex_unlock(&arena->lock);
	for (rdelm = qr_next(purge_runs_sentinel, rd_link),
	    chunkselm = qr_next(purge_chunks_sentinel, cc_link);
	    rdelm != purge_runs_sentinel; rdelm = qr_next(rdelm, rd_link)) {
		size_t npages;

		if (rdelm == &chunkselm->rd) {
			/*
			 * Don't actually purge the chunk here because 1)
			 * chunkselm is embedded in the chunk and must remain
			 * valid, and 2) we deallocate the chunk in
			 * arena_unstash_purged(), where it is destroyed,
			 * decommitted, or purged, depending on chunk
			 * deallocation policy.
			 */
			size_t size = extent_node_size_get(chunkselm);
			npages = size >> LG_PAGE;
			chunkselm = qr_next(chunkselm, cc_link);
		} else {
			size_t pageind, run_size, flag_unzeroed, flags, i;
			bool decommitted;
			arena_chunk_t *chunk =
			    (arena_chunk_t *)CHUNK_ADDR2BASE(rdelm);
			arena_chunk_map_misc_t *miscelm =
			    arena_rd_to_miscelm(rdelm);
			pageind = arena_miscelm_to_pageind(miscelm);
			run_size = arena_mapbits_large_size_get(chunk, pageind);
			npages = run_size >> LG_PAGE;

			assert(pageind + npages <= chunk_npages);
			assert(!arena_mapbits_decommitted_get(chunk, pageind));
			assert(!arena_mapbits_decommitted_get(chunk,
			    pageind+npages-1));
			decommitted = !chunk_hooks->decommit(chunk, chunksize,
			    pageind << LG_PAGE, npages << LG_PAGE, arena->ind);
			if (decommitted) {
				flag_unzeroed = 0;
				flags = CHUNK_MAP_DECOMMITTED;
			} else {
				flag_unzeroed = chunk_purge_wrapper(arena,
				    chunk_hooks, chunk, chunksize, pageind <<
				    LG_PAGE, run_size) ? CHUNK_MAP_UNZEROED : 0;
				flags = flag_unzeroed;
			}
			arena_mapbits_large_set(chunk, pageind+npages-1, 0,
			    flags);
			arena_mapbits_large_set(chunk, pageind, run_size,
			    flags);

			/*
			 * Set the unzeroed flag for internal pages, now that
			 * chunk_purge_wrapper() has returned whether the pages
			 * were zeroed as a side effect of purging.  This chunk
			 * map modification is safe even though the arena mutex
			 * isn't currently owned by this thread, because the run
			 * is marked as allocated, thus protecting it from being
			 * modified by any other thread.  As long as these
			 * writes don't perturb the first and last elements'
			 * CHUNK_MAP_ALLOCATED bits, behavior is well defined.
			 */
			for (i = 1; i < npages-1; i++) {
				arena_mapbits_internal_set(chunk, pageind+i,
				    flag_unzeroed);
			}
		}

		npurged += npages;
		if (config_stats)
			nmadvise++;
	}
	malloc_mutex_lock(&arena->lock);

	if (config_stats) {
		arena->stats.nmadvise += nmadvise;
		arena->stats.purged += npurged;
	}

	return (npurged);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movq %rdi, -0x1b0(%rbp)
movq %rsi, -0x1b8(%rbp)
movq %rdx, -0x1c0(%rbp)
movq %rcx, -0x1c8(%rbp)
movq $0x0, -0x1d8(%rbp)
movq $0x0, -0x1d0(%rbp)
movq -0x1b0(%rbp), %rdi
addq $0x8, %rdi
callq 0x3c3c0
movq -0x1c0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x1e0(%rbp)
movq -0x1c8(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x1e8(%rbp)
movq -0x1e0(%rbp), %rax
cmpq -0x1c0(%rbp), %rax
je 0x457fb
movq -0x1e0(%rbp), %rax
movq -0x1e8(%rbp), %rcx
addq $0x28, %rcx
cmpq %rcx, %rax
jne 0x452b7
movq -0x1e8(%rbp), %rdi
callq 0x44ab0
movq %rax, -0x1f8(%rbp)
movq -0x1f8(%rbp), %rax
shrq $0xc, %rax
movq %rax, -0x1f0(%rbp)
movq -0x1e8(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x1e8(%rbp)
jmp 0x457be
movq -0x1e0(%rbp), %rax
leaq 0x5d46b(%rip), %rcx     # 0xa2730
movq (%rcx), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq %rax, -0x230(%rbp)
movq -0x1e0(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movq -0x1a0(%rbp), %rax
subq $0x10, %rax
movq %rax, -0x1a8(%rbp)
movq -0x1a8(%rbp), %rax
movq %rax, -0x238(%rbp)
movq -0x238(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x188(%rbp), %rax
leaq 0x5d410(%rip), %rcx     # 0xa2730
movq (%rcx), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq %rax, -0x190(%rbp)
movq -0x188(%rbp), %rax
movq -0x190(%rbp), %rcx
addq 0x5d29a(%rip), %rcx     # 0xa25e0
subq %rcx, %rax
movl $0x60, %ecx
xorl %edx, %edx
divq %rcx
addq 0x5d27e(%rip), %rax     # 0xa25d8
movq %rax, -0x198(%rbp)
movq -0x198(%rbp), %rax
movq %rax, -0x200(%rbp)
movq -0x230(%rbp), %rcx
movq -0x200(%rbp), %rax
movq %rcx, -0x50(%rbp)
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, -0x40(%rbp)
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, -0x18(%rbp)
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, -0x8(%rbp)
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
addq $0x68, %rax
movq -0x10(%rbp), %rcx
subq 0x5d210(%rip), %rcx     # 0xa25d8
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
andq $-0x2000, %rax          # imm = 0xE000
shrq %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x208(%rbp)
movq -0x208(%rbp), %rax
shrq $0xc, %rax
movq %rax, -0x1f0(%rbp)
jmp 0x45416
jmp 0x45418
jmp 0x4541a
jmp 0x4541c
jmp 0x4541e
movq -0x1b8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x230(%rbp), %rdi
leaq 0x5d2f1(%rip), %rcx     # 0xa2728
movq (%rcx), %rsi
movq -0x200(%rbp), %rdx
shlq $0xc, %rdx
movq -0x1f0(%rbp), %rcx
shlq $0xc, %rcx
movq -0x1b0(%rbp), %r8
movl (%r8), %r8d
callq *%rax
xorb $-0x1, %al
andb $0x1, %al
movb %al, -0x221(%rbp)
testb $0x1, -0x221(%rbp)
je 0x45487
movq $0x0, -0x210(%rbp)
movq $0x4, -0x218(%rbp)
jmp 0x454e2
movq -0x1b0(%rbp), %rdi
movq -0x1b8(%rbp), %rsi
movq -0x230(%rbp), %rdx
leaq 0x5d285(%rip), %rax     # 0xa2728
movq (%rax), %rcx
movq -0x200(%rbp), %r8
shlq $0xc, %r8
movq -0x208(%rbp), %r9
callq 0x516b0
movb %al, %dl
xorl %eax, %eax
movl $0x8, %ecx
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, -0x210(%rbp)
movq -0x210(%rbp), %rax
movq %rax, -0x218(%rbp)
movq -0x230(%rbp), %rdx
movq -0x200(%rbp), %rcx
addq -0x1f0(%rbp), %rcx
subq $0x1, %rcx
movq -0x218(%rbp), %rax
movq %rdx, -0xa8(%rbp)
movq %rcx, -0xb0(%rbp)
movq $0x0, -0xb8(%rbp)
movq %rax, -0xc0(%rbp)
movq -0xa8(%rbp), %rcx
movq -0xb0(%rbp), %rax
movq %rcx, -0x98(%rbp)
movq %rax, -0xa0(%rbp)
movq -0x98(%rbp), %rcx
movq -0xa0(%rbp), %rax
movq %rcx, -0x88(%rbp)
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rax
addq $0x68, %rax
movq -0x90(%rbp), %rcx
subq 0x5d065(%rip), %rcx     # 0xa25d8
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rcx
movq -0xb8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
shlq %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
orq $0x1fe0, %rax           # imm = 0x1FE0
orq -0xc0(%rbp), %rax
orq $0x2, %rax
orq $0x1, %rax
movq %rcx, -0x78(%rbp)
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rcx
movq -0x78(%rbp), %rax
movq %rcx, (%rax)
movq -0x230(%rbp), %rsi
movq -0x200(%rbp), %rdx
movq -0x208(%rbp), %rcx
movq -0x218(%rbp), %rax
movq %rsi, -0x110(%rbp)
movq %rdx, -0x118(%rbp)
movq %rcx, -0x120(%rbp)
movq %rax, -0x128(%rbp)
movq -0x110(%rbp), %rcx
movq -0x118(%rbp), %rax
movq %rcx, -0x100(%rbp)
movq %rax, -0x108(%rbp)
movq -0x100(%rbp), %rcx
movq -0x108(%rbp), %rax
movq %rcx, -0xf0(%rbp)
movq %rax, -0xf8(%rbp)
movq -0xf0(%rbp), %rax
addq $0x68, %rax
movq -0xf8(%rbp), %rcx
subq 0x5cf85(%rip), %rcx     # 0xa25d8
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x130(%rbp)
movq -0x130(%rbp), %rcx
movq -0x120(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
shlq %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
orq $0x1fe0, %rax           # imm = 0x1FE0
orq -0x128(%rbp), %rax
orq $0x2, %rax
orq $0x1, %rax
movq %rcx, -0xe0(%rbp)
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rcx
movq -0xe0(%rbp), %rax
movq %rcx, (%rax)
movq $0x1, -0x220(%rbp)
movq -0x220(%rbp), %rax
movq -0x1f0(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x457bc
movq -0x230(%rbp), %rdx
movq -0x200(%rbp), %rcx
addq -0x220(%rbp), %rcx
movq -0x210(%rbp), %rax
movq %rdx, -0x168(%rbp)
movq %rcx, -0x170(%rbp)
movq %rax, -0x178(%rbp)
movq -0x168(%rbp), %rcx
movq -0x170(%rbp), %rax
movq %rcx, -0x158(%rbp)
movq %rax, -0x160(%rbp)
movq -0x158(%rbp), %rcx
movq -0x160(%rbp), %rax
movq %rcx, -0x148(%rbp)
movq %rax, -0x150(%rbp)
movq -0x148(%rbp), %rax
addq $0x68, %rax
movq -0x150(%rbp), %rcx
subq 0x5ce6e(%rip), %rcx     # 0xa25d8
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x180(%rbp)
movq -0x180(%rbp), %rcx
movq -0x178(%rbp), %rax
movq %rcx, -0x138(%rbp)
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rcx
movq -0x138(%rbp), %rax
movq %rcx, (%rax)
movq -0x220(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x220(%rbp)
jmp 0x456cd
jmp 0x457be
movq -0x1f0(%rbp), %rax
addq -0x1d0(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movq -0x1d8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1d8(%rbp)
movq -0x1e0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x1e0(%rbp)
jmp 0x45250
movq -0x1b0(%rbp), %rdi
addq $0x8, %rdi
callq 0x3c3a0
movq -0x1d8(%rbp), %rcx
movq -0x1b0(%rbp), %rax
addq 0x40(%rax), %rcx
movq %rcx, 0x40(%rax)
movq -0x1d0(%rbp), %rcx
movq -0x1b0(%rbp), %rax
addq 0x48(%rax), %rcx
movq %rcx, 0x48(%rax)
movq -0x1d0(%rbp), %rax
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
nopw (%rax,%rax)