// File: 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 %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x8(%rbp)
leaq -0x9(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rsi
leaq -0x40(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0x18db0
movq -0x150(%rbp), %rdi
leaq 0xafc82(%rip), %rsi     # 0xc84d3
callq 0x1d470
movb %al, -0x141(%rbp)
jmp 0x1885e
movb -0x141(%rbp), %al
andb $0x1, %al
movb %al, -0x61(%rbp)
xorl %eax, %eax
movl %eax, %edx
leaq -0x60(%rbp), %rdi
leaq -0x61(%rbp), %rsi
callq 0x1d4a0
jmp 0x1887c
leaq -0x60(%rbp), %rdi
callq 0x1d4e0
movb %al, -0x151(%rbp)
jmp 0x1888d
movb -0x151(%rbp), %al
testb $0x1, %al
jne 0x18899
jmp 0x188c0
jmp 0x189a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x18d9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x189fc
leaq -0x80(%rbp), %rdi
callq 0x84210
jmp 0x188cb
leaq 0xafc06(%rip), %rdx     # 0xc84d8
leaq 0xafb76(%rip), %rcx     # 0xc844f
leaq 0xafb75(%rip), %r8      # 0xc8455
leaq -0xa8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x7d210
jmp 0x188f2
leaq -0xa8(%rbp), %rdi
callq 0x102c0
movq %rax, %r8
leaq 0xafaed(%rip), %rdx     # 0xc83f5
leaq -0x88(%rbp), %rdi
movl $0x1, %esi
movl $0x3f, %ecx
callq 0x80580
jmp 0x18920
leaq -0x88(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x7d370
jmp 0x18932
leaq -0x88(%rbp), %rdi
callq 0x80600
leaq -0xa8(%rbp), %rdi
callq 0x10fc8
leaq -0x80(%rbp), %rdi
callq 0x1d500
jmp 0x189a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x18995
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x18989
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x80600
leaq -0xa8(%rbp), %rdi
callq 0x10fc8
leaq -0x80(%rbp), %rdi
callq 0x1d500
jmp 0x189fc
leaq -0x60(%rbp), %rdi
callq 0x1d520
movb $0x66, -0xb9(%rbp)
leaq 0xafb2b(%rip), %rsi     # 0xc84e2
leaq 0xb642c(%rip), %rdx     # 0xcedea
leaq -0xb8(%rbp), %rdi
leaq -0xb9(%rbp), %rcx
leaq -0x9(%rbp), %r8
callq 0x1d890
jmp 0x189d7
leaq -0xb8(%rbp), %rdi
callq 0x1d4e0
movb %al, -0x152(%rbp)
jmp 0x189eb
movb -0x152(%rbp), %al
testb $0x1, %al
jne 0x189f7
jmp 0x18a1b
jmp 0x18ac7
leaq -0x60(%rbp), %rdi
callq 0x1d520
jmp 0x18d9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x18b36
leaq -0xc8(%rbp), %rdi
callq 0x84210
jmp 0x18a29
leaq -0xb8(%rbp), %rdi
callq 0x1d620
movq %rax, -0x160(%rbp)
jmp 0x18a3e
movq -0x160(%rbp), %r8
leaq 0xaf9a9(%rip), %rdx     # 0xc83f5
leaq -0xd0(%rbp), %rdi
movl $0x1, %esi
movl $0x40, %ecx
callq 0x80580
jmp 0x18a64
leaq -0xd0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x7d370
jmp 0x18a79
leaq -0xd0(%rbp), %rdi
callq 0x80600
leaq -0xc8(%rbp), %rdi
callq 0x1d500
jmp 0x18ac7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x18ab9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x80600
leaq -0xc8(%rbp), %rdi
callq 0x1d500
jmp 0x18b36
leaq -0xb8(%rbp), %rdi
callq 0x1d520
xorl %eax, %eax
movl %eax, %esi
leaq -0x40(%rbp), %rdi
callq 0x1d470
movb %al, -0x161(%rbp)
jmp 0x18ae8
movb -0x161(%rbp), %al
notb %al
andb $0x1, %al
movb %al, -0xe1(%rbp)
xorl %eax, %eax
movl %eax, %edx
leaq -0xe0(%rbp), %rdi
leaq -0xe1(%rbp), %rsi
callq 0x1d4a0
jmp 0x18b11
leaq -0xe0(%rbp), %rdi
callq 0x1d4e0
movb %al, -0x162(%rbp)
jmp 0x18b25
movb -0x162(%rbp), %al
testb $0x1, %al
jne 0x18b31
jmp 0x18b58
jmp 0x18c47
leaq -0xb8(%rbp), %rdi
callq 0x1d520
jmp 0x18d9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x18ca6
leaq -0xf0(%rbp), %rdi
callq 0x84210
jmp 0x18b66
leaq 0xaf979(%rip), %rdx     # 0xc84e6
leaq 0xaf8e1(%rip), %rcx     # 0xc8455
leaq 0xaf8d4(%rip), %r8      # 0xc844f
leaq -0x118(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x7d210
jmp 0x18b90
leaq -0x118(%rbp), %rdi
callq 0x102c0
movq %rax, %r8
leaq 0xaf84f(%rip), %rdx     # 0xc83f5
leaq -0xf8(%rbp), %rdi
movl $0x1, %esi
movl $0x42, %ecx
callq 0x80580
jmp 0x18bbe
leaq -0xf8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x7d370
jmp 0x18bd3
leaq -0xf8(%rbp), %rdi
callq 0x80600
leaq -0x118(%rbp), %rdi
callq 0x10fc8
leaq -0xf0(%rbp), %rdi
callq 0x1d500
jmp 0x18c47
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x18c39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x18c2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x80600
leaq -0x118(%rbp), %rdi
callq 0x10fc8
leaq -0xf0(%rbp), %rdi
callq 0x1d500
jmp 0x18ca6
leaq -0xe0(%rbp), %rdi
callq 0x1d520
movb $0x66, -0x129(%rbp)
leaq 0xaf881(%rip), %rsi     # 0xc84e2
leaq 0xb6182(%rip), %rdx     # 0xcedea
leaq -0x128(%rbp), %rdi
leaq -0x129(%rbp), %rcx
leaq -0x9(%rbp), %r8
callq 0x1d890
jmp 0x18c81
leaq -0x128(%rbp), %rdi
callq 0x1d4e0
movb %al, -0x163(%rbp)
jmp 0x18c95
movb -0x163(%rbp), %al
testb $0x1, %al
jne 0x18ca1
jmp 0x18cc8
jmp 0x18d74
leaq -0xe0(%rbp), %rdi
callq 0x1d520
jmp 0x18d9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x18d92
leaq -0x138(%rbp), %rdi
callq 0x84210
jmp 0x18cd6
leaq -0x128(%rbp), %rdi
callq 0x1d620
movq %rax, -0x170(%rbp)
jmp 0x18ceb
movq -0x170(%rbp), %r8
leaq 0xaf6fc(%rip), %rdx     # 0xc83f5
leaq -0x140(%rbp), %rdi
movl $0x1, %esi
movl $0x43, %ecx
callq 0x80580
jmp 0x18d11
leaq -0x140(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x7d370
jmp 0x18d26
leaq -0x140(%rbp), %rdi
callq 0x80600
leaq -0x138(%rbp), %rdi
callq 0x1d500
jmp 0x18d74
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x18d66
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x80600
leaq -0x138(%rbp), %rdi
callq 0x1d500
jmp 0x18d92
leaq -0x128(%rbp), %rdi
callq 0x1d520
leaq -0x40(%rbp), %rdi
callq 0x1d540
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
leaq -0x128(%rbp), %rdi
callq 0x1d520
leaq -0x40(%rbp), %rdi
callq 0x1d540
movq -0x70(%rbp), %rdi
callq 0x10e00