// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
leaq 0x42396(%rip), %rsi     # 0x6e827
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
callq 0x29a42
movq 0x8(%rbx), %rax
movq %rax, 0x60(%rsp)
leaq 0x41ef2(%rip), %rsi     # 0x6e3a0
leaq 0xe8(%rsp), %rdi
callq 0x200cc
leaq 0x16(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
callq 0x2cd85
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2c4f3
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0xd530
movb 0x16(%rsp), %al
movb %al, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
testb %al, %al
je 0x2c801
leaq 0x38(%rsp), %rcx
movb $0x1, (%rcx)
leaq 0x17(%rsp), %r8
leaq 0x3fbec(%rip), %rsi     # 0x6c10c
leaq 0x41e8c(%rip), %rdx     # 0x6e3b3
leaq 0x18(%rsp), %rdi
callq 0x2d9fd
cmpb $0x0, 0x18(%rsp)
je 0x2c8ae
movq 0x20(%rsp), %rsi
testq %rsi, %rsi
je 0x2c550
leaq 0x20(%rsp), %rdi
callq 0x153ca
movq 0x70(%rsp), %rax
addq $0x10, %rax
leaq 0x38(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x41e4e(%rip), %rsi     # 0x6e3b6
leaq 0x40a52(%rip), %rdx     # 0x6cfc1
leaq 0x18(%rsp), %rdi
leaq 0x60(%rsp), %r8
callq 0x2d35e
cmpb $0x0, 0x18(%rsp)
je 0x2c8c7
movq 0x20(%rsp), %rsi
testq %rsi, %rsi
je 0x2c59d
leaq 0x20(%rsp), %rdi
callq 0x153ca
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x2c5b7
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0xd530
leaq 0x422c0(%rip), %rsi     # 0x6e87e
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
callq 0x29a42
movq 0x8(%rbx), %rax
movq %rax, 0x60(%rsp)
leaq 0x41dc5(%rip), %rsi     # 0x6e3a0
leaq 0xc0(%rsp), %rdi
callq 0x200cc
leaq 0x16(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x2cd85
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2c620
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0xd530
movb 0x16(%rsp), %al
movb %al, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
testb %al, %al
je 0x2c91d
leaq 0x38(%rsp), %rcx
movb $0x0, (%rcx)
leaq 0x17(%rsp), %r8
leaq 0x3fab9(%rip), %rsi     # 0x6c106
leaq 0x41d5f(%rip), %rdx     # 0x6e3b3
leaq 0x18(%rsp), %rdi
callq 0x2d9fd
cmpb $0x0, 0x18(%rsp)
je 0x2ca0a
movq 0x20(%rsp), %rsi
testq %rsi, %rsi
je 0x2c67d
leaq 0x20(%rsp), %rdi
callq 0x153ca
movq 0x70(%rsp), %rax
addq $0x10, %rax
leaq 0x38(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x41d21(%rip), %rsi     # 0x6e3b6
leaq 0x40925(%rip), %rdx     # 0x6cfc1
leaq 0x18(%rsp), %rdi
leaq 0x60(%rsp), %r8
callq 0x2d35e
cmpb $0x0, 0x18(%rsp)
je 0x2ca23
movq 0x20(%rsp), %rsi
testq %rsi, %rsi
je 0x2c6ca
leaq 0x20(%rsp), %rdi
callq 0x153ca
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x2c6e4
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0xd530
leaq 0x4219a(%rip), %rsi     # 0x6e885
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
callq 0x29a42
movq 0x8(%rbx), %rax
movq %rax, 0x60(%rsp)
leaq 0x28(%rsp), %r15
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
callq 0x4ca83
testb %al, %al
je 0x2c771
leaq 0x41c77(%rip), %rsi     # 0x6e3a0
leaq 0x98(%rsp), %rdi
callq 0x200cc
leaq 0x96(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0x98(%rsp), %rdx
callq 0x2cd85
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2c771
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0xd530
leaq 0x18(%rsp), %rdi
movq 0x8(%rdi), %rdx
leaq 0x42014(%rip), %rcx     # 0x6e795
movl $0x7d, %r8d
xorl %esi, %esi
callq 0xd960
leaq 0x38(%rsp), %rdi
callq 0x4ca86
movq 0x18(%rsp), %r8
leaq 0x41bae(%rip), %rdx     # 0x6e352
leaq 0x8(%rsp), %rdi
movl $0x1, %esi
movl $0x87, %ecx
callq 0x4902a
leaq 0x8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x46a1c
leaq 0x8(%rsp), %rdi
callq 0x49096
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x2c7e1
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x2c9e3
movq 0x28(%rsp), %rsi
incq %rsi
callq 0xd530
jmp 0x2c9e3
leaq 0x8(%rsp), %rdi
callq 0x4ca86
leaq 0x40(%rsp), %r14
leaq 0x41b9d(%rip), %rdx     # 0x6e3b4
leaq 0x3f8e8(%rip), %rcx     # 0x6c106
leaq 0x3f8e7(%rip), %r8      # 0x6c10c
leaq 0x18(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x46893
movq 0x18(%rsp), %r8
leaq 0x41b12(%rip), %rdx     # 0x6e352
leaq 0x58(%rsp), %rdi
movl $0x2, %esi
movl $0x74, %ecx
callq 0x4902a
leaq 0x58(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x46a1c
leaq 0x58(%rsp), %rdi
callq 0x49096
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2c888
movq 0x28(%rsp), %rsi
incq %rsi
callq 0xd530
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x2c898
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x40(%rsp), %rsi
testq %rsi, %rsi
je 0x2c9e3
movq %r14, %rdi
jmp 0x2c9de
leaq 0x38(%rsp), %rdi
callq 0x4ca86
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x2c8e7
movq (%rax), %r8
jmp 0x2c8ee
leaq 0x38(%rsp), %rdi
callq 0x4ca86
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x2c984
movq (%rax), %r8
jmp 0x2c98b
leaq 0x426e7(%rip), %r8      # 0x6efd5
leaq 0x41a5d(%rip), %rdx     # 0x6e352
leaq 0x8(%rsp), %rdi
movl $0x2, %esi
movl $0x75, %ecx
callq 0x4902a
leaq 0x8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x46a1c
jmp 0x2c9b5
leaq 0x8(%rsp), %rdi
callq 0x4ca86
leaq 0x40(%rsp), %r14
leaq 0x41a81(%rip), %rdx     # 0x6e3b4
leaq 0x3f7cc(%rip), %rcx     # 0x6c106
leaq 0x3f7cb(%rip), %r8      # 0x6c10c
leaq 0x18(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x46893
movq 0x18(%rsp), %r8
leaq 0x419f6(%rip), %rdx     # 0x6e352
leaq 0x58(%rsp), %rdi
movl $0x2, %esi
movl $0x7e, %ecx
callq 0x4902a
leaq 0x58(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x46a1c
jmp 0x2c863
leaq 0x4264a(%rip), %r8      # 0x6efd5
leaq 0x419c0(%rip), %rdx     # 0x6e352
leaq 0x8(%rsp), %rdi
movl $0x2, %esi
movl $0x76, %ecx
callq 0x4902a
leaq 0x8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x46a1c
leaq 0x8(%rsp), %rdi
callq 0x49096
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x2c9cf
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x20(%rsp), %rsi
testq %rsi, %rsi
je 0x2c9e3
leaq 0x20(%rsp), %rdi
callq 0x153ca
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x2c9fd
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0xd530
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r14
popq %r15
retq
leaq 0x38(%rsp), %rdi
callq 0x4ca86
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x2ca3c
movq (%rax), %r8
jmp 0x2ca43
leaq 0x38(%rsp), %rdi
callq 0x4ca86
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x2ca72
movq (%rax), %r8
jmp 0x2ca79
leaq 0x42592(%rip), %r8      # 0x6efd5
leaq 0x41908(%rip), %rdx     # 0x6e352
leaq 0x8(%rsp), %rdi
movl $0x2, %esi
movl $0x7f, %ecx
callq 0x4902a
leaq 0x8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x46a1c
jmp 0x2c9b5
leaq 0x4255c(%rip), %r8      # 0x6efd5
leaq 0x418d2(%rip), %rdx     # 0x6e352
leaq 0x8(%rsp), %rdi
movl $0x2, %esi
movl $0x80, %ecx
callq 0x4902a
leaq 0x8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x46a1c
jmp 0x2c9b5
movq %rdx, %r14
movq %rax, %rbx
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2cb16
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0xd530
jmp 0x2cb16
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x49096
jmp 0x2cae3
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x2cc33
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x2cc33
jmp 0x2cc9f
jmp 0x2cc30
jmp 0x2ccae
jmp 0x2ccc3
movq %rdx, %r14
movq %rax, %rbx
movq %rbx, %rdi
cmpl $0x3, %r14d
jne 0x2cb2e
callq 0xd200
callq 0xd9e0
jmp 0x2c7e1
callq 0xd200
cmpl $0x2, %r14d
jne 0x2cbd3
movq %rax, %rbx
leaq 0x41bd8(%rip), %rsi     # 0x6e71f
leaq 0x18(%rsp), %rdi
callq 0xd800
movq (%rbx), %rax
movq -0x8(%rax), %rsi
leaq 0x38(%rsp), %rdi
callq 0x21030
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
leaq 0x18(%rsp), %rdi
callq 0xd180
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2cb91
movq 0x48(%rsp), %rsi
incq %rsi
callq 0xd530
leaq 0x46a8f(%rip), %rsi     # 0x73627
leaq 0x18(%rsp), %rdi
callq 0xdb40
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
leaq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0xdb40
leaq 0x407ff(%rip), %rsi     # 0x6d3be
leaq 0x18(%rsp), %rdi
callq 0xdb40
callq 0xd9e0
jmp 0x2c78e
leaq 0x41abe(%rip), %rsi     # 0x6e698
leaq 0x18(%rsp), %rdi
callq 0xd800
callq 0xd9e0
jmp 0x2c78e
movq %rax, %rbx
callq 0xd9e0
jmp 0x2cc33
jmp 0x2cc30
movq %rax, %rbx
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2cc21
movq 0x48(%rsp), %rsi
incq %rsi
callq 0xd530
jmp 0x2cc21
jmp 0x2cc1e
jmp 0x2cc30
movq %rax, %rbx
callq 0xd9e0
jmp 0x2cc33
movq %rax, %rdi
callq 0x1536f
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x2cd63
movq 0x28(%rsp), %rsi
jmp 0x2cd56
jmp 0x2cc9f
jmp 0x2ccae
jmp 0x2ccc3
jmp 0x2cd60
jmp 0x2cce0
jmp 0x2ccef
jmp 0x2cd0f
jmp 0x2cd60
jmp 0x2cd60
jmp 0x2cc9f
jmp 0x2ccae
movq %rax, %rbx
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2cd63
movq 0xd0(%rsp), %rsi
jmp 0x2cd56
jmp 0x2ccc3
jmp 0x2cd60
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x49096
jmp 0x2ccb1
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x2ccc6
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x2ccc6
movq %rax, %rbx
movq 0x20(%rsp), %rsi
testq %rsi, %rsi
je 0x2cd63
leaq 0x20(%rsp), %rdi
jmp 0x2cd2f
jmp 0x2cd60
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x49096
jmp 0x2ccf2
movq %rax, %rbx
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2cd12
movq 0x28(%rsp), %rsi
incq %rsi
callq 0xd530
jmp 0x2cd12
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x2cd22
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x40(%rsp), %rsi
testq %rsi, %rsi
je 0x2cd63
movq %r14, %rdi
callq 0x153ca
jmp 0x2cd63
jmp 0x2cd60
jmp 0x2cd60
movq %rax, %rbx
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2cd63
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0xd530
jmp 0x2cd63
movq %rax, %rbx
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x2cd7d
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0xd530
movq %rbx, %rdi
callq 0xda70