// File: halfflat[P]tinyopt/test/test_run.cc
// Function: run_modal_Test::TestBody()
TEST(run, modal) {
    int a0 = 0, a1 = 0, a2 = 0;
    to::option opts[] = {
        {to::increment(a0), "-a", to::flag, to::when(0)},
        {to::increment(a1), "-a", to::flag, to::when(1)},
        {to::increment(a2), "-a", to::flag, to::when(2)},
        {{}, "one", to::flag, to::then(1)},
        {{}, "two", to::flag, to::then(2)}
    };

    mockargs M("-a\0one\0-a\0two\0-a\0-a\0one\0-a\0-a\0");
    auto r = to::run(opts, M.argc, M.argv);
    EXPECT_TRUE(r);

    EXPECT_EQ(1, a0);
    EXPECT_EQ(3, a1);
    EXPECT_EQ(2, a2);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x590, %rsp            # imm = 0x590
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movb $0x1, -0x3c9(%rbp)
leaq -0x250(%rbp), %rax
movq %rax, -0x258(%rbp)
leaq -0x278(%rbp), %rdi
leaq -0xc(%rbp), %rsi
callq 0x1db80
jmp 0x6d39b
movl $0x1, -0x288(%rbp)
leaq -0x2a8(%rbp), %rdi
xorl %esi, %esi
callq 0x38a90
jmp 0x6d3b5
leaq 0x5c2c4(%rip), %rdx     # 0xc9680
leaq -0x250(%rbp), %rdi
leaq -0x278(%rbp), %rsi
leaq -0x288(%rbp), %rcx
leaq -0x2a8(%rbp), %r8
callq 0x6f4b0
jmp 0x6d3df
leaq -0x1e0(%rbp), %rax
movq %rax, -0x4f0(%rbp)
movq %rax, -0x258(%rbp)
leaq -0x2c8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x1db80
jmp 0x6d406
movl $0x1, -0x2cc(%rbp)
leaq -0x2f0(%rbp), %rdi
movl $0x1, %esi
callq 0x38a90
jmp 0x6d423
movq -0x4f0(%rbp), %rdi
leaq 0x5c24f(%rip), %rdx     # 0xc9680
leaq -0x2c8(%rbp), %rsi
leaq -0x2cc(%rbp), %rcx
leaq -0x2f0(%rbp), %r8
callq 0x6f4b0
jmp 0x6d44d
leaq -0x170(%rbp), %rax
movq %rax, -0x4f8(%rbp)
movq %rax, -0x258(%rbp)
leaq -0x310(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x1db80
jmp 0x6d474
movl $0x1, -0x314(%rbp)
leaq -0x338(%rbp), %rdi
movl $0x2, %esi
callq 0x38a90
jmp 0x6d491
movq -0x4f8(%rbp), %rdi
leaq 0x5c1e1(%rip), %rdx     # 0xc9680
leaq -0x310(%rbp), %rsi
leaq -0x314(%rbp), %rcx
leaq -0x338(%rbp), %r8
callq 0x6f4b0
jmp 0x6d4bb
leaq -0x100(%rbp), %rax
movq %rax, -0x500(%rbp)
movq %rax, -0x258(%rbp)
leaq -0x358(%rbp), %rdi
callq 0x1d450
jmp 0x6d4de
movl $0x1, -0x35c(%rbp)
leaq -0x380(%rbp), %rdi
movl $0x1, %esi
callq 0x38ac0
jmp 0x6d4fb
movq -0x500(%rbp), %rdi
leaq 0x5d8b4(%rip), %rdx     # 0xcadbd
leaq -0x358(%rbp), %rsi
leaq -0x35c(%rbp), %rcx
leaq -0x380(%rbp), %r8
callq 0x6f5d0
jmp 0x6d525
leaq -0x90(%rbp), %rax
movq %rax, -0x508(%rbp)
movq %rax, -0x258(%rbp)
leaq -0x3a0(%rbp), %rdi
callq 0x1d450
jmp 0x6d548
movl $0x1, -0x3a4(%rbp)
leaq -0x3c8(%rbp), %rdi
movl $0x2, %esi
callq 0x38ac0
jmp 0x6d565
movq -0x508(%rbp), %rdi
leaq 0x5d992(%rip), %rdx     # 0xcaf05
leaq -0x3a0(%rbp), %rsi
leaq -0x3a4(%rbp), %rcx
leaq -0x3c8(%rbp), %r8
callq 0x6f5d0
jmp 0x6d58f
movb $0x0, -0x3c9(%rbp)
leaq -0x3c8(%rbp), %rdi
callq 0x38e90
leaq -0x3a0(%rbp), %rdi
callq 0x1d540
leaq -0x380(%rbp), %rdi
callq 0x38e90
leaq -0x358(%rbp), %rdi
callq 0x1d540
leaq -0x338(%rbp), %rdi
callq 0x38eb0
leaq -0x310(%rbp), %rdi
callq 0x1d540
leaq -0x2f0(%rbp), %rdi
callq 0x38eb0
leaq -0x2c8(%rbp), %rdi
callq 0x1d540
leaq -0x2a8(%rbp), %rdi
callq 0x38eb0
leaq -0x278(%rbp), %rdi
callq 0x1d540
leaq 0x5e4c8(%rip), %rsi     # 0xcbadd
leaq -0x3f8(%rbp), %rdi
callq 0x4bfe0
jmp 0x6d623
movq -0x3f0(%rbp), %rax
movq %rax, -0x518(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x430(%rbp)
movq $0x0, -0x420(%rbp)
leaq -0x430(%rbp), %rdi
movq %rdi, -0x510(%rbp)
callq 0x611a0
movq -0x518(%rbp), %rcx
movq -0x510(%rbp), %r8
leaq -0x418(%rbp), %rdi
leaq -0x250(%rbp), %rsi
leaq -0x3f8(%rbp), %rdx
callq 0x6f6f0
jmp 0x6d683
leaq -0x430(%rbp), %rdi
callq 0x61330
xorl %eax, %eax
movl %eax, %edx
leaq -0x440(%rbp), %rdi
leaq -0x418(%rbp), %rsi
callq 0x6e4b0
jmp 0x6d6a8
leaq -0x440(%rbp), %rdi
callq 0x1d4e0
movb %al, -0x519(%rbp)
jmp 0x6d6bc
movb -0x519(%rbp), %al
testb $0x1, %al
jne 0x6d6cb
jmp 0x6d8f9
jmp 0x6d9fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6d834
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6d828
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6d81c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6d810
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6d804
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6d7f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6d7ec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6d7e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6d7d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6d7c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
leaq -0x3c8(%rbp), %rdi
callq 0x38e90
leaq -0x3a0(%rbp), %rdi
callq 0x1d540
leaq -0x380(%rbp), %rdi
callq 0x38e90
leaq -0x358(%rbp), %rdi
callq 0x1d540
leaq -0x338(%rbp), %rdi
callq 0x38eb0
leaq -0x310(%rbp), %rdi
callq 0x1d540
leaq -0x2f0(%rbp), %rdi
callq 0x38eb0
leaq -0x2c8(%rbp), %rdi
callq 0x1d540
leaq -0x2a8(%rbp), %rdi
callq 0x38eb0
leaq -0x278(%rbp), %rdi
callq 0x1d540
testb $0x1, -0x3c9(%rbp)
jne 0x6d83f
jmp 0x6d88c
movq -0x258(%rbp), %rax
leaq -0x250(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x528(%rbp)
je 0x6d88a
movq -0x528(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x530(%rbp)
callq 0x38ed0
movq -0x530(%rbp), %rax
leaq -0x250(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x528(%rbp)
jne 0x6d859
jmp 0x6d88c
jmp 0x6deab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6de5d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
leaq -0x430(%rbp), %rdi
callq 0x61330
jmp 0x6de51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6de45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6da5c
leaq -0x448(%rbp), %rdi
callq 0x84210
jmp 0x6d907
leaq 0x5cdd3(%rip), %rdx     # 0xca6e1
leaq 0x5ab3a(%rip), %rcx     # 0xc844f
leaq 0x5ab39(%rip), %r8      # 0xc8455
leaq -0x470(%rbp), %rdi
leaq -0x440(%rbp), %rsi
callq 0x7d210
jmp 0x6d931
leaq -0x470(%rbp), %rdi
callq 0x102c0
movq %rax, %r8
leaq 0x5dc53(%rip), %rdx     # 0xcb59a
leaq -0x450(%rbp), %rdi
movl $0x1, %esi
movl $0xf7, %ecx
callq 0x80580
jmp 0x6d95f
leaq -0x450(%rbp), %rdi
leaq -0x448(%rbp), %rsi
callq 0x7d370
jmp 0x6d974
leaq -0x450(%rbp), %rdi
callq 0x80600
leaq -0x470(%rbp), %rdi
callq 0x10fc8
leaq -0x448(%rbp), %rdi
callq 0x1d500
jmp 0x6d9fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6d9ec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6d9e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
leaq -0x450(%rbp), %rdi
callq 0x80600
leaq -0x470(%rbp), %rdi
callq 0x10fc8
leaq -0x448(%rbp), %rdi
callq 0x1d500
jmp 0x6da5c
leaq -0x440(%rbp), %rdi
callq 0x1d520
movl $0x1, -0x484(%rbp)
leaq 0x5c8bf(%rip), %rsi     # 0xca2d6
leaq 0x5e043(%rip), %rdx     # 0xcba61
leaq -0x480(%rbp), %rdi
leaq -0x484(%rbp), %rcx
leaq -0xc(%rbp), %r8
callq 0x1d5d0
jmp 0x6da37
leaq -0x480(%rbp), %rdi
callq 0x1d4e0
movb %al, -0x531(%rbp)
jmp 0x6da4b
movb -0x531(%rbp), %al
testb $0x1, %al
jne 0x6da57
jmp 0x6da84
jmp 0x6db3c
leaq -0x440(%rbp), %rdi
callq 0x1d520
jmp 0x6de45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6db9e
leaq -0x490(%rbp), %rdi
callq 0x84210
jmp 0x6da92
leaq -0x480(%rbp), %rdi
callq 0x1d620
movq %rax, -0x540(%rbp)
jmp 0x6daa7
movq -0x540(%rbp), %r8
leaq 0x5dae5(%rip), %rdx     # 0xcb59a
leaq -0x498(%rbp), %rdi
movl $0x1, %esi
movl $0xf9, %ecx
callq 0x80580
jmp 0x6dacd
leaq -0x498(%rbp), %rdi
leaq -0x490(%rbp), %rsi
callq 0x7d370
jmp 0x6dae2
leaq -0x498(%rbp), %rdi
callq 0x80600
leaq -0x490(%rbp), %rdi
callq 0x1d500
jmp 0x6db3c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6db2e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
leaq -0x498(%rbp), %rdi
callq 0x80600
leaq -0x490(%rbp), %rdi
callq 0x1d500
jmp 0x6db9e
leaq -0x480(%rbp), %rdi
callq 0x1d520
movl $0x3, -0x4ac(%rbp)
leaq 0x5d2a1(%rip), %rsi     # 0xcadfa
leaq 0x5df04(%rip), %rdx     # 0xcba64
leaq -0x4a8(%rbp), %rdi
leaq -0x4ac(%rbp), %rcx
leaq -0x10(%rbp), %r8
callq 0x1d5d0
jmp 0x6db79
leaq -0x4a8(%rbp), %rdi
callq 0x1d4e0
movb %al, -0x541(%rbp)
jmp 0x6db8d
movb -0x541(%rbp), %al
testb $0x1, %al
jne 0x6db99
jmp 0x6dbc6
jmp 0x6dc7e
leaq -0x480(%rbp), %rdi
callq 0x1d520
jmp 0x6de45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6dce0
leaq -0x4b8(%rbp), %rdi
callq 0x84210
jmp 0x6dbd4
leaq -0x4a8(%rbp), %rdi
callq 0x1d620
movq %rax, -0x550(%rbp)
jmp 0x6dbe9
movq -0x550(%rbp), %r8
leaq 0x5d9a3(%rip), %rdx     # 0xcb59a
leaq -0x4c0(%rbp), %rdi
movl $0x1, %esi
movl $0xfa, %ecx
callq 0x80580
jmp 0x6dc0f
leaq -0x4c0(%rbp), %rdi
leaq -0x4b8(%rbp), %rsi
callq 0x7d370
jmp 0x6dc24
leaq -0x4c0(%rbp), %rdi
callq 0x80600
leaq -0x4b8(%rbp), %rdi
callq 0x1d500
jmp 0x6dc7e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6dc70
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
leaq -0x4c0(%rbp), %rdi
callq 0x80600
leaq -0x4b8(%rbp), %rdi
callq 0x1d500
jmp 0x6dce0
leaq -0x4a8(%rbp), %rdi
callq 0x1d520
movl $0x2, -0x4d4(%rbp)
leaq 0x5c62b(%rip), %rsi     # 0xca2c6
leaq 0x5ddc5(%rip), %rdx     # 0xcba67
leaq -0x4d0(%rbp), %rdi
leaq -0x4d4(%rbp), %rcx
leaq -0x14(%rbp), %r8
callq 0x1d5d0
jmp 0x6dcbb
leaq -0x4d0(%rbp), %rdi
callq 0x1d4e0
movb %al, -0x551(%rbp)
jmp 0x6dccf
movb -0x551(%rbp), %al
testb $0x1, %al
jne 0x6dcdb
jmp 0x6dd08
jmp 0x6ddc0
leaq -0x4a8(%rbp), %rdi
callq 0x1d520
jmp 0x6de45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6de39
leaq -0x4e0(%rbp), %rdi
callq 0x84210
jmp 0x6dd16
leaq -0x4d0(%rbp), %rdi
callq 0x1d620
movq %rax, -0x560(%rbp)
jmp 0x6dd2b
movq -0x560(%rbp), %r8
leaq 0x5d861(%rip), %rdx     # 0xcb59a
leaq -0x4e8(%rbp), %rdi
movl $0x1, %esi
movl $0xfb, %ecx
callq 0x80580
jmp 0x6dd51
leaq -0x4e8(%rbp), %rdi
leaq -0x4e0(%rbp), %rsi
callq 0x7d370
jmp 0x6dd66
leaq -0x4e8(%rbp), %rdi
callq 0x80600
leaq -0x4e0(%rbp), %rdi
callq 0x1d500
jmp 0x6ddc0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x6ddb2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
leaq -0x4e8(%rbp), %rdi
callq 0x80600
leaq -0x4e0(%rbp), %rdi
callq 0x1d500
jmp 0x6de39
leaq -0x4d0(%rbp), %rdi
callq 0x1d520
leaq -0x418(%rbp), %rdi
callq 0x6e5d0
leaq -0x3f8(%rbp), %rdi
callq 0x4c380
leaq -0x250(%rbp), %rax
movq %rax, -0x570(%rbp)
addq $0x230, %rax            # imm = 0x230
movq %rax, -0x568(%rbp)
movq -0x568(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x578(%rbp)
callq 0x38ed0
movq -0x570(%rbp), %rcx
movq -0x578(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x568(%rbp)
jne 0x6ddff
addq $0x590, %rsp            # imm = 0x590
popq %rbp
retq
leaq -0x4d0(%rbp), %rdi
callq 0x1d520
leaq -0x418(%rbp), %rdi
callq 0x6e5d0
leaq -0x3f8(%rbp), %rdi
callq 0x4c380
leaq -0x250(%rbp), %rax
movq %rax, -0x588(%rbp)
addq $0x230, %rax            # imm = 0x230
movq %rax, -0x580(%rbp)
movq -0x580(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x590(%rbp)
callq 0x38ed0
movq -0x588(%rbp), %rcx
movq -0x590(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x580(%rbp)
jne 0x6de78
jmp 0x6deab
movq -0x280(%rbp), %rdi
callq 0x10e00
nopw (%rax,%rax)