#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 pow(float base, float potencia) {
  if (potencia == 0.0 && base != 0.0)
    return 1.0;
  else if (potencia == 0.0 && base == 0.0)
    return 0.0;
  float m = 1.0;
  for (int i = 1; i <= potencia; i++) {
    m *= base;
  }
  return m;
}


x86 assembly (clang, -O0):
<pow>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    115d <pow+0x5d>
jp     115d <pow+0x5d>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    114b <pow+0x4b>
jp     114b <pow+0x4b>
jmp    115d <pow+0x5d>
movss  0xead(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11f5 <pow+0xf5>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11a2 <pow+0xa2>
jp     11a2 <pow+0xa2>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11a2 <pow+0xa2>
jp     11a2 <pow+0xa2>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11f5 <pow+0xf5>
jmp    11a7 <pow+0xa7>
movss  0xe51(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cvtsi2ssl -0x14(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     11eb <pow+0xeb>
movss  -0x8(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11bb <pow+0xbb>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<pow>:
movaps %xmm0,%xmm2
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm2
jne    110d <pow+0xd>
jnp    1120 <pow+0x20>
xorps  %xmm3,%xmm3
ucomiss %xmm3,%xmm1
jne    1120 <pow+0x20>
jp     1120 <pow+0x20>
movss  0xee1(%rip),%xmm0
ret
ucomiss %xmm0,%xmm2
jne    1131 <pow+0x31>
jp     1131 <pow+0x31>
xorps  %xmm3,%xmm3
ucomiss %xmm3,%xmm1
jne    1131 <pow+0x31>
jnp    1163 <pow+0x63>
movss  0xec7(%rip),%xmm0
ucomiss %xmm0,%xmm1
jb     1163 <pow+0x63>
movss  0xeba(%rip),%xmm0
mov    $0x2,%eax
nopl   0x0(%rax,%rax,1)
xorps  %xmm3,%xmm3
cvtsi2ss %eax,%xmm3
mulss  %xmm2,%xmm0
add    $0x1,%eax
ucomiss %xmm3,%xmm1
jae    1150 <pow+0x50>
ret

LLVM IR (-O0):
define float @pow(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca i32
store float %0, float* %4
store float %1, float* %5
%8 = load float, float* %5
%9 = fpext float %8 to double
%10 = fcmp oeq double %9, 0.000000e+00
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load float, float* %4
%13 = fpext float %12 to double
%14 = fcmp une double %13, 0.000000e+00
br i1 %14, label %15, label %16
15: ; preds = %11
store float 1.000000e+00, float* %3
br label %41
16: ; preds = %11, %2
%17 = load float, float* %5
%18 = fpext float %17 to double
%19 = fcmp oeq double %18, 0.000000e+00
br i1 %19, label %20, label %25
20: ; preds = %16
%21 = load float, float* %4
%22 = fpext float %21 to double
%23 = fcmp oeq double %22, 0.000000e+00
br i1 %23, label %24, label %25
24: ; preds = %20
store float 0.000000e+00, float* %3
br label %41
25: ; preds = %20, %16
br label %26
26: ; preds = %25
store float 1.000000e+00, float* %6
store i32 1, i32* %7
br label %27
27: ; preds = %36, %26
%28 = load i32, i32* %7
%29 = sitofp i32 %28 to float
%30 = load float, float* %5
%31 = fcmp ole float %29, %30
br i1 %31, label %32, label %39
32: ; preds = %27
%33 = load float, float* %4
%34 = load float, float* %6
%35 = fmul float %34, %33
store float %35, float* %6
br label %36
36: ; preds = %32
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %27
39: ; preds = %27
%40 = load float, float* %6
store float %40, float* %3
br label %41
41: ; preds = %39, %24, %15
%42 = load float, float* %3
ret float %42
}

LLVM IR (-O2):
define float @pow(float %0, float %1) {
%3 = fcmp oeq float %1, 0.000000e+00
%4 = fcmp une float %0, 0.000000e+00
%5 = and i1 %4, %3
br i1 %5, label %18, label %6
6: ; preds = %2
%7 = fcmp oeq float %0, 0.000000e+00
%8 = and i1 %7, %3
br i1 %8, label %18, label %9
9: ; preds = %6
%10 = fcmp ult float %1, 1.000000e+00
br i1 %10, label %18, label %11
11: ; preds = %9, %11
%12 = phi i32 [ %15, %11 ], [ 1, %9 ]
%13 = phi float [ %14, %11 ], [ 1.000000e+00, %9 ]
%14 = fmul float %13, %0
%15 = add nuw nsw i32 %12, 1
%16 = sitofp i32 %15 to float
%17 = fcmp ugt float %16, %1
br i1 %17, label %18, label %11
18: ; preds = %11, %9, %6, %2
%19 = phi float [ 1.000000e+00, %2 ], [ 0.000000e+00, %6 ], [ 1.000000e+00, %9 ], [ %14, %11 ]
ret float %19
}