// File: 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
movq %rsp, %rbp
subq $0x70, %rsp
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rdi
callq 0x20a0
movq %rax, %rdi
addq $0x64, %rdi
callq 0x2270
movq %rax, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x38(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x183c87(%rip), %rsi    # 0x38d5b7
movb $0x0, %al
callq 0x2050
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x20(%rbp), %rax
movq (%rax), %rdx
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
movq 0x8(%rax), %r8
movq -0x20(%rbp), %rax
movq 0x30(%rax), %r9
movq -0x20(%rbp), %rax
movl 0x40(%rax), %r10d
movq -0x20(%rbp), %rax
movl 0x44(%rax), %eax
xorl %r11d, %r11d
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x0, 0x18(%rsp)
movl $0x0, 0x20(%rsp)
callq 0x115910
cmpq $0x0, -0x28(%rbp)
je 0x2099e7
movq -0x38(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x183c14(%rip), %rsi    # 0x38d5c2
movb $0x0, %al
callq 0x2050
movq -0x38(%rbp), %rdi
leaq 0x18fa12(%rip), %rsi    # 0x3993d2
callq 0x2200
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x40(%rbp), %rcx
callq 0x2088d0
movq -0x40(%rbp), %rdi
callq 0x21a0
cmpq $0x0, -0x30(%rbp)
je 0x209a32
movq -0x38(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x183bd5(%rip), %rsi    # 0x38d5d2
movb $0x0, %al
callq 0x2050
movq -0x38(%rbp), %rdi
leaq 0x18f9c3(%rip), %rsi    # 0x3993d2
callq 0x2200
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x208ae0
movq -0x40(%rbp), %rdi
callq 0x21a0
cmpq $0x0, 0x10(%rbp)
je 0x209a81
movq -0x38(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x183b9f(%rip), %rsi    # 0x38d5e7
movb $0x0, %al
callq 0x2050
movq -0x38(%rbp), %rdi
leaq 0x18f978(%rip), %rsi    # 0x3993d2
callq 0x2200
movq %rax, -0x40(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movq 0x20(%rbp), %rdx
movq -0x40(%rbp), %rcx
callq 0x208c80
movq -0x40(%rbp), %rdi
callq 0x21a0
cmpq $0x0, 0x28(%rbp)
je 0x209add
movq -0x38(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x183b61(%rip), %rsi    # 0x38d5f8
movb $0x0, %al
callq 0x2050
movq -0x38(%rbp), %rdi
leaq 0x18f929(%rip), %rsi    # 0x3993d2
callq 0x2200
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movq 0x28(%rbp), %rsi
leaq 0x182ee7(%rip), %rdx    # 0x38c9a8
leaq 0x1835c0(%rip), %rcx    # 0x38d088
leaq 0x17d4ca(%rip), %r8     # 0x386f99
callq 0x208dd0
movq -0x40(%rbp), %rdi
callq 0x21a0
movq -0x38(%rbp), %rdi
callq 0x2210
movq 0x1ba4f3(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x17dc24(%rip), %rsi    # 0x38771b
leaq 0x183b0b(%rip), %rdx    # 0x38d609
movb $0x0, %al
callq 0x22a0
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)