// File: /workspace/github_c_makefile_star2_O3/jflatow[P]jfdb/src/jfdb.c
// Function: prefix_opts
static int prefix_opts(JFT_Stem *prefix, JFT_Symbol **stop, int argc, char **argv) {
  extern char *optarg;
  extern int optind, optopt;
  int opt, ptr, err = 0, omit = 1;

  static struct option options[] = {
    {"null", no_argument, NULL, 'n'},
    {"stop", no_argument, NULL, 's'},
    {"primary", no_argument, NULL, 'p'},
    {"indices", no_argument, NULL, 'i'},
    {}
  };

  // default
  prefix->pre = JFT_SYMBOL_PRIMARY;
  prefix->size = 1;

  while ((opt = getopt_long(argc, argv, "hnspi", options, &ptr)) != -1) {
    switch (opt) {
      case 'h':
        return usage(0);
      case 'n':
        omit = 0;
        break;
      case 's':
        *stop = &null;
        break;
      case 'p':
        prefix->pre = JFT_SYMBOL_PRIMARY;
        prefix->size = 1;
        break;
      case 'i':
        prefix->pre = JFT_SYMBOL_INDICES;
        prefix->size = 1;
        break;
      case ':':
        pwarn("%s: option requires an argument -- %c", argv[0], optopt);
        err++;
        break;
      case '?':
        pwarn("%s: illegal option -- %c", argv[0], optopt);
        err++;
        break;
    }
  }

  read_prefix(prefix, omit, argc - optind, argv + optind);
  return err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %r15
movl %edx, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdi, %r14
movq $-0x5, (%rdi)
movw $0x1, 0x8(%rdi)
movl $0x1, 0xc(%rsp)
xorl %ebp, %ebp
leaq 0x7e00(%rip), %rbx      # 0xa130
leaq 0x44(%rsp), %r12
leaq 0x4d8c(%rip), %r13      # 0x70c8
movl 0x8(%rsp), %edi
movq %r15, %rsi
leaq 0x5240(%rip), %rdx      # 0x758a
movq %rbx, %rcx
movq %r12, %r8
callq 0x10e0
cmpl $0x67, %eax
jle 0x239d
addl $-0x68, %eax
cmpl $0xb, %eax
ja 0x233c
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movq $-0x4, (%r14)
movw $0x1, 0x8(%r14)
jmp 0x233c
movq 0x10(%rsp), %rax
leaq 0x7e50(%rip), %rcx      # 0xa1d8
movq %rcx, (%rax)
jmp 0x233c
movq $-0x5, (%r14)
movw $0x1, 0x8(%r14)
jmp 0x233c
cmpl $-0x1, %eax
je 0x23f9
cmpl $0x3a, %eax
je 0x23c3
cmpl $0x3f, %eax
jne 0x233c
movq %r15, %rdi
callq 0x1309
jmp 0x23cb
movl $0x0, 0xc(%rsp)
jmp 0x233c
movq %r15, %rdi
callq 0x1336
incl %ebp
jmp 0x233c
movq 0x7be7(%rip), %rax      # 0x9fc0
movq (%rax), %rcx
leaq 0x4e40(%rip), %rdi      # 0x7223
movl $0xca, %esi
movl $0x1, %edx
callq 0x1200
xorl %eax, %eax
jmp 0x24b0
movl %ebp, 0x1c(%rsp)
movq 0x7bcc(%rip), %rax      # 0x9fd0
movslq (%rax), %rcx
movl 0x8(%rsp), %eax
subl %ecx, %eax
movq %rcx, 0x28(%rsp)
movq %r14, 0x20(%rsp)
jle 0x2483
leaq (%r15,%rcx,8), %rcx
movq %rcx, 0x38(%rsp)
movl %eax, %eax
movq %rax, 0x30(%rsp)
xorl %ebp, %ebp
xorl %r13d, %r13d
movq 0x20(%rsp), %r15
movq 0x38(%rsp), %rax
movq (%rax,%rbp,8), %rbx
movq %rbx, %rdi
callq 0x10c0
movq %rax, 0x10(%rsp)
movzwl %r13w, %r14d
movq 0x10(%r15), %rdi
addq %r14, %rdi
movzwl %ax, %r12d
movq %rbx, %rsi
movq %r12, %rdx
callq 0x1170
addq 0x10(%r15), %r12
movb $0x0, (%r14,%r12)
movq 0x10(%rsp), %rax
addl %eax, %r13d
incl %r13d
incq %rbp
cmpq %rbp, 0x30(%rsp)
jne 0x2433
jmp 0x2486
xorl %r13d, %r13d
movq 0x28(%rsp), %rax
cmpl %eax, 0x8(%rsp)
setne %al
cmpl $0x0, 0xc(%rsp)
setne %cl
andb %al, %cl
movzbl %cl, %eax
subl %eax, %r13d
movq 0x20(%rsp), %rax
addw %r13w, 0x8(%rax)
movl 0x1c(%rsp), %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq