// File: /workspace/github_cpp_makefile_star2_O1/CMU-SAFARI[P]MQSim/src/host/IO_Flow_Base.cpp
// Function: Host_Components::IO_Flow_Base::Submit_io_request(Host_Components::Host_IO_Request*)
void IO_Flow_Base::Submit_io_request(Host_IO_Request* request)
	{
		switch (SSD_device_type) {
			case HostInterface_Types::NVME:
				//If either of software or hardware queue is full
				if (NVME_SQ_FULL(nvme_queue_pair) || available_command_ids.size() == 0) {
					waiting_requests.push_back(request);
				} else {
					if (nvme_software_request_queue[*available_command_ids.begin()] != NULL) {
						PRINT_ERROR("Unexpteced situation in IO_Flow_Base! Overwriting an unhandled I/O request in the queue!")
					} else {
						request->IO_queue_info = *available_command_ids.begin();
						nvme_software_request_queue[*available_command_ids.begin()] = request;
						available_command_ids.erase(available_command_ids.begin());
						request_queue_in_memory[nvme_queue_pair.Submission_queue_tail] = request;
						NVME_UPDATE_SQ_TAIL(nvme_queue_pair);
					}
					request->Enqueue_time = Simulator->Time();
					pcie_root_complex->Write_to_device(nvme_queue_pair.Submission_tail_register_address_on_device, nvme_queue_pair.Submission_queue_tail);//Based on NVMe protocol definition, the updated tail pointer should be informed to the device
				}
				break;
			case HostInterface_Types::SATA:
				request->Source_flow_id = flow_id;
				sata_hba->Submit_io_request(request);
				break;
		}
	}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl 0x54(%rdi), %eax
testl %eax, %eax
je 0x1f872
cmpl $0x1, %eax
jne 0x1f98b
movzwl 0x82(%rbx), %eax
movzwl 0x84(%rbx), %ecx
decl %ecx
cmpl %eax, %ecx
jle 0x1f892
incl %eax
movzwl 0x80(%rbx), %ecx
cmpl %ecx, %eax
jne 0x1f8a0
jmp 0x1f964
movzwl 0x38(%rbx), %eax
movw %ax, 0x22(%r14)
movq 0x60(%rbx), %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x25926
cmpw $0x0, 0x80(%rbx)
je 0x1f964
cmpq $0x0, 0xe0(%rbx)
je 0x1f964
leaq 0x118(%rbx), %r15
movq 0xd0(%rbx), %rax
movzwl 0x20(%rax), %eax
movq %rsp, %rsi
movq %rax, (%rsi)
movq %r15, %rdi
callq 0x219d8
cmpq $0x0, (%rax)
jne 0x1f997
leaq 0xb8(%rbx), %r12
movq 0xd0(%rbx), %rax
movzwl 0x20(%rax), %ecx
movw %cx, 0x20(%r14)
movzwl 0x20(%rax), %eax
movq %rsp, %rsi
movq %rax, (%rsi)
movq %r15, %rdi
callq 0x219d8
movq %r14, (%rax)
movq 0xd0(%rbx), %rsi
movq %r12, %rdi
callq 0x21d98
movzwl 0x82(%rbx), %eax
movq 0xe8(%rbx), %rcx
movq %r14, (%rcx,%rax,8)
incl %eax
xorl %ecx, %ecx
cmpw 0x84(%rbx), %ax
cmovnel %eax, %ecx
movw %cx, 0x82(%rbx)
callq 0x281b4
movq %rax, %rdi
callq 0x285a6
movq %rax, 0x8(%r14)
movq 0x58(%rbx), %rdi
movq 0x88(%rbx), %rsi
movzwl 0x82(%rbx), %edx
callq 0x24fea
jmp 0x1f98b
leaq 0x100(%rbx), %r15
movl $0x18, %edi
callq 0x73a0
movq %r14, 0x10(%rax)
movq %rax, %rdi
movq %r15, %rsi
callq 0x7060
incq 0x110(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x4f652(%rip), %rbx     # 0x6eff0
leaq 0x36c03(%rip), %rsi     # 0x565a8
movq %rbx, %rdi
callq 0x7390
leaq 0x380e6(%rip), %rsi     # 0x57a9a
movq %rbx, %rdi
callq 0x7390
movq %rax, %rdi
callq 0x71c0
movq 0x4f605(%rip), %rdi     # 0x6efd0
callq 0x7430
movl $0x1, %edi
callq 0x7440