#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 *, int *);
int main() {
  int number = 0;
  scanf("%d", &number);
  int divider = 2;
  int count = 0;
  while (number > 1) {
    int remainder = number % 2;
    if (remainder)
      count++;
    number = number / 2;
  }
  if (number == 1)
    count++;
  printf("%d\n", count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x2,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1192 <main+0x72>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     117f <main+0x5f>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1154 <main+0x34>
cmpl   $0x1,-0x8(%rbp)
jne    11a5 <main+0x85>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xed0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
xor    %eax,%eax
cmp    $0x2,%ecx
jl     1164 <main+0x44>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
mov    %ecx,%edx
mov    %ecx,%esi
and    $0x1,%esi
add    %esi,%eax
shr    %ecx
cmp    $0x3,%edx
ja     1150 <main+0x30>
mov    %ecx,0x4(%rsp)
xor    %esi,%esi
cmp    $0x1,%ecx
sete   %sil
add    %eax,%esi
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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