#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);
  do {
    y *= x;
    counter++;
  } while (counter < n);
  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>
movss  -0x10(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1183 <main+0x63>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0xc(%rbp),%esi
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe4f(%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    0xedc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
cmp    $0x2,%esi
mov    $0x1,%ecx
cmovge %esi,%ecx
movss  (%rsp),%xmm0
lea    -0x1(%rcx),%edx
mov    %ecx,%eax
and    $0x7,%eax
cmp    $0x7,%edx
jae    118c <main+0x6c>
movss  0xe76(%rip),%xmm1
jmp    11c5 <main+0xa5>
and    $0x7ffffff8,%ecx
movss  0xe66(%rip),%xmm1
nopw   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    11a0 <main+0x80>
test   %eax,%eax
je     11d9 <main+0xb9>
nopl   0x0(%rax)
mulss  %xmm0,%xmm1
add    $0xffffffff,%eax
jne    11d0 <main+0xb0>
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xe2a(%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 = %16, %0
%11 = load float, float* %4
%12 = load float, float* %5
%13 = fmul float %12, %11
store float %13, float* %5
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %16
16: ; preds = %10
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = icmp slt i32 %17, %18
br i1 %19, label %10, label %20
20: ; preds = %16
%21 = load float, float* %4
%22 = fpext float %21 to double
%23 = load i32, i32* %3
%24 = load float, float* %5
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %22, i32 %23, double %25)
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 = call i32 @llvm.smax.i32(i32 %10, i32 1)
%12 = add nsw i32 %11, -1
%13 = and i32 %11, 7
%14 = icmp ult i32 %12, 7
br i1 %14, label %30, label %15
15: ; preds = %0
%16 = and i32 %11, 2147483640
br label %17
17: ; preds = %17, %15
%18 = phi float [ 1.000000e+00, %15 ], [ %27, %17 ]
%19 = phi i32 [ 0, %15 ], [ %28, %17 ]
%20 = fmul float %18, %9
%21 = fmul float %20, %9
%22 = fmul float %21, %9
%23 = fmul float %22, %9
%24 = fmul float %23, %9
%25 = fmul float %24, %9
%26 = fmul float %25, %9
%27 = fmul float %26, %9
%28 = add i32 %19, 8
%29 = icmp eq i32 %28, %16
br i1 %29, label %30, label %17
30: ; preds = %17, %0
%31 = phi float [ undef, %0 ], [ %27, %17 ]
%32 = phi float [ 1.000000e+00, %0 ], [ %27, %17 ]
%33 = icmp eq i32 %13, 0
br i1 %33, label %40, label %34
34: ; preds = %30, %34
%35 = phi float [ %37, %34 ], [ %32, %30 ]
%36 = phi i32 [ %38, %34 ], [ 0, %30 ]
%37 = fmul float %35, %9
%38 = add i32 %36, 1
%39 = icmp eq i32 %38, %13
br i1 %39, label %40, label %34
40: ; preds = %34, %30
%41 = phi float [ %31, %30 ], [ %37, %34 ]
%42 = fpext float %9 to double
%43 = fpext float %41 to double
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %42, i32 %10, double %43)
ret i32 0
}