// File: /workspace/github_cpp_makefile_star2_O3/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 0x2d4e
leaq 0x150(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5b53(%rip), %rsi      # 0x8020
leaq 0x5b50(%rip), %rdx      # 0x8024
leaq 0x140(%rsp), %rdi
callq 0x6d9e
leaq 0x130(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5b31(%rip), %rsi      # 0x8025
leaq 0x5b30(%rip), %rdx      # 0x802b
leaq 0x120(%rsp), %rdi
callq 0x6d9e
leaq 0x110(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5b11(%rip), %rsi      # 0x802c
leaq 0x5b0e(%rip), %rdx      # 0x8030
leaq 0x100(%rsp), %rdi
callq 0x6d9e
leaq 0xf0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5aef(%rip), %rsi      # 0x8031
leaq 0x5aec(%rip), %rdx      # 0x8035
leaq 0xe0(%rsp), %rdi
callq 0x6d9e
leaq 0xd0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5acd(%rip), %rsi      # 0x8036
leaq 0x5ad0(%rip), %rdx      # 0x8040
leaq 0xc0(%rsp), %rdi
callq 0x6d9e
leaq 0xb0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5ab1(%rip), %rsi      # 0x8041
leaq 0x5ab5(%rip), %rdx      # 0x804c
leaq 0xa0(%rsp), %rdi
callq 0x6d9e
leaq 0x90(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5a96(%rip), %rsi      # 0x804d
leaq 0x5a95(%rip), %rdx      # 0x8053
leaq 0x80(%rsp), %rdi
callq 0x6d9e
leaq 0x70(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5a79(%rip), %rsi      # 0x8054
leaq 0x5a75(%rip), %rdx      # 0x8057
leaq 0x60(%rsp), %rdi
callq 0x6d9e
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5a5c(%rip), %rsi      # 0x8058
leaq 0x5a58(%rip), %rdx      # 0x805b
leaq 0x40(%rsp), %rdi
callq 0x6d9e
leaq 0x180(%rsp), %rdi
leaq 0x140(%rsp), %rdx
movq %rdx, %rsi
callq 0x30a0
leaq 0x180(%rsp), %rdi
leaq 0x120(%rsp), %rdx
movq %rdx, %rsi
callq 0x30a0
leaq 0x180(%rsp), %rdi
leaq 0x100(%rsp), %rdx
movq %rdx, %rsi
callq 0x30a0
leaq 0x180(%rsp), %rdi
leaq 0xe0(%rsp), %rdx
movq %rdx, %rsi
callq 0x30a0
leaq 0x180(%rsp), %rdi
leaq 0xc0(%rsp), %rdx
movq %rdx, %rsi
callq 0x30a0
leaq 0x180(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
movq %rdx, %rsi
callq 0x30a0
leaq 0x180(%rsp), %rdi
leaq 0x80(%rsp), %rdx
movq %rdx, %rsi
callq 0x30a0
leaq 0x180(%rsp), %rdi
leaq 0x60(%rsp), %rdx
movq %rdx, %rsi
callq 0x30a0
leaq 0x180(%rsp), %rdi
leaq 0x40(%rsp), %rdx
movq %rdx, %rsi
callq 0x30a0
leaq 0x180(%rsp), %rdi
xorl %esi, %esi
callq 0x3218
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x98c7(%rip), %rdi      # 0xbfd0
leaq 0x594c(%rip), %rsi      # 0x805c
movl $0x5, %edx
callq 0x21a0
movq 0x98bf(%rip), %r14      # 0xbfe0
leaq 0x20(%rsp), %r15
movq 0x98a3(%rip), %r12      # 0xbfd0
movq %rsp, %rbp
leaq 0x5940(%rip), %rbx      # 0x8077
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2290
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2972
movl $0x10, %edx
movq %r12, %rdi
leaq 0x58e8(%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 0x58d3(%rip), %rsi      # 0x8073
callq 0x21a0
leaq 0x160(%rsp), %rdi
leaq 0x180(%rsp), %rsi
movq %r15, %rdx
callq 0x35f0
cmpb $0x1, 0x160(%rsp)
jne 0x286e
movq 0x168(%rsp), %r14
movq 0x170(%rsp), %r15
cmpq %r15, %r14
je 0x290e
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0x6d08
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 0x2865
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2180
addq $0x20, %r14
jmp 0x27db
movl $0x48, %edx
movq %r12, %rdi
leaq 0x57fe(%rip), %rsi      # 0x807b
callq 0x21a0
movq %rbp, %rdi
leaq 0x180(%rsp), %rsi
movq %r15, %rdx
callq 0x3726
movq (%rsp), %rax
cmpq 0x8(%rsp), %rax
je 0x2940
movq (%rsp), %rax
cmpq 0x8(%rsp), %rax
je 0x2906
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 0x393a
jmp 0x28a4
movq %rbp, %rdi
callq 0x6caa
movl $0x5, %edx
movq %r12, %rdi
leaq 0x573f(%rip), %rsi      # 0x805c
callq 0x21a0
movq 0x96b7(%rip), %r14      # 0xbfe0
leaq 0x20(%rsp), %r15
leaq 0x168(%rsp), %rdi
callq 0x3cfe
jmp 0x2737
movl $0x2c, %edx
movq %r12, %rdi
leaq 0x5775(%rip), %rsi      # 0x80c4
callq 0x21a0
movl $0x5, %edx
movq %r12, %rdi
leaq 0x56f9(%rip), %rsi      # 0x805c
callq 0x21a0
movq %rbp, %rdi
callq 0x6caa
jmp 0x292e
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x298e
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x29aa
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x29c6
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x29eb
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x2a10
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x2a35
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x2a5a
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x2a7f
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0x2aa4
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x2ac9
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x2180
leaq 0x260(%rsp), %rdi
callq 0x3cfe
leaq 0x228(%rsp), %rdi
callq 0x46ee
leaq 0x1f8(%rsp), %rdi
callq 0x4766
leaq 0x1c0(%rsp), %rdi
callq 0x47b6
leaq 0x188(%rsp), %rbx
movq %rbx, %rdi
callq 0x4826
movq -0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x2b34
leaq 0x38(%rbx), %rdi
callq 0x3dbe
movq %rbx, %rdi
callq 0x3df2
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 0x2b9f
movq %rax, %rbx
jmp 0x2c19
movq %rax, %rbx
jmp 0x2c35
movq %rax, %rbx
jmp 0x2c5a
movq %rax, %rbx
jmp 0x2c7f
movq %rax, %rbx
jmp 0x2ca4
movq %rax, %rbx
jmp 0x2cc9
movq %rax, %rbx
jmp 0x2cee
movq %rax, %rbx
jmp 0x2d13
movq %rax, %rbx
jmp 0x2d38
movq %rax, %rbx
jmp 0x2bfd
jmp 0x2bc9
jmp 0x2ba4
jmp 0x2b9f
jmp 0x2ba4
movq %rax, %rbx
jmp 0x2be1
movq %rax, %rbx
jmp 0x2bd4
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2bd4
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2180
jmp 0x2bd4
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6caa
leaq 0x168(%rsp), %rdi
callq 0x3cfe
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x2bfd
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x2c19
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x2c35
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x2c5a
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x2c7f
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x2ca4
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x2cc9
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x2cee
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0x2d13
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x2180
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x2d38
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x2180
leaq 0x180(%rsp), %rdi
callq 0x3990
movq %rbx, %rdi
callq 0x2270
nop