// File: rurban[P]dgnlib/cpl_conv.cpp
// Function: CPLReadLine
const char *CPLReadLine( FILE * fp )

{
    char *pszRLBuffer = CPLReadLineBuffer(1);
    int         nReadSoFar = 0;

/* -------------------------------------------------------------------- */
/*      Cleanup case.                                                   */
/* -------------------------------------------------------------------- */
    if( fp == NULL )
    {
        CPLReadLineBuffer( -1 );
        return NULL;
    }

/* -------------------------------------------------------------------- */
/*      Loop reading chunks of the line till we get to the end of       */
/*      the line.                                                       */
/* -------------------------------------------------------------------- */
    int nBytesReadThisTime;

    do {
/* -------------------------------------------------------------------- */
/*      Grow the working buffer if we have it nearly full.  Fail out    */
/*      of read line if we can't reallocate it big enough (for          */
/*      instance for a _very large_ file with no newlines).             */
/* -------------------------------------------------------------------- */
        pszRLBuffer = CPLReadLineBuffer( nReadSoFar + 129 );
        if( pszRLBuffer == NULL )
            return NULL;

/* -------------------------------------------------------------------- */
/*      Do the actual read.                                             */
/* -------------------------------------------------------------------- */
        if( CPLFGets( pszRLBuffer+nReadSoFar, 128, fp ) == NULL )
            return NULL;

        nBytesReadThisTime = strlen(pszRLBuffer+nReadSoFar);
        nReadSoFar += nBytesReadThisTime;

    } while( nBytesReadThisTime >= 127
             && pszRLBuffer[nReadSoFar-1] != 13
             && pszRLBuffer[nReadSoFar-1] != 10 );

    return( pszRLBuffer );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl $0x1, %edi
callq 0x3580
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x34af
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3580
movq $0x0, -0x8(%rbp)
jmp 0x356f
jmp 0x34b1
movl -0x1c(%rbp), %edi
addl $0x81, %edi
callq 0x3580
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x34d7
movq $0x0, -0x8(%rbp)
jmp 0x356f
movq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rax
addq %rax, %rdi
movq -0x10(%rbp), %rdx
movl $0x80, %esi
callq 0x3240
cmpq $0x0, %rax
jne 0x3500
movq $0x0, -0x8(%rbp)
jmp 0x356f
movq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rax
addq %rax, %rdi
callq 0x2120
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
xorl %eax, %eax
cmpl $0x7f, -0x20(%rbp)
movb %al, -0x21(%rbp)
jl 0x355c
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0xd, %ecx
movb %al, -0x21(%rbp)
je 0x355c
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
setne %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x34b1
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)