// File: /workspace/github_c_makefile_star2_O3/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 $0x1048, %rsp           # imm = 0x1048
movl %edx, %ebp
movq %rsi, %r14
movl %edi, %r15d
movq %fs:-0x18, %rax
testq %rax, %rax
jne 0x8cc9d
callq 0x8d204
movb $0x1, %bl
cmpq $0x3, %rax
jb 0x8ceb4
movq %rax, 0x30(%rsp)
movb $0x1, 0x58(%rax)
leaq 0x53e6f(%rip), %rdi     # 0xe0b28
callq 0x1faa0
movq %r14, 0x28(%rsp)
movq %r14, %rdi
movl $0x1a4, %esi            # imm = 0x1A4
callq 0x1f460
movl %eax, 0x53e92(%rip)     # 0xe0b68
cmpl $-0x1, %eax
je 0x8ce33
movl %r15d, 0xc(%rsp)
movl %ebp, 0x24(%rsp)
leaq 0x18(%rsp), %rsi
movq $0x0, (%rsi)
leaq 0x52d9d(%rip), %rdi     # 0xdfa98
xorl %r12d, %r12d
leaq 0x10(%rsp), %rcx
xorl %edx, %edx
callq 0x931e0
movl $0x0, %r14d
movl $0x0, %r13d
movl $0x0, %ebx
movl $0x0, %ebp
testb %al, %al
jne 0x8ce0d
xorl %ebp, %ebp
xorl %ebx, %ebx
xorl %r13d, %r13d
xorl %r14d, %r14d
xorl %r12d, %r12d
movq 0x10(%rsp), %r15
movq 0x8(%r15), %rdi
callq 0x1faa0
movdqu 0x38(%r15), %xmm0
movdqu 0x48(%r15), %xmm1
movdqu %xmm0, 0x18(%r15)
movdqu %xmm1, 0x28(%r15)
movq 0x58(%r15), %rcx
movq 0x18(%r15), %rax
testq %rcx, %rcx
je 0x8cdc4
movb 0x52d26(%rip), %dl      # 0xdfa94
movq 0x20(%r15), %rsi
movq %rcx, %rdi
movl 0x28(%rdi), %r9d
testb $0x1, %r9b
jne 0x8cd75
movq 0x30(%rdi), %r10
movq 0x38(%rdi), %r8
movdqu 0x40(%rdi), %xmm0
movl 0x28(%rdi), %r11d
cmpl %r9d, %r11d
jne 0x8cd75
addq %r10, %rax
movq %rax, 0x18(%r15)
addq %r8, %rsi
movq %rsi, 0x20(%r15)
testb %dl, %dl
je 0x8cdb7
movdqu 0x28(%r15), %xmm1
paddq %xmm0, %xmm1
movdqu %xmm1, 0x28(%r15)
movq (%rdi), %rdi
cmpq %rcx, %rdi
je 0x8cdc4
testq %rdi, %rdi
jne 0x8cd75
cmpq $0x1, %rax
sbbq $-0x1, %rbp
addq 0x20(%r15), %r14
cmpb $0x1, 0x52cbd(%rip)     # 0xdfa94
jne 0x8cde1
addq 0x28(%r15), %r13
addq 0x30(%r15), %rbx
addq %rax, %r12
movq 0x8(%r15), %rdi
callq 0x1fbb0
leaq 0x52ca4(%rip), %rdi     # 0xdfa98
leaq 0x18(%rsp), %rsi
xorl %edx, %edx
leaq 0x10(%rsp), %rcx
callq 0x931e0
testb %al, %al
je 0x8cd35
movq 0x3d164(%rip), %rcx     # 0xc9f78
testq %rcx, %rcx
je 0x8ce5c
movl $0x1, %eax
shlq %cl, %rax
movq %rax, (%rsp)
movzbl 0xc(%rsp), %edi
leaq 0x16823(%rip), %rsi     # 0xa3654
jmp 0x8ce68
testb %r15b, %r15b
jne 0x8ce7f
leaq 0x167bd(%rip), %rdi     # 0xa35fc
movq 0x28(%rsp), %rsi
xorl %eax, %eax
callq 0x926f9
leaq 0x51d08(%rip), %rax     # 0xdeb5a
cmpb $0x1, (%rax)
jne 0x8ce7f
callq 0x1f1b0
movzbl 0xc(%rsp), %edi
leaq 0x167bb(%rip), %rsi     # 0xa3623
movq %r12, %rdx
movq %r14, %rcx
movq %r13, %r8
movq %rbx, %r9
xorl %eax, %eax
callq 0x8d897
testb %al, %al
je 0x8cec8
leaq 0x53ca2(%rip), %rdi     # 0xe0b28
callq 0x1fbb0
movq 0x30(%rsp), %rcx
movb $0x0, 0x58(%rcx)
movb 0x59(%rcx), %al
movb 0x5a(%rcx), %bl
movw $0x0, 0x59(%rcx)
cmpb $0x1, %al
jne 0x8cea9
callq 0x8cb7b
testb %bl, %bl
je 0x8ceb2
callq 0x8d182
movb $0x1, %bl
movl %ebx, %eax
addq $0x1048, %rsp           # imm = 0x1048
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18(%rsp), %rsi
movq $0x0, (%rsi)
leaq 0x52bbd(%rip), %rdi     # 0xdfa98
leaq 0x38(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x931e0
testb %al, %al
je 0x8d03b
callq 0x1f410
leaq 0x16815(%rip), %rdx     # 0xa3713
leaq 0x40(%rsp), %rbx
movl $0x1001, %esi           # imm = 0x1001
movq %rbx, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0x9255e
movq %rbx, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x1fbf0
cmpl $-0x1, %eax
je 0x8ce7f
movl %eax, %ebx
movl 0xc(%rsp), %r13d
movzbl %r13b, %r15d
leaq 0x167e6(%rip), %rsi     # 0xa3721
movl %r15d, %edi
callq 0x8d9a4
testb %r13b, %al
jne 0x8ce7f
xorl %eax, %eax
leaq 0x53c1b(%rip), %r13     # 0xe0b70
addl 0x53c11(%rip), %eax     # 0xe0b6c
movl %eax, 0x53c0b(%rip)     # 0xe0b6c
cmpl $0x10000, %eax          # imm = 0x10000
jne 0x8cf80
movl %r15d, %edi
callq 0x8d943
testb %al, 0xc(%rsp)
jne 0x8ce7f
movl 0x53bec(%rip), %eax     # 0xe0b6c
movl %eax, %esi
addq %r13, %rsi
movl $0x10000, %edx          # imm = 0x10000
subl %eax, %edx
movl %ebx, %edi
callq 0x1f330
testq %rax, %rax
jg 0x8cf55
movl %ebx, %edi
callq 0x1f170
movl %r15d, %edi
callq 0x8d943
testb %al, %al
jne 0x8ce7f
movl 0x53bb3(%rip), %edi     # 0xe0b68
callq 0x1f170
movq 0x30(%rsp), %rdi
callq 0x8c6d2
xorl %ebx, %ebx
cmpb $0x0, 0x24(%rsp)
je 0x8ceb4
testq %r14, %r14
je 0x8ceb4
cmpq $0x1, %r14
leaq 0xa35c(%rip), %rax      # 0x97341
leaq 0x12497(%rip), %rcx     # 0x9f483
movq %rcx, %rdx
cmoveq %rax, %rdx
cmpq $0x1, %r12
movq %rcx, %r8
cmoveq %rax, %r8
cmpq $0x1, %rbp
cmoveq %rax, %rcx
movq %rcx, (%rsp)
leaq 0x16674(%rip), %rdi     # 0xa3685
xorl %ebx, %ebx
movq %r14, %rsi
movq %r12, %rcx
movq %rbp, %r9
xorl %eax, %eax
callq 0x926f9
leaq 0x1669e(%rip), %rdi     # 0xa36c8
movq 0x28(%rsp), %rsi
xorl %eax, %eax
callq 0x926f9
jmp 0x8ceb4
movzbl 0xc(%rsp), %r15d
movq 0x10(%rsp), %rax
movq 0x38(%rsp), %rbx
cmpb $0x0, 0x52a42(%rip)     # 0xdfa94
je 0x8d063
movq 0x28(%rax), %r8
testq %r8, %r8
je 0x8d0dc
movq 0x18(%rax), %rdx
jmp 0x8d070
movq 0x18(%rax), %rdx
testq %rdx, %rdx
je 0x8d0dc
movq 0x28(%rax), %r8
movq 0x20(%rax), %rcx
movq 0x30(%rax), %r9
movl %r15d, %edi
leaq 0x16675(%rip), %rsi     # 0xa36f7
xorl %eax, %eax
callq 0x8d897
testb %al, %al
jne 0x8ce7f
cmpl $0x0, 0x8(%rbx)
je 0x8d0c5
xorl %r13d, %r13d
movq (%rbx), %rax
movq (%rax,%r13,8), %rdx
movl %r15d, %edi
leaq 0x16662(%rip), %rsi     # 0xa370d
xorl %eax, %eax
callq 0x8d897
testb %al, %al
jne 0x8ce7f
incq %r13
movl 0x8(%rbx), %eax
cmpq %rax, %r13
jb 0x8d09a
movl %r15d, %edi
leaq 0x96c2(%rip), %rsi      # 0x96791
callq 0x8d9a4
testb %al, %al
jne 0x8ce7f
leaq 0x529b5(%rip), %rdi     # 0xdfa98
leaq 0x18(%rsp), %rsi
leaq 0x38(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x931e0
testb %al, %al
je 0x8d041
jmp 0x8cef2