// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/zmakebas/zmakebas.c
// Function: parse_options
void parse_options(int argc,char *argv[])
{
int done=0;

done=0;
opterr=0;
startlabel[0]=0;

do
  switch(getopt(argc,argv,"a:hi:ln:o:rs:"))
    {
    case 'a':
      if(*optarg=='@')
        if(strlen(optarg+1)>MAX_LABEL_LEN)
          fprintf(stderr,"Auto-start label too long\n"),exit(1);
        else
          strcpy(startlabel,optarg+1);
      else
        {
        startline=(unsigned int)atoi(optarg);
        if(startline>9999)
          fprintf(stderr,"Auto-start line must be in the range 0 to 9999.\n"),
            exit(1);
        }
      break;
    case 'h':	/* usage help */
      usage_help();
      exit(1);
    case 'i':
      autoincr=(int)atoi(optarg);
      /* this is unnecessarily restrictive but keeps things a bit sane */
      if(autoincr<1 || autoincr>1000)
        fprintf(stderr,"Label line incr. must be in the range 1 to 1000.\n"),
          exit(1);
      break;
    case 'l':
      use_labels=1;
      break;
    case 'n':
      strncpy(speccy_filename,optarg,10);
      speccy_filename[10]=0;
      break;
    case 'o':
      strcpy(outfile,optarg);
      break;
    case 'r':	/* output raw file */
      output_tap=0; break;
    case 's':
      autostart=(int)atoi(optarg);
      if(autostart<0 || autostart>9999)
        fprintf(stderr,"Label start line must be in the range 0 to 9999.\n"),
          exit(1);
      break;
    case '?':
      switch(optopt)
        {
        case 'a':
          fprintf(stderr,"The `a' option takes a line number arg.\n");
          break;
        case 'i':
          fprintf(stderr,"The `i' option takes a line incr. arg.\n");
          break;
        case 'n':
          fprintf(stderr,"The `n' option takes a Spectrum filename arg.\n");
          break;
        case 'o':
          fprintf(stderr,"The `o' option takes a filename arg.\n");
          break;
        case 's':
          fprintf(stderr,"The `s' option takes a line number arg.\n");
          break;
        default:
          fprintf(stderr,"Option `%c' not recognised.\n",optopt);
        }
      exit(1);
    case -1:
      done=1;
    }
while(!done);

if(optind<argc-1)	/* two or more remaining args */
  usage_help(),exit(1);

if(optind==argc-1)	/* one remaining arg */
  strcpy(infile,argv[optind]);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
andl $0x0, 0x5074(%rip)      # 0x870c
movb $0x0, 0x5081(%rip)      # 0x8720
leaq 0x1cf3(%rip), %r14      # 0x5399
leaq 0x19b3(%rip), %r13      # 0x5060
movl $0xfffffc17, %r15d      # imm = 0xFFFFFC17
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x32dc
leal -0x61(%rax), %ecx
cmpl $0x12, %ecx
ja 0x37a4
movslq (%r13,%rcx,4), %rax
addq %r13, %rax
jmpq *%rax
movq 0x5033(%rip), %r12      # 0x8710
cmpb $0x40, (%r12)
jne 0x37b7
incq %r12
movq %r12, %rdi
callq 0x3080
cmpq $0x11, %rax
jae 0x3893
leaq 0x501c(%rip), %rdi      # 0x8720
movq %r12, %rsi
callq 0x30d0
jmp 0x36b3
movq 0x4ffb(%rip), %rdi      # 0x8710
callq 0x31a0
movl %eax, 0x4fc0(%rip)      # 0x86e0
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x36b3
jmp 0x382a
movq 0x4fdd(%rip), %rsi      # 0x8710
leaq 0x5006(%rip), %rdi      # 0x8740
callq 0x30d0
jmp 0x36b3
movq 0x4fc5(%rip), %rdi      # 0x8710
callq 0x31a0
movl %eax, 0x4f8e(%rip)      # 0x86e4
addl %r15d, %eax
cmpl %r15d, %eax
ja 0x36b3
jmp 0x383d
movq 0x4fa2(%rip), %rsi      # 0x8710
leaq 0x4fbc(%rip), %rdi      # 0x8731
pushq $0xa
popq %rdx
callq 0x30a0
movb $0x0, 0x4fb7(%rip)      # 0x873b
jmp 0x36b3
movl $0x1, 0x4f6d(%rip)      # 0x8700
jmp 0x36b3
andl $0x0, 0x4f39(%rip)      # 0x86d8
jmp 0x36b3
cmpl $-0x1, %eax
je 0x37e5
cmpl $0x3f, %eax
jne 0x36b3
jmp 0x3861
movq %r12, %rdi
callq 0x31a0
movl %eax, 0x4f17(%rip)      # 0x86dc
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x36b3
movq 0x4801(%rip), %rax      # 0x7fd8
movq (%rax), %rcx
leaq 0x1be1(%rip), %rdi      # 0x53c2
pushq $0x30
jmp 0x3850
movslq 0x4efc(%rip), %rax      # 0x86e8
decl %ebp
cmpl %ebp, %eax
jl 0x3823
cmpl %ebp, %eax
jne 0x3814
movq (%rbx,%rax,8), %rsi
leaq 0x533f(%rip), %rdi      # 0x8b40
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x30d0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x35e2
jmp 0x3859
movq 0x47a7(%rip), %rax      # 0x7fd8
movq (%rax), %rcx
leaq 0x1bea(%rip), %rdi      # 0x5425
jmp 0x384e
movq 0x4794(%rip), %rax      # 0x7fd8
movq (%rax), %rcx
leaq 0x1ba5(%rip), %rdi      # 0x53f3
pushq $0x31
popq %rsi
pushq $0x1
popq %rdx
callq 0x31d0
pushq $0x1
popq %rdi
callq 0x3140
movl 0x4ea1(%rip), %edx      # 0x8708
movq 0x476a(%rip), %rax      # 0x7fd8
movq (%rax), %rcx
cmpl $0x73, %edx
je 0x38b3
cmpl $0x69, %edx
je 0x38a8
cmpl $0x6e, %edx
je 0x38be
cmpl $0x6f, %edx
je 0x38c9
cmpl $0x61, %edx
jne 0x38d7
leaq 0x1bc6(%rip), %rdi      # 0x5457
jmp 0x38ba
movq 0x473e(%rip), %rax      # 0x7fd8
movq (%rax), %rcx
leaq 0x1b03(%rip), %rdi      # 0x53a7
pushq $0x1a
jmp 0x3850
leaq 0x1bd1(%rip), %rdi      # 0x5480
pushq $0x27
jmp 0x3850
leaq 0x1c43(%rip), %rdi      # 0x54fd
pushq $0x28
jmp 0x3850
leaq 0x1be3(%rip), %rdi      # 0x54a8
pushq $0x2e
jmp 0x3850
leaq 0x1c07(%rip), %rdi      # 0x54d7
pushq $0x25
jmp 0x3850
leaq 0x1c48(%rip), %rsi      # 0x5526
movq %rcx, %rdi
xorl %eax, %eax
callq 0x3180
jmp 0x3859