// File: /workspace/github_c_makefile_star2_O0/zhou-yuxin[P]redis-aof-no-cow/deps/jemalloc/src/arena.c
// Function: je_arena_reset
void
arena_reset(tsd_t *tsd, arena_t *arena)
{
	unsigned i;
	extent_node_t *node;

	/*
	 * Locking in this function is unintuitive.  The caller guarantees that
	 * no concurrent operations are happening in this arena, but there are
	 * still reasons that some locking is necessary:
	 *
	 * - Some of the functions in the transitive closure of calls assume
	 *   appropriate locks are held, and in some cases these locks are
	 *   temporarily dropped to avoid lock order reversal or deadlock due to
	 *   reentry.
	 * - mallctl("epoch", ...) may concurrently refresh stats.  While
	 *   strictly speaking this is a "concurrent operation", disallowing
	 *   stats refreshes would impose an inconvenient burden.
	 */

	/* Remove large allocations from prof sample set. */
	if (config_prof && opt_prof) {
		ql_foreach(node, &arena->achunks, ql_link) {
			arena_achunk_prof_reset(tsd, arena,
			    extent_node_addr_get(node));
		}
	}

	/* Reset curruns for large size classes. */
	if (config_stats) {
		for (i = 0; i < nlclasses; i++)
			arena->stats.lstats[i].curruns = 0;
	}

	/* Huge allocations. */
	malloc_mutex_lock(tsd_tsdn(tsd), &arena->huge_mtx);
	for (node = ql_last(&arena->huge, ql_link); node != NULL; node =
	    ql_last(&arena->huge, ql_link)) {
		void *ptr = extent_node_addr_get(node);
		size_t usize;

		malloc_mutex_unlock(tsd_tsdn(tsd), &arena->huge_mtx);
		if (config_stats || (config_prof && opt_prof))
			usize = isalloc(tsd_tsdn(tsd), ptr, config_prof);
		/* Remove huge allocation from prof sample set. */
		if (config_prof && opt_prof)
			prof_free(tsd, ptr, usize);
		huge_dalloc(tsd_tsdn(tsd), ptr);
		malloc_mutex_lock(tsd_tsdn(tsd), &arena->huge_mtx);
		/* Cancel out unwanted effects on stats. */
		if (config_stats)
			arena_huge_reset_stats_cancel(arena, usize);
	}
	malloc_mutex_unlock(tsd_tsdn(tsd), &arena->huge_mtx);

	malloc_mutex_lock(tsd_tsdn(tsd), &arena->lock);

	/* Bins. */
	for (i = 0; i < NBINS; i++) {
		arena_bin_t *bin = &arena->bins[i];
		malloc_mutex_lock(tsd_tsdn(tsd), &bin->lock);
		bin->runcur = NULL;
		arena_run_heap_new(&bin->runs);
		if (config_stats) {
			bin->stats.curregs = 0;
			bin->stats.curruns = 0;
		}
		malloc_mutex_unlock(tsd_tsdn(tsd), &bin->lock);
	}

	/*
	 * Re-initialize runs_dirty such that the chunks_cache and runs_dirty
	 * chains directly correspond.
	 */
	qr_new(&arena->runs_dirty, rd_link);
	for (node = qr_next(&arena->chunks_cache, cc_link);
	    node != &arena->chunks_cache; node = qr_next(node, cc_link)) {
		qr_new(&node->rd, rd_link);
		qr_meld(&arena->runs_dirty, &node->rd, rd_link);
	}

	/* Arena chunks. */
	for (node = ql_last(&arena->achunks, ql_link); node != NULL; node =
	    ql_last(&arena->achunks, ql_link)) {
		ql_remove(&arena->achunks, node, ql_link);
		arena_chunk_discard(tsd_tsdn(tsd), arena,
		    extent_node_addr_get(node));
	}

	/* Spare. */
	if (arena->spare != NULL) {
		arena_chunk_discard(tsd_tsdn(tsd), arena, arena->spare);
		arena->spare = NULL;
	}

	assert(!arena->purging);
	arena->nactive = 0;

	for (i = 0; i < NPSIZES; i++)
		arena_run_heap_new(&arena->runs_avail[i]);

	malloc_mutex_unlock(tsd_tsdn(tsd), &arena->lock);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movq %rdi, -0x1a8(%rbp)
movq %rsi, -0x1b0(%rbp)
movl $0x0, -0x1b4(%rbp)
movl -0x1b4(%rbp), %eax
cmpl 0x67b85(%rip), %eax     # 0xa35b4
jae 0x3ba65
movq -0x1b0(%rbp), %rax
movq 0xd0(%rax), %rax
movl -0x1b4(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movq $0x0, 0x18(%rax)
movl -0x1b4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1b4(%rbp)
jmp 0x3ba23
movq -0x1a8(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
movq -0x1b0(%rbp), %rsi
addq $0x830, %rsi            # imm = 0x830
callq 0x3a660
movq -0x1b0(%rbp), %rax
cmpq $0x0, 0x828(%rax)
je 0x3bab9
movq -0x1b0(%rbp), %rax
movq 0x828(%rax), %rax
movq 0x58(%rax), %rax
movq %rax, -0x1e8(%rbp)
jmp 0x3bac4
xorl %eax, %eax
movq %rax, -0x1e8(%rbp)
jmp 0x3bac4
movq -0x1e8(%rbp), %rax
movq %rax, -0x1c0(%rbp)
cmpq $0x0, -0x1c0(%rbp)
je 0x3be93
movq -0x1c0(%rbp), %rdi
callq 0x3c370
movq %rax, -0x1c8(%rbp)
movq -0x1a8(%rbp), %rax
movq %rax, -0x150(%rbp)
movq -0x150(%rbp), %rdi
movq -0x1b0(%rbp), %rsi
addq $0x830, %rsi            # imm = 0x830
callq 0x3a6b0
movq -0x1a8(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0x158(%rbp), %rcx
movq -0x1c8(%rbp), %rax
movq %rcx, -0x130(%rbp)
movq %rax, -0x138(%rbp)
movb $0x0, -0x139(%rbp)
movq -0x130(%rbp), %rdx
movq -0x138(%rbp), %rcx
movb -0x139(%rbp), %al
movq %rdx, -0xf8(%rbp)
movq %rcx, -0x100(%rbp)
andb $0x1, %al
movb %al, -0x101(%rbp)
movq -0x100(%rbp), %rax
leaq 0x6852c(%rip), %rcx     # 0xa40b0
movq (%rcx), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rax
cmpq -0x100(%rbp), %rax
setne %al
testb $0x1, %al
jne 0x3bbaf
jmp 0x3bdc5
movq -0x100(%rbp), %rax
movq -0x118(%rbp), %rcx
subq %rcx, %rax
shrq $0xc, %rax
movq %rax, -0x120(%rbp)
movq -0x118(%rbp), %rcx
movq -0x120(%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, -0x38(%rbp)
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rcx
movq -0x40(%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), %rax
addq $0x78, %rax
movq -0x20(%rbp), %rcx
subq 0x6836c(%rip), %rcx     # 0xa3fa0
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
andq $0x1fe0, %rax           # imm = 0x1FE0
shrq $0x5, %rax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
movl %eax, -0x124(%rbp)
movl -0x124(%rbp), %eax
movl %eax, %ecx
movb $0x1, %al
cmpq $0xff, %rcx
movb %al, -0x1e9(%rbp)
je 0x3bc87
xorl %eax, %eax
movb %al, -0x1e9(%rbp)
jmp 0x3bc87
movb -0x1e9(%rbp), %al
testb $0x1, %al
jne 0x3bc96
jmp 0x3bd8f
movq -0x118(%rbp), %rcx
movq -0x120(%rbp), %rax
movq %rcx, -0xd8(%rbp)
movq %rax, -0xe0(%rbp)
movq -0xd8(%rbp), %rcx
movq -0xe0(%rbp), %rax
movq %rcx, -0xc8(%rbp)
movq %rax, -0xd0(%rbp)
movq -0xc8(%rbp), %rcx
movq -0xd0(%rbp), %rax
movq %rcx, -0xa0(%rbp)
movq %rax, -0xa8(%rbp)
movq -0xa0(%rbp), %rcx
movq -0xa8(%rbp), %rax
movq %rcx, -0x90(%rbp)
movq %rax, -0x98(%rbp)
movq -0x90(%rbp), %rcx
movq -0x98(%rbp), %rax
movq %rcx, -0x80(%rbp)
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rax
addq $0x78, %rax
movq -0x88(%rbp), %rcx
subq 0x6826b(%rip), %rcx     # 0xa3fa0
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
andq $-0x2000, %rax          # imm = 0xE000
shrq %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
subq $0x1000, %rax           # imm = 0x1000
movq %rax, -0x110(%rbp)
jmp 0x3bdc3
movl -0x124(%rbp), %eax
movl %eax, -0xec(%rbp)
movl -0xec(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
movl %eax, %ecx
leaq 0x54550(%rip), %rax     # 0x90300
movq (%rax,%rcx,8), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x110(%rbp)
jmp 0x3bddf
movq -0xf8(%rbp), %rdi
movq -0x100(%rbp), %rsi
callq 0x65c10
movq %rax, -0x110(%rbp)
movq -0x110(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movq -0x1a8(%rbp), %rax
movq %rax, -0x160(%rbp)
movq -0x160(%rbp), %rdi
movq -0x1c8(%rbp), %rsi
callq 0x64db0
movq -0x1a8(%rbp), %rax
movq %rax, -0x168(%rbp)
movq -0x168(%rbp), %rdi
movq -0x1b0(%rbp), %rsi
addq $0x830, %rsi            # imm = 0x830
callq 0x3a660
movq -0x1b0(%rbp), %rdi
movq -0x1d0(%rbp), %rsi
callq 0x3c390
movq -0x1b0(%rbp), %rax
cmpq $0x0, 0x828(%rax)
je 0x3be75
movq -0x1b0(%rbp), %rax
movq 0x828(%rax), %rax
movq 0x58(%rax), %rax
movq %rax, -0x1f8(%rbp)
jmp 0x3be80
xorl %eax, %eax
movq %rax, -0x1f8(%rbp)
jmp 0x3be80
movq -0x1f8(%rbp), %rax
movq %rax, -0x1c0(%rbp)
jmp 0x3bad2
movq -0x1a8(%rbp), %rax
movq %rax, -0x170(%rbp)
movq -0x170(%rbp), %rdi
movq -0x1b0(%rbp), %rsi
addq $0x830, %rsi            # imm = 0x830
callq 0x3a6b0
movq -0x1a8(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x178(%rbp), %rdi
movq -0x1b0(%rbp), %rsi
addq $0x10, %rsi
callq 0x3a660
movl $0x0, -0x1b4(%rbp)
cmpl $0x27, -0x1b4(%rbp)
jae 0x3bfb1
movq -0x1b0(%rbp), %rax
addq $0x980, %rax            # imm = 0x980
movl -0x1b4(%rbp), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x1d8(%rbp)
movq -0x1a8(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x180(%rbp), %rdi
movq -0x1d8(%rbp), %rsi
callq 0x3a660
movq -0x1d8(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x1d8(%rbp), %rdi
addq $0x58, %rdi
callq 0x3c440
movq -0x1d8(%rbp), %rax
movq $0x0, 0x78(%rax)
movq -0x1d8(%rbp), %rax
movq $0x0, 0xa0(%rax)
movq -0x1a8(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x188(%rbp), %rdi
movq -0x1d8(%rbp), %rsi
callq 0x3a6b0
movl -0x1b4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1b4(%rbp)
jmp 0x3beea
jmp 0x3bfb3
movq -0x1b0(%rbp), %rcx
addq $0x138, %rcx            # imm = 0x138
movq -0x1b0(%rbp), %rax
movq %rcx, 0x138(%rax)
movq -0x1b0(%rbp), %rcx
addq $0x138, %rcx            # imm = 0x138
movq -0x1b0(%rbp), %rax
movq %rcx, 0x140(%rax)
movq -0x1b0(%rbp), %rax
movq 0x188(%rax), %rax
movq %rax, -0x1c0(%rbp)
movq -0x1c0(%rbp), %rax
movq -0x1b0(%rbp), %rcx
addq $0x148, %rcx            # imm = 0x148
cmpq %rcx, %rax
je 0x3c0df
jmp 0x3c020
movq -0x1c0(%rbp), %rcx
addq $0x30, %rcx
movq -0x1c0(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x1c0(%rbp), %rcx
addq $0x30, %rcx
movq -0x1c0(%rbp), %rax
movq %rcx, 0x38(%rax)
jmp 0x3c04e
movq -0x1c0(%rbp), %rcx
addq $0x30, %rcx
movq -0x1b0(%rbp), %rax
movq 0x140(%rax), %rax
movq %rcx, (%rax)
movq -0x1b0(%rbp), %rcx
addq $0x138, %rcx            # imm = 0x138
movq -0x1c0(%rbp), %rax
movq 0x38(%rax), %rax
movq %rcx, (%rax)
movq -0x1b0(%rbp), %rax
movq 0x140(%rax), %rax
movq %rax, -0x1e0(%rbp)
movq -0x1c0(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0x1b0(%rbp), %rax
movq %rcx, 0x140(%rax)
movq -0x1e0(%rbp), %rcx
movq -0x1c0(%rbp), %rax
movq %rcx, 0x38(%rax)
jmp 0x3c0c8
movq -0x1c0(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x1c0(%rbp)
jmp 0x3c000
movq -0x1b0(%rbp), %rax
cmpq $0x0, 0x100(%rax)
je 0x3c10b
movq -0x1b0(%rbp), %rax
movq 0x100(%rax), %rax
movq 0x58(%rax), %rax
movq %rax, -0x200(%rbp)
jmp 0x3c116
xorl %eax, %eax
movq %rax, -0x200(%rbp)
jmp 0x3c116
movq -0x200(%rbp), %rax
movq %rax, -0x1c0(%rbp)
cmpq $0x0, -0x1c0(%rbp)
je 0x3c288
jmp 0x3c134
movq -0x1b0(%rbp), %rax
movq 0x100(%rax), %rax
cmpq -0x1c0(%rbp), %rax
jne 0x3c16b
movq -0x1b0(%rbp), %rax
movq 0x100(%rax), %rax
movq 0x50(%rax), %rcx
movq -0x1b0(%rbp), %rax
movq %rcx, 0x100(%rax)
movq -0x1b0(%rbp), %rax
movq 0x100(%rax), %rax
cmpq -0x1c0(%rbp), %rax
je 0x3c1de
jmp 0x3c184
movq -0x1c0(%rbp), %rax
movq 0x50(%rax), %rcx
movq -0x1c0(%rbp), %rax
movq 0x58(%rax), %rax
movq %rcx, 0x50(%rax)
movq -0x1c0(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x1c0(%rbp), %rax
movq 0x50(%rax), %rax
movq %rcx, 0x58(%rax)
movq -0x1c0(%rbp), %rcx
movq -0x1c0(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x1c0(%rbp), %rcx
movq -0x1c0(%rbp), %rax
movq %rcx, 0x58(%rax)
jmp 0x3c1f0
movq -0x1b0(%rbp), %rax
movq $0x0, 0x100(%rax)
jmp 0x3c1f2
movq -0x1a8(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0x190(%rbp), %rax
movq %rax, -0x210(%rbp)
movq -0x1b0(%rbp), %rax
movq %rax, -0x208(%rbp)
movq -0x1c0(%rbp), %rdi
callq 0x3c370
movq -0x210(%rbp), %rdi
movq -0x208(%rbp), %rsi
movq %rax, %rdx
callq 0x3c470
movq -0x1b0(%rbp), %rax
cmpq $0x0, 0x100(%rax)
je 0x3c26a
movq -0x1b0(%rbp), %rax
movq 0x100(%rax), %rax
movq 0x58(%rax), %rax
movq %rax, -0x218(%rbp)
jmp 0x3c275
xorl %eax, %eax
movq %rax, -0x218(%rbp)
jmp 0x3c275
movq -0x218(%rbp), %rax
movq %rax, -0x1c0(%rbp)
jmp 0x3c124
movq -0x1b0(%rbp), %rax
cmpq $0x0, 0x110(%rax)
je 0x3c2da
movq -0x1a8(%rbp), %rax
movq %rax, -0x198(%rbp)
movq -0x198(%rbp), %rdi
movq -0x1b0(%rbp), %rsi
movq -0x1b0(%rbp), %rax
movq 0x110(%rax), %rdx
callq 0x3c470
movq -0x1b0(%rbp), %rax
movq $0x0, 0x110(%rax)
jmp 0x3c2dc
jmp 0x3c2de
movq -0x1b0(%rbp), %rax
movq $0x0, 0x128(%rax)
movl $0x0, -0x1b4(%rbp)
cmpl $0xc7, -0x1b4(%rbp)
jae 0x3c337
movq -0x1b0(%rbp), %rdi
addq $0x2318, %rdi           # imm = 0x2318
movl -0x1b4(%rbp), %eax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x3c440
movl -0x1b4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1b4(%rbp)
jmp 0x3c2fa
movq -0x1a8(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movq -0x1a0(%rbp), %rdi
movq -0x1b0(%rbp), %rsi
addq $0x10, %rsi
callq 0x3a6b0
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
nopw %cs:(%rax,%rax)