// File: /workspace/github_cpp_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %rbx
movq %rdi, %r15
movq 0x78(%rdi), %rdi
testq %rdi, %rdi
je 0x1313f
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x18(%rax)
movq %rax, %r14
movq 0x78(%r15), %rax
cmpl $0x6, 0x10(%rax)
jne 0x13142
movl $0x18, %edi
callq 0x62e0
movq %rax, %r14
movq %rax, %rdi
callq 0x1cfb4
movq 0x78(%r15), %r12
addq $0x18, %r12
movq %rbx, %rdi
callq 0x2af04
movq %rbx, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x2af0e
movl $0x18, %edi
callq 0x62e0
movq %rax, %r12
movq %rax, %rdi
movl $0x1, %esi
callq 0x1d36e
leaq 0x78(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1ad2e(%rip), %rsi     # 0x2dd2c
leaq 0x1ad51(%rip), %rdx     # 0x2dd56
leaq 0x68(%rsp), %r13
movq %r13, %rdi
callq 0x6fec
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x2ae24
movq 0x68(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1303f
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x62f0
movl $0x18, %edi
callq 0x62e0
movq %rax, %r12
movq %rbx, %rdi
callq 0x2af04
addl $0x2, %eax
movq %r12, %rdi
movl %eax, %esi
movl $0x6, %edx
callq 0x1cfca
leaq 0x58(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x19f9b(%rip), %rsi     # 0x2d011
leaq 0x19fbf(%rip), %rdx     # 0x2d03c
leaq 0x48(%rsp), %r13
movq %r13, %rdi
callq 0x6fec
movq %rbx, %rdi
movl $0x16, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r12, %r8
movq %r13, %r9
callq 0x2ae24
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x130b8
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x62f0
movq 0x78(%r15), %r12
addq $0x30, %r12
movq %rbx, %rdi
callq 0x2af04
movq %rbx, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x2af0e
movl $0x18, %edi
callq 0x62e0
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
callq 0x1d36e
leaq 0x38(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1ac5b(%rip), %rsi     # 0x2dd57
leaq 0x1ac7e(%rip), %rdx     # 0x2dd81
leaq 0x28(%rsp), %r13
movq %r13, %rdi
callq 0x6fec
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x2ae24
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x13142
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x62f0
jmp 0x13142
xorl %r14d, %r14d
leaq 0x60(%r15), %r12
movq %rbx, %rdi
callq 0x2af04
movl %eax, %ebp
movl $0x18, %edi
callq 0x62e0
movl %ebp, 0x10(%rax)
movq %rax, %rdi
movq %r12, %rsi
callq 0x6080
incq 0x70(%r15)
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1ac05(%rip), %rsi     # 0x2dd82
leaq 0x1ac10(%rip), %rdx     # 0x2dd94
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x6fec
movq %rbx, %rdi
movl $0x10, %esi
movq %r14, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x2ae24
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x131c0
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x62f0
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x13246
movq 0x38(%rsp), %rsi
jmp 0x1323e
jmp 0x1321f
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x13246
movq 0x58(%rsp), %rsi
jmp 0x1323e
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %rbp, %rdi
je 0x13246
movq 0x78(%rsp), %rsi
jmp 0x1323e
jmp 0x1321f
movq %rax, %rbx
movl $0x18, %esi
movq %r14, %rdi
jmp 0x13241
movq %rax, %rbx
movl $0x18, %esi
movq %r12, %rdi
jmp 0x13241
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x13246
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x62f0
movq %rbx, %rdi
callq 0x6550