// File: /workspace/github_c_makefile_star2_O3/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 %rcx, %r14
movq %rdx, %r12
movq %rsi, %rbx
movl %edi, %ebp
movl 0x746c(%rip), %r13d     # 0xe818
testl %r13d, %r13d
je 0x7408
movslq 0x745c(%rip), %r15      # 0xe814
movl 0x7452(%rip), %eax      # 0xe810
movq $0x0, 0x7457(%rip) # 0xe820
testq %r15, %r15
je 0x756e
testl %eax, %eax
jne 0x756e
movq %r8, 0x8(%rsp)
movq (%rbx,%r15,8), %r13
cmpb $0x2d, (%r13)
jne 0x73f3
movzbl 0x1(%r13), %eax
testl %eax, %eax
jne 0x7439
movl 0x741f(%rip), %edx      # 0xe818
decl %edx
movq %rbx, %rdi
movl %r15d, %esi
callq 0x794a
jmp 0x73df
movl $0x1, 0x7406(%rip)      # 0xe818
xorl %r15d, %r15d
movl %r15d, 0x73f8(%rip)     # 0xe814
movl %r15d, 0x73ed(%rip)     # 0xe810
movq $0x0, 0x73f2(%rip) # 0xe820
movl $0x1, %r13d
jmp 0x756e
cmpl $0x2d, %eax
jne 0x74bb
addq $0x2, %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x7a55
cmpl $-0x1, %eax
je 0x7531
cltq
shlq $0x5, %rax
movl 0x8(%r14,%rax), %eax
testl %eax, %eax
movq 0x8(%rsp), %r8
je 0x7536
cmpl $0x2, %eax
je 0x7536
movq %r14, 0x10(%rsp)
cmpl $0x1, %eax
jne 0x792b
movq %r13, %rdi
movl $0x3d, %esi
callq 0x20f0
movq %rax, %r14
movq %r13, %rdi
callq 0x20e0
movl %r14d, %ecx
subl %r13d, %ecx
testq %r14, %r14
cmoveq %rax, %rcx
movslq %ecx, %rax
cmpb $0x3d, (%r13,%rax)
je 0x752c
leal 0x2(%r15), %r13d
jmp 0x7519
movq %r14, 0x10(%rsp)
leaq 0x1(%r13), %r15
movl $0x1, %r14d
movq %r15, %rdi
movq %r12, %rsi
callq 0x798a
cmpl $0x3, %eax
je 0x74e7
testl %eax, %eax
jne 0x7504
cmpb $0x0, 0x1(%r15)
jne 0x74f1
jmp 0x7525
cmpb $0x0, 0x2(%r15)
je 0x7525
incl %r14d
movslq %r14d, %r14
leaq (%r14,%r13), %r15
incq %r15
incq %r14
cmpb $0x0, (%r15)
jne 0x74ca
xorl %ecx, %ecx
cmpl $0x2, %eax
sete %cl
movl 0x7302(%rip), %eax      # 0xe814
leal (%rcx,%rax), %r13d
incl %r13d
movq 0x10(%rsp), %r14
movq 0x8(%rsp), %r8
jmp 0x753c
movl 0x72e8(%rip), %r15d     # 0xe814
movq 0x10(%rsp), %r14
movq 0x8(%rsp), %r8
incl %r15d
movl %r15d, %r13d
movl %r13d, 0x72d1(%rip)     # 0xe814
movslq 0x72ce(%rip), %rax      # 0xe818
movq (%rbx,%rax,8), %rcx
testq %rcx, %rcx
je 0x7568
cmpb $0x2d, (%rcx)
jne 0x7568
cmpb $0x2d, 0x1(%rcx)
jne 0x7568
cmpb $0x0, 0x2(%rcx)
je 0x7735
movl %r13d, %r15d
movl %eax, %r13d
cmpl %ebp, %r13d
jge 0x7667
movl 0x7293(%rip), %eax      # 0xe810
movslq %r13d, %rcx
movq (%rbx,%rcx,8), %rbp
testl %eax, %eax
je 0x75fc
movslq %eax, %r14
cmpb $0x0, (%rbp,%r14)
je 0x790c
addq %rbp, %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x798a
cmpl $0x3, %eax
ja 0x76e6
movl %eax, %eax
leaq 0x2341(%rip), %rcx      # 0x98f8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq $0x0, 0x7255(%rip) # 0xe820
movslq 0x723e(%rip), %rax      # 0xe810
leaq 0x1(%rax), %rcx
movl %ecx, 0x7234(%rip)      # 0xe810
cmpb $0x0, 0x1(%rbp,%rax)
jne 0x7722
incl 0x722b(%rip)            # 0xe818
movl $0x0, 0x7219(%rip)      # 0xe810
jmp 0x7722
leaq 0x8(%rbx), %rax
movabsq $0x100000000, %rcx      # imm = 0x100000000
cmpb $0x2d, (%rbp)
jne 0x761c
movzbl 0x1(%rbp), %edx
testl %edx, %edx
jne 0x7782
testl %r15d, %r15d
jne 0x762b
movl %r13d, 0x71ec(%rip)     # 0xe814
movl %r13d, %r15d
movslq %r13d, %rdx
leaq (%rax,%rdx,8), %rsi
shlq $0x20, %rdx
cmpb $0x2d, (%rbp)
jne 0x7642
cmpb $0x0, 0x1(%rbp)
jne 0x7656
movq (%rsi), %rbp
addq %rcx, %rdx
incl %r13d
addq $0x8, %rsi
testq %rbp, %rbp
jne 0x7636
jmp 0x7667
movl %r13d, 0x71bb(%rip)     # 0xe818
sarq $0x1d, %rdx
movq (%rbx,%rdx), %rbp
jmp 0x760a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %r15d, %r15d
je 0x7726
movl %r15d, 0x719c(%rip)     # 0xe818
movl $0x0, 0x718e(%rip)      # 0xe814
jmp 0x7726
movslq 0x7186(%rip), %rax      # 0xe818
movl $0x0, 0x7174(%rip)      # 0xe810
leal 0x2(%rax), %ecx
movl %ecx, 0x7173(%rip)      # 0xe818
movq 0x8(%rbx,%rax,8), %rax
jmp 0x76dd
leaq 0x1(%r14), %rax
movq %rax, 0x7169(%rip)      # 0xe820
cmpb $0x0, 0x2(%r14)
je 0x7714
movl 0x714c(%rip), %eax      # 0xe810
addl $0x2, %eax
jmp 0x771c
incl 0x7149(%rip)            # 0xe818
movl $0x0, 0x7137(%rip)      # 0xe810
leaq 0x1(%r14), %rax
movq %rax, 0x713c(%rip)      # 0xe820
jmp 0x7722
cmpl $0x0, 0x713b(%rip)      # 0xe828
jne 0x782d
incl 0x711f(%rip)            # 0xe818
movl $0x0, 0x710d(%rip)      # 0xe810
movsbl (%r14), %eax
movl %eax, 0x711f(%rip)      # 0xe82c
movl $0x3f, %eax
jmp 0x7726
incl 0x70fe(%rip)            # 0xe818
xorl %eax, %eax
movl %eax, 0x70ee(%rip)      # 0xe810
movsbl (%r14), %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, 0x10(%rsp)
movslq %r13d, %r14
movq (%rbx,%r14,8), %rax
cmpb $0x2d, (%rax)
jne 0x774c
cmpb $0x0, 0x1(%rax)
jne 0x775f
movl 0x70c6(%rip), %edx      # 0xe818
movq %rbx, %rdi
movl %r13d, %esi
callq 0x794a
jmp 0x773d
movl %r13d, 0x70b2(%rip)     # 0xe818
movl $0x0, 0x70a4(%rip)      # 0xe814
xorl %r15d, %r15d
movq 0x10(%rsp), %r14
movq 0x8(%rsp), %r8
jmp 0x756e
cmpl $0x2d, %edx
jne 0x7819
cmpb $0x0, 0x2(%rbp)
je 0x7851
movq %r8, 0x8(%rsp)
addq $0x2, %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x7a55
cmpl $-0x1, %eax
je 0x7865
movl %eax, %r15d
movq %rbp, %rdi
callq 0x20e0
movq %r14, %r12
movq %rax, %r14
movq %rbp, %rdi
movl $0x3d, %esi
callq 0x20f0
movq %rax, %rcx
subq %rbp, %rcx
testq %rax, %rax
cmoveq %r14, %rcx
movq %r12, %rsi
movslq %r15d, %rax
shlq $0x5, %rax
movl 0x8(%r12,%rax), %edx
cmpl $0x2, %edx
je 0x787e
cmpl $0x1, %edx
movq 0x8(%rsp), %rdx
jne 0x789d
movslq %ecx, %rcx
cmpb $0x3d, (%rbp,%rcx)
jne 0x78c2
addq %rcx, %rbp
incq %rbp
jmp 0x7896
movl $0x1, 0x6fed(%rip)      # 0xe810
movl $0x1, %eax
jmp 0x7588
movq 0x57c4(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movq (%rbx), %rdx
movsbl (%r14), %ecx
leaq 0x2117(%rip), %rsi      # 0x995c
xorl %eax, %eax
callq 0x2180
jmp 0x76f3
incl %r13d
movl %r13d, 0x6fbd(%rip)     # 0xe818
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x7726
incl %r13d
movl %r13d, 0x6fa9(%rip)     # 0xe818
movl $0x0, 0x6fb3(%rip)      # 0xe82c
jmp 0x770d
movslq %ecx, %rcx
addq %rbp, %rcx
incq %rcx
xorl %ebp, %ebp
cmpb $0x3d, -0x1(%rcx)
cmoveq %rcx, %rbp
movq 0x8(%rsp), %rdx
movq %rbp, 0x6f83(%rip)      # 0xe820
movl %r15d, (%rdx)
incl 0x6f72(%rip)            # 0xe818
addq %rax, %rsi
movq 0x10(%rsi), %rcx
movl 0x18(%rsi), %eax
testq %rcx, %rcx
je 0x7726
movl %eax, (%rcx)
xorl %eax, %eax
jmp 0x7726
leal 0x1(%r13), %ecx
movl %ecx, 0x6f4c(%rip)      # 0xe818
movslq %r13d, %rcx
movq 0x8(%rbx,%rcx,8), %rcx
movq %rcx, 0x6f45(%rip)      # 0xe820
testq %rcx, %rcx
jne 0x789d
cmpl $0x0, 0x6f41(%rip)      # 0xe828
je 0x786f
movq 0x5708(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movq (%rbx), %rdx
leaq 0x2079(%rip), %rsi      # 0x9976
movq %rbp, %rcx
xorl %eax, %eax
callq 0x2180
jmp 0x786f
leaq 0x1ff5(%rip), %rdi      # 0x9908
leaq 0x1ff0(%rip), %rsi      # 0x990a
leaq 0x1ff7(%rip), %rcx      # 0x9918
movl $0x143, %edx            # imm = 0x143
callq 0x2120
leaq 0x1fd6(%rip), %rdi      # 0x9908
leaq 0x1fd1(%rip), %rsi      # 0x990a
leaq 0x205e(%rip), %rcx      # 0x999e
movl $0xe4, %edx
callq 0x2120