// File: /workspace/github_c_makefile_star2_O1/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, 0x14(%rsp)
movl %r8d, %eax
movq 0x18(%rdx,%rax,8), %rax
cmpw $0x1, (%rax,%rcx,8)
jne 0x1d0968
movl %r8d, %r15d
movq %rcx, %r12
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %rbx
movq %rcx, (%rdi)
movl %r8d, 0x18(%rdi)
movl $0x0, 0x1c(%rdi)
xorl %ebp, %ebp
movq %rbp, 0x10(%rdi)
leaq 0x1e6430(%rip), %rdi    # 0x3b6be0
movq %rcx, %rsi
movl %r8d, %edx
xorl %eax, %eax
callq 0x108e02
movq $0x0, 0x8(%rsp)
movq %rbp, 0x10(%r13)
movq %r12, %rbp
movq 0x8(%r13), %rsi
cmpq %rsi, 0x10(%r13)
jb 0x1d07ff
addq $0x100, %rsi            # imm = 0x100
movq %rsi, 0x8(%r13)
movq (%r13), %rdi
shlq $0x4, %rsi
leaq 0x1e6050(%rip), %rdx    # 0x3b6841
movl $0x35e, %ecx            # imm = 0x35E
callq 0x1094e6
movq %rax, (%r13)
movq (%r13), %r12
testq %r12, %r12
je 0x1d0963
movq 0x10(%r13), %rax
leaq 0x1(%rax), %rcx
shlq $0x4, %rax
addq %rax, %r12
movq %rcx, 0x10(%r13)
cmpl $0x1, %r15d
jne 0x1d082c
movq (%rbx), %rax
movq %rax, (%r12)
movq (%rbx), %rsi
movl 0x18(%rbx), %edx
movq %r14, %rdi
callq 0x1d0158
incq 0x10(%rbx)
movq 0x8(%rsp), %rcx
movl %ecx, %edx
andb $0x1, %dl
movq (%rbx), %rcx
movq %rcx, 0x8(%rbx)
movl (%rax), %ecx
movq %rcx, (%rbx)
movb %dl, 0xc(%r12)
testl %r15d, %r15d
jne 0x1d086a
movq %rcx, (%r12)
movl 0x18(%rbx), %edx
movl %edx, 0x8(%r12)
cmpl $0x0, 0x18(%rbx)
setne %dl
btl $0x1d, 0x4(%rax)
setae %al
xorb %dl, %al
movl %eax, %edx
xorb $0x1, %dl
movzbl %dl, %edx
movl %edx, 0x18(%rbx)
cmpl $0x1, %r15d
jne 0x1d0894
movzbl %al, %edx
movl %edx, 0x8(%r12)
movq %rbp, %r12
cmpq %rbp, %rcx
je 0x1d08ce
movq 0x38(%r14), %rdx
movb (%rdx,%rcx), %sil
testb $0x10, %sil
jne 0x1d08ce
movzbl %al, %eax
movq 0x18(%r14,%rax,8), %rax
movzwl (%rax,%rcx,8), %eax
cmpq $0x1, %rax
setne %dil
testb %dil, 0x14(%rsp)
je 0x1d08f3
movb $0x1, %al
movq %rax, 0x8(%rsp)
jmp 0x1d08d5
movl $0x3, 0x1c(%rbx)
xorl %eax, %eax
testb %al, %al
je 0x1d0917
movl 0x18(%rbx), %eax
movq 0x18(%r14,%rax,8), %rax
movq (%rbx), %rcx
cmpw $0x1, (%rax,%rcx,8)
je 0x1d07ca
jmp 0x1d0917
cmpl $0x1, %eax
movq 0x8(%rsp), %rax
movzbl %al, %eax
movl $0x1, %edi
cmovnel %edi, %eax
movq %rax, 0x8(%rsp)
orb $0x10, %sil
movb %sil, (%rdx,%rcx)
movb $0x1, %al
jmp 0x1d08d7
movl 0x18(%rbx), %eax
movq 0x18(%r14,%rax,8), %rdx
movq (%rbx), %rcx
cmpw $0x0, (%rdx,%rcx,8)
jne 0x1d094a
xorl %edx, %edx
testl %eax, %eax
sete %dl
movq 0x18(%r14,%rdx,8), %rdx
movzwl (%rdx,%rcx,8), %ecx
cmpl $0x1, %ecx
je 0x1d0947
testl %ecx, %ecx
je 0x1d096d
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 0x6bc20
callq 0x6bbae
callq 0x6bbe7