// File: halfflat[P]tinyopt/ex/ex3-run.cc
// Function: main
int main(int argc, char** argv) {
    try {
        auto print_apple = [] { std::cout << "apple!\n"; };
        auto help = [argv0 = argv[0]] { to::usage(argv0, usage_str); };

        to::option opts[] = {
            { to::action(print_apple), to::flag, "-a", "--apple" },
            { to::action(help), to::flag, to::exit, "-h", "--help" },
            { {}, to::flag, to::stop, "--" }
        };

        if (!to::run(opts, argc, argv+1)) return 0;

        std::cout << "remaining arguments:";
        for (auto a = argv+1; *a; ++a) std::cout << ' ' << *a;
        std::cout << "\n";
    }
    catch (to::option_error& e) {
        to::usage_error(argv[0], usage_str, e.what());
        return 1;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x380, %rsp            # imm = 0x380
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movb $0x1, -0x209(%rbp)
leaq -0x170(%rbp), %rax
movq %rax, -0x178(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x2b70
jmp 0x2507
movl $0x1, -0x1b0(%rbp)
leaq 0xbc59(%rip), %rcx      # 0xe171
leaq 0xbc55(%rip), %r8       # 0xe174
leaq -0x170(%rbp), %rdi
leaq -0x198(%rbp), %rsi
leaq -0x1b0(%rbp), %rdx
callq 0x3670
jmp 0x253b
leaq -0x100(%rbp), %rax
movq %rax, -0x2e8(%rbp)
movq %rax, -0x178(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movq -0x1d8(%rbp), %rsi
leaq -0x1d0(%rbp), %rdi
callq 0x2ba0
jmp 0x2570
movq -0x2e8(%rbp), %rdi
movl $0x1, -0x1dc(%rbp)
movl $0x10, -0x1e0(%rbp)
leaq 0xbbea(%rip), %r8       # 0xe17c
leaq 0xbbe6(%rip), %r9       # 0xe17f
leaq -0x1d0(%rbp), %rsi
leaq -0x1dc(%rbp), %rdx
leaq -0x1e0(%rbp), %rcx
callq 0x3740
jmp 0x25b5
leaq -0x90(%rbp), %rax
movq %rax, -0x2f0(%rbp)
movq %rax, -0x178(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x3820
jmp 0x25d8
movq -0x2f0(%rbp), %rdi
movl $0x1, -0x204(%rbp)
movl $0x20, -0x208(%rbp)
leaq 0xbb8c(%rip), %r8       # 0xe186
leaq -0x200(%rbp), %rsi
leaq -0x204(%rbp), %rdx
leaq -0x208(%rbp), %rcx
callq 0x3840
jmp 0x2616
movb $0x0, -0x209(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x3910
leaq -0x1d0(%rbp), %rdi
callq 0x3910
leaq -0x198(%rbp), %rdi
callq 0x3910
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x300(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x250(%rbp)
movq $0x0, -0x240(%rbp)
leaq -0x250(%rbp), %rdi
movq %rdi, -0x2f8(%rbp)
callq 0x3df0
movq -0x300(%rbp), %rcx
movq -0x2f8(%rbp), %r8
leaq -0x230(%rbp), %rdi
leaq -0x170(%rbp), %rsi
leaq -0x8(%rbp), %rdx
callq 0x3980
jmp 0x269f
leaq -0x230(%rbp), %rdi
callq 0x3e10
xorb $-0x1, %al
movb %al, -0x301(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x3e30
leaq -0x250(%rbp), %rdi
callq 0x3e60
movb -0x301(%rbp), %al
testb $0x1, %al
jne 0x26da
jmp 0x27e2
movl $0x0, -0x4(%rbp)
movl $0x1, -0x254(%rbp)
jmp 0x2891
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x2762
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x2756
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x274a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x3910
leaq -0x1d0(%rbp), %rdi
callq 0x3910
leaq -0x198(%rbp), %rdi
callq 0x3910
testb $0x1, -0x209(%rbp)
jne 0x276d
jmp 0x27ba
movq -0x178(%rbp), %rax
leaq -0x170(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x310(%rbp)
je 0x27b8
movq -0x310(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x318(%rbp)
callq 0x3930
movq -0x318(%rbp), %rax
leaq -0x170(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x310(%rbp)
jne 0x2787
jmp 0x27ba
jmp 0x2941
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x3e60
jmp 0x28f3
movq 0x137e7(%rip), %rdi     # 0x15fd0
leaq 0xb999(%rip), %rsi      # 0xe189
callq 0x21c0
jmp 0x27f7
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x260(%rbp)
movq -0x260(%rbp), %rax
cmpq $0x0, (%rax)
je 0x2872
movq 0x137b6(%rip), %rdi     # 0x15fd0
movl $0x20, %esi
callq 0x2250
movq %rax, -0x320(%rbp)
jmp 0x282d
movq -0x320(%rbp), %rdi
movq -0x260(%rbp), %rax
movq (%rax), %rsi
callq 0x21c0
jmp 0x2845
jmp 0x2847
movq -0x260(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x260(%rbp)
jmp 0x2806
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x28f3
movq 0x13757(%rip), %rdi     # 0x15fd0
leaq 0xb956(%rip), %rsi      # 0xe1d6
callq 0x21c0
jmp 0x2887
movl $0x0, -0x254(%rbp)
leaq -0x170(%rbp), %rax
movq %rax, -0x330(%rbp)
addq $0x150, %rax            # imm = 0x150
movq %rax, -0x328(%rbp)
movq -0x328(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x338(%rbp)
callq 0x3930
movq -0x330(%rbp), %rcx
movq -0x338(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x328(%rbp)
jne 0x28ac
movl -0x254(%rbp), %eax
testl %eax, %eax
je 0x28ee
jmp 0x28e9
jmp 0x2b4c
jmp 0x2b4c
leaq -0x170(%rbp), %rax
movq %rax, -0x348(%rbp)
addq $0x150, %rax            # imm = 0x150
movq %rax, -0x340(%rbp)
movq -0x340(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x350(%rbp)
callq 0x3930
movq -0x348(%rbp), %rcx
movq -0x350(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x340(%rbp)
jne 0x290e
jmp 0x2941
movl -0x1ac(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x2b58
movq -0x1a8(%rbp), %rdi
callq 0x2090
movq %rax, -0x268(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x368(%rbp)
movq 0x13854(%rip), %rax     # 0x161d0
movq %rax, -0x360(%rbp)
leaq -0x289(%rbp), %rdi
movq %rdi, -0x358(%rbp)
callq 0x2320
movq -0x360(%rbp), %rsi
movq -0x358(%rbp), %rdx
leaq -0x288(%rbp), %rdi
callq 0x3f60
jmp 0x29b2
movq -0x268(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, -0x378(%rbp)
leaq -0x2b1(%rbp), %rdi
movq %rdi, -0x370(%rbp)
callq 0x2320
movq -0x378(%rbp), %rsi
movq -0x370(%rbp), %rdx
leaq -0x2b0(%rbp), %rdi
callq 0x3f60
jmp 0x29f8
leaq -0x2d9(%rbp), %rdi
movq %rdi, -0x380(%rbp)
callq 0x2320
movq -0x380(%rbp), %rdx
leaq 0xb785(%rip), %rsi      # 0xe19e
leaq -0x2d8(%rbp), %rdi
callq 0x3f60
jmp 0x2a27
movq -0x368(%rbp), %rdi
leaq -0x288(%rbp), %rsi
leaq -0x2b0(%rbp), %rdx
leaq -0x2d8(%rbp), %rcx
callq 0x3e80
jmp 0x2a4a
leaq -0x2d8(%rbp), %rdi
callq 0x2120
leaq -0x2d9(%rbp), %rdi
callq 0x2200
leaq -0x2b0(%rbp), %rdi
callq 0x2120
leaq -0x2b1(%rbp), %rdi
callq 0x2200
leaq -0x288(%rbp), %rdi
callq 0x2120
leaq -0x289(%rbp), %rdi
callq 0x2200
movl $0x1, -0x4(%rbp)
movl $0x1, -0x254(%rbp)
callq 0x22f0
jmp 0x2b4c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x2b37
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x2b1f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
jmp 0x2b07
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
leaq -0x2d8(%rbp), %rdi
callq 0x2120
leaq -0x2d9(%rbp), %rdi
callq 0x2200
leaq -0x2b0(%rbp), %rdi
callq 0x2120
leaq -0x2b1(%rbp), %rdi
callq 0x2200
leaq -0x288(%rbp), %rdi
callq 0x2120
leaq -0x289(%rbp), %rdi
callq 0x2200
callq 0x22f0
jmp 0x2b4a
jmp 0x2b58
movl -0x4(%rbp), %eax
addq $0x380, %rsp            # imm = 0x380
popq %rbp
retq
movq -0x1a8(%rbp), %rdi
callq 0x2310
movq %rax, %rdi
callq 0x4010
nopl (%rax)