LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: is_simple_broken_bubble(ma_ug_t*, unsigned int, unsigned int, unsigned int, unsigned int*)
int is_simple_broken_bubble(ma_ug_t *unitig_ug, uint32_t x, uint32_t beg, uint32_t sink, uint32_t* new_het)
{
    uint32_t nv, v = (uint32_t)-1, u_s = (uint32_t)-1, u_e = (uint32_t)-1, i;
    asg_arc_t *av = NULL;
    (*new_het) = (uint32_t)-1;

    if((asg_arc_n(unitig_ug->g, x) == 1) 
                        && (asg_arc_n(unitig_ug->g, x^1) == 0))
    {
        v = x;
    }

    if((asg_arc_n(unitig_ug->g, x^1) == 1) 
                        && (asg_arc_n(unitig_ug->g, x) == 0))
    {
        v = x^1;
    }

    if(v == (uint32_t)-1) return 0;

    
    av = asg_arc_a(unitig_ug->g, v);
    nv = asg_arc_n(unitig_ug->g, v);
    for (i = 0; i < nv; i++)
    {
        if(av[i].del) continue;
        if((av[i].v>>1) == (beg>>1)) u_s = beg, u_e = sink;
        if((av[i].v>>1) == (sink>>1)) u_s = sink, u_e = beg;
    }

    if(u_s == (uint32_t)-1 || u_e == (uint32_t)-1) return 0;

    av = asg_arc_a(unitig_ug->g, u_s);
    nv = asg_arc_n(unitig_ug->g, u_s);
    if(nv != 2) return 0;
    for (i = 0; i < nv; i++)
    {
        if(av[i].del) continue;
        if(av[i].v == (v^1)) continue;
        if(av[i].v == (u_e^1))
        {
            (*new_het) = u_e;
            return 1;
        }
    }

    return 0;
}

// Assembly:
orl $-0x1, (%r8)
movq 0x18(%rdi), %rax
movq 0x28(%rax), %r9
movl %esi, %edi
movl (%r9,%rdi,8), %r10d
movl %esi, %edi
xorl $0x1, %edi
cmpq $0x1, %r10
jne 0x103f2f
xorl %r11d, %r11d
cmpl (%r9,%rdi,8), %r11d
sbbl %r11d, %r11d
orl %esi, %r11d
jmp 0x103f35
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
movl (%r9,%rdi,8), %esi
xorq $0x1, %rsi
orq %rsi, %r10
cmovnel %r11d, %edi
cmpl $-0x1, %edi
je 0x104012
movq 0x8(%rax), %rsi
movl %edi, %eax
movq (%r9,%rax,8), %rax
movl %eax, %r10d
movq %rax, %r11
shrq $0x20, %r11
imulq $0x18, %r10, %rax
imulq $0x18, %r11, %r10
leaq (%r10,%rsi), %rbx
addq $0xc, %rbx
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
xorl %r14d, %r14d
movl %r11d, %r10d
cmpq %r14, %rax
je 0x103fb9
cmpl $0x0, (%rbx,%r14)
js 0x103fb3
movl -0x4(%rbx,%r14), %ebp
movl %ebp, %r15d
xorl %edx, %r15d
cmpl $0x2, %r15d
cmovbl %edx, %r11d
cmovbl %ecx, %r10d
xorl %ecx, %ebp
cmpl $0x2, %ebp
cmovbl %ecx, %r11d
cmovbl %edx, %r10d
addq $0x18, %r14
jmp 0x103f83
xorl %eax, %eax
cmpl $-0x1, %r11d
je 0x104014
cmpl $-0x1, %r10d
je 0x104014
movl %r11d, %ecx
movq (%r9,%rcx,8), %rcx
cmpl $0x2, %ecx
jne 0x104014
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rsi
movabsq $0xc, %rcx
cmpq $0x3c, %rcx
je 0x104014
cmpl $0x0, (%rsi,%rcx)
js 0x10400c
movl -0x4(%rsi,%rcx), %edx
movl %edx, %r9d
xorl %edi, %r9d
cmpl $0x1, %r9d
je 0x10400c
xorl %r10d, %edx
cmpl $0x1, %edx
je 0x10401b
addq $0x18, %rcx
jmp 0x103fe8
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %r10d, (%r8)
movl $0x1, %eax
jmp 0x104014
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: is_local_simple_circle(asg_t*, unsigned int)
int is_local_simple_circle(asg_t *g, uint32_t v)
{
    if(asg_arc_n(g, v) != asg_arc_n(g, v^1)) return 0;
    if(asg_arc_n(g, v) == 1) v = arc_first(g, v).v;
    if(asg_arc_n(g, v) != asg_arc_n(g, v^1)) return 0;
    if(asg_arc_n(g, v) != 2) return 0;
    uint32_t ncur, i, u;
    asg_arc_t *acur = NULL;
    ncur = asg_arc_n(g, v);
    acur = asg_arc_a(g, v);
    for (i = 0; i < ncur; i++)
    {
        if(acur[i].del) continue;
        u = acur[i].v;
        if(asg_arc_n(g, u) != 1 || asg_arc_n(g, u^1) != 1) continue;
        if(arc_first(g, u).v != v) continue;
        return 1;
    }
    return 0;
}

