// File: /workspace/github_c_makefile_star2_O3/sharpyfox[P]citrusleaf-client/src/cf_hist.c
// Function: cf_histogram_dump_new
void 
cf_histogram_dump_new( cf_histogram *h, char *outbuff, size_t outbuff_len)
{
  char printbuf[256];
  int pos = 0; // location to print from
  printbuf[0] = '\0';

  sprintf(printbuf, "histogram dump: %s (%zu total)",h->name, h->n_counts);
  if (outbuff) {
    strncat(outbuff, printbuf, outbuff_len - strlen(outbuff) - 1);
            strncat(outbuff, "  |", outbuff_len - strlen(outbuff) - 1);
  } else {
    cf_debug("%s", printbuf);
  }

  int i, j;
  int k = 0;
  for (j=CF_N_HIST_COUNTS-1 ; j >= 0 ; j-- ) if (h->count[j]) break;
  for (i=0;i<CF_N_HIST_COUNTS;i++) if (h->count[i]) break;
  for (; i<=j;i++) {
    if (h->count[i] > 0) { // print only non zero columns
      int bytes =
        sprintf((char *) (printbuf + pos), " (%02d: %010zu) ", i, h->count[i]);
      if (bytes <= 0) {
        cf_debug("histogram printing error. (bytes < 0 ) Bailing ...");
        return;
      }
      pos += bytes;
      if (k % 4 == 3){
        if (outbuff) {
          strncat(outbuff, printbuf, outbuff_len - strlen(outbuff) - 1);
          strncat(outbuff, "   ", outbuff_len - strlen(outbuff) - 1);
        } else {
          cf_debug("%s", (char *) printbuf);
        }
        pos = 0;
        printbuf[0] = '\0';
      }
      k++;
    }
  } // end for each
  if (pos > 0) {
    if (outbuff) {
      strncat(outbuff, printbuf, outbuff_len - strlen(outbuff) - 1);
    } else {
      cf_debug("%s", (char *) printbuf);
    }
  } // end if pos > 0
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, %r15
leaq 0x10(%rsp), %rdi
movq %rdx, %rbx
movq %rsi, %r14
leaq 0x5964(%rip), %rsi      # 0x15390
xorl %eax, %eax
movb $0x0, (%rdi)
movq %r15, %rdx
movq 0x40(%r15), %rcx
callq 0x6a20
testq %r14, %r14
je 0xfa7e
movq %r14, %rdi
callq 0x6270
notq %rax
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
leaq (%rax,%rbx), %rdx
callq 0x6420
movq %r14, %rdi
callq 0x6270
notq %rax
leaq 0x593f(%rip), %rsi      # 0x153af
movq %r14, %rdi
leaq (%rax,%rbx), %rdx
callq 0x6420
jmp 0xfaab
movq 0xb543(%rip), %rax      # 0x1afc8
movl (%rax), %eax
cmpl $0x3, %eax
jl 0xfaab
movq 0xb50d(%rip), %rax      # 0x1afa0
leaq 0x5a84(%rip), %rsi      # 0x1551e
leaq 0x10(%rsp), %rdx
movl $0x3, %edi
movq (%rax), %rcx
xorl %eax, %eax
callq *%rcx
movl $0x3f, %ebp
movl %ebp, %eax
cmpq $0x0, 0x48(%r15,%rax,8)
jne 0xfac4
addl $-0x1, %ebp
jb 0xfab0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorl %eax, %eax
cmpq $0x0, 0x48(%r15,%rax,8)
jne 0xfadc
incq %rax
cmpq $0x40, %rax
jne 0xfac6
movl $0x40, %eax
cmpl %ebp, %eax
jle 0xfaf2
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, 0x8(%rsp)
movl %eax, %r12d
incl %ebp
xorl %r13d, %r13d
xorl %ebx, %ebx
cmpq $0x0, 0x48(%r15,%r12,8)
je 0xfbc2
movq 0x48(%r15,%r12,8), %rcx
movl %r13d, %eax
leaq 0x5897(%rip), %rsi      # 0x153b3
movl %r12d, %edx
leaq 0x10(%rsp,%rax), %rdi
xorl %eax, %eax
callq 0x6a20
testl %eax, %eax
jle 0xfc04
movl %ebx, %ecx
andl $0x80000003, %ecx       # imm = 0x80000003
cmpl $0x3, %ecx
jne 0xfb86
testq %r14, %r14
je 0xfb8b
movq %r14, %rdi
callq 0x6270
movq 0x8(%rsp), %r13
notq %rax
movq %r14, %rdi
leaq 0x10(%rsp), %rsi
leaq (%rax,%r13), %rdx
callq 0x6420
movq %r14, %rdi
callq 0x6270
notq %rax
movq %r14, %rdi
leaq 0x587c(%rip), %rsi      # 0x153f7
leaq (%rax,%r13), %rdx
callq 0x6420
jmp 0xfbb8
addl %eax, %r13d
jmp 0xfbc0
movq 0xb436(%rip), %rax      # 0x1afc8
movl (%rax), %eax
cmpl $0x3, %eax
jl 0xfbb8
movq 0xb400(%rip), %rax      # 0x1afa0
movl $0x3, %edi
leaq 0x5972(%rip), %rsi      # 0x1551e
leaq 0x10(%rsp), %rdx
movq (%rax), %rcx
xorl %eax, %eax
callq *%rcx
xorl %r13d, %r13d
movb $0x0, 0x10(%rsp)
incl %ebx
incq %r12
cmpq %r12, %rbp
jne 0xfb01
movq 0x8(%rsp), %rbx
testl %r13d, %r13d
jle 0xfae0
testq %r14, %r14
je 0xfc35
movq %r14, %rdi
callq 0x6270
notq %rax
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
addq %rax, %rbx
movq %rbx, %rdx
callq 0x6420
jmp 0xfae0
movq 0xb3bd(%rip), %rax      # 0x1afc8
movl (%rax), %eax
cmpl $0x3, %eax
jl 0xfae0
movq 0xb383(%rip), %rax      # 0x1afa0
leaq 0x57a0(%rip), %rsi      # 0x153c4
movl $0x3, %edi
movq (%rax), %rcx
xorl %eax, %eax
callq *%rcx
jmp 0xfae0
movq 0xb38c(%rip), %rax      # 0x1afc8
movl (%rax), %eax
cmpl $0x3, %eax
jl 0xfae0
movq 0xb352(%rip), %rax      # 0x1afa0
leaq 0x58c9(%rip), %rsi      # 0x1551e
leaq 0x10(%rsp), %rdx
movl $0x3, %edi
movq (%rax), %rcx
xorl %eax, %eax
callq *%rcx
jmp 0xfae0