// File: /workspace/github_c_makefile_star2_O1/Ihsoh[P]ilang/compiler/frontend/irgen_llvmir.c
// Function: ir_expr_mul
static void _ir_expr_mul(
	IRGeneratorLlvmirContext *ctx,
	ResizableString *rstr,
	ResizableString *rstr_result_lhs_ptr,
	_ExprResult *expr_result,
	ParserASTNode *node
) {
	assert(ctx);
	assert(rstr);
	assert(expr_result);
	assert(node);
	assert(node->type == FE_NODE_EXPR_MUL
			|| node->type == FE_NODE_EXPR_MUL_ASSIGN);

	ParserSymbol *func_symbol = ctx->func_symbol;
	assert(func_symbol);

	ParserASTNode *node_type = FE_EXPR_AST_NODE_GET_TYPE_NODE(node);
	uint8_t type = FE_EXPR_AST_NODE_GET_TYPE(node);

	ParserASTNode *node_lhs = node->childs[0];
	ParserASTNode *node_rhs = node->childs[1];

	_ExprResult result_lhs;
	_ExprResult result_rhs;
	_ExprResult result_lhs_casted;
	_ExprResult result_rhs_casted;

	_expr_result_init(&result_lhs);
	_expr_result_init(&result_rhs);
	_expr_result_init(&result_lhs_casted);
	_expr_result_init(&result_rhs_casted);

	_ir_expr(ctx, rstr, &result_lhs, node_lhs);
	rstr_append_with_rstr(rstr, &(result_lhs.rstr_for_result_ptr));
	rstr_append_with_rstr(rstr, &(result_lhs.rstr_for_result));

	if (rstr_result_lhs_ptr != NULL) {
		rstr_append_with_rstr(
			rstr_result_lhs_ptr,
			&(result_lhs.rstr_result_ptr)
		);
	}

	_ir_expr(ctx, rstr, &result_rhs, node_rhs);
	rstr_append_with_rstr(rstr, &(result_rhs.rstr_for_result_ptr));
	rstr_append_with_rstr(rstr, &(result_rhs.rstr_for_result));

	_expr_result_cast(
		ctx,
		&result_lhs_casted,
		node_type,
		&result_lhs,
		FE_EXPR_AST_NODE_GET_TYPE_NODE(node_lhs)
	);
	rstr_append_with_rstr(rstr, &(result_lhs_casted.rstr_for_result_ptr));
	rstr_append_with_rstr(rstr, &(result_lhs_casted.rstr_for_result));

	_expr_result_cast(
		ctx,
		&result_rhs_casted,
		node_type,
		&result_rhs,
		FE_EXPR_AST_NODE_GET_TYPE_NODE(node_rhs)
	);
	rstr_append_with_rstr(rstr, &(result_rhs_casted.rstr_for_result_ptr));
	rstr_append_with_rstr(rstr, &(result_rhs_casted.rstr_for_result));

	ResizableString rstr_tmp_label_val;
	rstr_init(&rstr_tmp_label_val);
	_generate_func_tmp(ctx, func_symbol, &rstr_tmp_label_val);

	if (fe_sem_is_signed_type(type)) {
		rstr_appendf(
			&(expr_result->rstr_for_result),
			"%s = mul nsw %s, %s\n",
			RSTR_CSTR(&rstr_tmp_label_val),
			RSTR_CSTR(&(result_lhs_casted.rstr_result)),
			RSTR_CSTR(&(result_rhs_casted.rstr_result_val))
		);
	} else if (fe_sem_is_unsigned_type(type)) {
		rstr_appendf(
			&(expr_result->rstr_for_result),
			"%s = mul %s, %s\n",
			RSTR_CSTR(&rstr_tmp_label_val),
			RSTR_CSTR(&(result_lhs_casted.rstr_result)),
			RSTR_CSTR(&(result_rhs_casted.rstr_result_val))
		);
	} else if (fe_sem_is_float_type(type)) {
		rstr_appendf(
			&(expr_result->rstr_for_result),
			"%s = fmul %s, %s\n",
			RSTR_CSTR(&rstr_tmp_label_val),
			RSTR_CSTR(&(result_lhs_casted.rstr_result)),
			RSTR_CSTR(&(result_rhs_casted.rstr_result_val))
		);
	} else {
		assert(0);
	}
	_expr_result_set_result(
		expr_result,
		RSTR_CSTR(&(result_lhs_casted.rstr_result_type)),
		RSTR_CSTR(&rstr_tmp_label_val)
	);

	_expr_result_free(&result_lhs);
	_expr_result_free(&result_rhs);
	_expr_result_free(&result_lhs_casted);
	_expr_result_free(&result_rhs_casted);
	rstr_free(&rstr_tmp_label_val);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
testq %rcx, %rcx
je 0x1e6c6
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r15
movl (%r8), %eax
cmpl $0xe13, %eax            # imm = 0xE13
je 0x1e45e
cmpl $0xeb0, %eax            # imm = 0xEB0
jne 0x1e704
movq %rcx, -0x48(%rbp)
movq 0x40(%r15), %rax
movq %rax, -0x50(%rbp)
testq %rax, %rax
je 0x1e6e5
movq 0x68(%r8), %rax
movq %rax, -0x40(%rbp)
movb 0x60(%r8), %al
movb %al, -0x29(%rbp)
movq 0x48(%r8), %rax
movq (%rax), %rbx
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
leaq -0x160(%rbp), %r13
movq %r13, %rdi
callq 0x19eca
leaq -0xe0(%rbp), %rdi
callq 0x19eca
leaq -0x260(%rbp), %rdi
callq 0x19eca
leaq -0x1e0(%rbp), %rdi
callq 0x19eca
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x1ad56
leaq -0x150(%rbp), %rsi
movq %r14, %rdi
callq 0x788c
movq %r14, %rdi
movq %r13, %rsi
callq 0x788c
testq %r12, %r12
je 0x1e503
leaq -0x110(%rbp), %rsi
movq %r12, %rdi
callq 0x788c
leaq -0xe0(%rbp), %r13
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq -0x38(%rbp), %r12
movq %r12, %rcx
callq 0x1ad56
leaq -0xd0(%rbp), %rsi
movq %r14, %rdi
callq 0x788c
movq %r14, %rdi
movq %r13, %rsi
callq 0x788c
movq 0x68(%rbx), %r8
leaq -0x260(%rbp), %rbx
leaq -0x160(%rbp), %rcx
movq %r15, %rdi
movq %rbx, %rsi
movq -0x40(%rbp), %r13
movq %r13, %rdx
callq 0x19f71
leaq -0x250(%rbp), %rsi
movq %r14, %rdi
callq 0x788c
movq %r14, %rdi
movq %rbx, %rsi
callq 0x788c
movq 0x68(%r12), %r8
leaq -0x1e0(%rbp), %rbx
movq %r15, %rdi
movq %rbx, %rsi
movq %r13, %rdx
leaq -0xe0(%rbp), %rcx
callq 0x19f71
leaq -0x1d0(%rbp), %rsi
movq %r14, %rdi
callq 0x788c
movq %r14, %rdi
movq %rbx, %rsi
callq 0x788c
leaq -0x60(%rbp), %rbx
movq %rbx, %rdi
callq 0x7548
movq -0x50(%rbp), %rcx
movl 0x54(%rcx), %edx
leal 0x1(%rdx), %eax
movl %eax, 0x54(%rcx)
leaq 0x27ac8(%rip), %rsi     # 0x4609a
movq %rbx, %rdi
xorl %eax, %eax
callq 0x7b31
movzbl -0x29(%rbp), %ebx
movl %ebx, %edi
callq 0x2ad2f
testb %al, %al
je 0x1e5f4
leaq 0x27e6d(%rip), %rsi     # 0x4645f
jmp 0x1e61e
movl %ebx, %edi
callq 0x2ad3f
testb %al, %al
je 0x1e608
leaq 0x27e6e(%rip), %rsi     # 0x46474
jmp 0x1e61e
movl %ebx, %edi
callq 0x2ad60
testb %al, %al
je 0x1e723
leaq 0x27e67(%rip), %rsi     # 0x46485
leaq -0x60(%rbp), %rbx
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
leaq 0x2588a(%rip), %r12     # 0x43eba
cmoveq %r12, %rdx
leaq -0x260(%rbp), %r14
movq 0x28(%r14), %rcx
testq %rcx, %rcx
cmoveq %r12, %rcx
leaq -0x1e0(%rbp), %r15
movq 0x48(%r15), %r8
testq %r8, %r8
cmoveq %r12, %r8
movq -0x48(%rbp), %r13
movq %r13, %rdi
xorl %eax, %eax
callq 0x7b31
movq 0x38(%r14), %rsi
testq %rsi, %rsi
cmoveq %r12, %rsi
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
cmoveq %r12, %rdx
movq %r13, %rdi
callq 0x1e280
leaq -0x160(%rbp), %rdi
callq 0x1a7ab
leaq -0xe0(%rbp), %rdi
callq 0x1a7ab
movq %r14, %rdi
callq 0x1a7ab
movq %r15, %rdi
callq 0x1a7ab
movq %rbx, %rdi
callq 0x7a38
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x244bb(%rip), %rdi     # 0x42b88
leaq 0x271a0(%rip), %rsi     # 0x45874
leaq 0x27d10(%rip), %rcx     # 0x463eb
movl $0xb33, %edx            # imm = 0xB33
callq 0x30a0
leaq 0x2582f(%rip), %rdi     # 0x43f1b
leaq 0x27181(%rip), %rsi     # 0x45874
leaq 0x27cf1(%rip), %rcx     # 0x463eb
movl $0xb39, %edx            # imm = 0xB39
callq 0x30a0
leaq 0x24b16(%rip), %rdi     # 0x43221
leaq 0x27162(%rip), %rsi     # 0x45874
leaq 0x27cd2(%rip), %rcx     # 0x463eb
movl $0xb36, %edx            # imm = 0xB36
callq 0x30a0
leaq 0x21c5a(%rip), %rdi     # 0x40384
leaq 0x27143(%rip), %rsi     # 0x45874
leaq 0x27cb3(%rip), %rcx     # 0x463eb
movl $0xb8b, %edx            # imm = 0xB8B
callq 0x30a0