// File: /workspace/github_c_makefile_star2_O1/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, 0xc0c2(%rip)      # 0x10400
jne 0x434e
leaq 0x6478(%rip), %rdi      # 0xa7bf
xorl %eax, %eax
callq 0x9408
movq 0xc033(%rip), %rax      # 0x10388
movslq 0x18(%rax), %rdi
shlq $0x3, %rdi
callq 0x94d0
movq %rax, 0xc0a7(%rip)      # 0x10410
movq 0xc018(%rip), %rax      # 0x10388
movslq 0x18(%rax), %rdi
shlq $0x2, %rdi
callq 0x94d0
movq %rax, 0xc094(%rip)      # 0x10418
movl $0x1000, %edi           # imm = 0x1000
movl $0x2, %esi
callq 0x8c70
movq %rax, %rbx
movq 0xbfeb(%rip), %rax      # 0x10388
cmpl $0x0, 0x18(%rax)
jle 0x4496
xorl %r14d, %r14d
leaq -0xbf(%rip), %r15       # 0x42f2
movq 0x8(%rax), %rcx
movslq 0x14(%rax), %rdx
movslq %r14d, %rax
imulq %rdx, %rax
leaq (%rcx,%rax), %r12
addq $0x4, %r12
cmpl $0x10000, (%r12)        # imm = 0x10000
jae 0x4489
addq %rax, %rcx
movq 0x10(%rcx), %r13
movq %r13, 0xc03c(%rip)      # 0x10420
movl $0x0, 0x18(%rbx)
cmpl $0x0, 0x4(%rcx)
je 0x441c
xorl %ebp, %ebp
movq 0xc006(%rip), %rax      # 0x10400
movl (%r13,%rbp,8), %ecx
cmpb $0x0, (%rax,%rcx)
je 0x4413
movl 0x18(%rbx), %esi
movq %rbx, %rdi
callq 0x8f2b
movw %bp, (%rax)
incq %rbp
cmpl (%r12), %ebp
jb 0x43f3
movq 0x8(%rbx), %rdi
movslq 0x18(%rbx), %rsi
movslq 0x14(%rbx), %rdx
movq %r15, %rcx
callq 0x1090
movslq 0x18(%rbx), %rdi
addq %rdi, %rdi
callq 0x94d0
movq 0xbfcd(%rip), %rcx      # 0x10410
movq %rax, (%rcx,%r14,8)
movq 0xbfc2(%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 0xbfac(%rip), %rcx      # 0x10418
movl %eax, (%rcx,%r14,4)
incq %r14
movq 0xbf0e(%rip), %rax      # 0x10388
movslq 0x18(%rax), %rcx
cmpq %rcx, %r14
jl 0x43b1
jmp 0x4496
movq %r14, %rdi
movq %r12, %rsi
callq 0x1603
jmp 0x4470
movl 0xbf6c(%rip), %esi      # 0x10408
movl 0xbf6a(%rip), %edx      # 0x1040c
leaq 0x6378(%rip), %rdi      # 0xa821
xorl %eax, %eax
callq 0x10d0
movq 0xbed9(%rip), %rdi      # 0x10390
callq 0x96ed
movq 0xbecd(%rip), %rdi      # 0x10390
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11a0