// File: /workspace/github_c_makefile_star2_O0/skeeto[P]enchive/src/optparse.h
// Function: optparse_long
OPTPARSE_API
int
optparse_long(struct optparse *options,
              const struct optparse_long *longopts,
              int *longindex)
{
    int i;
    char *option = options->argv[options->optind];
    if (option == 0) {
        return -1;
    } else if (optparse_is_dashdash(option)) {
        options->optind++; /* consume "--" */
        return -1;
    } else if (optparse_is_shortopt(option)) {
        return optparse_long_fallback(options, longopts, longindex);
    } else if (!optparse_is_longopt(option)) {
        if (options->permute) {
            int index = options->optind++;
            int r = optparse_long(options, longopts, longindex);
            optparse_permute(options, index);
            options->optind--;
            return r;
        } else {
            return -1;
        }
    }

    /* Parse as long option. */
    options->errmsg[0] = '\0';
    options->optopt = 0;
    options->optarg = 0;
    option += 2; /* skip "--" */
    options->optind++;
    for (i = 0; !optparse_longopts_end(longopts, i); i++) {
        const char *name = longopts[i].longname;
        if (optparse_longopts_match(name, option)) {
            char *arg;
            if (longindex)
                *longindex = i;
            options->optopt = longopts[i].shortname;
            arg = optparse_longopts_arg(option);
            if (longopts[i].argtype == OPTPARSE_NONE && arg != 0) {
                return optparse_error(options, OPTPARSE_MSG_TOOMANY, name);
            } if (arg != 0) {
                options->optarg = arg;
            } else if (longopts[i].argtype == OPTPARSE_REQUIRED) {
                options->optarg = options->argv[options->optind++];
                if (options->optarg == 0)
                    return optparse_error(options, OPTPARSE_MSG_MISSING, name);
            }
            return options->optopt;
        }
    }
    return optparse_error(options, OPTPARSE_MSG_INVALID, option);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0xc(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x2b5e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2dc0
movq -0x30(%rbp), %rdi
callq 0x27b0
cmpl $0x0, %eax
je 0x2b85
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2dc0
movq -0x30(%rbp), %rdi
callq 0x2810
cmpl $0x0, %eax
je 0x2bac
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x2dd0
movl %eax, -0x4(%rbp)
jmp 0x2dc0
movq -0x30(%rbp), %rdi
callq 0x2ea0
cmpl $0x0, %eax
jne 0x2c1a
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x2c0e
movq -0x10(%rbp), %rcx
movl 0xc(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0xc(%rcx)
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x2b20
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x2870
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0xc(%rax)
movl -0x38(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2dc0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2dc0
jmp 0x2c1c
jmp 0x2c1e
jmp 0x2c20
movq -0x10(%rbp), %rax
movb $0x0, 0x20(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x30(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc(%rax)
movl $0x0, -0x24(%rbp)
movq -0x18(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x2f00
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x2c7c
jmp 0x2da9
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x2f50
cmpl $0x0, %eax
je 0x2d99
cmpq $0x0, -0x20(%rbp)
je 0x2cb8
movl -0x24(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x30(%rbp), %rdi
callq 0x3040
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpl $0x0, 0xc(%rax)
jne 0x2d16
cmpq $0x0, -0x48(%rbp)
je 0x2d16
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rdx
leaq 0x84fb(%rip), %rsi      # 0xb204
callq 0x29c0
movl %eax, -0x4(%rbp)
jmp 0x2dc0
cmpq $0x0, -0x48(%rbp)
je 0x2d2b
movq -0x48(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0x2d8d
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpl $0x1, 0xc(%rax)
jne 0x2d8b
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rdx
movl 0xc(%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0xc(%rdx)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x2d89
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rdx
leaq 0x8469(%rip), %rsi      # 0xb1e8
callq 0x29c0
movl %eax, -0x4(%rbp)
jmp 0x2dc0
jmp 0x2d8b
jmp 0x2d8d
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2dc0
jmp 0x2d9b
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2c5f
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x8421(%rip), %rsi      # 0xb1d9
callq 0x29c0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)