// File: /workspace/github_c_makefile_star2_O2/alexgirao[P]aimant/bsd-getopt_long.c
// Function: pure_parse_long_options
static int pure_parse_long_options(char * const *nargv, const char *options,
                                   const struct pure_option *long_options,
                                   int *idx, int short_too)
{
    const char *current_argv, *has_equal;
    size_t current_argv_len;
    int i, match;
    
    current_argv = pure_place;
    match = -1;
    
    pure_optind++;
    
    if ((has_equal = strchr(current_argv, '=')) != NULL) {
        /* argument found (--option=arg) */
        current_argv_len = has_equal - current_argv;
        has_equal++;
    } else
        current_argv_len = strlen(current_argv);
    
    for (i = 0; long_options[i].name; i++) {
        /* find matching long option */
        if (strncmp(current_argv, long_options[i].name,
            current_argv_len))
            continue;
        
        if (strlen(long_options[i].name) == current_argv_len) {
            /* exact match */
            match = i;
            break;
        }
        /*
         * If this is a known short option, don't allow
         * a partial match of a single character.
         */
        if (short_too && current_argv_len == 1)
            continue;
        
        if (match == -1)    /* partial match */
            match = i;
        else {
            /* ambiguous abbreviation */
            if (PRINT_ERROR)
                fprintf(stderr, ambig, (int)current_argv_len,
                        current_argv);
            pure_optopt = 0;
            return BADCH;
        }
    }
    if (match != -1) {        /* option found */
        if (long_options[match].has_arg == no_argument
            && has_equal) {
            if (PRINT_ERROR)
                fprintf(stderr, noarg, (int)current_argv_len,
                        current_argv);
            /*
             * XXX: GNU sets pure_optopt to val regardless of flag
             */
            if (long_options[match].flag == NULL)
                pure_optopt = long_options[match].val;
            else
                pure_optopt = 0;
            return BADARG;
        }
        if (long_options[match].has_arg == required_argument ||
            long_options[match].has_arg == optional_argument) {
            if (has_equal)
                pure_optarg = has_equal;
            else if (long_options[match].has_arg ==
                     required_argument) {
                /*
                 * optional argument doesn't use next nargv
                 */
                pure_optarg = nargv[pure_optind++];
            }
        }
        if ((long_options[match].has_arg == required_argument)
            && (pure_optarg == NULL)) {
            /*
             * Missing argument; leading ':' indicates no error
             * should be generated.
             */
            if (PRINT_ERROR)
                fprintf(stderr, recargstring,
                        current_argv);
            /*
             * XXX: GNU sets pure_optopt to val regardless of flag
             */
            if (long_options[match].flag == NULL)
                pure_optopt = long_options[match].val;
            else
                pure_optopt = 0;
            --pure_optind;
            return BADARG;
        }
    } else {            /* unknown option */
        if (short_too) {
            --pure_optind;
            return -1;
        }
        if (PRINT_ERROR)
            fprintf(stderr, illoptstring, current_argv);
        pure_optopt = 0;
        return BADCH;
    }
    if (idx)
        *idx = match;
    if (long_options[match].flag) {
        *long_options[match].flag = long_options[match].val;
        return 0;
    } else
        return long_options[match].val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %r8d, %r15d
movq %rcx, -0x78(%rbp)
movq %rdx, -0x60(%rbp)
movq %rsi, -0x38(%rbp)
movq %rdi, -0x70(%rbp)
movq 0x4964(%rip), %rbx      # 0x86e8
movl 0x4949(%rip), %r14d     # 0x86d4
leal 0x1(%r14), %eax
movl %eax, 0x493f(%rip)      # 0x86d4
pushq $0x3d
popq %rsi
movq %rbx, %rdi
callq 0x1100
testq %rax, %rax
movq %rbx, -0x40(%rbp)
je 0x3db8
movq %rax, %r13
subq %rbx, %r13
incq %rax
movq %rax, -0x50(%rbp)
jmp 0x3dcb
movq %rbx, %rdi
callq 0x10e0
movq %rax, %r13
movq $0x0, -0x50(%rbp)
movq %r14, -0x58(%rbp)
movslq %r14d, %rax
movq %rax, -0x68(%rbp)
movl %r15d, -0x44(%rbp)
testl %r15d, %r15d
setne %al
cmpq $0x1, %r13
sete %cl
andb %al, %cl
movb %cl, -0x29(%rbp)
pushq $-0x1
popq %r15
xorl %r12d, %r12d
movq -0x60(%rbp), %r14
movq (%r14), %rbx
testq %rbx, %rbx
je 0x3e3b
movq -0x40(%rbp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x1080
testl %eax, %eax
jne 0x3e32
movq %rbx, %rdi
callq 0x10e0
cmpq %r13, %rax
je 0x3e5c
cmpb $0x0, -0x29(%rbp)
jne 0x3e32
cmpl $-0x1, %r15d
movl %r12d, %r15d
jne 0x3ed3
incl %r12d
addq $0x20, %r14
jmp 0x3df7
cmpl $-0x1, %r15d
jne 0x3e5f
cmpl $0x0, -0x44(%rbp)
movq -0x58(%rbp), %rax
je 0x3f06
movl %eax, 0x487f(%rip)      # 0x86d4
pushq $-0x1
jmp 0x3f25
movl %r12d, %r15d
movslq %r15d, %rax
shlq $0x5, %rax
movq -0x60(%rbp), %rcx
leaq (%rcx,%rax), %rbx
movl 0x8(%rcx,%rax), %eax
testl %eax, %eax
sete %cl
movq -0x50(%rbp), %rsi
testq %rsi, %rsi
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
movq -0x58(%rbp), %rdx
jne 0x3eb9
cmpl $0x0, 0x483d(%rip)      # 0x86d0
je 0x3ea2
movq -0x38(%rbp), %rax
cmpb $0x3a, (%rax)
jne 0x3fca
xorl %eax, %eax
cmpq $0x0, 0x10(%rbx)
jne 0x3eae
movl 0x18(%rbx), %eax
movl %eax, 0x4824(%rip)      # 0x86d8
jmp 0x3f8b
leal -0x1(%rax), %ecx
cmpl $0x1, %ecx
ja 0x3f52
testq %rsi, %rsi
je 0x3f28
movq %rsi, 0x4837(%rip)      # 0x8708
jmp 0x3f52
cmpl $0x0, 0x47f6(%rip)      # 0x86d0
je 0x3f1c
movq -0x38(%rbp), %rax
cmpb $0x3a, (%rax)
je 0x3f1c
movq 0x410c(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
leaq 0x2042(%rip), %rsi      # 0x5f38
movl %r13d, %edx
movq -0x40(%rbp), %rcx
xorl %eax, %eax
callq 0x11b0
jmp 0x3f1c
cmpl $0x0, 0x47c3(%rip)      # 0x86d0
je 0x3f1c
movq -0x38(%rbp), %rax
cmpb $0x3a, (%rax)
jne 0x400f
andl $0x0, 0x47b5(%rip)      # 0x86d8
pushq $0x3f
popq %rax
jmp 0x3f9d
cmpl $0x1, %eax
jne 0x3f4f
addl $0x2, %edx
movl %edx, 0x479e(%rip)      # 0x86d4
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
movq %rax, 0x47be(%rip)      # 0x8708
movl 0x8(%rbx), %eax
jmp 0x3f52
pushq $0x2
popq %rax
cmpl $0x1, %eax
jne 0x3fac
cmpq $0x0, 0x47a9(%rip)      # 0x8708
jne 0x3fac
cmpl $0x0, 0x4768(%rip)      # 0x86d0
je 0x3f73
movq -0x38(%rbp), %rax
cmpb $0x3a, (%rax)
jne 0x3fee
xorl %eax, %eax
cmpq $0x0, 0x10(%rbx)
jne 0x3f7f
movl 0x18(%rbx), %eax
movl %eax, 0x4753(%rip)      # 0x86d8
decl 0x4749(%rip)            # 0x86d4
xorl %eax, %eax
movq -0x38(%rbp), %rcx
cmpb $0x3a, (%rcx)
setne %al
leal (%rax,%rax,4), %eax
addl $0x3a, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x78(%rbp), %rax
testq %rax, %rax
je 0x3fb8
movl %r15d, (%rax)
movq 0x10(%rbx), %rcx
movl 0x18(%rbx), %eax
testq %rcx, %rcx
je 0x3f9d
movl %eax, (%rcx)
xorl %eax, %eax
jmp 0x3f9d
movq 0x4027(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
leaq 0x1f77(%rip), %rsi      # 0x5f52
movl %r13d, %edx
movq -0x40(%rbp), %rcx
xorl %eax, %eax
callq 0x11b0
jmp 0x3ea2
movq 0x4003(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
leaq 0x1f7c(%rip), %rsi      # 0x5f7b
movq -0x40(%rbp), %rdx
xorl %eax, %eax
callq 0x11b0
jmp 0x3f73
movq 0x3fe2(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
leaq 0x1f7e(%rip), %rsi      # 0x5f9e
movq -0x40(%rbp), %rdx
xorl %eax, %eax
callq 0x11b0
jmp 0x3f1c