#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 pow(double, double);
double airSgnPow(double v, double p) {
  return (p == 1 ? v : (v >= 0 ? pow(v, p) : -pow(-v, p)));
}


x86 assembly (clang, -O0):
<airSgnPow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xed1(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    114e <airSgnPow+0x3e>
jp     114e <airSgnPow+0x3e>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11c5 <airSgnPow+0xb5>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1179 <airSgnPow+0x69>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x20(%rbp)
jmp    11bb <airSgnPow+0xab>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <pow@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<airSgnPow>:
push   %rax
ucomisd 0xee7(%rip),%xmm1
jne    111f <airSgnPow+0xf>
jp     111f <airSgnPow+0xf>
pop    %rax
ret
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jae    1140 <airSgnPow+0x30>
xorpd  0xedf(%rip),%xmm0
call   1030 <pow@plt>
xorpd  0xed2(%rip),%xmm0
pop    %rax
ret
pop    %rax
jmp    1030 <pow@plt>

LLVM IR (-O0):
define double @airSgnPow(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fcmp oeq double %5, 1.000000e+00
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = load double, double* %3
br label %24
9: ; preds = %2
%10 = load double, double* %3
%11 = fcmp oge double %10, 0.000000e+00
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load double, double* %3
%14 = load double, double* %4
%15 = call double @pow(double %13, double %14)
br label %22
16: ; preds = %9
%17 = load double, double* %3
%18 = fneg double %17
%19 = load double, double* %4
%20 = call double @pow(double %18, double %19)
%21 = fneg double %20
br label %22
22: ; preds = %16, %12
%23 = phi double [ %15, %12 ], [ %21, %16 ]
br label %24
24: ; preds = %22, %7
%25 = phi double [ %8, %7 ], [ %23, %22 ]
ret double %25
}

LLVM IR (-O2):
define double @airSgnPow(double %0, double %1) {
%3 = fcmp oeq double %1, 1.000000e+00
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = fcmp ult double %0, 0.000000e+00
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call double @pow(double %0, double %1)
br label %12
8: ; preds = %4
%9 = fneg double %0
%10 = tail call double @pow(double %9, double %1)
%11 = fneg double %10
br label %12
12: ; preds = %2, %6, %8
%13 = phi double [ %7, %6 ], [ %11, %8 ], [ %0, %2 ]
ret double %13
}