// File: /workspace/github_cpp_makefile_star2_O3/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 0x15faf
cmpl $0x1, %eax
jne 0x15fd4
movq 0x58(%rbx), %rax
cmpq %rax, 0x60(%rbx)
je 0x15fd4
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 0x1f95c
movq %rax, %r15
movq 0x58(%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0x1f962
movq %rax, %r12
movq 0x58(%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0x1f954
movq 0x10(%rax), %r13
movq 0x58(%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0x1f954
movq 0x28(%rax), %r9
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %esi
movq %r15, %rdx
movq %r12, %rcx
movq %r13, %r8
callq 0x41afa
movzwl %r14w, %ebp
movq 0x58(%rbx), %rax
movq 0x60(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
incl %r14d
cmpq %rbp, %rcx
ja 0x15f25
jmp 0x15fd4
movq 0x50(%rbx), %rdi
callq 0x259ee
movq 0x10(%rax), %r15
movq 0x50(%rbx), %rdi
callq 0x259ee
movq 0x28(%rax), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x43bd0
cmpb $0x1, 0x78(%rbx)
jne 0x160bb
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x160f8
movq 0x70(%rbx), %rbx
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x165a4
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x1d6fa
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1601b
callq 0x7370
movq 0x18(%rsp), %rbx
movq 0x20(%rsp), %r15
cmpq %r15, %rbx
je 0x160ae
movq (%rbx), %r14
testq %r14, %r14
je 0x16098
movq 0x198(%r14), %rdi
testq %rdi, %rdi
je 0x16047
callq 0x7370
movq 0x180(%r14), %rdi
testq %rdi, %rdi
je 0x16058
callq 0x7370
leaq 0xf0(%r14), %rdi
callq 0x16674
leaq 0xc0(%r14), %rdi
callq 0x166be
leaq 0x90(%r14), %rdi
callq 0x166be
movq 0x40(%r14), %rdi
testq %rdi, %rdi
je 0x1608a
callq 0x7370
movq 0x28(%r14), %rdi
testq %rdi, %rdi
je 0x16098
callq 0x7370
movq %r14, %rdi
callq 0x7370
addq $0x8, %rbx
cmpq %r15, %rbx
jne 0x1602e
movq 0x18(%rsp), %rbx
testq %rbx, %rbx
je 0x160bb
movq %rbx, %rdi
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 0x160e1
callq 0x7370
jmp 0x160e1
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x160f0
callq 0x7370
movq %rbx, %rdi
callq 0x7620