#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 log(double);
int /*<<< orphan*/ puts(char *);
double lnPDFkernelBDS_YR07(double t, double t1, double vt1, double lambda,
                           double mu, double rho) {
  double lnp, mlt = (mu - lambda) * t, expmlt, small = 1e-20;
  if (fabs(mu - lambda) < small)
    lnp = log((1 + rho * lambda * t1) /
              (t1 * ((1 + rho * lambda * t) * (1 + rho * lambda * t))));
  else {
    expmlt = exp(mlt);
    lnp = (rho * (lambda - mu) /
           (rho * lambda + (lambda * (1 - rho) - mu) * expmlt));
    if (lnp < 0)
      puts("this should not be negative, in lnPDFkernelBDS_YR07");
    lnp = log(lnp * lnp * lambda / (vt1 * rho) * expmlt);
  }
  return (lnp);
}


x86 assembly (clang, -O0):
<lnPDFkernelBDS_YR07>:
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  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe9e(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
movaps 0xe78(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1218 <lnPDFkernelBDS_YR07+0xe8>
movsd  -0x30(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe62(%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  0xe3e(%rip),%xmm3
addsd  %xmm3,%xmm2
movsd  -0x30(%rbp),%xmm3
mulsd  -0x20(%rbp),%xmm3
movsd  -0x8(%rbp),%xmm4
mulsd  %xmm4,%xmm3
movsd  0xe1f(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1050 <log@plt>
movsd  %xmm0,-0x38(%rbp)
jmp    12d6 <lnPDFkernelBDS_YR07+0x1a6>
movsd  -0x40(%rbp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x48(%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  0xdc7(%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  -0x48(%rbp),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    12aa <lnPDFkernelBDS_YR07+0x17a>
lea    0xd7b(%rip),%rdi
call   1030 <puts@plt>
movsd  -0x38(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x48(%rbp),%xmm0
call   1050 <log@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lnPDFkernelBDS_YR07>:
sub    $0x28,%rsp
movapd %xmm4,%xmm7
subsd  %xmm3,%xmm7
movapd 0xebb(%rip),%xmm8
andpd  %xmm7,%xmm8
movsd  0xebe(%rip),%xmm6
ucomisd %xmm8,%xmm6
jbe    118a <lnPDFkernelBDS_YR07+0x5a>
mulsd  %xmm5,%xmm3
movapd %xmm3,%xmm4
mulsd  %xmm1,%xmm4
movsd  0xeab(%rip),%xmm2
addsd  %xmm2,%xmm4
mulsd  %xmm0,%xmm3
addsd  %xmm2,%xmm3
mulsd  %xmm3,%xmm3
mulsd  %xmm1,%xmm3
divsd  %xmm3,%xmm4
jmp    1249 <lnPDFkernelBDS_YR07+0x119>
movsd  %xmm2,0x20(%rsp)
mulsd  %xmm0,%xmm7
movapd %xmm7,%xmm0
movsd  %xmm3,0x10(%rsp)
movsd  %xmm5,0x8(%rsp)
movsd  %xmm4,(%rsp)
call   1040 <exp@plt>
movsd  0x8(%rsp),%xmm3
movsd  0x10(%rsp),%xmm2
movapd %xmm0,%xmm4
movapd %xmm2,%xmm5
movsd  (%rsp),%xmm1
subsd  %xmm1,%xmm5
mulsd  %xmm3,%xmm5
movsd  0xe41(%rip),%xmm0
subsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm0
subsd  %xmm1,%xmm0
mulsd  %xmm4,%xmm0
movapd %xmm3,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm5
xorpd  %xmm0,%xmm0
ucomisd %xmm5,%xmm0
jbe    122f <lnPDFkernelBDS_YR07+0xff>
lea    0xe18(%rip),%rdi
movsd  %xmm4,(%rsp)
movsd  %xmm5,0x18(%rsp)
call   1030 <puts@plt>
movsd  0x18(%rsp),%xmm5
movsd  0x8(%rsp),%xmm3
movsd  (%rsp),%xmm4
movsd  0x10(%rsp),%xmm2
mulsd  %xmm5,%xmm5
mulsd  %xmm2,%xmm5
movsd  0x20(%rsp),%xmm0
mulsd  %xmm3,%xmm0
divsd  %xmm0,%xmm5
mulsd  %xmm5,%xmm4
movapd %xmm4,%xmm0
add    $0x28,%rsp
jmp    1050 <log@plt>

LLVM IR (-O0):
@.str = [52 x i8] c"this should not be negative, in lnPDFkernelBDS_YR07\00"
define double @lnPDFkernelBDS_YR07(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
%16 = 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
%17 = load double, double* %11
%18 = load double, double* %10
%19 = fsub double %17, %18
%20 = load double, double* %7
%21 = fmul double %19, %20
store double %21, double* %14
store double 0x3BC79CA10C924223, double* %16
%22 = load double, double* %11
%23 = load double, double* %10
%24 = fsub double %22, %23
%25 = call double @llvm.fabs.f64(double %24)
%26 = load double, double* %16
%27 = fcmp olt double %25, %26
br i1 %27, label %28, label %49
28: ; preds = %6
%29 = load double, double* %12
%30 = load double, double* %10
%31 = fmul double %29, %30
%32 = load double, double* %8
%33 = call double @llvm.fmuladd.f64(double %31, double %32, double 1.000000e+00)
%34 = load double, double* %8
%35 = load double, double* %12
%36 = load double, double* %10
%37 = fmul double %35, %36
%38 = load double, double* %7
%39 = call double @llvm.fmuladd.f64(double %37, double %38, double 1.000000e+00)
%40 = load double, double* %12
%41 = load double, double* %10
%42 = fmul double %40, %41
%43 = load double, double* %7
%44 = call double @llvm.fmuladd.f64(double %42, double %43, double 1.000000e+00)
%45 = fmul double %39, %44
%46 = fmul double %34, %45
%47 = fdiv double %33, %46
%48 = call double @log(double %47)
store double %48, double* %13
br label %86
49: ; preds = %6
%50 = load double, double* %14
%51 = call double @exp(double %50)
store double %51, double* %15
%52 = load double, double* %12
%53 = load double, double* %10
%54 = load double, double* %11
%55 = fsub double %53, %54
%56 = fmul double %52, %55
%57 = load double, double* %12
%58 = load double, double* %10
%59 = load double, double* %10
%60 = load double, double* %12
%61 = fsub double 1.000000e+00, %60
%62 = load double, double* %11
%63 = fneg double %62
%64 = call double @llvm.fmuladd.f64(double %59, double %61, double %63)
%65 = load double, double* %15
%66 = fmul double %64, %65
%67 = call double @llvm.fmuladd.f64(double %57, double %58, double %66)
%68 = fdiv double %56, %67
store double %68, double* %13
%69 = load double, double* %13
%70 = fcmp olt double %69, 0.000000e+00
br i1 %70, label %71, label %73
71: ; preds = %49
%72 = call i32 @puts(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
br label %73
73: ; preds = %71, %49
%74 = load double, double* %13
%75 = load double, double* %13
%76 = fmul double %74, %75
%77 = load double, double* %10
%78 = fmul double %76, %77
%79 = load double, double* %9
%80 = load double, double* %12
%81 = fmul double %79, %80
%82 = fdiv double %78, %81
%83 = load double, double* %15
%84 = fmul double %82, %83
%85 = call double @log(double %84)
store double %85, double* %13
br label %86
86: ; preds = %73, %28
%87 = load double, double* %13
ret double %87
}

LLVM IR (-O2):
@.str = [52 x i8] c"this should not be negative, in lnPDFkernelBDS_YR07\00"
define double @lnPDFkernelBDS_YR07(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = fsub double %4, %3
%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 %37
17: ; preds = %6
%18 = fmul double %7, %0
%19 = tail call double @exp(double %18)
%20 = fsub double %3, %4
%21 = fmul double %20, %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, %19
%26 = tail call double @llvm.fmuladd.f64(double %5, double %3, double %25)
%27 = fdiv double %21, %26
%28 = fcmp olt double %27, 0.000000e+00
br i1 %28, label %29, label %31
29: ; preds = %17
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
br label %31
31: ; preds = %29, %17
%32 = fmul double %27, %27
%33 = fmul double %32, %3
%34 = fmul double %2, %5
%35 = fdiv double %33, %34
%36 = fmul double %19, %35
br label %37
37: ; preds = %31, %10
%38 = phi double [ %36, %31 ], [ %16, %10 ]
%39 = tail call double @log(double %38)
ret double %39
}