// File: /workspace/github_c_makefile_star2_O3/Cyan4973[P]FiniteStateEntropy/programs/../lib/fse_compress.c
// Function: FSE_buildCTable_raw
size_t FSE_buildCTable_raw (FSE_CTable* ct, unsigned nbBits)
{
    const unsigned tableSize = 1 << nbBits;
    const unsigned tableMask = tableSize - 1;
    const unsigned maxSymbolValue = tableMask;
    void* const ptr = ct;
    U16* const tableU16 = ( (U16*) ptr) + 2;
    void* const FSCT = ((U32*)ptr) + 1 /* header */ + (tableSize>>1);   /* assumption : tableLog >= 1 */
    FSE_symbolCompressionTransform* const symbolTT = (FSE_symbolCompressionTransform*) (FSCT);
    unsigned s;

    /* Sanity checks */
    if (nbBits < 1) return ERROR(GENERIC);             /* min size */

    /* header */
    tableU16[-2] = (U16) nbBits;
    tableU16[-1] = (U16) maxSymbolValue;

    /* Build table */
    for (s=0; s<tableSize; s++)
        tableU16[s] = (U16)(tableSize + s);

    /* Build Symbol Transformation Table */
    {   const U32 deltaNbBits = (nbBits << 16) - (1 << nbBits);
        for (s=0; s<=maxSymbolValue; s++) {
            symbolTT[s].deltaNbBits = deltaNbBits;
            symbolTT[s].deltaFindState = s-1;
    }   }

    return 0;
}

