// File: /workspace/github_cpp_makefile_star2_O1/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 0x55ad(%rip), %al       # 0x81a0
testb %al, %al
je 0x2dd0
leaq 0x10(%r14), %r12
leaq -0xc8(%rbp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x2b3a
movq %r12, %rdi
movq %r13, %rsi
callq 0x3f9a
movq %rax, %r12
leaq -0xb8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2c3e
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x21a0
leaq 0x18(%r14), %rax
cmpq %rax, %r12
je 0x2c8d
leaq -0x78(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0x88(%rbp), %rdi
callq 0x3388
movq 0x40(%r12), %rax
movq %rax, -0x48(%rbp)
movq 0x48(%r12), %rax
movq %rax, -0x40(%rbp)
testq %rax, %rax
je 0x2cde
movq 0x533d(%rip), %rcx      # 0x7fc0
cmpb $0x0, (%rcx)
je 0x2cda
incl 0x8(%rax)
jmp 0x2cde
leaq -0x98(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0xa8(%rbp), %rdi
callq 0x3388
movq 0x54db(%rip), %rax      # 0x8190
movq %rax, -0x68(%rbp)
movq 0x54d8(%rip), %rax      # 0x8198
movq %rax, -0x60(%rbp)
testq %rax, %rax
je 0x2d47
movq 0x52f0(%rip), %rcx      # 0x7fc0
cmpb $0x0, (%rcx)
je 0x2d43
incl 0x8(%rax)
jmp 0x2d47
lock
incl 0x8(%rax)
movq (%r14), %rax
movq %rax, -0x38(%rbp)
movq 0x8(%r14), %rax
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0x2d07
movq 0x52c7(%rip), %rcx      # 0x7fc0
cmpb $0x0, (%rcx)
je 0x2d03
incl 0x8(%rax)
jmp 0x2d07
lock
incl 0x8(%rax)
leaq -0x88(%rbp), %rsi
leaq -0x48(%rbp), %rdx
leaq -0x38(%rbp), %rcx
movq %rbx, %rdi
callq 0x32fe
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x2d2c
callq 0x2748
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x2d3a
callq 0x2748
movq -0x88(%rbp), %rdi
jmp 0x2daa
lock
incl 0x8(%rax)
movq (%r14), %rax
movq %rax, -0x58(%rbp)
movq 0x8(%r14), %rax
movq %rax, -0x50(%rbp)
testq %rax, %rax
je 0x2d70
movq 0x525e(%rip), %rcx      # 0x7fc0
cmpb $0x0, (%rcx)
je 0x2d6c
incl 0x8(%rax)
jmp 0x2d70
lock
incl 0x8(%rax)
leaq -0xa8(%rbp), %rsi
leaq -0x68(%rbp), %rdx
leaq -0x58(%rbp), %rcx
movq %rbx, %rdi
callq 0x32fe
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x2d95
callq 0x2748
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x2da3
callq 0x2748
movq -0xa8(%rbp), %rdi
cmpq %r13, %rdi
je 0x2dbb
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 0x53c9(%rip), %rdi      # 0x81a0
callq 0x22a0
testl %eax, %eax
je 0x2bfb
leaq 0x53a5(%rip), %rdi      # 0x8190
callq 0x3299
leaq 0xdff(%rip), %rdi       # 0x3bf6
leaq 0x5392(%rip), %rsi      # 0x8190
leaq 0x536b(%rip), %rdx      # 0x8170
callq 0x2170
leaq 0x538f(%rip), %rdi      # 0x81a0
callq 0x20f0
jmp 0x2bfb
movq %rax, %rbx
leaq 0x537b(%rip), %rdi      # 0x81a0
callq 0x20e0
jmp 0x2eb6
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x2e40
callq 0x2748
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x2e4e
callq 0x2748
movq -0xa8(%rbp), %rdi
cmpq %r13, %rdi
je 0x2eb6
movq -0x98(%rbp), %rsi
jmp 0x2eae
movq %rax, %rbx
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x2e74
callq 0x2748
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x2e82
callq 0x2748
movq -0x88(%rbp), %rdi
cmpq %r13, %rdi
je 0x2eb6
movq -0x78(%rbp), %rsi
jmp 0x2eae
movq %rax, %rbx
leaq -0xb8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2eb6
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x21a0
movq %rbx, %rdi
callq 0x2280