// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/backend/asmgen_gas64.c
// Function: asm_constexpr_param
static void _asm_constexpr_param(
	ASMGeneratorGas64Context *ctx,
	ResizableString *rstr_val,
	ParserASTNode *node_constexpr,
	int tmp_reg
) {
	assert(ctx);
	assert(rstr_val);
	assert(node_constexpr);
	assert(BE_EXPR_AST_NODE_GET_CONSTANT(node_constexpr));

	switch (BE_EXPR_AST_NODE_GET_CONSTANT_TYPE(node_constexpr)) {
		case BE_TYPE_CHAR: {
			char str[128];
			snprintf(
				str, sizeof(str), "$%d",
				BE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_CHAR_VAL(node_constexpr)
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case BE_TYPE_INT8: {
			char str[128];
			snprintf(
				str, sizeof(str), "$%d",
				BE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_INT8_VAL(node_constexpr)
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case BE_TYPE_INT16: {
			char str[128];
			snprintf(
				str, sizeof(str), "$%d",
				BE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_INT16_VAL(node_constexpr)
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case BE_TYPE_INT32: {
			char str[128];
			snprintf(
				str, sizeof(str), "$%d",
				BE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_INT32_VAL(node_constexpr)
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case BE_TYPE_INT64: {
			char str[128];
			snprintf(
				str, sizeof(str), "$%lld",
				BE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_INT64_VAL(node_constexpr)
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case BE_TYPE_UINT8: {
			char str[128];
			snprintf(
				str, sizeof(str), "$%u",
				BE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_UINT8_VAL(node_constexpr)
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case BE_TYPE_UINT16: {
			char str[128];
			snprintf(
				str, sizeof(str), "$%u",
				BE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_UINT16_VAL(node_constexpr)
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case BE_TYPE_UINT32: {
			char str[128];
			snprintf(
				str, sizeof(str), "$%u",
				BE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_UINT32_VAL(node_constexpr)
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case BE_TYPE_UINT64: {
			char str[128];
			snprintf(
				str, sizeof(str), "$%llu",
				BE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_UINT64_VAL(node_constexpr)
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case BE_TYPE_FLOAT: {
			char str[128];
			float val = BE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_FLOAT_VAL(node_constexpr);
			snprintf(
				str, sizeof(str), "$0x%X",
				*(uint32_t *)&val
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case BE_TYPE_DOUBLE: {
			char str[128];
			double val = BE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_DOUBLE_VAL(node_constexpr);
			snprintf(
				str, sizeof(str), "$0x%llX",
				*(uint64_t *)&val
			);
			rstr_append_with_cstr(rstr_val, str);
			break;
		}
		case BE_TYPE_POINTER: {
			if (BE_EXPR_AST_NODE_GET_HAS_CONSTSTR(node_constexpr)) {
				BeParserConstexprString *conststr = BE_EXPR_AST_NODE_GET_CONSTSTR(node_constexpr);
				uint64_t ptr_val = BE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_POINTER_VAL(node_constexpr);

				ResizableString conststr_name;
				rstr_init(&conststr_name);

				int len = _new_string(ctx, &conststr_name, conststr->str, conststr->len);

				ResizableString rstr_source;
				rstr_init(&rstr_source);
				_asm_inst_memref_base_disp(
					ctx,
					&rstr_source,
					_ASM_REG_NAME_RIP,
					RSTR_CSTR(&conststr_name)
				);

				_asm_inst_lea_x_x(
					ctx,
					ctx->body,
					_asm_inst_reg(ctx, BE_TYPE_INT64, tmp_reg),
					RSTR_CSTR(&rstr_source)
				);

				ResizableString rstr_ptr_val;
				rstr_init(&rstr_ptr_val);
				_asm_inst_uint_const(ctx, &rstr_ptr_val, ptr_val);
				_asm_inst_add_x_x(
					ctx,
					ctx->body,
					BE_TYPE_POINTER,
					_asm_inst_reg(ctx, BE_TYPE_INT64, tmp_reg),
					RSTR_CSTR(&rstr_ptr_val)
				);
				rstr_free(&rstr_ptr_val);

				rstr_append_with_cstr(
					rstr_val,
					_asm_inst_reg(ctx, BE_TYPE_INT64, tmp_reg)
				);

				rstr_free(&conststr_name);
				rstr_free(&rstr_source);
			} else {
				char str[128];
				uint64_t val = BE_EXPR_AST_NODE_GET_CONSTEXPR_RESULT_POINTER_VAL(node_constexpr);
				snprintf(
					str, sizeof(str), "$0x%llX",
					val
				);
				rstr_append_with_cstr(rstr_val, str);
			}
			break;
		}
		default: {
			assert(0);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x6f0, %rsp            # imm = 0x6F0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x32e83
jmp 0x32ea2
leaq 0x4d2d7(%rip), %rdi     # 0x80161
leaq 0x47c73(%rip), %rsi     # 0x7ab04
movl $0xa7e, %edx            # imm = 0xA7E
leaq 0x485e2(%rip), %rcx     # 0x7b47f
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x32eab
jmp 0x32eca
leaq 0x42ff8(%rip), %rdi     # 0x75eaa
leaq 0x47c4b(%rip), %rsi     # 0x7ab04
movl $0xa7f, %edx            # imm = 0xA7F
leaq 0x485ba(%rip), %rcx     # 0x7b47f
callq 0x30a0
cmpq $0x0, -0x18(%rbp)
je 0x32ed3
jmp 0x32ef2
leaq 0x42f3f(%rip), %rdi     # 0x75e19
leaq 0x47c23(%rip), %rsi     # 0x7ab04
movl $0xa80, %edx            # imm = 0xA80
leaq 0x48592(%rip), %rcx     # 0x7b47f
callq 0x30a0
movq -0x18(%rbp), %rax
testb $0x1, 0x70(%rax)
je 0x32efe
jmp 0x32f1d
leaq 0x42f23(%rip), %rdi     # 0x75e28
leaq 0x47bf8(%rip), %rsi     # 0x7ab04
movl $0xa81, %edx            # imm = 0xA81
leaq 0x48567(%rip), %rcx     # 0x7b47f
callq 0x30a0
movq -0x18(%rbp), %rax
movzbl 0x71(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x690(%rbp)
subl $0xf, %eax
ja 0x33469
movq -0x690(%rbp), %rax
leaq 0x47afd(%rip), %rcx     # 0x7aa44
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 0x43af9(%rip), %rdx     # 0x76a67
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x8d70
jmp 0x33488
leaq -0x120(%rbp), %rdi
movq -0x18(%rbp), %rax
movsbl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x43abf(%rip), %rdx     # 0x76a67
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x8d70
jmp 0x33488
leaq -0x1a0(%rbp), %rdi
movq -0x18(%rbp), %rax
movswl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x43a85(%rip), %rdx     # 0x76a67
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x8d70
jmp 0x33488
leaq -0x220(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x43a4c(%rip), %rdx     # 0x76a67
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x220(%rbp), %rsi
callq 0x8d70
jmp 0x33488
leaq -0x2a0(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rcx
movl $0x80, %esi
leaq 0x48489(%rip), %rdx     # 0x7b4de
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x8d70
jmp 0x33488
leaq -0x320(%rbp), %rdi
movq -0x18(%rbp), %rax
movzbl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x439df(%rip), %rdx     # 0x76a6e
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x320(%rbp), %rsi
callq 0x8d70
jmp 0x33488
leaq -0x3a0(%rbp), %rdi
movq -0x18(%rbp), %rax
movzwl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x439a5(%rip), %rdx     # 0x76a6e
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x3a0(%rbp), %rsi
callq 0x8d70
jmp 0x33488
leaq -0x420(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x88(%rax), %ecx
movl $0x80, %esi
leaq 0x4396c(%rip), %rdx     # 0x76a6e
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x420(%rbp), %rsi
callq 0x8d70
jmp 0x33488
leaq -0x4a0(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rcx
movl $0x80, %esi
leaq 0x43936(%rip), %rdx     # 0x76a72
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x4a0(%rbp), %rsi
callq 0x8d70
jmp 0x33488
movq -0x18(%rbp), %rax
movss 0x88(%rax), %xmm0
movss %xmm0, -0x524(%rbp)
leaq -0x520(%rbp), %rdi
movl -0x524(%rbp), %ecx
movl $0x80, %esi
leaq 0x4835f(%rip), %rdx     # 0x7b4e4
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x520(%rbp), %rsi
callq 0x8d70
jmp 0x33488
movq -0x18(%rbp), %rax
movsd 0x88(%rax), %xmm0
movsd %xmm0, -0x5b8(%rbp)
leaq -0x5b0(%rbp), %rdi
movq -0x5b8(%rbp), %rcx
movl $0x80, %esi
leaq 0x4831b(%rip), %rdx     # 0x7b4ea
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x5b0(%rbp), %rsi
callq 0x8d70
jmp 0x33488
movq -0x18(%rbp), %rax
testb $0x1, 0x72(%rax)
je 0x33424
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
movq -0x8(%rbp), %rdi
movq -0x5c0(%rbp), %rax
movq (%rax), %rdx
movq -0x5c0(%rbp), %rax
movq 0x8(%rax), %rcx
leaq -0x5d8(%rbp), %rsi
callq 0x29cd0
movl %eax, -0x5dc(%rbp)
leaq -0x5f0(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rax
movq %rax, -0x698(%rbp)
cmpq $0x0, -0x5d0(%rbp)
jne 0x33286
leaq 0x42cc2(%rip), %rax     # 0x75f3f
movq %rax, -0x6a0(%rbp)
jmp 0x33294
movq -0x5d0(%rbp), %rax
movq %rax, -0x6a0(%rbp)
movq -0x698(%rbp), %rdi
movq -0x6a0(%rbp), %rcx
leaq -0x5f0(%rbp), %rsi
leaq 0x479fc(%rip), %rdx     # 0x7acac
callq 0x29520
movq -0x8(%rbp), %rax
movq %rax, -0x6b8(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x6b0(%rbp)
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %edx
movl $0x5, %esi
callq 0x334d0
movq %rax, -0x6a8(%rbp)
cmpq $0x0, -0x5e8(%rbp)
jne 0x33301
leaq 0x42c47(%rip), %rax     # 0x75f3f
movq %rax, -0x6c0(%rbp)
jmp 0x3330f
movq -0x5e8(%rbp), %rax
movq %rax, -0x6c0(%rbp)
movq -0x6a8(%rbp), %rdx
movq -0x6b0(%rbp), %rsi
movq -0x6b8(%rbp), %rdi
movq -0x6c0(%rbp), %rcx
callq 0x33a10
leaq -0x600(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x5c8(%rbp), %rdx
leaq -0x600(%rbp), %rsi
callq 0x33b00
movq -0x8(%rbp), %rax
movq %rax, -0x6d8(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x6d0(%rbp)
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %edx
movl $0x5, %esi
callq 0x334d0
movq %rax, -0x6c8(%rbp)
cmpq $0x0, -0x5f8(%rbp)
jne 0x3339f
leaq 0x42ba9(%rip), %rax     # 0x75f3f
movq %rax, -0x6e0(%rbp)
jmp 0x333ad
movq -0x5f8(%rbp), %rax
movq %rax, -0x6e0(%rbp)
movq -0x6c8(%rbp), %rcx
movq -0x6d0(%rbp), %rsi
movq -0x6d8(%rbp), %rdi
movq -0x6e0(%rbp), %r8
movl $0x10, %edx
callq 0x33b30
leaq -0x600(%rbp), %rdi
callq 0x9310
movq -0x10(%rbp), %rax
movq %rax, -0x6e8(%rbp)
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %edx
movl $0x5, %esi
callq 0x334d0
movq -0x6e8(%rbp), %rdi
movq %rax, %rsi
callq 0x8d70
leaq -0x5d8(%rbp), %rdi
callq 0x9310
leaq -0x5f0(%rbp), %rdi
callq 0x9310
jmp 0x33467
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rax
movq %rax, -0x688(%rbp)
leaq -0x680(%rbp), %rdi
movq -0x688(%rbp), %rcx
movl $0x80, %esi
leaq 0x4809a(%rip), %rdx     # 0x7b4ea
movb $0x0, %al
callq 0x3090
movq -0x10(%rbp), %rdi
leaq -0x680(%rbp), %rsi
callq 0x8d70
jmp 0x33488
leaq 0x3ffea(%rip), %rdi     # 0x7345a
leaq 0x4768d(%rip), %rsi     # 0x7ab04
movl $0xb22, %edx            # imm = 0xB22
leaq 0x47ffc(%rip), %rcx     # 0x7b47f
callq 0x30a0
addq $0x6f0, %rsp            # imm = 0x6F0
popq %rbp
retq
nopw %cs:(%rax,%rax)