// File: /workspace/github_c_makefile_star2_O3/richarddurbin[P]hash10x/hash10x.c
// Function: processBlock
void processBlock (U32 *readData, ClusterBlock *b)
{
  Array a = arrayCreate (4096, HashTemp) ;
  int i, j, n ;
  char s1[160], s2[160] ;

  for (i = 0 ; i < b->nRead ; ++i, readData += 30)
    { unpackFQB (readData, s1, 0, s2, 0) ;
      seqAddHashes (&s1[23], 127, a, i) ; /* ignore 16bp of barcode and 7bp of spacer */
      seqAddHashes (s2, 150, a, i) ;
    }
  
  arraySort (a, compareHashTemp) ; /* sort then remove duplicate hash values */
  U64 hash, lastHash = arrp(a,0,HashTemp)->hash ;
  for (n = 1, j = 1 ; j < arrayMax(a) ; ++j)
    { hash = arrp(a,j,HashTemp)->hash ;
      if (hash != lastHash)
	arr(a,n++,HashTemp) = arr(a,j,HashTemp) ; lastHash = hash ;
    }

  b->nHash = n ;
  b->clusHash = new (n, ClusterHash) ;
  for (i = 0 ; i < n ; ++i)
    { int index = hashIndexFind (arrp(a,i,HashTemp)->hash, TRUE) ;
      ++array(hashDepth, index, U32) ;
      b->clusHash[i].hash = index ;
      b->clusHash[i].read = arrp(a,i,HashTemp)->read ;
    }

  qsort (b->clusHash, n, sizeof(ClusterHash), compareClusterHash) ; /* sort so hashes are in order */
  
  arrayDestroy (a) ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rsi, %r14
movq %rdi, %r15
movl $0x1000, %edi           # imm = 0x1000
movl $0x10, %esi
callq 0x8e88
movq %rax, %rbx
cmpl $0x0, (%r14)
je 0x1eb2
xorl %r12d, %r12d
movq %rsp, %rbp
leaq 0xa0(%rsp), %r13
movq %r15, %rdi
movq %rbp, %rsi
xorl %edx, %edx
movq %r13, %rcx
xorl %r8d, %r8d
callq 0x1cb4
leaq 0x17(%rsp), %rdi
movl $0x7f, %esi
movq %rbx, %rdx
movl %r12d, %ecx
callq 0x1d6b
movq %r13, %rdi
movl $0x96, %esi
movq %rbx, %rdx
movl %r12d, %ecx
callq 0x1d6b
incl %r12d
addq $0x78, %r15
cmpl (%r14), %r12d
jb 0x1e6b
movq 0x8(%rbx), %rdi
movslq 0x18(%rbx), %rsi
movslq 0x14(%rbx), %rdx
leaq -0xab(%rip), %rcx       # 0x1e1a
callq 0x1090
movl 0x18(%rbx), %ecx
movl $0x1, %eax
cmpl $0x2, %ecx
jl 0x1f22
movq 0x8(%rbx), %rax
movq (%rax), %rsi
movl $0x1, %eax
movl $0x1, %edx
movq %rsi, %r10
movq 0x8(%rbx), %rdi
movl 0x14(%rbx), %r8d
movl %r8d, %esi
imull %edx, %esi
movslq %esi, %r9
movq (%rdi,%r9), %rsi
cmpq %r10, %rsi
je 0x1f1c
addq %rdi, %r9
imull %eax, %r8d
incl %eax
movslq %r8d, %rcx
movups (%r9), %xmm0
movups %xmm0, (%rdi,%rcx)
movl 0x18(%rbx), %ecx
incl %edx
cmpl %ecx, %edx
jl 0x1ee8
movl %eax, 0x4(%r14)
movslq %eax, %r15
leaq (,%r15,8), %rdi
callq 0x96c0
movq %rax, 0x10(%r14)
testl %r15d, %r15d
jle 0x2027
movq 0x8(%rbx), %rcx
movl 0x14(%rbx), %edx
leaq 0x96ea(%rip), %r12      # 0xb63b
xorl %ebp, %ebp
imull %ebp, %edx
movslq %edx, %rax
movq (%rcx,%rax), %rax
movq 0xe4ec(%rip), %rdi      # 0x10450
movq %rdi, %rdx
andq %rax, %rdx
movb 0xd1e0(%rip), %cl       # 0xf150
movq %rax, %r8
shrq %cl, %r8
movq 0xe41b(%rip), %rcx      # 0x10398
movl (%rcx,%rdx,4), %r13d
movq 0xe428(%rip), %rsi      # 0x103b0
testl %r13d, %r13d
je 0x1fac
andq %rdi, %r8
orq $0x1, %r8
movl %r13d, %r9d
cmpq %rax, (%rsi,%r9,8)
je 0x1fe9
addq %r8, %rdx
andq %rdi, %rdx
movl (%rcx,%rdx,4), %r13d
testl %r13d, %r13d
jne 0x1f94
movl 0xe3f5(%rip), %r13d     # 0x103a8
leal 0x1(%r13), %edi
movl %edi, 0xe3eb(%rip)      # 0x103a8
movl %r13d, (%rcx,%rdx,4)
movq %rax, (%rsi,%r13,8)
movl 0xe3dd(%rip), %eax      # 0x103a8
movq 0xe3ce(%rip), %rcx      # 0x103a0
shrq $0x2, %rcx
addq $-0x2, %rcx
cmpq %rax, %rcx
jae 0x1fe9
movq %r12, %rdi
xorl %eax, %eax
callq 0x95f8
movq 0xe390(%rip), %rdi      # 0x10380
movl %r13d, %esi
callq 0x9131
incl (%rax)
movq 0x10(%r14), %rax
movl %r13d, (%rax,%rbp,8)
movq 0x8(%rbx), %rcx
movl 0x14(%rbx), %edx
movl %edx, %esi
imull %ebp, %esi
movslq %esi, %rsi
movzwl 0x8(%rcx,%rsi), %esi
movw %si, 0x4(%rax,%rbp,8)
incq %rbp
cmpq %r15, %rbp
jne 0x1f53
leaq -0x3a2(%rip), %rcx      # 0x1c8c
movl $0x8, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x1090
movq %rbx, %rdi
callq 0x8fd6
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq