// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/deps/jemalloc/src/prof.c
// Function: prof_dump
static bool
prof_dump(bool propagate_err, const char *filename, bool leakcheck)
{
	prof_tdata_t *prof_tdata;
	prof_cnt_t cnt_all;
	size_t tabind;
	union {
		prof_bt_t	*p;
		void		*v;
	} bt;
	union {
		prof_ctx_t	*p;
		void		*v;
	} ctx;
	size_t leak_nctx;

	cassert(config_prof);

	prof_tdata = prof_tdata_get();
	if ((uintptr_t)prof_tdata <= (uintptr_t)PROF_TDATA_STATE_MAX)
		return (true);
	prof_enter(prof_tdata);
	prof_dump_fd = creat(filename, 0644);
	if (prof_dump_fd == -1) {
		if (propagate_err == false) {
			malloc_printf(
			    "<jemalloc>: creat(\"%s\"), 0644) failed\n",
			    filename);
			if (opt_abort)
				abort();
		}
		goto label_error;
	}

	/* Merge per thread profile stats, and sum them in cnt_all. */
	memset(&cnt_all, 0, sizeof(prof_cnt_t));
	leak_nctx = 0;
	for (tabind = 0; ckh_iter(&bt2ctx, &tabind, NULL, &ctx.v) == false;)
		prof_ctx_sum(ctx.p, &cnt_all, &leak_nctx);

	/* Dump profile header. */
	if (opt_lg_prof_sample == 0) {
		if (prof_printf(propagate_err,
		    "heap profile: %"PRId64": %"PRId64
		    " [%"PRIu64": %"PRIu64"] @ heapprofile\n",
		    cnt_all.curobjs, cnt_all.curbytes,
		    cnt_all.accumobjs, cnt_all.accumbytes))
			goto label_error;
	} else {
		if (prof_printf(propagate_err,
		    "heap profile: %"PRId64": %"PRId64
		    " [%"PRIu64": %"PRIu64"] @ heap_v2/%"PRIu64"\n",
		    cnt_all.curobjs, cnt_all.curbytes,
		    cnt_all.accumobjs, cnt_all.accumbytes,
		    ((uint64_t)1U << opt_lg_prof_sample)))
			goto label_error;
	}

	/* Dump  per ctx profile stats. */
	for (tabind = 0; ckh_iter(&bt2ctx, &tabind, &bt.v, &ctx.v)
	    == false;) {
		if (prof_dump_ctx(propagate_err, ctx.p, bt.p))
			goto label_error;
	}

	/* Dump /proc/<pid>/maps if possible. */
	if (prof_dump_maps(propagate_err))
		goto label_error;

	if (prof_flush(propagate_err))
		goto label_error;
	close(prof_dump_fd);
	prof_leave(prof_tdata);

	if (leakcheck && cnt_all.curbytes != 0) {
		malloc_printf("<jemalloc>: Leak summary: %"PRId64" byte%s, %"
		    PRId64" object%s, %zu context%s\n",
		    cnt_all.curbytes, (cnt_all.curbytes != 1) ? "s" : "",
		    cnt_all.curobjs, (cnt_all.curobjs != 1) ? "s" : "",
		    leak_nctx, (leak_nctx != 1) ? "s" : "");
		malloc_printf(
		    "<jemalloc>: Run pprof on \"%s\" for leak detail\n",
		    filename);
	}

	return (false);
label_error:
	prof_leave(prof_tdata);
	return (true);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1068, %rsp           # imm = 0x1068
movl %edx, %ebp
movq %rsi, %r14
movl %edi, 0x2c(%rsp)
movq %fs:-0x18, %rax
testq %rax, %rax
jne 0x8ca1e
callq 0x8cfbd
movb $0x1, %bl
cmpq $0x3, %rax
jb 0x8cc76
movq %rax, 0x48(%rsp)
movb $0x1, 0x58(%rax)
leaq 0x540ee(%rip), %rdi     # 0xe0b28
callq 0x1faa0
movq %r14, 0x40(%rsp)
movq %r14, %rdi
movl $0x1a4, %esi            # imm = 0x1A4
callq 0x1f460
movl %eax, 0x54111(%rip)     # 0xe0b68
cmpl $-0x1, %eax
je 0x8cbf0
movl %ebp, 0x3c(%rsp)
leaq 0x30(%rsp), %rsi
movq $0x0, (%rsi)
leaq 0x53021(%rip), %rdi     # 0xdfa98
xorl %r12d, %r12d
leaq 0x20(%rsp), %rcx
xorl %edx, %edx
callq 0x92dbd
movl $0x0, %r13d
movl $0x0, %ecx
movq %rcx, 0x10(%rsp)
movl $0x0, %ecx
movq %rcx, 0x18(%rsp)
movl $0x0, %ebx
testb %al, %al
jne 0x8cbbf
xorl %ebx, %ebx
movq $0x0, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
xorl %r13d, %r13d
xorl %r12d, %r12d
movq 0x20(%rsp), %r15
movq 0x8(%r15), %rdi
callq 0x1faa0
movups 0x38(%r15), %xmm0
movups 0x48(%r15), %xmm1
movups %xmm0, 0x18(%r15)
movups %xmm1, 0x28(%r15)
movq 0x58(%r15), %rax
testq %rax, %rax
je 0x8cb5e
movb 0x52f9c(%rip), %cl      # 0xdfa94
movq 0x18(%r15), %rdx
movq 0x20(%r15), %rsi
movq %rax, %rdi
movl 0x28(%rdi), %ebp
testb $0x1, %bpl
jne 0x8cb29
movq 0x30(%rdi), %r8
movq 0x38(%rdi), %r9
movq 0x40(%rdi), %r11
movq 0x48(%rdi), %r10
movl 0x28(%rdi), %r14d
cmpl %ebp, %r14d
sete %bpl
jmp 0x8cb2b
xorl %ebp, %ebp
testb %bpl, %bpl
je 0x8cb03
addq %r8, %rdx
movq %rdx, 0x18(%r15)
addq %r9, %rsi
movq %rsi, 0x20(%r15)
testb %cl, %cl
je 0x8cb4a
addq %r11, 0x28(%r15)
addq %r10, 0x30(%r15)
movq (%rdi), %r14
cmpq %rax, %r14
movl $0x0, %edi
cmovneq %r14, %rdi
testq %rdi, %rdi
jne 0x8cb03
movq 0x18(%r15), %rax
cmpq $0x1, %rax
sbbq $-0x1, %rbx
addq 0x20(%r15), %r13
cmpb $0x1, 0x52f1f(%rip)     # 0xdfa94
jne 0x8cb93
movq 0x10(%rsp), %rcx
addq 0x28(%r15), %rcx
movq %rcx, 0x10(%rsp)
movq 0x18(%rsp), %rcx
addq 0x30(%r15), %rcx
movq %rcx, 0x18(%rsp)
addq %rax, %r12
movq 0x8(%r15), %rdi
callq 0x1fbb0
leaq 0x52ef2(%rip), %rdi     # 0xdfa98
leaq 0x30(%rsp), %rsi
xorl %edx, %edx
leaq 0x20(%rsp), %rcx
callq 0x92dbd
testb %al, %al
je 0x8cac7
movq %rbx, 0x58(%rsp)
movq %r13, %r14
movq 0x3d3aa(%rip), %rcx     # 0xc9f78
testq %rcx, %rcx
movl 0x2c(%rsp), %ebp
je 0x8cc1b
movl $0x1, %eax
shlq %cl, %rax
movq %rax, (%rsp)
movzbl %bpl, %edi
leaq 0x16966(%rip), %rsi     # 0xa3554
jmp 0x8cc26
cmpb $0x0, 0x2c(%rsp)
jne 0x8cc41
leaq 0x168fe(%rip), %rdi     # 0xa34fc
movq 0x40(%rsp), %rsi
xorl %eax, %eax
callq 0x92309
leaq 0x51f49(%rip), %rax     # 0xdeb5a
cmpb $0x1, (%rax)
jne 0x8cc41
callq 0x1f1b0
movzbl %bpl, %edi
leaq 0x168fd(%rip), %rsi     # 0xa3523
movq %r12, %rdx
movq %r14, %rcx
movq 0x10(%rsp), %r8
movq 0x18(%rsp), %r9
xorl %eax, %eax
callq 0x8d656
testb %al, %al
je 0x8cc8a
leaq 0x53ee0(%rip), %rdi     # 0xe0b28
callq 0x1fbb0
movq 0x48(%rsp), %rcx
movb $0x0, 0x58(%rcx)
movb 0x59(%rcx), %al
movb 0x5a(%rcx), %bl
movw $0x0, 0x59(%rcx)
cmpb $0x1, %al
jne 0x8cc6b
callq 0x8c8fb
testb %bl, %bl
je 0x8cc74
callq 0x8cf3b
movb $0x1, %bl
movl %ebx, %eax
addq $0x1068, %rsp           # imm = 0x1068
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x30(%rsp), %rsi
movq $0x0, (%rsi)
leaq 0x52dfb(%rip), %rdi     # 0xdfa98
leaq 0x50(%rsp), %rdx
leaq 0x20(%rsp), %rcx
callq 0x92dbd
testb %al, %al
je 0x8cdf7
callq 0x1f410
leaq 0x16953(%rip), %rdx     # 0xa3613
leaq 0x60(%rsp), %rbx
movl $0x1001, %esi           # imm = 0x1001
movq %rbx, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0x9216e
movq %rbx, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x1fbf0
cmpl $-0x1, %eax
je 0x8cc41
movl %eax, %ebx
movzbl %bpl, %r15d
leaq 0x16929(%rip), %rsi     # 0xa3621
movl %r15d, %edi
callq 0x8d763
testb %bpl, %al
jne 0x8cc41
xorl %eax, %eax
leaq 0x53e5e(%rip), %r13     # 0xe0b70
addl 0x53e54(%rip), %eax     # 0xe0b6c
movl %eax, 0x53e4e(%rip)     # 0xe0b6c
cmpl $0x10000, %eax          # imm = 0x10000
jne 0x8cd36
movl %r15d, %edi
callq 0x8d702
testb %bpl, %al
jne 0x8cc41
movl 0x53e30(%rip), %esi     # 0xe0b6c
movl $0x10000, %edx          # imm = 0x10000
subl %esi, %edx
addq %r13, %rsi
movl %ebx, %edi
callq 0x1f330
testq %rax, %rax
jg 0x8cd12
movl %ebx, %edi
callq 0x1f170
movl %r15d, %edi
callq 0x8d702
testb %al, %al
jne 0x8cc41
movl 0x53df9(%rip), %edi     # 0xe0b68
callq 0x1f170
movq 0x48(%rsp), %rdi
callq 0x8c47b
xorl %ebx, %ebx
cmpb $0x0, 0x3c(%rsp)
je 0x8cc76
testq %r14, %r14
je 0x8cc76
cmpq $0x1, %r14
leaq 0xa542(%rip), %rax      # 0x972e1
leaq 0x1266d(%rip), %rcx     # 0x9f413
movq %rcx, %rdx
cmoveq %rax, %rdx
cmpq $0x1, %r12
movq %rcx, %r8
cmoveq %rax, %r8
movq 0x58(%rsp), %r9
cmpq $0x1, %r9
cmoveq %rax, %rcx
movq %rcx, (%rsp)
leaq 0x167b5(%rip), %rdi     # 0xa3585
xorl %ebx, %ebx
movq %r14, %rsi
movq %r12, %rcx
xorl %eax, %eax
callq 0x92309
leaq 0x167e2(%rip), %rdi     # 0xa35c8
movq 0x40(%rsp), %rsi
xorl %eax, %eax
callq 0x92309
jmp 0x8cc76
movzbl %bpl, %r15d
movq 0x20(%rsp), %rax
movq 0x50(%rsp), %rbx
movb 0x52c89(%rip), %cl      # 0xdfa94
testb %cl, %cl
jne 0x8ce16
cmpq $0x0, 0x18(%rax)
je 0x8ce95
testb %cl, %cl
je 0x8ce21
cmpq $0x0, 0x28(%rax)
je 0x8ce95
movq 0x18(%rax), %rdx
movq 0x20(%rax), %rcx
movq 0x28(%rax), %r8
movq 0x30(%rax), %r9
movl %r15d, %edi
leaq 0x167bc(%rip), %rsi     # 0xa35f7
xorl %eax, %eax
callq 0x8d656
testb %al, %al
jne 0x8cc41
cmpl $0x0, 0x8(%rbx)
je 0x8ce7e
xorl %r13d, %r13d
movq (%rbx), %rax
movq (%rax,%r13,8), %rdx
movl %r15d, %edi
leaq 0x167a9(%rip), %rsi     # 0xa360d
xorl %eax, %eax
callq 0x8d656
testb %al, %al
jne 0x8cc41
incq %r13
movl 0x8(%rbx), %eax
cmpq %rax, %r13
jb 0x8ce53
movl %r15d, %edi
leaq 0x98b9(%rip), %rsi      # 0x96741
callq 0x8d763
testb %al, %al
jne 0x8cc41
leaq 0x52bfc(%rip), %rdi     # 0xdfa98
leaq 0x30(%rsp), %rsi
leaq 0x50(%rsp), %rdx
leaq 0x20(%rsp), %rcx
callq 0x92dbd
testb %al, %al
je 0x8cdfb
jmp 0x8ccb4