// File: /workspace/github_c_makefile_star2_O1/erikdubbelboer[P]discnt/deps/jemalloc/src/arena.c
// Function: je_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;
	szind_t binind;

	binind = size2index(size);
	assert(binind < NBINS);
	bin = &arena->bins[binind];
	size = index2size(binind);

	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.nmalloc++;
		bin->stats.nrequests++;
		bin->stats.curregs++;
	}
	malloc_mutex_unlock(&bin->lock);
	if (config_prof && !isthreaded && arena_prof_accum(arena, size))
		prof_idump();

	if (!zero) {
		if (config_fill) {
			if (unlikely(opt_junk_alloc)) {
				arena_alloc_junk_small(ret,
				    &arena_bin_info[binind], false);
			} else if (unlikely(opt_zero))
				memset(ret, 0, size);
		}
		JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(ret, size);
	} else {
		if (config_fill && unlikely(opt_junk_alloc)) {
			arena_alloc_junk_small(ret, &arena_bin_info[binind],
			    true);
		}
		JEMALLOC_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 $0x18, %rsp
movl %edx, %ebp
movq %rdi, %r12
cmpq $0x1000, %rsi           # imm = 0x1000
ja 0x3b3fa
decq %rsi
shrq $0x3, %rsi
leaq 0x1e634(%rip), %rax     # 0x59800
movzbl (%rax,%rsi), %eax
movl %eax, %r14d
imulq $0xe0, %r14, %rax
leaq (%r12,%rax), %r15
addq $0x450, %r15            # imm = 0x450
leaq 0x1de94(%rip), %rax     # 0x59080
movq (%rax,%r14,8), %rbx
movq %r15, %rdi
callq 0x12960
movq 0x28(%r15), %rdi
testq %rdi, %rdi
je 0x3b356
movl 0x4(%rdi), %eax
testl %eax, %eax
je 0x3b356
movl %eax, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
leaq (%r14,%r14,2), %r10
shlq $0x5, %r10
leaq 0x48588(%rip), %r11     # 0x837b0
leaq (%r11,%r10), %r9
leaq 0x8(%rdi), %rax
movl 0x30(%r10,%r11), %edx
leal -0x1(%rdx), %ecx
movq 0x38(%r9,%rcx,8), %rsi
movq 0x8(%rdi,%rsi,8), %rsi
bsfq %rsi, %rsi
movq $-0x1, %r12
cmoveq %r12, %rsi
testl %ecx, %ecx
movl %ebp, 0xc(%rsp)
je 0x3b27a
movq 0x30(%r9,%rcx,8), %rbx
leaq (%rax,%rbx,8), %rbx
movq (%rbx,%rsi,8), %rbx
shlq $0x6, %rsi
bsfq %rbx, %rbx
cmoveq %r12, %rbx
addq %rbx, %rsi
decq %rcx
jne 0x3b259
movq %rsi, %r12
shrq $0x6, %r12
movq (%rax,%r12,8), %r13
movl $0x1, %ebx
movl %esi, %ecx
shlq %cl, %rbx
movq %r13, %rcx
btcq %rsi, %rcx
movq %rcx, (%rax,%r12,8)
cmpl $0x2, %edx
jb 0x3b2e9
cmpq %rbx, %r13
jne 0x3b2e9
addq $-0x2, %rdx
addq %r11, %r10
addq $0x40, %r10
xorl %r11d, %r11d
movq %r12, %rcx
shrq $0x6, %r12
movq (%r10,%r11,8), %rbx
leaq (%rax,%rbx,8), %rbx
movq (%rbx,%r12,8), %r8
movl $0x1, %ebp
shlq %cl, %rbp
movq %r8, %r13
btcq %rcx, %r13
movq %r13, (%rbx,%r12,8)
cmpq %rbp, %r8
jne 0x3b2e9
leaq 0x1(%r11), %rcx
cmpq %r11, %rdx
movq %rcx, %r11
jne 0x3b2b2
leaq -0x10(%rdi), %rax
leaq 0x493ac(%rip), %rcx     # 0x846a0
movq (%rcx), %rcx
notq %rcx
andq %rax, %rcx
movq 0x4924c(%rip), %rax     # 0x84550
addq %rcx, %rax
negq %rax
addq %rdi, %rax
addq $-0x10, %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rdx
shrq $0x6, %rdx
addq 0x4921f(%rip), %rdx     # 0x84548
shlq $0xc, %rdx
movl 0x58(%r9), %eax
movl %esi, %r12d
imulq 0x10(%r9), %r12
addq %rax, %r12
addq %rcx, %r12
addq %rdx, %r12
movl 0x8(%rsp), %eax
decl %eax
movl %eax, 0x4(%rdi)
movq 0x10(%rsp), %rbx
movl 0xc(%rsp), %ebp
jmp 0x3b364
movq %r12, %rdi
movq %r15, %rsi
callq 0x3aba6
movq %rax, %r12
testq %r12, %r12
je 0x3b3bf
incq 0x98(%r15)
incq 0xa8(%r15)
incq 0xb0(%r15)
movq %r15, %rdi
callq 0x125c0
leaq 0x483a4(%rip), %rax     # 0x83731
movb (%rax), %al
testb %bpl, %bpl
je 0x3b3cc
testb %al, %al
jne 0x3b407
leaq 0x483f5(%rip), %rax     # 0x83794
cmpb $0x1, (%rax)
je 0x3b414
movq %r12, %rdi
xorl %esi, %esi
movq %rbx, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x12380
movq %r15, %rdi
callq 0x125c0
xorl %r12d, %r12d
jmp 0x3b3e8
testb %al, %al
jne 0x3b421
leaq 0x4836c(%rip), %rax     # 0x83743
cmpb $0x1, (%rax)
je 0x3b451
leaq 0x483b1(%rip), %rax     # 0x83794
cmpb $0x1, (%rax)
je 0x3b444
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %rdi
callq 0x3fb29
jmp 0x3b1d0
movq %r14, %rdi
movq %r12, %rsi
callq 0x14761
jmp 0x3b398
movq %r12, %rdi
movq %rbx, %rsi
callq 0x507e2
jmp 0x3b3a4
leaq (%r14,%r14,2), %rax
shlq $0x5, %rax
leaq 0x48380(%rip), %rcx     # 0x837b0
movq %r12, %rdi
subq 0x8(%rax,%rcx), %rdi
movq 0x10(%rax,%rcx), %rdx
movl $0xa5, %esi
jmp 0x3b459
movq %r12, %rdi
movq %rbx, %rsi
callq 0x507e2
jmp 0x3b3e8
movq %r12, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x12380
jmp 0x3b3dc