// Assembly:
movq 0x28(%rdi), %rcx
movl %esi, %eax
movq (%rcx,%rax,8), %rdx
movl %esi, %r8d
xorl $0x1, %r8d
xorl %eax, %eax
cmpl (%rcx,%r8,8), %edx
jne 0x10441d
cmpl $0x1, %edx
jne 0x1043b8
movq 0x8(%rdi), %rsi
shrq $0x20, %rdx
imulq $0x18, %rdx, %rdx
movl 0x8(%rsi,%rdx), %esi
movq (%rcx,%rsi,8), %rdx
movq %rsi, %r8
xorq $0x1, %r8
cmpl $0x2, %edx
jne 0x10441d
movl (%rcx,%r8,8), %r8d
cmpl $0x2, %r8d
jne 0x10441d
movq 0x8(%rdi), %rdi
shrq $0x20, %rdx
imulq $0x18, %rdx, %rdx
addq %rdi, %rdx
pushq $0xc
popq %r9
pushq $0x1
popq %r8
cmpq $0x3c, %r9
je 0x10441d
cmpl $0x0, (%rdx,%r9)
js 0x104414
movl -0x4(%rdx,%r9), %r11d
movq (%rcx,%r11,8), %r10
cmpl $0x1, %r10d
jne 0x104414
xorq $0x1, %r11
cmpl $0x1, (%rcx,%r11,8)
jne 0x104414
shrq $0x20, %r10
imulq $0x18, %r10, %r10
cmpl %esi, 0x8(%rdi,%r10)
je 0x10441a
addq $0x18, %r9
jmp 0x1043de
movl %r8d, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: get_related_bub_nodes(kvec_t_u32_warp*, bubble_type*, pdq*, asg_t*, unsigned int*, unsigned int, unsigned int, unsigned char*)
void get_related_bub_nodes(kvec_t_u32_warp* broken, bubble_type* bub, pdq* pq, asg_t *unitig_g, 
                                        uint32_t *pre, uint32_t src, uint32_t dest, uint8_t *bsg_idx)
{
    uint32_t j_i, pre_id, adjecent;
    src ^= 1;
    get_shortest_path(src, pq, unitig_g, pre);
            
    for (j_i = 0; j_i < pq->dis.n; j_i++)
    {
        if(pq->dis.a[j_i] == (uint64_t)-1) continue;
        ///if(IF_HOM(j_i>>1, *bub)) continue;
        if((j_i>>1) == (src>>1)) continue;
        if((dest != (uint32_t)-1) && ((j_i>>1) == (dest>>1))) continue;

        pre_id = pre[j_i];
        adjecent = 0;
        while (pre_id != src)
        { 
            if(((dest != (uint32_t)-1) && ((pre_id>>1) == (dest>>1))) 
                                                || ((pre_id>>1) == (src>>1)))
            {
                adjecent = 1;
                break;
            }
            pre_id = pre[pre_id];
        }
        
        if(adjecent == 0)
        {
            if(broken->a.n == 0 || (broken->a.n > 0 && (j_i>>1) != (broken->a.a[broken->a.n - 1]>>1)))
            {
                if(bsg_idx && bsg_idx[(j_i>>1)])
                {
                    broken->a.n = 0;
                    return;
                }
                kv_push(uint32_t, broken->a, j_i);
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %ebx
movq %r8, %r14
movq %rdx, %r12
movq %rdi, %r15
movl 0x50(%rsp), %r13d
movl %r9d, %ebp
xorl $0x1, %ebp
movl %ebp, %edi
movq %rdx, %rsi
movq %rcx, %rdx
movq %r8, %rcx
callq 0xfa824
movq 0x58(%rsp), %r9
movq %r15, %r8
shrl %ebx
movl %r13d, %r10d
shrl %r10d
xorl %r15d, %r15d
movq %r8, 0x10(%rsp)
movl %r10d, 0xc(%rsp)
movl %r15d, %ecx
cmpq %rcx, 0x30(%r12)
jbe 0x104be6
movq 0x40(%r12), %rax
cmpq $-0x1, (%rax,%rcx,8)
je 0x104bda
cmpl $-0x1, %r13d
setne %dl
movl %r15d, %eax
shrl %eax
cmpl %r10d, %eax
sete %sil
cmpl %ebx, %eax
je 0x104bda
andb %sil, %dl
jne 0x104bda
movl (%r14,%rcx,4), %ecx
cmpl %ebp, %ecx
je 0x104b6f
cmpl $-0x1, %r13d
setne %dl
movl %ecx, %esi
xorl %r13d, %esi
cmpl $0x2, %esi
setb %sil
movl %ecx, %edi
shrl %edi
cmpl %ebx, %edi
jne 0x104b41
jmp 0x104bda
movq (%r8), %rcx
testq %rcx, %rcx
je 0x104b85
movq 0x10(%r8), %rdx
movl -0x4(%rdx,%rcx,4), %edx
shrl %edx
cmpl %edx, %eax
je 0x104bda
testq %r9, %r9
je 0x104b91
cmpb $0x0, (%r9,%rax)
jne 0x104be2
movq 0x10(%r8), %rax
cmpq 0x8(%r8), %rcx
jne 0x104bcf
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r8)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movl 0xc(%rsp), %r10d
movq 0x58(%rsp), %r9
movq 0x10(%rsp), %r8
movq %rax, 0x10(%r8)
movq (%r8), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%r8)
movl %r15d, (%rax,%rcx,4)
incl %r15d
jmp 0x104b08
andq $0x0, (%r8)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: calculate_chain_weight(ma_utg_t*, bubble_type*, ma_ug_t*, chain_w_type*)
uint64_t calculate_chain_weight(ma_utg_t *u, bubble_type* bub, ma_ug_t *unitig_ug, chain_w_type* x)
{
    x->b_occ = x->g_occ = 0;
    uint32_t i, j, *a, n;
    uint64_t occ, occ_n, thres;
    for (i = occ = occ_n = 0; i < u->n; i++)
    {
        if(bub->b_g->seq[u->a[i]>>33].c != HAP_LABLE)
        {
            get_bubbles(bub, u->a[i]>>33, NULL, NULL, &a, &n, NULL);
            for (j = 0; j < n; j++)
            {
                occ += unitig_ug->u.a[a[j]>>1].n;
            }
            occ_n++;
        }
    }

    thres = (uint64_t)-1;
    if(occ_n > 0) thres = (occ*6)/occ_n;

    for (i = 0; i < u->n; i++)
    {
        occ = 0;
        get_bubbles(bub, u->a[i]>>33, NULL, NULL, &a, &n, NULL);
        for (j = 0; j < n; j++)
        {
            occ += unitig_ug->u.a[a[j]>>1].n;
        }

        if(bub->b_g->seq[u->a[i]>>33].c != HAP_LABLE || occ < thres)
        {
            x->g_occ += occ;
        }
        else
        {
            x->b_occ += occ;
        }
    }

    return thres;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r8
xorps %xmm0, %xmm0
movq %rcx, -0x8(%rsp)
movups %xmm0, (%rcx)
movl 0x10(%rdi), %ecx
xorl %edx, %edx
xorl %eax, %eax
xorl %r10d, %r10d
cmpq %rcx, %rdx
je 0x104c87
movq 0xb8(%rsi), %r11
movq 0x20(%r11), %rbx
movq 0x18(%rdi), %r11
movq (%r11,%rdx,8), %r11
shrq $0x21, %r11
cmpb $0x2, 0x4(%rbx,%r11,8)
je 0x104c82
movq 0x28(%rsi), %rbx
movq 0x40(%rsi), %r14
movl (%r14,%r11,4), %r15d
movl 0x4(%r14,%r11,4), %r11d
leaq (%rbx,%r15,4), %rbx
addq $0x8, %rbx
subl %r15d, %r11d
addl $-0x2, %r11d
xorl %r14d, %r14d
cmpq %r14, %r11
je 0x104c7f
movq 0x10(%r8), %r15
movl (%rbx,%r14,4), %r12d
shrl %r12d
imulq $0x28, %r12, %r12
movl 0x10(%r15,%r12), %r15d
addq %r15, %rax
incq %r14
jmp 0x104c5e
incq %r10
incq %rdx
jmp 0x104c17
testq %r10, %r10
je 0x104c97
imulq $0x6, %rax, %rax
xorl %edx, %edx
divq %r10
jmp 0x104ca1
movabsq $-0x1, %rax
xorl %edx, %edx
xorl %r10d, %r10d
xorl %r11d, %r11d
cmpq %rcx, %r11
je 0x104d3e
movq 0x18(%rdi), %rbx
movq (%rbx,%r11,8), %rbx
shrq $0x21, %rbx
movq 0x28(%rsi), %r14
movq 0x40(%rsi), %r15
movl (%r15,%rbx,4), %r13d
movl 0x4(%r15,%rbx,4), %r15d
leaq (%r14,%r13,4), %r12
addq $0x8, %r12
subl %r13d, %r15d
addl $-0x2, %r15d
xorl %r13d, %r13d
xorl %r14d, %r14d
cmpq %r13, %r15
je 0x104d05
movq 0x10(%r8), %rbp
movl (%r12,%r13,4), %r9d
shrl %r9d
imulq $0x28, %r9, %r9
movl 0x10(%rbp,%r9), %r9d
addq %r9, %r14
incq %r13
jmp 0x104ce4
movq 0xb8(%rsi), %r9
movq 0x20(%r9), %r9
cmpb $0x2, 0x4(%r9,%rbx,8)
jne 0x104d2b
cmpq %rax, %r14
jb 0x104d2b
addq %r14, %r10
movq -0x8(%rsp), %r9
movq %r10, 0x8(%r9)
jmp 0x104d36
addq %r14, %rdx
movq -0x8(%rsp), %r9
movq %rdx, (%r9)
incq %r11
jmp 0x104ca9
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: get_btg_occ(bubble_type*, unsigned int)
uint32_t get_btg_occ(bubble_type* bub, uint32_t v)
{
    ma_ug_t *bub_ug = bub->b_ug;
    ma_utg_t *u = NULL;
    uint32_t k_i, k_j, *a = NULL, n, tan_occ = 0;

    u = &(bub_ug->u.a[v]);
    for (k_i = 0; k_i < u->n; k_i++)
    {
        get_bubbles(bub, u->a[k_i]>>33, NULL, NULL, &a, &n, NULL);
        for (k_j = 0; k_j < n; k_j++)
        {
            tan_occ += bub->ug->u.a[a[k_j]>>1].n;
        }
    }
    return tan_occ;
}

// Assembly:
pushq %rbx
movq 0xc0(%rdi), %rax
movq 0x10(%rax), %rax
movl %esi, %ecx
imulq $0x28, %rcx, %rdx
leaq (%rax,%rdx), %rcx
movl 0x10(%rax,%rdx), %edx
xorl %esi, %esi
xorl %eax, %eax
cmpq %rdx, %rsi
je 0x1053d3
movq 0x18(%rcx), %r8
movq (%r8,%rsi,8), %r8
movq 0x28(%rdi), %r9
movq 0x40(%rdi), %r10
shrq $0x21, %r8
movl (%r10,%r8,4), %r11d
movl 0x4(%r10,%r8,4), %r8d
leaq (%r9,%r11,4), %r9
addq $0x8, %r9
subl %r11d, %r8d
addl $-0x2, %r8d
xorl %r10d, %r10d
cmpq %r10, %r8
je 0x1053ce
movq 0x10(%rdi), %r11
movq 0x10(%r11), %r11
movl (%r9,%r10,4), %ebx
shrl %ebx
imulq $0x28, %rbx, %rbx
addl 0x10(%r11,%rbx), %eax
incq %r10
jmp 0x1053ad
incq %rsi
jmp 0x105379
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: get_utg_end_from_btg(bubble_type*, ma_ug_t*, unsigned int)
uint32_t get_utg_end_from_btg(bubble_type* bub, ma_ug_t *bub_ug, uint32_t v)
{
    ma_utg_t *u = &(bub_ug->u.a[v>>1]);
    
    if((v&1)==1)
    {
        return (u->a[0]>>32)^1;
    }
    else
    {
        return u->a[u->n-1]>>32;
    } 
}

// Assembly:
movq 0x10(%rsi), %rax
movl %edx, %ecx
shrl %ecx
imulq $0x28, %rcx, %rsi
movq 0x18(%rax,%rsi), %rcx
testb $0x1, %dl
jne 0x1062be
addq %rsi, %rax
movl 0x10(%rax), %eax
decl %eax
movl 0x4(%rcx,%rax,8), %eax
retq
movl 0x4(%rcx), %eax
xorl $0x1, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: debug_tangle_bubble(bubble_type*, long long, long long, char const*)
void debug_tangle_bubble(bubble_type* bub, long long beg_idx, long long end_idx, const char* command)
{
    // long long beg_idx = (long long)bub->b_g->n_seq - bub->tangle_bub;
    // long long end_idx = (long long)bub->b_g->n_seq - 1;
    long long i, j, k;
    ma_utg_t *u = NULL;
    uint32_t beg_utg, sink_utg, *a = NULL, n, btg_left, ori_left, btg_right, ori_right, root_0, root_1;
    for (i = beg_idx; i <= end_idx; i++)
    {
        get_bubbles(bub, i, &beg_utg, &sink_utg, &a, &n, NULL);
        fprintf(stderr, "\n(%lld) %s: beg=utg%.6ul, sink=utg%.6ul, n: %u\n", i, command, (beg_utg>>1)+1, (sink_utg>>1)+1, n);
        for (k = 0; k < n; k++)
        {
            fprintf(stderr, "mid=utg%.6ul\n", (a[k]>>1)+1);
        }
        
        for (j = 0; j < bub->b_ug->g->n_seq; j++)
        {
            u = &(bub->b_ug->u.a[j]);
            if(u->n) continue;
            for (k = 0; k < u->n; k++)
            {
                if((long long)(u->a[k]>>33) != i) continue;
                fprintf(stderr, "is the %lld-th bubble at btg%.6lldl\n", k, j+1);
                if(k > 0)
                {
                    btg_left = u->a[k-1]>>33;
                    ori_left = u->a[k-1]>>32&1;
                    get_bubbles(bub, btg_left, ori_left == 1?&root_0:NULL, ori_left == 0?&root_0:NULL, NULL, NULL, NULL);
                    fprintf(stderr, "left-utg%.6ul\n", (ori_left>>1)+1);
                }

                if(k + 1 < u->n)
                {
                    btg_right = u->a[k+1]>>33;
                    ori_right = (u->a[k+1]>>32&1)^1;
                    get_bubbles(bub, btg_right, ori_right == 1?&root_1:NULL, ori_right == 0?&root_1:NULL, NULL, NULL, NULL);
                    fprintf(stderr, "right-utg%.6ul\n", (ori_right>>1)+1);
                }
            }
        }
        
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %rbx
movq %rdx, %r14
leaq 0x20(%rsp), %rax
andq $0x0, (%rax)
movq %rsi, %r12
movq %rdi, %r13
movq 0x14caef(%rip), %r15    # 0x252fe0
cmpq %r14, %r12
jg 0x106587
andq $0x0, (%rsp)
movq %r13, %rdi
movq %r12, %rsi
leaq 0x1c(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0x20(%rsp), %r8
leaq 0x14(%rsp), %r9
callq 0xf6ab5
movq (%r15), %rdi
movl 0x1c(%rsp), %r8d
shrl %r8d
incl %r8d
movl 0x18(%rsp), %r9d
shrl %r9d
incl %r9d
movl 0x14(%rsp), %eax
movl %eax, (%rsp)
leaq 0xe77de(%rip), %rsi     # 0x1edd23
movq %r12, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x22b0
xorl %ebp, %ebp
jmp 0x106576
movq (%r15), %rdi
movq 0x20(%rsp), %rax
movl (%rax,%rbp,4), %edx
shrl %edx
incl %edx
leaq 0xe77e7(%rip), %rsi     # 0x1edd53
xorl %eax, %eax
callq 0x22b0
incq %rbp
movl 0x14(%rsp), %eax
cmpq %rax, %rbp
jb 0x106556
incq %r12
jmp 0x1064f1
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: print_b_utg_occ(bubble_type*, unsigned int)
uint32_t print_b_utg_occ(bubble_type* bub, uint32_t v)
{
    ma_ug_t *bub_ug = bub->b_ug;
    ma_utg_t *u = NULL;
    uint32_t k_i, k_j, *a = NULL, n, tan_occ = 0, beg, sink;

    
    u = &(bub_ug->u.a[v]);
    fprintf(stderr, "\nstart: %u-th bubble-utg-start (# bubbles: %u)\n", v, (uint32_t)u->n);
    for (k_i = 0; k_i < u->n; k_i++)
    {
        get_bubbles(bub, u->a[k_i]>>33, &beg, &sink, &a, &n, NULL);
        for (k_j = 0; k_j < n; k_j++)
        {
            tan_occ += bub->ug->u.a[a[k_j]>>1].n;
        }

        fprintf(stderr, "bid: %lu, n: %u, beg-utg%.6dl(%u), sink-utg%.6dl(%u)\n", u->a[k_i]>>33, n, (beg>>1)+1, beg&1, (sink>>1)+1, sink&1);
    }

    fprintf(stderr, "end: %u-th bubble-utg-end\n\n", v);
    return tan_occ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
movq 0xc0(%rdi), %rax
leaq 0x10(%rsp), %rcx
andq $0x0, (%rcx)
movl %esi, %edx
movq 0x10(%rax), %rax
movl %esi, %ecx
imulq $0x28, %rcx, %rcx
leaq (%rax,%rcx), %r12
movq 0x14ca12(%rip), %rsi    # 0x252fe0
movq (%rsi), %rdi
movl 0x10(%rax,%rcx), %ecx
leaq 0xe7785(%rip), %rsi     # 0x1edd61
movl %edx, (%rsp)
xorl %eax, %eax
callq 0x22b0
leaq 0xe77a4(%rip), %r15     # 0x1edd91
xorl %r13d, %r13d
xorl %ebp, %ebp
movl 0x10(%r12), %eax
cmpq %rax, %r13
jae 0x1066ab
movq 0x18(%r12), %rbx
movq (%rbx,%r13,8), %rsi
shrq $0x21, %rsi
subq $0x8, %rsp
movq %r14, %rdi
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rcx
leaq 0x18(%rsp), %r8
leaq 0x14(%rsp), %r9
pushq $0x0
callq 0xf6ab5
addq $0x10, %rsp
movl 0xc(%rsp), %ecx
movq 0x10(%rsp), %rax
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x10665d
movq 0x10(%r14), %rsi
movq 0x10(%rsi), %rsi
movl (%rax,%rdx,4), %edi
shrl %edi
imulq $0x28, %rdi, %rdi
addl 0x10(%rsi,%rdi), %ebp
incq %rdx
jmp 0x10663e
movq 0x14c97c(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
movq (%rbx,%r13,8), %rdx
shrq $0x21, %rdx
movl 0x8(%rsp), %r9d
movl %r9d, %r8d
shrl %r8d
incl %r8d
andl $0x1, %r9d
movl 0x4(%rsp), %r10d
movl %r10d, %r11d
shrl %r11d
incl %r11d
andl $0x1, %r10d
movq %r15, %rsi
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x22b0
popq %rcx
popq %rdx
incq %r13
jmp 0x1065f2
movq 0x14c92e(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0xe770b(%rip), %rsi     # 0x1eddc7
movl (%rsp), %edx
xorl %eax, %eax
callq 0x22b0
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: double_check_bub_branch(asg_arc_t*, ma_ug_t*, double*, unsigned int*, double, unsigned int)
int double_check_bub_branch(asg_arc_t *t, ma_ug_t *bs_ug, double *e_w, uint32_t *e_occ, double cutoff, uint32_t max_w_occ)
{
    uint32_t v = t->v^1, w = (t->ul>>32)^1, i, nv, rv, max_i, w_i, *a_occ = NULL;
    asg_arc_t *av = NULL;
    double *aw = NULL, max_w = cutoff - 1, w_w = 1;
    av = asg_arc_a(bs_ug->g, v);
    nv = asg_arc_n(bs_ug->g, v);
    aw = (&e_w[bs_ug->g->idx[v]>>32]);
    a_occ = (&e_occ[bs_ug->g->idx[v]>>32]);

    if(nv <= 1) return 1;

    for (i = rv = 0, max_i = w_i = (uint32_t)-1; i < nv; i++)
    {
        if(av[i].del) continue;
        rv++;
        if(av[i].v == w)
        {
            w_i = i;
            w_w = aw[i];
            continue;
        }
        if(max_i == (uint32_t)-1)
        {
            max_i = i;
            max_w = aw[i];
        }
        else if(max_w < aw[i])
        {
            max_i = i;
            max_w = aw[i];
        }
    }

    if(rv <= 1) return 1; ///must be here

    if(max_i == (uint32_t)-1 || w_i == (uint32_t)-1) return 0;
    ///if(max_w <= max_w_cutoff) return 0; //must be <=
    if(a_occ[max_i] <= max_w_occ) return 0; //must be <=
    
    if(w_w*cutoff < max_w) return 1;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl 0x8(%rdi), %eax
xorq $0x1, %rax
movq 0x18(%rsi), %r10
movq 0x28(%r10), %rsi
movq (%rsi,%rax,8), %r9
movl $0x1, %eax
testl $0xfffffffe, %r9d       # imm = 0xFFFFFFFE
je 0x108bbc
movl 0x4(%rdi), %esi
movq 0x8(%r10), %rdi
movq %r9, %r10
shrq $0x20, %r10
leaq (%rdx,%r10,8), %rdx
leaq (%rcx,%r10,4), %rcx
movsd 0xdaa5e(%rip), %xmm2    # 0x1e3580
addsd %xmm0, %xmm2
movl %r9d, %r9d
imulq $0x18, %r10, %r10
addq %rdi, %r10
addq $0xc, %r10
movsd 0xda764(%rip), %xmm1    # 0x1e32a0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
xorl %r11d, %r11d
xorl %ebx, %ebx
movl %edi, %ebp
cmpq %r11, %r9
je 0x108b8e
cmpl $0x0, (%r10)
js 0x108b85
incl %ebx
movl -0x4(%r10), %r14d
xorl %esi, %r14d
cmpl $0x1, %r14d
jne 0x108b6d
movsd (%rdx,%r11,8), %xmm1
movl %r11d, %ebp
jmp 0x108b85
movsd (%rdx,%r11,8), %xmm3
cmpl $-0x1, %edi
je 0x108b7e
ucomisd %xmm2, %xmm3
jbe 0x108b85
movl %r11d, %edi
movapd %xmm3, %xmm2
incq %r11
addq $0x18, %r10
jmp 0x108b48
cmpl $0x2, %ebx
jb 0x108bbc
cmpl $-0x1, %edi
sete %dl
cmpl $-0x1, %ebp
sete %sil
xorl %eax, %eax
orb %dl, %sil
jne 0x108bbc
movl %edi, %edx
cmpl %r8d, (%rcx,%rdx,4)
jbe 0x108bbc
mulsd %xmm0, %xmm1
xorl %eax, %eax
ucomisd %xmm1, %xmm2
seta %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: is_same_phase(unsigned long, unsigned long, H_partition*, signed char*, mc_gg_status*)
uint32_t is_same_phase(uint64_t bid, uint64_t eid, H_partition* hap, int8_t *s, mc_gg_status *sa)
{
    if(bid == eid) return 1;
    if(hap || s)
    {
        int beg_status, end_status;
        beg_status = (hap? get_phase_status(hap, bid):s[bid]);
        if(beg_status != 1 && beg_status != -1) return (uint32_t)-1;
        end_status = (hap? get_phase_status(hap, eid):s[eid]);
        if(end_status != 1 && end_status != -1) return (uint32_t)-1;
        if(beg_status == end_status) return 1;
        return 0;
    }

    if(sa)
    {
        if(sa[bid].s == 0 || sa[eid].s == 0) return (uint32_t)-1;
        return !!(sa[bid].s&sa[eid].s);
    }
    return (uint32_t)-1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
cmpq %rsi, %rdi
jne 0x10a9af
pushq $0x1
popq %rbx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rcx, %r12
movq %rdx, %r15
movq %rdi, %rsi
movq %rdx, %rax
orq %rcx, %rax
je 0x10a9d1
testq %r15, %r15
je 0x10a9fa
movq %r15, %rdi
callq 0x121555
movl %eax, %ebp
jmp 0x10a9ff
pushq $-0x1
popq %rbx
testq %r8, %r8
je 0x10a9a4
shlq $0x5, %rsi
movl (%r8,%rsi), %eax
testl %eax, %eax
je 0x10a9a4
shlq $0x5, %r14
movl (%r8,%r14), %ecx
testl %ecx, %ecx
je 0x10a9a4
xorl %ebx, %ebx
testl %eax, %ecx
setne %bl
jmp 0x10a9a4
movsbl (%r12,%rsi), %ebp
pushq $-0x1
popq %rbx
cmpl $0x1, %ebp
je 0x10aa0c
cmpl $-0x1, %ebp
jne 0x10a9a4
testq %r15, %r15
je 0x10aa1e
movq %r15, %rdi
movl %r14d, %esi
callq 0x121555
jmp 0x10aa23
movsbl (%r12,%r14), %eax
cmpl $0x1, %eax
je 0x10aa31
cmpl $-0x1, %eax
jne 0x10a9a4
xorl %ebx, %ebx
cmpl %eax, %ebp
sete %bl
jmp 0x10a9a4
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: get_path_weight(unsigned int, unsigned int, unsigned int, bub_p_t_warp*, hc_links*)
double get_path_weight(uint32_t query, uint32_t v0, uint32_t root, bub_p_t_warp *b, hc_links* x)
{
    if(v0 == root) return 0;
    uint32_t v, u;
    hc_edge *p = NULL;
    double weight = 0;
    v = v0;
    do {
		u = b->a[v].p; // u->v
        p = get_hc_edge(x, query>>1, v>>1, 0);
        if(p) weight += p->weight;
		v = u;
	} while (v != root);

    return weight;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
cmpl %edx, %esi
je 0x10b493
movq %r8, %rbx
movl %edx, %ebp
movl %esi, %r15d
movl %edi, %r14d
movq (%rcx), %r12
shrl %r14d
movsd %xmm0, 0x8(%rsp)
movl %r15d, %edx
movl %r15d, %eax
imulq $0x38, %rax, %rax
movl (%r12,%rax), %r15d
shrl %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0xfcabc
testq %rax, %rax
je 0x10b48e
movsd 0x8(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
cmpl %ebp, %r15d
jne 0x10b45c
movsd 0x8(%rsp), %xmm0
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: get_related_weight(unsigned int, H_partition*, double*, double*, unsigned int*)
uint32_t get_related_weight(uint32_t x, H_partition* hap, double* w0, double* w1, uint32_t* hap_label)
{
    (*w0) = (*w1) = 0;
    if(x >= hap->link->a.n) return 0;
    uint32_t i, a_n = hap->link->a.a[x].e.n, occ;
    hc_edge* a = hap->link->a.a[x].e.a;
    for (i = occ = 0; i < a_n; i++)
    {
        if(a[i].del) continue;
        if(hap_label && (!is_hap_set_label(a[i].uID, *hap, *hap_label))) continue;
        if(is_hap_set(a[i].uID, *hap)) occ++;
        if((hap->hap[a[i].uID] & hap->m[0])) (*w0)+= a[i].weight;
        if((hap->hap[a[i].uID] & hap->m[1])) (*w1)+= a[i].weight;
    }
    return occ;
}

// Assembly:
movq %rcx, %r9
andq $0x0, (%rcx)
andq $0x0, (%rdx)
movl %edi, %ecx
movq 0x30(%rsi), %rdi
xorl %eax, %eax
cmpq %rcx, (%rdi)
jbe 0x10b583
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq 0x10(%rdi), %rax
imulq $0x30, %rcx, %rcx
movl (%rax,%rcx), %r10d
movq 0x10(%rax,%rcx), %rdi
imulq $0x28, %r10, %r10
xorl %r11d, %r11d
xorl %eax, %eax
cmpq %r11, %r10
je 0x10b579
cmpb $0x0, 0x18(%rdi,%r11)
js 0x10b570
movq 0x10(%rsi), %rcx
movl 0x8(%rdi,%r11), %ebx
movl (%rcx,%rbx,4), %ebx
movl 0x18(%rsi), %r14d
movl 0x1c(%rsi), %ebp
testq %r8, %r8
je 0x10b535
movl %ebp, %ecx
orl %r14d, %ecx
movl 0x20(%rsi), %r15d
orl %r15d, %ecx
testl %ebx, %ecx
je 0x10b570
movb 0x2c(%rsi), %cl
movl %ebx, %r12d
shrl %cl, %r12d
movl (%r8), %r13d
shrl %cl, %r13d
cmpl %r13d, %r12d
je 0x10b539
jmp 0x10b570
movl 0x20(%rsi), %r15d
orl %r14d, %r15d
orl %ebp, %r15d
andl %ebx, %r15d
cmpl $0x1, %r15d
sbbl $-0x1, %eax
testl %ebx, %r14d
je 0x10b55c
movsd (%rdi,%r11), %xmm0
addsd (%rdx), %xmm0
movsd %xmm0, (%rdx)
testl %ebx, %ebp
je 0x10b570
movsd (%rdi,%r11), %xmm0
addsd (%r9), %xmm0
movsd %xmm0, (%r9)
addq $0x28, %r11
jmp 0x10b4e6
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: set_path_hap(bub_p_t_warp*, unsigned int, H_partition*, unsigned int)
void set_path_hap(bub_p_t_warp *b, uint32_t root, H_partition* hap, uint32_t max_hap_label)
{
    uint32_t v, u, label;
    double w0 = 0, w1 = 0, cur_w0, cur_w1;
    ///v is the sink of this bubble
    v = b->S.a[0];
    do {
		u = b->a[v].p; // u->v
        if(v != b->S.a[0]) 
        {
            get_related_weight(v>>1, hap, &cur_w0, &cur_w1, &max_hap_label);
            w0 += cur_w0; w1 += cur_w1;
        }
		v = u;
	} while (v != root);

    if(w0 > w1)
    {
        label = max_hap_label | hap->m[0];
        b->exist_hap_label = hap->m[0];
    }
    else if(w0 < w1)
    {
        label = max_hap_label | hap->m[1];
        b->exist_hap_label = hap->m[1];
    }
    else
    {
        if(b->exist_hap_label == (uint32_t)-1)
        {
            label = max_hap_label | hap->m[0];
            b->exist_hap_label = hap->m[0];
        }
        else
        {
            if(b->exist_hap_label == hap->m[0])
            {
                label = max_hap_label | hap->m[1];
                b->exist_hap_label = hap->m[1];
            }
            else
            {
                label = max_hap_label | hap->m[0];
                b->exist_hap_label = hap->m[0];
            }
        }   
    }
    

	v = b->S.a[0];
    do {
		u = b->a[v].p; // u->v
        if(v != b->S.a[0]) hap->hap[v>>1] |= label;
		v = u;
	} while (v != root);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r14
movl %esi, %ebp
leaq 0xc(%rsp), %rax
movl %ecx, 0x8(%rsp)
movl %ecx, (%rax)
movq (%rdi), %r12
movq %rdi, 0x10(%rsp)
movq 0x18(%rdi), %rbx
movl (%rbx), %r13d
xorpd %xmm0, %xmm0
movl %r13d, %edi
xorpd %xmm1, %xmm1
movl %edi, %eax
imulq $0x38, %rax, %rax
movl (%r12,%rax), %r15d
cmpl %r13d, %edi
je 0x10b608
shrl %edi
movq %r14, %rsi
leaq 0x30(%rsp), %rdx
leaq 0x28(%rsp), %rcx
leaq 0xc(%rsp), %r8
movsd %xmm0, 0x20(%rsp)
movsd %xmm1, 0x18(%rsp)
callq 0x10b4a6
movsd 0x18(%rsp), %xmm1
movsd 0x20(%rsp), %xmm0
addsd 0x30(%rsp), %xmm0
addsd 0x28(%rsp), %xmm1
movl %r15d, %edi
cmpl %ebp, %r15d
jne 0x10b5bc
ucomisd %xmm1, %xmm0
jbe 0x10b624
movl 0x18(%r14), %eax
movq 0x10(%rsp), %rcx
movl %eax, 0x68(%rcx)
jmp 0x10b636
ucomisd %xmm0, %xmm1
movq 0x10(%rsp), %rdx
jbe 0x10b63d
movl 0x1c(%r14), %eax
movl %eax, 0x68(%rdx)
movl 0x8(%rsp), %r8d
jmp 0x10b659
movl 0x68(%rdx), %ecx
movl 0x18(%r14), %eax
cmpl $-0x1, %ecx
movl 0x8(%rsp), %r8d
je 0x10b656
cmpl %eax, %ecx
jne 0x10b656
movl 0x1c(%r14), %eax
movl %eax, 0x68(%rdx)
movl (%rbx), %ecx
movl %ecx, %edx
imulq $0x38, %rdx, %rdx
movl (%r12,%rdx), %edx
cmpl (%rbx), %ecx
je 0x10b67a
movq 0x10(%r14), %rsi
shrl %ecx
movl (%rsi,%rcx,4), %edi
orl %eax, %edi
orl %r8d, %edi
movl %edi, (%rsi,%rcx,4)
movl %edx, %ecx
cmpl %ebp, %edx
jne 0x10b65b
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: reset_ambiguous_label(H_partition*, unsigned char*, unsigned int)
void reset_ambiguous_label(H_partition* hap, uint8_t* hap_label_flag, uint32_t uID)
{
    uint32_t hap_label = (uint32_t)-1;
    if(get_weightest_hap_label_from_uid(uID, hap, hap_label_flag, &hap_label, NULL)>0)
    {
        double cur_w0, cur_w1;
        get_related_weight(uID, hap, &cur_w0, &cur_w1, &hap_label);
        if(cur_w0 >= cur_w1)
        {
            hap->hap[uID] |= (hap_label | hap->m[0]);
        }
        else
        {
            hap->hap[uID] |= (hap_label | hap->m[1]);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, %rdx
movq %rdi, %rbx
leaq 0x4(%rsp), %rcx
orl $-0x1, (%rcx)
movl %ebp, %r14d
movq %r14, %rdi
movq %rbx, %rsi
xorl %r8d, %r8d
callq 0x10be02
testl %eax, %eax
je 0x10c6ad
leaq 0x10(%rsp), %r15
leaq 0x8(%rsp), %r12
leaq 0x4(%rsp), %r13
movl %ebp, %edi
movq %rbx, %rsi
movq %r15, %rdx
movq %r12, %rcx
movq %r13, %r8
callq 0x10b4a6
movsd (%r15), %xmm0
xorl %eax, %eax
ucomisd (%r12), %xmm0
setb %al
movl 0x18(%rbx,%rax,4), %eax
orl (%r13), %eax
movq 0x10(%rbx), %rcx
orl %eax, (%rcx,%r14,4)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: get_unset_com(H_partition*, bubble_type*, ma_ug_t*, unsigned char*, unsigned int*)
uint32_t get_unset_com(H_partition* hap, bubble_type* bub, ma_ug_t *ug, uint8_t* hap_label_flag, uint32_t* max_hap_label)
{
    uint32_t max_i = get_available_com(hap, bub, ug, 1, 1, hap_label_flag, max_hap_label);

    if(max_i == (uint32_t)-1)
    {
        max_i = get_available_com(hap, bub, ug, 1, 0, hap_label_flag, max_hap_label);
        if(max_i != (uint32_t)-1)
        {
            hap->label += hap->label_add;
            (*max_hap_label) = hap->label;
        }
    }

    return max_i;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %r8, %rbx
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r14
movq %r8, (%rsp)
pushq $0x1
popq %rcx
movl %ecx, %r8d
movq %r15, %r9
callq 0x10c1eb
cmpl $-0x1, %eax
jne 0x10c722
movq %rbx, (%rsp)
pushq $0x1
popq %rcx
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x10c1eb
cmpl $-0x1, %eax
je 0x10c71f
movl 0x24(%r14), %ecx
addl 0x28(%r14), %ecx
movl %ecx, 0x24(%r14)
movl %ecx, (%rbx)
jmp 0x10c722
pushq $-0x1
popq %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: phase_com(H_partition*, ma_ug_t*, bub_p_t_warp*, bubble_type*, unsigned int, unsigned int)
void phase_com(H_partition* hap, ma_ug_t *ug, bub_p_t_warp* b, bubble_type* bub, uint32_t bid, uint32_t max_hap_label)
{
    
    if((bid & 1) == 0) ///bubble
    {
        uint32_t beg = (uint32_t)-1, sink = (uint32_t)-1, n, *a;
        get_bubbles(bub, bid>>1, &beg, &sink, &a, &n, NULL);
        ///fprintf(stderr, "+bubble-%uth, beg: %u, sink: %u, phasing ID: %u\n", bid>>1, beg>>1, sink>>1, hap->label>>3);
        b->exist_hap_label = (uint32_t)-1;
        get_phase_path(ug, beg, sink, b, hap, max_hap_label);
        get_phase_path(ug, beg, sink, b, hap, max_hap_label);
        ///fprintf(stderr, "-bubble-%uth, beg: %u, sink: %u, phasing ID: %u\n", bid>>1, beg>>1, sink>>1, hap->label>>3);
    }
    else
    {
        double cur_w0, cur_w1;
        get_related_weight(bid>>1, hap, &cur_w0, &cur_w1, &max_hap_label);
        ///fprintf(stderr, "utg-%uth, phasing ID: %u\n", bid>>1, hap->label>>3);
        if(cur_w0 >= cur_w1)
        {
            hap->hap[bid>>1] |= (max_hap_label | hap->m[0]);
        }
        else
        {
            hap->hap[bid>>1] |= (max_hap_label | hap->m[1]);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, %ebx
movl %r8d, %r15d
movq %rdi, %r14
movl %r9d, 0xc(%rsp)
testb $0x1, %r15b
jne 0x10c7bc
movq %rdx, %r12
movq %rsi, %r13
leaq 0x10(%rsp), %rbp
orl $-0x1, (%rbp)
leaq 0x24(%rsp), %rax
orl $-0x1, (%rax)
shrl %r15d
andq $0x0, (%rsp)
leaq 0x18(%rsp), %r8
leaq 0x20(%rsp), %r9
movq %rcx, %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq %rax, %rcx
callq 0xf6ab5
orl $-0x1, 0x68(%r12)
movl (%rbp), %esi
movq %r13, %rdi
movq %r12, %rcx
movq %r14, %r8
movl %ebx, %r9d
callq 0x10b68f
movl (%rbp), %esi
movq %r13, %rdi
movq %r12, %rcx
movq %r14, %r8
movl %ebx, %r9d
callq 0x10b68f
jmp 0x10c803
shrl %r15d
leaq 0x18(%rsp), %r12
leaq 0x10(%rsp), %r13
leaq 0xc(%rsp), %r8
movl %r15d, %edi
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x10b4a6
movsd (%r12), %xmm0
xorl %eax, %eax
ucomisd (%r13), %xmm0
setb %al
movq 0x10(%r14), %rcx
movl 0x18(%r14,%rax,4), %eax
orl (%rcx,%r15,4), %eax
orl %ebx, %eax
movl %eax, (%rcx,%r15,4)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: get_cluster_weight(H_partition*, hc_links*, unsigned int*, unsigned int)
double get_cluster_weight(H_partition* hap, hc_links* link, uint32_t *h, uint32_t h_n)
{
    int o_d = 0;
    double weight = 0;
    uint32_t j, k, m;
    for (j = 0, weight = 0; j < h_n; j++)
    {
        for (k = 0; k < link->a.a[h[j]].e.n; k++)
        {
            if(link->a.a[h[j]].e.a[k].del) continue;
            for (m = 0; m < h_n; m++)
            {
                if(h[m] == link->a.a[h[j]].e.a[k].uID) break;
            }
            if(m < h_n) continue;

            o_d = get_phase_status(hap, link->a.a[h[j]].e.a[k].uID);
            if(o_d < -1) continue;
            ///if(o_d < -1) fprintf(stderr, "ERROR\n");
            weight += (o_d*link->a.a[h[j]].e.a[k].weight);
        }
    }

    return weight;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, 0x10(%rsp)
movl %ecx, %r12d
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
xorl %r13d, %r13d
cmpq %r12, %r13
je 0x10c8cd
xorl %ebp, %ebp
movl %ebp, %ebp
movq 0x10(%r14), %rax
movl (%rbx,%r13,4), %ecx
imulq $0x30, %rcx, %rcx
cmpq %rbp, (%rax,%rcx)
jbe 0x10c8c5
addq %rcx, %rax
movq 0x10(%rax), %rax
imulq $0x28, %rbp, %r15
cmpb $0x0, 0x18(%rax,%r15)
js 0x10c8c1
movl 0x8(%rax,%r15), %esi
xorl %eax, %eax
cmpq %rax, %r12
je 0x10c887
leaq 0x1(%rax), %rcx
cmpl %esi, (%rbx,%rax,4)
movq %rcx, %rax
jne 0x10c874
jmp 0x10c8c1
movq 0x10(%rsp), %rdi
callq 0x121555
cmpl $-0x1, %eax
jl 0x10c8c1
cvtsi2sd %eax, %xmm0
movq 0x10(%r14), %rax
movl (%rbx,%r13,4), %ecx
imulq $0x30, %rcx, %rcx
movq 0x10(%rax,%rcx), %rax
mulsd (%rax,%r15), %xmm0
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
incl %ebp
jmp 0x10c846
incq %r13
jmp 0x10c83b
movsd 0x8(%rsp), %xmm0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: get_cluster_inner_weight(H_partition*, hc_links*, unsigned int*, unsigned int, unsigned int*, unsigned int)
double get_cluster_inner_weight(H_partition* hap, hc_links* link, uint32_t *h0, uint32_t h0_n, 
uint32_t *h1, uint32_t h1_n)
{
    double weight = 0;
    uint32_t j, k, m;
    for (j = 0, weight = 0; j < h0_n; j++)
    {
        for (k = 0; k < link->a.a[h0[j]].e.n; k++)
        {
            if(link->a.a[h0[j]].e.a[k].del) continue;
            for (m = 0; m < h1_n; m++)
            {
                if(h1[m] == link->a.a[h0[j]].e.a[k].uID) break;
            }
            if(m == h1_n) continue;

            weight += link->a.a[h0[j]].e.a[k].weight;
        }
    }

    return weight * 2;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %eax
movl %r9d, %ecx
xorpd %xmm0, %xmm0
xorl %edi, %edi
cmpq %rax, %rdi
je 0x10c95d
movq 0x10(%rsi), %r10
movl (%rdx,%rdi,4), %r9d
imulq $0x30, %r9, %r11
leaq (%r10,%r11), %r9
movq (%r10,%r11), %r10
xorl %r11d, %r11d
movl %r11d, %r11d
cmpq %r11, %r10
jbe 0x10c958
movq 0x10(%r9), %rbx
imulq $0x28, %r11, %r14
cmpb $0x0, 0x18(%rbx,%r14)
js 0x10c953
leaq (%rbx,%r14), %r12
addq $0x8, %r12
xorl %r15d, %r15d
cmpq %r15, %rcx
je 0x10c953
movl (%r8,%r15,4), %ebp
cmpl (%r12), %ebp
je 0x10c948
incq %r15
jmp 0x10c934
cmpl %r15d, %ecx
je 0x10c953
addsd (%rbx,%r14), %xmm0
incl %r11d
jmp 0x10c911
incq %rdi
jmp 0x10c8f5
addsd %xmm0, %xmm0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: update_partition_flag(H_partition*, G_partition*, hc_links*, unsigned int)
void update_partition_flag(H_partition* h, G_partition* g_p, hc_links* link, uint32_t id)
{
    uint32_t k, *h0, h0_n, *h1, h1_n, uID, flag = 0;
    int status;
    get_phased_block(g_p, NULL, id, NULL, NULL, &h0, &h0_n, &h1, &h1_n, NULL, NULL);

    status = g_p->a[id].status[0];
    if(status == 1) flag = h->m[0];
    else if(status == -1) flag = h->m[1];
    else if(status == 0) flag = h->m[2];
    else if(status == -2) flag = 0;
    for (k = 0; k < h0_n; k++)
    {
        uID = h0[k];
        h->hap[uID] >>= 3;
        h->hap[uID] <<= 3;
        h->hap[uID] |= flag;
    }

    status = g_p->a[id].status[1];
    if(status == 1) flag = h->m[0];
    else if(status == -1) flag = h->m[1];
    else if(status == 0) flag = h->m[2];
    else if(status == -2) flag = 0;
    for (k = 0; k < h1_n; k++)
    {
        uID = h1[k];
        h->hap[uID] >>= 3;
        h->hap[uID] <<= 3;
        h->hap[uID] |= flag;
    }
}

// Assembly:
movl %ecx, %eax
movq 0x10(%rsi), %rsi
imulq $0x48, %rax, %r8
movq 0x10(%rsi,%r8), %r9
movl 0x18(%rsi,%r8), %r10d
testq %r10, %r10
leaq (%r9,%r10,4), %rax
movl 0x1c(%rsi,%r8), %ecx
cmoveq %r10, %r9
testq %rcx, %rcx
cmoveq %rcx, %rax
movl 0x24(%rsi,%r8), %r11d
cmpl $-0x1, %r11d
je 0x10c9b7
testl %r11d, %r11d
je 0x10c9b2
xorl %edx, %edx
cmpl $0x1, %r11d
jne 0x10c9ba
movl 0x18(%rdi), %edx
jmp 0x10c9ba
movl 0x20(%rdi), %edx
jmp 0x10c9ba
movl 0x1c(%rdi), %edx
pushq %rbp
pushq %r14
pushq %rbx
xorl %r11d, %r11d
cmpq %r11, %r10
je 0x10c9e0
movl (%r9,%r11,4), %ebx
movq 0x10(%rdi), %r14
movl (%r14,%rbx,4), %ebp
andl $-0x8, %ebp
orl %edx, %ebp
movl %ebp, (%r14,%rbx,4)
incq %r11
jmp 0x10c9c1
movl 0x28(%rsi,%r8), %esi
addl $0x2, %esi
cmpl $0x3, %esi
ja 0x10ca0e
leaq 0xe0778(%rip), %rdx     # 0x1ed16c
movslq (%rdx,%rsi,4), %rsi
addq %rdx, %rsi
jmpq *%rsi
xorl %edx, %edx
jmp 0x10ca0e
movl 0x20(%rdi), %edx
jmp 0x10ca0e
movl 0x18(%rdi), %edx
jmp 0x10ca0e
movl 0x1c(%rdi), %edx
xorl %esi, %esi
cmpq %rsi, %rcx
je 0x10ca31
movl (%rax,%rsi,4), %r8d
movq 0x10(%rdi), %r9
movl (%r9,%r8,4), %r10d
andl $-0x8, %r10d
orl %edx, %r10d
movl %r10d, (%r9,%r8,4)
incq %rsi
jmp 0x10ca10
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: print_contig_partition(H_partition*, char const*)
void print_contig_partition(H_partition* hap, const char* debug)
{
    uint32_t i;
    int status;
    for (i = 0; i < hap->n; i++)
    {
        status = get_phase_status(hap, i);
        fprintf(stderr, "%s\tutg%.6d\tP:%u\tHG:A:%d\n", debug, (int)(i+1), hap->hap[i]>>3, status);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x1
popq %r15
movq 0x146406(%rip), %rbp    # 0x252fe0
leaq 0xe1294(%rip), %r12     # 0x1ede75
leal -0x1(%r15), %r13d
cmpq %r13, (%r14)
jbe 0x10cc1d
movq %r14, %rdi
movl %r13d, %esi
callq 0x121555
movq (%rbp), %rdi
movq 0x10(%r14), %rcx
movl (%rcx,%r13,4), %r8d
shrl $0x3, %r8d
movq %r12, %rsi
movq %rbx, %rdx
movl %r15d, %ecx
movl %eax, %r9d
xorl %eax, %eax
callq 0x22b0
incl %r15d
jmp 0x10cbe1
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: if_flip(H_partition*, G_partition*, hc_links*, bubble_type*, unsigned int)
uint32_t if_flip(H_partition* h, G_partition* g_p, hc_links* link,  
bubble_type* bub, uint32_t gid)
{
    double weight = 0;
    if(h->lock[gid]) return 0;
    if(g_p->a[gid].h[0] > 0 && (g_p->a[gid].status[0] == 1 || g_p->a[gid].status[0] == -1))
    {
        weight += (g_p->a[gid].weight[0] * g_p->a[gid].status[0]);
    }

    if(g_p->a[gid].h[1] > 0 && (g_p->a[gid].status[1] == 1 || g_p->a[gid].status[1] == -1))
    {
        weight += (g_p->a[gid].weight[1] * g_p->a[gid].status[1]);
    }
    weight += g_p->a[gid].weight_convex*2;
    if(weight >= 0) return 0;
    return 1;
}

// Assembly:
movq 0x8(%rdi), %rdx
movl %r8d, %ecx
xorl %eax, %eax
cmpb $0x0, (%rdx,%rcx)
je 0x10d85c
retq
movq 0x10(%rsi), %rax
imulq $0x48, %rcx, %rcx
leaq (%rax,%rcx), %rdx
xorpd %xmm0, %xmm0
cmpl $0x0, 0x18(%rax,%rcx)
je 0x10d88d
movl 0x24(%rdx), %esi
cmpl $0x1, %esi
je 0x10d880
cmpl $-0x1, %esi
jne 0x10d88d
cvtsi2sd %esi, %xmm1
mulsd 0x30(%rdx), %xmm1
addsd %xmm1, %xmm0
cmpl $0x0, 0x1c(%rdx)
je 0x10d8ad
movl 0x28(%rdx), %esi
cmpl $0x1, %esi
je 0x10d8a0
cmpl $-0x1, %esi
jne 0x10d8ad
cvtsi2sd %esi, %xmm1
mulsd 0x38(%rdx), %xmm1
addsd %xmm1, %xmm0
movsd 0x40(%rax,%rcx), %xmm1
addsd %xmm1, %xmm1
addsd %xmm0, %xmm1
xorpd %xmm0, %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm1
setb %al
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: debug_flip(G_partition*, hc_links*, bubble_type*, unsigned int)
void debug_flip(G_partition* g_p, hc_links* link, bubble_type* bub, uint32_t id)
{
    fprintf(stderr, "33333333333\n");
    uint32_t *h0, h0_n, *h1, h1_n, k, wrong;
    double hw0, hw1;
    for (k = wrong = 0; k < g_p->n; k++)
    {
        hw0 = hw1 = 0;
        get_phased_block(g_p, NULL, k, NULL, NULL, &h0, &h0_n, &h1, &h1_n, NULL, NULL);
        if(h0_n >0) hw0 = get_cluster_weight_debug(g_p, link, h0, h0_n);
        if(h1_n >0) hw1 = get_cluster_weight_debug(g_p, link, h1, h1_n);
        if(hw0 != g_p->a[k].weight[0])
        {
            if((uint32_t)hw0 != (uint32_t)g_p->a[k].weight[0]) wrong = 1;
            fprintf(stderr, "k: %u, ERROR(id: %u): hw0: %f, weight[0]: %f\n", k, id, hw0, g_p->a[k].weight[0]);
        } 
        
        if(hw1 != g_p->a[k].weight[1])
        {
            if((uint32_t)hw1 != (uint32_t)g_p->a[k].weight[1]) wrong = 1;
            fprintf(stderr, "k: %u, ERROR(id: %u): hw1: %f, weight[1]: %f\n", k, id, hw1, g_p->a[k].weight[1]);
        }

        if(wrong) break;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, 0x14(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdi, %rbx
movq 0x1456f6(%rip), %rax    # 0x252fe0
movq (%rax), %rcx
leaq 0xe05b2(%rip), %rdi     # 0x1edea6
pushq $0xc
popq %rsi
pushq $0x1
popq %rdx
callq 0x2410
movq %rbx, %rcx
xorl %r12d, %r12d
movq %rbx, 0x8(%rsp)
movl %r12d, %r12d
cmpq %r12, (%rcx)
jbe 0x10da4f
movq 0x10(%rcx), %r15
imulq $0x48, %r12, %r14
movq 0x10(%r15,%r14), %rbp
movl 0x18(%r15,%r14), %ebx
movl 0x1c(%r15,%r14), %r13d
xorpd %xmm0, %xmm0
xorpd %xmm2, %xmm2
testq %rbx, %rbx
je 0x10d95b
movq 0x8(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq %rbp, %rdx
movl %ebx, %ecx
callq 0x10da5e
movq 0x8(%rsp), %rcx
movapd %xmm0, %xmm2
xorpd %xmm0, %xmm0
testl %r13d, %r13d
je 0x10d98e
leaq (,%rbx,4), %rdx
addq %rbp, %rdx
movq 0x8(%rsp), %rdi
movq 0x20(%rsp), %rsi
movl %r13d, %ecx
movsd %xmm2, 0x18(%rsp)
callq 0x10da5e
movsd 0x18(%rsp), %xmm2
movq 0x8(%rsp), %rcx
movsd 0x30(%r15,%r14), %xmm1
ucomisd %xmm1, %xmm2
jne 0x10d9b4
jp 0x10d9b4
movsd 0x38(%r15,%r14), %xmm1
ucomisd %xmm1, %xmm0
jne 0x10da12
jp 0x10da12
incl %r12d
jmp 0x10d90a
cvttsd2si %xmm2, %r15
cvttsd2si %xmm1, %r13
cmpl %r13d, %r15d
sete %bl
movq 0x145615(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0xe04de(%rip), %rsi     # 0x1edeb3
movl %r12d, %edx
movl 0x14(%rsp), %ecx
movsd %xmm0, 0x18(%rsp)
movapd %xmm2, %xmm0
movb $0x2, %al
callq 0x22b0
movsd 0x18(%rsp), %xmm0
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rax
movsd 0x38(%rax,%r14), %xmm1
ucomisd %xmm1, %xmm0
jne 0x10da14
jp 0x10da14
cmpl %r13d, %r15d
je 0x10d9ac
jmp 0x10da4f
movb $0x1, %bl
cvttsd2si %xmm0, %r14
cvttsd2si %xmm1, %r15
movq 0x1455bb(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0xe04b2(%rip), %rsi     # 0x1edee1
movl %r12d, %edx
movl 0x14(%rsp), %ecx
movb $0x2, %al
callq 0x22b0
movq 0x8(%rsp), %rcx
cmpl %r15d, %r14d
jne 0x10da4f
testb %bl, %bl
jne 0x10d9ac
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/hic.cpp
// Function: merge_phase_group_by_chain(H_partition*, G_partition*, bubble_type*, unsigned int)
void merge_phase_group_by_chain(H_partition* hap, G_partition* g_p, bubble_type* bub, uint32_t chain_id)
{
    uint32_t i, k;
    uint32_t beg, sink, *a, n, pre_id, hap_label_id;
    uint64_t bid, uid;
    ma_utg_t *u = &(bub->b_ug->u.a[chain_id]);
    
    for (i = 0, pre_id = (uint32_t)-1; i < u->n; i++)
    {
        // fprintf(stderr, "inner i: %u, u->n: %u\n", i, (uint32_t)u->n);
        bid = u->a[i]>>33; ///here is a bubble
        // fprintf(stderr, "bid: %lu\n", bid);
        get_bubbles(bub, bid, &beg, &sink, &a, &n, NULL);
        for (k = 0; k < n; k++)
        {
            // fprintf(stderr, "k: %u, n: %u\n", k, n);
            uid = a[k]>>1;
            // fprintf(stderr, "uid: %lu\n", uid);
            if(g_p->index[uid] == (uint32_t)-1) ///mean this unitig doesn't have hap label
            {
                pre_id = (uint32_t)-1;
                continue;
            }
            hap_label_id = g_p->index[uid]>>1;
            // fprintf(stderr, "hap_label_id: %u, hap->n: %lu\n", hap_label_id, hap->n);
            if(hap_label_id == pre_id) continue;
            pre_id = hap_label_id;
            if(hap->lock[hap_label_id] == 1) continue;
            if(if_flip(hap, g_p, hap->link, bub, hap_label_id))
            {
                // fprintf(stderr, "2222222222\n");
                flip_unitig(g_p, hap->link, bub, hap_label_id);
                ///debug_flip(g_p, hap->link, bub, hap_label_id);
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, %r15
movq %rdx, 0x18(%rsp)
movq 0xc0(%rdx), %rax
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq 0x10(%rax), %rcx
pushq $-0x1
popq %r12
xorl %edx, %edx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %rcx, 0x10(%rsp)
movl 0x10(%rcx), %eax
cmpq %rax, %rdx
jae 0x10dbfe
movq 0x18(%rcx), %rax
movq %rdx, 0x20(%rsp)
movq (%rax,%rdx,8), %rsi
shrq $0x21, %rsi
andq $0x0, (%rsp)
movq 0x18(%rsp), %rdi
leaq 0x34(%rsp), %rdx
leaq 0x30(%rsp), %rcx
leaq 0x28(%rsp), %r8
leaq 0xc(%rsp), %r9
callq 0xf6ab5
pushq $-0x1
popq %rdx
xorl %ebx, %ebx
movl 0xc(%rsp), %eax
cmpq %rax, %rbx
jae 0x10dbec
movq 0x28(%rsp), %rax
movl (%rax,%rbx,4), %eax
shrl %eax
movq 0x18(%r14), %rcx
movl (%rcx,%rax,4), %r13d
movl %edx, %eax
cmpq %rbp, %r13
je 0x10dbe4
shrl %r13d
movl %r12d, %eax
cmpl %r12d, %r13d
je 0x10dbe4
movq 0x8(%r15), %rax
cmpb $0x1, (%rax,%r13)
jne 0x10dbbd
movl %r13d, %eax
jmp 0x10dbe4
movq %r15, %rdi
movq %r14, %rsi
movl %r13d, %r8d
callq 0x10d84c
testl %eax, %eax
je 0x10dbde
movq 0x30(%r15), %rsi
movq %r14, %rdi
movl %r13d, %ecx
callq 0x10dc0d
movl %r13d, %eax
pushq $-0x1
popq %rdx
incq %rbx
movl %eax, %r12d
jmp 0x10db80
movq 0x20(%rsp), %rdx
incq %rdx
movq 0x10(%rsp), %rcx
jmp 0x10db3b
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq