// File: /workspace/github_c_makefile_star2_O2/richarddurbin[P]hash10x/hash10x.c
// Function: shareScan
void shareScan (int countMin, int countMax)
{
  U32 x ;
  int i, j, k, nTot = 0 ; 
  int *nBin = new0 (countMax-countMin, int) ;
  U32 *xBin = new (10*(countMax-countMin), U32) ;
  Array *aBin = new (10*(countMax-countMin), Array) ;
  for (x = countMax ; x < hashNumber ; x += 100)
    { int xCount = arr(hashDepth, x, U32) ;
      if (xCount < countMin || xCount >= countMax) continue ; /* out of range */
      int bin = xCount - countMin ;
      if (nBin[bin] == 10) continue ;                         /* already have enough */
      xBin[10*bin + nBin[bin]] = x ;
      Array a = countHashNeighbours (x) ;
      --*arrp(a,arrayMax(a)-1,int) ;                          /* remove top match; often wrong */
      while (arrayMax(a) && !arr(a,arrayMax(a)-1,int)) --arrayMax(a) ;
      aBin[10*bin + nBin[bin]++] = a ;
      if (++nTot == 10*(countMax-countMin)) break ;           /* done */
    }

  for (i = 0 ; i < countMax-countMin ; ++i)
    for (j = 0 ; j < nBin[i] ; ++j)
      { fprintf (outFile,"SHARE_SCAN %3d %24s ", i+countMin, cribText(xBin[10*i+j])) ;
	Array a = aBin[10*i+j] ;
	for (k = 1 ; k < arrayMax(a) ; ++k) fprintf (outFile," %d", arr(a,k,int)) ;
	fputc ('\n', outFile) ;
      }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %esi, %ebp
movl %esi, %ecx
movq %rdi, 0x18(%rsp)
subl %edi, %ecx
movq %rcx, 0x8(%rsp)
movslq %ecx, %rbx
pushq $0x4
popq %rsi
movq %rbx, %rdi
callq 0x8b24
movq %rax, 0x10(%rsp)
imull $0xa, %ebx, %r14d
movslq %r14d, %rbx
leaq (,%rbx,4), %rdi
callq 0x8afc
movq %rax, 0x28(%rsp)
shlq $0x3, %rbx
movq %rbx, %rdi
callq 0x8afc
movq %rax, 0x20(%rsp)
xorl %ebx, %ebx
movl 0xcd9a(%rip), %eax      # 0x103b8
movl %ebp, %r13d
cmpl %eax, %r13d
jae 0x36ee
movq 0xcd5f(%rip), %rcx      # 0x10390
movq 0x8(%rcx), %rdx
movl 0x14(%rcx), %ecx
imull %r13d, %ecx
movl (%rdx,%rcx), %edx
movl %edx, %ecx
subl 0x18(%rsp), %ecx
setl %sil
cmpl %ebp, %edx
setge %dl
orb %sil, %dl
jne 0x36e5
movslq %ecx, %r15
movq 0x10(%rsp), %rdx
movl (%rdx,%r15,4), %edx
cmpl $0xa, %edx
je 0x36e5
imull $0xa, %ecx, %r12d
addl %r12d, %edx
movslq %edx, %rax
movq 0x28(%rsp), %rcx
movl %r13d, (%rcx,%rax,4)
movl %r13d, %edi
callq 0x2d8e
movq 0x8(%rax), %rcx
movslq 0x18(%rax), %rdx
decq %rdx
movslq 0x14(%rax), %rsi
imulq %rdx, %rsi
decl (%rcx,%rsi)
movl 0x18(%rax), %edx
decl %edx
cmpl $-0x1, %edx
je 0x36b9
movslq 0x14(%rax), %rsi
movslq %edx, %rdi
imulq %rsi, %rdi
cmpl $0x0, (%rcx,%rdi)
jne 0x36b9
movl %edx, 0x18(%rax)
jmp 0x369c
movq 0x10(%rsp), %rsi
movl (%rsi,%r15,4), %ecx
leal 0x1(%rcx), %edx
movl %edx, (%rsi,%r15,4)
addl %ecx, %r12d
movslq %r12d, %rcx
movq 0x20(%rsp), %rdx
movq %rax, (%rdx,%rcx,8)
incl %ebx
cmpl %r14d, %ebx
je 0x36ee
movl 0xccd3(%rip), %eax      # 0x103b8
addl $0x64, %r13d
jmp 0x3621
xorl %eax, %eax
movq 0x8(%rsp), %rcx
testl %ecx, %ecx
cmovlel %eax, %ecx
movq %rcx, 0x8(%rsp)
leaq 0x5dab(%rip), %rbx      # 0x94b1
xorl %ebp, %ebp
cmpq 0x8(%rsp), %rbp
je 0x37cc
imulq $0xa, %rbp, %rax
movq %rax, 0x30(%rsp)
movq 0x18(%rsp), %rax
leal (%rax,%rbp), %r14d
xorl %r15d, %r15d
movq 0x10(%rsp), %rax
movslq (%rax,%rbp,4), %rax
cmpq %rax, %r15
jge 0x37c4
movq 0xcc5f(%rip), %r12      # 0x103a0
movq 0x30(%rsp), %rax
leaq (%r15,%rax), %r13
movq 0x28(%rsp), %rax
movl (%rax,%r13,4), %edi
callq 0x2a97
movq %r12, %rdi
leaq 0x6048(%rip), %rsi      # 0x97aa
movl %r14d, %edx
leaq 0xcc84(%rip), %rcx      # 0x103f0
xorl %eax, %eax
callq 0x1150
movq 0x20(%rsp), %rax
movq (%rax,%r13,8), %r12
pushq $0x1
popq %r13
movq 0xcc19(%rip), %rsi      # 0x103a0
cmpl 0x18(%r12), %r13d
jge 0x37b4
movq 0x8(%r12), %rax
movslq 0x14(%r12), %rcx
movslq %r13d, %rdx
imulq %rcx, %rdx
movl (%rax,%rdx), %edx
movq %rsi, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1150
incl %r13d
jmp 0x3780
pushq $0xa
popq %rdi
callq 0x1100
incq %r15
jmp 0x3728
incq %rbp
jmp 0x3708
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq