// File: /workspace/github_cpp_makefile_star2_O1/kelwinfc[P]ci4721-Fernandez-Gyomrey/src/AST/to_tac.cpp
// Function: AST_assignment::to_tac(Tac*)
void AST_assignment::to_tac(Tac* t){
    next_list.clear();

    opd* l = lvalue->to_tac(t);
    opd* r = expr->to_tac(t);
    
    if ( expr->type == BOOLEAN){

        t->backpatch( expr->truelist, t->next_instruction() );
        t->append_quad(inst::CP, l, new opd(true), 0, "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 asignar el valor booleano");

        t->backpatch( expr->falselist, t->next_instruction() );
        t->append_quad(inst::CP, l, new opd(false), 0, "asignación de valor booleano obtenido (false) al lvalue");
    } else {
        t->append_quad(inst::CP, l, r, 0, "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 $0x88, %rsp
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x18(%rdi), %r12
movq %r12, %rdi
callq 0x1686a
movq 0x78(%r15), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x18(%rax)
movq %rax, %r14
movq 0x80(%r15), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x18(%rax)
movq 0x80(%r15), %rbp
cmpl $0x6, 0x10(%rbp)
jne 0x12e79
movq %r14, (%rsp)
addq $0x18, %rbp
movq %rbx, %rdi
callq 0x2af04
movq %rbx, %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 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1ae4f(%rip), %rsi     # 0x2db92
leaq 0x1ae80(%rip), %rdx     # 0x2dbca
leaq 0x28(%rsp), %rbp
movq %rbp, %rdi
callq 0x6fec
movq %rbx, %rdi
xorl %esi, %esi
movq (%rsp), %rdx
movq %r13, %rcx
xorl %r8d, %r8d
movq %rbp, %r9
callq 0x2ae24
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x12d85
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x62f0
movq %rbx, %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 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1a256(%rip), %rsi     # 0x2d011
leaq 0x1a27a(%rip), %rdx     # 0x2d03c
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x6fec
movq %rbx, %rdi
movl $0x16, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r12, %r9
callq 0x2ae24
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x12dfd
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x62f0
movq 0x80(%r15), %r15
addq $0x30, %r15
movq %rbx, %rdi
callq 0x2af04
movq %rbx, %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
movq (%rsp), %r14
leaq 0x78(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1aeab(%rip), %rsi     # 0x2dcf3
leaq 0x1aedc(%rip), %rdx     # 0x2dd2b
leaq 0x68(%rsp), %r12
movq %r12, %rdi
callq 0x6fec
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
movq %r12, %r9
callq 0x2ae24
movq 0x68(%rsp), %rdi
jmp 0x12ebb
movq %rax, %r13
leaq 0x58(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1adc9(%rip), %rsi     # 0x2dc55
leaq 0x1adfe(%rip), %rdx     # 0x2dc91
leaq 0x48(%rsp), %r15
movq %r15, %rdi
callq 0x6fec
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x2ae24
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x12ecc
movq (%rbp), %rsi
incq %rsi
callq 0x62f0
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %rbp, %rdi
je 0x12f4e
movq 0x78(%rsp), %rsi
jmp 0x12f39
movq %rax, %rbx
movl $0x18, %esi
movq %r15, %rdi
jmp 0x12f49
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x12f4e
movq 0x18(%rsp), %rsi
jmp 0x12f39
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x12f4e
movq 0x38(%rsp), %rsi
jmp 0x12f39
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x12f4e
movq 0x58(%rsp), %rsi
incq %rsi
jmp 0x12f49
movq %rax, %rbx
movl $0x18, %esi
movq %r13, %rdi
callq 0x62f0
movq %rbx, %rdi
callq 0x6550