// File: /workspace/github_cpp_makefile_star2_O3/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 0x5abc
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), %r13
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 0x50cc
movq -0x30(%rbp), %rax
movq (%rax), %rdi
leaq -0x78(%rbp), %rsi
callq 0x593e
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq (%rax), %r12
movq 0x8(%rax), %r15
leaq -0x220(%rbp), %rdi
leaq -0x78(%rbp), %rsi
movl $0x8, %edx
callq 0x32c0
subq %r12, %r15
leaq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movb $0x0, -0x48(%rbp)
shlq $0x1b, %r15
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
addq %rax, %r15
sarq $0x20, %r15
leaq -0x220(%rbp), %rdi
movq %rbx, %rsi
callq 0x3250
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x508f
movq %r13, %rdi
movq %rbx, %rsi
callq 0x517a
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3240
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x502c
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x31e0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x598a
movq %rax, %r12
movq (%rax), %rdi
testq %rdi, %rdi
jne 0x507b
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 %r12, %rdi
movq %rax, %rsi
callq 0x5a0a
movq (%r12), %rdi
movq %r15, -0xa0(%rbp)
movq %r13, %rsi
callq 0x6338
jmp 0x4fd3
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x50a8
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x31e0
leaq -0x220(%rbp), %rdi
movq 0x4efa(%rip), %rsi      # 0x9fb0
callq 0x3270
leaq -0x1a8(%rbp), %rdi
callq 0x30a0
jmp 0x4f3a
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x50e5
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 0x50f9
movq %rax, %rbx
jmp 0x513f
jmp 0x5104
jmp 0x5104
jmp 0x5104
movq %rax, %rbx
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x5120
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x31e0
movq 0x4e89(%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 0x5158
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x31e0
movq %r14, %rdi
callq 0x4e10
movq -0x80(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5171
callq 0x441a
movq %rbx, %rdi
callq 0x32e0
nop