// File: /workspace/github_c_makefile_star2_O2/Ihsoh[P]ilang/compiler/frontend/irgen_c.c
// Function: ir_expr_constexpr
static bool _ir_expr_constexpr(
	IRGeneratorCContext *ctx,
	ResizableString *rstr,
	ParserASTNode *node_expr
) {
	assert(ctx);
	assert(rstr);
	assert(node_expr);
	
	if (!FE_EXPR_AST_NODE_GET_CONSTANT(node_expr)) {
		return false;
	}

	_IR_EXPR_AUTO_CAST_BEGIN

	switch (FE_EXPR_AST_NODE_GET_CONSTANT_TYPE(node_expr)) {
		case FE_TYPE_CHAR: {
			char str[128];
			snprintf(
				str, sizeof(str), "%d",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_CHAR_VAL(node_expr)
			);
			rstr_append_with_cstr(rstr, str);
			break;
		}
		case FE_TYPE_INT8: {
			char str[128];
			snprintf(
				str, sizeof(str), "%d",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_INT8_VAL(node_expr)
			);
			rstr_append_with_cstr(rstr, str);
			break;
		}
		case FE_TYPE_INT16: {
			char str[128];
			snprintf(
				str, sizeof(str), "%d",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_INT16_VAL(node_expr)
			);
			rstr_append_with_cstr(rstr, str);
			break;
		}
		case FE_TYPE_INT32: {
			char str[128];
			snprintf(
				str, sizeof(str), "%d",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_INT32_VAL(node_expr)
			);
			rstr_append_with_cstr(rstr, str);
			break;
		}
		case FE_TYPE_INT64: {
			char str[128];
			snprintf(
				str, sizeof(str), "%lld",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_INT64_VAL(node_expr)
			);
			rstr_append_with_cstr(rstr, str);
			break;
		}
		case FE_TYPE_UINT8: {
			char str[128];
			snprintf(
				str, sizeof(str), "%u",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_UINT8_VAL(node_expr)
			);
			rstr_append_with_cstr(rstr, str);
			break;
		}
		case FE_TYPE_UINT16: {
			char str[128];
			snprintf(
				str, sizeof(str), "%u",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_UINT16_VAL(node_expr)
			);
			rstr_append_with_cstr(rstr, str);
			break;
		}
		case FE_TYPE_UINT32: {
			char str[128];
			snprintf(
				str, sizeof(str), "%u",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_UINT32_VAL(node_expr)
			);
			rstr_append_with_cstr(rstr, str);
			break;
		}
		case FE_TYPE_UINT64: {
			char str[128];
			snprintf(
				str, sizeof(str), "%llu",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_UINT64_VAL(node_expr)
			);
			rstr_append_with_cstr(rstr, str);
			break;
		}
		case FE_TYPE_FLOAT: {
			char str[128];
			snprintf(
				str, sizeof(str), "%f",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_FLOAT_VAL(node_expr)
			);
			rstr_append_with_cstr(rstr, str);
			break;
		}
		case FE_TYPE_DOUBLE: {
			char str[128];
			snprintf(
				str, sizeof(str), "%lf",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_DOUBLE_VAL(node_expr)
			);
			rstr_append_with_cstr(rstr, str);
			break;
		}
		case FE_TYPE_POINTER: {
			rstr_append_with_char(rstr, '(');

			ParserASTNode *node_type = FE_EXPR_AST_NODE_GET_TYPE_NODE(node_expr);
			ResizableString rstr_type;
			rstr_init(&rstr_type);
			_ir_type(ctx, &rstr_type, node_type);
			rstr_appendf(rstr, "(%s) ", RSTR_CSTR(&rstr_type));
			rstr_free(&rstr_type);

			if (FE_EXPR_AST_NODE_GET_HAS_CONSTSTR(node_expr)) {
				FeParserConstexprString *conststr = FE_EXPR_AST_NODE_GET_CONSTSTR(node_expr);
				rstr_append_with_char(rstr, '\"');
				rstr_append_with_raw(rstr, conststr->str, conststr->len);
				rstr_append_with_char(rstr, '\"');

				uint64_t ptr_val = FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_POINTER_VAL(node_expr);

				if (ptr_val > 0) {
					rstr_append_with_cstr(rstr, " + ");

					char str[128];
					snprintf(
						str, sizeof(str), "%llu",
						ptr_val
					);
					rstr_append_with_cstr(rstr, str);
				}
			} else {
				char str[128];
				snprintf(
					str, sizeof(str), "%llu",
					FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_POINTER_VAL(node_expr)
				);
				rstr_append_with_cstr(rstr, str);
			}

			rstr_append_with_char(rstr, ')');
			break;
		}
		default: {
			assert(0);
			return false;
		}
	}

	_IR_EXPR_AUTO_CAST_END

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movb 0x70(%rsi), %bl
cmpb $0x1, %bl
jne 0x14527
movq %rsi, %r15
movq %rdi, %r14
leaq -0x48(%rbp), %r12
movq %r12, %rdi
callq 0x6e1c
movq 0x68(%r15), %rsi
movq %r12, %rdi
callq 0x13ba1
movq 0x8(%r12), %rdx
testq %rdx, %rdx
leaq 0x2bbe6(%rip), %r12     # 0x3ff16
cmoveq %r12, %rdx
leaq 0x2c8c4(%rip), %rsi     # 0x40bff
movq %r14, %rdi
xorl %eax, %eax
callq 0x739a
movzbl 0x71(%r15), %eax
decl %eax
cmpl $0xf, %eax
ja 0x14577
leaq 0x2c3f4(%rip), %rcx     # 0x40750
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movsbl 0x88(%r15), %ecx
jmp 0x144da
pushq $0x28
popq %rsi
movq %r14, %rdi
callq 0x6f81
movq 0x68(%r15), %r13
leaq -0x38(%rbp), %rdi
callq 0x6e1c
leaq -0x38(%rbp), %rdi
movq %r13, %rsi
callq 0x13ba1
leaq -0x38(%rbp), %r13
movq 0x8(%r13), %rax
testq %rax, %rax
cmovneq %rax, %r12
leaq 0x2c86d(%rip), %rsi     # 0x40c19
movq %r14, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x739a
movq %r13, %rdi
callq 0x72b9
cmpb $0x1, 0x72(%r15)
jne 0x1453b
pushq $0x22
popq %r12
movq %r14, %rdi
movl %r12d, %esi
callq 0x6f81
movq 0x78(%r15), %rsi
movl 0x80(%r15), %edx
movq %r14, %rdi
callq 0x700f
movq %r14, %rdi
movl %r12d, %esi
callq 0x6f81
movq 0x88(%r15), %r15
testq %r15, %r15
je 0x1456a
leaq 0x2c80f(%rip), %rsi     # 0x40c1f
movq %r14, %rdi
callq 0x6e99
leaq 0x2c7ee(%rip), %rdx     # 0x40c0d
leaq -0xd0(%rbp), %r12
movl $0x80, %esi
movq %r12, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x3090
movq %r14, %rdi
movq %r12, %rsi
jmp 0x14565
cvtss2sd 0x88(%r15), %xmm0
leaq 0x2c7bf(%rip), %rdx     # 0x40c12
jmp 0x14465
movsd 0x88(%r15), %xmm0
leaq 0x2c7b0(%rip), %rdx     # 0x40c15
leaq -0xd0(%rbp), %r15
movl $0x80, %esi
movq %r15, %rdi
movb $0x1, %al
callq 0x3090
jmp 0x14508
movq 0x88(%r15), %rcx
leaq 0x2c77f(%rip), %rdx     # 0x40c0d
jmp 0x1449e
movq 0x88(%r15), %rcx
leaq 0x2c767(%rip), %rdx     # 0x40c05
leaq -0xd0(%rbp), %r15
movl $0x80, %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x3090
jmp 0x14508
movzbl 0x88(%r15), %ecx
jmp 0x144eb
movswl 0x88(%r15), %ecx
jmp 0x144da
movl 0x88(%r15), %ecx
jmp 0x144eb
movl 0x88(%r15), %ecx
leaq 0x2d726(%rip), %rdx     # 0x41c07
jmp 0x144f2
movzwl 0x88(%r15), %ecx
leaq 0x2c718(%rip), %rdx     # 0x40c0a
leaq -0xd0(%rbp), %r15
movl $0x80, %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x3090
movq %r14, %rdi
movq %r15, %rsi
callq 0x6e99
leaq -0x48(%rbp), %rdi
callq 0x72b9
pushq $0x29
popq %rsi
movq %r14, %rdi
callq 0x6f81
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x88(%r15), %rcx
leaq 0x2c6c4(%rip), %rdx     # 0x40c0d
leaq -0xd0(%rbp), %r15
movl $0x80, %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x3090
movq %r14, %rdi
movq %r15, %rsi
callq 0x6e99
pushq $0x29
popq %rsi
movq %r14, %rdi
callq 0x6f81
jmp 0x14513
leaq 0x27de2(%rip), %rdi     # 0x3c360
leaq 0x2c32f(%rip), %rsi     # 0x408b4
leaq 0x2c61f(%rip), %rcx     # 0x40bab
movl $0x18c, %edx            # imm = 0x18C
callq 0x30a0