// File: /workspace/github_cpp_makefile_star2_O3/CMU-SAFARI[P]MQSim/src/ssd/Data_Cache_Manager_Flash_Advanced.cpp
// Function: SSD_Components::Data_Cache_Manager_Flash_Advanced::~Data_Cache_Manager_Flash_Advanced()
Data_Cache_Manager_Flash_Advanced::~Data_Cache_Manager_Flash_Advanced()
	{
		switch (sharing_mode)
		{
			case SSD_Components::Cache_Sharing_Mode::SHARED:
			{
				delete per_stream_cache[0];
				while (dram_execution_queue[0].size()) {
					delete dram_execution_queue[0].front();
					dram_execution_queue[0].pop();
				}
				for (auto &req : waiting_user_requests_queue_for_dram_free_slot[0]) {
					delete req;
				}
				break;
			}
			case SSD_Components::Cache_Sharing_Mode::EQUAL_PARTITIONING:
				for (unsigned int i = 0; i < stream_count; i++) {
					delete per_stream_cache[i];
					while (dram_execution_queue[i].size()) {
						delete dram_execution_queue[i].front();
						dram_execution_queue[i].pop();
					}
					for (auto &req : waiting_user_requests_queue_for_dram_free_slot[i]) {
						delete req;
					}
				}
				break;
			default:
				break;
		}
		
		delete[] per_stream_cache;
		delete[] dram_execution_queue;
		delete[] waiting_user_requests_queue_for_dram_free_slot;
		delete[] bloom_filter;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x3b935(%rip), %rax     # 0x6e250
movq %rax, (%rdi)
movl 0x70(%rdi), %eax
testl %eax, %eax
je 0x32b2b
cmpl $0x1, %eax
jne 0x32a40
cmpl $0x0, 0x74(%rbx)
je 0x32a40
xorl %r15d, %r15d
movq 0xc0(%rbx), %rax
movq (%rax,%r15,8), %r14
testq %r14, %r14
je 0x32957
movq %r14, %rdi
callq 0x31540
movq %r14, %rdi
callq 0x7370
leaq (%r15,%r15,4), %r14
shlq $0x4, %r14
movq 0xd0(%rbx), %rcx
movq 0x48(%rcx,%r14), %rax
movq %rax, %rdx
subq 0x28(%rcx,%r14), %rdx
shrq $0x3, %rdx
cmpq $0x1, %rax
adcq $-0x1, %rdx
movq 0x30(%rcx,%r14), %rsi
subq 0x38(%rcx,%r14), %rsi
shlq $0x6, %rdx
sarq $0x3, %rsi
addq %rdx, %rsi
movq 0x10(%rcx,%r14), %rax
movq 0x20(%rcx,%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
addq %rsi, %rcx
je 0x329cb
movq (%rax), %rdi
callq 0x7370
movq 0xd0(%rbx), %rdi
addq %r14, %rdi
callq 0x3470a
jmp 0x32967
movq 0xd8(%rbx), %rax
movq %r15, (%rsp)
leaq (%r15,%r15,2), %rcx
leaq (%rax,%rcx,8), %r12
movq (%r12), %r13
cmpq %r12, %r13
je 0x32a2d
movq 0x10(%r13), %r14
testq %r14, %r14
je 0x32a1f
leaq 0x40(%r14), %rbp
movq 0x40(%r14), %rdi
cmpq %rbp, %rdi
je 0x32a0d
movq (%rdi), %r15
callq 0x7370
movq %r15, %rdi
cmpq %rbp, %r15
jne 0x329fd
movq 0x8(%r14), %rdi
leaq 0x18(%r14), %rax
cmpq %rax, %rdi
je 0x32a1f
callq 0x7370
movq %r14, %rdi
callq 0x7370
movq (%r13), %r13
jmp 0x329e2
movq (%rsp), %r15
incq %r15
movl 0x74(%rbx), %eax
cmpq %rax, %r15
jb 0x3293f
movq 0xc0(%rbx), %rdi
testq %rdi, %rdi
je 0x32a51
callq 0x7480
movq 0xd0(%rbx), %r15
testq %r15, %r15
je 0x32a8d
leaq -0x8(%r15), %r14
movq -0x8(%r15), %rax
testq %rax, %rax
je 0x32a85
addq $-0x50, %r15
shlq $0x4, %rax
leaq (%rax,%rax,4), %r12
leaq (%r15,%r12), %rdi
callq 0x34558
addq $-0x50, %r12
jne 0x32a76
movq %r14, %rdi
callq 0x7480
movq 0xd8(%rbx), %r15
testq %r15, %r15
je 0x32ad9
leaq -0x8(%r15), %r14
movq -0x8(%r15), %rax
testq %rax, %rax
je 0x32ad1
leaq (%rax,%rax,2), %rax
leaq (%r15,%rax,8), %r12
movq -0x18(%r12), %rdi
addq $-0x18, %r12
cmpq %r12, %rdi
je 0x32acc
movq (%rdi), %r13
callq 0x7370
movq %r13, %rdi
cmpq %r12, %r13
jne 0x32abc
cmpq %r15, %r12
jne 0x32aae
movq %r14, %rdi
callq 0x7480
movq 0xf8(%rbx), %r15
testq %r15, %r15
je 0x32b15
leaq -0x8(%r15), %r14
movq -0x8(%r15), %rax
testq %rax, %rax
je 0x32b0d
addq $-0x30, %r15
shlq $0x4, %rax
leaq (%rax,%rax,2), %r12
leaq (%r15,%r12), %rdi
callq 0x16674
addq $-0x30, %r12
jne 0x32afe
movq %r14, %rdi
callq 0x7480
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x32140
movq 0xc0(%rbx), %rax
movq (%rax), %r14
testq %r14, %r14
je 0x32b42
movq %r14, %rdi
callq 0x31540
movq %r14, %rdi
callq 0x7370
movq 0xd0(%rbx), %rcx
movq 0x48(%rcx), %rax
movq %rax, %rdx
subq 0x28(%rcx), %rdx
shrq $0x3, %rdx
cmpq $0x1, %rax
adcq $-0x1, %rdx
movq 0x30(%rcx), %rsi
subq 0x38(%rcx), %rsi
shlq $0x6, %rdx
sarq $0x3, %rsi
addq %rdx, %rsi
movq 0x10(%rcx), %rax
movq 0x20(%rcx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
addq %rsi, %rcx
je 0x32ba5
movq (%rax), %rdi
callq 0x7370
movq 0xd0(%rbx), %rdi
callq 0x3470a
jmp 0x32b4a
movq 0xd8(%rbx), %r15
movq (%r15), %r12
cmpq %r15, %r12
je 0x32a40
movq 0x10(%r12), %r14
testq %r14, %r14
je 0x32bf1
leaq 0x40(%r14), %r13
movq 0x40(%r14), %rdi
cmpq %r13, %rdi
je 0x32bdf
movq (%rdi), %rbp
callq 0x7370
movq %rbp, %rdi
cmpq %r13, %rbp
jne 0x32bcf
movq 0x8(%r14), %rdi
leaq 0x18(%r14), %rax
cmpq %rax, %rdi
je 0x32bf1
callq 0x7370
movq %r14, %rdi
callq 0x7370
movq (%r12), %r12
jmp 0x32baf
nop