// File: /workspace/github_cpp_makefile_star2_O3/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 0x16888
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 0x12ec9
movq %r14, (%rsp)
addq $0x18, %rbp
movq %rbx, %rdi
callq 0x2b316
movq %rbx, %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 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1bdff(%rip), %rsi     # 0x2eb92
leaq 0x1be30(%rip), %rdx     # 0x2ebca
leaq 0x28(%rsp), %rbp
movq %rbp, %rdi
callq 0x7008
movq %rbx, %rdi
xorl %esi, %esi
movq (%rsp), %rdx
movq %r13, %rcx
xorl %r8d, %r8d
movq %rbp, %r9
callq 0x2b238
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x12dd5
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6300
movq %rbx, %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 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1b206(%rip), %rsi     # 0x2e011
leaq 0x1b22a(%rip), %rdx     # 0x2e03c
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x7008
movq %rbx, %rdi
movl $0x16, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r12, %r9
callq 0x2b238
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x12e4d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6300
movq 0x80(%r15), %r15
addq $0x30, %r15
movq %rbx, %rdi
callq 0x2b316
movq %rbx, %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
movq (%rsp), %r14
leaq 0x78(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1be5b(%rip), %rsi     # 0x2ecf3
leaq 0x1be8c(%rip), %rdx     # 0x2ed2b
leaq 0x68(%rsp), %r12
movq %r12, %rdi
callq 0x7008
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
movq %r12, %r9
callq 0x2b238
movq 0x68(%rsp), %rdi
jmp 0x12f0b
movq %rax, %r13
leaq 0x58(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x1bd79(%rip), %rsi     # 0x2ec55
leaq 0x1bdae(%rip), %rdx     # 0x2ec91
leaq 0x48(%rsp), %r15
movq %r15, %rdi
callq 0x7008
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x2b238
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x12f1c
movq (%rbp), %rsi
incq %rsi
callq 0x6300
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 0x12f9e
movq 0x78(%rsp), %rsi
jmp 0x12f89
movq %rax, %rbx
movl $0x18, %esi
movq %r15, %rdi
jmp 0x12f99
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x12f9e
movq 0x18(%rsp), %rsi
jmp 0x12f89
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x12f9e
movq 0x38(%rsp), %rsi
jmp 0x12f89
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x12f9e
movq 0x58(%rsp), %rsi
incq %rsi
jmp 0x12f99
movq %rax, %rbx
movl $0x18, %esi
movq %r13, %rdi
callq 0x6300
movq %rbx, %rdi
callq 0x6560