// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/rdj-ovlfind-gusfield.c
// Function: rdj_gusfield_processleafedge
static inline
void rdj_gusfield_processleafedge(GtUword leafnumber,
                                  const GtEncseq *encseq,
                                  GtUword nofsequences,
                                  GtArrayGtUword *matchlen_stacks,
                                  GtBitsequence *has_match,
                                  GtBitsequence *sspbittab,
                                  bool find_submaximal,
                                  GtUword firstrevcompl,
                                  GtSpmproc proc,
                                  void* procdata)
{
  GtUword prefix_seqnum, suffix_seqnum, corrected_suffix_seqnum;
  bool suffixseq_direct = true, prefixseq_direct = true;
  GtUword *matchlen;
  GtUword stack_pos;
  gt_assert(encseq != NULL);

  if (leafnumber == 0 || (bool)GT_ISIBITSET(sspbittab, leafnumber-1))
  {
    prefix_seqnum = gt_encseq_seqnum(encseq, leafnumber);
    if (firstrevcompl != 0)
    {
      GT_READJOINER_CORRECT_REVCOMPL(prefix_seqnum, firstrevcompl,
        nofsequences, prefixseq_direct);
    }
    for (suffix_seqnum = 0; suffix_seqnum < nofsequences; suffix_seqnum++)
    {
      if ((bool)GT_ISIBITSET(has_match, suffix_seqnum))
      {
        corrected_suffix_seqnum = suffix_seqnum;
        if (firstrevcompl != 0)
        {
          GT_READJOINER_CORRECT_REVCOMPL(corrected_suffix_seqnum,
            firstrevcompl, nofsequences, suffixseq_direct);
          if (!GT_READJOINER_IS_CORRECT_REVCOMPL_CASE(corrected_suffix_seqnum,
            suffixseq_direct, prefix_seqnum, prefixseq_direct))
            continue;
        }
        if (!find_submaximal)
        {
          matchlen = matchlen_stacks[suffix_seqnum].spaceGtUword +
                     matchlen_stacks[suffix_seqnum].nextfreeGtUword - 1;
          gt_assert(matchlen != NULL);
          if (suffix_seqnum == prefix_seqnum)
          {
            if (*matchlen == gt_encseq_seqlength(encseq, suffix_seqnum))
            {
              /* read overlaps with whole itself */
              if (matchlen_stacks[suffix_seqnum].nextfreeGtUword == 1UL)
              {
                /* no other overlap */
                continue;
              }
              else
              {
                matchlen = matchlen_stacks[suffix_seqnum].spaceGtUword +
                           matchlen_stacks[suffix_seqnum].nextfreeGtUword - 2;
              }
            }
          }
          proc(corrected_suffix_seqnum, prefix_seqnum,
               (GtUword) *matchlen, suffixseq_direct,
               prefixseq_direct, procdata);
        }
        else /* process whole stack, not only the top */
        {
          for (stack_pos = 0;
               stack_pos < matchlen_stacks[suffix_seqnum].nextfreeGtUword;
               stack_pos++)
          {
            matchlen = matchlen_stacks[suffix_seqnum].spaceGtUword + stack_pos;
            gt_assert(matchlen != NULL);
            if (suffix_seqnum == prefix_seqnum)
            {
              if (*matchlen == gt_encseq_seqlength(encseq, suffix_seqnum))
                /* skip ovl of read with whole itself */
                continue;
            }
            proc(corrected_suffix_seqnum, prefix_seqnum,
                 (GtUword) *matchlen, suffixseq_direct,
                 prefixseq_direct, procdata);
          }
        }
      }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, 0x40(%rsp)
movq %rsi, 0x18(%rsp)
testq %rsi, %rsi
je 0x1ca18e
movq %r8, %r13
movq %rdx, %r15
movq %rdi, %rdx
movabsq $-0x8000000000000000, %r14 # imm = 0x8000000000000000
testq %rdi, %rdi
je 0x1c9f1f
leaq -0x1(%rdx), %rcx
movq %r14, %rax
shrq %cl, %rax
shrq $0x6, %rcx
testq %rax, (%r9,%rcx,8)
je 0x1ca17a
movq 0x88(%rsp), %rbx
movq 0x18(%rsp), %rdi
movq %rdx, %rsi
callq 0xeb655
movq %rbx, %rsi
leaq -0x1(%rbx), %rcx
movq %rax, %rbp
movq %rax, 0x8(%rsp)
movq %rcx, 0x10(%rsp)
cmpq %rax, %rcx
jae 0x1c9f5c
leaq -0x1(%r15), %rbp
subq 0x8(%rsp), %rbp
jb 0x1ca193
testq %r15, %r15
je 0x1ca17a
movb $0x1, %al
movl %eax, 0x4(%rsp)
xorl %ebx, %ebx
movq %r15, 0x30(%rsp)
movq %r13, 0x38(%rsp)
movq %r14, %rax
movl %ebx, %ecx
shrq %cl, %rax
movq %rbx, %rcx
shrq $0x6, %rcx
testq %rax, (%r13,%rcx,8)
je 0x1ca16e
movq %rbx, %rdx
testq %rsi, %rsi
je 0x1ca031
cmpq %rsi, %rbx
jb 0x1c9fb5
movq %rbx, %rdx
notq %rdx
addq %r15, %rdx
movl $0x0, 0x4(%rsp)
jmp 0x1c9fca
movb $0x1, %al
movl %eax, 0x4(%rsp)
movq %rbx, %rdx
movq 0x10(%rsp), %rax
cmpq 0x8(%rsp), %rax
jae 0x1ca031
cmpq %rsi, %rbx
setb %al
movq 0x10(%rsp), %rcx
cmpq 0x8(%rsp), %rcx
setae %cl
movq %rdx, %rdi
cmpq %rbp, %rdx
sete %dl
orb %al, %cl
testb %dl, %cl
je 0x1c9ff1
movq %rbp, %rdx
jmp 0x1ca031
cmpq %rsi, %rbx
jae 0x1ca00c
movq 0x10(%rsp), %rax
cmpq 0x8(%rsp), %rax
jae 0x1ca00c
cmpq %rdi, %rbp
jbe 0x1ca00c
movq %rdi, %rdx
jmp 0x1ca031
cmpq %rsi, %rbx
jb 0x1ca16e
movq 0x10(%rsp), %rax
cmpq 0x8(%rsp), %rax
jb 0x1ca16e
movq %rdi, %rdx
cmpq %rdi, %rbp
jae 0x1ca16e
movq %rdx, 0x20(%rsp)
leaq (%rbx,%rbx,2), %rax
movq 0x40(%rsp), %rcx
leaq (%rcx,%rax,8), %r12
cmpb $0x0, 0x80(%rsp)
je 0x1ca0e2
cmpq $0x0, 0x10(%r12)
je 0x1ca16e
movzbl 0x4(%rsp), %eax
andl $0x1, %eax
movl %eax, 0x2c(%rsp)
xorl %r13d, %r13d
movq 0x20(%rsp), %r14
movq (%r12), %r15
testq %r15, %r15
je 0x1ca189
cmpq %rbp, %rbx
jne 0x1ca09e
movq (%r15,%r13,8), %r14
movq 0x18(%rsp), %rdi
movq %rbp, %rsi
callq 0xeb9d2
cmpq %rax, %r14
movq 0x20(%rsp), %r14
je 0x1ca0cc
xorl %r8d, %r8d
movq 0x10(%rsp), %rax
cmpq 0x8(%rsp), %rax
setae %r8b
movq (%r15,%r13,8), %rdx
movq %r14, %rdi
movq %rbp, %rsi
movl 0x2c(%rsp), %ecx
movq 0x98(%rsp), %r9
callq *0x90(%rsp)
incq %r13
cmpq 0x10(%r12), %r13
jb 0x1ca071
movq 0x38(%rsp), %r13
movq 0x30(%rsp), %r15
jmp 0x1ca15c
movq (%r12), %rax
movq 0x10(%r12), %rcx
leaq (%rax,%rcx,8), %r14
addq $-0x8, %r14
cmpq %rbp, %rbx
jne 0x1ca129
movq (%r14), %r15
movq 0x18(%rsp), %rdi
movq %rbp, %rsi
callq 0xeb9d2
cmpq %rax, %r15
movq 0x30(%rsp), %r15
jne 0x1ca129
movq 0x10(%r12), %rax
cmpq $0x1, %rax
je 0x1ca15c
movq (%r12), %rcx
leaq (%rcx,%rax,8), %r14
addq $-0x10, %r14
xorl %r8d, %r8d
movq 0x10(%rsp), %rax
cmpq 0x8(%rsp), %rax
setae %r8b
movq (%r14), %rdx
movzbl 0x4(%rsp), %ecx
andl $0x1, %ecx
movq 0x20(%rsp), %rdi
movq %rbp, %rsi
movq 0x98(%rsp), %r9
callq *0x90(%rsp)
movabsq $-0x8000000000000000, %r14 # imm = 0x8000000000000000
movq 0x88(%rsp), %rsi
incq %rbx
cmpq %r15, %rbx
jne 0x1c9f77
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x6ab5b
callq 0x6ab92
callq 0x6ab24