// File: iZhangHui[P]CppPrimer/CH16_TemplatesAndGenericProgramming/exercises/TextQuery.cc
// Function: TextQuery::TextQuery(std::basic_ifstream<char, std::char_traits<char>>&)
TextQuery::TextQuery(ifstream& is):
					file(new vector<string>(), DebugDelete())
{
	string text;
	while (getline(is, text)) {
		file->push_back(text);
		int n = file->size() - 1;
		istringstream line(text);
		string word;
		while (line >> word) {
			word = cleanup_str(word);
			auto& lines = wm[word];
			if (lines == nullptr)
				lines.reset(new set<line_no>(), DebugDelete());
			lines->insert(n);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2a0, %rsp            # imm = 0x2A0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x240(%rbp)
movl $0x18, %edi
callq 0x21d0
movq %rax, %rdi
movq %rdi, -0x248(%rbp)
xorl %esi, %esi
movl $0x18, %edx
callq 0x2100
movq -0x248(%rbp), %rdi
callq 0x37d0
leaq -0x18(%rbp), %rdi
movq 0xc1d3(%rip), %rsi      # 0xefc8
callq 0x37f0
movq -0x248(%rbp), %rsi
movq -0x240(%rbp), %rdi
movq -0x18(%rbp), %rdx
callq 0x3810
movq -0x240(%rbp), %rdi
addq $0x10, %rdi
movq %rdi, -0x238(%rbp)
callq 0x3850
leaq -0x38(%rbp), %rdi
callq 0x2260
movq -0x10(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x2050
movq %rax, -0x250(%rbp)
jmp 0x2e47
movq -0x250(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2240
movb %al, -0x251(%rbp)
jmp 0x2e65
movb -0x251(%rbp), %al
testb $0x1, %al
jne 0x2e74
jmp 0x30b5
movq -0x240(%rbp), %rdi
callq 0x3870
movq %rax, %rdi
leaq -0x38(%rbp), %rsi
callq 0x3890
jmp 0x2e8e
movq -0x240(%rbp), %rdi
callq 0x3870
movq %rax, %rdi
callq 0x3900
decl %eax
movl %eax, -0x48(%rbp)
leaq -0x1c8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
movl $0x8, %edx
callq 0x22c0
jmp 0x2ebe
leaq -0x1e8(%rbp), %rdi
callq 0x2260
leaq -0x1c8(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0x2250
movq %rax, -0x260(%rbp)
jmp 0x2ee6
movq -0x260(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2240
movb %al, -0x261(%rbp)
jmp 0x2f04
movb -0x261(%rbp), %al
testb $0x1, %al
jne 0x2f13
jmp 0x3098
leaq -0x208(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0x3100
jmp 0x2f28
leaq -0x1e8(%rbp), %rdi
movq %rdi, -0x278(%rbp)
leaq -0x208(%rbp), %rsi
movq %rsi, -0x280(%rbp)
callq 0x2230
movq -0x280(%rbp), %rdi
callq 0x2120
movq -0x240(%rbp), %rdi
movq -0x278(%rbp), %rsi
addq $0x10, %rdi
callq 0x3920
movq %rax, -0x270(%rbp)
jmp 0x2f75
movq -0x270(%rbp), %rax
movq %rax, -0x210(%rbp)
movq -0x210(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3a00
testb $0x1, %al
jne 0x2f9c
jmp 0x3044
movq -0x210(%rbp), %rax
movq %rax, -0x290(%rbp)
movl $0x30, %edi
callq 0x21d0
movq %rax, -0x288(%rbp)
jmp 0x2fbd
movq -0x288(%rbp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
callq 0x3a90
movq 0xbfea(%rip), %rsi      # 0xefc8
leaq -0x218(%rbp), %rdi
callq 0x37f0
jmp 0x2fec
movq -0x288(%rbp), %rsi
movq -0x290(%rbp), %rdi
movq -0x218(%rbp), %rdx
callq 0x3a30
jmp 0x3008
jmp 0x3044
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x30c7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x2120
leaq -0x1c8(%rbp), %rdi
callq 0x20e0
jmp 0x30c7
movq -0x210(%rbp), %rdi
callq 0x3ab0
movq %rax, %rdi
movslq -0x48(%rbp), %rax
movq %rax, -0x220(%rbp)
leaq -0x220(%rbp), %rsi
callq 0x3ad0
movb %dl, -0x299(%rbp)
movq %rax, -0x298(%rbp)
jmp 0x3079
movb -0x299(%rbp), %al
movq -0x298(%rbp), %rcx
movq %rcx, -0x230(%rbp)
movb %al, -0x228(%rbp)
jmp 0x2eca
leaq -0x1e8(%rbp), %rdi
callq 0x2120
leaq -0x1c8(%rbp), %rdi
callq 0x20e0
jmp 0x2e31
leaq -0x38(%rbp), %rdi
callq 0x2120
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbp
retq
leaq -0x38(%rbp), %rdi
callq 0x2120
movq -0x238(%rbp), %rdi
callq 0x2a00
movq -0x240(%rbp), %rdi
callq 0x27f0
movq -0x40(%rbp), %rdi
callq 0x22d0
nopw %cs:(%rax,%rax)