#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*/ printbits(unsigned int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ putchar(char);
int main(void) {
  int x;
  x = 1212;
  printbits((unsigned)x);
  printf(" (%d) contains %u 1-bits\n", x, bitcount(x));
  x = 3425;
  printbits((unsigned)x);
  printf(" (%d) contains %u 1-bits\n", x, bitcount(x));
  x = -128;
  printbits((unsigned)x);
  printf(" (%d) contains %u 1-bits\n", x, bitcount(x));
  x = 0xFA0A0A0A;
  printbits((unsigned)x);
  printf(" (%d) contains %u 1-bits\n", x, bitcount(x));
  (void)putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4bc,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <printbits@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <bitcount@plt>
mov    -0x18(%rbp),%esi
mov    %eax,%edx
lea    0xe88(%rip),%rdi
call   1040 <printf@plt>
movl   $0xd61,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <printbits@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <bitcount@plt>
mov    -0x14(%rbp),%esi
mov    %eax,%edx
lea    0xe5a(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffff80,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <printbits@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <bitcount@plt>
mov    -0x10(%rbp),%esi
mov    %eax,%edx
lea    0xe2c(%rip),%rdi
call   1040 <printf@plt>
movl   $0xfa0a0a0a,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <printbits@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <bitcount@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xdfe(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x4bc,%edi
call   1060 <printbits@plt>
mov    $0x4bc,%edi
call   1050 <bitcount@plt>
lea    0xea4(%rip),%rbx
mov    %rbx,%rdi
mov    $0x4bc,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0xd61,%edi
call   1060 <printbits@plt>
mov    $0xd61,%edi
call   1050 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xd61,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0xffffff80,%edi
call   1060 <printbits@plt>
mov    $0xffffff80,%edi
call   1050 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xffffff80,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0xfa0a0a0a,%edi
call   1060 <printbits@plt>
mov    $0xfa0a0a0a,%edi
call   1050 <bitcount@plt>
mov    %rbx,%rdi
mov    $0xfa0a0a0a,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c" (%d) contains %u 1-bits\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1212, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printbits(i32 %3)
%5 = load i32, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @bitcount(i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %7)
store i32 3425, i32* %2
%9 = load i32, i32* %2
%10 = call i32 @printbits(i32 %9)
%11 = load i32, i32* %2
%12 = load i32, i32* %2
%13 = call i32 @bitcount(i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %13)
store i32 -128, i32* %2
%15 = load i32, i32* %2
%16 = call i32 @printbits(i32 %15)
%17 = load i32, i32* %2
%18 = load i32, i32* %2
%19 = call i32 @bitcount(i32 %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %19)
store i32 -100005366, i32* %2
%21 = load i32, i32* %2
%22 = call i32 @printbits(i32 %21)
%23 = load i32, i32* %2
%24 = load i32, i32* %2
%25 = call i32 @bitcount(i32 %24)
%26 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %23, i32 %25)
%27 = call i32 @putchar(i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c" (%d) contains %u 1-bits\0A\00"
define i32 @main() {
%1 = tail call i32 @printbits(i32 1212)
%2 = tail call i32 @bitcount(i32 1212)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 1212, i32 %2)
%4 = tail call i32 @printbits(i32 3425)
%5 = tail call i32 @bitcount(i32 3425)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 3425, i32 %5)
%7 = tail call i32 @printbits(i32 -128)
%8 = tail call i32 @bitcount(i32 -128)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 -128, i32 %8)
%10 = tail call i32 @printbits(i32 -100005366)
%11 = tail call i32 @bitcount(i32 -100005366)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 -100005366, i32 %11)
%13 = tail call i32 @putchar(i8 signext 10)
ret i32 0
}