#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 log(double);
scalar_t__ xlgamma(double);
double gammprob(double x, double p, double lam) {
  double xx, yl;
  xx = ((x) < (1.0e-8) ? (1.0e-8) : (x));
  yl = (p - 1) * log(xx) - lam * xx;
  yl += p * log(lam);
  yl -= xlgamma(p);
  return yl;
}


x86 assembly (clang, -O0):
<gammprob>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  0xec1(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    115c <gammprob+0x3c>
movsd  0xeae(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1166 <gammprob+0x46>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe8b(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm2
movsd  -0x38(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <xlgamma@plt>
cvtsi2sd %rax,%xmm1
movsd  -0x28(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gammprob>:
sub    $0x28,%rsp
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x20(%rsp)
movsd  0xec8(%rip),%xmm2
maxsd  %xmm0,%xmm2
movsd  %xmm2,0x18(%rsp)
movsd  0xebe(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movapd %xmm2,%xmm0
call   1040 <log@plt>
movapd %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm2
mulsd  %xmm0,%xmm2
mulsd  0x8(%rsp),%xmm1
subsd  %xmm2,%xmm1
movsd  %xmm1,0x8(%rsp)
call   1040 <log@plt>
movapd %xmm0,%xmm1
movsd  0x20(%rsp),%xmm0
mulsd  %xmm0,%xmm1
addsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x10(%rsp)
call   1030 <xlgamma@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
movsd  0x10(%rsp),%xmm0
subsd  %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @gammprob(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%9 = load double, double* %4
%10 = fcmp olt double %9, 1.000000e-08
br i1 %10, label %11, label %12
11: ; preds = %3
br label %14
12: ; preds = %3
%13 = load double, double* %4
br label %14
14: ; preds = %12, %11
%15 = phi double [ 1.000000e-08, %11 ], [ %13, %12 ]
store double %15, double* %7
%16 = load double, double* %5
%17 = fsub double %16, 1.000000e+00
%18 = load double, double* %7
%19 = call double @log(double %18)
%20 = load double, double* %6
%21 = load double, double* %7
%22 = fmul double %20, %21
%23 = fneg double %22
%24 = call double @llvm.fmuladd.f64(double %17, double %19, double %23)
store double %24, double* %8
%25 = load double, double* %5
%26 = load double, double* %6
%27 = call double @log(double %26)
%28 = load double, double* %8
%29 = call double @llvm.fmuladd.f64(double %25, double %27, double %28)
store double %29, double* %8
%30 = load double, double* %5
%31 = call i64 @xlgamma(double %30)
%32 = sitofp i64 %31 to double
%33 = load double, double* %8
%34 = fsub double %33, %32
store double %34, double* %8
%35 = load double, double* %8
ret double %35
}

LLVM IR (-O2):
define double @gammprob(double %0, double %1, double %2) {
%4 = fcmp olt double %0, 1.000000e-08
%5 = select i1 %4, double 1.000000e-08, double %0
%6 = fadd double %1, -1.000000e+00
%7 = tail call double @log(double %5)
%8 = fneg double %5
%9 = fmul double %8, %2
%10 = tail call double @llvm.fmuladd.f64(double %6, double %7, double %9)
%11 = tail call double @log(double %2)
%12 = tail call double @llvm.fmuladd.f64(double %1, double %11, double %10)
%13 = tail call i64 @xlgamma(double %1)
%14 = sitofp i64 %13 to double
%15 = fsub double %12, %14
ret double %15
}