// File: /workspace/github_cpp_makefile_star2_O1/melop[P]admixem/Population.cpp
// Function: Population::Breed()
bool Population::Breed() {
	
	
	int nCurrGen = SimulConfig.GetCurrGen(); // tell what is the current generation
	bool bIgnoreGlobalRules = SimulConfig.pSexualSelConfig->IgnoreGlobalRules(nCurrGen); // is there special sexual selection rules for this generation?
	bool bIgnoreGlobalRulesNa = SimulConfig.pNaturalSelConfig->IgnoreGlobalRules(nCurrGen);
	double nSampleMate = SimulConfig.GetNumericConfig("SampleMate");
	string sOffSpringCountFunc = SimulConfig.GetConfig("kids_per_female_func");
	int nOffSpringCountFunc = (sOffSpringCountFunc=="Poisson")? 1:0; //1 - Poisson, 0- normal distribution with variance being 1/4 of mean

	if (_mpMales.size()==0 || _mpFemales.size()==0) {
		printf("Pop %s cannot breed because one of the sexes is 0...\n", _sPopName.c_str());
		this->_bBred = true;
		return false;
	}

	//Check if natural selection prob or sexual selection prob is zero, if so, no need to continue.
	list< pair< Parser *, int> > * pqParsers = SimulConfig.pNaturalSelConfig->GetFormulae(this->GetPopName());

	for (list< pair< Parser *, int> >::iterator itParser= pqParsers->begin(); itParser != pqParsers->end() ; ++itParser) {
		int nGen = itParser->second;
		if ((nGen ==-1 && !bIgnoreGlobalRules) || (bIgnoreGlobalRulesNa && nGen == nCurrGen) ) {
			if (itParser->first->IsZero) {
				this->_bBred = true;
				return true; //no need to continue since surviving prob is zero.
			}
		}
	}

	printf("Pop %s breeding...\n", _sPopName.c_str());
	int nNewOffSpringCount = 0;
	int nNumFemales = _mpFemales.size();
	
	vector< Poisson* > vOffSpringPoissonGen; 
	

	//set population level variables for freq dependent sexual selection:

	
	map< int, map<string , list< pair<Parser *, int> > > > * mppqParsers = SimulConfig.pSexualSelConfig->GetFormulaeAllCPUs();

	list< vector<string> > * pqvPopCourterSymbols = SimulConfig.pSexualSelConfig->GetFormulaSymbolStringsPopCourter( this->_sPopName);
	list< vector<string> > * pqvPopChooserSymbols = SimulConfig.pSexualSelConfig->GetFormulaSymbolStringsPopChooser( this->_sPopName);
	list< vector<string> > * pqvPopSymbols = SimulConfig.pSexualSelConfig->GetFormulaSymbolStringsPop( this->_sPopName);



	for(int nCPU=0;nCPU<nTotalCPUCore;nCPU++) { //set global current population parameters for all the CPUs

		list< pair< Parser *, int > > * pqParsers = &(*mppqParsers)[nCPU][this->_sPopName];
		list< vector<string> >::iterator itPopCourterSymbols= pqvPopCourterSymbols->begin();
		list< vector<string> >::iterator itPopChooserSymbols= pqvPopChooserSymbols->begin();
		list< vector<string> >::iterator itPopSymbols= pqvPopSymbols->begin();

		for (list< pair< Parser *, int > > ::iterator itParser= pqParsers->begin(); itParser != pqParsers->end() ; ++itParser) {
				vector<string> vSymbolsPopCourter = *itPopCourterSymbols;
				vector<string> vSymbolsPopChooser = *itPopChooserSymbols;
				vector<string> vSymbolsPop = *itPopSymbols;

				Parser * pParser = itParser->first;

				//Set courter symbol values
				for(vector<string>::iterator itSymbol=vSymbolsPop.begin();itSymbol!=vSymbolsPop.end();++itSymbol)
				{
					string sSymbol = (*itSymbol).substr(4);
					string sType = (*itSymbol).substr(0, 3); //either Avg or Std
					if (sType != "Avg" && sType != "Std") {
						throw new Exception("Population parameter type unknown!");
					}
					if (this->_mpSumPhenotype.find(sSymbol) == _mpSumPhenotype.end()) {
						throw new Exception("Unable to find population symbol");
					}
			
					pParser->symbols_[string("Pop_Avg_"+sSymbol)] = this->_mpSumPhenotype[sSymbol].first;
					pParser->symbols_[string("Pop_Std_"+sSymbol)] = this->_mpSumPhenotype[sSymbol].second;
					cout << "CPU:" << nCPU << "Pop_Avg_" << sSymbol.c_str() << "=" << this->_mpSumPhenotype[sSymbol].first << "\n";
					cout << "CPU:" << nCPU << "Pop_Std_" << sSymbol.c_str() << "=" << this->_mpSumPhenotype[sSymbol].second << "\n";
				}

				for(vector<string>::iterator itSymbol=vSymbolsPopCourter.begin();itSymbol!=vSymbolsPopCourter.end();++itSymbol)
				{
					string sSymbol = (*itSymbol).substr(4);
					string sType = (*itSymbol).substr(0, 3); //either Avg or Std
					if (sType != "Avg" && sType != "Std") {
						throw new Exception("Population parameter type unknown!");
					}
					if (this->_mpSumPhenotypeMale.find(sSymbol) == _mpSumPhenotypeMale.end()) {
						throw new Exception("Unable to find population symbol: male");
					}
			
					pParser->symbols_[string("PopCourter_Avg_"+sSymbol)] = this->_mpSumPhenotypeMale[sSymbol].first;
					pParser->symbols_[string("PopCourter_Std_"+sSymbol)] = this->_mpSumPhenotypeMale[sSymbol].second;
					cout << "CPU:" << nCPU << "PopCourter_Avg_" << sSymbol.c_str() << "=" << this->_mpSumPhenotypeMale[sSymbol].first << "\n";
					cout << "CPU:" << nCPU << "PopCourter_Std_" << sSymbol.c_str() << "=" << this->_mpSumPhenotypeMale[sSymbol].second << "\n";
				}

				for(vector<string>::iterator itSymbol=vSymbolsPopChooser.begin();itSymbol!=vSymbolsPopChooser.end();++itSymbol)
				{
					string sSymbol = (*itSymbol).substr(4);
					string sType = (*itSymbol).substr(0, 3); //either Avg or Std
					if (sType != "Avg" && sType != "Std") {
						throw new Exception("Population parameter type unknown!");
					}
					if (this->_mpSumPhenotypeFemale.find(sSymbol) == _mpSumPhenotypeFemale.end()) {
						throw new Exception("Unable to find population symbol: female");
					}
			
					pParser->symbols_[string("PopChooser_Avg_"+sSymbol)] = this->_mpSumPhenotypeFemale[sSymbol].first;
					pParser->symbols_[string("PopChooser_Std_"+sSymbol)] = this->_mpSumPhenotypeFemale[sSymbol].second;
					cout << "CPU:" << nCPU << "PopChooser_Avg_" << sSymbol.c_str() << "=" << this->_mpSumPhenotypeFemale[sSymbol].first << "\n";
					cout << "CPU:" << nCPU << "PopChooser_Std_" << sSymbol.c_str() << "=" << this->_mpSumPhenotypeFemale[sSymbol].second << "\n";


				}
			
				++itPopCourterSymbols;
				++itPopChooserSymbols;
				++itPopSymbols;
		}
	}

	//for (vector<Individual *>::iterator itFemale = _mpFemales.begin(); itFemale!= _mpFemales.end(); ++itFemale) {
	//enable omp. because this is random access, ideal for parallel
	std::set<int> stSampledFemales;//keep a list of the females already sampled so that they're not sampled twice.
	std::set<int> stExhaustedFemales; // a list of females without further gametes
	//int nExhaustedFemales=0;
	bool bCourterHandeled = false;
	int nMaxLoop = SimulConfig.GetNumericConfig("FemaleGiveBirthMaxIterations");
	nMaxLoop = (nMaxLoop==-1)? 1000:nMaxLoop; //do at most 20 loops.
	int nLoopCount = 0;
	int nSameAvgKidIterCount = 0;
	double nPrevKidPerFemale = -1.0;
	do 
	{
		nLoopCount++;
		if (nNewOffSpringCount >= this->_nPopMaxSize) {
			printf("Max Pop Size met.\n");
			break; //no need to continue;
		}
		//#pragma omp critical
		//{
			if (stSampledFemales.size() != 0) {
				stSampledFemales.clear();
			}
		//}
	double nAvgKidPerFemale = (double)(_nPopMaxSize - nNewOffSpringCount) / (double)nNumFemales; // average kid per female, given the number offsprings left to fill the pop
	vOffSpringPoissonGen.clear();
		
	if (nPrevKidPerFemale == nAvgKidPerFemale ) {
		//no addition;
		if (nSameAvgKidIterCount > nMaxLoop) {
			printf("No more breeding possible\n");
			break;
		} else {
			nSameAvgKidIterCount++;	
		}
	}
	nPrevKidPerFemale = nAvgKidPerFemale;
		
	for(int nCPU=0;nCPU<nTotalCPUCore;nCPU++) { //set global current population parameters for all the CPUs

		//initialize poisson generators for offspring numbers
		if (nOffSpringCountFunc == 1 ) {
			Poisson * OffSpPois = new Poisson(nAvgKidPerFemale);
			vOffSpringPoissonGen.push_back(OffSpPois);
		}
	}

	printf("AvgKidPerFemale: %f\n", nAvgKidPerFemale);

	#pragma omp parallel shared(bCourterHandeled, stExhaustedFemales, stSampledFemales, nNumFemales, nSampleMate, bIgnoreGlobalRules, nAvgKidPerFemale, bIgnoreGlobalRulesNa, nNewOffSpringCount) 
	//private(pFemale, nCourters, pCourter, vOffSprings, itOffSpring)
	{
	


	#pragma omp for 
		//reduction(+: nNewOffSpringCount) 
	for(int i=0;i<nNumFemales;i++) 
	{
		if (nNewOffSpringCount >= this->_nPopMaxSize || stExhaustedFemales.size() >= this->_mpFemales.size()) {
			continue; // first see if new pop already filled up by other threads. if so then do nothing.
		}
		
		#ifdef _OPENMP
		int nCPU = omp_get_thread_num();
			#ifdef DEBUG
			printf("CPU %d: %s : %d\n", nCPU, "SexSelFormulae # ", nCPU);
			#endif
		#else
			int nCPU = 0;
		#endif

		//Go over each female so that they can mate.
		int nRandFemaleInd=fnGetRandIndex(nNumFemales);
		bool bGetRandSuccess = true;
		
			while((stSampledFemales.find(nRandFemaleInd)!= stSampledFemales.end()) && (stExhaustedFemales.find(nRandFemaleInd) == stExhaustedFemales.end())) {
				nRandFemaleInd=fnGetRandIndex(nNumFemales);
				if (stExhaustedFemales.size() >= this->_mpFemales.size()) {
					bGetRandSuccess = false;
					break;
				}
			}
			if (bGetRandSuccess) {
				#pragma omp critical
				{
					stSampledFemales.insert(nRandFemaleInd);
				}
			}
		#ifdef DEBUG
		printf("CPU %d: Female Id: %d\n", nCPU, nRandFemaleInd);
		#endif
		if (!bGetRandSuccess) {
			continue;
		}

		Individual * pFemale = this->_mpFemales.at(nRandFemaleInd); //get random female

		if (pFemale->GetGameteNum() == 0) 
		{
				#pragma omp critical
				{
			
			
						stExhaustedFemales.insert(nRandFemaleInd); // this female cannot produce more offsprings.

				}
				continue; //if already no gamete then don't bother.
				//nExhaustedFemales++;
		}

		if (!bCourterHandeled) {
		int nCourters = (int)nSampleMate; //(int)NormalExt(nSampleMate , 1, 0, 100);

		
			for (int j=0;j<nCourters;j++) {
				#ifdef DEBUG
				printf("CPU %d: Breed::beforerandom\n", nCPU);
				printf("CPU %d: _mpMale.size() %d\n", nCPU, _mpMales.size());
				#endif
				
				Individual * pCourter = this->_mpMales.at(fnGetRandIndex(this->_mpMales.size() ));

				#ifdef DEBUG
				printf("CPU %d: Breed::afterrandom\n", nCPU);
				#endif
				//#pragma omp critical
				//{
					pFemale->HandleCourter(pCourter , bIgnoreGlobalRules);
				//}
				#ifdef DEBUG
				printf("CPU %d : Breed::aftercourterhandler\n", nCPU);
				#endif
			}
		}
		

		//After mating, get the offspring out!

		vector<Individual *> vOffSprings;

		int nTargetOffSpringCount =  round(NormalExt(nAvgKidPerFemale,nAvgKidPerFemale/4, 0,10000));

		if ( nOffSpringCountFunc == 1 ) { //use poisson distribution for offspring number
			#ifdef DEBUG
			printf("CPU %d : Getting Target offspring...\n", nCPU );
			#endif
			nTargetOffSpringCount = vOffSpringPoissonGen[nCPU]->Next();
			#ifdef DEBUG
			printf("CPU %d : Target offspring: %d\n", nCPU, nTargetOffSpringCount );
			#endif
		}
		//#pragma omp critical
		//{
		if (nTargetOffSpringCount == 0) {
			continue;
		}

		#ifdef DEBUG

		printf("CPU %d: Breed::GiveBirth before\n", nCPU);
		#endif
		
		pFemale->GiveBirth(vOffSprings, nTargetOffSpringCount, bIgnoreGlobalRulesNa); // to save memory, natural selection that isn't frequency dependent is carried out in the GiveBirth Function!
		
		#ifdef DEBUG

		printf("CPU %d: Breed::GiveBirth after\n", nCPU);
		#endif
		//}

		if (pFemale->GetGameteNum() == 0) 
		{
			#ifdef DEBUG

			printf("CPU %d: Exhausted female before\n", nCPU);
			#endif
			#pragma omp critical
			{
			
			
				stExhaustedFemales.insert(nRandFemaleInd); // this female cannot produce more offsprings.
				//nExhaustedFemales++;
			}

			#ifdef DEBUG
			printf("CPU %d: Exhausted female after\n", nCPU);
			#endif
		}

		#ifdef DEBUG
		printf("CPU %d: Start insert offspring\n", nCPU);
		#endif
		//#pragma omp critical
		//{
		for (vector<Individual *>::iterator itOffSpring = vOffSprings.begin(); itOffSpring!=vOffSprings.end(); ++itOffSpring) 
		{

			if (nNewOffSpringCount < this->_nPopMaxSize)
			{
				if ( (*itOffSpring)->GetSex() == Individual::Male) {

					//#pragma omp critical
						this->_mpvNewGenMales[nCPU].push_back(*itOffSpring);
					//}
				}
				else {
					//#pragma omp critical
					//{
						this->_mpvNewGenFemales[nCPU].push_back(*itOffSpring);
					//}
				}
				#pragma omp critical
				{
					nNewOffSpringCount++;
				}
			}
			else {

				printf("No need to insert more offsprings, break;\n");
				break; // no need to do anything more, already exceeded limit;
			}
		}

		//} // end omp
		#ifdef DEBUG
		printf("CPU %d: end insert offspring\n", nCPU);
		#endif

	}

		
	} //end parallel block

	bCourterHandeled = true;
		
		for(int nCPU=0;nCPU<nTotalCPUCore;nCPU++) { //set global current population parameters for all the CPUs
			//delete poisson generators for offspring numbers
			if (nOffSpringCountFunc == 1 ) {
				#ifdef DEBUG
				printf("CPU %d: Realease poisson generator\n", nCPU);
				#endif
				delete vOffSpringPoissonGen[nCPU];
				vOffSpringPoissonGen[nCPU] = NULL;
			}
		}


	} // end do block
	while( (nLoopCount <= nMaxLoop) && (nNewOffSpringCount < this->_nPopMaxSize) && (stExhaustedFemales.size() < this->_mpFemales.size()) ) ; //end do while block.
	/* needs more work
	int nExcessOffsprings = nNewOffSpringCount - this->_nPopMaxSize;
	int nExcessMales = nExcessOffsprings / 2;
	int nExcessFemales = nExcessOffsprings - nExcessMales;
	int nDeletedMales = 0;
	int nDeletedFemales = 0;
	
	if (nExcessOffsprings > 0) {
		printf("Delete %d extra males and %d females (total %d)\n", nExcessMales,  nExcessFemales, nExcessOffsprings);	
	}
	
		for(int nCPU=0;nCPU<nTotalCPUCore;nCPU++) { //set global current population parameters for all the CPUs

			if (nDeletedMales < nExcessMales && (!this->_mpvNewGenMales[nCPU].empty())) {
				Individual *pToDelete = (this->_mpvNewGenMales[nCPU].back());
				this->_mpvNewGenMales[nCPU].pop_back();
				delete pToDelete;
				nDeletedMales++;
			}
                        if (nDeletedFemales < nExcessFemales && (!this->_mpvNewGenFemales[nCPU].empty())) {
                                Individual *pToDelete = (this->_mpvNewGenFemales[nCPU].back());
                                this->_mpvNewGenFemales[nCPU].pop_back();
				delete pToDelete;
                                nDeletedFemales++;
                        }
		}
	*/
	
	this->_bBred = true; //set flag
	return true;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %rdi, %r15
leaq 0x1ee7b(%rip), %rbx     # 0x49908
movq %rbx, %rdi
callq 0x198ee
movl %eax, %ebp
movq 0x28(%rbx), %rdi
movl %eax, %esi
callq 0x17836
movb %al, 0xb(%rsp)
movq 0x20(%rbx), %rdi
movl %ebp, %esi
callq 0x15b1c
movb %al, 0xa(%rsp)
leaq 0x288(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xce23(%rip), %rsi      # 0x378ec
leaq 0xce26(%rip), %rdx      # 0x378f6
leaq 0x278(%rsp), %r14
movq %r14, %rdi
callq 0xa886
movq %rbx, %rdi
movq %r14, %rsi
callq 0x19626
movsd %xmm0, 0x130(%rsp)
movq 0x278(%rsp), %rdi
cmpq %r12, %rdi
je 0x2ab11
movq 0x288(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x248(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xcdd3(%rip), %rsi      # 0x378f7
leaq 0xcde0(%rip), %rdx      # 0x3790b
leaq 0x238(%rsp), %rdi
callq 0xa886
leaq 0x1edc9(%rip), %rbx     # 0x49908
leaq 0x258(%rsp), %rdi
leaq 0x238(%rsp), %rdx
movq %rbx, %rsi
callq 0x1007e
movq 0x238(%rsp), %rdi
cmpq %r14, %rdi
je 0x2ab74
movq 0x248(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0xada1(%rip), %rsi      # 0x3591c
leaq 0x258(%rsp), %rdi
callq 0x7100
movl %eax, 0x64(%rsp)
movq 0x50(%r15), %rax
cmpq 0x48(%r15), %rax
je 0x2bef6
movq 0x68(%r15), %rax
cmpq 0x60(%r15), %rax
je 0x2bef6
movq 0x20(%rbx), %r14
leaq 0x228(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0x218(%rsp), %rdi
callq 0xa916
leaq 0x218(%rsp), %rsi
movq %r14, %rdi
callq 0x15b64
movq %rax, %r14
movq 0x218(%rsp), %rdi
cmpq %r12, %rdi
je 0x2ac00
movq 0x228(%rsp), %rsi
incq %rsi
callq 0x7390
movq (%r14), %rax
cmpq %r14, %rax
movb 0xa(%rsp), %sil
je 0x2ac3c
movl 0x18(%rax), %edx
cmpl $-0x1, %edx
setne %cl
cmpl %ebp, %edx
sete %dl
testb %dl, %sil
jne 0x2ac26
orb 0xb(%rsp), %cl
jne 0x2ac34
movq 0x10(%rax), %rcx
cmpb $0x1, 0x61(%rcx)
je 0x2bf10
movq (%rax), %rax
cmpq %r14, %rax
jne 0x2ac0d
movq (%r15), %rsi
leaq 0xccfc(%rip), %rdi      # 0x37942
xorl %eax, %eax
callq 0x7060
movq 0x68(%r15), %rax
subq 0x60(%r15), %rax
movq %rax, 0x68(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x90(%rsp)
movq $0x0, 0xa0(%rsp)
movq 0x28(%rbx), %rdi
callq 0x178b8
movq %rax, 0x150(%rsp)
movq 0x28(%rbx), %r14
leaq 0x208(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0x1f8(%rsp), %rdi
callq 0xa916
leaq 0x1f8(%rsp), %rsi
movq %r14, %rdi
callq 0x178e2
movq %rax, 0x148(%rsp)
movq 0x1f8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2ace1
movq 0x208(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x28(%rbx), %r14
leaq 0x1e8(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0x1d8(%rsp), %rdi
callq 0xa916
leaq 0x1d8(%rsp), %rsi
movq %r14, %rdi
callq 0x178ee
movq %rax, 0x140(%rsp)
movq 0x1d8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2ad3e
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x28(%rbx), %rbx
leaq 0x1c8(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0x1b8(%rsp), %rdi
callq 0xa916
leaq 0x1b8(%rsp), %rsi
movq %rbx, %rdi
callq 0x178d6
movq %rax, 0x138(%rsp)
movq %r15, 0x10(%rsp)
movq 0x1b8(%rsp), %rdi
cmpq %r14, %rdi
je 0x2ad9f
movq 0x1c8(%rsp), %rsi
incq %rsi
callq 0x7390
movl $0x0, 0xc(%rsp)
leaq 0x1e60e(%rip), %rax     # 0x493bc
cmpl $0x0, (%rax)
jle 0x2b8e9
movq 0x10(%rsp), %rax
leaq 0xb8(%rax), %rcx
movq %rcx, 0x40(%rsp)
leaq 0xc0(%rax), %rcx
movq %rcx, 0xe0(%rsp)
leaq 0xe8(%rax), %rcx
movq %rcx, 0x50(%rsp)
leaq 0xf0(%rax), %rcx
movq %rcx, 0xd8(%rsp)
leaq 0x118(%rax), %rcx
movq %rcx, 0x48(%rsp)
addq $0x120, %rax            # imm = 0x120
movq %rax, 0x88(%rsp)
leaq 0x70(%rsp), %rbx
leaq 0xa8(%rsp), %r15
movq 0x1e170(%rip), %r12     # 0x48f90
movq 0x150(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x1a6f2
movq %rax, %rdi
movq 0x10(%rsp), %rsi
callq 0x1a756
movq %rax, %rcx
movq (%rax), %rax
movq %rax, 0x128(%rsp)
cmpq %rcx, %rax
je 0x2b8d0
movq 0x138(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x118(%rsp)
movq 0x140(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x120(%rsp)
movq 0x148(%rsp), %rax
movq (%rax), %r14
movq %rcx, 0x158(%rsp)
movq %r14, 0x160(%rsp)
leaq 0x10(%r14), %rsi
movq %rbx, %rdi
callq 0x2021c
movq 0x120(%rsp), %rax
leaq 0x10(%rax), %rsi
leaq 0x180(%rsp), %rdi
callq 0x2021c
movq 0x118(%rsp), %rax
leaq 0x10(%rax), %rsi
leaq 0x168(%rsp), %rdi
callq 0x2021c
movq 0x128(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x58(%rsp)
movq 0x168(%rsp), %r13
cmpq 0x170(%rsp), %r13
je 0x2b20f
movq 0x58(%rsp), %rax
leaq 0x68(%rax), %r14
movl $0x4, %edx
movq %r15, %rdi
movq %r13, %rsi
movq $-0x1, %rcx
callq 0x73c0
movl $0x3, %ecx
leaq 0xe8(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x73c0
movq %rbx, %rdi
leaq 0xbff6(%rip), %rsi      # 0x36f36
callq 0x7100
testl %eax, %eax
je 0x2af60
movq %rbx, %rdi
leaq 0xbfe7(%rip), %rsi      # 0x36f3a
callq 0x7100
testl %eax, %eax
jne 0x2c024
movq 0x40(%rsp), %rdi
movq %r15, %rsi
callq 0x276ee
cmpq 0xe0(%rsp), %rax
je 0x2bf9a
movq 0x40(%rsp), %rdi
movq %r15, %rsi
callq 0x26b00
movsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
leaq 0xc9d8(%rip), %rsi      # 0x37979
movq %r15, %rdx
callq 0x9981
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1b39a
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x2afda
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x40(%rsp), %rdi
movq %r15, %rsi
callq 0x26b00
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
leaq 0xc981(%rip), %rsi      # 0x37982
movq %r15, %rdx
callq 0x9981
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1b39a
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x2b03a
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x7390
movl $0x4, %edx
movq %r12, %rdi
leaq 0xc942(%rip), %rsi      # 0x3798b
callq 0x7400
movl 0xc(%rsp), %esi
movq %r12, %rdi
callq 0x7670
movq %rax, %rbp
movl $0x8, %edx
movq %rax, %rdi
leaq 0xc90d(%rip), %rsi      # 0x37979
callq 0x7400
movq 0xa8(%rsp), %rbx
testq %rbx, %rbx
je 0x2b096
movq %rbx, %rdi
callq 0x7170
movq %rbp, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x7400
jmp 0x2b0b0
movq (%rbp), %rax
movq -0x18(%rax), %rax
movq %rbp, %rdi
addq %rax, %rdi
movl 0x20(%rbp,%rax), %esi
orl $0x1, %esi
callq 0x7640
movl $0x1, %edx
movq %rbp, %rdi
leaq 0xc4fe(%rip), %rsi      # 0x375bd
callq 0x7400
movq 0x40(%rsp), %rdi
movq %r15, %rsi
callq 0x26b00
movsd (%rax), %xmm0
movq %rbp, %rdi
callq 0x75c0
movl $0x1, %edx
movq %rax, %rdi
leaq 0xae8b(%rip), %rsi      # 0x35f77
callq 0x7400
movl $0x4, %edx
movq %r12, %rdi
leaq 0xc88b(%rip), %rsi      # 0x3798b
callq 0x7400
movl 0xc(%rsp), %esi
movq %r12, %rdi
callq 0x7670
movq %rax, %rbp
movl $0x8, %edx
movq %rax, %rdi
leaq 0xc85f(%rip), %rsi      # 0x37982
callq 0x7400
movq 0xa8(%rsp), %rbx
testq %rbx, %rbx
je 0x2b152
movq %rbx, %rdi
callq 0x7170
movq %rbp, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x7400
leaq 0x70(%rsp), %rbx
jmp 0x2b171
movq (%rbp), %rax
movq -0x18(%rax), %rax
movq %rbp, %rdi
addq %rax, %rdi
movl 0x20(%rbp,%rax), %esi
orl $0x1, %esi
callq 0x7640
leaq 0x70(%rsp), %rbx
movl $0x1, %edx
movq %rbp, %rdi
leaq 0xc43d(%rip), %rsi      # 0x375bd
callq 0x7400
movq 0x40(%rsp), %rdi
movq %r15, %rsi
callq 0x26b00
movsd 0x8(%rax), %xmm0
movq %rbp, %rdi
callq 0x75c0
movl $0x1, %edx
movq %rax, %rdi
leaq 0xadc9(%rip), %rsi      # 0x35f77
callq 0x7400
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x2b1d8
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x2b1fd
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x7390
addq $0x20, %r13
cmpq 0x170(%rsp), %r13
jne 0x2af05
movq 0x70(%rsp), %r13
cmpq 0x78(%rsp), %r13
je 0x2b52f
movq 0x58(%rsp), %rax
leaq 0x68(%rax), %r14
movl $0x4, %edx
movq %r15, %rdi
movq %r13, %rsi
movq $-0x1, %rcx
callq 0x73c0
movl $0x3, %ecx
leaq 0xe8(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x73c0
movq %rbx, %rdi
leaq 0xbcd3(%rip), %rsi      # 0x36f36
callq 0x7100
testl %eax, %eax
je 0x2b283
movq %rbx, %rdi
leaq 0xbcc4(%rip), %rsi      # 0x36f3a
callq 0x7100
testl %eax, %eax
jne 0x2c061
movq 0x50(%rsp), %rdi
movq %r15, %rsi
callq 0x276ee
cmpq 0xd8(%rsp), %rax
je 0x2bfc8
movq 0x50(%rsp), %rdi
movq %r15, %rsi
callq 0x26b00
movsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
leaq 0xc6f3(%rip), %rsi      # 0x379b7
movq %r15, %rdx
callq 0x9981
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1b39a
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x2b2fd
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x50(%rsp), %rdi
movq %r15, %rsi
callq 0x26b00
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
leaq 0xc6a3(%rip), %rsi      # 0x379c7
movq %r15, %rdx
callq 0x9981
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1b39a
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x2b35d
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x7390
movl $0x4, %edx
movq %r12, %rdi
leaq 0xc61f(%rip), %rsi      # 0x3798b
callq 0x7400
movl 0xc(%rsp), %esi
movq %r12, %rdi
callq 0x7670
movq %rax, %rbp
movl $0xf, %edx
movq %rax, %rdi
leaq 0xc628(%rip), %rsi      # 0x379b7
callq 0x7400
movq 0xa8(%rsp), %rbx
testq %rbx, %rbx
je 0x2b3b9
movq %rbx, %rdi
callq 0x7170
movq %rbp, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x7400
jmp 0x2b3d3
movq (%rbp), %rax
movq -0x18(%rax), %rax
movq %rbp, %rdi
addq %rax, %rdi
movl 0x20(%rbp,%rax), %esi
orl $0x1, %esi
callq 0x7640
movl $0x1, %edx
movq %rbp, %rdi
leaq 0xc1db(%rip), %rsi      # 0x375bd
callq 0x7400
movq 0x50(%rsp), %rdi
movq %r15, %rsi
callq 0x26b00
movsd (%rax), %xmm0
movq %rbp, %rdi
callq 0x75c0
movl $0x1, %edx
movq %rax, %rdi
leaq 0xab68(%rip), %rsi      # 0x35f77
callq 0x7400
movl $0x4, %edx
movq %r12, %rdi
leaq 0xc568(%rip), %rsi      # 0x3798b
callq 0x7400
movl 0xc(%rsp), %esi
movq %r12, %rdi
callq 0x7670
movq %rax, %rbp
movl $0xf, %edx
movq %rax, %rdi
leaq 0xc581(%rip), %rsi      # 0x379c7
callq 0x7400
movq 0xa8(%rsp), %rbx
testq %rbx, %rbx
je 0x2b475
movq %rbx, %rdi
callq 0x7170
movq %rbp, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x7400
leaq 0x70(%rsp), %rbx
jmp 0x2b494
movq (%rbp), %rax
movq -0x18(%rax), %rax
movq %rbp, %rdi
addq %rax, %rdi
movl 0x20(%rbp,%rax), %esi
orl $0x1, %esi
callq 0x7640
leaq 0x70(%rsp), %rbx
movl $0x1, %edx
movq %rbp, %rdi
leaq 0xc11a(%rip), %rsi      # 0x375bd
callq 0x7400
movq 0x50(%rsp), %rdi
movq %r15, %rsi
callq 0x26b00
movsd 0x8(%rax), %xmm0
movq %rbp, %rdi
callq 0x75c0
movl $0x1, %edx
movq %rax, %rdi
leaq 0xaaa6(%rip), %rsi      # 0x35f77
callq 0x7400
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x2b4fb
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x2b520
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x7390
addq $0x20, %r13
cmpq 0x78(%rsp), %r13
jne 0x2b228
movq 0x180(%rsp), %r13
cmpq 0x188(%rsp), %r13
je 0x2b859
addq $0x68, 0x58(%rsp)
movl $0x4, %edx
movq %r15, %rdi
movq %r13, %rsi
movq $-0x1, %rcx
callq 0x73c0
movl $0x3, %ecx
leaq 0xe8(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x73c0
movq %rbx, %rdi
leaq 0xb9b0(%rip), %rsi      # 0x36f36
callq 0x7100
testl %eax, %eax
je 0x2b5a6
movq %rbx, %rdi
leaq 0xb9a1(%rip), %rsi      # 0x36f3a
callq 0x7100
testl %eax, %eax
jne 0x2c09e
movq 0x48(%rsp), %rdi
movq %r15, %rsi
callq 0x276ee
cmpq 0x88(%rsp), %rax
je 0x2bff6
movq 0x48(%rsp), %rdi
movq %r15, %rsi
callq 0x26b00
movsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
leaq 0xc419(%rip), %rsi      # 0x37a00
movq %r15, %rdx
callq 0x9981
movq 0x58(%rsp), %rdi
movq %rbx, %rsi
callq 0x1b39a
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x2b622
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x48(%rsp), %rdi
movq %r15, %rsi
callq 0x26b00
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
leaq 0xc3c7(%rip), %rsi      # 0x37a10
movq %r15, %rdx
callq 0x9981
movq 0x58(%rsp), %rdi
movq %rbx, %rsi
callq 0x1b39a
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x2b684
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x7390
movl $0x4, %edx
movq %r12, %rdi
leaq 0xc2f8(%rip), %rsi      # 0x3798b
callq 0x7400
movl 0xc(%rsp), %esi
movq %r12, %rdi
callq 0x7670
movq %rax, %r14
movl $0xf, %edx
movq %rax, %rdi
leaq 0xc34a(%rip), %rsi      # 0x37a00
callq 0x7400
movq 0xa8(%rsp), %rbx
testq %rbx, %rbx
je 0x2b6e0
movq %rbx, %rdi
callq 0x7170
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x7400
jmp 0x2b6fa
movq (%r14), %rax
movq -0x18(%rax), %rax
movq %r14, %rdi
addq %rax, %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x7640
movl $0x1, %edx
movq %r14, %rdi
leaq 0xbeb4(%rip), %rsi      # 0x375bd
callq 0x7400
movq 0x48(%rsp), %rdi
movq %r15, %rsi
callq 0x26b00
movsd (%rax), %xmm0
movq %r14, %rdi
callq 0x75c0
movl $0x1, %edx
movq %rax, %rdi
leaq 0xa841(%rip), %rsi      # 0x35f77
callq 0x7400
movl $0x4, %edx
movq %r12, %rdi
leaq 0xc241(%rip), %rsi      # 0x3798b
callq 0x7400
movl 0xc(%rsp), %esi
movq %r12, %rdi
callq 0x7670
movq %rax, %r14
movl $0xf, %edx
movq %rax, %rdi
leaq 0xc2a3(%rip), %rsi      # 0x37a10
callq 0x7400
movq 0xa8(%rsp), %rbx
testq %rbx, %rbx
je 0x2b79c
movq %rbx, %rdi
callq 0x7170
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x7400
leaq 0x70(%rsp), %rbx
jmp 0x2b7bb
movq (%r14), %rax
movq -0x18(%rax), %rax
movq %r14, %rdi
addq %rax, %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x7640
leaq 0x70(%rsp), %rbx
movl $0x1, %edx
movq %r14, %rdi
leaq 0xbdf3(%rip), %rsi      # 0x375bd
callq 0x7400
movq 0x48(%rsp), %rdi
movq %r15, %rsi
callq 0x26b00
movsd 0x8(%rax), %xmm0
movq %r14, %rdi
callq 0x75c0
movl $0x1, %edx
movq %rax, %rdi
leaq 0xa77f(%rip), %rsi      # 0x35f77
callq 0x7400
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x2b822
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x2b847
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x7390
addq $0x20, %r13
cmpq 0x188(%rsp), %r13
jne 0x2b54b
movq 0x160(%rsp), %r14
movq (%r14), %r14
movq 0x120(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x120(%rsp)
movq 0x118(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x118(%rsp)
leaq 0x168(%rsp), %rdi
callq 0x1a61a
leaq 0x180(%rsp), %rdi
callq 0x1a61a
movq %rbx, %rdi
callq 0x1a61a
movq 0x128(%rsp), %rax
movq (%rax), %rax
movq 0x158(%rsp), %rcx
movq %rax, 0x128(%rsp)
cmpq %rcx, %rax
jne 0x2ae8f
movl 0xc(%rsp), %eax
incl %eax
movl %eax, 0xc(%rsp)
leaq 0x1dadb(%rip), %rcx     # 0x493bc
cmpl (%rcx), %eax
jl 0x2ae20
leaq 0xb0(%rsp), %r12
xorl %eax, %eax
movl %eax, (%r12)
movq %rax, 0x8(%r12)
movq %r12, 0x10(%r12)
movq %r12, 0x18(%r12)
movq %rax, 0x20(%r12)
leaq 0xf0(%rsp), %r14
movl %eax, (%r14)
movq %rax, 0x8(%r14)
movq %r14, 0x10(%r14)
movq %r14, 0x18(%r14)
movq %rax, 0x20(%r14)
leaq 0x1a8(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0xc0e7(%rip), %rsi      # 0x37a20
leaq 0xc0fc(%rip), %rdx      # 0x37a3c
leaq 0x198(%rsp), %rdi
callq 0xa886
leaq 0x1dfb4(%rip), %rdi     # 0x49908
leaq 0x198(%rsp), %rsi
callq 0x19626
shrq $0x3, 0x68(%rsp)
cvttsd2si %xmm0, %ebp
movq 0x198(%rsp), %rdi
cmpq %rbx, %rdi
je 0x2b988
movq 0x1a8(%rsp), %rsi
incq %rsi
callq 0x7390
cmpl $-0x1, %ebp
movl $0x3e8, %r13d           # imm = 0x3E8
cmovnel %ebp, %r13d
xorps %xmm0, %xmm0
cvtsi2sdl 0x68(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
cvttsd2si 0x130(%rsp), %eax
movl %eax, 0xd8(%rsp)
movq $0x0, 0xe0(%rsp)
movsd 0x9a70(%rip), %xmm0     # 0x35438
movsd %xmm0, 0x48(%rsp)
xorl %ebp, %ebp
movq $0x0, 0x50(%rsp)
xorl %r15d, %r15d
movl %r13d, 0x88(%rsp)
movq 0x10(%rsp), %rax
cmpl 0x2c(%rax), %r15d
jge 0x2bf17
cmpq $0x0, 0xd0(%rsp)
je 0x2ba0b
leaq 0xa8(%rsp), %rdi
callq 0x2e92c
movq 0x10(%rsp), %rax
movl 0x2c(%rax), %eax
movq 0x90(%rsp), %rcx
cmpq %rcx, 0x98(%rsp)
je 0x2ba2d
movq %rcx, 0x98(%rsp)
subl %r15d, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x48(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x2ba71
jp 0x2ba71
movq 0xe0(%rsp), %rax
cmpl %r13d, %eax
jle 0x2ba77
leaq 0xc16a(%rip), %rdi      # 0x37bcf
callq 0x7560
xorl %eax, %eax
jmp 0x2bebf
movl %ebp, 0x58(%rsp)
jmp 0x2ba85
movl %ebp, 0x58(%rsp)
incl %eax
movq %rax, 0xe0(%rsp)
leaq 0x1d930(%rip), %rax     # 0x493bc
cmpl $0x0, (%rax)
jle 0x2baf9
xorl %ebp, %ebp
cmpl $0x0, 0x64(%rsp)
jne 0x2baec
movl $0x10, %edi
callq 0x7380
movq %rax, %rbx
movq %rax, %rdi
movsd 0x40(%rsp), %xmm0
callq 0xd030
movq %rbx, 0x20(%rsp)
movq 0x98(%rsp), %rsi
cmpq 0xa0(%rsp), %rsi
je 0x2bada
movq %rbx, (%rsi)
addq $0x8, 0x98(%rsp)
jmp 0x2baec
leaq 0x90(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x1ce18
incl %ebp
leaq 0x1d8c7(%rip), %rax     # 0x493bc
cmpl (%rax), %ebp
jl 0x2ba93
leaq 0xbf3d(%rip), %rdi      # 0x37a3d
movsd 0x40(%rsp), %xmm0
movb $0x1, %al
callq 0x7060
cmpl $0x0, 0x68(%rsp)
jle 0x2be3d
cmpl $0x0, 0xd8(%rsp)
setle %al
movsd 0x40(%rsp), %xmm0
mulsd 0xb547(%rip), %xmm0     # 0x37078
movsd %xmm0, 0x48(%rsp)
movq 0x50(%rsp), %rcx
orb %al, %cl
movq %rcx, 0x50(%rsp)
xorl %ebp, %ebp
movq 0x10(%rsp), %rcx
cmpl 0x2c(%rcx), %r15d
jge 0x2be31
movq 0x68(%rcx), %rax
subq 0x60(%rcx), %rax
sarq $0x3, %rax
cmpq %rax, 0x110(%rsp)
jae 0x2be31
movq 0x68(%rsp), %rdi
callq 0x29a86
movl %eax, 0x70(%rsp)
movq 0xb8(%rsp), %rcx
movq %r12, %rax
testq %rcx, %rcx
je 0x2bbaa
movl 0x70(%rsp), %edx
movq %r12, %rax
xorl %esi, %esi
cmpl %edx, 0x20(%rcx)
setl %sil
cmovgeq %rcx, %rax
movq 0x10(%rcx,%rsi,8), %rcx
testq %rcx, %rcx
jne 0x2bb93
movq %r12, %rcx
cmpq %r12, %rax
je 0x2bbc0
movl 0x70(%rsp), %ecx
cmpl 0x20(%rax), %ecx
cmovlq %r12, %rax
movq %rax, %rcx
movb $0x1, %bl
cmpq %r12, %rcx
je 0x2bc3f
movq 0xf8(%rsp), %rcx
movq %r14, %rax
testq %rcx, %rcx
je 0x2bbf5
movl 0x70(%rsp), %edx
movq %r14, %rax
xorl %esi, %esi
cmpl %edx, 0x20(%rcx)
setl %sil
cmovgeq %rcx, %rax
movq 0x10(%rcx,%rsi,8), %rcx
testq %rcx, %rcx
jne 0x2bbde
movq %r14, %rcx
cmpq %r14, %rax
je 0x2bc0b
movl 0x70(%rsp), %ecx
cmpl 0x20(%rax), %ecx
cmovlq %r14, %rax
movq %rax, %rcx
cmpq %r14, %rcx
jne 0x2bc3f
movq 0x68(%rsp), %rdi
callq 0x29a86
movl %eax, 0x70(%rsp)
movq 0x10(%rsp), %rcx
movq 0x68(%rcx), %rax
subq 0x60(%rcx), %rax
sarq $0x3, %rax
cmpq %rax, 0x110(%rsp)
jb 0x2bb7c
xorl %ebx, %ebx
testb %bl, %bl
je 0x2be31
leaq 0xa8(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x202a6
testb %bl, %bl
je 0x2be31
movslq 0x70(%rsp), %rsi
movq 0x10(%rsp), %rcx
movq 0x60(%rcx), %rax
movq 0x68(%rcx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rsi, %rdx
jbe 0x2c0e9
movq (%rax,%rsi,8), %rbx
movq %rbx, %rdi
callq 0x25cc8
testl %eax, %eax
je 0x2bdfa
testb $0x1, 0x50(%rsp)
jne 0x2bcf2
movl 0xd8(%rsp), %r13d
movq 0x10(%rsp), %rax
movq 0x50(%rax), %rdi
subq 0x48(%rax), %rdi
shrq $0x3, %rdi
callq 0x29a86
movslq %eax, %rsi
movq 0x10(%rsp), %rcx
movq 0x48(%rcx), %rax
movq 0x50(%rcx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rsi, %rdx
jbe 0x2c0db
movq (%rax,%rsi,8), %rsi
movzbl 0xb(%rsp), %edx
movq %rbx, %rdi
callq 0x2441e
decl %r13d
jne 0x2bca6
xorpd %xmm0, %xmm0
movapd %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
xorps %xmm2, %xmm2
movsd 0x40(%rsp), %xmm0
movsd 0x48(%rsp), %xmm1
movsd 0xbb7c(%rip), %xmm3     # 0x37898
callq 0x299dc
callq 0x29ad4
cmpl $0x0, 0x64(%rsp)
jne 0x2bd3d
movq 0x90(%rsp), %rax
movq (%rax), %rdi
movq (%rdi), %rax
callq *(%rax)
cvttsd2si %xmm0, %edx
testl %edx, %edx
je 0x2bdf0
movzbl 0xa(%rsp), %ecx
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0x25ccc
movq %rbx, %rdi
callq 0x25cc8
testl %eax, %eax
jne 0x2bd79
leaq 0xe8(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x202a6
movq 0x20(%rsp), %rbx
cmpq 0x28(%rsp), %rbx
je 0x2bdf0
movl 0x88(%rsp), %r13d
movq 0x10(%rsp), %rax
cmpl 0x2c(%rax), %r15d
jge 0x2be0e
movq (%rbx), %rdi
callq 0x2361c
testl %eax, %eax
je 0x2bdb2
movq 0x10(%rsp), %rax
movq 0xb0(%rax), %rdi
jmp 0x2bdbe
movq 0x10(%rsp), %rax
movq 0xa8(%rax), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x2bdd8
addq $0x8, %rdi
movq (%rbx), %rax
movq %rax, (%rsi)
addq $0x8, (%rdi)
jmp 0x2bde0
movq %rbx, %rdx
callq 0x275b2
incl %r15d
addq $0x8, %rbx
cmpq 0x28(%rsp), %rbx
jne 0x2bd8d
jmp 0x2be1a
movl 0x88(%rsp), %r13d
jmp 0x2be1a
leaq 0xe8(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x202a6
jmp 0x2be31
leaq 0xbd90(%rip), %rdi      # 0x37ba5
callq 0x7560
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2be31
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
incl %ebp
cmpl 0x68(%rsp), %ebp
jne 0x2bb45
leaq 0x1d578(%rip), %rax     # 0x493bc
cmpl $0x0, (%rax)
jle 0x2bea6
xorl %ebx, %ebx
movl 0x58(%rsp), %ebp
cmpl $0x0, 0x64(%rsp)
jne 0x2be7d
movq 0x90(%rsp), %rax
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x2be6d
movq (%rdi), %rax
callq *0x20(%rax)
movq 0x90(%rsp), %rax
movq $0x0, (%rax,%rbx,8)
incq %rbx
leaq 0x1d535(%rip), %rax     # 0x493bc
movslq (%rax), %rax
cmpq %rax, %rbx
jl 0x2be4f
movb $0x1, %al
movq %rax, 0x50(%rsp)
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movb $0x1, %al
jmp 0x2bebf
movb $0x1, %al
movq %rax, 0x50(%rsp)
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movb $0x1, %al
movl 0x58(%rsp), %ebp
testb %al, %al
je 0x2bf23
cmpl %r13d, %ebp
jge 0x2bf23
movq 0x10(%rsp), %rax
cmpl 0x2c(%rax), %r15d
jge 0x2bf23
movq 0x10(%rsp), %rcx
movq 0x68(%rcx), %rax
subq 0x60(%rcx), %rax
incl %ebp
sarq $0x3, %rax
cmpq %rax, 0x110(%rsp)
jb 0x2b9e4
jmp 0x2bf23
movq (%r15), %rsi
leaq 0xba0c(%rip), %rdi      # 0x3790c
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x7060
movb $0x1, 0x40(%r15)
jmp 0x2bf65
movb $0x1, 0x40(%r15)
jmp 0x2bf63
leaq 0xbccb(%rip), %rdi      # 0x37be9
callq 0x7560
movq 0x10(%rsp), %rax
movb $0x1, 0x40(%rax)
leaq 0xe8(%rsp), %rdi
callq 0x2e8dc
leaq 0xa8(%rsp), %rdi
callq 0x2e8dc
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x2bf63
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
movb $0x1, %bl
leaq 0x268(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2bf86
movq 0x268(%rsp), %rsi
incq %rsi
callq 0x7390
movl %ebx, %eax
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x7180
movq %rax, %r14
movl $0x1, %edi
callq 0x7380
movq %rax, %rbx
leaq 0xaf5a(%rip), %rsi      # 0x36f15
movq %rax, %rdi
callq 0xb4d0
jmp 0x2c04d
movl $0x8, %edi
callq 0x7180
movq %rax, %r14
movl $0x1, %edi
callq 0x7380
movq %rax, %rbx
leaq 0xb9a7(%rip), %rsi      # 0x37990
movq %rax, %rdi
callq 0xb4d0
jmp 0x2c08a
movl $0x8, %edi
callq 0x7180
movq %rax, %r14
movl $0x1, %edi
callq 0x7380
movq %rax, %rbx
leaq 0xb9c0(%rip), %rsi      # 0x379d7
movq %rax, %rdi
callq 0xb4d0
jmp 0x2c0c7
movl $0x8, %edi
callq 0x7180
movq %rax, %r14
movl $0x1, %edi
callq 0x7380
movq %rax, %rbx
leaq 0xb911(%rip), %rsi      # 0x37956
movq %rax, %rdi
callq 0xb4d0
movq %rbx, (%r14)
leaq 0x1cc61(%rip), %rsi     # 0x48cb8
movq %r14, %rdi
xorl %edx, %edx
callq 0x7660
movl $0x8, %edi
callq 0x7180
movq %rax, %r14
movl $0x1, %edi
callq 0x7380
movq %rax, %rbx
leaq 0xb8d4(%rip), %rsi      # 0x37956
movq %rax, %rdi
callq 0xb4d0
movq %rbx, (%r14)
leaq 0x1cc24(%rip), %rsi     # 0x48cb8
movq %r14, %rdi
xorl %edx, %edx
callq 0x7660
movl $0x8, %edi
callq 0x7180
movq %rax, %r14
movl $0x1, %edi
callq 0x7380
movq %rax, %rbx
leaq 0xb897(%rip), %rsi      # 0x37956
movq %rax, %rdi
callq 0xb4d0
movq %rbx, (%r14)
leaq 0x1cbe7(%rip), %rsi     # 0x48cb8
movq %r14, %rdi
xorl %edx, %edx
callq 0x7660
leaq 0xab3f(%rip), %rdi      # 0x36c21
xorl %eax, %eax
callq 0x7530
leaq 0xab31(%rip), %rdi      # 0x36c21
xorl %eax, %eax
callq 0x7530
movq %rax, %r15
movq 0x198(%rsp), %rdi
cmpq %rbx, %rdi
je 0x2c265
movq 0x1a8(%rsp), %rsi
incq %rsi
jmp 0x2c23d
jmp 0x2c262
movq %rax, %r15
movq 0x1b8(%rsp), %rdi
cmpq %r14, %rdi
je 0x2c381
movq 0x1c8(%rsp), %rsi
jmp 0x2c182
jmp 0x2c252
movq %rax, %r15
movq 0x1d8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2c381
movq 0x1e8(%rsp), %rsi
jmp 0x2c182
jmp 0x2c252
movq %rax, %r15
movq 0x1f8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2c381
movq 0x208(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x2c381
jmp 0x2c252
jmp 0x2c252
movq %rax, %r15
movq 0x218(%rsp), %rdi
cmpq %r12, %rdi
je 0x2c39e
movq 0x228(%rsp), %rsi
incq %rsi
jmp 0x2c399
movq %rax, %r15
jmp 0x2c39e
movq %rax, %r15
movq 0x238(%rsp), %rdi
cmpq %r14, %rdi
je 0x2c3bf
movq 0x248(%rsp), %rsi
jmp 0x2c3b7
movq %rax, %r15
jmp 0x2c3bf
movq %rax, %r15
movq 0x278(%rsp), %rdi
cmpq %r12, %rdi
je 0x2c3bf
movq 0x288(%rsp), %rsi
jmp 0x2c3b7
jmp 0x2c262
jmp 0x2c262
jmp 0x2c21b
jmp 0x2c262
jmp 0x2c252
jmp 0x2c262
movq %rax, %r15
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2c265
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
jmp 0x2c23d
movq %rax, %r15
movl $0x10, %esi
movq %rbx, %rdi
callq 0x7390
jmp 0x2c265
jmp 0x2c262
jmp 0x2c262
jmp 0x2c262
movq %rax, %r15
jmp 0x2c36a
movq %rax, %r15
jmp 0x2c381
movq %rax, %r15
jmp 0x2c377
movq %rax, %r15
leaq 0xe8(%rsp), %rdi
callq 0x2e8dc
leaq 0xa8(%rsp), %rdi
callq 0x2e8dc
jmp 0x2c381
jmp 0x2c28e
jmp 0x2c28e
jmp 0x2c28e
jmp 0x2c28e
jmp 0x2c28e
movq %rax, %r15
movl $0x1, %esi
movq %rbx, %rdi
callq 0x7390
jmp 0x2c2b3
jmp 0x2c2b0
jmp 0x2c2b0
jmp 0x2c2b0
jmp 0x2c310
jmp 0x2c310
jmp 0x2c310
jmp 0x2c2b0
jmp 0x2c2b0
movq %rax, %r15
movq %r14, %rdi
callq 0x72a0
jmp 0x2c313
jmp 0x2c2d9
jmp 0x2c2de
jmp 0x2c310
jmp 0x2c2e9
jmp 0x2c2e9
jmp 0x2c310
jmp 0x2c310
jmp 0x2c2de
jmp 0x2c2d9
jmp 0x2c310
jmp 0x2c310
jmp 0x2c2e9
jmp 0x2c310
jmp 0x2c2e9
movq %rax, %r15
jmp 0x2c35d
movq %rax, %r15
jmp 0x2c338
jmp 0x2c2e9
jmp 0x2c310
jmp 0x2c310
movq %rax, %r15
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x2c313
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x2c313
jmp 0x2c310
jmp 0x2c310
jmp 0x2c310
movq %rax, %r15
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x2c338
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x2c35d
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x168(%rsp), %rdi
callq 0x1a61a
leaq 0x180(%rsp), %rdi
callq 0x1a61a
leaq 0x70(%rsp), %rdi
callq 0x1a61a
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x2c39e
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x7390
leaq 0x268(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2c3bf
movq 0x268(%rsp), %rsi
incq %rsi
callq 0x7390
movq %r15, %rdi
callq 0x76a0
nop