// File: /workspace/github_cpp_makefile_star2_O3/richardposner[P]BioNetFit2/src/code/Swarm.cpp
// Function: Swarm::runAGA()
void Swarm::runAGA() {
	if (options.verbosity >= 3) {
		cout << "Running an asynchronous genetic fit" << endl;
	}

	if (!checkIfFileExists(options.jobOutputDir + "1")) {
		string createDirCmd = "mkdir " + options.jobOutputDir + "1";
		if (runCommand(createDirCmd) != 0) {
			outputError("Error: Couldn't create first generation output directory with command: " + createDirCmd + ". Quitting.");
		}
	}

	//int sp = 0;

	// Holds finished particles
	vector<unsigned int> finishedParticles;

	// Run the first generation
	runGeneration();

	// Save swarm state
	saveSwarmState();


	string outputPath = options.jobOutputDir + toString(currentGeneration - 1 ) + "_summary.txt";

	outputRunSummary(outputPath);

	cout << "Generation: " << toString(currentGeneration - 1 ) << endl;


	// Breed generation
	breedGenerationGA();


	// Re-launch the particles in to the Swarm proper
	/*for (int p = 1; p <= options.swarmSize; ++p) {


		//for(int mid = 0; mid < options.models.size(); mid++){

		//	launchSubParticle(p, mid, false);

		//}

		launchParticle(p, false);
	}

*/

	//int newFinishedPar = 0;

	//bool stopCriteria = false;
	//int iteration = 0;

	/*
	cout << "==================================ENTERING LOOP==================================" << endl;
	while (!stopCriteria){
		usleep(250000);
		cout << "RAQUEL Iteration " << iteration;
		iteration++;
		// Check for any messages from particles and store finished particles

		//finishedParticles = checkMasterMessages();
		finishedParticles = checkMasterMessages();
		newFinishedPar += finishedParticles.size();

		cout << "new finished particles " << newFinishedPar << endl;
		cout << "Running particles " << runningParticles_.size() << endl;
		cout << "Global finished " << finishedParticles_.size() << endl;
		cout << "Global finished sub " << finishedSubParticles_.size() << endl;

		// Check stop criteria
		cout << "Checking stop criteria" << endl;
		stopCriteria = checkStopCriteria();
		cout << "Done, stop criteria value = " << stopCriteria << endl;

		cout << "flightcounter = " << flightCounter_ << endl;
		cout << "max flightcounter" << options.maxNumSimulations << endl;

		// Cleanup old files if needed
		string currentDirectory = options.jobOutputDir + toString(currentGeneration);
		if (options.deleteOldFiles) {
			cleanupFiles(currentDirectory.c_str());
		}

		// If we haven't reached stop criteria, breed and re-launch finished particles
//		if (!stopCriteria && finishedParticles.size() >= options.swarmSize/2) {
		if (!stopCriteria && finishedParticles_.size() >= options.swarmSize/2) {
			cout << "RAQUEL preparing for asynchronous breed, 1/2 of particles are done" << endl;
			// Get new params for any finished particles
			//breedGenerationGA(finishedParticles);
			copy(finishedParticles_.begin(), finishedParticles_.end(), inserter(finishedParticles, finishedParticles.begin()));
			cout << "Async Particles done: " << finishedParticles.size() << endl;

			breedGenerationGA(finishedParticles);
			newFinishedPar = 0;

		//for(auto i = finishedParticles.begin(); i != finishedParticles.end(); ++i){
		//		for(int j=0; j < options.models.size(); j++){
		//			sp = fcalcsubParID(*i, j, options.models.size());
		//			cout << "sending nex gen to " << sp << endl;
		//			swarmComm->sendToSwarm(0, sp, NEXT_GENERATION, false, swarmComm->univMessageSender);
		//		}
		//	}
			//finishedParticles.clear();
			//finishedParticles_.clear();
			//finishedSubParticles_.clear(); //Raquel added to solve problem of less and less result files as generations go

			// Re-launch any finished particles
			for (auto pID = finishedParticles_.begin(); pID != finishedParticles_.end(); ++pID) {

				launchParticle(*pID, false);

			}

			currentGeneration++;
			flightCounter_++;



		}
	}
	*/
	bool stopCriteria = false;
	while (!stopCriteria){
		if (options.verbosity >= 4) {
			cout << "RAQUEL: Started runGeneration();" << endl;
		}
		runAsyncGeneration();
		if (options.verbosity >= 4) {
			cout << "RAQUEL: Finished runGeneration();" << endl;

			cout << "RAQUEL: Started checkStopCriteria();" << endl;
		}

		saveSwarmState();
		if (options.verbosity >= 4) {
			cout << "RAQUEL: Finished saveSwarmState();" << endl;
		}


		string currentDirectory = options.jobOutputDir + toString(currentGeneration);
		if (options.deleteOldFiles) {
			if (options.verbosity >= 4) {
				cout << "RAQUEL: Started cleanupFiles();" << endl;
			}
			cleanupFiles(currentDirectory.c_str());
			if (options.verbosity >= 4) {
				cout << "RAQUEL: Finished cleanupFiles();" << endl;
			}

		}

		string outputPath = options.jobOutputDir + toString(currentGeneration - 1 ) + "_summary.txt";

		outputRunSummary(outputPath);

		cout << "Generation: " << toString(currentGeneration - 1 ) << endl;

		stopCriteria = checkStopCriteria();
		if (options.verbosity >= 4) {
			cout << "RAQUEL: Stop criteria value is " << stopCriteria << endl;

			cout << "RAQUEL: Finished checkStopCriteria();" << endl;
			cout << "RAQUEL: Started saveSwarmState();" << endl;
		}

		if (!stopCriteria) {

			if(options.verbosity>=3){

				cout << "RAQUEL: started breedGenerationGA();" << endl;
			}
			finishedParticles.clear();
			for(auto i = finishedParticles_.begin(); i!=finishedParticles_.end(); ++i){
				//cout << "RAQUEL: processing particle number: " << *i << endl;
				finishedParticles.push_back(*i);
			}
			breedGenerationGA(finishedParticles);
			if(options.verbosity>=3){

				cout << "RAQUEL: finished breedGenerationGA();" << endl;
			}
		}

		currentsubswarmBestFits_.clear();

	}

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rdi, %rbx
cmpl $0x3, 0x1614(%rdi)
jb 0x80a57
movq 0xf558c(%rip), %r14     # 0x175fa8
leaq 0x7fe8e(%rip), %rsi     # 0x1008b1
movl $0x23, %edx
movq %r14, %rdi
callq 0x22ab0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r14, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
leaq 0xd8(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x1520(%rbx), %rsi
movq 0x1528(%rbx), %rdx
addq %rsi, %rdx
leaq 0xc8(%rsp), %r14
movq %r14, %rdi
callq 0x3213c
leaq 0x78151(%rip), %rsi     # 0xf8bdc
movq %r14, %rdi
callq 0x233b0
leaq 0xc8(%rsp), %rdi
callq 0xbe9a8
movl %eax, %ebp
movq 0xc8(%rsp), %rdi
cmpq %r15, %rdi
je 0x80abf
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x229c0
testl %ebp, %ebp
jne 0x80bc2
leaq 0x1520(%rbx), %rdx
leaq 0x77472(%rip), %rsi     # 0xf7f47
movq %rsp, %r14
movq %r14, %rdi
callq 0x31944
leaq 0x780f5(%rip), %rsi     # 0xf8bdc
movq %r14, %rdi
callq 0x233b0
leaq 0x50(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x80b16
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
jmp 0x80b1d
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, 0x48(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x10(%rsp), %r15
movq -0x10(%r15), %rdi
cmpq %r15, %rdi
je 0x80b50
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x229c0
leaq 0x150(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
leaq 0x140(%rsp), %rdi
callq 0x3213c
leaq 0x140(%rsp), %rdi
callq 0xbfa1f
movl %eax, %ebp
movq 0x140(%rsp), %rdi
cmpq %r12, %rdi
je 0x80ba3
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x229c0
testl %ebp, %ebp
jne 0x8152b
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x80bc2
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x229c0
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movq $0x0, 0x90(%rsp)
movq %rbx, %rdi
callq 0x8cd7e
movq %rbx, %rdi
callq 0x9be92
movl 0x13e8(%rbx), %esi
decl %esi
leaq 0x20(%rsp), %rdi
callq 0xbfa49
movq 0x1520(%rbx), %rcx
movq 0x1528(%rbx), %r8
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x22a80
leaq 0x10(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x80c3d
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x80c43
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rsp, %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x7faf9(%rip), %rsi     # 0x10075d
callq 0x233b0
leaq 0x50(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x80c90
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
jmp 0x80c96
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x48(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x80cc9
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x229c0
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x80ce4
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x229c0
leaq 0x130(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
leaq 0x120(%rsp), %rdi
callq 0x3213c
leaq 0x120(%rsp), %rsi
movq %rbx, %rdi
callq 0x91ae2
movq 0x120(%rsp), %rdi
cmpq %r14, %rdi
je 0x80d37
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0xf526a(%rip), %rdi     # 0x175fa8
leaq 0x7e61d(%rip), %rsi     # 0xff362
movl $0xc, %edx
callq 0x22ab0
movl 0x13e8(%rbx), %esi
decl %esi
movq %rsp, %rdi
callq 0xbfa49
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0xf5239(%rip), %r14     # 0x175fa8
movq %r14, %rdi
callq 0x22ab0
movq %rax, %r15
movq (%rax), %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
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x80dbc
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x229c0
xorps %xmm0, %xmm0
leaq 0x160(%rsp), %rsi
movaps %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
movq %rbx, %rdi
callq 0x9cc52
movq 0x160(%rsp), %rdi
testq %rdi, %rdi
je 0x80df7
movq 0x170(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
leaq 0x18c8(%rbx), %r13
leaq 0x1c30(%rbx), %rax
movq %rax, 0xa0(%rsp)
leaq 0x80(%rsp), %r15
cmpl $0x4, 0x1614(%rbx)
jb 0x80e59
movl $0x20, %edx
movq %r14, %rdi
leaq 0x7faa8(%rip), %rsi     # 0x1008d5
callq 0x22ab0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r14, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movq %rbx, %rdi
callq 0x8fd12
cmpl $0x4, 0x1614(%rbx)
jb 0x80ee0
movl $0x21, %edx
movq %r14, %rdi
leaq 0x7fa7d(%rip), %rsi     # 0x1008f6
callq 0x22ab0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r14, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movl $0x24, %edx
movq %r14, %rdi
leaq 0x7fa64(%rip), %rsi     # 0x100918
callq 0x22ab0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r14, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movq %rbx, %rdi
callq 0x9be92
cmpl $0x4, 0x1614(%rbx)
jb 0x80f2c
movl $0x22, %edx
movq %r14, %rdi
leaq 0x7fa3d(%rip), %rsi     # 0x10093d
callq 0x22ab0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r14, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movl 0x13e8(%rbx), %esi
leaq 0x20(%rsp), %r12
movq %r12, %rdi
callq 0xbfa49
movq 0x1520(%rbx), %rcx
movq 0x1528(%rbx), %r8
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x22a80
leaq 0x10(%rsp), %rsi
movq %rsi, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x80f7f
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x80f85
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x80fb9
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x229c0
cmpb $0x1, 0x1646(%rbx)
jne 0x81057
cmpl $0x4, 0x1614(%rbx)
jb 0x8100a
movl $0x1f, %edx
movq %r14, %rdi
leaq 0x7f982(%rip), %rsi     # 0x100960
callq 0x22ab0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r14, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movq (%rsp), %rsi
callq 0x9163a
cmpl $0x4, 0x1614(%rbx)
jb 0x81057
movl $0x20, %edx
movq %r14, %rdi
leaq 0x7f955(%rip), %rsi     # 0x100980
callq 0x22ab0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r14, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movl 0x13e8(%rbx), %esi
decl %esi
leaq 0x100(%rsp), %r12
movq %r12, %rdi
callq 0xbfa49
movq 0x1520(%rbx), %rcx
movq 0x1528(%rbx), %r8
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x22a80
leaq 0x70(%rsp), %rsi
movq %rsi, 0x60(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x810b1
movq %rdx, 0x60(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x70(%rsp)
jmp 0x810b7
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x68(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x60(%rsp), %rdi
leaq 0x7f682(%rip), %rsi     # 0x10075d
callq 0x233b0
leaq 0x30(%rsp), %rsi
movq %rsi, 0x20(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x81108
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x8110e
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x28(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x81142
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x81167
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x229c0
leaq 0xb8(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0xa8(%rsp), %rdi
callq 0x3213c
movq %rbx, %rdi
leaq 0xa8(%rsp), %rsi
callq 0x91ae2
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x811c6
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x229c0
movl $0xc, %edx
movq %r14, %rdi
leaq 0x7e18d(%rip), %rsi     # 0xff362
callq 0x22ab0
movl 0x13e8(%rbx), %esi
decl %esi
leaq 0x60(%rsp), %rdi
callq 0xbfa49
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq %r14, %rdi
callq 0x22ab0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %rbp, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x81244
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x229c0
movq %rbx, %rdi
callq 0x86f12
movl %eax, %ebp
cmpl $0x4, 0x1614(%rbx)
jb 0x8131b
movl $0x1f, %edx
movq %r14, %rdi
leaq 0x7f737(%rip), %rsi     # 0x1009a1
callq 0x22ab0
movzbl %bpl, %esi
movq %r14, %rdi
callq 0x230e0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r12, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movl $0x25, %edx
movq %r14, %rdi
leaq 0x7f70d(%rip), %rsi     # 0x1009c1
callq 0x22ab0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r14, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movl $0x21, %edx
movq %r14, %rdi
leaq 0x7f6f8(%rip), %rsi     # 0x1009e7
callq 0x22ab0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r14, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
testb %bpl, %bpl
jne 0x8149c
cmpl $0x3, 0x1614(%rbx)
jb 0x81368
movl $0x24, %edx
movq %r14, %rdi
leaq 0x7f6cd(%rip), %rsi     # 0x100a09
callq 0x22ab0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r14, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movq 0x80(%rsp), %rax
cmpq %rax, 0x88(%rsp)
je 0x81382
movq %rax, 0x88(%rsp)
movq 0x18d8(%rbx), %rbp
cmpq %r13, %rbp
je 0x813ce
leaq 0x20(%rbp), %rdx
movq 0x88(%rsp), %rsi
cmpq 0x90(%rsp), %rsi
je 0x813b6
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x88(%rsp)
jmp 0x813be
movq %r15, %rdi
callq 0x6b0da
movq %rbp, %rdi
callq 0x22ad0
movq %rax, %rbp
cmpq %r13, %rax
jne 0x8138e
leaq 0xe8(%rsp), %rdi
movq %r15, %rsi
callq 0xa8002
movq %rbx, %rdi
leaq 0xe8(%rsp), %rsi
callq 0x9cc52
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x8140b
movq 0xf8(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
cmpl $0x3, 0x1614(%rbx)
jb 0x8144f
movl $0x25, %edx
movq %r14, %rdi
leaq 0x7f60b(%rip), %rsi     # 0x100a2e
callq 0x22ab0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r14, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movq 0xa0(%rsp), %rdi
callq 0xafaaa
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x81478
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x229c0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x80e15
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x80e15
movq 0xa0(%rsp), %rdi
callq 0xafaaa
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x814c5
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x229c0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x814e0
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x814fc
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x81519
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7f1e3(%rip), %rsi     # 0x100715
movq %rsp, %rdi
leaq 0x40(%rsp), %rdx
callq 0x31944
leaq 0x80473(%rip), %rsi     # 0x1019b9
movq %rsp, %rdi
callq 0x233b0
leaq 0x188(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x81574
movups (%rcx), %xmm0
movups %xmm0, (%r12)
jmp 0x81587
movq %rdx, 0x178(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x188(%rsp)
movq 0x8(%rax), %rdx
leaq 0x178(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbx, %rdi
callq 0x784c2
movq %rax, %rbx
movq 0x178(%rsp), %rdi
cmpq %r12, %rdi
je 0x815d3
movq 0x188(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x815d3
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x8160a
movq 0x10(%rsp), %rsi
jmp 0x815fd
jmp 0x81607
movq %rax, %rbx
movq 0x140(%rsp), %rdi
cmpq %r12, %rdi
je 0x8160a
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x8160a
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x81857
movq 0x50(%rsp), %rsi
jmp 0x816ea
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x81857
movq 0x10(%rsp), %rsi
jmp 0x816ea
movq %rax, %rbx
movq 0x160(%rsp), %rdi
testq %rdi, %rdi
je 0x8181e
movq 0x170(%rsp), %rsi
subq %rdi, %rsi
jmp 0x81819
jmp 0x817df
movq %rax, %rbx
movq 0x120(%rsp), %rdi
cmpq %r14, %rdi
je 0x8181e
movq 0x130(%rsp), %rsi
jmp 0x81816
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x816ae
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x816ae
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8183a
movq 0x30(%rsp), %rsi
jmp 0x81832
jmp 0x816f7
jmp 0x816ce
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
cmpq %r15, %rdi
je 0x81857
movq 0xd8(%rsp), %rsi
incq %rsi
jmp 0x81852
jmp 0x817df
movq %rax, %rbx
jmp 0x8183a
jmp 0x817b7
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x817e7
movq 0xf8(%rsp), %rsi
subq %rdi, %rsi
jmp 0x817d6
movq %rax, %rbx
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x81798
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x81798
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x817e7
movq 0xb8(%rsp), %rsi
jmp 0x817d3
jmp 0x817e4
jmp 0x817df
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x8181e
movq 0x30(%rsp), %rsi
jmp 0x81816
jmp 0x817b7
movq %rax, %rbx
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x81803
movq 0x110(%rsp), %rsi
jmp 0x817fb
movq %rax, %rbx
jmp 0x81803
movq %rax, %rbx
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x817e7
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x817e7
jmp 0x817e4
movq %rax, %rbx
jmp 0x8181e
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x81803
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x229c0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x8181e
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x8183a
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x81857
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
movq %rbx, %rdi
callq 0x23240
nop