// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/rdj-contigs-graph.c
// Function: gt_contigs_graph_extend_contigs
void gt_contigs_graph_extend_contigs(GtContigsGraph *cg, bool use_only_internal)
{
  GtUword cnum, nof_v_before;
  GtArrayGtContigsGraphPathElem path[2];
  GT_INITARRAY(&(path[0]), GtContigsGraphPathElem);
  GT_INITARRAY(&(path[1]), GtContigsGraphPathElem);
  for (cnum = 0; cnum < cg->nof_v; cnum++)
  {
    cg->v_m[cnum].selected = false;
    cg->v_m[cnum].processed = false;
    cg->v_m[cnum].visited = false;
  }
  nof_v_before = cg->nof_v;
  gt_log_log("nof_v before extending contigs = "GT_WU"", cg->nof_v);
  for (cnum = 0; cnum < nof_v_before; cnum++)
  {
    GtContigsGraphPathEndInfo info[2];
    GtUword deg[2];
    unsigned int startdir;
    deg[0] = (GtUword)cg->v_spm[0][cnum].deg;
    deg[1] = (GtUword)cg->v_spm[1][cnum].deg;
    if ((cg->v_m[cnum].deleted) ||
        (cg->v_m[cnum].optional) ||
        (deg[0] > 1UL) || /* junction */
        (deg[1] > 1UL) || /* junction */
        (deg[0] == 0 && deg[1] == 0)) /* isolated */
      continue;
    gt_log_log("extend_contigs, cnum = "GT_WU"", cnum);
    for (startdir = 0; startdir < 2U; startdir++)
    {
      if (cg->v_spm[startdir][cnum].deg == 0)
      {
        info[startdir].depth = 0;
        info[startdir].t = GT_CONTIGS_GRAPH_SINGLE_END;
        info[startdir].dest = (GtUword)
          gt_contigs_graph_find_only_spm_edge(cg, cnum,
              GT_CONTIGS_GRAPH_OTHER_DIR(startdir))->dest;
        info[startdir].cnum = cnum;
        info[startdir].dir = GT_CONTIGS_GRAPH_OTHER_DIR(startdir);
        continue;
      }
      else
      {
        {
          GtUword cnum2;
          for (cnum2 = 0; cnum2 < nof_v_before; cnum2++)
          {
            cg->v_m[cnum2].visited = false;
          }
        }
        gt_contigs_graph_find_path_end(&(info[startdir]), &(path[startdir]),
            cg, cnum, startdir, use_only_internal);
      }
    }
    gt_contigs_graph_create_composite_vertex(cg, path, info);
    {
      GtUword cnum2;
      for (cnum2 = 0; cnum2 < nof_v_before; cnum2++)
      {
        if (cg->v_m[cnum2].processed && !cg->v_m[cnum2].deleted
        && info[0].t != GT_CONTIGS_GRAPH_CIRCULAR)
          gt_contigs_graph_rm_vertex(cg, cnum2);
      }
    }
  }
  for (cnum = 0; cnum < nof_v_before; cnum++)
  {
    if (cg->v_m[cnum].selected && !cg->v_m[cnum].deleted)
      gt_contigs_graph_rm_vertex(cg, cnum);
  }
  GT_FREEARRAY(&path[0], GtContigsGraphPathElem);
  GT_FREEARRAY(&path[1], GtContigsGraphPathElem);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %esi, %ebp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movq (%rdi), %r14
testq %r14, %r14
je 0x1d0df8
xorl %eax, %eax
movq 0x38(%rbx), %rcx
andb $-0x5, (%rcx,%rax)
movq 0x38(%rbx), %rcx
andb $-0x9, (%rcx,%rax)
movq 0x38(%rbx), %rcx
andb $-0x11, (%rcx,%rax)
incq %rax
movq (%rbx), %r14
cmpq %r14, %rax
jb 0x1d0dd5
leaq 0x1e6094(%rip), %rdi    # 0x3b6e93
movq %r14, %rsi
xorl %eax, %eax
callq 0x108e02
testq %r14, %r14
je 0x1d0f78
movzbl %bpl, %eax
movl %eax, 0xc(%rsp)
xorl %r15d, %r15d
movq 0x38(%rbx), %rax
movb (%rax,%r15), %al
testb $0x1, %al
je 0x1d0e36
incq %r15
cmpq %r14, %r15
jne 0x1d0e1d
jmp 0x1d0f52
testb $0x2, %al
jne 0x1d0e29
movq 0x18(%rbx), %rax
movzwl (%rax,%r15,8), %eax
cmpl $0x1, %eax
ja 0x1d0e29
movq 0x20(%rbx), %rcx
movzwl (%rcx,%r15,8), %ecx
cmpl $0x1, %ecx
ja 0x1d0e29
orq %rcx, %rax
je 0x1d0e29
leaq 0x1e6056(%rip), %rdi    # 0x3b6eb8
movq %r15, %rsi
xorl %eax, %eax
callq 0x108e02
xorl %r12d, %r12d
movq 0x18(%rbx,%r12,8), %rax
cmpw $0x0, (%rax,%r15,8)
je 0x1d0ebb
xorl %eax, %eax
movq 0x38(%rbx), %rcx
andb $-0x11, (%rcx,%rax)
incq %rax
cmpq %rax, %r14
jne 0x1d0e7e
movq %r12, %rax
shlq $0x5, %rax
leaq (%rsp,%rax), %rdi
addq $0x40, %rdi
leaq (%r12,%r12,2), %rax
leaq 0x10(%rsp,%rax,8), %rsi
movq %rbx, %rdx
movq %r15, %rcx
movl %r12d, %r8d
movl 0xc(%rsp), %r9d
callq 0x1d0760
jmp 0x1d0ef9
movq %r12, %rbp
shlq $0x5, %rbp
movq $0x0, 0x50(%rsp,%rbp)
movl $0x1, 0x5c(%rsp,%rbp)
movl %r12d, %r13d
xorl $0x1, %r13d
movq %rbx, %rdi
movq %r15, %rsi
movl %r13d, %edx
callq 0x1d0158
movl (%rax), %eax
movq %rax, 0x48(%rsp,%rbp)
movq %r15, 0x40(%rsp,%rbp)
movl %r13d, 0x58(%rsp,%rbp)
leaq 0x1(%r12), %rax
testq %r12, %r12
movq %rax, %r12
je 0x1d0e6f
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x1d0972
movl 0x5c(%rsp), %r13d
xorl %r12d, %r12d
movq 0x38(%rbx), %rax
movb (%rax,%r12), %al
testb $0x8, %al
je 0x1d0f45
testb $0x1, %al
jne 0x1d0f45
cmpl $0x3, %r13d
je 0x1d0f45
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1d038c
incq %r12
cmpq %r12, %r14
jne 0x1d0f24
jmp 0x1d0e29
xorl %r15d, %r15d
movq 0x38(%rbx), %rax
movb (%rax,%r15), %al
testb $0x4, %al
je 0x1d0f70
testb $0x1, %al
jne 0x1d0f70
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1d038c
incq %r15
cmpq %r15, %r14
jne 0x1d0f55
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1d0fa4
leaq 0x1e58b8(%rip), %rsi    # 0x3b6841
movl $0x477, %edx            # imm = 0x477
callq 0x109670
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x1d0fd2
leaq 0x28(%rsp), %rbx
leaq 0x1e5887(%rip), %rsi    # 0x3b6841
movl $0x478, %edx            # imm = 0x478
callq 0x109670
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq