// File: /workspace/github_c_makefile_star2_O2/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, %r15d
cmpl $0x10, %esi
setb %al
cmpl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
setae %cl
orb %al, %cl
jne 0x52291
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %r13
movl $0x10b300, %edi         # imm = 0x10B300
callq 0x6412c
testq %rax, %rax
je 0x52291
movq %rax, 0x30(%rsp)
movl $0x40000, %edi          # imm = 0x40000
callq 0x6412c
movq %rax, %rbx
testq %rax, %rax
je 0x51f40
movzbl (%r13), %r14d
movl %r14d, %eax
andb $-0x10, %al
cmpb $-0x40, %al
jne 0x51ebc
xorl %eax, %eax
movq 0x30(%rsp), %rcx
cmpq $0x100, %rax            # imm = 0x100
je 0x51edc
movq %rcx, 0x70(%rsp,%rax,8)
incq %rax
addq $0x10b3, %rcx           # imm = 0x10B3
jmp 0x51ea3
xorl %eax, %eax
movq 0x30(%rsp), %rcx
cmpq $0x100, %rax            # imm = 0x100
je 0x51edc
movq %rcx, 0x70(%rsp,%rax,8)
incq %rax
addq $0x4b3, %rcx            # imm = 0x4B3
jmp 0x51ec3
movl %r15d, %ecx
testq %r12, %r12
je 0x51eee
movq $0x0, (%rsp)
jmp 0x51f08
movq %rcx, %r12
movq %rcx, %rdi
callq 0x4680
movq %r12, %rcx
movq %rax, %r12
movq %rax, (%rsp)
testq %rax, %rax
je 0x51f40
movq %rcx, 0x60(%rsp)
movl %ebp, 0x50(%rsp)
movl %ebp, %ebp
addq %r13, %rbp
incq %r13
movl %r14d, 0x20(%rsp)
testb $0x1, %r14b
movq %rbp, 0x8(%rsp)
jne 0x51f4b
movq $0x0, 0x68(%rsp)
movq $0x0, 0x18(%rsp)
jmp 0x51fca
xorl %r15d, %r15d
xorl %r14d, %r14d
jmp 0x5226f
movq %r15, 0x40(%rsp)
leaq 0x870(%rsp), %rdx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x51248
movslq %eax, %r14
addq %r13, %r14
leaq 0x54(%rsp), %r15
movq %r14, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x51248
cltq
addq %r14, %rax
movl (%r15), %r14d
subq %rax, %rbp
cmpq %r14, %rbp
jl 0x52268
movq %rax, %r15
movl 0x870(%rsp), %ebp
movq %rax, %rdi
movl %r14d, %esi
xorl %edx, %edx
movl %ebp, %ecx
callq 0x4f5f9
testq %rax, %rax
je 0x52268
addq %r14, %r15
movq %r15, 0x68(%rsp)
addq %rax, %rbp
movq %rax, 0x18(%rsp)
movq %rax, %r13
movq 0x40(%rsp), %r15
leaq 0xc70(%rsp), %r14
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x4260
movq %r13, %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x51470
testl %eax, %eax
je 0x52202
cltq
addq %rax, %r13
movq %r13, 0x10(%rsp)
cmpq %rbp, %r13
jae 0x52202
movq %r15, 0x40(%rsp)
movl 0x20(%rsp), %r14d
shrl $0x4, %r14d
cmpl $0x186a0, 0x50(%rsp)    # imm = 0x186A0
setae %al
pushq $0x1
popq %rdx
movl %r14d, %ecx
shll %cl, %edx
movl %edx, 0x28(%rsp)
cmpl $0xa, %r14d
sete %cl
andb %al, %cl
movb %cl, 0x48(%rsp)
xorl %r15d, %r15d
movq %rbx, 0x38(%rsp)
movq %r12, 0x58(%rsp)
movl %r14d, 0x20(%rsp)
cmpq $0x100, %r15            # imm = 0x100
je 0x5220d
cmpl $0x0, 0xc70(%rsp,%r15,4)
je 0x521f5
movl $0x400, %edx            # imm = 0x400
leaq 0x870(%rsp), %rdi
xorl %esi, %esi
callq 0x4260
cmpq %rbp, 0x10(%rsp)
je 0x521fd
xorl %ebx, %ebx
movq 0x10(%rsp), %r14
xorl %eax, %eax
xorl %r13d, %r13d
leaq 0x54(%rsp), %r12
cmpq $0xff, %rbx
ja 0x520fa
cmpq %rbp, %r14
jae 0x520fa
cmpl $0x0, 0xc70(%rsp,%rbx,4)
je 0x520e3
testl %eax, %eax
je 0x520bc
decl %eax
xorl %ecx, %ecx
jmp 0x520d9
movq %r14, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x51248
cltq
addq %rax, %r14
movl 0x54(%rsp), %ecx
xorl %eax, %eax
testl %ecx, %ecx
je 0x520e8
movl %ecx, 0x870(%rsp,%rbx,4)
addl %ecx, %r13d
incq %rbx
jmp 0x5209a
cmpq %rbp, %r14
jae 0x521fd
movzbl (%r14), %eax
incq %r14
jmp 0x520b8
subq 0x10(%rsp), %r14
testl %r14d, %r14d
je 0x521fd
testl %r13d, %r13d
je 0x521de
leaq 0x870(%rsp), %rdi
movl %r13d, %esi
movl 0x28(%rsp), %edx
callq 0x4f9ec
movq 0x30(%rsp), %r10
xorl %r13d, %r13d
xorl %ebx, %ebx
cmpq $0x100, %r13            # imm = 0x100
je 0x521d8
movl 0x870(%rsp,%r13,4), %r12d
testq %r12, %r12
je 0x521d0
movl 0x28(%rsp), %eax
subl %ebx, %eax
cmpl %eax, %r12d
ja 0x521fd
cmpb $0x0, 0x48(%rsp)
je 0x5219c
movl %r12d, %eax
shll $0x12, %eax
movq %r12, %rcx
shlq $0x8, %rcx
movl %ebx, %edx
xorl %esi, %esi
cmpq %rsi, %rcx
je 0x521ca
movl %eax, %edi
orl %esi, %edi
orl %r13d, %edi
movl %edx, %r8d
movq %r15, %r9
shlq $0xc, %r9
addq %r10, %r9
movl %edi, (%r9,%r8,4)
addq $0x100, %rsi            # imm = 0x100
incl %edx
jmp 0x52174
movl %ebx, %edi
addq 0x70(%rsp,%r15,8), %rdi
movl %r13d, %esi
movq %r12, %rdx
callq 0x4260
movq 0x30(%rsp), %r10
movq %r15, %rax
shlq $0xa, %rax
addq 0x38(%rsp), %rax
movw %r12w, (%rax,%r13,4)
movw %bx, 0x2(%rax,%r13,4)
addl %ebx, %r12d
movl %r12d, %ebx
incq %r13
jmp 0x5212f
cmpl %ebx, 0x28(%rsp)
jne 0x521fd
movslq %r14d, %rax
addq %rax, 0x10(%rsp)
movq 0x38(%rsp), %rbx
movq 0x58(%rsp), %r12
movl 0x20(%rsp), %r14d
incq %r15
jmp 0x5204e
movq 0x38(%rsp), %rbx
movq (%rsp), %r14
movq 0x18(%rsp), %r15
jmp 0x5226f
movq 0x68(%rsp), %rax
testq %rax, %rax
movq 0x10(%rsp), %r15
cmovneq %rax, %r15
movq 0x18(%rsp), %rdi
callq 0x45c0
leaq 0x10(%r15), %rcx
movq 0x8(%rsp), %rax
cmpq %rax, %rcx
ja 0x52268
movl (%r15), %r8d
cmpl $0x8000, %r8d           # imm = 0x8000
jb 0x52268
movl 0x4(%r15), %r9d
cmpl $0x8000, %r9d           # imm = 0x8000
jb 0x52268
movl 0x8(%r15), %r10d
cmpl $0x8000, %r10d          # imm = 0x8000
jb 0x52268
movl 0xc(%r15), %esi
cmpl $0x8000, %esi           # imm = 0x8000
jae 0x522a9
xorl %r15d, %r15d
movq (%rsp), %r14
movq %rbx, %rdi
callq 0x64291
movq 0x30(%rsp), %rdi
callq 0x64291
movq %r14, %rdi
callq 0x45c0
movq %r15, %rdi
callq 0x45c0
xorl %r15d, %r15d
movq %r15, %rax
addq $0x1078, %rsp           # imm = 0x1078
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $-0x8, %rax
movq %rax, 0x48(%rsp)
movq 0x40(%rsp), %rax
shrl $0x2, %eax
movq %rax, 0x40(%rsp)
leaq (%rax,%rax,2), %rax
movq %rax, 0x28(%rsp)
cmpl $0xc, %r14d
jne 0x5252d
movq %rcx, 0x10(%rsp)
xorl %edi, %edi
movq %r12, (%rsp)
xorl %r14d, %r14d
xorl %ebp, %ebp
xorl %r13d, %r13d
xorl %ebx, %ebx
movq 0x40(%rsp), %r11
movl $0xfff, %r15d           # imm = 0xFFF
movq %r11, %r12
addq %rdi, %r12
je 0x5276c
movq %r13, %rdx
movq %rbp, %rax
movq %rdi, 0x20(%rsp)
movq 0x70(%rsp,%rbx,8), %r12
movl %r8d, %r13d
andl %r15d, %r13d
movzbl (%r12,%r13), %ecx
shlq $0xa, %rbx
movq 0x38(%rsp), %rdi
addq %rdi, %rbx
movzwl (%rbx,%rcx,4), %ebp
shrl $0xc, %r8d
imull %ebp, %r8d
addl %r13d, %r8d
movzwl 0x2(%rbx,%rcx,4), %ebx
subl %ebx, %r8d
movq (%rsp), %r12
movq %rcx, 0x18(%rsp)
movb %cl, (%r12)
movq 0x70(%rsp,%rdx,8), %rbx
movl %r9d, %ebp
andl %r15d, %ebp
movzbl (%rbx,%rbp), %r13d
shlq $0xa, %rdx
addq %rdi, %rdx
movzwl (%rdx,%r13,4), %ebx
shrl $0xc, %r9d
imull %ebx, %r9d
addl %ebp, %r9d
movzwl 0x2(%rdx,%r13,4), %edx
subl %edx, %r9d
movb %r13b, (%r12,%r11)
movq 0x70(%rsp,%rax,8), %rdx
movl %r10d, %ebx
andl %r15d, %ebx
movzbl (%rdx,%rbx), %ebp
shlq $0xa, %rax
addq %rdi, %rax
movzwl (%rax,%rbp,4), %edx
shrl $0xc, %r10d
imull %edx, %r10d
addl %ebx, %r10d
movzwl 0x2(%rax,%rbp,4), %eax
subl %eax, %r10d
movb %bpl, (%r12,%r11,2)
movl %r14d, %eax
movq 0x70(%rsp,%rax,8), %rdx
movl %esi, %ebx
andl %r15d, %ebx
movzbl (%rdx,%rbx), %r14d
shlq $0xa, %rax
addq %rdi, %rax
movzwl (%rax,%r14,4), %edx
shrl $0xc, %esi
imull %edx, %esi
addl %ebx, %esi
movzwl 0x2(%rax,%r14,4), %eax
subl %eax, %esi
movq 0x28(%rsp), %rax
movb %r14b, (%r12,%rax)
movq 0x10(%rsp), %rcx
cmpq 0x48(%rsp), %rcx
jae 0x52481
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
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rbx
jmp 0x5251c
cmpl $0x7fff, %r8d           # imm = 0x7FFF
ja 0x524af
leaq 0x1(%rcx), %rax
cmpq 0x8(%rsp), %rax
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rbx
jae 0x524b9
movzwl (%rcx), %eax
shll $0x10, %r8d
orl %eax, %r8d
addq $0x2, %rcx
jmp 0x524b9
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rbx
cmpl $0x7fff, %r9d           # imm = 0x7FFF
ja 0x524db
leaq 0x1(%rcx), %rax
cmpq 0x8(%rsp), %rax
jae 0x524db
movzwl (%rcx), %eax
shll $0x10, %r9d
orl %eax, %r9d
addq $0x2, %rcx
cmpl $0x7fff, %r10d          # imm = 0x7FFF
ja 0x524fd
leaq 0x1(%rcx), %rax
cmpq 0x8(%rsp), %rax
jae 0x524fd
movzwl (%rcx), %eax
shll $0x10, %r10d
orl %eax, %r10d
addq $0x2, %rcx
cmpl $0x7fff, %esi           # imm = 0x7FFF
ja 0x5251c
leaq 0x1(%rcx), %rax
cmpq 0x8(%rsp), %rax
jae 0x5251c
movzwl (%rcx), %eax
shll $0x10, %esi
orl %eax, %esi
addq $0x2, %rcx
movq %rcx, 0x10(%rsp)
decq %rdi
incq (%rsp)
jmp 0x522f2
cmpl $0x1869f, 0x50(%rsp)    # imm = 0x1869F
jbe 0x527f2
xorl %ebx, %ebx
movq %r12, %r14
xorl %eax, %eax
xorl %r13d, %r13d
xorl %r11d, %r11d
xorl %r15d, %r15d
movl $0x3ff, %r12d           # imm = 0x3FF
movq 0x40(%rsp), %rdi
movq %rdi, %rdx
movq %rbx, %rbp
addq %rbx, %rdx
je 0x52a4c
movl %r8d, %edx
andl %r12d, %edx
shlq $0xc, %r15
movq 0x30(%rsp), %rbx
addq %rbx, %r15
movl (%r15,%rdx,4), %r15d
movl %r9d, %edx
andl %r12d, %edx
shlq $0xc, %r11
addq %rbx, %r11
movl (%r11,%rdx,4), %r11d
movb %r15b, (%r14)
movb %r11b, (%r14,%rdi)
movl %r15d, %edx
shrl $0x12, %edx
shrl $0xa, %r8d
imull %edx, %r8d
movl %r15d, %edx
shrl $0x8, %edx
andl %r12d, %edx
addl %edx, %r8d
movl %r11d, %edx
shrl $0x12, %edx
shrl $0xa, %r9d
imull %edx, %r9d
movl %r11d, %edx
shrl $0x8, %edx
andl %r12d, %edx
addl %edx, %r9d
movl %r10d, %edx
andl %r12d, %edx
shlq $0xc, %r13
addq %rbx, %r13
movl (%r13,%rdx,4), %r13d
movl %eax, %eax
movl %esi, %edx
andl %r12d, %edx
shlq $0xc, %rax
addq %rbx, %rax
movq %r14, %rbx
movl (%rax,%rdx,4), %r14d
movl %r13d, %eax
shrl $0x12, %eax
shrl $0xa, %r10d
imull %eax, %r10d
movl %r13d, %eax
shrl $0x8, %eax
andl %r12d, %eax
addl %eax, %r10d
movl %r14d, %eax
shrl $0x12, %eax
shrl $0xa, %esi
imull %eax, %esi
movl %r14d, %eax
shrl $0x8, %eax
andl %r12d, %eax
addl %eax, %esi
movb %r13b, (%rbx,%rdi,2)
movq 0x28(%rsp), %rax
movq %rbx, %rdi
movb %r14b, (%rbx,%rax)
cmpq 0x48(%rsp), %rcx
jae 0x526bf
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
movq %rbp, %rbx
jmp 0x5274c
cmpl $0x7fff, %r8d           # imm = 0x7FFF
ja 0x526e6
leaq 0x1(%rcx), %rax
cmpq 0x8(%rsp), %rax
movq %rbp, %rbx
jae 0x526e9
movzwl (%rcx), %eax
shll $0x10, %r8d
orl %eax, %r8d
addq $0x2, %rcx
jmp 0x526e9
movq %rbp, %rbx
cmpl $0x7fff, %r9d           # imm = 0x7FFF
ja 0x5270b
leaq 0x1(%rcx), %rax
cmpq 0x8(%rsp), %rax
jae 0x5270b
movzwl (%rcx), %eax
shll $0x10, %r9d
orl %eax, %r9d
addq $0x2, %rcx
cmpl $0x7fff, %r10d          # imm = 0x7FFF
ja 0x5272d
leaq 0x1(%rcx), %rax
cmpq 0x8(%rsp), %rax
jae 0x5272d
movzwl (%rcx), %eax
shll $0x10, %r10d
orl %eax, %r10d
addq $0x2, %rcx
cmpl $0x7fff, %esi           # imm = 0x7FFF
ja 0x5274c
leaq 0x1(%rcx), %rax
cmpq 0x8(%rsp), %rax
jae 0x5274c
movzwl (%rcx), %eax
shll $0x10, %esi
orl %eax, %esi
addq $0x2, %rcx
movl $0xff, %eax
andq %rax, %r15
andq %rax, %r11
andq %rax, %r13
movzbl %r14b, %eax
decq %rbx
movq %rdi, %r14
incq %r14
jmp 0x52551
movq 0x28(%rsp), %r11
subq %rdi, %r11
movq 0x30(%rsp), %rbx
movq 0x38(%rsp), %rdi
movq 0x58(%rsp), %r15
movq 0x60(%rsp), %r9
movq 0x8(%rsp), %r10
movq 0x10(%rsp), %rcx
cmpq %r9, %r11
jae 0x52b57
movl %esi, %eax
andl $0xfff, %eax            # imm = 0xFFF
movl %r14d, %edx
movq 0x70(%rsp,%rdx,8), %r8
movzbl (%r8,%rax), %r14d
movb %r14b, (%r15,%r11)
shlq $0xa, %rdx
addq %rdi, %rdx
movzwl (%rdx,%r14,4), %r8d
shrl $0xc, %esi
imull %r8d, %esi
addl %eax, %esi
movzwl 0x2(%rdx,%r14,4), %eax
subl %eax, %esi
cmpl $0x7fff, %esi           # imm = 0x7FFF
ja 0x527ed
leaq 0x1(%rcx), %rax
cmpq %r10, %rax
jae 0x527ed
movzwl (%rcx), %eax
shll $0x10, %esi
orl %eax, %esi
addq $0x2, %rcx
incq %r11
jmp 0x52792
xorl %edi, %edi
movq %r12, 0x20(%rsp)
movq $0x0, (%rsp)
xorl %ebp, %ebp
xorl %r13d, %r13d
xorl %ebx, %ebx
movl $0x3ff, %r15d           # imm = 0x3FF
movq 0x40(%rsp), %r11
movq %r11, %r12
movq %rdi, 0x10(%rsp)
addq %rdi, %r12
je 0x52ad4
movq %r13, %rdx
movq %rbp, %rax
movq 0x70(%rsp,%rbx,8), %r12
movl %r8d, %r13d
andl %r15d, %r13d
movzbl (%r12,%r13), %r14d
shlq $0xa, %rbx
movq 0x38(%rsp), %rdi
addq %rdi, %rbx
movzwl (%rbx,%r14,4), %ebp
shrl $0xa, %r8d
imull %ebp, %r8d
addl %r13d, %r8d
movzwl 0x2(%rbx,%r14,4), %ebx
subl %ebx, %r8d
movq 0x20(%rsp), %r12
movq %r14, 0x18(%rsp)
movb %r14b, (%r12)
movq 0x70(%rsp,%rdx,8), %rbx
movl %r9d, %ebp
andl %r15d, %ebp
movzbl (%rbx,%rbp), %r13d
shlq $0xa, %rdx
addq %rdi, %rdx
movzwl (%rdx,%r13,4), %ebx
shrl $0xa, %r9d
imull %ebx, %r9d
addl %ebp, %r9d
movzwl 0x2(%rdx,%r13,4), %edx
subl %edx, %r9d
movb %r13b, (%r12,%r11)
movq 0x70(%rsp,%rax,8), %rdx
movl %r10d, %ebx
andl %r15d, %ebx
movzbl (%rdx,%rbx), %ebp
shlq $0xa, %rax
addq %rdi, %rax
movzwl (%rax,%rbp,4), %edx
shrl $0xa, %r10d
imull %edx, %r10d
addl %ebx, %r10d
movzwl 0x2(%rax,%rbp,4), %eax
subl %eax, %r10d
movb %bpl, (%r12,%r11,2)
movl (%rsp), %eax
movq 0x70(%rsp,%rax,8), %rdx
movl %esi, %ebx
andl %r15d, %ebx
movzbl (%rdx,%rbx), %r11d
shlq $0xa, %rax
addq %rdi, %rax
movzwl (%rax,%r11,4), %edx
shrl $0xa, %esi
imull %edx, %esi
addl %ebx, %esi
movzwl 0x2(%rax,%r11,4), %eax
subl %eax, %esi
movq 0x28(%rsp), %rax
movq %r11, (%rsp)
movb %r11b, (%r12,%rax)
cmpq 0x48(%rsp), %rcx
jae 0x529a4
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
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rbx
jmp 0x52a3f
cmpl $0x7fff, %r8d           # imm = 0x7FFF
ja 0x529d2
leaq 0x1(%rcx), %rax
cmpq 0x8(%rsp), %rax
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rbx
jae 0x529dc
movzwl (%rcx), %eax
shll $0x10, %r8d
orl %eax, %r8d
addq $0x2, %rcx
jmp 0x529dc
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rbx
cmpl $0x7fff, %r9d           # imm = 0x7FFF
ja 0x529fe
leaq 0x1(%rcx), %rax
cmpq 0x8(%rsp), %rax
jae 0x529fe
movzwl (%rcx), %eax
shll $0x10, %r9d
orl %eax, %r9d
addq $0x2, %rcx
cmpl $0x7fff, %r10d          # imm = 0x7FFF
ja 0x52a20
leaq 0x1(%rcx), %rax
cmpq 0x8(%rsp), %rax
jae 0x52a20
movzwl (%rcx), %eax
shll $0x10, %r10d
orl %eax, %r10d
addq $0x2, %rcx
cmpl $0x7fff, %esi           # imm = 0x7FFF
ja 0x52a3f
leaq 0x1(%rcx), %rax
cmpq 0x8(%rsp), %rax
jae 0x52a3f
movzwl (%rcx), %eax
shll $0x10, %esi
orl %eax, %esi
addq $0x2, %rcx
decq %rdi
incq 0x20(%rsp)
jmp 0x5280e
movq 0x28(%rsp), %r14
subq %rbp, %r14
movl $0x3ff, %edx            # imm = 0x3FF
movq 0x30(%rsp), %rbx
movq 0x38(%rsp), %rdi
movq 0x58(%rsp), %r15
movq 0x60(%rsp), %r10
movq 0x8(%rsp), %r11
cmpq %r10, %r14
jae 0x52b57
movl %eax, %eax
movl %esi, %r8d
andl %edx, %r8d
shlq $0xc, %rax
addq %rbx, %rax
movl (%rax,%r8,4), %eax
movb %al, (%r15,%r14)
movl %eax, %r8d
shrl $0x12, %r8d
shrl $0xa, %esi
movl %esi, %r9d
imull %r8d, %r9d
movl %eax, %esi
shrl $0x8, %esi
andl %edx, %esi
addl %r9d, %esi
cmpl $0x7fff, %esi           # imm = 0x7FFF
ja 0x52acc
leaq 0x1(%rcx), %r8
cmpq %r11, %r8
jae 0x52acc
movzwl (%rcx), %r8d
shll $0x10, %esi
orl %r8d, %esi
addq $0x2, %rcx
movzbl %al, %eax
incq %r14
jmp 0x52a72
movq 0x28(%rsp), %r11
subq 0x10(%rsp), %r11
movq 0x30(%rsp), %rbx
movq 0x38(%rsp), %rdi
movq 0x58(%rsp), %r15
movq 0x60(%rsp), %r9
movq 0x8(%rsp), %r10
movq (%rsp), %r14
cmpq %r9, %r11
jae 0x52b57
movl %esi, %eax
andl $0x3ff, %eax            # imm = 0x3FF
movl %r14d, %edx
movq 0x70(%rsp,%rdx,8), %r8
movzbl (%r8,%rax), %r14d
movb %r14b, (%r15,%r11)
shlq $0xa, %rdx
addq %rdi, %rdx
movzwl (%rdx,%r14,4), %r8d
shrl $0xa, %esi
imull %r8d, %esi
addl %eax, %esi
movzwl 0x2(%rdx,%r14,4), %eax
subl %eax, %esi
cmpl $0x7fff, %esi           # imm = 0x7FFF
ja 0x52b52
leaq 0x1(%rcx), %rax
cmpq %r10, %rax
jae 0x52b52
movzwl (%rcx), %eax
shll $0x10, %esi
orl %eax, %esi
addq $0x2, %rcx
incq %r11
jmp 0x52afb
callq 0x64291
movq %rbx, %rdi
callq 0x64291
jmp 0x52294
nopl (%rax)