// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/tovlp.cpp
// Function: is_pop_unitig(unsigned int, asg_t*, ma_ug_t*, kvec_t_u32_warp*, kvec_t_u32_warp*, unsigned char*, pdq*, pdq*, unsigned char, unsigned char, long long*)
int is_pop_unitig(uint32_t v, asg_t *g, ma_ug_t *ug, kvec_t_u32_warp *tt, kvec_t_u32_warp *stack, uint8_t *vis,
pdq *pq_p, pdq *pq_a, uint8_t fp, uint8_t fa, long long *d)
{
    asg_arc_t *as = NULL;
    uint32_t s, sv, return_flag, convex, ns, i, k, nc, p_n, found, *a_a = NULL, a_n;
    long long ll, tmp, max_stop_nodeLen, max_stop_baseLen;
    if(g->seq[v>>1].del || g->seq[v>>1].c == ALTER_LABLE) return 0;
    if(asg_arc_n(g, v) == 0 || get_real_length(g, v, NULL) != 1) return 0;
    get_real_length(g, v, &s);
    if(get_real_length(g, s^1, NULL) < 2) return 0;
    return_flag = get_unitig(g, ug, v^1, &convex, &ll, &tmp, &max_stop_nodeLen,&max_stop_baseLen, 1, NULL);
    if(return_flag == LOOP) return 0;

    as = asg_arc_a(g, convex); ns = asg_arc_n(g, convex);
    for (i = nc = 0; i < ns; i++)
    {
        if(as[i].del) continue;
        if(get_real_length(g, as[i].v^1, NULL) < 2) break;
        nc++;
    }
    if(nc == 0 || i < ns) return 0;

    tt->a.n = 0; s^=1; sv = v^1;
    dfs_set(g, sv, s>>1, stack, tt, vis, fp);
    p_n = tt->a.n;
    as = asg_arc_a(g, s); ns = asg_arc_n(g, s); found = 0;
    for (i = 0; i < ns; i++)
    {
        if(as[i].del || as[i].v == sv) continue;
        nc = dfs_set(g, as[i].v, s>>1, stack, tt, vis, fa);///nc > 0 means as[i].v and sv have common suffix
        if(nc && check_trans_relation_by_path(sv, as[i].v, pq_p, NULL, NULL, pq_a, NULL, NULL, g, 
        vis, fp+fa, nc, 0.45, d))
        {
            found = 1;
        }
        a_a = tt->a.a + p_n; a_n = tt->a.n - p_n;
        for (k = 0; k < a_n; k++)
        {
            if(vis[a_a[k]]&fa) vis[a_a[k]] -= fa;
        }
        tt->a.n = p_n;
        if(found) break;
    }
    a_a = tt->a.a; a_n = p_n;
    for (k = 0; k < a_n; k++) vis[a_a[k]] = 0;
    return found;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %r15
movq 0x20(%rsi), %rax
movl %edi, %edx
shrl %edx
xorl %r13d, %r13d
cmpl $0x0, (%rax,%rdx,8)
js 0x152435
cmpb $0x1, 0x4(%rax,%rdx,8)
je 0x152435
movq %rsi, %r12
movq %r8, 0x58(%rsp)
movq %rcx, 0x80(%rsp)
movq 0x28(%rsi), %rax
movl %edi, %ecx
cmpl $0x0, (%rax,%rcx,8)
je 0x152435
movq %r9, %rbx
movl %edi, %ebp
xorl %r13d, %r13d
movq %r12, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0xc2e7a
cmpl $0x1, %eax
jne 0x152435
leaq 0x38(%rsp), %r13
movq %r12, %rdi
movl %ebp, %esi
movq %r13, %rdx
callq 0xc2e7a
movl (%r13), %esi
xorl $0x1, %esi
xorl %r13d, %r13d
movq %r12, %rdi
xorl %edx, %edx
callq 0xc2e7a
cmpl $0x2, %eax
jl 0x152435
xorl $0x1, %ebp
leaq 0x88(%rsp), %rax
movq %rax, 0x8(%rsp)
andq $0x0, 0x18(%rsp)
leaq 0x90(%rsp), %rax
movq %rax, (%rsp)
movl $0x1, 0x10(%rsp)
leaq 0x54(%rsp), %rcx
leaq 0xa0(%rsp), %r8
leaq 0x98(%rsp), %r9
movq %r12, %rdi
movq %r15, %rsi
movl %ebp, 0x3c(%rsp)
movl %ebp, %edx
callq 0xc2ebf
cmpl $0x7, %eax
jne 0x15244a
movl %r13d, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r12), %rax
movq 0x28(%r12), %rcx
movl 0x54(%rsp), %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %edx
shrq $0x20, %rcx
imulq $0x18, %rdx, %rdx
movq %rdx, 0x40(%rsp)
imulq $0x18, %rcx, %rcx
leaq (%rcx,%rax), %r14
addq $0xc, %r14
xorl %r15d, %r15d
xorl %ebp, %ebp
cmpq %r15, 0x40(%rsp)
je 0x1524ac
cmpl $0x0, (%r14,%r15)
js 0x1524a6
movl -0x4(%r14,%r15), %esi
xorl $0x1, %esi
xorl %r13d, %r13d
movq %r12, %rdi
xorl %edx, %edx
callq 0xc2e7a
cmpl $0x2, %eax
jl 0x152435
incl %ebp
addq $0x18, %r15
jmp 0x15247c
testl %ebp, %ebp
je 0x152656
movq 0x80(%rsp), %r14
andq $0x0, (%r14)
movl 0x38(%rsp), %edx
movl %edx, %eax
xorl $0x1, %eax
movl %eax, 0x38(%rsp)
shrl %edx
movzbl 0xf0(%rsp), %ebp
movl %ebp, (%rsp)
movq %r12, %rdi
movl 0x3c(%rsp), %esi
movq 0x58(%rsp), %rcx
movq %r14, %r8
movq %rbx, %r9
callq 0x151cff
movq (%r14), %rdx
movq 0x28(%r12), %rax
movl 0x38(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, %ecx
shrq $0x20, %rax
imulq $0x18, %rax, %rdi
addq 0x8(%r12), %rdi
movb 0xf8(%rsp), %al
addb %al, %bpl
movq %rdx, 0x40(%rsp)
movl %edx, %edx
xorl %r13d, %r13d
movzbl %al, %eax
movl %eax, 0x50(%rsp)
movq %rdx, 0x68(%rsp)
leaq (,%rdx,4), %rax
movq %rax, 0x60(%rsp)
movzbl %bpl, %eax
movl %eax, 0x4c(%rsp)
movq %r14, %rbp
xorl %r14d, %r14d
movq %rcx, 0x78(%rsp)
movq %rdi, 0x70(%rsp)
cmpq %rcx, %r14
je 0x152664
imulq $0x18, %r14, %r15
cmpl $0x0, 0xc(%rdi,%r15)
js 0x15264e
addq %rdi, %r15
movl 0x8(%r15), %esi
cmpl 0x3c(%rsp), %esi
je 0x15264e
movl 0x38(%rsp), %edx
shrl %edx
movl 0x50(%rsp), %eax
movl %eax, (%rsp)
movq %r12, %rdi
movq 0x58(%rsp), %rcx
movq %rbp, %r8
movq %rbx, %r9
callq 0x151cff
testl %eax, %eax
je 0x1525fe
movl 0x8(%r15), %esi
movq 0x100(%rsp), %rcx
movq %rcx, 0x30(%rsp)
movl %eax, 0x28(%rsp)
movl 0x4c(%rsp), %eax
movl %eax, 0x20(%rsp)
movq %rbx, 0x18(%rsp)
movq %r12, 0x10(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
movl 0x3c(%rsp), %edi
movq 0xe0(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq 0xe8(%rsp), %r9
movsd 0x9f21e(%rip), %xmm0    # 0x1f1810
callq 0xfad11
testl %eax, %eax
sete %al
jmp 0x152600
movb $0x1, %al
movq 0x10(%rbp), %rcx
addq 0x60(%rsp), %rcx
movl (%rbp), %edx
subl 0x40(%rsp), %edx
xorl %esi, %esi
movb 0xf8(%rsp), %r9b
cmpq %rsi, %rdx
je 0x152637
movl (%rcx,%rsi,4), %edi
movb (%rbx,%rdi), %r8b
testb %r9b, %r8b
je 0x152632
subb %r9b, %r8b
movb %r8b, (%rbx,%rdi)
incq %rsi
jmp 0x15261a
movq 0x68(%rsp), %rcx
movq %rcx, (%rbp)
testb %al, %al
movq 0x78(%rsp), %rcx
movq 0x70(%rsp), %rdi
je 0x15265e
incq %r14
jmp 0x152555
xorl %r13d, %r13d
jmp 0x152435
pushq $0x1
popq %rax
movl %eax, %r13d
movq 0x10(%rbp), %rax
movl 0x40(%rsp), %ecx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x152435
movl (%rax,%rdx,4), %esi
movb $0x0, (%rbx,%rsi)
incq %rdx
jmp 0x15266e