void grat1(double *a, double *x, double *r, double *p, double *q, double *eps) {
  static int K2 = 0;
  static double a2n, a2nm1, am0, an, an0, b2n, b2nm1, c, cma, g, h, j, l, sum,
      t, tol, w, z, T1, T3;
  if (*a * *x == 0.0e0)
    goto S120;
  if (*a == 0.5e0)
    goto S100;
  if (*x < 1.1e0)
    goto S10;
  goto S60;
S10:
  an = 3.0e0;
  c = *x;
  sum = *x / (*a + 3.0e0);
  tol = 0.1e0 * *eps / (*a + 1.0e0);
S20:
  an += 1.0e0;
  c = -(c * (*x / an));
  t = c / (*a + an);
  sum += t;
  if (fabs(t) > tol)
    goto S20;
  j = *a * *x *
      ((sum / 6.0e0 - 0.5e0 / (*a + 2.0e0)) * *x + 1.0e0 / (*a + 1.0e0));
  z = *a * log(*x);
  h = gam1(a);
  g = 1.0e0 + h;
  if (*x < 0.25e0)
    goto S30;
  if (*a < *x / 2.59e0)
    goto S50;
  goto S40;
S30:
  if (z > -.13394e0)
    goto S50;
S40:
  w = exp(z);
  *p = w * g * (0.5e0 + (0.5e0 - j));
  *q = 0.5e0 + (0.5e0 - *p);
  return;
S50:
  l = rexp(&z);
  w = 0.5e0 + (0.5e0 + l);
  *q = (w * j - l) * g - h;
  if (*q < 0.0e0)
    goto S90;
  *p = 0.5e0 + (0.5e0 - *q);
  return;
S60:
  a2nm1 = a2n = 1.0e0;
  b2nm1 = *x;
  b2n = *x + (1.0e0 - *a);
  c = 1.0e0;
S70:
  a2nm1 = *x * a2n + c * a2nm1;
  b2nm1 = *x * b2n + c * b2nm1;
  am0 = a2nm1 / b2nm1;
  c += 1.0e0;
  cma = c - *a;
  a2n = a2nm1 + cma * a2n;
  b2n = b2nm1 + cma * b2n;
  an0 = a2n / b2n;
  if (fabs(an0 - am0) >= *eps * an0)
    goto S70;
  *q = *r * an0;
  *p = 0.5e0 + (0.5e0 - *q);
  return;
S80:
  *p = 0.0e0;
  *q = 1.0e0;
  return;
S90:
  *p = 1.0e0;
  *q = 0.0e0;
  return;
S100:
  if (*x >= 0.25e0)
    goto S110;
  T1 = sqrt(*x);
  *p = erf1(&T1);
  *q = 0.5e0 + (0.5e0 - *p);
  return;
S110:
  T3 = sqrt(*x);
  *q = erfc1(&K2, &T3);
  *p = 0.5e0 + (0.5e0 - *q);
  return;
S120:
  if (*x <= *a)
    goto S80;
  goto S90;
}


x86 assembly (clang, -O0):
<grat1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11b8 <grat1+0x48>
jp     11b8 <grat1+0x48>
jmp    18d0 <grat1+0x760>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xe38(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11dd <grat1+0x6d>
jp     11dd <grat1+0x6d>
jmp    17fa <grat1+0x68a>
mov    -0x10(%rbp),%rax
movsd  0xe1f(%rip),%xmm0
ucomisd (%rax),%xmm0
jbe    11f8 <grat1+0x88>
jmp    11fd <grat1+0x8d>
jmp    15cb <grat1+0x45b>
movsd  0xe1b(%rip),%xmm0
movsd  %xmm0,0x2e73(%rip)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,0x2e83(%rip)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0xdef(%rip),%xmm1
addsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x2e8f(%rip)
mov    -0x30(%rbp),%rax
movsd  0xdcb(%rip),%xmm0
mulsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0xdb3(%rip),%xmm1
addsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x2e73(%rip)
movsd  0xd9b(%rip),%xmm0
addsd  0x2e03(%rip),%xmm0
movsd  %xmm0,0x2dfb(%rip)
movsd  0x2e13(%rip),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
divsd  0x2de3(%rip),%xmm1
mulsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,0x2de0(%rip)
movsd  0x2dd8(%rip),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
addsd  0x2da8(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x2df4(%rip)
movsd  0x2dec(%rip),%xmm0
addsd  0x2ddc(%rip),%xmm0
movsd  %xmm0,0x2dd4(%rip)
movsd  0x2dd4(%rip),%xmm0
movaps 0xd45(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd 0x2dc9(%rip),%xmm0
jbe    1322 <grat1+0x1b2>
jmp    126d <grat1+0xfd>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  0x2d96(%rip),%xmm1
movsd  0xcf6(%rip),%xmm2
divsd  %xmm2,%xmm1
mov    -0x8(%rbp),%rax
movsd  0xcde(%rip),%xmm3
addsd  (%rax),%xmm3
movsd  0xca2(%rip),%xmm2
divsd  %xmm3,%xmm2
subsd  %xmm2,%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm3
mov    -0x8(%rbp),%rax
movsd  0xc96(%rip),%xmm4
addsd  (%rax),%xmm4
movsd  0xc8a(%rip),%xmm2
divsd  %xmm4,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x2d22(%rip)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
call   1070 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x2d24(%rip)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <gam1@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x2cd5(%rip)
movsd  0xc25(%rip),%xmm0
addsd  0x2cc5(%rip),%xmm0
movsd  %xmm0,0x2cb5(%rip)
mov    -0x10(%rbp),%rax
movsd  0xc21(%rip),%xmm0
ucomisd (%rax),%xmm0
jbe    1416 <grat1+0x2a6>
jmp    1446 <grat1+0x2d6>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xc12(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    1441 <grat1+0x2d1>
jmp    14e0 <grat1+0x370>
jmp    146a <grat1+0x2fa>
movsd  0x2ca2(%rip),%xmm0
movsd  0xbf2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1465 <grat1+0x2f5>
jmp    14e0 <grat1+0x370>
jmp    146a <grat1+0x2fa>
movsd  0x2c7e(%rip),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,0x2c69(%rip)
movsd  0x2c61(%rip),%xmm0
mulsd  0x2c21(%rip),%xmm0
movsd  0xb69(%rip),%xmm2
subsd  0x2c21(%rip),%xmm2
movsd  0xb59(%rip),%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  0xb3d(%rip),%xmm1
subsd  (%rax),%xmm1
movsd  0xb31(%rip),%xmm0
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    18f4 <grat1+0x784>
lea    0x2c09(%rip),%rdi
mov    $0x0,%al
call   1040 <rexp@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x2bce(%rip)
movsd  0xafe(%rip),%xmm1
addsd  0x2bbe(%rip),%xmm1
movsd  0xaee(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2bca(%rip)
movsd  0x2bc2(%rip),%xmm0
movsd  0x2b92(%rip),%xmm2
movsd  0x2b92(%rip),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0x2b53(%rip),%xmm2
movsd  0x2b53(%rip),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd (%rax),%xmm0
jbe    15a2 <grat1+0x432>
jmp    17da <grat1+0x66a>
mov    -0x28(%rbp),%rax
movsd  0xa52(%rip),%xmm1
subsd  (%rax),%xmm1
movsd  0xa46(%rip),%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    18f4 <grat1+0x784>
movsd  0xa3d(%rip),%xmm0
movsd  %xmm0,0x2a8d(%rip)
movsd  0xa2d(%rip),%xmm0
movsd  %xmm0,0x2a85(%rip)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,0x2a9d(%rip)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0xa01(%rip),%xmm1
subsd  (%rax),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2a71(%rip)
movsd  0x9e9(%rip),%xmm0
movsd  %xmm0,0x2a71(%rip)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0x2a29(%rip),%xmm2
movsd  0x2a59(%rip),%xmm1
mulsd  0x2a21(%rip),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2a11(%rip)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0x2a21(%rip),%xmm2
movsd  0x2a29(%rip),%xmm1
mulsd  0x2a19(%rip),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2a09(%rip)
movsd  0x29d9(%rip),%xmm0
divsd  0x29f9(%rip),%xmm0
movsd  %xmm0,0x29d1(%rip)
movsd  0x961(%rip),%xmm0
addsd  0x29e9(%rip),%xmm0
movsd  %xmm0,0x29e1(%rip)
movsd  0x29d9(%rip),%xmm0
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,0x29d1(%rip)
movsd  0x2991(%rip),%xmm1
movsd  0x29c1(%rip),%xmm0
movsd  0x2979(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2969(%rip)
movsd  0x2991(%rip),%xmm1
movsd  0x2999(%rip),%xmm0
movsd  0x2979(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2969(%rip)
movsd  0x2939(%rip),%xmm0
divsd  0x2959(%rip),%xmm0
movsd  %xmm0,0x2949(%rip)
movsd  0x2941(%rip),%xmm0
subsd  0x2929(%rip),%xmm0
movaps 0x8fa(%rip),%xmm1
pand   %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  0x291e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1779 <grat1+0x609>
jmp    162f <grat1+0x4bf>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mulsd  0x28ff(%rip),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  0x863(%rip),%xmm1
subsd  (%rax),%xmm1
movsd  0x857(%rip),%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    18f4 <grat1+0x784>
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  0x83f(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    18f4 <grat1+0x784>
mov    -0x20(%rbp),%rax
movsd  0x82a(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    18f4 <grat1+0x784>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0x81e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1819 <grat1+0x6a9>
jmp    1871 <grat1+0x701>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
call   1090 <sqrt@plt>
movsd  %xmm0,0x28ca(%rip)
lea    0x28c3(%rip),%rdi
mov    $0x0,%al
call   1080 <erf1@plt>
cvtsi2sd %eax,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  0x7ac(%rip),%xmm1
subsd  (%rax),%xmm1
movsd  0x7a0(%rip),%xmm0
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    18f4 <grat1+0x784>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
call   1090 <sqrt@plt>
movsd  %xmm0,0x287a(%rip)
lea    0x27d3(%rip),%rdi
lea    0x286c(%rip),%rsi
mov    $0x0,%al
call   1060 <erfc1@plt>
cvtsi2sd %eax,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  0x74d(%rip),%xmm1
subsd  (%rax),%xmm1
movsd  0x741(%rip),%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    18f4 <grat1+0x784>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jb     18ef <grat1+0x77f>
jmp    17ba <grat1+0x64a>
jmp    17da <grat1+0x66a>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grat1>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %r8,%r15
mov    %rcx,%r14
movsd  (%rdi),%xmm12
movsd  (%rsi),%xmm11
movapd %xmm12,%xmm0
mulsd  %xmm11,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11c2 <grat1+0x52>
jp     11c2 <grat1+0x52>
ucomisd %xmm11,%xmm12
jae    1244 <grat1+0xd4>
movabs $0x3ff0000000000000,%rax
mov    %rax,(%r14)
movq   $0x0,(%r15)
jmp    15c1 <grat1+0x451>
ucomisd 0xe35(%rip),%xmm12
jne    125d <grat1+0xed>
jp     125d <grat1+0xed>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm11
jb     13c1 <grat1+0x251>
xorps  %xmm0,%xmm0
sqrtsd %xmm11,%xmm0
ucomisd 0xe49(%rip),%xmm11
jb     13e6 <grat1+0x276>
movsd  %xmm0,0x2e8b(%rip)
lea    0x2e84(%rip),%rsi
lea    0x2e4d(%rip),%rdi
xor    %eax,%eax
call   1060 <erfc1@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%r15)
movsd  0xdd2(%rip),%xmm1
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%r14)
jmp    15c1 <grat1+0x451>
movq   $0x0,(%r14)
movabs $0x3ff0000000000000,%rax
mov    %rax,(%r15)
jmp    15c1 <grat1+0x451>
movsd  0xda3(%rip),%xmm1
ucomisd %xmm11,%xmm1
jbe    1426 <grat1+0x2b6>
mov    %rsi,%rbx
mov    %rdi,%r12
movsd  0xd9a(%rip),%xmm3
movapd %xmm12,%xmm2
addsd  %xmm3,%xmm2
movapd %xmm11,%xmm1
divsd  %xmm2,%xmm1
movsd  (%r9),%xmm4
mulsd  0xd83(%rip),%xmm4
movsd  0xd6a(%rip),%xmm8
addsd  %xmm12,%xmm8
divsd  %xmm8,%xmm4
movsd  0xd57(%rip),%xmm10
movapd 0xdae(%rip),%xmm9
movapd 0xd96(%rip),%xmm6
movapd %xmm11,%xmm7
nop
xorpd  %xmm9,%xmm7
addsd  %xmm10,%xmm3
movapd %xmm11,%xmm2
divsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm7
movapd %xmm12,%xmm2
addsd  %xmm3,%xmm2
movapd %xmm7,%xmm5
divsd  %xmm2,%xmm5
addsd  %xmm5,%xmm1
andpd  %xmm6,%xmm5
ucomisd %xmm4,%xmm5
ja     12d0 <grat1+0x160>
divsd  0xd1a(%rip),%xmm1
movsd  0xd1a(%rip),%xmm2
addsd  %xmm12,%xmm2
movsd  0xd15(%rip),%xmm3
divsd  %xmm2,%xmm3
addsd  %xmm1,%xmm3
movapd %xmm10,%xmm1
divsd  %xmm8,%xmm1
mulsd  %xmm11,%xmm3
addsd  %xmm1,%xmm3
mulsd  %xmm3,%xmm0
movsd  %xmm0,0x2d2e(%rip)
movapd %xmm11,%xmm0
movsd  %xmm12,(%rsp)
call   1070 <log@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x2d19(%rip)
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <gam1@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x2cf0(%rip)
addsd  0xc88(%rip),%xmm0
movsd  %xmm0,0x2cd8(%rip)
movsd  (%rbx),%xmm0
movsd  0xca4(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    14ff <grat1+0x38f>
movsd  0x2cd2(%rip),%xmm0
ucomisd 0xc9a(%rip),%xmm0
ja     150f <grat1+0x39f>
jmp    1582 <grat1+0x412>
movapd %xmm11,%xmm0
movsd  %xmm11,(%rsp)
call   1090 <sqrt@plt>
movsd  (%rsp),%xmm11
ucomisd 0xc60(%rip),%xmm11
jae    11fd <grat1+0x8d>
movsd  %xmm0,0x2c9a(%rip)
lea    0x2c93(%rip),%rdi
xor    %eax,%eax
call   1080 <erf1@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%r14)
movsd  0xbf0(%rip),%xmm1
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%r15)
jmp    15c1 <grat1+0x451>
movsd  0xbe1(%rip),%xmm9
movapd %xmm9,%xmm2
subsd  %xmm12,%xmm2
addsd  %xmm11,%xmm2
movsd  (%r9),%xmm10
movapd 0xc14(%rip),%xmm8
movapd %xmm11,%xmm3
movapd %xmm9,%xmm4
movapd %xmm9,%xmm5
movapd %xmm9,%xmm0
mulsd  %xmm5,%xmm4
movapd %xmm11,%xmm6
mulsd  %xmm0,%xmm6
addsd  %xmm6,%xmm4
mulsd  %xmm5,%xmm3
movapd %xmm11,%xmm6
mulsd  %xmm2,%xmm6
addsd  %xmm6,%xmm3
addsd  %xmm9,%xmm5
movapd %xmm5,%xmm7
subsd  %xmm12,%xmm7
mulsd  %xmm7,%xmm0
addsd  %xmm4,%xmm0
mulsd  %xmm2,%xmm7
addsd  %xmm3,%xmm7
movapd %xmm0,%xmm6
unpcklpd %xmm4,%xmm6
movapd %xmm7,%xmm2
unpcklpd %xmm3,%xmm7
divpd  %xmm7,%xmm6
movapd %xmm6,%xmm7
unpckhpd %xmm6,%xmm7
movapd %xmm6,%xmm1
subsd  %xmm7,%xmm1
andpd  %xmm8,%xmm1
movapd %xmm6,%xmm7
mulsd  %xmm10,%xmm7
ucomisd %xmm7,%xmm1
jae    1460 <grat1+0x2f0>
mulsd  (%rdx),%xmm6
movsd  %xmm6,(%r15)
movsd  0xb17(%rip),%xmm0
movapd %xmm0,%xmm1
subsd  %xmm6,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
jmp    15c1 <grat1+0x451>
divsd  0xb41(%rip),%xmm0
ucomisd (%r12),%xmm0
jbe    157a <grat1+0x40a>
lea    0x2b6a(%rip),%rdi
xor    %eax,%eax
call   1040 <rexp@plt>
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
movsd  0xad4(%rip),%xmm0
movapd %xmm2,%xmm1
addsd  %xmm0,%xmm1
addsd  %xmm0,%xmm1
mulsd  0x2b38(%rip),%xmm1
subsd  %xmm2,%xmm1
mulsd  0x2b1c(%rip),%xmm1
subsd  0x2b1c(%rip),%xmm1
movsd  %xmm1,(%r15)
xorpd  %xmm2,%xmm2
ucomisd %xmm1,%xmm2
ja     11a9 <grat1+0x39>
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,(%r14)
jmp    15c1 <grat1+0x451>
movsd  0x2afe(%rip),%xmm0
call   1050 <exp@plt>
mulsd  0x2ad9(%rip),%xmm0
movsd  0xa69(%rip),%xmm1
movapd %xmm1,%xmm2
subsd  0x2ad5(%rip),%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,(%r14)
movapd %xmm1,%xmm0
subsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r15)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@grat1.K2 = internal global i32 0
@grat1.a2n = internal global double 0.000000e+00
@grat1.a2nm1 = internal global double 0.000000e+00
@grat1.am0 = internal global double 0.000000e+00
@grat1.an = internal global double 0.000000e+00
@grat1.an0 = internal global double 0.000000e+00
@grat1.b2n = internal global double 0.000000e+00
@grat1.b2nm1 = internal global double 0.000000e+00
@grat1.c = internal global double 0.000000e+00
@grat1.cma = internal global double 0.000000e+00
@grat1.g = internal global double 0.000000e+00
@grat1.h = internal global double 0.000000e+00
@grat1.j = internal global double 0.000000e+00
@grat1.l = internal global double 0.000000e+00
@grat1.sum = internal global double 0.000000e+00
@grat1.t = internal global double 0.000000e+00
@grat1.tol = internal global double 0.000000e+00
@grat1.w = internal global double 0.000000e+00
@grat1.z = internal global double 0.000000e+00
@grat1.T1 = internal global double 0.000000e+00
@grat1.T3 = internal global double 0.000000e+00
define void @grat1(double* %0, double* %1, double* %2, double* %3, double* %4, double* %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
store double* %0, double** %7
store double* %1, double** %8
store double* %2, double** %9
store double* %3, double** %10
store double* %4, double** %11
store double* %5, double** %12
%13 = load double*, double** %7
%14 = load double, double* %13
%15 = load double*, double** %8
%16 = load double, double* %15
%17 = fmul double %14, %16
%18 = fcmp oeq double %17, 0.000000e+00
br i1 %18, label %19, label %20
19: ; preds = %6
br label %263
20: ; preds = %6
%21 = load double*, double** %7
%22 = load double, double* %21
%23 = fcmp oeq double %22, 5.000000e-01
br i1 %23, label %24, label %25
24: ; preds = %20
br label %234
25: ; preds = %20
%26 = load double*, double** %8
%27 = load double, double* %26
%28 = fcmp olt double %27, 1.100000e+00
br i1 %28, label %29, label %30
29: ; preds = %25
br label %31
30: ; preds = %25
br label %163
31: ; preds = %29
store double 3.000000e+00, double* @grat1.an
%32 = load double*, double** %8
%33 = load double, double* %32
store double %33, double* @grat1.c
%34 = load double*, double** %8
%35 = load double, double* %34
%36 = load double*, double** %7
%37 = load double, double* %36
%38 = fadd double %37, 3.000000e+00
%39 = fdiv double %35, %38
store double %39, double* @grat1.sum
%40 = load double*, double** %12
%41 = load double, double* %40
%42 = fmul double 1.000000e-01, %41
%43 = load double*, double** %7
%44 = load double, double* %43
%45 = fadd double %44, 1.000000e+00
%46 = fdiv double %42, %45
store double %46, double* @grat1.tol
br label %47
47: ; preds = %70, %31
%48 = load double, double* @grat1.an
%49 = fadd double %48, 1.000000e+00
store double %49, double* @grat1.an
%50 = load double, double* @grat1.c
%51 = load double*, double** %8
%52 = load double, double* %51
%53 = load double, double* @grat1.an
%54 = fdiv double %52, %53
%55 = fmul double %50, %54
%56 = fneg double %55
store double %56, double* @grat1.c
%57 = load double, double* @grat1.c
%58 = load double*, double** %7
%59 = load double, double* %58
%60 = load double, double* @grat1.an
%61 = fadd double %59, %60
%62 = fdiv double %57, %61
store double %62, double* @grat1.t
%63 = load double, double* @grat1.t
%64 = load double, double* @grat1.sum
%65 = fadd double %64, %63
store double %65, double* @grat1.sum
%66 = load double, double* @grat1.t
%67 = call double @llvm.fabs.f64(double %66)
%68 = load double, double* @grat1.tol
%69 = fcmp ogt double %67, %68
br i1 %69, label %70, label %71
70: ; preds = %47
br label %47
71: ; preds = %47
%72 = load double*, double** %7
%73 = load double, double* %72
%74 = load double*, double** %8
%75 = load double, double* %74
%76 = fmul double %73, %75
%77 = load double, double* @grat1.sum
%78 = fdiv double %77, 6.000000e+00
%79 = load double*, double** %7
%80 = load double, double* %79
%81 = fadd double %80, 2.000000e+00
%82 = fdiv double 5.000000e-01, %81
%83 = fsub double %78, %82
%84 = load double*, double** %8
%85 = load double, double* %84
%86 = load double*, double** %7
%87 = load double, double* %86
%88 = fadd double %87, 1.000000e+00
%89 = fdiv double 1.000000e+00, %88
%90 = call double @llvm.fmuladd.f64(double %83, double %85, double %89)
%91 = fmul double %76, %90
store double %91, double* @grat1.j
%92 = load double*, double** %7
%93 = load double, double* %92
%94 = load double*, double** %8
%95 = load double, double* %94
%96 = call double @log(double %95)
%97 = fmul double %93, %96
store double %97, double* @grat1.z
%98 = load double*, double** %7
%99 = call i32 (double*, ...) bitcast (i32 (...)* @gam1 to i32 (double*, ...)*)(double* %98)
%100 = sitofp i32 %99 to double
store double %100, double* @grat1.h
%101 = load double, double* @grat1.h
%102 = fadd double 1.000000e+00, %101
store double %102, double* @grat1.g
%103 = load double*, double** %8
%104 = load double, double* %103
%105 = fcmp olt double %104, 2.500000e-01
br i1 %105, label %106, label %107
106: ; preds = %71
br label %116
107: ; preds = %71
%108 = load double*, double** %7
%109 = load double, double* %108
%110 = load double*, double** %8
%111 = load double, double* %110
%112 = fdiv double %111, 2.590000e+00
%113 = fcmp olt double %109, %112
br i1 %113, label %114, label %115
114: ; preds = %107
br label %137
115: ; preds = %107
br label %121
116: ; preds = %106
%117 = load double, double* @grat1.z
%118 = fcmp ogt double %117, -1.339400e-01
br i1 %118, label %119, label %120
119: ; preds = %116
br label %137
120: ; preds = %116
br label %121
121: ; preds = %120, %115
%122 = load double, double* @grat1.z
%123 = call double @exp(double %122)
store double %123, double* @grat1.w
%124 = load double, double* @grat1.w
%125 = load double, double* @grat1.g
%126 = fmul double %124, %125
%127 = load double, double* @grat1.j
%128 = fsub double 5.000000e-01, %127
%129 = fadd double 5.000000e-01, %128
%130 = fmul double %126, %129
%131 = load double*, double** %10
store double %130, double* %131
%132 = load double*, double** %10
%133 = load double, double* %132
%134 = fsub double 5.000000e-01, %133
%135 = fadd double 5.000000e-01, %134
%136 = load double*, double** %11
store double %135, double* %136
br label %271
137: ; preds = %119, %114
%138 = call i32 (double*, ...) bitcast (i32 (...)* @rexp to i32 (double*, ...)*)(double* @grat1.z)
%139 = sitofp i32 %138 to double
store double %139, double* @grat1.l
%140 = load double, double* @grat1.l
%141 = fadd double 5.000000e-01, %140
%142 = fadd double 5.000000e-01, %141
store double %142, double* @grat1.w
%143 = load double, double* @grat1.w
%144 = load double, double* @grat1.j
%145 = load double, double* @grat1.l
%146 = fneg double %145
%147 = call double @llvm.fmuladd.f64(double %143, double %144, double %146)
%148 = load double, double* @grat1.g
%149 = load double, double* @grat1.h
%150 = fneg double %149
%151 = call double @llvm.fmuladd.f64(double %147, double %148, double %150)
%152 = load double*, double** %11
store double %151, double* %152
%153 = load double*, double** %11
%154 = load double, double* %153
%155 = fcmp olt double %154, 0.000000e+00
br i1 %155, label %156, label %157
156: ; preds = %137
br label %231
157: ; preds = %137
%158 = load double*, double** %11
%159 = load double, double* %158
%160 = fsub double 5.000000e-01, %159
%161 = fadd double 5.000000e-01, %160
%162 = load double*, double** %10
store double %161, double* %162
br label %271
163: ; preds = %30
store double 1.000000e+00, double* @grat1.a2n
store double 1.000000e+00, double* @grat1.a2nm1
%164 = load double*, double** %8
%165 = load double, double* %164
store double %165, double* @grat1.b2nm1
%166 = load double*, double** %8
%167 = load double, double* %166
%168 = load double*, double** %7
%169 = load double, double* %168
%170 = fsub double 1.000000e+00, %169
%171 = fadd double %167, %170
store double %171, double* @grat1.b2n
store double 1.000000e+00, double* @grat1.c
br label %172
172: ; preds = %216, %163
%173 = load double*, double** %8
%174 = load double, double* %173
%175 = load double, double* @grat1.a2n
%176 = load double, double* @grat1.c
%177 = load double, double* @grat1.a2nm1
%178 = fmul double %176, %177
%179 = call double @llvm.fmuladd.f64(double %174, double %175, double %178)
store double %179, double* @grat1.a2nm1
%180 = load double*, double** %8
%181 = load double, double* %180
%182 = load double, double* @grat1.b2n
%183 = load double, double* @grat1.c
%184 = load double, double* @grat1.b2nm1
%185 = fmul double %183, %184
%186 = call double @llvm.fmuladd.f64(double %181, double %182, double %185)
store double %186, double* @grat1.b2nm1
%187 = load double, double* @grat1.a2nm1
%188 = load double, double* @grat1.b2nm1
%189 = fdiv double %187, %188
store double %189, double* @grat1.am0
%190 = load double, double* @grat1.c
%191 = fadd double %190, 1.000000e+00
store double %191, double* @grat1.c
%192 = load double, double* @grat1.c
%193 = load double*, double** %7
%194 = load double, double* %193
%195 = fsub double %192, %194
store double %195, double* @grat1.cma
%196 = load double, double* @grat1.a2nm1
%197 = load double, double* @grat1.cma
%198 = load double, double* @grat1.a2n
%199 = call double @llvm.fmuladd.f64(double %197, double %198, double %196)
store double %199, double* @grat1.a2n
%200 = load double, double* @grat1.b2nm1
%201 = load double, double* @grat1.cma
%202 = load double, double* @grat1.b2n
%203 = call double @llvm.fmuladd.f64(double %201, double %202, double %200)
store double %203, double* @grat1.b2n
%204 = load double, double* @grat1.a2n
%205 = load double, double* @grat1.b2n
%206 = fdiv double %204, %205
store double %206, double* @grat1.an0
%207 = load double, double* @grat1.an0
%208 = load double, double* @grat1.am0
%209 = fsub double %207, %208
%210 = call double @llvm.fabs.f64(double %209)
%211 = load double*, double** %12
%212 = load double, double* %211
%213 = load double, double* @grat1.an0
%214 = fmul double %212, %213
%215 = fcmp oge double %210, %214
br i1 %215, label %216, label %217
216: ; preds = %172
br label %172
217: ; preds = %172
%218 = load double*, double** %9
%219 = load double, double* %218
%220 = load double, double* @grat1.an0
%221 = fmul double %219, %220
%222 = load double*, double** %11
store double %221, double* %222
%223 = load double*, double** %11
%224 = load double, double* %223
%225 = fsub double 5.000000e-01, %224
%226 = fadd double 5.000000e-01, %225
%227 = load double*, double** %10
store double %226, double* %227
br label %271
228: ; preds = %269
%229 = load double*, double** %10
store double 0.000000e+00, double* %229
%230 = load double*, double** %11
store double 1.000000e+00, double* %230
br label %271
231: ; preds = %270, %156
%232 = load double*, double** %10
store double 1.000000e+00, double* %232
%233 = load double*, double** %11
store double 0.000000e+00, double* %233
br label %271
234: ; preds = %24
%235 = load double*, double** %8
%236 = load double, double* %235
%237 = fcmp oge double %236, 2.500000e-01
br i1 %237, label %238, label %239
238: ; preds = %234
br label %251
239: ; preds = %234
%240 = load double*, double** %8
%241 = load double, double* %240
%242 = call double @sqrt(double %241)
store double %242, double* @grat1.T1
%243 = call i32 (double*, ...) bitcast (i32 (...)* @erf1 to i32 (double*, ...)*)(double* @grat1.T1)
%244 = sitofp i32 %243 to double
%245 = load double*, double** %10
store double %244, double* %245
%246 = load double*, double** %10
%247 = load double, double* %246
%248 = fsub double 5.000000e-01, %247
%249 = fadd double 5.000000e-01, %248
%250 = load double*, double** %11
store double %249, double* %250
br label %271
251: ; preds = %238
%252 = load double*, double** %8
%253 = load double, double* %252
%254 = call double @sqrt(double %253)
store double %254, double* @grat1.T3
%255 = call i32 (i32*, double*, ...) bitcast (i32 (...)* @erfc1 to i32 (i32*, double*, ...)*)(i32* @grat1.K2, double* @grat1.T3)
%256 = sitofp i32 %255 to double
%257 = load double*, double** %11
store double %256, double* %257
%258 = load double*, double** %11
%259 = load double, double* %258
%260 = fsub double 5.000000e-01, %259
%261 = fadd double 5.000000e-01, %260
%262 = load double*, double** %10
store double %261, double* %262
br label %271
263: ; preds = %19
%264 = load double*, double** %8
%265 = load double, double* %264
%266 = load double*, double** %7
%267 = load double, double* %266
%268 = fcmp ole double %265, %267
br i1 %268, label %269, label %270
269: ; preds = %263
br label %228
270: ; preds = %263
br label %231
271: ; preds = %251, %239, %231, %228, %217, %157, %121
ret void
}

LLVM IR (-O2):
@grat1.K2 = internal global i32 0
@grat1.g = internal unnamed_addr global double 0.000000e+00
@grat1.h = internal unnamed_addr global double 0.000000e+00
@grat1.j = internal unnamed_addr global double 0.000000e+00
@grat1.z = internal global double 0.000000e+00
@grat1.T1 = internal global double 0.000000e+00
@grat1.T3 = internal global double 0.000000e+00
define void @grat1(double* %0, double* nocapture %1, double* nocapture %2, double* nocapture writeonly %3, double* nocapture writeonly %4, double* nocapture %5) {
%7 = load double, double* %0
%8 = load double, double* %1
%9 = fmul double %7, %8
%10 = fcmp oeq double %9, 0.000000e+00
br i1 %10, label %136, label %11
11: ; preds = %6
%12 = fcmp oeq double %7, 5.000000e-01
br i1 %12, label %123, label %13
13: ; preds = %11
%14 = fcmp olt double %8, 1.100000e+00
br i1 %14, label %15, label %86
15: ; preds = %13
%16 = fadd double %7, 3.000000e+00
%17 = fdiv double %8, %16
%18 = load double, double* %5
%19 = fmul double %18, 1.000000e-01
%20 = fadd double %7, 1.000000e+00
%21 = fdiv double %19, %20
br label %22
22: ; preds = %22, %15
%23 = phi double [ %32, %22 ], [ %17, %15 ]
%24 = phi double [ %29, %22 ], [ %8, %15 ]
%25 = phi double [ %26, %22 ], [ 3.000000e+00, %15 ]
%26 = fadd double %25, 1.000000e+00
%27 = fdiv double %8, %26
%28 = fneg double %24
%29 = fmul double %27, %28
%30 = fadd double %7, %26
%31 = fdiv double %29, %30
%32 = fadd double %31, %23
%33 = tail call double @llvm.fabs.f64(double %31)
%34 = fcmp ogt double %33, %21
br i1 %34, label %22, label %35
35: ; preds = %22
%36 = fdiv double %32, 6.000000e+00
%37 = fadd double %7, 2.000000e+00
%38 = fdiv double 5.000000e-01, %37
%39 = fsub double %36, %38
%40 = fdiv double 1.000000e+00, %20
%41 = tail call double @llvm.fmuladd.f64(double %39, double %8, double %40)
%42 = fmul double %9, %41
store double %42, double* @grat1.j
%43 = tail call double @log(double %8)
%44 = fmul double %7, %43
store double %44, double* @grat1.z
%45 = tail call i32 (double*, ...) bitcast (i32 (...)* @gam1 to i32 (double*, ...)*)(double* %0)
%46 = sitofp i32 %45 to double
store double %46, double* @grat1.h
%47 = fadd double %46, 1.000000e+00
store double %47, double* @grat1.g
%48 = load double, double* %1
%49 = fcmp olt double %48, 2.500000e-01
br i1 %49, label %56, label %50
50: ; preds = %35
%51 = load double, double* %0
%52 = fdiv double %48, 2.590000e+00
%53 = fcmp olt double %51, %52
br i1 %53, label %70, label %54
54: ; preds = %50
%55 = load double, double* @grat1.z
br label %59
56: ; preds = %35
%57 = load double, double* @grat1.z
%58 = fcmp ogt double %57, -1.339400e-01
br i1 %58, label %70, label %59
59: ; preds = %54, %56
%60 = phi double [ %55, %54 ], [ %57, %56 ]
%61 = tail call double @exp(double %60)
%62 = load double, double* @grat1.g
%63 = fmul double %61, %62
%64 = load double, double* @grat1.j
%65 = fsub double 5.000000e-01, %64
%66 = fadd double %65, 5.000000e-01
%67 = fmul double %63, %66
store double %67, double* %3
%68 = fsub double 5.000000e-01, %67
%69 = fadd double %68, 5.000000e-01
store double %69, double* %4
br label %139
70: ; preds = %56, %50
%71 = tail call i32 (double*, ...) bitcast (i32 (...)* @rexp to i32 (double*, ...)*)(double* @grat1.z)
%72 = sitofp i32 %71 to double
%73 = fadd double %72, 5.000000e-01
%74 = fadd double %73, 5.000000e-01
%75 = load double, double* @grat1.j
%76 = fneg double %72
%77 = tail call double @llvm.fmuladd.f64(double %74, double %75, double %76)
%78 = load double, double* @grat1.g
%79 = load double, double* @grat1.h
%80 = fneg double %79
%81 = tail call double @llvm.fmuladd.f64(double %77, double %78, double %80)
store double %81, double* %4
%82 = fcmp olt double %81, 0.000000e+00
br i1 %82, label %122, label %83
83: ; preds = %70
%84 = fsub double 5.000000e-01, %81
%85 = fadd double %84, 5.000000e-01
store double %85, double* %3
br label %139
86: ; preds = %13
%87 = fsub double 1.000000e+00, %7
%88 = fadd double %8, %87
%89 = load double, double* %5
br label %90
90: ; preds = %90, %86
%91 = phi double [ %99, %90 ], [ %8, %86 ]
%92 = phi double [ %103, %90 ], [ %88, %86 ]
%93 = phi double [ %97, %90 ], [ 1.000000e+00, %86 ]
%94 = phi double [ %100, %90 ], [ 1.000000e+00, %86 ]
%95 = phi double [ %102, %90 ], [ 1.000000e+00, %86 ]
%96 = fmul double %94, %93
%97 = tail call double @llvm.fmuladd.f64(double %8, double %95, double %96)
%98 = fmul double %94, %91
%99 = tail call double @llvm.fmuladd.f64(double %8, double %92, double %98)
%100 = fadd double %94, 1.000000e+00
%101 = fsub double %100, %7
%102 = tail call double @llvm.fmuladd.f64(double %101, double %95, double %97)
%103 = tail call double @llvm.fmuladd.f64(double %101, double %92, double %99)
%104 = insertelement <2 x double> poison, double %102, i64 0
%105 = insertelement <2 x double> %104, double %97, i64 1
%106 = insertelement <2 x double> poison, double %103, i64 0
%107 = insertelement <2 x double> %106, double %99, i64 1
%108 = fdiv <2 x double> %105, %107
%109 = extractelement <2 x double> %108, i64 0
%110 = shufflevector <2 x double> %108, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%111 = fsub <2 x double> %108, %110
%112 = extractelement <2 x double> %111, i64 0
%113 = tail call double @llvm.fabs.f64(double %112)
%114 = fmul double %109, %89
%115 = fcmp ult double %113, %114
br i1 %115, label %116, label %90
116: ; preds = %90
%117 = extractelement <2 x double> %108, i64 0
%118 = load double, double* %2
%119 = fmul double %117, %118
store double %119, double* %4
%120 = fsub double 5.000000e-01, %119
%121 = fadd double %120, 5.000000e-01
store double %121, double* %3
br label %139
122: ; preds = %136, %70
store double 1.000000e+00, double* %3
store double 0.000000e+00, double* %4
br label %139
123: ; preds = %11
%124 = fcmp ult double %8, 2.500000e-01
%125 = tail call double @sqrt(double %8)
br i1 %124, label %126, label %131
126: ; preds = %123
store double %125, double* @grat1.T1
%127 = tail call i32 (double*, ...) bitcast (i32 (...)* @erf1 to i32 (double*, ...)*)(double* @grat1.T1)
%128 = sitofp i32 %127 to double
store double %128, double* %3
%129 = fsub double 5.000000e-01, %128
%130 = fadd double %129, 5.000000e-01
store double %130, double* %4
br label %139
131: ; preds = %123
store double %125, double* @grat1.T3
%132 = tail call i32 (i32*, double*, ...) bitcast (i32 (...)* @erfc1 to i32 (i32*, double*, ...)*)(i32* @grat1.K2, double* @grat1.T3)
%133 = sitofp i32 %132 to double
store double %133, double* %4
%134 = fsub double 5.000000e-01, %133
%135 = fadd double %134, 5.000000e-01
store double %135, double* %3
br label %139
136: ; preds = %6
%137 = fcmp ugt double %8, %7
br i1 %137, label %122, label %138
138: ; preds = %136
store double 0.000000e+00, double* %3
store double 1.000000e+00, double* %4
br label %139
139: ; preds = %131, %126, %122, %138, %116, %83, %59
ret void
}