// File: /workspace/github_c_makefile_star2_O0/FastFilter[P]BlockBloomSimulator/src/bitset.c
// Function: bitset_count
size_t bitset_count(const bitset_t *bitset) {
    size_t card = 0;
    size_t k = 0;
    // assumes that long long is 8 bytes
    for(; k + 7 < bitset->arraysize; k+=8) {
        card += __builtin_popcountll(bitset->array[k]);
        card += __builtin_popcountll(bitset->array[k+1]);
        card += __builtin_popcountll(bitset->array[k+2]);
        card += __builtin_popcountll(bitset->array[k+3]);
        card += __builtin_popcountll(bitset->array[k+4]);
        card += __builtin_popcountll(bitset->array[k+5]);
        card += __builtin_popcountll(bitset->array[k+6]);
        card += __builtin_popcountll(bitset->array[k+7]);
    }
    for(; k + 3 < bitset->arraysize; k+=4) {
        card += __builtin_popcountll(bitset->array[k]);
        card += __builtin_popcountll(bitset->array[k+1]);
        card += __builtin_popcountll(bitset->array[k+2]);
        card += __builtin_popcountll(bitset->array[k+3]);
    }
    for(; k < bitset->arraysize; k++) {
        card += __builtin_popcountll(bitset->array[k]);
    }
    return card;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq $0x0, -0x10(%rsp)
movq $0x0, -0x18(%rsp)
movq -0x18(%rsp), %rax
addq $0x7, %rax
movq -0x8(%rsp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x3f19
movq -0x8(%rsp), %rax
movq (%rax), %rax
movq -0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rcx
movq %rcx, %rax
shrq %rax
movabsq $0x5555555555555555, %rdx # imm = 0x5555555555555555
andq %rdx, %rax
subq %rax, %rcx
movabsq $0x3333333333333333, %rdx # imm = 0x3333333333333333
movq %rcx, %rax
andq %rdx, %rax
shrq $0x2, %rcx
andq %rdx, %rcx
addq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
addq %rcx, %rax
movabsq $0xf0f0f0f0f0f0f0f, %rcx # imm = 0xF0F0F0F0F0F0F0F
andq %rcx, %rax
movabsq $0x101010101010101, %rcx # imm = 0x101010101010101
imulq %rcx, %rax
shrq $0x38, %rax
cltq
addq -0x10(%rsp), %rax
movq %rax, -0x10(%rsp)
movq -0x8(%rsp), %rax
movq (%rax), %rax
movq -0x18(%rsp), %rcx
movq 0x8(%rax,%rcx,8), %rcx
movq %rcx, %rax
shrq %rax
movabsq $0x5555555555555555, %rdx # imm = 0x5555555555555555
andq %rdx, %rax
subq %rax, %rcx
movabsq $0x3333333333333333, %rdx # imm = 0x3333333333333333
movq %rcx, %rax
andq %rdx, %rax
shrq $0x2, %rcx
andq %rdx, %rcx
addq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
addq %rcx, %rax
movabsq $0xf0f0f0f0f0f0f0f, %rcx # imm = 0xF0F0F0F0F0F0F0F
andq %rcx, %rax
movabsq $0x101010101010101, %rcx # imm = 0x101010101010101
imulq %rcx, %rax
shrq $0x38, %rax
cltq
addq -0x10(%rsp), %rax
movq %rax, -0x10(%rsp)
movq -0x8(%rsp), %rax
movq (%rax), %rax
movq -0x18(%rsp), %rcx
movq 0x10(%rax,%rcx,8), %rcx
movq %rcx, %rax
shrq %rax
movabsq $0x5555555555555555, %rdx # imm = 0x5555555555555555
andq %rdx, %rax
subq %rax, %rcx
movabsq $0x3333333333333333, %rdx # imm = 0x3333333333333333
movq %rcx, %rax
andq %rdx, %rax
shrq $0x2, %rcx
andq %rdx, %rcx
addq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
addq %rcx, %rax
movabsq $0xf0f0f0f0f0f0f0f, %rcx # imm = 0xF0F0F0F0F0F0F0F
andq %rcx, %rax
movabsq $0x101010101010101, %rcx # imm = 0x101010101010101
imulq %rcx, %rax
shrq $0x38, %rax
cltq
addq -0x10(%rsp), %rax
movq %rax, -0x10(%rsp)
movq -0x8(%rsp), %rax
movq (%rax), %rax
movq -0x18(%rsp), %rcx
movq 0x18(%rax,%rcx,8), %rcx
movq %rcx, %rax
shrq %rax
movabsq $0x5555555555555555, %rdx # imm = 0x5555555555555555
andq %rdx, %rax
subq %rax, %rcx
movabsq $0x3333333333333333, %rdx # imm = 0x3333333333333333
movq %rcx, %rax
andq %rdx, %rax
shrq $0x2, %rcx
andq %rdx, %rcx
addq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
addq %rcx, %rax
movabsq $0xf0f0f0f0f0f0f0f, %rcx # imm = 0xF0F0F0F0F0F0F0F
andq %rcx, %rax
movabsq $0x101010101010101, %rcx # imm = 0x101010101010101
imulq %rcx, %rax
shrq $0x38, %rax
cltq
addq -0x10(%rsp), %rax
movq %rax, -0x10(%rsp)
movq -0x8(%rsp), %rax
movq (%rax), %rax
movq -0x18(%rsp), %rcx
movq 0x20(%rax,%rcx,8), %rcx
movq %rcx, %rax
shrq %rax
movabsq $0x5555555555555555, %rdx # imm = 0x5555555555555555
andq %rdx, %rax
subq %rax, %rcx
movabsq $0x3333333333333333, %rdx # imm = 0x3333333333333333
movq %rcx, %rax
andq %rdx, %rax
shrq $0x2, %rcx
andq %rdx, %rcx
addq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
addq %rcx, %rax
movabsq $0xf0f0f0f0f0f0f0f, %rcx # imm = 0xF0F0F0F0F0F0F0F
andq %rcx, %rax
movabsq $0x101010101010101, %rcx # imm = 0x101010101010101
imulq %rcx, %rax
shrq $0x38, %rax
cltq
addq -0x10(%rsp), %rax
movq %rax, -0x10(%rsp)
movq -0x8(%rsp), %rax
movq (%rax), %rax
movq -0x18(%rsp), %rcx
movq 0x28(%rax,%rcx,8), %rcx
movq %rcx, %rax
shrq %rax
movabsq $0x5555555555555555, %rdx # imm = 0x5555555555555555
andq %rdx, %rax
subq %rax, %rcx
movabsq $0x3333333333333333, %rdx # imm = 0x3333333333333333
movq %rcx, %rax
andq %rdx, %rax
shrq $0x2, %rcx
andq %rdx, %rcx
addq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
addq %rcx, %rax
movabsq $0xf0f0f0f0f0f0f0f, %rcx # imm = 0xF0F0F0F0F0F0F0F
andq %rcx, %rax
movabsq $0x101010101010101, %rcx # imm = 0x101010101010101
imulq %rcx, %rax
shrq $0x38, %rax
cltq
addq -0x10(%rsp), %rax
movq %rax, -0x10(%rsp)
movq -0x8(%rsp), %rax
movq (%rax), %rax
movq -0x18(%rsp), %rcx
movq 0x30(%rax,%rcx,8), %rcx
movq %rcx, %rax
shrq %rax
movabsq $0x5555555555555555, %rdx # imm = 0x5555555555555555
andq %rdx, %rax
subq %rax, %rcx
movabsq $0x3333333333333333, %rdx # imm = 0x3333333333333333
movq %rcx, %rax
andq %rdx, %rax
shrq $0x2, %rcx
andq %rdx, %rcx
addq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
addq %rcx, %rax
movabsq $0xf0f0f0f0f0f0f0f, %rcx # imm = 0xF0F0F0F0F0F0F0F
andq %rcx, %rax
movabsq $0x101010101010101, %rcx # imm = 0x101010101010101
imulq %rcx, %rax
shrq $0x38, %rax
cltq
addq -0x10(%rsp), %rax
movq %rax, -0x10(%rsp)
movq -0x8(%rsp), %rax
movq (%rax), %rax
movq -0x18(%rsp), %rcx
movq 0x38(%rax,%rcx,8), %rcx
movq %rcx, %rax
shrq %rax
movabsq $0x5555555555555555, %rdx # imm = 0x5555555555555555
andq %rdx, %rax
subq %rax, %rcx
movabsq $0x3333333333333333, %rdx # imm = 0x3333333333333333
movq %rcx, %rax
andq %rdx, %rax
shrq $0x2, %rcx
andq %rdx, %rcx
addq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
addq %rcx, %rax
movabsq $0xf0f0f0f0f0f0f0f, %rcx # imm = 0xF0F0F0F0F0F0F0F
andq %rcx, %rax
movabsq $0x101010101010101, %rcx # imm = 0x101010101010101
imulq %rcx, %rax
shrq $0x38, %rax
cltq
addq -0x10(%rsp), %rax
movq %rax, -0x10(%rsp)
movq -0x18(%rsp), %rax
addq $0x8, %rax
movq %rax, -0x18(%rsp)
jmp 0x3b37
jmp 0x3f1b
movq -0x18(%rsp), %rax
addq $0x3, %rax
movq -0x8(%rsp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x4121
movq -0x8(%rsp), %rax
movq (%rax), %rax
movq -0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rcx
movq %rcx, %rax
shrq %rax
movabsq $0x5555555555555555, %rdx # imm = 0x5555555555555555
andq %rdx, %rax
subq %rax, %rcx
movabsq $0x3333333333333333, %rdx # imm = 0x3333333333333333
movq %rcx, %rax
andq %rdx, %rax
shrq $0x2, %rcx
andq %rdx, %rcx
addq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
addq %rcx, %rax
movabsq $0xf0f0f0f0f0f0f0f, %rcx # imm = 0xF0F0F0F0F0F0F0F
andq %rcx, %rax
movabsq $0x101010101010101, %rcx # imm = 0x101010101010101
imulq %rcx, %rax
shrq $0x38, %rax
cltq
addq -0x10(%rsp), %rax
movq %rax, -0x10(%rsp)
movq -0x8(%rsp), %rax
movq (%rax), %rax
movq -0x18(%rsp), %rcx
movq 0x8(%rax,%rcx,8), %rcx
movq %rcx, %rax
shrq %rax
movabsq $0x5555555555555555, %rdx # imm = 0x5555555555555555
andq %rdx, %rax
subq %rax, %rcx
movabsq $0x3333333333333333, %rdx # imm = 0x3333333333333333
movq %rcx, %rax
andq %rdx, %rax
shrq $0x2, %rcx
andq %rdx, %rcx
addq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
addq %rcx, %rax
movabsq $0xf0f0f0f0f0f0f0f, %rcx # imm = 0xF0F0F0F0F0F0F0F
andq %rcx, %rax
movabsq $0x101010101010101, %rcx # imm = 0x101010101010101
imulq %rcx, %rax
shrq $0x38, %rax
cltq
addq -0x10(%rsp), %rax
movq %rax, -0x10(%rsp)
movq -0x8(%rsp), %rax
movq (%rax), %rax
movq -0x18(%rsp), %rcx
movq 0x10(%rax,%rcx,8), %rcx
movq %rcx, %rax
shrq %rax
movabsq $0x5555555555555555, %rdx # imm = 0x5555555555555555
andq %rdx, %rax
subq %rax, %rcx
movabsq $0x3333333333333333, %rdx # imm = 0x3333333333333333
movq %rcx, %rax
andq %rdx, %rax
shrq $0x2, %rcx
andq %rdx, %rcx
addq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
addq %rcx, %rax
movabsq $0xf0f0f0f0f0f0f0f, %rcx # imm = 0xF0F0F0F0F0F0F0F
andq %rcx, %rax
movabsq $0x101010101010101, %rcx # imm = 0x101010101010101
imulq %rcx, %rax
shrq $0x38, %rax
cltq
addq -0x10(%rsp), %rax
movq %rax, -0x10(%rsp)
movq -0x8(%rsp), %rax
movq (%rax), %rax
movq -0x18(%rsp), %rcx
movq 0x18(%rax,%rcx,8), %rcx
movq %rcx, %rax
shrq %rax
movabsq $0x5555555555555555, %rdx # imm = 0x5555555555555555
andq %rdx, %rax
subq %rax, %rcx
movabsq $0x3333333333333333, %rdx # imm = 0x3333333333333333
movq %rcx, %rax
andq %rdx, %rax
shrq $0x2, %rcx
andq %rdx, %rcx
addq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
addq %rcx, %rax
movabsq $0xf0f0f0f0f0f0f0f, %rcx # imm = 0xF0F0F0F0F0F0F0F
andq %rcx, %rax
movabsq $0x101010101010101, %rcx # imm = 0x101010101010101
imulq %rcx, %rax
shrq $0x38, %rax
cltq
addq -0x10(%rsp), %rax
movq %rax, -0x10(%rsp)
movq -0x18(%rsp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rsp)
jmp 0x3f1b
jmp 0x4123
movq -0x18(%rsp), %rax
movq -0x8(%rsp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x41c0
movq -0x8(%rsp), %rax
movq (%rax), %rax
movq -0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rcx
movq %rcx, %rax
shrq %rax
movabsq $0x5555555555555555, %rdx # imm = 0x5555555555555555
andq %rdx, %rax
subq %rax, %rcx
movabsq $0x3333333333333333, %rdx # imm = 0x3333333333333333
movq %rcx, %rax
andq %rdx, %rax
shrq $0x2, %rcx
andq %rdx, %rcx
addq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
addq %rcx, %rax
movabsq $0xf0f0f0f0f0f0f0f, %rcx # imm = 0xF0F0F0F0F0F0F0F
andq %rcx, %rax
movabsq $0x101010101010101, %rcx # imm = 0x101010101010101
imulq %rcx, %rax
shrq $0x38, %rax
cltq
addq -0x10(%rsp), %rax
movq %rax, -0x10(%rsp)
movq -0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rsp)
jmp 0x4123
movq -0x10(%rsp), %rax
retq
nopw %cs:(%rax,%rax)