// File: /workspace/github_c_makefile_star2_O0/zhou-yuxin[P]redis-aof-no-cow/deps/jemalloc/src/ctl.c
// Function: ctl_init
static bool
ctl_init(tsdn_t *tsdn)
{
	bool ret;

	malloc_mutex_lock(tsdn, &ctl_mtx);
	if (!ctl_initialized) {
		/*
		 * Allocate space for one extra arena stats element, which
		 * contains summed stats across all arenas.
		 */
		ctl_stats.narenas = narenas_total_get();
		ctl_stats.arenas = (ctl_arena_stats_t *)a0malloc(
		    (ctl_stats.narenas + 1) * sizeof(ctl_arena_stats_t));
		if (ctl_stats.arenas == NULL) {
			ret = true;
			goto label_return;
		}
		memset(ctl_stats.arenas, 0, (ctl_stats.narenas + 1) *
		    sizeof(ctl_arena_stats_t));

		/*
		 * Initialize all stats structures, regardless of whether they
		 * ever get used.  Lazy initialization would allow errors to
		 * cause inconsistent state to be viewable by the application.
		 */
		if (config_stats) {
			unsigned i;
			for (i = 0; i <= ctl_stats.narenas; i++) {
				if (ctl_arena_init(&ctl_stats.arenas[i])) {
					unsigned j;
					for (j = 0; j < i; j++) {
						a0dalloc(
						    ctl_stats.arenas[j].lstats);
						a0dalloc(
						    ctl_stats.arenas[j].hstats);
					}
					a0dalloc(ctl_stats.arenas);
					ctl_stats.arenas = NULL;
					ret = true;
					goto label_return;
				}
			}
		}
		ctl_stats.arenas[ctl_stats.narenas].initialized = true;

		ctl_epoch = 0;
		ctl_refresh(tsdn);
		ctl_initialized = true;
	}

	ret = false;
label_return:
	malloc_mutex_unlock(tsdn, &ctl_mtx);
	return (ret);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x502c9(%rip), %rsi     # 0xa40e0
callq 0x54620
testb $0x1, 0x502b5(%rip)     # 0xa40d8
jne 0x53f76
callq 0x19e40
movl %eax, 0x5032c(%rip)     # 0xa4160
movl 0x50326(%rip), %eax     # 0xa4160
addl $0x1, %eax
movl %eax, %eax
imulq $0xbd8, %rax, %rdi      # imm = 0xBD8
callq 0x18520
movq %rax, 0x50316(%rip)     # 0xa4168
cmpq $0x0, 0x5030e(%rip)     # 0xa4168
jne 0x53e65
movb $0x1, -0x9(%rbp)
jmp 0x53f7a
movq 0x502fc(%rip), %rdi     # 0xa4168
movl 0x502ee(%rip), %eax     # 0xa4160
addl $0x1, %eax
movl %eax, %eax
imulq $0xbd8, %rax, %rdx      # imm = 0xBD8
xorl %esi, %esi
callq 0xb210
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl 0x502cb(%rip), %eax     # 0xa4160
ja 0x53f41
movq 0x502c6(%rip), %rdi     # 0xa4168
movl -0x10(%rbp), %eax
imulq $0xbd8, %rax, %rax      # imm = 0xBD8
addq %rax, %rdi
callq 0x54670
testb $0x1, %al
jne 0x53eba
jmp 0x53f31
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x10(%rbp), %eax
jae 0x53f14
movq 0x50298(%rip), %rax     # 0xa4168
movl -0x14(%rbp), %ecx
imulq $0xbd8, %rcx, %rcx      # imm = 0xBD8
addq %rcx, %rax
movq 0xbc8(%rax), %rdi
callq 0x19280
movq 0x50278(%rip), %rax     # 0xa4168
movl -0x14(%rbp), %ecx
imulq $0xbd8, %rcx, %rcx      # imm = 0xBD8
addq %rcx, %rax
movq 0xbd0(%rax), %rdi
callq 0x19280
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x53ec1
movq 0x5024d(%rip), %rdi     # 0xa4168
callq 0x19280
movq $0x0, 0x5023d(%rip) # 0xa4168
movb $0x1, -0x9(%rbp)
jmp 0x53f7a
jmp 0x53f33
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x53e8c
movq 0x50220(%rip), %rax     # 0xa4168
movl 0x50212(%rip), %ecx     # 0xa4160
imulq $0xbd8, %rcx, %rcx      # imm = 0xBD8
addq %rcx, %rax
movb $0x1, (%rax)
movq $0x0, 0x5020a(%rip) # 0xa4170
movq -0x8(%rbp), %rdi
callq 0x54720
movb $0x1, 0x50162(%rip)     # 0xa40d8
movb $0x0, -0x9(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x5015b(%rip), %rsi     # 0xa40e0
callq 0x549c0
movb -0x9(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)