// File: /workspace/github_cpp_makefile_star2_O3/kelwinfc[P]ci4721-Fernandez-Gyomrey/src/block.cpp
// Function: dump_blocks_definition(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void dump_blocks_definition(string filename){
    ofstream fout;
    
    fout.open((filename+".blocks").c_str());
    
    for (uint index = 0 ; index != list_of_blocks.size(); index++)
    {
        // Bloque basico
        fout << " B" << list_of_blocks[index]->index << ":\n";
        
        fout << "+--------------------------\n";
        
        // Lista de instrucciones
        list<inst*>::iterator it = 
            list_of_blocks[index]->instructions.linst->begin();
        for ( ; it != list_of_blocks[index]->instructions.linst->end(); ++it ){
            inst* current_inst = *it;
            fout << "| " << current_inst->to_string(false) << endl;
        }
        fout << "|\n";
        
        // Salida obligatoria
        if ( list_of_blocks[index]->mandatory_exit ){
            fout << "| --> B" << list_of_blocks[index]->mandatory_exit->index;
        } else {
            fout << "| --> ";
        }
        fout << endl;
        
        // Salidas opcionales
        if ( list_of_blocks[index]->sucessors.size() != 0 ){
            vector<Block*>::iterator it =
            list_of_blocks[index]->sucessors.begin();
            fout << "| -->";
            for ( ; it != list_of_blocks[index]->sucessors.end(); ++it ){
                fout << " B" << (*it)->index;
            }
            fout << endl;
        }
        
        fout << "+--------------------------\n\n";
    }
    
    fout.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rdi, %rbx
leaq 0x28(%rsp), %rdi
callq 0x6520
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x16c68
leaq 0x16df8(%rip), %rsi     # 0x32c2d
leaq 0x8(%rsp), %rdi
callq 0x65b0
movq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
movl $0x10, %edx
callq 0x6070
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1be72
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6300
leaq 0x2353f(%rip), %r14     # 0x3f3b8
movq 0x8(%r14), %rax
cmpq (%r14), %rax
je 0x1c0bf
xorl %ebp, %ebp
leaq 0x134c6(%rip), %r13     # 0x2f355
leaq 0x8(%rsp), %r12
movl $0x2, %edx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x6370
movq (%r14), %rax
movq (%rax,%rbp,8), %rax
movl (%rax), %esi
movq %rbx, %rdi
callq 0x6540
movl $0x2, %edx
movq %rax, %rdi
leaq 0x13466(%rip), %rsi     # 0x2f32a
callq 0x6370
movl $0x1c, %edx
movq %rbx, %rdi
leaq 0x13455(%rip), %rsi     # 0x2f32d
callq 0x6370
movq (%r14), %rax
movq (%rax,%rbp,8), %rax
movq 0x8(%rax), %rax
movq (%rax), %r15
cmpq %rax, %r15
je 0x1bf86
movq 0x10(%r15), %r13
movl $0x2, %edx
movq %rbx, %rdi
leaq 0x13443(%rip), %rsi     # 0x2f34a
callq 0x6370
movq (%r13), %rax
movq %r12, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq *(%rax)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x6370
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x62c0
movsbl %al, %esi
movq %r13, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6200
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1bf72
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6300
movq (%r15), %r15
movq (%r14), %rax
movq (%rax,%rbp,8), %rax
cmpq 0x8(%rax), %r15
jne 0x1bef4
movl $0x2, %edx
movq %rbx, %rdi
leaq 0x133b8(%rip), %rsi     # 0x2f34d
callq 0x6370
leaq 0x133b4(%rip), %r13     # 0x2f355
movq (%r14), %rax
movq (%rax,%rbp,8), %rax
cmpq $0x0, 0x10(%rax)
je 0x1bfda
movl $0x7, %edx
movq %rbx, %rdi
leaq 0x13392(%rip), %rsi     # 0x2f350
callq 0x6370
movq (%r14), %rax
movq (%rax,%rbp,8), %rax
movq 0x10(%rax), %rax
movl (%rax), %esi
movq %rbx, %rdi
callq 0x6540
jmp 0x1bfee
movl $0x6, %edx
movq %rbx, %rdi
leaq 0x1336f(%rip), %rsi     # 0x2f358
callq 0x6370
movq 0x28(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x62c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6200
movq (%r14), %rax
movq (%rax,%rbp,8), %rax
movq 0x18(%rax), %r15
cmpq %r15, 0x20(%rax)
je 0x1c095
movl $0x5, %edx
movq %rbx, %rdi
leaq 0x13328(%rip), %rsi     # 0x2f35f
callq 0x6370
movq (%r14), %rax
movq (%rax,%rbp,8), %rax
cmpq 0x20(%rax), %r15
je 0x1c06c
movl $0x2, %edx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x6370
movq (%r15), %rax
movl (%rax), %esi
movq %rbx, %rdi
callq 0x6540
addq $0x8, %r15
jmp 0x1c03c
movq 0x28(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x62c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6200
movl $0x1d, %edx
movq %rbx, %rdi
leaq 0x132c1(%rip), %rsi     # 0x2f365
callq 0x6370
incl %ebp
movq 0x8(%r14), %rax
subq (%r14), %rax
sarq $0x3, %rax
cmpq %rbp, %rax
jne 0x1be94
leaq 0x28(%rsp), %rdi
callq 0x6420
movq 0x22ee0(%rip), %rax     # 0x3efb0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x30(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x28(%rsp,%rcx)
callq 0x6280
leaq 0x120(%rsp), %rdi
callq 0x6100
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1c11f
jmp 0x1c124
jmp 0x1c124
jmp 0x1c11f
jmp 0x1c11f
jmp 0x1c11f
jmp 0x1c11f
jmp 0x1c11f
jmp 0x1c11f
movq %rax, %rbx
jmp 0x1c143
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1c143
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6300
leaq 0x28(%rsp), %rdi
callq 0x65d8
movq %rbx, %rdi
callq 0x6560