// File: /workspace/github_c_makefile_star2_O2/Ihsoh[P]ilang/compiler/assembler/ins_directive_enc.c
// Function: ins_enc_strings
void ins_enc_strings(
	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);

	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_STRING);

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

	for (uint64_t i = 0; i < result_count->value.u64; i++) {
		fwrite(
			result_val->value.str.ptr,
			result_val->value.str.len,
			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 0x16d9b
movq %rsi, %rbx
testq %rsi, %rsi
je 0x16dba
movq (%rbx), %rax
cmpl $0x2, 0x44(%rax)
jne 0x16dd9
movq 0x48(%rax), %rax
movq (%rax), %r15
cmpl $0xe00, (%r15)          # imm = 0xE00
jne 0x16df8
cmpb $0x1, 0x60(%r15)
jne 0x16e17
movq 0x8(%rax), %r12
cmpl $0xe00, (%r12)          # imm = 0xE00
jne 0x16e36
cmpb $0x3, 0x60(%r12)
jne 0x16e55
movq 0x70(%r12), %rax
imulq 0x68(%r15), %rax
movq 0x8(%rbx), %rcx
addq %rax, 0xc0(%rcx)
cmpl $0x1, 0xc8(%rcx)
jne 0x16d6c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r13d, %r13d
pushq $0x1
popq %r14
cmpq 0x68(%r15), %r13
jae 0x16d5d
movq 0x68(%r12), %rdi
movq 0x70(%r12), %rsi
movq 0x8(%rbx), %rax
movq 0xb8(%rax), %rcx
movq %r14, %rdx
callq 0xa170
incq %r13
jmp 0x16d73
leaq 0x18998(%rip), %rdi     # 0x2f73a
leaq 0x197e1(%rip), %rsi     # 0x3058a
leaq 0x19d47(%rip), %rcx     # 0x30af7
movl $0x17d, %edx            # imm = 0x17D
callq 0xa0b0
leaq 0x1e82a(%rip), %rdi     # 0x355eb
leaq 0x197c2(%rip), %rsi     # 0x3058a
leaq 0x19d28(%rip), %rcx     # 0x30af7
movl $0x17e, %edx            # imm = 0x17E
callq 0xa0b0
leaq 0x19ae5(%rip), %rdi     # 0x308c5
leaq 0x197a3(%rip), %rsi     # 0x3058a
leaq 0x19d09(%rip), %rcx     # 0x30af7
movl $0x17f, %edx            # imm = 0x17F
callq 0xa0b0
leaq 0x19ae3(%rip), %rdi     # 0x308e2
leaq 0x19784(%rip), %rsi     # 0x3058a
leaq 0x19cea(%rip), %rcx     # 0x30af7
movl $0x182, %edx            # imm = 0x182
callq 0xa0b0
leaq 0x19ae6(%rip), %rdi     # 0x30904
leaq 0x19765(%rip), %rsi     # 0x3058a
leaq 0x19ccb(%rip), %rcx     # 0x30af7
movl $0x185, %edx            # imm = 0x185
callq 0xa0b0
leaq 0x19afe(%rip), %rdi     # 0x3093b
leaq 0x19746(%rip), %rsi     # 0x3058a
leaq 0x19cac(%rip), %rcx     # 0x30af7
movl $0x188, %edx            # imm = 0x188
callq 0xa0b0
leaq 0x19cd9(%rip), %rdi     # 0x30b35
leaq 0x19727(%rip), %rsi     # 0x3058a
leaq 0x19c8d(%rip), %rcx     # 0x30af7
movl $0x18b, %edx            # imm = 0x18B
callq 0xa0b0