// File: 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
movq %rsp, %rbp
subq $0x3a0, %rsp            # imm = 0x3A0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2c8(%rbp)
cmpl $0x3, 0x1614(%rax)
jb 0xf2dc5
movq 0x1e21a6(%rip), %rdi    # 0x2d4f50
leaq 0xf06f8(%rip), %rsi     # 0x1e34a9
callq 0x2ff50
movq %rax, %rdi
movq 0x1e2208(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
movq -0x2c8(%rbp), %rsi
addq $0x1520, %rsi           # imm = 0x1520
leaq 0xf20a4(%rip), %rdx     # 0x1e4e7e
leaq -0x28(%rbp), %rdi
movq %rdi, -0x2d8(%rbp)
callq 0x447b0
movq -0x2d8(%rbp), %rdi
callq 0x17d410
movl %eax, -0x2cc(%rbp)
jmp 0xf2dfe
movl -0x2cc(%rbp), %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x2d9(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x311e8
movb -0x2d9(%rbp), %al
testb $0x1, %al
jne 0xf2e2a
jmp 0xf2fc2
movq -0x2c8(%rbp), %rdx
addq $0x1520, %rdx           # imm = 0x1520
leaq 0xe7958(%rip), %rsi     # 0x1da797
leaq -0x78(%rbp), %rdi
movq %rdi, -0x2e8(%rbp)
callq 0x44240
movq -0x2e8(%rbp), %rsi
leaq 0xf2021(%rip), %rdx     # 0x1e4e7e
leaq -0x58(%rbp), %rdi
callq 0x441f0
jmp 0xf2e68
leaq -0x78(%rbp), %rdi
callq 0x311e8
leaq -0x98(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x2f300
jmp 0xf2e83
leaq -0x98(%rbp), %rdi
callq 0x17e3f0
movl %eax, -0x2ec(%rbp)
jmp 0xf2e97
leaq -0x98(%rbp), %rdi
callq 0x311e8
movl -0x2ec(%rbp), %eax
cmpl $0x0, %eax
je 0xf2fa9
leaq 0xf0454(%rip), %rsi     # 0x1e330d
leaq -0xd8(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x44240
jmp 0xf2ecb
leaq 0xf1792(%rip), %rdx     # 0x1e4664
leaq -0xb8(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x441f0
jmp 0xf2ee7
movq -0x2c8(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0xeada0
jmp 0xf2efc
leaq -0xb8(%rbp), %rdi
callq 0x311e8
leaq -0xd8(%rbp), %rdi
callq 0x311e8
jmp 0xf2fa9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x311e8
jmp 0xf3905
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x311e8
jmp 0xf3905
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0xf2fb4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x311e8
jmp 0xf2fb4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0xf2f9b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x311e8
leaq -0xd8(%rbp), %rdi
callq 0x311e8
jmp 0xf2fb4
leaq -0x58(%rbp), %rdi
callq 0x311e8
jmp 0xf2fc2
leaq -0x58(%rbp), %rdi
callq 0x311e8
jmp 0xf3905
leaq -0xf0(%rbp), %rdi
callq 0xb2010
movq -0x2c8(%rbp), %rdi
callq 0x100a10
jmp 0xf2fdc
movq -0x2c8(%rbp), %rdi
callq 0x10f2c0
jmp 0xf2fea
movq -0x2c8(%rbp), %rax
movq %rax, %rcx
addq $0x1520, %rcx           # imm = 0x1520
movq %rcx, -0x2f8(%rbp)
movl 0x13e8(%rax), %esi
decl %esi
leaq -0x150(%rbp), %rdi
callq 0x17e460
jmp 0xf3018
movq -0x2f8(%rbp), %rsi
leaq -0x130(%rbp), %rdi
leaq -0x150(%rbp), %rdx
callq 0xb3380
jmp 0xf3034
leaq 0xf031a(%rip), %rdx     # 0x1e3355
leaq -0x110(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x441f0
jmp 0xf3050
leaq -0x130(%rbp), %rdi
callq 0x311e8
leaq -0x150(%rbp), %rdi
callq 0x311e8
leaq -0x170(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x2f300
jmp 0xf307d
movq -0x2c8(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x105530
jmp 0xf3092
leaq -0x170(%rbp), %rdi
callq 0x311e8
movq 0x1e1eab(%rip), %rdi    # 0x2d4f50
leaq 0xeed86(%rip), %rsi     # 0x1e1e32
callq 0x2ff50
movq %rax, -0x300(%rbp)
jmp 0xf30ba
movq -0x2c8(%rbp), %rax
movl 0x13e8(%rax), %esi
decl %esi
leaq -0x190(%rbp), %rdi
callq 0x17e460
jmp 0xf30d7
movq -0x300(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x2f780
movq %rax, -0x308(%rbp)
jmp 0xf30f3
movq -0x308(%rbp), %rdi
movq 0x1e1ec7(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xf3108
leaq -0x190(%rbp), %rdi
callq 0x311e8
xorps %xmm0, %xmm0
movaps %xmm0, -0x1b0(%rbp)
movq $0x0, -0x1a0(%rbp)
leaq -0x1b0(%rbp), %rdi
movq %rdi, -0x310(%rbp)
callq 0xb2010
movq -0x2c8(%rbp), %rdi
movq -0x310(%rbp), %rsi
callq 0x110510
jmp 0xf3151
leaq -0x1b0(%rbp), %rdi
callq 0xb2400
movb $0x0, -0x1b1(%rbp)
movb -0x1b1(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0xf3175
jmp 0xf38cc
movq -0x2c8(%rbp), %rax
cmpl $0x4, 0x1614(%rax)
jb 0xf326f
movq 0x1e1dc0(%rip), %rdi    # 0x2d4f50
leaq 0xf0336(%rip), %rsi     # 0x1e34cd
callq 0x2ff50
movq %rax, -0x318(%rbp)
jmp 0xf31a5
movq -0x318(%rbp), %rdi
movq 0x1e1e15(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xf31ba
jmp 0xf326f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0xf38f9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0xf31f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x311e8
leaq -0x150(%rbp), %rdi
callq 0x311e8
jmp 0xf38f9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0xf38ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x311e8
jmp 0xf38ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x311e8
jmp 0xf38ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0xb2400
jmp 0xf38ed
movq -0x2c8(%rbp), %rdi
callq 0x103840
jmp 0xf327d
movq -0x2c8(%rbp), %rax
cmpl $0x4, 0x1614(%rax)
jb 0xf32f1
movq 0x1e1cbc(%rip), %rdi    # 0x2d4f50
leaq 0xf0253(%rip), %rsi     # 0x1e34ee
callq 0x2ff50
movq %rax, -0x320(%rbp)
jmp 0xf32a9
movq -0x320(%rbp), %rdi
movq 0x1e1d11(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xf32be
movq 0x1e1c8b(%rip), %rdi    # 0x2d4f50
leaq 0xf0244(%rip), %rsi     # 0x1e3510
callq 0x2ff50
movq %rax, -0x328(%rbp)
jmp 0xf32da
movq -0x328(%rbp), %rdi
movq 0x1e1ce0(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xf32ef
jmp 0xf32f1
movq -0x2c8(%rbp), %rdi
callq 0x10f2c0
jmp 0xf32ff
movq -0x2c8(%rbp), %rax
cmpl $0x4, 0x1614(%rax)
jb 0xf3342
movq 0x1e1c3a(%rip), %rdi    # 0x2d4f50
leaq 0xf0218(%rip), %rsi     # 0x1e3535
callq 0x2ff50
movq %rax, -0x330(%rbp)
jmp 0xf332b
movq -0x330(%rbp), %rdi
movq 0x1e1c8f(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xf3340
jmp 0xf3342
movq -0x2c8(%rbp), %rax
movq %rax, %rcx
addq $0x1520, %rcx           # imm = 0x1520
movq %rcx, -0x338(%rbp)
movl 0x13e8(%rax), %esi
leaq -0x1f8(%rbp), %rdi
callq 0x17e460
jmp 0xf336e
movq -0x338(%rbp), %rsi
leaq -0x1d8(%rbp), %rdi
leaq -0x1f8(%rbp), %rdx
callq 0xb3380
jmp 0xf338a
leaq -0x1f8(%rbp), %rdi
callq 0x311e8
movq -0x2c8(%rbp), %rax
testb $0x1, 0x1646(%rax)
je 0xf347d
movq -0x2c8(%rbp), %rax
cmpl $0x4, 0x1614(%rax)
jb 0xf341b
movq 0x1e1b8f(%rip), %rdi    # 0x2d4f50
leaq 0xf0190(%rip), %rsi     # 0x1e3558
callq 0x2ff50
movq %rax, -0x340(%rbp)
jmp 0xf33d6
movq -0x340(%rbp), %rdi
movq 0x1e1be4(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xf33eb
jmp 0xf341b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x311e8
jmp 0xf38ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0xf38be
leaq -0x1d8(%rbp), %rdi
callq 0x2f290
movq -0x2c8(%rbp), %rdi
movq %rax, %rsi
callq 0x105080
jmp 0xf3438
movq -0x2c8(%rbp), %rax
cmpl $0x4, 0x1614(%rax)
jb 0xf347b
movq 0x1e1b01(%rip), %rdi    # 0x2d4f50
leaq 0xf0122(%rip), %rsi     # 0x1e3578
callq 0x2ff50
movq %rax, -0x348(%rbp)
jmp 0xf3464
movq -0x348(%rbp), %rdi
movq 0x1e1b56(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xf3479
jmp 0xf347b
jmp 0xf347d
movq -0x2c8(%rbp), %rax
movq %rax, %rcx
addq $0x1520, %rcx           # imm = 0x1520
movq %rcx, -0x350(%rbp)
movl 0x13e8(%rax), %esi
decl %esi
leaq -0x258(%rbp), %rdi
callq 0x17e460
jmp 0xf34ab
movq -0x350(%rbp), %rsi
leaq -0x238(%rbp), %rdi
leaq -0x258(%rbp), %rdx
callq 0xb3380
jmp 0xf34c7
leaq 0xefe87(%rip), %rdx     # 0x1e3355
leaq -0x218(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x441f0
jmp 0xf34e3
leaq -0x238(%rbp), %rdi
callq 0x311e8
leaq -0x258(%rbp), %rdi
callq 0x311e8
leaq -0x278(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x2f300
jmp 0xf3510
movq -0x2c8(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x105530
jmp 0xf3525
leaq -0x278(%rbp), %rdi
callq 0x311e8
movq 0x1e1a18(%rip), %rdi    # 0x2d4f50
leaq 0xee8f3(%rip), %rsi     # 0x1e1e32
callq 0x2ff50
movq %rax, -0x358(%rbp)
jmp 0xf354d
movq -0x2c8(%rbp), %rax
movl 0x13e8(%rax), %esi
decl %esi
leaq -0x298(%rbp), %rdi
callq 0x17e460
jmp 0xf356a
movq -0x358(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x2f780
movq %rax, -0x360(%rbp)
jmp 0xf3586
movq -0x360(%rbp), %rdi
movq 0x1e1a34(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xf359b
leaq -0x298(%rbp), %rdi
callq 0x311e8
movq -0x2c8(%rbp), %rdi
callq 0xf99b0
movb %al, -0x361(%rbp)
jmp 0xf35bb
movq -0x2c8(%rbp), %rax
movb -0x361(%rbp), %cl
andb $0x1, %cl
movb %cl, -0x1b1(%rbp)
cmpl $0x4, 0x1614(%rax)
jb 0xf3717
movq 0x1e196b(%rip), %rdi    # 0x2d4f50
leaq 0xeffad(%rip), %rsi     # 0x1e3599
callq 0x2ff50
movq %rax, -0x370(%rbp)
jmp 0xf35fa
movq -0x370(%rbp), %rdi
movzbl -0x1b1(%rbp), %esi
andl $0x1, %esi
callq 0x2f690
movq %rax, -0x378(%rbp)
jmp 0xf3619
movq -0x378(%rbp), %rdi
movq 0x1e19a1(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xf362e
movq 0x1e191b(%rip), %rdi    # 0x2d4f50
leaq 0xeff7d(%rip), %rsi     # 0x1e35b9
callq 0x2ff50
movq %rax, -0x380(%rbp)
jmp 0xf364a
movq -0x380(%rbp), %rdi
movq 0x1e1970(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xf365f
movq 0x1e18ea(%rip), %rdi    # 0x2d4f50
leaq 0xeff72(%rip), %rsi     # 0x1e35df
callq 0x2ff50
movq %rax, -0x388(%rbp)
jmp 0xf367b
movq -0x388(%rbp), %rdi
movq 0x1e193f(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xf3690
jmp 0xf3717
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0xf36bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x311e8
leaq -0x258(%rbp), %rdi
callq 0x311e8
jmp 0xf38be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0xf38b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x278(%rbp), %rdi
callq 0x311e8
jmp 0xf38b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x298(%rbp), %rdi
callq 0x311e8
jmp 0xf38b2
testb $0x1, -0x1b1(%rbp)
jne 0xf3882
movq -0x2c8(%rbp), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xf3767
movq 0x1e1815(%rip), %rdi    # 0x2d4f50
leaq 0xefebf(%rip), %rsi     # 0x1e3601
callq 0x2ff50
movq %rax, -0x390(%rbp)
jmp 0xf3750
movq -0x390(%rbp), %rdi
movq 0x1e186a(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xf3765
jmp 0xf3767
leaq -0xf0(%rbp), %rdi
callq 0x122bf0
movq -0x2c8(%rbp), %rdi
addq $0x18c0, %rdi           # imm = 0x18C0
callq 0x123360
movq %rax, -0x2a0(%rbp)
movq -0x2c8(%rbp), %rdi
addq $0x18c0, %rdi           # imm = 0x18C0
callq 0x1233c0
movq %rax, -0x2a8(%rbp)
leaq -0x2a0(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x123390
testb $0x1, %al
jne 0xf37c0
jmp 0xf37ed
leaq -0x2a0(%rbp), %rdi
callq 0x1233f0
movq %rax, %rsi
leaq -0xf0(%rbp), %rdi
callq 0xb4640
jmp 0xf37dd
jmp 0xf37df
leaq -0x2a0(%rbp), %rdi
callq 0x123410
jmp 0xf378d
leaq -0x2c0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x123be0
jmp 0xf3802
movq -0x2c8(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x110510
jmp 0xf3817
leaq -0x2c0(%rbp), %rdi
callq 0xb2400
movq -0x2c8(%rbp), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xf3880
movq 0x1e1716(%rip), %rdi    # 0x2d4f50
leaq 0xefde5(%rip), %rsi     # 0x1e3626
callq 0x2ff50
movq %rax, -0x398(%rbp)
jmp 0xf384f
movq -0x398(%rbp), %rdi
movq 0x1e176b(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xf3864
jmp 0xf3880
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0xb2400
jmp 0xf38b2
jmp 0xf3882
movq -0x2c8(%rbp), %rdi
addq $0x1c30, %rdi           # imm = 0x1C30
callq 0x1232c0
leaq -0x218(%rbp), %rdi
callq 0x311e8
leaq -0x1d8(%rbp), %rdi
callq 0x311e8
jmp 0xf3164
leaq -0x218(%rbp), %rdi
callq 0x311e8
leaq -0x1d8(%rbp), %rdi
callq 0x311e8
jmp 0xf38ed
leaq -0x110(%rbp), %rdi
callq 0x311e8
leaq -0xf0(%rbp), %rdi
callq 0xb2400
addq $0x3a0, %rsp            # imm = 0x3A0
popq %rbp
retq
leaq -0x110(%rbp), %rdi
callq 0x311e8
leaq -0xf0(%rbp), %rdi
callq 0xb2400
movq -0x30(%rbp), %rdi
callq 0x30170
nop