// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: output_trio_graph(asg_t*, ma_sub_t*, char*, ma_hit_t_alloc*, ma_hit_t_alloc*, long long, float, long long, R_to_U*, float, float, int, int, int, long long, ug_opt_t*, bub_label_t*)
void output_trio_graph(asg_t *sg, ma_sub_t* coverage_cut, char* output_file_name, 
ma_hit_t_alloc* sources, ma_hit_t_alloc* reverse_sources, long long tipsLen, float tip_drop_ratio, 
long long stops_threshold, R_to_U* ruIndex, float chimeric_rate, float drop_ratio, int max_hang, 
int min_ovlp, int is_bench, long long gap_fuzz, ug_opt_t *opt, bub_label_t* b_mask_t)
{
    reduce_hamming_error_adv(NULL, sg, sources, coverage_cut, max_hang, min_ovlp, gap_fuzz, opt->ruIndex, NULL);
    uint8_t *rf = NULL;

    if(asm_opt.kpt_rate > 0) CALLOC(rf, sg->n_seq); 

    output_trio_unitig_graph(sg, coverage_cut, output_file_name, FATHER, sources, 
        reverse_sources, tipsLen, tip_drop_ratio, stops_threshold, ruIndex, chimeric_rate, 
        drop_ratio, max_hang, min_ovlp, gap_fuzz, is_bench, b_mask_t, NULL, rf, NULL);
    
    output_trio_unitig_graph(sg, coverage_cut, output_file_name, MOTHER, sources, 
        reverse_sources, tipsLen, tip_drop_ratio, stops_threshold, ruIndex, chimeric_rate, 
        drop_ratio, max_hang, min_ovlp, gap_fuzz, is_bench, b_mask_t, NULL, rf, NULL);

    if(rf) {
        kvec_asg_arc_t_warp r_edges; kv_init(r_edges.a);
        ma_ug_t *kug = NULL; 
        char* kug_n = (char*)malloc(strlen(output_file_name)+100);
        sprintf(kug_n, "%s.kdp", output_file_name);

        update_dump_trio(R_INF.trio_flag, sg->n_seq, rf, NULL);
        kug = output_trio_unitig_graph(sg, coverage_cut, output_file_name, FATHER, sources, 
                reverse_sources, tipsLen, tip_drop_ratio, stops_threshold, ruIndex, chimeric_rate, 
                drop_ratio, max_hang, min_ovlp, gap_fuzz, 1, b_mask_t, NULL, NULL, &r_edges);
        filter_set_kug(R_INF.trio_flag, sg, rf, &r_edges, asm_opt.kpt_rate, &kug);
        print_utg(&kug, sg, coverage_cut, kug_n, sources, ruIndex, max_hang, min_ovlp, &r_edges);
        
        free(kug_n), kv_destroy(r_edges.a); ma_ug_destroy(kug); 
        free(rf);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movss %xmm2, 0xc(%rsp)
movss %xmm1, 0x8(%rsp)
movss %xmm0, 0x4(%rsp)
movq %r9, 0x40(%rsp)
movq %r8, 0x18(%rsp)
movq %rdx, %rbx
movq %rsi, %rax
movq %rdi, %r15
movq 0xd8(%rsp), %rdx
movl 0xc8(%rsp), %r9d
movl 0xc0(%rsp), %r8d
subq $0x20, %rsp
andq $0x0, 0x10(%rsp)
movq %rdx, (%rsp)
movq $0x0, 0x30(%rsp)
xorl %edi, %edi
movq %r15, %rsi
movq %rcx, %r13
movq %rcx, %rdx
movq %rax, %r12
movq %rax, %rcx
callq 0x8f127
addq $0x20, %rsp
leaq 0x1b6d1d(%rip), %rax    # 0x253758
movss 0x208(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x9ca62
movl 0x14(%r15), %edi
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
pushq $0x1
popq %rsi
callq 0x2120
movq %rax, 0x10(%rsp)
subq $0x8, %rsp
pushq $0x1
popq %rcx
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %r13, %rbp
movq %r13, %r8
movq %rbx, %r10
movq 0x20(%rsp), %rbx
movq %rbx, %r9
movss 0xc(%rsp), %xmm0
movss 0x10(%rsp), %xmm1
movss 0x14(%rsp), %xmm2
pushq $0x0
movq 0x20(%rsp), %r13
pushq %r13
pushq $0x0
movq 0x108(%rsp), %rax
pushq %rax
movl 0xf8(%rsp), %eax
pushq %rax
movq 0x108(%rsp), %rax
pushq %rax
movl 0x100(%rsp), %eax
pushq %rax
movl 0x100(%rsp), %r14d
pushq %r14
movq 0x100(%rsp), %rax
pushq %rax
movq 0x100(%rsp), %rax
pushq %rax
movq %r10, %r14
movq 0x98(%rsp), %r13
pushq %r13
callq 0x86cbc
addq $0x58, %rsp
pushq $0x2
popq %rcx
movq %r15, 0x30(%rsp)
movq %r15, %rdi
movq %r12, 0x40(%rsp)
movq %r12, %rsi
movq %r14, %r12
movq %r14, %rdx
movq %rbp, 0x38(%rsp)
movq %rbp, %r8
movq %rbx, %r9
movss 0xc(%rsp), %xmm0
movss 0x10(%rsp), %xmm1
movss 0x14(%rsp), %xmm2
pushq $0x0
movq 0x20(%rsp), %rbx
pushq %rbx
pushq $0x0
pushq 0x108(%rsp)
movl 0xf8(%rsp), %eax
pushq %rax
movl 0xf0(%rsp), %r15d
pushq 0x108(%rsp)
movl 0x100(%rsp), %eax
pushq %rax
pushq %r15
pushq 0x100(%rsp)
pushq 0x100(%rsp)
movq %r13, %r14
pushq %r13
callq 0x86cbc
addq $0x60, %rsp
testq %rbx, %rbx
je 0x9cd20
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq %r12, %rbx
movq %r12, %rdi
callq 0x2090
leaq 0x64(%rax), %rdi
callq 0x2280
movq %rax, 0x20(%rsp)
leaq 0x14caeb(%rip), %rsi    # 0x1e969c
movq %rax, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x1b766b(%rip), %rax    # 0x254230
movq 0x28(%rax), %rdi
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movq 0x28(%rsp), %rbp
andl 0x14(%rbp), %esi
movq 0x10(%rsp), %r13
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x8689c
subq $0x60, %rsp
leaq 0xb0(%rsp), %rax
movq %rax, 0x50(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rsp)
movq 0x148(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x138(%rsp), %rax
movl %eax, 0x28(%rsp)
movl 0x128(%rsp), %eax
movl %eax, 0x20(%rsp)
movl %r15d, 0x18(%rsp)
movq 0x118(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x110(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r14, (%rsp)
movl $0x1, 0x30(%rsp)
pushq $0x1
popq %rcx
movq %rbp, %rdi
movq 0x98(%rsp), %r12
movq %r12, %rsi
movq %rbx, %rdx
movq 0x90(%rsp), %rbx
movq %rbx, %r8
movq 0x78(%rsp), %r9
movss 0x64(%rsp), %xmm0
movss 0x68(%rsp), %xmm1
movss 0x6c(%rsp), %xmm2
callq 0x86cbc
addq $0x60, %rsp
leaq 0x48(%rsp), %r15
movq %rax, (%r15)
leaq 0x1b7595(%rip), %rax    # 0x254230
movq 0x28(%rax), %rdi
leaq 0x1b6ab2(%rip), %rax    # 0x253758
movss 0x208(%rax), %xmm0
movq %rbp, %rsi
movq %r13, %rdx
leaq 0x50(%rsp), %r14
movq %r14, %rcx
movq %r15, %r8
callq 0x9c7a2
subq $0x8, %rsp
movq %r15, %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq 0x28(%rsp), %r12
movq %r12, %rcx
movq %rbx, %r8
movq 0xc0(%rsp), %r9
pushq %r14
movl 0xd8(%rsp), %eax
pushq %rax
movl 0xd8(%rsp), %eax
pushq %rax
callq 0x83df0
addq $0x20, %rsp
movq %r12, %rdi
callq 0x2220
movq 0x10(%r14), %rdi
callq 0x2220
movq (%r15), %rdi
callq 0x6921d
movq %r13, %rdi
callq 0x2220
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq