// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
xorl %r14d, %r14d
leaq 0xd447(%rip), %rbx      # 0xf270
leaq 0x83e0(%rip), %r15      # 0xa210
cmpq $0x1a, %r14
je 0x1e53
movq %rbx, %rdi
callq 0x1d32
leaq 0x1(%r14), %rcx
cmpb (%r14,%r15), %al
movq %rcx, %r14
je 0x1e30
pushq $0x5
popq %rdi
callq 0x13ed
leaq 0x86f1(%rip), %r14      # 0xa54b
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
pushq $0xd
popq %rbp
leaq 0x86fe(%rip), %r15      # 0xa56c
xorl %ebx, %ebx
cmpb $0x0, 0x1983a(%rip)     # 0x1b6b1
je 0x1e8d
movzbl 0xd3f0(%rip), %edi      # 0xf270
callq 0x138f
testl %eax, %eax
jne 0x1f4f
callq 0x1fd4
movl %ebp, %edi
callq 0x1030
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
movzbl 0x19807(%rip), %ecx     # 0x1b6b1
testl %ecx, %ecx
je 0x1f4f
movq 0xd2f7(%rip), %rax      # 0xf1b0
cmpl $0x3, %ecx
je 0x1eca
cmpl $0x8, %ecx
je 0x1eca
addq %rax, 0xd30e(%rip)      # 0xf1d8
addq %rax, %rbx
movzbl 0xd39c(%rip), %edi      # 0xf270
movq 0xd2fd(%rip), %rsi      # 0xf1d8
xorl %edx, %edx
callq 0x10d0
movq 0xd2ef(%rip), %rax      # 0xf1d8
movq 0xd488(%rip), %rcx      # 0xf378
cmpq %rcx, %rax
ja 0x1f34
andl $0x0, 0xd474(%rip)      # 0xf370
imulq $0x64, %rbx, %rax
xorl %edx, %edx
divq %rcx
cmpb $0x0, 0x197a5(%rip)     # 0x1b6b1
je 0x1f4f
movq %rax, %r12
movzbl 0xd358(%rip), %edi      # 0xf270
callq 0x138f
testl %eax, %eax
jne 0x1f4f
movzbl %r12b, %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x10b0
jmp 0x1e70
movb $0x0, 0x19776(%rip)     # 0x1b6b1
subq %rax, %rbx
addq %rcx, %rbx
movq %rcx, 0xd290(%rip)      # 0xf1d8
andl $0x0, 0xd421(%rip)      # 0xf370
leaq 0x96a9(%rip), %rdi      # 0xb5ff
callq 0x1070
movq 0xd276(%rip), %rsi      # 0xf1d8
leaq 0x8608(%rip), %rdi      # 0xa571
movq %rbx, %rdx
xorl %eax, %eax
callq 0x10b0
cmpb $0x0, 0x19737(%rip)     # 0x1b6b1
je 0x1f98
movzbl 0xd2ed(%rip), %edi      # 0xf270
callq 0x138f
testl %eax, %eax
je 0x1f98
leaq 0x9671(%rip), %rdi      # 0xb604
callq 0x1070
movzbl 0xd2d1(%rip), %edi      # 0xf270
pushq $0x1a
popq %rsi
xorl %edx, %edx
callq 0x10d0
andl $0x0, 0xd3c0(%rip)      # 0xf370
andq $0x0, 0xd200(%rip)      # 0xf1b8
movq $0x1a, 0xd215(%rip) # 0xf1d8
andq $0x0, 0xd1e5(%rip)      # 0xf1b0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq