// File: /workspace/github_c_makefile_star2_O0/richarddurbin[P]hash10x/hash10x.c
// Function: histogramReport
void histogramReport (char* prefix, Array a)
{
  U64 sum = 0, total = 0 ;
  int i ;
  for (i = 0 ; i < arrayMax(a) ; ++i) { sum += arr(a,i,int) ; total += i*arr(a,i,int) ; }
  U64 partSum = 0, partTotal = 0, max = 0, massMax = 0 ;
  int median = 0, massMedian = 0, n99 = 0, nMass99 = 0, mode, massMode ;
  int t50 = sum*0.5, tMass50 = total*0.5, t99 = sum*0.99, tMass99 = total*0.99 ;
  for (i = 0 ; i < arrayMax(a) ; ++i)
    { int n = arr(a,i,int) ;
      partSum += n ;
      partTotal += i*n ;
      fprintf (outFile, "%s_HIST %6d %d %.4f %.4f\n",
	       prefix, i, n, partSum / (double)sum, partTotal / (double)total) ;
      if (n > max) { mode = i ; max = n ; }
      if (i*n > massMax) { massMode = i ; massMax = i*n ; }
      if (partSum > t50 && !median) median = i ;
      if (partTotal > tMass50 && !massMedian) massMedian = i ;
      if (partSum > t99 && !n99) n99 = i ;
      if (partTotal > tMass99 && !nMass99) nMass99 = i ; 
    }
  fprintf (outFile, "%s_STATS MEAN %.1f", prefix, total/(double)sum) ;
  fprintf (outFile, "  MODE %d  MEDIAN %d  PERCENT99 %d", mode, median, n99) ;
  fprintf (outFile, "  MASS_MODE %d  N50 %d  N99 %d\n", massMode, massMedian, nMass99) ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x276a
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x24(%rbp), %ecx
movq -0x10(%rbp), %rdx
imull 0x14(%rdx), %ecx
movslq %ecx, %rcx
movslq (%rax,%rcx), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
movl -0x24(%rbp), %edx
movq -0x10(%rbp), %rsi
imull 0x14(%rsi), %edx
movslq %edx, %rdx
imull (%rcx,%rdx), %eax
cltq
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x270a
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
movl $0x0, -0x58(%rbp)
movq -0x18(%rbp), %xmm0
movaps 0xb85e(%rip), %xmm2     # 0xe010
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0xb862(%rip), %xmm1     # 0xe020
subpd %xmm1, %xmm0
movaps %xmm0, %xmm3
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm3, %xmm0
movsd 0xb863(%rip), %xmm3     # 0xe038
mulsd %xmm3, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x64(%rbp)
movq -0x20(%rbp), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm1, %xmm0
movaps %xmm0, %xmm4
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm4, %xmm0
mulsd %xmm3, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x68(%rbp)
movq -0x18(%rbp), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm1, %xmm0
movaps %xmm0, %xmm3
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm3, %xmm0
movsd 0xb80d(%rip), %xmm3     # 0xe030
mulsd %xmm3, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x6c(%rbp)
movq -0x20(%rbp), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0xb7e2(%rip), %xmm1     # 0xe030
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x70(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x29f5
movq -0x10(%rbp), %rdx
movq 0x8(%rdx), %rax
movl -0x24(%rbp), %ecx
movl 0x14(%rdx), %edx
imull %edx, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx), %eax
movl %eax, -0x74(%rbp)
movslq -0x74(%rbp), %rcx
movq -0x30(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl -0x24(%rbp), %eax
movl -0x74(%rbp), %ecx
imull %ecx, %eax
movslq %eax, %rcx
movq -0x38(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq 0x11b19(%rip), %rdi     # 0x143d0
movq -0x8(%rbp), %rdx
movl -0x24(%rbp), %ecx
movl -0x74(%rbp), %r8d
movaps 0xb747(%rip), %xmm4     # 0xe010
movq -0x30(%rbp), %xmm0
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
movapd 0xb746(%rip), %xmm3     # 0xe020
subpd %xmm3, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq -0x18(%rbp), %xmm1
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
subpd %xmm3, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movq -0x38(%rbp), %xmm1
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
subpd %xmm3, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
movq -0x20(%rbp), %xmm2
punpckldq %xmm4, %xmm2    # xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
subpd %xmm3, %xmm2
movaps %xmm2, %xmm3
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
addsd %xmm3, %xmm2
divsd %xmm2, %xmm1
leaq 0xbb15(%rip), %rsi      # 0xe455
movb $0x2, %al
callq 0x1150
movslq -0x74(%rbp), %rax
cmpq -0x40(%rbp), %rax
jbe 0x295f
movl -0x24(%rbp), %eax
movl %eax, -0x5c(%rbp)
movslq -0x74(%rbp), %rax
movq %rax, -0x40(%rbp)
movl -0x24(%rbp), %eax
imull -0x74(%rbp), %eax
cltq
cmpq -0x48(%rbp), %rax
jbe 0x2981
movl -0x24(%rbp), %eax
movl %eax, -0x60(%rbp)
movl -0x24(%rbp), %eax
imull -0x74(%rbp), %eax
cltq
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movslq -0x64(%rbp), %rcx
cmpq %rcx, %rax
jbe 0x299a
cmpl $0x0, -0x4c(%rbp)
jne 0x299a
movl -0x24(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x38(%rbp), %rax
movslq -0x68(%rbp), %rcx
cmpq %rcx, %rax
jbe 0x29b3
cmpl $0x0, -0x50(%rbp)
jne 0x29b3
movl -0x24(%rbp), %eax
movl %eax, -0x50(%rbp)
movq -0x30(%rbp), %rax
movslq -0x6c(%rbp), %rcx
cmpq %rcx, %rax
jbe 0x29cc
cmpl $0x0, -0x54(%rbp)
jne 0x29cc
movl -0x24(%rbp), %eax
movl %eax, -0x54(%rbp)
movq -0x38(%rbp), %rax
movslq -0x70(%rbp), %rcx
cmpq %rcx, %rax
jbe 0x29e5
cmpl $0x0, -0x58(%rbp)
jne 0x29e5
movl -0x24(%rbp), %eax
movl %eax, -0x58(%rbp)
jmp 0x29e7
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2860
movq 0x119d4(%rip), %rdi     # 0x143d0
movq -0x8(%rbp), %rdx
movq -0x20(%rbp), %xmm0
movaps 0xb604(%rip), %xmm3     # 0xe010
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0xb608(%rip), %xmm2     # 0xe020
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq -0x18(%rbp), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
leaq 0xba25(%rip), %rsi      # 0xe46f
movb $0x1, %al
callq 0x1150
movq 0x11978(%rip), %rdi     # 0x143d0
movl -0x5c(%rbp), %edx
movl -0x4c(%rbp), %ecx
movl -0x54(%rbp), %r8d
leaq 0xba19(%rip), %rsi      # 0xe482
movb $0x0, %al
callq 0x1150
movq 0x11959(%rip), %rdi     # 0x143d0
movl -0x60(%rbp), %edx
movl -0x50(%rbp), %ecx
movl -0x58(%rbp), %r8d
leaq 0xba1d(%rip), %rsi      # 0xe4a5
movb $0x0, %al
callq 0x1150
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)