#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 exp(double);
double fabs(double);
double PDFkernelBD(double t, double t1, double vt1, double lambda, double mu,
                   double rho) {
  double pdf, expmlt, small = 1e-20;
  if (fabs(lambda - mu) < small)
    pdf = (1 + rho * lambda * t1) /
          (t1 * ((1 + rho * lambda * t) * (1 + rho * lambda * t)));
  else {
    expmlt = exp((mu - lambda) * t);
    pdf = (rho * (lambda - mu) /
           (rho * lambda + (lambda * (1 - rho) - mu) * expmlt));
    pdf = pdf * pdf * lambda / (vt1 * rho) * expmlt;
  }
  return (pdf);
}


x86 assembly (clang, -O0):
<PDFkernelBD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  0xed2(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm1
subsd  -0x28(%rbp),%xmm1
movaps 0xeac(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11df <PDFkernelBD+0xcf>
movsd  -0x30(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe96(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm3
mulsd  %xmm3,%xmm2
movsd  0xe72(%rip),%xmm3
addsd  %xmm3,%xmm2
movsd  -0x30(%rbp),%xmm3
mulsd  -0x20(%rbp),%xmm3
movsd  -0x8(%rbp),%xmm4
mulsd  %xmm4,%xmm3
movsd  0xe53(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    1288 <PDFkernelBD+0x178>
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm3
movsd  -0x20(%rbp),%xmm2
movsd  0xdf6(%rip),%xmm5
subsd  -0x30(%rbp),%xmm5
movsd  -0x28(%rbp),%xmm4
movq   %xmm4,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm4
mulsd  %xmm5,%xmm2
addsd  %xmm4,%xmm2
mulsd  -0x40(%rbp),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PDFkernelBD>:
sub    $0x38,%rsp
movapd %xmm3,%xmm8
subsd  %xmm4,%xmm8
movapd 0xeda(%rip),%xmm6
andpd  %xmm8,%xmm6
movsd  0xedd(%rip),%xmm7
ucomisd %xmm6,%xmm7
jbe    116a <PDFkernelBD+0x5a>
mulsd  %xmm5,%xmm3
movapd %xmm3,%xmm4
mulsd  %xmm1,%xmm4
movsd  0xecb(%rip),%xmm2
addsd  %xmm2,%xmm4
mulsd  %xmm0,%xmm3
addsd  %xmm2,%xmm3
mulsd  %xmm3,%xmm3
mulsd  %xmm1,%xmm3
divsd  %xmm3,%xmm4
jmp    11f2 <PDFkernelBD+0xe2>
movapd %xmm4,%xmm1
subsd  %xmm3,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
movapd %xmm8,0x20(%rsp)
movsd  %xmm3,0x8(%rsp)
movsd  %xmm2,0x18(%rsp)
movsd  %xmm5,(%rsp)
movsd  %xmm4,0x10(%rsp)
call   1030 <exp@plt>
movapd 0x20(%rsp),%xmm4
movsd  (%rsp),%xmm5
mulsd  %xmm5,%xmm4
movsd  0xe64(%rip),%xmm1
subsd  %xmm5,%xmm1
movsd  0x8(%rsp),%xmm3
mulsd  %xmm3,%xmm1
subsd  0x10(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x18(%rsp),%xmm2
mulsd  %xmm5,%xmm2
mulsd  %xmm3,%xmm5
addsd  %xmm1,%xmm5
divsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm4
mulsd  %xmm3,%xmm4
divsd  %xmm2,%xmm4
mulsd  %xmm0,%xmm4
movapd %xmm4,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @PDFkernelBD(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store double %5, double* %12
store double 0x3BC79CA10C924223, double* %15
%16 = load double, double* %10
%17 = load double, double* %11
%18 = fsub double %16, %17
%19 = call double @llvm.fabs.f64(double %18)
%20 = load double, double* %15
%21 = fcmp olt double %19, %20
br i1 %21, label %22, label %42
22: ; preds = %6
%23 = load double, double* %12
%24 = load double, double* %10
%25 = fmul double %23, %24
%26 = load double, double* %8
%27 = call double @llvm.fmuladd.f64(double %25, double %26, double 1.000000e+00)
%28 = load double, double* %8
%29 = load double, double* %12
%30 = load double, double* %10
%31 = fmul double %29, %30
%32 = load double, double* %7
%33 = call double @llvm.fmuladd.f64(double %31, double %32, double 1.000000e+00)
%34 = load double, double* %12
%35 = load double, double* %10
%36 = fmul double %34, %35
%37 = load double, double* %7
%38 = call double @llvm.fmuladd.f64(double %36, double %37, double 1.000000e+00)
%39 = fmul double %33, %38
%40 = fmul double %28, %39
%41 = fdiv double %27, %40
store double %41, double* %13
br label %77
42: ; preds = %6
%43 = load double, double* %11
%44 = load double, double* %10
%45 = fsub double %43, %44
%46 = load double, double* %7
%47 = fmul double %45, %46
%48 = call double @exp(double %47)
store double %48, double* %14
%49 = load double, double* %12
%50 = load double, double* %10
%51 = load double, double* %11
%52 = fsub double %50, %51
%53 = fmul double %49, %52
%54 = load double, double* %12
%55 = load double, double* %10
%56 = load double, double* %10
%57 = load double, double* %12
%58 = fsub double 1.000000e+00, %57
%59 = load double, double* %11
%60 = fneg double %59
%61 = call double @llvm.fmuladd.f64(double %56, double %58, double %60)
%62 = load double, double* %14
%63 = fmul double %61, %62
%64 = call double @llvm.fmuladd.f64(double %54, double %55, double %63)
%65 = fdiv double %53, %64
store double %65, double* %13
%66 = load double, double* %13
%67 = load double, double* %13
%68 = fmul double %66, %67
%69 = load double, double* %10
%70 = fmul double %68, %69
%71 = load double, double* %9
%72 = load double, double* %12
%73 = fmul double %71, %72
%74 = fdiv double %70, %73
%75 = load double, double* %14
%76 = fmul double %74, %75
store double %76, double* %13
br label %77
77: ; preds = %42, %22
%78 = load double, double* %13
ret double %78
}

LLVM IR (-O2):
define double @PDFkernelBD(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = fsub double %3, %4
%8 = tail call double @llvm.fabs.f64(double %7)
%9 = fcmp olt double %8, 0x3BC79CA10C924223
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = fmul double %3, %5
%12 = tail call double @llvm.fmuladd.f64(double %11, double %1, double 1.000000e+00)
%13 = tail call double @llvm.fmuladd.f64(double %11, double %0, double 1.000000e+00)
%14 = fmul double %13, %13
%15 = fmul double %14, %1
%16 = fdiv double %12, %15
br label %33
17: ; preds = %6
%18 = fsub double %4, %3
%19 = fmul double %18, %0
%20 = tail call double @exp(double %19)
%21 = fmul double %7, %5
%22 = fsub double 1.000000e+00, %5
%23 = fneg double %4
%24 = tail call double @llvm.fmuladd.f64(double %3, double %22, double %23)
%25 = fmul double %24, %20
%26 = tail call double @llvm.fmuladd.f64(double %5, double %3, double %25)
%27 = fdiv double %21, %26
%28 = fmul double %27, %27
%29 = fmul double %28, %3
%30 = fmul double %2, %5
%31 = fdiv double %29, %30
%32 = fmul double %20, %31
br label %33
33: ; preds = %17, %10
%34 = phi double [ %16, %10 ], [ %32, %17 ]
ret double %34
}