#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 odd_ones(unsigned int);
int /*<<< orphan*/ printf(char *, unsigned int, int);
int main(void) {
  unsigned x;
  x = 1;
  printf("%u has odd ones: %d\n", x, odd_ones(x));
  x = 3;
  printf("%u has odd ones: %d\n", x, odd_ones(x));
  x = 7;
  printf("%u has odd ones: %d\n", x, odd_ones(x));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <odd_ones@plt>
mov    -0x14(%rbp),%esi
mov    %eax,%edx
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
movl   $0x3,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <odd_ones@plt>
mov    -0x10(%rbp),%esi
mov    %eax,%edx
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
movl   $0x7,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <odd_ones@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
call   1040 <odd_ones@plt>
lea    0xece(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <odd_ones@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x7,%edi
call   1040 <odd_ones@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"%u has odd ones: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @odd_ones(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %5)
store i32 3, i32* %2
%7 = load i32, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @odd_ones(i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %9)
store i32 7, i32* %2
%11 = load i32, i32* %2
%12 = load i32, i32* %2
%13 = call i32 @odd_ones(i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"%u has odd ones: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @odd_ones(i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 1, i32 %1)
%3 = tail call i32 @odd_ones(i32 3)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 3, i32 %3)
%5 = tail call i32 @odd_ones(i32 7)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 7, i32 %5)
ret i32 0
}