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

        int a = 0, b = 0, c = 0;
        bool one = false, two = false, three = false;
        std::string save_file;

        to::option opts[] = {
            { to::increment(a), to::flag, "-a"_compact },
            { to::increment(b), to::flag, "-b"_compact },
            { to::increment(c), to::flag, "-c"_compact },
            { to::set(one),     to::flag, "set/one"_compact },
            { to::set(two),     to::flag, "set/two"_compact },
            { to::set(three),   to::flag, "set/three"_compact },
            { save_file,        to::ephemeral, "--save" },
            { to::action(help), to::flag, to::exit, "-h", "--help" }
        };

        auto saved = to::run(opts, argc, argv);
        if (!saved) return 0;

        if (!save_file.empty()) {
            std::ofstream f(save_file);
            f << *saved << '\n';
        }

        if (a>0) std::cout << "a=" << a << '\n';
        if (b>0) std::cout << "b=" << b << '\n';
        if (c>0) std::cout << "c=" << c << '\n';
        if (one) std::cout << "set/one\n";
        if (two) std::cout << "set/two\n";
        if (three) std::cout << "set/three\n";
    }
    catch (to::option_error& e) {
        to::usage_error(argv[0], usage_str, e.what());
        return 1;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x9e0, %rsp            # imm = 0x9E0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movb $0x0, -0x25(%rbp)
movb $0x0, -0x26(%rbp)
movb $0x0, -0x27(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x32d0
movb $0x1, -0x619(%rbp)
leaq -0x3d0(%rbp), %rax
movq %rax, -0x3d8(%rbp)
leaq -0x3f8(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x47b0
jmp 0x35c5
movl $0x1, -0x408(%rbp)
leaq 0xdbd8(%rip), %rsi      # 0x111ae
leaq -0x430(%rbp), %rdi
movl $0x2, %edx
callq 0x47f0
jmp 0x35e9
leaq -0x3d0(%rbp), %rdi
leaq -0x3f8(%rbp), %rsi
leaq -0x408(%rbp), %rdx
leaq -0x430(%rbp), %rcx
callq 0x48a0
jmp 0x360c
leaq -0x360(%rbp), %rax
movq %rax, -0x8f0(%rbp)
movq %rax, -0x3d8(%rbp)
leaq -0x450(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x47b0
jmp 0x3633
movl $0x1, -0x454(%rbp)
leaq 0xdb6d(%rip), %rsi      # 0x111b1
leaq -0x480(%rbp), %rdi
movl $0x2, %edx
callq 0x47f0
jmp 0x3657
movq -0x8f0(%rbp), %rdi
leaq -0x450(%rbp), %rsi
leaq -0x454(%rbp), %rdx
leaq -0x480(%rbp), %rcx
callq 0x48a0
jmp 0x367a
leaq -0x2f0(%rbp), %rax
movq %rax, -0x8f8(%rbp)
movq %rax, -0x3d8(%rbp)
leaq -0x4a0(%rbp), %rdi
leaq -0x24(%rbp), %rsi
callq 0x47b0
jmp 0x36a1
movl $0x1, -0x4a4(%rbp)
leaq 0xdb02(%rip), %rsi      # 0x111b4
leaq -0x4d0(%rbp), %rdi
movl $0x2, %edx
callq 0x47f0
jmp 0x36c5
movq -0x8f8(%rbp), %rdi
leaq -0x4a0(%rbp), %rsi
leaq -0x4a4(%rbp), %rdx
leaq -0x4d0(%rbp), %rcx
callq 0x48a0
jmp 0x36e8
leaq -0x280(%rbp), %rax
movq %rax, -0x900(%rbp)
movq %rax, -0x3d8(%rbp)
leaq -0x4f0(%rbp), %rdi
leaq -0x25(%rbp), %rsi
callq 0x4970
jmp 0x370f
movl $0x1, -0x4f4(%rbp)
leaq 0xda97(%rip), %rsi      # 0x111b7
leaq -0x520(%rbp), %rdi
movl $0x7, %edx
callq 0x47f0
jmp 0x3733
movq -0x900(%rbp), %rdi
leaq -0x4f0(%rbp), %rsi
leaq -0x4f4(%rbp), %rdx
leaq -0x520(%rbp), %rcx
callq 0x48a0
jmp 0x3756
leaq -0x210(%rbp), %rax
movq %rax, -0x908(%rbp)
movq %rax, -0x3d8(%rbp)
leaq -0x540(%rbp), %rdi
leaq -0x26(%rbp), %rsi
callq 0x4970
jmp 0x377d
movl $0x1, -0x544(%rbp)
leaq 0xda31(%rip), %rsi      # 0x111bf
leaq -0x570(%rbp), %rdi
movl $0x7, %edx
callq 0x47f0
jmp 0x37a1
movq -0x908(%rbp), %rdi
leaq -0x540(%rbp), %rsi
leaq -0x544(%rbp), %rdx
leaq -0x570(%rbp), %rcx
callq 0x48a0
jmp 0x37c4
leaq -0x1a0(%rbp), %rax
movq %rax, -0x910(%rbp)
movq %rax, -0x3d8(%rbp)
leaq -0x590(%rbp), %rdi
leaq -0x27(%rbp), %rsi
callq 0x4970
jmp 0x37eb
movl $0x1, -0x594(%rbp)
leaq 0xd9cb(%rip), %rsi      # 0x111c7
leaq -0x5c0(%rbp), %rdi
movl $0x9, %edx
callq 0x47f0
jmp 0x380f
movq -0x910(%rbp), %rdi
leaq -0x590(%rbp), %rsi
leaq -0x594(%rbp), %rdx
leaq -0x5c0(%rbp), %rcx
callq 0x48a0
jmp 0x3832
leaq -0x130(%rbp), %rax
movq %rax, -0x918(%rbp)
movq %rax, -0x3d8(%rbp)
leaq -0x5e0(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x49a0
jmp 0x3859
movq -0x918(%rbp), %rdi
movl $0x2, -0x5e4(%rbp)
leaq 0xd960(%rip), %rcx      # 0x111d1
leaq -0x5e0(%rbp), %rsi
leaq -0x5e4(%rbp), %rdx
callq 0x49d0
jmp 0x3886
leaq -0xc0(%rbp), %rax
movq %rax, -0x920(%rbp)
movq %rax, -0x3d8(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x610(%rbp)
movq -0x610(%rbp), %rsi
leaq -0x608(%rbp), %rdi
callq 0x41b0
jmp 0x38bb
movq -0x920(%rbp), %rdi
movl $0x1, -0x614(%rbp)
movl $0x10, -0x618(%rbp)
leaq 0xd8fb(%rip), %r8       # 0x111d8
leaq 0xd8f7(%rip), %r9       # 0x111db
leaq -0x608(%rbp), %rsi
leaq -0x614(%rbp), %rdx
leaq -0x618(%rbp), %rcx
callq 0x4aa0
jmp 0x3900
movb $0x0, -0x619(%rbp)
leaq -0x608(%rbp), %rdi
callq 0x4b80
leaq -0x5e0(%rbp), %rdi
callq 0x4b80
leaq -0x5c0(%rbp), %rdi
callq 0x4ba0
leaq -0x590(%rbp), %rdi
callq 0x4b80
leaq -0x570(%rbp), %rdi
callq 0x4ba0
leaq -0x540(%rbp), %rdi
callq 0x4b80
leaq -0x520(%rbp), %rdi
callq 0x4ba0
leaq -0x4f0(%rbp), %rdi
callq 0x4b80
leaq -0x4d0(%rbp), %rdi
callq 0x4ba0
leaq -0x4a0(%rbp), %rdi
callq 0x4b80
leaq -0x480(%rbp), %rdi
callq 0x4ba0
leaq -0x450(%rbp), %rdi
callq 0x4b80
leaq -0x430(%rbp), %rdi
callq 0x4ba0
leaq -0x3f8(%rbp), %rdi
callq 0x4b80
movq -0x10(%rbp), %rax
movq %rax, -0x930(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x660(%rbp)
movq $0x0, -0x650(%rbp)
leaq -0x660(%rbp), %rdi
movq %rdi, -0x928(%rbp)
callq 0x5080
movq -0x930(%rbp), %rcx
movq -0x928(%rbp), %r8
leaq -0x640(%rbp), %rdi
leaq -0x3d0(%rbp), %rsi
leaq -0x8(%rbp), %rdx
callq 0x4c10
jmp 0x3a09
leaq -0x660(%rbp), %rdi
callq 0x50a0
leaq -0x640(%rbp), %rdi
callq 0x50c0
testb $0x1, %al
jne 0x3caf
movl $0x0, -0x4(%rbp)
movl $0x1, -0x664(%rbp)
jmp 0x3ea4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
jmp 0x3c2f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
jmp 0x3c23
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
jmp 0x3c17
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
jmp 0x3c0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
jmp 0x3bff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
jmp 0x3bf3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
jmp 0x3be7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
jmp 0x3bdb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
jmp 0x3bcf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
jmp 0x3bc3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
jmp 0x3bb7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
jmp 0x3bab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
jmp 0x3b9f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
jmp 0x3b93
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
leaq -0x608(%rbp), %rdi
callq 0x4b80
leaq -0x5e0(%rbp), %rdi
callq 0x4b80
leaq -0x5c0(%rbp), %rdi
callq 0x4ba0
leaq -0x590(%rbp), %rdi
callq 0x4b80
leaq -0x570(%rbp), %rdi
callq 0x4ba0
leaq -0x540(%rbp), %rdi
callq 0x4b80
leaq -0x520(%rbp), %rdi
callq 0x4ba0
leaq -0x4f0(%rbp), %rdi
callq 0x4b80
leaq -0x4d0(%rbp), %rdi
callq 0x4ba0
leaq -0x4a0(%rbp), %rdi
callq 0x4b80
leaq -0x480(%rbp), %rdi
callq 0x4ba0
leaq -0x450(%rbp), %rdi
callq 0x4b80
leaq -0x430(%rbp), %rdi
callq 0x4ba0
leaq -0x3f8(%rbp), %rdi
callq 0x4b80
testb $0x1, -0x619(%rbp)
jne 0x3c3a
jmp 0x3c87
movq -0x3d8(%rbp), %rax
leaq -0x3d0(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x938(%rbp)
je 0x3c85
movq -0x938(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x940(%rbp)
callq 0x4bc0
movq -0x940(%rbp), %rax
leaq -0x3d0(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x938(%rbp)
jne 0x3c54
jmp 0x3c87
jmp 0x3f75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
leaq -0x660(%rbp), %rdi
callq 0x50a0
jmp 0x3f27
leaq -0x48(%rbp), %rdi
callq 0x3350
testb $0x1, %al
jne 0x3d56
leaq -0x868(%rbp), %rdi
leaq -0x48(%rbp), %rsi
movl $0x10, %edx
callq 0x33d0
jmp 0x3cd7
leaq -0x640(%rbp), %rdi
callq 0x51c0
movq %rax, %rsi
leaq -0x868(%rbp), %rdi
callq 0x50e0
movq %rax, -0x948(%rbp)
jmp 0x3cfb
movq -0x948(%rbp), %rdi
movl $0xa, %esi
callq 0x3290
jmp 0x3d0e
leaq -0x868(%rbp), %rdi
callq 0x3300
jmp 0x3d56
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
jmp 0x3f1b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
leaq -0x868(%rbp), %rdi
callq 0x3300
jmp 0x3f1b
cmpl $0x0, -0x1c(%rbp)
jle 0x3da5
movq 0x1626d(%rip), %rdi     # 0x19fd0
leaq 0xd478(%rip), %rsi      # 0x111e2
callq 0x3200
movq %rax, -0x950(%rbp)
jmp 0x3d78
movq -0x950(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x3370
movq %rax, -0x958(%rbp)
jmp 0x3d90
movq -0x958(%rbp), %rdi
movl $0xa, %esi
callq 0x3290
jmp 0x3da3
jmp 0x3da5
cmpl $0x0, -0x20(%rbp)
jle 0x3df4
movq 0x1621e(%rip), %rdi     # 0x19fd0
leaq 0xd42c(%rip), %rsi      # 0x111e5
callq 0x3200
movq %rax, -0x960(%rbp)
jmp 0x3dc7
movq -0x960(%rbp), %rdi
movl -0x20(%rbp), %esi
callq 0x3370
movq %rax, -0x968(%rbp)
jmp 0x3ddf
movq -0x968(%rbp), %rdi
movl $0xa, %esi
callq 0x3290
jmp 0x3df2
jmp 0x3df4
cmpl $0x0, -0x24(%rbp)
jle 0x3e43
movq 0x161cf(%rip), %rdi     # 0x19fd0
leaq 0xd3e0(%rip), %rsi      # 0x111e8
callq 0x3200
movq %rax, -0x970(%rbp)
jmp 0x3e16
movq -0x970(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x3370
movq %rax, -0x978(%rbp)
jmp 0x3e2e
movq -0x978(%rbp), %rdi
movl $0xa, %esi
callq 0x3290
jmp 0x3e41
jmp 0x3e43
testb $0x1, -0x25(%rbp)
je 0x3e60
movq 0x16180(%rip), %rdi     # 0x19fd0
leaq 0xd394(%rip), %rsi      # 0x111eb
callq 0x3200
jmp 0x3e5e
jmp 0x3e60
testb $0x1, -0x26(%rbp)
je 0x3e7d
movq 0x16163(%rip), %rdi     # 0x19fd0
leaq 0xd380(%rip), %rsi      # 0x111f4
callq 0x3200
jmp 0x3e7b
jmp 0x3e7d
testb $0x1, -0x27(%rbp)
je 0x3e9a
movq 0x16146(%rip), %rdi     # 0x19fd0
leaq 0xd36c(%rip), %rsi      # 0x111fd
callq 0x3200
jmp 0x3e98
jmp 0x3e9a
movl $0x0, -0x664(%rbp)
leaq -0x640(%rbp), %rdi
callq 0x51e0
leaq -0x3d0(%rbp), %rax
movq %rax, -0x988(%rbp)
addq $0x380, %rax            # imm = 0x380
movq %rax, -0x980(%rbp)
movq -0x980(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x990(%rbp)
callq 0x4bc0
movq -0x988(%rbp), %rcx
movq -0x990(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x980(%rbp)
jne 0x3ecb
leaq -0x48(%rbp), %rdi
callq 0x3130
movl -0x664(%rbp), %eax
testl %eax, %eax
je 0x3f16
jmp 0x3f11
jmp 0x4189
jmp 0x4189
leaq -0x640(%rbp), %rdi
callq 0x51e0
leaq -0x3d0(%rbp), %rax
movq %rax, -0x9a0(%rbp)
addq $0x380, %rax            # imm = 0x380
movq %rax, -0x998(%rbp)
movq -0x998(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x9a8(%rbp)
callq 0x4bc0
movq -0x9a0(%rbp), %rcx
movq -0x9a8(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x998(%rbp)
jne 0x3f42
jmp 0x3f75
leaq -0x48(%rbp), %rdi
callq 0x3130
movl -0x404(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x4195
movq -0x400(%rbp), %rdi
callq 0x3090
movq %rax, -0x870(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x9c0(%rbp)
movq 0x1625f(%rip), %rax     # 0x1a218
movq %rax, -0x9b8(%rbp)
leaq -0x891(%rbp), %rdi
movq %rdi, -0x9b0(%rbp)
callq 0x3390
movq -0x9b8(%rbp), %rsi
movq -0x9b0(%rbp), %rdx
leaq -0x890(%rbp), %rdi
callq 0x52f0
jmp 0x3fef
movq -0x870(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, -0x9d0(%rbp)
leaq -0x8b9(%rbp), %rdi
movq %rdi, -0x9c8(%rbp)
callq 0x3390
movq -0x9d0(%rbp), %rsi
movq -0x9c8(%rbp), %rdx
leaq -0x8b8(%rbp), %rdi
callq 0x52f0
jmp 0x4035
leaq -0x8e1(%rbp), %rdi
movq %rdi, -0x9d8(%rbp)
callq 0x3390
movq -0x9d8(%rbp), %rdx
leaq 0xd1b2(%rip), %rsi      # 0x11208
leaq -0x8e0(%rbp), %rdi
callq 0x52f0
jmp 0x4064
movq -0x9c0(%rbp), %rdi
leaq -0x890(%rbp), %rsi
leaq -0x8b8(%rbp), %rdx
leaq -0x8e0(%rbp), %rcx
callq 0x5210
jmp 0x4087
leaq -0x8e0(%rbp), %rdi
callq 0x3130
leaq -0x8e1(%rbp), %rdi
callq 0x3240
leaq -0x8b8(%rbp), %rdi
callq 0x3130
leaq -0x8b9(%rbp), %rdi
callq 0x3240
leaq -0x890(%rbp), %rdi
callq 0x3130
leaq -0x891(%rbp), %rdi
callq 0x3240
movl $0x1, -0x4(%rbp)
movl $0x1, -0x664(%rbp)
callq 0x3340
jmp 0x4189
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
jmp 0x4174
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
jmp 0x415c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
jmp 0x4144
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x400(%rbp)
movl %eax, -0x404(%rbp)
leaq -0x8e0(%rbp), %rdi
callq 0x3130
leaq -0x8e1(%rbp), %rdi
callq 0x3240
leaq -0x8b8(%rbp), %rdi
callq 0x3130
leaq -0x8b9(%rbp), %rdi
callq 0x3240
leaq -0x890(%rbp), %rdi
callq 0x3130
leaq -0x891(%rbp), %rdi
callq 0x3240
callq 0x3340
jmp 0x4187
jmp 0x4195
movl -0x4(%rbp), %eax
addq $0x9e0, %rsp            # imm = 0x9E0
popq %rbp
retq
movq -0x400(%rbp), %rdi
callq 0x3380
movq %rax, %rdi
callq 0x53a0
nopl (%rax)