// File: /workspace/github_c_makefile_star2_O3/Ihsoh[P]ilang/compiler/frontend/semantics.c
// Function: expr_cond
static void _expr_cond(
	ParserContext *ctx,
	ParserASTNode *node
) {
	assert(ctx);
	assert(node);

	uint32_t node_type = node->type;

	switch (node_type) {
		case FE_NODE_EXPR_COND: {
			assert(node->nchilds == 3);

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

			_expr_or(ctx, node_expr);
			_expr(ctx, node_expr_true);
			_expr(ctx, node_expr_false);

			ParserASTNode *node_expr_true_type = FE_EXPR_AST_NODE_GET_TYPE_NODE(node_expr_true);
			ParserASTNode *node_expr_false_type = FE_EXPR_AST_NODE_GET_TYPE_NODE(node_expr_false);

			if (!_is_integer_type_node(ctx, node_expr)
					&& !_is_pointer_type_node(ctx, node_expr)) {
				_SYNERR_NODE(
					ctx,
					node,
					"conditional operator condexpr type must be primitive type or pointer type."
				);
			}

			if (_is_primitive_type_node(ctx, node_expr_true)
					&& _is_compatible_type(ctx, node_expr_true_type, node_expr_false_type, false)) {
				int32_t weight_node_expr_true = _get_primitive_type_weight_by_expr_node(ctx, node_expr_true);
				int32_t weight_node_expr_false = _get_primitive_type_weight_by_expr_node(ctx, node_expr_false);
				if (weight_node_expr_true > weight_node_expr_false) {
					FE_EXPR_AST_NODE_COPY(node, node_expr_true);
				} else {
					FE_EXPR_AST_NODE_COPY(node, node_expr_false);
				}
			} else if (_is_pointer_type_node(ctx, node_expr_true)
					&& _is_compatible_type(ctx, node_expr_true_type, node_expr_false_type, true)) {
				FE_EXPR_AST_NODE_COPY(node, node_expr_true);
			} else {
				_SYNERR_NODE(
					ctx,
					node,
					"conditional operator do not support this operand combination."
				);
			}

			FE_EXPR_AST_NODE_COPY_CONSTANT3(
				node,
				node_expr,
				node_expr_true,
				node_expr_false
			);
			if (FE_EXPR_AST_NODE_GET_CONSTANT(node)) {
				_calc_cond_constexpr(ctx, node, node_expr, node_expr_true, node_expr_false);
			}

			break;
		}
		default: {
			_expr_or(ctx, node);
			break;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x428, %rsp            # imm = 0x428
testq %rsi, %rsi
je 0x2c8ec
movq %rsi, %rbx
movq %rdi, %r12
cmpl $0xecd, (%rsi)          # imm = 0xECD
jne 0x2c71d
cmpl $0x3, 0x44(%rbx)
jne 0x2c90b
movq 0x48(%rbx), %rax
movq (%rax), %r13
movq 0x8(%rax), %r15
movq 0x10(%rax), %r14
movq %r12, %rdi
movq %r13, %rsi
callq 0x2d4e8
movq %r12, %rdi
movq %r15, %rsi
callq 0x2b6a7
movq %r12, %rdi
movq %r14, %rsi
callq 0x2b6a7
movq 0x68(%r15), %rax
movq %rax, -0x38(%rbp)
movq %r14, -0x30(%rbp)
movq 0x68(%r14), %rax
movq %rax, -0x40(%rbp)
movq %r13, %rdi
callq 0x2d683
testb %al, %al
jne 0x2c6b1
movq %r13, %rdi
callq 0x2d6e4
testb %al, %al
jne 0x2c6b1
leaq 0x1e926(%rip), %rsi     # 0x4afb5
leaq -0x450(%rbp), %r14
movl $0x4b, %edx
movq %r14, %rdi
callq 0x3110
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq *0x58(%r12)
leaq 0x60(%r15), %r14
movq %r15, %rdi
callq 0x2d742
testb %al, %al
je 0x2c739
movq %r12, %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
xorl %ecx, %ecx
callq 0x2a4b9
testb %al, %al
je 0x2c739
movq %r13, -0x38(%rbp)
movq -0x30(%rbp), %rax
leaq 0x60(%rax), %r13
movzbl (%r14), %edi
callq 0x2a3cd
movl %eax, -0x40(%rbp)
movq %r13, -0x48(%rbp)
movzbl (%r13), %edi
callq 0x2a3cd
leaq 0x60(%rbx), %rcx
cmpl %eax, -0x40(%rbp)
jbe 0x2c7c9
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
jmp 0x2c7d8
movq %r12, %rdi
movq %rbx, %rsi
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2d4e8
movzbl 0x1(%r15), %eax
shll $0x8, %eax
cmpl $0xe00, %eax            # imm = 0xE00
jne 0x2c92a
cmpb $0x10, (%r14)
jne 0x2c78a
movq %r12, %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movl $0x1, %ecx
callq 0x2a4b9
testb %al, %al
je 0x2c78a
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups %xmm2, 0x80(%rbx)
movups %xmm1, 0x70(%rbx)
movups %xmm0, 0x60(%rbx)
jmp 0x2c7e7
movups 0x1e89d(%rip), %xmm0    # 0x4b02e
leaq -0x450(%rbp), %rdx
movups %xmm0, 0x2e(%rdx)
movups 0x1e87d(%rip), %xmm0    # 0x4b020
movaps %xmm0, 0x20(%rdx)
movups 0x1e862(%rip), %xmm0    # 0x4b010
movaps %xmm0, 0x10(%rdx)
movups 0x1e847(%rip), %xmm0    # 0x4b000
movaps %xmm0, (%rdx)
movq %r12, %rdi
movq %rbx, %rsi
callq *0x58(%r12)
jmp 0x2c7e7
movq -0x48(%rbp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x20(%rcx)
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
movq -0x38(%rbp), %r13
cmpb $0x1, 0x70(%r13)
jne 0x2c890
cmpb $0x1, 0x70(%r15)
jne 0x2c890
movq -0x30(%rbp), %rax
movb 0x70(%rax), %al
movb %al, 0x70(%rbx)
cmpb $0x1, %al
jne 0x2c894
movzbl 0x1(%r13), %eax
shll $0x8, %eax
cmpl $0xe00, %eax            # imm = 0xE00
jne 0x2c949
cmpb $0x0, 0x70(%r13)
je 0x2c968
movzbl 0x1(%r15), %eax
shll $0x8, %eax
cmpl $0xe00, %eax            # imm = 0xE00
jne 0x2c987
cmpb $0x0, 0x70(%r15)
je 0x2c9a6
movq -0x30(%rbp), %rax
movzbl 0x1(%rax), %eax
shll $0x8, %eax
cmpl $0xe00, %eax            # imm = 0xE00
jne 0x2c9c5
movq %r15, %rdi
callq 0x2d742
testb %al, %al
je 0x2c8a6
movq %r13, %rdi
callq 0x32780
testb %al, %al
movq -0x30(%rbp), %rcx
cmovneq %r15, %rcx
movzbl 0x60(%rbx), %esi
movq %r12, %rdi
movq %rbx, %rdx
callq 0x30d23
jmp 0x2c894
movb $0x0, 0x70(%rbx)
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movzbl 0x1(%r15), %eax
shll $0x8, %eax
cmpl $0xe00, %eax            # imm = 0xE00
jne 0x2c92a
cmpb $0x10, (%r14)
jne 0x2c9e4
movq %r13, %rdi
callq 0x32780
testb %al, %al
je 0x2c8d4
movq 0x88(%r15), %rax
jmp 0x2c8df
movq -0x30(%rbp), %rax
movq 0x88(%rax), %rax
movq %rax, 0x88(%rbx)
movb $0x10, 0x71(%rbx)
jmp 0x2c894
leaq 0x164ef(%rip), %rdi     # 0x42de2
leaq 0x1e000(%rip), %rsi     # 0x4a8fa
leaq 0x1e682(%rip), %rcx     # 0x4af83
movl $0x1293, %edx           # imm = 0x1293
callq 0x30a0
leaq 0x163b8(%rip), %rdi     # 0x42cca
leaq 0x1dfe1(%rip), %rsi     # 0x4a8fa
leaq 0x1e663(%rip), %rcx     # 0x4af83
movl $0x1299, %edx           # imm = 0x1299
callq 0x30a0
leaq 0x1f166(%rip), %rdi     # 0x4ba97
leaq 0x1dfc2(%rip), %rsi     # 0x4a8fa
leaq 0x1f73f(%rip), %rcx     # 0x4c07e
movl $0x1ff, %edx            # imm = 0x1FF
callq 0x30a0
leaq 0x1f81b(%rip), %rdi     # 0x4c16b
leaq 0x1dfa3(%rip), %rsi     # 0x4a8fa
leaq 0x1f79e(%rip), %rcx     # 0x4c0fc
movl $0xbc6, %edx            # imm = 0xBC6
callq 0x30a0
leaq 0x1f818(%rip), %rdi     # 0x4c187
leaq 0x1df84(%rip), %rsi     # 0x4a8fa
leaq 0x1f77f(%rip), %rcx     # 0x4c0fc
movl $0xbc7, %edx            # imm = 0xBC7
callq 0x30a0
leaq 0x1f2f6(%rip), %rdi     # 0x4bc84
leaq 0x1df65(%rip), %rsi     # 0x4a8fa
leaq 0x1f760(%rip), %rcx     # 0x4c0fc
movl $0xbc9, %edx            # imm = 0xBC9
callq 0x30a0
leaq 0x1f2f6(%rip), %rdi     # 0x4bca3
leaq 0x1df46(%rip), %rsi     # 0x4a8fa
leaq 0x1f741(%rip), %rcx     # 0x4c0fc
movl $0xbca, %edx            # imm = 0xBCA
callq 0x30a0
leaq 0x1f306(%rip), %rdi     # 0x4bcd2
leaq 0x1df27(%rip), %rsi     # 0x4a8fa
leaq 0x1f722(%rip), %rcx     # 0x4c0fc
movl $0xbcc, %edx            # imm = 0xBCC
callq 0x30a0
leaq 0x12975(%rip), %rdi     # 0x3f360
leaq 0x1df08(%rip), %rsi     # 0x4a8fa
leaq 0x1f703(%rip), %rcx     # 0x4c0fc
movl $0xbeb, %edx            # imm = 0xBEB
callq 0x30a0