// File: /workspace/github_c_makefile_star2_O0/zhou-yuxin[P]redis-aof-no-cow/deps/jemalloc/src/arena.c
// Function: je_arena_new
arena_t *
arena_new(tsdn_t *tsdn, unsigned ind)
{
	arena_t *arena;
	unsigned i;

	/*
	 * 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(tsdn,
		    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(tsdn, sizeof(arena_t));
	if (arena == NULL)
		return (NULL);

	arena->ind = ind;
	arena->nthreads[0] = arena->nthreads[1] = 0;
	if (malloc_mutex_init(&arena->lock, "arena", WITNESS_RANK_ARENA))
		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 :
		    (size_t)(uintptr_t)arena;
	}

	arena->dss_prec = chunk_dss_prec_get();

	ql_new(&arena->achunks);

	arena->extent_sn_next = 0;

	arena->spare = NULL;

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

	for (i = 0; i < NPSIZES; i++)
		arena_run_heap_new(&arena->runs_avail[i]);

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

	if (opt_purge == purge_mode_decay)
		arena_decay_init(arena, arena_decay_time_default_get());

	ql_new(&arena->huge);
	if (malloc_mutex_init(&arena->huge_mtx, "arena_huge",
	    WITNESS_RANK_ARENA_HUGE))
		return (NULL);

	extent_tree_szsnad_new(&arena->chunks_szsnad_cached);
	extent_tree_ad_new(&arena->chunks_ad_cached);
	extent_tree_szsnad_new(&arena->chunks_szsnad_retained);
	extent_tree_ad_new(&arena->chunks_ad_retained);
	if (malloc_mutex_init(&arena->chunks_mtx, "arena_chunks",
	    WITNESS_RANK_ARENA_CHUNKS))
		return (NULL);
	ql_new(&arena->node_cache);
	if (malloc_mutex_init(&arena->node_cache_mtx, "arena_node_cache",
	    WITNESS_RANK_ARENA_NODE_CACHE))
		return (NULL);

	arena->chunk_hooks = chunk_hooks_default;

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

	return (arena);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movl 0x6000b(%rip), %eax     # 0xa35b4
movl %eax, %esi
shlq $0x5, %rsi
addq $0x7, %rsi
andq $-0x8, %rsi
addq $0x2980, %rsi           # imm = 0x2980
movl 0x609d4(%rip), %eax     # 0xa3f98
imulq $0x18, %rax, %rax
addq %rax, %rsi
callq 0x50230
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x435e8
movq $0x0, -0x8(%rbp)
jmp 0x439a5
movl -0x14(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x20(%rbp), %rdi
addq $0x10, %rdi
leaq 0x4d8eb(%rip), %rsi     # 0x90f01
movl $0x8, %edx
callq 0x66ad0
testb $0x1, %al
jne 0x43626
jmp 0x43633
movq $0x0, -0x8(%rbp)
jmp 0x439a5
movq -0x20(%rbp), %rdi
addq $0x60, %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0xb210
movq -0x20(%rbp), %rcx
addq $0x2980, %rcx           # imm = 0x2980
movq -0x20(%rbp), %rax
movq %rcx, 0xd0(%rax)
movq -0x20(%rbp), %rax
movq 0xd0(%rax), %rdi
movl 0x5ff46(%rip), %eax     # 0xa35b4
movl %eax, %edx
shlq $0x5, %rdx
xorl %esi, %esi
callq 0xb210
movq -0x20(%rbp), %rcx
addq $0x2980, %rcx           # imm = 0x2980
movl 0x5ff28(%rip), %eax     # 0xa35b4
shlq $0x5, %rax
addq $0x7, %rax
andq $-0x8, %rax
addq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0xd8(%rax)
movq -0x20(%rbp), %rax
movq 0xd8(%rax), %rdi
movl 0x608e1(%rip), %eax     # 0xa3f98
imulq $0x18, %rax, %rdx
xorl %esi, %esi
callq 0xb210
movq -0x20(%rbp), %rax
movq $0x0, 0xe0(%rax)
movq -0x20(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0xf0(%rax)
callq 0x53430
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0xf8(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x100(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x108(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x110(%rax)
callq 0x42ce0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x118(%rax)
movq -0x20(%rbp), %rax
movb $0x0, 0x120(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x128(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x130(%rax)
movl $0x0, -0x24(%rbp)
cmpl $0xc7, -0x24(%rbp)
jae 0x4378f
movq -0x20(%rbp), %rdi
addq $0x2318, %rdi           # imm = 0x2318
movl -0x24(%rbp), %eax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x3c440
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x43761
jmp 0x43791
movq -0x20(%rbp), %rcx
addq $0x138, %rcx            # imm = 0x138
movq -0x20(%rbp), %rax
movq %rcx, 0x138(%rax)
movq -0x20(%rbp), %rcx
addq $0x138, %rcx            # imm = 0x138
movq -0x20(%rbp), %rax
movq %rcx, 0x140(%rax)
jmp 0x437bf
movq -0x20(%rbp), %rcx
addq $0x148, %rcx            # imm = 0x148
movq -0x20(%rbp), %rax
movq %rcx, 0x188(%rax)
movq -0x20(%rbp), %rcx
addq $0x148, %rcx            # imm = 0x148
movq -0x20(%rbp), %rax
movq %rcx, 0x190(%rax)
cmpl $0x1, 0x5fdbe(%rip)     # 0xa35b0
jne 0x4380d
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
callq 0x42db0
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x3b630
jmp 0x4380f
movq -0x20(%rbp), %rax
movq $0x0, 0x828(%rax)
movq -0x20(%rbp), %rdi
addq $0x830, %rdi            # imm = 0x830
leaq 0x4d6d7(%rip), %rsi     # 0x90f07
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x66ad0
testb $0x1, %al
jne 0x43840
jmp 0x4384d
movq $0x0, -0x8(%rbp)
jmp 0x439a5
movq -0x20(%rbp), %rdi
addq $0x880, %rdi            # imm = 0x880
callq 0x5d300
movq -0x20(%rbp), %rdi
addq $0x888, %rdi            # imm = 0x888
callq 0x5ef30
movq -0x20(%rbp), %rdi
addq $0x890, %rdi            # imm = 0x890
callq 0x5d300
movq -0x20(%rbp), %rdi
addq $0x898, %rdi            # imm = 0x898
callq 0x5ef30
movq -0x20(%rbp), %rdi
addq $0x8a0, %rdi            # imm = 0x8A0
leaq 0x4d673(%rip), %rsi     # 0x90f12
movl $0x9, %edx
callq 0x66ad0
testb $0x1, %al
jne 0x438af
jmp 0x438bc
movq $0x0, -0x8(%rbp)
jmp 0x439a5
jmp 0x438be
movq -0x20(%rbp), %rax
movq $0x0, 0x8f0(%rax)
movq -0x20(%rbp), %rdi
addq $0x8f8, %rdi            # imm = 0x8F8
leaq 0x4d640(%rip), %rsi     # 0x90f1f
movl $0xa, %edx
callq 0x66ad0
testb $0x1, %al
jne 0x438ef
jmp 0x438fc
movq $0x0, -0x8(%rbp)
jmp 0x439a5
movq -0x20(%rbp), %rdi
addq $0x948, %rdi            # imm = 0x948
leaq 0x5d9a2(%rip), %rsi     # 0xa12b0
movl $0x38, %edx
callq 0xb310
movl $0x0, -0x24(%rbp)
cmpl $0x27, -0x24(%rbp)
jae 0x4399d
movq -0x20(%rbp), %rax
addq $0x980, %rax            # imm = 0x980
movl -0x24(%rbp), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x4d5e5(%rip), %rsi     # 0x90f30
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x66ad0
testb $0x1, %al
jne 0x4395b
jmp 0x43965
movq $0x0, -0x8(%rbp)
jmp 0x439a5
movq -0x30(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x30(%rbp), %rdi
addq $0x58, %rdi
callq 0x3c440
movq -0x30(%rbp), %rdi
addq $0x60, %rdi
xorl %esi, %esi
movl $0x48, %edx
callq 0xb210
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x4391f
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nop