// File: /workspace/github_cpp_makefile_star2_O1/zakimjz[P]SLEUTH/treeminer.cpp
// Function: get_intersect(idlist*, idlist*, Eqnode*, Eqnode*, int, int, bool)
void get_intersect(idlist *l1, idlist *l2, Eqnode *ins, Eqnode *outs,
                   int n1depth, int n2depth, bool f2=false)
{
   static idnode *n1, *n2;

   int i1 = 0, i2 = 0;
   int e1, e2;

   //cout << "GISECT:\n";
   //cout << *l1;
   //cout << *l2;
   
   while (i1 < l1->size() && i2 < l2->size()){
      n1 = &(*l1)[i1];
      n2 = &(*l2)[i2];

      //look for matching cids
      if (n1->cid < n2->cid) i1++;
      else if (n1->cid > n2->cid) i2++;
      else{
         //cids match
         e1 = i1;
         e2 = i2;

         //check the cid end positions in it1 and it2
         while (e1 < l1->size() && (*l1)[e1].cid == n1->cid) e1++;
         while (e2 < l2->size() && (*l2)[e2].cid == n2->cid) e2++;

         //cout << "ISECT " << i1 << " " << i2 << " " << e1 << " " << e2 << endl;
         //increment support if candidate found
         if (ins) check_ins(l1, l2, ins, i1, i2, e1, e2, f2);
         if (outs) check_outs(l1, l2, outs, i1, i2, e1, e2, 
                              n1depth, n2depth);

         //restore index to end of cids
         i1 = e1;
         i2 = e2;
      }
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, 0x10(%rsp)
movq %rdx, %r11
movq (%rdi), %rax
movq 0x8(%rdi), %rdx
subq %rax, %rdx
je 0x5ac3
movq %rsi, %r15
movq %rdi, %r12
sarq $0x4, %rdx
movabsq $-0x5555555555555555, %rbx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rbx, %rdx
xorl %edi, %edi
xorl %ebp, %ebp
xorl %r13d, %r13d
movq %r11, 0x8(%rsp)
movslq %ebp, %rcx
movq (%r15), %r8
movq 0x8(%r15), %rsi
subq %r8, %rsi
sarq $0x4, %rsi
imulq %rbx, %rsi
cmpq %rcx, %rsi
jbe 0x5ac3
leaq (%rdi,%rdi,2), %r9
shlq $0x4, %r9
leaq (%rax,%r9), %rdi
movq %rdi, 0x7a7e(%rip)      # 0xd438
leaq (%rcx,%rcx,2), %r10
shlq $0x4, %r10
leaq (%r8,%r10), %rdi
movq %rdi, 0x7a73(%rip)      # 0xd440
movl (%rax,%r9), %r9d
movl (%r8,%r10), %r8d
cmpl %r8d, %r9d
jge 0x59e2
incl %r13d
jmp 0x5aa3
jle 0x59eb
incl %ebp
jmp 0x5aa3
movslq %r13d, %r10
movl %r13d, %ebx
cmpq %r10, %rdx
jbe 0x5a1a
leaq (%r10,%r10,2), %r11
shlq $0x4, %r11
addq %r11, %rax
cmpl %r9d, (%rax)
jne 0x5a12
incq %r10
addq $0x30, %rax
cmpq %r10, %rdx
ja 0x5a01
movl %r10d, %ebx
movq 0x8(%rsp), %r11
movslq %ebp, %rax
movl %ebp, %r14d
cmpq %rax, %rsi
jbe 0x5a39
cmpl %r8d, (%rdi)
jne 0x5a36
incq %rcx
addq $0x30, %rdi
cmpq %rcx, %rsi
ja 0x5a25
movl %ecx, %r14d
testq %r11, %r11
je 0x5a66
movzbl 0x50(%rsp), %eax
movq %r12, %rdi
movq %r15, %rsi
movq %r11, %rdx
movl %r13d, %ecx
movl %ebp, %r8d
movl %ebx, %r9d
pushq %rax
pushq %r14
callq 0x5523
movq 0x18(%rsp), %r11
addq $0x10, %rsp
movq 0x10(%rsp), %rdx
testq %rdx, %rdx
je 0x5a93
subq $0x18, %rsp
movq %r12, %rdi
movq %r15, %rsi
movl %r13d, %ecx
movl %ebp, %r8d
movl %ebx, %r9d
pushq %r14
callq 0x573d
movq 0x28(%rsp), %r11
addq $0x20, %rsp
movl %ebx, %r13d
movl %r14d, %ebp
movabsq $-0x5555555555555555, %rbx # imm = 0xAAAAAAAAAAAAAAAB
movslq %r13d, %rdi
movq (%r12), %rax
movq 0x8(%r12), %rdx
subq %rax, %rdx
sarq $0x4, %rdx
imulq %rbx, %rdx
cmpq %rdi, %rdx
ja 0x5989
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq