// File: /workspace/github_cpp_makefile_star2_O3/4n6ist[P]usn_analytics/lib/usnjrnl.cpp
// Function: UsnJrnl::PostProcess()
int UsnJrnl::PostProcess(){
  
  // store usnmain_set file_path value
  GetAllDirName();

  printf("%8lu records after packing\n", usnmain_set.size());       
  fprintf(fp_ofreport, "%8lu records after packing\n", usnmain_set.size()); 
  string timestamp_begin, timestamp_end;
  
  timestamp_begin = usnmain_set[0].timestamp_s;
  timestamp_end = usnmain_set[usnmain_set.size()-1].timestamp_s;
  
  fprintf(fp_ofreport, " Records |                         DateTime                        |             USN              |\n");
  fprintf(fp_ofreport, "%8lu | %s - %s |%13llu - %13llu |\n", usnmain_set.size(), timestamp_begin.c_str(), timestamp_end.c_str(), usnmain_set[0].usn, usnmain_set[usnmain_set.size()-1].usn); 
  fprintf(fp_ofreport, "===================================================================================================\n");

  // USN range, Time slot Breakdown
  uint64_t usn_begin;
  usn_begin = usnmain_set[0].usn;
  int j=0;
  for(int i=1; i <= usnmain_set.size(); ++i) {
    if(usnmain_set[i].usn - usnmain_set[i-1].usn > 1048576) {
      timestamp_end = usnmain_set[i-1].timestamp_s;
      fprintf(fp_ofreport, "%8d |", i-j);
      fprintf(fp_ofreport, " %s - %s |", timestamp_begin.c_str(), timestamp_end.c_str());
      fprintf(fp_ofreport, "%13llu - %13llu |\n", usn_begin, usnmain_set[i-1].usn);
      j = i;
      if(i == usnmain_set.size())
        break;
      usn_begin = usnmain_set[i].usn;
      timestamp_begin = usnmain_set[i].timestamp_s;
    }
  }
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
callq 0x4f38
movq 0x58(%rbx), %rsi
subq 0x50(%rbx), %rsi
sarq %rsi
movabsq $0x3a4c0a237c32b16d, %r15 # imm = 0x3A4C0A237C32B16D
imulq %r15, %rsi
leaq 0x92f3(%rip), %r14      # 0xf1df
xorl %r12d, %r12d
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
movq 0x18(%rbx), %rdi
movq 0x58(%rbx), %rdx
subq 0x50(%rbx), %rdx
sarq %rdx
imulq %r15, %rdx
movq %r14, %rsi
xorl %eax, %eax
callq 0x3350
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r12, -0x8(%rax)
movb %r12b, (%rax)
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r12, -0x8(%rax)
movb %r12b, (%rax)
movq 0x50(%rbx), %rsi
addq $0x12, %rsi
leaq 0x28(%rsp), %rdi
callq 0x3120
movq $-0xb8, %rsi
addq 0x58(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0x3120
movq 0x18(%rbx), %rcx
leaq 0x9293(%rip), %rdi      # 0xf1fb
movl $0x1, %r14d
movl $0x64, %esi
movl $0x1, %edx
callq 0x34b0
movq 0x58(%rbx), %rdx
movq 0x18(%rbx), %rdi
movq 0x50(%rbx), %rax
movq -0xca(%rdx), %rsi
subq %rax, %rdx
sarq %rdx
imulq %r15, %rdx
movq 0x28(%rsp), %rcx
movq 0x8(%rsp), %r8
movq (%rax), %r9
movq %rsi, (%rsp)
leaq 0x92ae(%rip), %rsi      # 0xf260
xorl %eax, %eax
callq 0x3350
movq 0x18(%rbx), %rcx
leaq 0x92bf(%rip), %rdi      # 0xf283
movl $0x64, %esi
movl $0x1, %edx
callq 0x34b0
movq 0x50(%rbx), %rax
movq 0x58(%rbx), %rcx
cmpq %rax, %rcx
je 0x60cc
movq (%rax), %rbp
movl $0xdc, %r12d
xorl %r13d, %r13d
movq -0x12(%rax,%r12), %rdx
subq -0xdc(%rax,%r12), %rdx
cmpq $0x100001, %rdx         # imm = 0x100001
jb 0x60a8
leaq (%rax,%r12), %rsi
addq $-0xca, %rsi
leaq 0x8(%rsp), %rdi
callq 0x3120
movq 0x18(%rbx), %rdi
movl %r14d, %edx
subl %r13d, %edx
leaq 0x92b8(%rip), %rsi      # 0xf2e8
xorl %eax, %eax
callq 0x3350
movq 0x18(%rbx), %rdi
movq 0x28(%rsp), %rdx
movq 0x8(%rsp), %rcx
leaq 0x92a2(%rip), %rsi      # 0xf2ee
xorl %eax, %eax
callq 0x3350
movq 0x18(%rbx), %rdi
movq 0x50(%rbx), %rax
movq -0xdc(%rax,%r12), %rcx
leaq 0x9206(%rip), %rsi      # 0xf270
movq %rbp, %rdx
xorl %eax, %eax
callq 0x3350
movq 0x50(%rbx), %rsi
movq 0x58(%rbx), %rax
subq %rsi, %rax
sarq %rax
imulq %r15, %rax
cmpq %rax, %r14
je 0x60cc
movq -0x12(%rsi,%r12), %rbp
addq %r12, %rsi
leaq 0x28(%rsp), %rdi
callq 0x3120
movq 0x50(%rbx), %rax
movq 0x58(%rbx), %rcx
movl %r14d, %r13d
leaq 0x1(%r14), %rdx
movq %rcx, %rsi
subq %rax, %rsi
sarq %rsi
imulq %r15, %rsi
addq $0xca, %r12
cmpq %r14, %rsi
movq %rdx, %r14
ja 0x5ff0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x60e8
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3230
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x6104
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3230
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6117
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x6136
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3230
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x6152
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3230
movq %rbx, %rdi
callq 0x3460