// File: /workspace/github_cpp_makefile_star2_O3/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, 0x24(%rsp)
movq %rsi, %r14
movq %rdi, %rbp
cmpl $0x3, 0x1614(%rsi)
movl %edx, %ebx
movq %rsi, 0x10(%rsp)
jb 0xa0388
movq 0xd5c6e(%rip), %r14     # 0x175fa8
leaq 0x6144c(%rip), %rsi     # 0x10178d
movl $0x12, %edx
movq %r14, %rdi
callq 0x22ab0
movq %r14, %rdi
movq %rbx, %rsi
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
movq 0x10(%rsp), %r14
callq 0x22050
movq %rax, %rdi
callq 0x22660
xorps %xmm0, %xmm0
movups %xmm0, (%rbp)
movq $0x0, 0x10(%rbp)
leaq 0x14e0(%r14), %rdi
leaq 0x8db56(%rip), %rsi     # 0x12defb
callq 0x22250
testl %eax, %eax
jne 0xa1389
movl 0x1620(%r14), %eax
xorl %edx, %edx
divl 0x16fc(%r14)
movl %eax, %r15d
xorps %xmm0, %xmm0
movss 0x24(%rsp), %xmm1
ucomiss %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
movsd %xmm0, 0x70(%rsp)
jne 0xa03f0
jp 0xa03f0
movsd 0x5dc3e(%rip), %xmm0    # 0xfe028
movsd %xmm0, 0x70(%rsp)
decl %r15d
js 0xa1389
movq 0x1d20(%r14), %rax
movl (%rax,%rbx,4), %eax
movq %rax, 0x8(%rsp)
cmpl $0x3, 0x1614(%r14)
jb 0xa0458
movq 0xd5b8f(%rip), %rbx     # 0x175fa8
leaq 0x61380(%rip), %rsi     # 0x1017a0
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 0xd5b5d(%rip), %rdi     # 0x175fa8
callq 0x22050
movq %rax, %rdi
callq 0x22660
movl 0x1700(%r14), %eax
decl %eax
cmpl $0x3, %eax
ja 0xa1315
leaq 0x5dc17(%rip), %rcx     # 0xfe088
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
movq %rbp, 0x18(%rsp)
movl %r15d, 0x24(%rsp)
jmpq *%rax
cmpq $0x0, 0x1608(%r14)
je 0xa0d8a
movq 0x18f0(%r14), %rbx
xorl %ebp, %ebp
cmpq 0x18f8(%r14), %rbx
je 0xa1171
movl (%rbx), %edi
movq 0x15c8(%r14), %rsi
subq 0x15c0(%r14), %rsi
shrq $0x3, %rsi
callq 0xbe99e
movss 0x4(%rbx), %xmm0
ucomiss 0x5d82f(%rip), %xmm0    # 0xfdcfc
jbe 0xa04e6
cltq
movq 0x1d20(%r14), %rcx
movq 0x8(%rsp), %rdx
cmpl %edx, (%rcx,%rax,4)
je 0xa10cc
addq $0x8, %rbx
jmp 0xa049b
cmpq $0x0, 0x1608(%r14)
je 0xa084f
movq 0x18f0(%r14), %rbx
cmpq 0x18f8(%r14), %rbx
je 0xa0898
xorl %ebp, %ebp
movq 0xd5a91(%rip), %r15     # 0x175fa8
leaq 0x612a8(%rip), %r12     # 0x1017c6
leaq 0x612c9(%rip), %r13     # 0x1017ee
movq 0x10(%rsp), %r14
cmpl $0x4, 0x1614(%r14)
jb 0xa056b
movl $0x27, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x22ab0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r15, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movl (%rbx), %edi
movq 0x15c8(%r14), %rsi
subq 0x15c0(%r14), %rsi
shrq $0x3, %rsi
callq 0xbe99e
movss 0x4(%rbx), %xmm0
ucomiss 0x5d76c(%rip), %xmm0    # 0xfdcfc
jbe 0xa05ef
cltq
movq 0x1d20(%r14), %rcx
movq 0x8(%rsp), %rdx
cmpl %edx, (%rcx,%rax,4)
jne 0xa05ef
cmpl $0x4, 0x1614(%r14)
jb 0xa05eb
movl $0x2c, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x22ab0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r15, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movss 0x4(%rbx), %xmm0
cvttss2si %xmm0, %ebp
addq $0x8, %rbx
cmpq 0x18f8(%r14), %rbx
jne 0xa052a
jmp 0xa089a
cmpq $0x0, 0x1608(%r14)
je 0xa0ab1
movq 0x18f0(%r14), %rbx
cmpq 0x18f8(%r14), %rbx
je 0xa0afa
xorl %ebp, %ebp
movq 0xd5978(%rip), %r15     # 0x175fa8
leaq 0x6118f(%rip), %r12     # 0x1017c6
leaq 0x611b0(%rip), %r13     # 0x1017ee
movq 0x10(%rsp), %r14
cmpl $0x4, 0x1614(%r14)
jb 0xa0684
movl $0x27, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x22ab0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r15, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movl (%rbx), %edi
movq 0x15c8(%r14), %rsi
subq 0x15c0(%r14), %rsi
shrq $0x3, %rsi
callq 0xbe99e
movss 0x4(%rbx), %xmm0
ucomiss 0x5d653(%rip), %xmm0    # 0xfdcfc
jbe 0xa0708
cltq
movq 0x1d20(%r14), %rcx
movq 0x8(%rsp), %rdx
cmpl %edx, (%rcx,%rax,4)
jne 0xa0708
cmpl $0x4, 0x1614(%r14)
jb 0xa0704
movl $0x2c, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x22ab0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r15, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movss 0x4(%rbx), %xmm0
cvttss2si %xmm0, %ebp
addq $0x8, %rbx
cmpq 0x18f8(%r14), %rbx
jne 0xa0643
jmp 0xa0afc
cmpq $0x0, 0x1608(%r14)
je 0xa0e42
movq 0x18f0(%r14), %rbx
cmpq 0x18f8(%r14), %rbx
je 0xa0e8b
xorl %ebp, %ebp
movq 0xd585f(%rip), %r15     # 0x175fa8
leaq 0x61076(%rip), %r12     # 0x1017c6
leaq 0x61097(%rip), %r13     # 0x1017ee
movq 0x10(%rsp), %r14
cmpl $0x4, 0x1614(%r14)
jb 0xa079d
movl $0x27, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x22ab0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r15, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movl (%rbx), %edi
movq 0x15c8(%r14), %rsi
subq 0x15c0(%r14), %rsi
shrq $0x3, %rsi
callq 0xbe99e
movss 0x4(%rbx), %xmm0
ucomiss 0x5d53a(%rip), %xmm0    # 0xfdcfc
jbe 0xa0839
movslq %eax, %rsi
movq 0x1d20(%r14), %rax
movq 0x1d28(%r14), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rsi, %rdx
jbe 0xa13a8
movq 0x8(%rsp), %rcx
cmpl %ecx, (%rax,%rsi,4)
jne 0xa0839
cmpl $0x4, 0x1614(%r14)
jb 0xa0835
movl $0x2c, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x22ab0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r15, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movss 0x4(%rbx), %xmm0
cvttss2si %xmm0, %ebp
addq $0x8, %rbx
cmpq 0x18f8(%r14), %rbx
jne 0xa075c
jmp 0xa0e8d
movq 0x1ac8(%r14), %rax
leaq 0x1ab8(%r14), %rbx
cmpq %rbx, %rax
je 0xa0898
movq 0x1d20(%r14), %r14
xorl %ebp, %ebp
movsd 0x20(%rax), %xmm0
ucomisd 0x56270(%rip), %xmm0    # 0xf6ae8
jbe 0xa0889
movl 0x28(%rax), %ecx
movq 0x8(%rsp), %rdx
cmpl %edx, (%r14,%rcx,4)
cmovel %ecx, %ebp
movq %rax, %rdi
callq 0x22670
cmpq %rbx, %rax
jne 0xa086b
jmp 0xa089a
xorl %ebp, %ebp
movq 0x10(%rsp), %rbx
leaq 0x1400(%rbx), %rdi
leaq 0x30(%rsp), %rsi
movl %ebp, (%rsi)
movq %rdi, 0x28(%rsp)
callq 0x6ec8a
leaq 0x48(%rsp), %rdi
movq %rax, %rsi
callq 0x65d5c
movq 0x15a8(%rbx), %r12
leaq 0x1598(%rbx), %rax
movq %rax, 0x60(%rsp)
cmpq %rax, %r12
movq 0x18(%rsp), %rbp
je 0xa12fe
leaq 0x58(%rbx), %r13
xorl %r15d, %r15d
movq 0x8(%rsp), %rax
leaq (%rax,%rax,2), %rax
movq %rax, 0x38(%rsp)
xorl %r14d, %r14d
xorl %ebp, %ebp
xorl %ebx, %ebx
cmpl %ebx, %ebp
je 0xa090f
cmpl %ebp, %r14d
je 0xa090f
cmpl %ebx, %r14d
jne 0xa0940
movq %r13, %rdi
xorl %esi, %esi
movl 0x24(%rsp), %ebx
movl %ebx, %edx
callq 0xbbd9b
movl %eax, %r14d
movq %r13, %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0xbbd9b
movl %eax, %ebp
movq %r13, %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0xbbd9b
movl %eax, %ebx
jmp 0xa0901
movq 0x10(%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 0x8(%rsp), %rdx
jbe 0xa1376
movslq %r14d, %rsi
shlq $0x2, %rsi
movq 0x38(%rsp), %rcx
addq (%rax,%rcx,8), %rsi
movq 0x28(%rsp), %rdi
callq 0xa7a46
movq 0x10(%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 0x8(%rsp), %rdx
jbe 0xa1363
movl %r15d, %r14d
movq (%rax), %rax
movsd (%rax,%r14,8), %xmm0
movsd %xmm0, 0x40(%rsp)
movslq %ebp, %rsi
shlq $0x2, %rsi
movq 0x38(%rsp), %rax
addq (%rcx,%rax,8), %rsi
movq 0x28(%rsp), %rdi
callq 0xa7a46
movq 0x10(%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 0x8(%rsp), %rdx
movq 0x18(%rsp), %rbp
jbe 0xa1350
movq (%rax), %rax
movsd (%rax,%r14,8), %xmm0
movsd %xmm0, 0x68(%rsp)
movslq %ebx, %rsi
shlq $0x2, %rsi
movq 0x38(%rsp), %rax
addq (%rcx,%rax,8), %rsi
movq 0x28(%rsp), %rdi
callq 0xa7a46
movq (%rax), %rax
movsd 0x68(%rsp), %xmm0
subsd (%rax,%r14,8), %xmm0
mulsd 0x70(%rsp), %xmm0
addsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x8(%rbp), %rsi
cmpq 0x10(%rbp), %rsi
je 0xa0a86
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbp)
jmp 0xa0a93
movq %rbp, %rdi
leaq 0x30(%rsp), %rdx
callq 0x67e5a
incl %r15d
movq %r12, %rdi
callq 0x22ad0
movq %rax, %r12
cmpq 0x60(%rsp), %rax
jne 0xa08fa
jmp 0xa12fe
movq 0x1ac8(%r14), %rax
leaq 0x1ab8(%r14), %rbx
cmpq %rbx, %rax
je 0xa0afa
movq 0x1d20(%r14), %r14
xorl %ebp, %ebp
movsd 0x20(%rax), %xmm0
ucomisd 0x5600e(%rip), %xmm0    # 0xf6ae8
jbe 0xa0aeb
movl 0x28(%rax), %ecx
movq 0x8(%rsp), %rdx
cmpl %edx, (%r14,%rcx,4)
cmovel %ecx, %ebp
movq %rax, %rdi
callq 0x22670
cmpq %rbx, %rax
jne 0xa0acd
jmp 0xa0afc
xorl %ebp, %ebp
movq 0x10(%rsp), %rbx
leaq 0x1400(%rbx), %r14
leaq 0x30(%rsp), %rsi
movl %ebp, (%rsi)
movq %r14, %rdi
callq 0x6ec8a
leaq 0x48(%rsp), %rdi
movq %rax, %rsi
callq 0x65d5c
movq 0x15a8(%rbx), %rcx
leaq 0x1598(%rbx), %rax
movq %rax, 0x78(%rsp)
cmpq %rax, %rcx
movq 0x18(%rsp), %rbp
je 0xa12fe
leaq 0x58(%rbx), %r15
movl $0x0, 0x28(%rsp)
movq 0x8(%rsp), %rax
leaq (%rax,%rax,2), %r13
movq %r14, 0x90(%rsp)
movq %r13, 0x8(%rsp)
movq %rcx, 0x38(%rsp)
xorl %ebp, %ebp
xorl %r13d, %r13d
xorl %r14d, %r14d
xorl %r12d, %r12d
xorl %ebx, %ebx
cmpl %ebx, %r12d
je 0xa0baa
cmpl %ebx, %r14d
je 0xa0baa
cmpl %ebx, %r13d
je 0xa0baa
cmpl %ebx, %ebp
je 0xa0baa
cmpl %r12d, %r14d
je 0xa0baa
cmpl %r12d, %r13d
je 0xa0baa
cmpl %r14d, %r13d
je 0xa0baa
cmpl %r13d, %ebp
je 0xa0baa
cmpl %r14d, %ebp
je 0xa0baa
cmpl %r12d, %ebp
jne 0xa0bf9
movq %r15, %rdi
xorl %esi, %esi
movl 0x24(%rsp), %ebx
movl %ebx, %edx
callq 0xbbd9b
movl %eax, %ebp
movq %r15, %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0xbbd9b
movl %eax, %r13d
movq %r15, %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0xbbd9b
movl %eax, %r14d
movq %r15, %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0xbbd9b
movl %eax, %r12d
movq %r15, %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0xbbd9b
movl %eax, %ebx
jmp 0xa0b79
movq 0x10(%rsp), %rax
movq 0x1d38(%rax), %rax
movslq %ebp, %rsi
shlq $0x2, %rsi
movq 0x8(%rsp), %rcx
addq (%rax,%rcx,8), %rsi
movq 0x90(%rsp), %rbp
movq %rbp, %rdi
callq 0xa7e00
movl 0x28(%rsp), %ecx
movq (%rax), %rax
movq %rcx, 0x40(%rsp)
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x68(%rsp)
movq 0x10(%rsp), %rax
movq 0x1d38(%rax), %rax
movslq %r13d, %rsi
shlq $0x2, %rsi
movq 0x8(%rsp), %rcx
addq (%rax,%rcx,8), %rsi
movq %rbp, %rdi
callq 0xa7e00
movq %rbp, %r13
movq (%rax), %rax
movq 0x40(%rsp), %rbp
movsd (%rax,%rbp,8), %xmm0
movsd %xmm0, 0x60(%rsp)
movq 0x10(%rsp), %rax
movq 0x1d38(%rax), %rax
movslq %r14d, %rsi
shlq $0x2, %rsi
movq 0x8(%rsp), %r14
addq (%rax,%r14,8), %rsi
movq %r13, %rdi
callq 0xa7e00
movq %r14, %rcx
movq %r13, %r14
movq (%rax), %rax
movsd (%rax,%rbp,8), %xmm0
movsd %xmm0, 0x88(%rsp)
movq 0x10(%rsp), %r13
movq 0x1d38(%r13), %rax
movslq %r12d, %rsi
shlq $0x2, %rsi
addq (%rax,%rcx,8), %rsi
movq %r14, %rdi
movq %rcx, %r12
callq 0xa7e00
movq (%rax), %rax
movsd (%rax,%rbp,8), %xmm0
movsd %xmm0, 0x80(%rsp)
movq 0x1d38(%r13), %rax
movslq %ebx, %rsi
shlq $0x2, %rsi
addq (%rax,%r12,8), %rsi
movq %r14, %rdi
callq 0xa7e00
movq 0x38(%rsp), %rbx
movq (%rax), %rax
movsd 0x80(%rsp), %xmm2
subsd (%rax,%rbp,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 0x18(%rsp), %rbp
movq 0x8(%rbp), %rsi
cmpq 0x10(%rbp), %rsi
je 0xa0d5e
movsd %xmm2, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbp)
jmp 0xa0d6b
movq %rbp, %rdi
leaq 0x30(%rsp), %rdx
callq 0x67e5a
incl 0x28(%rsp)
movq %rbx, %rdi
callq 0x22ad0
movq %rax, %rcx
cmpq 0x78(%rsp), %rax
jne 0xa0b67
jmp 0xa12fe
movq 0x1ac8(%r14), %r15
leaq 0x1ab8(%r14), %r12
xorl %ebp, %ebp
cmpq %r12, %r15
je 0xa1171
movq 0xd51fe(%rip), %rbx     # 0x175fa8
leaq 0x60a15(%rip), %r14     # 0x1017c6
movq 0x10(%rsp), %rax
cmpl $0x4, 0x1614(%rax)
jb 0xa0df6
movl $0x27, %edx
movq %rbx, %rdi
movq %r14, %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
movsd 0x20(%r15), %xmm0
ucomisd 0x55ce4(%rip), %xmm0    # 0xf6ae8
jbe 0xa0e24
movl 0x28(%r15), %eax
movq 0x10(%rsp), %rcx
movq 0x1d20(%rcx), %rcx
movq 0x8(%rsp), %rdx
cmpl %edx, (%rcx,%rax,4)
je 0xa10d5
movq %r15, %rdi
callq 0x22670
movq %rax, %r15
cmpq %r12, %rax
jne 0xa0db1
movq 0x10(%rsp), %r14
jmp 0xa1171
movq 0x1ac8(%r14), %rax
leaq 0x1ab8(%r14), %rbx
cmpq %rbx, %rax
je 0xa0e8b
movq 0x1d20(%r14), %r14
xorl %ebp, %ebp
movsd 0x20(%rax), %xmm0
ucomisd 0x55c7d(%rip), %xmm0    # 0xf6ae8
jbe 0xa0e7c
movl 0x28(%rax), %ecx
movq 0x8(%rsp), %rdx
cmpl %edx, (%r14,%rcx,4)
cmovel %ecx, %ebp
movq %rax, %rdi
callq 0x22670
cmpq %rbx, %rax
jne 0xa0e5e
jmp 0xa0e8d
xorl %ebp, %ebp
movq 0x10(%rsp), %rbx
leaq 0x1400(%rbx), %r15
leaq 0x30(%rsp), %rsi
movl %ebp, (%rsi)
movq %r15, %rdi
callq 0x6ec8a
leaq 0x48(%rsp), %rdi
movq %rax, %rsi
callq 0x65d5c
movq 0x15a8(%rbx), %rcx
leaq 0x1598(%rbx), %rax
movq %rax, 0x88(%rsp)
cmpq %rax, %rcx
movq 0x18(%rsp), %rbp
movl 0x24(%rsp), %r12d
je 0xa12fe
leaq 0x58(%rbx), %r13
movl $0x0, 0x28(%rsp)
movq 0x8(%rsp), %rax
leaq (%rax,%rax,2), %rax
movq %rax, 0x78(%rsp)
movq %r15, 0x80(%rsp)
movq %rcx, 0x38(%rsp)
xorl %r15d, %r15d
xorl %r14d, %r14d
xorl %ebp, %ebp
xorl %ebx, %ebx
cmpl %ebx, %ebp
je 0xa0f2c
cmpl %ebx, %r14d
je 0xa0f2c
cmpl %ebp, %r14d
je 0xa0f2c
cmpl %r14d, %r15d
je 0xa0f2c
cmpl %ebp, %r15d
je 0xa0f2c
cmpl %ebx, %r15d
jne 0xa0f6c
movq %r13, %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0xbbd9b
movl %eax, %r15d
movq %r13, %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0xbbd9b
movl %eax, %r14d
movq %r13, %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0xbbd9b
movl %eax, %ebp
movq %r13, %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0xbbd9b
movl %eax, %ebx
jmp 0xa0f0f
movq 0x10(%rsp), %rax
movq 0x1d38(%rax), %rax
movslq %r15d, %rsi
shlq $0x2, %rsi
movq 0x78(%rsp), %r12
addq (%rax,%r12,8), %rsi
movq 0x80(%rsp), %r15
movq %r15, %rdi
callq 0xa7e00
movl 0x28(%rsp), %ecx
movq (%rax), %rax
movq %rcx, 0x8(%rsp)
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x40(%rsp)
movq 0x10(%rsp), %rax
movq 0x1d38(%rax), %rax
movslq %r14d, %rsi
shlq $0x2, %rsi
addq (%rax,%r12,8), %rsi
movq %r15, %rdi
callq 0xa7e00
movq %r12, %r14
movq (%rax), %rax
movq 0x8(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x68(%rsp)
movq 0x10(%rsp), %r12
movq 0x1d38(%r12), %rax
movslq %ebp, %rsi
shlq $0x2, %rsi
addq (%rax,%r14,8), %rsi
movq %r15, %rdi
callq 0xa7e00
movq %r14, %rcx
movq 0x38(%rsp), %r14
movq (%rax), %rax
movq 0x8(%rsp), %rdx
movsd (%rax,%rdx,8), %xmm0
movsd %xmm0, 0x60(%rsp)
movq 0x1d38(%r12), %rax
movslq %ebx, %rsi
shlq $0x2, %rsi
addq (%rax,%rcx,8), %rsi
movq %r15, %rdi
movq 0x18(%rsp), %rbp
callq 0xa7e00
movq (%rax), %rax
movq 0x8(%rsp), %rcx
movsd 0x60(%rsp), %xmm2
subsd (%rax,%rcx,8), %xmm2
movq 0x48(%rsp), %rax
movsd 0x40(%rsp), %xmm1
subsd 0x68(%rsp), %xmm1
movsd 0x70(%rsp), %xmm0
mulsd %xmm0, %xmm1
addsd (%rax,%rcx,8), %xmm1
mulsd %xmm0, %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, 0x30(%rsp)
movq 0x8(%rbp), %rsi
cmpq 0x10(%rbp), %rsi
movl 0x24(%rsp), %r12d
je 0xa109d
movsd %xmm2, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbp)
jmp 0xa10aa
movq %rbp, %rdi
leaq 0x30(%rsp), %rdx
callq 0x67e5a
incl 0x28(%rsp)
movq %r14, %rdi
callq 0x22ad0
movq %rax, %rcx
cmpq 0x88(%rsp), %rax
jne 0xa0f00
jmp 0xa12fe
cvttss2si %xmm0, %ebp
jmp 0xa1171
movq 0x10(%rsp), %r14
cmpl $0x4, 0x1614(%r14)
movl %eax, %ebp
jb 0xa1171
movq 0xd4eb7(%rip), %rdi     # 0x175fa8
leaq 0x606f6(%rip), %rsi     # 0x1017ee
movl $0x2c, %edx
callq 0x22ab0
movq 0xd4e9f(%rip), %rdi     # 0x175fa8
callq 0x22430
movl 0x28(%r15), %ebp
cmpl $0x4, 0x1614(%r14)
jb 0xa1171
movq 0xd4e85(%rip), %rdi     # 0x175fa8
leaq 0x606f1(%rip), %rsi     # 0x10181b
movl $0x11, %edx
callq 0x22ab0
movl 0x28(%r15), %esi
movq 0xd4e69(%rip), %rdi     # 0x175fa8
callq 0x22650
movq %rax, %rbx
leaq 0x606df(%rip), %rsi     # 0x10182d
movl $0x15, %edx
movq %rax, %rdi
callq 0x22ab0
movsd 0x20(%r15), %xmm0
movq %rbx, %rdi
callq 0x23060
movq %rax, %rdi
callq 0x22430
leaq 0x1400(%r14), %rdi
leaq 0x30(%rsp), %rsi
movl %ebp, (%rsi)
movq %rdi, 0x28(%rsp)
callq 0xa7a46
leaq 0x48(%rsp), %rdi
movq %rax, %rsi
callq 0x65d5c
movq 0x15a8(%r14), %r12
leaq 0x1598(%r14), %rax
movq %rax, 0x40(%rsp)
cmpq %rax, %r12
movq 0x18(%rsp), %rbp
je 0xa12fe
movq 0x10(%rsp), %rax
leaq 0x58(%rax), %r13
xorl %r14d, %r14d
movq 0x8(%rsp), %rax
leaq (%rax,%rax,2), %r15
xorl %ebx, %ebx
xorl %ebp, %ebp
cmpl %ebx, %ebp
jne 0xa11f6
movq %r13, %rdi
xorl %esi, %esi
movl 0x24(%rsp), %ebx
movl %ebx, %edx
callq 0xbbd9b
movl %eax, %ebp
movq %r13, %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0xbbd9b
movl %eax, %ebx
jmp 0xa11d0
movq 0x10(%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 0x8(%rsp), %rdx
jbe 0xa133d
movslq %ebp, %rsi
shlq $0x2, %rsi
addq (%rax,%r15,8), %rsi
movq 0x28(%rsp), %rdi
callq 0xa7a46
movq 0x10(%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 0x8(%rsp), %rdx
jbe 0xa132a
movl %r14d, %ebp
movq (%rax), %rax
movsd (%rax,%rbp,8), %xmm0
movsd %xmm0, 0x38(%rsp)
movslq %ebx, %rsi
shlq $0x2, %rsi
addq (%rcx,%r15,8), %rsi
movq 0x28(%rsp), %rdi
callq 0xa7a46
movq (%rax), %rax
movsd 0x38(%rsp), %xmm0
subsd (%rax,%rbp,8), %xmm0
movq 0x48(%rsp), %rax
mulsd 0x70(%rsp), %xmm0
addsd (%rax,%rbp,8), %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x18(%rsp), %rbp
movq 0x8(%rbp), %rsi
cmpq 0x10(%rbp), %rsi
je 0xa12d8
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbp)
jmp 0xa12e5
movq %rbp, %rdi
leaq 0x30(%rsp), %rdx
callq 0x67e5a
incl %r14d
movq %r12, %rdi
callq 0x22ad0
movq %rax, %r12
cmpq 0x40(%rsp), %rax
jne 0xa11cc
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0xa1315
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
movq %rbp, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x52348(%rip), %rdi     # 0xf3679
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x22f40
leaq 0x52335(%rip), %rdi     # 0xf3679
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x22f40
leaq 0x52322(%rip), %rdi     # 0xf3679
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x22f40
leaq 0x5230f(%rip), %rdi     # 0xf3679
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x22f40
leaq 0x522fc(%rip), %rdi     # 0xf3679
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x22f40
leaq 0x75bbf(%rip), %rdi     # 0x116f4f
leaq 0x75bcb(%rip), %rsi     # 0x116f62
leaq 0x75bfb(%rip), %rcx     # 0x116f99
movl $0x151, %edx            # imm = 0x151
callq 0x22610
leaq 0x522ca(%rip), %rdi     # 0xf3679
xorl %eax, %eax
callq 0x22f40
jmp 0xa13fd
jmp 0xa13fd
jmp 0xa13fd
jmp 0xa13fd
jmp 0xa13fd
jmp 0xa13fd
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
jmp 0xa13fd
movq %rax, %r14
jmp 0xa142c
jmp 0xa13fd
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
jmp 0xa13fd
jmp 0xa13fd
movq %rax, %r14
movq 0x18(%rsp), %rbp
jmp 0xa142c
jmp 0xa140d
jmp 0xa140d
jmp 0xa140d
movq %rax, %r14
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
movq 0x18(%rsp), %rbp
je 0xa142c
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
movq (%rbp), %rdi
testq %rdi, %rdi
je 0xa1441
movq 0x10(%rbp), %rsi
subq %rdi, %rsi
callq 0x229c0
movq %r14, %rdi
callq 0x23240
nop