// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/Correct.cpp
// Function: prt_sub_cigar(overlap_region*, unsigned long, unsigned long, unsigned long)
void prt_sub_cigar(overlap_region* z, uint64_t str_l, uint64_t site, uint64_t win)
{
    uint64_t k, s, e, ci, xi, yi, ws, we, os, oe, ovlp; uint32_t cl; uint16_t c; bit_extz_t ez; char cm[4]; 
    cm[0] = 'M'; cm[1] = 'S'; cm[2] = 'I'; cm[3] = 'D';  
    s = ((site >= win)?(site-win):(0)); 
    e = (((site+win+1) <= str_l)?(site+win+1):(str_l));

    fprintf(stderr, "[M::%s-site::%lu] [%lu, %lu)\n", __func__, site, s, e);

    for (k = 0; k < z->w_list.n; k++) {
        set_bit_extz_t(ez, (*z), k); ci = 0; xi = ez.ts; yi = ez.ps;
        while (ci < ez.cigar.n) {
            ws = xi;
            ci = pop_trace(&(ez.cigar), ci, &c, &cl);
            if(c!=2) xi += cl;
            if(c!=3) yi += cl; 
            we = xi; 

            os = MAX(s, ws); oe = MIN(e, we);
            ovlp = ((oe>os)? (oe-os):0);

            if(c != 2) {
                if(!ovlp) continue;
            } else {///ws == we
                if(ws < s || ws >= e) continue;
                ovlp = cl;
            }

            fprintf(stderr, "%lu%c[%lu,%lu)", ovlp, cm[c], os, oe);
        }
        fprintf(stderr, "\n");
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rax
movq %rsi, %r9
movq %rdi, %rbx
movl $0x4449534d, 0x4(%rsp)  # imm = 0x4449534D
subq %rcx, %rdx
movl $0x0, %r15d
cmovaeq %rdx, %r15
addq %rax, %rcx
incq %rcx
cmpq %rsi, %rcx
cmovbq %rcx, %r9
movq 0x28fc50(%rip), %rcx    # 0x294fe0
movq (%rcx), %rdi
leaq 0x22c921(%rip), %rsi    # 0x231cbb
leaq 0x22c94a(%rip), %rdx    # 0x231ceb
movq %rax, %rcx
movq %r15, %r8
movq %r9, 0x8(%rsp)
xorl %eax, %eax
callq 0x22b0
cmpq $0x0, 0x48(%rbx)
je 0x54dc
xorl %r12d, %r12d
movq %rbx, 0x10(%rsp)
movq 0x58(%rbx), %rax
movq 0x70(%rbx), %rcx
movq %r12, %rdx
shlq $0x5, %rdx
movl 0x18(%rax,%rdx), %esi
movl 0x1c(%rax,%rdx), %r14d
leaq (%rcx,%rsi,2), %r13
movslq (%rax,%rdx), %rbx
xorl %ebp, %ebp
movq 0x8(%rsp), %r10
cmpq %r15, %rbx
setae %al
cmpq %r10, %rbx
setb %cl
andb %al, %cl
cmpl %ebp, %r14d
jbe 0x54b8
movl %ebp, %esi
movzwl (%r13,%rsi,2), %edx
movl %edx, %eax
shrl $0xe, %eax
andl $0x3fff, %edx           # imm = 0x3FFF
incl %ebp
cmpl %ebp, %r14d
jbe 0x544e
leaq 0x2(,%rsi,2), %rsi
addq %r13, %rsi
movzwl (%rsi), %edi
movl %edi, %r8d
shrl $0xe, %r8d
cmpl %eax, %r8d
jne 0x544e
andl $0x3fff, %edi           # imm = 0x3FFF
addl %edi, %edx
incl %ebp
addq $0x2, %rsi
cmpl %ebp, %r14d
jne 0x5429
movl %r14d, %ebp
movl %edx, %esi
cmpw $0x2, %ax
jne 0x545c
testb %cl, %cl
je 0x53fb
jmp 0x548d
addq %rbx, %rsi
cmpq %rbx, %r15
movq %rbx, %r8
cmovaq %r15, %r8
cmpq %rsi, %r10
movq %rsi, %r9
cmovbq %r10, %r9
movq %r9, %rcx
movl $0x0, %edx
movq %rsi, %rbx
subq %r8, %rcx
cmovaeq %rcx, %rdx
jbe 0x53ed
jmp 0x5496
movq %rbx, %r8
movq %rbx, %r9
movq %rsi, %rdx
movq 0x28fb43(%rip), %rcx    # 0x294fe0
movq (%rcx), %rdi
movsbl 0x4(%rsp,%rax), %ecx
leaq 0x22c84d(%rip), %rsi    # 0x231cf9
xorl %eax, %eax
callq 0x22b0
jmp 0x53e8
movq 0x28fb21(%rip), %rax    # 0x294fe0
movq (%rax), %rsi
pushq $0xa
popq %rdi
callq 0x2270
incq %r12
movq 0x10(%rsp), %rbx
cmpq 0x48(%rbx), %r12
jb 0x53c6
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq