// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/deps/jemalloc/src/arena.c
// Function: je_arena_new
arena_t *
arena_new(unsigned ind)
{
	arena_t *arena;
	unsigned i;
	arena_bin_t *bin;

	/*
	 * Allocate arena, arena->lstats, and arena->hstats contiguously, mainly
	 * because there is no way to clean up if base_alloc() OOMs.
	 */
	if (config_stats) {
		arena = (arena_t *)base_alloc(CACHELINE_CEILING(sizeof(arena_t))
		    + QUANTUM_CEILING(nlclasses * sizeof(malloc_large_stats_t) +
		    nhclasses) * sizeof(malloc_huge_stats_t));
	} else
		arena = (arena_t *)base_alloc(sizeof(arena_t));
	if (arena == NULL)
		return (NULL);

	arena->ind = ind;
	arena->nthreads = 0;
	if (malloc_mutex_init(&arena->lock))
		return (NULL);

	if (config_stats) {
		memset(&arena->stats, 0, sizeof(arena_stats_t));
		arena->stats.lstats = (malloc_large_stats_t *)((uintptr_t)arena
		    + CACHELINE_CEILING(sizeof(arena_t)));
		memset(arena->stats.lstats, 0, nlclasses *
		    sizeof(malloc_large_stats_t));
		arena->stats.hstats = (malloc_huge_stats_t *)((uintptr_t)arena
		    + CACHELINE_CEILING(sizeof(arena_t)) +
		    QUANTUM_CEILING(nlclasses * sizeof(malloc_large_stats_t)));
		memset(arena->stats.hstats, 0, nhclasses *
		    sizeof(malloc_huge_stats_t));
		if (config_tcache)
			ql_new(&arena->tcache_ql);
	}

	if (config_prof)
		arena->prof_accumbytes = 0;

	if (config_cache_oblivious) {
		/*
		 * A nondeterministic seed based on the address of arena reduces
		 * the likelihood of lockstep non-uniform cache index
		 * utilization among identical concurrent processes, but at the
		 * cost of test repeatability.  For debug builds, instead use a
		 * deterministic seed.
		 */
		arena->offset_state = config_debug ? ind :
		    (uint64_t)(uintptr_t)arena;
	}

	arena->dss_prec = chunk_dss_prec_get();

	arena->spare = NULL;

	arena->lg_dirty_mult = arena_lg_dirty_mult_default_get();
	arena->purging = false;
	arena->nactive = 0;
	arena->ndirty = 0;

	arena_avail_tree_new(&arena->runs_avail);
	qr_new(&arena->runs_dirty, rd_link);
	qr_new(&arena->chunks_cache, cc_link);

	ql_new(&arena->huge);
	if (malloc_mutex_init(&arena->huge_mtx))
		return (NULL);

	extent_tree_szad_new(&arena->chunks_szad_cached);
	extent_tree_ad_new(&arena->chunks_ad_cached);
	extent_tree_szad_new(&arena->chunks_szad_retained);
	extent_tree_ad_new(&arena->chunks_ad_retained);
	if (malloc_mutex_init(&arena->chunks_mtx))
		return (NULL);
	ql_new(&arena->node_cache);
	if (malloc_mutex_init(&arena->node_cache_mtx))
		return (NULL);

	arena->chunk_hooks = chunk_hooks_default;

	/* Initialize bins. */
	for (i = 0; i < NBINS; i++) {
		bin = &arena->bins[i];
		if (malloc_mutex_init(&bin->lock))
			return (NULL);
		bin->runcur = NULL;
		arena_run_tree_new(&bin->runs);
		if (config_stats)
			memset(&bin->stats, 0, sizeof(malloc_bin_stats_t));
	}

	return (arena);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebp
movl 0x309f0(%rip), %eax     # 0x5b550
shlq $0x5, %rax
movl 0x309ea(%rip), %ecx     # 0x5b554
addq %rcx, %rax
addq $0x7, %rax
movabsq $0x3ffffffff8, %rcx     # imm = 0x3FFFFFFFF8
andq %rax, %rcx
leaq (%rcx,%rcx,2), %rax
leaq 0x2680(,%rax,8), %rdi
callq 0x2dd78
testq %rax, %rax
je 0x2abad
movq %rax, %rbx
movl %ebp, (%rax)
movl $0x0, 0x4(%rax)
leaq 0x8(%rax), %rdi
callq 0x36e44
testb %al, %al
je 0x2abc2
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorps %xmm0, %xmm0
movups %xmm0, 0x80(%rbx)
movups %xmm0, 0x70(%rbx)
movups %xmm0, 0x60(%rbx)
movups %xmm0, 0x50(%rbx)
movups %xmm0, 0x40(%rbx)
movups %xmm0, 0x30(%rbx)
xorl %r14d, %r14d
movq %r14, 0x90(%rbx)
leaq 0x2680(%rbx), %rdi
movq %rdi, 0x98(%rbx)
movl 0x30952(%rip), %edx     # 0x5b550
shlq $0x5, %rdx
xorl %esi, %esi
callq 0x10270
movl 0x30941(%rip), %eax     # 0x5b550
shlq $0x5, %rax
leaq (%rax,%rbx), %rdi
addq $0x2680, %rdi           # imm = 0x2680
movq %rdi, 0xa0(%rbx)
movl 0x30929(%rip), %eax     # 0x5b554
shlq $0x3, %rax
leaq (%rax,%rax,2), %rdx
xorl %esi, %esi
callq 0x10270
movq %r14, 0xa8(%rbx)
movq %rbx, 0xb8(%rbx)
callq 0x2f1ec
movl %eax, 0xc0(%rbx)
movq %r14, 0xc8(%rbx)
xorl %eax, %eax
lock
xaddq %rax, 0x308e3(%rip)     # 0x5b548
movq %rax, 0xd0(%rbx)
movb $0x0, 0xd8(%rbx)
leaq 0xf8(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0xe0(%rbx)
movq %rax, 0xf0(%rbx)
movq %rax, 0xf8(%rbx)
andq $-0x2, %rax
movq %rax, 0x100(%rbx)
leaq 0x158(%rbx), %rax
movq %rax, 0x158(%rbx)
movq %rax, 0x160(%rbx)
leaq 0x168(%rbx), %rax
movq %rax, 0x1a0(%rbx)
movq %rax, 0x1a8(%rbx)
movq %r14, 0x1d0(%rbx)
leaq 0x1d8(%rbx), %rdi
callq 0x36e44
testb %al, %al
jne 0x2abb0
leaq 0x200(%rbx), %rdi
callq 0x34370
leaq 0x270(%rbx), %rdi
callq 0x355eb
leaq 0x2e0(%rbx), %rdi
callq 0x34370
leaq 0x350(%rbx), %rdi
callq 0x355eb
leaq 0x3c0(%rbx), %rdi
callq 0x36e44
testb %al, %al
jne 0x2abad
movq $0x0, 0x3e8(%rbx)
leaq 0x3f0(%rbx), %rdi
callq 0x36e44
testb %al, %al
jne 0x2abad
leaq 0x2b6f4(%rip), %rax     # 0x56440
movq 0x30(%rax), %rcx
movq %rcx, 0x448(%rbx)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x438(%rbx)
movups %xmm1, 0x428(%rbx)
movups %xmm0, 0x418(%rbx)
leaq 0x450(%rbx), %r15
movq %rbx, %r12
addq $0x488, %r12            # imm = 0x488
xorl %r14d, %r14d
movl $0xe0, %r13d
xorl %ebp, %ebp
movq %r15, %rdi
callq 0x36e44
testb %al, %al
jne 0x2abb0
movq %r14, 0x28(%r15)
leaq 0x38(%r15), %rax
movq %rax, 0x30(%r15)
movq %rax, 0x38(%r15)
leaq (%r12,%rbp), %rax
andq $-0x2, %rax
movq %rax, 0x40(%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x98(%r15)
movups %xmm0, 0xa8(%r15)
movups %xmm0, 0xb8(%r15)
movups %xmm0, 0xc8(%r15)
movq %r14, 0xd8(%r15)
addq %r13, %r15
addq %r13, %rbp
cmpq $0x2220, %rbp           # imm = 0x2220
jne 0x2ad93
movq %rbx, %r14
jmp 0x2abb0