#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 *, ...);
int main() {
  int counter, n;
  float x, y;
  printf("x: ");
  scanf("%f", &x);
  printf("n: ");
  scanf("%d", &n);
  for (counter = 1, y = x; counter < n; counter++) {
    y *= x;
  }
  printf("%f^%d = %f\n", x, n, y);
  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    0xec0(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea7(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x1,-0x8(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a9 <main+0x89>
movss  -0x10(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1180 <main+0x60>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0xc(%rbp),%esi
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe49(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  (%rsp),%xmm0
mov    0x4(%rsp),%esi
movaps %xmm0,%xmm1
cmp    $0x2,%esi
jl     11c9 <main+0xa9>
lea    -0x1(%rsi),%ecx
lea    -0x2(%rsi),%edx
mov    %ecx,%eax
and    $0x7,%eax
movaps %xmm0,%xmm1
cmp    $0x7,%edx
jb     11b5 <main+0x95>
and    $0xfffffff8,%ecx
movaps %xmm0,%xmm1
nopl   0x0(%rax,%rax,1)
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
add    $0xfffffff8,%ecx
jne    1190 <main+0x70>
test   %eax,%eax
je     11c9 <main+0xa9>
nopl   0x0(%rax)
mulss  %xmm0,%xmm1
add    $0xffffffff,%eax
jne    11c0 <main+0xa0>
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xe36(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"x: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [4 x i8] c"n: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [12 x i8] c"%f^%d = %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
store i32 1, i32* %2
%10 = load float, float* %4
store float %10, float* %5
br label %11
11: ; preds = %19, %0
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %22
15: ; preds = %11
%16 = load float, float* %4
%17 = load float, float* %5
%18 = fmul float %17, %16
store float %18, float* %5
br label %19
19: ; preds = %15
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %11
22: ; preds = %11
%23 = load float, float* %4
%24 = fpext float %23 to double
%25 = load i32, i32* %3
%26 = load float, float* %5
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %24, i32 %25, double %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"x: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [4 x i8] c"n: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [12 x i8] c"%f^%d = %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = bitcast i32* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%9 = load float, float* %2
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %42
12: ; preds = %0
%13 = add i32 %10, -1
%14 = add i32 %10, -2
%15 = and i32 %13, 7
%16 = icmp ult i32 %14, 7
br i1 %16, label %32, label %17
17: ; preds = %12
%18 = and i32 %13, -8
br label %19
19: ; preds = %19, %17
%20 = phi float [ %9, %17 ], [ %29, %19 ]
%21 = phi i32 [ 0, %17 ], [ %30, %19 ]
%22 = fmul float %9, %20
%23 = fmul float %9, %22
%24 = fmul float %9, %23
%25 = fmul float %9, %24
%26 = fmul float %9, %25
%27 = fmul float %9, %26
%28 = fmul float %9, %27
%29 = fmul float %9, %28
%30 = add i32 %21, 8
%31 = icmp eq i32 %30, %18
br i1 %31, label %32, label %19
32: ; preds = %19, %12
%33 = phi float [ undef, %12 ], [ %29, %19 ]
%34 = phi float [ %9, %12 ], [ %29, %19 ]
%35 = icmp eq i32 %15, 0
br i1 %35, label %42, label %36
36: ; preds = %32, %36
%37 = phi float [ %39, %36 ], [ %34, %32 ]
%38 = phi i32 [ %40, %36 ], [ 0, %32 ]
%39 = fmul float %9, %37
%40 = add i32 %38, 1
%41 = icmp eq i32 %40, %15
br i1 %41, label %42, label %36
42: ; preds = %32, %36, %0
%43 = phi float [ %9, %0 ], [ %33, %32 ], [ %39, %36 ]
%44 = fpext float %9 to double
%45 = fpext float %43 to double
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %44, i32 %10, double %45)
ret i32 0
}