// File: /workspace/github_c_makefile_star2_O0/richarddurbin[P]hash10x/moshasm.c
// Function: readsetFileRead
void readsetFileRead (Readset *rs, char *filename)
{
  char *seq ;			/* ignore the name for now */
  int len ;
  Array hitsA = arrayCreate (1024, U32) ; /* reuse these to build the lists of hits and dx */
  Array dxA = arrayCreate (1024, U16) ;

  memset (rs->ms->depth, 0, (rs->ms->max+1)*sizeof(U16)) ; /* rebuild depth from this file */
  dna2indexConv['N'] = dna2indexConv['n'] = 0 ; /* to get 2-bit encoding */
  SeqIO *si = seqIOopen (filename, dna2indexConv, FALSE) ;
  while (seqIOread (si))
    { Read *read = arrayp(rs->reads, arrayMax(rs->reads), Read) ;
      read->len = si->seqLen ;
      SeqhashRCiterator *mi = moshRCiterator (rs->ms->hasher, sqioSeq(si), si->seqLen) ;
      hitsA = arrayReCreate (hitsA, 1024, U32) ;
      dxA = arrayReCreate (dxA, 1024, U16) ;
      U64 hash ; int lastPos = 0, pos ; BOOL isForward ;
      while (moshRCnext (mi, &hash, &pos, &isForward))
	{ U32 index = moshsetIndexFind (rs->ms, hash, FALSE) ;
	  if (index)
	    { array(hitsA,read->nHit,U32) = isForward ? (index | TOPBIT) : index ;
	      array(dxA,read->nHit,U16) = pos - lastPos ; lastPos = pos ;
	      ++read->nHit ;
	      U16 *di = &rs->ms->depth[index] ; ++*di ; if (!*di) *di = U16MAX ;
	    }
	  else ++read->nMiss ;
	}
      seqhashRCiteratorDestroy (mi) ;
      if (read->nHit)
	{ read->hit = new (read->nHit, U32) ;
	  memcpy (read->hit, arrp(hitsA,0,U32), read->nHit*sizeof(U32)) ;
	  read->dx = new(read->nHit,U16) ;
	  memcpy (read->dx, arrp(dxA,0,U16), read->nHit*sizeof(U16)) ;
	  rs->totHit += read->nHit ;
	}
    }
  seqIOclose (si) ;

  invBuild (rs) ;
  arrayDestroy (hitsA) ; arrayDestroy (dxA) ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x400, %edi            # imm = 0x400
movl $0x4, %esi
callq 0x9220
movq %rax, -0x28(%rbp)
movl $0x400, %edi            # imm = 0x400
movl $0x2, %esi
callq 0x9220
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x40(%rax), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %edx
shlq %rdx
xorl %esi, %esi
callq 0x10d0
leaq 0xdb5a(%rip), %rax      # 0xf750
movl $0x0, 0x1b8(%rax)
leaq 0xdb49(%rip), %rax      # 0xf750
movl $0x0, 0x138(%rax)
movq -0x10(%rbp), %rdi
leaq 0xdb34(%rip), %rsi      # 0xf750
xorl %edx, %edx
callq 0x49f0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x4d00
cmpb $0x0, %al
je 0x1ea6
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x18(%rax), %esi
callq 0x9680
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x1c86
movq -0x38(%rbp), %rax
movq 0x70(%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0x1c9d
movq -0x38(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x38(%rbp), %rcx
movslq 0x24(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq -0x38(%rbp), %rax
movl 0x18(%rax), %edx
callq 0x6bf0
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
movl $0x4, %edx
callq 0x92f0
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
movl $0x2, %edx
callq 0x92f0
movq %rax, -0x30(%rbp)
movl $0x0, -0x54(%rbp)
movq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x58(%rbp), %rdx
leaq -0x59(%rbp), %rcx
callq 0x6e10
cmpb $0x0, %al
je 0x1de4
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x7350
movl %eax, -0x60(%rbp)
cmpl $0x0, -0x60(%rbp)
je 0x1dd2
movsbl -0x59(%rbp), %eax
cmpl $0x0, %eax
je 0x1d3c
movl -0x60(%rbp), %eax
orl $0x80000000, %eax       # imm = 0x80000000
movl %eax, -0x7c(%rbp)
jmp 0x1d42
movl -0x60(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, -0x84(%rbp)
movq -0x28(%rbp), %rdi
movq -0x40(%rbp), %rax
movl 0x4(%rax), %esi
callq 0x9680
movl -0x84(%rbp), %ecx
movl %ecx, (%rax)
movl -0x58(%rbp), %eax
subl -0x54(%rbp), %eax
movw %ax, -0x7e(%rbp)
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rax
movl 0x4(%rax), %esi
callq 0x9680
movw -0x7e(%rbp), %cx
movw %cx, (%rax)
movl -0x58(%rbp), %eax
movl %eax, -0x54(%rbp)
movq -0x40(%rbp), %rax
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %rax
movl -0x60(%rbp), %ecx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movw (%rax), %cx
addw $0x1, %cx
movw %cx, (%rax)
movq -0x68(%rbp), %rax
cmpw $0x0, (%rax)
jne 0x1dd0
movq -0x68(%rbp), %rax
movw $0xffff, (%rax)         # imm = 0xFFFF
jmp 0x1ddf
movq -0x40(%rbp), %rax
movl 0x1c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x1c(%rax)
jmp 0x1cea
movq -0x48(%rbp), %rdi
callq 0x1ee0
movq -0x40(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0x1ea1
movq -0x40(%rbp), %rax
movslq 0x4(%rax), %rdi
shlq $0x2, %rdi
callq 0xa1e0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x28(%rbp), %rax
imull $0x0, 0x14(%rax), %eax
cltq
addq %rax, %rsi
movq -0x40(%rbp), %rax
movslq 0x4(%rax), %rdx
shlq $0x2, %rdx
callq 0x1140
movq -0x40(%rbp), %rax
movslq 0x4(%rax), %rdi
shlq %rdi
callq 0xa1e0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x30(%rbp), %rax
imull $0x0, 0x14(%rax), %eax
cltq
addq %rax, %rsi
movq -0x40(%rbp), %rax
movslq 0x4(%rax), %rdx
shlq %rdx
callq 0x1140
movq -0x40(%rbp), %rax
movslq 0x4(%rax), %rcx
movq -0x8(%rbp), %rax
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
jmp 0x1c27
movq -0x38(%rbp), %rdi
callq 0x4c90
movq -0x8(%rbp), %rdi
callq 0x18e0
movq -0x28(%rbp), %rdi
callq 0x9420
movq -0x30(%rbp), %rdi
callq 0x9420
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)