// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/deps/jemalloc/src/arena.c
// Function: arena_tcache_fill_small
void
arena_tcache_fill_small(arena_t *arena, tcache_bin_t *tbin, size_t binind,
    uint64_t prof_accumbytes)
{
	unsigned i, nfill;
	arena_bin_t *bin;
	arena_run_t *run;
	void *ptr;

	assert(tbin->ncached == 0);

	if (config_prof) {
		malloc_mutex_lock(&arena->lock);
		arena_prof_accum(arena, prof_accumbytes);
		malloc_mutex_unlock(&arena->lock);
	}
	bin = &arena->bins[binind];
	malloc_mutex_lock(&bin->lock);
	for (i = 0, nfill = (tcache_bin_info[binind].ncached_max >>
	    tbin->lg_fill_div); i < nfill; i++) {
		if ((run = bin->runcur) != NULL && run->nfree > 0)
			ptr = arena_run_reg_alloc(run, &arena_bin_info[binind]);
		else
			ptr = arena_bin_malloc_hard(arena, bin);
		if (ptr == NULL)
			break;
		if (config_fill && opt_junk) {
			arena_alloc_junk_small(ptr, &arena_bin_info[binind],
			    true);
		}
		/* Insert such that low regions get used first. */
		tbin->avail[nfill - 1 - i] = ptr;
	}
	if (config_stats) {
		bin->stats.allocated += i * arena_bin_info[binind].reg_size;
		bin->stats.nmalloc += i;
		bin->stats.nrequests += tbin->tstats.nrequests;
		bin->stats.nfills++;
		tbin->tstats.nrequests = 0;
	}
	malloc_mutex_unlock(&bin->lock);
	tbin->ncached = i;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r14
movq %rsi, %rbx
imulq $0x98, %rdx, %rax
movq %rdi, 0x28(%rsp)
leaq (%rdi,%rax), %rbp
addq $0x120, %rbp            # imm = 0x120
movq %rbp, %rdi
callq 0x1faa0
leaq 0x70660(%rip), %rax     # 0xf0b90
movq (%rax), %rax
movl (%rax,%r14,4), %edx
movq %rbx, 0x20(%rsp)
movb 0xc(%rbx), %cl
shrl %cl, %edx
testl %edx, %edx
je 0x806f9
movq %r14, 0x10(%rsp)
imulq $0x68, %r14, %rax
leaq 0x5e6a7(%rip), %rcx     # 0xdec00
leaq (%rcx,%rax), %rbx
movl %edx, 0x8(%rsp)
movl %edx, %edx
movq %rdx, 0x30(%rsp)
leaq (%rax,%rcx), %r12
addq $0x40, %r12
xorl %r15d, %r15d
movq $-0x1, %r14
movq %rbp, 0x18(%rsp)
movq 0x28(%rbp), %rdx
testq %rdx, %rdx
je 0x80677
movl 0xc(%rdx), %eax
testl %eax, %eax
je 0x80677
movl %eax, 0xc(%rsp)
movl 0x24(%rbx), %edi
movl 0x30(%rbx), %r8d
addq %rdx, %rdi
leal -0x1(%r8), %ecx
movq 0x38(%rbx,%rcx,8), %rax
movq (%rdi,%rax,8), %rax
bsfq %rax, %rax
cmoveq %r14, %rax
testl %ecx, %ecx
je 0x805df
movq 0x30(%rbx,%rcx,8), %r9
leaq (%rdi,%r9,8), %r9
movq (%r9,%rax,8), %r9
shlq $0x6, %rax
bsfq %r9, %r9
cmoveq %r14, %r9
addq %r9, %rax
decq %rcx
jne 0x805be
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 0x80649
cmpq %r11, %r10
jne 0x80649
addq $-0x2, %r8
xorl %r10d, %r10d
movq %r9, %rcx
shrq $0x6, %r9
movq (%r12,%r10,8), %r11
leaq (%rdi,%r11,8), %r11
movq (%r11,%r9,8), %rsi
movl $0x1, %ebp
shlq %cl, %rbp
movq %rsi, %r13
btcq %rcx, %r13
movq %r13, (%r11,%r9,8)
cmpq %rbp, %rsi
jne 0x80649
leaq 0x1(%r10), %rcx
cmpq %r10, %r8
movq %rcx, %r10
jne 0x80612
movl 0x64(%rbx), %ecx
movq 0x10(%rbx), %r13
movl 0xc(%rsp), %esi
decl %esi
movl %esi, 0xc(%rdx)
cmpl %eax, 0x8(%rdx)
jne 0x80664
leal 0x1(%rax), %esi
movl %esi, 0x8(%rdx)
addq %rdx, %rcx
movl %eax, %eax
imulq %rax, %r13
addq %rcx, %r13
movq 0x18(%rsp), %rbp
jmp 0x80687
movq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x80759
movq %rax, %r13
testq %r13, %r13
je 0x806f2
leaq 0x5e4c8(%rip), %rax     # 0xdeb5b
cmpb $0x1, (%rax)
jne 0x806c7
movq 0x8(%rbx), %rbp
movq %r13, %rdi
subq %rbp, %rdi
movl $0xa5, %esi
movq %rbp, %rdx
callq 0x1f110
movq (%rbx), %rdi
addq %r13, %rdi
movl $0xa5, %esi
movq %rbp, %rdx
movq 0x18(%rsp), %rbp
callq 0x1f110
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movl %r15d, %ecx
notl %ecx
addl 0x8(%rsp), %ecx
movq %r13, (%rax,%rcx,8)
incq %r15
cmpq 0x30(%rsp), %r15
jne 0x8057f
movl 0x8(%rsp), %eax
movl %eax, %r15d
movq 0x10(%rsp), %r14
jmp 0x806fc
xorl %r15d, %r15d
movl %r15d, %eax
imulq $0x68, %r14, %rcx
leaq 0x5e4f6(%rip), %rdx     # 0xdec00
movq (%rcx,%rdx), %rcx
imulq %rax, %rcx
addq %rcx, 0x50(%rbp)
addq %rax, 0x58(%rbp)
movaps 0x138ff(%rip), %xmm0    # 0x94020
movq 0x20(%rsp), %rbx
movlps (%rbx), %xmm0           # xmm0 = mem[0,1],xmm0[2,3]
movdqu 0x68(%rbp), %xmm1
paddq %xmm1, %xmm0
movdqu %xmm0, 0x68(%rbp)
movq $0x0, (%rbx)
movq %rbp, %rdi
callq 0x1fbb0
movl %r15d, 0x10(%rbx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq