// File: /workspace/github_c_makefile_star2_O1/erikdubbelboer[P]discnt/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, %r14
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 $0xf
popq %rdx
movabsq $0x7ffffffffffff000, %r15 # imm = 0x7FFFFFFFFFFFF000
pushq $0x40
popq %rsi
jne 0x14daa
leaq (%r12,%r14), %rcx
decq %rcx
movq %r14, %r8
negq %r8
andq %rcx, %r8
cmpq $0x1000, %r8            # imm = 0x1000
ja 0x15226
decq %r8
shrq $0x3, %r8
leaq 0x44a73(%rip), %rcx     # 0x59800
movzbl (%rcx,%r8), %ecx
leaq 0x442e7(%rip), %r8      # 0x59080
movq (%r8,%rcx,8), %rbx
cmpq $0x4000, %rbx           # imm = 0x4000
jb 0x14e8b
leaq 0x6f77f(%rip), %rcx     # 0x84530
leaq 0x6f8e0(%rip), %r8      # 0x84698
movq (%r8), %r8
movq %r14, %r10
cmpq %r12, (%rcx)
jb 0x14e2b
movq %r14, %r10
cmpq %r14, %r8
jbe 0x14e2b
leaq 0xfff(%r14), %r10
andq $-0x1000, %r10          # imm = 0xF000
movl $0x4000, %ebx           # imm = 0x4000
cmpq $0x4001, %r12           # imm = 0x4001
jb 0x14e1b
testq %r12, %r12
js 0x15302
leaq -0x1(,%r12,2), %rcx
bsrq %rcx, %r11
leal -0x3(%r11), %ecx
movq %rax, %rbx
shlq %cl, %rbx
cmpq $0x7, %r11
notq %rbx
cmovbq %rdx, %rbx
leaq (%rbx,%r12), %rcx
notq %rbx
andq %rcx, %rbx
leaq (%rbx,%r10), %rcx
leaq 0x6f732(%rip), %r11     # 0x84558
cmpq (%r11), %rcx
jbe 0x14e8b
leaq 0x6f86e(%rip), %rcx     # 0x846a0
movq (%rcx), %r11
addq %r11, %r10
notq %r11
andq %r10, %r11
je 0x14e76
cmpq %r12, %r8
jae 0x14e7a
cmpq $0x1000, %r12           # imm = 0x1000
ja 0x1543c
leaq -0x1(%r12), %rax
shrq $0x3, %rax
leaq 0x4499e(%rip), %rcx     # 0x59800
movzbl (%rcx,%rax), %eax
leaq 0x44213(%rip), %rcx     # 0x59080
movq (%rcx,%rax,8), %r8
cmpq %r12, %r8
jae 0x14e7a
xorl %ebx, %ebx
jmp 0x14e8b
movl $0xfff, %eax            # imm = 0xFFF
subq %r11, %rax
xorl %ebx, %ebx
cmpq %r8, %rax
cmovaeq %r8, %rbx
testq %rbx, %rbx
je 0x15140
pushq $0x40
popq %rcx
xorl %ebp, %ebp
movl $0x80, %edx
movq %rdi, 0x18(%rsp)
movq %r13, %rsi
xorl %r8d, %r8d
movq %r9, 0x10(%rsp)
callq 0x13e13
testq %rax, %rax
je 0x15142
movq %rax, %r15
movq %rax, %rbx
leaq 0x6f7d7(%rip), %rcx     # 0x846a0
movq (%rcx), %rax
notq %rax
andq %r15, %rax
cmpq %rax, %r15
je 0x151f2
movq (%rax), %rbp
movq (%rcx), %rax
notq %rax
andq %r15, %rax
movq %r15, %rcx
subq %rax, %rcx
je 0x15205
shrq $0xc, %rcx
leaq 0x6f64a(%rip), %rdx     # 0x84548
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 0x15212
movl %ecx, %eax
leaq 0x4415d(%rip), %rcx     # 0x59080
movq (%rcx,%rax,8), %rax
lock
xaddq %rax, 0x58(%rbp)
testq %r15, %r15
je 0x15140
movl 0x24(%rsp), %eax
movb %al, 0xf(%rsp)
testq %r13, %r13
jne 0x14f55
movq 0x18(%rsp), %rax
movq 0x28(%rax), %r13
testq %r13, %r13
je 0x15358
testq %r13, %r13
je 0x1502b
leaq 0xf(%rsp), %rcx
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x39c78
testq %rax, %rax
je 0x1502b
movq %rax, %rbp
movb 0xf(%rsp), %al
movq %r13, (%rbx)
movq %rbp, 0x8(%rbx)
movq %r12, 0x10(%rbx)
movb %al, 0x18(%rbx)
movw $0x1, 0x19(%rbx)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x40504
testb %al, %al
je 0x15154
movq %r13, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x39e02
leaq 0x6f6e3(%rip), %rsi     # 0x846a0
movq (%rsi), %rax
notq %rax
andq %r15, %rax
cmpq %rax, %r15
je 0x15400
movq (%rax), %r14
movq (%rsi), %rax
notq %rax
andq %r15, %rax
movq %r15, %rcx
subq %rax, %rcx
je 0x15414
shrq $0xc, %rcx
leaq 0x6f556(%rip), %rdx     # 0x84548
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 0x15428
movl %ecx, %eax
leaq 0x44069(%rip), %rcx     # 0x59080
movq (%rcx,%rax,8), %rax
movq 0x10(%rsp), %rdx
negq %rax
lock
xaddq %rax, 0x58(%r14)
jmp 0x1509e
leaq 0x6f66e(%rip), %rsi     # 0x846a0
movq (%rsi), %rax
notq %rax
andq %r15, %rax
cmpq %rax, %r15
je 0x1531c
movq (%rax), %r14
movq (%rsi), %rax
notq %rax
andq %r15, %rax
movq %r15, %rcx
subq %rax, %rcx
je 0x15330
shrq $0xc, %rcx
leaq 0x6f4e1(%rip), %rdx     # 0x84548
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 0x15344
movl %ecx, %eax
leaq 0x43ff4(%rip), %rcx     # 0x59080
movq (%rcx,%rax,8), %rax
movq 0x10(%rsp), %rdx
negq %rax
lock
xaddq %rax, 0x58(%r14)
movq (%rsi), %rsi
notq %rsi
andq %r15, %rsi
subq %rsi, %r15
je 0x1525e
shrq $0xc, %r15
leaq 0x6f48d(%rip), %rax     # 0x84548
movq %r15, %rcx
subq (%rax), %rcx
movq 0x68(%rsi,%rcx,8), %rax
testb $0x2, %al
jne 0x15270
testq %rdx, %rdx
je 0x152a5
shrl $0x5, %eax
movzbl %al, %ebp
leaq 0x6e64e(%rip), %rax     # 0x83732
cmpb $0x1, (%rax)
movl %ebp, %r15d
je 0x152b8
movl %ebp, %eax
shll $0x5, %eax
leaq (%rdx,%rax), %r14
addq $0x20, %r14
leaq 0x6fc9c(%rip), %rax     # 0x84da0
movq (%rax), %rax
movl (%rax,%r15,4), %r8d
cmpl %r8d, 0x10(%r14)
movq 0x18(%rsp), %r15
je 0x152d5
movq 0x18(%r14), %rax
movl 0x10(%r14), %ecx
movq %rbx, (%rax,%rcx,8)
leal 0x1(%rcx), %eax
movl %eax, 0x10(%r14)
movl 0x18(%rdx), %eax
incl %eax
movl %eax, 0x18(%rdx)
cmpl $0xe4, %eax
je 0x152f2
xorl %ebp, %ebp
movq %rbp, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1d8(%r13), %r14
movq %r14, %rdi
callq 0x12960
movq %rbx, 0x48(%rbx)
movq %rbx, 0x50(%rbx)
movq 0x1d0(%r13), %rax
testq %rax, %rax
je 0x15199
movq 0x50(%rax), %rax
movq %rax, 0x50(%rbx)
movq 0x1d0(%r13), %rcx
movq %rcx, 0x48(%rbx)
movq %rbx, 0x48(%rax)
movq 0x1d0(%r13), %rax
movq %rbx, 0x50(%rax)
movq 0x48(%rbx), %rax
movq %rax, 0x1d0(%r13)
movq %r14, %rdi
callq 0x125c0
cmpb $0x0, 0x24(%rsp)
je 0x151cc
cmpb $0x0, 0xf(%rsp)
jne 0x15142
movq %rbp, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x12380
jmp 0x15142
leaq 0x6e570(%rip), %rax     # 0x83743
cmpb $0x1, (%rax)
je 0x151b3
leaq 0x6e552(%rip), %rax     # 0x83731
cmpb $0x1, (%rax)
jne 0x15142
movq %rbp, %rdi
movl $0xa5, %esi
jmp 0x151bf
movq %rbx, %rdi
movq %rcx, %rbp
callq 0x48bfc
movq %rbp, %rcx
jmp 0x14edb
movq %rbx, %rdi
callq 0x48cd7
jmp 0x14f27
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0x14f27
testq %r8, %r8
js 0x15474
leaq -0x1(,%r8,2), %rcx
bsrq %rcx, %r10
leal -0x3(%r10), %ecx
movq %rax, %rbx
shlq %cl, %rbx
cmpq $0x7, %r10
notq %rbx
cmovbq %rdx, %rbx
addq %rbx, %r8
notq %rbx
andq %r8, %rbx
jmp 0x14d9d
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq 0x488cb
jmp 0x15140
testq %rdx, %rdx
je 0x15295
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
leaq -0x1000(%rax), %r14
leaq 0x6fb44(%rip), %rcx     # 0x84dd0
cmpq (%rcx), %r14
jbe 0x1536a
movq (%rsi), %rdi
movq %rbx, %rdx
callq 0x3bb14
jmp 0x15140
movq (%rsi), %rdi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x3b9e8
jmp 0x15140
imulq $0x60, %r15, %rsi
addq 0x58d05(%rip), %rsi     # 0x6dfc8
movq %rbx, %rdi
callq 0x3b00b
movq 0x10(%rsp), %rdx
jmp 0x150f0
shrl %r8d
movq %r15, %rdi
movq %rdx, %rsi
movq %r14, %rdx
movl %ebp, %ecx
callq 0x4e87e
movq 0x10(%rsp), %rdx
jmp 0x1511a
movq %r15, %rdi
movq %rdx, %rsi
callq 0x4e7cd
jmp 0x15140
leaq 0xfff(%r15), %rcx
andq %r12, %rcx
cmpq $0x1, %rcx
movq %rsi, %r11
sbbq $0x0, %r11
jmp 0x14dfc
movq %rbx, %rdi
callq 0x48bfc
leaq 0x6f375(%rip), %rsi     # 0x846a0
jmp 0x15044
movq %rbx, %rdi
callq 0x48cd7
leaq 0x6f361(%rip), %rsi     # 0x846a0
jmp 0x15090
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0x15090
movq 0x18(%rsp), %rdi
callq 0x34a5f
movq %rax, %r13
jmp 0x14f55
cmpq $0x1000, %r14           # imm = 0x1000
ja 0x1548e
addq $-0x1001, %rax          # imm = 0xEFFF
shrq $0x3, %rax
leaq 0x44478(%rip), %rcx     # 0x59800
movzbl (%rcx,%rax), %ebp
leaq 0x6e39f(%rip), %rax     # 0x83732
cmpb $0x1, (%rax)
je 0x1549d
movl %ebp, %eax
leaq 0x6f9fb(%rip), %rcx     # 0x84da0
movq (%rcx), %rcx
movl (%rcx,%rax,4), %ecx
shlq $0x5, %rax
movq 0x10(%rsp), %rdx
leaq (%rdx,%rax), %r14
addq $0x20, %r14
cmpl %ecx, 0x10(%r14)
je 0x154ad
movq 0x18(%r14), %rax
movl 0x10(%r14), %ecx
movq %rbx, (%rax,%rcx,8)
leal 0x1(%rcx), %eax
movl %eax, 0x10(%r14)
movq 0x10(%rsp), %rcx
movl 0x18(%rcx), %eax
incl %eax
movl %eax, 0x18(%rcx)
cmpl $0xe4, %eax
jne 0x15140
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rsi
jmp 0x152f8
movq %rbx, %rdi
callq 0x48bfc
leaq 0x6f291(%rip), %rsi     # 0x846a0
jmp 0x14fcf
movq %rbx, %rdi
callq 0x48cd7
leaq 0x6f27d(%rip), %rsi     # 0x846a0
jmp 0x1501b
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0x1501b
testq %r12, %r12
js 0x154c8
leaq -0x1(,%r12,2), %rcx
bsrq %rcx, %rsi
leal -0x3(%rsi), %ecx
shlq %cl, %rax
cmpq $0x7, %rsi
notq %rax
cmovbq %rdx, %rax
leaq (%rax,%r12), %rcx
notq %rax
andq %rcx, %rax
movq %rax, %r8
jmp 0x14e71
leaq 0xfff(%r15), %rcx
andq %r8, %rcx
cmpq $0x1, %rcx
movq %rsi, %r10
sbbq $0x0, %r10
jmp 0x1523b
movq %r14, %rdi
callq 0x48d7b
movl %eax, %ebp
jmp 0x1538c
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3b9ed
jmp 0x1539c
shrl %ecx
movq 0x18(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
movq 0x10(%rsp), %r8
callq 0x4ea32
jmp 0x153c6
orq $0xfff, %r15            # imm = 0xFFF
andq %r12, %r15
cmpq $0x1, %r15
sbbq $0x0, %rsi
jmp 0x15451