// File: suyash[P]chan/chan_test.cc
// Function: buffered_chan_communication_test_Test::TestBody()
TEST(buffered_chan, communication_test) {
	std::string a = "not hello, world";
	chan::buffered_chan<int> c(10);
	int _ = 0;

	auto f = [&]() {
		a = "hello, world";

		c << _;
	};

	std::thread t(f);

	// this will block until the thread sends something across c
	c >> _;

	ASSERT_STREQ("hello, world", a.c_str());

	t.join();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x8(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0x160(%rbp)
callq 0xabd0
movq -0x160(%rbp), %rdx
leaq 0xc81f(%rip), %rsi      # 0x5387c
leaq -0x28(%rbp), %rdi
callq 0xa950
jmp 0x47068
leaq -0x29(%rbp), %rdi
callq 0xa680
leaq -0x108(%rbp), %rdi
movl $0xa, %esi
callq 0x4c3c0
jmp 0x47084
movl $0x0, -0x10c(%rbp)
leaq -0x28(%rbp), %rax
movq %rax, -0x128(%rbp)
leaq -0x108(%rbp), %rax
movq %rax, -0x120(%rbp)
leaq -0x10c(%rbp), %rax
movq %rax, -0x118(%rbp)
leaq -0x130(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x472f0
jmp 0x470ca
leaq -0x108(%rbp), %rdi
leaq -0x10c(%rbp), %rsi
callq 0x4c6c0
jmp 0x470df
leaq -0x28(%rbp), %rdi
callq 0xa230
movq %rax, %r8
leaq 0xc79b(%rip), %rsi      # 0x5388d
leaq 0xc7a3(%rip), %rdx      # 0x5389c
leaq 0xc780(%rip), %rcx      # 0x53880
leaq -0x140(%rbp), %rdi
callq 0x12700
jmp 0x4710e
leaq -0x140(%rbp), %rdi
callq 0x29610
movb %al, -0x161(%rbp)
jmp 0x47122
movb -0x161(%rbp), %al
testb $0x1, %al
jne 0x4712e
jmp 0x47191
jmp 0x47247
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x29(%rbp), %rdi
callq 0xa680
jmp 0x472d8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x472cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x472c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x472b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x472ab
leaq -0x148(%rbp), %rdi
callq 0xf670
jmp 0x4719f
leaq -0x140(%rbp), %rdi
callq 0x29630
movq %rax, -0x170(%rbp)
jmp 0x471b4
movq -0x170(%rbp), %r8
leaq 0xc687(%rip), %rdx      # 0x53849
leaq -0x150(%rbp), %rdi
movl $0x2, %esi
movl $0x81, %ecx
callq 0xc8a0
jmp 0x471da
leaq -0x150(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0xc960
jmp 0x471ef
leaq -0x150(%rbp), %rdi
callq 0xc920
leaq -0x148(%rbp), %rdi
callq 0x295f0
movl $0x1, -0x154(%rbp)
jmp 0x47251
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x47239
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x150(%rbp), %rdi
callq 0xc920
leaq -0x148(%rbp), %rdi
callq 0x295f0
jmp 0x472ab
movl $0x0, -0x154(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x292a0
movl -0x154(%rbp), %eax
testl %eax, %eax
jne 0x47281
jmp 0x47269
leaq -0x130(%rbp), %rdi
callq 0xab70
jmp 0x47277
movl $0x0, -0x154(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x4c1f0
leaq -0x108(%rbp), %rdi
callq 0x4c490
leaq -0x28(%rbp), %rdi
callq 0xad58
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
leaq -0x140(%rbp), %rdi
callq 0x292a0
leaq -0x130(%rbp), %rdi
callq 0x4c1f0
leaq -0x108(%rbp), %rdi
callq 0x4c490
leaq -0x28(%rbp), %rdi
callq 0xad58
movq -0x38(%rbp), %rdi
callq 0xabc0
nopw %cs:(%rax,%rax)