// File: IHorvalds[P]RomAna/./processing/analyze_poet.hpp
// Function: PoetAnalyzer::processPoems()
void processPoems() {
    std::string filename = "poets/poems/" + poet + "_list_poems.txt";
    std::ifstream in;
    
    // Compute the number of poems
    in.open(filename);
    uint32_t totalCountOfPoems = 0;
    std::string str;
    while (in >> str)
      ++totalCountOfPoems;
    in.close();
    
    // Don't alloc the dictionary
    InflexEngine dict(InflexEngine::Read);
    
    // Read each poem from the list
    in.open(filename);
    std::string currPoem; 
    std::cout << "Start the analysis of " << this->poet << std::endl;
    while (in >> currPoem) {
      ++countPoems;
      
      std::cout << "[" << static_cast<unsigned>(100 * (double)(countPoems - 1) / totalCountOfPoems) << "%]" << ":  currently analyzing '" << currPoem << "'" << std::endl;
      
      // Read the poetry from the html file
      receivePoem(currPoem);
      
      // Reset the InflexEngine with the initial dictionary
      dict.reset("dict.bin");
      
      // Parse the poetry and save the frequencies into InflexEngine
      dictionaryTask(dict, "parsed.txt");
    
      // Get the frequencies of inflections
      std::vector<std::pair<uint32_t, std::string>> freqs = dict.getFrequencies();
    
      // Compute the size of the current poem and store it
      uint32_t poemSize = 0;
      for (auto e : freqs)
        poemSize += e.first;
      assert(poemSize);
      sizeOfPoems.push_back(poemSize);
    
      // Update the map with frequencies per word
      for (auto iter: freqs) {
        std::string word = iter.second;
        uint32_t currFreq = iter.first;
        
        // Store the index of the poem along the absolute frequency
        wordToFreqs[word].push_back(std::make_pair(currFreq, countPoems - 1));
      }
    }
    std::cout << "[100%]: " << this->poet << " is finished" << std::endl;
  }

