// File: /workspace/github_cpp_makefile_star2_O1/IHorvalds[P]RomAna/./processing/analyze_poet.hpp
// Function: PoetAnalyzer::saveFrequencies()
void saveFrequencies() {
    std::string filename = "poets/local/frequency/" + poet + "_local_frequencies.txt";
    std::ofstream out(filename);
    
    // Parse all his/her poems
    processPoems();
    
    /** Save in the file "poet_words_frequencies.txt"
      The encoding is:
      On the first line of the file: [countPoems] [sizeOfEachPoem]
      word = [word] count = [number of poems the words appears in] [list of pair(absolute frequency, index of poem)]
    **/
    
    // Print the first 2 lines
    out << countPoems;
    for (auto e : sizeOfPoems)
        out << " " << e;
    out << "\n";
    
    // And the rest
    for (auto iter : wordToFreqs) {
      std::string word = iter.first;
      std::vector<std::pair<uint32_t, uint32_t>> freqs = iter.second;

      // Sort the frequencies
      std::sort(freqs.begin(), freqs.end(), [](auto& left, auto& right) {
        return (left.first < right.first);
      });

      // And print the file
      out << word << " " << freqs.size();
      for (auto elem : freqs)
        out << " " << elem.first << " " << elem.second; 
      out << "\n";
    }
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2a8, %rsp            # imm = 0x2A8
movq %rdi, %rbp
leaq 0x10(%rdi), %rdx
leaq 0x4051(%rip), %rsi      # 0xc5b2
leaq 0xa8(%rsp), %r14
movq %r14, %rdi
callq 0x8342
leaq 0x4051(%rip), %rsi      # 0xc5c9
movq %r14, %rdi
callq 0x34f0
leaq 0x50(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x85a7
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
jmp 0x85ad
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x48(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x85e6
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0xa8(%rsp), %rdi
leaq 0x40(%rsp), %rsi
movl $0x10, %edx
callq 0x3510
movq %rbp, %rdi
callq 0x977c
movl (%rbp), %esi
leaq 0xa8(%rsp), %rdi
callq 0x31a0
movq 0x30(%rbp), %rbx
movq 0x38(%rbp), %r13
cmpq %r13, %rbx
je 0x8658
leaq 0x3b31(%rip), %r14      # 0xc15a
leaq 0xa8(%rsp), %r15
movl (%rbx), %r12d
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x32f0
movq %r15, %rdi
movq %r12, %rsi
callq 0x31a0
addq $0x4, %rbx
cmpq %r13, %rbx
jne 0x8631
leaq 0x3f81(%rip), %rsi      # 0xc5e0
leaq 0xa8(%rsp), %rdi
movl $0x1, %edx
callq 0x32f0
movq 0x60(%rbp), %rbx
addq $0x50, %rbp
cmpq %rbp, %rbx
je 0x884b
leaq 0xa8(%rsp), %r15
leaq 0x3ac9(%rip), %r12      # 0xc15a
movq %rbp, 0x60(%rsp)
leaq 0x20(%rbx), %rsi
leaq 0x70(%rsp), %rdi
callq 0x9f18
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
addq %rsi, %rdx
leaq 0x20(%rsp), %rdi
callq 0xb0ae
leaq 0x8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x9f6e
movq %rbx, 0x68(%rsp)
movq 0x8(%rsp), %rbp
movq 0x10(%rsp), %r13
cmpq %r13, %rbp
je 0x8718
movq %r13, %rax
subq %rbp, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbp, %rdi
movq %r13, %rsi
callq 0xabf5
movq %rbp, %rdi
movq %r13, %rsi
callq 0xace3
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %r15, %rdi
callq 0x32f0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x32f0
movq 0x10(%rsp), %rsi
subq 0x8(%rsp), %rsi
sarq $0x3, %rsi
movq %r13, %rdi
callq 0x31a0
movq 0x8(%rsp), %rbx
movq 0x10(%rsp), %r14
cmpq %r14, %rbx
je 0x87a7
movl (%rbx), %r13d
movl 0x4(%rbx), %ebp
movl $0x1, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x32f0
movq %r15, %rdi
movq %r13, %rsi
callq 0x31a0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x32f0
movq %r13, %rdi
movq %rbp, %rsi
callq 0x31a0
addq $0x8, %rbx
jmp 0x875d
movl $0x1, %edx
movq %r15, %rdi
leaq 0x3e2a(%rip), %rsi      # 0xc5e0
callq 0x32f0
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
movq 0x60(%rsp), %rbp
movq 0x68(%rsp), %rbx
je 0x87dc
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x3290
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x87f8
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x8815
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3290
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x8837
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x3290
movq %rbx, %rdi
callq 0x31c0
movq %rax, %rbx
cmpq %rbp, %rax
jne 0x8696
movq 0x7776(%rip), %rax      # 0xffc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0xb0(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0xa8(%rsp,%rcx)
callq 0x3210
leaq 0x1a0(%rsp), %rdi
callq 0x3100
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x889f
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3290
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x893d
movq %rax, %rbx
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8959
movq 0xb8(%rsp), %rsi
jmp 0x8951
jmp 0x88e9
jmp 0x88e9
movq %rax, %rbx
jmp 0x8926
movq %rax, %rbx
jmp 0x890a
movq %rax, %rbx
jmp 0x8930
jmp 0x88f0
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x890a
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x3290
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x8926
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x70(%rsp), %rdi
callq 0x9748
leaq 0xa8(%rsp), %rdi
callq 0x33c0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x8959
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3290
movq %rbx, %rdi
callq 0x34b0
nop