// File: /workspace/github_c_makefile_star2_O1/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 $0x48, %rsp
movl %r8d, %r12d
movq %rcx, -0x60(%rbp)
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, -0x58(%rbp)
movq 0x4781(%rip), %r14      # 0x96f8
movl 0x4767(%rip), %eax      # 0x96e4
movq %rax, -0x50(%rbp)
incl %eax
movl %eax, 0x475b(%rip)      # 0x96e4
movq %r14, %rdi
movl $0x3d, %esi
callq 0x2100
testq %rax, %rax
je 0x4fa6
movq %rax, %r13
subq %r14, %r13
incq %rax
jmp 0x4fb3
movq %r14, %rdi
callq 0x20e0
movq %rax, %r13
xorl %eax, %eax
movq %rax, -0x70(%rbp)
movq %r14, -0x38(%rbp)
movq %rbx, -0x40(%rbp)
movq (%r15), %rbx
testq %rbx, %rbx
movq %r15, -0x68(%rbp)
movl %r12d, -0x44(%rbp)
je 0x5032
testl %r12d, %r12d
setne %al
cmpq $0x1, %r13
sete %cl
andb %al, %cl
movb %cl, -0x29(%rbp)
leaq 0x20(%r15), %r14
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
xorl %r15d, %r15d
movq -0x38(%rbp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x2080
testl %eax, %eax
jne 0x5021
movq %rbx, %rdi
callq 0x20e0
cmpq %r13, %rax
je 0x503a
cmpb $0x0, -0x29(%rbp)
jne 0x5021
cmpl $-0x1, %r12d
movl %r15d, %r12d
jne 0x5188
movq (%r14), %rbx
incl %r15d
addq $0x20, %r14
testq %rbx, %rbx
jne 0x4fee
jmp 0x503d
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0x503d
movl %r15d, %r12d
cmpl $-0x1, %r12d
je 0x509a
movslq %r12d, %rax
shlq $0x5, %rax
movq -0x68(%rbp), %rcx
leaq (%rcx,%rax), %rbx
movl 0x8(%rcx,%rax), %eax
testl %eax, %eax
sete %cl
movq -0x70(%rbp), %rsi
testq %rsi, %rsi
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x50c0
cmpl $0x0, 0x466d(%rip)      # 0x96e0
movq -0x40(%rbp), %r14
je 0x5083
cmpb $0x3a, (%r14)
jne 0x51b8
xorl %eax, %eax
cmpq $0x0, 0x10(%rbx)
jne 0x508f
movl 0x18(%rbx), %eax
movl %eax, 0x4653(%rip)      # 0x96e8
jmp 0x5131
cmpl $0x0, -0x44(%rbp)
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rdx
je 0x5160
movq -0x50(%rbp), %rax
movl %eax, 0x462e(%rip)      # 0x96e4
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x51a9
leal -0x1(%rax), %ecx
cmpl $0x1, %ecx
ja 0x50f2
testq %rsi, %rsi
jne 0x50eb
cmpl $0x1, %eax
jne 0x50f2
movq -0x50(%rbp), %rcx
movslq %ecx, %rax
addl $0x2, %ecx
movl %ecx, 0x4602(%rip)      # 0x96e4
movq -0x58(%rbp), %rcx
movq 0x8(%rcx,%rax,8), %rsi
movq %rsi, 0x4626(%rip)      # 0x9718
cmpl $0x1, 0x8(%rbx)
jne 0x5142
cmpq $0x0, 0x4618(%rip)      # 0x9718
jne 0x5142
cmpl $0x0, 0x45d7(%rip)      # 0x96e0
movq -0x40(%rbp), %r14
je 0x5119
cmpb $0x3a, (%r14)
jne 0x51dc
xorl %eax, %eax
cmpq $0x0, 0x10(%rbx)
jne 0x5125
movl 0x18(%rbx), %eax
movl %eax, 0x45bd(%rip)      # 0x96e8
decl 0x45b3(%rip)            # 0x96e4
xorl %eax, %eax
cmpb $0x3a, (%r14)
setne %al
leal (%rax,%rax,4), %eax
addl $0x3a, %eax
jmp 0x51a9
movq -0x60(%rbp), %rax
testq %rax, %rax
je 0x514e
movl %r12d, (%rax)
movq 0x10(%rbx), %rcx
movl 0x18(%rbx), %eax
testq %rcx, %rcx
je 0x51a9
movl %eax, (%rcx)
xorl %eax, %eax
jmp 0x51a9
cmpl $0x0, 0x4579(%rip)      # 0x96e0
je 0x519a
cmpb $0x3a, (%rax)
je 0x519a
movq 0x3e83(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leaq 0x1e22(%rip), %rsi      # 0x6fa1
xorl %eax, %eax
callq 0x21c0
jmp 0x519a
cmpl $0x0, 0x4551(%rip)      # 0x96e0
je 0x519a
movq -0x40(%rbp), %rax
cmpb $0x3a, (%rax)
jne 0x51fd
movl $0x0, 0x4544(%rip)      # 0x96e8
movl $0x3f, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3e39(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leaq 0x1d8c(%rip), %rsi      # 0x6f55
movl %r13d, %edx
movq -0x38(%rbp), %rcx
xorl %eax, %eax
callq 0x21c0
jmp 0x5083
movq 0x3e15(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leaq 0x1d91(%rip), %rsi      # 0x6f7e
movq -0x38(%rbp), %rdx
xorl %eax, %eax
callq 0x21c0
jmp 0x5119
movq 0x3df4(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leaq 0x1d2d(%rip), %rsi      # 0x6f3b
movl %r13d, %edx
movq -0x38(%rbp), %rcx
xorl %eax, %eax
callq 0x21c0
jmp 0x519a
nopl (%rax)