// File: halfflat[P]tinyopt/include/tinyopt/tinyopt.h
// Function: to::maybe<int> to::parse<int, to::default_parser<int>, void, void, char const*>(char**&, to::default_parser<int> const&, to::key, char const*)
maybe<V> parse(char**& argp, const P& parser, key k0, Tail... krest) {
    key keys[] = { std::move(k0), std::move(krest)... };

    const char* arg = argp[0];
    if (!arg) return nothing;

    const char* text = nullptr;
    for (const key& k: keys) {
        if (k.label==arg) {
            if (!argp[1]) throw missing_argument(arg);
            text = argp[1];
            argp += 2;
            goto match;
        }
        else if (k.style==key::longfmt) {
            const char* eq = std::strrchr(arg, '=');
            if (eq && !std::strncmp(arg, k.label.c_str(), eq-arg)) {
                text = eq+1;
                argp += 1;
                goto match;
            }
        }
    }
    return nothing;

match:
    if (auto v = parser(text)) return v;
    else throw option_parse_error(arg);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rcx, -0x148(%rbp)
movq %rsi, %rax
movq -0x148(%rbp), %rsi
movq %rdi, -0x140(%rbp)
movq %rdi, %rcx
movq %rcx, -0x138(%rbp)
movq %rdi, -0x8(%rbp)
movq %rax, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %r8, -0x28(%rbp)
leaq -0x80(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq 0x3e690
leaq -0x58(%rbp), %rdi
movq %rdi, -0x88(%rbp)
movq -0x28(%rbp), %rsi
callq 0x38290
jmp 0x53ee7
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq %rax, -0xa0(%rbp)
cmpq $0x0, -0xa0(%rbp)
jne 0x53f79
movq -0x140(%rbp), %rdi
callq 0x1fa00
movl $0x1, -0xa8(%rbp)
jmp 0x54347
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
movq -0x88(%rbp), %rax
leaq -0x80(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x150(%rbp)
je 0x53f74
movq -0x150(%rbp), %rdi
addq $-0x28, %rdi
movq %rdi, -0x158(%rbp)
callq 0x384f0
movq -0x158(%rbp), %rax
leaq -0x80(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x150(%rbp)
jne 0x53f46
jmp 0x543e7
movq $0x0, -0xb0(%rbp)
leaq -0x80(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xb8(%rbp), %rax
addq $0x50, %rax
movq %rax, -0xc8(%rbp)
movq -0xc0(%rbp), %rax
cmpq -0xc8(%rbp), %rax
je 0x541bf
movq -0xc0(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rdi
movq -0xa0(%rbp), %rsi
callq 0x4dd00
testb $0x1, %al
jne 0x53fed
jmp 0x5410e
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, 0x8(%rax)
jne 0x540e9
movb $0x1, -0xf2(%rbp)
movl $0x30, %edi
callq 0x10390
movq %rax, -0x170(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x168(%rbp)
leaq -0xf1(%rbp), %rdi
movq %rdi, -0x160(%rbp)
callq 0x10e10
movq -0x168(%rbp), %rsi
movq -0x160(%rbp), %rdx
leaq -0xf0(%rbp), %rdi
callq 0x1d070
jmp 0x54054
movq -0x170(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x3c580
jmp 0x54069
movq -0x170(%rbp), %rdi
movb $0x0, -0xf2(%rbp)
leaq 0xc069a(%rip), %rsi     # 0x114718
leaq -0x17a15(%rip), %rdx    # 0x3c670
callq 0x10db0
jmp 0x543f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x540c1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x10fc8
leaq -0xf1(%rbp), %rdi
callq 0x10810
testb $0x1, -0xf2(%rbp)
jne 0x540d8
jmp 0x540e4
movq -0x170(%rbp), %rdi
callq 0x10530
jmp 0x5439e
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
jmp 0x541da
movq -0xd0(%rbp), %rax
cmpl $0x1, 0x20(%rax)
jne 0x541a4
movq -0xa0(%rbp), %rdi
movl $0x3d, %esi
callq 0x10870
movq %rax, -0x100(%rbp)
cmpq $0x0, -0x100(%rbp)
je 0x541a2
movq -0xa0(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0xd0(%rbp), %rdi
callq 0x102c0
movq -0x178(%rbp), %rdi
movq %rax, %rsi
movq -0x100(%rbp), %rdx
movq -0xa0(%rbp), %rax
subq %rax, %rdx
callq 0x10370
cmpl $0x0, %eax
jne 0x541a2
movq -0x100(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb0(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
addq $0x8, %rcx
movq %rcx, (%rax)
jmp 0x541da
jmp 0x541a4
jmp 0x541a6
jmp 0x541a8
movq -0xc0(%rbp), %rax
addq $0x28, %rax
movq %rax, -0xc0(%rbp)
jmp 0x53faf
movq -0x140(%rbp), %rdi
callq 0x1fa00
movl $0x1, -0xa8(%rbp)
jmp 0x54347
movq -0x140(%rbp), %rdi
movb $0x0, -0x102(%rbp)
movq -0x18(%rbp), %rsi
movq -0xb0(%rbp), %rdx
callq 0x1f7a0
jmp 0x541fa
movq -0x140(%rbp), %rdi
callq 0x1d690
testb $0x1, %al
jne 0x5420c
jmp 0x54246
movb $0x1, -0x102(%rbp)
movl $0x1, -0xa8(%rbp)
testb $0x1, -0x102(%rbp)
jne 0x54345
jmp 0x54339
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x5439e
movb $0x1, -0x12a(%rbp)
movl $0x30, %edi
callq 0x10390
movq %rax, -0x190(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x188(%rbp)
leaq -0x129(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x10e10
movq -0x188(%rbp), %rsi
movq -0x180(%rbp), %rdx
leaq -0x128(%rbp), %rdi
callq 0x1d070
jmp 0x5429b
movq -0x190(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x3c690
jmp 0x542b0
movq -0x190(%rbp), %rdi
movb $0x0, -0x12a(%rbp)
leaq 0xbffeb(%rip), %rsi     # 0x1142b0
leaq -0x17b4c(%rip), %rdx    # 0x3c780
callq 0x10db0
jmp 0x543f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x54308
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x10fc8
leaq -0x129(%rbp), %rdi
callq 0x10810
testb $0x1, -0x12a(%rbp)
jne 0x5431f
jmp 0x5432b
movq -0x190(%rbp), %rdi
callq 0x10530
movq -0x140(%rbp), %rdi
callq 0x1d710
jmp 0x5439e
movq -0x140(%rbp), %rdi
callq 0x1d710
jmp 0x54347
leaq -0x80(%rbp), %rax
movq %rax, -0x1a0(%rbp)
addq $0x50, %rax
movq %rax, -0x198(%rbp)
movq -0x198(%rbp), %rdi
addq $-0x28, %rdi
movq %rdi, -0x1a8(%rbp)
callq 0x384f0
movq -0x1a0(%rbp), %rcx
movq -0x1a8(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x198(%rbp)
jne 0x5435d
movq -0x138(%rbp), %rax
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
leaq -0x80(%rbp), %rax
movq %rax, -0x1b8(%rbp)
addq $0x50, %rax
movq %rax, -0x1b0(%rbp)
movq -0x1b0(%rbp), %rdi
addq $-0x28, %rdi
movq %rdi, -0x1c0(%rbp)
callq 0x384f0
movq -0x1b8(%rbp), %rcx
movq -0x1c0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x1b0(%rbp)
jne 0x543b4
jmp 0x543e7
movq -0x90(%rbp), %rdi
callq 0x10e00
nopw %cs:(%rax,%rax)
nopl (%rax)