// File: /workspace/github_cpp_makefile_star2_O3/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 0x40d9(%rip), %rsi      # 0xc5b2
leaq 0xa8(%rsp), %r14
movq %r14, %rdi
callq 0x82ba
leaq 0x40d9(%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 0x851f
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
jmp 0x8525
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 0x855e
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 0x96ca
movl (%rbp), %esi
leaq 0xa8(%rsp), %rdi
callq 0x31a0
movq 0x30(%rbp), %rbx
movq 0x38(%rbp), %r13
cmpq %r13, %rbx
je 0x85d0
leaq 0x3bb9(%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 0x85a9
leaq 0x4009(%rip), %rsi      # 0xc5e0
leaq 0xa8(%rsp), %rdi
movl $0x1, %edx
callq 0x32f0
movq 0x60(%rbp), %rbx
addq $0x50, %rbp
cmpq %rbp, %rbx
je 0x87c3
leaq 0xa8(%rsp), %r15
leaq 0x3b51(%rip), %r12      # 0xc15a
movq %rbp, 0x60(%rsp)
leaq 0x20(%rbx), %rsi
leaq 0x70(%rsp), %rdi
callq 0x9e72
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
addq %rsi, %rdx
leaq 0x20(%rsp), %rdi
callq 0xafec
leaq 0x8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x9ec8
movq %rbx, 0x68(%rsp)
movq 0x8(%rsp), %rbp
movq 0x10(%rsp), %r13
cmpq %r13, %rbp
je 0x8690
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 0xab57
movq %rbp, %rdi
movq %r13, %rsi
callq 0xac45
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 0x871f
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 0x86d5
movl $0x1, %edx
movq %r15, %rdi
leaq 0x3eb2(%rip), %rsi      # 0xc5e0
callq 0x32f0
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
movq 0x60(%rsp), %rbp
movq 0x68(%rsp), %rbx
je 0x8754
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x3290
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x8770
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x878d
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3290
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x87af
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x3290
movq %rbx, %rdi
callq 0x31c0
movq %rax, %rbx
cmpq %rbp, %rax
jne 0x860e
movq 0x77fe(%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 0x8817
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 0x88b5
movq %rax, %rbx
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x88d1
movq 0xb8(%rsp), %rsi
jmp 0x88c9
jmp 0x8861
jmp 0x8861
movq %rax, %rbx
jmp 0x889e
movq %rax, %rbx
jmp 0x8882
movq %rax, %rbx
jmp 0x88a8
jmp 0x8868
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x8882
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x3290
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x889e
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x70(%rsp), %rdi
callq 0x9696
leaq 0xa8(%rsp), %rdi
callq 0x33c0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x88d1
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3290
movq %rbx, %rdi
callq 0x34b0
nop