// File: /workspace/github_c_makefile_star2_O2/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)
xorl %eax, %eax
movq (%rbx), %r14
cmpq %r14, %rax
jae 0x17834f
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
jmp 0x17832a
leaq 0x1d588d(%rip), %rdi    # 0x34dbe3
movq %r14, %rsi
xorl %eax, %eax
callq 0x92a82
movzbl %bpl, %eax
movl %eax, 0xc(%rsp)
xorl %r15d, %r15d
cmpq %r14, %r15
je 0x1784a5
movq 0x38(%rbx), %rax
movb (%rax,%r15), %al
testb $0x1, %al
je 0x178385
incq %r15
jmp 0x17836b
testb $0x2, %al
jne 0x178380
movq 0x18(%rbx), %rax
movzwl (%rax,%r15,8), %eax
cmpl $0x1, %eax
ja 0x178380
movq 0x20(%rbx), %rcx
movzwl (%rcx,%r15,8), %ecx
cmpl $0x1, %ecx
ja 0x178380
orq %rcx, %rax
je 0x178380
leaq 0x1d5857(%rip), %rdi    # 0x34dc08
movq %r15, %rsi
xorl %eax, %eax
callq 0x92a82
xorl %r12d, %r12d
cmpq $0x2, %r12
je 0x17845c
movq 0x18(%rbx,%r12,8), %rax
cmpw $0x0, (%rax,%r15,8)
je 0x178419
xorl %eax, %eax
cmpq %rax, %r14
je 0x1783e9
movq 0x38(%rbx), %rcx
andb $-0x11, (%rcx,%rax)
incq %rax
jmp 0x1783d7
movq %r12, %rax
shlq $0x5, %rax
leaq (%rsp,%rax), %rdi
addq $0x40, %rdi
imulq $0x18, %r12, %rax
leaq (%rsp,%rax), %rsi
addq $0x10, %rsi
movq %rbx, %rdx
movq %r15, %rcx
movl %r12d, %r8d
movl 0xc(%rsp), %r9d
callq 0x177b26
jmp 0x178454
movq %r12, %rbp
shlq $0x5, %rbp
andq $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 0x1773b5
movl (%rax), %eax
movq %rax, 0x48(%rsp,%rbp)
movq %r15, 0x40(%rsp,%rbp)
movl %r13d, 0x58(%rsp,%rbp)
incq %r12
jmp 0x1783be
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x177d89
movl 0x5c(%rsp), %r13d
xorl %r12d, %r12d
cmpq %r12, %r14
je 0x178380
movq 0x38(%rbx), %rax
movb (%rax,%r12), %al
testb $0x8, %al
je 0x1784a0
testb $0x1, %al
jne 0x1784a0
cmpl $0x3, %r13d
je 0x1784a0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x177735
incq %r12
jmp 0x178476
xorl %r15d, %r15d
cmpq %r15, %r14
je 0x1784cd
movq 0x38(%rbx), %rax
movb (%rax,%r15), %al
testb $0x4, %al
je 0x1784c8
testb $0x1, %al
jne 0x1784c8
movq %rbx, %rdi
movq %r15, %rsi
callq 0x177735
incq %r15
jmp 0x1784a8
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1784e8
leaq 0x1d50b3(%rip), %rsi    # 0x34d591
movl $0x477, %edx            # imm = 0x477
callq 0x936f9
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x178514
leaq 0x1d5098(%rip), %rsi    # 0x34d591
movl $0x478, %edx            # imm = 0x478
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x936f9
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq