// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/deps/jemalloc/src/huge.c
// Function: je_huge_palloc
void *
huge_palloc(tsd_t *tsd, arena_t *arena, size_t size, size_t alignment,
    bool zero, tcache_t *tcache)
{
	void *ret;
	size_t usize;
	extent_node_t *node;
	bool is_zeroed;

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

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

	/* Allocate an extent node with which to track the chunk. */
	node = ipallocztm(tsd, CACHELINE_CEILING(sizeof(extent_node_t)),
	    CACHELINE, false, tcache, true, arena);
	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;
	arena = arena_choose(tsd, arena);
	if (unlikely(arena == NULL) || (ret = arena_chunk_alloc_huge(arena,
	    size, alignment, &is_zeroed)) == NULL) {
		idalloctm(tsd, node, tcache, true);
		return (NULL);
	}

	extent_node_init(node, arena, ret, size, is_zeroed, true);

	if (huge_node_set(ret, node)) {
		arena_chunk_dalloc_huge(arena, ret, size);
		idalloctm(tsd, node, tcache, true);
		return (NULL);
	}

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

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

	return (ret);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, 0x24(%rsp)
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r13
cmpq $0x3801, %rdx           # imm = 0x3801
setae %al
cmpq $0x1000, %rcx           # imm = 0x1000
setae %cl
orb %al, %cl
pushq $-0x1
popq %rax
pushq $0x7
popq %rdx
movabsq $0x7ffffffffffff000, %r15 # imm = 0x7FFFFFFFFFFFF000
pushq $0x40
popq %rsi
jne 0x2fea0
leaq (%r12,%rbx), %rcx
decq %rcx
movq %rbx, %r8
negq %r8
andq %rcx, %r8
cmpq $0x1000, %r8            # imm = 0x1000
ja 0x301f9
decq %r8
shrq $0x3, %r8
leaq 0x12c7d(%rip), %rcx     # 0x42b00
movzbl (%rcx,%r8), %ecx
leaq 0x124f1(%rip), %r8      # 0x42380
movq (%r8,%rcx,8), %r14
cmpq $0x4000, %r14           # imm = 0x4000
jb 0x2ff89
leaq 0x27699(%rip), %rcx     # 0x57540
leaq 0x277fa(%rip), %r8      # 0x576a8
movq (%r8), %r8
movq %rbx, %r10
cmpq %r12, (%rcx)
jb 0x2ff22
movq %rbx, %r10
cmpq %rbx, %r8
jbe 0x2ff22
leaq 0xfff(%rbx), %r10
andq $-0x1000, %r10          # imm = 0xF000
movl $0x4000, %r14d          # imm = 0x4000
cmpq $0x4001, %r12           # imm = 0x4001
jb 0x2ff12
testq %r12, %r12
js 0x30231
leaq -0x1(,%r12,2), %rcx
bsrq %rcx, %r11
leal -0x3(%r11), %ecx
movq %rax, %r14
shlq %cl, %r14
cmpq $0x6, %r11
notq %r14
cmovbq %rdx, %r14
leaq (%r14,%r12), %rcx
notq %r14
andq %rcx, %r14
leaq (%r14,%r10), %rcx
leaq 0x2764b(%rip), %r11     # 0x57568
cmpq (%r11), %rcx
jbe 0x2ff89
leaq 0x27787(%rip), %rcx     # 0x576b0
movq (%rcx), %r11
addq %r11, %r10
notq %r11
andq %r10, %r11
je 0x3036a
cmpq %r12, %r8
jae 0x2ff75
cmpq $0x1000, %r12           # imm = 0x1000
ja 0x30524
leaq -0x1(%r12), %rax
shrq $0x3, %rax
leaq 0x12ba3(%rip), %rcx     # 0x42b00
movzbl (%rcx,%rax), %eax
leaq 0x12418(%rip), %rcx     # 0x42380
movq (%rcx,%rax,8), %r8
cmpq %r12, %r8
jb 0x3036a
movl $0xfff, %eax            # imm = 0xFFF
subq %r11, %rax
movq %r8, %r14
cmpq %r8, %rax
jb 0x3036a
movq %r9, 0x10(%rsp)
testq %r14, %r14
je 0x3036a
pushq $0x40
popq %rcx
xorl %ebp, %ebp
movl $0x80, %edx
movq %rdi, 0x18(%rsp)
movq %r13, %rsi
xorl %r8d, %r8d
movq 0x10(%rsp), %r9
callq 0x23953
testq %rax, %rax
je 0x3036c
movq %rax, %r15
movq %rax, %r14
leaq 0x276e4(%rip), %rax     # 0x576b0
movq (%rax), %rax
notq %rax
andq %r15, %rax
cmpq %rax, %r15
je 0x301b8
movq (%rax), %rbp
cmpq %rax, %r15
je 0x301d8
movq %r15, %rcx
subq %rax, %rcx
shrq $0xc, %rcx
leaq 0x2755d(%rip), %rdx     # 0x57558
subq (%rdx), %rcx
movq 0x68(%rax,%rcx,8), %rax
movl %eax, %ecx
shrl $0x5, %ecx
movl $0xff, %edx
andl %edx, %ecx
cmpl %edx, %ecx
je 0x301e5
movl %ecx, %eax
leaq 0x12360(%rip), %rcx     # 0x42380
movq (%rcx,%rax,8), %rax
lock
xaddq %rax, 0x58(%rbp)
movl 0x24(%rsp), %eax
movb %al, 0xf(%rsp)
testq %r13, %r13
jne 0x30049
movq 0x18(%rsp), %rax
movq 0x28(%rax), %r13
testq %r13, %r13
je 0x3024b
leaq 0xf(%rsp), %rcx
movq %r13, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x22298
testq %rax, %rax
je 0x3025e
movq %rax, %rbp
movb 0xf(%rsp), %al
movq %r13, (%r14)
movq %rbp, 0x8(%r14)
movq %r12, 0x10(%r14)
movb %al, 0x18(%r14)
movw $0x1, 0x19(%r14)
movq %rbp, %rdi
movq %r14, %rsi
callq 0x28e8e
testb %al, %al
je 0x30116
movq %r13, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x22433
leaq 0x27606(%rip), %r13     # 0x576b0
movq (%r13), %rax
notq %rax
andq %r15, %rax
cmpq %rax, %r15
je 0x304e9
movq (%rax), %rbx
movq 0x10(%rsp), %r12
cmpq %rax, %r15
je 0x30503
movq %r15, %rcx
subq %rax, %rcx
shrq $0xc, %rcx
leaq 0x27479(%rip), %rdx     # 0x57558
subq (%rdx), %rcx
movq 0x68(%rax,%rcx,8), %rax
movl %eax, %ecx
shrl $0x5, %ecx
movl $0xff, %edx
andl %edx, %ecx
cmpl %edx, %ecx
je 0x30510
movl %ecx, %eax
leaq 0x1227c(%rip), %rcx     # 0x42380
movq (%rcx,%rax,8), %rax
negq %rax
lock
xaddq %rax, 0x58(%rbx)
jmp 0x302cc
leaq 0x1d8(%r13), %rbx
movq %rbx, %rdi
callq 0x106d0
movq %r14, 0x48(%r14)
movq %r14, 0x50(%r14)
movq 0x1d0(%r13), %rax
testq %rax, %rax
je 0x3015f
movq 0x50(%rax), %rax
movq %rax, 0x50(%r14)
movq 0x1d0(%r13), %rcx
movq %rcx, 0x48(%r14)
movq %r14, 0x48(%rax)
movq 0x1d0(%r13), %rax
movq %r14, 0x50(%rax)
movq 0x48(%r14), %r14
movq %r14, 0x1d0(%r13)
movq %rbx, %rdi
callq 0x10440
cmpb $0x0, 0x24(%rsp)
je 0x30192
cmpb $0x0, 0xf(%rsp)
jne 0x3036c
movq %rbp, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x10270
jmp 0x3036c
leaq 0x2649a(%rip), %rax     # 0x56633
cmpb $0x1, (%rax)
je 0x30175
leaq 0x2647c(%rip), %rax     # 0x56621
cmpb $0x1, (%rax)
jne 0x3036c
movq %rbp, %rdi
movl $0xa5, %esi
jmp 0x30185
movq %r14, %rdi
callq 0x311b6
movq %rax, %rbp
leaq 0x274e6(%rip), %rax     # 0x576b0
movq (%rax), %rax
notq %rax
andq %r15, %rax
jmp 0x2ffe1
movq %r14, %rdi
callq 0x311c1
jmp 0x30024
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0x30024
testq %r8, %r8
js 0x3055c
leaq -0x1(,%r8,2), %rcx
bsrq %rcx, %r10
leal -0x3(%r10), %ecx
movq %rax, %r14
shlq %cl, %r14
cmpq $0x6, %r10
notq %r14
cmovbq %rdx, %r14
addq %r14, %r8
notq %r14
andq %r8, %r14
jmp 0x2fe93
leaq 0xfff(%r15), %rcx
andq %r12, %rcx
cmpq $0x1, %rcx
movq %rsi, %r11
sbbq $0x0, %r11
jmp 0x2fef3
movq 0x18(%rsp), %rdi
callq 0x1c83a
testq %rax, %rax
jne 0x305ca
leaq 0x2744b(%rip), %r13     # 0x576b0
movq (%r13), %rax
notq %rax
andq %r15, %rax
cmpq %rax, %r15
je 0x3041a
movq (%rax), %rbx
movq 0x10(%rsp), %r12
cmpq %rax, %r15
je 0x30434
movq %r15, %rcx
subq %rax, %rcx
shrq $0xc, %rcx
leaq 0x272be(%rip), %rdx     # 0x57558
subq (%rdx), %rcx
movq 0x68(%rax,%rcx,8), %rax
movl %eax, %ecx
shrl $0x5, %ecx
movl $0xff, %edx
andl %edx, %ecx
cmpl %edx, %ecx
je 0x30441
movl %ecx, %eax
leaq 0x120c1(%rip), %rcx     # 0x42380
movq (%rcx,%rax,8), %rax
negq %rax
lock
xaddq %rax, 0x58(%rbx)
movq (%r13), %rsi
notq %rsi
andq %r15, %rsi
subq %rsi, %r15
je 0x3037e
shrq $0xc, %r15
leaq 0x2726e(%rip), %rax     # 0x57558
movq %r15, %rcx
subq (%rax), %rcx
movq 0x68(%rsi,%rcx,8), %rax
testb $0x2, %al
jne 0x30390
testq %r12, %r12
je 0x303c2
shrl $0x5, %eax
movzbl %al, %ebx
leaq 0x2630f(%rip), %rax     # 0x56622
cmpb $0x1, (%rax)
je 0x303d2
movl %ebx, %eax
shll $0x5, %eax
leaq (%r12,%rax), %r15
addq $0x20, %r15
leaq 0x27a80(%rip), %rax     # 0x57db0
movq (%rax), %rax
movl 0x10(%r15), %r8d
cmpl (%rax,%rbx,4), %r8d
je 0x303ea
movq 0x18(%r15), %rax
movl %r8d, %ecx
movq %r14, (%rax,%rcx,8)
incl %r8d
movl %r8d, 0x10(%r15)
movl 0x18(%r12), %eax
incl %eax
movl %eax, 0x18(%r12)
cmpl $0xd3, %eax
je 0x30408
xorl %ebp, %ebp
movq %rbp, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x30dbc
jmp 0x3036a
testq %r12, %r12
je 0x303b5
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
leaq -0x1000(%rax), %rbx
leaq 0x27a34(%rip), %rcx     # 0x57de0
cmpq (%rcx), %rbx
jbe 0x30455
movq (%rsi), %rdi
movq %r14, %rdx
callq 0x24608
jmp 0x3036a
movq (%rsi), %rdi
movq %r14, %rdx
movq %r15, %rcx
callq 0x244f0
jmp 0x3036a
imulq $0x60, %rbx, %rsi
addq 0x23bfb(%rip), %rsi     # 0x53fd8
movq %r14, %rdi
callq 0x233ee
jmp 0x3031c
shrl %r8d
movq 0x18(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
movl %ebx, %ecx
callq 0x37034
movl 0x10(%r15), %r8d
jmp 0x30341
movq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x36f85
jmp 0x3036a
movq %r14, %rdi
callq 0x311b6
movq %rax, %rbx
movq (%r13), %rax
notq %rax
andq %r15, %rax
jmp 0x3027b
movq %r14, %rdi
callq 0x311c1
jmp 0x302c3
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0x302c3
cmpq $0x1000, %rbx           # imm = 0x1000
ja 0x30576
addq $-0x1001, %rax          # imm = 0xEFFF
shrq $0x3, %rax
leaq 0x1268d(%rip), %rcx     # 0x42b00
movzbl (%rcx,%rax), %ebp
leaq 0x261a4(%rip), %rax     # 0x56622
cmpb $0x1, (%rax)
je 0x30585
movl %ebp, %eax
movq %rax, %rcx
shlq $0x5, %rcx
movq 0x10(%rsp), %rdx
leaq (%rdx,%rcx), %rbx
addq $0x20, %rbx
leaq 0x2790c(%rip), %rcx     # 0x57db0
movq (%rcx), %rdx
movl 0x10(%rbx), %ecx
cmpl (%rdx,%rax,4), %ecx
je 0x30595
movq 0x18(%rbx), %rax
movl %ecx, %edx
movq %r14, (%rax,%rdx,8)
incl %ecx
movl %ecx, 0x10(%rbx)
movq 0x10(%rsp), %rcx
movl 0x18(%rcx), %eax
incl %eax
movl %eax, 0x18(%rcx)
cmpl $0xd3, %eax
jne 0x3036a
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rsi
jmp 0x30410
movq %r14, %rdi
callq 0x311b6
movq %rax, %rbx
movq (%r13), %rax
notq %rax
andq %r15, %rax
jmp 0x300c0
movq %r14, %rdi
callq 0x311c1
jmp 0x30108
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0x30108
testq %r12, %r12
js 0x305b3
leaq -0x1(,%r12,2), %rcx
bsrq %rcx, %rsi
leal -0x3(%rsi), %ecx
shlq %cl, %rax
cmpq $0x6, %rsi
notq %rax
cmovbq %rdx, %rax
leaq (%rax,%r12), %rcx
notq %rax
andq %rcx, %rax
movq %rax, %r8
jmp 0x2ff6c
leaq 0xfff(%r15), %rcx
andq %r8, %rcx
cmpq $0x1, %rcx
movq %rsi, %r10
sbbq $0x0, %r10
jmp 0x3020e
movq %rbx, %rdi
callq 0x31263
movl %eax, %ebp
jmp 0x30477
movq %r14, %rdi
movq %rbx, %rsi
callq 0x244f5
jmp 0x30487
shrl %ecx
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
movl %ebp, %edx
movq 0x10(%rsp), %r8
callq 0x371b7
movl 0x10(%rbx), %ecx
jmp 0x304b3
orq $0xfff, %r15            # imm = 0xFFF
andq %r12, %r15
cmpq $0x1, %r15
sbbq $0x0, %rsi
jmp 0x30539
movq %rax, %r13
jmp 0x30049