// File: /workspace/github_cpp_makefile_star2_O3/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 0x16888
movq 0xa0(%r15), %r13
movl $0x18, %edi
callq 0x62f0
movq %rax, %rbx
movq 0x98(%r15), %rsi
testq %r13, %r13
je 0x12576
movq %rbx, %rdi
callq 0x1d00c
movq 0xa0(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x18(%rax)
movq 0xa0(%r15), %rbp
cmpl $0x6, 0x10(%rbp)
jne 0x12620
addq $0x18, %rbp
movq %r14, %rdi
callq 0x2b316
movq %r14, %rdi
movq %rbp, %rsi
movl %eax, %edx
callq 0x2b320
movl $0x18, %edi
callq 0x62f0
movq %rax, %r13
movq %rax, %rdi
movl $0x1, %esi
callq 0x1d3f2
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x1c744(%rip), %rsi     # 0x2eb81
leaq 0x1c786(%rip), %rdx     # 0x2ebca
leaq 0x8(%rsp), %rbp
movq %rbp, %rdi
callq 0x7008
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
movq %rbp, %r9
callq 0x2b238
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x12483
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6300
movq %r14, %rdi
callq 0x2b316
movl %eax, %ebp
movl $0x18, %edi
callq 0x62f0
movl %ebp, 0x10(%rax)
movq %rax, %rdi
movq %r12, %rsi
callq 0x6080
incq 0x28(%r15)
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x1c712(%rip), %rsi     # 0x2ebcb
leaq 0x1c741(%rip), %rdx     # 0x2ec01
leaq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0x7008
movq %r14, %rdi
movl $0x16, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r12, %r9
callq 0x2b238
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x124fb
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6300
movq 0xa0(%r15), %r15
addq $0x30, %r15
movq %r14, %rdi
callq 0x2b316
movq %r14, %rdi
movq %r15, %rsi
movl %eax, %edx
callq 0x2b320
movl $0x18, %edi
callq 0x62f0
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
callq 0x1d3f2
leaq 0x78(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1c6c0(%rip), %rsi     # 0x2ec02
leaq 0x1c6fa(%rip), %rdx     # 0x2ec43
leaq 0x68(%rsp), %r12
movq %r12, %rdi
callq 0x7008
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
movq %r12, %r9
callq 0x2b238
movq 0x68(%rsp), %rdi
jmp 0x12662
movq %rbx, %rdi
callq 0x1d00c
movl $0x18, %edi
callq 0x62f0
movq %rax, %r12
movq 0x98(%r15), %rdi
callq 0x1801a
cltq
leaq 0x2ce70(%rip), %rcx     # 0x3f410
movq (%rcx), %rcx
movq (%rcx,%rax,8), %rax
movl 0x28(%rax), %esi
movq %r12, %rdi
movl $0x2, %edx
callq 0x1d02a
movl $0x18, %edi
callq 0x62f0
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x1d02a
leaq 0x98(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1c583(%rip), %rsi     # 0x2eb69
leaq 0x1c593(%rip), %rdx     # 0x2eb80
leaq 0x88(%rsp), %r13
movq %r13, %rdi
callq 0x7008
movq %r14, %rdi
movl $0x9, %esi
movq %rbx, %rdx
movq %r12, %rcx
movq %r15, %r8
movq %r13, %r9
callq 0x2b238
movq 0x88(%rsp), %rdi
jmp 0x12662
movq %rax, %r13
leaq 0x58(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1c611(%rip), %rsi     # 0x2ec44
leaq 0x1c657(%rip), %rdx     # 0x2ec91
leaq 0x48(%rsp), %r15
movq %r15, %rdi
callq 0x7008
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x2b238
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x12673
movq (%rbp), %rsi
incq %rsi
callq 0x6300
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 0x1273a
movq 0x78(%rsp), %rsi
jmp 0x12709
jmp 0x1270e
movq %rax, %r14
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x1273a
movq 0x38(%rsp), %rsi
jmp 0x12709
movq %rax, %r14
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1273a
movq 0x18(%rsp), %rsi
jmp 0x12709
movq %rax, %r14
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1273a
movq 0x58(%rsp), %rsi
jmp 0x12709
movq %rax, %r14
movl $0x18, %esi
movq %r13, %rdi
jmp 0x12735
movq %rax, %r14
movq 0x88(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1273a
movq 0x98(%rsp), %rsi
incq %rsi
jmp 0x12735
movq %rax, %r14
movl $0x18, %esi
movq %r15, %rdi
jmp 0x12735
jmp 0x1271d
movq %rax, %r14
movl $0x18, %esi
movq %rbx, %rdi
jmp 0x12735
movq %rax, %r14
movl $0x18, %esi
movq %r12, %rdi
callq 0x6300
movq %r14, %rdi
callq 0x6560