// File: /workspace/github_c_makefile_star2_O1/richarddurbin[P]hash10x/hash10x.c
// Function: hashNeighbours
Array hashNeighbours (int x)
{ /* return array of hashes that share between min and max codes with x */
  /* abuse ClusterHash structure for this array, storing the number of shared codes in ->read */
  if (!hashWithinRange) die ("hashNeighbours() called without setting hashDepthRange") ;
  Array ch = arrayCreate (1000, ClusterHash) ;
  int i,j ;
  U32 xCount = arr(hashDepth,x,U32) ; if (!xCount) return 0 ;
  for (i = 0 ; i < xCount ; ++i)
    { ClusterBlock *b = arrp(clusterBlocks, arr(hashCodes,x,U32*)[i], ClusterBlock) ;
      ClusterHash *c = b->clusHash ;
      for (j = 0 ; j < b->nHash ; ++j, ++c)
	if (c->hash != x && hashWithinRange[c->hash])
	  array(ch, arrayMax(ch), ClusterHash) = *c ;
    }
  arraySort (ch, compareClusterHash) ;
  Array shared = arrayCreate (256, ClusterHash) ; /* abuse structure esp. read field */
  ClusterHash *last = arrayp (shared, 0, ClusterHash) ;
  last->hash = arrp(ch, 0, ClusterHash)->hash ; last->read = 1 ;
  for (i = 1 ; i < arrayMax(ch) ; ++i)
    if (arrp(ch, i, ClusterHash)->hash == last->hash) ++last->read ;
    else
      { last = arrayp (shared, arrayMax(shared), ClusterHash) ;
	last->hash = arrp(ch, i, ClusterHash)->hash ; last->read = 1 ;
      }
  arrayDestroy (ch) ;
  return shared ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edi, %ebp
cmpq $0x0, 0xcd35(%rip)      # 0x10400
jne 0x36db
leaq 0x6f2e(%rip), %rdi      # 0xa602
xorl %eax, %eax
callq 0x9408
movl $0x3e8, %edi            # imm = 0x3E8
movl $0x8, %esi
callq 0x8c70
movq 0xcc8f(%rip), %rdx      # 0x10380
movq 0x8(%rdx), %rcx
movslq 0x14(%rdx), %rdx
movslq %ebp, %rsi
movq %rsi, 0x10(%rsp)
imulq %rsi, %rdx
movl (%rcx,%rdx), %ecx
movq %rcx, 0x8(%rsp)
testq %rcx, %rcx
je 0x3838
movq %rax, (%rsp)
xorl %r12d, %r12d
movq 0xcc64(%rip), %rax      # 0x10388
movq 0x8(%rax), %r13
movq 0xcc89(%rip), %rcx      # 0x103b8
movq 0x8(%rcx), %rdx
movslq 0x14(%rcx), %rcx
imulq 0x10(%rsp), %rcx
movq (%rdx,%rcx), %rcx
movl 0x14(%rax), %r14d
imull (%rcx,%r12,4), %r14d
cmpl $0x0, 0x4(%r13,%r14)
je 0x378b
movq 0x10(%r13,%r14), %r15
xorl %ebx, %ebx
movl (%r15,%rbx,8), %eax
cmpl %ebp, %eax
je 0x3781
movq 0xcc98(%rip), %rcx      # 0x10400
cmpb $0x0, (%rcx,%rax)
je 0x3781
movq (%rsp), %rdi
movl 0x18(%rdi), %esi
callq 0x8f2b
movq (%r15,%rbx,8), %rcx
movq %rcx, (%rax)
incq %rbx
cmpl 0x4(%r13,%r14), %ebx
jb 0x3759
incq %r12
cmpq 0x8(%rsp), %r12
jne 0x371d
movq (%rsp), %r15
movq 0x8(%r15), %rdi
movslq 0x18(%r15), %rsi
movslq 0x14(%r15), %rdx
leaq -0x1b30(%rip), %rcx     # 0x1c7c
callq 0x1090
movl $0x100, %edi            # imm = 0x100
movl $0x8, %esi
callq 0x8c70
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x8f2b
movq 0x8(%r15), %rcx
movl (%rcx), %ecx
movl %ecx, (%rax)
movw $0x1, 0x4(%rax)
cmpl $0x2, 0x18(%r15)
jl 0x382e
movl $0x1, %ebp
movq 0x8(%r15), %rcx
movslq 0x14(%r15), %rdx
movslq %ebp, %rbx
imulq %rbx, %rdx
movl (%rcx,%rdx), %ecx
cmpl (%rax), %ecx
jne 0x3803
incw 0x4(%rax)
jmp 0x3826
movl 0x18(%r14), %esi
movq %r14, %rdi
callq 0x8f2b
movq 0x8(%r15), %rcx
movslq 0x14(%r15), %rdx
imulq %rbx, %rdx
movl (%rcx,%rdx), %ecx
movl %ecx, (%rax)
movw $0x1, 0x4(%rax)
incl %ebp
cmpl 0x18(%r15), %ebp
jl 0x37e7
movq %r15, %rdi
callq 0x8dc9
jmp 0x383b
xorl %r14d, %r14d
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq