// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/cache1d.c
// Function: dfread
unsigned dfread(void *buffer, unsigned dasizeof, unsigned count, BFILE *fil)
{
	size_t i, j;
	int k, kgoal;
	unsigned short leng;
	unsigned char *ptr;

	lzwallocate();

	if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; }
	ptr = (unsigned char *)buffer;

	if (Bfread(&leng,2,1,fil) != 1) { lzwrelease(); return -1; }
	leng = B_LITTLE16(leng);
	if (Bfread(lzwbuf5,(int)leng,1,fil) != 1) { lzwrelease(); return -1; }
	k = 0; kgoal = lzwuncompress(lzwbuf5,(int)leng,lzwbuf4);

	copybufbyte(lzwbuf4,ptr,(int)dasizeof);
	k += (int)dasizeof;

	for(i=1;i<count;i++)
	{
		if (k >= kgoal)
		{
			if (Bfread(&leng,2,1,fil) != 1) { lzwrelease(); return -1; }
			leng = B_LITTLE16(leng);
			if (Bfread(lzwbuf5,(int)leng,1,fil) != 1) { lzwrelease(); return -1; }
			k = 0; kgoal = lzwuncompress(lzwbuf5,(int)leng,lzwbuf4);
		}
		for(j=0;j<dasizeof;j++) ptr[j+dasizeof] = ((ptr[j]+lzwbuf4[j+k])&255);
		k += dasizeof;
		ptr += dasizeof;
	}
	lzwrelease();
	return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %rbx
movl %edx, 0x8(%rsp)
movl %esi, %ebp
movq %rdi, %r15
callq 0x1ea64
cmpl $0x4001, %ebp           # imm = 0x4001
pushq $0x1
popq %r13
movl %ebp, %r14d
cmovael %r13d, %r14d
cmovael %ebp, %r13d
leaq 0x6(%rsp), %rdi
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x6550
pushq $-0x1
popq %r12
cmpq $0x1, %rax
jne 0x1ee49
movzwl 0x6(%rsp), %ebp
movq 0x192caa(%rip), %rdi    # 0x1b19c0
pushq $0x1
popq %rdx
movq %rbp, %rsi
movq %rbx, %rcx
callq 0x6550
cmpq $0x1, %rax
jne 0x1ee49
movq %rbx, 0x20(%rsp)
movl %r13d, %ebx
imull 0x8(%rsp), %ebx
movq 0x192c7e(%rip), %rdi    # 0x1b19c0
movq 0x192c7f(%rip), %rdx    # 0x1b19c8
movl %ebp, %esi
callq 0x1eb23
movl %eax, %r13d
movq 0x192c6e(%rip), %rdi    # 0x1b19c8
movq %r15, %rsi
movl %r14d, %edx
callq 0x44524
movl %ebx, 0x10(%rsp)
movl %ebx, %ebx
movl %r14d, %r12d
pushq $0x1
popq %rdx
movq %rdx, %r9
movl %r14d, %eax
movl %r14d, 0x14(%rsp)
movq %rbx, 0x18(%rsp)
movq 0x20(%rsp), %rbp
cmpq %rbx, %r9
jae 0x1ee3e
cmpl %r13d, %eax
jl 0x1ee07
movq %r9, 0x8(%rsp)
leaq 0x6(%rsp), %rdi
pushq $0x2
popq %rsi
movq %rbp, %rcx
movq %rdx, %r14
callq 0x6550
cmpq $0x1, %rax
jne 0x1ee45
movzwl 0x6(%rsp), %r13d
movq 0x192bfd(%rip), %rdi    # 0x1b19c0
movq %r13, %rsi
movq %r14, %rbx
movq %r14, %rdx
movq %rbp, %rcx
callq 0x6550
cmpq $0x1, %rax
jne 0x1ee45
movq 0x192bdf(%rip), %rdi    # 0x1b19c0
movq 0x192be0(%rip), %rdx    # 0x1b19c8
movl %r13d, %esi
callq 0x1eb23
movl %eax, %r13d
xorl %eax, %eax
movq %rbx, %rdx
movl 0x14(%rsp), %r14d
movq 0x18(%rsp), %rbx
movq 0x8(%rsp), %r9
movslq %eax, %r8
leaq (%r15,%r12), %rcx
xorl %esi, %esi
cmpq %rsi, %r12
je 0x1ee30
movq 0x192bac(%rip), %rdi    # 0x1b19c8
addq %r8, %rdi
movb (%rsi,%rdi), %dil
addb (%r15,%rsi), %dil
movb %dil, (%rcx,%rsi)
incq %rsi
jmp 0x1ee10
addl %r14d, %eax
incq %r9
movq %rcx, %r15
jmp 0x1ed86
movl 0x10(%rsp), %r12d
jmp 0x1ee49
pushq $-0x1
popq %r12
movb $0x1, 0x192b84(%rip)    # 0x1b19d4
movl $0x1010101, 0x192b76(%rip) # imm = 0x1010101
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq