#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 airFlippedSgnPow(double vv, double pp) {
  double sn = 1.0;
  if (1.0 == pp) {
    return vv;
  }
  if (vv < 0) {
    sn = -1.0;
    vv = -vv;
  }
  return sn * (1.0 - pow(1.0 - ((1.0) < (vv) ? (1.0) : (vv)), pp));
}


x86 assembly (clang, -O0):
<airFlippedSgnPow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  0xed6(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xec9(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    1157 <airFlippedSgnPow+0x47>
jp     1157 <airFlippedSgnPow+0x47>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1208 <airFlippedSgnPow+0xf8>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1193 <airFlippedSgnPow+0x83>
movsd  0xe9b(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe56(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11c6 <airFlippedSgnPow+0xb6>
movsd  0xe44(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    11d0 <airFlippedSgnPow+0xc0>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  0xe23(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm2
movsd  -0x28(%rbp),%xmm0
movsd  0xe05(%rip),%xmm1
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<airFlippedSgnPow>:
sub    $0x18,%rsp
ucomisd 0xee4(%rip),%xmm1
jne    1125 <airFlippedSgnPow+0x15>
jp     1125 <airFlippedSgnPow+0x15>
add    $0x18,%rsp
ret
movapd %xmm0,%xmm3
movapd %xmm0,(%rsp)
xorpd  0xeda(%rip),%xmm0
xorpd  %xmm4,%xmm4
movapd %xmm3,%xmm2
cmpltsd %xmm4,%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm3,%xmm2
orpd   %xmm0,%xmm2
movsd  0xea9(%rip),%xmm0
movapd %xmm0,%xmm3
minsd  %xmm2,%xmm3
subsd  %xmm3,%xmm0
call   1030 <pow@plt>
movsd  0xe90(%rip),%xmm1
xorpd  %xmm2,%xmm2
ucomisd (%rsp),%xmm2
subsd  %xmm0,%xmm1
jbe    1187 <airFlippedSgnPow+0x77>
xorpd  0xe89(%rip),%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

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

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