#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 */
double power(double, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  printf("%.0f\n", power(5, 2));
  printf("Enter n and p (n^p): ");
  double n;
  int p;
  scanf("%lf", &n);
  scanf("%d", &p);
  printf("The pow is: %.0f\n", power(n, p));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  0xec0(%rip),%xmm0
mov    $0x2,%edi
call   1030 <power@plt>
lea    0xee0(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xea3(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movsd  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1030 <power@plt>
lea    0xe87(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movsd  0xec4(%rip),%xmm0
mov    $0x2,%edi
call   1030 <power@plt>
lea    0xee4(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xea6(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movsd  0x10(%rsp),%xmm0
mov    0xc(%rsp),%edi
call   1030 <power@plt>
lea    0xe87(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%.0f\0A\00"
@.str.1 = [22 x i8] c"Enter n and p (n^p): \00"
@.str.2 = [4 x i8] c"%lf\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [18 x i8] c"The pow is: %.0f\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca i32
%3 = call double @power(double 5.000000e+00, i32 2)
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %1)
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%8 = load double, double* %1
%9 = load i32, i32* %2
%10 = call double @power(double %8, i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), double %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%.0f\0A\00"
@.str.1 = [22 x i8] c"Enter n and p (n^p): \00"
@.str.2 = [4 x i8] c"%lf\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [18 x i8] c"The pow is: %.0f\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca i32
%3 = tail call double @power(double 5.000000e+00, i32 2)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%6 = bitcast double* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %1)
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%10 = load double, double* %1
%11 = load i32, i32* %2
%12 = call double @power(double %10, i32 %11)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), double %12)
ret i32 0
}