#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 bitcount1(int);
int bitcount2(int);
int /*<<< orphan*/ dec_bin(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int x = 0;
  int rez = 0;
  printf("insert please number:");
  scanf("%d", &x);
  printf("\ngettend x = %30d;\nand in bin = %29lu;\n\n", x, dec_bin(x));
  rez = bitcount1(x);
  printf("rezult of counting bits = %16d;\n", rez);
  rez = bitcount2(x);
  printf("rezult 2 of counting bits = %14d;\n", rez);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9b(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <dec_bin@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <bitcount1@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1060 <bitcount2@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xe9c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
call   1050 <dec_bin@plt>
lea    0xe8b(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%edi
call   1030 <bitcount1@plt>
lea    0xe99(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%edi
call   1060 <bitcount2@plt>
lea    0xea1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"insert please number:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [41 x i8] c"\0Agettend x = %30d;\0Aand in bin = %29lu;\0A\0A\00"
@.str.3 = [33 x i8] c"rezult of counting bits = %16d;\0A\00"
@.str.4 = [35 x i8] c"rezult 2 of counting bits = %14d;\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = load i32, i32* %1
%7 = call i32 @dec_bin(i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %7)
%9 = load i32, i32* %1
%10 = call i32 @bitcount1(i32 %9)
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %1
%14 = call i32 @bitcount2(i32 %13)
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %15)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"insert please number:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [41 x i8] c"\0Agettend x = %30d;\0Aand in bin = %29lu;\0A\0A\00"
@.str.3 = [33 x i8] c"rezult of counting bits = %16d;\0A\00"
@.str.4 = [35 x i8] c"rezult 2 of counting bits = %14d;\0A\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @dec_bin(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %6)
%8 = load i32, i32* %1
%9 = call i32 @bitcount1(i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %1
%12 = call i32 @bitcount2(i32 %11)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %12)
ret void
}