// File: /workspace/github_cpp_makefile_star2_O2/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)
movq %rsi, %r15
movq %rdi, 0x40(%rsp)
cmpl $0x3, 0x1614(%rsi)
movl %edx, %ebx
jb 0x81638
movq 0xe497f(%rip), %rdi     # 0x165f98
leaq 0x5e356(%rip), %rsi     # 0xdf976
callq 0x289f0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x286e0
movq %rax, %rdi
callq 0x284a0
xorps %xmm0, %xmm0
movq 0x40(%rsp), %rax
movups %xmm0, (%rax)
andq $0x0, 0x10(%rax)
leaq 0x14e0(%r15), %rdi
leaq 0x8ae05(%rip), %rsi     # 0x10c45b
callq 0x3357b
testb %al, %al
je 0x8167f
movq 0x1d20(%r15), %rax
movl (%rax,%rbx,4), %ebp
movl 0x1620(%r15), %eax
xorl %edx, %edx
divl 0x16fc(%r15)
movl %eax, %edx
decl %edx
jmp 0x81684
xorl %ebp, %ebp
pushq $-0x1
popq %rdx
movss 0x8(%rsp), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
cvtss2sd %xmm1, %xmm0
movsd %xmm0, 0x58(%rsp)
jne 0x816ac
jp 0x816ac
movsd 0x5aae2(%rip), %xmm0    # 0xdc188
movsd %xmm0, 0x58(%rsp)
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
callq 0x8678c
cmpl $0x3, 0x1614(%r15)
jb 0x816dd
movq 0xe48cf(%rip), %rdi     # 0x165f98
leaq 0x5e2b9(%rip), %rsi     # 0xdf989
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movl 0x1700(%r15), %eax
decl %eax
cmpl $0x3, %eax
ja 0x822d4
leaq 0x5aaf2(%rip), %rcx     # 0xdc1e8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
movq %r15, 0x8(%rsp)
jmpq *%rax
cmpq $0x0, 0x1608(%r15)
je 0x82056
movq 0x18f0(%r15), %rbx
cmpq 0x18f8(%r15), %rbx
je 0x81fc4
movl (%rbx), %edi
movq 0x15c8(%r15), %rsi
subq 0x15c0(%r15), %rsi
shrq $0x3, %rsi
callq 0x9ec1e
movss 0x4(%rbx), %xmm0
ucomiss 0x5a751(%rip), %xmm0    # 0xdbe9c
jbe 0x8175f
cltq
movq 0x1d20(%r15), %rcx
cmpl %ebp, (%rcx,%rax,4)
je 0x82120
addq $0x8, %rbx
jmp 0x81719
cmpq $0x0, 0x1608(%r15)
je 0x81fcc
movq 0x18f0(%r15), %r13
xorl %r12d, %r12d
movq 0xe4814(%rip), %rbx     # 0x165f98
leaq 0x5e224(%rip), %r14     # 0xdf9af
leaq 0x5e245(%rip), %r15     # 0xdf9d7
movq 0x8(%rsp), %rax
cmpq 0x18f8(%rax), %r13
je 0x819d8
cmpl $0x4, 0x1614(%rax)
jb 0x817c0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movl (%r13), %edi
movq 0x8(%rsp), %rax
movq 0x15c8(%rax), %rsi
subq 0x15c0(%rax), %rsi
shrq $0x3, %rsi
callq 0x9ec1e
movss 0x4(%r13), %xmm0
ucomiss 0x5a6af(%rip), %xmm0    # 0xdbe9c
jbe 0x8182e
cltq
movq 0x8(%rsp), %rcx
movq 0x1d20(%rcx), %rcx
cmpl %ebp, (%rcx,%rax,4)
jne 0x8182e
movq 0x8(%rsp), %rax
cmpl $0x4, 0x1614(%rax)
jb 0x81829
movq %rbx, %rdi
movq %r15, %rsi
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movss 0x4(%r13), %xmm0
cvttss2si %xmm0, %r12d
addq $0x8, %r13
jmp 0x81792
cmpq $0x0, 0x1608(%r15)
je 0x82011
movq 0x18f0(%r15), %r13
xorl %r12d, %r12d
movq 0xe4742(%rip), %rbx     # 0x165f98
leaq 0x5e152(%rip), %r14     # 0xdf9af
leaq 0x5e173(%rip), %r15     # 0xdf9d7
movq 0x8(%rsp), %rax
cmpq 0x18f8(%rax), %r13
je 0x81b53
cmpl $0x4, 0x1614(%rax)
jb 0x81892
movq %rbx, %rdi
movq %r14, %rsi
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movl (%r13), %edi
movq 0x8(%rsp), %rax
movq 0x15c8(%rax), %rsi
subq 0x15c0(%rax), %rsi
shrq $0x3, %rsi
callq 0x9ec1e
movss 0x4(%r13), %xmm0
ucomiss 0x5a5dd(%rip), %xmm0    # 0xdbe9c
jbe 0x81900
cltq
movq 0x8(%rsp), %rcx
movq 0x1d20(%rcx), %rcx
cmpl %ebp, (%rcx,%rax,4)
jne 0x81900
movq 0x8(%rsp), %rax
cmpl $0x4, 0x1614(%rax)
jb 0x818fb
movq %rbx, %rdi
movq %r15, %rsi
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movss 0x4(%r13), %xmm0
cvttss2si %xmm0, %r12d
addq $0x8, %r13
jmp 0x81864
cmpq $0x0, 0x1608(%r15)
je 0x820ce
movq 0x18f0(%r15), %r12
leaq 0x1d20(%r15), %rbx
xorl %r13d, %r13d
movq 0xe4669(%rip), %r14     # 0x165f98
leaq 0x5e079(%rip), %r15     # 0xdf9af
movq 0x8(%rsp), %rax
cmpq 0x18f8(%rax), %r12
je 0x81db8
cmpl $0x4, 0x1614(%rax)
jb 0x81964
movq %r14, %rdi
movq %r15, %rsi
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movl (%r12), %edi
movq 0x8(%rsp), %rax
movq 0x15c8(%rax), %rsi
subq 0x15c0(%rax), %rsi
shrq $0x3, %rsi
callq 0x9ec1e
movss 0x4(%r12), %xmm0
ucomiss 0x5a50a(%rip), %xmm0    # 0xdbe9c
jbe 0x819cf
movslq %eax, %rsi
movq %rbx, %rdi
callq 0x5a5de
cmpl %ebp, (%rax)
jne 0x819cf
movq 0x8(%rsp), %rax
cmpl $0x4, 0x1614(%rax)
jb 0x819c8
movq %r14, %rdi
leaq 0x5e01c(%rip), %rsi     # 0xdf9d7
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
cvttss2si 0x4(%r12), %r13d
addq $0x8, %r12
jmp 0x81936
movq %rax, %r15
leaq 0x1400(%r15), %rdi
leaq 0x20(%rsp), %rsi
movl %r12d, (%rsi)
movq %rdi, 0x10(%rsp)
callq 0x61e04
leaq 0x60(%rsp), %rdi
movq %rax, %rsi
callq 0x59fa2
movq 0x15a8(%r15), %rcx
leaq 0x1598(%r15), %rax
movq %rax, 0x48(%rsp)
leaq 0x58(%r15), %r12
addq $0x1d38, %r15           # imm = 0x1D38
movl %ebp, %eax
movq %rax, 0x8(%rsp)
movl $0x0, 0x18(%rsp)
leaq 0x30(%rsp), %rbx
cmpq 0x48(%rsp), %rcx
je 0x822ca
movq %rcx, 0x28(%rsp)
movq %r15, %r13
xorl %ebp, %ebp
xorl %r15d, %r15d
xorl %r14d, %r14d
cmpl %r14d, %r15d
je 0x81a5d
cmpl %r15d, %ebp
je 0x81a5d
cmpl %r14d, %ebp
jne 0x81a88
movq %rbx, %rdi
movq %r12, %rsi
callq 0x867b6
movl %eax, %ebp
movq %rbx, %rdi
movq %r12, %rsi
callq 0x867b6
movl %eax, %r15d
movq %rbx, %rdi
movq %r12, %rsi
callq 0x867b6
movl %eax, %r14d
jmp 0x81a4e
movq %r13, %rdi
movq 0x8(%rsp), %rsi
callq 0x8687e
movslq %ebp, %rsi
shlq $0x2, %rsi
addq (%rax), %rsi
movq 0x10(%rsp), %rdi
callq 0x861e4
movl 0x18(%rsp), %ebp
movq (%rax), %rax
movsd (%rax,%rbp,8), %xmm0
movsd %xmm0, 0x38(%rsp)
movq %r13, %rdi
movq 0x8(%rsp), %rsi
callq 0x8687e
movslq %r15d, %rsi
shlq $0x2, %rsi
addq (%rax), %rsi
movq 0x10(%rsp), %rdi
callq 0x861e4
movq (%rax), %rax
movsd (%rax,%rbp,8), %xmm0
movsd %xmm0, 0x50(%rsp)
movq %r13, %r15
movq %r13, %rdi
movq 0x8(%rsp), %rsi
callq 0x8687e
movslq %r14d, %rsi
shlq $0x2, %rsi
addq (%rax), %rsi
movq 0x10(%rsp), %rdi
callq 0x861e4
movq (%rax), %rax
movsd 0x50(%rsp), %xmm0
subsd (%rax,%rbp,8), %xmm0
mulsd 0x58(%rsp), %xmm0
addsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x5c482
incl 0x18(%rsp)
movq 0x28(%rsp), %rdi
callq 0x28b60
movq %rax, %rcx
jmp 0x81a33
movq %rax, %r15
leaq 0x1400(%r15), %rdi
leaq 0x20(%rsp), %rsi
movl %r12d, (%rsi)
movq %rdi, 0x90(%rsp)
callq 0x61e04
leaq 0x60(%rsp), %rdi
movq %rax, %rsi
callq 0x59fa2
movq 0x15a8(%r15), %rcx
leaq 0x1598(%r15), %rax
movq %rax, 0x78(%rsp)
leaq 0x58(%r15), %r12
movl %ebp, %eax
movl $0x0, 0x28(%rsp)
imulq $0x18, %rax, %rbp
movq %rbp, 0x18(%rsp)
cmpq 0x78(%rsp), %rcx
je 0x822ca
movq %rcx, 0x38(%rsp)
xorl %ebp, %ebp
xorl %r15d, %r15d
xorl %r14d, %r14d
xorl %r13d, %r13d
xorl %ebx, %ebx
cmpl %ebx, %r13d
je 0x81bf7
cmpl %ebx, %r14d
je 0x81bf7
cmpl %ebx, %r15d
je 0x81bf7
cmpl %ebx, %ebp
je 0x81bf7
cmpl %r13d, %r14d
je 0x81bf7
cmpl %r13d, %r15d
je 0x81bf7
cmpl %r14d, %r15d
je 0x81bf7
cmpl %r15d, %ebp
je 0x81bf7
cmpl %r14d, %ebp
je 0x81bf7
cmpl %r13d, %ebp
jne 0x81c4a
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x867b6
movl %eax, %ebp
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x867b6
movl %eax, %r15d
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x867b6
movl %eax, %r14d
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x867b6
movl %eax, %r13d
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x867b6
movl %eax, %ebx
jmp 0x81bc6
movq 0x8(%rsp), %rax
movq 0x1d38(%rax), %rax
movslq %ebp, %rsi
shlq $0x2, %rsi
movq 0x18(%rsp), %rcx
addq (%rax,%rcx), %rsi
movq 0x90(%rsp), %rbp
movq %rbp, %rdi
callq 0x86502
movl 0x28(%rsp), %ecx
movq (%rax), %rax
movq %rcx, 0x10(%rsp)
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x50(%rsp)
movq 0x8(%rsp), %rax
movq 0x1d38(%rax), %rax
movslq %r15d, %rsi
shlq $0x2, %rsi
movq 0x18(%rsp), %rcx
addq (%rax,%rcx), %rsi
movq %rbp, %rdi
callq 0x86502
movq %rbp, %r15
movq (%rax), %rax
movq 0x10(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x48(%rsp)
movq 0x8(%rsp), %rax
movq 0x1d38(%rax), %rax
movslq %r14d, %rsi
shlq $0x2, %rsi
movq 0x18(%rsp), %rbp
addq (%rax,%rbp), %rsi
movq %r15, %rdi
callq 0x86502
movq 0x8(%rsp), %r14
movq (%rax), %rax
movq 0x10(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x88(%rsp)
movq 0x1d38(%r14), %rax
movslq %r13d, %rsi
shlq $0x2, %rsi
addq (%rax,%rbp), %rsi
movq %r15, %rdi
callq 0x86502
movq (%rax), %rax
movq 0x10(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x80(%rsp)
movq 0x1d38(%r14), %rax
movslq %ebx, %rsi
shlq $0x2, %rsi
addq (%rax,%rbp), %rsi
movq %r15, %rdi
callq 0x86502
movq (%rax), %rax
movq 0x10(%rsp), %rcx
movsd 0x80(%rsp), %xmm2
subsd (%rax,%rcx,8), %xmm2
movsd 0x48(%rsp), %xmm1
subsd 0x88(%rsp), %xmm1
movsd 0x58(%rsp), %xmm0
mulsd %xmm0, %xmm1
addsd 0x50(%rsp), %xmm1
mulsd %xmm0, %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, 0x20(%rsp)
movq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x5c482
movq 0x38(%rsp), %rdi
incl 0x28(%rsp)
callq 0x28b60
movq %rax, %rcx
jmp 0x81ba9
movq %rax, %r15
leaq 0x1400(%r15), %rax
leaq 0x20(%rsp), %rsi
movl %r13d, (%rsi)
movq %rax, %r13
movq %rax, %rdi
callq 0x61e04
leaq 0x60(%rsp), %rdi
movq %rax, %rsi
callq 0x59fa2
movq 0x15a8(%r15), %rcx
leaq 0x1598(%r15), %rax
movq %rax, 0x80(%rsp)
leaq 0x58(%r15), %r12
movl %ebp, %eax
movl $0x0, 0x18(%rsp)
leaq 0x30(%rsp), %rbp
imulq $0x18, %rax, %r14
movq %r13, 0x78(%rsp)
movq %r14, 0x10(%rsp)
cmpq 0x80(%rsp), %rcx
je 0x822ca
movq %rcx, 0x28(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
xorl %r14d, %r14d
xorl %ebx, %ebx
cmpl %ebx, %r14d
je 0x81e55
cmpl %ebx, %r13d
je 0x81e55
cmpl %r14d, %r13d
je 0x81e55
cmpl %r13d, %r15d
je 0x81e55
cmpl %r14d, %r15d
je 0x81e55
cmpl %ebx, %r15d
jne 0x81e8e
movq %rbp, %rdi
movq %r12, %rsi
callq 0x867b6
movl %eax, %r15d
movq %rbp, %rdi
movq %r12, %rsi
callq 0x867b6
movl %eax, %r13d
movq %rbp, %rdi
movq %r12, %rsi
callq 0x867b6
movl %eax, %r14d
movq %rbp, %rdi
movq %r12, %rsi
callq 0x867b6
movl %eax, %ebx
jmp 0x81e37
movq 0x8(%rsp), %rax
movq 0x1d38(%rax), %rax
movslq %r15d, %rsi
shlq $0x2, %rsi
movq 0x10(%rsp), %rcx
addq (%rax,%rcx), %rsi
movq 0x78(%rsp), %r15
movq %r15, %rdi
callq 0x86502
movl 0x18(%rsp), %ecx
movq (%rax), %rax
movq %rcx, 0x38(%rsp)
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x50(%rsp)
movq 0x8(%rsp), %rax
movq 0x1d38(%rax), %rax
movslq %r13d, %rsi
shlq $0x2, %rsi
movq 0x10(%rsp), %rcx
addq (%rax,%rcx), %rsi
movq %r15, %rdi
callq 0x86502
movq %r15, %r13
movq (%rax), %rax
movq 0x38(%rsp), %r15
movsd (%rax,%r15,8), %xmm0
movsd %xmm0, 0x48(%rsp)
movq 0x8(%rsp), %rax
movq 0x1d38(%rax), %rax
movslq %r14d, %rsi
shlq $0x2, %rsi
movq 0x10(%rsp), %r14
addq (%rax,%r14), %rsi
movq %r13, %rdi
callq 0x86502
movq (%rax), %rax
movsd (%rax,%r15,8), %xmm0
movsd %xmm0, 0x88(%rsp)
movq 0x8(%rsp), %rax
movq 0x1d38(%rax), %rax
movslq %ebx, %rsi
shlq $0x2, %rsi
addq (%rax,%r14), %rsi
movq %r13, %rdi
callq 0x86502
movq (%rax), %rax
movsd 0x88(%rsp), %xmm2
subsd (%rax,%r15,8), %xmm2
movq 0x60(%rsp), %rax
movsd 0x50(%rsp), %xmm1
subsd 0x48(%rsp), %xmm1
movsd 0x58(%rsp), %xmm0
mulsd %xmm0, %xmm1
addsd (%rax,%r15,8), %xmm1
mulsd %xmm0, %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, 0x20(%rsp)
movq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x5c482
movq 0x28(%rsp), %rdi
incl 0x18(%rsp)
callq 0x28b60
movq %rax, %rcx
jmp 0x81e19
xorl %r12d, %r12d
jmp 0x821a1
movq 0x1ac8(%r15), %rax
leaq 0x1ab8(%r15), %rbx
movq 0x1d20(%r15), %r14
xorl %r12d, %r12d
cmpq %rbx, %rax
je 0x819db
movsd 0x20(%rax), %xmm0
ucomisd 0x52a86(%rip), %xmm0    # 0xd4a80
jbe 0x82007
movl 0x28(%rax), %ecx
cmpl %ebp, (%r14,%rcx,4)
cmovel %ecx, %r12d
movq %rax, %rdi
callq 0x28700
jmp 0x81fe4
movq 0x1ac8(%r15), %rax
leaq 0x1ab8(%r15), %rbx
movq 0x1d20(%r15), %r14
xorl %r12d, %r12d
cmpq %rbx, %rax
je 0x81b56
movsd 0x20(%rax), %xmm0
ucomisd 0x52a41(%rip), %xmm0    # 0xd4a80
jbe 0x8204c
movl 0x28(%rax), %ecx
cmpl %ebp, (%r14,%rcx,4)
cmovel %ecx, %r12d
movq %rax, %rdi
callq 0x28700
jmp 0x82029
movq 0x1ac8(%r15), %rbx
leaq 0x1ab8(%r15), %r13
movq 0xe3f2d(%rip), %r14     # 0x165f98
leaq 0x5d93d(%rip), %r15     # 0xdf9af
cmpq %r13, %rbx
je 0x82113
movq 0x8(%rsp), %rax
cmpl $0x4, 0x1614(%rax)
jb 0x8209c
movq %r14, %rdi
movq %r15, %rsi
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movsd 0x20(%rbx), %xmm0
ucomisd 0x529d7(%rip), %xmm0    # 0xd4a80
jbe 0x820c1
movl 0x28(%rbx), %r12d
movq 0x8(%rsp), %rax
movq 0x1d20(%rax), %rax
cmpl %ebp, (%rax,%r12,4)
je 0x82127
movq %rbx, %rdi
callq 0x28700
movq %rax, %rbx
jmp 0x82072
movq 0x1ac8(%r15), %rax
leaq 0x1ab8(%r15), %rbx
movq 0x1d20(%r15), %r14
xorl %r13d, %r13d
cmpq %rbx, %rax
je 0x81dbb
movsd 0x20(%rax), %xmm0
ucomisd 0x52984(%rip), %xmm0    # 0xd4a80
jbe 0x82109
movl 0x28(%rax), %ecx
cmpl %ebp, (%r14,%rcx,4)
cmovel %ecx, %r13d
movq %rax, %rdi
callq 0x28700
jmp 0x820e6
xorl %r12d, %r12d
movq 0x8(%rsp), %r15
jmp 0x821a1
cvttss2si %xmm0, %r12d
jmp 0x821a1
movq 0x8(%rsp), %r15
cmpl $0x4, 0x1614(%r15)
jb 0x821a1
movq 0xe3e5b(%rip), %rdi     # 0x165f98
leaq 0x5d893(%rip), %rsi     # 0xdf9d7
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movl 0x28(%rbx), %r12d
cmpl $0x4, 0x1614(%r15)
jb 0x821a1
movq 0xe3e32(%rip), %rdi     # 0x165f98
leaq 0x5d897(%rip), %rsi     # 0xdfa04
callq 0x289f0
movl 0x28(%rbx), %esi
movq %rax, %rdi
callq 0x286e0
leaq 0x5d892(%rip), %rsi     # 0xdfa16
movq %rax, %rdi
callq 0x289f0
movsd 0x20(%rbx), %xmm0
movq %rax, %rdi
callq 0x290f0
movq %rax, %rdi
callq 0x284a0
leaq 0x1400(%r15), %rdi
leaq 0x20(%rsp), %rsi
movl %r12d, (%rsi)
movq %rdi, 0x18(%rsp)
callq 0x861e4
leaq 0x60(%rsp), %rdi
movq %rax, %rsi
callq 0x59fa2
movq 0x15a8(%r15), %r12
leaq 0x1598(%r15), %rax
movq %rax, 0x38(%rsp)
movq %r15, %rax
addq $0x58, %r15
addq $0x1d38, %rax           # imm = 0x1D38
movq %rax, 0x8(%rsp)
movl %ebp, %eax
movq %rax, 0x10(%rsp)
xorl %r13d, %r13d
leaq 0x30(%rsp), %rbp
cmpq 0x38(%rsp), %r12
je 0x822ca
xorl %r14d, %r14d
xorl %ebx, %ebx
cmpl %r14d, %ebx
jne 0x8222d
movq %rbp, %rdi
movq %r15, %rsi
callq 0x867b6
movl %eax, %ebx
movq %rbp, %rdi
movq %r15, %rsi
callq 0x867b6
movl %eax, %r14d
jmp 0x8220b
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x8687e
movslq %ebx, %rsi
shlq $0x2, %rsi
addq (%rax), %rsi
movq 0x18(%rsp), %rdi
callq 0x861e4
movl %r13d, %ebx
movq (%rax), %rax
movsd (%rax,%rbx,8), %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x8687e
movslq %r14d, %rsi
shlq $0x2, %rsi
addq (%rax), %rsi
movq 0x18(%rsp), %rdi
callq 0x861e4
movq (%rax), %rax
movsd 0x28(%rsp), %xmm0
subsd (%rax,%rbx,8), %xmm0
movq 0x60(%rsp), %rax
mulsd 0x58(%rsp), %xmm0
addsd (%rax,%rbx,8), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x5c482
incl %r13d
movq %r12, %rdi
callq 0x28b60
movq %rax, %r12
jmp 0x821fb
leaq 0x60(%rsp), %rdi
callq 0x5c44e
movq 0x40(%rsp), %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x82319
jmp 0x82319
jmp 0x82319
jmp 0x82319
jmp 0x82319
jmp 0x82319
jmp 0x82319
jmp 0x82319
jmp 0x8232e
jmp 0x8232e
jmp 0x8232e
jmp 0x8232e
jmp 0x8232e
jmp 0x8232e
jmp 0x8232e
jmp 0x8232e
jmp 0x8232e
jmp 0x8232e
jmp 0x8232e
jmp 0x8232e
jmp 0x8232e
jmp 0x82319
jmp 0x82319
movq %rax, %rbx
jmp 0x8233b
jmp 0x8232e
jmp 0x8232e
jmp 0x8232e
jmp 0x8232e
jmp 0x8232e
jmp 0x8232e
jmp 0x8232e
jmp 0x8232e
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x5c44e
movq 0x40(%rsp), %rdi
callq 0x5c44e
movq %rbx, %rdi
callq 0x292f0
nop