// File: ruankotovich[P]TextCorrection-Trie/src/trie.hpp
// Function: trie::Trie_t::buildActiveNodeSet(bool)
void buildActiveNodeSet(bool _onlyFinalWords)
    {
      std::queue<std::pair<TrieNode_t*, int>> seekQueue;
      std::unordered_map<TrieNode_t*, TrieNode_t*> father;
      std::set<TrieNode_t*> visited;
      seekQueue.emplace(this->m_lambdaNode.get(), 0); // add the lambdaNode to the seek
      m_activeNodeSet.emplace(this->m_lambdaNode.get(), 0); // add the lambdaNode to the activeSet
      father.emplace(this->m_lambdaNode.get(), nullptr); // set lambdaNode father as nullptr

      /* initialization */

      while (!seekQueue.empty()) {
        auto currentNode = seekQueue.front(); // get currentNode
        seekQueue.pop();

        for (TrieNode_t* child : currentNode.first->getChildren()) {

          // verify if the child hasn't been visited recently
          if (visited.find(child) == visited.end()) {
            int currentLevel = currentNode.second + 1;

            visited.emplace(child); // add child to the visited set
            father.emplace(child, currentNode.first); // set current vertex as father

            if (currentLevel < m_fuzzyLimitThreshold) { // add the child on the seek only if it has a threshold < fuzzy
              seekQueue.emplace(child, currentLevel);
            }

            if (!_onlyFinalWords || child->isEndOfWord()) { // verify if this child is end of word
              TrieNode_t* currentChild = child;
              m_activeNodeSet.emplace(currentChild, currentLevel); // add the child to the activeSet

              auto currentChild_it = father.find(child);

              // add all the father's father's father's ... father's of this child to the activeSet
              while (currentChild_it->second != nullptr) {

                if (m_activeNodeSet.emplace(currentChild_it->second, --currentLevel).second) {
                  currentChild_it = father.find(currentChild_it->second);
                } else {
                  break;
                }
              }
            }
          }
        }
      }
    }

