// File: /workspace/github_cpp_makefile_star2_O1/melop[P]admixem/simulation.cpp
// Function: PerformExport(int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, int, int, int, double)
void PerformExport(int nGen, int nRep, string sExportFolder, int nPop1Size, int nPop2Size, int nPop3Size, int nMarkerNum, double nRandSeed) {

	Random::Set(nRandSeed);
	string sOutFolder = SimulConfig.GetConfig("OutputFolder");
	sExportFolder = sExportFolder + "/Gen" + convertInt(nGen);
	fnMakeDir(sExportFolder.c_str());

	ofstream fPriorAlleleFreq, fOutcomeVars, fGenotypes, fEtaPriors, fLoci, fSampledMarkers;// Create priorallelefreqs.txt
	//fPriorAlleleFreq.open(sExportFolder + "/priorallelefreqs.txt");
	//fOutcomeVars.open(sExportFolder + "/outcomevars.txt");
	//fGenotypes.open(sExportFolder + "/genotypes.txt");
	//fEtaPriors.open(sExportFolder + "/etapriors.txt");
	fLoci.open((sExportFolder + "/lociChr.txt").c_str());
	fSampledMarkers.open("sampledmarkers.txt"); // this is an instruction to the php script regarding what markers to draw

	ifstream fMarkers, fPhenotypes;
	/*char szCurrGen[100];
	_itoa(nGen , szCurrGen, 10);
	*/
	string sGenHeader = sOutFolder;
	sGenHeader = (nRep==0)? sGenHeader : (sGenHeader + "_") + fnIntToString(nRep);
	sGenHeader = sGenHeader + "/Gen";
	sGenHeader = sGenHeader + fnIntToString(nGen);//szCurrGen;

	fMarkers.open((sGenHeader + "_markers.txt").c_str() , ios_base::in );

	fPhenotypes.open((sGenHeader + "_phenotypes.txt").c_str() , ios_base::in );
	//convert the phenotype file to outcomevars.txt
	string sCmd = "php export_phenotype.php -- -s \"" + sGenHeader + "_phenotypes.txt\" -o \"" + sExportFolder + "/outcomevars.txt\"";
	printf("Calling: %s ...\n", sCmd.c_str());
	system(sCmd.c_str());

	//write loci.txt file
	printf("Writing locus information...\n");
	fLoci << "\"LocusName\"\t\"NumberOfAlleles\"\t\"cM\"\t\"Chr\"" <<endl; // Header
	
	fLoci << fixed << showpoint; 
	fLoci << setprecision(6);
	

	//vector<vector<int>> vRandomMarkerSubset;
	vector<map<double, double> > * pvMarkerMapDistance = SimulConfig.pMarkerConfig->GetMpMarkerMapDistance(2); // use average map distance

	size_t nTotalChrSize = pvMarkerMapDistance->size();
	for( size_t nChr=0; nChr < nTotalChrSize ; nChr++) {
		map<double, double> * pmMarkerMapDistanceOnChr = & (pvMarkerMapDistance->at(nChr));
		size_t nCurrMarker = 1;
		size_t nSampledMarkerCount = 1;
		double nPrevMarkerPos=0.0;

		double nExpectedMarkerNumOnChr = (double)nMarkerNum * SimulConfig.pMarkerConfig->GetChrToGenomeRatio( nChr );
		double nProbToKeep = nExpectedMarkerNumOnChr / (double)pmMarkerMapDistanceOnChr->size();

		for (map<double,double>::iterator itMarker = pmMarkerMapDistanceOnChr->begin(); itMarker!=pmMarkerMapDistanceOnChr->end(); ++itMarker) {

			if (UniformGen.Next() <= nProbToKeep) {

				double nCurrPos = itMarker->second; // itMarker->first  * 10.0e-6;

				fLoci << "chr" << (nChr+1) << "_" << nCurrMarker << "\t2\t";
				fSampledMarkers << nChr << "\t" << ( nCurrMarker -1 ) << "\t" << nCurrPos << endl;
			
				if ((nSampledMarkerCount==1)) {
				
					fLoci << "NA\t"; 
				}
				else {
				
					fLoci <<  (nCurrPos - nPrevMarkerPos) << "\t";
					
				
				}
				nPrevMarkerPos = nCurrPos ;
				fLoci << (nChr+1) << endl;
				nSampledMarkerCount++;
			}
			else {
				//nPrevMarkerPos += itMarker->first; //accumulate distance
			}

			nCurrMarker++;
		}
	}

	fSampledMarkers.close();

	sCmd = "php export_genotype.php -- -s \"" + sGenHeader + "_markers.txt\" -o \"" + sExportFolder + "\" -i sampledmarkers.txt -pop1 100000 -pop2 100000 -pop3 999999";
	printf("Calling: %s ...\n", sCmd.c_str());
	system(sCmd.c_str());



	/*
	string sLn;
	int iLn = 0;
	if (std::getline(fPhenotypes, sLn)) {// Header

	}

	else {
		printf("Phenotype output error.\n");
		return;
	}

	while(std::getline(fPhenotypes, sLn)) {
		
		int nId, nPop, nSex, nFatherId, nMotherId;
		sscanf(sLn.c_str(), "%[^\t] %[^\t] %[^\t] %[^\t] %[^\t] %*[^\n]", &nId, &nPop, &nSex, &nFatherId, &nMotherId);
		string sPrelude
		iLn++;
	}
	*/
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1198, %rsp           # imm = 0x1198
movq %rdx, 0x20(%rsp)
movl %esi, %r15d
movl %edi, %ebx
callq 0xbbf2
leaq 0x178(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x580a(%rip), %rsi      # 0x37cb7
leaq 0x580f(%rip), %rdx      # 0x37cc3
leaq 0x168(%rsp), %r14
movq %r14, %rdi
callq 0xa886
leaq 0x1743d(%rip), %rsi     # 0x49908
leaq 0x148(%rsp), %rdi
movq %r14, %rdx
callq 0x1007e
movq 0x168(%rsp), %rdi
cmpq %r12, %rdi
je 0x324f8
movq 0x178(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x5a0(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x20(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x590(%rsp), %rdi
callq 0xa916
leaq 0x5b8d(%rip), %rsi      # 0x380b5
leaq 0x590(%rsp), %rdi
callq 0x76f0
leaq 0x798(%rsp), %rdi
movl %ebx, %esi
callq 0x33710
movq 0x590(%rsp), %rcx
movq 0x598(%rsp), %r8
movq 0x7a0(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r12, %rcx
je 0x32572
movq 0x5a0(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x32597
leaq 0x7a8(%rsp), %rdi
movl $0xf, %esi
cmpq %rdi, -0x10(%rdi)
je 0x32592
movq 0x7a8(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x325ae
movq 0x798(%rsp), %rsi
leaq 0x590(%rsp), %rdi
callq 0x7110
jmp 0x325bf
leaq 0x798(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x73e0
leaq 0x198(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x325ec
movq %rsi, 0x188(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x198(%rsp)
jmp 0x325f4
movupd (%rcx), %xmm0
movupd %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x190(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x188(%rsp), %r14
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x7460
movq (%r14), %rdi
leaq 0x198(%rsp), %r14
cmpq %r14, %rdi
je 0x32649
movq 0x198(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x7a8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3266a
movq 0x7a8(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x590(%rsp), %rdi
cmpq %r12, %rdi
je 0x32687
movq 0x5a0(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x20(%rsp), %rax
movq (%rax), %rdi
callq 0x31fff
leaq 0x798(%rsp), %rdi
callq 0x7650
leaq 0xf98(%rsp), %rdi
callq 0x7650
leaq 0xd98(%rsp), %rdi
callq 0x7650
leaq 0xb98(%rsp), %rdi
callq 0x7650
leaq 0x390(%rsp), %rdi
callq 0x7650
leaq 0x998(%rsp), %rdi
callq 0x7650
leaq 0x188(%rsp), %rdi
movq %r14, (%rdi)
movq 0x20(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
callq 0xa916
leaq 0x59b2(%rip), %rsi      # 0x380ba
leaq 0x188(%rsp), %rdi
callq 0x76f0
movq 0x188(%rsp), %rsi
leaq 0x390(%rsp), %rdi
movl $0x10, %edx
callq 0x7070
movq 0x188(%rsp), %rdi
cmpq %r14, %rdi
je 0x3274c
movq 0x198(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x5974(%rip), %rsi      # 0x380c7
leaq 0x998(%rsp), %rdi
movl $0x10, %edx
callq 0x7070
leaq 0x188(%rsp), %rdi
callq 0x73f0
leaq 0x590(%rsp), %rdi
callq 0x73f0
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x148(%rsp), %rsi
movq 0x150(%rsp), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0xa916
testl %r15d, %r15d
je 0x32862
leaq 0xc8(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
leaq 0xb8(%rsp), %rdi
callq 0xa916
leaq 0x3a2b(%rip), %rsi      # 0x36206
leaq 0xb8(%rsp), %rdi
callq 0x76f0
leaq 0xe8(%rsp), %rdi
movl %r15d, %esi
callq 0x29b02
movq 0xb8(%rsp), %rcx
movq 0xc0(%rsp), %r8
movq 0xf0(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r14, %rcx
je 0x32826
movq 0xc8(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x3284b
leaq 0xf8(%rsp), %rdi
movl $0xf, %esi
cmpq %rdi, -0x10(%rdi)
je 0x32846
movq 0xf8(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x32882
movq 0xe8(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x7110
jmp 0x32893
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
movq %rsp, %rdi
callq 0xa916
jmp 0x328db
leaq 0xe8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x73e0
leaq 0x10(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x328b6
movq %rsi, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x328be
movupd (%rcx), %xmm0
movupd %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x28(%rsp), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x7460
movq (%r14), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x32905
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x7390
testl %r15d, %r15d
je 0x3294c
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3292b
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3294c
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x7390
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
callq 0xa916
leaq 0x5745(%rip), %rsi      # 0x380b5
movq %rsp, %rdi
callq 0x76f0
leaq 0x28(%rsp), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x7460
movq (%r14), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x329a2
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x68(%rsp), %rdi
movl %ebx, %esi
callq 0x29b02
movq 0x28(%rsp), %rcx
movq 0x30(%rsp), %r8
leaq 0x68(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x73e0
leaq 0x10(%rsp), %r14
movq %r14, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x329ec
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x329f5
movupd (%rcx), %xmm0
movupd %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rsp, %rbx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x7460
movq (%rbx), %rdi
cmpq %r14, %rdi
je 0x32a31
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x78(%rsp), %rbx
movq -0x10(%rbx), %rdi
cmpq %rbx, %rdi
je 0x32a4c
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x7390
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
callq 0xa916
leaq 0x533a(%rip), %rsi      # 0x37daa
movq %rsp, %rdi
callq 0x76f0
movq (%rsp), %rsi
leaq 0x188(%rsp), %rdi
movl $0x8, %edx
callq 0x7200
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x32aa9
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x7390
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
callq 0xa916
leaq 0x52f5(%rip), %rsi      # 0x37dc2
movq %rsp, %rdi
callq 0x76f0
movq (%rsp), %rsi
leaq 0x590(%rsp), %rdi
movl $0x8, %edx
callq 0x7200
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x32b06
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x55cd(%rip), %rsi      # 0x380da
leaq 0x98(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x9981
leaq 0x55d5(%rip), %rsi      # 0x380fb
leaq 0x98(%rsp), %rdi
callq 0x76f0
leaq 0x58(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x32b5a
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x32b62
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq 0x48(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x20(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x7110
movq %rbx, 0x68(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x32bb2
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0x32bba
movupd (%rcx), %xmm0
movupd %xmm0, (%rbx)
movq 0x8(%rax), %rdx
leaq 0x68(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x5534(%rip), %rsi      # 0x38111
callq 0x76f0
leaq 0x10(%rsp), %rsi
movq %rsi, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x32c08
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x32c10
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x68(%rsp), %rdi
cmpq %rbx, %rdi
je 0x32c3f
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x32c5b
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0xa8(%rsp), %rbp
movq -0x10(%rbp), %rdi
cmpq %rbp, %rdi
je 0x32c7c
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7390
movq (%rsp), %rsi
leaq 0x549c(%rip), %rdi      # 0x38123
xorl %eax, %eax
callq 0x7060
movq (%rsp), %rdi
callq 0x7300
leaq 0x5657(%rip), %rdi      # 0x382f5
callq 0x7560
leaq 0x548a(%rip), %rsi      # 0x38134
leaq 0x390(%rsp), %rbx
movl $0x28, %edx
movq %rbx, %rdi
callq 0x7400
movq 0x390(%rsp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x7350
movsbl %al, %esi
leaq 0x390(%rsp), %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7260
movq 0x390(%rsp), %rax
movq -0x18(%rax), %rcx
movl $0xfffffefb, %edx       # imm = 0xFFFFFEFB
andl 0x3a8(%rsp,%rcx), %edx
orl $0x4, %edx
movl %edx, 0x3a8(%rsp,%rcx)
movq -0x18(%rax), %rcx
orl $0x400, 0x3a8(%rsp,%rcx) # imm = 0x400
movq -0x18(%rax), %rax
movq $0x6, 0x398(%rsp,%rax)
leaq 0x16bd0(%rip), %rax     # 0x49908
movq (%rax), %rdi
movl $0x2, %esi
callq 0x10802
movq 0x8(%rax), %rcx
movq %rax, 0x118(%rsp)
subq (%rax), %rcx
je 0x33052
movq %rcx, %rax
sarq $0x4, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
cvtsi2sdl 0x11d0(%rsp), %xmm0
movsd %xmm0, 0x108(%rsp)
cmpq $0x1, %rax
adcq $0x0, %rax
movq %rax, 0x110(%rsp)
xorl %r14d, %r14d
movq 0x118(%rsp), %rax
movq (%rax), %rbx
movq 0x8(%rax), %rdx
subq %rbx, %rdx
sarq $0x4, %rdx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rdx
cmpq %r14, %rdx
jbe 0x333cf
leaq 0x16b40(%rip), %rax     # 0x49908
movq (%rax), %rdi
movl %r14d, %esi
callq 0x10822
movq %r14, 0x88(%rsp)
leaq (%r14,%r14,2), %rax
shlq $0x4, %rax
leaq (%rbx,%rax), %r12
addq $0x8, %r12
movsd 0x20(%r12), %xmm2
unpcklps 0x3fc7(%rip), %xmm2     # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x3fcf(%rip), %xmm2     # 0x36dd0
movq 0x10(%r12), %r15
cmpq %r12, %r15
je 0x33039
mulsd 0x108(%rsp), %xmm0
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x120(%rsp)
movq 0x88(%rsp), %rax
incq %rax
movq %rax, 0xe0(%rsp)
movl $0x1, %r14d
xorpd %xmm0, %xmm0
movsd %xmm0, 0xd8(%rsp)
xorl %r13d, %r13d
leaq 0x16bdf(%rip), %rdi     # 0x49a40
callq 0xbaa8
leaq 0x1(%r13), %rbp
movsd 0x120(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jb 0x3301a
movsd 0x28(%r15), %xmm0
movsd %xmm0, 0x90(%rsp)
movl $0x3, %edx
leaq 0x390(%rsp), %rdi
leaq 0x30ad(%rip), %rsi      # 0x35f4d
callq 0x7400
leaq 0x390(%rsp), %rdi
movq 0xe0(%rsp), %rsi
callq 0x7250
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x333a(%rip), %rsi      # 0x36206
callq 0x7400
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x7250
movl $0x3, %edx
movq %rax, %rdi
leaq 0x5272(%rip), %rsi      # 0x3815d
callq 0x7400
leaq 0x998(%rsp), %rdi
movq 0x88(%rsp), %rsi
callq 0x7250
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x3101(%rip), %rsi      # 0x36018
callq 0x7400
movq %rbx, %rdi
movq %r13, %rsi
callq 0x7250
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x30df(%rip), %rsi      # 0x36018
callq 0x7400
movq %rbx, %rdi
movsd 0x90(%rsp), %xmm0
callq 0x75c0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x7350
movsbl %al, %esi
movq %r13, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7260
movl $0x3, %edx
leaq 0x390(%rsp), %rax
leaq 0x51d4(%rip), %rsi      # 0x38161
cmpq $0x1, %r14
je 0x32fbe
movsd 0x90(%rsp), %xmm0
subsd 0xd8(%rsp), %xmm0
leaq 0x390(%rsp), %rdi
callq 0x75c0
movl $0x1, %edx
leaq 0x305a(%rip), %rsi      # 0x36018
movq %rax, %rdi
callq 0x7400
leaq 0x390(%rsp), %rdi
movq 0xe0(%rsp), %rsi
callq 0x7250
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x7350
movsbl %al, %esi
movq %r13, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7260
incq %r14
movsd 0x90(%rsp), %xmm0
movsd %xmm0, 0xd8(%rsp)
movq %r15, %rdi
callq 0x7270
movq %rax, %r15
movq %rbp, %r13
cmpq %r12, %rax
leaq 0xa8(%rsp), %rbp
jne 0x32e5a
movq 0x88(%rsp), %r14
incq %r14
cmpq 0x110(%rsp), %r14
jne 0x32d94
leaq 0x998(%rsp), %rbx
movq %rbx, %rdi
callq 0x74e0
leaq 0x50fc(%rip), %rsi      # 0x38165
leaq 0x128(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x9981
leaq 0x5103(%rip), %rsi      # 0x38185
leaq 0x128(%rsp), %rdi
callq 0x76f0
movq %rbp, 0x98(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x330bb
movq %rdx, 0x98(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xa8(%rsp)
jmp 0x330c4
movupd (%rcx), %xmm0
movupd %xmm0, (%rbp)
movq 0x8(%rax), %rdx
leaq 0x98(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x20(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x7110
leaq 0x58(%rsp), %rsi
movq %rsi, 0x48(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3311c
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x33124
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq 0x48(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x5051(%rip), %rsi      # 0x38198
callq 0x76f0
leaq 0x78(%rsp), %r15
movq %r15, 0x68(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x33174
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0x3317d
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x68(%rsp), %r14
movq %rdx, 0x8(%r14)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rsp, %rdi
movq %r14, %rsi
callq 0x7460
movq (%r14), %rdi
cmpq %r15, %rdi
je 0x331b9
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x331d5
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x98(%rsp), %rdi
cmpq %rbp, %rdi
je 0x331f2
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x138(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x33213
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x7390
movq (%rsp), %rsi
leaq 0x4f05(%rip), %rdi      # 0x38123
xorl %eax, %eax
callq 0x7060
movq (%rsp), %rdi
callq 0x7300
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x33249
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x33265
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x590(%rsp), %rdi
callq 0x70d0
leaq 0x188(%rsp), %rdi
callq 0x70d0
movq 0x15cc2(%rip), %rax     # 0x48f48
movq (%rax), %r14
movq 0x18(%rax), %r15
leaq 0x9a0(%rsp), %rdi
movq %r14, -0x8(%rdi)
movq -0x18(%r14), %rax
movq %r15, 0x998(%rsp,%rax)
callq 0x72f0
movl $0xf8, %r12d
addq %r12, %rbx
movq %rbx, %rdi
callq 0x7120
leaq 0x398(%rsp), %rdi
movq %r14, -0x8(%rdi)
movq -0x18(%r14), %rax
movq %r15, 0x390(%rsp,%rax)
callq 0x72f0
leaq 0x390(%rsp), %rdi
addq %r12, %rdi
callq 0x7120
leaq 0xba0(%rsp), %rdi
movq %r14, -0x8(%rdi)
movq -0x18(%r14), %rax
movq %r15, 0xb98(%rsp,%rax)
callq 0x72f0
leaq 0xb98(%rsp), %rdi
addq %r12, %rdi
callq 0x7120
leaq 0xda0(%rsp), %rdi
movq %r14, -0x8(%rdi)
movq -0x18(%r14), %rax
movq %r15, 0xd98(%rsp,%rax)
callq 0x72f0
leaq 0xd98(%rsp), %rdi
addq %r12, %rdi
callq 0x7120
leaq 0xfa0(%rsp), %rdi
movq %r14, -0x8(%rdi)
movq -0x18(%r14), %rax
movq %r15, 0xf98(%rsp,%rax)
callq 0x72f0
leaq 0xf98(%rsp), %rdi
addq %r12, %rdi
callq 0x7120
leaq 0x7a0(%rsp), %rdi
movq %r14, -0x8(%rdi)
movq -0x18(%r14), %rax
movq %r15, 0x798(%rsp,%rax)
callq 0x72f0
leaq 0x798(%rsp), %rdi
addq %r12, %rdi
callq 0x7120
leaq 0x158(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x333bd
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x7390
addq $0x1198, %rsp           # imm = 0x1198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x384b(%rip), %rdi      # 0x36c21
movq %r14, %rsi
xorl %eax, %eax
callq 0x7530
jmp 0x3355a
movq %rax, %rbx
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x33410
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x33410
jmp 0x3340d
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
cmpq %r14, %rdi
je 0x33666
movq 0xc8(%rsp), %rsi
jmp 0x3365e
jmp 0x3355a
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x33457
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x33457
movq %rax, %rbx
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x33481
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x33481
movq %rax, %rbx
leaq 0x138(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3364b
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x3364b
jmp 0x33648
jmp 0x33648
movq %rbx, %rcx
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %rcx, %rdi
je 0x334d7
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x334d7
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x334f8
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x334f8
movq %rax, %rbx
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x33666
movq 0xa8(%rsp), %rsi
jmp 0x3365e
jmp 0x3355a
jmp 0x33648
jmp 0x33648
jmp 0x3355a
jmp 0x33648
jmp 0x33648
jmp 0x3355a
movq %rax, %rbx
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x33666
movq 0x78(%rsp), %rsi
jmp 0x3365e
jmp 0x3355a
jmp 0x33648
movq %rax, %rbx
jmp 0x33666
movq %rax, %rbx
jmp 0x33682
movq %rax, %rbx
jmp 0x3368f
jmp 0x335a1
jmp 0x335a1
jmp 0x33578
movq %rax, %rbx
movq 0x188(%rsp), %rdi
cmpq %r14, %rdi
je 0x3369c
movq 0x198(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x3369c
movq %rax, %rbx
jmp 0x3369c
movq %rax, %rbx
jmp 0x336a9
movq %rax, %rbx
jmp 0x336b6
movq %rax, %rbx
jmp 0x336c3
movq %rax, %rbx
jmp 0x336d0
movq %rax, %rbx
jmp 0x336dd
jmp 0x33626
jmp 0x33626
movq %rax, %rbx
leaq 0x7a8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x33600
movq 0x7a8(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x33600
jmp 0x335fd
movq %rax, %rbx
movq 0x590(%rsp), %rdi
cmpq %r12, %rdi
je 0x336ea
movq 0x5a0(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x336ea
movq %rax, %rbx
jmp 0x336ea
movq %rax, %rbx
movq 0x168(%rsp), %rdi
jmp 0x336f7
jmp 0x33648
jmp 0x33648
jmp 0x33648
jmp 0x33648
jmp 0x33648
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x33666
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x33682
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x590(%rsp), %rdi
callq 0x70d0
leaq 0x188(%rsp), %rdi
callq 0x70d0
leaq 0x998(%rsp), %rdi
callq 0x7520
leaq 0x390(%rsp), %rdi
callq 0x7520
leaq 0xb98(%rsp), %rdi
callq 0x7520
leaq 0xd98(%rsp), %rdi
callq 0x7520
leaq 0xf98(%rsp), %rdi
callq 0x7520
leaq 0x798(%rsp), %rdi
callq 0x7520
leaq 0x158(%rsp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x33708
movq (%r12), %rsi
incq %rsi
callq 0x7390
movq %rbx, %rdi
callq 0x76a0