// File: /workspace/github_cpp_makefile_star2_O2/halfflat[P]tinyopt/test/test_parse.cc
// Function: parse_custom_parser_Test::TestBody()
TEST(parse, custom_parser) {
    auto custom = [](const char* s) -> to::maybe<bool> {
        if (!std::strcmp("no", s)) return false;
        if (!std::strcmp("yes", s)) return true;
        return to::nothing;
    };

    {
        mockargs M("-s\0yes\0");
        char** arg = M.argv;

        auto r = to::parse<bool>(arg, custom, "-s");
        ASSERT_TRUE(r);
        ASSERT_EQ(true, *r);
        ASSERT_EQ(M.argv+2, arg);
    }

    {
        mockargs M("-s\0no\0");
        char** arg = M.argv;

        auto r = to::parse<bool>(arg, custom, "-s");
        ASSERT_TRUE(r);
        ASSERT_EQ(false, *r);
        ASSERT_EQ(M.argv+2, arg);
    }

    {
        mockargs M("-s\0what?\0");
        char** arg = M.argv;

        EXPECT_THROW(to::parse<bool>(arg, custom, "-s"), to::option_parse_error);
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
leaq 0x31dab(%rip), %rsi     # 0x588bc
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
callq 0x2488e
movq 0x8(%rbx), %rax
movq %rax, 0x58(%rsp)
leaq 0x31907(%rip), %rsi     # 0x58435
leaq 0xe0(%rsp), %rdi
callq 0x1c660
leaq 0xe(%rsp), %rdi
leaq 0x58(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
callq 0x27239
leaq 0xe0(%rsp), %rdi
callq 0xdbe8
movb 0xe(%rsp), %al
leaq 0x38(%rsp), %r14
movb %al, -0x8(%r14)
andq $0x0, (%r14)
testb %al, %al
je 0x26de1
movq %r14, %rdi
callq 0x13646
leaq 0x30(%rsp), %rcx
movb $0x1, (%rcx)
leaq 0xf(%rsp), %r8
leaq 0x2f581(%rip), %rsi     # 0x56115
leaq 0x318ad(%rip), %rdx     # 0x58448
leaq 0x10(%rsp), %rdi
callq 0x27c08
cmpb $0x0, 0x10(%rsp)
je 0x26e61
leaq 0x18(%rsp), %rdi
callq 0x13646
movq 0x70(%rsp), %rax
addq $0x10, %rax
leaq 0x30(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x31879(%rip), %rsi     # 0x5844b
leaq 0x30815(%rip), %rdx     # 0x573ee
leaq 0x10(%rsp), %rdi
leaq 0x58(%rsp), %r8
callq 0x276d1
cmpb $0x0, 0x10(%rsp)
je 0x26e7a
leaq 0x18(%rsp), %rdi
callq 0x13646
leaq 0x78(%rsp), %rdi
callq 0x25080
leaq 0x31d05(%rip), %rsi     # 0x58913
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
callq 0x2488e
movq 0x8(%rbx), %rax
movq %rax, 0x58(%rsp)
leaq 0x3180a(%rip), %rsi     # 0x58435
leaq 0xb8(%rsp), %rdi
callq 0x1c660
leaq 0xe(%rsp), %rdi
leaq 0x58(%rsp), %rsi
leaq 0xb8(%rsp), %rdx
callq 0x27239
leaq 0xb8(%rsp), %rdi
callq 0xdbe8
movb 0xe(%rsp), %al
leaq 0x38(%rsp), %r14
movb %al, -0x8(%r14)
andq $0x0, (%r14)
testb %al, %al
je 0x26ec8
movq %r14, %rdi
callq 0x13646
leaq 0x30(%rsp), %rcx
movb $0x0, (%rcx)
leaq 0xf(%rsp), %r8
leaq 0x2f47e(%rip), %rsi     # 0x5610f
leaq 0x317b0(%rip), %rdx     # 0x58448
leaq 0x10(%rsp), %rdi
callq 0x27c08
cmpb $0x0, 0x10(%rsp)
je 0x26f85
leaq 0x18(%rsp), %rdi
callq 0x13646
movq 0x70(%rsp), %rax
addq $0x10, %rax
leaq 0x30(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x3177c(%rip), %rsi     # 0x5844b
leaq 0x30718(%rip), %rdx     # 0x573ee
leaq 0x10(%rsp), %rdi
leaq 0x58(%rsp), %r8
callq 0x276d1
cmpb $0x0, 0x10(%rsp)
je 0x26f9e
leaq 0x18(%rsp), %rdi
callq 0x13646
leaq 0x78(%rsp), %rdi
callq 0x25080
leaq 0x31c0f(%rip), %rsi     # 0x5891a
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
callq 0x2488e
movq 0x8(%rbx), %rax
movq %rax, 0x58(%rsp)
leaq 0x20(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
callq 0x3d5f3
testb %al, %al
je 0x26d76
leaq 0x316f0(%rip), %rsi     # 0x58435
leaq 0x90(%rsp), %rdi
callq 0x1c660
leaq 0x66(%rsp), %rdi
leaq 0x58(%rsp), %rsi
leaq 0x90(%rsp), %rdx
callq 0x27239
leaq 0x90(%rsp), %rdi
callq 0xdbe8
leaq 0x31aad(%rip), %rsi     # 0x5882a
leaq 0x10(%rsp), %rdi
callq 0xdb70
leaq 0x30(%rsp), %rdi
callq 0x3d5f6
movq 0x10(%rsp), %r8
leaq 0x3164a(%rip), %rdx     # 0x583e7
movq %rsp, %rdi
pushq $0x1
popq %rsi
movl $0x87, %ecx
callq 0x3b5b6
movq %rsp, %rdi
leaq 0x30(%rsp), %rsi
callq 0x39b08
movq %rsp, %rdi
callq 0x3b616
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x26dd2
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x10(%rsp), %rdi
callq 0xdbe8
jmp 0x26f70
movq %rsp, %rdi
callq 0x3d5f6
leaq 0x31659(%rip), %rdx     # 0x58449
leaq 0x2f318(%rip), %rcx     # 0x5610f
leaq 0x2f317(%rip), %r8      # 0x56115
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x399e5
movq 0x10(%rsp), %r8
leaq 0x315ce(%rip), %rdx     # 0x583e7
leaq 0x50(%rsp), %rdi
pushq $0x2
popq %rsi
pushq $0x74
popq %rcx
callq 0x3b5b6
leaq 0x50(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x50(%rsp), %rdi
callq 0x3b616
leaq 0x10(%rsp), %rdi
callq 0xdbe8
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x26e59
movq (%rdi), %rax
callq *0x8(%rax)
movq %r14, %rdi
jmp 0x26f6b
leaq 0x30(%rsp), %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x26e9a
movq (%rax), %r8
jmp 0x26ea1
leaq 0x30(%rsp), %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x26f22
movq (%rax), %r8
jmp 0x26f29
leaq 0x321c9(%rip), %r8      # 0x5906a
leaq 0x3153f(%rip), %rdx     # 0x583e7
movq %rsp, %rdi
pushq $0x2
popq %rsi
pushq $0x75
popq %rcx
callq 0x3b5b6
movq %rsp, %rdi
leaq 0x30(%rsp), %rsi
callq 0x39b08
jmp 0x26f4b
movq %rsp, %rdi
callq 0x3d5f6
leaq 0x31572(%rip), %rdx     # 0x58449
leaq 0x2f231(%rip), %rcx     # 0x5610f
leaq 0x2f230(%rip), %r8      # 0x56115
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x399e5
movq 0x10(%rsp), %r8
leaq 0x314e7(%rip), %rdx     # 0x583e7
leaq 0x50(%rsp), %rdi
pushq $0x2
popq %rsi
pushq $0x7e
popq %rcx
callq 0x3b5b6
leaq 0x50(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
jmp 0x26e36
leaq 0x32141(%rip), %r8      # 0x5906a
leaq 0x314b7(%rip), %rdx     # 0x583e7
movq %rsp, %rdi
pushq $0x2
popq %rsi
pushq $0x76
popq %rcx
callq 0x3b5b6
movq %rsp, %rdi
leaq 0x30(%rsp), %rsi
callq 0x39b08
leaq 0x18(%rsp), %rbx
movq %rsp, %rdi
callq 0x3b616
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x26f68
movq (%rdi), %rax
callq *0x8(%rax)
movq %rbx, %rdi
callq 0x13646
leaq 0x78(%rsp), %rdi
callq 0x25080
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
retq
leaq 0x30(%rsp), %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x26fb7
movq (%rax), %r8
jmp 0x26fbe
leaq 0x30(%rsp), %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x26fe5
movq (%rax), %r8
jmp 0x26fec
leaq 0x320ac(%rip), %r8      # 0x5906a
leaq 0x31422(%rip), %rdx     # 0x583e7
movq %rsp, %rdi
pushq $0x2
popq %rsi
pushq $0x7f
popq %rcx
callq 0x3b5b6
movq %rsp, %rdi
leaq 0x30(%rsp), %rsi
callq 0x39b08
jmp 0x26f4b
leaq 0x3207e(%rip), %r8      # 0x5906a
leaq 0x313f4(%rip), %rdx     # 0x583e7
movq %rsp, %rdi
pushq $0x2
popq %rsi
movl $0x80, %ecx
callq 0x3b5b6
movq %rsp, %rdi
leaq 0x30(%rsp), %rsi
callq 0x39b08
jmp 0x26f4b
movq %rdx, %r14
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0xdbe8
jmp 0x2706d
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3b616
jmp 0x2703a
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x27163
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x27163
jmp 0x271a3
jmp 0x27160
jmp 0x271b0
jmp 0x271c5
movq %rdx, %r14
movq %rax, %rbx
movq %rbx, %rdi
cmpl $0x3, %r14d
jne 0x27085
callq 0xd210
callq 0xda40
jmp 0x26dd2
callq 0xd210
cmpl $0x2, %r14d
jne 0x27114
movq %rax, %rbx
leaq 0x31716(%rip), %rsi     # 0x587b4
leaq 0x10(%rsp), %rdi
callq 0xdb70
movq (%rbx), %rax
movq -0x8(%rax), %rsi
leaq 0x30(%rsp), %rdi
callq 0x1d219
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0xdb90
leaq 0x30(%rsp), %rdi
callq 0xdbe8
leaq 0x3658e(%rip), %rsi     # 0x5d667
leaq 0x10(%rsp), %rdi
callq 0xdb60
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0xdb60
leaq 0x306eb(%rip), %rsi     # 0x577eb
leaq 0x10(%rsp), %rdi
callq 0xdb60
callq 0xda40
jmp 0x26d87
leaq 0x31612(%rip), %rsi     # 0x5872d
leaq 0x10(%rsp), %rdi
callq 0xdb70
callq 0xda40
jmp 0x26d87
movq %rax, %rbx
callq 0xda40
jmp 0x27163
jmp 0x27160
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xdbe8
jmp 0x27151
jmp 0x2714e
jmp 0x27160
movq %rax, %rbx
callq 0xda40
jmp 0x27163
movq %rax, %rdi
callq 0x135af
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
jmp 0x2721d
jmp 0x271a3
jmp 0x271b0
jmp 0x271c5
jmp 0x27224
jmp 0x271d1
jmp 0x271e0
jmp 0x271ef
jmp 0x27203
jmp 0x27224
jmp 0x271a3
jmp 0x271b0
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
jmp 0x2721d
jmp 0x271c5
jmp 0x27224
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3b616
jmp 0x271b3
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x271c8
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x271c8
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
jmp 0x27209
jmp 0x27224
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x3b616
jmp 0x271e3
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xdbe8
jmp 0x271f2
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x27206
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x27206
movq %rax, %rbx
movq %r14, %rdi
callq 0x13646
jmp 0x27227
jmp 0x27224
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
callq 0xdbe8
jmp 0x27227
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x25080
movq %rbx, %rdi
callq 0xdaa0