// File: /workspace/github_c_makefile_star2_O1/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 $0x28, %rsp
movq %rsi, -0x30(%rbp)
movl %edi, -0x34(%rbp)
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
testq %rdx, %rdx
je 0x4dba
movq %rdx, %r14
movq %rcx, -0x40(%rbp)
movq %r8, -0x48(%rbp)
cmpl $0x0, 0x4ddd(%rip)      # 0x96e4
jne 0x491a
movl $0x1, %eax
movl %eax, 0x4dfc(%rip)      # 0x9710
movl %eax, 0x4dca(%rip)      # 0x96e4
cmpl $-0x1, 0x4dcb(%rip)     # 0x96ec
sete %al
movl 0x4de6(%rip), %ebx      # 0x9710
testl %ebx, %ebx
setne %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x4956
leaq 0x25ee(%rip), %rdi      # 0x6f2b
movl %r9d, %r15d
callq 0x2030
movl %r15d, %r9d
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
movl %ecx, 0x4d96(%rip)      # 0x96ec
movzbl (%r14), %eax
cmpl $0x2d, %eax
jne 0x4965
orl $0x2, %r9d
jmp 0x497d
movl %r9d, %ecx
andl $-0x2, %ecx
cmpl $0x0, 0x4d7a(%rip)      # 0x96ec
cmovnel %ecx, %r9d
cmpl $0x2b, %eax
cmovel %ecx, %r9d
cmpl $0x2d, %eax
je 0x4987
cmpl $0x2b, %eax
jne 0x498a
incq %r14
movq %r14, -0x50(%rbp)
movq $0x0, 0x4d7f(%rip) # 0x9718
testl %ebx, %ebx
je 0x49ae
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, 0x4d48(%rip)      # 0x96f0
movl %eax, 0x4d46(%rip)      # 0x96f4
movq 0x4d43(%rip), %rax      # 0x96f8
movl 0x4d38(%rip), %r15d     # 0x96f4
movl 0x4d2e(%rip), %ebx      # 0x96f0
leaq 0x1ba8(%rip), %rdx      # 0x6571
movl %r9d, -0x38(%rbp)
cmpl $0x0, 0x4d3c(%rip)      # 0x9710
jne 0x49df
cmpb $0x0, (%rax)
jne 0x4b4b
movl $0x0, 0x4d27(%rip)      # 0x9710
movl 0x4cf4(%rip), %r12d     # 0x96e4
cmpl -0x34(%rbp), %r12d
jge 0x4ac0
movslq %r12d, %rax
movq -0x30(%rbp), %rcx
movq (%rcx,%rax,8), %r14
movq %r14, 0x4cec(%rip)      # 0x96f8
cmpb $0x2d, (%r14)
jne 0x4a41
movb 0x1(%r14), %r13b
testb %r13b, %r13b
jne 0x4b04
movq -0x50(%rbp), %rdi
movl $0x2d, %esi
callq 0x2100
leaq 0x1b3d(%rip), %rdx      # 0x6571
movl -0x38(%rbp), %r9d
testq %rax, %rax
jne 0x4b04
movq %rdx, 0x4cb0(%rip)      # 0x96f8
testb $0x2, %r9b
jne 0x4bbf
testb $0x1, %r9b
je 0x4bdb
cmpl $-0x1, %r15d
je 0x4aa8
cmpl $-0x1, %ebx
je 0x4aa3
movl %r15d, %edi
movl %ebx, %esi
movl %r12d, %edx
movq -0x30(%rbp), %rcx
callq 0x4eb3
leaq 0x1af2(%rip), %rdx      # 0x6571
movl -0x38(%rbp), %r9d
subl %ebx, %r15d
addl 0x4c57(%rip), %r15d     # 0x96e4
movl %r15d, 0x4c60(%rip)     # 0x96f4
movl $0xffffffff, 0x4c52(%rip) # imm = 0xFFFFFFFF
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %r15d, %r12d
jmp 0x4aaf
movl %r12d, 0x4c45(%rip)     # 0x96f4
incl 0x4c2f(%rip)            # 0x96e4
movl %r12d, %r15d
movq %rdx, %rax
jmp 0x49cd
leaq 0x1aaa(%rip), %rax      # 0x6571
movq %rax, 0x4c2a(%rip)      # 0x96f8
movl 0x4c1b(%rip), %r15d     # 0x96f0
movl 0x4c19(%rip), %ebx      # 0x96f4
cmpl $-0x1, %r15d
je 0x4be6
movl %ebx, %edi
movl %r15d, %esi
movl %r12d, %edx
movq -0x30(%rbp), %rcx
callq 0x4eb3
subl %r15d, %ebx
addl 0x4be5(%rip), %ebx      # 0x96e4
jmp 0x4beb
movl 0x4bea(%rip), %ebx      # 0x96f4
cmpl $-0x1, %ebx
je 0x4b1f
cmpl $-0x1, 0x4bda(%rip)     # 0x96f0
jne 0x4b1f
movl %r12d, 0x4bd1(%rip)     # 0x96f0
testb %r13b, %r13b
je 0x4b4b
leaq 0x1(%r14), %rax
movq %rax, 0x4bc9(%rip)      # 0x96f8
cmpb $0x2d, %r13b
jne 0x4b4b
cmpq $0x0, -0x40(%rbp)
je 0x4c0a
cmpb $0x0, 0x2(%r14)
je 0x4c0a
movq -0x40(%rbp), %rbx
testq %rbx, %rbx
movq -0x50(%rbp), %r15
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
je 0x4c8b
movq 0x4b8f(%rip), %rax      # 0x96f8
movslq 0x4b74(%rip), %rcx      # 0x96e4
movq -0x30(%rbp), %rdx
cmpq (%rdx,%rcx,8), %rax
je 0x4c8b
movsbl (%rax), %esi
cmpl $0x2d, %esi
setne %cl
testb $0x4, %r9b
sete %dl
testb %cl, %dl
jne 0x4c8b
xorl %r8d, %r8d
cmpb $0x3a, %sil
je 0x4c5d
movzbl %sil, %ecx
cmpl $0x2d, %ecx
jne 0x4c4b
incq %rax
movq %rax, 0x4b3e(%rip)      # 0x96f8
jmp 0x4c5d
incl %r12d
movl %r12d, 0x4b1b(%rip)     # 0x96e4
movq %r14, 0x4b48(%rip)      # 0x9718
movl $0x1, %r12d
jmp 0x4dba
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0x4dba
cmpl $-0x1, %ebx
je 0x4bf1
movl %ebx, 0x4af3(%rip)      # 0x96e4
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl %r12d, 0x4af2(%rip)     # 0x96f0
movl %r12d, 0x4aef(%rip)     # 0x96f4
jmp 0x4dba
incl %r12d
movl %r12d, 0x4ad0(%rip)     # 0x96e4
leaq 0x1956(%rip), %rax      # 0x6571
movq %rax, 0x4ad6(%rip)      # 0x96f8
movl 0x4ac7(%rip), %r15d     # 0x96f0
cmpl $-0x1, %r15d
je 0x4bf1
movl %ebx, %edi
movl %r15d, %esi
movl %r12d, %edx
movq -0x30(%rbp), %rcx
callq 0x4eb3
subl %r15d, %ebx
addl %ebx, 0x4a9b(%rip)      # 0x96e4
jmp 0x4bf1
movq %r15, %rdi
callq 0x2100
xorl %r8d, %r8d
testq %rax, %rax
setne %r8b
movq -0x30(%rbp), %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq -0x48(%rbp), %rcx
callq 0x4f4e
cmpl $-0x1, %eax
je 0x4c8b
leaq 0x18f5(%rip), %rcx      # 0x6571
movq %rcx, 0x4a75(%rip)      # 0x96f8
movl %eax, %r12d
jmp 0x4dba
movq 0x4a66(%rip), %rax      # 0x96f8
leaq 0x1(%rax), %rbx
movq %rbx, 0x4a5b(%rip)      # 0x96f8
movzbl (%rax), %r14d
movsbl %r14b, %r13d
cmpl $0x3a, %r14d
je 0x4d4a
cmpl $0x2d, %r14d
jne 0x4cbe
cmpb $0x0, (%rbx)
jne 0x4d44
movq %r15, %rdi
movl %r13d, %esi
callq 0x2100
testq %rax, %rax
je 0x4d44
cmpq $0x0, -0x40(%rbp)
sete %cl
cmpb $0x57, %r14b
setne %dl
orb %cl, %dl
jne 0x4d77
cmpb $0x3b, 0x1(%rax)
jne 0x4d77
cmpb $0x0, (%rbx)
movq -0x40(%rbp), %rdx
jne 0x4d21
movslq 0x49e5(%rip), %rax      # 0x96e4
leal 0x1(%rax), %ecx
movl %ecx, 0x49dc(%rip)      # 0x96e4
cmpl -0x34(%rbp), %ecx
jge 0x4e0c
movq -0x30(%rbp), %rcx
movq 0x8(%rcx,%rax,8), %rax
movq %rax, 0x49d7(%rip)      # 0x96f8
movq -0x30(%rbp), %rdi
movq %r15, %rsi
movq -0x48(%rbp), %rcx
xorl %r8d, %r8d
callq 0x4f4e
leaq 0x1836(%rip), %rcx      # 0x6571
movq %rcx, 0x49b6(%rip)      # 0x96f8
jmp 0x4dbd
cmpb $0x2d, %r14b
je 0x4dba
cmpb $0x0, (%rbx)
jne 0x4d55
incl 0x498f(%rip)            # 0x96e4
cmpl $0x0, 0x4984(%rip)      # 0x96e0
je 0x4d68
cmpb $0x3a, (%r15)
jne 0x4dec
movl %r13d, 0x4979(%rip)     # 0x96e8
movl $0x3f, %r12d
jmp 0x4dba
cmpb $0x3a, 0x1(%rax)
jne 0x4d96
movq $0x0, 0x4990(%rip) # 0x9718
cmpb $0x0, (%rbx)
je 0x4d9d
movq %rbx, 0x4984(%rip)      # 0x9718
jmp 0x4da3
cmpb $0x0, (%rbx)
jne 0x4db7
jmp 0x4db1
cmpb $0x3a, 0x2(%rax)
jne 0x4dcc
leaq 0x17c7(%rip), %rax      # 0x6571
movq %rax, 0x4947(%rip)      # 0x96f8
incl 0x492d(%rip)            # 0x96e4
movl %r13d, %r12d
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movslq 0x4911(%rip), %rax      # 0x96e4
leal 0x1(%rax), %ecx
movl %ecx, 0x4908(%rip)      # 0x96e4
cmpl -0x34(%rbp), %ecx
jge 0x4e35
movq -0x30(%rbp), %rcx
movq 0x8(%rcx,%rax,8), %rbx
jmp 0x4d8d
movq 0x4205(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leaq 0x21ba(%rip), %rsi      # 0x6fb7
movl %r13d, %edx
xorl %eax, %eax
callq 0x21c0
jmp 0x4d68
leaq 0x175e(%rip), %rax      # 0x6571
movq %rax, 0x48de(%rip)      # 0x96f8
cmpl $0x0, 0x48bf(%rip)      # 0x96e0
je 0x4e29
cmpb $0x3a, (%r15)
jne 0x4e6f
movl $0x57, 0x48b5(%rip)     # 0x96e8
jmp 0x4e59
leaq 0x1735(%rip), %rax      # 0x6571
movq %rax, 0x48b5(%rip)      # 0x96f8
cmpl $0x0, 0x4896(%rip)      # 0x96e0
je 0x4e52
cmpb $0x3a, (%r15)
jne 0x4e76
movl %r13d, 0x488f(%rip)     # 0x96e8
xorl %eax, %eax
cmpb $0x3a, (%r15)
setne %al
leal (%rax,%rax,4), %r12d
addl $0x3a, %r12d
jmp 0x4dba
callq 0x2451
jmp 0x4e29
movq 0x417b(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leaq 0x2146(%rip), %rsi      # 0x6fcd
movl %r13d, %edx
xorl %eax, %eax
callq 0x21c0
jmp 0x4e52