// File: /workspace/github_c_makefile_star2_O1/Cyan4973[P]FiniteStateEntropy/programs/../lib/fseU16.c
// Function: FSE_decompressU16_usingDTable
size_t FSE_decompressU16_usingDTable (U16* dst, size_t maxDstSize,
                               const void* cSrc, size_t cSrcSize,
                               const FSE_DTable* dt)
{
    U16* const ostart = dst;
    U16* op = ostart;
    U16* const oend = ostart + maxDstSize;
    BIT_DStream_t bitD;
    FSE_DState_t state;

    /* Init */
    memset(&bitD, 0, sizeof(bitD));
    BIT_initDStream(&bitD, cSrc, cSrcSize);
    FSE_initDState(&state, &bitD, dt);

    while((BIT_reloadDStream(&bitD) < BIT_DStream_completed) && (op<oend)) {
        *op++ = FSE_decodeSymbolU16(&state, &bitD);
    }

    if (!BIT_endOfDStream(&bitD)) return ERROR(corruption_detected);

    while (state.state && op<oend) {
        *op++ = FSE_decodeSymbolU16(&state, &bitD);
    }

    if (state.state) return ERROR(corruption_detected);

    return op-ostart;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
testq %rcx, %rcx
je 0x9edd
leaq 0x8(%rdx), %rax
cmpq $0x8, %rcx
jb 0x9eee
leaq (%rdx,%rcx), %rbx
addq $-0x8, %rbx
movq (%rbx), %r9
movzbl 0x7(%rbx), %ecx
bsrl %ecx, %r10d
notl %r10d
addl $0x9, %r10d
testl %ecx, %ecx
cmovel %ecx, %r10d
jmp 0x9f7c
xorl %r10d, %r10d
xorl %ebx, %ebx
xorl %edx, %edx
xorl %eax, %eax
xorl %r9d, %r9d
jmp 0x9f7c
movzbl (%rdx), %r9d
leaq -0x2(%rcx), %r10
cmpq $0x5, %r10
ja 0x9f55
leaq 0xa0cd(%rip), %r11      # 0x13fd0
movslq (%r11,%r10,4), %r10
addq %r11, %r10
jmpq *%r10
movzbl 0x6(%rdx), %r10d
shlq $0x30, %r10
orq %r10, %r9
movzbl 0x5(%rdx), %r10d
shlq $0x28, %r10
addq %r10, %r9
movzbl 0x4(%rdx), %r10d
shlq $0x20, %r10
addq %r10, %r9
movzbl 0x3(%rdx), %r10d
shll $0x18, %r10d
addq %r10, %r9
movzbl 0x2(%rdx), %r10d
shll $0x10, %r10d
addq %r10, %r9
movzbl 0x1(%rdx), %r10d
shll $0x8, %r10d
addq %r10, %r9
movzbl -0x1(%rdx,%rcx), %r11d
bsrl %r11d, %r10d
notl %r10d
addl $0x9, %r10d
testl %r11d, %r11d
cmovel %r11d, %r10d
je 0x9f79
shll $0x3, %ecx
subl %ecx, %r10d
addl $0x40, %r10d
movq %rdx, %rbx
movzwl (%r8), %r15d
addl %r15d, %r10d
movl %r10d, %ecx
negb %cl
movq %r9, %r14
shrq %cl, %r14
leaq 0xa05b(%rip), %r11      # 0x13ff0
andl (%r11,%r15,4), %r14d
cmpl $0x40, %r10d
ja 0x9fe0
cmpq %rax, %rbx
jae 0x9fce
cmpq %rdx, %rbx
je 0x9fe0
movl %r10d, %r9d
shrl $0x3, %r9d
movq %rbx, %r15
subq %r9, %r15
movl %ebx, %ecx
subl %edx, %ecx
cmpq %rdx, %r15
cmovael %r9d, %ecx
leal (,%rcx,8), %r9d
subl %r9d, %r10d
jmp 0x9fd8
movl %r10d, %ecx
shrl $0x3, %ecx
andl $0x7, %r10d
movl %ecx, %ecx
subq %rcx, %rbx
movq (%rbx), %r9
leaq (%rdi,%rsi,2), %r15
movq %rdi, %rsi
cmpl $0x40, %r10d
jbe 0x9ff1
xorl %ecx, %ecx
jmp 0xa032
cmpq %rax, %rbx
jae 0xa020
cmpq %rdx, %rbx
je 0xa072
movl %r10d, %ecx
shrl $0x3, %ecx
movq %rbx, %r9
subq %rcx, %r9
movl %ebx, %r12d
subl %edx, %r12d
cmpq %rdx, %r9
cmovael %ecx, %r12d
subq %r12, %rbx
shll $0x3, %r12d
subl %r12d, %r10d
jmp 0xa02d
movl %r10d, %ecx
shrl $0x3, %ecx
subq %rcx, %rbx
andl $0x7, %r10d
movq (%rbx), %r9
movb $0x1, %cl
testb %cl, %cl
je 0xa07b
cmpq %r15, %rsi
jae 0xa07b
movzwl 0x4(%r8,%r14,4), %r12d
movzwl 0x6(%r8,%r14,4), %ebp
movl %ebp, %r13d
andl $0xf, %r13d
addl %r13d, %r10d
movl %r10d, %ecx
negb %cl
movq %r9, %r14
shrq %cl, %r14
andl (%r11,%r13,4), %r14d
shrl $0x4, %ebp
addq %r12, %r14
movw %bp, (%rsi)
addq $0x2, %rsi
jmp 0x9fe7
cmpl $0x40, %r10d
setne %cl
jmp 0xa032
movq $-0x4, %rax
cmpl $0x40, %r10d
jne 0xa0e9
cmpq %rdx, %rbx
jne 0xa0e9
testq %r14, %r14
setne %cl
cmpq %r15, %rsi
setb %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0xa0dc
movzwl 0x4(%r8,%r14,4), %edx
movzwl 0x6(%r8,%r14,4), %ebx
movl %ebx, %r12d
andl $0xf, %r12d
addl %r12d, %r10d
movl %r10d, %ecx
negb %cl
movq %r9, %r14
shrq %cl, %r14
shrl $0x4, %ebx
andl (%r11,%r12,4), %r14d
movw %bx, (%rsi)
addq $0x2, %rsi
addq %rdx, %r14
setne %cl
je 0xa0dc
cmpq %r15, %rsi
jb 0xa0a0
testb %cl, %cl
jne 0xa0e9
subq %rdi, %rsi
sarq %rsi
movq %rsi, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq