// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]Register-Interval/main.cpp
// Function: basic_blocks_log(std::vector<basicBlock*, std::allocator<basicBlock*>>, char*)
void basic_blocks_log(vector<basicBlock*> basic_blocks, 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/BasicBlocks_" + File + ".txt");
        
        vector<basicBlock*> P ,S;
	out << "The number of basic_blocks = " << basic_blocks.size() << endl;
	for (int i = 0; i < basic_blocks.size(); i++){
		out << " #The basic_block ID : " << basic_blocks[i]->getID() << endl;
		out << "		#Number of Instructions = " << basic_blocks[i]->numberOfInstructions() << endl;
		out << "		#Register_list = {";
		set<string> L = basic_blocks[i]->get_output_list();
		set<string>::iterator it;
		for (it = L.begin(); it != L.end(); it++)
			out << *it << " ";
		out << "}; #Number of Registers = " << L.size() << ";" << endl;
		P = basic_blocks[i]->get_predecessors();
		S = basic_blocks[i]->get_successors();
		out << "		#predecessors = {";
		for(int j=0;j<P.size();j++){
			out << P[j]->getID() << " ";
		}
		out << "};		#successors = {";
		for(int j=0;j<S.size();j++){
			out << S[j]->getID() << " ";
		}
		out <<"};" << endl;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2b8, %rsp            # imm = 0x2B8
movq %rdi, -0x30(%rbp)
leaq -0xc0(%rbp), %r14
leaq -0x2d8(%rbp), %rdx
movq %r14, %rdi
callq 0x20c0
leaq 0x39b4(%rip), %r15      # 0x9064
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x2390
movq %rax, %r12
movl %r12d, %ebx
cmpl $-0x1, %ebx
je 0x56e0
leal 0x1(%rbx), %eax
movslq %eax, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2390
movl %ebx, %r12d
movl %eax, %ebx
jmp 0x56c3
leaq 0x397f(%rip), %rsi      # 0x9066
leaq -0xc0(%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 -0x2d8(%rbp), %rdi
movq %r14, %rsi
callq 0x21d0
leaq -0x2d8(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2220
movq %r15, %rdi
callq 0x2100
leaq 0x392f(%rip), %rsi      # 0x9068
leaq -0x70(%rbp), %rdi
movq %r14, %rdx
callq 0x6df7
leaq 0x3930(%rip), %rdx      # 0x907c
leaq -0xa0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x6dce
leaq -0x2d8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
pushq $0x10
popq %rdx
callq 0x2370
leaq -0xa0(%rbp), %rdi
callq 0x2100
leaq -0x70(%rbp), %r14
movq %r14, %rdi
callq 0x2100
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
andq $0x0, 0x10(%r14)
movaps %xmm0, -0x50(%rbp)
andq $0x0, -0x40(%rbp)
leaq 0x38db(%rip), %rsi      # 0x9081
leaq -0x2d8(%rbp), %rdi
callq 0x21b0
movq -0x30(%rbp), %r14
movq 0x8(%r14), %rsi
subq (%r14), %rsi
sarq $0x3, %rsi
movq %rax, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x2110
leaq -0x98(%rbp), %r12
xorl %ebx, %ebx
leaq 0x38d4(%rip), %r13      # 0x90b5
movq 0x8(%r14), %rax
subq (%r14), %rax
sarq $0x3, %rax
cmpq %rbx, %rax
jbe 0x59f4
movq %r15, %rdi
leaq 0x38a0(%rip), %rsi      # 0x909f
callq 0x21b0
movq (%r14), %rcx
movq (%rcx,%rbx,8), %rcx
movl (%rcx), %esi
movq %rax, %rdi
callq 0x2320
movq %rax, %rdi
callq 0x2110
movq %r15, %rdi
leaq 0x3890(%rip), %rsi      # 0x90b7
callq 0x21b0
movq (%r14), %rcx
movq (%rcx,%rbx,8), %rcx
movl 0x48(%rcx), %esi
movq %rax, %rdi
callq 0x2320
movq %rax, %rdi
callq 0x2110
movq %r15, %rdi
leaq 0x3884(%rip), %rsi      # 0x90d4
callq 0x21b0
movq (%r14), %rax
movq (%rax,%rbx,8), %rsi
movl $0xc0, %eax
addq %rax, %rsi
leaq -0xa0(%rbp), %rdi
callq 0x6ef4
movq -0x88(%rbp), %r14
cmpq %r12, %r14
je 0x58a0
leaq 0x20(%r14), %rsi
movq %r15, %rdi
callq 0x2190
movq %rax, %rdi
movq %r13, %rsi
callq 0x21b0
movq %r14, %rdi
callq 0x2200
movq %rax, %r14
jmp 0x5877
movq %r15, %rdi
leaq 0x383f(%rip), %rsi      # 0x90e9
callq 0x21b0
movq -0x78(%rbp), %rsi
movq %rax, %rdi
callq 0x2150
movq %rax, %rdi
leaq 0x3868(%rip), %rsi      # 0x912d
callq 0x21b0
movq %rax, %rdi
callq 0x2110
movq -0x30(%rbp), %r12
movq (%r12), %rax
movq (%rax,%rbx,8), %rsi
addq $0x60, %rsi
movq %rbx, %r14
leaq -0xd8(%rbp), %rbx
movq %rbx, %rdi
callq 0x6bdc
leaq -0x70(%rbp), %rdi
movq %rbx, %rsi
callq 0x8ee2
movq %rbx, %rdi
callq 0x7ed2
movq (%r12), %rax
movq %r14, %r12
movq (%rax,%r14,8), %rsi
addq $0x78, %rsi
movq %rbx, %rdi
callq 0x6bdc
leaq -0x50(%rbp), %rdi
movq %rbx, %rsi
callq 0x8ee2
movq %rbx, %rdi
callq 0x7ed2
movq %r15, %rdi
leaq 0x37c7(%rip), %rsi      # 0x9104
callq 0x21b0
movq %r12, %rbx
leaq -0x98(%rbp), %r12
xorl %r14d, %r14d
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r14, %rcx
jbe 0x5981
movq (%rax,%r14,8), %rax
movl (%rax), %esi
movq %r15, %rdi
callq 0x2320
movq %rax, %rdi
movq %r13, %rsi
callq 0x21b0
incq %r14
jmp 0x594f
movq %r15, %rdi
leaq 0x378d(%rip), %rsi      # 0x9118
callq 0x21b0
xorl %r14d, %r14d
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r14, %rcx
jbe 0x59c5
movq (%rax,%r14,8), %rax
movl (%rax), %esi
movq %r15, %rdi
callq 0x2320
movq %rax, %rdi
movq %r13, %rsi
callq 0x21b0
incq %r14
jmp 0x5993
movq %r15, %rdi
leaq 0x375d(%rip), %rsi      # 0x912c
callq 0x21b0
movq %rax, %rdi
callq 0x2110
leaq -0xa0(%rbp), %rdi
callq 0x6e7c
incq %rbx
movq -0x30(%rbp), %r14
jmp 0x57e1
leaq -0x50(%rbp), %rdi
callq 0x7ed2
leaq -0x70(%rbp), %rdi
callq 0x7ed2
leaq -0x2d8(%rbp), %rdi
callq 0x22b0
leaq -0xc0(%rbp), %rdi
callq 0x2100
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x2100
jmp 0x5a44
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x2100
jmp 0x5a96
jmp 0x5a51
movq %rax, %rbx
jmp 0x5a96
jmp 0x5a5e
jmp 0x5a69
jmp 0x5a69
jmp 0x5a5e
movq %rax, %rbx
jmp 0x5a78
jmp 0x5a69
jmp 0x5a69
jmp 0x5a69
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x6e7c
leaq -0x50(%rbp), %rdi
callq 0x7ed2
leaq -0x70(%rbp), %rdi
callq 0x7ed2
leaq -0x2d8(%rbp), %rdi
callq 0x22b0
leaq -0xc0(%rbp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x2340