// File: /workspace/github_c_makefile_star2_O1/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 0x2273c(%rip), %rax     # 0xa30c0
movzbl (%rsi,%rax), %eax
imulq $0x98, %rax, %rcx
leaq (%rdi,%rcx), %r14
addq $0x120, %r14            # imm = 0x120
imulq $0x68, %rax, %r13
leaq 0x5e25b(%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 0x80ac6
movl 0xc(%rdx), %esi
testl %esi, %esi
je 0x80ac6
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 0x80a23
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 0x80a02
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 0x80a98
cmpq %r11, %r10
jne 0x80a98
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 0x80a98
leaq 0x1(%r11), %rcx
cmpq %r11, %r8
movq %rcx, %r11
jne 0x80a61
movl 0x64(%r12), %ecx
movq 0x10(%r12), %r15
decl %esi
movl %esi, 0xc(%rdx)
movl 0x8(%rdx), %esi
cmpl %eax, %esi
jne 0x80ab3
incl %esi
movl %esi, 0x8(%rdx)
addq %rdx, %rcx
movl %eax, %eax
imulq %rax, %r15
addq %rcx, %r15
movq 0x10(%rsp), %rbx
jmp 0x80ad4
movq %r15, %rdi
movq %r14, %rsi
callq 0x80470
movq %rax, %r15
testq %r15, %r15
je 0x80b80
addq %rbx, 0x50(%r14)
incq 0x58(%r14)
incq 0x68(%r14)
movq %r14, %rdi
callq 0x1fbb0
leaq 0x5e063(%rip), %rax     # 0xdeb5b
movb (%rax), %al
cmpb $0x0, 0xc(%rsp)
je 0x80b8d
testb %al, %al
je 0x80b35
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 0x80ba3
movq %r14, %rdi
callq 0x1fbb0
xorl %r15d, %r15d
jmp 0x80ba8
testb %al, %al
je 0x80bba
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 0x5dfab(%rip), %rax     # 0xdeb6c
cmpb $0x1, (%rax)
jne 0x80ba8
movq %r15, %rdi
xorl %esi, %esi
movq %rbx, %rdx
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1f110