// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x18
popq %rdi
callq 0x31e0
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x5210
leaq 0x18(%rbx), %rax
andl $0x0, 0x18(%rbx)
andq $0x0, 0x20(%rbx)
movq %rax, 0x28(%rbx)
movq %rax, 0x30(%rbx)
andq $0x0, 0x38(%rbx)
movq %rbx, -0x30(%rbp)
leaq 0x10(%rbx), %r14
leaq -0x70(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x80(%rbp), %rsi
leaq -0x60(%rbp), %r15
leaq -0xa0(%rbp), %r12
movq -0x38(%rbp), %rdi
callq 0x3050
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4b4b
movq -0x30(%rbp), %rax
movq (%rax), %rdi
leaq -0x80(%rbp), %rbx
movq %rbx, %rsi
callq 0x50be
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rcx
movq %rcx, -0x40(%rbp)
movq 0x8(%rax), %r13
leaq -0x220(%rbp), %rdi
movq %rbx, %rsi
pushq $0x8
popq %rdx
callq 0x32d0
subq -0x40(%rbp), %r13
leaq -0x50(%rbp), %rax
movq %rax, -0x60(%rbp)
andq $0x0, -0x58(%rbp)
movb $0x0, -0x50(%rbp)
shlq $0x1b, %r13
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
addq %rax, %r13
sarq $0x20, %r13
leaq -0x220(%rbp), %rdi
movq %r15, %rsi
callq 0x3240
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4b2e
movq %r12, %rdi
movq %r15, %rsi
callq 0x4bb2
movq %r15, %rdi
movq %r12, %rsi
callq 0x3230
movq %r12, %rdi
callq 0x30e0
movq %r14, %rdi
movq %r15, %rsi
callq 0x50fa
movq %rax, %rbx
movq (%rax), %rdi
testq %rdi, %rdi
jne 0x4b1a
pushq $0x30
popq %rdi
callq 0x31e0
movq %rax, %rcx
addq $0x8, %rcx
andl $0x0, 0x8(%rax)
andq $0x0, 0x10(%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
andq $0x0, 0x28(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x5164
movq (%rbx), %rdi
movq %r13, -0xa0(%rbp)
movq %r12, %rsi
callq 0x5a78
jmp 0x4a96
movq %r15, %rdi
callq 0x30e0
leaq -0x220(%rbp), %rdi
callq 0x30f0
leaq -0x80(%rbp), %rsi
jmp 0x4a1a
leaq -0x80(%rbp), %rdi
callq 0x30e0
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4b68
movq %rax, %rbx
jmp 0x4b8b
jmp 0x4b73
jmp 0x4b73
jmp 0x4b73
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x30e0
leaq -0x220(%rbp), %rdi
callq 0x30f0
leaq -0x80(%rbp), %rdi
callq 0x30e0
movq %r14, %rdi
callq 0x4902
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
callq 0x3d18
movq %rbx, %rdi
callq 0x32f0
nop