// File: halfflat[P]tinyopt/ex/ex3-parse.cc
// Function: main
int main(int, char** argv) {
    try {
        std::vector<std::string> remaining;
        auto print_apple = [] { std::cout << "apple!\n"; };
        bool help = false;
        bool stop = false;

        char** arg = argv+1;
        while (*arg && !help && !stop) {
            bool match =
                help        << to::parse(arg, "-h", "--help") ||
                print_apple << to::parse(arg, "-a", "--apple") ||
                stop        << to::parse(arg, "--");

            if (!match) remaining.push_back(*arg++);
        }

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

        // Grab any remaining unprocessed arguments, too.
        while (*arg) remaining.push_back(*arg++);

        std::cout << "remaining arguments:";
        for (auto& a: remaining) std::cout << ' ' << a;
        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 $0x290, %rsp            # imm = 0x290
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x2ca0
movb $0x0, -0x2a(%rbp)
movb $0x0, -0x2b(%rbp)
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rcx
xorl %eax, %eax
cmpq $0x0, (%rcx)
movb %al, -0x212(%rbp)
je 0x23f1
xorl %eax, %eax
testb $0x1, -0x2a(%rbp)
movb %al, -0x212(%rbp)
jne 0x23f1
movb -0x2b(%rbp), %al
xorb $-0x1, %al
movb %al, -0x212(%rbp)
movb -0x212(%rbp), %al
testb $0x1, %al
jne 0x2400
jmp 0x26f6
movb $0x0, -0xa1(%rbp)
movb $0x0, -0xd1(%rbp)
movb $0x0, -0xd2(%rbp)
leaq 0x2cc5(%rip), %rsi      # 0x50e1
leaq -0x68(%rbp), %rdi
callq 0x2fb0
jmp 0x2427
leaq 0x2cb6(%rip), %rcx      # 0x50e4
leaq -0x3c(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x68(%rbp), %rdx
callq 0x2d20
jmp 0x2441
leaq -0x3b(%rbp), %rdi
leaq -0x2a(%rbp), %rsi
leaq -0x3c(%rbp), %rdx
callq 0x2cc0
jmp 0x2454
leaq -0x3b(%rbp), %rdi
callq 0x3050
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x213(%rbp)
jne 0x253b
leaq 0x2c74(%rip), %rsi      # 0x50eb
leaq -0xa0(%rbp), %rdi
callq 0x2fb0
jmp 0x2485
movb $0x1, -0xa1(%rbp)
leaq 0x2c5b(%rip), %rcx      # 0x50ee
leaq -0x76(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
callq 0x2d20
jmp 0x24a9
leaq -0x75(%rbp), %rdi
leaq -0x29(%rbp), %rsi
leaq -0x76(%rbp), %rdx
callq 0x2c00
jmp 0x24bc
leaq -0x75(%rbp), %rdi
callq 0x3070
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x213(%rbp)
jne 0x253b
leaq 0x2c1b(%rip), %rsi      # 0x50f6
leaq -0xd0(%rbp), %rdi
callq 0x2fb0
jmp 0x24e9
movb $0x1, -0xd1(%rbp)
leaq -0xa4(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0xd0(%rbp), %rdx
callq 0x3090
jmp 0x2509
leaq -0xa3(%rbp), %rdi
leaq -0x2b(%rbp), %rsi
leaq -0xa4(%rbp), %rdx
callq 0x2cc0
jmp 0x2522
movb $0x1, -0xd2(%rbp)
leaq -0xa3(%rbp), %rdi
callq 0x3050
movb %al, -0x213(%rbp)
movb -0x213(%rbp), %al
movb %al, -0x214(%rbp)
testb $0x1, -0xd2(%rbp)
jne 0x2552
jmp 0x255e
leaq -0xa3(%rbp), %rdi
callq 0x31f0
testb $0x1, -0xd1(%rbp)
jne 0x2569
jmp 0x2575
leaq -0xd0(%rbp), %rdi
callq 0x3220
testb $0x1, -0xa1(%rbp)
jne 0x2580
jmp 0x258c
leaq -0xa0(%rbp), %rdi
callq 0x3220
leaq -0x3b(%rbp), %rdi
callq 0x31f0
leaq -0x68(%rbp), %rdi
callq 0x3220
movb -0x214(%rbp), %al
andb $0x1, %al
movb %al, -0x39(%rbp)
testb $0x1, -0x39(%rbp)
jne 0x26f1
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x38(%rbp)
movq (%rax), %rax
movq %rax, -0x228(%rbp)
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x2210
movq -0x228(%rbp), %rsi
movq -0x220(%rbp), %rdx
leaq -0xf8(%rbp), %rdi
callq 0x3270
jmp 0x25fb
leaq -0x28(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x3240
jmp 0x260d
leaq -0xf8(%rbp), %rdi
callq 0x20b0
leaq -0xf9(%rbp), %rdi
callq 0x2170
jmp 0x26f1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x29e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x26ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x26a3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x268a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
testb $0x1, -0xd1(%rbp)
jne 0x267c
jmp 0x2688
leaq -0xd0(%rbp), %rdi
callq 0x3220
jmp 0x268a
testb $0x1, -0xa1(%rbp)
jne 0x2695
jmp 0x26a1
leaq -0xa0(%rbp), %rdi
callq 0x3220
jmp 0x26a3
leaq -0x3b(%rbp), %rdi
callq 0x31f0
leaq -0x68(%rbp), %rdi
callq 0x3220
jmp 0x29e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x26e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x20b0
leaq -0xf9(%rbp), %rdi
callq 0x2170
jmp 0x29e6
jmp 0x23c6
testb $0x1, -0x2a(%rbp)
je 0x2839
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x240(%rbp)
movq 0x5a23(%rip), %rax      # 0x8138
movq %rax, -0x238(%rbp)
leaq -0x121(%rbp), %rdi
movq %rdi, -0x230(%rbp)
callq 0x2210
movq -0x238(%rbp), %rsi
movq -0x230(%rbp), %rdx
leaq -0x120(%rbp), %rdi
callq 0x3270
jmp 0x274b
leaq -0x149(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0x2210
movq -0x248(%rbp), %rdx
leaq 0x298d(%rip), %rsi      # 0x50f9
leaq -0x148(%rbp), %rdi
callq 0x3270
jmp 0x277a
movq -0x240(%rbp), %rdi
leaq -0x120(%rbp), %rsi
leaq -0x148(%rbp), %rdx
callq 0x3320
jmp 0x2796
leaq -0x148(%rbp), %rdi
callq 0x20b0
leaq -0x149(%rbp), %rdi
callq 0x2170
leaq -0x120(%rbp), %rdi
callq 0x20b0
leaq -0x121(%rbp), %rdi
callq 0x2170
movl $0x0, -0x4(%rbp)
movl $0x1, -0x150(%rbp)
jmp 0x29c7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x2828
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x2810
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x20b0
leaq -0x149(%rbp), %rdi
callq 0x2170
leaq -0x120(%rbp), %rdi
callq 0x20b0
leaq -0x121(%rbp), %rdi
callq 0x2170
jmp 0x29e6
jmp 0x283b
movq -0x38(%rbp), %rax
cmpq $0x0, (%rax)
je 0x28f7
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x38(%rbp)
movq (%rax), %rax
movq %rax, -0x258(%rbp)
leaq -0x171(%rbp), %rdi
movq %rdi, -0x250(%rbp)
callq 0x2210
movq -0x258(%rbp), %rsi
movq -0x250(%rbp), %rdx
leaq -0x170(%rbp), %rdi
callq 0x3270
jmp 0x2891
leaq -0x28(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x3240
jmp 0x28a3
leaq -0x170(%rbp), %rdi
callq 0x20b0
leaq -0x171(%rbp), %rdi
callq 0x2170
jmp 0x283b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x28e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x20b0
leaq -0x171(%rbp), %rdi
callq 0x2170
jmp 0x29e6
movq 0x56d2(%rip), %rdi      # 0x7fd0
leaq 0x27fc(%rip), %rsi      # 0x5101
callq 0x2130
jmp 0x290c
leaq -0x28(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x180(%rbp), %rdi
callq 0x33c0
movq %rax, -0x188(%rbp)
movq -0x180(%rbp), %rdi
callq 0x33f0
movq %rax, -0x190(%rbp)
leaq -0x188(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x3420
testb $0x1, %al
jne 0x2956
jmp 0x29a8
leaq -0x188(%rbp), %rdi
callq 0x3460
movq %rax, -0x198(%rbp)
movq 0x5660(%rip), %rdi      # 0x7fd0
movl $0x20, %esi
callq 0x21b0
movq %rax, -0x260(%rbp)
jmp 0x2983
movq -0x260(%rbp), %rdi
movq -0x198(%rbp), %rsi
callq 0x2120
jmp 0x2998
jmp 0x299a
leaq -0x188(%rbp), %rdi
callq 0x3480
jmp 0x293d
movq 0x5621(%rip), %rdi      # 0x7fd0
leaq 0x27aa(%rip), %rsi      # 0x5160
callq 0x2130
jmp 0x29bd
movl $0x0, -0x150(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x34a0
movl -0x150(%rbp), %eax
testl %eax, %eax
je 0x29e1
jmp 0x29dc
jmp 0x2bdc
jmp 0x2bdc
leaq -0x28(%rbp), %rdi
callq 0x34a0
movl -0x74(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x2be8
movq -0x70(%rbp), %rdi
callq 0x2070
movq %rax, -0x1a0(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x278(%rbp)
movq 0x5714(%rip), %rax      # 0x8138
movq %rax, -0x270(%rbp)
leaq -0x1c1(%rbp), %rdi
movq %rdi, -0x268(%rbp)
callq 0x2210
movq -0x270(%rbp), %rsi
movq -0x268(%rbp), %rdx
leaq -0x1c0(%rbp), %rdi
callq 0x3270
jmp 0x2a5a
movq -0x1a0(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, -0x288(%rbp)
leaq -0x1e9(%rbp), %rdi
movq %rdi, -0x280(%rbp)
callq 0x2210
movq -0x288(%rbp), %rsi
movq -0x280(%rbp), %rdx
leaq -0x1e8(%rbp), %rdi
callq 0x3270
jmp 0x2aa0
leaq -0x211(%rbp), %rdi
movq %rdi, -0x290(%rbp)
callq 0x2210
movq -0x290(%rbp), %rdx
leaq 0x2638(%rip), %rsi      # 0x50f9
leaq -0x210(%rbp), %rdi
callq 0x3270
jmp 0x2acf
movq -0x278(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
leaq -0x1e8(%rbp), %rdx
leaq -0x210(%rbp), %rcx
callq 0x3500
jmp 0x2af2
leaq -0x210(%rbp), %rdi
callq 0x20b0
leaq -0x211(%rbp), %rdi
callq 0x2170
leaq -0x1e8(%rbp), %rdi
callq 0x20b0
leaq -0x1e9(%rbp), %rdi
callq 0x2170
leaq -0x1c0(%rbp), %rdi
callq 0x20b0
leaq -0x1c1(%rbp), %rdi
callq 0x2170
movl $0x1, -0x4(%rbp)
movl $0x1, -0x150(%rbp)
callq 0x21f0
jmp 0x2bdc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x2bc7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x2baf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x2b97
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x20b0
leaq -0x211(%rbp), %rdi
callq 0x2170
leaq -0x1e8(%rbp), %rdi
callq 0x20b0
leaq -0x1e9(%rbp), %rdi
callq 0x2170
leaq -0x1c0(%rbp), %rdi
callq 0x20b0
leaq -0x1c1(%rbp), %rdi
callq 0x2170
callq 0x21f0
jmp 0x2bda
jmp 0x2be8
movl -0x4(%rbp), %eax
addq $0x290, %rsp            # imm = 0x290
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x2200
movq %rax, %rdi
callq 0x35e0
nopl (%rax)