// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/ecovlp.cpp
// Function: prt_dbg_rid_paf(ma_hit_t_alloc*, UC_Read*, asg8_v*)
void prt_dbg_rid_paf(ma_hit_t_alloc *ov, UC_Read *ra, asg8_v *qa)
{
    if(!(ov->length)) return;
    uint64_t k, qn = (ov->buffer[0].qns>>32), qn_n, i, m; char *nn = NULL; FILE *fp = NULL; ma_hit_t *h = NULL;
    qn_n = Get_NAME_LENGTH((R_INF), qn) + 64; MALLOC(nn, qn_n);

    sprintf(nn, "%.*s.qry.fq", (int)Get_NAME_LENGTH(R_INF, qn), Get_NAME((R_INF), qn)); fp = fopen(nn, "w");
    for (k = 0; k < ov->length; k++) {
        i = ov->buffer[k].tn;
        recover_UC_Read(ra, &R_INF, i);
        fprintf(fp, "@%.*s\n", (int32_t)Get_NAME_LENGTH(R_INF, i), Get_NAME(R_INF, i));
        fprintf(fp, "%.*s\n", (int32_t)ra->length, ra->seq);        
        fprintf(fp, "+\n");
        retrive_bqual(qa, NULL, i, -1, -1, 0, sc_bn);
        for (m = 0; m < qa->n; m++) fprintf(fp, "%c", (char)(sc_tb[qa->a[m]] + 33 - 1));
        fprintf(fp, "\n");
    }
    fclose(fp);

    sprintf(nn, "%.*s.ref.fq", (int)Get_NAME_LENGTH(R_INF, qn), Get_NAME((R_INF), qn)); fp = fopen(nn, "w");
    i = qn;
    recover_UC_Read(ra, &R_INF, i);
    fprintf(fp, "@%.*s\n", (int32_t)Get_NAME_LENGTH(R_INF, i), Get_NAME(R_INF, i));
    fprintf(fp, "%.*s\n", (int32_t)ra->length, ra->seq);        
    fprintf(fp, "+\n");
    retrive_bqual(qa, NULL, i, -1, -1, 0, sc_bn);
    for (m = 0; m < qa->n; m++) fprintf(fp, "%c", (char)(sc_tb[qa->a[m]] + 33 - 1));
    fprintf(fp, "\n");
    fclose(fp);

    sprintf(nn, "%.*s.ref.fa", (int)Get_NAME_LENGTH(R_INF, qn), Get_NAME((R_INF), qn)); fp = fopen(nn, "w");
    i = qn;
    recover_UC_Read(ra, &R_INF, i);
    fprintf(fp, ">%.*s\n", (int32_t)Get_NAME_LENGTH(R_INF, i), Get_NAME(R_INF, i));
    fprintf(fp, "%.*s\n", (int32_t)ra->length, ra->seq);        
    // fprintf(fp, "+\n");
    // retrive_bqual(qa, NULL, i, -1, -1, 0, sc_bn);
    // for (m = 0; m < qa->n; m++) fprintf(fp, "%c", (char)(sc_tb[qa->a[m]] + 33 - 1));
    // fprintf(fp, "\n");
    fclose(fp);

    sprintf(nn, "%.*s.ov.paf", (int)Get_NAME_LENGTH(R_INF, qn), Get_NAME((R_INF), qn)); fp = fopen(nn, "w");
    for (k = 0; k < ov->length; k++) {
        h = &(ov->buffer[k]);
        fprintf(fp, "%.*s(qn::%u)\t%u\t%u\t%u\t%c\t%.*s(tn::%u)\t%u\t%u\t%u\t%u\t%u\t255\n", (int)Get_NAME_LENGTH(R_INF, Get_qn(*h)), Get_NAME((R_INF), Get_qn(*h)), Get_qn(*h), (uint32_t)Get_READ_LENGTH(R_INF, Get_qn(*h)), Get_qs(*h), Get_qe(*h), "+-"[h->rev], 
        (int)Get_NAME_LENGTH(R_INF, Get_tn(*h)), Get_NAME((R_INF), Get_tn(*h)), Get_tn(*h), (uint32_t)Get_READ_LENGTH(R_INF, Get_tn(*h)), Get_ts(*h), Get_te(*h), h->ml, h->bl);
    }
    fclose(fp);

    free(nn);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, 0x8(%rsp)
cmpl $0x0, 0xc(%rdi)
je 0x183bd2
movq %rdx, %rbp
movq (%rdi), %rax
movq (%rax), %rcx
shrq $0x20, %rcx
leaq 0x107af0(%rip), %rbx    # 0x28b230
movq 0x40(%rbx), %rax
movq (%rax,%rcx,8), %r15
movq %rcx, 0x20(%rsp)
movq 0x8(%rax,%rcx,8), %r12
subq %r15, %r12
movq %rdi, 0x10(%rsp)
leaq 0x40(%r12), %rdi
callq 0x2280
movq %rax, %r14
addq 0x8(%rbx), %r15
leaq 0xaef5a(%rip), %rsi     # 0x2326cc
movq %rax, %rdi
movl %r12d, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x2050
leaq 0xb8c75(%rip), %rsi     # 0x23c3fe
movq %r14, 0x18(%rsp)
movq %r14, %rdi
callq 0x2210
movq 0x10(%rsp), %rcx
movq %rax, %r15
cmpl $0x0, 0xc(%rcx)
je 0x1838ab
leaq 0xae5a1(%rip), %r14     # 0x231d50
xorl %edx, %edx
movq 0x8(%rsp), %rbx
movq (%rcx), %rax
movq %rdx, 0x28(%rsp)
leaq (%rdx,%rdx,4), %rcx
movl 0xc(%rax,%rcx,8), %r12d
movq %rbx, %rdi
leaq 0x107a5f(%rip), %r13    # 0x28b230
movq %r13, %rsi
movq %r12, %rdx
callq 0x33cf8
movq 0x40(%r13), %rax
movl 0x8(%rax,%r12,8), %edx
movq (%rax,%r12,8), %rcx
subl %ecx, %edx
addq 0x8(%r13), %rcx
movq %r15, %rdi
leaq 0xa1463(%rip), %rsi     # 0x224c5c
xorl %eax, %eax
callq 0x22b0
movl 0x8(%rbx), %edx
movq (%rbx), %rcx
movq %r15, %rdi
leaq 0xb66a6(%rip), %rsi     # 0x239eb6
xorl %eax, %eax
callq 0x22b0
movl $0x2, %esi
movl $0x1, %edx
leaq 0xa0f34(%rip), %rdi     # 0x22475c
movq %r15, %rcx
callq 0x2410
subq $0x8, %rsp
movq %rbp, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq $-0x1, %rcx
movq $-0x1, %r8
xorl %r9d, %r9d
pushq $0x2
callq 0x342bc
addq $0x10, %rsp
cmpq $0x0, (%rbp)
je 0x183885
xorl %r12d, %r12d
movq 0x10(%rbp), %rax
movzbl (%rax,%r12), %eax
movb (%r14,%rax,8), %al
addb $0x20, %al
movsbl %al, %edi
movq %r15, %rsi
callq 0x2270
incq %r12
cmpq (%rbp), %r12
jb 0x183862
movl $0xa, %edi
movq %r15, %rsi
callq 0x2270
movq 0x28(%rsp), %rdx
incq %rdx
movq 0x10(%rsp), %rcx
movl 0xc(%rcx), %eax
cmpq %rax, %rdx
jb 0x1837b6
movq %r15, %rdi
callq 0x2190
leaq 0x107976(%rip), %rbx    # 0x28b230
movq 0x40(%rbx), %rax
movq 0x20(%rsp), %r13
movl 0x8(%rax,%r13,8), %edx
movq (%rax,%r13,8), %rcx
subl %ecx, %edx
addq 0x8(%rbx), %rcx
leaq 0xaedff(%rip), %rsi     # 0x2326d8
movq 0x18(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2050
leaq 0xb8b0f(%rip), %rsi     # 0x23c3fe
movq %r14, %rdi
callq 0x2210
movq %rax, %r15
movq 0x8(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x33cf8
movq 0x40(%rbx), %rax
movl 0x8(%rax,%r13,8), %edx
movq (%rax,%r13,8), %rcx
subl %ecx, %edx
addq 0x8(%rbx), %rcx
leaq 0xa1335(%rip), %rsi     # 0x224c5c
movq %r15, %rdi
xorl %eax, %eax
callq 0x22b0
movl 0x8(%r14), %edx
movq (%r14), %rcx
leaq 0xb6577(%rip), %rsi     # 0x239eb6
movq %r15, %rdi
xorl %eax, %eax
callq 0x22b0
leaq 0xa0e0c(%rip), %rdi     # 0x22475c
movl $0x2, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
subq $0x8, %rsp
movq %rbp, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq $-0x1, %rcx
movq $-0x1, %r8
xorl %r9d, %r9d
pushq $0x2
callq 0x342bc
addq $0x10, %rsp
cmpq $0x0, (%rbp)
je 0x1839bc
xorl %ebx, %ebx
leaq 0xae3b6(%rip), %r14     # 0x231d50
movq 0x10(%rbp), %rax
movzbl (%rax,%rbx), %eax
movb (%r14,%rax,8), %al
addb $0x20, %al
movsbl %al, %edi
movq %r15, %rsi
callq 0x2270
incq %rbx
cmpq (%rbp), %rbx
jb 0x18399a
movl $0xa, %edi
movq %r15, %rsi
callq 0x2270
movq %r15, %rdi
callq 0x2190
leaq 0x107858(%rip), %r14    # 0x28b230
movq 0x40(%r14), %rax
movl 0x8(%rax,%r13,8), %edx
movq (%rax,%r13,8), %rcx
subl %ecx, %edx
addq 0x8(%r14), %rcx
leaq 0xaecf2(%rip), %rsi     # 0x2326e4
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
leaq 0xb89f6(%rip), %r15     # 0x23c3fe
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2210
movq %rax, %r12
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x33cf8
movq 0x40(%r14), %rax
movl 0x8(%rax,%r13,8), %edx
movq (%rax,%r13,8), %rcx
subl %ecx, %edx
addq 0x8(%r14), %rcx
leaq 0xa755e(%rip), %rsi     # 0x22afa1
movq %r12, %rdi
xorl %eax, %eax
callq 0x22b0
movl 0x8(%rbp), %edx
movq (%rbp), %rcx
leaq 0xb645b(%rip), %rsi     # 0x239eb6
movq %r12, %rdi
xorl %eax, %eax
callq 0x22b0
movq %r12, %rdi
callq 0x2190
movq 0x40(%r14), %rax
movl 0x8(%rax,%r13,8), %edx
movq (%rax,%r13,8), %rcx
subl %ecx, %edx
addq 0x8(%r14), %rcx
leaq 0xaec69(%rip), %rsi     # 0x2326f0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2210
movq %rax, 0x30(%rsp)
movq 0x10(%rsp), %rcx
cmpl $0x0, 0xc(%rcx)
je 0x183bb0
movl $0x18, %r13d
xorl %ebp, %ebp
movq (%rcx), %rax
movq 0x40(%r14), %rsi
movq -0x18(%rax,%r13), %r8
movq %r8, 0x28(%rsp)
shrq $0x20, %r8
leal 0x1(%r8), %ecx
movl (%rsi,%rcx,8), %edx
movq (%rsi,%r8,8), %rcx
subl %ecx, %edx
movq 0x8(%r14), %rbx
movq 0x18(%r14), %rdi
addq %rbx, %rcx
movl (%rdi,%r8,8), %r9d
movl -0x10(%rax,%r13), %r10d
movq %r10, 0x8(%rsp)
movq (%rax,%r13), %r10
movl %r10d, %r14d
shrl $0x1f, %r14d
leaq 0xa26be(%rip), %r11     # 0x2261c3
movsbl (%r14,%r11), %r11d
movq %r11, 0x20(%rsp)
movl -0xc(%rax,%r13), %r15d
leal 0x1(%r15), %r14d
movl (%rsi,%r14,8), %r12d
movq (%rsi,%r15,8), %rsi
subl %esi, %r12d
addq %rsi, %rbx
movl (%rdi,%r15,8), %esi
movq %rsi, 0x40(%rsp)
movl -0x8(%rax,%r13), %esi
movq %rsi, 0x38(%rsp)
movl -0x4(%rax,%r13), %r14d
movl %r10d, %r11d
shrl $0x1e, %r11d
andl $0x1, %r11d
shrq $0x20, %r10
andl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
subq $0x8, %rsp
movq 0x38(%rsp), %rdi
leaq 0xa92ec(%rip), %rsi     # 0x22ce50
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r14
leaq 0x1076bd(%rip), %r14    # 0x28b230
pushq 0x58(%rsp)
pushq 0x68(%rsp)
pushq %r15
pushq %rbx
pushq %r12
pushq 0x68(%rsp)
pushq 0x58(%rsp)
pushq 0x80(%rsp)
callq 0x22b0
movq 0x70(%rsp), %rcx
addq $0x60, %rsp
incq %rbp
movl 0xc(%rcx), %eax
addq $0x28, %r13
cmpq %rax, %rbp
jb 0x183ab8
movq 0x30(%rsp), %rdi
callq 0x2190
movq 0x18(%rsp), %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2220
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq