// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x358, %rsp            # imm = 0x358
movq %rdi, 0x8(%rsp)
leaq 0x10(%rdi), %r14
leaq 0x3114(%rip), %rsi      # 0xa5d5
leaq 0x150(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rdx
callq 0x6670
leaq 0x3107(%rip), %rdx      # 0xa5e2
leaq 0xa8(%rsp), %rdi
movq %rbx, %rsi
callq 0x67cf
leaq 0x150(%rsp), %rdi
callq 0x3120
leaq 0x150(%rsp), %rdi
callq 0x32b0
leaq 0x150(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
pushq $0x8
popq %rdx
callq 0x3210
leaq 0x100(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorl %ebp, %ebp
leaq 0x150(%rsp), %rbx
leaq 0xf0(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3300
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x7560
incl %ebp
jmp 0x7543
leaq 0x150(%rsp), %rdi
callq 0x3080
andl $0x0, 0x78(%rsp)
andl $0x0, 0x94(%rsp)
andq $0x0, 0x88(%rsp)
andl $0x0, 0xa0(%rsp)
leaq 0x150(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
pushq $0x8
popq %rdx
callq 0x3210
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x7a0d(%rip), %rdi      # 0xefc8
leaq 0x3030(%rip), %rsi      # 0xa5f2
callq 0x3250
movq %rax, %rdi
movq %r14, %rsi
callq 0x3230
movq %rax, %rdi
callq 0x3130
movq %r14, 0x28(%rsp)
movl %ebp, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x38(%rsp)
movq 0x8(%rsp), %rax
leaq 0x30(%rax), %rcx
movq %rcx, 0x30(%rsp)
leaq 0xd0(%rsp), %r15
addq $0x48, %rax
movq %rax, 0x40(%rsp)
leaq 0x130(%rsp), %rbp
leaq 0xc8(%rsp), %r13
leaq 0x110(%rsp), %rbx
leaq 0x150(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x3300
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x7814
movq 0x8(%rsp), %rax
incl (%rax)
movq 0x7973(%rip), %rdi      # 0xefc8
leaq 0x2fad(%rip), %rsi      # 0xa609
callq 0x3250
movq 0x8(%rsp), %rcx
movl (%rcx), %ecx
decl %ecx
cvtsi2sd %rcx, %xmm0
mulsd 0x2991(%rip), %xmm0     # 0xa008
divsd 0x38(%rsp), %xmm0
cvttsd2si %xmm0, %rcx
movl %ecx, %esi
movq %rax, %rdi
callq 0x3190
movq %rax, %rdi
leaq 0x2f75(%rip), %rsi      # 0xa60b
callq 0x3250
movq %rax, %rdi
leaq 0x2f69(%rip), %rsi      # 0xa60e
callq 0x3250
movq %rax, %rdi
leaq 0x58(%rsp), %rsi
callq 0x3230
movq %rax, %rdi
leaq 0x2f64(%rip), %rsi      # 0xa625
callq 0x3250
movq %rax, %rdi
callq 0x3130
movq %rbp, %rdi
leaq 0x58(%rsp), %rsi
callq 0x3350
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x7a02
movq %rbp, %rdi
callq 0x3120
leaq 0x78(%rsp), %rdi
leaq 0x2f2b(%rip), %rsi      # 0xa627
callq 0x4c40
movq 0x8(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0x2f1e(%rip), %rdx      # 0xa630
callq 0x7a46
leaq 0x10(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x5160
andl $0x0, 0x4(%rsp)
movq 0x10(%rsp), %r12
movq 0x18(%rsp), %r14
cmpq %r14, %r12
je 0x7763
movq %r13, %rdi
movq %r12, %rsi
callq 0x7d4a
movl 0xc8(%rsp), %eax
addl %eax, 0x4(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x3120
addq $0x28, %r12
jmp 0x7735
cmpl $0x0, 0x4(%rsp)
je 0x7898
movq %rbx, %r14
movq 0x30(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x7d5c
movq 0x10(%rsp), %r12
movq 0x18(%rsp), %rax
movq %rax, 0x48(%rsp)
cmpq 0x48(%rsp), %r12
je 0x7802
movq %r13, %rdi
movq %r12, %rsi
callq 0x7d4a
movq %r14, %rbx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3350
movq %rbx, %rsi
movq %r15, %rbx
movl 0xc8(%rsp), %r15d
movq 0x40(%rsp), %rdi
callq 0x7d7a
movq 0x8(%rsp), %rcx
movl (%rcx), %ecx
decl %ecx
shlq $0x20, %rcx
orq %r15, %rcx
movq %rcx, 0x50(%rsp)
movq %rax, %rdi
leaq 0x50(%rsp), %rsi
callq 0x8304
movq %r14, %rdi
callq 0x3120
movq %rbx, %r15
movq %rbx, %rdi
callq 0x3120
addq $0x28, %r12
jmp 0x778f
leaq 0x10(%rsp), %rdi
callq 0x65d2
movq %r14, %rbx
jmp 0x7623
movq 0x77ad(%rip), %rdi      # 0xefc8
leaq 0x2e62(%rip), %rsi      # 0xa684
callq 0x3250
movq 0x28(%rsp), %rsi
movq %rax, %rdi
callq 0x3230
leaq 0x2e52(%rip), %rsi      # 0xa68d
movq %rax, %rdi
callq 0x3250
movq %rax, %rdi
callq 0x3130
leaq 0x58(%rsp), %rdi
callq 0x3120
leaq 0x78(%rsp), %rdi
callq 0x4bc6
leaq 0xf0(%rsp), %rdi
callq 0x3120
leaq 0x150(%rsp), %rdi
callq 0x30b0
leaq 0xa8(%rsp), %rdi
callq 0x3120
addq $0x358, %rsp            # imm = 0x358
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2d9c(%rip), %rdi      # 0xa63b
leaq 0x2d9e(%rip), %rsi      # 0xa644
leaq 0x2db5(%rip), %rcx      # 0xa662
pushq $0x5e
popq %rdx
callq 0x3180
movq %rax, %r14
jmp 0x793e
jmp 0x78f7
movq %rax, %r14
jmp 0x7955
movq %rax, %r14
jmp 0x7962
movq %rax, %r14
leaq 0x150(%rsp), %rdi
jmp 0x796a
jmp 0x78fc
jmp 0x7927
movq %rax, %r14
leaq 0x130(%rsp), %rdi
callq 0x3120
jmp 0x7934
jmp 0x78fc
movq %rax, %r14
jmp 0x7948
movq %rax, %r14
jmp 0x7934
jmp 0x7927
movq %rax, %r14
jmp 0x791d
jmp 0x790a
movq %rax, %r14
movq %rbx, %r15
leaq 0x110(%rsp), %rdi
callq 0x3120
movq %r15, %rdi
callq 0x3120
jmp 0x792a
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x65d2
leaq 0x58(%rsp), %rdi
callq 0x3120
leaq 0x78(%rsp), %rdi
callq 0x4bc6
leaq 0xf0(%rsp), %rdi
callq 0x3120
leaq 0x150(%rsp), %rdi
callq 0x30b0
leaq 0xa8(%rsp), %rdi
callq 0x3120
movq %r14, %rdi
callq 0x3480
nop