// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/realn.c
// Function: sam_prob_realn
int sam_prob_realn(bam1_t *b, const char *ref, hts_pos_t ref_len, int flag) {
    int k, bw, y, yb, ye, xb, xe, fix_bq = 0, apply_baq = flag & BAQ_APPLY,
        extend_baq = flag & BAQ_EXTEND, redo_baq = flag & BAQ_REDO;
    enum htsRealnFlags system = flag & (0xff << 3);
    hts_pos_t i, x;
    uint32_t *cigar = bam_get_cigar(b);
    bam1_core_t *c = &b->core;

    // d(I) e(M) band
    probaln_par_t conf = { 0.001, 0.1, 10 }; // Illumina

    if (b->core.l_qseq > 1000 || system > BAQ_ILLUMINA) {
        // Params that work well on PacBio CCS 15k.  Unknown if they
        // help other long-read platforms yet, but likely better than
        // the short-read tuned ones.
        //
        // This function has no access to the SAM header.
        // Ideally the calling function would check for e.g.
        // @RG PL = "PACBIO" and DS contains "READTYPE=CCS".
        //
        // In the absense of this, we simply auto-detect via a crude
        // short vs long strategy.
        conf.d = 1e-7;
        conf.e = 1e-1;
    }

    uint8_t *bq = NULL, *zq = NULL, *qual = bam_get_qual(b);
    int *state = NULL;
    if ((c->flag & BAM_FUNMAP) || b->core.l_qseq == 0 || qual[0] == (uint8_t)-1)
        return -1; // do nothing

    // test if BQ or ZQ is present, and make sanity checks
    if ((bq = bam_aux_get(b, "BQ")) != NULL) {
        if (!redo_baq) {
            if (realn_check_tag(bq, HTS_LOG_WARNING, "BQ", b) < 0)
                fix_bq = 1;
        }
        ++bq;
    }
    if ((zq = bam_aux_get(b, "ZQ")) != NULL) {
        if (realn_check_tag(zq, HTS_LOG_ERROR, "ZQ", b) < 0)
            return -4;
        ++zq;
    }
    if (bq && redo_baq)
    {
        bam_aux_del(b, bq-1);
        bq = 0;
    }
    if (bq && zq) { // remove the ZQ tag
        bam_aux_del(b, zq-1);
        zq = 0;
    }
    if (!zq && fix_bq) { // Need to fix invalid BQ tag (by realigning)
        assert(bq != NULL);
        bam_aux_del(b, bq-1);
        bq = 0;
    }

    if (bq || zq) {
        if ((apply_baq && zq) || (!apply_baq && bq)) return -3; // in both cases, do nothing
        if (bq && apply_baq) { // then convert BQ to ZQ
            for (i = 0; i < c->l_qseq; ++i)
                qual[i] = qual[i] + 64 < bq[i]? 0 : qual[i] - ((int)bq[i] - 64);
            *(bq - 3) = 'Z';
        } else if (zq && !apply_baq) { // then convert ZQ to BQ
            for (i = 0; i < c->l_qseq; ++i)
                qual[i] += (int)zq[i] - 64;
            *(zq - 3) = 'B';
        }
        return 0;
    }
    // find the start and end of the alignment
    x = c->pos, y = 0, yb = ye = xb = xe = -1;
    for (k = 0; k < c->n_cigar; ++k) {
        int op, l;
        op = cigar[k]&0xf; l = cigar[k]>>4;
        if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) {
            if (yb < 0) yb = y;
            if (xb < 0) xb = x;
            ye = y + l; xe = x + l;
            x += l; y += l;
        } else if (op == BAM_CSOFT_CLIP || op == BAM_CINS) y += l;
        else if (op == BAM_CDEL) x += l;
        else if (op == BAM_CREF_SKIP) return -1; // do nothing if there is a reference skip
    }
    if (xb == -1) // No matches in CIGAR.
        return -1;
    // set bandwidth and the start and the end
    bw = 7;
    if (abs((xe - xb) - (ye - yb)) > bw)
        bw = abs((xe - xb) - (ye - yb)) + 3;
    conf.bw = bw;

    xb -= yb + bw/2; if (xb < 0) xb = 0;
    xe += c->l_qseq - ye + bw/2;
    if (xe - xb - c->l_qseq > bw)
        xb += (xe - xb - c->l_qseq - bw) / 2, xe -= (xe - xb - c->l_qseq - bw) / 2;
    { // glocal
        uint8_t *seq = bam_get_seq(b);
        uint8_t *tseq; // translated seq A=>0,C=>1,G=>2,T=>3,other=>4
        uint8_t *tref; // translated ref
        uint8_t *q; // Probability of incorrect alignment from probaln_glocal()
        size_t lref = xe > xb ? xe - xb : 1;
        size_t align_lqseq;
        if (extend_baq && lref < c->l_qseq)
            lref = c->l_qseq; // So we can recycle tseq,tref for left,rght below
        // Try to make q,tref,tseq reasonably well aligned
        align_lqseq = ((c->l_qseq + 1) | 0xf) + 1;
        // Overflow check - 3 for *bq, sizeof(int) for *state
        if ((SIZE_MAX - lref) / (3 + sizeof(int)) < align_lqseq) {
            errno = ENOMEM;
            goto fail;
        }

        assert(bq == NULL); // bq was used above, but should now be NULL
        bq = malloc(align_lqseq * 3 + lref);
        if (!bq) goto fail;
        q = bq + align_lqseq;
        tseq = q + align_lqseq;
        tref = tseq + align_lqseq;

        memcpy(bq, qual, c->l_qseq); bq[c->l_qseq] = 0;
        for (i = 0; i < c->l_qseq; ++i)
            tseq[i] = seq_nt16_int[bam_seqi(seq, i)];
        for (i = xb; i < xe; ++i) {
            if (i >= ref_len || ref[i] == '\0') { xe = i; break; }
            tref[i-xb] = seq_nt16_int[seq_nt16_table[(unsigned char)ref[i]]];
        }

        state = malloc(c->l_qseq * sizeof(int));
        if (!state) goto fail;
        if (probaln_glocal(tref, xe-xb, tseq, c->l_qseq, qual,
                           &conf, state, q) == INT_MIN) {
            goto fail;
        }

        if (!extend_baq) { // in this block, bq[] is capped by base quality qual[]
            for (k = 0, x = c->pos, y = 0; k < c->n_cigar; ++k) {
                int op = cigar[k]&0xf, l = cigar[k]>>4;
                if (l == 0) continue;
                if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) {
                    // Sanity check running off the end of the sequence
                    // Can only happen if the alignment is broken
                    if (l > c->l_qseq - y)
                        l = c->l_qseq - y;
                    for (i = y; i < y + l; ++i) {
                        if ((state[i]&3) != 0 || state[i]>>2 != x - xb + (i - y)) bq[i] = 0;
                        else bq[i] = bq[i] < q[i]? bq[i] : q[i];
                    }
                    x += l; y += l;
                } else if (op == BAM_CSOFT_CLIP || op == BAM_CINS) {
                    // Need sanity check here too.
                    if (l > c->l_qseq - y)
                        l = c->l_qseq - y;
                    y += l;
                } else if (op == BAM_CDEL) {
                    x += l;
                }
            }
            for (i = 0; i < c->l_qseq; ++i) bq[i] = qual[i] - bq[i] + 64; // finalize BQ
        } else { // in this block, bq[] is BAQ that can be larger than qual[] (different from the above!)
            // tseq,tref are no longer needed, so we can steal them to avoid mallocs
            uint8_t *left = tseq;
            uint8_t *rght = tref;
            int len = 0;

            for (k = 0, x = c->pos, y = 0; k < c->n_cigar; ++k) {
                int op = cigar[k]&0xf, l = cigar[k]>>4;

                // concatenate alignment matches (including sequence (mis)matches)
                // otherwise 50M50M gives a different result to 100M
                if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) {
                    if ((k + 1) < c->n_cigar) {
                        int next_op = bam_cigar_op(cigar[k + 1]);

                        if (next_op == BAM_CMATCH || next_op == BAM_CEQUAL || next_op == BAM_CDIFF) {
                            len += l;
                            continue;
                        }
                    }

                    // last of M/X/= ops
                    l += len;
                    len = 0;
                }

                if (l == 0) continue;
                if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) {
                    // Sanity check running off the end of the sequence
                    // Can only happen if the alignment is broken
                    if (l > c->l_qseq - y)
                        l = c->l_qseq - y;
                    for (i = y; i < y + l; ++i)
                        bq[i] = ((state[i]&3) != 0 || state[i]>>2 != x - xb + (i - y))? 0 : q[i];
                    for (left[y] = bq[y], i = y + 1; i < y + l; ++i)
                        left[i] = bq[i] > left[i-1]? bq[i] : left[i-1];
                    for (rght[y+l-1] = bq[y+l-1], i = y + l - 2; i >= y; --i)
                        rght[i] = bq[i] > rght[i+1]? bq[i] : rght[i+1];
                    for (i = y; i < y + l; ++i)
                        bq[i] = left[i] < rght[i]? left[i] : rght[i];
                    x += l; y += l;
                } else if (op == BAM_CSOFT_CLIP || op == BAM_CINS) {
                    // Need sanity check here too.
                    if (l > c->l_qseq - y)
                        l = c->l_qseq - y;
                    y += l;
                } else if (op == BAM_CDEL) {
                    x += l;
                }
            }
            for (i = 0; i < c->l_qseq; ++i) bq[i] = 64 + (qual[i] <= bq[i]? 0 : qual[i] - bq[i]); // finalize BQ
        }
        if (apply_baq) {
            for (i = 0; i < c->l_qseq; ++i) qual[i] -= bq[i] - 64; // modify qual
            bam_aux_append(b, "ZQ", 'Z', c->l_qseq + 1, bq);
        } else bam_aux_append(b, "BQ", 'Z', c->l_qseq + 1, bq);
        free(bq); free(state);
    }

    return 0;

 fail:
    free(bq); free(state);
    return -4;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movl %ecx, %r9d
andl $0x7f8, %r9d            # imm = 0x7F8
movq 0x38(%rdi), %r14
movzwl 0x12(%rdi), %edi
movabsq $0x3dcccccd3a83126f, %rax # imm = 0x3DCCCCCD3A83126F
movq %rax, 0x50(%rsp)
movl $0xa, 0x58(%rsp)
movl 0x18(%rbx), %r8d
cmpl $0x3e9, %r8d            # imm = 0x3E9
setl %r10b
cmpl $0x9, %r9d
setb %al
testb %r10b, %al
jne 0x16707
movsd 0x5eeff(%rip), %xmm0    # 0x75600
movsd %xmm0, 0x50(%rsp)
pushq $-0x1
popq %rax
testl %r8d, %r8d
je 0x16f97
movzwl 0x10(%rbx), %r9d
andl $0x4, %r9d
jne 0x16f97
addq %rdi, %r14
movl 0x14(%rbx), %edi
shll $0x2, %edi
addq %r14, %rdi
incl %r8d
sarl %r8d
movslq %r8d, %r15
addq %rdi, %r15
cmpb $-0x1, (%r15)
je 0x16f97
movq %rsi, 0x10(%rsp)
movq %rdx, 0x18(%rsp)
movl %ecx, 0x4(%rsp)
leaq 0x5eeb7(%rip), %rsi     # 0x75610
movq %rbx, %rdi
callq 0x1e928
testq %rax, %rax
je 0x1678c
movq %rax, %r12
testb $0x4, 0x4(%rsp)
jne 0x16793
leaq 0x5ee99(%rip), %rdx     # 0x75610
pushq $0x3
popq %rsi
movq %r12, %rdi
movq %rbx, %rcx
callq 0x16fc5
movl %eax, %ebp
shrl $0x1f, %ebp
jmp 0x16795
xorl %r12d, %r12d
xorl %ebp, %ebp
jmp 0x16798
xorl %ebp, %ebp
incq %r12
leaq 0x5ee74(%rip), %rsi     # 0x75613
movq %rbx, %rdi
callq 0x1e928
testq %rax, %rax
je 0x167d1
movq %rax, %r13
leaq 0x5ee5d(%rip), %rdx     # 0x75613
pushq $0x1
popq %rsi
movq %rax, %rdi
movq %rbx, %rcx
callq 0x16fc5
testl %eax, %eax
js 0x16b0f
incq %r13
jmp 0x167d4
xorl %r13d, %r13d
testq %r12, %r12
setne %al
movl 0x4(%rsp), %edi
movl %edi, %ecx
shrb $0x2, %cl
testb %al, %cl
je 0x16806
decq %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1fdbb
testq %r13, %r13
sete %r8b
testb %r8b, %bpl
je 0x16857
jmp 0x16fa6
testq %r12, %r12
setne %al
testq %r13, %r13
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x1682e
decq %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1fdbb
movl 0x4(%rsp), %edi
xorl %r13d, %r13d
testq %r13, %r13
sete %r8b
testb %r8b, %bpl
je 0x1685e
testq %r12, %r12
je 0x16fa6
decq %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1fdbb
movb $0x1, %r8b
xorl %r13d, %r13d
xorl %r12d, %r12d
movl 0x4(%rsp), %edi
movq %r13, %rcx
orq %r12, %rcx
je 0x168da
testq %r13, %r13
setne %sil
testq %r12, %r12
setne %cl
testb $0x1, %dil
sete %dl
pushq $-0x3
popq %rax
testb %sil, %dil
jne 0x16f97
andb %cl, %dl
jne 0x16f97
testb $0x1, %dil
sete %cl
testq %r12, %r12
sete %dl
orb %cl, %dl
jne 0x16b17
xorl %eax, %eax
xorl %ecx, %ecx
movslq 0x18(%rbx), %rdx
cmpq %rdx, %rcx
jge 0x16b46
movzbl (%r15,%rcx), %edx
movl %edx, %esi
addl $0x40, %esi
movzbl (%r12,%rcx), %edi
subb %dil, %dl
addb $0x40, %dl
cmpl %edi, %esi
movzbl %dl, %edx
cmovbl %eax, %edx
movb %dl, (%r15,%rcx)
incq %rcx
jmp 0x168a7
movq %r15, 0x40(%rsp)
movq (%rbx), %r8
movl 0x14(%rbx), %r15d
xorl %r9d, %r9d
pushq $-0x1
popq %rcx
leaq 0x5ece9(%rip), %r10     # 0x755dc
movl %ecx, %eax
movl %ecx, %edx
movl %ecx, %edi
xorl %r11d, %r11d
cmpq %r9, %r15
je 0x1696a
movl (%r14,%r9,4), %ebp
movl %ebp, %r13d
andl $0xf, %r13d
movl %ebp, %r12d
shrl $0x4, %r12d
cmpl $0x7, %r13d
setne %sil
testb $0x7, %bpl
setne %bpl
testb %sil, %bpl
jne 0x16945
testl %edi, %edi
cmovsl %r11d, %edi
testl %eax, %eax
cmovsl %r8d, %eax
movl %r12d, %edx
addl %r11d, %edx
addq %r12, %r8
movl %r8d, %ecx
movl %edx, %r11d
jmp 0x16965
decl %r13d
cmpl $0x3, %r13d
ja 0x16965
movslq (%r10,%r13,4), %rsi
addq %r10, %rsi
jmpq *%rsi
addl %r11d, %r12d
movl %r12d, %r11d
jmp 0x16965
movl %r12d, %esi
addq %rsi, %r8
incq %r9
jmp 0x168fc
cmpl $-0x1, %eax
je 0x16a30
movl %ecx, %r8d
subl %eax, %r8d
subl %edx, %r8d
addl %edi, %r8d
movl %r8d, %esi
negl %esi
cmovsl %r8d, %esi
leal 0x3(%rsi), %r9d
cmpl $0x8, %esi
pushq $0x7
popq %r8
cmovael %r9d, %r8d
movl %r8d, %esi
shrl %esi
addl %esi, %edi
subl %edi, %eax
xorl %r9d, %r9d
testl %eax, %eax
cmovgl %eax, %r9d
movl %r8d, 0x58(%rsp)
movslq 0x18(%rbx), %rdi
subl %edx, %ecx
addl %esi, %ecx
leal (%rcx,%rdi), %r11d
movl %ecx, %eax
subl %r9d, %eax
subl %r8d, %eax
jle 0x169de
pushq $0x2
popq %rsi
cltd
idivl %esi
addl %eax, %r9d
addl %r9d, %r8d
subl %r8d, %ecx
pushq $-0x2
popq %rsi
movl %ecx, %eax
cltd
idivl %esi
addl %eax, %r11d
movl 0x4(%rsp), %ecx
pushq $0x1
popq %rdx
movl %r11d, %eax
subl %r9d, %eax
cmovgl %eax, %edx
cmpl %edi, %edx
movl %edi, %eax
cmoval %edx, %eax
testb $0x2, %cl
cmovel %edx, %eax
movslq %eax, %rcx
leaq 0x1(%rdi), %r10
orq $0xf, %r10
leaq 0x1(%r10), %rbp
movq %rcx, %rax
notq %rax
pushq $0x7
popq %rsi
xorl %edx, %edx
divq %rsi
cmpq %rbp, %rax
jae 0x16a37
callq 0x4050
movl $0xc, (%rax)
xorl %r12d, %r12d
jmp 0x16afc
pushq $-0x1
jmp 0x16b11
movl %r11d, 0x4c(%rsp)
movq %r10, 0x60(%rsp)
movl %r9d, 0x2c(%rsp)
movq %rdi, 0x8(%rsp)
shll $0x2, %r15d
addq 0x38(%rbx), %r15
movzwl 0x12(%rbx), %eax
movq %rax, 0x20(%rsp)
leaq (,%rbp,2), %rdi
addq %rbp, %rdi
addq %rcx, %rdi
callq 0x4680
xorl %r12d, %r12d
testq %rax, %rax
je 0x16afc
movq %rax, %r13
addq 0x20(%rsp), %r15
addq %rbp, %rax
movq %rax, 0x20(%rsp)
movq %rbp, 0x30(%rsp)
addq %rax, %rbp
movq %r13, %rdi
movq 0x40(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x43c0
movq 0x8(%rsp), %r11
movb $0x0, (%r13,%r11)
testq %r11, %r11
movl $0x0, %edx
cmovgq %r11, %rdx
leaq 0x5d55d(%rip), %rax     # 0x74020
xorl %esi, %esi
movq 0x18(%rsp), %r8
movq 0x10(%rsp), %r9
cmpq %rsi, %rdx
je 0x16b51
movq %rsi, %rcx
shrq %rcx
movzbl (%r15,%rcx), %edi
movl %r12d, %ecx
notb %cl
andb $0x4, %cl
shrl %cl, %edi
andl $0xf, %edi
movb (%rax,%rdi,4), %cl
movb %cl, (%rbp,%rsi)
incq %rsi
addl $0x4, %r12d
jmp 0x16acf
xorl %r13d, %r13d
movq %r13, %rdi
callq 0x45c0
movq %r12, %rdi
callq 0x45c0
pushq $-0x4
popq %rax
jmp 0x16f97
orb %r8b, %dil
xorl %eax, %eax
testb $0x1, %dil
jne 0x16f97
xorl %eax, %eax
movslq 0x18(%rbx), %rcx
cmpq %rcx, %rax
jge 0x16b9c
movb (%r13,%rax), %cl
addb (%r15,%rax), %cl
addb $-0x40, %cl
movb %cl, (%r15,%rax)
incq %rax
jmp 0x16b28
movb $0x5a, -0x3(%r12)
jmp 0x16f95
movq 0x30(%rsp), %r10
addq %rbp, %r10
movslq 0x2c(%rsp), %r15
movl 0x4c(%rsp), %r12d
movslq %r12d, %rcx
leaq 0x5d393(%rip), %rdx     # 0x73f00
movq %r10, %rsi
movq %r15, 0x38(%rsp)
cmpq %rcx, %r15
jge 0x16ba6
cmpq %r8, %r15
jge 0x16ba9
movzbl (%r9,%r15), %edi
testq %rdi, %rdi
je 0x16ba9
movzbl (%rdx,%rdi), %edi
movb (%rax,%rdi,4), %dil
movb %dil, (%rsi)
incq %r15
incq %rsi
jmp 0x16b75
movb $0x42, -0x3(%r13)
jmp 0x16f95
movl %r12d, %r15d
movq %r10, 0x30(%rsp)
leaq (,%r11,4), %rdi
callq 0x4680
testq %rax, %rax
je 0x16cf1
movq %rax, %r12
subl 0x2c(%rsp), %r15d
leaq 0x50(%rsp), %r9
movq 0x30(%rsp), %rdi
movl %r15d, %esi
movq %rbp, %rdx
movq 0x8(%rsp), %rcx
movq 0x40(%rsp), %r15
movq %r15, %r8
pushq 0x20(%rsp)
pushq %rax
callq 0x6b6e4
popq %rcx
popq %rdx
negl %eax
jo 0x16aff
movq (%rbx), %rax
movq %rax, 0x10(%rsp)
movl 0x14(%rbx), %r10d
movl 0x4(%rsp), %r9d
testb $0x2, %r9b
movq %r10, 0x8(%rsp)
jne 0x16cf9
movq 0x38(%rsp), %r11
negq %r11
xorl %edx, %edx
xorl %esi, %esi
movq 0x10(%rsp), %rbp
cmpq %r10, %rdx
je 0x16ecf
movl (%r14,%rdx,4), %ecx
cmpl $0x10, %ecx
jb 0x16ce4
movl %ecx, %edi
andl $0xf, %edi
movl %ecx, %eax
shrl $0x4, %eax
cmpl $0x7, %edi
setne %r8b
testb $0x7, %cl
setne %cl
testb %r8b, %cl
jne 0x16cb7
movl 0x18(%rbx), %edi
subl %esi, %edi
cmpl %edi, %eax
cmovll %eax, %edi
movslq %esi, %r8
addl %edi, %esi
movslq %esi, %r9
leaq (%r11,%rbp), %r10
cmpq %r9, %r8
jge 0x16cd4
movl (%r12,%r8,4), %eax
testb $0x3, %al
jne 0x16ca9
sarl $0x2, %eax
cltq
cmpq %rax, %r10
jne 0x16ca9
movzbl (%r13,%r8), %eax
movq 0x20(%rsp), %rcx
movzbl (%rcx,%r8), %ecx
cmpb %cl, %al
cmovbl %eax, %ecx
movb %cl, (%r13,%r8)
jmp 0x16caf
movb $0x0, (%r13,%r8)
incq %r8
incq %r10
jmp 0x16c76
cmpl $0x4, %edi
je 0x16cc6
cmpl $0x2, %edi
je 0x16cec
cmpl $0x1, %edi
jne 0x16ce4
movl 0x18(%rbx), %ecx
subl %esi, %ecx
cmpl %ecx, %eax
cmovll %eax, %ecx
addl %ecx, %esi
jmp 0x16ce4
movslq %edi, %rax
addq %rax, %rbp
movl 0x4(%rsp), %r9d
movq 0x8(%rsp), %r10
incq %rdx
jmp 0x16c2e
addq %rax, %rbp
jmp 0x16ce4
xorl %r12d, %r12d
jmp 0x16aff
negq 0x38(%rsp)
movslq 0x60(%rsp), %rax
leaq (%rax,%rax,2), %rax
leaq (%rax,%r13), %rdx
addq $0x4, %rdx
xorl %esi, %esi
xorl %r9d, %r9d
movl $0x0, 0x18(%rsp)
cmpq %r10, %rsi
je 0x16efa
movl (%r14,%rsi,4), %edi
movl %edi, %eax
andl $0xf, %eax
movl %edi, %r11d
shrl $0x4, %r11d
cmpl $0x7, %eax
setne %cl
testb $0x7, %dil
setne %r8b
testb %cl, %r8b
jne 0x16d7c
leaq 0x1(%rsi), %rax
cmpq %r10, %rax
jae 0x16db2
movl 0x4(%r14,%rsi,4), %eax
movl %eax, %ecx
andl $0xf, %ecx
cmpl $0x7, %ecx
sete %cl
testb $0x7, %al
sete %al
addl 0x18(%rsp), %r11d
orb %cl, %al
je 0x16db7
movl %r9d, %r8d
movl %r11d, 0x18(%rsp)
jmp 0x16ec4
cmpl $0x10, %edi
jb 0x16ec1
cmpl $0x4, %eax
je 0x16d9c
cmpl $0x2, %eax
je 0x16ebc
cmpl $0x1, %eax
jne 0x16ec1
movl 0x18(%rbx), %r8d
subl %r9d, %r8d
cmpl %r8d, %r11d
cmovll %r11d, %r8d
addl %r9d, %r8d
jmp 0x16ec4
addl 0x18(%rsp), %r11d
movl $0x0, 0x18(%rsp)
testl %r11d, %r11d
je 0x16ec1
movl 0x18(%rbx), %r10d
subl %r9d, %r10d
cmpl %r10d, %r11d
cmovll %r11d, %r10d
movslq %r9d, %rax
leal (%r10,%r9), %r8d
movslq %r8d, %r15
movq 0x38(%rsp), %rcx
movq 0x10(%rsp), %rdi
addq %rcx, %rdi
movq %rax, %r11
cmpq %r15, %r11
jge 0x16e23
movl (%r12,%r11,4), %ecx
testb $0x3, %cl
jne 0x16e14
sarl $0x2, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rdi
jne 0x16e14
movq 0x20(%rsp), %rcx
movb (%rcx,%r11), %cl
jmp 0x16e16
xorl %ecx, %ecx
movb %cl, (%r13,%r11)
incq %r11
incq %rdi
jmp 0x16df0
movb (%r13,%rax), %cl
movb %cl, (%rbp,%rax)
incl %r9d
movslq %r9d, %rdi
movq 0x30(%rsp), %r11
cmpq %r15, %rdi
jge 0x16e59
movzbl (%r13,%rdi), %ecx
movzbl -0x1(%rbp,%rdi), %r9d
cmpb %r9b, %cl
cmoval %ecx, %r9d
movb %r9b, (%rbp,%rdi)
incq %rdi
jmp 0x16e37
movb -0x1(%r13,%r15), %cl
movb %cl, -0x1(%r11,%r15)
leal -0x2(%r15), %ecx
movslq %ecx, %rdi
cmpq %rax, %rdi
jl 0x16ea3
movzbl (%r13,%rdi), %ecx
movzbl (%rdx,%rdi), %r9d
cmpb %r9b, %cl
cmoval %ecx, %r9d
movb %r9b, -0x1(%rdx,%rdi)
decq %rdi
jmp 0x16e6a
movzbl (%rbp,%rax), %ecx
movzbl (%r11,%rax), %edi
cmpb %dil, %cl
cmovbl %ecx, %edi
movb %dil, (%r13,%rax)
incq %rax
cmpq %r15, %rax
jl 0x16e8b
movslq %r10d, %rax
addq %rax, 0x10(%rsp)
movq 0x40(%rsp), %r15
movq 0x8(%rsp), %r10
jmp 0x16ec4
addq %r11, 0x10(%rsp)
movl %r9d, %r8d
incq %rsi
movl %r8d, %r9d
jmp 0x16d1c
movl 0x18(%rbx), %ecx
xorl %eax, %eax
testl %ecx, %ecx
movl $0x0, %edx
cmovgl %ecx, %edx
cmpq %rax, %rdx
je 0x16f3d
movb (%r15,%rax), %sil
subb (%r13,%rax), %sil
addb $0x40, %sil
movb %sil, (%r13,%rax)
incq %rax
jmp 0x16ede
movl 0x18(%rbx), %ecx
xorl %eax, %eax
testl %ecx, %ecx
movl $0x0, %edx
cmovgl %ecx, %edx
pushq $0x40
popq %rsi
cmpq %rax, %rdx
je 0x16f38
movb (%r15,%rax), %dil
movb (%r13,%rax), %r8b
movl %edi, %r9d
subb %r8b, %r9b
addb $0x40, %r9b
cmpb %r8b, %dil
movzbl %r9b, %edi
cmovbel %esi, %edi
movb %dil, (%r13,%rax)
incq %rax
jmp 0x16f0c
movl 0x4(%rsp), %r9d
testb $0x1, %r9b
jne 0x16f4c
leaq 0x5e6c6(%rip), %rsi     # 0x75610
jmp 0x16f75
xorl %eax, %eax
movslq %ecx, %rdx
cmpq %rdx, %rax
jge 0x16f6e
movb (%r15,%rax), %cl
subb (%r13,%rax), %cl
addb $0x40, %cl
movb %cl, (%r15,%rax)
incq %rax
movl 0x18(%rbx), %ecx
jmp 0x16f4e
leaq 0x5e69e(%rip), %rsi     # 0x75613
incl %ecx
pushq $0x5a
popq %rdx
movq %rbx, %rdi
movq %r13, %r8
callq 0x1fc13
movq %r13, %rdi
callq 0x45c0
movq %r12, %rdi
callq 0x45c0
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5e669(%rip), %rdi     # 0x75616
leaq 0x5e66d(%rip), %rsi     # 0x75621
leaq 0x5e66e(%rip), %rcx     # 0x75629
movl $0xa0, %edx
callq 0x42f0