#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 fnRecPow(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(void) {
  int iX, iN;
  float fRes;
  printf("\n Enter value of x and n\n");
  scanf("%d%d", &iX, &iN);
  if (iN < 0) {
    fRes = 1.0 / fnRecPow(iX, -iN);
  } else {
    fRes = fnRecPow(iX, iN);
  }
  printf("\n%d raised to the power %d is %d\n", iX, iN, fRes);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jge    1195 <main+0x65>
mov    -0x8(%rbp),%edi
xor    %esi,%esi
sub    -0xc(%rbp),%esi
call   1040 <fnRecPow@plt>
movaps %xmm0,%xmm1
movsd  0xe7d(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11a9 <main+0x79>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <fnRecPow@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe68(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1060 <scanf@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edi
test   %esi,%esi
js     1173 <main+0x33>
call   1050 <fnRecPow@plt>
jmp    118a <main+0x4a>
neg    %esi
call   1050 <fnRecPow@plt>
movapd %xmm0,%xmm1
movsd  0xe7a(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
cvtss2sd %xmm0,%xmm0
lea    0xe6d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"\0A Enter value of x and n\0A\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [34 x i8] c"\0A%d raised to the power %d is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %0
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = sub nsw i32 0, %11
%13 = call double @fnRecPow(i32 %10, i32 %12)
%14 = fdiv double 1.000000e+00, %13
%15 = fptrunc double %14 to float
store float %15, float* %4
br label %21
16: ; preds = %0
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = call double @fnRecPow(i32 %17, i32 %18)
%20 = fptrunc double %19 to float
store float %20, float* %4
br label %21
21: ; preds = %16, %9
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = load float, float* %4
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 %23, double %25)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [34 x i8] c"\0A%d raised to the power %d is %d\0A\00"
@str = [25 x i8] c"\0A Enter value of x and n\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 0
%9 = load i32, i32* %1
br i1 %8, label %10, label %14
10: ; preds = %0
%11 = sub nsw i32 0, %7
%12 = call double @fnRecPow(i32 %9, i32 %11)
%13 = fdiv double 1.000000e+00, %12
br label %16
14: ; preds = %0
%15 = call double @fnRecPow(i32 %9, i32 %7)
br label %16
16: ; preds = %14, %10
%17 = phi double [ %13, %10 ], [ %15, %14 ]
%18 = fptrunc double %17 to float
%19 = load i32, i32* %1
%20 = load i32, i32* %2
%21 = fpext float %18 to double
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %19, i32 %20, double %21)
ret i32 0
}