// File: migueeelvargas[P]Auto-Complete/DictionaryTrie.cpp
// Function: DictionaryTrie::getPrefixWords(TrieNode*, 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::getPrefixWords (TrieNode* curr, std::string prefix,
  std::multimap<int, std::string, std::greater<int>> &prefixWords) {

  // Base case
  if (curr == NULL)
    return;

  // Traverse the left side of TST
  getPrefixWords(curr->right, prefix, prefixWords);
  getPrefixWords(curr->left, prefix, prefixWords);

  // Check if node is a word, & store prefix + current character
  if(curr->isAWord)
    prefixWords.insert(std::pair<int, std::string>(curr->freq, prefix + curr->symbol));

  // getPrefixWords(curr->mid, prefix.append(&(curr->symbol)), prefixWords);
  getPrefixWords(curr->mid, prefix + curr->symbol, prefixWords);  
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdx, -0xf0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xe8(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x9cf9
jmp 0x9eff
movq -0xf0(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x100(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x30f0
movq -0xe8(%rbp), %rdi
movq -0x100(%rbp), %rsi
movq -0xf8(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x9cc0
jmp 0x9d3f
leaq -0x40(%rbp), %rdi
callq 0x3170
movq -0xf0(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x110(%rbp)
leaq -0x70(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x30f0
movq -0xe8(%rbp), %rdi
movq -0x110(%rbp), %rsi
movq -0x108(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x9cc0
jmp 0x9d8e
leaq -0x70(%rbp), %rdi
callq 0x3170
movq -0x10(%rbp), %rax
testb $0x1, 0x20(%rax)
je 0x9ea7
movq -0xf0(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x24, %rcx
movq %rcx, -0x120(%rbp)
movsbl (%rax), %edx
leaq -0xb8(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0xa1d0
movq -0x120(%rbp), %rsi
movq -0x118(%rbp), %rdx
leaq -0x98(%rbp), %rdi
callq 0xa250
jmp 0x9dfb
movq -0x128(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0xa140
movq %rax, -0x130(%rbp)
jmp 0x9e17
movq -0x130(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq -0x98(%rbp), %rdi
callq 0xa1b0
leaq -0xb8(%rbp), %rdi
callq 0x3170
jmp 0x9ea7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x3170
jmp 0x9f20
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x3170
jmp 0x9f20
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9e99
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x98(%rbp), %rdi
callq 0xa1b0
leaq -0xb8(%rbp), %rdi
callq 0x3170
jmp 0x9f20
movq -0xf0(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
movq %rcx, -0x140(%rbp)
movsbl (%rax), %edx
leaq -0xe0(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0xa1d0
movq -0xe8(%rbp), %rdi
movq -0x140(%rbp), %rsi
movq -0x138(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x9cc0
jmp 0x9ef3
leaq -0xe0(%rbp), %rdi
callq 0x3170
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x3170
movq -0x48(%rbp), %rdi
callq 0x33c0
nopl (%rax)