// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/deps/jemalloc/src/ctl.c
// Function: ctl_refresh
static void
ctl_refresh(void)
{
	unsigned i;
	VARIABLE_ARRAY(arena_t *, tarenas, ctl_stats.narenas);

	if (config_stats) {
		malloc_mutex_lock(&chunks_mtx);
		ctl_stats.chunks.current = stats_chunks.curchunks;
		ctl_stats.chunks.total = stats_chunks.nchunks;
		ctl_stats.chunks.high = stats_chunks.highchunks;
		malloc_mutex_unlock(&chunks_mtx);

		malloc_mutex_lock(&huge_mtx);
		ctl_stats.huge.allocated = huge_allocated;
		ctl_stats.huge.nmalloc = huge_nmalloc;
		ctl_stats.huge.ndalloc = huge_ndalloc;
		malloc_mutex_unlock(&huge_mtx);
	}

	/*
	 * Clear sum stats, since they will be merged into by
	 * ctl_arena_refresh().
	 */
	ctl_stats.arenas[ctl_stats.narenas].nthreads = 0;
	ctl_arena_clear(&ctl_stats.arenas[ctl_stats.narenas]);

	malloc_mutex_lock(&arenas_lock);
	memcpy(tarenas, arenas, sizeof(arena_t *) * ctl_stats.narenas);
	for (i = 0; i < ctl_stats.narenas; i++) {
		if (arenas[i] != NULL)
			ctl_stats.arenas[i].nthreads = arenas[i]->nthreads;
		else
			ctl_stats.arenas[i].nthreads = 0;
	}
	malloc_mutex_unlock(&arenas_lock);
	for (i = 0; i < ctl_stats.narenas; i++) {
		bool initialized = (tarenas[i] != NULL);

		ctl_stats.arenas[i].initialized = initialized;
		if (initialized)
			ctl_arena_refresh(tarenas[i], i);
	}

	if (config_stats) {
		ctl_stats.allocated =
		    ctl_stats.arenas[ctl_stats.narenas].allocated_small
		    + ctl_stats.arenas[ctl_stats.narenas].astats.allocated_large
		    + ctl_stats.huge.allocated;
		ctl_stats.active =
		    (ctl_stats.arenas[ctl_stats.narenas].pactive << LG_PAGE)
		    + ctl_stats.huge.allocated;
		ctl_stats.mapped = (ctl_stats.chunks.current << opt_lg_chunk);
	}

	ctl_epoch++;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl 0x597ff(%rip), %eax     # 0xdf9f0
movq %rsp, %r15
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
leaq 0x5962b(%rip), %r14     # 0xdf838
movq %r14, %rdi
callq 0x1faa0
leaq 0x5964c(%rip), %rax     # 0xdf868
movq 0x10(%rax), %rcx
movq %rcx, 0x59799(%rip)     # 0xdf9c0
movups (%rax), %xmm0
movups %xmm0, 0x59797(%rip)    # 0xdf9c8
movq %r14, %rdi
callq 0x1fbb0
leaq 0x597c8(%rip), %r14     # 0xdfa08
movq %r14, %rdi
callq 0x1faa0
leaq 0x59831(%rip), %rax     # 0xdfa80
movq (%rax), %rax
movq %rax, 0x5977f(%rip)     # 0xdf9d8
leaq 0x59818(%rip), %rax     # 0xdfa78
movq (%rax), %rax
movq %rax, 0x59776(%rip)     # 0xdf9e0
leaq 0x59817(%rip), %rax     # 0xdfa88
movq (%rax), %rax
movq %rax, 0x5976d(%rip)     # 0xdf9e8
movq %r14, %rdi
callq 0x1fbb0
movq 0x5976e(%rip), %rax     # 0xdf9f8
movl 0x59760(%rip), %ecx     # 0xdf9f0
imulq $0x870, %rcx, %rcx      # imm = 0x870
leaq (%rax,%rcx), %r14
addq $0x10, %r14
movl $0x0, -0xc(%r14)
leaq 0x43ca2(%rip), %rax     # 0xc9f50
movq 0x18(%rax), %rax
movq %rax, -0x8(%r14)
movl $0x858, %edx            # imm = 0x858
movq %r14, %rdi
xorl %esi, %esi
callq 0x1f110
movq 0x858(%r14), %rdi
leaq 0x595b5(%rip), %rax     # 0xdf888
movq (%rax), %rdx
leaq 0x5964b(%rip), %rax     # 0xdf928
subq (%rax), %rdx
shlq $0x5, %rdx
xorl %esi, %esi
callq 0x1f110
leaq 0x58896(%rip), %rdi     # 0xdeb88
callq 0x1faa0
leaq 0x5887a(%rip), %rax     # 0xdeb78
movq (%rax), %r14
movl 0x596e9(%rip), %ebx     # 0xdf9f0
leaq (,%rbx,8), %rdx
movq %r15, -0x30(%rbp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x1fbd0
testq %rbx, %rbx
je 0x86351
movq 0x596ce(%rip), %rax     # 0xdf9f8
addq $0x4, %rax
xorl %ecx, %ecx
movq (%r14,%rcx,8), %rsi
movl $0x0, %edx
testq %rsi, %rsi
je 0x86341
movl 0x4(%rsi), %edx
movl %edx, (%rax)
incq %rcx
addq $0x870, %rax            # imm = 0x870
cmpq %rcx, %rbx
jne 0x86330
leaq 0x58830(%rip), %rdi     # 0xdeb88
callq 0x1fbb0
movl 0x5968d(%rip), %eax     # 0xdf9f0
testl %eax, %eax
je 0x86607
movl $0xa0, %r10d
movl $0xc8, %esi
xorl %edi, %edi
movq -0x30(%rbp), %rcx
movq (%rcx,%rdi,8), %r14
movq 0x59671(%rip), %r13     # 0xdf9f8
imulq $0x870, %rdi, %rbx      # imm = 0x870
testq %r14, %r14
setne (%r13,%rbx)
je 0x865ea
movq %rdi, -0x48(%rbp)
movq %rsi, -0x58(%rbp)
addq %r13, %rbx
movl %eax, %eax
imulq $0x870, %rax, %r15      # imm = 0x870
leaq (%r15,%r13), %r12
leaq 0x43b94(%rip), %rax     # 0xc9f50
movq 0x18(%rax), %rax
leaq 0x8(%rbx), %rcx
movq %rcx, -0x40(%rbp)
movq %rax, 0x8(%rbx)
leaq 0x10(%rbx), %rdi
movq %rdi, -0x38(%rbp)
movl $0x858, %edx            # imm = 0x858
xorl %esi, %esi
movq %r10, -0x60(%rbp)
callq 0x1f110
movq 0x868(%rbx), %rdi
leaq 0x59496(%rip), %rax     # 0xdf888
movq (%rax), %rdx
leaq 0x5952c(%rip), %rax     # 0xdf928
subq (%rax), %rdx
shlq $0x5, %rdx
xorl %esi, %esi
callq 0x1f110
movl 0x4(%rbx), %eax
movq %r15, -0x50(%rbp)
addl %eax, 0x4(%r13,%r15)
leaq 0x18(%rbx), %rcx
leaq 0x20(%rbx), %r8
leaq 0x88(%rbx), %r9
subq $0x8, %rsp
movq %r14, %rdi
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
pushq 0x868(%rbx)
callq 0x827c1
movq -0x60(%rbp), %r10
addq $0x10, %rsp
movq 0x68(%rbx), %rax
movq 0x70(%rbx), %rcx
movq 0x78(%rbx), %rdx
movq 0x80(%rbx), %rsi
leaq (%r10,%r13), %rdi
xorl %r8d, %r8d
addq -0x18(%rdi,%r8), %rax
addq -0x10(%rdi,%r8), %rcx
addq -0x8(%rdi,%r8), %rdx
addq (%rdi,%r8), %rsi
addq $0x48, %r8
cmpq $0x7e0, %r8             # imm = 0x7E0
jne 0x86461
movq %rax, 0x68(%rbx)
movq %rcx, 0x70(%rbx)
movq %rdx, 0x78(%rbx)
movq %rsi, 0x80(%rbx)
movq 0x10(%rbx), %rdi
addq %rdi, 0x10(%r12)
movq 0x18(%rbx), %rdi
addq %rdi, 0x18(%r12)
movq 0x20(%rbx), %rdi
addq %rdi, 0x20(%r12)
movq 0x28(%rbx), %rdi
addq %rdi, 0x28(%r12)
movq 0x30(%rbx), %rdi
addq %rdi, 0x30(%r12)
movq 0x38(%rbx), %rdi
addq %rdi, 0x38(%r12)
addq %rax, 0x68(%r12)
addq %rcx, 0x70(%r12)
addq %rdx, 0x78(%r12)
addq %rsi, 0x80(%r12)
movq 0x40(%rbx), %rax
addq %rax, 0x40(%r12)
movq 0x48(%rbx), %rax
addq %rax, 0x48(%r12)
movq 0x50(%rbx), %rax
addq %rax, 0x50(%r12)
movq 0x58(%rbx), %rax
addq %rax, 0x58(%r12)
leaq 0x5937c(%rip), %r8      # 0xdf888
movq (%r8), %rax
leaq 0x59412(%rip), %r9      # 0xdf928
cmpq (%r9), %rax
je 0x8656a
movq 0x868(%rbx), %rax
movq 0x868(%r12), %rcx
movl $0x1, %edx
xorl %esi, %esi
shlq $0x5, %rsi
movq (%rax,%rsi), %rdi
addq %rdi, (%rcx,%rsi)
movq 0x8(%rax,%rsi), %rdi
addq %rdi, 0x8(%rcx,%rsi)
movq 0x10(%rax,%rsi), %rdi
addq %rdi, 0x10(%rcx,%rsi)
movq 0x18(%rax,%rsi), %rdi
addq %rdi, 0x18(%rcx,%rsi)
movl %edx, %esi
movq (%r8), %rdi
subq (%r9), %rdi
incl %edx
cmpq %rsi, %rdi
ja 0x86531
movq -0x50(%rbp), %rax
addq %r13, %rax
addq $0xc8, %rax
movq -0x58(%rbp), %rsi
addq %rsi, %r13
xorl %ecx, %ecx
movq -0x48(%rbp), %rdi
movq -0x40(%r13,%rcx), %rdx
addq %rdx, -0x40(%rax,%rcx)
movq -0x38(%r13,%rcx), %rdx
addq %rdx, -0x38(%rax,%rcx)
movq -0x30(%r13,%rcx), %rdx
addq %rdx, -0x30(%rax,%rcx)
movq -0x28(%r13,%rcx), %rdx
addq %rdx, -0x28(%rax,%rcx)
movq -0x20(%r13,%rcx), %rdx
addq %rdx, -0x20(%rax,%rcx)
movq -0x18(%r13,%rcx), %rdx
addq %rdx, -0x18(%rax,%rcx)
movq -0x10(%r13,%rcx), %rdx
addq %rdx, -0x10(%rax,%rcx)
movq -0x8(%r13,%rcx), %rdx
addq %rdx, -0x8(%rax,%rcx)
movq (%r13,%rcx), %rdx
addq %rdx, (%rax,%rcx)
addq $0x48, %rcx
cmpq $0x7e0, %rcx            # imm = 0x7E0
jne 0x86584
incq %rdi
movl 0x593fd(%rip), %eax     # 0xdf9f0
movl $0x870, %ecx            # imm = 0x870
addq %rcx, %r10
addq %rcx, %rsi
cmpq %rax, %rdi
jb 0x86378
movq 0x593ea(%rip), %rcx     # 0xdf9f8
movl %eax, %eax
imulq $0x870, %rax, %rax      # imm = 0x870
movq 0x40(%rcx,%rax), %rdx
addq 0x68(%rcx,%rax), %rdx
movq 0x593b0(%rip), %rsi     # 0xdf9d8
addq %rsi, %rdx
movq %rdx, 0x59376(%rip)     # 0xdf9a8
movq 0x10(%rcx,%rax), %rax
shlq $0xc, %rax
addq %rsi, %rax
movq %rax, 0x5936b(%rip)     # 0xdf9b0
movq 0x59374(%rip), %rax     # 0xdf9c0
leaq 0x438f5(%rip), %rcx     # 0xc9f48
movb (%rcx), %cl
shlq %cl, %rax
movq %rax, 0x59359(%rip)     # 0xdf9b8
incq 0x5939a(%rip)           # 0xdfa00
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq