double trigamma(double x) {
  double p;
  int i;
  x = x + 6;
  p = 1 / (x * x);
  p = (((((0.075757575757576 * p - 0.033333333333333) * p +
          0.0238095238095238) *
             p -
         0.033333333333333) *
            p +
        0.166666666666667) *
           p +
       1) /
          x +
      0.5 * p;
  for (i = 0; i < 6; i++) {
    x = x - 1;
    p = 1 / (x * x) + p;
  }
  return (p);
}


x86 assembly (clang, -O0):
<trigamma>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xf1f(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xedb(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  0xee5(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xec9(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xebc(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe9f(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe82(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe65(%rip),%xmm0
addsd  %xmm0,%xmm1
divsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  0xe47(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x6,-0x14(%rbp)
jge    121b <trigamma+0x11b>
movsd  -0x8(%rbp),%xmm0
movsd  0xe24(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xe09(%rip),%xmm0
divsd  %xmm1,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11cd <trigamma+0xcd>
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<trigamma>:
addsd  0xef8(%rip),%xmm0
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xef0(%rip),%xmm3
movapd %xmm3,%xmm2
divsd  %xmm1,%xmm2
movsd  0xee8(%rip),%xmm1
mulsd  %xmm2,%xmm1
movsd  0xee4(%rip),%xmm4
addsd  %xmm4,%xmm1
mulsd  %xmm2,%xmm1
addsd  0xedc(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm4,%xmm1
mulsd  %xmm2,%xmm1
addsd  0xed0(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm3,%xmm1
mulsd  0xec8(%rip),%xmm2
divsd  %xmm0,%xmm1
addsd  %xmm1,%xmm2
movsd  0xec0(%rip),%xmm3
addsd  %xmm3,%xmm0
movapd %xmm0,%xmm4
addsd  %xmm3,%xmm4
unpcklpd %xmm4,%xmm0
mulpd  %xmm0,%xmm0
movapd 0xeac(%rip),%xmm1
movapd %xmm1,%xmm5
divpd  %xmm0,%xmm5
addsd  %xmm5,%xmm2
unpckhpd %xmm5,%xmm5
addsd  %xmm2,%xmm5
addsd  %xmm3,%xmm4
movapd %xmm4,%xmm0
addsd  %xmm3,%xmm0
unpcklpd %xmm0,%xmm4
mulpd  %xmm4,%xmm4
movapd %xmm1,%xmm2
divpd  %xmm4,%xmm2
addsd  %xmm2,%xmm5
unpckhpd %xmm2,%xmm2
addsd  %xmm5,%xmm2
addsd  %xmm3,%xmm0
addsd  %xmm0,%xmm3
unpcklpd %xmm3,%xmm0
mulpd  %xmm0,%xmm0
divpd  %xmm0,%xmm1
addsd  %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @trigamma(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca i32
store double %0, double* %2
%5 = load double, double* %2
%6 = fadd double %5, 6.000000e+00
store double %6, double* %2
%7 = load double, double* %2
%8 = load double, double* %2
%9 = fmul double %7, %8
%10 = fdiv double 1.000000e+00, %9
store double %10, double* %3
%11 = load double, double* %3
%12 = call double @llvm.fmuladd.f64(double 0x3FB364D9364D9376, double %11, double 0xBFA11111111110E1)
%13 = load double, double* %3
%14 = call double @llvm.fmuladd.f64(double %12, double %13, double 0x3F98618618618616)
%15 = load double, double* %3
%16 = call double @llvm.fmuladd.f64(double %14, double %15, double 0xBFA11111111110E1)
%17 = load double, double* %3
%18 = call double @llvm.fmuladd.f64(double %16, double %17, double 0x3FC5555555555561)
%19 = load double, double* %3
%20 = call double @llvm.fmuladd.f64(double %18, double %19, double 1.000000e+00)
%21 = load double, double* %2
%22 = fdiv double %20, %21
%23 = load double, double* %3
%24 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %23, double %22)
store double %24, double* %3
store i32 0, i32* %4
br label %25
25: ; preds = %37, %1
%26 = load i32, i32* %4
%27 = icmp slt i32 %26, 6
br i1 %27, label %28, label %40
28: ; preds = %25
%29 = load double, double* %2
%30 = fsub double %29, 1.000000e+00
store double %30, double* %2
%31 = load double, double* %2
%32 = load double, double* %2
%33 = fmul double %31, %32
%34 = fdiv double 1.000000e+00, %33
%35 = load double, double* %3
%36 = fadd double %34, %35
store double %36, double* %3
br label %37
37: ; preds = %28
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %25
40: ; preds = %25
%41 = load double, double* %3
ret double %41
}

LLVM IR (-O2):
define double @trigamma(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 0x3FB364D9364D9376, double 0xBFA11111111110E1)
%6 = tail call double @llvm.fmuladd.f64(double %5, double %4, double 0x3F98618618618616)
%7 = tail call double @llvm.fmuladd.f64(double %6, double %4, double 0xBFA11111111110E1)
%8 = tail call double @llvm.fmuladd.f64(double %7, double %4, double 0x3FC5555555555561)
%9 = tail call double @llvm.fmuladd.f64(double %8, double %4, double 1.000000e+00)
%10 = fdiv double %9, %2
%11 = tail call double @llvm.fmuladd.f64(double %4, double 5.000000e-01, double %10)
%12 = fadd double %2, -1.000000e+00
%13 = fadd double %12, -1.000000e+00
%14 = insertelement <2 x double> poison, double %12, i64 0
%15 = insertelement <2 x double> %14, double %13, i64 1
%16 = fmul <2 x double> %15, %15
%17 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %16
%18 = extractelement <2 x double> %17, i64 0
%19 = fadd double %11, %18
%20 = extractelement <2 x double> %17, i64 1
%21 = fadd double %19, %20
%22 = fadd double %13, -1.000000e+00
%23 = fadd double %22, -1.000000e+00
%24 = insertelement <2 x double> poison, double %22, i64 0
%25 = insertelement <2 x double> %24, double %23, i64 1
%26 = fmul <2 x double> %25, %25
%27 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %26
%28 = extractelement <2 x double> %27, i64 0
%29 = fadd double %21, %28
%30 = extractelement <2 x double> %27, i64 1
%31 = fadd double %29, %30
%32 = fadd double %23, -1.000000e+00
%33 = fadd double %32, -1.000000e+00
%34 = insertelement <2 x double> poison, double %32, i64 0
%35 = insertelement <2 x double> %34, double %33, i64 1
%36 = fmul <2 x double> %35, %35
%37 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %36
%38 = extractelement <2 x double> %37, i64 0
%39 = fadd double %31, %38
%40 = extractelement <2 x double> %37, i64 1
%41 = fadd double %39, %40
ret double %41
}