// File: /workspace/github_c_makefile_star2_O3/richarddurbin[P]hash10x/seqio.c
// Function: seqIOread
BOOL seqIOread (SeqIO *si)
{
  if (!si->nb) return FALSE ;
  si->recStart = si->b - si->buf ;
  
  if (si->type == BINARY)
    { bufConfirmNbytes (si, 3*sizeof(int)) ;
      si->idLen = *((int*)si->b) ; si->b += sizeof(int) ;
      si->descLen = *((int*)si->b) ; si->b += sizeof(int) ;
      si->seqLen = *((int*)si->b) ; si->b += sizeof(int) ;
      si->nb -= 3*sizeof(int) ;
      int nBytes = si->idLen+1 + si->descLen+1
	+ (si->seqLen+3)/4 + si->isQual ? (si->seqLen+7)/8 : 0 ;
      nBytes = 4*((nBytes+3)/4) ;
      bufConfirmNbytes (si, nBytes) ;
      si->idStart = si->b - si->buf ;
      si->descStart = si->idStart + si->idLen+1 ;
      if (si->seqLen > si->seqBufSize)
	{ if (si->seqBufSize) { free (si->seqBuf) ; if (si->isQual) free (si->qualBuf) ; }
	  si->seqBufSize = 1 << 20 ; while (si->seqBufSize < si->seqLen) si->seqBufSize <<= 1 ;
	  si->seqBuf = new (si->seqBufSize, char) ;
	  if (si->isQual) si->qualBuf = new (si->seqBufSize, char) ;
	}
      si->seqStart = si->descStart + si->descLen+1 ;
      sqioSeqUnpack ((U8*)(si->buf+si->seqStart), si->seqBuf, si->seqLen) ;
      if (si->isQual)
	{ si->qualStart = si->seqStart + (si->seqLen+3)/4 ;
	  sqioQualUnpack ((U8*)(si->buf+si->qualStart), si->qualBuf, si->seqLen, si->qualThresh) ;
	}
      ++si->nSeq ;
      si->b += nBytes ; si->nb -= nBytes ;
      return TRUE ;
    }

  /* if get to here then this is a text file, FASTA or FASTQ */
  
  if (si->type == FASTA)
    { if (*si->b != '>') die ("no initial > for FASTA record line %d", si->line) ; }
  else if (si->type == FASTQ)
    { if (*si->b != '@') die ("no initial @ for FASTQ record line %d", si->line) ; }
  bufAdvanceInRecord(si) ; si->idStart = si->b - si->buf ;
  while (!isspace(*si->b)) bufAdvanceInRecord(si) ;
  si->idLen = si->b - sqioId(si) ;
  if (*si->b != '\n') /* a space or tab - whatever follows on this line is description */
    { *si->b = 0 ; bufAdvanceInRecord(si) ;
      si->descStart = si->b - si->buf ;
      while (*si->b != '\n') bufAdvanceInRecord(si) ;
      si->descLen = si->b - sqioDesc(si) ;
    }
  else { si->descLen = si->descStart = 0 ; }
  *si->b = 0 ;
  ++si->line ; bufAdvanceInRecord(si) ;	              /* line 2 */
  si->seqStart = si->b - si->buf ;
  if (si->type == FASTA)
    { while (si->nb && *si->b != '>')
	{ while (*si->b != '\n') bufAdvanceInRecord(si) ;
	  ++si->line ; bufAdvanceEndRecord(si) ;
	}
      char *s = sqioSeq(si), *t = s ;
      while (s < si->b) if ((*t++ = si->convert[*s++]) < 0) --t ;
      si->seqLen = t - sqioSeq(si) ;
    }
  else if (si->type == FASTQ)
    { while (*si->b != '\n') bufAdvanceInRecord(si) ;
      si->seqLen = si->b - sqioSeq(si) ;
      if (si->convert)
	{ char *s = sqioSeq(si) ;
	  while (s < si->b) { *s = si->convert[*s] ; ++s ; }
	}
      ++si->line ; bufAdvanceInRecord(si) ; 	      /* line 3 */
      if (*si->b != '+') die ("missing + FASTQ line %d", si->line) ;
      while (*si->b != '\n') bufAdvanceInRecord(si) ; /* ignore remainder of + line */
      ++si->line ; bufAdvanceInRecord(si) ;	      /* line 4 */
      si->qualStart = si->b - si->buf ;
      while (*si->b != '\n') bufAdvanceInRecord(si) ;
      if (si->b - si->buf - si->qualStart != si->seqLen)
	die ("qual not same length as seq line %d", si->line) ;
      if (si->isQual) { char *q = sqioQual(si), *e = q + si->seqLen ; while (q < e) *q++ -= 33 ; }
      ++si->line ; bufAdvanceEndRecord(si) ;
    }

  ++si->nSeq ;
  return TRUE ;
}

