LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: update_hap_label(ma_ug_t*, asg_t*)
void update_hap_label(ma_ug_t *ug, asg_t* read_g)
{
    uint32_t v, n_vtx, k;
    uint64_t rId;

    if(ug == NULL)
    {
        n_vtx = read_g->n_seq;
        for (v = 0; v < n_vtx; ++v) 
        {
            if(read_g->seq[v].del) continue;
            if(read_g->seq[v].c != HAP_LABLE) continue;
            read_g->seq[v].c = PRIMARY_LABLE;
        }
        return;
    }


    asg_t* nsg = ug->g;
    n_vtx = nsg->n_seq;
    ma_utg_t* u = NULL;
    for (v = 0; v < n_vtx; ++v) 
    {
        if(nsg->seq[v].del) continue;
        if(nsg->seq[v].c != HAP_LABLE) continue;
        u = &((ug)->u.a[v]);
        if(u->m == 0) continue;
        for (k = 0; k < u->n; k++)
        {
            rId = u->a[k]>>33;
            read_g->seq[rId].c = HAP_LABLE;
        }
    }
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x9984d
movq 0x18(%rdi), %rax
movl 0x14(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
xorl %edx, %edx
cmpq %rcx, %rdx
je 0x99877
movq 0x20(%rax), %r8
cmpl $0x0, (%r8,%rdx,8)
js 0x99848
cmpb $0x2, 0x4(%r8,%rdx,8)
jne 0x99848
movq 0x10(%rdi), %r8
imulq $0x28, %rdx, %r9
cmpl $0x0, 0xc(%r8,%r9)
je 0x99848
addq %r9, %r8
movl 0x10(%r8), %r9d
xorl %r10d, %r10d
cmpq %r10, %r9
je 0x99848
movq 0x18(%r8), %r11
movq (%r11,%r10,8), %r11
movq 0x20(%rsi), %rbx
shrq $0x21, %r11
movb $0x2, 0x4(%rbx,%r11,8)
incq %r10
jmp 0x99828
incq %rdx
jmp 0x997f6
movl 0x14(%rsi), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x99877
movq 0x20(%rsi), %rdx
cmpl $0x0, (%rdx,%rcx,8)
js 0x99872
cmpb $0x2, 0x4(%rdx,%rcx,8)
jne 0x99872
movb $0x0, 0x4(%rdx,%rcx,8)
incq %rcx
jmp 0x99857
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: purge_dump(ma_ug_t*)
void purge_dump(ma_ug_t* ug)
{
    asg_t* nsg = ug->g;
    uint32_t v, n_vtx = nsg->n_seq, k, rId;
    ma_utg_t *u = NULL;
    for (v = 0; v < n_vtx; ++v) {
        if (nsg->seq[v].del) continue;
        u = &((ug)->u.a[v]);
        if(u->m == 0) continue;
        for (k = 0; k < u->n; k++){
            rId = u->a[k]>>33;
            if(R_INF.trio_flag[rId] != AMBIGU && R_INF.trio_flag[rId] != DROP) break;
        }
        if(k >= u->n){
            if(u->m != 0){
                u->circ = u->end = u->len = u->m = u->n = u->start = 0;
                free(u->a);
                u->a = NULL;
            }
            asg_seq_del(nsg, v);
        }
    }
    asg_cleanup(nsg);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x18(%rdi), %rbx
movl 0x14(%rbx), %r12d
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
xorl %r15d, %r15d
leaq 0x1ba732(%rip), %r13    # 0x254230
cmpq %r12, %r15
je 0x99b75
movq 0x20(%rbx), %rax
cmpl $0x0, (%rax,%r15,8)
js 0x99b70
movq 0x10(%r14), %rbp
imulq $0x28, %r15, %rax
cmpl $0x0, 0xc(%rbp,%rax)
je 0x99b70
addq %rax, %rbp
movl 0x10(%rbp), %eax
movq 0x28(%r13), %rcx
xorl %edx, %edx
cmpq %rdx, %rax
je 0x99b4c
movq 0x18(%rbp), %rsi
movq (%rsi,%rdx,8), %rsi
shrq $0x21, %rsi
movzbl (%rcx,%rsi), %esi
cmpl $0x5, %esi
je 0x99b47
testl %esi, %esi
jne 0x99b70
incq %rdx
jmp 0x99b29
andl $0x0, 0x10(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, (%rbp)
movq 0x18(%rbp), %rdi
callq 0x2220
andq $0x0, 0x18(%rbp)
movq %rbx, %rdi
movl %r15d, %esi
callq 0x6f8da
incq %r15
jmp 0x99afe
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x694eb
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: discard_small_ctg(ma_ug_t**, asg_t*, kvec_asg_arc_t_warp*, int, unsigned int, unsigned int)
void discard_small_ctg(ma_ug_t **ug, asg_t* rg, kvec_asg_arc_t_warp* edge, int32_t max_rg_cut, uint32_t is_renew0, uint32_t is_renew1)
{
    if(is_renew0) renew_utg(ug, rg, edge);
    uint32_t i, cnt = 0; ma_utg_t* u = NULL;
    for (i = 0; i < (*ug)->u.n; i++) {
        if(((int32_t)(*ug)->u.a[i].n) > max_rg_cut) continue;
        u = &(((*ug))->u.a[i]);
        asg_seq_del((*ug)->g, i);
        if(u->m!=0) {
            u->m = u->n = 0; free(u->a); u->a = NULL; u->len = u->circ = 0; u->start = u->end = 0;
        }
        cnt++;
    }

    if(cnt && is_renew1) renew_utg(ug, rg, edge);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, 0xc(%rsp)
movl %ecx, %r12d
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
testl %r8d, %r8d
je 0x99bbd
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x80328
movq %rbx, 0x10(%rsp)
xorl %r13d, %r13d
xorl %ebp, %ebp
movl %r13d, %r13d
movq (%r15), %rax
cmpq %r13, (%rax)
jbe 0x99c18
movq 0x10(%rax), %rbx
imulq $0x28, %r13, %rcx
cmpl %r12d, 0x10(%rbx,%rcx)
jg 0x99c13
addq %rcx, %rbx
movq 0x18(%rax), %rdi
movl %r13d, %esi
callq 0x6f8da
cmpl $0x0, 0xc(%rbx)
je 0x99c11
andq $0x0, 0xc(%rbx)
movq 0x18(%rbx), %rdi
callq 0x2220
andq $0x0, 0x18(%rbx)
andq $0x0, (%rbx)
andl $0x0, 0x8(%rbx)
incl %ebp
incl %r13d
jmp 0x99bc7
testl %ebp, %ebp
sete %al
cmpl $0x0, 0xc(%rsp)
sete %cl
orb %al, %cl
jne 0x99c47
movq %r15, %rdi
movq %r14, %rsi
movq 0x10(%rsp), %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x80328
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: debug_untig_length(ma_ug_t*, unsigned int, char const*)
int debug_untig_length(ma_ug_t *g, uint32_t tipsLen, const char* name)
{
	uint32_t i;

	for (i = 0; i < g->u.n; ++i) {
		ma_utg_t *u = &g->u.a[i];
        if(u->m == 0) continue;
        if(u->n <= tipsLen)
        {
            fprintf(stderr, "i: %u, u->n: %u, tipsLen: %u, %s\n", i, u->n, tipsLen, name);
        }
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movq 0x1b6d5e(%rip), %r13    # 0x252fe0
leaq 0x14d36f(%rip), %r15    # 0x1e95f8
xorl %r12d, %r12d
movl %r12d, %r12d
cmpq %r12, (%r14)
jbe 0x9c2cb
movq 0x10(%r14), %rax
imulq $0x28, %r12, %rcx
cmpl $0x0, 0xc(%rax,%rcx)
je 0x9c2ad
addq %rcx, %rax
movl 0x10(%rax), %ecx
cmpl %ebp, %ecx
jbe 0x9c2b2
incl %r12d
jmp 0x9c28c
movq (%r13), %rdi
movq %r15, %rsi
movl %r12d, %edx
movl %ebp, %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0x22b0
jmp 0x9c2ad
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: prt_phase_dbg_graph(char*, asg_t*, ma_sub_t*, ma_hit_t_alloc*, R_to_U*, int, int)
void prt_phase_dbg_graph(char *in, asg_t *sg, ma_sub_t *cov, ma_hit_t_alloc *src, R_to_U* ri, int max_hang, int min_ovlp)
{
    char* gfa_name = (char*)malloc(strlen(in)+100);
    sprintf(gfa_name, "%s.phase", in);
    uint64_t pscut = 0;
    pscut = (asm_opt.hom_global_coverage_set?(asm_opt.hom_global_coverage):(((double)asm_opt.hom_global_coverage)/((double)HOM_PEAK_RATE)));
    pscut *= PHASE_SEF; if(pscut < PHASE_SEP) pscut = PHASE_SEP;
    ma_ug_t *ug = ma_ug_gen_phase(sg, pscut, PHASE_SEP_RATE);
    print_debug_gfa(sg, ug, cov, gfa_name, src, ri, max_hang, min_ovlp, 0, 0, 0);
    ma_ug_destroy(ug);

    sprintf(gfa_name, "%s.raw", in);
    ug = ma_ug_gen(sg);
    print_debug_gfa(sg, ug, cov, gfa_name, src, ri, max_hang, min_ovlp, 0, 0, 0);
    ma_ug_destroy(ug);

    free(gfa_name);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, 0x20(%rsp)
movq %r8, (%rsp)
movq %rcx, 0x18(%rsp)
movq %rdx, %r13
movq %rsi, %rbp
movq %rdi, %rbx
movl 0x60(%rsp), %r12d
callq 0x2090
leaq 0x64(%rax), %rdi
callq 0x2280
movq %rax, %r14
leaq 0x14d2fc(%rip), %rsi    # 0x1e961a
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x1b7426(%rip), %rax    # 0x253758
cmpl $0x0, 0x148(%rax)
cvtsi2sdl 0x144(%rax), %xmm0
jne 0x9c34b
divsd 0x14b915(%rip), %xmm0   # 0x1e7c60
cvttsd2si %xmm0, %rax
movq %rax, %rcx
subsd 0x146f3d(%rip), %xmm0   # 0x1e3298
cvttsd2si %xmm0, %rdx
sarq $0x3f, %rcx
andq %rcx, %rdx
orq %rax, %rdx
addq %rdx, %rdx
cmpq $0x41, %rdx
pushq $0x40
popq %rsi
cmovaeq %rdx, %rsi
movsd 0x1471b8(%rip), %xmm0   # 0x1e3538
movq %rbp, %rdi
callq 0x773c3
movq %rax, %r15
subq $0x8, %rsp
movq %rbp, %rdi
movq %rax, %rsi
movq %r13, %rdx
movq %r14, %rcx
movq %r13, 0x18(%rsp)
movq 0x20(%rsp), %r13
movq %r13, %r8
movq 0x8(%rsp), %r9
pushq $0x0
pushq $0x0
pushq $0x0
pushq %r12
movq %r12, 0x30(%rsp)
movq 0x48(%rsp), %r12
pushq %r12
callq 0x926e3
addq $0x30, %rsp
movq %r15, %rdi
callq 0x6921d
leaq 0x14d24a(%rip), %rsi    # 0x1e9623
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2050
movq %rbp, %rdi
callq 0x76d91
movq %rax, %rbx
subq $0x8, %rsp
movq %rbp, %rdi
movq %rax, %rsi
movq 0x18(%rsp), %rdx
movq %r14, %rcx
movq %r13, %r8
movq 0x8(%rsp), %r9
pushq $0x0
pushq $0x0
pushq $0x0
pushq 0x28(%rsp)
pushq %r12
callq 0x926e3
addq $0x30, %rsp
movq %rbx, %rdi
callq 0x6921d
movq %r14, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2220
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: output_hap_sc_graph(kvect_sec_t*, asg_t*, ma_sub_t*, char*, unsigned char, ma_hit_t_alloc*, R_to_U*, char*)
void output_hap_sc_graph(kvect_sec_t *ug, asg_t *sg, /**kvec_asg_arc_t_warp *arcs,**/ ma_sub_t* coverage_cut, char* output_file_name, uint8_t flag, ma_hit_t_alloc* sources, R_to_U* ruIndex, /**int max_hang, int min_ovlp,**/ char *f_prefix)
{
    char* gfa_name = (char*)malloc(strlen(output_file_name)+100);
    sprintf(gfa_name, "%s.%s.p_ctg.gfa", output_file_name, f_prefix?f_prefix:(flag==FATHER?"hap1":"hap2"));
    FILE* output_file = fopen(gfa_name, "w");

    fprintf(stderr, "Writing %s to disk... \n", gfa_name);

    // ma_ug_seq(ug->ctg, sg, coverage_cut, sources, arcs, max_hang, min_ovlp, 0, 1);
    // ma_ug_print(ug, sg, coverage_cut, sources, ruIndex, (flag==FATHER?"h1tg":"h2tg"), output_file);
    ma_scg_print(ug, &R_INF, sg, coverage_cut, sources, ruIndex, 1, (flag==FATHER?"h1tg":"h2tg"), output_file);
    fclose(output_file);

    free(gfa_name);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, 0x20(%rsp)
movl %r8d, %r14d
movq %rcx, %rbx
movq %rdx, 0x18(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, %rbp
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x68(%rsp), %r13
movq %rcx, %rdi
callq 0x2090
leaq 0x64(%rax), %rdi
callq 0x2280
movq %rax, %r15
cmpl $0x1, %r14d
leaq 0x14cf4e(%rip), %rax    # 0x1e963a
leaq 0x14cf4c(%rip), %rcx    # 0x1e963f
cmoveq %rax, %rcx
leaq 0x14cf46(%rip), %rax    # 0x1e9644
leaq 0x14cf44(%rip), %r12    # 0x1e9649
cmoveq %rax, %r12
testq %r13, %r13
leaq 0x14cf17(%rip), %rsi    # 0x1e962a
leaq 0x15df87(%rip), %r14    # 0x1fa6a1
cmovneq %r13, %rcx
movq %r15, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2050
movq %r15, %rdi
movq %r14, %rsi
callq 0x2210
movq %rax, %rbx
movq 0x1b68a0(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0x14c229(%rip), %rsi    # 0x1e8973
movq %r15, %rdx
xorl %eax, %eax
callq 0x22b0
subq $0x8, %rsp
leaq 0x1b7ad1(%rip), %rsi    # 0x254230
movq %rbp, %rdi
movq 0x10(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq 0x28(%rsp), %r8
movq 0x18(%rsp), %r9
pushq %rbx
pushq %r12
pushq $0x1
callq 0x7ceaa
addq $0x20, %rsp
movq %rbx, %rdi
callq 0x2190
movq %r15, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2220
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: update_recover_atg_cov()
void update_recover_atg_cov()
{
    if(asm_opt.recover_atg_cov_min == -1024) {
        asm_opt.recover_atg_cov_max = (asm_opt.hom_global_coverage_set?
            (asm_opt.hom_global_coverage):(((double)asm_opt.hom_global_coverage)/((double)HOM_PEAK_RATE)));         
        asm_opt.recover_atg_cov_min = asm_opt.recover_atg_cov_max * 0.85;
        asm_opt.recover_atg_cov_max = INT32_MAX;
    }
}

// Assembly:
leaq 0x1b686b(%rip), %rax    # 0x253758
cmpl $0xfffffc00, 0x13c(%rax) # imm = 0xFFFFFC00
jne 0x9cf36
cmpl $0x0, 0x148(%rax)
cvtsi2sdl 0x144(%rax), %xmm0
jne 0x9cf12
divsd 0x14ad4e(%rip), %xmm0   # 0x1e7c60
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
mulsd 0x14ad5e(%rip), %xmm0   # 0x1e7c80
cvttsd2si %xmm0, %ecx
movl %ecx, 0x13c(%rax)
movl $0x7fffffff, 0x140(%rax) # imm = 0x7FFFFFFF
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: delete_ug_node(ma_ug_t*, unsigned long)
void delete_ug_node(ma_ug_t *ug, uint64_t nid)
{
    asg_seq_del(ug->g, nid);
    if(ug->u.a[nid].m!=0) {
        ug->u.a[nid].m = ug->u.a[nid].n = 0;
        free(ug->u.a[nid].a); ug->u.a[nid].a = NULL;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0x6f8da
movq 0x10(%rbx), %rax
imulq $0x28, %r14, %r14
cmpl $0x0, 0xc(%rax,%r14)
je 0x9d26e
leaq (%rax,%r14), %rcx
andl $0x0, 0x10(%rcx)
andl $0x0, 0xc(%rax,%r14)
movq 0x18(%rax,%r14), %rdi
callq 0x2220
movq 0x10(%rbx), %rax
andq $0x0, 0x18(%rax,%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: dedup_exact_ug(dedup_idx_t*, dedup_idx_t*, ma_sub_t*, ma_hit_t_alloc*, R_to_U*, unsigned char*, unsigned char)
uint64_t dedup_exact_ug(dedup_idx_t *ref, dedup_idx_t *qry, ma_sub_t *cov, ma_hit_t_alloc *src, R_to_U *rui, uint8_t *ff, uint8_t trio_f)
{
    // fprintf(stderr, "[M::%s] Start\n", __func__);
    uint64_t k, n_base = 0; int64_t f;
    for (k = 0; k < qry->ug->u.n; k++) {
        if((qry->ug->u.a[k].n == 0) || (qry->ug->u.a[k].m == 0) || (qry->ug->g->seq[k].del)) continue;
        if(if_primary_unitig(&(qry->ug->u.a[k]), qry->rg, cov, src, rui, ff)) continue;
        f = cal_exact_ug_o(ref, &(qry->ug->u.a[k]), trio_f);
        if(f == INT32_MIN) continue;
        if(f == -1) {///delete qry
            delete_ug_node(qry->ug, k); n_base += qry->ug->u.a[k].len;
        } else if(f >= 0) {///delete ref
            delete_ug_node(ref->ug, f); n_base += ref->ug->u.a[f].len;
        }
    }
    // fprintf(stderr, "[M::%s] End\n", __func__);
    return n_base;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %r14
movq %r8, %r15
movq %rcx, %r12
movq %rdx, 0x30(%rsp)
movq %rsi, %r13
movq %rdi, 0x20(%rsp)
movzbl 0x70(%rsp), %eax
movq %rax, 0x28(%rsp)
xorl %ebx, %ebx
movq $0x0, 0x18(%rsp)
xorl %ebp, %ebp
movq %r8, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
movq (%r13), %rax
cmpq (%rax), %rbp
jae 0x9d38c
movq 0x10(%rax), %rdi
cmpl $0x0, 0x10(%rdi,%rbx)
je 0x9d380
cmpl $0x0, 0xc(%rdi,%rbx)
je 0x9d380
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
cmpl $0x0, (%rax,%rbp,8)
js 0x9d380
addq %rbx, %rdi
movq 0x8(%r13), %rsi
movq 0x30(%rsp), %rdx
movq %r12, %rcx
movq %r15, %r8
movq %r14, %r9
callq 0x945a4
testb %al, %al
jne 0x9d380
movq (%r13), %rax
movq 0x10(%rax), %rsi
addq %rbx, %rsi
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rdx
callq 0x9cf37
cmpq $-0x80000000, %rax      # imm = 0x80000000
je 0x9d380
movq %r14, %r12
movq %r13, %r15
movq %rbp, %r14
cmpq $-0x1, %rax
je 0x9d350
movq 0x20(%rsp), %r15
movq %rax, %r14
testq %rax, %rax
js 0x9d373
movq (%r15), %rdi
movq %r14, %rsi
callq 0x9d229
movq (%r15), %rax
movq 0x10(%rax), %rax
imulq $0x28, %r14, %rcx
movl (%rax,%rcx), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addq %rax, 0x18(%rsp)
movq %r12, %r14
movq 0x10(%rsp), %r15
movq 0x8(%rsp), %r12
incq %rbp
addq $0x28, %rbx
jmp 0x9d2bb
movq 0x18(%rsp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: push_ma_utg_t(ma_ug_t*, ma_utg_t*)
void push_ma_utg_t(ma_ug_t *ug, ma_utg_t *u)
{
    ma_utg_t *p; 
    ///graph
    asg_seq_set(ug->g, ug->u.n, u->len, 0); ug->g->seq[ug->u.n].c = 0;

    //unitig
    kv_pushp(ma_utg_t, ug->u, &p); memset(p, 0, sizeof((*p)));
    *p = *u; p->a = NULL; p->s = NULL;
    MALLOC(p->a, p->m); memcpy(p->a, u->a, sizeof((*(p->a)))*p->m);
    if(u->s) {
        MALLOC(p->s, p->len); memcpy(p->s, u->s, sizeof((*(p->s)))*p->len);
    }
    assert(ug->g->n_seq == ug->u.n);
    if(p->n) {
        p->circ = 0; p->start = (p->a[0]>>32); p->end = (p->a[p->n-1]>>32)^1;
    }    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movl (%rbx), %esi
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl (%r14), %edx
xorl %ecx, %ecx
callq 0x69316
movq (%rbx), %rax
movq 0x18(%rbx), %rcx
movq 0x20(%rcx), %rcx
movb $0x0, 0x4(%rcx,%rax,8)
cmpq 0x8(%rbx), %rax
jne 0x9d407
leaq (%rax,%rax), %rcx
testq %rax, %rax
pushq $0x2
popq %rax
cmovneq %rcx, %rax
movq %rax, 0x8(%rbx)
movq 0x10(%rbx), %rdi
imulq $0x28, %rax, %rsi
callq 0x2370
movq %rax, %r12
movq %rax, 0x10(%rbx)
movq (%rbx), %rax
jmp 0x9d40b
movq 0x10(%rbx), %r12
leaq 0x1(%rax), %rcx
movq %rcx, (%rbx)
imulq $0x28, %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r12,%r15)
andq $0x0, 0x20(%r12,%r15)
movups %xmm0, (%r12,%r15)
movups (%r14), %xmm0
movups %xmm0, (%r12,%r15)
movq 0x10(%r14), %rax
movq %rax, 0x10(%r12,%r15)
andq $0x0, 0x20(%r12,%r15)
leaq (%r12,%r15), %rbp
movl 0xc(%r12,%r15), %r13d
shlq $0x3, %r13
movq %r13, %rdi
callq 0x2280
movq %rax, 0x18(%r12,%r15)
movq %rax, %r15
movq 0x18(%r14), %rsi
movq %rax, %rdi
movq %r13, %rdx
callq 0x2160
xorl %eax, %eax
cmpq %rax, 0x20(%r14)
je 0x9d49c
movl (%rbp), %r12d
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
movq %r12, %rdi
callq 0x2280
movq %rax, 0x20(%rbp)
movq 0x20(%r14), %rsi
movq %rax, %rdi
movq %r12, %rdx
callq 0x2160
movq 0x18(%rbx), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, (%rbx)
jne 0x9d4db
movl 0x10(%rbp), %eax
testl %eax, %eax
je 0x9d4cc
andb $0x7f, 0x3(%rbp)
movl 0x4(%r15), %ecx
movl %ecx, 0x4(%rbp)
decl %eax
movl 0x4(%r15,%rax,8), %eax
xorl $0x1, %eax
movl %eax, 0x8(%rbp)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x14c27a(%rip), %rdi    # 0x1e975c
leaq 0x14a8a8(%rip), %rsi    # 0x1e7d91
leaq 0x14c284(%rip), %rcx    # 0x1e9774
movl $0x5404, %edx           # imm = 0x5404
callq 0x2110
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: update_ctg_trans_cc(kv_u_trans_t*)
void update_ctg_trans_cc(kv_u_trans_t *os)
{
    uint64_t k, m; u_trans_t *z;
    kt_for(asm_opt.thread_num, worker_for_ctg_trans_cc, os, os->idx.n);
    for (k = m = 0; k < os->n; k++) {
        if(!(os->a[k].del)) os->a[m++] = os->a[k];
    }
    os->n = m;
    for (k = 0; k < m; k++) {
        kv_pushp(u_trans_t, *os, &z);
        *z = os->a[k];
        z->qn = os->a[k].tn; z->qs = os->a[k].ts; z->qe = os->a[k].te; 
        z->tn = os->a[k].qn; z->ts = os->a[k].qs; z->te = os->a[k].qe; 
    }
    kt_u_trans_t_idx(os, os->idx.n);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1b5512(%rip), %rax    # 0x253758
movl 0x7c(%rax), %edi
movq 0x18(%rbx), %rcx
leaq 0x100(%rip), %rsi       # 0x9e354
movq %rbx, %rdx
callq 0xc67c0
xorl %eax, %eax
xorl %r14d, %r14d
xorl %ecx, %ecx
cmpq (%rbx), %rcx
jae 0x9e2a0
movq 0x10(%rbx), %rdx
cmpb $0x0, 0x28(%rdx,%rax)
js 0x9e297
leaq (%rdx,%rax), %rsi
imulq $0x30, %r14, %rdi
incq %r14
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movups 0x20(%rsi), %xmm2
movups %xmm2, 0x20(%rdx,%rdi)
movups %xmm1, 0x10(%rdx,%rdi)
movups %xmm0, (%rdx,%rdi)
incq %rcx
addq $0x30, %rax
jmp 0x9e263
movq %r14, (%rbx)
xorl %r15d, %r15d
pushq $0x2
popq %r12
subq $0x1, %r14
jb 0x9e33e
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rcx
jne 0x9e2e3
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
cmoveq %r12, %rdx
movq %rdx, 0x8(%rbx)
imulq $0x30, %rdx, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbx)
imulq $0x30, %rcx, %rcx
movups (%rax,%r15), %xmm0
movups 0x10(%rax,%r15), %xmm1
movups 0x20(%rax,%r15), %xmm2
movups %xmm2, 0x20(%rax,%rcx)
movups %xmm1, 0x10(%rax,%rcx)
movups %xmm0, (%rax,%rcx)
movq 0x10(%rbx), %rdx
movl 0x14(%rdx,%r15), %esi
movl %esi, 0x8(%rax,%rcx)
movq 0xc(%rdx,%r15), %rsi
movq %rsi, (%rax,%rcx)
movl 0x8(%rdx,%r15), %esi
movl %esi, 0x14(%rax,%rcx)
movq (%rdx,%r15), %rdx
movq %rdx, 0xc(%rax,%rcx)
addq $0x30, %r15
jmp 0x9e2aa
movl 0x18(%rbx), %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x88a31
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: get_scaf_res_t(scaf_res_t*, unsigned int, unsigned int, unsigned int, unsigned int*, unsigned int*, unsigned int*, unsigned int*, uc_block_t**)
uint32_t get_scaf_res_t(scaf_res_t *pa, uint32_t uid, uint32_t s, uint32_t e, uint32_t *in, uint32_t *rs, uint32_t *re, uint32_t *rn, uc_block_t **ra)
{
    // fprintf(stderr, "s::%u, e::%u, uid::%u, pa->n::%u\n", s, e, uid, (uint32_t)pa->n);
    if(uid >= pa->n) return 0;
    ul_vec_t *idx = &(pa->a[uid]); uint32_t k, z, a_n, os, oe, z0; uc_block_t *a; 
    (*rs) = (*re) = (uint32_t)-1; (*rn) = 0; (*ra) = NULL;
    
    for (k = (*in); k < idx->bb.n; k++) {
        a = idx->bb.a + idx->bb.a[k].ts; a_n = idx->bb.a[k].te - idx->bb.a[k].ts;
        os = MAX(s, idx->bb.a[k].qs); 
        oe = MIN(e, idx->bb.a[k].qe);
        // fprintf(stderr, "k::%u, os::%u, oe::%u, a_n::%u\n", k, os, oe, a_n);
        if(os >= oe) continue;
        for(z = 0; z < a_n && a[z].qe <= os; z++);
        if(z >= a_n) continue;
        for(z0 = z; z < a_n && a[z].qs < oe; z++);
        if(z <= z0 ) continue;
        *rs = os; *re = oe; *rn = z - z0; *ra = a + z0; (*in) = k + 1;
        return 1;
    }
    return 0;
}

// Assembly:
movl %esi, %esi
xorl %eax, %eax
cmpq %rsi, 0x8(%rdi)
jbe 0x9e6ba
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq 0x38(%rsp), %r10
movq (%rdi), %rax
orl $-0x1, (%r10)
movq 0x48(%rsp), %rdi
orl $-0x1, (%r9)
movq 0x40(%rsp), %r10
andl $0x0, (%r10)
andq $0x0, (%rdi)
movq %r8, -0x8(%rsp)
movl (%r8), %edi
imulq $0x58, %rsi, %rsi
leaq (%rax,%rsi), %r8
addq $0x20, %r8
movq (%r8), %r14
xorl %eax, %eax
movl %edi, %edi
cmpq %rdi, %r14
jbe 0x9e6b0
movq 0x10(%r8), %rsi
imulq $0x24, %rdi, %r10
movl 0x4(%rsi,%r10), %ebp
movl 0x8(%rsi,%r10), %r15d
cmpl %edx, %ebp
cmovbel %edx, %ebp
cmpl %ecx, %r15d
cmovael %ecx, %r15d
cmpl %r15d, %ebp
jae 0x9e67d
movl 0xc(%rsi,%r10), %r11d
imulq $0x24, %r11, %rbx
leaq (%rsi,%rbx), %r12
movl 0x10(%rsi,%r10), %r13d
subl %r11d, %r13d
movl %r13d, %r10d
leaq (%rsi,%rbx), %r11
addq $0x4, %r11
xorl %esi, %esi
cmpq %rsi, %r10
je 0x9e67d
cmpl %ebp, 0x8(%r12)
ja 0x9e651
incq %rsi
addq $0x24, %r12
addq $0x24, %r11
jmp 0x9e638
cmpl %r13d, %esi
cmoval %esi, %r13d
cmpq %r10, %rsi
cmovaq %rsi, %r10
movq %rsi, %rbx
cmpq %rbx, %r10
je 0x9e678
cmpl %r15d, (%r11)
jae 0x9e675
incq %rbx
addq $0x24, %r11
jmp 0x9e662
movl %ebx, %r13d
cmpl %esi, %r13d
ja 0x9e684
incl %edi
jmp 0x9e5e8
movl %ebp, (%r9)
movq 0x38(%rsp), %rax
movl %r15d, (%rax)
subl %esi, %r13d
movq 0x40(%rsp), %rax
movl %r13d, (%rax)
movq 0x48(%rsp), %rax
movq %r12, (%rax)
incl %edi
movq -0x8(%rsp), %rax
movl %edi, (%rax)
movl $0x1, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: is_noisy_ov(unsigned long, unsigned long, unsigned long, unsigned long, double, u_trans_t*, unsigned long)
uint64_t is_noisy_ov(uint64_t s, uint64_t e, uint64_t len, uint64_t bd, double cov_rate, u_trans_t *a, uint64_t a_n)
{
    uint64_t w, k, zs, ze, oz, tot;
    if(e - s < (bd<<1)) {
        w = (e + s)>>1;
        s = ((w>=bd)?(w-bd):(0)); 
        e = ((w+bd<=len)?(w+bd):(len));
    }
    if(s >= e) return 0;
    for(k = tot = 0; k < a_n; k++) {
        if(a[k].qs >= e) break;
        if(a[k].qe <= s) continue;
        zs = MAX(s, a[k].qs); ze = MIN(e, a[k].qe);
        oz = ((ze > zs)? (ze - zs):(0));
        tot += oz;
    }
    if((tot > 0) && (tot >= ((e - s)*cov_rate))) return 1;
    return 0;
}

// Assembly:
movq %rsi, %rax
subq %rdi, %rax
leaq (%rcx,%rcx), %r10
cmpq %r10, %rax
jae 0x9ec11
addq %rdi, %rsi
shrq %rsi
xorl %edi, %edi
movq %rsi, %rax
subq %rcx, %rax
cmovaeq %rax, %rdi
addq %rcx, %rsi
cmpq %rdx, %rsi
cmovaeq %rdx, %rsi
movq %rsi, %rax
subq %rdi, %rax
jbe 0x9ecae
addq $0x4, %r8
xorl %ecx, %ecx
subq $0x1, %r9
jb 0x9ec5d
movl -0x4(%r8), %edx
cmpq %rdx, %rsi
jbe 0x9ec5d
movl (%r8), %r10d
cmpq %r10, %rdi
jae 0x9ec57
cmpq %rdx, %rdi
cmovaq %rdi, %rdx
cmpq %r10, %rsi
cmovbq %rsi, %r10
subq %rdx, %r10
movl $0x0, %edx
cmovaeq %r10, %rdx
addq %rdx, %rcx
addq $0x30, %r8
jmp 0x9ec23
testq %rcx, %rcx
je 0x9ecae
movq %rcx, %xmm1
movq 0x144601(%rip), %xmm2   # 0x1e3270
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x144605(%rip), %xmm3   # 0x1e3280
subpd %xmm3, %xmm1
movapd %xmm1, %xmm4
unpckhpd %xmm1, %xmm4            # xmm4 = xmm4[1],xmm1[1]
addsd %xmm1, %xmm4
movq %rax, %xmm1
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
subpd %xmm3, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
mulsd %xmm0, %xmm2
ucomisd %xmm2, %xmm4
jae 0x9ecb1
xorl %eax, %eax
retq
pushq $0x1
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: dedup_tang_flank(unsigned int*, unsigned int*, unsigned int*, unsigned int*, unsigned int*, unsigned int*)
void dedup_tang_flank(uint32_t *va, uint32_t *vd, uint32_t *vn0, uint32_t *wa, uint32_t *wd, uint32_t *wn0)
{
    uint64_t k, z, vn = (*vn0), wn = (*wn0);
    uint32_t vp, wp;
    for (k = 0; k < vn && k < wn; k++) {
        if(k < vn) {
            vp = va[vn-k-1]>>1;
            for (z = k; (z < wn) && (vp != (wa[z]>>1)); z++);
            if(z < wn) wn = z;
        }
        if(k < wn) {
            wp = wa[k]>>1;
            for (z = k; (z < vn) && (wp != (va[vn-z-1]>>1)); z++);
            if(z < vn) vn = z;
        }
    }
    if(vn < (*vn0)) {
        z = (*vn0) - vn;
        for (k = 0; k < vn; k++) {
            va[k] = va[k + z]; vd[k] = vd[k + z];
        }
    }
    (*vn0) = vn; (*wn0) = wn;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl (%rdx), %r10d
movl (%r9), %eax
leaq -0x4(%rdi), %r11
xorl %ebx, %ebx
movq %r10, %r8
cmpq %r8, %rbx
jae 0x9f8d6
cmpq %rax, %rbx
jae 0x9f8d6
movq %rbx, %r14
notq %r14
leaq (%rdi,%r8,4), %r15
movl (%r15,%r14,4), %ebp
movq %rbx, %r14
cmpq %r14, %rax
je 0x9f890
movl (%rcx,%r14,4), %r15d
xorl %ebp, %r15d
cmpl $0x2, %r15d
jb 0x9f893
incq %r14
jmp 0x9f879
movq %rax, %r14
cmpq %rax, %r14
cmovbq %r14, %rax
cmpq %rax, %rbx
jae 0x9f8cd
movl (%rcx,%rbx,4), %ebp
leaq (%r11,%r8,4), %r15
movq %rbx, %r14
cmpq %r14, %r8
je 0x9f8c3
movl (%r15), %r12d
xorl %ebp, %r12d
cmpl $0x2, %r12d
jb 0x9f8c6
incq %r14
addq $-0x4, %r15
jmp 0x9f8a9
movq %r8, %r14
cmpq %r8, %r14
cmovbq %r14, %r8
incq %rbx
addq $-0x4, %r11
jmp 0x9f85e
cmpq %r10, %r8
jae 0x9f90e
leaq (%rsi,%r10,4), %rcx
leaq (,%r8,4), %r11
subq %r11, %rcx
leaq (%rdi,%r10,4), %r10
subq %r11, %r10
xorl %r11d, %r11d
cmpq %r11, %r8
je 0x9f90e
movl (%r10,%r11,4), %ebx
movl %ebx, (%rdi,%r11,4)
movl (%rcx,%r11,4), %ebx
movl %ebx, (%rsi,%r11,4)
incq %r11
jmp 0x9f8f4
movl %r8d, (%rdx)
movl %eax, (%r9)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: prt_scf_dbg_nds(u_trans_t*, unsigned int*, unsigned int*, unsigned int, ma_ug_t*, ma_ug_t*, ma_ug_t*, unsigned long, unsigned long, char const*)
void prt_scf_dbg_nds(u_trans_t *z, uint32_t *za, uint32_t *zd, uint32_t zn, ma_ug_t *ref, ma_ug_t *hu1, ma_ug_t *hu2, uint64_t s_end, uint64_t e_end, const char *cmd)
{
    uint64_t k, id, rev, ui, uid; ma_utg_t *u;

    id = z->tn; rev = z->rev;
    u = ((id<hu1->u.n)?&(hu1->u.a[id]):&(hu2->u.a[id-hu1->u.n]));
    ui = ((id<hu1->u.n)?1:2); uid = ((id<hu1->u.n)?(id):(id-hu1->u.n));

    fprintf(stderr, "\nCMD::%s[M::%s] h%lutg%.6lu%c(%c)\ts::%u\te::%u\ts_end::%lu\te_end::%lu\tref_n::%u\n", cmd, __func__,
    ui, uid+1, "lc"[u->circ], "+-"[rev], z->ts, z->te, s_end, e_end, (uint32_t)ref->u.n);
    for (k = 0; k < zn; k++) {
        fprintf(stderr, "[%u|%u]", (za[k]>>1), (za[k]&1));
        fprintf(stderr, "utg%.6u%c(%c)(d::%u),", (za[k]>>1)+1, "lc"[ref->u.a[(za[k]>>1)].circ], "+-"[za[k]&1], zd[k]);
    }
    fprintf(stderr, "\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %rax
movq %r8, %rbx
movl %ecx, 0xc(%rsp)
movq %rdx, 0x20(%rsp)
movq %rsi, %r15
movq 0x78(%rsp), %rdx
movq 0x70(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq 0x68(%rsp), %rcx
movq %rcx, 0x18(%rsp)
movl 0x14(%rdi), %r9d
movzbl 0x28(%rdi), %ecx
shrl $0x6, %ecx
andl $0x1, %ecx
movq (%rax), %rsi
movq %r9, %r8
subq %rsi, %r8
jae 0xa0a89
imulq $0x28, %r9, %r12
addq 0x10(%rax), %r12
pushq $0x1
popq %r8
xorl %esi, %esi
jmp 0xa0a9a
movq 0x60(%rsp), %rax
imulq $0x28, %r8, %r12
addq 0x10(%rax), %r12
pushq $0x2
popq %r8
movq 0x1b253f(%rip), %r14    # 0x252fe0
movq (%r14), %rax
subq %rsi, %r9
incq %r9
movl (%r12), %esi
shrl $0x1f, %esi
leaq 0x145bd3(%rip), %r10    # 0x1e668b
movsbl (%rsi,%r10), %r12d
leaq 0x14375f(%rip), %rsi    # 0x1e4223
movsbl (%rcx,%rsi), %r13d
movl 0xc(%rdi), %ebp
movl 0x10(%rdi), %r10d
movl (%rbx), %r11d
subq $0x8, %rsp
leaq 0x148e98(%rip), %rsi    # 0x1e9976
leaq 0x148ee0(%rip), %rcx    # 0x1e99c5
movq %rax, %rdi
xorl %eax, %eax
pushq %r11
pushq 0x20(%rsp)
pushq 0x30(%rsp)
pushq %r10
pushq %rbp
pushq %r13
pushq %r12
callq 0x22b0
addq $0x40, %rsp
movl 0xc(%rsp), %ebp
leaq 0x148ece(%rip), %r13    # 0x1e99dd
xorl %r12d, %r12d
movq (%r14), %rsi
cmpq %r12, %rbp
je 0xa0b85
movl (%r15,%r12,4), %ecx
movl %ecx, %edx
shrl %edx
andl $0x1, %ecx
movq %rsi, %rdi
leaq 0x148ea6(%rip), %rsi    # 0x1e99d5
xorl %eax, %eax
callq 0x22b0
movq (%r14), %rdi
movl (%r15,%r12,4), %eax
movl %eax, %ecx
shrl %ecx
imulq $0x28, %rcx, %rsi
movl %ecx, %edx
incl %edx
movq 0x10(%rbx), %rcx
movl (%rcx,%rsi), %ecx
shrl $0x1f, %ecx
leaq 0x145b31(%rip), %rsi    # 0x1e668b
movsbl (%rcx,%rsi), %ecx
andl $0x1, %eax
leaq 0x1436bb(%rip), %rsi    # 0x1e4223
movsbl (%rax,%rsi), %r8d
movq 0x20(%rsp), %rax
movl (%rax,%r12,4), %r9d
movq %r13, %rsi
xorl %eax, %eax
callq 0x22b0
incq %r12
jmp 0xa0b12
pushq $0xa
popq %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2270
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: prt_gen_scaf_path_lst(unsigned long*, unsigned long, unsigned long, ma_ug_t*, ma_ug_t*)
uint64_t prt_gen_scaf_path_lst(uint64_t *a, uint64_t n, uint64_t is_circle, ma_ug_t *hu1, ma_ug_t *hu2)
{
    uint64_t k, nl, el, tl, id, rev, ui, uid; ma_utg_t *u;
    for (k = nl = el = tl = 0; k < n; k++) {
        nl += (a[k]>>32); id = ((uint32_t)a[k])>>1;
        u = ((id<hu1->u.n)?&(hu1->u.a[id]):&(hu2->u.a[id-hu1->u.n]));
        el += u->len;
    }
    tl = el + nl;
    fprintf(stderr, "[M::%s]tot::%lu\tel::%lu\tnl::%lu\tis_c::%lu\t#::%lu\t%s\n", __func__, tl, el, nl, is_circle, n, ((n>1)?"scf":"ctg"));
    for (k = 0; k < n; k++) {
        id = ((uint32_t)a[k])>>1; rev = ((uint32_t)a[k])&1;
        u = ((id<hu1->u.n)?&(hu1->u.a[id]):&(hu2->u.a[id-hu1->u.n]));
        ui = ((id<hu1->u.n)?1:2); nl = (a[k]>>32);
        uid = ((id<hu1->u.n)?(id):(id-hu1->u.n));
        fprintf(stderr, "[M::%s] h%lutg%.6lu%c(%c)\tlen::%u\tNs::%lu\n", __func__,
        ui, uid+1, "lc"[u->circ], "+-"[rev], u->len, nl);
    }
    return tl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r10
movq %rsi, %r15
movq %rdi, %r12
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
cmpq %rax, %r15
je 0xa0f13
movq (%r12,%rax,8), %rcx
movl %ecx, %edx
shrl %edx
movq %rdx, %rsi
subq (%r14), %rsi
jae 0xa0ef4
imulq $0x28, %rdx, %rdx
addq 0x10(%r14), %rdx
jmp 0xa0efc
imulq $0x28, %rsi, %rdx
addq 0x10(%rbx), %rdx
shrq $0x20, %rcx
addq %rcx, %r9
movl (%rdx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, %r8
incq %rax
jmp 0xa0ed5
leaq (%r9,%r8), %rcx
movq 0x1b20c2(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
cmpq $0x2, %r15
leaq 0x14753d(%rip), %rax    # 0x1e8469
leaq 0x14753a(%rip), %r11    # 0x1e846d
cmovaeq %rax, %r11
subq $0x8, %rsp
leaq 0x148ab1(%rip), %rsi    # 0x1e99f3
leaq 0x148adf(%rip), %rdx    # 0x1e9a28
movq %rcx, 0x8(%rsp)
xorl %eax, %eax
pushq %r11
pushq %r15
pushq %r10
callq 0x22b0
addq $0x20, %rsp
xorl %ebp, %ebp
cmpq %rbp, %r15
je 0xa1005
movq (%r12,%rbp,8), %r10
movl %r10d, %r8d
shrl %r8d
movq (%r14), %rdx
movq %r8, %rax
subq %rdx, %rax
jae 0xa0f8d
imulq $0x28, %r8, %rax
addq 0x10(%r14), %rax
xorl %edx, %edx
pushq $0x1
jmp 0xa0f97
imulq $0x28, %rax, %rax
addq 0x10(%rbx), %rax
pushq $0x2
popq %rcx
movl %r10d, %esi
andl $0x1, %esi
shrq $0x20, %r10
movq 0x1b2037(%rip), %rdi    # 0x252fe0
movq (%rdi), %rdi
subq %rdx, %r8
incq %r8
movl (%rax), %r11d
movl %r11d, %eax
shrl $0x1f, %eax
leaq 0x1456c9(%rip), %rdx    # 0x1e668b
movsbl (%rax,%rdx), %r9d
leaq 0x143255(%rip), %rax    # 0x1e4223
movsbl (%rsi,%rax), %r13d
andl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
subq $0x8, %rsp
leaq 0x148a59(%rip), %rsi    # 0x1e9a3e
leaq 0x148a3c(%rip), %rdx    # 0x1e9a28
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r13
callq 0x22b0
addq $0x20, %rsp
incq %rbp
jmp 0xa0f61
movq (%rsp), %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: cal_arr_N50(unsigned int*, unsigned int, char const*)
void cal_arr_N50(uint32_t *a, uint32_t n, const char *cmd)
{
    uint64_t i, s, len;
    for (i = len = 0; i < n; i++) len += a[i];
    radix_sort_arch32(a, a + n);

    i = n; s = 0;
    while (i > 0) {
        s += a[--i];
        if(s >= (len>>1)) {
            fprintf(stderr, "CMD::%s[M::%s::] N50: %u, Size::%lu\n", cmd, __func__, a[i], len);
            break;
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r15
movl %esi, %r12d
xorl %eax, %eax
xorl %r14d, %r14d
cmpq %rax, %r12
je 0xa103f
movl (%r15,%rax,4), %ecx
addq %rcx, %r14
incq %rax
jmp 0xa102e
leaq (%r15,%r12,4), %rsi
movq %r15, %rdi
callq 0x66e0b
movq %r14, %rax
shrq %rax
xorl %ecx, %ecx
subq $0x1, %r12
jb 0xa1095
movl (%r15,%r12,4), %r8d
addq %r8, %rcx
cmpq %rax, %rcx
jb 0xa1053
movq 0x1b1f74(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0x1489f3(%rip), %rsi    # 0x1e9a69
leaq 0x148a11(%rip), %rcx    # 0x1e9a8e
movq %rbx, %rdx
movq %r14, %r9
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x22b0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: set_fsk(unsigned char*, unsigned char, ul_vec_t*)
void set_fsk(uint8_t *fsk, uint8_t mm, ul_vec_t *idx)
{
    uint64_t k, m, a_n; uc_block_t *a; 
    for (k = 0; k < idx->bb.n; k++) {
        a = idx->bb.a + idx->bb.a[k].ts; a_n = idx->bb.a[k].te - idx->bb.a[k].ts;
        for(m = 0; m < a_n; m++) fsk[a[m].hid] = mm;
    }
}

// Assembly:
xorl %eax, %eax
cmpq 0x20(%rdx), %rax
jae 0xa10e4
movq 0x30(%rdx), %r8
imulq $0x24, %rax, %rcx
movl 0xc(%r8,%rcx), %r9d
movl 0x10(%r8,%rcx), %r10d
imulq $0x24, %r9, %rcx
addq %r8, %rcx
subl %r9d, %r10d
imulq $0x24, %r10, %r8
xorl %r9d, %r9d
cmpq %r9, %r8
je 0xa10df
movl (%rcx,%r9), %r10d
movb %sil, (%rdi,%r10)
addq $0x24, %r9
jmp 0xa10cc
incq %rax
jmp 0xa10a3
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: scaf_hit2arc(u_trans_t*, u_trans_t*, unsigned long, unsigned long, long, asg_arc_t*)
static inline void scaf_hit2arc(u_trans_t *a0, u_trans_t *a1, uint64_t rev, uint64_t el, int64_t glen, asg_arc_t *p)
{
    uint64_t v, w;
    memset(p, 0, sizeof((*p)));
    v = ((uint64_t)(a0->tn<<1))|((uint64_t)(!!(a0->rev))); v^=((uint64_t)(!!(rev)));
    w = ((uint64_t)(a1->tn<<1))|((uint64_t)(!!(a1->rev))); w^=((uint64_t)(!!(rev)));
    // p->ul = v; p->ul <<= 32; p->ul |= a0i; p->v = w; p->ol = a1i; p->el = el; 
    p->ul = v; p->ul <<= 32; p->v = w; p->ol = ((glen>=0)?(glen):(-glen)); p->el = el; p->strong = ((glen>=0)?(1):(0)); 
    // a0r = 0; if((a0->f) || (((a0->qe-a0->qs) >= reliable_len) && ((a0->te-a0->ts) >= reliable_len))) a0r = 1;
    // a1r = 0; if((a1->f) || (((a1->qe-a1->qs) >= reliable_len) && ((a1->te-a1->ts) >= reliable_len))) a1r = 1;
    // p->el = ((a0r && a1r)?1:0);
}

// Assembly:
andq $0x0, 0x10(%r9)
xorps %xmm0, %xmm0
movups %xmm0, (%r9)
movl 0x14(%rdi), %eax
movl 0x28(%rdi), %edi
shrl $0x6, %edi
andl $0x1, %edi
leal (%rdi,%rax,2), %eax
xorl %edi, %edi
testq %rdx, %rdx
setne %dil
xorl %edi, %eax
movl 0x14(%rsi), %edx
movl 0x28(%rsi), %esi
shrl $0x6, %esi
andl $0x1, %esi
leal (%rsi,%rdx,2), %edx
shlq $0x20, %rax
movq %rax, (%r9)
xorl %edi, %edx
movl %edx, 0x8(%r9)
xorl %eax, %eax
testq %r8, %r8
setns %al
movq %r8, %rdx
negq %rdx
cmovsq %r8, %rdx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movl %edx, 0xc(%r9)
movb %cl, 0x12(%r9)
shll $0xe, %eax
movw %ax, 0x10(%r9)
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: gen_contig_trans_func(ma_ug_t*, ma_ug_t*, ma_ug_t*, scaf_res_t*, scaf_res_t*, asg_t*, bubble_type*, ug_opt_t*, kv_u_trans_t*, unsigned char, ma_ug_t**, scaf_res_t**)
kv_u_trans_t *gen_contig_trans_func(ma_ug_t *ref, ma_ug_t *hu0, ma_ug_t *hu1, scaf_res_t *cp0, scaf_res_t *cp1, asg_t *sg, bubble_type *bu, ug_opt_t *opt, kv_u_trans_t *bd, uint8_t is_sep, ma_ug_t **rmg, scaf_res_t **rms)
{

    kv_u_trans_t *os; CALLOC(os, 1);
    if(is_sep) {
        gen_contig_trans(opt, sg, hu1, cp1, hu0, cp0, ref, bd, hu0->u.n, 0, bu, os);
        gen_contig_trans(opt, sg, hu0, cp0, hu1, cp1, ref, bd, 0, hu0->u.n, bu, os);
    } else {
        ma_ug_t *mg = merge_utgs(hu0, hu1); scaf_res_t *ms = merge_scaf_res(cp0, cp1);
        gen_contig_self(opt, sg, mg, ms, ref, bd, hu0->u.n, bu, os, 0);
        if(!rmg) ma_ug_destroy(mg); 
        else (*rmg) = mg;
        if(!rms) destroy_scaf_res_t(ms);
        else (*rms) = ms;
    }

    kt_u_trans_t_idx(os, hu0->u.n + hu1->u.n);
    update_ctg_trans_cc(os);
    return os;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %rbp
movq %r8, %r13
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
pushq $0x1
popq %rdi
pushq $0x30
popq %rsi
callq 0x2120
movq %rax, %r15
cmpb $0x0, 0x68(%rsp)
je 0xa2771
movl (%rbx), %eax
movq 0x58(%rsp), %rdi
movq %r13, %rcx
movq %r13, 0x10(%rsp)
movq %rbp, %r13
movq %rbp, %rsi
movq %r12, %rdx
movq %rbx, %r8
movq %r14, %r9
pushq %r15
movq 0x58(%rsp), %r10
pushq %r10
pushq $0x0
pushq %rax
movq 0x80(%rsp), %rax
pushq %rax
movq 0x30(%rsp), %rbp
pushq %rbp
callq 0x19bf9c
addq $0x30, %rsp
movl (%rbx), %eax
movq 0x58(%rsp), %rdi
movq %r13, %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq %r12, %r8
movq 0x10(%rsp), %r9
pushq %r15
pushq 0x58(%rsp)
pushq %rax
pushq $0x0
pushq 0x80(%rsp)
pushq %rbp
callq 0x19bf9c
addq $0x30, %rsp
jmp 0xa27f1
movq %rbx, %rdi
movq %r12, (%rsp)
movq %r12, %rsi
callq 0xa21dc
movq %rax, %r12
movq %r14, %rdi
movq %r13, %rsi
callq 0xa24cc
movq %rax, %r14
movq 0x58(%rsp), %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq %rax, %rcx
movq 0x8(%rsp), %r8
movq 0x60(%rsp), %r9
pushq $0x0
pushq %r15
pushq 0x60(%rsp)
pushq (%rbx)
callq 0x19c162
movq 0x90(%rsp), %rax
addq $0x20, %rsp
testq %rax, %rax
je 0xa27ce
movq %r12, (%rax)
jmp 0xa27d6
movq %r12, %rdi
callq 0x6921d
movq 0x78(%rsp), %rax
testq %rax, %rax
je 0xa27e5
movq %r14, (%rax)
jmp 0xa27ed
movq %r14, %rdi
callq 0xbb11
movq (%rsp), %r12
movl (%r12), %esi
addl (%rbx), %esi
movq %r15, %rdi
callq 0x88a31
movq %r15, %rdi
callq 0x9e234
movq %r15, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: output_read_graph(asg_t*, ma_sub_t*, char*, long long)
void output_read_graph(asg_t *sg, ma_sub_t* coverage_cut, char* output_file_name, long long n_read)
{
    fprintf(stderr, "Writing read GFA to disk... \n");
    char* gfa_name = (char*)malloc(strlen(output_file_name)+25);
    sprintf(gfa_name, "%s.read.gfa", output_file_name);
    FILE* output_file = fopen(gfa_name, "w");
    ma_sg_print(sg, &R_INF, coverage_cut, output_file);
    free(gfa_name);
    fclose(output_file);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq 0x1af6f7(%rip), %rax    # 0x252fe0
movq (%rax), %rcx
leaq 0x14632c(%rip), %rdi    # 0x1e9c1f
pushq $0x1d
popq %rsi
pushq $0x1
popq %rdx
callq 0x2410
movq %r15, %rdi
callq 0x2090
leaq 0x19(%rax), %rdi
callq 0x2280
movq %rax, %r12
leaq 0x146324(%rip), %rsi    # 0x1e9c3d
movq %rax, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x156d74(%rip), %rsi    # 0x1fa6a1
movq %r12, %rdi
callq 0x2210
movq %rax, %r15
leaq 0x1b08f1(%rip), %rsi    # 0x254230
movq %r14, %rdi
movq %rbx, %rdx
movq %rax, %rcx
callq 0x7dc67
movq %r12, %rdi
callq 0x2220
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2190
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: write_ma(ma_hit_t*, _IO_FILE*)
void write_ma(ma_hit_t* x, FILE* fp)
{
    fwrite(&(x->qns), sizeof(x->qns), 1, fp);
    fwrite(&(x->qe), sizeof(x->qe), 1, fp);
    fwrite(&(x->tn), sizeof(x->tn), 1, fp);
    fwrite(&(x->ts), sizeof(x->ts), 1, fp);
    fwrite(&(x->te), sizeof(x->te), 1, fp);
    fwrite(&(x->el), sizeof(x->el), 1, fp);
    fwrite(&(x->no_l_indel), sizeof(x->no_l_indel), 1, fp);

    uint32_t t = x->ml;
    fwrite(&(t), sizeof(t), 1, fp);
    t = x->rev;
    fwrite(&(t), sizeof(t), 1, fp);

    t = x->bl;
    fwrite(&(t), sizeof(t), 1, fp);
    t =x->del;
    fwrite(&(t), sizeof(t), 1, fp);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r15
pushq $0x8
popq %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
movq %rbx, %rcx
callq 0x2410
leaq 0x8(%r15), %rdi
pushq $0x4
popq %r12
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x2410
leaq 0xc(%r15), %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x2410
leaq 0x10(%r15), %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x2410
leaq 0x14(%r15), %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x2410
movsbl 0x20(%r15), %edi
movq %rbx, %rsi
callq 0x2270
movsbl 0x21(%r15), %edi
movq %rbx, %rsi
callq 0x2270
movl 0x18(%r15), %eax
shrl $0x1e, %eax
andl $0x1, %eax
leaq 0xc(%rsp), %r13
movl %eax, (%r13)
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x2410
movl 0x18(%r15), %eax
shrl $0x1f, %eax
movl %eax, (%r13)
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x2410
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl 0x1c(%r15), %eax
movl %eax, (%r13)
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x2410
movq 0x18(%r15), %rax
shrq $0x3f, %rax
movl %eax, (%r13)
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x2410
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: write_ma_hit_ts(ma_hit_t_alloc*, long long, char*)
void write_ma_hit_ts(ma_hit_t_alloc* x, long long n_read, char* read_file_name)
{
    fprintf(stderr, "Writing ma_hit_ts to disk... \n");
    char* index_name = (char*)malloc(strlen(read_file_name)+15);
    sprintf(index_name, "%s.bin", read_file_name);
    FILE* fp = fopen(index_name, "w");
    long long i, k;
    fwrite(&n_read, sizeof(n_read), 1, fp);


    for (i = 0; i < n_read; i++)
    {
        fwrite(&(x[i].is_fully_corrected), sizeof(x[i].is_fully_corrected), 1, fp);
        fwrite(&(x[i].is_abnormal), sizeof(x[i].is_abnormal), 1, fp);
        fwrite(&(x[i].length), sizeof(x[i].length), 1, fp);
        for (k = 0; k < x[i].length; k++)
        {
            write_ma(x[i].buffer + k, fp);
        }  
        // fwrite(x[i].buffer, sizeof((*(x[i].buffer))), x[i].length, fp);
    }


    free(index_name);
    fflush(fp);    
    fclose(fp);
    fprintf(stderr, "ma_hit_ts has been written.\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r12
movq %rdi, 0x10(%rsp)
leaq 0x20(%rsp), %r13
movq %rsi, (%r13)
movq 0x1af1eb(%rip), %rax    # 0x252fe0
movq (%rax), %rcx
leaq 0x145e85(%rip), %rdi    # 0x1e9c84
pushq $0x1e
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x2410
movq %r12, %rdi
callq 0x2090
leaq 0xf(%rax), %rdi
callq 0x2280
movq %rax, %r14
leaq 0x13e823(%rip), %rsi    # 0x1e264b
xorl %r15d, %r15d
movq %rax, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x156862(%rip), %rsi    # 0x1fa6a1
movq %r14, 0x8(%rsp)
movq %r14, %rdi
callq 0x2210
movq %rax, %r12
pushq $0x8
popq %rsi
movq %r13, %rdi
movq %rbx, %rdx
movq %rax, %rcx
callq 0x2410
movq (%r13), %rax
movq %rax, 0x18(%rsp)
cmpq 0x18(%rsp), %r15
jge 0xa3ed8
imulq $0x18, %r15, %rax
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax), %r13
leaq (%rcx,%rax), %rbp
addq $0xc, %rbp
movsbl 0x4(%rbp), %edi
movq %r12, %rsi
callq 0x2270
movsbl 0x5(%rbp), %edi
movq %r12, %rsi
callq 0x2270
movq %rbp, %rdi
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %r12, %rcx
callq 0x2410
xorl %r14d, %r14d
xorl %ebx, %ebx
movl (%rbp), %eax
cmpq %rax, %rbx
jae 0xa3ed3
movq (%r13), %rdi
addq %r14, %rdi
movq %r12, %rsi
callq 0xa3cbb
incq %rbx
addq $0x28, %r14
jmp 0xa3eb3
incq %r15
jmp 0xa3e69
movq 0x8(%rsp), %rdi
callq 0x2220
movq %r12, %rdi
callq 0x2200
movq %r12, %rdi
callq 0x2190
movq 0x1af0e7(%rip), %rax    # 0x252fe0
movq (%rax), %rcx
leaq 0x145da0(%rip), %rdi    # 0x1e9ca3
pushq $0x1c
popq %rsi
pushq $0x1
popq %rdx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2410