// File: /workspace/github_cpp_makefile_star2_O2/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 $0x108, %rsp            # imm = 0x108
movq %rdx, %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0x4449534d, 0x1c(%rsp) # imm = 0x4449534D
xorl %edx, %edx
movq %rax, %r15
subq %rcx, %r15
cmovbq %rdx, %r15
addq %rax, %rcx
incq %rcx
cmpq %rsi, %rcx
cmovbq %rcx, %rbx
movq 0x22f3de(%rip), %rcx    # 0x252fe0
movq (%rcx), %rdi
leaq 0x1bffff(%rip), %rsi    # 0x1e3c0b
leaq 0x1c0028(%rip), %rdx    # 0x1e3c3b
movq %rax, %rcx
movq %r15, %r8
movq %rbx, %r9
xorl %eax, %eax
callq 0x22b0
leaq 0x2(%rsp), %r13
leaq 0x4(%rsp), %rbp
xorl %ecx, %ecx
movq %rbx, 0x10(%rsp)
movq %r14, 0x20(%rsp)
movq %r15, 0x8(%rsp)
cmpq 0x48(%r14), %rcx
jae 0x23d8d
movq 0x58(%r14), %rax
movq %rcx, 0x28(%rsp)
shlq $0x5, %rcx
movl 0x18(%rax,%rcx), %edx
addq %rdx, %rdx
addq 0x70(%r14), %rdx
movq %rdx, 0xe8(%rsp)
movl 0x1c(%rax,%rcx), %edx
movq %rdx, 0xe0(%rsp)
movq %rdx, 0xd8(%rsp)
movq (%rax,%rcx), %rdx
movq %rdx, 0x4c(%rsp)
movq 0x8(%rax,%rcx), %rsi
movq %rsi, 0x40(%rsp)
movswl 0x14(%rax,%rcx), %eax
movl %eax, 0x5c(%rsp)
movl %eax, 0x58(%rsp)
movslq %edx, %r12
xorl %r14d, %r14d
cmpq %r15, %r12
setae %al
cmpq %rbx, %r12
setb %bl
andb %al, %bl
leaq 0xd8(%rsp), %r15
movl %r14d, %eax
cmpq %rax, 0xd8(%rsp)
jbe 0x23d5f
movq %r15, %rdi
movl %r14d, %esi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x53a7d
movl %eax, %r14d
movzwl 0x2(%rsp), %eax
cmpq $0x2, %rax
jne 0x23d02
testb %bl, %bl
je 0x23cb8
movl 0x4(%rsp), %edx
movq %r12, %r8
movq %r12, %r9
movq 0x10(%rsp), %rbx
movq 0x8(%rsp), %r15
jmp 0x23d3d
movl 0x4(%rsp), %r9d
addq %r12, %r9
movq 0x8(%rsp), %r15
cmpq %r12, %r15
movq %r12, %r8
cmovaq %r15, %r8
movq 0x10(%rsp), %rbx
cmpq %r9, %rbx
movq %r9, %r12
cmovbq %rbx, %r9
movq %r9, %rcx
movl $0x0, %edx
subq %r8, %rcx
cmovaeq %rcx, %rdx
jbe 0x23ca2
movq 0x22f29c(%rip), %rcx    # 0x252fe0
movq (%rcx), %rdi
movsbl 0x1c(%rsp,%rax), %ecx
leaq 0x1bfef6(%rip), %rsi    # 0x1e3c49
xorl %eax, %eax
callq 0x22b0
jmp 0x23ca2
movq 0x22f27a(%rip), %rax    # 0x252fe0
movq (%rax), %rsi
pushq $0xa
popq %rdi
callq 0x2270
movq 0x28(%rsp), %rcx
incq %rcx
movq 0x10(%rsp), %rbx
movq 0x20(%rsp), %r14
movq 0x8(%rsp), %r15
jmp 0x23c3e
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq