// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/rdj-strgraph.c
// Function: gt_strgraph_redpbubbles
GtUword gt_strgraph_redpbubbles(GtStrgraph *strgraph,
    GtUword maxwidth, const GtUword maxdiff,
    bool show_progressbar)
{
  GtStrgraphVnum i, from, to;
  GtStrgraphVEdgenum j, from_to, p, nofpaths;
  GtStrgraphLength len;
  GtUword depth, width, counter = 0, nofpbubbles = 0;
  GtUint64 progress = 0;
  GtStrgraphPathInfo *info, *prev;

  gt_assert(strgraph != NULL);

  if (maxwidth == 0)
    maxwidth = (GtUword)(gt_strgraph_longest_read(strgraph) << 2) -
        (strgraph->minmatchlen << 1) - 1;
  gt_log_log("redpbubbles(maxwidth="GT_WU", maxdiff="GT_WU")", maxwidth,
             maxdiff);

  /* allocate info and set all marks to VACANT */
  {
    GtUword maxoutdeg = 0;
    for (i = 0; i < GT_STRGRAPH_NOFVERTICES(strgraph); i++)
    {
      GT_STRGRAPH_V_SET_MARK(strgraph, i, GT_STRGRAPH_V_VACANT);
      if (GT_STRGRAPH_V_OUTDEG(strgraph, i) > (GtStrgraphVEdgenum)maxoutdeg)
        maxoutdeg = (GtUword)GT_STRGRAPH_V_OUTDEG(strgraph, i);
    }
    gt_log_log("maxoutdeg = "GT_WU"", maxoutdeg);
    info = gt_malloc(sizeof (GtStrgraphPathInfo) * maxoutdeg);
  }

  if (show_progressbar)
    gt_progressbar_start(&progress,
        (GtUint64)GT_STRGRAPH_NOFVERTICES(strgraph));

  for (i = 0; i < GT_STRGRAPH_NOFVERTICES(strgraph); i++)
  {
    if (GT_STRGRAPH_V_OUTDEG(strgraph, i) > 0)
    {
      if (GT_STRGRAPH_V_IS_INTERNAL(strgraph, i))
        continue;
      nofpaths = 0;
      for (j = 0; j < GT_STRGRAPH_V_NOFEDGES(strgraph, i); j++)
      {
        if (!GT_STRGRAPH_EDGE_IS_REDUCED(strgraph, i, j))
        {
          to = GT_STRGRAPH_EDGE_DEST(strgraph, i, j);
          depth = 1UL;
          len = GT_STRGRAPH_EDGE_LEN(strgraph, i, j);
          gt_assert(sizeof (GtUword) >= sizeof (GtStrgraphLength) ||
              len <= (GtStrgraphLength)ULONG_MAX);
          width = (GtUword)len;
          while (GT_STRGRAPH_V_IS_INTERNAL(strgraph, to) && width <= maxwidth)
          {
            depth++;
            from = to;
            from_to = gt_strgraph_find_only_edge(strgraph, from);
            len = GT_STRGRAPH_EDGE_LEN(strgraph, from, from_to);
            gt_assert((sizeof (GtUword) >= sizeof (GtStrgraphLength) &&
                width <= ULONG_MAX - (GtUword)len) ||
                (GtStrgraphLength)width + len < (GtStrgraphLength)ULONG_MAX);
            width += (GtUword)len;
            to = GT_STRGRAPH_EDGE_DEST(strgraph, from, from_to);
          }
          if (width <= maxwidth && depth > 1UL)
          {
            info[nofpaths].edgenum = j;
            info[nofpaths].dest = to;
            info[nofpaths].depth = depth;
            info[nofpaths].width = width;
            nofpaths++;
          }
        }
      }
      if (nofpaths > 0)
      {
        qsort(info, (size_t)nofpaths, sizeof (*info),
            gt_strgraph_path_info_compare);
        prev = info;
        for (p = (GtStrgraphVEdgenum)1; p < nofpaths; p++)
        {
          if (info[p].dest == prev->dest &&
              (info[p].width - prev->width <= maxdiff))
          {
            nofpbubbles++;
            if (info[p].depth <= prev->depth)
            {
              from_to = info[p].edgenum;
            }
            else
            {
              from_to = prev->edgenum;
              prev = info + p;
            }
            GT_STRGRAPH_EDGE_SET_MARK(strgraph, i, from_to);
            to = GT_STRGRAPH_EDGE_DEST(strgraph, i, from_to);
            while (GT_STRGRAPH_V_IS_INTERNAL(strgraph, to))
            {
              from = to;
              from_to = gt_strgraph_find_only_edge(strgraph, from);
              GT_STRGRAPH_EDGE_SET_MARK(strgraph, from, from_to);
              to = GT_STRGRAPH_EDGE_DEST(strgraph, from, from_to);
            }
          }
          else
          {
            prev = info + p;
          }
        }
      }
    }
    if (show_progressbar)
      progress++;
  }
  counter = gt_strgraph_reduce_marked_edges(strgraph);

  if (show_progressbar)
    gt_progressbar_stop();
  gt_free(info);
  gt_log_log("p-bubbles = "GT_WU"", nofpbubbles);
  gt_log_log("removed p-bubble edges = "GT_WU"", counter);
#ifndef NDEBUG
  gt_strgraph_check_outdegs(strgraph);
#endif
  return counter;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %ecx, 0x14(%rsp)
movq %rdx, 0x40(%rsp)
andq $0x0, 0x50(%rsp)
testq %rdi, %rdi
je 0x183817
movq %rdi, %rbx
testq %rsi, %rsi
jne 0x1831f0
movq %rbx, %rdi
callq 0x17f6b5
movq 0x30(%rbx), %rcx
addq %rcx, %rcx
notq %rcx
leaq (%rcx,%rax,4), %rsi
leaq 0x1ccbc0(%rip), %rdi    # 0x34fdb7
xorl %r14d, %r14d
movq %rsi, 0x48(%rsp)
movq 0x40(%rsp), %rdx
xorl %eax, %eax
callq 0x92a82
xorl %r12d, %r12d
cmpq 0x80(%rbx), %r14
jae 0x18324a
movq 0x58(%rbx), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x180026
movq 0x70(%rbx), %rdi
movq %r14, %rsi
callq 0x17ffcd
cmpq %r12, %rax
jbe 0x183245
movq 0x70(%rbx), %rdi
movq %r14, %rsi
callq 0x17ffcd
movq %rax, %r12
incq %r14
jmp 0x18320e
leaq 0x1ccb8d(%rip), %rdi    # 0x34fdde
movq %r12, %rsi
xorl %eax, %eax
callq 0x92a82
shlq $0x5, %r12
leaq 0x1cc50f(%rip), %rsi    # 0x34f775
movq %r12, %rdi
movl $0x4ec, %edx            # imm = 0x4EC
callq 0x93160
movq %rax, 0x30(%rsp)
cmpb $0x0, 0x14(%rsp)
je 0x183290
movq 0x80(%rbx), %rsi
leaq 0x50(%rsp), %rdi
callq 0x9c79c
xorl %r15d, %r15d
pushq $-0x1
popq %r12
movq $0x0, 0x38(%rsp)
cmpq 0x80(%rbx), %r15
jae 0x183774
movq 0x70(%rbx), %rdi
movq %r15, %rsi
callq 0x17ffcd
testq %rax, %rax
je 0x183760
movq 0x70(%rbx), %rdi
movq %r15, %rsi
callq 0x17ffcd
cmpq $0x1, %rax
jne 0x1832f7
movq 0x70(%rbx), %rdi
movl %r15d, %esi
andl $0x1, %esi
negq %rsi
orq $0x1, %rsi
addq %r15, %rsi
callq 0x17ffcd
cmpq $0x1, %rax
je 0x18376c
leaq 0x1(%r15), %r13
xorl %ebp, %ebp
movq $0x0, 0x8(%rsp)
movq %r15, 0x28(%rsp)
movq %r13, 0x18(%rsp)
movq 0x60(%rbx), %rdi
movq %r13, %rsi
callq 0x17ffcd
movq %rax, %r14
movq 0x60(%rbx), %rdi
movq %r15, %rsi
callq 0x17ffcd
subq %rax, %r14
cmpq %r14, %rbp
jae 0x1835bc
movq 0x60(%rbx), %rdi
movq 0x88(%rbx), %r14
movq %r15, %rsi
callq 0x17ffcd
leaq (%rax,%rbp), %rsi
movq %r14, %rdi
callq 0x17ffcd
movq %rax, %r14
movq 0x90(%rbx), %rdi
callq 0x28a939
movl %r12d, %edx
movl %eax, %ecx
shll %cl, %edx
notl %edx
addl %edx, %edx
movslq %edx, %rax
andq %r14, %rax
shrq %rax
cmpq 0x90(%rbx), %rax
je 0x1835b4
movq 0x60(%rbx), %rdi
movq 0x88(%rbx), %r14
movq %r15, %rsi
callq 0x17ffcd
leaq (%rax,%rbp), %rsi
movq %r14, %rdi
callq 0x17ffcd
movq %rax, %r13
movq 0x80(%rbx), %rdi
callq 0x28a939
movq %rbp, %r15
movl %r12d, %ebp
movl %eax, %ecx
shll %cl, %ebp
notl %ebp
movq 0x90(%rbx), %rdi
callq 0x28a939
leal 0x1(%rax), %ecx
shll %cl, %ebp
movslq %ebp, %r14
andq %r13, %r14
movq 0x90(%rbx), %rdi
callq 0x28a939
leal 0x1(%rax), %ecx
shrq %cl, %r14
movq 0x60(%rbx), %rdi
movq 0x88(%rbx), %r13
movq 0x28(%rsp), %rsi
callq 0x17ffcd
movq %r15, 0x20(%rsp)
leaq (%rax,%r15), %rsi
movq %r13, %rdi
callq 0x17ffcd
movq %rax, %r13
movq 0x90(%rbx), %rdi
callq 0x28a939
movl %r12d, %edx
movl %eax, %ecx
shll %cl, %edx
notl %edx
addl %edx, %edx
movslq %edx, %rbp
andq %r13, %rbp
shrq %rbp
pushq $0x1
popq %r15
movq 0x70(%rbx), %rdi
movq %r14, %rsi
callq 0x17ffcd
cmpq $0x1, %rax
jne 0x183547
movq 0x70(%rbx), %rdi
movl %r14d, %esi
andl $0x1, %esi
negq %rsi
orq $0x1, %rsi
addq %r14, %rsi
callq 0x17ffcd
cmpq $0x1, %rax
jne 0x183547
cmpq 0x48(%rsp), %rbp
ja 0x183547
movq %rbx, %rdi
movq %r14, %rsi
callq 0x183094
movq %rax, %r13
movq 0x60(%rbx), %rdi
movq 0x88(%rbx), %r12
movq %r14, %rsi
callq 0x17ffcd
leaq (%rax,%r13), %rsi
movq %r12, %rdi
callq 0x17ffcd
movq %rax, %r12
movq 0x90(%rbx), %rdi
callq 0x28a939
pushq $-0x1
popq %rdx
movl %eax, %ecx
shll %cl, %edx
notl %edx
addl %edx, %edx
movslq %edx, %rax
andq %r12, %rax
shrq %rax
addq %rax, %rbp
jae 0x1834d9
cmpq $-0x1, %rbp
je 0x1837df
incq %r15
movq 0x60(%rbx), %rdi
movq 0x88(%rbx), %r12
movq %r14, %rsi
callq 0x17ffcd
addq %rax, %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x17ffcd
movq %rax, %r12
movq 0x80(%rbx), %rdi
callq 0x28a939
pushq $-0x1
popq %r14
movl %eax, %ecx
shll %cl, %r14d
notl %r14d
movq 0x90(%rbx), %rdi
callq 0x28a939
leal 0x1(%rax), %ecx
shll %cl, %r14d
movslq %r14d, %r14
andq %r12, %r14
movq 0x90(%rbx), %rdi
callq 0x28a939
leal 0x1(%rax), %ecx
shrq %cl, %r14
jmp 0x183436
cmpq 0x48(%rsp), %rbp
setbe %al
cmpq $0x2, %r15
setae %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x1835a1
movq 0x8(%rsp), %rdx
movq %rdx, %rax
shlq $0x5, %rax
movq 0x30(%rsp), %rcx
movq 0x20(%rsp), %rsi
movq %rsi, (%rcx,%rax)
movq %r14, 0x8(%rcx,%rax)
movq %r15, 0x10(%rcx,%rax)
movq %rbp, 0x18(%rcx,%rax)
movq %rsi, %rbp
incq %rdx
movq %rdx, 0x8(%rsp)
movq 0x28(%rsp), %r15
pushq $-0x1
popq %r12
movq 0x18(%rsp), %r13
jmp 0x1835b4
movq 0x28(%rsp), %r15
pushq $-0x1
popq %r12
movq 0x18(%rsp), %r13
movq 0x20(%rsp), %rbp
incq %rbp
jmp 0x183310
cmpq $0x0, 0x8(%rsp)
je 0x183760
movq 0x30(%rsp), %r14
movq %r14, %rdi
movq 0x8(%rsp), %rsi
pushq $0x20
popq %rdx
leaq 0x266(%rip), %rcx       # 0x183845
callq 0x17ed0
movq 0x8(%rsp), %rsi
pushq $0x1
popq %rdi
cmpq %rsi, %rdi
je 0x183760
movq %rdi, %rcx
shlq $0x5, %rcx
movq 0x30(%rsp), %rdx
leaq (%rdx,%rcx), %r8
movq 0x8(%rdx,%rcx), %rcx
cmpq 0x8(%r14), %rcx
jne 0x183755
movq 0x18(%r8), %rcx
subq 0x18(%r14), %rcx
cmpq 0x40(%rsp), %rcx
ja 0x183755
movq %rdi, 0x20(%rsp)
incq 0x38(%rsp)
movq 0x10(%r8), %rcx
cmpq 0x10(%r14), %rcx
movq %r8, %rcx
cmovaq %r14, %rcx
cmovbeq %r14, %r8
movq %r8, 0x18(%rsp)
movq (%rcx), %r13
movq %r15, %r14
movq 0x60(%rbx), %rdi
movq 0x88(%rbx), %r12
movq %r14, %rsi
callq 0x17ffcd
leaq (%rax,%r13), %rbp
movq 0x60(%rbx), %rdi
movq 0x88(%rbx), %r15
movq %r14, %rsi
callq 0x17ffcd
leaq (%rax,%r13), %rsi
movq %r15, %rdi
callq 0x17ffcd
orq $0x1, %rax
movq %r12, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x180026
movq 0x60(%rbx), %rdi
movq 0x88(%rbx), %r15
movq %r14, %rsi
callq 0x17ffcd
addq %rax, %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x17ffcd
movq %rax, %r15
movq 0x80(%rbx), %rdi
callq 0x28a939
pushq $-0x1
popq %r12
movl %r12d, %ebp
movl %eax, %ecx
shll %cl, %ebp
notl %ebp
movq 0x90(%rbx), %rdi
callq 0x28a939
leal 0x1(%rax), %ecx
shll %cl, %ebp
movslq %ebp, %r14
andq %r15, %r14
movq 0x90(%rbx), %rdi
callq 0x28a939
leal 0x1(%rax), %ecx
shrq %cl, %r14
movq 0x70(%rbx), %rdi
movq %r14, %rsi
callq 0x17ffcd
cmpq $0x1, %rax
jne 0x183741
movq 0x70(%rbx), %rdi
movl %r14d, %esi
andl $0x1, %esi
negq %rsi
orq $0x1, %rsi
addq %r14, %rsi
callq 0x17ffcd
cmpq $0x1, %rax
jne 0x183741
movq %rbx, %rdi
movq %r14, %rsi
callq 0x183094
movq %rax, %r13
jmp 0x18364f
movq 0x28(%rsp), %r15
movq 0x8(%rsp), %rsi
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %r8
incq %rdi
movq %r8, %r14
jmp 0x1835ec
cmpb $0x0, 0x14(%rsp)
je 0x18376c
incq 0x50(%rsp)
incq %r15
jmp 0x1832a0
movq %rbx, %rdi
callq 0x1825cd
movq %rax, %r14
cmpb $0x0, 0x14(%rsp)
je 0x18378b
callq 0x9cce9
leaq 0x1cbfe3(%rip), %rsi    # 0x34f775
movq 0x30(%rsp), %rdi
movl $0x546, %edx            # imm = 0x546
callq 0x936f9
leaq 0x1cc6da(%rip), %rdi    # 0x34fe82
movq 0x38(%rsp), %rsi
xorl %eax, %eax
callq 0x92a82
leaq 0x1cc6d7(%rip), %rdi    # 0x34fe92
movq %r14, %rsi
xorl %eax, %eax
callq 0x92a82
movq %rbx, %rdi
callq 0x181ac4
movq %r14, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2b4782(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x161823(%rip), %rsi    # 0x2e5013
leaq 0x1cc5f7(%rip), %rdx    # 0x34fdee
leaq 0x1cc5a1(%rip), %rcx    # 0x34fd9f
leaq 0x1cbf70(%rip), %r8     # 0x34f775
movl $0x50c, %r9d            # imm = 0x50C
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x2b474a(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1617eb(%rip), %rsi    # 0x2e5013
leaq 0x1cc00a(%rip), %rdx    # 0x34f839
leaq 0x1cc569(%rip), %rcx    # 0x34fd9f
leaq 0x1cbf38(%rip), %r8     # 0x34f775
movl $0x4da, %r9d            # imm = 0x4DA
jmp 0x18380b