// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: if_conflict_utg(unsigned int, unsigned int*, unsigned int*, ma_ug_t*, unsigned char*, unsigned char*, unsigned int, kvec_t_u32_warp*)
void if_conflict_utg(uint32_t root, uint32_t* aim_0, uint32_t* aim_1, ma_ug_t* ug, uint8_t* vis_flag,
uint8_t* is_vis_2, uint32_t ava_flag, kvec_t_u32_warp* stack)
{
    uint32_t n_vx = ug->g->n_seq<<1, k, cur, ncur;
    asg_arc_t *acur = NULL;
    memset(is_vis_2, 0, n_vx);

    stack->a.n = 0;
    kv_push(uint32_t, stack->a, root);
    while (stack->a.n > 0)
    {
        stack->a.n--;
        cur = stack->a.a[stack->a.n];
        if(is_vis_2[cur]) continue;
        is_vis_2[cur] = 1;
       
        ncur = asg_arc_n(ug->g, cur);
        acur = asg_arc_a(ug->g, cur);
        for (k = 0; k < ncur; k++)
        {
            if(acur[k].del) continue;
            if(is_vis_2[acur[k].v]) continue;
            if(vis_flag[acur[k].v>>1] != 0 && vis_flag[acur[k].v>>1] != ava_flag)
            {
                if(aim_0 && (acur[k].v>>1) == (*aim_0)) continue;
                if(aim_1 && (acur[k].v>>1) == (*aim_1)) continue;
                break;
            }
            kv_push(uint32_t, stack->a, acur[k].v);
        }

        if(k < ncur) return;
    }

    for (k = 0; k < n_vx; k++)
    {
        if(is_vis_2[k] && vis_flag[k>>1] == 0)
        {
            ///fprintf(stderr, "******************k=utg%.6ul, vis_flag: %u\n", (k>>1)+1, vis_flag[k>>1]);
            vis_flag[k>>1] = ava_flag;
        } 
        
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %rbx
movq %r8, %r14
movq %rdx, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movl %edi, %ebp
movq 0x68(%rsp), %r12
movq %rcx, 0x20(%rsp)
movq 0x18(%rcx), %rax
movl 0x14(%rax), %edx
addl %edx, %edx
movq %r9, %rdi
xorl %esi, %esi
movq %rdx, (%rsp)
callq 0x20e0
movq $0x0, (%r12)
cmpq $0x0, 0x8(%r12)
jne 0x149f00
movq $0x2, 0x8(%r12)
movq 0x10(%r12), %rdi
movl $0x8, %esi
callq 0x2370
movq %rax, 0x10(%r12)
movl 0x60(%rsp), %edi
movq (%r12), %rcx
movq 0x10(%r12), %rdx
movq %rcx, %rax
incq %rax
movq %rax, (%r12)
movl %ebp, (%rdx,%rcx,4)
movq 0x10(%rsp), %r8
movq 0x8(%rsp), %r9
je 0x14a049
movq %r14, 0x18(%rsp)
leaq -0x1(%rax), %rcx
movq %rcx, (%r12)
movq 0x10(%r12), %rcx
movl -0x4(%rcx,%rax,4), %eax
cmpb $0x0, (%rbx,%rax)
jne 0x14a03c
movb $0x1, (%rbx,%rax)
movq 0x20(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq 0x28(%rcx), %rdx
movq (%rdx,%rax,8), %rax
testl %eax, %eax
je 0x14a03c
movq 0x8(%rcx), %rcx
movq %rax, %rdx
shrq $0x20, %rdx
movl %eax, %eax
leaq (%rdx,%rdx,2), %rdx
leaq (%rcx,%rdx,8), %r15
addq $0x8, %r15
shlq $0x3, %rax
leaq (%rax,%rax,2), %r13
xorl %ebp, %ebp
cmpl $0x0, 0x4(%r15,%rbp)
js 0x14a02f
movl (%r15,%rbp), %eax
cmpb $0x0, (%rbx,%rax)
jne 0x14a02f
shrl %eax
movzbl (%r14,%rax), %ecx
testl %ecx, %ecx
sete %dl
cmpl %edi, %ecx
sete %cl
orb %dl, %cl
je 0x14a01b
movq 0x8(%r12), %rax
cmpq %rax, (%r12)
jne 0x14a001
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r12)
movl %edi, %r14d
movq 0x10(%r12), %rdi
shlq $0x2, %rsi
callq 0x2370
movq 0x8(%rsp), %r9
movq 0x10(%rsp), %r8
movl %r14d, %edi
movq 0x18(%rsp), %r14
movq %rax, 0x10(%r12)
movl (%r15,%rbp), %eax
movq (%r12), %rcx
movq 0x10(%r12), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, (%r12)
movl %eax, (%rdx,%rcx,4)
jmp 0x14a02f
testq %r9, %r9
je 0x14a025
cmpl (%r9), %eax
je 0x14a02f
testq %r8, %r8
je 0x14a071
cmpl (%r8), %eax
jne 0x14a071
addq $0x18, %rbp
cmpq %rbp, %r13
jne 0x149f8a
movq (%r12), %rax
testq %rax, %rax
jne 0x149f2f
cmpl $0x0, (%rsp)
je 0x14a071
movl (%rsp), %eax
xorl %ecx, %ecx
cmpb $0x0, (%rbx,%rcx)
je 0x14a069
movl %ecx, %edx
shrl %edx
cmpb $0x0, (%r14,%rdx)
jne 0x14a069
movb %dil, (%r14,%rdx)
incq %rcx
cmpq %rcx, %rax
jne 0x14a054
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq