// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/htscodecs/htscodecs/rANS_static32x16pr_sse4.c
// Function: rans_uncompress_O0_32x16_sse4
unsigned char *rans_uncompress_O0_32x16_sse4(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, *out_free = NULL;
    unsigned char *cp_end = in + in_size;
    int i;
    uint32_t s3[TOTFREQ] __attribute__((aligned(32))); // For TF_SHIFT <= 12

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

    // Precompute reverse lookup of frequency.
    uint32_t F[256] = {0}, fsum;
    int fsz = decode_freq(cp, cp_end, F, &fsum);
    if (!fsz)
        goto err;
    cp += fsz;

    normalise_freq_shift(F, fsum, TOTFREQ);

    // Build symbols; fixme, do as part of decode, see the _d variant
    if (rans_F_to_s3(F, TF_SHIFT, s3))
        goto err;

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

    int z;
    RansState R[NX] __attribute__((aligned(32)));
    for (z = 0; z < NX; z++) {
        RansDecInit(&R[z], &cp);
        if (R[z] < RANS_BYTE_L)
            goto err;
    }

    uint16_t *sp = (uint16_t *)cp;

    int out_end = (out_sz&~(NX-1));
    const uint32_t mask = (1u << TF_SHIFT)-1;

    __m128i maskv  = _mm_set1_epi32(mask); // set mask in all lanes
    LOAD128(Rv, R);

    uint8_t overflow[72+64] = {0};
    for (i=0; i < out_end; i+=NX) {
        //for (z = 0; z < NX; z++)
        //  m[z] = R[z] & mask;
        __m128i masked1 = _mm_and_si128(Rv1, maskv);
        __m128i masked2 = _mm_and_si128(Rv2, maskv);
        __m128i masked3 = _mm_and_si128(Rv3, maskv);
        __m128i masked4 = _mm_and_si128(Rv4, maskv);

        //  S[z] = s3[m[z]];
        __m128i Sv1 = _mm_i32gather_epi32x((int *)s3, masked1, sizeof(*s3));
        __m128i Sv2 = _mm_i32gather_epi32x((int *)s3, masked2, sizeof(*s3));
        __m128i Sv3 = _mm_i32gather_epi32x((int *)s3, masked3, sizeof(*s3));
        __m128i Sv4 = _mm_i32gather_epi32x((int *)s3, masked4, sizeof(*s3));

        //  f[z] = S[z]>>(TF_SHIFT+8);
        __m128i fv1 = _mm_srli_epi32(Sv1, TF_SHIFT+8);
        __m128i fv2 = _mm_srli_epi32(Sv2, TF_SHIFT+8);
        __m128i fv3 = _mm_srli_epi32(Sv3, TF_SHIFT+8);
        __m128i fv4 = _mm_srli_epi32(Sv4, TF_SHIFT+8);

        //  b[z] = (S[z]>>8) & mask;
        __m128i bv1 = _mm_and_si128(_mm_srli_epi32(Sv1, 8), maskv);
        __m128i bv2 = _mm_and_si128(_mm_srli_epi32(Sv2, 8), maskv);
        __m128i bv3 = _mm_and_si128(_mm_srli_epi32(Sv3, 8), maskv);
        __m128i bv4 = _mm_and_si128(_mm_srli_epi32(Sv4, 8), maskv);

        //  s[z] = S[z] & 0xff;
        __m128i sv1 = _mm_and_si128(Sv1, _mm_set1_epi32(0xff));
        __m128i sv2 = _mm_and_si128(Sv2, _mm_set1_epi32(0xff));
        __m128i sv3 = _mm_and_si128(Sv3, _mm_set1_epi32(0xff));
        __m128i sv4 = _mm_and_si128(Sv4, _mm_set1_epi32(0xff));

        //  R[z] = f[z] * (R[z] >> TF_SHIFT) + b[z];
        Rv1 = _mm_add_epi32(
                  _mm_mullo_epi32(
                      _mm_srli_epi32(Rv1,TF_SHIFT), fv1), bv1);
        Rv2 = _mm_add_epi32(
                  _mm_mullo_epi32(
                      _mm_srli_epi32(Rv2,TF_SHIFT), fv2), bv2);
        Rv3 = _mm_add_epi32(
                  _mm_mullo_epi32(
                      _mm_srli_epi32(Rv3,TF_SHIFT), fv3), bv3);
        Rv4 = _mm_add_epi32(
                  _mm_mullo_epi32(
                      _mm_srli_epi32(Rv4,TF_SHIFT), fv4), bv4);

        // Tricky one:  out[i+z] = s[z];
        //             ---d---c ---b---a  sv1
        //             ---h---g ---f---e  sv2
        // packs_epi32 -h-g-f-e -d-c-b-a  sv1(2)
        // packs_epi16 ponmlkji hgfedcba  sv1(2) / sv3(4)
        sv1 = _mm_packus_epi32(sv1, sv2);
        sv3 = _mm_packus_epi32(sv3, sv4);
        sv1 = _mm_packus_epi16(sv1, sv3);

        // c =  R[z] < RANS_BYTE_L;
        // A little tricky as we only have signed comparisons.
        // See https://stackoverflow.com/questions/32945410/sse2-intrinsics-comparing-unsigned-integers

#define _mm_cmplt_epu32_imm(a,b) _mm_andnot_si128(_mm_cmpeq_epi32(_mm_max_epu32((a),_mm_set1_epi32(b)), (a)), _mm_set1_epi32(-1));

//#define _mm_cmplt_epu32_imm(a,b) _mm_cmpgt_epi32(_mm_set1_epi32((b)-0x80000000), _mm_xor_si128((a), _mm_set1_epi32(0x80000000)))

        __m128i renorm_mask1, renorm_mask2, renorm_mask3, renorm_mask4;
        renorm_mask1 = _mm_cmplt_epu32_imm(Rv1, RANS_BYTE_L);
        renorm_mask2 = _mm_cmplt_epu32_imm(Rv2, RANS_BYTE_L);
        renorm_mask3 = _mm_cmplt_epu32_imm(Rv3, RANS_BYTE_L);
        renorm_mask4 = _mm_cmplt_epu32_imm(Rv4, RANS_BYTE_L);

//#define P(A,B,C,D) ((A)+((B)<<2) + ((C)<<4) + ((D)<<6))
#define P(A,B,C,D)                              \
        { A+0,A+1,A+2,A+3,                      \
          B+0,B+1,B+2,B+3,                      \
          C+0,C+1,C+2,C+3,                      \
          D+0,D+1,D+2,D+3}
#ifdef _
#undef _
#endif
#define _ 0x80
        uint8_t pidx[16][16] = {
            P(_,_,_,_),
            P(0,_,_,_),
            P(_,0,_,_),
            P(0,4,_,_),

            P(_,_,0,_),
            P(0,_,4,_),
            P(_,0,4,_),
            P(0,4,8,_),

            P(_,_,_,0),
            P(0,_,_,4),
            P(_,0,_,4),
            P(0,4,_,8),

            P(_,_,0,4),
            P(0,_,4,8),
            P(_,0,4,8),
            P(0,4,8,12),
        };
#undef _

        // Protect against running off the end of in buffer.
        // We copy it to a worst-case local buffer when near the end.
        // 72 = 7*8(imask1..7) + 16;  worse case for 8th _mm_loadu_si128 call.
        // An extra 64 bytes is to avoid triggering this multiple times
        // after we swap sp/cp_end over.
        if ((uint8_t *)sp+72 > cp_end) {
            memmove(overflow, sp, cp_end - (uint8_t *)sp);
            sp = (uint16_t *)overflow;
            cp_end = (uint8_t *)overflow + sizeof(overflow);
        }

        // Shuffle the renorm values to correct lanes and incr sp pointer
        __m128i Vv1 = _mm_cvtepu16_epi32(_mm_loadu_si128((__m128i *)sp));
        unsigned int imask1 = _mm_movemask_ps((__m128)renorm_mask1);
        Vv1 = _mm_shuffle_epi8(Vv1, _mm_load_si128((__m128i*)pidx[imask1]));
        sp += _mm_popcnt_u32(imask1);

        __m128i Vv2 = _mm_cvtepu16_epi32(_mm_loadu_si128((__m128i *)sp));
        unsigned int imask2 = _mm_movemask_ps((__m128)renorm_mask2);
        sp += _mm_popcnt_u32(imask2);
        Vv2 = _mm_shuffle_epi8(Vv2, _mm_load_si128((__m128i*)pidx[imask2]));

        __m128i Vv3 = _mm_cvtepu16_epi32(_mm_loadu_si128((__m128i *)sp));
        unsigned int imask3 = _mm_movemask_ps((__m128)renorm_mask3);
        Vv3 = _mm_shuffle_epi8(Vv3, _mm_load_si128((__m128i*)pidx[imask3]));
        sp += _mm_popcnt_u32(imask3);

        __m128i Vv4 = _mm_cvtepu16_epi32(_mm_loadu_si128((__m128i *)sp));
        unsigned int imask4 = _mm_movemask_ps((__m128)renorm_mask4);
        sp += _mm_popcnt_u32(imask4);
        Vv4 = _mm_shuffle_epi8(Vv4, _mm_load_si128((__m128i*)pidx[imask4]));

        __m128i Yv1 = _mm_slli_epi32(Rv1, 16);
        __m128i Yv2 = _mm_slli_epi32(Rv2, 16);
        __m128i Yv3 = _mm_slli_epi32(Rv3, 16);
        __m128i Yv4 = _mm_slli_epi32(Rv4, 16);

        // y = (R[z] << 16) | V[z];
        Yv1 = _mm_or_si128(Yv1, Vv1);
        Yv2 = _mm_or_si128(Yv2, Vv2);
        Yv3 = _mm_or_si128(Yv3, Vv3);
        Yv4 = _mm_or_si128(Yv4, Vv4);

        // R[z] = c ? Y[z] : R[z];
        Rv1 = _mm_blendv_epi8(Rv1, Yv1, renorm_mask1);
        Rv2 = _mm_blendv_epi8(Rv2, Yv2, renorm_mask2);
        Rv3 = _mm_blendv_epi8(Rv3, Yv3, renorm_mask3);
        Rv4 = _mm_blendv_epi8(Rv4, Yv4, renorm_mask4);

        // ------------------------------------------------------------

        //  m[z] = R[z] & mask;
        __m128i masked5 = _mm_and_si128(Rv5, maskv);
        __m128i masked6 = _mm_and_si128(Rv6, maskv);
        __m128i masked7 = _mm_and_si128(Rv7, maskv);
        __m128i masked8 = _mm_and_si128(Rv8, maskv);

        //  S[z] = s3[m[z]];
        __m128i Sv5 = _mm_i32gather_epi32x((int *)s3, masked5, sizeof(*s3));
        __m128i Sv6 = _mm_i32gather_epi32x((int *)s3, masked6, sizeof(*s3));
        __m128i Sv7 = _mm_i32gather_epi32x((int *)s3, masked7, sizeof(*s3));
        __m128i Sv8 = _mm_i32gather_epi32x((int *)s3, masked8, sizeof(*s3));

        //  f[z] = S[z]>>(TF_SHIFT+8);
        __m128i fv5 = _mm_srli_epi32(Sv5, TF_SHIFT+8);
        __m128i fv6 = _mm_srli_epi32(Sv6, TF_SHIFT+8);
        __m128i fv7 = _mm_srli_epi32(Sv7, TF_SHIFT+8);
        __m128i fv8 = _mm_srli_epi32(Sv8, TF_SHIFT+8);

        //  b[z] = (S[z]>>8) & mask;
        __m128i bv5 = _mm_and_si128(_mm_srli_epi32(Sv5, 8), maskv);
        __m128i bv6 = _mm_and_si128(_mm_srli_epi32(Sv6, 8), maskv);
        __m128i bv7 = _mm_and_si128(_mm_srli_epi32(Sv7, 8), maskv);
        __m128i bv8 = _mm_and_si128(_mm_srli_epi32(Sv8, 8), maskv);

        //  s[z] = S[z] & 0xff;
        __m128i sv5 = _mm_and_si128(Sv5, _mm_set1_epi32(0xff));
        __m128i sv6 = _mm_and_si128(Sv6, _mm_set1_epi32(0xff));
        __m128i sv7 = _mm_and_si128(Sv7, _mm_set1_epi32(0xff));
        __m128i sv8 = _mm_and_si128(Sv8, _mm_set1_epi32(0xff));

        //  R[z] = f[z] * (R[z] >> TF_SHIFT) + b[z];
        Rv5 = _mm_add_epi32(
                  _mm_mullo_epi32(
                      _mm_srli_epi32(Rv5,TF_SHIFT), fv5), bv5);
        Rv6 = _mm_add_epi32(
                  _mm_mullo_epi32(
                      _mm_srli_epi32(Rv6,TF_SHIFT), fv6), bv6);
        Rv7 = _mm_add_epi32(
                  _mm_mullo_epi32(
                      _mm_srli_epi32(Rv7,TF_SHIFT), fv7), bv7);
        Rv8 = _mm_add_epi32(
                  _mm_mullo_epi32(
                      _mm_srli_epi32(Rv8,TF_SHIFT), fv8), bv8);

        // Tricky one:  out[i+z] = s[z];
        //             ---d---c ---b---a  sv1
        //             ---h---g ---f---e  sv2
        // packs_epi32 -h-g-f-e -d-c-b-a  sv1(2)
        // packs_epi16 ponmlkji hgfedcba  sv1(2) / sv3(4)
        sv5 = _mm_packus_epi32(sv5, sv6);
        sv7 = _mm_packus_epi32(sv7, sv8);
        sv5 = _mm_packus_epi16(sv5, sv7);

        // c =  R[z] < RANS_BYTE_L;
        __m128i renorm_mask5, renorm_mask6, renorm_mask7, renorm_mask8;
        renorm_mask5 = _mm_cmplt_epu32_imm(Rv5, RANS_BYTE_L);
        renorm_mask6 = _mm_cmplt_epu32_imm(Rv6, RANS_BYTE_L);
        renorm_mask7 = _mm_cmplt_epu32_imm(Rv7, RANS_BYTE_L);
        renorm_mask8 = _mm_cmplt_epu32_imm(Rv8, RANS_BYTE_L);
        
        // Shuffle the renorm values to correct lanes and incr sp pointer
        __m128i Vv5 = _mm_cvtepu16_epi32(_mm_loadu_si128((__m128i *)sp));
        unsigned int imask5 = _mm_movemask_ps((__m128)renorm_mask5);
        Vv5 = _mm_shuffle_epi8(Vv5, _mm_load_si128((__m128i*)pidx[imask5]));
        sp += _mm_popcnt_u32(imask5);

        __m128i Vv6 = _mm_cvtepu16_epi32(_mm_loadu_si128((__m128i *)sp));
        unsigned int imask6 = _mm_movemask_ps((__m128)renorm_mask6);
        sp += _mm_popcnt_u32(imask6);
        Vv6 = _mm_shuffle_epi8(Vv6, _mm_load_si128((__m128i*)pidx[imask6]));

        __m128i Vv7 = _mm_cvtepu16_epi32(_mm_loadu_si128((__m128i *)sp));
        unsigned int imask7 = _mm_movemask_ps((__m128)renorm_mask7);
        Vv7 = _mm_shuffle_epi8(Vv7, _mm_load_si128((__m128i*)pidx[imask7]));
        sp += _mm_popcnt_u32(imask7);

        __m128i Vv8 = _mm_cvtepu16_epi32(_mm_loadu_si128((__m128i *)sp));
        unsigned int imask8 = _mm_movemask_ps((__m128)renorm_mask8);
        sp += _mm_popcnt_u32(imask8);
        Vv8 = _mm_shuffle_epi8(Vv8, _mm_load_si128((__m128i*)pidx[imask8]));

        __m128i Yv5 = _mm_slli_epi32(Rv5, 16);
        __m128i Yv6 = _mm_slli_epi32(Rv6, 16);
        __m128i Yv7 = _mm_slli_epi32(Rv7, 16);
        __m128i Yv8 = _mm_slli_epi32(Rv8, 16);

        // y = (R[z] << 16) | V[z];
        Yv5 = _mm_or_si128(Yv5, Vv5);
        Yv6 = _mm_or_si128(Yv6, Vv6);
        Yv7 = _mm_or_si128(Yv7, Vv7);
        Yv8 = _mm_or_si128(Yv8, Vv8);

        // R[z] = c ? Y[z] : R[z];
        Rv5 = _mm_blendv_epi8(Rv5, Yv5, renorm_mask5);
        Rv6 = _mm_blendv_epi8(Rv6, Yv6, renorm_mask6);
        Rv7 = _mm_blendv_epi8(Rv7, Yv7, renorm_mask7);
        Rv8 = _mm_blendv_epi8(Rv8, Yv8, renorm_mask8);

        // Maybe just a store128 instead?
        _mm_storeu_si128((__m128i *)&out[i+ 0], sv1);
        _mm_storeu_si128((__m128i *)&out[i+16], sv5);
//      *(uint64_t *)&out[i+ 0] = _mm_extract_epi64(sv1, 0);
//      *(uint64_t *)&out[i+ 8] = _mm_extract_epi64(sv1, 1);
//      *(uint64_t *)&out[i+16] = _mm_extract_epi64(sv5, 0);
//      *(uint64_t *)&out[i+24] = _mm_extract_epi64(sv5, 1);
    }

    STORE128(Rv, R);

    for (z = out_sz & (NX-1); z-- > 0; )
      out[out_end + z] = s3[R[z] & mask];

    //fprintf(stderr, "    0 Decoded %d bytes\n", (int)(cp-in)); //c-size

    return out;

 err:
    free(out_free);
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
andq $-0x20, %rsp
subq $0x45e0, %rsp           # imm = 0x45E0
movl %ecx, %r15d
cmpl $0x10, %esi
setb %al
cmpl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
setae %cl
orb %al, %cl
jne 0x746d8
movl %esi, %r13d
movq %rdi, %r14
testq %rdx, %rdx
je 0x73c42
xorl %r12d, %r12d
jmp 0x73c50
movl %r15d, %edi
callq 0x4680
movq %rax, %r12
movq %rax, %rdx
xorl %ebx, %ebx
testq %rdx, %rdx
je 0x746d8
movq %r15, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
movl %r13d, %eax
movq %rax, (%rsp)
leaq (%r14,%rax), %r15
leaq 0x1c0(%rsp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x4260
testl %r13d, %r13d
je 0x73e0a
leaq 0x1(%r14), %rax
movzbl (%r14), %ecx
xorl %edx, %edx
cmpl $0x4, %r13d
jb 0x73ceb
xorl %ebx, %ebx
xorl %edx, %edx
movl %ecx, %esi
movl $0x1, 0x1c0(%rsp,%rsi,4)
testl %edx, %edx
je 0x73cc4
cmpl $0xfe, %ecx
jg 0x73d47
decl %edx
incl %ecx
jmp 0x73cde
movl %ecx, %edx
incl %edx
movzbl (%rax), %ecx
cmpl %ecx, %edx
jne 0x73cd9
movzbl 0x1(%rax), %edx
addq $0x2, %rax
jmp 0x73cde
incq %rax
xorl %edx, %edx
testl %ecx, %ecx
je 0x73ceb
leaq 0x2(%rax), %rsi
cmpq %r15, %rsi
jb 0x73ca1
testl %ecx, %ecx
je 0x73d41
xorl %ebx, %ebx
movl %ecx, %esi
movl $0x1, 0x1c0(%rsp,%rsi,4)
cmpq %r15, %rax
jae 0x73d47
testl %edx, %edx
je 0x73d15
cmpl $0xfe, %ecx
jg 0x73d47
decl %edx
incl %ecx
jmp 0x73d38
movl %ecx, %edi
incl %edi
movzbl (%rax), %ecx
leaq 0x1(%rax), %rsi
xorl %edx, %edx
cmpl %ecx, %edi
jne 0x73d35
cmpq %r15, %rsi
jae 0x73d47
movzbl 0x1(%rax), %edx
addq $0x2, %rax
jmp 0x73d38
movq %rsi, %rax
testl %ecx, %ecx
je 0x73d41
cmpq %r15, %rax
jb 0x73cf1
subl %r14d, %eax
movslq %eax, %rbx
addq %r14, %rbx
xorl %ecx, %ecx
xorl %eax, %eax
cmpl $0x0, 0x1c0(%rsp,%rcx,4)
je 0x73dcd
movq %r15, %rdx
subq %rbx, %rdx
cmpq $0x6, %rdx
jl 0x73d9c
xorl %edi, %edi
xorl %edx, %edx
movzbl (%rbx,%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 0x73d8b
cmpl $0x5, %edi
movq %rsi, %rdi
jne 0x73d68
addq %rbx, %rsi
movl %edx, 0x1c0(%rsp,%rcx,4)
subl %ebx, %esi
movslq %esi, %rdx
jmp 0x73dc3
cmpq %r15, %rbx
jae 0x73db6
movsbl (%rbx), %edx
testl %edx, %edx
js 0x73ddf
movl %edx, 0x1c0(%rsp,%rcx,4)
movl $0x1, %edx
jmp 0x73dc3
movl $0x0, 0x1c0(%rsp,%rcx,4)
xorl %edx, %edx
addq %rdx, %rbx
addl 0x1c0(%rsp,%rcx,4), %eax
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x73d4e
jmp 0x73e05
xorl %edx, %edx
movq %rbx, %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 0x73d8e
cmpq %r15, %rsi
jb 0x73de4
jmp 0x73d8e
subl %r14d, %ebx
jmp 0x73e0a
testl %ebx, %ebx
je 0x746d0
movslq %ebx, %rdx
testl $0xffffefff, %eax       # imm = 0xFFFFEFFF
je 0x73e49
xorl %ecx, %ecx
cmpl $0xfff, %eax            # imm = 0xFFF
ja 0x73e35
xorl %ecx, %ecx
leal (%rax,%rax), %esi
incl %ecx
cmpl $0x800, %eax            # imm = 0x800
movl %esi, %eax
jb 0x73e27
xorl %eax, %eax
shll %cl, 0x1c0(%rsp,%rax,4)
incq %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0x73e37
addq %rdx, %r14
xorl %eax, %eax
xorl %ecx, %ecx
movl 0x1c0(%rsp,%rax,4), %esi
movl $0x1000, %edi           # imm = 0x1000
subl %ecx, %edi
leal -0x1(%rsi), %r8d
cmpl %edi, %r8d
jae 0x73e88
testl %esi, %esi
je 0x73e88
movl %esi, %edi
shll $0x14, %edi
addl %eax, %edi
movslq %ecx, %rcx
movl %edi, 0x5c0(%rsp,%rcx,4)
incl %ecx
addl $0x100, %edi            # imm = 0x100
decl %esi
jne 0x73e72
incq %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0x73e50
cmpl $0x1000, %ecx           # imm = 0x1000
jne 0x746d0
movq (%rsp), %rax
subq %rdx, %rax
cmpq $0x80, %rax
jl 0x746d0
xorl %ebx, %ebx
movl (%r14,%rbx), %eax
movl %eax, 0xa0(%rsp,%rbx)
cmpl $0x8000, %eax           # imm = 0x8000
jb 0x746d0
addq $0x4, %rbx
cmpq $0x80, %rbx
jne 0x73eb4
movq 0x18(%rsp), %r13
andl $0x7fffffe0, %r13d      # imm = 0x7FFFFFE0
movaps 0xa0(%rsp), %xmm0
movaps %xmm0, (%rsp)
movaps 0xb0(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
movaps 0xc0(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movaps 0xd0(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movaps 0xe0(%rsp), %xmm0
movaps %xmm0, 0x80(%rsp)
movaps 0xf0(%rsp), %xmm0
movaps %xmm0, 0x70(%rsp)
movaps 0x100(%rsp), %xmm0
movaps %xmm0, 0x60(%rsp)
movaps 0x110(%rsp), %xmm0
movaps %xmm0, 0x50(%rsp)
leaq 0x130(%rsp), %rdi
movl $0x88, %edx
xorl %esi, %esi
callq 0x4260
testl %r13d, %r13d
je 0x746ed
addq %rbx, %r14
movq %r13, 0x98(%rsp)
movl %r13d, %r9d
xorl %r13d, %r13d
pmovsxwd 0x2edeb(%rip), %xmm13   # 0xa2d70
pmovzxbd 0x2edfa(%rip), %xmm6    # 0xa2d88
leaq 0x2edfb(%rip), %rbx     # 0xa2d90
movq 0x10(%rsp), %r8
movdqa 0x80(%rsp), %xmm9
movdqa 0x70(%rsp), %xmm10
movdqa 0x60(%rsp), %xmm11
movdqa 0x50(%rsp), %xmm12
movdqa (%rsp), %xmm5
movdqa 0x40(%rsp), %xmm14
movdqa 0x30(%rsp), %xmm15
movdqa 0x20(%rsp), %xmm8
movdqa %xmm5, %xmm0
pand %xmm13, %xmm0
pextrd $0x3, %xmm0, %eax
pextrd $0x2, %xmm0, %ecx
pextrd $0x1, %xmm0, %edx
movd %xmm0, %esi
movd 0x5c0(%rsp,%rsi,4), %xmm7
pinsrd $0x1, 0x5c0(%rsp,%rdx,4), %xmm7
pinsrd $0x2, 0x5c0(%rsp,%rcx,4), %xmm7
pinsrd $0x3, 0x5c0(%rsp,%rax,4), %xmm7
movdqa %xmm14, %xmm0
pand %xmm13, %xmm0
pextrd $0x3, %xmm0, %eax
pextrd $0x2, %xmm0, %ecx
pextrd $0x1, %xmm0, %edx
movd %xmm0, %esi
movd 0x5c0(%rsp,%rsi,4), %xmm0
pinsrd $0x1, 0x5c0(%rsp,%rdx,4), %xmm0
pinsrd $0x2, 0x5c0(%rsp,%rcx,4), %xmm0
pinsrd $0x3, 0x5c0(%rsp,%rax,4), %xmm0
movdqa %xmm15, %xmm1
pand %xmm13, %xmm1
pextrd $0x3, %xmm1, %eax
pextrd $0x2, %xmm1, %ecx
pextrd $0x1, %xmm1, %edx
movd %xmm1, %esi
movd 0x5c0(%rsp,%rsi,4), %xmm1
pinsrd $0x1, 0x5c0(%rsp,%rdx,4), %xmm1
pinsrd $0x2, 0x5c0(%rsp,%rcx,4), %xmm1
pinsrd $0x3, 0x5c0(%rsp,%rax,4), %xmm1
movdqa %xmm8, %xmm2
pand %xmm13, %xmm2
pextrd $0x3, %xmm2, %eax
pextrd $0x2, %xmm2, %ecx
pextrd $0x1, %xmm2, %edx
movd %xmm2, %esi
movd 0x5c0(%rsp,%rsi,4), %xmm2
pinsrd $0x1, 0x5c0(%rsp,%rdx,4), %xmm2
pinsrd $0x2, 0x5c0(%rsp,%rcx,4), %xmm2
pinsrd $0x3, 0x5c0(%rsp,%rax,4), %xmm2
movdqa %xmm7, %xmm3
psrld $0x14, %xmm3
psrld $0xc, %xmm5
movdqa %xmm5, %xmm4
pmulld %xmm3, %xmm4
movdqa %xmm7, %xmm3
psrld $0x8, %xmm3
pand %xmm13, %xmm3
movdqa %xmm3, %xmm5
paddd %xmm4, %xmm5
movdqa %xmm0, %xmm3
psrld $0x14, %xmm3
psrld $0xc, %xmm14
movdqa %xmm14, %xmm4
pmulld %xmm3, %xmm4
movdqa %xmm0, %xmm14
psrld $0x8, %xmm14
pand %xmm13, %xmm14
paddd %xmm4, %xmm14
movdqa %xmm1, %xmm3
psrld $0x14, %xmm3
psrld $0xc, %xmm15
movdqa %xmm15, %xmm4
pmulld %xmm3, %xmm4
movdqa %xmm1, %xmm15
psrld $0x8, %xmm15
pand %xmm13, %xmm15
paddd %xmm4, %xmm15
movdqa %xmm2, %xmm3
psrld $0x14, %xmm3
psrld $0xc, %xmm8
movdqa %xmm8, %xmm4
pmulld %xmm3, %xmm4
movdqa %xmm2, %xmm3
psrld $0x8, %xmm3
pand %xmm13, %xmm3
movdqa %xmm3, %xmm8
paddd %xmm4, %xmm8
pand %xmm6, %xmm7
pand %xmm6, %xmm0
packusdw %xmm0, %xmm7
pand %xmm6, %xmm1
pand %xmm6, %xmm2
packusdw %xmm2, %xmm1
packuswb %xmm1, %xmm7
movdqa %xmm7, 0x120(%rsp)
leaq 0x48(%r14), %rax
cmpq %r15, %rax
movdqa %xmm5, (%rsp)
jbe 0x74289
subq %r14, %r15
leaq 0x130(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
movdqa %xmm9, 0x80(%rsp)
movdqa %xmm10, 0x70(%rsp)
movdqa %xmm11, 0x60(%rsp)
movdqa %xmm12, 0x50(%rsp)
movdqa %xmm14, 0x40(%rsp)
movdqa %xmm15, 0x30(%rsp)
movdqa %xmm8, 0x20(%rsp)
movq %r9, %r14
callq 0x4830
movq %r14, %r9
movdqa 0x20(%rsp), %xmm8
movdqa 0x30(%rsp), %xmm15
movdqa 0x40(%rsp), %xmm14
movdqa (%rsp), %xmm5
movdqa 0x50(%rsp), %xmm12
movdqa 0x60(%rsp), %xmm11
movdqa 0x70(%rsp), %xmm10
movdqa 0x80(%rsp), %xmm9
movq 0x10(%rsp), %r8
movq %r12, %r14
leaq 0x1b8(%rsp), %r15
pmovzxwd (%r14), %xmm4
movdqa %xmm5, %xmm0
pmovsxwd 0x2eadc(%rip), %xmm1    # 0xa2d78
pminud %xmm1, %xmm0
movdqa %xmm1, %xmm2
pcmpeqd %xmm5, %xmm0
movmskps %xmm0, %eax
popcntl %eax, %ecx
shll $0x4, %eax
pshufb (%rax,%rbx), %xmm4
leaq (%r14,%rcx,2), %rax
pmovzxwd (%rax), %xmm5
movdqa %xmm14, %xmm1
pminud %xmm2, %xmm1
movdqa %xmm2, %xmm13
pcmpeqd %xmm14, %xmm1
movmskps %xmm1, %ecx
popcntl %ecx, %edx
leaq (%rax,%rdx,2), %rax
shll $0x4, %ecx
pshufb (%rcx,%rbx), %xmm5
pmovzxwd (%rax), %xmm7
movdqa %xmm15, %xmm2
pminud %xmm13, %xmm2
pcmpeqd %xmm15, %xmm2
movmskps %xmm2, %ecx
popcntl %ecx, %edx
shll $0x4, %ecx
pshufb (%rcx,%rbx), %xmm7
leaq (%rax,%rdx,2), %rax
pmovzxwd (%rax), %xmm6
movdqa %xmm8, %xmm3
pminud %xmm13, %xmm3
pcmpeqd %xmm8, %xmm3
movmskps %xmm3, %edx
popcntl %edx, %ecx
shll $0x4, %edx
pshufb (%rdx,%rbx), %xmm6
movdqa %xmm8, %xmm13
movdqa (%rsp), %xmm8
pslld $0x10, %xmm8
por %xmm4, %xmm8
movdqa %xmm14, %xmm4
pslld $0x10, %xmm4
por %xmm5, %xmm4
movdqa %xmm15, %xmm5
pslld $0x10, %xmm5
por %xmm7, %xmm5
movaps (%rsp), %xmm7
blendvps %xmm0, %xmm8, %xmm7
movaps %xmm7, (%rsp)
movdqa %xmm13, %xmm8
movdqa %xmm13, %xmm7
movaps %xmm1, %xmm0
blendvps %xmm0, %xmm4, %xmm14
pslld $0x10, %xmm7
movaps %xmm2, %xmm0
blendvps %xmm0, %xmm5, %xmm15
por %xmm6, %xmm7
movaps %xmm3, %xmm0
blendvps %xmm0, %xmm7, %xmm8
movdqa %xmm9, %xmm0
pmovsxwd 0x2e9bb(%rip), %xmm13   # 0xa2d70
pand %xmm13, %xmm0
pextrd $0x3, %xmm0, %edx
pextrd $0x2, %xmm0, %esi
movd %xmm0, %edi
movd 0x5c0(%rsp,%rdi,4), %xmm1
pextrd $0x1, %xmm0, %edi
pinsrd $0x1, 0x5c0(%rsp,%rdi,4), %xmm1
pinsrd $0x2, 0x5c0(%rsp,%rsi,4), %xmm1
pinsrd $0x3, 0x5c0(%rsp,%rdx,4), %xmm1
movdqa %xmm10, %xmm0
pand %xmm13, %xmm0
pextrd $0x3, %xmm0, %edx
pextrd $0x2, %xmm0, %esi
movd %xmm0, %edi
movd 0x5c0(%rsp,%rdi,4), %xmm2
pextrd $0x1, %xmm0, %edi
pinsrd $0x1, 0x5c0(%rsp,%rdi,4), %xmm2
pinsrd $0x2, 0x5c0(%rsp,%rsi,4), %xmm2
pinsrd $0x3, 0x5c0(%rsp,%rdx,4), %xmm2
movdqa %xmm11, %xmm0
pand %xmm13, %xmm0
pextrd $0x3, %xmm0, %edx
pextrd $0x2, %xmm0, %esi
movd %xmm0, %edi
movd 0x5c0(%rsp,%rdi,4), %xmm3
pextrd $0x1, %xmm0, %edi
pinsrd $0x1, 0x5c0(%rsp,%rdi,4), %xmm3
pinsrd $0x2, 0x5c0(%rsp,%rsi,4), %xmm3
pinsrd $0x3, 0x5c0(%rsp,%rdx,4), %xmm3
movdqa %xmm12, %xmm0
pand %xmm13, %xmm0
pextrd $0x3, %xmm0, %edx
pextrd $0x2, %xmm0, %esi
movd %xmm0, %edi
movd 0x5c0(%rsp,%rdi,4), %xmm4
pextrd $0x1, %xmm0, %edi
pinsrd $0x1, 0x5c0(%rsp,%rdi,4), %xmm4
pinsrd $0x2, 0x5c0(%rsp,%rsi,4), %xmm4
pinsrd $0x3, 0x5c0(%rsp,%rdx,4), %xmm4
leaq (%rax,%rcx,2), %rax
movdqa %xmm1, %xmm6
psrld $0x14, %xmm6
movdqa %xmm2, %xmm7
psrld $0x14, %xmm7
movdqa %xmm3, %xmm5
psrld $0x14, %xmm5
movdqa %xmm4, %xmm0
psrld $0x14, %xmm0
psrld $0xc, %xmm9
pmulld %xmm6, %xmm9
movdqa %xmm1, %xmm6
psrld $0x8, %xmm6
pand %xmm13, %xmm6
paddd %xmm6, %xmm9
movdqa %xmm2, %xmm6
psrld $0x8, %xmm6
psrld $0xc, %xmm10
pmulld %xmm7, %xmm10
movdqa %xmm3, %xmm7
psrld $0x8, %xmm7
pand %xmm13, %xmm6
paddd %xmm6, %xmm10
psrld $0xc, %xmm11
pmulld %xmm5, %xmm11
pand %xmm13, %xmm7
paddd %xmm7, %xmm11
psrld $0xc, %xmm12
pmulld %xmm0, %xmm12
pmovzxwd (%rax), %xmm6
movdqa %xmm9, %xmm0
pminud 0x2e7b4(%rip), %xmm0    # 0xa2d30
pcmpeqd %xmm9, %xmm0
movmskps %xmm0, %ecx
popcntl %ecx, %edx
shll $0x4, %ecx
pshufb (%rcx,%rbx), %xmm6
leaq (%rax,%rdx,2), %rax
pmovzxwd (%rax), %xmm5
movdqa %xmm9, %xmm7
pslld $0x10, %xmm7
por %xmm6, %xmm7
blendvps %xmm0, %xmm7, %xmm9
movdqa %xmm10, %xmm0
pmovsxwd 0x2e7bc(%rip), %xmm7    # 0xa2d78
pminud %xmm7, %xmm0
pcmpeqd %xmm10, %xmm0
movmskps %xmm0, %ecx
popcntl %ecx, %edx
shll $0x4, %ecx
pshufb (%rcx,%rbx), %xmm5
movdqa %xmm10, %xmm6
pslld $0x10, %xmm6
por %xmm5, %xmm6
movdqa %xmm4, %xmm5
psrld $0x8, %xmm5
pand %xmm13, %xmm5
leaq (%rax,%rdx,2), %rax
blendvps %xmm0, %xmm6, %xmm10
pmovzxwd (%rax), %xmm6
movdqa %xmm11, %xmm0
pminud %xmm7, %xmm0
pcmpeqd %xmm11, %xmm0
movmskps %xmm0, %ecx
popcntl %ecx, %edx
shll $0x4, %ecx
pshufb (%rcx,%rbx), %xmm6
paddd %xmm5, %xmm12
leaq (%rax,%rdx,2), %rax
movdqa %xmm11, %xmm5
pslld $0x10, %xmm5
por %xmm6, %xmm5
pmovzxwd (%rax), %xmm6
blendvps %xmm0, %xmm5, %xmm11
movdqa %xmm12, %xmm0
pminud %xmm7, %xmm0
pcmpeqd %xmm12, %xmm0
movmskps %xmm0, %ecx
popcntl %ecx, %edx
shll $0x4, %ecx
pshufb (%rcx,%rbx), %xmm6
movdqa %xmm12, %xmm5
pslld $0x10, %xmm5
por %xmm6, %xmm5
blendvps %xmm0, %xmm5, %xmm12
movdqa (%rsp), %xmm5
pmovzxbd 0x2e705(%rip), %xmm6    # 0xa2d88
pand %xmm6, %xmm1
pand %xmm6, %xmm2
packusdw %xmm2, %xmm1
pand %xmm6, %xmm3
pand %xmm6, %xmm4
packusdw %xmm4, %xmm3
packuswb %xmm3, %xmm1
movaps 0x120(%rsp), %xmm0
movups %xmm0, (%r8,%r13)
movdqu %xmm1, 0x10(%r8,%r13)
leaq (%rax,%rdx,2), %r14
addq $0x20, %r13
cmpq %r9, %r13
jb 0x73fd3
movq 0x98(%rsp), %r13
jmp 0x7472b
movq %r12, %rdi
callq 0x45c0
xorl %r8d, %r8d
movq %r8, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rsp), %r8
movdqa 0x80(%rsp), %xmm9
movdqa 0x70(%rsp), %xmm10
movdqa 0x60(%rsp), %xmm11
movdqa 0x50(%rsp), %xmm12
movdqa (%rsp), %xmm5
movdqa 0x40(%rsp), %xmm14
movdqa 0x30(%rsp), %xmm15
movdqa 0x20(%rsp), %xmm8
movdqa %xmm5, 0xa0(%rsp)
movdqa %xmm14, 0xb0(%rsp)
movdqa %xmm15, 0xc0(%rsp)
movdqa %xmm8, 0xd0(%rsp)
movdqa %xmm9, 0xe0(%rsp)
movdqa %xmm10, 0xf0(%rsp)
movdqa %xmm11, 0x100(%rsp)
movdqa %xmm12, 0x110(%rsp)
movq 0x18(%rsp), %rdx
testb $0x1f, %dl
je 0x746db
andl $0x1f, %edx
incq %rdx
addq %r8, %r13
movl $0xfff, %eax            # imm = 0xFFF
movl 0x98(%rsp,%rdx,4), %ecx
andl %eax, %ecx
movb 0x5c0(%rsp,%rcx,4), %cl
movb %cl, -0x2(%r13,%rdx)
decq %rdx
cmpq $0x1, %rdx
jg 0x74796
jmp 0x746db