// File: /workspace/github_c_makefile_star2_O1/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, 0x8(%rsp)
movq %r8, %r15
movq %rcx, %rbp
movq %rdx, %r13
movq %rsi, (%rsp)
movq %rdi, %r12
movl $0x10, %edi
callq 0xd46fc
movq %rax, %r14
cmpq $0x0, (%r12)
je 0x1d1038
xorl %eax, %eax
movq 0x38(%r12), %rcx
andb $-0x5, (%rcx,%rax)
movq 0x38(%r12), %rcx
andb $-0x9, (%rcx,%rax)
incq %rax
cmpq (%r12), %rax
jb 0x1d101d
testq %rbp, %rbp
je 0x1d1082
xorl %ebx, %ebx
movq (%r13,%rbx,8), %rdx
movq (%r12), %rcx
cmpq %rcx, %rdx
jae 0x1d11da
movq %rdx, 0x18(%rsp)
movq 0x38(%r12), %rax
orb $0x4, (%rax,%rdx)
movq $0x1, 0x20(%rsp)
movl $0x10, %edx
movq %r14, %rdi
leaq 0x18(%rsp), %rsi
callq 0xd49ce
incq %rbx
cmpq %rbx, %rbp
jne 0x1d103f
leaq 0x1e58f7(%rip), %rsi    # 0x3b6980
movq (%rsp), %rdi
xorl %eax, %eax
callq 0x103d21
movq %r14, %rdi
callq 0xd4a9a
testq %rax, %rax
je 0x1d11bc
xorl %ebx, %ebx
movq %r14, 0x10(%rsp)
movq %r14, %rdi
movq %rbx, 0x8(%rsp)
movq %rbx, %rsi
callq 0xd47ba
movq (%rax), %r13
movq 0x8(%rax), %rbp
movq %r12, %rdi
movq %r13, %rsi
movq (%rsp), %rdx
callq 0x1cffb0
movq 0x38(%r12), %rax
orb $0x8, (%rax,%r13)
leaq 0x1(%rbp), %rax
movq %rax, 0x20(%rsp)
xorl %r14d, %r14d
movq 0x18(%r12,%r14,8), %rax
movq 0x80(%r12,%r14,8), %rcx
movq (%rax,%r13,8), %rdx
movq 0x8(%rax,%r13,8), %rax
shrq $0x10, %rdx
leaq (%rcx,%rdx,8), %rbx
shrq $0x10, %rax
leaq (%rcx,%rax,8), %rax
cmpq %rax, %rbx
jae 0x1d118e
cmpb $0x0, 0xa8(%r12)
jne 0x1d1124
testb $0x40, 0x7(%rbx)
jne 0x1d116e
movq 0x38(%r12), %rax
movl (%rbx), %edx
testb $0x4, (%rax,%rdx)
jne 0x1d116e
cmpq %r15, %rbp
jae 0x1d115c
movq %rdx, 0x18(%rsp)
movl $0x10, %edx
movq 0x10(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xd49ce
movq 0x38(%r12), %rax
movl (%rbx), %ecx
orb $0x4, (%rax,%rcx)
jmp 0x1d116e
movq (%rsp), %rdi
leaq 0x1e5dad(%rip), %rsi    # 0x3b6f14
xorl %eax, %eax
callq 0x103d21
addq $0x8, %rbx
movq 0x18(%r12,%r14,8), %rax
movq 0x8(%rax,%r13,8), %rax
shrq $0xd, %rax
andq $-0x8, %rax
addq 0x80(%r12,%r14,8), %rax
jmp 0x1d110e
leaq 0x1(%r14), %rax
testq %r14, %r14
movq %rax, %r14
je 0x1d10e8
movq 0x8(%rsp), %rbx
incq %rbx
movq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0xd4a9a
cmpq %rax, %rbx
jb 0x1d10ac
movq %r14, %rdi
callq 0xd4ef4
leaq 0x1ea306(%rip), %rsi    # 0x3bb4d1
movq (%rsp), %rdi
xorl %eax, %eax
callq 0x103d21
xorl %eax, %eax
jmp 0x1d11fa
leaq 0x1e5cf2(%rip), %rsi    # 0x3b6ed3
movq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x1019cf
movq %r14, %rdi
callq 0xd4ef4
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq