// File: /workspace/github_cpp_makefile_star2_O2/migueeelvargas[P]Auto-Complete/benchdict.cpp
// Function: testBST(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 testBST(std::string dictionary, int minSize, 
  int stepSize, unsigned int iterations, std::vector<std::string> words) {

  // Display title
  std::cout << "DictionaryBST:" << 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) {

    DictionaryBST* dictBST = new DictionaryBST();
    //loading dictionary
    Utils::load_dict(*dictBST, 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();
      dictBST->find(*it);
      times.push_back(T.end_timer());
    }

    for (auto &i : times) {
      sum = sum + i;
    }
    duration = (sum/times.size());
                 
    // Print the results
    std::cout << ((minSize)+(i*stepSize)) << "\t" << duration  << std::endl;

    delete dictBST;
  }
  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 0x7466(%rip), %rdi      # 0x9fd8
leaq 0x353c(%rip), %rsi      # 0x60b5
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 $0x30
popq %r14
leaq 0x764b(%rip), %r13      # 0xa200
leaq 0x20(%rsp), %r12
cmpq 0x10(%rsp), %rax
je 0x2ce6
movq %rax, 0x8(%rsp)
movq %r14, %rdi
callq 0x21d0
movq %rax, %r15
movq %rax, %rdi
callq 0x514c
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 0x3824
movq (%rbx), %r14
cmpq 0x8(%rbx), %r14
je 0x2c4e
movq %r13, %rdi
callq 0x3508
movq %r12, %rdi
movq %r14, %rsi
callq 0x2260
movq %r15, %rdi
movq %r12, %rsi
callq 0x51d2
movq %r12, %rdi
callq 0x2100
movq %r13, %rdi
callq 0x3516
movq %rax, 0x18(%rsp)
leaq 0x759a(%rip), %rdi      # 0xa1d8
leaq 0x18(%rsp), %rsi
callq 0x338c
addq $0x20, %r14
jmp 0x2bfe
movq 0x7583(%rip), %rdx      # 0xa1d8
movq 0x7584(%rip), %rcx      # 0xa1e0
movq 0x7595(%rip), %rax      # 0xa1f8
movq %rdx, %rsi
cmpq %rcx, %rsi
je 0x2c7b
addq (%rsi), %rax
movq %rax, 0x7583(%rip)      # 0xa1f8
addq $0x8, %rsi
jmp 0x2c66
subq %rdx, %rcx
sarq $0x3, %rcx
xorl %edx, %edx
divq %rcx
movq %rax, 0x7562(%rip)      # 0xa1f0
movl %ebp, %esi
movq 0x7341(%rip), %rdi      # 0x9fd8
callq 0x2150
movq %rax, %rdi
leaq 0x340d(%rip), %rsi      # 0x60b3
callq 0x21c0
movq 0x753e(%rip), %rsi      # 0xa1f0
movq %rax, %rdi
callq 0x20c0
movq %rax, %rdi
callq 0x2120
movq %r15, %rdi
callq 0x51e8
movq %r15, %rdi
pushq $0x30
popq %r14
movq %r14, %rsi
callq 0x21e0
movq 0x8(%rsp), %rax
incq %rax
jmp 0x2bba
movq 0x72eb(%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 0x2d33
movq %rax, %rbx
pushq $0x30
popq %rsi
movq %r15, %rdi
callq 0x21e0
jmp 0x2d36
jmp 0x2d33
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x2100
jmp 0x2d36
jmp 0x2d33
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x22e0