// File: /workspace/github_cpp_makefile_star2_O2/zakimjz[P]SLEUTH/treeminer.cpp
// Function: enumerate_freq(Eqclass*, int)
void enumerate_freq(Eqclass *eq, int iter)
{
   TimeTracker tt;
   Eqclass *neq;
   list<Eqnode *>::iterator ni, nj;
   Eqnode *ins, *outs;
   int ni_depth, nj_depth; //required depth for induced mining
   
   if (prune_type == noprune) eq->sort_nodes(); //doesn't work with pruning

   //cout << endl << "FX " << *eq << "------ " << endl;

   for (ni = eq->nlist().begin(); ni != eq->nlist().end(); ++ni){
      eq->get_scope((*ni)->pos, ni_depth);
      neq = new Eqclass;
      neq->set_prefix(eq->prefix(),*(*ni));

      bool res;
      res = ((!mine_induced || (*ni)->isup >= MINSUPPORT) && 
             check_canonical(neq->prefix(), neq->prefix().size()-1)); 
      if (!res){
         delete neq;
         continue;
      }
      
      stats.incrlarge(iter-2);
      if (output){
         //cout << "INDUCED ";
         neq->print_prefix();
         cout << *(*ni);
      }


      tt.Start();
      for (nj = eq->nlist().begin(); nj != eq->nlist().end(); ++nj){ 
         if ((*ni)->pos < (*nj)->pos) continue;

         ins = outs = NULL;
         if ((*ni)->pos > (*nj)->pos){
            outs = test_node(iter, neq, (*nj)->val, (*nj)->pos);
         }
         else{ 
            outs = test_node(iter, neq, (*nj)->val, (*nj)->pos);
            ins = test_node(iter, neq, (*nj)->val, neq->prefix().size()-1);
         }  

         
         eq->get_scope((*nj)->pos, nj_depth);
         //cout << "prefix ";
         //eq->print_prefix();
         //cout << " -- " << flush << *(*nj) << " ,,, " <<  sss << endl;
         
         if (ins || outs)
            get_intersect(&(*ni)->tlist, &(*nj)->tlist, ins, outs, 
                          ni_depth, nj_depth);

         if (outs){
            stats.incrcand(iter-1);
            //cout << "OUTS " << *outs;
            if (notfrequent(*outs, iter)) delete outs;
            else{
               neq->add_node(outs);
               //if (!mine_induced || outs->isup >= MINSUPPORT)
               //   stats.incrlarge(iter-1);
            }
         }
         if (ins){
            // cout << "INS " << *ins;
            stats.incrcand(iter-1);
            if (notfrequent(*ins, iter)) delete ins;
            else{
               neq->add_node(ins);
               //if (!mine_induced)
               //   stats.incrlarge(iter-1);
            }
         }
      }
      stats.incrtime(iter-1, tt.Stop());
      if (!neq->nlist().empty()){
//          if (output){
//             if (mine_induced) neq->print(true);
//             else neq->print();
//          }
         
         if (prune_type == prune) FK.add(iter,neq);
         enumerate_freq(neq, iter+1);
      }
      delete neq;
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %esi, %ebx
movq %rdi, %r15
movb $0x0, 0x80(%rsp)
cmpl $0x0, 0x7ba1(%rip)      # 0xd3c0
jne 0x5829
movq %r15, %rdi
callq 0x61ee
leaq 0x18(%r15), %r13
leal -0x2(%rbx), %eax
movl %eax, 0x30(%rsp)
leal -0x1(%rbx), %eax
movl %eax, 0x1c(%rsp)
movq %rbx, 0x38(%rsp)
leal 0x1(%rbx), %eax
movl %eax, 0x2c(%rsp)
leaq 0x34(%rsp), %rbx
pushq $0x30
popq %r14
leaq 0x60(%rsp), %r12
movq %r13, %rcx
movq %r13, 0x50(%rsp)
movq %r15, 0x48(%rsp)
movq (%rcx), %rcx
cmpq %r13, %rcx
je 0x5b25
movq 0x10(%rcx), %rax
movl 0x4(%rax), %esi
movq %r15, %rdi
movq %rbx, %rdx
movq %rcx, %rbp
callq 0x35e8
movq %r14, %rdi
callq 0x2170
andq $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
leaq 0x18(%rax), %rcx
movq %rcx, 0x20(%rax)
movq %rcx, 0x40(%rsp)
movq %rcx, 0x18(%rax)
andq $0x0, 0x28(%rax)
movq %rbp, 0x10(%rsp)
movq 0x10(%rbp), %rdx
movq %rax, %rbp
movq %rax, %rdi
movq %r15, %rsi
callq 0x362e
cmpb $0x1, 0x7ae9(%rip)      # 0xd3b3
jne 0x58e4
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
movl 0xc(%rax), %eax
cmpl 0x78d2(%rip), %eax      # 0xd1b0
jl 0x5b08
movq 0x8(%rbp), %rsi
subq (%rbp), %rsi
shrq $0x2, %rsi
decl %esi
movq %rbp, %rdi
callq 0x544c
testb %al, %al
je 0x5b08
leaq 0x7a7f(%rip), %rdi      # 0xd388
movl 0x30(%rsp), %esi
pushq $0x1
popq %rdx
callq 0x3ee0
cmpb $0x1, 0x7a94(%rip)      # 0xd3b0
jne 0x5941
movq %rbp, %rdi
movq 0x76a8(%rip), %rbx      # 0xcfd0
movq %rbx, %rsi
callq 0x369c
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rsi
movq %rbx, %rdi
callq 0x34b7
movq %rbp, 0x20(%rsp)
movq %r12, %rdi
callq 0x605c
movq %r13, %r14
movq 0x10(%rsp), %rcx
movq (%r14), %r14
cmpq %r13, %r14
je 0x5aaa
movq 0x10(%rcx), %rax
movl 0x4(%rax), %ebx
movq 0x10(%r14), %rax
movl 0x4(%rax), %ebp
cmpl %ebp, %ebx
jl 0x5956
movl (%rax), %edx
movq 0x38(%rsp), %r15
movl %r15d, %edi
movq 0x20(%rsp), %r13
movq %r13, %rsi
movl %ebp, %ecx
callq 0x550f
movq %rax, %r12
cmpl %ebp, %ebx
jle 0x5998
xorl %ebp, %ebp
jmp 0x59ba
movq 0x10(%r14), %rax
movl (%rax), %edx
movq 0x8(%r13), %rcx
subq (%r13), %rcx
shrq $0x2, %rcx
decl %ecx
movl %r15d, %edi
movq %r13, %rsi
callq 0x550f
movq %rax, %rbp
movq 0x10(%r14), %rax
movl 0x4(%rax), %esi
movq 0x48(%rsp), %r15
movq %r15, %rdi
leaq 0x5c(%rsp), %rdx
callq 0x35e8
movq %r12, %rax
orq %rbp, %rax
movq 0x50(%rsp), %r13
movq 0x10(%rsp), %rcx
je 0x5956
movq 0x10(%rcx), %rdi
addq $0x10, %rdi
movq 0x10(%r14), %rsi
addq $0x10, %rsi
andl $0x0, (%rsp)
movq %rbp, %rdx
movq %r12, %rcx
callq 0x5268
testq %r12, %r12
je 0x5a53
leaq 0x7974(%rip), %rdi      # 0xd388
movl 0x1c(%rsp), %esi
pushq $0x1
popq %rdx
callq 0x3e98
movl 0x8(%r12), %eax
cmpl 0x7785(%rip), %eax      # 0xd1b0
jge 0x5a46
movq %r12, %rdi
addq $0x10, %rdi
callq 0x3be8
movq %r12, %rdi
pushq $0x28
popq %rsi
callq 0x2180
jmp 0x5a53
movq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x3592
testq %rbp, %rbp
movq 0x10(%rsp), %rcx
je 0x5956
leaq 0x7920(%rip), %rdi      # 0xd388
movl 0x1c(%rsp), %esi
pushq $0x1
popq %rdx
callq 0x3e98
movl 0x8(%rbp), %eax
cmpl 0x7733(%rip), %eax      # 0xd1b0
jge 0x5a98
leaq 0x10(%rbp), %rdi
callq 0x3be8
movq %rbp, %rdi
pushq $0x28
popq %rsi
callq 0x2180
jmp 0x5951
movq 0x20(%rsp), %rdi
movq %rbp, %rsi
callq 0x3592
jmp 0x5951
leaq 0x60(%rsp), %r12
movq %r12, %rdi
callq 0x60a2
leaq 0x78ca(%rip), %rdi      # 0xd388
movl 0x1c(%rsp), %esi
callq 0x3f28
movq 0x40(%rsp), %rax
cmpq %rax, (%rax)
leaq 0x34(%rsp), %rbx
pushq $0x30
popq %r14
movq 0x20(%rsp), %rbp
je 0x5b08
cmpl $0x1, 0x78da(%rip)      # 0xd3c0
jne 0x5afc
leaq 0x78d9(%rip), %rdi      # 0xd3c8
movq 0x38(%rsp), %rsi
movq %rbp, %rdx
callq 0x7250
movq %rbp, %rdi
movl 0x2c(%rsp), %esi
callq 0x57fa
movq %rbp, %rdi
callq 0x3512
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2180
movq 0x10(%rsp), %rcx
jmp 0x5862
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq