#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 Rf_d1mach(int);
double cos(double);
double fabs(double);
double log(double);
double sin(double);
double psi(double x) {
  static double piov4 = .785398163397448;
  static double dx0 = 1.461632144968362341262659542325721325;
  static double p1[7] = {.0089538502298197, 4.77762828042627, 142.441585084029,
                         1186.45200713425,  3633.51846806499, 4138.10161269013,
                         1305.60269827897};
  static double q1[6] = {44.8452573429826, 520.752771467162,
                         2210.0079924783,  3641.27349079381,
                         1908.310765963,   6.91091682714533e-6};
  static double p2[4] = {-2.12940445131011, -7.01677227766759,
                         -4.48616543918019, -.648157123766197};
  static double q2[4] = {32.2703493791143, 89.2920700481861, 54.6117738103215,
                         7.77788548522962};
  double ret_val, d__1, d__2;
  int i__, m, n;
  double w, z__;
  int nq;
  double den, aug, sgn, xmx0, xmax1, upper;
  double xsmall;
  xmax1 = Rf_d1mach(4) - 1.0;
  d__1 = xmax1, d__2 = 0.5 / Rf_d1mach(3);
  ;
  xmax1 = ((d__1 < d__2) ? d__1 : d__2);
  xsmall = 1e-9;
  aug = 0.0;
  if (x >= 0.5) {
    goto L200;
  }
  if (fabs(x) > xsmall) {
    goto L100;
  }
  if (x == 0.f) {
    goto L400;
  }
  aug = -1.0 / x;
  goto L150;
L100:
  w = -x;
  sgn = piov4;
  if (w > 0.0) {
    goto L120;
  }
  w = -w;
  sgn = -sgn;
L120:
  if (w >= xmax1) {
    goto L400;
  }
  nq = (int)w;
  w -= (double)nq;
  nq = (int)(w * 4.0);
  w = (w - (double)nq * .25f) * 4.0;
  n = nq / 2;
  if (n + n != nq) {
    w = 1.0 - w;
  }
  z__ = piov4 * w;
  m = n / 2;
  if (m + m != n) {
    sgn = -sgn;
  }
  n = (nq + 1) / 2;
  m = n / 2;
  m += m;
  if (m != n) {
    goto L140;
  }
  if (z__ == 0.0) {
    goto L400;
  }
  aug = sgn * (cos(z__) / sin(z__) * 4.0);
  goto L150;
L140:
  aug = sgn * (sin(z__) / cos(z__) * 4.0);
L150:
  x = 1.0 - x;
L200:
  if (x > 3.0) {
    goto L300;
  }
  den = x;
  upper = p1[0] * x;
  for (i__ = 1; i__ <= 5; ++i__) {
    den = (den + q1[i__ - 1]) * x;
    upper = (upper + p1[i__]) * x;
  }
  den = (upper + p1[6]) / (den + q1[5]);
  xmx0 = x - dx0;
  ret_val = den * xmx0 + aug;
  return ret_val;
L300:
  if (x >= xmax1) {
    goto L350;
  }
  w = 1.0 / (x * x);
  den = w;
  upper = p2[0] * w;
  for (i__ = 1; i__ <= 3; ++i__) {
    den = (den + q2[i__ - 1]) * w;
    upper = (upper + p2[i__]) * w;
  }
  aug = upper / (den + q2[3]) - 0.5 / x + aug;
L350:
  ret_val = aug + log(x);
  return ret_val;
L400:
  ret_val = 0.0;
  return ret_val;
}


