// File: /workspace/github_cpp_makefile_star2_O3/gpertea[P]gclib/GArgs.cpp
// Function: GArgs::parseArgs(bool)
int GArgs::parseArgs(bool nodigitopts) {
  int p=1; //skip program name
  int f=0;
  while (p<_argc) {
   // silly patch for annnoying MacOS gdb/eclipse issues:
   #if defined(__APPLE__) && defined(DEBUG)
	   dbg_dequote(_argv[p]);
   #endif
   //--
   if (_argv[p][0]=='-' && (_argv[p][1]==0 || _argv[p][1]!='-')) { 
     //single-dash argument
     int cpos=1;
     char c=_argv[p][cpos];
     if (c==0 || (nodigitopts && isdigit(c)) || 
            (c=='.' && isdigit(_argv[p][cpos+1]))) { 
        //special case: plain argument '-' or just a negative number
        GREALLOC(args, (count+1)*sizeof(argdata));
        args[count].opt=NULL;
        args[count].fmti=-1;
        if (c==0) {
          GCALLOC(args[count].value, 2);
          args[count].value[0]='-';
          }
         else { //negative number given
          args[count].value=Gstrdup(_argv[p]);
          }
        count++;
        nonOptCount++;
        }
      else { //single-dash argument or switch
       COLLAPSED:
        if ((f=validShortOpt(c))>=0) {
          GREALLOC(args, (count+1)*sizeof(argdata));
          GCALLOC(args[count].opt, 2);
          args[count].opt[0]=c;
          args[count].fmti=f;
          if (!fmt[f].req_value) {//switch type
            GCALLOC(args[count].value,1);//so getOpt() functions would not return NULL
            count++;
            // only switches can be grouped with some other switches or options
            if (_argv[p][cpos+1]!='\0') {
               cpos++;
               c=_argv[p][cpos];
               goto COLLAPSED;
               }
            }
           else {
              //single-dash argument followed by a value
            if (_argv[p][cpos+1]=='\0') {
                if (p+1<_argc && _argv[p+1][0]!=0) { //value is the whole next argument
                   p++;
				#if defined(__APPLE__) && defined(DEBUG)
				   dbg_dequote(_argv[p]);
				#endif
                   args[count].value=Gstrdup(_argv[p]);
                }
                  else {
                   errarg=p;
                   err_valmissing=true;
                   return errarg;
                   }
                }
               else { //value immediately follows the dash-option
                args[count].value=Gstrdup(_argv[p]+cpos+1);
                }
            count++;
            }
          } //was validShortOpt
         else { //option not found in format definition!
           errarg=p;
           return errarg;
           }
        }
     } //-single-dash
   else {//not a single-dash argument
     char* ap=_argv[p];
     bool is_longopt=false;
     if (*ap=='-' && ap[1]=='-') { //double-dash option
        is_longopt=true;
        ap+=2;
        }
     char* e=strchr(ap+1,'=');
     while (e!=NULL && *(e-1)=='\\') e=strchr(e,'=');
     if (e==NULL && is_longopt) {
        e=ap;
        while (*e!=0 && *e!=' ') e++;
        //e will be on eos or next space
        }
     if (e!=NULL && e>ap) {
       //this must be a long option
       //e is on eos, space or '='
       if ((f=validLongOpt(ap,e-1))>=0) {
            GREALLOC(args, (count+1)*sizeof(argdata));
            args[count].opt=Gstrdup(ap,e-1);
            args[count].fmti=f;
            if (fmt[f].req_value) {
               if (*e==0) {
                   //value is the next argument
                   if (p+1<_argc && _argv[p+1][0]!=0) {
                      p++;
					#if defined(__APPLE__) && defined(DEBUG)
                      dbg_dequote(_argv[p]);
   	   	   	   	   	#endif
                      args[count].value=Gstrdup(_argv[p]);
                      }
                    else {
                      errarg=p;
                      err_valmissing=true;
                      return errarg;
                      }
                   }
                else { //value is in the same argument
                   //while (*e!=0 && (*e==' ' || *e=='=')) e++;
                   if (*e=='=') e++;
                   if (*e==0) {
                      errarg=p;
                      err_valmissing=true;
                      return errarg;
                      }
                   args[count].value=Gstrdup(e);
                   }
               } //value required
              else { //no value expected
               GCALLOC(args[count].value,1); //do not return NULL
               }
            count++;
            }
          else { //error - this long argument not recognized
           errarg=p;
           return errarg;
           }
        }
      else { //just a plain non-option argument
       if (e==ap) { //i.e. just "--"
          errarg=p;
          return errarg;
          }
       GREALLOC(args, (count+1)*sizeof(argdata));
       args[count].opt=NULL; //it's not an option
       args[count].value=Gstrdup(_argv[p]);
       args[count].fmti=-1;
       count++;
       nonOptCount++;
       }
     }
   p++;//check next arg string
   } //while arguments
 return errarg;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, 0x1c(%rsp)
movq %rdi, %rbx
cmpl $0x2, 0x10(%rdi)
jl 0x861a
movl $0x1, %ebp
movq 0x18(%rbx), %rax
movslq %ebp, %r13
movq (%rax,%r13,8), %r12
movb (%r12), %r14b
cmpb $0x2d, %r14b
jne 0x805d
movsbl 0x1(%r12), %r15d
cmpl $0x2d, %r15d
jne 0x8134
addq $0x2, %r12
leaq 0x1(%r12), %rdi
movl $0x3d, %esi
callq 0x2100
testq %rax, %rax
je 0x8090
movq %rax, %r15
cmpb $0x5c, -0x1(%r15)
jne 0x80a6
movq %r15, %rdi
movl $0x3d, %esi
callq 0x2100
movq %rax, %r15
testq %rax, %rax
jne 0x8074
cmpb $0x2d, %r14b
jne 0x8100
movq %r12, %r15
movzbl (%r15), %eax
testb $-0x21, %al
je 0x80a6
incq %r15
jmp 0x8099
cmpq %r12, %r15
jbe 0x8103
movq %rbp, 0x8(%rsp)
leaq -0x1(%r15), %rbp
movq %rbx, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x86b2
testl %eax, %eax
js 0x861f
movl %eax, %r14d
movslq 0x28(%rbx), %rax
leaq 0x1(%rax), %rcx
movq 0x20(%rbx), %rdi
testl %ecx, %ecx
je 0x8210
leaq 0x8(,%rax,8), %rax
leaq (%rax,%rax,2), %rsi
testq %rdi, %rdi
je 0x83dd
callq 0x23d0
jmp 0x83e5
xorl %r15d, %r15d
cmpq %r12, %r15
je 0x8624
movslq 0x28(%rbx), %rax
leaq 0x1(%rax), %rcx
movq 0x20(%rbx), %rdi
testl %ecx, %ecx
je 0x818b
leaq 0x8(,%rax,8), %rax
leaq (%rax,%rax,2), %rsi
testq %rdi, %rdi
je 0x8199
callq 0x23d0
jmp 0x81a1
testb %r15b, %r15b
movq %r13, 0x10(%rsp)
je 0x8158
cmpb $0x0, 0x1c(%rsp)
je 0x8221
movl %r15d, %eax
addl $-0x30, %eax
cmpl $0xa, %eax
jae 0x8221
movslq 0x28(%rbx), %rax
leaq 0x1(%rax), %rcx
movq 0x20(%rbx), %rdi
testl %ecx, %ecx
je 0x83cb
leaq 0x8(,%rax,8), %rax
leaq (%rax,%rax,2), %rsi
testq %rdi, %rdi
je 0x84c1
callq 0x23d0
jmp 0x84c9
testq %rdi, %rdi
je 0x8195
callq 0x22e0
xorl %eax, %eax
jmp 0x81a6
movq %rsi, %rdi
callq 0x2330
testq %rax, %rax
je 0x81ac
movq %rax, 0x20(%rbx)
jmp 0x81be
leaq 0x5e6d(%rip), %rdi      # 0xe020
xorl %eax, %eax
callq 0x286c
movq 0x20(%rbx), %rax
movslq 0x28(%rbx), %rcx
leaq (%rcx,%rcx,2), %rcx
movq $0x0, (%rax,%rcx,8)
movq 0x18(%rbx), %rax
movq (%rax,%r13,8), %rdi
xorl %esi, %esi
callq 0x2906
movq 0x20(%rbx), %rcx
movq 0x28(%rbx), %rdx
movq %rdx, %xmm0
psubd 0x602e(%rip), %xmm0     # 0xe220
movslq %edx, %rdx
leaq (%rdx,%rdx,2), %rdx
movq %rax, 0x8(%rcx,%rdx,8)
movl $0xffffffff, 0x10(%rcx,%rdx,8) # imm = 0xFFFFFFFF
movq %xmm0, 0x28(%rbx)
jmp 0x85ac
testq %rdi, %rdi
je 0x821a
callq 0x22e0
xorl %eax, %eax
jmp 0x83ea
cmpb $0x2e, %r15b
jne 0x8239
movsbl 0x2(%r12), %eax
addl $-0x30, %eax
cmpl $0x9, %eax
jbe 0x8158
movl $0x1, %edx
movslq (%rbx), %rax
testq %rax, %rax
jle 0x8624
movq 0x8(%rbx), %rcx
shlq $0x4, %rax
xorl %r12d, %r12d
xorl %r14d, %r14d
cmpb %r15b, 0x8(%rcx,%r14)
je 0x8270
addq $0x10, %r14
incl %r12d
cmpq %r14, %rax
jne 0x8258
jmp 0x8624
movslq 0x28(%rbx), %rax
leaq 0x1(%rax), %rcx
movq 0x20(%rbx), %rdi
testl %ecx, %ecx
movq %rdx, 0x20(%rsp)
je 0x829d
leaq 0x8(,%rax,8), %rax
leaq (%rax,%rax,2), %rsi
testq %rdi, %rdi
je 0x82ab
callq 0x23d0
jmp 0x82b3
testq %rdi, %rdi
je 0x82a7
callq 0x22e0
xorl %eax, %eax
jmp 0x82b8
movq %rsi, %rdi
callq 0x2330
testq %rax, %rax
je 0x82be
movq %rax, 0x20(%rbx)
jmp 0x82d0
leaq 0x5d5b(%rip), %rdi      # 0xe020
xorl %eax, %eax
callq 0x286c
movq 0x20(%rbx), %rax
movslq 0x28(%rbx), %r13
testq %rax, %rax
jne 0x82fb
leaq 0x5f9e(%rip), %rdi      # 0xe27e
leaq 0x5f9b(%rip), %rsi      # 0xe282
movl $0x105, %edx            # imm = 0x105
movq %rax, 0x8(%rsp)
callq 0x282c
movq 0x8(%rsp), %rax
movq %rbp, 0x8(%rsp)
leaq (,%r13,2), %rcx
addq %r13, %rcx
leaq (%rax,%rcx,8), %r13
movl $0x2, %edi
movl $0x1, %esi
callq 0x21c0
movq %rax, (%r13)
testq %rax, %rax
jne 0x8335
leaq 0x5cf2(%rip), %rdi      # 0xe020
xorl %eax, %eax
callq 0x286c
movq 0x20(%rbx), %rax
movslq 0x28(%rbx), %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %rax
movb %r15b, (%rax)
movq 0x20(%rbx), %r13
movl 0x28(%rbx), %r15d
movslq %r15d, %rax
leaq (%rax,%rax,2), %rbp
movl %r12d, 0x10(%r13,%rbp,8)
movq 0x8(%rbx), %rax
cmpb $0x0, 0x9(%rax,%r14)
jne 0x85b9
movl $0x1, %edi
movl $0x1, %esi
callq 0x21c0
movq %rax, 0x8(%r13,%rbp,8)
testq %rax, %rax
jne 0x8397
leaq 0x5c94(%rip), %rdi      # 0xe020
xorl %eax, %eax
callq 0x286c
movl 0x28(%rbx), %r15d
incl %r15d
movl %r15d, 0x28(%rbx)
movq 0x18(%rbx), %rax
movq 0x10(%rsp), %r13
movq (%rax,%r13,8), %rax
movq 0x20(%rsp), %rdx
movb 0x1(%rax,%rdx), %r15b
incq %rdx
testb %r15b, %r15b
movq 0x8(%rsp), %rbp
jne 0x823e
jmp 0x85ac
testq %rdi, %rdi
je 0x83d5
callq 0x22e0
xorl %r14d, %r14d
jmp 0x84d1
movq %rsi, %rdi
callq 0x2330
testq %rax, %rax
je 0x83f0
movq %rax, 0x20(%rbx)
jmp 0x83fe
leaq 0x5c29(%rip), %rdi      # 0xe020
xorl %eax, %eax
callq 0x286c
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2978
movq 0x20(%rbx), %rbp
movl 0x28(%rbx), %r12d
movslq %r12d, %rcx
leaq (%rcx,%rcx,2), %r13
movq %rax, (%rbp,%r13,8)
movl %r14d, 0x10(%rbp,%r13,8)
movq 0x8(%rbx), %rax
movl %r14d, %ecx
shlq $0x4, %rcx
cmpb $0x1, 0x9(%rax,%rcx)
jne 0x848a
movzbl (%r15), %eax
cmpl $0x3d, %eax
je 0x8576
testl %eax, %eax
movq 0x8(%rsp), %rbp
jne 0x8582
incl %ebp
cmpl 0x10(%rbx), %ebp
jge 0x8638
movq 0x18(%rbx), %rax
movslq %ebp, %rcx
movq (%rax,%rcx,8), %rdi
cmpb $0x0, (%rdi)
je 0x8638
xorl %esi, %esi
callq 0x2906
movq 0x20(%rbx), %rcx
movslq 0x28(%rbx), %r12
leaq (%r12,%r12,2), %rdx
movq %rax, 0x8(%rcx,%rdx,8)
jmp 0x85a5
movl $0x1, %edi
movl $0x1, %esi
callq 0x21c0
movq %rax, 0x8(%rbp,%r13,8)
testq %rax, %rax
jne 0x84b5
leaq 0x5b76(%rip), %rdi      # 0xe020
xorl %eax, %eax
callq 0x286c
movl 0x28(%rbx), %r12d
movq 0x8(%rsp), %rax
movl %eax, %ebp
jmp 0x85a5
movq %rsi, %rdi
callq 0x2330
testq %rax, %rax
je 0x84d7
movq %rax, %r14
movq %r14, 0x20(%rbx)
jmp 0x84e9
leaq 0x5b42(%rip), %rdi      # 0xe020
xorl %eax, %eax
callq 0x286c
movq 0x20(%rbx), %r14
movslq 0x28(%rbx), %r12
leaq (%r12,%r12,2), %r13
movq $0x0, (%r14,%r13,8)
movl $0xffffffff, 0x10(%r14,%r13,8) # imm = 0xFFFFFFFF
testb %r15b, %r15b
je 0x852e
movq 0x18(%rbx), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
xorl %esi, %esi
callq 0x2906
movq 0x20(%rbx), %rdx
movslq 0x28(%rbx), %rcx
leaq (%rcx,%rcx,2), %rsi
movq %rax, 0x8(%rdx,%rsi,8)
jmp 0x856c
movl $0x2, %edi
movl $0x1, %esi
callq 0x21c0
movq %rax, 0x8(%r14,%r13,8)
testq %rax, %rax
jne 0x8559
leaq 0x5ad2(%rip), %rdi      # 0xe020
xorl %eax, %eax
callq 0x286c
movslq 0x28(%rbx), %r12
movq 0x20(%rbx), %rax
leaq (%r12,%r12,2), %rcx
movq 0x8(%rax,%rcx,8), %rax
movb $0x2d, (%rax)
movl 0x28(%rbx), %ecx
incl %ecx
movl %ecx, 0x28(%rbx)
incl 0x2c(%rbx)
jmp 0x85ac
movb 0x1(%r15), %al
incq %r15
movq 0x8(%rsp), %rbp
testb %al, %al
je 0x863d
movq %r15, %rdi
xorl %esi, %esi
callq 0x2906
movq 0x20(%rbx), %rcx
movslq 0x28(%rbx), %r12
leaq (%r12,%r12,2), %rdx
movq %rax, 0x8(%rcx,%rdx,8)
incl %r12d
movl %r12d, 0x28(%rbx)
incl %ebp
cmpl 0x10(%rbx), %ebp
jl 0x8034
jmp 0x861a
movq 0x18(%rbx), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rcx
movl 0x20(%rsp), %edx
cmpb $0x0, 0x1(%rcx,%rdx)
je 0x85e1
leaq (%rcx,%rdx), %rdi
incq %rdi
movq 0x8(%rsp), %rax
movl %eax, %ebp
jmp 0x85fa
movq 0x8(%rsp), %rcx
leal 0x1(%rcx), %ebp
cmpl 0x10(%rbx), %ebp
jge 0x8638
movslq %ebp, %rcx
movq (%rax,%rcx,8), %rdi
cmpb $0x0, (%rdi)
je 0x8638
xorl %esi, %esi
callq 0x2906
movq 0x20(%rbx), %rcx
movslq 0x28(%rbx), %rdx
leaq (%rdx,%rdx,2), %rsi
movq %rax, 0x8(%rcx,%rsi,8)
leal 0x1(%rdx), %eax
movl %eax, 0x28(%rbx)
jmp 0x85ac
movl 0x38(%rbx), %ebp
jmp 0x8627
movq 0x8(%rsp), %rbp
movl %ebp, 0x38(%rbx)
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rsp), %rbp
movl %ebp, 0x38(%rbx)
movb $0x1, 0x3c(%rbx)
jmp 0x8627