// File: /workspace/github_cpp_makefile_star2_O3/IlyaSamoylov45[P]MapReduce-Project/main.cpp
// Function: sortPrint(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, int>>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void sortPrint(std::map<std::string, int> result, std::string path) {
  std::ofstream outputFile;
  outputFile.open (path);
  std::map<int, int> convert; // convert all strings to int for sorting purposes
  for(auto it = result.begin(); it != result.end(); it++){
      int stringToInt = std::stoi(it->first);
      convert[stringToInt] = it->second;
  }

  //numbers are already sorted
  for(auto it = convert.begin(); it != convert.end(); it++){
      //if there are dupes print all the dupes
      for(int i = 0; i < it->second; i++){
	outputFile << it->first << "\n";
      }
  }
  outputFile.close();

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x268(%rbp), %r15
movq %r15, %rdi
callq 0x3530
movq %r15, %rdi
movq %r14, %rsi
movl $0x10, %edx
callq 0x3160
leaq -0x60(%rbp), %rcx
movl $0x0, (%rcx)
xorl %eax, %eax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movq 0x18(%rbx), %r15
addq $0x8, %rbx
cmpq %rbx, %r15
je 0x55ac
callq 0x3050
movq %rax, %r14
movq 0x20(%r15), %r13
movl (%r14), %r12d
movl $0x0, (%r14)
movq %r13, %rdi
leaq -0x38(%rbp), %rsi
movl $0xa, %edx
callq 0x33e0
cmpq %r13, -0x38(%rbp)
je 0x5609
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x5615
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x5615
testl %ecx, %ecx
jne 0x5529
movl %r12d, (%r14)
movl %eax, -0x2c(%rbp)
movl 0x40(%r15), %r12d
leaq -0x68(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x73ba
movl %r12d, (%rax)
movq %r15, %rdi
callq 0x3210
movq %rax, %r15
cmpq %rbx, %rax
jne 0x54e1
movq -0x50(%rbp), %rbx
leaq -0x60(%rbp), %rax
cmpq %rax, %rbx
je 0x55ac
leaq -0x268(%rbp), %r14
leaq 0xfab5(%rip), %r15      # 0x15020
cmpl $0x0, 0x24(%rbx)
jle 0x5598
xorl %r12d, %r12d
movl 0x20(%rbx), %esi
movq %r14, %rdi
callq 0x3550
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x3340
incl %r12d
cmpl 0x24(%rbx), %r12d
jl 0x5574
movq %rbx, %rdi
callq 0x3210
movq %rax, %rbx
leaq -0x60(%rbp), %rax
cmpq %rax, %rbx
jne 0x556b
leaq -0x268(%rbp), %rdi
callq 0x33f0
leaq -0x68(%rbp), %rdi
callq 0x79b4
movq 0x19a00(%rip), %rax     # 0x1efc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x260(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x268(%rbp,%rcx)
callq 0x3290
leaq -0x170(%rbp), %rdi
callq 0x30e0
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xfdb2(%rip), %rdi      # 0x153c2
callq 0x31d0
leaq 0xfda6(%rip), %rdi      # 0x153c2
callq 0x3400
jmp 0x5638
movq %rax, %rbx
jmp 0x5644
jmp 0x5638
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x563b
movl %r12d, (%r14)
jmp 0x563b
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x79b4
leaq -0x268(%rbp), %rdi
callq 0x3450
movq %rbx, %rdi
callq 0x3560