// File: /workspace/github_c_makefile_star2_O0/richarddurbin[P]hash10x/hash10x.c
// Function: errorFix
void errorFix (int hashMin, int hashMax)
{
  if (!crib) die ("need to set crib") ;
  U32 x ; int i ;
  int low[CRIBTYPE_MAX], nt[CRIBTYPE_MAX] ;
  double min[CRIBTYPE_MAX], max[CRIBTYPE_MAX], sum[CRIBTYPE_MAX] ;
  for (i = 0 ; i < CRIBTYPE_MAX ; ++i)
    { low[i] = 0 ; nt[i] = 0 ; min[i] = 1.0 ; max[i] = 0.0 ; sum[i] = 0.0 ; }
  for (x = hashMin ; x < hashMax ; ++x)
    { int type = cribType[x] ;
      int xCount = arr(hashDepth, x, U32) ; if (xCount < 5) { ++low[type] ; continue ; }
      Array a = countHashNeighbours (x) ;
      --*arrp(a,arrayMax(a)-1,int) ; /* remove top match - often wrong */
      while (arrayMax(a) && !arr(a,arrayMax(a)-1,int)) --arrayMax(a) ;
      if (arrayMax(a) > 4)
	{ int n = 0 ; U64 sumSq = 0 ; int *ai = arrp(a,0,int) ;
	  for (i = 0 ; i < 4 ; ++i) n += *ai++ ;
	  for ( ; i < arrayMax(a) ; ++i) { sumSq += *ai * (i-3)*(i-3) ; n += *ai++ ; }
	  double score = sumSq/((double)n*(xCount-3)) ;
	  ++nt[type] ; sum[type] += score ;
	  if (score < min[type]) min[type] = score ;
	  if (score > max[type]) max[type] = score ;
	  if ((type == CRIB_ERR && score > 0.00005) || (type != CRIB_ERR && score < 0.00005))
	    { printf ("  %s count %d max %d score %.6f ",
		      cribText(x), xCount, arrayMax(a)-1, score) ;
	      for (i = 5 ; i < arrayMax(a) ; ++i) printf (" %d", arr(a,i,int)) ;
	      putchar ('\n') ;
	    }
	}
      else
	++low[type] ;
      arrayDestroy (a) ;
    }
  for (i = 0 ; i < CRIBTYPE_MAX ; ++i)
    printf ("  %s low %d n %d min %.6f av %.6f max %.6f\n",
	    cribTypeName[i], low[i], nt[i], min[i], sum[i] / (nt[i]?nt[i]:1), max[i]) ;
  timeUpdate (stdout) ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
cmpq $0x0, 0x103d7(%rip)     # 0x14400
jne 0x4039
leaq 0xa70a(%rip), %rdi      # 0xe73c
movb $0x0, %al
callq 0xd0c0
movl $0x0, -0x10(%rbp)
cmpl $0x5, -0x10(%rbp)
jge 0x409b
movslq -0x10(%rbp), %rax
movl $0x0, -0x30(%rbp,%rax,4)
movslq -0x10(%rbp), %rax
movl $0x0, -0x50(%rbp,%rax,4)
movslq -0x10(%rbp), %rax
movsd 0x9fde(%rip), %xmm0     # 0xe048
movsd %xmm0, -0x80(%rbp,%rax,8)
movslq -0x10(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, -0xb0(%rbp,%rax,8)
movslq -0x10(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, -0xe0(%rbp,%rax,8)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x4040
movl -0x4(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x8(%rbp), %eax
jae 0x4479
movq 0x10354(%rip), %rax     # 0x14408
movl -0xc(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movl %eax, -0xe4(%rbp)
movq 0x102f8(%rip), %rax     # 0x143c0
movq 0x8(%rax), %rax
movl -0xc(%rbp), %ecx
movq 0x102ea(%rip), %rdx     # 0x143c0
imull 0x14(%rdx), %ecx
movl %ecx, %ecx
movl (%rax,%rcx), %eax
movl %eax, -0xe8(%rbp)
cmpl $0x5, -0xe8(%rbp)
jge 0x4105
movslq -0xe4(%rbp), %rax
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
jmp 0x446b
movl -0xc(%rbp), %edi
callq 0x38d0
movq %rax, -0xf0(%rbp)
movq -0xf0(%rbp), %rax
movq 0x8(%rax), %rax
movq -0xf0(%rbp), %rcx
movl 0x18(%rcx), %ecx
subl $0x1, %ecx
movq -0xf0(%rbp), %rdx
imull 0x14(%rdx), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx), %edx
addl $-0x1, %edx
movl %edx, (%rax,%rcx)
movq -0xf0(%rbp), %rcx
xorl %eax, %eax
cmpl $0x0, 0x18(%rcx)
movb %al, -0x111(%rbp)
je 0x418d
movq -0xf0(%rbp), %rax
movq 0x8(%rax), %rax
movq -0xf0(%rbp), %rcx
movl 0x18(%rcx), %ecx
subl $0x1, %ecx
movq -0xf0(%rbp), %rdx
imull 0x14(%rdx), %ecx
movslq %ecx, %rcx
cmpl $0x0, (%rax,%rcx)
setne %al
xorb $-0x1, %al
movb %al, -0x111(%rbp)
movb -0x111(%rbp), %al
testb $0x1, %al
jne 0x4199
jmp 0x41ab
movq -0xf0(%rbp), %rax
movl 0x18(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x18(%rax)
jmp 0x4143
movq -0xf0(%rbp), %rax
cmpl $0x4, 0x18(%rax)
jle 0x444d
movl $0x0, -0xf4(%rbp)
movq $0x0, -0x100(%rbp)
movq -0xf0(%rbp), %rax
movq 0x8(%rax), %rax
movq -0xf0(%rbp), %rcx
imull $0x0, 0x14(%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x108(%rbp)
movl $0x0, -0x10(%rbp)
cmpl $0x4, -0x10(%rbp)
jge 0x422f
movq -0x108(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x108(%rbp)
movl (%rax), %eax
addl -0xf4(%rbp), %eax
movl %eax, -0xf4(%rbp)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x41fb
jmp 0x4231
movl -0x10(%rbp), %eax
movq -0xf0(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x4299
movq -0x108(%rbp), %rax
movl (%rax), %eax
movl -0x10(%rbp), %ecx
subl $0x3, %ecx
imull %ecx, %eax
movl -0x10(%rbp), %ecx
subl $0x3, %ecx
imull %ecx, %eax
cltq
addq -0x100(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x108(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x108(%rbp)
movl (%rax), %eax
addl -0xf4(%rbp), %eax
movl %eax, -0xf4(%rbp)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x4231
movaps 0x9d70(%rip), %xmm1     # 0xe010
movq -0x100(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x9d6c(%rip), %xmm1     # 0xe020
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
cvtsi2sdl -0xf4(%rbp), %xmm1
movl -0xe8(%rbp), %eax
subl $0x3, %eax
cvtsi2sd %eax, %xmm2
mulsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x110(%rbp)
movslq -0xe4(%rbp), %rax
movl -0x50(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x50(%rbp,%rax,4)
movsd -0x110(%rbp), %xmm0
movslq -0xe4(%rbp), %rax
addsd -0xe0(%rbp,%rax,8), %xmm0
movsd %xmm0, -0xe0(%rbp,%rax,8)
movsd -0x110(%rbp), %xmm1
movslq -0xe4(%rbp), %rax
movsd -0x80(%rbp,%rax,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x434b
movsd -0x110(%rbp), %xmm0
movslq -0xe4(%rbp), %rax
movsd %xmm0, -0x80(%rbp,%rax,8)
movsd -0x110(%rbp), %xmm0
movslq -0xe4(%rbp), %rax
ucomisd -0xb0(%rbp,%rax,8), %xmm0
jbe 0x437d
movsd -0x110(%rbp), %xmm0
movslq -0xe4(%rbp), %rax
movsd %xmm0, -0xb0(%rbp,%rax,8)
cmpl $0x0, -0xe4(%rbp)
jne 0x439c
movsd -0x110(%rbp), %xmm0
movsd 0x9caa(%rip), %xmm1     # 0xe040
ucomisd %xmm1, %xmm0
ja 0x43bf
cmpl $0x0, -0xe4(%rbp)
je 0x444b
movsd 0x9c8f(%rip), %xmm0     # 0xe040
ucomisd -0x110(%rbp), %xmm0
jbe 0x444b
movl -0xc(%rbp), %edi
callq 0x3440
movq %rax, %rsi
movl -0xe8(%rbp), %edx
movq -0xf0(%rbp), %rax
movl 0x18(%rax), %ecx
subl $0x1, %ecx
movsd -0x110(%rbp), %xmm0
leaq 0xa361(%rip), %rdi      # 0xe74d
movb $0x1, %al
callq 0x10d0
movl $0x5, -0x10(%rbp)
movl -0x10(%rbp), %eax
movq -0xf0(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x4441
movq -0xf0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x10(%rbp), %ecx
movq -0xf0(%rbp), %rdx
imull 0x14(%rdx), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx), %esi
leaq 0xa072(%rip), %rdi      # 0xe4a1
movb $0x0, %al
callq 0x10d0
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x43fa
movl $0xa, %edi
callq 0x1050
jmp 0x445f
movslq -0xe4(%rbp), %rax
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq -0xf0(%rbp), %rdi
callq 0xc3e0
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x40a1
movl $0x0, -0x10(%rbp)
cmpl $0x5, -0x10(%rbp)
jge 0x4565
movslq -0x10(%rbp), %rcx
leaq 0xeccb(%rip), %rax      # 0x13160
movq (%rax,%rcx,8), %rax
movq %rax, -0x138(%rbp)
movslq -0x10(%rbp), %rax
movl -0x30(%rbp,%rax,4), %eax
movl %eax, -0x130(%rbp)
movslq -0x10(%rbp), %rax
movl -0x50(%rbp,%rax,4), %eax
movl %eax, -0x12c(%rbp)
movslq -0x10(%rbp), %rax
movsd -0x80(%rbp,%rax,8), %xmm0
movsd %xmm0, -0x128(%rbp)
movslq -0x10(%rbp), %rax
movsd -0xe0(%rbp,%rax,8), %xmm0
movsd %xmm0, -0x120(%rbp)
movslq -0x10(%rbp), %rax
cmpl $0x0, -0x50(%rbp,%rax,4)
je 0x44fe
movslq -0x10(%rbp), %rax
movl -0x50(%rbp,%rax,4), %eax
movl %eax, -0x13c(%rbp)
jmp 0x450b
movl $0x1, %eax
movl %eax, -0x13c(%rbp)
jmp 0x450b
movsd -0x128(%rbp), %xmm0
movl -0x12c(%rbp), %ecx
movl -0x130(%rbp), %edx
movq -0x138(%rbp), %rsi
movsd -0x120(%rbp), %xmm1
movl -0x13c(%rbp), %eax
cvtsi2sd %eax, %xmm2
divsd %xmm2, %xmm1
movslq -0x10(%rbp), %rax
movsd -0xb0(%rbp,%rax,8), %xmm2
leaq 0xa21e(%rip), %rdi      # 0xe76e
movb $0x3, %al
callq 0x10d0
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x4480
movq 0xea64(%rip), %rax      # 0x12fd0
movq (%rax), %rdi
callq 0xd4d0
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopl (%rax)