// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/hyperloglog.c
// Function: hllDenseSum
double hllDenseSum(uint8_t *registers, double *PE, int *ezp) {
    double E = 0;
    int j, ez = 0;

    /* Redis default is to use 16384 registers 6 bits each. The code works
     * with other values by modifying the defines, but for our target value
     * we take a faster path with unrolled loops. */
    if (HLL_REGISTERS == 16384 && HLL_BITS == 6) {
        uint8_t *r = registers;
        unsigned long r0, r1, r2, r3, r4, r5, r6, r7, r8, r9,
                      r10, r11, r12, r13, r14, r15;
        for (j = 0; j < 1024; j++) {
            /* Handle 16 registers per iteration. */
            r0 = r[0] & 63; if (r0 == 0) ez++;
            r1 = (r[0] >> 6 | r[1] << 2) & 63; if (r1 == 0) ez++;
            r2 = (r[1] >> 4 | r[2] << 4) & 63; if (r2 == 0) ez++;
            r3 = (r[2] >> 2) & 63; if (r3 == 0) ez++;
            r4 = r[3] & 63; if (r4 == 0) ez++;
            r5 = (r[3] >> 6 | r[4] << 2) & 63; if (r5 == 0) ez++;
            r6 = (r[4] >> 4 | r[5] << 4) & 63; if (r6 == 0) ez++;
            r7 = (r[5] >> 2) & 63; if (r7 == 0) ez++;
            r8 = r[6] & 63; if (r8 == 0) ez++;
            r9 = (r[6] >> 6 | r[7] << 2) & 63; if (r9 == 0) ez++;
            r10 = (r[7] >> 4 | r[8] << 4) & 63; if (r10 == 0) ez++;
            r11 = (r[8] >> 2) & 63; if (r11 == 0) ez++;
            r12 = r[9] & 63; if (r12 == 0) ez++;
            r13 = (r[9] >> 6 | r[10] << 2) & 63; if (r13 == 0) ez++;
            r14 = (r[10] >> 4 | r[11] << 4) & 63; if (r14 == 0) ez++;
            r15 = (r[11] >> 2) & 63; if (r15 == 0) ez++;

            /* Additional parens will allow the compiler to optimize the
             * code more with a loss of precision that is not very relevant
             * here (floating point math is not commutative!). */
            E += (PE[r0] + PE[r1]) + (PE[r2] + PE[r3]) + (PE[r4] + PE[r5]) +
                 (PE[r6] + PE[r7]) + (PE[r8] + PE[r9]) + (PE[r10] + PE[r11]) +
                 (PE[r12] + PE[r13]) + (PE[r14] + PE[r15]);
            r += 12;
        }
    } else {
        for (j = 0; j < HLL_REGISTERS; j++) {
            unsigned long reg;

            HLL_DENSE_GET_REGISTER(reg,registers,j);
            if (reg == 0) {
                ez++;
                /* Increment E at the end of the loop. */
            } else {
                E += PE[reg]; /* Precomputed 2^(-reg[j]). */
            }
        }
        E += ez; /* Add 2^0 'ez' times. */
    }
    *ezp = ez;
    return E;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, -0x68(%rsp)
movq %rdi, %rbp
xorpd %xmm0, %xmm0
xorl %eax, %eax
xorl %ecx, %ecx
cmpl $0x3000, %eax           # imm = 0x3000
je 0x706e4
movzbl (%rbp,%rax), %edi
xorl %r8d, %r8d
movl %edi, %edx
andl $0x3f, %edx
movq %rdx, (%rsp)
sete %r8b
movl %r8d, -0x74(%rsp)
shrl $0x6, %edi
movq %rdi, -0x30(%rsp)
movzbl 0x1(%rbp,%rax), %edx
movl %edx, %edi
andl $0xf, %edi
movq %rdi, -0x40(%rsp)
shrl $0x4, %edx
movzbl 0x2(%rbp,%rax), %ebx
movq %rbx, -0x70(%rsp)
shll $0x4, %ebx
andl $0x30, %ebx
orl %edx, %ebx
movzbl 0x3(%rbp,%rax), %edi
xorl %r8d, %r8d
movl %edi, %edx
andl $0x3f, %edx
movq %rdx, -0x8(%rsp)
sete %r8b
movl %r8d, -0x78(%rsp)
shrl $0x6, %edi
movq %rdi, -0x48(%rsp)
movzbl 0x4(%rbp,%rax), %edx
movl %edx, %edi
andl $0xf, %edi
movq %rdi, -0x50(%rsp)
shrl $0x4, %edx
movzbl 0x5(%rbp,%rax), %r12d
movq %r12, -0x10(%rsp)
xorl %r11d, %r11d
cmpl $0x4, %r12d
setb %r11b
shll $0x4, %r12d
andl $0x30, %r12d
orl %edx, %r12d
movzbl 0x6(%rbp,%rax), %r9d
xorl %edi, %edi
movl %r9d, %edx
andl $0x3f, %edx
movq %rdx, -0x18(%rsp)
sete %dil
movl %edi, -0x7c(%rsp)
shrl $0x6, %r9d
movzbl 0x7(%rbp,%rax), %edx
movl %edx, %edi
andl $0xf, %edi
movq %rdi, -0x60(%rsp)
shrl $0x4, %edx
movzbl 0x8(%rbp,%rax), %r14d
movq %r14, -0x20(%rsp)
xorl %edi, %edi
cmpl $0x4, %r14d
setb %dil
movl %edi, -0x80(%rsp)
shll $0x4, %r14d
andl $0x30, %r14d
orl %edx, %r14d
movzbl 0x9(%rbp,%rax), %edx
xorl %r10d, %r10d
movl %edx, %edi
andl $0x3f, %edi
movq %rdi, -0x28(%rsp)
sete %r10b
shrl $0x6, %edx
movzbl 0xa(%rbp,%rax), %r13d
movl %r13d, %edi
andl $0xf, %edi
leal (%rdx,%rdi,4), %edx
movq %rdx, -0x38(%rsp)
xorl %r8d, %r8d
testl %edx, %edx
sete %r8b
shrl $0x4, %r13d
movzbl 0xb(%rbp,%rax), %edx
movq %rdx, -0x58(%rsp)
xorl %edi, %edi
cmpl $0x4, %edx
setb %dil
shll $0x4, %edx
andl $0x30, %edx
orl %r13d, %edx
cmpl $0x4, -0x70(%rsp)
adcl -0x74(%rsp), %ecx
movq -0x30(%rsp), %r13
movq -0x40(%rsp), %r15
leal (%r13,%r15,4), %r13d
cmpl $0x1, %r13d
adcl -0x78(%rsp), %ecx
cmpl $0x1, %ebx
adcl %r11d, %ecx
movq -0x48(%rsp), %r15
movq -0x50(%rsp), %r11
leal (%r15,%r11,4), %r15d
cmpl $0x1, %r15d
adcl -0x7c(%rsp), %ecx
cmpl $0x1, %r12d
adcl -0x80(%rsp), %ecx
movq -0x60(%rsp), %r11
leal (%r9,%r11,4), %r9d
cmpl $0x1, %r9d
adcl %r10d, %ecx
cmpl $0x1, %r14d
adcl %edi, %ecx
cmpl $0x1, %edx
adcl %r8d, %ecx
movq (%rsp), %rdi
movsd (%rsi,%rdi,8), %xmm1
addsd (%rsi,%r13,8), %xmm1
movsd (%rsi,%rbx,8), %xmm2
movq -0x70(%rsp), %rdi
andl $-0x4, %edi
addsd (%rsi,%rdi,2), %xmm2
movq -0x8(%rsp), %rdi
movsd (%rsi,%rdi,8), %xmm3
addsd (%rsi,%r15,8), %xmm3
movsd (%rsi,%r12,8), %xmm4
movq -0x10(%rsp), %rdi
andl $-0x4, %edi
addsd (%rsi,%rdi,2), %xmm4
movq -0x18(%rsp), %rdi
movsd (%rsi,%rdi,8), %xmm5
addsd (%rsi,%r9,8), %xmm5
movsd (%rsi,%r14,8), %xmm6
movq -0x20(%rsp), %rdi
andl $-0x4, %edi
addsd (%rsi,%rdi,2), %xmm6
movq -0x28(%rsp), %rdi
movsd (%rsi,%rdi,8), %xmm7
movq -0x38(%rsp), %rdi
addsd (%rsi,%rdi,8), %xmm7
movsd (%rsi,%rdx,8), %xmm8
movq -0x58(%rsp), %rdx
andl $-0x4, %edx
addsd (%rsi,%rdx,2), %xmm8
addsd %xmm1, %xmm2
addsd %xmm2, %xmm3
addsd %xmm3, %xmm4
addsd %xmm4, %xmm5
addsd %xmm5, %xmm6
addsd %xmm6, %xmm7
addsd %xmm7, %xmm8
addsd %xmm8, %xmm0
addq $0xc, %rax
jmp 0x70478
movq -0x68(%rsp), %rax
movl %ecx, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq