#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 */
int /*<<< orphan*/ error2(char *);
double log(double);
double lnPDFkernelBeta(double t, double t1, double p, double q) {
  double lnp, x = t / t1;
  if (x < 0 || x > 1)
    error2("t outside of range (0, t1)");
  lnp = (p - 1) * log(x) + (q - 1) * log(1 - x);
  lnp -= log(t1);
  return (lnp);
}


x86 assembly (clang, -O0):
<lnPDFkernelBeta>:
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  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x30(%rbp),%xmm0
ja     1170 <lnPDFkernelBeta+0x50>
movsd  -0x30(%rbp),%xmm0
movsd  0xe9a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    117c <lnPDFkernelBeta+0x5c>
lea    0xe91(%rip),%rdi
call   1030 <error2@plt>
movsd  -0x18(%rbp),%xmm0
movsd  0xe77(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <log@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe52(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe41(%rip),%xmm0
subsd  -0x30(%rbp),%xmm0
call   1040 <log@plt>
movsd  -0x48(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lnPDFkernelBeta>:
sub    $0x28,%rsp
movsd  %xmm3,0x8(%rsp)
movsd  %xmm2,(%rsp)
movsd  %xmm1,0x20(%rsp)
divsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
movsd  %xmm0,0x10(%rsp)
ja     1153 <lnPDFkernelBeta+0x33>
ucomisd 0xeaf(%rip),%xmm0
jbe    1165 <lnPDFkernelBeta+0x45>
lea    0xeb6(%rip),%rdi
call   1030 <error2@plt>
movsd  0x10(%rsp),%xmm0
movsd  (%rsp),%xmm1
addsd  0xe96(%rip),%xmm1
movsd  %xmm1,(%rsp)
call   1040 <log@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xe78(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xe62(%rip),%xmm0
subsd  0x10(%rsp),%xmm0
call   1040 <log@plt>
mulsd  0x8(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  (%rsp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
movsd  0x20(%rsp),%xmm0
call   1040 <log@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"t outside of range (0, t1)\00"
define double @lnPDFkernelBeta(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%11 = load double, double* %5
%12 = load double, double* %6
%13 = fdiv double %11, %12
store double %13, double* %10
%14 = load double, double* %10
%15 = fcmp olt double %14, 0.000000e+00
br i1 %15, label %19, label %16
16: ; preds = %4
%17 = load double, double* %10
%18 = fcmp ogt double %17, 1.000000e+00
br i1 %18, label %19, label %21
19: ; preds = %16, %4
%20 = call i32 @error2(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %19, %16
%22 = load double, double* %7
%23 = fsub double %22, 1.000000e+00
%24 = load double, double* %10
%25 = call double @log(double %24)
%26 = load double, double* %8
%27 = fsub double %26, 1.000000e+00
%28 = load double, double* %10
%29 = fsub double 1.000000e+00, %28
%30 = call double @log(double %29)
%31 = fmul double %27, %30
%32 = call double @llvm.fmuladd.f64(double %23, double %25, double %31)
store double %32, double* %9
%33 = load double, double* %6
%34 = call double @log(double %33)
%35 = load double, double* %9
%36 = fsub double %35, %34
store double %36, double* %9
%37 = load double, double* %9
ret double %37
}

LLVM IR (-O2):
@.str = [27 x i8] c"t outside of range (0, t1)\00"
define double @lnPDFkernelBeta(double %0, double %1, double %2, double %3) {
%5 = fdiv double %0, %1
%6 = fcmp olt double %5, 0.000000e+00
%7 = fcmp ogt double %5, 1.000000e+00
%8 = or i1 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 @error2(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %4, %9
%12 = fadd double %2, -1.000000e+00
%13 = tail call double @log(double %5)
%14 = fadd double %3, -1.000000e+00
%15 = fsub double 1.000000e+00, %5
%16 = tail call double @log(double %15)
%17 = fmul double %14, %16
%18 = tail call double @llvm.fmuladd.f64(double %12, double %13, double %17)
%19 = tail call double @log(double %1)
%20 = fsub double %18, %19
ret double %20
}