// File: melop[P]admixem/config.cpp
// Function: PhenotypeConfigurations::LoadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void PhenotypeConfigurations::LoadFromFile(string szConfigFile) 
{
	FILE *pConfigFile;
	char szBuffer[2048];
	char szPhenotypeName[100];
	char szFormula[2048];
	
	#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 phenotype file %s ...\n", szConfigFile.c_str());

	_szConfigFilename = szConfigFile; // save name of config file

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

	if (!pConfigFile) {
		printf("%s\n", "Cannot open phenotype file ...");
		throw "Cannot open phenotype file!";
	}

	if (fgets(szBuffer, 2048, pConfigFile) == NULL) { // skip the header line
		throw "Cannot read phenotype file!";
	}

	while(fgets(szBuffer, 2048, pConfigFile) != NULL) 
	{
		string sPhenotypeName, sFormula;

		sscanf(szBuffer, "%[^\t\n]	%[^\t\n]", szPhenotypeName, szFormula);
		sPhenotypeName = szPhenotypeName;
		sFormula = szFormula;
		if (sPhenotypeName.length() != 0 && sFormula.length() !=0) {
			this->_mpPhenotypes[sPhenotypeName] = sFormula;
			
			Parser * pF = new Parser("");
			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< pair<int, double> > vSymbols;
			vector< string > vDadPheSymbols;
			vector< string > vMomPheSymbols;
			vector<string> vSymbolStrings;
			//list all the symbols used in this formula
			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

				int nSymbolChr;
				double nSymbolPos;
				
				if (strlen(it->first.c_str()) < 6) { // no need to add symbol
					continue;
				}

				string sSymbolLabel = it->first;
				size_t nFirstUS = sSymbolLabel.find_first_of("_");
				size_t nLastUS = sSymbolLabel.find_last_of("_");

				if (sSymbolLabel.find_first_of("Phe") == 0) { //if referring to the phenotype of dad or mum
					string sWhichParent = sSymbolLabel.substr(  nFirstUS+1, 3);
					string sPhenotype = sSymbolLabel.substr(  nLastUS+1 );

					if (sWhichParent == "Dad" ) {
						vDadPheSymbols.push_back(sPhenotype);
						//vSymbolStrings.push_back(sSymbolLabel); //don't add this
						this->_mpIsReferToParentPhe[sPhenotypeName] = true;
					}

					if (sWhichParent == "Mom" ) {
						vMomPheSymbols.push_back(sPhenotype);
						//vSymbolStrings.push_back(sSymbolLabel); //don't add this.
						this->_mpIsReferToParentPhe[sPhenotypeName] = true;

					}

					continue;
				}

				string sTemp = it->first.substr(3);	
				nFirstUS = sTemp.find_first_of("_");
				nLastUS = sTemp.find_last_of("_");

				if (nFirstUS != nLastUS) { // there is _a1 _a2 suffixes, delete the suffix
					sTemp = sTemp.substr(0,nLastUS);
					sSymbolLabel = "chr" + sTemp;				
				}

				sTemp = sTemp.replace(sTemp.find_first_of("_"), 1, " ");
				if (sscanf(sTemp.c_str(), "%d %lf", &nSymbolChr, &nSymbolPos)!=2) 
				{ // see if it's another format with _a1, a2 suffixes
					continue;
				};
				pair<int,double> oSymbolPair( nSymbolChr, nSymbolPos);
				vSymbols.push_back(oSymbolPair);
				vSymbolStrings.push_back(sSymbolLabel); // save label too
			}

			for (int nCPU=0;nCPU<nTotalCPUCore;nCPU++) {
				//map<string , Parser *> _mpPhenotypeFormulae;
				this->_mpmpPhenotypeFormulae[nCPU][sPhenotypeName] = new Parser(sFormula);//pF;
			}
			this->_mpPhenotypeFormulaSymbols[sPhenotypeName] = vSymbols;
			this->_mpPhenotypeFormulaDadSymbols[sPhenotypeName] = vDadPheSymbols;
			this->_mpPhenotypeFormulaMomSymbols[sPhenotypeName] = vMomPheSymbols;
			this->_mpPhenotypeFormulaSymbolStrings[sPhenotypeName] = vSymbolStrings;
		}
	}

	for (std::map<string,string>::iterator it = _mpPhenotypes.begin(); it != _mpPhenotypes.end(); ++it) {
		printf("%s %s\n", it->first.c_str(), it->second.c_str());
	}

	printf("%d phenotype(s) loaded. \n", _mpPhenotypes.size());

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x13d0, %rsp           # imm = 0x13D0
movq %rsi, -0x12e8(%rbp)
movq %rdi, %rax
movq -0x12e8(%rbp), %rdi
movq %rdi, -0x12d8(%rbp)
movq %rax, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x12e0(%rbp)
movl $0x1, -0x1094(%rbp)
callq 0x81d0
movq %rax, %rsi
leaq 0x5637e(%rip), %rdi     # 0x770ad
movb $0x0, %al
callq 0x8080
movq -0x12e0(%rbp), %rdi
movq -0x12d8(%rbp), %rsi
callq 0x8070
movq -0x12d8(%rbp), %rdi
callq 0x81d0
movq %rax, %rdi
leaq 0x581e3(%rip), %rsi     # 0x78f42
callq 0x85e0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x20dab
leaq 0x565b0(%rip), %rdi     # 0x77326
leaq 0x56355(%rip), %rsi     # 0x770d2
movb $0x0, %al
callq 0x8080
movl $0x8, %edi
callq 0x8230
movq %rax, %rdi
leaq 0x56359(%rip), %rax     # 0x770f1
movq %rax, (%rdi)
movq 0x891a6(%rip), %rsi     # 0xa9f48
xorl %eax, %eax
movl %eax, %edx
callq 0x8820
leaq -0x820(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x800, %esi            # imm = 0x800
callq 0x8750
cmpq $0x0, %rax
jne 0x20ded
movl $0x8, %edi
callq 0x8230
movq %rax, %rdi
leaq 0x56333(%rip), %rax     # 0x7710d
movq %rax, (%rdi)
movq 0x89164(%rip), %rsi     # 0xa9f48
xorl %eax, %eax
movl %eax, %edx
callq 0x8820
jmp 0x20def
leaq -0x820(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x800, %esi            # imm = 0x800
callq 0x8750
cmpq $0x0, %rax
je 0x21960
leaq -0x10b8(%rbp), %rdi
movq %rdi, -0x12f8(%rbp)
callq 0x86b0
leaq -0x10d8(%rbp), %rdi
callq 0x86b0
leaq 0x562f5(%rip), %rsi     # 0x77129
xorl %eax, %eax
leaq -0x820(%rbp), %rdi
leaq -0x890(%rbp), %rdx
movq %rdx, -0x12f0(%rbp)
leaq -0x1090(%rbp), %rcx
callq 0x8480
movq -0x12f8(%rbp), %rdi
movq -0x12f0(%rbp), %rsi
callq 0x8690
jmp 0x20e6c
leaq -0x10d8(%rbp), %rdi
leaq -0x1090(%rbp), %rsi
callq 0x8690
jmp 0x20e81
leaq -0x10b8(%rbp), %rdi
callq 0x8710
cmpq $0x0, %rax
je 0x21926
leaq -0x10d8(%rbp), %rdi
callq 0x8710
cmpq $0x0, %rax
je 0x21926
movq -0x12e0(%rbp), %rdi
addq $0x58, %rdi
leaq -0x10b8(%rbp), %rsi
callq 0x2b1e0
movq %rax, -0x1300(%rbp)
jmp 0x20ecd
movq -0x1300(%rbp), %rdi
leaq -0x10d8(%rbp), %rsi
callq 0x8070
jmp 0x20ee2
movl $0x98, %edi
callq 0x84c0
movq %rax, -0x1308(%rbp)
jmp 0x20ef5
movb $0x1, -0x1112(%rbp)
leaq -0x1111(%rbp), %rdi
movq %rdi, -0x1310(%rbp)
callq 0x8870
movq -0x1310(%rbp), %rdx
leaq 0x563a1(%rip), %rsi     # 0x772be
leaq -0x1110(%rbp), %rdi
callq 0xcb30
jmp 0x20f2b
movq -0x1308(%rbp), %rdi
leaq -0x1110(%rbp), %rsi
callq 0x2b2c0
jmp 0x20f40
movb $0x0, -0x1112(%rbp)
leaq -0x1110(%rbp), %rdi
callq 0x82e0
leaq -0x1111(%rbp), %rdi
callq 0x8540
movq -0x1308(%rbp), %rax
movq %rax, -0x10f0(%rbp)
movq -0x10f0(%rbp), %rdi
leaq -0x10d8(%rbp), %rsi
callq 0xc2c0
jmp 0x20f82
jmp 0x211cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10e0(%rbp)
movl %eax, -0x10e4(%rbp)
jmp 0x21943
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10e0(%rbp)
movl %eax, -0x10e4(%rbp)
jmp 0x20fd0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10e0(%rbp)
movl %eax, -0x10e4(%rbp)
leaq -0x1110(%rbp), %rdi
callq 0x82e0
leaq -0x1111(%rbp), %rdi
callq 0x8540
testb $0x1, -0x1112(%rbp)
jne 0x20fe7
jmp 0x20ff8
movq -0x1308(%rbp), %rdi
movl $0x98, %esi
callq 0x84d0
jmp 0x21943
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10e0(%rbp)
movl %eax, -0x10e4(%rbp)
movl -0x10e4(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x21943
movq -0x10e0(%rbp), %rdi
movq %rdi, -0x1330(%rbp)
callq 0x8620
movq %rax, %rsi
leaq -0x1128(%rbp), %rdi
movq %rdi, -0x1328(%rbp)
callq 0x81e0
movq -0x1330(%rbp), %rdi
callq 0x81c0
movq -0x1328(%rbp), %rdi
callq 0x86a0
movq %rax, -0x1320(%rbp)
leaq -0x1149(%rbp), %rdi
movq %rdi, -0x1318(%rbp)
callq 0x8870
movq -0x1320(%rbp), %rsi
movq -0x1318(%rbp), %rdx
leaq -0x1148(%rbp), %rdi
callq 0xcb30
jmp 0x21099
leaq 0x55312(%rip), %rsi     # 0x763b2
leaq -0x1148(%rbp), %rdi
callq 0xcbe0
movb %al, -0x1331(%rbp)
jmp 0x210b4
leaq -0x1148(%rbp), %rdi
callq 0x82e0
leaq -0x1149(%rbp), %rdi
callq 0x8540
movb -0x1331(%rbp), %al
testb $0x1, %al
jne 0x210db
jmp 0x21173
leaq -0x10d8(%rbp), %rdi
callq 0x81d0
movq %rax, -0x1340(%rbp)
leaq -0x1128(%rbp), %rdi
callq 0x86a0
movq -0x1340(%rbp), %rsi
movq %rax, %rdx
leaq 0x5602c(%rip), %rdi     # 0x77137
xorl %eax, %eax
callq 0x8080
jmp 0x21114
jmp 0x211b6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10e0(%rbp)
movl %eax, -0x10e4(%rbp)
jmp 0x2114b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10e0(%rbp)
movl %eax, -0x10e4(%rbp)
leaq -0x1148(%rbp), %rdi
callq 0x82e0
leaq -0x1149(%rbp), %rdi
callq 0x8540
jmp 0x2126c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10e0(%rbp)
movl %eax, -0x10e4(%rbp)
jmp 0x2126c
leaq -0x10d8(%rbp), %rdi
callq 0x81d0
movq %rax, -0x1348(%rbp)
leaq -0x1128(%rbp), %rdi
callq 0x86a0
movq -0x1348(%rbp), %rsi
movq %rax, %rdx
leaq 0x55fea(%rip), %rdi     # 0x7718d
xorl %eax, %eax
callq 0x8080
jmp 0x211ac
movl $0x64, %edi
callq 0x85f0
leaq -0x1128(%rbp), %rdi
callq 0x8948
callq 0x87d0
jmp 0x211c9
jmp 0x211cb
leaq -0x1168(%rbp), %rdi
callq 0x2b500
leaq -0x1180(%rbp), %rdi
callq 0x2b520
leaq -0x1198(%rbp), %rdi
callq 0x2b520
leaq -0x11b0(%rbp), %rdi
callq 0x2b520
movq -0x10f0(%rbp), %rdi
addq $0x68, %rdi
callq 0x2b540
movq %rax, -0x11b8(%rbp)
movq -0x10f0(%rbp), %rdi
addq $0x68, %rdi
callq 0x107a0
movq %rax, -0x11c0(%rbp)
leaq -0x11b8(%rbp), %rdi
leaq -0x11c0(%rbp), %rsi
callq 0x2b570
testb $0x1, %al
jne 0x21245
jmp 0x21712
leaq -0x11b8(%rbp), %rdi
callq 0x2b5a0
movq %rax, %rdi
callq 0x81d0
movq %rax, %rdi
callq 0x8200
cmpq $0x6, %rax
jae 0x21284
jmp 0x216f0
leaq -0x1128(%rbp), %rdi
callq 0x8948
callq 0x87d0
jmp 0x2127f
jmp 0x21943
leaq -0x11b8(%rbp), %rdi
callq 0x2b5a0
movq %rax, %rsi
leaq -0x11f0(%rbp), %rdi
callq 0x81f0
jmp 0x212a1
leaq -0x11f0(%rbp), %rdi
leaq 0x561fc(%rip), %rsi     # 0x774ab
xorl %eax, %eax
movl %eax, %edx
callq 0x8240
movq %rax, -0x11f8(%rbp)
leaq -0x11f0(%rbp), %rdi
leaq 0x561de(%rip), %rsi     # 0x774ab
movq $-0x1, %rdx
callq 0x8460
movq %rax, -0x1200(%rbp)
leaq -0x11f0(%rbp), %rdi
leaq 0x55ef8(%rip), %rsi     # 0x771e6
xorl %eax, %eax
movl %eax, %edx
callq 0x8240
cmpq $0x0, %rax
jne 0x214bc
movq -0x11f8(%rbp), %rdx
incq %rdx
leaq -0x1220(%rbp), %rdi
leaq -0x11f0(%rbp), %rsi
movl $0x3, %ecx
callq 0x8500
jmp 0x21325
movq -0x1200(%rbp), %rdx
incq %rdx
leaq -0x1240(%rbp), %rdi
leaq -0x11f0(%rbp), %rsi
movq $-0x1, %rcx
callq 0x8500
jmp 0x2134b
leaq 0x55e98(%rip), %rsi     # 0x771ea
leaq -0x1220(%rbp), %rdi
callq 0xcbe0
movb %al, -0x1349(%rbp)
jmp 0x21366
movb -0x1349(%rbp), %al
testb $0x1, %al
jne 0x21375
jmp 0x2141e
leaq -0x1180(%rbp), %rdi
leaq -0x1240(%rbp), %rsi
callq 0x2b5c0
jmp 0x2138a
movq -0x12e0(%rbp), %rdi
addq $0x20, %rdi
leaq -0x10b8(%rbp), %rsi
callq 0x2b630
movq %rax, -0x1358(%rbp)
jmp 0x213aa
movq -0x1358(%rbp), %rax
movb $0x1, (%rax)
jmp 0x2141e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10e0(%rbp)
movl %eax, -0x10e4(%rbp)
jmp 0x218f4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10e0(%rbp)
movl %eax, -0x10e4(%rbp)
jmp 0x21701
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10e0(%rbp)
movl %eax, -0x10e4(%rbp)
jmp 0x214ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10e0(%rbp)
movl %eax, -0x10e4(%rbp)
leaq -0x1240(%rbp), %rdi
callq 0x82e0
jmp 0x214ab
leaq 0x55dc9(%rip), %rsi     # 0x771ee
leaq -0x1220(%rbp), %rdi
callq 0xcbe0
movb %al, -0x1359(%rbp)
jmp 0x21439
movb -0x1359(%rbp), %al
testb $0x1, %al
jne 0x21445
jmp 0x21484
leaq -0x1198(%rbp), %rdi
leaq -0x1240(%rbp), %rsi
callq 0x2b5c0
jmp 0x2145a
movq -0x12e0(%rbp), %rdi
addq $0x20, %rdi
leaq -0x10b8(%rbp), %rsi
callq 0x2b630
movq %rax, -0x1368(%rbp)
jmp 0x2147a
movq -0x1368(%rbp), %rax
movb $0x1, (%rax)
movl $0x6, -0x1244(%rbp)
leaq -0x1240(%rbp), %rdi
callq 0x82e0
leaq -0x1220(%rbp), %rdi
callq 0x82e0
jmp 0x216d4
leaq -0x1220(%rbp), %rdi
callq 0x82e0
jmp 0x21701
leaq -0x11b8(%rbp), %rdi
callq 0x2b5a0
movq %rax, %rsi
leaq -0x1268(%rbp), %rdi
movl $0x3, %edx
movq $-0x1, %rcx
callq 0x8500
jmp 0x214e5
leaq -0x1268(%rbp), %rdi
leaq 0x55fb8(%rip), %rsi     # 0x774ab
xorl %eax, %eax
movl %eax, %edx
callq 0x8240
movq %rax, -0x11f8(%rbp)
leaq -0x1268(%rbp), %rdi
leaq 0x55f9a(%rip), %rsi     # 0x774ab
movq $-0x1, %rdx
callq 0x8460
movq %rax, -0x1200(%rbp)
movq -0x11f8(%rbp), %rax
cmpq -0x1200(%rbp), %rax
je 0x215e5
movq -0x1200(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x1288(%rbp), %rdi
leaq -0x1268(%rbp), %rsi
callq 0x8500
jmp 0x21558
leaq -0x1268(%rbp), %rdi
movq %rdi, -0x1370(%rbp)
leaq -0x1288(%rbp), %rsi
movq %rsi, -0x1378(%rbp)
callq 0x8600
movq -0x1378(%rbp), %rdi
callq 0x82e0
movq -0x1370(%rbp), %rdx
leaq 0x55c5f(%rip), %rsi     # 0x771f2
leaq -0x12a8(%rbp), %rdi
callq 0xc3f0
jmp 0x215a1
leaq -0x11f0(%rbp), %rdi
leaq -0x12a8(%rbp), %rsi
callq 0x8600
leaq -0x12a8(%rbp), %rdi
callq 0x82e0
jmp 0x215e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10e0(%rbp)
movl %eax, -0x10e4(%rbp)
leaq -0x1268(%rbp), %rdi
callq 0x82e0
jmp 0x21701
leaq 0x55ebf(%rip), %rsi     # 0x774ab
xorl %eax, %eax
movl %eax, %edx
leaq -0x1268(%rbp), %rdi
movq %rdi, -0x1388(%rbp)
callq 0x8240
movq -0x1388(%rbp), %rdi
movq %rax, %rsi
leaq 0x57cd8(%rip), %rcx     # 0x792ec
movl $0x1, %edx
callq 0x82c0
movq %rax, -0x1380(%rbp)
jmp 0x21627
movq -0x1380(%rbp), %rsi
leaq -0x1268(%rbp), %rdi
callq 0x8070
jmp 0x2163c
leaq -0x1268(%rbp), %rdi
callq 0x81d0
movq %rax, %rdi
leaq 0x55ba4(%rip), %rsi     # 0x771f6
leaq -0x11c4(%rbp), %rdx
leaq -0x11d0(%rbp), %rcx
movb $0x0, %al
callq 0x8480
cmpl $0x2, %eax
je 0x21678
movl $0x6, -0x1244(%rbp)
jmp 0x216c8
leaq -0x12b8(%rbp), %rdi
leaq -0x11c4(%rbp), %rsi
leaq -0x11d0(%rbp), %rdx
callq 0x2b710
jmp 0x21694
leaq -0x1168(%rbp), %rdi
leaq -0x12b8(%rbp), %rsi
callq 0x2b740
jmp 0x216a9
leaq -0x11b0(%rbp), %rdi
leaq -0x11f0(%rbp), %rsi
callq 0x2b5c0
jmp 0x216be
movl $0x0, -0x1244(%rbp)
leaq -0x1268(%rbp), %rdi
callq 0x82e0
leaq -0x11f0(%rbp), %rdi
callq 0x82e0
movl -0x1244(%rbp), %eax
testl %eax, %eax
je 0x216ee
jmp 0x216ec
jmp 0x216f0
jmp 0x216f0
leaq -0x11b8(%rbp), %rdi
callq 0x11700
jmp 0x21212
leaq -0x11f0(%rbp), %rdi
callq 0x82e0
jmp 0x218f4
movl $0x0, -0x12bc(%rbp)
movl -0x12bc(%rbp), %eax
cmpl -0x1094(%rbp), %eax
jge 0x217e2
movl $0x98, %edi
callq 0x84c0
movq %rax, -0x1390(%rbp)
jmp 0x21741
movq -0x1390(%rbp), %rdi
leaq -0x10d8(%rbp), %rsi
callq 0x2b2c0
jmp 0x21756
movq -0x12e0(%rbp), %rdi
addq $0x88, %rdi
leaq -0x12bc(%rbp), %rsi
callq 0x2b7b0
movq %rax, -0x1398(%rbp)
jmp 0x21779
movq -0x1398(%rbp), %rdi
leaq -0x10b8(%rbp), %rsi
callq 0x2b890
movq %rax, -0x13a0(%rbp)
jmp 0x21795
movq -0x13a0(%rbp), %rax
movq -0x1390(%rbp), %rcx
movq %rcx, (%rax)
movl -0x12bc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x12bc(%rbp)
jmp 0x2171c
movq -0x1390(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10e0(%rbp)
movl %eax, -0x10e4(%rbp)
movl $0x98, %esi
callq 0x84d0
jmp 0x218f4
movq -0x12e0(%rbp), %rdi
addq $0xb8, %rdi
leaq -0x10b8(%rbp), %rsi
callq 0x2b970
movq %rax, -0x13a8(%rbp)
jmp 0x21805
movq -0x13a8(%rbp), %rdi
leaq -0x1168(%rbp), %rsi
callq 0x2ba50
jmp 0x2181a
movq -0x12e0(%rbp), %rdi
addq $0xe8, %rdi
leaq -0x10b8(%rbp), %rsi
callq 0x2bca0
movq %rax, -0x13b0(%rbp)
jmp 0x2183d
movq -0x13b0(%rbp), %rdi
leaq -0x1180(%rbp), %rsi
callq 0x2bd80
jmp 0x21852
movq -0x12e0(%rbp), %rdi
addq $0x118, %rdi            # imm = 0x118
leaq -0x10b8(%rbp), %rsi
callq 0x2bca0
movq %rax, -0x13b8(%rbp)
jmp 0x21875
movq -0x13b8(%rbp), %rdi
leaq -0x1198(%rbp), %rsi
callq 0x2bd80
jmp 0x2188a
movq -0x12e0(%rbp), %rdi
addq $0x148, %rdi            # imm = 0x148
leaq -0x10b8(%rbp), %rsi
callq 0x2bca0
movq %rax, -0x13c0(%rbp)
jmp 0x218ad
movq -0x13c0(%rbp), %rdi
leaq -0x11b0(%rbp), %rsi
callq 0x2bd80
jmp 0x218c2
leaq -0x11b0(%rbp), %rdi
callq 0x2bfd0
leaq -0x1198(%rbp), %rdi
callq 0x2bfd0
leaq -0x1180(%rbp), %rdi
callq 0x2bfd0
leaq -0x1168(%rbp), %rdi
callq 0x2c030
jmp 0x21926
leaq -0x11b0(%rbp), %rdi
callq 0x2bfd0
leaq -0x1198(%rbp), %rdi
callq 0x2bfd0
leaq -0x1180(%rbp), %rdi
callq 0x2bfd0
leaq -0x1168(%rbp), %rdi
callq 0x2c030
jmp 0x21943
leaq -0x10d8(%rbp), %rdi
callq 0x82e0
leaq -0x10b8(%rbp), %rdi
callq 0x82e0
jmp 0x20def
leaq -0x10d8(%rbp), %rdi
callq 0x82e0
leaq -0x10b8(%rbp), %rdi
callq 0x82e0
jmp 0x21a2d
movq -0x12e0(%rbp), %rdi
addq $0x58, %rdi
callq 0x2c090
movq %rax, -0x12c8(%rbp)
movq -0x12e0(%rbp), %rdi
addq $0x58, %rdi
callq 0x2c0f0
movq %rax, -0x12d0(%rbp)
leaq -0x12c8(%rbp), %rdi
leaq -0x12d0(%rbp), %rsi
callq 0x2c0c0
testb $0x1, %al
jne 0x219a7
jmp 0x21a03
leaq -0x12c8(%rbp), %rdi
callq 0x2c120
movq %rax, %rdi
callq 0x81d0
movq %rax, -0x13c8(%rbp)
leaq -0x12c8(%rbp), %rdi
callq 0x2c120
movq %rax, %rdi
addq $0x20, %rdi
callq 0x81d0
movq -0x13c8(%rbp), %rsi
movq %rax, %rdx
leaq 0x55812(%rip), %rdi     # 0x771fd
movb $0x0, %al
callq 0x8080
leaq -0x12c8(%rbp), %rdi
callq 0x2c140
jmp 0x21977
movq -0x12e0(%rbp), %rdi
addq $0x58, %rdi
callq 0x2c170
movq %rax, %rsi
leaq 0x557e7(%rip), %rdi     # 0x77204
movb $0x0, %al
callq 0x8080
addq $0x13d0, %rsp           # imm = 0x13D0
popq %rbp
retq
movq -0x10e0(%rbp), %rdi
callq 0x8860
movq %rax, %rdi
callq 0xcd10
nopw %cs:(%rax,%rax)