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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
callq 0x31780
cmpl $0x4000, -0x14(%rbp)    # imm = 0x4000
jbe 0x32365
movl -0x14(%rbp), %eax
imull -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movl $0x1, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq 0x1c31b0(%rip), %rsi    # 0x1f5528
movl -0x14(%rbp), %edx
callq 0x6ef00
movl -0x14(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl $0x4000, %ecx           # imm = 0x4000
subl -0x14(%rbp), %ecx
cmpl %ecx, %eax
jbe 0x32425
movq 0x1c3188(%rip), %rdi    # 0x1f5528
movl -0x2c(%rbp), %esi
movq 0x1c3176(%rip), %rdx    # 0x1f5520
callq 0x31fd0
movw %ax, -0x2e(%rbp)
movl $0x0, -0x2c(%rbp)
movw -0x2e(%rbp), %ax
movw %ax, -0x30(%rbp)
movq -0x20(%rbp), %rcx
leaq -0x30(%rbp), %rdi
movl $0x2, %esi
movl $0x1, %edx
callq 0x6aa0
cmpq $0x1, %rax
je 0x323f0
callq 0x31870
movl $0x0, -0x4(%rbp)
jmp 0x325de
movq 0x1c3129(%rip), %rdi    # 0x1f5520
movzwl -0x2e(%rbp), %eax
movslq %eax, %rsi
movq -0x20(%rbp), %rcx
movl $0x1, %edx
callq 0x6aa0
cmpq $0x1, %rax
je 0x32423
callq 0x31870
movl $0x0, -0x4(%rbp)
jmp 0x325de
jmp 0x32425
movl $0x1, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x18(%rbp), %eax
jae 0x3254e
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x32488
movq -0x38(%rbp), %rax
movl -0x28(%rbp), %ecx
addl -0x14(%rbp), %ecx
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
movq -0x38(%rbp), %rcx
movl -0x28(%rbp), %edx
movzbl (%rcx,%rdx), %ecx
subl %ecx, %eax
andl $0xff, %eax
movb %al, %dl
movq 0x1c30b6(%rip), %rax    # 0x1f5528
movl -0x28(%rbp), %ecx
addl -0x2c(%rbp), %ecx
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x3243f
movl -0x14(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl $0x4000, %ecx           # imm = 0x4000
subl -0x14(%rbp), %ecx
cmpl %ecx, %eax
jbe 0x32530
movq 0x1c307d(%rip), %rdi    # 0x1f5528
movl -0x2c(%rbp), %esi
movq 0x1c306b(%rip), %rdx    # 0x1f5520
callq 0x31fd0
movw %ax, -0x2e(%rbp)
movl $0x0, -0x2c(%rbp)
movw -0x2e(%rbp), %ax
movw %ax, -0x30(%rbp)
movq -0x20(%rbp), %rcx
leaq -0x30(%rbp), %rdi
movl $0x2, %esi
movl $0x1, %edx
callq 0x6aa0
cmpq $0x1, %rax
je 0x324fb
callq 0x31870
movl $0x0, -0x4(%rbp)
jmp 0x325de
movq 0x1c301e(%rip), %rdi    # 0x1f5520
movzwl -0x2e(%rbp), %eax
movslq %eax, %rsi
movq -0x20(%rbp), %rcx
movl $0x1, %edx
callq 0x6aa0
cmpq $0x1, %rax
je 0x3252e
callq 0x31870
movl $0x0, -0x4(%rbp)
jmp 0x325de
jmp 0x32530
movl -0x14(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3242c
cmpl $0x0, -0x2c(%rbp)
jbe 0x325d3
movq 0x1c2fcd(%rip), %rdi    # 0x1f5528
movl -0x2c(%rbp), %esi
movq 0x1c2fbb(%rip), %rdx    # 0x1f5520
callq 0x31fd0
movw %ax, -0x2e(%rbp)
movw -0x2e(%rbp), %ax
movw %ax, -0x30(%rbp)
movq -0x20(%rbp), %rcx
leaq -0x30(%rbp), %rdi
movl $0x2, %esi
movl $0x1, %edx
callq 0x6aa0
cmpq $0x1, %rax
je 0x325a1
callq 0x31870
movl $0x0, -0x4(%rbp)
jmp 0x325de
movq 0x1c2f78(%rip), %rdi    # 0x1f5520
movzwl -0x2e(%rbp), %eax
movslq %eax, %rsi
movq -0x20(%rbp), %rcx
movl $0x1, %edx
callq 0x6aa0
cmpq $0x1, %rax
je 0x325d1
callq 0x31870
movl $0x0, -0x4(%rbp)
jmp 0x325de
jmp 0x325d3
callq 0x31870
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)