// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/fasta_reader_fsm.c
// Function: gt_fasta_reader_fsm_run
static int gt_fasta_reader_fsm_run(GtFastaReader *fasta_reader,
                                   GtFastaReaderProcDescription
                                   proc_description,
                                   GtFastaReaderProcSequencePart
                                   proc_sequence_part,
                                   GtFastaReaderProcSequenceLength
                                   proc_sequence_length,
                                   void *data, GtError *err)
{
  GtFastaReaderFSM *fr = gt_fasta_reader_fsm_cast(fasta_reader);
  unsigned char cc;
  GtFastaReaderState state = EXPECTING_SEPARATOR;
  GtUword sequence_length = 0, line_counter = 1;
  GtStr *description, *sequence;
  int had_err = 0;

  gt_error_check(err);
  gt_assert(fr);

  /* init */
  description = gt_str_new();
  sequence    = gt_str_new();

  /* at least one function has to be defined */
  gt_assert(proc_description || proc_sequence_part || proc_sequence_length);

  /* rewind sequence file (to allow multiple calls) */
  if (fr->sequence_file)
    gt_file_xrewind(fr->sequence_file);

  /* reading */
  while (!had_err && gt_file_xread(fr->sequence_file, &cc, 1) != 0) {
    switch (state) {
      case EXPECTING_SEPARATOR:
        if (cc != GT_FASTA_SEPARATOR) {
          gt_error_set(err,
                    "the first character of fasta file \"%s\" has to be '%c'",
                    gt_str_get(fr->sequence_filename), GT_FASTA_SEPARATOR);
          had_err = -1;
        }
        else
          state = READING_DESCRIPTION;
        break;
      case READING_DESCRIPTION:
        if (cc == '\n') {
          if (proc_description) {
            had_err = proc_description(gt_str_get(description),
                                       gt_str_length(description), data, err);
            if (!had_err)
              gt_str_reset(description);
          }
          if (!had_err) {
            sequence_length = 0;
            line_counter++;
            state = READING_SEQUENCE_AFTER_NEWLINE;
          }
        }
        else if (proc_description && cc != '\r')
          gt_str_append_char(description, cc);
        break;
      case READING_SEQUENCE_AFTER_NEWLINE:
        if (cc == GT_FASTA_SEPARATOR) {
          if (!sequence_length) {
            gt_assert(line_counter);
            gt_error_set(err, "empty sequence after description given in line "
                              ""GT_WU"", line_counter - 1);
            had_err = -1;
            break;
          }
          else {
            if (proc_sequence_part) {
              gt_assert(gt_str_length(sequence));
              had_err = proc_sequence_part(gt_str_get(sequence),
                                           gt_str_length(sequence), data, err);
            }
            if (had_err)
              break;
            gt_str_reset(sequence);
            if (proc_sequence_length)
              had_err = proc_sequence_length(sequence_length, data, err);
            if (had_err)
              break;
            state = READING_DESCRIPTION;
            continue;
          }
        }
        /*@fallthrough@*/
      case READING_SEQUENCE:
        if (cc == '\n') {
          line_counter++;
          state = READING_SEQUENCE_AFTER_NEWLINE;
        }
        else {
          sequence_length++;
          if (proc_sequence_part) {
            if (gt_str_length(sequence) == BUFSIZ) {
              had_err = proc_sequence_part(gt_str_get(sequence),
                                           gt_str_length(sequence), data, err);
              if (had_err)
                break;
              gt_str_reset(sequence);
            }
            if (cc != ' ' && cc != '\r')
              gt_str_append_char(sequence, cc);
          }
        }
        break;
    }
  }

  if (!had_err) {
    /* checks after reading */
    switch (state) {
      case EXPECTING_SEPARATOR:
        gt_error_set(err, "sequence file \"%s\" is empty",
                  gt_str_get(fr->sequence_filename));
        had_err = -1;
        break;
      case READING_DESCRIPTION:
        gt_error_set(err, "unfinished fasta entry in line " GT_WU
                     " of sequence file \"%s\"",
                     line_counter, gt_str_get(fr->sequence_filename));
        had_err = -1;
        break;
      case READING_SEQUENCE_AFTER_NEWLINE:
      case READING_SEQUENCE:
        if (!sequence_length) {
          gt_assert(line_counter);
          gt_error_set(err, "empty sequence after description given in line "
                            ""GT_WU"", line_counter - 1);
          had_err = -1;
        }
        else {
          if (proc_sequence_part) {
            gt_assert(gt_str_length(sequence));
            had_err = proc_sequence_part(gt_str_get(sequence),
                                         gt_str_length(sequence), data, err);
          }
          if (!had_err && proc_sequence_length)
            had_err = proc_sequence_length(sequence_length, data, err);
        }
    }
  }

  /* free */
  gt_str_delete(sequence);
  gt_str_delete(description);

  return had_err;
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, 0xd0(%rsp)
movq %rsi, 0xc8(%rsp)
movq %rdx, 0xc0(%rsp)
movq %rcx, 0xb8(%rsp)
movq %r8, 0xb0(%rsp)
movq %r9, 0xa8(%rsp)
callq 0x158f30
movq %rax, %rdi
movq 0xd0(%rsp), %rsi
callq 0x158eb0
movq %rax, 0xa0(%rsp)
movl $0x0, 0x98(%rsp)
movq $0x0, 0x90(%rsp)
movq $0x1, 0x88(%rsp)
movl $0x0, 0x74(%rsp)
cmpq $0x0, 0xa8(%rsp)
je 0x159015
movq 0xa8(%rsp), %rdi
callq 0x33160
testb $0x1, %al
jne 0x158fdd
jmp 0x159015
movq 0x4a2fe4(%rip), %rax    # 0x5fbfc8
movq (%rax), %rdi
leaq 0x3a25af(%rip), %rsi    # 0x4fb59d
leaq 0x3a277b(%rip), %rdx    # 0x4fb770
leaq 0x3b0ff4(%rip), %rcx    # 0x509ff0
leaq 0x3b1005(%rip), %r8     # 0x50a008
movl $0x36, %r9d
movb $0x0, %al
callq 0x33960
callq 0x2f830
jmp 0x159017
jmp 0x159019
cmpq $0x0, 0xa0(%rsp)
jne 0x15905c
movq 0x4a2f9d(%rip), %rax    # 0x5fbfc8
movq (%rax), %rdi
leaq 0x3a2568(%rip), %rsi    # 0x4fb59d
leaq 0x3b0fe8(%rip), %rdx    # 0x50a024
leaq 0x3b0fad(%rip), %rcx    # 0x509ff0
leaq 0x3b0fbe(%rip), %r8     # 0x50a008
movl $0x37, %r9d
movb $0x0, %al
callq 0x33960
callq 0x2f830
jmp 0x15905e
callq 0x32680
movq %rax, 0x80(%rsp)
callq 0x32680
movq %rax, 0x78(%rsp)
cmpq $0x0, 0xc8(%rsp)
jne 0x1590ce
cmpq $0x0, 0xc0(%rsp)
jne 0x1590ce
cmpq $0x0, 0xb8(%rsp)
jne 0x1590ce
movq 0x4a2f2b(%rip), %rax    # 0x5fbfc8
movq (%rax), %rdi
leaq 0x3a24f6(%rip), %rsi    # 0x4fb59d
leaq 0x3b0f79(%rip), %rdx    # 0x50a027
leaq 0x3b0f3b(%rip), %rcx    # 0x509ff0
leaq 0x3b0f4c(%rip), %r8     # 0x50a008
movl $0x3e, %r9d
movb $0x0, %al
callq 0x33960
callq 0x2f830
jmp 0x1590d0
movq 0xa0(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x1590f0
movq 0xa0(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x2fb40
jmp 0x1590f2
xorl %eax, %eax
cmpl $0x0, 0x74(%rsp)
movb %al, 0x73(%rsp)
jne 0x159127
movq 0xa0(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x9f(%rsp), %rsi
movl $0x1, %edx
callq 0x30280
cmpl $0x0, %eax
setne %al
movb %al, 0x73(%rsp)
movb 0x73(%rsp), %al
testb $0x1, %al
jne 0x159134
jmp 0x15953c
movl 0x98(%rsp), %eax
movq %rax, 0x68(%rsp)
subq $0x3, %rax
ja 0x159537
movq 0x68(%rsp), %rax
leaq 0x3b0e8a(%rip), %rcx    # 0x509fe0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzbl 0x9f(%rsp), %eax
cmpl $0x3e, %eax
je 0x1591af
movq 0xa8(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0xa0(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x33b70
movq 0x60(%rsp), %rdi
movq %rax, %rdx
leaq 0x3b0ecd(%rip), %rsi    # 0x50a066
movl $0x3e, %ecx
movb $0x0, %al
callq 0x31a40
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0x1591ba
movl $0x1, 0x98(%rsp)
jmp 0x159537
movzbl 0x9f(%rsp), %eax
cmpl $0xa, %eax
jne 0x159274
cmpq $0x0, 0xc8(%rsp)
je 0x159240
movq 0xc8(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x80(%rsp), %rdi
callq 0x33b70
movq %rax, 0x50(%rsp)
movq 0x80(%rsp), %rdi
callq 0x31eb0
movq 0x50(%rsp), %rdi
movq %rax, %rsi
movq 0x58(%rsp), %rax
movq 0xb0(%rsp), %rdx
movq 0xa8(%rsp), %rcx
callq *%rax
movl %eax, 0x74(%rsp)
cmpl $0x0, 0x74(%rsp)
jne 0x15923e
movq 0x80(%rsp), %rdi
callq 0x33720
jmp 0x159240
cmpl $0x0, 0x74(%rsp)
jne 0x159272
movq $0x0, 0x90(%rsp)
movq 0x88(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x88(%rsp)
movl $0x2, 0x98(%rsp)
jmp 0x1592a3
cmpq $0x0, 0xc8(%rsp)
je 0x1592a1
movzbl 0x9f(%rsp), %eax
cmpl $0xd, %eax
je 0x1592a1
movq 0x80(%rsp), %rdi
movsbl 0x9f(%rsp), %esi
callq 0x333e0
jmp 0x1592a3
jmp 0x159537
movzbl 0x9f(%rsp), %eax
cmpl $0x3e, %eax
jne 0x159441
cmpq $0x0, 0x90(%rsp)
jne 0x15933a
jmp 0x1592c6
cmpq $0x0, 0x88(%rsp)
jne 0x159309
movq 0x4a2cf0(%rip), %rax    # 0x5fbfc8
movq (%rax), %rdi
leaq 0x3a22bb(%rip), %rsi    # 0x4fb59d
leaq 0x3b0db3(%rip), %rdx    # 0x50a09c
leaq 0x3b0d00(%rip), %rcx    # 0x509ff0
leaq 0x3b0d11(%rip), %r8     # 0x50a008
movl $0x65, %r9d
movb $0x0, %al
callq 0x33960
callq 0x2f830
jmp 0x15930b
movq 0xa8(%rsp), %rdi
movq 0x88(%rsp), %rdx
subq $0x1, %rdx
leaq 0x3b0d83(%rip), %rsi    # 0x50a0a9
movb $0x0, %al
callq 0x31a40
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0x159537
cmpq $0x0, 0xc0(%rsp)
je 0x1593de
jmp 0x15934b
movq 0x78(%rsp), %rdi
callq 0x31eb0
cmpq $0x0, %rax
jne 0x159393
movq 0x4a2c66(%rip), %rax    # 0x5fbfc8
movq (%rax), %rdi
leaq 0x3a2231(%rip), %rsi    # 0x4fb59d
leaq 0x3b0e56(%rip), %rdx    # 0x50a1c9
leaq 0x3b0c76(%rip), %rcx    # 0x509ff0
leaq 0x3b0c87(%rip), %r8     # 0x50a008
movl $0x6d, %r9d
movb $0x0, %al
callq 0x33960
callq 0x2f830
jmp 0x159395
movq 0xc0(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x78(%rsp), %rdi
callq 0x33b70
movq %rax, 0x40(%rsp)
movq 0x78(%rsp), %rdi
callq 0x31eb0
movq 0x40(%rsp), %rdi
movq %rax, %rsi
movq 0x48(%rsp), %rax
movq 0xb0(%rsp), %rdx
movq 0xa8(%rsp), %rcx
callq *%rax
movl %eax, 0x74(%rsp)
cmpl $0x0, 0x74(%rsp)
je 0x1593ea
jmp 0x159537
movq 0x78(%rsp), %rdi
callq 0x33720
cmpq $0x0, 0xb8(%rsp)
je 0x159425
movq 0xb8(%rsp), %rax
movq 0x90(%rsp), %rdi
movq 0xb0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
callq *%rax
movl %eax, 0x74(%rsp)
cmpl $0x0, 0x74(%rsp)
je 0x159431
jmp 0x159537
movl $0x1, 0x98(%rsp)
jmp 0x1590f2
jmp 0x159443
movzbl 0x9f(%rsp), %eax
cmpl $0xa, %eax
jne 0x159474
movq 0x88(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x88(%rsp)
movl $0x2, 0x98(%rsp)
jmp 0x159535
movq 0x90(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x90(%rsp)
cmpq $0x0, 0xc0(%rsp)
je 0x159533
movq 0x78(%rsp), %rdi
callq 0x31eb0
cmpq $0x2000, %rax           # imm = 0x2000
jne 0x159505
movq 0xc0(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x78(%rsp), %rdi
callq 0x33b70
movq %rax, 0x30(%rsp)
movq 0x78(%rsp), %rdi
callq 0x31eb0
movq 0x30(%rsp), %rdi
movq %rax, %rsi
movq 0x38(%rsp), %rax
movq 0xb0(%rsp), %rdx
movq 0xa8(%rsp), %rcx
callq *%rax
movl %eax, 0x74(%rsp)
cmpl $0x0, 0x74(%rsp)
je 0x1594fb
jmp 0x159537
movq 0x78(%rsp), %rdi
callq 0x33720
movzbl 0x9f(%rsp), %eax
cmpl $0x20, %eax
je 0x159531
movzbl 0x9f(%rsp), %eax
cmpl $0xd, %eax
je 0x159531
movq 0x78(%rsp), %rdi
movsbl 0x9f(%rsp), %esi
callq 0x333e0
jmp 0x159533
jmp 0x159535
jmp 0x159537
jmp 0x1590f2
cmpl $0x0, 0x74(%rsp)
jne 0x15976d
movl 0x98(%rsp), %eax
movl %eax, 0x2c(%rsp)
testl %eax, %eax
je 0x159578
jmp 0x159558
movl 0x2c(%rsp), %eax
subl $0x1, %eax
je 0x1595b9
jmp 0x159563
movl 0x2c(%rsp), %eax
addl $-0x2, %eax
subl $0x2, %eax
jb 0x15960c
jmp 0x15976b
movq 0xa8(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0xa0(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x33b70
movq 0x20(%rsp), %rdi
movq %rax, %rdx
leaq 0x3b0b37(%rip), %rsi    # 0x50a0dc
movb $0x0, %al
callq 0x31a40
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0x15976b
movq 0xa8(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0xa0(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x33b70
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rdx
movq %rax, %rcx
leaq 0x3b0b00(%rip), %rsi    # 0x50a0f8
movb $0x0, %al
callq 0x31a40
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0x15976b
cmpq $0x0, 0x90(%rsp)
jne 0x15968d
jmp 0x159619
cmpq $0x0, 0x88(%rsp)
jne 0x15965c
movq 0x4a299d(%rip), %rax    # 0x5fbfc8
movq (%rax), %rdi
leaq 0x3a1f68(%rip), %rsi    # 0x4fb59d
leaq 0x3b0a60(%rip), %rdx    # 0x50a09c
leaq 0x3b09ad(%rip), %rcx    # 0x509ff0
leaq 0x3b09be(%rip), %r8     # 0x50a008
movl $0xa5, %r9d
movb $0x0, %al
callq 0x33960
callq 0x2f830
jmp 0x15965e
movq 0xa8(%rsp), %rdi
movq 0x88(%rsp), %rdx
subq $0x1, %rdx
leaq 0x3b0a30(%rip), %rsi    # 0x50a0a9
movb $0x0, %al
callq 0x31a40
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0x159769
cmpq $0x0, 0xc0(%rsp)
je 0x15972f
jmp 0x15969e
movq 0x78(%rsp), %rdi
callq 0x31eb0
cmpq $0x0, %rax
jne 0x1596e6
movq 0x4a2913(%rip), %rax    # 0x5fbfc8
movq (%rax), %rdi
leaq 0x3a1ede(%rip), %rsi    # 0x4fb59d
leaq 0x3b0b03(%rip), %rdx    # 0x50a1c9
leaq 0x3b0923(%rip), %rcx    # 0x509ff0
leaq 0x3b0934(%rip), %r8     # 0x50a008
movl $0xac, %r9d
movb $0x0, %al
callq 0x33960
callq 0x2f830
jmp 0x1596e8
movq 0xc0(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x78(%rsp), %rdi
callq 0x33b70
movq %rax, (%rsp)
movq 0x78(%rsp), %rdi
callq 0x31eb0
movq (%rsp), %rdi
movq %rax, %rsi
movq 0x8(%rsp), %rax
movq 0xb0(%rsp), %rdx
movq 0xa8(%rsp), %rcx
callq *%rax
movl %eax, 0x74(%rsp)
cmpl $0x0, 0x74(%rsp)
jne 0x159767
cmpq $0x0, 0xb8(%rsp)
je 0x159767
movq 0xb8(%rsp), %rax
movq 0x90(%rsp), %rdi
movq 0xb0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
callq *%rax
movl %eax, 0x74(%rsp)
jmp 0x159769
jmp 0x15976b
jmp 0x15976d
movq 0x78(%rsp), %rdi
callq 0x34040
movq 0x80(%rsp), %rdi
callq 0x34040
movl 0x74(%rsp), %eax
addq $0xd8, %rsp
retq