// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/deps/jemalloc/src/jemalloc.c
// Function: je_arena_choose_hard
arena_t *
arena_choose_hard(tsd_t *tsd)
{
	arena_t *ret;

	if (narenas_auto > 1) {
		unsigned i, choose, first_null;

		choose = 0;
		first_null = narenas_auto;
		malloc_mutex_lock(&arenas_lock);
		assert(a0get() != NULL);
		for (i = 1; i < narenas_auto; i++) {
			if (arenas[i] != NULL) {
				/*
				 * Choose the first arena that has the lowest
				 * number of threads assigned to it.
				 */
				if (arenas[i]->nthreads <
				    arenas[choose]->nthreads)
					choose = i;
			} else if (first_null == narenas_auto) {
				/*
				 * Record the index of the first uninitialized
				 * arena, in case all extant arenas are in use.
				 *
				 * NB: It is possible for there to be
				 * discontinuities in terms of initialized
				 * versus uninitialized arenas, due to the
				 * "thread.arena" mallctl.
				 */
				first_null = i;
			}
		}

		if (arenas[choose]->nthreads == 0
		    || first_null == narenas_auto) {
			/*
			 * Use an unloaded arena, or the least loaded arena if
			 * all arenas are already initialized.
			 */
			ret = arenas[choose];
		} else {
			/* Initialize a new arena. */
			choose = first_null;
			ret = arena_init_locked(choose);
			if (ret == NULL) {
				malloc_mutex_unlock(&arenas_lock);
				return (NULL);
			}
		}
		arena_bind_locked(tsd, choose);
		malloc_mutex_unlock(&arenas_lock);
	} else {
		ret = a0get();
		arena_bind(tsd, 0);
	}

	return (ret);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
cmpl $0x1, 0x7b34d(%rip)     # 0xa1700
jbe 0x264c4
movl $0x0, -0x20(%rbp)
movl 0x7b33a(%rip), %eax     # 0xa1700
movl %eax, -0x24(%rbp)
leaq 0x7b2f8(%rip), %rdi     # 0xa16c8
callq 0x25e30
jmp 0x263d7
movl $0x1, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl 0x7b319(%rip), %eax     # 0xa1700
jae 0x26446
movq 0x7b308(%rip), %rax     # 0xa16f8
movl -0x1c(%rbp), %ecx
cmpq $0x0, (%rax,%rcx,8)
je 0x26426
movq 0x7b2f7(%rip), %rax     # 0xa16f8
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl 0x4(%rax), %eax
movq 0x7b2e6(%rip), %rcx     # 0xa16f8
movl -0x20(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
cmpl 0x4(%rcx), %eax
jae 0x26424
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
jmp 0x26439
movl -0x24(%rbp), %eax
cmpl 0x7b2d1(%rip), %eax     # 0xa1700
jne 0x26437
movl -0x1c(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0x26439
jmp 0x2643b
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x263de
movq 0x7b2ab(%rip), %rax     # 0xa16f8
movl -0x20(%rbp), %ecx
movq (%rax,%rcx,8), %rax
cmpl $0x0, 0x4(%rax)
je 0x26465
movl -0x24(%rbp), %eax
cmpl 0x7b29d(%rip), %eax     # 0xa1700
jne 0x26479
movq 0x7b28c(%rip), %rax     # 0xa16f8
movl -0x20(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
jmp 0x264aa
movl -0x24(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %edi
callq 0x25e50
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x264a8
leaq 0x7b22f(%rip), %rdi     # 0xa16c8
callq 0x25f70
movq $0x0, -0x8(%rbp)
jmp 0x264e0
jmp 0x264aa
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %esi
callq 0x264f0
leaq 0x7b20b(%rip), %rdi     # 0xa16c8
callq 0x25f70
jmp 0x264d8
callq 0x246a0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x26550
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)