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

        std::vector<std::vector<int>> nss;

        auto new_ns = [&]() { nss.push_back({}); return true; };
        auto push_ns = [&](int n) { nss.back().push_back(n); return true; };

        auto gt0 = [](int m) { return m>0; };
        auto decrement = [](int m) { return m-1; };

        to::option opts[] = {
            { to::action(help), "-h", "--help", to::flag, to::exit },
            { to::action(new_ns), to::then(3), "-n", to::flag },
            { to::action(push_ns), to::when(gt0), to::then(decrement)}
        };

        if (!to::run(opts, argc, argv+1)) return 0;
        if (argv[1]) throw to::option_error("unrecognized argument", argv[1]);

        for (auto& ns: nss) {
            std::cout << "{ ";
            std::ostream_iterator<int> os(std::cout, " ");
            for (int n: ns) *os = n;
            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 $0x4e0, %rsp            # imm = 0x4E0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
leaq -0x30(%rbp), %rdi
movq %rdi, -0x420(%rbp)
callq 0x5860
movq -0x420(%rbp), %rax
movq %rax, -0x38(%rbp)
movq %rax, -0x40(%rbp)
movb $0x1, -0x2aa(%rbp)
leaq -0x1a0(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movq -0x1d0(%rbp), %rsi
leaq -0x1c8(%rbp), %rdi
callq 0x3ef0
jmp 0x3598
movl $0x1, -0x1e0(%rbp)
movl $0x10, -0x1e4(%rbp)
leaq 0xfc92(%rip), %rdx      # 0x13245
leaq 0xfc8e(%rip), %rcx      # 0x13248
leaq -0x1a0(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
leaq -0x1e0(%rbp), %r8
leaq -0x1e4(%rbp), %r9
callq 0x5880
jmp 0x35dd
leaq -0x130(%rbp), %rax
movq %rax, -0x428(%rbp)
movq %rax, -0x1a8(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x210(%rbp)
movq -0x210(%rbp), %rsi
leaq -0x208(%rbp), %rdi
callq 0x3f30
jmp 0x3612
leaq -0x230(%rbp), %rdi
movl $0x3, %esi
callq 0x59b0
jmp 0x3625
movq -0x428(%rbp), %rdi
movl $0x1, -0x234(%rbp)
leaq 0xfc12(%rip), %rcx      # 0x1324f
leaq -0x208(%rbp), %rsi
leaq -0x230(%rbp), %rdx
leaq -0x234(%rbp), %r8
callq 0x59e0
jmp 0x3659
leaq -0xc0(%rbp), %rax
movq %rax, -0x430(%rbp)
movq %rax, -0x1a8(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x260(%rbp)
movq -0x260(%rbp), %rsi
leaq -0x258(%rbp), %rdi
callq 0x3f70
jmp 0x368e
leaq -0x280(%rbp), %rdi
callq 0x3fb0
jmp 0x369c
leaq -0x2a8(%rbp), %rdi
callq 0x3fe0
jmp 0x36aa
movq -0x430(%rbp), %rdi
leaq -0x258(%rbp), %rsi
leaq -0x280(%rbp), %rdx
leaq -0x2a8(%rbp), %rcx
callq 0x5ae0
jmp 0x36cd
movb $0x0, -0x2aa(%rbp)
leaq -0x2a8(%rbp), %rdi
callq 0x5be0
leaq -0x280(%rbp), %rdi
callq 0x5c00
leaq -0x258(%rbp), %rdi
callq 0x5c20
leaq -0x230(%rbp), %rdi
callq 0x5be0
leaq -0x208(%rbp), %rdi
callq 0x5c20
leaq -0x1c8(%rbp), %rdi
callq 0x5c20
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x440(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x2f0(%rbp)
movq $0x0, -0x2e0(%rbp)
leaq -0x2f0(%rbp), %rdi
movq %rdi, -0x438(%rbp)
callq 0x6100
movq -0x440(%rbp), %rcx
movq -0x438(%rbp), %r8
leaq -0x2d0(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
leaq -0x8(%rbp), %rdx
callq 0x5c90
jmp 0x377a
leaq -0x2d0(%rbp), %rdi
callq 0x6120
xorb $-0x1, %al
movb %al, -0x441(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0x6140
leaq -0x2f0(%rbp), %rdi
callq 0x6170
movb -0x441(%rbp), %al
testb $0x1, %al
jne 0x37b5
jmp 0x3923
movl $0x0, -0x4(%rbp)
movl $0x1, -0x2f4(%rbp)
jmp 0x3bf4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x38a3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x3897
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x388b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x387f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x3873
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x3867
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
leaq -0x2a8(%rbp), %rdi
callq 0x5be0
leaq -0x280(%rbp), %rdi
callq 0x5c00
leaq -0x258(%rbp), %rdi
callq 0x5c20
leaq -0x230(%rbp), %rdi
callq 0x5be0
leaq -0x208(%rbp), %rdi
callq 0x5c20
leaq -0x1c8(%rbp), %rdi
callq 0x5c20
testb $0x1, -0x2aa(%rbp)
jne 0x38ae
jmp 0x38fb
movq -0x1a8(%rbp), %rax
leaq -0x1a0(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x450(%rbp)
je 0x38f9
movq -0x450(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x458(%rbp)
callq 0x5c40
movq -0x458(%rbp), %rax
leaq -0x1a0(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x450(%rbp)
jne 0x38c8
jmp 0x38fb
jmp 0x3cad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
leaq -0x2f0(%rbp), %rdi
callq 0x6170
jmp 0x3c5f
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x3a7f
movb $0x1, -0x342(%rbp)
movl $0x30, %edi
callq 0x3110
movq %rax, -0x468(%rbp)
leaq -0x319(%rbp), %rdi
movq %rdi, -0x460(%rbp)
callq 0x3370
movq -0x460(%rbp), %rdx
leaq 0xf8e7(%rip), %rsi      # 0x13252
leaq -0x318(%rbp), %rdi
callq 0x6190
jmp 0x3979
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x478(%rbp)
leaq -0x341(%rbp), %rdi
movq %rdi, -0x470(%rbp)
callq 0x3370
movq -0x478(%rbp), %rsi
movq -0x470(%rbp), %rdx
leaq -0x340(%rbp), %rdi
callq 0x6190
jmp 0x39b7
movq -0x468(%rbp), %rdi
leaq -0x318(%rbp), %rsi
leaq -0x340(%rbp), %rdx
callq 0x6240
jmp 0x39d3
movq -0x468(%rbp), %rdi
movb $0x0, -0x342(%rbp)
leaq 0x1a260(%rip), %rsi     # 0x1dc48
leaq 0x2921(%rip), %rdx      # 0x6310
callq 0x3340
jmp 0x3ee1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x3a57
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x3a3f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
leaq -0x340(%rbp), %rdi
callq 0x3160
leaq -0x341(%rbp), %rdi
callq 0x3240
leaq -0x318(%rbp), %rdi
callq 0x3160
leaq -0x319(%rbp), %rdi
callq 0x3240
testb $0x1, -0x342(%rbp)
jne 0x3a6e
jmp 0x3a7a
movq -0x468(%rbp), %rdi
callq 0x31a0
jmp 0x3c5f
leaq -0x30(%rbp), %rax
movq %rax, -0x350(%rbp)
movq -0x350(%rbp), %rdi
callq 0x6350
movq %rax, -0x358(%rbp)
movq -0x350(%rbp), %rdi
callq 0x6380
movq %rax, -0x360(%rbp)
leaq -0x358(%rbp), %rdi
leaq -0x360(%rbp), %rsi
callq 0x63b0
testb $0x1, %al
jne 0x3acc
jmp 0x3bea
leaq -0x358(%rbp), %rdi
callq 0x63f0
movq %rax, -0x368(%rbp)
movq 0x1a4ea(%rip), %rdi     # 0x1dfd0
leaq 0xf77b(%rip), %rsi      # 0x13268
callq 0x3200
jmp 0x3af4
movq 0x1a4d5(%rip), %rsi     # 0x1dfd0
leaq 0xf772(%rip), %rdx      # 0x13274
leaq -0x378(%rbp), %rdi
callq 0x6410
jmp 0x3b10
movq -0x368(%rbp), %rax
movq %rax, -0x380(%rbp)
movq -0x380(%rbp), %rdi
callq 0x6440
movq %rax, -0x388(%rbp)
movq -0x380(%rbp), %rdi
callq 0x6470
movq %rax, -0x390(%rbp)
leaq -0x388(%rbp), %rdi
leaq -0x390(%rbp), %rsi
callq 0x64a0
testb $0x1, %al
jne 0x3b5d
jmp 0x3bc2
leaq -0x388(%rbp), %rdi
callq 0x64e0
movl (%rax), %eax
movl %eax, -0x394(%rbp)
leaq -0x378(%rbp), %rdi
callq 0x6500
movq %rax, -0x480(%rbp)
jmp 0x3b86
movq -0x480(%rbp), %rdi
leaq -0x394(%rbp), %rsi
callq 0x6510
jmp 0x3b9b
jmp 0x3b9d
leaq -0x388(%rbp), %rdi
callq 0x6560
jmp 0x3b44
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x3c5f
movq 0x1a407(%rip), %rdi     # 0x1dfd0
leaq 0xf69b(%rip), %rsi      # 0x1326b
callq 0x3200
jmp 0x3bd7
jmp 0x3bd9
leaq -0x358(%rbp), %rdi
callq 0x6580
jmp 0x3ab0
movl $0x0, -0x2f4(%rbp)
leaq -0x1a0(%rbp), %rax
movq %rax, -0x490(%rbp)
addq $0x150, %rax            # imm = 0x150
movq %rax, -0x488(%rbp)
movq -0x488(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x498(%rbp)
callq 0x5c40
movq -0x490(%rbp), %rcx
movq -0x498(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x488(%rbp)
jne 0x3c0f
leaq -0x30(%rbp), %rdi
callq 0x65a0
movl -0x2f4(%rbp), %eax
testl %eax, %eax
je 0x3c5a
jmp 0x3c55
jmp 0x3ec1
jmp 0x3ec1
leaq -0x1a0(%rbp), %rax
movq %rax, -0x4a8(%rbp)
addq $0x150, %rax            # imm = 0x150
movq %rax, -0x4a0(%rbp)
movq -0x4a0(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x4b0(%rbp)
callq 0x5c40
movq -0x4a8(%rbp), %rcx
movq -0x4b0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x4a0(%rbp)
jne 0x3c7a
jmp 0x3cad
leaq -0x30(%rbp), %rdi
callq 0x65a0
movl -0x1dc(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x3ecd
movq -0x1d8(%rbp), %rdi
callq 0x30a0
movq %rax, -0x3a0(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x4c8(%rbp)
movq 0x1a50f(%rip), %rax     # 0x1e200
movq %rax, -0x4c0(%rbp)
leaq -0x3c1(%rbp), %rdi
movq %rdi, -0x4b8(%rbp)
callq 0x3370
movq -0x4c0(%rbp), %rsi
movq -0x4b8(%rbp), %rdx
leaq -0x3c0(%rbp), %rdi
callq 0x6190
jmp 0x3d27
movq -0x3a0(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, -0x4d8(%rbp)
leaq -0x3e9(%rbp), %rdi
movq %rdi, -0x4d0(%rbp)
callq 0x3370
movq -0x4d8(%rbp), %rsi
movq -0x4d0(%rbp), %rdx
leaq -0x3e8(%rbp), %rdi
callq 0x6190
jmp 0x3d6d
leaq -0x411(%rbp), %rdi
movq %rdi, -0x4e0(%rbp)
callq 0x3370
movq -0x4e0(%rbp), %rdx
leaq 0xf4e0(%rip), %rsi      # 0x1326e
leaq -0x410(%rbp), %rdi
callq 0x6190
jmp 0x3d9c
movq -0x4c8(%rbp), %rdi
leaq -0x3c0(%rbp), %rsi
leaq -0x3e8(%rbp), %rdx
leaq -0x410(%rbp), %rcx
callq 0x6600
jmp 0x3dbf
leaq -0x410(%rbp), %rdi
callq 0x3160
leaq -0x411(%rbp), %rdi
callq 0x3240
leaq -0x3e8(%rbp), %rdi
callq 0x3160
leaq -0x3e9(%rbp), %rdi
callq 0x3240
leaq -0x3c0(%rbp), %rdi
callq 0x3160
leaq -0x3c1(%rbp), %rdi
callq 0x3240
movl $0x1, -0x4(%rbp)
movl $0x1, -0x2f4(%rbp)
callq 0x3320
jmp 0x3ec1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x3eac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x3e94
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x3e7c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
leaq -0x410(%rbp), %rdi
callq 0x3160
leaq -0x411(%rbp), %rdi
callq 0x3240
leaq -0x3e8(%rbp), %rdi
callq 0x3160
leaq -0x3e9(%rbp), %rdi
callq 0x3240
leaq -0x3c0(%rbp), %rdi
callq 0x3160
leaq -0x3c1(%rbp), %rdi
callq 0x3240
callq 0x3320
jmp 0x3ebf
jmp 0x3ecd
movl -0x4(%rbp), %eax
addq $0x4e0, %rsp            # imm = 0x4E0
popq %rbp
retq
movq -0x1d8(%rbp), %rdi
callq 0x3360
movq %rax, %rdi
callq 0x66e0
nopw %cs:(%rax,%rax)