#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 countBits(unsigned int, int);
int /*<<< orphan*/ printBits(unsigned int);
int /*<<< orphan*/ printf(char *, ...);
void test4() {
  unsigned int a = 0x6F245FF2;
  unsigned int b = 0x7F67FF89;
  printf("a:\n");
  printBits(a);
  printf("countBits(a,1)=%d\n", countBits(a, 1));
  printf("countBits(a,0)=%d\n", countBits(a, 0));
  printf("b:\n");
  printBits(b);
  printf("countBits(b,1)=%d\n", countBits(b, 1));
  printf("countBits(b,0)=%d\n", countBits(b, 0));
}


x86 assembly (clang, -O0):
<test4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x6f245ff2,-0x4(%rbp)
movl   $0x7f67ff89,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <printBits@plt>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <countBits@plt>
mov    %eax,%esi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1030 <countBits@plt>
mov    %eax,%esi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
call   1040 <printBits@plt>
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
call   1030 <countBits@plt>
mov    %eax,%esi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
xor    %esi,%esi
call   1030 <countBits@plt>
mov    %eax,%esi
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test4>:
push   %rax
lea    0xf04(%rip),%rdi
call   1030 <puts@plt>
mov    $0x6f245ff2,%edi
call   1050 <printBits@plt>
mov    $0x6f245ff2,%edi
mov    $0x1,%esi
call   1040 <countBits@plt>
lea    0xe93(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x6f245ff2,%edi
xor    %esi,%esi
call   1040 <countBits@plt>
lea    0xe8a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
mov    $0x7f67ff89,%edi
call   1050 <printBits@plt>
mov    $0x7f67ff89,%edi
mov    $0x1,%esi
call   1040 <countBits@plt>
lea    0xe68(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x7f67ff89,%edi
xor    %esi,%esi
call   1040 <countBits@plt>
lea    0xe5f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
pop    %rcx
jmp    1060 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"a:\0A\00"
@.str.1 = [19 x i8] c"countBits(a,1)=%d\0A\00"
@.str.2 = [19 x i8] c"countBits(a,0)=%d\0A\00"
@.str.3 = [4 x i8] c"b:\0A\00"
@.str.4 = [19 x i8] c"countBits(b,1)=%d\0A\00"
@.str.5 = [19 x i8] c"countBits(b,0)=%d\0A\00"
define void @test4() {
%1 = alloca i32
%2 = alloca i32
store i32 1864654834, i32* %1
store i32 2137522057, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %1
%5 = call i32 @printBits(i32 %4)
%6 = load i32, i32* %1
%7 = call i32 @countBits(i32 %6, i32 1)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %1
%10 = call i32 @countBits(i32 %9, i32 0)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%13 = load i32, i32* %2
%14 = call i32 @printBits(i32 %13)
%15 = load i32, i32* %2
%16 = call i32 @countBits(i32 %15, i32 1)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %2
%19 = call i32 @countBits(i32 %18, i32 0)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %19)
ret void
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"countBits(a,1)=%d\0A\00"
@.str.2 = [19 x i8] c"countBits(a,0)=%d\0A\00"
@.str.4 = [19 x i8] c"countBits(b,1)=%d\0A\00"
@.str.5 = [19 x i8] c"countBits(b,0)=%d\0A\00"
@str = [3 x i8] c"a:\00"
@str.6 = [3 x i8] c"b:\00"
define void @test4() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @printBits(i32 1864654834)
%3 = tail call i32 @countBits(i32 1864654834, i32 1)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 @countBits(i32 1864654834, i32 0)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.6, i64 0, i64 0))
%8 = tail call i32 @printBits(i32 2137522057)
%9 = tail call i32 @countBits(i32 2137522057, i32 1)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %9)
%11 = tail call i32 @countBits(i32 2137522057, i32 0)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %11)
ret void
}