#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 */
float fastlog(float);
float fastdigamma(float x) {
  float twopx = 2.0f + x;
  float logterm = fastlog(twopx);
  return (-48.0f + x * (-157.0f + x * (-127.0f - 30.0f * x))) /
             (12.0f * x * (1.0f + x) * twopx * twopx) +
         logterm;
}


x86 assembly (clang, -O0):
<fastdigamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xef3(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <fastlog@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
movss  -0x4(%rbp),%xmm2
movss  0xebb(%rip),%xmm3
mulss  %xmm3,%xmm2
movss  0xeb3(%rip),%xmm3
addss  %xmm3,%xmm2
mulss  %xmm2,%xmm1
movss  0xe9b(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  0xe87(%rip),%xmm1
addss  %xmm1,%xmm0
movss  0xe77(%rip),%xmm1
mulss  -0x4(%rbp),%xmm1
movss  0xe66(%rip),%xmm2
addss  -0x4(%rbp),%xmm2
mulss  %xmm2,%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
addss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fastdigamma>:
push   %rax
movaps %xmm0,%xmm1
movss  %xmm0,(%rsp)
movss  0xedf(%rip),%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,0x4(%rsp)
call   1030 <fastlog@plt>
movss  0xecc(%rip),%xmm1
movss  (%rsp),%xmm3
mulss  %xmm3,%xmm1
addss  0xebf(%rip),%xmm1
mulss  %xmm3,%xmm1
addss  0xeb7(%rip),%xmm1
mulss  %xmm3,%xmm1
addss  0xeaf(%rip),%xmm1
movss  0xeab(%rip),%xmm2
mulss  %xmm3,%xmm2
addss  0xea3(%rip),%xmm3
mulss  %xmm2,%xmm3
movss  0x4(%rsp),%xmm2
mulss  %xmm2,%xmm3
mulss  %xmm2,%xmm3
divss  %xmm3,%xmm1
addss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @fastdigamma(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %2
%5 = load float, float* %2
%6 = fadd float 2.000000e+00, %5
store float %6, float* %3
%7 = load float, float* %3
%8 = call float @fastlog(float %7)
store float %8, float* %4
%9 = load float, float* %2
%10 = load float, float* %2
%11 = load float, float* %2
%12 = call float @llvm.fmuladd.f32(float -3.000000e+01, float %11, float -1.270000e+02)
%13 = call float @llvm.fmuladd.f32(float %10, float %12, float -1.570000e+02)
%14 = call float @llvm.fmuladd.f32(float %9, float %13, float -4.800000e+01)
%15 = load float, float* %2
%16 = fmul float 1.200000e+01, %15
%17 = load float, float* %2
%18 = fadd float 1.000000e+00, %17
%19 = fmul float %16, %18
%20 = load float, float* %3
%21 = fmul float %19, %20
%22 = load float, float* %3
%23 = fmul float %21, %22
%24 = fdiv float %14, %23
%25 = load float, float* %4
%26 = fadd float %24, %25
ret float %26
}

LLVM IR (-O2):
define float @fastdigamma(float %0) {
%2 = fadd float %0, 2.000000e+00
%3 = tail call float @fastlog(float %2)
%4 = tail call float @llvm.fmuladd.f32(float %0, float -3.000000e+01, float -1.270000e+02)
%5 = tail call float @llvm.fmuladd.f32(float %0, float %4, float -1.570000e+02)
%6 = tail call float @llvm.fmuladd.f32(float %0, float %5, float -4.800000e+01)
%7 = fmul float %0, 1.200000e+01
%8 = fadd float %0, 1.000000e+00
%9 = fmul float %7, %8
%10 = fmul float %2, %9
%11 = fmul float %2, %10
%12 = fdiv float %6, %11
%13 = fadd float %12, %3
ret float %13
}