// File: /workspace/github_c_makefile_star2_O3/Ihsoh[P]ilang/compiler/assembler/ins_directive_enc.c
// Function: ins_enc_floats
void ins_enc_floats(
	Instruction *ins,
	InstructionEncoderData *data
) {
	assert(ins);
	assert(data);
	assert(data->ins_node->nchilds == 2);

	ParserASTNode *node_count = data->ins_node->childs[0];
	assert(node_count->type == ASM_NODE_EXPR);

	AsmExprEvalResult *result_count = &ASM_EXPR_AST_NODE_GET_RESULT(node_count);
	assert(result_count->type == ASM_EXPR_EVAL_RESULT_TYPE_UINT64);

	ASM_PARSER_CONTEXT_DATA_INC_ADDRESS_COUNTER(data->ctx, result_count->value.u64 * 4);
	if (ASM_PARSER_CONTEXT_DATA_GET_STEP(data->ctx) == ASM_STEP_SCAN) {
		return;
	}

	ParserASTNode *node_val = data->ins_node->childs[1];
	assert(node_val->type == ASM_NODE_EXPR);

	AsmExprEvalResult *result_val = &ASM_EXPR_AST_NODE_GET_RESULT(node_val);
	assert(result_val->type == ASM_EXPR_EVAL_RESULT_TYPE_DOUBLE);

	float value = (float) result_val->value.d;

	for (uint64_t i = 0; i < result_count->value.u64; i++) {
		fwrite(&value, 4, 1, ASM_PARSER_CONTEXT_DATA_GET_OUT(data->ctx));
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
testq %rdi, %rdi
je 0x17751
movq %rsi, %rbx
testq %rsi, %rsi
je 0x17770
movq (%rbx), %rax
cmpl $0x2, 0x44(%rax)
jne 0x1778f
movq 0x48(%rax), %rax
movq (%rax), %r15
cmpl $0xe00, (%r15)          # imm = 0xE00
jne 0x177ae
cmpb $0x1, 0x60(%r15)
jne 0x177cd
movq 0x68(%r15), %rcx
shlq $0x2, %rcx
movq 0x8(%rbx), %rdx
addq %rcx, 0xc0(%rdx)
cmpl $0x1, 0xc8(%rdx)
je 0x17744
movq 0x8(%rax), %rax
cmpl $0xe00, (%rax)          # imm = 0xE00
jne 0x177ec
cmpb $0x2, 0x60(%rax)
jne 0x1780b
cvtsd2ss 0x68(%rax), %xmm0
movss %xmm0, -0x24(%rbp)
cmpq $0x0, 0x68(%r15)
je 0x17744
xorl %r12d, %r12d
leaq -0x24(%rbp), %r14
movq 0x8(%rbx), %rax
movq 0xb8(%rax), %rcx
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
callq 0xa180
incq %r12
cmpq 0x68(%r15), %r12
jb 0x1771e
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18fd2(%rip), %rdi     # 0x3072a
leaq 0x19e1b(%rip), %rsi     # 0x3157a
leaq 0x1a2d1(%rip), %rcx     # 0x31a37
movl $0x13f, %edx            # imm = 0x13F
callq 0xa0b0
leaq 0x1ede4(%rip), %rdi     # 0x3655b
leaq 0x19dfc(%rip), %rsi     # 0x3157a
leaq 0x1a2b2(%rip), %rcx     # 0x31a37
movl $0x140, %edx            # imm = 0x140
callq 0xa0b0
leaq 0x1a11f(%rip), %rdi     # 0x318b5
leaq 0x19ddd(%rip), %rsi     # 0x3157a
leaq 0x1a293(%rip), %rcx     # 0x31a37
movl $0x141, %edx            # imm = 0x141
callq 0xa0b0
leaq 0x1a11d(%rip), %rdi     # 0x318d2
leaq 0x19dbe(%rip), %rsi     # 0x3157a
leaq 0x1a274(%rip), %rcx     # 0x31a37
movl $0x144, %edx            # imm = 0x144
callq 0xa0b0
leaq 0x1a120(%rip), %rdi     # 0x318f4
leaq 0x19d9f(%rip), %rsi     # 0x3157a
leaq 0x1a255(%rip), %rcx     # 0x31a37
movl $0x147, %edx            # imm = 0x147
callq 0xa0b0
leaq 0x1a138(%rip), %rdi     # 0x3192b
leaq 0x19d80(%rip), %rsi     # 0x3157a
leaq 0x1a236(%rip), %rcx     # 0x31a37
movl $0x14f, %edx            # imm = 0x14F
callq 0xa0b0
leaq 0x1a262(%rip), %rdi     # 0x31a74
leaq 0x19d61(%rip), %rsi     # 0x3157a
leaq 0x1a217(%rip), %rcx     # 0x31a37
movl $0x152, %edx            # imm = 0x152
callq 0xa0b0