// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/rdj-contigs-graph.c
// Function: gt_contigs_graph_show_dot_subgraph
int gt_contigs_graph_show_dot_subgraph(GtContigsGraph *cg,
    GtFile *outfp, GtUword *cnums, GtUword nofcnums,
    GtUword maxdepth, GtError *err)
{
  GtArray *stack;
  struct { GtUword v, d; } to_add, *current;
  GtUword next, cnum, i, v, d;
  GtContigsGraphSpmEdge *edge;
  unsigned int dir;

  stack = gt_array_new(sizeof (to_add));
  for (cnum = 0; cnum < cg->nof_v; cnum++)
  {
    cg->v_m[cnum].selected = false;
    cg->v_m[cnum].processed = false;
  }
  for (i = 0; i < nofcnums; i++)
  {
    cnum = cnums[i];
    if (cnum >= cg->nof_v)
    {
      gt_error_set(err, "Error by context output for contig "GT_WU": "
          "number of contigs is "GT_WU"", cnum, cg->nof_v);
      gt_array_delete(stack);
      return -1;
    }
    to_add.v = cnum;
    cg->v_m[cnum].selected = true;
    to_add.d = 1UL;
    gt_array_add(stack, to_add);
  }
  gt_file_xprintf(outfp, GT_CONTIGS_GRAPH_DOT_HEADER);
  for (next = 0; next < gt_array_size(stack); next++)
  {
    current = gt_array_get(stack, next);
    v = current->v;
    d = current->d;
    gt_contigs_graph_show_dot_for_contig(cg, v, outfp);
    cg->v_m[v].processed = true;
    to_add.d = d + 1UL;
    for (dir = 0; dir < 2U; dir++)
    {
      for (GT_CONTIGS_GRAPH_EACH_SPM_EDGE(cg, v, dir, edge))
      {
        if (cg->dot_show_deleted || !edge->deleted)
        {
          if (!cg->v_m[edge->dest].selected)
          {
            if (d < maxdepth)
            {
              to_add.v = (GtUword)edge->dest;
              gt_array_add(stack, to_add);
              cg->v_m[edge->dest].selected = true;
            }
            else
            {
              gt_file_xprintf(outfp, "  %u [style=invisible];\n", edge->dest);
            }
          }
        }
      }
    }
  }
  gt_array_delete(stack);
  gt_file_xprintf(outfp, GT_CONTIGS_GRAPH_DOT_FOOTER);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r14
movq %r8, %r15
movq %rcx, %rbp
movq %rdx, %r13
movq %rsi, (%rsp)
movq %rdi, %r12
pushq $0x10
popq %rdi
callq 0x5809c
xorl %edx, %edx
cmpq (%r12), %rdx
jae 0x17856e
movq 0x38(%r12), %rcx
andb $-0x5, (%rcx,%rdx)
movq 0x38(%r12), %rcx
andb $-0x9, (%rcx,%rdx)
incq %rdx
jmp 0x178551
movq %rax, 0x8(%rsp)
xorl %ebx, %ebx
cmpq %rbx, %rbp
je 0x1785ba
movq (%r13,%rbx,8), %rdx
movq (%r12), %rcx
cmpq %rcx, %rdx
jae 0x1786f6
movq %rdx, 0x10(%rsp)
movq 0x38(%r12), %rax
orb $0x4, (%rax,%rdx)
movq $0x1, 0x18(%rsp)
movq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
pushq $0x10
popq %rdx
callq 0x5851d
incq %rbx
jmp 0x178575
leaq 0x1d510f(%rip), %rsi    # 0x34d6d0
movq (%rsp), %rdi
xorl %eax, %eax
callq 0x8d432
xorl %r14d, %r14d
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x586a4
movq %rbx, %rdi
cmpq %rax, %r14
jae 0x1786db
movq %r14, 0x20(%rsp)
movq %r14, %rsi
callq 0x581aa
movq (%rax), %rbp
movq 0x8(%rax), %r13
movq %r12, %rdi
movq %rbp, %rsi
movq (%rsp), %rdx
callq 0x17721f
movq 0x38(%r12), %rax
orb $0x8, (%rax,%rbp)
leaq 0x1(%r13), %rax
movq %rax, 0x18(%rsp)
xorl %ebx, %ebx
cmpq $0x2, %rbx
je 0x1786ce
movq 0x18(%r12,%rbx,8), %rcx
movq 0x80(%r12,%rbx,8), %rax
movq (%rcx,%rbp,8), %rdx
shrq $0x10, %rdx
leaq (%rax,%rdx,8), %r14
movq 0x8(%rcx,%rbp,8), %rcx
shrq $0x10, %rcx
leaq (%rax,%rcx,8), %rax
cmpq %rax, %r14
jae 0x1786c6
cmpb $0x0, 0xa8(%r12)
jne 0x178666
testb $0x40, 0x7(%r14)
jne 0x1786b0
movq 0x38(%r12), %rax
movl (%r14), %edx
testb $0x4, (%rax,%rdx)
jne 0x1786b0
cmpq %r15, %r13
jae 0x17869e
movq %rdx, 0x10(%rsp)
movq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
pushq $0x10
popq %rdx
callq 0x5851d
movq 0x38(%r12), %rax
movl (%r14), %ecx
orb $0x4, (%rax,%rcx)
jmp 0x1786b0
movq (%rsp), %rdi
leaq 0x1d55bb(%rip), %rsi    # 0x34dc64
xorl %eax, %eax
callq 0x8d432
addq $0x8, %r14
movq 0x18(%r12,%rbx,8), %rcx
movq 0x80(%r12,%rbx,8), %rax
jmp 0x178642
incq %rbx
jmp 0x17861f
movq 0x20(%rsp), %r14
incq %r14
jmp 0x1785cf
callq 0x58eb9
leaq 0x1d9c32(%rip), %rsi    # 0x352319
xorl %ebp, %ebp
movq (%rsp), %rdi
xorl %eax, %eax
callq 0x8d432
jmp 0x178714
leaq 0x1d5526(%rip), %rsi    # 0x34dc23
movq %r14, %rdi
xorl %eax, %eax
callq 0x89dbb
movq 0x8(%rsp), %rdi
callq 0x58eb9
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq