// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/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, %r14
movq %rdi, 0x8(%rsp)
callq 0x37351
movq %rax, %r15
movq %rax, %rbx
movq %r14, %rdi
movq %rax, %rsi
callq 0x373d3
movq %r14, 0x10(%rsp)
addq $0x20, %r14
leaq 0x450(%r15), %r12
xorl %r13d, %r13d
movq %r14, %rbp
cmpq $0x27, %r13
je 0x37959
movq 0x8(%rsp), %rdi
movq %rbp, %rdx
movl %r13d, %ecx
xorl %r8d, %r8d
callq 0x37034
cmpq $0x0, (%rbp)
je 0x37949
movq %r12, %rdi
callq 0x106d0
movq (%rbp), %rax
addq %rax, 0xa8(%r12)
movq %r12, %rdi
callq 0x10440
incq %r13
addq $0x20, %rbp
addq $0xe0, %r12
jmp 0x3790d
addq $0x8, %r15
xorl %r13d, %r13d
leal 0x27(%r13), %edx
cmpq %rdx, 0x2044d(%rip)     # 0x57db8
jbe 0x379be
movq %rdx, %rbp
shlq $0x5, %rbp
leaq (%r14,%rbp), %r12
movq 0x8(%rsp), %rdi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0x371b7
cmpq $0x0, (%r14,%rbp)
je 0x379b9
movq %r15, %rdi
callq 0x106d0
movq (%r12), %rax
addq %rax, 0x78(%rbx)
movq 0x98(%rbx), %rcx
movl %r13d, %edx
shlq $0x5, %rdx
addq %rax, 0x10(%rcx,%rdx)
movq %r15, %rdi
callq 0x10440
incl %r13d
jmp 0x37960
leaq 0x1fceb(%rip), %rbx     # 0x576b0
movq (%rbx), %rax
notq %rax
movq 0x10(%rsp), %r14
andq %r14, %rax
cmpq %r14, %rax
je 0x37a70
movq (%rax), %r15
cmpq %r14, %rax
je 0x37a89
movq %r14, %rcx
subq %rax, %rcx
shrq $0xc, %rcx
leaq 0x1fb5f(%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 0x37ab0
movl %ecx, %eax
leaq 0xa962(%rip), %rcx      # 0x42380
movq (%rcx,%rax,8), %rax
negq %rax
lock
xaddq %rax, 0x58(%r15)
movq (%rbx), %rsi
notq %rsi
andq %r14, %rsi
cmpq %r14, %rsi
je 0x37a93
movq %r14, %rcx
subq %rsi, %rcx
shrq $0xc, %rcx
leaq 0x1fb0e(%rip), %rax     # 0x57558
movq %rcx, %rdx
subq (%rax), %rdx
testb $0x2, 0x68(%rsi,%rdx,8)
movq (%rsi), %rdi
movq %r14, %rdx
jne 0x37ac4
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x244f0
movq %r14, %rdi
callq 0x311b6
movq %rax, %r15
movq (%rbx), %rax
notq %rax
andq %r14, %rax
jmp 0x379df
movq %r14, %rdi
callq 0x311c1
jmp 0x37a22
movq 0x8(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x30dbc
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0x37a22
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x24608