// File: /workspace/github_cpp_makefile_star2_O3/CMU-SAFARI[P]Register-Interval/./src/implementation/RegisterIntervalCreation.cpp
// Function: RegisterIntervalCreationPass::registerIntervalCreationPassOne(std::vector<basicBlock*, std::allocator<basicBlock*>>, int)
vector<registerInterval*> RegisterIntervalCreationPass::registerIntervalCreationPassOne(vector<basicBlock*> BB_vector, int N){ //N is the maximum number of registers allowed in a register-interval 
        basic_blocks = BB_vector;
    
        /* Initialization */
	for (auto b = basic_blocks.begin(); b != basic_blocks.end(); b++){
		(*b)->clear_input_list();
		(*b)->set_registerInterval(nullptr);
	}

	RegisterIntervals.clear();
	for(auto b = basic_blocks.begin(); b != basic_blocks.end(); b++){
		auto Predecessors = (*b)->get_predecessors();
		if(Predecessors.size() == 0){ // each basic block with no predecessors is assumed as an entry basicBlock
			auto temp = new registerInterval();
			RegisterIntervals.push_back(temp);
			(*b)->set_registerInterval(temp);
			WS.push(*b);// The entry basic block is added to the working set of registerInterval creation algorithm
		}
	}

	while (!WS.empty()){
		auto BB = WS.front(); //Get one basic blocks from working set
		WS.pop();
		auto i = BB->RegisterInterval(); //Get the register-interval that this basic block belongs to
		traverse(BB, N); //Traversing the basic block and splitting it if it has more than the allowed number of registers
		if (BB->numberOfRegisters() < N){
                        //In this loop we will add all eligible basic blocks to the current registerInterval (i)
			for (auto b = basic_blocks.begin(); b != basic_blocks.end(); b++){
				set<string> Union;//The set that will contain the union of register sets of all basic blocks of i
                                Union.clear();
				bool C = true;//This boolean determines that the basicBlock is reachable only from the current register-interval (in other words, its all predecessors should belong to the current register-interval)

				visit_all_predecessors(*b);//marks all basic blocks that can reach this basic block

				Union = (*b)->get_output_list();
                                //This loop will add all registers of marked basic blocks that belong to the current register-interval (i)
				for(auto bb = basic_blocks.begin(); bb != basic_blocks.end(); bb++){
					if(mark[(*bb)->getID()]){
						if((*bb)->RegisterInterval() == i){
							auto s = (*bb)->get_output_list();
							for (auto it = s.begin(); it != s.end(); it++){
								Union.insert(*it);
							}
						}
					}
				}
		
				//This loop determines the boolean value of C
				auto P = (*b)->get_predecessors();
                                for(auto p = P.begin(); p != P.end(); p++){
                                        if((*p)->RegisterInterval() != i)
                                                C = false;
                                }

				//If this basic block is eligible, it will be added to the current register-interval
				if ((*b)->RegisterInterval() == nullptr //the basic block should not belong to another register-interval
                                        && C  //All predecessors of the basic block should belong to the current register-interval
                                        && Union.size() < N //The union of all registers of the basic block and current register-interval should not be more than the allowed number
                                        )
                                {
					(*b)->set_registerInterval(i);
					(*b)->set_input_list(Union);
					traverse((*b), N);
				}
			}
		}
                //At this point no more basic blocks can be added to the current register-interval

                set<basicBlock*> Successors; //Successors will contain all successors of the current register-interval (i)
		Successors.clear();
                
                //This loop will add all successors of the current registerInterval to Successors set
		for (auto b = basic_blocks.begin(); b != basic_blocks.end(); b++){
			if ((*b)->RegisterInterval() == i){
				auto S = (*b)->get_successors();
				for (auto s = S.begin(); s != S.end(); s++){
					if ((*s)->RegisterInterval() != i)
						Successors.insert(*s);
				}
			}
		}
                
                //This loop will assign new register-intervals to the successors of the current register-interval
		set<basicBlock*>::iterator it2;
		for (auto s = Successors.begin(); s != Successors.end(); s++){
			if ((*s)->RegisterInterval() == nullptr){
				auto temp = new registerInterval();
				RegisterIntervals.push_back(temp);
				(*s)->set_registerInterval(temp);
				(*s)->clear_input_list();
				WS.push(*s);
			}
		}
	}
        
        /*At this point all register-interval are created
         *      and the rest of the function just sets the register list of register-intervals
         *      and forms the new CFG that its nodes are register-intervals*/

        //This loop will set the register list of all register-intervals
	for (auto i = RegisterIntervals.begin(); i != RegisterIntervals.end(); i++){
                set<string> regList;//the register list of register-interval
		regList.clear();
		for (auto b = basic_blocks.begin(); b != basic_blocks.end(); b++){
			if ((*b)->RegisterInterval() == *i){
				auto s = (*b)->get_output_list();
				for (auto it = s.begin(); it != s.end(); it++){
					regList.insert(*it);
				}
			}
		}
		(*i)->set_register_list(regList);
	}

	//This loop sets the series of instructions of all register-intervals
	string code;
	for (auto i = RegisterIntervals.begin(); i != RegisterIntervals.end(); i++){
		code = "";
		for (auto b = basic_blocks.begin(); b != basic_blocks.end(); b++){
			if ((*b)->RegisterInterval() == *i){
				code = code + (*b)->get_code();
			}
		}
		(*i)->set_code(code);
	}

	//This loop sets the predecessors and successors of all register-intervals
	for (auto i = RegisterIntervals.begin(); i != RegisterIntervals.end(); i++){
		for (auto b = basic_blocks.begin(); b != basic_blocks.end(); b++){
			if ((*b)->RegisterInterval() == *i){
				auto P = (*b)->get_predecessors();
				for (auto p = P.begin(); p != P.end(); p++){
					if ((*p)->RegisterInterval() != *i)
						(*i)->add_predecessor((*p)->RegisterInterval());
				}
                                
                                auto S = (*b)->get_successors();
				for (auto s = S.begin(); s != S.end(); s++){
					if ((*s)->RegisterInterval() != *i)
						(*i)->add_successors((*s)->RegisterInterval());
				}
			}
		}
	}
        
        return RegisterIntervals;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movl %edx, -0x64(%rbp)
movq %rdi, -0xc0(%rbp)
leaq 0xc051(%rip), %rdi      # 0xf210
callq 0x8de6
movq 0xc045(%rip), %r14      # 0xf210
cmpq 0xc046(%rip), %r14      # 0xf218
je 0x31ff
movl $0x90, %ebx
movq (%r14), %rdi
addq %rbx, %rdi
callq 0x95a8
movq (%r14), %rax
movq $0x0, 0xf0(%rax)
addq $0x8, %r14
cmpq 0xc01b(%rip), %r14      # 0xf218
jne 0x31d9
movq 0xc022(%rip), %rax      # 0xf228
cmpq %rax, 0xc023(%rip)      # 0xf230
je 0x3216
movq %rax, 0xc01a(%rip)      # 0xf230
movq 0xbff3(%rip), %rbx      # 0xf210
cmpq %r14, %rbx
je 0x336c
leaq -0x98(%rbp), %r15
xorl %r14d, %r14d
leaq -0x60(%rbp), %r13
leaq 0xc005(%rip), %r12      # 0xf240
movq (%rbx), %rsi
addq $0x60, %rsi
movq %r15, %rdi
callq 0x8ecc
movq -0x98(%rbp), %rdi
cmpq %rdi, -0x90(%rbp)
jne 0x3351
movl $0xc0, %edi
callq 0x21e0
movq %r14, 0x8(%rax)
movl %r14d, 0x10(%rax)
movq %r14, 0x18(%rax)
movl %r14d, 0x20(%rax)
movq %r14, 0x28(%rax)
leaq 0x48(%rax), %rcx
movq %rcx, 0x38(%rax)
movq %r14, 0x40(%rax)
movb $0x0, 0x48(%rax)
movq %rax, %rcx
addq $0x68, %rcx
movl %r14d, 0x68(%rax)
movq %r14, 0x70(%rax)
movq %rcx, 0x78(%rax)
movq %rcx, 0x80(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x88(%rax)
movups %xmm0, 0x98(%rax)
movups %xmm0, 0xa8(%rax)
movq %r14, 0xb8(%rax)
movl 0xbf39(%rip), %ecx      # 0xf204
leal 0x1(%rcx), %edx
movl %edx, 0xbf30(%rip)      # 0xf204
movl %ecx, (%rax)
movl %r14d, 0x58(%rax)
movq %rax, -0x60(%rbp)
movq 0xbf4b(%rip), %rsi      # 0xf230
cmpq 0xbf4c(%rip), %rsi      # 0xf238
je 0x32fb
movq %rax, (%rsi)
addq $0x8, 0xbf37(%rip)      # 0xf230
jmp 0x330a
leaq 0xbf26(%rip), %rdi      # 0xf228
movq %r13, %rdx
callq 0x9c5c
movq (%rbx), %rax
movq -0x60(%rbp), %rcx
movq %rcx, 0xf0(%rax)
movq 0xbf51(%rip), %rax      # 0xf270
movq 0xbf5a(%rip), %rcx      # 0xf280
addq $-0x8, %rcx
cmpq %rcx, %rax
je 0x333f
movq (%rbx), %rcx
movq %rcx, (%rax)
addq $0x8, 0xbf33(%rip)      # 0xf270
jmp 0x334a
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa1b2
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0x335b
callq 0x21c0
addq $0x8, %rbx
cmpq 0xbeb2(%rip), %rbx      # 0xf218
jne 0x323b
movq 0xbedd(%rip), %rax      # 0xf250
cmpq %rax, 0xbef6(%rip)      # 0xf270
je 0x3828
leaq -0x58(%rbp), %r13
movslq -0x64(%rbp), %rcx
movq %rcx, -0xc8(%rbp)
leaq -0x98(%rbp), %r12
movq (%rax), %r14
leaq 0xbea0(%rip), %rdi      # 0xf240
callq 0xa3bc
movq 0xf0(%r14), %rbx
movq %r14, %rdi
movl -0x64(%rbp), %r15d
movl %r15d, %esi
callq 0x3d4a
cmpl %r15d, 0xe8(%r14)
leaq -0x60(%rbp), %r15
jge 0x3623
movq 0xbe3d(%rip), %r14      # 0xf210
cmpq 0xbe3e(%rip), %r14      # 0xf218
je 0x3623
movl $0x0, -0x90(%rbp)
xorl %ecx, %ecx
movq %rcx, -0x88(%rbp)
leaq -0x90(%rbp), %rax
movq %rax, -0x80(%rbp)
movq %rax, -0x78(%rbp)
movq %rcx, -0x70(%rbp)
movq %r12, %rdi
callq 0x95a8
movq (%r14), %rdi
callq 0x49d6
movq (%r14), %rsi
movl $0xc0, %eax
addq %rax, %rsi
movq %r15, %rdi
callq 0x905a
movq %r14, -0x30(%rbp)
movq %r12, %rdi
callq 0x95a8
movq -0x50(%rbp), %rax
testq %rax, %rax
je 0x347b
movl -0x58(%rbp), %ecx
movl %ecx, -0x90(%rbp)
movq %rax, -0x88(%rbp)
movups -0x48(%rbp), %xmm0
movups %xmm0, -0x80(%rbp)
leaq -0x90(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x70(%rbp)
xorl %eax, %eax
movq %rax, -0x50(%rbp)
movq %r13, -0x48(%rbp)
movq %r13, -0x40(%rbp)
movq %rax, -0x38(%rbp)
movq %r15, %rdi
callq 0x8ff0
movq 0xbd86(%rip), %r14      # 0xf210
movq 0xbd87(%rip), %rax      # 0xf218
cmpq %rax, %r14
movabsq $-0x8000000000000000, %r10 # imm = 0x8000000000000000
je 0x354e
movq 0xbde5(%rip), %rcx      # 0xf290
movq (%r14), %rsi
movslq (%rsi), %rdx
leal 0x3f(%rdx), %edi
testq %rdx, %rdx
cmovnsl %edx, %edi
sarl $0x6, %edi
movslq %edi, %rdi
leaq (%rcx,%rdi,8), %rdi
leaq 0x3f(%r10), %r8
andq %rdx, %r8
xorl %r9d, %r9d
cmpq %r10, %r8
setbe %r9b
movq -0x8(%rdi,%r9,8), %rdi
btq %rdx, %rdi
jae 0x3541
cmpq %rbx, 0xf0(%rsi)
jne 0x3541
addq $0xc0, %rsi
movq %r15, %rdi
callq 0x905a
movq -0x48(%rbp), %r15
cmpq %r13, %r15
je 0x351d
leaq 0x20(%r15), %rsi
movq %r12, %rdi
callq 0x9d96
movq %r15, %rdi
callq 0x2240
movq %rax, %r15
cmpq %r13, %rax
jne 0x3501
leaq -0x60(%rbp), %r15
movq %r15, %rdi
callq 0x8ff0
movq 0xbd60(%rip), %rcx      # 0xf290
movq 0xbce1(%rip), %rax      # 0xf218
movabsq $-0x8000000000000000, %r10 # imm = 0x8000000000000000
addq $0x8, %r14
cmpq %rax, %r14
jne 0x34ab
movq -0x30(%rbp), %r14
movq (%r14), %rsi
addq $0x60, %rsi
movq %r15, %rdi
callq 0x8ecc
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rcx
movb $0x1, %al
cmpq %rcx, %rdi
je 0x3596
movq %rdi, %rdx
leaq -0x118(%rbp), %r8
movq (%rdx), %rsi
cmpq %rbx, 0xf0(%rsi)
sete %sil
andb %sil, %al
addq $0x8, %rdx
cmpq %rcx, %rdx
jne 0x357a
jmp 0x359d
leaq -0x118(%rbp), %r8
movq (%r14), %rcx
cmpq $0x0, 0xf0(%rcx)
jne 0x3608
testb %al, %al
je 0x3608
movq -0xc8(%rbp), %rax
cmpq %rax, -0x70(%rbp)
jae 0x3608
movq %rbx, 0xf0(%rcx)
movq (%r14), %r14
movq %r8, %rdi
movq %r12, %rsi
movq %r8, %r15
callq 0x905a
addq $0x90, %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x9274
movq %r15, %rdi
callq 0x8ff0
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movl -0x64(%rbp), %esi
callq 0x3d4a
movq -0x60(%rbp), %rdi
leaq -0x60(%rbp), %r15
movq -0x30(%rbp), %r14
testq %rdi, %rdi
je 0x3612
callq 0x21c0
movq %r12, %rdi
callq 0x8ff0
addq $0x8, %r14
jmp 0x33d3
movl $0x0, -0x90(%rbp)
xorl %ecx, %ecx
movq %rcx, -0x88(%rbp)
leaq -0x90(%rbp), %rax
movq %rax, -0x80(%rbp)
movq %rax, -0x78(%rbp)
movq %rcx, -0x70(%rbp)
movq %r12, %rdi
callq 0xa410
movq 0xbbb8(%rip), %r14      # 0xf210
movq 0xbbb9(%rip), %rax      # 0xf218
cmpq %rax, %r14
je 0x36cf
movq (%r14), %rsi
cmpq %rbx, 0xf0(%rsi)
jne 0x36c9
addq $0x78, %rsi
movq %r15, %rdi
callq 0x8ecc
movq -0x60(%rbp), %r15
movq -0x58(%rbp), %rax
cmpq %rax, %r15
je 0x36b1
movq (%r15), %rcx
cmpq %rbx, 0xf0(%rcx)
je 0x36a4
movq %r12, %rdi
movq %r15, %rsi
callq 0xa448
movq -0x58(%rbp), %rax
addq $0x8, %r15
cmpq %rax, %r15
jne 0x3689
movq -0x60(%rbp), %r15
testq %r15, %r15
je 0x36be
movq %r15, %rdi
callq 0x21c0
movq 0xbb53(%rip), %rax      # 0xf218
leaq -0x60(%rbp), %r15
addq $0x8, %r14
jmp 0x365f
movq -0x80(%rbp), %r15
leaq -0x90(%rbp), %rbx
cmpq %rbx, %r15
je 0x380c
movq 0x20(%r15), %rax
cmpq $0x0, 0xf0(%rax)
jne 0x37f8
movl $0xc0, %edi
callq 0x21e0
xorl %esi, %esi
movq %rsi, 0x8(%rax)
movl %esi, 0x10(%rax)
movq %rsi, 0x18(%rax)
movl %esi, 0x20(%rax)
movq %rsi, 0x28(%rax)
leaq 0x48(%rax), %rcx
movq %rcx, 0x38(%rax)
movq %rsi, 0x40(%rax)
movb $0x0, 0x48(%rax)
movq %rax, %rcx
addq $0x68, %rcx
movl %esi, 0x68(%rax)
movq %rsi, 0x70(%rax)
movq %rcx, 0x78(%rax)
movq %rcx, 0x80(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x88(%rax)
movups %xmm0, 0x98(%rax)
movups %xmm0, 0xa8(%rax)
movq %rsi, 0xb8(%rax)
movl 0xbaa3(%rip), %ecx      # 0xf204
leal 0x1(%rcx), %edx
movl %edx, 0xba9a(%rip)      # 0xf204
movl %ecx, (%rax)
movl %esi, 0x58(%rax)
movq %rax, -0x60(%rbp)
movq 0xbab6(%rip), %rsi      # 0xf230
cmpq 0xbab7(%rip), %rsi      # 0xf238
je 0x3790
movq %rax, (%rsi)
addq $0x8, 0xbaa2(%rip)      # 0xf230
jmp 0x37a0
leaq 0xba91(%rip), %rdi      # 0xf228
leaq -0x60(%rbp), %rdx
callq 0x9c5c
leaq 0x20(%r15), %r14
movq (%r14), %rax
movq -0x60(%rbp), %rcx
movq %rcx, 0xf0(%rax)
movq (%r14), %rdi
movl $0x90, %eax
addq %rax, %rdi
callq 0x95a8
movq 0xbaa7(%rip), %rax      # 0xf270
movq 0xbab0(%rip), %rcx      # 0xf280
addq $-0x8, %rcx
cmpq %rcx, %rax
je 0x37e9
movq (%r14), %rcx
movq %rcx, (%rax)
addq $0x8, 0xba89(%rip)      # 0xf270
jmp 0x37f8
leaq 0xba50(%rip), %rdi      # 0xf240
movq %r14, %rsi
callq 0xa1b2
movq %r15, %rdi
callq 0x2240
movq %rax, %r15
cmpq %rbx, %rax
jne 0x36e3
movq %r12, %rdi
callq 0x95e0
movq 0xba35(%rip), %rax      # 0xf250
cmpq %rax, 0xba4e(%rip)      # 0xf270
jne 0x3396
movq 0xb9f9(%rip), %r14      # 0xf228
cmpq 0xb9fa(%rip), %r14      # 0xf230
je 0x3bd9
leaq -0x58(%rbp), %r13
leaq -0x98(%rbp), %rbx
movl $0x0, -0x90(%rbp)
xorl %ecx, %ecx
movq %rcx, -0x88(%rbp)
leaq -0x90(%rbp), %rax
movq %rax, -0x80(%rbp)
movq %rax, -0x78(%rbp)
movq %rcx, -0x70(%rbp)
movq %rbx, %rdi
callq 0x95a8
movq 0xb994(%rip), %r15      # 0xf210
movq 0xb995(%rip), %rax      # 0xf218
cmpq %rax, %r15
je 0x38e3
movq (%r15), %rsi
movq 0xf0(%rsi), %rcx
cmpq (%r14), %rcx
jne 0x38dd
addq $0xc0, %rsi
leaq -0x60(%rbp), %rdi
callq 0x905a
movq -0x48(%rbp), %r12
cmpq %r13, %r12
je 0x38cd
leaq 0x20(%r12), %rsi
movq %rbx, %rdi
callq 0x9d96
movq %r12, %rdi
callq 0x2240
movq %rax, %r12
cmpq %r13, %rax
jne 0x38b0
leaq -0x60(%rbp), %rdi
callq 0x8ff0
movq 0xb93b(%rip), %rax      # 0xf218
addq $0x8, %r15
jmp 0x3883
movq (%r14), %r12
leaq -0x148(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x905a
movq %r12, %rdi
movq %r15, %rsi
callq 0x2828
movq %r15, %rdi
callq 0x8ff0
movq %rbx, %rdi
callq 0x8ff0
addq $0x8, %r14
cmpq 0xb912(%rip), %r14      # 0xf230
jne 0x3847
movq 0xb8fd(%rip), %r13      # 0xf228
leaq -0x88(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movq %rax, -0x30(%rbp)
movb $0x0, (%rax)
cmpq %r14, %r13
je 0x3acc
leaq -0xa8(%rbp), %r15
leaq -0x50(%rbp), %r14
leaq -0xb8(%rbp), %r12
movq -0x90(%rbp), %rdx
leaq -0x98(%rbp), %rdi
xorl %esi, %esi
leaq 0x773f(%rip), %rcx      # 0xb0b6
xorl %r8d, %r8d
callq 0x2300
movq 0xb88a(%rip), %rbx      # 0xf210
movq 0xb88b(%rip), %rax      # 0xf218
cmpq %rax, %rbx
je 0x3a5b
movq (%rbx), %rcx
movq 0xf0(%rcx), %rdx
cmpq (%r13), %rdx
jne 0x3a52
movq %r15, -0xb8(%rbp)
movq 0x28(%rcx), %rsi
movq 0x30(%rcx), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x975c
movq -0x98(%rbp), %rcx
movq -0x90(%rbp), %r8
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2220
movq %r14, -0x60(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x39fe
movq %rdx, -0x60(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x50(%rbp)
jmp 0x3a05
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, -0x58(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x98(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x2270
movq -0x60(%rbp), %rdi
cmpq %r14, %rdi
je 0x3a3a
callq 0x21c0
movq -0xb8(%rbp), %rdi
cmpq %r15, %rdi
je 0x3a4b
callq 0x21c0
movq 0xb7c6(%rip), %rax      # 0xf218
addq $0x8, %rbx
jmp 0x398d
movq (%r13), %rbx
leaq -0xd8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
addq %rsi, %rdx
leaq -0xe8(%rbp), %rdi
callq 0x975c
movq %rbx, %rdi
leaq -0xe8(%rbp), %rsi
callq 0x2754
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x3ab1
callq 0x21c0
addq $0x8, %r13
cmpq 0xb774(%rip), %r13      # 0xf230
jne 0x3960
movq %r13, %r14
movq 0xb75c(%rip), %r13      # 0xf228
cmpq %r14, %r13
je 0x3bf3
movq 0xb73c(%rip), %rax      # 0xf218
leaq -0xb8(%rbp), %r12
movq 0xb726(%rip), %rbx      # 0xf210
cmpq %rax, %rbx
je 0x3bca
movq (%rbx), %rsi
movq 0xf0(%rsi), %rcx
cmpq (%r13), %rcx
jne 0x3bb6
addq $0x60, %rsi
leaq -0x60(%rbp), %rdi
callq 0x8ecc
movq -0x60(%rbp), %r14
movq -0x58(%rbp), %rax
cmpq %rax, %r14
je 0x3b43
movq (%r14), %rcx
movq 0xf0(%rcx), %rsi
movq (%r13), %rdi
cmpq %rdi, %rsi
je 0x3b3d
callq 0x29cc
movq -0x58(%rbp), %rax
addq $0x8, %r14
jmp 0x3b1c
movq (%rbx), %rsi
addq $0x78, %rsi
movq %r12, %rdi
callq 0x8ecc
movq -0xb8(%rbp), %r15
movq -0xb0(%rbp), %rax
cmpq %rax, %r15
je 0x3b94
movq (%r15), %rcx
movq 0xf0(%rcx), %rsi
movq (%r13), %rdi
cmpq %rdi, %rsi
je 0x3b84
callq 0x2a48
movq -0xb0(%rbp), %rax
addq $0x8, %r15
cmpq %rax, %r15
jne 0x3b65
movq -0xb8(%rbp), %r15
testq %r15, %r15
je 0x3ba1
movq %r15, %rdi
callq 0x21c0
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x3baf
callq 0x21c0
movq 0xb662(%rip), %rax      # 0xf218
addq $0x8, %rbx
cmpq %rax, %rbx
jne 0x3af3
movq 0xb666(%rip), %r14      # 0xf230
addq $0x8, %r13
cmpq %r14, %r13
jne 0x3ae3
jmp 0x3bf3
leaq -0x88(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movq %rax, -0x30(%rbp)
movb $0x0, (%rax)
leaq 0xb62e(%rip), %rsi      # 0xf228
movq -0xc0(%rbp), %rbx
movq %rbx, %rdi
callq 0x8d52
movq -0x98(%rbp), %rdi
cmpq -0x30(%rbp), %rdi
je 0x3c1b
callq 0x21c0
movq %rbx, %rax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3c91
movq %rax, %rbx
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
jne 0x3cf0
jmp 0x3cf5
movq %rax, %rbx
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
jne 0x3d02
jmp 0x3d42
movq %rax, %rbx
leaq -0x148(%rbp), %rdi
jmp 0x3d31
jmp 0x3cc9
jmp 0x3c91
jmp 0x3ce4
jmp 0x3c91
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
cmpq %r15, %rdi
jne 0x3cf0
jmp 0x3cf5
movq %rax, %rbx
jmp 0x3cf5
movq %rax, %rbx
leaq -0x118(%rbp), %rdi
callq 0x8ff0
jmp 0x3cae
jmp 0x3cc4
jmp 0x3cc9
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x3d36
callq 0x21c0
jmp 0x3d36
jmp 0x3cc9
jmp 0x3cc9
jmp 0x3cc9
movq %rax, %rbx
jmp 0x3d1a
movq %rax, %rbx
jmp 0x3d36
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
testq %rdi, %rdi
je 0x3ce7
callq 0x21c0
jmp 0x3ce7
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x3cf5
callq 0x21c0
movq -0x98(%rbp), %rdi
cmpq -0x30(%rbp), %rdi
je 0x3d42
callq 0x21c0
jmp 0x3d42
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x3d1a
callq 0x21c0
leaq -0x98(%rbp), %rdi
callq 0x95e0
jmp 0x3d42
jmp 0x3d2a
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x8ff0
leaq -0x98(%rbp), %rdi
callq 0x8ff0
movq %rbx, %rdi
callq 0x2370