// File: /workspace/github_c_makefile_star2_O3/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
xorl %r9d, %r9d
testq %rcx, %rcx
je 0xa6b6
leaq 0x8(%rdx), %r10
cmpq $0x8, %rcx
jb 0xa6c3
leaq (%rdx,%rcx), %r14
addq $-0x8, %r14
movq (%r14), %r11
movq %r11, %rax
shrq $0x38, %rax
je 0xa73e
bsrl %eax, %r9d
notl %r9d
addl $0x9, %r9d
jmp 0xa73e
xorl %r14d, %r14d
xorl %edx, %edx
xorl %r10d, %r10d
xorl %r11d, %r11d
jmp 0xa73e
movzbl (%rdx), %r11d
leaq -0x2(%rcx), %rax
cmpq $0x5, %rax
ja 0xa720
leaq 0xaa18(%rip), %rbx      # 0x150f0
movslq (%rbx,%rax,4), %rax
addq %rbx, %rax
jmpq *%rax
movzbl 0x6(%rdx), %eax
shlq $0x30, %rax
orq %rax, %r11
movzbl 0x5(%rdx), %eax
shlq $0x28, %rax
addq %rax, %r11
movzbl 0x4(%rdx), %eax
shlq $0x20, %rax
addq %rax, %r11
movzbl 0x3(%rdx), %eax
shll $0x18, %eax
addq %rax, %r11
movzbl 0x2(%rdx), %eax
shll $0x10, %eax
addq %rax, %r11
movzbl 0x1(%rdx), %eax
shll $0x8, %eax
addq %rax, %r11
movzbl -0x1(%rdx,%rcx), %eax
testl %eax, %eax
je 0xa73b
bsrl %eax, %r9d
xorl $0x1f, %r9d
shll $0x3, %ecx
subl %ecx, %r9d
addl $0x29, %r9d
movq %rdx, %r14
movzwl (%r8), %r12d
addl %r12d, %r9d
movl %r9d, %ecx
negb %cl
movq %r11, %r15
shrq %cl, %r15
movq $-0x4, %rax
cmpl $0x40, %r9d
jbe 0xa768
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, -0x8(%rsp)
leaq 0xa99c(%rip), %rdi      # 0x15110
andl (%rdi,%r12,4), %r15d
cmpq %r10, %r14
jae 0xa7ae
cmpq %rdx, %r14
je 0xa7be
movl %r9d, %r11d
shrl $0x3, %r11d
movq %r14, %r12
subq %r11, %r12
movl %r14d, %ecx
subl %edx, %ecx
cmpq %rdx, %r12
cmovael %r11d, %ecx
leal (,%rcx,8), %r11d
subl %r11d, %r9d
cmpl $0x40, %r9d
ja 0xa75d
jmp 0xa7b8
movl %r9d, %ecx
shrl $0x3, %ecx
andl $0x7, %r9d
subq %rcx, %r14
movq (%r14), %r11
movq -0x8(%rsp), %rcx
leaq (%rcx,%rsi,2), %r12
movq %rcx, %rsi
cmpq %r10, %r14
jae 0xa7f9
cmpq %rdx, %r14
je 0xa84f
movl %r9d, %ecx
shrl $0x3, %ecx
movq %r14, %r11
subq %rcx, %r11
movl %r14d, %r13d
subl %edx, %r13d
cmpq %rdx, %r11
cmovael %ecx, %r13d
subq %r13, %r14
shll $0x3, %r13d
subl %r13d, %r9d
jmp 0xa806
movl %r9d, %ecx
shrl $0x3, %ecx
subq %rcx, %r14
andl $0x7, %r9d
movq (%r14), %r11
movb $0x1, %cl
testb %cl, %cl
je 0xa858
cmpq %r12, %rsi
jae 0xa858
movzwl 0x4(%r8,%r15,4), %r13d
movzwl 0x6(%r8,%r15,4), %ebp
movl %ebp, %ebx
andl $0xf, %ebx
addl %ebx, %r9d
movl %r9d, %ecx
negb %cl
movq %r11, %r15
shrq %cl, %r15
shrl $0x4, %ebp
andl (%rdi,%rbx,4), %r15d
addq %r13, %r15
movw %bp, (%rsi)
addq $0x2, %rsi
cmpl $0x40, %r9d
jbe 0xa7ca
jmp 0xa75d
cmpl $0x40, %r9d
setne %cl
jmp 0xa80b
cmpq %rdx, %r14
jne 0xa75d
cmpl $0x40, %r9d
jne 0xa75d
testq %r15, %r15
setne %cl
cmpq %r12, %rsi
setb %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0xa8be
movl $0x40, %edx
movzwl 0x4(%r8,%r15,4), %r9d
movzwl 0x6(%r8,%r15,4), %r10d
movl %r10d, %ebx
andl $0xf, %ebx
addl %ebx, %edx
movl %edx, %ecx
negb %cl
movq %r11, %r15
shrq %cl, %r15
shrl $0x4, %r10d
andl (%rdi,%rbx,4), %r15d
movw %r10w, (%rsi)
addq $0x2, %rsi
addq %r9, %r15
setne %cl
je 0xa8be
cmpq %r12, %rsi
jb 0xa883
testb %cl, %cl
jne 0xa75d
subq -0x8(%rsp), %rsi
sarq %rsi
movq %rsi, %rax
jmp 0xa75d