// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/lib/nib.c
// Function: nibInput
static struct dnaSeq *nibInput(int options, char *fileName, char *seqName,
                               FILE *f, int seqSize, int start, int size)
/* Load part of an open .nib file. */
{
int end;
DNA *d;
int bVal;
DNA *valToNtTbl = ((options &  NIB_MASK_MIXED) ? valToNtMasked : valToNt);
struct dnaSeq *seq;
Bits* mask = NULL;
int bytePos, byteSize;
int maskIdx = 0;

assert(start >= 0);
assert(size >= 0);

end = start+size;
if (end > seqSize)
    errAbort("nib read past end of file (%d %d) in file: %s", 
	     end, seqSize, (fileName != NULL ? fileName : "(NULL)"));

AllocVar(seq);
seq->size = size;
seq->name = cloneString(seqName);
seq->dna = d = needLargeMem(size+1);
if (options & NIB_MASK_MIXED)
    seq->mask = mask = bitAlloc(size);

bytePos = (start>>1);
fseek(f, bytePos + 2*sizeof(bits32), SEEK_SET);
if (start & 1)
    {
    bVal = getc_unlocked(f);
    if (bVal < 0)
	{
	errAbort("Read error 1 in %s", fileName);
	}
    *d++ = valToNtTbl[(bVal&0xf)];
    size -= 1;
    if (mask != NULL)
        {
        if ((bVal&0xf&MASKED_BASE_BIT) == 0)
            bitSetOne(mask, maskIdx);
        maskIdx++;
        }
    }
byteSize = (size>>1);
while (--byteSize >= 0)
    {
    bVal = getc_unlocked(f);
    if (bVal < 0)
	errAbort("Read error 2 in %s", fileName);
    d[0] = valToNtTbl[(bVal>>4)];
    d[1] = valToNtTbl[(bVal&0xf)];
    d += 2;
    if (mask != NULL)
        {
        if (((bVal>>4)&0xf) == 0)
            bitSetOne(mask, maskIdx);
        if ((bVal&0xf) == 0)
            bitSetOne(mask, maskIdx+1);
        maskIdx += 2;
        }
    }
if (size&1)
    {
    bVal = getc_unlocked(f);
    if (bVal < 0)
	errAbort("Read error 3 in %s", fileName);
    *d++ = valToNtTbl[(bVal>>4)];
    if (mask != NULL)
        {
        if ((bVal>>4) == 0)
            bitSetOne(mask, maskIdx);
        maskIdx++;
        }
    }
*d = 0;
return seq;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, %r12d
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, 0x8(%rsp)
movl %edi, %ebp
testb $0x1, %bpl
jne 0x31b28
leaq 0x9054a(%rip), %rax     # 0xc2070
jmp 0x31b2f
leaq 0x91561(%rip), %rax     # 0xc3090
movq %rax, 0x10(%rsp)
testl %r12d, %r12d
js 0x31d75
movl 0x60(%rsp), %r13d
testl %r13d, %r13d
js 0x31d94
leal (%r12,%r13), %esi
cmpl %r8d, %esi
jle 0x31b78
movq 0x8(%rsp), %rax
testq %rax, %rax
leaq 0x610e8(%rip), %rcx     # 0x92c4b
cmovneq %rax, %rcx
leaq 0x610af(%rip), %rdi     # 0x92c1d
movl %r8d, %edx
xorl %eax, %eax
callq 0x26b6f
movl $0x28, %edi
callq 0x2dc95
movq %rax, %rbx
movl %r13d, 0x18(%rax)
movq %r15, %rdi
callq 0x1f9f6
movq %rax, 0x8(%rbx)
leal 0x1(%r13), %edi
callq 0x2da9d
movq %rax, %r15
movq $0x0, 0x18(%rsp)
movq %rax, 0x10(%rbx)
testb $0x1, %bpl
movq %r13, (%rsp)
jne 0x31bbd
xorl %r13d, %r13d
jmp 0x31bcc
movq %r13, %rdi
callq 0x1b749
movq %rax, %r13
movq %rax, 0x20(%rbx)
movl %r12d, %esi
shrl %esi
addl $0x8, %esi
movq %r14, %rdi
xorl %edx, %edx
callq 0x67d0
testb $0x1, %r12b
jne 0x31be9
movq %r15, %r12
jmp 0x31c49
movq %r14, %rdi
callq 0x6de0
movl %eax, %ebp
testl %eax, %eax
jns 0x31c0a
leaq 0x61054(%rip), %rdi     # 0x92c52
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x26b6f
movl %ebp, %eax
andl $0xf, %eax
movq 0x10(%rsp), %rcx
movb (%rcx,%rax), %al
movq %r15, %r12
incq %r12
movb %al, (%r15)
movq (%rsp), %rax
decl %eax
movq %rax, (%rsp)
testq %r13, %r13
je 0x31c49
movl $0x1, %eax
movq %rax, 0x18(%rsp)
testb $0x8, %bpl
jne 0x31c49
movq %r13, %rdi
xorl %esi, %esi
callq 0x1b860
movq (%rsp), %rax
movl %eax, %r15d
sarl %r15d
testl %r15d, %r15d
jle 0x31d01
movq %rbx, 0x20(%rsp)
movq %r14, %rbx
incl %r15d
movq %r12, %r14
movq %rbx, %rdi
callq 0x6de0
movl %eax, %r12d
testl %eax, %eax
jns 0x31c8c
leaq 0x60fe5(%rip), %rdi     # 0x92c65
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x26b6f
movl %r12d, %eax
sarl $0x4, %eax
movl %r12d, %ebp
andl $0xf, %ebp
cltq
movq 0x10(%rsp), %rcx
movb (%rcx,%rax), %al
movb %al, (%r14)
movb (%rcx,%rbp), %al
movb %al, 0x1(%r14)
testq %r13, %r13
je 0x31ce1
testb $-0x10, %r12b
movq 0x18(%rsp), %r12
jne 0x31cc7
movq %r13, %rdi
movl %r12d, %esi
callq 0x1b860
testl %ebp, %ebp
jne 0x31cd8
leal 0x1(%r12), %esi
movq %r13, %rdi
callq 0x1b860
addl $0x2, %r12d
movq %r12, 0x18(%rsp)
decl %r15d
leaq 0x2(%r14), %r12
cmpl $0x1, %r15d
jg 0x31c67
addq $0x2, %r14
movq %r14, %r12
movq %rbx, %r14
movq 0x20(%rsp), %rbx
testb $0x1, (%rsp)
je 0x31d5e
movq %r14, %rdi
callq 0x6de0
movl %eax, %r14d
testl %eax, %eax
jns 0x31d29
leaq 0x60f5b(%rip), %rdi     # 0x92c78
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x26b6f
movl %r14d, %eax
sarl $0x4, %eax
cltq
movq 0x10(%rsp), %rcx
movb (%rcx,%rax), %al
movb %al, (%r12)
incq %r12
testq %r13, %r13
sete %al
cmpl $0x10, %r14d
setae %cl
orb %al, %cl
jne 0x31d5e
movq %r13, %rdi
movq 0x18(%rsp), %rsi
callq 0x1b860
movb $0x0, (%r12)
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x60e3e(%rip), %rdi     # 0x92bba
leaq 0x60e42(%rip), %rsi     # 0x92bc5
leaq 0x60e45(%rip), %rcx     # 0x92bcf
movl $0xa9, %edx
callq 0x6460
leaq 0x60e78(%rip), %rdi     # 0x92c13
leaq 0x60e23(%rip), %rsi     # 0x92bc5
leaq 0x60e26(%rip), %rcx     # 0x92bcf
movl $0xaa, %edx
callq 0x6460