// File: /workspace/github_cpp_makefile_star2_O3/iZhangHui[P]CppPrimer/CH17_SpecializedLibraryFacilities/examples/findbook.cc
// Function: reportResults(std::istream&, std::ostream&, std::vector<std::vector<Sales_data, std::allocator<Sales_data>>, std::allocator<std::vector<Sales_data, std::allocator<Sales_data>>>> const&)
void reportResults(istream &in, ostream &os,
                   const vector<vector<Sales_data>> &files)
{
	string s;   // book to look for
	while (in >> s) {
		auto trans = findBook(files, s);  // stores that sold this book
		if (trans.empty()) {
			cout << s << " not found in any stores" << endl;
			continue;  // get the next book to look for
		}
		for (const auto &store : trans)   // for every store with a sale
			// get<n> returns the specified member from the tuple in store
			os << "store " << get<0>(store) << " sales: "
			   << accumulate(get<1>(store), get<2>(store), 
			                 Sales_data(s))
			   << endl;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rdx, -0xa0(%rbp)
movq %rsi, -0x80(%rbp)
movq %rdi, -0xa8(%rbp)
leaq -0x68(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x78(%rbp), %rbx
leaq -0x58(%rbp), %r12
leaq -0x118(%rbp), %r13
movq -0xa8(%rbp), %rdi
movq %rbx, %rsi
callq 0x2180
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x29e0
leaq -0x98(%rbp), %rdi
movq -0xa0(%rbp), %rsi
movq %rbx, %rdx
callq 0x250a
movq -0x98(%rbp), %r14
movq -0x90(%rbp), %rax
movq %rax, -0xb0(%rbp)
cmpq %rax, %r14
je 0x296a
movl $0x6, %edx
movq -0x80(%rbp), %rdi
leaq 0x2868(%rip), %rsi      # 0x5039
callq 0x2160
movq 0x10(%r14), %rsi
movq -0x80(%rbp), %rdi
callq 0x20d0
movl $0x8, %edx
movq %rax, %rdi
leaq 0x284e(%rip), %rsi      # 0x5040
movq %rax, -0xb8(%rbp)
callq 0x2160
movq (%r14), %rbx
movq 0x8(%r14), %r15
leaq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x2e32
movl $0x0, -0x38(%rbp)
movq $0x0, -0x30(%rbp)
cmpq %rbx, %r15
je 0x2887
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x465e
movq %r12, %rdi
movq %r13, %rsi
callq 0x2170
leaq -0xf8(%rbp), %rax
movups (%rax), %xmm0
leaq -0x48(%rbp), %rax
movups %xmm0, 0x10(%rax)
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x2881
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x2150
addq $0x30, %r15
jmp 0x282f
leaq -0xd8(%rbp), %rdx
movq %rdx, -0xe8(%rbp)
movq -0x58(%rbp), %rax
leaq -0x48(%rbp), %rcx
cmpq %rcx, %rax
je 0x28b6
movq %rax, -0xe8(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0xd8(%rbp)
jmp 0x28bc
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq -0x50(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq %rcx, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movb $0x0, -0x48(%rbp)
movups 0x10(%rcx), %xmm0
movups %xmm0, 0x10(%rdx)
movq -0xb8(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x46b7
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x293e
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x2957
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x2150
addq $0x18, %r14
cmpq -0xb0(%rbp), %r14
jne 0x27c1
jmp 0x29bc
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
movq 0x465f(%rip), %rdi      # 0x6fd8
callq 0x2160
movq %rax, %rbx
movl $0x18, %edx
movq %rax, %rdi
leaq 0x2690(%rip), %rsi      # 0x5020
callq 0x2160
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0x29d7
movq -0x88(%rbp), %rsi
subq %rdi, %rsi
callq 0x2150
leaq -0x78(%rbp), %rbx
jmp 0x276c
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x29f9
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x2150
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2a0d
movq %rax, %rbx
jmp 0x2a79
jmp 0x2a16
jmp 0x2a16
movq %rax, %rbx
jmp 0x2a5e
movq %rax, %rbx
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x2a45
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x2150
jmp 0x2a45
movq %rax, %rbx
leaq -0x48(%rbp), %rax
movq -0x58(%rbp), %rdi
cmpq %rax, %rdi
je 0x2a5e
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0x2a79
movq -0x88(%rbp), %rsi
subq %rdi, %rsi
callq 0x2150
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x2a92
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x2150
movq %rbx, %rdi
callq 0x21f0