#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 exp(float);
float log(float);
float pow(float arg1, float arg2) {
  float temp;
  long l;
  if (arg1 <= 0.) {
    if (arg1 == 0.) {
      if (arg2 <= 0.)
        goto domain;
      return (0.);
    }
    l = arg2;
    if (l != arg2)
      goto domain;
    temp = exp(arg2 * log(-arg1));
    if (l & 1)
      temp = -temp;
    return (temp);
  }
  return (exp(arg2 * log(arg1)));
domain:
  return (0.);
}


x86 assembly (clang, -O0):
<pow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jb     1225 <pow+0x105>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    118c <pow+0x6c>
jp     118c <pow+0x6c>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jb     117f <pow+0x5f>
jmp    1254 <pow+0x134>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    125c <pow+0x13c>
cvttss2si -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
cvtsi2ssq -0x18(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jne    11b1 <pow+0x91>
jp     11b1 <pow+0x91>
jmp    11b6 <pow+0x96>
jmp    1254 <pow+0x134>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movss  -0x1c(%rbp),%xmm0
mulss  %xmm1,%xmm0
call   1030 <exp@plt>
movss  %xmm0,-0x10(%rbp)
mov    -0x18(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     1216 <pow+0xf6>
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    125c <pow+0x13c>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movss  -0x20(%rbp),%xmm0
mulss  %xmm1,%xmm0
call   1030 <exp@plt>
movss  %xmm0,-0x4(%rbp)
jmp    125c <pow+0x13c>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pow>:
push   %rbx
sub    $0x10,%rsp
movaps %xmm0,%xmm3
xorps  %xmm0,%xmm0
ucomiss %xmm3,%xmm0
jae    114e <pow+0x2e>
movaps %xmm3,%xmm0
movss  %xmm1,0xc(%rsp)
call   1040 <log@plt>
mulss  0xc(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
jmp    1030 <exp@plt>
ucomiss %xmm0,%xmm3
jne    1155 <pow+0x35>
jnp    1192 <pow+0x72>
cvttss2si %xmm1,%rbx
cvtsi2ss %rbx,%xmm2
ucomiss %xmm1,%xmm2
jne    1192 <pow+0x72>
jp     1192 <pow+0x72>
xorps  0xe93(%rip),%xmm3
movaps %xmm3,%xmm0
movss  %xmm1,0xc(%rsp)
call   1040 <log@plt>
mulss  0xc(%rsp),%xmm0
call   1030 <exp@plt>
test   $0x1,%bl
je     1192 <pow+0x72>
xorps  0xe6e(%rip),%xmm0
add    $0x10,%rsp
pop    %rbx
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 i64
store float %0, float* %4
store float %1, float* %5
%8 = load float, float* %4
%9 = fpext float %8 to double
%10 = fcmp ole double %9, 0.000000e+00
br i1 %10, label %11, label %44
11: ; preds = %2
%12 = load float, float* %4
%13 = fpext float %12 to double
%14 = fcmp oeq double %13, 0.000000e+00
br i1 %14, label %15, label %21
15: ; preds = %11
%16 = load float, float* %5
%17 = fpext float %16 to double
%18 = fcmp ole double %17, 0.000000e+00
br i1 %18, label %19, label %20
19: ; preds = %15
br label %50
20: ; preds = %15
store float 0.000000e+00, float* %3
br label %51
21: ; preds = %11
%22 = load float, float* %5
%23 = fptosi float %22 to i64
store i64 %23, i64* %7
%24 = load i64, i64* %7
%25 = sitofp i64 %24 to float
%26 = load float, float* %5
%27 = fcmp une float %25, %26
br i1 %27, label %28, label %29
28: ; preds = %21
br label %50
29: ; preds = %21
%30 = load float, float* %5
%31 = load float, float* %4
%32 = fneg float %31
%33 = call float @log(float %32)
%34 = fmul float %30, %33
%35 = call float @exp(float %34)
store float %35, float* %6
%36 = load i64, i64* %7
%37 = and i64 %36, 1
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %29
%40 = load float, float* %6
%41 = fneg float %40
store float %41, float* %6
br label %42
42: ; preds = %39, %29
%43 = load float, float* %6
store float %43, float* %3
br label %51
44: ; preds = %2
%45 = load float, float* %5
%46 = load float, float* %4
%47 = call float @log(float %46)
%48 = fmul float %45, %47
%49 = call float @exp(float %48)
store float %49, float* %3
br label %51
50: ; preds = %28, %19
store float 0.000000e+00, float* %3
br label %51
51: ; preds = %50, %44, %42, %20
%52 = load float, float* %3
ret float %52
}

LLVM IR (-O2):
define float @pow(float %0, float %1) {
%3 = fcmp ugt float %0, 0.000000e+00
br i1 %3, label %19, label %4
4: ; preds = %2
%5 = fcmp oeq float %0, 0.000000e+00
br i1 %5, label %23, label %6
6: ; preds = %4
%7 = fptosi float %1 to i64
%8 = sitofp i64 %7 to float
%9 = fcmp une float %8, %1
br i1 %9, label %23, label %10
10: ; preds = %6
%11 = fneg float %0
%12 = tail call float @log(float %11)
%13 = fmul float %12, %1
%14 = tail call float @exp(float %13)
%15 = and i64 %7, 1
%16 = icmp eq i64 %15, 0
%17 = fneg float %14
%18 = select i1 %16, float %14, float %17
br label %23
19: ; preds = %2
%20 = tail call float @log(float %0)
%21 = fmul float %20, %1
%22 = tail call float @exp(float %21)
br label %23
23: ; preds = %4, %6, %19, %10
%24 = phi float [ %18, %10 ], [ %22, %19 ], [ 0.000000e+00, %6 ], [ 0.000000e+00, %4 ]
ret float %24
}