// File: halfflat[P]tinyopt/ex/ex1-run.cc
// Function: main
int main(int argc, char** argv) {
    try {
        int n = 1, fn = 0;

        std::pair<const char*, int> functions[] = {
            { "one", 1 }, { "two", 2 }
        };

        auto help = [argv0 = argv[0]] { to::usage(argv0, usage_str); };

        to::option opts[] = {
            { n, "-n", "--number" },
            { {fn, to::keywords(functions)}, "-f", "--function", to::mandatory },
            { to::action(help), to::flag, to::exit, "-h", "--help" }
        };

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

        if (argv[1]) throw to::option_error("unrecognized argument", argv[1]);
        if (n<1) throw to::option_error("N must be at least 1");

        // Do things with arguments:

        for (int i = 0; i<n; ++i) {
            std::cout << "Performing function #" << fn << "\n";
        }
    }
    catch (to::option_error& e) {
        to::usage_error(argv[0], usage_str, e.what());
        return 1;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x490, %rsp            # imm = 0x490
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
leaq 0xdc0a(%rip), %rax      # 0x11168
movq %rax, -0x48(%rbp)
movl $0x1, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x4c(%rbp), %rdx
callq 0x4430
jmp 0x357c
leaq -0x30(%rbp), %rdi
leaq 0xdbe5(%rip), %rax      # 0x1116c
movq %rax, -0x68(%rbp)
movl $0x2, -0x6c(%rbp)
leaq -0x68(%rbp), %rsi
leaq -0x6c(%rbp), %rdx
callq 0x4430
jmp 0x35a1
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x78(%rbp)
movb $0x1, -0x269(%rbp)
leaq -0x1d0(%rbp), %rax
movq %rax, -0x1d8(%rbp)
leaq -0x1f8(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x4460
jmp 0x35d3
leaq 0xdb96(%rip), %rdx      # 0x11170
leaq 0xdb92(%rip), %rcx      # 0x11173
leaq -0x1d0(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x4490
jmp 0x35f6
leaq -0x160(%rbp), %rax
movq %rax, -0x3b8(%rbp)
movq %rax, -0x1d8(%rbp)
leaq -0x230(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x45a0
jmp 0x361d
leaq -0x218(%rbp), %rdi
leaq -0x18(%rbp), %rsi
leaq -0x230(%rbp), %rdx
callq 0x45d0
jmp 0x3636
movq -0x3b8(%rbp), %rdi
movl $0x8, -0x234(%rbp)
leaq 0xdb2e(%rip), %rdx      # 0x1117c
leaq 0xdb2a(%rip), %rcx      # 0x1117f
leaq -0x218(%rbp), %rsi
leaq -0x234(%rbp), %r8
callq 0x4650
jmp 0x366a
leaq -0xf0(%rbp), %rax
movq %rax, -0x3c0(%rbp)
movq %rax, -0x1d8(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x260(%rbp)
movq -0x260(%rbp), %rsi
leaq -0x258(%rbp), %rdi
callq 0x3e30
jmp 0x369f
movq -0x3c0(%rbp), %rdi
movl $0x1, -0x264(%rbp)
movl $0x10, -0x268(%rbp)
leaq 0xdac9(%rip), %r8       # 0x1118a
leaq 0xdac5(%rip), %r9       # 0x1118d
leaq -0x258(%rbp), %rsi
leaq -0x264(%rbp), %rdx
leaq -0x268(%rbp), %rcx
callq 0x4770
jmp 0x36e4
movb $0x0, -0x269(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x4850
leaq -0x218(%rbp), %rdi
callq 0x4850
leaq -0x230(%rbp), %rdi
callq 0x4870
leaq -0x1f8(%rbp), %rdi
callq 0x4850
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x3d0(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x2b0(%rbp)
movq $0x0, -0x2a0(%rbp)
leaq -0x2b0(%rbp), %rdi
movq %rdi, -0x3c8(%rbp)
callq 0x4d50
movq -0x3d0(%rbp), %rcx
movq -0x3c8(%rbp), %r8
leaq -0x290(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
leaq -0x8(%rbp), %rdx
callq 0x48e0
jmp 0x3779
leaq -0x290(%rbp), %rdi
callq 0x4d70
xorb $-0x1, %al
movb %al, -0x3d1(%rbp)
leaq -0x290(%rbp), %rdi
callq 0x4d90
leaq -0x2b0(%rbp), %rdi
callq 0x4dc0
movb -0x3d1(%rbp), %al
testb $0x1, %al
jne 0x37b4
jmp 0x38c9
movl $0x0, -0x4(%rbp)
movl $0x1, -0x2b4(%rbp)
jmp 0x3b76
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3c26
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x384f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3843
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3837
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x382b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x4850
leaq -0x218(%rbp), %rdi
callq 0x4850
leaq -0x230(%rbp), %rdi
callq 0x4870
leaq -0x1f8(%rbp), %rdi
callq 0x4850
testb $0x1, -0x269(%rbp)
jne 0x385a
jmp 0x38a7
movq -0x1d8(%rbp), %rax
leaq -0x1d0(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x3e0(%rbp)
je 0x38a5
movq -0x3e0(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x3e8(%rbp)
callq 0x4890
movq -0x3e8(%rbp), %rax
leaq -0x1d0(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x3e0(%rbp)
jne 0x3874
jmp 0x38a7
jmp 0x3c26
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x2b0(%rbp), %rdi
callq 0x4dc0
jmp 0x3bd8
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x3a13
movb $0x1, -0x302(%rbp)
movl $0x30, %edi
callq 0x3110
movq %rax, -0x3f8(%rbp)
leaq -0x2d9(%rbp), %rdi
movq %rdi, -0x3f0(%rbp)
callq 0x3380
movq -0x3f0(%rbp), %rdx
leaq 0xd883(%rip), %rsi      # 0x11194
leaq -0x2d8(%rbp), %rdi
callq 0x4de0
jmp 0x391f
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x408(%rbp)
leaq -0x301(%rbp), %rdi
movq %rdi, -0x400(%rbp)
callq 0x3380
movq -0x408(%rbp), %rsi
movq -0x400(%rbp), %rdx
leaq -0x300(%rbp), %rdi
callq 0x4de0
jmp 0x395d
movq -0x3f8(%rbp), %rdi
leaq -0x2d8(%rbp), %rsi
leaq -0x300(%rbp), %rdx
callq 0x4e90
jmp 0x3979
movq -0x3f8(%rbp), %rdi
movb $0x0, -0x302(%rbp)
leaq 0x172ea(%rip), %rsi     # 0x1ac78
leaq 0x15cb(%rip), %rdx      # 0x4f60
callq 0x3350
jmp 0x3e30
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x39eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x39d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x300(%rbp), %rdi
callq 0x3160
leaq -0x301(%rbp), %rdi
callq 0x3240
leaq -0x2d8(%rbp), %rdi
callq 0x3160
leaq -0x2d9(%rbp), %rdi
callq 0x3240
testb $0x1, -0x302(%rbp)
jne 0x3a02
jmp 0x3a0e
movq -0x3f8(%rbp), %rdi
callq 0x31a0
jmp 0x3bd8
cmpl $0x1, -0x14(%rbp)
jge 0x3aed
movb $0x1, -0x32a(%rbp)
movl $0x30, %edi
callq 0x3110
movq %rax, -0x418(%rbp)
leaq -0x329(%rbp), %rdi
movq %rdi, -0x410(%rbp)
callq 0x3380
movq -0x410(%rbp), %rdx
leaq 0xd754(%rip), %rsi      # 0x111aa
leaq -0x328(%rbp), %rdi
callq 0x4de0
jmp 0x3a64
movq -0x418(%rbp), %rdi
leaq -0x328(%rbp), %rsi
callq 0x4fa0
jmp 0x3a79
movq -0x418(%rbp), %rdi
movb $0x0, -0x32a(%rbp)
leaq 0x171ea(%rip), %rsi     # 0x1ac78
leaq 0x14cb(%rip), %rdx      # 0x4f60
callq 0x3350
jmp 0x3e30
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3ac5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x328(%rbp), %rdi
callq 0x3160
leaq -0x329(%rbp), %rdi
callq 0x3240
testb $0x1, -0x32a(%rbp)
jne 0x3adc
jmp 0x3ae8
movq -0x418(%rbp), %rdi
callq 0x31a0
jmp 0x3bd8
movl $0x0, -0x330(%rbp)
movl -0x330(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x3b6c
movq 0x174c7(%rip), %rdi     # 0x1afd0
leaq 0xd6af(%rip), %rsi      # 0x111bf
callq 0x3200
movq %rax, -0x420(%rbp)
jmp 0x3b1e
movq -0x420(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x3360
movq %rax, -0x428(%rbp)
jmp 0x3b36
movq -0x428(%rbp), %rdi
leaq 0xd622(%rip), %rsi      # 0x11166
callq 0x3200
jmp 0x3b4b
jmp 0x3b4d
movl -0x330(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x330(%rbp)
jmp 0x3af7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3bd8
movl $0x0, -0x2b4(%rbp)
leaq -0x1d0(%rbp), %rax
movq %rax, -0x438(%rbp)
addq $0x150, %rax            # imm = 0x150
movq %rax, -0x430(%rbp)
movq -0x430(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x440(%rbp)
callq 0x4890
movq -0x438(%rbp), %rcx
movq -0x440(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x430(%rbp)
jne 0x3b91
movl -0x2b4(%rbp), %eax
testl %eax, %eax
je 0x3bd3
jmp 0x3bce
jmp 0x3e13
jmp 0x3e13
leaq -0x1d0(%rbp), %rax
movq %rax, -0x450(%rbp)
addq $0x150, %rax            # imm = 0x150
movq %rax, -0x448(%rbp)
movq -0x448(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x458(%rbp)
callq 0x4890
movq -0x450(%rbp), %rcx
movq -0x458(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x448(%rbp)
jne 0x3bf3
jmp 0x3c26
movl -0x5c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x3e1f
movq -0x58(%rbp), %rdi
callq 0x30a0
movq %rax, -0x338(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x470(%rbp)
movq 0x175ad(%rip), %rax     # 0x1b208
movq %rax, -0x468(%rbp)
leaq -0x359(%rbp), %rdi
movq %rdi, -0x460(%rbp)
callq 0x3380
movq -0x468(%rbp), %rsi
movq -0x460(%rbp), %rdx
leaq -0x358(%rbp), %rdi
callq 0x4de0
jmp 0x3c91
movq -0x338(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, -0x480(%rbp)
leaq -0x381(%rbp), %rdi
movq %rdi, -0x478(%rbp)
callq 0x3380
movq -0x480(%rbp), %rsi
movq -0x478(%rbp), %rdx
leaq -0x380(%rbp), %rdi
callq 0x4de0
jmp 0x3cd7
leaq -0x3a9(%rbp), %rdi
movq %rdi, -0x488(%rbp)
callq 0x3380
movq -0x488(%rbp), %rdx
leaq 0xd4dd(%rip), %rsi      # 0x111d5
leaq -0x3a8(%rbp), %rdi
callq 0x4de0
jmp 0x3d06
movq -0x470(%rbp), %rdi
leaq -0x358(%rbp), %rsi
leaq -0x380(%rbp), %rdx
leaq -0x3a8(%rbp), %rcx
callq 0x4ff0
jmp 0x3d29
leaq -0x3a8(%rbp), %rdi
callq 0x3160
leaq -0x3a9(%rbp), %rdi
callq 0x3240
leaq -0x380(%rbp), %rdi
callq 0x3160
leaq -0x381(%rbp), %rdi
callq 0x3240
leaq -0x358(%rbp), %rdi
callq 0x3160
leaq -0x359(%rbp), %rdi
callq 0x3240
movl $0x1, -0x4(%rbp)
movl $0x1, -0x2b4(%rbp)
callq 0x3330
jmp 0x3e13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3dfe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3de6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3dce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x3a8(%rbp), %rdi
callq 0x3160
leaq -0x3a9(%rbp), %rdi
callq 0x3240
leaq -0x380(%rbp), %rdi
callq 0x3160
leaq -0x381(%rbp), %rdi
callq 0x3240
leaq -0x358(%rbp), %rdi
callq 0x3160
leaq -0x359(%rbp), %rdi
callq 0x3240
callq 0x3330
jmp 0x3e11
jmp 0x3e1f
movl -0x4(%rbp), %eax
addq $0x490, %rsp            # imm = 0x490
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x3370
movq %rax, %rdi
callq 0x50d0