// File: /workspace/github_c_makefile_star2_O3/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, 0x18(%rsp)
movq %rdi, %r14
leaq 0x1e5f6d(%rip), %rdi    # 0x3ad681
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x103d72
movb $0x1, %bpl
leaq 0x1ad05f(%rip), %r13    # 0x374787
leaq 0x1e5f6e(%rip), %r12    # 0x3ad69d
movq %r15, %rax
shlq $0x5, %rax
movl 0x1c(%rbx,%rax), %ecx
cmpl $0x1, %ecx
je 0x1c775e
movq %r13, %rsi
cmpl $0x3, %ecx
je 0x1c7765
cmpl $0x2, %ecx
leaq 0x1e5fa4(%rip), %rsi    # 0x3ad6f5
leaq 0x1e5f90(%rip), %rcx    # 0x3ad6e8
cmoveq %rcx, %rsi
jmp 0x1c7765
leaq 0x1e5f78(%rip), %rsi    # 0x3ad6dd
movq (%rbx,%rax), %rdx
movq 0x8(%rbx,%rax), %rcx
movq 0x10(%rbx,%rax), %r8
movl 0x18(%rbx,%rax), %r9d
movq %rsi, (%rsp)
movq %r12, %rdi
movl %r15d, %esi
xorl %eax, %eax
callq 0x103d72
movl $0x1, %r15d
testb $0x1, %bpl
movl $0x0, %ebp
jne 0x1c772f
cmpl $0x3, 0x1c(%rbx)
jne 0x1c77bd
cmpl $0x3, 0x3c(%rbx)
jne 0x1c7b23
movq 0x10(%rbx), %rcx
cmpq 0x30(%rbx), %rcx
jne 0x1c7b28
incq %rcx
jmp 0x1c77cb
movq 0x10(%rbx), %rax
movq 0x30(%rbx), %rcx
addq %rax, %rcx
incq %rcx
movq %rcx, 0x10(%rsp)
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1c6268
movq %rax, %r15
leaq 0x1e5f87(%rip), %rdi    # 0x3ad76d
movq %rax, %rsi
movq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x103d72
movq 0x20(%rbx), %r13
leaq 0x1e5f8f(%rip), %rdi    # 0x3ad78f
movq %r13, %rsi
xorl %eax, %eax
callq 0x103d72
movq 0x10(%rsp), %r9
testq %r9, %r9
je 0x1c7951
movabsq $-0x8000000000000000, %r10 # imm = 0x8000000000000000
movl 0x38(%rbx), %ecx
leaq -0x1(%r9), %rax
movq %rax, 0x30(%rsp)
xorl %ebp, %ebp
leaq -0x1(%r10), %r11
xorl %eax, %eax
xorl %edx, %edx
movq %r15, 0x28(%rsp)
movq %r11, 0x20(%rsp)
movq 0x40(%r14), %rsi
movq %r15, %rdi
subq 0x10(%r14), %rdi
movq (%rsi,%rdi,8), %rsi
shrq $0xc, %rsi
andq $-0x10, %rsi
addq 0x58(%r14), %rsi
movq %r13, %rdi
andq %r11, %rdi
movq (%rbp,%rsi), %r8
andq %r10, %r8
orq %rdi, %r8
movq %r8, (%rbp,%rsi)
testq %rdx, %rdx
je 0x1c7885
cmpq %rdx, 0x30(%rsp)
jne 0x1c7898
cmpl $0x0, 0x18(%rbx)
jmp 0x1c7889
cmpl $0x1, 0x38(%rbx)
movl $0x0, %r8d
cmoveq %r10, %r8
orq %rdi, %r8
jmp 0x1c78ab
cmpl $0x1, %ecx
movl $0x0, %r8d
cmoveq %r10, %r8
orq %r8, %rdi
movq %rdi, %r8
movq %r8, (%rsi,%rbp)
movq %rax, 0x8(%rsi,%rbp)
leaq 0x1(%rdx), %r12
cmpq %r9, %r12
jae 0x1c7941
movq 0x30(%rbx), %rax
cmpq %rax, %rdx
jae 0x1c78e3
notq %rdx
shlq $0x4, %rax
movq 0x18(%rsp), %rcx
addq 0x18(%rcx), %rax
shlq $0x4, %rdx
addq %rax, %rdx
jmp 0x1c78f5
movq 0x18(%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 0x1c6f1b
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 0x10(%rsp), %r9
movq 0x28(%rsp), %r15
movabsq $-0x8000000000000000, %r10 # imm = 0x8000000000000000
movq 0x20(%rsp), %r11
addq $0x10, %rbp
movq %r12, %rdx
cmpq %r12, %r9
jne 0x1c7842
movq (%rbx), %rdx
leaq 0x1e5e51(%rip), %rdi    # 0x3ad7ac
movq %r13, %rsi
xorl %eax, %eax
callq 0x103d72
cmpq (%rbx), %r13
jne 0x1c7b19
movq 0x20(%rbx), %r15
leaq 0x1e5e16(%rip), %rdi    # 0x3ad78f
movq %r15, %rsi
xorl %eax, %eax
callq 0x103d72
movq 0x10(%rsp), %rcx
testq %rcx, %rcx
je 0x1c7b1e
movl 0x3c(%rbx), %eax
cmpl $0x3, %eax
jne 0x1c79a2
decq %rcx
je 0x1c7b2d
decq %rcx
je 0x1c7a5e
xorl %ebp, %ebp
xorl %r12d, %r12d
movq %rcx, 0x10(%rsp)
movq %r15, %r13
movq 0x30(%rbx), %rcx
cmpq %rcx, %r12
jae 0x1c79dd
movq %r12, %rax
notq %rax
shlq $0x4, %rcx
movq 0x18(%rsp), %rdx
addq 0x18(%rdx), %rcx
shlq $0x4, %rax
addq %rcx, %rax
jmp 0x1c79ef
movq 0x18(%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 0x1c6f1b
movl (%rax), %r15d
leaq 0x1e5de7(%rip), %rdi    # 0x3ad7f1
movq %r13, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x103d72
movq 0x18(%r14), %rax
cmpw $0x1, (%rax,%r13,8)
jne 0x1c7a49
movq 0x20(%r14), %rax
cmpw $0x1, (%rax,%r13,8)
jne 0x1c7a49
leaq 0x1e5dd4(%rip), %rdi    # 0x3ad80a
movq %r13, %rsi
xorl %eax, %eax
callq 0x103d72
movq 0x38(%r14), %rax
orb $0x4, (%rax,%r13)
incq %r12
addq $0x10, %rbp
cmpq %r12, 0x10(%rsp)
jne 0x1c79b5
movl 0x3c(%rbx), %eax
cmpl $0x3, %eax
jne 0x1c7a83
movq 0x8(%rbx), %rdx
leaq 0x1e5db7(%rip), %rdi    # 0x3ad825
movq %r15, %rsi
xorl %eax, %eax
callq 0x103d72
cmpq 0x8(%rbx), %r15
je 0x1c7aa0
callq 0x6a463
movq (%rbx), %rdx
leaq 0x1e5d1f(%rip), %rdi    # 0x3ad7ac
movq %r15, %rsi
xorl %eax, %eax
callq 0x103d72
cmpq (%rbx), %r15
jne 0x1c7b32
cmpl $0x3, 0x3c(%rbx)
jne 0x1c7ac4
movq 0x20(%rbx), %rsi
leaq 0x1e5da8(%rip), %rdi    # 0x3ad859
xorl %eax, %eax
callq 0x103d72
movq 0x38(%r14), %rax
movq 0x20(%rbx), %rcx
orb $0x4, (%rax,%rcx)
cmpl $0x1, 0x1c(%rbx)
jne 0x1c7ae6
movq (%rbx), %rsi
leaq 0x1e5da2(%rip), %rdi    # 0x3ad876
xorl %eax, %eax
callq 0x103d72
movq 0x38(%r14), %rax
movq (%rbx), %rcx
orb $0x4, (%rax,%rcx)
cmpl $0x1, 0x3c(%rbx)
jne 0x1c7b0a
movq 0x20(%rbx), %rsi
leaq 0x1e5d7f(%rip), %rdi    # 0x3ad876
xorl %eax, %eax
callq 0x103d72
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 0x6a3f1
callq 0x6a4d5
callq 0x6a37f
callq 0x6a3b8
callq 0x6a49c
callq 0x6a42a