// File: /workspace/github_cpp_makefile_star2_O1/CMU-SAFARI[P]MQSim/src/exec/Host_System.cpp
// Function: Host_System::Start_simulation()
void Host_System::Start_simulation()
{
	switch (ssd_device->Host_interface->GetType()) {
		case HostInterface_Types::NVME:
			for (uint16_t flow_cntr = 0; flow_cntr < IO_flows.size(); flow_cntr++) {
				((SSD_Components::Host_Interface_NVMe*) ssd_device->Host_interface)->Create_new_stream(
					IO_flows[flow_cntr]->Priority_class(),
					IO_flows[flow_cntr]->Get_start_lsa_on_device(), IO_flows[flow_cntr]->Get_end_lsa_address_on_device(),
					IO_flows[flow_cntr]->Get_nvme_queue_pair_info()->Submission_queue_memory_base_address, IO_flows[flow_cntr]->Get_nvme_queue_pair_info()->Completion_queue_memory_base_address);
			}
			break;
		case HostInterface_Types::SATA:
			((SSD_Components::Host_Interface_SATA*) ssd_device->Host_interface)->Set_ncq_address(
				SATA_hba->Get_sata_ncq_info()->Submission_queue_memory_base_address, SATA_hba->Get_sata_ncq_info()->Completion_queue_memory_base_address);
		default:
			break;
	}

	if (preconditioning_required) {
		std::vector<Utils::Workload_Statistics*> workload_stats = get_workloads_statistics();
		ssd_device->Perform_preconditioning(workload_stats);
		for (auto &stat : workload_stats) {
			delete stat;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq 0x70(%rdi), %rax
movq 0x40(%rax), %r14
movl 0x38(%r14), %eax
testl %eax, %eax
je 0x160b9
cmpl $0x1, %eax
jne 0x160de
movq 0x58(%rbx), %rax
cmpq %rax, 0x60(%rbx)
je 0x160de
movw $0x1, %r14w
xorl %ebp, %ebp
movq 0x70(%rbx), %rcx
movq 0x40(%rcx), %rcx
movq %rcx, 0x10(%rsp)
movq (%rax,%rbp,8), %rdi
movl 0x78(%rdi), %eax
movl %eax, 0xc(%rsp)
callq 0x1fa14
movq %rax, %r15
movq 0x58(%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0x1fa1a
movq %rax, %r12
movq 0x58(%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0x1fa0c
movq 0x10(%rax), %r13
movq 0x58(%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0x1fa0c
movq 0x28(%rax), %r9
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %esi
movq %r15, %rdx
movq %r12, %rcx
movq %r13, %r8
callq 0x42564
movzwl %r14w, %ebp
movq 0x58(%rbx), %rax
movq 0x60(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
incl %r14d
cmpq %rbp, %rcx
ja 0x1602f
jmp 0x160de
movq 0x50(%rbx), %rdi
callq 0x25b7e
movq 0x10(%rax), %r15
movq 0x50(%rbx), %rdi
callq 0x25b7e
movq 0x28(%rax), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x4463c
cmpb $0x1, 0x78(%rbx)
jne 0x161bb
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x161f8
movq 0x70(%rbx), %rbx
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x166a4
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x1d7b6
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x16125
callq 0x7370
movq 0x18(%rsp), %r14
movq 0x20(%rsp), %r15
cmpq %r15, %r14
je 0x161ac
movq (%r14), %rbx
testq %rbx, %rbx
je 0x161a6
movq 0x198(%rbx), %rdi
testq %rdi, %rdi
je 0x1614d
callq 0x7370
movq 0x180(%rbx), %rdi
testq %rdi, %rdi
je 0x1615e
callq 0x7370
leaq 0xf0(%rbx), %rdi
callq 0x1676e
leaq 0xc0(%rbx), %rdi
callq 0x167b8
leaq 0x90(%rbx), %rdi
callq 0x167b8
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x16190
callq 0x7370
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x1619e
callq 0x7370
movq %rbx, %rdi
callq 0x7370
addq $0x8, %r14
jmp 0x1612f
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x161bb
callq 0x7370
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x161e1
callq 0x7370
jmp 0x161e1
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x161f0
callq 0x7370
movq %rbx, %rdi
callq 0x7620