// File: /workspace/github_c_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl 0x48da2(%rip), %r12d    # 0x5bdb8
shll $0x5, %r12d
addl $0x27, %r12d
andl $-0x20, %r12d
movl 0x48d98(%rip), %eax     # 0x5bdc0
leaq (%r12,%rax,8), %rax
pushq $-0x1
popq %rdx
pushq $0x7
popq %rsi
cmpq $0x3800, %rax           # imm = 0x3800
ja 0x1307a
leal 0x3f(%rax), %edi
andl $0x7fc0, %edi           # imm = 0x7FC0
cmpl $0x1000, %edi           # imm = 0x1000
ja 0x13274
leaq -0x1(%rdi), %rcx
shrq $0x3, %rcx
leaq 0x34f62(%rip), %rdi     # 0x47fc0
movzbl (%rdi,%rcx), %ecx
leaq 0x347d7(%rip), %rdi     # 0x47840
movq (%rdi,%rcx,8), %r15
cmpq $0x4000, %r15           # imm = 0x4000
jb 0x1314a
leaq 0x484bf(%rip), %r8      # 0x5b540
leaq 0x48620(%rip), %rcx     # 0x5b6a8
movq (%rcx), %rdi
pushq $0x40
popq %rcx
cmpq %rax, (%r8)
jb 0x130ea
cmpq $0x41, %rdi
jb 0x130ea
movl $0x4000, %r15d          # imm = 0x4000
cmpq $0x4001, %rax           # imm = 0x4001
jb 0x130d2
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 0x48488(%rip), %r9      # 0x5b568
movl $0x1000, %ecx           # imm = 0x1000
cmpq (%r9), %r8
jbe 0x1314a
leaq 0x485bf(%rip), %r8      # 0x5b6b0
movq (%r8), %r8
addq %r8, %rcx
notq %r8
andq %rcx, %r8
je 0x13133
cmpq %rax, %rdi
jae 0x13138
cmpq $0x1000, %rax           # imm = 0x1000
ja 0x132a4
leaq -0x1(%rax), %rcx
shrq $0x3, %rcx
leaq 0x34ea1(%rip), %rdx     # 0x47fc0
movzbl (%rdx,%rcx), %ecx
leaq 0x34716(%rip), %rdx     # 0x47840
movq (%rdx,%rcx,8), %rdi
cmpq %rax, %rdi
jae 0x13138
xorl %r15d, %r15d
jmp 0x1314a
movl $0xfff, %eax            # imm = 0xFFF
subq %r8, %rax
xorl %r15d, %r15d
cmpq %rdi, %rax
cmovaeq %rdi, %r15
callq 0x21b4c
pushq $0x40
popq %rcx
pushq $0x1
popq %rbp
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
movl %ebp, %r8d
xorl %r9d, %r9d
callq 0x28c3d
movq %rax, %r14
testq %rax, %rax
je 0x13227
leaq 0x48534(%rip), %r13     # 0x5b6b0
movq (%r13), %rax
notq %rax
andq %r14, %rax
cmpq %rax, %r14
je 0x13239
movq (%rax), %r15
cmpq %rax, %r14
je 0x13253
movq %r14, %rcx
subq %rax, %rcx
shrq $0xc, %rcx
leaq 0x483ac(%rip), %rdx     # 0x5b558
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 0x13260
movl %ecx, %eax
leaq 0x3466f(%rip), %rcx     # 0x47840
movq (%rcx,%rax,8), %rax
lock
xaddq %rax, 0x58(%r15)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3cc12
movq 0x48bcb(%rip), %rax     # 0x5bdb8
testq %rax, %rax
je 0x13227
leaq 0x20(%r14), %rcx
xorl %edx, %edx
movq %rdx, %rsi
shlq $0x5, %rsi
movl $0x1, 0xc(%rcx,%rsi)
leaq (%r12,%r14), %rdi
movq %rdi, 0x18(%rcx,%rsi)
movq 0x48b99(%rip), %rsi     # 0x5bdb0
movl (%rsi,%rdx,4), %edx
leaq (%r12,%rdx,8), %r12
movl %ebp, %edx
incl %ebp
cmpq %rdx, %rax
ja 0x131f8
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x36d3b
movq %rax, %r15
movq (%r13), %rax
notq %rax
andq %r14, %rax
jmp 0x13192
movq %r14, %rdi
callq 0x36d46
jmp 0x131d5
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0x131d5
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 0x1306d
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 0x1312e