// File: /workspace/github_c_makefile_star2_O3/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
movl %ecx, 0x10(%rsp)
movslq %ecx, %rbx
movl $0x4, %esi
movq %rbx, %rdi
callq 0x96e8
movq %rax, 0x8(%rsp)
addl %ebx, %ebx
leal (%rbx,%rbx,4), %r15d
movslq %r15d, %rbx
leaq (,%rbx,4), %rdi
callq 0x96c0
movq %rax, 0x28(%rsp)
shlq $0x3, %rbx
movq %rbx, %rdi
callq 0x96c0
movq %rax, 0x20(%rsp)
movl 0xc225(%rip), %eax      # 0x103a8
cmpl %ebp, %eax
jbe 0x4279
xorl %ebx, %ebx
movq 0xc1ec(%rip), %rcx      # 0x10380
movl %ebp, %r13d
movq 0x8(%rcx), %rdx
movl 0x14(%rcx), %esi
imull %r13d, %esi
movl (%rdx,%rsi), %esi
movl %esi, %edx
subl 0x18(%rsp), %edx
setl %dil
cmpl %ebp, %esi
setge %sil
orb %dil, %sil
jne 0x426c
movslq %edx, %r12
movq 0x8(%rsp), %rsi
movl (%rsi,%r12,4), %esi
cmpl $0xa, %esi
je 0x426c
addl %edx, %edx
leal (%rdx,%rdx,4), %r14d
addl %r14d, %esi
movslq %esi, %rax
movq 0x28(%rsp), %rcx
movl %r13d, (%rcx,%rax,4)
movl %r13d, %edi
callq 0x3837
movq 0x8(%rax), %rcx
movslq 0x18(%rax), %rdx
decq %rdx
movslq 0x14(%rax), %rsi
imulq %rdx, %rsi
decl (%rcx,%rsi)
movslq 0x18(%rax), %rdx
testq %rdx, %rdx
je 0x4239
movslq 0x14(%rax), %rsi
leal -0x1(%rdx), %edi
leaq -0x1(%rdx), %r8
imulq %rsi, %r8
addq %r8, %rcx
negq %rsi
cmpl $0x0, (%rcx)
jne 0x4239
decq %rdx
movl %edi, 0x18(%rax)
decl %edi
addq %rsi, %rcx
testq %rdx, %rdx
jne 0x4224
movq 0x8(%rsp), %rsi
movl (%rsi,%r12,4), %ecx
leal 0x1(%rcx), %edx
movl %edx, (%rsi,%r12,4)
addl %ecx, %r14d
movslq %r14d, %rcx
movq 0x20(%rsp), %rdx
movq %rax, (%rdx,%rcx,8)
incl %ebx
cmpl %r15d, %ebx
je 0x4279
movq 0xc11a(%rip), %rcx      # 0x10380
movl 0xc13c(%rip), %eax      # 0x103a8
addl $0x64, %r13d
cmpl %eax, %r13d
jb 0x4197
movl 0x10(%rsp), %eax
testl %eax, %eax
jle 0x436d
movl %eax, %eax
movq %rax, 0x30(%rsp)
leaq 0x625e(%rip), %rbx      # 0xa4f1
xorl %r12d, %r12d
movq 0x8(%rsp), %rax
cmpl $0x0, (%rax,%r12,4)
jle 0x435f
leaq (%r12,%r12), %rax
leaq (%rax,%rax,4), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rax
leal (%r12,%rax), %r15d
xorl %ebp, %ebp
movq 0xc0cb(%rip), %r14      # 0x10390
movq 0x10(%rsp), %rax
leaq (%rax,%rbp), %r13
movq 0x28(%rsp), %rax
movl (%rax,%r13,4), %edi
callq 0x3513
movq %r14, %rdi
leaq 0x6504(%rip), %rsi      # 0xa7ea
movl %r15d, %edx
leaq 0xc0f0(%rip), %rcx      # 0x103e0
xorl %eax, %eax
callq 0x1150
movq 0x20(%rsp), %rax
movq (%rax,%r13,8), %r14
cmpl $0x2, 0x18(%r14)
jl 0x4339
movl $0x1, %r13d
movq 0xc07c(%rip), %rdi      # 0x10390
movq 0x8(%r14), %rax
movslq 0x14(%r14), %rcx
movslq %r13d, %r13
imulq %r13, %rcx
movl (%rax,%rcx), %edx
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1150
incl %r13d
cmpl 0x18(%r14), %r13d
jl 0x430d
movq 0xc050(%rip), %rsi      # 0x10390
movl $0xa, %edi
callq 0x1100
incq %rbp
movq 0x8(%rsp), %rax
movslq (%rax,%r12,4), %rax
cmpq %rax, %rbp
jl 0x42be
incq %r12
cmpq 0x30(%rsp), %r12
jne 0x4296
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq