// File: /workspace/github_c_makefile_star2_O1/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
movl %ecx, %r15d
movq %rdi, %rbx
movl %ecx, %r8d
andl $0x7f8, %r8d            # imm = 0x7F8
movq 0x38(%rdi), %rbp
movzwl 0x12(%rdi), %ecx
movabsq $0x3dcccccd3a83126f, %rax # imm = 0x3DCCCCCD3A83126F
movq %rax, 0x50(%rsp)
movl $0xa, 0x58(%rsp)
movl 0x18(%rdi), %edi
cmpl $0x3e9, %edi            # imm = 0x3E9
setl %r9b
cmpl $0x9, %r8d
setb %al
testb %r9b, %al
jne 0x1a5ad
movabsq $0x3dcccccd33d6bf95, %rax # imm = 0x3DCCCCCD33D6BF95
movq %rax, 0x50(%rsp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %edi, %edi
je 0x1ac15
movzwl 0x10(%rbx), %r8d
andl $0x4, %r8d
jne 0x1ac15
addq %rcx, %rbp
movl 0x14(%rbx), %ecx
shll $0x2, %ecx
addq %rbp, %rcx
incl %edi
sarl %edi
movslq %edi, %rdi
addq %rcx, %rdi
movq %rdi, 0x20(%rsp)
cmpb $-0x1, (%rdi)
je 0x1ac15
movq %rsi, 0x18(%rsp)
movq %rdx, 0x48(%rsp)
leaq 0x7af6a(%rip), %rsi     # 0x95568
movq %rbx, %rdi
callq 0x25860
testq %rax, %rax
je 0x1a637
movq %rax, %r12
movl %r15d, %r14d
testb $0x4, %r15b
jne 0x1a642
leaq 0x7af4a(%rip), %rdx     # 0x95568
movq %r12, %rdi
movl $0x3, %esi
movq %rbx, %rcx
callq 0x1af34
movl %eax, %r15d
shrl $0x1f, %r15d
jmp 0x1a645
movl %r15d, %r14d
xorl %r12d, %r12d
xorl %r15d, %r15d
jmp 0x1a648
xorl %r15d, %r15d
incq %r12
leaq 0x7af1c(%rip), %rsi     # 0x9556b
movq %rbx, %rdi
callq 0x25860
testq %rax, %rax
je 0x1a683
movq %rax, %r13
leaq 0x7af05(%rip), %rdx     # 0x9556b
movq %rax, %rdi
movl $0x1, %esi
movq %rbx, %rcx
callq 0x1af34
testl %eax, %eax
js 0x1ac10
incq %r13
jmp 0x1a686
xorl %r13d, %r13d
testq %r12, %r12
sete %al
testb $0x4, %r14b
sete %cl
orb %al, %cl
jne 0x1a6a8
decq %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x27b4b
xorl %r12d, %r12d
testq %r12, %r12
setne %al
testq %r13, %r13
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x1a6cc
decq %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x27b4b
xorl %r13d, %r13d
testq %r13, %r13
setne %al
xorb $0x1, %r15b
orb %al, %r15b
jne 0x1a6f5
testq %r12, %r12
je 0x1af15
decq %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x27b4b
xorl %r12d, %r12d
movq %r13, %rax
orq %r12, %rax
je 0x1a786
testq %r13, %r13
setne %dl
testq %r12, %r12
setne %sil
testb $0x1, %r14b
sete %cl
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
testb %dl, %r14b
jne 0x1ac15
andb %sil, %cl
jne 0x1ac15
testb $0x1, %r14b
je 0x1a940
testq %r12, %r12
je 0x1a940
cmpl $0x0, 0x18(%rbx)
movq 0x20(%rsp), %r8
jle 0x1a77b
xorl %eax, %eax
xorl %ecx, %ecx
movzbl (%r8,%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, (%r8,%rcx)
incq %rcx
movslq 0x18(%rbx), %rdx
cmpq %rdx, %rcx
jl 0x1a74e
movb $0x5a, -0x3(%r12)
jmp 0x1abfc
movl %r14d, 0x4(%rsp)
movl 0x14(%rbx), %r15d
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testq %r15, %r15
je 0x1a852
movq (%rbx), %rdi
xorl %r8d, %r8d
leaq 0x7ad93(%rip), %r14     # 0x9554c
xorl %r10d, %r10d
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl (%rbp,%r8,4), %r13d
movl %r13d, %r11d
andl $0xf, %r11d
movl %r13d, %r12d
shrl $0x4, %r12d
cmpl $0x7, %r11d
setne %r9b
testb $0x7, %r13b
setne %r13b
testb %r9b, %r13b
jne 0x1a811
testl %ecx, %ecx
cmovsl %r10d, %ecx
testl %edx, %edx
cmovsl %edi, %edx
movl %r12d, %esi
addl %r10d, %esi
addq %r12, %rdi
movb $0x1, %r11b
movl %edi, %eax
movl %esi, %r10d
jmp 0x1a83d
decl %r11d
cmpl $0x3, %r11d
ja 0x1a835
movslq (%r14,%r11,4), %r9
addq %r14, %r9
jmpq *%r9
addl %r10d, %r12d
movb $0x1, %r11b
movl %r12d, %r10d
jmp 0x1a83d
movl %r12d, %r9d
addq %r9, %rdi
movb $0x1, %r11b
jmp 0x1a83d
xorl %r11d, %r11d
testb %r11b, %r11b
je 0x1a936
incq %r8
cmpq %r8, %r15
jne 0x1a7cb
cmpl $-0x1, %edx
je 0x1a936
movl %eax, %r8d
subl %edx, %r8d
subl %esi, %r8d
addl %ecx, %r8d
movl %r8d, %edi
negl %edi
cmovsl %r8d, %edi
leal 0x3(%rdi), %r8d
cmpl $0x8, %edi
movl $0x7, %edi
cmovael %r8d, %edi
movl %edi, %r8d
shrl %r8d
addl %r8d, %ecx
subl %ecx, %edx
xorl %r9d, %r9d
testl %edx, %edx
cmovgl %edx, %r9d
movl %edi, 0x58(%rsp)
movslq 0x18(%rbx), %r13
subl %esi, %eax
addl %r8d, %eax
leal (%rax,%r13), %r8d
movl %eax, %ecx
subl %r9d, %ecx
subl %edi, %ecx
jle 0x1a8cb
movl %ecx, %edx
shrl $0x1f, %edx
addl %ecx, %edx
sarl %edx
addl %edx, %r9d
addl %r9d, %edi
subl %edi, %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
subl %ecx, %r8d
movl %r8d, %eax
subl %r9d, %eax
movl $0x1, %ecx
cmovgl %eax, %ecx
cmpl %r13d, %ecx
movl %r13d, %eax
cmoval %ecx, %eax
testb $0x2, 0x4(%rsp)
cmovel %ecx, %eax
movslq %eax, %rsi
leaq 0x1(%r13), %rdi
orq $0xf, %rdi
leaq 0x1(%rdi), %r14
movq %rsi, %rcx
notq %rcx
movabsq $0x2492492492492493, %rdx # imm = 0x2492492492492493
movq %rcx, %rax
mulq %rdx
subq %rdx, %rcx
shrq %rcx
addq %rdx, %rcx
shrq $0x2, %rcx
cmpq %r14, %rcx
jae 0x1a985
callq 0x4050
movl $0xc, (%rax)
movl $0xb, %ecx
jmp 0x1abd9
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x1ac15
testq %r13, %r13
sete %cl
orb %r14b, %cl
xorl %eax, %eax
testb $0x1, %cl
movq 0x20(%rsp), %rdx
jne 0x1ac15
cmpl $0x0, 0x18(%rbx)
jle 0x1a97b
xorl %esi, %esi
movb (%r13,%rsi), %cl
addb (%rdx,%rsi), %cl
addb $-0x40, %cl
movb %cl, (%rdx,%rsi)
incq %rsi
movslq 0x18(%rbx), %rcx
cmpq %rcx, %rsi
jl 0x1a961
movb $0x42, -0x3(%r13)
jmp 0x1ac15
movl %r8d, 0x28(%rsp)
movq %rdi, 0x30(%rsp)
movl %r9d, 0x10(%rsp)
shll $0x2, %r15d
addq 0x38(%rbx), %r15
movzwl 0x12(%rbx), %eax
movq %rax, 0x8(%rsp)
leaq (%r14,%r14,2), %rdi
addq %rsi, %rdi
callq 0x4680
movl $0xb, %ecx
testq %rax, %rax
je 0x1abd9
movq %rax, %r12
addq %r14, %rax
movq %rax, 0x40(%rsp)
addq %r14, %rax
movq %rax, 0x38(%rsp)
movq %r12, %rdi
movq 0x20(%rsp), %rsi
movq %r13, %rdx
callq 0x43c0
movq 0x38(%rsp), %r8
movb $0x0, (%r12,%r13)
testl %r13d, %r13d
jle 0x1aa2a
addq 0x8(%rsp), %r15
xorl %eax, %eax
leaq 0x795b1(%rip), %rdx     # 0x93fb0
xorl %esi, %esi
movq %rsi, %rcx
shrq %rcx
movzbl (%r15,%rcx), %edi
movl %eax, %ecx
notb %cl
andb $0x4, %cl
shrl %cl, %edi
andl $0xf, %edi
movb (%rdx,%rdi,4), %cl
movb %cl, (%r8,%rsi)
incq %rsi
addl $0x4, %eax
cmpq %rsi, %r13
jne 0x1aa01
addq %r8, %r14
movl 0x10(%rsp), %eax
movslq %eax, %r15
movl 0x28(%rsp), %r10d
cmpl %eax, %r10d
movq 0x48(%rsp), %r8
movq 0x18(%rsp), %r9
movq %r15, 0x8(%rsp)
jle 0x1aa86
movslq %r10d, %rax
leaq 0x79439(%rip), %rcx     # 0x93e90
leaq 0x79552(%rip), %rdx     # 0x93fb0
movq %r14, %rsi
cmpq %r8, %r15
jge 0x1aa89
movzbl (%r9,%r15), %edi
testq %rdi, %rdi
je 0x1aa89
movzbl (%rcx,%rdi), %edi
movb (%rdx,%rdi,4), %dil
movb %dil, (%rsi)
incq %r15
incq %rsi
cmpq %r15, %rax
jne 0x1aa61
movl %r10d, %r15d
movq %r14, 0x28(%rsp)
leaq (,%r13,4), %rdi
callq 0x4680
testq %rax, %rax
je 0x1abe6
movq %rax, %r14
subl 0x10(%rsp), %r15d
leaq 0x50(%rsp), %r9
movq 0x28(%rsp), %rdi
movl %r15d, %esi
movq 0x38(%rsp), %rdx
movl %r13d, %ecx
movq 0x20(%rsp), %r8
pushq 0x40(%rsp)
pushq %rax
callq 0x89e94
addq $0x10, %rsp
negl %eax
jo 0x1abe9
movl 0x14(%rbx), %r13d
movl 0x4(%rsp), %r15d
testb $0x2, %r15b
jne 0x1ac24
testq %r13, %r13
je 0x1ae82
movq (%rbx), %rcx
negq 0x8(%rsp)
xorl %edx, %edx
xorl %edi, %edi
movl (%rbp,%rdx,4), %eax
cmpl $0x10, %eax
jae 0x1ab14
movl %edi, %esi
jmp 0x1abbe
movl %eax, %esi
andl $0xf, %esi
movl %eax, %r9d
shrl $0x4, %r9d
cmpl $0x7, %esi
setne %r8b
testb $0x7, %al
setne %al
testb %r8b, %al
jne 0x1ab9d
movl 0x18(%rbx), %r8d
subl %edi, %r8d
cmpl %r8d, %r9d
cmovll %r9d, %r8d
leal (%r8,%rdi), %esi
testl %r8d, %r8d
jle 0x1ab95
movslq %esi, %r9
movslq %edi, %rdi
movq 0x8(%rsp), %rax
leaq (%rax,%rcx), %r10
movl (%r14,%rdi,4), %eax
testb $0x3, %al
jne 0x1ab85
sarl $0x2, %eax
cltq
cmpq %rax, %r10
jne 0x1ab85
movzbl (%r12,%rdi), %eax
movq 0x40(%rsp), %r11
movzbl (%r11,%rdi), %r11d
cmpb %r11b, %al
cmovbl %eax, %r11d
movb %r11b, (%r12,%rdi)
jmp 0x1ab8a
movb $0x0, (%r12,%rdi)
incq %rdi
incq %r10
cmpq %r9, %rdi
jl 0x1ab57
movslq %r8d, %rax
addq %rax, %rcx
jmp 0x1abbe
cmpl $0x4, %esi
je 0x1abb0
cmpl $0x2, %esi
je 0x1abd1
cmpl $0x1, %esi
jne 0x1ab0d
movl 0x18(%rbx), %esi
subl %edi, %esi
cmpl %esi, %r9d
cmovll %r9d, %esi
addl %edi, %esi
incq %rdx
movl %esi, %edi
cmpq %r13, %rdx
jne 0x1ab04
jmp 0x1ae82
addq %r9, %rcx
jmp 0x1ab0d
xorl %r14d, %r14d
xorl %r12d, %r12d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x1abf3
xorl %r14d, %r14d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0xb, %ecx
cmpl $0xb, %ecx
je 0x1ac00
testl %ecx, %ecx
jne 0x1ac15
xorl %eax, %eax
jmp 0x1ac15
movq %r12, %rdi
callq 0x45c0
movq %r14, %rdi
callq 0x45c0
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r13, %r13
je 0x1ae3e
movq (%rbx), %rax
movq %rax, 0x10(%rsp)
movslq 0x30(%rsp), %rax
leaq (%r12,%rax,2), %rcx
incq %rcx
movq %rcx, 0x30(%rsp)
leaq (%rax,%rax,2), %rcx
leaq (%r12,%rcx), %rdx
addq $0x4, %rdx
movq %rdx, 0x60(%rsp)
negq 0x8(%rsp)
leaq (%r12,%rax,2), %rdi
addq $0x2, %rdi
leaq (%r12,%rcx), %r8
addq $0x3, %r8
xorl %r10d, %r10d
movl $0x0, 0x18(%rsp)
xorl %r15d, %r15d
movq %r13, 0x48(%rsp)
movl (%rbp,%r10,4), %eax
movl %eax, %esi
andl $0xf, %esi
movl %eax, %edx
shrl $0x4, %edx
cmpl $0x7, %esi
sete %cl
testb $0x7, %al
sete %r9b
orb %cl, %r9b
cmpb $0x1, %r9b
jne 0x1acf1
leaq 0x1(%r10), %rax
cmpq %r13, %rax
jae 0x1ace3
movl 0x4(%rbp,%r10,4), %eax
movl %eax, %ecx
andl $0xf, %ecx
cmpl $0x7, %ecx
setne %cl
testb $0x7, %al
setne %al
andb %cl, %al
movl %edx, %ecx
movl $0x0, %r11d
cmovnel %r11d, %ecx
addl 0x18(%rsp), %ecx
cmpb $0x1, %al
je 0x1ace7
movl %r15d, %r13d
movl %ecx, 0x18(%rsp)
jmp 0x1ae2a
movl 0x18(%rsp), %ecx
addl %ecx, %edx
movl $0x0, 0x18(%rsp)
testl %edx, %edx
je 0x1ae27
testb %r9b, %r9b
je 0x1adfd
movl 0x18(%rbx), %r9d
subl %r15d, %r9d
cmpl %r9d, %edx
cmovll %edx, %r9d
movslq %r15d, %r11
leal (%r9,%r15), %r13d
movslq %r13d, %rsi
testl %r9d, %r9d
jle 0x1ad5c
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
addq %rax, %rcx
movq %r11, %rdx
movl (%r14,%rdx,4), %eax
testb $0x3, %al
jne 0x1ad4b
sarl $0x2, %eax
cltq
cmpq %rax, %rcx
jne 0x1ad4b
movq 0x40(%rsp), %rax
movb (%rax,%rdx), %al
jmp 0x1ad4d
xorl %eax, %eax
movb %al, (%r12,%rdx)
incq %rdx
incq %rcx
cmpq %rsi, %rdx
jl 0x1ad2f
movb (%r12,%r11), %al
movq 0x38(%rsp), %rcx
movb %al, (%rcx,%r11)
cmpl $0x2, %r9d
jl 0x1ad96
leal 0x1(%r15), %eax
movslq %eax, %rcx
movq 0x30(%rsp), %rax
movb (%rax,%rcx), %dl
movzbl (%r12,%rcx), %eax
movzbl %dl, %edx
cmpb %dl, %al
cmoval %eax, %edx
movb %dl, (%rdi,%rcx)
incq %rcx
cmpq %rsi, %rcx
jl 0x1ad7e
movb -0x1(%r12,%rsi), %al
movq 0x28(%rsp), %rcx
movb %al, -0x1(%rcx,%rsi)
leaq -0x2(%rsi), %rcx
cmpl %r15d, %ecx
jl 0x1add3
movq 0x60(%rsp), %rax
movb (%rax,%rcx), %dl
incq %rcx
movzbl -0x1(%r12,%rcx), %eax
movzbl %dl, %edx
cmpb %dl, %al
cmoval %eax, %edx
movb %dl, -0x1(%r8,%rcx)
decq %rcx
cmpq %r11, %rcx
jg 0x1adb8
testl %r9d, %r9d
jle 0x1adf3
movzbl (%rdi,%r11), %eax
movzbl (%r8,%r11), %ecx
cmpb %cl, %al
cmovbl %eax, %ecx
movb %cl, (%r12,%r11)
incq %r11
cmpq %rsi, %r11
jl 0x1add8
movslq %r9d, %rax
addq %rax, 0x10(%rsp)
jmp 0x1ae2a
cmpl $0x4, %esi
je 0x1ae0c
cmpl $0x2, %esi
je 0x1ae1f
cmpl $0x1, %esi
jne 0x1ae27
movl 0x18(%rbx), %r13d
subl %r15d, %r13d
cmpl %r13d, %edx
cmovll %edx, %r13d
addl %r15d, %r13d
jmp 0x1ae2a
movslq %edx, %rax
addq %rax, 0x10(%rsp)
movl %r15d, %r13d
incq %r10
movl %r13d, %r15d
movq 0x48(%rsp), %r13
cmpq %r13, %r10
jne 0x1ac7f
movslq 0x18(%rbx), %rax
testq %rax, %rax
movl 0x4(%rsp), %r15d
movq 0x20(%rsp), %r9
jle 0x1aea9
xorl %ecx, %ecx
movl $0x40, %edx
movb (%r9,%rcx), %sil
movb (%r12,%rcx), %dil
movl %esi, %r8d
subb %dil, %r8b
addb $0x40, %r8b
cmpb %dil, %sil
movzbl %r8b, %esi
cmovbel %edx, %esi
movb %sil, (%r12,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x1ae58
jmp 0x1aea9
movslq 0x18(%rbx), %rax
testq %rax, %rax
movq 0x20(%rsp), %r9
jle 0x1aea9
xorl %ecx, %ecx
movb (%r9,%rcx), %dl
subb (%r12,%rcx), %dl
addb $0x40, %dl
movb %dl, (%r12,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x1ae92
movl 0x18(%rbx), %ecx
testb $0x1, %r15b
jne 0x1aebb
leaq 0x7a6af(%rip), %rsi     # 0x95568
jmp 0x1aeec
testl %ecx, %ecx
jle 0x1aee5
xorl %eax, %eax
leaq 0x7a6a3(%rip), %rsi     # 0x9556b
movb (%r9,%rax), %cl
subb (%r12,%rax), %cl
addb $0x40, %cl
movb %cl, (%r9,%rax)
incq %rax
movslq 0x18(%rbx), %rcx
cmpq %rcx, %rax
jl 0x1aec8
jmp 0x1aeec
leaq 0x7a67f(%rip), %rsi     # 0x9556b
incl %ecx
movq %rbx, %rdi
movl $0x5a, %edx
movq %r12, %r8
callq 0x27998
movq %r12, %rdi
callq 0x45c0
movq %r14, %rdi
callq 0x45c0
xorl %ecx, %ecx
jmp 0x1abdf
leaq 0x7a652(%rip), %rdi     # 0x9556e
leaq 0x7a656(%rip), %rsi     # 0x95579
leaq 0x7a657(%rip), %rcx     # 0x95581
movl $0xa0, %edx
callq 0x42f0