// File: zakimjz[P]SLEUTH/hashtable.cpp
// Function: FreqHT::add(int, Eqclass*)
void FreqHT::add(int iter, Eqclass *eq){
   vector<int> *iset;
   int phval = 0;
   int i;
   for (i=0; i < eq->prefix().size(); i++)
      if (eq->prefix()[i] != BranchIt) phval += eq->prefix()[i];
   
   
   int hval = 0;
   int scope, scnt;
   list<Eqnode *>::iterator ni = eq->nlist().begin();
   for (; ni != eq->nlist().end(); ni++){
      iset = new vector<int>(eq->prefix());
      scnt = eq->get_scope((*ni)->pos, scope); //what is the scope of node.pos
      while(scnt > scope){
         iset->push_back(BranchIt);
         scnt--;
      }
      iset->push_back((*ni)->val);
      hval = phval + (*ni)->val;
      if (chtable[iter] == NULL) chtable[iter] = new cHTable(FHTSIZE);
      int hres = chtable[iter]->hash_funct()(hval);
      chtable[iter]->insert(cHTPair(hres, iset));
      //cout << "ADD " << hres << " xx " << *iset << endl;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movslq -0x28(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x18(%rbp), %rdi
callq 0xc150
movq %rax, %rdi
callq 0x4b80
movq %rax, %rcx
movq -0x98(%rbp), %rax
cmpq %rcx, %rax
jae 0x10b08
movq -0x18(%rbp), %rdi
callq 0xc150
movq %rax, %rdi
movslq -0x28(%rbp), %rsi
callq 0x6520
movslq (%rax), %rax
leaq 0xd6e7(%rip), %rcx      # 0x1e1c0
cmpq (%rcx), %rax
je 0x10afb
movq -0x18(%rbp), %rdi
callq 0xc150
movq %rax, %rdi
movslq -0x28(%rbp), %rsi
callq 0x6520
movl (%rax), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0x10afd
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x10a8f
movl $0x0, -0x2c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x63f0
movq %rax, %rdi
callq 0x6410
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
callq 0x63f0
movq %rax, %rdi
callq 0x6440
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x6830
testb $0x1, %al
jne 0x10b4f
jmp 0x10d4c
movl $0x18, %edi
callq 0x2170
movq %rax, -0xa8(%rbp)
movq -0x18(%rbp), %rdi
callq 0xc150
movq %rax, -0xa0(%rbp)
jmp 0x10b72
movq -0xa0(%rbp), %rsi
movq -0xa8(%rbp), %rdi
callq 0x4a90
jmp 0x10b87
movq -0xa8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x6860
movq -0xb0(%rbp), %rdi
movq (%rax), %rax
movl 0x4(%rax), %esi
leaq -0x30(%rbp), %rdx
callq 0x5dc0
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x30(%rbp), %eax
jle 0x10c0e
movq -0x20(%rbp), %rdi
leaq 0xd5ee(%rip), %rax      # 0x1e1c0
movq (%rax), %rax
movl %eax, -0x58(%rbp)
leaq -0x58(%rbp), %rsi
callq 0x6790
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x10bbf
movq -0xa8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
movl $0x18, %esi
callq 0x2180
jmp 0x10d55
movq -0x20(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x6860
movq -0xc0(%rbp), %rdi
movq (%rax), %rsi
callq 0x67c0
movl -0x24(%rbp), %eax
movl %eax, -0xb4(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x6860
movq -0x90(%rbp), %rdi
movq %rax, %rcx
movl -0xb4(%rbp), %eax
movq (%rcx), %rcx
addl (%rcx), %eax
movl %eax, -0x2c(%rbp)
movslq -0xc(%rbp), %rsi
callq 0xcf80
cmpq $0x0, (%rax)
jne 0x10ccb
movl $0x28, %edi
callq 0x2170
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xc8(%rbp)
movl $0x64, %esi
callq 0x10f10
jmp 0x10c8d
movq -0x90(%rbp), %rdi
movslq -0xc(%rbp), %rsi
callq 0xcf80
movq -0xc8(%rbp), %rcx
movq %rcx, (%rax)
jmp 0x10ccb
movq -0xc8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
movl $0x28, %esi
callq 0x2180
jmp 0x10d55
movq -0x90(%rbp), %rdi
movslq -0xc(%rbp), %rsi
callq 0xcf80
movq (%rax), %rdi
callq 0x10f90
movl -0x2c(%rbp), %esi
leaq -0x5d(%rbp), %rdi
callq 0xd390
movq -0x90(%rbp), %rdi
movl %eax, -0x5c(%rbp)
movslq -0xc(%rbp), %rsi
callq 0xcf80
movq (%rax), %rax
movq %rax, -0xd0(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x5c(%rbp), %rsi
leaq -0x20(%rbp), %rdx
callq 0x10ff0
movq -0xd0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x10fb0
movq %rax, -0x80(%rbp)
movq %rdx, -0x78(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
callq 0x6880
movq %rax, -0x88(%rbp)
jmp 0x10b24
addq $0xd0, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x22d0
nop