#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 const gammln(double const);
double const log(int);
int pow(double const, double const);
double dloggamma(const double x, const double alpha, const double beta) {
  return log(pow(beta, alpha) * pow(x, alpha - 1.0)) - beta * x - gammln(alpha);
}


x86 assembly (clang, -O0):
<dloggamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1040 <pow@plt>
mov    %eax,-0x24(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xe95(%rip),%xmm2
subsd  %xmm2,%xmm1
call   1040 <pow@plt>
mov    -0x24(%rbp),%edi
imul   %eax,%edi
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <gammln@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dloggamma>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm2,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
movaps %xmm2,%xmm0
call   1040 <pow@plt>
mov    %eax,%ebx
movsd  0xea7(%rip),%xmm1
addsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm0
call   1040 <pow@plt>
imul   %eax,%ebx
mov    %ebx,%edi
call   1030 <log@plt>
movsd  0x18(%rsp),%xmm1
mulsd  0x8(%rsp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1050 <gammln@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @dloggamma(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %6
%8 = load double, double* %5
%9 = call i32 @pow(double %7, double %8)
%10 = load double, double* %4
%11 = load double, double* %5
%12 = fsub double %11, 1.000000e+00
%13 = call i32 @pow(double %10, double %12)
%14 = mul nsw i32 %9, %13
%15 = call double @log(i32 %14)
%16 = load double, double* %6
%17 = load double, double* %4
%18 = fneg double %16
%19 = call double @llvm.fmuladd.f64(double %18, double %17, double %15)
%20 = load double, double* %5
%21 = call double @gammln(double %20)
%22 = fsub double %19, %21
ret double %22
}

LLVM IR (-O2):
define double @dloggamma(double %0, double %1, double %2) {
%4 = tail call i32 @pow(double %2, double %1)
%5 = fadd double %1, -1.000000e+00
%6 = tail call i32 @pow(double %0, double %5)
%7 = mul nsw i32 %6, %4
%8 = tail call double @log(i32 %7)
%9 = fneg double %2
%10 = tail call double @llvm.fmuladd.f64(double %9, double %0, double %8)
%11 = tail call double @gammln(double %1)
%12 = fsub double %10, %11
ret double %12
}