// Assembly:
subq $0x468, %rsp            # imm = 0x468
movq %rdi, 0x460(%rsp)
movq 0x460(%rsp), %rdx
movq %rdx, 0x90(%rsp)
addq $0x10, %rdx
leaq 0x72f4(%rip), %rsi      # 0x1561e
leaq 0x420(%rsp), %rdi
movq %rdi, 0x98(%rsp)
callq 0xb330
movq 0x98(%rsp), %rsi
leaq 0x72dd(%rip), %rdx      # 0x1562b
leaq 0x440(%rsp), %rdi
callq 0xb6e0
jmp 0xe35d
leaq 0x420(%rsp), %rdi
callq 0x4200
leaq 0x208(%rsp), %rdi
callq 0x43e0
jmp 0xe379
leaq 0x208(%rsp), %rdi
leaq 0x440(%rsp), %rsi
movl $0x8, %edx
callq 0x42e0
jmp 0xe395
movl $0x0, 0x204(%rsp)
leaq 0x1e0(%rsp), %rdi
callq 0x44e0
leaq 0x208(%rsp), %rdi
leaq 0x1e0(%rsp), %rsi
callq 0x4450
movq %rax, 0x88(%rsp)
jmp 0xe3cc
movq 0x88(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x4430
movb %al, 0x87(%rsp)
jmp 0xe3ec
movb 0x87(%rsp), %al
testb $0x1, %al
jne 0xe3fc
jmp 0xe480
movl 0x204(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x204(%rsp)
jmp 0xe3ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x418(%rsp)
movl %eax, 0x414(%rsp)
leaq 0x420(%rsp), %rdi
callq 0x4200
jmp 0xeabc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x418(%rsp)
movl %eax, 0x414(%rsp)
jmp 0xeaaf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x418(%rsp)
movl %eax, 0x414(%rsp)
jmp 0xeaa2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x418(%rsp)
movl %eax, 0x414(%rsp)
jmp 0xea95
leaq 0x208(%rsp), %rdi
callq 0x40c0
jmp 0xe48f
xorl %esi, %esi
movl %esi, %ecx
leaq 0x1b0(%rsp), %rdi
movq %rcx, %rdx
callq 0x6110
jmp 0xe4a5
leaq 0x208(%rsp), %rdi
leaq 0x440(%rsp), %rsi
movl $0x8, %edx
callq 0x42e0
jmp 0xe4c1
leaq 0x190(%rsp), %rdi
callq 0x44e0
movq 0xdaf3(%rip), %rdi      # 0x1bfc8
leaq 0x715f(%rip), %rsi      # 0x1563b
callq 0x4330
movq %rax, 0x78(%rsp)
jmp 0xe4e8
movq 0x78(%rsp), %rdi
movq 0x90(%rsp), %rsi
addq $0x10, %rsi
callq 0x4310
movq %rax, 0x70(%rsp)
jmp 0xe505
movq 0x70(%rsp), %rdi
movq 0xda97(%rip), %rsi      # 0x1bfa8
callq 0x4380
jmp 0xe518
jmp 0xe51a
leaq 0x208(%rsp), %rdi
leaq 0x190(%rsp), %rsi
callq 0x4450
movq %rax, 0x68(%rsp)
jmp 0xe536
movq 0x68(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x4430
movb %al, 0x67(%rsp)
jmp 0xe550
movb 0x67(%rsp), %al
testb $0x1, %al
jne 0xe55d
jmp 0xe9d0
movq 0x90(%rsp), %rax
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
movq 0xda56(%rip), %rdi      # 0x1bfc8
leaq 0x70d9(%rip), %rsi      # 0x15652
callq 0x4330
movq %rax, 0x58(%rsp)
jmp 0xe585
movq 0x58(%rsp), %rdi
movq 0x90(%rsp), %rax
movl (%rax), %eax
decl %eax
cvtsi2sd %rax, %xmm0
movsd 0x6a65(%rip), %xmm1     # 0x15008
mulsd %xmm1, %xmm0
movl 0x204(%rsp), %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, %esi
callq 0x44a0
movq %rax, 0x50(%rsp)
jmp 0xe5ca
movq 0x50(%rsp), %rdi
leaq 0x707e(%rip), %rsi      # 0x15654
callq 0x4330
movq %rax, 0x48(%rsp)
jmp 0xe5e2
movq 0x48(%rsp), %rdi
leaq 0x7069(%rip), %rsi      # 0x15657
callq 0x4330
movq %rax, 0x40(%rsp)
jmp 0xe5fa
movq 0x40(%rsp), %rdi
leaq 0x190(%rsp), %rsi
callq 0x4310
movq %rax, 0x38(%rsp)
jmp 0xe613
movq 0x38(%rsp), %rdi
leaq 0x704f(%rip), %rsi      # 0x1566e
callq 0x4330
movq %rax, 0x30(%rsp)
jmp 0xe62b
movq 0x30(%rsp), %rdi
movq 0xd971(%rip), %rsi      # 0x1bfa8
callq 0x4380
jmp 0xe63e
leaq 0x170(%rsp), %rdi
leaq 0x190(%rsp), %rsi
callq 0x4170
jmp 0xe655
movq 0x90(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0xef00
jmp 0xe66c
leaq 0x170(%rsp), %rdi
callq 0x4200
leaq 0x6ff0(%rip), %rsi      # 0x15670
leaq 0x1b0(%rsp), %rdi
callq 0x7110
jmp 0xe68f
movq 0x90(%rsp), %rdi
leaq 0x6fdb(%rip), %rdx      # 0x15679
leaq 0x1b0(%rsp), %rsi
callq 0xef80
jmp 0xe6ad
leaq 0x158(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x7b30
jmp 0xe6c4
movl $0x0, 0x154(%rsp)
leaq 0x158(%rsp), %rax
movq %rax, 0x148(%rsp)
movq 0x148(%rsp), %rdi
callq 0xb130
movq %rax, 0x140(%rsp)
movq 0x148(%rsp), %rdi
callq 0xb160
movq %rax, 0x138(%rsp)
leaq 0x140(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0xb190
testb $0x1, %al
jne 0xe727
jmp 0xe7e8
leaq 0x140(%rsp), %rdi
callq 0xf490
movq %rax, %rsi
leaq 0x110(%rsp), %rdi
callq 0xf4a0
jmp 0xe746
movl 0x110(%rsp), %eax
addl 0x154(%rsp), %eax
movl %eax, 0x154(%rsp)
leaq 0x110(%rsp), %rdi
callq 0xb110
leaq 0x140(%rsp), %rdi
callq 0xb1e0
jmp 0xe709
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x418(%rsp)
movl %eax, 0x414(%rsp)
jmp 0xea88
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x418(%rsp)
movl %eax, 0x414(%rsp)
jmp 0xea7b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x418(%rsp)
movl %eax, 0x414(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x4200
jmp 0xea7b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x418(%rsp)
movl %eax, 0x414(%rsp)
jmp 0xe9be
cmpl $0x0, 0x154(%rsp)
je 0xe7f4
jmp 0xe813
leaq 0x6e89(%rip), %rdi      # 0x15684
leaq 0x6e8b(%rip), %rsi      # 0x1568d
movl $0x5e, %edx
leaq 0x6e9d(%rip), %rcx      # 0x156ab
callq 0x4230
movq 0x90(%rsp), %rdi
addq $0x30, %rdi
leaq 0x154(%rsp), %rsi
callq 0xf4e0
jmp 0xe82e
leaq 0x158(%rsp), %rax
movq %rax, 0x108(%rsp)
movq 0x108(%rsp), %rdi
callq 0xb130
movq %rax, 0x100(%rsp)
movq 0x108(%rsp), %rdi
callq 0xb160
movq %rax, 0xf8(%rsp)
leaq 0x100(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0xb190
testb $0x1, %al
jne 0xe886
jmp 0xe9ac
leaq 0x100(%rsp), %rdi
callq 0xf490
movq %rax, %rsi
leaq 0xd0(%rsp), %rdi
callq 0xf4a0
jmp 0xe8a5
leaq 0xd8(%rsp), %rsi
leaq 0xb0(%rsp), %rdi
callq 0x4170
jmp 0xe8bc
movq 0x90(%rsp), %rdi
movl 0xd0(%rsp), %eax
movl %eax, 0xac(%rsp)
addq $0x48, %rdi
leaq 0xb0(%rsp), %rsi
callq 0xf550
movq %rax, 0x28(%rsp)
jmp 0xe8ea
movq 0x90(%rsp), %rax
movl (%rax), %eax
decl %eax
movl %eax, 0xa0(%rsp)
leaq 0xac(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0xf670
movq %rax, 0x20(%rsp)
jmp 0xe919
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rax
movq %rax, 0xa4(%rsp)
leaq 0xa4(%rsp), %rsi
callq 0xf640
jmp 0xe93a
leaq 0xb0(%rsp), %rdi
callq 0x4200
leaq 0xd0(%rsp), %rdi
callq 0xb110
leaq 0x100(%rsp), %rdi
callq 0xb1e0
jmp 0xe868
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x418(%rsp)
movl %eax, 0x414(%rsp)
jmp 0xe99d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x418(%rsp)
movl %eax, 0x414(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x4200
leaq 0xd0(%rsp), %rdi
callq 0xb110
jmp 0xe9be
leaq 0x158(%rsp), %rdi
callq 0xb040
jmp 0xe51a
leaq 0x158(%rsp), %rdi
callq 0xb040
jmp 0xea7b
movq 0xd5f1(%rip), %rdi      # 0x1bfc8
leaq 0x6cef(%rip), %rsi      # 0x156cd
callq 0x4330
movq %rax, 0x18(%rsp)
jmp 0xe9ea
movq 0x18(%rsp), %rdi
movq 0x90(%rsp), %rsi
addq $0x10, %rsi
callq 0x4310
movq %rax, 0x10(%rsp)
jmp 0xea07
movq 0x10(%rsp), %rdi
leaq 0x6cc3(%rip), %rsi      # 0x156d6
callq 0x4330
movq %rax, 0x8(%rsp)
jmp 0xea1f
movq 0x8(%rsp), %rdi
movq 0xd57d(%rip), %rsi      # 0x1bfa8
callq 0x4380
jmp 0xea32
leaq 0x190(%rsp), %rdi
callq 0x4200
leaq 0x1b0(%rsp), %rdi
callq 0x7030
leaq 0x1e0(%rsp), %rdi
callq 0x4200
leaq 0x208(%rsp), %rdi
callq 0x4100
leaq 0x440(%rsp), %rdi
callq 0x4200
addq $0x468, %rsp            # imm = 0x468
retq
leaq 0x190(%rsp), %rdi
callq 0x4200
leaq 0x1b0(%rsp), %rdi
callq 0x7030
leaq 0x1e0(%rsp), %rdi
callq 0x4200
leaq 0x208(%rsp), %rdi
callq 0x4100
leaq 0x440(%rsp), %rdi
callq 0x4200
movq 0x418(%rsp), %rdi
callq 0x4620
nopl (%rax)