// File: /workspace/github_cpp_makefile_star2_O1/iZhangHui[P]CppPrimer/CH15_ObjectOrientedProgramming/examples/Query.cc
// Function: AndQuery::eval(TextQuery const&) const
QueryResult
AndQuery::eval(const TextQuery& text) const
{
    // virtual calls through the Query operands to get result sets for the operands
    auto left = lhs.eval(text), right = rhs.eval(text);

	// set to hold the intersection of left and right
    auto ret_lines = make_shared<set<line_no>>();  

    // writes the intersection of two ranges to a destination iterator
    // destination iterator in this call adds elements to ret
    set_intersection(left.begin(), left.end(), 
                   right.begin(), right.end(),
                   inserter(*ret_lines, ret_lines->begin()));
    return QueryResult(rep(), ret_lines, left.get_file());
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc0, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x8(%rsi), %rsi
movq (%rsi), %rax
leaq -0xa0(%rbp), %rdi
callq *0x10(%rax)
movq 0x18(%r15), %rsi
movq (%rsi), %rax
leaq -0xe0(%rbp), %rdi
movq %r14, %rdx
callq *0x10(%rax)
movl $0x40, %edi
callq 0x31d0
movq %rax, %r14
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x8(%r14)
leaq 0x635a(%rip), %rax      # 0x9bb8
movq %rax, (%r14)
leaq 0x10(%r14), %r12
movq %r14, %r9
addq $0x18, %r9
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r14)
movups %xmm0, 0x30(%r14)
movups %xmm0, 0x10(%r14)
movq %r9, 0x28(%r14)
movq %r9, 0x30(%r14)
movq $0x0, 0x38(%r14)
movq -0x80(%rbp), %rsi
movq 0x18(%rsi), %rdi
addq $0x8, %rsi
movq -0xc0(%rbp), %rcx
movq 0x18(%rcx), %rdx
addq $0x8, %rcx
movq %r12, %r8
callq 0x47a2
movq (%r15), %rax
leaq -0x60(%rbp), %rdi
movq %r15, %rsi
callq *0x18(%rax)
movq %r12, -0x40(%rbp)
movq %r14, -0x38(%rbp)
movq 0x66f3(%rip), %rax      # 0x9fc0
cmpb $0x0, (%rax)
je 0x38d8
incl 0x8(%r14)
jmp 0x38dd
lock
incl 0x8(%r14)
movq -0x70(%rbp), %rdx
movq -0x68(%rbp), %rcx
movq %rdx, -0x30(%rbp)
movq %rcx, -0x28(%rbp)
testq %rcx, %rcx
je 0x3900
cmpb $0x0, (%rax)
je 0x38fc
incl 0x8(%rcx)
jmp 0x3900
lock
incl 0x8(%rcx)
leaq -0x60(%rbp), %rsi
leaq -0x40(%rbp), %rdx
leaq -0x30(%rbp), %rcx
movq %rbx, %rdi
callq 0x3ca0
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x3922
callq 0x447c
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x3930
callq 0x447c
leaq -0x50(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3949
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x31e0
movq %r14, %rdi
callq 0x447c
movq -0xa8(%rbp), %rdi
testq %rdi, %rdi
je 0x3962
callq 0x447c
movq -0xb8(%rbp), %rdi
testq %rdi, %rdi
je 0x3973
callq 0x447c
leaq -0xd0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3992
movq -0xd0(%rbp), %rsi
incq %rsi
callq 0x31e0
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x39a0
callq 0x447c
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x39ae
callq 0x447c
leaq -0x90(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x39cd
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x31e0
movq %rbx, %rax
addq $0xc0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x39f1
callq 0x447c
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x39ff
callq 0x447c
leaq -0x50(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3a27
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x31e0
jmp 0x3a27
movq %rax, %rbx
jmp 0x3a2f
movq %rax, %rbx
jmp 0x3a3b
movq %rax, %rbx
movq %r14, %rdi
callq 0x447c
leaq -0xe0(%rbp), %rdi
callq 0x3d2a
leaq -0xa0(%rbp), %rdi
callq 0x3d2a
movq %rbx, %rdi
callq 0x32e0
nop