// File: /workspace/github_c_makefile_star2_O0/zhou-yuxin[P]redis-aof-no-cow/deps/jemalloc/src/ctl.c
// Function: ctl_refresh
static void
ctl_refresh(tsdn_t *tsdn)
{
	unsigned i;
	VARIABLE_ARRAY(arena_t *, tarenas, ctl_stats.narenas);

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

	for (i = 0; i < ctl_stats.narenas; i++)
		tarenas[i] = arena_get(tsdn, i, false);

	for (i = 0; i < ctl_stats.narenas; i++) {
		bool initialized = (tarenas[i] != NULL);

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

	if (config_stats) {
		size_t base_allocated, base_resident, base_mapped;
		base_stats_get(tsdn, &base_allocated, &base_resident,
		    &base_mapped);
		ctl_stats.allocated =
		    ctl_stats.arenas[ctl_stats.narenas].allocated_small +
		    ctl_stats.arenas[ctl_stats.narenas].astats.allocated_large +
		    ctl_stats.arenas[ctl_stats.narenas].astats.allocated_huge;
		ctl_stats.active =
		    (ctl_stats.arenas[ctl_stats.narenas].pactive << LG_PAGE);
		ctl_stats.metadata = base_allocated +
		    ctl_stats.arenas[ctl_stats.narenas].astats.metadata_mapped +
		    ctl_stats.arenas[ctl_stats.narenas].astats
		    .metadata_allocated;
		ctl_stats.resident = base_resident +
		    ctl_stats.arenas[ctl_stats.narenas].astats.metadata_mapped +
		    ((ctl_stats.arenas[ctl_stats.narenas].pactive +
		    ctl_stats.arenas[ctl_stats.narenas].pdirty) << LG_PAGE);
		ctl_stats.mapped = base_mapped +
		    ctl_stats.arenas[ctl_stats.narenas].astats.mapped;
		ctl_stats.retained =
		    ctl_stats.arenas[ctl_stats.narenas].astats.retained;
	}

	ctl_epoch++;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl 0x4fa2e(%rip), %eax     # 0xa4160
movq %rsp, %rcx
movq %rcx, -0x18(%rbp)
leaq 0xf(,%rax,8), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x48(%rbp)
movq %rcx, %rsp
movq %rax, -0x20(%rbp)
movq 0x4fa0b(%rip), %rdi     # 0xa4168
movl 0x4f9fd(%rip), %eax     # 0xa4160
imulq $0xbd8, %rax, %rax      # imm = 0xBD8
addq %rax, %rdi
callq 0x54a10
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl 0x4f9de(%rip), %eax     # 0xa4160
jae 0x547ab
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
xorl %edx, %edx
callq 0x54b20
movq %rax, %rdx
movq -0x48(%rbp), %rax
movl -0xc(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x54779
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl 0x4f9a5(%rip), %eax     # 0xa4160
jae 0x54817
movq -0x48(%rbp), %rax
movl -0xc(%rbp), %ecx
cmpq $0x0, (%rax,%rcx,8)
setne %al
andb $0x1, %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %cl
movq 0x4f98d(%rip), %rax     # 0xa4168
movl -0xc(%rbp), %edx
imulq $0xbd8, %rdx, %rdx      # imm = 0xBD8
addq %rdx, %rax
andb $0x1, %cl
movb %cl, (%rax)
testb $0x1, -0x21(%rbp)
je 0x5480a
movq -0x48(%rbp), %rax
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
movl -0xc(%rbp), %edx
callq 0x54bd0
jmp 0x5480c
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x547b2
movq -0x8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq -0x38(%rbp), %rdx
leaq -0x40(%rbp), %rcx
callq 0x508e0
movq 0x4f935(%rip), %rax     # 0xa4168
movl 0x4f927(%rip), %ecx     # 0xa4160
imulq $0xbd8, %rcx, %rcx      # imm = 0xBD8
addq %rcx, %rax
movq 0xb0(%rax), %rax
movq 0x4f917(%rip), %rcx     # 0xa4168
movl 0x4f909(%rip), %edx     # 0xa4160
imulq $0xbd8, %rdx, %rdx      # imm = 0xBD8
addq %rdx, %rcx
addq 0x68(%rcx), %rax
movq 0x4f8fc(%rip), %rcx     # 0xa4168
movl 0x4f8ee(%rip), %edx     # 0xa4160
imulq $0xbd8, %rdx, %rdx      # imm = 0xBD8
addq %rdx, %rcx
addq 0x88(%rcx), %rax
movq %rax, 0x4f8a6(%rip)     # 0xa4130
movq 0x4f8d7(%rip), %rax     # 0xa4168
movl 0x4f8c9(%rip), %ecx     # 0xa4160
imulq $0xbd8, %rcx, %rcx      # imm = 0xBD8
addq %rcx, %rax
movq 0x20(%rax), %rax
shlq $0xc, %rax
movq %rax, 0x4f888(%rip)     # 0xa4138
movq -0x30(%rbp), %rax
movq 0x4f8ad(%rip), %rcx     # 0xa4168
movl 0x4f89f(%rip), %edx     # 0xa4160
imulq $0xbd8, %rdx, %rdx      # imm = 0xBD8
addq %rdx, %rcx
addq 0x58(%rcx), %rax
movq 0x4f892(%rip), %rcx     # 0xa4168
movl 0x4f884(%rip), %edx     # 0xa4160
imulq $0xbd8, %rdx, %rdx      # imm = 0xBD8
addq %rdx, %rcx
addq 0x60(%rcx), %rax
movq %rax, 0x4f84f(%rip)     # 0xa4140
movq -0x38(%rbp), %rax
movq 0x4f86c(%rip), %rcx     # 0xa4168
movl 0x4f85e(%rip), %edx     # 0xa4160
imulq $0xbd8, %rdx, %rdx      # imm = 0xBD8
addq %rdx, %rcx
addq 0x58(%rcx), %rax
movq 0x4f851(%rip), %rcx     # 0xa4168
movl 0x4f843(%rip), %edx     # 0xa4160
imulq $0xbd8, %rdx, %rdx      # imm = 0xBD8
addq %rdx, %rcx
movq 0x20(%rcx), %rcx
movq 0x4f836(%rip), %rdx     # 0xa4168
movl 0x4f828(%rip), %esi     # 0xa4160
imulq $0xbd8, %rsi, %rsi      # imm = 0xBD8
addq %rsi, %rdx
addq 0x28(%rdx), %rcx
shlq $0xc, %rcx
addq %rcx, %rax
movq %rax, 0x4f7f4(%rip)     # 0xa4148
movq -0x40(%rbp), %rax
movq 0x4f809(%rip), %rcx     # 0xa4168
movl 0x4f7fb(%rip), %edx     # 0xa4160
imulq $0xbd8, %rdx, %rdx      # imm = 0xBD8
addq %rdx, %rcx
addq 0x30(%rcx), %rax
movq %rax, 0x4f7d6(%rip)     # 0xa4150
movq 0x4f7e7(%rip), %rax     # 0xa4168
movl 0x4f7d9(%rip), %ecx     # 0xa4160
imulq $0xbd8, %rcx, %rcx      # imm = 0xBD8
addq %rcx, %rax
movq 0x38(%rax), %rax
movq %rax, 0x4f7bc(%rip)     # 0xa4158
movq 0x4f7cd(%rip), %rax     # 0xa4170
addq $0x1, %rax
movq %rax, 0x4f7c2(%rip)     # 0xa4170
movq -0x18(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
nopw (%rax,%rax)