// File: /workspace/github_c_makefile_star2_O0/Cyan4973[P]FiniteStateEntropy/programs/../lib/hist.c
// Function: HIST_count_parallel_wksp
static size_t HIST_count_parallel_wksp(
                                unsigned* count, unsigned* maxSymbolValuePtr,
                                const void* source, size_t sourceSize,
                                HIST_checkInput_e check,
                                U32* const workSpace)
{
    const BYTE* ip = (const BYTE*)source;
    const BYTE* const iend = ip+sourceSize;
    size_t const countSize = (*maxSymbolValuePtr + 1) * sizeof(*count);
    unsigned max=0;
    U32* const Counting1 = workSpace;
    U32* const Counting2 = Counting1 + 256;
    U32* const Counting3 = Counting2 + 256;
    U32* const Counting4 = Counting3 + 256;

    /* safety checks */
    assert(*maxSymbolValuePtr <= 255);
    if (!sourceSize) {
        memset(count, 0, countSize);
        *maxSymbolValuePtr = 0;
        return 0;
    }
    memset(workSpace, 0, 4*256*sizeof(unsigned));

    /* by stripes of 16 bytes */
    {   U32 cached = MEM_read32(ip); ip += 4;
        while (ip < iend-15) {
            U32 c = cached; cached = MEM_read32(ip); ip += 4;
            Counting1[(BYTE) c     ]++;
            Counting2[(BYTE)(c>>8) ]++;
            Counting3[(BYTE)(c>>16)]++;
            Counting4[       c>>24 ]++;
            c = cached; cached = MEM_read32(ip); ip += 4;
            Counting1[(BYTE) c     ]++;
            Counting2[(BYTE)(c>>8) ]++;
            Counting3[(BYTE)(c>>16)]++;
            Counting4[       c>>24 ]++;
            c = cached; cached = MEM_read32(ip); ip += 4;
            Counting1[(BYTE) c     ]++;
            Counting2[(BYTE)(c>>8) ]++;
            Counting3[(BYTE)(c>>16)]++;
            Counting4[       c>>24 ]++;
            c = cached; cached = MEM_read32(ip); ip += 4;
            Counting1[(BYTE) c     ]++;
            Counting2[(BYTE)(c>>8) ]++;
            Counting3[(BYTE)(c>>16)]++;
            Counting4[       c>>24 ]++;
        }
        ip-=4;
    }

    /* finish last symbols */
    while (ip<iend) Counting1[*ip++]++;

    {   U32 s;
        for (s=0; s<256; s++) {
            Counting1[s] += Counting2[s] + Counting3[s] + Counting4[s];
            if (Counting1[s] > max) max = Counting1[s];
    }   }

    {   unsigned maxSymbolValue = 255;
        while (!Counting1[maxSymbolValue]) maxSymbolValue--;
        if (check && maxSymbolValue > *maxSymbolValuePtr) return ERROR(maxSymbolValue_tooSmall);
        *maxSymbolValuePtr = maxSymbolValue;
        memmove(count, Counting1, countSize);   /* in case count & Counting1 are overlapping */
    }
    return (size_t)max;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movq %r9, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
addl $0x1, %eax
movl %eax, %eax
shlq $0x2, %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
addq $0x400, %rax            # imm = 0x400
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
addq $0x400, %rax            # imm = 0x400
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
addq $0x400, %rax            # imm = 0x400
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xf080
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rdx
xorl %esi, %esi
callq 0x10c0
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
movq $0x0, -0x8(%rbp)
jmp 0xf3b9
movq -0x38(%rbp), %rdi
xorl %esi, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x10c0
movq -0x40(%rbp), %rdi
callq 0xf530
movl %eax, -0x7c(%rbp)
movq -0x40(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
addq $-0xf, %rcx
cmpq %rcx, %rax
jae 0xf28a
movl -0x7c(%rbp), %eax
movl %eax, -0x80(%rbp)
movq -0x40(%rbp), %rdi
callq 0xf530
movl %eax, -0x7c(%rbp)
movq -0x40(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x40(%rbp)
movq -0x60(%rbp), %rax
movl -0x80(%rbp), %ecx
movzbl %cl, %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq -0x68(%rbp), %rax
movl -0x80(%rbp), %ecx
shrl $0x8, %ecx
movzbl %cl, %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq -0x70(%rbp), %rax
movl -0x80(%rbp), %ecx
shrl $0x10, %ecx
movzbl %cl, %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq -0x78(%rbp), %rax
movl -0x80(%rbp), %ecx
shrl $0x18, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x7c(%rbp), %eax
movl %eax, -0x80(%rbp)
movq -0x40(%rbp), %rdi
callq 0xf530
movl %eax, -0x7c(%rbp)
movq -0x40(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x40(%rbp)
movq -0x60(%rbp), %rax
movl -0x80(%rbp), %ecx
movzbl %cl, %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq -0x68(%rbp), %rax
movl -0x80(%rbp), %ecx
shrl $0x8, %ecx
movzbl %cl, %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq -0x70(%rbp), %rax
movl -0x80(%rbp), %ecx
shrl $0x10, %ecx
movzbl %cl, %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq -0x78(%rbp), %rax
movl -0x80(%rbp), %ecx
shrl $0x18, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x7c(%rbp), %eax
movl %eax, -0x80(%rbp)
movq -0x40(%rbp), %rdi
callq 0xf530
movl %eax, -0x7c(%rbp)
movq -0x40(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x40(%rbp)
movq -0x60(%rbp), %rax
movl -0x80(%rbp), %ecx
movzbl %cl, %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq -0x68(%rbp), %rax
movl -0x80(%rbp), %ecx
shrl $0x8, %ecx
movzbl %cl, %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq -0x70(%rbp), %rax
movl -0x80(%rbp), %ecx
shrl $0x10, %ecx
movzbl %cl, %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq -0x78(%rbp), %rax
movl -0x80(%rbp), %ecx
shrl $0x18, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x7c(%rbp), %eax
movl %eax, -0x80(%rbp)
movq -0x40(%rbp), %rdi
callq 0xf530
movl %eax, -0x7c(%rbp)
movq -0x40(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x40(%rbp)
movq -0x60(%rbp), %rax
movl -0x80(%rbp), %ecx
movzbl %cl, %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq -0x68(%rbp), %rax
movl -0x80(%rbp), %ecx
shrl $0x8, %ecx
movzbl %cl, %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq -0x70(%rbp), %rax
movl -0x80(%rbp), %ecx
shrl $0x10, %ecx
movzbl %cl, %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq -0x78(%rbp), %rax
movl -0x80(%rbp), %ecx
shrl $0x18, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0xf0a8
movq -0x40(%rbp), %rax
addq $-0x4, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0xf2c1
movq -0x60(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x40(%rbp)
movzbl (%rcx), %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0xf296
movl $0x0, -0x84(%rbp)
cmpl $0x100, -0x84(%rbp)     # imm = 0x100
jae 0xf343
movq -0x68(%rbp), %rax
movl -0x84(%rbp), %ecx
movl (%rax,%rcx,4), %edx
movq -0x70(%rbp), %rax
movl -0x84(%rbp), %ecx
addl (%rax,%rcx,4), %edx
movq -0x78(%rbp), %rax
movl -0x84(%rbp), %ecx
addl (%rax,%rcx,4), %edx
movq -0x60(%rbp), %rax
movl -0x84(%rbp), %ecx
addl (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
movq -0x60(%rbp), %rax
movl -0x84(%rbp), %ecx
movl (%rax,%rcx,4), %eax
cmpl -0x54(%rbp), %eax
jbe 0xf330
movq -0x60(%rbp), %rax
movl -0x84(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x54(%rbp)
jmp 0xf332
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0xf2cb
movl $0xff, -0x88(%rbp)
movq -0x60(%rbp), %rax
movl -0x88(%rbp), %ecx
cmpl $0x0, (%rax,%rcx,4)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0xf366
jmp 0xf377
movl -0x88(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0xf34d
cmpl $0x0, -0x2c(%rbp)
je 0xf395
movl -0x88(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jbe 0xf395
movq $-0x7, -0x8(%rbp)
jmp 0xf3b9
movl -0x88(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0x1160
movl -0x54(%rbp), %eax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)