// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x207b6(%rip), %r12d    # 0x57db8
shll $0x5, %r12d
addl $0x27, %r12d
andl $-0x20, %r12d
movl 0x207ac(%rip), %eax     # 0x57dc0
leaq (%r12,%rax,8), %rax
pushq $-0x1
popq %rdx
pushq $0x7
popq %rsi
cmpq $0x3800, %rax           # imm = 0x3800
ja 0x37666
leal 0x3f(%rax), %edi
andl $0x7fc0, %edi           # imm = 0x7FC0
cmpl $0x1000, %edi           # imm = 0x1000
ja 0x37853
leaq -0x1(%rdi), %rcx
shrq $0x3, %rcx
leaq 0xb4b6(%rip), %rdi      # 0x42b00
movzbl (%rdi,%rcx), %ecx
leaq 0xad2b(%rip), %rdi      # 0x42380
movq (%rdi,%rcx,8), %r15
cmpq $0x4000, %r15           # imm = 0x4000
jb 0x37736
leaq 0x1fed3(%rip), %r8      # 0x57540
leaq 0x20034(%rip), %rcx     # 0x576a8
movq (%rcx), %rdi
pushq $0x40
popq %rcx
cmpq %rax, (%r8)
jb 0x376d6
cmpq $0x41, %rdi
jb 0x376d6
movl $0x4000, %r15d          # imm = 0x4000
cmpq $0x4001, %rax           # imm = 0x4001
jb 0x376be
leaq -0x1(,%rax,2), %rcx
bsrq %rcx, %r8
leal -0x3(%r8), %ecx
movq %rdx, %r15
shlq %cl, %r15
cmpq $0x6, %r8
notq %r15
cmovbq %rsi, %r15
leaq (%r15,%rax), %rcx
notq %r15
andq %rcx, %r15
leaq 0x1000(%r15), %r8
leaq 0x1fe9c(%rip), %r9      # 0x57568
movl $0x1000, %ecx           # imm = 0x1000
cmpq (%r9), %r8
jbe 0x37736
leaq 0x1ffd3(%rip), %r8      # 0x576b0
movq (%r8), %r8
addq %r8, %rcx
notq %r8
andq %rcx, %r8
je 0x3771f
cmpq %rax, %rdi
jae 0x37724
cmpq $0x1000, %rax           # imm = 0x1000
ja 0x37883
leaq -0x1(%rax), %rcx
shrq $0x3, %rcx
leaq 0xb3f5(%rip), %rdx      # 0x42b00
movzbl (%rdx,%rcx), %ecx
leaq 0xac6a(%rip), %rdx      # 0x42380
movq (%rdx,%rcx,8), %rdi
cmpq %rax, %rdi
jae 0x37724
xorl %r15d, %r15d
jmp 0x37736
movl $0xfff, %eax            # imm = 0xFFF
subq %r8, %rax
xorl %r15d, %r15d
cmpq %rdi, %rax
cmovaeq %rdi, %r15
callq 0x1c298
pushq $0x40
popq %rcx
pushq $0x1
popq %r8
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
xorl %r9d, %r9d
callq 0x23953
movq %rax, %r14
testq %rax, %rax
je 0x3780e
leaq 0x1ff4a(%rip), %r13     # 0x576b0
movq (%r13), %rax
notq %rax
andq %r14, %rax
cmpq %rax, %r14
je 0x3781b
movq (%rax), %r15
cmpq %rax, %r14
je 0x37835
movq %r14, %rcx
subq %rax, %rcx
shrq $0xc, %rcx
leaq 0x1fdc2(%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 0x3783f
movl %ecx, %eax
leaq 0xabc5(%rip), %rcx      # 0x42380
movq (%rcx,%rax,8), %rax
lock
xaddq %rax, 0x58(%r15)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3735f
movq 0x205e1(%rip), %rax     # 0x57db8
leaq 0x20(%r14), %rcx
xorl %edx, %edx
movl %edx, %edx
cmpq %rdx, %rax
jbe 0x3780e
movq %rdx, %rsi
shlq $0x5, %rsi
movl $0x1, 0xc(%rcx,%rsi)
leaq (%r12,%r14), %rdi
movq %rdi, 0x18(%rcx,%rsi)
movq 0x205ad(%rip), %rsi     # 0x57db0
movl (%rsi,%rdx,4), %esi
leaq (%r12,%rsi,8), %r12
incl %edx
jmp 0x377dd
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %r14, %rdi
callq 0x311b6
movq %rax, %r15
movq (%r13), %rax
notq %rax
andq %r14, %rax
jmp 0x3777c
movq %r14, %rdi
callq 0x311c1
jmp 0x377bf
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0x377bf
leaq -0x1(,%rdi,2), %rcx
bsrq %rcx, %r8
leal -0x3(%r8), %ecx
movq %rdx, %r15
shlq %cl, %r15
cmpq $0x6, %r8
notq %r15
cmovbq %rsi, %r15
leaq (%r15,%rdi), %rcx
notq %r15
andq %rcx, %r15
jmp 0x37659
leaq -0x1(,%rax,2), %rcx
bsrq %rcx, %rdi
leal -0x3(%rdi), %ecx
shlq %cl, %rdx
cmpq $0x6, %rdi
notq %rdx
cmovbq %rsi, %rdx
leaq (%rdx,%rax), %rcx
notq %rdx
andq %rcx, %rdx
movq %rdx, %rdi
jmp 0x3771a