// File: /workspace/github_c_makefile_star2_O1/richarddurbin[P]hash10x/seqio.c
// Function: seqIOopen
SeqIO *seqIOopen (char *filename, int* convert, BOOL isQual)
{
  SeqIO *si = new0 (1, SeqIO) ;
  if (!strcmp (filename, "-")) si->f = gzdopen (fileno (stdin), "r") ;
  else si->f = gzopen (filename, "r") ;
  if (!si->f) { free(si) ; return 0 ; }
  si->bufSize = 1<<24 ;
  si->b = si->buf = new (si->bufSize, char) ;
  si->convert = convert ;
  si->isQual = isQual ;
  si->nb = gzread (si->f, si->buf, si->bufSize) ;
  if (!si->nb)
    { fprintf (stderr, "sequence file %s unreadable or empty\n", filename) ;
      seqIOclose (si) ;
      return 0 ;
    }
  si->line = 1 ;
  if (*si->buf == '>')
    { si->type = FASTA ; si->isQual = FALSE ;
      if (!si->convert) si->convert = dna2textAmbigConv ; /* default: need to remove whitespace */
    }
  else if (*si->buf == '@') si->type = FASTQ ;
  else if (*si->buf == 'B')
    { si->type = BINARY ;
      if (si->nb <= 8) die ("binary file too short\n") ;
      si->qualThresh = si->buf[1] ;
      si->isQual = (si->qualThresh > 0) ;
      si->nSeq = *(U64*)si->buf & 0xffffffffffffLL ; /* 6 bytes of ff */
      si->b += 8 ; si->nb -= 8 ;
    }
  else
    { fprintf (stderr, "sequence file %s is unknown type\n", filename) ;
      seqIOclose (si) ;
      return 0 ;
    }
  return si ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r14
movl $0x1, %edi
movl $0x80, %esi
callq 0x57c8
movq %rax, %rbx
leaq 0x3ee3(%rip), %rsi      # 0x6617
movq %r14, %rdi
callq 0x1100
testl %eax, %eax
je 0x2751
leaq 0x3f49(%rip), %rsi      # 0x6690
movq %r14, %rdi
callq 0x11b0
jmp 0x276e
movq 0x7880(%rip), %rax      # 0x9fd8
movq (%rax), %rdi
callq 0x1150
leaq 0x3f29(%rip), %rsi      # 0x6690
movl %eax, %edi
callq 0x1080
movq %rax, 0x48(%rbx)
testq %rax, %rax
je 0x27f1
movl $0x1000000, 0x34(%rbx)  # imm = 0x1000000
movl $0x1000000, %edi        # imm = 0x1000000
callq 0x57a0
movq %rax, 0x50(%rbx)
movq %rax, 0x58(%rbx)
movq %r15, 0x60(%rbx)
movb %bpl, 0x2c(%rbx)
movq 0x48(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %rax, %rsi
callq 0x1110
movl %eax, 0x38(%rbx)
testl %eax, %eax
je 0x2857
movl $0x1, 0x3c(%rbx)
movq 0x50(%rbx), %rcx
movzbl (%rcx), %ecx
cmpl $0x42, %ecx
je 0x27fd
cmpl $0x40, %ecx
je 0x2843
cmpl $0x3e, %ecx
jne 0x286a
movl $0x0, (%rbx)
movb $0x0, 0x2c(%rbx)
cmpq $0x0, 0x60(%rbx)
jne 0x2849
leaq 0x7b55(%rip), %rax      # 0xa340
movq %rax, 0x60(%rbx)
jmp 0x2849
movq %rbx, %rdi
callq 0x1040
xorl %ebx, %ebx
jmp 0x2849
movl $0x2, (%rbx)
cmpl $0x8, %eax
jg 0x2816
leaq 0x4091(%rip), %rdi      # 0x68a0
xorl %eax, %eax
callq 0x56d8
movq 0x50(%rbx), %rax
movsbl 0x1(%rax), %ecx
testl %ecx, %ecx
movl %ecx, 0x30(%rbx)
setg 0x2c(%rbx)
movabsq $0xffffffffffff, %rcx   # imm = 0xFFFFFFFFFFFF
andq (%rax), %rcx
movq %rcx, 0x8(%rbx)
addq $0x8, 0x58(%rbx)
addl $-0x8, 0x38(%rbx)
jmp 0x2849
movl $0x1, (%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x779a(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq 0x4012(%rip), %rsi      # 0x687a
jmp 0x287b
movq 0x7787(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq 0x403c(%rip), %rsi      # 0x68b7
movq %r14, %rdx
xorl %eax, %eax
callq 0x1120
movq %rbx, %rdi
callq 0x2892
jmp 0x27f9