// File: /workspace/github_c_makefile_star2_O0/Cyan4973[P]FiniteStateEntropy/programs/../lib/fseU16.c
// Function: FSE_compressU16_usingCTable
size_t FSE_compressU16_usingCTable (void* dst, size_t maxDstSize,
                              const U16*  src, size_t srcSize,
                              const FSE_CTable* ct)
{
    const U16* const istart = src;
    const U16* const iend = istart + srcSize;
    const U16* ip;

    BYTE* op = (BYTE*) dst;
    BIT_CStream_t bitC;
    FSE_CState_t CState;


    /* init */
    BIT_initCStream(&bitC, op, maxDstSize);
    FSE_initCState(&CState, ct);

    ip=iend;

    /* join to even */
    if (srcSize & 1) {
        FSE_encodeSymbol(&bitC, &CState, *--ip);
        BIT_flushBits(&bitC);
    }

    /* join to mod 4 */
    if (srcSize & 2) {
        FSE_encodeSymbol(&bitC, &CState, *--ip);
        FSE_encodeSymbol(&bitC, &CState, *--ip);
        BIT_flushBits(&bitC);
    }

    /* 2 or 4 encoding per loop */
    while (ip>istart) {
        FSE_encodeSymbol(&bitC, &CState, *--ip);

        if (sizeof(size_t)*8 < FSE_MAX_TABLELOG*2+7 )  /* This test must be static */
            BIT_flushBits(&bitC);

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

        if (sizeof(size_t)*8 > FSE_MAX_TABLELOG*4+7 ) {  /* This test must be static */
            FSE_encodeSymbol(&bitC, &CState, *--ip);
            FSE_encodeSymbol(&bitC, &CState, *--ip);
        }
        BIT_flushBits(&bitC);
    }

    FSE_flushCState(&bitC, &CState);
    return BIT_closeCStream(&bitC);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq -0x70(%rbp), %rdi
callq 0x13bd0
movq -0x28(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x13c50
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x13aa4
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $-0x2, %rcx
movq %rcx, -0x40(%rbp)
movzwl -0x2(%rax), %edx
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x13d00
leaq -0x70(%rbp), %rdi
callq 0x13d90
movq -0x20(%rbp), %rax
andq $0x2, %rax
cmpq $0x0, %rax
je 0x13b01
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $-0x2, %rcx
movq %rcx, -0x40(%rbp)
movzwl -0x2(%rax), %edx
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x13d00
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $-0x2, %rcx
movq %rcx, -0x40(%rbp)
movzwl -0x2(%rax), %edx
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x13d00
leaq -0x70(%rbp), %rdi
callq 0x13d90
jmp 0x13b03
movq -0x40(%rbp), %rax
cmpq -0x30(%rbp), %rax
jbe 0x13bab
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $-0x2, %rcx
movq %rcx, -0x40(%rbp)
movzwl -0x2(%rax), %edx
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x13d00
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $-0x2, %rcx
movq %rcx, -0x40(%rbp)
movzwl -0x2(%rax), %edx
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x13d00
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $-0x2, %rcx
movq %rcx, -0x40(%rbp)
movzwl -0x2(%rax), %edx
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x13d00
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $-0x2, %rcx
movq %rcx, -0x40(%rbp)
movzwl -0x2(%rax), %edx
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x13d00
leaq -0x70(%rbp), %rdi
callq 0x13d90
jmp 0x13b03
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x13e20
leaq -0x70(%rbp), %rdi
callq 0x13e60
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)