// File: /workspace/github_c_makefile_star2_O1/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, %r14d
movq %rdi, 0x18(%rsp)
subl %edi, %r14d
movslq %r14d, %rbx
movl $0x4, %esi
movq %rbx, %rdi
callq 0x94f8
movq %rax, 0x8(%rsp)
addl %ebx, %ebx
leal (%rbx,%rbx,4), %eax
movl %eax, 0x10(%rsp)
movslq %eax, %rbx
leaq (,%rbx,4), %rdi
callq 0x94d0
movq %rax, 0x28(%rsp)
shlq $0x3, %rbx
movq %rbx, %rdi
callq 0x94d0
movq %rax, 0x20(%rsp)
cmpl %ebp, 0xc2a4(%rip)      # 0x103a8
jbe 0x41f1
xorl %ebx, %ebx
movl %ebp, %r13d
movq 0xc26a(%rip), %rax      # 0x10380
movq 0x8(%rax), %rcx
movl 0x14(%rax), %eax
imull %r13d, %eax
movl (%rcx,%rax), %ecx
movl %ecx, %eax
subl 0x18(%rsp), %eax
setl %dl
cmpl %ebp, %ecx
setge %cl
orb %dl, %cl
jne 0x4147
movslq %eax, %r12
movq 0x8(%rsp), %rcx
movl (%rcx,%r12,4), %ecx
cmpl $0xa, %ecx
jne 0x414e
xorl %eax, %eax
jmp 0x41dc
addl %eax, %eax
leal (%rax,%rax,4), %r15d
addl %r15d, %ecx
movslq %ecx, %rax
movq 0x28(%rsp), %rcx
movl %r13d, (%rcx,%rax,4)
movl %r13d, %edi
callq 0x384d
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 0x41b4
movslq 0x14(%rax), %rsi
leal -0x1(%rdx), %edi
leaq -0x1(%rdx), %r8
imulq %rsi, %r8
addq %r8, %rcx
negq %rsi
cmpl $0x0, (%rcx)
jne 0x41b4
decq %rdx
movl %edi, 0x18(%rax)
decl %edi
addq %rsi, %rcx
testq %rdx, %rdx
jne 0x419f
movq 0x8(%rsp), %rsi
movl (%rsi,%r12,4), %ecx
leal 0x1(%rcx), %edx
movl %edx, (%rsi,%r12,4)
addl %ecx, %r15d
movslq %r15d, %rcx
movq 0x20(%rsp), %rdx
movq %rax, (%rdx,%rcx,8)
incl %ebx
cmpl 0x10(%rsp), %ebx
sete %al
testb %al, %al
jne 0x41f1
addl $0x64, %r13d
cmpl 0xc1bd(%rip), %r13d     # 0x103a8
jb 0x410f
testl %r14d, %r14d
jle 0x42e3
movl %r14d, %eax
movq %rax, 0x30(%rsp)
leaq 0x62a8(%rip), %rbx      # 0xa4b1
xorl %r12d, %r12d
movq 0x8(%rsp), %rax
cmpl $0x0, (%rax,%r12,4)
jle 0x42d5
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 0xc155(%rip), %r14      # 0x10390
movq 0x10(%rsp), %rax
leaq (%rax,%rbp), %r13
movq 0x28(%rsp), %rax
movl (%rax,%r13,4), %edi
callq 0x353c
movq %r14, %rdi
leaq 0x654e(%rip), %rsi      # 0xa7aa
movl %r15d, %edx
leaq 0xc17a(%rip), %rcx      # 0x103e0
xorl %eax, %eax
callq 0x1150
movq 0x20(%rsp), %rax
movq (%rax,%r13,8), %r14
cmpl $0x2, 0x18(%r14)
jl 0x42af
movl $0x1, %r13d
movq 0xc106(%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 0x4283
movq 0xc0da(%rip), %rsi      # 0x10390
movl $0xa, %edi
callq 0x1100
incq %rbp
movq 0x8(%rsp), %rax
movslq (%rax,%r12,4), %rax
cmpq %rax, %rbp
jl 0x4234
incq %r12
cmpq 0x30(%rsp), %r12
jne 0x420c
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq