// File: /workspace/github_c_makefile_star2_O2/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 $0x28, %rsp
movl 0x5f338(%rip), %eax     # 0xdc9f0
movq %rsp, %r15
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
leaq 0x5f164(%rip), %r14     # 0xdc838
movq %r14, %rdi
callq 0x1faa0
leaq 0x5f185(%rip), %rax     # 0xdc868
movq 0x10(%rax), %rcx
movq %rcx, 0x5f2d2(%rip)     # 0xdc9c0
movdqu (%rax), %xmm0
movdqu %xmm0, 0x5f2ce(%rip)    # 0xdc9c8
movq %r14, %rdi
callq 0x1fbb0
leaq 0x5f2ff(%rip), %r14     # 0xdca08
movq %r14, %rdi
callq 0x1faa0
leaq 0x5f368(%rip), %rax     # 0xdca80
movq (%rax), %rax
movq %rax, 0x5f2b6(%rip)     # 0xdc9d8
leaq 0x5f34f(%rip), %rax     # 0xdca78
movq (%rax), %rax
movq %rax, 0x5f2ad(%rip)     # 0xdc9e0
leaq 0x5f34e(%rip), %rax     # 0xdca88
movq (%rax), %rax
movq %rax, 0x5f2a4(%rip)     # 0xdc9e8
movq %r14, %rdi
callq 0x1fbb0
movq 0x5f2a5(%rip), %rax     # 0xdc9f8
movl 0x5f297(%rip), %ecx     # 0xdc9f0
imulq $0x870, %rcx, %rcx      # imm = 0x870
leaq (%rax,%rcx), %rdi
andl $0x0, 0x4(%rax,%rcx)
callq 0x7daca
leaq 0x5e413(%rip), %rdi     # 0xdbb88
callq 0x1faa0
leaq 0x5e3f7(%rip), %rax     # 0xdbb78
movq (%rax), %r14
movl 0x5f266(%rip), %ebx     # 0xdc9f0
leaq (,%rbx,8), %rdx
movq %r15, -0x30(%rbp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x1fbd0
movq 0x5f250(%rip), %rax     # 0xdc9f8
addq $0x4, %rax
xorl %ecx, %ecx
cmpq %rcx, %rbx
je 0x7d7d0
movq (%r14,%rcx,8), %rdx
testq %rdx, %rdx
je 0x7d7c1
movl 0x4(%rdx), %edx
jmp 0x7d7c3
xorl %edx, %edx
movl %edx, (%rax)
incq %rcx
addq $0x870, %rax            # imm = 0x870
jmp 0x7d7ae
leaq 0x5e3b1(%rip), %rdi     # 0xdbb88
callq 0x1fbb0
movl $0x98, %r8d
movl $0xc8, %edi
xorl %esi, %esi
movl 0x5f201(%rip), %eax     # 0xdc9f0
movl %eax, %ecx
cmpq %rcx, %rsi
jae 0x7da5e
movq -0x30(%rbp), %rdx
movq (%rdx,%rsi,8), %r15
movq 0x5f1ef(%rip), %rbx     # 0xdc9f8
imulq $0x870, %rsi, %r14      # imm = 0x870
testq %r15, %r15
setne (%rbx,%r14)
je 0x7da4b
movq %rsi, -0x40(%rbp)
movq %rdi, -0x48(%rbp)
addq %rbx, %r14
imulq $0x870, %rcx, %r13      # imm = 0x870
leaq (%rbx,%r13), %r12
movq %r14, %rdi
movq %r8, -0x50(%rbp)
callq 0x7daca
movl 0x4(%r14), %eax
movq %r13, -0x38(%rbp)
addl %eax, 0x4(%rbx,%r13)
leaq 0x8(%r14), %rsi
leaq 0x10(%r14), %rdx
leaq 0x18(%r14), %rcx
leaq 0x20(%r14), %r8
leaq 0x88(%r14), %r9
subq $0x8, %rsp
movq %r15, %rdi
pushq 0x868(%r14)
callq 0x79eca
leaq 0x5f0aa(%rip), %r10     # 0xdc928
leaq 0x5f003(%rip), %r9      # 0xdc888
movq -0x50(%rbp), %r8
addq $0x10, %rsp
movdqu 0x68(%r14), %xmm1
movdqu 0x78(%r14), %xmm0
movl 0x5f151(%rip), %eax     # 0xdc9f0
leaq (%rbx,%r8), %rcx
xorl %edx, %edx
cmpq $0x7e0, %rdx            # imm = 0x7E0
je 0x7d8c7
movdqu -0x10(%rcx,%rdx), %xmm2
movdqu (%rcx,%rdx), %xmm3
paddq %xmm2, %xmm1
paddq %xmm3, %xmm0
addq $0x48, %rdx
jmp 0x7d8a5
movdqu %xmm1, 0x68(%r14)
movdqu %xmm0, 0x78(%r14)
movdqu 0x10(%r14), %xmm2
movdqu 0x10(%r12), %xmm3
paddq %xmm2, %xmm3
movdqu 0x20(%r12), %xmm2
movdqu 0x30(%r12), %xmm4
movdqu 0x40(%r12), %xmm5
movdqu %xmm3, 0x10(%r12)
movdqu 0x20(%r14), %xmm3
paddq %xmm2, %xmm3
movdqu %xmm3, 0x20(%r12)
movdqu 0x30(%r14), %xmm2
paddq %xmm4, %xmm2
movdqu %xmm2, 0x30(%r12)
movdqu 0x68(%r12), %xmm2
paddq %xmm1, %xmm2
movdqu %xmm2, 0x68(%r12)
movdqu 0x78(%r12), %xmm1
paddq %xmm0, %xmm1
movdqu %xmm1, 0x78(%r12)
movdqu 0x40(%r14), %xmm0
paddq %xmm5, %xmm0
movdqu %xmm0, 0x40(%r12)
movdqu 0x50(%r14), %xmm0
movdqu 0x50(%r12), %xmm1
paddq %xmm0, %xmm1
movdqu %xmm1, 0x50(%r12)
xorl %ecx, %ecx
movl %ecx, %ecx
movq (%r9), %rdx
subq (%r10), %rdx
cmpq %rcx, %rdx
jbe 0x7d9c1
movq 0x868(%r14), %rdx
movq %rcx, %rsi
shlq $0x5, %rsi
movq 0x868(%r12), %rdi
movdqu (%rdx,%rsi), %xmm0
movdqu (%rdi,%rsi), %xmm1
paddq %xmm0, %xmm1
movdqu 0x10(%rdi,%rsi), %xmm0
movdqu %xmm1, (%rdi,%rsi)
movdqu 0x10(%rdx,%rsi), %xmm1
paddq %xmm0, %xmm1
movdqu %xmm1, 0x10(%rdi,%rsi)
incl %ecx
jmp 0x7d971
movq -0x38(%rbp), %rcx
addq %rbx, %rcx
addq $0xc8, %rcx
movq -0x48(%rbp), %rdi
addq %rdi, %rbx
xorl %edx, %edx
cmpq $0x7e0, %rdx            # imm = 0x7E0
je 0x7da47
movdqu -0x40(%rbx,%rdx), %xmm0
movdqu -0x40(%rcx,%rdx), %xmm1
paddq %xmm0, %xmm1
movdqu -0x30(%rcx,%rdx), %xmm0
movdqu -0x20(%rcx,%rdx), %xmm2
movdqu -0x10(%rcx,%rdx), %xmm3
movdqu %xmm1, -0x40(%rcx,%rdx)
movdqu -0x30(%rbx,%rdx), %xmm1
paddq %xmm0, %xmm1
movdqu %xmm1, -0x30(%rcx,%rdx)
movdqu -0x20(%rbx,%rdx), %xmm0
paddq %xmm2, %xmm0
movdqu %xmm0, -0x20(%rcx,%rdx)
movdqu -0x10(%rbx,%rdx), %xmm0
paddq %xmm3, %xmm0
movdqu %xmm0, -0x10(%rcx,%rdx)
movq (%rbx,%rdx), %rsi
addq %rsi, (%rcx,%rdx)
addq $0x48, %rdx
jmp 0x7d9d8
movq -0x40(%rbp), %rsi
incq %rsi
movl $0x870, %ecx            # imm = 0x870
addq %rcx, %r8
addq %rcx, %rdi
jmp 0x7d7ef
movq 0x5ef93(%rip), %rax     # 0xdc9f8
imulq $0x870, %rcx, %rcx      # imm = 0x870
movq 0x40(%rax,%rcx), %rdx
addq 0x68(%rax,%rcx), %rdx
movq 0x5ef5b(%rip), %rsi     # 0xdc9d8
addq %rsi, %rdx
movq %rdx, 0x5ef21(%rip)     # 0xdc9a8
movq 0x10(%rax,%rcx), %rax
shlq $0xc, %rax
addq %rsi, %rax
movq %rax, 0x5ef16(%rip)     # 0xdc9b0
movq 0x5ef1f(%rip), %rax     # 0xdc9c0
leaq 0x494a0(%rip), %rcx     # 0xc6f48
movb (%rcx), %cl
shlq %cl, %rax
movq %rax, 0x5ef04(%rip)     # 0xdc9b8
incq 0x5ef45(%rip)           # 0xdca00
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq