int sphs2x(const double eul[5], int nlng, int nlat, int sll, int spt,
           const double lng[], const double lat[], double phi[],
           double theta[]) {
  int jlng, mlat, mlng, rowlen, rowoff;
  double coslat, coslat3, coslat4, coslng, dlng, dphi, sinlat, sinlat3, sinlat4,
      sinlng, x, y, z;
  register int ilat, ilng;
  register const double *latp, *lngp;
  register double *phip, *thetap;
  if (nlat > 0) {
    mlng = nlng;
    mlat = nlat;
  } else {
    mlng = 1;
    mlat = 1;
    nlat = nlng;
  }
  if (eul[4] == 0.0) {
    if (eul[1] == 0.0) {
      dphi = fmod(eul[2] - 180.0 - eul[0], 360.0);
      jlng = 0;
      latp = lat;
      phip = phi;
      thetap = theta;
      for (ilat = 0; ilat < nlat; ilat++, latp += sll) {
        lngp = lng + (jlng % nlng) * sll;
        for (ilng = 0; ilng < mlng; ilng++, lngp += sll, jlng++) {
          *phip = fmod(*lngp + dphi, 360.0);
          *thetap = *latp;
          if (*phip > 180.0) {
            *phip -= 360.0;
          } else if (*phip < -180.0) {
            *phip += 360.0;
          }
          phip += spt;
          thetap += spt;
        }
      }
    } else {
      dphi = fmod(eul[2] + eul[0], 360.0);
      jlng = 0;
      latp = lat;
      phip = phi;
      thetap = theta;
      for (ilat = 0; ilat < nlat; ilat++, latp += sll) {
        lngp = lng + (jlng % nlng) * sll;
        for (ilng = 0; ilng < mlng; ilng++, lngp += sll, jlng++) {
          *phip = fmod(dphi - *lngp, 360.0);
          *thetap = -(*latp);
          if (*phip > 180.0) {
            *phip -= 360.0;
          } else if (*phip < -180.0) {
            *phip += 360.0;
          }
          phip += spt;
          thetap += spt;
        }
      }
    }
    return 0;
  }
  lngp = lng;
  rowoff = 0;
  rowlen = nlng * spt;
  for (ilng = 0; ilng < nlng; ilng++, rowoff += spt, lngp += sll) {
    dlng = *lngp - eul[0];
    phip = phi + rowoff;
    thetap = theta;
    for (ilat = 0; ilat < mlat; ilat++) {
      *phip = dlng;
      phip += rowlen;
    }
  }
  latp = lat;
  phip = phi;
  thetap = theta;
  for (ilat = 0; ilat < nlat; ilat++, latp += sll) {
    sincosd(*latp, &sinlat, &coslat);
    coslat3 = coslat * eul[3];
    coslat4 = coslat * eul[4];
    sinlat3 = sinlat * eul[3];
    sinlat4 = sinlat * eul[4];
    for (ilng = 0; ilng < mlng; ilng++, phip += spt, thetap += spt) {
      dlng = *phip;
      sincosd(dlng, &sinlng, &coslng);
      x = sinlat4 - coslat3 * coslng;
      if (fabs(x) < 1.0e-5) {
        x = -cosd(*latp + eul[1]) + coslat3 * (1.0 - coslng);
      }
      y = -coslat * sinlng;
      if (x != 0.0 || y != 0.0) {
        dphi = atan2d(y, x);
      } else {
        if (eul[1] < 90.0) {
          dphi = dlng - 180.0;
        } else {
          dphi = -dlng;
        }
      }
      *phip = fmod(eul[2] + dphi, 360.0);
      if (*phip > 180.0) {
        *phip -= 360.0;
      } else if (*phip < -180.0) {
        *phip += 360.0;
      }
      if (fmod(dlng, 180.0) == 0.0) {
        *thetap = *latp + coslng * eul[1];
        if (*thetap > 90.0)
          *thetap = 180.0 - *thetap;
        if (*thetap < -90.0)
          *thetap = -180.0 - *thetap;
      } else {
        z = sinlat3 + coslat4 * coslng;
        if (fabs(z) > 0.99) {
          *thetap = ((z) < 0.0 ? -fabs(acosd(sqrt(x * x + y * y)))
                               : fabs(acosd(sqrt(x * x + y * y))));
        } else {
          *thetap = asind(z);
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<sphs2x>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
cmpl   $0x0,-0x18(%rbp)
jle    11b7 <sphs2x+0x47>
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    11cb <sphs2x+0x5b>
movl   $0x1,-0x34(%rbp)
movl   $0x1,-0x30(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1636 <sphs2x+0x4c6>
jp     1636 <sphs2x+0x4c6>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1411 <sphs2x+0x2a1>
jp     1411 <sphs2x+0x2a1>
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  0xe04(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
movsd  0xdf8(%rip),%xmm1
call   1040 <fmod@plt>
movsd  %xmm0,-0x70(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    0x10(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    0x18(%rbp),%rax
mov    %rax,-0xc8(%rbp)
mov    0x20(%rbp),%rax
mov    %rax,-0xd0(%rbp)
movl   $0x0,-0xac(%rbp)
mov    -0xac(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    140c <sphs2x+0x29c>
mov    -0x28(%rbp),%rax
mov    %rax,-0xd8(%rbp)
mov    -0x2c(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    -0xd8(%rbp),%rax
imul   -0x1c(%rbp),%edx
movslq %edx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xc0(%rbp)
movl   $0x0,-0xb0(%rbp)
mov    -0xb0(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    13d8 <sphs2x+0x268>
mov    -0xc0(%rbp),%rax
movsd  (%rax),%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  0xd4e(%rip),%xmm1
call   1040 <fmod@plt>
mov    -0xc8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0xb8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0xd0(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0xc8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xd0d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1335 <sphs2x+0x1c5>
mov    -0xc8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xcf8(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
jmp    136a <sphs2x+0x1fa>
mov    -0xc8(%rbp),%rax
movsd  0xce4(%rip),%xmm0
ucomisd (%rax),%xmm0
jbe    1365 <sphs2x+0x1f5>
mov    -0xc8(%rbp),%rax
movsd  0xcc3(%rip),%xmm0
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
jmp    136a <sphs2x+0x1fa>
mov    -0x20(%rbp),%ecx
mov    -0xc8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xc8(%rbp)
mov    -0x20(%rbp),%ecx
mov    -0xd0(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xd0(%rbp)
mov    -0xb0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb0(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0xc0(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xc0(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12ab <sphs2x+0x13b>
jmp    13dd <sphs2x+0x26d>
mov    -0xac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xac(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0xb8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xb8(%rbp)
jmp    1264 <sphs2x+0xf4>
jmp    162a <sphs2x+0x4ba>
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
addsd  (%rax),%xmm0
movsd  0xbf6(%rip),%xmm1
call   1040 <fmod@plt>
movsd  %xmm0,-0x70(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    0x10(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    0x18(%rbp),%rax
mov    %rax,-0xc8(%rbp)
mov    0x20(%rbp),%rax
mov    %rax,-0xd0(%rbp)
movl   $0x0,-0xac(%rbp)
mov    -0xac(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1625 <sphs2x+0x4b5>
mov    -0x28(%rbp),%rax
mov    %rax,-0xe0(%rbp)
mov    -0x2c(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    -0xe0(%rbp),%rax
imul   -0x1c(%rbp),%edx
movslq %edx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xc0(%rbp)
movl   $0x0,-0xb0(%rbp)
mov    -0xb0(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    15f1 <sphs2x+0x481>
movsd  -0x70(%rbp),%xmm0
mov    -0xc0(%rbp),%rax
subsd  (%rax),%xmm0
movsd  0xb4c(%rip),%xmm1
call   1040 <fmod@plt>
mov    -0xc8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0xb8(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0xd0(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0xc8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xaf4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    154e <sphs2x+0x3de>
mov    -0xc8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xadf(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
jmp    1583 <sphs2x+0x413>
mov    -0xc8(%rbp),%rax
movsd  0xacb(%rip),%xmm0
ucomisd (%rax),%xmm0
jbe    157e <sphs2x+0x40e>
mov    -0xc8(%rbp),%rax
movsd  0xaaa(%rip),%xmm0
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
jmp    1583 <sphs2x+0x413>
mov    -0x20(%rbp),%ecx
mov    -0xc8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xc8(%rbp)
mov    -0x20(%rbp),%ecx
mov    -0xd0(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xd0(%rbp)
mov    -0xb0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb0(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0xc0(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xc0(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    14ad <sphs2x+0x33d>
jmp    15f6 <sphs2x+0x486>
mov    -0xac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xac(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0xb8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xb8(%rbp)
jmp    1466 <sphs2x+0x2f6>
jmp    162a <sphs2x+0x4ba>
movl   $0x0,-0x4(%rbp)
jmp    1cd1 <sphs2x+0xb61>
mov    -0x28(%rbp),%rax
mov    %rax,-0xc0(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x20(%rbp),%eax
mov    %eax,-0x38(%rbp)
movl   $0x0,-0xb0(%rbp)
mov    -0xb0(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1739 <sphs2x+0x5c9>
mov    -0xc0(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    0x18(%rbp),%rax
movslq -0x3c(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xc8(%rbp)
mov    0x20(%rbp),%rax
mov    %rax,-0xd0(%rbp)
movl   $0x0,-0xac(%rbp)
mov    -0xac(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    16fc <sphs2x+0x58c>
movsd  -0x68(%rbp),%xmm0
mov    -0xc8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%ecx
mov    -0xc8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xc8(%rbp)
mov    -0xac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xac(%rbp)
jmp    16ae <sphs2x+0x53e>
jmp    1701 <sphs2x+0x591>
mov    -0xb0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb0(%rbp)
mov    -0x20(%rbp),%eax
add    -0x3c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0xc0(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xc0(%rbp)
jmp    165c <sphs2x+0x4ec>
mov    0x10(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    0x18(%rbp),%rax
mov    %rax,-0xc8(%rbp)
mov    0x20(%rbp),%rax
mov    %rax,-0xd0(%rbp)
movl   $0x0,-0xac(%rbp)
mov    -0xac(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1cca <sphs2x+0xb5a>
mov    -0xb8(%rbp),%rax
movsd  (%rax),%xmm0
lea    -0x78(%rbp),%rdi
lea    -0x48(%rbp),%rsi
mov    $0x1,%al
call   1070 <sincosd@plt>
movsd  -0x48(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x78(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x78(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movl   $0x0,-0xb0(%rbp)
mov    -0xb0(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1c96 <sphs2x+0xb26>
mov    -0xc8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
lea    -0x90(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    $0x1,%al
call   1070 <sincosd@plt>
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x50(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm1
ff
movaps 0x7dc(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0x790(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    18c1 <sphs2x+0x751>
mov    -0xb8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
addsd  0x8(%rax),%xmm0
mov    $0x1,%al
call   1030 <cosd@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  0x75c(%rip),%xmm2
subsd  -0x60(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1928 <sphs2x+0x7b8>
jp     1928 <sphs2x+0x7b8>
movsd  -0xa0(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1928 <sphs2x+0x7b8>
jp     1928 <sphs2x+0x7b8>
jmp    194d <sphs2x+0x7dd>
movsd  -0xa0(%rbp),%xmm0
ff
movsd  -0x98(%rbp),%xmm1
ff
mov    $0x2,%al
call   1090 <atan2d@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    19a5 <sphs2x+0x835>
mov    -0x10(%rbp),%rax
movsd  0x6b7(%rip),%xmm0
ucomisd 0x8(%rax),%xmm0
jbe    197f <sphs2x+0x80f>
movsd  -0x68(%rbp),%xmm0
movsd  0x6a7(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    19a0 <sphs2x+0x830>
movsd  -0x68(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    19a5 <sphs2x+0x835>
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  0x665(%rip),%xmm1
call   1040 <fmod@plt>
mov    -0xc8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0xc8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0x63a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1a08 <sphs2x+0x898>
mov    -0xc8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0x625(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
jmp    1a3d <sphs2x+0x8cd>
mov    -0xc8(%rbp),%rax
movsd  0x611(%rip),%xmm0
ucomisd (%rax),%xmm0
jbe    1a38 <sphs2x+0x8c8>
mov    -0xc8(%rbp),%rax
movsd  0x5f0(%rip),%xmm0
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
jmp    1a3d <sphs2x+0x8cd>
movsd  -0x68(%rbp),%xmm0
movsd  0x5ce(%rip),%xmm1
call   1040 <fmod@plt>
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1b05 <sphs2x+0x995>
jp     1b05 <sphs2x+0x995>
mov    -0xb8(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x60(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0xd0(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0xd0(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0x56f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1ac9 <sphs2x+0x959>
mov    -0xd0(%rbp),%rax
movsd  0x55e(%rip),%xmm0
subsd  (%rax),%xmm0
mov    -0xd0(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0xd0(%rbp),%rax
movsd  0x560(%rip),%xmm0
ucomisd (%rax),%xmm0
jbe    1b00 <sphs2x+0x990>
mov    -0xd0(%rbp),%rax
movsd  0x537(%rip),%xmm0
subsd  (%rax),%xmm0
mov    -0xd0(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1c47 <sphs2x+0xad7>
movsd  -0x80(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movaps 0x50d(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0x4f1(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1c24 <sphs2x+0xab4>
xorps  %xmm0,%xmm0
ucomisd -0xa8(%rbp),%xmm0
ff
jbe    1bc1 <sphs2x+0xa51>
movsd  -0x98(%rbp),%xmm0
ff
movsd  -0x98(%rbp),%xmm2
ff
movsd  -0xa0(%rbp),%xmm1
ff
mulsd  -0xa0(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
mov    $0x1,%al
call   1050 <acosd@plt>
cvtsi2sd %eax,%xmm0
movaps 0x4a7(%rip),%xmm1
pand   %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
jmp    1c0c <sphs2x+0xa9c>
movsd  -0x98(%rbp),%xmm0
ff
movsd  -0x98(%rbp),%xmm2
ff
movsd  -0xa0(%rbp),%xmm1
ff
mulsd  -0xa0(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
mov    $0x1,%al
call   1050 <acosd@plt>
cvtsi2sd %eax,%xmm0
movaps 0x440(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0xe8(%rbp),%xmm0
ff
mov    -0xd0(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1c42 <sphs2x+0xad2>
movsd  -0xa8(%rbp),%xmm0
ff
mov    $0x1,%al
call   1080 <asind@plt>
cvtsi2sd %eax,%xmm0
mov    -0xd0(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1c47 <sphs2x+0xad7>
jmp    1c4c <sphs2x+0xadc>
mov    -0xb0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb0(%rbp)
mov    -0x20(%rbp),%ecx
mov    -0xc8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xc8(%rbp)
mov    -0x20(%rbp),%ecx
mov    -0xd0(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xd0(%rbp)
jmp    17e6 <sphs2x+0x676>
jmp    1c9b <sphs2x+0xb2b>
mov    -0xac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xac(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0xb8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xb8(%rbp)
jmp    1764 <sphs2x+0x5f4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sphs2x>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %r8d,%ebx
mov    %ecx,%r12d
mov    %esi,%ecx
mov    0x110(%rsp),%rbp
mov    0x108(%rsp),%r15
mov    0x100(%rsp),%r14
test   %edx,%edx
mov    $0x1,%r13d
cmovg  %esi,%r13d
mov    %esi,%eax
cmovg  %edx,%eax
mov    %eax,0x8(%rsp)
movsd  0x20(%rdi),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %r13d,0xc(%rsp)
jne    1336 <sphs2x+0x1c6>
jp     1336 <sphs2x+0x1c6>
movsd  0x8(%rdi),%xmm2
movsd  0x10(%rdi),%xmm0
ucomisd %xmm1,%xmm2
mov    %r9,0x60(%rsp)
mov    %r12d,0x10(%rsp)
mov    %ecx,0x38(%rsp)
jne    186d <sphs2x+0x6fd>
jp     186d <sphs2x+0x6fd>
addsd  0xe34(%rip),%xmm0
subsd  (%rdi),%xmm0
movsd  0xe30(%rip),%xmm1
call   1040 <fmod@plt>
mov    0x60(%rsp),%rsi
movsd  %xmm0,0x20(%rsp)
cmpl   $0x0,0x8(%rsp)
jle    1997 <sphs2x+0x827>
movslq %ebx,%rbx
movslq %r12d,%rax
shl    $0x3,%rbx
mov    %rax,0x18(%rsp)
lea    0x0(,%rax,8),%rax
mov    %rax,0x70(%rsp)
xor    %ecx,%ecx
xor    %edx,%edx
jmp    1287 <sphs2x+0x117>
nopl   (%rax)
mov    0xc(%rsp),%eax
mov    0x50(%rsp),%edx
add    %eax,%edx
mov    %r13,%r14
mov    %eax,%r13d
mov    0x60(%rsp),%rsi
mov    0x10(%rsp),%r12d
mov    0x80(%rsp),%ecx
add    $0x1,%ecx
mov    0x18(%rsp),%rax
lea    (%r14,%rax,8),%r14
cmp    0x8(%rsp),%ecx
je     1997 <sphs2x+0x827>
test   %r13d,%r13d
jle    1271 <sphs2x+0x101>
mov    %ecx,0x80(%rsp)
mov    %r13d,%ecx
mov    %r14,%r13
mov    %edx,0x50(%rsp)
mov    %edx,%eax
cltd
idivl  0x38(%rsp)
imul   %r12d,%edx
movslq %edx,%rax
lea    (%rsi,%rax,8),%r12
mov    %ecx,%r14d
jmp    12de <sphs2x+0x16e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r15)
add    %rbx,%rbp
add    %rbx,%r15
add    0x70(%rsp),%r12
add    $0xffffffff,%r14d
je     1250 <sphs2x+0xe0>
movsd  (%r12),%xmm0
addsd  0x20(%rsp),%xmm0
movsd  0xd4e(%rip),%xmm1
call   1040 <fmod@plt>
movsd  %xmm0,(%r15)
movsd  0x0(%r13),%xmm0
movsd  %xmm0,0x0(%rbp)
movsd  (%r15),%xmm0
ucomisd 0xd3c(%rip),%xmm0
movsd  0xd2c(%rip),%xmm1
ja     12c0 <sphs2x+0x150>
movsd  0xd12(%rip),%xmm1
ucomisd %xmm0,%xmm1
movsd  0xd0e(%rip),%xmm1
ja     12c0 <sphs2x+0x150>
jmp    12c9 <sphs2x+0x159>
mov    %rdi,0x98(%rsp)
movslq %r12d,%rax
mov    %rax,0xa0(%rsp)
movslq %ebx,%rax
mov    %rax,0x10(%rsp)
test   %ecx,%ecx
jle    14e1 <sphs2x+0x371>
imul   %ecx,%ebx
cmp    $0x2,%edx
mov    $0x1,%eax
mov    $0x1,%edi
cmovge %edx,%edi
test   %edx,%edx
movslq %ebx,%rsi
cmovle %eax,%edi
lea    -0x1(%rdi),%eax
mov    %eax,0x18(%rsp)
mov    %edi,%eax
and    $0x7,%eax
mov    %eax,0x50(%rsp)
and    $0x7ffffff8,%edi
mov    %rdi,0xb0(%rsp)
mov    0x10(%rsp),%rax
lea    0x0(,%rax,8),%rax
mov    %rax,0x40(%rsp)
mov    %rsi,%r14
shl    $0x6,%r14
imul   $0x38,%rsi,%r10
mov    %rsi,%rax
shl    $0x4,%rax
lea    (%rax,%rax,2),%r8
lea    0x0(,%rsi,8),%rbx
lea    (%rbx,%rbx,4),%rdi
mov    %rsi,%r13
shl    $0x5,%r13
lea    (%rbx,%rbx,2),%r12
xor    %edx,%edx
mov    %r15,0x20(%rsp)
movl   $0x0,0x70(%rsp)
mov    %ecx,0x38(%rsp)
jmp    1438 <sphs2x+0x2c8>
cs nopw 0x0(%rax,%rax,1)
mov    0x70(%rsp),%r11d
add    $0x1,%r11d
mov    0x80(%rsp),%rdx
add    0x10(%rsp),%rdx
mov    0xa0(%rsp),%rcx
mov    0x60(%rsp),%r9
lea    (%r9,%rcx,8),%r9
mov    0x20(%rsp),%rcx
add    0x40(%rsp),%rcx
mov    %rcx,0x20(%rsp)
mov    0x38(%rsp),%ecx
mov    %r11d,0x70(%rsp)
cmp    %ecx,%r11d
je     14e1 <sphs2x+0x371>
movsd  (%r9),%xmm0
mov    0x98(%rsp),%rcx
subsd  (%rcx),%xmm0
cmpl   $0x7,0x18(%rsp)
mov    %r9,0x60(%rsp)
mov    %rdx,0x80(%rsp)
jae    1470 <sphs2x+0x300>
lea    (%r15,%rdx,8),%rcx
jmp    14b4 <sphs2x+0x344>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0xb0(%rsp),%rcx
mov    %ecx,%r11d
mov    0x20(%rsp),%rcx
movsd  %xmm0,(%rcx)
movsd  %xmm0,(%rcx,%rsi,8)
movsd  %xmm0,(%rcx,%rax,1)
movsd  %xmm0,(%rcx,%r12,1)
movsd  %xmm0,(%rcx,%r13,1)
movsd  %xmm0,(%rcx,%rdi,1)
movsd  %xmm0,(%rcx,%r8,1)
movsd  %xmm0,(%rcx,%r10,1)
add    %r14,%rcx
add    $0xfffffff8,%r11d
jne    1480 <sphs2x+0x310>
cmpl   $0x0,0x50(%rsp)
je     13f0 <sphs2x+0x280>
mov    0x50(%rsp),%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  %xmm0,(%rcx)
add    %rbx,%rcx
add    $0xffffffff,%edx
jne    14d0 <sphs2x+0x360>
jmp    13f0 <sphs2x+0x280>
cmpl   $0x0,0x8(%rsp)
mov    0x100(%rsp),%r14
mov    0xc(%rsp),%r13d
mov    0x10(%rsp),%r12
mov    0x98(%rsp),%rbx
jle    1997 <sphs2x+0x827>
shl    $0x3,%r12
movl   $0x0,0x40(%rsp)
jmp    1546 <sphs2x+0x3d6>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x40(%rsp),%ecx
add    $0x1,%ecx
mov    0xa0(%rsp),%rax
lea    (%r14,%rax,8),%r14
mov    %ecx,0x40(%rsp)
cmp    0x8(%rsp),%ecx
mov    0xc(%rsp),%r13d
je     1997 <sphs2x+0x827>
movsd  (%r14),%xmm0
lea    0xc0(%rsp),%rdi
lea    0xa8(%rsp),%rsi
mov    $0x1,%al
call   1070 <sincosd@plt>
test   %r13d,%r13d
jle    1520 <sphs2x+0x3b0>
movsd  0xa8(%rsp),%xmm0
movsd  0x18(%rbx),%xmm1
movsd  0x20(%rbx),%xmm2
movapd %xmm0,%xmm3
mulsd  %xmm1,%xmm3
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xc0(%rsp),%xmm0
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x38(%rsp)
movapd %xmm3,0x50(%rsp)
xorpd  0xa49(%rip),%xmm3
movapd %xmm3,0x80(%rsp)
jmp    15e9 <sphs2x+0x479>
movapd %xmm3,%xmm0
mov    $0x1,%al
call   1080 <asind@plt>
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
movsd  %xmm2,0x0(%rbp)
add    %r12,%rbp
add    %r12,%r15
add    $0xffffffff,%r13d
je     1520 <sphs2x+0x3b0>
movsd  (%r15),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0xb8(%rsp),%rdi
lea    0x48(%rsp),%rsi
mov    $0x1,%al
call   1070 <sincosd@plt>
movsd  0x48(%rsp),%xmm2
mulsd  0x80(%rsp),%xmm2
addsd  0x38(%rsp),%xmm2
movapd %xmm2,%xmm0
andpd  0x9e8(%rip),%xmm0
movsd  0x9f0(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1668 <sphs2x+0x4f8>
movsd  (%r14),%xmm0
addsd  0x8(%rbx),%xmm0
mov    $0x1,%al
call   1030 <cosd@plt>
neg    %eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x9d0(%rip),%xmm2
subsd  0x48(%rsp),%xmm2
mulsd  0x50(%rsp),%xmm2
addsd  %xmm0,%xmm2
movsd  0xa8(%rsp),%xmm1
xorpd  0x987(%rip),%xmm1
mulsd  0xb8(%rsp),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
movapd %xmm2,0x70(%rsp)
movapd %xmm1,0x60(%rsp)
jne    16d0 <sphs2x+0x560>
jp     16d0 <sphs2x+0x560>
ucomisd %xmm0,%xmm1
jne    16d0 <sphs2x+0x560>
jp     16d0 <sphs2x+0x560>
movsd  0x986(%rip),%xmm0
ucomisd 0x8(%rbx),%xmm0
jbe    16f0 <sphs2x+0x580>
movapd 0x20(%rsp),%xmm0
addsd  0x979(%rip),%xmm0
jmp    16fe <sphs2x+0x58e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movapd %xmm1,%xmm0
movapd %xmm2,%xmm1
mov    $0x2,%al
call   1090 <atan2d@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
jmp    16fe <sphs2x+0x58e>
nopl   0x0(%rax,%rax,1)
movapd 0x20(%rsp),%xmm0
xorpd  0x902(%rip),%xmm0
addsd  0x10(%rbx),%xmm0
movsd  0x935(%rip),%xmm1
call   1040 <fmod@plt>
movsd  %xmm0,(%r15)
movsd  0x933(%rip),%xmm2
ucomisd %xmm2,%xmm0
movsd  0x91f(%rip),%xmm1
ja     1741 <sphs2x+0x5d1>
movsd  0x905(%rip),%xmm1
ucomisd %xmm0,%xmm1
movsd  0x901(%rip),%xmm1
jbe    174a <sphs2x+0x5da>
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r15)
movapd 0x20(%rsp),%xmm0
movapd %xmm2,%xmm1
call   1040 <fmod@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    17d0 <sphs2x+0x660>
jp     17d0 <sphs2x+0x660>
movsd  0x48(%rsp),%xmm1
mulsd  0x8(%rbx),%xmm1
addsd  (%r14),%xmm1
movsd  0x8d3(%rip),%xmm2
subsd  %xmm1,%xmm2
movsd  0x8a7(%rip),%xmm0
cmpltsd %xmm1,%xmm0
andpd  %xmm0,%xmm2
andnpd %xmm1,%xmm0
orpd   %xmm2,%xmm0
movlpd %xmm0,0x0(%rbp)
movsd  0x8b9(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    15d9 <sphs2x+0x469>
movsd  0x87f(%rip),%xmm2
subsd  %xmm0,%xmm2
jmp    15d4 <sphs2x+0x464>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0x48(%rsp),%xmm3
mulsd  0x10(%rsp),%xmm3
addsd  0x18(%rsp),%xmm3
movapd %xmm3,%xmm0
andpd  0x822(%rip),%xmm0
ucomisd 0x862(%rip),%xmm0
jbe    15c2 <sphs2x+0x452>
movapd 0x60(%rsp),%xmm2
mulsd  %xmm2,%xmm2
movapd 0x70(%rsp),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
movapd %xmm3,0x20(%rsp)
jb     1826 <sphs2x+0x6b6>
sqrtsd %xmm0,%xmm0
jmp    182b <sphs2x+0x6bb>
call   1060 <sqrt@plt>
mov    $0x1,%al
call   1050 <acosd@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd %xmm0,%xmm1
andpd  0x7cb(%rip),%xmm1
orpd   0x7b3(%rip),%xmm0
movapd 0x20(%rsp),%xmm2
cmpltsd 0x80c(%rip),%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm0,%xmm2
jmp    15d4 <sphs2x+0x464>
addsd  (%rdi),%xmm0
movsd  0x7c7(%rip),%xmm1
call   1040 <fmod@plt>
mov    0x60(%rsp),%rcx
movsd  %xmm0,0x20(%rsp)
cmpl   $0x0,0x8(%rsp)
jle    1997 <sphs2x+0x827>
movslq %ebx,%rbx
movslq %r12d,%rax
shl    $0x3,%rbx
mov    %rax,0x18(%rsp)
lea    0x0(,%rax,8),%rax
mov    %rax,0x70(%rsp)
xor    %edx,%edx
xor    %esi,%esi
jmp    18f3 <sphs2x+0x783>
cs nopw 0x0(%rax,%rax,1)
mov    0xc(%rsp),%r13d
mov    0x50(%rsp),%esi
add    %r13d,%esi
mov    0x60(%rsp),%rcx
mov    0x10(%rsp),%r12d
mov    0x80(%rsp),%edx
add    $0x1,%edx
mov    0x18(%rsp),%rax
lea    (%r14,%rax,8),%r14
cmp    0x8(%rsp),%edx
je     1997 <sphs2x+0x827>
test   %r13d,%r13d
jle    18dd <sphs2x+0x76d>
mov    %edx,0x80(%rsp)
mov    %esi,0x50(%rsp)
mov    %esi,%eax
cltd
idivl  0x38(%rsp)
imul   %r12d,%edx
movslq %edx,%rax
mov    %r13d,%r12d
lea    (%rcx,%rax,8),%r13
jmp    193a <sphs2x+0x7ca>
nopw   0x0(%rax,%rax,1)
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r15)
add    %rbx,%rbp
add    %rbx,%r15
add    0x70(%rsp),%r13
add    $0xffffffff,%r12d
je     18c0 <sphs2x+0x750>
movsd  0x20(%rsp),%xmm0
subsd  0x0(%r13),%xmm0
movsd  0x6f2(%rip),%xmm1
call   1040 <fmod@plt>
movsd  %xmm0,(%r15)
movsd  (%r14),%xmm0
xorps  0x69c(%rip),%xmm0
movlps %xmm0,0x0(%rbp)
movsd  (%r15),%xmm0
ucomisd 0x6db(%rip),%xmm0
movsd  0x6cb(%rip),%xmm1
ja     1920 <sphs2x+0x7b0>
movsd  0x6b1(%rip),%xmm1
ucomisd %xmm0,%xmm1
movsd  0x6ad(%rip),%xmm1
ja     1920 <sphs2x+0x7b0>
jmp    1929 <sphs2x+0x7b9>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @sphs2x(double* %0, i32 %1, i32 %2, i32 %3, i32 %4, double* %5, double* %6, double* %7, double* %8) {
%10 = alloca i32
%11 = alloca double*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double
%32 = alloca double
%33 = alloca double
%34 = alloca double
%35 = alloca double
%36 = alloca double
%37 = alloca double
%38 = alloca i32
%39 = alloca i32
%40 = alloca double*
%41 = alloca double*
%42 = alloca double*
%43 = alloca double*
store double* %0, double** %11
store i32 %1, i32* %12
store i32 %2, i32* %13
store i32 %3, i32* %14
store i32 %4, i32* %15
store double* %5, double** %16
store double* %6, double** %17
store double* %7, double** %18
store double* %8, double** %19
%44 = load i32, i32* %13
%45 = icmp sgt i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %9
%47 = load i32, i32* %12
store i32 %47, i32* %22
%48 = load i32, i32* %13
store i32 %48, i32* %21
br label %51
49: ; preds = %9
store i32 1, i32* %22
store i32 1, i32* %21
%50 = load i32, i32* %12
store i32 %50, i32* %13
br label %51
51: ; preds = %49, %46
%52 = load double*, double** %11
%53 = getelementptr inbounds double, double* %52, i64 4
%54 = load double, double* %53
%55 = fcmp oeq double %54, 0.000000e+00
br i1 %55, label %56, label %228
56: ; preds = %51
%57 = load double*, double** %11
%58 = getelementptr inbounds double, double* %57, i64 1
%59 = load double, double* %58
%60 = fcmp oeq double %59, 0.000000e+00
br i1 %60, label %61, label %144
61: ; preds = %56
%62 = load double*, double** %11
%63 = getelementptr inbounds double, double* %62, i64 2
%64 = load double, double* %63
%65 = fsub double %64, 1.800000e+02
%66 = load double*, double** %11
%67 = getelementptr inbounds double, double* %66, i64 0
%68 = load double, double* %67
%69 = fsub double %65, %68
%70 = call double @fmod(double %69, double 3.600000e+02)
store double %70, double* %30
store i32 0, i32* %20
%71 = load double*, double** %17
store double* %71, double** %40
%72 = load double*, double** %18
store double* %72, double** %42
%73 = load double*, double** %19
store double* %73, double** %43
store i32 0, i32* %38
br label %74
74: ; preds = %136, %61
%75 = load i32, i32* %38
%76 = load i32, i32* %13
%77 = icmp slt i32 %75, %76
br i1 %77, label %78, label %143
78: ; preds = %74
%79 = load double*, double** %16
%80 = load i32, i32* %20
%81 = load i32, i32* %12
%82 = srem i32 %80, %81
%83 = load i32, i32* %14
%84 = mul nsw i32 %82, %83
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds double, double* %79, i64 %85
store double* %86, double** %41
store i32 0, i32* %39
br label %87
87: ; preds = %126, %78
%88 = load i32, i32* %39
%89 = load i32, i32* %22
%90 = icmp slt i32 %88, %89
br i1 %90, label %91, label %135
91: ; preds = %87
%92 = load double*, double** %41
%93 = load double, double* %92
%94 = load double, double* %30
%95 = fadd double %93, %94
%96 = call double @fmod(double %95, double 3.600000e+02)
%97 = load double*, double** %42
store double %96, double* %97
%98 = load double*, double** %40
%99 = load double, double* %98
%100 = load double*, double** %43
store double %99, double* %100
%101 = load double*, double** %42
%102 = load double, double* %101
%103 = fcmp ogt double %102, 1.800000e+02
br i1 %103, label %104, label %108
104: ; preds = %91
%105 = load double*, double** %42
%106 = load double, double* %105
%107 = fsub double %106, 3.600000e+02
store double %107, double* %105
br label %117
108: ; preds = %91
%109 = load double*, double** %42
%110 = load double, double* %109
%111 = fcmp olt double %110, -1.800000e+02
br i1 %111, label %112, label %116
112: ; preds = %108
%113 = load double*, double** %42
%114 = load double, double* %113
%115 = fadd double %114, 3.600000e+02
store double %115, double* %113
br label %116
116: ; preds = %112, %108
br label %117
117: ; preds = %116, %104
%118 = load i32, i32* %15
%119 = load double*, double** %42
%120 = sext i32 %118 to i64
%121 = getelementptr inbounds double, double* %119, i64 %120
store double* %121, double** %42
%122 = load i32, i32* %15
%123 = load double*, double** %43
%124 = sext i32 %122 to i64
%125 = getelementptr inbounds double, double* %123, i64 %124
store double* %125, double** %43
br label %126
126: ; preds = %117
%127 = load i32, i32* %39
%128 = add nsw i32 %127, 1
store i32 %128, i32* %39
%129 = load i32, i32* %14
%130 = load double*, double** %41
%131 = sext i32 %129 to i64
%132 = getelementptr inbounds double, double* %130, i64 %131
store double* %132, double** %41
%133 = load i32, i32* %20
%134 = add nsw i32 %133, 1
store i32 %134, i32* %20
br label %87
135: ; preds = %87
br label %136
136: ; preds = %135
%137 = load i32, i32* %38
%138 = add nsw i32 %137, 1
store i32 %138, i32* %38
%139 = load i32, i32* %14
%140 = load double*, double** %40
%141 = sext i32 %139 to i64
%142 = getelementptr inbounds double, double* %140, i64 %141
store double* %142, double** %40
br label %74
143: ; preds = %74
br label %227
144: ; preds = %56
%145 = load double*, double** %11
%146 = getelementptr inbounds double, double* %145, i64 2
%147 = load double, double* %146
%148 = load double*, double** %11
%149 = getelementptr inbounds double, double* %148, i64 0
%150 = load double, double* %149
%151 = fadd double %147, %150
%152 = call double @fmod(double %151, double 3.600000e+02)
store double %152, double* %30
store i32 0, i32* %20
%153 = load double*, double** %17
store double* %153, double** %40
%154 = load double*, double** %18
store double* %154, double** %42
%155 = load double*, double** %19
store double* %155, double** %43
store i32 0, i32* %38
br label %156
156: ; preds = %219, %144
%157 = load i32, i32* %38
%158 = load i32, i32* %13
%159 = icmp slt i32 %157, %158
br i1 %159, label %160, label %226
160: ; preds = %156
%161 = load double*, double** %16
%162 = load i32, i32* %20
%163 = load i32, i32* %12
%164 = srem i32 %162, %163
%165 = load i32, i32* %14
%166 = mul nsw i32 %164, %165
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds double, double* %161, i64 %167
store double* %168, double** %41
store i32 0, i32* %39
br label %169
169: ; preds = %209, %160
%170 = load i32, i32* %39
%171 = load i32, i32* %22
%172 = icmp slt i32 %170, %171
br i1 %172, label %173, label %218
173: ; preds = %169
%174 = load double, double* %30
%175 = load double*, double** %41
%176 = load double, double* %175
%177 = fsub double %174, %176
%178 = call double @fmod(double %177, double 3.600000e+02)
%179 = load double*, double** %42
store double %178, double* %179
%180 = load double*, double** %40
%181 = load double, double* %180
%182 = fneg double %181
%183 = load double*, double** %43
store double %182, double* %183
%184 = load double*, double** %42
%185 = load double, double* %184
%186 = fcmp ogt double %185, 1.800000e+02
br i1 %186, label %187, label %191
187: ; preds = %173
%188 = load double*, double** %42
%189 = load double, double* %188
%190 = fsub double %189, 3.600000e+02
store double %190, double* %188
br label %200
191: ; preds = %173
%192 = load double*, double** %42
%193 = load double, double* %192
%194 = fcmp olt double %193, -1.800000e+02
br i1 %194, label %195, label %199
195: ; preds = %191
%196 = load double*, double** %42
%197 = load double, double* %196
%198 = fadd double %197, 3.600000e+02
store double %198, double* %196
br label %199
199: ; preds = %195, %191
br label %200
200: ; preds = %199, %187
%201 = load i32, i32* %15
%202 = load double*, double** %42
%203 = sext i32 %201 to i64
%204 = getelementptr inbounds double, double* %202, i64 %203
store double* %204, double** %42
%205 = load i32, i32* %15
%206 = load double*, double** %43
%207 = sext i32 %205 to i64
%208 = getelementptr inbounds double, double* %206, i64 %207
store double* %208, double** %43
br label %209
209: ; preds = %200
%210 = load i32, i32* %39
%211 = add nsw i32 %210, 1
store i32 %211, i32* %39
%212 = load i32, i32* %14
%213 = load double*, double** %41
%214 = sext i32 %212 to i64
%215 = getelementptr inbounds double, double* %213, i64 %214
store double* %215, double** %41
%216 = load i32, i32* %20
%217 = add nsw i32 %216, 1
store i32 %217, i32* %20
br label %169
218: ; preds = %169
br label %219
219: ; preds = %218
%220 = load i32, i32* %38
%221 = add nsw i32 %220, 1
store i32 %221, i32* %38
%222 = load i32, i32* %14
%223 = load double*, double** %40
%224 = sext i32 %222 to i64
%225 = getelementptr inbounds double, double* %223, i64 %224
store double* %225, double** %40
br label %156
226: ; preds = %156
br label %227
227: ; preds = %226, %143
store i32 0, i32* %10
br label %483
228: ; preds = %51
%229 = load double*, double** %16
store double* %229, double** %41
store i32 0, i32* %24
%230 = load i32, i32* %12
%231 = load i32, i32* %15
%232 = mul nsw i32 %230, %231
store i32 %232, i32* %23
store i32 0, i32* %39
br label %233
233: ; preds = %264, %228
%234 = load i32, i32* %39
%235 = load i32, i32* %12
%236 = icmp slt i32 %234, %235
br i1 %236, label %237, label %274
237: ; preds = %233
%238 = load double*, double** %41
%239 = load double, double* %238
%240 = load double*, double** %11
%241 = getelementptr inbounds double, double* %240, i64 0
%242 = load double, double* %241
%243 = fsub double %239, %242
store double %243, double* %29
%244 = load double*, double** %18
%245 = load i32, i32* %24
%246 = sext i32 %245 to i64
%247 = getelementptr inbounds double, double* %244, i64 %246
store double* %247, double** %42
%248 = load double*, double** %19
store double* %248, double** %43
store i32 0, i32* %38
br label %249
249: ; preds = %260, %237
%250 = load i32, i32* %38
%251 = load i32, i32* %21
%252 = icmp slt i32 %250, %251
br i1 %252, label %253, label %263
253: ; preds = %249
%254 = load double, double* %29
%255 = load double*, double** %42
store double %254, double* %255
%256 = load i32, i32* %23
%257 = load double*, double** %42
%258 = sext i32 %256 to i64
%259 = getelementptr inbounds double, double* %257, i64 %258
store double* %259, double** %42
br label %260
260: ; preds = %253
%261 = load i32, i32* %38
%262 = add nsw i32 %261, 1
store i32 %262, i32* %38
br label %249
263: ; preds = %249
br label %264
264: ; preds = %263
%265 = load i32, i32* %39
%266 = add nsw i32 %265, 1
store i32 %266, i32* %39
%267 = load i32, i32* %15
%268 = load i32, i32* %24
%269 = add nsw i32 %268, %267
store i32 %269, i32* %24
%270 = load i32, i32* %14
%271 = load double*, double** %41
%272 = sext i32 %270 to i64
%273 = getelementptr inbounds double, double* %271, i64 %272
store double* %273, double** %41
br label %233
274: ; preds = %233
%275 = load double*, double** %17
store double* %275, double** %40
%276 = load double*, double** %18
store double* %276, double** %42
%277 = load double*, double** %19
store double* %277, double** %43
store i32 0, i32* %38
br label %278
278: ; preds = %475, %274
%279 = load i32, i32* %38
%280 = load i32, i32* %13
%281 = icmp slt i32 %279, %280
br i1 %281, label %282, label %482
282: ; preds = %278
%283 = load double*, double** %40
%284 = load double, double* %283
%285 = call i32 (double, double*, double*, ...) bitcast (i32 (...)* @sincosd to i32 (double, double*, double*, ...)*)(double %284, double* %31, double* %25)
%286 = load double, double* %25
%287 = load double*, double** %11
%288 = getelementptr inbounds double, double* %287, i64 3
%289 = load double, double* %288
%290 = fmul double %286, %289
store double %290, double* %26
%291 = load double, double* %25
%292 = load double*, double** %11
%293 = getelementptr inbounds double, double* %292, i64 4
%294 = load double, double* %293
%295 = fmul double %291, %294
store double %295, double* %27
%296 = load double, double* %31
%297 = load double*, double** %11
%298 = getelementptr inbounds double, double* %297, i64 3
%299 = load double, double* %298
%300 = fmul double %296, %299
store double %300, double* %32
%301 = load double, double* %31
%302 = load double*, double** %11
%303 = getelementptr inbounds double, double* %302, i64 4
%304 = load double, double* %303
%305 = fmul double %301, %304
store double %305, double* %33
store i32 0, i32* %39
br label %306
306: ; preds = %463, %282
%307 = load i32, i32* %39
%308 = load i32, i32* %22
%309 = icmp slt i32 %307, %308
br i1 %309, label %310, label %474
310: ; preds = %306
%311 = load double*, double** %42
%312 = load double, double* %311
store double %312, double* %29
%313 = load double, double* %29
%314 = call i32 (double, double*, double*, ...) bitcast (i32 (...)* @sincosd to i32 (double, double*, double*, ...)*)(double %313, double* %34, double* %28)
%315 = load double, double* %33
%316 = load double, double* %26
%317 = load double, double* %28
%318 = fneg double %316
%319 = call double @llvm.fmuladd.f64(double %318, double %317, double %315)
store double %319, double* %35
%320 = load double, double* %35
%321 = call double @llvm.fabs.f64(double %320)
%322 = fcmp olt double %321, 1.000000e-05
br i1 %322, label %323, label %337
323: ; preds = %310
%324 = load double*, double** %40
%325 = load double, double* %324
%326 = load double*, double** %11
%327 = getelementptr inbounds double, double* %326, i64 1
%328 = load double, double* %327
%329 = fadd double %325, %328
%330 = call i32 (double, ...) bitcast (i32 (...)* @cosd to i32 (double, ...)*)(double %329)
%331 = sub nsw i32 0, %330
%332 = sitofp i32 %331 to double
%333 = load double, double* %26
%334 = load double, double* %28
%335 = fsub double 1.000000e+00, %334
%336 = call double @llvm.fmuladd.f64(double %333, double %335, double %332)
store double %336, double* %35
br label %337
337: ; preds = %323, %310
%338 = load double, double* %25
%339 = fneg double %338
%340 = load double, double* %34
%341 = fmul double %339, %340
store double %341, double* %36
%342 = load double, double* %35
%343 = fcmp une double %342, 0.000000e+00
br i1 %343, label %347, label %344
344: ; preds = %337
%345 = load double, double* %36
%346 = fcmp une double %345, 0.000000e+00
br i1 %346, label %347, label %352
347: ; preds = %344, %337
%348 = load double, double* %36
%349 = load double, double* %35
%350 = call i32 (double, double, ...) bitcast (i32 (...)* @atan2d to i32 (double, double, ...)*)(double %348, double %349)
%351 = sitofp i32 %350 to double
store double %351, double* %30
br label %364
352: ; preds = %344
%353 = load double*, double** %11
%354 = getelementptr inbounds double, double* %353, i64 1
%355 = load double, double* %354
%356 = fcmp olt double %355, 9.000000e+01
br i1 %356, label %357, label %360
357: ; preds = %352
%358 = load double, double* %29
%359 = fsub double %358, 1.800000e+02
store double %359, double* %30
br label %363
360: ; preds = %352
%361 = load double, double* %29
%362 = fneg double %361
store double %362, double* %30
br label %363
363: ; preds = %360, %357
br label %364
364: ; preds = %363, %347
%365 = load double*, double** %11
%366 = getelementptr inbounds double, double* %365, i64 2
%367 = load double, double* %366
%368 = load double, double* %30
%369 = fadd double %367, %368
%370 = call double @fmod(double %369, double 3.600000e+02)
%371 = load double*, double** %42
store double %370, double* %371
%372 = load double*, double** %42
%373 = load double, double* %372
%374 = fcmp ogt double %373, 1.800000e+02
br i1 %374, label %375, label %379
375: ; preds = %364
%376 = load double*, double** %42
%377 = load double, double* %376
%378 = fsub double %377, 3.600000e+02
store double %378, double* %376
br label %388
379: ; preds = %364
%380 = load double*, double** %42
%381 = load double, double* %380
%382 = fcmp olt double %381, -1.800000e+02
br i1 %382, label %383, label %387
383: ; preds = %379
%384 = load double*, double** %42
%385 = load double, double* %384
%386 = fadd double %385, 3.600000e+02
store double %386, double* %384
br label %387
387: ; preds = %383, %379
br label %388
388: ; preds = %387, %375
%389 = load double, double* %29
%390 = call double @fmod(double %389, double 1.800000e+02)
%391 = fcmp oeq double %390, 0.000000e+00
br i1 %391, label %392, label %419
392: ; preds = %388
%393 = load double*, double** %40
%394 = load double, double* %393
%395 = load double, double* %28
%396 = load double*, double** %11
%397 = getelementptr inbounds double, double* %396, i64 1
%398 = load double, double* %397
%399 = call double @llvm.fmuladd.f64(double %395, double %398, double %394)
%400 = load double*, double** %43
store double %399, double* %400
%401 = load double*, double** %43
%402 = load double, double* %401
%403 = fcmp ogt double %402, 9.000000e+01
br i1 %403, label %404, label %409
404: ; preds = %392
%405 = load double*, double** %43
%406 = load double, double* %405
%407 = fsub double 1.800000e+02, %406
%408 = load double*, double** %43
store double %407, double* %408
br label %409
409: ; preds = %404, %392
%410 = load double*, double** %43
%411 = load double, double* %410
%412 = fcmp olt double %411, -9.000000e+01
br i1 %412, label %413, label %418
413: ; preds = %409
%414 = load double*, double** %43
%415 = load double, double* %414
%416 = fsub double -1.800000e+02, %415
%417 = load double*, double** %43
store double %416, double* %417
br label %418
418: ; preds = %413, %409
br label %462
419: ; preds = %388
%420 = load double, double* %32
%421 = load double, double* %27
%422 = load double, double* %28
%423 = call double @llvm.fmuladd.f64(double %421, double %422, double %420)
store double %423, double* %37
%424 = load double, double* %37
%425 = call double @llvm.fabs.f64(double %424)
%426 = fcmp ogt double %425, 0x3FEFAE147AE147AE
br i1 %426, label %427, label %456
427: ; preds = %419
%428 = load double, double* %37
%429 = fcmp olt double %428, 0.000000e+00
br i1 %429, label %430, label %442
430: ; preds = %427
%431 = load double, double* %35
%432 = load double, double* %35
%433 = load double, double* %36
%434 = load double, double* %36
%435 = fmul double %433, %434
%436 = call double @llvm.fmuladd.f64(double %431, double %432, double %435)
%437 = call double @sqrt(double %436)
%438 = call i32 (double, ...) bitcast (i32 (...)* @acosd to i32 (double, ...)*)(double %437)
%439 = sitofp i32 %438 to double
%440 = call double @llvm.fabs.f64(double %439)
%441 = fneg double %440
br label %453
442: ; preds = %427
%443 = load double, double* %35
%444 = load double, double* %35
%445 = load double, double* %36
%446 = load double, double* %36
%447 = fmul double %445, %446
%448 = call double @llvm.fmuladd.f64(double %443, double %444, double %447)
%449 = call double @sqrt(double %448)
%450 = call i32 (double, ...) bitcast (i32 (...)* @acosd to i32 (double, ...)*)(double %449)
%451 = sitofp i32 %450 to double
%452 = call double @llvm.fabs.f64(double %451)
br label %453
453: ; preds = %442, %430
%454 = phi double [ %441, %430 ], [ %452, %442 ]
%455 = load double*, double** %43
store double %454, double* %455
br label %461
456: ; preds = %419
%457 = load double, double* %37
%458 = call i32 (double, ...) bitcast (i32 (...)* @asind to i32 (double, ...)*)(double %457)
%459 = sitofp i32 %458 to double
%460 = load double*, double** %43
store double %459, double* %460
br label %461
461: ; preds = %456, %453
br label %462
462: ; preds = %461, %418
br label %463
463: ; preds = %462
%464 = load i32, i32* %39
%465 = add nsw i32 %464, 1
store i32 %465, i32* %39
%466 = load i32, i32* %15
%467 = load double*, double** %42
%468 = sext i32 %466 to i64
%469 = getelementptr inbounds double, double* %467, i64 %468
store double* %469, double** %42
%470 = load i32, i32* %15
%471 = load double*, double** %43
%472 = sext i32 %470 to i64
%473 = getelementptr inbounds double, double* %471, i64 %472
store double* %473, double** %43
br label %306
474: ; preds = %306
br label %475
475: ; preds = %474
%476 = load i32, i32* %38
%477 = add nsw i32 %476, 1
store i32 %477, i32* %38
%478 = load i32, i32* %14
%479 = load double*, double** %40
%480 = sext i32 %478 to i64
%481 = getelementptr inbounds double, double* %479, i64 %480
store double* %481, double** %40
br label %278
482: ; preds = %278
store i32 0, i32* %10
br label %483
483: ; preds = %482, %227
%484 = load i32, i32* %10
ret i32 %484
}

LLVM IR (-O2):
define i32 @sphs2x(double* nocapture %0, i32 %1, i32 %2, i32 %3, i32 %4, double* nocapture %5, double* nocapture %6, double* nocapture %7, double* nocapture writeonly %8) {
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = bitcast double* %10 to i8*
%15 = bitcast double* %11 to i8*
%16 = bitcast double* %12 to i8*
%17 = bitcast double* %13 to i8*
%18 = icmp sgt i32 %2, 0
%19 = select i1 %18, i32 %1, i32 1
%20 = select i1 %18, i32 %2, i32 %1
%21 = getelementptr inbounds double, double* %0, i64 4
%22 = load double, double* %21
%23 = fcmp oeq double %22, 0.000000e+00
br i1 %23, label %24, label %134
24: ; preds = %9
%25 = getelementptr inbounds double, double* %0, i64 1
%26 = load double, double* %25
%27 = fcmp oeq double %26, 0.000000e+00
%28 = getelementptr inbounds double, double* %0, i64 2
%29 = load double, double* %28
br i1 %27, label %30, label %82
30: ; preds = %24
%31 = fadd double %29, -1.800000e+02
%32 = load double, double* %0
%33 = fsub double %31, %32
%34 = tail call double @fmod(double %33, double 3.600000e+02)
%35 = icmp sgt i32 %20, 0
br i1 %35, label %36, label %303
36: ; preds = %30
%37 = icmp sgt i32 %19, 0
%38 = sext i32 %4 to i64
%39 = sext i32 %3 to i64
br label %40
40: ; preds = %36, %75
%41 = phi double* [ %8, %36 ], [ %78, %75 ]
%42 = phi double* [ %7, %36 ], [ %77, %75 ]
%43 = phi double* [ %6, %36 ], [ %80, %75 ]
%44 = phi i32 [ 0, %36 ], [ %79, %75 ]
%45 = phi i32 [ 0, %36 ], [ %76, %75 ]
br i1 %37, label %46, label %75
46: ; preds = %40
%47 = srem i32 %45, %1
%48 = mul nsw i32 %47, %3
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %5, i64 %49
br label %51
51: ; preds = %46, %67
%52 = phi double* [ %69, %67 ], [ %41, %46 ]
%53 = phi double* [ %68, %67 ], [ %42, %46 ]
%54 = phi double* [ %71, %67 ], [ %50, %46 ]
%55 = phi i32 [ %70, %67 ], [ 0, %46 ]
%56 = load double, double* %54
%57 = fadd double %34, %56
%58 = tail call double @fmod(double %57, double 3.600000e+02)
store double %58, double* %53
%59 = load double, double* %43
store double %59, double* %52
%60 = load double, double* %53
%61 = fcmp ogt double %60, 1.800000e+02
br i1 %61, label %64, label %62
62: ; preds = %51
%63 = fcmp olt double %60, -1.800000e+02
br i1 %63, label %64, label %67
64: ; preds = %62, %51
%65 = phi double [ -3.600000e+02, %51 ], [ 3.600000e+02, %62 ]
%66 = fadd double %60, %65
store double %66, double* %53
br label %67
67: ; preds = %64, %62
%68 = getelementptr inbounds double, double* %53, i64 %38
%69 = getelementptr inbounds double, double* %52, i64 %38
%70 = add nuw nsw i32 %55, 1
%71 = getelementptr inbounds double, double* %54, i64 %39
%72 = icmp eq i32 %70, %19
br i1 %72, label %73, label %51
73: ; preds = %67
%74 = add i32 %45, %19
br label %75
75: ; preds = %73, %40
%76 = phi i32 [ %45, %40 ], [ %74, %73 ]
%77 = phi double* [ %42, %40 ], [ %68, %73 ]
%78 = phi double* [ %41, %40 ], [ %69, %73 ]
%79 = add nuw nsw i32 %44, 1
%80 = getelementptr inbounds double, double* %43, i64 %39
%81 = icmp eq i32 %79, %20
br i1 %81, label %303, label %40
82: ; preds = %24
%83 = load double, double* %0
%84 = fadd double %29, %83
%85 = tail call double @fmod(double %84, double 3.600000e+02)
%86 = icmp sgt i32 %20, 0
br i1 %86, label %87, label %303
87: ; preds = %82
%88 = icmp sgt i32 %19, 0
%89 = sext i32 %4 to i64
%90 = sext i32 %3 to i64
br label %91
91: ; preds = %87, %127
%92 = phi double* [ %8, %87 ], [ %130, %127 ]
%93 = phi double* [ %7, %87 ], [ %129, %127 ]
%94 = phi double* [ %6, %87 ], [ %132, %127 ]
%95 = phi i32 [ 0, %87 ], [ %131, %127 ]
%96 = phi i32 [ 0, %87 ], [ %128, %127 ]
br i1 %88, label %97, label %127
97: ; preds = %91
%98 = srem i32 %96, %1
%99 = mul nsw i32 %98, %3
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds double, double* %5, i64 %100
br label %102
102: ; preds = %97, %119
%103 = phi double* [ %121, %119 ], [ %92, %97 ]
%104 = phi double* [ %120, %119 ], [ %93, %97 ]
%105 = phi double* [ %123, %119 ], [ %101, %97 ]
%106 = phi i32 [ %122, %119 ], [ 0, %97 ]
%107 = load double, double* %105
%108 = fsub double %85, %107
%109 = tail call double @fmod(double %108, double 3.600000e+02)
store double %109, double* %104
%110 = load double, double* %94
%111 = fneg double %110
store double %111, double* %103
%112 = load double, double* %104
%113 = fcmp ogt double %112, 1.800000e+02
br i1 %113, label %116, label %114
114: ; preds = %102
%115 = fcmp olt double %112, -1.800000e+02
br i1 %115, label %116, label %119
116: ; preds = %114, %102
%117 = phi double [ -3.600000e+02, %102 ], [ 3.600000e+02, %114 ]
%118 = fadd double %112, %117
store double %118, double* %104
br label %119
119: ; preds = %116, %114
%120 = getelementptr inbounds double, double* %104, i64 %89
%121 = getelementptr inbounds double, double* %103, i64 %89
%122 = add nuw nsw i32 %106, 1
%123 = getelementptr inbounds double, double* %105, i64 %90
%124 = icmp eq i32 %122, %19
br i1 %124, label %125, label %102
125: ; preds = %119
%126 = add i32 %96, %19
br label %127
127: ; preds = %125, %91
%128 = phi i32 [ %96, %91 ], [ %126, %125 ]
%129 = phi double* [ %93, %91 ], [ %120, %125 ]
%130 = phi double* [ %92, %91 ], [ %121, %125 ]
%131 = add nuw nsw i32 %95, 1
%132 = getelementptr inbounds double, double* %94, i64 %90
%133 = icmp eq i32 %131, %20
br i1 %133, label %303, label %91
134: ; preds = %9
%135 = icmp sgt i32 %1, 0
br i1 %135, label %136, label %148
136: ; preds = %134
%137 = mul nsw i32 %4, %1
%138 = sext i32 %137 to i64
%139 = sext i32 %3 to i64
%140 = tail call i32 @llvm.smax.i32(i32 %2, i32 1)
%141 = select i1 %18, i32 %140, i32 1
%142 = sext i32 %4 to i64
%143 = add nsw i32 %141, -1
%144 = and i32 %141, 7
%145 = icmp ult i32 %143, 7
%146 = and i32 %141, 2147483640
%147 = icmp eq i32 %144, 0
br label %157
148: ; preds = %186, %134
%149 = icmp sgt i32 %20, 0
br i1 %149, label %150, label %303
150: ; preds = %148
%151 = getelementptr inbounds double, double* %0, i64 3
%152 = icmp sgt i32 %19, 0
%153 = getelementptr inbounds double, double* %0, i64 1
%154 = getelementptr inbounds double, double* %0, i64 2
%155 = sext i32 %4 to i64
%156 = sext i32 %3 to i64
br label %191
157: ; preds = %136, %186
%158 = phi i64 [ 0, %136 ], [ %188, %186 ]
%159 = phi double* [ %5, %136 ], [ %189, %186 ]
%160 = phi i32 [ 0, %136 ], [ %187, %186 ]
%161 = load double, double* %159
%162 = load double, double* %0
%163 = fsub double %161, %162
%164 = getelementptr inbounds double, double* %7, i64 %158
br i1 %145, label %178, label %165
165: ; preds = %157, %165
%166 = phi double* [ %175, %165 ], [ %164, %157 ]
%167 = phi i32 [ %176, %165 ], [ 0, %157 ]
store double %163, double* %166
%168 = getelementptr inbounds double, double* %166, i64 %138
store double %163, double* %168
%169 = getelementptr inbounds double, double* %168, i64 %138
store double %163, double* %169
%170 = getelementptr inbounds double, double* %169, i64 %138
store double %163, double* %170
%171 = getelementptr inbounds double, double* %170, i64 %138
store double %163, double* %171
%172 = getelementptr inbounds double, double* %171, i64 %138
store double %163, double* %172
%173 = getelementptr inbounds double, double* %172, i64 %138
store double %163, double* %173
%174 = getelementptr inbounds double, double* %173, i64 %138
store double %163, double* %174
%175 = getelementptr inbounds double, double* %174, i64 %138
%176 = add i32 %167, 8
%177 = icmp eq i32 %176, %146
br i1 %177, label %178, label %165
178: ; preds = %165, %157
%179 = phi double* [ %164, %157 ], [ %175, %165 ]
br i1 %147, label %186, label %180
180: ; preds = %178, %180
%181 = phi double* [ %183, %180 ], [ %179, %178 ]
%182 = phi i32 [ %184, %180 ], [ 0, %178 ]
store double %163, double* %181
%183 = getelementptr inbounds double, double* %181, i64 %138
%184 = add i32 %182, 1
%185 = icmp eq i32 %184, %144
br i1 %185, label %186, label %180
186: ; preds = %180, %178
%187 = add nuw nsw i32 %160, 1
%188 = add nsw i64 %158, %142
%189 = getelementptr inbounds double, double* %159, i64 %139
%190 = icmp eq i32 %187, %1
br i1 %190, label %148, label %157
191: ; preds = %150, %297
%192 = phi double* [ %8, %150 ], [ %299, %297 ]
%193 = phi double* [ %7, %150 ], [ %298, %297 ]
%194 = phi double* [ %6, %150 ], [ %301, %297 ]
%195 = phi i32 [ 0, %150 ], [ %300, %297 ]
%196 = load double, double* %194
%197 = call i32 (double, double*, double*, ...) bitcast (i32 (...)* @sincosd to i32 (double, double*, double*, ...)*)(double %196, double* %12, double* %10)
%198 = load double, double* %10
%199 = load double, double* %151
%200 = fmul double %198, %199
%201 = load double, double* %21
%202 = fmul double %198, %201
%203 = load double, double* %12
%204 = fmul double %199, %203
%205 = fmul double %201, %203
br i1 %152, label %206, label %297
206: ; preds = %191
%207 = fneg double %200
br label %208
208: ; preds = %206, %292
%209 = phi double* [ %192, %206 ], [ %295, %292 ]
%210 = phi double* [ %193, %206 ], [ %294, %292 ]
%211 = phi i32 [ 0, %206 ], [ %293, %292 ]
%212 = load double, double* %210
%213 = call i32 (double, double*, double*, ...) bitcast (i32 (...)* @sincosd to i32 (double, double*, double*, ...)*)(double %212, double* %13, double* %11)
%214 = load double, double* %11
%215 = call double @llvm.fmuladd.f64(double %207, double %214, double %205)
%216 = call double @llvm.fabs.f64(double %215)
%217 = fcmp olt double %216, 1.000000e-05
br i1 %217, label %218, label %228
218: ; preds = %208
%219 = load double, double* %194
%220 = load double, double* %153
%221 = fadd double %219, %220
%222 = call i32 (double, ...) bitcast (i32 (...)* @cosd to i32 (double, ...)*)(double %221)
%223 = sub nsw i32 0, %222
%224 = sitofp i32 %223 to double
%225 = load double, double* %11
%226 = fsub double 1.000000e+00, %225
%227 = call double @llvm.fmuladd.f64(double %200, double %226, double %224)
br label %228
228: ; preds = %218, %208
%229 = phi double [ %227, %218 ], [ %215, %208 ]
%230 = load double, double* %10
%231 = fneg double %230
%232 = load double, double* %13
%233 = fmul double %232, %231
%234 = fcmp une double %229, 0.000000e+00
%235 = fcmp une double %233, 0.000000e+00
%236 = select i1 %234, i1 true, i1 %235
br i1 %236, label %237, label %240
237: ; preds = %228
%238 = call i32 (double, double, ...) bitcast (i32 (...)* @atan2d to i32 (double, double, ...)*)(double %233, double %229)
%239 = sitofp i32 %238 to double
br label %247
240: ; preds = %228
%241 = load double, double* %153
%242 = fcmp olt double %241, 9.000000e+01
br i1 %242, label %243, label %245
243: ; preds = %240
%244 = fadd double %212, -1.800000e+02
br label %247
245: ; preds = %240
%246 = fneg double %212
br label %247
247: ; preds = %243, %245, %237
%248 = phi double [ %239, %237 ], [ %244, %243 ], [ %246, %245 ]
%249 = load double, double* %154
%250 = fadd double %248, %249
%251 = call double @fmod(double %250, double 3.600000e+02)
store double %251, double* %210
%252 = fcmp ogt double %251, 1.800000e+02
br i1 %252, label %255, label %253
253: ; preds = %247
%254 = fcmp olt double %251, -1.800000e+02
br i1 %254, label %255, label %258
255: ; preds = %253, %247
%256 = phi double [ -3.600000e+02, %247 ], [ 3.600000e+02, %253 ]
%257 = fadd double %251, %256
store double %257, double* %210
br label %258
258: ; preds = %255, %253
%259 = call double @fmod(double %212, double 1.800000e+02)
%260 = fcmp oeq double %259, 0.000000e+00
br i1 %260, label %261, label %272
261: ; preds = %258
%262 = load double, double* %194
%263 = load double, double* %11
%264 = load double, double* %153
%265 = call double @llvm.fmuladd.f64(double %263, double %264, double %262)
%266 = fcmp ogt double %265, 9.000000e+01
%267 = fsub double 1.800000e+02, %265
%268 = select i1 %266, double %267, double %265
store double %268, double* %209
%269 = fcmp olt double %268, -9.000000e+01
br i1 %269, label %270, label %292
270: ; preds = %261
%271 = fsub double -1.800000e+02, %268
br label %290
272: ; preds = %258
%273 = load double, double* %11
%274 = call double @llvm.fmuladd.f64(double %202, double %273, double %204)
%275 = call double @llvm.fabs.f64(double %274)
%276 = fcmp ogt double %275, 0x3FEFAE147AE147AE
br i1 %276, label %277, label %287
277: ; preds = %272
%278 = fcmp olt double %274, 0.000000e+00
%279 = fmul double %233, %233
%280 = call double @llvm.fmuladd.f64(double %229, double %229, double %279)
%281 = call double @sqrt(double %280)
%282 = call i32 (double, ...) bitcast (i32 (...)* @acosd to i32 (double, ...)*)(double %281)
%283 = sitofp i32 %282 to double
%284 = call double @llvm.fabs.f64(double %283)
%285 = fneg double %284
%286 = select i1 %278, double %285, double %284
br label %290
287: ; preds = %272
%288 = call i32 (double, ...) bitcast (i32 (...)* @asind to i32 (double, ...)*)(double %274)
%289 = sitofp i32 %288 to double
br label %290
290: ; preds = %277, %287, %270
%291 = phi double [ %271, %270 ], [ %289, %287 ], [ %286, %277 ]
store double %291, double* %209
br label %292
292: ; preds = %290, %261
%293 = add nuw nsw i32 %211, 1
%294 = getelementptr inbounds double, double* %210, i64 %155
%295 = getelementptr inbounds double, double* %209, i64 %155
%296 = icmp eq i32 %293, %19
br i1 %296, label %297, label %208
297: ; preds = %292, %191
%298 = phi double* [ %193, %191 ], [ %294, %292 ]
%299 = phi double* [ %192, %191 ], [ %295, %292 ]
%300 = add nuw nsw i32 %195, 1
%301 = getelementptr inbounds double, double* %194, i64 %156
%302 = icmp eq i32 %300, %20
br i1 %302, label %303, label %191
303: ; preds = %297, %127, %75, %148, %82, %30
ret i32 0
}