// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: trans_path_check(unsigned int, unsigned int, asg_t*, ma_hit_t_alloc*, R_to_U*, unsigned int, asg64_v*)
uint32_t trans_path_check(uint32_t a, uint32_t b, asg_t *g, ma_hit_t_alloc *rev, R_to_U* rI, 
uint32_t minLen, asg64_v *t)
{
    if(a == b) return -1;
    uint32_t tn = t->n, m, e, l[2] = {0};
    uint64_t *x[2];
    m = follow_limit_path(g, a, &e, &(l[0]), t, (uint32_t)-1);
    if(m == LOOP || l[0] <= minLen) {
        t->n = tn; return -1;
    }

    m = follow_limit_path(g, b, &e, &(l[1]), t, (uint32_t)-1);
    if(m == LOOP || l[1] <= minLen) {
        t->n = tn; return -1;
    }

    x[0] = t->a + tn; x[1] = t->a + tn + l[0];
    if(l[0] > l[1]) {
        x[0] = t->a + tn + l[0]; x[1] = t->a + tn;
        m = l[0]; l[0] = l[1]; l[1] = m;
    }
    assert(l[0]+l[1]+tn==t->n);

    uint32_t i, k, qi, ti, isU; double max_count = 0, min_count = 0;
    for (i = 0; i < l[1]; i++) g->seq_vis[x[1][i]>>1] = 1;
    for (i = 0; i < l[0]; i++) {
        qi = x[0][i]>>1;
        for (k = 0; k < rev[qi].length; k++) {
            ti = Get_tn(rev[qi].buffer[k]);
            if(g->seq[ti].del == 1) {
                get_R_to_U(rI, ti, &ti, &isU);
                if(ti == (uint32_t)-1 || isU == 1 || g->seq[ti].del == 1) continue;
            }
            min_count++; max_count += g->seq_vis[ti];
        }
    }

    for (i = 0; i < l[1]; i++) g->seq_vis[x[1][i]>>1] = 0;
    t->n = tn;

    if(min_count == 0) return -1;
    if(max_count == 0) return 0;
    if((max_count/min_count)>0.3) return 1;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %esi, %r14d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl %esi, %edi
je 0x1e8088
movl %r9d, %r13d
movq %r8, %r15
movq %rdx, %rbx
movl %edi, %esi
movq %rcx, 0x50(%rsp)
movq 0x90(%rsp), %r8
movq (%r8), %r12
movl %r12d, %eax
movq %rax, 0x10(%rsp)
movq %rsp, %rcx
movq $0x0, (%rcx)
leaq 0x2c(%rsp), %rdx
movq %rbx, %rdi
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
callq 0x1e51e1
cmpl $0x7, %eax
je 0x1e806e
cmpl %r13d, (%rsp)
jbe 0x1e806e
leaq 0x4(%rsp), %rcx
leaq 0x2c(%rsp), %rdx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %rbx, %rdi
movl %r14d, %esi
movq 0x90(%rsp), %r14
movq %r14, %r8
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
callq 0x1e51e1
cmpl $0x7, %eax
je 0x1e8080
movl 0x4(%rsp), %eax
cmpl %r13d, %eax
jbe 0x1e8080
movq 0x10(%rsp), %rcx
leaq (,%rcx,8), %rcx
addq 0x10(%r14), %rcx
movl (%rsp), %edx
leaq (%rcx,%rdx,8), %r8
cmpl %eax, %edx
jbe 0x1e8099
movl %eax, (%rsp)
movl %edx, 0x4(%rsp)
movq %rcx, %rsi
jmp 0x1e809f
movq 0x90(%rsp), %rax
movq 0x10(%rsp), %rcx
movq %rcx, (%rax)
jmp 0x1e8088
movq 0x10(%rsp), %rax
movq %rax, (%r14)
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r8, %rsi
movq %rcx, %r8
movl (%rsp), %eax
movl 0x4(%rsp), %edi
movq %rax, 0x30(%rsp)
addl %edi, %eax
addl %eax, %r12d
cmpq %r12, (%r14)
jne 0x1e8257
testq %rdi, %rdi
je 0x1e80d7
xorl %eax, %eax
movq 0x30(%rbx), %rcx
movq (%rsi,%rax,8), %rdx
shrq %rdx
movb $0x1, (%rcx,%rdx)
incq %rax
cmpq %rax, %rdi
jne 0x1e80c0
movq %rdi, 0x38(%rsp)
movq %rsi, 0x40(%rsp)
cmpq $0x0, 0x30(%rsp)
je 0x1e81dd
xorpd %xmm1, %xmm1
xorl %r14d, %r14d
xorpd %xmm2, %xmm2
movq %r8, 0x48(%rsp)
movq (%r8,%r14,8), %rax
shrq %rax
movl %eax, %eax
leaq (%rax,%rax,2), %rax
movq 0x50(%rsp), %rcx
cmpl $0x0, 0xc(%rcx,%rax,8)
je 0x1e81c8
leaq (%rcx,%rax,8), %r13
movl $0xc, %r12d
xorl %ebp, %ebp
movq (%r13), %rax
movl (%rax,%r12), %esi
movl %esi, 0xc(%rsp)
movq 0x20(%rbx), %rax
cmpl $0x0, (%rax,%rsi,8)
js 0x1e815d
addsd 0x3d12c(%rip), %xmm1    # 0x225270
movq 0x30(%rbx), %rax
movl 0xc(%rsp), %ecx
movzbl (%rax,%rcx), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
addsd %xmm0, %xmm2
jmp 0x1e81b4
movsd %xmm2, 0x18(%rsp)
movsd %xmm1, 0x20(%rsp)
movq %r15, %rdi
leaq 0xc(%rsp), %rdx
leaq 0x28(%rsp), %rcx
callq 0xa306f
movl 0xc(%rsp), %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rax
je 0x1e81a8
cmpl $0x1, 0x28(%rsp)
je 0x1e81a8
movq 0x20(%rbx), %rcx
cmpl $0x0, (%rcx,%rax,8)
movsd 0x20(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
jns 0x1e813c
jmp 0x1e81b4
movsd 0x20(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
incq %rbp
movl 0xc(%r13), %eax
addq $0x28, %r12
cmpq %rax, %rbp
jb 0x1e8126
incq %r14
cmpq 0x30(%rsp), %r14
movq 0x48(%rsp), %r8
jne 0x1e80fd
jmp 0x1e81e5
xorpd %xmm2, %xmm2
xorpd %xmm1, %xmm1
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
movq 0x40(%rsp), %rsi
je 0x1e820d
xorl %eax, %eax
movq 0x30(%rbx), %rcx
movq (%rsi,%rax,8), %rdx
shrq %rdx
movb $0x0, (%rcx,%rdx)
incq %rax
cmpq %rax, %rdi
jne 0x1e81f6
movq 0x90(%rsp), %rax
movq 0x10(%rsp), %rcx
movq %rcx, (%rax)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x1e8232
jnp 0x1e8088
xorl %ebp, %ebp
ucomisd %xmm0, %xmm2
jne 0x1e8240
jnp 0x1e8088
divsd %xmm1, %xmm2
xorl %ebp, %ebp
ucomisd 0x3c992(%rip), %xmm2    # 0x224be0
seta %bpl
jmp 0x1e8088
leaq 0x5134f(%rip), %rdi     # 0x2395ad
leaq 0x510c0(%rip), %rsi     # 0x239325
leaq 0x51354(%rip), %rcx     # 0x2395c0
movl $0x4e5, %edx            # imm = 0x4E5
callq 0x2110