// File: 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
movq %rsp, %rbp
subq $0x2f0, %rsp            # imm = 0x2F0
movq %rdi, -0x2a0(%rbp)
movq %r8, -0x2b0(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movq %r8, -0x20(%rbp)
movq 0x10867(%rip), %rdi     # 0x14fd8
leaq 0x9930(%rip), %rsi      # 0xe0a8
callq 0x3210
movq %rax, %rdi
movq 0x10841(%rip), %rsi     # 0x14fc8
callq 0x3250
leaq -0x228(%rbp), %rdi
movq %rdi, -0x2a8(%rbp)
callq 0x32b0
movq -0x2a8(%rbp), %rdi
movq -0x2a0(%rbp), %rsi
movl $0x4, %edx
callq 0x31f0
jmp 0x47b9
movl $0x0, -0x238(%rbp)
movl -0x238(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x4ae0
movl $0x38, %edi
callq 0x3220
movq %rax, -0x2b8(%rbp)
jmp 0x47e5
movq -0x2b8(%rbp), %rdi
callq 0xbea0
jmp 0x47f3
movq -0x2b8(%rbp), %rax
movq %rax, -0x240(%rbp)
movq -0x240(%rbp), %rdi
movl -0xc(%rbp), %edx
movl -0x238(%rbp), %eax
movl -0x10(%rbp), %ecx
imull %ecx, %eax
addl %eax, %edx
leaq -0x228(%rbp), %rsi
callq 0x7a00
jmp 0x4827
movq -0x2b0(%rbp), %rdi
callq 0x4e00
movq %rax, -0x248(%rbp)
movq -0x2b0(%rbp), %rdi
callq 0x4e70
movq %rax, -0x250(%rbp)
leaq -0x248(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x4e30
testb $0x1, %al
jne 0x4869
jmp 0x4970
leaq 0x10a18(%rip), %rdi     # 0x15288
callq 0x6b80
jmp 0x4877
movq -0x240(%rbp), %rax
movq %rax, -0x2c0(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x4ea0
movq %rax, %rsi
leaq -0x270(%rbp), %rdi
callq 0x30f0
jmp 0x48a2
movq -0x2c0(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0xbf60
jmp 0x48b7
leaq -0x270(%rbp), %rdi
callq 0x3170
leaq 0x109be(%rip), %rdi     # 0x15288
callq 0x6bc0
movq %rax, -0x2c8(%rbp)
jmp 0x48d8
movq -0x2c8(%rbp), %rax
movq %rax, -0x278(%rbp)
leaq 0x10973(%rip), %rdi     # 0x15260
leaq -0x278(%rbp), %rsi
callq 0x4ec0
jmp 0x48fb
jmp 0x48fd
leaq -0x248(%rbp), %rdi
callq 0x4ef0
jmp 0x483a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0x4b0a
movq -0x2b8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
movl $0x38, %esi
callq 0x3230
jmp 0x4b0a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
leaq -0x270(%rbp), %rdi
callq 0x3170
jmp 0x4b0a
leaq 0x108e9(%rip), %rax     # 0x15260
movq %rax, -0x280(%rbp)
leaq 0x108db(%rip), %rdi     # 0x15260
callq 0x4f10
movq %rax, -0x288(%rbp)
leaq 0x108c8(%rip), %rdi     # 0x15260
callq 0x4f40
movq %rax, -0x290(%rbp)
leaq -0x288(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x4f70
testb $0x1, %al
jne 0x49bd
jmp 0x49f6
leaq -0x288(%rbp), %rdi
callq 0x4fb0
movq %rax, -0x298(%rbp)
movq 0x108a9(%rip), %rax     # 0x15280
movq -0x298(%rbp), %rcx
addq (%rcx), %rax
movq %rax, 0x10898(%rip)     # 0x15280
leaq -0x288(%rbp), %rdi
callq 0x4fd0
jmp 0x49a4
movq 0x10883(%rip), %rax     # 0x15280
movq %rax, -0x2d8(%rbp)
leaq 0x10855(%rip), %rdi     # 0x15260
callq 0x4ff0
movq %rax, %rcx
movq -0x2d8(%rbp), %rax
xorl %edx, %edx
divq %rcx
movq %rax, 0x10852(%rip)     # 0x15278
movl -0xc(%rbp), %esi
movl -0x238(%rbp), %eax
movl -0x10(%rbp), %ecx
imull %ecx, %eax
addl %eax, %esi
movq 0x1059a(%rip), %rdi     # 0x14fd8
callq 0x3320
movq %rax, -0x2d0(%rbp)
jmp 0x4a4c
movq -0x2d0(%rbp), %rdi
leaq 0x963d(%rip), %rsi      # 0xe097
callq 0x3210
movq %rax, -0x2e0(%rbp)
jmp 0x4a68
movq -0x2e0(%rbp), %rdi
movq 0x10802(%rip), %rsi     # 0x15278
callq 0x3140
movq %rax, -0x2e8(%rbp)
jmp 0x4a84
movq -0x2e8(%rbp), %rdi
movq 0x10536(%rip), %rsi     # 0x14fc8
callq 0x3250
jmp 0x4a99
movq -0x240(%rbp), %rax
movq %rax, -0x2f0(%rbp)
cmpq $0x0, %rax
je 0x4aca
movq -0x2f0(%rbp), %rdi
callq 0xbfc0
movq -0x2f0(%rbp), %rdi
movl $0x38, %esi
callq 0x3230
jmp 0x4acc
movl -0x238(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x238(%rbp)
jmp 0x47c3
movq 0x104f1(%rip), %rdi     # 0x14fd8
movq 0x104da(%rip), %rsi     # 0x14fc8
callq 0x3250
jmp 0x4af5
leaq -0x228(%rbp), %rdi
callq 0x30a0
addq $0x2f0, %rsp            # imm = 0x2F0
popq %rbp
retq
leaq -0x228(%rbp), %rdi
callq 0x30a0
movq -0x230(%rbp), %rdi
callq 0x33c0
nopw %cs:(%rax,%rax)
nopl (%rax)