// File: /workspace/github_c_makefile_star2_O2/zhou-yuxin[P]redis-aof-no-cow/deps/jemalloc/src/arena.c
// Function: arena_purge_to_limit
static void
arena_purge_to_limit(tsdn_t *tsdn, arena_t *arena, size_t ndirty_limit)
{
	chunk_hooks_t chunk_hooks = chunk_hooks_get(tsdn, arena);
	size_t npurge, npurged;
	arena_runs_dirty_link_t purge_runs_sentinel;
	extent_node_t purge_chunks_sentinel;

	arena->purging = true;

	/*
	 * Calls to arena_dirty_count() are disabled even for debug builds
	 * because overhead grows nonlinearly as memory usage increases.
	 */
	if (false && config_debug) {
		size_t ndirty = arena_dirty_count(arena);
		assert(ndirty == arena->ndirty);
	}
	assert(opt_purge != purge_mode_ratio || (arena->nactive >>
	    arena->lg_dirty_mult) < arena->ndirty || ndirty_limit == 0);

	qr_new(&purge_runs_sentinel, rd_link);
	extent_node_dirty_linkage_init(&purge_chunks_sentinel);

	npurge = arena_stash_dirty(tsdn, arena, &chunk_hooks, ndirty_limit,
	    &purge_runs_sentinel, &purge_chunks_sentinel);
	if (npurge == 0)
		goto label_return;
	npurged = arena_purge_stashed(tsdn, arena, &chunk_hooks,
	    &purge_runs_sentinel, &purge_chunks_sentinel);
	assert(npurged == npurge);
	arena_unstash_purged(tsdn, arena, &chunk_hooks, &purge_runs_sentinel,
	    &purge_chunks_sentinel);

	if (config_stats)
		arena->stats.npurge++;

label_return:
	arena->purging = false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdx, 0x10(%rsp)
movq %rsi, %rbx
movq %rdi, %rsi
leaq 0x60(%rsp), %rdi
movq %rsi, 0x18(%rsp)
movq %rbx, %rdx
callq 0x211f1
movq %rbx, %rsi
movb $0x1, 0x120(%rbx)
leaq 0x20(%rsp), %rax
movq %rax, (%rax)
movq %rax, 0x8(%rax)
leaq 0xc8(%rsp), %rax
movq %rax, (%rax)
movq %rax, 0x8(%rax)
leaq 0x98(%rsp), %rax
movq %rax, 0x40(%rax)
movq %rax, 0x48(%rax)
leaq 0x138(%rbx), %rax
movq %rax, 0x30(%rsp)
movq 0x138(%rbx), %r13
movq 0x188(%rbx), %r14
xorl %ebx, %ebx
movq %rsi, 0x8(%rsp)
cmpq 0x30(%rsp), %r13
je 0x1ad4a
movq (%r13), %r12
leaq 0x30(%r14), %rbp
cmpq %rbp, %r13
je 0x1ac5b
leaq 0x2e520(%rip), %rax     # 0x490d0
movq (%rax), %rcx
leaq -0x18(%r13), %rax
andq %rcx, %rax
notq %rcx
andq %r13, %rcx
subq 0x2e401(%rip), %rax     # 0x48fc8
xorl %edx, %edx
pushq $0x60
popq %rdi
divq %rdi
movq 0x78(%rcx,%rax,8), %rbp
movq %rbp, %r15
shrq $0xd, %r15
cmpl $0x1, 0x2d9ee(%rip)     # 0x485d0
jne 0x1abfc
movq 0x130(%rsi), %rax
subq %r15, %rax
subq %rbx, %rax
cmpq 0x10(%rsp), %rax
jb 0x1ad4a
cmpq %rcx, 0x110(%rsi)
jne 0x1ac19
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x1ee18
movq 0x8(%rsp), %rsi
shrq %rbp
movabsq $0x7ffffffffffff000, %rax # imm = 0x7FFFFFFFFFFFF000
andq %rax, %rbp
movq %rsi, %rdi
movq %r13, %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
callq 0x1f1be
movq 0x28(%rsp), %rax
movq %r13, (%rax)
movq 0x8(%r13), %rcx
leaq 0x20(%rsp), %rdx
movq %rdx, (%rcx)
movq %rcx, 0x28(%rsp)
movq %rax, 0x8(%r13)
jmp 0x1ad12
movq 0x10(%r14), %r8
movq %r8, %r15
shrq $0xc, %r15
cmpl $0x1, 0x2d963(%rip)     # 0x485d0
jne 0x1ac87
movq 0x130(%rsi), %rax
subq %r15, %rax
subq %rbx, %rax
cmpq 0x10(%rsp), %rax
jb 0x1ad4a
movq 0x40(%r14), %r13
xorl %eax, %eax
movb %al, 0x7(%rsp)
movb %al, 0x6(%rsp)
movq 0x8(%r14), %rcx
leaq 0x2e428(%rip), %rax     # 0x490c8
movq (%rax), %r9
movq 0x18(%rsp), %rdi
leaq 0x60(%rsp), %rdx
pushq $0x0
leaq 0xe(%rsp), %rax
pushq %rax
leaq 0x17(%rsp), %rax
pushq %rax
leaq 0x70(%rsp), %rax
pushq %rax
callq 0x2146e
addq $0x20, %rsp
movq 0x28(%rsp), %rax
movq %rbp, (%rax)
movq 0x38(%r14), %rcx
leaq 0x20(%rsp), %rdx
movq %rdx, (%rcx)
movq %rcx, 0x28(%rsp)
movq %rax, 0x38(%r14)
movq 0xe0(%rsp), %rax
movq %r14, 0x40(%rax)
movq 0x48(%r14), %rcx
leaq 0x98(%rsp), %rdx
movq %rdx, 0x40(%rcx)
movq %rcx, 0xe0(%rsp)
movq %rax, 0x48(%r14)
movq %r13, %r14
addq %rbx, %r15
cmpl $0x0, 0x2d8b4(%rip)     # 0x485d0
movq %r15, %rbx
movq %r12, %r13
movq 0x8(%rsp), %rsi
jne 0x1ab8d
movq 0x130(%rsi), %rax
subq %r15, %rax
movq %r15, %rbx
movq %r12, %r13
cmpq 0x10(%rsp), %rax
ja 0x1ab8d
jmp 0x1ad4d
movq %rbx, %r15
testq %r15, %r15
je 0x1b04d
leaq 0x10(%rsi), %rdi
movq %rdi, 0x40(%rsp)
callq 0xb380
pxor %xmm2, %xmm2
movq 0xd8(%rsp), %rcx
leaq 0x20(%rsp), %r14
leaq 0x2e34c(%rip), %r15     # 0x490c8
movq (%r14), %r14
leaq 0x20(%rsp), %rax
cmpq %rax, %r14
je 0x1af04
leaq 0x30(%rcx), %rax
cmpq %rax, %r14
je 0x1ae5d
movq %rcx, 0x10(%rsp)
movdqa %xmm2, 0x30(%rsp)
leaq 0x2e324(%rip), %rax     # 0x490d0
movq (%rax), %r13
leaq -0x18(%r14), %rax
andq %r13, %rax
notq %r13
andq %r14, %r13
subq 0x2e205(%rip), %rax     # 0x48fc8
xorl %edx, %edx
pushq $0x60
popq %rcx
divq %rcx
movq 0x2e1ee(%rip), %r12     # 0x48fc0
addq %rax, %r12
movq 0x78(%r13,%rax,8), %rbx
cmpb $0x1, 0x70(%r13)
jne 0x1adf1
movq (%r15), %rsi
movq %r13, %rdi
callq 0x296f0
movb $0x0, 0x70(%r13)
movq %rbx, %rbp
shrq %rbp
movabsq $0x7ffffffffffff000, %rax # imm = 0x7FFFFFFFFFFFF000
andq %rax, %rbp
movq (%r15), %rsi
movq %r12, %r15
shlq $0xc, %r15
movq 0x8(%rsp), %rax
movl (%rax), %r8d
movq %r13, %rdi
movq %r15, %rdx
movq %rbp, %rcx
callq *0x78(%rsp)
testb %al, %al
je 0x1ae6b
leaq 0x2e29a(%rip), %rax     # 0x490c8
movq (%rax), %r8
subq $0x8, %rsp
movq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rsi
leaq 0x68(%rsp), %rdx
movq %r13, %rcx
movq %r15, %r9
pushq %rbp
callq 0x21fcc
popq %rcx
popq %rdx
movzbl %al, %eax
shll $0x3, %eax
movq %rax, %rcx
jmp 0x1ae70
movq 0x10(%rcx), %rbx
movq 0x40(%rcx), %rcx
shrq $0xc, %rbx
jmp 0x1aeea
xorl %eax, %eax
pushq $0x4
popq %rcx
shrq $0xd, %rbx
leaq (%r12,%rbx), %rdx
movq 0x2e141(%rip), %rsi     # 0x48fc0
notq %rsi
addq %rdx, %rsi
orq $0x1fe3, %rcx           # imm = 0x1FE3
movq %rcx, 0x78(%r13,%rsi,8)
movq %r12, %rdx
subq 0x2e125(%rip), %rdx     # 0x48fc0
addq %rbp, %rbp
orq %rcx, %rbp
movq %rbp, 0x78(%r13,%rdx,8)
leaq -0x1(%rbx), %rcx
leaq 0x80(,%r12,8), %rdx
addq %r13, %rdx
pushq $0x1
popq %rsi
leaq 0x2e209(%rip), %r15     # 0x490c8
movdqa 0x30(%rsp), %xmm2
cmpq %rcx, %rsi
jae 0x1aee5
movq 0x2e0ef(%rip), %rdi     # 0x48fc0
shlq $0x3, %rdi
negq %rdi
movq %rax, (%rdx,%rdi)
incq %rsi
addq $0x8, %rdx
jmp 0x1aec5
movq 0x10(%rsp), %rcx
movq %rbx, %xmm0
movdqa 0x1bf39(%rip), %xmm1    # 0x36e30
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
paddq %xmm1, %xmm2
jmp 0x1ad7c
movq 0x40(%rsp), %rdi
movdqa %xmm2, 0x30(%rsp)
callq 0xb5a0
movq 0x8(%rsp), %rax
movdqu 0x78(%rax), %xmm0
paddq 0x30(%rsp), %xmm0
movdqu %xmm0, 0x78(%rax)
leaq 0x20(%rsp), %rbx
movq (%rbx), %r14
movq 0xd8(%rsp), %r12
pushq $0x1
popq %rbp
leaq 0x30(%r12), %r15
movq %r14, %rcx
cmpq %rbx, %r14
je 0x1b044
movq (%rcx), %r14
cmpq %r15, %rcx
je 0x1afc0
leaq 0x2e174(%rip), %rax     # 0x490d0
movq (%rax), %rsi
notq %rsi
leaq -0x18(%rcx), %rax
andq %rsi, %rax
addq 0x2e058(%rip), %rax     # 0x48fc8
andq %rcx, %rsi
negq %rax
addq %rcx, %rax
addq $-0x18, %rax
xorl %edx, %edx
pushq $0x60
popq %rdi
divq %rdi
movl 0x78(%rsi,%rax,8), %r9d
andl $0x4, %r9d
shrl $0x2, %r9d
movq 0x8(%rcx), %rax
movq %r14, (%rax)
movq (%rcx), %rdx
movq %rax, 0x8(%rdx)
movq %rcx, (%rcx)
movq %rcx, 0x8(%rcx)
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %rcx, %rdx
xorl %ecx, %ecx
movl %ebp, %r8d
callq 0x1fd91
jmp 0x1af41
movq 0x40(%r12), %rax
movq %rax, 0x30(%rsp)
movq 0x8(%r12), %r13
movq 0x10(%r12), %rax
movq %rax, 0x40(%rsp)
movq 0x18(%r12), %rax
movq %rax, 0x50(%rsp)
movzbl 0x20(%r12), %eax
movq %rax, 0x10(%rsp)
movzbl 0x21(%r12), %eax
movq %rax, 0x48(%rsp)
movq %r12, %rdi
callq 0x19df3
movq 0x8(%rsp), %r15
movq %r15, %rsi
movq %r12, %rdx
callq 0x19ec9
movq 0x18(%rsp), %rdi
movq %r15, %rsi
leaq 0x60(%rsp), %rdx
movq %r13, %rcx
movq 0x40(%rsp), %r8
movq 0x50(%rsp), %r9
pushq 0x48(%rsp)
pushq 0x18(%rsp)
callq 0x21eb3
popq %rax
popq %rcx
movq 0x30(%rsp), %r12
jmp 0x1af3c
movq 0x8(%rsp), %rsi
incq 0x70(%rsi)
movb $0x0, 0x120(%rsi)
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq