// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/deps/jemalloc/src/arena.c
// Function: bin_info_run_size_calc
static void
bin_info_run_size_calc(arena_bin_info_t *bin_info)
{
	size_t pad_size;
	size_t try_run_size, perfect_run_size, actual_run_size;
	uint32_t try_nregs, perfect_nregs, actual_nregs;

	/*
	 * Determine redzone size based on minimum alignment and minimum
	 * redzone size.  Add padding to the end of the run if it is needed to
	 * align the regions.  The padding allows each redzone to be half the
	 * minimum alignment; without the padding, each redzone would have to
	 * be twice as large in order to maintain alignment.
	 */
	if (config_fill && unlikely(opt_redzone)) {
		size_t align_min = ZU(1) << (jemalloc_ffs(bin_info->reg_size) -
		    1);
		if (align_min <= REDZONE_MINSIZE) {
			bin_info->redzone_size = REDZONE_MINSIZE;
			pad_size = 0;
		} else {
			bin_info->redzone_size = align_min >> 1;
			pad_size = bin_info->redzone_size;
		}
	} else {
		bin_info->redzone_size = 0;
		pad_size = 0;
	}
	bin_info->reg_interval = bin_info->reg_size +
	    (bin_info->redzone_size << 1);

	/*
	 * Compute run size under ideal conditions (no redzones, no limit on run
	 * size).
	 */
	try_run_size = PAGE;
	try_nregs = try_run_size / bin_info->reg_size;
	do {
		perfect_run_size = try_run_size;
		perfect_nregs = try_nregs;

		try_run_size += PAGE;
		try_nregs = try_run_size / bin_info->reg_size;
	} while (perfect_run_size != perfect_nregs * bin_info->reg_size);
	assert(perfect_nregs <= RUN_MAXREGS);

	actual_run_size = perfect_run_size;
	actual_nregs = (actual_run_size - pad_size) / bin_info->reg_interval;

	/*
	 * Redzones can require enough padding that not even a single region can
	 * fit within the number of pages that would normally be dedicated to a
	 * run for this size class.  Increase the run size until at least one
	 * region fits.
	 */
	while (actual_nregs == 0) {
		assert(config_fill && unlikely(opt_redzone));

		actual_run_size += PAGE;
		actual_nregs = (actual_run_size - pad_size) /
		    bin_info->reg_interval;
	}

	/*
	 * Make sure that the run will fit within an arena chunk.
	 */
	while (actual_run_size > arena_maxrun) {
		actual_run_size -= PAGE;
		actual_nregs = (actual_run_size - pad_size) /
		    bin_info->reg_interval;
	}
	assert(actual_nregs > 0);
	assert(actual_run_size == s2u(actual_run_size));

	/* Copy final settings. */
	bin_info->run_size = actual_run_size;
	bin_info->nregs = actual_nregs;
	bin_info->reg0_offset = actual_run_size - (actual_nregs *
	    bin_info->reg_interval) - pad_size + bin_info->redzone_size;

	if (actual_run_size > small_maxrun)
		small_maxrun = actual_run_size;

	assert(bin_info->reg0_offset - bin_info->redzone_size + (bin_info->nregs
	    * bin_info->reg_interval) + pad_size == bin_info->run_size);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
leaq 0x52581(%rip), %rax     # 0xa16b0
movb (%rax), %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x4f1ab
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %edx
tzcntl %edx, %eax
addl $0x1, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovel %ecx, %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, -0x48(%rbp)
cmpq $0x10, -0x48(%rbp)
ja 0x4f18e
movq -0x10(%rbp), %rax
movq $0x10, 0x8(%rax)
movq $0x0, -0x18(%rbp)
jmp 0x4f1a9
movq -0x48(%rbp), %rcx
shrq %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x4f1bf
movq -0x10(%rbp), %rax
movq $0x0, 0x8(%rax)
movq $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
addq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq $0x1000, -0x20(%rbp)    # imm = 0x1000
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
xorl %edx, %edx
divq (%rcx)
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x20(%rbp), %rax
addq $0x1000, %rax           # imm = 0x1000
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
xorl %edx, %edx
divq (%rcx)
movl %eax, -0x34(%rbp)
movq -0x28(%rbp), %rax
movl -0x38(%rbp), %ecx
movq -0x10(%rbp), %rdx
imulq (%rdx), %rcx
cmpq %rcx, %rax
jne 0x4f1f4
jmp 0x4f236
jmp 0x4f238
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
subq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
xorl %edx, %edx
divq 0x10(%rcx)
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jne 0x4f284
jmp 0x4f25d
jmp 0x4f25f
movq -0x30(%rbp), %rax
addq $0x1000, %rax           # imm = 0x1000
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
subq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
xorl %edx, %edx
divq 0x10(%rcx)
movl %eax, -0x3c(%rbp)
jmp 0x4f255
jmp 0x4f286
movq -0x30(%rbp), %rax
cmpq 0x53357(%rip), %rax     # 0xa25e8
jbe 0x4f2b8
movq -0x30(%rbp), %rax
subq $0x1000, %rax           # imm = 0x1000
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
subq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
xorl %edx, %edx
divq 0x10(%rcx)
movl %eax, -0x3c(%rbp)
jmp 0x4f286
jmp 0x4f2ba
jmp 0x4f2bc
jmp 0x4f2be
jmp 0x4f2c0
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x3c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x30(%rbp), %rax
movl -0x3c(%rbp), %ecx
movq -0x10(%rbp), %rdx
imulq 0x10(%rdx), %rcx
subq %rcx, %rax
subq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
addq 0x8(%rcx), %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x58(%rax)
movq -0x30(%rbp), %rax
cmpq 0x532e7(%rip), %rax     # 0xa25f0
jbe 0x4f316
movq -0x30(%rbp), %rax
movq %rax, 0x532da(%rip)     # 0xa25f0
jmp 0x4f318
jmp 0x4f31a
popq %rbp
retq
nopl (%rax)