// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/rdj-strgraph.c
// Function: gt_strgraph_find_connecting_path
int gt_strgraph_find_connecting_path(GtStrgraph *strgraph, GtUword from,
    GtStrgraphVtype from_vt, GtUword to, GtStrgraphVtype to_vt,
    GtUword minlen, GtUword maxlen, bool first_path_only,
    const char *indexname, const char *suffix,
    GtLogger *logger, GtError *err)
{
  int had_err = 0;

  if (from >= (GtUword)GT_STRGRAPH_NOFREADS(strgraph))
  {
    had_err = -1;
    gt_error_set(err, "Can't search path from read "GT_WU" "
        "because the readset has "FormatGtStrgraphVnum" reads", from,
        GT_STRGRAPH_NOFREADS(strgraph));
  }
  if (to >= (GtUword)GT_STRGRAPH_NOFREADS(strgraph))
  {
    had_err = -1;
    gt_error_set(err, "Can't search path from read "GT_WU" "
        "because the readset has "FormatGtStrgraphVnum" reads", to,
        GT_STRGRAPH_NOFREADS(strgraph));
  }
  if (!had_err)
  {
    GtStrgraphVnumAndDepth vd;
    GtStrgraphVEdgenum nofedges, nofedges_sum = 0;
    GtStrgraphVnum i;
    GtContigsWriter *cw;
    GtFile *outfp;
    GtStr *complete_suffix;
    bool unreachable = false;
    int found = -1;

    /* check if "to" is reachable */
    if (to_vt == GT_STRGRAPH_VTYPE_B || to_vt == GT_STRGRAPH_VTYPE_A)
    {
      nofedges = GT_STRGRAPH_V_NOFEDGES(strgraph, GT_STRGRAPH_V_B(to));
      nofedges_sum = nofedges;
      if (nofedges == 0)
      {
        gt_logger_log(logger, "Destination read has no edges from B vertex");
        if (to_vt == GT_STRGRAPH_VTYPE_B)
          unreachable = true;
      }
    }
    if (to_vt == GT_STRGRAPH_VTYPE_E || to_vt == GT_STRGRAPH_VTYPE_A)
    {
      nofedges = GT_STRGRAPH_V_NOFEDGES(strgraph, GT_STRGRAPH_V_E(to));
      nofedges_sum += nofedges;
      if (nofedges == 0)
      {
        gt_logger_log(logger, "Destination read has no edges from E vertex");
        if (to_vt == GT_STRGRAPH_VTYPE_E || nofedges_sum == 0)
          unreachable = true;
      }
    }
    if (unreachable)
    {
      gt_logger_log(logger, "Destination read unreachable");
      return 0;
    }

    gt_assert(strgraph->encseq != NULL);
    gt_assert(gt_encseq_is_mirrored(strgraph->encseq));
    complete_suffix = gt_str_new();
    gt_str_append_char(complete_suffix, '.');
    gt_str_append_uword(complete_suffix, from);
    gt_str_append_char(complete_suffix, '.');
    gt_str_append_uword(complete_suffix, to);
    gt_str_append_cstr(complete_suffix, suffix);
    outfp = gt_strgraph_get_file(indexname, gt_str_get(complete_suffix),
        true, false);
    gt_logger_log(logger, "Connecting paths output filename: %s%s", indexname,
        gt_str_get(complete_suffix));
    cw = gt_contigs_writer_new(strgraph->encseq, outfp);
    gt_contigs_writer_enable_complete_path_output(cw);

    /* reset vertex marks */
    for (i = 0; i < GT_STRGRAPH_NOFVERTICES(strgraph); i++)
      GT_STRGRAPH_V_SET_MARK(strgraph, i, GT_STRGRAPH_V_VACANT);

    vd.d = GT_STRGRAPH_SEQLEN(strgraph, from);

    /* disallow returning to origin read in any orientation
       (however, from == to should still work) */
    GT_STRGRAPH_V_SET_MARK(strgraph, GT_STRGRAPH_V_B(from),
        GT_STRGRAPH_V_MARKED);
    GT_STRGRAPH_V_SET_MARK(strgraph, GT_STRGRAPH_V_E(from),
        GT_STRGRAPH_V_MARKED);

    /* search path from B vertex */
    if (from_vt == GT_STRGRAPH_VTYPE_B || from_vt == GT_STRGRAPH_VTYPE_A)
    {
      vd.v = GT_STRGRAPH_V_B(from);
      nofedges = GT_STRGRAPH_V_NOFEDGES(strgraph, vd.v);
      if (nofedges == 0)
        gt_logger_log(logger, "Origin read has no edges from B vertex");
      else
      {
        gt_logger_log(logger, "Computing paths starting from B vertex...");
        found = gt_strgraph_find_connecting_path_from_vertex(strgraph, vd,
            nofedges, to, to_vt, minlen, maxlen, first_path_only, cw, logger);
      }
    }

    if ((from_vt == GT_STRGRAPH_VTYPE_E || from_vt == GT_STRGRAPH_VTYPE_A) &&
        ((found != 0) || !first_path_only))
    {
      /* search path from E vertex */
      vd.v = GT_STRGRAPH_V_E(from);
      nofedges = GT_STRGRAPH_V_NOFEDGES(strgraph, vd.v);
      if (nofedges == 0)
        gt_logger_log(logger, "Origin read has no edges from E vertex");
      else
      {
        gt_logger_log(logger, "Computing paths starting from E vertex...");
        gt_strgraph_find_connecting_path_from_vertex(strgraph, vd, nofedges,
            to, to_vt, minlen, maxlen, first_path_only, cw, logger);
      }
    }
    gt_str_delete(complete_suffix);
    gt_contigs_writer_delete(cw);
    gt_file_delete(outfp);
  }
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0xa8(%rsp), %rbp
movq 0x80(%rdi), %rcx
shrq %rcx
pushq $-0x1
popq %r13
cmpq %rsi, %rcx
jbe 0x183915
cmpq %rbx, %rcx
jbe 0x183938
movl %r8d, %r12d
movl %edx, 0xc(%rsp)
movq %r9, 0x40(%rsp)
testl %r8d, %r8d
sete %r13b
movb $0x1, %al
movl %eax, 0x10(%rsp)
leaq 0x1(,%rbx,2), %rsi
testl $0xfffffffd, %r8d       # imm = 0xFFFFFFFD
movq %r12, 0x18(%rsp)
movq %rsi, 0x20(%rsp)
jne 0x18395e
movq 0x60(%r15), %rdi
leaq (%rbx,%rbx), %rbp
callq 0x17ffcd
movq %rax, %r12
movq 0x60(%r15), %rdi
movq %rbp, %rsi
callq 0x17ffcd
cmpq %rax, %r12
jne 0x183963
leaq 0x1cc5ed(%rip), %rsi    # 0x34fef1
movq 0xa0(%rsp), %rdi
xorl %eax, %eax
callq 0x92e71
jmp 0x18396e
leaq 0x1cc593(%rip), %rsi    # 0x34feaf
movq %rbp, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x89dbb
movq 0x80(%r15), %rcx
shrq %rcx
cmpq %rbx, %rcx
ja 0x18394c
leaq 0x1cc570(%rip), %rsi    # 0x34feaf
movq %rbp, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x89dbb
movl %r13d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r13d, %r13d
jmp 0x183973
movl $0x0, 0x10(%rsp)
xorl %r13d, %r13d
movq 0x18(%rsp), %r12
leal -0x1(%r12), %eax
cmpl $0x1, %eax
ja 0x183ace
movq 0x60(%r15), %rdi
leaq 0x2(,%rbx,2), %rsi
callq 0x17ffcd
movq %r12, %rbp
movq %rax, %r12
movq 0x60(%r15), %rdi
movq 0x20(%rsp), %rsi
callq 0x17ffcd
cmpq %rax, %r12
jne 0x183ace
movq %rbp, %r12
cmpl $0x1, %r12d
sete %bpl
leaq 0x1cc55c(%rip), %rsi    # 0x34ff1d
movq 0xa0(%rsp), %rdi
xorl %eax, %eax
callq 0x92e71
movl 0x10(%rsp), %eax
orb %r13b, %al
orb %bpl, %al
jne 0x183ad7
movq (%r15), %rdi
testq %rdi, %rdi
je 0x183ccb
callq 0x81dea
testb %al, %al
je 0x183cf9
callq 0xacb84
movq %rax, %rbp
pushq $0x2e
popq %r13
movq %rax, %rdi
movl %r13d, %esi
callq 0xaced9
movq %rbp, %rdi
movq %r14, %rsi
callq 0xace26
movq %rbp, %rdi
movl %r13d, %esi
callq 0xaced9
movq %rbp, %rdi
movq %rbx, 0x38(%rsp)
movq %rbx, %rsi
callq 0xace26
movq %rbp, %rdi
movq 0x98(%rsp), %rsi
callq 0xacbfb
movq %rbp, %rdi
callq 0xad1fa
pushq $0x1
popq %rdx
xorl %r13d, %r13d
movq 0x90(%rsp), %rdi
movq %rax, %rsi
xorl %ecx, %ecx
callq 0x1805c9
movq %rax, %rbx
movq %rbp, 0x10(%rsp)
movq %rbp, %rdi
callq 0xad1fa
leaq 0x1cc532(%rip), %rsi    # 0x34ffaf
movq 0xa0(%rsp), %rdi
movq 0x90(%rsp), %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x92e71
movq (%r15), %rdi
movq %rbx, 0x20(%rsp)
movq %rbx, %rsi
callq 0x17872c
movq %rax, %rbp
movq %rax, %rdi
callq 0x178815
cmpq 0x80(%r15), %r13
jae 0x183af5
movq 0x58(%r15), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x180026
incq %r13
jmp 0x183ab2
testb %r13b, %r13b
je 0x1839e0
leaq 0x1cc46b(%rip), %rsi    # 0x34ff49
xorl %r13d, %r13d
movq 0xa0(%rsp), %rdi
xorl %eax, %eax
callq 0x92e71
jmp 0x18394c
movq 0x8(%r15), %rax
testq %rax, %rax
jne 0x183b09
movq (%r15), %rdi
movq %r14, %rsi
callq 0x75173
movq %rax, 0x30(%rsp)
movq 0x58(%r15), %rdi
leaq (%r14,%r14), %r13
pushq $0x3
popq %r12
movq %r13, %rsi
movq %r12, %rdx
callq 0x180026
movq 0x58(%r15), %rdi
leaq 0x1(,%r14,2), %r14
movq %r14, %rsi
movq %r12, %rdx
callq 0x180026
movb $0x1, %r12b
movzbl 0x88(%rsp), %ebx
movl 0xc(%rsp), %eax
testl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
jne 0x183c01
movq %rbx, 0x28(%rsp)
movq %rbp, %rbx
movq 0x60(%r15), %rdi
movq %r14, %rsi
callq 0x17ffcd
movq %rax, %rbp
movq 0x60(%r15), %rdi
movq %r13, %rsi
callq 0x17ffcd
subq %rax, %rbp
jne 0x183ba2
leaq 0x1cc451(%rip), %rsi    # 0x34ffd6
movq 0xa0(%rsp), %rdi
xorl %eax, %eax
callq 0x92e71
movl 0xc(%rsp), %eax
movq %rbx, %rbp
movq 0x28(%rsp), %rbx
jmp 0x183c01
leaq 0x1cc454(%rip), %rsi    # 0x34fffd
movq 0xa0(%rsp), %r12
movq %r12, %rdi
xorl %eax, %eax
callq 0x92e71
subq $0x8, %rsp
movq %r15, %rdi
movq %r13, %rsi
movq 0x38(%rsp), %rdx
movq %rbp, %rcx
movq 0x40(%rsp), %r8
movq 0x20(%rsp), %r9
pushq %r12
movq %rbx, %rbp
pushq %rbx
movq 0x40(%rsp), %rbx
pushq %rbx
pushq 0xa0(%rsp)
pushq 0x68(%rsp)
callq 0x183d31
addq $0x30, %rsp
testl %eax, %eax
setne %r12b
movl 0xc(%rsp), %eax
decl %eax
cmpl $0x1, %eax
ja 0x183ca7
movb 0x88(%rsp), %al
xorb $0x1, %al
orb %al, %r12b
je 0x183ca7
movq 0x60(%r15), %rdi
addq $0x2, %r13
movq %r13, %rsi
callq 0x17ffcd
movq %rax, %r13
movq 0x60(%r15), %rdi
movq %r14, %rsi
callq 0x17ffcd
subq %rax, %r13
jne 0x183c5a
leaq 0x1cc3de(%rip), %rsi    # 0x350027
movq 0xa0(%rsp), %rdi
xorl %eax, %eax
callq 0x92e71
jmp 0x183ca7
leaq 0x1cc3ed(%rip), %rsi    # 0x35004e
movq 0xa0(%rsp), %r12
movq %r12, %rdi
xorl %eax, %eax
callq 0x92e71
subq $0x8, %rsp
movq %r15, %rdi
movq %r14, %rsi
movq 0x38(%rsp), %rdx
movq %r13, %rcx
movq 0x40(%rsp), %r8
movq 0x20(%rsp), %r9
pushq %r12
pushq %rbp
pushq %rbx
pushq 0xa0(%rsp)
pushq 0x68(%rsp)
callq 0x183d31
addq $0x30, %rsp
movq 0x10(%rsp), %rdi
callq 0xae103
movq %rbp, %rdi
callq 0x1788c2
movq 0x20(%rsp), %rdi
callq 0x8da06
xorl %r13d, %r13d
jmp 0x18394c
movq 0x2b4296(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x161337(%rip), %rsi    # 0x2e5013
leaq 0x1cba60(%rip), %rdx    # 0x34f743
leaq 0x1cc27c(%rip), %rcx    # 0x34ff66
leaq 0x1cba84(%rip), %r8     # 0x34f775
movl $0x735, %r9d            # imm = 0x735
jmp 0x183d25
movq 0x2b4268(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x161309(%rip), %rsi    # 0x2e5013
leaq 0x1cc276(%rip), %rdx    # 0x34ff87
leaq 0x1cc24e(%rip), %rcx    # 0x34ff66
leaq 0x1cba56(%rip), %r8     # 0x34f775
movl $0x736, %r9d            # imm = 0x736
xorl %eax, %eax
callq 0x17a50
callq 0x17390