// File: /workspace/github_cpp_makefile_star2_O1/halfflat[P]tinyopt/test/test_maybe.cc
// Function: maybe_conditional_apply_arg_Test::TestBody()
TEST(maybe, conditional_apply_arg) {
    int c = 0;
    auto f = [&c](int n) { c += n; };

    EXPECT_TRUE(f << maybe<int>(22));
    EXPECT_EQ(22, c);

    EXPECT_FALSE(f << maybe<int>());
    EXPECT_EQ(22, c);

    EXPECT_TRUE(f << maybe<double>(-7));
    EXPECT_EQ(15, c);

    c = 100;
    auto g = [&c](int n) { c += n; return n+1; };

    auto r1 = g << maybe<int>(10);
    ASSERT_TRUE(r1);
    EXPECT_EQ(11, r1.value());
    EXPECT_EQ(110, c);

    auto r2 = g << maybe<int>();
    EXPECT_FALSE(r2);
    EXPECT_EQ(110, c);
}

// Assembly:
pushq %rbx
subq $0x30, %rsp
movl $0x16, %eax
leaq 0x24(%rsp), %r8
movl %eax, (%r8)
leaq 0x18(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x57474(%rip), %rsi     # 0x6eb64
leaq 0x57c95(%rip), %rdx     # 0x6f38c
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x15aba
cmpb $0x0, (%rbx)
jne 0x17767
leaq 0x18(%rsp), %rdi
callq 0x4e2e8
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x17722
movq (%rax), %r8
jmp 0x17729
leaq 0x598cf(%rip), %r8      # 0x70ff8
leaq 0x5736f(%rip), %rdx     # 0x6ea9f
movq %rsp, %rdi
movl $0x1, %esi
movl $0x76, %ecx
callq 0x4a84c
movq %rsp, %rdi
leaq 0x18(%rsp), %rsi
callq 0x481aa
movq %rsp, %rdi
callq 0x4a8b8
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x17767
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
je 0x1777b
leaq 0x10(%rsp), %rdi
callq 0x156d0
leaq 0x18(%rsp), %rcx
movl $0x16, (%rcx)
leaq 0x573d7(%rip), %rsi     # 0x6eb64
leaq 0x57bf8(%rip), %rdx     # 0x6f38c
leaq 0x8(%rsp), %rbx
leaq 0x24(%rsp), %r8
movq %rbx, %rdi
callq 0x15aba
cmpb $0x0, (%rbx)
jne 0x17809
leaq 0x18(%rsp), %rdi
callq 0x4e2e8
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x177c4
movq (%rax), %r8
jmp 0x177cb
leaq 0x5982d(%rip), %r8      # 0x70ff8
leaq 0x572cd(%rip), %rdx     # 0x6ea9f
movq %rsp, %rdi
movl $0x1, %esi
movl $0x79, %ecx
callq 0x4a84c
movq %rsp, %rdi
leaq 0x18(%rsp), %rsi
callq 0x481aa
movq %rsp, %rdi
callq 0x4a8b8
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x17809
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
je 0x1781d
leaq 0x10(%rsp), %rdi
callq 0x156d0
leaq 0x24(%rsp), %r8
addl $-0x7, (%r8)
leaq 0x18(%rsp), %rcx
movl $0xf, (%rcx)
leaq 0x5732f(%rip), %rsi     # 0x6eb67
leaq 0x57b4d(%rip), %rdx     # 0x6f38c
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x15aba
cmpb $0x0, (%rbx)
jne 0x178af
leaq 0x18(%rsp), %rdi
callq 0x4e2e8
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x1786a
movq (%rax), %r8
jmp 0x17871
leaq 0x59787(%rip), %r8      # 0x70ff8
leaq 0x57227(%rip), %rdx     # 0x6ea9f
movq %rsp, %rdi
movl $0x1, %esi
movl $0x7c, %ecx
callq 0x4a84c
movq %rsp, %rdi
leaq 0x18(%rsp), %rsi
callq 0x481aa
movq %rsp, %rdi
callq 0x4a8b8
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x178af
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
je 0x178c3
leaq 0x10(%rsp), %rdi
callq 0x156d0
movl $0x64, 0x24(%rsp)
movl $0x6e, 0x24(%rsp)
leaq 0x18(%rsp), %rdi
movb $0x1, (%rdi)
movl $0xb, %eax
movl %eax, 0x4(%rdi)
movl %eax, (%rsp)
callq 0x17fe0
leaq 0x1c(%rsp), %r8
leaq 0x57273(%rip), %rsi     # 0x6eb6a
leaq 0x5726f(%rip), %rdx     # 0x6eb6d
leaq 0x8(%rsp), %rdi
movq %rsp, %rcx
callq 0x15aba
cmpb $0x0, 0x8(%rsp)
jne 0x17971
movq %rsp, %rdi
callq 0x4e2e8
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x17929
movq (%rax), %r8
jmp 0x17930
leaq 0x596c8(%rip), %r8      # 0x70ff8
leaq 0x57168(%rip), %rdx     # 0x6ea9f
leaq 0x28(%rsp), %rdi
movl $0x1, %esi
movl $0x83, %ecx
callq 0x4a84c
leaq 0x28(%rsp), %rdi
movq %rsp, %rsi
callq 0x481aa
leaq 0x28(%rsp), %rdi
callq 0x4a8b8
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x17971
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
je 0x17985
leaq 0x10(%rsp), %rdi
callq 0x156d0
movq %rsp, %rcx
movl $0x6e, (%rcx)
leaq 0x571e3(%rip), %rsi     # 0x6eb78
leaq 0x579f0(%rip), %rdx     # 0x6f38c
leaq 0x8(%rsp), %rdi
leaq 0x24(%rsp), %r8
callq 0x15aba
cmpb $0x0, 0x8(%rsp)
jne 0x17a11
movq %rsp, %rdi
callq 0x4e2e8
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x179c9
movq (%rax), %r8
jmp 0x179d0
leaq 0x59628(%rip), %r8      # 0x70ff8
leaq 0x570c8(%rip), %rdx     # 0x6ea9f
leaq 0x28(%rsp), %rdi
movl $0x1, %esi
movl $0x84, %ecx
callq 0x4a84c
leaq 0x28(%rsp), %rdi
movq %rsp, %rsi
callq 0x481aa
leaq 0x28(%rsp), %rdi
callq 0x4a8b8
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x17a11
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
je 0x17a25
leaq 0x10(%rsp), %rdi
callq 0x156d0
movq %rsp, %rcx
movl $0x6e, (%rcx)
leaq 0x57143(%rip), %rsi     # 0x6eb78
leaq 0x57950(%rip), %rdx     # 0x6f38c
leaq 0x8(%rsp), %rdi
leaq 0x24(%rsp), %r8
callq 0x15aba
cmpb $0x0, 0x8(%rsp)
jne 0x17ab1
movq %rsp, %rdi
callq 0x4e2e8
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x17a69
movq (%rax), %r8
jmp 0x17a70
leaq 0x59588(%rip), %r8      # 0x70ff8
leaq 0x57028(%rip), %rdx     # 0x6ea9f
leaq 0x28(%rsp), %rdi
movl $0x1, %esi
movl $0x88, %ecx
callq 0x4a84c
leaq 0x28(%rsp), %rdi
movq %rsp, %rsi
callq 0x481aa
leaq 0x28(%rsp), %rdi
callq 0x4a8b8
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x17ab1
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
je 0x17ac5
leaq 0x10(%rsp), %rdi
callq 0x156d0
addq $0x30, %rsp
popq %rbx
retq
jmp 0x17ad7
jmp 0x17ae6
jmp 0x17b02
jmp 0x17ad7
jmp 0x17ae6
jmp 0x17b02
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x4a8b8
jmp 0x17ae9
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x17af8
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, (%rsp)
jmp 0x17b05
movq %rax, %rbx
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
je 0x17b19
leaq 0x10(%rsp), %rdi
callq 0x156d0
movq $0x0, 0x10(%rsp)
jmp 0x17b7b
jmp 0x17b2e
jmp 0x17b3d
jmp 0x17b2e
jmp 0x17b5b
jmp 0x17b3d
movq %rax, %rbx
movq %rsp, %rdi
callq 0x4a8b8
jmp 0x17b40
jmp 0x17b5b
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x17b50
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x18(%rsp)
jmp 0x17b5e
movq %rax, %rbx
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
je 0x17b7b
leaq 0x10(%rsp), %rdi
callq 0x156d0
jmp 0x17b7b
jmp 0x17b78
jmp 0x17b78
movq %rax, %rbx
movq %rbx, %rdi
callq 0xda70
nop