// File: /workspace/github_c_makefile_star2_O1/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
movl $0x0, 0x4ee2(%rip)      # 0x871c
movb $0x0, 0x4eef(%rip)      # 0x8730
xorl %r12d, %r12d
leaq 0x1b4e(%rip), %r14      # 0x5399
leaq 0x180e(%rip), %r13      # 0x5060
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x345c
leal -0x61(%rax), %ecx
cmpl $0x12, %ecx
ja 0x38a3
movslq (%r13,%rcx,4), %rax
addq %r13, %rax
jmpq *%rax
movq 0x4ea8(%rip), %r15      # 0x8720
cmpb $0x40, (%r15)
jne 0x3953
incq %r15
movq %r15, %rdi
callq 0x3080
cmpq $0x11, %rax
jae 0x39fc
leaq 0x4e92(%rip), %rdi      # 0x8730
movq %r15, %rsi
jmp 0x38c8
cmpl $-0x1, %eax
je 0x394b
cmpl $0x3f, %eax
jne 0x396c
jmp 0x39cc
movq 0x4e5f(%rip), %rsi      # 0x8720
leaq 0x4e88(%rip), %rdi      # 0x8750
callq 0x30e0
jmp 0x396c
movl $0x0, 0x4e0c(%rip)      # 0x86e8
jmp 0x396c
movl $0x1, 0x4e25(%rip)      # 0x8710
jmp 0x396c
movq 0x4e2c(%rip), %rdi      # 0x8720
callq 0x31b0
movl %eax, 0x4df5(%rip)      # 0x86f4
movl $0xfffffc17, %ecx       # imm = 0xFFFFFC17
addl %ecx, %eax
cmpl %ecx, %eax
ja 0x396c
jmp 0x39c7
movq 0x4e0a(%rip), %rsi      # 0x8720
movl $0xa, %edx
leaq 0x4e1f(%rip), %rdi      # 0x8741
callq 0x30a0
movb $0x0, 0x4e1d(%rip)      # 0x874b
jmp 0x396c
movq 0x4de9(%rip), %rdi      # 0x8720
callq 0x31b0
movl %eax, 0x4dae(%rip)      # 0x86f0
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x396c
jmp 0x39c2
movl $0x1, %r12d
jmp 0x396c
movq %r15, %rdi
callq 0x31b0
movl %eax, 0x4d8b(%rip)      # 0x86ec
cmpl $0x2710, %eax           # imm = 0x2710
jae 0x39f7
testl %r12d, %r12d
je 0x3852
movslq 0x4d7c(%rip), %rax      # 0x86f8
decl %ebp
cmpl %ebp, %eax
jl 0x39b3
cmpl %ebp, %eax
jne 0x39a4
movq (%rbx,%rax,8), %rsi
leaq 0x51bf(%rip), %rdi      # 0x8b50
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x30e0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3781
movl $0x1, %edi
callq 0x3150
callq 0x32af
callq 0x32d4
movl 0x4d46(%rip), %edx      # 0x8718
movq 0x45ff(%rip), %rax      # 0x7fd8
movq (%rax), %rdi
cmpl $0x6d, %edx
jle 0x3a01
cmpl $0x6e, %edx
je 0x3a12
cmpl $0x6f, %edx
je 0x3a19
cmpl $0x73, %edx
jne 0x3a27
callq 0x3246
jmp 0x39b8
callq 0x32f9
callq 0x331e
cmpl $0x61, %edx
je 0x3a20
cmpl $0x69, %edx
jne 0x3a27
callq 0x3285
jmp 0x39b8
callq 0x3270
jmp 0x39b8
callq 0x325b
jmp 0x39b8
callq 0x329a
jmp 0x39b8
leaq 0x1af8(%rip), %rsi      # 0x5526
xorl %eax, %eax
callq 0x3190
jmp 0x39b8