// Assembly:
movl %esi, %ecx
movl $0x1, %eax
shll %cl, %eax
testl %esi, %esi
je 0x9674
movl %eax, %esi
shrl %esi
movw %cx, (%rdi)
leal -0x1(%rax), %edx
movw %dx, 0x2(%rdi)
movl %eax, %edx
leaq 0x7(%rdx), %r8
andq $-0x8, %r8
leaq -0x1(%rdx), %r9
movq %r9, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa 0x9d31(%rip), %xmm1     # 0x130b0
movdqa 0x9d39(%rip), %xmm2     # 0x130c0
movdqa 0x9d41(%rip), %xmm3     # 0x130d0
movdqa 0x9d49(%rip), %xmm4     # 0x130e0
xorl %r9d, %r9d
movdqa 0x9d4e(%rip), %xmm5     # 0x130f0
pxor %xmm5, %xmm0
pcmpeqd %xmm6, %xmm6
movdqa 0xab4e(%rip), %xmm7     # 0x13f00
movdqa %xmm4, %xmm8
pxor %xmm5, %xmm8
movdqa %xmm8, %xmm10
pcmpgtd %xmm0, %xmm10
pshufd $0xa0, %xmm10, %xmm9    # xmm9 = xmm10[0,0,2,2]
pshuflw $0xe8, %xmm9, %xmm11    # xmm11 = xmm9[0,2,2,3,4,5,6,7]
pcmpeqd %xmm0, %xmm8
pshufd $0xf5, %xmm8, %xmm8     # xmm8 = xmm8[1,1,3,3]
pshuflw $0xe8, %xmm8, %xmm12    # xmm12 = xmm8[0,2,2,3,4,5,6,7]
pand %xmm11, %xmm12
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
pshuflw $0xe8, %xmm10, %xmm11   # xmm11 = xmm10[0,2,2,3,4,5,6,7]
por %xmm12, %xmm11
pxor %xmm6, %xmm11
packssdw %xmm11, %xmm11
movd %xmm11, %r10d
testb $0x1, %r10b
je 0x9418
leal (%rdx,%r9), %r10d
movw %r10w, 0x4(%rdi,%r9,2)
pand %xmm9, %xmm8
por %xmm10, %xmm8
packssdw %xmm8, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm8
movd %xmm8, %r10d
shrl $0x10, %r10d
testb $0x1, %r10b
je 0x944d
leal (%rdx,%r9), %r10d
incl %r10d
movw %r10w, 0x6(%rdi,%r9,2)
movdqa %xmm3, %xmm9
pxor %xmm5, %xmm9
movdqa %xmm9, %xmm10
pcmpgtd %xmm0, %xmm10
pshufd $0xa0, %xmm10, %xmm8    # xmm8 = xmm10[0,0,2,2]
pcmpeqd %xmm0, %xmm9
pshufd $0xf5, %xmm9, %xmm9     # xmm9 = xmm9[1,1,3,3]
movdqa %xmm9, %xmm11
pand %xmm8, %xmm11
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
por %xmm10, %xmm11
packssdw %xmm11, %xmm11
pxor %xmm6, %xmm11
packssdw %xmm11, %xmm11
pextrw $0x2, %xmm11, %r10d
testb $0x1, %r10b
je 0x94b0
leal (%rdx,%r9), %r10d
addl $0x2, %r10d
movw %r10w, 0x8(%rdi,%r9,2)
pshufhw $0x84, %xmm8, %xmm8     # xmm8 = xmm8[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm9, %xmm9     # xmm9 = xmm9[0,1,2,3,4,5,4,6]
pand %xmm8, %xmm9
pshufhw $0x84, %xmm10, %xmm8    # xmm8 = xmm10[0,1,2,3,4,5,4,6]
por %xmm9, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm8
pextrw $0x3, %xmm8, %r10d
testb $0x1, %r10b
je 0x94f0
leal (%rdx,%r9), %r10d
addl $0x3, %r10d
movw %r10w, 0xa(%rdi,%r9,2)
movdqa %xmm2, %xmm8
pxor %xmm5, %xmm8
movdqa %xmm8, %xmm10
pcmpgtd %xmm0, %xmm10
pshufd $0xa0, %xmm10, %xmm9    # xmm9 = xmm10[0,0,2,2]
pshuflw $0xe8, %xmm9, %xmm11    # xmm11 = xmm9[0,2,2,3,4,5,6,7]
pcmpeqd %xmm0, %xmm8
pshufd $0xf5, %xmm8, %xmm8     # xmm8 = xmm8[1,1,3,3]
pshuflw $0xe8, %xmm8, %xmm12    # xmm12 = xmm8[0,2,2,3,4,5,6,7]
pand %xmm11, %xmm12
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
pshuflw $0xe8, %xmm10, %xmm11   # xmm11 = xmm10[0,2,2,3,4,5,6,7]
por %xmm12, %xmm11
pxor %xmm6, %xmm11
packssdw %xmm11, %xmm11
pextrw $0x4, %xmm11, %r10d
testb $0x1, %r10b
je 0x955b
leal (%rdx,%r9), %r10d
addl $0x4, %r10d
movw %r10w, 0xc(%rdi,%r9,2)
pand %xmm9, %xmm8
por %xmm10, %xmm8
packssdw %xmm8, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm8
pextrw $0x5, %xmm8, %r10d
testb $0x1, %r10b
je 0x958e
leal (%rdx,%r9), %r10d
addl $0x5, %r10d
movw %r10w, 0xe(%rdi,%r9,2)
movdqa %xmm1, %xmm9
pxor %xmm5, %xmm9
movdqa %xmm9, %xmm10
pcmpgtd %xmm0, %xmm10
pshufd $0xa0, %xmm10, %xmm8    # xmm8 = xmm10[0,0,2,2]
pcmpeqd %xmm0, %xmm9
pshufd $0xf5, %xmm9, %xmm9     # xmm9 = xmm9[1,1,3,3]
movdqa %xmm9, %xmm11
pand %xmm8, %xmm11
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
por %xmm10, %xmm11
packssdw %xmm11, %xmm11
pxor %xmm6, %xmm11
packssdw %xmm11, %xmm11
pextrw $0x6, %xmm11, %r10d
testb $0x1, %r10b
je 0x95f1
leal (%rdx,%r9), %r10d
addl $0x6, %r10d
movw %r10w, 0x10(%rdi,%r9,2)
pshufhw $0x84, %xmm8, %xmm8     # xmm8 = xmm8[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm9, %xmm9     # xmm9 = xmm9[0,1,2,3,4,5,4,6]
pand %xmm8, %xmm9
pshufhw $0x84, %xmm10, %xmm8    # xmm8 = xmm10[0,1,2,3,4,5,4,6]
por %xmm9, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm8
pextrw $0x7, %xmm8, %r10d
testb $0x1, %r10b
je 0x9631
leal (%rdx,%r9), %r10d
addl $0x7, %r10d
movw %r10w, 0x12(%rdi,%r9,2)
addq $0x8, %r9
paddq %xmm7, %xmm4
paddq %xmm7, %xmm3
paddq %xmm7, %xmm2
paddq %xmm7, %xmm1
cmpq %r9, %r8
jne 0x93b2
shll $0x10, %ecx
subl %eax, %ecx
leaq (%rdi,%rsi,4), %rsi
addq $0x8, %rsi
xorl %eax, %eax
xorl %edi, %edi
movl %ecx, (%rsi,%rdi,8)
leal -0x1(%rdi), %r8d
movl %r8d, -0x4(%rsi,%rdi,8)
incq %rdi
cmpq %rdi, %rdx
jne 0x965f
retq
movq $-0x1, %rax
retq