#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 fabs(double);
double pow(double, double);
double bias(double x, double p) {
  double ap;
  p = 2 * p - 1.0;
  if (p) {
    if ((ap = fabs(p)) <= 1.0)
      x *= (p * x + 1.0 - p);
    else {
      ap = pow(2.0, ap);
      if (p < 0.0)
        x = 1.0 - pow(1.0 - x, ap);
      else
        x = pow(x, ap);
    }
  }
  return x;
}


x86 assembly (clang, -O0):
<bias>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xecd(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1159 <bias+0x49>
jp     1159 <bias+0x49>
jmp    1221 <bias+0x111>
movsd  -0x10(%rbp),%xmm1
movaps 0xebb(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  %xmm1,-0x18(%rbp)
movsd  0xe92(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     11ae <bias+0x9e>
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe72(%rip),%xmm1
addsd  %xmm1,%xmm0
subsd  -0x10(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    121c <bias+0x10c>
movsd  -0x18(%rbp),%xmm1
movsd  0xe55(%rip),%xmm0
call   1030 <pow@plt>
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1203 <bias+0xf3>
movsd  0xe2d(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xe13(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1217 <bias+0x107>
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    121c <bias+0x10c>
jmp    1221 <bias+0x111>
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bias>:
sub    $0x28,%rsp
addsd  %xmm1,%xmm1
addsd  0xed0(%rip),%xmm1
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    1140 <bias+0x20>
jnp    11b6 <bias+0x96>
movapd 0xec8(%rip),%xmm0
andpd  %xmm1,%xmm0
movsd  0xeb4(%rip),%xmm3
ucomisd %xmm0,%xmm3
jae    119e <bias+0x7e>
movapd %xmm2,0x10(%rsp)
movapd %xmm1,(%rsp)
call   1030 <exp2@plt>
movapd 0x10(%rsp),%xmm2
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd (%rsp),%xmm0
jbe    11bf <bias+0x9f>
movsd  0xe81(%rip),%xmm0
subsd  %xmm2,%xmm0
call   1040 <pow@plt>
movsd  0xe70(%rip),%xmm2
subsd  %xmm0,%xmm2
jmp    11b6 <bias+0x96>
movapd %xmm1,%xmm0
mulsd  %xmm2,%xmm0
addsd  0xe5a(%rip),%xmm0
subsd  %xmm1,%xmm0
mulsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
add    $0x28,%rsp
ret
movapd %xmm2,%xmm0
add    $0x28,%rsp
jmp    1040 <pow@plt>

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

LLVM IR (-O2):
define double @bias(double %0, double %1) {
%3 = tail call double @llvm.fmuladd.f64(double %1, double 2.000000e+00, double -1.000000e+00)
%4 = fcmp une double %3, 0.000000e+00
br i1 %4, label %5, label %21
5: ; preds = %2
%6 = tail call double @llvm.fabs.f64(double %3)
%7 = fcmp ugt double %6, 1.000000e+00
br i1 %7, label %12, label %8
8: ; preds = %5
%9 = tail call double @llvm.fmuladd.f64(double %3, double %0, double 1.000000e+00)
%10 = fsub double %9, %3
%11 = fmul double %10, %0
br label %21
12: ; preds = %5
%13 = tail call double @exp2(double %6)
%14 = fcmp olt double %3, 0.000000e+00
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = fsub double 1.000000e+00, %0
%17 = tail call double @pow(double %16, double %13)
%18 = fsub double 1.000000e+00, %17
br label %21
19: ; preds = %12
%20 = tail call double @pow(double %0, double %13)
br label %21
21: ; preds = %8, %19, %15, %2
%22 = phi double [ %11, %8 ], [ %18, %15 ], [ %20, %19 ], [ %0, %2 ]
ret double %22
}