// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: if_false_bub_links(unsigned int, asg_t*, buf_t*, asg64_v*, unsigned int, int)
uint32_t if_false_bub_links(uint32_t v, asg_t *g, buf_t *x, asg64_v *b, uint32_t bs, int32_t check_dist)
{
    uint32_t i, mm = 1;
    if (g->seq[v>>1].del) return 0;
    for (i = bs; i < b->n; i++) {
        g->arc[b->a[i]].del = 1;
        asg_arc_del(g, g->arc[b->a[i]].v^1, (g->arc[b->a[i]].ul>>32)^1, 1);
    }
    if (asg_arc_n(g, v) < 2 || get_arcs(g, v, NULL, 0) < 2) mm = 0;
    
    if(mm) {
        mm = 0;
        if(asg_bub_pop1_primary_trio(g, NULL, v, check_dist, x, (uint32_t)-1, (uint32_t)-1, 0, 
                                                                    NULL, NULL, NULL, 0, 0, NULL)) {

            for (i = bs; i < b->n; i++) {
                g->arc[b->a[i]].del = 0;
                asg_arc_del(g, g->arc[b->a[i]].v^1, (g->arc[b->a[i]].ul>>32)^1, 0);
            }

            asg_arc_t *av = asg_arc_a(g, v); uint32_t nv = asg_arc_n(g, v);
            for (i = 0, b->n = bs; i < nv; i++) {
                if (av[i].del) continue;
                av[i].del = 1; asg_arc_del(g, av[i].v^1, (av[i].ul>>32)^1, 1);
                kv_push(uint64_t, *b, ((uint64_t)(av-g->arc+i)));     
            }

            if(asg_bub_pop1_primary_trio(g, NULL, x->S.a[0]^1, check_dist, x, (uint32_t)-1, (uint32_t)-1, 0, NULL, NULL, NULL, 0, 0, NULL)) {
                mm = 1;
            }
        }
    }
    
    for (i = bs; i < b->n; i++) {
        g->arc[b->a[i]].del = 0;
        asg_arc_del(g, g->arc[b->a[i]].v^1, (g->arc[b->a[i]].ul>>32)^1, 0);
    }

    return mm;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, %r14
movq 0x20(%rsi), %rax
movl %edi, %ecx
shrl %ecx
cmpl $0x0, (%rax,%rcx,8)
js 0x1ec4e9
movl %r8d, %ebx
movq %rsi, %r15
movl %edi, %r12d
movl %r8d, %r13d
cmpq %r13, (%r14)
jbe 0x1ec183
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %r13, %rsi
movl %ebx, %ecx
movq 0x8(%r15), %rdi
movq 0x10(%r14), %r8
movq (%r8,%rsi,8), %r8
leaq (%r8,%r8,2), %r8
orl $0x80000000, 0xc(%rdi,%r8,8) # imm = 0x80000000
movq 0x8(%r15), %rdi
movq 0x28(%r15), %r8
movq 0x10(%r14), %r10
movq (%r10,%rsi,8), %rsi
leaq (%rsi,%rsi,2), %rsi
movl 0x8(%rdi,%rsi,8), %r10d
xorq $0x1, %r10
movq (%r8,%r10,8), %r10
movq %r10, %r8
andq %rax, %r8
je 0x1ec175
movl 0x4(%rdi,%rsi,8), %esi
shrq $0x20, %r10
shlq $0x3, %r8
leaq (%r8,%r8,2), %r8
leaq (%r10,%r10,2), %r10
leaq (%rdi,%r10,8), %rdi
addq $0xc, %rdi
xorl %r10d, %r10d
movl -0x4(%rdi,%r10), %r11d
xorl %esi, %r11d
cmpl $0x1, %r11d
jne 0x1ec16c
orb $-0x80, 0x3(%rdi,%r10)
addq $0x18, %r10
cmpq %r10, %r8
jne 0x1ec158
incl %ecx
movq %rcx, %rsi
cmpq %rcx, (%r14)
ja 0x1ec0f7
movq %rdx, 0x40(%rsp)
movq 0x28(%r15), %rax
movl %r12d, %r10d
movq (%rax,%r10,8), %rax
xorl %ebp, %ebp
testl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
je 0x1ec451
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
andq %rax, %rcx
je 0x1ec451
shrq $0x20, %rax
movq 0x8(%r15), %rdi
xorl %esi, %esi
movl %eax, %r8d
leaq (%r8,%r8,2), %r8
movl 0xc(%rdi,%r8,8), %r8d
notl %r8d
shrl $0x1f, %r8d
addl %r8d, %esi
incq %rax
decq %rcx
jne 0x1ec1b8
xorl %ebp, %ebp
cmpl $0x2, %esi
jb 0x1ec451
movslq %r9d, %rcx
xorl %ebp, %ebp
movq %rbp, 0x38(%rsp)
movl %ebp, 0x30(%rsp)
movl %ebp, 0x28(%rsp)
movq %rbp, 0x20(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
movl %ebp, 0x8(%rsp)
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
movq %r15, %rdi
xorl %esi, %esi
movl %r12d, %edx
movq %rcx, 0x48(%rsp)
movq 0x40(%rsp), %r8
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
movq %r10, %r12
callq 0xbf39f
testq %rax, %rax
je 0x1ec451
movq %r12, %r10
cmpq %r13, (%r14)
jbe 0x1ec2d5
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %r13, %rdx
movl %ebx, %ecx
movq 0x8(%r15), %rsi
movq 0x10(%r14), %rdi
movq (%rdi,%rdx,8), %rdi
leaq (%rdi,%rdi,2), %rdi
andl $0x7fffffff, 0xc(%rsi,%rdi,8) # imm = 0x7FFFFFFF
movq 0x8(%r15), %rsi
movq 0x28(%r15), %rdi
movq 0x10(%r14), %r8
movq (%r8,%rdx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
movl 0x8(%rsi,%rdx,8), %r8d
xorq $0x1, %r8
movq (%rdi,%r8,8), %r8
movq %r8, %rdi
andq %rax, %rdi
je 0x1ec2c7
movl 0x4(%rsi,%rdx,8), %edx
shrq $0x20, %r8
shlq $0x3, %rdi
leaq (%rdi,%rdi,2), %rdi
leaq (%r8,%r8,2), %r8
leaq (%rsi,%r8,8), %rsi
addq $0xc, %rsi
xorl %r8d, %r8d
movl -0x4(%rsi,%r8), %r9d
xorl %edx, %r9d
cmpl $0x1, %r9d
jne 0x1ec2be
andb $0x7f, 0x3(%rsi,%r8)
addq $0x18, %r8
cmpq %r8, %rdi
jne 0x1ec2aa
incl %ecx
movq %rcx, %rdx
cmpq %rcx, (%r14)
ja 0x1ec24a
movq 0x28(%r15), %rax
movq (%rax,%r10,8), %rax
movq %rax, %rcx
shrq $0x20, %rcx
leaq (%rcx,%rcx,2), %r12
shlq $0x3, %r12
addq 0x8(%r15), %r12
movq %r13, (%r14)
testl %eax, %eax
je 0x1ec3fe
movl %eax, %r8d
xorl %ebp, %ebp
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movabsq $-0x5555555555555555, %r11 # imm = 0xAAAAAAAAAAAAAAAB
movq %r8, 0x50(%rsp)
leaq (,%rbp,2), %rax
addq %rbp, %rax
movl 0xc(%r12,%rax,8), %ecx
testl %ecx, %ecx
js 0x1ec3f2
leaq (%r12,%rax,8), %rax
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movl 0x8(%rax), %ecx
xorq $0x1, %rcx
movq 0x28(%r15), %rdx
movq (%rdx,%rcx,8), %rdx
movq %rdx, %rcx
andq %r10, %rcx
je 0x1ec38b
movl 0x4(%rax), %eax
movq 0x8(%r15), %rsi
shrq $0x20, %rdx
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rdx,%rdx,2), %rdx
leaq (%rsi,%rdx,8), %rdx
addq $0xc, %rdx
xorl %esi, %esi
movl -0x4(%rdx,%rsi), %edi
xorl %eax, %edi
cmpl $0x1, %edi
jne 0x1ec382
orb $-0x80, 0x3(%rdx,%rsi)
addq $0x18, %rsi
cmpq %rsi, %rcx
jne 0x1ec372
movq 0x8(%r14), %rax
cmpq %rax, (%r14)
jne 0x1ec3ce
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r14)
movq 0x10(%r14), %rdi
shlq $0x3, %rsi
callq 0x2370
movabsq $-0x5555555555555555, %r11 # imm = 0xAAAAAAAAAAAAAAAB
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movq 0x50(%rsp), %r8
movq %rax, 0x10(%r14)
movq %r12, %rax
subq 0x8(%r15), %rax
sarq $0x3, %rax
imulq %r11, %rax
addq %rbp, %rax
movq (%r14), %rcx
movq 0x10(%r14), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, (%r14)
movq %rax, (%rdx,%rcx,8)
incq %rbp
cmpq %r8, %rbp
jne 0x1ec315
movq 0x40(%rsp), %r8
movq 0x18(%r8), %rax
movl (%rax), %edx
xorl $0x1, %edx
xorl %eax, %eax
movq %rax, 0x38(%rsp)
movl %eax, 0x30(%rsp)
movl %eax, 0x28(%rsp)
movq %rax, 0x20(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
movl %eax, 0x8(%rsp)
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
movq %r15, %rdi
xorl %esi, %esi
movq 0x48(%rsp), %rcx
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
callq 0xbf39f
xorl %ebp, %ebp
testq %rax, %rax
setne %bpl
cmpq %r13, (%r14)
jbe 0x1ec4eb
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq 0x8(%r15), %rcx
movq 0x10(%r14), %rdx
movq (%rdx,%r13,8), %rdx
leaq (%rdx,%rdx,2), %rdx
andl $0x7fffffff, 0xc(%rcx,%rdx,8) # imm = 0x7FFFFFFF
movq 0x8(%r15), %rdx
movq 0x28(%r15), %rsi
movq 0x10(%r14), %rcx
movq (%rcx,%r13,8), %rcx
leaq (%rcx,%rcx,2), %rcx
movl 0x8(%rdx,%rcx,8), %edi
xorq $0x1, %rdi
movq (%rsi,%rdi,8), %rdi
movq %rdi, %rsi
andq %rax, %rsi
je 0x1ec4d9
movl 0x4(%rdx,%rcx,8), %ecx
shrq $0x20, %rdi
shlq $0x3, %rsi
leaq (%rsi,%rsi,2), %rsi
leaq (%rdi,%rdi,2), %rdi
leaq (%rdx,%rdi,8), %rdx
addq $0xc, %rdx
xorl %edi, %edi
movl -0x4(%rdx,%rdi), %r8d
xorl %ecx, %r8d
cmpl $0x1, %r8d
jne 0x1ec4d0
andb $0x7f, 0x3(%rdx,%rdi)
addq $0x18, %rdi
cmpq %rdi, %rsi
jne 0x1ec4bd
incl %ebx
movq %rbx, %r13
cmpq %rbx, (%r14)
ja 0x1ec45f
jmp 0x1ec4eb
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq