// File: /workspace/github_c_makefile_star2_O0/skoren[P]bacValidation/bamcat.c
// Function: nextline
static const char *nextline(char **lineptr, size_t *n, const char *text)
{
    int len;
    const char *to = text;

    if ( !*to ) return NULL;

    while ( *to && *to!='\n' && *to!='\r' ) to++;
    len = to - text + 1;

    if ( *to )
    {
        // Advance the pointer for the next call
        if ( *to=='\n' ) to++;
        else if ( *to=='\r' && *(to+1)=='\n' ) to+=2;
    }
    if ( !len )
        return to;

    if ( !*lineptr ) 
    {
        *lineptr = malloc(len);
        *n = len;
    }
    else if ( *n<len ) 
    {
        *lineptr = realloc(*lineptr, len);
        *n = len;
    }
    if ( !*lineptr ) {
		debug("[nextline] Insufficient memory!\n");
		return 0;
	}

    memcpy(*lineptr,text,len);
    (*lineptr)[len-1] = 0;

    return to;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpb $0x0, (%rax)
jne 0xaf02
movq $0x0, -0x8(%rbp)
jmp 0xb071
jmp 0xaf04
movq -0x30(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x31(%rbp)
je 0xaf36
movq -0x30(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0x31(%rbp)
je 0xaf36
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xd, %eax
setne %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0xaf3f
jmp 0xaf4d
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xaf04
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
subq %rcx, %rax
addq $0x1, %rax
movl %eax, -0x24(%rbp)
movq -0x30(%rbp), %rax
cmpb $0x0, (%rax)
je 0xafab
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0xaf82
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xafa9
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xd, %eax
jne 0xafa7
movq -0x30(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0xa, %eax
jne 0xafa7
movq -0x30(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x30(%rbp)
jmp 0xafa9
jmp 0xafab
cmpl $0x0, -0x24(%rbp)
jne 0xafbe
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xb071
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
jne 0xafe8
movslq -0x24(%rbp), %rdi
callq 0x3520
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movslq -0x24(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
jmp 0xb01f
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
cmpq %rcx, %rax
jae 0xb01d
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movslq -0x24(%rbp), %rsi
callq 0x3650
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movslq -0x24(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
jmp 0xb01f
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
jne 0xb041
leaq 0x76a7(%rip), %rdi      # 0x126d7
movb $0x0, %al
callq 0xb9c0
movq $0x0, -0x8(%rbp)
jmp 0xb071
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
movslq -0x24(%rbp), %rdx
callq 0x32d0
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)