// File: /workspace/github_c_makefile_star2_O3/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 0x12411
leaq (%r12,%rbx), %rcx
decq %rcx
movq %rbx, %r8
negq %r8
andq %rcx, %r8
cmpq $0x1000, %r8            # imm = 0x1000
ja 0x12768
decq %r8
shrq $0x3, %r8
leaq 0x35bcc(%rip), %rcx     # 0x47fc0
movzbl (%rcx,%r8), %ecx
leaq 0x35440(%rip), %r8      # 0x47840
movq (%r8,%rcx,8), %r14
cmpq $0x4000, %r14           # imm = 0x4000
jb 0x124fa
leaq 0x49128(%rip), %rcx     # 0x5b540
leaq 0x49289(%rip), %r8      # 0x5b6a8
movq (%r8), %r8
movq %rbx, %r10
cmpq %r12, (%rcx)
jb 0x12493
movq %rbx, %r10
cmpq %rbx, %r8
jbe 0x12493
leaq 0xfff(%rbx), %r10
andq $-0x1000, %r10          # imm = 0xF000
movl $0x4000, %r14d          # imm = 0x4000
cmpq $0x4001, %r12           # imm = 0x4001
jb 0x12483
testq %r12, %r12
js 0x127a0
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 0x490da(%rip), %r11     # 0x5b568
cmpq (%r11), %rcx
jbe 0x124fa
leaq 0x49216(%rip), %rcx     # 0x5b6b0
movq (%rcx), %r11
addq %r11, %r10
notq %r11
andq %r10, %r11
je 0x128dc
cmpq %r12, %r8
jae 0x124e6
cmpq $0x1000, %r12           # imm = 0x1000
ja 0x12a90
leaq -0x1(%r12), %rax
shrq $0x3, %rax
leaq 0x35af2(%rip), %rcx     # 0x47fc0
movzbl (%rcx,%rax), %eax
leaq 0x35367(%rip), %rcx     # 0x47840
movq (%rcx,%rax,8), %r8
cmpq %r12, %r8
jb 0x128dc
movl $0xfff, %eax            # imm = 0xFFF
subq %r11, %rax
movq %r8, %r14
cmpq %r8, %rax
jb 0x128dc
movq %r9, 0x18(%rsp)
testq %r14, %r14
je 0x128dc
pushq $0x40
popq %rcx
xorl %ebp, %ebp
movl $0x80, %edx
movq %rdi, 0x10(%rsp)
movq %r13, %rsi
xorl %r8d, %r8d
movq 0x18(%rsp), %r9
callq 0x28c3d
testq %rax, %rax
je 0x128de
movq %rax, %r15
movq %rax, %r14
leaq 0x49173(%rip), %rbp     # 0x5b6b0
movq (%rbp), %rcx
notq %rcx
andq %rax, %rcx
movq %rcx, %rax
cmpq %rcx, %r15
je 0x12730
movq (%rax), %rbp
cmpq %rcx, %r15
je 0x12747
movq %r15, %rax
subq %rcx, %rax
shrq $0xc, %rax
leaq 0x48fe8(%rip), %rdx     # 0x5b558
subq (%rdx), %rax
movq 0x68(%rcx,%rax,8), %rax
movl %eax, %ecx
shrl $0x5, %ecx
movl $0xff, %edx
andl %edx, %ecx
cmpl %edx, %ecx
je 0x12754
movl %ecx, %eax
leaq 0x352ab(%rip), %rcx     # 0x47840
movq (%rcx,%rax,8), %rax
lock
xaddq %rax, 0x58(%rbp)
movl 0x24(%rsp), %eax
movb %al, 0xf(%rsp)
testq %r13, %r13
jne 0x125be
movq 0x10(%rsp), %rax
movq 0x28(%rax), %r13
testq %r13, %r13
je 0x127ba
leaq 0xf(%rsp), %rcx
movq %r13, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x271c6
testq %rax, %rax
je 0x127cd
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 0x2e465
testb %al, %al
je 0x1268e
movq %r13, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x27364
leaq 0x49091(%rip), %r13     # 0x5b6b0
movq (%r13), %rcx
notq %rcx
andq %r15, %rcx
movq %rcx, %rax
cmpq %rcx, %r15
je 0x12a58
movq (%rax), %rbx
cmpq %rcx, %r15
movq 0x18(%rsp), %r12
je 0x12a6f
movq %r15, %rax
subq %rcx, %rax
shrq $0xc, %rax
leaq 0x48f01(%rip), %rdx     # 0x5b558
subq (%rdx), %rax
movq 0x68(%rcx,%rax,8), %rax
movl %eax, %ecx
shrl $0x5, %ecx
movl $0xff, %edx
andl %edx, %ecx
cmpl %edx, %ecx
je 0x12a7c
movl %ecx, %eax
leaq 0x351c4(%rip), %rcx     # 0x47840
movq (%rcx,%rax,8), %rax
negq %rax
lock
xaddq %rax, 0x58(%rbx)
jmp 0x1283e
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 0x126d7
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 0x1270a
cmpb $0x0, 0xf(%rsp)
jne 0x128de
movq %rbp, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x10270
jmp 0x128de
leaq 0x47f22(%rip), %rax     # 0x5a633
cmpb $0x1, (%rax)
je 0x126ed
leaq 0x47f04(%rip), %rax     # 0x5a621
cmpb $0x1, (%rax)
jne 0x128de
movq %rbp, %rdi
movl $0xa5, %esi
jmp 0x126fd
movq %r14, %rdi
callq 0x36c66
movq (%rbp), %rcx
notq %rcx
andq %r15, %rcx
jmp 0x12553
movq %r14, %rdi
callq 0x36d46
jmp 0x12599
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0x12599
testq %r8, %r8
js 0x12ac8
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 0x12404
leaq 0xfff(%r15), %rcx
andq %r12, %rcx
cmpq $0x1, %rcx
movq %rsi, %r11
sbbq $0x0, %r11
jmp 0x12464
movq 0x10(%rsp), %rdi
callq 0x22135
testq %rax, %rax
jne 0x12b36
leaq 0x48edc(%rip), %r13     # 0x5b6b0
movq (%r13), %rcx
notq %rcx
andq %r15, %rcx
movq %rcx, %rax
cmpq %rcx, %r15
je 0x1298c
movq (%rax), %rbx
cmpq %rcx, %r15
movq 0x18(%rsp), %r12
je 0x129a3
movq %r15, %rax
subq %rcx, %rax
shrq $0xc, %rax
leaq 0x48d4c(%rip), %rdx     # 0x5b558
subq (%rdx), %rax
movq 0x68(%rcx,%rax,8), %rax
movl %eax, %ecx
shrl $0x5, %ecx
movl $0xff, %edx
andl %edx, %ecx
cmpl %edx, %ecx
je 0x129b0
movl %ecx, %eax
leaq 0x3500f(%rip), %rcx     # 0x47840
movq (%rcx,%rax,8), %rax
negq %rax
lock
xaddq %rax, 0x58(%rbx)
movq (%r13), %rsi
notq %rsi
andq %r15, %rsi
subq %rsi, %r15
je 0x128f0
shrq $0xc, %r15
leaq 0x48cfc(%rip), %rax     # 0x5b558
movq %r15, %rcx
subq (%rax), %rcx
movq 0x68(%rsi,%rcx,8), %rax
testb $0x2, %al
jne 0x12902
testq %r12, %r12
je 0x12934
shrl $0x5, %eax
movzbl %al, %ebx
leaq 0x47d9d(%rip), %rax     # 0x5a622
cmpb $0x1, (%rax)
je 0x12944
movl %ebx, %eax
shll $0x5, %eax
leaq (%r12,%rax), %r15
addq $0x20, %r15
leaq 0x4950e(%rip), %rax     # 0x5bdb0
movq (%rax), %rax
movl 0x10(%r15), %r8d
cmpl (%rax,%rbx,4), %r8d
je 0x1295c
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 0x1297a
xorl %ebp, %ebp
movq %rbp, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x36925
jmp 0x128dc
testq %r12, %r12
je 0x12927
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
leaq -0x1000(%rax), %rbx
leaq 0x494c2(%rip), %rcx     # 0x5bde0
cmpq (%rcx), %rbx
jbe 0x129c4
movq (%rsi), %rdi
movq %r14, %rdx
callq 0x299db
jmp 0x128dc
movq (%rsi), %rdi
movq %r14, %rdx
movq %r15, %rcx
callq 0x298af
jmp 0x128dc
imulq $0x60, %rbx, %rsi
addq 0x45689(%rip), %rsi     # 0x57fd8
movq %r14, %rdi
callq 0x2859f
jmp 0x1288e
shrl %r8d
movq 0x10(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
movl %ebx, %ecx
callq 0x3c88f
movl 0x10(%r15), %r8d
jmp 0x128b3
movq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x3c7e1
jmp 0x128dc
movq %r14, %rdi
callq 0x36c66
movq (%r13), %rcx
notq %rcx
andq %r15, %rcx
jmp 0x127ea
movq %r14, %rdi
callq 0x36d46
jmp 0x12835
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0x12835
cmpq $0x1000, %rbx           # imm = 0x1000
ja 0x12ae2
addq $-0x1001, %rax          # imm = 0xEFFF
shrq $0x3, %rax
leaq 0x355de(%rip), %rcx     # 0x47fc0
movzbl (%rcx,%rax), %ebp
leaq 0x47c35(%rip), %rax     # 0x5a622
cmpb $0x1, (%rax)
je 0x12af1
movl %ebp, %eax
movq %rax, %rcx
shlq $0x5, %rcx
movq 0x18(%rsp), %rdx
leaq (%rdx,%rcx), %rbx
addq $0x20, %rbx
leaq 0x4939d(%rip), %rcx     # 0x5bdb0
movq (%rcx), %rdx
movl 0x10(%rbx), %ecx
cmpl (%rdx,%rax,4), %ecx
je 0x12b01
movq 0x18(%rbx), %rax
movl %ecx, %edx
movq %r14, (%rax,%rdx,8)
incl %ecx
movl %ecx, 0x10(%rbx)
movq 0x18(%rsp), %rcx
movl 0x18(%rcx), %eax
incl %eax
movl %eax, 0x18(%rcx)
cmpl $0xd3, %eax
jne 0x128dc
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
jmp 0x12982
movq %r14, %rdi
callq 0x36c66
movq (%r13), %rcx
notq %rcx
andq %r15, %rcx
jmp 0x12635
movq %r14, %rdi
callq 0x36d46
jmp 0x12680
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0x12680
testq %r12, %r12
js 0x12b1f
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 0x124dd
leaq 0xfff(%r15), %rcx
andq %r8, %rcx
cmpq $0x1, %rcx
movq %rsi, %r10
sbbq $0x0, %r10
jmp 0x1277d
movq %rbx, %rdi
callq 0x36dea
movl %eax, %ebp
jmp 0x129e6
movq %r14, %rdi
movq %rbx, %rsi
callq 0x298b4
jmp 0x129f6
shrl %ecx
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
movl %ebp, %edx
movq 0x18(%rsp), %r8
callq 0x3ca47
movl 0x10(%rbx), %ecx
jmp 0x12a22
orq $0xfff, %r15            # imm = 0xFFF
andq %r12, %r15
cmpq $0x1, %r15
sbbq $0x0, %rsi
jmp 0x12aa5
movq %rax, %r13
jmp 0x125be