// File: /workspace/github_cpp_makefile_star2_O1/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 0x3af15(%rip), %rax     # 0x6e258
movq %rax, (%rdi)
movl 0x70(%rdi), %eax
testl %eax, %eax
je 0x33558
cmpl $0x1, %eax
jne 0x3346d
cmpl $0x0, 0x74(%rbx)
je 0x3346d
xorl %r15d, %r15d
movq 0xc0(%rbx), %rax
movq (%rax,%r15,8), %r14
testq %r14, %r14
je 0x33387
movq %r14, %rdi
callq 0x31dae
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 0x333f8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x333e7
callq 0x7370
movq 0xd0(%rbx), %rdi
addq %r14, %rdi
callq 0x35168
jmp 0x3338f
movq 0xd8(%rbx), %rax
movq %r15, (%rsp)
leaq (%r15,%r15,2), %rcx
leaq (%rax,%rcx,8), %r12
movq (%r12), %r13
cmpq %r12, %r13
je 0x3345a
movq 0x10(%r13), %r14
testq %r14, %r14
je 0x33454
leaq 0x40(%r14), %rbp
movq 0x40(%r14), %rdi
cmpq %rbp, %rdi
je 0x3343a
movq (%rdi), %r15
callq 0x7370
movq %r15, %rdi
cmpq %rbp, %r15
jne 0x3342a
movq 0x8(%r14), %rdi
leaq 0x18(%r14), %rax
cmpq %rax, %rdi
je 0x3344c
callq 0x7370
movq %r14, %rdi
callq 0x7370
movq (%r13), %r13
jmp 0x3340f
movq (%rsp), %r15
incq %r15
movl 0x74(%rbx), %eax
cmpq %rax, %r15
jb 0x33367
movq 0xc0(%rbx), %rdi
testq %rdi, %rdi
je 0x3347e
callq 0x7480
movq 0xd0(%rbx), %r15
testq %r15, %r15
je 0x334ba
leaq -0x8(%r15), %r14
movq -0x8(%r15), %rax
testq %rax, %rax
je 0x334b2
addq $-0x50, %r15
shlq $0x4, %rax
leaq (%rax,%rax,4), %r12
leaq (%r15,%r12), %rdi
callq 0x34fbc
addq $-0x50, %r12
jne 0x334a3
movq %r14, %rdi
callq 0x7480
movq 0xd8(%rbx), %r15
testq %r15, %r15
je 0x33506
leaq -0x8(%r15), %r14
movq -0x8(%r15), %rax
testq %rax, %rax
je 0x334fe
leaq (%rax,%rax,2), %rax
leaq (%r15,%rax,8), %r12
movq -0x18(%r12), %rdi
addq $-0x18, %r12
cmpq %r12, %rdi
je 0x334f9
movq (%rdi), %r13
callq 0x7370
movq %r13, %rdi
cmpq %r12, %r13
jne 0x334e9
cmpq %r15, %r12
jne 0x334db
movq %r14, %rdi
callq 0x7480
movq 0xf8(%rbx), %r15
testq %r15, %r15
je 0x33542
leaq -0x8(%r15), %r14
movq -0x8(%r15), %rax
testq %rax, %rax
je 0x3353a
addq $-0x30, %r15
shlq $0x4, %rax
leaq (%rax,%rax,2), %r12
leaq (%r15,%r12), %rdi
callq 0x1676e
addq $-0x30, %r12
jne 0x3352b
movq %r14, %rdi
callq 0x7480
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x32b82
movq 0xc0(%rbx), %rax
movq (%rax), %r14
testq %r14, %r14
je 0x33592
movq %r14, %rdi
callq 0x31dae
movq %r14, %rdi
callq 0x7370
jmp 0x33592
movq (%rax), %rdi
testq %rdi, %rdi
je 0x33586
callq 0x7370
movq 0xd0(%rbx), %rdi
callq 0x35168
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
jne 0x33579
movq 0xd8(%rbx), %r15
movq (%r15), %r12
cmpq %r15, %r12
je 0x3346d
movq 0x10(%r12), %r14
testq %r14, %r14
je 0x3362b
leaq 0x40(%r14), %r13
movq 0x40(%r14), %rdi
cmpq %r13, %rdi
je 0x33611
movq (%rdi), %rbp
callq 0x7370
movq %rbp, %rdi
cmpq %r13, %rbp
jne 0x33601
movq 0x8(%r14), %rdi
leaq 0x18(%r14), %rax
cmpq %rax, %rdi
je 0x33623
callq 0x7370
movq %r14, %rdi
callq 0x7370
movq (%r12), %r12
jmp 0x335e1
nop