// File: /workspace/github_c_makefile_star2_O3/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 0x31e01
leaq 0x90271(%rip), %rax     # 0xc2070
jmp 0x31e08
leaq 0x91288(%rip), %rax     # 0xc3090
movq %rax, 0x10(%rsp)
testl %r12d, %r12d
js 0x3204e
movl 0x60(%rsp), %r13d
testl %r13d, %r13d
js 0x3206d
leal (%r12,%r13), %esi
cmpl %r8d, %esi
jle 0x31e51
movq 0x8(%rsp), %rax
testq %rax, %rax
leaq 0x60ee0(%rip), %rcx     # 0x92d1c
cmovneq %rax, %rcx
leaq 0x60ea7(%rip), %rdi     # 0x92cee
movl %r8d, %edx
xorl %eax, %eax
callq 0x26e94
movl $0x28, %edi
callq 0x2dff4
movq %rax, %rbx
movl %r13d, 0x18(%rax)
movq %r15, %rdi
callq 0x1feba
movq %rax, 0x8(%rbx)
leal 0x1(%r13), %edi
callq 0x2ddfc
movq %rax, %r15
movq $0x0, 0x18(%rsp)
movq %rax, 0x10(%rbx)
testb $0x1, %bpl
movq %r13, (%rsp)
jne 0x31e96
xorl %r13d, %r13d
jmp 0x31ea5
movq %r13, %rdi
callq 0x1baaa
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 0x31ec2
movq %r15, %r12
jmp 0x31f22
movq %r14, %rdi
callq 0x6de0
movl %eax, %ebp
testl %eax, %eax
jns 0x31ee3
leaq 0x60e4c(%rip), %rdi     # 0x92d23
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x26e94
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 0x31f22
movl $0x1, %eax
movq %rax, 0x18(%rsp)
testb $0x8, %bpl
jne 0x31f22
movq %r13, %rdi
xorl %esi, %esi
callq 0x1bbc1
movq (%rsp), %rax
movl %eax, %r15d
sarl %r15d
testl %r15d, %r15d
jle 0x31fda
movq %rbx, 0x20(%rsp)
movq %r14, %rbx
incl %r15d
movq %r12, %r14
movq %rbx, %rdi
callq 0x6de0
movl %eax, %r12d
testl %eax, %eax
jns 0x31f65
leaq 0x60ddd(%rip), %rdi     # 0x92d36
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x26e94
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 0x31fba
testb $-0x10, %r12b
movq 0x18(%rsp), %r12
jne 0x31fa0
movq %r13, %rdi
movl %r12d, %esi
callq 0x1bbc1
testl %ebp, %ebp
jne 0x31fb1
leal 0x1(%r12), %esi
movq %r13, %rdi
callq 0x1bbc1
addl $0x2, %r12d
movq %r12, 0x18(%rsp)
decl %r15d
leaq 0x2(%r14), %r12
cmpl $0x1, %r15d
ja 0x31f40
addq $0x2, %r14
movq %r14, %r12
movq %rbx, %r14
movq 0x20(%rsp), %rbx
testb $0x1, (%rsp)
je 0x32037
movq %r14, %rdi
callq 0x6de0
movl %eax, %r14d
testl %eax, %eax
jns 0x32002
leaq 0x60d53(%rip), %rdi     # 0x92d49
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x26e94
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 0x32037
movq %r13, %rdi
movq 0x18(%rsp), %rsi
callq 0x1bbc1
movb $0x0, (%r12)
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x60c36(%rip), %rdi     # 0x92c8b
leaq 0x60c3a(%rip), %rsi     # 0x92c96
leaq 0x60c3d(%rip), %rcx     # 0x92ca0
movl $0xa9, %edx
callq 0x6460
leaq 0x60c70(%rip), %rdi     # 0x92ce4
leaq 0x60c1b(%rip), %rsi     # 0x92c96
leaq 0x60c1e(%rip), %rcx     # 0x92ca0
movl $0xaa, %edx
callq 0x6460