// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/deps/jemalloc/src/jemalloc.c
// Function: je_allocm
int
je_allocm(void **ptr, size_t *rsize, size_t size, int flags)
{
	void *p;
	size_t usize;
	size_t alignment = (ZU(1) << (flags & ALLOCM_LG_ALIGN_MASK)
	    & (SIZE_T_MAX-1));
	bool zero = flags & ALLOCM_ZERO;
	unsigned arena_ind = ((unsigned)(flags >> 8)) - 1;
	arena_t *arena;
	bool try_tcache;

	assert(ptr != NULL);
	assert(size != 0);

	if (malloc_init())
		goto label_oom;

	if (arena_ind != UINT_MAX) {
		arena = arenas[arena_ind];
		try_tcache = false;
	} else {
		arena = NULL;
		try_tcache = true;
	}

	usize = (alignment == 0) ? s2u(size) : sa2u(size, alignment);
	if (usize == 0)
		goto label_oom;

	if (config_prof && opt_prof) {
		prof_thr_cnt_t *cnt;

		PROF_ALLOC_PREP(1, usize, cnt);
		if (cnt == NULL)
			goto label_oom;
		if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U && usize <=
		    SMALL_MAXCLASS) {
			size_t usize_promoted = (alignment == 0) ?
			    s2u(SMALL_MAXCLASS+1) : sa2u(SMALL_MAXCLASS+1,
			    alignment);
			assert(usize_promoted != 0);
			p = iallocm(usize_promoted, alignment, zero,
			    try_tcache, arena);
			if (p == NULL)
				goto label_oom;
			arena_prof_promoted(p, usize);
		} else {
			p = iallocm(usize, alignment, zero, try_tcache, arena);
			if (p == NULL)
				goto label_oom;
		}
		prof_malloc(p, usize, cnt);
	} else {
		p = iallocm(usize, alignment, zero, try_tcache, arena);
		if (p == NULL)
			goto label_oom;
	}
	if (rsize != NULL)
		*rsize = usize;

	*ptr = p;
	if (config_stats) {
		assert(usize == isalloc(p, config_prof));
		thread_allocated_tsd_get()->allocated += usize;
	}
	UTRACE(0, size, p);
	JEMALLOC_VALGRIND_MALLOC(true, p, usize, zero);
	return (ALLOCM_SUCCESS);
