// File: /workspace/github_c_makefile_star2_O2/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, 0x8(%rsp)
movq %rdi, %r14
leaq 0x1d5c28(%rip), %rdi    # 0x34d9d1
xorl %eax, %eax
callq 0x92a82
movq %rbx, 0x18(%rsp)
addq $0x1c, %rbx
leaq 0x19ccd7(%rip), %r15    # 0x314a97
leaq 0x1d5c26(%rip), %r12    # 0x34d9ed
leaq 0x1d5c77(%rip), %rbp    # 0x34da45
xorl %r13d, %r13d
cmpq $0x2, %r13
je 0x177e2a
movl (%rbx), %ecx
cmpl $0x1, %ecx
je 0x177df9
movq %r15, %rax
cmpl $0x3, %ecx
je 0x177e00
cmpl $0x2, %ecx
movq %rbp, %rax
leaq 0x1d5c45(%rip), %rcx    # 0x34da38
cmoveq %rcx, %rax
jmp 0x177e00
leaq 0x1d5c2d(%rip), %rax    # 0x34da2d
movq -0x1c(%rbx), %rdx
movq -0x14(%rbx), %rcx
movq -0xc(%rbx), %r8
movl -0x4(%rbx), %r9d
movq %rax, (%rsp)
movq %r12, %rdi
movl %r13d, %esi
xorl %eax, %eax
callq 0x92a82
incq %r13
addq $0x20, %rbx
jmp 0x177dd1
movq 0x18(%rsp), %rbx
cmpl $0x3, 0x1c(%rbx)
jne 0x177e52
cmpl $0x3, 0x3c(%rbx)
jne 0x17823b
movq 0x10(%rbx), %r15
cmpq 0x30(%rbx), %r15
jne 0x17826c
incq %r15
jmp 0x177e61
movq 0x10(%rbx), %rax
movq 0x30(%rbx), %rcx
leaq (%rax,%rcx), %r15
incq %r15
xorl %ebp, %ebp
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %r15, %rcx
callq 0x1765f6
movq %rax, %r13
leaq 0x1d5c41(%rip), %rdi    # 0x34dabd
movq %rax, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x92a82
movq 0x20(%rbx), %r12
leaq 0x1d5c4b(%rip), %rdi    # 0x34dadf
movq %r12, %rsi
xorl %eax, %eax
callq 0x92a82
movq %r12, %rsi
movabsq $-0x8000000000000000, %r11 # imm = 0x8000000000000000
leaq -0x1(%r15), %rax
movq %rax, 0x10(%rsp)
cmpl $0x1, 0x38(%rbx)
sete %cl
movq %r15, %r12
negq %r12
leaq -0x1(%r11), %rdi
xorl %eax, %eax
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rsi, %rdx
andq %rdi, %rdx
testb $0x1, %cl
movl $0x0, %esi
cmovneq %r11, %rsi
orq %rdx, %rsi
movq %rbp, %rcx
shlq $0x4, %rcx
decq %rbp
leaq (%r12,%rbp), %r9
incq %r9
je 0x177fe5
movq %rbp, %rdi
movq 0x40(%r14), %r8
movq %r13, %r10
subq 0x10(%r14), %r10
movq (%r8,%r10,8), %r8
shrq $0xc, %r8
andq $-0x10, %r8
addq 0x58(%r14), %r8
movq (%rcx,%r8), %r10
andq %r11, %r10
orq %rdx, %r10
movq %r10, (%rcx,%r8)
cmpq $-0x1, %rbp
je 0x177f3e
movq %rsi, %r10
cmpq $-0x1, %r9
jne 0x177f4f
cmpl $0x0, 0x18(%rbx)
jmp 0x177f42
cmpl $0x1, 0x38(%rbx)
movl $0x0, %r10d
cmoveq %r11, %r10
orq %rdx, %r10
movq %r10, (%r8,%rcx)
movq %rax, 0x8(%r8,%rcx)
addq $0x10, %rcx
leaq 0x1(%rdi), %rbp
addq $0x2, %rdi
cmpq %r15, %rdi
jae 0x177ef0
movq 0x30(%rbx), %rax
cmpq %rax, %rbp
jae 0x177f84
shlq $0x4, %rax
movq 0x8(%rsp), %rdx
addq 0x18(%rdx), %rax
subq %rcx, %rax
jmp 0x177f9b
movq 0x8(%rsp), %rdx
movq (%rdx), %rdx
shlq $0x4, %rax
subq %rax, %rdx
leaq (%rdx,%rcx), %rax
addq $-0x10, %rax
incq %rbp
movq (%rax), %rcx
movl 0x8(%rax), %edx
movl %edx, 0x24(%rsp)
movq %r14, %rdi
movq 0x28(%rsp), %rsi
callq 0x177447
movl (%rax), %esi
movl 0x4(%rax), %eax
cmpl $0x0, 0x24(%rsp)
setne %dl
movl %eax, %ecx
shrl $0x1d, %ecx
andl $0x1, %ecx
xorb %dl, %cl
andl $0x1fffffff, %eax       # imm = 0x1FFFFFFF
movabsq $-0x8000000000000000, %r11 # imm = 0x8000000000000000
movq 0x30(%rsp), %rdi
jmp 0x177ecc
movq (%rbx), %rdx
leaq 0x1d5b0d(%rip), %rdi    # 0x34dafc
movq 0x28(%rsp), %r12
movq %r12, %rsi
xorl %eax, %eax
callq 0x92a82
cmpq (%rbx), %r12
jne 0x1781d9
movq 0x20(%rbx), %rbp
leaq 0x1d5acd(%rip), %rdi    # 0x34dadf
movq %rbp, %rsi
xorl %eax, %eax
callq 0x92a82
testq %r15, %r15
je 0x17820a
cmpl $0x3, 0x3c(%rbx)
jne 0x178040
cmpq $0x0, 0x10(%rsp)
je 0x17829a
addq $-0x2, %r15
movq %r15, 0x10(%rsp)
pushq $-0x10
popq %r15
leaq 0x1d5af6(%rip), %r12    # 0x34db41
xorl %ebx, %ebx
cmpq %rbx, 0x10(%rsp)
je 0x1780ec
movq 0x18(%rsp), %rax
movq 0x30(%rax), %rax
movq %rbx, %rcx
subq %rax, %rcx
jae 0x17807b
shlq $0x4, %rax
movq 0x8(%rsp), %rcx
addq 0x18(%rcx), %rax
addq %r15, %rax
jmp 0x17808a
shlq $0x4, %rcx
movq 0x8(%rsp), %rax
addq (%rax), %rcx
movq %rcx, %rax
movq (%rax), %rcx
movl 0x8(%rax), %edx
movq %r14, %rdi
movq %rbp, %rsi
callq 0x177447
movl (%rax), %r13d
movq %r12, %rdi
movq %rbp, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x92a82
movq 0x18(%r14), %rax
cmpw $0x1, (%rax,%rbp,8)
jne 0x1780dd
movq 0x20(%r14), %rax
cmpw $0x1, (%rax,%rbp,8)
jne 0x1780dd
leaq 0x1d5a8f(%rip), %rdi    # 0x34db5a
movq %rbp, %rsi
xorl %eax, %eax
callq 0x92a82
movq 0x38(%r14), %rax
orb $0x4, (%rax,%rbp)
incq %rbx
addq $-0x10, %r15
movq %r13, %rbp
jmp 0x17804d
movq 0x18(%rsp), %rbx
cmpl $0x3, 0x3c(%rbx)
jne 0x178143
movq 0x8(%rbx), %rdx
leaq 0x1d5a73(%rip), %rdi    # 0x34db75
movq %rbp, %rsi
xorl %eax, %eax
callq 0x92a82
cmpq 0x8(%rbx), %rbp
je 0x178160
movq 0x2bfe4f(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x16cef0(%rip), %rsi    # 0x2e5013
leaq 0x1d5a6a(%rip), %rdx    # 0x34db94
leaq 0x1d5944(%rip), %rcx    # 0x34da75
leaq 0x1d5459(%rip), %r8     # 0x34d591
movl $0x405, %r9d            # imm = 0x405
jmp 0x1782f4
movq (%rbx), %rdx
leaq 0x1d59af(%rip), %rdi    # 0x34dafc
movq %rbp, %rsi
xorl %eax, %eax
callq 0x92a82
cmpq (%rbx), %rbp
jne 0x1782c8
cmpl $0x3, 0x3c(%rbx)
jne 0x178184
movq 0x20(%rbx), %rsi
leaq 0x1d5a38(%rip), %rdi    # 0x34dba9
xorl %eax, %eax
callq 0x92a82
movq 0x38(%r14), %rax
movq 0x20(%rbx), %rcx
orb $0x4, (%rax,%rcx)
cmpl $0x1, 0x1c(%rbx)
jne 0x1781a6
movq (%rbx), %rsi
leaq 0x1d5a32(%rip), %rdi    # 0x34dbc6
xorl %eax, %eax
callq 0x92a82
movq 0x38(%r14), %rax
movq (%rbx), %rcx
orb $0x4, (%rax,%rcx)
cmpl $0x1, 0x3c(%rbx)
jne 0x1781ca
movq 0x20(%rbx), %rsi
leaq 0x1d5a0f(%rip), %rdi    # 0x34dbc6
xorl %eax, %eax
callq 0x92a82
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
movq 0x2bfd88(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x16ce29(%rip), %rsi    # 0x2e5013
leaq 0x1d592a(%rip), %rdx    # 0x34db1b
leaq 0x1d587d(%rip), %rcx    # 0x34da75
leaq 0x1d5392(%rip), %r8     # 0x34d591
movl $0x3d5, %r9d            # imm = 0x3D5
jmp 0x1782f4
movq 0x2bfd57(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x16cdf8(%rip), %rsi    # 0x2e5013
leaq 0x1d590e(%rip), %rdx    # 0x34db30
leaq 0x1d584c(%rip), %rcx    # 0x34da75
leaq 0x1d5361(%rip), %r8     # 0x34d591
movl $0x3d8, %r9d            # imm = 0x3D8
jmp 0x1782f4
movq 0x2bfd26(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x16cdc7(%rip), %rsi    # 0x2e5013
leaq 0x1d57fb(%rip), %rdx    # 0x34da4e
leaq 0x1d581b(%rip), %rcx    # 0x34da75
leaq 0x1d5330(%rip), %r8     # 0x34d591
movl $0x3a0, %r9d            # imm = 0x3A0
jmp 0x1782f4
movq 0x2bfcf5(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x16cd96(%rip), %rsi    # 0x2e5013
leaq 0x1d581a(%rip), %rdx    # 0x34da9e
leaq 0x1d57ea(%rip), %rcx    # 0x34da75
leaq 0x1d52ff(%rip), %r8     # 0x34d591
movl $0x3a1, %r9d            # imm = 0x3A1
jmp 0x1782f4
movq 0x2bfcc7(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x16cd68(%rip), %rsi    # 0x2e5013
leaq 0x1d587e(%rip), %rdx    # 0x34db30
leaq 0x1d57bc(%rip), %rcx    # 0x34da75
leaq 0x1d52d1(%rip), %r8     # 0x34d591
movl $0x3dc, %r9d            # imm = 0x3DC
jmp 0x1782f4
movq 0x2bfc99(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x16cd3a(%rip), %rsi    # 0x2e5013
leaq 0x1d583b(%rip), %rdx    # 0x34db1b
leaq 0x1d578e(%rip), %rcx    # 0x34da75
leaq 0x1d52a3(%rip), %r8     # 0x34d591
movl $0x400, %r9d            # imm = 0x400
xorl %eax, %eax
callq 0x17a50
callq 0x17390