// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/bitops.c
// Function: redisPopcount
size_t redisPopcount(void *s, long count) {
    size_t bits = 0;
    unsigned char *p = s;
    uint32_t *p4;
    static const unsigned char bitsinbyte[256] = {0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8};

    /* Count initial bytes not aligned to 32 bit. */
    while((unsigned long)p & 3 && count) {
        bits += bitsinbyte[*p++];
        count--;
    }

    /* Count bits 28 bytes at a time */
    p4 = (uint32_t*)p;
    while(count>=28) {
        uint32_t aux1, aux2, aux3, aux4, aux5, aux6, aux7;

        aux1 = *p4++;
        aux2 = *p4++;
        aux3 = *p4++;
        aux4 = *p4++;
        aux5 = *p4++;
        aux6 = *p4++;
        aux7 = *p4++;
        count -= 28;

        aux1 = aux1 - ((aux1 >> 1) & 0x55555555);
        aux1 = (aux1 & 0x33333333) + ((aux1 >> 2) & 0x33333333);
        aux2 = aux2 - ((aux2 >> 1) & 0x55555555);
        aux2 = (aux2 & 0x33333333) + ((aux2 >> 2) & 0x33333333);
        aux3 = aux3 - ((aux3 >> 1) & 0x55555555);
        aux3 = (aux3 & 0x33333333) + ((aux3 >> 2) & 0x33333333);
        aux4 = aux4 - ((aux4 >> 1) & 0x55555555);
        aux4 = (aux4 & 0x33333333) + ((aux4 >> 2) & 0x33333333);
        aux5 = aux5 - ((aux5 >> 1) & 0x55555555);
        aux5 = (aux5 & 0x33333333) + ((aux5 >> 2) & 0x33333333);
        aux6 = aux6 - ((aux6 >> 1) & 0x55555555);
        aux6 = (aux6 & 0x33333333) + ((aux6 >> 2) & 0x33333333);
        aux7 = aux7 - ((aux7 >> 1) & 0x55555555);
        aux7 = (aux7 & 0x33333333) + ((aux7 >> 2) & 0x33333333);
        bits += ((((aux1 + (aux1 >> 4)) & 0x0F0F0F0F) +
                    ((aux2 + (aux2 >> 4)) & 0x0F0F0F0F) +
                    ((aux3 + (aux3 >> 4)) & 0x0F0F0F0F) +
                    ((aux4 + (aux4 >> 4)) & 0x0F0F0F0F) +
                    ((aux5 + (aux5 >> 4)) & 0x0F0F0F0F) +
                    ((aux6 + (aux6 >> 4)) & 0x0F0F0F0F) +
                    ((aux7 + (aux7 >> 4)) & 0x0F0F0F0F))* 0x01010101) >> 24;
    }
    /* Count the remaining bytes. */
    p = (unsigned char*)p4;
    while(count--) bits += bitsinbyte[*p++];
    return bits;
}

// Assembly:
xorl %eax, %eax
leaq 0x550a7(%rip), %rcx     # 0xbcc00
movq %rdi, %rdx
movq %rsi, %r8
addq $-0x1, %r8
setb %r9b
testb $0x3, %dil
je 0x67c9e
testb %r9b, %r9b
je 0x67c9e
movzbl (%rdx), %esi
incq %rdx
movzbl (%rsi,%rcx), %esi
addq %rsi, %rax
incq %rdi
movq %r8, %rsi
jmp 0x67b5f
movl 0x10(%rdx), %edi
movdqu (%rdx), %xmm0
movq 0x14(%rdx), %xmm1
addq $0x1c, %rdx
addq $-0x1c, %rsi
movl %edi, %r8d
shrl %r8d
andl $0x55555555, %r8d       # imm = 0x55555555
subl %r8d, %edi
movl $0x33333333, %r8d       # imm = 0x33333333
movl %edi, %r9d
andl %r8d, %r9d
shrl $0x2, %edi
andl %r8d, %edi
addl %r9d, %edi
movdqa %xmm0, %xmm2
psrld $0x1, %xmm2
pand 0x54f97(%rip), %xmm2    # 0xbcb70
psubd %xmm2, %xmm0
movdqa 0x54f9b(%rip), %xmm2    # 0xbcb80
movdqa %xmm0, %xmm3
pand %xmm2, %xmm3
psrld $0x2, %xmm0
pand %xmm2, %xmm0
paddd %xmm3, %xmm0
movdqa %xmm0, %xmm2
psrld $0x4, %xmm2
paddd %xmm0, %xmm2
pand 0x54f81(%rip), %xmm2    # 0xbcb90
movl %edi, %r8d
shrl $0x4, %r8d
addl %edi, %r8d
andl $0xf0f0f0f, %r8d        # imm = 0xF0F0F0F
movdqa %xmm1, %xmm0
psrld $0x1, %xmm0
pand 0x54f6f(%rip), %xmm0    # 0xbcba0
psubd %xmm0, %xmm1
movdqa 0x54f73(%rip), %xmm0    # 0xbcbb0
movdqa %xmm1, %xmm3
pand %xmm0, %xmm3
psrld $0x2, %xmm1
pand %xmm0, %xmm1
paddd %xmm3, %xmm1
movdqa %xmm1, %xmm0
psrld $0x4, %xmm0
paddd %xmm1, %xmm0
pand 0x54f59(%rip), %xmm0    # 0xbcbc0
pshufd $0xee, %xmm2, %xmm1     # xmm1 = xmm2[2,3,2,3]
paddd %xmm2, %xmm1
pshufd $0x55, %xmm1, %xmm2     # xmm2 = xmm1[1,1,1,1]
paddd %xmm1, %xmm2
movd %xmm2, %edi
pshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
paddd %xmm0, %xmm1
movd %xmm1, %r9d
addl %r8d, %r9d
addl %edi, %r9d
imull $0x1010101, %r9d, %edi  # imm = 0x1010101
shrl $0x18, %edi
addq %rdi, %rax
cmpq $0x1b, %rsi
jg 0x67b8f
xorl %edi, %edi
cmpq %rdi, %rsi
je 0x67cc1
movzbl (%rdx,%rdi), %r8d
movzbl (%r8,%rcx), %r8d
addq %r8, %rax
incq %rdi
jmp 0x67caa
retq