// File: /workspace/github_c_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %r9, %r14
movq %r8, 0x40(%rsp)
movq %rcx, 0x58(%rsp)
movq %rdi, %rbx
movq 0xe0(%rsp), %rbp
movq 0xd0(%rsp), %r12
cmpq $0x0, 0x10(%rdi)
je 0x197ba2
callq 0x1df6b8
movq %rax, 0x28(%rsp)
jmp 0x197bab
movq $0x0, 0x28(%rsp)
movq %r12, %rax
orq %rbp, %rax
je 0x19821e
movq 0xe8(%rsp), %rax
movq %rax, 0x90(%rsp)
testq %rax, %rax
je 0x1981e8
movl 0xd8(%rsp), %eax
movq %rax, 0x30(%rsp)
leaq 0x108(%rbx), %rax
movq %rax, 0x88(%rsp)
leaq 0x48(%rbx), %rax
movq %rax, 0x80(%rsp)
leaq 0x80(%rbx), %rax
movq %rax, 0x78(%rsp)
leaq 0x8(%r12), %r15
movq $0x0, 0x50(%rsp)
movq $0x0, 0x18(%rsp)
xorl %r13d, %r13d
movq %r14, 0x48(%rsp)
movq %rbp, %rax
testq %r12, %r12
je 0x197c41
leaq (,%r13,2), %rax
addq %r13, %rax
leaq (%r12,%rax,4), %rax
movl (%r15), %ecx
movq %rcx, 0x30(%rsp)
movl (%rax), %esi
movl 0x4(%rax), %edx
cmpb $0x1, 0x105(%rbx)
movq %rdx, 0x20(%rsp)
movq %rsi, 0x38(%rsp)
jne 0x197c76
leaq 0x209638(%rip), %rdi    # 0x3a1298
movq 0x30(%rsp), %rcx
xorl %eax, %eax
callq 0x17070
movq 0x38(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq %r14, %rdi
callq 0x308086
movq 0x18(%rbx), %rdx
movq 0x190(%rbx), %rcx
cmpq %rdx, %rax
jae 0x197cba
testq %rcx, %rcx
je 0x197c97
incq 0x50(%rcx)
cmpb $0x1, 0x105(%rbx)
jne 0x1981a5
leaq 0x209653(%rip), %rdi    # 0x3a12fe
movq %rax, %rsi
xorl %eax, %eax
callq 0x17070
jmp 0x1981a5
testq %rcx, %rcx
je 0x197cd2
incq 0x18(%rcx)
testb $0x1, 0x50(%rsp)
jne 0x197ce9
incq 0x30(%rcx)
movb $0x1, %al
jmp 0x197ce4
movq 0x50(%rsp), %rax
testb $0x1, %al
movzbl %al, %eax
movl $0x1, %ecx
cmovel %ecx, %eax
movq %rax, 0x50(%rsp)
cmpb $0x1, 0x20(%rbx)
je 0x1981c0
movq 0x10(%rbx), %r14
cmpb $0x1, 0x105(%rbx)
jne 0x197d2c
testb $0x1, 0x18(%rsp)
leaq 0x1ee8e0(%rip), %rdx    # 0x3865ec
leaq 0x209fc2(%rip), %rax    # 0x3a1cd5
cmovneq %rax, %rdx
leaq 0x209608(%rip), %rdi    # 0x3a1326
leaq 0x20961b(%rip), %rsi    # 0x3a1340
xorl %eax, %eax
callq 0x17070
testb $0x1, 0x18(%rsp)
movq 0x20(%rsp), %rcx
je 0x197e56
testq %r14, %r14
je 0x197dfa
movq 0x38(%rsp), %rdx
movq %rdx, %r12
movq 0x30(%rsp), %rax
subq %rax, %r12
incq %r12
movq %rcx, %r14
subq %rax, %r14
incq %r14
cmpb $0x1, 0x105(%rbx)
jne 0x197e05
movq 0x128(%rbx), %r9
subq $0x8, %rsp
leaq 0x2095f7(%rip), %rdi    # 0x3a1377
movq %r12, %rsi
movq %rcx, %r8
movq %r14, %rcx
xorl %eax, %eax
pushq 0x140(%rbx)
pushq 0x138(%rbx)
pushq 0x130(%rbx)
callq 0x17070
addq $0x20, %rsp
movl %r12d, (%rsp)
movq 0x38(%rsp), %rax
movl %eax, 0x4(%rsp)
movl %r14d, 0x8(%rsp)
movq 0x20(%rsp), %rax
movl %eax, 0xc(%rsp)
movq 0x28(%rsp), %r14
movq %r14, %rdi
callq 0x1df8b4
movq %r14, %rdi
movq %rsp, %rsi
callq 0x1df874
testb %al, %al
je 0x197e45
leaq 0x209ec0(%rip), %rdi    # 0x3a1ca4
callq 0x17bd0
movb $0x1, %al
movq %rax, 0x18(%rsp)
movq 0x48(%rsp), %r14
jmp 0x198179
cmpq %rcx, 0x140(%rbx)
jae 0x197e34
jmp 0x197e56
movl %r12d, (%rsp)
movl %edx, 0x4(%rsp)
movl %r14d, 0x8(%rsp)
movl %ecx, 0xc(%rsp)
movq 0x28(%rsp), %rdi
movq %rsp, %rsi
callq 0x1df874
movq 0x20(%rsp), %rcx
testb %al, %al
movq 0xd0(%rsp), %r12
je 0x197e56
movb $0x1, %al
movq %rax, 0x18(%rsp)
movq 0x48(%rsp), %r14
jmp 0x1981a5
leaq 0x209e1d(%rip), %rdi    # 0x3a1c69
callq 0x17bd0
movq 0x20(%rsp), %rcx
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq 0x190(%rbx), %rax
testq %rax, %rax
je 0x197e7e
cmpb $0x1, 0x58(%rax)
jne 0x197e7e
movq %rsp, %rdi
xorl %esi, %esi
callq 0x17c90
movq 0x20(%rsp), %rcx
movq %rcx, %rax
movq 0x30(%rsp), %r11
subq %r11, %rax
incq %rax
movq 0x38(%rsp), %rcx
subq %r11, %rcx
incq %rcx
movzbl 0x104(%rbx), %r9d
movl 0x100(%rbx), %r10d
movq 0x88(%rsp), %rdi
movq 0x80(%rsp), %rsi
movq 0x58(%rsp), %rdx
movq 0x78(%rsp), %r8
pushq %r10
pushq %r11
pushq %rax
pushq 0x58(%rsp)
callq *0x158(%rbx)
addq $0x20, %rsp
movl %eax, %r14d
movq 0x190(%rbx), %rax
testq %rax, %rax
je 0x197f1b
cmpb $0x1, 0x58(%rax)
jne 0x197f1d
leaq 0x68(%rsp), %rdi
xorl %esi, %esi
callq 0x17c90
movq 0x68(%rsp), %rax
subq (%rsp), %rax
imulq $0xf4240, %rax, %rcx    # imm = 0xF4240
addq 0x70(%rsp), %rcx
subq 0x8(%rsp), %rcx
movq 0x190(%rbx), %rax
addq %rcx, 0x40(%rax)
jmp 0x197f1d
xorl %eax, %eax
movl $0x1, %r12d
testb %r14b, %r14b
je 0x1980c0
cmpq $0x0, 0x188(%rbx)
je 0x197fcf
movq 0xa0(%rbx), %rcx
movq 0x130(%rbx), %r14
addq 0x140(%rbx), %r14
movq 0x128(%rbx), %rax
addq 0x138(%rbx), %rax
subq %rax, %r14
addq $0x2, %r14
movq 0x170(%rbx), %rdx
movq 0x148(%rbx), %r9
movsd 0x28(%rbx), %xmm0
leaq 0x68(%rsp), %rdi
leaq 0x60(%rsp), %rsi
movq %r14, %r8
movq 0x320f4d(%rip), %rax    # 0x4b8ed8
pushq (%rax)
pushq 0x8(%rbx)
pushq (%rbx)
pushq 0x150(%rbx)
callq 0x1bb6d2
addq $0x20, %rsp
movl $0x2, %r12d
testb %al, %al
je 0x1980b9
movq 0x188(%rbx), %rax
addq %r14, 0x8(%rax)
movq 0x148(%rbx), %rcx
addq %rcx, (%rax)
movl $0x3, %r12d
jmp 0x1980b9
movq 0x110(%rbx), %r14
testq %r14, %r14
je 0x198223
movq 0x170(%rbx), %rdx
movq (%rbx), %r8
movq 0x8(%rbx), %r9
movsd 0x28(%rbx), %xmm0
leaq 0x68(%rsp), %rdi
leaq 0x60(%rsp), %rsi
movq %r14, %rcx
callq 0x1bb88d
movb 0x180(%rbx), %cl
testb %al, %al
je 0x1980a0
movl $0x3, %r12d
testb %cl, %cl
jne 0x1980b9
movq 0x178(%rbx), %rdi
callq 0x1b9e95
testb %al, %al
je 0x198083
movq 0x190(%rbx), %rax
testq %rax, %rax
je 0x198228
movq 0x70(%rax), %rsi
movq %r14, %rdi
callq 0x1baded
movq 0x190(%rbx), %rax
incq 0x70(%rax)
movq 0x60(%rax), %rdi
movq 0x58(%rsp), %rsi
callq 0xd6abc
movq 0x190(%rbx), %rax
movq 0x68(%rax), %rdi
testq %rdi, %rdi
jne 0x198079
movq 0x60(%rax), %rdi
movq 0x40(%rsp), %rsi
callq 0xd6abc
movsd 0x68(%rsp), %xmm0
movsd 0x60(%rsp), %xmm1
movq 0x178(%rbx), %rdi
movq %r14, %rsi
callq 0x1bae05
jmp 0x1980b9
movl $0x2, %r12d
testb %cl, %cl
jne 0x1980b9
movq 0x178(%rbx), %rdi
movq %r14, %rsi
callq 0x1bb649
movq 0x190(%rbx), %rax
testq %rax, %rax
movq 0x48(%rsp), %r14
je 0x1980ce
incq 0x10(%rax)
cmpl $0x2, %r12d
jb 0x198179
movq 0x10(%rbx), %rax
cmpq $0x2, %rax
je 0x1980f4
cmpq $0x1, %rax
setne %al
cmpl $0x3, %r12d
setne %cl
orb %al, %cl
jne 0x198152
movl 0x128(%rbx), %esi
movl %esi, (%rsp)
movl 0x130(%rbx), %edx
movl %edx, 0x4(%rsp)
movl 0x138(%rbx), %ecx
movl %ecx, 0x8(%rsp)
movl 0x140(%rbx), %r8d
movl %r8d, 0xc(%rsp)
cmpb $0x1, 0x105(%rbx)
jne 0x198145
leaq 0x20919a(%rip), %rdi    # 0x3a12c7
movq 0x38(%rsp), %r9
xorl %eax, %eax
pushq 0x30(%rsp)
pushq 0x28(%rsp)
callq 0x17070
addq $0x10, %rsp
movq 0x28(%rsp), %rdi
movq %rsp, %rsi
callq 0x1df725
movq 0x190(%rbx), %rax
cmpl $0x2, %r12d
jne 0x198183
movb $0x1, %cl
movq %rcx, 0x18(%rsp)
testq %rax, %rax
movq 0xd0(%rsp), %r12
je 0x1981a5
incq 0x28(%rax)
jmp 0x1981a5
movq 0xd0(%rsp), %r12
jmp 0x1981a5
testq %rax, %rax
movq 0xd0(%rsp), %r12
je 0x198194
incq 0x20(%rax)
movb $0x1, %al
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x160(%rbx)
jne 0x19820b
incq %r13
addq $0x8, %rbp
addq $0xc, %r15
decq 0x90(%rsp)
jne 0x197c22
jmp 0x1981e8
xorl %eax, %eax
cmpl $0x3, 0x100(%rbx)
sete %al
leal 0x2b(%rax,%rax), %edx
leaq 0x2090e4(%rip), %rdi    # 0x3a12bb
movq 0x58(%rsp), %rsi
movq 0x40(%rsp), %rcx
xorl %eax, %eax
callq 0x17070
cmpq $0x0, 0x10(%rbx)
je 0x1981f9
movq 0x28(%rsp), %rdi
callq 0x1df6df
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x168(%rbx), %rdi
movq 0x40(%rsp), %rsi
callq 0x1986bf
jmp 0x1981e8
callq 0x5de9e
callq 0x5df10
callq 0x5ded7