// File: CMU-SAFARI[P]Register-Interval/./src/implementation/RegisterIntervalCreation.cpp
// Function: RegisterIntervalCreationPass::traverse(basicBlock*, int)
void RegisterIntervalCreationPass::traverse(basicBlock* BB, int N){
	set<string> temp_list;
	vector<basicBlock*> V;
	auto register_list = BB->get_input_list();

	basicBlock* BB1;
	registerInterval* temp;
        string new_name, old_name;
        
        //set<string> register_list;//register_list is a list that will be updated after processing each instruction and the new registers will be added to it
        //register_list.clear();
        set<string> temporary_register_list;//temporary_register_list contains is like register_list but it can have more than N registers and it is checked at each iteration
        temporary_register_list.clear();
        
        string code = BB->get_code();//code is the string of instruction sequence
        
	int found1 = 0; //points to the beginning of the instruction string
	int found2 = code.find(";", found1, 1); //points to the end of instructions string
	while (found2 != string::npos){//This loop continues until all instructions of the basic block are processed
		
                /* this loop updates register_list for the current instruction (in other words it finds the register operands of the instruction)*/
		for (int i = found1; i < found2; i++){
			if (code[i] == 'R'){
				string str = "";
				if (code[i + 1]>47 && code[i + 1] < 58){
					str.push_back('R');
					str.push_back(code[i + 1]);
					if (code[i + 2]>47 && code[i + 2] < 58){
						str.push_back(code[i + 2]);
					}
					temporary_register_list.insert(str);
				}
			}
		}

		/*after cheching the size of temporary_register_list, we decide to split the basic block or not */
		if (temporary_register_list.size() > N){
                        /*At this point the basic block will be splited and the current instruction will reside in the second baisc basicBlock*/
			string code1, code2;//code1 and code2 contain the instructions of two basic blocks after splitting
                        code1.append(code, 0, found1); 
			code2.append(code, found1 + 1, code.size() - found1);


			//introducing a new basic block BB1:
			BB1 = new basicBlock();
			basic_blocks.push_back(BB1);
			
			old_name = BB->get_name();
			string new_name = old_name + std::to_string(BB->getID() + 1);
			BB1->set_name(new_name);//sets the name of the new basic blcok
			
                        int found = 0;
			found = code2.find(old_name, found+1);
			while(found != string::npos){//in thils loop finds points of code that uses the old name and replaces with the new name
				code2.replace(found, old_name.size(), new_name);
				
				found = code2.find(old_name, found+1);
			}
			BB1->set_code(code2);

			/*At this point the register set of the new basic block will be set*/
			found = 0;
			found = code2.find("R", found + 1, 1);
			while (found != string::npos){
				string str = "R";
				if (code2[found + 1] > 47 && code2[found + 1] < 58){
					for (int j = found + 1; code2[j] >47 && code2[j] < 58; j++){
						str = str + code2[j];
					}
					BB1->add_register(str);
				}

				found = code2.find("R", found + 1, 1);
			}
                        
                        //The BB will be splitted and its code and register list are updated
			BB->set_code(code1);
			BB->set_output_list(register_list);

			/*setting successors of old and new basic blocks*/
			BB1->set_successors(BB->get_successors()); //the successors of the new basic block is just like the original basic block
                        vector<basicBlock*> S;
                        S.clear();
                        S.push_back(BB1);
                        BB->set_successors(S); //the only successor of the old basic block is the new one

			/*setting predecessors of new and old basic blocks*/
			BB1->add_predecessor(BB); //the only predecessor of the new basic block is the old one (also the predecessors of the old basic block won't change)
			

			auto temp = new registerInterval();
			RegisterIntervals.push_back(temp);
			BB1->set_registerInterval(temp);
			BB1->clear_input_list();
			WS.push(BB1);//the new basic block has been assigned to a new register-interval

			return;
		}
		else{
			register_list = temporary_register_list;
			BB->set_output_list(register_list);
		}

		register_list = temporary_register_list;
		found1 = found2 + 1;
		found2 = code.find(";", found1, 1);
	}

	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4c0, %rsp            # imm = 0x4C0
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
leaq -0x40(%rbp), %rdi
callq 0xb630
leaq -0x58(%rbp), %rdi
callq 0xbdb0
movq -0x8(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x4400
jmp 0x5896
leaq -0xc8(%rbp), %rdi
callq 0x3360
leaq -0xe8(%rbp), %rdi
callq 0x3360
leaq -0x118(%rbp), %rdi
movq %rdi, -0x3b0(%rbp)
callq 0xb630
movq -0x3b0(%rbp), %rdi
callq 0xc460
movq -0x8(%rbp), %rsi
leaq -0x138(%rbp), %rdi
callq 0x4360
jmp 0x58df
movl $0x0, -0x13c(%rbp)
movslq -0x13c(%rbp), %rdx
leaq -0x138(%rbp), %rdi
leaq 0x12813(%rip), %rsi     # 0x18111
movl $0x1, %ecx
callq 0x3430
movl %eax, -0x140(%rbp)
movslq -0x140(%rbp), %rax
cmpq $-0x1, %rax
je 0x65a4
movl -0x13c(%rbp), %eax
movl %eax, -0x144(%rbp)
movl -0x144(%rbp), %eax
cmpl -0x140(%rbp), %eax
jge 0x5be7
movslq -0x144(%rbp), %rsi
leaq -0x138(%rbp), %rdi
callq 0x34a0
movq %rax, -0x3b8(%rbp)
jmp 0x5959
movq -0x3b8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x52, %eax
jne 0x5bd1
leaq -0x169(%rbp), %rdi
movq %rdi, -0x3c0(%rbp)
callq 0x3450
movq -0x3c0(%rbp), %rdx
leaq 0x1270d(%rip), %rsi     # 0x1809a
leaq -0x168(%rbp), %rdi
callq 0x3340
jmp 0x599b
leaq -0x169(%rbp), %rdi
callq 0x32a0
movl -0x144(%rbp), %eax
incl %eax
movslq %eax, %rsi
leaq -0x138(%rbp), %rdi
callq 0x34a0
movq %rax, -0x3c8(%rbp)
jmp 0x59c7
movq -0x3c8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
jle 0x5bc5
movl -0x144(%rbp), %eax
incl %eax
movslq %eax, %rsi
leaq -0x138(%rbp), %rdi
callq 0x34a0
movq %rax, -0x3d0(%rbp)
jmp 0x59fa
movq -0x3d0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
jge 0x5bc5
leaq -0x168(%rbp), %rdi
movl $0x52, %esi
callq 0x31f0
jmp 0x5a20
movl -0x144(%rbp), %eax
incl %eax
movslq %eax, %rsi
leaq -0x138(%rbp), %rdi
callq 0x34a0
movq %rax, -0x3d8(%rbp)
jmp 0x5a40
movq -0x3d8(%rbp), %rax
movsbl (%rax), %esi
leaq -0x168(%rbp), %rdi
callq 0x31f0
jmp 0x5a58
movl -0x144(%rbp), %eax
addl $0x2, %eax
movslq %eax, %rsi
leaq -0x138(%rbp), %rdi
callq 0x34a0
movq %rax, -0x3e0(%rbp)
jmp 0x5a79
movq -0x3e0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
jle 0x5b89
movl -0x144(%rbp), %eax
addl $0x2, %eax
movslq %eax, %rsi
leaq -0x138(%rbp), %rdi
callq 0x34a0
movq %rax, -0x3e8(%rbp)
jmp 0x5aad
movq -0x3e8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
jge 0x5b89
movl -0x144(%rbp), %eax
addl $0x2, %eax
movslq %eax, %rsi
leaq -0x138(%rbp), %rdi
callq 0x34a0
movq %rax, -0x3f0(%rbp)
jmp 0x5ae1
movq -0x3f0(%rbp), %rax
movsbl (%rax), %esi
leaq -0x168(%rbp), %rdi
callq 0x31f0
jmp 0x5af9
jmp 0x5b89
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x6641
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x6611
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x6605
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x169(%rbp), %rdi
callq 0x32a0
jmp 0x6605
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x31a0
jmp 0x6605
leaq -0x118(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0xbe30
movb %dl, -0x3f9(%rbp)
movq %rax, -0x3f8(%rbp)
jmp 0x5bab
movb -0x3f9(%rbp), %al
movq -0x3f8(%rbp), %rcx
movq %rcx, -0x180(%rbp)
movb %al, -0x178(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x31a0
jmp 0x5bd3
movl -0x144(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x144(%rbp)
jmp 0x592b
leaq -0x118(%rbp), %rdi
callq 0xc350
movslq -0xc(%rbp), %rcx
cmpq %rcx, %rax
jbe 0x64db
leaq -0x1a0(%rbp), %rdi
movq %rdi, -0x408(%rbp)
callq 0x3360
leaq -0x1c0(%rbp), %rdi
callq 0x3360
movq -0x408(%rbp), %rdi
movslq -0x13c(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x138(%rbp), %rsi
callq 0x3350
jmp 0x5c3f
movl -0x13c(%rbp), %eax
incl %eax
cltq
movq %rax, -0x410(%rbp)
leaq -0x138(%rbp), %rdi
movq %rdi, -0x418(%rbp)
callq 0x31c0
movq -0x418(%rbp), %rsi
movq -0x410(%rbp), %rdx
movq %rax, %rcx
movslq -0x13c(%rbp), %rax
subq %rax, %rcx
leaq -0x1c0(%rbp), %rdi
callq 0x3350
jmp 0x5c8c
movl $0xf8, %edi
callq 0x3250
movq %rax, -0x420(%rbp)
jmp 0x5c9f
movq -0x420(%rbp), %rdi
callq 0x3d10
jmp 0x5cad
movq -0x420(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq 0x1c5ce(%rip), %rdi     # 0x22290
leaq -0xa0(%rbp), %rsi
callq 0xbec0
jmp 0x5cd0
movq -0x8(%rbp), %rsi
leaq -0x1e0(%rbp), %rdi
callq 0x4320
jmp 0x5ce2
leaq -0xe8(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
movq %rsi, -0x428(%rbp)
callq 0x32c0
movq -0x428(%rbp), %rdi
callq 0x31a0
movq -0x8(%rbp), %rdi
callq 0x4350
movl %eax, %esi
incl %esi
leaq -0x220(%rbp), %rdi
callq 0xcbb0
jmp 0x5d23
leaq -0x200(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
leaq -0x220(%rbp), %rdx
callq 0xc8e0
jmp 0x5d3f
leaq -0x220(%rbp), %rdi
callq 0x31a0
movq -0xa0(%rbp), %rax
movq %rax, -0x430(%rbp)
leaq -0x240(%rbp), %rdi
leaq -0x200(%rbp), %rsi
callq 0x3110
jmp 0x5d6e
movq -0x430(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x3ff0
jmp 0x5d83
leaq -0x240(%rbp), %rdi
callq 0x31a0
movl $0x0, -0x244(%rbp)
movl -0x244(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
leaq -0x1c0(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x34b0
movl %eax, -0x244(%rbp)
movslq -0x244(%rbp), %rax
cmpq $-0x1, %rax
je 0x5ec6
movslq -0x244(%rbp), %rax
movq %rax, -0x438(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x31c0
movq -0x438(%rbp), %rsi
movq %rax, %rdx
leaq -0x1c0(%rbp), %rdi
leaq -0x200(%rbp), %rcx
callq 0x30d0
jmp 0x5e08
movl -0x244(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
leaq -0x1c0(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x34b0
movl %eax, -0x244(%rbp)
jmp 0x5dbe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x64be
movq -0x420(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
callq 0x3230
jmp 0x64be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x31a0
jmp 0x64be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x64b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x31a0
jmp 0x64b2
movq -0xa0(%rbp), %rax
movq %rax, -0x440(%rbp)
leaq -0x268(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x3110
jmp 0x5ee9
movq -0x440(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x4020
jmp 0x5efe
leaq -0x268(%rbp), %rdi
callq 0x31a0
movl $0x0, -0x244(%rbp)
movl -0x244(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
leaq -0x1c0(%rbp), %rdi
leaq 0x120d6(%rip), %rsi     # 0x18004
movl $0x1, %ecx
callq 0x3430
movl %eax, -0x244(%rbp)
movslq -0x244(%rbp), %rax
cmpq $-0x1, %rax
je 0x61f0
leaq -0x289(%rbp), %rdi
movq %rdi, -0x448(%rbp)
callq 0x3450
movq -0x448(%rbp), %rdx
leaq 0x12094(%rip), %rsi     # 0x18004
leaq -0x288(%rbp), %rdi
callq 0x3340
jmp 0x5f7e
leaq -0x289(%rbp), %rdi
callq 0x32a0
movl -0x244(%rbp), %eax
incl %eax
movslq %eax, %rsi
leaq -0x1c0(%rbp), %rdi
callq 0x34a0
movq %rax, -0x450(%rbp)
jmp 0x5faa
movq -0x450(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
jle 0x61a4
movl -0x244(%rbp), %eax
incl %eax
movslq %eax, %rsi
leaq -0x1c0(%rbp), %rdi
callq 0x34a0
movq %rax, -0x458(%rbp)
jmp 0x5fdd
movq -0x458(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
jge 0x61a4
movl -0x244(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x290(%rbp)
movslq -0x290(%rbp), %rsi
leaq -0x1c0(%rbp), %rdi
callq 0x34a0
movq %rax, -0x460(%rbp)
jmp 0x601b
movq -0x460(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x2f, %ecx
movb %al, -0x461(%rbp)
jle 0x6064
movslq -0x290(%rbp), %rsi
leaq -0x1c0(%rbp), %rdi
callq 0x34a0
movq %rax, -0x470(%rbp)
jmp 0x604e
movq -0x470(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
setl %al
movb %al, -0x461(%rbp)
movb -0x461(%rbp), %al
testb $0x1, %al
jne 0x6073
jmp 0x613e
movslq -0x290(%rbp), %rsi
leaq -0x1c0(%rbp), %rdi
callq 0x34a0
movq %rax, -0x478(%rbp)
jmp 0x608f
movq -0x478(%rbp), %rax
movsbl (%rax), %edx
leaq -0x2b0(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0xccd0
jmp 0x60ae
leaq -0x288(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x32c0
leaq -0x2b0(%rbp), %rdi
callq 0x31a0
movl -0x290(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x290(%rbp)
jmp 0x5fff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x31a0
jmp 0x64b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x289(%rbp), %rdi
callq 0x32a0
jmp 0x64b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x61df
movq -0xa0(%rbp), %rax
movq %rax, -0x480(%rbp)
leaq -0x2d0(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x3110
jmp 0x6161
movq -0x480(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x40e0
jmp 0x6176
leaq -0x2d0(%rbp), %rdi
callq 0x31a0
jmp 0x61a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0x31a0
jmp 0x61df
movl -0x244(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
leaq -0x1c0(%rbp), %rdi
leaq 0x11e46(%rip), %rsi     # 0x18004
movl $0x1, %ecx
callq 0x3430
movl %eax, -0x244(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x31a0
jmp 0x5f3e
leaq -0x288(%rbp), %rdi
callq 0x31a0
jmp 0x64b2
movq -0x8(%rbp), %rax
movq %rax, -0x488(%rbp)
leaq -0x2f0(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x3110
jmp 0x6210
movq -0x488(%rbp), %rdi
leaq -0x2f0(%rbp), %rsi
callq 0x4020
jmp 0x6225
leaq -0x2f0(%rbp), %rdi
callq 0x31a0
movq -0x8(%rbp), %rax
movq %rax, -0x490(%rbp)
leaq -0x320(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0xb710
jmp 0x6251
movq -0x490(%rbp), %rdi
leaq -0x320(%rbp), %rsi
callq 0x4440
jmp 0x6266
leaq -0x320(%rbp), %rdi
callq 0xb6d0
movq -0xa0(%rbp), %rax
movq %rax, -0x498(%rbp)
movq -0x8(%rbp), %rsi
leaq -0x338(%rbp), %rdi
callq 0x44d0
jmp 0x6292
movq -0x498(%rbp), %rdi
leaq -0x338(%rbp), %rsi
callq 0x4230
jmp 0x62a7
leaq -0x338(%rbp), %rdi
callq 0xbdd0
leaq -0x350(%rbp), %rdi
movq %rdi, -0x4a0(%rbp)
callq 0xbdb0
movq -0x4a0(%rbp), %rdi
callq 0xcd50
movq -0x4a0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0xbec0
jmp 0x62e7
movq -0x8(%rbp), %rax
movq %rax, -0x4a8(%rbp)
leaq -0x368(%rbp), %rdi
leaq -0x350(%rbp), %rsi
callq 0xc370
jmp 0x6307
movq -0x4a8(%rbp), %rdi
leaq -0x368(%rbp), %rsi
callq 0x4230
jmp 0x631c
leaq -0x368(%rbp), %rdi
callq 0xbdd0
movq -0xa0(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x4110
jmp 0x633a
movl $0xc0, %edi
callq 0x3250
movq %rax, -0x4b0(%rbp)
jmp 0x634d
movq -0x4b0(%rbp), %rdi
callq 0x3710
jmp 0x635b
movq -0x4b0(%rbp), %rax
movq %rax, -0x370(%rbp)
leaq 0x1bf38(%rip), %rdi     # 0x222a8
leaq -0x370(%rbp), %rsi
callq 0xbc50
jmp 0x637e
movq -0xa0(%rbp), %rdi
movq -0x370(%rbp), %rsi
callq 0x4580
movq -0xa0(%rbp), %rdi
callq 0x4550
leaq 0x1bf1c(%rip), %rdi     # 0x222c0
leaq -0xa0(%rbp), %rsi
callq 0xc4f0
jmp 0x63b2
movl $0x1, -0x374(%rbp)
leaq -0x350(%rbp), %rdi
callq 0xbdd0
leaq -0x200(%rbp), %rdi
callq 0x31a0
leaq -0x1c0(%rbp), %rdi
callq 0x31a0
leaq -0x1a0(%rbp), %rdi
callq 0x31a0
jmp 0x65ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x2f0(%rbp), %rdi
callq 0x31a0
jmp 0x64b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x320(%rbp), %rdi
callq 0xb6d0
jmp 0x64b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x338(%rbp), %rdi
callq 0xbdd0
jmp 0x64b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x64a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x368(%rbp), %rdi
callq 0xbdd0
jmp 0x64a6
movq -0x4b0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
callq 0x3230
leaq -0x350(%rbp), %rdi
callq 0xbdd0
leaq -0x200(%rbp), %rdi
callq 0x31a0
leaq -0x1c0(%rbp), %rdi
callq 0x31a0
leaq -0x1a0(%rbp), %rdi
callq 0x31a0
jmp 0x6605
leaq -0x88(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0xb8d0
jmp 0x64f0
movq -0x8(%rbp), %rax
movq %rax, -0x4b8(%rbp)
leaq -0x3a8(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0xb710
jmp 0x6510
movq -0x4b8(%rbp), %rdi
leaq -0x3a8(%rbp), %rsi
callq 0x4440
jmp 0x6525
leaq -0x3a8(%rbp), %rdi
callq 0xb6d0
jmp 0x6556
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x3a8(%rbp), %rdi
callq 0xb6d0
jmp 0x6605
leaq -0x88(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0xb8d0
jmp 0x656b
movl -0x140(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13c(%rbp)
movslq -0x13c(%rbp), %rdx
leaq -0x138(%rbp), %rdi
leaq 0x11b82(%rip), %rsi     # 0x18111
movl $0x1, %ecx
callq 0x3430
movl %eax, -0x140(%rbp)
jmp 0x590e
movl $0x1, -0x374(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x31a0
leaq -0x118(%rbp), %rdi
callq 0xb6d0
leaq -0xe8(%rbp), %rdi
callq 0x31a0
leaq -0xc8(%rbp), %rdi
callq 0x31a0
leaq -0x88(%rbp), %rdi
callq 0xb6d0
leaq -0x58(%rbp), %rdi
callq 0xbdd0
leaq -0x40(%rbp), %rdi
callq 0xb6d0
addq $0x4c0, %rsp            # imm = 0x4C0
popq %rbp
retq
leaq -0x138(%rbp), %rdi
callq 0x31a0
leaq -0x118(%rbp), %rdi
callq 0xb6d0
leaq -0xe8(%rbp), %rdi
callq 0x31a0
leaq -0xc8(%rbp), %rdi
callq 0x31a0
leaq -0x88(%rbp), %rdi
callq 0xb6d0
leaq -0x58(%rbp), %rdi
callq 0xbdd0
leaq -0x40(%rbp), %rdi
callq 0xb6d0
movq -0x90(%rbp), %rdi
callq 0x3440
nop