// File: kelwinfc[P]ci4721-Fernandez-Gyomrey/src/AST/to_tac.cpp
// Function: AST_conversion::to_tac(Tac*)
opd *AST_conversion::to_tac(Tac* t){
    opd *v = expr->to_tac(t);
    if (0 == v) {
        v = new opd();
    } else if (O_TEMP != v->type) {
        opd *o = new opd();
        t->append_quad(inst::CP, o, v, 0, "la conversión de tipos requiere a juro un temporal");
        v = o;
    }
    if (BOOLEAN == expr->type) {
        t->backpatch(expr->truelist, t->next_instruction() );
        t->append_quad(inst::CP, v, new opd(true), 0, "asignación de valor booleano (true) obtenido al lvalue");
        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, v, new opd(false), 0, "asignación de valor booleano (false) obtenido al lvalue");
    }
    t->append_quad(inst::CONV, v, v, 0, string("conversión de tipo ") + PRINT_TYPE(original_type) + " a " + PRINT_TYPE(type));
    return v;
}

// Assembly:
subq $0x2a8, %rsp            # imm = 0x2A8
movq %rdi, 0x2a0(%rsp)
movq %rsi, 0x298(%rsp)
movq 0x2a0(%rsp), %rax
movq %rax, 0x148(%rsp)
movq 0x50(%rax), %rdi
movq 0x298(%rsp), %rsi
movq (%rdi), %rax
callq *0x18(%rax)
movq %rax, 0x290(%rsp)
xorl %eax, %eax
cmpq 0x290(%rsp), %rax
jne 0x1818c
movl $0x18, %edi
callq 0x6390
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x140(%rsp)
callq 0x37ff0
jmp 0x1814c
movq 0x140(%rsp), %rax
movq %rax, 0x290(%rsp)
jmp 0x18305
movq 0x140(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
movl $0x18, %esi
callq 0x63a0
jmp 0x18bc6
movq 0x290(%rsp), %rax
movsbl 0x10(%rax), %ecx
movl $0x1, %eax
cmpl %ecx, %eax
je 0x18303
movl $0x18, %edi
callq 0x6390
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x138(%rsp)
callq 0x37ff0
jmp 0x181c4
movq 0x138(%rsp), %rax
movq %rax, 0x278(%rsp)
movq 0x298(%rsp), %rax
movq %rax, 0x118(%rsp)
movq 0x278(%rsp), %rax
movq %rax, 0x120(%rsp)
movq 0x290(%rsp), %rax
movq %rax, 0x128(%rsp)
leaq 0x257(%rsp), %rdi
movq %rdi, 0x130(%rsp)
callq 0x66c0
movq 0x130(%rsp), %rdx
leaq 0x3b744(%rip), %rsi     # 0x5396c
leaq 0x258(%rsp), %rdi
callq 0x7500
jmp 0x18237
movq 0x128(%rsp), %rcx
movq 0x120(%rsp), %rdx
movq 0x118(%rsp), %rdi
xorl %esi, %esi
movl %esi, %r8d
leaq 0x258(%rsp), %r9
callq 0x4de80
jmp 0x18263
leaq 0x258(%rsp), %rdi
callq 0x6778
leaq 0x257(%rsp), %rdi
callq 0x6400
movq 0x278(%rsp), %rax
movq %rax, 0x290(%rsp)
jmp 0x18303
movq 0x138(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
movl $0x18, %esi
callq 0x63a0
jmp 0x18bc6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x182f1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
leaq 0x258(%rsp), %rdi
callq 0x6778
leaq 0x257(%rsp), %rdi
callq 0x6400
jmp 0x18bc6
jmp 0x18305
movq 0x148(%rsp), %rax
movq 0x50(%rax), %rcx
movl $0x6, %eax
cmpl 0x10(%rcx), %eax
jne 0x1874d
movq 0x148(%rsp), %rax
movq 0x298(%rsp), %rdi
movq %rdi, 0xf0(%rsp)
movq 0x50(%rax), %rax
addq $0x18, %rax
movq %rax, 0xf8(%rsp)
callq 0x4dfb0
movq 0xf0(%rsp), %rdi
movq 0xf8(%rsp), %rsi
movl %eax, %edx
callq 0x4dfc0
movq 0x298(%rsp), %rax
movq %rax, 0x100(%rsp)
movq 0x290(%rsp), %rax
movq %rax, 0x108(%rsp)
movl $0x18, %edi
callq 0x6390
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x110(%rsp)
movl $0x1, %esi
callq 0x38470
jmp 0x183a7
leaq 0x22f(%rsp), %rdi
movq %rdi, 0xe8(%rsp)
callq 0x66c0
movq 0xe8(%rsp), %rdx
leaq 0x3b5d5(%rip), %rsi     # 0x539a0
leaq 0x230(%rsp), %rdi
callq 0x7500
jmp 0x183da
movq 0x110(%rsp), %rcx
movq 0x108(%rsp), %rdx
movq 0x100(%rsp), %rdi
xorl %esi, %esi
movl %esi, %r8d
leaq 0x230(%rsp), %r9
callq 0x4de80
jmp 0x18406
leaq 0x230(%rsp), %rdi
callq 0x6778
leaq 0x22f(%rsp), %rdi
callq 0x6400
movq 0x298(%rsp), %rax
movq %rax, 0xd0(%rsp)
movl $0x18, %edi
callq 0x6390
movq %rax, 0xd8(%rsp)
movq 0x298(%rsp), %rdi
callq 0x4dfb0
movl %eax, 0xe4(%rsp)
jmp 0x18458
movq 0xd8(%rsp), %rdi
movl 0xe4(%rsp), %esi
addl $0x2, %esi
movl $0x6, %edx
callq 0x38010
jmp 0x18476
leaq 0x207(%rsp), %rdi
movq %rdi, 0xc8(%rsp)
callq 0x66c0
movq 0xc8(%rsp), %rdx
leaq 0x3ab63(%rip), %rsi     # 0x52ffd
leaq 0x208(%rsp), %rdi
callq 0x7500
jmp 0x184a9
movq 0xd8(%rsp), %r8
movq 0xd0(%rsp), %rdi
xorl %eax, %eax
movl %eax, %ecx
movl $0x16, %esi
leaq 0x208(%rsp), %r9
movq %rcx, %rdx
callq 0x4de80
jmp 0x184d4
leaq 0x208(%rsp), %rdi
callq 0x6778
leaq 0x207(%rsp), %rdi
callq 0x6400
movq 0x148(%rsp), %rax
movq 0x298(%rsp), %rdi
movq %rdi, 0xa0(%rsp)
movq 0x50(%rax), %rax
addq $0x30, %rax
movq %rax, 0xa8(%rsp)
callq 0x4dfb0
movq 0xa0(%rsp), %rdi
movq 0xa8(%rsp), %rsi
movl %eax, %edx
callq 0x4dfc0
movq 0x298(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0x290(%rsp), %rax
movq %rax, 0xb8(%rsp)
movl $0x18, %edi
callq 0x6390
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0xc0(%rsp)
xorl %esi, %esi
callq 0x38470
jmp 0x18573
leaq 0x1df(%rsp), %rdi
movq %rdi, 0x98(%rsp)
callq 0x66c0
movq 0x98(%rsp), %rdx
leaq 0x3b441(%rip), %rsi     # 0x539d8
leaq 0x1e0(%rsp), %rdi
callq 0x7500
jmp 0x185a6
movq 0xc0(%rsp), %rcx
movq 0xb8(%rsp), %rdx
movq 0xb0(%rsp), %rdi
xorl %esi, %esi
movl %esi, %r8d
leaq 0x1e0(%rsp), %r9
callq 0x4de80
jmp 0x185d2
leaq 0x1e0(%rsp), %rdi
callq 0x6778
leaq 0x1df(%rsp), %rdi
callq 0x6400
jmp 0x1874d
movq 0x110(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
movl $0x18, %esi
callq 0x63a0
jmp 0x18bc6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x18653
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
leaq 0x230(%rsp), %rdi
callq 0x6778
leaq 0x22f(%rsp), %rdi
callq 0x6400
jmp 0x18bc6
movq 0xd8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
movl $0x18, %esi
callq 0x63a0
jmp 0x18bc6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x186c7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
leaq 0x208(%rsp), %rdi
callq 0x6778
leaq 0x207(%rsp), %rdi
callq 0x6400
jmp 0x18bc6
movq 0xc0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
movl $0x18, %esi
callq 0x63a0
jmp 0x18bc6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x1873b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
leaq 0x1e0(%rsp), %rdi
callq 0x6778
leaq 0x1df(%rsp), %rdi
callq 0x6400
jmp 0x18bc6
movq 0x298(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x290(%rsp), %rax
movq %rax, 0x80(%rsp)
movq %rax, 0x88(%rsp)
leaq 0x157(%rsp), %rdi
movq %rdi, 0x90(%rsp)
callq 0x66c0
movq 0x90(%rsp), %rdx
leaq 0x3b27b(%rip), %rsi     # 0x53a11
leaq 0x158(%rsp), %rdi
callq 0x7500
jmp 0x187a5
movq 0x148(%rsp), %rcx
xorl %eax, %eax
cmpl 0x48(%rcx), %eax
jne 0x187c5
leaq 0x3b26b(%rip), %rax     # 0x53a26
movq %rax, 0x70(%rsp)
jmp 0x188f3
movq 0x148(%rsp), %rcx
movl $0x1, %eax
cmpl 0x48(%rcx), %eax
jne 0x187e8
leaq 0x3b252(%rip), %rax     # 0x53a30
movq %rax, 0x68(%rsp)
jmp 0x188e9
movq 0x148(%rsp), %rcx
movl $0x2, %eax
cmpl 0x48(%rcx), %eax
jne 0x1880b
leaq 0x3b237(%rip), %rax     # 0x53a38
movq %rax, 0x60(%rsp)
jmp 0x188df
movq 0x148(%rsp), %rcx
movl $0x3, %eax
cmpl 0x48(%rcx), %eax
jne 0x1882e
leaq 0x3b219(%rip), %rax     # 0x53a3d
movq %rax, 0x58(%rsp)
jmp 0x188d5
movq 0x148(%rsp), %rcx
movl $0x4, %eax
cmpl 0x48(%rcx), %eax
jne 0x1884e
leaq 0x3b1fa(%rip), %rax     # 0x53a41
movq %rax, 0x50(%rsp)
jmp 0x188cb
movq 0x148(%rsp), %rcx
movl $0x5, %eax
cmpl 0x48(%rcx), %eax
jne 0x1886e
leaq 0x3b1e0(%rip), %rax     # 0x53a47
movq %rax, 0x48(%rsp)
jmp 0x188c1
movq 0x148(%rsp), %rcx
movl $0x6, %eax
cmpl 0x48(%rcx), %eax
jne 0x1888e
leaq 0x3b1c5(%rip), %rax     # 0x53a4c
movq %rax, 0x40(%rsp)
jmp 0x188b7
movq 0x148(%rsp), %rax
movl 0x48(%rax), %esi
movl $0x7, %edx
leaq 0x3b1b6(%rip), %rax     # 0x53a5b
leaq 0x3b1a8(%rip), %rcx     # 0x53a54
cmpl %esi, %edx
cmoveq %rcx, %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rdx
leaq 0x178(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x20990
jmp 0x1890f
leaq 0x3b14d(%rip), %rdx     # 0x53a63
leaq 0x198(%rsp), %rdi
leaq 0x178(%rsp), %rsi
callq 0x20990
jmp 0x1892d
movq 0x148(%rsp), %rcx
xorl %eax, %eax
cmpl 0x10(%rcx), %eax
jne 0x1894d
leaq 0x3b0e3(%rip), %rax     # 0x53a26
movq %rax, 0x38(%rsp)
jmp 0x18a7b
movq 0x148(%rsp), %rcx
movl $0x1, %eax
cmpl 0x10(%rcx), %eax
jne 0x18970
leaq 0x3b0ca(%rip), %rax     # 0x53a30
movq %rax, 0x30(%rsp)
jmp 0x18a71
movq 0x148(%rsp), %rcx
movl $0x2, %eax
cmpl 0x10(%rcx), %eax
jne 0x18993
leaq 0x3b0af(%rip), %rax     # 0x53a38
movq %rax, 0x28(%rsp)
jmp 0x18a67
movq 0x148(%rsp), %rcx
movl $0x3, %eax
cmpl 0x10(%rcx), %eax
jne 0x189b6
leaq 0x3b091(%rip), %rax     # 0x53a3d
movq %rax, 0x20(%rsp)
jmp 0x18a5d
movq 0x148(%rsp), %rcx
movl $0x4, %eax
cmpl 0x10(%rcx), %eax
jne 0x189d6
leaq 0x3b072(%rip), %rax     # 0x53a41
movq %rax, 0x18(%rsp)
jmp 0x18a53
movq 0x148(%rsp), %rcx
movl $0x5, %eax
cmpl 0x10(%rcx), %eax
jne 0x189f6
leaq 0x3b058(%rip), %rax     # 0x53a47
movq %rax, 0x10(%rsp)
jmp 0x18a49
movq 0x148(%rsp), %rcx
movl $0x6, %eax
cmpl 0x10(%rcx), %eax
jne 0x18a16
leaq 0x3b03d(%rip), %rax     # 0x53a4c
movq %rax, 0x8(%rsp)
jmp 0x18a3f
movq 0x148(%rsp), %rax
movl 0x10(%rax), %esi
movl $0x7, %edx
leaq 0x3b02e(%rip), %rax     # 0x53a5b
leaq 0x3b020(%rip), %rcx     # 0x53a54
cmpl %esi, %edx
cmoveq %rcx, %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rdx
leaq 0x1b8(%rsp), %rdi
leaq 0x198(%rsp), %rsi
callq 0x20990
jmp 0x18a97
movq 0x80(%rsp), %rcx
movq 0x88(%rsp), %rdx
movq 0x78(%rsp), %rdi
xorl %eax, %eax
movl %eax, %r8d
movl $0x6, %esi
leaq 0x1b8(%rsp), %r9
callq 0x4de80
jmp 0x18ac5
leaq 0x1b8(%rsp), %rdi
callq 0x6778
leaq 0x198(%rsp), %rdi
callq 0x6778
leaq 0x178(%rsp), %rdi
callq 0x6778
leaq 0x158(%rsp), %rdi
callq 0x6778
leaq 0x157(%rsp), %rdi
callq 0x6400
movq 0x290(%rsp), %rax
addq $0x2a8, %rsp            # imm = 0x2A8
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x18bb9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x18bac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x18b9f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x18b92
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
leaq 0x1b8(%rsp), %rdi
callq 0x6778
leaq 0x198(%rsp), %rdi
callq 0x6778
leaq 0x178(%rsp), %rdi
callq 0x6778
leaq 0x158(%rsp), %rdi
callq 0x6778
leaq 0x157(%rsp), %rdi
callq 0x6400
movq 0x288(%rsp), %rdi
callq 0x66b0
nopw %cs:(%rax,%rax)