// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/ecovlp.cpp
// Function: prt_ovlp_sam_0(char*, _IO_FILE*, char*, int, char*, int, char*, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, bit_extz_t*)
void prt_ovlp_sam_0(char *cm, FILE *fp, char *ref_id, int32_t ref_id_n, char *qry_id, int32_t qry_id_n, char *qry_seq, uint64_t qry_seq_n, uint64_t rs, uint64_t re, uint64_t qs, uint64_t qe, uint64_t flag, uint64_t err0, bit_extz_t *ez)
{
    uint64_t ci = 0, err1 = 0; uint16_t c; uint32_t cl, cl0 = 0; char c0 = (char)-1;
    fprintf(fp, "%.*s\t%lu\t%.*s\t%lu\t60\t", qry_id_n, qry_id, flag, ref_id_n, ref_id, rs + 1);

    if(qs) fprintf(fp, "%luS", qs);
    while (ci < ez->cigar.n) {
        ci = pop_trace(&(ez->cigar), ci, &c, &cl);
        if(c0 == cm[c]) {
            cl0 += cl;
        } else {
            if(c0 != ((char)-1)) {
                fprintf(fp, "%u%c", cl0, c0);
            }
            cl0 = cl; c0 = cm[c];
        }
        // fprintf(fp, "%u%c", cl, cm[c]);
        if(c != 0) err1 += cl;
    }
    if(cl0) fprintf(fp, "%u%c", cl0, c0);
    if(qry_seq_n > qe) fprintf(fp, "%luS", qry_seq_n - qe);
    fprintf(fp, "\t*\t0\t0\t%.*s\t", (int32_t)qry_seq_n, qry_seq);
    for (ci = 0; ci < qry_seq_n; ci++) fprintf(fp, "~");
    assert(err0 == err1);
    fprintf(fp, "\tNM:i:%lu\n", err0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %r11
movl %ecx, %eax
movq %rdx, %r10
movq %rsi, %r15
movq %rdi, 0x20(%rsp)
movq 0xa0(%rsp), %rbp
movq 0x80(%rsp), %rbx
movq 0x90(%rsp), %r8
movq 0x70(%rsp), %r14
incq %r14
leaq 0xac670(%rip), %rsi     # 0x1f058b
movq %r15, %rdi
movl %r9d, %edx
movq %r11, %rcx
movl %eax, %r9d
xorl %eax, %eax
pushq %r14
pushq %r10
callq 0x22b0
popq %rcx
popq %rdx
testq %rbx, %rbx
je 0x143f4d
leaq 0xac661(%rip), %rsi     # 0x1f05a1
movq %r15, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x22b0
movq %r15, 0x10(%rsp)
movq 0x68(%rsp), %r15
addq $0xa8, %rbp
movb $-0x1, %r12b
xorl %esi, %esi
movq $0x0, 0x18(%rsp)
xorl %r13d, %r13d
movsbl %r12b, %ebx
cmpq (%rbp), %rsi
jae 0x143ffd
movq %rbp, %rdi
leaq 0xa(%rsp), %rdx
leaq 0xc(%rsp), %rcx
callq 0x53a7d
movl %eax, %r14d
movzwl 0xa(%rsp), %eax
movq 0x20(%rsp), %rcx
movb (%rcx,%rax), %dl
cmpb %dl, %r12b
jne 0x143fad
movl 0xc(%rsp), %ecx
addl %ecx, %r13d
jmp 0x143fe2
cmpb $-0x1, %r12b
je 0x143fd8
movq 0x10(%rsp), %rdi
leaq 0xa02ff(%rip), %rsi     # 0x1e42be
movl %r13d, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x22b0
movzwl 0xa(%rsp), %eax
movq 0x20(%rsp), %rcx
movb (%rcx,%rax), %dl
movl 0xc(%rsp), %ecx
movl %ecx, %r13d
movl %edx, %r12d
movl %r14d, %esi
testw %ax, %ax
movl %ecx, %eax
movl $0x0, %ecx
cmovneq %rax, %rcx
addq %rcx, 0x18(%rsp)
jmp 0x143f6f
testl %r13d, %r13d
movq 0x10(%rsp), %r14
je 0x14401d
leaq 0xa02b0(%rip), %rsi     # 0x1e42be
movq %r14, %rdi
movl %r13d, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x22b0
movq %r15, %rdx
subq 0x88(%rsp), %rdx
jbe 0x14403b
leaq 0xac570(%rip), %rsi     # 0x1f05a1
movq %r14, %rdi
xorl %eax, %eax
callq 0x22b0
leaq 0xac564(%rip), %rsi     # 0x1f05a6
movq %r14, %rdi
movl %r15d, %edx
movq 0x60(%rsp), %rcx
xorl %eax, %eax
callq 0x22b0
pushq $0x7e
popq %rbx
subq $0x1, %r15
jb 0x144069
movl %ebx, %edi
movq %r14, %rsi
callq 0x2270
jmp 0x144057
movq 0x98(%rsp), %rdx
cmpq %rdx, 0x18(%rsp)
jne 0x144098
leaq 0xac5e3(%rip), %rsi     # 0x1f0662
movq %r14, %rdi
xorl %eax, %eax
callq 0x22b0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xac514(%rip), %rdi     # 0x1f05b3
leaq 0xabe55(%rip), %rsi     # 0x1efefb
leaq 0xac513(%rip), %rcx     # 0x1f05c0
movl $0xb6f, %edx            # imm = 0xB6F
callq 0x2110