label_oom:
	if (config_xmalloc && opt_xmalloc) {
		malloc_write("<jemalloc>: Error in allocm(): "
		    "out of memory\n");
		abort();
	}
	*ptr = NULL;
	UTRACE(0, size, 0);
	return (ALLOCM_ERR_OOM);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, %ebp
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %rbx
movl $0x1, %r12d
shlq %cl, %r12
callq 0x7c7b5
testb %al, %al
jne 0x7e967
andq $-0x2, %r12
cmpl $0x100, %ebp            # imm = 0x100
jae 0x7e6b7
xorl %edi, %edi
jmp 0x7e6cb
movl %ebp, %eax
sarl $0x8, %eax
decl %eax
movq 0x604b3(%rip), %rcx     # 0xdeb78
movl %eax, %eax
movq (%rcx,%rax,8), %rdi
testq %r12, %r12
je 0x7e729
leaq (%r12,%r13), %rax
decq %rax
movq %r12, %r15
negq %r15
andq %rax, %r15
cmpq %r13, %r15
jb 0x7e967
leaq 0x61240(%rip), %rax     # 0xdf930
movq (%rax), %rax
cmpq %rax, %r15
seta %cl
cmpq $0x1001, %r12           # imm = 0x1001
setae %dl
orb %cl, %dl
jne 0x7e77a
cmpq $0xe00, %r15            # imm = 0xE00
ja 0x7e7dd
decq %r15
shrq $0x3, %r15
leaq 0x24a9e(%rip), %rax     # 0xa31c0
movzbl (%rax,%r15), %eax
jmp 0x7e745
cmpq $0xe00, %r13            # imm = 0xE00
ja 0x7e759
decq %r13
shrq $0x3, %r13
leaq 0x24a80(%rip), %rax     # 0xa31c0
movzbl (%rax,%r13), %eax
imulq $0x68, %rax, %rax
leaq 0x604b0(%rip), %rcx     # 0xdec00
movq (%rcx,%rax), %r15
jmp 0x7e7eb
leaq 0x611d0(%rip), %rax     # 0xdf930
cmpq %r13, (%rax)
jae 0x7e7ca
leaq 0x61114(%rip), %rax     # 0xdf880
movq (%rax), %r15
addq %r15, %r13
notq %r15
andq %r13, %r15
jmp 0x7e7eb
leaq 0xfff(%r13), %r15
andq $-0x1000, %r15          # imm = 0xF000
cmpq %r13, %r15
jb 0x7e967
leaq 0xfff(%r12), %rcx
andq $-0x1000, %rcx          # imm = 0xF000
addq %r15, %rcx
jb 0x7e967
addq $-0x1000, %rcx          # imm = 0xF000
cmpq %rax, %rcx
jbe 0x7e7eb
leaq 0x610c4(%rip), %rax     # 0xdf880
movq (%rax), %rax
addq %rax, %r15
notq %rax
andq %rax, %r15
jmp 0x7e7eb
addq $0xfff, %r13            # imm = 0xFFF
andq $-0x1000, %r13          # imm = 0xF000
movq %r13, %r15
jmp 0x7e7eb
addq $0xfff, %r15            # imm = 0xFFF
andq $-0x1000, %r15          # imm = 0xF000
testq %r15, %r15
je 0x7e967
movl %ebp, %r13d
andl $0x40, %r13d
leaq 0x6112e(%rip), %rax     # 0xdf930
movq (%rax), %rax
testq %r12, %r12
je 0x7e833
cmpq $0x1000, %r12           # imm = 0x1000
ja 0x7e84a
cmpq %r15, %rax
jb 0x7e84a
xorl %ecx, %ecx
cmpl $0x100, %ebp            # imm = 0x100
setb %cl
xorl %edx, %edx
testl %r13d, %r13d
setne %dl
movq %r15, %rsi
jmp 0x7e8d1
testl %r13d, %r13d
je 0x7e87f
cmpq %r15, %rax
jae 0x7e8ac
movq %r15, %rdi
movl $0x1, %esi
jmp 0x7e8e4
cmpq %r15, %rax
jb 0x7e88b
testq %rdi, %rdi
jne 0x7e86a
movq %fs:-0x30, %rdi
testq %rdi, %rdi
jne 0x7e86a
callq 0x7c4da
movq %rax, %rdi
xorl %ecx, %ecx
testl %r13d, %r13d
setne %cl
movq %r15, %rsi
movq %r12, %rdx
callq 0x8104f
jmp 0x7e8e9
cmpq %r15, %rax
jae 0x7e8c1
movq %r15, %rdi
xorl %esi, %esi
jmp 0x7e8e4
leaq 0x60fce(%rip), %rax     # 0xdf860
cmpq %r12, (%rax)
jae 0x7e8d8
xorl %edx, %edx
testl %r13d, %r13d
setne %dl
movq %r15, %rdi
movq %r12, %rsi
callq 0x8b92d
jmp 0x7e8e9
xorl %ecx, %ecx
cmpl $0x100, %ebp            # imm = 0x100
setb %cl
movq %r15, %rsi
movl $0x1, %edx
jmp 0x7e8d1
xorl %ecx, %ecx
cmpl $0x100, %ebp            # imm = 0x100
setb %cl
movq %r15, %rsi
xorl %edx, %edx
callq 0x7fb8c
jmp 0x7e8e9
xorl %esi, %esi
testl %r13d, %r13d
setne %sil
movq %r15, %rdi
callq 0x8b91c
testq %rax, %rax
je 0x7e967
testq %r14, %r14
je 0x7e8f6
movq %r15, (%r14)
movq %rax, (%rbx)
addq %r15, %fs:-0x28
xorl %ecx, %ecx
cmpb $0x1, 0x6025f(%rip)     # 0xdeb6a
jne 0x7e973
movq $0x1301, 0x10(%rsp)     # imm = 0x1301
movq %rax, 0x18(%rsp)
movq %r15, 0x20(%rsp)
leaq 0x60f59(%rip), %rcx     # 0xdf880
movq (%rcx), %rcx
notq %rcx
andq %rax, %rcx
movq %rax, %rdx
subq %rcx, %rdx
je 0x7e984
shrq $0xc, %rdx
leaq 0x60fe5(%rip), %rax     # 0xdf928
subq (%rax), %rdx
leaq (%rdx,%rdx,2), %rax
movq 0x40(%rcx,%rax,8), %rax
movl %eax, %ecx
shrl $0x4, %ecx
movl $0xff, %edx
andl %edx, %ecx
cmpl %edx, %ecx
jne 0x7e98e
andq $-0x1000, %rax          # imm = 0xF000
jmp 0x7e99d
movq $0x0, (%rbx)
movl $0x1, %ecx
movl %ecx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rdi
callq 0x8be94
jmp 0x7e99d
imulq $0x68, %rcx, %rax
leaq 0x60267(%rip), %rcx     # 0xdec00
movq (%rcx,%rax), %rax
xorl %ecx, %ecx
cmpq $0xe00, %rax            # imm = 0xE00
ja 0x7e9cb
decq %rax
shrq $0x3, %rax
leaq 0x2480b(%rip), %rdx     # 0xa31c0
movzbl (%rdx,%rax), %eax
imulq $0x68, %rax, %rax
leaq 0x6023c(%rip), %rdx     # 0xdec00
movq 0x8(%rdx,%rax), %rdx
jmp 0x7e9cd
xorl %edx, %edx
leaq 0x10(%rsp), %rax
movq %rdx, 0x18(%rax)
shrl $0x6, %r13d
movq %r13, 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
jmp 0x7e973