// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0xc(%rbp)
movl 0x5f36f(%rip), %eax     # 0xa25d0
shlq $0x5, %rax
movl 0x5f369(%rip), %ecx     # 0xa25d4
addq %rcx, %rax
addq $0x7, %rax
andq $-0x8, %rax
imulq $0x18, %rax, %rdi
addq $0x2680, %rdi           # imm = 0x2680
callq 0x4f320
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x4329e
movq $0x0, -0x8(%rbp)
jmp 0x435b0
movl -0xc(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0x64360
testb $0x1, %al
jne 0x432c5
jmp 0x432d2
movq $0x0, -0x8(%rbp)
jmp 0x435b0
movq -0x18(%rbp), %rdi
addq $0x30, %rdi
xorl %esi, %esi
movl $0x78, %edx
callq 0x10250
movq -0x18(%rbp), %rcx
addq $0x2680, %rcx           # imm = 0x2680
movq -0x18(%rbp), %rax
movq %rcx, 0x98(%rax)
movq -0x18(%rbp), %rax
movq 0x98(%rax), %rdi
movl 0x5f2c3(%rip), %eax     # 0xa25d0
movl %eax, %edx
shlq $0x5, %rdx
xorl %esi, %esi
callq 0x10250
movq -0x18(%rbp), %rcx
addq $0x2680, %rcx           # imm = 0x2680
movl 0x5f2a5(%rip), %eax     # 0xa25d0
shlq $0x5, %rax
addq $0x7, %rax
andq $-0x8, %rax
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0xa0(%rax)
movq -0x18(%rbp), %rax
movq 0xa0(%rax), %rdi
movl 0x5f27e(%rip), %eax     # 0xa25d4
imulq $0x18, %rax, %rdx
xorl %esi, %esi
callq 0x10250
movq -0x18(%rbp), %rax
movq $0x0, 0xa8(%rax)
movq -0x18(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0xb8(%rax)
callq 0x522a0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0xc0(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0xc8(%rax)
callq 0x42ca0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0xd0(%rax)
movq -0x18(%rbp), %rax
movb $0x0, 0xd8(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0xe0(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0xe8(%rax)
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
callq 0x435c0
movq -0x18(%rbp), %rcx
addq $0x158, %rcx            # imm = 0x158
movq -0x18(%rbp), %rax
movq %rcx, 0x158(%rax)
movq -0x18(%rbp), %rcx
addq $0x158, %rcx            # imm = 0x158
movq -0x18(%rbp), %rax
movq %rcx, 0x160(%rax)
jmp 0x43419
movq -0x18(%rbp), %rcx
addq $0x168, %rcx            # imm = 0x168
movq -0x18(%rbp), %rax
movq %rcx, 0x1a0(%rax)
movq -0x18(%rbp), %rcx
addq $0x168, %rcx            # imm = 0x168
movq -0x18(%rbp), %rax
movq %rcx, 0x1a8(%rax)
jmp 0x43447
movq -0x18(%rbp), %rax
movq $0x0, 0x1d0(%rax)
movq -0x18(%rbp), %rdi
addq $0x1d8, %rdi            # imm = 0x1D8
callq 0x64360
testb $0x1, %al
jne 0x4346c
jmp 0x43479
movq $0x0, -0x8(%rbp)
jmp 0x435b0
movq -0x18(%rbp), %rdi
addq $0x200, %rdi            # imm = 0x200
callq 0x5bc00
movq -0x18(%rbp), %rdi
addq $0x270, %rdi            # imm = 0x270
callq 0x5d990
movq -0x18(%rbp), %rdi
addq $0x2e0, %rdi            # imm = 0x2E0
callq 0x5bc00
movq -0x18(%rbp), %rdi
addq $0x350, %rdi            # imm = 0x350
callq 0x5d990
movq -0x18(%rbp), %rdi
addq $0x3c0, %rdi            # imm = 0x3C0
callq 0x64360
testb $0x1, %al
jne 0x434cf
jmp 0x434dc
movq $0x0, -0x8(%rbp)
jmp 0x435b0
jmp 0x434de
movq -0x18(%rbp), %rax
movq $0x0, 0x3e8(%rax)
movq -0x18(%rbp), %rdi
addq $0x3f0, %rdi            # imm = 0x3F0
callq 0x64360
testb $0x1, %al
jne 0x43503
jmp 0x43510
movq $0x0, -0x8(%rbp)
jmp 0x435b0
movq -0x18(%rbp), %rdi
addq $0x418, %rdi            # imm = 0x418
leaq 0x59f26(%rip), %rsi     # 0x9d448
movl $0x38, %edx
callq 0x103b0
movl $0x0, -0x1c(%rbp)
cmpl $0x27, -0x1c(%rbp)
jae 0x435a8
movq -0x18(%rbp), %rax
addq $0x450, %rax            # imm = 0x450
movl -0x1c(%rbp), %ecx
imulq $0xe0, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x64360
testb $0x1, %al
jne 0x43563
jmp 0x4356d
movq $0x0, -0x8(%rbp)
jmp 0x435b0
movq -0x28(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x28(%rbp), %rdi
addq $0x30, %rdi
callq 0x43640
movq -0x28(%rbp), %rdi
addq $0x98, %rdi
xorl %esi, %esi
movl $0x48, %edx
callq 0x10250
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x43533
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)