// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl -0x24(%rbp), %eax
andl $0x3f, %eax
movl %eax, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
andq $-0x2, %rax
movq %rax, -0x40(%rbp)
movl -0x24(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x41(%rbp)
movl -0x24(%rbp), %eax
sarl $0x8, %eax
subl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0xb24f3
jmp 0xb24f5
jmp 0xb24f7
callq 0xb1590
testb $0x1, %al
jne 0xb2502
jmp 0xb2507
jmp 0xb266d
cmpl $-0x1, -0x48(%rbp)
je 0xb2525
movq 0x75fb4(%rip), %rax     # 0x1284c8
movl -0x48(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x50(%rbp)
movb $0x0, -0x51(%rbp)
jmp 0xb2531
movq $0x0, -0x50(%rbp)
movb $0x1, -0x51(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0xb254a
movq -0x20(%rbp), %rdi
callq 0xb15d0
movq %rax, -0xa8(%rbp)
jmp 0xb255e
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0xb2690
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0xb2575
jmp 0xb266d
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movb -0x41(%rbp), %cl
movb -0x51(%rbp), %al
movq -0x50(%rbp), %r8
andb $0x1, %cl
andb $0x1, %al
movzbl %cl, %edx
movzbl %al, %ecx
callq 0xb27f0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0xb25a7
jmp 0xb266d
cmpq $0x0, -0x18(%rbp)
je 0xb25b9
movq -0x38(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0xb25c6
movq -0x38(%rbp), %rax
movq %rax, -0xb0(%rbp)
callq 0xb16d0
movq -0xb0(%rbp), %rcx
addq (%rax), %rcx
movq %rcx, (%rax)
testb $0x1, 0x75ed0(%rip)     # 0x1284ba
je 0xb2662
jmp 0xb25ee
movq $0x1301, -0x90(%rbp) # imm = 0x1301
movq -0x30(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x30(%rbp), %rdi
callq 0xb16f0
movq %rax, -0x78(%rbp)
movb -0x41(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movq %rax, -0x70(%rbp)
movq $0x0, -0x68(%rbp)
leaq -0x90(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
rolq $0x3, %rdi
rolq $0xd, %rdi
rolq $0x3d, %rdi
rolq $0x33, %rdi
xchgq %rbx, %rbx
movq %rdx, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0xa0(%rbp)
jmp 0xb2662
jmp 0xb2664
movl $0x0, -0x4(%rbp)
jmp 0xb267f
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax,%rax)