// File: /workspace/github_cpp_makefile_star2_O2/migueeelvargas[P]Auto-Complete/benchdict.cpp
// Function: testHT(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, int, unsigned int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>)
void testHT(std::string dictionary, int minSize, 
  int stepSize, unsigned int iterations, std::vector<std::string> words) {

  // Display title
  std::cout << "DictionaryHashtable:" << std::endl;

  // Open a stream to read input file
  std::ifstream ifs;
  ifs.open(dictionary, std::ios::binary);

  // Find average times
  for (unsigned i = 0; i < iterations; ++i) {
    DictionaryHashtable* dictHT = new DictionaryHashtable();

    // Load the dictionary
    Utils::load_dict(*dictHT, ifs, (minSize+(i*stepSize)));
    
    // Timing 10 finds that are not in the dictionary
    for (auto it = words.begin(); it != words.end(); ++it) {
      T.begin_timer();
      dictHT->find(*it);
      times.push_back(T.end_timer());
    }

    // Add up all the times
    for (auto &i : times)
      sum = sum + i;

    // Find the average time
    duration = (sum/times.size());
                 
    // Print the results
    std::cout << ((minSize)+(i*stepSize)) << "\t" << duration  << std::endl;

    delete dictHT;
  }
  std::cout << std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movq %r8, %rbx
movl %ecx, %ebp
movl %edx, 0x4(%rsp)
movl %esi, (%rsp)
movq %rdi, %r14
movq 0x7269(%rip), %rdi      # 0x9fd8
leaq 0x334e(%rip), %rsi      # 0x60c4
callq 0x21c0
movq %rax, %rdi
callq 0x2120
leaq 0x40(%rsp), %r15
movq %r15, %rdi
callq 0x2210
pushq $0x4
popq %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x21a0
movl %ebp, %eax
movq %rax, 0x10(%rsp)
xorl %eax, %eax
pushq $0x38
popq %r14
leaq 0x744e(%rip), %r13      # 0xa200
leaq 0x20(%rsp), %r12
cmpq 0x10(%rsp), %rax
je 0x2ee3
movq %rax, 0x8(%rsp)
movq %r14, %rdi
callq 0x21d0
movq %rax, %r15
movq %rax, %rdi
callq 0x54bc
movq 0x8(%rsp), %rax
movl %eax, %ebp
imull 0x4(%rsp), %ebp
addl (%rsp), %ebp
movq %r15, %rdi
leaq 0x40(%rsp), %rsi
movl %ebp, %edx
callq 0x3e24
movq (%rbx), %r14
cmpq 0x8(%rbx), %r14
je 0x2e4b
movq %r13, %rdi
callq 0x3508
movq %r12, %rdi
movq %r14, %rsi
callq 0x2260
movq %r15, %rdi
movq %r12, %rsi
callq 0x5548
movq %r12, %rdi
callq 0x2100
movq %r13, %rdi
callq 0x3516
movq %rax, 0x18(%rsp)
leaq 0x739d(%rip), %rdi      # 0xa1d8
leaq 0x18(%rsp), %rsi
callq 0x338c
addq $0x20, %r14
jmp 0x2dfb
movq 0x7386(%rip), %rdx      # 0xa1d8
movq 0x7387(%rip), %rcx      # 0xa1e0
movq 0x7398(%rip), %rax      # 0xa1f8
movq %rdx, %rsi
cmpq %rcx, %rsi
je 0x2e78
addq (%rsi), %rax
movq %rax, 0x7386(%rip)      # 0xa1f8
addq $0x8, %rsi
jmp 0x2e63
subq %rdx, %rcx
sarq $0x3, %rcx
xorl %edx, %edx
divq %rcx
movq %rax, 0x7365(%rip)      # 0xa1f0
movl %ebp, %esi
movq 0x7144(%rip), %rdi      # 0x9fd8
callq 0x2150
movq %rax, %rdi
leaq 0x3210(%rip), %rsi      # 0x60b3
callq 0x21c0
movq 0x7341(%rip), %rsi      # 0xa1f0
movq %rax, %rdi
callq 0x20c0
movq %rax, %rdi
callq 0x2120
movq %r15, %rdi
callq 0x5556
movq %r15, %rdi
pushq $0x38
popq %r14
movq %r14, %rsi
callq 0x21e0
movq 0x8(%rsp), %rax
incq %rax
jmp 0x2db7
movq 0x70ee(%rip), %rdi      # 0x9fd8
callq 0x2120
leaq 0x40(%rsp), %rdi
callq 0x2080
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2f30
movq %rax, %rbx
pushq $0x38
popq %rsi
movq %r15, %rdi
callq 0x21e0
jmp 0x2f33
jmp 0x2f30
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x2100
jmp 0x2f33
jmp 0x2f30
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x22e0
nop