// File: richardposner[P]BioNetFit2/src/code/Swarm.cpp
// Function: Swarm::consolidate_model_params()
void Swarm::consolidate_model_params(){

	if(options.verbosity>=1){
		cout<<"consolidating " << this->getNumModels()<<" models."<<endl;
	}

	//Raquel: commented, unnecessary
	/*if (options.models.size() <1){
		if(options.verbosity >= 3) cout<<"No need to consolidate models. Less than two models exist"<<endl;
		return;
	}
 *
 * Bug Note by Raquel
 * There was a bug in the consolidation function bellow
 * When you have more then 2 models that share equal paramaters, the command:
 * delete options.models.at(j)->freeParams_[fj->first];
 * will try to delete the free parameter from the list more then once
 * this will cause an error of memory access violation
 * I solved this problem by creating a new map containing only the unique parameters
 */



	map<string,FreeParam*> uniqueList;
	int uniqueIndex = 0;
	//remove dulicate free parameters
	unsigned int i,j, k, cnt=0;


	if(options.models.size() > 1 ){

	for (i=0; i <options.models.size(); i++){  //k-1 first models
		//cout << "in the first loop" << endl;
		for (j=i+1; j <options.models.size(); j++){  //the subsequent model to the end
			//cout << "in the second loop" << endl;
			for (auto fi=options.models.at(i)->freeParams_.begin(); fi!=options.models.at(i)->freeParams_.end(); ++fi){
				//cout << "in the thrid loop" << endl;
				for (auto fj=options.models.at(j)->freeParams_.begin(); fj!=options.models.at(j)->freeParams_.end(); ++fj){
					//cout << "in the fourth loop" << endl;
					if(fi->first.compare(fj->first)==0){  //common free parameters
						//cout << "in the if if the fourth loop" << endl;
						cnt++;
						if(options.verbosity >= 4)
							cout<<"Common free parameters found.  Param:"<< fi->first <<"  model1:" <<options.models.at(i)->getName() <<"   model2:" << options.models.at(j)->getName() <<endl;
						//cout << "before deleting" << endl;

						if ( uniqueList.find(fj->first) == uniqueList.end() ) {
							cout << fj->first << endl;
							//delete options.models.at(j)->freeParams_[fj->first]; //delete free param objecyt in j
							uniqueList[fj->first] = fj->second;
							uniqueIndex++;
							//cout << "Found parameter " << fj->first << endl;
						  // found
						} else {
							  // not found
								//cout << "parameter already found: " << fj->first << endl;

						}
						//cout << "after delete" << endl;
						//options.models.at(j)->freeParams_[fj->first] = options.models.at(i)->freeParams_[fi->first];  //map to i
						fj->second = fi->second;
					}
				}
			}
		}
	}
	//cout << "Found " << uniqueIndex << " unique parameters" << endl;
	//Raquel changed the way that the function find unique parameters

	if(options.verbosity >= 3) cout<<"Removing duplicate free parameters is finished. "<<cnt<<" duplicate free parameters are deleted."<<endl;

	}else{

		uniqueList = options.models.at(0)->freeParams_;
	}



		for (i=0; i <options.models.size(); i++){
			options.models.at(i)->freeParams_ = uniqueList;
			if(options.verbosity >= 1){
				cout << "model " << i << " free parameters " << options.models.at(i)->freeParams_.size() << endl;
			}
		}


		options.freeParams_.clear(); cnt=0;
		options.freeParams_ = uniqueList;
		cnt = options.freeParams_.size();

	 //razi make full list of union of free parameters
	options.freeParams_.clear(); cnt=0;
	for (i=0; i <options.models.size(); i++){  //razi: all models, was k-1 first models, later test
		for (auto fi=options.models.at(i)->freeParams_.begin(); fi!=options.models.at(i)->freeParams_.end(); ++fi){
			if (options.freeParams_.count(fi->first) < 1){  //a new free parameters
				options.freeParams_.insert(make_pair(fi->first, fi->second)); cnt++;
				if(options.verbosity >= 3) cout<<"Free parameter:"<<fi->first <<" is added to the list"<<endl;
			}
		}
	}


	if(options.verbosity >= 3) cout<<"Free parameters found:"<< cnt << endl;


	//razi make mapping from models free parameters to the full list of free parameters


	std::map<unsigned int, unsigned int> dummay_map;
	for (i=0; i <options.models.size(); i++){  //razi: all models, was k-1 first models, later test
		j = 0;

		freeParamMapping.push_back(dummay_map);
		for (auto fj=options.models.at(i)->freeParams_.begin(); fj!=options.models.at(i)->freeParams_.end(); ++fj){
			k=0;
			for (auto fk=options.freeParams_.begin(); fk!=options.freeParams_.end(); ++fk){
//cout<<"Full List   FreeParam["<<k<<"] :" << fk->first<<endl; //mypause();
				if (fj->first == fk->first){
					freeParamMapping.at(i).insert(make_pair(j,k));
				}
				k++;
			}
			j++;
		}
	}


	if(options.verbosity >= 3)cout<<"Model consolidation is completed. "<<cnt<<" free parameters are found."<<endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x370, %rsp            # imm = 0x370
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x188(%rbp)
cmpl $0x1, 0x1614(%rax)
jb 0xe9d95
movq 0x1eb206(%rip), %rdi    # 0x2d4f50
leaq 0xf71af(%rip), %rsi     # 0x1e0f00
callq 0x2ff50
movq -0x188(%rbp), %rdi
movq %rax, -0x190(%rbp)
callq 0x8dec0
movq -0x190(%rbp), %rdi
movl %eax, %esi
callq 0x30640
movq %rax, %rdi
leaq 0xf745c(%rip), %rsi     # 0x1e11dd
callq 0x2ff50
movq %rax, %rdi
movq 0x1eb238(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
leaq -0x38(%rbp), %rdi
callq 0x9c240
movq -0x188(%rbp), %rdi
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x4c(%rbp)
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x100, %rdi            # imm = 0x100
callq 0x45170
cmpq $0x1, %rax
jbe 0xea315
movl $0x0, -0x40(%rbp)
movq -0x188(%rbp), %rdi
movl -0x40(%rbp), %eax
movq %rax, -0x198(%rbp)
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x100, %rdi            # imm = 0x100
callq 0x45170
movq %rax, %rcx
movq -0x198(%rbp), %rax
cmpq %rcx, %rax
jae 0xea29c
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movq -0x188(%rbp), %rdi
movl -0x44(%rbp), %eax
movq %rax, -0x1a0(%rbp)
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x100, %rdi            # imm = 0x100
callq 0x45170
movq %rax, %rcx
movq -0x1a0(%rbp), %rax
cmpq %rcx, %rax
jae 0xea28c
movq -0x188(%rbp), %rdi
addq $0x15c0, %rdi           # imm = 0x15C0
movl -0x40(%rbp), %eax
movl %eax, %esi
callq 0x45190
movq %rax, -0x1a8(%rbp)
jmp 0xe9e6f
movq -0x1a8(%rbp), %rax
movq (%rax), %rdi
addq $0x30, %rdi
callq 0x44c70
movq %rax, -0x58(%rbp)
movq -0x188(%rbp), %rdi
addq $0x15c0, %rdi           # imm = 0x15C0
movl -0x40(%rbp), %eax
movl %eax, %esi
callq 0x45190
movq %rax, -0x1b0(%rbp)
jmp 0xe9ea7
movq -0x1b0(%rbp), %rax
movq (%rax), %rdi
addq $0x30, %rdi
callq 0x44cd0
movq %rax, -0x70(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x44ca0
testb $0x1, %al
jne 0xe9ed4
jmp 0xea27c
movq -0x188(%rbp), %rdi
addq $0x15c0, %rdi           # imm = 0x15C0
movl -0x44(%rbp), %eax
movl %eax, %esi
callq 0x45190
movq %rax, -0x1b8(%rbp)
jmp 0xe9ef5
movq -0x1b8(%rbp), %rax
movq (%rax), %rdi
addq $0x30, %rdi
callq 0x44c70
movq %rax, -0x78(%rbp)
movq -0x188(%rbp), %rdi
addq $0x15c0, %rdi           # imm = 0x15C0
movl -0x44(%rbp), %eax
movl %eax, %esi
callq 0x45190
movq %rax, -0x1c0(%rbp)
jmp 0xe9f2d
movq -0x1c0(%rbp), %rax
movq (%rax), %rdi
addq $0x30, %rdi
callq 0x44cd0
movq %rax, -0x80(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x44ca0
testb $0x1, %al
jne 0xe9f5a
jmp 0xea26c
leaq -0x58(%rbp), %rdi
callq 0x44d00
movq %rax, -0x1d0(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x44d00
movq -0x1d0(%rbp), %rdi
movq %rax, %rsi
callq 0x2f230
movl %eax, -0x1c4(%rbp)
jmp 0xe9f8a
movl -0x1c4(%rbp), %eax
cmpl $0x0, %eax
jne 0xea25c
movq -0x188(%rbp), %rax
movl -0x4c(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x4c(%rbp)
cmpl $0x4, 0x1614(%rax)
jb 0xea14c
movq 0x1eaf93(%rip), %rdi    # 0x2d4f50
leaq 0xf6f4b(%rip), %rsi     # 0x1e0f0f
callq 0x2ff50
movq %rax, -0x1d8(%rbp)
jmp 0xe9fd2
leaq -0x58(%rbp), %rdi
callq 0x44d00
movq -0x1d8(%rbp), %rdi
movq %rax, %rsi
callq 0x2f780
movq %rax, -0x1e0(%rbp)
jmp 0xe9ff3
movq -0x1e0(%rbp), %rdi
leaq 0xf6f34(%rip), %rsi     # 0x1e0f35
callq 0x2ff50
movq %rax, -0x1e8(%rbp)
jmp 0xea00f
movq -0x188(%rbp), %rdi
addq $0x15c0, %rdi           # imm = 0x15C0
movl -0x40(%rbp), %eax
movl %eax, %esi
callq 0x45190
movq %rax, -0x1f0(%rbp)
jmp 0xea030
movq -0x1f0(%rbp), %rax
movq (%rax), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x8e140
jmp 0xea048
movq -0x1e8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2f780
movq %rax, -0x1f8(%rbp)
jmp 0xea064
movq -0x1f8(%rbp), %rdi
leaq 0xf6ecd(%rip), %rsi     # 0x1e0f3f
callq 0x2ff50
movq %rax, -0x200(%rbp)
jmp 0xea080
movq -0x188(%rbp), %rdi
addq $0x15c0, %rdi           # imm = 0x15C0
movl -0x44(%rbp), %eax
movl %eax, %esi
callq 0x45190
movq %rax, -0x208(%rbp)
jmp 0xea0a1
movq -0x208(%rbp), %rax
movq (%rax), %rsi
leaq -0xc0(%rbp), %rdi
callq 0x8e140
jmp 0xea0b9
movq -0x200(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x2f780
movq %rax, -0x210(%rbp)
jmp 0xea0d5
movq -0x210(%rbp), %rdi
movq 0x1eaee5(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xea0ea
leaq -0xc0(%rbp), %rdi
callq 0x311e8
leaq -0xa0(%rbp), %rdi
callq 0x311e8
jmp 0xea14c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xeab08
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xea13b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x311e8
leaq -0xa0(%rbp), %rdi
callq 0x311e8
jmp 0xeab08
leaq -0x78(%rbp), %rdi
callq 0x44d00
movq %rax, %rsi
leaq -0x38(%rbp), %rdi
callq 0x1213f0
movq %rax, -0x218(%rbp)
jmp 0xea16a
movq -0x218(%rbp), %rax
movq %rax, -0xc8(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x44cd0
movq %rax, -0xd0(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x83830
testb $0x1, %al
jne 0xea1a4
jmp 0xea232
leaq -0x78(%rbp), %rdi
callq 0x44d00
movq %rax, %rsi
movq 0x1ead99(%rip), %rdi    # 0x2d4f50
callq 0x2f780
movq %rax, -0x220(%rbp)
jmp 0xea1c5
movq -0x220(%rbp), %rdi
movq 0x1eadf5(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xea1da
leaq -0x78(%rbp), %rdi
movq %rdi, -0x238(%rbp)
callq 0x44d00
movq -0x238(%rbp), %rdi
movq 0x20(%rax), %rax
movq %rax, -0x230(%rbp)
callq 0x44d00
movq %rax, %rsi
leaq -0x38(%rbp), %rdi
callq 0x121420
movq %rax, -0x228(%rbp)
jmp 0xea216
movq -0x228(%rbp), %rax
movq -0x230(%rbp), %rcx
movq %rcx, (%rax)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xea234
jmp 0xea234
leaq -0x58(%rbp), %rdi
callq 0x44d00
movq 0x20(%rax), %rax
movq %rax, -0x240(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x44d00
movq -0x240(%rbp), %rcx
movq %rcx, 0x20(%rax)
jmp 0xea25e
leaq -0x78(%rbp), %rdi
callq 0x44d20
jmp 0xe9f0c
jmp 0xea26e
leaq -0x58(%rbp), %rdi
callq 0x44d20
jmp 0xe9e86
jmp 0xea27e
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xe9e17
jmp 0xea28e
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0xe9dd7
movq -0x188(%rbp), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xea313
movq 0x1eac9d(%rip), %rdi    # 0x2d4f50
leaq 0xf6c90(%rip), %rsi     # 0x1e0f4a
callq 0x2ff50
movq %rax, -0x248(%rbp)
jmp 0xea2c8
movq -0x248(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x30640
movq %rax, -0x250(%rbp)
jmp 0xea2e0
movq -0x250(%rbp), %rdi
leaq 0xf6c8d(%rip), %rsi     # 0x1e0f7b
callq 0x2ff50
movq %rax, -0x258(%rbp)
jmp 0xea2fc
movq -0x258(%rbp), %rdi
movq 0x1eacbe(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xea311
jmp 0xea313
jmp 0xea350
movq -0x188(%rbp), %rdi
addq $0x15c0, %rdi           # imm = 0x15C0
xorl %eax, %eax
movl %eax, %esi
callq 0x45190
movq %rax, -0x260(%rbp)
jmp 0xea335
movq -0x260(%rbp), %rax
movq (%rax), %rsi
addq $0x30, %rsi
leaq -0x38(%rbp), %rdi
callq 0x121500
jmp 0xea34e
jmp 0xea350
movl $0x0, -0x40(%rbp)
movq -0x188(%rbp), %rdi
movl -0x40(%rbp), %eax
movq %rax, -0x268(%rbp)
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x100, %rdi            # imm = 0x100
callq 0x45170
movq %rax, %rcx
movq -0x268(%rbp), %rax
cmpq %rcx, %rax
jae 0xea49f
movq -0x188(%rbp), %rdi
addq $0x15c0, %rdi           # imm = 0x15C0
movl -0x40(%rbp), %eax
movl %eax, %esi
callq 0x45190
movq %rax, -0x270(%rbp)
jmp 0xea3af
movq -0x270(%rbp), %rax
movq (%rax), %rdi
addq $0x30, %rdi
leaq -0x38(%rbp), %rsi
callq 0x121500
jmp 0xea3c8
movq -0x188(%rbp), %rax
cmpl $0x1, 0x1614(%rax)
jb 0xea48f
movq 0x1eab6d(%rip), %rdi    # 0x2d4f50
leaq 0xf160b(%rip), %rsi     # 0x1db9f5
callq 0x2ff50
movq %rax, -0x278(%rbp)
jmp 0xea3f8
movq -0x278(%rbp), %rdi
movl -0x40(%rbp), %esi
callq 0x30640
movq %rax, -0x280(%rbp)
jmp 0xea410
movq -0x280(%rbp), %rdi
leaq 0xf6b85(%rip), %rsi     # 0x1e0fa3
callq 0x2ff50
movq %rax, -0x288(%rbp)
jmp 0xea42c
movq -0x188(%rbp), %rdi
addq $0x15c0, %rdi           # imm = 0x15C0
movl -0x40(%rbp), %eax
movl %eax, %esi
callq 0x45190
movq %rax, -0x290(%rbp)
jmp 0xea44d
movq -0x290(%rbp), %rax
movq (%rax), %rdi
addq $0x30, %rdi
callq 0x4cd80
movq -0x288(%rbp), %rdi
movq %rax, %rsi
callq 0x30cf0
movq %rax, -0x298(%rbp)
jmp 0xea478
movq -0x298(%rbp), %rdi
movq 0x1eab42(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xea48d
jmp 0xea48f
jmp 0xea491
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0xea357
movq -0x188(%rbp), %rdi
addq $0x1590, %rdi           # imm = 0x1590
movq %rdi, -0x2a0(%rbp)
callq 0x121530
movq -0x2a0(%rbp), %rdi
movl $0x0, -0x4c(%rbp)
leaq -0x38(%rbp), %rsi
callq 0x121500
jmp 0xea4d2
movq -0x188(%rbp), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0xd0, %rdi
callq 0x4cd80
movq -0x188(%rbp), %rdi
movl %eax, -0x4c(%rbp)
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0xd0, %rdi
callq 0x121530
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x40(%rbp)
movq -0x188(%rbp), %rdi
movl -0x40(%rbp), %eax
movq %rax, -0x2a8(%rbp)
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x100, %rdi            # imm = 0x100
callq 0x45170
movq %rax, %rcx
movq -0x2a8(%rbp), %rax
cmpq %rcx, %rax
jae 0xea799
movq -0x188(%rbp), %rdi
addq $0x15c0, %rdi           # imm = 0x15C0
movl -0x40(%rbp), %eax
movl %eax, %esi
callq 0x45190
movq %rax, -0x2b0(%rbp)
jmp 0xea56f
movq -0x2b0(%rbp), %rax
movq (%rax), %rdi
addq $0x30, %rdi
callq 0x44c70
movq %rax, -0xd8(%rbp)
movq -0x188(%rbp), %rdi
addq $0x15c0, %rdi           # imm = 0x15C0
movl -0x40(%rbp), %eax
movl %eax, %esi
callq 0x45190
movq %rax, -0x2b8(%rbp)
jmp 0xea5aa
movq -0x2b8(%rbp), %rax
movq (%rax), %rdi
addq $0x30, %rdi
callq 0x44cd0
movq %rax, -0xe0(%rbp)
leaq -0xd8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x44ca0
testb $0x1, %al
jne 0xea5e0
jmp 0xea789
movq -0x188(%rbp), %rax
addq $0x1590, %rax           # imm = 0x1590
movq %rax, -0x2c8(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x44d00
movq -0x2c8(%rbp), %rdi
movq %rax, %rsi
callq 0x44980
movq %rax, -0x2c0(%rbp)
jmp 0xea618
movq -0x2c0(%rbp), %rax
cmpq $0x1, %rax
jae 0xea776
movq -0x188(%rbp), %rax
addq $0x1590, %rax           # imm = 0x1590
movq %rax, -0x2e0(%rbp)
leaq -0xd8(%rbp), %rdi
movq %rdi, -0x2d8(%rbp)
callq 0x44d00
movq -0x2d8(%rbp), %rdi
movq %rax, -0x2d0(%rbp)
callq 0x44d00
movq -0x2d0(%rbp), %rsi
movq %rax, %rdx
addq $0x20, %rdx
leaq -0x108(%rbp), %rdi
callq 0x121550
jmp 0xea67f
movq -0x2e0(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x9c4f0
movb %dl, -0x2e9(%rbp)
movq %rax, -0x2e8(%rbp)
jmp 0xea6a1
movb -0x2e9(%rbp), %al
movq -0x2e8(%rbp), %rcx
movq %rcx, -0x118(%rbp)
movb %al, -0x110(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x9c570
movq -0x188(%rbp), %rax
movl -0x4c(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x4c(%rbp)
cmpl $0x3, 0x1614(%rax)
jb 0xea774
movq 0x1ea865(%rip), %rdi    # 0x2d4f50
leaq 0xf68c3(%rip), %rsi     # 0x1e0fb5
callq 0x2ff50
movq %rax, -0x2f8(%rbp)
jmp 0xea700
leaq -0xd8(%rbp), %rdi
callq 0x44d00
movq -0x2f8(%rbp), %rdi
movq %rax, %rsi
callq 0x2f780
movq %rax, -0x300(%rbp)
jmp 0xea724
movq -0x300(%rbp), %rdi
leaq 0xf6893(%rip), %rsi     # 0x1e0fc5
callq 0x2ff50
movq %rax, -0x308(%rbp)
jmp 0xea740
movq -0x308(%rbp), %rdi
movq 0x1ea87a(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xea755
jmp 0xea774
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x9c570
jmp 0xeab08
jmp 0xea776
jmp 0xea778
leaq -0xd8(%rbp), %rdi
callq 0x44d20
jmp 0xea589
jmp 0xea78b
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0xea517
movq -0x188(%rbp), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xea7f4
movq 0x1ea7a0(%rip), %rdi    # 0x2d4f50
leaq 0xf6824(%rip), %rsi     # 0x1e0fdb
callq 0x2ff50
movq %rax, -0x310(%rbp)
jmp 0xea7c5
movq -0x310(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x30640
movq %rax, -0x318(%rbp)
jmp 0xea7dd
movq -0x318(%rbp), %rdi
movq 0x1ea7dd(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xea7f2
jmp 0xea7f4
leaq -0x148(%rbp), %rdi
callq 0x121590
movl $0x0, -0x40(%rbp)
movq -0x188(%rbp), %rdi
movl -0x40(%rbp), %eax
movq %rax, -0x320(%rbp)
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x100, %rdi            # imm = 0x100
callq 0x45170
movq %rax, %rcx
movq -0x320(%rbp), %rax
cmpq %rcx, %rax
jae 0xeaa73
movq -0x188(%rbp), %rdi
movl $0x0, -0x44(%rbp)
addq $0x1980, %rdi           # imm = 0x1980
leaq -0x148(%rbp), %rsi
callq 0x1215b0
jmp 0xea861
movq -0x188(%rbp), %rdi
addq $0x15c0, %rdi           # imm = 0x15C0
movl -0x40(%rbp), %eax
movl %eax, %esi
callq 0x45190
movq %rax, -0x328(%rbp)
jmp 0xea882
movq -0x328(%rbp), %rax
movq (%rax), %rdi
addq $0x30, %rdi
callq 0x44c70
movq %rax, -0x150(%rbp)
movq -0x188(%rbp), %rdi
addq $0x15c0, %rdi           # imm = 0x15C0
movl -0x40(%rbp), %eax
movl %eax, %esi
callq 0x45190
movq %rax, -0x330(%rbp)
jmp 0xea8bd
movq -0x330(%rbp), %rax
movq (%rax), %rdi
addq $0x30, %rdi
callq 0x44cd0
movq %rax, -0x158(%rbp)
leaq -0x150(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x44ca0
testb $0x1, %al
jne 0xea8f3
jmp 0xeaa63
movq -0x188(%rbp), %rdi
movl $0x0, -0x48(%rbp)
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0xd0, %rdi
callq 0x44c70
movq %rax, -0x160(%rbp)
movq -0x188(%rbp), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0xd0, %rdi
callq 0x44cd0
movq %rax, -0x168(%rbp)
leaq -0x160(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x44ca0
testb $0x1, %al
jne 0xea958
jmp 0xeaa49
leaq -0x150(%rbp), %rdi
callq 0x44d00
movq %rax, -0x338(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x44d00
movq -0x338(%rbp), %rdi
movq %rax, %rsi
callq 0x69890
testb $0x1, %al
jne 0xea98f
jmp 0xeaa2f
movq -0x188(%rbp), %rdi
addq $0x1980, %rdi           # imm = 0x1980
movl -0x40(%rbp), %eax
movl %eax, %esi
callq 0x121620
movq %rax, -0x340(%rbp)
jmp 0xea9b0
leaq -0x44(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x1216a0
movq %rax, -0x348(%rbp)
jmp 0xea9c6
movq -0x340(%rbp), %rdi
movq -0x348(%rbp), %rax
movq %rax, -0x170(%rbp)
leaq -0x170(%rbp), %rsi
callq 0x121660
movb %dl, -0x351(%rbp)
movq %rax, -0x350(%rbp)
jmp 0xea9f6
movb -0x351(%rbp), %al
movq -0x350(%rbp), %rcx
movq %rcx, -0x180(%rbp)
movb %al, -0x178(%rbp)
jmp 0xeaa2f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x1216d0
jmp 0xeab08
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x44d20
jmp 0xea91b
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x44d20
jmp 0xea89c
jmp 0xeaa65
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0xea807
movq -0x188(%rbp), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xeaaea
movq 0x1ea4c6(%rip), %rdi    # 0x2d4f50
leaq 0xf6561(%rip), %rsi     # 0x1e0ff2
callq 0x2ff50
movq %rax, -0x360(%rbp)
jmp 0xeaa9f
movq -0x360(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x30640
movq %rax, -0x368(%rbp)
jmp 0xeaab7
movq -0x368(%rbp), %rdi
leaq 0xf6550(%rip), %rsi     # 0x1e1015
callq 0x2ff50
movq %rax, -0x370(%rbp)
jmp 0xeaad3
movq -0x370(%rbp), %rdi
movq 0x1ea4e7(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xeaae8
jmp 0xeaaea
leaq -0x148(%rbp), %rdi
callq 0x1216d0
leaq -0x38(%rbp), %rdi
callq 0x9c260
addq $0x370, %rsp            # imm = 0x370
popq %rbp
retq
leaq -0x38(%rbp), %rdi
callq 0x9c260
movq -0x60(%rbp), %rdi
callq 0x30170
nopw (%rax,%rax)