// File: /workspace/github_c_makefile_star2_O0/richarddurbin[P]hash10x/moshasm.c
// Function: markBadReads
void markBadReads (Readset *rs)
{
  int ix ;
  Read *x, *x0 = arrp(rs->reads,0,Read) ;

  for (ix = 0, x = x0 ; ix < arrayMax(rs->reads) ; ++ix, ++x)
    x->bad = 0 ; /* initialise by clearing all bad flags */
  
  /* first pass through findOverlaps - set badOrder10 */
  int nBad = 0 ;
  for (ix = 0, x = x0 ; ix < arrayMax(rs->reads) ; ++ix, ++x)
    if (badOverlaps (rs, x) >= 10) { x->badOrder10 = 1 ; ++nBad ; }
  printf ("MB  %d with >=10 bad overlaps\n", nBad) ;

  /* second pass, set badOrder1 for all 2 or more - will remove some more singleton errors */
  nBad = 0 ;
  for (ix = 0, x = x0 ; ix < arrayMax(rs->reads) ; ++ix, ++x)
    if (badOverlaps (rs, x) > 1 && !x->badOrder10) { x->badOrder1 = 1 ; ++nBad ; }
  printf ("MB  %d with multiple bad overlaps\n", nBad) ;

  /* third pass, set badOrder1 for anything bad  - must be simple pairs - might be too harsh */
  nBad = 0 ;
  for (ix = 0, x = x0 ; ix < arrayMax(rs->reads) ; ++ix, ++x)
    if (badOverlaps (rs, x) > 0 && !x->badOrder10) { x->badOrder1 = 1 ; ++nBad ; }
  printf ("MB  %d with single bad overlaps\n", nBad) ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %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, -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 0x34dc
movq -0x18(%rbp), %rax
movb $0x0, 0x18(%rax)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x18(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x18(%rbp)
jmp 0x34ad
movl $0x0, -0x24(%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 0x3546
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x33e0
cmpl $0xa, %eax
jl 0x352d
movq -0x18(%rbp), %rax
movb 0x18(%rax), %cl
andb $-0x3, %cl
orb $0x2, %cl
movb %cl, 0x18(%rax)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x352f
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x18(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x18(%rbp)
jmp 0x34f2
movl -0x24(%rbp), %esi
leaq 0x7eef(%rip), %rdi      # 0xb43f
movb $0x0, %al
callq 0x10b0
movl $0x0, -0x24(%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 0x35d0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x33e0
cmpl $0x1, %eax
jle 0x35b7
movq -0x18(%rbp), %rax
movb 0x18(%rax), %al
shrb %al
andb $0x1, %al
cmpb $0x0, %al
jne 0x35b7
movq -0x18(%rbp), %rax
movb 0x18(%rax), %cl
andb $-0x5, %cl
orb $0x4, %cl
movb %cl, 0x18(%rax)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x35b9
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x18(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x18(%rbp)
jmp 0x356d
movl -0x24(%rbp), %esi
leaq 0x7e84(%rip), %rdi      # 0xb45e
movb $0x0, %al
callq 0x10b0
movl $0x0, -0x24(%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 0x365a
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x33e0
cmpl $0x0, %eax
jle 0x3641
movq -0x18(%rbp), %rax
movb 0x18(%rax), %al
shrb %al
andb $0x1, %al
cmpb $0x0, %al
jne 0x3641
movq -0x18(%rbp), %rax
movb 0x18(%rax), %cl
andb $-0x5, %cl
orb $0x4, %cl
movb %cl, 0x18(%rax)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3643
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x18(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x18(%rbp)
jmp 0x35f7
movl -0x24(%rbp), %esi
leaq 0x7e1d(%rip), %rdi      # 0xb481
movb $0x0, %al
callq 0x10b0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)