// File: /workspace/github_cpp_makefile_star2_O3/melop[P]admixem/config.cpp
// Function: GeneConfigurations::LoadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void GeneConfigurations::LoadFromFile(string szConfigFile) {
	#ifdef _OPENMP
		int nTotalCPUCore =  omp_get_max_threads();//omp_get_num_threads();
		//printf("OpenMP enabled\n");
	#else
		int nTotalCPUCore = 1;
		//printf("OpenMP disabled \n");
	#endif

	this->_nHaploidChrNum = ((SimulationConfigurations *)this->_pParentConfig)->pMarkerConfig->GetHaploidChromosomeNum();

	//Initialize _mpGenes
	//this->_mpGenes = new map<double, GeneProperties>[_nHaploidChrNum];
	//this->_mpGeneIndex = new map<double, int>[_nHaploidChrNum];
	vector<int> vIndexCounters;
	vector< map<double , GeneProperties> > mpGenes;
	vector< map<double, int> > mpGeneIndex;

	for (int i=0;i<_nHaploidChrNum;i++) {
		map<double , GeneProperties> oPlaceHolderMap1;
		map<double, int> oPlaceHolderMap2;

		mpGenes.push_back(oPlaceHolderMap1);
		mpGeneIndex.push_back(oPlaceHolderMap2);

		vIndexCounters.push_back(0);
	}

	FILE *pConfigFile;
	char szBuffer[12048];
	char szGeneName[100];
	char szMode[20];
	int nChr;
	double  nPos, nDomVal, nRecesVal , nDominantFreqPop1, nDominantFreqPop2;
	char nDominantName, nRecessiveName;

	
	
	printf("Start loading gene file %s ...\n", szConfigFile.c_str());

	_szConfigFilename = szConfigFile; // save name of config file

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

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

	if (fgets(szBuffer, 2048, pConfigFile) == NULL) { // skip the header line
		throw "Cannot read gene file!";
	}

	

	while(fgets(szBuffer, 12048, pConfigFile) != NULL) 
	{
		
		if (sscanf(szBuffer, "%[^\t\n]	%d	%lf	%c	%lf	%c	%lf	%s %lf %lf", szGeneName, &nChr ,&nPos, &nDominantName, &nDomVal, &nRecessiveName, &nRecesVal, szMode, &nDominantFreqPop1, &nDominantFreqPop2  ) != 10) {
			continue;//empty line
			
		};
		
		if (nChr > this->_nHaploidChrNum || nChr <=0) {
			throw "Chromosome number incorrect in the gene file!";
		}

		GeneProperties oGeneProp;
		oGeneProp.AlleleMode = strcmp(szMode,"Dominant")==0? GeneProperties::Dominant: strcmp(szMode,"Additive")==0? GeneProperties::Additive : GeneProperties::Hemizygous;
		oGeneProp.GeneName = szGeneName;
		oGeneProp.DominantLabel = nDominantName;
		oGeneProp.DominantValue = nDomVal;
		oGeneProp.RecessiveLabel = nRecessiveName;
		oGeneProp.RecessiveValue = nRecesVal;
		oGeneProp.DominantFreqPop1 = nDominantFreqPop1;
		oGeneProp.DominantFreqPop2 = nDominantFreqPop2;

		mpGenes[nChr-1][nPos] = oGeneProp;
		mpGeneIndex[nChr-1][nPos] = vIndexCounters.at(nChr-1);
		vIndexCounters.at(nChr-1) += 1;
		//nIndexCounter++;
		
	}

	
	//Try opening muation file too
	string szMutationFile = ((SimulationConfigurations *)this->_pParentConfig)->GetConfig("GeneMutationFile");
	if (szMutationFile=="") {
		std::printf("No mutation file specified for genes, no mutations will be carried out\n");
	}
	else {
		FILE *pMutationFile;
		char szBuffer[12048];
		char szFormula[12048];
		char szGeneName[100];
		char szPopName[1000];
		int nChr, nStartGen, nEndGen;
		double  nPos, nMuteRate, nLowerBound , nUpperBound;


		pMutationFile = fopen(szMutationFile.c_str(), "r");

		if (!pMutationFile) {
			printf("%s\n", "Cannot open gene mutation file ...");
			throw "Cannot open mutation file!";
		}

		if (fgets(szBuffer, 12048, pMutationFile) == NULL) { // skip the header line
			throw "Cannot read mutation file!";
		}

		while(fgets(szBuffer, 12048, pMutationFile) != NULL) 
		{
			bool bLongLineFormat = true;
			if (sscanf(szBuffer, "%[^\t\n]	%d	%lf	%[^\t\n]	%d	%d	%lf	%lf	%lf %s", szGeneName, &nChr ,&nPos, szPopName, &nStartGen, &nEndGen, &nMuteRate, &nLowerBound, &nUpperBound, szFormula  ) != 10) {
				
				//see if line in short format
				if (sscanf(szBuffer, "%[^\t\n]	%d	%lf	%lf	%lf	%lf %s", szGeneName, &nChr ,&nPos, &nMuteRate, &nLowerBound, &nUpperBound, szFormula  ) != 7) {
					continue;//empty line
				}
				else {
					bLongLineFormat = false;
				}
			}
			

			if (mpGenes.size() < nChr)
			{
				std::printf("Warning: Gene mutation definition applied to an undefined chromosome: %d", nChr);
			}
			else if (mpGenes[nChr-1].find(nPos) == mpGenes[nChr-1].end()) {//
				std::printf("Warning: Gene mutation definition applied to an undefined location: %f on chromosome %d", nPos, nChr);
			}
			else {
				mpGenes[nChr-1][nPos].MutationProb = nMuteRate;
				mpGenes[nChr-1][nPos].LowerBound = nLowerBound;
				mpGenes[nChr-1][nPos].UpperBound = nUpperBound;
				mpGenes[nChr-1][nPos].pFormula = new Parser(szFormula);
				mpGenes[nChr-1][nPos].sFormula = szFormula;
				string sPopName;
				if (bLongLineFormat) {
					mpGenes[nChr-1][nPos].Pops.insert( sPopName=szPopName );
					mpGenes[nChr-1][nPos].StartGen = nStartGen;
					mpGenes[nChr-1][nPos].EndGen = nEndGen;
				}
				else {
					//SHORT FORMAT DEFAULT TO ANY POP, ANY GEN
					mpGenes[nChr-1][nPos].Pops.insert( sPopName = "!ANYPOP" );
					mpGenes[nChr-1][nPos].StartGen = -1;
					mpGenes[nChr-1][nPos].EndGen = -1;
				}
				std::printf("Mutation rule %s (prob=%f) loaded for chr %d : %f, at Generations %d to %d in population %s\n", szFormula, nMuteRate, nChr, nPos, mpGenes[nChr-1][nPos].StartGen, mpGenes[nChr-1][nPos].EndGen, sPopName.c_str() );
			}

			
		};
		
	}

	for( int nCPU=0; nCPU<nTotalCPUCore ; nCPU++) {
		this->_mpmpGenes[nCPU] = mpGenes;
		this->_mpmpGeneIndex[nCPU] = mpGeneIndex;

	}

	//printf("%f \n", this->_mpGenes[23][100.0].DominantFreqPop1);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x9368, %rsp           # imm = 0x9368
movq %rsi, 0x20(%rsp)
movq 0x28(%rdi), %rax
movq (%rax), %rax
movl 0x8(%rax), %eax
movq %rdi, 0x68(%rsp)
movl %eax, 0x20(%rdi)
xorl %r14d, %r14d
movq %r14, 0x80(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
movq %r14, 0x40(%rsp)
movapd %xmm0, 0x30(%rsp)
movq %r14, 0xc0(%rsp)
movapd %xmm0, 0xb0(%rsp)
testl %eax, %eax
jle 0x17c2c
leaq 0x3548(%rsp), %rbx
leaq 0x248(%rsp), %r15
leaq 0x3540(%rsp), %r12
leaq 0x240(%rsp), %rbp
xorl %r13d, %r13d
movl %r14d, 0x3548(%rsp)
movq %r14, 0x3550(%rsp)
movq %rbx, 0x3558(%rsp)
movq %rbx, 0x3560(%rsp)
movq %r14, 0x3568(%rsp)
movl %r14d, 0x248(%rsp)
movq %r14, 0x250(%rsp)
movq %r15, 0x258(%rsp)
movq %r15, 0x260(%rsp)
movq %r14, 0x268(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x1a8fe
leaq 0xb0(%rsp), %rdi
movq %rbp, %rsi
callq 0x19e2e
movl $0x0, 0x6450(%rsp)
movq 0x78(%rsp), %rsi
cmpq 0x80(%rsp), %rsi
je 0x17bf8
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x78(%rsp)
jmp 0x17c0a
leaq 0x70(%rsp), %rdi
leaq 0x6450(%rsp), %rdx
callq 0x1bcea
movq %rbp, %rdi
callq 0x1ae3c
movq %r12, %rdi
callq 0x1baf0
incl %r13d
movq 0x68(%rsp), %rax
cmpl 0x20(%rax), %r13d
jl 0x17b60
movq 0x20(%rsp), %r14
movq (%r14), %rsi
leaq 0x1d6e3(%rip), %rdi     # 0x3531e
xorl %eax, %eax
callq 0x7060
movq 0x68(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x71d0
movq (%r14), %rdi
leaq 0x1f06e(%rip), %rsi     # 0x36cca
callq 0x7440
testq %rax, %rax
je 0x186da
movq %rax, %r14
leaq 0x3540(%rsp), %rdi
movl $0x800, %esi            # imm = 0x800
movq %rax, %rdx
callq 0x7590
testq %rax, %rax
je 0x186ef
leaq 0x3540(%rsp), %rdi
movl $0x2f10, %esi           # imm = 0x2F10
movq %r14, %rdx
callq 0x7590
testq %rax, %rax
je 0x17fa8
xorl %r15d, %r15d
leaq 0x3540(%rsp), %r13
leaq 0x1d0(%rsp), %rbp
leaq 0x158(%rsp), %r12
leaq 0x1d6c8(%rip), %rax     # 0x35393
movq %rax, 0x20(%rsp)
movq %r13, %rdi
leaq 0x1d692(%rip), %rsi     # 0x3536c
movq %rbp, %rdx
leaq 0x2c(%rsp), %rcx
movq %r12, %r8
leaq 0x1f(%rsp), %r9
xorl %eax, %eax
leaq 0xf8(%rsp), %r10
pushq %r10
leaq 0x108(%rsp), %r10
pushq %r10
leaq 0xe0(%rsp), %r10
pushq %r10
leaq 0x120(%rsp), %r10
pushq %r10
leaq 0x3e(%rsp), %r10
pushq %r10
leaq 0x138(%rsp), %r10
pushq %r10
callq 0x7360
addq $0x30, %rsp
cmpl $0xa, %eax
jne 0x17f8f
movl 0x2c(%rsp), %eax
testl %eax, %eax
jle 0x186fb
cmpl 0x20(%rbx), %eax
jg 0x186fb
leaq 0x250(%rsp), %rax
movq %rax, 0x240(%rsp)
movq %r15, 0x248(%rsp)
movb %r15b, 0x250(%rsp)
leaq 0x2c0(%rsp), %rax
movq %rax, 0x2b0(%rsp)
movq %r15, 0x2b8(%rsp)
movb %r15b, 0x2c0(%rsp)
movl $0x0, 0x2d8(%rsp)
movq %r15, 0x2e0(%rsp)
leaq 0x2d8(%rsp), %rax
movq %rax, 0x2e8(%rsp)
movq %rax, 0x2f0(%rsp)
movq %r15, 0x2f8(%rsp)
movq %r15, 0x290(%rsp)
movq 0xd0(%rsp), %rax
movabsq $0x746e616e696d6f44, %rcx # imm = 0x746E616E696D6F44
xorq %rcx, %rax
movzbl 0xd8(%rsp), %ecx
orq %rax, %rcx
je 0x17e10
movq 0xd0(%rsp), %rcx
movabsq $0x6576697469646441, %rax # imm = 0x6576697469646441
xorq %rax, %rcx
movzbl 0xd8(%rsp), %edx
xorl %eax, %eax
orq %rcx, %rdx
sete %al
jmp 0x17e15
movl $0x2, %eax
movl %eax, 0x288(%rsp)
movq %rbp, %rdi
callq 0x7170
leaq 0x240(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %rbp, %rcx
movq %rax, %r8
callq 0x7570
movb 0x1f(%rsp), %al
movb %al, 0x260(%rsp)
movsd 0x110(%rsp), %xmm0
movsd %xmm0, 0x268(%rsp)
movb 0x1e(%rsp), %al
movb %al, 0x261(%rsp)
movsd 0x108(%rsp), %xmm0
movsd %xmm0, 0x270(%rsp)
movsd 0x100(%rsp), %xmm0
movsd %xmm0, 0x278(%rsp)
movsd 0xf8(%rsp), %xmm0
movsd %xmm0, 0x280(%rsp)
movslq 0x2c(%rsp), %rax
movq 0x30(%rsp), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
leaq (%rcx,%rax), %rdi
addq $-0x30, %rdi
movq %r12, %rsi
callq 0x1a92a
movq %rax, %rdi
leaq 0x240(%rsp), %rsi
callq 0x1886e
movslq 0x2c(%rsp), %rax
leaq -0x1(%rax), %rsi
movq 0x70(%rsp), %rcx
movq 0x78(%rsp), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rsi, %rdx
jbe 0x186cc
movl -0x4(%rcx,%rax,4), %ebx
leaq (%rsi,%rsi,2), %rdi
shlq $0x4, %rdi
addq 0xb0(%rsp), %rdi
movq %r12, %rsi
callq 0x19ec6
movl %ebx, (%rax)
movslq 0x2c(%rsp), %rax
leaq -0x1(%rax), %rsi
movq 0x70(%rsp), %rcx
movq 0x78(%rsp), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rsi, %rdx
jbe 0x186cc
incl -0x4(%rcx,%rax,4)
leaq 0x2d0(%rsp), %rdi
callq 0x1bb92
movq 0x2b0(%rsp), %rdi
leaq 0x2c0(%rsp), %rax
cmpq %rax, %rdi
movq 0x68(%rsp), %rbx
je 0x17f6a
movq 0x2c0(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x240(%rsp), %rdi
leaq 0x250(%rsp), %rax
cmpq %rax, %rdi
je 0x17f8f
movq 0x250(%rsp), %rsi
incq %rsi
callq 0x7390
movq %r13, %rdi
movl $0x2f10, %esi           # imm = 0x2F10
movq %r14, %rdx
callq 0x7590
testq %rax, %rax
jne 0x17cd0
movq 0x28(%rbx), %r14
leaq 0x128(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1d414(%rip), %rsi     # 0x353d3
leaq 0x1d41d(%rip), %rdx     # 0x353e3
leaq 0x118(%rsp), %rdi
callq 0xa91c
leaq 0x138(%rsp), %rdi
leaq 0x118(%rsp), %rdx
movq %r14, %rsi
callq 0x1023e
movq 0x118(%rsp), %rdi
cmpq %r15, %rdi
je 0x18008
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x1d02a(%rip), %rsi     # 0x35039
leaq 0x138(%rsp), %rdi
callq 0x7100
testl %eax, %eax
je 0x185f7
movq 0x138(%rsp), %rdi
leaq 0x1ec97(%rip), %rsi     # 0x36cca
callq 0x7440
testq %rax, %rax
je 0x1871e
movq %rax, %r14
leaq 0x240(%rsp), %rdi
movl $0x2f10, %esi           # imm = 0x2F10
movq %rax, %rdx
callq 0x7590
testq %rax, %rax
je 0x18733
leaq 0x240(%rsp), %rdi
movl $0x2f10, %esi           # imm = 0x2F10
movq %r14, %rdx
callq 0x7590
testq %rax, %rax
je 0x18603
leaq 0x6450(%rsp), %r15
leaq 0xf0(%rsp), %r13
leaq 0x240(%rsp), %rbp
movq %r14, 0xa0(%rsp)
movq %rbp, %rdi
leaq 0x1d393(%rip), %rsi     # 0x3543d
leaq 0x160(%rsp), %rdx
leaq 0xc(%rsp), %rcx
leaq 0x10(%rsp), %r8
leaq 0x3150(%rsp), %r9
xorl %eax, %eax
pushq %r15
pushq %r13
leaq 0xb8(%rsp), %r10
pushq %r10
leaq 0xa8(%rsp), %r10
pushq %r10
leaq 0xb8(%rsp), %r10
pushq %r10
leaq 0xc4(%rsp), %r10
pushq %r10
callq 0x7360
addq $0x30, %rsp
movl %eax, %r12d
cmpl $0xa, %eax
je 0x1814d
subq $0x8, %rsp
movq %rbp, %rdi
leaq 0x1d356(%rip), %rsi     # 0x35467
leaq 0x168(%rsp), %rdx
leaq 0x14(%rsp), %rcx
leaq 0x18(%rsp), %r8
leaq 0x98(%rsp), %r9
xorl %eax, %eax
pushq %r15
pushq %r13
leaq 0xc0(%rsp), %r10
pushq %r10
callq 0x7360
addq $0x20, %rsp
cmpl $0x7, %eax
jne 0x181e8
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rax
subq %rcx, %rax
sarq $0x4, %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rax
movslq 0xc(%rsp), %rsi
cmpq %rsi, %rax
jae 0x18186
leaq 0x1d307(%rip), %rdi     # 0x35484
xorl %eax, %eax
callq 0x7060
jmp 0x181e8
leaq (%rsi,%rsi,2), %rdx
shlq $0x4, %rdx
movq -0x20(%rcx,%rdx), %rax
movsd 0x10(%rsp), %xmm0
testq %rax, %rax
je 0x181da
leaq (%rcx,%rdx), %rdi
addq $-0x30, %rdi
addq %rcx, %rdx
addq $-0x28, %rdx
movq %rdx, %rcx
xorl %r8d, %r8d
ucomisd 0x20(%rax), %xmm0
cmovbeq %rax, %rcx
seta %r8b
movq 0x10(%rax,%r8,8), %rax
testq %rax, %rax
jne 0x181b0
cmpq %rdx, %rcx
je 0x181da
movsd 0x20(%rcx), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x18206
leaq 0x1d2ec(%rip), %rdi     # 0x354cd
movb $0x1, %al
callq 0x7060
movq %rbp, %rdi
movl $0x2f10, %esi           # imm = 0x2F10
movq %r14, %rdx
callq 0x7590
testq %rax, %rax
jne 0x180a0
jmp 0x18603
movsd 0x90(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0x10(%rsp), %rsi
callq 0x1a92a
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x50(%rax)
movsd 0xa8(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movslq 0xc(%rsp), %rax
movq 0x30(%rsp), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
leaq (%rcx,%rax), %rdi
addq $-0x30, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1a92a
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x58(%rax)
movsd 0xf0(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movslq 0xc(%rsp), %rax
movq 0x30(%rsp), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
leaq (%rcx,%rax), %rdi
addq $-0x30, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1a92a
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x60(%rax)
movl $0x98, %edi
callq 0x7380
movq %rax, %r15
leaq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0x6450(%rsp), %r14
movq %r14, %rdi
callq 0x7170
leaq (%rsp,%rax), %rdx
addq $0x6450, %rdx           # imm = 0x6450
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa91c
movb $0x1, %r14b
movq %r15, %rdi
movq %rbx, %rsi
callq 0x19fda
movslq 0xc(%rsp), %rax
movq 0x30(%rsp), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
leaq (%rcx,%rax), %rdi
addq $-0x30, %rdi
xorl %r14d, %r14d
leaq 0x10(%rsp), %rsi
callq 0x1a92a
movq %r15, 0x68(%rax)
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x1833d
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x7390
movslq 0xc(%rsp), %rax
movq 0x30(%rsp), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
leaq (%rcx,%rax), %rdi
addq $-0x30, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1a92a
movq %rax, %r15
addq $0x70, %r15
movq 0x78(%rax), %r14
movq %r13, %rbx
leaq 0x6450(%rsp), %r13
movq %r13, %rdi
callq 0x7170
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq 0xa0(%rsp), %r14
movq %r13, %rcx
movq %rbx, %r13
movq %rax, %r8
callq 0x7570
movslq 0xc(%rsp), %rax
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
movq 0x30(%rsp), %rcx
leaq (%rcx,%rax), %rdi
addq $-0x30, %rdi
leaq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
movq $0x0, 0x50(%rsp)
movb $0x0, 0x58(%rsp)
cmpl $0xa, %r12d
jne 0x1848b
leaq 0x10(%rsp), %rsi
callq 0x1a92a
movq %rax, %r15
movq 0x50(%rsp), %r14
leaq 0x3150(%rsp), %rbx
movq %rbx, %rdi
callq 0x7170
leaq 0x48(%rsp), %rdi
xorl %esi, %esi
movq %r14, %rdx
movq 0xa0(%rsp), %r14
movq %rbx, %rcx
movq %rax, %r8
callq 0x7570
addq $0x90, %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x20d64
movl 0x9c(%rsp), %ebx
movslq 0xc(%rsp), %rax
movq 0x30(%rsp), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
leaq (%rcx,%rax), %rdi
addq $-0x30, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1a92a
movl %ebx, 0xc0(%rax)
movl 0x98(%rsp), %ebx
movslq 0xc(%rsp), %rax
movq 0x30(%rsp), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
leaq (%rcx,%rax), %rdi
addq $-0x30, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1a92a
jmp 0x1851f
leaq 0x10(%rsp), %rsi
callq 0x1a92a
movq %rax, %r15
movq 0x50(%rsp), %rdx
movl $0x7, %r8d
leaq 0x48(%rsp), %rdi
xorl %esi, %esi
leaq 0x1d074(%rip), %rcx     # 0x35525
callq 0x7570
addq $0x90, %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x20d64
movslq 0xc(%rsp), %rax
movq 0x30(%rsp), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
leaq (%rcx,%rax), %rdi
addq $-0x30, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1a92a
movl $0xffffffff, 0xc0(%rax) # imm = 0xFFFFFFFF
movslq 0xc(%rsp), %rax
movq 0x30(%rsp), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
leaq (%rcx,%rax), %rdi
addq $-0x30, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1a92a
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, 0xc4(%rax)
movsd 0x90(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movslq 0xc(%rsp), %r15
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0xe8(%rsp)
movq 0x30(%rsp), %rax
leaq (%r15,%r15,2), %rcx
shlq $0x4, %rcx
leaq (%rax,%rcx), %rdi
addq $-0x30, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1a92a
movl 0xc0(%rax), %r12d
movslq 0xc(%rsp), %rax
movq 0x30(%rsp), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
leaq (%rcx,%rax), %rdi
addq $-0x30, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1a92a
movl 0xc4(%rax), %r8d
movq 0x48(%rsp), %r9
leaq 0x1cf88(%rip), %rdi     # 0x3552d
leaq 0x6450(%rsp), %rsi
movsd 0x20(%rsp), %xmm0
movl %r15d, %edx
movsd 0xe8(%rsp), %xmm1
movl %r12d, %ecx
movb $0x2, %al
callq 0x7060
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x185e5
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x68(%rsp), %rbx
leaq 0x6450(%rsp), %r15
jmp 0x181e8
leaq 0x1d709(%rip), %rdi     # 0x35d07
callq 0x7560
leaq 0x30(%rbx), %r14
leaq 0x240(%rsp), %r15
movl $0x0, (%r15)
addq $0x60, %rbx
leaq 0x30(%rsp), %r12
leaq 0xb0(%rsp), %r13
movq %r14, %rdi
movq %r15, %rsi
callq 0x1a9dc
movq %rax, %rdi
movq %r12, %rsi
callq 0x1aa42
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1abc4
movq %rax, %rdi
movq %r13, %rsi
callq 0x1ac2a
movl 0x240(%rsp), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x240(%rsp)
testl %eax, %eax
js 0x18627
leaq 0x148(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18689
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0xb0(%rsp), %rdi
callq 0x1adac
leaq 0x30(%rsp), %rdi
callq 0x1adf4
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x186ba
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
addq $0x9368, %rsp           # imm = 0x9368
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1d4f3(%rip), %rdi     # 0x35bc6
xorl %eax, %eax
callq 0x7530
leaq 0x1c76c(%rip), %rdi     # 0x34e4d
callq 0x7560
leaq 0x1cc51(%rip), %rax     # 0x3533e
jmp 0x186f6
leaq 0x1cc5f(%rip), %rax     # 0x35355
movq %rax, 0x20(%rsp)
movl $0x8, %edi
callq 0x7180
movq 0x20(%rsp), %rcx
movq %rcx, (%rax)
movq 0x2f824(%rip), %rsi     # 0x47f38
movq %rax, %rdi
xorl %edx, %edx
callq 0x7660
leaq 0x1ccbf(%rip), %rdi     # 0x353e4
callq 0x7560
leaq 0x1ccd6(%rip), %rbx     # 0x35407
jmp 0x1873a
leaq 0x1cce8(%rip), %rbx     # 0x35422
movl $0x8, %edi
callq 0x7180
movq %rbx, (%rax)
movq 0x2f7ea(%rip), %rsi     # 0x47f38
movq %rax, %rdi
xorl %edx, %edx
callq 0x7660
movq %rax, %rbx
jmp 0x187a9
movq %rax, %rbx
movq 0x118(%rsp), %rdi
cmpq %r15, %rdi
je 0x18834
movq 0x128(%rsp), %rsi
jmp 0x1882c
jmp 0x187d8
jmp 0x18810
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x187a4
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x7390
testb %r14b, %r14b
je 0x18813
movl $0x98, %esi
movq %r15, %rdi
jmp 0x187cf
jmp 0x18810
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x18813
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x18813
jmp 0x187f1
movq %rax, %rbx
jmp 0x18834
jmp 0x187df
movq %rax, %rbx
leaq 0x240(%rsp), %rdi
callq 0x1a996
jmp 0x18834
movq %rax, %rbx
leaq 0x240(%rsp), %rdi
callq 0x1ae3c
leaq 0x3540(%rsp), %rdi
callq 0x1baf0
jmp 0x18834
movq %rax, %rbx
leaq 0x148(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18834
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0xb0(%rsp), %rdi
callq 0x1adac
leaq 0x30(%rsp), %rdi
callq 0x1adf4
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x18865
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq %rbx, %rdi
callq 0x76a0
nop