// Assembly:
subq $0x298, %rsp            # imm = 0x298
movb %sil, %al
movq %rdi, 0x290(%rsp)
andb $0x1, %al
movb %al, 0x28f(%rsp)
movq 0x290(%rsp), %rax
movq %rax, 0x98(%rsp)
leaq 0x238(%rsp), %rdi
movq %rdi, 0xa0(%rsp)
callq 0xb3e0
leaq 0x200(%rsp), %rdi
callq 0xb410
leaq 0x1d0(%rsp), %rdi
callq 0xb420
movq 0x98(%rsp), %rdi
callq 0x9570
movq 0xa0(%rsp), %rdi
movq %rax, 0x1c8(%rsp)
movl $0x0, 0x1c4(%rsp)
leaq 0x1c8(%rsp), %rsi
leaq 0x1c4(%rsp), %rdx
callq 0xb430
jmp 0x3469
movq 0x98(%rsp), %rdi
movq %rdi, %rax
addq $0x78, %rax
movq %rax, 0x80(%rsp)
callq 0x9570
movq 0x80(%rsp), %rdi
movq %rax, 0x1a8(%rsp)
movl $0x0, 0x1a4(%rsp)
leaq 0x1a8(%rsp), %rsi
leaq 0x1a4(%rsp), %rdx
callq 0xb460
movb %dl, 0x8f(%rsp)
movq %rax, 0x90(%rsp)
jmp 0x34c6
movq 0x98(%rsp), %rdi
movb 0x8f(%rsp), %al
movq 0x90(%rsp), %rcx
movq %rcx, 0x190(%rsp)
movb %al, 0x198(%rsp)
callq 0x9570
movq %rax, 0x188(%rsp)
movq $0x0, 0x180(%rsp)
leaq 0x200(%rsp), %rdi
leaq 0x188(%rsp), %rsi
leaq 0x180(%rsp), %rdx
callq 0xb4c0
movb %dl, 0x77(%rsp)
movq %rax, 0x78(%rsp)
jmp 0x352d
movb 0x77(%rsp), %al
movq 0x78(%rsp), %rcx
movq %rcx, 0x170(%rsp)
movb %al, 0x178(%rsp)
leaq 0x238(%rsp), %rdi
callq 0xb510
movb %al, 0x76(%rsp)
jmp 0x3558
movb 0x76(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3567
jmp 0x393b
leaq 0x238(%rsp), %rdi
callq 0xb530
movq %rax, 0x68(%rsp)
jmp 0x357b
movq 0x68(%rsp), %rax
movups (%rax), %xmm0
movaps %xmm0, 0x160(%rsp)
leaq 0x238(%rsp), %rdi
callq 0xb540
jmp 0x359a
movq 0x160(%rsp), %rsi
leaq 0x140(%rsp), %rdi
callq 0xb550
jmp 0x35b1
leaq 0x140(%rsp), %rax
movq %rax, 0x158(%rsp)
movq 0x158(%rsp), %rdi
callq 0xb640
movq %rax, 0x138(%rsp)
movq 0x158(%rsp), %rdi
callq 0xb670
movq %rax, 0x130(%rsp)
leaq 0x138(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0xb6a0
testb $0x1, %al
jne 0x362f
leaq 0x140(%rsp), %rdi
callq 0xb930
jmp 0x3936
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
jmp 0x396a
leaq 0x138(%rsp), %rdi
callq 0xb6e0
movq (%rax), %rax
movq %rax, 0x128(%rsp)
leaq 0x1d0(%rsp), %rdi
leaq 0x128(%rsp), %rsi
callq 0xb710
movq %rax, 0x60(%rsp)
jmp 0x3663
movq 0x60(%rsp), %rax
movq %rax, 0x120(%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0xb750
movq %rax, 0x118(%rsp)
leaq 0x120(%rsp), %rdi
leaq 0x118(%rsp), %rsi
callq 0xb6f0
testb $0x1, %al
jne 0x36a3
jmp 0x3922
movl 0x168(%rsp), %eax
incl %eax
movl %eax, 0x114(%rsp)
leaq 0x1d0(%rsp), %rdi
leaq 0x128(%rsp), %rsi
callq 0xb780
movb %dl, 0x57(%rsp)
movq %rax, 0x58(%rsp)
jmp 0x36d3
movb 0x57(%rsp), %al
movq 0x58(%rsp), %rcx
movq %rcx, 0x100(%rsp)
movb %al, 0x108(%rsp)
leaq 0x200(%rsp), %rdi
leaq 0x128(%rsp), %rsi
leaq 0x160(%rsp), %rdx
callq 0xb7e0
movb %dl, 0x47(%rsp)
movq %rax, 0x48(%rsp)
jmp 0x3713
movq 0x98(%rsp), %rcx
movb 0x47(%rsp), %al
movq 0x48(%rsp), %rdx
movq %rdx, 0xf0(%rsp)
movb %al, 0xf8(%rsp)
movl 0x114(%rsp), %eax
cmpl 0xdc(%rcx), %eax
jge 0x3789
leaq 0x238(%rsp), %rdi
leaq 0x128(%rsp), %rsi
leaq 0x114(%rsp), %rdx
callq 0xb830
jmp 0x3761
jmp 0x3789
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
leaq 0x140(%rsp), %rdi
callq 0xb930
jmp 0x396a
testb $0x1, 0x28f(%rsp)
je 0x37a9
movq 0x128(%rsp), %rdi
callq 0x97d0
testb $0x1, %al
jne 0x37a9
jmp 0x3920
movq 0x98(%rsp), %rdi
movq 0x128(%rsp), %rax
movq %rax, 0xe8(%rsp)
addq $0x78, %rdi
leaq 0xe8(%rsp), %rsi
leaq 0x114(%rsp), %rdx
callq 0xb860
movb %dl, 0x37(%rsp)
movq %rax, 0x38(%rsp)
jmp 0x37e5
movb 0x37(%rsp), %al
movq 0x38(%rsp), %rcx
movq %rcx, 0xd8(%rsp)
movb %al, 0xe0(%rsp)
leaq 0x200(%rsp), %rdi
leaq 0x128(%rsp), %rsi
callq 0xb8c0
movq %rax, 0x28(%rsp)
jmp 0x3819
movq 0x28(%rsp), %rax
movq %rax, 0xd0(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0xb8f0
cmpq $0x0, 0x8(%rax)
je 0x391e
movq 0x98(%rsp), %rax
addq $0x78, %rax
movq %rax, 0x10(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0xb8f0
movq 0x10(%rsp), %rdi
movq %rax, %rsi
addq $0x8, %rsi
movl 0x114(%rsp), %eax
decl %eax
movl %eax, 0x114(%rsp)
leaq 0x114(%rsp), %rdx
callq 0xb860
movb %dl, 0x1f(%rsp)
movq %rax, 0x20(%rsp)
jmp 0x3890
movb 0x1f(%rsp), %al
movq 0x20(%rsp), %rcx
movq %rcx, 0xb0(%rsp)
movb %al, 0xb8(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movb 0xb8(%rsp), %al
movb %al, 0xc8(%rsp)
testb $0x1, 0xc8(%rsp)
je 0x3917
leaq 0xd0(%rsp), %rdi
callq 0xb8f0
movq %rax, %rsi
addq $0x8, %rsi
leaq 0x200(%rsp), %rdi
callq 0xb8c0
movq %rax, 0x8(%rsp)
jmp 0x38f8
movq 0x8(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0xd0(%rsp)
jmp 0x3919
jmp 0x391e
jmp 0x3826
jmp 0x3920
jmp 0x3922
jmp 0x3924
leaq 0x138(%rsp), %rdi
callq 0xb910
jmp 0x35eb
jmp 0x3545
leaq 0x1d0(%rsp), %rdi
callq 0xb990
leaq 0x200(%rsp), %rdi
callq 0xb9a0
leaq 0x238(%rsp), %rdi
callq 0xb9b0
addq $0x298, %rsp            # imm = 0x298
retq
leaq 0x1d0(%rsp), %rdi
callq 0xb990
leaq 0x200(%rsp), %rdi
callq 0xb9a0
leaq 0x238(%rsp), %rdi
callq 0xb9b0
movq 0x1b8(%rsp), %rdi
callq 0x2300
nop