// File: /workspace/github_c_makefile_star2_O3/Cyan4973[P]FiniteStateEntropy/programs/../lib/huf_compress.c
// Function: HUF_compress4X_usingCTable_internal
static size_t
HUF_compress4X_usingCTable_internal(void* dst, size_t dstSize,
                              const void* src, size_t srcSize,
                              const HUF_CElt* CTable, int bmi2)
{
    size_t const segmentSize = (srcSize+3)/4;   /* first 3 segments */
    const BYTE* ip = (const BYTE*) src;
    const BYTE* const iend = ip + srcSize;
    BYTE* const ostart = (BYTE*) dst;
    BYTE* const oend = ostart + dstSize;
    BYTE* op = ostart;

    if (dstSize < 6 + 1 + 1 + 1 + 8) return 0;   /* minimum space to compress successfully */
    if (srcSize < 12) return 0;   /* no saving possible : too small input */
    op += 6;   /* jumpTable */

    assert(op <= oend);
    {   CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, (size_t)(oend-op), ip, segmentSize, CTable, bmi2) );
        if (cSize==0) return 0;
        assert(cSize <= 65535);
        MEM_writeLE16(ostart, (U16)cSize);
        op += cSize;
    }

    ip += segmentSize;
    assert(op <= oend);
    {   CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, (size_t)(oend-op), ip, segmentSize, CTable, bmi2) );
        if (cSize==0) return 0;
        assert(cSize <= 65535);
        MEM_writeLE16(ostart+2, (U16)cSize);
        op += cSize;
    }

    ip += segmentSize;
    assert(op <= oend);
    {   CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, (size_t)(oend-op), ip, segmentSize, CTable, bmi2) );
        if (cSize==0) return 0;
        assert(cSize <= 65535);
        MEM_writeLE16(ostart+4, (U16)cSize);
        op += cSize;
    }

    ip += segmentSize;
    assert(op <= oend);
    assert(ip <= iend);
    {   CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, (size_t)(oend-op), ip, (size_t)(iend-ip), CTable, bmi2) );
        if (cSize==0) return 0;
        op += cSize;
    }

    return (size_t)(op-ostart);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbp
cmpq $0x11, %rsi
setb %al
cmpq $0xc, %rcx
setb %cl
orb %al, %cl
je 0xbd27
xorl %eax, %eax
jmp 0xbe35
movq %r8, %r15
movq %rdx, %r12
movq %rsi, %r13
leaq 0x3(%rbp), %rbx
shrq $0x2, %rbx
movq %rdi, 0x8(%rsp)
leaq 0x6(%rdi), %r14
addq $-0x6, %rsi
movq %r14, %rdi
movq %rbx, %rcx
movl %r9d, 0x4(%rsp)
callq 0xbb51
cmpq $-0x9, %rax
ja 0xbe35
testq %rax, %rax
je 0xbd20
movq 0x8(%rsp), %rcx
addq %rcx, %r13
movw %ax, (%rcx)
addq %rax, %r14
leaq (%r12,%rbx), %rdx
movq %r13, %rsi
subq %r14, %rsi
movq %r14, %rdi
movq %rdx, 0x10(%rsp)
movq %rbx, %rcx
movq %r15, %r8
movl 0x4(%rsp), %r9d
callq 0xbb51
cmpq $-0x9, %rax
ja 0xbe35
testq %rax, %rax
je 0xbd20
movq 0x8(%rsp), %rcx
movw %ax, 0x2(%rcx)
addq %rax, %r14
movq 0x10(%rsp), %rdx
addq %rbx, %rdx
movq %r13, %rsi
subq %r14, %rsi
movq %r14, %rdi
movq %rdx, 0x10(%rsp)
movq %rbx, %rcx
movq %r15, %r8
movl 0x4(%rsp), %r9d
callq 0xbb51
cmpq $-0x9, %rax
ja 0xbe35
testq %rax, %rax
je 0xbd20
addq %rbp, %r12
movq 0x8(%rsp), %rcx
movw %ax, 0x4(%rcx)
addq %rax, %r14
movq 0x10(%rsp), %rdx
addq %rbx, %rdx
subq %r14, %r13
subq %rdx, %r12
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rcx
movq %r15, %r8
movl 0x4(%rsp), %r9d
callq 0xbb51
cmpq $-0x9, %rax
ja 0xbe35
testq %rax, %rax
je 0xbd20
addq %rax, %r14
subq 0x8(%rsp), %r14
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq