#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 cube(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int square(int);
int toTheFifthPower(int);
int toTheFourthPower(int);
int main() {
  int userInput = 0;
  printf("Enter Number: ");
  scanf("%d", &userInput);
  printf("\n%d^2 = %d \n", userInput, square(userInput));
  printf("%d^3 = %d \n", userInput, cube(userInput));
  printf("%d^4 = %d \n", userInput, toTheFourthPower(userInput));
  printf("%d^5 = %d \n", userInput, toTheFifthPower(userInput));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe8b(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <square@plt>
mov    -0x14(%rbp),%esi
mov    %eax,%edx
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1070 <cube@plt>
mov    -0x10(%rbp),%esi
mov    %eax,%edx
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <toTheFourthPower@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1080 <toTheFifthPower@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xe8c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8d(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
call   1030 <square@plt>
lea    0xe74(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
call   1070 <cube@plt>
lea    0xe64(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
call   1050 <toTheFourthPower@plt>
lea    0xe53(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
call   1080 <toTheFifthPower@plt>
lea    0xe42(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Enter Number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"\0A%d^2 = %d \0A\00"
@.str.3 = [12 x i8] c"%d^3 = %d \0A\00"
@.str.4 = [12 x i8] c"%d^4 = %d \0A\00"
@.str.5 = [12 x i8] c"%d^5 = %d \0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = load i32, i32* %1
%6 = call i32 @square(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %4, i32 %6)
%8 = load i32, i32* %1
%9 = load i32, i32* %1
%10 = call i32 @cube(i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %8, i32 %10)
%12 = load i32, i32* %1
%13 = load i32, i32* %1
%14 = call i32 @toTheFourthPower(i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %12, i32 %14)
%16 = load i32, i32* %1
%17 = load i32, i32* %1
%18 = call i32 @toTheFifthPower(i32 %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %16, i32 %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Enter Number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"\0A%d^2 = %d \0A\00"
@.str.3 = [12 x i8] c"%d^3 = %d \0A\00"
@.str.4 = [12 x i8] c"%d^4 = %d \0A\00"
@.str.5 = [12 x i8] c"%d^5 = %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @square(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %6)
%8 = load i32, i32* %1
%9 = call i32 @cube(i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %8, i32 %9)
%11 = load i32, i32* %1
%12 = call i32 @toTheFourthPower(i32 %11)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %11, i32 %12)
%14 = load i32, i32* %1
%15 = call i32 @toTheFifthPower(i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %14, i32 %15)
ret i32 0
}