// File: /workspace/github_c_makefile_star2_O2/Cyan4973[P]FiniteStateEntropy/programs/../lib/fse_compress.c
// Function: FSE_compress_usingCTable_generic
static size_t FSE_compress_usingCTable_generic (void* dst, size_t dstSize,
                           const void* src, size_t srcSize,
                           const FSE_CTable* ct, const unsigned fast)
{
    const BYTE* const istart = (const BYTE*) src;
    const BYTE* const iend = istart + srcSize;
    const BYTE* ip=iend;

    BIT_CStream_t bitC;
    FSE_CState_t CState1, CState2;

    /* init */
    if (srcSize <= 2) return 0;
    { size_t const initError = BIT_initCStream(&bitC, dst, dstSize);
      if (FSE_isError(initError)) return 0; /* not enough space available to write a bitstream */ }

#define FSE_FLUSHBITS(s)  (fast ? BIT_flushBitsFast(s) : BIT_flushBits(s))

    if (srcSize & 1) {
        FSE_initCState2(&CState1, ct, *--ip);
        FSE_initCState2(&CState2, ct, *--ip);
        FSE_encodeSymbol(&bitC, &CState1, *--ip);
        FSE_FLUSHBITS(&bitC);
    } else {
        FSE_initCState2(&CState2, ct, *--ip);
        FSE_initCState2(&CState1, ct, *--ip);
    }

    /* join to mod 4 */
    srcSize -= 2;
    if ((sizeof(bitC.bitContainer)*8 > FSE_MAX_TABLELOG*4+7 ) && (srcSize & 2)) {  /* test bit 2 */
        FSE_encodeSymbol(&bitC, &CState2, *--ip);
        FSE_encodeSymbol(&bitC, &CState1, *--ip);
        FSE_FLUSHBITS(&bitC);
    }

    /* 2 or 4 encoding per loop */
    while ( ip>istart ) {

        FSE_encodeSymbol(&bitC, &CState2, *--ip);

        if (sizeof(bitC.bitContainer)*8 < FSE_MAX_TABLELOG*2+7 )   /* this test must be static */
            FSE_FLUSHBITS(&bitC);

        FSE_encodeSymbol(&bitC, &CState1, *--ip);

        if (sizeof(bitC.bitContainer)*8 > FSE_MAX_TABLELOG*4+7 ) {  /* this test must be static */
            FSE_encodeSymbol(&bitC, &CState2, *--ip);
            FSE_encodeSymbol(&bitC, &CState1, *--ip);
        }

        FSE_FLUSHBITS(&bitC);
    }

    FSE_flushCState(&bitC, &CState2);
    FSE_flushCState(&bitC, &CState1);
    return BIT_closeCStream(&bitC);
}

// Assembly:
cmpq $0x3, %rcx
jae 0x7f0e
xorl %eax, %eax
retq
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
andq $0x0, (%rsp)
andl $0x0, 0x8(%rsp)
movq %rdi, 0x10(%rsp)
movq %rdi, 0x18(%rsp)
leaq (%rdi,%rsi), %rax
addq $-0x8, %rax
movq %rax, 0x20(%rsp)
cmpq $0x9, %rsi
jb 0x815e
movl %r9d, %ebx
movq %r8, %r12
movq %rcx, %r15
movq %rdx, %r14
leaq (%rdx,%rcx), %rbp
movzbl -0x1(%rbp), %edx
testb $0x1, %r15b
jne 0x7f85
addq $-0x2, %rbp
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x8394
movzbl (%rbp), %edx
leaq 0x48(%rsp), %rdi
movq %r12, %rsi
callq 0x8394
jmp 0x7ffc
leaq 0x48(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x8394
movzbl -0x2(%rbp), %edx
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x8394
movzbl -0x3(%rbp), %edx
addq $-0x3, %rbp
movq %rsp, %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x83fa
movl 0x8(%r12), %edx
movl %edx, %ecx
shrl $0x3, %ecx
movq 0x18(%r12), %rdi
leaq (%rdi,%rcx), %rsi
movq (%r12), %rax
movq %rax, (%rdi)
testl %ebx, %ebx
jne 0x7fe6
movq 0x20(%rsp), %rdi
cmpq %rdi, %rsi
cmovaq %rdi, %rsi
movq %rsi, 0x18(%rsp)
andl $0x7, %edx
movl %edx, 0x8(%rsp)
shll $0x3, %ecx
shrq %cl, %rax
movq %rax, (%rsp)
testb $0x2, %r15b
jne 0x8068
movzbl -0x1(%rbp), %edx
movq %rsp, %r15
leaq 0x28(%rsp), %rsi
movq %r15, %rdi
callq 0x83fa
movzbl -0x2(%rbp), %edx
addq $-0x2, %rbp
leaq 0x48(%rsp), %rsi
movq %r15, %rdi
callq 0x83fa
movl 0x8(%r15), %edx
movl %edx, %ecx
shrl $0x3, %ecx
movq 0x18(%r15), %rdi
leaq (%rdi,%rcx), %rsi
movq (%r15), %rax
movq %rax, (%rdi)
testl %ebx, %ebx
jne 0x8052
movq 0x20(%rsp), %rdi
cmpq %rdi, %rsi
cmovaq %rdi, %rsi
movq %rsi, 0x18(%rsp)
andl $0x7, %edx
movl %edx, 0x8(%rsp)
shll $0x3, %ecx
shrq %cl, %rax
movq %rax, (%rsp)
movq %rsp, %r15
leaq 0x28(%rsp), %r12
leaq 0x48(%rsp), %r13
cmpq %r14, %rbp
jbe 0x8105
movzbl -0x1(%rbp), %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x83fa
movzbl -0x2(%rbp), %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x83fa
movzbl -0x3(%rbp), %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x83fa
movzbl -0x4(%rbp), %edx
addq $-0x4, %rbp
movq %r15, %rdi
movq %r13, %rsi
callq 0x83fa
movl 0x8(%rsp), %eax
movl %eax, %ecx
shrl $0x3, %ecx
movq 0x18(%rsp), %rdx
movq (%rsp), %rsi
movq %rsi, (%rdx)
addq %rdx, %rcx
movq 0x20(%rsp), %rdx
cmpq %rdx, %rcx
cmovbeq %rcx, %rdx
testl %ebx, %ebx
cmovneq %rcx, %rdx
movl %eax, %ecx
andb $-0x8, %cl
shrq %cl, %rsi
andl $0x7, %eax
movq %rdx, 0x18(%rsp)
movl %eax, 0x8(%rsp)
movq %rsi, (%rsp)
jmp 0x8075
movq %rsp, %rbx
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x8481
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0x8481
movl 0x8(%rbx), %ecx
movq (%rbx), %rdx
btsq %rcx, %rdx
incl %ecx
movl %ecx, %eax
shrl $0x3, %eax
movq 0x18(%rbx), %rsi
movq %rdx, (%rsi)
addq %rsi, %rax
movq 0x20(%rbx), %rdx
cmpq %rdx, %rax
cmovaq %rdx, %rax
cmpq %rdx, %rax
jae 0x815e
andl $0x7, %ecx
cmpl $0x1, %ecx
sbbq $-0x1, %rax
subq 0x10(%rsp), %rax
jmp 0x8160
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq