// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/htscodecs/htscodecs/rANS_static32x16pr.c
// Function: rans_uncompress_O1_32x16
unsigned char *rans_uncompress_O1_32x16(unsigned char *in,
                                        unsigned int in_size,
                                        unsigned char *out,
                                        unsigned int out_sz) {
    if (in_size < NX*4) // 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;

    /*
     * Somewhat complex memory layout.
     * With shift==12 (TF_SHIFT_O1) we fill out use both sfb and fb.
     * With shift==10 (...O1_FAST)  we fill out and use s3 only.
     *
     * sfb+fb is larger, therefore we allocate this much memory.
     */
    uint8_t *sfb_ = htscodecs_tls_alloc(256*
                                        ((TOTFREQ_O1+MAGIC2)*sizeof(*sfb_)
                                         +256 * sizeof(fb_t)));
    if (!sfb_)
        return NULL;

    // sfb and fb are consecutive
    uint8_t *sfb[257];
    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);
    }
    fb_t (*fb)[256] = (fb_t (*)[256]) sfb[256];

    // NOTE: s3 overlaps sfb/fb
    uint32_t (*s3)[TOTFREQ_O1_FAST] = (uint32_t (*)[TOTFREQ_O1_FAST])sfb_;

    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
    cp += decode_freq1(cp, c_freq_end, shift, NULL, s3, sfb, fb);

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

    if (cp_end - cp < NX * 4)
        goto err;

    RansState R[NX];
    uint8_t *ptr = cp, *ptr_end = in + in_size - 2*NX;
    int z;
    for (z = 0; z < NX; z++) {
        RansDecInit(&R[z], &ptr);
        if (R[z] < RANS_BYTE_L)
            goto err;
    }

    int isz4 = out_sz/NX;
    int i4[NX], l[NX] = {0};
    for (z = 0; z < NX; z++)
        i4[z] = z*isz4;

    const int low_ent = in_size < 0.2 * out_sz;

    // 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 (; likely(i4[0] < isz4);) {
            for (z = 0; z < NX; z+=4) {
                uint16_t m[4], c[4];

                c[0] = sfb[l[z+0]][m[0] = R[z+0] & mask];
                c[1] = sfb[l[z+1]][m[1] = R[z+1] & mask];
                c[2] = sfb[l[z+2]][m[2] = R[z+2] & mask];
                c[3] = sfb[l[z+3]][m[3] = R[z+3] & mask];

                R[z+0] = fb[l[z+0]][c[0]].f * (R[z+0]>>TF_SHIFT_O1);
                R[z+0] += m[0] - fb[l[z+0]][c[0]].b;

                R[z+1] = fb[l[z+1]][c[1]].f * (R[z+1]>>TF_SHIFT_O1);
                R[z+1] += m[1] - fb[l[z+1]][c[1]].b;

                R[z+2] = fb[l[z+2]][c[2]].f * (R[z+2]>>TF_SHIFT_O1);
                R[z+2] += m[2] - fb[l[z+2]][c[2]].b;

                R[z+3] = fb[l[z+3]][c[3]].f * (R[z+3]>>TF_SHIFT_O1);
                R[z+3] += m[3] - fb[l[z+3]][c[3]].b;

                out[i4[z+0]++] = l[z+0] = c[0];
                out[i4[z+1]++] = l[z+1] = c[1];
                out[i4[z+2]++] = l[z+2] = c[2];
                out[i4[z+3]++] = l[z+3] = c[3];

                if (!low_ent && likely(ptr < ptr_end)) {
                    RansDecRenorm(&R[z+0], &ptr);
                    RansDecRenorm(&R[z+1], &ptr);
                    RansDecRenorm(&R[z+2], &ptr);
                    RansDecRenorm(&R[z+3], &ptr);
                } else {
                    RansDecRenormSafe(&R[z+0], &ptr, ptr_end+2*NX);
                    RansDecRenormSafe(&R[z+1], &ptr, ptr_end+2*NX);
                    RansDecRenormSafe(&R[z+2], &ptr, ptr_end+2*NX);
                    RansDecRenormSafe(&R[z+3], &ptr, ptr_end+2*NX);
                }
            }
        }

        // Remainder
        for (; i4[NX-1] < out_sz; i4[NX-1]++) {
            uint32_t m = R[NX-1] & ((1u<<TF_SHIFT_O1)-1);
            unsigned char c = sfb[l[NX-1]][m];
            out[i4[NX-1]] = c;
            R[NX-1] = fb[l[NX-1]][c].f * (R[NX-1]>>TF_SHIFT_O1) +
                m - fb[l[NX-1]][c].b;
            RansDecRenormSafe(&R[NX-1], &ptr, ptr_end + 2*NX);
            l[NX-1] = c;
        }
    } else {
        // TF_SHIFT_O1 = 10
        const uint32_t mask = ((1u << TF_SHIFT_O1_FAST)-1);
        for (; likely(i4[0] < isz4);) {
            for (z = 0; z < NX; z+=4) {
                // Merged sfb and fb into single s3 lookup.
                // The m[4] array completely vanishes in this method.
                uint32_t S[4] = {
                    s3[l[z+0]][R[z+0] & mask],
                    s3[l[z+1]][R[z+1] & mask],
                    s3[l[z+2]][R[z+2] & mask],
                    s3[l[z+3]][R[z+3] & mask],
                };

                l[z+0] = out[i4[z+0]++] = S[0];
                l[z+1] = out[i4[z+1]++] = S[1];
                l[z+2] = out[i4[z+2]++] = S[2];
                l[z+3] = out[i4[z+3]++] = S[3];

                uint32_t F[4] = {
                    S[0]>>(TF_SHIFT_O1_FAST+8),
                    S[1]>>(TF_SHIFT_O1_FAST+8),
                    S[2]>>(TF_SHIFT_O1_FAST+8),
                    S[3]>>(TF_SHIFT_O1_FAST+8),
                };
                uint32_t B[4] = {
                    (S[0]>>8) & mask,
                    (S[1]>>8) & mask,
                    (S[2]>>8) & mask,
                    (S[3]>>8) & mask,
                };

                R[z+0] = F[0] * (R[z+0]>>TF_SHIFT_O1_FAST) + B[0];
                R[z+1] = F[1] * (R[z+1]>>TF_SHIFT_O1_FAST) + B[1];
                R[z+2] = F[2] * (R[z+2]>>TF_SHIFT_O1_FAST) + B[2];
                R[z+3] = F[3] * (R[z+3]>>TF_SHIFT_O1_FAST) + B[3];

                if (!low_ent && (ptr < ptr_end)) {
                    // branchless & asm
                    RansDecRenorm(&R[z+0], &ptr);
                    RansDecRenorm(&R[z+1], &ptr);
                    RansDecRenorm(&R[z+2], &ptr);
                    RansDecRenorm(&R[z+3], &ptr);
                } else {
                    // branched, but better when predictable
                    RansDecRenormSafe(&R[z+0], &ptr, ptr_end+2*NX);
                    RansDecRenormSafe(&R[z+1], &ptr, ptr_end+2*NX);
                    RansDecRenormSafe(&R[z+2], &ptr, ptr_end+2*NX);
                    RansDecRenormSafe(&R[z+3], &ptr, ptr_end+2*NX);
                }
            }
        }

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

    htscodecs_tls_free(sfb_);
    return out;

 err:
    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 $0x1218, %rsp           # imm = 0x1218
cmpl $0x80, %esi
setb %al
movl %ecx, 0x38(%rsp)
cmpl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
setae %cl
orb %al, %cl
jne 0x5ec12
movq %rdx, %rbx
movl %esi, %r12d
movq %rdi, %r15
movl $0x14b300, %edi         # imm = 0x14B300
callq 0x6412c
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x5ec12
movzbl (%r15), %eax
movl %eax, 0x10(%rsp)
andb $-0x10, %al
xorl %edx, %edx
cmpb $-0x40, %al
jne 0x5e0ba
movq 0x18(%rsp), %rcx
cmpq $0x101, %rdx            # imm = 0x101
je 0x5e0dc
movq %rcx, 0xa10(%rsp,%rdx,8)
incq %rdx
addq $0x10b3, %rcx           # imm = 0x10B3
jmp 0x5e09d
movq 0x18(%rsp), %rcx
cmpq $0x101, %rdx            # imm = 0x101
je 0x5e0dc
movq %rcx, 0xa10(%rsp,%rdx,8)
incq %rdx
addq $0x4b3, %rcx            # imm = 0x4B3
jmp 0x5e0bf
movq 0x1210(%rsp), %rcx
movq %rcx, 0x58(%rsp)
movl 0x38(%rsp), %edi
testq %rbx, %rbx
je 0x5e0f7
xorl %r14d, %r14d
jmp 0x5e111
movq %rdi, %rbx
callq 0x4680
movq %rbx, %rdi
movq %rax, %rbx
movq %rax, %r14
testq %rax, %rax
je 0x5ebfd
movq %rdi, 0x108(%rsp)
movq %rbx, 0x50(%rsp)
movl %r12d, %eax
movq %rax, 0x100(%rsp)
leaq (%r15,%rax), %r12
incq %r15
movq %r15, 0x8(%rsp)
testb $0x1, 0x10(%rsp)
jne 0x5e15b
movq %r14, 0x60(%rsp)
movq $0x0, 0x28(%rsp)
movq %r12, %rbx
movq $0x0, 0x70(%rsp)
jmp 0x5e1e2
leaq 0x610(%rsp), %rdx
movq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x5edb6
movslq %eax, %r13
addq %r15, %r13
leaq 0x210(%rsp), %r15
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x5edb6
cltq
addq %r13, %rax
movq %rax, %r13
movl (%r15), %r15d
movq %r12, %rax
subq %r13, %rax
cmpq %r15, %rax
jl 0x5ec00
movl 0x610(%rsp), %ebx
movq %r13, %rdi
movl %r15d, %esi
xorl %edx, %edx
movl %ebx, %ecx
callq 0x4f5f9
testq %rax, %rax
je 0x5ec00
movq %r14, 0x60(%rsp)
addq %r15, %r13
movq %r13, 0x28(%rsp)
addq %rax, %rbx
movq %rax, 0x70(%rsp)
movq %rax, 0x8(%rsp)
shrl $0x4, 0x10(%rsp)
leaq 0x610(%rsp), %r13
xorl %r14d, %r14d
movl $0x400, %edx            # imm = 0x400
movq %r13, %rdi
xorl %esi, %esi
callq 0x4260
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x5ef6e
testl %eax, %eax
je 0x5e421
cltq
addq 0x8(%rsp), %rax
movq %rax, 0x20(%rsp)
cmpq %rbx, %rax
jae 0x5e41e
movq 0x58(%rsp), %rax
testq %rax, %rax
movq 0x28(%rsp), %rdx
je 0x5e242
andw $0x0, 0x2(%rax)
movq 0x18(%rsp), %rax
andl $0x0, (%rax)
pushq $0x1
popq %rsi
movl 0x10(%rsp), %ecx
shll %cl, %esi
movl %esi, 0x48(%rsp)
xorl %ecx, %ecx
movq %rax, 0x40(%rsp)
cmpq $0x100, %rcx            # imm = 0x100
je 0x5eda5
cmpl $0x0, 0x610(%rsp,%rcx,4)
je 0x5e40d
movq %rcx, 0x30(%rsp)
movl $0x400, %edx            # imm = 0x400
leaq 0x210(%rsp), %rdi
xorl %esi, %esi
callq 0x4260
cmpq %rbx, 0x20(%rsp)
je 0x5e41e
xorl %r13d, %r13d
movq 0x20(%rsp), %r8
xorl %eax, %eax
xorl %ebp, %ebp
cmpq $0xff, %r13
ja 0x5e312
cmpq %rbx, %r8
jae 0x5e312
cmpl $0x0, 0x610(%rsp,%r13,4)
je 0x5e2fb
testl %eax, %eax
je 0x5e2cc
decl %eax
xorl %ecx, %ecx
jmp 0x5e2f1
movq %r8, %rdi
movq %rbx, %rsi
leaq 0x6c(%rsp), %rdx
movq %r8, %r14
callq 0x5edb6
movq %r14, %r8
cltq
addq %rax, %r8
movl 0x6c(%rsp), %ecx
xorl %eax, %eax
testl %ecx, %ecx
je 0x5e300
movl %ecx, 0x210(%rsp,%r13,4)
addl %ecx, %ebp
incq %r13
jmp 0x5e2a9
cmpq %rbx, %r8
jae 0x5e41e
movzbl (%r8), %eax
incq %r8
jmp 0x5e2c8
subq 0x20(%rsp), %r8
testl %r8d, %r8d
je 0x5e41e
testl %ebp, %ebp
je 0x5e3fb
leaq 0x210(%rsp), %rdi
movl %ebp, %esi
movl 0x48(%rsp), %edx
movq %r8, 0x78(%rsp)
callq 0x5d71a
movq 0x78(%rsp), %r8
xorl %ebp, %ebp
xorl %r15d, %r15d
cmpq $0x100, %rbp            # imm = 0x100
je 0x5e3f4
movl 0x210(%rsp,%rbp,4), %r13d
testq %r13, %r13
je 0x5e3bb
movl 0x48(%rsp), %eax
subl %r15d, %eax
cmpl %eax, %r13d
ja 0x5e41e
movslq %r15d, %rdi
cmpl $0xa, 0x10(%rsp)
je 0x5e3c0
cmpl $0xc, 0x10(%rsp)
jne 0x5e3b5
movq 0x30(%rsp), %r14
addq 0xa10(%rsp,%r14,8), %rdi
movl %ebp, %esi
movq %r13, %rdx
callq 0x4260
movq 0x78(%rsp), %r8
shlq $0xa, %r14
addq 0x58(%rsp), %r14
movw %r13w, (%r14,%rbp,4)
movw %r15w, 0x2(%r14,%rbp,4)
addl %r15d, %r13d
movl %r13d, %r15d
incq %rbp
jmp 0x5e34a
movl %r13d, %ecx
shll $0x12, %ecx
movl %ebp, %eax
orl %ecx, %eax
movq 0x40(%rsp), %rcx
leaq (%rcx,%rdi,4), %rcx
movq %r13, %rdx
shlq $0x8, %rdx
xorl %esi, %esi
cmpq %rsi, %rdx
je 0x5e3b5
movl %eax, %edi
orl %esi, %edi
movl %edi, (%rcx)
addq $0x4, %rcx
addq $0x100, %rsi            # imm = 0x100
jmp 0x5e3dc
cmpl %r15d, 0x48(%rsp)
jne 0x5e41e
movslq %r8d, %rax
addq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rcx
incq %rcx
addq $0x1000, 0x40(%rsp)     # imm = 0x1000
jmp 0x5e25e
xorl %r14d, %r14d
movq 0x28(%rsp), %rdx
movq 0x8(%rsp), %r15
addq %r14, %r15
testq %rdx, %rdx
cmovneq %rdx, %r15
movq 0x70(%rsp), %rdi
callq 0x45c0
movq %r12, %rax
movq %r15, 0x8(%rsp)
subq %r15, %rax
cmpq $0x80, %rax
jge 0x5e45c
movq 0x60(%rsp), %r14
jmp 0x5ec00
leaq -0x40(%r12), %rax
movq %rax, 0x40(%rsp)
xorl %eax, %eax
movq 0x60(%rsp), %r14
cmpq $0x80, %rax
je 0x5e496
movq 0x8(%rsp), %rcx
movl (%rcx,%rax), %ecx
movl %ecx, 0x80(%rsp,%rax)
cmpl $0x8000, %ecx           # imm = 0x8000
jb 0x5ec00
addq $0x4, %rax
jmp 0x5e46d
movl 0x38(%rsp), %ecx
shrl $0x5, %ecx
movl %ecx, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x180(%rsp)
movaps %xmm0, 0x170(%rsp)
movaps %xmm0, 0x160(%rsp)
movaps %xmm0, 0x150(%rsp)
movaps %xmm0, 0x140(%rsp)
movaps %xmm0, 0x130(%rsp)
movaps %xmm0, 0x120(%rsp)
movaps %xmm0, 0x110(%rsp)
addq %rax, 0x8(%rsp)
xorl %eax, %eax
xorl %ecx, %ecx
cmpq $0x20, %rcx
je 0x5e503
movl %eax, 0x190(%rsp,%rcx,4)
incq %rcx
addl 0x30(%rsp), %eax
jmp 0x5e4ed
cvtsi2sdq 0x100(%rsp), %xmm0
cvtsi2sdl 0x38(%rsp), %xmm1
mulsd 0x1e63d(%rip), %xmm1    # 0x7cb58
cmpl $0xc, 0x10(%rsp)
movq %r12, 0x10(%rsp)
pcmpeqd %xmm2, %xmm2
jne 0x5e8a7
movl 0x30(%rsp), %eax
cmpl %eax, 0x190(%rsp)
jge 0x5ec26
xorl %r8d, %r8d
cmpq $0x1f, %r8
ja 0x5e52f
movslq 0x110(%rsp,%r8,4), %rsi
movq 0xa10(%rsp,%rsi,8), %rax
movl 0x80(%rsp,%r8,4), %r13d
movl 0x84(%rsp,%r8,4), %r11d
movq %r13, %rcx
movl $0xfff, %edx            # imm = 0xFFF
andq %rdx, %rcx
movzbl (%rax,%rcx), %edi
movslq 0x114(%rsp,%r8,4), %r15
movq 0xa10(%rsp,%r15,8), %rax
movq %r11, %r14
andq %rdx, %r14
movl $0xfff, %r9d            # imm = 0xFFF
movzbl (%rax,%r14), %eax
movq %rax, 0x20(%rsp)
movslq 0x118(%rsp,%r8,4), %rbx
movq 0xa10(%rsp,%rbx,8), %rdx
movl 0x88(%rsp,%r8,4), %r10d
movq %r10, %rbp
andq %r9, %rbp
movzbl (%rdx,%rbp), %eax
movq %rax, 0x48(%rsp)
movslq 0x11c(%rsp,%r8,4), %r12
movq 0xa10(%rsp,%r12,8), %rax
shlq $0xa, %rsi
movq 0x58(%rsp), %rdx
addq %rdx, %rsi
movq %rdi, 0x38(%rsp)
movzwl (%rsi,%rdi,4), %r9d
shrl $0xc, %r13d
imull %r9d, %r13d
movl 0x8c(%rsp,%r8,4), %r9d
movzwl 0x2(%rsi,%rdi,4), %esi
subl %esi, %ecx
movq %r9, %rdi
movl $0xfff, %esi            # imm = 0xFFF
andq %rsi, %rdi
movzbl (%rax,%rdi), %esi
addl %r13d, %ecx
movl %ecx, 0x80(%rsp,%r8,4)
shlq $0xa, %r15
addq %rdx, %r15
movq 0x20(%rsp), %r13
movzwl (%r15,%r13,4), %eax
shrl $0xc, %r11d
imull %eax, %r11d
movzwl 0x2(%r15,%r13,4), %eax
subl %eax, %r14d
addl %r11d, %r14d
movl %r14d, 0x84(%rsp,%r8,4)
shlq $0xa, %rbx
addq %rdx, %rbx
movq 0x48(%rsp), %r15
movzwl (%rbx,%r15,4), %eax
shrl $0xc, %r10d
imull %eax, %r10d
movzwl 0x2(%rbx,%r15,4), %eax
subl %eax, %ebp
addl %r10d, %ebp
movl %ebp, 0x88(%rsp,%r8,4)
shlq $0xa, %r12
addq %rdx, %r12
movzwl (%r12,%rsi,4), %eax
shrl $0xc, %r9d
imull %eax, %r9d
movzwl 0x2(%r12,%rsi,4), %eax
subl %eax, %edi
addl %r9d, %edi
movl %edi, 0x8c(%rsp,%r8,4)
movq 0x38(%rsp), %rdx
movl %edx, 0x110(%rsp,%r8,4)
movl %r13d, 0x114(%rsp,%r8,4)
movl %r15d, 0x118(%rsp,%r8,4)
movl %esi, 0x11c(%rsp,%r8,4)
movdqa 0x190(%rsp,%r8,4), %xmm3
movslq 0x190(%rsp,%r8,4), %rax
movslq 0x194(%rsp,%r8,4), %r9
movslq 0x198(%rsp,%r8,4), %r10
movslq 0x19c(%rsp,%r8,4), %r11
movq 0x50(%rsp), %rbx
movb %dl, (%rbx,%rax)
movb %r13b, (%rbx,%r9)
movb %r15b, (%rbx,%r10)
psubd %xmm2, %xmm3
movdqa %xmm3, 0x190(%rsp,%r8,4)
movb %sil, (%rbx,%r11)
ucomisd %xmm0, %xmm1
ja 0x5e7ca
movq 0x8(%rsp), %rax
cmpq 0x40(%rsp), %rax
jae 0x5e7ca
movq 0x8(%rsp), %rsi
movzwl (%rsi), %eax
movl %ecx, %edx
shll $0x10, %edx
orl %eax, %edx
xorl %eax, %eax
cmpl $0x8000, %ecx           # imm = 0x8000
cmovbl %edx, %ecx
leaq 0x2(%rsi), %rax
cmovbq %rax, %rsi
movl %ecx, 0x80(%rsp,%r8,4)
movzwl (%rsi), %eax
movl %r14d, %edx
shll $0x10, %edx
orl %eax, %edx
xorl %eax, %eax
cmpl $0x8000, %r14d          # imm = 0x8000
cmovbl %edx, %r14d
leaq 0x2(%rsi), %rax
cmovbq %rax, %rsi
movl %r14d, 0x84(%rsp,%r8,4)
movzwl (%rsi), %eax
movl %ebp, %edx
shll $0x10, %edx
orl %eax, %edx
xorl %eax, %eax
cmpl $0x8000, %ebp           # imm = 0x8000
cmovbl %edx, %ebp
leaq 0x2(%rsi), %rax
cmovbq %rax, %rsi
movl %ebp, 0x88(%rsp,%r8,4)
movzwl (%rsi), %eax
movl %edi, %edx
shll $0x10, %edx
orl %eax, %edx
xorl %eax, %eax
cmpl $0x8000, %edi           # imm = 0x8000
cmovbl %edx, %edi
leaq 0x2(%rsi), %rax
cmovbq %rax, %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %r12
jmp 0x5e896
cmpl $0x7fff, %ecx           # imm = 0x7FFF
movq 0x10(%rsp), %r12
ja 0x5e802
movq 0x8(%rsp), %rax
incq %rax
cmpq %r12, %rax
jae 0x5e802
movq 0x8(%rsp), %rdx
movzwl (%rdx), %eax
shll $0x10, %ecx
orl %eax, %ecx
addq $0x2, %rdx
movq %rdx, 0x8(%rsp)
movl %ecx, 0x80(%rsp,%r8,4)
cmpl $0x7fff, %r14d          # imm = 0x7FFF
ja 0x5e838
movq 0x8(%rsp), %rax
incq %rax
cmpq %r12, %rax
jae 0x5e838
movq 0x8(%rsp), %rcx
movzwl (%rcx), %eax
shll $0x10, %r14d
orl %eax, %r14d
addq $0x2, %rcx
movq %rcx, 0x8(%rsp)
movl %r14d, 0x84(%rsp,%r8,4)
cmpl $0x7fff, %ebp           # imm = 0x7FFF
ja 0x5e86b
movq 0x8(%rsp), %rax
incq %rax
cmpq %r12, %rax
jae 0x5e86b
movq 0x8(%rsp), %rcx
movzwl (%rcx), %eax
shll $0x10, %ebp
orl %eax, %ebp
addq $0x2, %rcx
movq %rcx, 0x8(%rsp)
movl %ebp, 0x88(%rsp,%r8,4)
cmpl $0x7fff, %edi           # imm = 0x7FFF
ja 0x5e89e
movq 0x8(%rsp), %rax
incq %rax
cmpq %r12, %rax
jae 0x5e89e
movq 0x8(%rsp), %rcx
movzwl (%rcx), %eax
shll $0x10, %edi
orl %eax, %edi
addq $0x2, %rcx
movq %rcx, 0x8(%rsp)
movl %edi, 0x8c(%rsp,%r8,4)
addq $0x4, %r8
jmp 0x5e543
movl 0x30(%rsp), %eax
cmpl %eax, 0x190(%rsp)
jge 0x5ecd6
xorl %r9d, %r9d
cmpq $0x1f, %r9
ja 0x5e8a7
movslq 0x110(%rsp,%r9,4), %rax
movl 0x80(%rsp,%r9,4), %r13d
movl 0x84(%rsp,%r9,4), %ebp
movl %r13d, %ecx
movl $0x3ff, %esi            # imm = 0x3FF
andl %esi, %ecx
shlq $0xc, %rax
movq 0x18(%rsp), %r8
addq %r8, %rax
movl (%rax,%rcx,4), %edx
movslq 0x114(%rsp,%r9,4), %rax
movl %ebp, %ecx
andl %esi, %ecx
movl $0x3ff, %edi            # imm = 0x3FF
shlq $0xc, %rax
addq %r8, %rax
movl (%rax,%rcx,4), %esi
movslq 0x118(%rsp,%r9,4), %rax
movl 0x88(%rsp,%r9,4), %r11d
movl %r11d, %ecx
andl %edi, %ecx
shlq $0xc, %rax
addq %r8, %rax
movl (%rax,%rcx,4), %ecx
movslq 0x11c(%rsp,%r9,4), %rax
movl 0x8c(%rsp,%r9,4), %r10d
movl %r10d, %ebx
andl %edi, %ebx
shlq $0xc, %rax
addq %r8, %rax
movl (%rax,%rbx,4), %eax
movl %edx, %ebx
movl $0xff, %edi
andl %edi, %ebx
movl %esi, %r14d
andl %edi, %r14d
movl %ecx, %r12d
andl %edi, %r12d
movl %ebx, 0x110(%rsp,%r9,4)
movl %r14d, 0x114(%rsp,%r9,4)
movl %r12d, 0x118(%rsp,%r9,4)
movdqa 0x190(%rsp,%r9,4), %xmm3
movslq 0x190(%rsp,%r9,4), %r14
movslq 0x194(%rsp,%r9,4), %r15
movslq 0x198(%rsp,%r9,4), %r12
movslq 0x19c(%rsp,%r9,4), %rbx
movq 0x50(%rsp), %r8
movb %dl, (%r8,%r14)
movl %edx, %r14d
shrl $0x12, %r14d
shrl $0xa, %r13d
imull %r14d, %r13d
shrl $0x8, %edx
movl $0x3ff, %r14d           # imm = 0x3FF
andl %r14d, %edx
addl %edx, %r13d
movb %sil, (%r8,%r15)
movl %esi, %edx
shrl $0x12, %edx
shrl $0xa, %ebp
imull %edx, %ebp
shrl $0x8, %esi
andl %r14d, %esi
addl %esi, %ebp
movb %cl, (%r8,%r12)
movl %ecx, %edx
shrl $0x12, %edx
shrl $0xa, %r11d
imull %edx, %r11d
shrl $0x8, %ecx
andl %r14d, %ecx
movl $0x3ff, %edx            # imm = 0x3FF
addl %ecx, %r11d
movl %eax, %ecx
shrl $0x12, %ecx
shrl $0xa, %r10d
imull %ecx, %r10d
movl %eax, %ecx
shrl $0x8, %ecx
andl %edx, %ecx
addl %ecx, %r10d
psubd %xmm2, %xmm3
movdqa %xmm3, 0x190(%rsp,%r9,4)
movb %al, (%r8,%rbx)
movl $0xff, %ecx
andl %ecx, %eax
movl %eax, 0x11c(%rsp,%r9,4)
ucomisd %xmm0, %xmm1
movl %r13d, 0x80(%rsp,%r9,4)
movl %ebp, 0x84(%rsp,%r9,4)
movl %r11d, 0x88(%rsp,%r9,4)
movl %r10d, 0x8c(%rsp,%r9,4)
ja 0x5eb1a
movq 0x8(%rsp), %rax
cmpq 0x40(%rsp), %rax
jae 0x5eb1a
movq 0x8(%rsp), %rcx
movzwl (%rcx), %eax
movl %r13d, %edx
shll $0x10, %edx
orl %eax, %edx
xorl %eax, %eax
cmpl $0x8000, %r13d          # imm = 0x8000
cmovbl %edx, %r13d
leaq 0x2(%rcx), %rax
cmovbq %rax, %rcx
movl %r13d, 0x80(%rsp,%r9,4)
movzwl (%rcx), %eax
movl %ebp, %edx
shll $0x10, %edx
orl %eax, %edx
xorl %eax, %eax
cmpl $0x8000, %ebp           # imm = 0x8000
cmovbl %edx, %ebp
leaq 0x2(%rcx), %rax
cmovbq %rax, %rcx
movl %ebp, 0x84(%rsp,%r9,4)
movzwl (%rcx), %eax
movl %r11d, %edx
shll $0x10, %edx
orl %eax, %edx
xorl %eax, %eax
cmpl $0x8000, %r11d          # imm = 0x8000
cmovbl %edx, %r11d
leaq 0x2(%rcx), %rax
cmovbq %rax, %rcx
movl %r11d, 0x88(%rsp,%r9,4)
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
movq %rcx, 0x8(%rsp)
movq 0x10(%rsp), %r12
jmp 0x5ebec
cmpl $0x7fff, %r13d          # imm = 0x7FFF
movq 0x10(%rsp), %r12
ja 0x5eb55
movq 0x8(%rsp), %rax
incq %rax
cmpq %r12, %rax
jae 0x5eb55
movq 0x8(%rsp), %rcx
movzwl (%rcx), %eax
shll $0x10, %r13d
orl %eax, %r13d
addq $0x2, %rcx
movq %rcx, 0x8(%rsp)
movl %r13d, 0x80(%rsp,%r9,4)
cmpl $0x7fff, %ebp           # imm = 0x7FFF
ja 0x5eb88
movq 0x8(%rsp), %rax
incq %rax
cmpq %r12, %rax
jae 0x5eb88
movq 0x8(%rsp), %rcx
movzwl (%rcx), %eax
shll $0x10, %ebp
orl %eax, %ebp
addq $0x2, %rcx
movq %rcx, 0x8(%rsp)
movl %ebp, 0x84(%rsp,%r9,4)
cmpl $0x7fff, %r11d          # imm = 0x7FFF
ja 0x5ebbe
movq 0x8(%rsp), %rax
incq %rax
cmpq %r12, %rax
jae 0x5ebbe
movq 0x8(%rsp), %rcx
movzwl (%rcx), %eax
shll $0x10, %r11d
orl %eax, %r11d
addq $0x2, %rcx
movq %rcx, 0x8(%rsp)
movl %r11d, 0x88(%rsp,%r9,4)
cmpl $0x7fff, %r10d          # imm = 0x7FFF
ja 0x5ebf4
movq 0x8(%rsp), %rax
incq %rax
cmpq %r12, %rax
jae 0x5ebf4
movq 0x8(%rsp), %rcx
movzwl (%rcx), %eax
shll $0x10, %r10d
orl %eax, %r10d
addq $0x2, %rcx
movq %rcx, 0x8(%rsp)
movl %r10d, 0x8c(%rsp,%r9,4)
addq $0x4, %r9
jmp 0x5e8bb
xorl %r14d, %r14d
movq 0x18(%rsp), %rdi
callq 0x64291
movq %r14, %rdi
callq 0x45c0
xorl %eax, %eax
addq $0x1218, %rsp           # imm = 0x1218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x20c(%rsp), %eax
movl 0xfc(%rsp), %ecx
movl 0x18c(%rsp), %edx
cmpq 0x108(%rsp), %rax
jae 0x5ed91
movl %ecx, %esi
andl $0xfff, %esi            # imm = 0xFFF
movslq %edx, %rdi
movq 0xa10(%rsp,%rdi,8), %rdx
movzbl (%rdx,%rsi), %edx
movq 0x50(%rsp), %r8
movb %dl, (%r8,%rax)
shlq $0xa, %rdi
addq 0x58(%rsp), %rdi
movzwl (%rdi,%rdx,4), %r8d
shrl $0xc, %ecx
imull %r8d, %ecx
addl %esi, %ecx
movzwl 0x2(%rdi,%rdx,4), %esi
subl %esi, %ecx
movl %ecx, 0xfc(%rsp)
cmpl $0x7fff, %ecx           # imm = 0x7FFF
ja 0x5ecc0
movq 0x8(%rsp), %rsi
incq %rsi
cmpq %r12, %rsi
jae 0x5ecc0
movq 0x8(%rsp), %rdi
movzwl (%rdi), %esi
shll $0x10, %ecx
orl %esi, %ecx
addq $0x2, %rdi
movq %rdi, 0x8(%rsp)
movl %ecx, 0xfc(%rsp)
movl %edx, 0x18c(%rsp)
incq %rax
movl %eax, 0x20c(%rsp)
jmp 0x5ec3b
movslq 0x20c(%rsp), %rax
movl 0x18c(%rsp), %edi
movl 0xfc(%rsp), %esi
movq %rax, %rcx
addq 0x50(%rsp), %rcx
movl $0x3ff, %edx            # imm = 0x3FF
cmpl 0x38(%rsp), %eax
jae 0x5ed91
movslq %edi, %rdi
movl %esi, %r8d
andl %edx, %r8d
shlq $0xc, %rdi
addq 0x18(%rsp), %rdi
movl (%rdi,%r8,4), %r8d
movzbl %r8b, %edi
movl %edi, 0x18c(%rsp)
movb %dil, (%rcx)
movl %r8d, %r9d
shrl $0x12, %r9d
shrl $0xa, %esi
movl %esi, %r10d
imull %r9d, %r10d
shrl $0x8, %r8d
andl %edx, %r8d
movl %r8d, %esi
addl %r10d, %esi
movl %esi, 0xfc(%rsp)
cmpl $0x7fff, %esi           # imm = 0x7FFF
ja 0x5ed80
movq 0x8(%rsp), %r8
incq %r8
cmpq %r12, %r8
jae 0x5ed80
movq 0x8(%rsp), %r9
movzwl (%r9), %r8d
shll $0x10, %esi
orl %r8d, %esi
addq $0x2, %r9
movq %r9, 0x8(%rsp)
movl %esi, 0xfc(%rsp)
incl %eax
movl %eax, 0x20c(%rsp)
incq %rcx
jmp 0x5ecf9
movq 0x18(%rsp), %rdi
callq 0x64291
movq 0x50(%rsp), %rax
jmp 0x5ec14
movq 0x20(%rsp), %rax
subl 0x8(%rsp), %eax
movslq %eax, %r14
jmp 0x5e426