// File: /workspace/github_c_makefile_star2_O1/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 0x17add
movq %rsi, %rbx
testq %rsi, %rsi
je 0x17afc
movq (%rbx), %rax
cmpl $0x2, 0x44(%rax)
jne 0x17b1b
movq 0x48(%rax), %rax
movq (%rax), %r15
cmpl $0xe00, (%r15)          # imm = 0xE00
jne 0x17b3a
cmpb $0x1, 0x60(%r15)
jne 0x17b59
movq 0x68(%r15), %rcx
shlq $0x2, %rcx
movq 0x8(%rbx), %rdx
addq %rcx, 0xc0(%rdx)
cmpl $0x1, 0xc8(%rdx)
je 0x17ad0
movq 0x8(%rax), %rax
cmpl $0xe00, (%rax)          # imm = 0xE00
jne 0x17b78
cmpb $0x2, 0x60(%rax)
jne 0x17b97
cvtsd2ss 0x68(%rax), %xmm0
movss %xmm0, -0x24(%rbp)
cmpq $0x0, 0x68(%r15)
je 0x17ad0
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 0xa170
incq %r12
cmpq 0x68(%r15), %r12
jb 0x17aaa
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x19c96(%rip), %rdi     # 0x3177a
leaq 0x1aadf(%rip), %rsi     # 0x325ca
leaq 0x1af95(%rip), %rcx     # 0x32a87
movl $0x13f, %edx            # imm = 0x13F
callq 0xa0b0
leaq 0x1faf1(%rip), %rdi     # 0x375f4
leaq 0x1aac0(%rip), %rsi     # 0x325ca
leaq 0x1af76(%rip), %rcx     # 0x32a87
movl $0x140, %edx            # imm = 0x140
callq 0xa0b0
leaq 0x1ade3(%rip), %rdi     # 0x32905
leaq 0x1aaa1(%rip), %rsi     # 0x325ca
leaq 0x1af57(%rip), %rcx     # 0x32a87
movl $0x141, %edx            # imm = 0x141
callq 0xa0b0
leaq 0x1ade1(%rip), %rdi     # 0x32922
leaq 0x1aa82(%rip), %rsi     # 0x325ca
leaq 0x1af38(%rip), %rcx     # 0x32a87
movl $0x144, %edx            # imm = 0x144
callq 0xa0b0
leaq 0x1ade4(%rip), %rdi     # 0x32944
leaq 0x1aa63(%rip), %rsi     # 0x325ca
leaq 0x1af19(%rip), %rcx     # 0x32a87
movl $0x147, %edx            # imm = 0x147
callq 0xa0b0
leaq 0x1adfc(%rip), %rdi     # 0x3297b
leaq 0x1aa44(%rip), %rsi     # 0x325ca
leaq 0x1aefa(%rip), %rcx     # 0x32a87
movl $0x14f, %edx            # imm = 0x14F
callq 0xa0b0
leaq 0x1af26(%rip), %rdi     # 0x32ac4
leaq 0x1aa25(%rip), %rsi     # 0x325ca
leaq 0x1aedb(%rip), %rcx     # 0x32a87
movl $0x152, %edx            # imm = 0x152
callq 0xa0b0