// File: /workspace/github_c_makefile_star2_O1/MikeGray-APH[P]LibLouisAPH/source/translate.c
// Function: translate_copy_to_output
int translate_copy_to_output(struct translate *translate, const int count, const int do_map)
{
	int cnt, i;

	/*   ensure count is still within range   */
	if(translate->input_crs + count > translate->input_len)
		cnt = translate->input_len - translate->input_crs;
	else
		cnt = count;

	if(!translate_check_output_max(translate, cnt))
		return 0;

	for(i = 0; i < cnt; i++)
	{
		ASSERT(translate->output_len + i < translate->output_max)
		translate->output[translate->output_len + i] = translate->input[translate->input_crs + i];
		translate->output_mask[translate->output_len + i] = translate->input_mask[translate->input_crs + i];
		if(translate->maps_use)
		if(do_map)
		{
			translate->output_to_input_map[translate->output_len + i] = translate->input_map[translate->input_crs + i];
			translate_remap_input(translate, i, 0);
		}
		else
		{
			translate->output_to_input_map[translate->output_len + i] = -1;
			translate_remap_input(translate, i, 1);
		}
	}

	translate_increment(translate, cnt, cnt);

	return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %r14d
movq %rdi, %rbx
movl 0x40(%rdi), %eax
movl 0x44(%rdi), %ecx
movl %ecx, %ebp
subl %eax, %ebp
addl %esi, %eax
cmpl %ecx, %eax
cmovlel %esi, %ebp
movl %ebp, %esi
callq 0x72d8
testl %eax, %eax
je 0x7840
testl %ebp, %ebp
jle 0x7800
xorl %eax, %eax
movslq 0x68(%rbx), %rdx
movslq %eax, %rcx
addq %rcx, %rdx
cmpl 0x6c(%rbx), %edx
jge 0x7847
movslq 0x40(%rbx), %rsi
addq %rcx, %rsi
movq 0x38(%rbx), %rdi
movq 0x60(%rbx), %r8
movzwl (%rdi,%rsi,2), %edi
movw %di, (%r8,%rdx,2)
movq 0x58(%rbx), %rdi
movq 0x80(%rbx), %r8
movb (%rdi,%rsi), %sil
movb %sil, (%r8,%rdx)
cmpl $0x0, 0x90(%rbx)
je 0x77f6
testl %r14d, %r14d
je 0x777c
movq 0x50(%rbx), %rsi
movq 0x78(%rbx), %rdx
movslq 0x40(%rbx), %rdi
addq %rcx, %rdi
movl (%rsi,%rdi,4), %edi
movslq 0x68(%rbx), %r8
addq %rcx, %r8
movl %edi, (%rdx,%r8,4)
movslq 0x40(%rbx), %rdi
addq %rdi, %rcx
cmpl 0x44(%rbx), %ecx
jge 0x7847
movslq (%rsi,%rcx,4), %rcx
testq %rcx, %rcx
js 0x77f6
movl 0x68(%rbx), %edx
testl %edi, %edi
je 0x773e
movl -0x4(%rsi,%rdi,4), %r8d
cmpl (%rsi,%rdi,4), %r8d
je 0x77f6
movq 0x48(%rbx), %rsi
cmpl $0x0, (%rsi,%rcx,4)
js 0x77f6
leal 0x1(%rcx), %edi
cmpl 0x20(%rbx), %edi
jge 0x7777
movl %edi, %r8d
leaq (%rsi,%r8,4), %r8
movl (%r8), %r9d
testl %r9d, %r9d
js 0x7777
cmpl (%rsi,%rcx,4), %r9d
jne 0x7777
movl %edx, (%r8)
incl %edi
addq $0x4, %r8
cmpl %edi, 0x20(%rbx)
jg 0x775b
movl %edx, (%rsi,%rcx,4)
jmp 0x77f6
movq 0x78(%rbx), %rdx
movslq 0x68(%rbx), %rsi
addq %rcx, %rsi
movl $0xffffffff, (%rdx,%rsi,4) # imm = 0xFFFFFFFF
movslq 0x40(%rbx), %rdx
addq %rdx, %rcx
cmpl 0x44(%rbx), %ecx
jge 0x7847
movq 0x50(%rbx), %rsi
movslq (%rsi,%rcx,4), %rcx
testq %rcx, %rcx
js 0x77f6
testl %edx, %edx
je 0x77b8
movl -0x4(%rsi,%rdx,4), %edi
cmpl (%rsi,%rdx,4), %edi
je 0x77f6
movq 0x48(%rbx), %rdx
cmpl $0x0, (%rdx,%rcx,4)
js 0x77f6
leal 0x1(%rcx), %esi
cmpl 0x20(%rbx), %esi
jge 0x77ef
movl %esi, %edi
leaq (%rdx,%rdi,4), %rdi
movl (%rdi), %r8d
testl %r8d, %r8d
js 0x77ef
cmpl (%rdx,%rcx,4), %r8d
jne 0x77ef
movl $0xffffffff, (%rdi)     # imm = 0xFFFFFFFF
incl %esi
addq $0x4, %rdi
cmpl %esi, 0x20(%rbx)
jg 0x77d0
movl $0xffffffff, (%rdx,%rcx,4) # imm = 0xFFFFFFFF
incl %eax
cmpl %ebp, %eax
jl 0x769a
testl %ebp, %ebp
je 0x7833
cmpl $0x0, 0x8c(%rbx)
jne 0x7833
movl 0x40(%rbx), %eax
movl 0x88(%rbx), %ecx
cmpl %eax, %ecx
jl 0x7833
addl %ebp, %eax
cmpl %eax, %ecx
jge 0x7833
movl $0x1, 0x8c(%rbx)
movl 0x68(%rbx), %eax
movl %eax, 0x88(%rbx)
addl %ebp, 0x40(%rbx)
addl %ebp, 0x68(%rbx)
movl $0x1, %eax
jmp 0x7842
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
callq 0x1060