// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edi, -0x3c(%rbp)
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testq %rdx, %rdx
je 0x3da2
movq %rcx, %r15
movq %rdx, %rbx
movl 0x4e9a(%rip), %r13d     # 0x86d4
testl %r13d, %r13d
movq %rsi, -0x38(%rbp)
movq %r8, -0x58(%rbp)
je 0x386c
movl 0x4eb2(%rip), %r14d     # 0x8700
movl 0x4e88(%rip), %ecx      # 0x86dc
cmpl $-0x1, %ecx
sete %al
testl %r14d, %r14d
setne %dl
orb %al, %dl
cmpb $0x1, %dl
jne 0x38ae
movl %r9d, %r12d
jmp 0x3889
movl %r9d, %r12d
movl $0x1, %r13d
movl %r13d, 0x4e84(%rip)     # 0x8700
movl %r13d, 0x4e51(%rip)     # 0x86d4
movl $0x1, %r14d
leaq 0x2698(%rip), %rdi      # 0x5f28
callq 0x1030
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
movl %ecx, 0x4e39(%rip)      # 0x86dc
testl %r14d, %r14d
sete %al
movl %r12d, %r9d
jmp 0x38b3
movb $0x1, %al
xorl %r14d, %r14d
movb (%rbx), %sil
cmpb $0x2d, %sil
jne 0x38c9
orl $0x2, %r9d
movl %r9d, %edx
movq -0x38(%rbp), %rcx
jmp 0x38e3
movl %r9d, %edx
andl $-0x2, %edx
testl %ecx, %ecx
cmovnel %edx, %r9d
cmpb $0x2b, %sil
cmovel %edx, %r9d
movq -0x38(%rbp), %rcx
jne 0x38e9
incq %rbx
movl %edx, %r9d
movq %rbx, -0x30(%rbp)
movq $0x0, 0x4e10(%rip) # 0x8708
testb %al, %al
movq %r15, -0x48(%rbp)
je 0x390f
movl 0x4dde(%rip), %ebx      # 0x86e4
movl 0x4dd3(%rip), %r15d     # 0x86e0
jmp 0x3928
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %r15d, 0x4dc4(%rip)     # 0x86e0
movl %r15d, 0x4dc1(%rip)     # 0x86e4
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0x4db9(%rip), %r12      # 0x86e8
leaq 0x1c3b(%rip), %rdx      # 0x5571
movl %r9d, -0x4c(%rbp)
testl %r14d, %r14d
jne 0x394a
cmpb $0x0, (%r12)
jne 0x3b3e
movl $0x0, 0x4dac(%rip)      # 0x8700
cmpl -0x3c(%rbp), %r13d
jge 0x3a37
movslq %r13d, %rax
movq (%rcx,%rax,8), %r12
movq %r12, 0x4d7c(%rip)      # 0x86e8
cmpb $0x2d, (%r12)
jne 0x39a7
movb 0x1(%r12), %r14b
testb %r14b, %r14b
jne 0x3a6a
movq -0x30(%rbp), %rdi
movl $0x2d, %esi
callq 0x1100
leaq 0x1bdb(%rip), %rdx      # 0x5571
movl -0x4c(%rbp), %r9d
movq -0x38(%rbp), %rcx
testq %rax, %rax
jne 0x3a6a
movq %rdx, 0x4d3a(%rip)      # 0x86e8
testb $0x2, %r9b
jne 0x3af0
testb $0x1, %r9b
je 0x3b0c
cmpl $-0x1, %ebx
je 0x3a18
xorl %r14d, %r14d
cmpl $-0x1, %r15d
je 0x3a10
movl %ebx, %edi
movl %r15d, %esi
movl %r13d, %edx
callq 0x3e80
leaq 0x1b8d(%rip), %rdx      # 0x5571
movl -0x4c(%rbp), %r9d
movq -0x38(%rbp), %rcx
movl 0x4ce1(%rip), %r13d     # 0x86d4
subl %r15d, %ebx
addl %r13d, %ebx
movl %ebx, 0x4ce5(%rip)      # 0x86e4
movl $0xffffffff, 0x4cd7(%rip) # imm = 0xFFFFFFFF
movl 0x4cf0(%rip), %r14d     # 0x8700
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0x3a25
movl %r13d, 0x4cc5(%rip)     # 0x86e4
xorl %r14d, %r14d
movl %r13d, %ebx
incl %r13d
movl %r13d, 0x4ca5(%rip)     # 0x86d4
movq %rdx, %r12
jmp 0x393a
leaq 0x1b33(%rip), %rax      # 0x5571
movq %rax, 0x4ca3(%rip)      # 0x86e8
cmpl $-0x1, %r15d
je 0x3b17
movl %ebx, %edi
movl %r15d, %esi
movl %r13d, %edx
callq 0x3e80
subl %r15d, %ebx
addl 0x4c6f(%rip), %ebx      # 0x86d4
jmp 0x3b1c
cmpl $-0x1, %ebx
setne %al
cmpl $-0x1, %r15d
sete %dl
andb %al, %dl
cmpb $0x1, %dl
jne 0x3a88
movl %r13d, 0x4c5b(%rip)     # 0x86e0
movl %r13d, %r15d
testb %r14b, %r14b
je 0x3b3e
leaq 0x1(%r12), %rax
movq %rax, 0x4c4b(%rip)      # 0x86e8
cmpb $0x2d, %r14b
jne 0x3b3b
cmpq $0x0, -0x48(%rbp)
je 0x3aba
cmpb $0x0, 0x2(%r12)
jne 0x3b51
incl %r13d
movl %r13d, 0x4c10(%rip)     # 0x86d4
leaq 0x1aa6(%rip), %rax      # 0x5571
movq %rax, 0x4c16(%rip)      # 0x86e8
cmpl $-0x1, %r15d
je 0x3b22
movl %ebx, %edi
movl %r15d, %esi
movl %r13d, %edx
callq 0x3e80
subl %r15d, %ebx
addl %ebx, 0x4be6(%rip)      # 0x86d4
jmp 0x3b22
incl %r13d
movl %r13d, 0x4bda(%rip)     # 0x86d4
movq %r12, 0x4c07(%rip)      # 0x8708
movl $0x1, %r13d
jmp 0x3da2
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jmp 0x3da2
cmpl $-0x1, %ebx
je 0x3b22
movl %ebx, 0x4bb2(%rip)      # 0x86d4
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl %r13d, 0x4bb1(%rip)     # 0x86e0
movl %r13d, 0x4bae(%rip)     # 0x86e4
jmp 0x3da2
movq %rax, %r12
cmpq $0x0, -0x48(%rbp)
je 0x3b68
movslq %r13d, %rax
cmpq (%rcx,%rax,8), %r12
je 0x3ba8
movq %r12, %rax
movb (%rax), %sil
movb $0x1, %r14b
testb $0x4, %r9b
jne 0x3b6d
cmpb $0x2d, %sil
je 0x3b6d
movq %rax, %r12
jmp 0x3bab
xorl %r14d, %r14d
jmp 0x3bab
xorl %r8d, %r8d
cmpb $0x3a, %sil
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
je 0x3cff
movzbl %sil, %edx
cmpl $0x2d, %edx
movq -0x30(%rbp), %rbx
movq -0x58(%rbp), %r15
movq -0x48(%rbp), %r12
jne 0x3d0d
incq %rax
movq %rax, 0x4b45(%rip)      # 0x86e8
jmp 0x3d27
movb $0x1, %r14b
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
leaq 0x1(%r12), %r15
movq %r15, 0x4b2b(%rip)      # 0x86e8
movzbl (%r12), %r12d
movsbl %r12b, %ebx
cmpl $0x3a, %r12d
je 0x3cb7
cmpl $0x2d, %r12d
jne 0x3bfd
cmpb $0x0, (%r15)
jne 0x3da2
movq -0x30(%rbp), %rdi
movl %ebx, %esi
callq 0x1100
movq -0x38(%rbp), %rdi
testq %rax, %rax
jne 0x3c80
jmp 0x3da2
movq -0x30(%rbp), %rdi
movl %ebx, %esi
callq 0x1100
testq %rax, %rax
je 0x3cad
cmpb $0x57, %r12b
setne %cl
xorb $0x1, %r14b
orb %cl, %r14b
movq -0x38(%rbp), %rdi
jne 0x3c80
cmpb $0x3b, 0x1(%rax)
jne 0x3c80
cmpb $0x0, (%r15)
movq -0x30(%rbp), %rbx
movq -0x58(%rbp), %rcx
movq -0x48(%rbp), %rdx
jne 0x3c62
movslq 0x4a90(%rip), %rax      # 0x86d4
leal 0x1(%rax), %esi
movl %esi, 0x4a87(%rip)      # 0x86d4
cmpl -0x3c(%rbp), %esi
jge 0x3e02
movq 0x8(%rdi,%rax,8), %rax
movq %rax, 0x4a86(%rip)      # 0x86e8
movq %rbx, %rsi
xorl %r8d, %r8d
callq 0x3f1e
leaq 0x18fd(%rip), %rcx      # 0x5571
movq %rcx, 0x4a6d(%rip)      # 0x86e8
jmp 0x3da5
cmpb $0x3a, 0x1(%rax)
jne 0x3cea
movq $0x0, 0x4a77(%rip) # 0x8708
cmpb $0x0, (%r15)
je 0x3d5c
movq %r15, 0x4a66(%rip)      # 0x8708
movl 0x4a2c(%rip), %eax      # 0x86d4
jmp 0x3d89
cmpb $0x2d, %r12b
je 0x3da2
cmpb $0x0, (%r15)
jne 0x3cc3
incl 0x4a11(%rip)            # 0x86d4
cmpl $0x0, 0x4a06(%rip)      # 0x86d0
je 0x3cd9
movq -0x30(%rbp), %rax
cmpb $0x3a, (%rax)
jne 0x3db4
movl %ebx, 0x49f9(%rip)      # 0x86d8
movl $0x3f, %r13d
jmp 0x3da2
cmpb $0x0, (%r15)
jne 0x3d9f
incl 0x49da(%rip)            # 0x86d4
jmp 0x3d9f
movq -0x30(%rbp), %rbx
movq -0x58(%rbp), %r15
movq -0x48(%rbp), %r12
jmp 0x3d27
movsbl %sil, %esi
movq %rbx, %rdi
callq 0x1100
movq -0x38(%rbp), %rcx
xorl %r8d, %r8d
testq %rax, %rax
setne %r8b
movq %rcx, %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x3f1e
cmpl $-0x1, %eax
je 0x3d50
leaq 0x182d(%rip), %rcx      # 0x5571
movq %rcx, 0x499d(%rip)      # 0x86e8
movl %eax, %r13d
jmp 0x3da2
movq 0x4991(%rip), %r12      # 0x86e8
jmp 0x3bb1
cmpb $0x3a, 0x2(%rax)
movl 0x496e(%rip), %ecx      # 0x86d4
jne 0x3d6c
movl %ecx, %eax
jmp 0x3d89
leal 0x1(%rcx), %eax
movl %eax, 0x495f(%rip)      # 0x86d4
cmpl -0x3c(%rbp), %eax
jge 0x3dd3
movslq %ecx, %rcx
movq 0x8(%rdi,%rcx,8), %rcx
movq %rcx, 0x497f(%rip)      # 0x8708
leaq 0x17e1(%rip), %rcx      # 0x5571
movq %rcx, 0x4951(%rip)      # 0x86e8
incl %eax
movl %eax, 0x4935(%rip)      # 0x86d4
movl %ebx, %r13d
movl %r13d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x423d(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
leaq 0x21ef(%rip), %rsi      # 0x5fb4
movl %ebx, %edx
xorl %eax, %eax
callq 0x11b0
jmp 0x3cd9
leaq 0x1797(%rip), %rax      # 0x5571
movq %rax, 0x4907(%rip)      # 0x86e8
cmpl $0x0, 0x48e8(%rip)      # 0x86d0
movq -0x30(%rbp), %r14
je 0x3df4
cmpb $0x3a, (%r14)
jne 0x3e3d
movl %ebx, 0x48de(%rip)      # 0x86d8
xorl %eax, %eax
cmpb $0x3a, (%r14)
jmp 0x3e2d
leaq 0x1768(%rip), %rax      # 0x5571
movq %rax, 0x48d8(%rip)      # 0x86e8
cmpl $0x0, 0x48b9(%rip)      # 0x86d0
je 0x3e1e
cmpb $0x3a, (%rbx)
jne 0x3e59
movl $0x57, 0x48b0(%rip)     # 0x86d8
xorl %eax, %eax
cmpb $0x3a, (%rbx)
setne %al
leal (%rax,%rax,4), %r13d
addl $0x3a, %r13d
jmp 0x3da2
movq 0x41b4(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
leaq 0x217c(%rip), %rsi      # 0x5fca
movl %ebx, %edx
xorl %eax, %eax
callq 0x11b0
jmp 0x3df4
callq 0x146d
jmp 0x3e1e