// File: /workspace/github_c_makefile_star2_O1/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 $0x418, %rsp            # imm = 0x418
testq %rsi, %rsi
je 0x2d2d9
movq %rsi, %rbx
movq %rdi, %r15
cmpl $0xecd, (%rsi)          # imm = 0xECD
jne 0x2d106
cmpl $0x3, 0x44(%rbx)
jne 0x2d2f8
movq 0x48(%rbx), %rax
movq (%rax), %r14
movq 0x8(%rax), %r12
movq 0x10(%rax), %r13
movq %r15, %rdi
movq %r14, %rsi
callq 0x2e0f4
movq %r15, %rdi
movq %r12, %rsi
callq 0x2c01f
movq %r15, %rdi
movq %r13, %rsi
callq 0x2c01f
movq 0x68(%r12), %rax
movq %rax, -0x30(%rbp)
movq %r13, -0x40(%rbp)
movq 0x68(%r13), %r13
movq %r14, -0x38(%rbp)
movq %r14, %rdi
callq 0x2e28f
testb %al, %al
jne 0x2d096
movq -0x38(%rbp), %rdi
callq 0x2e2f0
testb %al, %al
jne 0x2d096
leaq 0x1eea0(%rip), %rsi     # 0x4bf15
leaq -0x440(%rbp), %r14
movl $0x4b, %edx
movq %r14, %rdi
callq 0x3100
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq *0x58(%r15)
leaq 0x60(%r12), %r14
movq %r12, %rdi
callq 0x2e34e
testb %al, %al
je 0x2d122
movq %r15, %rdi
movq -0x30(%rbp), %rsi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x2ada4
testb %al, %al
je 0x2d122
movq %r14, -0x30(%rbp)
movq %r12, %rdi
callq 0x2e3af
movl %eax, %r14d
movq -0x40(%rbp), %r13
movq %r13, %rdi
callq 0x2e3af
leaq 0x60(%rbx), %rcx
cmpl %eax, %r14d
jbe 0x2d283
movq -0x30(%rbp), %r14
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups %xmm2, 0x20(%rcx)
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
jmp 0x2d1a5
movq %r15, %rdi
movq %rbx, %rsi
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2e0f4
movq %r12, %rdi
callq 0x2e2f0
testb %al, %al
je 0x2d165
movq %r15, %rdi
movq -0x30(%rbp), %rsi
movq %r13, %rdx
movl $0x1, %ecx
callq 0x2ada4
testb %al, %al
je 0x2d165
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups %xmm2, 0x80(%rbx)
movups %xmm1, 0x70(%rbx)
movups %xmm0, 0x60(%rbx)
jmp 0x2d1a1
movups 0x1ee22(%rip), %xmm0    # 0x4bf8e
leaq -0x440(%rbp), %rdx
movups %xmm0, 0x2e(%rdx)
movups 0x1ee02(%rip), %xmm0    # 0x4bf80
movaps %xmm0, 0x20(%rdx)
movups 0x1ede7(%rip), %xmm0    # 0x4bf70
movaps %xmm0, 0x10(%rdx)
movups 0x1edcc(%rip), %xmm0    # 0x4bf60
movaps %xmm0, (%rdx)
movq %r15, %rdi
movq %rbx, %rsi
callq *0x58(%r15)
movq -0x40(%rbp), %r13
movq -0x38(%rbp), %rdi
cmpb $0x1, 0x70(%rdi)
jne 0x2d26d
cmpb $0x1, 0x70(%r12)
jne 0x2d26d
movb 0x70(%r13), %al
movb %al, 0x70(%rbx)
cmpb $0x1, %al
jne 0x2d271
testq %rdi, %rdi
je 0x2d317
movzbl 0x1(%rdi), %eax
shll $0x8, %eax
cmpl $0xe00, %eax            # imm = 0xE00
jne 0x2d336
cmpb $0x0, 0x70(%rdi)
je 0x2d355
testq %r12, %r12
je 0x2d374
movzbl 0x1(%r12), %eax
shll $0x8, %eax
cmpl $0xe00, %eax            # imm = 0xE00
jne 0x2d393
cmpb $0x0, 0x70(%r12)
je 0x2d3b2
testq %r13, %r13
je 0x2d3d1
movzbl 0x1(%r13), %eax
shll $0x8, %eax
cmpl $0xe00, %eax            # imm = 0xE00
jne 0x2d3f0
cmpb $0x0, 0x70(%r13)
je 0x2d40f
movb (%r14), %al
leal -0x1(%rax), %ecx
cmpb $0xa, %cl
ja 0x2d2aa
callq 0x3357f
testb %al, %al
cmovneq %r12, %r13
movzbl 0x60(%rbx), %esi
movq %r15, %rdi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x31acc
jmp 0x2d271
movb $0x0, 0x70(%rbx)
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x60(%r13), %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), %rdi
movq -0x30(%rbp), %r14
jmp 0x2d1a9
cmpb $0x10, %al
jne 0x2d42e
callq 0x3357f
testb %al, %al
je 0x2d2c5
movq 0x88(%r12), %rax
jmp 0x2d2cc
movq 0x88(%r13), %rax
movq %rax, 0x88(%rbx)
movb $0x10, 0x71(%rbx)
jmp 0x2d271
leaq 0x16ab6(%rip), %rdi     # 0x43d96
leaq 0x1e573(%rip), %rsi     # 0x4b85a
leaq 0x1ebf5(%rip), %rcx     # 0x4bee3
movl $0x1293, %edx           # imm = 0x1293
callq 0x30a0
leaq 0x1697f(%rip), %rdi     # 0x43c7e
leaq 0x1e554(%rip), %rsi     # 0x4b85a
leaq 0x1ebd6(%rip), %rcx     # 0x4bee3
movl $0x1299, %edx           # imm = 0x1299
callq 0x30a0
leaq 0x1fdff(%rip), %rdi     # 0x4d11d
leaq 0x1e535(%rip), %rsi     # 0x4b85a
leaq 0x1fd82(%rip), %rcx     # 0x4d0ae
movl $0xbc5, %edx            # imm = 0xBC5
callq 0x30a0
leaq 0x1fde5(%rip), %rdi     # 0x4d122
leaq 0x1e516(%rip), %rsi     # 0x4b85a
leaq 0x1fd63(%rip), %rcx     # 0x4d0ae
movl $0xbc6, %edx            # imm = 0xBC6
callq 0x30a0
leaq 0x1fde2(%rip), %rdi     # 0x4d13e
leaq 0x1e4f7(%rip), %rsi     # 0x4b85a
leaq 0x1fd44(%rip), %rcx     # 0x4d0ae
movl $0xbc7, %edx            # imm = 0xBC7
callq 0x30a0
leaq 0x1f861(%rip), %rdi     # 0x4cbdc
leaq 0x1e4d8(%rip), %rsi     # 0x4b85a
leaq 0x1fd25(%rip), %rcx     # 0x4d0ae
movl $0xbc8, %edx            # imm = 0xBC8
callq 0x30a0
leaq 0x1f84a(%rip), %rdi     # 0x4cbe4
leaq 0x1e4b9(%rip), %rsi     # 0x4b85a
leaq 0x1fd06(%rip), %rcx     # 0x4d0ae
movl $0xbc9, %edx            # imm = 0xBC9
callq 0x30a0
leaq 0x1f84a(%rip), %rdi     # 0x4cc03
leaq 0x1e49a(%rip), %rsi     # 0x4b85a
leaq 0x1fce7(%rip), %rcx     # 0x4d0ae
movl $0xbca, %edx            # imm = 0xBCA
callq 0x30a0
leaq 0x1f852(%rip), %rdi     # 0x4cc2a
leaq 0x1e47b(%rip), %rsi     # 0x4b85a
leaq 0x1fcc8(%rip), %rcx     # 0x4d0ae
movl $0xbcb, %edx            # imm = 0xBCB
callq 0x30a0
leaq 0x1f83b(%rip), %rdi     # 0x4cc32
leaq 0x1e45c(%rip), %rsi     # 0x4b85a
leaq 0x1fca9(%rip), %rcx     # 0x4d0ae
movl $0xbcc, %edx            # imm = 0xBCC
callq 0x30a0
leaq 0x1f83b(%rip), %rdi     # 0x4cc51
leaq 0x1e43d(%rip), %rsi     # 0x4b85a
leaq 0x1fc8a(%rip), %rcx     # 0x4d0ae
movl $0xbcd, %edx            # imm = 0xBCD
callq 0x30a0
leaq 0x12f4f(%rip), %rdi     # 0x40384
leaq 0x1e41e(%rip), %rsi     # 0x4b85a
leaq 0x1fc6b(%rip), %rcx     # 0x4d0ae
movl $0xbeb, %edx            # imm = 0xBEB
callq 0x30a0