// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/backend/asmgen_gas32.c
// Function: asm_stat_mul
static void _asm_stat_mul(
	ASMGeneratorGas32Context *ctx,
	ParserASTNode *node
) {
	assert(ctx);
	assert(node);
	assert(node->type == BE_NODE_STAT_MUL);
	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 (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) {
			if (type_target == BE_TYPE_INT64) {
				_push_func_call_arg32(ctx, ctx->body, _ASM_REG_NAME_EDX);
				_push_func_call_arg32(ctx, ctx->body, _ASM_REG_NAME_ECX);
				_push_func_call_arg32(ctx, ctx->body, _ASM_REG_NAME_EBX);
				_push_func_call_arg32(ctx, ctx->body, _ASM_REG_NAME_EAX);

				_asm_inst_call_x(
					ctx,
					ctx->body,
					"___rt_mul_i64"
				);

				_release_func_call_arg_space(ctx, ctx->body, 4 * 8);
			} else if (type_target == BE_TYPE_UINT64) {
				_push_func_call_arg32(ctx, ctx->body, _ASM_REG_NAME_EDX);
				_push_func_call_arg32(ctx, ctx->body, _ASM_REG_NAME_ECX);
				_push_func_call_arg32(ctx, ctx->body, _ASM_REG_NAME_EBX);
				_push_func_call_arg32(ctx, ctx->body, _ASM_REG_NAME_EAX);

				_asm_inst_call_x(
					ctx,
					ctx->body,
					"___rt_mul_u64"
				);

				_release_func_call_arg_space(ctx, ctx->body, 4 * 8);
			} else {
				assert(0);
			}
			
			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_imul_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_mulss_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_mulsd_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 $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1722c
jmp 0x1724b
leaq 0x68f2e(%rip), %rdi     # 0x80161
leaq 0x5e6be(%rip), %rsi     # 0x758f8
movl $0x1a0e, %edx           # imm = 0x1A0E
leaq 0x61c50(%rip), %rcx     # 0x78e96
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x17254
jmp 0x17273
leaq 0x5f301(%rip), %rdi     # 0x7655c
leaq 0x5e696(%rip), %rsi     # 0x758f8
movl $0x1a0f, %edx           # imm = 0x1A0F
leaq 0x61c28(%rip), %rcx     # 0x78e96
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xbe2, (%rax)          # imm = 0xBE2
jne 0x17281
jmp 0x172a0
leaq 0x61c4e(%rip), %rdi     # 0x78ed6
leaq 0x5e669(%rip), %rsi     # 0x758f8
movl $0x1a10, %edx           # imm = 0x1A10
leaq 0x61bfb(%rip), %rcx     # 0x78e96
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0x3, 0x44(%rax)
jne 0x172ac
jmp 0x172cb
leaq 0x5fe8b(%rip), %rdi     # 0x7713e
leaq 0x5e63e(%rip), %rsi     # 0x758f8
movl $0x1a11, %edx           # imm = 0x1A11
leaq 0x61bd0(%rip), %rcx     # 0x78e96
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 0x172e8
jmp 0x17307
leaq 0x5f0ce(%rip), %rdi     # 0x763bd
leaq 0x5e602(%rip), %rsi     # 0x758f8
movl $0x1a14, %edx           # imm = 0x1A14
leaq 0x61b94(%rip), %rcx     # 0x78e96
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), %edi
callq 0x4da80
testb $0x1, %al
jne 0x17354
jmp 0x17608
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 0x17395
movzbl -0x21(%rbp), %eax
cmpl $0x9, %eax
jne 0x17573
movzbl -0x21(%rbp), %eax
cmpl $0x5, %eax
jne 0x17435
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
leaq 0x5f7a7(%rip), %rdx     # 0x76b5c
callq 0x25fc0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
leaq 0x5f782(%rip), %rdx     # 0x76b4f
callq 0x25fc0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
leaq 0x5f005(%rip), %rdx     # 0x763ea
callq 0x25fc0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
leaq 0x5efe8(%rip), %rdx     # 0x763e5
callq 0x25fc0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
leaq 0x61ae0(%rip), %rdx     # 0x78ef5
callq 0x25340
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x20, %edx
callq 0x26010
jmp 0x174f3
movzbl -0x21(%rbp), %eax
cmpl $0x9, %eax
jne 0x174d2
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
leaq 0x5f707(%rip), %rdx     # 0x76b5c
callq 0x25fc0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
leaq 0x5f6e2(%rip), %rdx     # 0x76b4f
callq 0x25fc0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
leaq 0x5ef65(%rip), %rdx     # 0x763ea
callq 0x25fc0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
leaq 0x5ef48(%rip), %rdx     # 0x763e5
callq 0x25fc0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
leaq 0x61a4e(%rip), %rdx     # 0x78f03
callq 0x25340
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x20, %edx
callq 0x26010
jmp 0x174f1
leaq 0x5bf81(%rip), %rdi     # 0x7345a
leaq 0x5e418(%rip), %rsi     # 0x758f8
movl $0x1a46, %edx           # imm = 0x1A46
leaq 0x619aa(%rip), %rcx     # 0x78e96
callq 0x30a0
jmp 0x174f3
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1f8e0
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl $0x4, %edx
callq 0x1f8e0
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x40(%rbp), %rdx
leaq 0x5eeb2(%rip), %rcx     # 0x763e5
callq 0x20080
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x48(%rbp), %rdx
leaq 0x5ee9b(%rip), %rcx     # 0x763ea
callq 0x20080
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x1fd10
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x1fd10
jmp 0x17603
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5ee5a(%rip), %rcx     # 0x763e5
leaq 0x5f5bd(%rip), %r8      # 0x76b4f
callq 0x260a0
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1f8e0
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
xorl %edx, %edx
leaq 0x5e325(%rip), %rcx     # 0x758f8
movl $0x1a6b, %r8d           # imm = 0x1A6B
movzbl -0x21(%rbp), %esi
callq 0x20d10
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq %rax, %rcx
callq 0x20080
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x1fd10
jmp 0x17752
movzbl -0x21(%rbp), %eax
cmpl $0xa, %eax
jne 0x1769d
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x602e2(%rip), %rsi     # 0x77906
callq 0x24300
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rdx
leaq 0x613ef(%rip), %rsi     # 0x78a27
callq 0x24300
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
leaq 0x602b6(%rip), %rdx     # 0x77906
leaq 0x613d0(%rip), %rcx     # 0x78a27
callq 0x261e0
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1f8e0
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x58(%rbp), %rdx
leaq 0x60280(%rip), %rcx     # 0x77906
callq 0x23420
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x1fd10
jmp 0x17750
movzbl -0x21(%rbp), %eax
cmpl $0xb, %eax
jne 0x1772f
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x6024d(%rip), %rsi     # 0x77906
callq 0x24300
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rdx
leaq 0x6135a(%rip), %rsi     # 0x78a27
callq 0x24300
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
leaq 0x60221(%rip), %rdx     # 0x77906
leaq 0x6133b(%rip), %rcx     # 0x78a27
callq 0x262d0
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1f8e0
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x60(%rbp), %rdx
leaq 0x601eb(%rip), %rcx     # 0x77906
callq 0x236a0
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x1fd10
jmp 0x1774e
leaq 0x5bd24(%rip), %rdi     # 0x7345a
leaq 0x5e1bb(%rip), %rsi     # 0x758f8
movl $0x1aad, %edx           # imm = 0x1AAD
leaq 0x6174d(%rip), %rcx     # 0x78e96
callq 0x30a0
jmp 0x17750
jmp 0x17752
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)