// File: /workspace/github_cpp_makefile_star2_O3/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 0x7f2d(%rip), %r14      # 0xafd8
leaq 0x5012(%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 0x32c3
leaq 0x40(%rsp), %rbp
movl %ebx, %eax
movq %rax, 0x18(%rsp)
xorl %r14d, %r14d
leaq 0x80df(%rip), %r12      # 0xb200
leaq 0x30(%rsp), %r13
movl $0x38, %edi
callq 0x21c0
movq %rax, %r15
movq %rax, %rdi
callq 0x6c8c
movl %r14d, %ebx
imull 0xc(%rsp), %ebx
addl 0x8(%rsp), %ebx
movq %r15, %rdi
leaq 0x50(%rsp), %rsi
movl %ebx, %edx
callq 0x4b22
movq %r14, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %r14
cmpq 0x8(%rax), %r14
je 0x31fa
movq %r12, %rdi
callq 0x3a38
movq %rbp, 0x30(%rsp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x349c
movq %r15, %rdi
movq %r13, %rsi
callq 0x6d4e
movq 0x30(%rsp), %rdi
cmpq %rbp, %rdi
je 0x31ae
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x21d0
movq %r12, %rdi
callq 0x3a46
movq %rax, 0x28(%rsp)
movq 0x801e(%rip), %rsi      # 0xb1e0
cmpq 0x801f(%rip), %rsi      # 0xb1e8
je 0x31db
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8007(%rip)      # 0xb1e0
jmp 0x31ec
leaq 0x7ff6(%rip), %rdi      # 0xb1d8
leaq 0x28(%rsp), %rdx
callq 0x38fc
addq $0x20, %r14
movq 0x10(%rsp), %rax
jmp 0x3163
movq 0x7fd7(%rip), %rdx      # 0xb1d8
movq 0x7fd8(%rip), %rcx      # 0xb1e0
movq 0x7fe9(%rip), %rax      # 0xb1f8
movq %rdx, %rsi
cmpq %rcx, %rdx
je 0x322a
addq (%rsi), %rax
movq %rax, 0x7fd7(%rip)      # 0xb1f8
addq $0x8, %rsi
cmpq %rcx, %rsi
jne 0x3217
subq %rdx, %rcx
sarq $0x3, %rcx
xorl %edx, %edx
divq %rcx
movq %rax, 0x7fb3(%rip)      # 0xb1f0
movl %ebx, %esi
movq 0x7d92(%rip), %rdi      # 0xafd8
callq 0x2130
movq 0x20(%rsp), %r14
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x4e51(%rip), %rsi      # 0x80b3
callq 0x2210
movq 0x7f82(%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 0x6d5c
movl $0x38, %esi
movq %r15, %rdi
callq 0x21d0
incq %r14
cmpq 0x18(%rsp), %r14
jne 0x3126
movq 0x7d0e(%rip), %rdi      # 0xafd8
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq 0x7cf3(%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 0x333d
movq %rax, %rbx
movl $0x38, %esi
movq %r15, %rdi
jmp 0x3334
jmp 0x333d
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %rbp, %rdi
je 0x3340
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x21d0
jmp 0x3340
jmp 0x333d
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x22e0