// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x10320, %rsp          # imm = 0x10320
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x88(%rsp), %r15
movq %r15, %rdi
callq 0x73a0
movq (%r14), %rsi
pushq $0x8
popq %rdx
movq %r15, %rdi
callq 0x7250
movq 0x88(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xa8(%rsp,%rax)
leaq 0x18(%rsp), %r15
je 0x8497
movq 0x59bca(%rip), %rdi     # 0x61f78
leaq 0x3aca9(%rip), %rsi     # 0x4305e
callq 0x7360
movq %rax, %rdi
callq 0x71a0
movq 0x59baf(%rip), %rdi     # 0x61f78
leaq 0x3acc3(%rip), %rsi     # 0x43093
callq 0x7360
movq %rax, %rdi
callq 0x71a0
movq 0x59b94(%rip), %rdi     # 0x61f78
leaq 0x3accd(%rip), %rsi     # 0x430b8
callq 0x7360
movq %rax, %rdi
callq 0x71a0
leaq 0x290(%rsp), %rdi
callq 0x98a0
movq %r15, 0x8(%rsp)
andq $0x0, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
movq (%r14), %rsi
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x7150
leaq 0x290(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x41980
leaq 0x68(%rsp), %rdi
callq 0x7678
movq (%rbx), %rax
leaq 0x290(%rsp), %rsi
movq %rbx, %rdi
callq *(%rax)
leaq 0x290(%rsp), %rdi
callq 0x419c4
movq 0x59b11(%rip), %rdi     # 0x61f78
leaq 0x3ac9b(%rip), %rsi     # 0x43109
callq 0x7360
movq %rax, %rdi
callq 0x71a0
leaq 0x8(%rsp), %rdi
callq 0x7678
leaq 0x290(%rsp), %rdi
callq 0x98c4
jmp 0x86b3
movq 0x170(%rsp,%rax), %rsi
leaq 0x8(%rsp), %rdi
movq %r15, (%rdi)
pushq $-0x1
popq %rdx
xorl %ecx, %ecx
movl %edx, %r8d
callq 0x9d66
leaq 0x88(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x7410
leaq 0x3ac5a(%rip), %rsi     # 0x43127
leaq 0x8(%rsp), %rdi
callq 0x7120
testl %eax, %eax
je 0x8598
leaq 0x2f0(%rsp), %rbx
andq $0x0, -0x40(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbx)
andl $0x0, -0x38(%rbx)
andq $0x0, -0x30(%rbx)
andq $0x0, -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 0x7330
leaq 0x290(%rsp), %rdi
movq %r14, %rsi
callq 0x98ea
leaq 0x3abe7(%rip), %rsi     # 0x4313b
leaq 0x290(%rsp), %rdi
pushq $0x1
popq %rcx
xorl %edx, %edx
callq 0x99b8
movq %rax, %r14
testq %rax, %rax
je 0x866b
pushq $0x8
popq %rdi
callq 0x7370
leaq 0x5831f(%rip), %rcx     # 0x608a0
addq $0x10, %rcx
movq %rcx, (%rax)
movq %rax, %rdi
movq %r14, %rsi
callq 0xedce
jmp 0x86a1
movq 0x599d9(%rip), %rdi     # 0x61f78
leaq 0x3aaed(%rip), %rsi     # 0x43093
callq 0x7360
movq %rax, %rdi
callq 0x71a0
movq 0x599be(%rip), %rdi     # 0x61f78
leaq 0x3aaf7(%rip), %rsi     # 0x430b8
callq 0x7360
movq %rax, %rdi
callq 0x71a0
leaq 0x290(%rsp), %rdi
callq 0x98a0
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq (%r14), %rsi
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x7150
leaq 0x290(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x41980
leaq 0x28(%rsp), %rdi
callq 0x7678
movq (%rbx), %rax
leaq 0x290(%rsp), %rsi
movq %rbx, %rdi
callq *(%rax)
leaq 0x290(%rsp), %rdi
callq 0x419c4
movq 0x5993a(%rip), %rdi     # 0x61f78
leaq 0x3aac4(%rip), %rsi     # 0x43109
callq 0x7360
movq %rax, %rdi
callq 0x71a0
leaq 0x48(%rsp), %rdi
callq 0x7678
leaq 0x290(%rsp), %rdi
callq 0x98c4
jmp 0x86a9
movq 0x59906(%rip), %rdi     # 0x61f78
leaq 0x3aada(%rip), %rsi     # 0x43153
callq 0x7360
movq %rax, %rdi
callq 0x71a0
movq 0x598eb(%rip), %rdi     # 0x61f78
leaq 0x3a9ff(%rip), %rsi     # 0x43093
callq 0x7360
movq %rax, %rdi
callq 0x71a0
movq %rbx, %rdi
callq 0x9c68
leaq 0x8(%rsp), %rdi
callq 0x7678
leaq 0x88(%rsp), %rdi
callq 0x70a0
leaq 0x88(%rsp), %rdi
callq 0x7100
addq $0x10320, %rsp          # imm = 0x10320
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x7678
jmp 0x86f4
jmp 0x86f1
jmp 0x872d
jmp 0x8758
jmp 0x8720
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x7678
leaq 0x290(%rsp), %rdi
callq 0x98c4
jmp 0x8730
movq %rax, %r14
leaq 0x68(%rsp), %rdi
callq 0x7678
jmp 0x873f
jmp 0x873c
jmp 0x8758
movq %rax, %r14
movq %rbx, %rdi
callq 0x9c68
jmp 0x8730
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x7678
jmp 0x875b
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x7678
leaq 0x290(%rsp), %rdi
callq 0x98c4
jmp 0x875b
movq %rax, %r14
leaq 0x88(%rsp), %rdi
callq 0x7100
movq %r14, %rdi
callq 0x75d0