#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 floor(double);
double pow(double x, double y) {
  int count;
  if ((x < 0) && (floor(y) != y)) {
    return (0);
  }
  if (y == 0)
    x = 1;
  else {
    for (count = 1; count < y; count++)
      x *= x;
  }
  return (x);
}


x86 assembly (clang, -O0):
<pow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    115d <pow+0x4d>
movsd  -0x18(%rbp),%xmm0
call   1030 <floor@plt>
ucomisd -0x18(%rbp),%xmm0
jne    1150 <pow+0x40>
jp     1150 <pow+0x40>
jmp    115d <pow+0x4d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11ce <pow+0xbe>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1187 <pow+0x77>
jp     1187 <pow+0x77>
movsd  0xe83(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11c4 <pow+0xb4>
movl   $0x1,-0x1c(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11bf <pow+0xaf>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    118e <pow+0x7e>
jmp    11c4 <pow+0xb4>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pow>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
movapd %xmm1,%xmm0
call   1030 <floor@plt>
movsd  0x10(%rsp),%xmm3
movsd  0x8(%rsp),%xmm2
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm3,%xmm0
jbe    1150 <pow+0x40>
ucomisd %xmm2,%xmm1
jne    114b <pow+0x3b>
jnp    1150 <pow+0x40>
add    $0x18,%rsp
ret
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jne    1169 <pow+0x59>
jp     1169 <pow+0x59>
movsd  0xe9c(%rip),%xmm0
add    $0x18,%rsp
ret
ucomisd 0xe8f(%rip),%xmm2
jbe    1196 <pow+0x86>
mov    $0x2,%eax
movapd %xmm3,%xmm0
nopl   0x0(%rax)
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  %xmm0,%xmm0
add    $0x1,%eax
ucomisd %xmm1,%xmm2
ja     1180 <pow+0x70>
jmp    114b <pow+0x3b>
movapd %xmm3,%xmm0
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define double @pow(double %0, double %1) {
%3 = fcmp olt double %0, 0.000000e+00
%4 = tail call double @llvm.floor.f64(double %1)
%5 = fcmp une double %4, %1
%6 = select i1 %3, i1 %5, i1 false
br i1 %6, label %18, label %7
7: ; preds = %2
%8 = fcmp oeq double %1, 0.000000e+00
br i1 %8, label %18, label %9
9: ; preds = %7
%10 = fcmp ogt double %1, 1.000000e+00
br i1 %10, label %11, label %18
11: ; preds = %9, %11
%12 = phi i32 [ %15, %11 ], [ 1, %9 ]
%13 = phi double [ %14, %11 ], [ %0, %9 ]
%14 = fmul double %13, %13
%15 = add nuw nsw i32 %12, 1
%16 = sitofp i32 %15 to double
%17 = fcmp olt double %16, %1
br i1 %17, label %11, label %18
18: ; preds = %11, %9, %7, %2
%19 = phi double [ 0.000000e+00, %2 ], [ 1.000000e+00, %7 ], [ %0, %9 ], [ %14, %11 ]
ret double %19
}