// File: /workspace/github_c_makefile_star2_O1/mincebert[P]maketzx/maketzx.c
// Function: CheckSyntax
void CheckSyntax(void)
{
  byte params=0,files=0,fnamelen;
  char *fstoppos,*bslashpos;
  printf("\n-=[ MAKETZX v%s ]=- Copyright (C) 1998 Stefano Donati of RAMSOFT\n\n",version);  if (ARGC<1) { Instructions(); }
  for (params=1; params<ARGC; params++)
      {
	if ((ARGV[params][0]=='/') || (ARGV[params][0]=='-'))
	{
	  if (strlen(ARGV[params])>2) Instructions();
	  strnset(ARGV[params],' ',1);
	  ARGV[params]=strlwr(ARGV[params]);
	  switch (ARGV[params][1])
		 {
		   case 'a' : if (slocktype || normal || bleep || soft || zeta) Error(13);
			      alk=1; break;
		   case 'b' : if (slocktype || normal || alk || soft || zeta) Error(13);
			      bleep=1; break;
		   case 'f' : if (alk || normal || bleep || slocktype || zeta) Error(13);
		   case 'k' : params++; blockskip=atoi(ARGV[params]); break;
		   case 'l' : loggen=1; break;
		   case 'n' : if (alk || slocktype || bleep || soft || zeta) Error(13);
			      normal=1; break;
		   case 'q' : hifi=0; break;
		   case 'r' : tzxhead[9]=0x01; tzxver[2]='0'; tzxver[3]='1'; break;
		   case 's' : params++;
			      if ((atoi(ARGV[params])<1) || (atoi(ARGV[params])>7))
				 {
				   printf("ERROR - Speedlock type %s does not exist!\n\n",ARGV[params]);
				   exit(1);
				 }
			      if (alk || normal || bleep || soft || zeta) Error(13);
			      slocktype=atoi(ARGV[params]); break;
		   case 'x' : hex=1; break;
		   case 'z' : if (alk || slocktype || bleep || soft || normal) Error(13);
			      zeta=1; break;
		   default : InvalidSwitch(ARGV[params]);
		 }
	}
	else {
	       files++;
	       switch (files)
		      {
			case 1 : strcpy(inpfile.name,ARGV[params]); break;
			case 2 : strcpy(outfile.name,ARGV[params]); break;
			case 3 : Instructions(); break;
		      }
	     }
      }
  fstoppos=strrchr(inpfile.name,'.');
  bslashpos=strrchr(inpfile.name,'\\');

  //printf("NAME='%s' P=%x BSL=%x\n",inpfile.name,inpfile.name,bslashpos);

  if (!files) Instructions();
  if (files==1)
     {
       if (bslashpos!=NULL) fnamelen=strlen(inpfile.name)-(bslashpos-inpfile.name)-1;
       else fnamelen=strlen(inpfile.name);
       strcpy(outfile.name,strncpy(outfile.name,strrev(inpfile.name),fnamelen));
       strrev(inpfile.name); strrev(outfile.name);
       if (fstoppos!=NULL)
	  {
	    outfile.name[(int)(strrchr(outfile.name,'.')-outfile.name)]='\0';
	  }
       else // strcat(strupr(inpfile.name),".VOC");
            strcat(inpfile.name,".voc");
       // strcat(strupr(outfile.name),".TZX");
       strcat(outfile.name,".tzx");
     }
  else if (fstoppos==NULL) strcat(inpfile.name,".voc");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x9c74(%rip), %rdi      # 0xb490
leaq 0xd8bd(%rip), %rsi      # 0xf0e0
xorl %eax, %eax
callq 0x10b0
cmpl $0x0, 0x19e93(%rip)     # 0x1b6c4
jle 0x1caf
cmpl $0x2, 0x19e86(%rip)     # 0x1b6c4
jl 0x1b80
movb $0x1, %bpl
xorl %r12d, %r12d
leaq 0x97f7(%rip), %r13      # 0xb048
leaq 0x11b41(%rip), %r14     # 0x13399
movq 0x19e69(%rip), %rax     # 0x1b6c8
movzbl %bpl, %ebx
movq (%rax,%rbx,8), %rsi
movzbl (%rsi), %eax
orl $0x2, %eax
cmpl $0x2f, %eax
jne 0x193b
movq %rsi, %rdi
callq 0x10a0
cmpq $0x3, %rax
jae 0x1caf
movq 0x19e39(%rip), %rax     # 0x1b6c8
movq (%rax,%rbx,8), %rdi
cmpb $0x0, (%rdi)
je 0x18a8
setne %al
movzbl %al, %edx
movl $0x20, %esi
callq 0x10e0
movq 0x19e19(%rip), %rax     # 0x1b6c8
shll $0x3, %ebx
movq (%rax,%rbx), %r15
movq %r15, %rdi
callq 0x12da
movq 0x19e03(%rip), %rax     # 0x1b6c8
movq %r15, (%rax,%rbx)
movq 0x19df8(%rip), %rax     # 0x1b6c8
movq (%rax,%rbx), %rsi
movzbl 0x1(%rsi), %ecx
addl $-0x61, %ecx
cmpl $0x19, %ecx
ja 0x1cca
movslq (%r13,%rcx,4), %rcx
addq %r13, %rcx
jmpq *%rcx
cmpb $0x0, 0xd8bf(%rip)      # 0xf1b4
jne 0x1cb4
cmpb $0x0, 0xd8ae(%rip)      # 0xf1b0
jne 0x1cb4
cmpb $0x0, 0xd8a4(%rip)      # 0xf1b3
jne 0x1cb4
cmpb $0x0, 0xd896(%rip)      # 0xf1b2
jne 0x1cb4
cmpb $0x0, 0xd88c(%rip)      # 0xf1b5
jne 0x1cb4
movb $0x1, 0xd87b(%rip)      # 0xf1b1
jmp 0x1b6b
leal 0x1(%r12), %ebx
testb %r12b, %r12b
je 0x1964
movzbl %r12b, %eax
cmpl $0x1, %eax
je 0x195f
movl %ebx, %r12d
cmpl $0x2, %eax
jne 0x1b6b
jmp 0x1caf
movq %r14, %rdi
jmp 0x196b
leaq 0xd916(%rip), %rdi      # 0xf281
callq 0x1060
movl %ebx, %r12d
jmp 0x1b6b
movb $0x1, 0xd838(%rip)      # 0xf1b7
jmp 0x1b6b
cmpb $0x0, 0xd826(%rip)      # 0xf1b1
jne 0x1cb4
cmpb $0x0, 0xd81c(%rip)      # 0xf1b4
jne 0x1cb4
cmpb $0x0, 0xd80e(%rip)      # 0xf1b3
jne 0x1cb4
cmpb $0x0, 0xd800(%rip)      # 0xf1b2
jne 0x1cb4
cmpb $0x0, 0xd7f1(%rip)      # 0xf1b0
jne 0x1cb4
movb $0x1, 0xd7e9(%rip)      # 0xf1b5
jmp 0x1b6b
incb %bpl
movzbl %bpl, %ebx
movq (%rax,%rbx,8), %r15
movq %r15, %rdi
callq 0x1150
addl $-0x8, %eax
cmpl $-0x8, %eax
jbe 0x1cbe
cmpb $0x0, 0xd7ba(%rip)      # 0xf1b1
jne 0x1cb4
cmpb $0x0, 0xd7ac(%rip)      # 0xf1b0
jne 0x1cb4
cmpb $0x0, 0xd7a2(%rip)      # 0xf1b3
jne 0x1cb4
cmpb $0x0, 0xd794(%rip)      # 0xf1b2
jne 0x1cb4
cmpb $0x0, 0xd78a(%rip)      # 0xf1b5
jne 0x1cb4
movq 0x19c90(%rip), %rax     # 0x1b6c8
movq (%rax,%rbx,8), %rdi
callq 0x1150
movb %al, 0xd76d(%rip)       # 0xf1b4
jmp 0x1b6b
movb $0x1, 0xd765(%rip)      # 0xf1b8
jmp 0x1b6b
cmpb $0x0, 0xd752(%rip)      # 0xf1b1
jne 0x1cb4
cmpb $0x0, 0xd748(%rip)      # 0xf1b4
jne 0x1cb4
cmpb $0x0, 0xd73a(%rip)      # 0xf1b3
jne 0x1cb4
cmpb $0x0, 0xd72c(%rip)      # 0xf1b2
jne 0x1cb4
cmpb $0x0, 0xd722(%rip)      # 0xf1b5
jne 0x1cb4
movb $0x1, 0xd710(%rip)      # 0xf1b0
jmp 0x1b6b
movb $0x1, 0xd6ab(%rip)      # 0xf157
movw $0x3130, 0xd695(%rip)   # imm = 0x3130
jmp 0x1b6b
cmpb $0x0, 0xd6f0(%rip)      # 0xf1b1
jne 0x1cb4
cmpb $0x0, 0xd6e2(%rip)      # 0xf1b0
jne 0x1cb4
cmpb $0x0, 0xd6d8(%rip)      # 0xf1b3
jne 0x1cb4
cmpb $0x0, 0xd6cc(%rip)      # 0xf1b4
jne 0x1cb4
cmpb $0x0, 0xd6c0(%rip)      # 0xf1b5
jne 0x1cb4
incb %bpl
movq 0x19bc3(%rip), %rax     # 0x1b6c8
movzbl %bpl, %ecx
movq (%rax,%rcx,8), %rdi
callq 0x1150
movl %eax, 0xd714(%rip)      # 0xf22c
jmp 0x1b6b
cmpb $0x0, 0xd693(%rip)      # 0xf1b4
jne 0x1cb4
cmpb $0x0, 0xd682(%rip)      # 0xf1b0
jne 0x1cb4
cmpb $0x0, 0xd676(%rip)      # 0xf1b1
jne 0x1cb4
cmpb $0x0, 0xd66a(%rip)      # 0xf1b2
jne 0x1cb4
cmpb $0x0, 0xd660(%rip)      # 0xf1b5
jne 0x1cb4
movb $0x1, 0xd651(%rip)      # 0xf1b3
jmp 0x1b6b
movb $0x0, 0xd585(%rip)      # 0xf0f0
incb %bpl
movzbl %bpl, %eax
cmpl %eax, 0x19b4c(%rip)     # 0x1b6c4
jg 0x1858
jmp 0x1b83
xorl %r12d, %r12d
leaq 0xd6f7(%rip), %rdi      # 0xf281
movl $0x2e, %esi
callq 0x10c0
movq %rax, %rbx
cmpb $0x1, %r12b
je 0x1bd2
movzbl %r12b, %eax
testl %eax, %eax
je 0x1caf
testq %rbx, %rbx
jne 0x1ca0
leaq 0xd6c8(%rip), %rdi      # 0xf281
callq 0x10a0
leaq 0xd6bb(%rip), %rcx      # 0xf280
movl $0x636f762e, 0x1(%rax,%rcx) # imm = 0x636F762E
jmp 0x1c9b
leaq 0xd6a8(%rip), %r14      # 0xf281
movq %r14, %rdi
movl $0x5c, %esi
callq 0x10c0
movq %rax, %r15
movq %r14, %rdi
callq 0x10a0
movq %rax, %r12
movl %r15d, %eax
notl %eax
addl %r14d, %eax
xorl %ecx, %ecx
testq %r15, %r15
cmovnel %eax, %ecx
addl %ecx, %r12d
movq %r14, %rdi
callq 0x1346
movzbl %r12b, %edx
leaq 0x1177f(%rip), %r15     # 0x13399
movq %r15, %rdi
movq %r14, %rsi
callq 0x1040
movq %r14, %rdi
callq 0x1346
movq %r15, %rdi
callq 0x1346
testq %rbx, %rbx
je 0x1c60
leaq 0x11758(%rip), %rbx     # 0x13399
movq %rbx, %rdi
movl $0x2e, %esi
callq 0x10c0
leaq 0x11743(%rip), %rcx     # 0x13398
subl %ebx, %eax
cltq
movb $0x0, 0x1(%rax,%rcx)
jmp 0x1c80
leaq 0xd61a(%rip), %rdi      # 0xf281
callq 0x10a0
leaq 0xd60d(%rip), %rcx      # 0xf280
movl $0x636f762e, 0x1(%rax,%rcx) # imm = 0x636F762E
movb $0x0, 0x5(%rax,%rcx)
leaq 0x11712(%rip), %rdi     # 0x13399
callq 0x10a0
leaq 0x11705(%rip), %rcx     # 0x13398
movl $0x787a742e, 0x1(%rax,%rcx) # imm = 0x787A742E
movb $0x0, 0x5(%rax,%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1ce2
movl $0xd, %edi
callq 0x140c
leaq 0x980f(%rip), %rdi      # 0xb4d4
movq %r15, %rsi
jmp 0x1cd1
leaq 0x98be(%rip), %rdi      # 0xb58f
xorl %eax, %eax
callq 0x10b0
movl $0x1, %edi
callq 0x1170