// File: /workspace/github_cpp_makefile_star2_O3/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 0x63ec(%rip), %rax      # 0x9bf0
movq %rax, (%r14)
leaq 0x10(%r14), %r12
movq %r14, %r9
addq $0x18, %r9
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r14)
xorl %eax, %eax
movq %rax, 0x20(%r14)
movq %r9, 0x28(%r14)
movq %r9, 0x30(%r14)
movq %rax, 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 0x4722
movq (%r15), %rax
leaq -0x60(%rbp), %rdi
movq %r15, %rsi
callq *0x18(%rax)
movq %r12, -0x40(%rbp)
movq %r14, -0x38(%rbp)
movq 0x6755(%rip), %rax      # 0x9fc0
cmpb $0x0, (%rax)
je 0x3876
incl 0x8(%r14)
jmp 0x387b
lock
incl 0x8(%r14)
movq -0x70(%rbp), %rdx
movq -0x68(%rbp), %rcx
movq %rdx, -0x30(%rbp)
movq %rcx, -0x28(%rbp)
testq %rcx, %rcx
je 0x389e
cmpb $0x0, (%rax)
je 0x389a
incl 0x8(%rcx)
jmp 0x389e
lock
incl 0x8(%rcx)
leaq -0x60(%rbp), %rsi
leaq -0x40(%rbp), %rdx
leaq -0x30(%rbp), %rcx
movq %rbx, %rdi
callq 0x3c3e
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x38c0
callq 0x441a
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x38ce
callq 0x441a
leaq -0x50(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x38e7
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x31e0
movq %r14, %rdi
callq 0x441a
movq -0xa8(%rbp), %rdi
testq %rdi, %rdi
je 0x3900
callq 0x441a
movq -0xb8(%rbp), %rdi
testq %rdi, %rdi
je 0x3911
callq 0x441a
leaq -0xd0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3930
movq -0xd0(%rbp), %rsi
incq %rsi
callq 0x31e0
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x393e
callq 0x441a
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x394c
callq 0x441a
leaq -0x90(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x396b
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 0x398f
callq 0x441a
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x399d
callq 0x441a
leaq -0x50(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x39c5
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x31e0
jmp 0x39c5
movq %rax, %rbx
jmp 0x39cd
movq %rax, %rbx
jmp 0x39d9
movq %rax, %rbx
movq %r14, %rdi
callq 0x441a
leaq -0xe0(%rbp), %rdi
callq 0x3cc8
leaq -0xa0(%rbp), %rdi
callq 0x3cc8
movq %rbx, %rdi
callq 0x32e0
nop