// File: /workspace/github_cpp_makefile_star2_O3/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 $0x298, %rsp            # imm = 0x298
movq %rdi, -0x48(%rbp)
leaq -0xc0(%rbp), %rbx
leaq -0x2c0(%rbp), %rdx
movq %rbx, %rdi
callq 0x20e0
leaq 0x42a5(%rip), %rsi      # 0xb064
movl $0x1, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2360
cmpl $-0x1, %eax
je 0x6e02
leaq 0x428a(%rip), %rbx      # 0xb064
leaq -0xc0(%rbp), %r14
movl %eax, %r15d
leal 0x1(%r15), %eax
movslq %eax, %rdx
movl $0x1, %ecx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2360
cmpl $-0x1, %eax
jne 0x6de1
jmp 0x6e08
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
leaq 0x4257(%rip), %rsi      # 0xb066
leaq -0xc0(%rbp), %rbx
movl $0x1, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2360
leal 0x1(%r15), %ecx
movslq %ecx, %rdx
notl %r15d
addl %eax, %r15d
movslq %r15d, %rcx
leaq -0x2c0(%rbp), %rdi
movq %rbx, %rsi
callq 0x2200
leaq -0xc0(%rbp), %rdi
leaq -0x2c0(%rbp), %rbx
movq %rbx, %rsi
callq 0x2270
movq (%rbx), %rdi
leaq -0x2b0(%rbp), %rax
cmpq %rax, %rdi
movq -0x48(%rbp), %r14
je 0x6e72
callq 0x21c0
leaq 0x41ef(%rip), %rsi      # 0xb068
leaq -0x70(%rbp), %rdi
leaq -0xc0(%rbp), %rdx
callq 0x8f56
leaq 0x41ec(%rip), %rsi      # 0xb07c
leaq -0x70(%rbp), %rdi
callq 0x23a0
leaq -0x90(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x6ec6
movq %rdx, -0xa0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x90(%rbp)
jmp 0x6ecc
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
leaq -0xa0(%rbp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x2c0(%rbp), %rdi
movl $0x10, %edx
callq 0x23b0
movq -0xa0(%rbp), %rdi
cmpq %rbx, %rdi
je 0x6f0c
callq 0x21c0
leaq -0x60(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6f1e
callq 0x21c0
leaq 0x415c(%rip), %rsi      # 0xb081
leaq -0x2c0(%rbp), %rdi
movl $0x1d, %edx
callq 0x2230
movq 0x8(%r14), %rsi
subq (%r14), %rsi
sarq $0x3, %rsi
leaq -0x2c0(%rbp), %r13
movq %r13, %rdi
callq 0x2140
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x8(%r14), %rax
cmpq (%r14), %rax
je 0x7345
movq $0x0, -0x38(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x40(%rbp)
movl $0x17, %edx
movq %r13, %rdi
leaq 0x40f1(%rip), %rsi      # 0xb09f
callq 0x2230
movq -0x48(%rbp), %r14
movq (%r14), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %esi
movq %r13, %rdi
callq 0x2350
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movl $0x1c, %edx
movq %r13, %rdi
leaq 0x40b2(%rip), %rsi      # 0xb0b7
callq 0x2230
movq (%r14), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x48(%rax), %esi
movq %r13, %rdi
callq 0x2350
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movl $0x14, %edx
movq %r13, %rdi
leaq 0x407b(%rip), %rsi      # 0xb0d4
callq 0x2230
movq (%r14), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movl $0xc0, %eax
addq %rax, %rsi
leaq -0xa0(%rbp), %rdi
movq -0x40(%rbp), %r15
callq 0x905a
movq -0x88(%rbp), %rbx
leaq -0x98(%rbp), %rax
cmpq %rax, %rbx
je 0x70c5
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq %r13, %rdi
callq 0x2230
movl $0x1, %edx
movq %rax, %rdi
leaq 0x4002(%rip), %rsi      # 0xb0b5
callq 0x2230
movq %rbx, %rdi
callq 0x2240
movq %rax, %rbx
jmp 0x7088
movl $0x1a, %edx
movq %r15, %r14
movq -0x30(%rbp), %rax
movq %rax, %r12
movq %r13, %rdi
movq %rax, %r13
leaq 0x4008(%rip), %rsi      # 0xb0e9
callq 0x2230
movq -0x78(%rbp), %rsi
movq %r14, %r15
movq %r13, %r12
leaq -0x2c0(%rbp), %rdi
callq 0x2140
movq %rax, %rbx
movl $0x1, %edx
movq %r14, %r15
movq %r13, %r12
movq %rax, %rdi
leaq 0x4019(%rip), %rsi      # 0xb12d
callq 0x2230
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movq %r14, %r15
movq %r13, %r12
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %r14, %r15
movq %r13, %r12
movq %rbx, %rdi
callq 0x2030
movq %r14, %r15
movq %r13, %r12
movq %rax, %rdi
callq 0x2150
movq -0x48(%rbp), %rbx
movq (%rbx), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
addq $0x60, %rsi
leaq -0x70(%rbp), %rdi
callq 0x8ecc
movq -0x70(%rbp), %r12
movq -0x68(%rbp), %r13
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x71a1
callq 0x21c0
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x71a1
callq 0x21c0
movq (%rbx), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
addq $0x78, %rsi
leaq -0x70(%rbp), %rdi
callq 0x8ecc
movq -0x70(%rbp), %r15
movq -0x68(%rbp), %rbx
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x71ec
callq 0x21c0
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x71ec
callq 0x21c0
movl $0x13, %edx
leaq -0x2c0(%rbp), %rdi
leaq 0x3f05(%rip), %rsi      # 0xb104
callq 0x2230
subq %r12, %r13
je 0x7246
sarq $0x3, %r13
cmpq $0x1, %r13
adcq $0x0, %r13
xorl %r14d, %r14d
movq (%r12,%r14,8), %rax
movl (%rax), %esi
leaq -0x2c0(%rbp), %rdi
callq 0x2350
movl $0x1, %edx
movq %rax, %rdi
leaq 0x3e7c(%rip), %rsi      # 0xb0b5
callq 0x2230
incq %r14
cmpq %r14, %r13
jne 0x7218
movl $0x13, %edx
leaq -0x2c0(%rbp), %rdi
leaq 0x3ebf(%rip), %rsi      # 0xb118
callq 0x2230
subq %r15, %rbx
leaq -0x2c0(%rbp), %r13
je 0x72a3
sarq $0x3, %rbx
cmpq $0x1, %rbx
adcq $0x0, %rbx
xorl %r14d, %r14d
movq (%r15,%r14,8), %rax
movl (%rax), %esi
movq %r13, %rdi
callq 0x2350
movl $0x1, %edx
movq %rax, %rdi
leaq 0x3e1f(%rip), %rsi      # 0xb0b5
callq 0x2230
incq %r14
cmpq %r14, %rbx
jne 0x7279
movl $0x2, %edx
movq %r13, %rdi
leaq 0x3e7a(%rip), %rsi      # 0xb12c
callq 0x2230
movq -0x2c0(%rbp), %rax
movq -0x18(%rax), %rdi
leaq -0x2c0(%rbp), %rax
addq %rax, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
leaq -0x2c0(%rbp), %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
leaq -0xa0(%rbp), %rdi
callq 0x8ff0
movq -0x38(%rbp), %rdx
incq %rdx
movq -0x48(%rbp), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
sarq $0x3, %rax
movq %r12, -0x30(%rbp)
movq %r15, -0x40(%rbp)
movq %rdx, -0x38(%rbp)
cmpq %rdx, %rax
leaq -0x2c0(%rbp), %r13
ja 0x6f9f
testq %r15, %r15
je 0x7338
movq %r15, %rdi
callq 0x21c0
testq %r12, %r12
je 0x7345
movq %r12, %rdi
callq 0x21c0
movq 0x7c8c(%rip), %rax      # 0xefd8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x2b8(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x2c0(%rbp,%rcx)
callq 0x2190
leaq -0x1c8(%rbp), %rdi
callq 0x20c0
leaq -0xb0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7390
callq 0x21c0
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0xa0(%rbp), %rdi
cmpq %rbx, %rdi
je 0x73bb
callq 0x21c0
jmp 0x73bb
movq %rax, %r14
leaq -0x60(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7447
callq 0x21c0
jmp 0x7447
jmp 0x73d1
movq %rax, %r14
jmp 0x7447
movq %rax, %r14
jmp 0x743b
movq %rax, %r14
jmp 0x73e7
movq %rax, %r14
movq %r12, -0x30(%rbp)
movq -0x40(%rbp), %r15
jmp 0x740b
movq %rax, %r14
jmp 0x7417
movq %rax, %r14
movq -0x40(%rbp), %r15
jmp 0x7417
jmp 0x73ff
jmp 0x73ff
movq %rax, %r14
movq %r12, -0x30(%rbp)
jmp 0x740b
movq %rax, %r14
leaq -0xa0(%rbp), %rdi
callq 0x8ff0
movq -0x30(%rbp), %rax
testq %r15, %r15
je 0x742e
movq %r15, %rdi
movq %rax, %rbx
callq 0x21c0
movq %rbx, %rax
testq %rax, %rax
je 0x743b
movq %rax, %rdi
callq 0x21c0
leaq -0x2c0(%rbp), %rdi
callq 0x22e0
leaq -0xb0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x745c
callq 0x21c0
movq %r14, %rdi
callq 0x2370