// File: /workspace/github_cpp_makefile_star2_O3/CMU-SAFARI[P]MQSim/src/main.cpp
// Function: read_configuration_parameters(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, Execution_Parameter_Set*)
void read_configuration_parameters(const string ssd_config_file_path, Execution_Parameter_Set* exec_params)
{
	ifstream ssd_config_file;
	ssd_config_file.open(ssd_config_file_path.c_str());

	if (!ssd_config_file) {
		PRINT_MESSAGE("The specified SSD configuration file does not exist.")
		PRINT_MESSAGE("Using MQSim's default configuration.")
		PRINT_MESSAGE("Writing the default configuration parameters to the expected configuration file.")

		Utils::XmlWriter xmlwriter;
		string tmp;
		xmlwriter.Open(ssd_config_file_path.c_str());
		exec_params->XML_serialize(xmlwriter);
		xmlwriter.Close();
		PRINT_MESSAGE("[====================] Done!\n")
	} else {
		//Read input workload parameters
		string line((std::istreambuf_iterator<char>(ssd_config_file)),
			std::istreambuf_iterator<char>());
		ssd_config_file >> line;
		if (line.compare("USE_INTERNAL_PARAMS") != 0) {
			rapidxml::xml_document<> doc;    // character type defaults to char
			char* temp_string = new char[line.length() + 1];
			strcpy(temp_string, line.c_str());
			doc.parse<0>(temp_string);
			rapidxml::xml_node<> *mqsim_config = doc.first_node("Execution_Parameter_Set");
			if (mqsim_config != NULL) {
				exec_params = new Execution_Parameter_Set;
				exec_params->XML_deserialize(mqsim_config);
			} else {
				PRINT_MESSAGE("Error in the SSD configuration file!")
				PRINT_MESSAGE("Using MQSim's default configuration.")
			}
		} else {
			PRINT_MESSAGE("Using MQSim's default configuration.");
			PRINT_MESSAGE("Writing the default configuration parameters to the expected configuration file.");

			Utils::XmlWriter xmlwriter;
			string tmp;
			xmlwriter.Open(ssd_config_file_path.c_str());
			exec_params->XML_serialize(xmlwriter);
			xmlwriter.Close();
			PRINT_MESSAGE("[====================] Done!\n")
		}
	}

	ssd_config_file.close();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10318, %rsp          # imm = 0x10318
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x88(%rsp), %r15
movq %r15, %rdi
callq 0x73f0
movq (%r14), %rsi
movq %r15, %rdi
movl $0x8, %edx
callq 0x7260
movq 0x88(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xa8(%rsp,%rax)
je 0x8b48
movq 0x66651(%rip), %r15     # 0x6ef88
leaq 0x4c720(%rip), %rsi     # 0x5505e
movl $0x34, %edx
movq %r15, %rdi
callq 0x7400
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x7380
movsbl %al, %esi
movq 0x6661f(%rip), %rdi     # 0x6ef88
callq 0x7040
movq %rax, %rdi
callq 0x7290
movq 0x6660b(%rip), %r15     # 0x6ef88
leaq 0x4c70f(%rip), %rsi     # 0x55093
movl $0x24, %edx
movq %r15, %rdi
callq 0x7400
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x7380
movsbl %al, %esi
movq 0x665d9(%rip), %rdi     # 0x6ef88
callq 0x7040
movq %rax, %rdi
callq 0x7290
movq 0x665c5(%rip), %r15     # 0x6ef88
leaq 0x4c6ee(%rip), %rsi     # 0x550b8
movl $0x50, %edx
movq %r15, %rdi
callq 0x7400
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x7380
movsbl %al, %esi
movq 0x66593(%rip), %rdi     # 0x6ef88
callq 0x7040
movq %rax, %rdi
callq 0x7290
leaq 0x290(%rsp), %rdi
callq 0x75d0
xorps %xmm0, %xmm0
movups %xmm0, 0x4c0(%rsp)
movups %xmm0, 0x4b0(%rsp)
movups %xmm0, 0x4a0(%rsp)
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
movq (%r14), %rsi
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x7180
leaq 0x290(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x53a8a
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8a76
callq 0x7370
movq (%rbx), %rax
leaq 0x290(%rsp), %rsi
movq %rbx, %rdi
callq *(%rax)
leaq 0x290(%rsp), %rdi
callq 0x53adc
movq 0x664ee(%rip), %rbx     # 0x6ef88
leaq 0x4c668(%rip), %rsi     # 0x55109
movl $0x1d, %edx
movq %rbx, %rdi
callq 0x7400
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x7380
movsbl %al, %esi
movq 0x664bc(%rip), %rdi     # 0x6ef88
callq 0x7040
movq %rax, %rdi
callq 0x7290
leaq 0x4a0(%rsp), %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x8af0
callq 0x7370
leaq 0x4b8(%rsp), %r14
movq %r14, %rdi
callq 0xae1a
movq %rbx, %rdi
callq 0xae1a
movq 0x66459(%rip), %rax     # 0x6ef68
movq (%rax), %rcx
movq 0x18(%rax), %rax
movq %rcx, -0x228(%r14)
movq -0x18(%rcx), %rcx
movq %rax, 0x290(%rsp,%rcx)
leaq 0x298(%rsp), %rdi
callq 0x7320
leaq 0x388(%rsp), %rdi
callq 0x7150
jmp 0x8ed0
movq 0x170(%rsp,%rax), %rsi
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x8(%rsp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0xb05e
leaq 0x88(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x7460
leaq 0x4c59d(%rip), %rsi     # 0x55127
leaq 0x8(%rsp), %rdi
callq 0x7120
testl %eax, %eax
je 0x8c5b
xorl %eax, %eax
leaq 0x2f0(%rsp), %rbx
movq %rax, -0x40(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbx)
movl $0x0, -0x38(%rbx)
movq %rax, -0x30(%rbx)
movq %rax, -0x20(%rbx)
leaq 0x10308(%rsp), %rax
leaq 0x308(%rsp), %rcx
movups %xmm0, (%rax)
movq %rcx, -0x18(%rcx)
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movq 0x10(%rsp), %rdi
incq %rdi
callq 0x7030
movq %rax, %r14
movq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x7360
leaq 0x290(%rsp), %rdi
movq %r14, %rsi
callq 0xab20
leaq 0x4c528(%rip), %rsi     # 0x5513b
leaq 0x290(%rsp), %rdi
xorl %edx, %edx
movl $0x1, %ecx
callq 0xac4e
movq %rax, %r14
testq %rax, %rax
je 0x8e2d
movl $0x8, %edi
callq 0x73a0
leaq 0x64cb4(%rip), %rcx     # 0x6d8f8
addq $0x10, %rcx
movq %rcx, (%rax)
movq %rax, %rdi
movq %r14, %rsi
callq 0x116f8
jmp 0x8eb9
movq 0x66326(%rip), %r15     # 0x6ef88
leaq 0x4c42a(%rip), %rsi     # 0x55093
movl $0x24, %edx
movq %r15, %rdi
callq 0x7400
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x7380
movsbl %al, %esi
movq 0x662f4(%rip), %rdi     # 0x6ef88
callq 0x7040
movq %rax, %rdi
callq 0x7290
movq 0x662e0(%rip), %r15     # 0x6ef88
leaq 0x4c409(%rip), %rsi     # 0x550b8
movl $0x50, %edx
movq %r15, %rdi
callq 0x7400
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x7380
movsbl %al, %esi
movq 0x662ae(%rip), %rdi     # 0x6ef88
callq 0x7040
movq %rax, %rdi
callq 0x7290
leaq 0x290(%rsp), %rdi
callq 0x75d0
xorps %xmm0, %xmm0
movups %xmm0, 0x4c0(%rsp)
movups %xmm0, 0x4b0(%rsp)
movups %xmm0, 0x4a0(%rsp)
leaq 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
movq (%r14), %rsi
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x7180
leaq 0x290(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x53a8a
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8d5b
callq 0x7370
movq (%rbx), %rax
leaq 0x290(%rsp), %rsi
movq %rbx, %rdi
callq *(%rax)
leaq 0x290(%rsp), %rdi
callq 0x53adc
movq 0x66209(%rip), %rbx     # 0x6ef88
leaq 0x4c383(%rip), %rsi     # 0x55109
movl $0x1d, %edx
movq %rbx, %rdi
callq 0x7400
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x7380
movsbl %al, %esi
movq 0x661d7(%rip), %rdi     # 0x6ef88
callq 0x7040
movq %rax, %rdi
callq 0x7290
leaq 0x4a0(%rsp), %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x8dd5
callq 0x7370
leaq 0x4b8(%rsp), %r14
movq %r14, %rdi
callq 0xae1a
movq %rbx, %rdi
callq 0xae1a
movq 0x66174(%rip), %rax     # 0x6ef68
movq (%rax), %rcx
movq 0x18(%rax), %rax
movq %rcx, -0x228(%r14)
movq -0x18(%rcx), %rcx
movq %rax, 0x290(%rsp,%rcx)
leaq 0x298(%rsp), %rdi
callq 0x7320
leaq 0x388(%rsp), %rdi
callq 0x7150
jmp 0x8ec1
movq 0x66154(%rip), %r14     # 0x6ef88
leaq 0x4c318(%rip), %rsi     # 0x55153
movl $0x24, %edx
movq %r14, %rdi
callq 0x7400
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x7380
movsbl %al, %esi
movq 0x66122(%rip), %rdi     # 0x6ef88
callq 0x7040
movq %rax, %rdi
callq 0x7290
movq 0x6610e(%rip), %r14     # 0x6ef88
leaq 0x4c212(%rip), %rsi     # 0x55093
movl $0x24, %edx
movq %r14, %rdi
callq 0x7400
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x7380
movsbl %al, %esi
movq 0x660dc(%rip), %rdi     # 0x6ef88
callq 0x7040
movq %rax, %rdi
callq 0x7290
movq %rbx, %rdi
callq 0xae6e
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8ed0
callq 0x7370
leaq 0x88(%rsp), %rdi
callq 0x70b0
leaq 0x88(%rsp), %rdi
callq 0x7100
addq $0x10318, %rsp          # imm = 0x10318
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8f3d
callq 0x7370
jmp 0x8f3d
jmp 0x8f3a
jmp 0x8f70
jmp 0x8f68
jmp 0x8fa5
jmp 0x8f5b
movq %rax, %r14
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8f87
callq 0x7370
jmp 0x8f87
jmp 0x8f84
jmp 0x8fa5
movq %rax, %r14
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x8f4c
callq 0x7370
leaq 0x290(%rsp), %rdi
callq 0xaad2
jmp 0x8f73
movq %rax, %r14
movq %rbx, %rdi
callq 0xae6e
jmp 0x8f73
movq %rax, %rdi
callq 0xae63
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8fa8
callq 0x7370
jmp 0x8fa8
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x8f96
callq 0x7370
leaq 0x290(%rsp), %rdi
callq 0xaad2
jmp 0x8fa8
movq %rax, %r14
leaq 0x88(%rsp), %rdi
callq 0x7100
movq %r14, %rdi
callq 0x7620