// File: kelwinfc[P]ci4721-Fernandez-Gyomrey/src/AST/to_tac.cpp
// Function: AST_print::to_tac(Tac*)
void AST_print::to_tac(Tac* t){
    for (vector<AST_expression*>::iterator it = list.begin(); it != list.end(); ++ it) {
        if ( (*it)->type == BOOLEAN){
            (*it)->to_tac(t);
            t->backpatch( (*it)->truelist, t->next_instruction() );
            t->backpatch( (*it)->falselist, t->next_instruction() + 2 );
            t->append_quad(inst::WRITE, new opd(true), 0, 0, "imprimir bool true a salida estándar");
            t->append_quad(inst::GOTO, 0, 0, new opd(t->next_instruction() + 2, O_LABEL), "impreso bool true a salida estándar");
            t->append_quad(inst::WRITE, new opd(false), 0, 0, "imprimir bool false a salida estándar");
        } else {
            t->append_quad(inst::WRITE, (*it)->to_tac(t), 0, 0, "imprimir a salida estándar");
        }
    }
}

// Assembly:
subq $0x168, %rsp            # imm = 0x168
movq %rdi, 0x160(%rsp)
movq %rsi, 0x158(%rsp)
movq 0x160(%rsp), %rdi
movq %rdi, 0x90(%rsp)
addq $0x78, %rdi
callq 0x20070
movq %rax, 0x150(%rsp)
movq 0x90(%rsp), %rdi
addq $0x78, %rdi
callq 0x200e0
movq %rax, 0x148(%rsp)
leaq 0x150(%rsp), %rdi
leaq 0x148(%rsp), %rsi
callq 0x200a0
testb $0x1, %al
jne 0x1cd0f
jmp 0x1d21b
leaq 0x150(%rsp), %rdi
callq 0x20110
movq (%rax), %rax
cmpl $0x6, 0x10(%rax)
jne 0x1d121
leaq 0x150(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0x20110
movq (%rax), %rdi
movq 0x158(%rsp), %rsi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movq 0x68(%rsp), %rdi
movq 0x158(%rsp), %rax
movq %rax, 0x58(%rsp)
callq 0x20110
movq (%rax), %rax
addq $0x18, %rax
movq %rax, 0x60(%rsp)
movq 0x158(%rsp), %rdi
callq 0x4dfb0
movq 0x58(%rsp), %rdi
movq 0x60(%rsp), %rsi
movl %eax, %edx
callq 0x4dfc0
movq 0x68(%rsp), %rdi
movq 0x158(%rsp), %rax
movq %rax, 0x70(%rsp)
callq 0x20110
movq (%rax), %rax
addq $0x30, %rax
movq %rax, 0x78(%rsp)
movq 0x158(%rsp), %rdi
callq 0x4dfb0
movq 0x70(%rsp), %rdi
movq 0x78(%rsp), %rsi
movl %eax, %edx
addl $0x2, %edx
callq 0x4dfc0
movq 0x158(%rsp), %rax
movq %rax, 0x80(%rsp)
movl $0x18, %edi
callq 0x6390
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x88(%rsp)
movl $0x1, %esi
callq 0x38470
jmp 0x1ce08
leaq 0x117(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x66c0
movq 0x50(%rsp), %rdx
leaq 0x371b8(%rip), %rsi     # 0x53fde
leaq 0x118(%rsp), %rdi
callq 0x7500
jmp 0x1ce35
movq 0x88(%rsp), %rdx
movq 0x80(%rsp), %rdi
xorl %eax, %eax
movl %eax, %r8d
movl $0xa, %esi
leaq 0x118(%rsp), %r9
movq %r8, %rcx
callq 0x4de80
jmp 0x1ce61
leaq 0x118(%rsp), %rdi
callq 0x6778
leaq 0x117(%rsp), %rdi
callq 0x6400
movq 0x158(%rsp), %rax
movq %rax, 0x38(%rsp)
movl $0x18, %edi
callq 0x6390
movq %rax, 0x40(%rsp)
movq 0x158(%rsp), %rdi
callq 0x4dfb0
movl %eax, 0x4c(%rsp)
jmp 0x1ceaa
movq 0x40(%rsp), %rdi
movl 0x4c(%rsp), %esi
addl $0x2, %esi
movl $0x6, %edx
callq 0x38010
jmp 0x1cec2
leaq 0xef(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x66c0
movq 0x30(%rsp), %rdx
leaq 0x37124(%rip), %rsi     # 0x54004
leaq 0xf0(%rsp), %rdi
callq 0x7500
jmp 0x1ceef
movq 0x40(%rsp), %r8
movq 0x38(%rsp), %rdi
xorl %eax, %eax
movl %eax, %ecx
movl $0x16, %esi
leaq 0xf0(%rsp), %r9
movq %rcx, %rdx
callq 0x4de80
jmp 0x1cf14
leaq 0xf0(%rsp), %rdi
callq 0x6778
leaq 0xef(%rsp), %rdi
callq 0x6400
movq 0x158(%rsp), %rax
movq %rax, 0x20(%rsp)
movl $0x18, %edi
callq 0x6390
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x28(%rsp)
xorl %esi, %esi
callq 0x38470
jmp 0x1cf59
leaq 0xc7(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x66c0
movq 0x18(%rsp), %rdx
leaq 0x370b2(%rip), %rsi     # 0x54029
leaq 0xc8(%rsp), %rdi
callq 0x7500
jmp 0x1cf86
movq 0x28(%rsp), %rdx
movq 0x20(%rsp), %rdi
xorl %eax, %eax
movl %eax, %r8d
movl $0xa, %esi
leaq 0xc8(%rsp), %r9
movq %r8, %rcx
callq 0x4de80
jmp 0x1cfac
leaq 0xc8(%rsp), %rdi
callq 0x6778
leaq 0xc7(%rsp), %rdi
callq 0x6400
jmp 0x1d207
movq 0x88(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
movl $0x18, %esi
callq 0x63a0
jmp 0x1d223
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0x1d02d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x6778
leaq 0x117(%rsp), %rdi
callq 0x6400
jmp 0x1d223
movq 0x40(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
movl $0x18, %esi
callq 0x63a0
jmp 0x1d223
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0x1d09e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x6778
leaq 0xef(%rsp), %rdi
callq 0x6400
jmp 0x1d223
movq 0x28(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
movl $0x18, %esi
callq 0x63a0
jmp 0x1d223
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0x1d10f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x6778
leaq 0xc7(%rsp), %rdi
callq 0x6400
jmp 0x1d223
movq 0x158(%rsp), %rax
movq %rax, (%rsp)
leaq 0x150(%rsp), %rdi
callq 0x20110
movq (%rax), %rdi
movq 0x158(%rsp), %rsi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movq %rax, 0x8(%rsp)
leaq 0x9f(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x66c0
movq 0x10(%rsp), %rdx
leaq 0x36edf(%rip), %rsi     # 0x54050
leaq 0xa0(%rsp), %rdi
callq 0x7500
jmp 0x1d180
movq 0x8(%rsp), %rdx
movq (%rsp), %rdi
xorl %eax, %eax
movl %eax, %r8d
movl $0xa, %esi
leaq 0xa0(%rsp), %r9
movq %r8, %rcx
callq 0x4de80
jmp 0x1d1a5
leaq 0xa0(%rsp), %rdi
callq 0x6778
leaq 0x9f(%rsp), %rdi
callq 0x6400
jmp 0x1d207
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0x1d1f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x6778
leaq 0x9f(%rsp), %rdi
callq 0x6400
jmp 0x1d223
jmp 0x1d209
leaq 0x150(%rsp), %rdi
callq 0x20120
jmp 0x1ccd8
addq $0x168, %rsp            # imm = 0x168
retq
movq 0x140(%rsp), %rdi
callq 0x66b0