// File: /workspace/github_cpp_makefile_star2_O3/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 $0x348, %rsp            # imm = 0x348
movq %rdi, %rbx
leaq 0x10(%rdi), %rdx
leaq 0x2ef9(%rip), %rsi      # 0xc5e2
leaq 0x140(%rsp), %r14
movq %r14, %rdi
callq 0x82ba
leaq 0x2eef(%rip), %rsi      # 0xc5ef
movq %r14, %rdi
callq 0x34f0
leaq 0x68(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x972f
movq %rdx, 0x58(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x68(%rsp)
jmp 0x9737
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x60(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x150(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9770
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x140(%rsp), %rdi
callq 0x32e0
leaq 0x140(%rsp), %rdi
leaq 0x58(%rsp), %rsi
movl $0x8, %edx
callq 0x3240
leaq 0xe0(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorl %ebp, %ebp
leaq 0x140(%rsp), %r14
leaq 0xd0(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x3340
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x97da
incl %ebp
jmp 0x97bd
leaq 0x140(%rsp), %rdi
callq 0x30a0
xorl %eax, %eax
movl %eax, 0xf0(%rsp)
movl %eax, 0x10c(%rsp)
movq $0x0, 0x100(%rsp)
movl %eax, 0x118(%rsp)
leaq 0x140(%rsp), %rdi
leaq 0x58(%rsp), %rsi
movl $0x8, %edx
callq 0x3240
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x6794(%rip), %rdi      # 0xffd0
leaq 0x2dbc(%rip), %rsi      # 0xc5ff
movl $0x16, %edx
callq 0x32f0
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
movq 0x6774(%rip), %rdi      # 0xffd0
callq 0x32f0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
movl %ebp, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0xb8(%rsp)
leaq 0x28(%rsp), %r13
leaq 0x30(%rbx), %rax
movq %rax, 0xb0(%rsp)
leaq 0x130(%rsp), %r14
leaq 0x48(%rbx), %rax
movq %rax, 0xc0(%rsp)
leaq 0xf0(%rsp), %r15
movq %rbx, 0x8(%rsp)
leaq 0x140(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x3340
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x9c08
incl (%rbx)
movl $0x1, %edx
movq 0x66d1(%rip), %rdi      # 0xffd0
leaq 0x2d10(%rip), %rsi      # 0xc616
callq 0x32f0
movl (%rbx), %eax
decl %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x26e9(%rip), %xmm0     # 0xc008
divsd 0xb8(%rsp), %xmm0
cvttsd2si %xmm0, %rax
movl %eax, %esi
movq 0x669a(%rip), %rdi      # 0xffd0
callq 0x31a0
movq %rax, %r12
movl $0x2, %edx
movq %rax, %rdi
leaq 0x2ccb(%rip), %rsi      # 0xc618
callq 0x32f0
movl $0x18, %edx
movq %r12, %rdi
leaq 0x2cba(%rip), %rsi      # 0xc61b
callq 0x32f0
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq %r12, %rdi
callq 0x32f0
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0x2ca8(%rip), %rsi      # 0xc632
callq 0x32f0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
movq %r12, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
leaq 0x88(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
addq %rsi, %rdx
leaq 0x78(%rsp), %rdi
callq 0xafec
movq %rbx, %rdi
leaq 0x78(%rsp), %rsi
callq 0x9f3e
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x9a0a
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x3290
movq %r15, %rdi
callq 0x55a0
movl $0x1, 0xf0(%rsp)
movl $0x0, 0x10c(%rsp)
movq $0x0, 0x100(%rsp)
movq %r15, %rdi
leaq 0x2bf6(%rip), %rsi      # 0xc634
callq 0x47bc
movq %rbx, %rdi
movq %r15, %rsi
leaq 0x2bed(%rip), %rdx      # 0xc63d
callq 0x9fa8
leaq 0x98(%rsp), %rdi
movq %r15, %rsi
callq 0x5f2e
movl $0x0, 0x4(%rsp)
movq 0x98(%rsp), %rbx
movq 0xa0(%rsp), %r12
cmpq %r12, %rbx
je 0x9cfb
movl (%rbx), %eax
movl %eax, 0x10(%rsp)
movq %r13, 0x18(%rsp)
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rdi
callq 0xafec
movl 0x10(%rsp), %eax
addl %eax, 0x4(%rsp)
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x9ac5
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3290
addq $0x28, %rbx
cmpq %r12, %rbx
jne 0x9a86
movl 0x4(%rsp), %eax
testl %eax, %eax
je 0x9cfb
movq 0x8(%rsp), %rcx
movq 0x38(%rcx), %rsi
cmpq 0x40(%rcx), %rsi
je 0x9af5
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x38(%rcx)
jmp 0x9b07
movq 0xb0(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0xa524
movq 0x98(%rsp), %r12
movq 0xa0(%rsp), %rbx
cmpq %rbx, %r12
je 0x9be9
movl (%r12), %eax
movl %eax, 0x10(%rsp)
movq %r13, 0x18(%rsp)
movq 0x8(%r12), %rsi
movq 0x10(%r12), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rdi
callq 0xafec
movq %r14, 0x120(%rsp)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq %rsi, %rdx
leaq 0x120(%rsp), %rbp
movq %rbp, %rdi
callq 0xafec
movq %r14, %r15
movl 0x10(%rsp), %r14d
movq 0xc0(%rsp), %rdi
movq %rbp, %rsi
callq 0xa4a8
movq 0x8(%rsp), %rcx
movl (%rcx), %ecx
decl %ecx
shlq $0x20, %rcx
orq %r14, %rcx
movq %rcx, 0xc8(%rsp)
movq %rax, %rdi
leaq 0xc8(%rsp), %rsi
callq 0xa9da
movq 0x120(%rsp), %rdi
movq %r15, %r14
cmpq %r15, %rdi
je 0x9bc9
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x9be0
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3290
addq $0x28, %r12
jmp 0x9b17
leaq 0x98(%rsp), %rdi
callq 0x81dc
movq 0x8(%rsp), %rbx
leaq 0xf0(%rsp), %r15
jmp 0x98cd
movq 0x63c1(%rip), %rdi      # 0xffd0
leaq 0x2a7b(%rip), %rsi      # 0xc691
movl $0x8, %edx
callq 0x32f0
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
movq 0x63a1(%rip), %rdi      # 0xffd0
callq 0x32f0
movq %rax, %rbx
leaq 0x2a5c(%rip), %rsi      # 0xc69a
movl $0xc, %edx
movq %rax, %rdi
callq 0x32f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x9c8e
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0xf0(%rsp), %rdi
callq 0x55a0
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x9cc0
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x140(%rsp), %rdi
callq 0x30c0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x9ce9
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x3290
addq $0x348, %rsp            # imm = 0x348
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2946(%rip), %rdi      # 0xc648
leaq 0x2948(%rip), %rsi      # 0xc651
leaq 0x295f(%rip), %rcx      # 0xc66f
movl $0x5e, %edx
callq 0x3190
jmp 0x9e69
movq %rax, %rbx
jmp 0x9e06
jmp 0x9d8b
movq %rax, %rbx
jmp 0x9e38
movq %rax, %rbx
jmp 0x9e45
movq %rax, %rbx
leaq 0x150(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9e61
movq 0x150(%rsp), %rsi
jmp 0x9e59
jmp 0x9d93
jmp 0x9dda
movq %rax, %rbx
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x9dea
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x9dea
jmp 0x9d93
movq %rax, %rbx
jmp 0x9e13
movq %rax, %rbx
jmp 0x9dea
jmp 0x9d9a
movq %rax, %rbx
movq 0x120(%rsp), %rdi
cmpq %r15, %rdi
je 0x9dc1
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x9dc1
jmp 0x9dda
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x9ddd
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x9ddd
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x81dc
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x9e06
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0xf0(%rsp), %rdi
callq 0x55a0
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x9e38
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x140(%rsp), %rdi
callq 0x30c0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x9e61
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x3290
movq %rbx, %rdi
callq 0x34b0
movq %rax, %rdi
callq 0x8173
nop