// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/match_iterator_blast.c
// Function: gt_match_iterator_blast_next
static GtMatchIteratorStatus gt_match_iterator_blast_next(GtMatchIterator *mi,
                                                          GtMatch **match,
                                                          GtError *err)
{
  gt_assert(mi);
  GtUword columncount = 0;
  GtWord storeinteger[GT_BLASTITER_READNUMS], tmp;
  double e_value;
  float bitscore, identity;
  bool reverse = false;
  char query_seq[BUFSIZ], db_seq[BUFSIZ], buffer[BUFSIZ];
  int had_err = 0, i = 0, readvalues = 0;
  GtMatchIteratorBlast *mib = gt_match_iterator_blast_cast(mi);

  if (mib->pvt->matchfilep) {
    if (!mib->pvt->process) {
      while (true) {
        if (fgetc(mib->pvt->matchfilep) == '#') {
          GT_UNUSED char *l = fgets(buffer, BUFSIZ, mib->pvt->matchfilep);
          mib->pvt->curpos++;
        } else break;
      }
    }
    if (!mib->pvt->process)
      fseek(mib->pvt->matchfilep, -1, SEEK_CUR);
    readvalues = fscanf(mib->pvt->matchfilep,
                        "%s %s %f " GT_WD " " GT_WD " " GT_WD " " GT_WD " "
                        GT_WD " " GT_WD " " GT_WD " %lg %f\n",
                        query_seq, db_seq, &identity,
                        &storeinteger[0], &storeinteger[5], &storeinteger[6],
                        &storeinteger[1], &storeinteger[2], &storeinteger[3],
                        &storeinteger[4], &e_value, &bitscore);
    if (readvalues == EOF)
      return GT_MATCHER_STATUS_END;
    if (readvalues != GT_BLASTITER_READVALUES)
    {
      GT_MATCHER_BLAST_CANNOTPARSELINE("invalid format");
      had_err = -1;
    }
  } else {
    while (true) {
      while ((buffer[i] = gt_file_xfgetc(mib->pvt->gtmatchfilep)) != '\n') {
        if (buffer[i] == EOF)
          return GT_MATCHER_STATUS_END;
        i++;
      }
      buffer[i+1] = '\0';
      if (buffer[0] == '#') {
        mib->pvt->curpos++;
        i = 0;
      } else break;
    }
    if ((readvalues = sscanf(buffer, "%s %s %f " GT_WD " " GT_WD " " GT_WD " "
                             GT_WD " " GT_WD " " GT_WD " " GT_WD " %lg " "%f\n",
                             query_seq, db_seq, &identity, &storeinteger[0],
                             &storeinteger[5], &storeinteger[6],
                             &storeinteger[1], &storeinteger[2],
                             &storeinteger[3], &storeinteger[4], &e_value,
                             &bitscore)) != GT_BLASTITER_READVALUES) {
      GT_MATCHER_BLAST_CANNOTPARSELINE("invalid format");
      had_err = -1;
    }
  }

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

  if (!had_err) {
    if (storeinteger[1] > storeinteger[2]) {
      tmp = storeinteger[1];
      gt_assert(!reverse);
      reverse = true;
      storeinteger[1] = storeinteger[2];
      storeinteger[2] = tmp;
    }
    if (storeinteger[3] > storeinteger[4]) {
      tmp = storeinteger[3];
      gt_assert(!reverse);
      reverse = true;
      storeinteger[3] = storeinteger[4];
      storeinteger[4] = tmp;
    }
    *match = gt_match_blast_new_extended(query_seq,
                                         db_seq,
                                         storeinteger[1],
                                         storeinteger[2],
                                         storeinteger[3],
                                         storeinteger[4],
                                         e_value,
                                         bitscore,
                                         storeinteger[0],
                                         identity,
                                         storeinteger[5],
                                         storeinteger[6],
                                         reverse ? GT_MATCH_REVERSE
                                                 : GT_MATCH_DIRECT);
    mib->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 $0x6058, %rsp           # imm = 0x6058
testq %rdi, %rdi
je 0xfd18c
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %r14
callq 0xfc834
movq %rax, %rdi
movq %r14, %rsi
callq 0xfc6cb
movq %rax, %r14
movq 0x8(%rax), %rcx
movq 0x8(%rcx), %rdi
testq %rdi, %rdi
je 0xfcf18
movb 0x20(%rcx), %al
testb %al, %al
jne 0xfcfc5
leaq 0x50(%rsp), %r12
callq 0x17bb0
movq 0x8(%r14), %rcx
cmpl $0x23, %eax
jne 0xfcfc2
movq 0x8(%rcx), %rdx
movq %r12, %rdi
movl $0x2000, %esi           # imm = 0x2000
callq 0x17bc0
movq 0x8(%r14), %rax
incq (%rax)
movq 0x8(%rax), %rdi
jmp 0xfcee1
movq 0x8(%r14), %rcx
incq (%rcx)
xorl %ebx, %ebx
movq 0x10(%rcx), %rdi
callq 0x8d34b
movb %al, 0x50(%rsp,%rbx)
cmpb $0xa, %al
je 0xfcf42
movzbl %al, %eax
cmpl $0xff, %eax
je 0xfd0f3
incq %rbx
movq 0x8(%r14), %rcx
jmp 0xfcf1a
incl %ebx
movb $0x0, 0x50(%rsp,%rbx)
cmpb $0x23, 0x50(%rsp)
je 0xfcf11
movq %r13, 0x8(%rsp)
leaq 0x18(%rsp), %rbx
leaq 0x20(%rsp), %r12
leaq 0x28(%rsp), %r13
leaq 0x30(%rsp), %rbp
leaq 0x4(%rsp), %r10
leaq 0x48(%rsp), %r11
leaq 0x22a4ee(%rip), %rsi    # 0x327468
leaq 0x50(%rsp), %rdi
leaq 0x4050(%rsp), %rdx
leaq 0x2050(%rsp), %rcx
movq %rsp, %r8
leaq 0x10(%rsp), %r9
movl $0x0, %eax
pushq %r10
pushq %r11
pushq %rbp
pushq %r13
pushq %r12
pushq %rbx
leaq 0x70(%rsp), %r10
pushq %r10
leaq 0x70(%rsp), %r10
pushq %r10
callq 0x177b0
addq $0x40, %rsp
jmp 0xfd051
movb 0x20(%rcx), %al
testb $0x1, %al
movq %r13, 0x8(%rsp)
jne 0xfcfe1
movq 0x8(%rcx), %rdi
pushq $-0x1
popq %rsi
pushq $0x1
popq %rdx
callq 0x17840
movq 0x8(%r14), %rcx
movq 0x8(%rcx), %rdi
leaq 0x18(%rsp), %rbx
leaq 0x20(%rsp), %r12
leaq 0x28(%rsp), %r13
leaq 0x30(%rsp), %rbp
leaq 0x4(%rsp), %r10
leaq 0x48(%rsp), %r11
leaq 0x22a45e(%rip), %rsi    # 0x327468
leaq 0x4050(%rsp), %rdx
leaq 0x2050(%rsp), %rcx
movq %rsp, %r8
leaq 0x10(%rsp), %r9
movl $0x0, %eax
pushq %r10
pushq %r11
pushq %rbp
pushq %r13
pushq %r12
pushq %rbx
leaq 0x70(%rsp), %r10
pushq %r10
leaq 0x70(%rsp), %r10
pushq %r10
callq 0x17e10
addq $0x40, %rsp
cmpl $-0x1, %eax
je 0xfd0f3
movb $0x1, %bl
cmpl $0xc, %eax
je 0xfd07d
movq 0x8(%r14), %rax
movq (%rax), %rcx
movq 0x18(%rax), %rdx
leaq 0x22a42b(%rip), %rsi    # 0x327495
leaq 0x22a43a(%rip), %r8     # 0x3274ab
xorl %ebx, %ebx
movq %r15, %rdi
xorl %eax, %eax
callq 0x89dbb
leaq 0x22a436(%rip), %r12    # 0x3274ba
leaq 0x22a451(%rip), %r13    # 0x3274dc
xorl %ebp, %ebp
testb $0x1, %bl
je 0xfd0cb
cmpq $0x6, %rbp
ja 0xfd0cb
cmpq $0x0, 0x10(%rsp,%rbp,8)
setns %bl
js 0xfd0a8
incq %rbp
jmp 0xfd08d
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 0xfd08d
testb $0x1, %bl
je 0xfd0f7
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rsi
cmpq %rsi, %rdx
jle 0xfd0fc
movq %rsi, 0x18(%rsp)
movq %rdx, 0x20(%rsp)
movb $0x1, %al
movq %rdx, %rcx
movq %rsi, %rdx
jmp 0xfd101
pushq $0x1
jmp 0xfd0f9
pushq $0x2
popq %rax
jmp 0xfd17a
xorl %eax, %eax
movq %rsi, %rcx
movq 0x8(%rsp), %rbx
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %r8
cmpq %r8, %rsi
jle 0xfd12e
testb %al, %al
jne 0xfd1c2
movq %r8, 0x28(%rsp)
movq %rsi, 0x30(%rsp)
movb $0x1, %al
movq %rsi, %r9
jmp 0xfd134
movq %r8, %r9
movq %rsi, %r8
movsd 0x48(%rsp), %xmm0
movss 0x4(%rsp), %xmm1
cvtss2sd (%rsp), %xmm2
movzbl %al, %eax
leaq 0x4050(%rsp), %rdi
leaq 0x2050(%rsp), %rsi
pushq %rax
pushq 0x48(%rsp)
pushq 0x48(%rsp)
pushq 0x28(%rsp)
callq 0xfc21f
addq $0x20, %rsp
movq %rax, (%rbx)
movq 0x8(%r14), %rax
incq (%rax)
xorl %eax, %eax
addq $0x6058, %rsp           # imm = 0x6058
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x33add5(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1e7e76(%rip), %rsi    # 0x2e5013
leaq 0x1f393e(%rip), %rdx    # 0x2f0ae2
leaq 0x22a2a0(%rip), %rcx    # 0x32744b
leaq 0x22a1b6(%rip), %r8     # 0x327368
pushq $0x47
popq %r9
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x33ad9f(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1e7e40(%rip), %rsi    # 0x2e5013
leaq 0x22a320(%rip), %rdx    # 0x3274fa
leaq 0x22a26a(%rip), %rcx    # 0x32744b
leaq 0x22a180(%rip), %r8     # 0x327368
movl $0x96, %r9d
jmp 0xfd1b6