// File: /workspace/github_cpp_makefile_star2_O1/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, %r12d
movq %rdi, 0x18(%rsp)
movb $0x0, 0x70(%rsp)
cmpl $0x0, 0x73f8(%rip)      # 0xd3f0
jne 0x6018
cmpl $0x0, 0x73e7(%rip)      # 0xd3e8
je 0x6018
movq 0x18(%rsp), %rax
leaq 0x18(%rax), %rdi
leaq 0x1181(%rip), %rsi      # 0x7194
callq 0x6f04
movq 0x18(%rsp), %rax
leaq 0x18(%rax), %rcx
movq 0x18(%rax), %rbx
movq %rcx, 0x20(%rsp)
cmpq %rcx, %rbx
je 0x62f9
leal -0x2(%r12), %eax
movl %eax, 0x30(%rsp)
leal -0x1(%r12), %eax
movl %eax, 0x14(%rsp)
leal 0x1(%r12), %eax
movl %eax, 0x2c(%rsp)
leaq 0x34(%rsp), %r15
xorl %ebp, %ebp
movq %r12, 0x40(%rsp)
movq 0x10(%rbx), %rax
movl 0x4(%rax), %esi
movq 0x18(%rsp), %r14
movq %r14, %rdi
movq %r15, %rdx
callq 0x39cc
movl $0x30, %edi
callq 0x21d0
movq %rax, %r13
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %rbp, 0x10(%rax)
addq $0x18, %rax
movq %rax, 0x20(%r13)
movq %rax, 0x38(%rsp)
movq %rax, 0x18(%r13)
movq %rbp, 0x28(%r13)
movq 0x10(%rbx), %rdx
movq %r13, %rdi
movq %r14, %rsi
callq 0x3a1c
cmpb $0x1, 0x7330(%rip)      # 0xd3e3
jne 0x60c8
movq 0x10(%rbx), %rax
movl 0xc(%rax), %eax
cmpl 0x7126(%rip), %eax      # 0xd1e8
jl 0x62d6
movq 0x8(%r13), %rsi
subq (%r13), %rsi
shrq $0x2, %rsi
decl %esi
movq %r13, %rdi
callq 0x5b6b
testb %al, %al
je 0x62d6
leaq 0x72cb(%rip), %rdi      # 0xd3b8
movl 0x30(%rsp), %esi
movl $0x1, %edx
callq 0x4280
cmpb $0x1, 0x72de(%rip)      # 0xd3e0
jne 0x6122
movq %r13, %rdi
movq 0x6ec2(%rip), %r14      # 0xcfd0
movq %r14, %rsi
callq 0x3afc
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x3811
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
callq 0x22d0
movb $0x1, 0x70(%rsp)
movq 0x20(%rsp), %rax
movq (%rax), %r14
cmpq %rax, %r14
je 0x6281
movq 0x10(%rbx), %rax
movl 0x4(%rax), %r15d
movq 0x10(%r14), %rax
movl 0x4(%rax), %ebp
cmpl %ebp, %r15d
jl 0x6273
movl (%rax), %edx
movl %r12d, %edi
movq %r13, %rsi
movl %ebp, %ecx
callq 0x5c55
movq %r12, %rdi
movq %rax, %r12
cmpl %ebp, %r15d
jle 0x617a
xorl %ebp, %ebp
jmp 0x6199
movq 0x10(%r14), %rax
movl (%rax), %edx
movq 0x8(%r13), %rcx
subq (%r13), %rcx
shrq $0x2, %rcx
decl %ecx
movq %r13, %rsi
callq 0x5c55
movq %rax, %rbp
movq 0x10(%r14), %rax
movl 0x4(%rax), %esi
movq 0x18(%rsp), %rdi
leaq 0x4c(%rsp), %rdx
callq 0x39cc
movq %r12, %rax
orq %rbp, %rax
je 0x61d9
movq 0x10(%rbx), %rdi
addq $0x10, %rdi
movq 0x10(%r14), %rsi
addq $0x10, %rsi
movl $0x0, (%rsp)
movq %rbp, %rdx
movq %r12, %rcx
callq 0x593f
testq %r12, %r12
je 0x6226
leaq 0x71d3(%rip), %rdi      # 0xd3b8
movl 0x14(%rsp), %esi
movl $0x1, %edx
callq 0x4232
movl 0x8(%r12), %eax
cmpl 0x6fea(%rip), %eax      # 0xd1e8
jge 0x621b
movq %r12, %rdi
addq $0x10, %rdi
callq 0x4010
movl $0x28, %esi
movq %r12, %rdi
callq 0x21e0
jmp 0x6226
movq %r13, %rdi
movq %r12, %rsi
callq 0x394e
testq %rbp, %rbp
movq 0x40(%rsp), %r12
je 0x6273
leaq 0x7181(%rip), %rdi      # 0xd3b8
movl 0x14(%rsp), %esi
movl $0x1, %edx
callq 0x4232
movl 0x8(%rbp), %eax
cmpl 0x6f9a(%rip), %eax      # 0xd1e8
jge 0x6268
leaq 0x10(%rbp), %rdi
callq 0x4010
movl $0x28, %esi
movq %rbp, %rdi
callq 0x21e0
jmp 0x6273
movq %r13, %rdi
movq %rbp, %rsi
callq 0x394e
movq (%r14), %r14
cmpq 0x20(%rsp), %r14
jne 0x6144
leaq 0x50(%rsp), %rdi
callq 0x696e
leaq 0x7126(%rip), %rdi      # 0xd3b8
movl 0x14(%rsp), %esi
callq 0x42d0
movq 0x38(%rsp), %rax
cmpq %rax, (%rax)
leaq 0x34(%rsp), %r15
movl $0x0, %ebp
je 0x62d6
cmpl $0x1, 0x713a(%rip)      # 0xd3f0
jne 0x62ca
leaq 0x7139(%rip), %rdi      # 0xd3f8
movl %r12d, %esi
movq %r13, %rdx
callq 0x78d4
movq %r13, %rdi
movl 0x2c(%rsp), %esi
callq 0x5fd6
movq %r13, %rdi
callq 0x3894
movl $0x30, %esi
movq %r13, %rdi
callq 0x21e0
movq (%rbx), %rbx
cmpq 0x20(%rsp), %rbx
jne 0x605a
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq