// File: /workspace/github_c_makefile_star2_O0/zhou-yuxin[P]redis-aof-no-cow/deps/jemalloc/src/arena.c
// Function: arena_purge_stashed
static size_t
arena_purge_stashed(tsdn_t *tsdn, 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(tsdn, &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;

			/*
			 * If this is the first run purged within chunk, mark
			 * the chunk as non-huge.  This will prevent all use of
			 * transparent huge pages for this chunk until the chunk
			 * as a whole is deallocated.
			 */
			if (chunk->hugepage) {
				pages_nohuge(chunk, chunksize);
				chunk->hugepage = false;
			}

			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(tsdn, 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(tsdn, &arena->lock);

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

	return (npurged);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movq %rdi, -0x1c0(%rbp)
movq %rsi, -0x1c8(%rbp)
movq %rdx, -0x1d0(%rbp)
movq %rcx, -0x1d8(%rbp)
movq %r8, -0x1e0(%rbp)
movq $0x0, -0x1f0(%rbp)
movq $0x0, -0x1e8(%rbp)
movq -0x1c0(%rbp), %rdi
movq -0x1c8(%rbp), %rsi
addq $0x10, %rsi
callq 0x3a6b0
movq -0x1d8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x1f8(%rbp)
movq -0x1e0(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x200(%rbp)
movq -0x1f8(%rbp), %rax
cmpq -0x1d8(%rbp), %rax
je 0x45b00
movq -0x1f8(%rbp), %rax
movq -0x200(%rbp), %rcx
addq $0x30, %rcx
cmpq %rcx, %rax
jne 0x45565
movq -0x200(%rbp), %rdi
callq 0x44740
movq %rax, -0x210(%rbp)
movq -0x210(%rbp), %rax
shrq $0xc, %rax
movq %rax, -0x208(%rbp)
movq -0x200(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x200(%rbp)
jmp 0x45ac3
movq -0x1f8(%rbp), %rax
leaq 0x5eb3d(%rip), %rcx     # 0xa40b0
movq (%rcx), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq %rax, -0x248(%rbp)
movq -0x1f8(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0x1b0(%rbp), %rax
subq $0x18, %rax
movq %rax, -0x1b8(%rbp)
movq -0x1b8(%rbp), %rax
movq %rax, -0x250(%rbp)
movq -0x250(%rbp), %rax
movq %rax, -0x198(%rbp)
movq -0x198(%rbp), %rax
leaq 0x5eae2(%rip), %rcx     # 0xa40b0
movq (%rcx), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq %rax, -0x1a0(%rbp)
movq -0x198(%rbp), %rax
movq -0x1a0(%rbp), %rcx
addq 0x5e9b4(%rip), %rcx     # 0xa3fa8
subq %rcx, %rax
movl $0x60, %ecx
xorl %edx, %edx
divq %rcx
addq 0x5e998(%rip), %rax     # 0xa3fa0
movq %rax, -0x1a8(%rbp)
movq -0x1a8(%rbp), %rax
movq %rax, -0x218(%rbp)
movq -0x248(%rbp), %rcx
movq -0x218(%rbp), %rax
movq %rcx, -0x60(%rbp)
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rcx, -0x50(%rbp)
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, -0x28(%rbp)
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rcx
movq -0x30(%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 $0x78, %rax
movq -0x10(%rbp), %rcx
subq 0x5e91a(%rip), %rcx     # 0xa3fa0
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
andq $-0x2000, %rax          # imm = 0xE000
shrq %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x220(%rbp)
movq -0x220(%rbp), %rax
shrq $0xc, %rax
movq %rax, -0x208(%rbp)
movq -0x248(%rbp), %rax
testb $0x1, 0x70(%rax)
je 0x45700
movq -0x248(%rbp), %rdi
leaq 0x5e9bb(%rip), %rax     # 0xa40a8
movq (%rax), %rsi
callq 0x67280
movq -0x248(%rbp), %rax
movb $0x0, 0x70(%rax)
jmp 0x45702
jmp 0x45704
jmp 0x45706
jmp 0x45708
jmp 0x4570a
jmp 0x4570c
movq -0x1d0(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x248(%rbp), %rdi
leaq 0x5e983(%rip), %rcx     # 0xa40a8
movq (%rcx), %rsi
movq -0x218(%rbp), %rdx
shlq $0xc, %rdx
movq -0x208(%rbp), %rcx
shlq $0xc, %rcx
movq -0x1c8(%rbp), %r8
movl (%r8), %r8d
callq *%rax
xorb $-0x1, %al
andb $0x1, %al
movb %al, -0x239(%rbp)
testb $0x1, -0x239(%rbp)
je 0x45775
movq $0x0, -0x228(%rbp)
movq $0x4, -0x230(%rbp)
jmp 0x457db
movq -0x1c0(%rbp), %rdi
movq -0x1c8(%rbp), %rsi
movq -0x1d0(%rbp), %rdx
movq -0x248(%rbp), %rcx
leaq 0x5e910(%rip), %rax     # 0xa40a8
movq (%rax), %r8
movq -0x218(%rbp), %r9
shlq $0xc, %r9
movq -0x220(%rbp), %rax
movq %rax, (%rsp)
callq 0x52c40
movb %al, %dl
xorl %eax, %eax
movl $0x8, %ecx
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, -0x228(%rbp)
movq -0x228(%rbp), %rax
movq %rax, -0x230(%rbp)
movq -0x248(%rbp), %rdx
movq -0x218(%rbp), %rcx
addq -0x208(%rbp), %rcx
subq $0x1, %rcx
movq -0x230(%rbp), %rax
movq %rdx, -0xb8(%rbp)
movq %rcx, -0xc0(%rbp)
movq $0x0, -0xc8(%rbp)
movq %rax, -0xd0(%rbp)
movq -0xb8(%rbp), %rcx
movq -0xc0(%rbp), %rax
movq %rcx, -0xa8(%rbp)
movq %rax, -0xb0(%rbp)
movq -0xa8(%rbp), %rcx
movq -0xb0(%rbp), %rax
movq %rcx, -0x98(%rbp)
movq %rax, -0xa0(%rbp)
movq -0x98(%rbp), %rax
addq $0x78, %rax
movq -0xa0(%rbp), %rcx
subq 0x5e734(%rip), %rcx     # 0xa3fa0
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rcx
movq -0xc8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
shlq %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
orq $0x1fe0, %rax           # imm = 0x1FE0
orq -0xd0(%rbp), %rax
orq $0x2, %rax
orq $0x1, %rax
movq %rcx, -0x88(%rbp)
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rcx
movq -0x88(%rbp), %rax
movq %rcx, (%rax)
movq -0x248(%rbp), %rsi
movq -0x218(%rbp), %rdx
movq -0x220(%rbp), %rcx
movq -0x230(%rbp), %rax
movq %rsi, -0x120(%rbp)
movq %rdx, -0x128(%rbp)
movq %rcx, -0x130(%rbp)
movq %rax, -0x138(%rbp)
movq -0x120(%rbp), %rcx
movq -0x128(%rbp), %rax
movq %rcx, -0x110(%rbp)
movq %rax, -0x118(%rbp)
movq -0x110(%rbp), %rcx
movq -0x118(%rbp), %rax
movq %rcx, -0x100(%rbp)
movq %rax, -0x108(%rbp)
movq -0x100(%rbp), %rax
addq $0x78, %rax
movq -0x108(%rbp), %rcx
subq 0x5e648(%rip), %rcx     # 0xa3fa0
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rcx
movq -0x130(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
shlq %rax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
orq $0x1fe0, %rax           # imm = 0x1FE0
orq -0x138(%rbp), %rax
orq $0x2, %rax
orq $0x1, %rax
movq %rcx, -0xf0(%rbp)
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rcx
movq -0xf0(%rbp), %rax
movq %rcx, (%rax)
movq $0x1, -0x238(%rbp)
movq -0x238(%rbp), %rax
movq -0x208(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x45ac1
movq -0x248(%rbp), %rdx
movq -0x218(%rbp), %rcx
addq -0x238(%rbp), %rcx
movq -0x228(%rbp), %rax
movq %rdx, -0x178(%rbp)
movq %rcx, -0x180(%rbp)
movq %rax, -0x188(%rbp)
movq -0x178(%rbp), %rcx
movq -0x180(%rbp), %rax
movq %rcx, -0x168(%rbp)
movq %rax, -0x170(%rbp)
movq -0x168(%rbp), %rcx
movq -0x170(%rbp), %rax
movq %rcx, -0x158(%rbp)
movq %rax, -0x160(%rbp)
movq -0x158(%rbp), %rax
addq $0x78, %rax
movq -0x160(%rbp), %rcx
subq 0x5e531(%rip), %rcx     # 0xa3fa0
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x190(%rbp)
movq -0x190(%rbp), %rcx
movq -0x188(%rbp), %rax
movq %rcx, -0x148(%rbp)
movq %rax, -0x150(%rbp)
movq -0x150(%rbp), %rcx
movq -0x148(%rbp), %rax
movq %rcx, (%rax)
movq -0x238(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x238(%rbp)
jmp 0x459d2
jmp 0x45ac3
movq -0x208(%rbp), %rax
addq -0x1e8(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movq -0x1f0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1f0(%rbp)
movq -0x1f8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x1f8(%rbp)
jmp 0x454fe
movq -0x1c0(%rbp), %rdi
movq -0x1c8(%rbp), %rsi
addq $0x10, %rsi
callq 0x3a660
movq -0x1f0(%rbp), %rcx
movq -0x1c8(%rbp), %rax
addq 0x78(%rax), %rcx
movq %rcx, 0x78(%rax)
movq -0x1e8(%rbp), %rcx
movq -0x1c8(%rbp), %rax
addq 0x80(%rax), %rcx
movq %rcx, 0x80(%rax)
movq -0x1e8(%rbp), %rax
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
nopl (%rax)