// File: iZhangHui[P]CppPrimer/CH15_ObjectOrientedProgramming/examples/and_orQueryTest.cc
// Function: main
int main(int argc, char **argv)
{
    // gets file to read and builds map to support queries
    TextQuery file = get_file(argc, argv);

    // iterate with the user: prompt for a word to find and print results
    while (true) {
        string sought1, sought2, sought3;
        if (!get_words(sought1, sought2)) break;
        cout << "\nenter third word: " ;
        cin  >> sought3;
        // find all the occurrences of the requested string
        Query q = Query(sought1) & Query(sought2) 
                             | Query(sought3);
        cout << "\nExecuting Query for: " << q << endl;
        const auto results = q.eval(file);
        // report matches
		print(cout, results);
     } 
     return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0xc000
jmp 0x728b
leaq -0x70(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x32e0
leaq -0x90(%rbp), %rdi
movq %rdi, -0x160(%rbp)
callq 0x32e0
leaq -0xb0(%rbp), %rdi
callq 0x32e0
movq -0x168(%rbp), %rdi
movq -0x160(%rbp), %rsi
callq 0xc1d0
movb %al, -0x151(%rbp)
jmp 0x72d5
movb -0x151(%rbp), %al
testb $0x1, %al
jne 0x7307
jmp 0x72e1
movl $0x3, -0xc0(%rbp)
jmp 0x7472
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x7567
movq 0xccba(%rip), %rdi      # 0x13fc8
leaq 0x5e13(%rip), %rsi      # 0xd128
callq 0x3220
jmp 0x731c
movq 0xccb5(%rip), %rdi      # 0x13fd8
leaq -0xb0(%rbp), %rsi
callq 0x32c0
jmp 0x7331
leaq -0xf0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x7730
jmp 0x7343
leaq -0x100(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x7730
jmp 0x7358
leaq -0xe0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
leaq -0x100(%rbp), %rdx
callq 0x7680
jmp 0x7374
leaq -0x110(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x7730
jmp 0x7389
leaq -0xd0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
leaq -0x110(%rbp), %rdx
callq 0x75d0
jmp 0x73a5
leaq -0x110(%rbp), %rdi
callq 0x4cd0
leaq -0xe0(%rbp), %rdi
callq 0x4cd0
leaq -0x100(%rbp), %rdi
callq 0x4cd0
leaq -0xf0(%rbp), %rdi
callq 0x4cd0
movq 0xcbec(%rip), %rdi      # 0x13fc8
leaq 0x5d59(%rip), %rsi      # 0xd13c
callq 0x3220
movq %rax, -0x170(%rbp)
jmp 0x73f1
movq -0x170(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x77a0
movq %rax, -0x178(%rbp)
jmp 0x740d
movq -0x178(%rbp), %rdi
movq 0xcb8d(%rip), %rsi      # 0x13fa8
callq 0x3260
jmp 0x7422
leaq -0x150(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x3e80
jmp 0x743b
movq 0xcb86(%rip), %rdi      # 0x13fc8
leaq -0x150(%rbp), %rsi
callq 0x8ea0
jmp 0x7450
leaq -0x150(%rbp), %rdi
callq 0x4210
leaq -0xd0(%rbp), %rdi
callq 0x4cd0
movl $0x0, -0xc0(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x3160
leaq -0x90(%rbp), %rdi
callq 0x3160
leaq -0x70(%rbp), %rdi
callq 0x3160
movl -0xc0(%rbp), %eax
testl %eax, %eax
je 0x74a4
jmp 0x749f
jmp 0x7593
jmp 0x7289
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x751b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x750f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x7503
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x4cd0
leaq -0xe0(%rbp), %rdi
callq 0x4cd0
leaq -0x100(%rbp), %rdi
callq 0x4cd0
leaq -0xf0(%rbp), %rdi
callq 0x4cd0
jmp 0x7567
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x755b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x4210
leaq -0xd0(%rbp), %rdi
callq 0x4cd0
leaq -0xb0(%rbp), %rdi
callq 0x3160
leaq -0x90(%rbp), %rdi
callq 0x3160
leaq -0x70(%rbp), %rdi
callq 0x3160
leaq -0x50(%rbp), %rdi
callq 0x7810
jmp 0x75b9
movl $0x0, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x7810
movl -0x4(%rbp), %eax
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
movq -0xb8(%rbp), %rdi
callq 0x3370
nopw %cs:(%rax,%rax)
nop