#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, double);
double powerr(char const *, double, char const *, double);
double powGuarded(double x, const char *sx, double y, const char *sy) {
  return (x == 0.0 && y <= 0.0) || (x < 0.0 && floor(y) != y)
             ? powerr(sx, x, sy, y)
             : pow(x, y);
}


x86 assembly (clang, -O0):
<powGuarded>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1170 <powGuarded+0x40>
jp     1170 <powGuarded+0x40>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jae    119e <powGuarded+0x6e>
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    11bf <powGuarded+0x8f>
movsd  -0x18(%rbp),%xmm0
call   1050 <floor@plt>
ucomisd -0x18(%rbp),%xmm0
jne    119e <powGuarded+0x6e>
jp     119e <powGuarded+0x6e>
jmp    11bf <powGuarded+0x8f>
mov    -0x10(%rbp),%rdi
movsd  -0x8(%rbp),%xmm0
mov    -0x20(%rbp),%rsi
movsd  -0x18(%rbp),%xmm1
call   1030 <powerr@plt>
movsd  %xmm0,-0x28(%rbp)
jmp    11d3 <powGuarded+0xa3>
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<powGuarded>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jne    1153 <powGuarded+0x23>
jp     1153 <powGuarded+0x23>
ucomisd %xmm1,%xmm0
jae    1186 <powGuarded+0x56>
movapd %xmm1,%xmm0
movsd  %xmm1,0x10(%rsp)
movsd  %xmm2,0x8(%rsp)
call   1050 <floor@plt>
movsd  0x8(%rsp),%xmm2
movsd  0x10(%rsp),%xmm1
xorpd  %xmm3,%xmm3
ucomisd %xmm2,%xmm3
jbe    119c <powGuarded+0x6c>
ucomisd %xmm1,%xmm0
jne    1186 <powGuarded+0x56>
jnp    119c <powGuarded+0x6c>
mov    %rbx,%rdi
movapd %xmm2,%xmm0
mov    %r14,%rsi
add    $0x18,%rsp
pop    %rbx
pop    %r14
jmp    1030 <powerr@plt>
movapd %xmm2,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r14
jmp    1040 <pow@plt>

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

LLVM IR (-O2):
define double @powGuarded(double %0, i8* %1, double %2, i8* %3) {
%5 = fcmp oeq double %0, 0.000000e+00
%6 = fcmp ole double %2, 0.000000e+00
%7 = and i1 %5, %6
br i1 %7, label %13, label %8
8: ; preds = %4
%9 = fcmp olt double %0, 0.000000e+00
%10 = tail call double @llvm.floor.f64(double %2)
%11 = fcmp une double %10, %2
%12 = select i1 %9, i1 %11, i1 false
br i1 %12, label %13, label %15
13: ; preds = %8, %4
%14 = tail call double @powerr(i8* %1, double %0, i8* %3, double %2)
br label %17
15: ; preds = %8
%16 = tail call double @pow(double %0, double %2)
br label %17
17: ; preds = %15, %13
%18 = phi double [ %14, %13 ], [ %16, %15 ]
ret double %18
}