// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: write_debug_graph(asg_t*, ma_hit_t_alloc*, ma_sub_t*, char*, ma_hit_t_alloc*, R_to_U*, all_ul_t*)
int write_debug_graph(asg_t *sg, ma_hit_t_alloc* sources, ma_sub_t* coverage_cut, 
char* output_file_name, ma_hit_t_alloc* reverse_sources, R_to_U* ruIndex, all_ul_t *ul_r_inf)
{

    char* gfa_name = (char*)malloc(strlen(output_file_name)+55);

    ////write_All_reads(&R_INF, gfa_name);
    sprintf(gfa_name, "%s.all.debug.source", output_file_name);
    write_debug_ma_hit_ts(sources, R_INF.total_reads, gfa_name);
    sprintf(gfa_name, "%s.all.debug.reverse", output_file_name);
    write_debug_ma_hit_ts(reverse_sources, R_INF.total_reads, gfa_name);
    if(coverage_cut) {
        sprintf(gfa_name, "%s.all.debug.coverage_cut", output_file_name);
        write_coverage_cut(coverage_cut, gfa_name, R_INF.total_reads);
    }
    sprintf(gfa_name, "%s.all.debug.ruIndex", output_file_name);
    write_ruIndex(ruIndex, gfa_name);
    if(sg) {
        sprintf(gfa_name, "%s.all.debug.asg_t", output_file_name);
        write_asg_t(sg, gfa_name);
    }
    if(ul_r_inf) {
        sprintf(gfa_name, "%s.all.debug.ul.rinfor", output_file_name);
        write_all_ul_t(ul_r_inf, gfa_name, NULL);
    }
    free(gfa_name);
    fprintf(stderr, "debug_graph has been written.\n");
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x20(%rbp), %rdi
callq 0x20a0
movq %rax, %rdi
addq $0x37, %rdi
callq 0x2270
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x23b669(%rip), %rsi    # 0x389555
movb $0x0, %al
callq 0x2050
movq -0x10(%rbp), %rdi
leaq 0x2773d2(%rip), %rax    # 0x3c52d0
movq 0x50(%rax), %rsi
movq -0x38(%rbp), %rdx
callq 0x132e20
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x23b64f(%rip), %rsi    # 0x389569
movb $0x0, %al
callq 0x2050
movq -0x28(%rbp), %rdi
leaq 0x2773a4(%rip), %rax    # 0x3c52d0
movq 0x50(%rax), %rsi
movq -0x38(%rbp), %rdx
callq 0x132e20
cmpq $0x0, -0x18(%rbp)
je 0x14df6e
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x23b62f(%rip), %rsi    # 0x38957e
movb $0x0, %al
callq 0x2050
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq 0x27736b(%rip), %rax    # 0x3c52d0
movq 0x50(%rax), %rdx
callq 0x14d560
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x23b61b(%rip), %rsi    # 0x389598
movb $0x0, %al
callq 0x2050
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x14d610
cmpq $0x0, -0x8(%rbp)
je 0x14dfbb
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x23b606(%rip), %rsi    # 0x3895ad
movb $0x0, %al
callq 0x2050
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x14d900
cmpq $0x0, 0x10(%rbp)
je 0x14dfe9
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x23b5ef(%rip), %rsi    # 0x3895c0
movb $0x0, %al
callq 0x2050
movq 0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x2fd590
movq -0x38(%rbp), %rdi
callq 0x2210
movq 0x275fe7(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x23b5d4(%rip), %rsi    # 0x3895d7
movb $0x0, %al
callq 0x22a0
movl $0x1, %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)