// File: /workspace/github_c_makefile_star2_O2/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, %r14d
movq %rsi, %rbx
movl %edi, %r15d
callq 0x82f5a
movb $0x1, %bpl
cmpq $0x3, %rax
jb 0x83766
movq %rax, 0x30(%rsp)
movq %rax, %rdi
callq 0x82f6d
movq %rbx, 0x28(%rsp)
movq %rbx, %rdi
movl $0x1a4, %esi            # imm = 0x1A4
callq 0x1f460
movl %eax, 0x5a576(%rip)     # 0xddb68
cmpl $-0x1, %eax
je 0x83710
movl %r15d, 0xc(%rsp)
movl %r14d, 0x24(%rsp)
leaq 0x18(%rsp), %rax
andq $0x0, (%rax)
xorl %r12d, %r12d
xorl %r15d, %r15d
xorl %r14d, %r14d
xorl %ebp, %ebp
xorl %r13d, %r13d
leaq 0x59475(%rip), %rdi     # 0xdca98
leaq 0x18(%rsp), %rsi
xorl %edx, %edx
leaq 0x10(%rsp), %rcx
callq 0x89130
testb %al, %al
jne 0x836ec
movq 0x10(%rsp), %rbx
movq 0x8(%rbx), %rdi
callq 0x1faa0
leaq 0x18(%rbx), %rcx
movdqu 0x38(%rbx), %xmm0
movdqu 0x48(%rbx), %xmm1
movdqu %xmm1, 0x28(%rbx)
movdqu %xmm0, 0x18(%rbx)
movq 0x58(%rbx), %rdx
movb 0x59428(%rip), %al      # 0xdca94
movq %rdx, %rsi
testq %rsi, %rsi
je 0x836bf
movl 0x28(%rsi), %edi
testb $0x1, %dil
jne 0x83674
movdqu 0x30(%rsi), %xmm1
movdqu 0x40(%rsi), %xmm0
movl 0x28(%rsi), %r8d
cmpl %edi, %r8d
jne 0x83674
movdqu (%rcx), %xmm2
paddq %xmm1, %xmm2
movdqu %xmm2, (%rcx)
testb $0x1, %al
je 0x836ae
movdqu 0x28(%rbx), %xmm1
paddq %xmm0, %xmm1
movdqu %xmm1, 0x28(%rbx)
movq (%rsi), %rdi
cmpq %rdx, %rdi
movl $0x0, %esi
cmovneq %rdi, %rsi
jmp 0x8366f
movq 0x18(%rbx), %rcx
cmpq $0x1, %rcx
sbbq $-0x1, %r13
addq 0x20(%rbx), %r15
testb $0x1, %al
je 0x836db
addq 0x28(%rbx), %r14
addq 0x30(%rbx), %rbp
addq %rcx, %r12
movq 0x8(%rbx), %rdi
callq 0x1fbb0
jmp 0x8361c
movq 0x43885(%rip), %rcx     # 0xc6f78
movzbl 0xc(%rsp), %ebx
testq %rcx, %rcx
je 0x83739
pushq $0x1
popq %rax
shlq %cl, %rax
movq %rax, (%rsp)
leaq 0x15ee7(%rip), %rsi     # 0x995f5
jmp 0x83740
testb %r15b, %r15b
jne 0x83759
leaq 0x15e81(%rip), %rdi     # 0x9959d
movq 0x28(%rsp), %rsi
xorl %eax, %eax
callq 0x88881
leaq 0x5842b(%rip), %rax     # 0xdbb5a
cmpb $0x1, (%rax)
jne 0x83759
callq 0x1f1b0
leaq 0x15e84(%rip), %rsi     # 0x995c4
movl %ebx, %edi
movq %r12, %rdx
movq %r15, %rcx
movq %r14, %r8
movq %rbp, %r9
xorl %eax, %eax
callq 0x84058
testb %al, %al
je 0x8377a
movq 0x30(%rsp), %rdi
callq 0x83145
movb $0x1, %bpl
movl %ebp, %eax
addq $0x1048, %rsp           # imm = 0x1048
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18(%rsp), %rax
andq $0x0, (%rax)
leaq 0x5930e(%rip), %rdi     # 0xdca98
leaq 0x18(%rsp), %rsi
leaq 0x38(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x89130
testb %al, %al
jne 0x8383e
movq 0x10(%rsp), %rax
movq 0x38(%rsp), %r14
cmpb $0x0, 0x592dd(%rip)     # 0xdca94
je 0x837c8
movq 0x28(%rax), %r8
testq %r8, %r8
je 0x83783
movq 0x18(%rax), %rdx
jmp 0x837d5
movq 0x18(%rax), %rdx
testq %rdx, %rdx
je 0x83783
movq 0x28(%rax), %r8
movq 0x20(%rax), %rcx
movq 0x30(%rax), %r9
movl %ebx, %edi
leaq 0x15eb2(%rip), %rsi     # 0x99698
xorl %eax, %eax
callq 0x84058
testb %al, %al
jne 0x83759
xorl %ebp, %ebp
movl 0x8(%r14), %eax
cmpq %rax, %rbp
jae 0x83823
movq (%r14), %rax
movq (%rax,%rbp,8), %rdx
movl %ebx, %edi
leaq 0x15e9e(%rip), %rsi     # 0x996ae
xorl %eax, %eax
callq 0x84058
incq %rbp
testb %al, %al
je 0x837f7
jmp 0x83759
movl %ebx, %edi
leaq 0x8f25(%rip), %rsi      # 0x8c751
callq 0x84162
testb %al, %al
je 0x83783
jmp 0x83759
callq 0x1f410
leaq 0x15e6a(%rip), %rdx     # 0x996b4
leaq 0x40(%rsp), %r14
movl $0x1001, %esi           # imm = 0x1001
movq %r14, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0x8872c
movq %r14, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x1fbf0
cmpl $-0x1, %eax
je 0x83759
movl %eax, %ebp
leaq 0x15e44(%rip), %rsi     # 0x996c2
movl %ebx, %edi
callq 0x84162
testb %al, 0xc(%rsp)
jne 0x83759
xorl %eax, %eax
leaq 0x5a2d8(%rip), %r14     # 0xddb70
addl 0x5a2ce(%rip), %eax     # 0xddb6c
movl %eax, 0x5a2c8(%rip)     # 0xddb6c
cmpl $0x10000, %eax          # imm = 0x10000
jne 0x838c2
movl %ebx, %edi
callq 0x84104
testb %al, 0xc(%rsp)
jne 0x83759
movl 0x5a2aa(%rip), %eax     # 0xddb6c
movl %eax, %esi
addq %r14, %rsi
movl $0x10000, %edx          # imm = 0x10000
subl %eax, %edx
movl %ebp, %edi
callq 0x1f330
testq %rax, %rax
jg 0x83898
movl %ebp, %edi
callq 0x1f170
movl %ebx, %edi
callq 0x84104
testb %al, %al
jne 0x83759
movl 0x5a272(%rip), %edi     # 0xddb68
callq 0x1f170
movq 0x30(%rsp), %rdi
callq 0x83145
xorl %ebp, %ebp
cmpb $0x0, 0x24(%rsp)
je 0x83766
testq %r15, %r15
je 0x83766
cmpq $0x1, %r15
leaq 0x99eb(%rip), %rax      # 0x8d311
leaq 0x11aca(%rip), %rcx     # 0x953f7
movq %rcx, %rdx
cmoveq %rax, %rdx
cmpq $0x1, %r12
movq %rcx, %r8
cmoveq %rax, %r8
cmpq $0x1, %r13
cmoveq %rax, %rcx
movq %rcx, (%rsp)
leaq 0x15cd4(%rip), %rdi     # 0x99626
xorl %ebp, %ebp
movq %r15, %rsi
movq %r12, %rcx
movq %r13, %r9
xorl %eax, %eax
callq 0x88881
leaq 0x15cfe(%rip), %rdi     # 0x99669
movq 0x28(%rsp), %rsi
xorl %eax, %eax
callq 0x88881
jmp 0x83766