// File: /workspace/github_cpp_makefile_star2_O2/halfflat[P]tinyopt/test/test_parse.cc
// Function: parse_value_Test::TestBody()
TEST(parse, value) {
    {
        mockargs M("-s\0003\0end\0");
        char** arg = M.argv;

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

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

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

    {
        mockargs M("--long\0-123\0end\0");
        char** arg = M.argv;

        auto r = to::parse<int>(arg, "--long");
        ASSERT_TRUE(r);
        ASSERT_EQ(-123, *r);
        ASSERT_EQ(M.argv+2, arg);
    }

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

        EXPECT_THROW(to::parse<int>(arg, "--long"), to::missing_argument);
    }

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

        auto r = to::parse<int>(arg, "-s", "--long");
        ASSERT_FALSE(r);
        ASSERT_EQ(M.argv, arg);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x160, %rsp            # imm = 0x160
leaq 0x3291a(%rip), %rsi     # 0x588ef
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq 0x2488e
movq 0x8(%rbx), %rax
movq %rax, 0x30(%rsp)
leaq 0x32443(%rip), %rsi     # 0x58435
leaq 0x138(%rsp), %rdi
callq 0x1c660
leaq 0x3131a(%rip), %rcx     # 0x57320
leaq 0x8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x138(%rsp), %rdx
callq 0x274c8
leaq 0x138(%rsp), %rdi
callq 0xdbe8
movb 0x8(%rsp), %al
leaq 0x48(%rsp), %r14
movb %al, -0x8(%r14)
andq $0x0, (%r14)
testb %al, %al
je 0x26487
movq %r14, %rdi
callq 0x13646
leaq 0x40(%rsp), %rcx
movl $0x3, (%rcx)
leaq 0xc(%rsp), %r8
leaq 0x32afc(%rip), %rsi     # 0x58b5e
leaq 0x323df(%rip), %rdx     # 0x58448
leaq 0x10(%rsp), %rdi
callq 0x13a52
cmpb $0x0, 0x10(%rsp)
je 0x26507
leaq 0x18(%rsp), %rdi
callq 0x13646
movq 0x68(%rsp), %rax
addq $0x10, %rax
leaq 0x40(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x323ab(%rip), %rsi     # 0x5844b
leaq 0x31347(%rip), %rdx     # 0x573ee
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %r8
callq 0x276d1
cmpb $0x0, 0x10(%rsp)
je 0x26520
leaq 0x18(%rsp), %rdi
callq 0x13646
leaq 0x70(%rsp), %rdi
callq 0x25080
leaq 0x3281d(%rip), %rsi     # 0x588f9
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq 0x2488e
movq 0x8(%rbx), %rax
movq %rax, 0x30(%rsp)
leaq 0x20(%rsp), %r15
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
movq %r15, -0x10(%r15)
andq $0x0, -0x8(%r15)
callq 0x3d5f3
testb %al, %al
je 0x26153
leaq 0x3231e(%rip), %rsi     # 0x58435
leaq 0x110(%rsp), %rdi
callq 0x1c660
leaq 0x90(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x110(%rsp), %rdx
callq 0x27530
movb $0x0, 0x90(%rsp)
leaq 0x110(%rsp), %rdi
callq 0xdbe8
leaq 0x323e5(%rip), %rsi     # 0x5853f
leaq 0x10(%rsp), %rdi
callq 0xdb70
leaq 0x40(%rsp), %rdi
callq 0x3d5f6
movq 0x10(%rsp), %r8
leaq 0x3226d(%rip), %rdx     # 0x583e7
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x4a
popq %rcx
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x261b3
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x10(%rsp), %rdi
callq 0xdbe8
leaq 0x70(%rsp), %rdi
callq 0x25080
leaq 0x32734(%rip), %rsi     # 0x58902
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq 0x2488e
movq 0x8(%rbx), %rax
movq %rax, 0x30(%rsp)
leaq 0x31135(%rip), %rsi     # 0x57320
leaq 0xe8(%rsp), %rdi
callq 0x1c660
leaq 0x8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
callq 0x27530
leaq 0xe8(%rsp), %rdi
callq 0xdbe8
movb 0x8(%rsp), %al
leaq 0x48(%rsp), %r14
movb %al, -0x8(%r14)
andq $0x0, (%r14)
testb %al, %al
je 0x2656e
movq %r14, %rdi
callq 0x13646
leaq 0x40(%rsp), %rcx
movl $0xffffff85, (%rcx)     # imm = 0xFFFFFF85
leaq 0xc(%rsp), %r8
leaq 0x32360(%rip), %rsi     # 0x585b4
leaq 0x321ed(%rip), %rdx     # 0x58448
leaq 0x10(%rsp), %rdi
callq 0x13a52
cmpb $0x0, 0x10(%rsp)
je 0x2662d
leaq 0x18(%rsp), %rdi
callq 0x13646
movq 0x68(%rsp), %rax
addq $0x10, %rax
leaq 0x40(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x321b9(%rip), %rsi     # 0x5844b
leaq 0x31155(%rip), %rdx     # 0x573ee
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %r8
callq 0x276d1
cmpb $0x0, 0x10(%rsp)
je 0x26646
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x13646
leaq 0x70(%rsp), %rdi
callq 0x25080
leaq 0x325e3(%rip), %rsi     # 0x588b4
leaq 0x60(%rsp), %r14
movq %r14, %rdi
callq 0x2488e
movq 0x8(%r14), %rax
movq %rax, 0x30(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
movq %r15, -0x8(%rbx)
andq $0x0, (%rbx)
callq 0x3d5f3
testb %al, %al
je 0x26342
leaq 0x3101a(%rip), %rsi     # 0x57320
leaq 0xc0(%rsp), %rdi
callq 0x1c660
leaq 0x88(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x27530
movb $0x0, 0x88(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0xdbe8
leaq 0x3235f(%rip), %rsi     # 0x586a8
leaq 0x10(%rsp), %rdi
callq 0xdb70
leaq 0x40(%rsp), %rdi
callq 0x3d5f6
movq 0x10(%rsp), %r8
leaq 0x3207e(%rip), %rdx     # 0x583e7
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x5b
popq %rcx
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x263a2
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x10(%rsp), %rdi
callq 0xdbe8
leaq 0x70(%rsp), %rdi
callq 0x25080
leaq 0x32527(%rip), %rsi     # 0x588e4
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq 0x2488e
movq 0x8(%rbx), %rax
movq %rax, 0x30(%rsp)
leaq 0x3205b(%rip), %rsi     # 0x58435
leaq 0x98(%rsp), %rdi
callq 0x1c660
leaq 0x30f32(%rip), %rcx     # 0x57320
leaq 0x8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x98(%rsp), %rdx
callq 0x274c8
leaq 0x98(%rsp), %rdi
callq 0xdbe8
movb 0x8(%rsp), %al
movl %eax, %ecx
xorb $0x1, %cl
leaq 0x48(%rsp), %r14
movb %cl, -0x8(%r14)
andq $0x0, (%r14)
testb %al, %al
je 0x26694
movq %rsp, %rdi
callq 0x3d5f6
leaq 0x3200a(%rip), %rdx     # 0x58449
leaq 0x2fccf(%rip), %rcx     # 0x56115
leaq 0x2fcc2(%rip), %r8      # 0x5610f
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x399e5
movq 0x10(%rsp), %r8
leaq 0x31f7f(%rip), %rdx     # 0x583e7
leaq 0x38(%rsp), %rdi
pushq $0x2
popq %rsi
pushq $0x63
popq %rcx
callq 0x3b5b6
leaq 0x38(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
jmp 0x264dc
movq %rsp, %rdi
callq 0x3d5f6
leaq 0x31fb3(%rip), %rdx     # 0x58449
leaq 0x2fc72(%rip), %rcx     # 0x5610f
leaq 0x2fc71(%rip), %r8      # 0x56115
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x399e5
movq 0x10(%rsp), %r8
leaq 0x31f28(%rip), %rdx     # 0x583e7
leaq 0x38(%rsp), %rdi
pushq $0x2
popq %rsi
pushq $0x41
popq %rcx
callq 0x3b5b6
leaq 0x38(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x38(%rsp), %rdi
callq 0x3b616
leaq 0x10(%rsp), %rdi
callq 0xdbe8
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x264ff
movq (%rdi), %rax
callq *0x8(%rax)
movq %r14, %rdi
jmp 0x26611
leaq 0x40(%rsp), %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x26540
movq (%rax), %r8
jmp 0x26547
leaq 0x40(%rsp), %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x265c8
movq (%rax), %r8
jmp 0x265cf
leaq 0x32b23(%rip), %r8      # 0x5906a
leaq 0x31e99(%rip), %rdx     # 0x583e7
movq %rsp, %rdi
pushq $0x2
popq %rsi
pushq $0x42
popq %rcx
callq 0x3b5b6
movq %rsp, %rdi
leaq 0x40(%rsp), %rsi
callq 0x39b08
jmp 0x265f1
movq %rsp, %rdi
callq 0x3d5f6
leaq 0x31ecc(%rip), %rdx     # 0x58449
leaq 0x2fb8b(%rip), %rcx     # 0x5610f
leaq 0x2fb8a(%rip), %r8      # 0x56115
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x399e5
movq 0x10(%rsp), %r8
leaq 0x31e41(%rip), %rdx     # 0x583e7
leaq 0x38(%rsp), %rdi
pushq $0x2
popq %rsi
pushq $0x52
popq %rcx
callq 0x3b5b6
leaq 0x38(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
jmp 0x264dc
leaq 0x32a9b(%rip), %r8      # 0x5906a
leaq 0x31e11(%rip), %rdx     # 0x583e7
movq %rsp, %rdi
pushq $0x2
popq %rsi
pushq $0x43
popq %rcx
callq 0x3b5b6
movq %rsp, %rdi
leaq 0x40(%rsp), %rsi
callq 0x39b08
leaq 0x18(%rsp), %rbx
movq %rsp, %rdi
callq 0x3b616
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x2660e
movq (%rdi), %rax
callq *0x8(%rax)
movq %rbx, %rdi
callq 0x13646
leaq 0x70(%rsp), %rdi
callq 0x25080
addq $0x160, %rsp            # imm = 0x160
popq %rbx
popq %r14
popq %r15
retq
leaq 0x40(%rsp), %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x26666
movq (%rax), %r8
jmp 0x2666d
leaq 0x40(%rsp), %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x266e5
movq (%rax), %r8
jmp 0x266ec
leaq 0x329fd(%rip), %r8      # 0x5906a
leaq 0x31d73(%rip), %rdx     # 0x583e7
movq %rsp, %rdi
pushq $0x2
popq %rsi
pushq $0x53
popq %rcx
callq 0x3b5b6
movq %rsp, %rdi
leaq 0x40(%rsp), %rsi
callq 0x39b08
jmp 0x265f1
leaq 0x68(%rsp), %rbx
movq %r14, %rdi
callq 0x13646
leaq 0x31d99(%rip), %rsi     # 0x58441
leaq 0x30d3f(%rip), %rdx     # 0x573ee
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %r8
movq %rbx, %rcx
callq 0x276d1
cmpb $0x0, 0x10(%rsp)
jne 0x26754
leaq 0x40(%rsp), %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x26713
movq (%rax), %r8
jmp 0x2671a
leaq 0x3297e(%rip), %r8      # 0x5906a
leaq 0x31cf4(%rip), %rdx     # 0x583e7
movq %rsp, %rdi
pushq $0x2
popq %rsi
pushq $0x54
popq %rcx
callq 0x3b5b6
movq %rsp, %rdi
leaq 0x40(%rsp), %rsi
callq 0x39b08
jmp 0x265f1
leaq 0x32950(%rip), %r8      # 0x5906a
leaq 0x31cc6(%rip), %rdx     # 0x583e7
movq %rsp, %rdi
pushq $0x2
popq %rsi
pushq $0x64
popq %rcx
callq 0x3b5b6
movq %rsp, %rdi
leaq 0x40(%rsp), %rsi
callq 0x39b08
movq %rsp, %rdi
callq 0x3b616
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x26754
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
jmp 0x26611
jmp 0x26a69
jmp 0x26a76
jmp 0x26a8b
jmp 0x26a97
jmp 0x26aa6
jmp 0x26ab5
jmp 0x26aea
jmp 0x26ac9
movq %rdx, %r14
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0xdbe8
jmp 0x267d4
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
jmp 0x26ae3
jmp 0x26aea
jmp 0x26927
jmp 0x26936
jmp 0x26a69
jmp 0x26a5f
jmp 0x26a76
jmp 0x26a8b
movq %rdx, %r14
movq %rax, %rbx
movq %rbx, %rdi
cmpl $0x4, %r14d
jne 0x267ec
callq 0xd210
callq 0xda40
jmp 0x263a2
callq 0xd210
cmpl $0x2, %r14d
jne 0x2687b
movq %rax, %rbx
leaq 0x31e34(%rip), %rsi     # 0x58639
leaq 0x10(%rsp), %rdi
callq 0xdb70
movq (%rbx), %rax
movq -0x8(%rax), %rsi
leaq 0x40(%rsp), %rdi
callq 0x1d219
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xdb90
leaq 0x40(%rsp), %rdi
callq 0xdbe8
leaq 0x36e27(%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 0x30f84(%rip), %rsi     # 0x577eb
leaq 0x10(%rsp), %rdi
callq 0xdb60
callq 0xda40
jmp 0x26353
leaq 0x31d37(%rip), %rsi     # 0x585b9
leaq 0x10(%rsp), %rdi
callq 0xdb70
callq 0xda40
jmp 0x26353
movq %rax, %rbx
callq 0xda40
jmp 0x26a62
jmp 0x26a5f
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xdbe8
jmp 0x268c1
jmp 0x268be
jmp 0x26a5f
movq %rax, %rbx
callq 0xda40
jmp 0x26a62
jmp 0x26a5f
jmp 0x26a69
jmp 0x26a76
jmp 0x26a8b
jmp 0x26aea
jmp 0x26a97
jmp 0x26aa6
jmp 0x26ab5
jmp 0x26ac9
jmp 0x26aea
movq %rdx, %r14
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
callq 0xdbe8
jmp 0x2696c
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
jmp 0x26ae3
jmp 0x26aea
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3b616
jmp 0x26939
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x26a62
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x26a62
jmp 0x26a69
jmp 0x26a5f
jmp 0x26a76
jmp 0x26a8b
movq %rdx, %r14
movq %rax, %rbx
movq %rbx, %rdi
cmpl $0x3, %r14d
jne 0x26984
callq 0xd210
callq 0xda40
jmp 0x261b3
callq 0xd210
cmpl $0x2, %r14d
jne 0x26a13
movq %rax, %rbx
leaq 0x31b35(%rip), %rsi     # 0x584d2
leaq 0x10(%rsp), %rdi
callq 0xdb70
movq (%rbx), %rax
movq -0x8(%rax), %rsi
leaq 0x40(%rsp), %rdi
callq 0x1d219
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xdb90
leaq 0x40(%rsp), %rdi
callq 0xdbe8
leaq 0x36c8f(%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 0x30dec(%rip), %rsi     # 0x577eb
leaq 0x10(%rsp), %rdi
callq 0xdb60
callq 0xda40
jmp 0x26164
leaq 0x31a3a(%rip), %rsi     # 0x58454
leaq 0x10(%rsp), %rdi
callq 0xdb70
callq 0xda40
jmp 0x26164
movq %rax, %rbx
callq 0xda40
jmp 0x26a62
jmp 0x26a5f
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xdbe8
jmp 0x26a50
jmp 0x26a4d
jmp 0x26a5f
movq %rax, %rbx
callq 0xda40
jmp 0x26a62
movq %rax, %rdi
callq 0x135af
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
jmp 0x26ae3
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3b616
jmp 0x26a79
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x26a8e
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x26a8e
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
jmp 0x26acf
jmp 0x26aea
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x3b616
jmp 0x26aa9
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xdbe8
jmp 0x26ab8
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x26acc
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x26acc
movq %rax, %rbx
movq %r14, %rdi
callq 0x13646
jmp 0x26aed
jmp 0x26aea
movq %rax, %rbx
leaq 0x138(%rsp), %rdi
callq 0xdbe8
jmp 0x26aed
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x25080
movq %rbx, %rdi
callq 0xdaa0
nop