// File: /workspace/github_cpp_makefile_star2_O1/iZhangHui[P]CppPrimer/CH12_DynamicMemory/exercises/ex12_32.cc
// Function: TextQuery::TextQuery(std::basic_ifstream<char, std::char_traits<char>>&)
TextQuery::TextQuery(ifstream& is)
{
	string text;
	while (getline(is, text)) {
		file.push_back(text);
		int n = file.size() - 1;
		istringstream line(text);
		string word;
		while (line >> word) {
			word = clean_str(word);
			/**
			 * if the key is not already present,
			 * a new element is created and inserted
			 * into the map for that key.
			*/
			auto& lines = wm[word];
			if (!lines)
				lines.reset(new set<line_no>);
			lines->insert(n);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movq %rsi, -0x38(%rbp)
movq %rdi, %rbx
xorl %r15d, %r15d
movq %r15, (%rdi)
movl $0x28, %edi
callq 0x21c0
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x4340(%rip), %rcx      # 0x6c88
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movq %r15, 0x20(%rax)
movq %rax, 0x8(%rbx)
movq %rcx, (%rbx)
leaq 0x10(%rbx), %r14
leaq 0x18(%rbx), %rax
movl $0x0, 0x18(%rbx)
movq %r15, 0x20(%rbx)
movq %rax, 0x28(%rbx)
movq %rax, 0x30(%rbx)
movq %rbx, -0x30(%rbp)
movq %r15, 0x38(%rbx)
leaq -0x68(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r15, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x58(%rbp), %r13
leaq -0x98(%rbp), %rbx
movq -0x38(%rbp), %rcx
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %edx
movq -0x38(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x2300
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2b2d
movq -0x30(%rbp), %rax
movq (%rax), %rdi
leaq -0x78(%rbp), %rsi
callq 0x34f4
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq (%rax), %r15
movq 0x8(%rax), %r12
leaq -0x218(%rbp), %rdi
leaq -0x78(%rbp), %rsi
movl $0x8, %edx
callq 0x22b0
subq %r15, %r12
leaq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movb $0x0, -0x48(%rbp)
shlq $0x1b, %r12
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
addq %rax, %r12
sarq $0x20, %r12
leaq -0x218(%rbp), %rdi
movq %r13, %rsi
callq 0x2230
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2af0
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2bdc
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2220
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x2a90
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x21d0
movq %r14, %rdi
movq %r13, %rsi
callq 0x32a2
movq %rax, %r15
cmpq $0x0, (%rax)
jne 0x2ad9
movl $0x30, %edi
callq 0x21c0
movq %rax, %rcx
addq $0x8, %rcx
movl $0x0, 0x8(%rax)
xorl %edx, %edx
movq %rdx, 0x10(%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %rdx, 0x28(%rax)
movq %r15, %rdi
movq %rax, %rsi
callq 0x3322
movq (%r15), %rdi
movq %r12, -0x98(%rbp)
movq %rbx, %rsi
callq 0x3e18
jmp 0x2a37
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x2b09
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x21d0
leaq -0x218(%rbp), %rdi
movq 0x4481(%rip), %rsi      # 0x6f98
callq 0x2250
leaq -0x1a0(%rbp), %rdi
callq 0x2090
jmp 0x299e
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x2b46
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x21d0
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2b5a
movq %rax, %rbx
jmp 0x2ba0
jmp 0x2b65
jmp 0x2b65
jmp 0x2b65
movq %rax, %rbx
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x2b81
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x21d0
movq 0x4410(%rip), %rsi      # 0x6f98
leaq -0x218(%rbp), %rdi
callq 0x2250
leaq -0x1a0(%rbp), %rdi
callq 0x2090
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x2bb9
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x21d0
movq %r14, %rdi
callq 0x2862
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
testq %rdi, %rdi
je 0x2bd3
callq 0x27e8
movq %rbx, %rdi
callq 0x22d0
nop