// File: /workspace/github_c_makefile_star2_O1/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, 0x90(%rsp)
movq %r8, 0x48(%rsp)
movq %rcx, 0x50(%rsp)
movq %rdi, %r15
movq 0xe0(%rsp), %rbx
movq 0xd0(%rsp), %r14
cmpq $0x0, 0x10(%rdi)
je 0x1a0065
callq 0x1e8f04
jmp 0x1a0067
xorl %eax, %eax
movq %rax, 0x40(%rsp)
movq %r14, %rax
orq %rbx, %rax
je 0x1a0729
movq 0xe8(%rsp), %rbp
testq %rbp, %rbp
je 0x1a0706
movl 0xd8(%rsp), %eax
movq %rax, 0x28(%rsp)
leaq 0x108(%r15), %rax
movq %rax, 0x88(%rsp)
leaq 0x48(%r15), %rax
movq %rax, 0x80(%rsp)
leaq 0x80(%r15), %rax
movq %rax, 0x78(%rsp)
decq %rbp
leaq 0x8(%r14), %r12
movl $0x0, 0x34(%rsp)
movq $0x0, 0x58(%rsp)
xorl %r13d, %r13d
movq %rbx, %rax
testq %r14, %r14
je 0x1a00f7
leaq (,%r13,2), %rax
addq %r13, %rax
leaq (%r14,%rax,4), %rax
movl (%r12), %ecx
movq %rcx, 0x28(%rsp)
movl (%rax), %esi
movl 0x4(%rax), %r14d
cmpb $0x1, 0x105(%r15)
movq %rsi, 0x8(%rsp)
jne 0x1a0127
leaq 0x20a6e2(%rip), %rdi    # 0x3aa7f5
movl %r14d, %edx
movq 0x28(%rsp), %rcx
xorl %eax, %eax
callq 0x17070
movq 0x8(%rsp), %rsi
movq 0x90(%rsp), %rdi
movl %r14d, %edx
callq 0x311ed2
movq 0x18(%r15), %rdx
cmpq %rdx, %rax
jae 0x1a0177
movq 0x190(%r15), %rcx
testq %rcx, %rcx
je 0x1a0150
incq 0x50(%rcx)
cmpb $0x1, 0x105(%r15)
jne 0x1a06dc
xorl %r14d, %r14d
leaq 0x20a6f3(%rip), %rdi    # 0x3aa85b
movq %rax, %rsi
xorl %eax, %eax
callq 0x17070
jmp 0x1a06df
movq 0x190(%r15), %rax
testq %rax, %rax
je 0x1a0187
incq 0x18(%rax)
testq %rax, %rax
sete %cl
movl 0x34(%rsp), %esi
orb %sil, %cl
movzbl %sil, %esi
testb $0x1, %sil
movl $0x1, %edx
cmovel %edx, %esi
movl %esi, 0x34(%rsp)
testb $0x1, %cl
movq 0x8(%rsp), %r10
jne 0x1a01bc
incq 0x30(%rax)
movb $0x1, %al
movl %eax, 0x34(%rsp)
cmpb $0x1, 0x20(%r15)
jne 0x1a01f1
xorl %eax, %eax
cmpl $0x3, 0x100(%r15)
sete %al
leal 0x2b(%rax,%rax), %edx
leaq 0x20a63d(%rip), %rdi    # 0x3aa818
movq 0x50(%rsp), %rsi
movq 0x48(%rsp), %rcx
xorl %eax, %eax
callq 0x17070
jmp 0x1a06d7
movq %r14, 0x38(%rsp)
movq 0x10(%r15), %r14
cmpb $0x1, 0x105(%r15)
jne 0x1a0235
testb $0x1, 0x58(%rsp)
leaq 0x1ef7bc(%rip), %rdx    # 0x38f9cc
leaq 0x20b01b(%rip), %rax    # 0x3ab232
cmovneq %rax, %rdx
leaq 0x20a661(%rip), %rdi    # 0x3aa883
leaq 0x20a674(%rip), %rsi    # 0x3aa89d
xorl %eax, %eax
callq 0x17070
movq 0x8(%rsp), %r10
testb $0x1, 0x58(%rsp)
je 0x1a0367
testq %r14, %r14
je 0x1a02ea
movb 0x105(%r15), %al
movb %al, 0x7(%rsp)
cmpb $0x1, %al
jne 0x1a02ff
movq 0x128(%r15), %r9
movq %r10, %rsi
movq 0x28(%rsp), %rdx
subq %rdx, %rsi
incq %rsi
movq 0x38(%rsp), %rax
movq %rax, %rcx
movq %rax, %r8
subq %rdx, %rcx
incq %rcx
subq $0x8, %rsp
leaq 0x20a647(%rip), %rdi    # 0x3aa8d4
movq %r10, %rdx
xorl %eax, %eax
pushq 0x140(%r15)
pushq 0x138(%r15)
pushq 0x130(%r15)
movq %r10, %r14
callq 0x17070
addq $0x20, %rsp
movl %r14d, %eax
movq 0x28(%rsp), %rdx
subl %edx, %eax
incl %eax
movl %eax, 0x10(%rsp)
movl %r14d, 0x14(%rsp)
movq 0x38(%rsp), %rcx
movl %ecx, %eax
subl %edx, %eax
incl %eax
movl %eax, 0x18(%rsp)
movl %ecx, 0x1c(%rsp)
movq 0x40(%rsp), %r14
movq %r14, %rdi
callq 0x1e910d
jmp 0x1a032c
movq 0x38(%rsp), %rax
cmpq %rax, 0x140(%r15)
jb 0x1a0367
xorl %edx, %edx
jmp 0x1a05ea
movl %r10d, %eax
movq 0x28(%rsp), %rcx
subl %ecx, %eax
incl %eax
movl %eax, 0x10(%rsp)
movl %r10d, 0x14(%rsp)
movq 0x38(%rsp), %rdx
movl %edx, %eax
subl %ecx, %eax
incl %eax
movl %eax, 0x18(%rsp)
movl %edx, 0x1c(%rsp)
movq 0x40(%rsp), %r14
movq %r14, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1e90c4
movl %eax, %r14d
cmpb $0x0, 0x7(%rsp)
je 0x1a035d
testb %r14b, %r14b
leaq 0x20ae79(%rip), %rdi    # 0x3ab1c6
leaq 0x20aead(%rip), %rax    # 0x3ab201
cmovneq %rax, %rdi
callq 0x17bd0
testb %r14b, %r14b
movq 0x8(%rsp), %r10
jne 0x1a02f8
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq 0x190(%r15), %rax
testq %rax, %rax
je 0x1a0392
cmpb $0x1, 0x58(%rax)
jne 0x1a0392
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x17c90
movq 0x8(%rsp), %r10
movq 0x38(%rsp), %rax
movq 0x28(%rsp), %r11
subq %r11, %rax
incq %rax
movq %r10, %rcx
subq %r11, %rcx
incq %rcx
movzbl 0x104(%r15), %r9d
movl 0x100(%r15), %r10d
movq 0x88(%rsp), %rdi
movq 0x80(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq 0x78(%rsp), %r8
pushq %r10
pushq %r11
pushq %rax
pushq 0x60(%rsp)
callq *0x158(%r15)
addq $0x20, %rsp
movl %eax, %r14d
movq 0x190(%r15), %rax
testq %rax, %rax
je 0x1a042f
cmpb $0x1, 0x58(%rax)
jne 0x1a042f
leaq 0x68(%rsp), %rdi
xorl %esi, %esi
callq 0x17c90
movq 0x68(%rsp), %rax
subq 0x10(%rsp), %rax
imulq $0xf4240, %rax, %rax    # imm = 0xF4240
addq 0x70(%rsp), %rax
subq 0x18(%rsp), %rax
movq 0x190(%r15), %rcx
addq %rax, 0x40(%rcx)
movl $0x1, %edx
testb %r14b, %r14b
movq 0x8(%rsp), %r10
je 0x1a05ea
cmpq $0x0, 0x188(%r15)
je 0x1a04e7
movq 0xa0(%r15), %rcx
movq 0x130(%r15), %r14
addq 0x140(%r15), %r14
movq 0x128(%r15), %rax
addq 0x138(%r15), %rax
subq %rax, %r14
addq $0x2, %r14
movq 0x170(%r15), %rdx
movq 0x148(%r15), %r9
movsd 0x28(%r15), %xmm0
leaq 0x68(%rsp), %rdi
leaq 0x60(%rsp), %rsi
movq %r14, %r8
movq 0x323a46(%rip), %rax    # 0x4c3ee8
pushq (%rax)
pushq 0x8(%r15)
pushq (%r15)
pushq 0x150(%r15)
callq 0x1c443d
movq 0x28(%rsp), %r10
addq $0x20, %rsp
movl $0x2, %edx
testb %al, %al
je 0x1a05ea
movq 0x188(%r15), %rax
addq %r14, 0x8(%rax)
movq 0x148(%r15), %rcx
addq %rcx, (%rax)
jmp 0x1a05bb
movq 0x110(%r15), %r14
testq %r14, %r14
je 0x1a072e
movq 0x170(%r15), %rdx
movq (%r15), %r8
movq 0x8(%r15), %r9
movsd 0x28(%r15), %xmm0
leaq 0x68(%rsp), %rdi
leaq 0x60(%rsp), %rsi
movq %r14, %rcx
callq 0x1c45f8
testb %al, %al
je 0x1a05c2
movl $0x3, %edx
cmpb $0x0, 0x180(%r15)
jne 0x1a05e5
movq 0x178(%r15), %rdi
callq 0x1c2b25
testb %al, %al
je 0x1a059b
movq 0x190(%r15), %rax
testq %rax, %rax
je 0x1a0733
movq 0x70(%rax), %rsi
movq %r14, %rdi
callq 0x1c3b4c
movq 0x190(%r15), %rax
incq 0x70(%rax)
movq 0x60(%rax), %rdi
movq 0x50(%rsp), %rsi
callq 0xd913c
movq 0x190(%r15), %rax
movq 0x68(%rax), %rdi
testq %rdi, %rdi
jne 0x1a0591
movq 0x60(%rax), %rdi
movq 0x48(%rsp), %rsi
callq 0xd913c
movsd 0x68(%rsp), %xmm0
movsd 0x60(%rsp), %xmm1
movq 0x178(%r15), %rdi
movq %r14, %rsi
callq 0x1c3b64
movq 0x8(%rsp), %r10
movl $0x3, %edx
jmp 0x1a05ea
movl $0x2, %edx
cmpb $0x0, 0x180(%r15)
jne 0x1a05e5
movq 0x178(%r15), %rdi
movq %r14, %rsi
callq 0x1c43b4
movl $0x2, %edx
movq 0x8(%rsp), %r10
testl %edx, %edx
je 0x1a05fe
movq 0x190(%r15), %rax
testq %rax, %rax
je 0x1a05fe
incq 0x10(%rax)
cmpl $0x2, %edx
jb 0x1a06a7
movq 0x10(%r15), %rax
cmpq $0x2, %rax
je 0x1a0622
cmpq $0x1, %rax
setne %al
cmpl $0x3, %edx
setne %cl
orb %al, %cl
jne 0x1a068b
movl %edx, %r14d
movl 0x128(%r15), %esi
movl %esi, 0x10(%rsp)
movl 0x130(%r15), %edx
movl %edx, 0x14(%rsp)
movl 0x138(%r15), %ecx
movl %ecx, 0x18(%rsp)
movl 0x140(%r15), %r8d
movl %r8d, 0x1c(%rsp)
cmpb $0x1, 0x105(%r15)
jne 0x1a0679
leaq 0x20a1c1(%rip), %rdi    # 0x3aa824
movl %r10d, %r9d
xorl %eax, %eax
pushq 0x28(%rsp)
pushq 0x40(%rsp)
callq 0x17070
addq $0x10, %rsp
movq 0x40(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x1e8f71
movl %r14d, %edx
movb $0x1, %al
movq %rax, 0x58(%rsp)
cmpl $0x2, %edx
jne 0x1a06a7
movq 0x190(%r15), %rax
testq %rax, %rax
je 0x1a06a7
incq 0x28(%rax)
cmpl $0x3, %edx
jne 0x1a06dc
movq 0x190(%r15), %rax
testq %rax, %rax
je 0x1a06bc
incq 0x20(%rax)
cmpq $0x0, 0x160(%r15)
je 0x1a06dc
movq 0x168(%r15), %rdi
movq 0x48(%rsp), %rsi
callq 0x1a0bd7
movb $0x1, %r14b
jmp 0x1a06df
xorl %r14d, %r14d
subq $0x1, %rbp
setb %al
testb %r14b, %r14b
movq 0xd0(%rsp), %r14
jne 0x1a0706
incq %r13
addq $0x8, %rbx
addq $0xc, %r12
testb %al, %al
je 0x1a00d7
cmpq $0x0, 0x10(%r15)
je 0x1a0717
movq 0x40(%rsp), %rdi
callq 0x1e8f2b
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x5f312
callq 0x5f384
callq 0x5f34b