// File: /workspace/github_cpp_makefile_star2_O1/luooofan[P]hblzbd_compiler/src/generate_ir.cpp
// Function: ast::AssignStatement::GenerateIR(ir::ContextInfo&, std::vector<ir::IR*, std::allocator<ir::IR*>>&)
void AssignStatement::GenerateIR(ir::ContextInfo &ctx, std::vector<ir::IR *> &gIRList) {
  // 给函数调用赋值过不了语法分析
  this->rhs_.GenerateIR(ctx, gIRList);
  CHECK_OPN_INT("rhs exp");
  ir::Opn rhs_opn = ctx.opn_;

  ctx.is_assigned_ = true;
  this->lhs_.GenerateIR(ctx, gIRList);
  ctx.is_assigned_ = false;
  CHECK_OPN_INT("leftvalue");

  ir::Opn &lhs_opn = ctx.opn_;
  ir::SymbolTableItem *symbol = nullptr;
  ir::FindSymbol(ctx.scope_id_, lhs_opn.name_, symbol);

  // const check
  if (nullptr != symbol && symbol->is_const_) {
    ir::SemanticError(this->line_no_, lhs_opn.name_ + ": constant can't be assigned");
    return;
  }

  // genir(assign,opn1,-,res)
  gIRList.push_back(new ir::IR(IROpKind::ASSIGN, rhs_opn, lhs_opn));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x18(%rdi), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq 0x50(%r14), %rax
cmpq 0x58(%r14), %rax
je 0x19743
cmpl $0x4, 0x8(%r14)
jne 0x19743
movl 0x8(%r15), %ebp
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0xca10
leaq 0x56ccf(%rip), %rsi     # 0x702f0
movq %r12, %rdi
callq 0x8590
leaq 0x567e9(%rip), %rsi     # 0x6fe19
leaq 0x28(%rsp), %rdi
callq 0x8590
leaq 0x18(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x19664
movq %rsi, %r12
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x1966d
movups (%rcx), %xmm0
movq %rsi, %r12
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq 0x8(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x564f5(%rip), %rsi     # 0x6fb85
callq 0x8590
leaq 0x98(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x196c5
movq %rdx, 0x88(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x98(%rsp)
jmp 0x196cd
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0x88(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl %ebp, %edi
callq 0x2b12a
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0x19710
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
leaq 0x38(%rsp), %r12
je 0x1972c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x19743
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x82a0
leaq 0x8(%r14), %r12
leaq 0x88(%rsp), %rdi
movq %r12, %rsi
callq 0x28186
movb $0x1, 0x209(%r14)
movq 0x10(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x10(%rax)
movb $0x0, 0x209(%r14)
movq 0x50(%r14), %rax
cmpq 0x58(%r14), %rax
je 0x198ca
cmpl $0x4, 0x8(%r14)
jne 0x198ca
movl 0x8(%r15), %ebp
leaq 0x58(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
addq %rsi, %rdx
leaq 0x48(%rsp), %rdi
callq 0xca10
leaq 0x56b37(%rip), %rsi     # 0x702f0
leaq 0x48(%rsp), %rdi
callq 0x8590
leaq 0x564c6(%rip), %rsi     # 0x6fc90
leaq 0x48(%rsp), %rdi
callq 0x8590
leaq 0x38(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x197fb
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x19801
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq 0x28(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x56361(%rip), %rsi     # 0x6fb85
callq 0x8590
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x19850
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x19858
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0x8(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl %ebp, %edi
callq 0x2b12a
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x19892
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
leaq 0x58(%rsp), %r13
je 0x198b3
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x198ca
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x82a0
movq $0x0, 0x28(%rsp)
movl (%r14), %ebp
leaq 0x78(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
addq %rsi, %rdx
leaq 0x68(%rsp), %rdi
callq 0xca10
leaq 0x68(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movl %ebp, %edi
callq 0x27e6f
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x1991c
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x19983
cmpb $0x1, 0x1(%rax)
jne 0x19983
movl 0x8(%r15), %ebx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0xca10
leaq 0x56345(%rip), %rsi     # 0x6fc9a
leaq 0x8(%rsp), %rdi
callq 0x8590
leaq 0x8(%rsp), %rsi
movl %ebx, %edi
callq 0x2b12a
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x19a29
movq 0x18(%rsp), %rsi
jmp 0x19a21
movl $0xe0, %edi
callq 0x8290
movq %rax, %r14
leaq 0x108(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x28186
leaq 0xc8(%rsp), %rdi
movq %r12, %rsi
callq 0x28186
movb $0x1, %bpl
leaq 0x108(%rsp), %rdx
leaq 0xc8(%rsp), %rcx
movq %r14, %rdi
movl $0xc, %esi
callq 0x24e94
leaq 0x8(%rsp), %rsi
movq %r14, (%rsi)
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x114b8
leaq 0xe0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19a08
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x82a0
leaq 0x120(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19a29
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x82a0
leaq 0xa0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19a4a
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x82a0
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x19a5e
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x19be9
movq 0x18(%rsp), %rsi
jmp 0x19b86
jmp 0x19b8d
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x19a9d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x82a0
jmp 0x19a9d
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x19abe
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x82a0
jmp 0x19abe
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
jne 0x19ae3
jmp 0x19be9
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x19be9
movq 0x58(%rsp), %rsi
jmp 0x19b86
jmp 0x19b8d
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0x19b17
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x82a0
jmp 0x19b17
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x19b33
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x82a0
jmp 0x19b33
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
jne 0x19b58
jmp 0x19c0a
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x19c0a
movq 0x38(%rsp), %rsi
jmp 0x19c02
movq %rax, %rbx
movb $0x1, %bpl
jmp 0x19bb6
movq %rax, %rbx
movb $0x1, %bpl
jmp 0x19bd7
jmp 0x19b8d
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x19be9
movq 0x78(%rsp), %rsi
incq %rsi
jmp 0x19be4
jmp 0x19b8d
movq %rax, %rbx
jmp 0x19be9
movq %rax, %rbx
leaq 0xe0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19bb6
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x82a0
leaq 0x120(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19bd7
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x82a0
testb %bpl, %bpl
je 0x19be9
movl $0xe0, %esi
movq %r14, %rdi
callq 0x82a0
leaq 0xa0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19c0a
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x82a0
movq %rbx, %rdi
callq 0x8540