// File: /workspace/github_c_makefile_star2_O1/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 %rsi, 0x28(%rsp)
testq %rsi, %rsi
je 0x1d33e0
movq %r8, %r15
movq %rcx, %rbp
movq %rdx, %r13
movq %rdi, %rdx
movabsq $-0x8000000000000000, %r14 # imm = 0x8000000000000000
testq %rdi, %rdi
je 0x1d3136
leaq -0x1(%rdx), %rcx
movq %r14, %rax
shrq %cl, %rax
shrq $0x6, %rcx
testq %rax, (%r9,%rcx,8)
je 0x1d33cc
movq 0x88(%rsp), %rbx
movq 0x28(%rsp), %rdi
movq %rdx, %rsi
callq 0xefc48
movq %rbx, %rdx
leaq -0x1(%rbx), %r12
movq %rax, 0x8(%rsp)
movq %rax, 0x10(%rsp)
cmpq %rax, %r12
jae 0x1d3175
leaq -0x1(%r13), %rax
subq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
jb 0x1d33e5
testq %r13, %r13
je 0x1d33cc
cmpq 0x10(%rsp), %r12
setb 0x7(%rsp)
movb $0x1, 0x6(%rsp)
xorl %ebx, %ebx
movq %r13, 0x30(%rsp)
movq %r15, 0x20(%rsp)
movq %rbp, 0x38(%rsp)
movq %r12, 0x18(%rsp)
movq %r14, %rax
movl %ebx, %ecx
shrq %cl, %rax
movq %rbx, %rcx
shrq $0x6, %rcx
testq %rax, (%r15,%rcx,8)
je 0x1d33c0
movq %rbx, %rdi
testq %rdx, %rdx
je 0x1d3239
movq 0x10(%rsp), %rcx
cmpq %rcx, %r12
setae %al
movq %rbx, %rdi
notq %rdi
addq %r13, %rdi
cmpq %rdx, %rbx
setb %sil
cmovbq %rbx, %rdi
movb %sil, 0x6(%rsp)
testb %al, %sil
jne 0x1d3239
cmpq %rdx, %rbx
setb %al
cmpq %rcx, %r12
setae %cl
cmpq 0x8(%rsp), %rdi
jne 0x1d3204
orb %al, %cl
jne 0x1d3239
cmpq %rdx, %rbx
setb %al
cmpq %rdi, 0x8(%rsp)
seta %cl
andb 0x7(%rsp), %cl
testb %al, %cl
jne 0x1d3239
cmpq 0x10(%rsp), %r12
jb 0x1d33c0
cmpq %rdi, 0x8(%rsp)
jae 0x1d33c0
cmpq %rdx, %rbx
jb 0x1d33c0
leaq (%rbx,%rbx,2), %rax
leaq (,%rax,8), %r12
addq %rbp, %r12
cmpb $0x0, 0x80(%rsp)
je 0x1d330b
cmpq $0x0, 0x10(%r12)
je 0x1d3301
movq %rdi, 0x40(%rsp)
movzbl 0x6(%rsp), %r14d
andl $0x1, %r14d
xorl %r13d, %r13d
movq 0x10(%rsp), %r15
movq (%r12), %rbp
testq %rbp, %rbp
je 0x1d33db
cmpq 0x8(%rsp), %rbx
jne 0x1d32a9
movq (%rbp,%r13,8), %r15
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0xeffd3
cmpq %rax, %r15
movq 0x10(%rsp), %r15
je 0x1d32d6
xorl %r8d, %r8d
cmpq %r15, 0x18(%rsp)
setae %r8b
movq (%rbp,%r13,8), %rdx
movq 0x40(%rsp), %rdi
movq 0x8(%rsp), %rsi
movl %r14d, %ecx
movq 0x98(%rsp), %r9
callq *0x90(%rsp)
incq %r13
cmpq 0x10(%r12), %r13
jb 0x1d3279
movq 0x20(%rsp), %r15
movq 0x38(%rsp), %rbp
movq 0x30(%rsp), %r13
movabsq $-0x8000000000000000, %r14 # imm = 0x8000000000000000
movq 0x88(%rsp), %rdx
movq 0x18(%rsp), %r12
jmp 0x1d33c0
movq %rbp, %r15
movq %rdi, %rbp
movq (%r12), %rax
movq 0x10(%r12), %rcx
leaq (%rax,%rcx,8), %r14
addq $-0x8, %r14
cmpq 0x8(%rsp), %rbx
jne 0x1d3373
movq (%r14), %r13
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0xeffd3
cmpq %rax, %r13
movq 0x30(%rsp), %r13
jne 0x1d3373
movq 0x10(%r12), %rax
cmpq $0x1, %rax
jne 0x1d3367
movabsq $-0x8000000000000000, %r14 # imm = 0x8000000000000000
movq 0x88(%rsp), %rdx
movq 0x18(%rsp), %r12
jmp 0x1d33b8
movq (%r12), %rcx
leaq (%rcx,%rax,8), %r14
addq $-0x10, %r14
xorl %r8d, %r8d
movq 0x18(%rsp), %r12
cmpq 0x10(%rsp), %r12
setae %r8b
movq (%r14), %rdx
movzbl 0x6(%rsp), %ecx
andl $0x1, %ecx
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
movq 0x98(%rsp), %r9
callq *0x90(%rsp)
movabsq $-0x8000000000000000, %r14 # imm = 0x8000000000000000
movq 0x88(%rsp), %rdx
movq %r15, %rbp
movq 0x20(%rsp), %r15
incq %rbx
cmpq %r13, %rbx
jne 0x1d31a3
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x6c46e
callq 0x6c4a5
callq 0x6c437