// File: /workspace/github_cpp_makefile_star2_O2/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 %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
pushq $0x16
popq %rbp
leaq 0x2c(%rsp), %rbx
movl %ebp, (%rbx)
leaq 0x18(%rsp), %rdi
movb $0x1, -0x8(%rdi)
andq $0x0, (%rdi)
callq 0x13646
leaq 0x8(%rsp), %rcx
movl %ebp, (%rcx)
leaq 0x4161b(%rip), %rsi     # 0x56bbb
leaq 0x41e55(%rip), %rdx     # 0x573fc
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %r8
callq 0x13a52
cmpb $0x0, (%r14)
jne 0x15617
leaq 0x8(%rsp), %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x155d6
movq (%rax), %r8
jmp 0x155dd
leaq 0x43a8d(%rip), %r8      # 0x5906a
leaq 0x41512(%rip), %rdx     # 0x56af6
movq %rsp, %rdi
pushq $0x1
popq %rsi
pushq $0x76
popq %rcx
callq 0x3b5b6
movq %rsp, %rdi
leaq 0x8(%rsp), %rsi
callq 0x39b08
movq %rsp, %rdi
callq 0x3b616
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x15617
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x13646
movb $0x1, -0x8(%rbx)
leaq 0x18(%rsp), %rdi
andq $0x0, (%rdi)
callq 0x13646
leaq 0x8(%rsp), %rcx
movl $0x16, (%rcx)
leaq 0x41573(%rip), %rsi     # 0x56bbb
leaq 0x41dad(%rip), %rdx     # 0x573fc
leaq 0x10(%rsp), %rbx
leaq 0x2c(%rsp), %r8
movq %rbx, %rdi
callq 0x13a52
cmpb $0x0, (%rbx)
jne 0x156c0
leaq 0x8(%rsp), %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x1567f
movq (%rax), %r8
jmp 0x15686
leaq 0x439e4(%rip), %r8      # 0x5906a
leaq 0x41469(%rip), %rdx     # 0x56af6
movq %rsp, %rdi
pushq $0x1
popq %rsi
pushq $0x79
popq %rcx
callq 0x3b5b6
movq %rsp, %rdi
leaq 0x8(%rsp), %rsi
callq 0x39b08
movq %rsp, %rdi
callq 0x3b616
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x156c0
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x13646
leaq 0x2c(%rsp), %r14
addl $-0x7, (%r14)
movb $0x1, -0x8(%rbx)
leaq 0x18(%rsp), %rdi
andq $0x0, (%rdi)
callq 0x13646
leaq 0x8(%rsp), %rcx
movl $0xf, (%rcx)
leaq 0x414c4(%rip), %rsi     # 0x56bbe
leaq 0x41cfb(%rip), %rdx     # 0x573fc
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %r8
callq 0x13a52
cmpb $0x0, (%rbx)
jne 0x15770
leaq 0x8(%rsp), %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x1572f
movq (%rax), %r8
jmp 0x15736
leaq 0x43934(%rip), %r8      # 0x5906a
leaq 0x413b9(%rip), %rdx     # 0x56af6
movq %rsp, %rdi
pushq $0x1
popq %rsi
pushq $0x7c
popq %rcx
callq 0x3b5b6
movq %rsp, %rdi
leaq 0x8(%rsp), %rsi
callq 0x39b08
movq %rsp, %rdi
callq 0x3b616
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x15770
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x13646
movl $0x6e, 0x2c(%rsp)
pushq $0xb
popq %rbp
leaq 0x8(%rsp), %r14
movl %ebp, 0x4(%r14)
movb $0x1, %al
movb %al, (%r14)
movb %al, -0x8(%rbx)
leaq 0x18(%rsp), %rdi
andq $0x0, (%rdi)
callq 0x13646
movl %ebp, (%rsp)
movq %r14, %rdi
callq 0x15eb2
leaq 0xc(%rsp), %r8
leaq 0x41403(%rip), %rsi     # 0x56bc1
leaq 0x413ff(%rip), %rdx     # 0x56bc4
leaq 0x10(%rsp), %rdi
movq %rsp, %rcx
callq 0x13a52
cmpb $0x0, 0x10(%rsp)
jne 0x15836
movq %rsp, %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x157f0
movq (%rax), %r8
jmp 0x157f7
leaq 0x43873(%rip), %r8      # 0x5906a
leaq 0x412f8(%rip), %rdx     # 0x56af6
leaq 0x20(%rsp), %rdi
pushq $0x1
popq %rsi
movl $0x83, %ecx
callq 0x3b5b6
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x20(%rsp), %rdi
callq 0x3b616
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x15836
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x13646
movq %rsp, %rcx
movl $0x6e, (%rcx)
leaq 0x4137f(%rip), %rsi     # 0x56bcf
leaq 0x41ba5(%rip), %rdx     # 0x573fc
leaq 0x10(%rsp), %rdi
leaq 0x2c(%rsp), %r8
callq 0x13a52
cmpb $0x0, 0x10(%rsp)
jne 0x158ca
movq %rsp, %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x15884
movq (%rax), %r8
jmp 0x1588b
leaq 0x437df(%rip), %r8      # 0x5906a
leaq 0x41264(%rip), %rdx     # 0x56af6
leaq 0x20(%rsp), %rdi
pushq $0x1
popq %rsi
movl $0x84, %ecx
callq 0x3b5b6
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x20(%rsp), %rdi
callq 0x3b616
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x158ca
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x13646
movb $0x1, -0x8(%rbx)
leaq 0x18(%rsp), %rdi
andq $0x0, (%rdi)
callq 0x13646
movq %rsp, %rcx
movl $0x6e, (%rcx)
leaq 0x412d6(%rip), %rsi     # 0x56bcf
leaq 0x41afc(%rip), %rdx     # 0x573fc
leaq 0x10(%rsp), %rdi
leaq 0x2c(%rsp), %r8
callq 0x13a52
cmpb $0x0, 0x10(%rsp)
jne 0x15973
movq %rsp, %rdi
callq 0x3d5f6
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x1592d
movq (%rax), %r8
jmp 0x15934
leaq 0x43736(%rip), %r8      # 0x5906a
leaq 0x411bb(%rip), %rdx     # 0x56af6
leaq 0x20(%rsp), %rdi
pushq $0x1
popq %rsi
movl $0x88, %ecx
callq 0x3b5b6
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x39b08
leaq 0x20(%rsp), %rdi
callq 0x3b616
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x15973
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x13646
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x15992
jmp 0x159a1
jmp 0x159da
jmp 0x15992
jmp 0x159a1
jmp 0x159da
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3b616
jmp 0x159a4
movq %rax, %rbx
movq (%rsp), %rdi
jmp 0x159cd
jmp 0x159da
jmp 0x159b6
jmp 0x159c5
jmp 0x159b6
jmp 0x159da
jmp 0x159c5
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3b616
jmp 0x159c8
jmp 0x159da
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x159dd
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x159dd
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x13646
jmp 0x159f0
jmp 0x159ed
jmp 0x159ed
movq %rax, %rbx
movq %rbx, %rdi
callq 0xdaa0