// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/backend/asmgen_gas32.c
// Function: asm_stat_add
static void _asm_stat_add(
	ASMGeneratorGas32Context *ctx,
	ParserASTNode *node
) {
	assert(ctx);
	assert(node);
	assert(node->type == BE_NODE_STAT_ADD);
	assert(node->nchilds == 3);

	ParserASTNode *node_target = node->childs[0];
	assert(node_target->type == BE_NODE_IDENTIFIER);
	ParserSymbol *symbol_target = _get_var_symbol_by_id_node(ctx, node_target);
	uint8_t type_target = BE_VAR_SYMBOL_GET_TYPE(symbol_target);

	ParserASTNode *node_source_left = node->childs[1];
	ParserASTNode *node_source_right = node->childs[2];

	if (type_target == BE_TYPE_POINTER) {
		MoveIdOrConstexprToRegEx result;
		_move_id_or_constexpr_to_reg_ex(
			ctx,
			_ASM_REG_AX,
			_ASM_REG_BX,	// 32位指针，BX无意义。
			node_source_left,
			&result
		);
		size_t size_target = be_sem_calc_type_size(
			ctx->psrctx, node, result.node_type->childs[0]
		);

		_move_id_or_constexpr_to_reg(
			ctx,
			_ASM_REG_BX,
			_ASM_REG_CX,	// 32位下，指针运算右值低32位有效。
			node_source_right
		);
		if (size_target > 1) {
			ResizableString rstr_type_size;
			rstr_init(&rstr_type_size);
			_asm_inst_uint_const(
				ctx,
				&rstr_type_size,
				size_target
			);

			_asm_inst_imul_x_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EBX,
				_ASM_REG_NAME_EBX,
				RSTR_CSTR(&rstr_type_size)
			);

			rstr_free(&rstr_type_size);
		}

		_asm_inst_add_x_x(
			ctx,
			ctx->body,
			BE_TYPE_UINT32,
			_ASM_REG_NAME_EAX,
			_ASM_REG_NAME_EBX
		);

		ParserSymbol *symbol_target_l = _instantiate_varsym(ctx, symbol_target, 0);

		_asm_inst_mov_sym_x(
			ctx,
			ctx->body,
			symbol_target_l,
			_ASM_REG_NAME_EAX
		);

		_free_varsym(ctx, symbol_target_l);
	} else if (be_sem_is_integer_type(type_target)) {
		_move_id_or_constexpr_to_reg(
			ctx,
			_ASM_REG_AX,
			_ASM_REG_BX,
			node_source_left
		);

		_move_id_or_constexpr_to_reg(
			ctx,
			_ASM_REG_CX,
			_ASM_REG_DX,
			node_source_right
		);

		if (type_target == BE_TYPE_INT64 || type_target == BE_TYPE_UINT64) {
			_emu_add_64(
				ctx,
				_ASM_REG_NAME_EAX, _ASM_REG_NAME_EBX,
				_ASM_REG_NAME_ECX, _ASM_REG_NAME_EDX
			);

			ParserSymbol *symbol_target_l = _instantiate_varsym(ctx, symbol_target, 0);
			ParserSymbol *symbol_target_h = _instantiate_varsym(ctx, symbol_target, 4);

			_asm_inst_mov_sym_x(
				ctx,
				ctx->body,
				symbol_target_l,
				_ASM_REG_NAME_EAX
			);

			_asm_inst_mov_sym_x(
				ctx,
				ctx->body,
				symbol_target_h,
				_ASM_REG_NAME_EBX
			);

			_free_varsym(ctx, symbol_target_l);
			_free_varsym(ctx, symbol_target_h);
		} else {
			_asm_inst_add_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EAX,
				_ASM_REG_NAME_ECX
			);

			ParserSymbol *symbol_target_l = _instantiate_varsym(ctx, symbol_target, 0);

			_asm_inst_mov_sym_x(
				ctx,
				ctx->body,
				symbol_target_l,
				_asm_inst_reg(ctx, type_target, _ASM_REG_AX)
			);

			_free_varsym(ctx, symbol_target_l);
		}
	} else if (type_target == BE_TYPE_FLOAT) {
		_move_id_or_constexpr_to_xmm_reg(
			ctx,
			_ASM_REG_NAME_XMM0,
			node_source_left
		);

		_move_id_or_constexpr_to_xmm_reg(
			ctx,
			_ASM_REG_NAME_XMM1,
			node_source_right
		);

		_asm_inst_addss_x_x(
			ctx,
			ctx->body,
			_ASM_REG_NAME_XMM0,
			_ASM_REG_NAME_XMM1
		);

		ParserSymbol *symbol_target_l = _instantiate_varsym(ctx, symbol_target, 0);

		_asm_inst_movss_sym_x(
			ctx,
			ctx->body,
			symbol_target_l,
			_ASM_REG_NAME_XMM0
		);

		_free_varsym(ctx, symbol_target_l);
	} else if (type_target == BE_TYPE_DOUBLE) {
		_move_id_or_constexpr_to_xmm_reg(
			ctx,
			_ASM_REG_NAME_XMM0,
			node_source_left
		);

		_move_id_or_constexpr_to_xmm_reg(
			ctx,
			_ASM_REG_NAME_XMM1,
			node_source_right
		);

		_asm_inst_addsd_x_x(
			ctx,
			ctx->body,
			_ASM_REG_NAME_XMM0,
			_ASM_REG_NAME_XMM1
		);

		ParserSymbol *symbol_target_l = _instantiate_varsym(ctx, symbol_target, 0);

		_asm_inst_movsd_sym_x(
			ctx,
			ctx->body,
			symbol_target_l,
			_ASM_REG_NAME_XMM0
		);

		_free_varsym(ctx, symbol_target_l);
	} else {
		assert(0);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x166ec
jmp 0x1670b
leaq 0x69a6e(%rip), %rdi     # 0x80161
leaq 0x5f1fe(%rip), %rsi     # 0x758f8
movl $0x185f, %edx           # imm = 0x185F
leaq 0x622c2(%rip), %rcx     # 0x789c8
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x16714
jmp 0x16733
leaq 0x5fe41(%rip), %rdi     # 0x7655c
leaq 0x5f1d6(%rip), %rsi     # 0x758f8
movl $0x1860, %edx           # imm = 0x1860
leaq 0x6229a(%rip), %rcx     # 0x789c8
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xbe0, (%rax)          # imm = 0xBE0
jne 0x16741
jmp 0x16760
leaq 0x622c0(%rip), %rdi     # 0x78a08
leaq 0x5f1a9(%rip), %rsi     # 0x758f8
movl $0x1861, %edx           # imm = 0x1861
leaq 0x6226d(%rip), %rcx     # 0x789c8
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0x3, 0x44(%rax)
jne 0x1676c
jmp 0x1678b
leaq 0x609cb(%rip), %rdi     # 0x7713e
leaq 0x5f17e(%rip), %rsi     # 0x758f8
movl $0x1862, %edx           # imm = 0x1862
leaq 0x62242(%rip), %rcx     # 0x789c8
callq 0x30a0
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x200, (%rax)          # imm = 0x200
jne 0x167a8
jmp 0x167c7
leaq 0x5fc0e(%rip), %rdi     # 0x763bd
leaq 0x5f142(%rip), %rsi     # 0x758f8
movl $0x1865, %edx           # imm = 0x1865
leaq 0x62206(%rip), %rcx     # 0x789c8
callq 0x30a0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1f720
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movb 0x30(%rax), %al
movb %al, -0x21(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movzbl -0x21(%rbp), %eax
cmpl $0x10, %eax
jne 0x16955
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rcx
xorl %esi, %esi
movl $0x1, %edx
leaq -0x50(%rbp), %r8
callq 0x201a0
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rdx
callq 0x4d4f0
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rcx
movl $0x1, %esi
movl $0x2, %edx
callq 0x22a20
cmpq $0x1, -0x58(%rbp)
jbe 0x168f0
leaq -0x68(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rdx
leaq -0x68(%rbp), %rsi
callq 0x21e80
movq -0x8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xa0(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0x168b3
leaq 0x5f695(%rip), %rax     # 0x75f3f
movq %rax, -0xb0(%rbp)
jmp 0x168be
movq -0x60(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xa0(%rbp), %rsi
movq -0xa8(%rbp), %rdi
movq -0xb0(%rbp), %r9
movl $0x8, %edx
leaq 0x5fb0b(%rip), %r8      # 0x763ea
movq %r8, %rcx
callq 0x25510
leaq -0x68(%rbp), %rdi
callq 0x9310
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5fadd(%rip), %rcx     # 0x763e5
leaq 0x5fadb(%rip), %r8      # 0x763ea
callq 0x21eb0
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1f8e0
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x70(%rbp), %rdx
leaq 0x5faa7(%rip), %rcx     # 0x763e5
callq 0x20080
movq -0x8(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x1fd10
jmp 0x16c5b
movzbl -0x21(%rbp), %edi
callq 0x4da80
testb $0x1, %al
jne 0x16967
jmp 0x16afd
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rcx
xorl %esi, %esi
movl $0x1, %edx
callq 0x22a20
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rcx
movl $0x2, %esi
movl $0x3, %edx
callq 0x22a20
movzbl -0x21(%rbp), %eax
cmpl $0x5, %eax
je 0x169a8
movzbl -0x21(%rbp), %eax
cmpl $0x9, %eax
jne 0x16a4d
movq -0x8(%rbp), %rdi
leaq 0x5fa32(%rip), %rsi     # 0x763e5
leaq 0x5fa30(%rip), %rdx     # 0x763ea
leaq 0x6018e(%rip), %rcx     # 0x76b4f
leaq 0x60194(%rip), %r8      # 0x76b5c
callq 0x25680
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1f8e0
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl $0x4, %edx
callq 0x1f8e0
movq %rax, -0x80(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x78(%rbp), %rdx
leaq 0x5f9d8(%rip), %rcx     # 0x763e5
callq 0x20080
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x80(%rbp), %rdx
leaq 0x5f9c1(%rip), %rcx     # 0x763ea
callq 0x20080
movq -0x8(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x1fd10
movq -0x8(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x1fd10
jmp 0x16af8
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5f980(%rip), %rcx     # 0x763e5
leaq 0x600e3(%rip), %r8      # 0x76b4f
callq 0x21eb0
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1f8e0
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xc0(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rdi
xorl %edx, %edx
leaq 0x5ee3c(%rip), %rcx     # 0x758f8
movl $0x18de, %r8d           # imm = 0x18DE
movzbl -0x21(%rbp), %esi
callq 0x20d10
movq -0xc8(%rbp), %rdi
movq -0xc0(%rbp), %rsi
movq -0xb8(%rbp), %rdx
movq %rax, %rcx
callq 0x20080
movq -0x8(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0x1fd10
jmp 0x16c59
movzbl -0x21(%rbp), %eax
cmpl $0xa, %eax
jne 0x16b9b
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x60ded(%rip), %rsi     # 0x77906
callq 0x24300
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rdx
leaq 0x61efa(%rip), %rsi     # 0x78a27
callq 0x24300
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
leaq 0x60dc1(%rip), %rdx     # 0x77906
leaq 0x61edb(%rip), %rcx     # 0x78a27
callq 0x24120
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1f8e0
movq %rax, -0x90(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x90(%rbp), %rdx
leaq 0x60d85(%rip), %rcx     # 0x77906
callq 0x23420
movq -0x8(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0x1fd10
jmp 0x16c57
movzbl -0x21(%rbp), %eax
cmpl $0xb, %eax
jne 0x16c36
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x60d4f(%rip), %rsi     # 0x77906
callq 0x24300
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rdx
leaq 0x61e5c(%rip), %rsi     # 0x78a27
callq 0x24300
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
leaq 0x60d23(%rip), %rdx     # 0x77906
leaq 0x61e3d(%rip), %rcx     # 0x78a27
callq 0x24210
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1f8e0
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x98(%rbp), %rdx
leaq 0x60ce7(%rip), %rcx     # 0x77906
callq 0x236a0
movq -0x8(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x1fd10
jmp 0x16c55
leaq 0x5c81d(%rip), %rdi     # 0x7345a
leaq 0x5ecb4(%rip), %rsi     # 0x758f8
movl $0x1920, %edx           # imm = 0x1920
leaq 0x61d78(%rip), %rcx     # 0x789c8
callq 0x30a0
jmp 0x16c57
jmp 0x16c59
jmp 0x16c5b
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)