// File: /workspace/github_cpp_makefile_star2_O1/melop[P]admixem/config.cpp
// Function: RecombProbConfigurations::LoadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void RecombProbConfigurations::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

	FILE *pConfigFile;
	char szBuffer[12048];

	this->_nHaploidChrNum = ((SimulationConfigurations *)this->_pParentConfig)->pMarkerConfig->GetHaploidChromosomeNum(); // save a copy of the haploid chromosome number
	//Initialize arrays:
	this->_nExpectedMaleRecPerMeiosisArm1 = new double[_nHaploidChrNum];
	this->_nExpectedMaleRecPerMeiosisArm2 = new double[_nHaploidChrNum];
	this->_nExpectedFemaleRecPerMeiosisArm1 = new double[_nHaploidChrNum];
	this->_nExpectedFemaleRecPerMeiosisArm2 = new double[_nHaploidChrNum];

	this->pvBreakpointSamplePositions = new vector<double>[_nHaploidChrNum];
	this->pvMaleAccuProb = new vector<double>[_nHaploidChrNum];
	this->pvFemaleAccuProb = new vector<double>[_nHaploidChrNum];
	this->pvMaleMapDistance = new vector<double>[_nHaploidChrNum];
	this->pvFemaleMapDistance = new vector<double>[_nHaploidChrNum];
	this->pvAvgMapDistance = new vector<double>[_nHaploidChrNum];
	this->pvMaleRecArm1Gen = new vector< Poisson * >[nTotalCPUCore];
	this->pvMaleRecArm2Gen = new vector< Poisson * >[nTotalCPUCore];
	this->pvFemaleRecArm1Gen = new vector< Poisson * >[nTotalCPUCore];
	this->pvFemaleRecArm2Gen = new vector< Poisson * >[nTotalCPUCore];
	
	
	printf("Start loading marker probability file %s ...\n", szConfigFile.c_str());

	if (((SimulationConfigurations *)this->_pParentConfig)->GetConfig("UseUniformRec") == "yes") {
		printf("Instructed by configuration to use uniform distribution, will ignore candidate breakpoints in recombination file. But expected number of recombinations will still be used.\n");
		this->_bUseUniform = true;
		
	}
	else {
		this->_bUseUniform = false;
	}

	_szConfigFilename = szConfigFile; // save name of config file

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

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



	int nCurrChr;
	char szCmd[100];
	double nVal, nPos, nMaleAccu, nFemaleAccu, nMaleMapDistance, nFemaleMapDistance, nAvgMapDistance;

	long nLastBpArm1=0; // the index of the last break point at arm 1
	long nBpIndex = -1;
	double nPrevProb = 0.0; // previous probability. 

	while(fgets(szBuffer, 12048, pConfigFile) != NULL) 
	{

		//sscanf(szBuffer, "%d %*f %f %f %f", &nNum, &nAbsPos, &nFreqPop1, &nFreqPop2);


		if (szBuffer[0] == ':') { // it's metadata line

			if (szBuffer[1] == 'c') { // it's the chr line
				//parse chromosome number:

				sscanf(szBuffer, ":chr %d", &nCurrChr);

				if (nCurrChr > this->_nHaploidChrNum || nCurrChr <=0 ) {
					throw "Chromosome number in marker probability file incorrect!";
				}

				if (nBpIndex > 0) {
					vLastBpOnArm1.push_back(nLastBpArm1==0? nBpIndex : nLastBpArm1); // this is the previous record.
				}
				nLastBpArm1=0;
				nBpIndex = -1;
				nPrevProb = 0.0; // previous probability. 
				nCurrChr--;
				continue; // go to the next line
			}
			else { // it's a command line

				sscanf(szBuffer, "%s = %lf", szCmd, &nVal);
				
				//printf("%s\n",szCmd);

				if (strcmp(szCmd, ":ExpectedMaleRecPerMeiosisArm1")==0) {
					this->_nExpectedMaleRecPerMeiosisArm1[nCurrChr] = nVal;
					for(int nCPU=0;nCPU<nTotalCPUCore;nCPU++) {
						Poisson * pPosGen = new Poisson(nVal);
						this->pvMaleRecArm1Gen[nCPU].push_back(pPosGen);
					}
				}
				if (strcmp(szCmd,":ExpectedMaleRecPerMeiosisArm2")==0) {
					this->_nExpectedMaleRecPerMeiosisArm2[nCurrChr] = nVal;
					for(int nCPU=0;nCPU<nTotalCPUCore;nCPU++) {
						Poisson * pPosGen = new Poisson(nVal);
						this->pvMaleRecArm2Gen[nCPU].push_back(pPosGen);
					}
				}

				if (strcmp(szCmd,":ExpectedFemaleRecPerMeiosisArm1")==0) {
					this->_nExpectedFemaleRecPerMeiosisArm1[nCurrChr] = nVal;
					for(int nCPU=0;nCPU<nTotalCPUCore;nCPU++) {
						Poisson * pPosGen = new Poisson(nVal);
						this->pvFemaleRecArm1Gen[nCPU].push_back(pPosGen);
					}
				}
				if (strcmp(szCmd,":ExpectedFemaleRecPerMeiosisArm2")==0) {
					this->_nExpectedFemaleRecPerMeiosisArm2[nCurrChr] = nVal;
					for(int nCPU=0;nCPU<nTotalCPUCore;nCPU++) {
						Poisson * pPosGen = new Poisson(nVal);
						this->pvFemaleRecArm2Gen[nCPU].push_back(pPosGen);
					}
				}

			}

			continue;

		}

		if (szBuffer[0] == '\t') {
			
			continue; //title line, skip
		}
		else { //parse real data

			if (sscanf(szBuffer, "%lf %*lf %lf %*lf %lf %*lf %*lf %*lf %lf %*lf %lf %*lf %lf %*lf", &nPos, &nMaleAccu, &nFemaleAccu, &nMaleMapDistance, &nFemaleMapDistance, &nAvgMapDistance)!=6) {
				continue; // couldn't parse line.	
			};

			nBpIndex++;
			if (nMaleAccu < nPrevProb ) { //switch in prob. crossing the centromere?
				if (nLastBpArm1 != 0) { // this was already set, the sequence is not monotonic.
					throw("Error: accumulative recombination rate must be monotonic within each arm.\n");
				}

				nLastBpArm1 = nBpIndex - 1;//the previous bp is the last one in arm 1.
				
			}
			this->pvBreakpointSamplePositions[nCurrChr].push_back(nPos);
			this->pvMaleAccuProb[nCurrChr].push_back(nMaleAccu);
			this->pvFemaleAccuProb[nCurrChr].push_back(nFemaleAccu);
			this->pvMaleMapDistance[nCurrChr].push_back(nMaleMapDistance);
			this->pvFemaleMapDistance[nCurrChr].push_back(nFemaleMapDistance);
			this->pvAvgMapDistance[nCurrChr].push_back(nAvgMapDistance);

			nPrevProb = nMaleAccu;
		}


	}

	//check that recombination break points on arms are complete:
	if ( pvMaleRecArm1Gen[0].size() != pvMaleRecArm2Gen[0].size() || pvMaleRecArm2Gen[0].size() != pvFemaleRecArm1Gen[0].size() || pvFemaleRecArm1Gen[0].size() != pvFemaleRecArm2Gen[0].size()) {
		throw(new Exception("The number of Recombination break point defined are not equal.\n"));
	}

	vLastBpOnArm1.push_back(nLastBpArm1==0? nBpIndex : nLastBpArm1); // this is the last chromosome.


	//calculate splines
	for(int nCurrChr=0;nCurrChr < this->_nHaploidChrNum; nCurrChr++) {
		double nChrLen = ((SimulationConfigurations*)this->_pParentConfig)->pMarkerConfig->GetChromosomeLength(nCurrChr);
		tk::spline oMaleSplineArm1, oFemaleSplineArm1,oMaleSplineArm2, oFemaleSplineArm2;
		oMaleSplineArm1.set_boundary(spline::first_deriv, 0.0, spline::first_deriv, this->pvBreakpointSamplePositions[nCurrChr].at(this->vLastBpOnArm1[nCurrChr]), false);
		oFemaleSplineArm1.set_boundary(spline::first_deriv, 0.0, spline::first_deriv, this->pvBreakpointSamplePositions[nCurrChr].at(this->vLastBpOnArm1[nCurrChr]), false);
		oMaleSplineArm2.set_boundary(spline::first_deriv, this->pvBreakpointSamplePositions[nCurrChr].at(this->vLastBpOnArm1[nCurrChr]), spline::first_deriv, nChrLen, false);
		oFemaleSplineArm2.set_boundary(spline::first_deriv, this->pvBreakpointSamplePositions[nCurrChr].at(this->vLastBpOnArm1[nCurrChr]), spline::first_deriv, nChrLen, false);
		size_t nTotalBps = this->pvBreakpointSamplePositions[nCurrChr].size();
		vector<double> vPosArm1, vPosArm2, vAccMaleArm1, vAccMaleArm2, vAccFemaleArm1, vAccFemaleArm2;
		copy(this->pvBreakpointSamplePositions[nCurrChr].begin(), this->pvBreakpointSamplePositions[nCurrChr].begin() + this->vLastBpOnArm1[nCurrChr] + 1 ,back_inserter(vPosArm1));
		copy(this->pvBreakpointSamplePositions[nCurrChr].begin() + this->vLastBpOnArm1[nCurrChr] + 1, this->pvBreakpointSamplePositions[nCurrChr].end() ,back_inserter(vPosArm2));
		copy(this->pvMaleAccuProb[nCurrChr].begin(), this->pvMaleAccuProb[nCurrChr].begin() + this->vLastBpOnArm1[nCurrChr] + 1 ,back_inserter(vAccMaleArm1));
		copy(this->pvMaleAccuProb[nCurrChr].begin() + this->vLastBpOnArm1[nCurrChr] + 1, this->pvMaleAccuProb[nCurrChr].end() ,back_inserter(vAccMaleArm2));
		copy(this->pvFemaleAccuProb[nCurrChr].begin(), this->pvFemaleAccuProb[nCurrChr].begin() + this->vLastBpOnArm1[nCurrChr] + 1 ,back_inserter(vAccFemaleArm1));
		copy(this->pvFemaleAccuProb[nCurrChr].begin() + this->vLastBpOnArm1[nCurrChr] + 1, this->pvFemaleAccuProb[nCurrChr].end() ,back_inserter(vAccFemaleArm2));

		// erase elements in case not monotonic:

		if (vPosArm1.size() > 2) { // must have more than 2 pairs of dots to predict a spline.
			this->fnEraseNonMonotonic(&vAccMaleArm1 , &vAccFemaleArm1, &vPosArm1);
			oMaleSplineArm1.set_points(vAccMaleArm1 , vPosArm1);
			oFemaleSplineArm1.set_points(vAccFemaleArm1 , vPosArm1);
		}

		if (vPosArm2.size() > 2) {
			this->fnEraseNonMonotonic(&vAccMaleArm2 , &vAccFemaleArm2, &vPosArm2);

			oMaleSplineArm2.set_points(vAccMaleArm2 , vPosArm2);
			oFemaleSplineArm2.set_points(vAccFemaleArm2 , vPosArm2);
		}


		this->vMaleAccuProbSplineArm1.push_back(oMaleSplineArm1);
		this->vMaleAccuProbSplineArm2.push_back(oMaleSplineArm2);
		this->vFemaleAccuProbSplineArm1.push_back(oFemaleSplineArm1);
		this->vFemaleAccuProbSplineArm2.push_back(oFemaleSplineArm2);
	}

	///printf("%f %f %f", this->pvBreakpointSamplePositions[0].at(0), this->pvMaleAccuProb[0].at(0), this->pvFemaleAccuProb[0].at(0));

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x33b8, %rsp           # imm = 0x33B8
movq %rsi, 0x30(%rsp)
movq %rdi, %rbx
movq (%rdi), %rax
movq (%rax), %rax
movl 0x8(%rax), %ebp
movslq %ebp, %r15
movl $0x18, %ecx
movq %r15, %rax
mulq %rcx
movq %rax, %r12
seto %al
addq $0x8, %r12
movq $-0x1, %rcx
cmovbq %rcx, %r12
movl %ebp, 0x8(%rdi)
testb %al, %al
cmovneq %rcx, %r12
leaq (,%r15,8), %r13
testl %r15d, %r15d
cmovsq %rcx, %r13
movq %r13, %rdi
callq 0x7030
movq %rax, 0x30(%rbx)
movq %r13, %rdi
callq 0x7030
movq %rax, 0x38(%rbx)
movq %r13, %rdi
callq 0x7030
movq %rax, 0x40(%rbx)
movq %r13, %rdi
callq 0x7030
movq %rax, 0x48(%rbx)
movq %r12, %rdi
callq 0x7030
leaq 0x8(%rax), %r13
movq %r15, (%rax)
movabsq $-0x5555555555555555, %r14 # imm = 0xAAAAAAAAAAAAAAAB
testl %r15d, %r15d
je 0x10bd2
leaq (%r15,%r15,2), %rax
leaq -0x18(,%rax,8), %rax
mulq %r14
shrq $0x4, %rdx
leaq (%rdx,%rdx,2), %rax
leaq 0x18(,%rax,8), %rdx
movq %r13, %rdi
xorl %esi, %esi
callq 0x71e0
movq %r13, 0x78(%rbx)
movq %r12, %rdi
callq 0x7030
leaq 0x8(%rax), %r13
movq %r15, (%rax)
testl %ebp, %ebp
je 0x10c12
leaq (%r15,%r15,2), %rax
leaq -0x18(,%rax,8), %rax
mulq %r14
shrq $0x4, %rdx
leaq (%rdx,%rdx,2), %rax
leaq 0x18(,%rax,8), %rdx
movq %r13, %rdi
xorl %esi, %esi
callq 0x71e0
movq %r13, 0x80(%rbx)
movq %r12, %rdi
callq 0x7030
leaq 0x8(%rax), %r13
movq %r15, (%rax)
testl %ebp, %ebp
je 0x10c55
leaq (%r15,%r15,2), %rax
leaq -0x18(,%rax,8), %rax
mulq %r14
shrq $0x4, %rdx
leaq (%rdx,%rdx,2), %rax
leaq 0x18(,%rax,8), %rdx
movq %r13, %rdi
xorl %esi, %esi
callq 0x71e0
movq %r13, 0x88(%rbx)
movq %r12, %rdi
callq 0x7030
leaq 0x8(%rax), %r13
movq %r15, (%rax)
testl %ebp, %ebp
je 0x10c98
leaq (%r15,%r15,2), %rax
leaq -0x18(,%rax,8), %rax
mulq %r14
shrq $0x4, %rdx
leaq (%rdx,%rdx,2), %rax
leaq 0x18(,%rax,8), %rdx
movq %r13, %rdi
xorl %esi, %esi
callq 0x71e0
movq %r13, 0x108(%rbx)
movq %r12, %rdi
callq 0x7030
leaq 0x8(%rax), %r13
movq %r15, (%rax)
testl %ebp, %ebp
je 0x10cdb
leaq (%r15,%r15,2), %rax
leaq -0x18(,%rax,8), %rax
mulq %r14
shrq $0x4, %rdx
leaq (%rdx,%rdx,2), %rax
leaq 0x18(,%rax,8), %rdx
movq %r13, %rdi
xorl %esi, %esi
callq 0x71e0
movq %r13, 0x110(%rbx)
movq %r12, %rdi
callq 0x7030
leaq 0x8(%rax), %r12
movq %r15, (%rax)
testl %ebp, %ebp
je 0x10d1e
leaq (%r15,%r15,2), %rax
leaq -0x18(,%rax,8), %rax
mulq %r14
shrq $0x4, %rdx
leaq (%rdx,%rdx,2), %rax
leaq 0x18(,%rax,8), %rdx
movq %r12, %rdi
xorl %esi, %esi
callq 0x71e0
movq %r12, 0x118(%rbx)
movl $0x20, %edi
callq 0x7030
movl $0x1, %r14d
movq %r14, (%rax)
leaq 0x8(%rax), %rcx
pxor %xmm0, %xmm0
movdqu %xmm0, 0x8(%rax)
xorl %r15d, %r15d
movq %r15, 0x18(%rax)
movq %rcx, 0x50(%rbx)
movl $0x20, %edi
callq 0x7030
movq %r14, (%rax)
leaq 0x8(%rax), %rcx
pxor %xmm0, %xmm0
movdqu %xmm0, 0x8(%rax)
movq %r15, 0x18(%rax)
movq %rcx, 0x58(%rbx)
movl $0x20, %edi
callq 0x7030
movq %r14, (%rax)
leaq 0x8(%rax), %rcx
pxor %xmm0, %xmm0
movdqu %xmm0, 0x8(%rax)
movq %r15, 0x18(%rax)
movq %rcx, 0x60(%rbx)
movl $0x20, %edi
callq 0x7030
movq %r14, (%rax)
leaq 0x8(%rax), %rcx
pxor %xmm0, %xmm0
movdqu %xmm0, 0x8(%rax)
movq %r15, 0x18(%rax)
movq %rcx, 0x68(%rbx)
movq 0x30(%rsp), %r12
movq (%r12), %rsi
leaq 0x24e72(%rip), %rdi     # 0x35c38
xorl %eax, %eax
callq 0x7060
movq (%rbx), %r15
leaq 0x210(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x24e83(%rip), %rsi     # 0x35c66
leaq 0x24e89(%rip), %rdx     # 0x35c73
leaq 0x200(%rsp), %rdi
callq 0xa886
leaq 0x150(%rsp), %rdi
leaq 0x200(%rsp), %rdx
movq %r15, %rsi
callq 0x1007e
leaq 0x26860(%rip), %rsi     # 0x37676
leaq 0x150(%rsp), %r15
movq %r15, %rdi
callq 0x7100
movl %eax, %ebp
movq (%r15), %rdi
leaq 0x160(%rsp), %rax
cmpq %rax, %rdi
je 0x10e48
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x200(%rsp), %rdi
cmpq %r14, %rdi
je 0x10e65
movq 0x210(%rsp), %rsi
incq %rsi
callq 0x7390
testl %ebp, %ebp
je 0x10e6d
xorl %eax, %eax
jmp 0x10e7b
leaq 0x25e42(%rip), %rdi     # 0x36cb6
callq 0x7560
movb $0x1, %al
movb %al, 0x70(%rbx)
leaq 0x10(%rbx), %rdi
movq %r12, %rsi
callq 0x71d0
movq (%r12), %rdi
leaq 0x26e2d(%rip), %rsi     # 0x37cc2
callq 0x7440
testq %rax, %rax
je 0x11ded
movq %rax, %r14
movq $0x0, 0x18(%rsp)
movq $-0x1, 0x10(%rsp)
leaq 0x4a0(%rsp), %rdi
movl $0x2f10, %esi           # imm = 0x2F10
movq %rax, %rdx
callq 0x7590
testq %rax, %rax
je 0x11444
movabsq $0x636552656c614d64, %rax # imm = 0x636552656C614D64
movabsq $0x657463657078453a, %rcx # imm = 0x657463657078453A
leaq 0xf0(%rbx), %rdx
movq %rdx, 0x78(%rsp)
pxor %xmm0, %xmm0
movq %xmm0, 0x20(%rsp)
leaq 0x4a0(%rsp), %r12
leaq 0x430(%rsp), %rbp
movq %rcx, %xmm1
movq %rax, %xmm0
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movdqa %xmm1, 0x30(%rsp)
leaq 0x148(%rsp), %r15
movzbl 0x4a0(%rsp), %eax
cmpl $0x9, %eax
je 0x1122e
cmpl $0x3a, %eax
jne 0x10ffa
cmpb $0x63, 0x4a1(%rsp)
je 0x1124c
movq %r12, %rdi
leaq 0x24d56(%rip), %rsi     # 0x35cb4
movq %rbp, %rdx
leaq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x7360
movdqu 0x43f(%rsp), %xmm0
pcmpeqb 0x24a72(%rip), %xmm0    # 0x359f0
movdqa 0x430(%rsp), %xmm1
movdqa 0x30(%rsp), %xmm2
pcmpeqb %xmm2, %xmm1
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0x110bd
movsd 0x8(%rsp), %xmm0
movq 0x30(%rbx), %rax
movslq 0x4(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl $0x10, %edi
callq 0x7380
movq %rax, %r13
movq 0x8(%rsp), %xmm0
movq %rax, %rdi
callq 0xd030
movq %r13, 0x150(%rsp)
movq 0x50(%rbx), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x110aa
movq %r13, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x110b7
movq %r12, %rdi
leaq 0x24d39(%rip), %rsi     # 0x35d3d
leaq 0x118(%rsp), %rdx
leaq 0x28(%rsp), %rcx
leaq 0x110(%rsp), %r8
movq %r15, %r9
xorl %eax, %eax
leaq 0x100(%rsp), %r10
pushq %r10
leaq 0x110(%rsp), %r10
pushq %r10
callq 0x7360
addq $0x10, %rsp
cmpl $0x6, %eax
jne 0x1122e
movq 0x10(%rsp), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x10(%rsp)
movsd 0x20(%rsp), %xmm0
ucomisd 0x28(%rsp), %xmm0
jbe 0x11071
cmpq $0x0, 0x18(%rsp)
jne 0x11e31
movq %rax, 0x18(%rsp)
movq 0x78(%rbx), %rax
movslq 0x4(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x112c1
movsd 0x118(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x112ce
leaq 0x150(%rsp), %rdx
callq 0x1ce18
movdqa 0x30(%rsp), %xmm2
movdqu 0x43f(%rsp), %xmm0
pcmpeqb 0x24932(%rip), %xmm0    # 0x35a00
movdqa 0x430(%rsp), %xmm1
pcmpeqb %xmm2, %xmm1
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0x11146
movsd 0x8(%rsp), %xmm0
movq 0x38(%rbx), %rax
movslq 0x4(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl $0x10, %edi
callq 0x7380
movq %rax, %r13
movq 0x8(%rsp), %xmm0
movq %rax, %rdi
callq 0xd030
movq %r13, 0x150(%rsp)
movq 0x58(%rbx), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x11139
movq %r13, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x11146
leaq 0x150(%rsp), %rdx
callq 0x1ce18
movl $0x21, %edx
movq %rbp, %rdi
leaq 0x24ba6(%rip), %rsi     # 0x35cfb
callq 0x73b0
testl %eax, %eax
jne 0x111ba
movsd 0x8(%rsp), %xmm0
movq 0x40(%rbx), %rax
movslq 0x4(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl $0x10, %edi
callq 0x7380
movq %rax, %r13
movq 0x8(%rsp), %xmm0
movq %rax, %rdi
callq 0xd030
movq %r13, 0x150(%rsp)
movq 0x60(%rbx), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x111ad
movq %r13, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x111ba
leaq 0x150(%rsp), %rdx
callq 0x1ce18
movl $0x21, %edx
movq %rbp, %rdi
leaq 0x24b53(%rip), %rsi     # 0x35d1c
callq 0x73b0
testl %eax, %eax
jne 0x1122e
movsd 0x8(%rsp), %xmm0
movq 0x48(%rbx), %rax
movslq 0x4(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl $0x10, %edi
callq 0x7380
movq %rax, %r13
movq 0x8(%rsp), %xmm0
movq %rax, %rdi
callq 0xd030
movq %r13, 0x150(%rsp)
movq 0x68(%rbx), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x11221
movq %r13, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x1122e
leaq 0x150(%rsp), %rdx
callq 0x1ce18
movq %r12, %rdi
movl $0x2f10, %esi           # imm = 0x2F10
movq %r14, %rdx
callq 0x7590
testq %rax, %rax
jne 0x10f2c
jmp 0x11444
movq %r12, %rdi
leaq 0x24a1e(%rip), %rsi     # 0x35c74
leaq 0x4(%rsp), %rdx
xorl %eax, %eax
callq 0x7360
movl 0x4(%rsp), %eax
testl %eax, %eax
jle 0x11e1e
cmpl 0x8(%rbx), %eax
jg 0x11e1e
cmpq $0x0, 0x10(%rsp)
jle 0x1141f
cmpq $0x0, 0x18(%rsp)
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rax
cmoveq %rax, %rdx
movq 0xf8(%rbx), %rsi
cmpq 0x100(%rbx), %rsi
je 0x11415
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0xf8(%rbx)
jmp 0x1141f
leaq 0x118(%rsp), %rdx
callq 0x1cf54
movq 0x80(%rbx), %rax
movslq 0x4(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x11300
movsd 0x28(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x1130a
leaq 0x28(%rsp), %rdx
callq 0x1cf54
movq 0x88(%rbx), %rax
movslq 0x4(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x1133f
movsd 0x110(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x1134c
leaq 0x110(%rsp), %rdx
callq 0x1cf54
movq 0x108(%rbx), %rax
movslq 0x4(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x11381
movsd 0x148(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x11389
movq %r15, %rdx
callq 0x1cf54
movq 0x110(%rbx), %rax
movslq 0x4(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x113be
movsd 0x108(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x113cb
leaq 0x108(%rsp), %rdx
callq 0x1cf54
movq 0x118(%rbx), %rax
movslq 0x4(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x11400
movsd 0x100(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x1140d
leaq 0x100(%rsp), %rdx
callq 0x1cf54
movq 0x28(%rsp), %xmm0
jmp 0x11439
movq 0x78(%rsp), %rdi
callq 0x1ccdc
movq $0x0, 0x18(%rsp)
movq $-0x1, 0x10(%rsp)
decl 0x4(%rsp)
pxor %xmm0, %xmm0
movq %xmm0, 0x20(%rsp)
jmp 0x1122e
movq 0x50(%rbx), %rax
movq 0x58(%rbx), %rcx
movq 0x8(%rax), %rdx
subq (%rax), %rdx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
cmpq %rax, %rdx
jne 0x11db5
movq 0x60(%rbx), %rdx
movq 0x8(%rdx), %rcx
subq (%rdx), %rcx
cmpq %rcx, %rax
jne 0x11db5
movq 0x68(%rbx), %rax
movq 0x8(%rax), %rdx
subq (%rax), %rdx
cmpq %rdx, %rcx
jne 0x11db5
leaq 0x18(%rsp), %rax
cmpq $0x0, (%rax)
leaq 0x10(%rsp), %rdx
cmovneq %rax, %rdx
movq 0xf8(%rbx), %rsi
cmpq 0x100(%rbx), %rsi
je 0x114c0
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0xf8(%rbx)
jmp 0x114cc
leaq 0xf0(%rbx), %rdi
callq 0x1ccdc
cmpl $0x0, 0x8(%rbx)
jle 0x11d70
movl $0x90, %ecx
leaq 0x150(%rsp), %rax
addq %rcx, %rax
movq %rax, 0x30(%rsp)
leaq 0x380(%rsp), %rax
addq %rcx, %rax
movq %rax, 0x20(%rsp)
leaq 0x2d0(%rsp), %rax
addq %rcx, %rax
movq %rax, 0x78(%rsp)
leaq 0x220(%rsp), %rax
addq %rcx, %rax
movq %rax, 0x140(%rsp)
addq %rbx, %rcx
movq %rcx, 0x138(%rsp)
leaq 0xc0(%rbx), %rax
movq %rax, 0x130(%rsp)
leaq 0xa8(%rbx), %rax
movq %rax, 0x128(%rsp)
leaq 0xd8(%rbx), %rax
movq %rax, 0x120(%rsp)
xorl %r14d, %r14d
movabsq $0x200000002, %r13      # imm = 0x200000002
movabsq $0x100000001, %r12      # imm = 0x100000001
xorl %r15d, %r15d
xorl %ebp, %ebp
movq (%rbx), %rax
movq (%rax), %rax
movq 0x30(%rax), %rax
movq (%rax,%rbp,8), %xmm0
movq %r14, 0x1c0(%rsp)
pxor %xmm1, %xmm1
movdqa %xmm1, 0x1b0(%rsp)
movdqa %xmm1, 0x1a0(%rsp)
movdqa %xmm1, 0x190(%rsp)
movdqa %xmm1, 0x180(%rsp)
movdqa %xmm1, 0x170(%rsp)
movdqa %xmm1, 0x160(%rsp)
movdqa %xmm1, 0x150(%rsp)
movq %r13, 0x1d8(%rsp)
movq 0x30(%rsp), %rax
movb %r14b, 0x10(%rax)
movdqu %xmm1, (%rax)
movq %r14, 0x3f0(%rsp)
movdqa %xmm1, 0x3e0(%rsp)
movdqa %xmm1, 0x3d0(%rsp)
movdqa %xmm1, 0x3c0(%rsp)
movdqa %xmm1, 0x3b0(%rsp)
movdqa %xmm1, 0x3a0(%rsp)
movdqa %xmm1, 0x390(%rsp)
movdqa %xmm1, 0x380(%rsp)
movq %r13, 0x408(%rsp)
movq 0x20(%rsp), %rax
movb %r14b, 0x10(%rax)
movdqu %xmm1, (%rax)
movq %r14, 0x340(%rsp)
movdqa %xmm1, 0x330(%rsp)
movdqa %xmm1, 0x320(%rsp)
movdqa %xmm1, 0x310(%rsp)
movdqa %xmm1, 0x300(%rsp)
movdqa %xmm1, 0x2f0(%rsp)
movdqa %xmm1, 0x2e0(%rsp)
movdqa %xmm1, 0x2d0(%rsp)
movq %r13, 0x358(%rsp)
movq 0x78(%rsp), %rax
movb %r14b, 0x10(%rax)
movdqu %xmm1, (%rax)
movq %r14, 0x290(%rsp)
movdqa %xmm1, 0x280(%rsp)
movdqa %xmm1, 0x270(%rsp)
movdqa %xmm1, 0x260(%rsp)
movdqa %xmm1, 0x250(%rsp)
movdqa %xmm1, 0x240(%rsp)
movdqa %xmm1, 0x230(%rsp)
movdqa %xmm1, 0x220(%rsp)
movq %r13, 0x2a8(%rsp)
movq 0x140(%rsp), %rax
movb %r14b, 0x10(%rax)
movdqu %xmm1, (%rax)
movq 0x78(%rbx), %rax
movq 0xf0(%rbx), %rcx
movq (%rcx,%rbp,8), %rsi
movq (%rax,%r15), %rdi
movq 0x8(%rax,%r15), %rdx
subq %rdi, %rdx
sarq $0x3, %rdx
cmpq %rsi, %rdx
jbe 0x11da7
movq 0x158(%rsp), %rdx
cmpq 0x150(%rsp), %rdx
jne 0x11d88
movq (%rdi,%rsi,8), %xmm1
movq %r12, 0x1d8(%rsp)
movq $0x0, 0x1e0(%rsp)
movq %xmm1, 0x1e8(%rsp)
movb $0x0, 0x1f0(%rsp)
movq 0x388(%rsp), %rdx
cmpq 0x380(%rsp), %rdx
jne 0x11d86
movq (%rdi,%rsi,8), %xmm1
movq %r12, 0x408(%rsp)
movq $0x0, 0x410(%rsp)
movq %xmm1, 0x418(%rsp)
movb $0x0, 0x420(%rsp)
movq 0x2d8(%rsp), %rdx
cmpq 0x2d0(%rsp), %rdx
jne 0x11d84
movq (%rdi,%rsi,8), %xmm1
movq %r12, 0x358(%rsp)
movq %xmm1, 0x360(%rsp)
movq %xmm0, 0x368(%rsp)
movb $0x0, 0x370(%rsp)
movq 0x228(%rsp), %rdx
cmpq 0x220(%rsp), %rdx
jne 0x11d82
movq (%rdi,%rsi,8), %xmm1
movq %r12, 0x2a8(%rsp)
movq %xmm1, 0x2b0(%rsp)
movq %xmm0, 0x2b8(%rsp)
movb $0x0, 0x2c0(%rsp)
movq %r14, 0x70(%rsp)
pxor %xmm0, %xmm0
movdqa %xmm0, 0x60(%rsp)
movq %r14, 0x50(%rsp)
movdqa %xmm0, 0x40(%rsp)
movq %r14, 0xf0(%rsp)
movdqa %xmm0, 0xe0(%rsp)
movq %r14, 0xd0(%rsp)
movdqa %xmm0, 0xc0(%rsp)
movq %r14, 0xb0(%rsp)
movdqa %xmm0, 0xa0(%rsp)
movq %r14, 0x90(%rsp)
movdqa %xmm0, 0x80(%rsp)
movq (%rax,%r15), %rdi
movq (%rcx,%rbp,8), %rax
leaq 0x8(%rdi,%rax,8), %rsi
leaq 0x60(%rsp), %rdx
callq 0x1d034
movq 0x78(%rbx), %rax
movq 0xf0(%rbx), %rcx
movq (%rcx,%rbp,8), %rcx
movq (%rax,%r15), %rdx
movq 0x8(%rax,%r15), %rsi
leaq 0x8(%rdx,%rcx,8), %rdi
leaq 0x40(%rsp), %rdx
callq 0x1d034
movq 0x80(%rbx), %rax
movq 0xf0(%rbx), %rcx
movq (%rax,%r15), %rdi
movq (%rcx,%rbp,8), %rax
leaq (%rdi,%rax,8), %rsi
addq $0x8, %rsi
leaq 0xe0(%rsp), %rdx
callq 0x1d034
movq 0x80(%rbx), %rax
movq 0xf0(%rbx), %rcx
movq (%rcx,%rbp,8), %rcx
movq (%rax,%r15), %rdx
movq 0x8(%rax,%r15), %rsi
leaq 0x8(%rdx,%rcx,8), %rdi
leaq 0xc0(%rsp), %rdx
callq 0x1d034
movq 0x88(%rbx), %rax
movq 0xf0(%rbx), %rcx
movq (%rax,%r15), %rdi
movq (%rcx,%rbp,8), %rax
leaq (%rdi,%rax,8), %rsi
addq $0x8, %rsi
leaq 0xa0(%rsp), %rdx
callq 0x1d034
movq 0x88(%rbx), %rax
movq 0xf0(%rbx), %rcx
movq (%rcx,%rbp,8), %rcx
movq (%rax,%r15), %rdx
movq 0x8(%rax,%r15), %rsi
leaq 0x8(%rdx,%rcx,8), %rdi
leaq 0x80(%rsp), %rdx
callq 0x1d034
movq 0x68(%rsp), %rax
subq 0x60(%rsp), %rax
cmpq $0x11, %rax
jb 0x119c4
leaq 0xe0(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
leaq 0x60(%rsp), %rcx
callq 0x108dc
leaq 0x150(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x11fae
leaq 0x380(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x11fae
movq 0x48(%rsp), %rax
subq 0x40(%rsp), %rax
cmpq $0x11, %rax
jb 0x11a22
leaq 0xc0(%rsp), %rsi
leaq 0x80(%rsp), %rdx
leaq 0x40(%rsp), %rcx
callq 0x108dc
leaq 0x2d0(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x11fae
leaq 0x220(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x11fae
movq 0x138(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x12fa4
movq 0x130(%rsp), %rdi
leaq 0x2d0(%rsp), %rsi
callq 0x12fa4
movq 0x128(%rsp), %rdi
leaq 0x380(%rsp), %rsi
callq 0x12fa4
movq 0x120(%rsp), %rdi
leaq 0x220(%rsp), %rsi
callq 0x12fa4
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x11a93
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x11ab0
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x11acd
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x11aea
movq 0xf0(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x11b01
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x11b18
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x280(%rsp), %rdi
testq %rdi, %rdi
je 0x11b35
movq 0x290(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x268(%rsp), %rdi
testq %rdi, %rdi
je 0x11b52
movq 0x278(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x250(%rsp), %rdi
testq %rdi, %rdi
je 0x11b6f
movq 0x260(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x238(%rsp), %rdi
testq %rdi, %rdi
je 0x11b8c
movq 0x248(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x220(%rsp), %rdi
testq %rdi, %rdi
je 0x11ba9
movq 0x230(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x330(%rsp), %rdi
testq %rdi, %rdi
je 0x11bc6
movq 0x340(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x318(%rsp), %rdi
testq %rdi, %rdi
je 0x11be3
movq 0x328(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x300(%rsp), %rdi
testq %rdi, %rdi
je 0x11c00
movq 0x310(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x2e8(%rsp), %rdi
testq %rdi, %rdi
je 0x11c1d
movq 0x2f8(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x2d0(%rsp), %rdi
testq %rdi, %rdi
je 0x11c3a
movq 0x2e0(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x3e0(%rsp), %rdi
testq %rdi, %rdi
je 0x11c57
movq 0x3f0(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x3c8(%rsp), %rdi
testq %rdi, %rdi
je 0x11c74
movq 0x3d8(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x3b0(%rsp), %rdi
testq %rdi, %rdi
je 0x11c91
movq 0x3c0(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x398(%rsp), %rdi
testq %rdi, %rdi
je 0x11cae
movq 0x3a8(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x380(%rsp), %rdi
testq %rdi, %rdi
je 0x11ccb
movq 0x390(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x1b0(%rsp), %rdi
testq %rdi, %rdi
je 0x11ce8
movq 0x1c0(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x198(%rsp), %rdi
testq %rdi, %rdi
je 0x11d05
movq 0x1a8(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x180(%rsp), %rdi
testq %rdi, %rdi
je 0x11d22
movq 0x190(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x168(%rsp), %rdi
testq %rdi, %rdi
je 0x11d3f
movq 0x178(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x150(%rsp), %rdi
testq %rdi, %rdi
je 0x11d5c
movq 0x160(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
incq %rbp
movslq 0x8(%rbx), %rax
addq $0x18, %r15
cmpq %rax, %rbp
jl 0x11572
addq $0x33b8, %rsp           # imm = 0x33B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x11d88
jmp 0x11d88
jmp 0x11d88
leaq 0x2497e(%rip), %rdi     # 0x3670d
leaq 0x24985(%rip), %rsi     # 0x3671b
leaq 0x24989(%rip), %rcx     # 0x36726
movl $0x113, %edx            # imm = 0x113
callq 0x7210
leaq 0x24e73(%rip), %rdi     # 0x36c21
xorl %eax, %eax
callq 0x7530
movl $0x8, %edi
callq 0x7180
movq %rax, %r14
movl $0x1, %edi
callq 0x7380
movq %rax, %r15
leaq 0x23ff2(%rip), %rsi     # 0x35dc8
movq %rax, %rdi
callq 0xb4d0
movq %r15, (%r14)
leaq 0x36ed0(%rip), %rsi     # 0x48cb8
movq %r14, %rdi
jmp 0x11e17
leaq 0x23c4e(%rip), %rdi     # 0x35a42
callq 0x7560
movl $0x8, %edi
callq 0x7180
leaq 0x23c54(%rip), %rcx     # 0x35a5e
movq %rcx, (%rax)
movq 0x37124(%rip), %rsi     # 0x48f38
movq %rax, %rdi
xorl %edx, %edx
callq 0x7660
movl $0x8, %edi
callq 0x7180
leaq 0x23e4d(%rip), %rcx     # 0x35c7c
jmp 0x11e0a
movl $0x8, %edi
callq 0x7180
leaq 0x23f3b(%rip), %rcx     # 0x35d7d
jmp 0x11e0a
movq %rax, %rbx
movl $0x1, %esi
movq %r15, %rdi
callq 0x7390
jmp 0x11e82
movq %rax, %rbx
movq 0x200(%rsp), %rdi
cmpq %r14, %rdi
je 0x11f97
movq 0x210(%rsp), %rsi
incq %rsi
jmp 0x11ea0
movq %rax, %rbx
jmp 0x11f97
movq %rax, %rbx
movq %r14, %rdi
callq 0x72a0
jmp 0x11f97
jmp 0x11e95
jmp 0x11e95
jmp 0x11e95
movq %rax, %rbx
movl $0x10, %esi
movq %r13, %rdi
callq 0x7390
jmp 0x11f97
movq %rax, %rbx
jmp 0x11f63
jmp 0x11ebe
jmp 0x11ebe
jmp 0x11ebe
jmp 0x11ebe
jmp 0x11ebe
jmp 0x11ebe
movq %rax, %rbx
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x11ede
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x11efb
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x11f18
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x11f35
movq 0xf0(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x11f4c
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x11f63
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
leaq 0x220(%rsp), %rdi
callq 0x13108
leaq 0x2d0(%rsp), %rdi
callq 0x13108
leaq 0x380(%rsp), %rdi
callq 0x13108
leaq 0x150(%rsp), %rdi
callq 0x13108
movq %rbx, %rdi
callq 0x76a0
nop