// File: halfflat[P]tinyopt/ex/ex2-run.cc
// Function: main
int main(int argc, char** argv) {
    try {
        std::vector<int> x;
        auto help = [argv0 = argv[0]] { to::usage(argv0, usage_str); };

        to::option opts[] = {
            { {x, to::delimited<int>()}, "--sum" },
            { 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]);

        std::cout << std::accumulate(x.begin(), x.end(), 0) << "\n";
    }
    catch (to::option_error& e) {
        to::usage_error(argv[0], usage_str, e.what());
        return 1;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x370, %rsp            # imm = 0x370
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x42d0
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movb $0x1, -0x181(%rbp)
leaq -0x110(%rbp), %rax
movq %rax, -0x118(%rbp)
movl $0x2c, %edi
callq 0x42f0
movb %al, -0x2a2(%rbp)
jmp 0x3594
movb -0x2a2(%rbp), %al
movb %al, -0x13a(%rbp)
movzbl -0x13a(%rbp), %edx
leaq -0x138(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x4320
jmp 0x35b9
leaq 0xeb0e(%rip), %rdx      # 0x120ce
leaq -0x110(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x4370
jmp 0x35d5
leaq -0xa0(%rbp), %rax
movq %rax, -0x2b0(%rbp)
movq %rax, -0x118(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x178(%rbp), %rsi
leaq -0x170(%rbp), %rdi
callq 0x3cd0
jmp 0x360a
movq -0x2b0(%rbp), %rdi
movl $0x1, -0x17c(%rbp)
movl $0x10, -0x180(%rbp)
leaq 0xeaa8(%rip), %r8       # 0x120d4
leaq 0xeaa4(%rip), %r9       # 0x120d7
leaq -0x170(%rbp), %rsi
leaq -0x17c(%rbp), %rdx
leaq -0x180(%rbp), %rcx
callq 0x4470
jmp 0x364f
movb $0x0, -0x181(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x4550
leaq -0x138(%rbp), %rdi
callq 0x4550
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x2c0(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x1c0(%rbp)
movq $0x0, -0x1b0(%rbp)
leaq -0x1c0(%rbp), %rdi
movq %rdi, -0x2b8(%rbp)
callq 0x4a30
movq -0x2c0(%rbp), %rcx
movq -0x2b8(%rbp), %r8
leaq -0x1a8(%rbp), %rdi
leaq -0x110(%rbp), %rsi
leaq -0x8(%rbp), %rdx
callq 0x45c0
jmp 0x36cc
leaq -0x1a8(%rbp), %rdi
callq 0x4a50
xorb $-0x1, %al
movb %al, -0x2c1(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x4a70
leaq -0x1c0(%rbp), %rdi
callq 0x4aa0
movb -0x2c1(%rbp), %al
testb $0x1, %al
jne 0x3707
jmp 0x37ef
movl $0x0, -0x4(%rbp)
movl $0x1, -0x1c4(%rbp)
jmp 0x39cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x148(%rbp)
movl %eax, -0x14c(%rbp)
jmp 0x376f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x148(%rbp)
movl %eax, -0x14c(%rbp)
jmp 0x3763
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x148(%rbp)
movl %eax, -0x14c(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x4550
leaq -0x138(%rbp), %rdi
callq 0x4550
testb $0x1, -0x181(%rbp)
jne 0x377a
jmp 0x37c7
movq -0x118(%rbp), %rax
leaq -0x110(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x2d0(%rbp)
je 0x37c5
movq -0x2d0(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x2d8(%rbp)
callq 0x4570
movq -0x2d8(%rbp), %rax
leaq -0x110(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x2d0(%rbp)
jne 0x3794
jmp 0x37c7
jmp 0x3a97
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x148(%rbp)
movl %eax, -0x14c(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0x4aa0
jmp 0x3a49
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x394b
movb $0x1, -0x212(%rbp)
movl $0x30, %edi
callq 0x3110
movq %rax, -0x2e8(%rbp)
leaq -0x1e9(%rbp), %rdi
movq %rdi, -0x2e0(%rbp)
callq 0x3390
movq -0x2e0(%rbp), %rdx
leaq 0xe8a7(%rip), %rsi      # 0x120de
leaq -0x1e8(%rbp), %rdi
callq 0x4ac0
jmp 0x3845
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x2f8(%rbp)
leaq -0x211(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
callq 0x3390
movq -0x2f8(%rbp), %rsi
movq -0x2f0(%rbp), %rdx
leaq -0x210(%rbp), %rdi
callq 0x4ac0
jmp 0x3883
movq -0x2e8(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
leaq -0x210(%rbp), %rdx
callq 0x4b70
jmp 0x389f
movq -0x2e8(%rbp), %rdi
movb $0x0, -0x212(%rbp)
leaq 0x183d4(%rip), %rsi     # 0x1bc88
leaq 0x1385(%rip), %rdx      # 0x4c40
callq 0x3360
jmp 0x3ccb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x148(%rbp)
movl %eax, -0x14c(%rbp)
jmp 0x3923
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x148(%rbp)
movl %eax, -0x14c(%rbp)
jmp 0x390b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x148(%rbp)
movl %eax, -0x14c(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x3170
leaq -0x211(%rbp), %rdi
callq 0x3250
leaq -0x1e8(%rbp), %rdi
callq 0x3170
leaq -0x1e9(%rbp), %rdi
callq 0x3250
testb $0x1, -0x212(%rbp)
jne 0x393a
jmp 0x3946
movq -0x2e8(%rbp), %rdi
callq 0x31b0
jmp 0x3a49
leaq -0x28(%rbp), %rdi
movq %rdi, -0x308(%rbp)
callq 0x4ce0
movq -0x308(%rbp), %rdi
movq %rax, -0x220(%rbp)
callq 0x4d10
movq %rax, -0x228(%rbp)
movq -0x220(%rbp), %rdi
movq -0x228(%rbp), %rsi
xorl %edx, %edx
callq 0x4c80
movl %eax, -0x2fc(%rbp)
jmp 0x3992
movl -0x2fc(%rbp), %esi
movq 0x18631(%rip), %rdi     # 0x1bfd0
callq 0x3370
movq %rax, -0x310(%rbp)
jmp 0x39ad
movq -0x310(%rbp), %rdi
leaq 0xe711(%rip), %rsi      # 0x120cc
callq 0x3210
jmp 0x39c2
movl $0x0, -0x1c4(%rbp)
leaq -0x110(%rbp), %rax
movq %rax, -0x320(%rbp)
addq $0xe0, %rax
movq %rax, -0x318(%rbp)
movq -0x318(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x328(%rbp)
callq 0x4570
movq -0x320(%rbp), %rcx
movq -0x328(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x318(%rbp)
jne 0x39e7
leaq -0x28(%rbp), %rdi
callq 0x4d40
movl -0x1c4(%rbp), %eax
testl %eax, %eax
je 0x3a32
jmp 0x3a2d
jmp 0x3cab
jmp 0x3cab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x148(%rbp)
movl %eax, -0x14c(%rbp)
leaq -0x110(%rbp), %rax
movq %rax, -0x338(%rbp)
addq $0xe0, %rax
movq %rax, -0x330(%rbp)
movq -0x330(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x340(%rbp)
callq 0x4570
movq -0x338(%rbp), %rcx
movq -0x340(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x330(%rbp)
jne 0x3a64
jmp 0x3a97
leaq -0x28(%rbp), %rdi
callq 0x4d40
movl -0x14c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x3cb7
movq -0x148(%rbp), %rdi
callq 0x30a0
movq %rax, -0x230(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x358(%rbp)
movq 0x18735(%rip), %rax     # 0x1c210
movq %rax, -0x350(%rbp)
leaq -0x251(%rbp), %rdi
movq %rdi, -0x348(%rbp)
callq 0x3390
movq -0x350(%rbp), %rsi
movq -0x348(%rbp), %rdx
leaq -0x250(%rbp), %rdi
callq 0x4ac0
jmp 0x3b11
movq -0x230(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, -0x368(%rbp)
leaq -0x279(%rbp), %rdi
movq %rdi, -0x360(%rbp)
callq 0x3390
movq -0x368(%rbp), %rsi
movq -0x360(%rbp), %rdx
leaq -0x278(%rbp), %rdi
callq 0x4ac0
jmp 0x3b57
leaq -0x2a1(%rbp), %rdi
movq %rdi, -0x370(%rbp)
callq 0x3390
movq -0x370(%rbp), %rdx
leaq 0xe57c(%rip), %rsi      # 0x120f4
leaq -0x2a0(%rbp), %rdi
callq 0x4ac0
jmp 0x3b86
movq -0x358(%rbp), %rdi
leaq -0x250(%rbp), %rsi
leaq -0x278(%rbp), %rdx
leaq -0x2a0(%rbp), %rcx
callq 0x4da0
jmp 0x3ba9
leaq -0x2a0(%rbp), %rdi
callq 0x3170
leaq -0x2a1(%rbp), %rdi
callq 0x3250
leaq -0x278(%rbp), %rdi
callq 0x3170
leaq -0x279(%rbp), %rdi
callq 0x3250
leaq -0x250(%rbp), %rdi
callq 0x3170
leaq -0x251(%rbp), %rdi
callq 0x3250
movl $0x1, -0x4(%rbp)
movl $0x1, -0x1c4(%rbp)
callq 0x3340
jmp 0x3cab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x148(%rbp)
movl %eax, -0x14c(%rbp)
jmp 0x3c96
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x148(%rbp)
movl %eax, -0x14c(%rbp)
jmp 0x3c7e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x148(%rbp)
movl %eax, -0x14c(%rbp)
jmp 0x3c66
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x148(%rbp)
movl %eax, -0x14c(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x3170
leaq -0x2a1(%rbp), %rdi
callq 0x3250
leaq -0x278(%rbp), %rdi
callq 0x3170
leaq -0x279(%rbp), %rdi
callq 0x3250
leaq -0x250(%rbp), %rdi
callq 0x3170
leaq -0x251(%rbp), %rdi
callq 0x3250
callq 0x3340
jmp 0x3ca9
jmp 0x3cb7
movl -0x4(%rbp), %eax
addq $0x370, %rsp            # imm = 0x370
popq %rbp
retq
movq -0x148(%rbp), %rdi
callq 0x3380
movq %rax, %rdi
callq 0x4e80
nopl (%rax,%rax)