#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 */
double exp(double);
double log(double);
double dPow(double dX, double dY) {
  if (dY == 0.0) {
    return (1.0);
  }
  if (dX == 0.0) {
    return (0.0);
  }
  if (dX > 0.0) {
    return (exp(dY * log(dX)));
  }
  return (-exp(dY * log(-dX)));
}


x86 assembly (clang, -O0):
<dPow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    115c <dPow+0x3c>
jp     115c <dPow+0x3c>
movsd  0xeae(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    121a <dPow+0xfa>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1181 <dPow+0x61>
jp     1181 <dPow+0x61>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    121a <dPow+0xfa>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11c2 <dPow+0xa2>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    121a <dPow+0xfa>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dPow>:
push   %rax
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
jne    1137 <dPow+0x17>
jp     1137 <dPow+0x17>
movsd  0xecb(%rip),%xmm2
jmp    1181 <dPow+0x61>
ucomisd %xmm2,%xmm0
jne    113f <dPow+0x1f>
jnp    1181 <dPow+0x61>
movsd  %xmm1,(%rsp)
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    115e <dPow+0x3e>
call   1040 <log@plt>
mulsd  (%rsp),%xmm0
pop    %rax
jmp    1030 <exp@plt>
xorpd  0xeaa(%rip),%xmm0
call   1040 <log@plt>
mulsd  (%rsp),%xmm0
call   1030 <exp@plt>
movapd %xmm0,%xmm2
xorpd  0xe8f(%rip),%xmm2
movapd %xmm2,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @dPow(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %5
%7 = fcmp oeq double %6, 0.000000e+00
br i1 %7, label %8, label %9
8: ; preds = %2
store double 1.000000e+00, double* %3
br label %30
9: ; preds = %2
%10 = load double, double* %4
%11 = fcmp oeq double %10, 0.000000e+00
br i1 %11, label %12, label %13
12: ; preds = %9
store double 0.000000e+00, double* %3
br label %30
13: ; preds = %9
%14 = load double, double* %4
%15 = fcmp ogt double %14, 0.000000e+00
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = load double, double* %5
%18 = load double, double* %4
%19 = call double @log(double %18)
%20 = fmul double %17, %19
%21 = call double @exp(double %20)
store double %21, double* %3
br label %30
22: ; preds = %13
%23 = load double, double* %5
%24 = load double, double* %4
%25 = fneg double %24
%26 = call double @log(double %25)
%27 = fmul double %23, %26
%28 = call double @exp(double %27)
%29 = fneg double %28
store double %29, double* %3
br label %30
30: ; preds = %22, %16, %12, %8
%31 = load double, double* %3
ret double %31
}

LLVM IR (-O2):
define double @dPow(double %0, double %1) {
%3 = fcmp oeq double %1, 0.000000e+00
br i1 %3, label %18, label %4
4: ; preds = %2
%5 = fcmp oeq double %0, 0.000000e+00
br i1 %5, label %18, label %6
6: ; preds = %4
%7 = fcmp ogt double %0, 0.000000e+00
br i1 %7, label %8, label %12
8: ; preds = %6
%9 = tail call double @log(double %0)
%10 = fmul double %9, %1
%11 = tail call double @exp(double %10)
br label %18
12: ; preds = %6
%13 = fneg double %0
%14 = tail call double @log(double %13)
%15 = fmul double %14, %1
%16 = tail call double @exp(double %15)
%17 = fneg double %16
br label %18
18: ; preds = %4, %2, %12, %8
%19 = phi double [ %11, %8 ], [ %17, %12 ], [ 1.000000e+00, %2 ], [ 0.000000e+00, %4 ]
ret double %19
}