// File: /workspace/github_c_makefile_star2_O2/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 0x8c58(%rip), %rdi      # 0xa430
leaq 0xd8f1(%rip), %rsi      # 0xf0d0
xorl %eax, %eax
callq 0x10b0
movl 0x19ec8(%rip), %ebx     # 0x1b6b4
testl %ebx, %ebx
jle 0x1c3f
movb $0x1, %r13b
xorl %r14d, %r14d
movzbl %r13b, %ebp
movzbl %r14b, %r15d
cmpl %ebp, %ebx
jle 0x1b1c
movq 0x19ea7(%rip), %rax     # 0x1b6b8
movq (%rax,%rbp,8), %r12
movzbl (%r12), %eax
orl $0x2, %eax
cmpl $0x2f, %eax
jne 0x18e5
movq %r12, %rdi
callq 0x10a0
cmpq $0x3, %rax
jae 0x1c3f
movq %r12, %rdi
pushq $0x20
popq %rsi
pushq $0x1
popq %rdx
callq 0x1300
movq 0x19e6b(%rip), %rax     # 0x1b6b8
shll $0x3, %ebp
movq (%rax,%rbp), %r12
movq %r12, %rdi
callq 0x12cf
movq 0x19e55(%rip), %rax     # 0x1b6b8
movq %r12, (%rax,%rbp)
movq 0x19e4a(%rip), %rax     # 0x1b6b8
movq (%rax,%rbp), %rdi
movzbl 0x1(%rdi), %ecx
addl $-0x61, %ecx
cmpl $0x19, %ecx
ja 0x1c65
movl 0x19e2c(%rip), %ebx     # 0x1b6b4
leaq 0x87b9(%rip), %rdx      # 0xa048
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpb $0x0, 0xd905(%rip)      # 0xf1a4
jne 0x1c44
cmpb $0x0, 0xd8f4(%rip)      # 0xf1a0
jne 0x1c44
cmpb $0x0, 0xd8ea(%rip)      # 0xf1a3
jne 0x1c44
cmpb $0x0, 0xd8dc(%rip)      # 0xf1a2
jne 0x1c44
cmpb $0x0, 0xd8d2(%rip)      # 0xf1a5
jne 0x1c44
movb $0x1, 0xd8c1(%rip)      # 0xf1a1
jmp 0x1b14
testb %r14b, %r14b
je 0x1919
cmpl $0x1, %r15d
je 0x1902
cmpl $0x2, %r15d
je 0x1c3f
incb %r14b
jmp 0x1b14
leaq 0x11a80(%rip), %rdi     # 0x13389
movq %r12, %rsi
callq 0x1060
movb $0x2, %r14b
jmp 0x1b14
leaq 0xd951(%rip), %rdi      # 0xf271
movq %r12, %rsi
callq 0x1060
movb $0x1, %r14b
jmp 0x1b14
movb $0x1, 0xd870(%rip)      # 0xf1a7
jmp 0x1b14
cmpb $0x0, 0xd85e(%rip)      # 0xf1a1
jne 0x1c44
cmpb $0x0, 0xd854(%rip)      # 0xf1a4
jne 0x1c44
cmpb $0x0, 0xd846(%rip)      # 0xf1a3
jne 0x1c44
cmpb $0x0, 0xd838(%rip)      # 0xf1a2
jne 0x1c44
cmpb $0x0, 0xd829(%rip)      # 0xf1a0
jne 0x1c44
movb $0x1, 0xd821(%rip)      # 0xf1a5
jmp 0x1b14
incb %r13b
movzbl %r13b, %ecx
movq (%rax,%rcx,8), %r12
movq %r12, %rdi
callq 0x1140
addl $-0x8, %eax
cmpl $-0x8, %eax
jbe 0x1c4c
cmpb $0x0, 0xd7f2(%rip)      # 0xf1a1
jne 0x1c44
cmpb $0x0, 0xd7e4(%rip)      # 0xf1a0
jne 0x1c44
cmpb $0x0, 0xd7da(%rip)      # 0xf1a3
jne 0x1c44
cmpb $0x0, 0xd7cc(%rip)      # 0xf1a2
jne 0x1c44
cmpb $0x0, 0xd7c2(%rip)      # 0xf1a5
jne 0x1c44
movq %r12, %rdi
callq 0x1140
movb %al, 0xd7ad(%rip)       # 0xf1a4
jmp 0x1b14
movb $0x1, 0xd7a5(%rip)      # 0xf1a8
jmp 0x1b14
cmpb $0x0, 0xd792(%rip)      # 0xf1a1
jne 0x1c44
cmpb $0x0, 0xd788(%rip)      # 0xf1a4
jne 0x1c44
cmpb $0x0, 0xd77a(%rip)      # 0xf1a3
jne 0x1c44
cmpb $0x0, 0xd76c(%rip)      # 0xf1a2
jne 0x1c44
cmpb $0x0, 0xd762(%rip)      # 0xf1a5
jne 0x1c44
movb $0x1, 0xd750(%rip)      # 0xf1a0
jmp 0x1b14
movb $0x1, 0xd6eb(%rip)      # 0xf147
movw $0x3130, 0xd6d5(%rip)   # imm = 0x3130
jmp 0x1b14
cmpb $0x0, 0xd730(%rip)      # 0xf1a1
jne 0x1c44
cmpb $0x0, 0xd722(%rip)      # 0xf1a0
jne 0x1c44
cmpb $0x0, 0xd718(%rip)      # 0xf1a3
jne 0x1c44
cmpb $0x0, 0xd70c(%rip)      # 0xf1a4
jne 0x1c44
cmpb $0x0, 0xd700(%rip)      # 0xf1a5
jne 0x1c44
incb %r13b
movzbl %r13b, %ecx
movq (%rax,%rcx,8), %rdi
callq 0x1140
movl %eax, 0xd75b(%rip)      # 0xf21c
jmp 0x1b14
cmpb $0x0, 0xd6da(%rip)      # 0xf1a4
jne 0x1c44
cmpb $0x0, 0xd6c9(%rip)      # 0xf1a0
jne 0x1c44
cmpb $0x0, 0xd6bd(%rip)      # 0xf1a1
jne 0x1c44
cmpb $0x0, 0xd6b1(%rip)      # 0xf1a2
jne 0x1c44
cmpb $0x0, 0xd6a7(%rip)      # 0xf1a5
jne 0x1c44
movb $0x1, 0xd698(%rip)      # 0xf1a3
jmp 0x1b14
movb $0x0, 0xd5cc(%rip)      # 0xf0e0
incb %r13b
jmp 0x17fa
leaq 0xd74e(%rip), %rdi      # 0xf271
pushq $0x2e
popq %rsi
callq 0x10c0
movq %rax, %rbx
cmpb $0x1, %r14b
je 0x1b66
testl %r15d, %r15d
je 0x1c3f
testq %rbx, %rbx
jne 0x1c30
leaq 0xd724(%rip), %rdi      # 0xf271
callq 0x10a0
leaq 0xd717(%rip), %rcx      # 0xf270
movl $0x636f762e, 0x1(%rax,%rcx) # imm = 0x636F762E
jmp 0x1c2b
leaq 0xd704(%rip), %r14      # 0xf271
pushq $0x5c
popq %rsi
movq %r14, %rdi
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 0x1337
movzbl %r12b, %edx
leaq 0x117dd(%rip), %r15     # 0x13389
movq %r15, %rdi
movq %r14, %rsi
callq 0x1040
movq %r14, %rdi
callq 0x1337
movq %r15, %rdi
callq 0x1337
testq %rbx, %rbx
je 0x1bf0
leaq 0x117b6(%rip), %rbx     # 0x13389
pushq $0x2e
popq %rsi
movq %rbx, %rdi
callq 0x10c0
leaq 0x117a3(%rip), %rcx     # 0x13388
subl %ebx, %eax
cltq
movb $0x0, 0x1(%rax,%rcx)
jmp 0x1c10
leaq 0xd67a(%rip), %rdi      # 0xf271
callq 0x10a0
leaq 0xd66d(%rip), %rcx      # 0xf270
movl $0x636f762e, 0x1(%rax,%rcx) # imm = 0x636F762E
movb $0x0, 0x5(%rax,%rcx)
leaq 0x11772(%rip), %rdi     # 0x13389
callq 0x10a0
leaq 0x11765(%rip), %rcx     # 0x13388
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 0x1c6a
pushq $0xd
popq %rdi
callq 0x13ed
leaq 0x8821(%rip), %rdi      # 0xa474
movq %r12, %rsi
xorl %eax, %eax
callq 0x10b0
pushq $0x1
popq %rdi
callq 0x1160
callq 0x1cde