// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/core/str.c
// Function: gt_str_read_next_line_generic
int gt_str_read_next_line_generic(GtStr *s, GtFile *fpin)
{
  int cc;
  char c;
  gt_assert(s);
  for (;;) {
    cc = gt_file_xfgetc(fpin);
    if (cc == EOF)
      return EOF;
    if (cc == '\n') {
      if ((s->length+1) * sizeof (char) > s->allocated) {
        s->cstr = gt_dynalloc(s->cstr, &s->allocated,
                              (s->length+1) * sizeof (char));
      }
      s->cstr[s->length] = '\0';
      return 0;
    }
    else if (cc == '\r') {
      /* check if we have a Windows newline "\r\n" */
      int ncc;
      char nc;
      ncc = gt_file_xfgetc(fpin);
      if (ncc == EOF) {
        c = cc;
        if ((s->length+2) * sizeof (char) > s->allocated) {
          s->cstr = gt_dynalloc(s->cstr, &s->allocated,
                                (s->length+2) * sizeof (char));
        }
        s->cstr[s->length++] = c;
        return EOF;
      }
      if (ncc == '\n') {
        if ((s->length+1) * sizeof (char) > s->allocated) {
          s->cstr = gt_dynalloc(s->cstr, &s->allocated,
                                (s->length+1) * sizeof (char));
        }
        s->cstr[s->length] = '\0';
        return 0;
      }
      c = cc;
      nc = ncc;
      if ((s->length+3) * sizeof (char) > s->allocated) {
        s->cstr = gt_dynalloc(s->cstr, &s->allocated,
                              (s->length+3) * sizeof (char));
      }
      s->cstr[s->length++] = c;
      s->cstr[s->length++] = nc;
      continue;
    }
    c = cc;
    if ((s->length+2) * sizeof (char) > s->allocated) {
      s->cstr = gt_dynalloc(s->cstr, &s->allocated,
                            (s->length+2) * sizeof (char));
    }
    s->cstr[s->length++] = c;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x14931
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x10(%rdi), %r14
movq %r15, %rdi
callq 0x541f3
cmpl $0xd, %eax
je 0x1486c
movl %eax, %ebp
cmpl $-0x1, %eax
je 0x14924
cmpl $0xa, %ebp
je 0x148c7
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
leaq 0x2(%rcx), %rdx
cmpq 0x10(%rbx), %rdx
jbe 0x148b6
movq %rax, %rdi
movq %r14, %rsi
callq 0x516a0
movq %rax, (%rbx)
jmp 0x148b2
movq %r15, %rdi
callq 0x541f3
cmpl $0xa, %eax
je 0x148c7
movl %eax, %ebp
cmpl $-0x1, %eax
je 0x148f2
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
leaq 0x3(%rcx), %rdx
cmpq 0x10(%rbx), %rdx
jbe 0x148a3
movq %rax, %rdi
movq %r14, %rsi
callq 0x516a0
movq %rax, (%rbx)
movq 0x8(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%rbx)
movb $0xd, (%rax,%rcx)
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%rbx)
movb %bpl, (%rax,%rcx)
jmp 0x1482e
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
leaq 0x1(%rcx), %rdx
cmpq 0x10(%rbx), %rdx
jbe 0x148ea
movq %rax, %rdi
movq %r14, %rsi
callq 0x516a0
movq %rax, (%rbx)
movq 0x8(%rbx), %rcx
movb $0x0, (%rax,%rcx)
xorl %ebp, %ebp
jmp 0x14924
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
leaq 0x2(%rcx), %rdx
cmpq 0x10(%rbx), %rdx
jbe 0x14915
movq %rax, %rdi
movq %r14, %rsi
callq 0x516a0
movq %rax, (%rbx)
movq 0x8(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%rbx)
movb $0xd, (%rax,%rcx)
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x119680(%rip), %rax    # 0x12dfb8
movq (%rax), %rdi
leaq 0xb5724(%rip), %rsi     # 0xca066
leaq 0xc3161(%rip), %rdx     # 0xd7aaa
leaq 0xb7d58(%rip), %rcx     # 0xcc6a8
leaq 0xb7b96(%rip), %r8      # 0xcc4ed
movl $0x144, %r9d            # imm = 0x144
xorl %eax, %eax
callq 0xb8c0
callq 0xb300