// File: /workspace/github_cpp_makefile_star2_O2/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
movl %r9d, %ebp
movl %r8d, %r14d
movl %ecx, %ebx
movq %rdx, 0x10(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdi, %r13
movl %r9d, %eax
subl %ecx, %eax
movl %eax, 0x1c(%rsp)
xorl %r12d, %r12d
movl $0x0, 0xc(%rsp)
movl %ecx, %r15d
cmpl 0x60(%rsp), %r14d
jge 0x5233
movslq %r15d, %rax
movq (%r13), %rcx
imulq $0x30, %rax, %rax
leaq (%rcx,%rax), %rdx
movq %rdx, 0x82df(%rip)      # 0xd3f8
movslq %r14d, %rdx
movq 0x20(%rsp), %rsi
movq (%rsi), %rsi
imulq $0x30, %rdx, %rdx
leaq (%rsi,%rdx), %rdi
movq %rdi, 0x82cd(%rip)      # 0xd400
leaq (%rcx,%rax), %rdi
addq $0x4, %rdi
addq %rdx, %rsi
addq $0x4, %rsi
callq 0x38b2
leal -0x3(%rax), %ecx
cmpl $0x1, %ecx
ja 0x521c
cmpl $0x4, %eax
jne 0x5165
cmpb $0x0, 0x8255(%rip)      # 0xd3b4
jne 0x521c
movq 0x828c(%rip), %rdi      # 0xd3f8
movq 0x828d(%rip), %rsi      # 0xd400
callq 0x610c
testb %al, %al
je 0x521c
movl %r12d, 0xc(%rsp)
movq 0x826c(%rip), %rdx      # 0xd3f8
cmpb $0x1, 0x2c(%rdx)
jne 0x51a2
movq 0x8267(%rip), %rax      # 0xd400
movb $0x1, %r12b
cmpb $0x0, 0x2c(%rax)
jne 0x51a5
xorl %r12d, %r12d
movzbl %r12b, %r8d
cmpl $0x2, 0x1c(%rsp)
jl 0x51b9
movq 0x8249(%rip), %rdi      # 0xd400
jmp 0x51c9
movq 0x8240(%rip), %rdi      # 0xd400
cmpb $0x1, 0x81eb(%rip)      # 0xd3b2
jne 0x51ed
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 0x613e
jmp 0x5200
leaq 0x4(%rdi), %rdx
movl (%rdi), %esi
movl 0x28(%rdi), %ecx
movq 0x10(%rsp), %rdi
callq 0x6194
cmpb $0x0, 0x7fad(%rip)      # 0xd1b4
jne 0x5211
movq 0x10(%rsp), %rax
incl 0x8(%rax)
orb 0xc(%rsp), %r12b
movb $0x1, %al
movl %eax, 0xc(%rsp)
incl %r15d
xorl %eax, %eax
cmpl %ebp, %r15d
sete %al
cmovel %ebx, %r15d
addl %eax, %r14d
jmp 0x50f8
testb $0x1, 0xc(%rsp)
je 0x524b
cmpb $0x1, 0x7f73(%rip)      # 0xd1b4
jne 0x524b
movq 0x10(%rsp), %rax
incl 0x8(%rax)
testb $0x1, %r12b
je 0x5259
movq 0x10(%rsp), %rax
incl 0xc(%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq