// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/rdj-contigs-graph.c
// Function: gt_contigs_graph_create_composite_vertex
void gt_contigs_graph_create_composite_vertex(GtContigsGraph *cg,
    GtArrayGtContigsGraphPathElem *path, GtContigsGraphPathEndInfo *info)
{
  GtUword offset, cnum, nof_units, i, new_cnum;
  unsigned int dir;
  GT_UNUSED unsigned int enddir;
  gt_log_log("... create_composite_vertex");
  for (dir = 0; dir <= 1U; dir++)
    gt_log_log("info[%u]: cnum = "GT_WU", dest = "GT_WU", depth = "GT_WU", "
        "dir = %u, t = %s",
        dir,
        info[dir].cnum,
        info[dir].dest,
        info[dir].depth,
        info[dir].dir,
        info[dir].t == GT_CONTIGS_GRAPH_CIRCULAR ? "circular" :
          (info[dir].t == GT_CONTIGS_GRAPH_SINGLE_END ? "single_end" :
            (info[dir].t == GT_CONTIGS_GRAPH_MULTIPLE_END ? "multiple_end" :
              "junction")));
  if (info[0].t == GT_CONTIGS_GRAPH_CIRCULAR)
  {
    gt_assert(info[1].t == GT_CONTIGS_GRAPH_CIRCULAR);
    gt_assert(info[0].depth == info[1].depth);
    nof_units = 1UL + info[0].depth;
    /* it would be better to break circles at an optional,
     * if one is available */
  }
  else
  {
    nof_units = 1UL + info[0].depth + info[1].depth;
  }
  new_cnum = gt_contigs_graph_append_vertex(cg, 0, 0, nof_units);
#if 0
  new_cnum = gt_contigs_graph_append_vertex(cg,
      info[0].t == GT_CONTIGS_GRAPH_JUNCTION ? 1UL : 0,
      info[1].t == GT_CONTIGS_GRAPH_JUNCTION ? 1UL : 0,
      nof_units);
#endif
  gt_log_log("appended: vertex "GT_WU" (units: "GT_WU")", new_cnum, nof_units);
  cnum = info[1].cnum;
  gt_log_log("--- start traversal from "GT_WU"", cnum);
  dir = info[1].dir;
  offset = 0;
  for (i = 0; i < nof_units; i++)
  {
    GtContigsGraphSeqUnit *unit;
    unit = cg->units + cg->v_cmp[new_cnum - cg->nof_simple_v].ptr + i;
    unit->seqnum = cnum;
    if (i == 0)
      unit->revcomp = (info[1].dir == 1U);
    else if (i == nof_units - 1U)
      unit->revcomp = (info[0].dir == 0);
    else
      unit->revcomp = (dir == 1U);
    unit->offset = offset;
    if (i + 1 < nof_units)
    {
      GtContigsGraphSpmEdge *edge;
      GtUword dest;
      if (i < info[1].depth) {
        dest = path[1].spaceGtContigsGraphPathElem[info[1].depth - 1 - i].dest;
        dir = path[1].spaceGtContigsGraphPathElem[info[1].depth - 1 - i].dir;
      }
      else { /* if (i >= info[1].depth) */
        dest = path[0].spaceGtContigsGraphPathElem[i - info[1].depth].dest;
        dir = path[0].spaceGtContigsGraphPathElem[i - info[1].depth].dir;
      }
      edge = gt_contigs_graph_find_spm_edge(cg, cnum, dir, dest);
      cnum = (GtUword)edge->dest;
      dir = GT_CONTIGS_GRAPH_VALID_PATH_DIR(dir, edge->reverse);
      offset = (GtUword)edge->ovlen;
    }
  }
  gt_log_log("cnum = "GT_WU", info[0].cnum = "GT_WU"", cnum, info[0].cnum);
  gt_assert(cnum == info[0].cnum);
  cnum = info[1].cnum;
  gt_log_log("--- start traversal from "GT_WU"", cnum);
  gt_assert(nof_units >= 1UL);
  if (info[1].t == GT_CONTIGS_GRAPH_CIRCULAR)
  {
    nof_units--;
    gt_assert(nof_units >= 1UL);
  }
  for (i = 0; i < nof_units - 1UL; i++)
  {
    GtContigsGraphSpmEdge *edge;
    GtUword src = cnum;
    GtUword dest;
    GT_UNUSED bool extended;
    if (i < info[1].depth) {
      dest = path[1].spaceGtContigsGraphPathElem[info[1].depth - 1 - i].dest;
      dir = path[1].spaceGtContigsGraphPathElem[info[1].depth - 1 - i].dir;
      extended = path[1].spaceGtContigsGraphPathElem[info[1].depth - 1 - i].
        extended;
    }
    else { /* if (i >= info[1].depth) */
      dest = path[0].spaceGtContigsGraphPathElem[i - info[1].depth].dest;
      dir = path[0].spaceGtContigsGraphPathElem[i - info[1].depth].dir;
      extended = path[0].spaceGtContigsGraphPathElem[i - info[1].depth].
        extended;
    }
    edge = gt_contigs_graph_find_spm_edge(cg, cnum, dir, dest);
    cnum = (GtUword)edge->dest;
    gt_log_log("traverse edge "GT_WU" -- "GT_WU"", src, cnum);
    /*dir = GT_CONTIGS_GRAPH_VALID_PATH_DIR(dir, edge->reverse);*/
    if (cg->v_spm[0][src].deg == (uint64_t)1 &&
        cg->v_spm[1][src].deg == (uint64_t)1)
    {
      gt_log_log("mark vertex "GT_WU" (internal)", src);
      cg->v_m[src].selected = true;
     /* if (!extended && i > 1 && i < nof_units - 2)
        cg->v_m[src].processed = true;*/
    }
  }
  if (info[1].t != GT_CONTIGS_GRAPH_CIRCULAR)
  {
    gt_log_log("cnum = "GT_WU", info[0].cnum = "GT_WU"", cnum, info[0].cnum);
    gt_assert(cnum == info[0].cnum);
  }
  else
  {
    gt_log_log("cnum = "GT_WU", info[0].dest = "GT_WU"", cnum, info[0].dest);
    gt_assert(cnum == info[0].dest);
  }
  if (info[1].t == GT_CONTIGS_GRAPH_CIRCULAR)
  {
    gt_log_log("mark vertex "GT_WU" (circle end)", info[1].cnum);
    cg->v_m[info[1].cnum].selected = true;
  }
  if (info[0].t == GT_CONTIGS_GRAPH_SINGLE_END)
  {
    gt_log_log("mark vertex "GT_WU" (single end)", info[0].cnum);
    cg->v_m[info[0].cnum].selected = true;
  }
  if (info[1].t == GT_CONTIGS_GRAPH_SINGLE_END)
  {
    gt_log_log("mark vertex "GT_WU" (single end)", info[1].cnum);
    cg->v_m[info[1].cnum].selected = true;
  }
#if 0
  for (enddir = 0; enddir <= 1U; enddir++)
  {
    if (info[dir].t == GT_CONTIGS_GRAPH_JUNCTION)
    {
      GtContigsGraphSpmEdge *edge;
      cnum = info[enddir].cnum;
      dir = info[enddir].dir;
      /* set the edge on junction, recycling the previously deleted edge */
      edge = gt_contigs_graph_find_deleted_spm_edge(cg, cnum, dir);
      edge->deleted = false;
      cg->v_spm[dir][cnum].deg++;
      edge->dest = (uint32_t)new_cnum;
      edge->reverse = (dir == enddir);
      edge->ovlen = 0; /* this should be set to the junction contig length */
      /*cg->v_m[cnum].optional = true;*/
      /* set the edge on the composite contig */
      edge = cg->e_spm[enddir] + cg->v_spm[enddir][new_cnum].ptr;
      gt_assert(edge->deleted == false);
      edge->dest = (uint32_t)cnum;
      edge->reverse = (dir == enddir);
      edge->ovlen = 0; /* this should be set to the junction contig length */
    }
  }
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %rbx
movq %rsi, 0x10(%rsp)
movq %rdi, %r14
leaq 0x1e62ef(%rip), %rdi    # 0x3b6c81
xorl %eax, %eax
callq 0x108e02
movq %rbx, 0x18(%rsp)
addq $0x1c, %rbx
leaq 0x1ad05e(%rip), %r13    # 0x37da07
leaq 0x1e62ed(%rip), %r15    # 0x3b6c9d
leaq 0x1e633e(%rip), %rbp    # 0x3b6cf5
xorl %r12d, %r12d
movl (%rbx), %ecx
cmpl $0x1, %ecx
je 0x1d09dc
movq %r13, %rax
cmpl $0x3, %ecx
je 0x1d09e3
cmpl $0x2, %ecx
movq %rbp, %rax
leaq 0x1e6312(%rip), %rcx    # 0x3b6ce8
cmoveq %rcx, %rax
jmp 0x1d09e3
leaq 0x1e62fa(%rip), %rax    # 0x3b6cdd
movq -0x1c(%rbx), %rdx
movq -0x14(%rbx), %rcx
movq -0xc(%rbx), %r8
movl -0x4(%rbx), %r9d
movq %rax, (%rsp)
movq %r15, %rdi
movl %r12d, %esi
xorl %eax, %eax
callq 0x108e02
incq %r12
addq $0x20, %rbx
cmpq $0x1, %r12
je 0x1d09ba
movq 0x18(%rsp), %r15
cmpl $0x3, 0x1c(%r15)
jne 0x1d0a3b
cmpl $0x3, 0x3c(%r15)
jne 0x1d0d8f
movq 0x10(%r15), %r12
cmpq 0x30(%r15), %r12
jne 0x1d0d94
incq %r12
jmp 0x1d0a4a
movq 0x10(%r15), %rax
movq 0x30(%r15), %rcx
leaq (%rax,%rcx), %r12
incq %r12
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %r12, %rcx
callq 0x1cf4e5
leaq 0x1e630d(%rip), %rdi    # 0x3b6d6d
movq %rax, 0x30(%rsp)
movq %rax, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x108e02
movq 0x20(%r15), %r13
leaq 0x1e6312(%rip), %rdi    # 0x3b6d8f
movq %r13, %rsi
xorl %eax, %eax
callq 0x108e02
testq %r12, %r12
je 0x1d0bc1
movabsq $-0x8000000000000000, %r9 # imm = 0x8000000000000000
movl 0x38(%r15), %ecx
leaq -0x1(%r12), %rax
movq %rax, 0x28(%rsp)
xorl %ebp, %ebp
leaq -0x1(%r9), %r10
xorl %eax, %eax
xorl %edx, %edx
movq %r10, 0x20(%rsp)
movq 0x40(%r14), %rsi
movq 0x30(%rsp), %rdi
subq 0x10(%r14), %rdi
movq (%rsi,%rdi,8), %rsi
shrq $0xc, %rsi
andq $-0x10, %rsi
addq 0x58(%r14), %rsi
movq %r13, %rdi
andq %r10, %rdi
movq (%rbp,%rsi), %r8
andq %r9, %r8
orq %rdi, %r8
movq %r8, (%rbp,%rsi)
testq %rdx, %rdx
je 0x1d0afd
cmpq %rdx, 0x28(%rsp)
jne 0x1d0b11
cmpl $0x0, 0x18(%r15)
jmp 0x1d0b02
cmpl $0x1, 0x38(%r15)
movl $0x0, %r8d
cmoveq %r9, %r8
orq %rdi, %r8
jmp 0x1d0b24
cmpl $0x1, %ecx
movl $0x0, %r8d
cmoveq %r9, %r8
orq %r8, %rdi
movq %rdi, %r8
movq %r8, (%rsi,%rbp)
movq %rax, 0x8(%rsi,%rbp)
leaq 0x1(%rdx), %rbx
cmpq %r12, %rbx
jae 0x1d0bb1
movq 0x30(%r15), %rax
cmpq %rax, %rdx
jae 0x1d0b58
notq %rdx
shlq $0x4, %rax
movq 0x10(%rsp), %rcx
addq 0x18(%rcx), %rax
shlq $0x4, %rdx
addq %rax, %rdx
jmp 0x1d0b6a
movq 0x10(%rsp), %rcx
movq (%rcx), %rdx
shlq $0x4, %rax
subq %rax, %rdx
addq %rbp, %rdx
movq (%rdx), %rcx
movl 0x8(%rdx), %r15d
movq %r14, %rdi
movq %r13, %rsi
movl %r15d, %edx
callq 0x1d01b8
movl (%rax), %r13d
movl 0x4(%rax), %eax
testl %r15d, %r15d
setne %cl
movl %eax, %edx
shrl $0x1d, %edx
andl $0x1, %edx
xorb %cl, %dl
movzbl %dl, %ecx
andl $0x1fffffff, %eax       # imm = 0x1FFFFFFF
movq 0x18(%rsp), %r15
movabsq $-0x8000000000000000, %r9 # imm = 0x8000000000000000
movq 0x20(%rsp), %r10
addq $0x10, %rbp
movq %rbx, %rdx
cmpq %rbx, %r12
jne 0x1d0ab7
movq (%r15), %rdx
leaq 0x1e61e1(%rip), %rdi    # 0x3b6dac
movq %r13, %rsi
xorl %eax, %eax
callq 0x108e02
cmpq (%r15), %r13
jne 0x1d0d85
movq %r15, %rbx
movq 0x20(%r15), %r15
leaq 0x1e61a3(%rip), %rdi    # 0x3b6d8f
movq %r15, %rsi
xorl %eax, %eax
callq 0x108e02
testq %r12, %r12
je 0x1d0d8a
cmpl $0x3, 0x3c(%rbx)
jne 0x1d0c0e
decq %r12
je 0x1d0d99
decq %r12
je 0x1d0cc4
xorl %ebp, %ebp
xorl %ebx, %ebx
movq %r15, %r13
movq 0x18(%rsp), %rax
movq 0x30(%rax), %rcx
cmpq %rcx, %rbx
jae 0x1d0c48
movq %rbx, %rax
notq %rax
shlq $0x4, %rcx
movq 0x10(%rsp), %rdx
addq 0x18(%rdx), %rcx
shlq $0x4, %rax
addq %rcx, %rax
jmp 0x1d0c5a
movq 0x10(%rsp), %rax
movq (%rax), %rax
shlq $0x4, %rcx
subq %rcx, %rax
addq %rbp, %rax
movq (%rax), %rcx
movl 0x8(%rax), %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x1d01b8
movl (%rax), %r15d
leaq 0x1e617c(%rip), %rdi    # 0x3b6df1
movq %r13, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x108e02
movq 0x18(%r14), %rax
cmpw $0x1, (%rax,%r13,8)
jne 0x1d0cb4
movq 0x20(%r14), %rax
cmpw $0x1, (%rax,%r13,8)
jne 0x1d0cb4
leaq 0x1e6169(%rip), %rdi    # 0x3b6e0a
movq %r13, %rsi
xorl %eax, %eax
callq 0x108e02
movq 0x38(%r14), %rax
orb $0x4, (%rax,%r13)
incq %rbx
addq $0x10, %rbp
cmpq %rbx, %r12
jne 0x1d0c1b
movq 0x18(%rsp), %rbx
cmpl $0x3, 0x3c(%rbx)
jne 0x1d0cef
movq 0x8(%rbx), %rdx
leaq 0x1e614b(%rip), %rdi    # 0x3b6e25
movq %r15, %rsi
xorl %eax, %eax
callq 0x108e02
cmpq 0x8(%rbx), %r15
je 0x1d0d0c
callq 0x6bd3d
movq (%rbx), %rdx
leaq 0x1e60b3(%rip), %rdi    # 0x3b6dac
movq %r15, %rsi
xorl %eax, %eax
callq 0x108e02
cmpq (%rbx), %r15
jne 0x1d0d9e
cmpl $0x3, 0x3c(%rbx)
jne 0x1d0d30
movq 0x20(%rbx), %rsi
leaq 0x1e613c(%rip), %rdi    # 0x3b6e59
xorl %eax, %eax
callq 0x108e02
movq 0x38(%r14), %rax
movq 0x20(%rbx), %rcx
orb $0x4, (%rax,%rcx)
cmpl $0x1, 0x1c(%rbx)
jne 0x1d0d52
movq (%rbx), %rsi
leaq 0x1e6136(%rip), %rdi    # 0x3b6e76
xorl %eax, %eax
callq 0x108e02
movq 0x38(%r14), %rax
movq (%rbx), %rcx
orb $0x4, (%rax,%rcx)
cmpl $0x1, 0x3c(%rbx)
jne 0x1d0d76
movq 0x20(%rbx), %rsi
leaq 0x1e6113(%rip), %rdi    # 0x3b6e76
xorl %eax, %eax
callq 0x108e02
movq 0x38(%r14), %rax
movq 0x20(%rbx), %rcx
orb $0x4, (%rax,%rcx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x6bccb
callq 0x6bdaf
callq 0x6bc59
callq 0x6bc92
callq 0x6bd76
callq 0x6bd04