#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 /*<<< orphan*/ buildTable();
int countingNumberofOneswithPreprocessing(int);
int /*<<< orphan*/ printf(char *, int, int);
void countingNumberofOneswithPreprocessing_test() {
  buildTable();
  int i = 10;
  printf("Number of one's in %d is/are %d\n", i,
         countingNumberofOneswithPreprocessing(i));
  i = 5;
  printf("Number of one's in %d is/are %d\n", i,
         countingNumberofOneswithPreprocessing(i));
  i = 100;
  printf("Number of one's in %d is/are %d\n", i,
         countingNumberofOneswithPreprocessing(i));
  i = 1;
  printf("Number of one's in %d is/are %d\n", i,
         countingNumberofOneswithPreprocessing(i));
  i = 0;
  printf("Number of one's in %d is/are %d\n", i,
         countingNumberofOneswithPreprocessing(i));
}


x86 assembly (clang, -O0):
<countingNumberofOneswithPreprocessing_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1050 <buildTable@plt>
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <countingNumberofOneswithPreprocessing@plt>
mov    -0x18(%rbp),%esi
mov    %eax,%edx
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <countingNumberofOneswithPreprocessing@plt>
mov    -0x14(%rbp),%esi
mov    %eax,%edx
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
movl   $0x64,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <countingNumberofOneswithPreprocessing@plt>
mov    -0x10(%rbp),%esi
mov    %eax,%edx
lea    0xe54(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <countingNumberofOneswithPreprocessing@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xe2e(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <countingNumberofOneswithPreprocessing@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xe08(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<countingNumberofOneswithPreprocessing_test>:
push   %rbx
xor    %eax,%eax
call   1050 <buildTable@plt>
mov    $0xa,%edi
call   1030 <countingNumberofOneswithPreprocessing@plt>
lea    0xeb7(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x5,%edi
call   1030 <countingNumberofOneswithPreprocessing@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x64,%edi
call   1030 <countingNumberofOneswithPreprocessing@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x1,%edi
call   1030 <countingNumberofOneswithPreprocessing@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %edi,%edi
call   1030 <countingNumberofOneswithPreprocessing@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"Number of one's in %d is/are %d\0A\00"
define void @countingNumberofOneswithPreprocessing_test() {
%1 = alloca i32
%2 = call i32 (...) @buildTable()
store i32 10, i32* %1
%3 = load i32, i32* %1
%4 = load i32, i32* %1
%5 = call i32 @countingNumberofOneswithPreprocessing(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %5)
store i32 5, i32* %1
%7 = load i32, i32* %1
%8 = load i32, i32* %1
%9 = call i32 @countingNumberofOneswithPreprocessing(i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %9)
store i32 100, i32* %1
%11 = load i32, i32* %1
%12 = load i32, i32* %1
%13 = call i32 @countingNumberofOneswithPreprocessing(i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %13)
store i32 1, i32* %1
%15 = load i32, i32* %1
%16 = load i32, i32* %1
%17 = call i32 @countingNumberofOneswithPreprocessing(i32 %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %17)
store i32 0, i32* %1
%19 = load i32, i32* %1
%20 = load i32, i32* %1
%21 = call i32 @countingNumberofOneswithPreprocessing(i32 %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %21)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"Number of one's in %d is/are %d\0A\00"
define void @countingNumberofOneswithPreprocessing_test() {
%1 = tail call i32 (...) @buildTable()
%2 = tail call i32 @countingNumberofOneswithPreprocessing(i32 10)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 10, i32 %2)
%4 = tail call i32 @countingNumberofOneswithPreprocessing(i32 5)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 5, i32 %4)
%6 = tail call i32 @countingNumberofOneswithPreprocessing(i32 100)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 100, i32 %6)
%8 = tail call i32 @countingNumberofOneswithPreprocessing(i32 1)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 1, i32 %8)
%10 = tail call i32 @countingNumberofOneswithPreprocessing(i32 0)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 0, i32 %10)
ret void
}