// File: /workspace/github_cpp_makefile_star2_O1/richardposner[P]BioNetFit2/src/code/Swarm.cpp
// Function: Swarm::mutateParticleDE(unsigned int, float)
vector<double> Swarm::mutateParticleDE(unsigned int particle, float mutateFactor) {

	if (options.verbosity >= 3) {
		cout << "Mutating particle " << particle << endl;
	}

	int parID = 0;
	vector<double> mutatedParams;
	unsigned int currIsland = 0;
	unsigned int particlesPerIsland = 0;

	if (options.fitType == "de") {
		currIsland = particleToIsland_[particle]; //Raquel changed, was .at(particle)
		particlesPerIsland = options.swarmSize / options.numIslands;
	}

	// f between 0.1 and 0.9
	//float f = 0.1 + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(0.9-0.1)));
	float f;
	if (mutateFactor) {
		f = mutateFactor;
	}
	else {
		f = 0.9;
	}

	boost::random::uniform_int_distribution<int> unif(0, particlesPerIsland - 1);
	if(options.verbosity>=3){
		cout << "done setting uniform_int_distribution" << endl;
	}
	//Raquel: adding support to use constraints when selecting the best particles in DE
	if (options.mutateType == 1) {
		int bestParticle = 0;

		if(options.constraints_.size()>0){//If the user provided any constraint
			//use the combined rank between fit values and constraint values to select the best particle
			//The ranks are sorted from the best fit to the worst fit values, so the loop will stop at the first particle that it finds, with the best fit as possible per iland
			for (auto fitVal = subParRankFinal.begin(); fitVal != subParRankFinal.end(); ++fitVal) {
				//cout << "Raquel setting particle to island value" << endl;

				parID = fcalcParID(fitVal->first, options.models.size());

				if (fitVal->second > 0 && particleToIsland_[parID] == currIsland) {
					//cout << "Raquel setting particle to island value done" << endl;

					bestParticle = fitVal->second;
					//cout << "setting particle " << fitVal->second << " as best with fit of " << fitVal -> first << endl;
					break;
				}

			}


		}else{

			for (auto fitVal = particleBestFitsByFit_.begin(); fitVal != particleBestFitsByFit_.end(); ++fitVal) {
				if(options.verbosity>=4){
					cout << "Raquel setting particle to island value" << endl;
				}
				if (fitVal->first > 0 && particleToIsland_[fitVal->second] == currIsland) {
					if(options.verbosity>=4){
						cout << "Raquel setting particle to island value done" << endl;
					}
					bestParticle = fitVal->second;
					if(options.verbosity>=4){
						cout << "setting particle " << fitVal->second << " as best with fit of " << fitVal -> first << endl;
					}
					break;
				}

			}


		}



		vector<double> bestParamSet = particleCurrParamSets_.at(bestParticle);
		unsigned int pi = 0;
		for (auto param = this->getFreeParams_().begin(); param != this->getFreeParams_().end(); ++param) { //for (auto param = options.model->getFreeParams_().begin(); param != options.model->getFreeParams_().end(); ++param) {
			int p1 = 0;
			int p2 = 0;

			while (p1 == p2) {
				p1 = unif(generalRand);
				p2 = unif(generalRand);
			}

			double p1Param = particleCurrParamSets_.at(islandToParticle_.at(currIsland)[p1])[pi];
			double p2Param = particleCurrParamSets_.at(islandToParticle_.at(currIsland)[p2])[pi];

			mutatedParams.push_back(bestParamSet[pi] + f * (p1Param - p2Param));
			++pi;
		}
	}
	else if (options.mutateType == 2) {
		unsigned int pi = 0;
		int bestParticle = 0;
		//for (auto fitVal = particleBestFitsByFit_.begin(); fitVal != particleBestFitsByFit_.end(); ++fitVal) {
		//	if (fitVal->first > 0 && particleToIsland_.at(fitVal->second) == currIsland) {
		//		bestParticle = fitVal->second;
		//	}
		//}
		if(options.constraints_.size()>0){//If the user provided any constraint
					//use the combined rank between fit values and constraint values to select the best particle
					//mutate type 2 will take the worst particle for the current island and mutate it
					for (auto fitVal = subParRankFinal.begin(); fitVal != subParRankFinal.end(); ++fitVal) {
						if(options.verbosity>=4){
							cout << "Raquel setting particle to island value" << endl;
						}
						parID = fcalcParID(fitVal->first, options.models.size());

						if (fitVal->second > 0 && particleToIsland_.at(parID) == currIsland) {
							if(options.verbosity>=4){
								cout << "Raquel setting particle to island value done" << endl;
							}
							bestParticle = fitVal->second;
							//cout << "setting particle " << fitVal->second << " as best with fit of " << fitVal -> first << endl;
							//break;
						}

					}


				}else{


					for (auto fitVal = particleBestFitsByFit_.begin(); fitVal != particleBestFitsByFit_.end(); ++fitVal) {
						//cout << "Raquel setting particle to island value" << endl;
						if (fitVal->first > 0 && particleToIsland_[fitVal->second] == currIsland) {
							//cout << "Raquel setting particle to island value done" << endl;

							bestParticle = fitVal->second;
							//cout << "setting particle " << fitVal->second << " as best with fit of " << fitVal -> first << endl;
							//break;
						}

					}


				}


		vector<double> bestParamSet = particleCurrParamSets_[bestParticle];
		for (auto param = this->getFreeParams_().begin(); param != this->getFreeParams_().end(); ++param) {//for (auto param = options.model->getFreeParams_().begin(); param != options.model->getFreeParams_().end(); ++param) {
			int p1 = 0;
			int p2 = 0;
			int p3 = 0;
			int p4 = 0;
			while (p1 == p2 || p1 == p3 || p1 == p4 || p2 == p3 || p2 == p4 || p3 == p4) {
				p1 = unif(generalRand);
				p2 = unif(generalRand);
				p3 = unif(generalRand);
				p4 = unif(generalRand);
			}

			double p1Param = particleCurrParamSets_[islandToParticle_[currIsland][p1]][pi];
			double p2Param = particleCurrParamSets_[islandToParticle_[currIsland][p2]][pi];
			double p3Param = particleCurrParamSets_[islandToParticle_[currIsland][p3]][pi];
			double p4Param = particleCurrParamSets_[islandToParticle_[currIsland][p4]][pi];

			mutatedParams.push_back(bestParamSet[pi] + f * (p1Param - p2Param) + f * (p3Param - p4Param));
			++pi;
		}
	}
	else if (options.mutateType == 3) {
		unsigned int pi = 0;
		int bestParticle = 0;
		//for (auto fitVal = particleBestFitsByFit_.begin(); fitVal != particleBestFitsByFit_.end(); ++fitVal) {
		//	if (fitVal->first > 0 && particleToIsland_.at(fitVal->second) == currIsland) {
		//		bestParticle = fitVal->second;
		//	}
		//}

		if(options.constraints_.size()>0){//If the user provided any constraint
					//use the combined rank between fit values and constraint values to select the best particle
					//mutate type 3 will take the worst particle for the current island and mutate it
					for (auto fitVal = subParRankFinal.begin(); fitVal != subParRankFinal.end(); ++fitVal) {
						if(options.verbosity>=4){
							cout << "Raquel setting particle to island value" << endl;
						}
						parID = fcalcParID(fitVal->first, options.models.size());

						if (fitVal->second > 0 && particleToIsland_[parID] == currIsland) {
							if(options.verbosity>=4){
								cout << "Raquel setting particle to island value done" << endl;
							}
							bestParticle = fitVal->second;
							//cout << "setting particle " << fitVal->second << " as best with fit of " << fitVal -> first << endl;
							//break;
						}

					}


				}else{


					for (auto fitVal = particleBestFitsByFit_.begin(); fitVal != particleBestFitsByFit_.end(); ++fitVal) {
						//cout << "Raquel setting particle to island value" << endl;
						if (fitVal->first > 0 && particleToIsland_[fitVal->second] == currIsland) {
							//cout << "Raquel setting particle to island value done" << endl;

							bestParticle = fitVal->second;
							//cout << "setting particle " << fitVal->second << " as best with fit of " << fitVal -> first << endl;
							//break;
						}

					}


				}


		vector<double> bestParamSet = particleCurrParamSets_[bestParticle];
		for (auto param = this->getFreeParams_().begin(); param != this->getFreeParams_().end(); ++param) { //for (auto param = options.model->getFreeParams_().begin(); param != options.model->getFreeParams_().end(); ++param) {
			int p1 = 0;
			int p2 = 0;
			int p3 = 0;
			while (p1 == p2 || p1 == p3 || p2 == p3) {
				p1 = unif(generalRand);
				p2 = unif(generalRand);
				p3 = unif(generalRand);
			}

			double p1Param = particleCurrParamSets_.at(islandToParticle_.at(currIsland)[p1])[pi];
			double p2Param = particleCurrParamSets_.at(islandToParticle_.at(currIsland)[p2])[pi];
			double p3Param = particleCurrParamSets_.at(islandToParticle_.at(currIsland)[p3])[pi];

			mutatedParams.push_back(p1Param + f * (p2Param - p3Param));
			++pi;
		}
	}
	else if (options.mutateType == 4) {
		unsigned int pi = 0;
		int bestParticle = 0;
		//for (auto fitVal = particleBestFitsByFit_.begin(); fitVal != particleBestFitsByFit_.end(); ++fitVal) {
		//	if (fitVal->first > 0 && particleToIsland_.at(fitVal->second) == currIsland) {
		//		bestParticle = fitVal->second;
		//	}
		//}

		if(options.constraints_.size()>0){//If the user provided any constraint
					//use the combined rank between fit values and constraint values to select the best particle
					//mutate type 4 will take the worst particle for the current island and mutate it
					for (auto fitVal = subParRankFinal.begin(); fitVal != subParRankFinal.end(); ++fitVal) {
						if(options.verbosity>=4){
							cout << "Raquel setting particle to island value" << endl;
						}
						parID = fcalcParID(fitVal->first, options.models.size());

						if (fitVal->second > 0 && particleToIsland_[parID] == currIsland) {
							if(options.verbosity>=4){
								cout << "Raquel setting particle to island value done" << endl;
							}
							bestParticle = fitVal->second;
							//cout << "setting particle " << fitVal->second << " as best with fit of " << fitVal -> first << endl;
							//break;
						}

					}


				}else{


					for (auto fitVal = particleBestFitsByFit_.begin(); fitVal != particleBestFitsByFit_.end(); ++fitVal) {
						//cout << "Raquel setting particle to island value" << endl;
						if (fitVal->first > 0 && particleToIsland_[fitVal->second] == currIsland) {
							//cout << "Raquel setting particle to island value done" << endl;

							bestParticle = fitVal->second;
							//cout << "setting particle " << fitVal->second << " as best with fit of " << fitVal -> first << endl;
							//break;
						}

					}


				}



		vector<double> bestParamSet = particleCurrParamSets_[bestParticle];
		for (auto param = this->getFreeParams_().begin(); param != this->getFreeParams_().end(); ++param) {//for (auto param = options.model->getFreeParams_().begin(); param != options.model->getFreeParams_().end(); ++param) {
			int p1 = 0;
			int p2 = 0;
			int p3 = 0;
			int p4 = 0;
			int p5 = 0;
			// This (and above instances) should be optimized
			while (p1 == p2 || p1 == p3 || p1 == p4 || p2 == p3 || p2 == p4 || p3 == p4 || p1 == p5 || p2 == p5 || p3 == p5 || p4 == p5) {
				p1 = unif(generalRand);
				p2 = unif(generalRand);
				p3 = unif(generalRand);
				p4 = unif(generalRand);
				p5 = unif(generalRand);
			}

			double p1Param = particleCurrParamSets_[islandToParticle_[currIsland][p1]][pi];
			double p2Param = particleCurrParamSets_[islandToParticle_[currIsland][p2]][pi];
			double p3Param = particleCurrParamSets_[islandToParticle_[currIsland][p3]][pi];
			double p4Param = particleCurrParamSets_[islandToParticle_[currIsland][p4]][pi];
			double p5Param = particleCurrParamSets_[islandToParticle_[currIsland][p5]][pi];

			mutatedParams.push_back(p1Param + f * (p2Param - p3Param) + f * (p4Param - p5Param));
			++pi;
		}
	}

	return mutatedParams;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movss %xmm0, 0x8(%rsp)
movl %edx, %ebx
movq %rsi, %r12
movq %rdi, %r15
cmpl $0x3, 0x1614(%rsi)
jb 0xa0dff
movq 0xd51d9(%rip), %r14     # 0x175f90
leaq 0x609e8(%rip), %rsi     # 0x1017a6
movl $0x12, %edx
movq %r14, %rdi
callq 0x22ab0
movl %ebx, %esi
movq %r14, %rdi
callq 0x22650
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r14, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
movq %r15, 0x10(%rsp)
movq $0x0, 0x10(%r15)
leaq 0x14e0(%r12), %rdi
leaq 0x8d0f9(%rip), %rsi     # 0x12df1b
callq 0x22250
testl %eax, %eax
je 0xa0e37
xorl %ebp, %ebp
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0xa0e5c
movl %ebx, %eax
movq 0x1d20(%r12), %rcx
movl (%rcx,%rax,4), %ebp
movl 0x1620(%r12), %eax
xorl %edx, %edx
divl 0x16fc(%r12)
decl %eax
movl %eax, 0x24(%rsp)
xorps %xmm0, %xmm0
movss 0x8(%rsp), %xmm1
ucomiss %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
movsd %xmm0, 0x70(%rsp)
jne 0xa0e87
jp 0xa0e87
movsd 0x5d137(%rip), %xmm0    # 0xfdfb8
movsd %xmm0, 0x70(%rsp)
cmpl $0x0, 0x24(%rsp)
js 0xa1e4f
cmpl $0x3, 0x1614(%r12)
jb 0xa0ee3
movq 0xd50ec(%rip), %rbx     # 0x175f90
leaq 0x6090e(%rip), %rsi     # 0x1017b9
movl $0x25, %edx
movq %rbx, %rdi
callq 0x22ab0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq 0xd50ba(%rip), %rdi     # 0x175f90
callq 0x22050
movq %rax, %rdi
callq 0x22660
movl 0x1700(%r12), %eax
decl %eax
cmpl $0x3, %eax
ja 0xa1dcb
leaq 0x5d11b(%rip), %rcx     # 0xfe018
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
movq %r12, 0x8(%rsp)
jmpq *%rax
cmpq $0x0, 0x1608(%r12)
je 0xa184e
movq 0x18f0(%r12), %rbx
movq %r12, %rax
xorl %r12d, %r12d
cmpq 0x18f8(%rax), %rbx
je 0xa1c1f
movq 0x8(%rsp), %rax
movl (%rbx), %edi
movq 0x15c8(%rax), %rsi
subq 0x15c0(%rax), %rsi
shrq $0x3, %rsi
callq 0xbf2b8
movss 0x4(%rbx), %xmm0
ucomiss 0x5cddd(%rip), %xmm0    # 0xfdd3c
jbe 0xa0f78
cltq
movq 0x8(%rsp), %rcx
movq 0x1d20(%rcx), %rcx
cmpl %ebp, (%rcx,%rax,4)
je 0xa1b7e
addq $0x8, %rbx
movq 0x8(%rsp), %rax
cmpq 0x18f8(%rax), %rbx
jne 0xa0f3a
jmp 0xa1c1f
cmpq $0x0, 0x1608(%r12)
je 0xa1318
movq 0x18f0(%r12), %r14
cmpq 0x18f8(%r12), %r14
je 0xa1361
xorl %r13d, %r13d
movq 0xd4fd2(%rip), %rbx     # 0x175f90
leaq 0x6081a(%rip), %r15     # 0x1017df
leaq 0x6083b(%rip), %r12     # 0x101807
movq 0x8(%rsp), %rax
cmpl $0x4, 0x1614(%rax)
jb 0xa1011
movl $0x27, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x22ab0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %rbx, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movl (%r14), %edi
movq 0x8(%rsp), %rax
movq 0x15c8(%rax), %rsi
subq 0x15c0(%rax), %rsi
shrq $0x3, %rsi
callq 0xbf2b8
movss 0x4(%r14), %xmm0
ucomiss 0x5ccff(%rip), %xmm0    # 0xfdd3c
jbe 0xa1098
cltq
movq 0x8(%rsp), %rdx
movq 0x1d20(%rdx), %rcx
cmpl %ebp, (%rcx,%rax,4)
jne 0xa109d
cmpl $0x4, 0x1614(%rdx)
jb 0xa1092
movl $0x2c, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x22ab0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %rbx, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
cvttss2si 0x4(%r14), %r13d
movq 0x8(%rsp), %rdx
addq $0x8, %r14
cmpq 0x18f8(%rdx), %r14
jne 0xa0fcc
jmp 0xa1364
cmpq $0x0, 0x1608(%r12)
je 0xa157e
movq 0x18f0(%r12), %r14
cmpq 0x18f8(%r12), %r14
je 0xa15c7
xorl %r13d, %r13d
movq 0xd4eae(%rip), %rbx     # 0x175f90
leaq 0x606f6(%rip), %r15     # 0x1017df
leaq 0x60717(%rip), %r12     # 0x101807
movq 0x8(%rsp), %rax
cmpl $0x4, 0x1614(%rax)
jb 0xa1135
movl $0x27, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x22ab0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %rbx, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movl (%r14), %edi
movq 0x8(%rsp), %rax
movq 0x15c8(%rax), %rsi
subq 0x15c0(%rax), %rsi
shrq $0x3, %rsi
callq 0xbf2b8
movss 0x4(%r14), %xmm0
ucomiss 0x5cbdb(%rip), %xmm0    # 0xfdd3c
jbe 0xa11bc
cltq
movq 0x8(%rsp), %rdx
movq 0x1d20(%rdx), %rcx
cmpl %ebp, (%rcx,%rax,4)
jne 0xa11c1
cmpl $0x4, 0x1614(%rdx)
jb 0xa11b6
movl $0x2c, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x22ab0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %rbx, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
cvttss2si 0x4(%r14), %r13d
movq 0x8(%rsp), %rdx
addq $0x8, %r14
cmpq 0x18f8(%rdx), %r14
jne 0xa10f0
jmp 0xa15ca
cmpq $0x0, 0x1608(%r12)
je 0xa18f9
movq 0x18f0(%r12), %r14
cmpq 0x18f8(%r12), %r14
je 0xa1942
xorl %r13d, %r13d
movq 0xd4d8a(%rip), %rbx     # 0x175f90
leaq 0x605d2(%rip), %r15     # 0x1017df
leaq 0x605f3(%rip), %r12     # 0x101807
movq 0x8(%rsp), %rax
cmpl $0x4, 0x1614(%rax)
jb 0xa1259
movl $0x27, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x22ab0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %rbx, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movl (%r14), %edi
movq 0x8(%rsp), %rax
movq 0x15c8(%rax), %rsi
subq 0x15c0(%rax), %rsi
shrq $0x3, %rsi
callq 0xbf2b8
movss 0x4(%r14), %xmm0
ucomiss 0x5cab7(%rip), %xmm0    # 0xfdd3c
jbe 0xa12fd
movslq %eax, %rsi
movq 0x8(%rsp), %rcx
movq 0x1d20(%rcx), %rax
movq 0x1d28(%rcx), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rsi, %rdx
jbe 0xa1e41
cmpl %ebp, (%rax,%rsi,4)
jne 0xa12fd
movq 0x8(%rsp), %rax
cmpl $0x4, 0x1614(%rax)
jb 0xa12f7
movl $0x2c, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x22ab0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %rbx, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
cvttss2si 0x4(%r14), %r13d
addq $0x8, %r14
movq 0x8(%rsp), %rax
cmpq 0x18f8(%rax), %r14
jne 0xa1214
jmp 0xa1945
movq 0x1ac8(%r12), %rax
leaq 0x1ab8(%r12), %rbx
cmpq %rbx, %rax
je 0xa1361
movq 0x1d20(%r12), %r14
xorl %r13d, %r13d
movsd 0x20(%rax), %xmm0
ucomisd 0x557f3(%rip), %xmm0    # 0xf6b38
jbe 0xa1352
movl 0x28(%rax), %ecx
cmpl %ebp, (%r14,%rcx,4)
cmovel %ecx, %r13d
movq %rax, %rdi
callq 0x22670
cmpq %rbx, %rax
jne 0xa1338
jmp 0xa1364
xorl %r13d, %r13d
movq 0x8(%rsp), %rbx
leaq 0x1400(%rbx), %rdi
leaq 0x30(%rsp), %rsi
movl %r13d, (%rsi)
movq %rdi, 0x28(%rsp)
callq 0x6f1a2
leaq 0x48(%rsp), %rdi
movq %rax, %rsi
callq 0x66228
movq 0x15a8(%rbx), %r13
leaq 0x1598(%rbx), %rax
movq %rax, 0x60(%rsp)
cmpq %rax, %r13
je 0xa1db4
movq 0x8(%rsp), %rax
leaq 0x58(%rax), %rbx
movl %ebp, %eax
xorl %r12d, %r12d
movq %rax, 0x18(%rsp)
leaq (%rax,%rax,2), %rax
movq %rax, 0x38(%rsp)
xorl %r15d, %r15d
xorl %r14d, %r14d
xorl %ebp, %ebp
cmpl %ebp, %r14d
je 0xa13de
cmpl %r14d, %r15d
je 0xa13de
cmpl %ebp, %r15d
jne 0xa1410
movq %rbx, %rdi
xorl %esi, %esi
movl 0x24(%rsp), %ebp
movl %ebp, %edx
callq 0xbc645
movl %eax, %r15d
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0xbc645
movl %eax, %r14d
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0xbc645
movl %eax, %ebp
jmp 0xa13cf
movq 0x8(%rsp), %rcx
movq 0x1d38(%rcx), %rax
movq 0x1d40(%rcx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq 0x18(%rsp), %rdx
jbe 0xa1e2e
movslq %r15d, %rsi
shlq $0x2, %rsi
movq 0x38(%rsp), %rcx
addq (%rax,%rcx,8), %rsi
movq 0x28(%rsp), %rdi
callq 0xa837c
movq 0x8(%rsp), %rdx
movq 0x1d38(%rdx), %rcx
movq 0x1d40(%rdx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rdx
cmpq 0x18(%rsp), %rdx
jbe 0xa1e1b
movl %r12d, %r15d
movq (%rax), %rax
movsd (%rax,%r15,8), %xmm0
movsd %xmm0, 0x40(%rsp)
movslq %r14d, %rsi
shlq $0x2, %rsi
movq 0x38(%rsp), %rax
addq (%rcx,%rax,8), %rsi
movq 0x28(%rsp), %rdi
callq 0xa837c
movq 0x8(%rsp), %rdx
movq 0x1d38(%rdx), %rcx
movq 0x1d40(%rdx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rdx
cmpq 0x18(%rsp), %rdx
jbe 0xa1e08
movq (%rax), %rax
movsd (%rax,%r15,8), %xmm0
movsd %xmm0, 0x68(%rsp)
movslq %ebp, %rsi
shlq $0x2, %rsi
movq 0x38(%rsp), %rax
addq (%rcx,%rax,8), %rsi
movq 0x28(%rsp), %rdi
callq 0xa837c
movq (%rax), %rax
movsd 0x68(%rsp), %xmm0
subsd (%rax,%r15,8), %xmm0
mulsd 0x70(%rsp), %xmm0
addsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x10(%rsp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0xa1556
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rdi)
jmp 0xa1560
leaq 0x30(%rsp), %rdx
callq 0x68326
incl %r12d
movq %r13, %rdi
callq 0x22ad0
movq %rax, %r13
cmpq 0x60(%rsp), %rax
jne 0xa13c7
jmp 0xa1db4
movq 0x1ac8(%r12), %rax
leaq 0x1ab8(%r12), %rbx
cmpq %rbx, %rax
je 0xa15c7
movq 0x1d20(%r12), %r14
xorl %r13d, %r13d
movsd 0x20(%rax), %xmm0
ucomisd 0x5558d(%rip), %xmm0    # 0xf6b38
jbe 0xa15b8
movl 0x28(%rax), %ecx
cmpl %ebp, (%r14,%rcx,4)
cmovel %ecx, %r13d
movq %rax, %rdi
callq 0x22670
cmpq %rbx, %rax
jne 0xa159e
jmp 0xa15ca
xorl %r13d, %r13d
movq 0x8(%rsp), %rbx
leaq 0x1400(%rbx), %r15
leaq 0x30(%rsp), %rsi
movl %r13d, (%rsi)
movq %r15, %rdi
callq 0x6f1a2
leaq 0x48(%rsp), %rdi
movq %rax, %rsi
callq 0x66228
movq 0x15a8(%rbx), %rax
leaq 0x1598(%rbx), %rcx
movq %rcx, 0x78(%rsp)
cmpq %rcx, %rax
je 0xa1db4
leaq 0x58(%rbx), %r13
movl %ebp, %ecx
movl $0x0, 0x38(%rsp)
leaq (%rcx,%rcx,2), %r12
movq %r15, 0x90(%rsp)
movq %r12, 0x18(%rsp)
movq %rax, 0x40(%rsp)
xorl %ebp, %ebp
xorl %r12d, %r12d
xorl %r14d, %r14d
xorl %r15d, %r15d
xorl %ebx, %ebx
cmpl %ebx, %r15d
je 0xa1671
cmpl %ebx, %r14d
je 0xa1671
cmpl %ebx, %r12d
je 0xa1671
cmpl %ebx, %ebp
je 0xa1671
cmpl %r15d, %r14d
je 0xa1671
cmpl %r15d, %r12d
je 0xa1671
cmpl %r14d, %r12d
je 0xa1671
cmpl %r12d, %ebp
je 0xa1671
cmpl %r14d, %ebp
je 0xa1671
cmpl %r15d, %ebp
jne 0xa16c0
movq %r13, %rdi
xorl %esi, %esi
movl 0x24(%rsp), %ebx
movl %ebx, %edx
callq 0xbc645
movl %eax, %ebp
movq %r13, %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0xbc645
movl %eax, %r12d
movq %r13, %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0xbc645
movl %eax, %r14d
movq %r13, %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0xbc645
movl %eax, %r15d
movq %r13, %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0xbc645
movl %eax, %ebx
jmp 0xa1640
movq 0x8(%rsp), %rax
movq 0x1d38(%rax), %rax
movslq %ebp, %rsi
shlq $0x2, %rsi
movq 0x18(%rsp), %rcx
addq (%rax,%rcx,8), %rsi
movq 0x90(%rsp), %rbp
movq %rbp, %rdi
callq 0xa873a
movl 0x38(%rsp), %ecx
movq (%rax), %rax
movq %rcx, 0x28(%rsp)
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x68(%rsp)
movq 0x8(%rsp), %rax
movq 0x1d38(%rax), %rax
movslq %r12d, %rsi
shlq $0x2, %rsi
movq 0x18(%rsp), %rcx
addq (%rax,%rcx,8), %rsi
movq %rbp, %rdi
callq 0xa873a
movq (%rax), %rax
movq 0x28(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x60(%rsp)
movq 0x8(%rsp), %rax
movq 0x1d38(%rax), %rax
movslq %r14d, %rsi
shlq $0x2, %rsi
movq 0x18(%rsp), %r12
addq (%rax,%r12,8), %rsi
movq %rbp, %rdi
callq 0xa873a
movq 0x8(%rsp), %r14
movq (%rax), %rax
movq 0x28(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x88(%rsp)
movq 0x1d38(%r14), %rax
movslq %r15d, %rsi
shlq $0x2, %rsi
addq (%rax,%r12,8), %rsi
movq %rbp, %rdi
callq 0xa873a
movq (%rax), %rax
movq 0x28(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x80(%rsp)
movq 0x1d38(%r14), %rax
movslq %ebx, %rsi
shlq $0x2, %rsi
addq (%rax,%r12,8), %rsi
movq %rbp, %rdi
callq 0xa873a
movq (%rax), %rax
movq 0x28(%rsp), %rcx
movsd 0x80(%rsp), %xmm2
subsd (%rax,%rcx,8), %xmm2
movsd 0x60(%rsp), %xmm1
subsd 0x88(%rsp), %xmm1
movsd 0x70(%rsp), %xmm0
mulsd %xmm0, %xmm1
addsd 0x68(%rsp), %xmm1
mulsd %xmm0, %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, 0x30(%rsp)
movq 0x10(%rsp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
movq 0x40(%rsp), %rbx
je 0xa1828
movsd %xmm2, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rdi)
jmp 0xa1832
leaq 0x30(%rsp), %rdx
callq 0x68326
incl 0x38(%rsp)
movq %rbx, %rdi
callq 0x22ad0
cmpq 0x78(%rsp), %rax
jne 0xa162e
jmp 0xa1db4
movq 0x1ac8(%r12), %rbx
leaq 0x1ab8(%r12), %r13
xorl %r12d, %r12d
cmpq %r13, %rbx
je 0xa1c1f
movq 0xd471f(%rip), %r14     # 0x175f90
leaq 0x5ff67(%rip), %r15     # 0x1017df
movq 0x8(%rsp), %rax
cmpl $0x4, 0x1614(%rax)
jb 0xa18bd
movl $0x27, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x22ab0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r14, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movsd 0x20(%rbx), %xmm0
ucomisd 0x5526e(%rip), %xmm0    # 0xf6b38
jbe 0xa18e4
movl 0x28(%rbx), %eax
movq 0x8(%rsp), %rcx
movq 0x1d20(%rcx), %rcx
cmpl %ebp, (%rcx,%rax,4)
je 0xa1b88
movq %rbx, %rdi
callq 0x22670
movq %rax, %rbx
cmpq %r13, %rax
jne 0xa1878
jmp 0xa1c1f
movq 0x1ac8(%r12), %rax
leaq 0x1ab8(%r12), %rbx
cmpq %rbx, %rax
je 0xa1942
movq 0x1d20(%r12), %r14
xorl %r13d, %r13d
movsd 0x20(%rax), %xmm0
ucomisd 0x55212(%rip), %xmm0    # 0xf6b38
jbe 0xa1933
movl 0x28(%rax), %ecx
cmpl %ebp, (%r14,%rcx,4)
cmovel %ecx, %r13d
movq %rax, %rdi
callq 0x22670
cmpq %rbx, %rax
jne 0xa1919
jmp 0xa1945
xorl %r13d, %r13d
movq 0x8(%rsp), %rbx
leaq 0x1400(%rbx), %r14
leaq 0x30(%rsp), %rsi
movl %r13d, (%rsi)
movq %r14, %rdi
callq 0x6f1a2
leaq 0x48(%rsp), %rdi
movq %rax, %rsi
callq 0x66228
movq 0x15a8(%rbx), %rcx
leaq 0x1598(%rbx), %rax
movq %rax, 0x88(%rsp)
cmpq %rax, %rcx
movl 0x24(%rsp), %r12d
je 0xa1db4
movq 0x8(%rsp), %rax
leaq 0x58(%rax), %r13
movl %ebp, %eax
movl $0x0, 0x28(%rsp)
leaq (%rax,%rax,2), %r15
movq %r14, 0x80(%rsp)
movq %r15, 0x78(%rsp)
movq %rcx, 0x18(%rsp)
xorl %r15d, %r15d
xorl %r14d, %r14d
xorl %ebp, %ebp
xorl %ebx, %ebx
cmpl %ebx, %ebp
je 0xa19e2
cmpl %ebx, %r14d
je 0xa19e2
cmpl %ebp, %r14d
je 0xa19e2
cmpl %r14d, %r15d
je 0xa19e2
cmpl %ebp, %r15d
je 0xa19e2
cmpl %ebx, %r15d
jne 0xa1a22
movq %r13, %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0xbc645
movl %eax, %r15d
movq %r13, %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0xbc645
movl %eax, %r14d
movq %r13, %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0xbc645
movl %eax, %ebp
movq %r13, %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0xbc645
movl %eax, %ebx
jmp 0xa19c5
movq 0x8(%rsp), %rax
movq 0x1d38(%rax), %rax
movslq %r15d, %rsi
shlq $0x2, %rsi
movq 0x78(%rsp), %r15
addq (%rax,%r15,8), %rsi
movq 0x80(%rsp), %r12
movq %r12, %rdi
callq 0xa873a
movl 0x28(%rsp), %ecx
movq (%rax), %rax
movq %rcx, 0x38(%rsp)
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x40(%rsp)
movq 0x8(%rsp), %rax
movq 0x1d38(%rax), %rax
movslq %r14d, %rsi
shlq $0x2, %rsi
addq (%rax,%r15,8), %rsi
movq %r12, %rdi
callq 0xa873a
movq %r12, %r14
movq (%rax), %rax
movq 0x38(%rsp), %r12
movsd (%rax,%r12,8), %xmm0
movsd %xmm0, 0x68(%rsp)
movq 0x8(%rsp), %rax
movq 0x1d38(%rax), %rax
movslq %ebp, %rsi
shlq $0x2, %rsi
addq (%rax,%r15,8), %rsi
movq %r14, %rdi
callq 0xa873a
movq (%rax), %rax
movsd (%rax,%r12,8), %xmm0
movsd %xmm0, 0x60(%rsp)
movq 0x8(%rsp), %rax
movq 0x1d38(%rax), %rax
movslq %ebx, %rsi
shlq $0x2, %rsi
addq (%rax,%r15,8), %rsi
movq %r14, %rdi
movq 0x10(%rsp), %rbx
callq 0xa873a
movq (%rax), %rax
movsd 0x60(%rsp), %xmm2
subsd (%rax,%r12,8), %xmm2
movq 0x48(%rsp), %rax
movsd 0x40(%rsp), %xmm1
subsd 0x68(%rsp), %xmm1
movsd 0x70(%rsp), %xmm0
mulsd %xmm0, %xmm1
addsd (%rax,%r12,8), %xmm1
mulsd %xmm0, %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, 0x30(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
movl 0x24(%rsp), %r12d
je 0xa1b4d
movsd %xmm2, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
movq 0x18(%rsp), %rdi
jmp 0xa1b5f
movq %rbx, %rdi
leaq 0x30(%rsp), %rdx
callq 0x68326
movq 0x18(%rsp), %rdi
incl 0x28(%rsp)
callq 0x22ad0
movq %rax, %rcx
cmpq 0x88(%rsp), %rax
jne 0xa19b6
jmp 0xa1db4
cvttss2si %xmm0, %r12d
jmp 0xa1c1f
movq 0x8(%rsp), %rax
cmpl $0x4, 0x1614(%rax)
jb 0xa1bba
movq 0xd43f3(%rip), %rdi     # 0x175f90
leaq 0x5fc63(%rip), %rsi     # 0x101807
movl $0x2c, %edx
callq 0x22ab0
movq 0xd43db(%rip), %rdi     # 0x175f90
callq 0x22430
movl 0x28(%rbx), %r12d
movq 0x8(%rsp), %rax
cmpl $0x4, 0x1614(%rax)
jb 0xa1c1f
movq 0xd43bd(%rip), %rdi     # 0x175f90
leaq 0x5fc5a(%rip), %rsi     # 0x101834
movl $0x11, %edx
callq 0x22ab0
movl 0x28(%rbx), %esi
movq 0xd43a2(%rip), %rdi     # 0x175f90
callq 0x22650
movq %rax, %r14
leaq 0x5fc49(%rip), %rsi     # 0x101846
movl $0x15, %edx
movq %rax, %rdi
callq 0x22ab0
movsd 0x20(%rbx), %xmm0
movq %r14, %rdi
callq 0x23060
movq %rax, %rdi
callq 0x22430
movq 0x8(%rsp), %rax
leaq 0x1400(%rax), %rdi
leaq 0x30(%rsp), %rsi
movl %r12d, (%rsi)
movq %rdi, 0x28(%rsp)
callq 0xa837c
leaq 0x48(%rsp), %rdi
movq %rax, %rsi
callq 0x66228
movq 0x8(%rsp), %rax
movq 0x15a8(%rax), %r12
addq $0x1598, %rax           # imm = 0x1598
movq %rax, 0x40(%rsp)
cmpq %rax, %r12
je 0xa1db4
movq 0x8(%rsp), %rax
leaq 0x58(%rax), %r13
movl %ebp, %eax
xorl %ebx, %ebx
movq %rax, 0x18(%rsp)
leaq (%rax,%rax,2), %r15
xorl %ebp, %ebp
xorl %r14d, %r14d
cmpl %ebp, %r14d
jne 0xa1cad
movq %r13, %rdi
xorl %esi, %esi
movl 0x24(%rsp), %ebp
movl %ebp, %edx
callq 0xbc645
movl %eax, %r14d
movq %r13, %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0xbc645
movl %eax, %ebp
jmp 0xa1c85
movq 0x8(%rsp), %rcx
movq 0x1d38(%rcx), %rax
movq 0x1d40(%rcx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq 0x18(%rsp), %rdx
jbe 0xa1df5
movslq %r14d, %rsi
shlq $0x2, %rsi
addq (%rax,%r15,8), %rsi
movq 0x28(%rsp), %rdi
callq 0xa837c
movq 0x8(%rsp), %rdx
movq 0x1d38(%rdx), %rcx
movq 0x1d40(%rdx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rdx
cmpq 0x18(%rsp), %rdx
jbe 0xa1de2
movl %ebx, %r14d
movq (%rax), %rax
movsd (%rax,%r14,8), %xmm0
movsd %xmm0, 0x38(%rsp)
movslq %ebp, %rsi
shlq $0x2, %rsi
addq (%rcx,%r15,8), %rsi
movq 0x28(%rsp), %rdi
callq 0xa837c
movq (%rax), %rax
movsd 0x38(%rsp), %xmm0
subsd (%rax,%r14,8), %xmm0
movq 0x48(%rsp), %rax
mulsd 0x70(%rsp), %xmm0
addsd (%rax,%r14,8), %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x10(%rsp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0xa1d92
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rdi)
jmp 0xa1d9c
leaq 0x30(%rsp), %rdx
callq 0x68326
incl %ebx
movq %r12, %rdi
callq 0x22ad0
movq %rax, %r12
cmpq 0x40(%rsp), %rax
jne 0xa1c80
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0xa1dcb
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
movq 0x10(%rsp), %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x518dc(%rip), %rdi     # 0xf36c5
movq 0x18(%rsp), %rsi
xorl %eax, %eax
callq 0x22f40
leaq 0x518c9(%rip), %rdi     # 0xf36c5
movq 0x18(%rsp), %rsi
xorl %eax, %eax
callq 0x22f40
leaq 0x518b6(%rip), %rdi     # 0xf36c5
movq 0x18(%rsp), %rsi
xorl %eax, %eax
callq 0x22f40
leaq 0x518a3(%rip), %rdi     # 0xf36c5
movq 0x18(%rsp), %rsi
xorl %eax, %eax
callq 0x22f40
leaq 0x51890(%rip), %rdi     # 0xf36c5
movq 0x18(%rsp), %rsi
xorl %eax, %eax
callq 0x22f40
leaq 0x5187d(%rip), %rdi     # 0xf36c5
xorl %eax, %eax
callq 0x22f40
leaq 0x75112(%rip), %rdi     # 0x116f68
leaq 0x7511e(%rip), %rsi     # 0x116f7b
leaq 0x7514e(%rip), %rcx     # 0x116fb2
movl $0x151, %edx            # imm = 0x151
callq 0x22610
jmp 0xa1eb2
jmp 0xa1eb2
jmp 0xa1eb2
jmp 0xa1eb2
jmp 0xa1eb2
jmp 0xa1eb2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1eb2
jmp 0xa1eb2
jmp 0xa1eb2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1eb2
jmp 0xa1eb2
movq %rax, %r14
movq 0x10(%rsp), %rbx
jmp 0xa1ee1
jmp 0xa1ec2
jmp 0xa1ec2
jmp 0xa1ec2
movq %rax, %r14
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
movq 0x10(%rsp), %rbx
je 0xa1ee1
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
movq (%rbx), %rdi
testq %rdi, %rdi
je 0xa1ef5
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x229c0
movq %r14, %rdi
callq 0x23240
nop