// File: /workspace/github_c_makefile_star2_O3/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
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
cmpq $0x0, (%rdi)
je 0x1c7d09
movl %esi, %ebp
movq %rdi, %rbx
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 0x1c7b6b
leaq 0x1e5cfe(%rip), %rdi    # 0x3ad893
movq %r14, %rsi
xorl %eax, %eax
callq 0x103d72
testq %r14, %r14
je 0x1c7d19
movzbl %bpl, %eax
movl %eax, 0xc(%rsp)
xorl %r15d, %r15d
movq 0x38(%rbx), %rax
movb (%rax,%r15), %al
testb $0x1, %al
je 0x1c7bcc
incq %r15
cmpq %r14, %r15
jne 0x1c7bb3
jmp 0x1c7ce1
testb $0x2, %al
jne 0x1c7bbf
movq 0x18(%rbx), %rax
movzwl (%rax,%r15,8), %eax
cmpl $0x1, %eax
ja 0x1c7bbf
movq 0x20(%rbx), %rcx
movzwl (%rcx,%r15,8), %ecx
cmpl $0x1, %ecx
ja 0x1c7bbf
orq %rcx, %rax
je 0x1c7bbf
leaq 0x1e5cc0(%rip), %rdi    # 0x3ad8b8
movq %r15, %rsi
xorl %eax, %eax
callq 0x103d72
movb $0x1, %bpl
leaq 0x40(%rsp), %rdi
movq %rdi, %r13
leaq 0x10(%rsp), %rsi
xorl %r12d, %r12d
movq 0x18(%rbx,%r12,8), %rax
cmpw $0x0, (%rax,%r15,8)
je 0x1c7c49
xorl %eax, %eax
movq 0x38(%rbx), %rcx
andb $-0x11, (%rcx,%rax)
incq %rax
cmpq %rax, %r14
jne 0x1c7c24
movq %rbx, %rdx
movq %r15, %rcx
movl %r12d, %r8d
movl 0xc(%rsp), %r9d
callq 0x1c7515
jmp 0x1c7c79
movq $0x0, 0x10(%r13)
movl $0x1, 0x1c(%r13)
xorl $0x1, %r12d
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
callq 0x1c6ebb
movl (%rax), %eax
movq %rax, 0x8(%r13)
movq %r15, (%r13)
movl %r12d, 0x18(%r13)
movl $0x1, %r12d
leaq 0x60(%rsp), %rdi
movq %rdi, %r13
leaq 0x28(%rsp), %rsi
testb $0x1, %bpl
movl $0x0, %ebp
jne 0x1c7c15
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x1c76f4
movl 0x5c(%rsp), %ebp
xorl %r12d, %r12d
movq 0x38(%rbx), %rax
movb (%rax,%r12), %al
testb $0x8, %al
je 0x1c7cd4
testb $0x1, %al
jne 0x1c7cd4
cmpl $0x3, %ebp
je 0x1c7cd4
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1c70f9
incq %r12
cmpq %r12, %r14
jne 0x1c7cb4
jmp 0x1c7bbf
xorl %r15d, %r15d
movq 0x38(%rbx), %rax
movb (%rax,%r15), %al
testb $0x4, %al
je 0x1c7cff
testb $0x1, %al
jne 0x1c7cff
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1c70f9
incq %r15
cmpq %r15, %r14
jne 0x1c7ce4
jmp 0x1c7d19
leaq 0x1e5b83(%rip), %rdi    # 0x3ad893
xorl %esi, %esi
xorl %eax, %eax
callq 0x103d72
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1c7d34
leaq 0x1e5517(%rip), %rsi    # 0x3ad241
movl $0x477, %edx            # imm = 0x477
callq 0x1045eb
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x1c7d60
leaq 0x1e54fc(%rip), %rsi    # 0x3ad241
movl $0x478, %edx            # imm = 0x478
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1045eb
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq