// File: /workspace/github_cpp_makefile_star2_O1/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 %rsi, %r12
movq 0x20(%rsi), %rax
movl %edi, %esi
shrl %esi
xorl %r15d, %r15d
cmpl $0x0, (%rax,%rsi,8)
js 0x190d31
cmpb $0x1, 0x4(%rax,%rsi,8)
je 0x190d31
movq %r8, %r14
movl %edi, %ebp
movq 0x28(%r12), %rax
movl %edi, %esi
movq (%rax,%rsi,8), %rsi
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
andq %rsi, %r8
je 0x190d31
movq %r9, %rbx
movq %rcx, 0x60(%rsp)
movq 0x8(%r12), %rdi
shrq $0x20, %rsi
leaq (%rsi,%rsi,2), %rsi
leaq (%rdi,%rsi,8), %rdi
addq $0xc, %rdi
shlq $0x3, %r8
leaq (%r8,%r8,2), %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
movl (%rdi,%r8), %r10d
notl %r10d
shrl $0x1f, %r10d
addl %r10d, %r9d
addq $0x18, %r8
cmpq %r8, %rcx
jne 0x190b68
cmpl $0x1, %r9d
jne 0x190d2e
movq 0x8(%r12), %rdi
leaq (%rdi,%rsi,8), %rsi
addq $0xc, %rsi
xorl %edi, %edi
cmpl $0x0, (%rsi,%rdi)
js 0x190ba3
movl -0x4(%rsi,%rdi), %r13d
addq $0x18, %rdi
cmpq %rdi, %rcx
jne 0x190b98
movl %r13d, %r9d
xorl $0x1, %r9d
movq (%rax,%r9,8), %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
andq %rax, %rcx
je 0x190d2e
movq 0x8(%r12), %rsi
shrq $0x20, %rax
leaq (%rax,%rax,2), %rax
leaq (%rsi,%rax,8), %rax
addq $0xc, %rax
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
xorl %esi, %esi
xorl %edi, %edi
movl (%rax,%rsi), %r8d
notl %r8d
shrl $0x1f, %r8d
addl %r8d, %edi
addq $0x18, %rsi
cmpq %rsi, %rcx
jne 0x190be6
xorl %r15d, %r15d
cmpl $0x2, %edi
jl 0x190d31
movq %r9, 0x48(%rsp)
xorl $0x1, %ebp
leaq 0x88(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x90(%rsp), %rax
movq %rax, (%rsp)
movq $0x0, 0x18(%rsp)
movl $0x1, 0x10(%rsp)
leaq 0x6c(%rsp), %rcx
leaq 0xa0(%rsp), %r8
leaq 0x98(%rsp), %r9
movq %r12, %rdi
movq %rdx, %rsi
movl %ebp, %edx
callq 0x10109f
cmpl $0x7, %eax
je 0x190d31
movq 0x28(%r12), %rcx
movl 0x6c(%rsp), %eax
movq %rcx, 0x58(%rsp)
movq (%rcx,%rax,8), %rcx
movq %rcx, %rax
shlq $0x20, %rax
setne %al
movq %r14, 0x70(%rsp)
je 0x190d46
movq 0x8(%r12), %rdx
movq %rcx, %rsi
shrq $0x20, %rsi
leaq (%rsi,%rsi,2), %rsi
leaq (%rdx,%rsi,8), %rdi
movl %ecx, %r8d
addq $0xc, %rdx
movq %rdx, 0x50(%rsp)
xorl %r9d, %r9d
xorl %esi, %esi
leaq (%r9,%r9,2), %rcx
cmpl $0x0, 0xc(%rdi,%rcx,8)
js 0x190d1c
leaq (%rdi,%rcx,8), %rcx
movl 0x8(%rcx), %ecx
xorq $0x1, %rcx
movq 0x58(%rsp), %rdx
movq (%rdx,%rcx,8), %r10
movq %r10, %rcx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
andq %rdx, %rcx
je 0x190d27
shrq $0x20, %r10
leaq (%r10,%r10,2), %r10
movq 0x50(%rsp), %rdx
leaq (%rdx,%r10,8), %r11
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %r14
xorl %r10d, %r10d
xorl %ecx, %ecx
movl (%r11,%r10), %edx
notl %edx
shrl $0x1f, %edx
addl %edx, %ecx
addq $0x18, %r10
cmpq %r10, %r14
jne 0x190cfc
cmpl $0x2, %ecx
movq 0x70(%rsp), %r14
jl 0x190d27
incl %esi
incq %r9
cmpq %r8, %r9
setb %al
jne 0x190cb2
testl %esi, %esi
sete %cl
jmp 0x190d48
xorl %r15d, %r15d
movl %r15d, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %cl
orb %al, %cl
testb $0x1, %cl
movq 0x60(%rsp), %r8
jne 0x190d31
movq $0x0, (%r8)
shrl %r13d
movb 0xf0(%rsp), %r15b
movzbl %r15b, %eax
movl %eax, (%rsp)
movq %r12, %rdi
movl %ebp, %esi
movl %r13d, %edx
movq %r14, %rcx
movq %rbx, %r9
callq 0x1903fd
movq 0x60(%rsp), %r8
movq (%r8), %r11
movq 0x28(%r12), %rax
movq 0x48(%rsp), %rcx
movq (%rax,%rcx,8), %rax
testl %eax, %eax
je 0x190ef6
movq %rax, %rcx
shrq $0x20, %rcx
leaq (%rcx,%rcx,2), %rdx
shlq $0x3, %rdx
addq 0x8(%r12), %rdx
movb 0xf8(%rsp), %cl
addb %cl, %r15b
movb %r15b, 0x47(%rsp)
movl %r11d, %esi
movl %eax, %edi
xorl %r15d, %r15d
movzbl %cl, %eax
movl %eax, 0x68(%rsp)
movq %rsi, 0x48(%rsp)
leaq (,%rsi,4), %rax
movq %rax, 0x78(%rsp)
movq %r11, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movq %rdi, 0x80(%rsp)
leaq (%r15,%r15,2), %rax
cmpl $0x0, 0xc(%rdx,%rax,8)
js 0x190eea
leaq (%rdx,%rax,8), %r14
movl 0x8(%r14), %esi
cmpl %ebp, %esi
je 0x190eea
movl 0x68(%rsp), %eax
movl %eax, (%rsp)
movq %r12, %rdi
movl %r13d, %edx
movq 0x70(%rsp), %rcx
movq %rbx, %r9
callq 0x1903fd
testl %eax, %eax
je 0x190e8b
movl 0x8(%r14), %esi
movq 0x100(%rsp), %rcx
movq %rcx, 0x30(%rsp)
movl %eax, 0x28(%rsp)
movzbl 0x47(%rsp), %eax
movl %eax, 0x20(%rsp)
movq %rbx, 0x18(%rsp)
movq %r12, 0x10(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
movl %ebp, %edi
movq 0xe0(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq 0xe8(%rsp), %r9
movsd 0xa2881(%rip), %xmm0    # 0x233700
callq 0x13c3e2
testl %eax, %eax
sete %al
jmp 0x190e8d
movb $0x1, %al
movb 0xf8(%rsp), %r10b
movq 0x60(%rsp), %r8
movq (%r8), %rdx
movq 0x58(%rsp), %r11
subq %r11, %rdx
testl %edx, %edx
je 0x190ed1
movq 0x10(%r8), %rcx
addq 0x78(%rsp), %rcx
movl %edx, %edx
xorl %esi, %esi
movl (%rcx,%rsi,4), %edi
movb (%rbx,%rdi), %r9b
testb %r10b, %r9b
je 0x190ec9
subb %r10b, %r9b
movb %r9b, (%rbx,%rdi)
incq %rsi
cmpq %rsi, %rdx
jne 0x190eb6
movq 0x48(%rsp), %rcx
movq %rcx, (%r8)
testb %al, %al
movq 0x50(%rsp), %rdx
movq 0x80(%rsp), %rdi
je 0x190f1f
incq %r15
cmpq %rdi, %r15
jne 0x190df4
xorl %r15d, %r15d
testl %r11d, %r11d
je 0x190d31
movq 0x10(%r8), %rax
movl %r11d, %ecx
xorl %edx, %edx
movl (%rax,%rdx,4), %esi
movb $0x0, (%rbx,%rsi)
incq %rdx
cmpq %rdx, %rcx
jne 0x190f0b
jmp 0x190d31
movl $0x1, %r15d
jmp 0x190ef9