// File: /workspace/github_cpp_makefile_star2_O2/lhydave[P]SysYCompilerLab/back/no_alloc.cpp
// Function: no_alloc::gen_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::shared_ptr<eeyore_AST::op_node> const&)
void gen_assign(const string &lval, const shared_ptr<op_node> &rval)
{
	if (rval->exp_type == EXP_NUM) // number!
	{
		auto rnum = std::static_pointer_cast<num_node>(rval);
		tigger_dst << emit_exp_assign(lval, to_string(rnum->val));
		return;
	}
	if (rval->exp_type == EXP_VAR) // variable!
	{
		auto rreg = alloc_temp_reg(rval, 2);
		tigger_dst << emit_exp_assign(lval, rreg);
		return;
	}
	if (rval->exp_type == EXP_ARRAY) // array!
	{
		gen_array(rval, 2, 3);
		string right = temp_prefix + to_string(2) + "[0]";
		tigger_dst << emit_exp_assign(lval, right);
		return;
	}
	if (rval->exp_type == EXP_CALL) // call!
	{
		gen_call(std::static_pointer_cast<call_node>(rval), lval);
		return;
	}
	if (!rval->right) // unary operator
	{
		gen_unary(rval, 2);
		tigger_dst << emit_exp_assign(lval, temp_prefix + to_string(2));
		return;
	}
	// binary operator
	gen_binary(rval, 2, 3);
	tigger_dst << emit_exp_assign(lval, temp_prefix + to_string(2));
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x60, %rsp
movq %rdi, %rbx
movq (%rsi), %rax
movl 0x8(%rax), %ecx
decl %ecx
cmpl $0x4, %ecx
ja 0x180ca
leaq 0x77f4(%rip), %rdx      # 0x1f77c
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
leaq 0x20(%rsp), %r14
pushq $0x2
popq %rdx
movq %r14, %rdi
callq 0x18224
movq %rsp, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x15048
leaq 0x1644a(%rip), %rdi     # 0x2e400
movq %rsp, %rsi
callq 0x5210
jmp 0x18091
leaq 0x40(%rsp), %r14
movq %r14, %rdi
callq 0x18e9b
movq (%r14), %rax
movl 0x50(%rax), %esi
movq %rsp, %rdi
callq 0xc6d2
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
movq %rbx, %rsi
callq 0x15048
leaq 0x1640b(%rip), %rdi     # 0x2e400
leaq 0x20(%rsp), %rsi
callq 0x5210
leaq 0x20(%rsp), %rdi
callq 0x5548
movq %rsp, %rdi
callq 0x5548
leaq 0x48(%rsp), %rdi
jmp 0x180c0
pushq $0x2
popq %rbp
pushq $0x3
popq %rdx
movq %rsi, %rdi
movl %ebp, %esi
callq 0x1856a
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movl %ebp, %esi
callq 0xc6d2
leaq 0x16a17(%rip), %rsi     # 0x2ea58
movq %rsp, %rdi
movq %r14, %rdx
callq 0x18e23
leaq 0x7745(%rip), %rdx      # 0x1f798
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0xc579
movq %rsp, %rdi
callq 0x5548
leaq 0x40(%rsp), %rdi
callq 0x5548
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
movq %rbx, %rsi
callq 0x15048
leaq 0x16377(%rip), %rdi     # 0x2e400
movq %rsp, %rsi
callq 0x5210
movq %rsp, %rdi
callq 0x5548
leaq 0x20(%rsp), %rdi
jmp 0x1818b
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x18ed3
movq %r14, %rdi
movq %rbx, %rsi
callq 0x17e43
leaq 0x28(%rsp), %rdi
callq 0x11548
jmp 0x18190
cmpq $0x0, 0x40(%rax)
je 0x18125
pushq $0x2
popq %rbp
pushq $0x3
popq %rdx
movq %rsi, %rdi
movl %ebp, %esi
callq 0x18bef
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movl %ebp, %esi
callq 0xc6d2
leaq 0x16961(%rip), %rsi     # 0x2ea58
movq %rsp, %rdi
movq %r14, %rdx
callq 0x18e23
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
movq %rbx, %rsi
callq 0x15048
leaq 0x162e7(%rip), %rdi     # 0x2e400
leaq 0x20(%rsp), %rsi
callq 0x5210
jmp 0x18174
pushq $0x2
popq %rbp
movq %rsi, %rdi
movl %ebp, %esi
callq 0x18b3d
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movl %ebp, %esi
callq 0xc6d2
leaq 0x16910(%rip), %rsi     # 0x2ea58
movq %rsp, %rdi
movq %r14, %rdx
callq 0x18e23
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
movq %rbx, %rsi
callq 0x15048
leaq 0x16296(%rip), %rdi     # 0x2e400
leaq 0x20(%rsp), %rsi
callq 0x5210
leaq 0x20(%rsp), %rdi
callq 0x5548
movq %rsp, %rdi
callq 0x5548
leaq 0x40(%rsp), %rdi
callq 0x5548
addq $0x60, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x1819f
jmp 0x181c5
jmp 0x181f6
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x5548
jmp 0x181c8
jmp 0x181c5
jmp 0x181f6
jmp 0x181d2
jmp 0x18200
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x5548
jmp 0x181e2
movq %rax, %rbx
movq %rsp, %rdi
callq 0x5548
jmp 0x181f9
movq %rax, %rbx
movq %rsp, %rdi
callq 0x5548
jmp 0x18203
movq %rax, %rbx
movq %rsp, %rdi
callq 0x5548
jmp 0x18212
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0x18217
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
jmp 0x18208
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x5548
jmp 0x1821c
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x11548
movq %rbx, %rdi
callq 0x54c0