x86 assembly (clang, -O0):
<psi>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    $0x4,%edi
call   1060 <Rf_d1mach@plt>
movsd  0xea6(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0x3,%edi
call   1060 <Rf_d1mach@plt>
movaps %xmm0,%xmm1
movsd  0xe76(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11b9 <psi+0x79>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
jmp    11c6 <psi+0x86>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x78(%rbp)
movsd  0xe35(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe08(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1207 <psi+0xc7>
jmp    1501 <psi+0x3c1>
movsd  -0x10(%rbp),%xmm0
movaps 0xe2d(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd -0x88(%rbp),%xmm0
ff
jbe    122a <psi+0xea>
jmp    125e <psi+0x11e>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1247 <psi+0x107>
jp     1247 <psi+0x107>
jmp    1714 <psi+0x5d4>
movsd  0xdc9(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    14ef <psi+0x3af>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0x2dc9(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    12a3 <psi+0x163>
jmp    12e5 <psi+0x1a5>
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x68(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm0
ucomisd -0x78(%rbp),%xmm0
jb     12fa <psi+0x1ba>
jmp    1714 <psi+0x5d4>
cvttsd2si -0x40(%rbp),%eax
mov    %eax,-0x4c(%rbp)
cvtsi2sdl -0x4c(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xd03(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4c(%rbp)
movsd  -0x40(%rbp),%xmm1
cvtsi2sdl -0x4c(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xcd6(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xcbe(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x4c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
add    -0x34(%rbp),%eax
cmp    -0x4c(%rbp),%eax
je     139a <psi+0x25a>
movsd  0xc78(%rip),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0x2cae(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x34(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
add    -0x30(%rbp),%eax
cmp    -0x34(%rbp),%eax
je     13ea <psi+0x2aa>
movsd  -0x68(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x34(%rbp),%eax
je     1423 <psi+0x2e3>
jmp    149a <psi+0x35a>
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1440 <psi+0x300>
jp     1440 <psi+0x300>
jmp    1714 <psi+0x5d4>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0xa0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x98(%rbp),%xmm0
ff
divsd  %xmm2,%xmm1
movsd  0xb98(%rip),%xmm2
mulsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    14ef <psi+0x3af>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1040 <cos@plt>
movsd  -0xb0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xa8(%rbp),%xmm0
ff
divsd  %xmm2,%xmm1
movsd  0xb3e(%rip),%xmm2
mulsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xb11(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xb22(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    151d <psi+0x3dd>
jmp    15fb <psi+0x4bb>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0x2b31(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movl   $0x1,-0x2c(%rbp)
cmpl   $0x5,-0x2c(%rbp)
jg     159b <psi+0x45b>
movsd  -0x58(%rbp),%xmm0
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    0x2b41(%rip),%rax
addsd  (%rax,%rcx,8),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x80(%rbp),%xmm0
movslq -0x2c(%rbp),%rcx
lea    0x2ae2(%rip),%rax
addsd  (%rax,%rcx,8),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1540 <psi+0x400>
movsd  -0x80(%rbp),%xmm0
addsd  0x2ae8(%rip),%xmm0
movsd  -0x58(%rbp),%xmm1
addsd  0x2b13(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  0x2a8d(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1726 <psi+0x5e6>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x78(%rbp),%xmm0
jb     1610 <psi+0x4d0>
jmp    16da <psi+0x59a>
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  0x9e6(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0x2a93(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movl   $0x1,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jg     16a9 <psi+0x569>
movsd  -0x58(%rbp),%xmm0
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    0x2a83(%rip),%rax
addsd  (%rax,%rcx,8),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x80(%rbp),%xmm0
movslq -0x2c(%rbp),%rcx
lea    0x2a44(%rip),%rax
addsd  (%rax,%rcx,8),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    164e <psi+0x50e>
movsd  -0x80(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
addsd  0x2a4d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0x939(%rip),%xmm1
divsd  -0x10(%rbp),%xmm1
subsd  %xmm1,%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
call   1050 <log@plt>
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1726 <psi+0x5e6>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psi>:
sub    $0x48,%rsp
movapd %xmm0,0x30(%rsp)
mov    $0x4,%edi
call   1060 <Rf_d1mach@plt>
addsd  0xea4(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    $0x3,%edi
call   1060 <Rf_d1mach@plt>
movsd  (%rsp),%xmm4
movapd 0x30(%rsp),%xmm3
movsd  0xe8a(%rip),%xmm1
ucomisd %xmm1,%xmm3
divsd  %xmm0,%xmm1
minsd  %xmm1,%xmm4
xorpd  %xmm5,%xmm5
jae    135c <psi+0x21c>
movapd 0xef4(%rip),%xmm0
andpd  %xmm3,%xmm0
ucomisd 0xe68(%rip),%xmm0
jbe    11c8 <psi+0x88>
xorpd  %xmm0,%xmm0
xor    %eax,%eax
ucomisd %xmm3,%xmm0
seta   %cl
ja     11e5 <psi+0xa5>
movapd %xmm3,%xmm1
ucomisd %xmm4,%xmm1
jb     11f7 <psi+0xb7>
add    $0x48,%rsp
ret
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jne    11d4 <psi+0x94>
jnp    11c3 <psi+0x83>
movsd  0xe24(%rip),%xmm5
divsd  %xmm3,%xmm5
jmp    134c <psi+0x20c>
movapd 0xeb3(%rip),%xmm1
xorpd  %xmm3,%xmm1
ucomisd %xmm4,%xmm1
jae    11c3 <psi+0x83>
cvttpd2dq %xmm1,%xmm0
mov    %cl,%al
cvtdq2pd %xmm0,%xmm0
subsd  %xmm0,%xmm1
movsd  0xe0b(%rip),%xmm0
movapd %xmm1,%xmm2
mulsd  %xmm0,%xmm2
cvttsd2si %xmm2,%edx
cvttpd2dq %xmm2,%xmm2
cvtdq2pd %xmm2,%xmm6
lea    0xe88(%rip),%rcx
mulsd  0xdf0(%rip),%xmm6
addsd  %xmm1,%xmm6
mulsd  %xmm0,%xmm6
lea    0x1(%rdx),%esi
movd   %edx,%xmm0
movd   %esi,%xmm1
punpckldq %xmm0,%xmm1
movdqa %xmm1,%xmm0
psrld  $0x1f,%xmm0
paddd  %xmm1,%xmm0
psrad  $0x1,%xmm0
pshufd $0x55,%xmm0,%xmm2
movd   %xmm2,%esi
add    %esi,%esi
cmp    %edx,%esi
je     1278 <psi+0x138>
movsd  0xdb8(%rip),%xmm2
subsd  %xmm6,%xmm2
movapd %xmm2,%xmm6
movsd  (%rcx,%rax,8),%xmm5
movdqa %xmm1,%xmm2
psrad  $0x1f,%xmm2
psrld  $0x1e,%xmm2
paddd  %xmm1,%xmm2
psrad  $0x2,%xmm2
paddd  %xmm2,%xmm2
pcmpeqd %xmm0,%xmm2
pshufd $0x50,%xmm2,%xmm0
movmskpd %xmm0,%eax
test   $0x2,%al
jne    12b1 <psi+0x171>
xorpd  0xdef(%rip),%xmm5
mulsd  0xd77(%rip),%xmm6
test   $0x1,%al
je     12fa <psi+0x1ba>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm6
jne    12cd <psi+0x18d>
jnp    11c3 <psi+0x83>
movapd %xmm6,%xmm0
movsd  %xmm4,(%rsp)
movapd %xmm5,0x10(%rsp)
movapd %xmm6,0x20(%rsp)
call   1040 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x20(%rsp),%xmm0
call   1030 <sin@plt>
jmp    1325 <psi+0x1e5>
movapd %xmm6,%xmm0
movsd  %xmm4,(%rsp)
movapd %xmm5,0x10(%rsp)
movapd %xmm6,0x20(%rsp)
call   1030 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x20(%rsp),%xmm0
call   1040 <cos@plt>
movapd 0x10(%rsp),%xmm5
movsd  (%rsp),%xmm4
movapd 0x30(%rsp),%xmm3
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
mulsd  0xcd0(%rip),%xmm1
mulsd  %xmm1,%xmm5
movsd  0xcd4(%rip),%xmm0
subsd  %xmm3,%xmm0
movapd %xmm0,%xmm3
ucomisd 0xcd4(%rip),%xmm3
jbe    1423 <psi+0x2e3>
ucomisd %xmm4,%xmm3
jae    1409 <psi+0x2c9>
movapd %xmm3,%xmm0
mulsd  %xmm3,%xmm0
movsd  0xca4(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xcc0(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xcbc(%rip),%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
addsd  0xcb4(%rip),%xmm0
addsd  0xcb4(%rip),%xmm2
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm2
addsd  0xcac(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xca8(%rip),%xmm2
mulsd  %xmm1,%xmm2
addsd  0xca4(%rip),%xmm0
addsd  0xca4(%rip),%xmm2
mulsd  %xmm1,%xmm0
shufpd $0x2,0xd2f(%rip),%xmm0
unpcklpd %xmm3,%xmm2
divpd  %xmm2,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
subsd  %xmm1,%xmm0
addsd  %xmm0,%xmm5
movapd %xmm5,0x10(%rsp)
movapd %xmm3,%xmm0
call   1050 <log@plt>
addsd  0x10(%rsp),%xmm0
add    $0x48,%rsp
ret
movsd  0xc15(%rip),%xmm0
mulsd  %xmm3,%xmm0
unpcklpd %xmm3,%xmm0
addpd  0xc85(%rip),%xmm0
movapd %xmm3,%xmm1
unpcklpd %xmm3,%xmm1
mulpd  %xmm1,%xmm0
addpd  0xc81(%rip),%xmm0
mulpd  %xmm1,%xmm0
addpd  0xc85(%rip),%xmm0
mulpd  %xmm1,%xmm0
addpd  0xc89(%rip),%xmm0
mulpd  %xmm1,%xmm0
addpd  0xc8d(%rip),%xmm0
mulpd  %xmm1,%xmm0
addpd  0xc91(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
divsd  %xmm1,%xmm0
addsd  0xbb5(%rip),%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm5,%xmm3
movapd %xmm3,%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
@psi.piov4 = internal global double 0x3FE921FB54442D15
@psi.dx0 = internal global double 0x3FF762D86356BE3F
@psi.p1 = internal global [7 x double] [double 0x3F8256656F48699E, double 0x40131C4A9683808F, double 0x4061CE21770AC9CA, double 0x409289CEDAF54CA6, double 0x40AC630974A56E4E, double 0x40B02A1A034A0CF8, double 0x4094666929BCD620]
@psi.q1 = internal global [6 x double] [double 0x40466C3164826835, double 0x40804605AD0C0695, double 0x40A14404179711D3, double 0x40AC728C06FC3E58, double 0x409DD13E396EBF2E, double 0x3EDCFC8A5A3E14AF]
@psi.p2 = internal global [4 x double] [double 0xC00109053372AB83, double 0xC01C112CC0803F36, double 0xC011F1D55A56E5C7, double 0xBFE4BDB40227D903]
@psi.q2 = internal global [4 x double] [double 0x4040229ACEF6E519, double 0x405652B14692466E, double 0x404B4E4E9AADF0A9, double 0x401F1C8E033C6093]
define double @psi(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca i32
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
store double %0, double* %3
%20 = call double @Rf_d1mach(i32 4)
%21 = fsub double %20, 1.000000e+00
store double %21, double* %17
%22 = load double, double* %17
store double %22, double* %5
%23 = call double @Rf_d1mach(i32 3)
%24 = fdiv double 5.000000e-01, %23
store double %24, double* %6
%25 = load double, double* %5
%26 = load double, double* %6
%27 = fcmp olt double %25, %26
br i1 %27, label %28, label %30
28: ; preds = %1
%29 = load double, double* %5
br label %32
30: ; preds = %1
%31 = load double, double* %6
br label %32
32: ; preds = %30, %28
%33 = phi double [ %29, %28 ], [ %31, %30 ]
store double %33, double* %17
store double 1.000000e-09, double* %19
store double 0.000000e+00, double* %14
%34 = load double, double* %3
%35 = fcmp oge double %34, 5.000000e-01
br i1 %35, label %36, label %37
36: ; preds = %32
br label %145
37: ; preds = %32
%38 = load double, double* %3
%39 = call double @llvm.fabs.f64(double %38)
%40 = load double, double* %19
%41 = fcmp ogt double %39, %40
br i1 %41, label %42, label %43
42: ; preds = %37
br label %50
43: ; preds = %37
%44 = load double, double* %3
%45 = fcmp oeq double %44, 0.000000e+00
br i1 %45, label %46, label %47
46: ; preds = %43
br label %249
47: ; preds = %43
%48 = load double, double* %3
%49 = fdiv double -1.000000e+00, %48
store double %49, double* %14
br label %142
50: ; preds = %42
%51 = load double, double* %3
%52 = fneg double %51
store double %52, double* %10
%53 = load double, double* @psi.piov4
store double %53, double* %15
%54 = load double, double* %10
%55 = fcmp ogt double %54, 0.000000e+00
br i1 %55, label %56, label %57
56: ; preds = %50
br label %62
57: ; preds = %50
%58 = load double, double* %10
%59 = fneg double %58
store double %59, double* %10
%60 = load double, double* %15
%61 = fneg double %60
store double %61, double* %15
br label %62
62: ; preds = %57, %56
%63 = load double, double* %10
%64 = load double, double* %17
%65 = fcmp oge double %63, %64
br i1 %65, label %66, label %67
66: ; preds = %62
br label %249
67: ; preds = %62
%68 = load double, double* %10
%69 = fptosi double %68 to i32
store i32 %69, i32* %12
%70 = load i32, i32* %12
%71 = sitofp i32 %70 to double
%72 = load double, double* %10
%73 = fsub double %72, %71
store double %73, double* %10
%74 = load double, double* %10
%75 = fmul double %74, 4.000000e+00
%76 = fptosi double %75 to i32
store i32 %76, i32* %12
%77 = load double, double* %10
%78 = load i32, i32* %12
%79 = sitofp i32 %78 to double
%80 = fneg double %79
%81 = call double @llvm.fmuladd.f64(double %80, double 2.500000e-01, double %77)
%82 = fmul double %81, 4.000000e+00
store double %82, double* %10
%83 = load i32, i32* %12
%84 = sdiv i32 %83, 2
store i32 %84, i32* %9
%85 = load i32, i32* %9
%86 = load i32, i32* %9
%87 = add nsw i32 %85, %86
%88 = load i32, i32* %12
%89 = icmp ne i32 %87, %88
br i1 %89, label %90, label %93
90: ; preds = %67
%91 = load double, double* %10
%92 = fsub double 1.000000e+00, %91
store double %92, double* %10
br label %93
93: ; preds = %90, %67
%94 = load double, double* @psi.piov4
%95 = load double, double* %10
%96 = fmul double %94, %95
store double %96, double* %11
%97 = load i32, i32* %9
%98 = sdiv i32 %97, 2
store i32 %98, i32* %8
%99 = load i32, i32* %8
%100 = load i32, i32* %8
%101 = add nsw i32 %99, %100
%102 = load i32, i32* %9
%103 = icmp ne i32 %101, %102
br i1 %103, label %104, label %107
104: ; preds = %93
%105 = load double, double* %15
%106 = fneg double %105
store double %106, double* %15
br label %107
107: ; preds = %104, %93
%108 = load i32, i32* %12
%109 = add nsw i32 %108, 1
%110 = sdiv i32 %109, 2
store i32 %110, i32* %9
%111 = load i32, i32* %9
%112 = sdiv i32 %111, 2
store i32 %112, i32* %8
%113 = load i32, i32* %8
%114 = load i32, i32* %8
%115 = add nsw i32 %114, %113
store i32 %115, i32* %8
%116 = load i32, i32* %8
%117 = load i32, i32* %9
%118 = icmp ne i32 %116, %117
br i1 %118, label %119, label %120
119: ; preds = %107
br label %133
120: ; preds = %107
%121 = load double, double* %11
%122 = fcmp oeq double %121, 0.000000e+00
br i1 %122, label %123, label %124
123: ; preds = %120
br label %249
124: ; preds = %120
%125 = load double, double* %15
%126 = load double, double* %11
%127 = call double @cos(double %126)
%128 = load double, double* %11
%129 = call double @sin(double %128)
%130 = fdiv double %127, %129
%131 = fmul double %130, 4.000000e+00
%132 = fmul double %125, %131
store double %132, double* %14
br label %142
133: ; preds = %119
%134 = load double, double* %15
%135 = load double, double* %11
%136 = call double @sin(double %135)
%137 = load double, double* %11
%138 = call double @cos(double %137)
%139 = fdiv double %136, %138
%140 = fmul double %139, 4.000000e+00
%141 = fmul double %134, %140
store double %141, double* %14
br label %142
142: ; preds = %133, %124, %47
%143 = load double, double* %3
%144 = fsub double 1.000000e+00, %143
store double %144, double* %3
br label %145
145: ; preds = %142, %36
%146 = load double, double* %3
%147 = fcmp ogt double %146, 3.000000e+00
br i1 %147, label %148, label %149
148: ; preds = %145
br label %194
149: ; preds = %145
%150 = load double, double* %3
store double %150, double* %13
%151 = load double, double* getelementptr inbounds ([7 x double], [7 x double]* @psi.p1, i64 0, i64 0)
%152 = load double, double* %3
%153 = fmul double %151, %152
store double %153, double* %18
store i32 1, i32* %7
br label %154
154: ; preds = %175, %149
%155 = load i32, i32* %7
%156 = icmp sle i32 %155, 5
br i1 %156, label %157, label %178
157: ; preds = %154
%158 = load double, double* %13
%159 = load i32, i32* %7
%160 = sub nsw i32 %159, 1
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds [6 x double], [6 x double]* @psi.q1, i64 0, i64 %161
%163 = load double, double* %162
%164 = fadd double %158, %163
%165 = load double, double* %3
%166 = fmul double %164, %165
store double %166, double* %13
%167 = load double, double* %18
%168 = load i32, i32* %7
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds [7 x double], [7 x double]* @psi.p1, i64 0, i64 %169
%171 = load double, double* %170
%172 = fadd double %167, %171
%173 = load double, double* %3
%174 = fmul double %172, %173
store double %174, double* %18
br label %175
175: ; preds = %157
%176 = load i32, i32* %7
%177 = add nsw i32 %176, 1
store i32 %177, i32* %7
br label %154
178: ; preds = %154
%179 = load double, double* %18
%180 = load double, double* getelementptr inbounds ([7 x double], [7 x double]* @psi.p1, i64 0, i64 6)
%181 = fadd double %179, %180
%182 = load double, double* %13
%183 = load double, double* getelementptr inbounds ([6 x double], [6 x double]* @psi.q1, i64 0, i64 5)
%184 = fadd double %182, %183
%185 = fdiv double %181, %184
store double %185, double* %13
%186 = load double, double* %3
%187 = load double, double* @psi.dx0
%188 = fsub double %186, %187
store double %188, double* %16
%189 = load double, double* %13
%190 = load double, double* %16
%191 = load double, double* %14
%192 = call double @llvm.fmuladd.f64(double %189, double %190, double %191)
store double %192, double* %4
%193 = load double, double* %4
store double %193, double* %2
br label %251
194: ; preds = %148
%195 = load double, double* %3
%196 = load double, double* %17
%197 = fcmp oge double %195, %196
br i1 %197, label %198, label %199
198: ; preds = %194
br label %243
199: ; preds = %194
%200 = load double, double* %3
%201 = load double, double* %3
%202 = fmul double %200, %201
%203 = fdiv double 1.000000e+00, %202
store double %203, double* %10
%204 = load double, double* %10
store double %204, double* %13
%205 = load double, double* getelementptr inbounds ([4 x double], [4 x double]* @psi.p2, i64 0, i64 0)
%206 = load double, double* %10
%207 = fmul double %205, %206
store double %207, double* %18
store i32 1, i32* %7
br label %208
208: ; preds = %229, %199
%209 = load i32, i32* %7
%210 = icmp sle i32 %209, 3
br i1 %210, label %211, label %232
211: ; preds = %208
%212 = load double, double* %13
%213 = load i32, i32* %7
%214 = sub nsw i32 %213, 1
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds [4 x double], [4 x double]* @psi.q2, i64 0, i64 %215
%217 = load double, double* %216
%218 = fadd double %212, %217
%219 = load double, double* %10
%220 = fmul double %218, %219
store double %220, double* %13
%221 = load double, double* %18
%222 = load i32, i32* %7
%223 = sext i32 %222 to i64
%224 = getelementptr inbounds [4 x double], [4 x double]* @psi.p2, i64 0, i64 %223
%225 = load double, double* %224
%226 = fadd double %221, %225
%227 = load double, double* %10
%228 = fmul double %226, %227
store double %228, double* %18
br label %229
229: ; preds = %211
%230 = load i32, i32* %7
%231 = add nsw i32 %230, 1
store i32 %231, i32* %7
br label %208
232: ; preds = %208
%233 = load double, double* %18
%234 = load double, double* %13
%235 = load double, double* getelementptr inbounds ([4 x double], [4 x double]* @psi.q2, i64 0, i64 3)
%236 = fadd double %234, %235
%237 = fdiv double %233, %236
%238 = load double, double* %3
%239 = fdiv double 5.000000e-01, %238
%240 = fsub double %237, %239
%241 = load double, double* %14
%242 = fadd double %240, %241
store double %242, double* %14
br label %243
243: ; preds = %232, %198
%244 = load double, double* %14
%245 = load double, double* %3
%246 = call double @log(double %245)
%247 = fadd double %244, %246
store double %247, double* %4
%248 = load double, double* %4
store double %248, double* %2
br label %251
249: ; preds = %123, %66, %46
store double 0.000000e+00, double* %4
%250 = load double, double* %4
store double %250, double* %2
br label %251
251: ; preds = %249, %243, %178
%252 = load double, double* %2
ret double %252
}

LLVM IR (-O2):
define double @psi(double %0) {
%2 = tail call double @Rf_d1mach(i32 4)
%3 = fadd double %2, -1.000000e+00
%4 = tail call double @Rf_d1mach(i32 3)
%5 = fdiv double 5.000000e-01, %4
%6 = fcmp olt double %3, %5
%7 = select i1 %6, double %3, double %5
%8 = fcmp ult double %0, 5.000000e-01
br i1 %8, label %9, label %66
9: ; preds = %1
%10 = tail call double @llvm.fabs.f64(double %0)
%11 = fcmp ogt double %10, 1.000000e-09
br i1 %11, label %16, label %12
12: ; preds = %9
%13 = fcmp oeq double %0, 0.000000e+00
br i1 %13, label %123, label %14
14: ; preds = %12
%15 = fdiv double -1.000000e+00, %0
br label %63
16: ; preds = %9
%17 = fneg double %0
%18 = fcmp olt double %0, 0.000000e+00
%19 = select i1 %18, double %17, double %0
%20 = select i1 %18, double 0x3FE921FB54442D15, double 0xBFE921FB54442D15
%21 = fcmp ult double %19, %7
br i1 %21, label %22, label %123
22: ; preds = %16
%23 = fptosi double %19 to i32
%24 = sitofp i32 %23 to double
%25 = fsub double %19, %24
%26 = fmul double %25, 4.000000e+00
%27 = fptosi double %26 to i32
%28 = sitofp i32 %27 to double
%29 = fneg double %28
%30 = tail call double @llvm.fmuladd.f64(double %29, double 2.500000e-01, double %25)
%31 = fmul double %30, 4.000000e+00
%32 = add nsw i32 %27, 1
%33 = insertelement <2 x i32> poison, i32 %32, i64 0
%34 = insertelement <2 x i32> %33, i32 %27, i64 1
%35 = sdiv <2 x i32> %34, <i32 2, i32 2>
%36 = extractelement <2 x i32> %35, i64 1
%37 = shl nsw i32 %36, 1
%38 = icmp eq i32 %37, %27
%39 = fsub double 1.000000e+00, %31
%40 = select i1 %38, double %31, double %39
%41 = fmul double %40, 0x3FE921FB54442D15
%42 = fneg double %20
%43 = sdiv <2 x i32> %34, <i32 4, i32 4>
%44 = shl nsw <2 x i32> %43, <i32 1, i32 1>
%45 = icmp eq <2 x i32> %44, %35
%46 = extractelement <2 x i1> %45, i64 1
%47 = select i1 %46, double %20, double %42
%48 = extractelement <2 x i1> %45, i64 0
br i1 %48, label %49, label %57
49: ; preds = %22
%50 = fcmp oeq double %41, 0.000000e+00
br i1 %50, label %123, label %51
51: ; preds = %49
%52 = tail call double @cos(double %41)
%53 = tail call double @sin(double %41)
%54 = fdiv double %52, %53
%55 = fmul double %54, 4.000000e+00
%56 = fmul double %47, %55
br label %63
57: ; preds = %22
%58 = tail call double @sin(double %41)
%59 = tail call double @cos(double %41)
%60 = fdiv double %58, %59
%61 = fmul double %60, 4.000000e+00
%62 = fmul double %47, %61
br label %63
63: ; preds = %57, %51, %14
%64 = phi double [ %62, %57 ], [ %56, %51 ], [ %15, %14 ]
%65 = fsub double 1.000000e+00, %0
br label %66
66: ; preds = %1, %63
%67 = phi double [ 0.000000e+00, %1 ], [ %64, %63 ]
%68 = phi double [ %0, %1 ], [ %65, %63 ]
%69 = fcmp ogt double %68, 3.000000e+00
br i1 %69, label %92, label %70
70: ; preds = %66
%71 = fmul double %68, 0x3F8256656F48699E
%72 = insertelement <2 x double> poison, double %71, i64 0
%73 = insertelement <2 x double> %72, double %68, i64 1
%74 = fadd <2 x double> %73, <double 0x40131C4A9683808F, double 0x40466C3164826835>
%75 = insertelement <2 x double> poison, double %68, i64 0
%76 = shufflevector <2 x double> %75, <2 x double> poison, <2 x i32> zeroinitializer
%77 = fmul <2 x double> %76, %74
%78 = fadd <2 x double> %77, <double 0x4061CE21770AC9CA, double 0x40804605AD0C0695>
%79 = fmul <2 x double> %76, %78
%80 = fadd <2 x double> %79, <double 0x409289CEDAF54CA6, double 0x40A14404179711D3>
%81 = fmul <2 x double> %76, %80
%82 = fadd <2 x double> %81, <double 0x40AC630974A56E4E, double 0x40AC728C06FC3E58>
%83 = fmul <2 x double> %76, %82
%84 = fadd <2 x double> %83, <double 0x40B02A1A034A0CF8, double 0x409DD13E396EBF2E>
%85 = fmul <2 x double> %76, %84
%86 = fadd <2 x double> %85, <double 0x4094666929BCD620, double 0x3EDCFC8A5A3E14AF>
%87 = extractelement <2 x double> %86, i64 0
%88 = extractelement <2 x double> %86, i64 1
%89 = fdiv double %87, %88
%90 = fadd double %68, 0xBFF762D86356BE3F
%91 = tail call double @llvm.fmuladd.f64(double %89, double %90, double %67)
br label %123
92: ; preds = %66
%93 = fcmp ult double %68, %7
br i1 %93, label %94, label %119
94: ; preds = %92
%95 = fmul double %68, %68
%96 = fdiv double 1.000000e+00, %95
%97 = fmul double %96, 0xC00109053372AB83
%98 = fadd double %96, 0x4040229ACEF6E519
%99 = fmul double %96, %98
%100 = fadd double %97, 0xC01C112CC0803F36
%101 = fmul double %96, %100
%102 = fadd double %99, 0x405652B14692466E
%103 = fmul double %96, %102
%104 = fadd double %101, 0xC011F1D55A56E5C7
%105 = fmul double %96, %104
%106 = fadd double %103, 0x404B4E4E9AADF0A9
%107 = fmul double %96, %106
%108 = fadd double %105, 0xBFE4BDB40227D903
%109 = fmul double %96, %108
%110 = fadd double %107, 0x401F1C8E033C6093
%111 = insertelement <2 x double> <double poison, double 5.000000e-01>, double %109, i64 0
%112 = insertelement <2 x double> poison, double %110, i64 0
%113 = insertelement <2 x double> %112, double %68, i64 1
%114 = fdiv <2 x double> %111, %113
%115 = shufflevector <2 x double> %114, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%116 = fsub <2 x double> %114, %115
%117 = extractelement <2 x double> %116, i64 0
%118 = fadd double %67, %117
br label %119
119: ; preds = %92, %94
%120 = phi double [ %67, %92 ], [ %118, %94 ]
%121 = tail call double @log(double %68)
%122 = fadd double %120, %121
br label %123
123: ; preds = %12, %16, %49, %119, %70
%124 = phi double [ %122, %119 ], [ %91, %70 ], [ 0.000000e+00, %49 ], [ 0.000000e+00, %16 ], [ 0.000000e+00, %12 ]
ret double %124
}