// File: /workspace/github_c_makefile_star2_O3/zhou-yuxin[P]redis-aof-no-cow/deps/jemalloc/src/huge.c
// Function: je_huge_palloc
void *
huge_palloc(tsdn_t *tsdn, arena_t *arena, size_t usize, size_t alignment,
    bool zero)
{
	void *ret;
	size_t ausize;
	arena_t *iarena;
	extent_node_t *node;
	size_t sn;
	bool is_zeroed;

	/* Allocate one or more contiguous chunks for this request. */

	assert(!tsdn_null(tsdn) || arena != NULL);

	ausize = sa2u(usize, alignment);
	if (unlikely(ausize == 0 || ausize > HUGE_MAXCLASS))
		return (NULL);
	assert(ausize >= chunksize);

	/* Allocate an extent node with which to track the chunk. */
	iarena = (!tsdn_null(tsdn)) ? arena_ichoose(tsdn_tsd(tsdn), NULL) :
	    a0get();
	node = ipallocztm(tsdn, CACHELINE_CEILING(sizeof(extent_node_t)),
	    CACHELINE, false, NULL, true, iarena);
	if (node == NULL)
		return (NULL);

	/*
	 * Copy zero into is_zeroed and pass the copy to chunk_alloc(), so that
	 * it is possible to make correct junk/zero fill decisions below.
	 */
	is_zeroed = zero;
	if (likely(!tsdn_null(tsdn)))
		arena = arena_choose(tsdn_tsd(tsdn), arena);
	if (unlikely(arena == NULL) || (ret = arena_chunk_alloc_huge(tsdn,
	    arena, usize, alignment, &sn, &is_zeroed)) == NULL) {
		idalloctm(tsdn, node, NULL, true, true);
		return (NULL);
	}

	extent_node_init(node, arena, ret, usize, sn, is_zeroed, true);

	if (huge_node_set(tsdn, ret, node)) {
		arena_chunk_dalloc_huge(tsdn, arena, ret, usize, sn);
		idalloctm(tsdn, node, NULL, true, true);
		return (NULL);
	}

	/* Insert node into huge. */
	malloc_mutex_lock(tsdn, &arena->huge_mtx);
	ql_elm_new(node, ql_link);
	ql_tail_insert(&arena->huge, node, ql_link);
	malloc_mutex_unlock(tsdn, &arena->huge_mtx);

	if (zero || (config_fill && unlikely(opt_zero))) {
		if (!is_zeroed)
			memset(ret, 0, usize);
	} else if (config_fill && unlikely(opt_junk_alloc))
		memset(ret, JEMALLOC_ALLOC_JUNK, usize);

	arena_decay_tick(tsdn, arena);
	return (ret);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, 0x1c(%rsp)
movq %rcx, %r12
movq %rdx, %r15
movq %rsi, %r14
cmpq $0x3801, %rdx           # imm = 0x3801
setae %al
cmpq $0x1000, %rcx           # imm = 0x1000
setae %cl
orb %al, %cl
movabsq $0x7000000000000000, %rsi # imm = 0x7000000000000000
pushq $-0x1
popq %rax
pushq $0x7
popq %rdx
jne 0xfc47
leaq (%r15,%r12), %rcx
decq %rcx
movq %r12, %r10
negq %r10
andq %rcx, %r10
cmpq $0x1000, %r10           # imm = 0x1000
ja 0x1000c
decq %r10
shrq $0x3, %r10
leaq 0x2c216(%rip), %rcx     # 0x3be40
movzbl (%rcx,%r10), %ecx
leaq 0x2ba8a(%rip), %r8      # 0x3b6c0
movq (%r8,%rcx,8), %r9
cmpq $0x4000, %r9            # imm = 0x4000
jb 0xfd33
leaq 0x3d352(%rip), %rcx     # 0x4cfa0
leaq 0x3d473(%rip), %r8      # 0x4d0c8
movq (%r8), %r8
movq %r12, %r11
cmpq %r15, (%rcx)
jb 0xfccc
movq %r12, %r11
cmpq %r12, %r8
jbe 0xfccc
leaq 0xfff(%r12), %r11
andq $-0x1000, %r11          # imm = 0xF000
movl $0x4000, %r9d           # imm = 0x4000
cmpq $0x4001, %r15           # imm = 0x4001
jb 0xfcbc
cmpq %rsi, %r15
ja 0x10046
leaq -0x1(,%r15,2), %rcx
bsrq %rcx, %r10
movl %r10d, %ecx
addb $-0x3, %cl
movq %rax, %r9
shlq %cl, %r9
cmpl $0x6, %r10d
notq %r9
cmovbq %rdx, %r9
leaq (%r9,%r15), %rcx
notq %r9
andq %rcx, %r9
leaq (%r9,%r11), %rcx
leaq 0x3d309(%rip), %r10     # 0x4cfd0
cmpq (%r10), %rcx
jbe 0xfd33
cmpq %rsi, %r11
ja 0x100f9
leaq 0x3d3f4(%rip), %rcx     # 0x4d0d0
movq (%rcx), %r9
cmpq %r15, %r8
jae 0xfd18
cmpq $0x1000, %r15           # imm = 0x1000
ja 0x1018c
leaq -0x1(%r15), %rax
shrq $0x3, %rax
leaq 0x2c140(%rip), %rcx     # 0x3be40
movzbl (%rcx,%rax), %eax
leaq 0x2b9b5(%rip), %rcx     # 0x3b6c0
movq (%rcx,%rax,8), %r8
cmpq %r15, %r8
jb 0x100f9
addq %r9, %r11
notq %r9
andq %r11, %r9
movl $0xfff, %eax            # imm = 0xFFF
subq %r9, %rax
xorl %r9d, %r9d
cmpq %r8, %rax
cmovaeq %r8, %r9
movabsq $-0x7000000000000001, %rax # imm = 0x8FFFFFFFFFFFFFFF
addq %rax, %r9
incq %rax
cmpq %rax, %r9
jb 0x100f9
testq %rdi, %rdi
movq %rdi, 0x10(%rsp)
je 0xfd69
movq 0x28(%rdi), %rsi
testq %rsi, %rsi
jne 0xfd76
pushq $0x1
popq %rsi
callq 0x1af15
jmp 0xfd6e
callq 0x1aa00
movq 0x10(%rsp), %rdi
movq %rax, %rsi
xorl %ebx, %ebx
pushq $0x40
popq %rcx
movl $0x80, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xcfd4
testq %rax, %rax
je 0x100fb
movq %rax, %r13
movq %rax, %rbp
leaq 0x3d32f(%rip), %rax     # 0x4d0d0
movq (%rax), %rax
notq %rax
andq %r13, %rax
movq %r13, %rcx
subq %rax, %rcx
je 0xffd4
movq (%rax), %rbx
shrq $0xc, %rcx
leaq 0x3d1fc(%rip), %rdx     # 0x4cfc0
subq (%rdx), %rcx
movq 0x78(%rax,%rcx,8), %rax
movl %eax, %ecx
shrl $0x5, %ecx
movl $0xff, %edx
andl %edx, %ecx
cmpl %edx, %ecx
je 0xffec
movl %ecx, %eax
leaq 0x2b8d7(%rip), %rcx     # 0x3b6c0
movq (%rcx,%rax,8), %rax
movq 0x10(%rsp), %rdi
lock
xaddq %rax, 0x90(%rbx)
movl 0x1c(%rsp), %eax
movb %al, 0xf(%rsp)
testq %rdi, %rdi
je 0x1005d
testq %r14, %r14
jne 0xfe1e
movq 0x30(%rdi), %r14
testq %r14, %r14
je 0x1004e
leaq 0x20(%rsp), %r8
leaq 0xf(%rsp), %r9
movq %r14, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x219d7
movq 0x10(%rsp), %rdi
testq %rax, %rax
je 0x10066
movq %rax, %rbx
movq 0x20(%rsp), %rax
movb 0xf(%rsp), %cl
movq %r14, (%rbp)
movq %rbx, 0x8(%rbp)
movq %r15, 0x10(%rbp)
movq %rax, 0x18(%rbp)
movb %cl, 0x20(%rbp)
movw $0x1, 0x21(%rbp)
movq %rbx, %rsi
movq %rbp, %rdx
movq %rdi, %r12
callq 0x26668
testb %al, %al
je 0xfefa
movq 0x20(%rsp), %r8
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x21bee
leaq 0x3d238(%rip), %r14     # 0x4d0d0
movq (%r14), %rax
notq %rax
andq %r13, %rax
movq %r13, %rcx
subq %rax, %rcx
je 0x1014c
movq (%rax), %rbx
shrq $0xc, %rcx
leaq 0x3d105(%rip), %rdx     # 0x4cfc0
subq (%rdx), %rcx
movq 0x78(%rax,%rcx,8), %rax
movl %eax, %ecx
shrl $0x5, %ecx
movl $0xff, %edx
andl %edx, %ecx
cmpl %edx, %ecx
je 0x10164
movl %ecx, %eax
leaq 0x2b7e0(%rip), %rcx     # 0x3b6c0
movq (%rcx,%rax,8), %rax
movq 0x10(%rsp), %rdi
negq %rax
lock
xaddq %rax, 0x90(%rbx)
jmp 0x100c5
leaq 0x830(%r14), %r12
movq %r12, %rdi
callq 0xb5a0
movq %rbp, 0x50(%rbp)
movq %rbp, 0x58(%rbp)
movq 0x828(%r14), %rax
testq %rax, %rax
je 0xff43
movq 0x58(%rax), %rax
movq %rax, 0x58(%rbp)
movq 0x828(%r14), %rcx
movq %rcx, 0x50(%rbp)
movq %rbp, 0x50(%rax)
movq 0x828(%r14), %rax
movq %rbp, 0x58(%rax)
movq 0x50(%rbp), %rbp
movq %rbp, 0x828(%r14)
movq %r12, %rdi
callq 0xb380
cmpb $0x0, 0x1c(%rsp)
je 0xff79
cmpb $0x0, 0xf(%rsp)
movq 0x10(%rsp), %rdi
jne 0xff9a
movq %rbx, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0xb230
movq 0x10(%rsp), %rdi
jmp 0xff9a
leaq 0x3c5b3(%rip), %rax     # 0x4c533
cmpb $0x1, (%rax)
je 0xff59
leaq 0x3c595(%rip), %rax     # 0x4c521
cmpb $0x1, (%rax)
movq 0x10(%rsp), %rdi
je 0x101c1
testq %rdi, %rdi
je 0x100fb
movl (%r14), %esi
movq 0x38(%rdi), %rax
testq %rax, %rax
je 0x10000
cmpl %esi, 0x40(%rdi)
jbe 0x10000
leaq (%rax,%rsi,8), %rax
testq %rax, %rax
je 0x100fb
movl (%rax), %ecx
testl %ecx, %ecx
jle 0x10178
decl %ecx
movl %ecx, (%rax)
jmp 0x100fb
movq %rbp, %rdi
callq 0x2e20e
movq (%rax), %rbx
movq %rbp, %rsi
callq 0x2e344
jmp 0xfded
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0xfded
callq 0x1ade7
movq 0x10(%rsp), %rdi
jmp 0xffb8
cmpq %rsi, %r10
ja 0x100f9
leaq -0x1(,%r10,2), %rcx
bsrq %rcx, %r8
movl %r8d, %ecx
addb $-0x3, %cl
movq %rax, %r9
shlq %cl, %r9
cmpl $0x6, %r8d
notq %r9
cmovbq %rdx, %r9
addq %r9, %r10
notq %r9
andq %r10, %r9
jmp 0xfc3a
xorl %r9d, %r9d
jmp 0xfcbc
xorl %esi, %esi
callq 0x1af15
movq 0x10(%rsp), %rdi
movq %rax, %r14
testq %r14, %r14
jne 0xfe1e
leaq 0x3d063(%rip), %r14     # 0x4d0d0
movq (%r14), %rax
notq %rax
andq %r13, %rax
movq %r13, %rcx
subq %rax, %rcx
je 0x1011e
movq (%rax), %rbx
shrq $0xc, %rcx
leaq 0x3cf30(%rip), %rdx     # 0x4cfc0
subq (%rdx), %rcx
movq 0x78(%rax,%rcx,8), %rax
movl %eax, %ecx
shrl $0x5, %ecx
movl $0xff, %edx
andl %edx, %ecx
cmpl %edx, %ecx
je 0x10138
movl %ecx, %eax
leaq 0x2b60b(%rip), %rcx     # 0x3b6c0
movq (%rcx,%rax,8), %rax
negq %rax
lock
xaddq %rax, 0x90(%rbx)
movq (%r14), %rdx
notq %rdx
andq %r13, %rdx
subq %rdx, %r13
je 0x1010d
shrq $0xc, %r13
leaq 0x3cee2(%rip), %rax     # 0x4cfc0
movq %r13, %rcx
subq (%rax), %rcx
testb $0x2, 0x78(%rdx,%rcx,8)
movq (%rdx), %rsi
movq %rbp, %rcx
jne 0x10117
movq %r13, %r8
callq 0xd9f4
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, %rsi
callq 0x10a30
jmp 0x100f9
callq 0xda57
jmp 0x100f9
movq %rbp, %rdi
callq 0x2e20e
movq (%rax), %rbx
movq %rbp, %rsi
callq 0x2e344
movq 0x10(%rsp), %rdi
jmp 0x100b9
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0x100b9
movq %rbp, %rdi
callq 0x2e20e
movq (%rax), %rbx
movq %rbp, %rsi
callq 0x2e344
jmp 0xfee4
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0xfee4
movl 0x4(%rax), %ecx
movl %ecx, (%rax)
movq %r14, %rsi
xorl %edx, %edx
callq 0x225b4
jmp 0x100fb
cmpq %rsi, %r15
ja 0x101ce
leaq -0x1(,%r15,2), %rcx
bsrq %rcx, %rsi
movl %esi, %ecx
addb $-0x3, %cl
shlq %cl, %rax
cmpl $0x6, %esi
notq %rax
cmovbq %rdx, %rax
leaq (%rax,%r15), %rcx
notq %rax
andq %rcx, %rax
movq %rax, %r8
jmp 0xfd0f
movq %rbx, %rdi
movl $0xa5, %esi
jmp 0xff6a
xorl %r8d, %r8d
jmp 0xfd0f