#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 bitcnt(int);
int bitcnt_e(int);
int bitcnt_f(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  int value;
  printf("Please provide a integer for bit count test : \n");
  scanf("0x%x", &value);
  printf("Value 0x%x Bit Count %d\n", value, bitcnt(value));
  printf("Value 0x%x Bit Count %d\n", value, bitcnt_e(value));
  printf("Value 0x%x Bit Count %d\n", value, bitcnt_f(value));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1070 <bitcnt@plt>
mov    -0x20(%rbp),%esi
mov    %eax,%edx
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <bitcnt_e@plt>
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <bitcnt_f@plt>
mov    -0x18(%rbp),%esi
mov    %eax,%edx
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
lea    0xe89(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%ebx
mov    %ebx,%edi
call   1080 <bitcnt@plt>
lea    0xe72(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%ebx
mov    %ebx,%edi
call   1060 <bitcnt_e@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%ebx
mov    %ebx,%edi
call   1040 <bitcnt_f@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [48 x i8] c"Please provide a integer for bit count test : \0A\00"
@.str.1 = [5 x i8] c"0x%x\00"
@.str.2 = [25 x i8] c"Value 0x%x Bit Count %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%8 = load i32, i32* %5
%9 = load i32, i32* %5
%10 = call i32 @bitcnt(i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %10)
%12 = load i32, i32* %5
%13 = load i32, i32* %5
%14 = call i32 @bitcnt_e(i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %12, i32 %14)
%16 = load i32, i32* %5
%17 = load i32, i32* %5
%18 = call i32 @bitcnt_f(i32 %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 %18)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"0x%x\00"
@.str.2 = [25 x i8] c"Value 0x%x Bit Count %d\0A\00"
@str = [47 x i8] c"Please provide a integer for bit count test : \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = call i32 @bitcnt(i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8)
%10 = load i32, i32* %3
%11 = call i32 @bitcnt_e(i32 %10)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %10, i32 %11)
%13 = load i32, i32* %3
%14 = call i32 @bitcnt_f(i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %13, i32 %14)
ret i32 0
}