// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/diagbandseed.c
// Function: gt_diagbandseed_segment2matches
static void gt_diagbandseed_segment2matches(
             void *v_segment2matches_info,
             GT_UNUSED const GtEncseq *aencseq,
             GT_UNUSED const GtEncseq *bencseq,
             GtUword aseqnum,
             GtUword bseqnum,
             const GtDiagbandStruct *diagband_struct,
             const GtDiagbandseedMaximalmatch *memstore,
             unsigned int seedlength,
             const GtSeedpairPositions *segment_positions,
             GtUword segment_length)
{
  GtDiagbandseedExtendSegmentInfo *esi
    = (GtDiagbandseedExtendSegmentInfo *) v_segment2matches_info;
  bool found_selected = false, haspreviousmatch = false;
  GtUword idx, matchlength = seedlength;
  GtArrayGtDiagbandseedRectangle *previous_extensions = NULL;

  if (esi->use_apos > 0)
  {
    previous_extensions = gt_rectangle_store_new();
  }
  gt_assert(memstore != NULL || segment_positions != NULL);
  for (idx = 0; idx < segment_length; idx++)
  {
    GtDiagbandseedPosition apos, bpos;
    GtUword coverage;

    if (memstore != NULL)
    {
      apos = memstore[idx].apos;
      bpos = memstore[idx].bpos;
      matchlength = memstore[idx].len;
    } else
    {
      apos = segment_positions[idx].apos;
      bpos = segment_positions[idx].bpos;
    }
    if (esi->debug)
    {
      printf("# apos=%u,bpos=%u,matchlength=" GT_WU "\n",
             apos,bpos,matchlength);
    }

    /* The filter sums the score of the current diagonalband
       as well as the maximum of the score of the previous and next
       diagonal band */
    coverage = gt_diagband_struct_coverage(diagband_struct,apos,bpos);
    if (coverage >= esi->mincoverage)
    {
      int ret;

      if (esi->dbs_state != NULL)
      {
        esi->dbs_state->selected_seeds++;
      }
      if (!found_selected)
      {
        if (esi->dbs_state != NULL)
        {
          esi->dbs_state->seqpairs_with_minsegment++;
        }
        found_selected = true;
      }
      if (esi->only_selected_seqpairs)
      {
        printf("# " GT_WU "%c" GT_WU "\n",aseqnum,
               esi->query_readmode == GT_READMODE_REVCOMPL ? '-' : '+',
               bseqnum);
        break;
      }
      ret = gt_diagbandseed_possibly_extend(
                     previous_extensions,
                     haspreviousmatch,
                     esi->use_apos,
                     aseqnum,
                     apos,
                     bseqnum,
                     bpos,
                     matchlength,
                     esi);
      if (ret >= 1 && esi->dbs_state != NULL)
      {
        esi->dbs_state->extended_seeds++;
      }
      if (ret >= 2)
      {
        haspreviousmatch = true;
        if (esi->use_apos == 2 || /* add all previous matches */
            (esi->use_apos == 1 /* only add successful match */
             && ret == 3))
        {
          GtDiagbandseedRectangle newrectangle;

          newrectangle.a_start
            = esi->info_querymatch.previous_match_a_start;
          newrectangle.a_end = esi->info_querymatch.previous_match_a_end;
          newrectangle.b_start
            = esi->info_querymatch.previous_match_b_start;
          newrectangle.b_end
            = esi->info_querymatch.previous_match_b_end;
          if (esi->debug)
          {
            printf("# add rectangle (%u,%u) (%u,%u) from seed (%u,%u,"
                   GT_WU ")\n",
                    newrectangle.a_start,
                    newrectangle.a_end,
                    newrectangle.b_start,
                    newrectangle.b_end,
                    apos,bpos,matchlength);
          }
          gt_rectangle_store_add(previous_extensions,&newrectangle);
        }
        if (ret == 2 && esi->dbs_state != NULL)
        {
          esi->dbs_state->failedmatches++;
        }
      }
      if (ret == 3)
      {
        if (esi->dbs_state != NULL)
        {
          esi->dbs_state->countmatches++;
        }
        if (esi->segment_reject_func != NULL)
        {
          gt_segment_reject_register_match(esi->segment_reject_info,bseqnum);
          break;
        }
      }
    } else
    {
      if (esi->dbs_state != NULL)
      {
        esi->dbs_state->filteredbydiagonalscore++;
      }
      if (esi->debug)
      {
        printf("# filtered as diagonal score " GT_WU " < " GT_WU "\n",
               coverage,
               esi->mincoverage);
      }
    }
  }
  if (esi->use_apos > 0)
  {
    gt_rectangle_store_delete(previous_extensions);
  }
}

