// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/deps/jemalloc/src/tcache.c
// Function: tcache_destroy
void
tcache_destroy(tcache_t *tcache)
{
	unsigned i;
	size_t tcache_size;

	tcache_arena_dissociate(tcache);

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

		if (config_stats && tbin->tstats.nrequests != 0) {
			arena_t *arena = tcache->arena;
			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(tbin, i, 0, tcache);

		if (config_stats && tbin->tstats.nrequests != 0) {
			arena_t *arena = tcache->arena;
			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) {
		malloc_mutex_lock(&tcache->arena->lock);
		arena_prof_accum(tcache->arena, tcache->prof_accumbytes);
		malloc_mutex_unlock(&tcache->arena->lock);
	}

	tcache_size = arena_salloc(tcache, false);
	if (tcache_size <= SMALL_MAXCLASS) {
		arena_chunk_t *chunk = CHUNK_ADDR2BASE(tcache);
		arena_t *arena = chunk->arena;
		size_t pageind = ((uintptr_t)tcache - (uintptr_t)chunk) >>
		    LG_PAGE;
		arena_chunk_map_t *mapelm = arena_mapp_get(chunk, pageind);

		arena_dalloc_bin(arena, chunk, tcache, pageind, mapelm);
	} else if (tcache_size <= tcache_maxclass) {
		arena_chunk_t *chunk = CHUNK_ADDR2BASE(tcache);
		arena_t *arena = chunk->arena;

		arena_dalloc_large(arena, chunk, tcache);
	} else
		idallocx(tcache, false);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0xd5d30
movl $0x0, -0xc(%rbp)
cmpl $0x1c, -0xc(%rbp)
jae 0xd6226
movq -0x8(%rbp), %rax
addq $0x28, %rax
movl -0xc(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %eax
movl %eax, %esi
movq -0x8(%rbp), %rcx
xorl %edx, %edx
callq 0xd5640
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
je 0xd6216
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
addq $0x120, %rax            # imm = 0x120
movl -0xc(%rbp), %ecx
imulq $0x98, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0xd5bf0
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq -0x30(%rbp), %rax
addq 0x68(%rax), %rcx
movq %rcx, 0x68(%rax)
movq -0x30(%rbp), %rdi
callq 0xd5c50
jmp 0xd6218
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xd618c
jmp 0xd6228
movl -0xc(%rbp), %eax
cmpq 0x642be(%rip), %rax     # 0x13a4f0
jae 0xd62db
movq -0x8(%rbp), %rax
addq $0x28, %rax
movl -0xc(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movl -0xc(%rbp), %eax
movl %eax, %esi
movq -0x8(%rbp), %rcx
xorl %edx, %edx
callq 0xd58d0
movq -0x38(%rbp), %rax
cmpq $0x0, (%rax)
je 0xd62cb
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
addq $0x8, %rdi
callq 0xd5bf0
movq -0x38(%rbp), %rax
movq (%rax), %rcx
movq -0x40(%rbp), %rax
addq 0x68(%rax), %rcx
movq %rcx, 0x68(%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rcx
movq -0x40(%rbp), %rax
movq 0x70(%rax), %rax
movl -0xc(%rbp), %edx
subl $0x1c, %edx
movl %edx, %edx
shlq $0x5, %rdx
addq %rdx, %rax
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x40(%rbp), %rdi
addq $0x8, %rdi
callq 0xd5c50
jmp 0xd62cd
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xd6228
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0xd5440
movq %rax, -0x18(%rbp)
cmpq $0xe00, -0x18(%rbp)     # imm = 0xE00
ja 0xd6357
movq -0x8(%rbp), %rax
leaq 0x52ed1(%rip), %rcx     # 0x1291d0
movq (%rcx), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq -0x48(%rbp), %rcx
subq %rcx, %rax
shrq $0xc, %rax
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0xd5c10
movq %rax, -0x60(%rbp)
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x8(%rbp), %rdx
movq -0x58(%rbp), %rcx
movq -0x60(%rbp), %r8
callq 0xb72f0
jmp 0xd63a8
movq -0x18(%rbp), %rax
cmpq 0x6419e(%rip), %rax     # 0x13a500
ja 0xd639b
movq -0x8(%rbp), %rax
leaq 0x52e61(%rip), %rcx     # 0x1291d0
movq (%rcx), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x8(%rbp), %rdx
callq 0xb79c0
jmp 0xd63a6
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0xd63b0
jmp 0xd63a8
addq $0x70, %rsp
popq %rbp
retq
nop