#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 log(double const);
double dstrb_log_gamma_function(const double x) {
  const double sqrt_2pi = 2.50662827463100024;
  const double c[] = {1.000000000000000174663,      5716.400188274341379136,
                      -14815.30426768413909044,     14291.49277657478554025,
                      -6348.160217641458813289,     1301.608286058321874105,
                      -108.1767053514369634679,     2.605696505611755827729,
                      -0.7423452510201416151527e-2, 0.5384136432509564062961e-7,
                      -0.4023533141268236372067e-8};
  const double ss = x + 8.5;
  double t = x + 9.0;
  double s = c[0];
  for (int k = 10; k > 0; --k)
    s += c[k] / t--;
  return log(s * sqrt_2pi) + (x - 0.5) * log(ss) - ss;
}


x86 assembly (clang, -O0):
<dstrb_log_gamma_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xed8(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xee8(%rip),%rsi
mov    $0x58,%edx
call   1030 <memcpy@plt>
movsd  0xeae(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xe94(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movl   $0xa,-0x8c(%rbp)
cmpl   $0x0,-0x8c(%rbp)
jle    11e8 <dstrb_log_gamma_function+0xc8>
movslq -0x8c(%rbp),%rax
movsd  -0x70(%rbp,%rax,8),%xmm0
movsd  -0x80(%rbp),%xmm1
movsd  0xe6c(%rip),%xmm3
movaps %xmm1,%xmm2
addsd  %xmm3,%xmm2
movsd  %xmm2,-0x80(%rbp)
divsd  %xmm1,%xmm0
addsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x8c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8c(%rbp)
jmp    118d <dstrb_log_gamma_function+0x6d>
movsd  0xe20(%rip),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
call   1040 <log@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movsd  0xe06(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
call   1040 <log@plt>
movsd  -0xa0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x78(%rbp),%xmm0
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dstrb_log_gamma_function>:
sub    $0x18,%rsp
movsd  0xee4(%rip),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm0,%xmm5
movsd  %xmm0,(%rsp)
movsd  0xed7(%rip),%xmm0
movsd  0xed7(%rip),%xmm2
divsd  %xmm1,%xmm2
addsd  0xed3(%rip),%xmm2
addsd  %xmm0,%xmm1
movsd  0xecf(%rip),%xmm3
divsd  %xmm1,%xmm3
addsd  %xmm0,%xmm1
addsd  %xmm2,%xmm3
movapd %xmm1,%xmm2
addsd  %xmm0,%xmm2
unpcklpd %xmm2,%xmm1
movapd 0xecf(%rip),%xmm4
divpd  %xmm1,%xmm4
addsd  %xmm4,%xmm3
addsd  %xmm0,%xmm2
unpckhpd %xmm4,%xmm4
addsd  %xmm3,%xmm4
movapd %xmm2,%xmm1
addsd  %xmm0,%xmm1
unpcklpd %xmm1,%xmm2
movapd 0xeb7(%rip),%xmm3
divpd  %xmm2,%xmm3
addsd  %xmm3,%xmm4
addsd  %xmm0,%xmm1
unpckhpd %xmm3,%xmm3
addsd  %xmm4,%xmm3
movapd %xmm1,%xmm2
addsd  %xmm0,%xmm2
unpcklpd %xmm2,%xmm1
movapd 0xe9f(%rip),%xmm4
divpd  %xmm1,%xmm4
addsd  %xmm4,%xmm3
addsd  %xmm0,%xmm2
unpckhpd %xmm4,%xmm4
addsd  %xmm3,%xmm4
addsd  %xmm2,%xmm0
unpcklpd %xmm0,%xmm2
movapd 0xe8b(%rip),%xmm0
divpd  %xmm2,%xmm0
addsd  %xmm0,%xmm4
unpckhpd %xmm0,%xmm0
addsd  %xmm4,%xmm0
movsd  0xe2b(%rip),%xmm1
addsd  %xmm5,%xmm1
movsd  %xmm1,0x8(%rsp)
mulsd  0xe21(%rip),%xmm0
call   1030 <log@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
addsd  0xe11(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <log@plt>
mulsd  (%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.dstrb_log_gamma_function.c = [11 x double] [double 0x3FF0000000000001, double 0x40B6546672BD1E8A, double 0xC0CCEFA6F23E544E, double 0x40CBE9BF134D8478, double 0xC0B8CC290405FA4F, double 0x4094566EE28A5C6C, double 0xC05B0B4F23F65CCC, double 0x4004D87768D73B56, double 0xBF7E680DDC1359AC, double 0x3E6CE7E6989F8CA3, double 0xBE3147EBE5B11056]
define double @dstrb_log_gamma_function(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca [11 x double]
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i32
store double %0, double* %2
store double 0x40040D931FF62705, double* %3
%9 = bitcast [11 x double]* %4 to i8*
%10 = load double, double* %2
%11 = fadd double %10, 8.500000e+00
store double %11, double* %5
%12 = load double, double* %2
%13 = fadd double %12, 9.000000e+00
store double %13, double* %6
%14 = getelementptr inbounds [11 x double], [11 x double]* %4, i64 0, i64 0
%15 = load double, double* %14
store double %15, double* %7
store i32 10, i32* %8
br label %16
16: ; preds = %29, %1
%17 = load i32, i32* %8
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %32
19: ; preds = %16
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [11 x double], [11 x double]* %4, i64 0, i64 %21
%23 = load double, double* %22
%24 = load double, double* %6
%25 = fadd double %24, -1.000000e+00
store double %25, double* %6
%26 = fdiv double %23, %24
%27 = load double, double* %7
%28 = fadd double %27, %26
store double %28, double* %7
br label %29
29: ; preds = %19
%30 = load i32, i32* %8
%31 = add nsw i32 %30, -1
store i32 %31, i32* %8
br label %16
32: ; preds = %16
%33 = load double, double* %7
%34 = fmul double %33, 0x40040D931FF62705
%35 = call double @log(double %34)
%36 = load double, double* %2
%37 = fsub double %36, 5.000000e-01
%38 = load double, double* %5
%39 = call double @log(double %38)
%40 = call double @llvm.fmuladd.f64(double %37, double %39, double %35)
%41 = load double, double* %5
%42 = fsub double %40, %41
ret double %42
}

LLVM IR (-O2):
define double @dstrb_log_gamma_function(double %0) {
%2 = fadd double %0, 9.000000e+00
%3 = fadd double %2, -1.000000e+00
%4 = fdiv double 0xBE3147EBE5B11056, %2
%5 = fadd double %4, 0x3FF0000000000001
%6 = fadd double %3, -1.000000e+00
%7 = fdiv double 0x3E6CE7E6989F8CA3, %3
%8 = fadd double %5, %7
%9 = fadd double %6, -1.000000e+00
%10 = insertelement <2 x double> poison, double %6, i64 0
%11 = insertelement <2 x double> %10, double %9, i64 1
%12 = fdiv <2 x double> <double 0xBF7E680DDC1359AC, double 0x4004D87768D73B56>, %11
%13 = extractelement <2 x double> %12, i64 0
%14 = fadd double %8, %13
%15 = fadd double %9, -1.000000e+00
%16 = extractelement <2 x double> %12, i64 1
%17 = fadd double %14, %16
%18 = fadd double %15, -1.000000e+00
%19 = insertelement <2 x double> poison, double %15, i64 0
%20 = insertelement <2 x double> %19, double %18, i64 1
%21 = fdiv <2 x double> <double 0xC05B0B4F23F65CCC, double 0x4094566EE28A5C6C>, %20
%22 = extractelement <2 x double> %21, i64 0
%23 = fadd double %17, %22
%24 = fadd double %18, -1.000000e+00
%25 = extractelement <2 x double> %21, i64 1
%26 = fadd double %23, %25
%27 = fadd double %24, -1.000000e+00
%28 = insertelement <2 x double> poison, double %24, i64 0
%29 = insertelement <2 x double> %28, double %27, i64 1
%30 = fdiv <2 x double> <double 0xC0B8CC290405FA4F, double 0x40CBE9BF134D8478>, %29
%31 = extractelement <2 x double> %30, i64 0
%32 = fadd double %26, %31
%33 = fadd double %27, -1.000000e+00
%34 = extractelement <2 x double> %30, i64 1
%35 = fadd double %32, %34
%36 = fadd double %33, -1.000000e+00
%37 = insertelement <2 x double> poison, double %33, i64 0
%38 = insertelement <2 x double> %37, double %36, i64 1
%39 = fdiv <2 x double> <double 0xC0CCEFA6F23E544E, double 0x40B6546672BD1E8A>, %38
%40 = extractelement <2 x double> %39, i64 0
%41 = fadd double %35, %40
%42 = extractelement <2 x double> %39, i64 1
%43 = fadd double %41, %42
%44 = fadd double %0, 8.500000e+00
%45 = fmul double %43, 0x40040D931FF62705
%46 = tail call double @log(double %45)
%47 = fadd double %0, -5.000000e-01
%48 = tail call double @log(double %44)
%49 = tail call double @llvm.fmuladd.f64(double %47, double %48, double %46)
%50 = fsub double %49, %44
ret double %50
}