#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 */
float multiply(float, float);
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, float *, float *);
int main(void) {
  float base, exponent;
  float aux;
  float result = 1;
  scanf("%f %f", &base, &exponent);
  for (int i = 0; i < (exponent < 0 ? -exponent : exponent); i++) {
    result = multiply(result, base);
  }
  if (exponent < 0) {
    result = 1 / result;
  }
  printf("%f\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xeb9(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
lea    0xeb1(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
movl   $0x0,-0x18(%rbp)
cvtsi2ssl -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    119a <main+0x6a>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x20(%rbp)
jmp    11a4 <main+0x74>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm1
movss  -0x20(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11d9 <main+0xa9>
movss  -0x14(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <multiply@plt>
movss  %xmm0,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1167 <main+0x37>
xorps  %xmm0,%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    11f8 <main+0xc8>
movss  0xe12(%rip),%xmm0
divss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
lea    0xe06(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xedc(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
seta   %al
jbe    1163 <main+0x33>
xorps  0xe9d(%rip),%xmm0
movss  0xea5(%rip),%xmm2
ucomiss %xmm1,%xmm0
movaps %xmm2,%xmm0
jbe    11c4 <main+0x94>
movss  0xe95(%rip),%xmm0
mov    $0x1,%ebx
jmp    119f <main+0x6f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xorps  %xmm2,%xmm2
cvtsi2ss %ebx,%xmm2
add    $0x1,%ebx
ucomiss %xmm2,%xmm1
jbe    11c4 <main+0x94>
movss  0xc(%rsp),%xmm1
call   1030 <multiply@plt>
movss  0x8(%rsp),%xmm1
xorps  %xmm2,%xmm2
ucomiss %xmm1,%xmm2
seta   %al
jbe    1190 <main+0x60>
xorps  0xe3e(%rip),%xmm1
jmp    1190 <main+0x60>
test   %al,%al
je     11d7 <main+0xa7>
movss  0xe40(%rip),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
lea    0xe40(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%f %f\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i32
store i32 0, i32* %1
store float 1.000000e+00, float* %5
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), float* %2, float* %3)
store i32 0, i32* %6
br label %8
8: ; preds = %25, %0
%9 = load i32, i32* %6
%10 = sitofp i32 %9 to float
%11 = load float, float* %3
%12 = fcmp olt float %11, 0.000000e+00
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = load float, float* %3
%15 = fneg float %14
br label %18
16: ; preds = %8
%17 = load float, float* %3
br label %18
18: ; preds = %16, %13
%19 = phi float [ %15, %13 ], [ %17, %16 ]
%20 = fcmp olt float %10, %19
br i1 %20, label %21, label %28
21: ; preds = %18
%22 = load float, float* %5
%23 = load float, float* %2
%24 = call float @multiply(float %22, float %23)
store float %24, float* %5
br label %25
25: ; preds = %21
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
br label %8
28: ; preds = %18
%29 = load float, float* %3
%30 = fcmp olt float %29, 0.000000e+00
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = load float, float* %5
%33 = fdiv float 1.000000e+00, %32
store float %33, float* %5
br label %34
34: ; preds = %31, %28
%35 = load float, float* %5
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%f %f\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), float* %1, float* %2)
%6 = load float, float* %2
%7 = fcmp olt float %6, 0.000000e+00
%8 = fneg float %6
%9 = select i1 %7, float %8, float %6
%10 = fcmp ogt float %9, 0.000000e+00
br i1 %10, label %17, label %11
11: ; preds = %17, %0
%12 = phi float [ 1.000000e+00, %0 ], [ %21, %17 ]
%13 = phi i1 [ %7, %0 ], [ %25, %17 ]
%14 = fdiv float 1.000000e+00, %12
%15 = select i1 %13, float %14, float %12
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %15)
ret i32 0
17: ; preds = %0, %17
%18 = phi i32 [ %22, %17 ], [ 0, %0 ]
%19 = phi float [ %21, %17 ], [ 1.000000e+00, %0 ]
%20 = load float, float* %1
%21 = call float @multiply(float %19, float %20)
%22 = add nuw nsw i32 %18, 1
%23 = sitofp i32 %22 to float
%24 = load float, float* %2
%25 = fcmp olt float %24, 0.000000e+00
%26 = fneg float %24
%27 = select i1 %25, float %26, float %24
%28 = fcmp ogt float %27, %23
br i1 %28, label %17, label %11
}