// File: /workspace/github_c_makefile_star2_O0/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
subq $0x710, %rsp            # imm = 0x710
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x22220
jmp 0x2223f
leaq 0x5a32f(%rip), %rdi     # 0x7c556
leaq 0x54bba(%rip), %rsi     # 0x76de8
movl $0xf5, %edx
leaq 0x54edd(%rip), %rcx     # 0x77117
callq 0x30a0
cmpq $0x0, -0x18(%rbp)
je 0x22248
jmp 0x22267
leaq 0x508bf(%rip), %rdi     # 0x72b0e
leaq 0x54b92(%rip), %rsi     # 0x76de8
movl $0xf6, %edx
leaq 0x54eb5(%rip), %rcx     # 0x77117
callq 0x30a0
cmpq $0x0, -0x20(%rbp)
je 0x22270
jmp 0x2228f
leaq 0x54e7e(%rip), %rdi     # 0x770f5
leaq 0x54b6a(%rip), %rsi     # 0x76de8
movl $0xf7, %edx
leaq 0x54e8d(%rip), %rcx     # 0x77117
callq 0x30a0
movq -0x20(%rbp), %rax
testb $0x1, 0x70(%rax)
jne 0x222a2
movb $0x0, -0x1(%rbp)
jmp 0x22794
leaq -0x30(%rbp), %rdi
callq 0x8c90
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rdx
leaq -0x30(%rbp), %rsi
callq 0x216c0
movq -0x18(%rbp), %rax
movq %rax, -0x6e8(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x222e2
leaq 0x555dc(%rip), %rax     # 0x778b5
movq %rax, -0x6f0(%rbp)
jmp 0x222ed
movq -0x28(%rbp), %rax
movq %rax, -0x6f0(%rbp)
movq -0x6e8(%rbp), %rdi
movq -0x6f0(%rbp), %rdx
leaq 0x54e69(%rip), %rsi     # 0x7716b
xorl %eax, %eax
callq 0x94d0
movq -0x20(%rbp), %rax
movzbl 0x71(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x6f8(%rbp)
subl $0xf, %eax
ja 0x2275a
movq -0x6f8(%rbp), %rax
leaq 0x549ed(%rip), %rcx     # 0x76d20
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0xb0(%rbp), %rdi
movq -0x20(%rbp), %rax
movsbl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x55ff5(%rip), %rdx     # 0x7834f
movb $0x0, %al
callq 0x3090
movq -0x18(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x8d70
jmp 0x22779
leaq -0x130(%rbp), %rdi
movq -0x20(%rbp), %rax
movsbl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x55fbb(%rip), %rdx     # 0x7834f
movb $0x0, %al
callq 0x3090
movq -0x18(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x8d70
jmp 0x22779
leaq -0x1b0(%rbp), %rdi
movq -0x20(%rbp), %rax
movswl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x55f81(%rip), %rdx     # 0x7834f
movb $0x0, %al
callq 0x3090
movq -0x18(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x8d70
jmp 0x22779
leaq -0x230(%rbp), %rdi
movq -0x20(%rbp), %rax
movl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x55f48(%rip), %rdx     # 0x7834f
movb $0x0, %al
callq 0x3090
movq -0x18(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x8d70
jmp 0x22779
leaq -0x2b0(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x88(%rax), %rcx
movl $0x80, %esi
leaq 0x54d30(%rip), %rdx     # 0x77171
movb $0x0, %al
callq 0x3090
movq -0x18(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x8d70
jmp 0x22779
leaq -0x330(%rbp), %rdi
movq -0x20(%rbp), %rax
movzbl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x54cfb(%rip), %rdx     # 0x77176
movb $0x0, %al
callq 0x3090
movq -0x18(%rbp), %rdi
leaq -0x330(%rbp), %rsi
callq 0x8d70
jmp 0x22779
leaq -0x3b0(%rbp), %rdi
movq -0x20(%rbp), %rax
movzwl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x54cc1(%rip), %rdx     # 0x77176
movb $0x0, %al
callq 0x3090
movq -0x18(%rbp), %rdi
leaq -0x3b0(%rbp), %rsi
callq 0x8d70
jmp 0x22779
leaq -0x430(%rbp), %rdi
movq -0x20(%rbp), %rax
movl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x54c88(%rip), %rdx     # 0x77176
movb $0x0, %al
callq 0x3090
movq -0x18(%rbp), %rdi
leaq -0x430(%rbp), %rsi
callq 0x8d70
jmp 0x22779
leaq -0x4b0(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x88(%rax), %rcx
movl $0x80, %esi
leaq 0x54c51(%rip), %rdx     # 0x77179
movb $0x0, %al
callq 0x3090
movq -0x18(%rbp), %rdi
leaq -0x4b0(%rbp), %rsi
callq 0x8d70
jmp 0x22779
leaq -0x530(%rbp), %rdi
movq -0x20(%rbp), %rax
movss 0x88(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movl $0x80, %esi
leaq 0x54c17(%rip), %rdx     # 0x7717e
movb $0x1, %al
callq 0x3090
movq -0x18(%rbp), %rdi
leaq -0x530(%rbp), %rsi
callq 0x8d70
jmp 0x22779
leaq -0x5b0(%rbp), %rdi
movq -0x20(%rbp), %rax
movsd 0x88(%rax), %xmm0
movl $0x80, %esi
leaq 0x54bdf(%rip), %rdx     # 0x77181
movb $0x1, %al
callq 0x3090
movq -0x18(%rbp), %rdi
leaq -0x5b0(%rbp), %rsi
callq 0x8d70
jmp 0x22779
movq -0x18(%rbp), %rdi
movl $0x28, %esi
callq 0x8ea0
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x5b8(%rbp)
leaq -0x5c8(%rbp), %rdi
callq 0x8c90
movq -0x10(%rbp), %rdi
movq -0x5b8(%rbp), %rdx
leaq -0x5c8(%rbp), %rsi
callq 0x216c0
movq -0x18(%rbp), %rax
movq %rax, -0x700(%rbp)
cmpq $0x0, -0x5c0(%rbp)
jne 0x22623
leaq 0x5529b(%rip), %rax     # 0x778b5
movq %rax, -0x708(%rbp)
jmp 0x22631
movq -0x5c0(%rbp), %rax
movq %rax, -0x708(%rbp)
movq -0x700(%rbp), %rdi
movq -0x708(%rbp), %rdx
leaq 0x54b3f(%rip), %rsi     # 0x77185
movb $0x0, %al
callq 0x94d0
leaq -0x5c8(%rbp), %rdi
callq 0x9310
movq -0x20(%rbp), %rax
testb $0x1, 0x72(%rax)
je 0x22715
movq -0x20(%rbp), %rax
addq $0x60, %rax
addq $0x18, %rax
movq %rax, -0x5d0(%rbp)
movq -0x18(%rbp), %rdi
movl $0x22, %esi
callq 0x8ea0
movq -0x18(%rbp), %rdi
movq -0x5d0(%rbp), %rax
movq (%rax), %rsi
movq -0x5d0(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, %edx
callq 0x8f90
movq -0x18(%rbp), %rdi
movl $0x22, %esi
callq 0x8ea0
movq -0x20(%rbp), %rax
movq 0x88(%rax), %rax
movq %rax, -0x5d8(%rbp)
cmpq $0x0, -0x5d8(%rbp)
jbe 0x22713
movq -0x18(%rbp), %rdi
leaq 0x54aae(%rip), %rsi     # 0x7718b
callq 0x8d70
leaq -0x660(%rbp), %rdi
movq -0x5d8(%rbp), %rcx
movl $0x80, %esi
leaq 0x54a7d(%rip), %rdx     # 0x77179
movb $0x0, %al
callq 0x3090
movq -0x18(%rbp), %rdi
leaq -0x660(%rbp), %rsi
callq 0x8d70
jmp 0x2274a
leaq -0x6e0(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x88(%rax), %rcx
movl $0x80, %esi
leaq 0x54a46(%rip), %rdx     # 0x77179
movb $0x0, %al
callq 0x3090
movq -0x18(%rbp), %rdi
leaq -0x6e0(%rbp), %rsi
callq 0x8d70
movq -0x18(%rbp), %rdi
movl $0x29, %esi
callq 0x8ea0
jmp 0x22779
leaq 0x4fcfa(%rip), %rdi     # 0x7245b
leaq 0x54680(%rip), %rsi     # 0x76de8
movl $0x18c, %edx            # imm = 0x18C
leaq 0x549a3(%rip), %rcx     # 0x77117
callq 0x30a0
leaq -0x30(%rbp), %rdi
callq 0x9310
movq -0x18(%rbp), %rdi
movl $0x29, %esi
callq 0x8ea0
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x710, %rsp            # imm = 0x710
popq %rbp
retq
nopw %cs:(%rax,%rax)