LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: get_shortest_path(unsigned int, pdq*, asg_t*, unsigned int*)
void get_shortest_path(uint32_t src, pdq* pq, asg_t *sg, uint32_t* pre)
{
    uint64_t v, u, i, nv, w;
    asg_arc_t *av = NULL;
    reset_pdq(pq);
    pq->dis.a[src] = 0;
    if(pre) pre[src] = (uint32_t)-1;
    push_pdq(pq, src, 0);
    while (pdq_cnt(*pq) > 0)
    {
        pop_pdq(pq, &v, &w);
        pq->vis.a[v] = 1;

        av = asg_arc_a(sg, v);
        nv = asg_arc_n(sg, v);

        for (i = 0; i < nv; i++)
        {
            if(av[i].del) continue;
            u = av[i].v;
            w = (uint32_t)av[i].ul;

            if(pq->vis.a[u] == 0 && pq->dis.a[u] > pq->dis.a[v] + w)
            {
                pq->dis.a[u] = pq->dis.a[v] + w;
                push_pdq(pq, u, pq->dis.a[u]);
                if(pre) pre[u] = v;
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r15
movl %edi, %ebp
movq $0x1, 0x18(%rsi)
movq 0x28(%rsi), %rax
xorl %ebx, %ebx
movq %rbx, (%rax)
movq 0x30(%rsi), %rdx
movq 0x40(%rsi), %rdi
shlq $0x3, %rdx
movl $0xff, %esi
callq 0x20e0
movq (%r15), %rdx
movq 0x10(%r15), %rdi
xorl %esi, %esi
callq 0x20e0
movq 0x40(%r15), %rax
movl %ebp, %esi
movq %rbx, (%rax,%rsi,8)
testq %r14, %r14
je 0x141cc9
movl $0xffffffff, (%r14,%rsi,4) # imm = 0xFFFFFFFF
movq %r14, 0x18(%rsp)
movq %r15, %rdi
xorl %edx, %edx
callq 0x141a86
movq 0x28(%r15), %rax
cmpq $0x0, (%rax)
je 0x141dbc
movq %r12, 0x10(%rsp)
movq %r15, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x141b50
movq 0x10(%r15), %rax
movq 0x20(%rsp), %rsi
movb $0x1, (%rax,%rsi)
movq 0x28(%r12), %rax
movq (%rax,%rsi,8), %rax
movq %rax, %rcx
movq 0x8(%rsp), %r13
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
andq %rdx, %rcx
je 0x141da4
movq 0x8(%r12), %rdx
shrq $0x20, %rax
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %r14
leaq (%rax,%rax,2), %rax
leaq (%rdx,%rax,8), %rbx
addq $0xc, %rbx
xorl %r12d, %r12d
movq %rsi, (%rsp)
cmpl $0x0, (%rbx,%r12)
js 0x141d9b
movl -0xc(%rbx,%r12), %r13d
movl -0x4(%rbx,%r12), %ebp
movq 0x10(%r15), %rax
cmpb $0x0, (%rax,%rbp)
jne 0x141d9b
movq 0x40(%r15), %rax
movq (%rax,%rsi,8), %rdx
addq %r13, %rdx
cmpq %rdx, (%rax,%rbp,8)
jbe 0x141d9b
movq %rdx, (%rax,%rbp,8)
movq %r15, %rdi
movq %rbp, %rsi
callq 0x141a86
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x141d97
movq (%rsp), %rsi
movl %esi, (%rax,%rbp,4)
jmp 0x141d9b
movq (%rsp), %rsi
addq $0x18, %r12
cmpq %r12, %r14
jne 0x141d49
movq %r13, 0x8(%rsp)
movq 0x28(%r15), %rax
cmpq $0x0, (%rax)
movq 0x10(%rsp), %r12
jne 0x141ceb
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: all_pair_shortest_path(asg_t*, hc_links*, MT*)
void all_pair_shortest_path(asg_t *sg, hc_links* link, MT* M)
{
    hc_linkeage* t = NULL;
    pdq pq;
    init_pdq(&pq, sg->n_seq<<1);
    uint32_t n_vtx = sg->n_seq<<1, v;
    uint64_t k, *p = NULL;

    for (v = 0; v < n_vtx; ++v)
    {
        if (sg->seq[v>>1].del) continue;
        t = &(link->a.a[v>>1]);
        if (t->e.n == 0) continue;
        get_shortest_path(v, &pq, sg, NULL);
        for (k = 0; k < pq.dis.n; k++)
        {
            if(pq.dis.a[k] == (uint64_t)-1) continue;
            kv_pushp(uint64_t, M->matrix.a[v].a, &p);
            (*p) = k << M->uID_shift;
            (*p) = (*p) | pq.dis.a[k];
        }
    }
    
    destory_pdq(&pq);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %rbx
movq %rsi, 0x10(%rsp)
movq %rdi, %r14
movl 0x14(%rdi), %eax
addl %eax, %eax
movslq %eax, %rsi
leaq 0x20(%rsp), %rdi
callq 0x14198e
movq %r14, 0x8(%rsp)
movl 0x14(%r14), %eax
addl %eax, %eax
je 0x141efc
movl %eax, %eax
movq %rax, 0x18(%rsp)
xorl %r13d, %r13d
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rcx
movl %r13d, %eax
shrl %eax
cmpl $0x0, (%rcx,%rax,8)
js 0x141eee
movq 0x10(%rsp), %rcx
movq 0x10(%rcx), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
cmpq $0x0, (%rcx,%rax)
je 0x141eee
movl %r13d, %edi
leaq 0x20(%rsp), %rsi
movq 0x8(%rsp), %rdx
xorl %ecx, %ecx
callq 0x141c64
movq 0x50(%rsp), %r14
testq %r14, %r14
je 0x141eee
movq 0x60(%rsp), %rbp
movq %r13, %r12
shlq $0x5, %r12
xorl %r15d, %r15d
cmpq $-0x1, (%rbp,%r15,8)
je 0x141ee6
movq 0x10(%rbx), %rcx
movq (%rcx,%r12), %rax
cmpq 0x8(%rcx,%r12), %rax
jne 0x141ec3
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
leaq (%rcx,%r12), %rax
movq %rsi, 0x8(%rcx,%r12)
movq 0x10(%rax), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x10(%rbx), %rcx
movq %rax, 0x10(%rcx,%r12)
movq (%rcx,%r12), %rax
movq 0x10(%rcx,%r12), %rdx
leaq 0x1(%rax), %rsi
movq %rsi, (%rcx,%r12)
movb 0x18(%rbx), %cl
movq %r15, %rsi
shlq %cl, %rsi
movq %rsi, (%rdx,%rax,8)
orq (%rbp,%r15,8), %rsi
movq %rsi, (%rdx,%rax,8)
incq %r15
cmpq %r15, %r14
jne 0x141e79
incq %r13
cmpq 0x18(%rsp), %r13
jne 0x141e14
movq 0x48(%rsp), %rdi
callq 0x2220
movq 0x60(%rsp), %rdi
callq 0x2220
movq 0x30(%rsp), %rdi
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2220
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: get_utg_path(unsigned long, unsigned long, unsigned int*, buf_t*)
void get_utg_path(uint64_t s, uint64_t e, uint32_t *path, buf_t *res)
{
    uint64_t p = path[e], i;
    res->b.n = 0;
    kv_push(uint32_t, res->b, e);
    while (p != s)
    {
        kv_push(uint32_t, res->b, p);
        p = path[p];
    }
    kv_push(uint32_t, res->b, s);
    for (i = 0; i < (res->b.n>>1); i++)
    {
        p = res->b.a[i]; 
        res->b.a[i] = res->b.a[res->b.n-i-1];
        res->b.a[res->b.n-i-1] = p;
    }
    res->b.n--;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
movl (%rdx,%rsi,4), %r13d
movq $0x0, 0x38(%rcx)
cmpq $0x0, 0x40(%rcx)
je 0x142109
movq 0x48(%rbx), %rax
xorl %ecx, %ecx
jmp 0x142127
movq $0x2, 0x40(%rbx)
movq 0x48(%rbx), %rdi
movl $0x8, %esi
callq 0x2370
movq %rax, 0x48(%rbx)
movq 0x38(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x38(%rbx)
movl %r12d, (%rax,%rcx,4)
cmpq %r14, %r13
jne 0x14213d
movq %rdx, %rcx
jmp 0x142184
movl $0x2, %r12d
cmpq 0x40(%rbx), %rdx
jne 0x14216c
leaq (%rdx,%rdx), %rsi
testq %rdx, %rdx
cmoveq %r12, %rsi
movq %rsi, 0x40(%rbx)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x48(%rbx)
movq 0x38(%rbx), %rdx
leaq 0x1(%rdx), %rcx
movq %rcx, 0x38(%rbx)
movl %r13d, (%rax,%rdx,4)
movl (%r15,%r13,4), %r13d
movq %rcx, %rdx
cmpq %r14, %r13
jne 0x142143
cmpq 0x40(%rbx), %rcx
jne 0x1421b2
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
movl $0x2, %esi
cmovneq %rdx, %rsi
movq %rsi, 0x40(%rbx)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x48(%rbx)
movq 0x38(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movl %r14d, (%rax,%rcx,4)
cmpq $0x2, %rdx
jb 0x1421e6
shrq %rdx
negq %rdx
leaq (%rax,%rcx,4), %rsi
xorl %edi, %edi
movl (%rax), %r8d
movl (%rsi,%rdi,4), %r9d
movl %r9d, (%rax)
movl %r8d, (%rsi,%rdi,4)
decq %rdi
addq $0x4, %rax
cmpq %rdi, %rdx
jne 0x1421cc
movq %rcx, 0x38(%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: set_utg_by_dis(unsigned int, pdq*, asg_t*, kvec_t_u32_warp*, unsigned int)
void set_utg_by_dis(uint32_t v, pdq* pq, asg_t *g, kvec_t_u32_warp *res, uint32_t dis)
{
    uint64_t r;
    pdq_spec a;
    a.v = (uint64_t)-1; a.src = v; a.pq = pq; a.sg = g; a.df_occ = (uint64_t)-1;
    a.occ = 0; a.flag = (uint8_t)-1; a.dest = NULL; a.pre = NULL;
    reset_pdq(a.pq);
    while (1)
    {
        r = get_specific_shortest_path(&a);
        if(!r) return;
        if(a.pq->dis.a[a.v] <= dis) kv_push(uint32_t, res->a, a.v);
        else return;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r8d, %ebp
movq %rcx, %rbx
movq %rsi, %r15
movq $-0x1, %rax
movq %rsp, %r14
movq %rax, 0x38(%r14)
movl %edi, 0x8(%r14)
movq %rsi, (%r14)
movq %rdx, 0x10(%r14)
movq %rax, 0x30(%r14)
xorl %eax, %eax
movq %rax, 0x28(%r14)
movb $-0x1, 0x20(%r14)
movq %rax, 0x18(%r14)
movq %rax, 0x40(%r14)
movq $0x1, 0x18(%rsi)
movq 0x28(%rsi), %rcx
movq %rax, (%rcx)
movq 0x30(%rsi), %rdx
movq 0x40(%rsi), %rdi
shlq $0x3, %rdx
movl $0xff, %esi
callq 0x20e0
movq (%r15), %rdx
movq 0x10(%r15), %rdi
xorl %esi, %esi
callq 0x20e0
movq %r14, %rdi
callq 0x141f2b
testl %eax, %eax
je 0x142687
movl %ebp, %r15d
movl $0x2, %r12d
movq %rsp, %r14
movq (%rsp), %rax
movq 0x38(%rsp), %r13
movq 0x40(%rax), %rax
cmpq %r15, (%rax,%r13,8)
ja 0x142687
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rcx
jne 0x142670
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
cmoveq %r12, %rsi
movq %rsi, 0x8(%rbx)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbx)
movl %r13d, (%rax,%rcx,4)
movq %r14, %rdi
callq 0x141f2b
testl %eax, %eax
jne 0x14262e
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: fill_utg_distance_multi(asg_t*, hc_links*, MT*, bubble_type*)
void fill_utg_distance_multi(asg_t *sg, hc_links* link, MT* M, bubble_type* bub)
{
    // double index_time = yak_realtime();
    uint32_t i;
    utg_d_t s;
    s.sg = sg; s.link = link; s.M = M; s.bub = bub;
    s.dis_buf = (uint8_t**)malloc(sizeof(uint8_t*)*asm_opt.thread_num);
    for (i = 0; i < (uint32_t)asm_opt.thread_num; i++)
    {
        s.dis_buf[i] = (uint8_t*)malloc(sizeof(uint8_t)*(s.sg->n_seq<<1));
    }
    
    kt_for(asm_opt.thread_num, worker_for_dis, &s, s.sg->n_seq);


    for (i = 0; i < (uint32_t)asm_opt.thread_num; i++)
    {
        free(s.dis_buf[i]);
    }
    free(s.dis_buf);
    // fprintf(stderr, "[M::%s::%.3f]\n", __func__, yak_realtime()-index_time);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
movq %rdi, (%rsp)
movq %rsi, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movq %rcx, 0x18(%rsp)
leaq 0x152a4a(%rip), %r13    # 0x295758
movslq 0x7c(%r13), %r12
leaq (,%r12,8), %rdi
callq 0x2280
movl %r12d, %ebx
movq %rax, 0x20(%rsp)
testq %r12, %r12
je 0x142d52
movq %rax, %r15
movl 0x14(%r14), %r14d
leal (%r14,%r14), %eax
movslq %eax, %r12
xorl %ebp, %ebp
movq %r12, %rdi
callq 0x2280
movq %rax, (%r15,%rbp,8)
incq %rbp
cmpq %rbp, %rbx
jne 0x142d3c
jmp 0x142d56
movl 0x14(%r14), %r14d
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
leaq 0x49(%rip), %rsi        # 0x142dad
movq %rsp, %rdx
movl %ebx, %edi
movq %r14, %rcx
callq 0x108f2c
cmpl $0x0, 0x7c(%r13)
je 0x142d94
xorl %ebx, %ebx
movq 0x20(%rsp), %rax
movq (%rax,%rbx,8), %rdi
callq 0x2220
incq %rbx
movl 0x7c(%r13), %eax
cmpq %rax, %rbx
jb 0x142d7a
movq 0x20(%rsp), %rdi
callq 0x2220
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: init_MT(MT*, unsigned int)
void init_MT(MT* M, uint32_t n_vtx)
{
    uint32_t v;
    kv_init(M->matrix); kv_malloc(M->matrix, n_vtx); M->matrix.n = n_vtx;
    for (v = 0; v < n_vtx; ++v) kv_init(M->matrix.a[v].a);
    for (v = 1; (uint64_t)(1<<v) < n_vtx; v++);
    M->uID_shift = 64 - v; M->dis_mode = ((uint64_t)-1) >> v; 
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movl %esi, %r15d
movq %r15, 0x8(%rdi)
movq %r15, %r14
shlq $0x5, %r14
movq %r14, %rdi
callq 0x2280
movq %rax, 0x10(%rbx)
movq %r15, (%rbx)
testl %ebp, %ebp
je 0x14320b
xorl %ecx, %ecx
xorps %xmm0, %xmm0
movups %xmm0, (%rax,%rcx)
movq $0x0, 0x10(%rax,%rcx)
addq $0x20, %rcx
cmpq %rcx, %r14
jne 0x1431f5
xorl %ecx, %ecx
incl %ecx
movl $0x1, %eax
shll %cl, %eax
cltq
cmpq %r15, %rax
jb 0x14320d
movl $0x40, %eax
subl %ecx, %eax
movq %rax, 0x18(%rbx)
movq $-0x1, %rax
shrq %cl, %rax
movq %rax, 0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: get_trans_ug_arch(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, asg_arc_t*)
int get_trans_ug_arch(uint32_t qn, uint32_t qs, uint32_t qe, uint32_t qLen, 
uint32_t tn, uint32_t ts, uint32_t te, uint32_t tLen, uint32_t rev, asg_arc_t* t)
{
    ma_hit_t h;
    h.qns = qn;
    h.qns = h.qns << 32;
    h.qns = h.qns | qs;
    h.qe = qe;
    h.tn = tn;
    h.ts = ts;
    h.te = te;
    h.rev = rev;
    h.del = 0;
    h.bl = h.el = h.ml = h.no_l_indel = 0;
    return ma_hit2arc(&h, qLen, tLen, MAX(qLen, tLen) + 1, 0, 0, t);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl 0x40(%rsp), %r11d
movl 0x48(%rsp), %r14d
movl 0x38(%rsp), %r10d
cmpl %r11d, %ecx
movl %r11d, %eax
cmoval %ecx, %eax
incl %eax
subl %r10d, %r11d
testb $0x1, %r14b
movl %r9d, %r15d
cmovel %r11d, %r15d
cmovel %r9d, %r11d
cmpl %esi, %r11d
movl %esi, %ebp
cmovll %r11d, %ebp
movl %ecx, %r12d
subl %edx, %r12d
cmpl %r15d, %r12d
movl %r15d, %ebx
cmovll %r12d, %ebx
cmpl %eax, %ebp
setg %r13b
cmpl %eax, %ebx
setg %al
orb %r13b, %al
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jne 0x143398
cmpl %r11d, %esi
setg %al
cmpl %r15d, %r12d
setg %r13b
orb %al, %r13b
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpb $0x1, %r13b
jne 0x143398
cmpl %r15d, %r12d
setl %al
cmpl %r11d, %esi
setl %r12b
orb %al, %r12b
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
cmpb $0x1, %r12b
jne 0x143398
testb $0x1, %r14b
sete %r12b
addl %edx, %r15d
movl %ecx, %eax
subl %r15d, %eax
xorl %r14d, %r14d
subl %esi, %edx
subl %r11d, %esi
setg %r11b
cmovlel %eax, %esi
setle %r15b
addl %ebp, %ebx
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
addl %ebx, %edx
js 0x143398
subl %r9d, %r10d
addl %ebx, %r10d
js 0x143398
movq 0x50(%rsp), %rax
movl %edi, %edx
addq %rdx, %rdx
movb %r15b, %r14b
xorb %r11b, %r12b
movzbl %r12b, %edi
andl $-0x2, %edx
orl %edx, %r14d
leal (%rdi,%r8,2), %edx
shlq $0x20, %r14
movl %esi, %edi
orq %r14, %rdi
movq %rdi, (%rax)
movl %edx, 0x8(%rax)
subl %esi, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, 0xc(%rax)
movb $0x0, 0x12(%rax)
andb $0x3f, 0x11(%rax)
movl %esi, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: get_hc_edge(hc_links*, unsigned long, unsigned long, unsigned long)
hc_edge* get_hc_edge(hc_links* link, uint64_t src, uint64_t dest, uint64_t dir)
{
    if(src >= link->a.n) return NULL;
    uint64_t i, n;
    hc_edge* a = NULL;
    if(dir == 0)
    {
        n = link->a.a[src].e.n;
        a = link->a.a[src].e.a;
    }
    else
    {
        n = link->a.a[src].f.n;
        a = link->a.a[src].f.a;
    }
    
    for (i = 0; i < n; i++)
    {
        if(a[i].del) continue;
        if(a[i].uID == dest) return &(a[i]);
    }

    return NULL;
}

// Assembly:
cmpq %rsi, (%rdi)
jbe 0x144245
movq 0x10(%rdi), %rax
leaq (%rsi,%rsi,2), %rsi
shlq $0x4, %rsi
leaq (%rax,%rsi), %rdi
testq %rcx, %rcx
leaq 0x18(%rax,%rsi), %rax
cmoveq %rdi, %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0x144245
movq 0x10(%rax), %rax
cmpb $0x0, 0x18(%rax)
js 0x14423c
movl 0x8(%rax), %esi
cmpq %rdx, %rsi
je 0x144247
addq $0x28, %rax
decq %rcx
jne 0x14422e
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: set_reverse_links(unsigned int*, unsigned int, kvec_t_u32_warp*, unsigned int, hc_links*)
void set_reverse_links(uint32_t* bub, uint32_t n, kvec_t_u32_warp* reach, uint32_t root, hc_links* link)
{
    uint64_t i, k, d = RC_0;
    uint32_t v;
    for (i = 0; i < n; i++)
    {
        v = bub[i]>>1;
        if(v == root) continue;
        for (k = 0; k < reach->a.n; k++)
        {
            if(v == reach->a.a[k]) break;
        }

        ///if(k == reach->a.n && reach->a.n > 0)
        if(k == reach->a.n)
        {
            push_hc_edge(&(link->a.a[root]), v, 1, 1, &d);
            push_hc_edge(&(link->a.a[v]), root, 1, 1, &d);
        }
    }
    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, 0x20(%rsp)
movq $0x0, (%rsp)
testl %esi, %esi
je 0x145ad7
movl %ecx, %r12d
movq %rdx, %r15
movl %esi, %ebp
movl %ecx, %eax
xorl %ebx, %ebx
movq %rax, 0x10(%rsp)
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
movq %rax, 0x8(%rsp)
movq %rdi, 0x18(%rsp)
movq 0x20(%rsp), %r14
movl (%rdi,%rbx,4), %r13d
shrl %r13d
cmpl %r12d, %r13d
je 0x145acb
movq (%r15), %rax
testq %rax, %rax
je 0x145a71
movq 0x10(%r15), %rdx
xorl %ecx, %ecx
cmpl (%rdx,%rcx,4), %r13d
je 0x145a73
incq %rcx
cmpq %rcx, %rax
jne 0x145a61
jmp 0x145a78
xorl %ecx, %ecx
cmpq %rax, %rcx
jne 0x145acb
movq 0x10(%r14), %rdi
addq 0x8(%rsp), %rdi
movq %r13, %rsi
movsd 0xeb884(%rip), %xmm0    # 0x231310
movl $0x1, %edx
movq %rsp, %rcx
callq 0x1416e0
leaq (,%r13,2), %rdi
addq %r13, %rdi
shlq $0x4, %rdi
addq 0x10(%r14), %rdi
movq 0x10(%rsp), %rsi
movsd 0xeb857(%rip), %xmm0    # 0x231310
movl $0x1, %edx
movq %rsp, %rcx
callq 0x1416e0
movq 0x18(%rsp), %rdi
incq %rbx
cmpq %rbp, %rbx
jne 0x145a47
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: load_hc_links(hc_links*, char const*)
int load_hc_links(hc_links* link, const char *fn)
{
    uint64_t k, flag = 0;
    char *buf = (char*)calloc(strlen(fn) + 25, 1);
	sprintf(buf, "%s.hic.link.bin", fn);

    FILE* fp = NULL; 
    fp = fopen(buf, "r"); 
    if(!fp)
    {
        free(buf);
        return 0;
    } 
    

    kv_init(link->a);
    flag += fread(&link->a.n, sizeof(link->a.n), 1, fp);
    link->a.m = link->a.n; CALLOC(link->a.a, link->a.n);
    for (k = 0; k < link->a.n; k++)
    {
        flag += fread(&link->a.a[k].e.n, sizeof(link->a.a[k].e.n), 1, fp);
        link->a.a[k].e.m = link->a.a[k].e.n; MALLOC(link->a.a[k].e.a, link->a.a[k].e.n);
        flag += fread(link->a.a[k].e.a, sizeof(hc_edge), link->a.a[k].e.n, fp);

        flag += fread(&link->a.a[k].f.n, sizeof(link->a.a[k].f.n), 1, fp);
        link->a.a[k].f.m = link->a.a[k].f.n; MALLOC(link->a.a[k].f.a, link->a.a[k].f.n);
        flag += fread(link->a.a[k].f.a, sizeof(hc_edge), link->a.a[k].f.n, fp);
    }

    kv_init(link->enzymes);
    flag += fread(&link->enzymes.n, sizeof(link->enzymes.n), 1, fp);
    link->enzymes.m = link->enzymes.n; MALLOC(link->enzymes.a, link->enzymes.n);
    flag += fread(link->enzymes.a, sizeof(uint64_t), link->enzymes.n, fp);

    fclose(fp);
    free(buf);
    fprintf(stderr, "[M::%s::] ==> Hi-C linkages have been loaded\n", __func__);
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x2090
leaq 0x19(%rax), %rdi
movl $0x1, %esi
callq 0x2120
movq %rax, %r14
leaq 0xf563b(%rip), %rsi     # 0x23b7a9
xorl %ebp, %ebp
movq %rax, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0xf9673(%rip), %rsi     # 0x23f7f7
movq %r14, %rdi
callq 0x2210
testq %rax, %rax
jne 0x1461a6
movq %r14, %rdi
callq 0x2220
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x1c41f
movl $0x1, %ebp
jmp 0x146199
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: write_hc_hits(kvec_pe_hit*, ma_ug_t*, char const*)
void write_hc_hits(kvec_pe_hit* hits, ma_ug_t* ug, const char *fn)
{
    char *buf = (char*)calloc(strlen(fn) + 25, 1);
    sprintf(buf, "%s.hic.lk.bin", fn);
    FILE* fp = fopen(buf, "w");

    fwrite(&hits->a.n, sizeof(hits->a.n), 1, fp);
    fwrite(hits->a.a, sizeof(pe_hit), hits->a.n, fp);
    write_dbug(ug, fp);

    fclose(fp);
    free(buf);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r15
movq %rdx, %rdi
callq 0x2090
leaq 0x19(%rax), %rdi
movl $0x1, %esi
callq 0x2120
movq %rax, %r14
leaq 0xf5647(%rip), %rsi     # 0x23b833
movq %rax, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x1024e2(%rip), %rsi    # 0x2486e2
movq %r14, %rdi
callq 0x2210
movq %rax, %r12
movl $0x8, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %rax, %rcx
callq 0x2410
movq (%r15), %rdx
movq 0x10(%r15), %rdi
movl $0x20, %esi
movq %r12, %rcx
callq 0x2410
movq %rbx, %rdi
movq %r12, %rsi
callq 0xc3874
movq %r12, %rdi
callq 0x2190
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2220
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: write_hc_hits_v14(kvec_pe_hit_hap*, char const*)
void write_hc_hits_v14(kvec_pe_hit_hap* i_hits, const char *fn)
{
    char *buf = (char*)calloc(strlen(fn) + 25, 1);
	sprintf(buf, "%s.v14.hic.lk.bin", fn);
    FILE* fp = fopen(buf, "w");
    kvec_pe_hit hits; 
    kv_init(hits.a);
    uint64_t i, m_u = (uint64_t)-1, m_m = (uint64_t)-1;
    pe_hit* p = NULL;
    for (i = 0; i < i_hits->n; i++)
    {
        if(i_hits->a[i].occ1 == 1 && i_hits->a[i].occ2 == 1) 
        {
            kv_pushp(pe_hit, hits.a, &p);
            p->id = i_hits->a[i].id;
            p->s = i_hits->a[i].a[0];
            p->e = i_hits->a[i].a[1];
            m_u = i;
        }
        else
        {
            if(m_m == (uint64_t)-1) m_m = i;
        }
    }
    fprintf(stderr, "m_u: %lu, m_m: %lu, n_u: %lu\n", m_u, m_m, i_hits->n_u);

    fwrite(&hits.a.n, sizeof(hits.a.n), 1, fp);
    fwrite(hits.a.a, sizeof(pe_hit), hits.a.n, fp);

    kv_destroy(hits.a);
    fclose(fp);
    free(buf);
    exit(1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movq %rdi, %r15
movq %rsi, %rdi
callq 0x2090
leaq 0x19(%rax), %rdi
movl $0x1, %esi
callq 0x2120
movq %rax, %rbx
leaq 0xf55b3(%rip), %rsi     # 0x23b841
xorl %r12d, %r12d
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x10243d(%rip), %rsi    # 0x2486e2
movq %rbx, 0x8(%rsp)
movq %rbx, %rdi
callq 0x2210
movq %r15, %r8
movq %rax, (%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x8(%r15), %rax
testq %rax, %rax
jne 0x1462eb
movq $-0x1, %rdx
xorl %ebx, %ebx
xorl %r14d, %r14d
movq $-0x1, %r13
jmp 0x146393
movq (%r8), %rcx
movq $-0x1, %r13
xorl %ebp, %ebp
movq $-0x1, %rdx
xorl %r15d, %r15d
xorl %r14d, %r14d
xorl %ebx, %ebx
xorl %r12d, %r12d
cmpw $0x1, 0x10(%rcx,%rbp)
jne 0x14637b
cmpw $0x1, 0x12(%rcx,%rbp)
jne 0x14637b
cmpq %rbx, %r14
jne 0x14634d
leaq (%r14,%r14), %rbx
testq %r14, %r14
movl $0x2, %eax
cmoveq %rax, %rbx
movq %rbx, %rsi
shlq $0x5, %rsi
movq %r12, %rdi
movq %r8, %r12
callq 0x2370
movq %r12, %r8
movq %rax, %r12
movq (%r8), %rcx
movq 0x8(%r8), %rax
leaq 0x1(%r14), %rdx
shlq $0x5, %r14
movq 0x8(%rcx,%rbp), %rsi
movq %rsi, 0x10(%r12,%r14)
movq (%rcx,%rbp), %rsi
movq (%rsi), %rdi
movq %rdi, (%r12,%r14)
movq 0x8(%rsi), %rsi
movq %rsi, 0x8(%r12,%r14)
movq %rdx, %r14
movq %r15, %rdx
jmp 0x146383
cmpq $-0x1, %r13
cmoveq %r15, %r13
incq %r15
addq $0x18, %rbp
cmpq %rax, %r15
jb 0x146309
leaq 0x10(%rsp), %rbp
movq %r14, (%rbp)
movq %rbx, 0x8(%rbp)
movq %r12, 0x10(%rbp)
movq 0x14ec35(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
movq 0x18(%r8), %r8
leaq 0xf549a(%rip), %rsi     # 0x23b853
movq %r13, %rcx
xorl %eax, %eax
callq 0x22b0
movl $0x8, %esi
movl $0x1, %edx
movq %rbp, %rdi
movq (%rsp), %rbx
movq %rbx, %rcx
callq 0x2410
movq (%rbp), %rdx
movq 0x10(%rbp), %r15
movl $0x20, %esi
movq %r15, %rdi
movq %rbx, %rcx
callq 0x2410
movq %r15, %rdi
callq 0x2220
movq %rbx, %rdi
callq 0x2190
movq 0x8(%rsp), %rdi
callq 0x2220
movl $0x1, %edi
callq 0x2250
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: load_hc_hits(kvec_pe_hit*, ma_ug_t*, char const*)
int load_hc_hits(kvec_pe_hit* hits, ma_ug_t* ug, const char *fn)
{
    uint64_t flag = 0;
    char *buf = (char*)calloc(strlen(fn) + 25, 1);
    sprintf(buf, "%s.hic.lk.bin", fn);

    FILE* fp = NULL; 
    fp = fopen(buf, "r"); 
    if(!fp) 
    {
        free(buf);
        return 0;
    }
    

    kv_init(hits->a);
    flag += fread(&hits->a.n, sizeof(hits->a.n), 1, fp);
    hits->a.m = hits->a.n; MALLOC(hits->a.a, hits->a.n);
    flag += fread(hits->a.a, sizeof(pe_hit), hits->a.n, fp);
    free(buf);

    if(!test_dbug(ug, fp))
    {
        free(hits->a.a);
        kv_init(hits->a);
        fclose(fp);
        fprintf(stderr, "[M::%s::] ==> Renew Hi-C linkages\n", __func__);
        return 0;
    }

    fclose(fp);
    fprintf(stderr, "[M::%s::] ==> Hi-C linkages have been loaded\n", __func__);
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movq %rdx, %rdi
callq 0x2090
leaq 0x19(%rax), %rdi
movl $0x1, %esi
callq 0x2120
movq %rax, %r15
leaq 0xf4af7(%rip), %rsi     # 0x23b833
xorl %ebp, %ebp
movq %rax, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0xf8aa5(%rip), %rsi     # 0x23f7f7
movq %r15, %rdi
callq 0x2210
testq %rax, %rax
jne 0x146d78
movq %r15, %rdi
callq 0x2220
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r12
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
movl $0x8, %esi
movl $0x1, %edx
movq %rbx, %rdi
movq %rax, %rcx
callq 0x22f0
movq (%rbx), %r13
movq %r13, 0x8(%rbx)
movq %r13, %rdi
shlq $0x5, %rdi
callq 0x2280
movq %rax, 0x10(%rbx)
movl $0x20, %esi
movq %rax, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0x22f0
movq %r15, %rdi
callq 0x2220
movq %r14, %rdi
movq %r12, %rsi
callq 0xc3645
testl %eax, %eax
jne 0x146df5
leaq 0x10(%rbx), %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x1c5c1
xorl %ebp, %ebp
jmp 0x146d67
movq %r12, %rdi
callq 0x1c59b
movl $0x1, %ebp
jmp 0x146d67
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: normalize_hc_links(hc_links*)
void normalize_hc_links(hc_links* link)
{
    uint64_t i, k;
    for (i = 0; i < link->a.n; ++i) 
    { 
        for (k = 0; k < link->a.a[i].e.n; k++)
        {
            if(link->a.a[i].e.a[k].del) continue;
            link->a.a[i].e.a[k].weight *= 100;
            link->a.a[i].e.a[k].weight /= (double)(MIN(link->enzymes.a[i], link->enzymes.a[link->a.a[i].e.a[k].uID])); 
            ///link->a.a[i].e.a[k].weight /= (double)(link->enzymes.a[i] + link->enzymes.a[link->a.a[i].e.a[k].uID]); 
        }
    }
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x1470ff
movq 0x10(%rdi), %rcx
xorl %edx, %edx
movsd 0xf2633(%rip), %xmm0    # 0x2396b0
movq 0xea1fb(%rip), %xmm1    # 0x231280
movapd 0xea203(%rip), %xmm2    # 0x231290
leaq (%rdx,%rdx,2), %r8
shlq $0x4, %r8
movq (%rcx,%r8), %rsi
testq %rsi, %rsi
je 0x1470f7
addq %rcx, %r8
movq 0x10(%r8), %r8
cmpb $0x0, 0x18(%r8)
js 0x1470ee
movsd (%r8), %xmm3
mulsd %xmm0, %xmm3
movq 0x28(%rdi), %r9
movq (%r9,%rdx,8), %r10
movl 0x8(%r8), %r11d
movq (%r9,%r11,8), %r9
cmpq %r9, %r10
cmovbq %r10, %r9
movq %r9, %xmm4
punpckldq %xmm1, %xmm4    # xmm4 = xmm4[0],xmm1[0],xmm4[1],xmm1[1]
subpd %xmm2, %xmm4
movapd %xmm4, %xmm5
unpckhpd %xmm4, %xmm5            # xmm5 = xmm5[1],xmm4[1]
addsd %xmm4, %xmm5
divsd %xmm5, %xmm3
movsd %xmm3, (%r8)
addq $0x28, %r8
decq %rsi
jne 0x1470a5
incq %rdx
cmpq %rax, %rdx
jne 0x14708d
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: get_rGraph_edge(min_cut_t*, unsigned long, unsigned long)
hc_edge* get_rGraph_edge(min_cut_t* x, uint64_t src, uint64_t dest)
{
    if(src >= x->rGraph.n) return NULL;
    uint64_t i;
    for (i = 0; i < x->rGraph.a[src].n; i++)
    {
        if(x->rGraph.a[src].a[i].del) continue;
        if(x->rGraph.a[src].a[i].uID == dest) return &(x->rGraph.a[src].a[i]);
    }
    return NULL;
}

// Assembly:
cmpq %rsi, (%rdi)
jbe 0x147135
movq 0x10(%rdi), %rax
leaq (%rsi,%rsi,2), %rsi
movq (%rax,%rsi,8), %rcx
testq %rcx, %rcx
je 0x147135
leaq (%rax,%rsi,8), %rax
movq 0x10(%rax), %rax
cmpb $0x0, 0x18(%rax)
js 0x14712c
movl 0x8(%rax), %esi
cmpq %rdx, %rsi
je 0x147137
addq $0x28, %rax
decq %rcx
jne 0x14711e
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: destory_min_cut_t(min_cut_t*)
void destory_min_cut_t(min_cut_t* x)
{
    kv_destroy(x->order);
    kv_destroy(x->parent);
    kv_destroy(x->p_weight);
    kv_destroy(x->rGraphSet);
    kv_destroy(x->rGraphVis);
    kv_destroy(x->utgVis);
    kv_destroy(x->bmerVis);
    destory_pdq(&(x->pq));
    uint64_t i;
    for (i = 0; i < x->rGraph.m; i++)
    {
        kv_destroy(x->rGraph.a[i]);
    }
    kv_destroy(x->rGraph);
    kdq_destroy(uint64_t, x->q);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x28(%rdi), %rdi
callq 0x2220
movq 0x110(%rbx), %rdi
callq 0x2220
movq 0x128(%rbx), %rdi
callq 0x2220
movq 0xa8(%rbx), %rdi
callq 0x2220
movq 0xc0(%rbx), %rdi
callq 0x2220
movq 0xd8(%rbx), %rdi
callq 0x2220
movq 0xf0(%rbx), %rdi
callq 0x2220
leaq 0x30(%rbx), %rdi
callq 0x141a1d
cmpq $0x0, 0x8(%rbx)
je 0x1475c2
movl $0x10, %r14d
xorl %r15d, %r15d
movq 0x10(%rbx), %rax
movq (%rax,%r14), %rdi
callq 0x2220
incq %r15
addq $0x18, %r14
cmpq 0x8(%rbx), %r15
jb 0x1475a8
movq 0x10(%rbx), %rdi
callq 0x2220
movq 0xf8(%rbx), %rbx
testq %rbx, %rbx
je 0x1475ed
movq 0x18(%rbx), %rdi
callq 0x2220
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2220
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: reset_min_cut_t(min_cut_t*, hc_links*)
void reset_min_cut_t(min_cut_t* x, hc_links* link)
{
    ///no need to reset parent[] and q
    uint64_t i, j;
    ///important to have this line
    x->bmerVis.n = x->parent.n = x->p_weight.n = x->order.n = x->rGraph.n = x->rGraphVis.n = x->rGraphSet.n = link->a.n;
    kdq_clear(x->q);

    for (i = 0; i < x->rGraphSet.n; i++)
    {
        x->rGraphVis.a[i] = 0;
        ///x->bmerVis.a[i] = 0;
        ///important to have this line
        x->rGraph.a[i].n = link->a.a[i].e.n;

        if(x->rGraphSet.a[i] == 0) continue;
        for (j = 0; j < x->rGraph.a[i].n; j++)
        {
            x->rGraph.a[i].a[j].weight = link->a.a[i].e.a[j].weight;
        }
        x->rGraphSet.a[i] = 0;
    }
}

// Assembly:
movq (%rsi), %rax
movq %rax, 0x98(%rdi)
movq %rax, 0xb0(%rdi)
movq %rax, (%rdi)
movq %rax, 0x18(%rdi)
movq %rax, 0x118(%rdi)
movq %rax, 0x100(%rdi)
movq %rax, 0xe0(%rdi)
movq 0xf8(%rdi), %rax
movabsq $-0x400000000000000, %rcx # imm = 0xFC00000000000000
andq %rcx, (%rax)
movq 0xf8(%rdi), %rax
movq $0x0, 0x8(%rax)
cmpq $0x0, 0x98(%rdi)
je 0x1476bc
xorl %eax, %eax
movq 0xc0(%rdi), %rcx
movb $0x0, (%rcx,%rax)
movq 0x10(%rsi), %r8
leaq (%rax,%rax,2), %r9
movq %r9, %r10
shlq $0x4, %r10
movq (%r8,%r10), %rcx
movq 0x10(%rdi), %r11
movq %rcx, (%r11,%r9,8)
movq 0xa8(%rdi), %rdx
cmpb $0x0, (%rdx,%rax)
je 0x1476b0
testq %rcx, %rcx
je 0x1476ac
leaq (%r11,%r9,8), %r9
movq 0x10(%r8,%r10), %r8
movq 0x10(%r9), %r9
xorl %r10d, %r10d
movsd (%r8,%r10), %xmm0
movsd %xmm0, (%r9,%r10)
addq $0x28, %r10
decq %rcx
jne 0x147697
movb $0x0, (%rdx,%rax)
incq %rax
cmpq 0x98(%rdi), %rax
jb 0x14764f
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: update_link_by_min_cut_t(min_cut_t*, hc_links*)
void update_link_by_min_cut_t(min_cut_t* x, hc_links* link)
{
    uint64_t i, j;

    for (i = 0; i < link->a.n; i++)
    {
        for (j = 0; j < link->a.a[i].e.n; j++)
        {
            link->a.a[i].e.a[j].del = x->rGraph.a[i].a[j].del;
        }
    }
}

// Assembly:
movq (%rsi), %r8
testq %r8, %r8
je 0x147733
pushq %rbx
movq 0x10(%rsi), %rcx
xorl %eax, %eax
leaq (%rax,%rax,2), %rdx
movq %rdx, %r9
shlq $0x4, %r9
cmpq $0x0, (%rcx,%r9)
je 0x14772a
movl $0x18, %r8d
movq %rax, %r9
shlq $0x4, %r9
leaq (%r9,%r9,2), %r9
xorl %r10d, %r10d
movq 0x10(%rdi), %r11
movq 0x10(%r11,%rdx,8), %r11
movb (%r11,%r8), %r11b
andb $-0x80, %r11b
movq 0x10(%rcx,%r9), %rcx
movb (%rcx,%r8), %bl
andb $0x7f, %bl
orb %r11b, %bl
movb %bl, (%rcx,%r8)
incq %r10
movq 0x10(%rsi), %rcx
addq $0x28, %r8
cmpq (%rcx,%r9), %r10
jb 0x1476f2
movq (%rsi), %r8
incq %rax
cmpq %r8, %rax
jb 0x1476cc
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: print_path(unsigned long, unsigned long, min_cut_t*)
uint64_t print_path(uint64_t src, uint64_t dest, min_cut_t* x)
{
    double flow = 0, max_flow = 0;
    uint64_t v, u;
    hc_edge *p;

    if(bfs_flow(src, dest, x, NULL))
    {
        kdq_clear(x->q);
        flow = DBL_MAX;
        for (v = dest; v != src; v = x->parent.a[v])
        {
            flow = MIN(flow, x->p_weight.a[v]);
        }

        /*******************************for debug************************************/
        fprintf(stderr, "***********flow: %f*********\n", flow);
        /*******************************for debug************************************/

        for (v = dest; v != src; v = x->parent.a[v])
        {
            u = x->parent.a[v];
            p = get_rGraph_edge(x, u, v);

            /*******************************for debug************************************/
            fprintf(stderr, "utg%.6lul (%f)\n", u+1, p->weight);
            /*******************************for debug************************************/
        }

        max_flow += flow;
    }
    
    return (max_flow != 0);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
xorl %r12d, %r12d
xorl %ecx, %ecx
callq 0x147c19
testq %rax, %rax
jne 0x14831f
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0xf8(%r15), %rax
movabsq $-0x400000000000000, %rcx # imm = 0xFC00000000000000
andq %rcx, (%rax)
movq 0xf8(%r15), %rax
movq $0x0, 0x8(%rax)
cmpq %rbx, %r14
jne 0x148356
callq 0x1c67f
movsd 0xe92bc(%rip), %xmm1    # 0x231610
jmp 0x1483c0
movq 0x110(%r15), %rax
movq 0x128(%r15), %rcx
movsd 0xe92a4(%rip), %xmm0    # 0x231610
movq %r14, %rdx
movapd %xmm0, %xmm3
movsd (%rcx,%rdx,8), %xmm1
cmplesd %xmm1, %xmm3
movapd %xmm3, %xmm2
andnpd %xmm1, %xmm2
andpd %xmm0, %xmm3
orpd %xmm2, %xmm3
movapd %xmm3, %xmm0
movl (%rax,%rdx,4), %edx
cmpq %rbx, %rdx
jne 0x148373
movq 0x14cc40(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0xf3646(%rip), %rsi     # 0x23b9f0
movapd %xmm0, (%rsp)
movb $0x1, %al
callq 0x22b0
cmpq %rbx, %r14
jne 0x1483d7
movapd (%rsp), %xmm1
xorpd %xmm0, %xmm0
cmpneqsd %xmm1, %xmm0
movq %xmm0, %r12
andl $0x1, %r12d
jmp 0x148310
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x1c60d
jmp 0x1483bb
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: print_rGraph(min_cut_t*)
void print_rGraph(min_cut_t* x)
{
    uint64_t i, k;
    for (i = 0; i < x->rGraph.n; ++i) 
    { 
        for (k = 0; k < x->rGraph.a[i].n; k++)
        {
            if(x->rGraph.a[i].a[k].del) continue;
            fprintf(stderr, "src(utg%.6dl, enz:%lu)\tdes(utg%.6dl, enz:%lu)\t%f\n", 
            (int)(i+1), x->enzymes[i], 
            (int)(x->rGraph.a[i].a[k].uID+1), x->enzymes[x->rGraph.a[i].a[k].uID], 
            x->rGraph.a[i].a[k].weight);    
        }
    }
}

// Assembly:
movq (%rdi), %rcx
testq %rcx, %rcx
je 0x1485ef
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rax
xorl %r15d, %r15d
leaq (%r15,%r15,2), %r13
cmpq $0x0, (%rax,%r13,8)
je 0x1485d9
leal 0x1(%r15), %ebp
xorl %r12d, %r12d
xorl %r14d, %r14d
movq 0x10(%rax,%r13,8), %rdx
cmpb $0x0, 0x18(%rdx,%r12)
jns 0x148598
incq %r14
addq $0x28, %r12
cmpq (%rax,%r13,8), %r14
jb 0x14857c
jmp 0x1485d6
movq 0x14ca41(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
movq 0x130(%rbx), %rax
movq (%rax,%r15,8), %rcx
movl 0x8(%rdx,%r12), %esi
leal 0x1(%rsi), %r8d
movq (%rax,%rsi,8), %r9
movsd (%rdx,%r12), %xmm0
leaq 0xf3565(%rip), %rsi     # 0x23bb2c
movl %ebp, %edx
movb $0x1, %al
callq 0x22b0
movq 0x10(%rbx), %rax
jmp 0x148589
movq (%rbx), %rcx
incq %r15
cmpq %rcx, %r15
jb 0x148567
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: select_large_node(ma_ug_t const*, min_cut_t*, unsigned long, unsigned long, unsigned long, int)
int select_large_node(const ma_ug_t *ug, min_cut_t* x, 
uint64_t src, uint64_t dest, uint64_t utg_thres, int weight_thres)
{
    if(src >= ug->u.n || dest >= ug->u.n) return 0;
    if(ug->u.a[src].n < utg_thres || ug->u.a[dest].n < utg_thres) return 0;

    uint64_t k;
    for (k = 0; k < x->rGraph.a[src].n; k++)
    {
        if(x->rGraph.a[src].a[k].del) continue;
        if(x->rGraph.a[src].a[k].weight >= weight_thres) break;
    }
    if(k == x->rGraph.a[src].n) return 0;

    src = dest;
    for (k = 0; k < x->rGraph.a[src].n; k++)
    {
        if(x->rGraph.a[src].a[k].del) continue;
        if(x->rGraph.a[src].a[k].weight >= weight_thres) break;
    }
    if(k == x->rGraph.a[src].n) return 0;

    return 1;
}

// Assembly:
movq (%rdi), %rax
cmpq %rdx, %rax
setbe %r10b
cmpq %rcx, %rax
setbe %r11b
xorl %eax, %eax
orb %r10b, %r11b
jne 0x14866a
movq 0x10(%rdi), %rdi
leaq (%rdx,%rdx,4), %r10
movl 0x10(%rdi,%r10,8), %r10d
cmpq %r8, %r10
jb 0x14866a
leaq (%rcx,%rcx,4), %r10
movl 0x10(%rdi,%r10,8), %edi
cmpq %r8, %rdi
jb 0x14866a
movq 0x10(%rsi), %rsi
leaq (%rdx,%rdx,2), %rdi
movq (%rsi,%rdi,8), %rdx
xorl %eax, %eax
testq %rdx, %rdx
je 0x14866b
leaq (%rsi,%rdi,8), %rdi
movq 0x10(%rdi), %r8
cvtsi2sd %r9d, %xmm0
xorl %edi, %edi
cmpb $0x0, 0x18(%r8)
js 0x14865c
movsd (%r8), %xmm1
ucomisd %xmm0, %xmm1
jae 0x14866d
incq %rdi
addq $0x28, %r8
cmpq %rdi, %rdx
jne 0x14864a
xorl %eax, %eax
retq
xorl %edi, %edi
cmpq %rdx, %rdi
je 0x14866a
leaq (%rcx,%rcx,2), %rax
movq (%rsi,%rax,8), %rcx
testq %rcx, %rcx
je 0x1486b2
leaq (%rsi,%rax,8), %rax
movq 0x10(%rax), %rax
xorps %xmm0, %xmm0
cvtsi2sd %r9d, %xmm0
xorl %edx, %edx
cmpb $0x0, 0x18(%rax)
js 0x1486a1
movsd (%rax), %xmm1
ucomisd %xmm0, %xmm1
jae 0x1486b4
incq %rdx
addq $0x28, %rax
cmpq %rdx, %rcx
jne 0x148691
movq %rcx, %rdx
jmp 0x1486b4
xorl %edx, %edx
xorl %eax, %eax
cmpq %rcx, %rdx
setne %al
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: get_bmer_unitgs(min_cut_t*, bubble_type const*, unsigned long, unsigned long)
void get_bmer_unitgs(min_cut_t* x, const bubble_type* bub, uint64_t k, uint64_t src)
{
    uint32_t beg, sink, n, *a;
    if(!IF_BUB(src, *bub)) return;
    get_bubbles((bubble_type*)bub, bub->index[src], &beg, &sink, &a, &n, NULL);
    memset(x->bmerVis.a, 0, x->bmerVis.n);
    ///select_bmer(src, k, bub, x, 1);
    select_bmer_distance(beg^1, k, bub, x, 1, 1);
    select_bmer_distance(sink^1, k, bub, x, 1, 1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r15
movq (%rsi), %rax
movq 0x80(%rsi), %rdx
movl (%rax,%rcx,4), %eax
incq %rdx
cmpq %rax, %rdx
jbe 0x1494df
movq %rsi, %r14
movq %rdi, %rbx
movq 0x28(%rsi), %rcx
movq 0x40(%rsi), %rdx
movl (%rdx,%rax,4), %eax
movl (%rcx,%rax,4), %ebp
incl %eax
movl (%rcx,%rax,4), %r12d
movq 0xe0(%rdi), %rdx
movq 0xf0(%rdi), %rdi
xorl %esi, %esi
callq 0x20e0
xorl $0x1, %ebp
movl %ebp, %edi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
movl $0x1, %r8d
movl $0x1, %r9d
callq 0x1491f9
xorl $0x1, %r12d
movl %r12d, %edi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
movl $0x1, %r8d
movl $0x1, %r9d
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1491f9
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: reset_G_partition(G_partition*, unsigned long)
void reset_G_partition(G_partition* x, uint64_t n_utg)
{
    uint64_t i;
    x->n = 0;
    for (i = 0; i < n_utg; i++)
    {
        x->index[i] = (uint32_t)-1;
    }
}

// Assembly:
movq $0x0, (%rdi)
testq %rsi, %rsi
je 0x149557
movq %rsi, %rdx
movq 0x18(%rdi), %rdi
shlq $0x2, %rdx
movl $0xff, %esi
jmp 0x20e0
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: destory_G_partition(G_partition*)
void destory_G_partition(G_partition* x)
{
    uint64_t i;
    for (i = 0; i < x->n; i++)
    {
        kv_destroy(x->a[i].a);
    }
    kv_destroy(*x);
    free(x->index);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpq $0x0, (%rdi)
je 0x149588
movl $0x10, %r14d
xorl %r15d, %r15d
movq 0x10(%rbx), %rax
movq (%rax,%r14), %rdi
callq 0x2220
incq %r15
addq $0x48, %r14
cmpq (%rbx), %r15
jb 0x14956f
movq 0x10(%rbx), %rdi
callq 0x2220
movq 0x18(%rbx), %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2220
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: get_hc_weight(unsigned int, unsigned int, unsigned int, bub_p_t_warp*, min_cut_t*)
double get_hc_weight(uint32_t query, uint32_t v0, uint32_t root, bub_p_t_warp *b, min_cut_t* 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_rGraph_edge(x, query>>1, v>>1);
        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 0x149605
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
callq 0x147100
testq %rax, %rax
je 0x149600
movsd 0x8(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
cmpl %ebp, %r15d
jne 0x1495d0
movsd 0x8(%rsp), %xmm0
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: get_co_weight(unsigned int*, unsigned int, unsigned int*, unsigned int, min_cut_t*)
double get_co_weight(uint32_t *query, uint32_t query_n, uint32_t *target, uint32_t target_n, min_cut_t* m)
{
    double weight = 0;
    hc_edge *p = NULL;
    uint32_t i, k;
    for (i = 0; i < query_n; i++)
    {
        for (k = 0; k < target_n; k++)
        {
            p = get_rGraph_edge(m, query[i], target[k]);
            if(p) weight += p->weight;
        }
    }

    return weight;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
testl %esi, %esi
je 0x149ddd
movq %r8, %rbx
movq %rdx, %r14
movl %esi, %eax
movq %rax, 0x20(%rsp)
movl %ecx, %r15d
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
xorl %ebp, %ebp
movl %ecx, 0x14(%rsp)
testl %ecx, %ecx
je 0x149dcd
movq 0x18(%rsp), %rax
movl (%rax,%rbp,4), %r12d
xorl %r13d, %r13d
movl (%r14,%r13,4), %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x147100
testq %rax, %rax
je 0x149dc5
movsd 0x8(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
incq %r13
cmpq %r13, %r15
jne 0x149da1
incq %rbp
cmpq 0x20(%rsp), %rbp
movl 0x14(%rsp), %ecx
jne 0x149d91
jmp 0x149de7
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x8(%rsp), %xmm0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: get_hic_distance(pe_hit*, hc_links*, ha_ug_index const*, unsigned int*)
uint64_t get_hic_distance(pe_hit* hit, hc_links* link, const ha_ug_index* idx, uint32_t *is_cc)
{
    uint64_t s_uid, s_dir, e_uid, e_dir, u_dis, k;
    long long s_pos, e_pos;
    s_uid = ((hit->s<<1)>>(64 - idx->uID_bits)); s_pos = hit->s & idx->pos_mode;
    e_uid = ((hit->e<<1)>>(64 - idx->uID_bits)); e_pos = hit->e & idx->pos_mode;
    if(s_uid == e_uid)
    {
        if(is_cc) (*is_cc) = 1;
        return MAX(s_pos, e_pos) - MIN(s_pos, e_pos);
    } 
    hc_linkeage* t = &(link->a.a[s_uid]);
    for (k = 0; k < t->e.n; k++)
    {
        if(t->e.a[k].del || t->e.a[k].uID != e_uid) continue;
        if(is_cc) (*is_cc) = t->e.a[k].is_cc;
        s_dir = (!!(t->e.a[k].dis&(uint64_t)2));
        e_dir = (!!(t->e.a[k].dis&(uint64_t)1));
        u_dis = (t->e.a[k].dis ==(uint64_t)-1? (uint64_t)-1 : t->e.a[k].dis>>3);
        // if(s_uid == 24684 && s_pos == 124953 && e_uid == 16950 && e_pos == 93039)
        // {
        //     fprintf(stderr, "*****************s_dir: %lu, e_dir: %lu, u_dis: %lu\n", s_dir, e_dir, u_dis);
        // }
        if(u_dis == (uint64_t)-1) return (uint64_t)-1;
        if(s_dir == 1) s_pos = (long long)idx->ug->g->seq[s_uid].len - s_pos - 1;
        if(e_dir == 1) e_pos = (long long)idx->ug->g->seq[e_uid].len - e_pos - 1;
        e_pos = e_pos + u_dis - (long long)idx->ug->g->seq[e_uid].len;
        return MAX(s_pos, e_pos) - MIN(s_pos, e_pos);
    }

    return (uint64_t)-1;
}

// Assembly:
pushq %rbx
movq %rcx, %rax
movq (%rdi), %r8
movq 0x8(%rdi), %rdi
leaq (%r8,%r8), %r10
xorl %ecx, %ecx
subb 0x18(%rdx), %cl
shrq %cl, %r10
leaq (%rdi,%rdi), %r9
shrq %cl, %r9
movq 0x30(%rdx), %rcx
andq %rcx, %r8
andq %rcx, %rdi
cmpq %r9, %r10
jne 0x14a55f
testq %rax, %rax
je 0x14a550
movl $0x1, (%rax)
subq %rdi, %r8
movq %r8, %rax
negq %rax
cmovsq %r8, %rax
jmp 0x14a5a0
movq 0x10(%rsi), %rcx
leaq (%r10,%r10,2), %r11
shlq $0x4, %r11
movq (%rcx,%r11), %rsi
testq %rsi, %rsi
je 0x14a599
addq %r11, %rcx
movq 0x10(%rcx), %rcx
addq $0x18, %rcx
movsbl (%rcx), %r11d
testl %r11d, %r11d
js 0x14a590
movl -0x10(%rcx), %ebx
cmpq %rbx, %r9
je 0x14a5a2
addq $0x28, %rcx
decq %rsi
jne 0x14a57f
movq $-0x1, %rax
popq %rbx
retq
testq %rax, %rax
je 0x14a5aa
movl %r11d, (%rax)
movq -0x8(%rcx), %rcx
cmpq $-0x1, %rcx
je 0x14a599
movq %rcx, %rax
shrq $0x3, %rax
movq (%rdx), %rdx
testb $0x2, %cl
je 0x14a5db
movq 0x18(%rdx), %rsi
movq 0x20(%rsi), %rsi
movl (%rsi,%r10,8), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
notq %r8
addq %rsi, %r8
movq 0x18(%rdx), %rdx
movq 0x20(%rdx), %rdx
movl (%rdx,%r9,8), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq %rdi, %rsi
notq %rsi
addq %rdx, %rsi
testb $0x1, %cl
cmoveq %rdi, %rsi
addq %rsi, %rax
subq %rax, %r8
addq %rdx, %r8
jmp 0x14a553
// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: connect_bub_occ(bubble_type*, unsigned int, unsigned int)
uint32_t connect_bub_occ(bubble_type* bub, uint32_t root_id, uint32_t check_het)
{
    uint64_t id0, id1, occ = 2;  
    get_bub_id(bub, root_id, &id0, &id1, check_het);
    if(id0 == (uint64_t)-1) occ--;
    if(id1 == (uint64_t)-1) occ--;
    return occ;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %edx, %r8d
leaq 0x10(%rsp), %rbx
leaq 0x8(%rsp), %r14
movq %rbx, %rdx
movq %r14, %rcx
callq 0x14ac07
xorl %eax, %eax
cmpq $-0x1, (%rbx)
sete %al
xorl %ecx, %ecx
cmpq $-0x1, (%r14)
sete %cl
addl %eax, %ecx
movl $0x2, %eax
subl %ecx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq