// File: migueeelvargas[P]Auto-Complete/DictionaryTrie.cpp
// Function: DictionaryTrie::findPrefixWords(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::multimap<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::greater<int>, std::allocator<std::pair<int const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>&)
void DictionaryTrie::findPrefixWords (std::string prefix,
  std::multimap<int, std::string, std::greater<int>> &prefixWords) {

  auto retVal = traverse(prefix);
  TrieNode* parent = retVal.first;

  // Checks if the prefix doesn't have any words, exits
  if (parent == NULL)
    return;

  // If the prefix is a word, add it to prefixWords
  if (parent->isAWord) {
    prefixWords.insert(std::pair<int, std::string>(parent->freq, prefix));
  }

  std::string buffer = "";
  // Get all prefix words
  getPrefixWords(parent->mid, prefix, prefixWords);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rsi, -0x110(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x108(%rbp)
leaq -0x48(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x30f0
movq -0x108(%rbp), %rdi
movq -0x100(%rbp), %rsi
callq 0x9590
movl %edx, -0xf4(%rbp)
movq %rax, -0xf0(%rbp)
jmp 0x9adb
movl -0xf4(%rbp), %eax
movq -0xf0(%rbp), %rcx
movq %rcx, -0x68(%rbp)
movl %eax, -0x60(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x28(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x20(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x3170
movq -0x28(%rbp), %rax
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x70(%rbp)
jne 0x9b34
jmp 0x9c5b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x3170
jmp 0x9cb0
movq -0x70(%rbp), %rax
testb $0x1, 0x20(%rax)
je 0x9bc4
movq -0x110(%rbp), %rdx
movq -0x18(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x70(%rbp), %rsi
addq $0x24, %rsi
leaq -0x98(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0xa170
movq -0x128(%rbp), %rdi
movq -0x120(%rbp), %rsi
callq 0xa140
movq %rax, -0x118(%rbp)
jmp 0x9b8b
movq -0x118(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
callq 0xa1b0
jmp 0x9bc4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x98(%rbp), %rdi
callq 0xa1b0
jmp 0x9cb0
leaq -0xc1(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x33d0
movq -0x130(%rbp), %rdx
leaq 0x44b3(%rip), %rsi      # 0xe098
leaq -0xc0(%rbp), %rdi
callq 0x4c60
jmp 0x9bf3
leaq -0xc1(%rbp), %rdi
callq 0x3280
movq -0x110(%rbp), %rsi
movq -0x70(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x138(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x30f0
jmp 0x9c23
movq -0x138(%rbp), %rsi
movq -0x108(%rbp), %rdi
movq -0x18(%rbp), %rcx
leaq -0xe8(%rbp), %rdx
callq 0x9cc0
jmp 0x9c43
leaq -0xe8(%rbp), %rdi
callq 0x3170
leaq -0xc0(%rbp), %rdi
callq 0x3170
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xc1(%rbp), %rdi
callq 0x3280
jmp 0x9cb0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x9ca4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x3170
leaq -0xc0(%rbp), %rdi
callq 0x3170
movq -0x50(%rbp), %rdi
callq 0x33c0
nopl (%rax)