// File: /workspace/github_c_makefile_star2_O1/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 %r12
pushq %rbx
testq %rdi, %rdi
je 0x3c85c
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x10(%rdi), %r14
movq %r15, %rdi
callq 0x75720
movl %eax, %r12d
cmpl $-0x1, %eax
je 0x3c824
cmpl $0xd, %r12d
je 0x3c75d
cmpl $0xa, %r12d
je 0x3c829
movq 0x8(%rbx), %rdx
addq $0x2, %rdx
cmpq 0x10(%rbx), %rdx
jbe 0x3c748
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x73b98
movq %rax, (%rbx)
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%rbx)
movb %r12b, (%rax,%rcx)
jmp 0x3c708
movq %r15, %rdi
callq 0x75720
cmpl $0xa, %eax
je 0x3c7aa
movl %eax, %r12d
cmpl $-0x1, %eax
jne 0x3c7d6
movq 0x8(%rbx), %rdx
addq $0x2, %rdx
cmpq 0x10(%rbx), %rdx
jbe 0x3c78e
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x73b98
movq %rax, (%rbx)
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%rbx)
movb $0xd, (%rax,%rcx)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorl %eax, %eax
jmp 0x3c81a
movq 0x8(%rbx), %rdx
incq %rdx
cmpq 0x10(%rbx), %rdx
jbe 0x3c7c5
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x73b98
movq %rax, (%rbx)
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
movb $0x0, (%rax,%rcx)
xorl %eax, %eax
xorl %ebp, %ebp
jmp 0x3c81a
movq 0x8(%rbx), %rdx
addq $0x3, %rdx
cmpq 0x10(%rbx), %rdx
jbe 0x3c7f2
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x73b98
movq %rax, (%rbx)
movq (%rbx), %rax
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 %r12b, (%rax,%rcx)
movb $0x1, %al
testb %al, %al
jne 0x3c708
jmp 0x3c851
movl %r12d, %ebp
jmp 0x3c851
movq 0x8(%rbx), %rdx
incq %rdx
cmpq 0x10(%rbx), %rdx
jbe 0x3c844
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x73b98
movq %rax, (%rbx)
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
movb $0x0, (%rax,%rcx)
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0xe26d