// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/match_iterator_open.c
// Function: gt_match_iterator_open_next
static GtMatchIteratorStatus gt_match_iterator_open_next(GtMatchIterator *gmpi,
                                                         GtMatch **match,
                                                         GtError *err)
{
  GtUword columncount = 0;
  int readnums;
  GtWord storeinteger[GT_MATCHITER_READNUMS];
  int had_err = 0, i = 0;
  char buffer[BUFSIZ], seqid1[BUFSIZ], seqid2[BUFSIZ], matchtype;
  GtMatchIteratorOpen *mpi = gt_match_iterator_open_cast(gmpi);
  gt_assert(mpi);

  if (mpi->pvt->matchfilep) {
    while (true) {
      if (fgetc(mpi->pvt->matchfilep) == '#') {
        GT_UNUSED char *l = fgets(buffer, BUFSIZ, mpi->pvt->matchfilep);
        mpi->pvt->curpos++;
      } else break;
    }
    fseek(mpi->pvt->matchfilep, -1, SEEK_CUR);
    readnums = fscanf(mpi->pvt->matchfilep, " " GT_WD " %s " GT_WD " %c " GT_WD
                      " %s " GT_WD " %*d %*e " GT_WD " %*f\n",
                      &storeinteger[0],
                      seqid1,
                      &storeinteger[1],
                      &matchtype,
                      &storeinteger[2],
                      seqid2,
                      &storeinteger[3],
                      &storeinteger[4]);
    if (readnums == EOF)
      return GT_MATCHER_STATUS_END;
    if (readnums != GT_MATCHITER_READNUMS + 3)
    {
      GT_MATCHER_OPEN_CANNOTPARSELINE("invalid format");
      had_err = -1;
    }
  } else {
    while (true) {
      while ((buffer[i] = gt_file_xfgetc(mpi->pvt->gtmatchfilep)) != '\n') {
        if (buffer[i] == EOF)
          return GT_MATCHER_STATUS_END;
        i++;
      }
      buffer[i+1] = '\0';
      if (buffer[0] == '#') {
        mpi->pvt->curpos++;
        i = 0;
      } else break;
    }
    if (sscanf(buffer, " " GT_WD " %s " GT_WD " %*c " GT_WD " %s " GT_WD
               " %*d %*e " GT_WD " %*f\n",
               &storeinteger[0],
               seqid1,
               &storeinteger[1],
               &storeinteger[2],
               seqid2,
               &storeinteger[3],
               &storeinteger[4])
               != GT_MATCHITER_READNUMS + 2) {
      GT_MATCHER_OPEN_CANNOTPARSELINE("invalid format");
      had_err = -1;
    }
  }

  for (columncount = 0; !had_err &&
                        columncount < (GtUword) GT_MATCHITER_READNUMS;
       columncount++) {
    if (storeinteger[columncount] < 0) {
         GT_MATCHER_OPEN_CANNOTPARSECOLUMN("non-negative integer expected");
          had_err = -1;
     }
   }

  if (!had_err) {
    *match = gt_match_open_new(seqid1,
                               seqid2,
                               storeinteger[1],
                               storeinteger[1] + storeinteger[0] - 1,
                               storeinteger[3],
                               storeinteger[3] + storeinteger[2] - 1,
                               storeinteger[4],
                               matchtype == 'D' ? GT_MATCH_DIRECT :
                                                  GT_MATCH_REVERSE);
    mpi->pvt->curpos++;
    return GT_MATCHER_STATUS_OK;
  }
  else {
    return GT_MATCHER_STATUS_ERROR;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x6048, %rsp           # imm = 0x6048
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %r14
callq 0xfe55b
movq %rax, %rdi
movq %r14, %rsi
callq 0xfc6cb
testq %rax, %rax
je 0xfe809
movq %rax, %r14
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
testq %rdi, %rdi
je 0xfe615
leaq 0x40(%rsp), %r12
callq 0x17bb0
movq 0x8(%r14), %rcx
movq 0x8(%rcx), %rdx
cmpl $0x23, %eax
jne 0xfe6a7
movq %r12, %rdi
movl $0x2000, %esi           # imm = 0x2000
callq 0x17bc0
movq 0x8(%r14), %rax
incq (%rax)
movq 0x8(%rax), %rdi
jmp 0xfe5de
movq 0x8(%r14), %rax
incq (%rax)
xorl %ebx, %ebx
movq 0x10(%rax), %rdi
callq 0x8d34b
movb %al, 0x40(%rsp,%rbx)
cmpb $0xa, %al
je 0xfe63f
movzbl %al, %eax
cmpl $0xff, %eax
je 0xfe7f2
incq %rbx
movq 0x8(%r14), %rax
jmp 0xfe617
incl %ebx
movb $0x0, 0x40(%rsp,%rbx)
cmpb $0x23, 0x40(%rsp)
je 0xfe60e
movq %r13, 0x38(%rsp)
leaq 0x18(%rsp), %r8
leaq 0x20(%rsp), %r9
leaq 0x28(%rsp), %r10
leaq 0x30(%rsp), %r11
subq $0x8, %rsp
leaq 0x2048(%rsp), %rbx
leaq 0x229225(%rip), %rsi    # 0x32789e
leaq 0x48(%rsp), %rdi
leaq 0x18(%rsp), %rdx
leaq 0x4048(%rsp), %rcx
xorl %eax, %eax
pushq %r11
pushq %r10
pushq %rbx
callq 0x177b0
addq $0x20, %rsp
movb $0x1, %bl
cmpl $0x7, %eax
jne 0xfe71b
jmp 0xfe740
pushq $-0x1
popq %rsi
pushq $0x1
popq %rbp
movq %rdx, %rdi
movl %ebp, %edx
callq 0x17840
movq 0x8(%r14), %rax
movq 0x8(%rax), %rdi
leaq 0x18(%rsp), %r8
leaq 0x20(%rsp), %r10
leaq 0x28(%rsp), %r11
leaq 0x30(%rsp), %rbx
leaq 0x2040(%rsp), %r12
leaq 0x229191(%rip), %rsi    # 0x327873
leaq 0x10(%rsp), %rdx
leaq 0x4040(%rsp), %rcx
leaq 0xf(%rsp), %r9
xorl %eax, %eax
pushq %rbx
pushq %r11
pushq %r12
pushq %r10
callq 0x17e10
addq $0x20, %rsp
cmpl $-0x1, %eax
je 0xfe7f5
movq %r13, 0x38(%rsp)
movb $0x1, %bl
cmpl $0x8, %eax
je 0xfe740
movq 0x8(%r14), %rax
movq (%rax), %rcx
movq 0x18(%rax), %rdx
leaq 0x228d68(%rip), %rsi    # 0x327495
leaq 0x228d77(%rip), %r8     # 0x3274ab
xorl %ebx, %ebx
movq %r15, %rdi
xorl %eax, %eax
callq 0x89dbb
leaq 0x228d73(%rip), %r12    # 0x3274ba
leaq 0x228d8e(%rip), %r13    # 0x3274dc
xorl %ebp, %ebp
testb $0x1, %bl
je 0xfe78e
cmpq $0x4, %rbp
ja 0xfe78e
cmpq $0x0, 0x10(%rsp,%rbp,8)
setns %bl
js 0xfe76b
incq %rbp
jmp 0xfe750
movq 0x8(%r14), %rax
movq (%rax), %rcx
movq 0x18(%rax), %rdx
incq %rbp
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %r8
movq %r13, %r9
xorl %eax, %eax
callq 0x89dbb
jmp 0xfe750
testb $0x1, %bl
je 0xfe7ee
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rdx
leaq (%rdx,%rax), %rcx
decq %rcx
movq 0x28(%rsp), %r8
movq 0x20(%rsp), %rax
leaq (%r8,%rax), %r9
decq %r9
xorl %eax, %eax
cmpb $0x44, 0xf(%rsp)
setne %al
leaq 0x4040(%rsp), %rdi
leaq 0x2040(%rsp), %rsi
pushq %rax
pushq 0x38(%rsp)
callq 0xff01a
popq %rcx
popq %rdx
movq 0x38(%rsp), %rcx
movq %rax, (%rcx)
movq 0x8(%r14), %rax
incq (%rax)
xorl %ebp, %ebp
jmp 0xfe7f5
pushq $0x2
jmp 0xfe7f4
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x6048, %rsp           # imm = 0x6048
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x339758(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1e67f9(%rip), %rsi    # 0x2e5013
leaq 0x229032(%rip), %rdx    # 0x327853
leaq 0x22902f(%rip), %rcx    # 0x327857
leaq 0x228fd2(%rip), %r8     # 0x327801
pushq $0x46
popq %r9
xorl %eax, %eax
callq 0x17a50
callq 0x17390