// File: /workspace/github_c_makefile_star2_O2/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 $0x38, %rsp
movl %r9d, %r13d
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, 0x18(%rsp)
movl %edi, %ebp
testb $0x1, %bpl
jne 0x2c780
leaq 0x89912(%rip), %rax     # 0xb6090
jmp 0x2c787
leaq 0x8a929(%rip), %rax     # 0xb70b0
movq %rax, 0x20(%rsp)
testl %r13d, %r13d
js 0x2c9ce
movl 0x70(%rsp), %ebx
testl %ebx, %ebx
js 0x2c9ed
leal (%rbx,%r13), %esi
cmpl %r8d, %esi
jle 0x2c7ce
movq 0x18(%rsp), %rax
testq %rax, %rax
leaq 0x55463(%rip), %rcx     # 0x81c1c
cmovneq %rax, %rcx
leaq 0x5542a(%rip), %rdi     # 0x81bee
movl %r8d, %edx
xorl %eax, %eax
callq 0x223fb
pushq $0x28
popq %rdi
callq 0x28bb0
movq %rax, %r12
movl %ebx, 0x18(%rax)
movq %r15, %rdi
callq 0x1c306
movq %rax, 0x8(%r12)
leal 0x1(%rbx), %edi
callq 0x289b8
movq %rax, %r15
movq $0x0, 0x10(%rsp)
movq %rax, 0x10(%r12)
testb $0x1, %bpl
jne 0x2c813
movq $0x0, 0x8(%rsp)
jmp 0x2c824
movl %ebx, %edi
callq 0x183ab
movq %rax, 0x8(%rsp)
movq %rax, 0x20(%r12)
movl %r13d, %esi
shrl %esi
addl $0x8, %esi
movq %r14, %rdi
xorl %edx, %edx
callq 0x67d0
testb $0x1, %r13b
movq %r12, 0x28(%rsp)
jne 0x2c849
movq %r14, %r12
movq %r15, %r13
jmp 0x2c8b1
movq %rbx, %rbp
movq %r14, %rdi
callq 0x6de0
movl %eax, %ebx
testl %eax, %eax
jns 0x2c86d
leaq 0x553c2(%rip), %rdi     # 0x81c23
movq 0x18(%rsp), %rsi
xorl %eax, %eax
callq 0x223fb
movl %ebx, %eax
andl $0xf, %eax
movq 0x20(%rsp), %rcx
movb (%rcx,%rax), %al
movq %r15, %r13
incq %r13
movb %al, (%r15)
decl %ebp
cmpq $0x0, 0x8(%rsp)
je 0x2c8ab
pushq $0x1
popq %rax
movq %rax, 0x10(%rsp)
testb $0x8, %bl
jne 0x2c8ab
movq %r14, %r12
movq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x184bc
jmp 0x2c8ae
movq %r14, %r12
movq %rbp, %rbx
movq %rbx, 0x30(%rsp)
movl %ebx, %r14d
sarl %r14d
movq %r13, %rbx
testl %r14d, %r14d
jle 0x2c94f
movq %r12, %rdi
callq 0x6de0
movl %eax, %r15d
testl %eax, %eax
jns 0x2c8ea
leaq 0x55358(%rip), %rdi     # 0x81c36
movq 0x18(%rsp), %rsi
xorl %eax, %eax
callq 0x223fb
movl %r15d, %eax
sarl $0x4, %eax
movl %r15d, %ebp
andl $0xf, %ebp
leaq 0x2(%rbx), %r13
decl %r14d
cltq
movq 0x20(%rsp), %rcx
movb (%rcx,%rax), %al
movb %al, (%rbx)
movb (%rcx,%rbp), %al
movb %al, 0x1(%rbx)
movq %r13, %rbx
cmpq $0x0, 0x8(%rsp)
je 0x2c8bf
testb $-0x10, %r15b
movq 0x10(%rsp), %rbx
jne 0x2c931
movq 0x8(%rsp), %rdi
movl %ebx, %esi
callq 0x184bc
testl %ebp, %ebp
jne 0x2c942
leal 0x1(%rbx), %esi
movq 0x8(%rsp), %rdi
callq 0x184bc
addl $0x2, %ebx
movq %rbx, 0x10(%rsp)
jmp 0x2c8bc
testb $0x1, 0x30(%rsp)
jne 0x2c95d
movq 0x28(%rsp), %r14
jmp 0x2c9b9
movq %r12, %rdi
callq 0x6de0
movl %eax, %r14d
testl %eax, %eax
jns 0x2c97f
leaq 0x552d6(%rip), %rdi     # 0x81c49
movq 0x18(%rsp), %rsi
xorl %eax, %eax
callq 0x223fb
movl %r14d, %eax
sarl $0x4, %eax
cltq
movq 0x20(%rsp), %rcx
movb (%rcx,%rax), %al
movb %al, (%rbx)
incq %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
sete %al
cmpl $0x10, %r14d
setae %cl
orb %al, %cl
movq 0x28(%rsp), %r14
jne 0x2c9b9
movq 0x10(%rsp), %rsi
callq 0x184bc
movb $0x0, (%rbx)
movq %r14, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x551b6(%rip), %rdi     # 0x81b8b
leaq 0x551ba(%rip), %rsi     # 0x81b96
leaq 0x551bd(%rip), %rcx     # 0x81ba0
movl $0xa9, %edx
callq 0x6460
leaq 0x551f0(%rip), %rdi     # 0x81be4
leaq 0x5519b(%rip), %rsi     # 0x81b96
leaq 0x5519e(%rip), %rcx     # 0x81ba0
movl $0xaa, %edx
callq 0x6460