// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x16a5a
movq %rsi, %rbx
testq %rsi, %rsi
je 0x16a79
movq (%rbx), %rax
cmpl $0x2, 0x44(%rax)
jne 0x16a98
movq 0x48(%rax), %rax
movq (%rax), %r13
cmpl $0xe00, (%r13)          # imm = 0xE00
jne 0x16ab7
cmpb $0x1, 0x60(%r13)
jne 0x16ad6
movq 0x68(%r13), %rcx
shlq $0x2, %rcx
movq 0x8(%rbx), %rdx
addq %rcx, 0xc0(%rdx)
cmpl $0x1, 0xc8(%rdx)
jne 0x16a03
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rax), %rax
cmpl $0xe00, (%rax)          # imm = 0xE00
jne 0x16af5
cmpb $0x2, 0x60(%rax)
jne 0x16b14
cvtsd2ss 0x68(%rax), %xmm0
leaq -0x2c(%rbp), %rax
movss %xmm0, (%rax)
xorl %r14d, %r14d
pushq $0x4
popq %r15
pushq $0x1
popq %r12
cmpq 0x68(%r13), %r14
jae 0x169f4
movq 0x8(%rbx), %rax
movq 0xb8(%rax), %rcx
leaq -0x2c(%rbp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xa170
incq %r14
jmp 0x16a35
leaq 0x18cd9(%rip), %rdi     # 0x2f73a
leaq 0x19b22(%rip), %rsi     # 0x3058a
leaq 0x19fd8(%rip), %rcx     # 0x30a47
movl $0x13f, %edx            # imm = 0x13F
callq 0xa0b0
leaq 0x1eb6b(%rip), %rdi     # 0x355eb
leaq 0x19b03(%rip), %rsi     # 0x3058a
leaq 0x19fb9(%rip), %rcx     # 0x30a47
movl $0x140, %edx            # imm = 0x140
callq 0xa0b0
leaq 0x19e26(%rip), %rdi     # 0x308c5
leaq 0x19ae4(%rip), %rsi     # 0x3058a
leaq 0x19f9a(%rip), %rcx     # 0x30a47
movl $0x141, %edx            # imm = 0x141
callq 0xa0b0
leaq 0x19e24(%rip), %rdi     # 0x308e2
leaq 0x19ac5(%rip), %rsi     # 0x3058a
leaq 0x19f7b(%rip), %rcx     # 0x30a47
movl $0x144, %edx            # imm = 0x144
callq 0xa0b0
leaq 0x19e27(%rip), %rdi     # 0x30904
leaq 0x19aa6(%rip), %rsi     # 0x3058a
leaq 0x19f5c(%rip), %rcx     # 0x30a47
movl $0x147, %edx            # imm = 0x147
callq 0xa0b0
leaq 0x19e3f(%rip), %rdi     # 0x3093b
leaq 0x19a87(%rip), %rsi     # 0x3058a
leaq 0x19f3d(%rip), %rcx     # 0x30a47
movl $0x14f, %edx            # imm = 0x14F
callq 0xa0b0
leaq 0x19f69(%rip), %rdi     # 0x30a84
leaq 0x19a68(%rip), %rsi     # 0x3058a
leaq 0x19f1e(%rip), %rcx     # 0x30a47
movl $0x152, %edx            # imm = 0x152
callq 0xa0b0