// File: /workspace/github_c_makefile_star2_O1/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 0xd3dc(%rip), %rbx      # 0xf280
leaq 0x9365(%rip), %r15      # 0xb210
movq %rbx, %rdi
callq 0x1db5
cmpb (%r14,%r15), %al
jne 0x204b
incq %r14
cmpq $0x1a, %r14
jne 0x1eab
leaq 0x96de(%rip), %r14      # 0xb5ab
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
leaq 0x96ee(%rip), %r15      # 0xb5cc
xorl %ebx, %ebx
cmpb $0x0, 0x197da(%rip)     # 0x1b6c1
je 0x1efd
movzbl 0xd390(%rip), %edi      # 0xf280
callq 0x13a8
testl %eax, %eax
jne 0x1fbe
callq 0x2055
movl $0xd, %edi
callq 0x1030
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
movzbl 0x197a4(%rip), %ecx     # 0x1b6c1
testl %ecx, %ecx
je 0x1fbe
movq 0xd294(%rip), %rax      # 0xf1c0
cmpl $0x3, %ecx
je 0x1f3d
cmpl $0x8, %ecx
je 0x1f3d
addq %rax, 0xd2ab(%rip)      # 0xf1e8
addq %rax, %rbx
movzbl 0xd339(%rip), %edi      # 0xf280
movq 0xd29a(%rip), %rsi      # 0xf1e8
xorl %edx, %edx
callq 0x10d0
movq 0xd28c(%rip), %rax      # 0xf1e8
movq 0xd425(%rip), %rcx      # 0xf388
cmpq %rcx, %rax
jbe 0x1f7c
movb $0x0, 0x19752(%rip)     # 0x1b6c1
subq %rax, %rbx
addq %rcx, %rbx
movq %rcx, 0xd26c(%rip)      # 0xf1e8
movl $0x0, 0xd3fa(%rip)      # 0xf380
imulq $0x64, %rbx, %rax
xorl %edx, %edx
divq %rcx
cmpb $0x0, 0x1972b(%rip)     # 0x1b6c1
je 0x1fbe
movq %rax, %r12
movzbl 0xd2de(%rip), %edi      # 0xf280
callq 0x13a8
testl %eax, %eax
jne 0x1fbe
movzbl %r12b, %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x10b0
jmp 0x1ee0
leaq 0xa69a(%rip), %rdi      # 0xc65f
callq 0x1070
movq 0xd217(%rip), %rsi      # 0xf1e8
leaq 0x95f9(%rip), %rdi      # 0xb5d1
movq %rbx, %rdx
xorl %eax, %eax
callq 0x10b0
cmpb $0x0, 0x196d8(%rip)     # 0x1b6c1
je 0x2007
movzbl 0xd28e(%rip), %edi      # 0xf280
callq 0x13a8
testl %eax, %eax
je 0x2007
leaq 0xa662(%rip), %rdi      # 0xc664
callq 0x1070
movzbl 0xd272(%rip), %edi      # 0xf280
xorl %ebx, %ebx
movl $0x1a, %esi
xorl %edx, %edx
callq 0x10d0
movq $0x1a, 0xd1c1(%rip) # 0xf1e8
movl $0x0, 0xd34f(%rip)      # 0xf380
movq %rbx, 0xd190(%rip)      # 0xf1c8
movq %rbx, 0xd181(%rip)      # 0xf1c0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl $0x5, %edi
callq 0x140c