// File: /workspace/github_cpp_makefile_star2_O1/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 0x2d24
leaq 0x150(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5b73(%rip), %rsi      # 0x8020
leaq 0x5b70(%rip), %rdx      # 0x8024
leaq 0x140(%rsp), %rdi
callq 0x6e4e
leaq 0x130(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5b51(%rip), %rsi      # 0x8025
leaq 0x5b50(%rip), %rdx      # 0x802b
leaq 0x120(%rsp), %rdi
callq 0x6e4e
leaq 0x110(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5b31(%rip), %rsi      # 0x802c
leaq 0x5b2e(%rip), %rdx      # 0x8030
leaq 0x100(%rsp), %rdi
callq 0x6e4e
leaq 0xf0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5b0f(%rip), %rsi      # 0x8031
leaq 0x5b0c(%rip), %rdx      # 0x8035
leaq 0xe0(%rsp), %rdi
callq 0x6e4e
leaq 0xd0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5aed(%rip), %rsi      # 0x8036
leaq 0x5af0(%rip), %rdx      # 0x8040
leaq 0xc0(%rsp), %rdi
callq 0x6e4e
leaq 0xb0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5ad1(%rip), %rsi      # 0x8041
leaq 0x5ad5(%rip), %rdx      # 0x804c
leaq 0xa0(%rsp), %rdi
callq 0x6e4e
leaq 0x90(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5ab6(%rip), %rsi      # 0x804d
leaq 0x5ab5(%rip), %rdx      # 0x8053
leaq 0x80(%rsp), %rdi
callq 0x6e4e
leaq 0x70(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5a99(%rip), %rsi      # 0x8054
leaq 0x5a95(%rip), %rdx      # 0x8057
leaq 0x60(%rsp), %rdi
callq 0x6e4e
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5a7c(%rip), %rsi      # 0x8058
leaq 0x5a78(%rip), %rdx      # 0x805b
leaq 0x40(%rsp), %rdi
callq 0x6e4e
leaq 0x180(%rsp), %rdi
leaq 0x140(%rsp), %rdx
movq %rdx, %rsi
callq 0x3076
leaq 0x180(%rsp), %rdi
leaq 0x120(%rsp), %rdx
movq %rdx, %rsi
callq 0x3076
leaq 0x180(%rsp), %rdi
leaq 0x100(%rsp), %rdx
movq %rdx, %rsi
callq 0x3076
leaq 0x180(%rsp), %rdi
leaq 0xe0(%rsp), %rdx
movq %rdx, %rsi
callq 0x3076
leaq 0x180(%rsp), %rdi
leaq 0xc0(%rsp), %rdx
movq %rdx, %rsi
callq 0x3076
leaq 0x180(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
movq %rdx, %rsi
callq 0x3076
leaq 0x180(%rsp), %rdi
leaq 0x80(%rsp), %rdx
movq %rdx, %rsi
callq 0x3076
leaq 0x180(%rsp), %rdi
leaq 0x60(%rsp), %rdx
movq %rdx, %rsi
callq 0x3076
leaq 0x180(%rsp), %rdi
leaq 0x40(%rsp), %rdx
movq %rdx, %rsi
callq 0x3076
leaq 0x180(%rsp), %rdi
xorl %esi, %esi
callq 0x31dc
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x98e7(%rip), %rdi      # 0xbfd0
leaq 0x596c(%rip), %rsi      # 0x805c
movl $0x5, %edx
callq 0x21a0
movq 0x98df(%rip), %r14      # 0xbfe0
movq 0x98c8(%rip), %r12      # 0xbfd0
movq %rsp, %rbp
leaq 0x5965(%rip), %rbx      # 0x8077
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %edx
movq %r14, %rdi
leaq 0x20(%rsp), %rsi
callq 0x2290
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2948
movl $0x10, %edx
movq %r12, %rdi
leaq 0x590b(%rip), %rsi      # 0x8062
callq 0x21a0
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %r12, %rdi
callq 0x21a0
movl $0x3, %edx
movq %rax, %rdi
leaq 0x58f6(%rip), %rsi      # 0x8073
callq 0x21a0
leaq 0x160(%rsp), %rdi
leaq 0x180(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x35da
cmpb $0x1, 0x160(%rsp)
jne 0x284d
movq 0x168(%rsp), %r14
movq 0x170(%rsp), %r15
cmpq %r15, %r14
je 0x291b
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0x6dbe
movl $0x3, %edx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x21a0
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x21a0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2844
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2180
addq $0x20, %r14
jmp 0x27ba
movl $0x48, %edx
movq %r12, %rdi
leaq 0x581f(%rip), %rsi      # 0x807b
callq 0x21a0
movq %rbp, %rdi
leaq 0x180(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x36e8
movq (%rsp), %r15
movq 0x8(%rsp), %r14
cmpq %r14, %r15
je 0x28e6
movq (%rsp), %rax
cmpq 0x8(%rsp), %rax
je 0x290e
movl $0x3, %edx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x21a0
movq (%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r12, %rdi
callq 0x21a0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq %rbp, %rdi
callq 0x38fc
jmp 0x2884
movl $0x2c, %edx
movq %r12, %rdi
leaq 0x57cf(%rip), %rsi      # 0x80c4
callq 0x21a0
movl $0x5, %edx
movq %r12, %rdi
leaq 0x5753(%rip), %rsi      # 0x805c
callq 0x21a0
movq %rbp, %rdi
callq 0x6d62
cmpq %r14, %r15
je 0x292f
movl $0x5, %edx
movq %r12, %rdi
leaq 0x5732(%rip), %rsi      # 0x805c
callq 0x21a0
leaq 0x168(%rsp), %rdi
callq 0x3cc0
movq 0x969d(%rip), %r14      # 0xbfe0
jmp 0x2712
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x2964
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x2980
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x299c
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x29c1
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x29e6
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x2a0b
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x2a30
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x2a55
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0x2a7a
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x2a9f
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x2180
leaq 0x260(%rsp), %rdi
callq 0x3cc0
leaq 0x228(%rsp), %rdi
callq 0x473a
leaq 0x1f8(%rsp), %rdi
callq 0x47b2
leaq 0x1c0(%rsp), %rdi
callq 0x4802
leaq 0x188(%rsp), %rbx
movq %rbx, %rdi
callq 0x4872
movq -0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x2b0a
leaq 0x38(%rbx), %rdi
callq 0x3d7e
movq %rbx, %rdi
callq 0x3db2
movl $0x40, %esi
movq %rbx, %rdi
callq 0x2180
xorl %eax, %eax
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2b75
movq %rax, %rbx
jmp 0x2bef
movq %rax, %rbx
jmp 0x2c0b
movq %rax, %rbx
jmp 0x2c30
movq %rax, %rbx
jmp 0x2c55
movq %rax, %rbx
jmp 0x2c7a
movq %rax, %rbx
jmp 0x2c9f
movq %rax, %rbx
jmp 0x2cc4
movq %rax, %rbx
jmp 0x2ce9
movq %rax, %rbx
jmp 0x2d0e
movq %rax, %rbx
jmp 0x2bd3
jmp 0x2b9f
jmp 0x2b7a
jmp 0x2b75
jmp 0x2b7a
movq %rax, %rbx
jmp 0x2bb7
movq %rax, %rbx
jmp 0x2baa
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2baa
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2180
jmp 0x2baa
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6d62
leaq 0x168(%rsp), %rdi
callq 0x3cc0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x2bd3
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x2bef
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x2c0b
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x2c30
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x2c55
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x2c7a
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x2c9f
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x2cc4
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0x2ce9
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x2d0e
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x2180
leaq 0x180(%rsp), %rdi
callq 0x3952
movq %rbx, %rdi
callq 0x2270
nop