// File: 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
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x96f8, %rsp           # imm = 0x96F8
movq %rsi, -0x9538(%rbp)
movq %rdi, -0x20(%rbp)
movq %rsi, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x9530(%rbp)
movl $0x1, -0x2c(%rbp)
movq 0x28(%rax), %rax
movq (%rax), %rdi
callq 0x1ce90
movl %eax, %ecx
movq -0x9530(%rbp), %rax
movl %ecx, 0x20(%rax)
leaq -0x48(%rbp), %rdi
callq 0x2a060
leaq -0x60(%rbp), %rdi
callq 0x2cc50
leaq -0x78(%rbp), %rdi
callq 0x2aa10
movl $0x0, -0x7c(%rbp)
movq -0x9530(%rbp), %rcx
movl -0x7c(%rbp), %eax
cmpl 0x20(%rcx), %eax
jge 0x25c82
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x9540(%rbp)
callq 0x2cc70
leaq -0xe0(%rbp), %rdi
callq 0x2a0d0
movq -0x9540(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x2cc90
jmp 0x25bff
leaq -0x78(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x2a0f0
jmp 0x25c11
movl $0x0, -0xf0(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x2a0a0
jmp 0x25c2d
leaq -0xe0(%rbp), %rdi
callq 0x2a160
leaq -0xb0(%rbp), %rdi
callq 0x2cd00
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x25bbb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x2a160
leaq -0xb0(%rbp), %rdi
callq 0x2cd00
jmp 0x26b09
movq -0x9538(%rbp), %rdi
callq 0x81d0
movq %rax, %rsi
leaq 0x5190b(%rip), %rdi     # 0x775a3
xorl %eax, %eax
callq 0x8080
jmp 0x25ca1
movq -0x9538(%rbp), %rsi
movq -0x9530(%rbp), %rdi
callq 0x8070
jmp 0x25cb6
movq -0x9538(%rbp), %rdi
callq 0x81d0
movq %rax, %rdi
leaq 0x53276(%rip), %rsi     # 0x78f42
callq 0x85e0
movq %rax, -0x9548(%rbp)
jmp 0x25cda
movq -0x9548(%rbp), %rax
movq %rax, -0xf8(%rbp)
cmpq $0x0, -0xf8(%rbp)
jne 0x25d4c
leaq 0x5162d(%rip), %rdi     # 0x77326
leaq 0x513d2(%rip), %rsi     # 0x770d2
xorl %eax, %eax
callq 0x8080
jmp 0x25d09
movl $0x8, %edi
callq 0x8230
movq %rax, %rdi
leaq 0x518a6(%rip), %rax     # 0x775c3
movq %rax, (%rdi)
movq 0x84221(%rip), %rsi     # 0xa9f48
xorl %eax, %eax
movl %eax, %edx
callq 0x8820
jmp 0x26b30
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x26b09
movq -0xf8(%rbp), %rdx
leaq -0x3010(%rbp), %rdi
movl $0x800, %esi            # imm = 0x800
callq 0x8750
movq %rax, -0x9550(%rbp)
jmp 0x25d6d
movq -0x9550(%rbp), %rax
cmpq $0x0, %rax
jne 0x25da6
movl $0x8, %edi
callq 0x8230
movq %rax, %rdi
leaq 0x5184c(%rip), %rax     # 0x775da
movq %rax, (%rdi)
movq 0x841b0(%rip), %rsi     # 0xa9f48
xorl %eax, %eax
movl %eax, %edx
callq 0x8820
jmp 0x26b30
jmp 0x25da8
movq -0xf8(%rbp), %rdx
leaq -0x3010(%rbp), %rdi
movl $0x2f10, %esi           # imm = 0x2F10
callq 0x8750
movq %rax, -0x9558(%rbp)
jmp 0x25dc9
movq -0x9558(%rbp), %rax
cmpq $0x0, %rax
je 0x2607e
leaq -0x3010(%rbp), %rdi
leaq -0x3080(%rbp), %rdx
leaq -0x30a0(%rbp), %r11
leaq 0x517fb(%rip), %rsi     # 0x775f1
leaq -0x30a4(%rbp), %rcx
leaq -0x30b0(%rbp), %r8
leaq -0x30d1(%rbp), %r9
leaq -0x30b8(%rbp), %r15
leaq -0x30d2(%rbp), %r14
leaq -0x30c0(%rbp), %rbx
leaq -0x30c8(%rbp), %r10
leaq -0x30d0(%rbp), %rax
movq %r15, (%rsp)
movq %r14, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
movq %r11, 0x18(%rsp)
movq %r10, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movb $0x0, %al
callq 0x8480
cmpl $0xa, %eax
je 0x25e5c
jmp 0x25da8
movq -0x9530(%rbp), %rcx
movl -0x30a4(%rbp), %eax
cmpl 0x20(%rcx), %eax
jg 0x25e77
cmpl $0x0, -0x30a4(%rbp)
jg 0x25ea3
movl $0x8, %edi
callq 0x8230
movq %rax, %rdi
leaq 0x5178d(%rip), %rax     # 0x77618
movq %rax, (%rdi)
movq 0x840b3(%rip), %rsi     # 0xa9f48
xorl %eax, %eax
movl %eax, %edx
callq 0x8820
jmp 0x26b30
leaq -0x31a0(%rbp), %rdi
callq 0x2cd20
jmp 0x25eb1
leaq -0x30a0(%rbp), %rdi
leaq 0x51787(%rip), %rsi     # 0x77646
callq 0x86c0
cmpl $0x0, %eax
jne 0x25ed6
movl $0x2, %eax
movl %eax, -0x955c(%rbp)
jmp 0x25efe
leaq -0x30a0(%rbp), %rdi
leaq 0x5176b(%rip), %rsi     # 0x7764f
callq 0x86c0
movl %eax, %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovel %ecx, %eax
movl %eax, -0x955c(%rbp)
movl -0x955c(%rbp), %eax
movl %eax, -0x3158(%rbp)
leaq -0x31a0(%rbp), %rdi
leaq -0x3080(%rbp), %rsi
callq 0x8690
jmp 0x25f1f
movb -0x30d1(%rbp), %al
movb %al, -0x3180(%rbp)
movsd -0x30b8(%rbp), %xmm0
movsd %xmm0, -0x3178(%rbp)
movb -0x30d2(%rbp), %al
movb %al, -0x317f(%rbp)
movsd -0x30c0(%rbp), %xmm0
movsd %xmm0, -0x3170(%rbp)
movsd -0x30c8(%rbp), %xmm0
movsd %xmm0, -0x3168(%rbp)
movsd -0x30d0(%rbp), %xmm0
movsd %xmm0, -0x3160(%rbp)
movl -0x30a4(%rbp), %eax
decl %eax
movslq %eax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x2cd70
movq %rax, %rdi
leaq -0x30b0(%rbp), %rsi
callq 0x2cd90
movq %rax, -0x9568(%rbp)
jmp 0x25fa3
movq -0x9568(%rbp), %rdi
leaq -0x31a0(%rbp), %rsi
callq 0x26b30
jmp 0x25fb8
movl -0x30a4(%rbp), %eax
decl %eax
movslq %eax, %rsi
leaq -0x48(%rbp), %rdi
callq 0x2a3e0
movq %rax, -0x9570(%rbp)
jmp 0x25fd5
movq -0x9570(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x957c(%rbp)
movl -0x30a4(%rbp), %eax
decl %eax
movslq %eax, %rsi
leaq -0x78(%rbp), %rdi
callq 0x2a420
movq %rax, %rdi
leaq -0x30b0(%rbp), %rsi
callq 0x2a440
movq %rax, -0x9578(%rbp)
jmp 0x26010
movq -0x9578(%rbp), %rax
movl -0x957c(%rbp), %ecx
movl %ecx, (%rax)
movl -0x30a4(%rbp), %eax
decl %eax
movslq %eax, %rsi
leaq -0x48(%rbp), %rdi
callq 0x2a3e0
movq %rax, -0x9588(%rbp)
jmp 0x2603c
movq -0x9588(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
leaq -0x31a0(%rbp), %rdi
callq 0x2ce70
jmp 0x25da8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
leaq -0x31a0(%rbp), %rdi
callq 0x2ce70
jmp 0x26b09
movq -0x9530(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x9598(%rbp)
leaq -0x31e1(%rbp), %rdi
movq %rdi, -0x9590(%rbp)
callq 0x8870
movq -0x9590(%rbp), %rdx
leaq 0x515a7(%rip), %rsi     # 0x77658
leaq -0x31e0(%rbp), %rdi
callq 0xcb30
jmp 0x260bf
movq -0x9598(%rbp), %rsi
leaq -0x31c0(%rbp), %rdi
leaq -0x31e0(%rbp), %rdx
callq 0x1c190
jmp 0x260db
leaq -0x31e0(%rbp), %rdi
callq 0x82e0
leaq -0x31e1(%rbp), %rdi
callq 0x8540
leaq 0x511c4(%rip), %rsi     # 0x772be
leaq -0x31c0(%rbp), %rdi
callq 0xcbe0
movb %al, -0x9599(%rbp)
jmp 0x2610e
movb -0x9599(%rbp), %al
testb $0x1, %al
jne 0x2611a
jmp 0x26189
leaq 0x51548(%rip), %rdi     # 0x77669
xorl %eax, %eax
callq 0x8080
jmp 0x2612a
jmp 0x26a39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x26161
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
leaq -0x31e0(%rbp), %rdi
callq 0x82e0
leaq -0x31e1(%rbp), %rdi
callq 0x8540
jmp 0x26b09
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x26afd
leaq -0x31c0(%rbp), %rdi
callq 0x81d0
movq %rax, %rdi
leaq 0x52da3(%rip), %rsi     # 0x78f42
callq 0x85e0
movq %rax, -0x95a8(%rbp)
jmp 0x261ad
movq -0x95a8(%rbp), %rax
movq %rax, -0x31f0(%rbp)
cmpq $0x0, -0x31f0(%rbp)
jne 0x26208
leaq 0x5115a(%rip), %rdi     # 0x77326
leaq 0x514de(%rip), %rsi     # 0x776b1
xorl %eax, %eax
callq 0x8080
jmp 0x261dc
movl $0x8, %edi
callq 0x8230
movq %rax, %rdi
leaq 0x514e4(%rip), %rax     # 0x776d4
movq %rax, (%rdi)
movq 0x83d4e(%rip), %rsi     # 0xa9f48
xorl %eax, %eax
movl %eax, %edx
callq 0x8820
jmp 0x26b30
movq -0x31f0(%rbp), %rdx
leaq -0x6100(%rbp), %rdi
movl $0x2f10, %esi           # imm = 0x2F10
callq 0x8750
movq %rax, -0x95b0(%rbp)
jmp 0x26229
movq -0x95b0(%rbp), %rax
cmpq $0x0, %rax
jne 0x26262
movl $0x8, %edi
callq 0x8230
movq %rax, %rdi
leaq 0x514a5(%rip), %rax     # 0x776ef
movq %rax, (%rdi)
movq 0x83cf4(%rip), %rsi     # 0xa9f48
xorl %eax, %eax
movl %eax, %edx
callq 0x8820
jmp 0x26b30
jmp 0x26264
movq -0x31f0(%rbp), %rdx
leaq -0x6100(%rbp), %rdi
movl $0x2f10, %esi           # imm = 0x2F10
callq 0x8750
movq %rax, -0x95b8(%rbp)
jmp 0x26285
movq -0x95b8(%rbp), %rax
cmpq $0x0, %rax
je 0x26a37
movb $0x1, -0x94a1(%rbp)
leaq -0x6100(%rbp), %rdi
leaq -0x9080(%rbp), %rdx
leaq -0x9470(%rbp), %r9
leaq -0x9010(%rbp), %rax
leaq 0x5144a(%rip), %rsi     # 0x7770a
leaq -0x9474(%rbp), %rcx
leaq -0x9488(%rbp), %r8
leaq -0x9478(%rbp), %r15
leaq -0x947c(%rbp), %r14
leaq -0x9490(%rbp), %rbx
leaq -0x9498(%rbp), %r11
leaq -0x94a0(%rbp), %r10
movq %r15, (%rsp)
movq %r14, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
movq %r11, 0x18(%rsp)
movq %r10, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movb $0x0, %al
callq 0x8480
cmpl $0xa, %eax
je 0x26381
leaq -0x6100(%rbp), %rdi
leaq -0x9080(%rbp), %rdx
leaq -0x9010(%rbp), %rax
leaq 0x513fe(%rip), %rsi     # 0x77734
leaq -0x9474(%rbp), %rcx
leaq -0x9488(%rbp), %r8
leaq -0x9490(%rbp), %r9
leaq -0x9498(%rbp), %r11
leaq -0x94a0(%rbp), %r10
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movb $0x0, %al
callq 0x8480
cmpl $0x7, %eax
je 0x26378
jmp 0x26264
movb $0x0, -0x94a1(%rbp)
jmp 0x26381
leaq -0x60(%rbp), %rdi
callq 0x2ceb0
movslq -0x9474(%rbp), %rcx
cmpq %rcx, %rax
jae 0x263b1
movl -0x9474(%rbp), %esi
leaq 0x513ae(%rip), %rdi     # 0x77751
xorl %eax, %eax
callq 0x8080
jmp 0x263ac
jmp 0x26a32
movl -0x9474(%rbp), %eax
decl %eax
movslq %eax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x2cd70
movq %rax, %rdi
leaq -0x9488(%rbp), %rsi
callq 0x2cf10
movq %rax, -0x95c0(%rbp)
jmp 0x263dd
movq -0x95c0(%rbp), %rax
movq %rax, -0x94b0(%rbp)
movl -0x9474(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x2cd70
movq %rax, %rdi
callq 0x2cf40
movq %rax, -0x94b8(%rbp)
leaq -0x94b0(%rbp), %rdi
leaq -0x94b8(%rbp), %rsi
callq 0x2cee0
testb $0x1, %al
jne 0x26428
jmp 0x2644b
movsd -0x9488(%rbp), %xmm0
movl -0x9474(%rbp), %esi
leaq 0x5135d(%rip), %rdi     # 0x7779a
movb $0x1, %al
callq 0x8080
jmp 0x26446
jmp 0x26a30
movsd -0x9490(%rbp), %xmm0
movsd %xmm0, -0x95d0(%rbp)
movl -0x9474(%rbp), %eax
decl %eax
movslq %eax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x2cd70
movq %rax, %rdi
leaq -0x9488(%rbp), %rsi
callq 0x2cd90
movq %rax, -0x95c8(%rbp)
jmp 0x26487
movq -0x95c8(%rbp), %rax
movsd -0x95d0(%rbp), %xmm0
movsd %xmm0, 0x50(%rax)
movsd -0x9498(%rbp), %xmm0
movsd %xmm0, -0x95e0(%rbp)
movl -0x9474(%rbp), %eax
decl %eax
movslq %eax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x2cd70
movq %rax, %rdi
leaq -0x9488(%rbp), %rsi
callq 0x2cd90
movq %rax, -0x95d8(%rbp)
jmp 0x264d7
movq -0x95d8(%rbp), %rax
movsd -0x95e0(%rbp), %xmm0
movsd %xmm0, 0x58(%rax)
movsd -0x94a0(%rbp), %xmm0
movsd %xmm0, -0x95f0(%rbp)
movl -0x9474(%rbp), %eax
decl %eax
movslq %eax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x2cd70
movq %rax, %rdi
leaq -0x9488(%rbp), %rsi
callq 0x2cd90
movq %rax, -0x95e8(%rbp)
jmp 0x26527
movq -0x95e8(%rbp), %rax
movsd -0x95f0(%rbp), %xmm0
movsd %xmm0, 0x60(%rax)
movl $0x98, %edi
callq 0x84c0
movq %rax, -0x95f8(%rbp)
jmp 0x2654e
movb $0x1, -0x94da(%rbp)
leaq -0x94d9(%rbp), %rdi
movq %rdi, -0x9600(%rbp)
callq 0x8870
movq -0x9600(%rbp), %rdx
leaq -0x94d8(%rbp), %rdi
leaq -0x9010(%rbp), %rsi
callq 0xcb30
jmp 0x26584
movq -0x95f8(%rbp), %rdi
leaq -0x94d8(%rbp), %rsi
callq 0x2b2c0
jmp 0x26599
movb $0x0, -0x94da(%rbp)
movl -0x9474(%rbp), %eax
decl %eax
movslq %eax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x2cd70
movq %rax, %rdi
leaq -0x9488(%rbp), %rsi
callq 0x2cd90
movq %rax, -0x9608(%rbp)
jmp 0x265cc
movq -0x9608(%rbp), %rax
movq -0x95f8(%rbp), %rcx
movq %rcx, 0x68(%rax)
leaq -0x94d8(%rbp), %rdi
callq 0x82e0
leaq -0x94d9(%rbp), %rdi
callq 0x8540
leaq -0x9010(%rbp), %rax
movq %rax, -0x9618(%rbp)
movl -0x9474(%rbp), %eax
decl %eax
movslq %eax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x2cd70
movq %rax, %rdi
leaq -0x9488(%rbp), %rsi
callq 0x2cd90
movq %rax, -0x9610(%rbp)
jmp 0x26630
movq -0x9618(%rbp), %rsi
movq -0x9610(%rbp), %rdi
addq $0x70, %rdi
callq 0x8690
jmp 0x26649
leaq -0x9500(%rbp), %rdi
callq 0x86b0
testb $0x1, -0x94a1(%rbp)
je 0x26817
movl -0x9474(%rbp), %eax
decl %eax
movslq %eax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x2cd70
movq %rax, %rdi
leaq -0x9488(%rbp), %rsi
callq 0x2cd90
movq %rax, -0x9620(%rbp)
jmp 0x2668e
movq -0x9620(%rbp), %rax
addq $0x90, %rax
movq %rax, -0x9630(%rbp)
leaq -0x9500(%rbp), %rdi
leaq -0x9470(%rbp), %rsi
callq 0x8690
movq %rax, -0x9628(%rbp)
jmp 0x266be
movq -0x9628(%rbp), %rsi
movq -0x9630(%rbp), %rdi
callq 0x2cf70
movb %dl, -0x9639(%rbp)
movq %rax, -0x9638(%rbp)
jmp 0x266e0
movb -0x9639(%rbp), %al
movq -0x9638(%rbp), %rcx
movq %rcx, -0x9510(%rbp)
movb %al, -0x9508(%rbp)
movl -0x9478(%rbp), %eax
movl %eax, -0x964c(%rbp)
movl -0x9474(%rbp), %eax
decl %eax
movslq %eax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x2cd70
movq %rax, %rdi
leaq -0x9488(%rbp), %rsi
callq 0x2cd90
movq %rax, -0x9648(%rbp)
jmp 0x26732
movq -0x9648(%rbp), %rax
movl -0x964c(%rbp), %ecx
movl %ecx, 0xc0(%rax)
movl -0x947c(%rbp), %eax
movl %eax, -0x965c(%rbp)
movl -0x9474(%rbp), %eax
decl %eax
movslq %eax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x2cd70
movq %rax, %rdi
leaq -0x9488(%rbp), %rsi
callq 0x2cd90
movq %rax, -0x9658(%rbp)
jmp 0x2677d
movq -0x9658(%rbp), %rax
movl -0x965c(%rbp), %ecx
movl %ecx, 0xc4(%rax)
jmp 0x26929
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
jmp 0x267c7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
leaq -0x94d8(%rbp), %rdi
callq 0x82e0
leaq -0x94d9(%rbp), %rdi
callq 0x8540
testb $0x1, -0x94da(%rbp)
jne 0x267de
jmp 0x267ef
movq -0x95f8(%rbp), %rdi
movl $0x98, %esi
callq 0x84d0
jmp 0x26afd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
leaq -0x9500(%rbp), %rdi
callq 0x82e0
jmp 0x26afd
movl -0x9474(%rbp), %eax
decl %eax
movslq %eax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x2cd70
movq %rax, %rdi
leaq -0x9488(%rbp), %rsi
callq 0x2cd90
movq %rax, -0x9668(%rbp)
jmp 0x26843
movq -0x9668(%rbp), %rax
addq $0x90, %rax
movq %rax, -0x9678(%rbp)
leaq 0x50f94(%rip), %rsi     # 0x777f2
leaq -0x9500(%rbp), %rdi
callq 0x8690
movq %rax, -0x9670(%rbp)
jmp 0x26873
movq -0x9670(%rbp), %rsi
movq -0x9678(%rbp), %rdi
callq 0x2cf70
movb %dl, -0x9681(%rbp)
movq %rax, -0x9680(%rbp)
jmp 0x26895
movb -0x9681(%rbp), %al
movq -0x9680(%rbp), %rcx
movq %rcx, -0x9520(%rbp)
movb %al, -0x9518(%rbp)
movl -0x9474(%rbp), %eax
decl %eax
movslq %eax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x2cd70
movq %rax, %rdi
leaq -0x9488(%rbp), %rsi
callq 0x2cd90
movq %rax, -0x9690(%rbp)
jmp 0x268db
movq -0x9690(%rbp), %rax
movl $0xffffffff, 0xc0(%rax) # imm = 0xFFFFFFFF
movl -0x9474(%rbp), %eax
decl %eax
movslq %eax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x2cd70
movq %rax, %rdi
leaq -0x9488(%rbp), %rsi
callq 0x2cd90
movq %rax, -0x9698(%rbp)
jmp 0x26918
movq -0x9698(%rbp), %rax
movl $0xffffffff, 0xc4(%rax) # imm = 0xFFFFFFFF
leaq -0x9010(%rbp), %rax
movq %rax, -0x96c0(%rbp)
movsd -0x9490(%rbp), %xmm0
movsd %xmm0, -0x96b8(%rbp)
movl -0x9474(%rbp), %eax
movl %eax, -0x96ac(%rbp)
movsd -0x9488(%rbp), %xmm0
movsd %xmm0, -0x96a8(%rbp)
decl %eax
movslq %eax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x2cd70
movq %rax, %rdi
leaq -0x9488(%rbp), %rsi
callq 0x2cd90
movq %rax, -0x96a0(%rbp)
jmp 0x26989
movq -0x96a0(%rbp), %rax
movl 0xc0(%rax), %eax
movl %eax, -0x96cc(%rbp)
movl -0x9474(%rbp), %eax
decl %eax
movslq %eax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x2cd70
movq %rax, %rdi
leaq -0x9488(%rbp), %rsi
callq 0x2cd90
movq %rax, -0x96c8(%rbp)
jmp 0x269c8
movq -0x96c8(%rbp), %rax
movl 0xc4(%rax), %eax
movl %eax, -0x96d0(%rbp)
leaq -0x9500(%rbp), %rdi
callq 0x81d0
movq -0x96c0(%rbp), %rsi
movsd -0x96b8(%rbp), %xmm0
movl -0x96ac(%rbp), %edx
movsd -0x96a8(%rbp), %xmm1
movl -0x96cc(%rbp), %ecx
movl -0x96d0(%rbp), %r8d
movq %rax, %r9
leaq 0x50ddf(%rip), %rdi     # 0x777fa
movb $0x2, %al
callq 0x8080
jmp 0x26a24
leaq -0x9500(%rbp), %rdi
callq 0x82e0
jmp 0x26a32
jmp 0x26264
jmp 0x26a39
movl $0x0, -0x9524(%rbp)
movl -0x9524(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x26ac8
movq -0x9530(%rbp), %rdi
addq $0x30, %rdi
leaq -0x9524(%rbp), %rsi
callq 0x2cfc0
movq %rax, -0x96d8(%rbp)
jmp 0x26a6e
movq -0x96d8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x2d0a0
jmp 0x26a80
movq -0x9530(%rbp), %rdi
addq $0x60, %rdi
leaq -0x9524(%rbp), %rsi
callq 0x2d2f0
movq %rax, -0x96e0(%rbp)
jmp 0x26aa0
movq -0x96e0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x2d3d0
jmp 0x26ab2
jmp 0x26ab4
movl -0x9524(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9524(%rbp)
jmp 0x26a43
leaq -0x31c0(%rbp), %rdi
callq 0x82e0
leaq -0x78(%rbp), %rdi
callq 0x2d620
leaq -0x60(%rbp), %rdi
callq 0x2d680
leaq -0x48(%rbp), %rdi
callq 0x2a520
addq $0x96f8, %rsp           # imm = 0x96F8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq -0x31c0(%rbp), %rdi
callq 0x82e0
leaq -0x78(%rbp), %rdi
callq 0x2d620
leaq -0x60(%rbp), %rdi
callq 0x2d680
leaq -0x48(%rbp), %rdi
callq 0x2a520
movq -0xe8(%rbp), %rdi
callq 0x8860