// Assembly:
movl 0x38(%rdi), %eax
testl %eax, %eax
je 0x2c4a
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x58(%rdi), %rcx
movl 0x50(%rdi), %esi
movl %ecx, %edx
subl %esi, %edx
movl %edx, 0x40(%rdi)
movl (%rdi), %esi
testl %esi, %esi
je 0x2c5b
cmpl $0x1, %esi
je 0x2c4d
cmpl $0x2, %esi
jne 0x2c71
cmpl $0xb, %eax
ja 0x2aae
testl %edx, %edx
je 0x2aae
movq %rbx, %rdi
callq 0x32cb
movl 0x38(%rbx), %eax
movq 0x58(%rbx), %rcx
cmpl $0xb, %eax
ja 0x2adc
movslq 0x34(%rbx), %rax
addq 0x50(%rbx), %rax
cmpq %rax, %rcx
jne 0x30b4
movq %rbx, %rdi
callq 0x3326
movl 0x38(%rbx), %eax
cmpl $0xc, %eax
jb 0x30b4
movq 0x58(%rbx), %rcx
movl (%rcx), %esi
movl %esi, 0x10(%rbx)
movl 0x4(%rcx), %edi
movl %edi, 0x14(%rbx)
movl 0x8(%rcx), %edx
movl %edx, 0x18(%rbx)
addq $0xc, %rcx
movq %rcx, 0x58(%rbx)
addl $-0xc, %eax
movl %eax, 0x38(%rbx)
leal 0x3(%rdx), %ecx
leal 0x6(%rdx), %r8d
testl %ecx, %ecx
cmovnsl %ecx, %r8d
sarl $0x2, %r8d
addl %edi, %esi
leal (%r8,%rsi), %ecx
addl $0x2, %ecx
movsbl 0x2c(%rbx), %esi
xorl %ebp, %ebp
addl %ecx, %esi
je 0x2b3d
leal 0x7(%rdx), %ecx
addl $0xe, %edx
testl %ecx, %ecx
cmovnsl %ecx, %edx
sarl $0x3, %edx
leal 0x3(%rdx), %ecx
addl $0x6, %edx
testl %ecx, %ecx
cmovnsl %ecx, %edx
andl $-0x4, %edx
movl %edx, %ebp
cmpl %ebp, %eax
jge 0x2b52
cmpl $0x0, 0x40(%rbx)
je 0x2b52
movq %rbx, %rdi
callq 0x32cb
movl 0x38(%rbx), %eax
cmpl %ebp, %eax
jge 0x2b6f
movslq 0x34(%rbx), %rcx
addq 0x50(%rbx), %rcx
cmpq %rcx, 0x58(%rbx)
jne 0x2b6f
movq %rbx, %rdi
callq 0x3326
movl 0x38(%rbx), %eax
cmpl %ebp, %eax
jl 0x30c1
movl 0x58(%rbx), %eax
subl 0x50(%rbx), %eax
movl %eax, 0x1c(%rbx)
movl 0x10(%rbx), %ecx
movl 0x18(%rbx), %edx
addl %ecx, %eax
incl %eax
movl %eax, 0x20(%rbx)
movl 0x68(%rbx), %eax
cmpl %eax, %edx
jle 0x2be3
testl %eax, %eax
je 0x2bb0
movq 0x70(%rbx), %rdi
callq 0x1040
cmpb $0x0, 0x2c(%rbx)
je 0x2bb0
movq 0x78(%rbx), %rdi
callq 0x1040
movl 0x18(%rbx), %eax
movl $0x100000, %edx         # imm = 0x100000
movl %edx, %ecx
leal (%rcx,%rcx), %edx
cmpl %eax, %ecx
jl 0x2bb8
movl %ecx, 0x68(%rbx)
movslq %ecx, %rdi
callq 0x5a3c
movq %rax, 0x70(%rbx)
cmpb $0x0, 0x2c(%rbx)
je 0x2be3
movslq 0x68(%rbx), %rdi
callq 0x5a3c
movq %rax, 0x78(%rbx)
movl 0x20(%rbx), %eax
movl 0x14(%rbx), %ecx
movl 0x18(%rbx), %edx
addl %ecx, %eax
incl %eax
movl %eax, 0x24(%rbx)
movslq %eax, %rdi
addq 0x50(%rbx), %rdi
movq 0x70(%rbx), %rsi
callq 0x3381
cmpb $0x0, 0x2c(%rbx)
je 0x2c37
movslq 0x24(%rbx), %rax
movl 0x18(%rbx), %edx
leal 0x3(%rdx), %ecx
leal 0x6(%rdx), %esi
testl %ecx, %ecx
cmovnsl %ecx, %esi
movl 0x30(%rbx), %ecx
sarl $0x2, %esi
movslq %esi, %rdi
addq %rax, %rdi
movl %edi, 0x28(%rbx)
addq 0x50(%rbx), %rdi
movq 0x78(%rbx), %rsi
callq 0x33d2
incq 0x8(%rbx)
movslq %ebp, %rax
addq %rax, 0x58(%rbx)
subl %ebp, 0x38(%rbx)
jmp 0x329a
xorl %eax, %eax
retq
cmpb $0x40, (%rcx)
je 0x2c71
leaq 0x3cc0(%rip), %rdi      # 0x6919
jmp 0x2c67
cmpb $0x3e, (%rcx)
je 0x2c71
leaq 0x3c8c(%rip), %rdi      # 0x68f3
movl 0x3c(%rbx), %esi
xorl %eax, %eax
callq 0x5974
movq 0x58(%rbx), %r15
incq %r15
movq %r15, 0x58(%rbx)
movl 0x38(%rbx), %ebp
decl %ebp
movl %ebp, 0x38(%rbx)
jne 0x2cba
cmpl $0x0, 0x40(%rbx)
je 0x2c96
movq %rbx, %rdi
callq 0x32cb
jmp 0x2cab
movslq 0x34(%rbx), %rax
addq 0x50(%rbx), %rax
cmpq %rax, %r15
jne 0x2cab
movq %rbx, %rdi
callq 0x3326
movl 0x38(%rbx), %ebp
testl %ebp, %ebp
je 0x309a
movq 0x58(%rbx), %r15
movq 0x50(%rbx), %r12
movl %r15d, %r13d
subl %r12d, %r13d
movl %r13d, 0x1c(%rbx)
callq 0x1240
movq %rax, %r14
movq (%rax), %rax
movsbq (%r15), %rcx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x2d36
incq %r15
movq %r15, 0x58(%rbx)
decl %ebp
movl %ebp, 0x38(%rbx)
jne 0x2d20
cmpl $0x0, 0x40(%rbx)
je 0x2cfc
movq %rbx, %rdi
callq 0x32cb
jmp 0x2d11
movslq 0x34(%rbx), %rax
addq 0x50(%rbx), %rax
cmpq %rax, %r15
jne 0x2d11
movq %rbx, %rdi
callq 0x3326
movl 0x38(%rbx), %ebp
testl %ebp, %ebp
je 0x30ce
movq 0x58(%rbx), %r15
movq (%r14), %rax
movsbq (%r15), %rcx
testb $0x20, 0x1(%rax,%rcx,2)
je 0x2cde
movq 0x50(%rbx), %r12
movl 0x1c(%rbx), %r13d
addl %r13d, %r12d
movl %r15d, %eax
subl %r12d, %eax
movl %eax, 0x10(%rbx)
cmpb $0xa, (%r15)
jne 0x2d56
movl $0x0, 0x20(%rbx)
xorl %eax, %eax
jmp 0x2e0b
movb $0x0, (%r15)
movq 0x58(%rbx), %r15
incq %r15
movq %r15, 0x58(%rbx)
movl 0x38(%rbx), %eax
decl %eax
movl %eax, 0x38(%rbx)
jne 0x2da3
cmpl $0x0, 0x40(%rbx)
je 0x2d7f
movq %rbx, %rdi
callq 0x32cb
jmp 0x2d94
movslq 0x34(%rbx), %rax
addq 0x50(%rbx), %rax
cmpq %rax, %r15
jne 0x2d94
movq %rbx, %rdi
callq 0x3326
movl 0x38(%rbx), %eax
testl %eax, %eax
je 0x30db
movq 0x58(%rbx), %r15
movq 0x50(%rbx), %rcx
movl %r15d, %edx
subl %ecx, %edx
movl %edx, 0x20(%rbx)
cmpb $0xa, (%r15)
je 0x2e04
incq %r15
movq %r15, 0x58(%rbx)
decl %eax
movl %eax, 0x38(%rbx)
jne 0x2df7
cmpl $0x0, 0x40(%rbx)
je 0x2dd3
movq %rbx, %rdi
callq 0x32cb
jmp 0x2de8
movslq 0x34(%rbx), %rax
addq 0x50(%rbx), %rax
cmpq %rax, %r15
jne 0x2de8
movq %rbx, %rdi
callq 0x3326
movl 0x38(%rbx), %eax
testl %eax, %eax
je 0x30f5
movq 0x58(%rbx), %r15
cmpb $0xa, (%r15)
jne 0x2db5
movq 0x50(%rbx), %rcx
movl 0x20(%rbx), %edx
addl %edx, %ecx
movl %r15d, %eax
subl %ecx, %eax
movl %eax, 0x14(%rbx)
movb $0x0, (%r15)
movq 0x58(%rbx), %rcx
incq %rcx
movq %rcx, 0x58(%rbx)
movq 0x38(%rbx), %xmm0
paddd 0x3a36(%rip), %xmm0     # 0x6860
leaq 0x3c(%rbx), %r14
movq %xmm0, 0x38(%rbx)
movd %xmm0, %eax
testl %eax, %eax
jne 0x2e6f
cmpl $0x0, 0x40(%rbx)
je 0x2e4b
movq %rbx, %rdi
callq 0x32cb
jmp 0x2e60
movslq 0x34(%rbx), %rax
addq 0x50(%rbx), %rax
cmpq %rax, %rcx
jne 0x2e60
movq %rbx, %rdi
callq 0x3326
movl 0x38(%rbx), %eax
testl %eax, %eax
je 0x30a7
movq 0x58(%rbx), %rcx
movl 0x50(%rbx), %edx
movl %ecx, %esi
subl %edx, %esi
movl %esi, 0x24(%rbx)
movl (%rbx), %edx
testl %edx, %edx
je 0x2eea
cmpl $0x1, %edx
jne 0x3296
cmpb $0xa, (%rcx)
je 0x2f94
incq %rcx
movq %rcx, 0x58(%rbx)
decl %eax
movl %eax, 0x38(%rbx)
jne 0x2ed3
cmpl $0x0, 0x40(%rbx)
je 0x2eaf
movq %rbx, %rdi
callq 0x32cb
jmp 0x2ec4
movslq 0x34(%rbx), %rax
addq 0x50(%rbx), %rax
cmpq %rax, %rcx
jne 0x2ec4
movq %rbx, %rdi
callq 0x3326
movl 0x38(%rbx), %eax
testl %eax, %eax
je 0x3102
movq 0x58(%rbx), %rcx
cmpb $0xa, (%rcx)
jne 0x2e91
cmpl $0x2, (%rbx)
jne 0x2f94
movq 0x70(%rbx), %rdx
jmp 0x2f9c
movq 0x58(%rbx), %rcx
movzbl (%rcx), %edx
cmpl $0xa, %edx
je 0x2f46
cmpl $0x3e, %edx
je 0x2f87
incq %rcx
movq %rcx, 0x58(%rbx)
decl %eax
movl %eax, 0x38(%rbx)
jne 0x2f41
cmpl $0x0, 0x40(%rbx)
je 0x2f1d
movq %rbx, %rdi
callq 0x32cb
jmp 0x2f32
movslq 0x34(%rbx), %rax
addq 0x50(%rbx), %rax
cmpq %rax, %rcx
jne 0x2f32
movq %rbx, %rdi
callq 0x3326
movl 0x38(%rbx), %eax
testl %eax, %eax
je 0x304a
movq 0x58(%rbx), %rcx
cmpb $0xa, (%rcx)
jne 0x2eff
incl 0x3c(%rbx)
incq %rcx
movq %rcx, 0x58(%rbx)
decl %eax
movl %eax, 0x38(%rbx)
jne 0x2f7f
cmpl $0x0, 0x40(%rbx)
je 0x2f67
movq %rbx, %rdi
callq 0x32cb
jmp 0x2f7c
movslq 0x34(%rbx), %rax
addq 0x50(%rbx), %rax
cmpq %rax, %rcx
jne 0x2f7c
movq %rbx, %rdi
callq 0x3326
movl 0x38(%rbx), %eax
testl %eax, %eax
jne 0x2eea
movl (%rbx), %ecx
cmpl $0x2, %ecx
jne 0x2ff4
movq 0x70(%rbx), %rax
jmp 0x2ffc
movslq 0x24(%rbx), %rdx
addq 0x50(%rbx), %rdx
movl %ecx, %esi
subl %edx, %esi
leaq 0x18(%rbx), %r15
movl %esi, 0x18(%rbx)
cmpq $0x0, 0x60(%rbx)
je 0x2fcf
cmpq %rcx, %rdx
jae 0x2fcf
movq 0x60(%rbx), %rax
movsbq (%rdx), %rcx
movb (%rax,%rcx,4), %al
movb %al, (%rdx)
incq %rdx
movq 0x58(%rbx), %rcx
cmpq %rcx, %rdx
jb 0x2fb3
movl 0x38(%rbx), %eax
incl 0x3c(%rbx)
incq %rcx
movq %rcx, 0x58(%rbx)
decl %eax
movl %eax, 0x38(%rbx)
jne 0x3077
cmpl $0x0, 0x40(%rbx)
je 0x3057
movq %rbx, %rdi
callq 0x32cb
jmp 0x306c
movslq 0x24(%rbx), %rax
addq 0x50(%rbx), %rax
cmpq 0x58(%rbx), %rax
jae 0x302d
movq %rax, %rcx
movq %rax, %rdx
movq 0x60(%rbx), %rax
movsbq (%rcx), %rsi
incq %rcx
movb (%rax,%rsi,4), %sil
movb %sil, (%rdx)
xorl %eax, %eax
testb %sil, %sil
setns %al
addq %rdx, %rax
cmpq 0x58(%rbx), %rcx
jb 0x3005
movl (%rbx), %ecx
cmpl $0x2, %ecx
jne 0x3038
movq 0x70(%rbx), %rcx
jmp 0x3040
movslq 0x24(%rbx), %rcx
addq 0x50(%rbx), %rcx
subl %ecx, %eax
movl %eax, 0x18(%rbx)
jmp 0x3296
movq %r14, %rdi
callq 0x2269
jmp 0x32c7
movslq 0x34(%rbx), %rax
addq 0x50(%rbx), %rax
cmpq %rax, %rcx
jne 0x306c
movq %rbx, %rdi
callq 0x3326
movl 0x38(%rbx), %eax
testl %eax, %eax
je 0x30e8
movq 0x58(%rbx), %rcx
cmpb $0x2b, (%rcx)
je 0x3114
movl 0x3c(%rbx), %esi
leaq 0x38b5(%rip), %rdi      # 0x693f
xorl %eax, %eax
callq 0x5974
movq 0x58(%rbx), %rcx
movl 0x38(%rbx), %eax
jmp 0x310f
movq %rbx, %rdi
callq 0x22c1
jmp 0x32c7
movq %r14, %rdi
callq 0x2286
jmp 0x32c7
movq %rbx, %rdi
callq 0x217e
jmp 0x32c7
movq %rbx, %rdi
callq 0x2160
jmp 0x32c7
movq %rbx, %rdi
callq 0x22a3
jmp 0x32c7
movq %rbx, %rdi
callq 0x21ba
jmp 0x32c7
movq %r14, %rdi
callq 0x224c
jmp 0x32c7
movq %rbx, %rdi
callq 0x219c
jmp 0x32c7
movq %r14, %rdi
callq 0x21d8
jmp 0x32c7
cmpb $0xa, (%rcx)
je 0x3158
incq %rcx
movq %rcx, 0x58(%rbx)
decl %eax
movl %eax, 0x38(%rbx)
jne 0x310f
cmpl $0x0, 0x40(%rbx)
je 0x3132
movq %rbx, %rdi
callq 0x32cb
jmp 0x3147
movslq 0x34(%rbx), %rax
addq 0x50(%rbx), %rax
cmpq %rax, %rcx
jne 0x3147
movq %rbx, %rdi
callq 0x3326
movl 0x38(%rbx), %eax
testl %eax, %eax
je 0x32b5
movq 0x58(%rbx), %rcx
jmp 0x310f
incl 0x3c(%rbx)
incq %rcx
movq %rcx, 0x58(%rbx)
decl %eax
movl %eax, 0x38(%rbx)
jne 0x319d
cmpl $0x0, 0x40(%rbx)
je 0x3179
movq %rbx, %rdi
callq 0x32cb
jmp 0x318e
movslq 0x34(%rbx), %rax
addq 0x50(%rbx), %rax
cmpq %rax, %rcx
jne 0x318e
movq %rbx, %rdi
callq 0x3326
movl 0x38(%rbx), %eax
testl %eax, %eax
je 0x32ab
movq 0x58(%rbx), %rcx
movq 0x50(%rbx), %rdx
movl %ecx, %esi
subl %edx, %esi
movl %esi, 0x28(%rbx)
cmpb $0xa, (%rcx)
je 0x31fb
incq %rcx
movq %rcx, 0x58(%rbx)
decl %eax
movl %eax, 0x38(%rbx)
jne 0x31ef
cmpl $0x0, 0x40(%rbx)
je 0x31cb
movq %rbx, %rdi
callq 0x32cb
jmp 0x31e0
movslq 0x34(%rbx), %rax
addq 0x50(%rbx), %rax
cmpq %rax, %rcx
jne 0x31e0
movq %rbx, %rdi
callq 0x3326
movl 0x38(%rbx), %eax
testl %eax, %eax
je 0x32bf
movq 0x58(%rbx), %rcx
cmpb $0xa, (%rcx)
jne 0x31ad
movq 0x50(%rbx), %rdx
movl 0x28(%rbx), %esi
movslq %esi, %rax
addq %rdx, %rax
subq %rax, %rcx
movslq (%r15), %rax
cmpq %rax, %rcx
je 0x321d
movl (%r14), %esi
leaq 0x3741(%rip), %rdi      # 0x6957
xorl %eax, %eax
callq 0x5974
cmpb $0x0, 0x2c(%rbx)
je 0x324c
cmpl $0x2, (%rbx)
jne 0x322e
movq 0x78(%rbx), %rax
jmp 0x3236
movslq 0x28(%rbx), %rax
addq 0x50(%rbx), %rax
movslq (%r15), %rcx
testq %rcx, %rcx
jle 0x324c
addq %rax, %rcx
addb $-0x21, (%rax)
incq %rax
cmpq %rcx, %rax
jb 0x3241
movq 0x58(%rbx), %rax
incq %rax
movq %rax, 0x58(%rbx)
movq 0x38(%rbx), %xmm0
paddd 0x35fc(%rip), %xmm0     # 0x6860
movq %xmm0, 0x38(%rbx)
movd %xmm0, %ecx
testl %ecx, %ecx
jne 0x3296
cmpl $0x0, 0x40(%rbx)
je 0x3281
movq %rbx, %rdi
callq 0x32cb
jmp 0x3296
movslq 0x34(%rbx), %rcx
addq 0x50(%rbx), %rcx
cmpq %rcx, %rax
jne 0x3296
movq %rbx, %rdi
callq 0x3326
incq 0x8(%rbx)
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x2212
jmp 0x32c7
movq %r14, %rdi
callq 0x222f
jmp 0x32c7
movq %r14, %rdi
callq 0x21f5
xorl %eax, %eax
jmp 0x329c