// File: /workspace/github_c_makefile_star2_O3/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, 0xcd59(%rip)      # 0x10400
jne 0x36b7
leaq 0x6f92(%rip), %rdi      # 0xa642
xorl %eax, %eax
callq 0x95f8
movl $0x3e8, %edi            # imm = 0x3E8
movl $0x8, %esi
callq 0x8e88
movq %rax, (%rsp)
movq 0xccaf(%rip), %rax      # 0x10380
movq 0x8(%rax), %rcx
movslq 0x14(%rax), %rax
movslq %ebp, %rdx
movq %rdx, 0x10(%rsp)
imulq %rdx, %rax
movl (%rcx,%rax), %eax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x3822
xorl %r12d, %r12d
movq 0xcc88(%rip), %rax      # 0x10388
movq 0x8(%rax), %r13
movq 0xccad(%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
movl 0x4(%r13,%r14), %eax
testl %eax, %eax
je 0x376a
movq 0x10(%r13,%r14), %r15
xorl %ebx, %ebx
movl (%r15,%rbx,8), %ecx
cmpl %ebp, %ecx
je 0x3763
movq 0xccbb(%rip), %rdx      # 0x10400
cmpb $0x0, (%rdx,%rcx)
je 0x3763
movq (%rsp), %rdi
movl 0x18(%rdi), %esi
callq 0x9131
movq (%r15,%rbx,8), %rcx
movq %rcx, (%rax)
movl 0x4(%r13,%r14), %eax
incq %rbx
cmpl %eax, %ebx
jb 0x3736
incq %r12
cmpq 0x8(%rsp), %r12
jne 0x36f9
movq (%rsp), %rbx
movq 0x8(%rbx), %rdi
movslq 0x18(%rbx), %rsi
movslq 0x14(%rbx), %rdx
leaq -0x1aff(%rip), %rcx     # 0x1c8c
callq 0x1090
movl $0x100, %edi            # imm = 0x100
movl $0x8, %esi
callq 0x8e88
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x9131
movq 0x8(%rbx), %rcx
movl (%rcx), %edx
movl %edx, (%rax)
movw $0x1, 0x4(%rax)
movl 0x18(%rbx), %edi
cmpl $0x2, %edi
jl 0x3817
movq (%rsp), %rsi
movl 0x14(%rsi), %esi
movl $0x1, %ebp
movl %esi, %r8d
imull %ebp, %r8d
movslq %r8d, %r8
cmpl %edx, (%rcx,%r8)
jne 0x37e4
incw 0x4(%rax)
jmp 0x3811
movl 0x18(%r14), %esi
movq %r14, %rdi
callq 0x9131
movq (%rsp), %rdi
movq 0x8(%rdi), %rcx
movl 0x14(%rdi), %esi
movl %esi, %edx
imull %ebp, %edx
movslq %edx, %rdx
movl (%rcx,%rdx), %edx
movl %edx, (%rax)
movw $0x1, 0x4(%rax)
movl 0x18(%rdi), %edi
incl %ebp
cmpl %edi, %ebp
jl 0x37ce
movq (%rsp), %rdi
callq 0x8fd6
jmp 0x3825
xorl %r14d, %r14d
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq