// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: prt_debug_hic(char const*, ma_ug_t*, ha_ug_index*, ug_opt_t*, kvec_pe_hit*, kv_u_trans_t*, kv_u_trans_t*, hc_links*, signed char*, bubble_type*)
void prt_debug_hic(const char* o_n, ma_ug_t* ug, ha_ug_index* idx, ug_opt_t *opt, kvec_pe_hit* hits, 
kv_u_trans_t *utg_trans, kv_u_trans_t *p_arcs, hc_links* lk, int8_t *s, bubble_type *bub)
{
    char* gfa_name = (char*)malloc(strlen(o_n)+100); FILE *fn = NULL;

    sprintf(gfa_name, "%s.hic.dbg", o_n);
    print_debug_gfa(idx->read_g, idx->ug, opt->coverage_cut, gfa_name, opt->sources, opt->ruIndex, 
    opt->max_hang, opt->min_ovlp, 0, 0, 0);

    if(hits) {
        sprintf(gfa_name, "%s.hic.hits.log", o_n); fn = fopen(gfa_name, "w");
        prt_hits_noid(idx, ug, hits, fn);
        fclose(fn);
    }

    if(utg_trans) {
        sprintf(gfa_name, "%s.hic.utg.trans.log", o_n); fn = fopen(gfa_name, "w");
        prt_utg_trans(utg_trans, ug, fn);
        fclose(fn);
    }

    if(p_arcs) {
        sprintf(gfa_name, "%s.hic.parcs.log", o_n); fn = fopen(gfa_name, "w");
        prt_kv_u_trans(p_arcs, lk, s, fn);
        fclose(fn);
    }
    
    if(bub) {
        sprintf(gfa_name, "%s.bub.noseq.gfa", o_n); fn = fopen(gfa_name, "w");
        prt_bubble_gfa_adv(fn, bub, "utg", "btg", "ctg");
        fclose(fn);
    }
    
    free(gfa_name);
    fprintf(stderr, "[M::%s::] done\n", __func__);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r12
movq %r8, %rbx
movq %rcx, %rbp
movq %rdx, %r13
movq %rsi, (%rsp)
movq %rdi, %r15
movq 0x78(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x18(%rsp)
callq 0x2090
leaq 0x64(%rax), %rdi
callq 0x2280
movq %rax, %r14
leaq 0x2217eb(%rip), %rsi    # 0x23c956
movq %rax, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2050
movq (%r13), %rsi
movq 0x8(%r13), %rdi
movq (%rbp), %rdx
movq 0x8(%rbp), %r8
movq 0x30(%rbp), %r9
movl 0x40(%rbp), %eax
movl 0x44(%rbp), %r10d
subq $0x8, %rsp
movq %r14, %rcx
pushq $0x0
pushq $0x0
pushq $0x0
pushq %r10
pushq %rax
callq 0xa5f3
addq $0x30, %rsp
testq %rbx, %rbx
je 0x1b1f1
leaq 0x2217a9(%rip), %rsi    # 0x23c961
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x22d516(%rip), %rsi    # 0x2486e2
movq %r14, %rdi
callq 0x2210
movq %rax, %rbp
movq %r13, %rdi
movq (%rsp), %rsi
movq %rbx, %rdx
movq %rax, %rcx
callq 0x1612cb
movq %rbp, %rdi
callq 0x2190
testq %r12, %r12
je 0x1b233
leaq 0x221774(%rip), %rsi    # 0x23c971
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x22d4d1(%rip), %rsi    # 0x2486e2
movq %r14, %rdi
callq 0x2210
movq %rax, %rbx
movq %r12, %rdi
movq (%rsp), %rsi
movq %rax, %rdx
callq 0x1613e8
movq %rbx, %rdi
callq 0x2190
movq 0x18(%rsp), %r12
testq %r12, %r12
je 0x1b280
leaq 0x221742(%rip), %rsi    # 0x23c986
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x22d48a(%rip), %rsi    # 0x2486e2
movq %r14, %rdi
callq 0x2210
movq %rax, %rbx
movq %r12, %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rax, %rcx
callq 0x161501
movq %rbx, %rdi
callq 0x2190
movq 0x20(%rsp), %r12
testq %r12, %r12
je 0x1b2d8
leaq 0x221706(%rip), %rsi    # 0x23c997
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x22d43d(%rip), %rsi    # 0x2486e2
movq %r14, %rdi
callq 0x2210
movq %rax, %rbx
leaq 0x220ad4(%rip), %rdx    # 0x23bd8b
leaq 0x221169(%rip), %rcx    # 0x23c427
leaq 0x21b2a8(%rip), %r8     # 0x23656d
movq %rax, %rdi
movq %r12, %rsi
callq 0x1615df
movq %rbx, %rdi
callq 0x2190
movq %r14, %rdi
callq 0x2220
movq 0x279cf9(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x21b9fc(%rip), %rsi    # 0x236ced
leaq 0x2216b0(%rip), %rdx    # 0x23c9a8
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x22b0