// File: /workspace/github_c_makefile_star2_O1/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, 0x18(%rsp)
movq %rsi, %rbx
movq %rdi, %rsi
leaq 0x60(%rsp), %rdi
movq %rsi, 0x40(%rsp)
movq %rbx, %rdx
callq 0x265ab
movq %rbx, %rsi
movb $0x1, 0x120(%rbx)
leaq 0x30(%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, 0x20(%rsp)
movq 0x138(%rbx), %r12
movq 0x188(%rbx), %r9
xorl %r14d, %r14d
movq %rbx, 0x28(%rsp)
cmpq 0x20(%rsp), %r12
je 0x2298b
movq %r12, %r13
movq (%r12), %r12
leaq 0x30(%r9), %rbp
cmpq %rbp, %r13
je 0x2287a
leaq 0x2a918(%rip), %rax     # 0x4d0d0
movq (%rax), %rcx
leaq -0x18(%r13), %rax
andq %rcx, %rax
subq 0x2a7ff(%rip), %rax     # 0x4cfc8
notq %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rdx
andq %r13, %rcx
shrq $0x6, %rdx
movq 0x78(%rcx,%rdx,8), %rbp
movq %rbp, %rbx
shrq $0xd, %rbx
cmpl $0x1, 0x29ddd(%rip)     # 0x4c5d0
jne 0x2280d
movq 0x130(%rsi), %rax
subq %rbx, %rax
subq %r14, %rax
cmpq 0x18(%rsp), %rax
jb 0x228a2
movq %r9, 0x10(%rsp)
cmpq %rcx, 0x110(%rsi)
jne 0x2282a
movq 0x40(%rsp), %rdi
callq 0x24c04
movq 0x28(%rsp), %rsi
shrq %rbp
movabsq $0x7ffffffffffff000, %rax # imm = 0x7FFFFFFFFFFFF000
andq %rax, %rbp
xorl %r15d, %r15d
movq %rsi, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x25003
movq 0x28(%rsp), %rsi
movq 0x38(%rsp), %rax
movq %r13, (%rax)
movq 0x8(%r13), %rcx
leaq 0x30(%rsp), %rdx
movq %rdx, (%rcx)
movq %rcx, 0x38(%rsp)
movq %rax, 0x8(%r13)
jmp 0x22947
movq 0x10(%r9), %r8
movq %r8, %rbx
shrq $0xc, %rbx
cmpl $0x1, 0x29d44(%rip)     # 0x4c5d0
jne 0x228af
movq 0x130(%rsi), %rax
subq %rbx, %rax
subq %r14, %rax
cmpq 0x18(%rsp), %rax
jae 0x228af
movl $0x2, %r15d
xorl %eax, %eax
jmp 0x2294e
movq 0x40(%r9), %rax
movq %rax, 0x10(%rsp)
xorl %r15d, %r15d
movb %r15b, 0xf(%rsp)
movb %r15b, 0xe(%rsp)
movq 0x8(%r9), %rcx
leaq 0x2a7f8(%rip), %rax     # 0x4d0c8
movq %r9, %r13
movq (%rax), %r9
movq 0x40(%rsp), %rdi
leaq 0x60(%rsp), %rdx
pushq $0x0
leaq 0x16(%rsp), %rax
pushq %rax
leaq 0x1f(%rsp), %rax
pushq %rax
leaq 0x70(%rsp), %rax
pushq %rax
callq 0x2687b
movq 0x48(%rsp), %rsi
addq $0x20, %rsp
movq 0x38(%rsp), %rax
movq %rbp, (%rax)
movq 0x38(%r13), %rcx
leaq 0x30(%rsp), %rdx
movq %rdx, (%rcx)
movq %rcx, 0x38(%rsp)
movq %rax, 0x38(%r13)
movq 0xe0(%rsp), %rax
movq %r13, 0x40(%rax)
movq 0x48(%r13), %rcx
leaq 0x98(%rsp), %rdx
movq %rdx, 0x40(%rcx)
movq %rcx, 0xe0(%rsp)
movq %rax, 0x48(%r13)
movb $0x1, %al
movq 0x10(%rsp), %r9
testb %al, %al
je 0x2297a
addq %r14, %rbx
cmpl $0x0, 0x29c74(%rip)     # 0x4c5d0
jne 0x22975
movq 0x130(%rsi), %rax
subq %rbx, %rax
movl $0x2, %r15d
cmpq 0x18(%rsp), %rax
jbe 0x2297d
xorl %r15d, %r15d
jmp 0x2297d
movq %r14, %rbx
movq %rbx, %r14
testl %r15d, %r15d
je 0x22792
jmp 0x2298e
movq %r14, %rbx
testq %rbx, %rbx
je 0x22cdf
leaq 0x10(%rsi), %rdi
movq %rdi, 0x48(%rsp)
callq 0xb380
movq 0x30(%rsp), %rbx
leaq 0x30(%rsp), %rax
cmpq %rax, %rbx
je 0x22b65
movq 0xd8(%rsp), %rcx
xorl %r15d, %r15d
xorl %r13d, %r13d
leaq 0x2a6fb(%rip), %r12     # 0x4d0c8
leaq 0x30(%rcx), %rax
cmpq %rax, %rbx
je 0x22aaf
movq %rcx, 0x18(%rsp)
movq %r13, 0x10(%rsp)
movq %r15, 0x20(%rsp)
leaq 0x2a6e0(%rip), %rax     # 0x4d0d0
movq (%rax), %r13
leaq -0x18(%rbx), %rax
andq %r13, %rax
subq 0x2a5c7(%rip), %rax     # 0x4cfc8
notq %r13
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rcx
andq %rbx, %r13
shrq $0x6, %rdx
movq 0x2a5a1(%rip), %r15     # 0x4cfc0
addq %rdx, %r15
movq 0x78(%r13,%rdx,8), %r14
cmpb $0x1, 0x70(%r13)
jne 0x22a3f
movq (%r12), %rsi
movq %r13, %rdi
callq 0x2e8e2
movb $0x0, 0x70(%r13)
movq %r14, %rbp
shrq %rbp
movabsq $0x7ffffffffffff000, %rax # imm = 0x7FFFFFFFFFFFF000
andq %rax, %rbp
movq (%r12), %rsi
movq %r15, 0x50(%rsp)
shlq $0xc, %r15
movq 0x28(%rsp), %r12
movl (%r12), %r8d
movq %r13, %rdi
movq %r15, %rdx
movq %rbp, %rcx
callq *0x78(%rsp)
testb %al, %al
je 0x22ac0
leaq 0x2a648(%rip), %rax     # 0x4d0c8
movq (%rax), %r8
subq $0x8, %rsp
movq 0x48(%rsp), %rdi
movq %r12, %rsi
leaq 0x68(%rsp), %rdx
movq %r13, %rcx
movq %r15, %r9
pushq %rbp
callq 0x274d6
addq $0x10, %rsp
movzbl %al, %eax
shll $0x3, %eax
movq %rax, %rcx
jmp 0x22ac7
movq 0x10(%rcx), %r14
movq 0x40(%rcx), %rcx
shrq $0xc, %r14
jmp 0x22b4c
movl $0x4, %ecx
xorl %eax, %eax
movq 0x20(%rsp), %r15
shrq $0xd, %r14
movq 0x50(%rsp), %rdi
leaq (%rdi,%r14), %rdx
movq 0x2a4e0(%rip), %rsi     # 0x4cfc0
notq %rsi
addq %rdx, %rsi
orq $0x1fe3, %rcx           # imm = 0x1FE3
movq %rcx, 0x78(%r13,%rsi,8)
movq %rdi, %rdx
subq 0x2a4c4(%rip), %rdx     # 0x4cfc0
addq %rbp, %rbp
orq %rcx, %rbp
movq %rbp, 0x78(%r13,%rdx,8)
leaq -0x1(%r14), %rcx
cmpq $0x2, %rcx
leaq 0x2a5b2(%rip), %r12     # 0x4d0c8
jb 0x22b42
leaq -0x2(%r14), %rcx
leaq 0x80(,%rdi,8), %rdx
addq %r13, %rdx
movq 0x2a492(%rip), %rsi     # 0x4cfc0
shlq $0x3, %rsi
negq %rsi
movq %rax, (%rdx,%rsi)
addq $0x8, %rdx
decq %rcx
jne 0x22b27
movq 0x10(%rsp), %r13
movq 0x18(%rsp), %rcx
addq %r14, %r15
incq %r13
movq (%rbx), %rbx
leaq 0x30(%rsp), %rax
cmpq %rax, %rbx
jne 0x229cd
jmp 0x22b6b
xorl %r13d, %r13d
xorl %r15d, %r15d
movq 0x48(%rsp), %rdi
callq 0xb5a0
movq 0x28(%rsp), %rsi
addq %r13, 0x78(%rsi)
addq %r15, 0x80(%rsi)
movq 0x30(%rsp), %rcx
leaq 0x30(%rsp), %rax
cmpq %rax, %rcx
je 0x22cdb
movq 0xd8(%rsp), %r12
movq (%rcx), %rbx
leaq 0x30(%r12), %rax
cmpq %rax, %rcx
jne 0x22c66
movq 0x40(%r12), %r15
movq 0x8(%r12), %r13
movq 0x10(%r12), %rbp
movq 0x18(%r12), %r14
movzbl 0x20(%r12), %ecx
movq %rcx, 0x10(%rsp)
movq %rbx, 0x20(%rsp)
movzbl 0x21(%r12), %ebx
movq 0x30(%r12), %rcx
movq 0x38(%r12), %rdx
movq %rcx, (%rdx)
movq 0x30(%r12), %rcx
movq %rdx, 0x8(%rcx)
movq %rax, 0x30(%r12)
movq %rax, 0x38(%r12)
movq 0x48(%r12), %rax
movq %r15, 0x40(%rax)
movq 0x40(%r12), %rcx
movq %rax, 0x48(%rcx)
movq %r12, 0x40(%r12)
movq %r12, 0x48(%r12)
movq %r12, %rdx
movq %rsi, %r12
callq 0x21b05
movq 0x40(%rsp), %rdi
movq %r12, %rsi
leaq 0x60(%rsp), %rdx
movq %r13, %rcx
movq %rbp, %r8
movq %r14, %r9
pushq %rbx
movq 0x28(%rsp), %rbx
pushq 0x18(%rsp)
callq 0x273ec
addq $0x10, %rsp
movq %r15, %r12
movq %rbx, %rcx
leaq 0x30(%rsp), %rax
cmpq %rax, %rbx
movq 0x28(%rsp), %rsi
jne 0x22ba0
jmp 0x22cdb
leaq 0x2a463(%rip), %rax     # 0x4d0d0
movq (%rax), %rdi
notq %rdi
leaq -0x18(%rcx), %rax
andq %rdi, %rax
addq 0x2a347(%rip), %rax     # 0x4cfc8
negq %rax
addq %rcx, %rax
addq $-0x18, %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rdx
andq %rcx, %rdi
shrq $0x6, %rdx
movl 0x78(%rdi,%rdx,8), %r9d
andl $0x4, %r9d
shrl $0x2, %r9d
movq 0x8(%rcx), %rax
movq %rbx, (%rax)
movq (%rcx), %rdx
movq %rax, 0x8(%rdx)
movq %rcx, (%rcx)
movq %rcx, 0x8(%rcx)
movq 0x40(%rsp), %rdi
movq %rcx, %rdx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0xf459
jmp 0x22c4e
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