// File: /workspace/github_cpp_makefile_star2_O1/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, %r14
movq %rdx, %rbp
movq %rsi, %rax
movq %rdi, %r12
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 %r12, %rsi
movq %rcx, %r13
movq %rcx, %rdx
movq %rax, %r15
movq %rax, %rcx
callq 0x927f
addq $0x20, %rsp
leaq 0x27f26c(%rip), %rax    # 0x28a758
movss 0x208(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0xb514
movl 0x14(%r12), %edi
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
pushq $0x1
popq %rsi
callq 0x2120
movq %rax, 0x10(%rsp)
subq $0x8, %rsp
pushq $0x1
popq %rcx
movq %r12, %rdi
movq %r15, 0x20(%rsp)
movq %r15, %rsi
movq %rbp, %rdx
movq %r12, %r15
movq %r13, %r12
movq %r13, %r8
movq %r14, %rbx
movq %r14, %r9
movss 0xc(%rsp), %xmm0
movss 0x10(%rsp), %xmm1
movss 0x14(%rsp), %xmm2
pushq $0x0
movq 0x20(%rsp), %r14
pushq %r14
pushq $0x0
movq 0x108(%rsp), %rax
pushq %rax
movl 0xf8(%rsp), %eax
pushq %rax
movq 0x108(%rsp), %r13
pushq %r13
movl 0x100(%rsp), %eax
pushq %rax
movl 0x100(%rsp), %eax
pushq %rax
movq 0x100(%rsp), %rax
pushq %rax
movq 0x100(%rsp), %r13
pushq %r13
movq 0x98(%rsp), %r13
pushq %r13
callq 0xc21cc
addq $0x58, %rsp
pushq $0x2
popq %rcx
movq %r15, 0x38(%rsp)
movq %r15, %rdi
movq 0x20(%rsp), %rsi
movq %rbp, %r15
movq %rbp, %rdx
movq %r12, 0x40(%rsp)
movq %r12, %r8
movq %rbx, %rbp
movq %rbx, %r9
movss 0xc(%rsp), %xmm0
movss 0x10(%rsp), %xmm1
movss 0x14(%rsp), %xmm2
pushq $0x0
pushq %r14
pushq $0x0
pushq 0x108(%rsp)
movl 0xf8(%rsp), %r10d
pushq %r10
pushq 0x108(%rsp)
movl 0x100(%rsp), %eax
pushq %rax
movl 0x100(%rsp), %eax
pushq %rax
pushq 0x100(%rsp)
movq 0x100(%rsp), %rax
movq %rax, %rbx
pushq %rax
pushq %r13
callq 0xc21cc
addq $0x60, %rsp
testq %r14, %r14
jne 0xb63c
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
leaq 0x48(%rsp), %rax
andq $0x0, (%rax)
movq %r15, %rdi
movq %r15, 0x20(%rsp)
callq 0x2090
leaq 0x64(%rax), %rdi
callq 0x2280
movq %rax, 0x28(%rsp)
leaq 0x21ff35(%rip), %rsi    # 0x22b5ac
movq %rax, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x27fba5(%rip), %rax    # 0x28b230
movq 0x28(%rax), %rdi
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movq 0x30(%rsp), %r14
andl 0x14(%r14), %esi
movq 0x10(%rsp), %r12
movq %r12, %rdx
xorl %ecx, %ecx
callq 0xc1ead
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), %r15d
movl %r15d, 0x20(%rsp)
movl 0x120(%rsp), %eax
movl %eax, 0x18(%rsp)
movq 0x118(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %rbx, 0x8(%rsp)
movq %r13, (%rsp)
movl $0x1, 0x30(%rsp)
pushq $0x1
popq %rcx
movq %r14, %rdi
movq 0x78(%rsp), %r13
movq %r13, %rsi
movq 0x80(%rsp), %rdx
movq 0x98(%rsp), %rbx
movq %rbx, %r8
movq %rbp, %r9
movss 0x64(%rsp), %xmm0
movss 0x68(%rsp), %xmm1
movss 0x6c(%rsp), %xmm2
callq 0xc21cc
addq $0x60, %rsp
leaq 0x48(%rsp), %rbp
movq %rax, (%rbp)
leaq 0x27facd(%rip), %rax    # 0x28b230
movq 0x28(%rax), %rdi
leaq 0x27efea(%rip), %rax    # 0x28a758
movss 0x208(%rax), %xmm0
movq %r14, %rsi
movq %r12, %rdx
leaq 0x50(%rsp), %r15
movq %r15, %rcx
movq %rbp, %r8
callq 0xd8a3d
subq $0x8, %rsp
movq %rbp, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq 0x30(%rsp), %r14
movq %r14, %rcx
movq %rbx, %r8
movq 0xc0(%rsp), %r9
pushq %r15
movl 0xd8(%rsp), %eax
pushq %rax
movl 0xd8(%rsp), %eax
pushq %rax
callq 0x7e72
addq $0x20, %rsp
movq %r14, %rdi
callq 0x2220
movq 0x10(%r15), %rdi
callq 0x2220
movq (%rbp), %rdi
callq 0xa0004
movq %r12, %rdi
callq 0x2220
jmp 0xb62d