// File: /workspace/github_cpp_makefile_star2_O2/ruankotovich[P]TextCorrection-Trie/src/main.cpp
// Function: main
int main()
{
  trie::Trie_t personTrie;

  std::string name = "Duan";
  std::string name2 = "Daniel";
  std::string name3 = "Soto";
  std::string name4 = "Roab";
  std::string name5 = "Bananation";
  std::string name6 = "SotoBanaNAO";
  std::string name7 = "Danyel";
  std::string name8 = "ovo";
  std::string name9 = "uva";

  personTrie.putIndividualWord(name, name);
  personTrie.putIndividualWord(name2, name2);
  personTrie.putIndividualWord(name3, name3);
  personTrie.putIndividualWord(name4, name4);
  personTrie.putIndividualWord(name5, name5);
  personTrie.putIndividualWord(name6, name6);
  personTrie.putIndividualWord(name7, name7);
  personTrie.putIndividualWord(name8, name8);
  personTrie.putIndividualWord(name9, name9);

  personTrie.buildActiveNodeSet(false);

  std::string search;
  std::cout << "\n >> ";
  while (std::getline(std::cin, search)) {
    std::cout << " --- Searching \"" << search << "\".\n";
    auto mSearch = personTrie.searchKeyword(search);
    if (mSearch.first) {
      for (auto element : mSearch.second) {
        std::cout << " - "<<  element << std::endl;
      }
    } else {
      std::cout << " --- Couldn't find an exact match for this word, searching with errors.\n";
      auto a = personTrie.searchSimilarKeyword(search);
      if (a.empty()) {
        std::cout << " --- Couldn't find any result on this query\n";
        std::cout << "\n >> ";
        continue;
      }

      while (!a.empty()) {
        // std::cout << " -- " << a.top().content->name << " - " << a.top().content->age << '\n';
        std::cout << " - " << a.top().content << std::endl;
        a.pop();
      }
    }
    std::cout << "\n >> ";
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
leaq 0x180(%rsp), %rdi
callq 0x290a
leaq 0x4c13(%rip), %rsi      # 0x7004
leaq 0x160(%rsp), %rdi
leaq 0x140(%rsp), %rdx
callq 0x2090
leaq 0x4bfc(%rip), %rsi      # 0x7009
leaq 0x140(%rsp), %rdi
leaq 0x120(%rsp), %rdx
callq 0x2090
leaq 0x4be7(%rip), %rsi      # 0x7010
leaq 0x120(%rsp), %rdi
leaq 0x100(%rsp), %rdx
callq 0x2090
leaq 0x4bd0(%rip), %rsi      # 0x7015
leaq 0x100(%rsp), %rdi
leaq 0xe0(%rsp), %rdx
callq 0x2090
leaq 0x4bb9(%rip), %rsi      # 0x701a
leaq 0xe0(%rsp), %rdi
leaq 0xc0(%rsp), %rdx
callq 0x2090
leaq 0x4ba8(%rip), %rsi      # 0x7025
leaq 0xc0(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
callq 0x2090
leaq 0x4b98(%rip), %rsi      # 0x7031
leaq 0xa0(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0x2090
leaq 0x4b83(%rip), %rsi      # 0x7038
leaq 0x80(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0x2090
leaq 0x4b6e(%rip), %rsi      # 0x703c
leaq 0x60(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x2090
leaq 0x180(%rsp), %rdi
leaq 0x160(%rsp), %rdx
movq %rdx, %rsi
callq 0x2b80
leaq 0x180(%rsp), %rdi
leaq 0x140(%rsp), %rdx
movq %rdx, %rsi
callq 0x2b80
leaq 0x180(%rsp), %rdi
leaq 0x120(%rsp), %rdx
movq %rdx, %rsi
callq 0x2b80
leaq 0x180(%rsp), %rdi
leaq 0x100(%rsp), %rdx
movq %rdx, %rsi
callq 0x2b80
leaq 0x180(%rsp), %rdi
leaq 0xe0(%rsp), %rdx
movq %rdx, %rsi
callq 0x2b80
leaq 0x180(%rsp), %rdi
leaq 0xc0(%rsp), %rdx
movq %rdx, %rsi
callq 0x2b80
leaq 0x180(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
movq %rdx, %rsi
callq 0x2b80
leaq 0x180(%rsp), %rdi
leaq 0x80(%rsp), %rdx
movq %rdx, %rsi
callq 0x2b80
leaq 0x180(%rsp), %rdi
leaq 0x60(%rsp), %rdx
movq %rdx, %rsi
callq 0x2b80
leaq 0x180(%rsp), %rdi
xorl %esi, %esi
callq 0x2c74
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x99f7(%rip), %rdi      # 0xbfd0
leaq 0x4a60(%rip), %rsi      # 0x7040
callq 0x2150
leaq 0x40(%rsp), %r15
movq 0x99df(%rip), %r12      # 0xbfd0
movq %rsp, %rbp
leaq 0x4a60(%rip), %rbx      # 0x705b
movq 0x99de(%rip), %rdi      # 0xbfe0
movq %r15, %rsi
callq 0x2050
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2758
movq %r12, %rdi
leaq 0x4a20(%rip), %rsi      # 0x7046
callq 0x2150
movq %rax, %rdi
movq %r15, %rsi
callq 0x2130
movq %rax, %rdi
leaq 0x4a17(%rip), %rsi      # 0x7057
callq 0x2150
leaq 0x20(%rsp), %rdi
leaq 0x180(%rsp), %rsi
movq %r15, %rdx
callq 0x2f1a
cmpb $0x1, 0x20(%rsp)
jne 0x26ab
movq 0x28(%rsp), %r14
movq 0x30(%rsp), %r13
cmpq %r13, %r14
je 0x273a
movq %rbp, %rdi
movq %r14, %rsi
callq 0x21e0
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2150
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2130
movq %rax, %rdi
callq 0x20c0
movq %rbp, %rdi
callq 0x20b0
addq $0x20, %r14
jmp 0x266b
movq %r12, %rdi
leaq 0x49aa(%rip), %rsi      # 0x705f
callq 0x2150
movq %rbp, %rdi
leaq 0x180(%rsp), %rsi
movq %r15, %rdx
callq 0x3012
movq (%rsp), %r14
movq 0x8(%rsp), %r13
cmpq %r13, %r14
je 0x270f
movq (%rsp), %rax
cmpq 0x8(%rsp), %rax
je 0x272d
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2150
movq (%rsp), %rsi
movq %rax, %rdi
callq 0x2130
movq %rax, %rdi
callq 0x20c0
movq %rbp, %rdi
callq 0x31a2
jmp 0x26db
movq %r12, %rdi
leaq 0x498f(%rip), %rsi      # 0x70a8
callq 0x2150
movq %r12, %rdi
leaq 0x4918(%rip), %rsi      # 0x7040
callq 0x2150
movq %rbp, %rdi
callq 0x678a
cmpq %r13, %r14
je 0x2749
movq %r12, %rdi
leaq 0x48fc(%rip), %rsi      # 0x7040
callq 0x2150
leaq 0x28(%rsp), %rdi
callq 0x3450
jmp 0x25fb
leaq 0x40(%rsp), %rdi
callq 0x20b0
leaq 0x60(%rsp), %rdi
callq 0x20b0
leaq 0x80(%rsp), %rdi
callq 0x20b0
leaq 0xa0(%rsp), %rdi
callq 0x20b0
leaq 0xc0(%rsp), %rdi
callq 0x20b0
leaq 0xe0(%rsp), %rdi
callq 0x20b0
leaq 0x100(%rsp), %rdi
callq 0x20b0
leaq 0x120(%rsp), %rdi
callq 0x20b0
leaq 0x140(%rsp), %rdi
callq 0x20b0
leaq 0x160(%rsp), %rdi
callq 0x20b0
leaq 0x180(%rsp), %rdi
callq 0x31bc
xorl %eax, %eax
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x284c
movq %rax, %rbx
jmp 0x288c
movq %rax, %rbx
jmp 0x2899
movq %rax, %rbx
jmp 0x28a6
movq %rax, %rbx
jmp 0x28b3
movq %rax, %rbx
jmp 0x28c0
movq %rax, %rbx
jmp 0x28cd
movq %rax, %rbx
jmp 0x28da
movq %rax, %rbx
jmp 0x28e7
movq %rax, %rbx
jmp 0x28f4
movq %rax, %rbx
jmp 0x2882
jmp 0x2856
jmp 0x2851
jmp 0x284c
jmp 0x2851
movq %rax, %rbx
jmp 0x2878
movq %rax, %rbx
jmp 0x286e
movq %rax, %rbx
movq %rsp, %rdi
callq 0x678a
jmp 0x286e
movq %rax, %rbx
movq %rsp, %rdi
callq 0x20b0
leaq 0x28(%rsp), %rdi
callq 0x3450
leaq 0x40(%rsp), %rdi
callq 0x20b0
leaq 0x60(%rsp), %rdi
callq 0x20b0
leaq 0x80(%rsp), %rdi
callq 0x20b0
leaq 0xa0(%rsp), %rdi
callq 0x20b0
leaq 0xc0(%rsp), %rdi
callq 0x20b0
leaq 0xe0(%rsp), %rdi
callq 0x20b0
leaq 0x100(%rsp), %rdi
callq 0x20b0
leaq 0x120(%rsp), %rdi
callq 0x20b0
leaq 0x140(%rsp), %rdi
callq 0x20b0
leaq 0x160(%rsp), %rdi
callq 0x20b0
leaq 0x180(%rsp), %rdi
callq 0x31bc
movq %rbx, %rdi
callq 0x2280
nop