// File: /workspace/github_cpp_makefile_star2_O2/kelwinfc[P]ci4721-Fernandez-Gyomrey/src/AST/to_tac.cpp
// Function: AST_return::to_tac(Tac*)
void AST_return::to_tac(Tac* t){
    opd* r = 0;
    if ( expr ){
        r = expr->to_tac(t);
        if (BOOLEAN == expr->type) {
            r = new opd();
            t->backpatch( expr->truelist, t->next_instruction() );
            t->append_quad(inst::CP, r, new opd(true), 0, "returno del valor booleano obtenido (true)");

            t->append_quad(inst::GOTO, 0, 0, new opd(t->next_instruction() + 2, O_LABEL), "salto después de asignar el valor booleano");

            t->backpatch( expr->falselist, t->next_instruction() );
            t->append_quad(inst::CP, r, new opd(false), 0, "returno de valor booleano obtenido (false)");
        }
    }
    
    return_list.push_back(t->next_instruction());
    t->append_quad(inst::RETURN, r, 0, 0, "retorno de funcion");
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %rbx
movq %rdi, %r15
movq 0x78(%rdi), %rdi
testq %rdi, %rdi
je 0xfc7f
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x18(%rax)
movq %rax, %r14
movq 0x78(%r15), %rax
cmpl $0x6, 0x10(%rax)
jne 0xfc82
pushq $0x18
popq %rdi
callq 0x62d0
movq %rax, %r14
movq %rax, %rdi
callq 0x18148
movq 0x78(%r15), %r12
addq $0x18, %r12
movq %rbx, %rdi
callq 0x2138a
movq %rbx, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x21394
pushq $0x18
popq %rdi
callq 0x62d0
movq %rax, %r12
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x1837e
leaq 0x151a4(%rip), %rsi     # 0x24d2c
leaq 0x68(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0x6d6c
leaq 0x68(%rsp), %r9
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0x212de
leaq 0x68(%rsp), %rdi
callq 0x65c8
pushq $0x18
popq %rdi
callq 0x62d0
movq %rax, %r12
movq %rbx, %rdi
callq 0x2138a
addl $0x2, %eax
pushq $0x6
popq %rdx
movq %r12, %rdi
movl %eax, %esi
callq 0x1815e
leaq 0x1442e(%rip), %rsi     # 0x24011
leaq 0x48(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0x6d6c
pushq $0x16
popq %rsi
leaq 0x48(%rsp), %r9
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r12, %r8
callq 0x212de
leaq 0x48(%rsp), %rdi
callq 0x65c8
movq 0x78(%r15), %r12
addq $0x30, %r12
movq %rbx, %rdi
callq 0x2138a
movq %rbx, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x21394
pushq $0x18
popq %rdi
callq 0x62d0
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
callq 0x1837e
leaq 0x1510b(%rip), %rsi     # 0x24d57
leaq 0x28(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0x6d6c
leaq 0x28(%rsp), %r9
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0x212de
leaq 0x28(%rsp), %rdi
callq 0x65c8
jmp 0xfc82
xorl %r14d, %r14d
addq $0x60, %r15
movq %rbx, %rdi
callq 0x2138a
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
movq %r15, %rdi
callq 0x1243c
leaq 0x150de(%rip), %rsi     # 0x24d82
leaq 0x8(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0x6d6c
pushq $0x10
popq %rsi
leaq 0x8(%rsp), %r9
movq %rbx, %rdi
movq %r14, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x212de
leaq 0x8(%rsp), %rdi
callq 0x65c8
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0xfd2f
jmp 0xfd36
jmp 0xfd17
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0xfd2f
jmp 0xfd36
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
jmp 0xfd2f
jmp 0xfd36
jmp 0xfd17
movq %rax, %rbx
pushq $0x18
popq %rsi
movq %r14, %rdi
jmp 0xfd20
movq %rax, %rbx
pushq $0x18
popq %rsi
movq %r12, %rdi
callq 0x62e0
jmp 0xfd39
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x65c8
jmp 0xfd39
movq %rax, %rbx
movq %rbx, %rdi
callq 0x6530
nop