#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
unsigned int _count_bits(register size_t c) {
  c = c - ((c >> 1) & 0x5555555555555555);
  c = ((c >> 2) & 0x3333333333333333) + (c & 0x3333333333333333);
  c = ((c >> 4) + c) & 0x0F0F0F0F0F0F0F0F;
  c = ((c >> 8) + c) & 0x0000000000FF00FF;
  c = ((c >> 16) + c) & 0x0000FFFF0000FFFF;
  c = ((c >> 32) + c) & 0x00000000FFFFFFFF;
  return c;
}


x86 assembly (clang, -O0):
<_count_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x1,%rcx
movabs $0x5555555555555555,%rdx
55 55 55
and    %rdx,%rcx
sub    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x2,%rax
movabs $0x3333333333333333,%rcx
33 33 33
and    %rcx,%rax
movabs $0x3333333333333333,%rcx
33 33 33
and    -0x8(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x4,%rax
add    -0x8(%rbp),%rax
movabs $0xf0f0f0f0f0f0f0f,%rcx
0f 0f 0f
and    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x8,%rax
add    -0x8(%rbp),%rax
and    $0xff00ff,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
add    -0x8(%rbp),%rax
movabs $0xffff0000ffff,%rcx
and    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x20,%rax
add    -0x8(%rbp),%rax
movabs $0xffffffff,%rcx
and    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_count_bits>:
mov    %rdi,%rax
shr    %rax
movabs $0x5555555555555555,%rcx
55 55 55
and    %rax,%rcx
sub    %rcx,%rdi
mov    %rdi,%rax
shr    $0x2,%rax
movabs $0x3333333333333333,%rcx
33 33 33
and    %rcx,%rax
and    %rcx,%rdi
add    %rax,%rdi
mov    %rdi,%rax
shr    $0x4,%rax
add    %rdi,%rax
movabs $0xf0f0f0f0f0f0f0f,%rcx
0f 0f 0f
and    %rax,%rcx
mov    %rcx,%rax
shr    $0x8,%rax
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x10,%ecx
add    %eax,%ecx
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @_count_bits(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = load i64, i64* %2
%5 = lshr i64 %4, 1
%6 = and i64 %5, 6148914691236517205
%7 = sub i64 %3, %6
store i64 %7, i64* %2
%8 = load i64, i64* %2
%9 = lshr i64 %8, 2
%10 = and i64 %9, 3689348814741910323
%11 = load i64, i64* %2
%12 = and i64 %11, 3689348814741910323
%13 = add i64 %10, %12
store i64 %13, i64* %2
%14 = load i64, i64* %2
%15 = lshr i64 %14, 4
%16 = load i64, i64* %2
%17 = add i64 %15, %16
%18 = and i64 %17, 1085102592571150095
store i64 %18, i64* %2
%19 = load i64, i64* %2
%20 = lshr i64 %19, 8
%21 = load i64, i64* %2
%22 = add i64 %20, %21
%23 = and i64 %22, 16711935
store i64 %23, i64* %2
%24 = load i64, i64* %2
%25 = lshr i64 %24, 16
%26 = load i64, i64* %2
%27 = add i64 %25, %26
%28 = and i64 %27, 281470681808895
store i64 %28, i64* %2
%29 = load i64, i64* %2
%30 = lshr i64 %29, 32
%31 = load i64, i64* %2
%32 = add i64 %30, %31
%33 = and i64 %32, 4294967295
store i64 %33, i64* %2
%34 = load i64, i64* %2
%35 = trunc i64 %34 to i32
ret i32 %35
}

LLVM IR (-O2):
define i32 @_count_bits(i64 %0) {
%2 = lshr i64 %0, 1
%3 = and i64 %2, 6148914691236517205
%4 = sub i64 %0, %3
%5 = lshr i64 %4, 2
%6 = and i64 %5, 3689348814741910323
%7 = and i64 %4, 3689348814741910323
%8 = add nuw nsw i64 %6, %7
%9 = lshr i64 %8, 4
%10 = add nuw nsw i64 %9, %8
%11 = and i64 %10, 1085102592571150095
%12 = lshr i64 %11, 8
%13 = add nuw nsw i64 %12, %11
%14 = lshr i64 %13, 16
%15 = and i64 %14, 31
%16 = add nuw nsw i64 %15, %13
%17 = trunc i64 %16 to i32
%18 = and i32 %17, 63
ret i32 %18
}