// File: /workspace/github_cpp_makefile_star2_O3/melop[P]admixem/config.cpp
// Function: SimulationConfigurations::LoadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void SimulationConfigurations::LoadFromFile(string szConfigFile) {


	FILE *pConfigFile;

	printf("%s\n", "Start loading config ...");

	_szConfigFilename = szConfigFile; // save name of config file

	pConfigFile = fopen(szConfigFile.c_str(), "r");

	if (!pConfigFile) {
		printf("%s\n", "Cannot open config file ...");
		throw "Cannot open config file!";
	}

	//Go over each line:
	char szBuffer[1024];


	while(fgets(szBuffer, 1024, pConfigFile) != NULL) 
	{
		char * szKey = new char[1024];
		char * szValue = new char[1024];
		sscanf(szBuffer, "%s = %s %*s", szKey, szValue);
		string sKey(szKey);
		string sVal(szValue);

		this->_mpConfigs[sKey] = sVal;
		printf("%s = %s \n", sKey.c_str(), sVal.c_str());
		//printf("Size of map: %d\n", this->_mpConfigs.size());
	}

	fclose(pConfigFile);

	this->fnParseNumericConfigs();
	//printf("Size of map: %d\n", this->_mpConfigs.size());
	printf("%s = %s \n", "PhenotypeFile", this->GetConfig("PhenotypeFile").c_str());
	printf("%s = %f \n", "pop1_init_size", this->GetNumericConfig("pop1_init_size"));
	//printf("Size of map: %d\n", this->_mpConfigs.size());

	/*
	for (std::map<char *,char *>::iterator it = this->_mpConfigs.begin(); it != this->_mpConfigs.end(); ++it) { // go over the configuration map with string values

		printf("%s%s", it->first, it->second);
	}
	*/
	
	#ifdef _OPENMP

		int nThreads = (int)this->GetNumericConfig("NumThreads");
		if (nThreads <= 0 ) {
			omp_set_num_threads( 2 );
		}
		else {
			omp_set_num_threads( nThreads );
		}
	#endif

	//Load other config files:
	this->pMarkerConfig->LoadFromFile(this->GetConfig("MarkerFile"));
	this->pRecombProbConfig->LoadFromFile(this->GetConfig("MarkerProbFile"));
	this->pPhenotypeConfig->LoadFromFile(this->GetConfig("PhenotypeFile"));
	this->pGeneConfig->LoadFromFile(this->GetConfig("GeneFile"));
	this->pNaturalSelConfig->LoadFromFile(this->GetConfig("NaturalSelection"));
	this->pSexualSelConfig->LoadFromFile(this->GetConfig("SexualSelection"));
	this->pMarkerConfig->CalculateMapDistances();
	this->fnParseSampleGenDef();

	if (this->GetNumericConfig("LogVerbose") == -1) {
		this->_nVerboseLogLevel = 0;//default, not verbose
	}
	else {
		this->_nVerboseLogLevel = this->GetNumericConfig("LogVerbose");
	}

	this->bOutputFirst3Gens = (this->GetConfig("DisableOutputForFirst3Gens")!="yes");

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x678, %rsp            # imm = 0x678
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1c98e(%rip), %rdi     # 0x3558a
callq 0x7560
movq %r14, 0x28(%rsp)
leaq 0x38(%r14), %rdi
movq %rbx, %rsi
callq 0x71d0
movq (%rbx), %rdi
leaq 0x1e0ae(%rip), %rsi     # 0x36cca
callq 0x7440
testq %rax, %rax
je 0x19322
movq %rax, %rbp
leaq 0x270(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %rax, %rdx
callq 0x7590
testq %rax, %rax
je 0x18d5a
leaq 0x40(%rsp), %r13
movq 0x28(%rsp), %rax
addq $0x58, %rax
movq %rax, 0x20(%rsp)
leaq 0x270(%rsp), %r12
leaq 0x30(%rsp), %rbx
movl $0x400, %edi            # imm = 0x400
callq 0x7030
movq %rax, %r15
movl $0x400, %edi            # imm = 0x400
callq 0x7030
movq %r12, %rdi
movq %rax, %r12
movq %rdi, %r14
leaq 0x1c946(%rip), %rsi     # 0x355d8
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x7360
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %r15, %rdi
callq 0x7170
leaq (%rax,%r15), %rdx
movq %rsp, %rdi
movq %r15, %rsi
callq 0xa91c
movq %r13, 0x30(%rsp)
movq %r12, %rdi
callq 0x7170
movq %r12, %rdx
addq %rax, %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0xa91c
movq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x19f5e
movq %r14, %r12
movq %rax, %rdi
movq %rbx, %rsi
callq 0x71d0
movq (%rsp), %rsi
movq 0x30(%rsp), %rdx
leaq 0x1c8dc(%rip), %rdi     # 0x355e4
xorl %eax, %eax
callq 0x7060
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x18d26
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x7390
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x18d41
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x7390
movq %r12, %rdi
movl $0x400, %esi            # imm = 0x400
movq %rbp, %rdx
callq 0x7590
testq %rax, %rax
jne 0x18c6b
movq %rbp, %rdi
callq 0x7370
movq 0x28(%rsp), %r13
movq %r13, %rdi
callq 0x195d2
leaq 0x80(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1c86c(%rip), %rsi     # 0x355ee
leaq 0x1c872(%rip), %rdx     # 0x355fb
leaq 0x70(%rsp), %rdi
callq 0xa91c
movq %rsp, %rdi
leaq 0x70(%rsp), %rdx
movq %r13, %rsi
callq 0x1023e
leaq 0x10(%rsp), %r15
movq -0x10(%r15), %rdx
leaq 0x1c831(%rip), %rdi     # 0x355e4
leaq 0x1c834(%rip), %rsi     # 0x355ee
xorl %eax, %eax
callq 0x7060
movq -0x10(%r15), %rdi
cmpq %r15, %rdi
je 0x18dd7
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x18df1
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x260(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1c802(%rip), %rsi     # 0x35606
leaq 0x1c809(%rip), %rdx     # 0x35614
leaq 0x250(%rsp), %rbx
movq %rbx, %rdi
callq 0xa91c
movq %r13, %rdi
movq %rbx, %rsi
callq 0x19708
leaq 0x1c7cf(%rip), %rdi     # 0x355fc
leaq 0x1c7d2(%rip), %rsi     # 0x35606
movb $0x1, %al
callq 0x7060
movq 0x250(%rsp), %rdi
cmpq %r14, %rdi
je 0x18e58
movq 0x260(%rsp), %rsi
incq %rsi
callq 0x7390
movq (%r13), %rbx
leaq 0x220(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1c7a5(%rip), %rsi     # 0x35615
leaq 0x1c7a8(%rip), %rdx     # 0x3561f
leaq 0x210(%rsp), %r14
movq %r14, %rdi
callq 0xa91c
leaq 0x230(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1023e
leaq 0x230(%rsp), %rsi
movq %rbx, %rdi
callq 0xfb88
leaq 0x240(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18ecb
movq 0x240(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x210(%rsp), %rdi
cmpq %r12, %rdi
je 0x18ee8
movq 0x220(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x8(%r13), %rbx
leaq 0x1e0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1c720(%rip), %rsi     # 0x35620
leaq 0x1c727(%rip), %rdx     # 0x3562e
leaq 0x1d0(%rsp), %r14
movq %r14, %rdi
callq 0xa91c
leaq 0x1f0(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1023e
leaq 0x1f0(%rsp), %rsi
movq %rbx, %rdi
callq 0x10cc4
leaq 0x200(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18f5b
movq 0x200(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x1d0(%rsp), %rdi
cmpq %r12, %rdi
je 0x18f78
movq 0x1e0(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x10(%r13), %rbx
leaq 0x1a0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1c65e(%rip), %rsi     # 0x355ee
leaq 0x1c664(%rip), %rdx     # 0x355fb
leaq 0x190(%rsp), %r14
movq %r14, %rdi
callq 0xa91c
leaq 0x1b0(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1023e
leaq 0x1b0(%rsp), %rsi
movq %rbx, %rdi
callq 0x13750
leaq 0x1c0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18feb
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x190(%rsp), %rdi
cmpq %r12, %rdi
je 0x19008
movq 0x1a0(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x18(%r13), %rbx
leaq 0x160(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1c60f(%rip), %rsi     # 0x3562f
leaq 0x1c610(%rip), %rdx     # 0x35637
leaq 0x150(%rsp), %r14
movq %r14, %rdi
callq 0xa91c
leaq 0x170(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1023e
leaq 0x170(%rsp), %rsi
movq %rbx, %rdi
callq 0x17adc
leaq 0x180(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1907b
movq 0x180(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x150(%rsp), %rdi
cmpq %r12, %rdi
je 0x19098
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x20(%r13), %rbx
leaq 0x120(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1c588(%rip), %rsi     # 0x35638
leaq 0x1c591(%rip), %rdx     # 0x35648
leaq 0x110(%rsp), %r14
movq %r14, %rdi
callq 0xa91c
leaq 0x130(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1023e
leaq 0x130(%rsp), %rsi
movq %rbx, %rdi
callq 0x144a2
leaq 0x140(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1910b
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x110(%rsp), %rdi
cmpq %r12, %rdi
je 0x19128
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x28(%r13), %rbx
leaq 0xe0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1c509(%rip), %rsi     # 0x35649
leaq 0x1c511(%rip), %rdx     # 0x35658
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
callq 0xa91c
leaq 0xf0(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1023e
leaq 0xf0(%rsp), %rsi
movq %rbx, %rdi
callq 0x15fd4
leaq 0x100(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1919b
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0xd0(%rsp), %rdi
cmpq %r12, %rdi
je 0x191b8
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x7390
movq (%r13), %rdi
callq 0x102b6
movq %r13, %rdi
callq 0x1974e
leaq 0xc0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1c47d(%rip), %rsi     # 0x35659
leaq 0x1c480(%rip), %rdx     # 0x35663
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdi
callq 0xa91c
movq %r13, %rdi
movq %rbx, %rsi
callq 0x19708
movq 0xb0(%rsp), %rdi
cmpq %r14, %rdi
je 0x19227
movq 0xc0(%rsp), %rsi
incq %rsi
movsd %xmm0, 0x20(%rsp)
callq 0x7390
movsd 0x20(%rsp), %xmm0
ucomisd 0x1b1d9(%rip), %xmm0    # 0x34408
jne 0x1923d
jp 0x1923d
movl $0x0, 0x30(%r13)
jmp 0x19297
leaq 0xa0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1c409(%rip), %rsi     # 0x35659
leaq 0x1c40c(%rip), %rdx     # 0x35663
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
callq 0xa91c
movq %r13, %rdi
movq %rbx, %rsi
callq 0x19708
cvttsd2si %xmm0, %eax
movl %eax, 0x30(%r13)
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0x19297
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x60(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1c3bd(%rip), %rsi     # 0x35664
leaq 0x1c3d0(%rip), %rdx     # 0x3567e
leaq 0x50(%rsp), %rdi
callq 0xa91c
movq %rsp, %rdi
leaq 0x50(%rsp), %rdx
movq %r13, %rsi
callq 0x1023e
leaq 0x1d387(%rip), %rsi     # 0x36656
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x7100
testl %eax, %eax
setne 0xd4(%r13)
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0x192f9
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0x19310
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x7390
addq $0x678, %rsp            # imm = 0x678
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1c27a(%rip), %rdi     # 0x355a3
callq 0x7560
movl $0x8, %edi
callq 0x7180
leaq 0x1c280(%rip), %rcx     # 0x355bf
movq %rcx, (%rax)
movq 0x2ebef(%rip), %rsi     # 0x47f38
movq %rax, %rdi
xorl %edx, %edx
callq 0x7660
movq %rax, %rbx
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0x195ca
movq 0xa0(%rsp), %rsi
jmp 0x195c2
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0x195ca
movq 0x60(%rsp), %rsi
jmp 0x195c2
jmp 0x1958b
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
cmpq %r14, %rdi
je 0x195ca
movq 0xc0(%rsp), %rsi
jmp 0x195c2
movq %rax, %rbx
leaq 0x100(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x193de
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x193de
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
cmpq %r12, %rdi
je 0x195ca
movq 0xe0(%rsp), %rsi
jmp 0x195c2
movq %rax, %rbx
leaq 0x140(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19425
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x19425
movq %rax, %rbx
movq 0x110(%rsp), %rdi
cmpq %r12, %rdi
je 0x195ca
movq 0x120(%rsp), %rsi
jmp 0x195c2
movq %rax, %rbx
leaq 0x180(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1946c
movq 0x180(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x1946c
movq %rax, %rbx
movq 0x150(%rsp), %rdi
cmpq %r12, %rdi
je 0x195ca
movq 0x160(%rsp), %rsi
jmp 0x195c2
movq %rax, %rbx
leaq 0x1c0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x194b3
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x194b3
movq %rax, %rbx
movq 0x190(%rsp), %rdi
cmpq %r12, %rdi
je 0x195ca
movq 0x1a0(%rsp), %rsi
jmp 0x195c2
movq %rax, %rbx
leaq 0x200(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x194fa
movq 0x200(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x194fa
movq %rax, %rbx
movq 0x1d0(%rsp), %rdi
cmpq %r12, %rdi
je 0x195ca
movq 0x1e0(%rsp), %rsi
jmp 0x195c2
movq %rax, %rbx
leaq 0x240(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19541
movq 0x240(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x19541
movq %rax, %rbx
movq 0x210(%rsp), %rdi
cmpq %r12, %rdi
je 0x195ca
movq 0x220(%rsp), %rsi
jmp 0x195c2
movq %rax, %rbx
movq 0x250(%rsp), %rdi
cmpq %r14, %rdi
je 0x195ca
movq 0x260(%rsp), %rsi
jmp 0x195c2
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x195ca
movq 0x80(%rsp), %rsi
jmp 0x195c2
jmp 0x1958b
movq %rax, %rbx
jmp 0x195ca
movq %rax, %rbx
jmp 0x195af
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x195af
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x7390
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x195ca
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x7390
movq %rbx, %rdi
callq 0x76a0