// File: /workspace/github_c_makefile_star2_O1/erikdubbelboer[P]discnt/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 0x478d7(%rip), %eax     # 0x84540
shlq $0x5, %rax
movl 0x478d1(%rip), %ecx     # 0x84544
addq %rcx, %rax
addq $0xf, %rax
movabsq $0x3ffffffff0, %rcx     # imm = 0x3FFFFFFFF0
andq %rax, %rcx
leaq (%rcx,%rcx,2), %rax
leaq 0x2400(,%rax,8), %rdi
callq 0x3fe04
testq %rax, %rax
je 0x3ccb6
movq %rax, %rbx
movl %ebp, (%rax)
movl $0x0, 0x4(%rax)
leaq 0x8(%rax), %rdi
callq 0x48e30
testb %al, %al
je 0x3cccb
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, 0x90(%rbx)
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, 0xa0(%rbx)
leaq 0x2400(%rbx), %rdi
movq %rdi, 0x98(%rbx)
movl 0x47832(%rip), %edx     # 0x84540
shlq $0x5, %rdx
xorl %esi, %esi
callq 0x12380
movl 0x47821(%rip), %eax     # 0x84540
shlq $0x5, %rax
leaq (%rax,%rbx), %rdi
addq $0x2400, %rdi           # imm = 0x2400
movq %rdi, 0xa0(%rbx)
movl 0x47809(%rip), %eax     # 0x84544
shlq $0x3, %rax
leaq (%rax,%rax,2), %rdx
xorl %esi, %esi
callq 0x12380
movq %r14, 0xa8(%rbx)
movq %rbx, 0xb8(%rbx)
callq 0x41278
movl %eax, 0xc0(%rbx)
movq %r14, 0xc8(%rbx)
xorl %eax, %eax
lock
xaddq %rax, 0x477c3(%rip)     # 0x84538
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 0x48e30
testb %al, %al
jne 0x3ccb9
leaq 0x200(%rbx), %rdi
callq 0x46344
leaq 0x270(%rbx), %rdi
callq 0x4754d
leaq 0x2e0(%rbx), %rdi
callq 0x46344
leaq 0x350(%rbx), %rdi
callq 0x4754d
leaq 0x3c0(%rbx), %rdi
callq 0x48e30
testb %al, %al
jne 0x3ccb6
movq $0x0, 0x3e8(%rbx)
leaq 0x3f0(%rbx), %rdi
callq 0x48e30
testb %al, %al
jne 0x3ccb6
leaq 0x2f5ac(%rip), %rax     # 0x6c408
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 0x48e30
testb %al, %al
jne 0x3ccb9
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 $0x1f80, %rbp           # imm = 0x1F80
jne 0x3cea3
movq %rbx, %r14
jmp 0x3ccb9