// File: /workspace/github_cpp_makefile_star2_O3/migueeelvargas[P]Auto-Complete/test.cpp
// Function: modeTrie(DictionaryTrie*, 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>>>>&, 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 modeTrie (DictionaryTrie* dictionaryTrie, 
              std::vector<std::string>& words,
              std::vector<std::string>& wordsNotIn) {
    /* Test - insert() */
  std::cout << "Inserting strings..." << std::endl;
  for( auto i = words.begin(); i != words.end(); ++i) {
    // auto freq = (unsigned int)rand()%100;
    auto freq = 10;
    if (dictionaryTrie->insert(*i, freq))
      std::cout << "Inserted " << "\"" << *i << ", " << freq << "\"" << std::endl;

    else {
      std::cout << "\"" << *i << "\"" << " is already in dictionary." << std::endl;
      pass = false;
    }
  }
  if (pass)
    std::cout << "PASSED." << std::endl << std::endl;
  else 
    std::cout << "FAILED." << std::endl << std::endl;

  /* Testing Re-Insert - Should return all false */
  pass = true;
  std::cout << "Re-Inserting strings..." << std::endl;
  for( auto i = words.begin(); i != words.end(); ++i) {
    if (dictionaryTrie->insert(*i, 10)) {
      std::cout << "Inserted " << "\"" << *i << "\"" << std::endl;
      pass = false;
    }

    else 
      std::cout << "\"" << *i << "\"" << " is already in dictionary." << std::endl;
  }
  if (pass)
    std::cout << "PASSED." << std::endl << std::endl;
  else 
    std::cout << "FAILED." << std::endl << std::endl;

  /* Testing - find() */
  pass = true;
  std::cout << "Finding strings..." << std::endl;
  for( auto i = words.begin(); i != words.end(); ++i) {
    if (dictionaryTrie->find(*i))
      std::cout << "Found " << "\"" << *i << "\"" << std::endl;

    else {
      std::cout << "\"" << *i << "\"" << " is not in the dictionary." << std::endl;
      pass = false;
    }
  }
  for( auto i = wordsNotIn.begin(); i != wordsNotIn.end(); ++i) {
    if (dictionaryTrie->find(*i)) {
      std::cout << "Found " << "\"" << *i << "\"" << std::endl;
      pass = false;
    }

    else {
      std::cout << "\"" << *i << "\"" << " is not in the dictionary." << std::endl;
    }
  }
  if (pass)
    std::cout << "PASSED." << std::endl << std::endl;
  else 
    std::cout << "FAILED." << std::endl << std::endl << std::endl;

  /* Print # of vertices */
  std::cout << "# of vertices: " << dictionaryTrie->num_vertices << std::endl << std::endl;

  /* Testing predictCompletions */
  std::cout << "Testing predictCompletions..." << std::endl;
  auto prefix = "b";
  auto num = 4;

  auto completions = dictionaryTrie->predictCompletions(prefix, num);

  if(completions.empty())
    std::cout << std::endl << "The prefix does not have any words in the dictionary." << std::endl;

  else {
    std::cout << "finding the top " << num << " completions for: " << prefix << std::endl;

    for(auto it = completions.begin(); it != completions.end(); ++it) {
      std::cout << *it << std::endl;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdx, 0x18(%rsp)
movq %rsi, %r14
movq %rdi, 0x8(%rsp)
movq 0x5d41(%rip), %rbx      # 0x8fd8
leaq 0x2e3c(%rip), %rsi      # 0x60da
movl $0x14, %edx
movq %rbx, %rdi
callq 0x2180
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq (%r14), %r12
movq %r14, 0x10(%rsp)
cmpq 0x8(%r14), %r12
je 0x3475
leaq 0xc8(%rsp), %r14
leaq 0xb8(%rsp), %r13
movq 0x5cdd(%rip), %rbp      # 0x8fd8
leaq 0x2d59(%rip), %r15      # 0x605b
movq %r14, 0xb8(%rsp)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x3e74
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movl $0xa, %edx
callq 0x4bcc
movl %eax, %ebx
movq 0xb8(%rsp), %rdi
cmpq %r14, %rdi
je 0x334f
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x2150
testb %bl, %bl
je 0x33ec
movl $0x9, %edx
movq %rbp, %rdi
leaq 0x2ceb(%rip), %rsi      # 0x6051
callq 0x2180
movl $0x1, %edx
movq %rbp, %rdi
movq %r15, %rsi
callq 0x2180
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %rbp, %rdi
callq 0x2180
movq %rax, %rbx
movl $0x2, %edx
movq %rax, %rdi
leaq 0x2d36(%rip), %rsi      # 0x60d4
callq 0x2180
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21e0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2180
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
jmp 0x3462
movl $0x1, %edx
movq %rbp, %rdi
movq %r15, %rsi
callq 0x2180
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %rbp, %rdi
callq 0x2180
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2180
movl $0x1a, %edx
movq %rbx, %rdi
leaq 0x2c2e(%rip), %rsi      # 0x605d
callq 0x2180
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movb $0x0, 0x5cbe(%rip)      # 0x9120
addq $0x20, %r12
movq 0x10(%rsp), %rax
cmpq 0x8(%rax), %r12
jne 0x3302
leaq 0x2bfc(%rip), %rax      # 0x6078
cmpb $0x0, 0x5c9d(%rip)      # 0x9120
leaq 0x2bf6(%rip), %rsi      # 0x6080
cmovneq %rax, %rsi
movl $0x7, %edx
movq 0x5b3e(%rip), %r14      # 0x8fd8
movq %r14, %rdi
callq 0x2180
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movb $0x1, 0x5c26(%rip)      # 0x9120
leaq 0x2bd6(%rip), %rsi      # 0x60d7
movl $0x17, %edx
movq %r14, %rdi
callq 0x2180
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq 0x10(%rsp), %rax
movq (%rax), %r12
cmpq 0x8(%rax), %r12
je 0x36b4
leaq 0xa8(%rsp), %r14
leaq 0x98(%rsp), %r15
movq 0x5a7a(%rip), %rbp      # 0x8fd8
leaq 0x2af6(%rip), %rbx      # 0x605b
movq %r14, 0x98(%rsp)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x3e74
movq 0x8(%rsp), %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x4bcc
movl %eax, %r13d
movq 0x98(%rsp), %rdi
cmpq %r14, %rdi
je 0x35b3
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x2150
testb %r13b, %r13b
je 0x3631
movl $0x9, %edx
movq %rbp, %rdi
leaq 0x2a8a(%rip), %rsi      # 0x6051
callq 0x2180
movl $0x1, %edx
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x2180
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %rbp, %rdi
callq 0x2180
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2180
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movb $0x0, 0x5af1(%rip)      # 0x9120
jmp 0x36a1
movl $0x1, %edx
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x2180
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %rbp, %rdi
callq 0x2180
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2180
movl $0x1a, %edx
movq %r13, %rdi
leaq 0x29e9(%rip), %rsi      # 0x605d
callq 0x2180
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
addq $0x20, %r12
movq 0x10(%rsp), %rax
cmpq 0x8(%rax), %r12
jne 0x3565
cmpb $0x0, 0x5a65(%rip)      # 0x9120
leaq 0x29be(%rip), %rsi      # 0x6080
leaq 0x29af(%rip), %rax      # 0x6078
cmovneq %rax, %rsi
movl $0x7, %edx
movq 0x58ff(%rip), %r14      # 0x8fd8
movq %r14, %rdi
callq 0x2180
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movb $0x1, 0x59e7(%rip)      # 0x9120
leaq 0x294e(%rip), %rsi      # 0x608e
movl $0x12, %edx
movq %r14, %rdi
callq 0x2180
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq 0x10(%rsp), %rax
movq (%rax), %r12
cmpq 0x8(%rax), %r12
je 0x38e4
leaq 0x88(%rsp), %r14
leaq 0x78(%rsp), %r15
movq 0x583e(%rip), %r13      # 0x8fd8
leaq 0x28ba(%rip), %rbx      # 0x605b
movq %r14, 0x78(%rsp)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x3e74
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x4dee
movl %eax, %ebp
movq 0x78(%rsp), %rdi
cmpq %r14, %rdi
je 0x37e3
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x2150
testb %bpl, %bpl
je 0x385a
movl $0x6, %edx
movq %r13, %rdi
leaq 0x28aa(%rip), %rsi      # 0x60a1
callq 0x2180
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2180
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %r13, %rdi
callq 0x2180
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2180
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
jmp 0x38d1
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2180
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %r13, %rdi
callq 0x2180
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2180
movl $0x1a, %edx
movq %rbp, %rdi
leaq 0x2812(%rip), %rsi      # 0x60af
callq 0x2180
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movb $0x0, 0x584f(%rip)      # 0x9120
addq $0x20, %r12
movq 0x10(%rsp), %rax
cmpq 0x8(%rax), %r12
jne 0x37a1
movq 0x18(%rsp), %rax
movq (%rax), %rbp
cmpq 0x8(%rax), %rbp
je 0x3a4c
leaq 0x68(%rsp), %r14
leaq 0x58(%rsp), %r15
movq 0x56d1(%rip), %r12      # 0x8fd8
leaq 0x274d(%rip), %rbx      # 0x605b
movq %r14, 0x58(%rsp)
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x3e74
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x4dee
movl %eax, %r13d
movq 0x58(%rsp), %rdi
cmpq %r14, %rdi
je 0x394d
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x2150
testb %r13b, %r13b
je 0x39ca
movl $0x6, %edx
movq %r12, %rdi
leaq 0x2740(%rip), %rsi      # 0x60a1
callq 0x2180
movl $0x1, %edx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2180
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
movq %r12, %rdi
callq 0x2180
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2180
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movb $0x0, 0x5758(%rip)      # 0x9120
jmp 0x3a39
movl $0x1, %edx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2180
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
movq %r12, %rdi
callq 0x2180
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2180
movl $0x1a, %edx
movq %r13, %rdi
leaq 0x26a3(%rip), %rsi      # 0x60af
callq 0x2180
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
addq $0x20, %rbp
movq 0x18(%rsp), %rax
cmpq 0x8(%rax), %rbp
jne 0x390e
cmpb $0x0, 0x56cd(%rip)      # 0x9120
je 0x3a75
leaq 0x261c(%rip), %rsi      # 0x6078
movl $0x7, %edx
movq 0x5570(%rip), %r15      # 0x8fd8
movq %r15, %rdi
callq 0x2180
movq %r15, %rbx
jmp 0x3aba
leaq 0x2604(%rip), %rsi      # 0x6080
movl $0x7, %edx
movq 0x5550(%rip), %r15      # 0x8fd8
movq %r15, %rdi
callq 0x2180
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq %rax, %rbx
movq 0x8(%rsp), %r12
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
leaq 0x25d8(%rip), %rsi      # 0x60ef
movl $0xf, %edx
movq %r15, %rdi
callq 0x2180
movl (%r12), %esi
movq %r15, %rdi
callq 0x20c0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
leaq 0x2574(%rip), %rsi      # 0x60ff
movl $0x1d, %edx
movq %r15, %rdi
callq 0x2180
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
leaq 0x48(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x2440(%rip), %rsi      # 0x600f
leaq 0x243a(%rip), %rdx      # 0x6010
leaq 0x38(%rsp), %rdi
callq 0x417a
leaq 0x20(%rsp), %rdi
leaq 0x38(%rsp), %rdx
movq %r12, %rsi
movl $0x4, %ecx
callq 0x4ee4
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x3c0e
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x2150
movq 0x20(%rsp), %rax
cmpq 0x28(%rsp), %rax
je 0x3cf6
movq 0x53b3(%rip), %rdi      # 0x8fd8
leaq 0x2527(%rip), %rsi      # 0x6153
movl $0x10, %edx
callq 0x2180
movq 0x539b(%rip), %rdi      # 0x8fd8
movl $0x4, %esi
callq 0x21e0
movq %rax, %rbx
leaq 0x2513(%rip), %rsi      # 0x6164
movl $0x12, %edx
movq %rax, %rdi
callq 0x2180
leaq 0x23aa(%rip), %rsi      # 0x600f
movl $0x1, %edx
movq %rbx, %rdi
callq 0x2180
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq 0x20(%rsp), %r15
cmpq 0x28(%rsp), %r15
je 0x3d5f
movq 0x5328(%rip), %rbx      # 0x8fd8
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x2180
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
addq $0x20, %r15
cmpq 0x28(%rsp), %r15
jne 0x3cb0
jmp 0x3d5f
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq 0x52c4(%rip), %rdi      # 0x8fd8
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq %rax, %rbx
leaq 0x23f2(%rip), %rsi      # 0x611d
movl $0x35, %edx
movq %rax, %rdi
callq 0x2180
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
leaq 0x20(%rsp), %rdi
callq 0x3e16
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e0e
movq 0x48(%rsp), %rsi
jmp 0x3df7
movq %rax, %rbx
jmp 0x3e0e
jmp 0x3e01
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e0e
movq 0x68(%rsp), %rsi
jmp 0x3df7
movq %rax, %rbx
movq 0x78(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e0e
movq 0x88(%rsp), %rsi
jmp 0x3df7
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e0e
movq 0xa8(%rsp), %rsi
jmp 0x3df7
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e0e
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x2150
jmp 0x3e0e
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3e16
movq %rbx, %rdi
callq 0x21f0