#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 bitcount(int);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int x = 0xaaaa5555;
  int n = x + 20;
  while (x < n) {
    printf("%08x : %d\n", x, bitcount(x));
    x++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xaaaa5555,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x14,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1178 <main+0x58>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <bitcount@plt>
mov    -0x10(%rbp),%esi
mov    %eax,%edx
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113f <main+0x1f>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xaaaa5555,%edi
call   1040 <bitcount@plt>
lea    0xece(%rip),%rbx
mov    %rbx,%rdi
mov    $0xaaaa5555,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xaaaa5556,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xaaaa5556,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xaaaa5557,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xaaaa5557,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xaaaa5558,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xaaaa5558,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xaaaa5559,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xaaaa5559,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xaaaa555a,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xaaaa555a,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xaaaa555b,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xaaaa555b,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xaaaa555c,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xaaaa555c,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xaaaa555d,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xaaaa555d,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xaaaa555e,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xaaaa555e,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xaaaa555f,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xaaaa555f,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xaaaa5560,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xaaaa5560,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xaaaa5561,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xaaaa5561,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xaaaa5562,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xaaaa5562,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xaaaa5563,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xaaaa5563,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xaaaa5564,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xaaaa5564,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xaaaa5565,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xaaaa5565,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xaaaa5566,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xaaaa5566,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xaaaa5567,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xaaaa5567,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xaaaa5568,%edi
call   1040 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xaaaa5568,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%08x : %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 -1431677611, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 20
store i32 %5, i32* %3
br label %6
6: ; preds = %10, %0
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i32, i32* %2
%12 = load i32, i32* %2
%13 = call i32 @bitcount(i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %13)
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %6
17: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"%08x : %d\0A\00"
define i32 @main() {
%1 = tail call i32 @bitcount(i32 -1431677611)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677611, i32 %1)
%3 = tail call i32 @bitcount(i32 -1431677610)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677610, i32 %3)
%5 = tail call i32 @bitcount(i32 -1431677609)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677609, i32 %5)
%7 = tail call i32 @bitcount(i32 -1431677608)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677608, i32 %7)
%9 = tail call i32 @bitcount(i32 -1431677607)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677607, i32 %9)
%11 = tail call i32 @bitcount(i32 -1431677606)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677606, i32 %11)
%13 = tail call i32 @bitcount(i32 -1431677605)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677605, i32 %13)
%15 = tail call i32 @bitcount(i32 -1431677604)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677604, i32 %15)
%17 = tail call i32 @bitcount(i32 -1431677603)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677603, i32 %17)
%19 = tail call i32 @bitcount(i32 -1431677602)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677602, i32 %19)
%21 = tail call i32 @bitcount(i32 -1431677601)
%22 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677601, i32 %21)
%23 = tail call i32 @bitcount(i32 -1431677600)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677600, i32 %23)
%25 = tail call i32 @bitcount(i32 -1431677599)
%26 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677599, i32 %25)
%27 = tail call i32 @bitcount(i32 -1431677598)
%28 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677598, i32 %27)
%29 = tail call i32 @bitcount(i32 -1431677597)
%30 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677597, i32 %29)
%31 = tail call i32 @bitcount(i32 -1431677596)
%32 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677596, i32 %31)
%33 = tail call i32 @bitcount(i32 -1431677595)
%34 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677595, i32 %33)
%35 = tail call i32 @bitcount(i32 -1431677594)
%36 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677594, i32 %35)
%37 = tail call i32 @bitcount(i32 -1431677593)
%38 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677593, i32 %37)
%39 = tail call i32 @bitcount(i32 -1431677592)
%40 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 -1431677592, i32 %39)
ret i32 0
}