// File: /workspace/github_cpp_makefile_star2_O2/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 0x124ce
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 0xfa4b
addq $0x18, %rbp
movq %rbx, %rdi
callq 0x2138a
movq %rbx, %rdi
movq %rbp, %rsi
movl %eax, %edx
callq 0x21394
pushq $0x18
popq %rdi
callq 0x62d0
movq %rax, %r13
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x1837e
leaq 0x15230(%rip), %rsi     # 0x24b92
leaq 0x68(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0x6d6c
leaq 0x68(%rsp), %r9
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
callq 0x212de
leaq 0x68(%rsp), %rdi
callq 0x65c8
movq %rbx, %rdi
callq 0x2138a
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
movq %r12, %rdi
callq 0x1243c
leaq 0x14660(%rip), %rsi     # 0x24011
leaq 0x48(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0x6d6c
pushq $0x16
popq %rsi
leaq 0x48(%rsp), %r9
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x212de
leaq 0x48(%rsp), %rdi
callq 0x65c8
movq 0x80(%r15), %r15
addq $0x30, %r15
movq %rbx, %rdi
callq 0x2138a
movq %rbx, %rdi
movq %r15, %rsi
movl %eax, %edx
callq 0x21394
pushq $0x18
popq %rdi
callq 0x62d0
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
callq 0x1837e
leaq 0x152d6(%rip), %rsi     # 0x24cf3
leaq 0x28(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0x6d6c
leaq 0x28(%rsp), %r9
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x212de
leaq 0x28(%rsp), %rdi
jmp 0xfa81
movq %rax, %r13
leaq 0x15200(%rip), %rsi     # 0x24c55
leaq 0x8(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0x6d6c
leaq 0x8(%rsp), %r9
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
callq 0x212de
leaq 0x8(%rsp), %rdi
callq 0x65c8
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0xfacd
jmp 0xfad6
movq %rax, %rbx
pushq $0x18
popq %rsi
movq %r15, %rdi
jmp 0xfae4
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0xfacd
jmp 0xfad6
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
jmp 0xfacd
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x65c8
jmp 0xfae9
jmp 0xfad6
movq %rax, %rbx
jmp 0xfae9
movq %rax, %rbx
pushq $0x18
popq %rsi
movq %r13, %rdi
callq 0x62e0
movq %rbx, %rdi
callq 0x6530
nop