// File: /workspace/github_c_makefile_star2_O2/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, 0xcbeb(%rip)      # 0x10410
jne 0x3835
leaq 0x5f91(%rip), %rdi      # 0x97bf
xorl %eax, %eax
callq 0x8a3c
movq 0xcb5c(%rip), %rax      # 0x10398
movslq 0x18(%rax), %rdi
shlq $0x3, %rdi
callq 0x8afc
movq %rax, 0xcbd0(%rip)      # 0x10420
movq 0xcb41(%rip), %rax      # 0x10398
movslq 0x18(%rax), %rdi
shlq $0x2, %rdi
callq 0x8afc
movq %rax, 0xcbbd(%rip)      # 0x10428
pushq $0x2
popq %rsi
movl $0x1000, %edi           # imm = 0x1000
callq 0x82c8
movq %rax, %rbx
xorl %r13d, %r13d
movq 0xcb13(%rip), %rax      # 0x10398
movslq 0x18(%rax), %rcx
cmpq %rcx, %r13
jge 0x399a
movq 0x8(%rax), %rbp
movslq 0x14(%rax), %rax
movslq %r13d, %r14
imulq %rax, %r14
movl 0x4(%rbp,%r14), %eax
cmpl $0x10000, %eax          # imm = 0x10000
jae 0x3953
movq 0x10(%rbp,%r14), %r15
movq %r15, 0xcb73(%rip)      # 0x10430
andl $0x0, 0x18(%rbx)
xorl %r12d, %r12d
cmpl %eax, %r12d
jae 0x38f3
movq 0xcb40(%rip), %rcx      # 0x10410
movl (%r15,%r12,8), %edx
cmpb $0x0, (%rcx,%rdx)
je 0x38ee
movl 0x18(%rbx), %esi
movq %rbx, %rdi
callq 0x8560
movw %r12w, (%rax)
movl 0x4(%rbp,%r14), %eax
incq %r12
jmp 0x38c4
movq 0x8(%rbx), %rdi
movslq 0x18(%rbx), %rsi
movslq 0x14(%rbx), %rdx
leaq -0x12b(%rip), %rcx      # 0x37db
callq 0x1090
movslq 0x18(%rbx), %rdi
addq %rdi, %rdi
callq 0x8afc
movq 0xcb02(%rip), %rcx      # 0x10420
movq %rax, (%rcx,%r13,8)
movq 0xcaf7(%rip), %rax      # 0x10420
movq (%rax,%r13,8), %rdi
movq 0x8(%rbx), %rsi
movslq 0x18(%rbx), %rdx
addq %rdx, %rdx
callq 0x1170
movl 0x18(%rbx), %eax
movq 0xcae1(%rip), %rcx      # 0x10428
movl %eax, (%rcx,%r13,4)
incq %r13
jmp 0x387e
movq 0xcace(%rip), %rax      # 0x10428
andl $0x0, (%rax,%r13,4)
pushq $0x2
popq %rdi
callq 0x8afc
movq 0xcab2(%rip), %rcx      # 0x10420
movq %rax, (%rcx,%r13,8)
movq 0xb677(%rip), %rax      # 0xeff0
movq (%rax), %rdi
movl 0x4(%rbp,%r14), %ecx
leaq 0x5e6a(%rip), %rsi      # 0x97f2
movl %r13d, %edx
movl $0xffff, %r8d           # imm = 0xFFFF
xorl %eax, %eax
callq 0x1150
jmp 0x394b
movl 0xca78(%rip), %esi      # 0x10418
movl 0xca76(%rip), %edx      # 0x1041c
leaq 0x5e74(%rip), %rdi      # 0x9821
xorl %eax, %eax
callq 0x10d0
movq 0xc9e5(%rip), %rdi      # 0x103a0
callq 0x8d03
movq 0xc9d9(%rip), %rdi      # 0x103a0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11a0