// File: /workspace/github_c_makefile_star2_O2/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 0x31bea(%rip), %eax     # 0x57550
shlq $0x5, %rax
movl 0x31be4(%rip), %ecx     # 0x57554
addq %rcx, %rax
addq $0x7, %rax
movabsq $0x3ffffffff8, %rcx     # imm = 0x3FFFFFFFF8
andq %rax, %rcx
imulq $0x18, %rcx, %rdi
addq $0x2680, %rdi           # imm = 0x2680
callq 0x287c8
testq %rax, %rax
je 0x259af
movq %rax, %rbx
movl %ebp, (%rax)
andl $0x0, 0x4(%rax)
leaq 0x8(%rax), %rdi
callq 0x312bc
testb %al, %al
je 0x259c4
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)
andq $0x0, 0x90(%rbx)
leaq 0x2680(%rbx), %rdi
movq %rdi, 0x98(%rbx)
movl 0x31b52(%rip), %edx     # 0x57550
shlq $0x5, %rdx
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x10270
movl 0x31b3e(%rip), %eax     # 0x57550
shlq $0x5, %rax
leaq (%rax,%rbx), %rdi
addq $0x2680, %rdi           # imm = 0x2680
movq %rdi, 0xa0(%rbx)
movl 0x31b26(%rip), %eax     # 0x57554
imulq $0x18, %rax, %rdx
xorl %esi, %esi
callq 0x10270
andq $0x0, 0xa8(%rbx)
movq %rbx, 0xb8(%rbx)
callq 0x29b6c
movl %eax, 0xc0(%rbx)
andq $0x0, 0xc8(%rbx)
xorl %eax, %eax
lock
xaddq %rax, 0x31ae2(%rip)     # 0x57548
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)
andq $0x0, 0x1d0(%rbx)
leaq 0x1d8(%rbx), %rdi
callq 0x312bc
testb %al, %al
jne 0x259b2
leaq 0x200(%rbx), %rdi
callq 0x2e7ac
leaq 0x270(%rbx), %rdi
callq 0x2f31f
leaq 0x2e0(%rbx), %rdi
callq 0x2e7ac
leaq 0x350(%rbx), %rdi
callq 0x2f31f
leaq 0x3c0(%rbx), %rdi
callq 0x312bc
testb %al, %al
jne 0x259af
andq $0x0, 0x3e8(%rbx)
leaq 0x3f0(%rbx), %rdi
callq 0x312bc
testb %al, %al
jne 0x259af
leaq 0x2c8f5(%rip), %rax     # 0x52440
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
pushq $0x27
popq %r13
xorl %r14d, %r14d
movl $0xe0, %ebp
subq $0x1, %r13
jb 0x25bf8
movq %r15, %rdi
callq 0x312bc
testb %al, %al
jne 0x259b2
andq $0x0, 0x28(%r15)
leaq 0x38(%r15), %rax
movq %rax, 0x30(%r15)
movq %rax, 0x38(%r15)
movq %r12, %rax
andq $-0x2, %rax
movq %rax, 0x40(%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x98(%r15)
movups %xmm0, 0xa8(%r15)
andq $0x0, 0xd8(%r15)
movups %xmm0, 0xb8(%r15)
movups %xmm0, 0xc8(%r15)
addq %rbp, %r15
addq %rbp, %r12
jmp 0x25b93
movq %rbx, %r14
jmp 0x259b2