// File: /workspace/github_cpp_makefile_star2_O3/kelwinfc[P]ci4721-Fernandez-Gyomrey/src/Tac.cpp
// Function: Tac::to_spim()
Spim* Tac::to_spim()
{
    Spim* spim = new Spim(this);
    
    vector<Block*>::iterator itb = list_of_blocks.begin();
    bool in = false, out = false;
    for( ; itb != list_of_blocks.end(); ++itb){
        list<inst*>::iterator iti = (*itb)->instructions.linst->begin();
        for( ; iti != (*itb)->instructions.linst->end(); ++iti){
            const inst i = **iti;
            in = !out && (in || (i.op == inst::PROLOGUE && !i.arg2->data.sym->getName().compare("main")));
            if (in) {
                switch (i.op) {
                case inst::WRITE:
                    //spim->append_inst(Spim_Inst::LI);
                    //spim->append_inst(Spim_Inst::LI);
                default:
                    break;
                }
                //spim->append_inst(*iti);
            }
            out = out || (i.op == inst::EPILOGUE && !i.arg2->data.sym->getName().compare("main"));
            if (out && in) {
                // ep�logo main
                //spim->append_inst(Spim_Inst::LI, new opd(10));
                //spim->append_inst(Spim_Inst::LI);
            }
        }
    }
    return spim;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %r14
movl $0x28, %edi
callq 0x62f0
movq %rax, 0x8(%rsp)
movq %rax, %rdi
movq %r14, %rsi
callq 0x2b5ac
leaq 0x13fd2(%rip), %rax     # 0x3f3b8
movq (%rax), %rbx
movq 0x8(%rax), %rax
cmpq %rax, %rbx
je 0x2b55b
leaq 0x18(%rsp), %r12
xorl %r13d, %r13d
leaq 0x13903(%rip), %rbp     # 0x3ed08
addq $0x10, %rbp
xorl %r14d, %r14d
movq (%rbx), %rcx
movq 0x8(%rcx), %rcx
movq (%rcx), %r15
cmpq %rcx, %r15
je 0x2b54e
movq 0x10(%r15), %rax
movq %rbp, 0x10(%rsp)
movups 0x8(%rax), %xmm0
movups 0x18(%rax), %xmm1
movups %xmm1, 0x10(%r12)
movups %xmm0, (%r12)
leaq 0x48(%rsp), %rcx
movq %rcx, 0x38(%rsp)
movq 0x28(%rax), %rsi
movq 0x30(%rax), %rdx
addq %rsi, %rdx
leaq 0x38(%rsp), %rdi
callq 0x16c68
testb $0x1, %r13b
je 0x2b46b
movb $0x1, %r13b
xorl %r14d, %r14d
jmp 0x2b512
movl 0x1c(%rsp), %eax
cmpl $0xe, %eax
setne %cl
orb %r14b, %cl
testb $0x1, %cl
leaq 0x58(%rsp), %r13
jne 0x2b4c7
movq 0x30(%rsp), %rax
movq (%rax), %rsi
movq %r13, %rdi
callq 0x17ff4
movq %r13, %rdi
leaq 0x26dd(%rip), %rsi      # 0x2db79
callq 0x60d0
testl %eax, %eax
sete %r14b
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x2b4c3
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x6300
movl 0x1c(%rsp), %eax
cmpl $0xf, %eax
jne 0x2b50f
movq 0x30(%rsp), %rax
movq (%rax), %rsi
movq %r13, %rdi
callq 0x17ff4
movq %r13, %rdi
leaq 0x2693(%rip), %rsi      # 0x2db79
callq 0x60d0
testl %eax, %eax
sete %r13b
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x2b512
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x6300
jmp 0x2b512
xorl %r13d, %r13d
movq %rbp, 0x10(%rsp)
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x2b533
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x6300
movq (%r15), %r15
movq (%rbx), %rax
cmpq 0x8(%rax), %r15
jne 0x2b41f
leaq 0x13e6e(%rip), %rax     # 0x3f3b8
movq 0x8(%rax), %rax
addq $0x8, %rbx
cmpq %rax, %rbx
jne 0x2b40c
movq 0x8(%rsp), %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movl $0x28, %esi
movq 0x8(%rsp), %rdi
jmp 0x2b59f
jmp 0x2b580
movq %rax, %r14
movq %rbp, 0x10(%rsp)
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x2b5a4
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x6300
movq %r14, %rdi
callq 0x6560