// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: CheckVOCHeader
void CheckVOCHeader(void)
{
  byte vochdr[26]="Creative Voice File\x1a\x1a\x0\x0a\x01\x29\x11",
       count;
  dword totalsamp=0;
  for (count=0; count<sizeof(vochdr); count++)
      {
	if (GetData(&inpfile)!=vochdr[count])
	   Error(5);
      }
  printf("Checking input file integrity...");
  while (!blocktype || !eof(inpfile.handle))
	{
	  ReadVOCBlock();
	  printf("\x0d");
	  printf("Checking input file integrity...");
	  if (!blocktype) break;
	  else {
		 byte ratio=0;
		 totalsamp+=blocklength;
		 if (blocktype!=8 && blocktype!=3) filepos+=blocklength;
		 lseek(inpfile.handle,filepos,SEEK_SET);
		 if (filepos>inpfile.length)
		    {
		      blocktype=0;
		      totalsamp-=(filepos-inpfile.length);
		      filepos=inpfile.length;
		    }
		 inpfile.bufpoint=0;
		 ratio=(totalsamp*100)/inpfile.length;
		 if (!blocktype || eof(inpfile.handle)) break;
/*                  {
		      printf("done\n");
		      printf("Total file length: %lu bytes (%lu
		      samples)\n\n",filepos,totalsamp);
		      if (blocktype && eof(inpfile.handle))
		      printf("***WARNING*** - Unexpected end of file!\n\n");
		    } */
		 else printf("%d%%",ratio);
	       }
	}
/*  if (eof(inpfile.length) && blocktype)
     {
       Error(9);
     } */
  printf("done\n");
  printf("Total file length: %lu bytes (%lu samples)\n\n",filepos,totalsamp);
  if (blocktype && eof(inpfile.handle)) printf("***WARNING*** - Unexpected end of file!\n\n");
  lseek(inpfile.handle,26,SEEK_SET);
  filepos=26;
  blocklength=processed=inpfile.bufpoint=0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
xorl %r14d, %r14d
leaq 0xd3fc(%rip), %rbx      # 0xf280
leaq 0x9385(%rip), %r15      # 0xb210
movq %rbx, %rdi
callq 0x1d8c
cmpb (%r14,%r15), %al
jne 0x2035
incq %r14
cmpq $0x1a, %r14
jne 0x1e8b
leaq 0x96fe(%rip), %r14      # 0xb5ab
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
leaq 0x970e(%rip), %r15      # 0xb5cc
xorl %ebx, %ebx
cmpb $0x0, 0x197fa(%rip)     # 0x1b6c1
je 0x1edd
movzbl 0xd3b0(%rip), %edi      # 0xf280
callq 0x13a8
testl %eax, %eax
jne 0x1fa8
callq 0x203f
movl $0xd, %edi
callq 0x1030
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
movzbl 0x197c4(%rip), %ecx     # 0x1b6c1
testl %ecx, %ecx
je 0x1fa8
movq 0xd2b4(%rip), %rax      # 0xf1c0
cmpl $0x3, %ecx
je 0x1f1d
cmpl $0x8, %ecx
je 0x1f1d
addq %rax, 0xd2cb(%rip)      # 0xf1e8
addq %rax, %rbx
movzbl 0xd359(%rip), %edi      # 0xf280
movq 0xd2ba(%rip), %rsi      # 0xf1e8
xorl %edx, %edx
callq 0x10d0
movq 0xd2ac(%rip), %rax      # 0xf1e8
movq 0xd445(%rip), %rcx      # 0xf388
cmpq %rcx, %rax
ja 0x1f8a
movl $0x0, 0xd42e(%rip)      # 0xf380
imulq $0x64, %rbx, %rax
xorl %edx, %edx
divq %rcx
cmpb $0x0, 0x1975f(%rip)     # 0x1b6c1
je 0x1fa8
movq %rax, %r12
movzbl 0xd312(%rip), %edi      # 0xf280
callq 0x13a8
testl %eax, %eax
jne 0x1fa8
movzbl %r12b, %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x10b0
jmp 0x1ec0
movb $0x0, 0x19730(%rip)     # 0x1b6c1
subq %rax, %rbx
addq %rcx, %rbx
movq %rcx, 0xd24a(%rip)      # 0xf1e8
movl $0x0, 0xd3d8(%rip)      # 0xf380
leaq 0xa6b0(%rip), %rdi      # 0xc65f
callq 0x1070
movq 0xd22d(%rip), %rsi      # 0xf1e8
leaq 0x960f(%rip), %rdi      # 0xb5d1
movq %rbx, %rdx
xorl %eax, %eax
callq 0x10b0
cmpb $0x0, 0x196ee(%rip)     # 0x1b6c1
je 0x1ff1
movzbl 0xd2a4(%rip), %edi      # 0xf280
callq 0x13a8
testl %eax, %eax
je 0x1ff1
leaq 0xa678(%rip), %rdi      # 0xc664
callq 0x1070
movzbl 0xd288(%rip), %edi      # 0xf280
xorl %ebx, %ebx
movl $0x1a, %esi
xorl %edx, %edx
callq 0x10d0
movq $0x1a, 0xd1d7(%rip) # 0xf1e8
movl $0x0, 0xd365(%rip)      # 0xf380
movq %rbx, 0xd1a6(%rip)      # 0xf1c8
movq %rbx, 0xd197(%rip)      # 0xf1c0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl $0x5, %edi
callq 0x140c