// File: /workspace/github_c_makefile_star2_O1/sheneman[P]clearcut/getopt_long.c
// Function: getopt_long
int
getopt_long(int argc, char **argv,
            const char *shortopts,
            struct option *longopts,
            int *indexptr)
{
    char *opt;
    int i;
    static int shortoptind;
    static int no_optind = 0;
    
    if (optind == 0) {            /* skip first argument (command name) */
        optind++;
        no_optind = 0;
        shortoptind = 0;
    }

    optarg = 0;

    if (no_optind && !shortoptind) {
        while (!is_option(argv[no_optind]))
            insert_argv(argv, no_optind, optind-1);

        if (has_argument(argv[no_optind], shortopts, longopts) == 2)
            no_optind += 2;
        else
            no_optind++;

        if (argv[optind] && strcmp(argv[optind], "--") == 0) {
            while (!is_option(argv[no_optind]))
                insert_argv(argv, no_optind, optind);
            optind = no_optind;
            no_optind = 0;
        }
    }

    if (optind >= argc)
        goto end_of_option;

 retry:
    /*
    puts_argv(&argv[optind]);
    */
    opt = argv[optind];

    if (shortoptind == 0 && is_option(opt) == 1) {
        shortoptind++;
    }

    if (shortoptind) {
        /* short option */
        char *p = &opt[shortoptind];

        if (*p == '\0')
            assert(0);

        switch (has_argument_short(p, shortopts)) {
        case 0:
            /* no argument */
            optarg = 0;

            shortoptind++;
            if (opt[shortoptind] == '\0')
                optind++, shortoptind = 0;
            return *p;
        case 1:
            /* following character is argument */
            optind++, shortoptind = 0;
            optarg = &p[1];
            return *p;
        case 2:
            /* next argv is argument */
            optind++, shortoptind = 0;
            optarg = argv[optind++];
            return *p;
        case 3:
            /* has 1 byte argument */
            optarg = &p[1];
            if (p[2] == 0)
                optind++, shortoptind = 0;
            else
                shortoptind += 2;
            return *p;
        default:
            /* Invalid option */
            if (opterr)
                fprintf(stderr,
                        "%s: invalid option -- %c\n",
                        argv[0],
                        *p);

            optind++, shortoptind = 0;
            optopt = *p;
            return '?';
        }
    }
    else if (opt[0] == '-' && opt[1] == '-') {
        /* long option */

        if (opt[2] == '\0') {
            /* end of command line switch */
            optind++;
            return -1;
        }

        opt += 2;

        i = search_longopt(opt, longopts);
        if (i == -1) {
            optind++;
            optopt = 0;
            return '?';
        }
        else {
            int len = strlen(opt);
            char *p = strchr(opt, '=');
            if (p) {
                len = p - opt;
            }

            switch (longopts[i].has_arg) {
            case no_argument:
                break;
            case required_argument:
                if (opt[len] == '=')
                    optarg = opt + len + 1;
                else {
                    optind++;
                    optarg = argv[optind];
                    if (optarg == 0) {
                        if (opterr)
                            fprintf(stderr,
                                    "%s: option `--%s' requires an argument\n",
                                    argv[0],
                                    opt);

                        optopt = 0;
                        return '?'; /* no argument */
                    }
                }
                break;
            case optional_argument:
                if (opt[len] == '=')
                    optarg = opt + len + 1;
                else {
                    optarg = 0;
                }
                break;
            default:
                break;
            }

            *indexptr = i;
            optind++;
            if (longopts[i].flag) {
                *longopts[i].flag = longopts[i].val;
                return 0;
            }
            else {
                return longopts[i].val;
            }
        }

        optind++;
        optopt = 0;
        return '?';
    }

    /* not option */
    if (no_optind == 0)
        no_optind = optind;

    for (i = optind; argv[i]; i++) {
        if (is_option(argv[i])) {
            optind = i;
            goto retry;
        }
    }

 end_of_option:
    if (no_optind) {
        optind = no_optind;
        no_optind = 0;
    }

    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, 0x10(%rsp)
movq %rcx, %r12
movq %rdx, (%rsp)
movq %rsi, %rbx
movl %edi, %ebp
cmpl $0x0, 0x76c6(%rip)      # 0xe818
jne 0x716c
movl $0x1, 0x76ba(%rip)      # 0xe818
xorl %eax, %eax
movl %eax, 0x76ae(%rip)      # 0xe814
movl %eax, 0x76a4(%rip)      # 0xe810
movq $0x0, 0x76a9(%rip) # 0xe820
movslq 0x7696(%rip), %r14      # 0xe814
testq %r14, %r14
je 0x7351
cmpl $0x0, 0x7682(%rip)      # 0xe810
je 0x71a8
jmp 0x7351
movl 0x767d(%rip), %edx      # 0xe818
decl %edx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x76f2
movq (%rbx,%r14,8), %r13
movb (%r13), %cl
cmpb $0x2d, %cl
jne 0x7195
cmpb $0x0, 0x1(%r13)
je 0x7195
xorl %eax, %eax
cmpb $0x2d, %cl
jne 0x71d8
movb 0x1(%r13), %cl
xorl %edx, %edx
cmpb $0x2d, %cl
sete %dl
incl %edx
xorl %eax, %eax
testb %cl, %cl
cmovnel %edx, %eax
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testl %eax, %eax
movq %r12, 0x8(%rsp)
je 0x72dd
cmpl $0x2, %eax
jne 0x726f
addq $0x2, %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x77ea
cmpl $-0x1, %eax
je 0x72dd
movl %eax, %r14d
movq %r13, %rdi
callq 0x20e0
movq %rax, %r15
movq %r13, %rdi
movl $0x3d, %esi
callq 0x20f0
movq %rax, %rcx
subq %r13, %rcx
testq %rax, %rax
cmoveq %r15, %rcx
movslq %r14d, %rax
shlq $0x5, %rax
movq 0x8(%rsp), %rdx
movl 0x8(%rdx,%rax), %r15d
testl %r15d, %r15d
je 0x72dd
cmpl $0x2, %r15d
je 0x72c5
cmpl $0x1, %r15d
jne 0x76b4
movslq %ecx, %rax
xorl %r15d, %r15d
cmpb $0x3d, (%r13,%rax)
setne %r15b
incl %r15d
jmp 0x72dd
cmpb $0x0, 0x1(%r13)
je 0x72dd
leaq 0x1(%r13), %r14
movl $0x1, %r12d
movq %r14, %rdi
movq (%rsp), %rsi
callq 0x7732
movl %eax, %r15d
cmpl $0x3, %eax
je 0x72a6
testl %r15d, %r15d
jne 0x72dd
cmpb $0x0, 0x1(%r14)
jne 0x72b0
cmpl $0x3, %r15d
jne 0x72dd
cmpb $0x0, 0x2(%r14)
je 0x72d7
incl %r12d
movslq %r12d, %r12
leaq (%r12,%r13), %r14
incq %r14
incq %r12
cmpb $0x0, (%r14)
jne 0x7280
jmp 0x72dd
movslq %ecx, %rax
xorl %r15d, %r15d
cmpb $0x3d, (%r13,%rax)
sete %r15b
jmp 0x72dd
movl $0x3, %r15d
xorl %eax, %eax
cmpl $0x2, %r15d
sete %al
movslq 0x7527(%rip), %rcx      # 0xe814
leaq 0x1(%rax,%rcx), %r15
movl %r15d, 0x751b(%rip)     # 0xe814
movslq 0x7518(%rip), %rax      # 0xe818
movq (%rbx,%rax,8), %rdi
testq %rdi, %rdi
movq 0x8(%rsp), %r12
je 0x7351
leaq 0x25c3(%rip), %rsi      # 0x98d8
callq 0x2170
testl %eax, %eax
jne 0x7351
jmp 0x7331
movl 0x74f2(%rip), %edx      # 0xe818
movq %rbx, %rdi
movl %r15d, %esi
callq 0x76f2
movq (%rbx,%r15,8), %rax
cmpb $0x2d, (%rax)
jne 0x7320
cmpb $0x0, 0x1(%rax)
je 0x7320
movl %r15d, 0x74d1(%rip)     # 0xe818
movl $0x0, 0x74c3(%rip)      # 0xe814
cmpl %ebp, 0x74c1(%rip)      # 0xe818
jge 0x7400
movl 0x74b4(%rip), %r15d     # 0xe818
movl 0x74a6(%rip), %eax      # 0xe810
movl 0x74a4(%rip), %edx      # 0xe814
leaq 0x8(%rbx), %rcx
movslq %r15d, %rbp
movq (%rbx,%rbp,8), %r13
testl %eax, %eax
jne 0x73a3
cmpb $0x2d, (%r13)
jne 0x73a3
movzbl 0x1(%r13), %esi
testl %esi, %esi
je 0x73a3
cmpl $0x2d, %esi
je 0x73a3
movl $0x1, 0x7472(%rip)      # 0xe810
movl $0x1, %eax
testl %eax, %eax
jne 0x742e
cmpb $0x2d, (%r13)
jne 0x73bd
cmpb $0x2d, 0x1(%r13)
je 0x74a4
testl %edx, %edx
jne 0x73cb
movl %r15d, 0x744c(%rip)     # 0xe814
movl %r15d, %edx
movq (%rbx,%rbp,8), %rsi
testq %rsi, %rsi
je 0x7400
leaq (%rcx,%rbp,8), %rdi
cmpb $0x2d, (%rsi)
jne 0x73e3
cmpb $0x0, 0x1(%rsi)
jne 0x73f4
movq (%rdi), %rsi
incl %r15d
addq $0x8, %rdi
testq %rsi, %rsi
jne 0x73d8
jmp 0x7400
movl %r15d, 0x741d(%rip)     # 0xe818
jmp 0x7374
movl 0x740e(%rip), %ecx      # 0xe814
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
je 0x741f
movl %ecx, 0x7403(%rip)      # 0xe818
movl $0x0, 0x73f5(%rip)      # 0xe814
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movslq %eax, %r14
cmpb $0x0, (%r13,%r14)
je 0x76d3
addq %r13, %r14
movq %r14, %rdi
movq (%rsp), %rsi
callq 0x7732
cmpl $0x3, %eax
ja 0x758e
movl %eax, %eax
leaq 0x246a(%rip), %rcx      # 0x98c8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq $0x0, 0x73ae(%rip) # 0xe820
movslq 0x7397(%rip), %rax      # 0xe810
leaq 0x1(%rax), %rcx
movl %ecx, 0x738d(%rip)      # 0xe810
cmpb $0x0, 0x1(%r13,%rax)
jne 0x75f7
incl 0x7383(%rip)            # 0xe818
movl $0x0, 0x7371(%rip)      # 0xe810
jmp 0x75f7
cmpb $0x0, 0x2(%r13)
je 0x75b7
addq $0x2, %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x77ea
cmpl $-0x1, %eax
je 0x75cb
movl %eax, %r14d
movq %r13, %rdi
callq 0x20e0
movq %rax, (%rsp)
movq %r13, %rdi
movl $0x3d, %esi
callq 0x20f0
movq %rax, %rcx
subq %r13, %rcx
testq %rax, %rax
cmoveq (%rsp), %rcx
movslq %r14d, %rax
shlq $0x5, %rax
movq %r12, %rsi
movl 0x8(%r12,%rax), %edx
cmpl $0x2, %edx
je 0x7600
cmpl $0x1, %edx
jne 0x761b
movslq %ecx, %rcx
cmpb $0x3d, (%r13,%rcx)
jne 0x7645
addq %rcx, %r13
incq %r13
jmp 0x7614
movslq 0x72e5(%rip), %rax      # 0xe818
movl $0x0, 0x72d3(%rip)      # 0xe810
leal 0x2(%rax), %ecx
movl %ecx, 0x72d2(%rip)      # 0xe818
movq 0x8(%rbx,%rax,8), %rax
jmp 0x7585
leaq 0x1(%r14), %rax
movq %rax, 0x72c8(%rip)      # 0xe820
cmpb $0x0, 0x2(%r14)
je 0x75e9
movl 0x72a7(%rip), %eax      # 0xe810
addl $0x2, %eax
jmp 0x75f1
incl 0x72a1(%rip)            # 0xe818
movl $0x0, 0x728f(%rip)      # 0xe810
leaq 0x1(%r14), %rax
movq %rax, 0x7294(%rip)      # 0xe820
jmp 0x75f7
cmpl $0x0, 0x7293(%rip)      # 0xe828
jne 0x7690
incl 0x7277(%rip)            # 0xe818
movl $0x0, 0x7265(%rip)      # 0xe810
movsbl (%r14), %eax
movl %eax, 0x7277(%rip)      # 0xe82c
jmp 0x75df
incl %r15d
movl %r15d, 0x7257(%rip)     # 0xe818
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x741f
incl %r15d
movl %r15d, 0x7243(%rip)     # 0xe818
movl $0x0, 0x724d(%rip)      # 0xe82c
movl $0x3f, %eax
jmp 0x741f
incl 0x7229(%rip)            # 0xe818
xorl %eax, %eax
movl %eax, 0x7219(%rip)      # 0xe810
movsbl (%r14), %eax
jmp 0x741f
movslq %ecx, %rcx
addq %r13, %rcx
incq %rcx
xorl %r13d, %r13d
cmpb $0x3d, -0x1(%rcx)
cmoveq %rcx, %r13
movq %r13, 0x7205(%rip)      # 0xe820
movq 0x10(%rsp), %rcx
movl %r14d, (%rcx)
incl 0x71ef(%rip)            # 0xe818
addq %rax, %rsi
movq 0x10(%rsi), %rcx
movl 0x18(%rsi), %eax
testq %rcx, %rcx
je 0x741f
movl %eax, (%rcx)
xorl %eax, %eax
jmp 0x741f
incl %r15d
movl %r15d, 0x71c9(%rip)     # 0xe818
movq 0x8(%rbx,%rbp,8), %rcx
movq %rcx, 0x71c5(%rip)      # 0xe820
testq %rcx, %rcx
jne 0x761b
cmpl $0x0, 0x71c1(%rip)      # 0xe828
je 0x75d5
movq 0x5984(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movq (%rbx), %rdx
leaq 0x22c8(%rip), %rsi      # 0x9949
movq %r13, %rcx
xorl %eax, %eax
callq 0x2180
jmp 0x75d5
movq 0x5961(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movq (%rbx), %rdx
movsbl (%r14), %ecx
leaq 0x2287(%rip), %rsi      # 0x992f
xorl %eax, %eax
callq 0x2180
jmp 0x759b
leaq 0x2220(%rip), %rdi      # 0x98db
leaq 0x221b(%rip), %rsi      # 0x98dd
leaq 0x22a8(%rip), %rcx      # 0x9971
movl $0xe4, %edx
callq 0x2120
leaq 0x2201(%rip), %rdi      # 0x98db
leaq 0x21fc(%rip), %rsi      # 0x98dd
leaq 0x2203(%rip), %rcx      # 0x98eb
movl $0x143, %edx            # imm = 0x143
callq 0x2120