// File: /workspace/github_cpp_makefile_star2_O2/melop[P]admixem/config.cpp
// Function: NaturalSelectionConfigurations::LoadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void NaturalSelectionConfigurations::LoadFromFile(string szConfigFile)
{
	//FILE *pConfigFile;
	ifstream fsConfigFile;
	string sBuffer;
	char szPopName[MAXLINE];
	char szFormula[MAXLINE];
	
	#ifdef _OPENMP
		int nTotalCPUCore =  omp_get_max_threads();//omp_get_num_threads();
		//printf("OpenMP enabled\n");
	#else
		int nTotalCPUCore = 1;
		//printf("OpenMP disabled \n");
	#endif

	
	
	printf("Start loading natural selection file %s ...\n", szConfigFile.c_str());

	_szConfigFilename = szConfigFile; // save name of config file

	fsConfigFile.open(szConfigFile.c_str() );
	//pConfigFile = fopen(szConfigFile.c_str(), "r");
	

	if (!fsConfigFile.is_open()) {
		printf("%s\n", "Cannot open natural selection file ...");
		throw "Cannot open natural selection file!";
	}

	getline(fsConfigFile,sBuffer);
	if (sBuffer == "") { // skip the header line
		throw "Cannot read natural selection file!";
	}

	string sPopName="";
	string sFormula="";
	string sPrevPopName="";
	string sPrevFormula="";

	while(fsConfigFile.good()) 
	{
		getline(fsConfigFile,sBuffer);
		
		int nGen;
		sBuffer.erase(sBuffer.find_last_not_of(" \n\r\t")+1);//trim
                if (sBuffer == "") {
                        continue;
                }

		sscanf(sBuffer.c_str(), "%[^\t\n]	%d	%[^\t\n]", szPopName, &nGen, szFormula);
		sPrevPopName = sPopName;
		sPrevFormula = sFormula;
		sPopName = szPopName; //make it string so that it saves lots of trouble of fuddling with c strings... i hate c strings.
		sFormula = szFormula;
		if (sPopName==sPrevPopName && sFormula == sPrevFormula) {
			printf("Warning: %s already loaded for pop %s, skipping...\n", sFormula.c_str(), sPopName.c_str());
			continue;
		}

		printf("Parsing natural rule for Pop %s : %s\n", sPopName.c_str(), sFormula.c_str());
		if (sPopName.length() != 0 && sFormula.length() !=0) {
			
			

			if (this->_mpRules.find(sPopName) == this->_mpRules.end()) { // if this pop is not in the map yet
				list< string > vsFormulae;
				list< string > vsFreqDependentFormulae;
				list< pair< Parser * , int> > vpFormulae;
				list< pair< Parser * , int> > vpFreqDependentFormulae;
				list< vector<string> > vvsSymbols;
				list< vector<string> > vvsSymbols2;
				list< vector<string> > vvsSymbols3;
				list< vector<string> > vvsSymbols4;
				list< vector<string> > vvsSymbols5;
				list< vector<string> > vvsSymbols6;
				
				this->_mpRules[sPopName] = vsFormulae;
				this->_mpFreqDependentRules[sPopName] = vsFreqDependentFormulae;
				for(int nCPU=0;nCPU<nTotalCPUCore;nCPU++) { // the formula object needs to be duplicated such that it will parallelize
					printf("%d CPU cores found, putting natural selection parser on CPU %d\n",nTotalCPUCore, nCPU );
					if (this->_mpmpRuleFormulae.find(nCPU) == this->_mpmpRuleFormulae.end()) {
						 map<string , list< pair<Parser *, int> > > mpRuleFormulae, _mpFreqDependentRuleFormulae;
						this->_mpmpRuleFormulae[nCPU] =  mpRuleFormulae;
						this->_mpmpFreqDependentRuleFormulae[nCPU] = _mpFreqDependentRuleFormulae;
					}

					this->_mpmpRuleFormulae[nCPU][sPopName] = vpFormulae;
					this->_mpmpFreqDependentRuleFormulae[nCPU][sPopName] = vpFreqDependentFormulae;
				}
				this->_mpRuleFormulaSymbolStrings[sPopName] = vvsSymbols;
				this->_mpRuleFormulaSymbolStringsCourter[sPopName] = vvsSymbols2;
				this->_mpRuleFormulaSymbolStringsSelf[sPopName] = vvsSymbols3;
				this->_mpRuleFormulaSymbolStringsPopWide[sPopName] = vvsSymbols4;
				this->_mpRuleFormulaSymbolStringsPopWideChooser[sPopName] = vvsSymbols5;
				this->_mpRuleFormulaSymbolStringsPopWideCourter[sPopName] = vvsSymbols6;

			}

			
			
			Parser * pF = new Parser("");
			//Parser * pDummyFormula = new Parser("1"); // dummy formula that always return 1.

			try {
				pF->Evaluate(sFormula);
			}
			catch(std::runtime_error e) {
				
				if ( string(e.what()) == "Divide by zero" ) {
					
					printf("Warning in formula: %s \nErrMsg:%s\nThis could simply be caused by uninitialized values", sFormula.c_str(), e.what());
					
					
				}
				else {
					printf("Error occured when trying to parse formula: %s \nErrMsg:%s\nPlease check formulae grammar!", sFormula.c_str(), e.what());
					exit(100);
				}
			}

		
			vector<string> vSymbolStrings; // all symbols
			vector<string> vSymbolStringsCourter; // only symbols referring to an individual courter's trait prefixed with Courter_
			vector<string> vSymbolStringsPopWideCourter; // symbols referring to population-level variables prefixed with PopCourter_
			vector<string> vSymbolStringsSelf; //symbols referring to individual chooser trait prefixed with My_
			vector<string> vSymbolStringsPopWideChooser;//symbols referring to population-level variables prefixed with PopChooser_
			vector<string> vSymbolStringsPopWide; // symbols referring to population-level variables prefixed with Pop_
			//list all the symbols used in this formula

			bool bFreqDependent = false; // does this formula contain frequency dependent symbols?

			for(map<string,double>::iterator it = pF->symbols_.begin(); it != pF->symbols_.end(); ++it) 
			{	
				//Parse chromosome number and position from the symbol
				//cout << (it->first) << "\n"; //list all keys

				
				if (strlen(it->first.c_str()) < 3) { // no need to add symbol
					continue;
				}

				vSymbolStrings.push_back(it->first); // save label too

				//Look at prefixes:
				string sSymbol = it->first;
				
				if (sSymbol.find("Courter_") == 0) {
					throw(new Exception("Courter_ not yet implemented in natural selection."));
					sSymbol.replace(0, 8, "");
					vSymbolStringsCourter.push_back(sSymbol);
				}
				else if (sSymbol.find("PopCourter_") == 0) {
					//throw(new Exception("PopCourter_ not yet implemented in natural selection."));
					sSymbol.replace(0, 11, "");
					vSymbolStringsPopWideCourter.push_back(sSymbol );
					bFreqDependent = true;
				}
				else if (sSymbol.find("My_") == 0) {
					sSymbol.replace(0, 3, "");
					vSymbolStringsSelf.push_back(sSymbol);
				}
				else if (sSymbol.find("PopChooser_") == 0) {
					//throw(new Exception("PopChooser_ not yet implemented in natural selection."));
					sSymbol.replace(0, 11, "");
					vSymbolStringsPopWideChooser.push_back(sSymbol);
					bFreqDependent = true;
				}
				else if (sSymbol.find("Pop_") == 0) {
					//throw(new Exception("Pop_ not yet implemented in natural selection."));
					sSymbol.replace(0, 4, "");
					vSymbolStringsPopWide.push_back(sSymbol);
					bFreqDependent = true;
				}
				else { //default to be self
					vSymbolStringsSelf.push_back(sSymbol);
				}
			}

			delete pF;
			
			if (bFreqDependent) {
				this->_mpFreqDependentRules[sPopName].push_back(sFormula); // save the formula string for further reference.
				
				
				
				this->_mpRules[sPopName].push_back("1"); // 
				

				for(int nCPU=0;nCPU<nTotalCPUCore;nCPU++) { // the formula object needs to be duplicated such that it will parallelize

					this->_mpmpFreqDependentRuleFormulae[nCPU][sPopName].push_back(pair< Parser *, int >( new Parser(sFormula) , nGen )); // literally duplicate the parser object so that it can parallelize
					this->_mpmpRuleFormulae[nCPU][sPopName].push_back(pair< Parser *, int >( new Parser("1") , nGen )); // set dummy formula which always return 1. 
				}
				
			}
			else {

				this->_mpRules[sPopName].push_back(sFormula); // save the formula string for further reference.			

				this->_mpFreqDependentRules[sPopName].push_back("1"); 
				

				for(int nCPU=0;nCPU<nTotalCPUCore;nCPU++) { // the formula object needs to be duplicated such that it will parallelize
					this->_mpmpRuleFormulae[nCPU][sPopName].push_back(pair< Parser *, int >( new Parser(sFormula) , nGen ));
					this->_mpmpFreqDependentRuleFormulae[nCPU][sPopName].push_back(pair< Parser *, int >( new Parser("1") , nGen ));// set dummy formula which always return 1.
					
				}

			}
			this->_mpRuleFormulaSymbolStrings[sPopName].push_back(vSymbolStrings);
			this->_mpRuleFormulaSymbolStringsCourter[sPopName].push_back(vSymbolStringsCourter);
			this->_mpRuleFormulaSymbolStringsSelf[sPopName].push_back(vSymbolStringsSelf);
			this->_mpRuleFormulaSymbolStringsPopWide[sPopName].push_back(vSymbolStringsPopWide);
			this->_mpRuleFormulaSymbolStringsPopWideChooser[sPopName].push_back(vSymbolStringsPopWideChooser);
			this->_mpRuleFormulaSymbolStringsPopWideCourter[sPopName].push_back(vSymbolStringsPopWideCourter);

			if (nGen > -1) {
				this->_vSpecialGens.insert(nGen);
			}
		}
	}

	printf("Selection rules for %d populations loaded. \n", this->_mpRules.size());

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7a5b8, %rsp          # imm = 0x7A5B8
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x288(%rsp), %rdi
callq 0x7450
leaq 0x220(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq (%rbx), %rsi
leaq 0x1b6ab(%rip), %rdi     # 0x2df49
xorl %eax, %eax
callq 0x7050
movq %r14, 0x160(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7220
movq (%rbx), %rsi
leaq 0x288(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x7260
leaq 0x300(%rsp), %rdi
callq 0x70d0
testb %al, %al
je 0x136e9
leaq 0x288(%rsp), %rdi
leaq 0x210(%rsp), %rsi
callq 0x70b0
leaq 0x1b6ed(%rip), %rsi     # 0x2dfe9
leaq 0x210(%rsp), %rdi
callq 0x954d
testb %al, %al
jne 0x136fe
leaq 0x1b6d1(%rip), %rsi     # 0x2dfe9
leaq 0x1c0(%rsp), %rdi
leaq 0x100(%rsp), %rdx
callq 0x9512
leaq 0x1b6b5(%rip), %rsi     # 0x2dfe9
leaq 0xe0(%rsp), %rdi
leaq 0x100(%rsp), %rdx
callq 0x9512
leaq 0x1b699(%rip), %rsi     # 0x2dfe9
leaq 0x268(%rsp), %rdi
leaq 0x100(%rsp), %rdx
callq 0x9512
leaq 0x1b67d(%rip), %rsi     # 0x2dfe9
leaq 0x248(%rsp), %rdi
leaq 0x100(%rsp), %rdx
callq 0x9512
movq 0x160(%rsp), %rax
leaq 0x28(%rax), %r13
leaq 0x30(%rax), %rcx
movq %rcx, 0x238(%rsp)
leaq 0x58(%rax), %rcx
movq %rcx, 0xd8(%rsp)
leaq 0x88(%rax), %r12
leaq 0x90(%rax), %rcx
movq %rcx, 0x240(%rsp)
leaq 0xb8(%rax), %rcx
movq %rcx, 0x8(%rsp)
leaq 0xe8(%rax), %rcx
movq %rcx, 0x198(%rsp)
leaq 0x118(%rax), %rcx
movq %rcx, 0x190(%rsp)
leaq 0x148(%rax), %rcx
movq %rcx, 0x188(%rsp)
leaq 0x178(%rax), %rcx
movq %rcx, 0x180(%rsp)
leaq 0x1d8(%rax), %rcx
movq %rcx, 0x178(%rsp)
leaq 0x1a8(%rax), %rcx
movq %rcx, 0x170(%rsp)
addq $0x208, %rax            # imm = 0x208
movq %rax, 0x230(%rsp)
leaq 0x210(%rsp), %r14
leaq 0x100(%rsp), %rbx
movq %r13, 0x168(%rsp)
movq 0x288(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x2a8(%rsp,%rax)
jne 0x13636
leaq 0x288(%rsp), %rdi
movq %r14, %rsi
callq 0x70b0
movq %r14, %rdi
leaq 0x1b56a(%rip), %rsi     # 0x2dfe5
pushq $-0x1
popq %r15
movq %r15, %rdx
callq 0x76f0
leaq 0x1(%rax), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x70c0
leaq 0x1c0(%rsp), %r14
leaq 0x210(%rsp), %rdi
leaq 0x1b53c(%rip), %rsi     # 0x2dfe9
callq 0x954d
testb %al, %al
jne 0x13575
movq 0x210(%rsp), %rdi
leaq 0x1b521(%rip), %rsi     # 0x2dfea
leaq 0x3d520(%rsp), %rdx
leaq 0x4(%rsp), %rcx
leaq 0x490(%rsp), %r8
xorl %eax, %eax
callq 0x73c0
leaq 0x268(%rsp), %rdi
movq %r14, %rsi
callq 0x7220
leaq 0x248(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x7220
movq %r14, %rdi
leaq 0x3d520(%rsp), %rsi
callq 0x7730
leaq 0xe0(%rsp), %rdi
leaq 0x490(%rsp), %rsi
callq 0x7730
movq %r14, %rdi
leaq 0x268(%rsp), %rsi
callq 0x17653
testb %al, %al
je 0x12b7f
leaq 0xe0(%rsp), %rdi
leaq 0x248(%rsp), %rsi
callq 0x17653
testb %al, %al
je 0x12b7f
movq 0xe0(%rsp), %rsi
movq 0x1c0(%rsp), %rdx
leaq 0x1b488(%rip), %rdi     # 0x2dffb
xorl %eax, %eax
callq 0x7050
jmp 0x13575
movq 0x1c0(%rsp), %rsi
movq 0xe0(%rsp), %rdx
leaq 0x1b499(%rip), %rdi     # 0x2e02f
xorl %eax, %eax
callq 0x7050
cmpq $0x0, 0x1c8(%rsp)
je 0x13575
cmpq $0x0, 0xe8(%rsp)
je 0x13575
movq %r13, %rdi
movq %r14, %rsi
callq 0x1c798
cmpq 0x238(%rsp), %rax
jne 0x12f8e
leaq 0xc0(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq %rax, 0xc0(%rsp)
andq $0x0, 0xd0(%rsp)
leaq 0xa0(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq %rax, 0xa0(%rsp)
andq $0x0, 0xb0(%rsp)
leaq 0x80(%rsp), %rax
movq %rax, 0x88(%rsp)
movq %rax, 0x80(%rsp)
andq $0x0, 0x90(%rsp)
leaq 0x60(%rsp), %rax
movq %rax, 0x68(%rsp)
movq %rax, 0x60(%rsp)
andq $0x0, 0x70(%rsp)
leaq 0x40(%rsp), %rax
movq %rax, 0x48(%rsp)
movq %rax, 0x40(%rsp)
andq $0x0, 0x50(%rsp)
leaq 0x28(%rsp), %rax
movq %rax, 0x30(%rsp)
movq %rax, 0x28(%rsp)
andq $0x0, 0x38(%rsp)
leaq 0x10(%rsp), %rax
movq %rax, 0x18(%rsp)
movq %rax, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
leaq 0x1a8(%rsp), %rax
movq %rax, 0x1b0(%rsp)
movq %rax, 0x1a8(%rsp)
andq $0x0, 0x1b8(%rsp)
leaq 0x1f8(%rsp), %rax
movq %rax, 0x200(%rsp)
movq %rax, 0x1f8(%rsp)
andq $0x0, 0x208(%rsp)
leaq 0x1e0(%rsp), %rax
movq %rax, 0x1e8(%rsp)
movq %rax, 0x1e0(%rsp)
andq $0x0, 0x1f0(%rsp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x1767c
movq %rax, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x176e2
movq 0xd8(%rsp), %rdi
movq %r14, %rsi
callq 0x1767c
movq %rax, %rdi
leaq 0xa0(%rsp), %rsi
callq 0x176e2
xorl %edx, %edx
movl %edx, (%rsp)
testl %edx, %edx
jg 0x12e61
leaq 0x1b318(%rip), %rdi     # 0x2e055
pushq $0x1
popq %rsi
xorl %eax, %eax
callq 0x7050
movq %r12, %rdi
movq %rsp, %rsi
callq 0x1ce68
cmpq 0x240(%rsp), %rax
jne 0x12e0c
andl $0x0, 0x108(%rsp)
andq $0x0, 0x110(%rsp)
leaq 0x108(%rsp), %rax
movq %rax, 0x118(%rsp)
movq %rax, 0x120(%rsp)
andq $0x0, 0x128(%rsp)
andl $0x0, 0x138(%rsp)
andq $0x0, 0x140(%rsp)
leaq 0x138(%rsp), %rax
movq %rax, 0x148(%rsp)
movq %rax, 0x150(%rsp)
andq $0x0, 0x158(%rsp)
movq %r12, %rdi
movq %rsp, %rsi
callq 0x176fe
movq %rax, %rdi
movq %rbx, %rsi
callq 0x185e0
movq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x176fe
movq %rax, %rdi
leaq 0x130(%rsp), %rsi
callq 0x185e0
leaq 0x130(%rsp), %rdi
callq 0x18b30
movq %rbx, %rdi
callq 0x18b30
movq %r12, %rdi
movq %rsp, %rsi
callq 0x176fe
movq %rax, %rdi
movq %r14, %rsi
callq 0x1774c
movq %rax, %rdi
leaq 0x80(%rsp), %rsi
callq 0x177b2
movq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x176fe
movq %rax, %rdi
movq %r14, %rsi
callq 0x1774c
movq %rax, %rdi
leaq 0x60(%rsp), %rsi
callq 0x177b2
movl (%rsp), %edx
incl %edx
jmp 0x12d2b
movq 0x198(%rsp), %rdi
movq %r14, %rsi
callq 0x177ce
movq %rax, %rdi
leaq 0x40(%rsp), %rsi
callq 0x17834
movq 0x190(%rsp), %rdi
movq %r14, %rsi
callq 0x177ce
movq %rax, %rdi
leaq 0x28(%rsp), %rsi
callq 0x17834
movq 0x188(%rsp), %rdi
movq %r14, %rsi
callq 0x177ce
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x17834
movq 0x180(%rsp), %rdi
movq %r14, %rsi
callq 0x177ce
movq %rax, %rdi
leaq 0x1a8(%rsp), %rsi
callq 0x17834
movq 0x178(%rsp), %rdi
movq %r14, %rsi
callq 0x177ce
movq %rax, %rdi
leaq 0x1f8(%rsp), %rsi
callq 0x17834
movq 0x170(%rsp), %rdi
movq %r14, %rsi
callq 0x177ce
movq %rax, %rdi
leaq 0x1e0(%rsp), %rsi
callq 0x17834
leaq 0x1e0(%rsp), %rdi
callq 0x18b44
leaq 0x1f8(%rsp), %rdi
callq 0x18b44
leaq 0x1a8(%rsp), %rdi
callq 0x18b44
leaq 0x10(%rsp), %rdi
callq 0x18b44
leaq 0x28(%rsp), %rdi
callq 0x18b44
leaq 0x40(%rsp), %rdi
callq 0x18b44
leaq 0x60(%rsp), %rdi
callq 0x18a8c
leaq 0x80(%rsp), %rdi
callq 0x18a8c
leaq 0xa0(%rsp), %rdi
callq 0x18b84
leaq 0xc0(%rsp), %rdi
callq 0x18b84
movl $0x98, %edi
callq 0x73f0
movq %rax, %r14
movq %rbx, %rdi
leaq 0x1b044(%rip), %rsi     # 0x2dfe9
leaq 0x130(%rsp), %rdx
callq 0x9512
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1714c
movq %rbx, %rdi
callq 0x71a0
movq %r14, %rdi
leaq 0xe0(%rsp), %rsi
movq %r14, 0x1a0(%rsp)
callq 0x92d0
xorps %xmm0, %xmm0
movaps %xmm0, 0x130(%rsp)
andq $0x0, 0x140(%rsp)
movaps %xmm0, 0xc0(%rsp)
andq $0x0, 0xd0(%rsp)
movaps %xmm0, 0xa0(%rsp)
andq $0x0, 0xb0(%rsp)
movaps %xmm0, 0x80(%rsp)
andq $0x0, 0x90(%rsp)
movaps %xmm0, 0x60(%rsp)
andq $0x0, 0x70(%rsp)
movaps %xmm0, 0x40(%rsp)
andq $0x0, 0x50(%rsp)
movq 0x80(%r14), %r15
movq %r14, %r13
addq $0x70, %r13
xorl %r14d, %r14d
cmpq %r13, %r15
je 0x13193
movq 0x20(%r15), %rdi
callq 0x7180
cmpq $0x3, %rax
jb 0x13183
leaq 0x20(%r15), %rbp
leaq 0x130(%rsp), %rdi
movq %rbp, %rsi
callq 0x17278
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x7550
movq %rbx, %rdi
leaq 0x1b16b(%rip), %rsi     # 0x2e1fb
xorl %edx, %edx
callq 0x7750
testq %rax, %rax
je 0x136b0
movq %rbx, %rdi
leaq 0x1b14e(%rip), %rsi     # 0x2e1f8
xorl %edx, %edx
callq 0x7750
testq %rax, %rax
je 0x13113
movq %rbx, %rdi
leaq 0x1b008(%rip), %rsi     # 0x2e0c8
xorl %edx, %edx
callq 0x7750
testq %rax, %rax
je 0x13131
movq %rbx, %rdi
leaq 0x1b139(%rip), %rsi     # 0x2e20f
xorl %edx, %edx
callq 0x7750
testq %rax, %rax
je 0x13157
movq %rbx, %rdi
leaq 0x1b0fc(%rip), %rsi     # 0x2e1e8
xorl %edx, %edx
callq 0x7750
testq %rax, %rax
jne 0x13145
movq %rbx, %rdi
xorl %esi, %esi
pushq $0x4
popq %rdx
leaq 0x1aee2(%rip), %rcx     # 0x2dfe9
callq 0x7240
leaq 0x40(%rsp), %rdi
jmp 0x13170
movq %rbx, %rdi
xorl %esi, %esi
pushq $0xb
popq %rdx
leaq 0x1aec7(%rip), %rcx     # 0x2dfe9
callq 0x7240
leaq 0xa0(%rsp), %rdi
jmp 0x13170
movq %rbx, %rdi
xorl %esi, %esi
pushq $0x3
popq %rdx
leaq 0x1aea9(%rip), %rcx     # 0x2dfe9
callq 0x7240
leaq 0x80(%rsp), %rdi
movq %rbx, %rsi
callq 0x17278
jmp 0x1317b
movq %rbx, %rdi
xorl %esi, %esi
pushq $0xb
popq %rdx
leaq 0x1ae83(%rip), %rcx     # 0x2dfe9
callq 0x7240
leaq 0x60(%rsp), %rdi
movb $0x1, %r14b
movq %rbx, %rsi
callq 0x17278
movq %rbx, %rdi
callq 0x71a0
movq %r15, %rdi
callq 0x72d0
movq %rax, %r15
jmp 0x1304b
movq 0x1a0(%rsp), %r15
movq %r15, %rdi
callq 0x17850
movl $0x98, %esi
movq %r15, %rdi
callq 0x7400
testb $0x1, %r14b
je 0x1330a
movq 0xd8(%rsp), %rdi
leaq 0x1c0(%rsp), %r14
movq %r14, %rsi
callq 0x1767c
movq 0x168(%rsp), %r13
movq %rax, %rdi
leaq 0xe0(%rsp), %rsi
callq 0x17870
movq %r13, %rdi
movq %r14, %rsi
callq 0x1767c
movq %rax, %r15
movq %rbx, %rdi
leaq 0x1d141(%rip), %rsi     # 0x30343
leaq 0x28(%rsp), %rdx
callq 0x9512
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1787c
movq %rbx, %rdi
callq 0x71a0
xorl %eax, %eax
movl %eax, 0x10(%rsp)
testl %eax, %eax
jg 0x1345a
movq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x176fe
movq %rax, %rdi
movq %r14, %rsi
callq 0x1774c
movq %rax, %r15
movl $0x98, %edi
callq 0x73f0
movq %rax, %rbp
movq %rax, %rdi
leaq 0xe0(%rsp), %rsi
callq 0x1714c
movq %rbp, 0x100(%rsp)
movl 0x4(%rsp), %eax
movl %eax, 0x108(%rsp)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x17888
movq %r12, %rdi
leaq 0x10(%rsp), %rsi
callq 0x176fe
movq %rax, %rdi
movq %r14, %rsi
callq 0x1774c
movq %rax, %rbp
movl $0x98, %edi
callq 0x73f0
movq %rax, %r15
movq %rbx, %rdi
leaq 0x1d08c(%rip), %rsi     # 0x30343
leaq 0x1a8(%rsp), %rdx
callq 0x9512
movb $0x1, %r14b
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1714c
movq %r15, 0x28(%rsp)
movl 0x4(%rsp), %eax
movl %eax, 0x30(%rsp)
xorl %r14d, %r14d
movq %rbp, %rdi
leaq 0x28(%rsp), %rsi
callq 0x17888
movq %rbx, %rdi
callq 0x71a0
movl 0x10(%rsp), %eax
incl %eax
leaq 0x1c0(%rsp), %r14
jmp 0x13221
movq 0x168(%rsp), %r13
movq %r13, %rdi
leaq 0x1c0(%rsp), %r14
movq %r14, %rsi
callq 0x1767c
movq %rax, %rdi
leaq 0xe0(%rsp), %rsi
callq 0x17870
movq 0xd8(%rsp), %rdi
movq %r14, %rsi
callq 0x1767c
movq %rax, %r15
movq %rbx, %rdi
leaq 0x1cff1(%rip), %rsi     # 0x30343
leaq 0x28(%rsp), %rdx
callq 0x9512
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1787c
movq %rbx, %rdi
callq 0x71a0
xorl %eax, %eax
movl %eax, 0x10(%rsp)
testl %eax, %eax
jg 0x1345a
movq %r12, %rdi
leaq 0x10(%rsp), %rsi
callq 0x176fe
movq %rax, %rdi
movq %r14, %rsi
callq 0x1774c
movq %rax, %r15
movl $0x98, %edi
callq 0x73f0
movq %rax, %rbp
movq %rax, %rdi
leaq 0xe0(%rsp), %rsi
callq 0x1714c
movq %rbp, 0x100(%rsp)
movl 0x4(%rsp), %eax
movl %eax, 0x108(%rsp)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x17888
movq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x176fe
movq %rax, %rdi
movq %r14, %rsi
callq 0x1774c
movq %rax, %rbp
movl $0x98, %edi
callq 0x73f0
movq %rax, %r15
movq %rbx, %rdi
leaq 0x1cf3c(%rip), %rsi     # 0x30343
leaq 0x1a8(%rsp), %rdx
callq 0x9512
movb $0x1, %r14b
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1714c
movq %r15, 0x28(%rsp)
movl 0x4(%rsp), %eax
movl %eax, 0x30(%rsp)
xorl %r14d, %r14d
movq %rbp, %rdi
leaq 0x28(%rsp), %rsi
callq 0x17888
movq %rbx, %rdi
callq 0x71a0
movl 0x10(%rsp), %eax
incl %eax
leaq 0x1c0(%rsp), %r14
jmp 0x13371
movq 0x198(%rsp), %rdi
movq %r14, %rsi
callq 0x177ce
movq %rax, %rdi
leaq 0x130(%rsp), %rsi
callq 0x17894
movq 0x190(%rsp), %rdi
movq %r14, %rsi
callq 0x177ce
movq %rax, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x17894
movq 0x188(%rsp), %rdi
movq %r14, %rsi
callq 0x177ce
movq %rax, %rdi
leaq 0x80(%rsp), %rsi
callq 0x17894
movq 0x180(%rsp), %rdi
movq %r14, %rsi
callq 0x177ce
movq %rax, %rdi
leaq 0x40(%rsp), %rsi
callq 0x17894
movq 0x178(%rsp), %rdi
movq %r14, %rsi
callq 0x177ce
movq %rax, %rdi
leaq 0x60(%rsp), %rsi
callq 0x17894
movq 0x170(%rsp), %rdi
movq %r14, %rsi
callq 0x177ce
movq %rax, %rdi
leaq 0xa0(%rsp), %rsi
callq 0x17894
cmpl $0x0, 0x4(%rsp)
js 0x1352d
movq 0x230(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x1ddf0
leaq 0x40(%rsp), %rdi
callq 0x17632
leaq 0x60(%rsp), %rdi
callq 0x17632
leaq 0x80(%rsp), %rdi
callq 0x17632
leaq 0xa0(%rsp), %rdi
callq 0x17632
leaq 0xc0(%rsp), %rdi
callq 0x17632
leaq 0x130(%rsp), %rdi
callq 0x17632
leaq 0x210(%rsp), %r14
jmp 0x12a47
movq %rax, %r13
cmpl $0x1, %edx
jne 0x138c9
movq %r13, %rdi
callq 0x74d0
leaq 0x130(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x7170
movq %r13, %rdi
callq 0x7160
movq %r14, %rdi
callq 0x7540
movq %rbx, %rdi
movq %rax, %rsi
leaq 0xc0(%rsp), %rdx
callq 0x9512
movq %rbx, %rdi
leaq 0x19b7c(%rip), %rsi     # 0x2d152
callq 0x954d
movl %eax, %ebp
movq %rbx, %rdi
callq 0x71a0
movq 0xe0(%rsp), %r15
leaq 0x130(%rsp), %rdi
callq 0x7540
testb %bpl, %bpl
je 0x13721
leaq 0x1a858(%rip), %rdi     # 0x2de62
movq %r15, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x7050
leaq 0x130(%rsp), %rdi
callq 0x7788
callq 0x7660
movq 0x1a0(%rsp), %r14
jmp 0x12fdd
movq 0x160(%rsp), %rax
movq 0x50(%rax), %rsi
leaq 0x1ac58(%rip), %rdi     # 0x2e2a1
xorl %eax, %eax
callq 0x7050
leaq 0x248(%rsp), %rdi
callq 0x71a0
leaq 0x268(%rsp), %rdi
callq 0x71a0
leaq 0xe0(%rsp), %rdi
callq 0x71a0
leaq 0x1c0(%rsp), %rdi
callq 0x71a0
leaq 0x210(%rsp), %rdi
callq 0x71a0
leaq 0x288(%rsp), %rdi
callq 0x7100
addq $0x7a5b8, %rsp          # imm = 0x7A5B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x8
popq %rdi
callq 0x71d0
movq %rax, %rbx
pushq $0x1
popq %rdi
callq 0x73f0
movq %rax, %r14
leaq 0x1a9c8(%rip), %rsi     # 0x2e095
movq %rax, %rdi
callq 0xad94
movq %r14, (%rbx)
leaq 0x315f9(%rip), %rsi     # 0x44cd8
movq %rbx, %rdi
xorl %edx, %edx
callq 0x76a0
leaq 0x1a886(%rip), %rdi     # 0x2df76
callq 0x75c0
leaq 0x1a8a1(%rip), %rbx     # 0x2df9d
jmp 0x13705
leaq 0x1a8bc(%rip), %rbx     # 0x2dfc1
pushq $0x8
popq %rdi
callq 0x71d0
movq %rbx, (%rax)
movq 0x31839(%rip), %rsi     # 0x44f50
movq %rax, %rdi
xorl %edx, %edx
callq 0x76a0
leaq 0x1a790(%rip), %rdi     # 0x2deb8
movq %r15, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x7050
pushq $0x64
popq %rdi
callq 0x74b0
jmp 0x13816
movq %rax, %r13
leaq 0x130(%rsp), %rdi
callq 0x7788
callq 0x7660
jmp 0x138c9
movq %rax, %rdi
callq 0x955a
movq %rax, %r13
jmp 0x138d6
movq %rax, %r13
jmp 0x138e3
movq %rax, %r13
jmp 0x138f0
jmp 0x13792
jmp 0x13840
jmp 0x1387e
jmp 0x13840
jmp 0x1387e
movq %rax, %r13
jmp 0x138fd
jmp 0x13816
movq %rax, %r13
jmp 0x137b1
movq %rax, %r13
leaq 0x100(%rsp), %rdi
callq 0x71a0
movl $0x98, %esi
movq %r14, %rdi
callq 0x7400
jmp 0x138c9
jmp 0x13816
jmp 0x13840
movq %rax, %r13
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x7400
jmp 0x137e1
jmp 0x13816
jmp 0x1391f
movq %rax, %r13
movq %rbx, %rdi
callq 0x7300
jmp 0x13843
jmp 0x1391f
jmp 0x1387e
jmp 0x137fe
jmp 0x13803
jmp 0x1387e
movq %rax, %r13
jmp 0x13869
movq %rax, %r13
movl $0x98, %esi
movq %rbp, %rdi
jmp 0x13871
jmp 0x1387e
jmp 0x1387e
jmp 0x1387e
movq %rax, %r13
jmp 0x138c9
movq %rax, %r13
leaq 0x130(%rsp), %rdi
callq 0x18b30
leaq 0x100(%rsp), %rdi
callq 0x18b30
jmp 0x13922
movq %rax, %r13
leaq 0x100(%rsp), %rdi
callq 0x71a0
jmp 0x13881
jmp 0x13854
movq %rax, %r13
leaq 0x100(%rsp), %rdi
callq 0x71a0
testb %r14b, %r14b
je 0x13881
movl $0x98, %esi
movq %r15, %rdi
callq 0x7400
jmp 0x13881
jmp 0x1387e
jmp 0x1387e
jmp 0x1387e
movq %rax, %r13
leaq 0x40(%rsp), %rdi
callq 0x17632
leaq 0x60(%rsp), %rdi
callq 0x17632
leaq 0x80(%rsp), %rdi
callq 0x17632
leaq 0xa0(%rsp), %rdi
callq 0x17632
leaq 0xc0(%rsp), %rdi
callq 0x17632
leaq 0x130(%rsp), %rdi
callq 0x17632
leaq 0x248(%rsp), %rdi
callq 0x71a0
leaq 0x268(%rsp), %rdi
callq 0x71a0
leaq 0xe0(%rsp), %rdi
callq 0x71a0
leaq 0x1c0(%rsp), %rdi
callq 0x71a0
leaq 0x210(%rsp), %rdi
callq 0x71a0
leaq 0x288(%rsp), %rdi
callq 0x7100
movq %r13, %rdi
callq 0x76d0
movq %rax, %r13
leaq 0x1e0(%rsp), %rdi
callq 0x18b44
leaq 0x1f8(%rsp), %rdi
callq 0x18b44
leaq 0x1a8(%rsp), %rdi
callq 0x18b44
leaq 0x10(%rsp), %rdi
callq 0x18b44
leaq 0x28(%rsp), %rdi
callq 0x18b44
leaq 0x40(%rsp), %rdi
callq 0x18b44
leaq 0x60(%rsp), %rdi
callq 0x18a8c
leaq 0x80(%rsp), %rdi
callq 0x18a8c
leaq 0xa0(%rsp), %rdi
callq 0x18b84
leaq 0xc0(%rsp), %rdi
callq 0x18b84
jmp 0x138c9
nop