// File: /workspace/github_c_makefile_star2_O2/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 0x2a6b6
movq %rsi, %rbx
movq %rdi, %r12
cmpl $0xecd, (%rsi)          # imm = 0xECD
jne 0x2a4ff
cmpl $0x3, 0x44(%rbx)
jne 0x2a6d5
movq 0x48(%rbx), %rax
movq (%rax), %r13
movq 0x8(%rax), %r15
movq 0x10(%rax), %r14
movq %r12, %rdi
movq %r13, %rsi
callq 0x2b239
movq %r12, %rdi
movq %r15, %rsi
callq 0x294d8
movq %r12, %rdi
movq %r14, %rsi
callq 0x294d8
movq 0x68(%r15), %rax
movq %rax, -0x38(%rbp)
movq %r14, -0x30(%rbp)
movq 0x68(%r14), %rax
movq %rax, -0x40(%rbp)
movq %r13, %rdi
callq 0x2b3d4
testb %al, %al
jne 0x2a493
movq %r13, %rdi
callq 0x2b435
testb %al, %al
jne 0x2a493
leaq 0x1db82(%rip), %rsi     # 0x47ff5
leaq -0x450(%rbp), %r14
pushq $0x4b
popq %rdx
movq %r14, %rdi
callq 0x3100
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq *0x58(%r12)
leaq 0x60(%r15), %r14
movq %r15, %rdi
callq 0x2b493
testb %al, %al
je 0x2a51b
movq %r12, %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
xorl %ecx, %ecx
callq 0x2834e
testb %al, %al
je 0x2a51b
movq %r13, -0x38(%rbp)
movq -0x30(%rbp), %rax
leaq 0x60(%rax), %r13
movzbl (%r14), %edi
callq 0x28262
movl %eax, -0x40(%rbp)
movq %r13, -0x48(%rbp)
movzbl (%r13), %edi
callq 0x28262
leaq 0x60(%rbx), %rcx
cmpl %eax, -0x40(%rbp)
jbe 0x2a59c
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
jmp 0x2a5ab
movq %r12, %rdi
movq %rbx, %rsi
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2b239
movq %r15, %rdi
callq 0x2b435
testb %al, %al
je 0x2a55d
pushq $0x1
popq %rcx
movq %r12, %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x2834e
testb %al, %al
je 0x2a55d
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups %xmm2, 0x80(%rbx)
movups %xmm1, 0x70(%rbx)
movups %xmm0, 0x60(%rbx)
jmp 0x2a5ba
movups 0x1db0a(%rip), %xmm0    # 0x4806e
leaq -0x450(%rbp), %rdx
movups %xmm0, 0x2e(%rdx)
movups 0x1daea(%rip), %xmm0    # 0x48060
movaps %xmm0, 0x20(%rdx)
movups 0x1dacf(%rip), %xmm0    # 0x48050
movaps %xmm0, 0x10(%rdx)
movups 0x1dab4(%rip), %xmm0    # 0x48040
movaps %xmm0, (%rdx)
movq %r12, %rdi
movq %rbx, %rsi
callq *0x58(%r12)
jmp 0x2a5ba
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 0x2a663
cmpb $0x1, 0x70(%r15)
jne 0x2a663
movq -0x30(%rbp), %rax
movb 0x70(%rax), %al
movb %al, 0x70(%rbx)
cmpb $0x1, %al
jne 0x2a667
movzbl 0x1(%r13), %eax
shll $0x8, %eax
cmpl $0xe00, %eax            # imm = 0xE00
jne 0x2a6f4
cmpb $0x0, 0x70(%r13)
je 0x2a713
movzbl 0x1(%r15), %eax
shll $0x8, %eax
cmpl $0xe00, %eax            # imm = 0xE00
jne 0x2a732
cmpb $0x0, 0x70(%r15)
je 0x2a751
movq -0x30(%rbp), %rax
movzbl 0x1(%rax), %eax
shll $0x8, %eax
cmpl $0xe00, %eax            # imm = 0xE00
jne 0x2a770
movq %r15, %rdi
callq 0x2b493
testb %al, %al
je 0x2a679
movq %r13, %rdi
callq 0x30357
testb %al, %al
movq -0x30(%rbp), %rcx
cmovneq %r15, %rcx
movzbl 0x60(%rbx), %esi
movq %r12, %rdi
movq %rbx, %rdx
callq 0x2e959
jmp 0x2a667
movb $0x0, 0x70(%rbx)
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0x2b435
testb %al, %al
je 0x2a78f
movq %r13, %rdi
callq 0x30357
testb %al, %al
je 0x2a69e
movq 0x88(%r15), %rax
jmp 0x2a6a9
movq -0x30(%rbp), %rax
movq 0x88(%rax), %rax
movq %rax, 0x88(%rbx)
movb $0x10, 0x71(%rbx)
jmp 0x2a667
leaq 0x15735(%rip), %rdi     # 0x3fdf2
leaq 0x1d276(%rip), %rsi     # 0x4793a
leaq 0x1d8f8(%rip), %rcx     # 0x47fc3
movl $0x1293, %edx           # imm = 0x1293
callq 0x30a0
leaq 0x155fe(%rip), %rdi     # 0x3fcda
leaq 0x1d257(%rip), %rsi     # 0x4793a
leaq 0x1d8d9(%rip), %rcx     # 0x47fc3
movl $0x1299, %edx           # imm = 0x1299
callq 0x30a0
leaq 0x1eab0(%rip), %rdi     # 0x491ab
leaq 0x1d238(%rip), %rsi     # 0x4793a
leaq 0x1ea33(%rip), %rcx     # 0x4913c
movl $0xbc6, %edx            # imm = 0xBC6
callq 0x30a0
leaq 0x1eaad(%rip), %rdi     # 0x491c7
leaq 0x1d219(%rip), %rsi     # 0x4793a
leaq 0x1ea14(%rip), %rcx     # 0x4913c
movl $0xbc7, %edx            # imm = 0xBC7
callq 0x30a0
leaq 0x1e58b(%rip), %rdi     # 0x48cc4
leaq 0x1d1fa(%rip), %rsi     # 0x4793a
leaq 0x1e9f5(%rip), %rcx     # 0x4913c
movl $0xbc9, %edx            # imm = 0xBC9
callq 0x30a0
leaq 0x1e58b(%rip), %rdi     # 0x48ce3
leaq 0x1d1db(%rip), %rsi     # 0x4793a
leaq 0x1e9d6(%rip), %rcx     # 0x4913c
movl $0xbca, %edx            # imm = 0xBCA
callq 0x30a0
leaq 0x1e59b(%rip), %rdi     # 0x48d12
leaq 0x1d1bc(%rip), %rsi     # 0x4793a
leaq 0x1e9b7(%rip), %rcx     # 0x4913c
movl $0xbcc, %edx            # imm = 0xBCC
callq 0x30a0
leaq 0x11bca(%rip), %rdi     # 0x3c360
leaq 0x1d19d(%rip), %rsi     # 0x4793a
leaq 0x1e998(%rip), %rcx     # 0x4913c
movl $0xbeb, %edx            # imm = 0xBEB
callq 0x30a0