// File: /workspace/github_c_makefile_star2_O3/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, %r12d
movl %esi, %ebp
movq %rdi, %r14
callq 0x213a6
cmpl $0x4001, %ebp           # imm = 0x4001
movl $0x1, %r15d
movl %ebp, %eax
cmovael %r15d, %eax
movl %eax, 0x8(%rsp)
cmovael %ebp, %r15d
leaq 0x6(%rsp), %rdi
movl $0x2, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x6550
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpq $0x1, %rax
jne 0x217bf
movzwl 0x6(%rsp), %r13d
movq 0x197349(%rip), %rdi    # 0x1b89c0
movl $0x1, %edx
movq %r13, %rsi
movq %rbx, %rcx
callq 0x6550
cmpq $0x1, %rax
jne 0x217bf
imull %r12d, %r15d
movq 0x197324(%rip), %rdi    # 0x1b89c0
movq 0x197325(%rip), %rdx    # 0x1b89c8
movl %r13d, %esi
callq 0x21465
movl %eax, %r13d
movq 0x197313(%rip), %rdi    # 0x1b89c8
movq %r14, %rsi
movl 0x8(%rsp), %ebp
movl %ebp, %edx
callq 0x4d437
cmpl $0x2, %r15d
jb 0x217b5
movq %rbx, 0x20(%rsp)
movl %r15d, 0xc(%rsp)
movl %r15d, %r8d
movl %ebp, %r9d
movl %ebp, %edi
movq %r9, %rbp
negq %rbp
leaq (%r14,%r9), %r12
movl $0x1, %ebx
movl %edi, %eax
movq %r8, 0x18(%rsp)
movq %r9, 0x10(%rsp)
movq 0x20(%rsp), %r15
cmpl %r13d, %eax
jl 0x21771
movl $0x2, %esi
movl $0x1, %edx
leaq 0x6(%rsp), %rdi
movq %r15, %rcx
callq 0x6550
cmpq $0x1, %rax
jne 0x217ba
movzwl 0x6(%rsp), %r13d
movq 0x19728e(%rip), %rdi    # 0x1b89c0
movl $0x1, %edx
movq %r13, %rsi
movq %r15, %rcx
callq 0x6550
cmpq $0x1, %rax
jne 0x217ba
movq 0x197271(%rip), %rdi    # 0x1b89c0
movq 0x197272(%rip), %rdx    # 0x1b89c8
movl %r13d, %esi
callq 0x21465
movl %eax, %r13d
xorl %eax, %eax
movl 0x8(%rsp), %edi
movq 0x18(%rsp), %r8
movq 0x10(%rsp), %r9
testl %edi, %edi
je 0x2179b
movslq %eax, %rcx
xorl %edx, %edx
movq 0x197247(%rip), %rsi    # 0x1b89c8
addq %rcx, %rsi
movb (%rdx,%rsi), %sil
addb (%r14,%rdx), %sil
movb %sil, (%r12,%rdx)
incq %rdx
movq %rbp, %rsi
addq %rdx, %rsi
jne 0x2177a
addl %edi, %eax
addq %r9, %r14
incq %rbx
addq %r9, %r12
cmpq %r8, %rbx
jne 0x216ff
movl 0xc(%rsp), %ebp
jmp 0x217bf
movl %r15d, %ebp
jmp 0x217bf
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movb $0x1, 0x19720e(%rip)    # 0x1b89d4
movl $0x1010101, 0x197200(%rip) # imm = 0x1010101
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq