// File: /workspace/github_cpp_makefile_star2_O3/zakimjz[P]SLEUTH/treeminer.cpp
// Function: check_outs(idlist*, idlist*, Eqnode*, int, int, int, int, int, int)
void check_outs(idlist *l1, idlist *l2, Eqnode *outs,
                int st1, int st2, int en1, int en2,
                int n1depth, int n2depth){
   static idnode *n1, *n2;
   static ival_type cmpval;

   bool found_flg = false;
   bool induced, induced_flg = false;
   bool next2;
   int pos1 = st1;
   
   //for each n2 ival find if there is a sibling to the left
   int tpos = outs->tlist.size();
   while(st2 < en2){
      n1 = &(*l1)[pos1];
      n2 = &(*l2)[st2];

      //next2 = true;
      cmpval = ival::compare(n1->itscope, n2->itscope);
      switch (cmpval){
      case sup:
         //next2 = false;
         break;
      case before: 
//          //n1 is before n2. Check if n1.par is subset of or equal to n2.par
//          if (n1->path_equal(*n2)){
//             if (en1 - st1 > 1 || use_fullpath){
//                //outs->tlist.push_back(idnode(n2->cid, n1->parscope, 
//                //                            n1->itscope.lb, n2->itscope));
//                outs->add_list(n2->cid, n1->parscope, 
//                               n1->itscope.lb, n2->itscope, n2->depth);
//             }
//             else{
//                //outs->tlist.push_back(idnode(n2->cid,n2->itscope));
//                outs->add_list(n2->cid,n2->itscope, n2->depth);
//             }
//             if (!count_unique) outs->sup++;
//             found_flg = true;
//             if (n2->depth == rdepth) induced_flg = true;
//          }
//          //next2 = false;
//          break;
      case after:
         if (mine_ordered && cmpval == after) break;
         
         //n1 is before n2. Check if n1.par is subset of or equal to n2.par
         if (n1->path_equal(*n2)){
            //if (n1->depth == n1depth && n2->depth == n2depth &&
            if(n1->induced && n2->induced)
               induced = true;
            else induced = false;
            
            if (en1 - st1 > 1 || use_fullpath){
               //outs->tlist.push_back(idnode(n2->cid, n1->parscope, 
               //                            n1->itscope.lb, n2->itscope));
               outs->add_list(n2->cid, n1->parscope, 
                              n1->itscope.lb, n2->itscope, n2->depth, induced);
            }
            else{
               //outs->tlist.push_back(idnode(n2->cid,n2->itscope));
               outs->add_list(n2->cid,n2->itscope,n2->depth, induced);
            }
            if (!count_unique) outs->sup++;
            found_flg = true;
            if (induced) induced_flg = true;
         }
         //next2 = false;         
         break;
      case sub:
         break;
      }
      if (pos1+1 == en1){ //go to next n2 ival
         pos1 = st1;
         st2++;
      }
      else pos1++; //go to next n1 ival
   }
   if (found_flg && count_unique) outs->sup++;
   if (induced_flg) outs->isup++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, 0x10(%rsp)
cmpl 0x60(%rsp), %r8d
jge 0x592e
movl %r9d, %ebp
movl %r8d, %r14d
movl %ecx, %ebx
movq %rsi, %r12
movq %rdi, %r13
movl %r9d, %eax
subl %ecx, %eax
movl %eax, 0x1c(%rsp)
movl $0x0, 0x18(%rsp)
movl %ecx, %r15d
movl $0x0, 0xc(%rsp)
movq %rsi, 0x20(%rsp)
movslq %r15d, %rax
movq (%r13), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
leaq (%rcx,%rax), %rdx
movq %rdx, 0x7c6c(%rip)      # 0xd428
movslq %r14d, %rdx
movq (%r12), %rsi
leaq (%rdx,%rdx,2), %rdx
shlq $0x4, %rdx
leaq (%rsi,%rdx), %rdi
movq %rdi, 0x7c5a(%rip)      # 0xd430
leaq (%rcx,%rax), %rdi
addq $0x4, %rdi
addq %rdx, %rsi
addq $0x4, %rsi
callq 0x3d2a
leal -0x3(%rax), %ecx
cmpl $0x1, %ecx
ja 0x58ea
cmpl $0x4, %eax
jne 0x5808
cmpb $0x0, 0x7be2(%rip)      # 0xd3e4
jne 0x58ea
movq 0x7c19(%rip), %rdx      # 0xd428
movq 0x10(%rdx), %rcx
movq 0x18(%rdx), %rax
movq 0x7c12(%rip), %rdi      # 0xd430
subq %rcx, %rax
je 0x5867
sarq $0x2, %rax
cmpq $0x1, %rax
movq %rax, %rsi
adcq $0x0, %rsi
movq 0x10(%rdi), %r8
movl (%rcx), %r9d
cmpl (%r8), %r9d
jne 0x58ea
movl $0x1, %r10d
movq %r10, %r9
cmpq %r10, %rsi
je 0x585e
movl (%rcx,%r9,4), %r11d
leaq 0x1(%r9), %r10
cmpl (%r8,%r9,4), %r11d
je 0x5848
cmpq %r9, %rax
ja 0x58ea
cmpb $0x1, 0x2c(%rdx)
jne 0x5876
movb $0x1, %r12b
cmpb $0x0, 0x2c(%rdi)
jne 0x5879
xorl %r12d, %r12d
movzbl %r12b, %r8d
cmpl $0x1, 0x1c(%rsp)
jg 0x588d
cmpb $0x1, 0x7b57(%rip)      # 0xd3e2
jne 0x58b1
movl 0x4(%rdx), %ecx
addq $0x10, %rdx
leaq 0x4(%rdi), %rax
movl (%rdi), %esi
movl 0x28(%rdi), %r9d
movl %r8d, (%rsp)
movq 0x10(%rsp), %rdi
movq %rax, %r8
callq 0x6a06
jmp 0x58c4
leaq 0x4(%rdi), %rdx
movl (%rdi), %esi
movl 0x28(%rdi), %ecx
movq 0x10(%rsp), %rdi
callq 0x6a76
cmpb $0x0, 0x7921(%rip)      # 0xd1ec
jne 0x58d5
movq 0x10(%rsp), %rax
incl 0x8(%rax)
orb 0xc(%rsp), %r12b
movb $0x1, %al
movl %eax, 0x18(%rsp)
movl %r12d, 0xc(%rsp)
movq 0x20(%rsp), %r12
incl %r15d
xorl %eax, %eax
cmpl %ebp, %r15d
sete %al
cmovel %ebx, %r15d
addl %eax, %r14d
cmpl 0x60(%rsp), %r14d
jl 0x57a2
testb $0x1, 0x18(%rsp)
je 0x591f
cmpb $0x1, 0x78d7(%rip)      # 0xd1ec
jne 0x591f
movq 0x10(%rsp), %rax
incl 0x8(%rax)
testb $0x1, 0xc(%rsp)
je 0x592e
movq 0x10(%rsp), %rax
incl 0xc(%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq