// File: 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:
subq $0x118, %rsp            # imm = 0x118
movq %rdi, 0x110(%rsp)
movq 0x110(%rsp), %rax
movq %rax, 0xb8(%rsp)
leaq 0x6f6e2(%rip), %rcx     # 0xd9258
movq %rcx, (%rax)
movl 0x70(%rax), %eax
movl %eax, 0xc4(%rsp)
testl %eax, %eax
je 0x69b9e
jmp 0x69b89
movl 0xc4(%rsp), %eax
subl $0x1, %eax
je 0x69d1f
jmp 0x69f0f
movq 0xb8(%rsp), %rax
movq 0xc0(%rax), %rax
movq (%rax), %rax
movq %rax, 0xb0(%rsp)
cmpq $0x0, %rax
je 0x69bd8
movq 0xb0(%rsp), %rdi
callq 0x64410
movq 0xb0(%rsp), %rdi
callq 0x8410
jmp 0x69bda
movq 0xb8(%rsp), %rax
movq 0xd0(%rax), %rdi
callq 0x6bfa0
movq %rax, 0xa8(%rsp)
jmp 0x69bf8
movq 0xa8(%rsp), %rax
cmpq $0x0, %rax
je 0x69c65
movq 0xb8(%rsp), %rax
movq 0xd0(%rax), %rdi
callq 0x6bfb0
movq %rax, 0xa0(%rsp)
jmp 0x69c24
movq 0xa0(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x98(%rsp)
cmpq $0x0, %rax
je 0x69c4a
movq 0x98(%rsp), %rdi
callq 0x8410
movq 0xb8(%rsp), %rax
movq 0xd0(%rax), %rdi
callq 0x6bfc0
jmp 0x69c60
jmp 0x69bda
movq 0xb8(%rsp), %rax
movq 0xd8(%rax), %rax
movq %rax, 0x108(%rsp)
movq 0x108(%rsp), %rdi
callq 0x6bfd0
movq %rax, 0x100(%rsp)
movq 0x108(%rsp), %rdi
callq 0x6c000
movq %rax, 0xf8(%rsp)
leaq 0x100(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x6c030
testb $0x1, %al
jne 0x69cc1
jmp 0x69d1a
leaq 0x100(%rsp), %rdi
callq 0x6c050
movq %rax, 0xf0(%rsp)
movq 0xf0(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x90(%rsp)
cmpq $0x0, %rax
je 0x69d09
movq 0x90(%rsp), %rdi
callq 0x6c070
movq 0x90(%rsp), %rdi
callq 0x8410
jmp 0x69d0b
leaq 0x100(%rsp), %rdi
callq 0x6c0a0
jmp 0x69ca6
jmp 0x69f11
movl $0x0, 0xec(%rsp)
movq 0xb8(%rsp), %rcx
movl 0xec(%rsp), %eax
cmpl 0x74(%rcx), %eax
jae 0x69f0d
movq 0xb8(%rsp), %rax
movq 0xc0(%rax), %rax
movl 0xec(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0x88(%rsp)
cmpq $0x0, %rax
je 0x69d84
movq 0x88(%rsp), %rdi
callq 0x64410
movq 0x88(%rsp), %rdi
callq 0x8410
jmp 0x69d86
movq 0xb8(%rsp), %rax
movq 0xd0(%rax), %rdi
movl 0xec(%rsp), %eax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
addq %rax, %rdi
callq 0x6bfa0
movq %rax, 0x80(%rsp)
jmp 0x69db6
movq 0x80(%rsp), %rax
cmpq $0x0, %rax
je 0x69e3b
movq 0xb8(%rsp), %rax
movq 0xd0(%rax), %rdi
movl 0xec(%rsp), %eax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
addq %rax, %rdi
callq 0x6bfb0
movq %rax, 0x78(%rsp)
jmp 0x69df1
movq 0x78(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x70(%rsp)
cmpq $0x0, %rax
je 0x69e0e
movq 0x70(%rsp), %rdi
callq 0x8410
movq 0xb8(%rsp), %rax
movq 0xd0(%rax), %rdi
movl 0xec(%rsp), %eax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
addq %rax, %rdi
callq 0x6bfc0
jmp 0x69e36
jmp 0x69d86
movq 0xb8(%rsp), %rax
movq 0xd8(%rax), %rax
movl 0xec(%rsp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0xe0(%rsp)
movq 0xe0(%rsp), %rdi
callq 0x6bfd0
movq %rax, 0xd8(%rsp)
movq 0xe0(%rsp), %rdi
callq 0x6c000
movq %rax, 0xd0(%rsp)
leaq 0xd8(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x6c030
testb $0x1, %al
jne 0x69ea5
jmp 0x69ef5
leaq 0xd8(%rsp), %rdi
callq 0x6c050
movq %rax, 0xc8(%rsp)
movq 0xc8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x68(%rsp)
cmpq $0x0, %rax
je 0x69ee4
movq 0x68(%rsp), %rdi
callq 0x6c070
movq 0x68(%rsp), %rdi
callq 0x8410
jmp 0x69ee6
leaq 0xd8(%rsp), %rdi
callq 0x6c0a0
jmp 0x69e8a
jmp 0x69ef7
movl 0xec(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xec(%rsp)
jmp 0x69d2a
jmp 0x69f11
jmp 0x69f11
movq 0xb8(%rsp), %rax
movq 0xc0(%rax), %rax
movq %rax, 0x60(%rsp)
cmpq $0x0, %rax
je 0x69f35
movq 0x60(%rsp), %rdi
callq 0x8570
movq 0xb8(%rsp), %rax
movq 0xd0(%rax), %rax
movq %rax, 0x58(%rsp)
cmpq $0x0, %rax
je 0x69fa6
movq 0x58(%rsp), %rcx
movq %rcx, %rax
addq $-0x8, %rax
movq %rax, 0x48(%rsp)
imulq $0x50, -0x8(%rcx), %rdx
movq %rcx, %rax
addq %rdx, %rax
cmpq %rax, %rcx
movq %rax, 0x50(%rsp)
je 0x69f9c
movq 0x50(%rsp), %rdi
addq $-0x50, %rdi
movq %rdi, 0x40(%rsp)
callq 0x6bf80
movq 0x58(%rsp), %rcx
movq 0x40(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x50(%rsp)
jne 0x69f75
movq 0x48(%rsp), %rdi
callq 0x8570
movq 0xb8(%rsp), %rax
movq 0xd8(%rax), %rax
movq %rax, 0x38(%rsp)
cmpq $0x0, %rax
je 0x6a017
movq 0x38(%rsp), %rcx
movq %rcx, %rax
addq $-0x8, %rax
movq %rax, 0x28(%rsp)
imulq $0x18, -0x8(%rcx), %rdx
movq %rcx, %rax
addq %rdx, %rax
cmpq %rax, %rcx
movq %rax, 0x30(%rsp)
je 0x6a00d
movq 0x30(%rsp), %rdi
addq $-0x18, %rdi
movq %rdi, 0x20(%rsp)
callq 0x6c0c0
movq 0x38(%rsp), %rcx
movq 0x20(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x30(%rsp)
jne 0x69fe6
movq 0x28(%rsp), %rdi
callq 0x8570
movq 0xb8(%rsp), %rax
movq 0xf8(%rax), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, %rax
je 0x6a086
movq 0x18(%rsp), %rcx
movq %rcx, %rax
addq $-0x8, %rax
movq %rax, 0x8(%rsp)
imulq $0x30, -0x8(%rcx), %rdx
movq %rcx, %rax
addq %rdx, %rax
cmpq %rax, %rcx
movq %rax, 0x10(%rsp)
je 0x6a07c
movq 0x10(%rsp), %rdi
addq $-0x30, %rdi
movq %rdi, (%rsp)
callq 0x20b60
movq 0x18(%rsp), %rcx
movq (%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x10(%rsp)
jne 0x6a057
movq 0x8(%rsp), %rdi
callq 0x8570
movq 0xb8(%rsp), %rdi
callq 0x67ae0
addq $0x118, %rsp            # imm = 0x118
retq
movq %rax, %rdi
callq 0xd460
nopw %cs:(%rax,%rax)