// File: /workspace/github_c_makefile_star2_O0/alexgirao[P]aimant/bsd-getopt_long.c
// Function: pure_getopt_internal
static int pure_getopt_internal(int nargc, char * const *nargv,
                                const char *options,
                                const struct pure_option *long_options,
                                int *idx, int flags)
{
    char *oli;                /* option letter list index */
    int optchar, short_too;
    static int posixly_correct = -1;
    
    if (options == NULL)
        return -1;
    
    /*
     * XXX Some GNU programs (like cvs) set pure_optind to 0 instead of
     * XXX using pure_optreset.  Work around this braindamage.
     */
    if (pure_optind == 0)
        pure_optind = pure_optreset = 1;    
    
    /*
     * Disable GNU extensions if POSIXLY_CORRECT is set or options
     * string begins with a '+'.
     */
    if (posixly_correct == -1 || pure_optreset)
        posixly_correct = (getenv("POSIXLY_CORRECT") != NULL);
    if (*options == '-')
        flags |= FLAG_ALLARGS;    
    else if (posixly_correct || *options == '+')
        flags &= ~FLAG_PERMUTE;
    if (*options == '+' || *options == '-')
        options++;
        
    pure_optarg = NULL;
    if (pure_optreset)
        nonopt_start = nonopt_end = -1;
    start:
    if (pure_optreset || !*pure_place) {        /* update scanning pointer */
        pure_optreset = 0;
        if (pure_optind >= nargc) {          /* end of argument vector */
            pure_place = EMSG;
            if (nonopt_end != -1) {
                /* do permutation, if we have to */
                pure_permute_args(nonopt_start, nonopt_end,
                                  pure_optind, nargv);
                pure_optind -= nonopt_end - nonopt_start;
            }
            else if (nonopt_start != -1) {
                /*
                 * If we skipped non-options, set pure_optind
                 * to the first of them.
                 */
                pure_optind = nonopt_start;
            }
            nonopt_start = nonopt_end = -1;
            return -1;
        }
        if (*(pure_place = nargv[pure_optind]) != '-' ||
            (pure_place[1] == '\0' && strchr(options, '-') == NULL)) {
            pure_place = EMSG;        /* found non-option */
            if (flags & FLAG_ALLARGS) {
                /*
                 * GNU extension:
                 * return non-option as argument to option 1
                 */
                pure_optarg = nargv[pure_optind++];
                return INORDER;
            }
            if (!(flags & FLAG_PERMUTE)) {
                /*
                 * If no permutation wanted, stop parsing
                 * at first non-option.
                 */
                return -1;
            }
            /* do permutation */
            if (nonopt_start == -1)
                nonopt_start = pure_optind;
            else if (nonopt_end != -1) {
                pure_permute_args(nonopt_start, nonopt_end,
                                  pure_optind, nargv);
                nonopt_start = pure_optind -
                    (nonopt_end - nonopt_start);
                nonopt_end = -1;
            }
            pure_optind++;
            /* process next argument */
            goto start;
        }
        if (nonopt_start != -1 && nonopt_end == -1)
            nonopt_end = pure_optind;

        /*
         * Check for "--" or "--foo" with no long options
         * but if pure_place is simply "-" leave it unmolested.
         */

        if (pure_place[1] != '\0' && *++pure_place == '-' &&
            (pure_place[1] == '\0' || long_options == NULL)) {
            pure_optind++;
            pure_place = EMSG;
            /*
             * We found an option (--), so if we skipped
             * non-options, we have to permute.
             */
            if (nonopt_end != -1) {
                pure_permute_args(nonopt_start, nonopt_end,
                                  pure_optind, nargv);
                pure_optind -= nonopt_end - nonopt_start;
            }
            nonopt_start = nonopt_end = -1;
            return -1;
        }
    }
    
    /*
     * Check long options if:
     *  1) we were passed some
     *  2) the arg is not just "-"
     *  3) either the arg starts with -- we are pure_getopt_long_only()
     */
    if (long_options != NULL && pure_place != nargv[pure_optind] &&
        (*pure_place == '-' || (flags & FLAG_LONGONLY))) {
        short_too = 0;
        if (*pure_place == '-')
            pure_place++;        /* --foo long option */
        else if (*pure_place != ':' && strchr(options, *pure_place) != NULL)
            short_too = 1;        /* could be short option too */
        
        optchar = pure_parse_long_options(nargv, options, long_options,
                                          idx, short_too);
        if (optchar != -1) {
            pure_place = EMSG;
            return optchar;
        }
    }
    
    if ((optchar = (int) *pure_place++) == ':' ||
        (optchar == '-' && *pure_place) != '\0' ||
        (oli = strchr(options, optchar)) == NULL) { 
         /*
          * If the user didn't specify '-' as an option,
          * assume it means -1 as POSIX specifies.
          */
        if (optchar == '-')
            return -1;
        /* option letter unknown or ':' */
        if (!*pure_place)
            ++pure_optind;
        if (PRINT_ERROR)
            fprintf(stderr, illoptchar, optchar);
        pure_optopt = optchar;
        return BADCH;
    }
    if (long_options != NULL && optchar == 'W' && oli[1] == ';') {
        /* -W long-option */
        if (*pure_place)            /* no space */
            /* NOTHING */;
        else if (++pure_optind >= nargc) {    /* no arg */
            pure_place = EMSG;
            if (PRINT_ERROR)
                fprintf(stderr, recargchar, optchar);
            pure_optopt = optchar;
            return BADARG;
        } else                /* white space */
            pure_place = nargv[pure_optind];
        optchar = pure_parse_long_options(nargv, options, long_options,
                                          idx, 0);
        pure_place = EMSG;
        return optchar;
    }
    if (*++oli != ':') {            /* doesn't take argument */
        if (!*pure_place) {
            ++pure_optind;
        }
    } else {                /* takes (optional) argument */
        pure_optarg = NULL;
        if (*pure_place) {            /* no white space */
            pure_optarg = pure_place;
        } else if (oli[1] != ':') {    /* arg not optional */
            if (++pure_optind >= nargc) {    /* no arg */
                pure_place = EMSG;
                if (PRINT_ERROR)
                    fprintf(stderr, recargchar, optchar);
                pure_optopt = optchar;
                return BADARG;
            } else {
                pure_optarg = nargv[pure_optind];
            }
        }
        pure_place = EMSG;
        ++pure_optind;
    }
    /* dump back option letter */
    return optchar;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x62a2
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6a05
cmpl $0x0, 0x543b(%rip)      # 0xb6e4
jne 0x62bf
movl $0x1, 0x54a3(%rip)      # 0xb758
movl $0x1, 0x5425(%rip)      # 0xb6e4
cmpl $-0x1, 0x5426(%rip)     # 0xb6ec
je 0x62d1
cmpl $0x0, 0x5489(%rip)      # 0xb758
je 0x62ef
leaq 0x2df3(%rip), %rdi      # 0x90cb
callq 0x2030
cmpq $0x0, %rax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x53fd(%rip)      # 0xb6ec
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x6306
movl -0x2c(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x2c(%rbp)
jmp 0x6326
cmpl $0x0, 0x53df(%rip)      # 0xb6ec
jne 0x631b
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
jne 0x6324
movl -0x2c(%rbp), %eax
andl $-0x2, %eax
movl %eax, -0x2c(%rbp)
jmp 0x6326
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
je 0x633e
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x634a
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq $0x0, 0x540b(%rip) # 0xb760
cmpl $0x0, 0x53fc(%rip)      # 0xb758
je 0x6372
movl $0xffffffff, 0x5388(%rip) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x5382(%rip) # imm = 0xFFFFFFFF
jmp 0x6374
cmpl $0x0, 0x53dd(%rip)      # 0xb758
jne 0x638d
movq 0x5374(%rip), %rax      # 0xb6f8
cmpb $0x0, (%rax)
jne 0x6631
movl $0x0, 0x53c1(%rip)      # 0xb758
movl 0x5347(%rip), %eax      # 0xb6e4
cmpl -0x8(%rbp), %eax
jl 0x642b
leaq 0x2354(%rip), %rax      # 0x8701
movq %rax, 0x5344(%rip)      # 0xb6f8
cmpl $-0x1, 0x5335(%rip)     # 0xb6f0
je 0x63f4
movl 0x5331(%rip), %edi      # 0xb6f4
movl 0x5327(%rip), %esi      # 0xb6f0
movl 0x5315(%rip), %edx      # 0xb6e4
movq -0x10(%rbp), %rcx
callq 0x6a90
movl 0x5312(%rip), %ecx      # 0xb6f0
subl 0x5310(%rip), %ecx      # 0xb6f4
movl 0x52fa(%rip), %eax      # 0xb6e4
subl %ecx, %eax
movl %eax, 0x52f2(%rip)      # 0xb6e4
jmp 0x640b
cmpl $-0x1, 0x52f9(%rip)     # 0xb6f4
je 0x6409
movl 0x52f1(%rip), %eax      # 0xb6f4
movl %eax, 0x52db(%rip)      # 0xb6e4
jmp 0x640b
movl $0xffffffff, 0x52db(%rip) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x52d5(%rip) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6a05
movq -0x10(%rbp), %rax
movslq 0x52ae(%rip), %rcx      # 0xb6e4
movq (%rax,%rcx,8), %rax
movq %rax, 0x52b7(%rip)      # 0xb6f8
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x6475
movq 0x52a8(%rip), %rax      # 0xb6f8
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
jne 0x6549
movq -0x18(%rbp), %rdi
movl $0x2d, %esi
callq 0x2100
cmpq $0x0, %rax
jne 0x6549
leaq 0x2285(%rip), %rax      # 0x8701
movq %rax, 0x5275(%rip)      # 0xb6f8
movl -0x2c(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x64bd
movq -0x10(%rbp), %rax
movl 0x524c(%rip), %ecx      # 0xb6e4
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0x5241(%rip)      # 0xb6e4
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x52af(%rip)      # 0xb760
movl $0x1, -0x4(%rbp)
jmp 0x6a05
movl -0x2c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x64d4
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6a05
cmpl $-0x1, 0x5219(%rip)     # 0xb6f4
jne 0x64eb
movl 0x5201(%rip), %eax      # 0xb6e4
movl %eax, 0x520b(%rip)      # 0xb6f4
jmp 0x6535
cmpl $-0x1, 0x51fe(%rip)     # 0xb6f0
je 0x6533
movl 0x51fa(%rip), %edi      # 0xb6f4
movl 0x51f0(%rip), %esi      # 0xb6f0
movl 0x51de(%rip), %edx      # 0xb6e4
movq -0x10(%rbp), %rcx
callq 0x6a90
movl 0x51cf(%rip), %eax      # 0xb6e4
movl 0x51d5(%rip), %ecx      # 0xb6f0
subl 0x51d3(%rip), %ecx      # 0xb6f4
subl %ecx, %eax
movl %eax, 0x51cb(%rip)      # 0xb6f4
movl $0xffffffff, 0x51bd(%rip) # imm = 0xFFFFFFFF
jmp 0x6535
movl 0x51a9(%rip), %eax      # 0xb6e4
addl $0x1, %eax
movl %eax, 0x51a0(%rip)      # 0xb6e4
jmp 0x6374
cmpl $-0x1, 0x51a4(%rip)     # 0xb6f4
je 0x6567
cmpl $-0x1, 0x5197(%rip)     # 0xb6f0
jne 0x6567
movl 0x5183(%rip), %eax      # 0xb6e4
movl %eax, 0x5189(%rip)      # 0xb6f0
movq 0x518a(%rip), %rax      # 0xb6f8
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
je 0x662f
movq 0x5176(%rip), %rax      # 0xb6f8
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x5168(%rip)      # 0xb6f8
movsbl 0x1(%rax), %eax
cmpl $0x2d, %eax
jne 0x662f
movq 0x5154(%rip), %rax      # 0xb6f8
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
je 0x65b4
cmpq $0x0, -0x20(%rbp)
jne 0x662f
movl 0x512a(%rip), %eax      # 0xb6e4
addl $0x1, %eax
movl %eax, 0x5121(%rip)      # 0xb6e4
leaq 0x2137(%rip), %rax      # 0x8701
movq %rax, 0x5127(%rip)      # 0xb6f8
cmpl $-0x1, 0x5118(%rip)     # 0xb6f0
je 0x660f
movl 0x5114(%rip), %edi      # 0xb6f4
movl 0x510a(%rip), %esi      # 0xb6f0
movl 0x50f8(%rip), %edx      # 0xb6e4
movq -0x10(%rbp), %rcx
callq 0x6a90
movl 0x50f5(%rip), %ecx      # 0xb6f0
subl 0x50f3(%rip), %ecx      # 0xb6f4
movl 0x50dd(%rip), %eax      # 0xb6e4
subl %ecx, %eax
movl %eax, 0x50d5(%rip)      # 0xb6e4
movl $0xffffffff, 0x50d7(%rip) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x50d1(%rip) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6a05
jmp 0x6631
cmpq $0x0, -0x20(%rbp)
je 0x670e
movq 0x50b5(%rip), %rax      # 0xb6f8
movq -0x10(%rbp), %rcx
movslq 0x5096(%rip), %rdx      # 0xb6e4
cmpq (%rcx,%rdx,8), %rax
je 0x670e
movq 0x5099(%rip), %rax      # 0xb6f8
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x6676
movl -0x2c(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x670e
movl $0x0, -0x40(%rbp)
movq 0x5074(%rip), %rax      # 0xb6f8
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x66a0
movq 0x5065(%rip), %rax      # 0xb6f8
addq $0x1, %rax
movq %rax, 0x505a(%rip)      # 0xb6f8
jmp 0x66d1
movq 0x5051(%rip), %rax      # 0xb6f8
movsbl (%rax), %eax
cmpl $0x3a, %eax
je 0x66cf
movq -0x18(%rbp), %rdi
movq 0x503e(%rip), %rax      # 0xb6f8
movsbl (%rax), %esi
callq 0x2100
cmpq $0x0, %rax
je 0x66cf
movl $0x1, -0x40(%rbp)
jmp 0x66d1
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movl -0x40(%rbp), %r8d
callq 0x6b80
movl %eax, -0x3c(%rbp)
cmpl $-0x1, -0x3c(%rbp)
je 0x670c
leaq 0x2007(%rip), %rax      # 0x8701
movq %rax, 0x4ff7(%rip)      # 0xb6f8
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6a05
jmp 0x670e
movq 0x4fe3(%rip), %rax      # 0xb6f8
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x4fd5(%rip)      # 0xb6f8
movsbl (%rax), %eax
movl %eax, -0x3c(%rbp)
cmpl $0x3a, %eax
je 0x676f
xorl %eax, %eax
cmpl $0x2d, -0x3c(%rbp)
movb %al, -0x41(%rbp)
jne 0x674c
movq 0x4fb8(%rip), %rax      # 0xb6f8
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x676f
movq -0x18(%rbp), %rdi
movl -0x3c(%rbp), %esi
callq 0x2100
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0x67e1
cmpl $0x2d, -0x3c(%rbp)
jne 0x6781
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6a05
movq 0x4f70(%rip), %rax      # 0xb6f8
cmpb $0x0, (%rax)
jne 0x679c
movl 0x4f51(%rip), %eax      # 0xb6e4
addl $0x1, %eax
movl %eax, 0x4f48(%rip)      # 0xb6e4
cmpl $0x0, 0x4f3d(%rip)      # 0xb6e0
je 0x67cc
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
je 0x67cc
movq 0x4840(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq 0x4f3e(%rip), %rsi      # 0xb700
movl -0x3c(%rbp), %edx
movb $0x0, %al
callq 0x21c0
movl -0x3c(%rbp), %eax
movl %eax, 0x4f13(%rip)      # 0xb6e8
movl $0x3f, -0x4(%rbp)
jmp 0x6a05
cmpq $0x0, -0x20(%rbp)
je 0x68de
cmpl $0x57, -0x3c(%rbp)
jne 0x68de
movq -0x38(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x3b, %eax
jne 0x68de
movq 0x4eea(%rip), %rax      # 0xb6f8
cmpb $0x0, (%rax)
je 0x6818
jmp 0x68aa
movl 0x4ec6(%rip), %eax      # 0xb6e4
addl $0x1, %eax
movl %eax, 0x4ebd(%rip)      # 0xb6e4
cmpl -0x8(%rbp), %eax
jl 0x6892
leaq 0x1ece(%rip), %rax      # 0x8701
movq %rax, 0x4ebe(%rip)      # 0xb6f8
cmpl $0x0, 0x4e9f(%rip)      # 0xb6e0
je 0x686a
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
je 0x686a
movq 0x47a2(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq 0x4ea8(%rip), %rsi      # 0xb708
movl -0x3c(%rbp), %edx
movb $0x0, %al
callq 0x21c0
movl -0x3c(%rbp), %eax
movl %eax, 0x4e75(%rip)      # 0xb6e8
movq -0x18(%rbp), %rax
movsbl (%rax), %edx
movl $0x3f, %eax
movl $0x3a, %ecx
cmpl $0x3a, %edx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x6a05
movq -0x10(%rbp), %rax
movslq 0x4e47(%rip), %rcx      # 0xb6e4
movq (%rax,%rcx,8), %rax
movq %rax, 0x4e50(%rip)      # 0xb6f8
jmp 0x68aa
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
xorl %r8d, %r8d
callq 0x6b80
movl %eax, -0x3c(%rbp)
leaq 0x1e35(%rip), %rax      # 0x8701
movq %rax, 0x4e25(%rip)      # 0xb6f8
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6a05
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x3a, %eax
je 0x6916
movq 0x4dfb(%rip), %rax      # 0xb6f8
cmpb $0x0, (%rax)
jne 0x6911
movl 0x4ddc(%rip), %eax      # 0xb6e4
addl $0x1, %eax
movl %eax, 0x4dd3(%rip)      # 0xb6e4
jmp 0x69ff
movq $0x0, 0x4e3f(%rip) # 0xb760
movq 0x4dd0(%rip), %rax      # 0xb6f8
cmpb $0x0, (%rax)
je 0x6940
movq 0x4dc4(%rip), %rax      # 0xb6f8
movq %rax, 0x4e25(%rip)      # 0xb760
jmp 0x69e2
movq -0x38(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x3a, %eax
je 0x69e0
movl 0x4d8d(%rip), %eax      # 0xb6e4
addl $0x1, %eax
movl %eax, 0x4d84(%rip)      # 0xb6e4
cmpl -0x8(%rbp), %eax
jl 0x69c8
leaq 0x1d95(%rip), %rax      # 0x8701
movq %rax, 0x4d85(%rip)      # 0xb6f8
cmpl $0x0, 0x4d66(%rip)      # 0xb6e0
je 0x69a3
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
je 0x69a3
movq 0x4669(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq 0x4d6f(%rip), %rsi      # 0xb708
movl -0x3c(%rbp), %edx
movb $0x0, %al
callq 0x21c0
movl -0x3c(%rbp), %eax
movl %eax, 0x4d3c(%rip)      # 0xb6e8
movq -0x18(%rbp), %rax
movsbl (%rax), %edx
movl $0x3f, %eax
movl $0x3a, %ecx
cmpl $0x3a, %edx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x6a05
movq -0x10(%rbp), %rax
movslq 0x4d11(%rip), %rcx      # 0xb6e4
movq (%rax,%rcx,8), %rax
movq %rax, 0x4d82(%rip)      # 0xb760
jmp 0x69e0
jmp 0x69e2
leaq 0x1d18(%rip), %rax      # 0x8701
movq %rax, 0x4d08(%rip)      # 0xb6f8
movl 0x4cee(%rip), %eax      # 0xb6e4
addl $0x1, %eax
movl %eax, 0x4ce5(%rip)      # 0xb6e4
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nop