// File: 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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movq $0x0, -0x48(%rbp)
cmpl $-0x1, -0x24(%rbp)
je 0x1e23ee
movl -0x24(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x38(%rbp), %edx
callq 0x1e2260
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x34(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x34(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jae 0x1e23ec
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x1e2381
jmp 0x1e23de
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
xorl $0x1, %esi
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
xorq $0x1, %rax
movl %eax, %edx
movl $0x1, %ecx
callq 0x1de8a0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1e235a
jmp 0x1e23ee
cmpl $-0x1, -0x28(%rbp)
je 0x1e24e4
movl -0x28(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x38(%rbp), %edx
callq 0x1e2260
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x34(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x34(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jae 0x1e24e2
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x1e2477
jmp 0x1e24d4
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
xorl $0x1, %esi
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
xorq $0x1, %rax
movl %eax, %edx
movl $0x1, %ecx
callq 0x1de8a0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1e2450
jmp 0x1e24e4
cmpq $0x0, -0x20(%rbp)
jne 0x1e24f0
jmp 0x1e2704
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x1e2704
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x30(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x38(%rbp), %edx
callq 0x1e2260
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x34(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x34(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jae 0x1e25fc
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x1e2591
jmp 0x1e25ee
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
xorl $0x1, %esi
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
xorq $0x1, %rax
movl %eax, %edx
movl $0x1, %ecx
callq 0x1de8a0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1e256a
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x30(%rbp), %ecx
movl (%rax,%rcx,4), %eax
xorl $0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x38(%rbp), %edx
callq 0x1e2260
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x34(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x34(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jae 0x1e26f4
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x1e2689
jmp 0x1e26e6
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
xorl $0x1, %esi
movq -0x48(%rbp), %rax
movl -0x2c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
xorq $0x1, %rax
movl %eax, %edx
movl $0x1, %ecx
callq 0x1de8a0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1e2662
jmp 0x1e26f6
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x1e24f7
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)