// File: /workspace/github_c_makefile_star2_O1/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 $0x128, %rsp            # imm = 0x128
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x20(%rsp), %rdi
movb $0x0, (%rdi)
movq 0x40(%r15), %rcx
leaq 0x5571(%rip), %rsi      # 0x15370
movq %r15, %rdx
xorl %eax, %eax
callq 0x6a20
testq %r14, %r14
movq %rbx, 0x10(%rsp)
je 0xfe4f
movq %r14, %rdi
callq 0x6270
notq %rax
leaq (%rax,%rbx), %rdx
leaq 0x20(%rsp), %rsi
movq %r14, %rdi
callq 0x6420
movq %r14, %rdi
callq 0x6270
notq %rax
leaq (%rax,%rbx), %rdx
leaq 0x554a(%rip), %rsi      # 0x1538f
movq %r14, %rdi
callq 0x6420
jmp 0xfe7c
movq 0xb172(%rip), %rax      # 0x1afc8
movl (%rax), %eax
cmpl $0x3, %eax
jl 0xfe7c
movq 0xb13c(%rip), %rax      # 0x1afa0
movq (%rax), %rcx
leaq 0x5690(%rip), %rsi      # 0x154fe
leaq 0x20(%rsp), %rdx
movl $0x3, %edi
xorl %eax, %eax
callq *%rcx
movl $0x3f, %ebx
movl %ebx, %eax
cmpq $0x0, 0x48(%r15,%rax,8)
jne 0xfe95
addl $-0x1, %ebx
jb 0xfe81
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorl %eax, %eax
movq %r14, 0x18(%rsp)
cmpq $0x0, 0x48(%r15,%rax,8)
jne 0xfeb2
incq %rax
cmpq $0x40, %rax
jne 0xfe9c
movl $0x40, %eax
cmpl %ebx, %eax
jle 0xfec8
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %r12d
incl %ebx
movq 0xb0f4(%rip), %r13      # 0x1afc8
xorl %r14d, %r14d
movl $0x0, 0xc(%rsp)
cmpq $0x0, 0x48(%r15,%r12,8)
je 0xffd5
movl %r14d, %eax
leaq 0x20(%rsp,%rax), %rdi
movq 0x48(%r15,%r12,8), %rcx
leaq 0x5494(%rip), %rsi      # 0x15393
movl %r12d, %edx
xorl %eax, %eax
callq 0x6a20
movl %eax, %ebp
testl %eax, %eax
jle 0xff6f
movl 0xc(%rsp), %eax
andl $0x80000003, %eax       # imm = 0x80000003
cmpl $0x3, %eax
jne 0xff94
movq 0x18(%rsp), %r14
testq %r14, %r14
je 0xff99
movq %r14, %rdi
callq 0x6270
notq %rax
movq 0x10(%rsp), %r13
leaq (%rax,%r13), %rdx
movq %r14, %rdi
leaq 0x20(%rsp), %rsi
callq 0x6420
movq %r14, %rdi
callq 0x6270
notq %rax
leaq (%rax,%r13), %rdx
movq 0xb06a(%rip), %r13      # 0x1afc8
movq %r14, %rdi
leaq 0x546f(%rip), %rsi      # 0x153d7
callq 0x6420
jmp 0xffc1
movl (%r13), %eax
cmpl $0x3, %eax
jl 0xffcd
movq 0xb021(%rip), %rax      # 0x1afa0
movq (%rax), %rcx
movl $0x3, %edi
leaq 0x5416(%rip), %rsi      # 0x153a4
xorl %eax, %eax
callq *%rcx
jmp 0xffcd
addl %ebp, %r14d
jmp 0xffc9
movl (%r13), %eax
cmpl $0x3, %eax
jl 0xffc1
movq 0xaff7(%rip), %rax      # 0x1afa0
movq (%rax), %rcx
movl $0x3, %edi
leaq 0x5546(%rip), %rsi      # 0x154fe
leaq 0x20(%rsp), %rdx
xorl %eax, %eax
callq *%rcx
movb $0x0, 0x20(%rsp)
xorl %r14d, %r14d
incl 0xc(%rsp)
testl %ebp, %ebp
jle 0xfeb6
incq %r12
cmpq %r12, %rbx
jne 0xfedf
testl %r14d, %r14d
jle 0xfeb6
movq 0x18(%rsp), %rbx
testq %rbx, %rbx
je 0x10019
movq %rbx, %rdi
callq 0x6270
notq %rax
movq 0x10(%rsp), %rdx
addq %rax, %rdx
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x6420
jmp 0xfeb6
movl (%r13), %eax
cmpl $0x3, %eax
jl 0xfeb6
movq 0xaf73(%rip), %rax      # 0x1afa0
movq (%rax), %rcx
leaq 0x54c7(%rip), %rsi      # 0x154fe
leaq 0x20(%rsp), %rdx
movl $0x3, %edi
xorl %eax, %eax
callq *%rcx
jmp 0xfeb6