// File: 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
movq %rsp, %rbp
subq $0x90, %rsp
movb 0x10(%rbp), %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
andb $0x1, %al
movb %al, -0x29(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movslq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5480
movq -0x48(%rbp), %rcx
movq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x3d(%rbp)
jae 0xa5dc
movslq -0x34(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5480
movq %rax, %rcx
movq -0x50(%rbp), %rax
cmpq %rcx, %rax
setb %al
movb %al, -0x3d(%rbp)
movb -0x3d(%rbp), %al
testb $0x1, %al
jne 0xa5e8
jmp 0xa78f
movq -0x8(%rbp), %rdi
movslq -0x30(%rbp), %rsi
callq 0x61c0
movq %rax, 0x13e3c(%rip)     # 0x1e438
movq -0x10(%rbp), %rdi
movslq -0x34(%rbp), %rsi
callq 0x61c0
movq %rax, 0x13e30(%rip)     # 0x1e440
movq 0x13e21(%rip), %rax     # 0x1e438
movl (%rax), %eax
movq 0x13e20(%rip), %rcx     # 0x1e440
cmpl (%rcx), %eax
jge 0xa632
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xa78a
movq 0x13dff(%rip), %rax     # 0x1e438
movl (%rax), %eax
movq 0x13dfe(%rip), %rcx     # 0x1e440
cmpl (%rcx), %eax
jle 0xa654
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xa788
movl -0x30(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x3c(%rbp)
movslq -0x38(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5480
movq -0x60(%rbp), %rcx
movq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x51(%rbp)
jae 0xa6a0
movq -0x8(%rbp), %rdi
movslq -0x38(%rbp), %rsi
callq 0x61c0
movl (%rax), %eax
movq 0x13da0(%rip), %rcx     # 0x1e438
cmpl (%rcx), %eax
sete %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0xa6a9
jmp 0xa6b4
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xa660
jmp 0xa6b6
movslq -0x3c(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5480
movq -0x70(%rbp), %rcx
movq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x61(%rbp)
jae 0xa6f6
movq -0x10(%rbp), %rdi
movslq -0x3c(%rbp), %rsi
callq 0x61c0
movl (%rax), %eax
movq 0x13d52(%rip), %rcx     # 0x1e440
cmpl (%rcx), %eax
sete %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0xa6ff
jmp 0xa70a
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xa6b6
cmpq $0x0, -0x18(%rbp)
je 0xa741
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x30(%rbp), %ecx
movl -0x34(%rbp), %r8d
movl -0x38(%rbp), %r9d
movl -0x3c(%rbp), %r10d
movb -0x29(%rbp), %al
andb $0x1, %al
movl %r10d, (%rsp)
movzbl %al, %eax
movl %eax, 0x8(%rsp)
callq 0xa0d0
cmpq $0x0, -0x20(%rbp)
je 0xa77c
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x30(%rbp), %ecx
movl -0x34(%rbp), %r8d
movl -0x38(%rbp), %r9d
movl -0x3c(%rbp), %r11d
movl -0x24(%rbp), %r10d
movl -0x28(%rbp), %eax
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
callq 0xa320
movl -0x38(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0xa78a
jmp 0xa599
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax,%rax)