// File: CMU-SAFARI[P]Register-Interval/main.cpp
// Function: create_control_flow_graph(char*)
vector<basicBlock*> create_control_flow_graph(char* file_name){
    /* The control flow analysis of nvdisasm tool generates a CFG that its nodes are abstract basic blocks. So
     we first extract the abstract basic blocks from graphviz dot code (the output of nvdisasm tool) and then  we will create basic blocks and CFG.*/
    
    vector<basicBlock*> abstract_basic_blocks;
    
    //**********************getting input file and finding abstract basic blocks*******************************
        fstream file (file_name, fstream::in);
        
	char ch;
	string cfgString;
	string str = "";
	bool start = false;
	bool ready = false;
	bool OK = false;
	while (file >> noskipws >> ch)
	{
		cfgString = cfgString + ch;
	}

	for (int i = 0; i < cfgString.size(); i++){
		if (start){
			str = str + cfgString[i];
		}

		if (cfgString[i] == '"'){
			if (!start){
				start = true;
			}
			else{
				ready = true;
				start = false;
			}
		}

		if (ready){
			if (cfgString[i + 1] == '\n' || cfgString[i + 1] == 13){
				OK = true;
				ready = false;
			}
			else{
				ready = false;
				str = "";
			}
		}

		if (OK){
			str.erase(str.size() - 1, 1);
			auto temp = new basicBlock(str);
			abstract_basic_blocks.push_back(temp);
			OK = false;
			str = "";
		}
	}
	//******************************************************************************************

	//***************************setting code of abstract basic blocks*************************************
	int found1 = 0;
	int found2 = 0;
	string code;
	for (int i = 0; i < abstract_basic_blocks.size(); i++){
		code = "";
		found1 = cfgString.find("<entry>", found1 + 1, 7);
		found2 = cfgString.find("}\"]", found2 + 1, 3);
		for (int j = found1; j < found2 - 2; j++){
			code = code + cfgString[j];
		}
		abstract_basic_blocks[i]->set_code(code);
	}
	//******************************************************************************************

	//********************************Setting successors of abstract basic blocks******************************
	size_t found = 0;
	string tmp;
	int count = 0;
	for (int i = 0; i < abstract_basic_blocks.size(); i++){
		str = "\"";
		str = str + abstract_basic_blocks[i]->get_name();
		str = str + "\"";
		str = str + ":exit";
		found = 0;
		found = cfgString.find(str, found + 1);
		while (found != string::npos){
			count = 0;
			tmp = "";
			for (int j = found + 1; count < 3; j++){
				if (count == 2){
					tmp = tmp + cfgString[j];
				}

				if (cfgString[j] == '"')
					count++;
			}
			tmp.erase(tmp.end() - 1);
			for (int j = 0; j < abstract_basic_blocks.size(); j++){
				if (abstract_basic_blocks[j]->get_name() == tmp){
					abstract_basic_blocks[i]->add_successor(abstract_basic_blocks[j]);
					break;
				}
			}

			found = cfgString.find(str, found + 1);
		}
	}
	
	count = 0;
	for (int i = 0; i < abstract_basic_blocks.size(); i++){
		str = "\"";
		str = str + abstract_basic_blocks[i]->get_name();
		str = str + "\"";
		str = str + ":entry:s";
		found = 0;
		found = cfgString.find(str, found + 1);
		while (found != string::npos){
			count = 0;
			tmp = "";
			for (int j = found + 1; count < 3; j++){
				if (count == 2){
					tmp = tmp + cfgString[j];
				}

				if (cfgString[j] == '"')
					count++;
			}
			tmp.erase(tmp.end() - 1);
			for (int j = 0; j < abstract_basic_blocks.size(); j++){
				if (abstract_basic_blocks[j]->get_name() == tmp){
					abstract_basic_blocks[i]->add_successor(abstract_basic_blocks[j]);
					break;
				}
			}

			found = cfgString.find(str, found + 1);
		}
	}
	//************************************************************************************************

	//********************************Setting predecessors of abstract basic blocks**********************************
	vector<basicBlock*> x;
	for (int i = 0; i < abstract_basic_blocks.size(); i++){
		for (int j = 0; j < abstract_basic_blocks.size(); j++){
			x = abstract_basic_blocks[j]->get_successors();
			for (int k = 0; k < x.size(); k++){
				if (x[k]->get_name() == abstract_basic_blocks[i]->get_name()){
					abstract_basic_blocks[i]->add_predecessor(abstract_basic_blocks[j]);
				}
			}
		}
	}
	//************************************************************************************************
	
	//**************************Splitting abstract basic blocks to regular basic blocks***********************************
	auto basic_blocks = split_abstract_basic_blocks(abstract_basic_blocks);
	
	//***********************Extracting Registers of each basicBlock***************************************
	found = 0;
	for (int i = 0; i < basic_blocks.size(); i++){
		found = 0;
		code = basic_blocks[i]->get_code();
		found = code.find("R", found + 1, 1);
		while (found != string::npos){
			str = "R";
			if (code[found + 1] > 47 && code[found + 1] < 58){
				for (int j = found + 1; code[j] >47 && code[j] < 58; j++){
					str = str + code[j];
				}
				basic_blocks[i]->add_register(str);
			}

			found = code.find("R", found + 1, 1);
		}
	}
	//************************************************************************************************
        
        return basic_blocks;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x860, %rsp            # imm = 0x860
movq %rdi, -0x6b0(%rbp)
movq %rdi, %rax
movq %rax, -0x6a8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xbdb0
movq -0x10(%rbp), %rsi
leaq -0x238(%rbp), %rdi
movl $0x8, %edx
callq 0x3320
jmp 0x8034
leaq -0x268(%rbp), %rdi
callq 0x3360
leaq -0x289(%rbp), %rdi
movq %rdi, -0x6b8(%rbp)
callq 0x3450
movq -0x6b8(%rbp), %rdx
leaq 0x10039(%rip), %rsi     # 0x1809a
leaq -0x288(%rbp), %rdi
callq 0x3340
jmp 0x806f
leaq -0x289(%rbp), %rdi
callq 0x32a0
movb $0x0, -0x28a(%rbp)
movb $0x0, -0x28b(%rbp)
movb $0x0, -0x28c(%rbp)
leaq 0x4d09(%rip), %rsi      # 0xcda0
leaq -0x238(%rbp), %rdi
callq 0x3400
movq %rax, -0x6c0(%rbp)
jmp 0x80ac
movq -0x6c0(%rbp), %rdi
leaq -0x245(%rbp), %rsi
callq 0x3310
movq %rax, -0x6c8(%rbp)
jmp 0x80c8
movq -0x6c8(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x32e0
movb %al, -0x6c9(%rbp)
jmp 0x80e6
movb -0x6c9(%rbp), %al
testb $0x1, %al
jne 0x80f5
jmp 0x8186
movsbl -0x245(%rbp), %edx
leaq -0x2b0(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0xccd0
jmp 0x8111
leaq -0x268(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x32c0
leaq -0x2b0(%rbp), %rdi
callq 0x31a0
jmp 0x8090
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x9525
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x289(%rbp), %rdi
callq 0x32a0
jmp 0x950d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x9501
movl $0x0, -0x2b4(%rbp)
movslq -0x2b4(%rbp), %rax
movq %rax, -0x6d8(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x31c0
movq %rax, %rcx
movq -0x6d8(%rbp), %rax
cmpq %rcx, %rax
jae 0x843a
testb $0x1, -0x28a(%rbp)
je 0x8220
movslq -0x2b4(%rbp), %rsi
leaq -0x268(%rbp), %rdi
callq 0x34a0
movq %rax, -0x6e0(%rbp)
jmp 0x81e2
movq -0x6e0(%rbp), %rax
movsbl (%rax), %edx
leaq -0x2d8(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0xccd0
jmp 0x8201
leaq -0x288(%rbp), %rdi
leaq -0x2d8(%rbp), %rsi
callq 0x32c0
leaq -0x2d8(%rbp), %rdi
callq 0x31a0
movslq -0x2b4(%rbp), %rsi
leaq -0x268(%rbp), %rdi
callq 0x34a0
movq %rax, -0x6e8(%rbp)
jmp 0x823c
movq -0x6e8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
jne 0x826d
testb $0x1, -0x28a(%rbp)
jne 0x825d
movb $0x1, -0x28a(%rbp)
jmp 0x826b
movb $0x1, -0x28b(%rbp)
movb $0x0, -0x28a(%rbp)
jmp 0x826d
testb $0x1, -0x28b(%rbp)
je 0x8308
movl -0x2b4(%rbp), %eax
incl %eax
movslq %eax, %rsi
leaq -0x268(%rbp), %rdi
callq 0x34a0
movq %rax, -0x6f0(%rbp)
jmp 0x829a
movq -0x6f0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
je 0x82d8
movl -0x2b4(%rbp), %eax
incl %eax
movslq %eax, %rsi
leaq -0x268(%rbp), %rdi
callq 0x34a0
movq %rax, -0x6f8(%rbp)
jmp 0x82c9
movq -0x6f8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xd, %eax
jne 0x82e8
movb $0x1, -0x28c(%rbp)
movb $0x0, -0x28b(%rbp)
jmp 0x8306
movb $0x0, -0x28b(%rbp)
leaq 0xfda4(%rip), %rsi      # 0x1809a
leaq -0x288(%rbp), %rdi
callq 0x3330
jmp 0x8304
jmp 0x8306
jmp 0x8308
testb $0x1, -0x28c(%rbp)
je 0x8424
leaq -0x288(%rbp), %rdi
movq %rdi, -0x700(%rbp)
callq 0x31c0
movq -0x700(%rbp), %rdi
movq %rax, %rsi
decq %rsi
movl $0x1, %edx
callq 0x3090
jmp 0x8341
movl $0xf8, %edi
callq 0x3250
movq %rax, -0x708(%rbp)
jmp 0x8354
movb $0x1, -0x301(%rbp)
leaq -0x300(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x3110
jmp 0x8370
movq -0x708(%rbp), %rdi
leaq -0x300(%rbp), %rsi
callq 0x3e20
jmp 0x8385
movb $0x0, -0x301(%rbp)
leaq -0x300(%rbp), %rdi
callq 0x31a0
movq -0x708(%rbp), %rax
movq %rax, -0x2e0(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0xbec0
jmp 0x83b8
movb $0x0, -0x28c(%rbp)
leaq 0xfcd4(%rip), %rsi      # 0x1809a
leaq -0x288(%rbp), %rdi
callq 0x3330
jmp 0x83d4
jmp 0x8424
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x8408
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x300(%rbp), %rdi
callq 0x31a0
testb $0x1, -0x301(%rbp)
jne 0x8413
jmp 0x841f
movq -0x708(%rbp), %rdi
callq 0x3230
jmp 0x9501
jmp 0x8426
movl -0x2b4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2b4(%rbp)
jmp 0x8190
movl $0x0, -0x308(%rbp)
movl $0x0, -0x30c(%rbp)
leaq -0x330(%rbp), %rdi
callq 0x3360
movl $0x0, -0x334(%rbp)
movslq -0x334(%rbp), %rax
movq %rax, -0x710(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xbe80
movq %rax, %rcx
movq -0x710(%rbp), %rax
cmpq %rcx, %rax
jae 0x8626
leaq 0xfc05(%rip), %rsi      # 0x1809a
leaq -0x330(%rbp), %rdi
callq 0x3330
jmp 0x84a3
movl -0x308(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
leaq -0x268(%rbp), %rdi
leaq 0xfb49(%rip), %rsi      # 0x18006
movl $0x7, %ecx
callq 0x3430
movl %eax, -0x308(%rbp)
movl -0x30c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
leaq -0x268(%rbp), %rdi
leaq 0xfb27(%rip), %rsi      # 0x1800e
movl $0x3, %ecx
callq 0x3430
movl %eax, -0x30c(%rbp)
movl -0x308(%rbp), %eax
movl %eax, -0x338(%rbp)
movl -0x338(%rbp), %eax
movl -0x30c(%rbp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jge 0x859f
movslq -0x338(%rbp), %rsi
leaq -0x268(%rbp), %rdi
callq 0x34a0
movq %rax, -0x718(%rbp)
jmp 0x8536
movq -0x718(%rbp), %rax
movsbl (%rax), %edx
leaq -0x358(%rbp), %rdi
leaq -0x330(%rbp), %rsi
callq 0xccd0
jmp 0x8555
leaq -0x330(%rbp), %rdi
leaq -0x358(%rbp), %rsi
callq 0x32c0
leaq -0x358(%rbp), %rdi
callq 0x31a0
movl -0x338(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x338(%rbp)
jmp 0x8503
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x94f5
movslq -0x334(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0xbea0
movq (%rax), %rax
movq %rax, -0x720(%rbp)
leaq -0x378(%rbp), %rdi
leaq -0x330(%rbp), %rsi
callq 0x3110
jmp 0x85ce
movq -0x720(%rbp), %rdi
leaq -0x378(%rbp), %rsi
callq 0x4020
jmp 0x85e3
leaq -0x378(%rbp), %rdi
callq 0x31a0
movl -0x334(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x334(%rbp)
jmp 0x8464
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x378(%rbp), %rdi
callq 0x31a0
jmp 0x94f5
movq $0x0, -0x380(%rbp)
leaq -0x3a0(%rbp), %rdi
callq 0x3360
movl $0x0, -0x3a4(%rbp)
movl $0x0, -0x3a8(%rbp)
movslq -0x3a8(%rbp), %rax
movq %rax, -0x728(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xbe80
movq %rax, %rcx
movq -0x728(%rbp), %rax
cmpq %rcx, %rax
jae 0x8a8a
leaq 0xf990(%rip), %rsi      # 0x18012
leaq -0x288(%rbp), %rdi
callq 0x3330
jmp 0x8690
movslq -0x3a8(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0xbea0
movq (%rax), %rsi
leaq -0x3e8(%rbp), %rdi
callq 0x4320
jmp 0x86b1
leaq -0x3c8(%rbp), %rdi
leaq -0x288(%rbp), %rsi
leaq -0x3e8(%rbp), %rdx
callq 0xc8e0
jmp 0x86cd
leaq -0x288(%rbp), %rdi
movq %rdi, -0x730(%rbp)
leaq -0x3c8(%rbp), %rsi
movq %rsi, -0x738(%rbp)
callq 0x32c0
movq -0x738(%rbp), %rdi
callq 0x31a0
leaq -0x3e8(%rbp), %rdi
callq 0x31a0
movq -0x730(%rbp), %rsi
leaq 0xf8fe(%rip), %rdx      # 0x18012
leaq -0x408(%rbp), %rdi
callq 0xcdd0
jmp 0x8722
leaq -0x288(%rbp), %rdi
movq %rdi, -0x740(%rbp)
leaq -0x408(%rbp), %rsi
movq %rsi, -0x748(%rbp)
callq 0x32c0
movq -0x748(%rbp), %rdi
callq 0x31a0
movq -0x740(%rbp), %rsi
leaq 0xf8b7(%rip), %rdx      # 0x18014
leaq -0x428(%rbp), %rdi
callq 0xcdd0
jmp 0x876b
leaq -0x288(%rbp), %rdi
leaq -0x428(%rbp), %rsi
callq 0x32c0
leaq -0x428(%rbp), %rdi
callq 0x31a0
movq $0x0, -0x380(%rbp)
movq -0x380(%rbp), %rdx
addq $0x1, %rdx
leaq -0x268(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x34b0
movq %rax, -0x380(%rbp)
cmpq $-0x1, -0x380(%rbp)
je 0x8a74
movl $0x0, -0x3a4(%rbp)
leaq 0xf8c1(%rip), %rsi      # 0x1809a
leaq -0x3a0(%rbp), %rdi
callq 0x3330
jmp 0x87e7
movq -0x380(%rbp), %rax
addq $0x1, %rax
movl %eax, -0x42c(%rbp)
cmpl $0x3, -0x3a4(%rbp)
jge 0x88f8
cmpl $0x2, -0x3a4(%rbp)
jne 0x88a8
movslq -0x42c(%rbp), %rsi
leaq -0x268(%rbp), %rdi
callq 0x34a0
movq %rax, -0x750(%rbp)
jmp 0x882e
movq -0x750(%rbp), %rax
movsbl (%rax), %edx
leaq -0x450(%rbp), %rdi
leaq -0x3a0(%rbp), %rsi
callq 0xccd0
jmp 0x884d
leaq -0x3a0(%rbp), %rdi
leaq -0x450(%rbp), %rsi
callq 0x32c0
leaq -0x450(%rbp), %rdi
callq 0x31a0
jmp 0x88a8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x94e9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x3e8(%rbp), %rdi
callq 0x31a0
jmp 0x94e9
movslq -0x42c(%rbp), %rsi
leaq -0x268(%rbp), %rdi
callq 0x34a0
movq %rax, -0x758(%rbp)
jmp 0x88c4
movq -0x758(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
jne 0x88e2
movl -0x3a4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3a4(%rbp)
jmp 0x88e4
movl -0x42c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x42c(%rbp)
jmp 0x87f8
leaq -0x3a0(%rbp), %rdi
movq %rdi, -0x768(%rbp)
callq 0x3170
movq %rax, -0x468(%rbp)
leaq -0x468(%rbp), %rdi
movl $0x1, %esi
callq 0xce50
movq %rax, -0x460(%rbp)
leaq -0x458(%rbp), %rdi
leaq -0x460(%rbp), %rsi
callq 0xbab0
movq -0x768(%rbp), %rdi
movq -0x458(%rbp), %rsi
callq 0x32d0
movq %rax, -0x760(%rbp)
jmp 0x8959
movq -0x760(%rbp), %rax
movq %rax, -0x470(%rbp)
movl $0x0, -0x474(%rbp)
movslq -0x474(%rbp), %rax
movq %rax, -0x770(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xbe80
movq %rax, %rcx
movq -0x770(%rbp), %rax
cmpq %rcx, %rax
jae 0x8a4a
movslq -0x474(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0xbea0
movq (%rax), %rsi
leaq -0x498(%rbp), %rdi
callq 0x4320
jmp 0x89bc
leaq -0x498(%rbp), %rdi
leaq -0x3a0(%rbp), %rsi
callq 0xce90
movb %al, -0x771(%rbp)
leaq -0x498(%rbp), %rdi
callq 0x31a0
movb -0x771(%rbp), %al
testb $0x1, %al
jne 0x89ed
jmp 0x8a34
movslq -0x3a8(%rbp), %rsi
leaq -0x28(%rbp), %rdi
movq %rdi, -0x788(%rbp)
callq 0xbea0
movq -0x788(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x780(%rbp)
movslq -0x474(%rbp), %rsi
callq 0xbea0
movq -0x780(%rbp), %rdi
movq (%rax), %rsi
callq 0x41a0
jmp 0x8a32
jmp 0x8a4a
jmp 0x8a36
movl -0x474(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x474(%rbp)
jmp 0x8971
movq -0x380(%rbp), %rdx
addq $0x1, %rdx
leaq -0x268(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x34b0
movq %rax, -0x380(%rbp)
jmp 0x87ba
jmp 0x8a76
movl -0x3a8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3a8(%rbp)
jmp 0x8651
movl $0x0, -0x3a4(%rbp)
movl $0x0, -0x49c(%rbp)
movslq -0x49c(%rbp), %rax
movq %rax, -0x790(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xbe80
movq %rax, %rcx
movq -0x790(%rbp), %rax
cmpq %rcx, %rax
jae 0x8ebc
leaq 0xf543(%rip), %rsi      # 0x18012
leaq -0x288(%rbp), %rdi
callq 0x3330
jmp 0x8add
movslq -0x49c(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0xbea0
movq (%rax), %rsi
leaq -0x4e0(%rbp), %rdi
callq 0x4320
jmp 0x8afe
leaq -0x4c0(%rbp), %rdi
leaq -0x288(%rbp), %rsi
leaq -0x4e0(%rbp), %rdx
callq 0xc8e0
jmp 0x8b1a
leaq -0x288(%rbp), %rdi
movq %rdi, -0x798(%rbp)
leaq -0x4c0(%rbp), %rsi
movq %rsi, -0x7a0(%rbp)
callq 0x32c0
movq -0x7a0(%rbp), %rdi
callq 0x31a0
leaq -0x4e0(%rbp), %rdi
callq 0x31a0
movq -0x798(%rbp), %rsi
leaq 0xf4b1(%rip), %rdx      # 0x18012
leaq -0x500(%rbp), %rdi
callq 0xcdd0
jmp 0x8b6f
leaq -0x288(%rbp), %rdi
movq %rdi, -0x7a8(%rbp)
leaq -0x500(%rbp), %rsi
movq %rsi, -0x7b0(%rbp)
callq 0x32c0
movq -0x7b0(%rbp), %rdi
callq 0x31a0
movq -0x7a8(%rbp), %rsi
leaq 0xf470(%rip), %rdx      # 0x1801a
leaq -0x520(%rbp), %rdi
callq 0xcdd0
jmp 0x8bb8
leaq -0x288(%rbp), %rdi
leaq -0x520(%rbp), %rsi
callq 0x32c0
leaq -0x520(%rbp), %rdi
callq 0x31a0
movq $0x0, -0x380(%rbp)
movq -0x380(%rbp), %rdx
addq $0x1, %rdx
leaq -0x268(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x34b0
movq %rax, -0x380(%rbp)
cmpq $-0x1, -0x380(%rbp)
je 0x8ea6
movl $0x0, -0x3a4(%rbp)
leaq 0xf474(%rip), %rsi      # 0x1809a
leaq -0x3a0(%rbp), %rdi
callq 0x3330
jmp 0x8c34
movq -0x380(%rbp), %rax
addq $0x1, %rax
movl %eax, -0x524(%rbp)
cmpl $0x3, -0x3a4(%rbp)
jge 0x8d2a
cmpl $0x2, -0x3a4(%rbp)
jne 0x8cda
movslq -0x524(%rbp), %rsi
leaq -0x268(%rbp), %rdi
callq 0x34a0
movq %rax, -0x7b8(%rbp)
jmp 0x8c77
movq -0x7b8(%rbp), %rax
movsbl (%rax), %edx
leaq -0x548(%rbp), %rdi
leaq -0x3a0(%rbp), %rsi
callq 0xccd0
jmp 0x8c96
leaq -0x3a0(%rbp), %rdi
leaq -0x548(%rbp), %rsi
callq 0x32c0
leaq -0x548(%rbp), %rdi
callq 0x31a0
jmp 0x8cda
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x4e0(%rbp), %rdi
callq 0x31a0
jmp 0x94e9
movslq -0x524(%rbp), %rsi
leaq -0x268(%rbp), %rdi
callq 0x34a0
movq %rax, -0x7c0(%rbp)
jmp 0x8cf6
movq -0x7c0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
jne 0x8d14
movl -0x3a4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3a4(%rbp)
jmp 0x8d16
movl -0x524(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x524(%rbp)
jmp 0x8c45
leaq -0x3a0(%rbp), %rdi
movq %rdi, -0x7d0(%rbp)
callq 0x3170
movq %rax, -0x560(%rbp)
leaq -0x560(%rbp), %rdi
movl $0x1, %esi
callq 0xce50
movq %rax, -0x558(%rbp)
leaq -0x550(%rbp), %rdi
leaq -0x558(%rbp), %rsi
callq 0xbab0
movq -0x7d0(%rbp), %rdi
movq -0x550(%rbp), %rsi
callq 0x32d0
movq %rax, -0x7c8(%rbp)
jmp 0x8d8b
movq -0x7c8(%rbp), %rax
movq %rax, -0x568(%rbp)
movl $0x0, -0x56c(%rbp)
movslq -0x56c(%rbp), %rax
movq %rax, -0x7d8(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xbe80
movq %rax, %rcx
movq -0x7d8(%rbp), %rax
cmpq %rcx, %rax
jae 0x8e7c
movslq -0x56c(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0xbea0
movq (%rax), %rsi
leaq -0x590(%rbp), %rdi
callq 0x4320
jmp 0x8dee
leaq -0x590(%rbp), %rdi
leaq -0x3a0(%rbp), %rsi
callq 0xce90
movb %al, -0x7d9(%rbp)
leaq -0x590(%rbp), %rdi
callq 0x31a0
movb -0x7d9(%rbp), %al
testb $0x1, %al
jne 0x8e1f
jmp 0x8e66
movslq -0x49c(%rbp), %rsi
leaq -0x28(%rbp), %rdi
movq %rdi, -0x7f0(%rbp)
callq 0xbea0
movq -0x7f0(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x7e8(%rbp)
movslq -0x56c(%rbp), %rsi
callq 0xbea0
movq -0x7e8(%rbp), %rdi
movq (%rax), %rsi
callq 0x41a0
jmp 0x8e64
jmp 0x8e7c
jmp 0x8e68
movl -0x56c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x56c(%rbp)
jmp 0x8da3
movq -0x380(%rbp), %rdx
addq $0x1, %rdx
leaq -0x268(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x34b0
movq %rax, -0x380(%rbp)
jmp 0x8c07
jmp 0x8ea8
movl -0x49c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x49c(%rbp)
jmp 0x8a9e
leaq -0x5a8(%rbp), %rdi
callq 0xbdb0
movl $0x0, -0x5ac(%rbp)
movslq -0x5ac(%rbp), %rax
movq %rax, -0x7f8(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xbe80
movq %rax, %rcx
movq -0x7f8(%rbp), %rax
cmpq %rcx, %rax
jae 0x90ef
movl $0x0, -0x5b0(%rbp)
movslq -0x5b0(%rbp), %rax
movq %rax, -0x800(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xbe80
movq %rax, %rcx
movq -0x800(%rbp), %rax
cmpq %rcx, %rax
jae 0x90d9
movslq -0x5b0(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0xbea0
movq (%rax), %rsi
leaq -0x5c8(%rbp), %rdi
callq 0x44d0
jmp 0x8f51
leaq -0x5a8(%rbp), %rdi
leaq -0x5c8(%rbp), %rsi
callq 0xcf20
leaq -0x5c8(%rbp), %rdi
callq 0xbdd0
movl $0x0, -0x5cc(%rbp)
movslq -0x5cc(%rbp), %rax
movq %rax, -0x808(%rbp)
leaq -0x5a8(%rbp), %rdi
callq 0xbe80
movq %rax, %rcx
movq -0x808(%rbp), %rax
cmpq %rcx, %rax
jae 0x90c3
movslq -0x5cc(%rbp), %rsi
leaq -0x5a8(%rbp), %rdi
callq 0xbea0
movq (%rax), %rsi
leaq -0x5f0(%rbp), %rdi
callq 0x4320
jmp 0x8fcb
movslq -0x5ac(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0xbea0
movq (%rax), %rsi
leaq -0x610(%rbp), %rdi
callq 0x4320
jmp 0x8fec
leaq -0x5f0(%rbp), %rdi
leaq -0x610(%rbp), %rsi
callq 0xce90
movb %al, -0x809(%rbp)
leaq -0x610(%rbp), %rdi
callq 0x31a0
leaq -0x5f0(%rbp), %rdi
callq 0x31a0
movb -0x809(%rbp), %al
testb $0x1, %al
jne 0x902c
jmp 0x90ad
movslq -0x5ac(%rbp), %rsi
leaq -0x28(%rbp), %rdi
movq %rdi, -0x820(%rbp)
callq 0xbea0
movq -0x820(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x818(%rbp)
movslq -0x5b0(%rbp), %rsi
callq 0xbea0
movq -0x818(%rbp), %rdi
movq (%rax), %rsi
callq 0x4110
jmp 0x9071
jmp 0x90ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x94dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x5f0(%rbp), %rdi
callq 0x31a0
jmp 0x94dd
jmp 0x90af
movl -0x5cc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5cc(%rbp)
jmp 0x8f7a
jmp 0x90c5
movl -0x5b0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5b0(%rbp)
jmp 0x8f06
jmp 0x90db
movl -0x5ac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5ac(%rbp)
jmp 0x8ed2
movb $0x0, -0x611(%rbp)
leaq -0x630(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0xc370
jmp 0x9108
movq -0x6b0(%rbp), %rdi
leaq -0x630(%rbp), %rsi
callq 0xa400
jmp 0x911d
leaq -0x630(%rbp), %rdi
callq 0xbdd0
movq $0x0, -0x380(%rbp)
movl $0x0, -0x634(%rbp)
movq -0x6b0(%rbp), %rdi
movslq -0x634(%rbp), %rax
movq %rax, -0x828(%rbp)
callq 0xbe80
movq %rax, %rcx
movq -0x828(%rbp), %rax
cmpq %rcx, %rax
jae 0x9454
movq -0x6b0(%rbp), %rdi
movq $0x0, -0x380(%rbp)
movslq -0x634(%rbp), %rsi
callq 0xbea0
movq (%rax), %rsi
leaq -0x658(%rbp), %rdi
callq 0x4360
jmp 0x919a
leaq -0x330(%rbp), %rdi
leaq -0x658(%rbp), %rsi
callq 0x32c0
leaq -0x658(%rbp), %rdi
callq 0x31a0
movq -0x380(%rbp), %rdx
addq $0x1, %rdx
leaq -0x330(%rbp), %rdi
leaq 0xee32(%rip), %rsi      # 0x18004
movl $0x1, %ecx
callq 0x3430
movq %rax, -0x380(%rbp)
cmpq $-0x1, -0x380(%rbp)
je 0x943e
leaq 0xee0c(%rip), %rsi      # 0x18004
leaq -0x288(%rbp), %rdi
callq 0x3330
jmp 0x9206
movq -0x380(%rbp), %rsi
incq %rsi
leaq -0x330(%rbp), %rdi
callq 0x34a0
movq %rax, -0x830(%rbp)
jmp 0x9225
movq -0x830(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
jle 0x940f
movq -0x380(%rbp), %rsi
incq %rsi
leaq -0x330(%rbp), %rdi
callq 0x34a0
movq %rax, -0x838(%rbp)
jmp 0x9257
movq -0x838(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
jge 0x940f
movq -0x380(%rbp), %rax
addq $0x1, %rax
movl %eax, -0x65c(%rbp)
movslq -0x65c(%rbp), %rsi
leaq -0x330(%rbp), %rdi
callq 0x34a0
movq %rax, -0x840(%rbp)
jmp 0x9297
movq -0x840(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x2f, %ecx
movb %al, -0x841(%rbp)
jle 0x92e0
movslq -0x65c(%rbp), %rsi
leaq -0x330(%rbp), %rdi
callq 0x34a0
movq %rax, -0x850(%rbp)
jmp 0x92ca
movq -0x850(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
setl %al
movb %al, -0x841(%rbp)
movb -0x841(%rbp), %al
testb $0x1, %al
jne 0x92ef
jmp 0x9397
movslq -0x65c(%rbp), %rsi
leaq -0x330(%rbp), %rdi
callq 0x34a0
movq %rax, -0x858(%rbp)
jmp 0x930b
movq -0x858(%rbp), %rax
movsbl (%rax), %edx
leaq -0x680(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0xccd0
jmp 0x932a
leaq -0x288(%rbp), %rdi
leaq -0x680(%rbp), %rsi
callq 0x32c0
leaq -0x680(%rbp), %rdi
callq 0x31a0
movl -0x65c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x65c(%rbp)
jmp 0x927b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x630(%rbp), %rdi
callq 0xbdd0
jmp 0x94dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x94d1
movq -0x6b0(%rbp), %rdi
movslq -0x634(%rbp), %rsi
callq 0xbea0
movq (%rax), %rax
movq %rax, -0x860(%rbp)
leaq -0x6a0(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x3110
jmp 0x93c9
movq -0x860(%rbp), %rdi
leaq -0x6a0(%rbp), %rsi
callq 0x40e0
jmp 0x93de
leaq -0x6a0(%rbp), %rdi
callq 0x31a0
jmp 0x940f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x6a0(%rbp), %rdi
callq 0x31a0
jmp 0x94d1
movq -0x380(%rbp), %rdx
addq $0x1, %rdx
leaq -0x330(%rbp), %rdi
leaq 0xebdc(%rip), %rsi      # 0x18004
movl $0x1, %ecx
callq 0x3430
movq %rax, -0x380(%rbp)
jmp 0x91e3
jmp 0x9440
movl -0x634(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x634(%rbp)
jmp 0x913e
movb $0x1, -0x611(%rbp)
testb $0x1, -0x611(%rbp)
jne 0x9470
movq -0x6b0(%rbp), %rdi
callq 0xbdd0
leaq -0x5a8(%rbp), %rdi
callq 0xbdd0
leaq -0x3a0(%rbp), %rdi
callq 0x31a0
leaq -0x330(%rbp), %rdi
callq 0x31a0
leaq -0x288(%rbp), %rdi
callq 0x31a0
leaq -0x268(%rbp), %rdi
callq 0x31a0
leaq -0x238(%rbp), %rdi
callq 0x3080
leaq -0x28(%rbp), %rdi
callq 0xbdd0
movq -0x6a8(%rbp), %rax
addq $0x860, %rsp            # imm = 0x860
popq %rbp
retq
movq -0x6b0(%rbp), %rdi
callq 0xbdd0
leaq -0x5a8(%rbp), %rdi
callq 0xbdd0
leaq -0x3a0(%rbp), %rdi
callq 0x31a0
leaq -0x330(%rbp), %rdi
callq 0x31a0
leaq -0x288(%rbp), %rdi
callq 0x31a0
leaq -0x268(%rbp), %rdi
callq 0x31a0
leaq -0x238(%rbp), %rdi
callq 0x3080
leaq -0x28(%rbp), %rdi
callq 0xbdd0
movq -0x240(%rbp), %rdi
callq 0x3440
nopw (%rax,%rax)