#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 */
long LogGamma(long);
double exp(double);
long log(double);
double pdfErlang(long n, double b, double x) {
  double t;
  t = (n - 1) * log(x / b) - (x / b) - log(b) - LogGamma(n);
  return (exp(t));
}


x86 assembly (clang, -O0):
<pdfErlang>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    -0x8(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1050 <log@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
imul   %rcx,%rax
cvtsi2sd %rax,%xmm0
movsd  -0x18(%rbp),%xmm1
divsd  -0x10(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <log@plt>
movsd  -0x30(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <LogGamma@plt>
movsd  -0x28(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <exp@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pdfErlang>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
mov    %rdi,%rbx
lea    -0x1(%rdi),%r14
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm1,%xmm0
call   1050 <log@plt>
imul   %r14,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
subsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1050 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <LogGamma@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
movsd  0x8(%rsp),%xmm0
subsd  %xmm1,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r14
jmp    1040 <exp@plt>

LLVM IR (-O0):
define double @pdfErlang(i64 %0, double %1, double %2) {
%4 = alloca i64
%5 = alloca double
%6 = alloca double
%7 = alloca double
store i64 %0, i64* %4
store double %1, double* %5
store double %2, double* %6
%8 = load i64, i64* %4
%9 = sub nsw i64 %8, 1
%10 = load double, double* %6
%11 = load double, double* %5
%12 = fdiv double %10, %11
%13 = call i64 @log(double %12)
%14 = mul nsw i64 %9, %13
%15 = sitofp i64 %14 to double
%16 = load double, double* %6
%17 = load double, double* %5
%18 = fdiv double %16, %17
%19 = fsub double %15, %18
%20 = load double, double* %5
%21 = call i64 @log(double %20)
%22 = sitofp i64 %21 to double
%23 = fsub double %19, %22
%24 = load i64, i64* %4
%25 = call i64 @LogGamma(i64 %24)
%26 = sitofp i64 %25 to double
%27 = fsub double %23, %26
store double %27, double* %7
%28 = load double, double* %7
%29 = call double @exp(double %28)
ret double %29
}

LLVM IR (-O2):
define double @pdfErlang(i64 %0, double %1, double %2) {
%4 = add nsw i64 %0, -1
%5 = fdiv double %2, %1
%6 = tail call i64 @log(double %5)
%7 = mul nsw i64 %6, %4
%8 = sitofp i64 %7 to double
%9 = fsub double %8, %5
%10 = tail call i64 @log(double %1)
%11 = sitofp i64 %10 to double
%12 = fsub double %9, %11
%13 = tail call i64 @LogGamma(i64 %0)
%14 = sitofp i64 %13 to double
%15 = fsub double %12, %14
%16 = tail call double @exp(double %15)
ret double %16
}