// File: /workspace/github_c_makefile_star2_O3/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 $0x38, %rsp
movq %rcx, %rbx
movq %rsi, %rbp
movq %rdi, %r15
movq 0x98(%rsp), %r14
movq 0x80(%rdi), %rcx
shrq %rcx
cmpq %rsi, %rcx
jbe 0x1d482f
cmpq %rbx, %rcx
jbe 0x1d4857
movl %edx, 0x4(%rsp)
movq %r9, 0x28(%rsp)
testl %r8d, %r8d
sete %r12b
movb $0x1, %al
movl %eax, 0x8(%rsp)
leaq 0x1(,%rbx,2), %r14
testl $0xfffffffd, %r8d       # imm = 0xFFFFFFFD
movq %r8, 0x18(%rsp)
jne 0x1d4881
movq 0x60(%r15), %rax
testq %rax, %rax
je 0x1d4d4b
cmpq %r14, 0x8(%rax)
jbe 0x1d4d4b
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1d4d4b
movq (%rax), %rdi
movq %rdx, %rsi
imulq %r14, %rsi
callq 0x2f37dc
movq %rax, %r13
movq 0x60(%r15), %rax
testq %rax, %rax
je 0x1d4d50
leaq (%rbx,%rbx), %rsi
cmpq %rsi, 0x8(%rax)
jbe 0x1d4d50
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1d4d50
movq (%rax), %rdi
imulq %rdx, %rsi
callq 0x2f37dc
cmpq %rax, %r13
jne 0x1d4886
leaq 0x1db28b(%rip), %rsi    # 0x3afaa9
movq 0x90(%rsp), %rdi
xorl %eax, %eax
callq 0x103fe1
jmp 0x1d4891
leaq 0x1db231(%rip), %rsi    # 0x3afa67
movq %r14, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xfcb67
movq 0x80(%r15), %rcx
shrq %rcx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpq %rbx, %rcx
ja 0x1d4870
leaq 0x1db209(%rip), %rsi    # 0x3afa67
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r12d, %r12d
jmp 0x1d4896
movl $0x0, 0x8(%rsp)
xorl %r12d, %r12d
movq 0x18(%rsp), %r8
leal -0x1(%r8), %eax
cmpl $0x1, %eax
ja 0x1d4b94
movq 0x60(%r15), %rax
testq %rax, %rax
je 0x1d4d55
leaq 0x2(,%rbx,2), %rsi
cmpq %rsi, 0x8(%rax)
jbe 0x1d4d55
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1d4d55
movq (%rax), %rdi
imulq %rdx, %rsi
callq 0x2f37dc
movq %rax, %r13
movq 0x60(%r15), %rax
testq %rax, %rax
je 0x1d4d5a
cmpq %r14, 0x8(%rax)
jbe 0x1d4d5a
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1d4d5a
movq (%rax), %rdi
imulq %rdx, %r14
movq %r14, %rsi
callq 0x2f37dc
cmpq %rax, %r13
jne 0x1d4b94
cmpl $0x1, 0x18(%rsp)
sete %r14b
leaq 0x1db1ab(%rip), %rsi    # 0x3afad5
movq 0x90(%rsp), %rdi
xorl %eax, %eax
callq 0x103fe1
movl 0x8(%rsp), %eax
orb %r12b, %al
orb %r14b, %al
jne 0x1d4b9d
movq (%r15), %rdi
testq %rdi, %rdi
je 0x1d4d7d
callq 0xf6567
testb %al, %al
je 0x1d4d82
movq 0x88(%rsp), %r13
movq 0x80(%rsp), %r14
callq 0x11ac6c
movq %rax, %r12
movq %rax, %rdi
movl $0x2e, %esi
callq 0x11af23
movq %r12, %rdi
movq %rbp, %rsi
callq 0x11ae72
movq %r12, %rdi
movl $0x2e, %esi
callq 0x11af23
movq %r12, %rdi
movq %rbx, %rsi
callq 0x11ae72
movq %r12, %rdi
movq %r13, %rsi
callq 0x11acf3
movq %r12, %rdi
callq 0x11b0a1
movq %r14, %rdi
movq %rax, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x1cf1bf
movq %rax, %r13
movq %r12, %rdi
callq 0x11b0a1
leaq 0x1db186(%rip), %rsi    # 0x3afb67
movq 0x90(%rsp), %rdi
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x103fe1
movq (%r15), %rdi
movq %r13, %rsi
callq 0x1c7fb4
movq %rax, 0x8(%rsp)
movq %rax, %rdi
callq 0x1c806c
cmpq $0x0, 0x80(%r15)
je 0x1d4a5c
xorl %r14d, %r14d
movq 0x58(%r15), %rax
testq %rax, %rax
je 0x1d4d46
cmpq %r14, 0x8(%rax)
jbe 0x1d4d46
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1d4d46
movq (%rax), %rdi
movq %rdx, %rsi
imulq %r14, %rsi
xorl %ecx, %ecx
callq 0x2f388c
incq %r14
cmpq 0x80(%r15), %r14
jb 0x1d4a1b
movq 0x8(%r15), %rax
testq %rax, %rax
jne 0x1d4a70
movq (%r15), %rdi
movq %rbp, %rsi
callq 0xeb9d2
movq %rax, 0x20(%rsp)
movq 0x58(%r15), %rax
testq %rax, %rax
je 0x1d4d5f
addq %rbp, %rbp
cmpq %rbp, 0x8(%rax)
jbe 0x1d4d5f
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1d4d5f
movq %r12, 0x30(%rsp)
movq (%rax), %rdi
movq %rdx, %rsi
imulq %rbp, %rsi
movl $0x3, %ecx
callq 0x2f388c
movq 0x58(%r15), %rax
testq %rax, %rax
je 0x1d4d64
movq %rbp, %r14
orq $0x1, %r14
cmpq %r14, 0x8(%rax)
jbe 0x1d4d64
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1d4d64
movq (%rax), %rdi
movq %rdx, %rsi
imulq %r14, %rsi
movl $0x3, %ecx
callq 0x2f388c
movb $0x1, %r12b
movl 0x4(%rsp), %eax
testl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
jne 0x1d4c1f
movq %r13, 0x10(%rsp)
movq 0x60(%r15), %rax
testq %rax, %rax
je 0x1d4d73
cmpq %r14, 0x8(%rax)
jbe 0x1d4d73
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1d4d73
movq (%rax), %rdi
movq %rdx, %rsi
imulq %r14, %rsi
callq 0x2f37dc
movq %rax, %r13
movq 0x60(%r15), %rax
testq %rax, %rax
je 0x1d4d78
cmpq %rbp, 0x8(%rax)
jbe 0x1d4d78
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1d4d78
movq (%rax), %rdi
movq %rdx, %rsi
imulq %rbp, %rsi
callq 0x2f37dc
subq %rax, %r13
jne 0x1d4bba
leaq 0x1db00e(%rip), %rsi    # 0x3afb8e
movq 0x90(%rsp), %rdi
xorl %eax, %eax
callq 0x103fe1
jmp 0x1d4c16
testb %r12b, %r12b
je 0x1d4949
leaq 0x1daf5d(%rip), %rsi    # 0x3afb01
xorl %ebp, %ebp
movq 0x90(%rsp), %rdi
xorl %eax, %eax
callq 0x103fe1
jmp 0x1d4870
leaq 0x1daff4(%rip), %rsi    # 0x3afbb5
movq 0x90(%rsp), %r12
movq %r12, %rdi
xorl %eax, %eax
callq 0x103fe1
subq $0x8, %rsp
movzbl 0x80(%rsp), %eax
movq %r15, %rdi
movq %rbp, %rsi
movq 0x28(%rsp), %rdx
movq %r13, %rcx
movq %rbx, %r8
movq 0x20(%rsp), %r9
pushq %r12
pushq 0x18(%rsp)
pushq %rax
pushq 0x90(%rsp)
pushq 0x50(%rsp)
callq 0x1d4d87
addq $0x30, %rsp
testl %eax, %eax
setne %r12b
movl 0x4(%rsp), %eax
movq 0x10(%rsp), %r13
decl %eax
cmpl $0x1, %eax
ja 0x1d4d23
movb 0x78(%rsp), %al
xorb $0x1, %al
orb %al, %r12b
je 0x1d4d23
movq %r13, 0x10(%rsp)
movq 0x60(%r15), %rax
testq %rax, %rax
je 0x1d4d69
addq $0x2, %rbp
cmpq %rbp, 0x8(%rax)
jbe 0x1d4d69
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1d4d69
movq (%rax), %rdi
imulq %rdx, %rbp
movq %rbp, %rsi
callq 0x2f37dc
movq %rax, %r13
movq 0x60(%r15), %rax
testq %rax, %rax
je 0x1d4d6e
cmpq %r14, 0x8(%rax)
jbe 0x1d4d6e
movl 0x10(%rax), %edx
cmpq $0x41, %rdx
jae 0x1d4d6e
movq (%rax), %rdi
movq %rdx, %rsi
imulq %r14, %rsi
callq 0x2f37dc
subq %rax, %r13
jne 0x1d4cc8
leaq 0x1daf28(%rip), %rsi    # 0x3afbdf
movq 0x90(%rsp), %rdi
xorl %eax, %eax
callq 0x103fe1
jmp 0x1d4d1e
leaq 0x1daf37(%rip), %rsi    # 0x3afc06
movq 0x90(%rsp), %r12
movq %r12, %rdi
xorl %eax, %eax
callq 0x103fe1
subq $0x8, %rsp
movzbl 0x80(%rsp), %eax
movq %r15, %rdi
movq %r14, %rsi
movq 0x28(%rsp), %rdx
movq %r13, %rcx
movq %rbx, %r8
movq 0x20(%rsp), %r9
pushq %r12
pushq 0x18(%rsp)
pushq %rax
pushq 0x90(%rsp)
pushq 0x50(%rsp)
callq 0x1d4d87
addq $0x30, %rsp
movq 0x10(%rsp), %r13
movq 0x30(%rsp), %rdi
callq 0x11bdbf
movq 0x8(%rsp), %rdi
callq 0x1c8119
movq %r13, %rdi
callq 0xff22c
xorl %ebp, %ebp
jmp 0x1d4870
callq 0x6feab
callq 0x6fe39
callq 0x6fe00
callq 0x700ac
callq 0x70073
callq 0x70001
callq 0x6ffc8
callq 0x6ff1d
callq 0x6fee4
callq 0x6ff8f
callq 0x6ff56
callq 0x7003a
callq 0x6fe72