// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x80, %rsp
movl 0x10(%rbp), %eax
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movl -0x4(%rbp), %edx
andl $0x1, %edx
leaq 0xc1b6e(%rip), %rax     # 0x1084b0
leaq 0xc2b87(%rip), %rcx     # 0x1094d0
cmpl $0x0, %edx
cmovneq %rcx, %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x58(%rbp)
movl $0x0, -0x64(%rbp)
cmpl $0x0, -0x28(%rbp)
jl 0x4696b
jmp 0x4698a
leaq 0x960e8(%rip), %rdi     # 0xdca5a
leaq 0x960ec(%rip), %rsi     # 0xdca65
movl $0xa9, %edx
leaq 0x960ea(%rip), %rcx     # 0xdca6f
callq 0x6450
cmpl $0x0, 0x10(%rbp)
jl 0x46992
jmp 0x469b1
leaq 0x9611a(%rip), %rdi     # 0xdcab3
leaq 0x960c5(%rip), %rsi     # 0xdca65
movl $0xaa, %edx
leaq 0x960c3(%rip), %rcx     # 0xdca6f
callq 0x6450
movl -0x28(%rbp), %eax
addl 0x10(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jle 0x46a04
movl -0x2c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x68(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x469df
movq -0x10(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x469ec
leaq 0x96105(%rip), %rax     # 0xdcaeb
movq %rax, -0x78(%rbp)
jmp 0x469ec
movl -0x68(%rbp), %edx
movl -0x6c(%rbp), %esi
movq -0x78(%rbp), %rcx
leaq 0x960c0(%rip), %rdi     # 0xdcabd
movb $0x0, %al
callq 0x35d40
movl $0x28, %edi
callq 0x40c50
movq %rax, -0x50(%rbp)
movl 0x10(%rbp), %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x18(%rbp), %rdi
callq 0x2a450
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x8(%rax)
movl 0x10(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
callq 0x40950
movq %rax, %rcx
movq %rcx, -0x38(%rbp)
movq -0x50(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x4(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x46a6f
movl 0x10(%rbp), %edi
callq 0x23a00
movq %rax, %rcx
movq %rcx, -0x58(%rbp)
movq -0x50(%rbp), %rax
movq %rcx, 0x20(%rax)
movl -0x28(%rbp), %eax
sarl %eax
movl %eax, -0x5c(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x5c(%rbp), %rsi
addq $0x8, %rsi
xorl %edx, %edx
callq 0x67c0
movl -0x28(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x46b0f
movq -0x20(%rbp), %rdi
callq 0x6df0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jge 0x46ab9
movq -0x10(%rbp), %rsi
leaq 0x96040(%rip), %rdi     # 0xdcaf2
movb $0x0, %al
callq 0x35d40
movq -0x48(%rbp), %rax
movl -0x3c(%rbp), %ecx
andl $0xf, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movq -0x38(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x38(%rbp)
movb %cl, (%rax)
movl 0x10(%rbp), %eax
subl $0x1, %eax
movl %eax, 0x10(%rbp)
cmpq $0x0, -0x58(%rbp)
je 0x46b0d
movl -0x3c(%rbp), %eax
andl $0xf, %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0x46b04
movq -0x58(%rbp), %rdi
movl -0x64(%rbp), %esi
callq 0x23c50
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x46b0f
movl 0x10(%rbp), %eax
sarl %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x60(%rbp)
cmpl $0x0, %eax
jl 0x46bcf
movq -0x20(%rbp), %rdi
callq 0x6df0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jge 0x46b4d
movq -0x10(%rbp), %rsi
leaq 0x95fbf(%rip), %rdi     # 0xdcb05
movb $0x0, %al
callq 0x35d40
movq -0x48(%rbp), %rax
movl -0x3c(%rbp), %ecx
sarl $0x4, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movq -0x38(%rbp), %rax
movb %cl, (%rax)
movq -0x48(%rbp), %rax
movl -0x3c(%rbp), %ecx
andl $0xf, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movq -0x38(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x38(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x58(%rbp)
je 0x46bca
movl -0x3c(%rbp), %eax
sarl $0x4, %eax
andl $0xf, %eax
cmpl $0x0, %eax
jne 0x46ba7
movq -0x58(%rbp), %rdi
movl -0x64(%rbp), %esi
callq 0x23c50
movl -0x3c(%rbp), %eax
andl $0xf, %eax
cmpl $0x0, %eax
jne 0x46bc1
movq -0x58(%rbp), %rdi
movl -0x64(%rbp), %esi
addl $0x1, %esi
callq 0x23c50
movl -0x64(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x64(%rbp)
jmp 0x46b17
movl 0x10(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x46c48
movq -0x20(%rbp), %rdi
callq 0x6df0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jge 0x46bfe
movq -0x10(%rbp), %rsi
leaq 0x95f21(%rip), %rdi     # 0xdcb18
movb $0x0, %al
callq 0x35d40
movq -0x48(%rbp), %rax
movl -0x3c(%rbp), %ecx
sarl $0x4, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movq -0x38(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x38(%rbp)
movb %cl, (%rax)
cmpq $0x0, -0x58(%rbp)
je 0x46c46
movl -0x3c(%rbp), %eax
sarl $0x4, %eax
cmpl $0x0, %eax
jne 0x46c3d
movq -0x58(%rbp), %rdi
movl -0x64(%rbp), %esi
callq 0x23c50
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x46c48
movq -0x38(%rbp), %rax
movb $0x0, (%rax)
movq -0x50(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)