// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: drop_g_edges_by_utg(bubble_type*, asg_t*, ma_ug_t*, kvec_t_u32_warp*, unsigned int, unsigned int)
void drop_g_edges_by_utg(bubble_type* bub, asg_t *bsg, ma_ug_t *bub_ug, kvec_t_u32_warp* res_btg, 
uint32_t b_utg_beg, uint32_t b_utg_sink)
{
    uint32_t i, k, v, root, nv;
    asg_arc_t *av = NULL;
    if(b_utg_beg != (uint32_t)-1)
    {
        root = b_utg_beg;
        v = get_utg_end_from_btg(bub, bub_ug, root);
        nv = asg_arc_n(bsg, v);
        av = asg_arc_a(bsg, v);
        for (i = 0; i < nv; i++)
        {
            if(av[i].del) continue;
            av[i].del = 1;
            asg_arc_del(bsg, (av[i].v)^1, (av[i].ul>>32)^1, 1);
        }
    }
    
    if(b_utg_sink != (uint32_t)-1)
    {
        root = b_utg_sink;
        v = get_utg_end_from_btg(bub, bub_ug, root);
        nv = asg_arc_n(bsg, v);
        av = asg_arc_a(bsg, v);
        for (i = 0; i < nv; i++)
        {
            if(av[i].del) continue;
            av[i].del = 1;
            asg_arc_del(bsg, (av[i].v)^1, (av[i].ul>>32)^1, 1);
        }
    }
    

    if(res_btg == NULL) return;

    for (k = 0; k < res_btg->a.n; k++)
    {
        root = res_btg->a.a[k];
        v = get_utg_end_from_btg(bub, bub_ug, root);
        nv = asg_arc_n(bsg, v);
        av = asg_arc_a(bsg, v);
        for (i = 0; i < nv; i++)
        {
            if(av[i].del) continue;
            av[i].del = 1;
            asg_arc_del(bsg, (av[i].v)^1, (av[i].ul>>32)^1, 1);
        }


        root = res_btg->a.a[k]^1;
        v = get_utg_end_from_btg(bub, bub_ug, root);
        nv = asg_arc_n(bsg, v);
        av = asg_arc_a(bsg, v);
        for (i = 0; i < nv; i++)
        {
            if(av[i].del) continue;
            av[i].del = 1;
            asg_arc_del(bsg, (av[i].v)^1, (av[i].ul>>32)^1, 1);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
cmpl $-0x1, %r8d
je 0x14e459
movq 0x10(%rdx), %rax
movl %r8d, %edi
shrl %edi
leaq (%rdi,%rdi,4), %r10
movq 0x18(%rax,%r10,8), %rdi
testb $0x1, %r8b
jne 0x14e3aa
leaq (%rax,%r10,8), %rax
movl 0x10(%rax), %eax
decl %eax
movl 0x4(%rdi,%rax,8), %eax
jmp 0x14e3b1
movl 0x4(%rdi), %eax
xorq $0x1, %rax
movq 0x28(%rsi), %rdi
movq (%rdi,%rax,8), %rdi
testl %edi, %edi
je 0x14e459
movq %rdi, %rax
shrq $0x20, %rax
leaq (%rax,%rax,2), %rax
shlq $0x3, %rax
addq 0x8(%rsi), %rax
movl %edi, %edi
xorl %r8d, %r8d
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
leaq (%r8,%r8,2), %r11
movl 0xc(%rax,%r11,8), %ebx
testl %ebx, %ebx
js 0x14e451
leaq (%rax,%r11,8), %r11
orl $0x80000000, %ebx       # imm = 0x80000000
movl %ebx, 0xc(%r11)
movl 0x8(%r11), %ebx
xorq $0x1, %rbx
movq 0x28(%rsi), %r14
movq (%r14,%rbx,8), %r14
movq %r14, %rbx
andq %r10, %rbx
je 0x14e451
movl 0x4(%r11), %r11d
movq 0x8(%rsi), %r15
shrq $0x20, %r14
shlq $0x3, %rbx
leaq (%rbx,%rbx,2), %rbx
leaq (%r14,%r14,2), %r14
leaq (%r15,%r14,8), %r14
addq $0xc, %r14
xorl %r15d, %r15d
movl -0x4(%r14,%r15), %ebp
xorl %r11d, %ebp
cmpl $0x1, %ebp
jne 0x14e448
orb $-0x80, 0x3(%r14,%r15)
addq $0x18, %r15
cmpq %r15, %rbx
jne 0x14e435
incq %r8
cmpq %rdi, %r8
jne 0x14e3df
cmpl $-0x1, %r9d
je 0x14e53b
movq 0x10(%rdx), %rax
movl %r9d, %edi
shrl %edi
leaq (%rdi,%rdi,4), %r8
movq 0x18(%rax,%r8,8), %rdi
testb $0x1, %r9b
jne 0x14e48a
leaq (%rax,%r8,8), %rax
movl 0x10(%rax), %eax
decl %eax
movl 0x4(%rdi,%rax,8), %eax
jmp 0x14e491
movl 0x4(%rdi), %eax
xorq $0x1, %rax
movq 0x28(%rsi), %rdi
movq (%rdi,%rax,8), %rdi
testl %edi, %edi
je 0x14e53b
movq %rdi, %rax
shrq $0x20, %rax
leaq (%rax,%rax,2), %rax
shlq $0x3, %rax
addq 0x8(%rsi), %rax
movl %edi, %edi
xorl %r8d, %r8d
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
leaq (%r8,%r8,2), %r10
movl 0xc(%rax,%r10,8), %r11d
testl %r11d, %r11d
js 0x14e533
leaq (%rax,%r10,8), %r10
orl $0x80000000, %r11d      # imm = 0x80000000
movl %r11d, 0xc(%r10)
movl 0x8(%r10), %r11d
xorq $0x1, %r11
movq 0x28(%rsi), %rbx
movq (%rbx,%r11,8), %rbx
movq %rbx, %r11
andq %r9, %r11
je 0x14e533
movl 0x4(%r10), %r10d
movq 0x8(%rsi), %r14
shrq $0x20, %rbx
shlq $0x3, %r11
leaq (%r11,%r11,2), %r11
leaq (%rbx,%rbx,2), %rbx
leaq (%r14,%rbx,8), %rbx
addq $0xc, %rbx
xorl %r14d, %r14d
movl -0x4(%rbx,%r14), %ebp
xorl %r10d, %ebp
cmpl $0x1, %ebp
jne 0x14e52a
orb $-0x80, 0x3(%rbx,%r14)
addq $0x18, %r14
cmpq %r14, %r11
jne 0x14e517
incq %r8
cmpq %rdi, %r8
jne 0x14e4bf
testq %rcx, %rcx
je 0x14e71c
cmpq $0x0, (%rcx)
je 0x14e71c
xorl %eax, %eax
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq 0x10(%rcx), %r8
movl (%r8,%rax,4), %r9d
movq 0x10(%rdx), %r8
movl %r9d, %r10d
shrl %r10d
leaq (%r10,%r10,4), %rbx
movq 0x18(%r8,%rbx,8), %r11
testb $0x1, %r9b
jne 0x14e586
leaq (%r8,%rbx,8), %rbx
movl 0x10(%rbx), %ebx
decl %ebx
movl 0x4(%r11,%rbx,8), %r11d
jmp 0x14e58e
movl 0x4(%r11), %r11d
xorq $0x1, %r11
movq 0x28(%rsi), %rbx
movq (%rbx,%r11,8), %r11
testl %r11d, %r11d
je 0x14e644
movq %r11, %r8
shrq $0x20, %r8
leaq (%r8,%r8,2), %r8
shlq $0x3, %r8
addq 0x8(%rsi), %r8
movl %r11d, %r9d
xorl %r10d, %r10d
leaq (%r10,%r10,2), %r11
movl 0xc(%r8,%r11,8), %ebx
testl %ebx, %ebx
js 0x14e62a
leaq (%r8,%r11,8), %r11
orl $0x80000000, %ebx       # imm = 0x80000000
movl %ebx, 0xc(%r11)
movl 0x8(%r11), %ebx
xorq $0x1, %rbx
movq 0x28(%rsi), %r14
movq (%r14,%rbx,8), %r14
movq %r14, %rbx
andq %rdi, %rbx
je 0x14e62a
movl 0x4(%r11), %r11d
movq 0x8(%rsi), %r15
shrq $0x20, %r14
shlq $0x3, %rbx
leaq (%rbx,%rbx,2), %rbx
leaq (%r14,%r14,2), %r14
leaq (%r15,%r14,8), %r14
addq $0xc, %r14
xorl %r15d, %r15d
movl -0x4(%r14,%r15), %ebp
xorl %r11d, %ebp
cmpl $0x1, %ebp
jne 0x14e621
orb $-0x80, 0x3(%r14,%r15)
addq $0x18, %r15
cmpq %r15, %rbx
jne 0x14e60e
incq %r10
cmpq %r9, %r10
jne 0x14e5b8
movq 0x10(%rcx), %r8
movl (%r8,%rax,4), %r9d
movq 0x10(%rdx), %r8
movl %r9d, %r10d
shrl %r10d
leaq (%r10,%r10,4), %r11
movq 0x18(%r8,%r11,8), %r10
testb $0x1, %r9b
jne 0x14e65d
movl 0x4(%r10), %r8d
xorq $0x1, %r8
jmp 0x14e66d
leaq (%r8,%r11,8), %r8
movl 0x10(%r8), %r8d
decl %r8d
movl 0x4(%r10,%r8,8), %r8d
movq 0x28(%rsi), %r9
movq (%r9,%r8,8), %r9
testl %r9d, %r9d
je 0x14e711
movq %r9, %r8
shrq $0x20, %r8
leaq (%r8,%r8,2), %r8
shlq $0x3, %r8
addq 0x8(%rsi), %r8
movl %r9d, %r9d
xorl %r10d, %r10d
leaq (%r10,%r10,2), %r11
movl 0xc(%r8,%r11,8), %ebx
testl %ebx, %ebx
js 0x14e709
leaq (%r8,%r11,8), %r11
orl $0x80000000, %ebx       # imm = 0x80000000
movl %ebx, 0xc(%r11)
movl 0x8(%r11), %ebx
xorq $0x1, %rbx
movq 0x28(%rsi), %r14
movq (%r14,%rbx,8), %r14
movq %r14, %rbx
andq %rdi, %rbx
je 0x14e709
movl 0x4(%r11), %r11d
movq 0x8(%rsi), %r15
shrq $0x20, %r14
shlq $0x3, %rbx
leaq (%rbx,%rbx,2), %rbx
leaq (%r14,%r14,2), %r14
leaq (%r15,%r14,8), %r14
addq $0xc, %r14
xorl %r15d, %r15d
movl -0x4(%r14,%r15), %ebp
xorl %r11d, %ebp
cmpl $0x1, %ebp
jne 0x14e700
orb $-0x80, 0x3(%r14,%r15)
addq $0x18, %r15
cmpq %r15, %rbx
jne 0x14e6ed
incq %r10
cmpq %r9, %r10
jne 0x14e697
incl %eax
cmpq %rax, (%rcx)
ja 0x14e555
popq %rbx
popq %r14
popq %r15
popq %rbp
retq