// File: /workspace/github_cpp_makefile_star2_O1/gkalsi[P]barbecue/test.cc
// Function: main
int main(int argc, char* argv[]) {
	BoundedBlockingQueue<int> bbq;

	vector<thread> producerThreads;
	thread consumerThread(consumer, &bbq, kNumEntries * kNumProducerThreads);

	for (int i = 0; i < kNumProducerThreads; i++) {
		producerThreads.emplace_back(producer, &bbq, kNumEntries);
	}

	consumerThread.join();
	for (int i = 0; i < kNumProducerThreads; i++) {
		producerThreads[i].join();
	}

	int nerrors = 0;
	for (const auto& result : results) {
		// Each producer thread contributes one entry.
		if (result.second != kNumProducerThreads) {
			cout << "Error. Element " << result.first << " appears " 
				 << result.second << " times, expected " << kNumProducerThreads
				 << endl;
			nerrors++;
		}
	}

	cout << "test finished with " << nerrors << " error(s)." << endl;

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rbx
movaps %xmm0, 0x40(%rbx)
movaps %xmm0, 0x30(%rbx)
movaps %xmm0, 0x20(%rbx)
movaps %xmm0, 0x10(%rbx)
movaps %xmm0, (%rbx)
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2a04
movq %r14, 0x70(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rbx)
movaps %xmm0, 0x50(%rbx)
leaq 0xa8(%rsp), %rdi
callq 0x2190
movq %r14, 0x20(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
leaq 0x8(%rsp), %rdx
movq %rbx, (%rdx)
leaq 0x2c(%rsp), %rcx
movl $0xb71b0, (%rcx)        # imm = 0xB71B0
leaq 0x21d(%rip), %rsi       # 0x2665
movq %rsp, %rdi
callq 0x274e
movl $0x32, %ebp
leaq 0x2aa(%rip), %r14       # 0x2706
leaq 0x1bbd(%rip), %r15      # 0x4020
leaq 0x10(%rsp), %r12
leaq 0x8(%rsp), %r13
movq %rbx, 0x8(%rsp)
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x27e2
decl %ebp
jne 0x246d
movq %rsp, %rdi
callq 0x21f0
xorl %ebx, %ebx
movq 0x10(%rsp), %rdi
addq %rbx, %rdi
callq 0x21f0
addq $0x8, %rbx
cmpq $0x190, %rbx            # imm = 0x190
jne 0x2491
movq 0x3ca6(%rip), %r14      # 0x6158
leaq 0x3c8f(%rip), %r13      # 0x6148
xorl %ebp, %ebp
cmpq %r13, %r14
je 0x2580
movq 0x3b0d(%rip), %r15      # 0x5fd8
leaq 0x1b6d(%rip), %rbx      # 0x403f
cmpl $0x32, 0x24(%r14)
je 0x256c
movl $0xf, %edx
movq %r15, %rdi
leaq 0x1b39(%rip), %rsi      # 0x4025
callq 0x2180
movl 0x20(%r14), %esi
movq %r15, %rdi
callq 0x2200
movq %rax, %r12
movl $0x9, %edx
movq %rax, %rdi
leaq 0x1b26(%rip), %rsi      # 0x4035
callq 0x2180
movl 0x24(%r14), %esi
movq %r12, %rdi
callq 0x20d0
movq %rax, %r12
movl $0x11, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2180
movq %r12, %rdi
movl $0x32, %esi
callq 0x2200
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
incl %ebp
movq %r14, %rdi
callq 0x20f0
movq %rax, %r14
cmpq %r13, %rax
jne 0x24d2
movq 0x3a51(%rip), %rdi      # 0x5fd8
leaq 0x1ac3(%rip), %rsi      # 0x4051
movl $0x13, %edx
callq 0x2180
movq 0x3a39(%rip), %rdi      # 0x5fd8
movl %ebp, %esi
callq 0x2200
movq %rax, %rbx
leaq 0x1ab5(%rip), %rsi      # 0x4065
movl $0xa, %edx
movq %rax, %rdi
callq 0x2180
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
cmpq $0x0, (%rsp)
jne 0x2660
leaq 0x10(%rsp), %rdi
callq 0x281a
leaq 0xa8(%rsp), %rdi
callq 0x2220
leaq 0x30(%rsp), %rdi
callq 0x2b6c
xorl %eax, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x262d
movq %rax, %rbx
jmp 0x2637
jmp 0x262d
jmp 0x262d
jmp 0x262d
movq %rax, %rbx
cmpq $0x0, (%rsp)
jne 0x2660
leaq 0x10(%rsp), %rdi
callq 0x281a
leaq 0xa8(%rsp), %rdi
callq 0x2220
leaq 0x30(%rsp), %rdi
callq 0x2b6c
movq %rbx, %rdi
callq 0x2210
callq 0x2050