#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, long long *, int *);
int main() {
  int i, power;
  long long number, numBack;
  printf("Enter a number and the power you want to raise it to: \n");
  scanf("%lld %d", &number, &power);
  numBack = number;
  for (i = 1; i < power; i++)
    number *= numBack;
  printf("%lld raised to %d is %lld", numBack, power, number);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1187 <main+0x67>
mov    -0x20(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1160 <main+0x40>
mov    -0x20(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1050 <scanf@plt>
mov    0x10(%rsp),%rsi
mov    0xc(%rsp),%edx
mov    %rsi,%rcx
cmp    $0x2,%edx
jl     11ce <main+0x9e>
lea    -0x1(%rdx),%edi
lea    -0x2(%rdx),%r8d
mov    %edi,%eax
and    $0x7,%eax
mov    %rsi,%rcx
cmp    $0x7,%r8d
jb     11b5 <main+0x85>
and    $0xfffffff8,%edi
mov    %rsi,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
imul   %rsi,%rcx
imul   %rsi,%rcx
imul   %rsi,%rcx
imul   %rsi,%rcx
imul   %rsi,%rcx
imul   %rsi,%rcx
imul   %rsi,%rcx
imul   %rsi,%rcx
add    $0xfffffff8,%edi
jne    1190 <main+0x60>
test   %eax,%eax
je     11c9 <main+0x99>
nopl   0x0(%rax)
imul   %rsi,%rcx
add    $0xffffffff,%eax
jne    11c0 <main+0x90>
mov    %rcx,0x10(%rsp)
lea    0xe33(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [56 x i8] c"Enter a number and the power you want to raise it to: \0A\00"
@.str.1 = [8 x i8] c"%lld %d\00"
@.str.2 = [26 x i8] c"%lld raised to %d is %lld\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i64* %4, i32* %3)
%8 = load i64, i64* %4
store i64 %8, i64* %5
store i32 1, i32* %2
br label %9
9: ; preds = %17, %0
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %20
13: ; preds = %9
%14 = load i64, i64* %5
%15 = load i64, i64* %4
%16 = mul nsw i64 %15, %14
store i64 %16, i64* %4
br label %17
17: ; preds = %13
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %9
20: ; preds = %9
%21 = load i64, i64* %5
%22 = load i32, i32* %3
%23 = load i64, i64* %4
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i64 %21, i32 %22, i64 %23)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"%lld %d\00"
@.str.2 = [26 x i8] c"%lld raised to %d is %lld\00"
@str = [55 x i8] c"Enter a number and the power you want to raise it to: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = bitcast i32* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i64* %2, i32* %1)
%7 = load i64, i64* %2
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %42
10: ; preds = %0
%11 = add i32 %8, -1
%12 = add i32 %8, -2
%13 = and i32 %11, 7
%14 = icmp ult i32 %12, 7
br i1 %14, label %30, label %15
15: ; preds = %10
%16 = and i32 %11, -8
br label %17
17: ; preds = %17, %15
%18 = phi i64 [ %7, %15 ], [ %27, %17 ]
%19 = phi i32 [ 0, %15 ], [ %28, %17 ]
%20 = mul nsw i64 %18, %7
%21 = mul nsw i64 %20, %7
%22 = mul nsw i64 %21, %7
%23 = mul nsw i64 %22, %7
%24 = mul nsw i64 %23, %7
%25 = mul nsw i64 %24, %7
%26 = mul nsw i64 %25, %7
%27 = mul nsw i64 %26, %7
%28 = add i32 %19, 8
%29 = icmp eq i32 %28, %16
br i1 %29, label %30, label %17
30: ; preds = %17, %10
%31 = phi i64 [ undef, %10 ], [ %27, %17 ]
%32 = phi i64 [ %7, %10 ], [ %27, %17 ]
%33 = icmp eq i32 %13, 0
br i1 %33, label %40, label %34
34: ; preds = %30, %34
%35 = phi i64 [ %37, %34 ], [ %32, %30 ]
%36 = phi i32 [ %38, %34 ], [ 0, %30 ]
%37 = mul nsw i64 %35, %7
%38 = add i32 %36, 1
%39 = icmp eq i32 %38, %13
br i1 %39, label %40, label %34
40: ; preds = %34, %30
%41 = phi i64 [ %31, %30 ], [ %37, %34 ]
store i64 %41, i64* %2
br label %42
42: ; preds = %40, %0
%43 = phi i64 [ %41, %40 ], [ %7, %0 ]
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i64 %7, i32 %8, i64 %43)
ret i32 0
}