// File: /workspace/github_cpp_makefile_star2_O3/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 $0x78, %rsp
movl %esi, %r14d
movq %rdi, 0x10(%rsp)
movb $0x0, 0x70(%rsp)
cmpl $0x0, 0x73f7(%rip)      # 0xd3f0
jne 0x6019
cmpl $0x0, 0x73e6(%rip)      # 0xd3e8
je 0x6019
movq 0x10(%rsp), %rax
leaq 0x18(%rax), %rdi
leaq 0x1164(%rip), %rsi      # 0x7178
callq 0x6ee0
movq 0x10(%rsp), %rax
leaq 0x18(%rax), %rcx
movq 0x18(%rax), %rbx
movq %rcx, 0x20(%rsp)
cmpq %rcx, %rbx
je 0x631e
leal -0x2(%r14), %eax
movl %eax, 0x30(%rsp)
leal -0x1(%r14), %eax
movl %eax, 0xc(%rsp)
leal 0x1(%r14), %eax
movl %eax, 0x2c(%rsp)
leaq 0x34(%rsp), %r15
xorl %r12d, %r12d
leaq 0x50(%rsp), %rbp
movq %r14, 0x38(%rsp)
movq %rbx, 0x18(%rsp)
movq 0x10(%rbx), %rax
movl 0x4(%rax), %esi
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rdx
callq 0x396c
movl $0x30, %edi
callq 0x21d0
movq %rax, %r13
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %r12, 0x10(%rax)
addq $0x18, %rax
movq %rax, 0x20(%r13)
movq %rax, 0x40(%rsp)
movq %rax, 0x18(%r13)
movq %r12, 0x28(%r13)
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rdx
movq %r13, %rdi
movq %rbx, %rsi
movq 0x18(%rsp), %rbx
callq 0x39bc
cmpb $0x1, 0x731d(%rip)      # 0xd3e3
jne 0x60db
movq 0x10(%rbx), %rax
movl 0xc(%rax), %eax
cmpl 0x7113(%rip), %eax      # 0xd1e8
jl 0x62fb
movq 0x8(%r13), %rsi
subq (%r13), %rsi
shrq $0x2, %rsi
decl %esi
movq %r13, %rdi
callq 0x5b45
testb %al, %al
je 0x62fb
leaq 0x72b8(%rip), %rdi      # 0xd3b8
movl 0x30(%rsp), %esi
movl $0x1, %edx
callq 0x4232
cmpb $0x1, 0x72cb(%rip)      # 0xd3e0
jne 0x6135
movq %r13, %rdi
movq 0x6eaf(%rip), %r14      # 0xcfd0
movq %r14, %rsi
callq 0x3a9a
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x37b1
movq %rbp, %rdi
xorl %esi, %esi
callq 0x22d0
movb $0x1, 0x70(%rsp)
movq 0x20(%rsp), %rax
movq (%rax), %r14
cmpq %rax, %r14
je 0x629d
movq 0x10(%rbx), %rax
movl 0x4(%rax), %r15d
movq 0x10(%r14), %rax
movl 0x4(%rax), %r12d
cmpl %r12d, %r15d
jl 0x628f
movl (%rax), %edx
movq 0x38(%rsp), %rbx
movl %ebx, %edi
movq %r13, %rsi
movl %r12d, %ecx
callq 0x5c19
movq %rax, %rbp
cmpl %r12d, %r15d
jle 0x618f
xorl %r12d, %r12d
jmp 0x61b0
movq 0x10(%r14), %rax
movl (%rax), %edx
movq 0x8(%r13), %rcx
subq (%r13), %rcx
shrq $0x2, %rcx
decl %ecx
movl %ebx, %edi
movq %r13, %rsi
callq 0x5c19
movq %rax, %r12
movq 0x10(%r14), %rax
movl 0x4(%rax), %esi
movq 0x10(%rsp), %rdi
leaq 0x4c(%rsp), %rdx
callq 0x396c
movq %rbp, %rax
orq %r12, %rax
movq 0x18(%rsp), %rbx
je 0x628f
movq 0x10(%rbx), %rdi
addq $0x10, %rdi
movq 0x10(%r14), %rsi
addq $0x10, %rsi
movl $0x0, (%rsp)
movq %r12, %rdx
movq %rbp, %rcx
callq 0x593d
testq %rbp, %rbp
je 0x6244
leaq 0x71b3(%rip), %rdi      # 0xd3b8
movl 0xc(%rsp), %esi
movl $0x1, %edx
callq 0x41e4
movl 0x8(%rbp), %eax
cmpl 0x6fcc(%rip), %eax      # 0xd1e8
jge 0x6239
movq %rbp, %rdi
addq $0x10, %rdi
callq 0x3fba
movl $0x28, %esi
movq %rbp, %rdi
callq 0x21e0
jmp 0x6244
movq %r13, %rdi
movq %rbp, %rsi
callq 0x38ee
testq %r12, %r12
je 0x628f
leaq 0x7168(%rip), %rdi      # 0xd3b8
movl 0xc(%rsp), %esi
movl $0x1, %edx
callq 0x41e4
movl 0x8(%r12), %eax
cmpl 0x6f7f(%rip), %eax      # 0xd1e8
jge 0x6284
leaq 0x10(%r12), %rdi
callq 0x3fba
movl $0x28, %esi
movq %r12, %rdi
callq 0x21e0
jmp 0x628f
movq %r13, %rdi
movq %r12, %rsi
callq 0x38ee
movq (%r14), %r14
cmpq 0x20(%rsp), %r14
jne 0x6155
leaq 0x50(%rsp), %rbp
movq %rbp, %rdi
callq 0x6994
leaq 0x7107(%rip), %rdi      # 0xd3b8
movl 0xc(%rsp), %esi
callq 0x4282
movq 0x40(%rsp), %rax
cmpq %rax, (%rax)
movq 0x38(%rsp), %r14
leaq 0x34(%rsp), %r15
movl $0x0, %r12d
je 0x62fb
cmpl $0x1, 0x7115(%rip)      # 0xd3f0
jne 0x62ef
leaq 0x7114(%rip), %rdi      # 0xd3f8
movl %r14d, %esi
movq %r13, %rdx
callq 0x7c60
movq %r13, %rdi
movl 0x2c(%rsp), %esi
callq 0x5fd7
movq %r13, %rdi
callq 0x3834
movl $0x30, %esi
movq %r13, %rdi
callq 0x21e0
movq (%rbx), %rbx
cmpq 0x20(%rsp), %rbx
jne 0x605e
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq