// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/Overlaps.cpp
// Function: bub_pop_merge(ma_ug_t*, ma_ug_t*, unsigned int, unsigned int, unsigned long, buf_t*, unsigned int, unsigned int, hap_cov_t*, unsigned int, utg_trans_t*, kvec_asg_arc_t_warp*, ma_hit_t_alloc*, ma_sub_t*, int, int, int, unsigned int*)
uint32_t bub_pop_merge(ma_ug_t *raw_ug, ma_ug_t *new_ug, uint32_t v0, uint32_t v1, uint64_t max_dist, buf_t *b, 
uint32_t positive_flag, uint32_t negative_flag, hap_cov_t *cov, uint32_t is_update_chain, utg_trans_t *o, kvec_asg_arc_t_warp *ae, 
ma_hit_t_alloc* src, ma_sub_t *sub, int32_t max_hang, int32_t min_ovlp, int32_t gap_fuzz, uint32_t *n_insert)
{
    ///do not pop bubble within new_ug; 
    uint32_t is_pop = asg_bub_pop1_primary_trio(new_ug->g, new_ug, v0, max_dist, b, positive_flag, negative_flag, 0, NULL, NULL, cov, is_update_chain, 1/**0**/, o);
    assert(is_pop); assert(b->S.a[0] == v1);

    ///b->S.a[0] is the sink of this bubble
    uint32_t i, v, qn, tn, tmp_c, u; asg_arc_t *a;
    asg_t *g = raw_ug->g; tmp_c = g->seq[b->S.a[0]>>1].c;
    
    ///assert(b->S.n == 1);
    ///first remove all nodes in this bubble
    for (i = 0; i < b->b.n; ++i) g->seq[b->b.a[i]>>1].c = ALTER_LABLE;
    

    ///v is the sink of this bubble
    v = b->S.a[0];
    ///recover node
    do {
        u = b->a[v].p; // u->v
        /****************************may have hap bugs********************************/
        ////g->seq[v>>1].c = PRIMARY_LABLE;
        g->seq[v>>1].c = HAP_LABLE;
        /****************************may have hap bugs********************************/
        v = u;
    } while (v != v0);
    ///especially for unitig graph, don't label beg and sink node of a bubble as HAP_LABLE
    ///since in unitig graph, a node may consist of a lot of reads
    g->seq[b->S.a[0]>>1].c = tmp_c;

    ///remove all edges (self/reverse for each edge) in this bubble
    for (i = 0; i < b->e.n; ++i) {
        a = &(new_ug->g->arc[b->e.a[i]]);///note:: new_ug->g here
        qn = a->ul>>33;
        tn = a->v>>1;
        if(g->seq[qn].c == ALTER_LABLE && g->seq[tn].c == ALTER_LABLE) continue;
        ///remove this edge self
        asg_arc_del(g, a->ul>>32, a->v, 1);
        ///remove the reverse direction
        asg_arc_del(g, a->v^1, a->ul>>32^1, 1);
    }

    ///v is the sink of this bubble
    v = b->S.a[0];
    ///recover node
    do {
        u = b->a[v].p; // u->v
        g->seq[v>>1].del = 0;
        asg_arc_rest(g, new_ug->g, u, v, raw_ug, ae, src, sub, max_hang, min_ovlp, gap_fuzz, n_insert);
        v = u;
    } while (v != v0);
    return is_pop;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, %rbp
movl %ecx, %r12d
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, 0x10(%rsp)
movl 0x80(%rsp), %r9d
movl 0x88(%rsp), %eax
movq 0x90(%rsp), %rcx
movl 0x98(%rsp), %edx
movq 0xa0(%rsp), %rsi
movq 0x18(%r15), %rdi
subq $0x40, %rsp
movq %rsi, 0x38(%rsp)
movl %edx, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
movl %eax, (%rsp)
movl $0x1, 0x30(%rsp)
movl $0x0, 0x8(%rsp)
movq %r15, %rsi
movl %r14d, %edx
movq %r8, %rcx
movq %rbp, %r8
callq 0xc02d6
addq $0x40, %rsp
movq %rax, %r10
testl %r10d, %r10d
je 0xe7845
movq 0x18(%rbp), %rax
cmpl %r12d, (%rax)
jne 0xe784e
movq 0x10(%rsp), %rax
movq 0x18(%rax), %r13
movq 0x20(%r13), %rax
movl %r12d, %ecx
shrl %ecx
movb 0x4(%rax,%rcx,8), %dl
movq 0x38(%rbp), %rsi
testq %rsi, %rsi
je 0xe70ff
movq 0x48(%rbp), %rdi
xorl %r8d, %r8d
movl (%rdi,%r8,4), %r9d
shrl %r9d
movb $0x1, 0x4(%rax,%r9,8)
incq %r8
movl %r8d, %r9d
cmpq %r9, %rsi
ja 0xe70e7
movq %r10, 0x18(%rsp)
movq (%rbp), %rsi
movl %r12d, %edi
movl %edi, %r8d
leaq (%r8,%r8,8), %r9
leaq (%r9,%r9,2), %r9
addq %r8, %r9
movl (%rsi,%r9), %r8d
shrl %edi
movb $0x2, 0x4(%rax,%rdi,8)
movl %r8d, %edi
cmpl %r14d, %r8d
jne 0xe710b
movb %dl, 0x4(%rax,%rcx,8)
cmpq $0x0, 0x50(%rbp)
je 0xe7239
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq 0x18(%r15), %rdx
movq 0x8(%rdx), %r8
movq 0x60(%rbp), %rdx
movl (%rdx,%rax,4), %edx
leaq (%rdx,%rdx,2), %r9
movq (%r8,%r9,8), %rdx
movq 0x20(%r13), %rdi
movq %rdx, %rsi
shrq $0x21, %rsi
cmpb $0x1, 0x4(%rdi,%rsi,8)
movl 0x8(%r8,%r9,8), %esi
jne 0xe7182
movl %esi, %r10d
shrl %r10d
cmpb $0x1, 0x4(%rdi,%r10,8)
je 0xe7226
shrq $0x20, %rdx
movq 0x8(%r13), %rdi
movq 0x28(%r13), %r10
movq (%r10,%rdx,8), %r11
movq %r11, %rbx
andq %rcx, %rbx
je 0xe71df
leaq (%r8,%r9,8), %r8
shrq $0x20, %r11
shlq $0x3, %rbx
leaq (%rbx,%rbx,2), %rdx
leaq (%r11,%r11,2), %r9
leaq (%rdi,%r9,8), %rdi
addq $0xc, %rdi
xorl %r9d, %r9d
cmpl %esi, -0x4(%rdi,%r9)
jne 0xe71c6
orb $-0x80, 0x3(%rdi,%r9)
addq $0x18, %r9
cmpq %r9, %rdx
jne 0xe71b9
movl 0x4(%r8), %edx
movl 0x8(%r8), %esi
movq 0x8(%r13), %rdi
movq 0x28(%r13), %r10
xorl $0x1, %esi
movq (%r10,%rsi,8), %r8
movq %r8, %rsi
andq %rcx, %rsi
je 0xe7226
shrq $0x20, %r8
shlq $0x3, %rsi
leaq (%rsi,%rsi,2), %rsi
leaq (%r8,%r8,2), %r8
leaq (%rdi,%r8,8), %rdi
addq $0xc, %rdi
xorl %r8d, %r8d
movl -0x4(%rdi,%r8), %r9d
xorl %edx, %r9d
cmpl $0x1, %r9d
jne 0xe721d
orb $-0x80, 0x3(%rdi,%r8)
addq $0x18, %r8
cmpq %r8, %rsi
jne 0xe7209
incl %eax
cmpq %rax, 0x50(%rbp)
ja 0xe7142
movq 0x18(%rbp), %rax
movl (%rax), %r12d
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movl %r14d, 0xc(%rsp)
movq %r15, 0x28(%rsp)
movq %rbp, 0x20(%rsp)
movq (%rbp), %rax
movl %r12d, %ecx
leaq (%rcx,%rcx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rcx, %rdx
movl (%rax,%rdx), %ebx
movq 0x20(%r13), %rcx
movl %r12d, %eax
shrl %eax
andl $0x7fffffff, (%rcx,%rax,8) # imm = 0x7FFFFFFF
movq 0x18(%r15), %rcx
movq 0x28(%r13), %rdx
movq (%rdx,%rbx,8), %rsi
movq %rsi, %rdi
andq %r10, %rdi
je 0xe72ba
movq 0x8(%r13), %rdx
shrq $0x20, %rsi
shlq $0x3, %rdi
leaq (%rdi,%rdi,2), %rdi
leaq (%rsi,%rsi,2), %rsi
leaq (%rdx,%rsi,8), %r9
addq $0xc, %r9
xorl %r8d, %r8d
cmpl %r12d, -0x4(%r9,%r8)
je 0xe739c
addq $0x18, %r8
cmpq %r8, %rdi
jne 0xe72a6
movq 0x28(%rcx), %rdx
movq (%rdx,%rbx,8), %rsi
movq %rsi, %rdi
andq %r10, %rdi
je 0xe772e
movq 0x8(%rcx), %rdx
shrq $0x20, %rsi
shlq $0x3, %rdi
leaq (%rdi,%rdi,2), %r8
leaq (%rsi,%rsi,2), %rdi
leaq (%rdx,%rdi,8), %r9
addq $0xc, %r9
xorl %esi, %esi
cmpl %r12d, -0x4(%r9,%rsi)
je 0xe7301
addq $0x18, %rsi
cmpq %rsi, %r8
jne 0xe72ec
jmp 0xe772e
leaq (%rdx,%rdi,8), %rdx
andb $0x7f, 0xf(%rsi,%rdx)
movq 0x28(%r13), %rdi
movq (%rdi,%rbx,8), %rdi
movq %rdi, %r8
andq %r10, %r8
je 0xe77c9
addq %rsi, %rdx
movq 0x8(%r13), %r9
movq %rdi, %rsi
shrq $0x20, %rsi
leaq (%rsi,%rsi,2), %r10
leaq (%r9,%r10,8), %rsi
leaq (,%r8,8), %r11
leaq (%r11,%r11,2), %r11
xorl %r15d, %r15d
cmpl $0x0, 0xc(%rsi,%r15)
jns 0xe774d
addq $0x18, %r15
cmpq %r15, %r11
jne 0xe7343
movq (%rdx), %r11
cmpq %r11, (%rsi)
jae 0xe738f
leaq (%r9,%r10,8), %r15
addq $0x18, %r15
movl $0x1, %r9d
movq %r9, %r10
cmpq %r9, %r8
je 0xe7406
leaq 0x1(%r10), %r9
leaq 0x18(%r15), %rbp
cmpq %r11, (%r15)
movq %rbp, %r15
jb 0xe736e
decq %r9
jmp 0xe7409
xorl %edi, %edi
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
jmp 0xe7420
leaq (%rdx,%rsi,8), %rax
andb $0x7f, 0xf(%r8,%rax)
xorl $0x1, %r12d
movq 0x28(%r13), %rax
movq (%rax,%r12,8), %rcx
movq %rcx, %rdx
andq %r10, %rdx
je 0xe77aa
movq 0x8(%r13), %rax
shrq $0x20, %rcx
shlq $0x3, %rdx
leaq (%rdx,%rdx,2), %rdx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
addq $0xc, %rdi
xorl %esi, %esi
movl -0x4(%rdi,%rsi), %r8d
xorl %ebx, %r8d
cmpl $0x1, %r8d
je 0xe73f8
addq $0x18, %rsi
cmpq %rsi, %rdx
jne 0xe73dc
jmp 0xe77aa
leaq (%rax,%rcx,8), %rax
andb $0x7f, 0xf(%rsi,%rax)
jmp 0xe770e
movq %rdi, %r9
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
addl %r11d, %edi
cmpq %r8, %r10
cmovbq %r9, %rdi
movl %edi, %edi
movl 0xc(%rsp), %r14d
leaq (%rdi,%rdi,2), %rdi
movq 0x10(%rdx), %r8
movq %r8, 0x10(%rsi,%rdi,8)
movups (%rdx), %xmm0
movups %xmm0, (%rsi,%rdi,8)
movl %r12d, %edx
xorl $0x1, %edx
movq 0x28(%rcx), %rsi
movq (%rsi,%rdx,8), %rsi
movq %rsi, %rdi
andq %r11, %rdi
je 0xe776c
movq 0x8(%rcx), %rcx
shrq $0x20, %rsi
shlq $0x3, %rdi
leaq (%rdi,%rdi,2), %rdi
leaq (%rsi,%rsi,2), %rsi
leaq (%rcx,%rsi,8), %r9
addq $0xc, %r9
xorl %r8d, %r8d
movl -0x4(%r9,%r8), %r10d
xorl %ebx, %r10d
cmpl $0x1, %r10d
je 0xe7489
addq $0x18, %r8
cmpq %r8, %rdi
jne 0xe746d
jmp 0xe776c
leaq (%rcx,%rsi,8), %rcx
andb $0x7f, 0xf(%r8,%rcx)
movq 0x28(%r13), %rsi
movq (%rsi,%rdx,8), %rsi
movq %rsi, %rdi
andq %r11, %rdi
je 0xe77e8
addq %r8, %rcx
movq 0x8(%r13), %r8
movq %rsi, %rdx
shrq $0x20, %rdx
leaq (%rdx,%rdx,2), %r9
leaq (%r8,%r9,8), %rdx
leaq (,%rdi,8), %r10
leaq (%r10,%r10,2), %r10
xorl %r11d, %r11d
cmpl $0x0, 0xc(%rdx,%r11)
jns 0xe778b
addq $0x18, %r11
cmpq %r11, %r10
jne 0xe74cc
movq (%rcx), %r10
cmpq %r10, (%rdx)
jae 0xe7514
leaq (%r8,%r9,8), %r11
addq $0x18, %r11
movl $0x1, %r8d
movq %r8, %r9
cmpq %r8, %rdi
je 0xe7518
leaq 0x1(%r9), %r8
leaq 0x18(%r11), %r15
cmpq %r10, (%r11)
movq %r15, %r11
jb 0xe74f7
decq %r8
jmp 0xe751b
xorl %esi, %esi
jmp 0xe752d
movq %rsi, %r8
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
addl %r10d, %esi
cmpq %rdi, %r9
cmovbq %r8, %rsi
movl %esi, %esi
leaq (%rsi,%rsi,2), %rsi
movq 0x10(%rcx), %rdi
movq %rdi, 0x10(%rdx,%rsi,8)
movups (%rcx), %xmm0
movups %xmm0, (%rdx,%rsi,8)
movl %ebx, %edx
shrl %edx
movq 0x10(%rsp), %rcx
movq 0x10(%rcx), %rcx
leaq (%rdx,%rdx,4), %rdx
testb $0x1, %bl
jne 0xe7569
movq 0x18(%rcx,%rdx,8), %rsi
movl 0x10(%rcx,%rdx,8), %edx
decl %edx
movl 0x4(%rsi,%rdx,8), %r15d
jmp 0xe7576
movq 0x18(%rcx,%rdx,8), %rdx
movl 0x4(%rdx), %r15d
xorl $0x1, %r15d
leaq (%rax,%rax,4), %rax
testb $0x1, %r12b
jne 0xe758b
movq 0x18(%rcx,%rax,8), %rax
movl 0x4(%rax), %r12d
jmp 0xe759f
movq 0x18(%rcx,%rax,8), %rdx
movl 0x10(%rcx,%rax,8), %eax
decl %eax
movl 0x4(%rdx,%rax,8), %r12d
xorl $0x1, %r12d
movq 0xb0(%rsp), %rdi
movq 0xb8(%rsp), %rsi
movl 0xc0(%rsp), %ecx
movl 0xc8(%rsp), %r8d
movl %r15d, %r9d
leaq 0x30(%rsp), %rax
pushq %rax
pushq %r12
callq 0xb3df3
addq $0x10, %rsp
testl %eax, %eax
je 0xe7807
movq 0xa8(%rsp), %rsi
movq (%rsi), %rcx
cmpq 0x8(%rsi), %rcx
jne 0xe7624
movl %r14d, %ebp
leaq (%rcx,%rcx), %rax
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rax
movq %rax, 0x8(%rsi)
movq 0x10(%rsi), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2370
movq 0xa8(%rsp), %rsi
movq %rax, 0x10(%rsi)
movq (%rsi), %rcx
jmp 0xe762b
movl %r14d, %ebp
movq 0x10(%rsi), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, (%rsi)
leaq (%rcx,%rcx,2), %rcx
movq 0x40(%rsp), %rdx
movq %rdx, 0x10(%rax,%rcx,8)
movups 0x30(%rsp), %xmm0
movups %xmm0, (%rax,%rcx,8)
xorl $0x1, %r12d
xorl $0x1, %r15d
movq 0xb0(%rsp), %rdi
movq %rsi, %r14
movq 0xb8(%rsp), %rsi
movl 0xc0(%rsp), %ecx
movl 0xc8(%rsp), %r8d
movl %r12d, %r9d
leaq 0x30(%rsp), %rax
pushq %rax
pushq %r15
callq 0xb3df3
addq $0x10, %rsp
testl %eax, %eax
je 0xe7826
movq (%r14), %rcx
movq 0x10(%r14), %rax
cmpq 0x8(%r14), %rcx
movq 0x28(%rsp), %r15
movq %r14, %rsi
jne 0xe76d7
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rdx
movq %rdx, 0x8(%rsi)
shlq $0x3, %rdx
leaq (%rdx,%rdx,2), %rsi
movq %rax, %rdi
callq 0x2370
movq 0xa8(%rsp), %rsi
movq %rax, 0x10(%rsi)
movq (%rsi), %rcx
movl %ebp, %r14d
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
leaq 0x1(%rcx), %rdx
movq %rdx, (%rsi)
leaq (%rcx,%rcx,2), %rcx
movq 0x40(%rsp), %rdx
movq %rdx, 0x10(%rax,%rcx,8)
movups 0x30(%rsp), %xmm0
movups %xmm0, (%rax,%rcx,8)
movq 0xd8(%rsp), %rax
addl $0x2, (%rax)
movq 0x20(%rsp), %rbp
movl %ebx, %r12d
cmpl %r14d, %ebx
jne 0xe724e
movq 0x18(%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x15f512(%rip), %rdi    # 0x246c47
leaq 0x14e755(%rip), %rsi    # 0x235e91
leaq 0x151b0b(%rip), %rcx    # 0x23924e
movl $0x67a0, %edx           # imm = 0x67A0
callq 0x2110
leaq 0x151b99(%rip), %rdi    # 0x2392ed
leaq 0x14e736(%rip), %rsi    # 0x235e91
leaq 0x151aec(%rip), %rcx    # 0x23924e
movl $0x67a3, %edx           # imm = 0x67A3
callq 0x2110
leaq 0x15f4d4(%rip), %rdi    # 0x246c47
leaq 0x14e717(%rip), %rsi    # 0x235e91
leaq 0x151acd(%rip), %rcx    # 0x23924e
movl $0x67ae, %edx           # imm = 0x67AE
callq 0x2110
leaq 0x151b5b(%rip), %rdi    # 0x2392ed
leaq 0x14e6f8(%rip), %rsi    # 0x235e91
leaq 0x151aae(%rip), %rcx    # 0x23924e
movl $0x67b1, %edx           # imm = 0x67B1
callq 0x2110
leaq 0x14eaed(%rip), %rdi    # 0x23629e
leaq 0x14e6d9(%rip), %rsi    # 0x235e91
leaq 0x151a8f(%rip), %rcx    # 0x23924e
movl $0x6793, %edx           # imm = 0x6793
callq 0x2110
leaq 0x14ead2(%rip), %rdi    # 0x2362a2
leaq 0x14e6ba(%rip), %rsi    # 0x235e91
leaq 0x151a70(%rip), %rcx    # 0x23924e
movl $0x67a2, %edx           # imm = 0x67A2
callq 0x2110
leaq 0x14eab3(%rip), %rdi    # 0x2362a2
leaq 0x14e69b(%rip), %rsi    # 0x235e91
leaq 0x151a51(%rip), %rcx    # 0x23924e
movl $0x67b0, %edx           # imm = 0x67B0
callq 0x2110
leaq 0x151ae9(%rip), %rdi    # 0x2392f7
leaq 0x14e67c(%rip), %rsi    # 0x235e91
leaq 0x151a32(%rip), %rcx    # 0x23924e
movl $0x67b8, %edx           # imm = 0x67B8
callq 0x2110
leaq 0x151b11(%rip), %rdi    # 0x23933e
leaq 0x14e65d(%rip), %rsi    # 0x235e91
leaq 0x151a13(%rip), %rcx    # 0x23924e
movl $0x67bb, %edx           # imm = 0x67BB
callq 0x2110
leaq 0x15084c(%rip), %rdi    # 0x238098
jmp 0xe7855
leaq 0x150934(%rip), %rdi    # 0x238189
leaq 0x14e635(%rip), %rsi    # 0x235e91
leaq 0x15083c(%rip), %rcx    # 0x23809f
movl $0x67c7, %edx           # imm = 0x67C7
callq 0x2110