// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
cmpl $0x0, 0x7346(%rip)      # 0x10818
jne 0x94f7
movl 0x733e(%rip), %eax      # 0x10818
addl $0x1, %eax
movl %eax, 0x7335(%rip)      # 0x10818
movl $0x0, 0x7327(%rip)      # 0x10814
movl $0x0, 0x7319(%rip)      # 0x10810
movq $0x0, 0x731e(%rip) # 0x10820
cmpl $0x0, 0x730b(%rip)      # 0x10814
je 0x9620
cmpl $0x0, 0x72fa(%rip)      # 0x10810
jne 0x9620
jmp 0x951e
movq -0x10(%rbp), %rax
movslq 0x72eb(%rip), %rcx      # 0x10814
movq (%rax,%rcx,8), %rdi
callq 0x9b60
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x9540
jmp 0x955a
movq -0x10(%rbp), %rdi
movl 0x72ca(%rip), %esi      # 0x10814
movl 0x72c8(%rip), %edx      # 0x10818
subl $0x1, %edx
callq 0x9bc0
jmp 0x951e
movq -0x10(%rbp), %rax
movslq 0x72af(%rip), %rcx      # 0x10814
movq (%rax,%rcx,8), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x9c80
cmpl $0x2, %eax
jne 0x958c
movl 0x7293(%rip), %eax      # 0x10814
addl $0x2, %eax
movl %eax, 0x728a(%rip)      # 0x10814
jmp 0x959b
movl 0x7282(%rip), %eax      # 0x10814
addl $0x1, %eax
movl %eax, 0x7279(%rip)      # 0x10814
movq -0x10(%rbp), %rax
movslq 0x7272(%rip), %rcx      # 0x10818
cmpq $0x0, (%rax,%rcx,8)
je 0x961e
movq -0x10(%rbp), %rax
movslq 0x7260(%rip), %rcx      # 0x10818
movq (%rax,%rcx,8), %rdi
leaq 0x341d(%rip), %rsi      # 0xc9e0
callq 0x2140
cmpl $0x0, %eax
jne 0x961e
jmp 0x95cf
movq -0x10(%rbp), %rax
movslq 0x723a(%rip), %rcx      # 0x10814
movq (%rax,%rcx,8), %rdi
callq 0x9b60
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x95f1
jmp 0x9608
movq -0x10(%rbp), %rdi
movl 0x7219(%rip), %esi      # 0x10814
movl 0x7217(%rip), %edx      # 0x10818
callq 0x9bc0
jmp 0x95cf
movl 0x7206(%rip), %eax      # 0x10814
movl %eax, 0x7204(%rip)      # 0x10818
movl $0x0, 0x71f6(%rip)      # 0x10814
jmp 0x9620
movl 0x71f2(%rip), %eax      # 0x10818
cmpl -0x8(%rbp), %eax
jl 0x9630
jmp 0x9b22
jmp 0x9632
movq -0x10(%rbp), %rax
movslq 0x71db(%rip), %rcx      # 0x10818
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
cmpl $0x0, 0x71c4(%rip)      # 0x10810
jne 0x966b
movq -0x30(%rbp), %rdi
callq 0x9b60
cmpl $0x1, %eax
jne 0x966b
movl 0x71ae(%rip), %eax      # 0x10810
addl $0x1, %eax
movl %eax, 0x71a5(%rip)      # 0x10810
cmpl $0x0, 0x719e(%rip)      # 0x10810
je 0x9873
movq -0x30(%rbp), %rax
movslq 0x718d(%rip), %rcx      # 0x10810
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x96b5
leaq 0x3346(%rip), %rdi      # 0xc9e3
leaq 0x3341(%rip), %rsi      # 0xc9e5
movl $0x143, %edx            # imm = 0x143
leaq 0x3343(%rip), %rcx      # 0xc9f3
callq 0x2100
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9da0
movl %eax, %ecx
movq %rcx, -0x58(%rbp)
subl $0x3, %eax
ja 0x9812
movq -0x58(%rbp), %rax
leaq 0x32f4(%rip), %rcx      # 0xc9d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq $0x0, 0x7130(%rip) # 0x10820
movl 0x711a(%rip), %eax      # 0x10810
addl $0x1, %eax
movl %eax, 0x7111(%rip)      # 0x10810
movq -0x30(%rbp), %rax
movslq 0x7106(%rip), %rcx      # 0x10810
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x972c
movl 0x70ff(%rip), %eax      # 0x10818
addl $0x1, %eax
movl %eax, 0x70f6(%rip)      # 0x10818
movl $0x0, 0x70e4(%rip)      # 0x10810
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x9b48
movl 0x70d7(%rip), %eax      # 0x10818
addl $0x1, %eax
movl %eax, 0x70ce(%rip)      # 0x10818
movl $0x0, 0x70bc(%rip)      # 0x10810
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, 0x70bd(%rip)      # 0x10820
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x9b48
movl 0x70a0(%rip), %eax      # 0x10818
addl $0x1, %eax
movl %eax, 0x7097(%rip)      # 0x10818
movl $0x0, 0x7085(%rip)      # 0x10810
movq -0x10(%rbp), %rax
movl 0x7083(%rip), %ecx      # 0x10818
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0x7078(%rip)      # 0x10818
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x7072(%rip)      # 0x10820
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x9b48
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, 0x7054(%rip)      # 0x10820
movq -0x40(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x0, %eax
jne 0x97f4
movl 0x7039(%rip), %eax      # 0x10818
addl $0x1, %eax
movl %eax, 0x7030(%rip)      # 0x10818
movl $0x0, 0x701e(%rip)      # 0x10810
jmp 0x9803
movl 0x7016(%rip), %eax      # 0x10810
addl $0x2, %eax
movl %eax, 0x700d(%rip)      # 0x10810
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x9b48
cmpl $0x0, 0x700f(%rip)      # 0x10828
je 0x9841
movq 0x57d6(%rip), %rax      # 0xeff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x40(%rbp), %rax
movsbl (%rax), %ecx
leaq 0x31fd(%rip), %rsi      # 0xca37
movb $0x0, %al
callq 0x2150
movl 0x6fd1(%rip), %eax      # 0x10818
addl $0x1, %eax
movl %eax, 0x6fc8(%rip)      # 0x10818
movl $0x0, 0x6fb6(%rip)      # 0x10810
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
movl %eax, 0x6fc5(%rip)      # 0x1082c
movl $0x3f, -0x4(%rbp)
jmp 0x9b48
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x9ac0
movq -0x30(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2d, %eax
jne 0x9ac0
movq -0x30(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x0, %eax
jne 0x98bc
movl 0x6f71(%rip), %eax      # 0x10818
addl $0x1, %eax
movl %eax, 0x6f68(%rip)      # 0x10818
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9b48
movq -0x30(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x9fc0
movl %eax, -0x34(%rbp)
cmpl $-0x1, -0x34(%rbp)
jne 0x9903
movl 0x6f34(%rip), %eax      # 0x10818
addl $0x1, %eax
movl %eax, 0x6f2b(%rip)      # 0x10818
movl $0x0, 0x6f35(%rip)      # 0x1082c
movl $0x3f, -0x4(%rbp)
jmp 0x9b48
movq -0x30(%rbp), %rdi
callq 0x20c0
movl %eax, -0x44(%rbp)
movq -0x30(%rbp), %rdi
movl $0x3d, %esi
callq 0x20d0
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x9936
movq -0x50(%rbp), %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x44(%rbp)
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x5, %rcx
movl 0x8(%rax,%rcx), %eax
movl %eax, -0x5c(%rbp)
testl %eax, %eax
je 0x996a
jmp 0x994f
movl -0x5c(%rbp), %eax
subl $0x1, %eax
je 0x996f
jmp 0x9959
movl -0x5c(%rbp), %eax
subl $0x2, %eax
je 0x9a0d
jmp 0x9a43
jmp 0x9a45
movq -0x30(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3d, %eax
jne 0x9998
movq -0x30(%rbp), %rax
movslq -0x44(%rbp), %rcx
addq %rcx, %rax
addq $0x1, %rax
movq %rax, 0x6e8a(%rip)      # 0x10820
jmp 0x9a0b
movl 0x6e7a(%rip), %eax      # 0x10818
addl $0x1, %eax
movl %eax, 0x6e71(%rip)      # 0x10818
movq -0x10(%rbp), %rax
movslq 0x6e66(%rip), %rcx      # 0x10818
movq (%rax,%rcx,8), %rax
movq %rax, 0x6e63(%rip)      # 0x10820
cmpq $0x0, 0x6e5b(%rip)      # 0x10820
jne 0x9a09
cmpl $0x0, 0x6e5a(%rip)      # 0x10828
je 0x99f3
movq 0x5621(%rip), %rax      # 0xeff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x30(%rbp), %rcx
leaq 0x3065(%rip), %rsi      # 0xca51
movb $0x0, %al
callq 0x2150
movl $0x0, 0x6e2f(%rip)      # 0x1082c
movl $0x3f, -0x4(%rbp)
jmp 0x9b48
jmp 0x9a0b
jmp 0x9a45
movq -0x30(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3d, %eax
jne 0x9a36
movq -0x30(%rbp), %rax
movslq -0x44(%rbp), %rcx
addq %rcx, %rax
addq $0x1, %rax
movq %rax, 0x6dec(%rip)      # 0x10820
jmp 0x9a41
movq $0x0, 0x6ddf(%rip) # 0x10820
jmp 0x9a45
jmp 0x9a45
movl -0x34(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl 0x6dc4(%rip), %eax      # 0x10818
addl $0x1, %eax
movl %eax, 0x6dbb(%rip)      # 0x10818
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpq $0x0, 0x10(%rax)
je 0x9aa6
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x18(%rax), %ecx
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq 0x10(%rax), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x9b48
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x9b48
jmp 0x9ac2
cmpl $0x0, 0x6d4b(%rip)      # 0x10814
jne 0x9ad7
movl 0x6d47(%rip), %eax      # 0x10818
movl %eax, 0x6d3d(%rip)      # 0x10814
movl 0x6d3b(%rip), %eax      # 0x10818
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x9b20
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x9b60
cmpl $0x0, %eax
je 0x9b13
movl -0x34(%rbp), %eax
movl %eax, 0x6d0a(%rip)      # 0x10818
jmp 0x9632
jmp 0x9b15
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x9ae0
jmp 0x9b22
cmpl $0x0, 0x6ceb(%rip)      # 0x10814
je 0x9b41
movl 0x6ce3(%rip), %eax      # 0x10814
movl %eax, 0x6ce1(%rip)      # 0x10818
movl $0x0, 0x6cd3(%rip)      # 0x10814
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)