// Assembly:
subq $0x98, %rsp
movq 0xb8(%rsp), %rax
movq 0xb0(%rsp), %rax
movl 0xa8(%rsp), %eax
movq 0xa0(%rsp), %rax
movq %rdi, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
movq %rdx, 0x80(%rsp)
movq %rcx, 0x78(%rsp)
movq %r8, 0x70(%rsp)
movq %r9, 0x68(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0x60(%rsp)
movb $0x0, 0x5f(%rsp)
movb $0x0, 0x5e(%rsp)
movl 0xa8(%rsp), %eax
movq %rax, 0x48(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x60(%rsp), %rax
cmpq $0x0, 0x10(%rax)
jbe 0x21bc4f
callq 0x2a94a0
movq %rax, 0x40(%rsp)
jmp 0x21bc51
cmpq $0x0, 0xa0(%rsp)
jne 0x21bc9f
cmpq $0x0, 0xb0(%rsp)
jne 0x21bc9f
movq 0x420332(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2fa39b(%rip), %rsi    # 0x516013
leaq 0x357b82(%rip), %rdx    # 0x573801
leaq 0x357ba9(%rip), %rcx    # 0x57382f
leaq 0x356307(%rip), %r8     # 0x571f94
movl $0xc5d, %r9d            # imm = 0xC5D
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x21bca1
movq $0x0, 0x50(%rsp)
movq 0x50(%rsp), %rax
cmpq 0xb8(%rsp), %rax
jae 0x21c06a
cmpq $0x0, 0xa0(%rsp)
je 0x21bd12
movq 0xa0(%rsp), %rax
imulq $0xc, 0x50(%rsp), %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, 0x3c(%rsp)
movq 0xa0(%rsp), %rax
imulq $0xc, 0x50(%rsp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, 0x38(%rsp)
movq 0xa0(%rsp), %rax
imulq $0xc, 0x50(%rsp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq %rax, 0x48(%rsp)
jmp 0x21bd3b
movq 0xb0(%rsp), %rax
movq 0x50(%rsp), %rcx
movl (%rax,%rcx,8), %eax
movl %eax, 0x3c(%rsp)
movq 0xb0(%rsp), %rax
movq 0x50(%rsp), %rcx
movl 0x4(%rax,%rcx,8), %eax
movl %eax, 0x38(%rsp)
movq 0x60(%rsp), %rax
testb $0x1, 0x105(%rax)
je 0x21bd64
movl 0x3c(%rsp), %esi
movl 0x38(%rsp), %edx
movq 0x48(%rsp), %rcx
leaq 0x357af2(%rip), %rdi    # 0x57384f
movb $0x0, %al
callq 0x19070
movq 0x68(%rsp), %rdi
movl 0x3c(%rsp), %esi
movl 0x38(%rsp), %edx
callq 0x4a3540
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq 0x60(%rsp), %rcx
cmpq 0x18(%rcx), %rax
jb 0x21c002
movq 0x60(%rsp), %rax
cmpq $0x0, 0x190(%rax)
je 0x21bdb6
movq 0x60(%rsp), %rax
movq 0x190(%rax), %rax
movq 0x18(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rax)
testb $0x1, 0x5f(%rsp)
jne 0x21bde9
movq 0x60(%rsp), %rax
cmpq $0x0, 0x190(%rax)
je 0x21bde4
movq 0x60(%rsp), %rax
movq 0x190(%rax), %rax
movq 0x30(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x30(%rax)
movb $0x1, 0x5f(%rsp)
movq 0x60(%rsp), %rax
testb $0x1, 0x20(%rax)
je 0x21be2c
movq 0x78(%rsp), %rsi
movq 0x60(%rsp), %rax
movl 0x100(%rax), %ecx
movl $0x2b, %edx
movl $0x2d, %eax
cmpl $0x3, %ecx
cmovel %eax, %edx
movq 0x70(%rsp), %rcx
leaq 0x357a52(%rip), %rdi    # 0x573872
movb $0x0, %al
callq 0x19070
jmp 0x21c06a
movq 0x40(%rsp), %rdi
movb 0x5e(%rsp), %sil
movq 0x60(%rsp), %rax
movq 0x10(%rax), %rdx
movq 0x78(%rsp), %rcx
movl 0x3c(%rsp), %eax
movl %eax, %r8d
movq 0x70(%rsp), %r9
movl 0x38(%rsp), %eax
movl %eax, %r11d
movq 0x48(%rsp), %r10
movq 0x60(%rsp), %rax
andb $0x1, %sil
movzbl %sil, %esi
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x21d160
movl %eax, 0x2c(%rsp)
cmpl $0x1, 0x2c(%rsp)
jl 0x21beae
movq 0x60(%rsp), %rax
cmpq $0x0, 0x190(%rax)
je 0x21beae
movq 0x60(%rsp), %rax
movq 0x190(%rax), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
cmpl $0x2, 0x2c(%rsp)
jl 0x21bfa9
movb $0x1, 0x5e(%rsp)
movq 0x60(%rsp), %rax
cmpq $0x2, 0x10(%rax)
je 0x21bee5
movq 0x60(%rsp), %rax
cmpq $0x1, 0x10(%rax)
jne 0x21bf79
cmpl $0x3, 0x2c(%rsp)
jne 0x21bf79
movq 0x60(%rsp), %rax
movq 0x128(%rax), %rax
movl %eax, 0x1c(%rsp)
movq 0x60(%rsp), %rax
movq 0x130(%rax), %rax
movl %eax, 0x20(%rsp)
movq 0x60(%rsp), %rax
movq 0x138(%rax), %rax
movl %eax, 0x24(%rsp)
movq 0x60(%rsp), %rax
movq 0x140(%rax), %rax
movl %eax, 0x28(%rsp)
movq 0x60(%rsp), %rax
testb $0x1, 0x105(%rax)
je 0x21bf6a
movl 0x1c(%rsp), %esi
movl 0x20(%rsp), %edx
movl 0x24(%rsp), %ecx
movl 0x28(%rsp), %r8d
movl 0x3c(%rsp), %r9d
movl 0x38(%rsp), %r10d
movq 0x48(%rsp), %rax
leaq 0x357924(%rip), %rdi    # 0x57387e
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x19070
movq 0x40(%rsp), %rdi
leaq 0x1c(%rsp), %rsi
callq 0x2a9560
cmpl $0x2, 0x2c(%rsp)
jne 0x21bfa7
movq 0x60(%rsp), %rax
cmpq $0x0, 0x190(%rax)
je 0x21bfa7
movq 0x60(%rsp), %rax
movq 0x190(%rax), %rax
movq 0x28(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x28(%rax)
jmp 0x21bfa9
cmpl $0x3, 0x2c(%rsp)
jne 0x21c000
movq 0x60(%rsp), %rax
cmpq $0x0, 0x190(%rax)
je 0x21bfd7
movq 0x60(%rsp), %rax
movq 0x190(%rax), %rax
movq 0x20(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x20(%rax)
movq 0x60(%rsp), %rax
cmpq $0x0, 0x160(%rax)
je 0x21bffe
movq 0x60(%rsp), %rax
movq 0x168(%rax), %rdi
movq 0x70(%rsp), %rsi
callq 0x21d830
jmp 0x21c06a
jmp 0x21c000
jmp 0x21c055
movq 0x60(%rsp), %rax
cmpq $0x0, 0x190(%rax)
je 0x21c029
movq 0x60(%rsp), %rax
movq 0x190(%rax), %rax
movq 0x50(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x50(%rax)
movq 0x60(%rsp), %rax
testb $0x1, 0x105(%rax)
je 0x21c053
movq 0x30(%rsp), %rsi
movq 0x60(%rsp), %rax
movq 0x18(%rax), %rdx
leaq 0x357869(%rip), %rdi    # 0x5738b5
movb $0x0, %al
callq 0x19070
jmp 0x21c055
jmp 0x21c057
movq 0x50(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x21bcaa
movq 0x60(%rsp), %rax
cmpq $0x0, 0x10(%rax)
jbe 0x21c080
movq 0x40(%rsp), %rdi
callq 0x2a94f0
addq $0x98, %rsp
retq
nopl (%rax,%rax)