// File: /workspace/github_cpp_makefile_star2_O1/iZhangHui[P]CppPrimer/CH12_DynamicMemory/examples/TextQuery.cc
// Function: TextQuery::TextQuery(std::basic_ifstream<char, std::char_traits<char>>&)
TextQuery::TextQuery(ifstream& is): file(new vector<string>)
{
    string text;
    while (getline(is, text)) {       // for each line in the file
		file->push_back(text);        // remember this line of text
		int n = file->size() - 1;     // the current line number
		istringstream line(text);     // separate the line into words
		string word;
		while (line >> word) {        // for each word in that line
            word = cleanup_str(word);
            // if word isn't already in wm, subscripting adds a new entry
            auto& lines = wm[word]; // lines is a shared_ptr
            if (!lines) // that pointer is null the first time we see word
                lines.reset(new set<line_no>); // allocate a new set
            lines->insert(n);      // insert this line number
		}
	}
}

// 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
movl $0x18, %edi
callq 0x31d0
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
xorl %r15d, %r15d
movq %r15, 0x10(%rax)
movq %rax, (%rbx)
leaq 0x8(%rbx), %rdi
movq %rdi, -0x80(%rbp)
movq %rax, %rsi
callq 0x5b1e
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), %rbx
leaq -0xa0(%rbp), %r12
movq -0x38(%rbp), %rcx
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x31c0
movsbl %al, %edx
movq -0x38(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3310
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x5149
movq -0x30(%rbp), %rax
movq (%rax), %rdi
leaq -0x78(%rbp), %rsi
callq 0x59a0
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq (%rax), %r15
movq 0x8(%rax), %r13
leaq -0x220(%rbp), %rdi
leaq -0x78(%rbp), %rsi
movl $0x8, %edx
callq 0x32c0
subq %r15, %r13
leaq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movb $0x0, -0x48(%rbp)
shlq $0x1b, %r13
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
addq %rax, %r13
sarq $0x20, %r13
leaq -0x220(%rbp), %rdi
movq %rbx, %rsi
callq 0x3250
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x510c
movq %r12, %rdi
movq %rbx, %rsi
callq 0x51f6
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3240
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x50ac
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x31e0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x59ec
movq %rax, %r15
cmpq $0x0, (%rax)
jne 0x50f5
movl $0x30, %edi
callq 0x31d0
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 0x5a6c
movq (%r15), %rdi
movq %r13, -0xa0(%rbp)
movq %r12, %rsi
callq 0x63b8
jmp 0x5053
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x5125
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x31e0
leaq -0x220(%rbp), %rdi
movq 0x4e7d(%rip), %rsi      # 0x9fb0
callq 0x3270
leaq -0x1a8(%rbp), %rdi
callq 0x30a0
jmp 0x4fba
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x5162
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x31e0
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5176
movq %rax, %rbx
jmp 0x51bc
jmp 0x5181
jmp 0x5181
jmp 0x5181
movq %rax, %rbx
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x519d
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x31e0
movq 0x4e0c(%rip), %rsi      # 0x9fb0
leaq -0x220(%rbp), %rdi
callq 0x3270
leaq -0x1a8(%rbp), %rdi
callq 0x30a0
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x51d5
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x31e0
movq %r14, %rdi
callq 0x4e92
movq -0x80(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x51ee
callq 0x447c
movq %rbx, %rdi
callq 0x32e0