#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);
double digamma(double x) {
  double p;
  x = x + 6;
  p = 1 / (x * x);
  p = (((0.004166666666667 * p - 0.003968253986254) * p + 0.008333333333333) *
           p -
       0.083333333333333) *
      p;
  p = p + log(x) - 0.5 / x - 1 / (x - 1) - 1 / (x - 2) - 1 / (x - 3) -
      1 / (x - 4) - 1 / (x - 5) - 1 / (x - 6);
  return p;
}


x86 assembly (clang, -O0):
<digamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xee3(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xebf(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xef1(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeed(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xec8(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeab(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe6d(%rip),%xmm1
divsd  -0x8(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xe27(%rip),%xmm1
subsd  %xmm1,%xmm2
movsd  0xe1b(%rip),%xmm1
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xe2e(%rip),%xmm1
subsd  %xmm1,%xmm2
movsd  0xdfa(%rip),%xmm1
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xe05(%rip),%xmm1
subsd  %xmm1,%xmm2
movsd  0xdd9(%rip),%xmm1
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xddc(%rip),%xmm1
subsd  %xmm1,%xmm2
movsd  0xdb8(%rip),%xmm1
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xdb3(%rip),%xmm1
subsd  %xmm1,%xmm2
movsd  0xd97(%rip),%xmm1
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xd8a(%rip),%xmm1
subsd  %xmm1,%xmm2
movsd  0xd76(%rip),%xmm1
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<digamma>:
sub    $0x28,%rsp
addsd  0xee4(%rip),%xmm0
movapd %xmm0,%xmm2
movapd %xmm0,0x10(%rsp)
mulsd  %xmm0,%xmm2
movsd  0xed6(%rip),%xmm1
divsd  %xmm2,%xmm1
movsd  0xed2(%rip),%xmm2
mulsd  %xmm1,%xmm2
addsd  0xece(%rip),%xmm2
mulsd  %xmm1,%xmm2
addsd  0xeca(%rip),%xmm2
mulsd  %xmm1,%xmm2
addsd  0xec6(%rip),%xmm2
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsp)
call   1030 <log@plt>
addsd  0x8(%rsp),%xmm0
movsd  0xeb1(%rip),%xmm1
movapd 0x10(%rsp),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
unpcklpd %xmm2,%xmm2
movapd 0xea7(%rip),%xmm1
addpd  %xmm2,%xmm1
movapd %xmm2,%xmm4
movapd 0xea7(%rip),%xmm2
movapd %xmm2,%xmm3
divpd  %xmm1,%xmm3
subsd  %xmm3,%xmm0
unpckhpd %xmm3,%xmm3
subsd  %xmm3,%xmm0
movapd 0xe9b(%rip),%xmm1
addpd  %xmm4,%xmm1
movapd %xmm2,%xmm3
divpd  %xmm1,%xmm3
subsd  %xmm3,%xmm0
unpckhpd %xmm3,%xmm3
subsd  %xmm3,%xmm0
addpd  0xe8b(%rip),%xmm4
divpd  %xmm4,%xmm2
subsd  %xmm2,%xmm0
unpckhpd %xmm2,%xmm2
subsd  %xmm2,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @digamma(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fadd double %4, 6.000000e+00
store double %5, double* %2
%6 = load double, double* %2
%7 = load double, double* %2
%8 = fmul double %6, %7
%9 = fdiv double 1.000000e+00, %8
store double %9, double* %3
%10 = load double, double* %3
%11 = call double @llvm.fmuladd.f64(double 0x3F71111111111291, double %10, double 0xBF704104117DAD00)
%12 = load double, double* %3
%13 = call double @llvm.fmuladd.f64(double %11, double %12, double 0x3F81111111111051)
%14 = load double, double* %3
%15 = call double @llvm.fmuladd.f64(double %13, double %14, double 0xBFB555555555553D)
%16 = load double, double* %3
%17 = fmul double %15, %16
store double %17, double* %3
%18 = load double, double* %3
%19 = load double, double* %2
%20 = call double @log(double %19)
%21 = fadd double %18, %20
%22 = load double, double* %2
%23 = fdiv double 5.000000e-01, %22
%24 = fsub double %21, %23
%25 = load double, double* %2
%26 = fsub double %25, 1.000000e+00
%27 = fdiv double 1.000000e+00, %26
%28 = fsub double %24, %27
%29 = load double, double* %2
%30 = fsub double %29, 2.000000e+00
%31 = fdiv double 1.000000e+00, %30
%32 = fsub double %28, %31
%33 = load double, double* %2
%34 = fsub double %33, 3.000000e+00
%35 = fdiv double 1.000000e+00, %34
%36 = fsub double %32, %35
%37 = load double, double* %2
%38 = fsub double %37, 4.000000e+00
%39 = fdiv double 1.000000e+00, %38
%40 = fsub double %36, %39
%41 = load double, double* %2
%42 = fsub double %41, 5.000000e+00
%43 = fdiv double 1.000000e+00, %42
%44 = fsub double %40, %43
%45 = load double, double* %2
%46 = fsub double %45, 6.000000e+00
%47 = fdiv double 1.000000e+00, %46
%48 = fsub double %44, %47
store double %48, double* %3
%49 = load double, double* %3
ret double %49
}

LLVM IR (-O2):
define double @digamma(double %0) {
%2 = fadd double %0, 6.000000e+00
%3 = fmul double %2, %2
%4 = fdiv double 1.000000e+00, %3
%5 = tail call double @llvm.fmuladd.f64(double %4, double 0x3F71111111111291, double 0xBF704104117DAD00)
%6 = tail call double @llvm.fmuladd.f64(double %5, double %4, double 0x3F81111111111051)
%7 = tail call double @llvm.fmuladd.f64(double %6, double %4, double 0xBFB555555555553D)
%8 = fmul double %4, %7
%9 = tail call double @log(double %2)
%10 = fadd double %8, %9
%11 = fdiv double 5.000000e-01, %2
%12 = fsub double %10, %11
%13 = insertelement <2 x double> poison, double %2, i64 0
%14 = shufflevector <2 x double> %13, <2 x double> poison, <2 x i32> zeroinitializer
%15 = fadd <2 x double> %14, <double -1.000000e+00, double -2.000000e+00>
%16 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %15
%17 = extractelement <2 x double> %16, i64 0
%18 = fsub double %12, %17
%19 = extractelement <2 x double> %16, i64 1
%20 = fsub double %18, %19
%21 = fadd <2 x double> %14, <double -3.000000e+00, double -4.000000e+00>
%22 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %21
%23 = extractelement <2 x double> %22, i64 0
%24 = fsub double %20, %23
%25 = extractelement <2 x double> %22, i64 1
%26 = fsub double %24, %25
%27 = fadd <2 x double> %14, <double -5.000000e+00, double -6.000000e+00>
%28 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %27
%29 = extractelement <2 x double> %28, i64 0
%30 = fsub double %26, %29
%31 = extractelement <2 x double> %28, i64 1
%32 = fsub double %30, %31
ret double %32
}