// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, 0x4e35(%rip)      # 0x879c
movb $0x0, 0x4e42(%rip)      # 0x87b0
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x2cf0(%rip), %rdx      # 0x666c
callq 0x32c0
movl %eax, %ecx
movl %ecx, -0x18(%rbp)
subl $-0x1, %eax
je 0x3c93
jmp 0x3991
movl -0x18(%rbp), %eax
subl $0x3f, %eax
je 0x3bba
jmp 0x399f
movl -0x18(%rbp), %eax
subl $0x61, %eax
je 0x3a0e
jmp 0x39a9
movl -0x18(%rbp), %eax
subl $0x68, %eax
je 0x3ab5
jmp 0x39b7
movl -0x18(%rbp), %eax
subl $0x69, %eax
je 0x3ac4
jmp 0x39c5
movl -0x18(%rbp), %eax
subl $0x6c, %eax
je 0x3b12
jmp 0x39d3
movl -0x18(%rbp), %eax
subl $0x6e, %eax
je 0x3b21
jmp 0x39e1
movl -0x18(%rbp), %eax
subl $0x6f, %eax
je 0x3b45
jmp 0x39ef
movl -0x18(%rbp), %eax
subl $0x72, %eax
je 0x3b5d
jmp 0x39fd
movl -0x18(%rbp), %eax
subl $0x73, %eax
je 0x3b6c
jmp 0x3c9a
movq 0x4d8b(%rip), %rax      # 0x87a0
movsbl (%rax), %eax
cmpl $0x40, %eax
jne 0x3a6e
movq 0x4d7c(%rip), %rdi      # 0x87a0
addq $0x1, %rdi
callq 0x3070
cmpq $0x10, %rax
jbe 0x3a55
movq 0x45a6(%rip), %rax      # 0x7fe0
movq (%rax), %rdi
leaq 0x2c36(%rip), %rsi      # 0x667a
movb $0x0, %al
callq 0x3160
movl $0x1, %edi
callq 0x3120
movq 0x4d44(%rip), %rsi      # 0x87a0
addq $0x1, %rsi
leaq 0x4d49(%rip), %rdi      # 0x87b0
callq 0x30d0
jmp 0x3ab0
movq 0x4d2b(%rip), %rdi      # 0x87a0
callq 0x3180
movl %eax, 0x4c4c(%rip)      # 0x86cc
cmpl $0x270f, 0x4c42(%rip)   # imm = 0x270F
jbe 0x3aae
movq 0x454d(%rip), %rax      # 0x7fe0
movq (%rax), %rdi
leaq 0x2bf8(%rip), %rsi      # 0x6695
movb $0x0, %al
callq 0x3160
movl $0x1, %edi
callq 0x3120
jmp 0x3ab0
jmp 0x3c9a
callq 0x3880
movl $0x1, %edi
callq 0x3120
movq 0x4cd5(%rip), %rdi      # 0x87a0
callq 0x3180
movl %eax, 0x4bfe(%rip)      # 0x86d4
cmpl $0x1, 0x4bf7(%rip)      # 0x86d4
jl 0x3aeb
cmpl $0x3e8, 0x4beb(%rip)    # imm = 0x3E8
jle 0x3b0d
movq 0x44ee(%rip), %rax      # 0x7fe0
movq (%rax), %rdi
leaq 0x2bca(%rip), %rsi      # 0x66c6
movb $0x0, %al
callq 0x3160
movl $0x1, %edi
callq 0x3120
jmp 0x3c9a
movl $0x1, 0x4c74(%rip)      # 0x8790
jmp 0x3c9a
movq 0x4c78(%rip), %rsi      # 0x87a0
leaq 0x4c92(%rip), %rdi      # 0x87c1
movl $0xa, %edx
callq 0x30a0
movb $0x0, 0x4c8b(%rip)      # 0x87cb
jmp 0x3c9a
movq 0x4c54(%rip), %rsi      # 0x87a0
leaq 0x4c7d(%rip), %rdi      # 0x87d0
callq 0x30d0
jmp 0x3c9a
movl $0x0, 0x4b61(%rip)      # 0x86c8
jmp 0x3c9a
movq 0x4c2d(%rip), %rdi      # 0x87a0
callq 0x3180
movl %eax, 0x4b52(%rip)      # 0x86d0
cmpl $0x0, 0x4b4b(%rip)      # 0x86d0
jl 0x3b93
cmpl $0x270f, 0x4b3f(%rip)   # imm = 0x270F
jle 0x3bb5
movq 0x4446(%rip), %rax      # 0x7fe0
movq (%rax), %rdi
leaq 0x2b54(%rip), %rsi      # 0x66f8
movb $0x0, %al
callq 0x3160
movl $0x1, %edi
callq 0x3120
jmp 0x3c9a
movl 0x4bd8(%rip), %eax      # 0x8798
addl $-0x61, %eax
movl %eax, %ecx
movq %rcx, -0x20(%rbp)
subl $0x12, %eax
ja 0x3c6b
movq -0x20(%rbp), %rax
leaq 0x2483(%rip), %rcx      # 0x6060
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x43f3(%rip), %rax      # 0x7fe0
movq (%rax), %rdi
leaq 0x2b33(%rip), %rsi      # 0x672a
movb $0x0, %al
callq 0x3160
jmp 0x3c89
movq 0x43d6(%rip), %rax      # 0x7fe0
movq (%rax), %rdi
leaq 0x2b3f(%rip), %rsi      # 0x6753
movb $0x0, %al
callq 0x3160
jmp 0x3c89
movq 0x43bc(%rip), %rax      # 0x7fe0
movq (%rax), %rdi
leaq 0x2b4d(%rip), %rsi      # 0x677b
movb $0x0, %al
callq 0x3160
jmp 0x3c89
movq 0x43a2(%rip), %rax      # 0x7fe0
movq (%rax), %rdi
leaq 0x2b62(%rip), %rsi      # 0x67aa
movb $0x0, %al
callq 0x3160
jmp 0x3c89
movq 0x4388(%rip), %rax      # 0x7fe0
movq (%rax), %rdi
leaq 0x2b6e(%rip), %rsi      # 0x67d0
movb $0x0, %al
callq 0x3160
jmp 0x3c89
movq 0x436e(%rip), %rax      # 0x7fe0
movq (%rax), %rdi
movl 0x4b1d(%rip), %edx      # 0x8798
leaq 0x2b77(%rip), %rsi      # 0x67f9
movb $0x0, %al
callq 0x3160
movl $0x1, %edi
callq 0x3120
movl $0x1, -0x14(%rbp)
jmp 0x3c9c
cmpl $0x0, -0x14(%rbp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x396e
movl 0x4a25(%rip), %eax      # 0x86d8
movl -0x4(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x3ccc
callq 0x3880
movl $0x1, %edi
callq 0x3120
movl 0x4a06(%rip), %eax      # 0x86d8
movl -0x4(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x3cf7
movq -0x10(%rbp), %rax
movslq 0x49f1(%rip), %rcx      # 0x86d8
movq (%rax,%rcx,8), %rsi
leaq 0x4ede(%rip), %rdi      # 0x8bd0
callq 0x30d0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)