// File: /workspace/github_cpp_makefile_star2_O3/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 0x1318f
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x18(%rax)
movq %rax, %r14
movq 0x78(%r15), %rax
cmpl $0x6, 0x10(%rax)
jne 0x13192
movl $0x18, %edi
callq 0x62f0
movq %rax, %r14
movq %rax, %rdi
callq 0x1d014
movq 0x78(%r15), %r12
addq $0x18, %r12
movq %rbx, %rdi
callq 0x2b316
movq %rbx, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x2b320
movl $0x18, %edi
callq 0x62f0
movq %rax, %r12
movq %rax, %rdi
movl $0x1, %esi
callq 0x1d3f2
leaq 0x78(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1bcde(%rip), %rsi     # 0x2ed2c
leaq 0x1bd01(%rip), %rdx     # 0x2ed56
leaq 0x68(%rsp), %r13
movq %r13, %rdi
callq 0x7008
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x2b238
movq 0x68(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1308f
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x6300
movl $0x18, %edi
callq 0x62f0
movq %rax, %r12
movq %rbx, %rdi
callq 0x2b316
addl $0x2, %eax
movq %r12, %rdi
movl %eax, %esi
movl $0x6, %edx
callq 0x1d02a
leaq 0x58(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1af4b(%rip), %rsi     # 0x2e011
leaq 0x1af6f(%rip), %rdx     # 0x2e03c
leaq 0x48(%rsp), %r13
movq %r13, %rdi
callq 0x7008
movq %rbx, %rdi
movl $0x16, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r12, %r8
movq %r13, %r9
callq 0x2b238
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x13108
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x6300
movq 0x78(%r15), %r12
addq $0x30, %r12
movq %rbx, %rdi
callq 0x2b316
movq %rbx, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x2b320
movl $0x18, %edi
callq 0x62f0
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
callq 0x1d3f2
leaq 0x38(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1bc0b(%rip), %rsi     # 0x2ed57
leaq 0x1bc2e(%rip), %rdx     # 0x2ed81
leaq 0x28(%rsp), %r13
movq %r13, %rdi
callq 0x7008
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x2b238
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x13192
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6300
jmp 0x13192
xorl %r14d, %r14d
leaq 0x60(%r15), %r12
movq %rbx, %rdi
callq 0x2b316
movl %eax, %ebp
movl $0x18, %edi
callq 0x62f0
movl %ebp, 0x10(%rax)
movq %rax, %rdi
movq %r12, %rsi
callq 0x6080
incq 0x70(%r15)
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1bbb5(%rip), %rsi     # 0x2ed82
leaq 0x1bbc0(%rip), %rdx     # 0x2ed94
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x7008
movq %rbx, %rdi
movl $0x10, %esi
movq %r14, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x2b238
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x13210
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6300
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 0x13296
movq 0x38(%rsp), %rsi
jmp 0x1328e
jmp 0x1326f
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x13296
movq 0x58(%rsp), %rsi
jmp 0x1328e
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %rbp, %rdi
je 0x13296
movq 0x78(%rsp), %rsi
jmp 0x1328e
jmp 0x1326f
movq %rax, %rbx
movl $0x18, %esi
movq %r14, %rdi
jmp 0x13291
movq %rax, %rbx
movl $0x18, %esi
movq %r12, %rdi
jmp 0x13291
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x13296
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6300
movq %rbx, %rdi
callq 0x6560