// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/deps/jemalloc/src/prof.c
// Function: prof_tdata_cleanup
void
prof_tdata_cleanup(void *arg)
{
	prof_thr_cnt_t *cnt;
	prof_tdata_t *prof_tdata = *(prof_tdata_t **)arg;

	cassert(config_prof);

	if (prof_tdata == PROF_TDATA_STATE_REINCARNATED) {
		/*
		 * Another destructor deallocated memory after this destructor
		 * was called.  Reset prof_tdata to PROF_TDATA_STATE_PURGATORY
		 * in order to receive another callback.
		 */
		prof_tdata = PROF_TDATA_STATE_PURGATORY;
		prof_tdata_tsd_set(&prof_tdata);
	} else if (prof_tdata == PROF_TDATA_STATE_PURGATORY) {
		/*
		 * The previous time this destructor was called, we set the key
		 * to PROF_TDATA_STATE_PURGATORY so that other destructors
		 * wouldn't cause re-creation of the prof_tdata.  This time, do
		 * nothing, so that the destructor will not be called again.
		 */
	} else if (prof_tdata != NULL) {
		/*
		 * Delete the hash table.  All of its contents can still be
		 * iterated over via the LRU.
		 */
		ckh_delete(&prof_tdata->bt2cnt);
		/*
		 * Iteratively merge cnt's into the global stats and delete
		 * them.
		 */
		while ((cnt = ql_last(&prof_tdata->lru_ql, lru_link)) != NULL) {
			ql_remove(&prof_tdata->lru_ql, cnt, lru_link);
			prof_ctx_merge(cnt->ctx, cnt);
			idalloc(cnt);
		}
		idalloc(prof_tdata->vec);
		idalloc(prof_tdata);
		prof_tdata = PROF_TDATA_STATE_PURGATORY;
		prof_tdata_tsd_set(&prof_tdata);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0xcf2b9
jmp 0xcf2bb
jmp 0xcf2bd
movl $0x1, %eax
cmpq %rax, -0x18(%rbp)
jne 0xcf2df
movl $0x2, %eax
movq %rax, -0x18(%rbp)
leaq -0x18(%rbp), %rdi
callq 0xcf230
jmp 0xcf409
movl $0x2, %eax
cmpq %rax, -0x18(%rbp)
jne 0xcf2ef
jmp 0xcf407
cmpq $0x0, -0x18(%rbp)
je 0xcf405
movq -0x18(%rbp), %rdi
callq 0xdb480
movq -0x18(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0xcf320
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0xcf328
xorl %eax, %eax
movq %rax, -0x20(%rbp)
jmp 0xcf328
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0xcf3dd
jmp 0xcf33c
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0xcf35e
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x10(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
cmpq -0x10(%rbp), %rax
je 0xcf3b0
jmp 0xcf36e
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0xcf3bc
movq -0x18(%rbp), %rax
movq $0x0, 0x30(%rax)
jmp 0xcf3be
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0xce7a0
movq -0x10(%rbp), %rdi
callq 0xce700
jmp 0xcf303
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0xce700
movq -0x18(%rbp), %rdi
callq 0xce700
movl $0x2, %eax
movq %rax, -0x18(%rbp)
leaq -0x18(%rbp), %rdi
callq 0xcf230
jmp 0xcf407
jmp 0xcf409
addq $0x20, %rsp
popq %rbp
retq
nop