// File: /workspace/github_c_makefile_star2_O2/zhou-yuxin[P]redis-aof-no-cow/deps/jemalloc/src/arena.c
// Function: arena_bin_malloc_hard
static void *
arena_bin_malloc_hard(tsdn_t *tsdn, arena_t *arena, arena_bin_t *bin)
{
	szind_t binind;
	arena_bin_info_t *bin_info;
	arena_run_t *run;

	binind = arena_bin_index(arena, bin);
	bin_info = &arena_bin_info[binind];
	bin->runcur = NULL;
	run = arena_bin_nonfull_run_get(tsdn, arena, bin);
	if (bin->runcur != NULL && bin->runcur->nfree > 0) {
		/*
		 * Another thread updated runcur while this one ran without the
		 * bin lock in arena_bin_nonfull_run_get().
		 */
		void *ret;
		assert(bin->runcur->nfree > 0);
		ret = arena_run_reg_alloc(bin->runcur, bin_info);
		if (run != NULL) {
			arena_chunk_t *chunk;

			/*
			 * arena_run_alloc_small() may have allocated run, or
			 * it may have pulled run from the bin's run tree.
			 * Therefore it is unsafe to make any assumptions about
			 * how run has previously been used, and
			 * arena_bin_lower_run() must be called, as if a region
			 * were just deallocated from the run.
			 */
			chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run);
			if (run->nfree == bin_info->nregs) {
				arena_dalloc_bin_run(tsdn, arena, chunk, run,
				    bin);
			} else
				arena_bin_lower_run(arena, run, bin);
		}
		return (ret);
	}

	if (run == NULL)
		return (NULL);

	bin->runcur = run;

	assert(bin->runcur->nfree > 0);

	return (arena_run_reg_alloc(bin->runcur, bin_info));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, 0x10(%rsp)
movq %rdx, %rax
subq %rsi, %rax
addq $-0x980, %rax           # imm = 0xF680
movl $0xa8, %ecx
cqto
idivq %rcx
movq %rax, %rbp
movl %ebp, %eax
shlq $0x6, %rax
leaq 0x2cefe(%rip), %r12     # 0x485e0
addq %rax, %r12
andq $0x0, 0x50(%rbx)
movq %rbx, %rdi
callq 0x202b1
movq %rax, %r13
testq %rax, %rax
jne 0x1b769
movq %rbx, %rdi
callq 0xb380
leaq 0x10(%r14), %rdi
movq %rdi, 0x8(%rsp)
callq 0xb5a0
movq 0x18(%r12), %r15
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x20664
testq %rax, %rax
je 0x1b7d3
movq %rax, %r13
movl %ebp, (%r13)
movl 0x20(%r12), %eax
movl %eax, 0x4(%r13)
leaq 0x8(%r13), %rdi
leaq 0x28(%r12), %rsi
callq 0x2108c
movq 0x8(%rsp), %rdi
callq 0xb380
movq %rbx, %rdi
callq 0xb5a0
incq 0x90(%rbx)
incq 0xa0(%rbx)
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0x1b7ac
cmpl $0x0, 0x4(%rdi)
je 0x1b7ac
movq %r12, %rsi
callq 0x1b618
movq %rax, %r15
testq %r13, %r13
je 0x1b819
movl 0x4(%r13), %eax
cmpl 0x20(%r12), %eax
jne 0x1b80e
movq 0x10(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x201f8
jmp 0x1b819
testq %r13, %r13
je 0x1b7ce
movq %r13, 0x50(%rbx)
movq %r13, %rdi
movq %r12, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1b618
xorl %r15d, %r15d
jmp 0x1b819
movq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x1ee18
testq %rax, %rax
je 0x1b82b
movq 0x2d7dc(%rip), %rcx     # 0x48fc8
leaq (%rcx,%rax), %r13
addq $0x18, %r13
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rdx
movl %ebp, %ecx
callq 0x206ab
testb %al, %al
je 0x1b72e
jmp 0x1b841
movq %r13, %rdi
movq %rbx, %rsi
callq 0x20259
movq %r15, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x20664
testq %rax, %rax
jne 0x1b72b
movq 0x8(%rsp), %rdi
callq 0xb380
movq %rbx, %rdi
callq 0xb5a0
movq %rbx, %rdi
callq 0x202b1
movq %rax, %r13
jmp 0x1b769