#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 ln(double);
double pow(double x, double y) {
  if (x == 0 && y != 0)
    return 0;
  else if (x == 0 && y == 0)
    return 1;
  else if (y < 0)
    return 1 / pow(x, -y);
  else if (x < 0 && y - (int)y != 0)
    return 0;
  else if (x < 0 && y - (int)y == 0) {
    double powint = 1;
    int i;
    for (i = 1; i <= y; i++)
      powint *= x;
    return powint;
  }
  return exp(y * ln(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    1184 <pow+0x54>
jp     1184 <pow+0x54>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1177 <pow+0x47>
jp     1177 <pow+0x47>
jmp    1184 <pow+0x54>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    131d <pow+0x1ed>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11c6 <pow+0x96>
jp     11c6 <pow+0x96>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11c6 <pow+0x96>
jp     11c6 <pow+0x96>
movsd  0xe44(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    131d <pow+0x1ed>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1213 <pow+0xe3>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xdfb(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    131d <pow+0x1ed>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1258 <pow+0x128>
movsd  -0x18(%rbp),%xmm0
cvttsd2si -0x18(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    124b <pow+0x11b>
jp     124b <pow+0x11b>
jmp    1258 <pow+0x128>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    131d <pow+0x1ed>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    12df <pow+0x1af>
movsd  -0x18(%rbp),%xmm0
cvttsd2si -0x18(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12df <pow+0x1af>
jp     12df <pow+0x1af>
movsd  0xd6d(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
cvtsi2sdl -0x24(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     12d0 <pow+0x1a0>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    129f <pow+0x16f>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    131d <pow+0x1ed>
jmp    12e4 <pow+0x1b4>
jmp    12e9 <pow+0x1b9>
jmp    12ee <pow+0x1be>
jmp    12f3 <pow+0x1c3>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <ln@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>:
sub    $0x18,%rsp
xorpd  %xmm4,%xmm4
ucomisd %xmm4,%xmm0
jne    1154 <pow+0x24>
jp     1154 <pow+0x24>
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
jne    11e4 <pow+0xb4>
jp     11e4 <pow+0xb4>
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jne    1172 <pow+0x42>
jp     1172 <pow+0x42>
ucomisd %xmm2,%xmm1
jne    1172 <pow+0x42>
jp     1172 <pow+0x42>
movsd  0xe90(%rip),%xmm4
jmp    11e4 <pow+0xb4>
ucomisd %xmm1,%xmm2
jbe    1193 <pow+0x63>
xorpd  0xe90(%rip),%xmm1
call   1040 <pow@plt>
movsd  0xe73(%rip),%xmm4
divsd  %xmm0,%xmm4
jmp    11e4 <pow+0xb4>
xorpd  %xmm4,%xmm4
ucomisd %xmm0,%xmm4
jbe    11ed <pow+0xbd>
cvttpd2dq %xmm1,%xmm2
cvtdq2pd %xmm2,%xmm2
movapd %xmm1,%xmm3
subsd  %xmm2,%xmm3
ucomisd %xmm4,%xmm3
jne    11e4 <pow+0xb4>
jp     11e4 <pow+0xb4>
movsd  0xe43(%rip),%xmm4
ucomisd %xmm4,%xmm1
jb     11e4 <pow+0xb4>
movsd  0xe35(%rip),%xmm4
mov    $0x2,%eax
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
mulsd  %xmm0,%xmm4
add    $0x1,%eax
ucomisd %xmm2,%xmm1
jae    11d0 <pow+0xa0>
movapd %xmm4,%xmm0
add    $0x18,%rsp
ret
movapd %xmm1,(%rsp)
call   1050 <ln@plt>
mulsd  (%rsp),%xmm0
add    $0x18,%rsp
jmp    1030 <exp@plt>

LLVM IR (-O0):
define double @pow(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
store double %0, double* %4
store double %1, double* %5
%8 = load double, double* %4
%9 = fcmp oeq double %8, 0.000000e+00
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load double, double* %5
%12 = fcmp une double %11, 0.000000e+00
br i1 %12, label %13, label %14
13: ; preds = %10
store double 0.000000e+00, double* %3
br label %76
14: ; preds = %10, %2
%15 = load double, double* %4
%16 = fcmp oeq double %15, 0.000000e+00
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = load double, double* %5
%19 = fcmp oeq double %18, 0.000000e+00
br i1 %19, label %20, label %21
20: ; preds = %17
store double 1.000000e+00, double* %3
br label %76
21: ; preds = %17, %14
%22 = load double, double* %5
%23 = fcmp olt double %22, 0.000000e+00
br i1 %23, label %24, label %30
24: ; preds = %21
%25 = load double, double* %4
%26 = load double, double* %5
%27 = fneg double %26
%28 = call double @pow(double %25, double %27)
%29 = fdiv double 1.000000e+00, %28
store double %29, double* %3
br label %76
30: ; preds = %21
%31 = load double, double* %4
%32 = fcmp olt double %31, 0.000000e+00
br i1 %32, label %33, label %41
33: ; preds = %30
%34 = load double, double* %5
%35 = load double, double* %5
%36 = fptosi double %35 to i32
%37 = sitofp i32 %36 to double
%38 = fsub double %34, %37
%39 = fcmp une double %38, 0.000000e+00
br i1 %39, label %40, label %41
40: ; preds = %33
store double 0.000000e+00, double* %3
br label %76
41: ; preds = %33, %30
%42 = load double, double* %4
%43 = fcmp olt double %42, 0.000000e+00
br i1 %43, label %44, label %66
44: ; preds = %41
%45 = load double, double* %5
%46 = load double, double* %5
%47 = fptosi double %46 to i32
%48 = sitofp i32 %47 to double
%49 = fsub double %45, %48
%50 = fcmp oeq double %49, 0.000000e+00
br i1 %50, label %51, label %66
51: ; preds = %44
store double 1.000000e+00, double* %6
store i32 1, i32* %7
br label %52
52: ; preds = %61, %51
%53 = load i32, i32* %7
%54 = sitofp i32 %53 to double
%55 = load double, double* %5
%56 = fcmp ole double %54, %55
br i1 %56, label %57, label %64
57: ; preds = %52
%58 = load double, double* %4
%59 = load double, double* %6
%60 = fmul double %59, %58
store double %60, double* %6
br label %61
61: ; preds = %57
%62 = load i32, i32* %7
%63 = add nsw i32 %62, 1
store i32 %63, i32* %7
br label %52
64: ; preds = %52
%65 = load double, double* %6
store double %65, double* %3
br label %76
66: ; preds = %44, %41
br label %67
67: ; preds = %66
br label %68
68: ; preds = %67
br label %69
69: ; preds = %68
br label %70
70: ; preds = %69
%71 = load double, double* %5
%72 = load double, double* %4
%73 = call double @ln(double %72)
%74 = fmul double %71, %73
%75 = call double @exp(double %74)
store double %75, double* %3
br label %76
76: ; preds = %70, %64, %40, %24, %20, %13
%77 = load double, double* %3
ret double %77
}

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