// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/Overlaps.cpp
// Function: output_contig_graph_alternative(asg_t*, ma_sub_t*, char*, ma_hit_t_alloc*, R_to_U*, int, int)
void output_contig_graph_alternative(asg_t *sg, ma_sub_t* coverage_cut, char* output_file_name,
ma_hit_t_alloc* sources, R_to_U* ruIndex, int max_hang, int min_ovlp)
{
    kvec_asg_arc_t_warp new_rtg_edges;
    kv_init(new_rtg_edges.a);
    ma_ug_t *ug = NULL;
    ug = ma_ug_gen_primary(sg, ALTER_LABLE);

    // if(asm_opt.b_low_cov > 0)
    // {
    //     break_ug_contig(&ug, sg, &R_INF, coverage_cut, sources, ruIndex, &new_rtg_edges, max_hang, min_ovlp, asm_opt.b_low_cov);
    // }

    ma_ug_seq(ug, sg, coverage_cut, sources, &new_rtg_edges, max_hang, min_ovlp, 0, 1);

    fprintf(stderr, "Writing alternate contig GFA to disk... \n");
    char* gfa_name = (char*)malloc(strlen(output_file_name)+35);
    sprintf(gfa_name, "%s.a_ctg.gfa", output_file_name);
    FILE* output_file = fopen(gfa_name, "w");
    ma_ug_print(ug, sg, coverage_cut, sources, ruIndex, "atg", output_file);
    fclose(output_file);
    
    sprintf(gfa_name, "%s.a_ctg.noseq.gfa", output_file_name);
    output_file = fopen(gfa_name, "w");
    ma_ug_print_simple(ug, sg, coverage_cut, sources, ruIndex, "atg", output_file);
    fclose(output_file);
    if(asm_opt.bed_inconsist_rate != 0)
    {
        sprintf(gfa_name, "%s.a_ctg.lowQ.bed", output_file_name);
        output_file = fopen(gfa_name, "w");
        ma_ug_print_bed(ug, sg, &R_INF, coverage_cut, sources, &new_rtg_edges, 
        max_hang, min_ovlp, asm_opt.bed_inconsist_rate, "atg", output_file, NULL);
        fclose(output_file);
    }

    free(gfa_name);
    ma_ug_destroy(ug);
    kv_destroy(new_rtg_edges.a);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %r9d, %r15d
movq %r8, 0x20(%rsp)
movq %rcx, %r13
movq %rcx, 0x18(%rsp)
movq %rdx, (%rsp)
movq %rsi, %r14
movq %rsi, 0x10(%rsp)
movq %rdi, %rbp
movq %rdi, 0x8(%rsp)
movl 0xa0(%rsp), %r12d
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %rbx
movaps %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
pushq $0x1
popq %rsi
callq 0xb2a6d
movq %rax, 0x38(%rsp)
subq $0x8, %rsp
movq %rax, %rdi
movq %rbp, %rsi
movq %r14, %rdx
movq %r13, %rcx
movq %rbx, %r8
movq %r15, 0x38(%rsp)
movl %r15d, %r9d
pushq $0x1
popq %rax
pushq %rax
pushq $0x0
movq %r12, 0x40(%rsp)
pushq %r12
callq 0xb67c4
addq $0x20, %rsp
movq 0x28c71f(%rip), %rax    # 0x294fe0
movq (%rax), %rcx
leaq 0x2302a9(%rip), %rdi    # 0x238b74
pushq $0x29
popq %rsi
pushq $0x1
popq %rdx
callq 0x2410
movq (%rsp), %r14
movq %r14, %rdi
callq 0x2090
leaq 0x23(%rax), %rdi
callq 0x2280
movq %rax, %rbx
leaq 0x2302a9(%rip), %rsi    # 0x238b9e
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x23fdd9(%rip), %rsi    # 0x2486e2
movq %rbx, %rdi
callq 0x2210
movq %rax, %r15
subq $0x8, %rsp
leaq 0x23028c(%rip), %rax    # 0x238bab
leaq 0x28d90a(%rip), %rsi    # 0x296230
movq 0x40(%rsp), %rbp
movq %rbp, %rdi
movq 0x10(%rsp), %r12
movq %r12, %rdx
movq 0x18(%rsp), %r13
movq %r13, %rcx
movq 0x20(%rsp), %r14
movq %r14, %r8
movq 0x28(%rsp), %r9
pushq %r15
pushq %rax
pushq $0x1
popq %rax
pushq %rax
callq 0xb7823
addq $0x20, %rsp
movq %r15, %rdi
callq 0x2190
leaq 0x230245(%rip), %rsi    # 0x238baf
movq %rbx, %rdi
movq (%rsp), %rdx
xorl %eax, %eax
callq 0x2050
movq %rbx, %rdi
leaq 0x23fd60(%rip), %rsi    # 0x2486e2
callq 0x2210
movq %rax, %r15
subq $0x8, %rsp
movq %rbp, %rdi
leaq 0x28d898(%rip), %rsi    # 0x296230
movq %r12, %rdx
movq %r13, %rcx
movq %r14, %r8
leaq 0x230203(%rip), %r14    # 0x238bab
movq 0x28(%rsp), %r9
pushq %rax
pushq %r14
pushq $0x0
callq 0xb7823
addq $0x20, %rsp
movq %r15, %rdi
callq 0x2190
leaq 0x28cd8e(%rip), %r12    # 0x295758
cmpl $0x0, 0x150(%r12)
je 0x8a42
leaq 0x2301e6(%rip), %rsi    # 0x238bc2
movq %rbx, %rdi
movq (%rsp), %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x23fcf1(%rip), %rsi    # 0x2486e2
movq %rbx, %rdi
callq 0x2210
movq %rax, %r15
movl 0x150(%r12), %eax
leaq 0x28d825(%rip), %rdx    # 0x296230
leaq 0x40(%rsp), %r9
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %r8
pushq $0x0
pushq %r15
pushq %r14
pushq %rax
pushq 0x48(%rsp)
pushq 0x58(%rsp)
callq 0xb8f0d
addq $0x30, %rsp
movq %r15, %rdi
callq 0x2190
movq %rbx, %rdi
callq 0x2220
movq %rbp, %rdi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa0761