// File: /workspace/github_cpp_makefile_star2_O3/CMU-SAFARI[P]MQSim/src/main.cpp
// Function: collect_results(SSD_Device&, Host_System&, char const*)
void collect_results(SSD_Device& ssd, Host_System& host, const char* output_file_path)
{
	Utils::XmlWriter xmlwriter;
	xmlwriter.Open(output_file_path);

	std::string tmp("MQSim_Results");
	xmlwriter.Write_open_tag(tmp);
	
	host.Report_results_in_XML("", xmlwriter);
	ssd.Report_results_in_XML("", xmlwriter);

	xmlwriter.Write_close_tag();

	std::vector<Host_Components::IO_Flow_Base*> IO_flows = host.Get_io_flows();
	for (unsigned int stream_id = 0; stream_id < IO_flows.size(); stream_id++) {
		cout << "Flow " << IO_flows[stream_id]->ID() << " - total requests generated: " << IO_flows[stream_id]->Get_generated_request_count()
			<< " total requests serviced:" << IO_flows[stream_id]->Get_serviced_request_count() << endl;
		cout << "                   - device response time: " << IO_flows[stream_id]->Get_device_response_time() << " (us)"
			<< " end-to-end request delay:" << IO_flows[stream_id]->Get_end_to_end_request_delay() << " (us)" << endl;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x318, %rsp            # imm = 0x318
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xd8(%rsp), %r12
movq %r12, %rdi
callq 0x75d0
xorps %xmm0, %xmm0
movups %xmm0, 0x230(%r12)
movups %xmm0, 0x220(%r12)
movups %xmm0, 0x210(%r12)
leaq 0xb8(%rsp), %rdi
leaq 0x18(%rsp), %rdx
movq %r15, %rsi
callq 0x7180
leaq 0xd8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x53a8a
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9bab
callq 0x7370
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x4b73b(%rip), %rsi     # 0x552f6
leaq 0x4b741(%rip), %rdx     # 0x55303
leaq 0x18(%rsp), %rdi
callq 0xafc8
leaq 0xa8(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq %rsi, %rdx
leaq 0x98(%rsp), %rdi
callq 0xaf32
leaq 0xd8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x53af8
movq 0x98(%rsp), %rdi
cmpq %r15, %rdi
je 0x9c19
callq 0x7370
leaq 0x88(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x4ddaf(%rip), %rdx     # 0x579db
leaq 0x78(%rsp), %rdi
movq %rdx, %rsi
callq 0xafc8
movq (%rbx), %rax
leaq 0x78(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
movq %rbx, %rdi
callq *0x20(%rax)
movq 0x78(%rsp), %rdi
cmpq %r15, %rdi
je 0x9c5e
callq 0x7370
leaq 0x68(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x4dd6d(%rip), %rdx     # 0x579db
leaq 0x58(%rsp), %rdi
movq %rdx, %rsi
callq 0xafc8
movq (%r14), %rax
leaq 0x58(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
movq %r14, %rdi
callq *0x20(%rax)
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0x9ca0
callq 0x7370
leaq 0xd8(%rsp), %rdi
callq 0x53e9a
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x15ed0
movq (%rsp), %rdi
cmpq %rdi, 0x8(%rsp)
je 0x9e81
movl $0x1, %ebp
leaq 0x48(%rsp), %r13
xorl %r15d, %r15d
movq 0x652ad(%rip), %rbx     # 0x6ef88
leaq 0x4b68c(%rip), %r14     # 0x5536e
movl $0x5, %edx
movq %rbx, %rdi
leaq 0x4b613(%rip), %rsi     # 0x55304
callq 0x7400
movq (%rsp), %rax
movq (%rax,%r15,8), %rax
movq %r13, 0x38(%rsp)
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
addq %rsi, %rdx
leaq 0x38(%rsp), %rdi
callq 0xaf32
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq %rbx, %rdi
callq 0x7400
movq %rax, %r12
movl $0x1d, %edx
movq %rax, %rdi
leaq 0x4b5ce(%rip), %rsi     # 0x5530a
callq 0x7400
movq (%rsp), %rax
movq (%rax,%r15,8), %rdi
callq 0x1f968
movl %eax, %esi
movq %r12, %rdi
callq 0x7280
movq %rax, %r12
movl $0x19, %edx
movq %rax, %rdi
leaq 0x4b5be(%rip), %rsi     # 0x55328
callq 0x7400
movq (%rsp), %rax
movq (%rax,%r15,8), %rdi
callq 0x1f970
movl %eax, %esi
movq %r12, %rdi
callq 0x7280
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x7380
movsbl %al, %esi
movq %r12, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7290
movq 0x38(%rsp), %rdi
cmpq %r13, %rdi
je 0x9dbf
callq 0x7370
movl $0x2b, %edx
movq %rbx, %rdi
leaq 0x4b574(%rip), %rsi     # 0x55342
callq 0x7400
movq (%rsp), %rax
movq (%rax,%r15,8), %rdi
callq 0x1f978
movl %eax, %esi
movq %rbx, %rdi
callq 0x7280
movq %rax, %r12
movl $0x5, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x7400
movl $0x1a, %edx
movq %r12, %rdi
leaq 0x4b568(%rip), %rsi     # 0x55374
callq 0x7400
movq (%rsp), %rax
movq (%rax,%r15,8), %rdi
callq 0x1f9ec
movl %eax, %esi
movq %r12, %rdi
callq 0x7280
movq %rax, %r12
movl $0x5, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x7400
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x7380
movsbl %al, %esi
movq %r12, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7290
movl %ebp, %r15d
movq (%rsp), %rdi
movq 0x8(%rsp), %rax
subq %rdi, %rax
sarq $0x3, %rax
incl %ebp
cmpq %r15, %rax
ja 0x9ce2
testq %rdi, %rdi
je 0x9e8b
callq 0x7370
leaq 0x2e8(%rsp), %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x9ea7
callq 0x7370
leaq 0x300(%rsp), %r14
movq %r14, %rdi
callq 0xae1a
movq %rbx, %rdi
callq 0xae1a
movq 0x650a2(%rip), %rax     # 0x6ef68
movq (%rax), %rcx
movq 0x18(%rax), %rax
movq %rcx, -0x228(%r14)
movq -0x18(%rcx), %rcx
movq %rax, 0xd8(%rsp,%rcx)
leaq 0xe0(%rsp), %rdi
callq 0x7320
leaq 0x1d0(%rsp), %rdi
callq 0x7150
addq $0x318, %rsp            # imm = 0x318
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9f50
movq %rax, %rbx
movq 0x58(%rsp), %rdi
jmp 0x9f31
jmp 0x9f50
movq %rax, %rbx
movq 0x78(%rsp), %rdi
jmp 0x9f31
jmp 0x9f50
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r15, %rdi
jne 0x9f77
jmp 0x9f7c
jmp 0x9f4b
movq %rax, %rbx
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
jmp 0x9f86
movq %rax, %rbx
jmp 0x9f90
movq %rax, %rbx
jmp 0x9f7c
jmp 0x9f6b
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r13, %rdi
je 0x9f6e
callq 0x7370
jmp 0x9f6e
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x9f7c
callq 0x7370
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x9f90
callq 0x7370
leaq 0xd8(%rsp), %rdi
callq 0xaad2
movq %rbx, %rdi
callq 0x7620