// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/rdj-contigs-graph.c
// Function: gt_contigs_graph_find_path_end
void gt_contigs_graph_find_path_end(GtContigsGraphPathEndInfo *info,
    GtArrayGtContigsGraphPathElem *path, GtContigsGraph *cg,
    GtUword cnum, unsigned int incoming, bool use_only_internal)
{
  bool extended = false;
  gt_assert(cg->v_spm[incoming][cnum].deg == (uint64_t)1);
  info->cnum = cnum;
  info->dir = incoming;
  info->t = GT_CONTIGS_GRAPH_JUNCTION;
  info->depth = 0;
  gt_log_log("find_path_end(cnum="GT_WU", incoming=%u)", cnum, incoming);
  path->nextfreeGtContigsGraphPathElem = 0;
  do {
    GtContigsGraphSpmEdge *edge;
    GtContigsGraphPathElem *elem;
    GT_GETNEXTFREEINARRAY(elem, path, GtContigsGraphPathElem,
      GT_CONTIGS_GRAPH_PATHELEM_INC);
    if (incoming == 1U)
      elem->dest = info->cnum;
    edge = gt_contigs_graph_find_only_spm_edge(cg, info->cnum, info->dir);
    info->depth++;
    info->dest = info->cnum;
    info->cnum = (GtUword)edge->dest;
    elem->extended = extended;
    if (incoming == 0)
    {
      elem->dest = info->cnum;
      elem->dir = info->dir;
    }
    info->dir = GT_CONTIGS_GRAPH_VALID_PATH_DIR(info->dir, edge->reverse);
    if (incoming == 1U)
      elem->dir = GT_CONTIGS_GRAPH_OTHER_DIR(info->dir);
    if (info->cnum == cnum || cg->v_m[info->cnum].visited)
    {
      info->t = GT_CONTIGS_GRAPH_CIRCULAR;
      break;
    }
    if (cg->v_spm[GT_CONTIGS_GRAPH_OTHER_DIR(info->dir)][
        info->cnum].deg != (uint64_t)1)
    {
      extended = true;
      if (use_only_internal)
        break;
    }
    cg->v_m[info->cnum].visited = true;
  } while (cg->v_spm[info->dir][info->cnum].deg == (uint64_t)1);
  if (cg->v_spm[info->dir][info->cnum].deg == 0)
  {
    if (cg->v_spm[GT_CONTIGS_GRAPH_OTHER_DIR(info->dir)][
        info->cnum].deg == (uint64_t)1)
      info->t = GT_CONTIGS_GRAPH_SINGLE_END;
    else
    {
      gt_assert(cg->v_spm[GT_CONTIGS_GRAPH_OTHER_DIR(info->dir)][
          info->cnum].deg > (uint64_t)1);
      info->t = GT_CONTIGS_GRAPH_MULTIPLE_END;
    }
  }
  info->dir = GT_CONTIGS_GRAPH_OTHER_DIR(info->dir);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, 0xc(%rsp)
movl %r8d, %eax
movq 0x18(%rdx,%rax,8), %rax
cmpw $0x1, (%rax,%rcx,8)
jne 0x1c76ea
movl %r8d, %r15d
movq %rcx, %rbp
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %rbx
movq %rcx, (%rdi)
movl %r8d, 0x18(%rdi)
movl $0x0, 0x1c(%rdi)
xorl %r12d, %r12d
movq %r12, 0x10(%rdi)
leaq 0x1e607a(%rip), %rdi    # 0x3ad5e0
movq %rcx, %rsi
movl %r8d, %edx
xorl %eax, %eax
callq 0x103d72
movq %r12, 0x10(%r13)
movq %rbp, 0x10(%rsp)
movq 0x8(%r13), %rsi
cmpq %rsi, 0x10(%r13)
jae 0x1c758c
movq (%r13), %rbp
jmp 0x1c75b7
addq $0x100, %rsi            # imm = 0x100
movq %rsi, 0x8(%r13)
movq (%r13), %rdi
shlq $0x4, %rsi
leaq 0x1e5c9b(%rip), %rdx    # 0x3ad241
movl $0x35e, %ecx            # imm = 0x35E
callq 0x104461
movq %rax, %rbp
movq %rax, (%r13)
testq %rbp, %rbp
je 0x1c76e5
movq 0x10(%r13), %rax
leaq 0x1(%rax), %rcx
shlq $0x4, %rax
addq %rax, %rbp
movq %rcx, 0x10(%r13)
movq (%rbx), %rsi
cmpl $0x1, %r15d
jne 0x1c75e0
movq %rsi, (%rbp)
movl 0x18(%rbx), %edx
movq %r14, %rdi
callq 0x1c6ebb
incq 0x10(%rbx)
movl %r12d, %edx
andb $0x1, %dl
movq (%rbx), %rcx
movq %rcx, 0x8(%rbx)
movl (%rax), %ecx
movq %rcx, (%rbx)
movb %dl, 0xc(%rbp)
movl 0x18(%rbx), %edx
testl %r15d, %r15d
jne 0x1c7613
movq %rcx, (%rbp)
movl %edx, 0x8(%rbp)
testl %edx, %edx
setne %dl
btl $0x1d, 0x4(%rax)
setae %al
xorb %dl, %al
movzbl %al, %esi
xorb $0x1, %al
movzbl %al, %eax
movl %eax, 0x18(%rbx)
cmpl $0x1, %r15d
jne 0x1c7636
movl %esi, 0x8(%rbp)
movq 0x10(%rsp), %rbp
cmpq %rbp, %rcx
je 0x1c7696
movq 0x38(%r14), %rdx
movb (%rdx,%rcx), %dil
testb $0x10, %dil
jne 0x1c7696
movq 0x18(%r14,%rsi,8), %rsi
movzwl (%rsi,%rcx,8), %esi
cmpq $0x1, %rsi
setne %r8b
testb %r8b, 0xc(%rsp)
jne 0x1c769d
cmpl $0x1, %esi
movzbl %r12b, %r12d
movl $0x1, %eax
cmovnel %eax, %r12d
orb $0x10, %dil
movb %dil, (%rdx,%rcx)
movl 0x18(%rbx), %eax
movq 0x18(%r14,%rax,8), %rdx
movq (%rbx), %rcx
cmpw $0x1, (%rdx,%rcx,8)
je 0x1c757c
jmp 0x1c769d
movl $0x3, 0x1c(%rbx)
movl %eax, %edx
movq 0x18(%r14,%rdx,8), %rdx
cmpw $0x0, (%rdx,%rcx,8)
jne 0x1c76cc
xorl %edx, %edx
testl %eax, %eax
sete %dl
movq 0x18(%r14,%rdx,8), %rdx
movzwl (%rdx,%rcx,8), %ecx
cmpl $0x1, %ecx
je 0x1c76c9
testl %ecx, %ecx
je 0x1c76ef
movl $0x2, %ecx
movl %ecx, 0x1c(%rbx)
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
movl %ecx, 0x18(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x6a346
callq 0x6a2d4
callq 0x6a30d