#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 */
char EOF;
int EXIT_SUCCESS;
long long Power(long long, long long);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, long long *);
int /*<<< orphan*/ stderr;
int main(void) {
  long long x = 0LL;
  long long pw = 0LL;
  long long result = 0LL;
  char c = '\0';
  printf("Please enter an integer: ");
  while (scanf("%lld", &x) != 1) {
    fprintf(stderr, "Input invalid. Please try again.\n");
    while ((c = getchar()) != '\n' && c != EOF)
      continue;
  }
  while ((c = getchar()) != '\n' && c != EOF)
    continue;
  printf("Please enter a positive power: ");
  while (1) {
    while (scanf("%lld", &pw) != 1) {
      fprintf(stderr, "Input invalid. Please try again.\n");
      while ((c = getchar()) != '\n' && c != EOF)
        continue;
    }
    while ((c = getchar()) != '\n' && c != EOF)
      continue;
    if (pw < 0LL) {
      fprintf(stderr, "Negative powers not supported. "
                      "Please enter a positive value for power\n");
    } else {
      break;
    }
  }
  result = Power(x, pw);
  printf("%lld\n", result);
  getchar();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movb   $0x0,-0x21(%rbp)
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8a(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1070 <scanf@plt>
cmp    $0x1,%eax
je     1202 <main+0xb2>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
lea    0xe6d(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x21(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x22(%rbp)
je     11e8 <main+0x98>
movsbl -0x21(%rbp),%eax
mov    0x2e0b(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
test   $0x1,%al
jne    11f8 <main+0xa8>
jmp    11fd <main+0xad>
jmp    11b7 <main+0x67>
jmp    1189 <main+0x39>
jmp    1207 <main+0xb7>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x21(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x23(%rbp)
je     1238 <main+0xe8>
movsbl -0x21(%rbp),%eax
mov    0x2dbb(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x23(%rbp)
mov    -0x23(%rbp),%al
test   $0x1,%al
jne    1248 <main+0xf8>
jmp    124d <main+0xfd>
jmp    1207 <main+0xb7>
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1260 <main+0x110>
lea    0xdb3(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <scanf@plt>
cmp    $0x1,%eax
je     12d9 <main+0x189>
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
lea    0xd96(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x21(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x24(%rbp)
je     12bf <main+0x16f>
movsbl -0x21(%rbp),%eax
mov    0x2d34(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x24(%rbp)
mov    -0x24(%rbp),%al
test   $0x1,%al
jne    12cf <main+0x17f>
jmp    12d4 <main+0x184>
jmp    128e <main+0x13e>
jmp    1260 <main+0x110>
jmp    12de <main+0x18e>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x21(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x25(%rbp)
je     130f <main+0x1bf>
movsbl -0x21(%rbp),%eax
mov    0x2ce4(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    131f <main+0x1cf>
jmp    1324 <main+0x1d4>
jmp    12de <main+0x18e>
cmpq   $0x0,-0x18(%rbp)
jge    1349 <main+0x1f9>
mov    0x2ca2(%rip),%rax
mov    (%rax),%edi
lea    0xd22(%rip),%rsi
call   1060 <fprintf@plt>
jmp    134e <main+0x1fe>
jmp    1353 <main+0x203>
jmp    125b <main+0x10b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <Power@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    0x2c4c(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1070 <scanf@plt>
cmp    $0x1,%eax
jne    1290 <main+0x140>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e3a(%rip),%rbx
cmp    $0xa,%al
je     11b6 <main+0x66>
cmp    (%rbx),%al
jne    11a0 <main+0x50>
lea    0xe84(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe4f(%rip),%r14
lea    0x10(%rsp),%r13
mov    0x2e01(%rip),%rbp
lea    0xe83(%rip),%r15
lea    0xe3a(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %r13,%rsi
call   1070 <scanf@plt>
cmp    $0x1,%eax
je     1230 <main+0xe0>
mov    0x0(%rbp),%edi
mov    %r12,%rsi
call   1060 <fprintf@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
je     11f0 <main+0xa0>
cmp    (%rbx),%al
jne    1210 <main+0xc0>
jmp    11f0 <main+0xa0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
je     123f <main+0xef>
cmp    (%rbx),%al
jne    1230 <main+0xe0>
mov    0x10(%rsp),%rsi
test   %rsi,%rsi
jns    1256 <main+0x106>
mov    0x0(%rbp),%edi
mov    %r15,%rsi
call   1060 <fprintf@plt>
jmp    11f0 <main+0xa0>
mov    0x8(%rsp),%rdi
call   1040 <Power@plt>
lea    0xe42(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2d51(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d41(%rip),%r12
lea    0xd81(%rip),%r14
mov    0x2d43(%rip),%rbp
lea    0xd6e(%rip),%r15
lea    0x8(%rsp),%rbx
jmp    12d4 <main+0x184>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
cmp    $0x1,%eax
je     11a0 <main+0x50>
mov    (%r12),%edi
mov    %r14,%rsi
call   1060 <fprintf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
je     12c0 <main+0x170>
cmp    0x0(%rbp),%al
jne    12e0 <main+0x190>
jmp    12c0 <main+0x170>

LLVM IR (-O0):
@.str = [26 x i8] c"Please enter an integer: \00"
@.str.1 = [5 x i8] c"%lld\00"
@stderr = global i32 0
@.str.2 = [34 x i8] c"Input invalid. Please try again.\0A\00"
@EOF = global i8 0
@.str.3 = [32 x i8] c"Please enter a positive power: \00"
@.str.4 = [72 x i8] c"Negative powers not supported. Please enter a positive value for power\0A\00"
@.str.5 = [6 x i8] c"%lld\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8
store i32 0, i32* %1
store i64 0, i64* %2
store i64 0, i64* %3
store i64 0, i64* %4
store i8 0, i8* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %26, %0
%8 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%9 = icmp ne i32 %8, 1
br i1 %9, label %10, label %27
10: ; preds = %7
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
br label %13
13: ; preds = %25, %10
%14 = call signext i8 (...) @getchar()
store i8 %14, i8* %5
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 10
br i1 %16, label %17, label %23
17: ; preds = %13
%18 = load i8, i8* %5
%19 = sext i8 %18 to i32
%20 = load i8, i8* @EOF
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %19, %21
br label %23
23: ; preds = %17, %13
%24 = phi i1 [ false, %13 ], [ %22, %17 ]
br i1 %24, label %25, label %26
25: ; preds = %23
br label %13
26: ; preds = %23
br label %7
27: ; preds = %7
br label %28
28: ; preds = %40, %27
%29 = call signext i8 (...) @getchar()
store i8 %29, i8* %5
%30 = sext i8 %29 to i32
%31 = icmp ne i32 %30, 10
br i1 %31, label %32, label %38
32: ; preds = %28
%33 = load i8, i8* %5
%34 = sext i8 %33 to i32
%35 = load i8, i8* @EOF
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %34, %36
br label %38
38: ; preds = %32, %28
%39 = phi i1 [ false, %28 ], [ %37, %32 ]
br i1 %39, label %40, label %41
40: ; preds = %38
br label %28
41: ; preds = %38
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
br label %43
43: ; preds = %41, %85
br label %44
44: ; preds = %63, %43
%45 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %3)
%46 = icmp ne i32 %45, 1
br i1 %46, label %47, label %64
47: ; preds = %44
%48 = load i32, i32* @stderr
%49 = call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
br label %50
50: ; preds = %62, %47
%51 = call signext i8 (...) @getchar()
store i8 %51, i8* %5
%52 = sext i8 %51 to i32
%53 = icmp ne i32 %52, 10
br i1 %53, label %54, label %60
54: ; preds = %50
%55 = load i8, i8* %5
%56 = sext i8 %55 to i32
%57 = load i8, i8* @EOF
%58 = sext i8 %57 to i32
%59 = icmp ne i32 %56, %58
br label %60
60: ; preds = %54, %50
%61 = phi i1 [ false, %50 ], [ %59, %54 ]
br i1 %61, label %62, label %63
62: ; preds = %60
br label %50
63: ; preds = %60
br label %44
64: ; preds = %44
br label %65
65: ; preds = %77, %64
%66 = call signext i8 (...) @getchar()
store i8 %66, i8* %5
%67 = sext i8 %66 to i32
%68 = icmp ne i32 %67, 10
br i1 %68, label %69, label %75
69: ; preds = %65
%70 = load i8, i8* %5
%71 = sext i8 %70 to i32
%72 = load i8, i8* @EOF
%73 = sext i8 %72 to i32
%74 = icmp ne i32 %71, %73
br label %75
75: ; preds = %69, %65
%76 = phi i1 [ false, %65 ], [ %74, %69 ]
br i1 %76, label %77, label %78
77: ; preds = %75
br label %65
78: ; preds = %75
%79 = load i64, i64* %3
%80 = icmp slt i64 %79, 0
br i1 %80, label %81, label %84
81: ; preds = %78
%82 = load i32, i32* @stderr
%83 = call i32 @fprintf(i32 %82, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.4, i64 0, i64 0))
br label %85
84: ; preds = %78
br label %86
85: ; preds = %81
br label %43
86: ; preds = %84
%87 = load i64, i64* %2
%88 = load i64, i64* %3
%89 = call i64 @Power(i64 %87, i64 %88)
store i64 %89, i64* %4
%90 = load i64, i64* %4
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64 %90)
%92 = call signext i8 (...) @getchar()
%93 = load i32, i32* @EXIT_SUCCESS
ret i32 %93
}

LLVM IR (-O2):
@.str = [26 x i8] c"Please enter an integer: \00"
@.str.1 = [5 x i8] c"%lld\00"
@stderr = global i32 0
@.str.2 = [34 x i8] c"Input invalid. Please try again.\0A\00"
@EOF = global i8 0
@.str.3 = [32 x i8] c"Please enter a positive power: \00"
@.str.4 = [72 x i8] c"Negative powers not supported. Please enter a positive value for power\0A\00"
@.str.5 = [6 x i8] c"%lld\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
store i64 0, i64* %1
%4 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) 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), i64* %1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %12
8: ; preds = %9, %0
br label %21
9: ; preds = %15
%10 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%11 = icmp eq i32 %10, 1
br i1 %11, label %8, label %12
12: ; preds = %0, %9
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %15, %12
%16 = call signext i8 (...) @getchar()
%17 = icmp ne i8 %16, 10
%18 = load i8, i8* @EOF
%19 = icmp ne i8 %16, %18
%20 = select i1 %17, i1 %19, i1 false
br i1 %20, label %15, label %9
21: ; preds = %8, %21
%22 = call signext i8 (...) @getchar()
%23 = icmp ne i8 %22, 10
%24 = load i8, i8* @EOF
%25 = icmp ne i8 %22, %24
%26 = select i1 %23, i1 %25, i1 false
br i1 %26, label %21, label %27
27: ; preds = %21
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
br label %29
29: ; preds = %54, %27
%30 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%31 = icmp eq i32 %30, 1
br i1 %31, label %32, label %36
32: ; preds = %33, %29
br label %45
33: ; preds = %39
%34 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%35 = icmp eq i32 %34, 1
br i1 %35, label %32, label %36
36: ; preds = %29, %33
%37 = load i32, i32* @stderr
%38 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
br label %39
39: ; preds = %39, %36
%40 = call signext i8 (...) @getchar()
%41 = icmp ne i8 %40, 10
%42 = load i8, i8* @EOF
%43 = icmp ne i8 %40, %42
%44 = select i1 %41, i1 %43, i1 false
br i1 %44, label %39, label %33
45: ; preds = %32, %45
%46 = call signext i8 (...) @getchar()
%47 = icmp ne i8 %46, 10
%48 = load i8, i8* @EOF
%49 = icmp ne i8 %46, %48
%50 = select i1 %47, i1 %49, i1 false
br i1 %50, label %45, label %51
51: ; preds = %45
%52 = load i64, i64* %2
%53 = icmp slt i64 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %51
%55 = load i32, i32* @stderr
%56 = call i32 @fprintf(i32 %55, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.4, i64 0, i64 0))
br label %29
57: ; preds = %51
%58 = load i64, i64* %1
%59 = call i64 @Power(i64 %58, i64 %52)
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64 %59)
%61 = call signext i8 (...) @getchar()
%62 = load i32, i32* @EXIT_SUCCESS
ret i32 %62
}