// File: /workspace/github_c_makefile_star2_O1/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 0x7c61b
testb %al, %al
jne 0x7e6c7
andq $-0x2, %r12
cmpl $0x100, %ebp            # imm = 0x100
jae 0x7e413
xorl %edi, %edi
jmp 0x7e427
movl %ebp, %eax
sarl $0x8, %eax
decl %eax
movq 0x60757(%rip), %rcx     # 0xdeb78
movl %eax, %eax
movq (%rcx,%rax,8), %rdi
testq %r12, %r12
je 0x7e449
leaq (%r12,%r13), %rax
decq %rax
movq %r12, %r15
negq %r15
andq %rax, %r15
cmpq %r13, %r15
jae 0x7e467
xorl %r15d, %r15d
jmp 0x7e54b
cmpq $0xe00, %r13            # imm = 0xE00
ja 0x7e4b9
decq %r13
shrq $0x3, %r13
leaq 0x24c60(%rip), %rax     # 0xa30c0
movzbl (%rax,%r13), %eax
jmp 0x7e4a5
leaq 0x614c2(%rip), %rax     # 0xdf930
movq (%rax), %rax
cmpq %rax, %r15
seta %cl
cmpq $0x1001, %r12           # imm = 0x1001
setae %dl
orb %cl, %dl
jne 0x7e4da
cmpq $0xe00, %r15            # imm = 0xE00
ja 0x7e53d
decq %r15
shrq $0x3, %r15
leaq 0x24c20(%rip), %rax     # 0xa30c0
movzbl (%rax,%r15), %eax
imulq $0x68, %rax, %rax
leaq 0x60750(%rip), %rcx     # 0xdec00
movq (%rcx,%rax), %r15
jmp 0x7e54b
leaq 0x61470(%rip), %rax     # 0xdf930
cmpq %r13, (%rax)
jae 0x7e52a
leaq 0x613b4(%rip), %rax     # 0xdf880
movq (%rax), %r15
addq %r15, %r13
notq %r15
andq %r13, %r15
jmp 0x7e54b
leaq 0xfff(%r13), %r15
andq $-0x1000, %r15          # imm = 0xF000
cmpq %r13, %r15
jb 0x7e441
leaq 0xfff(%r12), %rcx
andq $-0x1000, %rcx          # imm = 0xF000
addq %r15, %rcx
jb 0x7e441
addq $-0x1000, %rcx          # imm = 0xF000
cmpq %rax, %rcx
jbe 0x7e54b
leaq 0x61364(%rip), %rax     # 0xdf880
movq (%rax), %rax
addq %rax, %r15
notq %rax
andq %rax, %r15
jmp 0x7e54b
addq $0xfff, %r13            # imm = 0xFFF
andq $-0x1000, %r13          # imm = 0xF000
movq %r13, %r15
jmp 0x7e54b
addq $0xfff, %r15            # imm = 0xFFF
andq $-0x1000, %r15          # imm = 0xF000
testq %r15, %r15
je 0x7e6c7
movl %ebp, %r13d
andl $0x40, %r13d
leaq 0x613ce(%rip), %rax     # 0xdf930
movq (%rax), %rax
testq %r12, %r12
je 0x7e593
cmpq $0x1000, %r12           # imm = 0x1000
ja 0x7e5aa
cmpq %r15, %rax
jb 0x7e5aa
xorl %ecx, %ecx
cmpl $0x100, %ebp            # imm = 0x100
setb %cl
xorl %edx, %edx
testl %r13d, %r13d
setne %dl
movq %r15, %rsi
jmp 0x7e631
testl %r13d, %r13d
je 0x7e5df
cmpq %r15, %rax
jae 0x7e60c
movq %r15, %rdi
movl $0x1, %esi
jmp 0x7e644
cmpq %r15, %rax
jb 0x7e5eb
testq %rdi, %rdi
jne 0x7e5ca
movq %fs:-0x30, %rdi
testq %rdi, %rdi
jne 0x7e5ca
callq 0x7c332
movq %rax, %rdi
xorl %ecx, %ecx
testl %r13d, %r13d
setne %cl
movq %r15, %rsi
movq %r12, %rdx
callq 0x80d53
jmp 0x7e649
cmpq %r15, %rax
jae 0x7e621
movq %r15, %rdi
xorl %esi, %esi
jmp 0x7e644
leaq 0x6126e(%rip), %rax     # 0xdf860
cmpq %r12, (%rax)
jae 0x7e638
xorl %edx, %edx
testl %r13d, %r13d
setne %dl
movq %r15, %rdi
movq %r12, %rsi
callq 0x8b6b5
jmp 0x7e649
xorl %ecx, %ecx
cmpl $0x100, %ebp            # imm = 0x100
setb %cl
movq %r15, %rsi
movl $0x1, %edx
jmp 0x7e631
xorl %ecx, %ecx
cmpl $0x100, %ebp            # imm = 0x100
setb %cl
movq %r15, %rsi
xorl %edx, %edx
callq 0x7f908
jmp 0x7e649
xorl %esi, %esi
testl %r13d, %r13d
setne %sil
movq %r15, %rdi
callq 0x8b6a4
testq %rax, %rax
je 0x7e6c7
testq %r14, %r14
je 0x7e656
movq %r15, (%r14)
movq %rax, (%rbx)
addq %r15, %fs:-0x28
xorl %ecx, %ecx
cmpb $0x1, 0x604ff(%rip)     # 0xdeb6a
jne 0x7e6d3
movq $0x1301, 0x10(%rsp)     # imm = 0x1301
movq %rax, 0x18(%rsp)
movq %r15, 0x20(%rsp)
leaq 0x611f9(%rip), %rcx     # 0xdf880
movq (%rcx), %rcx
notq %rcx
andq %rax, %rcx
movq %rax, %rdx
subq %rcx, %rdx
je 0x7e6e4
shrq $0xc, %rdx
leaq 0x61285(%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 0x7e6ee
andq $-0x1000, %rax          # imm = 0xF000
jmp 0x7e6fd
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 0x8bc15
jmp 0x7e6fd
imulq $0x68, %rcx, %rax
leaq 0x60507(%rip), %rcx     # 0xdec00
movq (%rcx,%rax), %rax
xorl %ecx, %ecx
cmpq $0xe00, %rax            # imm = 0xE00
ja 0x7e72b
decq %rax
shrq $0x3, %rax
leaq 0x249ab(%rip), %rdx     # 0xa30c0
movzbl (%rdx,%rax), %eax
imulq $0x68, %rax, %rax
leaq 0x604dc(%rip), %rdx     # 0xdec00
movq 0x8(%rdx,%rax), %rdx
jmp 0x7e72d
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 0x7e6d3