// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/lib/linefile.c
// Function: lineFileNext
boolean lineFileNext(struct lineFile *lf, char **retStart, int *retSize)
/* Fetch next line from file. */
{
int newStart;

if (lf->reuse)
    {
    lf->reuse = FALSE;
    if (retSize != NULL)
	*retSize = lf->lineEnd - lf->lineStart;
    *retStart = lf->buf + lf->lineStart;
    if (lf->metaOutput && *retStart[0] == '#')
        metaDataAdd(lf, *retStart);
    return TRUE;
    }

if (lf->nextCallBack)
    return lf->nextCallBack(lf, retStart, retSize);

if (lf->udcFile)
    {
    lf->bufOffsetInFile = udcTell(lf->udcFile);
    char *line = udcReadLine(lf->udcFile);
    if (line==NULL)
        return FALSE;
    int lineSize = strlen(line);
    lf->bytesInBuf = lineSize;
    ++lf->lineIx;
    lf->lineStart = 0;
    lf->lineEnd = lineSize;
    *retStart = line;
    freeMem(lf->buf);
    lf->buf = line;
    lf->bufSize = lineSize;
    return TRUE;
    }

if (lf->tabix != NULL && lf->tabixIter != NULL)
    {
    // Just use line-oriented ti_read:
    int lineSize = 0;
    lineSize = tbx_itr_next(lf->htsFile, lf->tabix, lf->tabixIter, lf->kline);
    if (lineSize == -1)
	return FALSE;
    lf->bufOffsetInFile = -1;
    lf->bytesInBuf = lineSize;
    lf->lineIx = -1;
    lf->lineStart = 0;
    lf->lineEnd = lineSize;
    if (lineSize > lf->bufSize)
	// shouldn't be!  but just in case:
	lineFileExpandBuf(lf, lineSize * 2);
    kstring_t *kline = lf->kline;
    safecpy(lf->buf, lf->bufSize, kline->s);
    *retStart = lf->buf;
    if (retSize != NULL)
	*retSize = lineSize;
    return TRUE;
    }

char *buf = lf->buf;
int endIx = lf->lineEnd;
int bytesInBuf = lf->bytesInBuf;
determineNlType(lf, buf+endIx, bytesInBuf-endIx);
boolean gotLf = findNextNewline(lf, buf, bytesInBuf, &endIx);

/* If not in buffer read in a new buffer's worth. */
while (!gotLf)
    {
    int oldEnd = lf->lineEnd;
    int sizeLeft = bytesInBuf - oldEnd;
    int bufSize = lf->bufSize;
    int readSize = bufSize - sizeLeft;

    if (oldEnd > 0 && sizeLeft > 0)
	{
	memmove(buf, buf+oldEnd, sizeLeft);
	}
    lf->bufOffsetInFile += oldEnd;
    if (lf->fd >= 0)
	readSize = lineFileLongNetRead(lf->fd, buf+sizeLeft, readSize);
    else if (lf->tabix != NULL && readSize > 0)
	{
        errAbort("bgzf read not supported with htslib (yet)");
	if (readSize < 1)
	    return FALSE;
	}
    else
        readSize = 0;

    if ((readSize == 0) && (endIx > oldEnd))
	{
	endIx = sizeLeft;
	buf[endIx] = 0;
	lf->bytesInBuf = newStart = lf->lineStart = 0;
	lf->lineEnd = endIx;
	++lf->lineIx;
	if (retSize != NULL)
	    *retSize = endIx - newStart;
	*retStart = buf + newStart;
        if (*retStart[0] == '#')
            metaDataAdd(lf, *retStart);
	return TRUE;
	}
    else if (readSize <= 0)
	{
	lf->bytesInBuf = lf->lineStart = lf->lineEnd = 0;
	return FALSE;
	}
    else
        endIx = sizeLeft;

    bytesInBuf = lf->bytesInBuf = readSize + sizeLeft;
    lf->lineEnd = 0;

    determineNlType(lf, buf+endIx, bytesInBuf-endIx);
    gotLf = findNextNewline(lf, buf, bytesInBuf, &endIx);

    if (!gotLf && bytesInBuf == lf->bufSize)
        {
	if (bufSize >= 512*1024*1024)
	    {
	    errAbort("Line too long (more than %d chars) line %d of %s",
		lf->bufSize, lf->lineIx+1, lf->fileName);
	    }
	else
	    {
	    lineFileExpandBuf(lf, bufSize*2);
	    buf = lf->buf;
	    }
	}
    }

if (lf->zTerm)
    {
    buf[endIx-1] = 0;
    if ((lf->nlType == nlt_dos) && (buf[endIx-2]=='\r'))
	{
	buf[endIx-2] = 0;
	}
    }

lf->lineStart = newStart = lf->lineEnd;
lf->lineEnd = endIx;
++lf->lineIx;
if (retSize != NULL)
    *retSize = endIx - newStart;
*retStart = buf + newStart;
if (*retStart[0] == '#')
    metaDataAdd(lf, *retStart);
return TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x3c(%rax)
je 0x3b6f1
movq -0x10(%rbp), %rax
movb $0x0, 0x3c(%rax)
cmpq $0x0, -0x20(%rbp)
je 0x3b6a1
movq -0x10(%rbp), %rax
movl 0x30(%rax), %ecx
movq -0x10(%rbp), %rax
subl 0x2c(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rcx
movq -0x10(%rbp), %rax
movslq 0x2c(%rax), %rax
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x3b6e5
movq -0x18(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0x3b6e5
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0x3bc80
movl $0x1, -0x4(%rbp)
jmp 0x3bc72
movq -0x10(%rbp), %rax
cmpq $0x0, 0xb8(%rax)
je 0x3b720
movq -0x10(%rbp), %rax
movq 0xb8(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq *%rax
movl %eax, -0x4(%rbp)
jmp 0x3bc72
movq -0x10(%rbp), %rax
cmpq $0x0, 0x88(%rax)
je 0x3b7e6
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rdi
callq 0x5eaa0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rdi
callq 0x5e6d0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x3b774
movl $0x0, -0x4(%rbp)
jmp 0x3bc72
movq -0x30(%rbp), %rdi
callq 0x62c0
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x10(%rbp), %rax
movl 0x28(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x28(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x2c(%rax)
movl -0x34(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x30(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x40d40
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
movl -0x34(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x14(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x3bc72
movq -0x10(%rbp), %rax
cmpq $0x0, 0x70(%rax)
je 0x3b8f7
movq -0x10(%rbp), %rax
cmpq $0x0, 0x78(%rax)
je 0x3b8f7
movl $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rdi
callq 0x727a0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rcx
callq 0x771c0
movl %eax, -0x38(%rbp)
cmpl $-0x1, -0x38(%rbp)
jne 0x3b850
movl $0x0, -0x4(%rbp)
jmp 0x3bc72
movq -0x10(%rbp), %rax
movq $-0x1, 0x18(%rax)
movl -0x38(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x28(%rax) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rax
movl $0x0, 0x2c(%rax)
movl -0x38(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x30(%rax)
movl -0x38(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jle 0x3b8a0
movq -0x10(%rbp), %rdi
movl -0x38(%rbp), %esi
shll %esi
callq 0x3b2f0
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x10(%rbp), %rax
movslq 0x14(%rax), %rsi
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdx
callq 0x2caf0
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x20(%rbp)
je 0x3b8eb
movl -0x38(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x3bc72
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
movslq -0x4c(%rbp), %rax
addq %rax, %rsi
movl -0x50(%rbp), %edx
subl -0x4c(%rbp), %edx
callq 0x3bd30
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl -0x50(%rbp), %edx
leaq -0x4c(%rbp), %rcx
callq 0x3bdf0
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x54(%rbp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3b95a
jmp 0x3bbb1
movq -0x10(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0x58(%rbp)
movl -0x50(%rbp), %eax
subl -0x58(%rbp), %eax
movl %eax, -0x5c(%rbp)
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
subl -0x5c(%rbp), %eax
movl %eax, -0x64(%rbp)
cmpl $0x0, -0x58(%rbp)
jle 0x3b9a4
cmpl $0x0, -0x5c(%rbp)
jle 0x3b9a4
movq -0x48(%rbp), %rdi
movq -0x48(%rbp), %rsi
movslq -0x58(%rbp), %rax
addq %rax, %rsi
movslq -0x5c(%rbp), %rdx
callq 0x6c60
movslq -0x58(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x18(%rax), %rcx
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jl 0x3b9dd
movq -0x10(%rbp), %rax
movl 0x10(%rax), %edi
movq -0x48(%rbp), %rsi
movslq -0x5c(%rbp), %rax
addq %rax, %rsi
movl -0x64(%rbp), %edx
callq 0x3b5d0
movl %eax, -0x64(%rbp)
jmp 0x3ba19
movq -0x10(%rbp), %rax
cmpq $0x0, 0x70(%rax)
je 0x3ba10
cmpl $0x0, -0x64(%rbp)
jle 0x3ba10
leaq 0x9f4e7(%rip), %rdi     # 0xdaedc
movb $0x0, %al
callq 0x35d40
cmpl $0x1, -0x64(%rbp)
jge 0x3ba0e
movl $0x0, -0x4(%rbp)
jmp 0x3bc72
jmp 0x3ba17
movl $0x0, -0x64(%rbp)
jmp 0x3ba19
cmpl $0x0, -0x64(%rbp)
jne 0x3bac5
movl -0x4c(%rbp), %eax
cmpl -0x58(%rbp), %eax
jle 0x3bac5
movl -0x5c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x48(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x10(%rbp), %rax
movl $0x0, 0x2c(%rax)
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rax
movl $0x0, 0x20(%rax)
movl -0x4c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x10(%rbp), %rax
movl 0x28(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x28(%rax)
cmpq $0x0, -0x20(%rbp)
je 0x3ba88
movl -0x4c(%rbp), %ecx
subl -0x24(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x48(%rbp), %rcx
movslq -0x24(%rbp), %rax
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0x3bab9
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0x3bc80
movl $0x1, -0x4(%rbp)
jmp 0x3bc72
cmpl $0x0, -0x64(%rbp)
jg 0x3baf8
movq -0x10(%rbp), %rax
movl $0x0, 0x30(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x2c(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x20(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x3bc72
movl -0x5c(%rbp), %eax
movl %eax, -0x4c(%rbp)
jmp 0x3bb00
movl -0x64(%rbp), %eax
addl -0x5c(%rbp), %eax
movq -0x10(%rbp), %rcx
movl %eax, 0x20(%rcx)
movl %eax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movl $0x0, 0x30(%rax)
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
movslq -0x4c(%rbp), %rax
addq %rax, %rsi
movl -0x50(%rbp), %edx
subl -0x4c(%rbp), %edx
callq 0x3bd30
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl -0x50(%rbp), %edx
leaq -0x4c(%rbp), %rcx
callq 0x3bdf0
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x54(%rbp)
jne 0x3bbac
movl -0x50(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jne 0x3bbac
cmpl $0x20000000, -0x60(%rbp) # imm = 0x20000000
jl 0x3bb90
movq -0x10(%rbp), %rax
movl 0x14(%rax), %esi
movq -0x10(%rbp), %rax
movl 0x28(%rax), %edx
addl $0x1, %edx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
leaq 0x9f37f(%rip), %rdi     # 0xdaf06
movb $0x0, %al
callq 0x35d40
jmp 0x3bbaa
movq -0x10(%rbp), %rdi
movl -0x60(%rbp), %esi
shll %esi
callq 0x3b2f0
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x3bbac
jmp 0x3b948
movq -0x10(%rbp), %rax
cmpb $0x0, 0x34(%rax)
je 0x3bbff
movq -0x48(%rbp), %rax
movl -0x4c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
movq -0x10(%rbp), %rax
cmpl $0x2, 0x38(%rax)
jne 0x3bbfd
movq -0x48(%rbp), %rax
movl -0x4c(%rbp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xd, %eax
jne 0x3bbfd
movq -0x48(%rbp), %rax
movl -0x4c(%rbp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
jmp 0x3bbff
movq -0x10(%rbp), %rax
movl 0x30(%rax), %ecx
movl %ecx, -0x24(%rbp)
movq -0x10(%rbp), %rax
movl %ecx, 0x2c(%rax)
movl -0x4c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x10(%rbp), %rax
movl 0x28(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x28(%rax)
cmpq $0x0, -0x20(%rbp)
je 0x3bc3a
movl -0x4c(%rbp), %ecx
subl -0x24(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x48(%rbp), %rcx
movslq -0x24(%rbp), %rax
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0x3bc6b
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0x3bc80
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)