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

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

        for (auto arg = argv+1; *arg; ) {
            bool ok =
                help << to::parse(arg, "-h", "--help") ||
                n    << to::parse<int>(arg, "-n", "--number") ||
                fn   << to::parse<int>(arg, to::keywords(functions), "-f", "--function");

            if (!ok) throw to::option_error("unrecognized argument", *arg);
        }

        if (help) {
            to::usage(argv[0], usage_str);
            return 0;
        }

        if (n<1) throw to::option_error("N must be at least 1");
        if (fn<1) throw to::option_error("Require FUNC");

        // 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 $0x360, %rsp            # imm = 0x360
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
leaq 0x4c22(%rip), %rax      # 0x7104
movq %rax, -0x48(%rbp)
movl $0x1, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x4c(%rbp), %rdx
callq 0x2fa0
jmp 0x2500
leaq -0x30(%rbp), %rdi
leaq 0x4bfd(%rip), %rax      # 0x7108
movq %rax, -0x68(%rbp)
movl $0x2, -0x6c(%rbp)
leaq -0x68(%rbp), %rsi
leaq -0x6c(%rbp), %rdx
callq 0x2fa0
jmp 0x2525
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
cmpq $0x0, (%rax)
je 0x2a39
movb $0x0, -0xe1(%rbp)
movb $0x0, -0xe2(%rbp)
movb $0x0, -0xe3(%rbp)
movb $0x0, -0x111(%rbp)
movb $0x0, -0x141(%rbp)
movb $0x0, -0x142(%rbp)
movb $0x0, -0x143(%rbp)
leaq 0x4b95(%rip), %rsi      # 0x710c
leaq -0xa8(%rbp), %rdi
callq 0x32c0
jmp 0x2585
leaq 0x4b83(%rip), %rcx      # 0x710f
leaq -0x7c(%rbp), %rdi
leaq -0x78(%rbp), %rsi
leaq -0xa8(%rbp), %rdx
callq 0x3030
jmp 0x25a2
leaq -0x7b(%rbp), %rdi
leaq -0x19(%rbp), %rsi
leaq -0x7c(%rbp), %rdx
callq 0x2fd0
jmp 0x25b5
leaq -0x7b(%rbp), %rdi
callq 0x3360
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x2b2(%rbp)
jne 0x26e8
leaq 0x4b3e(%rip), %rsi      # 0x7116
leaq -0xe0(%rbp), %rdi
callq 0x32c0
jmp 0x25e6
movb $0x1, -0xe1(%rbp)
leaq 0x4b25(%rip), %rcx      # 0x7119
leaq -0xb8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
callq 0x33e0
jmp 0x260d
movb $0x1, -0xe2(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0x14(%rbp), %rsi
leaq -0xb8(%rbp), %rdx
callq 0x3380
jmp 0x262d
movb $0x1, -0xe3(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x3480
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x2b2(%rbp)
jne 0x26e8
leaq -0x110(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x3a20
jmp 0x2665
movb $0x1, -0x111(%rbp)
leaq 0x4aaf(%rip), %rsi      # 0x7122
leaq -0x140(%rbp), %rdi
callq 0x32c0
jmp 0x2681
movb $0x1, -0x141(%rbp)
leaq 0x4a96(%rip), %r8       # 0x7125
leaq -0xf4(%rbp), %rdi
leaq -0x78(%rbp), %rsi
leaq -0x110(%rbp), %rdx
leaq -0x140(%rbp), %rcx
callq 0x34a0
jmp 0x26af
movb $0x1, -0x142(%rbp)
leaq -0xec(%rbp), %rdi
leaq -0x18(%rbp), %rsi
leaq -0xf4(%rbp), %rdx
callq 0x3380
jmp 0x26cf
movb $0x1, -0x143(%rbp)
leaq -0xec(%rbp), %rdi
callq 0x3480
movb %al, -0x2b2(%rbp)
movb -0x2b2(%rbp), %al
movb %al, -0x2b3(%rbp)
testb $0x1, -0x143(%rbp)
jne 0x26ff
jmp 0x270b
leaq -0xec(%rbp), %rdi
callq 0x3a50
testb $0x1, -0x142(%rbp)
jne 0x2716
jmp 0x2722
leaq -0xf4(%rbp), %rdi
callq 0x3a50
testb $0x1, -0x141(%rbp)
jne 0x272d
jmp 0x2739
leaq -0x140(%rbp), %rdi
callq 0x3a80
testb $0x1, -0x111(%rbp)
jne 0x2744
jmp 0x2750
leaq -0x110(%rbp), %rdi
callq 0x3aa0
testb $0x1, -0xe3(%rbp)
jne 0x275b
jmp 0x2767
leaq -0xb0(%rbp), %rdi
callq 0x3a50
testb $0x1, -0xe2(%rbp)
jne 0x2772
jmp 0x277e
leaq -0xb8(%rbp), %rdi
callq 0x3a50
testb $0x1, -0xe1(%rbp)
jne 0x2789
jmp 0x2795
leaq -0xe0(%rbp), %rdi
callq 0x3a80
leaq -0x7b(%rbp), %rdi
callq 0x3ac0
leaq -0xa8(%rbp), %rdi
callq 0x3a80
movb -0x2b3(%rbp), %al
andb $0x1, %al
movb %al, -0x79(%rbp)
testb $0x1, -0x79(%rbp)
jne 0x2a34
movb $0x1, -0x192(%rbp)
movl $0x30, %edi
callq 0x20f0
movq %rax, -0x2c8(%rbp)
leaq -0x169(%rbp), %rdi
movq %rdi, -0x2c0(%rbp)
callq 0x2300
movq -0x2c0(%rbp), %rdx
leaq 0x4938(%rip), %rsi      # 0x7130
leaq -0x168(%rbp), %rdi
callq 0x3af0
jmp 0x2806
movq -0x78(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x2d8(%rbp)
leaq -0x191(%rbp), %rdi
movq %rdi, -0x2d0(%rbp)
callq 0x2300
movq -0x2d8(%rbp), %rsi
movq -0x2d0(%rbp), %rdx
leaq -0x190(%rbp), %rdi
callq 0x3af0
jmp 0x2843
movq -0x2c8(%rbp), %rdi
leaq -0x168(%rbp), %rsi
leaq -0x190(%rbp), %rdx
callq 0x3ba0
jmp 0x285f
movq -0x2c8(%rbp), %rdi
movb $0x0, -0x192(%rbp)
leaq 0x7474(%rip), %rsi      # 0x9ce8
leaq 0x13f5(%rip), %rdx      # 0x3c70
callq 0x22d0
jmp 0x2f99
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x2d23
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x29af
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x29a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x298d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x2974
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x295b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x2942
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x2929
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
testb $0x1, -0x142(%rbp)
jne 0x291b
jmp 0x2927
leaq -0xf4(%rbp), %rdi
callq 0x3a50
jmp 0x2929
testb $0x1, -0x141(%rbp)
jne 0x2934
jmp 0x2940
leaq -0x140(%rbp), %rdi
callq 0x3a80
jmp 0x2942
testb $0x1, -0x111(%rbp)
jne 0x294d
jmp 0x2959
leaq -0x110(%rbp), %rdi
callq 0x3aa0
jmp 0x295b
testb $0x1, -0xe3(%rbp)
jne 0x2966
jmp 0x2972
leaq -0xb0(%rbp), %rdi
callq 0x3a50
jmp 0x2974
testb $0x1, -0xe2(%rbp)
jne 0x297f
jmp 0x298b
leaq -0xb8(%rbp), %rdi
callq 0x3a50
jmp 0x298d
testb $0x1, -0xe1(%rbp)
jne 0x2998
jmp 0x29a4
leaq -0xe0(%rbp), %rdi
callq 0x3a80
jmp 0x29a6
leaq -0x7b(%rbp), %rdi
callq 0x3ac0
leaq -0xa8(%rbp), %rdi
callq 0x3a80
jmp 0x2d23
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x2a0c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x29f4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x2130
leaq -0x191(%rbp), %rdi
callq 0x2200
leaq -0x168(%rbp), %rdi
callq 0x2130
leaq -0x169(%rbp), %rdi
callq 0x2200
testb $0x1, -0x192(%rbp)
jne 0x2a23
jmp 0x2a2f
movq -0x2c8(%rbp), %rdi
callq 0x2160
jmp 0x2d23
jmp 0x2531
testb $0x1, -0x19(%rbp)
je 0x2b72
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x2f0(%rbp)
movq 0x7770(%rip), %rax      # 0xa1c8
movq %rax, -0x2e8(%rbp)
leaq -0x1b9(%rbp), %rdi
movq %rdi, -0x2e0(%rbp)
callq 0x2300
movq -0x2e8(%rbp), %rsi
movq -0x2e0(%rbp), %rdx
leaq -0x1b8(%rbp), %rdi
callq 0x3af0
jmp 0x2a8e
leaq -0x1e1(%rbp), %rdi
movq %rdi, -0x2f8(%rbp)
callq 0x2300
movq -0x2f8(%rbp), %rdx
leaq 0x4697(%rip), %rsi      # 0x7146
leaq -0x1e0(%rbp), %rdi
callq 0x3af0
jmp 0x2abd
movq -0x2f0(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
leaq -0x1e0(%rbp), %rdx
callq 0x3cb0
jmp 0x2ad9
leaq -0x1e0(%rbp), %rdi
callq 0x2130
leaq -0x1e1(%rbp), %rdi
callq 0x2200
leaq -0x1b8(%rbp), %rdi
callq 0x2130
leaq -0x1b9(%rbp), %rdi
callq 0x2200
movl $0x0, -0x4(%rbp)
jmp 0x2f7c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x2b61
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x2b49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x2130
leaq -0x1e1(%rbp), %rdi
callq 0x2200
leaq -0x1b8(%rbp), %rdi
callq 0x2130
leaq -0x1b9(%rbp), %rdi
callq 0x2200
jmp 0x2d23
cmpl $0x1, -0x14(%rbp)
jge 0x2c4c
movb $0x1, -0x20a(%rbp)
movl $0x30, %edi
callq 0x20f0
movq %rax, -0x308(%rbp)
leaq -0x209(%rbp), %rdi
movq %rdi, -0x300(%rbp)
callq 0x2300
movq -0x300(%rbp), %rdx
leaq 0x4599(%rip), %rsi      # 0x714e
leaq -0x208(%rbp), %rdi
callq 0x3af0
jmp 0x2bc3
movq -0x308(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0x3d50
jmp 0x2bd8
movq -0x308(%rbp), %rdi
movb $0x0, -0x20a(%rbp)
leaq 0x70fb(%rip), %rsi      # 0x9ce8
leaq 0x107c(%rip), %rdx      # 0x3c70
callq 0x22d0
jmp 0x2f99
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x2c24
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x2130
leaq -0x209(%rbp), %rdi
callq 0x2200
testb $0x1, -0x20a(%rbp)
jne 0x2c3b
jmp 0x2c47
movq -0x308(%rbp), %rdi
callq 0x2160
jmp 0x2d23
cmpl $0x1, -0x18(%rbp)
jge 0x2e7f
movb $0x1, -0x232(%rbp)
movl $0x30, %edi
callq 0x20f0
movq %rax, -0x318(%rbp)
leaq -0x231(%rbp), %rdi
movq %rdi, -0x310(%rbp)
callq 0x2300
movq -0x310(%rbp), %rdx
leaq 0x44d4(%rip), %rsi      # 0x7163
leaq -0x230(%rbp), %rdi
callq 0x3af0
jmp 0x2c9d
movq -0x318(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x3d50
jmp 0x2cb2
movq -0x318(%rbp), %rdi
movb $0x0, -0x232(%rbp)
leaq 0x7021(%rip), %rsi      # 0x9ce8
leaq 0xfa2(%rip), %rdx       # 0x3c70
callq 0x22d0
jmp 0x2f99
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x2cfe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x2130
leaq -0x231(%rbp), %rdi
callq 0x2200
testb $0x1, -0x232(%rbp)
jne 0x2d15
jmp 0x2d21
movq -0x318(%rbp), %rdi
callq 0x2160
jmp 0x2d23
movl -0x5c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x2f88
movq -0x58(%rbp), %rdi
callq 0x2080
movq %rax, -0x240(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x330(%rbp)
movq 0x7470(%rip), %rax      # 0xa1c8
movq %rax, -0x328(%rbp)
leaq -0x261(%rbp), %rdi
movq %rdi, -0x320(%rbp)
callq 0x2300
movq -0x328(%rbp), %rsi
movq -0x320(%rbp), %rdx
leaq -0x260(%rbp), %rdi
callq 0x3af0
jmp 0x2d8e
movq -0x240(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, -0x340(%rbp)
leaq -0x289(%rbp), %rdi
movq %rdi, -0x338(%rbp)
callq 0x2300
movq -0x340(%rbp), %rsi
movq -0x338(%rbp), %rdx
leaq -0x288(%rbp), %rdi
callq 0x3af0
jmp 0x2dd4
leaq -0x2b1(%rbp), %rdi
movq %rdi, -0x348(%rbp)
callq 0x2300
movq -0x348(%rbp), %rdx
leaq 0x4351(%rip), %rsi      # 0x7146
leaq -0x2b0(%rbp), %rdi
callq 0x3af0
jmp 0x2e03
movq -0x330(%rbp), %rdi
leaq -0x260(%rbp), %rsi
leaq -0x288(%rbp), %rdx
leaq -0x2b0(%rbp), %rcx
callq 0x3da0
jmp 0x2e26
leaq -0x2b0(%rbp), %rdi
callq 0x2130
leaq -0x2b1(%rbp), %rdi
callq 0x2200
leaq -0x288(%rbp), %rdi
callq 0x2130
leaq -0x289(%rbp), %rdi
callq 0x2200
leaq -0x260(%rbp), %rdi
callq 0x2130
leaq -0x261(%rbp), %rdi
callq 0x2200
movl $0x1, -0x4(%rbp)
callq 0x22b0
jmp 0x2f7c
movl $0x0, -0x238(%rbp)
movl -0x238(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x2ef0
movq 0x7135(%rip), %rdi      # 0x9fd0
leaq 0x42ce(%rip), %rsi      # 0x7170
callq 0x21c0
movq %rax, -0x350(%rbp)
jmp 0x2eb0
movq -0x350(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x22e0
movq %rax, -0x358(%rbp)
jmp 0x2ec8
movq -0x358(%rbp), %rdi
leaq 0x422c(%rip), %rsi      # 0x7102
callq 0x21c0
jmp 0x2edd
jmp 0x2edf
movl -0x238(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x238(%rbp)
jmp 0x2e89
jmp 0x2f7c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x2f67
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x2f4f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x2f37
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x2b0(%rbp), %rdi
callq 0x2130
leaq -0x2b1(%rbp), %rdi
callq 0x2200
leaq -0x288(%rbp), %rdi
callq 0x2130
leaq -0x289(%rbp), %rdi
callq 0x2200
leaq -0x260(%rbp), %rdi
callq 0x2130
leaq -0x261(%rbp), %rdi
callq 0x2200
callq 0x22b0
jmp 0x2f7a
jmp 0x2f88
movl -0x4(%rbp), %eax
addq $0x360, %rsp            # imm = 0x360
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x3e80
nopl (%rax)