// File: /workspace/github_cpp_makefile_star2_O2/richardposner[P]BioNetFit2/src/code/Swarm.cpp
// Function: Swarm::initFit()
void Swarm::initFit () {  //razi: modified version
	int i, nModels=options.models.size();
	if (resumingSavedSwarm) {
		//razi: TODO modify this part
		cout << "Resuming fitting run. May need some modifcation to support multiple files. Enter a number..." << endl; cin>>i;

		/*
		for (auto particle = particleIterationCounter_.begin(); particle != particleIterationCounter_.end(); ++particle) {
			swarmComm->univMessageSender.push_back(toString(currentGeneration - 1));

			cout<<"Init fit, modify this line ...\n";
			for (unsigned int mid = 0; mid < options.models.size(); ++mid)
				swarmComm->sendToSwarm(0, particle->first, SEND_NUMFLIGHTS_TO_PARTICLE, false, swarmComm->univMessageSender);
			swarmComm->univMessageSender.clear();

			for (auto param = particleCurrParamSets_.at(particle->first).begin(); param != particleCurrParamSets_.at(particle->first).end(); ++param) {
				//cout << "Sending " << *param << " to " << particle->first << endl;
				swarmComm->univMessageSender.push_back(toString(*param));
			}
			swarmComm->sendToSwarm(0, particle->first, SEND_FINAL_PARAMS_TO_PARTICLE, false, swarmComm->univMessageSender);
			swarmComm->univMessageSender.clear();
		}

		// We need to set current generation to the iteration counter because the saved swarm
		// currentGeneration may not be accurate due to it changed between runGeneration() and
		// breedGenerationGA()
		if (options.fitType == "ga") {
			currentGeneration = currentGeneration - 1;
		}

		*/
	}
	else {
		if (options.verbosity >= 3) {
			cout << "Initializing fitting run" << endl;
		}

		// If we are running ODE, we want to generate a network and network reader.
		// The network file has parameters that are replaced in every generation,
		// and the network reader is used to read those network files

		//razi, generate subparticles, set particle id to 1;
		unsigned int ParID = 1; unsigned int subParId;

		Particle p = Particle(this, 1); bool genNetworkFlag = false;
		vector<subParticle *> sp(nModels);
		for (int mid=0; mid <nModels; mid++){
			if (options.models.at(mid)->getHasGenerateNetwork() && bootstrapCounter == 0) {

				genNetworkFlag = true;
				if (options.verbosity >= 3) {
					cout << "Creating dummy .bngl, running to get a .net file" << endl;
				}

				// First create a particle which will generate the network
				// and fill it with dummy params
				p.setModel(options.models[mid], mid);

				subParId= fcalcsubParID(ParID, mid, nModels); //razi: calc subparticle id from model index
				sp[mid] = new subParticle(&p, mid, subParId); //razi: generate subparticles
				//sp[mid]->setModel(mid);

			}
		}
		if (genNetworkFlag){
			p.generateParams();

			// Output model file with dummy parameters. This file will be used to generate
			// our initial network
			//razi, was options.model->outputModelWithParams(p.getParams(), options.jobOutputDir, "base.bngl", "", false, false, false, false, false);
			for (unsigned int mid = 0; mid < options.models.size(); ++mid){
				options.models[mid]->outputModelWithParams(p.getParams(mid), options.jobOutputDir, p.swarm_->getModelName(mid, false)+"_base.bngl", "", false, false, false, false, false);

				// Construct our simulation command and run the network generator

				string modelPath;
				if (options.jobOutputDir.substr(options.jobOutputDir.size()-1,1)=="/")   //razi added to avoid "//" in windows
					modelPath = options.jobOutputDir + p.swarm_->getModelName(mid, false)+"_base.bngl";
				else
					modelPath = options.jobOutputDir + "/" + p.swarm_->getModelName(mid, false)+"_base.bngl";

				string command = options.bngCommand + " --outdir " + options.jobOutputDir + " " + modelPath + " > " + options.jobOutputDir + "netgen_output 2>&1";
				if(options.verbosity>=1){
					cout << "Generating initial .net file with command: " << command << endl;
				}
				if (options.useCluster) {
					if(options.clusterSoftware == "slurm"){
						command = generateSlurmCommand(command, false, 1);
					}

				}

				int ret; ret= runCommand(command);
				if (ret != 0){
#ifdef PC_VER  //This is only for debugging in windows, the return value is 0 due to some error in BNG2.pl, later to be checked
					cout<<"Warning: Net file may not be generated properly: " <<command<<endl;
#else
					outputError("Error(32): Couldn't generate initial .net file with command: " + command + ". Quitting.");
#endif
				}else{
						// Now that we have a .net file, replace the full .bngl with a .bngl
					// containing ONLY action commands and a .net file loader. This is
					// used later to run our .net files.
					options.models[mid]->outputModelWithParams(p.getParams(mid), options.jobOutputDir, p.swarm_->getModelName(mid, false)+"_base.bngl", "", false, true, false, false, false);

					// Now store our .net file for later use
					//razi, was string netPath = options.jobOutputDir + "/base.net";
					string netPath = options.jobOutputDir + "/"  + p.swarm_->getModelName(mid, false)+"_base.net";
					//netPath=removeLastSlash(netPath);  //razi added for windows, already taken care of
					options.models[mid]->parseNet(netPath);
				}
			}
		}


/*
#if(defined(PC_VER))  //This is only for debugging in windows, the return value is 0 due to some error in BNG2.pl, later to be checked
		// random simulation is requested, just copy the exp file plus some noise into gdat files
		if (options.bngCommand.find("random")!=std::string::npos){
			ret=0;

		}
#endif
*/


		vector<double> params;
		int subPar = 0; //Raquel added to support subparticles
		for (unsigned int param = 0; param < getNumFreeParams(); ++param) {  //Razi: All free params tat appear in some models
			params.push_back(0);
		}

		for (int particle = 1; particle <= options.swarmSize; ++particle) {
			particleCurrParamSets_.insert(pair<int, vector<double> >(particle, params));

			//razi: init for each subparticle
			map<unsigned int, vector<double> > zmap;
			for (unsigned int mid = 0; mid < options.models.size(); ++mid){
				vector<double> zvec(options.models[mid]->getNumFreeParams());	//razi: dummy vector t contain free parameter values
				zmap.insert(make_pair(mid, zvec));
			}
			subparticleCurrParamSets_.insert(make_pair(particle, zmap));

		}


		if (options.fitType == "pso") {
			for (int particle = 1; particle <= options.swarmSize; ++particle) {
				particleParamVelocities_[particle] = params;
				particleBestParamSets_[particle] = params;
				particleWeights_[particle] = 0;
				for (int mid=0; mid<nModels; mid++)
					particleIterationCounter_[particle][mid] = 0;
			}
		}
		if (options.fitType == "pso" || "de") {
			int subPar = 0;

			for (int particle = 1; particle <= options.swarmSize; ++particle) {
				particleBestFits_[particle] = 0;

				//Raquel: added support for subparticles
				for(int mid = 0; (unsigned) mid < options.models.size(); mid++){
					subPar = fcalcsubParID(particle, mid, options.models.size());
					subparticleBestFits_[subPar] = 0;
				}//Raquel: added support for subparticles

			}
		}
		if(options.fitType == "de") {
			for (unsigned int island = 0; island <= options.numIslands; ++island) {
				islandToParticle_.push_back(vector<unsigned int>(options.swarmSize / options.numIslands,0));
			}
			for (int particle = 1; particle <= options.swarmSize; ++particle) {
				particleToIsland_.push_back(0);
				particleBestFitsByFit_.insert(pair<double, unsigned int>(0, particle));

				//Raquel added this loop to support subparticles
				for(unsigned int mid = 0; mid < options.models.size(); mid++){
					subPar = fcalcsubParID(particle, mid, options.models.size());
					subparticleBestFitsByFit_.insert(pair<double, unsigned int>(0, subPar));

				}//Raquel added this loop to support subparticles

			}
		}
		if (options.fitType == "sa") {
			for (int particle = 1; particle <= options.swarmSize; ++particle) {
				particleBestFitsByFit_.insert(pair<double, unsigned int>(0, particle));

				//Raquel added this loop to support subparticles
				for(unsigned int mid = 0; mid < options.models.size(); mid++){
					subPar = fcalcsubParID(particle, mid, options.models.size());
					subparticleBestFitsByFit_.insert(pair<double, unsigned int>(0, subPar));
					currentsubparticleBestFitsByFit_.insert(pair<double, unsigned int>(0, subPar));

				}//Raquel added this loop to support subparticles


			}


		}



	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3e8, %rsp            # imm = 0x3E8
cmpb $0x1, 0x13f0(%rdi)
jne 0x6bebc
movq 0xfa109(%rip), %rdi     # 0x165f98
leaq 0x70a80(%rip), %rsi     # 0xdc916
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movq 0xfa126(%rip), %rdi     # 0x165fd0
leaq 0x10c(%rsp), %rsi
callq 0x28630
jmp 0x6cb8a
movq %rdi, %rbx
movq 0x15c8(%rdi), %r14
subq 0x15c0(%rdi), %r14
shrq $0x3, %r14
cmpl $0x3, 0x1614(%rdi)
jb 0x6bef5
movq 0xfa0b7(%rip), %rdi     # 0x165f98
leaq 0x70a8b(%rip), %rsi     # 0xdc973
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
leaq 0x328(%rsp), %rdi
pushq $0x1
popq %rdx
movq %rbx, %rsi
callq 0x50880
movslq %r14d, %rsi
leaq 0x130(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x85ef8
movq %rbx, (%rsp)
leaq 0x15c0(%rbx), %rax
movq %rax, 0x10(%rsp)
xorl %r15d, %r15d
testl %r14d, %r14d
movl $0x0, %eax
cmovgl %r14d, %eax
movq %rax, 0x20(%rsp)
leaq 0x328(%rsp), %rbp
xorl %ebx, %ebx
cmpq %r15, 0x20(%rsp)
je 0x6c002
movq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x3374c
movq (%rax), %rax
cmpb $0x1, 0xb8(%rax)
jne 0x6bffa
movq (%rsp), %rax
cmpl $0x0, 0x13ec(%rax)
jne 0x6bffa
movq (%rsp), %rax
cmpl $0x3, 0x1614(%rax)
jb 0x6bfa8
movq 0xfa004(%rip), %rdi     # 0x165f98
leaq 0x709f1(%rip), %rsi     # 0xdc98c
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax,%r15,8), %rsi
movq %rbp, %rdi
movl %r15d, %edx
callq 0x597cc
pushq $0x1
popq %rdi
movl %r15d, %esi
movl %r14d, %edx
callq 0x9ec09
movl %eax, %r12d
pushq $0x20
popq %rdi
callq 0x28a10
movq %rax, %r13
movq %rax, %rdi
movq %rbp, %rsi
movl %r15d, %edx
movl %r12d, %ecx
callq 0x598a6
movq 0x130(%rsp), %rax
movq %r13, (%rax,%r15,8)
movb $0x1, %bl
incq %r15
jmp 0x6bf4b
testb $0x1, %bl
je 0x6c665
leaq 0x328(%rsp), %rdi
callq 0x50cca
movq (%rsp), %rax
leaq 0x1520(%rax), %r12
leaq 0x1540(%rax), %rcx
movq %rcx, 0x100(%rsp)
addq $0x1730, %rax           # imm = 0x1730
movq %rax, 0xf8(%rsp)
xorl %edx, %edx
leaq 0x248(%rsp), %rdi
leaq 0xa8(%rsp), %r15
movq %r12, 0x18(%rsp)
movl %edx, %edx
movq (%rsp), %rcx
movq 0x15c0(%rcx), %rax
movq 0x15c8(%rcx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rdx, %rcx
jbe 0x6c665
movq (%rax,%rdx,8), %rbp
movq %rdx, 0x8(%rsp)
imulq $0x30, %rdx, %rbx
movq 0x328(%rsp), %rsi
addq %rbx, %rsi
callq 0x4e96a
movq %rbx, 0x80(%rsp)
leaq 0x228(%rsp), %rdi
movq %r12, %rsi
callq 0x28dd0
movq 0x3d0(%rsp), %rsi
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
movq 0x8(%rsp), %rdx
xorl %ecx, %ecx
callq 0x6bd9a
leaq 0x208(%rsp), %rdi
movq %rbx, %rsi
leaq 0x708df(%rip), %rdx     # 0xdc9bd
callq 0x3336c
leaq 0x308(%rsp), %rbx
movq %rbx, %rdi
leaq 0x68b0c(%rip), %rsi     # 0xd4c01
movq %r15, %r13
movq %r15, %rdx
callq 0x33402
movq %rbx, %r15
movq %rbp, %rdi
leaq 0x248(%rsp), %rbx
movq %rbx, %rsi
leaq 0x228(%rsp), %rbp
movq %rbp, %rdx
leaq 0x208(%rsp), %r14
movq %r14, %rcx
movq %r15, %r8
xorl %r9d, %r9d
pushq $0x0
pushq $0x0
pushq $0x0
pushq $0x0
callq 0x4cf22
addq $0x20, %rsp
movq %r15, %rdi
callq 0x295a0
movq %r14, %rdi
callq 0x295a0
leaq 0x28(%rsp), %rdi
callq 0x295a0
movq %rbp, %rdi
callq 0x295a0
movq %rbx, %rdi
callq 0x495ac
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
andq $0x0, 0x30(%rsp)
movb $0x0, 0x38(%rsp)
movq (%rsp), %rax
movq 0x1528(%rax), %rdx
decq %rdx
movq %r13, %r15
movq %r13, %rdi
movq 0x18(%rsp), %rsi
pushq $0x1
popq %rcx
callq 0x28a90
movq %r15, %rdi
leaq 0x7180f(%rip), %r14     # 0xdd9b7
movq %r14, %rsi
callq 0x3357b
movl %eax, %ebx
movq %r15, %rdi
callq 0x295a0
testb %bl, %bl
je 0x6c224
movq 0x3d0(%rsp), %rsi
leaq 0x88(%rsp), %rbx
movq %rbx, %rdi
movq 0x8(%rsp), %rdx
xorl %ecx, %ecx
callq 0x6bd9a
leaq 0x60(%rsp), %r13
movq %r13, %rdi
movq 0x18(%rsp), %r12
movq %r12, %rsi
movq %rbx, %rdx
callq 0x5a115
movq %r15, %rdi
movq %r13, %rsi
leaq 0x707bb(%rip), %rdx     # 0xdc9bd
callq 0x3336c
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x28c40
movq %r15, %rdi
callq 0x295a0
movq %r13, %rdi
jmp 0x6c2ac
leaq 0x88(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %r14, %rdx
callq 0x334ed
movq 0x3d0(%rsp), %rsi
leaq 0xd8(%rsp), %r12
movq %r12, %rdi
movq 0x8(%rsp), %rdx
xorl %ecx, %ecx
callq 0x6bd9a
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
leaq 0x88(%rsp), %rsi
movq %r12, %rdx
callq 0x4e6ed
movq 0x18(%rsp), %r12
movq %r15, %rdi
movq %rbx, %rsi
leaq 0x7073b(%rip), %rdx     # 0xdc9bd
callq 0x3336c
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x28c40
movq %r15, %rdi
callq 0x295a0
movq %rbx, %rdi
callq 0x295a0
leaq 0xd8(%rsp), %rdi
callq 0x295a0
leaq 0x88(%rsp), %rdi
callq 0x295a0
leaq 0x1c8(%rsp), %rbx
movq %rbx, %rdi
movq 0x100(%rsp), %rsi
leaq 0x6a808(%rip), %rdx     # 0xd6ae0
callq 0x334ed
leaq 0x1e8(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x334ce
leaq 0x110(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
leaq 0x73305(%rip), %rdx     # 0xdf60d
callq 0x3336c
leaq 0xd8(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
leaq 0x28(%rsp), %rdx
callq 0x334ce
leaq 0x88(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
leaq 0x7068e(%rip), %rdx     # 0xdc9c8
callq 0x3336c
leaq 0x60(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x334ce
movq %r15, %rdi
movq %r13, %rsi
leaq 0x7066d(%rip), %rdx     # 0xdc9cc
callq 0x3336c
movq %r13, %rdi
callq 0x295a0
leaq 0x88(%rsp), %rdi
callq 0x295a0
leaq 0xd8(%rsp), %rdi
callq 0x295a0
leaq 0x110(%rsp), %rdi
callq 0x295a0
leaq 0x1e8(%rsp), %rdi
callq 0x295a0
leaq 0x1c8(%rsp), %rdi
callq 0x295a0
movq (%rsp), %rax
cmpl $0x0, 0x1614(%rax)
je 0x6c3e0
movq 0xf9bd7(%rip), %rdi     # 0x165f98
leaq 0x70617(%rip), %rsi     # 0xdc9df
callq 0x289f0
movq %rax, %rdi
movq %r15, %rsi
callq 0x28910
movq %rax, %rdi
callq 0x284a0
movq (%rsp), %rax
cmpb $0x1, 0x1631(%rax)
jne 0x6c44d
movq 0xf8(%rsp), %rdi
leaq 0x63fc3(%rip), %rsi     # 0xd03bf
callq 0x3357b
testb %al, %al
je 0x6c44d
leaq 0x2e8(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x28dd0
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq (%rsp), %rsi
movq %r13, %rdx
xorl %ecx, %ecx
pushq $0x1
popq %r8
callq 0x6cf02
movq %r15, %rdi
movq %rbx, %rsi
callq 0x28c40
movq %rbx, %rdi
callq 0x295a0
movq %r13, %rdi
callq 0x295a0
leaq 0x1a8(%rsp), %rdi
movq %r15, %rsi
callq 0x28dd0
leaq 0x1a8(%rsp), %r13
movq %r13, %rdi
callq 0x9f543
movl %eax, %ebx
movq %r13, %rdi
callq 0x295a0
testl %ebx, %ebx
jne 0x6cb9c
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %rbp
movq 0x80(%rsp), %rsi
addq 0x328(%rsp), %rsi
leaq 0x2b8(%rsp), %rdi
callq 0x4e96a
leaq 0x168(%rsp), %rdi
movq %r12, %rsi
callq 0x28dd0
movq 0x3d0(%rsp), %rsi
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq 0x8(%rsp), %rdx
xorl %ecx, %ecx
callq 0x6bd9a
leaq 0x148(%rsp), %rdi
movq %rbx, %rsi
leaq 0x704d2(%rip), %rdx     # 0xdc9bd
callq 0x3336c
leaq 0x298(%rsp), %r14
movq %r14, %rdi
leaq 0x686ff(%rip), %rsi     # 0xd4c01
leaq 0x88(%rsp), %rdx
callq 0x33402
movq %rbp, %rdi
leaq 0x2b8(%rsp), %rbx
movq %rbx, %rsi
leaq 0x168(%rsp), %r13
movq %r13, %rdx
leaq 0x148(%rsp), %rbp
movq %rbp, %rcx
movq %r14, %r8
xorl %r9d, %r9d
pushq $0x0
pushq $0x0
pushq $0x0
pushq $0x1
callq 0x4cf22
addq $0x20, %rsp
movq %r14, %rdi
callq 0x295a0
movq %rbp, %rdi
callq 0x295a0
leaq 0x60(%rsp), %rdi
callq 0x295a0
movq %r13, %rdi
callq 0x295a0
movq %rbx, %rdi
callq 0x495ac
leaq 0xd8(%rsp), %rdi
movq %r12, %rsi
leaq 0x71431(%rip), %rdx     # 0xdd9b7
callq 0x334ed
movq 0x3d0(%rsp), %rsi
leaq 0x110(%rsp), %r13
movq %r13, %rdi
movq 0x8(%rsp), %rdx
xorl %ecx, %ecx
callq 0x6bd9a
leaq 0x278(%rsp), %r14
leaq 0x88(%rsp), %rbx
movq %rbx, %rdi
leaq 0xd8(%rsp), %rsi
movq %r13, %rdx
callq 0x4e6ed
leaq 0x60(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
leaq 0x6a361(%rip), %rdx     # 0xd6940
callq 0x3336c
movq %rbx, %rdi
callq 0x295a0
leaq 0x110(%rsp), %rdi
callq 0x295a0
leaq 0xd8(%rsp), %rdi
callq 0x295a0
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %rbx
movq %r14, %rdi
movq %r13, %rsi
callq 0x28dd0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4cd7e
movq %r14, %rdi
callq 0x295a0
leaq 0x60(%rsp), %rdi
callq 0x295a0
movq %r15, %rdi
callq 0x295a0
leaq 0x28(%rsp), %rdi
callq 0x295a0
movq 0x8(%rsp), %rdx
incl %edx
leaq 0x248(%rsp), %rdi
jmp 0x6c057
leaq 0x60(%rsp), %r14
andq $0x0, 0x10(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
xorl %ebx, %ebx
leaq 0x28(%rsp), %r15
movq (%rsp), %rax
cmpl 0x15b8(%rax), %ebx
jae 0x6c69e
andq $0x0, 0x28(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x5c482
incl %ebx
jmp 0x6c67d
leaq 0x30(%rsp), %rbx
movq (%rsp), %rax
leaq 0x1400(%rax), %rcx
movq %rcx, 0x8(%rsp)
leaq 0x30(%rsp), %r15
addq $0x1460, %rax           # imm = 0x1460
movq %rax, 0x10(%rsp)
leaq 0x28(%rsp), %r14
leaq 0x88(%rsp), %r12
leaq 0xa8(%rsp), %r13
pushq $0x1
popq %rcx
movq (%rsp), %rax
cmpl 0x1620(%rax), %ecx
jg 0x6c7e5
movl %ecx, %ebp
movl %ecx, 0x28(%rsp)
movq %rbx, %rdi
leaq 0x60(%rsp), %rsi
callq 0x59fa2
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x8e158
movq %rbx, %rdi
callq 0x5c44e
andl $0x0, 0xb0(%rsp)
andq $0x0, 0xb8(%rsp)
leaq 0xb0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq %rax, 0xc8(%rsp)
andq $0x0, 0xd0(%rsp)
xorl %ebx, %ebx
movl %ebx, %eax
movq (%rsp), %rdx
movq 0x15c0(%rdx), %rcx
movq 0x15c8(%rdx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rax, %rdx
jbe 0x6c7a7
movq (%rcx,%rax,8), %rax
movl 0x58(%rax), %esi
movq %r12, %rdi
movq %r14, %rdx
callq 0x85f4a
movl %ebx, 0x28(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x59fa2
movq %r13, %rdi
movq %r14, %rsi
callq 0x8e24e
movq %r15, %rdi
callq 0x5c44e
movq %r12, %rdi
callq 0x5c44e
incl %ebx
jmp 0x6c747
movl %ebp, 0x28(%rsp)
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
callq 0x8abc2
movq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x8e318
leaq 0x30(%rsp), %rbx
leaq 0x30(%rsp), %rdi
callq 0x66268
movq %r13, %rdi
callq 0x66268
movl %ebp, %ecx
incl %ecx
jmp 0x6c6db
movq (%rsp), %rax
leaq 0x14e0(%rax), %rdi
leaq 0x708db(%rip), %rsi     # 0xdd0d2
movq %rdi, 0x80(%rsp)
callq 0x3357b
testb %al, %al
je 0x6c8e8
movq (%rsp), %rax
leaq 0x1c90(%rax), %rcx
movq %rcx, 0x8(%rsp)
leaq 0x1cc0(%rax), %rcx
movq %rcx, 0x10(%rsp)
leaq 0x1cf0(%rax), %rcx
movq %rcx, 0x18(%rsp)
leaq 0x1950(%rax), %rbp
pushq $0x1
popq %rbx
leaq 0x28(%rsp), %r14
leaq 0x60(%rsp), %r15
leaq 0xa8(%rsp), %r12
movq (%rsp), %rax
cmpl 0x1620(%rax), %ebx
jg 0x6c8e8
movl %ebx, 0x28(%rsp)
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x61e04
movq %rax, %rdi
movq %r15, %rsi
callq 0x85f9c
movl %ebx, 0x28(%rsp)
movq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x61e04
movq %rax, %rdi
movq %r15, %rsi
callq 0x85f9c
movl %ebx, 0x28(%rsp)
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x86066
andq $0x0, (%rax)
xorl %r13d, %r13d
cmpl %r13d, 0x20(%rsp)
je 0x6c8e1
movl %ebx, 0x28(%rsp)
movq %rbp, %rdi
movq %r14, %rsi
callq 0x860b4
movl %r13d, 0xa8(%rsp)
movq %rax, %rdi
movq %r12, %rsi
callq 0x86102
andl $0x0, (%rax)
incl %r13d
jmp 0x6c8b0
incl %ebx
jmp 0x6c850
leaq 0x707e3(%rip), %rsi     # 0xdd0d2
movq 0x80(%rsp), %rbx
movq %rbx, %rdi
callq 0x3357b
movq (%rsp), %rax
leaq 0x1a20(%rax), %r14
leaq 0x1a50(%rax), %r15
pushq $0x1
popq %rbp
leaq 0x28(%rsp), %r12
movq (%rsp), %rax
cmpl 0x1620(%rax), %ebp
jg 0x6c97c
movl %ebp, 0x28(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x86066
andq $0x0, (%rax)
xorl %r13d, %r13d
movq (%rsp), %rax
movq 0x15c8(%rax), %rdx
subq 0x15c0(%rax), %rdx
sarq $0x3, %rdx
cmpq %r13, %rdx
jbe 0x6c978
movl %ebp, %edi
movl %r13d, %esi
callq 0x9ec09
movl %eax, 0x28(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x86066
andq $0x0, (%rax)
incq %r13
jmp 0x6c93b
incl %ebp
jmp 0x6c919
leaq 0x9fad8(%rip), %rsi     # 0x10c45b
movq %rbx, %rdi
callq 0x3357b
testb %al, %al
je 0x6caa3
movq (%rsp), %rax
leaq 0x1d38(%rax), %r14
xorl %ebx, %ebx
leaq 0x28(%rsp), %r15
leaq 0xa8(%rsp), %r12
leaq 0x88(%rsp), %r13
movq (%rsp), %rax
movl 0x16fc(%rax), %ecx
cmpl %ecx, %ebx
ja 0x6c9fd
movl 0x1620(%rax), %eax
xorl %edx, %edx
divl %ecx
andl $0x0, 0xa8(%rsp)
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x86150
movq %r14, %rdi
movq %r15, %rsi
callq 0x8eaf4
movq %r15, %rdi
callq 0x5b268
incl %ebx
jmp 0x6c9b5
leaq 0x1d20(%rax), %rcx
movq %rcx, 0x20(%rsp)
leaq 0x1ab0(%rax), %r15
leaq 0x1b10(%rax), %r12
pushq $0x1
popq %rbp
leaq 0x28(%rsp), %r13
movq 0x80(%rsp), %rbx
movq (%rsp), %rax
cmpl 0x1620(%rax), %ebp
jg 0x6caa3
andl $0x0, 0x28(%rsp)
movq 0x20(%rsp), %rdi
movq %r13, %rsi
callq 0x8ed06
andq $0x0, 0x28(%rsp)
movl %ebp, 0x30(%rsp)
movq %r15, %rdi
movq %r13, %rsi
callq 0x8edfc
xorl %r14d, %r14d
movl %r14d, %eax
movq (%rsp), %rcx
movq 0x15c8(%rcx), %rdx
subq 0x15c0(%rcx), %rdx
sarq $0x3, %rdx
cmpq %rax, %rdx
jbe 0x6ca9f
movl %ebp, %edi
movl %r14d, %esi
callq 0x9ec09
andq $0x0, 0x28(%rsp)
movl %eax, 0x30(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x8edfc
incl %r14d
jmp 0x6ca5d
incl %ebp
jmp 0x6ca27
leaq 0x63502(%rip), %rsi     # 0xcffac
movq %rbx, %rdi
callq 0x3357b
testb %al, %al
je 0x6cb66
movq (%rsp), %rax
leaq 0x1ab0(%rax), %rcx
movq %rcx, 0x20(%rsp)
leaq 0x1b10(%rax), %r15
leaq 0x1b70(%rax), %r12
pushq $0x1
popq %rbp
leaq 0x28(%rsp), %r13
movq (%rsp), %rax
cmpl 0x1620(%rax), %ebp
jg 0x6cb66
andq $0x0, 0x28(%rsp)
movl %ebp, 0x30(%rsp)
movq 0x20(%rsp), %rdi
movq %r13, %rsi
callq 0x8edfc
xorl %r14d, %r14d
movl %r14d, %eax
movq (%rsp), %rcx
movq 0x15c8(%rcx), %rdx
subq 0x15c0(%rcx), %rdx
sarq $0x3, %rdx
cmpq %rax, %rdx
jbe 0x6cb5f
movl %ebp, %edi
movl %r14d, %esi
callq 0x9ec09
movl %eax, %ebx
andq $0x0, 0x28(%rsp)
movl %eax, 0x30(%rsp)
movq %r15, %rdi
movq %r13, %rsi
callq 0x8edfc
andq $0x0, 0x28(%rsp)
movl %ebx, 0x30(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x8edfc
incl %r14d
jmp 0x6cb06
incl %ebp
jmp 0x6cae0
leaq 0x60(%rsp), %rdi
callq 0x5c44e
leaq 0x130(%rsp), %rdi
callq 0x5b380
leaq 0x328(%rsp), %rdi
callq 0x861a6
addq $0x3e8, %rsp            # imm = 0x3E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6fe68(%rip), %rsi     # 0xdca0b
leaq 0x60(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
callq 0x3338b
leaq 0x72fe6(%rip), %rdx     # 0xdfba2
leaq 0x188(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x3336c
leaq 0x188(%rsp), %rsi
movq (%rsp), %rdi
callq 0x6aed2
jmp 0x6ce8d
movq %rax, %rbx
jmp 0x6ceed
movq %rax, %rbx
leaq 0x188(%rsp), %rdi
callq 0x295a0
jmp 0x6ccb2
movq %rax, %rbx
jmp 0x6ccb2
movq %rax, %rbx
leaq 0x2e8(%rsp), %rdi
jmp 0x6cd57
jmp 0x6ce6f
jmp 0x6ce6f
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x295a0
jmp 0x6cc4e
jmp 0x6cd7a
jmp 0x6cd7a
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x295a0
jmp 0x6cc53
movq %rax, %rbx
jmp 0x6cc65
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x295a0
jmp 0x6cc65
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
jmp 0x6ce7a
jmp 0x6cea2
jmp 0x6cea2
jmp 0x6cea2
jmp 0x6cea2
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x5b268
jmp 0x6ced6
jmp 0x6cea2
movq %rax, %rbx
leaq 0x278(%rsp), %rdi
callq 0x295a0
jmp 0x6ccb2
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
jmp 0x6cd57
movq %rax, %rbx
jmp 0x6cd0e
jmp 0x6ce6f
movq %rax, %rbx
leaq 0x298(%rsp), %rdi
callq 0x295a0
jmp 0x6ccdb
movq %rax, %rbx
leaq 0x148(%rsp), %rdi
callq 0x295a0
jmp 0x6cced
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x295a0
jmp 0x6cd2d
movq %rax, %rbx
jmp 0x6cd3a
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x295a0
leaq 0x110(%rsp), %rdi
callq 0x295a0
jmp 0x6cd20
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
jmp 0x6cd57
movq %rax, %rbx
leaq 0x168(%rsp), %rdi
callq 0x295a0
leaq 0x2b8(%rsp), %rdi
callq 0x495ac
jmp 0x6ce72
movq %rax, %rbx
leaq 0x1a8(%rsp), %rdi
callq 0x295a0
jmp 0x6ce72
movq %rax, %rbx
jmp 0x6cdd2
movq %rax, %rbx
jmp 0x6ce10
jmp 0x6ce8d
movq %rax, %rbx
jmp 0x6cdb3
jmp 0x6cd7a
movq %rax, %rbx
jmp 0x6ce7f
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x295a0
jmp 0x6cd94
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x295a0
jmp 0x6cda6
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x295a0
leaq 0x110(%rsp), %rdi
callq 0x295a0
jmp 0x6cdc5
movq %rax, %rbx
leaq 0x1e8(%rsp), %rdi
callq 0x295a0
leaq 0x1c8(%rsp), %rdi
jmp 0x6ce7a
movq %rax, %rbx
leaq 0x308(%rsp), %rdi
callq 0x295a0
jmp 0x6cdf4
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
callq 0x295a0
jmp 0x6ce06
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x295a0
leaq 0x228(%rsp), %rdi
callq 0x295a0
jmp 0x6ce22
movq %rax, %rbx
leaq 0x248(%rsp), %rdi
callq 0x495ac
jmp 0x6cee0
movq %rax, %rbx
pushq $0x20
popq %rsi
movq %r13, %rdi
callq 0x28a50
jmp 0x6cee0
jmp 0x6ce6f
jmp 0x6cea2
jmp 0x6cea2
jmp 0x6cea2
jmp 0x6cec6
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x66268
jmp 0x6cec9
jmp 0x6cea2
movq %rbx, %rdi
movq %rax, %rbx
callq 0x5c44e
jmp 0x6ced6
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x295a0
leaq 0x28(%rsp), %rdi
callq 0x295a0
jmp 0x6cee0
jmp 0x6cea2
movq %rax, %rbx
jmp 0x6cee0
jmp 0x6cea2
jmp 0x6cea2
jmp 0x6cea2
jmp 0x6cea2
jmp 0x6cea2
jmp 0x6cea2
jmp 0x6cea2
jmp 0x6cea2
movq %rax, %rbx
jmp 0x6ced6
movq %rax, %rbx
movq %r15, %rdi
callq 0x5c44e
jmp 0x6ceb7
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x5c44e
jmp 0x6cec9
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x66268
leaq 0x60(%rsp), %rdi
callq 0x5c44e
leaq 0x130(%rsp), %rdi
callq 0x5b380
leaq 0x328(%rsp), %rdi
callq 0x861a6
movq %rbx, %rdi
callq 0x292f0