#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 = 0, n;
  float x, y = 1;
  printf("x: ");
  scanf("%f", &x);
  printf("n: ");
  scanf("%d", &n);
  for (; 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)
movl   $0x0,-0x8(%rbp)
movss  0xec2(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe97(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ac <main+0x8c>
movss  -0x10(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1183 <main+0x63>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0xc(%rbp),%esi
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe4a(%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    0xee4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xecc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
movss  (%rsp),%xmm0
test   %esi,%esi
jle    1185 <main+0x65>
lea    -0x1(%rsi),%ecx
mov    %esi,%eax
and    $0x7,%eax
cmp    $0x7,%ecx
jae    118f <main+0x6f>
movss  0xe85(%rip),%xmm1
jmp    11c5 <main+0xa5>
movsd  0xe73(%rip),%xmm1
jmp    11dd <main+0xbd>
mov    %esi,%ecx
and    $0xfffffff8,%ecx
movss  0xe6c(%rip),%xmm1
nopl   0x0(%rax)
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    11a0 <main+0x80>
test   %eax,%eax
je     11d9 <main+0xb9>
nopl   0x0(%rax)
mulss  %xmm0,%xmm1
add    $0xffffffff,%eax
jne    11d0 <main+0xb0>
cvtss2sd %xmm1,%xmm1
cvtss2sd %xmm0,%xmm0
lea    0xe32(%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
store i32 0, i32* %2
store float 1.000000e+00, float* %5
%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)
br label %10
10: ; preds = %18, %0
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %21
14: ; preds = %10
%15 = load float, float* %4
%16 = load float, float* %5
%17 = fmul float %16, %15
store float %17, float* %5
br label %18
18: ; preds = %14
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %10
21: ; preds = %10
%22 = load float, float* %4
%23 = fpext float %22 to double
%24 = load i32, i32* %3
%25 = load float, float* %5
%26 = fpext float %25 to double
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %23, i32 %24, double %26)
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 i32, i32* %1
%10 = icmp sgt i32 %9, 0
%11 = load float, float* %2
br i1 %10, label %12, label %44
12: ; preds = %0
%13 = add i32 %9, -1
%14 = and i32 %9, 7
%15 = icmp ult i32 %13, 7
br i1 %15, label %31, label %16
16: ; preds = %12
%17 = and i32 %9, -8
br label %18
18: ; preds = %18, %16
%19 = phi float [ 1.000000e+00, %16 ], [ %28, %18 ]
%20 = phi i32 [ 0, %16 ], [ %29, %18 ]
%21 = fmul float %19, %11
%22 = fmul float %21, %11
%23 = fmul float %22, %11
%24 = fmul float %23, %11
%25 = fmul float %24, %11
%26 = fmul float %25, %11
%27 = fmul float %26, %11
%28 = fmul float %27, %11
%29 = add i32 %20, 8
%30 = icmp eq i32 %29, %17
br i1 %30, label %31, label %18
31: ; preds = %18, %12
%32 = phi float [ undef, %12 ], [ %28, %18 ]
%33 = phi float [ 1.000000e+00, %12 ], [ %28, %18 ]
%34 = icmp eq i32 %14, 0
br i1 %34, label %41, label %35
35: ; preds = %31, %35
%36 = phi float [ %38, %35 ], [ %33, %31 ]
%37 = phi i32 [ %39, %35 ], [ 0, %31 ]
%38 = fmul float %36, %11
%39 = add i32 %37, 1
%40 = icmp eq i32 %39, %14
br i1 %40, label %41, label %35
41: ; preds = %35, %31
%42 = phi float [ %32, %31 ], [ %38, %35 ]
%43 = fpext float %42 to double
br label %44
44: ; preds = %0, %41
%45 = phi double [ %43, %41 ], [ 1.000000e+00, %0 ]
%46 = fpext float %11 to double
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %46, i32 %9, double %45)
ret i32 0
}