// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]Register-Interval/main.cpp
// Function: registerInterval_log(std::vector<registerInterval*, std::allocator<registerInterval*>>, int, char*)
void registerInterval_log(vector<registerInterval*> intervals, int iteration, char* file_name){
	std::string File(file_name);
	int p = File.find("/");
	int p1 = p;
	while(p != string::npos){
		p1 = p;
		p = File.find("/", p + 1);
	}
	int p2 = File.find(".");
	File = File.substr(p1 + 1, p2 - p1 - 1);
        std::ofstream out("output/registerIntervals_" + File + ".txt");
        
	out << "The number of Intervals = " << intervals.size() << endl;
	for (int i = 0; i < intervals.size(); i++){
		out << " #Interval ID = " << intervals[i]->getID() << " #Number of Instructions = " << intervals[i]->getNumberOfInstructions() << endl;
		out << "		 #Register_list = {";
		set<string> L = intervals[i]->get_register_list();
		set<string>::iterator it;
		for (it = L.begin(); it != L.end(); it++)
			out << *it << " ";
		out << "}; #Number of Registers = " << L.size() << ";" << endl;
			
		vector<registerInterval*> ii;

		ii = intervals[i]->get_predecessors();
		out <<"		Predecessors = { ";
		for(int j = 0; j < ii.size(); j++){
			out << ii[j]->getID() << " ";
		}

		ii = intervals[i]->get_successors();
		out << "}		Successors = { ";
		for(int j = 0; j < ii.size(); j++){
			out << ii[j]->getID() << " ";
		}
		out << "};" << endl;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %rdi, %r13
leaq -0xa0(%rbp), %r14
leaq -0x2b8(%rbp), %rax
movq %r14, %rdi
movq %rdx, %rsi
movq %rax, %rdx
callq 0x20c0
leaq 0x3580(%rip), %r15      # 0x9064
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x2390
movq %rax, %r12
movl %r12d, %ebx
cmpl $-0x1, %ebx
je 0x5b14
leal 0x1(%rbx), %eax
movslq %eax, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2390
movl %ebx, %r12d
movl %eax, %ebx
jmp 0x5af7
leaq 0x354b(%rip), %rsi      # 0x9066
leaq -0xa0(%rbp), %r14
movq %r14, %rdi
xorl %edx, %edx
callq 0x2390
leal 0x1(%r12), %ecx
movslq %ecx, %rdx
notl %r12d
addl %eax, %r12d
movslq %r12d, %rcx
leaq -0x2b8(%rbp), %rdi
movq %r14, %rsi
callq 0x21d0
leaq -0x2b8(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2220
movq %r15, %rdi
callq 0x2100
leaq 0x35c2(%rip), %rsi      # 0x912f
leaq -0x50(%rbp), %rdi
movq %r14, %rdx
callq 0x6df7
leaq 0x34fc(%rip), %rdx      # 0x907c
leaq -0x80(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x6dce
leaq -0x2b8(%rbp), %rdi
leaq -0x80(%rbp), %rsi
pushq $0x10
popq %rdx
callq 0x2370
leaq -0x80(%rbp), %rdi
callq 0x2100
leaq -0x50(%rbp), %rdi
callq 0x2100
leaq 0x3590(%rip), %rsi      # 0x9149
leaq -0x2b8(%rbp), %rdi
callq 0x21b0
movq 0x8(%r13), %rsi
subq (%r13), %rsi
sarq $0x3, %rsi
movq %rax, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x2110
leaq -0x78(%rbp), %r12
xorl %ebx, %ebx
leaq 0x34c7(%rip), %r14      # 0x90b5
movq %r13, -0x30(%rbp)
movq 0x8(%r13), %rax
subq (%r13), %rax
sarq $0x3, %rax
cmpq %rbx, %rax
jbe 0x5e0a
movq %r15, %rdi
leaq 0x3553(%rip), %rsi      # 0x9164
callq 0x21b0
movq (%r13), %rcx
movq (%rcx,%rbx,8), %rcx
movl (%rcx), %esi
movq %rax, %rdi
callq 0x2320
movq %rax, %rdi
leaq 0x3543(%rip), %rsi      # 0x9175
callq 0x21b0
movq (%r13), %rcx
movq (%rcx,%rbx,8), %rcx
movl 0x58(%rcx), %esi
movq %rax, %rdi
callq 0x2320
movq %rax, %rdi
callq 0x2110
movq %r15, %rdi
leaq 0x3535(%rip), %rsi      # 0x9191
callq 0x21b0
movq (%r13), %rax
movq (%rax,%rbx,8), %rsi
addq $0x60, %rsi
leaq -0x80(%rbp), %rdi
callq 0x6ef4
movq -0x68(%rbp), %r13
cmpq %r12, %r13
je 0x5ca3
leaq 0x20(%r13), %rsi
movq %r15, %rdi
callq 0x2190
movq %rax, %rdi
movq %r14, %rsi
callq 0x21b0
movq %r13, %rdi
callq 0x2200
movq %rax, %r13
jmp 0x5c7a
movq %r15, %rdi
leaq 0x343c(%rip), %rsi      # 0x90e9
callq 0x21b0
movq -0x58(%rbp), %rsi
movq %rax, %rdi
callq 0x2150
movq %rax, %rdi
leaq 0x3465(%rip), %rsi      # 0x912d
callq 0x21b0
movq %rax, %rdi
callq 0x2110
andq $0x0, -0x40(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq (%rax,%rbx,8), %rsi
movl $0x90, %eax
addq %rax, %rsi
leaq -0xb8(%rbp), %r13
movq %r13, %rdi
callq 0x6a50
leaq -0x50(%rbp), %rdi
movq %r13, %rsi
callq 0x8e76
movq %r13, %rdi
callq 0x781c
movq %r15, %rdi
leaq 0x3486(%rip), %rsi      # 0x91a7
callq 0x21b0
xorl %r13d, %r13d
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r13, %rcx
jbe 0x5d5b
movq (%rax,%r13,8), %rax
movl (%rax), %esi
movq %r15, %rdi
callq 0x2320
movq %rax, %rdi
movq %r14, %rsi
callq 0x21b0
incq %r13
jmp 0x5d29
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq (%rax,%rbx,8), %rsi
movl $0xa8, %eax
addq %rax, %rsi
leaq -0xb8(%rbp), %r13
movq %r13, %rdi
callq 0x6a50
leaq -0x50(%rbp), %rdi
movq %r13, %rsi
callq 0x8e76
movq %r13, %rdi
callq 0x781c
movq %r15, %rdi
leaq 0x3420(%rip), %rsi      # 0x91bb
callq 0x21b0
xorl %r13d, %r13d
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r13, %rcx
jbe 0x5dd5
movq (%rax,%r13,8), %rax
movl (%rax), %esi
movq %r15, %rdi
callq 0x2320
movq %rax, %rdi
movq %r14, %rsi
callq 0x21b0
incq %r13
jmp 0x5da3
movq %r15, %rdi
leaq 0x334d(%rip), %rsi      # 0x912c
callq 0x21b0
movq %rax, %rdi
callq 0x2110
leaq -0x50(%rbp), %rdi
callq 0x781c
leaq -0x80(%rbp), %rdi
callq 0x6e7c
incq %rbx
movq -0x30(%rbp), %r13
jmp 0x5bf2
leaq -0x2b8(%rbp), %rdi
callq 0x22b0
leaq -0xa0(%rbp), %rdi
callq 0x2100
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x2100
jmp 0x5e45
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x2100
jmp 0x5e90
jmp 0x5e52
movq %rax, %rbx
jmp 0x5e90
jmp 0x5e63
jmp 0x5e6a
jmp 0x5e6a
jmp 0x5e63
jmp 0x5e6a
jmp 0x5e78
movq %rax, %rbx
jmp 0x5e84
jmp 0x5e6a
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x781c
jmp 0x5e7b
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x6e7c
leaq -0x2b8(%rbp), %rdi
callq 0x22b0
leaq -0xa0(%rbp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x2340