// File: /workspace/github_c_makefile_star2_O3/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 0x9c75(%rip), %rdi      # 0xb490
leaq 0xd8be(%rip), %rsi      # 0xf0e0
xorl %eax, %eax
callq 0x10b0
movl 0x19e95(%rip), %eax     # 0x1b6c4
testl %eax, %eax
jle 0x1c86
cmpl $0x1, %eax
je 0x1c86
movb $0x1, %bpl
movq 0x19e7e(%rip), %rbx     # 0x1b6c8
xorl %r12d, %r12d
leaq 0x97f4(%rip), %r13      # 0xb048
movzbl %bpl, %r14d
movq (%rbx,%r14,8), %r15
movzbl (%r15), %eax
orl $0x2, %eax
cmpl $0x2f, %eax
jne 0x1916
movq %r15, %rdi
callq 0x10a0
cmpq $0x3, %rax
jae 0x1c86
movb $0x20, (%r15)
movq 0x19e3f(%rip), %rax     # 0x1b6c8
shll $0x3, %r14d
movq (%rax,%r14), %r15
movq %r15, %rdi
callq 0x12da
movq 0x19e28(%rip), %rax     # 0x1b6c8
movq %r15, (%rax,%r14)
movq 0x19e1d(%rip), %rbx     # 0x1b6c8
movq (%rbx,%r14), %rsi
movzbl 0x1(%rsi), %eax
addl $-0x61, %eax
cmpl $0x19, %eax
ja 0x1ca1
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
cmpb $0x0, 0xd8e4(%rip)      # 0xf1b4
jne 0x1c8b
cmpb $0x0, 0xd8d3(%rip)      # 0xf1b0
jne 0x1c8b
cmpb $0x0, 0xd8c9(%rip)      # 0xf1b3
jne 0x1c8b
cmpb $0x0, 0xd8bb(%rip)      # 0xf1b2
jne 0x1c8b
cmpb $0x0, 0xd8b1(%rip)      # 0xf1b5
jne 0x1c8b
movb $0x1, 0xd8a0(%rip)      # 0xf1b1
jmp 0x1b47
testb %r12b, %r12b
je 0x194c
movzbl %r12b, %eax
cmpl $0x1, %eax
je 0x1935
cmpl $0x2, %eax
je 0x1c86
incb %r12b
jmp 0x1b47
leaq 0x11a5d(%rip), %rdi     # 0x13399
movq %r15, %rsi
callq 0x1060
movb $0x2, %r12b
jmp 0x1b47
leaq 0xd92e(%rip), %rdi      # 0xf281
movq %r15, %rsi
callq 0x1060
movb $0x1, %r12b
jmp 0x1b47
movb $0x1, 0xd84d(%rip)      # 0xf1b7
jmp 0x1b47
cmpb $0x0, 0xd83b(%rip)      # 0xf1b1
jne 0x1c8b
cmpb $0x0, 0xd831(%rip)      # 0xf1b4
jne 0x1c8b
cmpb $0x0, 0xd823(%rip)      # 0xf1b3
jne 0x1c8b
cmpb $0x0, 0xd815(%rip)      # 0xf1b2
jne 0x1c8b
cmpb $0x0, 0xd806(%rip)      # 0xf1b0
jne 0x1c8b
movb $0x1, 0xd7fe(%rip)      # 0xf1b5
jmp 0x1b47
incb %bpl
movzbl %bpl, %eax
movq (%rbx,%rax,8), %r15
movq %r15, %rdi
callq 0x1150
addl $-0x8, %eax
cmpl $-0x8, %eax
jbe 0x1c95
cmpb $0x0, 0xd7cf(%rip)      # 0xf1b1
jne 0x1c8b
cmpb $0x0, 0xd7c1(%rip)      # 0xf1b0
jne 0x1c8b
cmpb $0x0, 0xd7b7(%rip)      # 0xf1b3
jne 0x1c8b
cmpb $0x0, 0xd7a9(%rip)      # 0xf1b2
jne 0x1c8b
cmpb $0x0, 0xd79f(%rip)      # 0xf1b5
jne 0x1c8b
movq %r15, %rdi
callq 0x1150
movb %al, 0xd78a(%rip)       # 0xf1b4
jmp 0x1b47
movb $0x1, 0xd782(%rip)      # 0xf1b8
jmp 0x1b47
cmpb $0x0, 0xd76f(%rip)      # 0xf1b1
jne 0x1c8b
cmpb $0x0, 0xd765(%rip)      # 0xf1b4
jne 0x1c8b
cmpb $0x0, 0xd757(%rip)      # 0xf1b3
jne 0x1c8b
cmpb $0x0, 0xd749(%rip)      # 0xf1b2
jne 0x1c8b
cmpb $0x0, 0xd73f(%rip)      # 0xf1b5
jne 0x1c8b
movb $0x1, 0xd72d(%rip)      # 0xf1b0
jmp 0x1b47
movb $0x1, 0xd6c8(%rip)      # 0xf157
movw $0x3130, 0xd6b2(%rip)   # imm = 0x3130
jmp 0x1b47
cmpb $0x0, 0xd70d(%rip)      # 0xf1b1
jne 0x1c8b
cmpb $0x0, 0xd6ff(%rip)      # 0xf1b0
jne 0x1c8b
cmpb $0x0, 0xd6f5(%rip)      # 0xf1b3
jne 0x1c8b
cmpb $0x0, 0xd6e9(%rip)      # 0xf1b4
jne 0x1c8b
cmpb $0x0, 0xd6dd(%rip)      # 0xf1b5
jne 0x1c8b
incb %bpl
movzbl %bpl, %eax
movq (%rbx,%rax,8), %rdi
callq 0x1150
movl %eax, 0xd738(%rip)      # 0xf22c
jmp 0x1b47
cmpb $0x0, 0xd6b7(%rip)      # 0xf1b4
jne 0x1c8b
cmpb $0x0, 0xd6a6(%rip)      # 0xf1b0
jne 0x1c8b
cmpb $0x0, 0xd69a(%rip)      # 0xf1b1
jne 0x1c8b
cmpb $0x0, 0xd68e(%rip)      # 0xf1b2
jne 0x1c8b
cmpb $0x0, 0xd684(%rip)      # 0xf1b5
jne 0x1c8b
movb $0x1, 0xd675(%rip)      # 0xf1b3
jmp 0x1b47
movb $0x0, 0xd5a9(%rip)      # 0xf0f0
incb %bpl
movzbl %bpl, %eax
cmpl %eax, 0x19b70(%rip)     # 0x1b6c4
jg 0x1854
leaq 0xd720(%rip), %rdi      # 0xf281
movl $0x2e, %esi
callq 0x10c0
movq %rax, %rbx
cmpb $0x1, %r12b
je 0x1ba9
movzbl %r12b, %eax
testl %eax, %eax
je 0x1c86
testq %rbx, %rbx
jne 0x1c77
leaq 0xd6f1(%rip), %rdi      # 0xf281
callq 0x10a0
leaq 0xd6e4(%rip), %rcx      # 0xf280
movl $0x636f762e, 0x1(%rax,%rcx) # imm = 0x636F762E
jmp 0x1c72
leaq 0xd6d1(%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 0x117a8(%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 0x1c37
leaq 0x11781(%rip), %rbx     # 0x13399
movq %rbx, %rdi
movl $0x2e, %esi
callq 0x10c0
leaq 0x1176c(%rip), %rcx     # 0x13398
subl %ebx, %eax
cltq
movb $0x0, 0x1(%rax,%rcx)
jmp 0x1c57
leaq 0xd643(%rip), %rdi      # 0xf281
callq 0x10a0
leaq 0xd636(%rip), %rcx      # 0xf280
movl $0x636f762e, 0x1(%rax,%rcx) # imm = 0x636F762E
movb $0x0, 0x5(%rax,%rcx)
leaq 0x1173b(%rip), %rdi     # 0x13399
callq 0x10a0
leaq 0x1172e(%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 0x1cb9
movl $0xd, %edi
callq 0x140c
leaq 0x9838(%rip), %rdi      # 0xb4d4
movq %r15, %rsi
jmp 0x1ca8
leaq 0x98e7(%rip), %rdi      # 0xb58f
xorl %eax, %eax
callq 0x10b0
movl $0x1, %edi
callq 0x1170