// File: /workspace/github_c_makefile_star2_O1/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq 0x8(%rdi), %rax
movl 0x18(%rax), %ebx
movl %ebx, %eax
decl %eax
je 0x2cb7
movq %rdi, %r14
movq %rax, 0xa0(%rsp)
movq (%rdi), %rdi
movq 0xad25(%rip), %rsi      # 0xd370
callq 0x56c7
xorps %xmm0, %xmm0
movaps %xmm0, 0xe0(%rsp)
movaps %xmm0, 0xd0(%rsp)
movq %r14, 0xa8(%rsp)
movq 0x8(%r14), %rcx
movq 0x8(%rcx), %rax
movl 0x14(%rcx), %ecx
cmpl $0x3, %ebx
movl $0x2, %edx
cmovael %ebx, %edx
leaq 0x24(%rax), %rsi
movq $0x0, 0x48(%rsp)
movl $0x1, %edi
movl %ecx, %r8d
movl $0x0, 0x34(%rsp)
movl $0x0, 0x30(%rsp)
movl $0x0, 0x2c(%rsp)
movl $0x0, 0x28(%rsp)
movl $0x0, 0x24(%rsp)
xorl %r14d, %r14d
movq $0x0, 0x88(%rsp)
movq $0x0, 0x90(%rsp)
xorl %r12d, %r12d
xorl %ebp, %ebp
movq $0x0, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
movl %r8d, %r13d
addq %rsi, %r13
movl %ecx, %r11d
imull %edi, %r11d
movslq (%rax,%r11), %r10
movslq 0x1c(%rax,%r11), %r9
xorl %ebx, %ebx
movslq (%r13,%rbx,4), %r15
addq %r15, 0xd0(%rsp,%rbx,8)
incq %rbx
cmpq $0x4, %rbx
jne 0x2708
movl 0x28(%rax,%r11), %ebx
cmpl $0x1, %ebx
je 0x2742
testl %ebx, %ebx
jne 0x2756
movq 0x40(%rsp), %rbx
incl %ebx
movq %rbx, 0x40(%rsp)
addq %r10, 0x90(%rsp)
jmp 0x2756
movq 0x38(%rsp), %rbx
incl %ebx
movq %rbx, 0x38(%rsp)
addq %r10, 0x88(%rsp)
movzbl 0x18(%rax,%r11), %r11d
testl %r11d, %r11d
je 0x27a9
incl %r14d
movl %r11d, %ebx
andl $0x1, %ebx
addl %ebx, 0x24(%rsp)
btl $0x1, %r11d
adcl $0x0, 0x28(%rsp)
btl $0x2, %r11d
adcl $0x0, 0x2c(%rsp)
btl $0x3, %r11d
adcl $0x0, 0x30(%rsp)
btl $0x4, %r11d
adcl $0x0, 0x34(%rsp)
btl $0x5, %r11d
movq 0x48(%rsp), %r11
adcl $0x0, %r11d
movq %r11, 0x48(%rsp)
addq %r10, %rbp
addq %r9, %r12
incq %rdi
addl %ecx, %r8d
cmpq %rdx, %rdi
jne 0x26f0
movq 0xabab(%rip), %rdi      # 0xd370
movq %rbp, %xmm0
punpckldq 0x583e(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x5846(%rip), %xmm0     # 0x8020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0xf0(%rsp)
movq 0xa0(%rsp), %r15
movl %r15d, %eax
cvtsi2sd %rax, %xmm2
movsd %xmm2, 0x98(%rsp)
movapd %xmm1, %xmm0
divsd %xmm2, %xmm0
leaq 0x5946(%rip), %rsi      # 0x815d
movl %r15d, %edx
movq %rbp, %rcx
movb $0x1, %al
callq 0x1130
movq 0xab45(%rip), %rdi      # 0xd370
movq 0xa8(%rsp), %rbx
movq 0x10(%rbx), %rdx
movq %rdx, %xmm0
movq 0x57cc(%rip), %xmm1     # 0x8010
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x57d0(%rip), %xmm3     # 0x8020
subpd %xmm3, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
movapd 0xf0(%rsp), %xmm0
divsd %xmm2, %xmm0
addq %rdx, %r12
movq %r12, %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 0x98(%rsp), %xmm2
leaq 0x58ea(%rip), %rsi      # 0x818b
movb $0x3, %al
callq 0x1130
movq 0xaac1(%rip), %rdi      # 0xd370
movsd 0xd0(%rsp), %xmm1
movsd 0x5750(%rip), %xmm2     # 0x8010
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x5755(%rip), %xmm3     # 0x8020
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movsd 0x10(%rbx), %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 0xd8(%rsp), %r12
movq %r12, %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 0xe0(%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 0xe8(%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 0x5862(%rip), %rsi      # 0x81cd
movb $0x4, %al
callq 0x1130
movq 0x40(%rsp), %rdx
movq 0x38(%rsp), %rcx
subl %edx, %r15d
subl %ecx, %r15d
movq 0xa9e7(%rip), %rdi      # 0xd370
movq 0x90(%rsp), %rax
movq %rax, %xmm1
movq 0x5672(%rip), %xmm3     # 0x8010
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
movapd 0x5676(%rip), %xmm4     # 0x8020
subpd %xmm4, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %edx, %xmm1
divsd %xmm1, %xmm0
movq 0x88(%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
xorps %xmm2, %xmm2
cvtsi2sd %ecx, %xmm2
divsd %xmm2, %xmm1
addq %rsi, %rax
subq %rax, %rbp
movq %rbp, %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
xorps %xmm4, %xmm4
cvtsi2sd %r15, %xmm4
divsd %xmm4, %xmm2
movslq %ecx, %rcx
subq %rcx, %r12
movq %r12, %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 0x57c3(%rip), %rsi      # 0x8211
movl %r15d, %r8d
movb $0x4, %al
callq 0x1130
movq 0xa911(%rip), %rdi      # 0xd370
leaq 0x5821(%rip), %rsi      # 0x8287
movl %r14d, %edx
movl 0x24(%rsp), %ecx
movl 0x28(%rsp), %r8d
movl 0x2c(%rsp), %r9d
xorl %eax, %eax
callq 0x1130
movq 0xa8eb(%rip), %rdi      # 0xd370
leaq 0x582a(%rip), %rsi      # 0x82b6
movl 0x30(%rsp), %edx
movl 0x34(%rsp), %ecx
movq 0x48(%rsp), %r8
xorl %eax, %eax
callq 0x1130
xorpd %xmm0, %xmm0
movapd %xmm0, 0xc0(%rsp)
movapd %xmm0, 0xb0(%rsp)
movapd %xmm0, 0x50(%rsp)
movapd %xmm0, 0x60(%rsp)
movapd %xmm0, 0x70(%rsp)
movq (%rbx), %rcx
movl 0x40(%rcx), %esi
testl %esi, %esi
je 0x2b24
movq 0x30(%rcx), %rax
movq 0x38(%rcx), %rcx
incl %esi
cmpl $0x3, %esi
movl $0x2, %edx
cmovael %esi, %edx
movl $0x1, %esi
movzbl (%rcx,%rsi), %edi
andl $0x3, %edi
movl %edi, %r8d
incl 0x70(%rsp,%r8,4)
movzwl (%rax,%rsi,2), %r8d
testq %r8, %r8
je 0x2b09
incl 0x60(%rsp,%rdi,4)
cmpw $0x2, %r8w
jb 0x2b1c
incl 0x50(%rsp,%rdi,4)
addq %r8, 0xb0(%rsp,%rdi,8)
incq %rsi
cmpq %rsi, %rdx
jne 0x2aec
movq 0xa845(%rip), %rdi      # 0xd370
movl 0x60(%rsp), %eax
movl 0x64(%rsp), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movl 0x70(%rsp), %eax
movl 0x74(%rsp), %edx
xorps %xmm4, %xmm4
cvtsi2sd %rax, %xmm4
divsd %xmm4, %xmm0
movl 0x50(%rsp), %eax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
movl 0x54(%rsp), %eax
movsd 0xb0(%rsp), %xmm3
movsd 0x549f(%rip), %xmm13    # 0x8010
unpcklps %xmm13, %xmm3           # xmm3 = xmm3[0],xmm13[0],xmm3[1],xmm13[1]
movapd 0x54a2(%rip), %xmm14    # 0x8020
subpd %xmm14, %xmm3
movapd %xmm3, %xmm2
unpckhpd %xmm3, %xmm2            # xmm2 = xmm2[1],xmm3[1]
addsd %xmm3, %xmm2
divsd %xmm1, %xmm2
xorps %xmm3, %xmm3
cvtsi2sd %rcx, %xmm3
cvtsi2sd %rdx, %xmm6
divsd %xmm4, %xmm1
divsd %xmm6, %xmm3
xorps %xmm4, %xmm4
cvtsi2sd %rax, %xmm4
movsd 0xb8(%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
xorps %xmm6, %xmm6
cvtsi2sd %rax, %xmm6
movl 0x78(%rsp), %eax
cvtsi2sd %rax, %xmm9
divsd %xmm9, %xmm6
movl 0x58(%rsp), %eax
xorps %xmm7, %xmm7
cvtsi2sd %rax, %xmm7
movsd 0xc0(%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
xorps %xmm10, %xmm10
cvtsi2sd %rax, %xmm10
divsd %xmm9, %xmm7
movl 0x7c(%rsp), %eax
xorps %xmm9, %xmm9
cvtsi2sd %rax, %xmm9
divsd %xmm9, %xmm10
movl 0x5c(%rsp), %eax
cvtsi2sd %rax, %xmm11
movsd 0xc8(%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 0x563f(%rip), %rsi      # 0x82dd
movb $0x8, %al
callq 0x1130
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x13ea
jmp 0x2ca5