// File: /workspace/github_c_makefile_star2_O2/richarddurbin[P]hash10x/moshasm.c
// Function: readsetStats
void readsetStats (Readset *rs)
{
  U32 n = arrayMax(rs->reads)-1 ;
  if (!n) { fprintf (stderr, "stats called on empty readset\n") ; return ; }

  moshsetSummary (rs->ms, outFile) ;
  
  U32 i, j ; 
  int nUnique0 = 0, nUnique1 = 0 ;
  U64 totLen = 0, totMiss = 0, lenUnique0 = 0, lenUnique1 = 0 ;
  U64 totCopy[4] ; totCopy[0] = totCopy[1] = totCopy[2] = totCopy[3] = 0 ;
  U32 nBad = 0, nBadRepeat = 0, nBadOrder10 = 0, nBadOrder1 = 0 ;
  U32 nBadNoMatch = 0, nBadLowHit = 0, nBadLowCopy1 = 0 ;
  
  for (i = 1 ; i <= n ; ++i)
    { Read *read = arrp(rs->reads, i, Read) ;
      totLen += read->len ;
      totMiss += read->nMiss ;
      for (j = 0 ; j < 4 ; ++j) totCopy[j] += read->nCopy[j] ;
      if (read->nCopy[1] == 0) { ++nUnique0 ; lenUnique0 += read->len ; }
      else if (read->nCopy[1] == 1) { ++nUnique1 ; lenUnique1 += read->len ; }
      if (read->bad)
	{ ++nBad ;
	  if (read->badRepeat) ++nBadRepeat ;
	  if (read->badOrder10) ++nBadOrder10 ;
	  if (read->badOrder1) ++nBadOrder1 ;
	  if (read->badNoMatch) ++nBadNoMatch ;
	  if (read->badLowHit) ++nBadLowHit ;
	  if (read->badLowCopy1) ++nBadLowCopy1 ;
	}
    }
  fprintf (outFile, "RS %d sequences, total length %llu (av %.1f)\n",
	   n, totLen, totLen/(double)n) ;
  fprintf (outFile, "RS %llu mosh hits, %.1f bp/hit, frac hit %.2f, av hits/read %.1f\n",
	   rs->totHit, totLen/(double)rs->totHit, rs->totHit/(double)(totMiss+rs->totHit),
	   rs->totHit/(double)n) ;
  fprintf (outFile, "RS hit distribution %.2f copy0, %.2f copy1, %.2f copy2, %.2f copyM\n",
	   totCopy[0]/(double)rs->totHit, totCopy[1]/(double)rs->totHit,
	   totCopy[2]/(double)rs->totHit, totCopy[3]/(double)rs->totHit) ;
  U32 nUniqueMulti = n - nUnique0 - nUnique1 ;
  fprintf (outFile, "RS num reads and av_len with 0 copy1 hits %d %.1f with 1 copy1 hits %d %.1f"
	   " >1 copy1 hits %d %.1f av copy1 hits %.1f\n",
	   nUnique0, lenUnique0/(double)nUnique0, nUnique1, lenUnique1/(double)nUnique1,
	   nUniqueMulti, (totLen - lenUnique0 - lenUnique1)/(double)nUniqueMulti,
	   (totCopy[1]-nUnique1)/(double)nUniqueMulti) ;
  fprintf (outFile, "RS bad %u : %u repeat, %u order10, %u order1, ",
	   nBad, nBadRepeat, nBadOrder10, nBadOrder1) ;
  fprintf (outFile, "%u no_match, %u low_hit, %u low_copy1\n",
	   nBadNoMatch, nBadLowHit, nBadLowCopy1) ;
  U32 nCopy[4], hitCopy[4], hit2Copy[4] ;
  U64 depthCopy[4] ;
  for (j = 0 ; j < 4 ; ++j) nCopy[j] = hitCopy[j] = hit2Copy[j] = depthCopy[j] = 0 ;
  for (i = 1 ; i <= rs->ms->max ; ++i)
    { j = msCopy(rs->ms,i) ;
      ++nCopy[j] ;
      if (rs->ms->depth[i] > 0) ++hitCopy[j] ;
      if (rs->ms->depth[i] > 1) { ++hit2Copy[j] ; depthCopy[j] += rs->ms->depth[i] ; }
    }
  fprintf (outFile, "RS mosh frac hit hit>1 av: copy0 %.3f %.3f %.1f copy1 %.3f %.3f %.1f copy2 %.3f %.3f %.1f copyM %.3f %.3f %.1f\n", 
   hitCopy[0]/(double)nCopy[0], hit2Copy[0]/(double)nCopy[0], depthCopy[0]/(double)hit2Copy[0], 
   hitCopy[1]/(double)nCopy[1], hit2Copy[1]/(double)nCopy[1], depthCopy[1]/(double)hit2Copy[1], 
   hitCopy[2]/(double)nCopy[2], hit2Copy[2]/(double)nCopy[2], depthCopy[2]/(double)hit2Copy[2], 
   hitCopy[3]/(double)nCopy[3], hit2Copy[3]/(double)nCopy[3], depthCopy[3]/(double)hit2Copy[3]) ;
}

// Assembly:
movq 0x8(%rdi), %rax
movl 0x18(%rax), %eax
decl %eax
je 0x2126
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rdi, 0x38(%rsp)
movq (%rdi), %rdi
movq 0xa848(%rip), %rsi      # 0xc370
movq %rax, %rbx
callq 0x50f3
movq %rbx, %rdx
xorps %xmm0, %xmm0
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
pushq $0x1
popq %rax
movq $0x0, 0x48(%rsp)
movq $0x0, 0x40(%rsp)
xorl %r12d, %r12d
xorl %r14d, %r14d
movq $0x0, 0x88(%rsp)
movq $0x0, 0x80(%rsp)
xorl %r13d, %r13d
xorl %ebx, %ebx
xorl %ebp, %ebp
xorl %r15d, %r15d
movl $0x0, 0x34(%rsp)
movl $0x0, 0x30(%rsp)
movl $0x0, 0x2c(%rsp)
cmpl %edx, %eax
ja 0x1c66
movq 0x38(%rsp), %rcx
movq 0x8(%rcx), %rcx
movq 0x8(%rcx), %rsi
movl 0x14(%rcx), %edi
imull %eax, %edi
leaq (%rsi,%rdi), %r8
addq $0x24, %r8
movslq -0x24(%r8), %r11
movslq -0x8(%r8), %rcx
xorl %r9d, %r9d
cmpq $0x4, %r9
je 0x1be0
movslq (%r8,%r9,4), %r10
addq %r10, 0xa0(%rsp,%r9,8)
incq %r9
jmp 0x1bc9
movl 0x28(%rsi,%rdi), %r8d
cmpl $0x1, %r8d
je 0x1c07
testl %r8d, %r8d
jne 0x1c1c
movq 0x48(%rsp), %r8
incl %r8d
movq %r8, 0x48(%rsp)
addq %r11, 0x88(%rsp)
jmp 0x1c1c
movq 0x40(%rsp), %r8
incl %r8d
movq %r8, 0x40(%rsp)
addq %r11, 0x80(%rsp)
movzbl 0x18(%rsi,%rdi), %esi
testl %esi, %esi
je 0x1c59
incl %r13d
movl %esi, %edi
andl $0x1, %edi
addl %edi, %ebx
btl $0x1, %esi
adcl $0x0, %ebp
btl $0x2, %esi
adcl $0x0, %r15d
btl $0x3, %esi
adcl $0x0, 0x34(%rsp)
btl $0x4, %esi
adcl $0x0, 0x30(%rsp)
btl $0x5, %esi
adcl $0x0, 0x2c(%rsp)
addq %r11, %r12
addq %rcx, %r14
incl %eax
jmp 0x1b9b
movq 0xa703(%rip), %rdi      # 0xc370
movq %r12, %xmm0
punpckldq 0x5396(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x539e(%rip), %xmm0     # 0x7020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0xe0(%rsp)
movl %edx, %eax
cvtsi2sd %rax, %xmm2
movsd %xmm2, 0x90(%rsp)
movapd %xmm1, %xmm0
divsd %xmm2, %xmm0
leaq 0x54a9(%rip), %rsi      # 0x715f
movq %r12, %rcx
movb $0x1, %al
movq %rdx, 0x98(%rsp)
callq 0x1130
movq 0xa6a1(%rip), %rdi      # 0xc370
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rdx
movq %rdx, %xmm0
movq 0x532b(%rip), %xmm1     # 0x7010
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x532f(%rip), %xmm3     # 0x7020
subpd %xmm3, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
movapd 0xe0(%rsp), %xmm0
divsd %xmm2, %xmm0
addq %rdx, %r14
movq %r14, %xmm4
punpckldq %xmm1, %xmm4    # xmm4 = xmm4[0],xmm1[0],xmm4[1],xmm1[1]
subpd %xmm3, %xmm4
movapd %xmm4, %xmm3
unpckhpd %xmm4, %xmm3            # xmm3 = xmm3[1],xmm4[1]
addsd %xmm4, %xmm3
movapd %xmm2, %xmm1
divsd %xmm3, %xmm1
divsd 0x90(%rsp), %xmm2
leaq 0x544b(%rip), %rsi      # 0x718d
movb $0x3, %al
callq 0x1130
movq 0xa620(%rip), %rdi      # 0xc370
movsd 0xa0(%rsp), %xmm1
movsd 0x52af(%rip), %xmm2     # 0x7010
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x52b4(%rip), %xmm3     # 0x7020
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq 0x38(%rsp), %rax
movsd 0x10(%rax), %xmm1
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd %xmm2, %xmm6
subpd %xmm3, %xmm1
movapd %xmm3, %xmm7
movapd %xmm1, %xmm4
unpckhpd %xmm1, %xmm4            # xmm4 = xmm4[1],xmm1[1]
addsd %xmm1, %xmm4
divsd %xmm4, %xmm0
movq 0xa8(%rsp), %r14
movq %r14, %xmm2
punpckldq %xmm6, %xmm2    # xmm2 = xmm2[0],xmm6[0],xmm2[1],xmm6[1]
subpd %xmm3, %xmm2
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
divsd %xmm4, %xmm1
movsd 0xb0(%rsp), %xmm3
unpcklps %xmm6, %xmm3            # xmm3 = xmm3[0],xmm6[0],xmm3[1],xmm6[1]
subpd %xmm7, %xmm3
movapd %xmm3, %xmm2
unpckhpd %xmm3, %xmm2            # xmm2 = xmm2[1],xmm3[1]
addsd %xmm3, %xmm2
divsd %xmm4, %xmm2
movsd 0xb8(%rsp), %xmm5
unpcklps %xmm6, %xmm5            # xmm5 = xmm5[0],xmm6[0],xmm5[1],xmm6[1]
subpd %xmm7, %xmm5
movapd %xmm5, %xmm3
unpckhpd %xmm5, %xmm3            # xmm3 = xmm3[1],xmm5[1]
addsd %xmm5, %xmm3
divsd %xmm4, %xmm3
leaq 0x53be(%rip), %rsi      # 0x71cf
movb $0x4, %al
callq 0x1130
movq 0x48(%rsp), %rdx
movq 0x40(%rsp), %rcx
movq 0x98(%rsp), %r8
subl %edx, %r8d
subl %ecx, %r8d
movq 0xa539(%rip), %rdi      # 0xc370
movq 0x88(%rsp), %rax
movq %rax, %xmm1
movq 0x51c4(%rip), %xmm3     # 0x7010
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
movapd 0x51c8(%rip), %xmm4     # 0x7020
subpd %xmm4, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
cvtsi2sd %edx, %xmm1
divsd %xmm1, %xmm0
movq 0x80(%rsp), %rsi
movq %rsi, %xmm2
punpckldq %xmm3, %xmm2    # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
movdqa %xmm3, %xmm6
subpd %xmm4, %xmm2
movapd %xmm4, %xmm7
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
cvtsi2sd %ecx, %xmm2
divsd %xmm2, %xmm1
addq %rsi, %rax
subq %rax, %r12
movq %r12, %xmm3
punpckldq %xmm6, %xmm3    # xmm3 = xmm3[0],xmm6[0],xmm3[1],xmm6[1]
subpd %xmm4, %xmm3
movapd %xmm3, %xmm2
unpckhpd %xmm3, %xmm2            # xmm2 = xmm2[1],xmm3[1]
addsd %xmm3, %xmm2
cvtsi2sd %r8, %xmm4
divsd %xmm4, %xmm2
movslq %ecx, %rax
subq %rax, %r14
movq %r14, %xmm5
punpckldq %xmm6, %xmm5    # xmm5 = xmm5[0],xmm6[0],xmm5[1],xmm6[1]
subpd %xmm7, %xmm5
movapd %xmm5, %xmm3
unpckhpd %xmm5, %xmm3            # xmm3 = xmm3[1],xmm5[1]
addsd %xmm5, %xmm3
divsd %xmm4, %xmm3
leaq 0x5320(%rip), %rsi      # 0x7213
movb $0x4, %al
callq 0x1130
movq 0xa46f(%rip), %rdi      # 0xc370
leaq 0x5381(%rip), %rsi      # 0x7289
xorl %r14d, %r14d
movl %r13d, %edx
movl %ebx, %ecx
movl %ebp, %r8d
movl %r15d, %r9d
xorl %eax, %eax
callq 0x1130
movq 0xa44c(%rip), %rdi      # 0xc370
leaq 0x538d(%rip), %rsi      # 0x72b8
movl 0x34(%rsp), %edx
movl 0x30(%rsp), %ecx
movl 0x2c(%rsp), %r8d
xorl %eax, %eax
callq 0x1130
cmpq $0x4, %r14
je 0x1f65
andq $0x0, 0xc0(%rsp,%r14,8)
andl $0x0, 0x50(%rsp,%r14,4)
andl $0x0, 0x60(%rsp,%r14,4)
andl $0x0, 0x70(%rsp,%r14,4)
incq %r14
jmp 0x1f3f
movq 0x38(%rsp), %rax
movq (%rax), %rax
movl 0x40(%rax), %ecx
pushq $0x1
popq %rdx
cmpq %rcx, %rdx
ja 0x1fb0
movq 0x38(%rax), %rsi
movzbl (%rsi,%rdx), %esi
andl $0x3, %esi
movl %esi, %edi
incl 0x70(%rsp,%rdi,4)
movq 0x30(%rax), %rdi
movzwl (%rdi,%rdx,2), %edi
testq %rdi, %rdi
je 0x1fab
incl 0x60(%rsp,%rsi,4)
cmpl $0x1, %edi
je 0x1fab
incl 0x50(%rsp,%rsi,4)
addq %rdi, 0xc0(%rsp,%rsi,8)
incq %rdx
jmp 0x1f73
movq 0xa3b9(%rip), %rdi      # 0xc370
movl 0x60(%rsp), %eax
movl 0x64(%rsp), %ecx
cvtsi2sd %rax, %xmm0
movl 0x70(%rsp), %eax
movl 0x74(%rsp), %edx
cvtsi2sd %rax, %xmm4
divsd %xmm4, %xmm0
movl 0x50(%rsp), %eax
cvtsi2sd %rax, %xmm1
movl 0x54(%rsp), %eax
movsd 0xc0(%rsp), %xmm3
movsd 0x501c(%rip), %xmm13    # 0x7010
unpcklps %xmm13, %xmm3           # xmm3 = xmm3[0],xmm13[0],xmm3[1],xmm13[1]
movapd 0x501f(%rip), %xmm14    # 0x7020
subpd %xmm14, %xmm3
movapd %xmm3, %xmm2
unpckhpd %xmm3, %xmm2            # xmm2 = xmm2[1],xmm3[1]
addsd %xmm3, %xmm2
divsd %xmm1, %xmm2
cvtsi2sd %rcx, %xmm3
cvtsi2sd %rdx, %xmm6
divsd %xmm4, %xmm1
divsd %xmm6, %xmm3
cvtsi2sd %rax, %xmm4
movsd 0xc8(%rsp), %xmm7
unpcklps %xmm13, %xmm7           # xmm7 = xmm7[0],xmm13[0],xmm7[1],xmm13[1]
subpd %xmm14, %xmm7
movapd %xmm7, %xmm5
unpckhpd %xmm7, %xmm5            # xmm5 = xmm5[1],xmm7[1]
addsd %xmm7, %xmm5
divsd %xmm4, %xmm5
divsd %xmm6, %xmm4
movl 0x68(%rsp), %eax
cvtsi2sd %rax, %xmm6
movl 0x78(%rsp), %eax
cvtsi2sd %rax, %xmm9
divsd %xmm9, %xmm6
movl 0x58(%rsp), %eax
cvtsi2sd %rax, %xmm7
movsd 0xd0(%rsp), %xmm10
unpcklps %xmm13, %xmm10          # xmm10 = xmm10[0],xmm13[0],xmm10[1],xmm13[1]
subpd %xmm14, %xmm10
movapd %xmm10, %xmm8
unpckhpd %xmm10, %xmm8           # xmm8 = xmm8[1],xmm10[1]
addsd %xmm10, %xmm8
divsd %xmm7, %xmm8
movl 0x6c(%rsp), %eax
cvtsi2sd %rax, %xmm10
divsd %xmm9, %xmm7
movl 0x7c(%rsp), %eax
cvtsi2sd %rax, %xmm9
divsd %xmm9, %xmm10
movl 0x5c(%rsp), %eax
cvtsi2sd %rax, %xmm11
movsd 0xd8(%rsp), %xmm12
unpcklps %xmm13, %xmm12          # xmm12 = xmm12[0],xmm13[0],xmm12[1],xmm13[1]
subpd %xmm14, %xmm12
movapd %xmm12, %xmm13
unpckhpd %xmm12, %xmm13          # xmm13 = xmm13[1],xmm12[1]
addsd %xmm12, %xmm13
divsd %xmm11, %xmm13
divsd %xmm9, %xmm11
movsd %xmm11, 0x10(%rsp)
movsd %xmm10, 0x8(%rsp)
movsd %xmm13, 0x18(%rsp)
movsd %xmm8, (%rsp)
leaq 0x51d2(%rip), %rsi      # 0x72df
movb $0x8, %al
callq 0x1130
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8ecb(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x5009(%rip), %rdi      # 0x7140
pushq $0x1e
popq %rsi
pushq $0x1
popq %rdx
jmp 0x1230