// File: 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
movq %rsp, %rbp
subq $0x370, %rsp            # imm = 0x370
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x300(%rbp)
movl -0xc(%rbp), %esi
callq 0xac1e0
movl %eax, %ecx
movq -0x300(%rbp), %rax
movl %ecx, -0x10(%rbp)
movl -0x10(%rbp), %ecx
movl %ecx, -0x14(%rbp)
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xaade2
movq 0x22a1ee(%rip), %rdi    # 0x2d4f50
leaq 0x13000f(%rip), %rsi    # 0x1dad78
callq 0x2ff50
movq %rax, %rdi
movl -0x10(%rbp), %esi
callq 0x2f800
movq %rax, %rdi
leaq 0x13631d(%rip), %rsi    # 0x1e10a0
callq 0x2ff50
movq %rax, %rdi
movq -0x300(%rbp), %rax
movl 0x40(%rax), %esi
callq 0x30640
movq %rax, %rdi
leaq 0x139588(%rip), %rsi    # 0x1e432c
callq 0x2ff50
movq %rax, %rdi
movl -0xc(%rbp), %esi
callq 0x30640
movq %rax, %rdi
leaq 0x12fffa(%rip), %rsi    # 0x1dadb8
callq 0x2ff50
movq %rax, %rdi
movl -0xc(%rbp), %esi
callq 0x30640
movq %rax, %rdi
movq 0x22a1f0(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
callq 0x17c510
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
testb $0x1, 0x13f0(%rax)
je 0xab1de
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xaae36
movq 0x22a135(%rip), %rdi    # 0x2d4f50
leaq 0x12ffa3(%rip), %rsi    # 0x1dadc5
callq 0x2ff50
movq %rax, %rdi
movq 0x22a197(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rcx
movq (%rcx), %rdi
movl -0x14(%rbp), %edx
movq 0xa8(%rax), %rax
movq (%rax), %r9
addq $0x18, %r9
xorl %esi, %esi
movl $0x17, %ecx
movl $0x1, %r8d
movl $0x1, (%rsp)
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
callq 0xcefc0
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
movq (%rax), %rdi
addq $0x18, %rdi
movl $0x17, -0x2c(%rbp)
leaq -0x2c(%rbp), %rsi
callq 0xb3160
movq %rax, -0x28(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xb3190
movq %rax, %rdi
addq $0x8, %rdi
addq $0x28, %rdi
callq 0x458f0
movq %rax, -0x20(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x8aed0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x44520
movl %eax, %ecx
movq -0x300(%rbp), %rax
movl %ecx, 0xb0(%rax)
movq 0xa8(%rax), %rax
movq (%rax), %rdi
addq $0x18, %rdi
callq 0xb31c0
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xaaf34
movq 0x22a037(%rip), %rdi    # 0x2d4f50
leaq 0x12feca(%rip), %rsi    # 0x1dadea
callq 0x2ff50
movq %rax, %rdi
movq 0x22a099(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rcx
movq (%rcx), %rdi
movl -0x14(%rbp), %edx
movq 0xa8(%rax), %rax
movq (%rax), %r9
addq $0x18, %r9
xorl %esi, %esi
movl $0x15, %ecx
movl $0x1, %r8d
movl $0x1, (%rsp)
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
callq 0xcefc0
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x100, %rdi            # imm = 0x100
movl -0xc(%rbp), %eax
movl %eax, %esi
callq 0x45190
movq (%rax), %rdi
callq 0xb31e0
movq %rax, %rdi
callq 0xb3200
movq %rax, %rcx
movq -0x300(%rbp), %rax
movq %rcx, -0x38(%rbp)
movq 0xa8(%rax), %rax
movq (%rax), %rdi
addq $0x18, %rdi
movl $0x15, -0x4c(%rbp)
leaq -0x4c(%rbp), %rsi
callq 0xb3160
movq %rax, -0x48(%rbp)
leaq -0x48(%rbp), %rdi
callq 0xb3190
movq %rax, %rdi
addq $0x8, %rdi
addq $0x28, %rdi
callq 0x458f0
movq %rax, -0x40(%rbp)
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
movq (%rax), %rdi
addq $0x18, %rdi
movl $0x15, -0x64(%rbp)
leaq -0x64(%rbp), %rsi
callq 0xb3160
movq %rax, -0x60(%rbp)
leaq -0x60(%rbp), %rdi
callq 0xb3190
movq %rax, %rdi
addq $0x8, %rdi
addq $0x28, %rdi
callq 0x45920
movq %rax, -0x58(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x45860
testb $0x1, %al
jne 0xab056
jmp 0xab1c4
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xab0dc
movq 0x229edc(%rip), %rdi    # 0x2d4f50
leaq 0x12fdb8(%rip), %rsi    # 0x1dae33
callq 0x2ff50
movq %rax, -0x310(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xb3230
movq -0x310(%rbp), %rdi
movq %rax, %rsi
callq 0x2f780
movq %rax, %rdi
leaq 0x1387db(%rip), %rsi    # 0x1e3884
callq 0x2ff50
movq %rax, -0x308(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x8aed0
movq -0x308(%rbp), %rdi
movq %rax, %rsi
callq 0x2f780
movq %rax, %rdi
movq 0x229ef1(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
movq -0x300(%rbp), %rdi
movl -0xc(%rbp), %eax
movl %eax, %esi
callq 0xb2a00
movq %rax, -0x330(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xb3230
movq %rax, -0x338(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x8aed0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x44830
movq -0x338(%rbp), %rsi
movsd %xmm0, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
movq %rdi, -0x328(%rbp)
leaq -0x98(%rbp), %rdx
callq 0x8e760
movq -0x330(%rbp), %rdi
movq -0x328(%rbp), %rsi
callq 0x8e720
movb %dl, -0x319(%rbp)
movq %rax, -0x318(%rbp)
jmp 0xab164
movb -0x319(%rbp), %al
movq -0x318(%rbp), %rcx
movq %rcx, -0xb8(%rbp)
movb %al, -0xb0(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x8e7a0
leaq -0x38(%rbp), %rdi
callq 0xb3260
leaq -0x40(%rbp), %rdi
callq 0x8aef0
jmp 0xaaffa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x8e7a0
jmp 0xac1c9
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
movq (%rax), %rdi
addq $0x18, %rdi
callq 0xb31c0
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x20, %rdi
leaq 0x1662fd(%rip), %rsi    # 0x2114fb
callq 0x44930
testb $0x1, %al
jne 0xab20c
jmp 0xab2d6
movl $0x1, -0xbc(%rbp)
movq -0x300(%rbp), %rcx
movl -0xbc(%rbp), %eax
movq 0xa8(%rcx), %rcx
cmpl 0x16fc(%rcx), %eax
ja 0xab2d2
movl $0x1, -0xc0(%rbp)
movq -0x300(%rbp), %rcx
movl -0xc0(%rbp), %eax
movl %eax, -0x33c(%rbp)
movq 0xa8(%rcx), %rax
movl 0x1620(%rax), %eax
movq 0xa8(%rcx), %rcx
xorl %edx, %edx
divl 0x16fc(%rcx)
movl %eax, %ecx
movl -0x33c(%rbp), %eax
imull -0xbc(%rbp), %ecx
cmpl %ecx, %eax
ja 0xab2bc
movq -0x300(%rbp), %rcx
movl -0xc0(%rbp), %eax
cmpl 0x40(%rcx), %eax
jne 0xab2a9
movq -0x300(%rbp), %rax
movl -0xbc(%rbp), %ecx
movl %ecx, 0xb4(%rax)
jmp 0xab2d4
jmp 0xab2ab
movl -0xc0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc0(%rbp)
jmp 0xab240
jmp 0xab2be
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0xab216
jmp 0xab2d4
jmp 0xab2d6
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xab329
movq 0x229c5c(%rip), %rdi    # 0x2d4f50
leaq 0x1374ab(%rip), %rsi    # 0x1e27a6
callq 0x2ff50
movq %rax, %rdi
movl -0x14(%rbp), %esi
callq 0x2f800
movq %rax, %rdi
leaq 0x12fb28(%rip), %rsi    # 0x1dae3d
callq 0x2ff50
movq %rax, %rdi
movq 0x229ca4(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rcx
movq (%rcx), %rdi
movl -0x14(%rbp), %edx
movq 0xa8(%rax), %rax
movq (%rax), %r9
addq $0x18, %r9
xorl %esi, %esi
movl $0x12, %ecx
movl $0x1, %r8d
movl $0x1, (%rsp)
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
callq 0xcefc0
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
movq (%rax), %rdi
addq $0x18, %rdi
callq 0xb31c0
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xab3e0
movq 0x229bac(%rip), %rdi    # 0x2d4f50
leaq 0x1376e9(%rip), %rsi    # 0x1e2a94
callq 0x2ff50
movq %rax, %rdi
movq -0x300(%rbp), %rax
movl 0x40(%rax), %esi
callq 0x30640
movq %rax, %rdi
leaq 0x12fa83(%rip), %rsi    # 0x1dae4f
callq 0x2ff50
movq %rax, %rdi
movq 0x229bed(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xab419
movq 0x229b52(%rip), %rdi    # 0x2d4f50
leaq 0x12fa54(%rip), %rsi    # 0x1dae59
callq 0x2ff50
movq %rax, %rdi
movq 0x229bb4(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
movb $0x1, -0xc1(%rbp)
movb $0x1, -0xc2(%rbp)
testb $0x1, -0xc1(%rbp)
je 0xac187
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x0, 0x13ec(%rax)
jbe 0xab4b8
movq -0x300(%rbp), %rax
cmpl $0x1, 0xb0(%rax)
jne 0xab4b8
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rcx
movq (%rcx), %rdi
movl -0x14(%rbp), %edx
movq 0xa8(%rax), %rax
movq (%rax), %r9
addq $0x18, %r9
xorl %esi, %esi
movl $0x12, %ecx
movl $0x1, %r8d
movl $0x1, (%rsp)
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
callq 0xcefc0
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
movq (%rax), %rdi
addq $0x18, %rdi
callq 0xb31c0
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xab506
movq 0x229a7a(%rip), %rdi    # 0x2d4f50
leaq 0x12f9a4(%rip), %rsi    # 0x1dae81
callq 0x2ff50
movq %rax, %rdi
movq -0x300(%rbp), %rax
movl 0xb0(%rax), %esi
callq 0x30640
movq %rax, %rdi
movq 0x229ac7(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
testb $0x1, -0xc2(%rbp)
je 0xabe4c
movl $0x1, -0xc8(%rbp)
movq -0x300(%rbp), %rcx
movl -0xc8(%rbp), %eax
movq 0xa8(%rcx), %rcx
cmpl 0x1658(%rcx), %eax
ja 0xabd5f
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xab584
movq 0x2299f5(%rip), %rdi    # 0x2d4f50
leaq 0x12f93a(%rip), %rsi    # 0x1dae9c
callq 0x2ff50
movq %rax, %rdi
movl -0xc8(%rbp), %esi
callq 0x30640
movq %rax, %rdi
movq 0x229a49(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
testb $0x1, 0x50(%rax)
je 0xab6ef
movl $0x0, -0xcc(%rbp)
movq -0x300(%rbp), %rax
movl -0xcc(%rbp), %ecx
movl %ecx, -0x340(%rbp)
movq 0xa8(%rax), %rdi
callq 0x8dec0
movl %eax, %ecx
movl -0x340(%rbp), %eax
cmpl %ecx, %eax
ja 0xab6ea
movq -0x300(%rbp), %rdi
movl -0xcc(%rbp), %esi
callq 0xb2a40
cmpq $0x0, %rax
je 0xab6d4
movq -0x300(%rbp), %rdi
movl -0xcc(%rbp), %esi
callq 0xb2a40
movq %rax, %rdi
movl -0xc8(%rbp), %esi
xorl %edx, %edx
callq 0xa5c70
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xab6d2
movq 0x22991b(%rip), %rdi    # 0x2d4f50
leaq 0x12f886(%rip), %rsi    # 0x1daec2
callq 0x2ff50
movq -0x300(%rbp), %rdi
movq %rax, -0x348(%rbp)
movl -0xcc(%rbp), %esi
callq 0xac1e0
movq -0x348(%rbp), %rdi
movl %eax, %esi
callq 0x30640
movq %rax, %rdi
leaq 0x135a2e(%rip), %rsi    # 0x1e10a0
callq 0x2ff50
movq %rax, %rdi
movq -0x300(%rbp), %rax
movl 0x40(%rax), %esi
callq 0x30640
movq %rax, %rdi
leaq 0x138c99(%rip), %rsi    # 0x1e432c
callq 0x2ff50
movq %rax, %rdi
movl -0xcc(%rbp), %esi
callq 0x30640
movq %rax, %rdi
leaq 0x12f83e(%rip), %rsi    # 0x1daeee
callq 0x2ff50
movq %rax, %rdi
movl -0xc8(%rbp), %esi
callq 0x30640
movq %rax, %rdi
leaq 0x12f832(%rip), %rsi    # 0x1daeff
callq 0x2ff50
jmp 0xab6d4
jmp 0xab6d6
movl -0xcc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
jmp 0xab5a6
jmp 0xabd02
movq -0x300(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xb2a40
cmpq $0x0, %rax
je 0xab82d
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xab7a8
movq 0x229826(%rip), %rdi    # 0x2d4f50
leaq 0x12f791(%rip), %rsi    # 0x1daec2
callq 0x2ff50
movq %rax, %rdi
movl -0x10(%rbp), %esi
callq 0x2f800
movq %rax, %rdi
leaq 0x135955(%rip), %rsi    # 0x1e10a0
callq 0x2ff50
movq %rax, %rdi
movq -0x300(%rbp), %rax
movl 0x40(%rax), %esi
callq 0x30640
movq %rax, %rdi
leaq 0x138bc0(%rip), %rsi    # 0x1e432c
callq 0x2ff50
movq %rax, %rdi
movl -0xc(%rbp), %esi
callq 0x30640
movq %rax, %rdi
leaq 0x12f768(%rip), %rsi    # 0x1daeee
callq 0x2ff50
movq %rax, %rdi
movl -0xc8(%rbp), %esi
callq 0x30640
movq %rax, %rdi
leaq 0x12f76e(%rip), %rsi    # 0x1daf11
callq 0x2ff50
movq -0x300(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xb2a40
movq %rax, %rdi
movl -0xc8(%rbp), %esi
xorl %edx, %edx
callq 0xa5c70
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xab828
movq 0x22976b(%rip), %rdi    # 0x2d4f50
leaq 0x12f735(%rip), %rsi    # 0x1daf21
callq 0x2ff50
movq %rax, %rdi
movl -0xc(%rbp), %esi
callq 0x30640
movq %rax, %rdi
leaq 0x12f6e9(%rip), %rsi    # 0x1daeef
callq 0x2ff50
movq %rax, %rdi
movl -0xc8(%rbp), %esi
callq 0x30640
movq %rax, %rdi
leaq 0x12f6dc(%rip), %rsi    # 0x1daeff
callq 0x2ff50
jmp 0xabd00
movl -0x10(%rbp), %esi
leaq -0x250(%rbp), %rdi
movq %rdi, -0x350(%rbp)
callq 0x17ce40
movq -0x350(%rbp), %rdx
leaq 0x12f6fb(%rip), %rsi    # 0x1daf4c
leaq -0x230(%rbp), %rdi
callq 0x8e0f0
jmp 0xab85f
leaq 0x13583a(%rip), %rdx    # 0x1e10a0
leaq -0x210(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x441f0
jmp 0xab87b
movq -0x300(%rbp), %rax
movl 0x40(%rax), %esi
leaq -0x270(%rbp), %rdi
callq 0x17e460
jmp 0xab893
leaq -0x1f0(%rbp), %rdi
leaq -0x210(%rbp), %rsi
leaq -0x270(%rbp), %rdx
callq 0x9c7d0
jmp 0xab8af
leaq 0x12f6bd(%rip), %rdx    # 0x1daf73
leaq -0x1d0(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x441f0
jmp 0xab8cb
movl -0xc(%rbp), %esi
leaq -0x290(%rbp), %rdi
callq 0x17e460
jmp 0xab8dc
leaq -0x1b0(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
leaq -0x290(%rbp), %rdx
callq 0x9c7d0
jmp 0xab8f8
leaq 0x12f677(%rip), %rdx    # 0x1daf76
leaq -0x190(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x441f0
jmp 0xab914
movq -0x300(%rbp), %rax
movl 0x40(%rax), %esi
leaq -0x2b0(%rbp), %rdi
callq 0x17e460
jmp 0xab92c
leaq -0x170(%rbp), %rdi
leaq -0x190(%rbp), %rsi
leaq -0x2b0(%rbp), %rdx
callq 0x9c7d0
jmp 0xab948
leaq 0x12fbe4(%rip), %rdx    # 0x1db533
leaq -0x150(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x441f0
jmp 0xab964
movl -0xc(%rbp), %esi
leaq -0x2d0(%rbp), %rdi
callq 0x17e460
jmp 0xab975
leaq -0x130(%rbp), %rdi
leaq -0x150(%rbp), %rsi
leaq -0x2d0(%rbp), %rdx
callq 0x9c7d0
jmp 0xab991
leaq 0x12f5ec(%rip), %rdx    # 0x1daf84
leaq -0x110(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x441f0
jmp 0xab9ad
movl -0x10(%rbp), %esi
leaq -0x2f0(%rbp), %rdi
callq 0x17ce40
jmp 0xab9be
leaq -0xf0(%rbp), %rdi
leaq -0x110(%rbp), %rsi
leaq -0x2f0(%rbp), %rdx
callq 0x9c7d0
jmp 0xab9da
leaq -0xf0(%rbp), %rdi
callq 0x17e420
jmp 0xab9e8
leaq -0xf0(%rbp), %rdi
callq 0x311e8
leaq -0x2f0(%rbp), %rdi
callq 0x311e8
leaq -0x110(%rbp), %rdi
callq 0x311e8
leaq -0x130(%rbp), %rdi
callq 0x311e8
leaq -0x2d0(%rbp), %rdi
callq 0x311e8
leaq -0x150(%rbp), %rdi
callq 0x311e8
leaq -0x170(%rbp), %rdi
callq 0x311e8
leaq -0x2b0(%rbp), %rdi
callq 0x311e8
leaq -0x190(%rbp), %rdi
callq 0x311e8
leaq -0x1b0(%rbp), %rdi
callq 0x311e8
leaq -0x290(%rbp), %rdi
callq 0x311e8
leaq -0x1d0(%rbp), %rdi
callq 0x311e8
leaq -0x1f0(%rbp), %rdi
callq 0x311e8
leaq -0x270(%rbp), %rdi
callq 0x311e8
leaq -0x210(%rbp), %rdi
callq 0x311e8
leaq -0x230(%rbp), %rdi
callq 0x311e8
leaq -0x250(%rbp), %rdi
callq 0x311e8
jmp 0xabd00
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xabcef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xabce3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xabcd7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xabccb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xabcbf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xabcb3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xabca7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xabc9b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xabc8f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xabc83
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xabc77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xabc6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xabc5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xabc53
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xabc47
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xabc3b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x311e8
leaq -0x2f0(%rbp), %rdi
callq 0x311e8
leaq -0x110(%rbp), %rdi
callq 0x311e8
leaq -0x130(%rbp), %rdi
callq 0x311e8
leaq -0x2d0(%rbp), %rdi
callq 0x311e8
leaq -0x150(%rbp), %rdi
callq 0x311e8
leaq -0x170(%rbp), %rdi
callq 0x311e8
leaq -0x2b0(%rbp), %rdi
callq 0x311e8
leaq -0x190(%rbp), %rdi
callq 0x311e8
leaq -0x1b0(%rbp), %rdi
callq 0x311e8
leaq -0x290(%rbp), %rdi
callq 0x311e8
leaq -0x1d0(%rbp), %rdi
callq 0x311e8
leaq -0x1f0(%rbp), %rdi
callq 0x311e8
leaq -0x270(%rbp), %rdi
callq 0x311e8
leaq -0x210(%rbp), %rdi
callq 0x311e8
leaq -0x230(%rbp), %rdi
callq 0x311e8
leaq -0x250(%rbp), %rdi
callq 0x311e8
jmp 0xac1c9
jmp 0xabd02
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xabd49
movq 0x229230(%rip), %rdi    # 0x2d4f50
leaq 0x12f269(%rip), %rsi    # 0x1daf90
callq 0x2ff50
movq %rax, %rdi
movl -0xc8(%rbp), %esi
callq 0x30640
movq %rax, %rdi
movq 0x229284(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xabd4b
movl -0xc8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc8(%rbp)
jmp 0xab51d
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
testb $0x1, 0x50(%rax)
je 0xabe17
movl $0x0, -0x2f4(%rbp)
movq -0x300(%rbp), %rax
movl -0x2f4(%rbp), %ecx
movl %ecx, -0x354(%rbp)
movq 0xa8(%rax), %rdi
callq 0x8dec0
movl %eax, %ecx
movl -0x354(%rbp), %eax
cmpl %ecx, %eax
ja 0xabe15
movq -0x300(%rbp), %rdi
movl -0x2f4(%rbp), %esi
callq 0xb2a40
cmpq $0x0, %rax
je 0xabdff
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x1, 0x1658(%rax)
jbe 0xabded
movq -0x300(%rbp), %rdi
movl -0x2f4(%rbp), %esi
callq 0xa86f0
movq -0x300(%rbp), %rdi
movl -0x2f4(%rbp), %esi
callq 0xac230
jmp 0xabe01
movl -0x2f4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2f4(%rbp)
jmp 0xabd81
jmp 0xabe4a
movq -0x300(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xb2a40
cmpq $0x0, %rax
je 0xabe3b
movq -0x300(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xa86f0
movq -0x300(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xac230
jmp 0xabe53
movb $0x1, -0xc2(%rbp)
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xabe8c
movq 0x2290df(%rip), %rdi    # 0x2d4f50
leaq 0x12f136(%rip), %rsi    # 0x1dafae
callq 0x2ff50
movq %rax, %rdi
movq 0x229141(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x5, 0x1614(%rax)
jb 0xabec5
movq 0x2290a6(%rip), %rdi    # 0x2d4f50
leaq 0x12f125(%rip), %rsi    # 0x1dafd6
callq 0x2ff50
movq %rax, %rdi
movq 0x229108(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x20, %rdi
leaq 0x1284f9(%rip), %rsi    # 0x1d43de
callq 0x44930
testb $0x1, %al
jne 0xabef3
jmp 0xabf79
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xabf2c
movq 0x22903f(%rip), %rdi    # 0x2d4f50
leaq 0x12f0cf(%rip), %rsi    # 0x1dafe7
callq 0x2ff50
movq %rax, %rdi
movq 0x2290a1(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
movq -0x300(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xac870
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xabf74
movq 0x228ff7(%rip), %rdi    # 0x2d4f50
leaq 0x12f0a9(%rip), %rsi    # 0x1db009
callq 0x2ff50
movq %rax, %rdi
movq 0x229059(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xac123
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x20, %rdi
leaq 0x135aa9(%rip), %rsi    # 0x1e1a42
callq 0x44930
testb $0x1, %al
jne 0xabfa7
jmp 0xac02d
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xabfe0
movq 0x228f8b(%rip), %rdi    # 0x2d4f50
leaq 0x12f058(%rip), %rsi    # 0x1db024
callq 0x2ff50
movq %rax, %rdi
movq 0x228fed(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
movq -0x300(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xae240
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xac028
movq 0x228f43(%rip), %rdi    # 0x2d4f50
leaq 0x12f033(%rip), %rsi    # 0x1db047
callq 0x2ff50
movq %rax, %rdi
movq 0x228fa5(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xac121
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x20, %rdi
leaq 0x1654ae(%rip), %rsi    # 0x2114fb
callq 0x44930
testb $0x1, %al
jne 0xac05b
jmp 0xac0de
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xac094
movq 0x228ed7(%rip), %rdi    # 0x2d4f50
leaq 0x12efe6(%rip), %rsi    # 0x1db066
callq 0x2ff50
movq %rax, %rdi
movq 0x228f39(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
movq -0x300(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xafad0
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xac0dc
movq 0x228e8f(%rip), %rdi    # 0x2d4f50
leaq 0x12efc0(%rip), %rsi    # 0x1db088
callq 0x2ff50
movq %rax, %rdi
movq 0x228ef1(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xac11f
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x20, %rdi
leaq 0x1282e3(%rip), %rsi    # 0x1d43e1
callq 0x44930
testb $0x1, %al
jne 0xac109
jmp 0xac11d
movq -0x300(%rbp), %rdi
callq 0xb3290
andb $0x1, %al
movb %al, -0xc2(%rbp)
jmp 0xac11f
jmp 0xac121
jmp 0xac123
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xac15c
movq 0x228e0f(%rip), %rdi    # 0x2d4f50
leaq 0x12ef5e(%rip), %rsi    # 0x1db0a6
callq 0x2ff50
movq %rax, %rdi
movq 0x228e71(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
movb -0xc2(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0xac182
movq -0x300(%rbp), %rax
movl 0xb0(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xb0(%rax)
jmp 0xab427
movq -0x300(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xac1c0
movq 0x228dab(%rip), %rdi    # 0x2d4f50
leaq 0x12ef1e(%rip), %rsi    # 0x1db0ca
callq 0x2ff50
movq %rax, %rdi
movq 0x228e0d(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
addq $0x370, %rsp            # imm = 0x370
popq %rbp
retq
movq -0xa0(%rbp), %rdi
callq 0x30170
nopw %cs:(%rax,%rax)