// File: /workspace/github_c_makefile_star2_O1/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, %r15
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 0x70946(%rip), %rax     # 0xf0b90
movq (%rax), %rax
movl (%rax,%r15,4), %edx
movq %rbx, 0x20(%rsp)
movb 0xc(%rbx), %cl
shrl %cl, %edx
testl %edx, %edx
je 0x80413
movq %r15, 0x10(%rsp)
imulq $0x68, %r15, %rax
leaq 0x5e98d(%rip), %rcx     # 0xdec00
leaq (%rcx,%rax), %r12
movl %edx, 0x8(%rsp)
movl %edx, %edx
movq %rdx, 0x30(%rsp)
leaq (%rax,%rcx), %r15
addq $0x40, %r15
xorl %ebx, %ebx
movq $-0x1, %r14
movq %rbp, 0x18(%rsp)
movq 0x28(%rbp), %rdx
testq %rdx, %rdx
je 0x80397
movl 0xc(%rdx), %eax
testl %eax, %eax
je 0x80397
movl %eax, 0xc(%rsp)
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
cmoveq %r14, %rax
testl %ecx, %ecx
je 0x802fb
movq 0x30(%r12,%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 0x802da
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 0x80365
cmpq %r11, %r10
jne 0x80365
addq $-0x2, %r8
xorl %r10d, %r10d
movq %r9, %rcx
shrq $0x6, %r9
movq (%r15,%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 0x80365
leaq 0x1(%r10), %rcx
cmpq %r10, %r8
movq %rcx, %r10
jne 0x8032e
movl 0x64(%r12), %ecx
movq 0x10(%r12), %r13
movl 0xc(%rsp), %esi
decl %esi
movl %esi, 0xc(%rdx)
movl 0x8(%rdx), %esi
cmpl %eax, %esi
jne 0x80384
incl %esi
movl %esi, 0x8(%rdx)
addq %rdx, %rcx
movl %eax, %eax
imulq %rax, %r13
addq %rcx, %r13
movq 0x18(%rsp), %rbp
jmp 0x803a7
movq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x80470
movq %rax, %r13
testq %r13, %r13
je 0x80418
leaq 0x5e7a8(%rip), %rax     # 0xdeb5b
cmpb $0x1, (%rax)
jne 0x803e9
movq 0x8(%r12), %rbp
movq %r13, %rdi
subq %rbp, %rdi
movl $0xa5, %esi
movq %rbp, %rdx
callq 0x1f110
movq (%r12), %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 %ebx, %ecx
notl %ecx
addl 0x8(%rsp), %ecx
movq %r13, (%rax,%rcx,8)
incq %rbx
cmpq 0x30(%rsp), %rbx
jne 0x80298
movl 0x8(%rsp), %r14d
jmp 0x8041b
xorl %r14d, %r14d
jmp 0x80420
movl %ebx, %r14d
movq 0x10(%rsp), %r15
movl %r14d, %eax
imulq $0x68, %r15, %rcx
leaq 0x5e7d2(%rip), %rdx     # 0xdec00
movq (%rcx,%rdx), %rcx
imulq %rax, %rcx
addq %rcx, 0x50(%rbp)
addq %rax, 0x58(%rbp)
movq 0x20(%rsp), %rbx
movq (%rbx), %rax
addq %rax, 0x68(%rbp)
incq 0x70(%rbp)
movq $0x0, (%rbx)
movq %rbp, %rdi
callq 0x1fbb0
movl %r14d, 0x10(%rbx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq