// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/rANS_static4x16pr.c
// Function: rans_uncompress_O1_4x16
static
unsigned char *rans_uncompress_O1_4x16(unsigned char *in, unsigned int in_size,
                                       unsigned char *out, unsigned int out_sz) {
    if (in_size < 16) // 4-states at least
        return NULL;

    if (out_sz >= INT_MAX)
        return NULL; // protect against some overflow cases

#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
    if (out_sz > 100000)
        return NULL;
#endif

    /* Load in the static tables */
    unsigned char *cp = in, *cp_end = in+in_size, *out_free = NULL;
    unsigned char *c_freq = NULL;
    int i, j = -999;
    unsigned int x;

    uint8_t *sfb_ = htscodecs_tls_alloc(256*(TOTFREQ_O1+MAGIC2)*sizeof(*sfb_));
    uint32_t (*s3)[TOTFREQ_O1_FAST] = (uint32_t (*)[TOTFREQ_O1_FAST])sfb_;
    // reuse the same memory for the fast mode lookup, but this only works
    // if we're on e.g. 12-bit freqs vs 10-bit freqs as needs 4x larger array.
    //uint32_t s3[256][TOTFREQ_O1_FAST];

    if (!sfb_)
        return NULL;
    fb_t (*fb)[256] = htscodecs_tls_alloc(256 * sizeof(*fb));
    if (!fb)
        goto err;
    uint8_t *sfb[256];
    if ((*cp >> 4) == TF_SHIFT_O1) {
        for (i = 0; i < 256; i++)
            sfb[i]=  sfb_ + i*(TOTFREQ_O1+MAGIC2);
    } else {
        for (i = 0; i < 256; i++)
            sfb[i]=  sfb_ + i*(TOTFREQ_O1_FAST+MAGIC2);
    }

    if (!out)
        out_free = out = malloc(out_sz);

    if (!out)
        goto err;

    //fprintf(stderr, "out_sz=%d\n", out_sz);

    // compressed header? If so uncompress it
    unsigned char *tab_end = NULL;
    unsigned char *c_freq_end = cp_end;
    unsigned int shift = *cp >> 4;
    if (*cp++ & 1) {
        uint32_t u_freq_sz, c_freq_sz;
        cp += var_get_u32(cp, cp_end, &u_freq_sz);
        cp += var_get_u32(cp, cp_end, &c_freq_sz);
        if (c_freq_sz > cp_end - cp)
            goto err;
        tab_end = cp + c_freq_sz;
        if (!(c_freq = rans_uncompress_O0_4x16(cp, c_freq_sz, NULL, u_freq_sz)))
            goto err;
        cp = c_freq;
        c_freq_end = c_freq + u_freq_sz;
    }

    // Decode order-0 symbol list; avoids needing in order-1 tables
    uint32_t F0[256] = {0};
    int fsz = decode_alphabet(cp, c_freq_end, F0);
    if (!fsz)
        goto err;
    cp += fsz;

    if (cp >= c_freq_end)
        goto err;

    const int s3_fast_on = in_size >= 100000;

    for (i = 0; i < 256; i++) {
        if (F0[i] == 0)
            continue;

        uint32_t F[256] = {0}, T = 0;
        fsz = decode_freq_d(cp, c_freq_end, F0, F, &T);
        if (!fsz)
            goto err;
        cp += fsz;

        if (!T) {
            //fprintf(stderr, "No freq for F_%d\n", i);
            continue;
        }

        normalise_freq_shift(F, T, 1<<shift);

        // Build symbols; fixme, do as part of decode, see the _d variant
        for (j = x = 0; j < 256; j++) {
            if (F[j]) {
                if (F[j] > (1<<shift) - x)
                    goto err;

                if (shift == TF_SHIFT_O1_FAST && s3_fast_on) {
                    int y;
                    for (y = 0; y < F[j]; y++)
                        s3[i][y+x] = (((uint32_t)F[j])<<(shift+8)) |(y<<8) |j;
                } else {
                    memset(&sfb[i][x], j, F[j]);
                    fb[i][j].f = F[j];
                    fb[i][j].b = x;
                }
                x += F[j];
            }
        }
        if (x != (1<<shift))
            goto err;
    }

    if (tab_end)
        cp = tab_end;
    free(c_freq);
    c_freq = NULL;

    if (cp+16 > cp_end)
        goto err;

    RansState rans0, rans1, rans2, rans3;
    uint8_t *ptr = cp, *ptr_end = in + in_size - 8;
    RansDecInit(&rans0, &ptr); if (rans0 < RANS_BYTE_L) goto err;
    RansDecInit(&rans1, &ptr); if (rans1 < RANS_BYTE_L) goto err;
    RansDecInit(&rans2, &ptr); if (rans2 < RANS_BYTE_L) goto err;
    RansDecInit(&rans3, &ptr); if (rans3 < RANS_BYTE_L) goto err;

    unsigned int isz4 = out_sz>>2;
    int l0 = 0, l1 = 0, l2 = 0, l3 = 0;
    unsigned int i4[] = {0*isz4, 1*isz4, 2*isz4, 3*isz4};

    RansState R[4];
    R[0] = rans0;
    R[1] = rans1;
    R[2] = rans2;
    R[3] = rans3;

    // Around 15% faster to specialise for 10/12 than to have one
    // loop with shift as a variable.
    if (shift == TF_SHIFT_O1) {
        // TF_SHIFT_O1 = 12

        const uint32_t mask = ((1u << TF_SHIFT_O1)-1);
        for (; i4[0] < isz4; i4[0]++, i4[1]++, i4[2]++, i4[3]++) {
            uint16_t m, c;
            c = sfb[l0][m = R[0] & mask];
            R[0] = fb[l0][c].f * (R[0]>>TF_SHIFT_O1) + m - fb[l0][c].b;
            out[i4[0]] = l0 = c;

            c = sfb[l1][m = R[1] & mask];
            R[1] = fb[l1][c].f * (R[1]>>TF_SHIFT_O1) + m - fb[l1][c].b;
            out[i4[1]] = l1 = c;

            c = sfb[l2][m = R[2] & mask];
            R[2] = fb[l2][c].f * (R[2]>>TF_SHIFT_O1) + m - fb[l2][c].b;
            out[i4[2]] = l2 = c;

            c = sfb[l3][m = R[3] & mask];
            R[3] = fb[l3][c].f * (R[3]>>TF_SHIFT_O1) + m - fb[l3][c].b;
            out[i4[3]] = l3 = c;

            if (ptr < ptr_end) {
                RansDecRenorm(&R[0], &ptr);
                RansDecRenorm(&R[1], &ptr);
                RansDecRenorm(&R[2], &ptr);
                RansDecRenorm(&R[3], &ptr);
            } else {
                RansDecRenormSafe(&R[0], &ptr, ptr_end+8);
                RansDecRenormSafe(&R[1], &ptr, ptr_end+8);
                RansDecRenormSafe(&R[2], &ptr, ptr_end+8);
                RansDecRenormSafe(&R[3], &ptr, ptr_end+8);
            }
        }

        // Remainder
        for (; i4[3] < out_sz; i4[3]++) {
            uint32_t m3 = R[3] & ((1u<<TF_SHIFT_O1)-1);
            unsigned char c3 = sfb[l3][m3];
            out[i4[3]] = c3;
            R[3] = fb[l3][c3].f * (R[3]>>TF_SHIFT_O1) + m3 - fb[l3][c3].b;
            RansDecRenormSafe(&R[3], &ptr, ptr_end + 8);
            l3 = c3;
        }
    } else if (!s3_fast_on) {
        // TF_SHIFT_O1 = 10 with sfb[256][1024] & fb[256]256] array lookup
        // Slightly faster for -o193 on q4 (high comp), but also less
        // initialisation cost for smaller data
        const uint32_t mask = ((1u << TF_SHIFT_O1_FAST)-1);
        for (; i4[0] < isz4; i4[0]++, i4[1]++, i4[2]++, i4[3]++) {
            uint16_t m, c;
            c = sfb[l0][m = R[0] & mask];
            R[0] = fb[l0][c].f * (R[0]>>TF_SHIFT_O1_FAST) + m - fb[l0][c].b;
            out[i4[0]] = l0 = c;

            c = sfb[l1][m = R[1] & mask];
            R[1] = fb[l1][c].f * (R[1]>>TF_SHIFT_O1_FAST) + m - fb[l1][c].b;
            out[i4[1]] = l1 = c;

            c = sfb[l2][m = R[2] & mask];
            R[2] = fb[l2][c].f * (R[2]>>TF_SHIFT_O1_FAST) + m - fb[l2][c].b;
            out[i4[2]] = l2 = c;

            c = sfb[l3][m = R[3] & mask];
            R[3] = fb[l3][c].f * (R[3]>>TF_SHIFT_O1_FAST) + m - fb[l3][c].b;
            out[i4[3]] = l3 = c;

            if (ptr < ptr_end) {
                RansDecRenorm(&R[0], &ptr);
                RansDecRenorm(&R[1], &ptr);
                RansDecRenorm(&R[2], &ptr);
                RansDecRenorm(&R[3], &ptr);
            } else {
                RansDecRenormSafe(&R[0], &ptr, ptr_end+8);
                RansDecRenormSafe(&R[1], &ptr, ptr_end+8);
                RansDecRenormSafe(&R[2], &ptr, ptr_end+8);
                RansDecRenormSafe(&R[3], &ptr, ptr_end+8);
            }
        }

        // Remainder
        for (; i4[3] < out_sz; i4[3]++) {
            uint32_t m3 = R[3] & ((1u<<TF_SHIFT_O1_FAST)-1);
            unsigned char c3 = sfb[l3][m3];
            out[i4[3]] = c3;
            R[3] = fb[l3][c3].f * (R[3]>>TF_SHIFT_O1_FAST) + m3 - fb[l3][c3].b;
            RansDecRenormSafe(&R[3], &ptr, ptr_end + 8);
            l3 = c3;
        }
    } else {
        // TF_SHIFT_O1_FAST.
        // Significantly faster for -o1 on q40 (low comp).
        // Higher initialisation cost, so only use if big blocks.
        const uint32_t mask = ((1u << TF_SHIFT_O1_FAST)-1);
        for (; i4[0] < isz4; i4[0]++, i4[1]++, i4[2]++, i4[3]++) {
            uint32_t S0 = s3[l0][R[0] & mask];
            uint32_t S1 = s3[l1][R[1] & mask];
            l0 = out[i4[0]] = S0;
            l1 = out[i4[1]] = S1;
            uint16_t F0 = S0>>(TF_SHIFT_O1_FAST+8);
            uint16_t F1 = S1>>(TF_SHIFT_O1_FAST+8);
            uint16_t B0 = (S0>>8) & mask;
            uint16_t B1 = (S1>>8) & mask;

            R[0] = F0 * (R[0]>>TF_SHIFT_O1_FAST) + B0;
            R[1] = F1 * (R[1]>>TF_SHIFT_O1_FAST) + B1;

            uint32_t S2 = s3[l2][R[2] & mask];
            uint32_t S3 = s3[l3][R[3] & mask];
            l2 = out[i4[2]] = S2;
            l3 = out[i4[3]] = S3;
            uint16_t F2 = S2>>(TF_SHIFT_O1_FAST+8);
            uint16_t F3 = S3>>(TF_SHIFT_O1_FAST+8);
            uint16_t B2 = (S2>>8) & mask;
            uint16_t B3 = (S3>>8) & mask;

            R[2] = F2 * (R[2]>>TF_SHIFT_O1_FAST) + B2;
            R[3] = F3 * (R[3]>>TF_SHIFT_O1_FAST) + B3;

            if (ptr < ptr_end) {
                RansDecRenorm(&R[0], &ptr);
                RansDecRenorm(&R[1], &ptr);
                RansDecRenorm(&R[2], &ptr);
                RansDecRenorm(&R[3], &ptr);
            } else {
                RansDecRenormSafe(&R[0], &ptr, ptr_end+8);
                RansDecRenormSafe(&R[1], &ptr, ptr_end+8);
                RansDecRenormSafe(&R[2], &ptr, ptr_end+8);
                RansDecRenormSafe(&R[3], &ptr, ptr_end+8);
            }
        }

        // Remainder
        for (; i4[3] < out_sz; i4[3]++) {
            uint32_t S = s3[l3][R[3] & ((1u<<TF_SHIFT_O1_FAST)-1)];
            l3 = out[i4[3]] = S;
            R[3] = (S>>(TF_SHIFT_O1_FAST+8)) * (R[3]>>TF_SHIFT_O1_FAST)
                + ((S>>8) & ((1u<<TF_SHIFT_O1_FAST)-1));
            RansDecRenormSafe(&R[3], &ptr, ptr_end + 8);
        }
    }
    //fprintf(stderr, "    1 Decoded %d bytes\n", (int)(ptr-in)); //c-size

    htscodecs_tls_free(fb);
    htscodecs_tls_free(sfb_);
    return out;

 err:
    htscodecs_tls_free(fb);
    htscodecs_tls_free(sfb_);
    free(out_free);
    free(c_freq);

    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1078, %rsp           # imm = 0x1078
movl %ecx, %ebp
cmpl $0x10, %esi
setb %al
cmpl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
setae %cl
orb %al, %cl
jne 0x668d4
movq %rdx, %r12
movl %esi, %ebx
movq %rdi, %r13
movl $0x10b300, %edi         # imm = 0x10B300
callq 0x7e144
testq %rax, %rax
je 0x668d4
movq %rax, 0x48(%rsp)
movl $0x40000, %edi          # imm = 0x40000
callq 0x7e144
movq %rax, %r15
testq %rax, %rax
je 0x66353
movzbl (%r13), %eax
movl %eax, 0x10(%rsp)
andb $-0x10, %al
cmpb $-0x40, %al
jne 0x662e2
xorl %eax, %eax
movq 0x48(%rsp), %rcx
movq %rcx, 0x70(%rsp,%rax,8)
incq %rax
addq $0x10b3, %rcx           # imm = 0x10B3
cmpq $0x100, %rax            # imm = 0x100
jne 0x662c9
jmp 0x66300
xorl %eax, %eax
movq 0x48(%rsp), %rcx
movq %rcx, 0x70(%rsp,%rax,8)
incq %rax
addq $0x4b3, %rcx            # imm = 0x4B3
cmpq $0x100, %rax            # imm = 0x100
jne 0x662e9
testq %r12, %r12
je 0x66309
xorl %eax, %eax
jmp 0x66318
movl %ebp, %edi
callq 0x4680
movq %rax, %r12
testq %rax, %rax
je 0x66353
movq %rax, 0x8(%rsp)
movl %ebx, %eax
leaq (%rax,%r13), %r9
leaq 0x1(%r13), %r10
xorl %r14d, %r14d
testb $0x1, 0x10(%rsp)
jne 0x6635d
movq %r15, 0x30(%rsp)
movq %r10, %r15
movl %ebp, 0x1c(%rsp)
movq %r9, 0x20(%rsp)
movq %r9, %r13
movq $0x0, 0x28(%rsp)
jmp 0x6645b
xorl %ebp, %ebp
xorl %r14d, %r14d
jmp 0x668b2
xorl %edx, %edx
movzbl (%r10,%rdx), %esi
movl %r14d, %ecx
shll $0x7, %ecx
movl %esi, %r14d
andl $0x7f, %r14d
orl %ecx, %r14d
leaq 0x1(%rdx), %rcx
testb %sil, %sil
jns 0x66385
cmpl $0x5, %edx
movq %rcx, %rdx
jne 0x6635f
movq %rcx, %rdx
notq %rdx
addq %rax, %rdx
cmpq $0x6, %rdx
movl %ebx, 0x40(%rsp)
jl 0x663d6
xorl %edi, %edi
xorl %edx, %edx
leaq (%r10,%rdi), %rsi
movzbl (%rcx,%rsi), %r8d
movl %edx, %esi
shll $0x7, %esi
movl %r8d, %edx
andl $0x7f, %edx
orl %esi, %edx
leaq 0x1(%rdi), %rsi
testb %r8b, %r8b
jns 0x663c3
cmpl $0x5, %edi
movq %rsi, %rdi
jne 0x6639c
addq %r10, %rsi
addq %rcx, %rsi
notl %r13d
addl %r13d, %esi
subl %ecx, %esi
movslq %esi, %rbx
jmp 0x663f7
leaq (%r10,%rcx), %rsi
cmpq %r9, %rsi
jae 0x663f3
movsbl (%r10,%rcx), %edx
testl %edx, %edx
js 0x66871
movl $0x1, %ebx
jmp 0x663f7
xorl %edx, %edx
xorl %ebx, %ebx
movl %edx, %r13d
movq %rbx, %rdx
notq %rdx
addq %rax, %rdx
subq %rcx, %rdx
cmpq %r13, %rdx
jge 0x66412
xorl %ebp, %ebp
jmp 0x668ad
movq %r15, 0x30(%rsp)
movq %r9, 0x20(%rsp)
addq %rcx, %r10
leaq (%r10,%rbx), %rdi
movl %r13d, %esi
xorl %edx, %edx
movl %r14d, %ecx
movq %r10, %r15
callq 0x629f9
testq %rax, %rax
je 0x66852
movl %ebp, 0x1c(%rsp)
addq %r13, %rbx
addq %rbx, %r15
movl %r14d, %r13d
addq %rax, %r13
movq %r15, %r14
movq %rax, 0x28(%rsp)
movq %rax, %r15
movl 0x40(%rsp), %ebx
leaq 0xc70(%rsp), %rdi
xorl %ebp, %ebp
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x4260
cmpq %r13, %r15
je 0x66846
movq %r15, %r8
leaq 0x1(%r15), %rax
movzbl (%r15), %ecx
leaq 0x3(%r15), %rdx
cmpq %r13, %rdx
movq 0x30(%rsp), %r15
jae 0x664df
xorl %ebp, %ebp
movl %ecx, %edx
movl $0x1, 0xc70(%rsp,%rdx,4)
testl %ebp, %ebp
je 0x664b8
cmpl $0xfe, %ecx
jg 0x66865
decl %ebp
incl %ecx
jmp 0x664d2
incl %ecx
movzbl (%rax), %edx
cmpl %edx, %ecx
jne 0x664cb
movzbl 0x1(%rax), %ebp
addq $0x2, %rax
jmp 0x664d2
incq %rax
xorl %ebp, %ebp
movl %edx, %ecx
testl %ecx, %ecx
je 0x664df
leaq 0x2(%rax), %rdx
cmpq %r13, %rdx
jb 0x66495
testl %ecx, %ecx
je 0x6653f
movl %ecx, %edx
movl $0x1, 0xc70(%rsp,%rdx,4)
cmpq %r13, %rax
jae 0x66865
testl %ebp, %ebp
je 0x6650f
cmpl $0xfe, %ecx
jg 0x66865
decl %ebp
incl %ecx
jmp 0x66536
incl %ecx
movzbl (%rax), %edx
leaq 0x1(%rax), %rsi
xorl %ebp, %ebp
cmpl %edx, %ecx
jne 0x66531
cmpq %r13, %rsi
jae 0x66865
movzbl 0x1(%rax), %ebp
addq $0x2, %rax
jmp 0x66536
movq %rsi, %rax
movl %edx, %ecx
testl %ecx, %ecx
je 0x6653f
cmpq %r13, %rax
jb 0x664e3
subq %r8, %rax
testl %eax, %eax
movq 0x28(%rsp), %rbp
je 0x668ad
cltq
addq %rax, %r8
cmpq %r13, %r8
jae 0x668ad
movq %r12, 0x50(%rsp)
movl 0x10(%rsp), %ecx
shrl $0x4, %ecx
cmpl $0x186a0, %ebx          # imm = 0x186A0
setae %al
movl $0x1, %r11d
shll %cl, %r11d
movl %ecx, 0x10(%rsp)
cmpl $0xa, %ecx
sete %cl
andb %al, %cl
movb %cl, 0x58(%rsp)
xorl %r12d, %r12d
movl %ebx, 0x40(%rsp)
movq %rbp, 0x28(%rsp)
movq %r13, 0x68(%rsp)
movl %r11d, 0x38(%rsp)
cmpl $0x0, 0xc70(%rsp,%r12,4)
je 0x667db
movl $0x400, %edx            # imm = 0x400
leaq 0x870(%rsp), %rdi
xorl %esi, %esi
movq %r8, %rbx
callq 0x4260
movl 0x38(%rsp), %r11d
movq 0x48(%rsp), %r10
movq %rbx, 0x60(%rsp)
cmpq %r13, %rbx
jae 0x66860
xorl %ecx, %ecx
xorl %eax, %eax
xorl %esi, %esi
movq 0x60(%rsp), %r15
movq 0x68(%rsp), %r9
cmpl $0x0, 0xc70(%rsp,%rcx,4)
je 0x66677
testl %esi, %esi
je 0x66603
decl %esi
xorl %edx, %edx
jmp 0x6666e
movq %r9, %rdx
subq %r15, %rdx
cmpq $0x6, %rdx
jl 0x66641
xorl %edi, %edi
xorl %edx, %edx
movzbl (%r15,%rdi), %r8d
movl %edx, %esi
shll $0x7, %esi
movl %r8d, %edx
andl $0x7f, %edx
orl %esi, %edx
leaq 0x1(%rdi), %rsi
testb %r8b, %r8b
jns 0x66636
cmpl $0x5, %edi
movq %rsi, %rdi
jne 0x66613
addq %r15, %rsi
subl %r15d, %esi
movslq %esi, %rsi
jmp 0x6664e
movsbl (%r15), %edx
testl %edx, %edx
js 0x6668e
movl $0x1, %esi
addq %rsi, %r15
xorl %esi, %esi
testl %edx, %edx
jne 0x6666e
cmpq %r9, %r15
jae 0x66860
movzbl (%r15), %esi
incq %r15
xorl %edx, %edx
movq 0x68(%rsp), %r9
movl %edx, 0x870(%rsp,%rcx,4)
addl %edx, %eax
cmpq $0xfe, %rcx
ja 0x666b4
incq %rcx
cmpq %r9, %r15
jb 0x665ef
jmp 0x666b4
xorl %edx, %edx
movq %r15, %rsi
movzbl (%rsi), %edi
incq %rsi
movl %edx, %r8d
shll $0x7, %r8d
movl %edi, %edx
andl $0x7f, %edx
orl %r8d, %edx
testb %dil, %dil
jns 0x66639
cmpq %r9, %rsi
jb 0x66693
jmp 0x66639
subq 0x60(%rsp), %r15
testl %r15d, %r15d
je 0x66860
testl %eax, %eax
je 0x667c2
cmpl %r11d, %eax
je 0x66710
xorl %ecx, %ecx
cmpl %r11d, %eax
jae 0x666e1
xorl %ecx, %ecx
addl %eax, %eax
incl %ecx
cmpl %r11d, %eax
jb 0x666d8
movd %ecx, %xmm1
xorps %xmm0, %xmm0
movss %xmm1, %xmm0            # xmm0 = xmm1[0],xmm0[1,2,3]
xorl %eax, %eax
movdqa 0x870(%rsp,%rax,4), %xmm1
pslld %xmm0, %xmm1
movdqa %xmm1, 0x870(%rsp,%rax,4)
addq $0x4, %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0x666ee
xorl %r13d, %r13d
xorl %ebx, %ebx
movl 0x870(%rsp,%r13,4), %ebp
testq %rbp, %rbp
je 0x667a9
movl %r11d, %eax
subl %ebx, %eax
cmpl %eax, %ebp
ja 0x66860
cmpb $0x0, 0x58(%rsp)
je 0x66772
movl %ebp, %eax
shll $0x12, %eax
movq %rbp, %rcx
shlq $0x8, %rcx
xorl %edx, %edx
movl %ebx, %esi
movl %eax, %edi
orl %edx, %edi
orl %r13d, %edi
movl %esi, %r8d
movq %r12, %r9
shlq $0xc, %r9
addq %r10, %r9
movl %edi, (%r9,%r8,4)
incl %esi
addq $0x100, %rdx            # imm = 0x100
cmpq %rdx, %rcx
jne 0x6674a
jmp 0x667a5
movl %ebx, %edi
addq 0x70(%rsp,%r12,8), %rdi
movl %r13d, %esi
movq %rbp, %rdx
callq 0x4260
movl 0x38(%rsp), %r11d
movq 0x48(%rsp), %r10
movq %r12, %rax
shlq $0xa, %rax
addq 0x30(%rsp), %rax
movw %bp, (%rax,%r13,4)
movw %bx, 0x2(%rax,%r13,4)
addl %ebx, %ebp
movl %ebp, %ebx
incq %r13
cmpq $0x100, %r13            # imm = 0x100
jne 0x66715
cmpl %r11d, %ebx
jne 0x66860
movslq %r15d, %rax
movq 0x60(%rsp), %r8
addq %rax, %r8
movl 0x40(%rsp), %ebx
movq 0x28(%rsp), %rbp
movq 0x68(%rsp), %r13
incq %r12
cmpq $0x100, %r12            # imm = 0x100
jne 0x665a1
testq %r14, %r14
cmovneq %r14, %r8
movq %rbp, %rdi
movq %r8, %r14
callq 0x45c0
leaq 0x10(%r14), %rcx
movq 0x20(%rsp), %rax
cmpq %rax, %rcx
movq 0x30(%rsp), %r15
ja 0x6640b
movq %r14, %rdx
movl (%r14), %r8d
cmpl $0x8000, %r8d           # imm = 0x8000
movq 0x8(%rsp), %r14
jb 0x66842
movl 0x4(%rdx), %r9d
cmpl $0x8000, %r9d           # imm = 0x8000
jb 0x66842
movl 0x8(%rdx), %r10d
cmpl $0x8000, %r10d          # imm = 0x8000
jae 0x6689b
xorl %ebp, %ebp
jmp 0x668b2
movq 0x8(%rsp), %r14
movq 0x30(%rsp), %r15
jmp 0x6686a
movq 0x8(%rsp), %r14
xorl %ebp, %ebp
movq 0x30(%rsp), %r15
jmp 0x668b2
movq 0x30(%rsp), %r15
movq 0x8(%rsp), %r14
movq 0x28(%rsp), %rbp
jmp 0x668b2
xorl %edx, %edx
movzbl (%rsi), %edi
incq %rsi
movl %edx, %r8d
shll $0x7, %r8d
movl %edi, %edx
andl $0x7f, %edx
orl %r8d, %edx
testb %dil, %dil
jns 0x663c9
cmpq %r9, %rsi
jb 0x66873
jmp 0x663c9
movl 0xc(%rdx), %esi
cmpl $0x8000, %esi           # imm = 0x8000
jae 0x668ec
xorl %ebp, %ebp
movq 0x30(%rsp), %r15
movq 0x8(%rsp), %r14
movq %r15, %rdi
callq 0x7e26a
movq 0x48(%rsp), %rdi
callq 0x7e26a
movq %r14, %rdi
callq 0x45c0
movq %rbp, %rdi
callq 0x45c0
xorl %r14d, %r14d
movq %r14, %rax
addq $0x1078, %rsp           # imm = 0x1078
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%rsp), %rax
addq $-0x8, %rax
movq %rax, 0x58(%rsp)
movl 0x1c(%rsp), %eax
shrl $0x2, %eax
movq %rax, 0x28(%rsp)
leal (%rax,%rax,2), %eax
movq %rax, 0x8(%rsp)
cmpl $0xc, 0x10(%rsp)
jne 0x66c15
xorl %ebx, %ebx
cmpl $0x4, 0x1c(%rsp)
jb 0x66b8c
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0x10(%rsp)
movq 0x28(%rsp), %r15
leaq (%r15,%r15,2), %rax
movq %rax, 0x8(%rsp)
xorl %edi, %edi
movq %r15, %rdx
movq 0x50(%rsp), %r12
xorl %r15d, %r15d
xorl %r14d, %r14d
xorl %ebx, %ebx
movq %rdx, 0x38(%rsp)
movq %r14, %rax
movq %r15, %rdx
movq %rdi, %r14
movq 0x70(%rsp,%rdi,8), %r13
movl %r8d, %ebp
movl $0xfff, %edi            # imm = 0xFFF
andl %edi, %ebp
movzbl (%r13,%rbp), %r15d
shlq $0xa, %r14
movq 0x30(%rsp), %r13
addq %r13, %r14
movzwl (%r14,%r15,4), %r11d
shrl $0xc, %r8d
imull %r11d, %r8d
addl %ebp, %r8d
movzwl 0x2(%r14,%r15,4), %r11d
subl %r11d, %r8d
movq %r15, 0x40(%rsp)
movb %r15b, (%r12)
movq 0x70(%rsp,%rdx,8), %r11
movl %r9d, %r14d
andl %edi, %r14d
movzbl (%r11,%r14), %r15d
shlq $0xa, %rdx
addq %r13, %rdx
movzwl (%rdx,%r15,4), %r11d
shrl $0xc, %r9d
imull %r11d, %r9d
addl %r14d, %r9d
movzwl 0x2(%rdx,%r15,4), %edx
subl %edx, %r9d
movq 0x28(%rsp), %rbp
movb %r15b, (%r12,%rbp)
movq 0x70(%rsp,%rax,8), %rdx
movl %r10d, %r11d
andl %edi, %r11d
movzbl (%rdx,%r11), %r14d
shlq $0xa, %rax
addq %r13, %rax
movzwl (%rax,%r14,4), %edx
shrl $0xc, %r10d
imull %edx, %r10d
addl %r11d, %r10d
movzwl 0x2(%rax,%r14,4), %eax
subl %eax, %r10d
movb %r14b, (%r12,%rbp,2)
movl %ebx, %eax
movq 0x70(%rsp,%rax,8), %rdx
movl %esi, %r11d
andl %edi, %r11d
movzbl (%rdx,%r11), %ebx
shlq $0xa, %rax
addq %r13, %rax
movzwl (%rax,%rbx,4), %edx
shrl $0xc, %esi
imull %edx, %esi
addl %r11d, %esi
movzwl 0x2(%rax,%rbx,4), %eax
subl %eax, %esi
movq 0x8(%rsp), %rax
movb %bl, (%r12,%rax)
cmpq 0x58(%rsp), %rcx
jae 0x66ad6
movzwl (%rcx), %eax
movl %r8d, %edx
shll $0x10, %edx
orl %eax, %edx
xorl %eax, %eax
cmpl $0x8000, %r8d           # imm = 0x8000
cmovbl %edx, %r8d
leaq 0x2(%rcx), %rax
cmovbq %rax, %rcx
movzwl (%rcx), %eax
movl %r9d, %edx
shll $0x10, %edx
orl %eax, %edx
xorl %eax, %eax
cmpl $0x8000, %r9d           # imm = 0x8000
cmovbl %edx, %r9d
leaq 0x2(%rcx), %rax
cmovbq %rax, %rcx
movzwl (%rcx), %eax
movl %r10d, %edx
shll $0x10, %edx
orl %eax, %edx
xorl %eax, %eax
cmpl $0x8000, %r10d          # imm = 0x8000
cmovbl %edx, %r10d
leaq 0x2(%rcx), %rax
cmovbq %rax, %rcx
movzwl (%rcx), %eax
movl %esi, %edx
shll $0x10, %edx
orl %eax, %edx
xorl %eax, %eax
cmpl $0x8000, %esi           # imm = 0x8000
cmovbl %edx, %esi
leaq 0x2(%rcx), %rax
cmovbq %rax, %rcx
jmp 0x66b5b
cmpl $0x7fff, %r8d           # imm = 0x7FFF
ja 0x66af8
leaq 0x1(%rcx), %rax
cmpq 0x20(%rsp), %rax
jae 0x66af8
movzwl (%rcx), %eax
shll $0x10, %r8d
orl %eax, %r8d
addq $0x2, %rcx
cmpl $0x7fff, %r9d           # imm = 0x7FFF
ja 0x66b1a
leaq 0x1(%rcx), %rax
cmpq 0x20(%rsp), %rax
jae 0x66b1a
movzwl (%rcx), %eax
shll $0x10, %r9d
orl %eax, %r9d
addq $0x2, %rcx
cmpl $0x7fff, %r10d          # imm = 0x7FFF
ja 0x66b3c
leaq 0x1(%rcx), %rax
cmpq 0x20(%rsp), %rax
jae 0x66b3c
movzwl (%rcx), %eax
shll $0x10, %r10d
orl %eax, %r10d
addq $0x2, %rcx
cmpl $0x7fff, %esi           # imm = 0x7FFF
ja 0x66b5b
leaq 0x1(%rcx), %rax
cmpq 0x20(%rsp), %rax
jae 0x66b5b
movzwl (%rcx), %eax
shll $0x10, %esi
orl %eax, %esi
addq $0x2, %rcx
movq 0x10(%rsp), %rax
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rdx
incq %r12
decq %rax
movq %rax, 0x10(%rsp)
decq %rdx
jne 0x66955
movq 0x8(%rsp), %rax
subl 0x10(%rsp), %eax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
cmpl 0x1c(%rsp), %eax
movq 0x30(%rsp), %rdi
movq 0x50(%rsp), %r14
jae 0x671f0
movl 0x8(%rsp), %eax
movl 0x1c(%rsp), %edx
movl %esi, %r10d
andl $0xfff, %r10d           # imm = 0xFFF
movl %ebx, %r8d
movq 0x70(%rsp,%r8,8), %r9
movzbl (%r9,%r10), %ebx
movb %bl, (%r14,%rax)
shlq $0xa, %r8
addq %rdi, %r8
movzwl (%r8,%rbx,4), %r9d
shrl $0xc, %esi
imull %r9d, %esi
addl %r10d, %esi
movzwl 0x2(%r8,%rbx,4), %r8d
subl %r8d, %esi
cmpl $0x7fff, %esi           # imm = 0x7FFF
ja 0x66c08
leaq 0x1(%rcx), %r8
cmpq 0x20(%rsp), %r8
jae 0x66c08
movzwl (%rcx), %r8d
shll $0x10, %esi
orl %r8d, %esi
addq $0x2, %rcx
incq %rax
cmpq %rax, %rdx
jne 0x66bad
jmp 0x671f0
cmpl $0x1869f, %ebx          # imm = 0x1869F
jbe 0x66efd
xorl %eax, %eax
cmpl $0x4, 0x1c(%rsp)
jb 0x66e6f
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0x10(%rsp)
movq 0x28(%rsp), %r13
leaq (,%r13,2), %rax
addq %r13, %rax
movq %rax, 0x8(%rsp)
xorl %r15d, %r15d
movq 0x50(%rsp), %r12
xorl %r11d, %r11d
xorl %edi, %edi
xorl %eax, %eax
movl $0x3ff, %ebx            # imm = 0x3FF
movq 0x28(%rsp), %rbp
movl %r8d, %edx
andl %ebx, %edx
shlq $0xc, %r15
movq 0x48(%rsp), %r14
addq %r14, %r15
movl (%r15,%rdx,4), %r15d
movl %r9d, %edx
andl %ebx, %edx
shlq $0xc, %r11
addq %r14, %r11
movl (%r11,%rdx,4), %r11d
movb %r15b, (%r12)
movb %r11b, (%r12,%rbp)
movl %r15d, %edx
shrl $0x12, %edx
shrl $0xa, %r8d
imull %edx, %r8d
movl %r15d, %edx
shrl $0x8, %edx
andl %ebx, %edx
addl %edx, %r8d
movl %r11d, %edx
shrl $0x12, %edx
shrl $0xa, %r9d
imull %edx, %r9d
movl %r11d, %edx
shrl $0x8, %edx
andl %ebx, %edx
addl %edx, %r9d
movl %r10d, %edx
andl %ebx, %edx
shlq $0xc, %rdi
addq %r14, %rdi
movl (%rdi,%rdx,4), %edi
movl %eax, %eax
movl %esi, %edx
andl %ebx, %edx
shlq $0xc, %rax
addq %r14, %rax
movl (%rax,%rdx,4), %r14d
movl %edi, %eax
shrl $0x12, %eax
shrl $0xa, %r10d
imull %eax, %r10d
movl %edi, %eax
shrl $0x8, %eax
andl %ebx, %eax
addl %eax, %r10d
movl %r14d, %eax
shrl $0x12, %eax
shrl $0xa, %esi
imull %eax, %esi
movl %r14d, %eax
shrl $0x8, %eax
andl %ebx, %eax
addl %eax, %esi
movb %dil, (%r12,%rbp,2)
movq 0x8(%rsp), %rax
movb %r14b, (%r12,%rax)
cmpq 0x58(%rsp), %rcx
jae 0x66db1
movzwl (%rcx), %eax
movl %r8d, %edx
shll $0x10, %edx
orl %eax, %edx
xorl %eax, %eax
cmpl $0x8000, %r8d           # imm = 0x8000
cmovbl %edx, %r8d
leaq 0x2(%rcx), %rax
cmovbq %rax, %rcx
movzwl (%rcx), %eax
movl %r9d, %edx
shll $0x10, %edx
orl %eax, %edx
xorl %eax, %eax
cmpl $0x8000, %r9d           # imm = 0x8000
cmovbl %edx, %r9d
leaq 0x2(%rcx), %rax
cmovbq %rax, %rcx
movzwl (%rcx), %eax
movl %r10d, %edx
shll $0x10, %edx
orl %eax, %edx
xorl %eax, %eax
cmpl $0x8000, %r10d          # imm = 0x8000
cmovbl %edx, %r10d
leaq 0x2(%rcx), %rax
cmovbq %rax, %rcx
movzwl (%rcx), %eax
movl %esi, %edx
shll $0x10, %edx
orl %eax, %edx
xorl %eax, %eax
cmpl $0x8000, %esi           # imm = 0x8000
cmovbl %edx, %esi
leaq 0x2(%rcx), %rax
cmovbq %rax, %rcx
jmp 0x66e36
cmpl $0x7fff, %r8d           # imm = 0x7FFF
ja 0x66dd3
leaq 0x1(%rcx), %rax
cmpq 0x20(%rsp), %rax
jae 0x66dd3
movzwl (%rcx), %eax
shll $0x10, %r8d
orl %eax, %r8d
addq $0x2, %rcx
cmpl $0x7fff, %r9d           # imm = 0x7FFF
ja 0x66df5
leaq 0x1(%rcx), %rax
cmpq 0x20(%rsp), %rax
jae 0x66df5
movzwl (%rcx), %eax
shll $0x10, %r9d
orl %eax, %r9d
addq $0x2, %rcx
cmpl $0x7fff, %r10d          # imm = 0x7FFF
ja 0x66e17
leaq 0x1(%rcx), %rax
cmpq 0x20(%rsp), %rax
jae 0x66e17
movzwl (%rcx), %eax
shll $0x10, %r10d
orl %eax, %r10d
addq $0x2, %rcx
cmpl $0x7fff, %esi           # imm = 0x7FFF
ja 0x66e36
leaq 0x1(%rcx), %rax
cmpq 0x20(%rsp), %rax
jae 0x66e36
movzwl (%rcx), %eax
shll $0x10, %esi
orl %eax, %esi
addq $0x2, %rcx
movq 0x10(%rsp), %rdx
movl $0xff, %eax
andq %rax, %r15
andq %rax, %r11
andq %rax, %rdi
movzbl %r14b, %eax
incq %r12
decq %rdx
movq %rdx, 0x10(%rsp)
decq %r13
jne 0x66c6b
movq 0x8(%rsp), %rdx
subl 0x10(%rsp), %edx
movq %rdx, 0x8(%rsp)
movq 0x8(%rsp), %rdx
cmpl 0x1c(%rsp), %edx
movq 0x30(%rsp), %rdi
movq 0x50(%rsp), %r14
jae 0x671f0
movl 0x8(%rsp), %edx
movl 0x1c(%rsp), %r11d
movl $0x3ff, %r8d            # imm = 0x3FF
movl %eax, %eax
movl %esi, %r9d
andl %r8d, %r9d
shlq $0xc, %rax
addq 0x48(%rsp), %rax
movl (%rax,%r9,4), %eax
movb %al, (%r14,%rdx)
movl %eax, %r9d
shrl $0x12, %r9d
shrl $0xa, %esi
movl %esi, %r10d
imull %r9d, %r10d
movl %eax, %esi
shrl $0x8, %esi
andl %r8d, %esi
addl %r10d, %esi
cmpl $0x7fff, %esi           # imm = 0x7FFF
ja 0x66eed
leaq 0x1(%rcx), %r9
cmpq 0x20(%rsp), %r9
jae 0x66eed
movzwl (%rcx), %r9d
shll $0x10, %esi
orl %r9d, %esi
addq $0x2, %rcx
movzbl %al, %eax
incq %rdx
cmpq %rdx, %r11
jne 0x66e97
jmp 0x671f0
xorl %ebx, %ebx
cmpl $0x4, 0x1c(%rsp)
jb 0x67170
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0x10(%rsp)
movq 0x28(%rsp), %r15
leaq (%r15,%r15,2), %rax
movq %rax, 0x8(%rsp)
xorl %edi, %edi
movq %r15, %rdx
movq 0x50(%rsp), %r12
xorl %r15d, %r15d
xorl %r14d, %r14d
xorl %ebx, %ebx
movq %rdx, 0x38(%rsp)
movq %r14, %rax
movq %r15, %rdx
movq %rdi, %r14
movq 0x70(%rsp,%rdi,8), %r13
movl %r8d, %ebp
movl $0x3ff, %edi            # imm = 0x3FF
andl %edi, %ebp
movzbl (%r13,%rbp), %r15d
shlq $0xa, %r14
movq 0x30(%rsp), %r13
addq %r13, %r14
movzwl (%r14,%r15,4), %r11d
shrl $0xa, %r8d
imull %r11d, %r8d
addl %ebp, %r8d
movzwl 0x2(%r14,%r15,4), %r11d
subl %r11d, %r8d
movq %r15, 0x40(%rsp)
movb %r15b, (%r12)
movq 0x70(%rsp,%rdx,8), %r11
movl %r9d, %r14d
andl %edi, %r14d
movzbl (%r11,%r14), %r15d
shlq $0xa, %rdx
addq %r13, %rdx
movzwl (%rdx,%r15,4), %r11d
shrl $0xa, %r9d
imull %r11d, %r9d
addl %r14d, %r9d
movzwl 0x2(%rdx,%r15,4), %edx
subl %edx, %r9d
movq 0x28(%rsp), %rbp
movb %r15b, (%r12,%rbp)
movq 0x70(%rsp,%rax,8), %rdx
movl %r10d, %r11d
andl %edi, %r11d
movzbl (%rdx,%r11), %r14d
shlq $0xa, %rax
addq %r13, %rax
movzwl (%rax,%r14,4), %edx
shrl $0xa, %r10d
imull %edx, %r10d
addl %r11d, %r10d
movzwl 0x2(%rax,%r14,4), %eax
subl %eax, %r10d
movb %r14b, (%r12,%rbp,2)
movl %ebx, %eax
movq 0x70(%rsp,%rax,8), %rdx
movl %esi, %r11d
andl %edi, %r11d
movzbl (%rdx,%r11), %ebx
shlq $0xa, %rax
addq %r13, %rax
movzwl (%rax,%rbx,4), %edx
shrl $0xa, %esi
imull %edx, %esi
addl %r11d, %esi
movzwl 0x2(%rax,%rbx,4), %eax
subl %eax, %esi
movq 0x8(%rsp), %rax
movb %bl, (%r12,%rax)
cmpq 0x58(%rsp), %rcx
jae 0x670ba
movzwl (%rcx), %eax
movl %r8d, %edx
shll $0x10, %edx
orl %eax, %edx
xorl %eax, %eax
cmpl $0x8000, %r8d           # imm = 0x8000
cmovbl %edx, %r8d
leaq 0x2(%rcx), %rax
cmovbq %rax, %rcx
movzwl (%rcx), %eax
movl %r9d, %edx
shll $0x10, %edx
orl %eax, %edx
xorl %eax, %eax
cmpl $0x8000, %r9d           # imm = 0x8000
cmovbl %edx, %r9d
leaq 0x2(%rcx), %rax
cmovbq %rax, %rcx
movzwl (%rcx), %eax
movl %r10d, %edx
shll $0x10, %edx
orl %eax, %edx
xorl %eax, %eax
cmpl $0x8000, %r10d          # imm = 0x8000
cmovbl %edx, %r10d
leaq 0x2(%rcx), %rax
cmovbq %rax, %rcx
movzwl (%rcx), %eax
movl %esi, %edx
shll $0x10, %edx
orl %eax, %edx
xorl %eax, %eax
cmpl $0x8000, %esi           # imm = 0x8000
cmovbl %edx, %esi
leaq 0x2(%rcx), %rax
cmovbq %rax, %rcx
jmp 0x6713f
cmpl $0x7fff, %r8d           # imm = 0x7FFF
ja 0x670dc
leaq 0x1(%rcx), %rax
cmpq 0x20(%rsp), %rax
jae 0x670dc
movzwl (%rcx), %eax
shll $0x10, %r8d
orl %eax, %r8d
addq $0x2, %rcx
cmpl $0x7fff, %r9d           # imm = 0x7FFF
ja 0x670fe
leaq 0x1(%rcx), %rax
cmpq 0x20(%rsp), %rax
jae 0x670fe
movzwl (%rcx), %eax
shll $0x10, %r9d
orl %eax, %r9d
addq $0x2, %rcx
cmpl $0x7fff, %r10d          # imm = 0x7FFF
ja 0x67120
leaq 0x1(%rcx), %rax
cmpq 0x20(%rsp), %rax
jae 0x67120
movzwl (%rcx), %eax
shll $0x10, %r10d
orl %eax, %r10d
addq $0x2, %rcx
cmpl $0x7fff, %esi           # imm = 0x7FFF
ja 0x6713f
leaq 0x1(%rcx), %rax
cmpq 0x20(%rsp), %rax
jae 0x6713f
movzwl (%rcx), %eax
shll $0x10, %esi
orl %eax, %esi
addq $0x2, %rcx
movq 0x10(%rsp), %rax
movq 0x38(%rsp), %rdx
incq %r12
decq %rax
movq %rax, 0x10(%rsp)
decq %rdx
movq 0x40(%rsp), %rdi
jne 0x66f39
movq 0x8(%rsp), %rax
subl 0x10(%rsp), %eax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
cmpl 0x1c(%rsp), %eax
movq 0x30(%rsp), %rdi
movq 0x50(%rsp), %r14
jae 0x671f0
movl 0x8(%rsp), %eax
movl 0x1c(%rsp), %edx
movl %esi, %r10d
andl $0x3ff, %r10d           # imm = 0x3FF
movl %ebx, %r8d
movq 0x70(%rsp,%r8,8), %r9
movzbl (%r9,%r10), %ebx
movb %bl, (%r14,%rax)
shlq $0xa, %r8
addq %rdi, %r8
movzwl (%r8,%rbx,4), %r9d
shrl $0xa, %esi
imull %r9d, %esi
addl %r10d, %esi
movzwl 0x2(%r8,%rbx,4), %r8d
subl %r8d, %esi
cmpl $0x7fff, %esi           # imm = 0x7FFF
ja 0x671e8
leaq 0x1(%rcx), %r8
cmpq 0x20(%rsp), %r8
jae 0x671e8
movzwl (%rcx), %r8d
shll $0x10, %esi
orl %r8d, %esi
addq $0x2, %rcx
incq %rax
cmpq %rax, %rdx
jne 0x6718d
callq 0x7e26a
movq 0x48(%rsp), %rdi
callq 0x7e26a
jmp 0x668d7