// File: 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
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq 0x48(%rbp), %rax
movq 0x40(%rbp), %rax
movq 0x38(%rbp), %rax
movl 0x30(%rbp), %eax
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movq %rdx, -0x40(%rbp)
movq %rcx, -0x48(%rbp)
movq %r8, -0x50(%rbp)
movq %r9, -0x58(%rbp)
movss %xmm0, -0x5c(%rbp)
movss %xmm1, -0x60(%rbp)
movss %xmm2, -0x64(%rbp)
movq -0x30(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x38(%rbp), %rcx
movl 0x20(%rbp), %r8d
movl 0x28(%rbp), %r9d
movq 0x38(%rbp), %r10
movq 0x40(%rbp), %rax
movq 0x30(%rax), %rax
xorl %edi, %edi
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
callq 0x10f400
movq $0x0, -0x70(%rbp)
leaq 0x29f8f8(%rip), %rax    # 0x3c47f8
movss 0x208(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x124f2e
movq -0x30(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edi
movl $0x1, %esi
callq 0x2140
movq %rax, -0x70(%rbp)
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %r8
movq -0x50(%rbp), %r9
movq -0x58(%rbp), %rax
movq %rax, -0xc0(%rbp)
movss -0x5c(%rbp), %xmm0
movq 0x10(%rbp), %r13
movq 0x18(%rbp), %r12
movss -0x60(%rbp), %xmm1
movss -0x64(%rbp), %xmm2
movl 0x20(%rbp), %r15d
movl 0x28(%rbp), %r14d
movq 0x38(%rbp), %rax
movl %eax, %ebx
movl 0x30(%rbp), %r11d
movq 0x48(%rbp), %r10
movq -0x70(%rbp), %rax
movq %rax, -0xb8(%rbp)
movl $0x1, %ecx
xorl %eax, %eax
movq -0xc0(%rbp), %rax
movq %rax, (%rsp)
movq -0xb8(%rbp), %rax
movq %r13, 0x8(%rsp)
movq %r12, 0x10(%rsp)
movl %r15d, 0x18(%rsp)
movl %r14d, 0x20(%rsp)
movl %ebx, 0x28(%rsp)
movl %r11d, 0x30(%rsp)
movq %r10, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
movq %rax, 0x48(%rsp)
movq $0x0, 0x50(%rsp)
callq 0x100cf0
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %r8
movq -0x50(%rbp), %r9
movq -0x58(%rbp), %rax
movq %rax, -0xb0(%rbp)
movss -0x5c(%rbp), %xmm0
movq 0x10(%rbp), %r13
movq 0x18(%rbp), %r12
movss -0x60(%rbp), %xmm1
movss -0x64(%rbp), %xmm2
movl 0x20(%rbp), %r15d
movl 0x28(%rbp), %r14d
movq 0x38(%rbp), %rax
movl %eax, %ebx
movl 0x30(%rbp), %r11d
movq 0x48(%rbp), %r10
movq -0x70(%rbp), %rax
movq %rax, -0xa8(%rbp)
movl $0x2, %ecx
xorl %eax, %eax
movq -0xb0(%rbp), %rax
movq %rax, (%rsp)
movq -0xa8(%rbp), %rax
movq %r13, 0x8(%rsp)
movq %r12, 0x10(%rsp)
movl %r15d, 0x18(%rsp)
movl %r14d, 0x20(%rsp)
movl %ebx, 0x28(%rsp)
movl %r11d, 0x30(%rsp)
movq %r10, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
movq %rax, 0x48(%rsp)
movq $0x0, 0x50(%rsp)
callq 0x100cf0
cmpq $0x0, -0x70(%rbp)
je 0x125252
movq $0x0, -0x88(%rbp)
movq $0x0, -0x90(%rbp)
movq $0x0, -0x80(%rbp)
movq $0x0, -0x98(%rbp)
movq -0x40(%rbp), %rdi
callq 0x20a0
movq %rax, %rdi
addq $0x64, %rdi
callq 0x2270
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rdi
movq -0x40(%rbp), %rdx
leaq 0x26329b(%rip), %rsi    # 0x388387
movb $0x0, %al
callq 0x2050
leaq 0x2a01d6(%rip), %rax    # 0x3c52d0
movq 0x28(%rax), %rdi
movq -0x30(%rbp), %rax
movl 0x14(%rax), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movq -0x70(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x100680
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %r8
movq -0x50(%rbp), %r9
movq -0x58(%rbp), %r13
movss -0x5c(%rbp), %xmm0
movq 0x10(%rbp), %r12
movq 0x18(%rbp), %r15
movss -0x60(%rbp), %xmm1
movss -0x64(%rbp), %xmm2
movl 0x20(%rbp), %r14d
movl 0x28(%rbp), %ebx
movq 0x38(%rbp), %rax
movl %eax, %r11d
movq 0x48(%rbp), %r10
movl $0x1, %ecx
xorl %eax, %eax
leaq -0x90(%rbp), %rax
movq %r13, (%rsp)
movq %r12, 0x8(%rsp)
movq %r15, 0x10(%rsp)
movl %r14d, 0x18(%rsp)
movl %ebx, 0x20(%rsp)
movl %r11d, 0x28(%rsp)
movl $0x1, 0x30(%rsp)
movq %r10, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
movq $0x0, 0x48(%rsp)
movq %rax, 0x50(%rsp)
callq 0x100cf0
movq %rax, -0x98(%rbp)
leaq 0x2a0116(%rip), %rax    # 0x3c52d0
movq 0x28(%rax), %rdi
movq -0x30(%rbp), %rsi
movq -0x70(%rbp), %rdx
leaq 0x29f62b(%rip), %rax    # 0x3c47f8
movss 0x208(%rax), %xmm0
leaq -0x90(%rbp), %rcx
leaq -0x98(%rbp), %r8
callq 0x124ac0
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0xa0(%rbp), %rcx
movq -0x48(%rbp), %r8
movq 0x18(%rbp), %r9
movl 0x20(%rbp), %r11d
movl 0x28(%rbp), %r10d
leaq -0x98(%rbp), %rdi
leaq -0x90(%rbp), %rax
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0xfcd70
movq -0xa0(%rbp), %rdi
callq 0x2210
movq -0x80(%rbp), %rdi
callq 0x2210
movq -0x98(%rbp), %rdi
callq 0xcd6f0
movq -0x70(%rbp), %rdi
callq 0x2210
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)