// File: 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
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xd0, %rsp
movq 0x30(%rbp), %rax
movb 0x28(%rbp), %al
movb 0x20(%rbp), %al
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movl %edi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movq %r8, -0x38(%rbp)
movq %r9, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x78(%rbp)
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x18(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x272f0a
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x18(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movzbl 0x4(%rax,%rcx,8), %eax
cmpl $0x1, %eax
jne 0x272f16
movl $0x0, -0x14(%rbp)
jmp 0x27331d
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x18(%rbp), %ecx
movq (%rax,%rcx,8), %rax
cmpl $0x0, %eax
je 0x272f3f
movq -0x20(%rbp), %rdi
movl -0x18(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
cmpl $0x1, %eax
je 0x272f4b
movl $0x0, -0x14(%rbp)
jmp 0x27331d
movq -0x20(%rbp), %rdi
movl -0x18(%rbp), %esi
leaq -0x4c(%rbp), %rdx
callq 0x166b50
movq -0x20(%rbp), %rdi
movl -0x4c(%rbp), %esi
xorl $0x1, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
cmpl $0x2, %eax
jge 0x272f7f
movl $0x0, -0x14(%rbp)
jmp 0x27331d
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x18(%rbp), %edx
xorl $0x1, %edx
leaq -0x58(%rbp), %rcx
leaq -0x88(%rbp), %r8
leaq -0x90(%rbp), %r9
leaq -0x98(%rbp), %r10
leaq -0xa0(%rbp), %rax
xorl %r11d, %r11d
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movl $0x1, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
callq 0x166c30
movl %eax, -0x54(%rbp)
cmpl $0x7, -0x54(%rbp)
jne 0x272fe4
movl $0x0, -0x14(%rbp)
jmp 0x27331d
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x58(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x58(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x5c(%rbp)
movl $0x0, -0x68(%rbp)
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jae 0x273089
movq -0x48(%rbp), %rax
movl -0x60(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x27304d
jmp 0x27307e
movq -0x20(%rbp), %rdi
movq -0x48(%rbp), %rax
movl -0x60(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
xorl $0x1, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
cmpl $0x2, %eax
jge 0x273075
jmp 0x273089
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x27302a
cmpl $0x0, -0x68(%rbp)
je 0x273097
movl -0x60(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jae 0x2730a3
movl $0x0, -0x14(%rbp)
jmp 0x27331d
movq -0x30(%rbp), %rax
movq $0x0, (%rax)
movl -0x4c(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0x4c(%rbp)
movl -0x18(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0x50(%rbp)
movq -0x20(%rbp), %rdi
movl -0x50(%rbp), %esi
movl -0x4c(%rbp), %edx
shrl %edx
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %r8
movq -0x40(%rbp), %r9
movzbl 0x20(%rbp), %eax
movl %eax, (%rsp)
callq 0x272350
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl %eax, -0x6c(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x4c(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x4c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x5c(%rbp)
movl $0x0, -0x70(%rbp)
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jae 0x2732d9
movq -0x48(%rbp), %rax
movl -0x60(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x27316f
movq -0x48(%rbp), %rax
movl -0x60(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpl -0x50(%rbp), %eax
jne 0x273174
jmp 0x2732cb
movq -0x20(%rbp), %rdi
movq -0x48(%rbp), %rax
movl -0x60(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
movl -0x4c(%rbp), %edx
shrl %edx
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %r8
movq -0x40(%rbp), %r9
movzbl 0x28(%rbp), %eax
movl %eax, (%rsp)
callq 0x272350
movl %eax, -0x68(%rbp)
cmpl $0x0, -0x68(%rbp)
je 0x27323b
movl -0x50(%rbp), %edi
movq -0x48(%rbp), %rax
movl -0x60(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
movq 0x10(%rbp), %rdx
movq 0x18(%rbp), %r9
movq -0x20(%rbp), %r14
movq -0x40(%rbp), %rbx
movzbl 0x20(%rbp), %eax
movzbl 0x28(%rbp), %ecx
addl %ecx, %eax
movb %al, %r11b
movl -0x68(%rbp), %r10d
movq 0x30(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %r8d
movsd 0x11d377(%rip), %xmm0   # 0x390570
movq %r8, %rcx
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq %r14, 0x10(%rsp)
movq %rbx, 0x18(%rsp)
movzbl %r11b, %r11d
movl %r11d, 0x20(%rsp)
movl %r10d, 0x28(%rsp)
movq %rax, 0x30(%rsp)
callq 0x1ccb10
cmpl $0x0, %eax
je 0x27323b
movl $0x1, -0x70(%rbp)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x6c(%rbp), %ecx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl -0x6c(%rbp), %ecx
subq %rcx, %rax
movl %eax, -0x7c(%rbp)
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jae 0x2732b5
movq -0x40(%rbp), %rax
movq -0x78(%rbp), %rcx
movl -0x64(%rbp), %edx
movl (%rcx,%rdx,4), %ecx
movzbl (%rax,%rcx), %eax
movzbl 0x28(%rbp), %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x2732a8
movzbl 0x28(%rbp), %esi
movq -0x40(%rbp), %rax
movq -0x78(%rbp), %rcx
movl -0x64(%rbp), %edx
movl (%rcx,%rdx,4), %ecx
movzbl (%rax,%rcx), %edx
subl %esi, %edx
movb %dl, (%rax,%rcx)
jmp 0x2732aa
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x273268
movl -0x6c(%rbp), %eax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
cmpl $0x0, -0x70(%rbp)
je 0x2732c9
jmp 0x2732d9
jmp 0x2732cb
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x273134
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x78(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jae 0x273317
movq -0x40(%rbp), %rax
movq -0x78(%rbp), %rcx
movl -0x64(%rbp), %edx
movl (%rcx,%rdx,4), %ecx
movb $0x0, (%rax,%rcx)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x2732f2
movl -0x70(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)