// File: /workspace/github_c_makefile_star2_O3/zhou-yuxin[P]redis-aof-no-cow/deps/jemalloc/src/arena.c
// Function: je_arena_tcache_fill_small
void
arena_tcache_fill_small(tsdn_t *tsdn, arena_t *arena, tcache_bin_t *tbin,
    szind_t binind, uint64_t prof_accumbytes)
{
	unsigned i, nfill;
	arena_bin_t *bin;

	assert(tbin->ncached == 0);

	if (config_prof && arena_prof_accum(tsdn, arena, prof_accumbytes))
		prof_idump(tsdn);
	bin = &arena->bins[binind];
	malloc_mutex_lock(tsdn, &bin->lock);
	for (i = 0, nfill = (tcache_bin_info[binind].ncached_max >>
	    tbin->lg_fill_div); i < nfill; i++) {
		arena_run_t *run;
		void *ptr;
		if ((run = bin->runcur) != NULL && run->nfree > 0)
			ptr = arena_run_reg_alloc(run, &arena_bin_info[binind]);
		else
			ptr = arena_bin_malloc_hard(tsdn, arena, bin);
		if (ptr == NULL) {
			/*
			 * OOM.  tbin->avail isn't yet filled down to its first
			 * element, so the successful allocations (if any) must
			 * be moved just before tbin->avail before bailing out.
			 */
			if (i > 0) {
				memmove(tbin->avail - i, tbin->avail - nfill,
				    i * sizeof(void *));
			}
			break;
		}
		if (config_fill && unlikely(opt_junk_alloc)) {
			arena_alloc_junk_small(ptr, &arena_bin_info[binind],
			    true);
		}
		/* Insert such that low regions get used first. */
		*(tbin->avail - nfill + i) = ptr;
	}
	if (config_stats) {
		bin->stats.nmalloc += i;
		bin->stats.nrequests += tbin->tstats.nrequests;
		bin->stats.curregs += i;
		bin->stats.nfills++;
		tbin->tstats.nrequests = 0;
	}
	malloc_mutex_unlock(tsdn, &bin->lock);
	tbin->ncached = i;
	arena_decay_tick(tsdn, arena);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r15
movq %rdi, %r14
movl %ecx, %ebx
imulq $0xa8, %rbx, %rax
movq %rsi, 0x18(%rsp)
leaq (%rsi,%rax), %r12
addq $0x980, %r12            # imm = 0x980
movq %r12, %rdi
callq 0xb5a0
leaq 0x40bd8(%rip), %rax     # 0x4d478
movq (%rax), %rax
movl (%rax,%rbx,4), %eax
movb 0xc(%r15), %cl
shrl %cl, %eax
testl %eax, %eax
je 0xca0a
movq %r14, 0x8(%rsp)
shlq $0x6, %rbx
leaq 0x3fd1c(%rip), %rcx     # 0x4c5e0
addq %rbx, %rcx
movq %rcx, 0x10(%rsp)
movl %eax, 0x24(%rsp)
movl %eax, %r14d
movq %r14, %rax
negq %rax
xorl %ebx, %ebx
movq %rax, 0x30(%rsp)
leaq (,%rax,8), %rbp
movq 0x50(%r12), %rsi
testq %rsi, %rsi
je 0xc906
movl 0x4(%rsi), %edi
testl %edi, %edi
je 0xc906
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0xc920
xorl %edx, %edx
jmp 0xc938
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %r12, %rdx
callq 0x23006
movq %rax, %r13
jmp 0xc9a6
xorl %ecx, %ecx
pushq $0x1
popq %rdx
movl %edx, %eax
movq 0x8(%rsi,%rax,8), %rax
addl $0x40, %ecx
incl %edx
testq %rax, %rax
je 0xc925
movl %ecx, %edx
bsfq %rax, %rcx
leaq (%rcx,%rdx), %r8
pushq $0x1
popq %rax
shlq %cl, %rax
shrl $0x3, %edx
xorq %rax, 0x8(%rsi,%rdx)
leaq -0x18(%rsi), %rax
leaq 0x40777(%rip), %rcx     # 0x4d0d0
movq (%rcx), %rcx
notq %rcx
andq %rax, %rcx
movq 0x4065f(%rip), %rax     # 0x4cfc8
addq %rcx, %rax
negq %rax
addq %rsi, %rax
addq $-0x18, %rax
xorl %edx, %edx
pushq $0x60
popq %r9
divq %r9
addq 0x4063a(%rip), %rax     # 0x4cfc0
shlq $0xc, %rax
movq 0x10(%rsp), %rdx
movl 0x38(%rdx), %r13d
imulq 0x10(%rdx), %r8
addq %rcx, %r13
addq %r8, %r13
addq %rax, %r13
decl %edi
movl %edi, 0x4(%rsi)
testq %r13, %r13
je 0xca0e
leaq 0x3fb6f(%rip), %rax     # 0x4c521
cmpb $0x1, (%rax)
je 0xc9d0
movq 0x18(%r15), %rax
addq %rbp, %rax
movq %r13, (%rax,%rbx,8)
incq %rbx
cmpq %r14, %rbx
jne 0xc8e8
jmp 0xca30
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdx
movq %rdx, 0x28(%rsp)
movq %r13, %rdi
subq %rdx, %rdi
movl $0xa5, %esi
callq 0xb230
movq 0x10(%rsp), %rax
movq (%rax), %rdi
addq %r13, %rdi
movl $0xa5, %esi
movq 0x28(%rsp), %rdx
callq 0xb230
jmp 0xc9b7
xorl %ebx, %ebx
jmp 0xca42
testq %rbx, %rbx
je 0xca3b
movq 0x18(%r15), %rdi
movl %ebx, %edx
shlq $0x3, %rdx
movq 0x30(%rsp), %rax
leaq (%rdi,%rax,8), %rsi
subq %rdx, %rdi
callq 0xb450
jmp 0xca3d
movq 0x8(%rsp), %r14
movl 0x24(%rsp), %ebx
jmp 0xca42
xorl %ebx, %ebx
movq 0x8(%rsp), %r14
movl %ebx, %eax
movq %rax, %xmm0
addq %rax, 0x60(%r12)
movq (%r15), %rax
addq %rax, 0x70(%r12)
movdqu 0x78(%r12), %xmm1
shufpd $0x2, 0x2c5ba(%rip), %xmm0 # xmm0 = xmm0[0],mem[1]
paddq %xmm1, %xmm0
movdqu %xmm0, 0x78(%r12)
andq $0x0, (%r15)
movq %r12, %rdi
callq 0xb380
movl %ebx, 0x10(%r15)
testq %r14, %r14
je 0xcaaf
movq 0x18(%rsp), %rax
movl (%rax), %esi
movq 0x38(%r14), %rax
testq %rax, %rax
je 0xcabe
cmpl %esi, 0x40(%r14)
jbe 0xcabe
leaq (%rax,%rsi,8), %rax
testq %rax, %rax
je 0xcaaf
movl (%rax), %ecx
testl %ecx, %ecx
jle 0xcac8
decl %ecx
movl %ecx, (%rax)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x1ade7
jmp 0xcaa0
movl 0x4(%rax), %ecx
movl %ecx, (%rax)
movq %r14, %rdi
movq 0x18(%rsp), %rsi
xorl %edx, %edx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x225b4