// File: /workspace/github_c_makefile_star2_O1/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 %r9, 0x30(%rsp)
movl %r8d, %r14d
movq %rcx, %r13
movl %edx, 0xc(%rsp)
movq %rsi, %rbp
movq %rdi, %r12
movq 0xa8(%rsp), %rbx
movq 0x80(%rdi), %rcx
shrq %rcx
xorl %r15d, %r15d
cmpq %rsi, %rcx
ja 0x1ddefb
leaq 0x1db17f(%rip), %rsi    # 0x3b9067
movq %rbx, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movq 0x80(%r12), %rcx
shrq %rcx
cmpq %r13, %rcx
ja 0x1ddf25
leaq 0x1db155(%rip), %rsi    # 0x3b9067
movq %rbx, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testl %r15d, %r15d
jne 0x1de4cc
leaq 0x1(,%r13,2), %rbx
testl $0xfffffffd, %r14d      # imm = 0xFFFFFFFD
movq %r14, 0x10(%rsp)
movq %r13, 0x18(%rsp)
jne 0x1ddff7
movl %r15d, 0x8(%rsp)
movq 0x60(%r12), %rax
testq %rax, %rax
je 0x1de4e3
cmpq %rbx, 0x8(%rax)
jbe 0x1de4e3
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1de4e3
movq %r13, %r15
movq (%rax), %rdi
movq %rdx, %rsi
imulq %rbx, %rsi
callq 0x2fcc2c
movq %rax, %r14
movq 0x60(%r12), %rax
testq %rax, %rax
je 0x1de4e8
leaq (%r15,%r15), %rsi
cmpq %rsi, 0x8(%rax)
jbe 0x1de4e8
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1de4e8
movq (%rax), %rdi
imulq %rdx, %rsi
callq 0x2fcc2c
xorl %ecx, %ecx
movl $0x0, %r13d
cmpq %rax, %r14
movq 0x10(%rsp), %r14
movl 0x8(%rsp), %r15d
jne 0x1ddffc
testl %r14d, %r14d
sete %r13b
leaq 0x1db0c3(%rip), %rsi    # 0x3b90a9
movq 0xa0(%rsp), %rdi
xorl %eax, %eax
callq 0x10906e
jmp 0x1ddffa
xorl %r13d, %r13d
movb $0x1, %cl
leal -0x1(%r14), %eax
cmpl $0x1, %eax
ja 0x1de0bd
movl %ecx, 0x8(%rsp)
movq 0x60(%r12), %rax
testq %rax, %rax
je 0x1de4ed
movq 0x18(%rsp), %rcx
leaq 0x2(,%rcx,2), %rsi
cmpq %rsi, 0x8(%rax)
jbe 0x1de4ed
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1de4ed
movq (%rax), %rdi
imulq %rdx, %rsi
callq 0x2fcc2c
movq %rax, %r14
movq 0x60(%r12), %rax
testq %rax, %rax
je 0x1de4f2
cmpq %rbx, 0x8(%rax)
jbe 0x1de4f2
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1de4f2
movq (%rax), %rdi
imulq %rdx, %rbx
movq %rbx, %rsi
callq 0x2fcc2c
cmpq %rax, %r14
jne 0x1de0bd
leaq 0x1db047(%rip), %rsi    # 0x3b90d5
movq 0xa0(%rsp), %rdi
xorl %eax, %eax
callq 0x10906e
movzbl %r13b, %eax
cmpb $0x0, 0x8(%rsp)
movl $0x1, %r13d
cmovel %eax, %r13d
movq 0x10(%rsp), %r14
cmpl $0x1, %r14d
cmovel %r14d, %r13d
testb $0x1, %r13b
je 0x1de0de
leaq 0x1db037(%rip), %rsi    # 0x3b9101
movq 0xa0(%rsp), %rdi
xorl %eax, %eax
callq 0x10906e
jmp 0x1de4c4
movq (%r12), %rdi
testq %rdi, %rdi
je 0x1de515
movl %r13d, 0x8(%rsp)
callq 0xfac80
testb %al, %al
je 0x1de51a
movq 0x90(%rsp), %rbx
callq 0x1208f8
movq %rax, %r14
movq %rax, %rdi
movl $0x2e, %esi
callq 0x120ba5
movq %r14, %rdi
movq %rbp, %rsi
callq 0x120af4
movq %r14, %rdi
movl $0x2e, %esi
callq 0x120ba5
movq %r14, %rdi
movq 0x18(%rsp), %rsi
callq 0x120af4
movq %r14, %rdi
movq 0x98(%rsp), %rsi
callq 0x12097f
movq %r14, %rdi
callq 0x120d23
movq %rbx, %rdi
movq %rax, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x1d8925
movq %rax, %r13
movq %r14, 0x40(%rsp)
movq %r14, %rdi
callq 0x120d23
leaq 0x1dafe7(%rip), %rsi    # 0x3b9167
movq 0xa0(%rsp), %rdi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x10906e
movq (%r12), %rdi
movq %r13, 0x38(%rsp)
movq %r13, %rsi
callq 0x1d1210
movq %rax, %r13
movq %rax, %rdi
callq 0x1d12c8
cmpq $0x0, 0x80(%r12)
je 0x1de201
xorl %ebx, %ebx
movq 0x58(%r12), %rax
testq %rax, %rax
je 0x1de4de
cmpq %rbx, 0x8(%rax)
jbe 0x1de4de
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1de4de
movq (%rax), %rdi
movq %rdx, %rsi
imulq %rbx, %rsi
xorl %ecx, %ecx
callq 0x2fcd13
incq %rbx
cmpq 0x80(%r12), %rbx
jb 0x1de1be
movq 0x8(%r12), %rax
testq %rax, %rax
jne 0x1de217
movq (%r12), %rdi
movq %rbp, %rsi
callq 0xeffd3
movq 0x58(%r12), %rcx
testq %rcx, %rcx
je 0x1de4f7
addq %rbp, %rbp
cmpq %rbp, 0x8(%rcx)
jbe 0x1de4f7
movl 0x10(%rcx), %edx
cmpq $0x41, %rdx
jae 0x1de4f7
movq %rax, 0x28(%rsp)
movq (%rcx), %rdi
movq %rdx, %rsi
imulq %rbp, %rsi
movl $0x3, %ecx
callq 0x2fcd13
movq 0x58(%r12), %rax
testq %rax, %rax
je 0x1de4fc
movq %rbp, %rbx
orq $0x1, %rbx
cmpq %rbx, 0x8(%rax)
jbe 0x1de4fc
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1de4fc
movq (%rax), %rdi
movq %rdx, %rsi
imulq %rbx, %rsi
movl $0x3, %ecx
callq 0x2fcd13
movb $0x1, %r14b
movl 0xc(%rsp), %eax
testl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
jne 0x1de3a5
movq %r13, 0x20(%rsp)
movq 0x60(%r12), %rax
testq %rax, %rax
je 0x1de50b
cmpq %rbx, 0x8(%rax)
jbe 0x1de50b
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1de50b
movq (%rax), %rdi
movq %rdx, %rsi
imulq %rbx, %rsi
callq 0x2fcc2c
movq %rax, %r13
movq 0x60(%r12), %rax
testq %rax, %rax
je 0x1de510
cmpq %rbp, 0x8(%rax)
jbe 0x1de510
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1de510
movq (%rax), %rdi
movq %rdx, %rsi
imulq %rbp, %rsi
callq 0x2fcc2c
subq %rax, %r13
jne 0x1de340
leaq 0x1dae68(%rip), %rsi    # 0x3b918e
movq 0xa0(%rsp), %rdi
xorl %eax, %eax
callq 0x10906e
movl 0xc(%rsp), %eax
movq 0x20(%rsp), %r13
jmp 0x1de3a5
leaq 0x1dae6e(%rip), %rsi    # 0x3b91b5
movq 0xa0(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x10906e
subq $0x8, %rsp
movzbl 0x90(%rsp), %eax
movq %r12, %rdi
movq %rbp, %rsi
movq 0x30(%rsp), %rdx
movq %r13, %rcx
movq 0x20(%rsp), %r8
movq 0x18(%rsp), %r9
pushq %r14
movq 0x30(%rsp), %r13
pushq %r13
pushq %rax
pushq 0xa0(%rsp)
pushq 0x58(%rsp)
callq 0x1de51f
addq $0x30, %rsp
testl %eax, %eax
setne %r14b
movl 0xc(%rsp), %eax
decl %eax
cmpl $0x1, %eax
ja 0x1de4a3
movb 0x88(%rsp), %al
xorb $0x1, %al
orb %al, %r14b
je 0x1de4a3
movq 0x60(%r12), %rax
testq %rax, %rax
je 0x1de501
addq $0x2, %rbp
cmpq %rbp, 0x8(%rax)
jbe 0x1de501
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1de501
movq (%rax), %rdi
imulq %rdx, %rbp
movq %rbp, %rsi
callq 0x2fcc2c
movq %rax, %r14
movq 0x60(%r12), %rax
testq %rax, %rax
je 0x1de506
cmpq %rbx, 0x8(%rax)
jbe 0x1de506
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1de506
movq (%rax), %rdi
movq %rdx, %rsi
imulq %rbx, %rsi
callq 0x2fcc2c
subq %rax, %r14
jne 0x1de44e
leaq 0x1dada2(%rip), %rsi    # 0x3b91df
movq 0xa0(%rsp), %rdi
xorl %eax, %eax
callq 0x10906e
jmp 0x1de4a3
leaq 0x1dadb1(%rip), %rsi    # 0x3b9206
movq 0xa0(%rsp), %rbp
movq %rbp, %rdi
xorl %eax, %eax
callq 0x10906e
subq $0x8, %rsp
movzbl 0x90(%rsp), %eax
movq %r12, %rdi
movq %rbx, %rsi
movq 0x30(%rsp), %rdx
movq %r14, %rcx
movq 0x20(%rsp), %r8
movq 0x18(%rsp), %r9
pushq %rbp
pushq %r13
pushq %rax
pushq 0xa0(%rsp)
pushq 0x58(%rsp)
callq 0x1de51f
addq $0x30, %rsp
movq 0x40(%rsp), %rdi
callq 0x121b03
movq %r13, %rdi
callq 0x1d1375
movq 0x38(%rsp), %rdi
callq 0x1040fc
movl 0x8(%rsp), %r13d
xorl %eax, %eax
testb $0x1, %r13b
jne 0x1de4cf
movl %r15d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x71ab2
callq 0x71a40
callq 0x71a07
callq 0x71cb3
callq 0x71c7a
callq 0x71c08
callq 0x71bcf
callq 0x71b24
callq 0x71aeb
callq 0x71b96
callq 0x71b5d
callq 0x71c41
callq 0x71a79