// File: /workspace/github_c_makefile_star2_O2/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 $0x158, %rsp            # imm = 0x158
movq %rsi, %r14
movq %rdi, %r15
pushq $0x10
popq %rsi
movl $0x1000, %edi           # imm = 0x1000
callq 0x82c8
movq %rax, %rbx
xorl %r12d, %r12d
leaq 0xb0(%rsp), %r13
pushq $0x7f
popq %rbp
cmpl (%r14), %r12d
jae 0x15a4
movq %r15, %rdi
leaq 0x10(%rsp), %rsi
xorl %edx, %edx
movq %r13, %rcx
xorl %r8d, %r8d
callq 0x13b0
leaq 0x27(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
movl %r12d, %ecx
callq 0x147c
movq %r13, %rdi
movl $0x96, %esi
movq %rbx, %rdx
movl %r12d, %ecx
callq 0x147c
incl %r12d
addq $0x78, %r15
jmp 0x155c
movq 0x8(%rbx), %rdi
movslq 0x18(%rbx), %rsi
movslq 0x14(%rbx), %rdx
leaq -0xa2(%rip), %rcx       # 0x1515
callq 0x1090
movq 0x8(%rbx), %rax
movq (%rax), %rdx
pushq $0x1
popq %rax
movl %eax, %r13d
cmpl 0x18(%rbx), %eax
jge 0x1602
movq 0x8(%rbx), %rsi
movl 0x14(%rbx), %edi
movl %edi, %ecx
imull %eax, %ecx
movslq %ecx, %r8
movq (%rsi,%r8), %rcx
cmpq %rdx, %rcx
je 0x15fb
addq %rsi, %r8
imull %r13d, %edi
incl %r13d
movslq %edi, %rdx
movups (%r8), %xmm0
movups %xmm0, (%rsi,%rdx)
incl %eax
movq %rcx, %rdx
jmp 0x15c9
movl %r13d, 0x4(%r14)
movslq %r13d, %r12
leaq (,%r12,8), %rdi
callq 0x8afc
movq %rax, 0x10(%r14)
xorl %r15d, %r15d
movq %r12, 0x8(%rsp)
testl %r12d, %r12d
cmovlel %r15d, %r13d
cmpq %r15, %r13
je 0x1680
movq 0x8(%rbx), %rax
movslq 0x14(%rbx), %rcx
movslq %r15d, %rbp
imulq %rbp, %rcx
movq (%rax,%rcx), %rdi
pushq $0x1
popq %rsi
callq 0x16b1
movl %eax, %r12d
movq 0xed3d(%rip), %rdi      # 0x10390
movl %eax, %esi
callq 0x8560
incl (%rax)
movq 0x10(%r14), %rax
movl %r12d, (%rax,%r15,8)
movq 0x8(%rbx), %rcx
movslq 0x14(%rbx), %rdx
imulq %rbp, %rdx
movzwl 0x8(%rcx,%rdx), %ecx
movw %cx, 0x4(%rax,%r15,8)
incq %r15
jmp 0x1629
leaq -0x2fb(%rip), %rcx      # 0x138c
pushq $0x8
popq %rdx
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x1090
movq %rbx, %rdi
callq 0x8408
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq