// File: /workspace/github_cpp_makefile_star2_O1/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 $0x9358, %rsp           # imm = 0x9358
movq %rsi, 0x20(%rsp)
movq 0x28(%rdi), %rax
movq (%rax), %rax
movl 0x8(%rax), %eax
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)
movq %rdi, 0x48(%rsp)
cmpl $0x0, 0x20(%rdi)
jle 0x17af6
leaq 0x3538(%rsp), %rbx
leaq 0x238(%rsp), %r15
leaq 0x3530(%rsp), %r12
leaq 0x230(%rsp), %rbp
xorl %r13d, %r13d
movl %r14d, 0x3538(%rsp)
movq %r14, 0x3540(%rsp)
movq %rbx, 0x3548(%rsp)
movq %rbx, 0x3550(%rsp)
movq %r14, 0x3558(%rsp)
movl %r14d, 0x238(%rsp)
movq %r14, 0x240(%rsp)
movq %r15, 0x248(%rsp)
movq %r15, 0x250(%rsp)
movq %r14, 0x258(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x1a84e
leaq 0xb0(%rsp), %rdi
movq %rbp, %rsi
callq 0x19db0
movl $0x0, 0x6440(%rsp)
movq 0x78(%rsp), %rsi
cmpq 0x80(%rsp), %rsi
je 0x17ac2
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x78(%rsp)
jmp 0x17ad4
leaq 0x70(%rsp), %rdi
leaq 0x6440(%rsp), %rdx
callq 0x1bc0c
movq %rbp, %rdi
callq 0x1ad32
movq %r12, %rdi
callq 0x1ba12
incl %r13d
movq 0x48(%rsp), %rax
cmpl 0x20(%rax), %r13d
jl 0x17a2a
movq 0x20(%rsp), %rbx
movq (%rbx), %rsi
leaq 0x1e7f9(%rip), %rdi     # 0x362fe
xorl %eax, %eax
callq 0x7060
movq 0x48(%rsp), %rdi
movq %rbx, %rsi
callq 0x71d0
movq (%rbx), %rdi
leaq 0x2019f(%rip), %rsi     # 0x37cc2
callq 0x7440
testq %rax, %rax
je 0x185d0
movq %rax, %r14
leaq 0x3530(%rsp), %rdi
movl $0x800, %esi            # imm = 0x800
movq %rax, %rdx
callq 0x7590
testq %rax, %rax
je 0x185e5
leaq 0x3530(%rsp), %rdi
movl $0x2f10, %esi           # imm = 0x2F10
movq %r14, %rdx
callq 0x7590
testq %rax, %rax
je 0x17e7d
leaq 0x240(%rsp), %rbx
leaq 0xa8(%rsp), %r13
xorl %r15d, %r15d
leaq 0x3530(%rsp), %rdi
leaq 0x148(%rsp), %r12
leaq 0x1e7d9(%rip), %rax     # 0x36373
movq %rax, 0x20(%rsp)
movq %rdi, %rbp
leaq 0x1e7a3(%rip), %rsi     # 0x3634c
leaq 0x150(%rsp), %rdx
leaq 0x2c(%rsp), %rcx
movq %r12, %r8
leaq 0x1f(%rsp), %r9
xorl %eax, %eax
pushq %r13
leaq 0xf8(%rsp), %r10
pushq %r10
leaq 0xe0(%rsp), %r10
pushq %r10
leaq 0x110(%rsp), %r10
pushq %r10
leaq 0x3e(%rsp), %r10
pushq %r10
leaq 0x128(%rsp), %r10
pushq %r10
callq 0x7360
addq $0x30, %rsp
cmpl $0xa, %eax
jne 0x17e61
movl 0x2c(%rsp), %eax
testl %eax, %eax
jle 0x185f1
movq 0x48(%rsp), %rcx
cmpl 0x20(%rcx), %eax
jg 0x185f1
movq %rbx, 0x230(%rsp)
movq %r15, 0x238(%rsp)
movb %r15b, 0x240(%rsp)
leaq 0x2b0(%rsp), %rax
movq %rax, 0x2a0(%rsp)
movq %r15, 0x2a8(%rsp)
movb %r15b, 0x2b0(%rsp)
movl $0x0, 0x2c8(%rsp)
movq %r15, 0x2d0(%rsp)
leaq 0x2c8(%rsp), %rax
movq %rax, 0x2d8(%rsp)
movq %rax, 0x2e0(%rsp)
movq %r15, 0x2e8(%rsp)
movq %r15, 0x280(%rsp)
movq 0xd0(%rsp), %rax
movabsq $0x746e616e696d6f44, %rcx # imm = 0x746E616E696D6F44
xorq %rcx, %rax
movzbl 0xd8(%rsp), %ecx
orq %rax, %rcx
je 0x17cd9
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 0x17cde
movl $0x2, %eax
movq %rbx, %r13
movl %eax, 0x278(%rsp)
leaq 0x150(%rsp), %rbx
movq %rbx, %rdi
callq 0x7170
leaq 0x230(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %rbx, %rcx
movq %rax, %r8
callq 0x7570
movb 0x1f(%rsp), %al
movb %al, 0x250(%rsp)
movsd 0x100(%rsp), %xmm0
movsd %xmm0, 0x258(%rsp)
movb 0x1e(%rsp), %al
movb %al, 0x251(%rsp)
movsd 0xf8(%rsp), %xmm0
movsd %xmm0, 0x260(%rsp)
movsd 0xf0(%rsp), %xmm0
movsd %xmm0, 0x268(%rsp)
movsd 0xa8(%rsp), %xmm0
movsd %xmm0, 0x270(%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 0x1a87a
movq %rax, %rdi
leaq 0x230(%rsp), %rsi
callq 0x18766
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 0x185c2
movl -0x4(%rcx,%rax,4), %ebx
leaq (%rsi,%rsi,2), %rdi
shlq $0x4, %rdi
addq 0xb0(%rsp), %rdi
movq %r12, %rsi
callq 0x19e46
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 0x185c2
incl -0x4(%rcx,%rax,4)
leaq 0x2c0(%rsp), %rdi
callq 0x1bab4
movq 0x2a0(%rsp), %rdi
leaq 0x2b0(%rsp), %rax
cmpq %rax, %rdi
movq %r13, %rbx
je 0x17e3c
movq 0x2b0(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x230(%rsp), %rdi
cmpq %rbx, %rdi
leaq 0xa8(%rsp), %r13
je 0x17e61
movq 0x240(%rsp), %rsi
incq %rsi
callq 0x7390
movq %rbp, %rdi
movl $0x2f10, %esi           # imm = 0x2F10
movq %r14, %rdx
callq 0x7590
movq %rbp, %rdi
testq %rax, %rax
jne 0x17b9f
movq 0x48(%rsp), %rax
movq 0x28(%rax), %r14
leaq 0x118(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1e51a(%rip), %rsi     # 0x363b3
leaq 0x1e523(%rip), %rdx     # 0x363c3
leaq 0x108(%rsp), %rdi
callq 0xa886
leaq 0x128(%rsp), %rdi
leaq 0x108(%rsp), %rdx
movq %r14, %rsi
callq 0x1007e
movq 0x108(%rsp), %rdi
cmpq %r15, %rdi
je 0x17ee2
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x1e130(%rip), %rsi     # 0x36019
leaq 0x128(%rsp), %rdi
callq 0x7100
testl %eax, %eax
je 0x184e8
movq 0x128(%rsp), %rdi
leaq 0x1fdb5(%rip), %rsi     # 0x37cc2
callq 0x7440
testq %rax, %rax
je 0x18614
movq %rax, %r15
leaq 0x230(%rsp), %rdi
movl $0x2f10, %esi           # imm = 0x2F10
movq %rax, %rdx
callq 0x7590
testq %rax, %rax
je 0x18629
leaq 0x230(%rsp), %rdi
movl $0x2f10, %esi           # imm = 0x2F10
movq %r15, %rdx
callq 0x7590
testq %rax, %rax
je 0x184f4
leaq 0x98(%rsp), %r14
leaq 0xa0(%rsp), %rbp
leaq 0x230(%rsp), %r12
leaq 0x1c0(%rsp), %r13
leaq 0xc(%rsp), %rbx
movq %r12, %rdi
leaq 0x1e494(%rip), %rsi     # 0x3641d
movq %r13, %rdx
movq %rbx, %rcx
leaq 0x10(%rsp), %r8
leaq 0x3140(%rsp), %r9
xorl %eax, %eax
leaq 0x6440(%rsp), %r10
pushq %r10
pushq %r14
pushq %rbp
leaq 0xa0(%rsp), %r10
pushq %r10
leaq 0xb0(%rsp), %r10
pushq %r10
leaq 0xbc(%rsp), %r10
pushq %r10
callq 0x7360
addq $0x30, %rsp
movl %eax, %r12d
cmpl $0xa, %eax
je 0x18021
subq $0x8, %rsp
leaq 0x238(%rsp), %rdi
leaq 0x1e45a(%rip), %rsi     # 0x36447
movq %r13, %rdx
movq %rbx, %rcx
leaq 0x18(%rsp), %r8
leaq 0x90(%rsp), %r9
xorl %eax, %eax
leaq 0x6448(%rsp), %r10
pushq %r10
pushq %r14
pushq %rbp
callq 0x7360
addq $0x20, %rsp
cmpl $0x7, %eax
jne 0x184c5
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
subq %rax, %rcx
sarq $0x4, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
movslq 0xc(%rsp), %rsi
cmpq %rsi, %rcx
jae 0x1805d
leaq 0x1e413(%rip), %rdi     # 0x36464
xorl %eax, %eax
callq 0x7060
jmp 0x184c5
leaq (%rsi,%rsi,2), %rcx
shlq $0x4, %rcx
leaq (%rax,%rcx), %rdx
addq $-0x28, %rdx
movq 0x8(%rdx), %r8
movq %rdx, %rdi
testq %r8, %r8
je 0x1809d
movsd 0x10(%rsp), %xmm0
movq %rdx, %rdi
xorl %r9d, %r9d
ucomisd 0x20(%r8), %xmm0
cmovbeq %r8, %rdi
seta %r9b
movq 0x10(%r8,%r9,8), %r8
testq %r8, %r8
jne 0x18082
movq %rdx, %r8
cmpq %rdx, %rdi
je 0x180b8
movsd 0x20(%rdi), %xmm0
ucomisd 0x10(%rsp), %xmm0
movq %rdx, %r8
ja 0x180b8
movq %rdi, %r8
cmpq %rdx, %r8
je 0x1833d
leaq (%rax,%rcx), %rdi
addq $-0x30, %rdi
movsd 0x88(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0x10(%rsp), %rsi
callq 0x1a87a
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x50(%rax)
movsd 0xa0(%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 0x1a87a
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x58(%rax)
movsd 0x98(%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 0x1a87a
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x60(%rax)
movl $0x98, %edi
callq 0x7380
movq %rax, %r14
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0x6440(%rsp), %rbp
movq %rbp, %rdi
callq 0x7170
leaq (%rsp,%rax), %rdx
addq $0x6440, %rdx           # imm = 0x6440
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xa886
movb $0x1, %bpl
movq %r14, %rdi
movq %rbx, %rsi
callq 0x19f58
movslq 0xc(%rsp), %rax
movq 0x30(%rsp), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
leaq (%rcx,%rax), %rdi
addq $-0x30, %rdi
xorl %ebp, %ebp
leaq 0x10(%rsp), %rsi
callq 0x1a87a
movq %r14, 0x68(%rax)
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x181ff
movq 0x60(%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 0x1a87a
movq %rax, %r14
addq $0x70, %r14
movq 0x78(%rax), %rbp
movq %r13, %rbx
leaq 0x6440(%rsp), %r13
movq %r13, %rdi
callq 0x7170
movq %r14, %rdi
xorl %esi, %esi
movq %rbp, %rdx
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 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movq $0x0, 0x58(%rsp)
movb $0x0, 0x60(%rsp)
cmpl $0xa, %r12d
jne 0x18356
leaq 0x10(%rsp), %rsi
callq 0x1a87a
movq %rax, %r14
movq 0x58(%rsp), %r12
leaq 0x3140(%rsp), %rbx
movq %rbx, %rdi
callq 0x7170
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0x7570
addq $0x90, %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x20d3c
movl 0x94(%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 0x1a87a
movl %ebx, 0xc0(%rax)
movl 0x90(%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 0x1a87a
jmp 0x183ea
movsd 0x10(%rsp), %xmm0
leaq 0x1e163(%rip), %rdi     # 0x364ad
movb $0x1, %al
callq 0x7060
jmp 0x184c5
leaq 0x10(%rsp), %rsi
callq 0x1a87a
movq %rax, %r14
movq 0x58(%rsp), %rdx
movl $0x7, %r8d
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
leaq 0x1e189(%rip), %rcx     # 0x36505
callq 0x7570
addq $0x90, %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x20d3c
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 0x1a87a
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 0x1a87a
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, 0xc4(%rax)
movsd 0x88(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movslq 0xc(%rsp), %r14
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0xe8(%rsp)
movq 0x30(%rsp), %rax
leaq (%r14,%r14,2), %rcx
shlq $0x4, %rcx
leaq (%rax,%rcx), %rdi
addq $-0x30, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1a87a
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 0x1a87a
movl 0xc4(%rax), %r8d
movq 0x50(%rsp), %r9
leaq 0x1e09d(%rip), %rdi     # 0x3650d
leaq 0x6440(%rsp), %rsi
movsd 0x20(%rsp), %xmm0
movl %r14d, %edx
movsd 0xe8(%rsp), %xmm1
movl %r12d, %ecx
movb $0x2, %al
callq 0x7060
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x184b0
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x98(%rsp), %r14
leaq 0xa0(%rsp), %rbp
leaq 0xc(%rsp), %rbx
leaq 0x230(%rsp), %r12
movq %r12, %rdi
movl $0x2f10, %esi           # imm = 0x2F10
movq %r15, %rdx
callq 0x7590
testq %rax, %rax
jne 0x17f7f
jmp 0x184f4
leaq 0x1e873(%rip), %rdi     # 0x36d62
callq 0x7560
movq 0x48(%rsp), %rbx
leaq 0x30(%rbx), %r14
leaq 0x230(%rsp), %r15
movl $0x0, (%r15)
addq $0x60, %rbx
leaq 0x30(%rsp), %r12
leaq 0xb0(%rsp), %r13
movq %r14, %rdi
movq %r15, %rsi
callq 0x1a92a
movq %rax, %rdi
movq %r12, %rsi
callq 0x1a98e
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1aaec
movq %rax, %rdi
movq %r13, %rsi
callq 0x1ab50
movl 0x230(%rsp), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x230(%rsp)
testl %eax, %eax
js 0x1851d
leaq 0x138(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1857f
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0xb0(%rsp), %rdi
callq 0x1acae
leaq 0x30(%rsp), %rdi
callq 0x1acf0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x185b0
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
addq $0x9358, %rsp           # imm = 0x9358
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1e658(%rip), %rdi     # 0x36c21
xorl %eax, %eax
callq 0x7530
leaq 0x1d856(%rip), %rdi     # 0x35e2d
callq 0x7560
leaq 0x1dd3b(%rip), %rax     # 0x3631e
jmp 0x185ec
leaq 0x1dd49(%rip), %rax     # 0x36335
movq %rax, 0x20(%rsp)
movl $0x8, %edi
callq 0x7180
movq 0x20(%rsp), %rcx
movq %rcx, (%rax)
movq 0x3092e(%rip), %rsi     # 0x48f38
movq %rax, %rdi
xorl %edx, %edx
callq 0x7660
leaq 0x1dda9(%rip), %rdi     # 0x363c4
callq 0x7560
leaq 0x1ddc0(%rip), %rbx     # 0x363e7
jmp 0x18630
leaq 0x1ddd2(%rip), %rbx     # 0x36402
movl $0x8, %edi
callq 0x7180
movq %rbx, (%rax)
movq 0x308f4(%rip), %rsi     # 0x48f38
movq %rax, %rdi
xorl %edx, %edx
callq 0x7660
movq %rax, %rbx
movq 0x108(%rsp), %rdi
cmpq %r15, %rdi
je 0x1872d
movq 0x118(%rsp), %rsi
jmp 0x18725
jmp 0x186ae
jmp 0x18709
movq %rax, %rbx
movb $0x1, %bpl
jmp 0x1869d
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x1869d
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x7390
testb %bpl, %bpl
je 0x1870c
movl $0x98, %esi
movq %r14, %rdi
jmp 0x186d1
jmp 0x186ea
movq %rax, %rbx
jmp 0x1872d
jmp 0x18709
jmp 0x186d8
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x1870c
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x1870c
movq %rax, %rbx
leaq 0x230(%rsp), %rdi
callq 0x1a8e4
jmp 0x1872d
movq %rax, %rbx
leaq 0x230(%rsp), %rdi
callq 0x1ad32
leaq 0x3530(%rsp), %rdi
callq 0x1ba12
jmp 0x1872d
movq %rax, %rbx
leaq 0x138(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1872d
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0xb0(%rsp), %rdi
callq 0x1acae
leaq 0x30(%rsp), %rdi
callq 0x1acf0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x1875e
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq %rbx, %rdi
callq 0x76a0