// File: /workspace/github_c_makefile_star2_O0/richarddurbin[P]hash10x/moshasm.c
// Function: markContained
void markContained (Readset *rs) 
{
  int ix, io ;
  Read *x, *x0 = arrp(rs->reads,0,Read) ;
  int nContained = 0, nNotContained = 0 ;
  U64 totLen = 0 ;
  Array overlaps = 0 ;
  
  for (ix = 0, x = x0 ; ix < arrayMax(rs->reads) ; ++ix, ++x)
    { if (overlaps) { arrayDestroy (overlaps) ; overlaps = 0 ; }
      if (x->bad) continue ;
      overlaps = findOverlaps (rs, x, 0) ;
      int maxHit = 0 ;
      for (io = 0 ; io < arrayMax (overlaps) ; ++io)
	{ Overlap *o = arrp(overlaps,io,Overlap) ;
	  if (o->iy == ix) continue ; /* don't allow self-containment! */
	  Read *y = arrp(rs->reads,o->iy,Read) ;
	  if (y->len < x->len || o->nHit <= maxHit) continue ;
	  if (o->isPlus && (o->offset > 0 || o->offset + y->len < x->len)) continue ;
	  if (!o->isPlus && (o->offset < x->len || o->offset - y->len > 0)) continue ;
	  x->contained = o->iy ; maxHit = o->nHit ;
	}
      if (x->contained) ++nContained ; else { ++nNotContained ; totLen += x->len ; }
    }
  printf ("MC  found %d contained reads, leaving %d not contained, av length %.1f\n",
	  nContained, nNotContained, nNotContained ? totLen/(double)nNotContained : 0.) ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x8(%rcx), %rcx
imull $0x0, 0x14(%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x18(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
movq 0x8(%rcx), %rcx
cmpl 0x18(%rcx), %eax
jge 0x3880
cmpq $0x0, -0x38(%rbp)
je 0x3707
movq -0x38(%rbp), %rdi
callq 0x9420
movq $0x0, -0x38(%rbp)
movq -0x18(%rbp), %rax
cmpb $0x0, 0x18(%rax)
je 0x3716
jmp 0x3866
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x2740
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x3837
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x10(%rbp), %ecx
movq -0x38(%rbp), %rdx
imull 0x14(%rdx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movl (%rax), %eax
cmpl -0xc(%rbp), %eax
jne 0x3774
jmp 0x3829
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq -0x48(%rbp), %rcx
movl (%rcx), %ecx
movq -0x8(%rbp), %rdx
movq 0x8(%rdx), %rdx
imull 0x14(%rdx), %ecx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movl (%rax), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jl 0x37b5
movq -0x48(%rbp), %rax
movl 0x4(%rax), %eax
cmpl -0x3c(%rbp), %eax
jg 0x37b7
jmp 0x3829
movq -0x48(%rbp), %rax
movsbl 0xc(%rax), %eax
cmpl $0x0, %eax
je 0x37e5
movq -0x48(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jg 0x37e3
movq -0x48(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x50(%rbp), %rcx
addl (%rcx), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x37e5
jmp 0x3829
movq -0x48(%rbp), %rax
cmpb $0x0, 0xc(%rax)
jne 0x3812
movq -0x48(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jl 0x3810
movq -0x48(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x50(%rbp), %rcx
subl (%rcx), %eax
cmpl $0x0, %eax
jle 0x3812
jmp 0x3829
movq -0x48(%rbp), %rax
movl (%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x48(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x3c(%rbp)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x3737
movq -0x18(%rbp), %rax
cmpl $0x0, 0x20(%rax)
je 0x384c
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3864
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movslq (%rax), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x3866
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x18(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x18(%rbp)
jmp 0x36db
movl -0x24(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0x38c9
movaps 0x7777(%rip), %xmm1     # 0xb010
movq -0x30(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x7776(%rip), %xmm1     # 0xb020
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
cvtsi2sdl -0x28(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
jmp 0x38d3
xorps %xmm0, %xmm0
movsd %xmm0, -0x60(%rbp)
jmp 0x38d3
movl -0x54(%rbp), %edx
movl -0x58(%rbp), %esi
movsd -0x60(%rbp), %xmm0
leaq 0x7bbd(%rip), %rdi      # 0xb4a2
movb $0x1, %al
callq 0x10b0
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)