LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %rbp
pushq %r14
pushq %rbx
movq %rcx, %r9
xorl %eax, %eax
movq %rax, (%rcx)
movq %rax, (%rdx)
movl %edi, %edi
movq 0x30(%rsi), %rcx
cmpq %rdi, (%rcx)
jbe 0x14c2c3
movq 0x10(%rcx), %rcx
leaq (%rdi,%rdi,2), %rdi
shlq $0x4, %rdi
movl (%rcx,%rdi), %r10d
testq %r10, %r10
je 0x14c2c3
movq 0x10(%rcx,%rdi), %rdi
shlq $0x3, %r10
leaq (%r10,%r10,4), %r10
xorl %r11d, %r11d
xorl %eax, %eax
cmpb $0x0, 0x18(%rdi,%r11)
js 0x14c2b6
testq %r8, %r8
je 0x14c26a
movq 0x10(%rsi), %rcx
movl 0x8(%rdi,%r11), %ebx
movl 0x1c(%rsi), %ebp
orl 0x18(%rsi), %ebp
movl (%rcx,%rbx,4), %ebx
orl 0x20(%rsi), %ebp
testl %ebx, %ebp
je 0x14c2b6
movb 0x2c(%rsi), %cl
shrl %cl, %ebx
movl (%r8), %ebp
shrl %cl, %ebp
cmpl %ebp, %ebx
jne 0x14c2b6
movq 0x10(%rsi), %rcx
movl 0x8(%rdi,%r11), %ebx
movl (%rcx,%rbx,4), %ecx
movl 0x18(%rsi), %ebp
movl 0x1c(%rsi), %ebx
movl 0x20(%rsi), %r14d
orl %ebp, %r14d
orl %ebx, %r14d
andl %ecx, %r14d
cmpl $0x1, %r14d
sbbl $-0x1, %eax
testl %ecx, %ebp
je 0x14c2a2
movsd (%rdi,%r11), %xmm0
addsd (%rdx), %xmm0
movsd %xmm0, (%rdx)
testl %ecx, %ebx
je 0x14c2b6
movsd (%rdi,%r11), %xmm0
addsd (%r9), %xmm0
movsd %xmm0, (%r9)
addq $0x28, %r11
cmpq %r11, %r10
jne 0x14c236
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x14c34c
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 0x14c1ed
movsd 0x18(%rsp), %xmm1
movsd 0x20(%rsp), %xmm0
addsd 0x30(%rsp), %xmm0
addsd 0x28(%rsp), %xmm1
movl %r15d, %edi
cmpl %ebp, %r15d
jne 0x14c300
ucomisd %xmm1, %xmm0
jbe 0x14c368
movl 0x18(%r14), %eax
movq 0x10(%rsp), %rcx
movl %eax, 0x68(%rcx)
jmp 0x14c37a
ucomisd %xmm0, %xmm1
movq 0x10(%rsp), %rdx
jbe 0x14c381
movl 0x1c(%r14), %eax
movl %eax, 0x68(%rdx)
movl 0x8(%rsp), %r8d
jmp 0x14c39d
movl 0x68(%rdx), %ecx
movl 0x18(%r14), %eax
cmpl $-0x1, %ecx
movl 0x8(%rsp), %r8d
je 0x14c39a
cmpl %eax, %ecx
jne 0x14c39a
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 0x14c3be
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 0x14c39f
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
movl $0xffffffff, (%rcx)     # imm = 0xFFFFFFFF
movl %ebp, %r14d
movq %r14, %rdi
movq %rbx, %rsi
xorl %r8d, %r8d
callq 0x14cd15
testl %eax, %eax
je 0x14d6b0
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 0x14c1ed
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_O1/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)
movl $0x1, %ecx
movl $0x1, %r8d
movq %r15, %r9
callq 0x14d178
cmpl $-0x1, %eax
jne 0x14d72e
movq %rbx, (%rsp)
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
movl $0x1, %ecx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x14d178
cmpl $-0x1, %eax
je 0x14d729
movl 0x24(%r14), %ecx
addl 0x28(%r14), %ecx
movl %ecx, 0x24(%r14)
movl %ecx, (%rbx)
jmp 0x14d72e
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 $0x18, %rsp
movl %r9d, %ebx
movl %r8d, %r15d
movq %rdi, %r14
movl %r9d, 0x4(%rsp)
testb $0x1, %r15b
jne 0x14d7b3
movq %rdx, %r12
movq %rsi, %r13
shrl %r15d
movq 0x28(%rcx), %rax
movq 0x40(%rcx), %rcx
movl (%rcx,%r15,4), %ecx
movl (%rax,%rcx,4), %ebp
movl $0xffffffff, 0x68(%rdx) # imm = 0xFFFFFFFF
movq %rsi, %rdi
movl %ebp, %esi
movq %rdx, %rcx
movq %r14, %r8
movl %ebx, %r9d
callq 0x14c3d3
movl 0x4(%rsp), %r9d
movq %r13, %rdi
movl %ebp, %esi
movq %r12, %rcx
movq %r14, %r8
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x14c3d3
shrl %r15d
leaq 0x10(%rsp), %r12
leaq 0x8(%rsp), %r13
leaq 0x4(%rsp), %r8
movl %r15d, %edi
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x14c1ed
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 $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
testl %ecx, %ecx
je 0x14d8eb
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq 0x10(%rsi), %rax
movl %ecx, %ecx
xorpd %xmm0, %xmm0
xorl %esi, %esi
xorl %r8d, %r8d
movl (%rdx,%r8,4), %r9d
leaq (%r9,%r9,2), %r11
shlq $0x4, %r11
movq (%rax,%r11), %r9
testq %r9, %r9
je 0x14d8d4
leaq (%rax,%r11), %r10
movq 0x10(%r10), %r10
addq %rax, %r11
addq $0x10, %r11
xorl %ebx, %ebx
leaq (%rbx,%rbx,4), %r14
cmpb $0x0, 0x18(%r10,%r14,8)
js 0x14d8c9
movq (%r11), %r15
movl 0x8(%r15,%r14,8), %ebp
xorl %r15d, %r15d
cmpl %ebp, (%rdx,%r15,4)
je 0x14d8c9
incq %r15
cmpl %r15d, %ecx
jne 0x14d86b
movq (%r11), %r15
movl 0x8(%r15,%r14,8), %r12d
movq 0x10(%rdi), %r13
movl (%r13,%r12,4), %r12d
xorl %r13d, %r13d
testl %r12d, 0x18(%rdi)
setne %r13b
movl 0x1c(%rdi), %ebp
andl %r12d, %ebp
negl %ebp
movl $0x0, %ebp
sbbl %ebp, %ebp
leal -0x2(%r13,%r13,2), %r13d
orl %r13d, %ebp
testl %r12d, 0x20(%rdi)
cmovnel %esi, %ebp
cmpl $-0x1, %ebp
jl 0x14d8c9
xorps %xmm1, %xmm1
cvtsi2sd %ebp, %xmm1
mulsd (%r15,%r14,8), %xmm1
addsd %xmm1, %xmm0
incq %rbx
movl %ebx, %r14d
cmpq %r14, %r9
ja 0x14d854
incq %r8
cmpq %rcx, %r8
jne 0x14d82a
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorps %xmm0, %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
testl %ecx, %ecx
je 0x14d995
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r9d, %eax
movq 0x10(%rsi), %rsi
movl %ecx, %ecx
xorpd %xmm0, %xmm0
xorl %edi, %edi
movl (%rdx,%rdi,4), %r10d
leaq (%r10,%r10,2), %rbx
shlq $0x4, %rbx
movq (%rsi,%rbx), %r10
testq %r10, %r10
je 0x14d980
leaq (%rsi,%rbx), %r11
movq 0x10(%r11), %r11
addq %rsi, %rbx
addq $0x10, %rbx
xorl %r14d, %r14d
leaq (%r14,%r14,4), %r15
cmpb $0x0, 0x18(%r11,%r15,8)
js 0x14d975
testl %r9d, %r9d
je 0x14d964
movq (%rbx), %r12
movl 0x8(%r12,%r15,8), %ebp
xorl %r12d, %r12d
cmpl %ebp, (%r8,%r12,4)
je 0x14d967
incq %r12
cmpl %r12d, %eax
jne 0x14d951
movl %eax, %r12d
jmp 0x14d967
xorl %r12d, %r12d
cmpl %r9d, %r12d
je 0x14d975
movq (%rbx), %r12
addsd (%r12,%r15,8), %xmm0
incq %r14
movl %r14d, %r15d
cmpq %r15, %r10
ja 0x14d935
incq %rdi
cmpq %rcx, %rdi
jne 0x14d90e
addsd %xmm0, %xmm0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorps %xmm0, %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
leaq (%rax,%rax,8), %r8
movq 0x10(%rsi,%r8,8), %r9
movl 0x18(%rsi,%r8,8), %r10d
testq %r10, %r10
leaq (%r9,%r10,4), %rax
movl 0x1c(%rsi,%r8,8), %ecx
cmoveq %r10, %r9
testq %rcx, %rcx
cmoveq %rcx, %rax
movl 0x24(%rsi,%r8,8), %r11d
cmpl $-0x1, %r11d
je 0x14d9e6
testl %r11d, %r11d
je 0x14d9e1
xorl %edx, %edx
cmpl $0x1, %r11d
jne 0x14d9e9
movl 0x18(%rdi), %edx
jmp 0x14d9e9
movl 0x20(%rdi), %edx
jmp 0x14d9e9
movl 0x1c(%rdi), %edx
pushq %rbp
pushq %r14
pushq %rbx
testq %r10, %r10
je 0x14da11
movq 0x10(%rdi), %r11
xorl %ebx, %ebx
movl (%r9,%rbx,4), %r14d
movl (%r11,%r14,4), %ebp
andl $-0x8, %ebp
orl %edx, %ebp
movl %ebp, (%r11,%r14,4)
incq %rbx
cmpq %rbx, %r10
jne 0x14d9f8
movl 0x28(%rsi,%r8,8), %esi
addl $0x2, %esi
cmpl $0x3, %esi
ja 0x14da3f
leaq 0xe1607(%rip), %rdx     # 0x22f02c
movslq (%rdx,%rsi,4), %rsi
addq %rdx, %rsi
jmpq *%rsi
xorl %edx, %edx
jmp 0x14da3f
movl 0x20(%rdi), %edx
jmp 0x14da3f
movl 0x18(%rdi), %edx
jmp 0x14da3f
movl 0x1c(%rdi), %edx
testq %rcx, %rcx
je 0x14da65
movq 0x10(%rdi), %rsi
xorl %edi, %edi
movl (%rax,%rdi,4), %r8d
movl (%rsi,%r8,4), %r9d
andl $-0x8, %r9d
orl %edx, %r9d
movl %r9d, (%rsi,%r8,4)
incq %rdi
cmpq %rdi, %rcx
jne 0x14da4a
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x14e5dd
retq
movq 0x10(%rsi), %rax
leaq (%rcx,%rcx,8), %rcx
leaq (%rax,%rcx,8), %rdx
xorpd %xmm0, %xmm0
cmpl $0x0, 0x18(%rdx)
je 0x14e60d
movl 0x24(%rdx), %esi
cmpl $0x1, %esi
je 0x14e600
cmpl $-0x1, %esi
jne 0x14e60d
cvtsi2sd %esi, %xmm1
mulsd 0x30(%rdx), %xmm1
addsd %xmm1, %xmm0
cmpl $0x0, 0x1c(%rdx)
je 0x14e630
movl 0x28(%rdx), %esi
cmpl $0x1, %esi
je 0x14e620
cmpl $-0x1, %esi
jne 0x14e630
xorps %xmm1, %xmm1
cvtsi2sd %esi, %xmm1
mulsd 0x38(%rdx), %xmm1
addsd %xmm1, %xmm0
movsd 0x40(%rax,%rcx,8), %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_O1/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 $0x18, %rsp
movq 0xc0(%rdx), %rax
movq 0x10(%rax), %rax
movl %ecx, %ecx
leaq (%rcx,%rcx,4), %rcx
cmpl $0x0, 0x10(%rax,%rcx,8)
je 0x14e811
movq %rsi, %r14
movq %rdi, %r15
leaq (%rax,%rcx,8), %rsi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %edi, %edi
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movq %rdx, 0x8(%rsp)
movq %rsi, (%rsp)
movq 0x18(%rsi), %rcx
movq %rdi, 0x10(%rsp)
movq (%rcx,%rdi,8), %rcx
movq 0x40(%rdx), %rsi
shrq $0x21, %rcx
movl (%rsi,%rcx,4), %edi
movl 0x4(%rsi,%rcx,4), %ecx
subl %edi, %ecx
addl $-0x2, %ecx
je 0x14e7f4
movq 0x28(%rdx), %rsi
leaq (%rsi,%rdi,4), %r13
addq $0x8, %r13
movl %ecx, %ebp
xorl %ebx, %ebx
movl (%r13,%rbx,4), %ecx
shrl %ecx
movq 0x18(%r14), %rdx
movl (%rdx,%rcx,4), %r12d
cmpq %r8, %r12
je 0x14e7bb
shrl %r12d
cmpl %eax, %r12d
je 0x14e7ec
movq 0x8(%r15), %rax
cmpb $0x1, (%rax,%r12)
jne 0x14e7c2
movl %r12d, %eax
jmp 0x14e7ec
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x14e7ec
movq %r15, %rdi
movq %r14, %rsi
movl %r12d, %r8d
callq 0x14e5cd
testl %eax, %eax
je 0x14e7e3
movq 0x30(%r15), %rsi
movq %r14, %rdi
movl %r12d, %ecx
callq 0x14e820
movl %r12d, %eax
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
incq %rbx
cmpq %rbx, %rbp
jne 0x14e78f
movq 0x10(%rsp), %rdi
incq %rdi
movq (%rsp), %rsi
movl 0x10(%rsi), %ecx
cmpq %rcx, %rdi
movq 0x8(%rsp), %rdx
jb 0x14e75c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: set_bubble(H_partition*, G_partition*, bubble_type*, block_phase_type*, unsigned long)
void set_bubble(H_partition* hap, G_partition* g_p, bubble_type* bub, block_phase_type* block, 
uint64_t bid)
{
    uint32_t beg, sink, k, uid, *a, n, gid;
    block->weight = 0;
    get_bubbles(bub, bid, &beg, &sink, &a, &n, NULL);
    for (k = 0; k < n; k++)
    {
        uid = a[k]>>1;
        if(g_p->index[uid] == (uint32_t)-1) continue;
        gid = g_p->index[uid]>>1;
        block->vis.a[gid] = 1;
    }
}

