// File: /workspace/github_cpp_makefile_star2_O1/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 $0x258, %rsp            # imm = 0x258
movq %r8, 0x10(%rsp)
movl %ecx, %ebx
movl %edx, 0xc(%rsp)
movl %esi, 0x8(%rsp)
movq %rdi, %r15
movq 0x7f1f(%rip), %r14      # 0xafd8
leaq 0x5004(%rip), %rsi      # 0x80c4
movl $0x14, %edx
movq %r14, %rdi
callq 0x2210
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
leaq 0x50(%rsp), %r12
movq %r12, %rdi
callq 0x2200
movq %r12, %rdi
movq %r15, %rsi
movl $0x4, %edx
callq 0x2190
testl %ebx, %ebx
je 0x32d8
leaq 0x40(%rsp), %rbp
movl %ebx, %eax
movq %rax, 0x18(%rsp)
xorl %r14d, %r14d
leaq 0x80d1(%rip), %r12      # 0xb200
leaq 0x30(%rsp), %r13
movl $0x38, %edi
callq 0x21c0
movq %rax, %r15
movq %rax, %rdi
callq 0x6c64
movl %r14d, %ebx
imull 0xc(%rsp), %ebx
addl 0x8(%rsp), %ebx
movq %r15, %rdi
leaq 0x50(%rsp), %rsi
movl %ebx, %edx
callq 0x4b0a
movq %r14, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %r14
cmpq 0x8(%rax), %r14
je 0x3208
movq %r12, %rdi
callq 0x3a3c
movq %rbp, 0x30(%rsp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x34b0
movq %r15, %rdi
movq %r13, %rsi
callq 0x6d26
movq 0x30(%rsp), %rdi
cmpq %rbp, %rdi
je 0x31bc
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x21d0
movq %r12, %rdi
callq 0x3a4a
movq %rax, 0x28(%rsp)
movq 0x8010(%rip), %rsi      # 0xb1e0
cmpq 0x8011(%rip), %rsi      # 0xb1e8
je 0x31e9
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x7ff9(%rip)      # 0xb1e0
jmp 0x31fa
leaq 0x7fe8(%rip), %rdi      # 0xb1d8
leaq 0x28(%rsp), %rdx
callq 0x38fe
addq $0x20, %r14
movq 0x10(%rsp), %rax
jmp 0x3171
movq 0x7fc9(%rip), %rdx      # 0xb1d8
movq 0x7fca(%rip), %rcx      # 0xb1e0
cmpq %rcx, %rdx
je 0x3238
movq 0x7fd6(%rip), %rax      # 0xb1f8
movq %rdx, %rsi
addq (%rsi), %rax
movq %rax, 0x7fc9(%rip)      # 0xb1f8
addq $0x8, %rsi
cmpq %rcx, %rsi
jne 0x3225
movq 0x7fb9(%rip), %rax      # 0xb1f8
subq %rdx, %rcx
sarq $0x3, %rcx
xorl %edx, %edx
divq %rcx
movq %rax, 0x7f9e(%rip)      # 0xb1f0
movl %ebx, %esi
movq 0x7d7d(%rip), %rdi      # 0xafd8
callq 0x2130
movq 0x20(%rsp), %r14
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x4e3c(%rip), %rsi      # 0x80b3
callq 0x2210
movq 0x7f6d(%rip), %rsi      # 0xb1f0
movq %rbx, %rdi
callq 0x20e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
movq %r15, %rdi
callq 0x6d34
movl $0x38, %esi
movq %r15, %rdi
callq 0x21d0
incq %r14
cmpq 0x18(%rsp), %r14
jne 0x3134
movq 0x7cf9(%rip), %rdi      # 0xafd8
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq 0x7cde(%rip), %rdi      # 0xafd8
callq 0x2030
movq %rax, %rdi
callq 0x2140
leaq 0x50(%rsp), %rdi
callq 0x2080
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3352
movq %rax, %rbx
movl $0x38, %esi
movq %r15, %rdi
jmp 0x3349
jmp 0x3352
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %rbp, %rdi
je 0x3355
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x21d0
jmp 0x3355
jmp 0x3352
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x22e0
nop