#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 */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, long *);
int main() {
  long input;
  scanf("%d", &input);
  int s = 1;
  int count = 0;
  for (int i = 0; i < 32; i++) {
    if (input & s) {
      count++;
    }
    s <<= 1;
  }
  printf("%d", count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x20,-0x1c(%rbp)
jge    1193 <main+0x73>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
and    %rcx,%rax
cmp    $0x0,%rax
je     117c <main+0x5c>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1154 <main+0x34>
mov    -0x18(%rbp),%esi
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    $0x1,%eax
xor    %esi,%esi
mov    $0x20,%ecx
mov    (%rsp),%rdx
cltq
mov    %rdx,%rdi
and    %rax,%rdi
cmp    $0x1,%rdi
sbb    $0xffffffff,%esi
lea    (%rax,%rax,1),%edi
movslq %edi,%rdi
and    %rdx,%rdi
cmp    $0x1,%rdi
sbb    $0xffffffff,%esi
shl    $0x2,%eax
add    $0xfffffffe,%ecx
jne    1140 <main+0x20>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64* %2)
store i32 1, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %22, %0
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 32
br i1 %9, label %10, label %25
10: ; preds = %7
%11 = load i64, i64* %2
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = and i64 %11, %13
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %10
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %19
19: ; preds = %16, %10
%20 = load i32, i32* %3
%21 = shl i32 %20, 1
store i32 %21, i32* %3
br label %22
22: ; preds = %19
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %7
25: ; preds = %7
%26 = load i32, i32* %4
%27 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64* %1)
%4 = load i64, i64* %1
br label %7
5: ; preds = %7
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %21)
ret i32 0
7: ; preds = %7, %0
%8 = phi i32 [ 0, %0 ], [ %23, %7 ]
%9 = phi i32 [ 0, %0 ], [ %21, %7 ]
%10 = phi i32 [ 1, %0 ], [ %22, %7 ]
%11 = sext i32 %10 to i64
%12 = and i64 %4, %11
%13 = icmp ne i64 %12, 0
%14 = zext i1 %13 to i32
%15 = add nuw nsw i32 %9, %14
%16 = shl i32 %10, 1
%17 = sext i32 %16 to i64
%18 = and i64 %4, %17
%19 = icmp ne i64 %18, 0
%20 = zext i1 %19 to i32
%21 = add nuw nsw i32 %15, %20
%22 = shl i32 %10, 2
%23 = add nuw nsw i32 %8, 2
%24 = icmp eq i32 %23, 32
br i1 %24, label %5, label %7
}