// File: CMU-SAFARI[P]MQSim/src/host/IO_Flow_Base.cpp
// Function: Host_Components::IO_Flow_Base::~IO_Flow_Base()
IO_Flow_Base::~IO_Flow_Base()
	{
		log_file.close();
		for(auto &req : waiting_requests) {
			if (req) {
				delete req;
			}
		}

		switch (SSD_device_type) {
			case HostInterface_Types::NVME:
				for (auto &req : nvme_software_request_queue) {
					if (req.second) {
						delete req.second;
					}
				}
				break;
			case HostInterface_Types::SATA:
				break;
			default:
				PRINT_ERROR("Unsupported host interface type in IO_Flow_Base!")
		}

	}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movq 0x80(%rsp), %rdi
movq %rdi, 0x28(%rsp)
leaq 0xa85a5(%rip), %rax     # 0xd8b98
movq %rax, (%rdi)
leaq 0xa85f3(%rip), %rax     # 0xd8bf0
movq %rax, 0x30(%rdi)
addq $0x258, %rdi            # imm = 0x258
callq 0x8600
jmp 0x3060f
movq 0x28(%rsp), %rax
addq $0x100, %rax            # imm = 0x100
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rdi
callq 0x34180
movq %rax, 0x60(%rsp)
movq 0x68(%rsp), %rdi
callq 0x341b0
movq %rax, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x341e0
testb $0x1, %al
jne 0x30655
jmp 0x3072e
leaq 0x60(%rsp), %rdi
callq 0x34200
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
cmpq $0x0, (%rax)
je 0x3071d
movq 0x50(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, %rax
je 0x30690
movq 0x20(%rsp), %rdi
callq 0x8410
jmp 0x3071d
movq 0x28(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
addq $0x258, %rdi            # imm = 0x258
callq 0x8640
movq 0x28(%rsp), %rdi
addq $0x238, %rdi            # imm = 0x238
callq 0x8848
movq 0x28(%rsp), %rdi
addq $0x118, %rdi            # imm = 0x118
callq 0x340f0
movq 0x28(%rsp), %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x34100
movq 0x28(%rsp), %rdi
addq $0xe8, %rdi
callq 0x34110
movq 0x28(%rsp), %rdi
addq $0xb8, %rdi
callq 0x34170
movq 0x28(%rsp), %rdi
callq 0x1ff90
movq 0x78(%rsp), %rdi
callq 0x8560
jmp 0x3071f
leaq 0x60(%rsp), %rdi
callq 0x34220
jmp 0x3063d
movq 0x28(%rsp), %rax
movl 0x54(%rax), %eax
movl %eax, 0x1c(%rsp)
testl %eax, %eax
je 0x307e1
jmp 0x30744
movl 0x1c(%rsp), %eax
subl $0x1, %eax
jne 0x307e3
jmp 0x30753
movq 0x28(%rsp), %rax
addq $0x118, %rax            # imm = 0x118
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rdi
callq 0x34240
movq %rax, 0x40(%rsp)
movq 0x48(%rsp), %rdi
callq 0x34270
movq %rax, 0x38(%rsp)
leaq 0x40(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x342a0
testb $0x1, %al
jne 0x30796
jmp 0x307df
leaq 0x40(%rsp), %rdi
callq 0x342c0
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x307d1
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x307cf
movq 0x10(%rsp), %rdi
callq 0x8410
jmp 0x307d1
jmp 0x307d3
leaq 0x40(%rsp), %rdi
callq 0x342e0
jmp 0x30781
jmp 0x3083d
jmp 0x3083d
movq 0xa9806(%rip), %rdi     # 0xd9ff0
leaq 0x7a0f7(%rip), %rsi     # 0xaa8e8
callq 0x8440
jmp 0x307f8
movq 0xa97f1(%rip), %rdi     # 0xd9ff0
leaq 0x7b224(%rip), %rsi     # 0xaba2a
callq 0x8440
movq %rax, 0x8(%rsp)
jmp 0x30812
movq 0x8(%rsp), %rdi
movq 0xa973a(%rip), %rsi     # 0xd9f58
callq 0x8480
jmp 0x30825
movq 0xa97a4(%rip), %rdi     # 0xd9fd0
callq 0x84f0
jmp 0x30833
movl $0x1, %edi
callq 0x8500
movq 0x28(%rsp), %rdi
addq $0x258, %rdi            # imm = 0x258
callq 0x8640
movq 0x28(%rsp), %rdi
addq $0x238, %rdi            # imm = 0x238
callq 0x8848
movq 0x28(%rsp), %rdi
addq $0x118, %rdi            # imm = 0x118
callq 0x340f0
movq 0x28(%rsp), %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x34100
movq 0x28(%rsp), %rdi
addq $0xe8, %rdi
callq 0x34110
movq 0x28(%rsp), %rdi
addq $0xb8, %rdi
callq 0x34170
movq 0x28(%rsp), %rdi
callq 0x1ff90
addq $0x88, %rsp
retq
nopw %cs:(%rax,%rax)