// File: /workspace/github_cpp_makefile_star2_O1/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 0x1da50(%rip), %rdi     # 0x3656a
callq 0x7560
movq %r14, 0x28(%rsp)
leaq 0x38(%r14), %rdi
movq %rbx, %rsi
callq 0x71d0
movq (%rbx), %rdi
leaq 0x1f188(%rip), %rsi     # 0x37cc2
callq 0x7440
testq %rax, %rax
je 0x19240
movq %rax, %rbp
leaq 0x270(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %rax, %rdx
callq 0x7590
testq %rax, %rax
je 0x18c78
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 0x1da08(%rip), %rsi     # 0x365b8
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 0xa886
movq %r13, 0x30(%rsp)
movq %r12, %rdi
callq 0x7170
movq %r12, %rdx
addq %rax, %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0xa886
movq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x19edc
movq %r14, %r12
movq %rax, %rdi
movq %rbx, %rsi
callq 0x71d0
movq (%rsp), %rsi
movq 0x30(%rsp), %rdx
leaq 0x1d99e(%rip), %rdi     # 0x365c4
xorl %eax, %eax
callq 0x7060
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x18c44
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x7390
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x18c5f
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 0x18b89
movq %rbp, %rdi
callq 0x7370
movq 0x28(%rsp), %r13
movq %r13, %rdi
callq 0x194f0
leaq 0x80(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1d92e(%rip), %rsi     # 0x365ce
leaq 0x1d934(%rip), %rdx     # 0x365db
leaq 0x70(%rsp), %rdi
callq 0xa886
movq %rsp, %rdi
leaq 0x70(%rsp), %rdx
movq %r13, %rsi
callq 0x1007e
leaq 0x10(%rsp), %r15
movq -0x10(%r15), %rdx
leaq 0x1d8f3(%rip), %rdi     # 0x365c4
leaq 0x1d8f6(%rip), %rsi     # 0x365ce
xorl %eax, %eax
callq 0x7060
movq -0x10(%r15), %rdi
cmpq %r15, %rdi
je 0x18cf5
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x18d0f
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x260(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1d8c4(%rip), %rsi     # 0x365e6
leaq 0x1d8cb(%rip), %rdx     # 0x365f4
leaq 0x250(%rsp), %rbx
movq %rbx, %rdi
callq 0xa886
movq %r13, %rdi
movq %rbx, %rsi
callq 0x19626
leaq 0x1d891(%rip), %rdi     # 0x365dc
leaq 0x1d894(%rip), %rsi     # 0x365e6
movb $0x1, %al
callq 0x7060
movq 0x250(%rsp), %rdi
cmpq %r14, %rdi
je 0x18d76
movq 0x260(%rsp), %rsi
incq %rsi
callq 0x7390
movq (%r13), %rbx
leaq 0x220(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1d867(%rip), %rsi     # 0x365f5
leaq 0x1d86a(%rip), %rdx     # 0x365ff
leaq 0x210(%rsp), %r14
movq %r14, %rdi
callq 0xa886
leaq 0x230(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1007e
leaq 0x230(%rsp), %rsi
movq %rbx, %rdi
callq 0xf9f8
leaq 0x240(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18de9
movq 0x240(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x210(%rsp), %rdi
cmpq %r12, %rdi
je 0x18e06
movq 0x220(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x8(%r13), %rbx
leaq 0x1e0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1d7e2(%rip), %rsi     # 0x36600
leaq 0x1d7e9(%rip), %rdx     # 0x3660e
leaq 0x1d0(%rsp), %r14
movq %r14, %rdi
callq 0xa886
leaq 0x1f0(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1007e
leaq 0x1f0(%rsp), %rsi
movq %rbx, %rdi
callq 0x10afe
leaq 0x200(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18e79
movq 0x200(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x1d0(%rsp), %rdi
cmpq %r12, %rdi
je 0x18e96
movq 0x1e0(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x10(%r13), %rbx
leaq 0x1a0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1d720(%rip), %rsi     # 0x365ce
leaq 0x1d726(%rip), %rdx     # 0x365db
leaq 0x190(%rsp), %r14
movq %r14, %rdi
callq 0xa886
leaq 0x1b0(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1007e
leaq 0x1b0(%rsp), %rsi
movq %rbx, %rdi
callq 0x13592
leaq 0x1c0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18f09
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x190(%rsp), %rdi
cmpq %r12, %rdi
je 0x18f26
movq 0x1a0(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x18(%r13), %rbx
leaq 0x160(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1d6d1(%rip), %rsi     # 0x3660f
leaq 0x1d6d2(%rip), %rdx     # 0x36617
leaq 0x150(%rsp), %r14
movq %r14, %rdi
callq 0xa886
leaq 0x170(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1007e
leaq 0x170(%rsp), %rsi
movq %rbx, %rdi
callq 0x179a4
leaq 0x180(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18f99
movq 0x180(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x150(%rsp), %rdi
cmpq %r12, %rdi
je 0x18fb6
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x20(%r13), %rbx
leaq 0x120(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1d64a(%rip), %rsi     # 0x36618
leaq 0x1d653(%rip), %rdx     # 0x36628
leaq 0x110(%rsp), %r14
movq %r14, %rdi
callq 0xa886
leaq 0x130(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1007e
leaq 0x130(%rsp), %rsi
movq %rbx, %rdi
callq 0x142e4
leaq 0x140(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19029
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x110(%rsp), %rdi
cmpq %r12, %rdi
je 0x19046
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x28(%r13), %rbx
leaq 0xe0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1d5cb(%rip), %rsi     # 0x36629
leaq 0x1d5d3(%rip), %rdx     # 0x36638
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
callq 0xa886
leaq 0xf0(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1007e
leaq 0xf0(%rsp), %rsi
movq %rbx, %rdi
callq 0x15e82
leaq 0x100(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x190b9
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0xd0(%rsp), %rdi
cmpq %r12, %rdi
je 0x190d6
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x7390
movq (%r13), %rdi
callq 0x100f6
movq %r13, %rdi
callq 0x1966c
leaq 0xc0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1d53f(%rip), %rsi     # 0x36639
leaq 0x1d542(%rip), %rdx     # 0x36643
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdi
callq 0xa886
movq %r13, %rdi
movq %rbx, %rsi
callq 0x19626
movq 0xb0(%rsp), %rdi
cmpq %r14, %rdi
je 0x19145
movq 0xc0(%rsp), %rsi
incq %rsi
movsd %xmm0, 0x20(%rsp)
callq 0x7390
movsd 0x20(%rsp), %xmm0
ucomisd 0x1c2eb(%rip), %xmm0    # 0x35438
jne 0x1915b
jp 0x1915b
movl $0x0, 0x30(%r13)
jmp 0x191b5
leaq 0xa0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1d4cb(%rip), %rsi     # 0x36639
leaq 0x1d4ce(%rip), %rdx     # 0x36643
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
callq 0xa886
movq %r13, %rdi
movq %rbx, %rsi
callq 0x19626
cvttsd2si %xmm0, %eax
movl %eax, 0x30(%r13)
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0x191b5
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x60(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1d47f(%rip), %rsi     # 0x36644
leaq 0x1d492(%rip), %rdx     # 0x3665e
leaq 0x50(%rsp), %rdi
callq 0xa886
movq %rsp, %rdi
leaq 0x50(%rsp), %rdx
movq %r13, %rsi
callq 0x1007e
leaq 0x1e489(%rip), %rsi     # 0x37676
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x7100
testl %eax, %eax
setne 0xd4(%r13)
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0x19217
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0x1922e
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 0x1d33c(%rip), %rdi     # 0x36583
callq 0x7560
movl $0x8, %edi
callq 0x7180
leaq 0x1d342(%rip), %rcx     # 0x3659f
movq %rcx, (%rax)
movq 0x2fcd1(%rip), %rsi     # 0x48f38
movq %rax, %rdi
xorl %edx, %edx
callq 0x7660
movq %rax, %rbx
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0x194e8
movq 0xa0(%rsp), %rsi
jmp 0x194e0
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0x194e8
movq 0x60(%rsp), %rsi
jmp 0x194e0
jmp 0x194a9
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
cmpq %r14, %rdi
je 0x194e8
movq 0xc0(%rsp), %rsi
jmp 0x194e0
movq %rax, %rbx
leaq 0x100(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x192fc
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x192fc
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
cmpq %r12, %rdi
je 0x194e8
movq 0xe0(%rsp), %rsi
jmp 0x194e0
movq %rax, %rbx
leaq 0x140(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19343
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x19343
movq %rax, %rbx
movq 0x110(%rsp), %rdi
cmpq %r12, %rdi
je 0x194e8
movq 0x120(%rsp), %rsi
jmp 0x194e0
movq %rax, %rbx
leaq 0x180(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1938a
movq 0x180(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x1938a
movq %rax, %rbx
movq 0x150(%rsp), %rdi
cmpq %r12, %rdi
je 0x194e8
movq 0x160(%rsp), %rsi
jmp 0x194e0
movq %rax, %rbx
leaq 0x1c0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x193d1
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x193d1
movq %rax, %rbx
movq 0x190(%rsp), %rdi
cmpq %r12, %rdi
je 0x194e8
movq 0x1a0(%rsp), %rsi
jmp 0x194e0
movq %rax, %rbx
leaq 0x200(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19418
movq 0x200(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x19418
movq %rax, %rbx
movq 0x1d0(%rsp), %rdi
cmpq %r12, %rdi
je 0x194e8
movq 0x1e0(%rsp), %rsi
jmp 0x194e0
movq %rax, %rbx
leaq 0x240(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1945f
movq 0x240(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x1945f
movq %rax, %rbx
movq 0x210(%rsp), %rdi
cmpq %r12, %rdi
je 0x194e8
movq 0x220(%rsp), %rsi
jmp 0x194e0
movq %rax, %rbx
movq 0x250(%rsp), %rdi
cmpq %r14, %rdi
je 0x194e8
movq 0x260(%rsp), %rsi
jmp 0x194e0
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x194e8
movq 0x80(%rsp), %rsi
jmp 0x194e0
jmp 0x194a9
movq %rax, %rbx
jmp 0x194e8
movq %rax, %rbx
jmp 0x194cd
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x194cd
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x7390
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x194e8
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x7390
movq %rbx, %rdi
callq 0x76a0