// File: /workspace/github_cpp_makefile_star2_O2/halfflat[P]tinyopt/test/test_sink.cc
// Function: sink_action_explicit_Test::TestBody()
TEST(sink, action_explicit) {
    char x;
    auto setter = [&x](char c) { x = c; };
    auto firstchar = [](const char* s) { return s? to::just(s[0]): to::nothing; };

    auto a = to::action(setter, firstchar);
    EXPECT_TRUE(a("fish"));
    EXPECT_EQ('f', x);

    EXPECT_FALSE(a(nullptr));
    EXPECT_EQ('f', x);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
leaq 0x48(%rsp), %rdi
andq $0x0, 0x8(%rdi)
leaq 0x7(%rsp), %rax
movq %rax, (%rdi)
leaq 0x19a0(%rip), %rax      # 0x1324a
movq %rax, 0x18(%rdi)
leaq 0x19ab(%rip), %rax      # 0x13260
movq %rax, 0x10(%rdi)
leaq 0x448d3(%rip), %rsi     # 0x56193
callq 0x1362c
leaq 0x20(%rsp), %r14
movb %al, -0x8(%r14)
andq $0x0, (%r14)
testb %al, %al
jne 0x11953
leaq 0x8(%rsp), %rdi
callq 0x3d5f6
leaq 0x448b1(%rip), %rdx     # 0x56198
leaq 0x44821(%rip), %rcx     # 0x5610f
leaq 0x44820(%rip), %r8      # 0x56115
leaq 0x28(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x399e5
movq 0x28(%rsp), %r8
leaq 0x447a5(%rip), %rdx     # 0x560b5
leaq 0x10(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x3f
popq %rcx
callq 0x3b5b6
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x39b08
leaq 0x10(%rsp), %rdi
callq 0x3b616
leaq 0x28(%rsp), %rdi
callq 0xdbe8
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x11953
movq (%rdi), %rax
callq *0x8(%rax)
movq %r14, %rdi
callq 0x13646
leaq 0x18(%rsp), %rcx
movb $0x66, (%rcx)
leaq 0x44838(%rip), %rsi     # 0x561a2
leaq 0x4aa5d(%rip), %rdx     # 0x5c3ce
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %r8
callq 0x13c9e
cmpb $0x0, 0x28(%rsp)
jne 0x119e7
leaq 0x18(%rsp), %rdi
callq 0x3d5f6
movq 0x30(%rsp), %rax
testq %rax, %rax
je 0x119a0
movq (%rax), %r8
jmp 0x119a7
leaq 0x476c3(%rip), %r8      # 0x5906a
leaq 0x44707(%rip), %rdx     # 0x560b5
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x40
popq %rcx
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x119e7
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x30(%rsp), %rdi
callq 0x13646
leaq 0x48(%rsp), %rdi
xorl %esi, %esi
callq 0x1362c
movl %eax, %ecx
xorb $0x1, %cl
leaq 0x20(%rsp), %r14
movb %cl, -0x8(%r14)
andq $0x0, (%r14)
testb %al, %al
je 0x11a90
leaq 0x8(%rsp), %rdi
callq 0x3d5f6
leaq 0x44782(%rip), %rdx     # 0x561a6
leaq 0x446ea(%rip), %rcx     # 0x56115
leaq 0x446dd(%rip), %r8      # 0x5610f
leaq 0x28(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x399e5
movq 0x28(%rsp), %r8
leaq 0x44668(%rip), %rdx     # 0x560b5
leaq 0x10(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x42
popq %rcx
callq 0x3b5b6
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x39b08
leaq 0x10(%rsp), %rdi
callq 0x3b616
leaq 0x28(%rsp), %rdi
callq 0xdbe8
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x11a90
movq (%rdi), %rax
callq *0x8(%rax)
movq %r14, %rdi
callq 0x13646
leaq 0x18(%rsp), %rcx
movb $0x66, (%rcx)
leaq 0x446fb(%rip), %rsi     # 0x561a2
leaq 0x4a920(%rip), %rdx     # 0x5c3ce
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %r8
callq 0x13c9e
cmpb $0x0, 0x28(%rsp)
jne 0x11b24
leaq 0x18(%rsp), %rdi
callq 0x3d5f6
movq 0x30(%rsp), %rax
testq %rax, %rax
je 0x11add
movq (%rax), %r8
jmp 0x11ae4
leaq 0x47586(%rip), %r8      # 0x5906a
leaq 0x445ca(%rip), %rdx     # 0x560b5
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x43
popq %rcx
callq 0x3b5b6
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x39b08
leaq 0x8(%rsp), %rdi
callq 0x3b616
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x11b24
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x30(%rsp), %rdi
callq 0x13646
leaq 0x48(%rsp), %rdi
callq 0x1367e
addq $0x68, %rsp
popq %rbx
popq %r14
retq
jmp 0x11b4e
jmp 0x11b5d
jmp 0x11b72
jmp 0x11b7c
jmp 0x11b8b
jmp 0x11b9a
jmp 0x11baf
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3b616
jmp 0x11b60
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x11b75
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x11b75
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
jmp 0x11bb5
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3b616
jmp 0x11b8e
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xdbe8
jmp 0x11b9d
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x11bb2
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x11bb2
movq %rax, %rbx
movq %r14, %rdi
callq 0x13646
jmp 0x11bc5
jmp 0x11bc2
jmp 0x11bc2
jmp 0x11bc2
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x1367e
movq %rbx, %rdi
callq 0xdaa0
nop