// File: /workspace/github_c_makefile_star2_O1/Ihsoh[P]ilang/compiler/frontend/irgen.c
// Function: ir_expr_cond
static bool _ir_expr_cond(
	IRGeneratorContext *ctx,
	ResizableString *rstr,
	_ExprResult *expr_result,
	ParserASTNode *node
) {
	assert(ctx);
	assert(rstr);
	assert(expr_result);
	assert(node);

	if (node->type == FE_NODE_EXPR_COND) {
		assert(node->nchilds == 3);

		ParserASTNode *node_expr_cond = node->childs[0];
		ParserASTNode *node_expr_true = node->childs[1];
		ParserASTNode *node_expr_false = node->childs[2];

		ParserASTNode *node_target_type = FE_EXPR_AST_NODE_GET_TYPE_NODE(node);

		_TMP_LABEL_DEF(ctx, expr_true)
		_TMP_LABEL_DEF(ctx, expr_false)
		_TMP_LABEL_DEF(ctx, end)

		ResizableString rstr_result;
		rstr_init(&rstr_result);
		_generate_func_tmp_var(
			ctx,
			ctx->func_symbol,
			&rstr_result,
			node_target_type
		);

		_ExprResult result_expr_cond;
		_expr_result_init(&result_expr_cond);

		_ir_expr(ctx, rstr, &result_expr_cond, node_expr_cond);
		rstr_append_with_rstr(rstr, &(result_expr_cond.rstr_for_result_ptr));
		rstr_append_with_rstr(rstr, &(result_expr_cond.rstr_for_result));

		ResizableString rstr_expr_cond;
		rstr_init(&rstr_expr_cond);
		_ir_cond_expr_with_rstr(ctx, rstr, &rstr_expr_cond, &result_expr_cond, node_expr_cond);

		// 根据条件表达式选择执行expr_true块还是expr_false块。
		rstr_appendf(
			rstr,
			"cbr %s, %s, %s;\n",
			RSTR_CSTR(&rstr_expr_cond),
			_TMP_LABEL_CSTR(expr_true),
			_TMP_LABEL_CSTR(expr_false)
		);

		rstr_appendf(
			rstr,
			"%s:\n",
			_TMP_LABEL_CSTR(expr_true)
		);

		// expr_true块的代码。
		_ExprResult result_expr_true;
		_expr_result_init(&result_expr_true);

		_ir_expr(ctx, rstr, &result_expr_true, node_expr_true);
		rstr_append_with_rstr(rstr, &(result_expr_true.rstr_for_result_ptr));
		rstr_append_with_rstr(rstr, &(result_expr_true.rstr_for_result));

		_ExprResult result_expr_true_casted;
		_expr_result_init(&result_expr_true_casted);

		_expr_result_cast(
			ctx,
			&result_expr_true_casted,
			node_target_type,
			&result_expr_true,
			FE_EXPR_AST_NODE_GET_TYPE_NODE(node_expr_true)
		);
		rstr_append_with_rstr(rstr, &(result_expr_true_casted.rstr_for_result_ptr));
		rstr_append_with_rstr(rstr, &(result_expr_true_casted.rstr_for_result));

		rstr_appendf(
			rstr,
			"assign %s, %s;\n",
			RSTR_CSTR(&rstr_result),
			RSTR_CSTR(&(result_expr_true_casted.rstr_result))
		);

		rstr_appendf(
			rstr,
			"br %s;\n",
			_TMP_LABEL_CSTR(end)
		);

		rstr_appendf(
			rstr,
			"%s:\n",
			_TMP_LABEL_CSTR(expr_false)
		);

		// expr_false块的代码。
		_ExprResult result_expr_false;
		_expr_result_init(&result_expr_false);

		_ir_expr(ctx, rstr, &result_expr_false, node_expr_false);
		rstr_append_with_rstr(rstr, &(result_expr_false.rstr_for_result_ptr));
		rstr_append_with_rstr(rstr, &(result_expr_false.rstr_for_result));

		_ExprResult result_expr_false_casted;
		_expr_result_init(&result_expr_false_casted);

		_expr_result_cast(
			ctx,
			&result_expr_false_casted,
			node_target_type,
			&result_expr_false,
			FE_EXPR_AST_NODE_GET_TYPE_NODE(node_expr_false)
		);
		rstr_append_with_rstr(rstr, &(result_expr_false_casted.rstr_for_result_ptr));
		rstr_append_with_rstr(rstr, &(result_expr_false_casted.rstr_for_result));

		rstr_appendf(
			rstr,
			"assign %s, %s;\n",
			RSTR_CSTR(&rstr_result),
			RSTR_CSTR(&(result_expr_false_casted.rstr_result))
		);

		rstr_appendf(
			rstr,
			"%s:\n",
			_TMP_LABEL_CSTR(end)
		);

		_expr_result_set_result(
			expr_result,
			RSTR_CSTR(&rstr_result)
		);

		_TMP_LABEL_FREE(expr_true)
		_TMP_LABEL_FREE(expr_false)
		_TMP_LABEL_FREE(end)

		rstr_free(&rstr_result);

		_expr_result_free(&result_expr_cond);
		_expr_result_free(&result_expr_true);
		_expr_result_free(&result_expr_true_casted);
		_expr_result_free(&result_expr_false);
		_expr_result_free(&result_expr_false_casted);

		rstr_free(&rstr_expr_cond);

		return true;
	} else {
		return false;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movl (%rcx), %eax
cmpl $0xecd, %eax            # imm = 0xECD
jne 0x107ad
movq %rdx, -0x50(%rbp)
movl %eax, -0x2c(%rbp)
cmpl $0x3, 0x44(%rcx)
jne 0x107c7
movq %rsi, %r15
movq %rdi, %r13
movq 0x48(%rcx), %rax
movq 0x68(%rcx), %r14
movq %r14, -0x38(%rbp)
movq (%rax), %r12
movq 0x8(%rax), %rcx
movq %rcx, -0x40(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
leaq -0x90(%rbp), %rbx
movq %rbx, %rdi
callq 0x7548
movq 0x40(%r13), %rdi
movq %rbx, %rsi
callq 0x10e32
leaq -0x60(%rbp), %rbx
movq %rbx, %rdi
callq 0x7548
movq 0x40(%r13), %rdi
movq %rbx, %rsi
callq 0x10e32
leaq -0x80(%rbp), %rbx
movq %rbx, %rdi
callq 0x7548
movq 0x40(%r13), %rdi
movq %rbx, %rsi
callq 0x10e32
leaq -0x70(%rbp), %rbx
movq %rbx, %rdi
callq 0x7548
movq 0x40(%r13), %rsi
movq %r13, %rdi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x10e9c
leaq -0x1a0(%rbp), %r14
movq %r14, %rdi
callq 0xd03d
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0xde8a
leaq -0x190(%rbp), %rsi
movq %r15, %rdi
callq 0x788c
movq %r15, %rdi
movq %r14, %rsi
callq 0x788c
leaq -0xa0(%rbp), %rbx
movq %rbx, %rdi
callq 0x7548
movq %r13, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq %r12, %r8
callq 0x128cf
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
leaq 0x339b0(%rip), %rax     # 0x43eba
cmoveq %rax, %rdx
leaq -0x90(%rbp), %r14
movq 0x8(%r14), %rcx
testq %rcx, %rcx
cmoveq %rax, %rcx
leaq -0x60(%rbp), %rsi
movq 0x8(%rsi), %r8
testq %r8, %r8
cmoveq %rax, %r8
movq %rax, %rbx
leaq 0x335c6(%rip), %rsi     # 0x43aff
movq %r15, %rdi
xorl %eax, %eax
callq 0x7b31
movq 0x8(%r14), %rdx
testq %rdx, %rdx
cmoveq %rbx, %rdx
leaq 0x3677a(%rip), %rsi     # 0x46ccf
movq %r15, %rdi
xorl %eax, %eax
callq 0x7b31
leaq -0x160(%rbp), %r14
movq %r14, %rdi
callq 0xd03d
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq -0x40(%rbp), %rbx
movq %rbx, %rcx
callq 0xde8a
leaq -0x150(%rbp), %rsi
movq %r15, %rdi
callq 0x788c
movq %r15, %rdi
movq %r14, %rsi
callq 0x788c
leaq -0x120(%rbp), %r12
movq %r12, %rdi
callq 0xd03d
movq 0x68(%rbx), %r8
movq %r13, %rdi
movq %r12, %rsi
movq -0x38(%rbp), %rdx
movq %r14, %rcx
callq 0xd093
leaq -0x110(%rbp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0x788c
movq %r15, %rdi
movq %r12, %rsi
callq 0x788c
leaq -0x70(%rbp), %rax
movq 0x8(%rax), %rdx
testq %rdx, %rdx
leaq 0x338c9(%rip), %rbx     # 0x43eba
cmoveq %rbx, %rdx
movq 0x18(%r14), %rcx
testq %rcx, %rcx
cmoveq %rbx, %rcx
leaq 0x31fe3(%rip), %rsi     # 0x425ea
movq %r15, %rdi
xorl %eax, %eax
callq 0x7b31
leaq -0x80(%rbp), %rax
movq 0x8(%rax), %rdx
testq %rdx, %rdx
cmoveq %rbx, %rdx
leaq 0x334e9(%rip), %rsi     # 0x43b10
movq %r15, %rdi
xorl %eax, %eax
callq 0x7b31
leaq -0x60(%rbp), %rax
movq 0x8(%rax), %rdx
testq %rdx, %rdx
cmoveq %rbx, %rdx
movq %r15, %rdi
leaq 0x36685(%rip), %rsi     # 0x46ccf
xorl %eax, %eax
callq 0x7b31
leaq -0xe0(%rbp), %rbx
movq %rbx, %rdi
callq 0xd03d
movq %r13, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq -0x48(%rbp), %r12
movq %r12, %rcx
callq 0xde8a
leaq -0xd0(%rbp), %rsi
movq %r15, %rdi
callq 0x788c
movq %r15, %rdi
movq %rbx, %rsi
callq 0x788c
leaq -0x1e0(%rbp), %r14
movq %r14, %rdi
callq 0xd03d
movq 0x68(%r12), %r8
movq %r13, %rdi
movq %r14, %rsi
movq -0x38(%rbp), %rdx
movq %rbx, %rcx
callq 0xd093
leaq -0x1d0(%rbp), %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x788c
movq %r15, %rdi
movq %r14, %rsi
callq 0x788c
leaq -0x70(%rbp), %r12
movq 0x8(%r12), %rdx
testq %rdx, %rdx
leaq 0x337d5(%rip), %rax     # 0x43eba
cmoveq %rax, %rdx
movq 0x18(%r13), %rcx
testq %rcx, %rcx
cmoveq %rax, %rcx
movq %rax, %rbx
movq %r15, %rdi
leaq 0x31ee9(%rip), %rsi     # 0x425ea
xorl %eax, %eax
callq 0x7b31
leaq -0x80(%rbp), %r13
movq 0x8(%r13), %rdx
testq %rdx, %rdx
cmoveq %rbx, %rdx
movq %r15, %rdi
leaq 0x365ae(%rip), %rsi     # 0x46ccf
xorl %eax, %eax
callq 0x7b31
movq 0x8(%r12), %rsi
testq %rsi, %rsi
cmoveq %rbx, %rsi
movq -0x50(%rbp), %rdi
addq $0x20, %rdi
callq 0x75cf
leaq -0x90(%rbp), %rdi
callq 0x7a38
leaq -0x60(%rbp), %rdi
callq 0x7a38
movq %r13, %rdi
callq 0x7a38
movq %r12, %rdi
callq 0x7a38
leaq -0x1a0(%rbp), %rdi
callq 0xd787
leaq -0x160(%rbp), %rdi
callq 0xd787
leaq -0x120(%rbp), %rdi
callq 0xd787
leaq -0xe0(%rbp), %rdi
callq 0xd787
movq %r14, %rdi
callq 0xd787
leaq -0xa0(%rbp), %rdi
callq 0x7a38
movl -0x2c(%rbp), %eax
cmpl $0xecd, %eax            # imm = 0xECD
sete %al
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x334b0(%rip), %rdi     # 0x43c7e
leaq 0x31b43(%rip), %rsi     # 0x42318
leaq 0x33445(%rip), %rcx     # 0x43c21
movl $0xcf2, %edx            # imm = 0xCF2
callq 0x30a0