#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 pow(double x, double y) {
  if (x == 0 && y == 0) {
    return 1;
  }
  if (x == 0 && y != 0) {
    return 0;
  }
  if (y == 0 && x != 0) {
    return 1;
  }
  if (x < 0) {
    if (y / 1.00 == (int)y) {
      if ((int)y % 2) {
        return -exp(y * log(-x));
      } else {
        return exp(y * log(-x));
      }
    }
  }
  return exp(y * log(x));
}


x86 assembly (clang, -O0):
<pow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1174 <pow+0x54>
jp     1174 <pow+0x54>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1174 <pow+0x54>
jp     1174 <pow+0x54>
movsd  0xe96(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    131d <pow+0x1fd>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11b6 <pow+0x96>
jp     11b6 <pow+0x96>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11a9 <pow+0x89>
jp     11a9 <pow+0x89>
jmp    11b6 <pow+0x96>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    131d <pow+0x1fd>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11fd <pow+0xdd>
jp     11fd <pow+0xdd>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11eb <pow+0xcb>
jp     11eb <pow+0xcb>
jmp    11fd <pow+0xdd>
movsd  0xe0d(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    131d <pow+0x1fd>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    12f3 <pow+0x1d3>
movsd  -0x18(%rbp),%xmm0
movsd  0xde8(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si -0x18(%rbp),%eax
cvtsi2sd %eax,%xmm1
ucomisd %xmm1,%xmm0
jne    12ee <pow+0x1ce>
jp     12ee <pow+0x1ce>
cvttsd2si -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     12a8 <pow+0x188>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%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  -0x20(%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)
jmp    131d <pow+0x1fd>
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>
movsd  %xmm0,-0x8(%rbp)
jmp    131d <pow+0x1fd>
jmp    12f3 <pow+0x1d3>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pow>:
push   %rbx
sub    $0x10,%rsp
xorpd  %xmm4,%xmm4
ucomisd %xmm4,%xmm0
movsd  0xecb(%rip),%xmm2
jne    114b <pow+0x2b>
jp     114b <pow+0x2b>
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm1
jne    114b <pow+0x2b>
jp     114b <pow+0x2b>
movapd %xmm2,%xmm4
jmp    1177 <pow+0x57>
ucomisd %xmm4,%xmm0
jne    115f <pow+0x3f>
jp     115f <pow+0x3f>
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm1
jne    1177 <pow+0x57>
jp     1177 <pow+0x57>
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm0
jne    116b <pow+0x4b>
jnp    1181 <pow+0x61>
ucomisd %xmm3,%xmm1
movapd %xmm2,%xmm4
jne    1181 <pow+0x61>
jp     1181 <pow+0x61>
movapd %xmm4,%xmm0
add    $0x10,%rsp
pop    %rbx
ret
ucomisd %xmm0,%xmm3
movapd %xmm1,(%rsp)
jbe    11ca <pow+0xaa>
cvttpd2dq %xmm1,%xmm2
cvtdq2pd %xmm2,%xmm2
ucomisd %xmm1,%xmm2
jne    11ca <pow+0xaa>
jp     11ca <pow+0xaa>
cvttsd2si %xmm1,%ebx
xorpd  0xe68(%rip),%xmm0
call   1040 <log@plt>
mulsd  (%rsp),%xmm0
call   1030 <exp@plt>
movapd %xmm0,%xmm4
test   $0x1,%bl
je     1177 <pow+0x57>
xorpd  0xe48(%rip),%xmm4
jmp    1177 <pow+0x57>
call   1040 <log@plt>
mulsd  (%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
jmp    1030 <exp@plt>

LLVM IR (-O0):
define double @pow(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* %4
%7 = fcmp oeq double %6, 0.000000e+00
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load double, double* %5
%10 = fcmp oeq double %9, 0.000000e+00
br i1 %10, label %11, label %12
11: ; preds = %8
store double 1.000000e+00, double* %3
br label %63
12: ; preds = %8, %2
%13 = load double, double* %4
%14 = fcmp oeq double %13, 0.000000e+00
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load double, double* %5
%17 = fcmp une double %16, 0.000000e+00
br i1 %17, label %18, label %19
18: ; preds = %15
store double 0.000000e+00, double* %3
br label %63
19: ; preds = %15, %12
%20 = load double, double* %5
%21 = fcmp oeq double %20, 0.000000e+00
br i1 %21, label %22, label %26
22: ; preds = %19
%23 = load double, double* %4
%24 = fcmp une double %23, 0.000000e+00
br i1 %24, label %25, label %26
25: ; preds = %22
store double 1.000000e+00, double* %3
br label %63
26: ; preds = %22, %19
%27 = load double, double* %4
%28 = fcmp olt double %27, 0.000000e+00
br i1 %28, label %29, label %57
29: ; preds = %26
%30 = load double, double* %5
%31 = fdiv double %30, 1.000000e+00
%32 = load double, double* %5
%33 = fptosi double %32 to i32
%34 = sitofp i32 %33 to double
%35 = fcmp oeq double %31, %34
br i1 %35, label %36, label %56
36: ; preds = %29
%37 = load double, double* %5
%38 = fptosi double %37 to i32
%39 = srem i32 %38, 2
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %49
41: ; preds = %36
%42 = load double, double* %5
%43 = load double, double* %4
%44 = fneg double %43
%45 = call double @log(double %44)
%46 = fmul double %42, %45
%47 = call double @exp(double %46)
%48 = fneg double %47
store double %48, double* %3
br label %63
49: ; preds = %36
%50 = load double, double* %5
%51 = load double, double* %4
%52 = fneg double %51
%53 = call double @log(double %52)
%54 = fmul double %50, %53
%55 = call double @exp(double %54)
store double %55, double* %3
br label %63
56: ; preds = %29
br label %57
57: ; preds = %56, %26
%58 = load double, double* %5
%59 = load double, double* %4
%60 = call double @log(double %59)
%61 = fmul double %58, %60
%62 = call double @exp(double %61)
store double %62, double* %3
br label %63
63: ; preds = %57, %49, %41, %25, %18, %11
%64 = load double, double* %3
ret double %64
}

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