// File: /workspace/github_c_makefile_star2_O3/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, %rbx
movq %rdi, %r14
movq 0x28(%rdi), %r15
testq %r15, %r15
je 0x3d0cb
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3cc86
movq %rbx, 0x10(%rsp)
addq $0x20, %rbx
leaq 0x450(%r15), %r12
xorl %r13d, %r13d
movq %rbx, %rbp
movq %r14, %rdi
movq %rbp, %rdx
movl %r13d, %ecx
xorl %r8d, %r8d
callq 0x3c88f
cmpq $0x0, (%rbp)
je 0x3cf82
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
cmpq $0x27, %r13
jne 0x3cf4e
movq %r15, 0x8(%rsp)
cmpq $0x28, 0x1ee15(%rip)    # 0x5bdb8
jb 0x3d019
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %r12
movl $0x27, %r15d
movl $0x27, %r13d
shlq $0x5, %r13
leaq (%rbx,%r13), %rbp
movq %r14, %rdi
movq %rbp, %rsi
movl %r15d, %edx
xorl %ecx, %ecx
callq 0x3ca47
cmpq $0x0, (%rbx,%r13)
je 0x3d00a
movq %r12, %rdi
callq 0x106d0
movq (%rbp), %rax
movq 0x8(%rsp), %rcx
addq %rax, 0x78(%rcx)
movq 0x98(%rcx), %rcx
leal -0x27(%r15), %edx
shlq $0x5, %rdx
addq %rax, 0x10(%rcx,%rdx)
movq %r12, %rdi
callq 0x10440
incl %r15d
movq %r15, %r13
cmpq %r15, 0x1eda1(%rip)     # 0x5bdb8
ja 0x3cfba
leaq 0x1e690(%rip), %rbx     # 0x5b6b0
movq (%rbx), %rax
notq %rax
movq 0x10(%rsp), %r12
andq %r12, %rax
cmpq %r12, %rax
je 0x3d0db
movq (%rax), %r15
cmpq %r12, %rax
je 0x3d0f4
movq %r12, %rcx
subq %rax, %rcx
shrq $0xc, %rcx
leaq 0x1e504(%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 0x3d11c
movl %ecx, %eax
leaq 0xa7c7(%rip), %rcx      # 0x47840
movq (%rcx,%rax,8), %rax
negq %rax
lock
xaddq %rax, 0x58(%r15)
movq (%rbx), %rsi
notq %rsi
andq %r12, %rsi
cmpq %r12, %rsi
je 0x3d101
movq %r12, %rcx
subq %rsi, %rcx
shrq $0xc, %rcx
leaq 0x1e4b3(%rip), %rax     # 0x5b558
movq %rcx, %rdx
subq (%rax), %rdx
testb $0x2, 0x68(%rsi,%rdx,8)
movq (%rsi), %rdi
movq %r12, %rdx
jne 0x3d130
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x298af
movq %r14, %rdi
callq 0x22135
movq %rax, %r15
jmp 0x3cf2d
movq %r12, %rdi
callq 0x36d3b
movq %rax, %r15
movq (%rbx), %rax
notq %rax
andq %r12, %rax
jmp 0x3d03a
movq %r12, %rdi
callq 0x36d46
jmp 0x3d07d
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x36925
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0x3d07d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x299db