// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/info.cpp
// Function: InfoPrinter::print(unsigned long)
void
InfoPrinter::print(const size_t current_block_)
{
  const double current_time      = Time::get_monotonic();
  const size_t badcount          = _badblocks->size();
  const size_t processed_blocks  = (current_block_ - _start_block);
  const size_t total_blocks      = (_end_block - _start_block);
  const size_t blocks_left       = (total_blocks - processed_blocks);
  const double percentage        = (((double)processed_blocks / total_blocks) * 100.0);
  const double time_passed       = (current_time - _start_time);
  const double blocks_per_second = ((double)processed_blocks / time_passed);
  const size_t time_left         = ((double)blocks_left / blocks_per_second);

  std::cout << "\x1B" << '8'
            << "\x1B[2K"
            << "Current: " << current_block_ << " ("
            << std::fixed
            << std::setprecision(2)
            << percentage
            << "%); bps: " << blocks_per_second
            << "; eta: "
            << std::setfill('0') << std::setw(2)
            << (time_left/(60*60)) << ':'
            << std::setfill('0') << std::setw(2)
            << ((time_left/60)%60)  << ':'
            << std::setfill('0') << std::setw(2)
            << (time_left%60)
            << "; bad: " << badcount;
  if(badcount)
    std::cout << "; last: " << (*_badblocks)[badcount-1];
  std::cout << std::endl << "\x1B[2K" << std::flush;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r12
movq %rdi, %rbx
callq 0x117ac
movq 0x18(%rbx), %rax
movq 0x8(%rax), %r14
movq %r14, (%rsp)
movq (%rax), %rax
movq %rax, 0x8(%rsp)
subq %rax, %r14
sarq $0x3, %r14
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rax
movq %r12, %rdx
subq %rcx, %rdx
subq %rcx, %rax
movq %rax, %xmm1
subq %rdx, %rax
movq %rdx, %xmm2
movq 0x6926(%rip), %xmm3     # 0x12a70
punpckldq %xmm3, %xmm2    # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
movapd 0x692a(%rip), %xmm4     # 0x12a80
subpd %xmm4, %xmm2
movapd %xmm2, %xmm5
unpckhpd %xmm2, %xmm5            # xmm5 = xmm5[1],xmm2[1]
addsd %xmm2, %xmm5
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm4, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
movapd %xmm5, %xmm1
divsd %xmm2, %xmm1
mulsd 0x6906(%rip), %xmm1     # 0x12a90
movapd %xmm1, 0x20(%rsp)
subsd (%rbx), %xmm0
divsd %xmm0, %xmm5
movapd %xmm5, 0x10(%rsp)
movq %rax, %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm4, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd %xmm5, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x68c9(%rip), %xmm1     # 0x12a98
cvttsd2si %xmm1, %r15
andq %rcx, %r15
orq %rax, %r15
movq 0x14dd7(%rip), %rdi     # 0x20fb8
leaq 0x68be(%rip), %rsi      # 0x12aa6
callq 0x44b0
pushq $0x38
popq %rsi
movq %rax, %rdi
callq 0x4520
leaq 0x68a2(%rip), %rsi      # 0x12aa1
movq %rax, %rdi
callq 0x44b0
leaq 0x689a(%rip), %rsi      # 0x12aa8
movq %rax, %rdi
callq 0x44b0
movq %rax, %rdi
movq %r12, %rsi
callq 0x4320
leaq 0x60b7(%rip), %rsi      # 0x122df
movq %rax, %rdi
callq 0x44b0
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
movl $0xfffffefb, %esi       # imm = 0xFFFFFEFB
andl 0x18(%rax,%rdx), %esi
orl $0x4, %esi
movl %esi, 0x18(%rax,%rdx)
movq -0x18(%rcx), %rcx
pushq $0x2
popq %r13
movq %r13, 0x8(%rax,%rcx)
movq %rax, %rdi
movaps 0x20(%rsp), %xmm0
callq 0x46b0
leaq 0x684a(%rip), %rsi      # 0x12ab2
movq %rax, %rdi
callq 0x44b0
movq %rax, %rdi
movaps 0x10(%rsp), %xmm0
callq 0x46b0
leaq 0x6838(%rip), %rsi      # 0x12abc
movq %rax, %rdi
callq 0x44b0
pushq $0x30
popq %rbp
movq %rax, %rdi
movl %ebp, %esi
callq 0x4670
movq %rax, %rdi
movq (%rax), %rax
movq -0x18(%rax), %rax
movq %r13, 0x10(%rdi,%rax)
movl $0xe10, %ecx            # imm = 0xE10
movq %r15, %rax
xorl %edx, %edx
divq %rcx
movq %rax, %rsi
callq 0x4320
pushq $0x3a
popq %r12
movq %rax, %rdi
movl %r12d, %esi
callq 0x4520
movq %rax, %rdi
movl %ebp, %esi
callq 0x4670
movq %rax, %rdi
movq (%rax), %rax
movq -0x18(%rax), %rax
movq %r13, 0x10(%rdi,%rax)
pushq $0x3c
popq %rcx
movq %r15, %rax
xorl %edx, %edx
divq %rcx
movq %rdx, %r15
xorl %edx, %edx
divq %rcx
movq %rdx, %rsi
callq 0x4320
movq %rax, %rdi
movl %r12d, %esi
callq 0x4520
movq %rax, %rdi
movl %ebp, %esi
callq 0x4670
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq %r13, 0x10(%rax,%rcx)
movq %rax, %rdi
movq %r15, %rsi
callq 0x4320
leaq 0x6791(%rip), %rsi      # 0x12ac4
movq %rax, %rdi
callq 0x44b0
movq %rax, %rdi
movq %r14, %rsi
movq (%rsp), %r14
callq 0x4320
subq 0x8(%rsp), %r14
je 0xc378
movq 0x14c60(%rip), %rdi     # 0x20fb8
leaq 0x676d(%rip), %rsi      # 0x12acc
callq 0x44b0
movq 0x18(%rbx), %rcx
movq (%rcx), %rcx
movq -0x8(%rcx,%r14), %rsi
movq %rax, %rdi
callq 0x4320
movq 0x14c39(%rip), %rdi     # 0x20fb8
callq 0x4230
leaq 0x6716(%rip), %rsi      # 0x12aa1
movq %rax, %rdi
callq 0x44b0
movq %rax, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4330
nopl (%rax)