// File: /workspace/github_cpp_makefile_star2_O1/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 $0x98, %rsp
movq %rdi, %r14
movl $0x28, %edi
callq 0x62e0
movq %rax, 0x8(%rsp)
movq %rax, %rdi
movq %r14, %rsi
callq 0x2b1c8
leaq 0x133d9(%rip), %rax     # 0x3e3b0
movq (%rax), %r13
cmpq 0x8(%rax), %r13
je 0x2b174
xorl %r15d, %r15d
leaq 0x12d1a(%rip), %rbx     # 0x3dd08
addq $0x10, %rbx
xorl %ebp, %ebp
movq (%r13), %rax
movq 0x8(%rax), %rax
movq (%rax), %r14
cmpq %rax, %r14
je 0x2b159
movq 0x10(%r14), %rax
movq %rbx, 0x10(%rsp)
movups 0x8(%rax), %xmm0
movups 0x18(%rax), %xmm1
leaq 0x18(%rsp), %rcx
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
leaq 0x48(%rsp), %rcx
movq %rcx, 0x38(%rsp)
movq 0x28(%rax), %rsi
movq 0x30(%rax), %rdx
addq %rsi, %rdx
leaq 0x38(%rsp), %rdi
callq 0x16c42
xorl %eax, %eax
movl $0x0, %r12d
testb $0x1, %r15b
jne 0x2b094
testb $0x1, %bpl
je 0x2b05f
movb $0x1, %r12b
xorl %eax, %eax
jmp 0x2b094
xorl %eax, %eax
cmpl $0xe, 0x1c(%rsp)
jne 0x2b094
movq 0x30(%rsp), %rax
movq (%rax), %rsi
leaq 0x78(%rsp), %r12
movq %r12, %rdi
callq 0x17fb8
movq %r12, %rdi
leaq 0x1af2(%rip), %rsi      # 0x2cb79
callq 0x60d0
testl %eax, %eax
sete %r12b
movb $0x1, %al
testb %al, %al
je 0x2b0ba
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x2b0ba
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x62f0
testb $0x1, %r15b
je 0x2b0c7
movb $0x1, %r15b
xorl %eax, %eax
jmp 0x2b102
xorl %eax, %eax
cmpl $0xf, 0x1c(%rsp)
movl $0x0, %r15d
jne 0x2b102
movq 0x30(%rsp), %rax
movq (%rax), %rsi
leaq 0x58(%rsp), %r15
movq %r15, %rdi
callq 0x17fb8
movq %r15, %rdi
leaq 0x1a84(%rip), %rsi      # 0x2cb79
callq 0x60d0
testl %eax, %eax
sete %r15b
movb $0x1, %al
testb %al, %al
je 0x2b122
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x2b122
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x62f0
movq %rbx, 0x10(%rsp)
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x2b143
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x62f0
movq (%r14), %r14
movq (%r13), %rax
movl %r12d, %ebp
cmpq 0x8(%rax), %r14
jne 0x2b008
jmp 0x2b15c
movl %ebp, %r12d
addq $0x8, %r13
movl %r12d, %ebp
leaq 0x13246(%rip), %rax     # 0x3e3b0
cmpq 0x8(%rax), %r13
jne 0x2aff4
movq 0x8(%rsp), %rax
addq $0x98, %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 0x2b1bb
jmp 0x2b19c
movq %rax, %r14
movq %rbx, 0x10(%rsp)
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x2b1c0
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x62f0
movq %r14, %rdi
callq 0x6550