// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/frontend/irgen.c
// Function: ir_constexpr
static void _ir_constexpr(
	IRGeneratorContext *ctx,
	ResizableString *rstr_val,
	ParserASTNode *node_constexpr
) {
	assert(ctx);
	assert(rstr_val);
	assert(node_constexpr);
	assert(FE_EXPR_AST_NODE_GET_CONSTANT(node_constexpr));

	switch (FE_EXPR_AST_NODE_GET_CONSTANT_TYPE(node_constexpr)) {
		case FE_TYPE_CHAR: {
			char str[128];
			snprintf(
				str, sizeof(str), "cast<char>(%d)",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_CHAR_VAL(node_constexpr)
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case FE_TYPE_INT8: {
			char str[128];
			snprintf(
				str, sizeof(str), "cast<int8>(%d)",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_INT8_VAL(node_constexpr)
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case FE_TYPE_INT16: {
			char str[128];
			snprintf(
				str, sizeof(str), "cast<int16>(%d)",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_INT16_VAL(node_constexpr)
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case FE_TYPE_INT32: {
			char str[128];
			snprintf(
				str, sizeof(str), "cast<int32>(%d)",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_INT32_VAL(node_constexpr)
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case FE_TYPE_INT64: {
			char str[128];
			snprintf(
				str, sizeof(str), "cast<int64>(%lld)",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_INT64_VAL(node_constexpr)
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case FE_TYPE_UINT8: {
			char str[128];
			snprintf(
				str, sizeof(str), "cast<uint8>(%u)",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_UINT8_VAL(node_constexpr)
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case FE_TYPE_UINT16: {
			char str[128];
			snprintf(
				str, sizeof(str), "cast<uint16>(%u)",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_UINT16_VAL(node_constexpr)
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case FE_TYPE_UINT32: {
			char str[128];
			snprintf(
				str, sizeof(str), "cast<uint32>(%u)",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_UINT32_VAL(node_constexpr)
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case FE_TYPE_UINT64: {
			char str[128];
			snprintf(
				str, sizeof(str), "cast<uint64>(%llu)",
				FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_UINT64_VAL(node_constexpr)
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case FE_TYPE_FLOAT: {
			char str[128];
			float val = FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_FLOAT_VAL(node_constexpr);
			snprintf(
				str, sizeof(str), "cast<float>(%f)",
				val
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case FE_TYPE_DOUBLE: {
			char str[128];
			double val = FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_DOUBLE_VAL(node_constexpr);
			snprintf(
				str, sizeof(str), "cast<double>(%lf)",
				val
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case FE_TYPE_POINTER: {
			if (FE_EXPR_AST_NODE_GET_HAS_CONSTSTR(node_constexpr)) {
				FeParserConstexprString *conststr = FE_EXPR_AST_NODE_GET_CONSTSTR(node_constexpr);
				uint64_t ptr_val = FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_POINTER_VAL(node_constexpr);

				ResizableString rstr_string;
				rstr_init(&rstr_string);
				rstr_append_with_char(&rstr_string, '"');
				rstr_append_with_raw(&rstr_string, conststr->str, conststr->len);
				rstr_append_with_char(&rstr_string, '"');

				ResizableString target_type;
				rstr_init(&target_type);
				_ir_type(ctx, &target_type, FE_EXPR_AST_NODE_GET_TYPE_NODE(node_constexpr));

				char str[1024];
				if (ptr_val == 0) {
					snprintf(
						str, sizeof(str), "cast<%s>(%s)",
						RSTR_CSTR(&target_type),
						RSTR_CSTR(&rstr_string)
					);
				} else {
					snprintf(
						str, sizeof(str), "cast<%s>(%s + %llu)",
						RSTR_CSTR(&target_type),
						RSTR_CSTR(&rstr_string),
						ptr_val
					);
				}

				rstr_append_with_cstr(rstr_val, str);

				rstr_free(&rstr_string);
				rstr_free(&target_type);
			} else {
				ResizableString target_type;
				rstr_init(&target_type);
				_ir_type(ctx, &target_type, FE_EXPR_AST_NODE_GET_TYPE_NODE(node_constexpr));

				char str[1024];
				snprintf(
					str, sizeof(str), "cast<%s>(%llu)",
					RSTR_CSTR(&target_type),
					FE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_POINTER_VAL(node_constexpr)
				);
				rstr_append_with_cstr(rstr_val, str);

				rstr_free(&target_type);
			}
			break;
		}
		default: {
			assert(0);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe60, %rsp            # imm = 0xE60
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x13570
jmp 0x1358f
leaq 0x68fdf(%rip), %rdi     # 0x7c556
leaq 0x60e16(%rip), %rsi     # 0x74394
movl $0x2c2, %edx            # imm = 0x2C2
leaq 0x6154c(%rip), %rcx     # 0x74ad6
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x13598
jmp 0x135b7
leaq 0x61584(%rip), %rdi     # 0x74b23
leaq 0x60dee(%rip), %rsi     # 0x74394
movl $0x2c3, %edx            # imm = 0x2C3
leaq 0x61524(%rip), %rcx     # 0x74ad6
callq 0x30a0
cmpq $0x0, -0x18(%rbp)
je 0x135c0
jmp 0x135df
leaq 0x614d2(%rip), %rdi     # 0x74a99
leaq 0x60dc6(%rip), %rsi     # 0x74394
movl $0x2c4, %edx            # imm = 0x2C4
leaq 0x614fc(%rip), %rcx     # 0x74ad6
callq 0x30a0
movq -0x18(%rbp), %rax
testb $0x1, 0x70(%rax)
je 0x135eb
jmp 0x1360a
leaq 0x614b6(%rip), %rdi     # 0x74aa8
leaq 0x60d9b(%rip), %rsi     # 0x74394
movl $0x2c5, %edx            # imm = 0x2C5
leaq 0x614d1(%rip), %rcx     # 0x74ad6
callq 0x30a0
movq -0x18(%rbp), %rax
movzbl 0x71(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0xe08(%rbp)
subl $0xf, %eax
ja 0x13b9a
movq -0xe08(%rbp), %rax
leaq 0x60c58(%rip), %rcx     # 0x7428c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0xa0(%rbp), %rdi
movq -0x18(%rbp), %rax
movsbl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x614d1(%rip), %rdx     # 0x74b2c
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x8d70
jmp 0x13bb9
leaq -0x120(%rbp), %rdi
movq -0x18(%rbp), %rax
movsbl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x614a6(%rip), %rdx     # 0x74b3b
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x8d70
jmp 0x13bb9
leaq -0x1a0(%rbp), %rdi
movq -0x18(%rbp), %rax
movswl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x6147b(%rip), %rdx     # 0x74b4a
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x8d70
jmp 0x13bb9
leaq -0x220(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x61452(%rip), %rdx     # 0x74b5a
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x220(%rbp), %rsi
callq 0x8d70
jmp 0x13bb9
leaq -0x2a0(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rcx
movl $0x80, %esi
leaq 0x61428(%rip), %rdx     # 0x74b6a
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x8d70
jmp 0x13bb9
leaq -0x320(%rbp), %rdi
movq -0x18(%rbp), %rax
movzbl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x61400(%rip), %rdx     # 0x74b7c
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x320(%rbp), %rsi
callq 0x8d70
jmp 0x13bb9
leaq -0x3a0(%rbp), %rdi
movq -0x18(%rbp), %rax
movzwl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x613d6(%rip), %rdx     # 0x74b8c
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x3a0(%rbp), %rsi
callq 0x8d70
jmp 0x13bb9
leaq -0x420(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x613ae(%rip), %rdx     # 0x74b9d
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x420(%rbp), %rsi
callq 0x8d70
jmp 0x13bb9
leaq -0x4a0(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rcx
movl $0x80, %esi
leaq 0x61385(%rip), %rdx     # 0x74bae
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x4a0(%rbp), %rsi
callq 0x8d70
jmp 0x13bb9
movq -0x18(%rbp), %rax
movss 0x88(%rax), %xmm0
movss %xmm0, -0x524(%rbp)
leaq -0x520(%rbp), %rdi
movss -0x524(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movl $0x80, %esi
leaq 0x61349(%rip), %rdx     # 0x74bc1
movb $0x1, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x520(%rbp), %rsi
callq 0x8d70
jmp 0x13bb9
movq -0x18(%rbp), %rax
movsd 0x88(%rax), %xmm0
movsd %xmm0, -0x5b8(%rbp)
leaq -0x5b0(%rbp), %rdi
movsd -0x5b8(%rbp), %xmm0
movl $0x80, %esi
leaq 0x6130e(%rip), %rdx     # 0x74bd1
movb $0x1, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x5b0(%rbp), %rsi
callq 0x8d70
jmp 0x13bb9
movq -0x18(%rbp), %rax
testb $0x1, 0x72(%rax)
je 0x13af6
movq -0x18(%rbp), %rax
addq $0x60, %rax
addq $0x18, %rax
movq %rax, -0x5c0(%rbp)
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rax
movq %rax, -0x5c8(%rbp)
leaq -0x5d8(%rbp), %rdi
callq 0x8c90
leaq -0x5d8(%rbp), %rdi
movl $0x22, %esi
callq 0x8ea0
movq -0x5c0(%rbp), %rax
movq (%rax), %rsi
movq -0x5c0(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, %edx
leaq -0x5d8(%rbp), %rdi
callq 0x8f90
leaq -0x5d8(%rbp), %rdi
movl $0x22, %esi
callq 0x8ea0
leaq -0x5e8(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x68(%rax), %rdx
leaq -0x5e8(%rbp), %rsi
callq 0x10ca0
cmpq $0x0, -0x5c8(%rbp)
jne 0x13a2e
leaq -0x9f0(%rbp), %rax
movq %rax, -0xe10(%rbp)
cmpq $0x0, -0x5e0(%rbp)
jne 0x139bd
leaq 0x63f01(%rip), %rax     # 0x778b5
movq %rax, -0xe18(%rbp)
jmp 0x139cb
movq -0x5e0(%rbp), %rax
movq %rax, -0xe18(%rbp)
movq -0xe18(%rbp), %rax
movq %rax, -0xe20(%rbp)
cmpq $0x0, -0x5d0(%rbp)
jne 0x139f3
leaq 0x63ecb(%rip), %rax     # 0x778b5
movq %rax, -0xe28(%rbp)
jmp 0x13a01
movq -0x5d0(%rbp), %rax
movq %rax, -0xe28(%rbp)
movq -0xe20(%rbp), %rcx
movq -0xe10(%rbp), %rdi
movq -0xe28(%rbp), %r8
movl $0x400, %esi            # imm = 0x400
leaq 0x611c1(%rip), %rdx     # 0x74be3
movb $0x0, %al
callq 0x3090
jmp 0x13ac9
leaq -0x9f0(%rbp), %rax
movq %rax, -0xe30(%rbp)
cmpq $0x0, -0x5e0(%rbp)
jne 0x13a56
leaq 0x63e68(%rip), %rax     # 0x778b5
movq %rax, -0xe38(%rbp)
jmp 0x13a64
movq -0x5e0(%rbp), %rax
movq %rax, -0xe38(%rbp)
movq -0xe38(%rbp), %rax
movq %rax, -0xe40(%rbp)
cmpq $0x0, -0x5d0(%rbp)
jne 0x13a8c
leaq 0x63e32(%rip), %rax     # 0x778b5
movq %rax, -0xe48(%rbp)
jmp 0x13a9a
movq -0x5d0(%rbp), %rax
movq %rax, -0xe48(%rbp)
movq -0xe40(%rbp), %rcx
movq -0xe30(%rbp), %rdi
movq -0xe48(%rbp), %r8
movq -0x5c8(%rbp), %r9
movl $0x400, %esi            # imm = 0x400
leaq 0x6112e(%rip), %rdx     # 0x74bf0
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x9f0(%rbp), %rsi
callq 0x8d70
leaq -0x5d8(%rbp), %rdi
callq 0x9310
leaq -0x5e8(%rbp), %rdi
callq 0x9310
jmp 0x13b98
leaq -0xa00(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x68(%rax), %rdx
leaq -0xa00(%rbp), %rsi
callq 0x10ca0
leaq -0xe00(%rbp), %rax
movq %rax, -0xe50(%rbp)
cmpq $0x0, -0x9f8(%rbp)
jne 0x13b42
leaq 0x63d7c(%rip), %rax     # 0x778b5
movq %rax, -0xe58(%rbp)
jmp 0x13b50
movq -0x9f8(%rbp), %rax
movq %rax, -0xe58(%rbp)
movq -0xe50(%rbp), %rdi
movq -0xe58(%rbp), %rcx
movq -0x18(%rbp), %rax
movq 0x88(%rax), %r8
movl $0x400, %esi            # imm = 0x400
leaq 0x6108f(%rip), %rdx     # 0x74c04
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0xe00(%rbp), %rsi
callq 0x8d70
leaq -0xa00(%rbp), %rdi
callq 0x9310
jmp 0x13bb9
leaq 0x5e8ba(%rip), %rdi     # 0x7245b
leaq 0x607ec(%rip), %rsi     # 0x74394
movl $0x362, %edx            # imm = 0x362
leaq 0x60f22(%rip), %rcx     # 0x74ad6
callq 0x30a0
addq $0xe60, %rsp            # imm = 0xE60
popq %rbp
retq
nopw %cs:(%rax,%rax)