// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/deps/jemalloc/src/arena.c
// Function: arena_malloc_small
void *
arena_malloc_small(arena_t *arena, size_t size, bool zero)
{
	void *ret;
	arena_bin_t *bin;
	arena_run_t *run;
	size_t binind;

	binind = SMALL_SIZE2BIN(size);
	assert(binind < NBINS);
	bin = &arena->bins[binind];
	size = arena_bin_info[binind].reg_size;

	malloc_mutex_lock(&bin->lock);
	if ((run = bin->runcur) != NULL && run->nfree > 0)
		ret = arena_run_reg_alloc(run, &arena_bin_info[binind]);
	else
		ret = arena_bin_malloc_hard(arena, bin);

	if (ret == NULL) {
		malloc_mutex_unlock(&bin->lock);
		return (NULL);
	}

	if (config_stats) {
		bin->stats.allocated += size;
		bin->stats.nmalloc++;
		bin->stats.nrequests++;
	}
	malloc_mutex_unlock(&bin->lock);
	if (config_prof && isthreaded == false) {
		malloc_mutex_lock(&arena->lock);
		arena_prof_accum(arena, size);
		malloc_mutex_unlock(&arena->lock);
	}

	if (zero == false) {
		if (config_fill) {
			if (opt_junk) {
				arena_alloc_junk_small(ret,
				    &arena_bin_info[binind], false);
			} else if (opt_zero)
				memset(ret, 0, size);
		}
	} else {
		if (config_fill && opt_junk) {
			arena_alloc_junk_small(ret, &arena_bin_info[binind],
			    true);
		}
		VALGRIND_MAKE_MEM_UNDEFINED(ret, size);
		memset(ret, 0, size);
	}

	return (ret);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %edx, 0xc(%rsp)
movq %rdi, %r15
decq %rsi
shrq $0x3, %rsi
leaq 0x22558(%rip), %rax     # 0xa31c0
movzbl (%rsi,%rax), %eax
imulq $0x98, %rax, %rcx
leaq (%rdi,%rcx), %r14
addq $0x120, %r14            # imm = 0x120
imulq $0x68, %rax, %r13
leaq 0x5df77(%rip), %rbp     # 0xdec00
movq %rbp, %r12
addq %r13, %r12
movq (%r13,%rbp), %rbx
movq %r14, %rdi
callq 0x1faa0
movq 0x28(%r14), %rdx
testq %rdx, %rdx
je 0x80da9
movl 0xc(%rdx), %esi
testl %esi, %esi
je 0x80da9
movl 0x24(%r12), %edi
movl 0x30(%r12), %r8d
addq %rdx, %rdi
leal -0x1(%r8), %ecx
movq 0x38(%r12,%rcx,8), %rax
movq (%rdi,%rax,8), %rax
bsfq %rax, %rax
movq $-0x1, %r9
cmoveq %r9, %rax
testl %ecx, %ecx
movq %rbx, 0x10(%rsp)
je 0x80d07
movq 0x30(%r12,%rcx,8), %r10
leaq (%rdi,%r10,8), %r10
movq (%r10,%rax,8), %r10
shlq $0x6, %rax
bsfq %r10, %r10
cmoveq %r9, %r10
addq %r10, %rax
decq %rcx
jne 0x80ce6
movq %rax, %r9
shrq $0x6, %r9
movq (%rdi,%r9,8), %r10
movl $0x1, %r11d
movl %eax, %ecx
shlq %cl, %r11
movq %r10, %rcx
btcq %rax, %rcx
movq %rcx, (%rdi,%r9,8)
cmpl $0x2, %r8d
jb 0x80d7c
cmpq %r11, %r10
jne 0x80d7c
addq $-0x2, %r8
leaq 0x40(,%rbp), %r10
addq %r13, %r10
xorl %r11d, %r11d
movq %r9, %rcx
shrq $0x6, %r9
movq (%r10,%r11,8), %r15
leaq (%rdi,%r15,8), %r15
movq (%r15,%r9,8), %rbx
movl $0x1, %ebp
shlq %cl, %rbp
movq %rbx, %r13
btcq %rcx, %r13
movq %r13, (%r15,%r9,8)
cmpq %rbp, %rbx
jne 0x80d7c
leaq 0x1(%r11), %rcx
cmpq %r11, %r8
movq %rcx, %r11
jne 0x80d45
movl 0x64(%r12), %ecx
movq 0x10(%r12), %r15
decl %esi
movl %esi, 0xc(%rdx)
cmpl %eax, 0x8(%rdx)
jne 0x80d96
leal 0x1(%rax), %esi
movl %esi, 0x8(%rdx)
addq %rdx, %rcx
movl %eax, %eax
imulq %rax, %r15
addq %rcx, %r15
movq 0x10(%rsp), %rbx
jmp 0x80db7
movq %r15, %rdi
movq %r14, %rsi
callq 0x80759
movq %rax, %r15
testq %r15, %r15
je 0x80e79
movdqu 0x50(%r14), %xmm0
movq %rbx, %xmm1
shufpd $0x2, 0x1324c(%rip), %xmm1 # xmm1 = xmm1[0],mem[1]
paddq %xmm0, %xmm1
movdqu %xmm1, 0x50(%r14)
incq 0x68(%r14)
movq %r14, %rdi
callq 0x1fbb0
leaq 0x5dd6a(%rip), %rax     # 0xdeb5b
movb (%rax), %al
cmpb $0x0, 0xc(%rsp)
je 0x80e83
testb %al, %al
je 0x80e2e
movq 0x8(%r12), %r14
movq %r15, %rdi
subq %r14, %rdi
movl $0xa5, %esi
movq %r14, %rdx
callq 0x1f110
movq (%r12), %rdi
addq %r15, %rdi
movl $0xa5, %esi
movq %r14, %rdx
callq 0x1f110
leaq 0x20(%rsp), %rax
movq $0x4d430001, (%rax)     # imm = 0x4D430001
movq %r15, 0x8(%rax)
movq %rbx, 0x10(%rax)
xorl %ecx, %ecx
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %rcx, 0x28(%rax)
xorl %edx, %edx
rolq $0x3, %rdi
rolq $0xd, %rdi
rolq $0x3d, %rdi
rolq $0x33, %rdi
xchgq %rbx, %rbx
movq %rdx, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq %r15, %rdi
xorl %esi, %esi
movq %rbx, %rdx
jmp 0x80e99
movq %r14, %rdi
callq 0x1fbb0
jmp 0x80e9e
testb %al, %al
je 0x80eb0
movq %r15, %rdi
subq 0x8(%r12), %rdi
movq 0x10(%r12), %rdx
movl $0xa5, %esi
callq 0x1f110
movq %r15, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5dcb5(%rip), %rax     # 0xdeb6c
cmpb $0x1, (%rax)
je 0x80e6f
jmp 0x80e9e