// File: /workspace/github_cpp_makefile_star2_O1/kelwinfc[P]ci4721-Fernandez-Gyomrey/src/AST/to_tac.cpp
// Function: AST_variable_declaration::to_tac(Tac*)
void AST_variable_declaration::to_tac(Tac* t){
    next_list.clear();
    if (0 == value) {
        t->append_quad(inst::INIT, new opd(sym),
            new opd(types.types[ sym->getType() ]->width), new opd(0),
            "inicialización en cero");
        return;
    }
    opd* l = new opd(sym);
    opd* r = value->to_tac(t);
    
    if ( value->type == BOOLEAN){

        t->backpatch( value->truelist, t->next_instruction() );
        t->append_quad(inst::CP, l, new opd(true), 0,
                                "declaración con asignación del valor booleano "
                                "obtenido (true) al lvalue");
        
        next_list.push_back( t->next_instruction() );
        t->append_quad(inst::GOTO, 0, 0, 0, "salto después de declarar y asignar el valor booleano");

        t->backpatch( value->falselist, t->next_instruction() );
        t->append_quad(inst::CP, l, new opd(false), 0, "declaración con asignación de valor booleano obtenido al lvalue");
    } else {
        t->append_quad(inst::CP, l, r, 0, "declaración con asignación de un valor de cualquier tipo obtenido al lvalue");
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %r14
movq %rdi, %r15
leaq 0x18(%rdi), %r12
movq %r12, %rdi
callq 0x1686a
movq 0xa0(%r15), %r13
movl $0x18, %edi
callq 0x62e0
movq %rax, %rbx
movq 0x98(%r15), %rsi
testq %r13, %r13
je 0x12508
movq %rbx, %rdi
callq 0x1cfac
movq 0xa0(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x18(%rax)
movq 0xa0(%r15), %rbp
cmpl $0x6, 0x10(%rbp)
jne 0x125b2
addq $0x18, %rbp
movq %r14, %rdi
callq 0x2af04
movq %r14, %rdi
movq %rbp, %rsi
movl %eax, %edx
callq 0x2af0e
movl $0x18, %edi
callq 0x62e0
movq %rax, %r13
movq %rax, %rdi
movl $0x1, %esi
callq 0x1d36e
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x1b7b2(%rip), %rsi     # 0x2db81
leaq 0x1b7f4(%rip), %rdx     # 0x2dbca
leaq 0x8(%rsp), %rbp
movq %rbp, %rdi
callq 0x6fec
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
movq %rbp, %r9
callq 0x2ae24
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x12415
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x62f0
movq %r14, %rdi
callq 0x2af04
movl %eax, %ebp
movl $0x18, %edi
callq 0x62e0
movl %ebp, 0x10(%rax)
movq %rax, %rdi
movq %r12, %rsi
callq 0x6080
incq 0x28(%r15)
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x1b780(%rip), %rsi     # 0x2dbcb
leaq 0x1b7af(%rip), %rdx     # 0x2dc01
leaq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0x6fec
movq %r14, %rdi
movl $0x16, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r12, %r9
callq 0x2ae24
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x1248d
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x62f0
movq 0xa0(%r15), %r15
addq $0x30, %r15
movq %r14, %rdi
callq 0x2af04
movq %r14, %rdi
movq %r15, %rsi
movl %eax, %edx
callq 0x2af0e
movl $0x18, %edi
callq 0x62e0
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
callq 0x1d36e
leaq 0x78(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1b72e(%rip), %rsi     # 0x2dc02
leaq 0x1b768(%rip), %rdx     # 0x2dc43
leaq 0x68(%rsp), %r12
movq %r12, %rdi
callq 0x6fec
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
movq %r12, %r9
callq 0x2ae24
movq 0x68(%rsp), %rdi
jmp 0x125f4
movq %rbx, %rdi
callq 0x1cfac
movl $0x18, %edi
callq 0x62e0
movq %rax, %r12
movq 0x98(%r15), %rdi
callq 0x17fde
cltq
leaq 0x2bed6(%rip), %rcx     # 0x3e408
movq (%rcx), %rcx
movq (%rcx,%rax,8), %rax
movl 0x28(%rax), %esi
movq %r12, %rdi
movl $0x2, %edx
callq 0x1cfca
movl $0x18, %edi
callq 0x62e0
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x1cfca
leaq 0x98(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1b5f1(%rip), %rsi     # 0x2db69
leaq 0x1b601(%rip), %rdx     # 0x2db80
leaq 0x88(%rsp), %r13
movq %r13, %rdi
callq 0x6fec
movq %r14, %rdi
movl $0x9, %esi
movq %rbx, %rdx
movq %r12, %rcx
movq %r15, %r8
movq %r13, %r9
callq 0x2ae24
movq 0x88(%rsp), %rdi
jmp 0x125f4
movq %rax, %r13
leaq 0x58(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1b67f(%rip), %rsi     # 0x2dc44
leaq 0x1b6c5(%rip), %rdx     # 0x2dc91
leaq 0x48(%rsp), %r15
movq %r15, %rdi
callq 0x6fec
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x2ae24
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x12605
movq (%rbp), %rsi
incq %rsi
callq 0x62f0
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x68(%rsp), %rdi
cmpq %rbp, %rdi
je 0x126cc
movq 0x78(%rsp), %rsi
jmp 0x1269b
jmp 0x126a0
movq %rax, %r14
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x126cc
movq 0x38(%rsp), %rsi
jmp 0x1269b
movq %rax, %r14
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x126cc
movq 0x18(%rsp), %rsi
jmp 0x1269b
movq %rax, %r14
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x126cc
movq 0x58(%rsp), %rsi
jmp 0x1269b
movq %rax, %r14
movl $0x18, %esi
movq %r13, %rdi
jmp 0x126c7
movq %rax, %r14
movq 0x88(%rsp), %rdi
cmpq %rbp, %rdi
je 0x126cc
movq 0x98(%rsp), %rsi
incq %rsi
jmp 0x126c7
movq %rax, %r14
movl $0x18, %esi
movq %r15, %rdi
jmp 0x126c7
jmp 0x126af
movq %rax, %r14
movl $0x18, %esi
movq %rbx, %rdi
jmp 0x126c7
movq %rax, %r14
movl $0x18, %esi
movq %r12, %rdi
callq 0x62f0
movq %r14, %rdi
callq 0x6550