// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: update_bubble_graph(kvec_t_u32_warp*, unsigned int, unsigned int, unsigned int, unsigned int, bubble_type*, kvec_asg_arc_t_warp*, asg_t*, asg_arc_t*, unsigned char*, ma_ug_t*, unsigned long*, unsigned long)
void update_bubble_graph(kvec_t_u32_warp* broken, uint32_t beg, uint32_t beg_bub_id, 
uint32_t sink, uint32_t sink_bub_id, bubble_type* bub, kvec_asg_arc_t_warp* edges, asg_t *bsg, 
asg_arc_t *p_t, uint8_t *bsg_idx, ma_ug_t *unitig_ug, uint64_t* occ_thres, uint64_t is_b_bub)
{
    uint32_t i, pre, n, bub_id, v;
    uint64_t occ;
    asg_arc_t t_f, t_r;
    
    radix_sort_u32(broken->a.a, broken->a.a + broken->a.n);
    for (i = n = occ = 0, pre = (uint32_t)-1; i < broken->a.n; i++)
    {
        if((broken->a.a[i]>>1) == (pre>>1)) continue;
        if(IF_HOM((broken->a.a[i]>>1), *bub))
        {
            if(is_local_simple_circle(unitig_ug->g, broken->a.a[i]))
            {
                bub->index[broken->a.a[i]>>1] = bub->f_bub+1;
            }
            else
            {
                continue;
            }
        }
         
        pre = broken->a.a[i];
        broken->a.a[n] = pre;
        occ += unitig_ug->u.a[broken->a.a[n]>>1].n;
        n++;
    }
    broken->a.n = n;
    ///if(broken->a.n == 0) return;
    if(broken->a.n == 1)
    {
        ///fprintf(stderr, "+++++sb+++++utg%.6ul\n", (broken->a.a[0]>>1)+1);
        if(beg != (uint32_t)-1 && sink != (uint32_t)-1 && 
                            is_simple_broken_bubble(unitig_ug, broken->a.a[0], beg, sink, &v))
        {
            if((v>>1) != (broken->a.a[0]>>1))
            {
                ///fprintf(stderr, "-----sb-----utg%.6ul\n", (v>>1)+1);
                kv_push(uint32_t, broken->a, v);
                occ += unitig_ug->u.a[v>>1].n;
                if(occ_thres && occ > (*occ_thres)) return;
                bub->index[v>>1] = bub->f_bub+1; ///set to het
            }
        }
    } 
    
    
    if(occ_thres && occ > (*occ_thres)) return;
    /********************push graph node********************/
    bub_id = bub->b_g->n_seq;
    asg_seq_set(bub->b_g, bub_id, 0, 0);
    bub->b_g->seq[bub_id].c = HAP_LABLE;
    if(is_b_bub) bub->b_bub++;
    /********************push graph node********************/

    /********************push bubble********************/
    kv_push(uint32_t, bub->num, bub->list.n);
    kv_push(uint64_t, bub->pathLen, 0);
    kv_push(uint32_t, bub->list, beg);
    kv_push(uint32_t, bub->list, sink);

    for (i = 0; i < broken->a.n; i++)
    {
        kv_push(uint32_t, bub->list, broken->a.a[i]);
        if(bsg_idx) bsg_idx[broken->a.a[i]>>1] = 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r9, 0x30(%rsp)
movl %ecx, 0x14(%rsp)
movl %esi, 0x24(%rsp)
movq %rdi, %rbx
movl %edx, 0x2c(%rsp)
movl %r8d, 0x28(%rsp)
movq (%rdi), %rax
movq 0x10(%rdi), %rdi
leaq (%rdi,%rax,4), %rsi
callq 0x131a70
movq %rbx, %r9
movq (%rbx), %r10
testq %r10, %r10
movq %rbx, 0x18(%rsp)
je 0x145e04
movq 0x10(%r9), %r12
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorl %r15d, %r15d
xorl %r8d, %r8d
xorl %edx, %edx
movq 0xe0(%rsp), %rdi
movq %r10, 0x70(%rsp)
movl (%r12,%r15,4), %esi
movl %esi, %r13d
shrl %r13d
movl %ebp, %eax
shrl %eax
cmpl %eax, %r13d
je 0x145dd2
movq 0x30(%rsp), %rax
movq (%rax), %r14
movq 0x80(%rax), %rbx
movl (%r14,%r13,4), %eax
leaq 0x1(%rbx), %rcx
cmpq %rax, %rcx
jae 0x145db3
movq %rdx, 0x78(%rsp)
movq %r8, 0x80(%rsp)
movq 0x18(%rdi), %rdi
callq 0x145c33
testl %eax, %eax
je 0x145de3
incl %ebx
movl %ebx, (%r14,%r13,4)
movq 0x18(%rsp), %r9
movq 0x80(%rsp), %r8
movq 0xe0(%rsp), %rdi
movq 0x78(%rsp), %rdx
movq 0x70(%rsp), %r10
movl (%r12,%r15,4), %ebp
movl %edx, %eax
movl %ebp, (%r12,%rax,4)
movq 0x10(%rdi), %rax
movl %ebp, %ecx
shrl %ecx
leaq (%rcx,%rcx,4), %rcx
movl 0x10(%rax,%rcx,8), %eax
addq %rax, %r8
incl %edx
incq %r15
movl %r15d, %eax
cmpq %rax, %r10
ja 0x145d45
jmp 0x145e11
movq 0x18(%rsp), %r9
movq 0x80(%rsp), %r8
movq 0xe0(%rsp), %rdi
movq 0x78(%rsp), %rdx
movq 0x70(%rsp), %r10
jmp 0x145dd2
xorl %edx, %edx
xorl %r8d, %r8d
movq 0xe0(%rsp), %rdi
movq 0xe8(%rsp), %r13
movl %edx, %r12d
movq %r12, (%r9)
cmpl $0x1, %edx
jne 0x145f03
movl 0x24(%rsp), %edx
cmpl $-0x1, %edx
sete %al
movl 0x14(%rsp), %ebp
cmpl $-0x1, %ebp
sete %cl
orb %al, %cl
jne 0x145f07
movq %r8, %r14
movq 0x10(%r9), %r15
movl (%r15), %ebx
leaq 0x6c(%rsp), %r8
movl %ebx, %esi
movl %ebp, %ecx
callq 0x14576c
testl %eax, %eax
je 0x1463fd
movq %r15, %rdi
movl 0x6c(%rsp), %r15d
xorl %r15d, %ebx
cmpl $0x2, %ebx
movq %r14, %r8
jb 0x145f07
movq 0x18(%rsp), %r9
movq 0x8(%r9), %rax
cmpq %r12, %rax
jne 0x145eb2
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %esi
cmovneq %rcx, %rsi
movq %rsi, 0x8(%r9)
shlq $0x2, %rsi
callq 0x2370
movq %r14, %r8
movq 0x18(%rsp), %r9
movq %rax, 0x10(%r9)
movq (%r9), %rax
movq 0x10(%r9), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r9)
movl %r15d, (%rcx,%rax,4)
movq 0xe0(%rsp), %rax
movq 0x10(%rax), %rax
shrl %r15d
leaq (%r15,%r15,4), %rcx
movl 0x10(%rax,%rcx,8), %eax
addq %rax, %r8
testq %r13, %r13
je 0x145eed
cmpq (%r13), %r8
ja 0x1463eb
movq 0x30(%rsp), %rcx
movl 0x80(%rcx), %eax
incl %eax
movq (%rcx), %rcx
movl %eax, (%rcx,%r15,4)
jmp 0x145f07
movl 0x14(%rsp), %ebp
testq %r13, %r13
je 0x145f16
cmpq (%r13), %r8
ja 0x1463eb
movq 0xf0(%rsp), %rbx
movq 0x30(%rsp), %r13
movq 0xb8(%r13), %rdi
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andl 0x14(%rdi), %esi
movl %esi, 0x10(%rsp)
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xa0115
movq 0xb8(%r13), %rax
movq 0x20(%rax), %rax
movl 0x10(%rsp), %ecx
movb $0x2, 0x4(%rax,%rcx,8)
testq %rbx, %rbx
je 0x145f5f
incq 0x88(%r13)
movq 0x38(%r13), %rax
cmpq %rax, 0x30(%r13)
movl 0x24(%rsp), %r14d
jne 0x145f93
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %esi
cmovneq %rcx, %rsi
movq %rsi, 0x38(%r13)
movq 0x40(%r13), %rdi
shlq $0x2, %rsi
callq 0x2370
movq %rax, 0x40(%r13)
movl 0x18(%r13), %eax
movq 0x40(%r13), %rcx
movq 0x30(%r13), %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, 0x30(%r13)
movl %eax, (%rcx,%rdx,4)
movq 0x50(%r13), %rax
cmpq %rax, 0x48(%r13)
jne 0x145fd9
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %esi
cmovneq %rcx, %rsi
movq %rsi, 0x50(%r13)
movq 0x58(%r13), %rdi
shlq $0x3, %rsi
callq 0x2370
movq %rax, 0x58(%r13)
movq 0x48(%r13), %rax
movq 0x58(%r13), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0x48(%r13)
movq $0x0, (%rcx,%rax,8)
movq 0x20(%r13), %rax
cmpq %rax, 0x18(%r13)
jne 0x146020
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %esi
cmovneq %rcx, %rsi
movq %rsi, 0x20(%r13)
movq 0x28(%r13), %rdi
shlq $0x2, %rsi
callq 0x2370
movq %rax, 0x28(%r13)
movq 0x18(%r13), %rax
movq 0x28(%r13), %rdi
leaq 0x1(%rax), %rcx
movq %rcx, 0x18(%r13)
movl %r14d, (%rdi,%rax,4)
movq 0x20(%r13), %rax
cmpq %rax, %rcx
jne 0x14605e
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %esi
cmovneq %rcx, %rsi
movq %rsi, 0x20(%r13)
shlq $0x2, %rsi
callq 0x2370
movq %rax, 0x28(%r13)
movq 0x18(%r13), %rax
movq 0x28(%r13), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0x18(%r13)
movl %ebp, (%rcx,%rax,4)
movq 0x18(%rsp), %r8
cmpq $0x0, (%r8)
je 0x1460f5
movq 0xd8(%rsp), %rbx
movl $0x1, %ebp
xorl %r12d, %r12d
movl $0x2, %r15d
movq 0x20(%r13), %rax
cmpq %rax, 0x18(%r13)
jne 0x1460c1
leaq (%rax,%rax), %rsi
testq %rax, %rax
cmoveq %r15, %rsi
movq %rsi, 0x20(%r13)
movq 0x28(%r13), %rdi
shlq $0x2, %rsi
callq 0x2370
movq 0x18(%rsp), %r8
movq %rax, 0x28(%r13)
movq 0x18(%r13), %rcx
movq 0x28(%r13), %rdx
leaq 0x1(%rcx), %rsi
movq 0x10(%r8), %rax
movl (%rax,%r12,4), %edi
movq %rsi, 0x18(%r13)
movl %edi, (%rdx,%rcx,4)
testq %rbx, %rbx
je 0x1460eb
movl (%rax,%r12,4), %eax
shrl %eax
movb $0x1, (%rbx,%rax)
movl %ebp, %r12d
incl %ebp
cmpq %r12, (%r8)
ja 0x146092
movq 0xc0(%rsp), %rbx
cmpl $-0x1, %r14d
movl 0x14(%rsp), %ebp
je 0x14623c
movl %r14d, %r15d
xorl $0x1, %r15d
movl 0xb0(%r13), %eax
movl %eax, (%rsp)
leaq 0x2c(%rsp), %rdx
leaq 0x10(%rsp), %r8
leaq 0x50(%rsp), %r9
movq %r13, %rdi
movl %r14d, %esi
movl %r15d, %ecx
callq 0x144774
testl %eax, %eax
je 0x14623c
movl 0xb0(%r13), %eax
movl %eax, (%rsp)
leaq 0x10(%rsp), %rdx
leaq 0x2c(%rsp), %r8
leaq 0x38(%rsp), %r9
movq %r13, %rdi
movl %r15d, %esi
movl %r14d, %ecx
callq 0x144774
testl %eax, %eax
je 0x14623c
movb $0x0, 0x62(%rsp)
andb $0x7f, 0x61(%rsp)
andb $0x7f, 0x5f(%rsp)
movq 0x8(%rbx), %rax
cmpq %rax, (%rbx)
jne 0x1461b1
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmovneq %rcx, %rax
movq %rax, 0x8(%rbx)
movq 0x10(%rbx), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rbx)
leaq (%rax,%rax,2), %rax
movq 0x60(%rsp), %rdx
movq %rdx, 0x10(%rcx,%rax,8)
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rcx,%rax,8)
movb $0x0, 0x4a(%rsp)
andb $0x7f, 0x49(%rsp)
andb $0x7f, 0x47(%rsp)
movq 0x8(%rbx), %rax
cmpq %rax, (%rbx)
jne 0x146217
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmovneq %rcx, %rax
movq %rax, 0x8(%rbx)
movq 0x10(%rbx), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rbx)
leaq (%rax,%rax,2), %rax
movq 0x48(%rsp), %rdx
movq %rdx, 0x10(%rcx,%rax,8)
movups 0x38(%rsp), %xmm0
movups %xmm0, (%rcx,%rax,8)
cmpl $-0x1, %ebp
je 0x146374
movl %ebp, %r15d
xorl $0x1, %r15d
movl 0xb0(%r13), %eax
movl %eax, (%rsp)
leaq 0x10(%rsp), %rdx
leaq 0x28(%rsp), %r8
leaq 0x50(%rsp), %r9
movq %r13, %rdi
movl %r15d, %esi
movl %ebp, %ecx
callq 0x144774
testl %eax, %eax
je 0x146374
movl 0xb0(%r13), %eax
movl %eax, (%rsp)
leaq 0x28(%rsp), %rdx
leaq 0x10(%rsp), %r8
leaq 0x38(%rsp), %r9
movq %r13, %rdi
movl %ebp, %esi
movl %r15d, %ecx
callq 0x144774
testl %eax, %eax
je 0x146374
movb $0x0, 0x62(%rsp)
andb $0x7f, 0x61(%rsp)
andb $0x7f, 0x5f(%rsp)
movq 0x8(%rbx), %rax
cmpq %rax, (%rbx)
jne 0x1462e9
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmovneq %rcx, %rax
movq %rax, 0x8(%rbx)
movq 0x10(%rbx), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rbx)
leaq (%rax,%rax,2), %rax
movq 0x60(%rsp), %rdx
movq %rdx, 0x10(%rcx,%rax,8)
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rcx,%rax,8)
movb $0x0, 0x4a(%rsp)
andb $0x7f, 0x49(%rsp)
andb $0x7f, 0x47(%rsp)
movq 0x8(%rbx), %rax
cmpq %rax, (%rbx)
jne 0x14634f
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmovneq %rcx, %rax
movq %rax, 0x8(%rbx)
movq 0x10(%rbx), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rbx)
leaq (%rax,%rax,2), %rax
movq 0x48(%rsp), %rdx
movq %rdx, 0x10(%rcx,%rax,8)
movups 0x38(%rsp), %xmm0
movups %xmm0, (%rcx,%rax,8)
cmpl $-0x1, %r14d
je 0x1463eb
cmpl $-0x1, %ebp
je 0x1463eb
movq 0xd0(%rsp), %rax
testq %rax, %rax
je 0x1463eb
orb $-0x80, 0xf(%rax)
movq 0xc8(%rsp), %rcx
movl 0x8(%rax), %edx
xorq $0x1, %rdx
movq 0x28(%rcx), %rsi
movq (%rsi,%rdx,8), %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
andq %rdx, %rsi
je 0x1463eb
movl 0x4(%rax), %eax
movq 0x8(%rcx), %rdi
shrq $0x20, %rdx
shlq $0x3, %rsi
leaq (%rsi,%rsi,2), %rcx
leaq (%rdx,%rdx,2), %rdx
leaq (%rdi,%rdx,8), %rdx
addq $0xc, %rdx
xorl %esi, %esi
movl -0x4(%rdx,%rsi), %edi
xorl %eax, %edi
cmpl $0x1, %edi
jne 0x1463e2
orb $-0x80, 0x3(%rdx,%rsi)
addq $0x18, %rsi
cmpq %rsi, %rcx
jne 0x1463d2
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %r8
jmp 0x145f07