// Assembly:
movq $0x0, 0x18(%rcx)
movq 0x40(%rdx), %rdi
movl (%rdi,%r8,4), %eax
movl 0x4(%rdi,%r8,4), %edi
subl %eax, %edi
addl $-0x2, %edi
je 0x14eb11
movq 0x28(%rdx), %rdx
leaq (%rdx,%rax,4), %rax
addq $0x8, %rax
movl %edi, %edx
xorl %edi, %edi
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movl (%rax,%rdi,4), %r9d
shrl %r9d
movq 0x18(%rsi), %r10
movl (%r10,%r9,4), %r9d
cmpq %r8, %r9
je 0x14eb09
shrl %r9d
movq 0x10(%rcx), %r10
movb $0x1, (%r10,%r9)
incq %rdi
cmpq %rdi, %rdx
jne 0x14eae9
retq
// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: get_total_weight(H_partition*, G_partition*)
double get_total_weight(H_partition* h, G_partition* g_p)
{
    uint32_t i, k, uID;
    hc_links* link = h->link;
    int o_d = 0, o_f = 0;
    double w, t_w;
    for (i = 0, t_w = 0; i < h->n; i++)
    {
        if(g_p->index[i] == (uint32_t)-1) continue;
        o_f = g_p->a[g_p->index[i]>>1].status[g_p->index[i]&1];
        for (k = 0; k < link->a.a[i].e.n; k++)
        {
            if(link->a.a[i].e.a[k].del) continue;
            uID = link->a.a[i].e.a[k].uID;
            w = link->a.a[i].e.a[k].weight;
            if(g_p->index[uID] == (uint32_t)-1) continue;
            o_d = g_p->a[g_p->index[uID]>>1].status[g_p->index[uID]&1];
            t_w += (o_f*o_d*w);
        }
    }

    return t_w;
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x14f53a
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
movq 0x30(%rdi), %rcx
movq 0x18(%rsi), %rdx
xorpd %xmm0, %xmm0
xorl %edi, %edi
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movl (%rdx,%rdi,4), %r11d
cmpq %r8, %r11
je 0x14f524
movq 0x10(%rcx), %rbx
leaq (%rdi,%rdi,2), %r14
shlq $0x4, %r14
movq (%rbx,%r14), %r9
testq %r9, %r9
je 0x14f524
movq 0x10(%rsi), %r10
movl %r11d, %r15d
shrl %r15d
andl $0x1, %r11d
leaq (%r15,%r15,8), %r15
leaq (%r10,%r15,8), %r15
movl 0x24(%r15,%r11,4), %r11d
addq %r14, %rbx
movq 0x10(%rbx), %rbx
movl $0x1, %ebp
cmpb $0x0, 0x18(%rbx)
js 0x14f516
movl 0x8(%rbx), %r14d
movl (%rdx,%r14,4), %r14d
cmpq %r8, %r14
je 0x14f516
movl %r14d, %r15d
shrl %r15d
andl $0x1, %r14d
leaq (%r15,%r15,8), %r15
leaq (%r10,%r15,8), %r15
movl 0x24(%r15,%r14,4), %r14d
imull %r11d, %r14d
xorps %xmm1, %xmm1
cvtsi2sd %r14d, %xmm1
mulsd (%rbx), %xmm1
addsd %xmm1, %xmm0
movl %ebp, %r14d
addq $0x28, %rbx
incl %ebp
cmpq %r14, %r9
ja 0x14f4d8
incq %rdi
movl %edi, %r9d
cmpq %r9, %rax
ja 0x14f48f
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorps %xmm0, %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: hap_label_fliping(H_partition*, G_partition*, bubble_type*, hc_links*, unsigned int)
void hap_label_fliping(H_partition* hap, G_partition* g_p, bubble_type* bub, hc_links* link, uint32_t chain_id)
{
    long long c_bid, c_uid, l_bid, l_uid;
    uint32_t gid;
    ma_utg_t *u = &(bub->b_ug->u.a[chain_id]);
    hap->b.bid = hap->b.uid = 0;
    while (1)
    {
        gid = next_hap_label_id(&(hap->b), g_p, bub, u, 1, &c_bid, &c_uid);
        if(gid == (uint32_t)-1) break;
        identify_best_interval(&(hap->b), hap->lock, g_p, bub, u, link, c_bid, c_uid, &l_bid, &l_uid);
        if(l_bid == -1 || l_uid == -1) continue;
        
        // fprintf(stderr, "\nbefore weight: %f\n", get_total_weight(hap, g_p));
        // identify_best_interval_debug(&(hap->b), g_p, bub, u, link, c_bid, c_uid, &l_bid, &l_uid);
        if(flip_block(&(hap->b), g_p, bub, u, link, hap->lock, c_bid, c_uid, l_bid, l_uid))
        {
            ///fprintf(stderr, "after weight +: %f\n", get_total_weight(hap, g_p));
            hap->b.bid = l_bid;
            hap->b.uid = l_uid;
            gid = next_hap_label_id(&(hap->b), g_p, bub, u, 1, &c_bid, &c_uid);
            if(gid == (uint32_t)-1) break;
        }
        ///fprintf(stderr, "after weight -: %f\n", get_total_weight(hap, g_p));
        // exit(0);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, 0x20(%rsp)
movq %rdx, %r14
movq %rsi, %r15
movq 0xc0(%rdx), %rax
movl %r8d, %ecx
leaq (%rcx,%rcx,4), %r12
shlq $0x3, %r12
addq 0x10(%rax), %r12
leaq 0x90(%rdi), %rbp
xorps %xmm0, %xmm0
movq %rdi, 0x18(%rsp)
movups %xmm0, 0xb0(%rdi)
subq $0x8, %rsp
leaq 0x10(%rsp), %rax
leaq 0x18(%rsp), %r9
movq %rbp, %rdi
movq %r12, %rcx
movl $0x1, %r8d
pushq %rax
callq 0x14eb12
addq $0x10, %rsp
cmpl $-0x1, %eax
je 0x14f69c
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rsi
movq %rbp, %rdi
movq %r15, %rdx
movq %r14, %rcx
movq %r12, %r8
movq 0x20(%rsp), %r9
leaq 0x28(%rsp), %rax
pushq %rax
leaq 0x38(%rsp), %rax
pushq %rax
pushq 0x18(%rsp)
pushq 0x28(%rsp)
callq 0x14eeaf
addq $0x20, %rsp
movq 0x30(%rsp), %rbx
cmpq $-0x1, %rbx
sete %al
movq 0x28(%rsp), %r13
cmpq $-0x1, %r13
sete %cl
orb %al, %cl
jne 0x14f677
movq 0x18(%rsp), %rax
movq 0x8(%rax), %r9
movq %rbp, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %rcx
movq 0x20(%rsp), %r8
pushq %r13
pushq %rbx
pushq 0x18(%rsp)
pushq 0x28(%rsp)
callq 0x14f2ae
addq $0x20, %rsp
testl %eax, %eax
je 0x14f677
movq 0x18(%rsp), %rax
movq %rbx, 0xb0(%rax)
movq %r13, 0xb8(%rax)
subq $0x8, %rsp
movq %rbp, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %rcx
movl $0x1, %r8d
leaq 0x18(%rsp), %r9
leaq 0x10(%rsp), %rax
pushq %rax
callq 0x14eb12
addq $0x10, %rsp
cmpl $-0x1, %eax
je 0x14f69c
subq $0x8, %rsp
movq %rbp, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %rcx
movl $0x1, %r8d
leaq 0x18(%rsp), %r9
leaq 0x10(%rsp), %rax
jmp 0x14f59d
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: shift_block_phase_type(ma_utg_t*, G_partition*, bubble_type*, block_phase_type*, unsigned int)
uint32_t shift_block_phase_type(ma_utg_t *u, G_partition* g_p, bubble_type* bub, 
block_phase_type* b, uint32_t offset)
{
    long long c_bid, c_uid;
    uint32_t gid, occ = 0;
    b->bid = b->uid = 0;
    while (1)
    {
        if(occ == offset) break;
        gid = next_hap_label_id(b, g_p, bub, u, 1, &c_bid, &c_uid);
        if(gid == (uint32_t)-1) break;
        occ++;
    }
    return occ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rcx)
testl %r8d, %r8d
je 0x14f70a
movl %r8d, %ebx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
xorl %ebp, %ebp
leaq 0x8(%rsp), %rax
movq %rax, (%rsp)
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r13, %rcx
movl $0x1, %r8d
leaq 0x10(%rsp), %r9
callq 0x14eb12
cmpl $-0x1, %eax
je 0x14f70c
incl %ebp
cmpl %ebp, %ebx
jne 0x14f6d6
movl %ebx, %ebp
jmp 0x14f70c
xorl %ebp, %ebp
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_O1/chhylp123[P]hifiasm/hic.cpp
// Function: get_block_phase_type(unsigned long*, G_partition*, bubble_type*, unsigned int, block_phase_type*)
void get_block_phase_type(uint64_t* chain_idx, G_partition* g_p, bubble_type* bub, uint32_t id, block_phase_type* i_b)
{
    uint64_t i;
    ma_utg_t *u = NULL;
    for (i = 0; i < bub->chain_weight.n; i++)
    {
        if(id >= chain_idx[i] && id < chain_idx[i+1]) break;
    }

    u = &(bub->b_ug->u.a[bub->chain_weight.a[i].id]);
    shift_block_phase_type(u, g_p, bub, i_b, id - chain_idx[i]);
    i_b->chainID = bub->chain_weight.a[i].id;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %r8, %rbx
movl %ecx, %r8d
movq %rdx, %r14
movq 0xc8(%rdx), %rax
testq %rax, %rax
je 0x14f756
movl %r8d, %edx
xorl %ecx, %ecx
cmpq %rdx, (%rdi,%rcx,8)
ja 0x14f749
cmpq %rdx, 0x8(%rdi,%rcx,8)
ja 0x14f758
incq %rcx
cmpq %rcx, %rax
jne 0x14f73c
movq %rax, %rcx
jmp 0x14f758
xorl %ecx, %ecx
movq 0xc0(%r14), %rdx
movq 0xd8(%r14), %rax
movq %rcx, %r15
shlq $0x5, %r15
movq 0x10(%rax,%r15), %rax
leaq (%rax,%rax,4), %rax
shlq $0x3, %rax
addq 0x10(%rdx), %rax
subl (%rdi,%rcx,8), %r8d
movq %rax, %rdi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x14f6ab
movq 0xd8(%r14), %rax
movq 0x10(%rax,%r15), %rax
movq %rax, 0x30(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: init_mul_block_phase_type(mul_block_phase_type*, G_partition*, bubble_type*, unsigned int, H_partition*)
void init_mul_block_phase_type(mul_block_phase_type* x, G_partition* g_p, bubble_type* bub, uint32_t n_thread, H_partition* hap)
{
    ma_utg_t *u = NULL;
    uint32_t i, n;
    block_phase_type b;
    x->bub = bub;
    x->n_thread = n_thread;
    CALLOC(x->res, x->n_thread);
    CALLOC(x->x, x->n_thread);
    for (i = 0; i < x->n_thread; i++)
    {
        kv_init(x->x[i].vis);
        kv_malloc(x->x[i].vis, hap->n); 
        x->x[i].vis.n = hap->n;
    }

    x->chain_idx_n = 0;
    MALLOC(x->chain_idx, bub->chain_weight.n+1);
    for (i = n = 0; i < bub->chain_weight.n; i++)
    {
        x->chain_idx[i] = n;
        if(bub->chain_weight.a[i].del) continue;
        u = &(bub->b_ug->u.a[bub->chain_weight.a[i].id]);
        n += shift_block_phase_type(u, g_p, bub, &b, (uint32_t)-1);
        x->chain_idx_n++;
    }
    x->chain_idx[i] = n;///index of chain
    x->chain_ele_occ = n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %r15
movl %ecx, %r13d
movq %rdx, %r14
movq %rsi, 0x8(%rsp)
movq %rdi, %rbx
movq %rdx, 0x10(%rdi)
movl %ecx, 0x8(%rdi)
movl %ecx, %ebp
movl $0x38, %esi
movq %rbp, %rdi
callq 0x2120
movq %rax, 0x30(%rbx)
movl $0x38, %esi
movq %rbp, %rdi
callq 0x2120
movq %rbx, (%rsp)
movq %rax, (%rbx)
testl %r13d, %r13d
je 0x14f835
movq %rax, %r12
movq (%r15), %r13
imulq $0x38, %rbp, %rbx
xorl %r15d, %r15d
xorps %xmm0, %xmm0
movups %xmm0, (%r12,%r15)
movq $0x0, 0x10(%r12,%r15)
movq %r13, 0x8(%r12,%r15)
movq %r13, %rdi
callq 0x2280
movq %rax, 0x10(%r12,%r15)
movq %r13, (%r12,%r15)
addq $0x38, %r15
cmpq %r15, %rbx
jne 0x14f805
movq (%rsp), %rbx
movq $0x0, 0x20(%rbx)
movq 0xc8(%r14), %r13
leaq 0x8(,%r13,8), %rdi
callq 0x2280
movq %rax, %r12
movq %rax, 0x18(%rbx)
xorl %ebp, %ebp
testq %r13, %r13
je 0x14f8cc
movq 0xd8(%r14), %r15
movl $0x1, %ebx
xorl %eax, %eax
movl %ebp, %ecx
movq %rcx, (%r12,%rax,8)
shlq $0x5, %rax
cmpb $0x0, 0x18(%r15,%rax)
jne 0x14f8bf
addq %r15, %rax
movq 0xc0(%r14), %rcx
movq 0x10(%rax), %rax
leaq (%rax,%rax,4), %rdi
shlq $0x3, %rdi
addq 0x10(%rcx), %rdi
movq 0x8(%rsp), %rsi
movq %r14, %rdx
leaq 0x10(%rsp), %rcx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0x14f6ab
addl %eax, %ebp
movq (%rsp), %rax
incq 0x20(%rax)
movl %ebx, %eax
incl %ebx
cmpq %rax, %r13
ja 0x14f871
movl %ebp, %ebp
jmp 0x14f8ce
xorl %eax, %eax
movq %rbp, (%r12,%rax,8)
movq (%rsp), %rax
movq %rbp, 0x28(%rax)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: destory_mul_block_phase_type(mul_block_phase_type*)
void destory_mul_block_phase_type(mul_block_phase_type* x)
{
    uint32_t i;
    free(x->res);
    free(x->chain_idx);
    for (i = 0; i < x->n_thread; i++)
    {
        kv_destroy(x->x[i].vis);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x30(%rdi), %rdi
callq 0x2220
movq 0x18(%rbx), %rdi
callq 0x2220
cmpl $0x0, 0x8(%rbx)
je 0x14f92d
movl $0x10, %r14d
xorl %r15d, %r15d
movq (%rbx), %rax
movq (%rax,%r14), %rdi
callq 0x2220
incq %r15
movl 0x8(%rbx), %eax
addq $0x38, %r14
cmpq %rax, %r15
jb 0x14f912
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: select_max_block_by_utg_multi_thread(H_partition*, G_partition*, bubble_type*, hc_links*, block_phase_type*, unsigned long*, unsigned int, block_res_type*)
void select_max_block_by_utg_multi_thread(H_partition* h, G_partition* g_p, bubble_type* bub, 
hc_links* link, block_phase_type* i_b, uint64_t* chain_idx, uint32_t id, block_res_type* res)
{
    long long c_bid, c_uid, l_bid, l_uid;
    uint32_t gid;
    get_block_phase_type(chain_idx, g_p, bub, id, i_b);

    ma_utg_t *u = &(bub->b_ug->u.a[i_b->chainID]);
    
    gid = next_hap_label_id(i_b, g_p, bub, u, 1, &c_bid, &c_uid);

    if(gid == (uint32_t)-1) return;
    if(identify_best_interval(i_b, h->lock, g_p, bub, u, link, c_bid, c_uid, &l_bid, &l_uid)) return;
    if(l_bid == -1 || l_uid == -1) return;

    if((res->min_w > i_b->weight) || (res->min_w == i_b->weight && id < res->min_idx))
    {
        res->min_w = i_b->weight;
        res->min_f_bid = c_bid;
        res->min_f_uid = c_uid;
        res->min_l_bid = l_bid;
        res->min_l_uid = l_uid;
        res->min_chain_id = i_b->chainID;
        res->min_idx = id;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
movl 0x60(%rsp), %ecx
movq %r9, %rdi
callq 0x14f71d
movq 0xc0(%r15), %rax
movq 0x30(%rbx), %rcx
leaq (%rcx,%rcx,4), %rbp
shlq $0x3, %rbp
addq 0x10(%rax), %rbp
subq $0x8, %rsp
leaq 0x10(%rsp), %rax
leaq 0x18(%rsp), %r9
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbp, %rcx
movl $0x1, %r8d
pushq %rax
callq 0x14eb12
addq $0x10, %rsp
cmpl $-0x1, %eax
je 0x14fa4a
movq 0x8(%r13), %rsi
leaq 0x18(%rsp), %rax
leaq 0x20(%rsp), %r10
movq %rbx, %rdi
movq %r12, %rdx
movq %r15, %rcx
movq %rbp, %r8
movq %r14, %r9
pushq %rax
pushq %r10
pushq 0x18(%rsp)
pushq 0x28(%rsp)
callq 0x14eeaf
addq $0x20, %rsp
testl %eax, %eax
jne 0x14fa4a
movq 0x20(%rsp), %rax
cmpq $-0x1, %rax
sete %dl
movq 0x18(%rsp), %rcx
cmpq $-0x1, %rcx
sete %sil
orb %dl, %sil
jne 0x14fa4a
movq 0x68(%rsp), %rdx
movsd 0x30(%rdx), %xmm1
movsd 0x18(%rbx), %xmm0
ucomisd %xmm0, %xmm1
ja 0x14fa1c
jne 0x14fa4a
jp 0x14fa4a
movl 0x60(%rsp), %esi
cmpq %rsi, 0x28(%rdx)
jle 0x14fa4a
movsd %xmm0, 0x30(%rdx)
movq 0x10(%rsp), %rsi
movq %rsi, 0x8(%rdx)
movq 0x8(%rsp), %rsi
movq %rsi, 0x10(%rdx)
movq %rax, 0x18(%rdx)
movq %rcx, 0x20(%rdx)
movq 0x30(%rbx), %rax
movq %rax, (%rdx)
movl 0x60(%rsp), %eax
movq %rax, 0x28(%rdx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: select_max_block_by_utg_multi_thread_by_chain(H_partition*, G_partition*, bubble_type*, hc_links*, block_phase_type*, unsigned int, block_res_type*)
void select_max_block_by_utg_multi_thread_by_chain(H_partition* h, G_partition* g_p, bubble_type* bub, 
hc_links* link, block_phase_type* i_b, uint32_t id, block_res_type* res)
{
    long long c_bid, c_uid, l_bid, l_uid;
    uint32_t gid;
    ma_utg_t *u = &(bub->b_ug->u.a[id]);
    i_b->bid = i_b->uid = 0; i_b->chainID = id;
    while (1)
    {
        gid = next_hap_label_id(i_b, g_p, bub, u, 1, &c_bid, &c_uid);
        if(gid == (uint32_t)-1) break;

        if(identify_best_interval(i_b, h->lock, g_p, bub, u, link, c_bid, c_uid, &l_bid, &l_uid))
        {
            break;
        }
        if(l_bid == -1 || l_uid == -1) continue;
        if(res->min_w > i_b->weight)
        {
            res->min_w = i_b->weight;
            res->min_f_bid = c_bid;
            res->min_f_uid = c_uid;
            res->min_l_bid = l_bid;
            res->min_l_uid = l_uid;
            res->min_chain_id = i_b->chainID;
            res->min_idx = id;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, %rbx
movq %rcx, 0x20(%rsp)
movq %rdx, %r15
movq %rsi, %r12
movq 0xc0(%rdx), %rax
movl %r9d, %ecx
leaq (%rcx,%rcx,4), %r13
shlq $0x3, %r13
addq 0x10(%rax), %r13
movq %rdi, %rbp
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%r8)
movq %rcx, 0x18(%rsp)
movq %rcx, 0x30(%r8)
subq $0x8, %rsp
leaq 0x10(%rsp), %rax
leaq 0x18(%rsp), %r9
movq %r8, %rdi
movq %r13, %rcx
movl $0x1, %r8d
pushq %rax
callq 0x14eb12
addq $0x10, %rsp
cmpl $-0x1, %eax
je 0x14fb9f
movq 0x70(%rsp), %r14
movq 0x8(%rbp), %rsi
movq %rbx, %rdi
movq %r12, %rdx
movq %r15, %rcx
movq %r13, %r8
movq 0x20(%rsp), %r9
leaq 0x28(%rsp), %rax
pushq %rax
leaq 0x38(%rsp), %rax
pushq %rax
pushq 0x18(%rsp)
pushq 0x28(%rsp)
callq 0x14eeaf
addq $0x20, %rsp
testl %eax, %eax
jne 0x14fb9f
movq 0x30(%rsp), %rax
cmpq $-0x1, %rax
sete %dl
movq 0x28(%rsp), %rcx
cmpq $-0x1, %rcx
sete %sil
orb %dl, %sil
jne 0x14fb6c
movsd 0x30(%r14), %xmm1
movsd 0x18(%rbx), %xmm0
ucomisd %xmm0, %xmm1
jbe 0x14fb6c
movsd %xmm0, 0x30(%r14)
movq 0x10(%rsp), %rdx
movq %rdx, 0x8(%r14)
movq 0x8(%rsp), %rdx
movq %rdx, 0x10(%r14)
movq %rax, 0x18(%r14)
movq %rcx, 0x20(%r14)
movq 0x30(%rbx), %rax
movq %rax, (%r14)
movq 0x18(%rsp), %rax
movq %rax, 0x28(%r14)
subq $0x8, %rsp
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r13, %rcx
movl $0x1, %r8d
leaq 0x18(%rsp), %r9
leaq 0x10(%rsp), %rax
pushq %rax
callq 0x14eb12
addq $0x10, %rsp
cmpl $-0x1, %eax
jne 0x14fad3
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: select_max_block_by_utg(H_partition*, G_partition*, bubble_type*, hc_links*, unsigned int, long long*, long long*, long long*, long long*, double*)
void select_max_block_by_utg(H_partition* hap, G_partition* g_p, bubble_type* bub, hc_links* link, uint32_t chain_id,
long long* min_f_bid, long long* min_f_uid, long long* min_l_bid, long long* min_l_uid, double* min_w)
{
    long long c_bid, c_uid, l_bid, l_uid;
    uint32_t gid;
    ma_utg_t *u = &(bub->b_ug->u.a[chain_id]);
    (*min_w) = 1;
    hap->b.bid = hap->b.uid = 0;
    (*min_f_bid) = (*min_f_uid) = (*min_l_bid) = (*min_l_uid) = -1;
    while (1)
    {
        gid = next_hap_label_id(&(hap->b), g_p, bub, u, 1, &c_bid, &c_uid);
        if(gid == (uint32_t)-1) break;

        if(identify_best_interval(&(hap->b), hap->lock, g_p, bub, u, link, c_bid, c_uid, &l_bid, &l_uid))
        {
            break;
        }
        if(l_bid == -1 || l_uid == -1) continue;
        if((*min_w) > hap->b.weight)
        {
            (*min_w) = hap->b.weight;
            (*min_f_bid) = c_bid;
            (*min_f_uid) = c_uid;
            (*min_l_bid) = l_bid;
            (*min_l_uid) = l_uid;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
movq 0x78(%rsp), %rdx
movq 0x70(%rsp), %rsi
movq 0x68(%rsp), %rdi
movq 0x60(%rsp), %r10
movq 0xc0(%r15), %rax
movl %r8d, %ecx
leaq (%rcx,%rcx,4), %rbp
shlq $0x3, %rbp
addq 0x10(%rax), %rbp
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, (%rdx)
leaq 0x90(%r13), %rbx
xorpd %xmm0, %xmm0
movupd %xmm0, 0xb0(%r13)
movq $-0x1, %rax
movq %rax, (%rsi)
movq %rax, (%rdi)
movq %rax, (%r10)
movq %r9, 0x10(%rsp)
movq %rax, (%r9)
subq $0x8, %rsp
leaq 0x8(%rsp), %rax
leaq 0x10(%rsp), %r9
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbp, %rcx
movl $0x1, %r8d
pushq %rax
callq 0x14eb12
addq $0x10, %rsp
cmpl $-0x1, %eax
je 0x14fee0
movq 0x8(%r13), %rsi
movq %rbx, %rdi
movq %r12, %rdx
movq %r15, %rcx
movq %rbp, %r8
movq %r14, %r9
leaq 0x18(%rsp), %rax
pushq %rax
leaq 0x28(%rsp), %rax
pushq %rax
pushq 0x10(%rsp)
pushq 0x20(%rsp)
callq 0x14eeaf
addq $0x20, %rsp
testl %eax, %eax
jne 0x14fee0
movq 0x20(%rsp), %rax
cmpq $-0x1, %rax
sete %dl
movq 0x18(%rsp), %rcx
cmpq $-0x1, %rcx
sete %sil
orb %dl, %sil
jne 0x14febb
movq 0x78(%rsp), %rdx
movsd (%rdx), %xmm1
movsd 0xa8(%r13), %xmm0
ucomisd %xmm0, %xmm1
jbe 0x14febb
movsd %xmm0, (%rdx)
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rsi
movq %rdx, (%rsi)
movq (%rsp), %rdx
movq 0x60(%rsp), %rsi
movq %rdx, (%rsi)
movq 0x68(%rsp), %rdx
movq %rax, (%rdx)
movq 0x70(%rsp), %rax
movq %rcx, (%rax)
subq $0x8, %rsp
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbp, %rcx
movl $0x1, %r8d
leaq 0x10(%rsp), %r9
leaq 0x8(%rsp), %rax
jmp 0x14fe0d
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: phasing_improvement_by_block(H_partition*, G_partition*, bubble_type*, mul_block_phase_type*)
void phasing_improvement_by_block(H_partition* h, G_partition* g_p, bubble_type* bub, mul_block_phase_type* x)
{
    long long min_u, min_f_bid, min_f_uid, min_l_bid, min_l_uid; 
    double min_w;

    memset(h->lock, 0, sizeof(uint8_t)*h->n);
    while(get_max_block_multi_thread(h, g_p, bub, x, &min_u, &min_f_bid, &min_f_uid, &min_l_bid, &min_l_uid, &min_w))
    ///while(get_max_block(h, g_p, bub, &min_u, &min_f_bid, &min_f_uid, &min_l_bid, &min_l_uid, &min_w))
    {
        ///fprintf(stderr, "\nmin_w: %f, min_u: %lld, min_f_bid: %lld, min_f_uid: %lld, min_l_bid: %lld, min_l_uid: %lld\n", min_w, min_u, min_f_bid, min_f_uid, min_l_bid, min_l_uid);
        ///fprintf(stderr, "before weight: %f\n", get_total_weight(h, g_p));
        flip_block(&(h->b), g_p, bub, &(bub->b_ug->u.a[min_u]), h->link, h->lock, min_f_bid, 
        min_f_uid, min_l_bid, min_l_uid);
        ///fprintf(stderr, "after weight: %f\n", get_total_weight(h, g_p));
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movq (%rdi), %rdx
movq 0x8(%rdi), %rdi
xorl %esi, %esi
callq 0x20e0
leaq 0x30(%rsp), %rax
leaq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %r10
leaq 0x18(%rsp), %r11
leaq 0x28(%rsp), %r8
leaq 0x20(%rsp), %r9
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rcx
pushq %rax
pushq %rdx
pushq %r10
pushq %r11
callq 0x14fbae
addq $0x20, %rsp
testl %eax, %eax
je 0x1501a6
leaq 0x90(%r12), %r13
leaq 0x20(%rsp), %rbp
movq 0xc0(%r14), %rax
movq 0x28(%rsp), %rcx
leaq (%rcx,%rcx,4), %rcx
shlq $0x3, %rcx
addq 0x10(%rax), %rcx
movq 0x8(%r12), %r9
movq 0x30(%r12), %r8
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
pushq 0x8(%rsp)
pushq 0x18(%rsp)
pushq 0x28(%rsp)
pushq 0x38(%rsp)
callq 0x14f2ae
addq $0x20, %rsp
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rcx
leaq 0x28(%rsp), %r8
movq %rbp, %r9
leaq 0x30(%rsp), %rax
pushq %rax
leaq 0x10(%rsp), %rax
pushq %rax
leaq 0x20(%rsp), %rax
pushq %rax
leaq 0x30(%rsp), %rax
pushq %rax
callq 0x14fbae
addq $0x20, %rsp
testl %eax, %eax
jne 0x15012c
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: get_max_unitig(H_partition*, G_partition*, hc_links*, bubble_type*)
uint32_t get_max_unitig(H_partition* h, G_partition* g_p, hc_links* link, bubble_type* bub)
{
    double min, weight;
    uint32_t i, min_i;
     
    for (i = 0, min = 1, min_i = (uint32_t)-1; i < g_p->n; i++)
    {
        if(h->lock[i]) continue;
        weight = 0;
        if(g_p->a[i].h[0] > 0 && (g_p->a[i].status[0] == 1 || g_p->a[i].status[0] == -1))
        {
            weight += (g_p->a[i].weight[0] * g_p->a[i].status[0]);
        }

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

        if(weight >= 0) continue;
        if(weight < min)
        {
            min = weight;
            min_i = i;
        }
    }
    ///fprintf(stderr, "*****************min: %f\n", min);
    return min_i;
}

// Assembly:
movq (%rsi), %rcx
testq %rcx, %rcx
je 0x15040c
movq 0x8(%rdi), %rdx
movsd 0xd4f15(%rip), %xmm0    # 0x225270
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0x40, %edi
xorl %r8d, %r8d
xorpd %xmm1, %xmm1
cmpb $0x0, (%rdx,%r8)
jne 0x1503f8
movq 0x10(%rsi), %r9
xorpd %xmm2, %xmm2
cmpl $0x0, -0x28(%r9,%rdi)
je 0x1503ab
movl -0x1c(%r9,%rdi), %r10d
cmpl $0x1, %r10d
je 0x150398
cmpl $-0x1, %r10d
jne 0x1503ab
xorps %xmm2, %xmm2
cvtsi2sd %r10d, %xmm2
mulsd -0x10(%r9,%rdi), %xmm2
addsd %xmm1, %xmm2
cmpl $0x0, -0x24(%r9,%rdi)
je 0x1503d7
movl -0x18(%r9,%rdi), %r10d
cmpl $0x1, %r10d
je 0x1503c4
cmpl $-0x1, %r10d
jne 0x1503d7
xorps %xmm3, %xmm3
cvtsi2sd %r10d, %xmm3
mulsd -0x8(%r9,%rdi), %xmm3
addsd %xmm3, %xmm2
movsd (%r9,%rdi), %xmm3
addsd %xmm3, %xmm3
addsd %xmm2, %xmm3
ucomisd %xmm1, %xmm3
jae 0x1503f8
ucomisd %xmm3, %xmm0
jbe 0x1503f8
movapd %xmm3, %xmm0
movl %r8d, %eax
incq %r8
movl %r8d, %r9d
addq $0x48, %rdi
cmpq %r9, %rcx
ja 0x15036c
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: flip_by_node(H_partition*, G_partition*, bubble_type*)
void flip_by_node(H_partition* h, G_partition* g_p, bubble_type* bub)
{
    uint32_t i;
    memset(h->lock, 0, sizeof(uint8_t)*h->n);
    

    double pre_w = get_total_weight(h, g_p), current_w;
    uint32_t round = 0;
    while (1)
    {
        memset(h->lock, 0, sizeof(uint8_t)*h->n);
        while (1)
        {
            i = get_max_unitig(h, g_p, h->link, bub);
            if(i == (uint32_t)-1) break;
            h->lock[i] = 1;
            flip_unitig(g_p, h->link, bub, i);
        }
        current_w = get_total_weight(h, g_p);
        ///fprintf(stderr, "[M::%s::round %u, pre_w: %f, current_w: %f]\n", __func__, round, pre_w, current_w);
        if(ceil(current_w) <= ceil(pre_w)) break;
        round++;
        pre_w = current_w;
    }
    
    ///fprintf(stderr, "[M::%s::round %u, before block flipping: %f]\n", __func__, round, get_total_weight(h, g_p));
    
    for (i = 0; i < g_p->n; i++)
    {
        update_partition_flag(h, g_p, h->link, i);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rdx
movq 0x8(%rdi), %rdi
xorl %esi, %esi
callq 0x20e0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x14f469
movsd %xmm0, 0x18(%rsp)
movq (%r14), %rdx
movq 0x8(%r14), %rdi
xorl %esi, %esi
callq 0x20e0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x150343
cmpl $-0x1, %eax
je 0x150478
movq 0x8(%r14), %rcx
movl %eax, %edx
movb $0x1, (%rcx,%rdx)
movq 0x30(%r14), %rsi
movq %rbx, %rdi
movl %eax, %ecx
callq 0x14e820
jmp 0x15044e
movq %r14, %rdi
movq %rbx, %rsi
callq 0x14f469
movsd %xmm0, 0x10(%rsp)
callq 0x2040
movsd %xmm0, 0x8(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x2040
ucomisd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm0
jb 0x15043a
cmpq $0x0, (%rbx)
je 0x1504cc
xorl %r15d, %r15d
movq %r14, %rdi
movq %rbx, %rsi
movl %r15d, %ecx
callq 0x14d999
incl %r15d
cmpq %r15, (%rbx)
ja 0x1504b6
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq