// File: /workspace/github_c_makefile_star2_O1/erikdubbelboer[P]discnt/deps/jemalloc/src/tcache.c
// Function: tcache_destroy
static void
tcache_destroy(tsd_t *tsd, tcache_t *tcache)
{
	arena_t *arena;
	unsigned i;

	arena = arena_choose(tsd, NULL);
	tcache_arena_dissociate(tcache, arena);

	for (i = 0; i < NBINS; i++) {
		tcache_bin_t *tbin = &tcache->tbins[i];
		tcache_bin_flush_small(tsd, tcache, tbin, i, 0);

		if (config_stats && tbin->tstats.nrequests != 0) {
			arena_bin_t *bin = &arena->bins[i];
			malloc_mutex_lock(&bin->lock);
			bin->stats.nrequests += tbin->tstats.nrequests;
			malloc_mutex_unlock(&bin->lock);
		}
	}

	for (; i < nhbins; i++) {
		tcache_bin_t *tbin = &tcache->tbins[i];
		tcache_bin_flush_large(tsd, tbin, i, 0, tcache);

		if (config_stats && tbin->tstats.nrequests != 0) {
			malloc_mutex_lock(&arena->lock);
			arena->stats.nrequests_large += tbin->tstats.nrequests;
			arena->stats.lstats[i - NBINS].nrequests +=
			    tbin->tstats.nrequests;
			malloc_mutex_unlock(&arena->lock);
		}
	}

	if (config_prof && tcache->prof_accumbytes > 0 &&
	    arena_prof_accum(arena, tcache->prof_accumbytes))
		prof_idump();

	idalloctm(tsd, tcache, false, true);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x28(%rdi), %r15
testq %r15, %r15
je 0x4f0d3
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4ec77
leaq 0x20(%rbx), %r12
leaq 0x450(%r15), %r13
xorl %ebp, %ebp
movq %r14, %rdi
movq %r12, %rdx
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0x4e87e
cmpq $0x0, (%r12)
je 0x4ef70
movq %r13, %rdi
callq 0x12960
movq (%r12), %rax
addq %rax, 0xa8(%r13)
movq %r13, %rdi
callq 0x125c0
incq %rbp
addq $0x20, %r12
addq $0xe0, %r13
cmpq $0x24, %rbp
jne 0x4ef3e
movq %r15, 0x10(%rsp)
movq %rbx, 0x8(%rsp)
cmpq $0x25, 0x35e12(%rip)    # 0x84da8
jb 0x4f015
movq 0x8(%rsp), %rax
leaq 0x20(%rax), %rbx
movq 0x10(%rsp), %rax
leaq 0x8(%rax), %r12
movl $0x24, %r15d
movl $0x24, %r13d
shlq $0x5, %r13
leaq (%rbx,%r13), %rbp
movq %r14, %rdi
movq %rbp, %rsi
movl %r15d, %edx
xorl %ecx, %ecx
callq 0x4ea32
cmpq $0x0, (%rbx,%r13)
je 0x4f006
movq %r12, %rdi
callq 0x12960
movq (%rbp), %rax
movq 0x10(%rsp), %rcx
addq %rax, 0x78(%rcx)
movq 0x98(%rcx), %rcx
leal -0x24(%r15), %edx
shlq $0x5, %rdx
addq %rax, 0x10(%rcx,%rdx)
movq %r12, %rdi
callq 0x125c0
incl %r15d
movq %r15, %r13
cmpq %r15, 0x35d95(%rip)     # 0x84da8
ja 0x4efb6
leaq 0x35684(%rip), %r12     # 0x846a0
movq (%r12), %rax
notq %rax
movq 0x8(%rsp), %rbx
andq %rbx, %rax
cmpq %rbx, %rax
je 0x4f0e3
movq (%rax), %r15
movq (%r12), %rax
notq %rax
andq %rbx, %rax
cmpq %rbx, %rax
je 0x4f0f3
movq %rbx, %rcx
subq %rax, %rcx
shrq $0xc, %rcx
leaq 0x354ed(%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 0x4f118
movl %ecx, %eax
leaq 0xa000(%rip), %rcx      # 0x59080
movq (%rcx,%rax,8), %rax
negq %rax
lock
xaddq %rax, 0x58(%r15)
movq (%r12), %rsi
notq %rsi
andq %rbx, %rsi
cmpq %rbx, %rsi
je 0x4f0fd
movq %rbx, %rcx
subq %rsi, %rcx
shrq $0xc, %rcx
leaq 0x3549b(%rip), %rax     # 0x84548
movq %rcx, %rdx
subq (%rax), %rdx
testb $0x2, 0x68(%rsi,%rdx,8)
movq (%rsi), %rdi
movq %rbx, %rdx
jne 0x4f12c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3b9e8
movq %r14, %rdi
callq 0x34a5f
movq %rax, %r15
jmp 0x4ef26
movq %rbx, %rdi
callq 0x48ccc
movq %rax, %r15
jmp 0x4f037
movq %rbx, %rdi
callq 0x48cd7
jmp 0x4f084
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x488cb
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0x4f084
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3bb14