// File: /workspace/github_cpp_makefile_star2_O3/iZhangHui[P]CppPrimer/CH16_TemplatesAndGenericProgramming/exercises/TextQuery.cc
// Function: TextQuery::query(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) const
QueryResult TextQuery::query(const string& sought) const
{
	// we will return a pointer to this set if we dont't find sought
	static auto nodata = make_shared<set<line_no>>();

	// use find and not a subscript to avoid adding words to wm!
	auto loc = wm.find(cleanup_str(sought));

	if (loc == wm.end()){
		return QueryResult(sought, nodata, file);
	} else {
		return QueryResult(sought, loc->second, file);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movb 0x4595(%rip), %al       # 0x71a0
testb %al, %al
je 0x2de8
leaq 0x10(%r14), %r12
leaq -0xc8(%rbp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x2b38
movq %r12, %rdi
movq %r13, %rsi
callq 0x3f44
movq %rax, %r12
leaq -0xb8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2c56
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x21a0
leaq 0x18(%r14), %rax
cmpq %rax, %r12
je 0x2ca5
leaq -0x78(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0x88(%rbp), %rdi
callq 0x3398
movq 0x40(%r12), %rax
movq %rax, -0x48(%rbp)
movq 0x48(%r12), %rax
movq %rax, -0x40(%rbp)
testq %rax, %rax
je 0x2cf6
movq 0x4325(%rip), %rcx      # 0x6fc0
cmpb $0x0, (%rcx)
je 0x2cf2
incl 0x8(%rax)
jmp 0x2cf6
leaq -0x98(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0xa8(%rbp), %rdi
callq 0x3398
movq 0x44c3(%rip), %rax      # 0x7190
movq %rax, -0x68(%rbp)
movq 0x44c0(%rip), %rax      # 0x7198
movq %rax, -0x60(%rbp)
testq %rax, %rax
je 0x2d5f
movq 0x42d8(%rip), %rcx      # 0x6fc0
cmpb $0x0, (%rcx)
je 0x2d5b
incl 0x8(%rax)
jmp 0x2d5f
lock
incl 0x8(%rax)
movq (%r14), %rax
movq %rax, -0x38(%rbp)
movq 0x8(%r14), %rax
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0x2d1f
movq 0x42af(%rip), %rcx      # 0x6fc0
cmpb $0x0, (%rcx)
je 0x2d1b
incl 0x8(%rax)
jmp 0x2d1f
lock
incl 0x8(%rax)
leaq -0x88(%rbp), %rsi
leaq -0x48(%rbp), %rdx
leaq -0x38(%rbp), %rcx
movq %rbx, %rdi
callq 0x330e
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x2d44
callq 0x2748
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x2d52
callq 0x2748
movq -0x88(%rbp), %rdi
jmp 0x2dc2
lock
incl 0x8(%rax)
movq (%r14), %rax
movq %rax, -0x58(%rbp)
movq 0x8(%r14), %rax
movq %rax, -0x50(%rbp)
testq %rax, %rax
je 0x2d88
movq 0x4246(%rip), %rcx      # 0x6fc0
cmpb $0x0, (%rcx)
je 0x2d84
incl 0x8(%rax)
jmp 0x2d88
lock
incl 0x8(%rax)
leaq -0xa8(%rbp), %rsi
leaq -0x68(%rbp), %rdx
leaq -0x58(%rbp), %rcx
movq %rbx, %rdi
callq 0x330e
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x2dad
callq 0x2748
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x2dbb
callq 0x2748
movq -0xa8(%rbp), %rdi
cmpq %r13, %rdi
je 0x2dd3
movq (%r13), %rsi
incq %rsi
callq 0x21a0
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x43b1(%rip), %rdi      # 0x71a0
callq 0x22a0
testl %eax, %eax
je 0x2c13
leaq 0x438d(%rip), %rdi      # 0x7190
callq 0x32b1
leaq 0xdb1(%rip), %rdi       # 0x3bc0
leaq 0x437a(%rip), %rsi      # 0x7190
leaq 0x4353(%rip), %rdx      # 0x7170
callq 0x2170
leaq 0x4377(%rip), %rdi      # 0x71a0
callq 0x20f0
jmp 0x2c13
movq %rax, %rbx
leaq 0x4363(%rip), %rdi      # 0x71a0
callq 0x20e0
jmp 0x2ece
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x2e58
callq 0x2748
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x2e66
callq 0x2748
movq -0xa8(%rbp), %rdi
cmpq %r13, %rdi
je 0x2ece
movq -0x98(%rbp), %rsi
jmp 0x2ec6
movq %rax, %rbx
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x2e8c
callq 0x2748
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x2e9a
callq 0x2748
movq -0x88(%rbp), %rdi
cmpq %r13, %rdi
je 0x2ece
movq -0x78(%rbp), %rsi
jmp 0x2ec6
movq %rax, %rbx
leaq -0xb8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2ece
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x21a0
movq %rbx, %rdi
callq 0x2280