// File: /workspace/github_c_makefile_star2_O1/erikdubbelboer[P]discnt/deps/jemalloc/src/tcache.c
// Function: je_tcache_create
tcache_t *
tcache_create(tsd_t *tsd, arena_t *arena)
{
	tcache_t *tcache;
	size_t size, stack_offset;
	unsigned i;

	size = offsetof(tcache_t, tbins) + (sizeof(tcache_bin_t) * nhbins);
	/* Naturally align the pointer stacks. */
	size = PTR_CEILING(size);
	stack_offset = size;
	size += stack_nelms * sizeof(void *);
	/* Avoid false cacheline sharing. */
	size = sa2u(size, CACHELINE);

	tcache = ipallocztm(tsd, size, CACHELINE, true, false, true, a0get());
	if (tcache == NULL)
		return (NULL);

	tcache_arena_associate(tcache, arena);

	assert((TCACHE_NSLOTS_SMALL_MAX & 1U) == 0);
	for (i = 0; i < nhbins; i++) {
		tcache->tbins[i].lg_fill_div = 1;
		tcache->tbins[i].avail = (void **)((uintptr_t)tcache +
		    (uintptr_t)stack_offset);
		stack_offset += tcache_bin_info[i].ncached_max * sizeof(void *);
	}

	return (tcache);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl 0x6f3ba(%rip), %r13d    # 0x84da8
shll $0x5, %r13d
addl $0x27, %r13d
andl $-0x20, %r13d
movl 0x6f3b0(%rip), %eax     # 0x84db0
leaq (,%rax,8), %rax
addq %r13, %rax
pushq $-0x1
popq %rdx
pushq $0xf
popq %rsi
cmpq $0x3800, %rax           # imm = 0x3800
ja 0x15a59
leal 0x3f(%rax), %edi
andl $0x7fc0, %edi           # imm = 0x7FC0
cmpl $0x1000, %edi           # imm = 0x1000
ja 0x15c61
leaq -0x1(%rdi), %rcx
shrq $0x3, %rcx
leaq 0x43dc3(%rip), %rdi     # 0x59800
movzbl (%rdi,%rcx), %ecx
leaq 0x43638(%rip), %rdi     # 0x59080
movq (%rdi,%rcx,8), %r15
cmpq $0x4000, %r15           # imm = 0x4000
jb 0x15b29
leaq 0x6ead0(%rip), %r8      # 0x84530
leaq 0x6ec31(%rip), %rcx     # 0x84698
movq (%rcx), %rdi
pushq $0x40
popq %rcx
cmpq %rax, (%r8)
jb 0x15ac9
cmpq $0x41, %rdi
jb 0x15ac9
movl $0x4000, %r15d          # imm = 0x4000
cmpq $0x4001, %rax           # imm = 0x4001
jb 0x15ab1
leaq -0x1(,%rax,2), %rcx
bsrq %rcx, %r8
leal -0x3(%r8), %ecx
movq %rdx, %r15
shlq %cl, %r15
cmpq $0x7, %r8
notq %r15
cmovbq %rsi, %r15
leaq (%r15,%rax), %rcx
notq %r15
andq %rcx, %r15
leaq 0x1000(%r15), %r8
leaq 0x6ea99(%rip), %r9      # 0x84558
movl $0x1000, %ecx           # imm = 0x1000
cmpq (%r9), %r8
jbe 0x15b29
leaq 0x6ebd0(%rip), %r8      # 0x846a0
movq (%r8), %r8
addq %r8, %rcx
notq %r8
andq %rcx, %r8
je 0x15b12
cmpq %rax, %rdi
jae 0x15b17
cmpq $0x1000, %rax           # imm = 0x1000
ja 0x15c91
leaq -0x1(%rax), %rcx
shrq $0x3, %rcx
leaq 0x43d02(%rip), %rdx     # 0x59800
movzbl (%rdx,%rcx), %ecx
leaq 0x43577(%rip), %rdx     # 0x59080
movq (%rdx,%rcx,8), %rdi
cmpq %rax, %rdi
jae 0x15b17
xorl %r15d, %r15d
jmp 0x15b29
movl $0xfff, %eax            # imm = 0xFFF
subq %r8, %rax
xorl %r15d, %r15d
cmpq %rdi, %rax
cmovaeq %rdi, %r15
callq 0x34670
xorl %r12d, %r12d
pushq $0x40
popq %rcx
pushq $0x1
popq %rbp
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
movl %ebp, %r8d
xorl %r9d, %r9d
callq 0x13e13
testq %rax, %rax
je 0x15c1e
movq %rax, %r14
leaq 0x6eb42(%rip), %r12     # 0x846a0
movq (%r12), %rax
notq %rax
andq %r14, %rax
cmpq %rax, %r14
je 0x15c30
movq (%rax), %r15
movq (%r12), %rax
notq %rax
andq %r14, %rax
movq %r14, %rcx
subq %rax, %rcx
je 0x15c40
shrq $0xc, %rcx
leaq 0x6e9b3(%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 0x15c4d
movl %ecx, %eax
leaq 0x434c6(%rip), %rcx     # 0x59080
movq (%rcx,%rax,8), %rax
lock
xaddq %rax, 0x58(%r15)
testq %r14, %r14
je 0x15c1b
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4ec03
movq 0x6f1cd(%rip), %rax     # 0x84da8
testq %rax, %rax
je 0x15c16
leaq 0x20(%r14), %rcx
xorl %edx, %edx
movq %rdx, %rsi
shlq $0x5, %rsi
movl $0x1, 0xc(%rcx,%rsi)
leaq (%r14,%r13), %rdi
movq %rdi, 0x18(%rcx,%rsi)
movq 0x6f19b(%rip), %rsi     # 0x84da0
movl (%rsi,%rdx,4), %edx
leaq (%r13,%rdx,8), %r13
movl %ebp, %edx
incl %ebp
cmpq %rdx, %rax
ja 0x15be6
movq %r14, %r12
jmp 0x15c1e
xorl %r12d, %r12d
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x48ccc
movq %rax, %r15
jmp 0x15b74
movq %r14, %rdi
callq 0x48cd7
jmp 0x15bbe
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0x15bbe
leaq -0x1(,%rdi,2), %rcx
bsrq %rcx, %r8
leal -0x3(%r8), %ecx
movq %rdx, %r15
shlq %cl, %r15
cmpq $0x7, %r8
notq %r15
cmovbq %rsi, %r15
leaq (%r15,%rdi), %rcx
notq %r15
andq %rcx, %r15
jmp 0x15a4c
leaq -0x1(,%rax,2), %rcx
bsrq %rcx, %rdi
leal -0x3(%rdi), %ecx
shlq %cl, %rdx
cmpq $0x7, %rdi
notq %rdx
cmovbq %rsi, %rdx
leaq (%rdx,%rax), %rcx
notq %rdx
andq %rcx, %rdx
movq %rdx, %rdi
jmp 0x15b0d