// File: /workspace/github_cpp_makefile_star2_O2/richardposner[P]BioNetFit2/src/code/Particle.cpp
// Function: Particle::doParticle(unsigned int)
void Particle::doParticle(unsigned int mid) {
	int subParID = calcsubParID(mid);
	int id = subParID;

	if (swarm_->options.verbosity >= 3) {cout << "In doParticle(), waiting for message from master. subParticle:["<<subParID <<":"<< id_  <<"-"<<mid <<"]  model id:"<< mid<< endl; mypause();}

// razi: this is to run the program in slave mode without using master-slave configuration
// this should be commented later on.
#ifdef STANDALONE_STANDALONE_PARTICLE_TEST_ACTIVE

	if (swarm_->options.verbosity >= 3){ cout << "doParticle. Generate random parameters instead of waiting for master to send the parameters. Results are not valid !!!" << endl; mypause();}
	currentGeneration_ =1; int rnd; srand(subParID); //razi random seed

	//razi generate random values for free parameters only for test purpose
	for (auto frp = swarm_->options.models.at(mid)->freeParams_.begin(); frp != swarm_->options.models.at(mid)->freeParams_.end(); ++frp) {
		rnd=rand()%100; simParams_.at(mid).insert(pair<string, double>(frp->first, rnd));
		//cout<<"virtual free param:"<<frp->first<<" is set to "<<rnd<<"."<<endl;
	}

#else //STANDALONE_STANDALONE_PARTICLE_TEST_ACTIVE
	if (swarm_->resumingSavedSwarm) {
		if (swarm_->options.verbosity >= 3)  cout << "Waiting for flight count from master" << endl;
		swarm_->swarmComm->recvMessage(0, id, SEND_NUMFLIGHTS_TO_PARTICLE, true, swarm_->swarmComm->univMessageReceiver);
		currentGeneration_ = stoi(*(swarm_->swarmComm->univMessageReceiver.find(SEND_NUMFLIGHTS_TO_PARTICLE)->second.message.begin()));

		swarm_->swarmComm->univMessageReceiver.clear();
		if (swarm_->options.verbosity >= 3) cout << "Received flight count from master. Waiting for param set from master...." << endl;
		swarm_->swarmComm->recvMessage(0, id, SEND_FINAL_PARAMS_TO_PARTICLE, true, swarm_->swarmComm->univMessageReceiver);

		auto freeParam = swarm_->options.models.at(mid)->getFreeParams_().begin();
		for (auto paramVal = swarm_->swarmComm->univMessageReceiver.find(SEND_FINAL_PARAMS_TO_PARTICLE)->second.message.begin(); paramVal != swarm_->swarmComm->univMessageReceiver.find(SEND_FINAL_PARAMS_TO_PARTICLE)->second.message.end(); ++paramVal) {
			if (swarm_->options.verbosity >= 3) cout << "updating " << freeParam->first << " to " << *paramVal << endl;
			simParams_.at(mid).insert(pair<string, double>(freeParam->first, stod(*paramVal)));
			++freeParam;
		}
		swarm_->swarmComm->univMessageReceiver.clear();
	}
#endif //STANDALONE_STANDALONE_PARTICLE_TEST_ACTIVE


	if (swarm_->options.fitType == "de") {
		// Need to figure out which island I'm on
		for (unsigned int island = 1; island <= swarm_->options.numIslands; ++island) {
			for (unsigned int particle = 1; particle <= (swarm_->options.swarmSize / swarm_->options.numIslands) * island; ++particle) {
				if (particle == id_) {
					island_ = island;
					goto theEnd;
				}
			}
		}
		theEnd:;
	}


#ifndef STANDALONE_PARTICLE_TEST_ACTIVE

//cout << "Particle " << id_ << " waiting to begin" << endl;
//	swarm_->swarmComm->recvMessage(0, id_, NEXT_GENERATION, true, swarm_->swarmComm->univMessageReceiver);
	if (swarm_->options.verbosity >= 3) {
		cout << "subParticle " << id << " waiting to begin" << endl;
	}
	swarm_->swarmComm->recvMessage(0, id, NEXT_GENERATION, true, swarm_->swarmComm->univMessageReceiver); //Master should send message with subParID
	swarm_->swarmComm->univMessageReceiver.clear();
#endif //STANDALONE_PARTICLE_TEST_ACTIVE
	if (swarm_->options.verbosity >= 3) {
		cout << "Particle " << id_ << " starting" << endl;
	}
	if (swarm_->options.verbosity >= 3) {
		cout << "In doParticle(), entering main run loop" << endl;
	}

	bool doContinue = true;
	bool doRunModel = true;
	while(doContinue) {
		if (swarm_->bootstrapCounter > 0 && currentGeneration_ == 1) {
			swarm_->swarmComm->recvMessage(0, id, NEXT_GENERATION, true, swarm_->swarmComm->univMessageReceiver);
			swarm_->swarmComm->univMessageReceiver.clear();
		}
		if (swarm_->options.verbosity >= 3) {
			cout << "DoParticle: Generation is " << currentGeneration_ << endl;
		}
		if (doRunModel) {
			for (unsigned int i = 1; i <= swarm_->options.smoothing; ++i) {
				if (swarm_->options.verbosity >= 3) cout<<"doParticle-1x try to run model for i:"<<i<<endl;

				if (swarm_->isMaster){
						for (unsigned int j=0; j<=swarm_->getNumModels(); j++){   //razi:run all subparticles
						if (getSubParticle(j)){
							getSubParticle(j)->runModel(i, false);   //razi: check later due to false
							if (swarm_->options.verbosity >= 3) {
								cout<<"Particle::doParticle. Running subParticle:["<<calcsubParID(j) <<":"<< id_  <<"-"<<j <<"] for iteration:"<<i << " is completed...\n";
							}
						}
					}
				}else{
					if (getSubParticle(mid)){
						if (swarm_->options.verbosity >= 3) {
							cout<<"Particle::doParticle. Running subParticle:["<<subParID <<":"<< id_  <<"-"<<mid <<"] for iteration:"<<i << " is started...\n";
						}
						getSubParticle(mid)->runModel(i, false);   //razi: check later due to false
						if (swarm_->options.verbosity >= 3) {
							cout<<"Particle::doParticle. Running subParticle:"<< mid <<" for iteration:"<<i << " is completed...\n";
						}
					}else outputError("SubParticle number error subParticle:["+ toString(subParID)+":"+ toString(id_) + "-:"+ toString(mid)+"] particleID:"+ toString(id_)+ " model id:" + toString(mid) + "  subParID:" + toString(subParID));
				}
				if (swarm_->options.verbosity >= 3) cout<<"doParticle-1 ran model for i:"<<i<<endl;
			}

			if (swarm_->isMaster){
				for (unsigned int j=0; j<=swarm_->getNumModels(); j++){
					if (getSubParticle(j)) {
						if (swarm_->options.smoothing > 1) {
							smoothRuns(j);
						}
						finalizeSim(j);
					}
				}
			}else{
				if (getSubParticle(mid)) {
					smoothRuns(mid);
				}
				finalizeSim(mid);
			}
		}
		else{
			//cout<<"do Runmodel was not active\n";
			doRunModel = true;
		}

if (swarm_->options.verbosity >= 3) cout<<"doParticle-4 now lets check messages..."<<endl;
		if (swarm_->options.verbosity >= 5) {
			cout << "RAQUEL before if" << endl;
		}
		if (swarm_->options.fitType == "ga") {
			if (swarm_->options.verbosity >= 3) {
				cout << "RAQUEL Entering check messages GA" << endl;
			}
			//checkMessagesGenetic(); //Raquel: changed this function to fix the problem of not proceeding to the next generation
			checkMessagesGenetic(mid);
			if (swarm_->options.verbosity >= 3) {
				cout << "RAQUEL done check messages" << endl;
			}
		}
		else if (swarm_->options.fitType == "pso") {
			if (swarm_->options.verbosity >= 3) {
				cout << "RAQUEL Entering check messages PSO" << endl;
			}
			checkMessagesPSO(mid);
			if (swarm_->options.verbosity >= 3) {
				cout << "RAQUEL Done check messages PSO" << endl;
			}

		}
		else if (swarm_->options.fitType == "de") {

			if (swarm_->options.verbosity >= 3) {
				cout << "RAQUEL Entering check messages DE" << endl;
			}

			checkMessagesDE(mid);

			if (swarm_->options.verbosity >= 3) {
				cout << "RAQUEL Done check messages DE" << endl;
			}

		}
		else if (swarm_->options.fitType == "sa") {
			doRunModel = checkMessagesDE();
		}
if (swarm_->options.verbosity >= 3) cout<<"doParticle-4 check messages done..."<<endl;

		if (doRunModel == true) {
			// Next generation
			++currentGeneration_;
		}
	}
	if (swarm_->options.verbosity >= 3) {
		cout << "In doParticle(), finished ...." << endl;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
movl %esi, %ebp
movq %rdi, %r14
callq 0x5645e
movl %eax, 0x18(%rsp)
movq 0xa8(%r14), %rdi
cmpl $0x3, 0x1614(%rdi)
movl %ebp, %eax
movq %rax, 0x20(%rsp)
jb 0x55743
movq 0x1108d5(%rip), %rdi    # 0x165f98
leaq 0x80dae(%rip), %rsi     # 0xd6478
callq 0x289f0
movq %rax, %rdi
movl 0x18(%rsp), %esi
callq 0x29290
leaq 0x8704e(%rip), %rsi     # 0xdc730
movq %rax, %rdi
callq 0x289f0
movl 0x40(%r14), %esi
movq %rax, %rdi
callq 0x286e0
leaq 0x8a16d(%rip), %rsi     # 0xdf86a
movq %rax, %rdi
callq 0x289f0
movq %rax, %rdi
movq 0x20(%rsp), %rbx
movq %rbx, %rsi
callq 0x286e0
leaq 0x80d9c(%rip), %rsi     # 0xd64b8
movq %rax, %rdi
callq 0x289f0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x286e0
movq %rax, %rdi
callq 0x284a0
callq 0x9e3e0
movq 0xa8(%r14), %rdi
cmpb $0x1, 0x13f0(%rdi)
movl %ebp, 0x1c(%rsp)
jne 0x55976
cmpl $0x3, 0x1614(%rdi)
jb 0x5577f
movq 0x110834(%rip), %rdi    # 0x165f98
leaq 0x80d5a(%rip), %rsi     # 0xd64c5
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movq 0xa8(%r14), %rdi
movq (%rdi), %rdi
leaq 0x18(%rdi), %r9
orl $-0x1, 0x8(%rsp)
movl $0x1, (%rsp)
pushq $0x17
popq %rcx
pushq $0x1
popq %r8
xorl %esi, %esi
movl 0x18(%rsp), %edx
callq 0x60fd6
movq 0xa8(%r14), %rax
movq (%rax), %rdi
addq $0x18, %rdi
leaq 0x30(%rsp), %rsi
movl $0x17, (%rsi)
callq 0x5d11e
movq 0x38(%rax), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x3343d
movl %eax, 0xb0(%r14)
movq 0xa8(%r14), %rax
movq (%rax), %rdi
addq $0x18, %rdi
callq 0x5d19a
movq 0xa8(%r14), %rax
cmpl $0x3, 0x1614(%rax)
jb 0x5581c
movq 0x110797(%rip), %rdi    # 0x165f98
leaq 0x80ce2(%rip), %rsi     # 0xd64ea
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movq 0xa8(%r14), %rax
movq (%rax), %rdi
leaq 0x18(%rdi), %r9
orl $-0x1, 0x8(%rsp)
movl $0x1, (%rsp)
pushq $0x15
popq %rcx
pushq $0x1
popq %r8
xorl %esi, %esi
movl 0x18(%rsp), %edx
callq 0x60fd6
movl $0x15c0, %edi           # imm = 0x15C0
addq 0xa8(%r14), %rdi
movq 0x20(%rsp), %rsi
callq 0x3374c
movq (%rax), %rax
movq 0x48(%rax), %rbx
movq 0xa8(%r14), %rax
movq (%rax), %rdi
addq $0x18, %rdi
leaq 0x30(%rsp), %r15
movl $0x15, (%r15)
movq %r15, %rsi
callq 0x5d11e
movq 0x38(%rax), %r12
movq 0xa8(%r14), %rax
movq (%rax), %rdi
addq $0x18, %rdi
movl $0x15, 0x30(%rsp)
movq %r15, %rsi
callq 0x5d11e
movq 0xa8(%r14), %rcx
cmpq 0x40(%rax), %r12
je 0x5595f
cmpl $0x3, 0x1614(%rcx)
jb 0x558fd
movq 0x1106d5(%rip), %rdi    # 0x165f98
leaq 0x80c69(%rip), %rsi     # 0xd6533
callq 0x289f0
leaq 0x20(%rbx), %rsi
movq %rax, %rdi
callq 0x28910
movq %rax, %rdi
leaq 0x89590(%rip), %rsi     # 0xdee75
callq 0x289f0
movq %rax, %rdi
movq %r12, %rsi
callq 0x28910
movq %rax, %rdi
callq 0x284a0
movq %r14, %rdi
movq 0x20(%rsp), %rsi
callq 0x59f72
movq %rax, %rbp
leaq 0x20(%rbx), %r13
movq %r12, %rdi
xorl %esi, %esi
callq 0x33525
movsd %xmm0, 0x28(%rsp)
movq %r15, %rdi
movq %r13, %rsi
callq 0x28dd0
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
movq %rbp, %rdi
movq %r15, %rsi
callq 0x4bce2
movq %r15, %rdi
callq 0x295a0
movq %rbx, %rdi
callq 0x28b60
movq %rax, %rbx
addq $0x20, %r12
jmp 0x55884
movq (%rcx), %rdi
addq $0x18, %rdi
callq 0x5d19a
movq 0xa8(%r14), %rdi
movl 0x1c(%rsp), %ebp
addq $0x14e0, %rdi           # imm = 0x14E0
leaq 0xb6ad7(%rip), %rsi     # 0x10c45b
callq 0x3357b
movq 0xa8(%r14), %rcx
testb %al, %al
je 0x559dd
pushq $0x1
popq %rsi
movl 0x16fc(%rcx), %edi
xorl %r8d, %r8d
subl 0x40(%r14), %r8d
movl %esi, %r9d
cmpl %edi, %r9d
ja 0x559dd
movl 0x1620(%rcx), %eax
xorl %edx, %edx
divl %edi
imull %r9d, %eax
movl %esi, %edx
cmpl %eax, %edx
ja 0x559d1
leal (%r8,%rdx), %r10d
incl %r10d
incl %edx
cmpl $0x1, %r10d
jne 0x559bc
jmp 0x559d6
incl %r9d
jmp 0x559a7
movl %r9d, 0xb4(%r14)
cmpl $0x3, 0x1614(%rcx)
jb 0x55a23
movq 0x1105ab(%rip), %rdi    # 0x165f98
leaq 0x883a3(%rip), %rsi     # 0xddd97
callq 0x289f0
movq %rax, %rdi
movl 0x18(%rsp), %esi
callq 0x29290
leaq 0x80b31(%rip), %rsi     # 0xd653d
movq %rax, %rdi
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movq 0xa8(%r14), %rcx
movq (%rcx), %rdi
leaq 0x18(%rdi), %r9
orl $-0x1, 0x8(%rsp)
movl $0x1, (%rsp)
pushq $0x12
popq %rcx
pushq $0x1
popq %r8
xorl %esi, %esi
movl 0x18(%rsp), %edx
callq 0x60fd6
movq 0xa8(%r14), %rax
movq (%rax), %rdi
addq $0x18, %rdi
callq 0x5d19a
movq 0xa8(%r14), %rax
cmpl $0x3, 0x1614(%rax)
jb 0x55acc
movq 0x110526(%rip), %rdi    # 0x165f98
leaq 0x8860c(%rip), %rsi     # 0xde085
callq 0x289f0
movl 0x40(%r14), %esi
movq %rax, %rdi
callq 0x286e0
leaq 0x80abe(%rip), %rsi     # 0xd654f
movq %rax, %rdi
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movq 0xa8(%r14), %rax
cmpl $0x3, 0x1614(%rax)
jb 0x55acc
movq 0x1104e0(%rip), %rdi    # 0x165f98
leaq 0x80a9a(%rip), %rsi     # 0xd6559
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movb $0x1, %bl
movq 0xa8(%r14), %rax
cmpl $0x0, 0x13ec(%rax)
je 0x55b27
cmpl $0x1, 0xb0(%r14)
jne 0x55b27
movq (%rax), %rdi
leaq 0x18(%rdi), %r9
orl $-0x1, 0x8(%rsp)
movl $0x1, (%rsp)
xorl %esi, %esi
movl 0x18(%rsp), %edx
pushq $0x12
popq %rcx
pushq $0x1
popq %r8
callq 0x60fd6
movq 0xa8(%r14), %rax
movq (%rax), %rdi
addq $0x18, %rdi
callq 0x5d19a
movq 0xa8(%r14), %rax
movb %bl, 0x28(%rsp)
cmpl $0x3, 0x1614(%rax)
jb 0x55b5e
movq 0x11045d(%rip), %rdi    # 0x165f98
leaq 0x80a3f(%rip), %rsi     # 0xd6581
callq 0x289f0
movl 0xb0(%r14), %esi
movq %rax, %rdi
callq 0x286e0
movq %rax, %rdi
callq 0x284a0
movb $0x1, %bl
testb $0x1, 0x28(%rsp)
je 0x560e3
pushq $0x1
popq %rbx
movq 0xa8(%r14), %rax
cmpl 0x1658(%rax), %ebx
ja 0x56060
cmpl $0x3, 0x1614(%rax)
movl %ebx, %r15d
jb 0x55bba
movq 0x110404(%rip), %rdi    # 0x165f98
leaq 0x80a01(%rip), %rsi     # 0xd659c
callq 0x289f0
movq %rax, %rdi
movq %r15, %rsi
callq 0x286e0
movq %rax, %rdi
callq 0x284a0
movq 0xa8(%r14), %rax
cmpb $0x1, 0x50(%rax)
jne 0x55cb9
xorl %r12d, %r12d
movq 0x15c8(%rax), %rcx
subq 0x15c0(%rax), %rcx
shrq $0x3, %rcx
cmpl %ecx, %r12d
ja 0x5601f
movq %r14, %rdi
movl %r12d, %esi
callq 0x59f90
testq %rax, %rax
je 0x55caa
movq %r14, %rdi
movl %r12d, %esi
callq 0x59f90
movq %rax, %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0x520a6
movq 0xa8(%r14), %rax
cmpl $0x3, 0x1614(%rax)
jb 0x55caa
movq 0x110370(%rip), %rdi    # 0x165f98
leaq 0x80993(%rip), %rsi     # 0xd65c2
callq 0x289f0
movq %rax, %rbp
movq %r14, %rdi
movl %r12d, %esi
callq 0x5645e
movl %eax, %esi
movq %rbp, %rdi
callq 0x286e0
movq %rax, %rdi
leaq 0x86ada(%rip), %rsi     # 0xdc730
callq 0x289f0
movl 0x40(%r14), %esi
movq %rax, %rdi
callq 0x286e0
movq %rax, %rdi
leaq 0x89bf9(%rip), %rsi     # 0xdf86a
callq 0x289f0
movl %r12d, %esi
movq %rax, %rdi
callq 0x286e0
movq %rax, %rdi
leaq 0x80963(%rip), %rsi     # 0xd65ee
callq 0x289f0
movq %rax, %rdi
movq %r15, %rsi
callq 0x286e0
movq %rax, %rdi
leaq 0x8095a(%rip), %rsi     # 0xd65ff
callq 0x289f0
incl %r12d
movq 0xa8(%r14), %rax
jmp 0x55bc7
movq %r14, %rdi
movl %ebp, %esi
callq 0x59f90
testq %rax, %rax
je 0x55dd3
movq 0xa8(%r14), %rax
cmpl $0x3, 0x1614(%rax)
jb 0x55d5b
movq 0x1102b5(%rip), %rdi    # 0x165f98
leaq 0x808d8(%rip), %rsi     # 0xd65c2
callq 0x289f0
movq %rax, %rdi
movl 0x18(%rsp), %esi
callq 0x29290
movq %rax, %rdi
leaq 0x86a2b(%rip), %rsi     # 0xdc730
callq 0x289f0
movl 0x40(%r14), %esi
movq %rax, %rdi
callq 0x286e0
movq %rax, %rdi
leaq 0x89b4a(%rip), %rsi     # 0xdf86a
callq 0x289f0
movq %rax, %rdi
movq 0x20(%rsp), %rsi
callq 0x286e0
movq %rax, %rdi
leaq 0x808b2(%rip), %rsi     # 0xd65ee
callq 0x289f0
movq %rax, %rdi
movq %r15, %rsi
callq 0x286e0
movq %rax, %rdi
leaq 0x808bb(%rip), %rsi     # 0xd6611
callq 0x289f0
movq %r14, %rdi
movl %ebp, %esi
callq 0x59f90
movq %rax, %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0x520a6
movq 0xa8(%r14), %rax
cmpl $0x3, 0x1614(%rax)
jb 0x5601f
movq 0x11020c(%rip), %rdi    # 0x165f98
leaq 0x8088e(%rip), %rsi     # 0xd6621
callq 0x289f0
movq %rax, %rdi
movq 0x20(%rsp), %rsi
callq 0x286e0
movq %rax, %rdi
leaq 0x80840(%rip), %rsi     # 0xd65ef
callq 0x289f0
movq %rax, %rdi
movq %r15, %rsi
callq 0x286e0
movq %rax, %rdi
leaq 0x80836(%rip), %rsi     # 0xd65ff
callq 0x289f0
jmp 0x5601f
leaq 0x178(%rsp), %rbp
movq %rbp, %rdi
movl 0x18(%rsp), %esi
callq 0x9e9c3
leaq 0x218(%rsp), %r12
movq %r12, %rdi
leaq 0x80853(%rip), %rsi     # 0xd664c
movq %rbp, %rdx
callq 0x4933b
leaq 0x58(%rsp), %rdi
movq %r12, %rsi
leaq 0x86920(%rip), %rdx     # 0xdc730
callq 0x3336c
movl 0x40(%r14), %esi
leaq 0x158(%rsp), %rbp
movq %rbp, %rdi
callq 0x9f56b
leaq 0x198(%rsp), %r13
movq %r13, %rdi
leaq 0x58(%rsp), %rsi
movq %rbp, %rdx
callq 0x4e6ed
leaq 0x78(%rsp), %rdi
movq %r13, %rsi
leaq 0x80823(%rip), %rdx     # 0xd6673
callq 0x3336c
leaq 0x138(%rsp), %r13
movq %r13, %rdi
movl 0x1c(%rsp), %esi
callq 0x9f56b
leaq 0x1b8(%rsp), %rbp
movq %rbp, %rdi
leaq 0x78(%rsp), %rsi
movq %r13, %rdx
callq 0x4e6ed
leaq 0x98(%rsp), %rdi
movq %rbp, %rsi
leaq 0x807e3(%rip), %rdx     # 0xd6676
callq 0x3336c
movl 0x40(%r14), %esi
leaq 0x118(%rsp), %r13
movq %r13, %rdi
callq 0x9f56b
leaq 0x1d8(%rsp), %rbp
movq %rbp, %rdi
leaq 0x98(%rsp), %rsi
movq %r13, %rdx
callq 0x4e6ed
leaq 0xb8(%rsp), %rdi
movq %rbp, %rsi
leaq 0x80cff(%rip), %rdx     # 0xd6bd8
callq 0x3336c
leaq 0xf8(%rsp), %r13
movq %r13, %rdi
movl 0x1c(%rsp), %esi
callq 0x9f56b
leaq 0x1f8(%rsp), %rbp
movq %rbp, %rdi
leaq 0xb8(%rsp), %rsi
movq %r13, %rdx
callq 0x4e6ed
leaq 0x30(%rsp), %rdi
movq %rbp, %rsi
leaq 0x80768(%rip), %rdx     # 0xd6684
callq 0x3336c
leaq 0xd8(%rsp), %r13
movq %r13, %rdi
movl 0x18(%rsp), %esi
callq 0x9e9c3
leaq 0x238(%rsp), %rbp
movq %rbp, %rdi
leaq 0x30(%rsp), %rsi
movq %r13, %rdx
callq 0x4e6ed
movq %rbp, %rdi
callq 0x9f54b
movq %rbp, %rdi
callq 0x295a0
leaq 0xd8(%rsp), %rdi
callq 0x295a0
leaq 0x30(%rsp), %rdi
callq 0x295a0
leaq 0x1f8(%rsp), %rdi
callq 0x295a0
leaq 0xf8(%rsp), %rdi
callq 0x295a0
leaq 0xb8(%rsp), %rdi
callq 0x295a0
leaq 0x1d8(%rsp), %rdi
callq 0x295a0
leaq 0x118(%rsp), %rdi
callq 0x295a0
leaq 0x98(%rsp), %rdi
callq 0x295a0
leaq 0x1b8(%rsp), %rdi
callq 0x295a0
leaq 0x138(%rsp), %rdi
callq 0x295a0
leaq 0x78(%rsp), %rdi
callq 0x295a0
leaq 0x198(%rsp), %rdi
callq 0x295a0
leaq 0x158(%rsp), %rdi
callq 0x295a0
leaq 0x58(%rsp), %rdi
callq 0x295a0
movq %r12, %rdi
callq 0x295a0
leaq 0x178(%rsp), %rdi
callq 0x295a0
movq 0xa8(%r14), %rax
cmpl $0x3, 0x1614(%rax)
jb 0x56055
movq 0x10ff62(%rip), %rdi    # 0x165f98
leaq 0x80653(%rip), %rsi     # 0xd6690
callq 0x289f0
movq %rax, %rdi
movq %r15, %rsi
callq 0x286e0
movq %rax, %rdi
callq 0x284a0
incl %ebx
movl 0x1c(%rsp), %ebp
jmp 0x55b6e
cmpb $0x1, 0x50(%rax)
jne 0x560bc
xorl %ebx, %ebx
movq 0x15c8(%rax), %rcx
subq 0x15c0(%rax), %rcx
shrq $0x3, %rcx
cmpl %ecx, %ebx
ja 0x560df
movq %r14, %rdi
movl %ebx, %esi
callq 0x59f90
testq %rax, %rax
je 0x560b1
movq 0xa8(%r14), %rax
cmpl $0x2, 0x1658(%rax)
jb 0x560a7
movq %r14, %rdi
movl %ebx, %esi
callq 0x53ea4
movq %r14, %rdi
movl %ebx, %esi
callq 0x56486
incl %ebx
movq 0xa8(%r14), %rax
jmp 0x56068
movq %r14, %rdi
movl %ebp, %esi
callq 0x59f90
testq %rax, %rax
je 0x560d5
movq %r14, %rdi
movl %ebp, %esi
callq 0x53ea4
movq %r14, %rdi
movl %ebp, %esi
callq 0x56486
movb 0x28(%rsp), %bl
movq 0xa8(%r14), %rdi
cmpl $0x3, 0x1614(%rdi)
jb 0x56140
movq 0x10fe9e(%rip), %rdi    # 0x165f98
leaq 0x805ad(%rip), %rsi     # 0xd66ae
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movq 0xa8(%r14), %rdi
cmpl $0x5, 0x1614(%rdi)
jb 0x56140
movq 0x10fe73(%rip), %rdi    # 0x165f98
leaq 0x805aa(%rip), %rsi     # 0xd66d6
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movq 0xa8(%r14), %rdi
addq $0x14e0, %rdi           # imm = 0x14E0
leaq 0x79e5b(%rip), %rsi     # 0xcffa9
callq 0x3357b
movq 0xa8(%r14), %rdi
testb %al, %al
je 0x561b3
cmpl $0x3, 0x1614(%rdi)
jb 0x56182
movq 0x10fe2a(%rip), %rdi    # 0x165f98
leaq 0x80572(%rip), %rsi     # 0xd66e7
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movq %r14, %rdi
movl %ebp, %esi
callq 0x568a6
movq 0xa8(%r14), %rax
cmpl $0x3, 0x1614(%rax)
jb 0x5629e
movq 0x10fdf1(%rip), %rdi    # 0x165f98
leaq 0x8055b(%rip), %rsi     # 0xd6709
jmp 0x56291
addq $0x14e0, %rdi           # imm = 0x14E0
leaq 0x86f11(%rip), %rsi     # 0xdd0d2
callq 0x3357b
movq 0xa8(%r14), %rdi
testb %al, %al
je 0x56223
cmpl $0x3, 0x1614(%rdi)
jb 0x561f5
movq 0x10fdb7(%rip), %rdi    # 0x165f98
leaq 0x8053c(%rip), %rsi     # 0xd6724
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movq %r14, %rdi
movl %ebp, %esi
callq 0x57814
movq 0xa8(%r14), %rax
cmpl $0x3, 0x1614(%rax)
jb 0x5629e
movq 0x10fd7e(%rip), %rdi    # 0x165f98
leaq 0x80526(%rip), %rsi     # 0xd6747
jmp 0x56291
addq $0x14e0, %rdi           # imm = 0x14E0
leaq 0xb622a(%rip), %rsi     # 0x10c45b
callq 0x3357b
movq 0xa8(%r14), %rdi
testb %al, %al
je 0x562de
cmpl $0x3, 0x1614(%rdi)
jb 0x56269
movq 0x10fd43(%rip), %rdi    # 0x165f98
leaq 0x8050a(%rip), %rsi     # 0xd6766
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movq %r14, %rdi
movl %ebp, %esi
callq 0x58718
movq 0xa8(%r14), %rax
cmpl $0x3, 0x1614(%rax)
jb 0x5629e
movq 0x10fd0e(%rip), %rdi    # 0x165f98
leaq 0x804f7(%rip), %rsi     # 0xd6788
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movq 0xa8(%r14), %rax
cmpl $0x3, 0x1614(%rax)
jb 0x562c9
movq 0x10fce3(%rip), %rdi    # 0x165f98
leaq 0x804ea(%rip), %rsi     # 0xd67a6
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
testb $0x1, %bl
je 0x55ace
incl 0xb0(%r14)
jmp 0x55ace
addq $0x14e0, %rdi           # imm = 0x14E0
leaq 0x79cc0(%rip), %rsi     # 0xcffac
callq 0x3357b
testb %al, %al
je 0x5629e
movq %r14, %rdi
callq 0x5a10e
movl %eax, %ebx
jmp 0x5629e
movq %rax, %rbx
jmp 0x563c0
movq %rax, %rbx
jmp 0x563cd
movq %rax, %rbx
jmp 0x563da
movq %rax, %rbx
jmp 0x563e7
movq %rax, %rbx
jmp 0x563f4
movq %rax, %rbx
jmp 0x563fe
movq %rax, %rbx
jmp 0x5640b
movq %rax, %rbx
jmp 0x56418
movq %rax, %rbx
jmp 0x56422
movq %rax, %rbx
leaq 0x238(%rsp), %rdi
callq 0x295a0
jmp 0x56366
movq %rax, %rbx
jmp 0x5642f
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x295a0
jmp 0x56378
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x295a0
jmp 0x56387
movq %rax, %rbx
leaq 0x1f8(%rsp), %rdi
callq 0x295a0
jmp 0x56399
movq %rax, %rbx
leaq 0xf8(%rsp), %rdi
callq 0x295a0
leaq 0xb8(%rsp), %rdi
callq 0x295a0
leaq 0x1d8(%rsp), %rdi
callq 0x295a0
leaq 0x118(%rsp), %rdi
callq 0x295a0
leaq 0x98(%rsp), %rdi
callq 0x295a0
leaq 0x1b8(%rsp), %rdi
callq 0x295a0
leaq 0x138(%rsp), %rdi
callq 0x295a0
leaq 0x78(%rsp), %rdi
callq 0x295a0
leaq 0x198(%rsp), %rdi
callq 0x295a0
leaq 0x158(%rsp), %rdi
callq 0x295a0
leaq 0x58(%rsp), %rdi
callq 0x295a0
leaq 0x218(%rsp), %rdi
callq 0x295a0
leaq 0x178(%rsp), %rdi
jmp 0x56451
movq %rax, %rbx
jmp 0x563a6
movq %rax, %rbx
jmp 0x563b3
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x295a0
movq %rbx, %rdi
callq 0x292f0