// File: richardposner[P]BioNetFit2/src/code/Particle.cpp
// Function: Particle::runNelderMead(std::map<double, std::vector<double, std::allocator<double>>, std::less<double>, std::allocator<std::pair<double const, std::vector<double, std::allocator<double>>>>>, unsigned int)
void Particle::runNelderMead(map<double, vector<double> > simplex, unsigned int mid) {

	std::map<std::string, double> simParams = simParams_.at(mid);
	auto curPar = getSubParticle(mid);


	// The transformation coefficients
	float reflection = 1.0;
	float expansion = 2.0;
	float contraction = 0.5;
	float shrink = 0.5;
	unsigned int simulationCount = 0;

	while (simulationCount < 20) {
		// Get our important vertices
		auto sIt = simplex.end();
		advance(sIt, - 1); // Last element
		cout << "worst is: " << sIt->first << endl;
		auto worst = sIt;
		advance(sIt, - 1); // Second to last element
		cout << "second worst is: " << sIt->first << endl;
		auto good = sIt;
		auto best = simplex.begin();
		cout << "best is: " << best->first << endl;
		bool invalid = false;

		vector<vector<double> > centroidVectors;
		for (auto params = simplex.begin(); params != worst; ++params) {
			centroidVectors.push_back(swarm_->normalizeParams(params->second));
		}

		// Calculate the centroid
		vector<double> centroid = getCentroid(centroidVectors);

		// Reflect
		cout << "reflecting" << endl;
		vector<double> R; // The transformation vector
		for (unsigned int d = 0; d < centroid.size(); ++d) {
			double r = centroid[d] + reflection * (centroid[d] - worst->second[d]);
			if (r <= 0 || r > 1) {
				invalid = true;
			}
			cout << "creating new pt with eq " << centroid[d] << " + " << reflection << " * (" << centroid[d] << " - " << worst->second[d] << "): " << r << endl;
			R.push_back(r);
		}

		vector<double> deNormalizedReflection = swarm_->deNormalizeParams(R);

		auto tIt = deNormalizedReflection.begin();
		for (auto p = simParams.begin(); p != simParams.end(); ++p) {
			p->second = *tIt;
			++tIt;
		}

		double rCalc;
		if (!invalid) {
			for (unsigned int i = 1; i <= swarm_->options.smoothing; ++i) {
				curPar->runModel(i, true);
				++simulationCount;
			}
			if (swarm_->options.smoothing > 1) {
				curPar->smoothRuns();

			}
			curPar->calculateFit(true);
			rCalc = fitCalcs.at(mid)[-1];
		}
		else {
			invalid = false;
			rCalc = pow(10, 10);
		}
		cout << "reflection: " << rCalc << endl;

		// R Better than good, but worse than best
		if (rCalc > best->first && rCalc < good->first) {
			if (swarm_->options.verbosity >= 3) {
				cout << "reflection was worse than best and better than good. erasing worst of " << worst->first << endl;
			}
			simplex.erase(worst);
			if (swarm_->options.verbosity >= 3) {
				cout << "sim size: " << simplex.size() << endl;
			}
			simplex.insert(pair<double, vector<double> > (rCalc, R));
			if (swarm_->options.verbosity >= 3) {
				cout << "inserting rCalc of " << rCalc << endl;
			}
			continue;
		}
		// R Better than best
		else if (rCalc < best->first) {
			if (swarm_->options.verbosity >= 3) {
				cout << "reflection was better than best. expanding" << endl;
			}
			// Expand

			vector<double> E;
			for (unsigned int d = 0; d < centroid.size(); ++d) {
				double e = centroid[d] + expansion * (R[d] - centroid[d]);
				if (e <= 0 || e > 1) {
					invalid = true;
				}
				E.push_back(e);
				if (swarm_->options.verbosity >= 3) {
				cout << "creating new pt with eq " << centroid[d] << " + " << expansion << " * (" << R[d] << " - " << centroid[d] << "): " << e << endl;
				}
			}

			vector<double> deNormalizedExpansion = swarm_->deNormalizeParams(E);

			auto tIt = deNormalizedExpansion.begin();
			for (auto p = simParams.begin(); p != simParams.end(); ++p) {
				p->second = *tIt;
				++tIt;
			}

			double eCalc;
			if (!invalid) {
				for (unsigned int i = 1; i <= swarm_->options.smoothing; ++i) {
					curPar->runModel(i, true);
					++simulationCount;
				}
				if (swarm_->options.smoothing > 1) {
					curPar->smoothRuns();
				}
				curPar->calculateFit(true);

				eCalc = fitCalcs.at(mid)[-1];
				cout << "expansion: " << eCalc << endl;
			}
			else {
				eCalc = pow(10,10);
				invalid = false;
			}

			if (eCalc < rCalc) {
				cout << "expansion was better than reflection. looping." << endl;
				simplex.erase(worst);
				simplex.insert(pair<double, vector<double> > (eCalc, E));
				continue;
			}
			else {
				cout << "expansion was worse than reflection. looping." << endl;
				simplex.erase(worst);
				simplex.insert(pair<double, vector<double> > (rCalc, R));
				continue;
			}
		}
		// R worse than good
		else if (rCalc > good->first) {
			cout << "reflection was worse than good. contracting." << endl;
			// Contraction
			vector<double> C;
			for (unsigned int d = 0; d < centroid.size(); ++d) {
				double c = centroid[d] + contraction * (worst->second[d] - centroid[d]);
				if (c <= 0 || c > 1) {
					invalid = true;
				}
				C.push_back(c);
				cout << "creating new pt with eq " << centroid[d] << " + " << contraction << " * (" << worst->second[d] << " - " << centroid[d] << "): " << c << endl;
			}

			vector<double> deNormalizedContraction = swarm_->deNormalizeParams(C);

			auto tIt = deNormalizedContraction.begin();
			for (auto p = simParams.begin(); p != simParams.end(); ++p) {
				p->second = *tIt;
				++tIt;
			}

			double cCalc;
			if (!invalid) {
				for (unsigned int i = 1; i <= swarm_->options.smoothing; ++i) {
/*
					getSubParticle(mid)->runModel(i, true);
*/
					curPar->runModel(i, true);
					++simulationCount;
				}
				if (swarm_->options.smoothing > 1) {
					smoothRuns(mid); //razi: run for subparticle associated with model mid
					}
				calculateFit(true, mid); //razi: run for subparticle associated with model mid
				cCalc = fitCalcs.at(mid)[-1];
				cout << "contraction: " << cCalc << endl;
			}
			else {
				invalid = false;
				cCalc = pow(10, 10);
			}

			if (cCalc < worst->first) {
				cout << "contraction was better than worst. looping." << endl;
				simplex.erase(worst);
				simplex.insert(pair<double, vector<double> > (cCalc, C));
				continue;
			}
			else {
				//cout << "contraction was worse than worst. shrinking" << endl;
				// Shrink
				for (auto sIt = ++simplex.begin(); sIt != simplex.end(); ++sIt) {
					for (unsigned int d = 0; d < centroid.size(); ++d) {
						double s = simplex.begin()->second[d] + (shrink * (sIt->second[d] - best->second[d]));
						sIt->second[d] = s;
					}
				}
			}
		}
	}

	fitCalcs.at(mid)[-1] = simplex.begin()->first;
	unsigned int d = 0;
	for (auto p = simParams.begin(); p != simParams.end(); ++p) {
		p->second = simplex.begin()->second[d++];
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x770, %rsp            # imm = 0x770
movq %rsi, -0x410(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x408(%rbp)
movl -0x14(%rbp), %eax
movl %eax, %esi
callq 0xb2a00
movq %rax, %rsi
leaq -0x48(%rbp), %rdi
callq 0x9c620
movq -0x408(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0xb2a40
movq %rax, -0x400(%rbp)
jmp 0xa3ed6
movq -0x400(%rbp), %rax
movq %rax, -0x50(%rbp)
movss 0x12f11b(%rip), %xmm0   # 0x1d3004
movss %xmm0, -0x60(%rbp)
movss 0x136c4e(%rip), %xmm0   # 0x1dab44
movss %xmm0, -0x64(%rbp)
movss 0x136c3d(%rip), %xmm0   # 0x1dab40
movss %xmm0, -0x68(%rbp)
movss 0x136c30(%rip), %xmm0   # 0x1dab40
movss %xmm0, -0x6c(%rbp)
movl $0x0, -0x70(%rbp)
cmpl $0x14, -0x70(%rbp)
jae 0xa5b07
movq -0x410(%rbp), %rdi
callq 0xb2a70
movq %rax, -0x78(%rbp)
leaq -0x78(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xb2aa0
jmp 0xa3f46
movq 0x231003(%rip), %rdi    # 0x2d4f50
leaq 0x136c70(%rip), %rsi    # 0x1dabc4
callq 0x2ff50
movq %rax, -0x418(%rbp)
jmp 0xa3f62
leaq -0x78(%rbp), %rdi
callq 0xb2af0
movq -0x418(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x30710
movq %rax, -0x420(%rbp)
jmp 0xa3f84
movq -0x420(%rbp), %rdi
movq 0x231036(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xa3f99
movq -0x78(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x78(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xb2aa0
jmp 0xa3fb1
movq 0x230f98(%rip), %rdi    # 0x2d4f50
leaq 0x136bfe(%rip), %rsi    # 0x1dabbd
callq 0x2ff50
movq %rax, -0x428(%rbp)
jmp 0xa3fcd
leaq -0x78(%rbp), %rdi
callq 0xb2af0
movq -0x428(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x30710
movq %rax, -0x430(%rbp)
jmp 0xa3fef
movq -0x430(%rbp), %rdi
movq 0x230fcb(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xa4004
movq -0x410(%rbp), %rdi
movq -0x78(%rbp), %rax
movq %rax, -0x88(%rbp)
callq 0xb2b10
movq %rax, -0x90(%rbp)
movq 0x230f27(%rip), %rdi    # 0x2d4f50
leaq 0x136b9f(%rip), %rsi    # 0x1dabcf
callq 0x2ff50
movq %rax, -0x438(%rbp)
jmp 0xa403e
leaq -0x90(%rbp), %rdi
callq 0xb2af0
movq -0x438(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x30710
movq %rax, -0x440(%rbp)
jmp 0xa4063
movq -0x440(%rbp), %rdi
movq 0x230f57(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xa4078
movb $0x0, -0x91(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0xb2b40
movq -0x410(%rbp), %rdi
callq 0xb2b10
movq %rax, -0xb8(%rbp)
leaq -0xb8(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0xb2b60
testb $0x1, %al
jne 0xa40b7
jmp 0xa41a0
movq -0x408(%rbp), %rax
movq 0xa8(%rax), %rax
movq %rax, -0x448(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0xb2af0
movq %rax, %rsi
addq $0x8, %rsi
leaq -0xe8(%rbp), %rdi
callq 0xb2bc0
jmp 0xa40ed
movq -0x448(%rbp), %rsi
leaq -0xd0(%rbp), %rdi
leaq -0xe8(%rbp), %rdx
callq 0x117e60
jmp 0xa4109
leaq -0xb0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xb2b90
jmp 0xa411e
leaq -0xd0(%rbp), %rdi
callq 0xb2660
leaq -0xe8(%rbp), %rdi
callq 0xb2660
leaq -0xb8(%rbp), %rdi
callq 0xb2cb0
jmp 0xa409e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xa5c54
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xa5af6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xa418f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0xb2660
leaq -0xe8(%rbp), %rdi
callq 0xb2660
jmp 0xa5af6
leaq -0x118(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0xb2ce0
jmp 0xa41b5
movq -0x408(%rbp), %rsi
leaq -0x100(%rbp), %rdi
leaq -0x118(%rbp), %rdx
callq 0xa34c0
jmp 0xa41d1
leaq -0x118(%rbp), %rdi
callq 0xb2dd0
movq 0x230d6c(%rip), %rdi    # 0x2d4f50
leaq 0x1369ee(%rip), %rsi    # 0x1dabd9
callq 0x2ff50
movq %rax, -0x450(%rbp)
jmp 0xa41f9
movq -0x450(%rbp), %rdi
movq 0x230dc1(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xa420e
leaq -0x130(%rbp), %rdi
callq 0xb2580
movl $0x0, -0x134(%rbp)
movl -0x134(%rbp), %eax
movq %rax, -0x458(%rbp)
leaq -0x100(%rbp), %rdi
callq 0xb25c0
movq %rax, %rcx
movq -0x458(%rbp), %rax
cmpq %rcx, %rax
jae 0xa44e8
movl -0x134(%rbp), %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
callq 0xb2610
movsd (%rax), %xmm0
movsd %xmm0, -0x460(%rbp)
movss -0x60(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x468(%rbp)
movl -0x134(%rbp), %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
callq 0xb2610
movsd (%rax), %xmm0
movsd %xmm0, -0x470(%rbp)
leaq -0x80(%rbp), %rdi
callq 0xb2af0
movq %rax, %rdi
addq $0x8, %rdi
movl -0x134(%rbp), %eax
movl %eax, %esi
callq 0xb2610
movsd -0x470(%rbp), %xmm2
movsd -0x468(%rbp), %xmm0
movsd -0x460(%rbp), %xmm1
subsd (%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x140(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x140(%rbp), %xmm0
jae 0xa430d
movsd -0x140(%rbp), %xmm0
movsd 0x136821(%rip), %xmm1   # 0x1dab28
ucomisd %xmm1, %xmm0
jbe 0xa4344
movb $0x1, -0x91(%rbp)
jmp 0xa4344
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x118(%rbp), %rdi
callq 0xb2dd0
jmp 0xa5af6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xa5aea
movq 0x230c05(%rip), %rdi    # 0x2d4f50
leaq 0x136892(%rip), %rsi    # 0x1dabe4
callq 0x2ff50
movq %rax, -0x478(%rbp)
jmp 0xa4360
movl -0x134(%rbp), %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
callq 0xb2610
movq -0x478(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x30710
movq %rax, -0x480(%rbp)
jmp 0xa438d
movq -0x480(%rbp), %rdi
leaq 0x136862(%rip), %rsi    # 0x1dabfd
callq 0x2ff50
movq %rax, -0x488(%rbp)
jmp 0xa43a9
movq -0x488(%rbp), %rdi
movss -0x60(%rbp), %xmm0
callq 0x30ce0
movq %rax, -0x490(%rbp)
jmp 0xa43c3
movq -0x490(%rbp), %rdi
leaq 0x136830(%rip), %rsi    # 0x1dac01
callq 0x2ff50
movq %rax, -0x498(%rbp)
jmp 0xa43df
movl -0x134(%rbp), %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
callq 0xb2610
movq -0x498(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x30710
movq %rax, -0x4a0(%rbp)
jmp 0xa440c
movq -0x4a0(%rbp), %rdi
leaq 0x1367ec(%rip), %rsi    # 0x1dac06
callq 0x2ff50
movq %rax, -0x4a8(%rbp)
jmp 0xa4428
leaq -0x80(%rbp), %rdi
callq 0xb2af0
movq %rax, %rdi
addq $0x8, %rdi
movl -0x134(%rbp), %eax
movl %eax, %esi
callq 0xb2610
movq -0x4a8(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x30710
movq %rax, -0x4b0(%rbp)
jmp 0xa445e
movq -0x4b0(%rbp), %rdi
leaq 0x13e858(%rip), %rsi    # 0x1e2cc4
callq 0x2ff50
movq %rax, -0x4b8(%rbp)
jmp 0xa447a
movq -0x4b8(%rbp), %rdi
movsd -0x140(%rbp), %xmm0
callq 0x30710
movq %rax, -0x4c0(%rbp)
jmp 0xa4497
movq -0x4c0(%rbp), %rdi
movq 0x230b23(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xa44ac
leaq -0x130(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0xb2e30
jmp 0xa44c1
jmp 0xa44c3
movl -0x134(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x134(%rbp)
jmp 0xa4224
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xa5ade
movq -0x408(%rbp), %rax
movq 0xa8(%rax), %rax
movq %rax, -0x4c8(%rbp)
leaq -0x170(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0xb2bc0
jmp 0xa4512
movq -0x4c8(%rbp), %rsi
leaq -0x158(%rbp), %rdi
leaq -0x170(%rbp), %rdx
callq 0x117f40
jmp 0xa452e
leaq -0x170(%rbp), %rdi
callq 0xb2660
leaq -0x158(%rbp), %rdi
callq 0xb2ea0
movq %rax, -0x178(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x9c670
movq %rax, -0x180(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x966d0
movq %rax, -0x188(%rbp)
leaq -0x180(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x9c6a0
testb $0x1, %al
jne 0xa4586
jmp 0xa45ee
leaq -0x178(%rbp), %rdi
callq 0xb2ed0
movsd (%rax), %xmm0
movsd %xmm0, -0x4d0(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x9c7b0
movsd -0x4d0(%rbp), %xmm0
movsd %xmm0, 0x20(%rax)
leaq -0x178(%rbp), %rdi
callq 0xb2ef0
leaq -0x180(%rbp), %rdi
callq 0x97360
jmp 0xa455d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x170(%rbp), %rdi
callq 0xb2660
jmp 0xa5ade
testb $0x1, -0x91(%rbp)
jne 0xa46ef
movl $0x1, -0x194(%rbp)
movq -0x408(%rbp), %rcx
movl -0x194(%rbp), %eax
movq 0xa8(%rcx), %rcx
cmpl 0x1658(%rcx), %eax
ja 0xa4662
movq -0x50(%rbp), %rdi
movl -0x194(%rbp), %esi
movl $0x1, %edx
callq 0xa5c70
jmp 0xa4637
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
movl -0x194(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x194(%rbp)
jmp 0xa4605
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xa5ad2
movq -0x408(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x1, 0x1658(%rax)
jbe 0xa4686
movq -0x50(%rbp), %rdi
callq 0xa8680
jmp 0xa4684
jmp 0xa4686
movq -0x50(%rbp), %rdi
movl $0x1, %esi
callq 0xa86b0
jmp 0xa4696
movq -0x408(%rbp), %rdi
addq $0x18, %rdi
movl -0x14(%rbp), %eax
movl %eax, %esi
callq 0xb2f10
movq %rax, -0x4d8(%rbp)
jmp 0xa46b4
movq -0x4d8(%rbp), %rdi
movl $0xffffffff, -0x198(%rbp) # imm = 0xFFFFFFFF
leaq -0x198(%rbp), %rsi
callq 0xb2f50
movq %rax, -0x4e0(%rbp)
jmp 0xa46da
movq -0x4e0(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x190(%rbp)
jmp 0xa471c
movb $0x0, -0x91(%rbp)
movl $0xa, %esi
movl %esi, %edi
callq 0xb3030
movsd %xmm0, -0x4e8(%rbp)
jmp 0xa470c
movsd -0x4e8(%rbp), %xmm0
movsd %xmm0, -0x190(%rbp)
movq 0x23082d(%rip), %rdi    # 0x2d4f50
leaq 0x1364e0(%rip), %rsi    # 0x1dac0a
callq 0x2ff50
movq %rax, -0x4f0(%rbp)
jmp 0xa4738
movq -0x4f0(%rbp), %rdi
movsd -0x190(%rbp), %xmm0
callq 0x30710
movq %rax, -0x4f8(%rbp)
jmp 0xa4755
movq -0x4f8(%rbp), %rdi
movq 0x230865(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xa476a
movsd -0x190(%rbp), %xmm0
movsd %xmm0, -0x500(%rbp)
leaq -0x90(%rbp), %rdi
callq 0xb2af0
movsd -0x500(%rbp), %xmm0
ucomisd (%rax), %xmm0
jbe 0xa49d0
movsd -0x190(%rbp), %xmm0
movsd %xmm0, -0x508(%rbp)
leaq -0x88(%rbp), %rdi
callq 0xb2af0
movsd -0x508(%rbp), %xmm1
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xa49d0
movq -0x408(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xa4836
movq 0x230768(%rip), %rdi    # 0x2d4f50
leaq 0x136428(%rip), %rsi    # 0x1dac17
callq 0x2ff50
movq %rax, -0x510(%rbp)
jmp 0xa47fd
leaq -0x80(%rbp), %rdi
callq 0xb2af0
movq -0x510(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x30710
movq %rax, -0x518(%rbp)
jmp 0xa481f
movq -0x518(%rbp), %rdi
movq 0x23079b(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xa4834
jmp 0xa4836
movq -0x410(%rbp), %rdi
movq -0x80(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movq -0x1a0(%rbp), %rsi
callq 0xb3060
movq %rax, -0x520(%rbp)
jmp 0xa485d
movq -0x408(%rbp), %rax
movq -0x520(%rbp), %rcx
movq %rcx, -0x1a8(%rbp)
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xa48d9
movq 0x2306c7(%rip), %rdi    # 0x2d4f50
leaq 0x1363ce(%rip), %rsi    # 0x1dac5e
callq 0x2ff50
movq %rax, -0x528(%rbp)
jmp 0xa489e
movq -0x410(%rbp), %rdi
callq 0xb30a0
movq -0x528(%rbp), %rdi
movq %rax, %rsi
callq 0x30cf0
movq %rax, -0x530(%rbp)
jmp 0xa48c2
movq -0x530(%rbp), %rdi
movq 0x2306f8(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xa48d7
jmp 0xa48d9
leaq -0x1c8(%rbp), %rdi
leaq -0x190(%rbp), %rsi
leaq -0x130(%rbp), %rdx
callq 0xb3100
jmp 0xa48f5
movq -0x410(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
callq 0xb30c0
movb %dl, -0x539(%rbp)
movq %rax, -0x538(%rbp)
jmp 0xa4917
movb -0x539(%rbp), %al
movq -0x538(%rbp), %rcx
movq %rcx, -0x1d8(%rbp)
movb %al, -0x1d0(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0xb3140
movq -0x408(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xa49c1
movq 0x2305f5(%rip), %rdi    # 0x2d4f50
leaq 0x136307(%rip), %rsi    # 0x1dac69
callq 0x2ff50
movq %rax, -0x548(%rbp)
jmp 0xa4970
movq -0x548(%rbp), %rdi
movsd -0x190(%rbp), %xmm0
callq 0x30710
movq %rax, -0x550(%rbp)
jmp 0xa498d
movq -0x550(%rbp), %rdi
movq 0x23062d(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xa49a2
jmp 0xa49c1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0xb3140
jmp 0xa5ad2
movl $0x2, -0x1dc(%rbp)
jmp 0xa5a8c
movsd -0x190(%rbp), %xmm0
movsd %xmm0, -0x558(%rbp)
leaq -0x90(%rbp), %rdi
callq 0xb2af0
movsd -0x558(%rbp), %xmm1
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xa51bd
movq -0x408(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xa4a4c
movq 0x230530(%rip), %rdi    # 0x2d4f50
leaq 0x136256(%rip), %rsi    # 0x1dac7d
callq 0x2ff50
movq %rax, -0x560(%rbp)
jmp 0xa4a35
movq -0x560(%rbp), %rdi
movq 0x230585(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xa4a4a
jmp 0xa4a4c
leaq -0x1f8(%rbp), %rdi
callq 0xb2580
movl $0x0, -0x1fc(%rbp)
movl -0x1fc(%rbp), %eax
movq %rax, -0x568(%rbp)
leaq -0x100(%rbp), %rdi
callq 0xb25c0
movq %rax, %rcx
movq -0x568(%rbp), %rax
cmpq %rcx, %rax
jae 0xa4d01
movl -0x1fc(%rbp), %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
callq 0xb2610
movsd (%rax), %xmm0
movsd %xmm0, -0x570(%rbp)
movss -0x64(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x578(%rbp)
movl -0x1fc(%rbp), %eax
movl %eax, %esi
leaq -0x130(%rbp), %rdi
callq 0xb2610
movsd (%rax), %xmm0
movsd %xmm0, -0x580(%rbp)
movl -0x1fc(%rbp), %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
callq 0xb2610
movsd -0x580(%rbp), %xmm2
movsd -0x578(%rbp), %xmm0
movsd -0x570(%rbp), %xmm1
subsd (%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x208(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x208(%rbp), %xmm0
jae 0xa4b42
movsd -0x208(%rbp), %xmm0
movsd 0x135fec(%rip), %xmm1   # 0x1dab28
ucomisd %xmm1, %xmm0
jbe 0xa4b49
movb $0x1, -0x91(%rbp)
leaq -0x1f8(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0xb2e30
jmp 0xa4b5e
movq -0x408(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xa4ceb
movq 0x2303d0(%rip), %rdi    # 0x2d4f50
leaq 0x13605d(%rip), %rsi    # 0x1dabe4
callq 0x2ff50
movq %rax, -0x588(%rbp)
jmp 0xa4b95
movl -0x1fc(%rbp), %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
callq 0xb2610
movq -0x588(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x30710
movq %rax, -0x590(%rbp)
jmp 0xa4bc2
movq -0x590(%rbp), %rdi
leaq 0x13602d(%rip), %rsi    # 0x1dabfd
callq 0x2ff50
movq %rax, -0x598(%rbp)
jmp 0xa4bde
movq -0x598(%rbp), %rdi
movss -0x64(%rbp), %xmm0
callq 0x30ce0
movq %rax, -0x5a0(%rbp)
jmp 0xa4bf8
movq -0x5a0(%rbp), %rdi
leaq 0x135ffb(%rip), %rsi    # 0x1dac01
callq 0x2ff50
movq %rax, -0x5a8(%rbp)
jmp 0xa4c14
movl -0x1fc(%rbp), %eax
movl %eax, %esi
leaq -0x130(%rbp), %rdi
callq 0xb2610
movq -0x5a8(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x30710
movq %rax, -0x5b0(%rbp)
jmp 0xa4c41
movq -0x5b0(%rbp), %rdi
leaq 0x135fb7(%rip), %rsi    # 0x1dac06
callq 0x2ff50
movq %rax, -0x5b8(%rbp)
jmp 0xa4c5d
movl -0x1fc(%rbp), %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
callq 0xb2610
movq -0x5b8(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x30710
movq %rax, -0x5c0(%rbp)
jmp 0xa4c8a
movq -0x5c0(%rbp), %rdi
leaq 0x13e02c(%rip), %rsi    # 0x1e2cc4
callq 0x2ff50
movq %rax, -0x5c8(%rbp)
jmp 0xa4ca6
movq -0x5c8(%rbp), %rdi
movsd -0x208(%rbp), %xmm0
callq 0x30710
movq %rax, -0x5d0(%rbp)
jmp 0xa4cc3
movq -0x5d0(%rbp), %rdi
movq 0x2302f7(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xa4cd8
jmp 0xa4ceb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xa51ac
jmp 0xa4ced
movl -0x1fc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1fc(%rbp)
jmp 0xa4a62
movq -0x408(%rbp), %rax
movq 0xa8(%rax), %rax
movq %rax, -0x5d8(%rbp)
leaq -0x238(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0xb2bc0
jmp 0xa4d2b
movq -0x5d8(%rbp), %rsi
leaq -0x220(%rbp), %rdi
leaq -0x238(%rbp), %rdx
callq 0x117f40
jmp 0xa4d47
leaq -0x238(%rbp), %rdi
callq 0xb2660
leaq -0x220(%rbp), %rdi
callq 0xb2ea0
movq %rax, -0x240(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x9c670
movq %rax, -0x248(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x966d0
movq %rax, -0x250(%rbp)
leaq -0x248(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x9c6a0
testb $0x1, %al
jne 0xa4d9f
jmp 0xa4e07
leaq -0x240(%rbp), %rdi
callq 0xb2ed0
movsd (%rax), %xmm0
movsd %xmm0, -0x5e0(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x9c7b0
movsd -0x5e0(%rbp), %xmm0
movsd %xmm0, 0x20(%rax)
leaq -0x240(%rbp), %rdi
callq 0xb2ef0
leaq -0x248(%rbp), %rdi
callq 0x97360
jmp 0xa4d76
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x238(%rbp), %rdi
callq 0xb2660
jmp 0xa51ac
testb $0x1, -0x91(%rbp)
jne 0xa4f56
movl $0x1, -0x25c(%rbp)
movq -0x408(%rbp), %rcx
movl -0x25c(%rbp), %eax
movq 0xa8(%rcx), %rcx
cmpl 0x1658(%rcx), %eax
ja 0xa4e7b
movq -0x50(%rbp), %rdi
movl -0x25c(%rbp), %esi
movl $0x1, %edx
callq 0xa5c70
jmp 0xa4e50
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
movl -0x25c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x25c(%rbp)
jmp 0xa4e1e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xa51a0
movq -0x408(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x1, 0x1658(%rax)
jbe 0xa4e9f
movq -0x50(%rbp), %rdi
callq 0xa8680
jmp 0xa4e9d
jmp 0xa4e9f
movq -0x50(%rbp), %rdi
movl $0x1, %esi
callq 0xa86b0
jmp 0xa4eaf
movq -0x408(%rbp), %rdi
addq $0x18, %rdi
movl -0x14(%rbp), %eax
movl %eax, %esi
callq 0xb2f10
movq %rax, -0x5e8(%rbp)
jmp 0xa4ecd
movq -0x5e8(%rbp), %rdi
movl $0xffffffff, -0x260(%rbp) # imm = 0xFFFFFFFF
leaq -0x260(%rbp), %rsi
callq 0xb2f50
movq %rax, -0x5f0(%rbp)
jmp 0xa4ef3
movq -0x5f0(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x258(%rbp)
movq 0x230043(%rip), %rdi    # 0x2d4f50
leaq 0x135d94(%rip), %rsi    # 0x1daca8
callq 0x2ff50
movq %rax, -0x5f8(%rbp)
jmp 0xa4f22
movq -0x5f8(%rbp), %rdi
movsd -0x258(%rbp), %xmm0
callq 0x30710
movq %rax, -0x600(%rbp)
jmp 0xa4f3f
movq -0x600(%rbp), %rdi
movq 0x23007b(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xa4f54
jmp 0xa4f83
movl $0xa, %esi
movl %esi, %edi
callq 0xb3030
movsd %xmm0, -0x608(%rbp)
jmp 0xa4f6c
movsd -0x608(%rbp), %xmm0
movsd %xmm0, -0x258(%rbp)
movb $0x0, -0x91(%rbp)
movsd -0x258(%rbp), %xmm1
movsd -0x190(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xa5093
movq 0x22ffac(%rip), %rdi    # 0x2d4f50
leaq 0x135d09(%rip), %rsi    # 0x1dacb4
callq 0x2ff50
movq %rax, -0x610(%rbp)
jmp 0xa4fb9
movq -0x610(%rbp), %rdi
movq 0x230001(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xa4fce
movq -0x410(%rbp), %rdi
movq -0x80(%rbp), %rax
movq %rax, -0x268(%rbp)
movq -0x268(%rbp), %rsi
callq 0xb3060
movq %rax, -0x618(%rbp)
jmp 0xa4ff5
movq -0x618(%rbp), %rax
movq %rax, -0x270(%rbp)
leaq -0x290(%rbp), %rdi
leaq -0x258(%rbp), %rsi
leaq -0x1f8(%rbp), %rdx
callq 0xb3100
jmp 0xa501f
movq -0x410(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0xb30c0
movb %dl, -0x621(%rbp)
movq %rax, -0x620(%rbp)
jmp 0xa5041
movb -0x621(%rbp), %al
movq -0x620(%rbp), %rcx
movq %rcx, -0x2a0(%rbp)
movb %al, -0x298(%rbp)
leaq -0x290(%rbp), %rdi
callq 0xb3140
movl $0x2, -0x1dc(%rbp)
jmp 0xa5183
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x290(%rbp), %rdi
callq 0xb3140
jmp 0xa51a0
movq 0x22feb6(%rip), %rdi    # 0x2d4f50
leaq 0x135c42(%rip), %rsi    # 0x1dace3
callq 0x2ff50
movq %rax, -0x630(%rbp)
jmp 0xa50af
movq -0x630(%rbp), %rdi
movq 0x22ff0b(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xa50c4
movq -0x410(%rbp), %rdi
movq -0x80(%rbp), %rax
movq %rax, -0x2a8(%rbp)
movq -0x2a8(%rbp), %rsi
callq 0xb3060
movq %rax, -0x638(%rbp)
jmp 0xa50eb
movq -0x638(%rbp), %rax
movq %rax, -0x2b0(%rbp)
leaq -0x2d0(%rbp), %rdi
leaq -0x190(%rbp), %rsi
leaq -0x130(%rbp), %rdx
callq 0xb3100
jmp 0xa5115
movq -0x410(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0xb30c0
movb %dl, -0x641(%rbp)
movq %rax, -0x640(%rbp)
jmp 0xa5137
movb -0x641(%rbp), %al
movq -0x640(%rbp), %rcx
movq %rcx, -0x2e0(%rbp)
movb %al, -0x2d8(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0xb3140
movl $0x2, -0x1dc(%rbp)
jmp 0xa5183
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0xb3140
jmp 0xa51a0
leaq -0x220(%rbp), %rdi
callq 0xb2660
leaq -0x1f8(%rbp), %rdi
callq 0xb2660
jmp 0xa5a8c
leaq -0x220(%rbp), %rdi
callq 0xb2660
leaq -0x1f8(%rbp), %rdi
callq 0xb2660
jmp 0xa5ad2
movsd -0x190(%rbp), %xmm0
movsd %xmm0, -0x650(%rbp)
leaq -0x88(%rbp), %rdi
callq 0xb2af0
movsd -0x650(%rbp), %xmm0
ucomisd (%rax), %xmm0
jbe 0xa5a7e
movq 0x22fd5e(%rip), %rdi    # 0x2d4f50
leaq 0x135b18(%rip), %rsi    # 0x1dad11
callq 0x2ff50
movq %rax, -0x658(%rbp)
jmp 0xa5207
movq -0x658(%rbp), %rdi
movq 0x22fdb3(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xa521c
leaq -0x2f8(%rbp), %rdi
callq 0xb2580
movl $0x0, -0x2fc(%rbp)
movl -0x2fc(%rbp), %eax
movq %rax, -0x660(%rbp)
leaq -0x100(%rbp), %rdi
callq 0xb25c0
movq %rax, %rcx
movq -0x660(%rbp), %rax
cmpq %rcx, %rax
jae 0xa54c6
movl -0x2fc(%rbp), %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
callq 0xb2610
movsd (%rax), %xmm0
movsd %xmm0, -0x668(%rbp)
movss -0x68(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x670(%rbp)
leaq -0x80(%rbp), %rdi
callq 0xb2af0
movq %rax, %rdi
addq $0x8, %rdi
movl -0x2fc(%rbp), %eax
movl %eax, %esi
callq 0xb2610
movsd (%rax), %xmm0
movsd %xmm0, -0x678(%rbp)
movl -0x2fc(%rbp), %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
callq 0xb2610
movsd -0x678(%rbp), %xmm2
movsd -0x670(%rbp), %xmm0
movsd -0x668(%rbp), %xmm1
subsd (%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x308(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x308(%rbp), %xmm0
jae 0xa531b
movsd -0x308(%rbp), %xmm0
movsd 0x135813(%rip), %xmm1   # 0x1dab28
ucomisd %xmm1, %xmm0
jbe 0xa5322
movb $0x1, -0x91(%rbp)
leaq -0x2f8(%rbp), %rdi
leaq -0x308(%rbp), %rsi
callq 0xb2e30
jmp 0xa5337
movq 0x22fc12(%rip), %rdi    # 0x2d4f50
leaq 0x13589f(%rip), %rsi    # 0x1dabe4
callq 0x2ff50
movq %rax, -0x680(%rbp)
jmp 0xa5353
movl -0x2fc(%rbp), %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
callq 0xb2610
movq -0x680(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x30710
movq %rax, -0x688(%rbp)
jmp 0xa5380
movq -0x688(%rbp), %rdi
leaq 0x13586f(%rip), %rsi    # 0x1dabfd
callq 0x2ff50
movq %rax, -0x690(%rbp)
jmp 0xa539c
movq -0x690(%rbp), %rdi
movss -0x68(%rbp), %xmm0
callq 0x30ce0
movq %rax, -0x698(%rbp)
jmp 0xa53b6
movq -0x698(%rbp), %rdi
leaq 0x13583d(%rip), %rsi    # 0x1dac01
callq 0x2ff50
movq %rax, -0x6a0(%rbp)
jmp 0xa53d2
leaq -0x80(%rbp), %rdi
callq 0xb2af0
movq %rax, %rdi
addq $0x8, %rdi
movl -0x2fc(%rbp), %eax
movl %eax, %esi
callq 0xb2610
movq -0x6a0(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x30710
movq %rax, -0x6a8(%rbp)
jmp 0xa5408
movq -0x6a8(%rbp), %rdi
leaq 0x1357f0(%rip), %rsi    # 0x1dac06
callq 0x2ff50
movq %rax, -0x6b0(%rbp)
jmp 0xa5424
movl -0x2fc(%rbp), %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
callq 0xb2610
movq -0x6b0(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x30710
movq %rax, -0x6b8(%rbp)
jmp 0xa5451
movq -0x6b8(%rbp), %rdi
leaq 0x13d865(%rip), %rsi    # 0x1e2cc4
callq 0x2ff50
movq %rax, -0x6c0(%rbp)
jmp 0xa546d
movq -0x6c0(%rbp), %rdi
movsd -0x308(%rbp), %xmm0
callq 0x30710
movq %rax, -0x6c8(%rbp)
jmp 0xa548a
movq -0x6c8(%rbp), %rdi
movq 0x22fb30(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xa549f
jmp 0xa54a1
movl -0x2fc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2fc(%rbp)
jmp 0xa5232
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xa5a70
movq -0x408(%rbp), %rax
movq 0xa8(%rax), %rax
movq %rax, -0x6d0(%rbp)
leaq -0x338(%rbp), %rdi
leaq -0x2f8(%rbp), %rsi
callq 0xb2bc0
jmp 0xa54f0
movq -0x6d0(%rbp), %rsi
leaq -0x320(%rbp), %rdi
leaq -0x338(%rbp), %rdx
callq 0x117f40
jmp 0xa550c
leaq -0x338(%rbp), %rdi
callq 0xb2660
leaq -0x320(%rbp), %rdi
callq 0xb2ea0
movq %rax, -0x340(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x9c670
movq %rax, -0x348(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x966d0
movq %rax, -0x350(%rbp)
leaq -0x348(%rbp), %rdi
leaq -0x350(%rbp), %rsi
callq 0x9c6a0
testb $0x1, %al
jne 0xa5564
jmp 0xa55cc
leaq -0x340(%rbp), %rdi
callq 0xb2ed0
movsd (%rax), %xmm0
movsd %xmm0, -0x6d8(%rbp)
leaq -0x348(%rbp), %rdi
callq 0x9c7b0
movsd -0x6d8(%rbp), %xmm0
movsd %xmm0, 0x20(%rax)
leaq -0x340(%rbp), %rdi
callq 0xb2ef0
leaq -0x348(%rbp), %rdi
callq 0x97360
jmp 0xa553b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x338(%rbp), %rdi
callq 0xb2660
jmp 0xa5a70
testb $0x1, -0x91(%rbp)
jne 0xa5727
movl $0x1, -0x35c(%rbp)
movq -0x408(%rbp), %rcx
movl -0x35c(%rbp), %eax
movq 0xa8(%rcx), %rcx
cmpl 0x1658(%rcx), %eax
ja 0xa5640
movq -0x50(%rbp), %rdi
movl -0x35c(%rbp), %esi
movl $0x1, %edx
callq 0xa5c70
jmp 0xa5615
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
movl -0x35c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x35c(%rbp)
jmp 0xa55e3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xa5a64
movq -0x408(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x1, 0x1658(%rax)
jbe 0xa566a
movq -0x408(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0xa86f0
jmp 0xa5668
jmp 0xa566a
movq -0x408(%rbp), %rdi
movl -0x14(%rbp), %edx
movl $0x1, %esi
callq 0xa9130
jmp 0xa5680
movq -0x408(%rbp), %rdi
addq $0x18, %rdi
movl -0x14(%rbp), %eax
movl %eax, %esi
callq 0xb2f10
movq %rax, -0x6e0(%rbp)
jmp 0xa569e
movq -0x6e0(%rbp), %rdi
movl $0xffffffff, -0x360(%rbp) # imm = 0xFFFFFFFF
leaq -0x360(%rbp), %rsi
callq 0xb2f50
movq %rax, -0x6e8(%rbp)
jmp 0xa56c4
movq -0x6e8(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x358(%rbp)
movq 0x22f872(%rip), %rdi    # 0x2d4f50
leaq 0x135659(%rip), %rsi    # 0x1dad3e
callq 0x2ff50
movq %rax, -0x6f0(%rbp)
jmp 0xa56f3
movq -0x6f0(%rbp), %rdi
movsd -0x358(%rbp), %xmm0
callq 0x30710
movq %rax, -0x6f8(%rbp)
jmp 0xa5710
movq -0x6f8(%rbp), %rdi
movq 0x22f8aa(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xa5725
jmp 0xa5754
movb $0x0, -0x91(%rbp)
movl $0xa, %esi
movl %esi, %edi
callq 0xb3030
movsd %xmm0, -0x700(%rbp)
jmp 0xa5744
movsd -0x700(%rbp), %xmm0
movsd %xmm0, -0x358(%rbp)
movsd -0x358(%rbp), %xmm0
movsd %xmm0, -0x708(%rbp)
leaq -0x80(%rbp), %rdi
callq 0xb2af0
movsd -0x708(%rbp), %xmm1
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xa5879
movq 0x22f7c6(%rip), %rdi    # 0x2d4f50
leaq 0x1355bb(%rip), %rsi    # 0x1dad4c
callq 0x2ff50
movq %rax, -0x710(%rbp)
jmp 0xa579f
movq -0x710(%rbp), %rdi
movq 0x22f81b(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xa57b4
movq -0x410(%rbp), %rdi
movq -0x80(%rbp), %rax
movq %rax, -0x368(%rbp)
movq -0x368(%rbp), %rsi
callq 0xb3060
movq %rax, -0x718(%rbp)
jmp 0xa57db
movq -0x718(%rbp), %rax
movq %rax, -0x370(%rbp)
leaq -0x390(%rbp), %rdi
leaq -0x358(%rbp), %rsi
leaq -0x2f8(%rbp), %rdx
callq 0xb3100
jmp 0xa5805
movq -0x410(%rbp), %rdi
leaq -0x390(%rbp), %rsi
callq 0xb30c0
movb %dl, -0x721(%rbp)
movq %rax, -0x720(%rbp)
jmp 0xa5827
movb -0x721(%rbp), %al
movq -0x720(%rbp), %rcx
movq %rcx, -0x3a0(%rbp)
movb %al, -0x398(%rbp)
leaq -0x390(%rbp), %rdi
callq 0xb3140
movl $0x2, -0x1dc(%rbp)
jmp 0xa5a3e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x390(%rbp), %rdi
callq 0xb3140
jmp 0xa5a64
movq -0x410(%rbp), %rdi
callq 0xb2b10
movq %rax, -0x3b0(%rbp)
leaq -0x3b0(%rbp), %rdi
callq 0xb2cb0
movq (%rax), %rax
movq %rax, -0x3a8(%rbp)
movq -0x410(%rbp), %rdi
callq 0xb2a70
movq %rax, -0x3b8(%rbp)
leaq -0x3a8(%rbp), %rdi
leaq -0x3b8(%rbp), %rsi
callq 0xb2b60
testb $0x1, %al
jne 0xa58d1
jmp 0xa5a32
movl $0x0, -0x3bc(%rbp)
movl -0x3bc(%rbp), %eax
movq %rax, -0x730(%rbp)
leaq -0x100(%rbp), %rdi
callq 0xb25c0
movq %rax, %rcx
movq -0x730(%rbp), %rax
cmpq %rcx, %rax
jae 0xa5a1f
movq -0x410(%rbp), %rdi
callq 0xb2b10
movq %rax, -0x3d0(%rbp)
leaq -0x3d0(%rbp), %rdi
callq 0xb2af0
movq %rax, %rdi
addq $0x8, %rdi
movl -0x3bc(%rbp), %eax
movl %eax, %esi
callq 0xb2610
movsd (%rax), %xmm0
movsd %xmm0, -0x740(%rbp)
movss -0x6c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x748(%rbp)
leaq -0x3a8(%rbp), %rdi
callq 0xb2af0
movq %rax, %rdi
addq $0x8, %rdi
movl -0x3bc(%rbp), %eax
movl %eax, %esi
callq 0xb2610
movsd (%rax), %xmm0
movsd %xmm0, -0x750(%rbp)
leaq -0x90(%rbp), %rdi
callq 0xb2af0
movq %rax, %rdi
addq $0x8, %rdi
movl -0x3bc(%rbp), %eax
movl %eax, %esi
callq 0xb2610
movsd -0x750(%rbp), %xmm2
movsd -0x748(%rbp), %xmm0
movsd -0x740(%rbp), %xmm1
subsd (%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x3c8(%rbp)
movsd -0x3c8(%rbp), %xmm0
movsd %xmm0, -0x738(%rbp)
leaq -0x3a8(%rbp), %rdi
callq 0xb2af0
movq %rax, %rdi
addq $0x8, %rdi
movl -0x3bc(%rbp), %eax
movl %eax, %esi
callq 0xb2610
movsd -0x738(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x3bc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3bc(%rbp)
jmp 0xa58db
jmp 0xa5a21
leaq -0x3a8(%rbp), %rdi
callq 0xb2cb0
jmp 0xa58a2
jmp 0xa5a34
movl $0x0, -0x1dc(%rbp)
leaq -0x320(%rbp), %rdi
callq 0xb2660
leaq -0x2f8(%rbp), %rdi
callq 0xb2660
movl -0x1dc(%rbp), %eax
testl %eax, %eax
jne 0xa5a8c
jmp 0xa5a62
jmp 0xa5a7e
leaq -0x320(%rbp), %rdi
callq 0xb2660
leaq -0x2f8(%rbp), %rdi
callq 0xb2660
jmp 0xa5ad2
jmp 0xa5a80
jmp 0xa5a82
movl $0x0, -0x1dc(%rbp)
leaq -0x158(%rbp), %rdi
callq 0xb2660
leaq -0x130(%rbp), %rdi
callq 0xb2660
leaq -0x100(%rbp), %rdi
callq 0xb2660
leaq -0xb0(%rbp), %rdi
callq 0xb2dd0
movl -0x1dc(%rbp), %eax
testl %eax, %eax
je 0xa5acd
jmp 0xa5ac8
jmp 0xa3f1c
jmp 0xa3f1c
leaq -0x158(%rbp), %rdi
callq 0xb2660
leaq -0x130(%rbp), %rdi
callq 0xb2660
leaq -0x100(%rbp), %rdi
callq 0xb2660
leaq -0xb0(%rbp), %rdi
callq 0xb2dd0
jmp 0xa5c54
movq -0x410(%rbp), %rdi
callq 0xb2b10
movq %rax, -0x3d8(%rbp)
leaq -0x3d8(%rbp), %rdi
callq 0xb2af0
movq -0x408(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x760(%rbp)
addq $0x18, %rdi
movl -0x14(%rbp), %eax
movl %eax, %esi
callq 0xb2f10
movq %rax, -0x758(%rbp)
jmp 0xa5b50
movq -0x758(%rbp), %rdi
movl $0xffffffff, -0x3dc(%rbp) # imm = 0xFFFFFFFF
leaq -0x3dc(%rbp), %rsi
callq 0xb2f50
movq %rax, -0x768(%rbp)
jmp 0xa5b76
movq -0x768(%rbp), %rax
movsd -0x760(%rbp), %xmm0
movsd %xmm0, (%rax)
movl $0x0, -0x3e0(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x9c670
movq %rax, -0x3e8(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x966d0
movq %rax, -0x3f0(%rbp)
leaq -0x3e8(%rbp), %rdi
leaq -0x3f0(%rbp), %rsi
callq 0x9c6a0
testb $0x1, %al
jne 0xa5bcc
jmp 0xa5c42
movq -0x410(%rbp), %rdi
callq 0xb2b10
movq %rax, -0x3f8(%rbp)
leaq -0x3f8(%rbp), %rdi
callq 0xb2af0
movq %rax, %rdi
addq $0x8, %rdi
movl -0x3e0(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x3e0(%rbp)
movl %eax, %eax
movl %eax, %esi
callq 0xb2610
movsd (%rax), %xmm0
movsd %xmm0, -0x770(%rbp)
leaq -0x3e8(%rbp), %rdi
callq 0x9c7b0
movsd -0x770(%rbp), %xmm0
movsd %xmm0, 0x20(%rax)
leaq -0x3e8(%rbp), %rdi
callq 0x97360
jmp 0xa5ba3
leaq -0x48(%rbp), %rdi
callq 0x8de70
addq $0x770, %rsp            # imm = 0x770
popq %rbp
retq
leaq -0x48(%rbp), %rdi
callq 0x8de70
movq -0x58(%rbp), %rdi
callq 0x30170
nopw %cs:(%rax,%rax)