// File: /workspace/github_c_makefile_star2_O2/zhou-yuxin[P]redis-aof-no-cow/deps/jemalloc/src/stats.c
// Function: stats_print_helper
static void
stats_print_helper(void (*write_cb)(void *, const char *), void *cbopaque,
    bool json, bool merged, bool unmerged, bool bins, bool large, bool huge)
{
	size_t *cactive;
	size_t allocated, active, metadata, resident, mapped, retained;

	CTL_GET("stats.cactive", &cactive, size_t *);
	CTL_GET("stats.allocated", &allocated, size_t);
	CTL_GET("stats.active", &active, size_t);
	CTL_GET("stats.metadata", &metadata, size_t);
	CTL_GET("stats.resident", &resident, size_t);
	CTL_GET("stats.mapped", &mapped, size_t);
	CTL_GET("stats.retained", &retained, size_t);
	if (json) {
		malloc_cprintf(write_cb, cbopaque,
		    "\t\t\"stats\": {\n");

		malloc_cprintf(write_cb, cbopaque,
		    "\t\t\t\"cactive\": %zu,\n", atomic_read_z(cactive));
		malloc_cprintf(write_cb, cbopaque,
		    "\t\t\t\"allocated\": %zu,\n", allocated);
		malloc_cprintf(write_cb, cbopaque,
		    "\t\t\t\"active\": %zu,\n", active);
		malloc_cprintf(write_cb, cbopaque,
		    "\t\t\t\"metadata\": %zu,\n", metadata);
		malloc_cprintf(write_cb, cbopaque,
		    "\t\t\t\"resident\": %zu,\n", resident);
		malloc_cprintf(write_cb, cbopaque,
		    "\t\t\t\"mapped\": %zu,\n", mapped);
		malloc_cprintf(write_cb, cbopaque,
		    "\t\t\t\"retained\": %zu\n", retained);

		malloc_cprintf(write_cb, cbopaque,
		    "\t\t}%s\n", (merged || unmerged) ? "," : "");
	} else {
		malloc_cprintf(write_cb, cbopaque,
		    "Allocated: %zu, active: %zu, metadata: %zu,"
		    " resident: %zu, mapped: %zu, retained: %zu\n",
		    allocated, active, metadata, resident, mapped, retained);
		malloc_cprintf(write_cb, cbopaque,
		    "Current active ceiling: %zu\n",
		    atomic_read_z(cactive));
	}

	if (merged || unmerged) {
		unsigned narenas;

		if (json) {
			malloc_cprintf(write_cb, cbopaque,
			    "\t\t\"stats.arenas\": {\n");
		}

		CTL_GET("arenas.narenas", &narenas, unsigned);
		{
			VARIABLE_ARRAY(bool, initialized, narenas);
			size_t isz;
			unsigned i, j, ninitialized;

			isz = sizeof(bool) * narenas;
			xmallctl("arenas.initialized", (void *)initialized,
			    &isz, NULL, 0);
			for (i = ninitialized = 0; i < narenas; i++) {
				if (initialized[i])
					ninitialized++;
			}

			/* Merged stats. */
			if (merged && (ninitialized > 1 || !unmerged)) {
				/* Print merged arena stats. */
				if (json) {
					malloc_cprintf(write_cb, cbopaque,
					    "\t\t\t\"merged\": {\n");
				} else {
					malloc_cprintf(write_cb, cbopaque,
					    "\nMerged arenas stats:\n");
				}
				stats_arena_print(write_cb, cbopaque, json,
				    narenas, bins, large, huge);
				if (json) {
					malloc_cprintf(write_cb, cbopaque,
					    "\t\t\t}%s\n", (ninitialized > 1) ?
					    "," : "");
				}
			}

			/* Unmerged stats. */
			for (i = j = 0; i < narenas; i++) {
				if (initialized[i]) {
					if (json) {
						j++;
						malloc_cprintf(write_cb,
						    cbopaque,
						    "\t\t\t\"%u\": {\n", i);
					} else {
						malloc_cprintf(write_cb,
						    cbopaque, "\narenas[%u]:\n",
						    i);
					}
					stats_arena_print(write_cb, cbopaque,
					    json, i, bins, large, huge);
					if (json) {
						malloc_cprintf(write_cb,
						    cbopaque,
						    "\t\t\t}%s\n", (j <
						    ninitialized) ? "," : "");
					}
				}
			}
		}

		if (json) {
			malloc_cprintf(write_cb, cbopaque,
			    "\t\t}\n");
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %r9d, %r12d
movl %r8d, -0x38(%rbp)
movl %ecx, %r13d
movl %edx, -0x2c(%rbp)
movq %rsi, %r14
movq %rdi, %r15
leaq -0x80(%rbp), %rdx
movq $0x8, (%rdx)
leaq 0xaf2f(%rip), %rdi      # 0x385b9
leaq -0xa0(%rbp), %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1820a
testl %eax, %eax
jne 0x2db67
leaq -0x78(%rbp), %rdx
movq $0x8, (%rdx)
leaq 0xaf12(%rip), %rdi      # 0x385c7
leaq -0x80(%rbp), %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1820a
testl %eax, %eax
jne 0x2db77
leaq -0x70(%rbp), %rdx
movq $0x8, (%rdx)
leaq 0xaefa(%rip), %rdi      # 0x385d7
leaq -0x78(%rbp), %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1820a
testl %eax, %eax
jne 0x2db87
leaq -0x68(%rbp), %rdx
movq $0x8, (%rdx)
leaq 0xaedf(%rip), %rdi      # 0x385e4
leaq -0x70(%rbp), %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1820a
testl %eax, %eax
jne 0x2db97
leaq -0x60(%rbp), %rdx
movq $0x8, (%rdx)
leaq 0xaec6(%rip), %rdi      # 0x385f3
leaq -0x68(%rbp), %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1820a
testl %eax, %eax
jne 0x2dba7
leaq -0x58(%rbp), %rdx
movq $0x8, (%rdx)
leaq 0xaead(%rip), %rdi      # 0x38602
leaq -0x60(%rbp), %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1820a
testl %eax, %eax
jne 0x2dbb7
leaq -0x98(%rbp), %rdx
movq $0x8, (%rdx)
leaq 0xae8f(%rip), %rdi      # 0x3860f
leaq -0x58(%rbp), %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1820a
testl %eax, %eax
jne 0x2dbc7
cmpb $0x0, -0x2c(%rbp)
je 0x2d8b0
leaq 0xae77(%rip), %rdx      # 0x3861e
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x3222c
movq -0xa0(%rbp), %rax
xorl %ecx, %ecx
lock
xaddq %rcx, (%rax)
leaq 0xae63(%rip), %rdx      # 0x3862c
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x3222c
movq -0x80(%rbp), %rcx
leaq 0xb28a(%rip), %rdx      # 0x38a6b
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x3222c
movq -0x78(%rbp), %rcx
leaq 0xae47(%rip), %rdx      # 0x38640
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x3222c
movq -0x70(%rbp), %rcx
leaq 0xae42(%rip), %rdx      # 0x38653
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x3222c
movq -0x68(%rbp), %rcx
leaq 0xae3f(%rip), %rdx      # 0x38668
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x3222c
movq -0x60(%rbp), %rcx
leaq 0xb5a6(%rip), %rdx      # 0x38de7
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x3222c
movq -0x58(%rbp), %rcx
leaq 0xae24(%rip), %rdx      # 0x3867d
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x3222c
movl %r13d, %ebx
orb -0x38(%rbp), %bl
leaq 0x6977(%rip), %rax      # 0x341ea
leaq 0x6e4a(%rip), %rcx      # 0x346c4
cmovneq %rax, %rcx
leaq 0xbbf6(%rip), %rdx      # 0x3947b
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x3222c
testb %bl, %bl
je 0x2db58
leaq 0xae64(%rip), %rdx      # 0x38705
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x3222c
jmp 0x2d911
movq -0x80(%rbp), %rcx
movq -0x78(%rbp), %r8
movq -0x70(%rbp), %r9
subq $0x8, %rsp
leaq 0xadca(%rip), %rdx      # 0x38691
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
pushq -0x58(%rbp)
pushq -0x60(%rbp)
pushq -0x68(%rbp)
callq 0x3222c
addq $0x20, %rsp
movq -0xa0(%rbp), %rax
xorl %ecx, %ecx
lock
xaddq %rcx, (%rax)
leaq 0xadf2(%rip), %rdx      # 0x386e8
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x3222c
movl %r13d, %eax
orb -0x38(%rbp), %al
cmpb $0x1, %al
jne 0x2db58
leaq -0x98(%rbp), %rdx
movq $0x4, (%rdx)
leaq 0xa8ce(%rip), %rdi      # 0x381f4
leaq -0x30(%rbp), %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1820a
testl %eax, %eax
jne 0x2dbd7
movq %rsp, -0xa8(%rbp)
movl -0x30(%rbp), %eax
movq %rsp, %rsi
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %rsi
movq %rsi, %rsp
movl -0x30(%rbp), %eax
leaq -0x98(%rbp), %rdx
movq %rax, (%rdx)
leaq 0xadaf(%rip), %rdi      # 0x3871a
xorl %ebx, %ebx
movq %rsi, -0x40(%rbp)
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1820a
testl %eax, %eax
jne 0x2dbe7
movb 0x18(%rbp), %cl
movb 0x10(%rbp), %al
movl -0x30(%rbp), %edx
xorl %esi, %esi
movq -0x40(%rbp), %r8
cmpq %rsi, %rdx
je 0x2d9a3
movzbl (%r8,%rsi), %edi
addl %edi, %ebx
incq %rsi
jmp 0x2d992
movzbl %cl, %ecx
movq %rcx, -0x88(%rbp)
movzbl -0x2c(%rbp), %ecx
movl %ecx, -0x4c(%rbp)
movzbl %r12b, %ecx
movl %ecx, -0x48(%rbp)
movzbl %al, %eax
movl %eax, -0x44(%rbp)
testb %r13b, %r13b
je 0x2da5c
cmpl $0x2, %ebx
setb %al
testb %al, -0x38(%rbp)
jne 0x2da5c
leaq 0xad4d(%rip), %rax      # 0x3872d
leaq 0xad56(%rip), %rdx      # 0x3873d
movl -0x2c(%rbp), %r12d
testb %r12b, %r12b
cmovneq %rax, %rdx
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x3222c
movl -0x30(%rbp), %ecx
subq $0x8, %rsp
movq %r15, %rdi
movq %r14, %rsi
movl -0x4c(%rbp), %edx
movl -0x48(%rbp), %r8d
movl -0x44(%rbp), %r9d
pushq -0x88(%rbp)
callq 0x2dc01
movq -0x40(%rbp), %r8
addq $0x10, %rsp
testb %r12b, %r12b
je 0x2da5c
cmpl $0x2, %ebx
leaq 0x6c8b(%rip), %rax      # 0x346c4
leaq 0x67aa(%rip), %rcx      # 0x341ea
cmovbq %rax, %rcx
leaq 0xba2f(%rip), %rdx      # 0x3947a
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x3222c
movq -0x40(%rbp), %r8
movq %r15, -0x90(%rbp)
movq %r14, -0x38(%rbp)
leaq 0xace6(%rip), %rax      # 0x38754
leaq 0xaceb(%rip), %rcx      # 0x38760
cmpb $0x0, -0x2c(%rbp)
cmovneq %rax, %rcx
movq %rcx, -0xb8(%rbp)
xorl %r15d, %r15d
xorl %r14d, %r14d
movq %rbx, -0xb0(%rbp)
movq -0x90(%rbp), %r12
movq -0x38(%rbp), %r13
movl -0x30(%rbp), %eax
cmpq %rax, %r15
jae 0x2db32
cmpb $0x1, (%r8,%r15)
jne 0x2db2a
movl -0x4c(%rbp), %ebx
addl %ebx, %r14d
movq %r12, %rdi
movq %r13, %rsi
movq -0xb8(%rbp), %rdx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x3222c
subq $0x8, %rsp
movq %r12, %rdi
movq %r13, %rsi
movl %ebx, %edx
movl %r15d, %ecx
movl -0x48(%rbp), %r8d
movl -0x44(%rbp), %r9d
pushq -0x88(%rbp)
callq 0x2dc01
popq %rax
popq %rcx
cmpb $0x0, -0x2c(%rbp)
je 0x2db26
movq -0xb0(%rbp), %rbx
cmpl %ebx, %r14d
leaq 0x6bbd(%rip), %rcx      # 0x346c4
leaq 0x66dc(%rip), %rax      # 0x341ea
cmovbq %rax, %rcx
movq %r12, %rdi
movq %r13, %rsi
leaq 0xb95b(%rip), %rdx      # 0x3947a
xorl %eax, %eax
callq 0x3222c
movq -0x40(%rbp), %r8
incq %r15
jmp 0x2da9c
movq -0xa8(%rbp), %rsp
cmpb $0x0, -0x2c(%rbp)
je 0x2db58
leaq 0xac28(%rip), %rdx      # 0x3876e
movq -0x90(%rbp), %rdi
movq -0x38(%rbp), %rsi
xorl %eax, %eax
callq 0x3222c
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9d44(%rip), %rdi      # 0x378b2
leaq 0xaa44(%rip), %rsi      # 0x385b9
jmp 0x2dbf5
leaq 0x9d34(%rip), %rdi      # 0x378b2
leaq 0xaa42(%rip), %rsi      # 0x385c7
jmp 0x2dbf5
leaq 0x9d24(%rip), %rdi      # 0x378b2
leaq 0xaa42(%rip), %rsi      # 0x385d7
jmp 0x2dbf5
leaq 0x9d14(%rip), %rdi      # 0x378b2
leaq 0xaa3f(%rip), %rsi      # 0x385e4
jmp 0x2dbf5
leaq 0x9d04(%rip), %rdi      # 0x378b2
leaq 0xaa3e(%rip), %rsi      # 0x385f3
jmp 0x2dbf5
leaq 0x9cf4(%rip), %rdi      # 0x378b2
leaq 0xaa3d(%rip), %rsi      # 0x38602
jmp 0x2dbf5
leaq 0x9ce4(%rip), %rdi      # 0x378b2
leaq 0xaa3a(%rip), %rsi      # 0x3860f
jmp 0x2dbf5
leaq 0x9cd4(%rip), %rdi      # 0x378b2
leaq 0xa60f(%rip), %rsi      # 0x381f4
jmp 0x2dbf5
leaq 0x9cc4(%rip), %rdi      # 0x378b2
leaq 0xab25(%rip), %rsi      # 0x3871a
xorl %eax, %eax
callq 0x322ac
callq 0xb070