// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/deps/jemalloc/src/jemalloc.c
// Function: je_calloc
void *
je_calloc(size_t num, size_t size)
{
	void *ret;
	size_t num_size;
	size_t usize JEMALLOC_CC_SILENCE_INIT(0);
	prof_thr_cnt_t *cnt JEMALLOC_CC_SILENCE_INIT(NULL);

	if (malloc_init()) {
		num_size = 0;
		ret = NULL;
		goto label_return;
	}

	num_size = num * size;
	if (num_size == 0) {
		if (num == 0 || size == 0)
			num_size = 1;
		else {
			ret = NULL;
			goto label_return;
		}
	/*
	 * Try to avoid division here.  We know that it isn't possible to
	 * overflow during multiplication if neither operand uses any of the
	 * most significant half of the bits in a size_t.
	 */
	} else if (((num | size) & (SIZE_T_MAX << (sizeof(size_t) << 2)))
	    && (num_size / size != num)) {
		/* size_t overflow. */
		ret = NULL;
		goto label_return;
	}

	if (config_prof && opt_prof) {
		usize = s2u(num_size);
		PROF_ALLOC_PREP(1, usize, cnt);
		if (cnt == NULL) {
			ret = NULL;
			goto label_return;
		}
		if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U && usize
		    <= SMALL_MAXCLASS) {
			ret = icalloc(SMALL_MAXCLASS+1);
			if (ret != NULL)
				arena_prof_promoted(ret, usize);
		} else
			ret = icalloc(num_size);
	} else {
		if (config_stats || (config_valgrind && opt_valgrind))
			usize = s2u(num_size);
		ret = icalloc(num_size);
	}

label_return:
	if (ret == NULL) {
		if (config_xmalloc && opt_xmalloc) {
			malloc_write("<jemalloc>: Error in calloc(): out of "
			    "memory\n");
			abort();
		}
		set_errno(ENOMEM);
	}

	if (config_prof && opt_prof && ret != NULL)
		prof_malloc(ret, usize, cnt);
	if (config_stats && ret != NULL) {
		assert(usize == isalloc(ret, config_prof));
		thread_allocated_tsd_get()->allocated += usize;
	}
	UTRACE(0, num_size, ret);
	JEMALLOC_VALGRIND_MALLOC(ret != NULL, ret, usize, true);
	return (ret);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %r15
xorl %r12d, %r12d
callq 0x7c61b
movl $0x0, %ebx
testb %al, %al
jne 0x7d7db
movq %r14, %rax
mulq %r15
seto %cl
testq %rax, %rax
je 0x7d72c
orq %r15, %r14
shrq $0x20, %r14
setne %dl
xorl %r12d, %r12d
movl $0x0, %ebx
testb %cl, %dl
je 0x7d74d
jmp 0x7d7db
testq %r15, %r15
sete %al
testq %r14, %r14
sete %cl
xorl %r12d, %r12d
orb %al, %cl
movl $0x1, %eax
movl $0x0, %ebx
je 0x7d7db
cmpq $0xe00, %rax            # imm = 0xE00
ja 0x7d779
leaq -0x1(%rax), %rcx
shrq $0x3, %rcx
leaq 0x2595c(%rip), %rdx     # 0xa30c0
movzbl (%rdx,%rcx), %ecx
imulq $0x68, %rcx, %rcx
leaq 0x6148d(%rip), %rdx     # 0xdec00
movq (%rdx,%rcx), %r12
jmp 0x7d7a9
leaq 0x621b0(%rip), %rcx     # 0xdf930
cmpq %rax, (%rcx)
jae 0x7d79b
leaq 0x620f4(%rip), %rcx     # 0xdf880
movq (%rcx), %r12
leaq (%r12,%rax), %rcx
notq %r12
andq %rcx, %r12
jmp 0x7d7a9
leaq 0xfff(%rax), %r12
andq $-0x1000, %r12          # imm = 0xF000
leaq 0x62180(%rip), %rcx     # 0xdf930
cmpq %rax, (%rcx)
jae 0x7d7c4
movq %rax, %rdi
movl $0x1, %esi
callq 0x8b6a4
jmp 0x7d7d8
xorl %edi, %edi
movq %rax, %rsi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x7f908
movq %rax, %rbx
testq %rbx, %rbx
jne 0x7d7eb
callq 0x1f810
movl $0xc, (%rax)
testq %rbx, %rbx
je 0x7d7f9
addq %r12, %fs:-0x28
testq %rbx, %rbx
je 0x7d8e8
cmpb $0x0, 0x61361(%rip)     # 0xdeb6a
je 0x7d8e8
movq $0x1301, 0x10(%rsp)     # imm = 0x1301
movq %rbx, 0x18(%rsp)
movq %r12, 0x20(%rsp)
leaq 0x62057(%rip), %rax     # 0xdf880
movq (%rax), %rax
notq %rax
andq %rbx, %rax
movq %rbx, %rcx
subq %rax, %rcx
je 0x7d869
shrq $0xc, %rcx
leaq 0x620e3(%rip), %rdx     # 0xdf928
subq (%rdx), %rcx
leaq (%rcx,%rcx,2), %rcx
movq 0x40(%rax,%rcx,8), %rax
movl %eax, %ecx
shrl $0x4, %ecx
movl $0xff, %edx
andl %edx, %ecx
cmpl %edx, %ecx
jne 0x7d873
andq $-0x1000, %rax          # imm = 0xF000
jmp 0x7d882
movq %rbx, %rdi
callq 0x8bc15
jmp 0x7d882
imulq $0x68, %rcx, %rax
leaq 0x61382(%rip), %rcx     # 0xdec00
movq (%rcx,%rax), %rax
cmpq $0xe00, %rax            # imm = 0xE00
ja 0x7d8ae
decq %rax
shrq $0x3, %rax
leaq 0x25828(%rip), %rcx     # 0xa30c0
movzbl (%rcx,%rax), %eax
imulq $0x68, %rax, %rax
leaq 0x61359(%rip), %rcx     # 0xdec00
movq 0x8(%rcx,%rax), %rcx
jmp 0x7d8b0
xorl %ecx, %ecx
leaq 0x10(%rsp), %rax
movq %rcx, 0x18(%rax)
movq $0x1, 0x20(%rax)
movq $0x0, 0x28(%rax)
xorl %edx, %edx
rolq $0x3, %rdi
rolq $0xd, %rdi
rolq $0x3d, %rdi
rolq $0x33, %rdi
xchgq %rbx, %rbx
movq %rdx, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq