// File: /workspace/github_c_makefile_star2_O3/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, 0x8(%rsp)
movq %rsi, %rbx
movq %rdi, %rsi
leaq 0x60(%rsp), %rdi
movq %rsi, 0x28(%rsp)
movq %rbx, %rdx
callq 0x26557
movq %rbx, %r10
movb $0x1, 0x120(%rbx)
leaq 0x18(%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 0x138(%rbx), %r13
movq %rax, 0x30(%rsp)
cmpq %rax, %r13
je 0x22ba8
movq 0x188(%r10), %r15
xorl %ecx, %ecx
xorl %r14d, %r14d
movq %r10, 0x10(%rsp)
movq (%r13), %r12
leaq 0x30(%r15), %rbp
cmpq %rbp, %r13
je 0x22756
leaq 0x2aa2f(%rip), %rax     # 0x4d0d0
movq (%rax), %rsi
leaq -0x18(%r13), %rax
andq %rsi, %rax
subq 0x2a916(%rip), %rax     # 0x4cfc8
notq %rsi
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rdx
andq %r13, %rsi
shrq $0x6, %rdx
movq 0x78(%rsi,%rdx,8), %rbp
movq %rbp, %rbx
shrq $0xd, %rbx
cmpl $0x1, 0x29ef4(%rip)     # 0x4c5d0
jne 0x226f3
subq %rbx, %rcx
addq 0x130(%r10), %rcx
cmpq 0x8(%rsp), %rcx
jb 0x22852
cmpq %rsi, 0x110(%r10)
jne 0x2270e
movq 0x28(%rsp), %rdi
movq %r10, %rsi
callq 0x24b13
movq 0x10(%rsp), %r10
shrq %rbp
movabsq $0x7ffffffffffff000, %rax # imm = 0x7FFFFFFFFFFFF000
andq %rax, %rbp
movq %r10, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x24f71
movq 0x20(%rsp), %rax
movq %r13, (%rax)
movq 0x8(%r13), %rcx
leaq 0x18(%rsp), %rdx
movq %rdx, (%rcx)
movq %rcx, 0x20(%rsp)
movq %rax, 0x8(%r13)
jmp 0x2280d
movq 0x10(%r15), %r8
movq %r8, %rbx
shrq $0xc, %rbx
cmpl $0x1, 0x29e68(%rip)     # 0x4c5d0
jne 0x2277f
subq %rbx, %rcx
addq 0x130(%r10), %rcx
cmpq 0x8(%rsp), %rcx
jb 0x22852
movq 0x40(%r15), %r13
xorl %eax, %eax
movb %al, 0x7(%rsp)
movb %al, 0x6(%rsp)
movq 0x8(%r15), %rcx
leaq 0x2a930(%rip), %rax     # 0x4d0c8
movq (%rax), %r9
movq 0x28(%rsp), %rdi
movq %r10, %rsi
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 0x26812
addq $0x20, %rsp
movq 0x20(%rsp), %rax
movq %rbp, (%rax)
movq 0x38(%r15), %rcx
leaq 0x18(%rsp), %rdx
movq %rdx, (%rcx)
movq %rcx, 0x20(%rsp)
movq %rax, 0x38(%r15)
movq 0xe0(%rsp), %rax
movq %r15, 0x40(%rax)
movq 0x48(%r15), %rcx
leaq 0x98(%rsp), %rdx
movq %rdx, 0x40(%rcx)
movq %rcx, 0xe0(%rsp)
movq %rax, 0x48(%r15)
movq %r13, %r15
addq %rbx, %r14
cmpl $0x0, 0x29db9(%rip)     # 0x4c5d0
je 0x22827
cmpq 0x30(%rsp), %r12
movq 0x10(%rsp), %r10
jne 0x22844
jmp 0x22852
movq 0x10(%rsp), %r10
movq 0x130(%r10), %rax
subq %r14, %rax
cmpq 0x8(%rsp), %rax
jbe 0x22852
cmpq 0x30(%rsp), %r12
je 0x22852
movq %r14, %rcx
negq %rcx
movq %r12, %r13
jmp 0x22689
testq %r14, %r14
leaq 0x2a86c(%rip), %rbx     # 0x4d0c8
je 0x22ba8
leaq 0x10(%r10), %rdi
movq %rdi, 0x48(%rsp)
callq 0xb380
movq 0x18(%rsp), %r12
leaq 0x18(%rsp), %rax
pxor %xmm2, %xmm2
cmpq %rax, %r12
je 0x22a2b
movq 0xd8(%rsp), %rcx
leaq 0x30(%rcx), %rax
cmpq %rax, %r12
je 0x2296b
movq %rcx, 0x8(%rsp)
movdqa %xmm2, 0x30(%rsp)
leaq 0x2a822(%rip), %rax     # 0x4d0d0
movq (%rax), %r13
leaq -0x18(%r12), %rax
andq %r13, %rax
subq 0x2a708(%rip), %rax     # 0x4cfc8
notq %r13
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rcx
andq %r12, %r13
shrq $0x6, %rdx
movq 0x2a6e2(%rip), %r15     # 0x4cfc0
addq %rdx, %r15
movq 0x78(%r13,%rdx,8), %r14
cmpb $0x1, 0x70(%r13)
jne 0x228fd
movq (%rbx), %rsi
movq %r13, %rdi
callq 0x2e746
movb $0x0, 0x70(%r13)
movq %r14, %rbp
shrq %rbp
movabsq $0x7ffffffffffff000, %rax # imm = 0x7FFFFFFFFFFFF000
andq %rax, %rbp
movq (%rbx), %rsi
movq %r15, 0x50(%rsp)
shlq $0xc, %r15
movq 0x10(%rsp), %rbx
movl (%rbx), %r8d
movq %r13, %rdi
movq %r15, %rdx
movq %rbp, %rcx
callq *0x78(%rsp)
testb %al, %al
je 0x2297c
leaq 0x2a78c(%rip), %rax     # 0x4d0c8
movq (%rax), %r8
subq $0x8, %rsp
movq 0x30(%rsp), %rdi
movq %rbx, %rsi
leaq 0x68(%rsp), %rdx
movq %r13, %rcx
movq %r15, %r9
pushq %rbp
callq 0x2747b
addq $0x10, %rsp
movzbl %al, %eax
shll $0x3, %eax
movq %rax, %rcx
jmp 0x22983
movq 0x10(%rcx), %r14
movq 0x40(%rcx), %rcx
shrq $0xc, %r14
jmp 0x22a04
movl $0x4, %ecx
xorl %eax, %eax
movdqa 0x30(%rsp), %xmm2
shrq $0xd, %r14
movq 0x50(%rsp), %rdi
leaq (%rdi,%r14), %rdx
movq 0x2a623(%rip), %rsi     # 0x4cfc0
notq %rsi
addq %rdx, %rsi
orq $0x1fe3, %rcx           # imm = 0x1FE3
movq %rcx, 0x78(%r13,%rsi,8)
movq %rdi, %rdx
subq 0x2a607(%rip), %rdx     # 0x4cfc0
addq %rbp, %rbp
orq %rcx, %rbp
movq %rbp, 0x78(%r13,%rdx,8)
leaq -0x1(%r14), %rcx
cmpq $0x2, %rcx
leaq 0x2a6f5(%rip), %rbx     # 0x4d0c8
jb 0x229ff
leaq -0x2(%r14), %rcx
leaq 0x80(,%rdi,8), %rdx
addq %r13, %rdx
movq 0x2a5d5(%rip), %rsi     # 0x4cfc0
shlq $0x3, %rsi
negq %rsi
movq %rax, (%rdx,%rsi)
addq $0x8, %rdx
decq %rcx
jne 0x229e4
movq 0x8(%rsp), %rcx
movq %r14, %xmm0
movdqa 0x1988f(%rip), %xmm1    # 0x3c2a0
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
paddq %xmm1, %xmm2
movq (%r12), %r12
leaq 0x18(%rsp), %rax
cmpq %rax, %r12
jne 0x2288f
movdqa %xmm2, 0x30(%rsp)
movq 0x48(%rsp), %rdi
callq 0xb5a0
movq 0x10(%rsp), %r10
movdqu 0x78(%r10), %xmm0
paddq 0x30(%rsp), %xmm0
movdqu %xmm0, 0x78(%r10)
movq 0x18(%rsp), %rcx
leaq 0x18(%rsp), %rax
cmpq %rax, %rcx
je 0x22ba4
movq 0xd8(%rsp), %r12
movq (%rcx), %rbx
leaq 0x30(%r12), %rax
cmpq %rax, %rcx
jne 0x22b2c
movq 0x40(%r12), %r14
movq 0x8(%r12), %r13
movq 0x10(%r12), %rbp
movq 0x18(%r12), %r15
movzbl 0x20(%r12), %ecx
movq %rcx, 0x8(%rsp)
movq %rbx, 0x30(%rsp)
movzbl 0x21(%r12), %ebx
movq 0x30(%r12), %rcx
movq 0x38(%r12), %rdx
movq %rcx, (%rdx)
movq %rdx, 0x8(%rcx)
movq %rax, 0x30(%r12)
movq %rax, 0x38(%r12)
movq 0x48(%r12), %rax
movq %r14, 0x40(%rax)
movq %rax, 0x48(%r14)
movq %r12, 0x40(%r12)
movq %r12, 0x48(%r12)
movq %r10, %rsi
movq %r12, %rdx
movq %r10, %r12
callq 0x2196f
movq 0x28(%rsp), %rdi
movq %r12, %rsi
leaq 0x60(%rsp), %rdx
movq %r13, %rcx
movq %rbp, %r8
movq %r15, %r9
pushq %rbx
movq 0x38(%rsp), %rbx
pushq 0x10(%rsp)
callq 0x27376
addq $0x10, %rsp
movq %r14, %r12
movq %rbx, %rcx
leaq 0x18(%rsp), %rax
cmpq %rax, %rbx
movq 0x10(%rsp), %r10
jne 0x22a6d
jmp 0x22ba4
leaq 0x2a59d(%rip), %rax     # 0x4d0d0
movq (%rax), %rsi
notq %rsi
leaq -0x18(%rcx), %rax
andq %rsi, %rax
addq 0x2a481(%rip), %rax     # 0x4cfc8
negq %rax
addq %rcx, %rax
addq $-0x18, %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rdx
andq %rcx, %rsi
shrq $0x6, %rdx
movl 0x78(%rsi,%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 0x28(%rsp), %rdi
movq %r10, %rsi
movq %rcx, %rdx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0xed9d
jmp 0x22b14
incq 0x70(%r10)
movb $0x0, 0x120(%r10)
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq