// File: /workspace/github_cpp_makefile_star2_O2/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), %rdi
callq 0x98a0
leaq 0xb8(%rsp), %rdi
leaq 0x38(%rsp), %rdx
movq %r15, %rsi
callq 0x7150
leaq 0xd8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x41980
leaq 0xb8(%rsp), %rdi
callq 0x7678
leaq 0x3a314(%rip), %rsi     # 0x432f6
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x7150
leaq 0x98(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x7480
leaq 0xd8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x419e0
leaq 0x98(%rsp), %rdi
callq 0x7678
leaq 0x3c8bf(%rip), %rsi     # 0x458eb
leaq 0x78(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x7150
movq (%rbx), %rax
leaq 0x78(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
movq %rbx, %rdi
callq *0x20(%rax)
leaq 0x78(%rsp), %rdi
callq 0x7678
leaq 0x3c889(%rip), %rsi     # 0x458eb
leaq 0x58(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x7150
movq (%r14), %rax
leaq 0x58(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
movq %r14, %rdi
callq *0x20(%rax)
leaq 0x58(%rsp), %rdi
callq 0x7678
leaq 0xd8(%rsp), %rdi
callq 0x41c5c
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x11780
xorl %ebp, %ebp
movq 0x58ec6(%rip), %rbx     # 0x61f78
leaq 0x18(%rsp), %r15
leaq 0x3a2b0(%rip), %r14     # 0x4336e
leaq 0x3a2af(%rip), %r12     # 0x43374
movl %ebp, %ebp
movq 0x8(%rsp), %rax
subq (%rsp), %rax
sarq $0x3, %rax
cmpq %rbp, %rax
jbe 0x91e3
movq %rbx, %rdi
leaq 0x3a21d(%rip), %rsi     # 0x43304
callq 0x7360
movq %rax, %r13
movq (%rsp), %rax
movq (%rax,%rbp,8), %rsi
addq $0x8, %rsi
movq %r15, %rdi
callq 0x7480
movq %r13, %rdi
movq %r15, %rsi
callq 0x7310
movq %rax, %rdi
leaq 0x3a1f2(%rip), %rsi     # 0x4330a
callq 0x7360
movq %rax, %r13
movq (%rsp), %rax
movq (%rax,%rbp,8), %rdi
callq 0x187e8
movl %eax, %esi
movq %r13, %rdi
callq 0x7270
movq %rax, %rdi
leaq 0x3a1e7(%rip), %rsi     # 0x43328
callq 0x7360
movq %rax, %r13
movq (%rsp), %rax
movq (%rax,%rbp,8), %rdi
callq 0x187f0
movl %eax, %esi
movq %r13, %rdi
callq 0x7270
movq %rax, %rdi
callq 0x71a0
movq %r15, %rdi
callq 0x7678
movq %rbx, %rdi
leaq 0x3a1c8(%rip), %rsi     # 0x43342
callq 0x7360
movq %rax, %r13
movq (%rsp), %rax
movq (%rax,%rbp,8), %rdi
callq 0x187f8
movl %eax, %esi
movq %r13, %rdi
callq 0x7270
movq %rax, %rdi
movq %r14, %rsi
callq 0x7360
movq %rax, %rdi
movq %r12, %rsi
callq 0x7360
movq %rax, %r13
movq (%rsp), %rax
movq (%rax,%rbp,8), %rdi
callq 0x18842
movl %eax, %esi
movq %r13, %rdi
callq 0x7270
movq %rax, %rdi
movq %r14, %rsi
callq 0x7360
movq %rax, %rdi
callq 0x71a0
incl %ebp
jmp 0x90c5
movq %rsp, %rdi
callq 0xb5a0
leaq 0x38(%rsp), %rdi
callq 0x7678
leaq 0xd8(%rsp), %rdi
callq 0x98c4
addq $0x318, %rsp            # imm = 0x318
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9254
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
jmp 0x9239
jmp 0x9254
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
jmp 0x9239
jmp 0x9254
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x7678
jmp 0x9275
jmp 0x924f
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
jmp 0x927a
movq %rax, %rbx
jmp 0x927f
movq %rax, %rbx
jmp 0x9275
jmp 0x926a
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x7678
jmp 0x926d
movq %rax, %rbx
movq %rsp, %rdi
callq 0xb5a0
leaq 0x38(%rsp), %rdi
callq 0x7678
leaq 0xd8(%rsp), %rdi
callq 0x98c4
movq %rbx, %rdi
callq 0x75d0