// File: /workspace/github_cpp_makefile_star2_O1/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), %rcx
testb $0x5, 0xa8(%rsp,%rcx)
je 0x8b98
movq 0x66609(%rip), %r15     # 0x6ef90
leaq 0x4c6d0(%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 0x665d7(%rip), %rdi     # 0x6ef90
callq 0x7040
movq %rax, %rdi
callq 0x7290
movq 0x665c3(%rip), %r15     # 0x6ef90
leaq 0x4c6bf(%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 0x66591(%rip), %rdi     # 0x6ef90
callq 0x7040
movq %rax, %rdi
callq 0x7290
movq 0x6657d(%rip), %r15     # 0x6ef90
leaq 0x4c69e(%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 0x6654b(%rip), %rdi     # 0x6ef90
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 0x543e6
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8ac6
callq 0x7370
movq (%rbx), %rax
leaq 0x290(%rsp), %rsi
movq %rbx, %rdi
callq *(%rax)
leaq 0x290(%rsp), %rdi
callq 0x54438
movq 0x664a6(%rip), %rbx     # 0x6ef90
leaq 0x4c618(%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 0x66474(%rip), %rdi     # 0x6ef90
callq 0x7040
movq %rax, %rdi
callq 0x7290
leaq 0x4a0(%rsp), %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x8b40
callq 0x7370
leaq 0x4b8(%rsp), %r14
movq %r14, %rdi
callq 0xaf22
movq %rbx, %rdi
callq 0xaf22
movq 0x66411(%rip), %rax     # 0x6ef70
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 0x8f24
movq -0x18(%rax), %rax
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 0xb156
leaq 0x88(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x7460
leaq 0x4c549(%rip), %rsi     # 0x55127
leaq 0x8(%rsp), %rdi
callq 0x7120
testl %eax, %eax
je 0x8caf
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 0xab9e
leaq 0x4c4d4(%rip), %rsi     # 0x5513b
leaq 0x290(%rsp), %rdi
xorl %edx, %edx
movl $0x1, %ecx
callq 0xacce
movq %rax, %r14
testq %rax, %rax
je 0x8e81
movl $0x8, %edi
callq 0x73a0
leaq 0x64c50(%rip), %rcx     # 0x6d8e8
addq $0x10, %rcx
movq %rcx, (%rax)
movq %rax, %rdi
movq %r14, %rsi
callq 0x11810
jmp 0x8f0d
movq 0x662da(%rip), %r15     # 0x6ef90
leaq 0x4c3d6(%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 0x662a8(%rip), %rdi     # 0x6ef90
callq 0x7040
movq %rax, %rdi
callq 0x7290
movq 0x66294(%rip), %r15     # 0x6ef90
leaq 0x4c3b5(%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 0x66262(%rip), %rdi     # 0x6ef90
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 0x543e6
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8daf
callq 0x7370
movq (%rbx), %rax
leaq 0x290(%rsp), %rsi
movq %rbx, %rdi
callq *(%rax)
leaq 0x290(%rsp), %rdi
callq 0x54438
movq 0x661bd(%rip), %rbx     # 0x6ef90
leaq 0x4c32f(%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 0x6618b(%rip), %rdi     # 0x6ef90
callq 0x7040
movq %rax, %rdi
callq 0x7290
leaq 0x4a0(%rsp), %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x8e29
callq 0x7370
leaq 0x4b8(%rsp), %r14
movq %r14, %rdi
callq 0xaf22
movq %rbx, %rdi
callq 0xaf22
movq 0x66128(%rip), %rax     # 0x6ef70
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 0x8f15
movq 0x66108(%rip), %r14     # 0x6ef90
leaq 0x4c2c4(%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 0x660d6(%rip), %rdi     # 0x6ef90
callq 0x7040
movq %rax, %rdi
callq 0x7290
movq 0x660c2(%rip), %r14     # 0x6ef90
leaq 0x4c1be(%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 0x66090(%rip), %rdi     # 0x6ef90
callq 0x7040
movq %rax, %rdi
callq 0x7290
movq %rbx, %rdi
callq 0xaf70
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8f24
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 0x8f91
callq 0x7370
jmp 0x8f91
jmp 0x8f8e
jmp 0x8fc4
jmp 0x8fbc
jmp 0x8ff9
jmp 0x8faf
movq %rax, %r14
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8fdb
callq 0x7370
jmp 0x8fdb
jmp 0x8fd8
jmp 0x8ff9
movq %rax, %r14
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x8fa0
callq 0x7370
leaq 0x290(%rsp), %rdi
callq 0xab50
jmp 0x8fc7
movq %rax, %r14
movq %rbx, %rdi
callq 0xaf70
jmp 0x8fc7
movq %rax, %rdi
callq 0xaf65
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8ffc
callq 0x7370
jmp 0x8ffc
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x8fea
callq 0x7370
leaq 0x290(%rsp), %rdi
callq 0xab50
jmp 0x8ffc
movq %rax, %r14
leaq 0x88(%rsp), %rdi
callq 0x7100
movq %r14, %rdi
callq 0x7620