// File: /workspace/github_c_makefile_star2_O2/OpenGene[P]pecheck/src/cmdline.h
// Function: cmdline::parser::parse(int, char const* const*)
bool parse(int argc, const char * const argv[]){
    errors.clear();
    others.clear();

    if (argc<1){
      errors.push_back("argument number must be longer than 0");
      return false;
    }
    if (prog_name=="")
      prog_name=argv[0];

    std::map<char, std::string> lookup;
    for (std::map<std::string, option_base*>::iterator p=options.begin();
         p!=options.end(); p++){
      if (p->first.length()==0) continue;
      char initial=p->second->short_name();
      if (initial){
        if (lookup.count(initial)>0){
          lookup[initial]="";
          errors.push_back(std::string("short option '")+initial+"' is ambiguous");
          return false;
        }
        else lookup[initial]=p->first;
      }
    }

    for (int i=1; i<argc; i++){
      if (strncmp(argv[i], "--", 2)==0){
        const char *p=strchr(argv[i]+2, '=');
        if (p){
          std::string name(argv[i]+2, p);
          std::string val(p+1);
          set_option(name, val);
        }
        else{
          std::string name(argv[i]+2);
          if (options.count(name)==0){
            errors.push_back("undefined option: --"+name);
            continue;
          }
          if (options[name]->has_value()){
            if (i+1>=argc){
              errors.push_back("option needs value: --"+name);
              continue;
            }
            else{
              i++;
              set_option(name, argv[i]);
            }
          }
          else{
            set_option(name);
          }
        }
      }
      else if (strncmp(argv[i], "-", 1)==0){
        if (!argv[i][1]) continue;
        char last=argv[i][1];
        for (int j=2; argv[i][j]; j++){
          last=argv[i][j];
          if (lookup.count(argv[i][j-1])==0){
            errors.push_back(std::string("undefined short option: -")+argv[i][j-1]);
            continue;
          }
          if (lookup[argv[i][j-1]]==""){
            errors.push_back(std::string("ambiguous short option: -")+argv[i][j-1]);
            continue;
          }
          set_option(lookup[argv[i][j-1]]);
        }

        if (lookup.count(last)==0){
          errors.push_back(std::string("undefined short option: -")+last);
          continue;
        }
        if (lookup[last]==""){
          errors.push_back(std::string("ambiguous short option: -")+last);
          continue;
        }

        if (i+1<argc && options[lookup[last]]->has_value()){
          set_option(lookup[last], argv[i+1]);
          i++;
        }
        else{
          set_option(lookup[last]);
        }
      }
      else{
        others.push_back(argv[i]);
      }
    }

    for (std::map<std::string, option_base*>::iterator p=options.begin();
         p!=options.end(); p++)
      if (!p->second->valid())
        errors.push_back("need option: --"+std::string(p->first));

    return errors.size()==0;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdx, %r15
movl %esi, %ebx
movq %rdi, %r14
addq $0xa0, %rdi
movq %rdi, 0x8(%rsp)
callq 0x650e
leaq 0x88(%r14), %rdi
movq %rdi, 0xc0(%rsp)
callq 0x650e
movl %ebx, 0x18(%rsp)
testl %ebx, %ebx
jle 0x586d
leaq 0x68(%r14), %rbx
leaq 0x5840(%rip), %rsi      # 0xab4b
movq %rbx, %rdi
callq 0x4527
testb %al, %al
je 0x5322
movq (%r15), %rsi
movq %rbx, %rdi
callq 0x3530
leaq 0x98(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq 0x18(%r14), %r13
movq %r14, 0x10(%rsp)
leaq 0x8(%r14), %rax
movq %rax, 0x88(%rsp)
leaq 0x90(%rsp), %r12
leaq 0x7(%rsp), %rbp
cmpq 0x88(%rsp), %r13
je 0x53bc
cmpq $0x0, 0x28(%r13)
je 0x53af
movq 0x40(%r13), %rdi
movq (%rdi), %rax
callq *0x48(%rax)
movb %al, 0x7(%rsp)
testb %al, %al
je 0x53af
movq %r12, %rdi
movq %rbp, %rsi
callq 0x6516
testq %rax, %rax
jne 0x58ac
movq %r12, %rdi
movq %rbp, %rsi
callq 0x6530
leaq 0x20(%r13), %rsi
movq %rax, %rdi
callq 0x3170
movq %r13, %rdi
callq 0x31a0
movq %rax, %r13
jmp 0x5361
pushq $0x1
popq %rbx
leaq 0x28(%rsp), %r13
leaq 0x68(%rsp), %r12
movq 0x10(%rsp), %rbp
cmpl 0x18(%rsp), %ebx
jge 0x57e1
movq %rbx, 0x20(%rsp)
movslq %ebx, %rbx
movq (%r15,%rbx,8), %r14
cmpb $0x2d, (%r14)
jne 0x5458
cmpb $0x2d, 0x1(%r14)
jne 0x548a
addq $0x2, %r14
movq %r14, %rdi
pushq $0x3d
popq %rsi
callq 0x3100
testq %rax, %rax
je 0x5615
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x46c0
incq %rbx
movq %r12, %rdi
movq %rbx, %rsi
leaq 0x48(%rsp), %rdx
callq 0x44ec
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x65c0
movq 0x20(%rsp), %rbx
movq %r12, %rdi
callq 0x3568
jmp 0x547b
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x44ec
movq 0xc0(%rsp), %rdi
movq %r13, %rsi
callq 0x680c
movq 0x20(%rsp), %rbx
movq %r13, %rdi
callq 0x3568
incl %ebx
jmp 0x53ce
movb 0x1(%r14), %al
testb %al, %al
je 0x5693
movb %al, 0x48(%rsp)
pushq $0x1
popq %rbp
movb 0x1(%r14,%rbp), %al
testb %al, %al
je 0x5596
movb %al, 0x48(%rsp)
addq %rbp, %r14
leaq 0x90(%rsp), %rdi
movq %r14, %rsi
callq 0x6516
testq %rax, %rax
je 0x5523
movq (%r15,%rbx,8), %rsi
addq %rbp, %rsi
leaq 0x90(%rsp), %rdi
callq 0x6530
movq %rax, %rdi
leaq 0x5667(%rip), %rsi      # 0xab4b
callq 0x4527
testb %al, %al
je 0x5569
movq %r12, %rdi
leaq 0x4d96(%rip), %rsi      # 0xa28d
leaq 0x7(%rsp), %rdx
callq 0x44ec
movq (%r15,%rbx,8), %rax
movsbl (%rax,%rbp), %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0x659d
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x680c
jmp 0x5557
movq %r12, %rdi
leaq 0x4d46(%rip), %rsi      # 0xa273
leaq 0x7(%rsp), %rdx
callq 0x44ec
movq (%r15,%rbx,8), %rax
movsbl (%rax,%rbp), %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0x659d
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x680c
movq %r13, %rdi
callq 0x3568
movq %r12, %rdi
callq 0x3568
jmp 0x558a
movq (%r15,%rbx,8), %rsi
addq %rbp, %rsi
leaq 0x90(%rsp), %rdi
callq 0x6530
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x66ea
movq (%r15,%rbx,8), %r14
incq %rbp
jmp 0x549d
leaq 0x90(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x6516
movq 0x20(%rsp), %rbx
testq %rax, %rax
je 0x569d
leaq 0x90(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x6530
movq %rax, %rdi
leaq 0x5579(%rip), %rsi      # 0xab4b
callq 0x4527
testb %al, %al
je 0x56e3
movq %r12, %rdi
leaq 0x4ca4(%rip), %rsi      # 0xa28d
leaq 0x7(%rsp), %rdx
callq 0x44ec
movsbl 0x48(%rsp), %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0x659d
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x680c
jmp 0x56ce
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x44ec
movq %rbp, %rdi
movq %r13, %rsi
callq 0x50a4
movq 0x20(%rsp), %rbx
testq %rax, %rax
je 0x5784
movq %rbp, %rdi
movq %r13, %rsi
callq 0x5b6e
movq (%rax), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
testb %al, %al
je 0x57a8
incl %ebx
cmpl 0x18(%rsp), %ebx
jge 0x57b8
movslq %ebx, %rax
movq (%r15,%rax,8), %rsi
movq %r12, %rdi
leaq 0x48(%rsp), %rdx
callq 0x44ec
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x65c0
movq %r12, %rdi
callq 0x3568
jmp 0x547b
movq 0x20(%rsp), %rbx
jmp 0x5483
movq %r12, %rdi
leaq 0x4bcc(%rip), %rsi      # 0xa273
leaq 0x7(%rsp), %rdx
callq 0x44ec
movsbl 0x48(%rsp), %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0x659d
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x680c
movq %r13, %rdi
callq 0x3568
movq %r12, %rdi
callq 0x3568
jmp 0x577a
leal 0x1(%rbx), %ebp
cmpl 0x18(%rsp), %ebp
jge 0x575b
leaq 0x90(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x6530
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x5b6e
movq (%rax), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
testb %al, %al
je 0x575b
leaq 0x90(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x6530
movq %rax, %rbx
movslq %ebp, %rax
movq (%r15,%rax,8), %rsi
movq %r13, %rdi
movq %r12, %rdx
callq 0x44ec
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x65c0
movq %r13, %rdi
callq 0x3568
movl %ebp, %ebx
jmp 0x577a
leaq 0x90(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x6530
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x66ea
movq 0x10(%rsp), %rbp
jmp 0x5483
movq %r12, %rdi
leaq 0x4ab9(%rip), %rsi      # 0xa247
movq %r13, %rdx
callq 0x4566
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x680c
jmp 0x544e
movq %rbp, %rdi
movq %r13, %rsi
callq 0x66ea
jmp 0x547b
movq %r12, %rdi
leaq 0x4a9a(%rip), %rsi      # 0xa25c
movq %r13, %rdx
callq 0x4566
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x680c
movq 0x20(%rsp), %rbx
jmp 0x544e
movq 0x18(%rbp), %r13
leaq 0x68(%rsp), %r15
leaq 0x4ab6(%rip), %r12      # 0xa2a7
leaq 0x28(%rsp), %rbp
cmpq 0x88(%rsp), %r13
je 0x5852
movq 0x40(%r13), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
testb %al, %al
jne 0x5845
leaq 0x20(%r13), %rsi
movq %r15, %rdi
callq 0x3380
movq %rbp, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x6792
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x680c
movq %rbp, %rdi
callq 0x3568
movq %r15, %rdi
callq 0x3568
movq %r13, %rdi
callq 0x31a0
movq %rax, %r13
jmp 0x57f6
movq 0x10(%rsp), %rcx
movq 0xa8(%rcx), %rax
cmpq 0xa0(%rcx), %rax
sete %bl
jmp 0x593c
leaq 0x498f(%rip), %rsi      # 0xa203
leaq 0x90(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x44ec
leaq 0x90(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x680c
leaq 0x90(%rsp), %rdi
callq 0x3568
xorl %ebx, %ebx
jmp 0x5949
leaq 0x90(%rsp), %rdi
leaq 0x7(%rsp), %rsi
callq 0x6530
leaq 0x5286(%rip), %rsi      # 0xab4b
movq %rax, %rdi
callq 0x3530
leaq 0x4955(%rip), %rsi      # 0xa229
leaq 0x48(%rsp), %rdi
leaq 0x1f(%rsp), %rdx
callq 0x44ec
movsbl 0x7(%rsp), %edx
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x659d
leaq 0x493a(%rip), %rdx      # 0xa238
leaq 0x28(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x657e
leaq 0x28(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x680c
leaq 0x28(%rsp), %rdi
callq 0x3568
leaq 0x68(%rsp), %rdi
callq 0x3568
leaq 0x48(%rsp), %rdi
callq 0x3568
xorl %ebx, %ebx
leaq 0x90(%rsp), %rdi
callq 0x6cf6
movl %ebx, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x59e7
jmp 0x5a1d
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3568
jmp 0x5979
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x3568
jmp 0x5988
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0x5a16
jmp 0x5a1d
jmp 0x59cc
jmp 0x59e7
jmp 0x59cc
jmp 0x59e7
jmp 0x5a1d
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x3568
jmp 0x5a2d
movq %rax, %rbx
jmp 0x5a2d
jmp 0x59cc
jmp 0x59e7
jmp 0x5a04
jmp 0x59ff
jmp 0x5a1d
jmp 0x5a04
jmp 0x5a1d
jmp 0x59ff
jmp 0x5a1d
jmp 0x5a1d
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x3568
jmp 0x59ea
jmp 0x59e7
jmp 0x59e7
jmp 0x5a1d
jmp 0x59ff
jmp 0x5a1d
jmp 0x5a04
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0x5a16
jmp 0x5a1d
jmp 0x5a1d
jmp 0x5a04
jmp 0x59ff
jmp 0x5a1d
jmp 0x5a1d
jmp 0x5a1d
movq %rax, %rbx
jmp 0x5a11
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3568
leaq 0x68(%rsp), %rdi
callq 0x3568
jmp 0x5a20
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x6cf6
movq %rbx, %rdi
callq 0x34e0
nop