// File: chhylp123[P]hifiasm/Assembly.cpp
// Function: hap_recalculate_peaks(char*)
void hap_recalculate_peaks(char* output_file_name)
{
    destory_read_bin(&R_INF);
    destory_ma_hit_t_alloc(R_INF.paf);
    destory_ma_hit_t_alloc(R_INF.reverse_paf);

    char* gfa_name = (char*)malloc(strlen(output_file_name)+25);
	sprintf(gfa_name, "%s.ec", output_file_name);

    int hom_cov, het_cov;
    // construct hash table for high occurrence k-mers
    if (!(asm_opt.flag & HA_F_NO_KMER_FLT)) {
        ha_flt_tab = ha_ft_gen(&asm_opt, &R_INF, &hom_cov, 0, 0);
        ha_opt_update_cov(&asm_opt, hom_cov);
    }
    free(R_INF.read_length);
    free(R_INF.name_index);

    load_All_reads(&R_INF, gfa_name);

    ha_idx = ha_pt_gen(&asm_opt, ha_flt_tab, 1, 0, &R_INF, &hom_cov, &het_cov); // build the index
    asm_opt.hom_cov = hom_cov;
    asm_opt.het_cov = het_cov;
    ha_pt_destroy(ha_idx);
    ha_idx = 0;

    destory_read_bin(&R_INF);
    free(gfa_name);

    load_all_data_from_disk(&R_INF.paf, &R_INF.reverse_paf, asm_opt.output_file_name); 
    fprintf(stderr, "M::%s has done.\n", __func__);   
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x3aaaad(%rip), %rdi    # 0x3c52d0
callq 0x8fc0
movq 0x3aab19(%rip), %rdi    # 0x3c5348
callq 0xce190
movq 0x3aab15(%rip), %rdi    # 0x3c5350
callq 0xce190
movq -0x8(%rbp), %rdi
callq 0x20a0
movq %rax, %rdi
addq $0x19, %rdi
callq 0x2270
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x36738a(%rip), %rsi    # 0x381bf2
movb $0x0, %al
callq 0x2050
leaq 0x3a9f82(%rip), %rax    # 0x3c47f8
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x1a8b9
leaq 0x3a9f71(%rip), %rdi    # 0x3c47f8
leaq 0x3aaa42(%rip), %rsi    # 0x3c52d0
leaq -0x14(%rbp), %rdx
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x189600
movq %rax, %rcx
leaq 0x3aac29(%rip), %rax    # 0x3c54d0
movq %rcx, (%rax)
movl -0x14(%rbp), %esi
leaq 0x3a9f44(%rip), %rdi    # 0x3c47f8
callq 0x3b60
movq 0x3aaa28(%rip), %rdi    # 0x3c52e8
callq 0x2210
movq 0x3aaa44(%rip), %rdi    # 0x3c5310
callq 0x2210
movq -0x10(%rbp), %rsi
leaq 0x3aa9f4(%rip), %rdi    # 0x3c52d0
callq 0x79a0
leaq 0x3aabe8(%rip), %rax    # 0x3c54d0
movq (%rax), %rsi
leaq 0x3a9f06(%rip), %rdi    # 0x3c47f8
movl $0x1, %edx
xorl %ecx, %ecx
leaq 0x3aa9d0(%rip), %r8     # 0x3c52d0
leaq -0x14(%rbp), %r9
leaq -0x18(%rbp), %rax
movq %rax, (%rsp)
callq 0x18a180
movq %rax, %rcx
leaq 0x3aabbd(%rip), %rax    # 0x3c54d8
movq %rcx, (%rax)
movl -0x14(%rbp), %ecx
leaq 0x3a9ed0(%rip), %rax    # 0x3c47f8
movl %ecx, 0xd0(%rax)
movl -0x18(%rbp), %ecx
leaq 0x3a9ec0(%rip), %rax    # 0x3c47f8
movl %ecx, 0xd4(%rax)
leaq 0x3aab93(%rip), %rax    # 0x3c54d8
movq (%rax), %rdi
callq 0x187660
leaq 0x3aab84(%rip), %rax    # 0x3c54d8
movq $0x0, (%rax)
leaq 0x3aa96e(%rip), %rdi    # 0x3c52d0
callq 0x8fc0
movq -0x10(%rbp), %rdi
callq 0x2210
leaq 0x3a9e81(%rip), %rax    # 0x3c47f8
movq 0x10(%rax), %rdx
leaq 0x3aa94e(%rip), %rsi    # 0x3c52d0
movq %rsi, %rdi
addq $0x78, %rdi
addq $0x80, %rsi
callq 0x133660
movq 0x3a9644(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x367252(%rip), %rsi    # 0x381bf8
leaq 0x36725c(%rip), %rdx    # 0x381c09
movb $0x0, %al
callq 0x22a0
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)