// File: /workspace/github_cpp_makefile_star2_O2/halfflat[P]tinyopt/test/test_state.cc
// Function: state_consume_Test::TestBody()
TEST(state, consume) {
    const char* argstr = "zero\0one\0two\0three\0four\0five\0six\0";
    mockargs M(argstr);

    std::vector<char*> v0 = M.args;
    to::state s(M.argc, M.argv);

    typedef to::state::match_result MR;


    s.consume(MR{nullptr, 0, 0});
    EXPECT_EQ(7, M.argc);
    EXPECT_EQ(0, M.argv[M.argc]);
    EXPECT_EQ(v0[0], M.argv[0]+s.optoff);

    s.consume(MR{nullptr, 0, 2});
    EXPECT_EQ(7, M.argc);
    EXPECT_EQ(0, M.argv[M.argc]);
    EXPECT_EQ(v0[0]+2, M.argv[0]+s.optoff);

    s.consume(MR{nullptr, 2, 0});
    EXPECT_EQ(5, M.argc);
    EXPECT_EQ(0, M.argv[M.argc]);
    EXPECT_EQ(v0[2], M.argv[0]+s.optoff);

    s.consume(MR{nullptr, 0, 2});
    EXPECT_EQ(5, M.argc);
    EXPECT_EQ(0, M.argv[M.argc]);
    EXPECT_EQ(v0[2]+2, M.argv[0]+s.optoff);

    s.consume(MR{nullptr, 1, 1});
    EXPECT_EQ(4, M.argc);
    EXPECT_EQ(0, M.argv[M.argc]);
    EXPECT_EQ(v0[3]+1, M.argv[0]+s.optoff);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x80, %rsp
leaq 0x37b26(%rip), %rsi     # 0x58161
leaq 0x28(%rsp), %r14
movq %r14, %rdi
callq 0x2488e
leaq 0x38(%rsp), %rbx
leaq 0x68(%rsp), %rdi
movq %rbx, %rsi
callq 0x248c2
movq 0x30(%rsp), %rax
leaq 0x50(%rsp), %rdi
movq %r14, (%rdi)
movq %rax, 0x8(%rdi)
andl $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rsi
movaps %xmm0, (%rsi)
callq 0x24976
movq %rsp, %rcx
movl $0x7, (%rcx)
leaq 0x35aae(%rip), %rsi     # 0x5613d
leaq 0x3792c(%rip), %rdx     # 0x57fc2
leaq 0x10(%rsp), %rdi
movq %r14, %r8
callq 0x13a52
cmpb $0x0, 0x10(%rsp)
jne 0x20705
movq %rsp, %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x206c1
movq (%rax), %r8
jmp 0x206c8
leaq 0x389a2(%rip), %r8      # 0x5906a
leaq 0x378a5(%rip), %rdx     # 0x57f74
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x37
popq %rcx
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x20705
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x13646
movq 0x30(%rsp), %rax
movslq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %r8
leaq 0x3c624(%rip), %rsi     # 0x5cd48
leaq 0x3789e(%rip), %rdx     # 0x57fc9
leaq 0x10(%rsp), %rdi
xorl %ecx, %ecx
callq 0x2494e
cmpb $0x0, 0x10(%rsp)
jne 0x20799
movq %rsp, %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x20755
movq (%rax), %r8
jmp 0x2075c
leaq 0x3890e(%rip), %r8      # 0x5906a
leaq 0x37811(%rip), %rdx     # 0x57f74
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x38
popq %rcx
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x20799
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x13646
movq 0x68(%rsp), %rcx
movq 0x30(%rsp), %rax
movl 0x60(%rsp), %edx
addq (%rax), %rdx
movq %rsp, %r8
movq %rdx, (%r8)
leaq 0x37817(%rip), %rsi     # 0x57fd8
leaq 0x3784e(%rip), %rdx     # 0x58016
leaq 0x10(%rsp), %rdi
callq 0x250c4
cmpb $0x0, 0x10(%rsp)
jne 0x20834
movq %rsp, %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x207f0
movq (%rax), %r8
jmp 0x207f7
leaq 0x38873(%rip), %r8      # 0x5906a
leaq 0x37776(%rip), %rdx     # 0x57f74
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x39
popq %rcx
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x20834
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x13646
andq $0x0, -0x8(%r14)
movabsq $0x200000000, %r15      # imm = 0x200000000
movq %r15, (%r14)
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x24976
movq %rsp, %rcx
movl $0x7, (%rcx)
leaq 0x358cb(%rip), %rsi     # 0x5613d
leaq 0x37749(%rip), %rdx     # 0x57fc2
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %r8
callq 0x13a52
cmpb $0x0, 0x10(%rsp)
jne 0x208ea
movq %rsp, %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x208a6
movq (%rax), %r8
jmp 0x208ad
leaq 0x387bd(%rip), %r8      # 0x5906a
leaq 0x376c0(%rip), %rdx     # 0x57f74
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x3c
popq %rcx
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x208ea
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x13646
movq 0x30(%rsp), %rax
movslq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %r8
leaq 0x3c43f(%rip), %rsi     # 0x5cd48
leaq 0x376b9(%rip), %rdx     # 0x57fc9
leaq 0x10(%rsp), %rdi
xorl %ecx, %ecx
callq 0x2494e
cmpb $0x0, 0x10(%rsp)
jne 0x2097e
movq %rsp, %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x2093a
movq (%rax), %r8
jmp 0x20941
leaq 0x38729(%rip), %r8      # 0x5906a
leaq 0x3762c(%rip), %rdx     # 0x57f74
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x3d
popq %rcx
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2097e
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x13646
movq 0x68(%rsp), %rax
movq (%rax), %rax
addq $0x2, %rax
movq %rsp, %rcx
movq %rax, (%rcx)
movq 0x30(%rsp), %rax
movl 0x60(%rsp), %edx
addq (%rax), %rdx
leaq 0x8(%rsp), %r8
movq %rdx, (%r8)
leaq 0x37674(%rip), %rsi     # 0x58029
leaq 0x3765a(%rip), %rdx     # 0x58016
leaq 0x10(%rsp), %rdi
callq 0x250c4
cmpb $0x0, 0x10(%rsp)
jne 0x20a28
movq %rsp, %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x209e4
movq (%rax), %r8
jmp 0x209eb
leaq 0x3867f(%rip), %r8      # 0x5906a
leaq 0x37582(%rip), %rdx     # 0x57f74
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x3e
popq %rcx
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x20a28
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x13646
andq $0x0, -0x8(%r14)
movq $0x2, (%r14)
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x24976
movq %rsp, %rcx
movl $0x5, (%rcx)
leaq 0x3615f(%rip), %rsi     # 0x56bbf
leaq 0x3755b(%rip), %rdx     # 0x57fc2
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %r8
callq 0x13a52
cmpb $0x0, 0x10(%rsp)
jne 0x20ad8
movq %rsp, %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x20a94
movq (%rax), %r8
jmp 0x20a9b
leaq 0x385cf(%rip), %r8      # 0x5906a
leaq 0x374d2(%rip), %rdx     # 0x57f74
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x41
popq %rcx
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x20ad8
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x13646
movq 0x30(%rsp), %rax
movslq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %r8
leaq 0x3c251(%rip), %rsi     # 0x5cd48
leaq 0x374cb(%rip), %rdx     # 0x57fc9
leaq 0x10(%rsp), %rdi
xorl %ecx, %ecx
callq 0x2494e
cmpb $0x0, 0x10(%rsp)
jne 0x20b6c
movq %rsp, %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x20b28
movq (%rax), %r8
jmp 0x20b2f
leaq 0x3853b(%rip), %r8      # 0x5906a
leaq 0x3743e(%rip), %rdx     # 0x57f74
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x42
popq %rcx
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x20b6c
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x13646
movq 0x68(%rsp), %rcx
addq $0x10, %rcx
movq 0x30(%rsp), %rax
movl 0x60(%rsp), %edx
addq (%rax), %rdx
movq %rsp, %r8
movq %rdx, (%r8)
leaq 0x3746a(%rip), %rsi     # 0x58002
leaq 0x37477(%rip), %rdx     # 0x58016
leaq 0x10(%rsp), %rdi
callq 0x250c4
cmpb $0x0, 0x10(%rsp)
jne 0x20c0b
movq %rsp, %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x20bc7
movq (%rax), %r8
jmp 0x20bce
leaq 0x3849c(%rip), %r8      # 0x5906a
leaq 0x3739f(%rip), %rdx     # 0x57f74
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x43
popq %rcx
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x20c0b
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x13646
andq $0x0, -0x8(%r14)
movq %r15, (%r14)
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x24976
movq %rsp, %rcx
movl $0x5, (%rcx)
leaq 0x35f80(%rip), %rsi     # 0x56bbf
leaq 0x3737c(%rip), %rdx     # 0x57fc2
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %r8
callq 0x13a52
cmpb $0x0, 0x10(%rsp)
jne 0x20cb7
movq %rsp, %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x20c73
movq (%rax), %r8
jmp 0x20c7a
leaq 0x383f0(%rip), %r8      # 0x5906a
leaq 0x372f3(%rip), %rdx     # 0x57f74
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x46
popq %rcx
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x20cb7
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x13646
movq 0x30(%rsp), %rax
movslq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %r8
leaq 0x3c072(%rip), %rsi     # 0x5cd48
leaq 0x372ec(%rip), %rdx     # 0x57fc9
leaq 0x10(%rsp), %rdi
xorl %ecx, %ecx
callq 0x2494e
cmpb $0x0, 0x10(%rsp)
jne 0x20d4b
movq %rsp, %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x20d07
movq (%rax), %r8
jmp 0x20d0e
leaq 0x3835c(%rip), %r8      # 0x5906a
leaq 0x3725f(%rip), %rdx     # 0x57f74
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x47
popq %rcx
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x20d4b
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x13646
movq 0x68(%rsp), %rax
movq 0x10(%rax), %rax
addq $0x2, %rax
movq %rsp, %rcx
movq %rax, (%rcx)
movq 0x30(%rsp), %rax
movl 0x60(%rsp), %edx
addq (%rax), %rdx
leaq 0x8(%rsp), %r8
movq %rdx, (%r8)
leaq 0x372ae(%rip), %rsi     # 0x58031
leaq 0x3728c(%rip), %rdx     # 0x58016
leaq 0x10(%rsp), %rdi
callq 0x250c4
cmpb $0x0, 0x10(%rsp)
jne 0x20df6
movq %rsp, %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x20db2
movq (%rax), %r8
jmp 0x20db9
leaq 0x382b1(%rip), %r8      # 0x5906a
leaq 0x371b4(%rip), %rdx     # 0x57f74
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x48
popq %rcx
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x20df6
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x13646
andq $0x0, -0x8(%r14)
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, (%r14)
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x24976
movq %rsp, %rcx
movl $0x4, (%rcx)
leaq 0x37ca1(%rip), %rsi     # 0x58ad5
leaq 0x37187(%rip), %rdx     # 0x57fc2
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %r8
callq 0x13a52
cmpb $0x0, 0x10(%rsp)
jne 0x20eac
movq %rsp, %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x20e68
movq (%rax), %r8
jmp 0x20e6f
leaq 0x381fb(%rip), %r8      # 0x5906a
leaq 0x370fe(%rip), %rdx     # 0x57f74
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x4b
popq %rcx
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x20eac
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x13646
movq 0x30(%rsp), %rax
movslq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %r8
leaq 0x3be7d(%rip), %rsi     # 0x5cd48
leaq 0x370f7(%rip), %rdx     # 0x57fc9
leaq 0x10(%rsp), %rdi
xorl %ecx, %ecx
callq 0x2494e
cmpb $0x0, 0x10(%rsp)
jne 0x20f40
movq %rsp, %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x20efc
movq (%rax), %r8
jmp 0x20f03
leaq 0x38167(%rip), %r8      # 0x5906a
leaq 0x3706a(%rip), %rdx     # 0x57f74
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x4c
popq %rcx
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x20f40
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x13646
movq 0x68(%rsp), %rax
movq 0x18(%rax), %rax
incq %rax
movq %rsp, %rcx
movq %rax, (%rcx)
movq 0x30(%rsp), %rax
movl 0x60(%rsp), %edx
addq (%rax), %rdx
leaq 0x8(%rsp), %r8
movq %rdx, (%r8)
leaq 0x370c2(%rip), %rsi     # 0x58039
leaq 0x37098(%rip), %rdx     # 0x58016
leaq 0x10(%rsp), %rdi
callq 0x250c4
cmpb $0x0, 0x10(%rsp)
jne 0x20fea
movq %rsp, %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x20fa6
movq (%rax), %r8
jmp 0x20fad
leaq 0x380bd(%rip), %r8      # 0x5906a
leaq 0x36fc0(%rip), %rdx     # 0x57f74
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x4d
popq %rcx
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x20fea
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x13646
leaq 0x68(%rsp), %rdi
callq 0x25080
movq %rbx, %rdi
callq 0x25080
addq $0x80, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x21067
jmp 0x21076
jmp 0x2108a
jmp 0x21067
jmp 0x21076
jmp 0x2108a
jmp 0x21067
jmp 0x21076
jmp 0x2108a
jmp 0x21067
jmp 0x21076
jmp 0x2108a
jmp 0x21067
jmp 0x21076
jmp 0x2108a
jmp 0x21067
jmp 0x21076
jmp 0x2108a
jmp 0x21067
jmp 0x21076
jmp 0x2108a
jmp 0x21067
jmp 0x21076
jmp 0x2108a
jmp 0x21067
jmp 0x21076
jmp 0x2108a
jmp 0x21067
jmp 0x21076
jmp 0x2108a
jmp 0x21067
jmp 0x21076
jmp 0x2108a
jmp 0x21067
jmp 0x21076
jmp 0x2108a
jmp 0x21067
jmp 0x21076
jmp 0x2108a
jmp 0x21067
jmp 0x21076
jmp 0x2108a
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x3b616
jmp 0x21079
movq %rax, %r14
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2108d
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x2108d
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0x13646
jmp 0x210b8
jmp 0x210b5
jmp 0x210b5
jmp 0x210b5
jmp 0x210b5
jmp 0x210b5
jmp 0x210b5
jmp 0x210b5
jmp 0x210b5
jmp 0x210b5
jmp 0x210b5
jmp 0x210b5
jmp 0x210b5
jmp 0x210b5
jmp 0x210b5
movq %rax, %r14
leaq 0x68(%rsp), %rdi
callq 0x25080
movq %rbx, %rdi
callq 0x25080
movq %r14, %rdi
callq 0xdaa0
movq %rax, %r14
jmp 0x210c2
nop