// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x375f7(%rip), %rax     # 0x61230
movq %rax, (%rdi)
movl 0x70(%rdi), %eax
testl %eax, %eax
je 0x29cf6
cmpl $0x1, %eax
jne 0x29d76
xorl %r15d, %r15d
movl 0x74(%rbx), %eax
cmpq %rax, %r15
jae 0x29d76
movq 0xc0(%rbx), %rax
movq (%rax,%r15,8), %r14
testq %r14, %r14
je 0x29c77
movq %r14, %rdi
callq 0x287ec
movq %r14, %rdi
callq 0x7340
imulq $0x50, %r15, %r14
movq 0xd0(%rbx), %rdi
addq %r14, %rdi
callq 0x2afbe
testq %rax, %rax
je 0x29cbc
movq 0xd0(%rbx), %rax
movq 0x10(%rax,%r14), %rax
movq (%rax), %rdi
callq 0x7340
movq 0xd0(%rbx), %rdi
addq %r14, %rdi
callq 0x2b006
jmp 0x29c83
imulq $0x18, %r15, %r12
addq 0xd8(%rbx), %r12
movq %r12, %r13
movq (%r13), %r13
cmpq %r12, %r13
je 0x29cee
movq 0x10(%r13), %r14
testq %r14, %r14
je 0x29ce4
movq %r14, %rdi
callq 0x2ab0c
movq %r14, %rdi
callq 0x7340
jmp 0x29cca
incq %r15
jmp 0x29c53
movq 0xc0(%rbx), %rax
movq (%rax), %r14
testq %r14, %r14
je 0x29d0d
movq %r14, %rdi
callq 0x287ec
movq %r14, %rdi
callq 0x7340
movq 0xd0(%rbx), %rdi
callq 0x2afbe
testq %rax, %rax
je 0x29d47
movq 0xd0(%rbx), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
callq 0x7340
movq 0xd0(%rbx), %rdi
callq 0x2b006
jmp 0x29d15
movq 0xd8(%rbx), %r15
movq %r15, %r12
movq (%r12), %r12
cmpq %r15, %r12
je 0x29d76
movq 0x10(%r12), %r14
testq %r14, %r14
je 0x29d6c
movq %r14, %rdi
callq 0x2ab0c
movq %r14, %rdi
callq 0x7340
jmp 0x29d51
movq 0xc0(%rbx), %rdi
testq %rdi, %rdi
je 0x29d87
callq 0x7430
movq 0xd0(%rbx), %r15
testq %r15, %r15
je 0x29dbf
leaq -0x8(%r15), %r14
movq -0x8(%r15), %rax
testq %rax, %rax
je 0x29db7
addq $-0x50, %r15
imulq $0x50, %rax, %r12
leaq (%r15,%r12), %rdi
callq 0x2ad54
addq $-0x50, %r12
jne 0x29da8
movq %r14, %rdi
callq 0x7430
movq 0xd8(%rbx), %r15
testq %r15, %r15
je 0x29df7
leaq -0x8(%r15), %r14
movq -0x8(%r15), %rax
testq %rax, %rax
je 0x29def
addq $-0x18, %r15
imulq $0x18, %rax, %r12
leaq (%r15,%r12), %rdi
callq 0x2ada0
addq $-0x18, %r12
jne 0x29de0
movq %r14, %rdi
callq 0x7430
movq 0xf8(%rbx), %r15
testq %r15, %r15
je 0x29e2f
leaq -0x8(%r15), %r14
movq -0x8(%r15), %rax
testq %rax, %rax
je 0x29e27
addq $-0x30, %r15
imulq $0x30, %rax, %r12
leaq (%r15,%r12), %rdi
callq 0x11eea
addq $-0x30, %r12
jne 0x29e18
movq %r14, %rdi
callq 0x7430
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x294fe