// File: /workspace/github_c_makefile_star2_O3/richarddurbin[P]hash10x/hash10x.c
// Function: goodHashesBuild
void goodHashesBuild (void)
{
  if (!hashWithinRange) die ("cluster code called without setting hashDepthRange") ;
  goodHashes = new (arrayMax(clusterBlocks), U16*) ;
  nGoodHashes = new (arrayMax(clusterBlocks), int) ;
  Array a = arrayCreate (4096, U16) ;
  int c, i ;
  
  for (c = 0 ; c < arrayMax(clusterBlocks) ; ++c)
    { ClusterBlock *cb = arrp(clusterBlocks, c, ClusterBlock) ;
      if (cb->nHash > U16MAX)
	{ nGoodHashes[c] = 0 ; goodHashes[c] = new(1,U16) ;
	  fprintf (stderr, "ignoring barcode %d - too many hashes %d > %d\n",
		   c, cb->nHash, U16MAX) ;
	  continue ;
	}
      ClusterHash *ch = clusHashBase = cb->clusHash ;
      arrayMax(a) = 0 ;
      for (i = 0 ; i < cb->nHash ; ++i, ++ch)
	if (hashWithinRange[ch->hash]) array(a, arrayMax(a), U16) = i ;
      arraySort (a, compareGoodHashes) ; /* sort by increasing hashDepth */
      goodHashes[c] = new(arrayMax(a),U16) ;
      memcpy (goodHashes[c], arrp(a,0,U16), arrayMax(a)*sizeof(U16)) ;
      nGoodHashes[c] = arrayMax(a) ;
    }

  printf ("  made goodHashes arrays for hash range %d to %d\n  ", hashRangeMin, hashRangeMax) ;
  timeUpdate (outFile) ; fflush (outFile) ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpq $0x0, 0xc038(%rip)      # 0x10400
jne 0x43d8
leaq 0x642e(%rip), %rdi      # 0xa7ff
xorl %eax, %eax
callq 0x95f8
movq 0xbfa9(%rip), %rax      # 0x10388
movslq 0x18(%rax), %rdi
shlq $0x3, %rdi
callq 0x96c0
movq %rax, 0xc01d(%rip)      # 0x10410
movq 0xbf8e(%rip), %rax      # 0x10388
movslq 0x18(%rax), %rdi
shlq $0x2, %rdi
callq 0x96c0
movq %rax, 0xc00a(%rip)      # 0x10418
movl $0x1000, %edi           # imm = 0x1000
movl $0x2, %esi
callq 0x8e88
movq %rax, %rbx
movq 0xbf61(%rip), %rax      # 0x10388
cmpl $0x0, 0x18(%rax)
jle 0x452f
xorl %r14d, %r14d
leaq -0xbf(%rip), %r15       # 0x437c
movq 0x8(%rax), %rcx
movslq 0x14(%rax), %rax
movslq %r14d, %rdx
imulq %rax, %rdx
leaq (%rcx,%rdx), %r12
addq $0x4, %r12
movl (%r12), %eax
cmpl $0x10000, %eax          # imm = 0x10000
jae 0x451f
addq %rdx, %rcx
movq 0x10(%rcx), %r13
movq %r13, 0xbfb1(%rip)      # 0x10420
movl $0x0, 0x18(%rbx)
testl %eax, %eax
je 0x44b4
movq 0xbf7f(%rip), %rcx      # 0x10400
xorl %ebp, %ebp
movl (%r13,%rbp,8), %edx
cmpb $0x0, (%rcx,%rdx)
je 0x44a7
movl 0x18(%rbx), %esi
movq %rbx, %rdi
callq 0x9131
movw %bp, (%rax)
movq 0xbf5d(%rip), %rcx      # 0x10400
movl (%r12), %eax
incq %rbp
cmpl %eax, %ebp
jb 0x4483
movslq 0x18(%rbx), %rsi
jmp 0x44b6
xorl %esi, %esi
movq 0x8(%rbx), %rdi
movslq 0x14(%rbx), %rdx
movq %r15, %rcx
callq 0x1090
movslq 0x18(%rbx), %rdi
addq %rdi, %rdi
callq 0x96c0
movq 0xbf37(%rip), %rcx      # 0x10410
movq %rax, (%rcx,%r14,8)
movq 0xbf2c(%rip), %rax      # 0x10410
movq (%rax,%r14,8), %rdi
movq 0x8(%rbx), %rsi
movslq 0x18(%rbx), %rdx
addq %rdx, %rdx
callq 0x1170
movl 0x18(%rbx), %eax
movq 0xbf16(%rip), %rcx      # 0x10418
movl %eax, (%rcx,%r14,4)
incq %r14
movq 0xbe78(%rip), %rax      # 0x10388
movslq 0x18(%rax), %rcx
cmpq %rcx, %r14
jl 0x443b
jmp 0x452f
movq %r14, %rdi
movq %r12, %rsi
movl %r14d, %edx
callq 0x1603
jmp 0x4506
movl 0xbed3(%rip), %esi      # 0x10408
movl 0xbed1(%rip), %edx      # 0x1040c
leaq 0x631f(%rip), %rdi      # 0xa861
xorl %eax, %eax
callq 0x10d0
movq 0xbe40(%rip), %rdi      # 0x10390
callq 0x98d9
movq 0xbe34(%rip), %rdi      # 0x10390
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11a0