// File: /workspace/github_cpp_makefile_star2_O1/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 0x5d4a(%rip), %rbx      # 0x8fd8
leaq 0x2e48(%rip), %rsi      # 0x60dd
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 0x346c
leaq 0xc8(%rsp), %r14
leaq 0xb8(%rsp), %r13
movq 0x5ce6(%rip), %rbp      # 0x8fd8
leaq 0x2d65(%rip), %r15      # 0x605e
movq %r14, 0xb8(%rsp)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x3e6a
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movl $0xa, %edx
callq 0x4bb0
movl %eax, %ebx
movq 0xb8(%rsp), %rdi
cmpq %r14, %rdi
je 0x3346
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x2150
testb %bl, %bl
je 0x33e3
movl $0x9, %edx
movq %rbp, %rdi
leaq 0x2cf7(%rip), %rsi      # 0x6054
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 0x2d42(%rip), %rsi      # 0x60d7
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 0x3459
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 0x2c3a(%rip), %rsi      # 0x6060
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, 0x5cc7(%rip)      # 0x9120
addq $0x20, %r12
movq 0x10(%rsp), %rax
cmpq 0x8(%rax), %r12
jne 0x32f9
leaq 0x2c08(%rip), %rax      # 0x607b
cmpb $0x0, 0x5ca6(%rip)      # 0x9120
leaq 0x2c02(%rip), %rsi      # 0x6083
cmovneq %rax, %rsi
movl $0x7, %edx
movq 0x5b47(%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, 0x5c2f(%rip)      # 0x9120
leaq 0x2be2(%rip), %rsi      # 0x60da
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 0x36ab
leaq 0xa8(%rsp), %r14
leaq 0x98(%rsp), %r15
movq 0x5a83(%rip), %rbp      # 0x8fd8
leaq 0x2b02(%rip), %rbx      # 0x605e
movq %r14, 0x98(%rsp)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x3e6a
movq 0x8(%rsp), %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x4bb0
movl %eax, %r13d
movq 0x98(%rsp), %rdi
cmpq %r14, %rdi
je 0x35aa
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x2150
testb %r13b, %r13b
je 0x3628
movl $0x9, %edx
movq %rbp, %rdi
leaq 0x2a96(%rip), %rsi      # 0x6054
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, 0x5afa(%rip)      # 0x9120
jmp 0x3698
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 0x29f5(%rip), %rsi      # 0x6060
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 0x355c
cmpb $0x0, 0x5a6e(%rip)      # 0x9120
leaq 0x29ca(%rip), %rsi      # 0x6083
leaq 0x29bb(%rip), %rax      # 0x607b
cmovneq %rax, %rsi
movl $0x7, %edx
movq 0x5908(%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, 0x59f0(%rip)      # 0x9120
leaq 0x295a(%rip), %rsi      # 0x6091
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 0x38db
leaq 0x88(%rsp), %r14
leaq 0x78(%rsp), %r15
movq 0x5847(%rip), %r13      # 0x8fd8
leaq 0x28c6(%rip), %rbx      # 0x605e
movq %r14, 0x78(%rsp)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x3e6a
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x4da6
movl %eax, %ebp
movq 0x78(%rsp), %rdi
cmpq %r14, %rdi
je 0x37da
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x2150
testb %bpl, %bpl
je 0x3851
movl $0x6, %edx
movq %r13, %rdi
leaq 0x28b6(%rip), %rsi      # 0x60a4
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 0x38c8
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 0x281e(%rip), %rsi      # 0x60b2
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, 0x5858(%rip)      # 0x9120
addq $0x20, %r12
movq 0x10(%rsp), %rax
cmpq 0x8(%rax), %r12
jne 0x3798
movq 0x18(%rsp), %rax
movq (%rax), %rbp
cmpq 0x8(%rax), %rbp
je 0x3a43
leaq 0x68(%rsp), %r14
leaq 0x58(%rsp), %r15
movq 0x56da(%rip), %r12      # 0x8fd8
leaq 0x2759(%rip), %rbx      # 0x605e
movq %r14, 0x58(%rsp)
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x3e6a
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x4da6
movl %eax, %r13d
movq 0x58(%rsp), %rdi
cmpq %r14, %rdi
je 0x3944
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x2150
testb %r13b, %r13b
je 0x39c1
movl $0x6, %edx
movq %r12, %rdi
leaq 0x274c(%rip), %rsi      # 0x60a4
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, 0x5761(%rip)      # 0x9120
jmp 0x3a30
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 0x26af(%rip), %rsi      # 0x60b2
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 0x3905
cmpb $0x0, 0x56d6(%rip)      # 0x9120
je 0x3a6c
leaq 0x2628(%rip), %rsi      # 0x607b
movl $0x7, %edx
movq 0x5579(%rip), %r15      # 0x8fd8
movq %r15, %rdi
callq 0x2180
movq %r15, %rbx
jmp 0x3ab1
leaq 0x2610(%rip), %rsi      # 0x6083
movl $0x7, %edx
movq 0x5559(%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 0x25e4(%rip), %rsi      # 0x60f2
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 0x2580(%rip), %rsi      # 0x6102
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 0x244c(%rip), %rsi      # 0x6012
leaq 0x2446(%rip), %rdx      # 0x6013
leaq 0x38(%rsp), %rdi
callq 0x4162
leaq 0x20(%rsp), %rdi
leaq 0x38(%rsp), %rdx
movq %r12, %rsi
movl $0x4, %ecx
callq 0x4e9a
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x3c05
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x2150
movq 0x20(%rsp), %rax
cmpq 0x28(%rsp), %rax
je 0x3ced
movq 0x53bc(%rip), %rdi      # 0x8fd8
leaq 0x2533(%rip), %rsi      # 0x6156
movl $0x10, %edx
callq 0x2180
movq 0x53a4(%rip), %rdi      # 0x8fd8
movl $0x4, %esi
callq 0x21e0
movq %rax, %rbx
leaq 0x251f(%rip), %rsi      # 0x6167
movl $0x12, %edx
movq %rax, %rdi
callq 0x2180
leaq 0x23b6(%rip), %rsi      # 0x6012
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 0x3d56
movq 0x5331(%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 0x3ca7
jmp 0x3d56
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq 0x52cd(%rip), %rdi      # 0x8fd8
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq %rax, %rbx
leaq 0x23fe(%rip), %rsi      # 0x6120
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 0x3e0e
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 0x3e05
movq 0x48(%rsp), %rsi
jmp 0x3dee
movq %rax, %rbx
jmp 0x3e05
jmp 0x3df8
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e05
movq 0x68(%rsp), %rsi
jmp 0x3dee
movq %rax, %rbx
movq 0x78(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e05
movq 0x88(%rsp), %rsi
jmp 0x3dee
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e05
movq 0xa8(%rsp), %rsi
jmp 0x3dee
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e05
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x2150
jmp 0x3e05
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3e0e
movq %rbx, %rdi
callq 0x21f0
nop