#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double asin(double);
int locate(double *, int, double);
double sqrt(double);
double calc_phase_squared(int nphase, int lu, double ctheta, int nf,
                          double *mu_phase, double *phas2, double *mu_eq,
                          int *neg_phas, double norm_phas) {
  int j = 0, k = 0, it = 0;
  double pspike2 = 0.0, stheta = 0.0;
  double smueq = 0.0, phint = 0.0;
  double mumin = 0.0, mumax = 0.0;
  int imin = 0, imax = 0;
  double D = 0.0, C = 0.0, Dp = 0.0, Cp = 0.0;
  int cutting = 0;
  stheta = sqrt(1.0 - ctheta * ctheta);
  for (j = 1; j <= nf; j++) {
    if (ctheta == 1.0 || mu_eq[j - 1 + (lu - 1) * nf] == 1.0) {
      it = locate(mu_phase, nphase, mu_eq[j - 1 + (lu - 1) * nf] * ctheta) + 1;
      phint = 3.14159265358979323846 *
              (phas2[it - 1 + (lu - 1) * nphase] +
               (mu_eq[j - 1 + (lu - 1) * nf] * ctheta - mu_phase[it - 1]) /
                   (mu_phase[it + 1 - 1] - mu_phase[it - 1]) *
                   (phas2[it + 1 - 1 + (lu - 1) * nphase] -
                    phas2[it - 1 + (lu - 1) * nphase]));
      if (ctheta == 1.0)
        phint /= 2.0;
    } else {
      phint = 0.0;
      smueq = sqrt(1. -
                   mu_eq[j - 1 + (lu - 1) * nf] * mu_eq[j - 1 + (lu - 1) * nf]);
      mumin = ctheta * mu_eq[j - 1 + (lu - 1) * nf] - stheta * smueq;
      mumax = ctheta * mu_eq[j - 1 + (lu - 1) * nf] + stheta * smueq;
      if (mu_eq[j - 1 + (lu - 1) * nf] < mumax) {
        mumax = mu_eq[j - 1 + (lu - 1) * nf];
        cutting = 1;
      } else
        cutting = 0;
      if (mumin < mumax) {
        imin = locate(mu_phase, nphase, mumin) + 1;
        imax = locate(mu_phase, nphase, mumax) + 1;
        k = imin;
        D = (phas2[k + 1 - 1 + (lu - 1) * nphase] -
             phas2[k - 1 + (lu - 1) * nphase]) /
            (mu_phase[k + 1 - 1] - mu_phase[k - 1]);
        C = phas2[k - 1 + (lu - 1) * nphase] - mu_phase[k - 1] * D;
        phint += (D * ctheta * mu_eq[j - 1 + (lu - 1) * nf] + C) *
                 3.14159265358979323846 / 2.0;
        for (k = imin + 1; k <= imax; k++) {
          Dp = (phas2[k + 1 - 1 + (lu - 1) * nphase] -
                phas2[k - 1 + (lu - 1) * nphase]) /
               (mu_phase[k + 1 - 1] - mu_phase[k - 1]);
          Cp = phas2[k - 1 + (lu - 1) * nphase] - mu_phase[k - 1] * Dp;
          phint += (Dp - D) * sqrt(1.0 - ctheta * ctheta -
                                   mu_eq[j - 1 + (lu - 1) * nf] *
                                       mu_eq[j - 1 + (lu - 1) * nf] +
                                   2.0 * ctheta * mu_eq[j - 1 + (lu - 1) * nf] *
                                       mu_phase[k - 1] -
                                   mu_phase[k - 1] * mu_phase[k - 1]) +
                   ((Dp - D) * ctheta * mu_eq[j - 1 + (lu - 1) * nf] + Cp - C) *
                       asin((ctheta * mu_eq[j - 1 + (lu - 1) * nf] -
                             mu_phase[k - 1]) /
                            (smueq * stheta));
          D = Dp;
          C = Cp;
        }
        if (cutting == 1)
          phint +=
              -D * sqrt(1.0 - ctheta * ctheta +
                        2.0 * mu_eq[j - 1 + (lu - 1) * nf] *
                            mu_eq[j - 1 + (lu - 1) * nf] * (ctheta - 1.0)) -
              (D * ctheta * mu_eq[j - 1 + (lu - 1) * nf] + C) *
                  asin((ctheta - 1.0) * mu_eq[j - 1 + (lu - 1) * nf] /
                       (smueq * stheta));
        else
          phint += (D * ctheta * mu_eq[j - 1 + (lu - 1) * nf] + C) *
                   3.14159265358979323846 / 2.0;
      }
    }
    if (j == 1 || j == nf) {
      if (neg_phas[j - 1 + (lu - 1) * nf] == 1)
        pspike2 = pspike2 - 0.5 * phint;
      else
        pspike2 = pspike2 + 0.5 * phint;
    } else {
      if (neg_phas[j - 1 + (lu - 1) * nf] == 1)
        pspike2 = pspike2 - phint;
      else
        pspike2 = pspike2 + phint;
    }
  }
  pspike2 *= norm_phas;
  return pspike2;
}


x86 assembly (clang, -O0):
<calc_phase_squared>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movsd  %xmm1,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
movl   $0x0,-0x7c(%rbp)
movl   $0x0,-0x80(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movl   $0x0,-0xa4(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xdec(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x58(%rbp)
movl   $0x1,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1ced <calc_phase_squared+0xbbd>
movsd  -0x10(%rbp),%xmm0
movsd  0xdbe(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1257 <calc_phase_squared+0x127>
jp     1257 <calc_phase_squared+0x127>
jmp    128d <calc_phase_squared+0x15d>
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xd83(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    13ef <calc_phase_squared+0x2bf>
jp     13ef <calc_phase_squared+0x2bf>
mov    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1030 <locate@plt>
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x4(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x10(%rbp),%xmm3
mov    -0x20(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mov    -0x20(%rbp),%rax
mov    -0x44(%rbp),%ecx
add    $0x1,%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x20(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
divsd  %xmm2,%xmm1
mov    -0x28(%rbp),%rax
mov    -0x44(%rbp),%ecx
add    $0x1,%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x4(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x28(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x4(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xc62(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xc3c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    13ea <calc_phase_squared+0x2ba>
jp     13ea <calc_phase_squared+0x2ba>
movsd  -0x68(%rbp),%xmm0
movsd  0xc27(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    1c0e <calc_phase_squared+0xade>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xbaa(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x78(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    154e <calc_phase_squared+0x41e>
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x78(%rbp)
movl   $0x1,-0xa4(%rbp)
jmp    1558 <calc_phase_squared+0x428>
movl   $0x0,-0xa4(%rbp)
movsd  -0x70(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1c09 <calc_phase_squared+0xad9>
mov    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%esi
movsd  -0x70(%rbp),%xmm0
call   1030 <locate@plt>
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%esi
movsd  -0x78(%rbp),%xmm0
call   1030 <locate@plt>
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
mov    -0x7c(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%ecx
add    $0x1,%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x4(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x4(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%ecx
add    $0x1,%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x4(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x88(%rbp),%xmm2
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
mulsd  -0x10(%rbp),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x90(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0x95c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x948(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x80(%rbp),%eax
jg     1a06 <calc_phase_squared+0x8d6>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%ecx
add    $0x1,%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x4(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x4(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%ecx
add    $0x1,%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x4(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x98(%rbp),%xmm2
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
subsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x10(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm0,%xmm1
movsd  0x807(%rip),%xmm0
addsd  %xmm0,%xmm1
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0x7a8(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
subsd  -0x88(%rbp),%xmm0
ff
mulsd  -0x10(%rbp),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0xa0(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x60(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1040 <asin@plt>
movsd  -0xc0(%rbp),%xmm1
ff
movsd  -0xb8(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    16d7 <calc_phase_squared+0x5a7>
cmpl   $0x1,-0xa4(%rbp)
jne    1ba7 <calc_phase_squared+0xa77>
movsd  -0x88(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x10(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm0,%xmm1
movsd  0x599(%rip),%xmm0
addsd  %xmm0,%xmm1
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  0x57c(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  0x544(%rip),%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
mulsd  -0x10(%rbp),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x90(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movsd  0x4db(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  -0x60(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1040 <asin@plt>
movsd  -0xd8(%rbp),%xmm1
ff
movsd  -0xd0(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xc8(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    1c04 <calc_phase_squared+0xad4>
movsd  -0x88(%rbp),%xmm0
ff
mulsd  -0x10(%rbp),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x90(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0x426(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x412(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    1c09 <calc_phase_squared+0xad9>
jmp    1c0e <calc_phase_squared+0xade>
cmpl   $0x1,-0x3c(%rbp)
je     1c24 <calc_phase_squared+0xaf4>
mov    -0x3c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1c8f <calc_phase_squared+0xb5f>
mov    0x10(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    1c6b <calc_phase_squared+0xb3b>
movsd  -0x50(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm0
movsd  0x3c7(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1c8a <calc_phase_squared+0xb5a>
movsd  -0x50(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm0
movsd  0x39b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1cda <calc_phase_squared+0xbaa>
mov    0x10(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    1cc6 <calc_phase_squared+0xb96>
movsd  -0x50(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1cd5 <calc_phase_squared+0xba5>
movsd  -0x50(%rbp),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1cda <calc_phase_squared+0xbaa>
jmp    1cdf <calc_phase_squared+0xbaf>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1229 <calc_phase_squared+0xf9>
movsd  -0x38(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_phase_squared>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
movsd  %xmm1,0xb0(%rsp)
mov    %r9,%r15
mov    %r8,%rbp
mov    %rcx,%rbx
mov    %edx,%r12d
movapd %xmm0,%xmm2
mov    %esi,%r14d
mov    %edi,0x14(%rsp)
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xe8f(%rip),%xmm4
movapd %xmm4,%xmm0
subsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
movsd  %xmm2,(%rsp)
movsd  %xmm0,0x98(%rsp)
jb     1197 <calc_phase_squared+0x67>
sqrtsd %xmm0,%xmm0
jmp    11a9 <calc_phase_squared+0x79>
call   1050 <sqrt@plt>
movsd  0xe5c(%rip),%xmm4
movsd  (%rsp),%xmm2
movsd  %xmm0,0x80(%rsp)
test   %r12d,%r12d
xorpd  %xmm0,%xmm0
jle    179f <calc_phase_squared+0x66f>
add    $0xffffffff,%r14d
mov    %r14d,%eax
imul   %r12d,%eax
imul   0x14(%rsp),%r14d
movapd %xmm2,%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,0xe0(%rsp)
movsd  0xe1f(%rip),%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,0x60(%rsp)
mov    %r14,%rcx
mov    %r14,0x90(%rsp)
movslq %r14d,%rcx
mov    %r12d,%edx
mov    %rdx,0xb8(%rsp)
movslq %eax,%rdx
add    $0x1,%r12d
mov    %rcx,0x88(%rsp)
lea    0x0(,%rcx,8),%rax
add    %rbp,%rax
mov    %rax,0xd8(%rsp)
mov    $0x1,%r14d
xorpd  %xmm0,%xmm0
mov    %rbp,0xa8(%rsp)
mov    %r12,0x68(%rsp)
mov    %rdx,0xc0(%rsp)
jmp    126f <calc_phase_squared+0x13f>
nop
mulsd  0xdc0(%rip),%xmm3
movsd  0x28(%rsp),%xmm0
addsd  %xmm3,%xmm0
add    $0x1,%r14
cmp    %r12,%r14
je     179f <calc_phase_squared+0x66f>
ucomisd %xmm4,%xmm2
lea    -0x1(%r14,%rdx,1),%r13
movsd  %xmm0,0x28(%rsp)
jne    1282 <calc_phase_squared+0x152>
jnp    1298 <calc_phase_squared+0x168>
movsd  (%r15,%r13,8),%xmm1
ucomisd %xmm4,%xmm1
jne    1386 <calc_phase_squared+0x256>
jp     1386 <calc_phase_squared+0x256>
movsd  (%r15,%r13,8),%xmm0
mulsd  %xmm2,%xmm0
mov    %rbx,%rdi
mov    0x14(%rsp),%esi
call   1030 <locate@plt>
movsd  0xd4a(%rip),%xmm4
mov    0x90(%rsp),%rcx
add    %eax,%ecx
movsd  (%rsp),%xmm2
ucomisd %xmm4,%xmm2
movslq %ecx,%rcx
movsd  0x0(%rbp,%rcx,8),%xmm0
cltq
movsd  (%r15,%r13,8),%xmm1
mulsd  %xmm2,%xmm1
movsd  (%rbx,%rax,8),%xmm2
movsd  0x8(%rbx,%rax,8),%xmm3
subsd  %xmm2,%xmm1
subsd  %xmm2,%xmm3
divsd  %xmm3,%xmm1
mov    0x88(%rsp),%rcx
lea    0x1(%rax,%rcx,1),%eax
cltq
movsd  0x0(%rbp,%rax,8),%xmm3
subsd  %xmm0,%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm0,%xmm3
mulsd  0xcf3(%rip),%xmm3
jne    1329 <calc_phase_squared+0x1f9>
jp     1329 <calc_phase_squared+0x1f9>
mulsd  0xcef(%rip),%xmm3
movsd  (%rsp),%xmm2
mov    0xc0(%rsp),%rdx
lea    (%r14,%rdx,1),%rax
mov    0x120(%rsp),%rcx
mov    -0x4(%rcx,%rax,4),%eax
cmp    $0x1,%r14
je     1370 <calc_phase_squared+0x240>
cmp    0xb8(%rsp),%r14
je     1370 <calc_phase_squared+0x240>
cmp    $0x1,%eax
jne    1258 <calc_phase_squared+0x128>
movsd  0x28(%rsp),%xmm0
subsd  %xmm3,%xmm0
jmp    1262 <calc_phase_squared+0x132>
xchg   %ax,%ax
cmp    $0x1,%eax
jne    1250 <calc_phase_squared+0x120>
mulsd  0xc9f(%rip),%xmm3
jmp    1258 <calc_phase_squared+0x128>
mulsd  %xmm1,%xmm1
movapd %xmm4,%xmm0
subsd  %xmm1,%xmm0
ucomisd 0xc8e(%rip),%xmm0
jb     13a5 <calc_phase_squared+0x275>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    13bb <calc_phase_squared+0x28b>
call   1050 <sqrt@plt>
movsd  0xc4e(%rip),%xmm4
movsd  (%rsp),%xmm2
movapd %xmm0,%xmm1
mulsd  0x80(%rsp),%xmm1
movsd  (%r15,%r13,8),%xmm5
movapd %xmm2,%xmm6
mulsd  %xmm5,%xmm6
movapd %xmm6,%xmm0
subsd  %xmm1,%xmm0
addsd  %xmm1,%xmm6
movapd %xmm5,%xmm7
minsd  %xmm6,%xmm7
xorpd  %xmm3,%xmm3
ucomisd %xmm0,%xmm7
jbe    132e <calc_phase_squared+0x1fe>
movsd  %xmm6,0x70(%rsp)
movsd  %xmm5,0x78(%rsp)
movsd  %xmm1,0x20(%rsp)
mov    %rbx,%rdi
mov    0x14(%rsp),%r12d
mov    %r12d,%esi
movsd  %xmm7,0x8(%rsp)
call   1030 <locate@plt>
mov    %rax,0x30(%rsp)
mov    %rbx,%rdi
mov    %r12d,%esi
movsd  0x8(%rsp),%xmm0
call   1030 <locate@plt>
mov    0x30(%rsp),%rdx
movsd  (%rsp),%xmm2
mov    0x88(%rsp),%rcx
add    %edx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  0x0(%rbp,%rcx,8),%xmm9
mov    0x90(%rsp),%rcx
lea    (%rdx,%rcx,1),%ecx
movslq %ecx,%rcx
movsd  0x0(%rbp,%rcx,8),%xmm8
subsd  %xmm8,%xmm9
movslq %edx,%rcx
movsd  (%rbx,%rcx,8),%xmm0
movsd  0x8(%rbx,%rcx,8),%xmm1
subsd  %xmm0,%xmm1
divsd  %xmm1,%xmm9
mulsd  %xmm9,%xmm0
subsd  %xmm0,%xmm8
movapd %xmm9,%xmm3
mulsd  %xmm2,%xmm3
movsd  (%r15,%r13,8),%xmm1
mulsd  %xmm1,%xmm3
addsd  %xmm8,%xmm3
mulsd  0xb62(%rip),%xmm3
mulsd  0xb62(%rip),%xmm3
addsd  0xb6a(%rip),%xmm3
cmp    %eax,%ecx
jge    1659 <calc_phase_squared+0x529>
add    $0x2,%edx
movslq %edx,%rbp
movslq %eax,%r12
nop
mov    0xd8(%rsp),%rax
movsd  -0x8(%rax,%rbp,8),%xmm4
movsd  (%rax,%rbp,8),%xmm7
movsd  -0x8(%rbx,%rbp,8),%xmm6
movsd  (%rbx,%rbp,8),%xmm5
movsd  0xe0(%rsp),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm1
movsd  0x98(%rsp),%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm6,%xmm0
addsd  %xmm2,%xmm0
movapd %xmm6,%xmm1
mulsd  %xmm6,%xmm1
subsd  %xmm1,%xmm0
ucomisd 0xb00(%rip),%xmm0
movsd  %xmm3,0x58(%rsp)
jb     1540 <calc_phase_squared+0x410>
sqrtsd %xmm0,%xmm0
jmp    159d <calc_phase_squared+0x46d>
cs nopw 0x0(%rax,%rax,1)
movapd %xmm9,0x40(%rsp)
movsd  %xmm8,0x18(%rsp)
movsd  %xmm4,0x30(%rsp)
movsd  %xmm7,0x8(%rsp)
movsd  %xmm6,0xd0(%rsp)
movsd  %xmm5,0xc8(%rsp)
call   1050 <sqrt@plt>
movsd  0xc8(%rsp),%xmm5
movsd  0xd0(%rsp),%xmm6
movsd  0x8(%rsp),%xmm7
movsd  0x30(%rsp),%xmm4
movsd  0x18(%rsp),%xmm8
movapd 0x40(%rsp),%xmm9
movsd  %xmm0,0xa0(%rsp)
movsd  (%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
subsd  %xmm4,%xmm7
subsd  %xmm6,%xmm5
divsd  %xmm5,%xmm7
movsd  %xmm7,0x8(%rsp)
mulsd  %xmm7,%xmm6
subsd  %xmm6,%xmm4
movsd  %xmm4,0x30(%rsp)
movapd %xmm7,%xmm0
subsd  %xmm9,%xmm0
movsd  %xmm0,0x40(%rsp)
movapd %xmm0,%xmm3
mulsd  %xmm1,%xmm3
movsd  (%r15,%r13,8),%xmm0
mulsd  %xmm0,%xmm3
addsd  %xmm4,%xmm3
subsd  %xmm8,%xmm3
movsd  %xmm3,0x18(%rsp)
mulsd  %xmm1,%xmm0
subsd  -0x8(%rbx,%rbp,8),%xmm0
divsd  %xmm2,%xmm0
call   1040 <asin@plt>
mulsd  0x18(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
mulsd  0xa0(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0x58(%rsp),%xmm3
addsd  %xmm1,%xmm3
cmp    %r12,%rbp
jg     1660 <calc_phase_squared+0x530>
add    $0x1,%rbp
movsd  (%r15,%r13,8),%xmm1
movsd  0x30(%rsp),%xmm8
movsd  0x8(%rsp),%xmm9
jmp    14d0 <calc_phase_squared+0x3a0>
mov    0x68(%rsp),%r12
jmp    1680 <calc_phase_squared+0x550>
movsd  0x8(%rsp),%xmm9
movsd  0x30(%rsp),%xmm8
mov    0xa8(%rsp),%rbp
mov    0x68(%rsp),%r12
movsd  (%rsp),%xmm2
movsd  0x978(%rip),%xmm4
movsd  0x78(%rsp),%xmm0
movsd  0x70(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    16d1 <calc_phase_squared+0x5a1>
movsd  %xmm3,0x58(%rsp)
movsd  (%r15,%r13,8),%xmm1
movapd %xmm1,%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  0x60(%rsp),%xmm0
addsd  0x98(%rsp),%xmm0
ucomisd 0x95f(%rip),%xmm0
jb     16fd <calc_phase_squared+0x5cd>
sqrtsd %xmm0,%xmm0
jmp    1723 <calc_phase_squared+0x5f3>
mulsd  %xmm2,%xmm9
mulsd  (%r15,%r13,8),%xmm9
addsd  %xmm8,%xmm9
mulsd  0x926(%rip),%xmm9
mulsd  0x925(%rip),%xmm9
addsd  %xmm9,%xmm3
jmp    132e <calc_phase_squared+0x1fe>
movapd %xmm9,0x40(%rsp)
movsd  %xmm8,0x18(%rsp)
call   1050 <sqrt@plt>
movsd  0x18(%rsp),%xmm8
movapd 0x40(%rsp),%xmm9
movsd  (%rsp),%xmm2
movsd  0x20(%rsp),%xmm1
movsd  %xmm0,0x8(%rsp)
movapd %xmm9,%xmm3
xorpd  0x8f4(%rip),%xmm3
movapd %xmm3,0x30(%rsp)
mulsd  %xmm2,%xmm9
movsd  (%r15,%r13,8),%xmm0
mulsd  %xmm0,%xmm9
addsd  %xmm8,%xmm9
movapd %xmm9,0x40(%rsp)
mulsd  0x60(%rsp),%xmm0
divsd  %xmm1,%xmm0
call   1040 <asin@plt>
movsd  (%rsp),%xmm2
mulsd  0x40(%rsp),%xmm0
movapd 0x30(%rsp),%xmm1
mulsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x58(%rsp),%xmm3
addsd  %xmm1,%xmm3
movsd  0x866(%rip),%xmm4
jmp    132e <calc_phase_squared+0x1fe>
mulsd  0xb0(%rsp),%xmm0
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @calc_phase_squared(i32 %0, i32 %1, double %2, i32 %3, double* %4, double* %5, double* %6, i32* %7, double %8) {
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca i32
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca i32*
%18 = alloca double
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca i32
%29 = alloca i32
%30 = alloca double
%31 = alloca double
%32 = alloca double
%33 = alloca double
%34 = alloca i32
store i32 %0, i32* %10
store i32 %1, i32* %11
store double %2, double* %12
store i32 %3, i32* %13
store double* %4, double** %14
store double* %5, double** %15
store double* %6, double** %16
store i32* %7, i32** %17
store double %8, double* %18
store i32 0, i32* %19
store i32 0, i32* %20
store i32 0, i32* %21
store double 0.000000e+00, double* %22
store double 0.000000e+00, double* %23
store double 0.000000e+00, double* %24
store double 0.000000e+00, double* %25
store double 0.000000e+00, double* %26
store double 0.000000e+00, double* %27
store i32 0, i32* %28
store i32 0, i32* %29
store double 0.000000e+00, double* %30
store double 0.000000e+00, double* %31
store double 0.000000e+00, double* %32
store double 0.000000e+00, double* %33
store i32 0, i32* %34
%35 = load double, double* %12
%36 = load double, double* %12
%37 = fneg double %35
%38 = call double @llvm.fmuladd.f64(double %37, double %36, double 1.000000e+00)
%39 = call double @sqrt(double %38)
store double %39, double* %23
store i32 1, i32* %19
br label %40
40: ; preds = %676, %9
%41 = load i32, i32* %19
%42 = load i32, i32* %13
%43 = icmp sle i32 %41, %42
br i1 %43, label %44, label %679
44: ; preds = %40
%45 = load double, double* %12
%46 = fcmp oeq double %45, 1.000000e+00
br i1 %46, label %60, label %47
47: ; preds = %44
%48 = load double*, double** %16
%49 = load i32, i32* %19
%50 = sub nsw i32 %49, 1
%51 = load i32, i32* %11
%52 = sub nsw i32 %51, 1
%53 = load i32, i32* %13
%54 = mul nsw i32 %52, %53
%55 = add nsw i32 %50, %54
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds double, double* %48, i64 %56
%58 = load double, double* %57
%59 = fcmp oeq double %58, 1.000000e+00
br i1 %59, label %60, label %156
60: ; preds = %47, %44
%61 = load double*, double** %14
%62 = load i32, i32* %10
%63 = load double*, double** %16
%64 = load i32, i32* %19
%65 = sub nsw i32 %64, 1
%66 = load i32, i32* %11
%67 = sub nsw i32 %66, 1
%68 = load i32, i32* %13
%69 = mul nsw i32 %67, %68
%70 = add nsw i32 %65, %69
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %63, i64 %71
%73 = load double, double* %72
%74 = load double, double* %12
%75 = fmul double %73, %74
%76 = call i32 @locate(double* %61, i32 %62, double %75)
%77 = add nsw i32 %76, 1
store i32 %77, i32* %21
%78 = load double*, double** %15
%79 = load i32, i32* %21
%80 = sub nsw i32 %79, 1
%81 = load i32, i32* %11
%82 = sub nsw i32 %81, 1
%83 = load i32, i32* %10
%84 = mul nsw i32 %82, %83
%85 = add nsw i32 %80, %84
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %78, i64 %86
%88 = load double, double* %87
%89 = load double*, double** %16
%90 = load i32, i32* %19
%91 = sub nsw i32 %90, 1
%92 = load i32, i32* %11
%93 = sub nsw i32 %92, 1
%94 = load i32, i32* %13
%95 = mul nsw i32 %93, %94
%96 = add nsw i32 %91, %95
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds double, double* %89, i64 %97
%99 = load double, double* %98
%100 = load double, double* %12
%101 = load double*, double** %14
%102 = load i32, i32* %21
%103 = sub nsw i32 %102, 1
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds double, double* %101, i64 %104
%106 = load double, double* %105
%107 = fneg double %106
%108 = call double @llvm.fmuladd.f64(double %99, double %100, double %107)
%109 = load double*, double** %14
%110 = load i32, i32* %21
%111 = add nsw i32 %110, 1
%112 = sub nsw i32 %111, 1
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %109, i64 %113
%115 = load double, double* %114
%116 = load double*, double** %14
%117 = load i32, i32* %21
%118 = sub nsw i32 %117, 1
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds double, double* %116, i64 %119
%121 = load double, double* %120
%122 = fsub double %115, %121
%123 = fdiv double %108, %122
%124 = load double*, double** %15
%125 = load i32, i32* %21
%126 = add nsw i32 %125, 1
%127 = sub nsw i32 %126, 1
%128 = load i32, i32* %11
%129 = sub nsw i32 %128, 1
%130 = load i32, i32* %10
%131 = mul nsw i32 %129, %130
%132 = add nsw i32 %127, %131
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds double, double* %124, i64 %133
%135 = load double, double* %134
%136 = load double*, double** %15
%137 = load i32, i32* %21
%138 = sub nsw i32 %137, 1
%139 = load i32, i32* %11
%140 = sub nsw i32 %139, 1
%141 = load i32, i32* %10
%142 = mul nsw i32 %140, %141
%143 = add nsw i32 %138, %142
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds double, double* %136, i64 %144
%146 = load double, double* %145
%147 = fsub double %135, %146
%148 = call double @llvm.fmuladd.f64(double %123, double %147, double %88)
%149 = fmul double 0x400921FB54442D18, %148
store double %149, double* %25
%150 = load double, double* %12
%151 = fcmp oeq double %150, 1.000000e+00
br i1 %151, label %152, label %155
152: ; preds = %60
%153 = load double, double* %25
%154 = fdiv double %153, 2.000000e+00
store double %154, double* %25
br label %155
155: ; preds = %152, %60
br label %624
156: ; preds = %47
store double 0.000000e+00, double* %25
%157 = load double*, double** %16
%158 = load i32, i32* %19
%159 = sub nsw i32 %158, 1
%160 = load i32, i32* %11
%161 = sub nsw i32 %160, 1
%162 = load i32, i32* %13
%163 = mul nsw i32 %161, %162
%164 = add nsw i32 %159, %163
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds double, double* %157, i64 %165
%167 = load double, double* %166
%168 = load double*, double** %16
%169 = load i32, i32* %19
%170 = sub nsw i32 %169, 1
%171 = load i32, i32* %11
%172 = sub nsw i32 %171, 1
%173 = load i32, i32* %13
%174 = mul nsw i32 %172, %173
%175 = add nsw i32 %170, %174
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds double, double* %168, i64 %176
%178 = load double, double* %177
%179 = fneg double %167
%180 = call double @llvm.fmuladd.f64(double %179, double %178, double 1.000000e+00)
%181 = call double @sqrt(double %180)
store double %181, double* %24
%182 = load double, double* %12
%183 = load double*, double** %16
%184 = load i32, i32* %19
%185 = sub nsw i32 %184, 1
%186 = load i32, i32* %11
%187 = sub nsw i32 %186, 1
%188 = load i32, i32* %13
%189 = mul nsw i32 %187, %188
%190 = add nsw i32 %185, %189
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds double, double* %183, i64 %191
%193 = load double, double* %192
%194 = load double, double* %23
%195 = load double, double* %24
%196 = fmul double %194, %195
%197 = fneg double %196
%198 = call double @llvm.fmuladd.f64(double %182, double %193, double %197)
store double %198, double* %26
%199 = load double, double* %12
%200 = load double*, double** %16
%201 = load i32, i32* %19
%202 = sub nsw i32 %201, 1
%203 = load i32, i32* %11
%204 = sub nsw i32 %203, 1
%205 = load i32, i32* %13
%206 = mul nsw i32 %204, %205
%207 = add nsw i32 %202, %206
%208 = sext i32 %207 to i64
%209 = getelementptr inbounds double, double* %200, i64 %208
%210 = load double, double* %209
%211 = load double, double* %23
%212 = load double, double* %24
%213 = fmul double %211, %212
%214 = call double @llvm.fmuladd.f64(double %199, double %210, double %213)
store double %214, double* %27
%215 = load double*, double** %16
%216 = load i32, i32* %19
%217 = sub nsw i32 %216, 1
%218 = load i32, i32* %11
%219 = sub nsw i32 %218, 1
%220 = load i32, i32* %13
%221 = mul nsw i32 %219, %220
%222 = add nsw i32 %217, %221
%223 = sext i32 %222 to i64
%224 = getelementptr inbounds double, double* %215, i64 %223
%225 = load double, double* %224
%226 = load double, double* %27
%227 = fcmp olt double %225, %226
br i1 %227, label %228, label %240
228: ; preds = %156
%229 = load double*, double** %16
%230 = load i32, i32* %19
%231 = sub nsw i32 %230, 1
%232 = load i32, i32* %11
%233 = sub nsw i32 %232, 1
%234 = load i32, i32* %13
%235 = mul nsw i32 %233, %234
%236 = add nsw i32 %231, %235
%237 = sext i32 %236 to i64
%238 = getelementptr inbounds double, double* %229, i64 %237
%239 = load double, double* %238
store double %239, double* %27
store i32 1, i32* %34
br label %241
240: ; preds = %156
store i32 0, i32* %34
br label %241
241: ; preds = %240, %228
%242 = load double, double* %26
%243 = load double, double* %27
%244 = fcmp olt double %242, %243
br i1 %244, label %245, label %623
245: ; preds = %241
%246 = load double*, double** %14
%247 = load i32, i32* %10
%248 = load double, double* %26
%249 = call i32 @locate(double* %246, i32 %247, double %248)
%250 = add nsw i32 %249, 1
store i32 %250, i32* %28
%251 = load double*, double** %14
%252 = load i32, i32* %10
%253 = load double, double* %27
%254 = call i32 @locate(double* %251, i32 %252, double %253)
%255 = add nsw i32 %254, 1
store i32 %255, i32* %29
%256 = load i32, i32* %28
store i32 %256, i32* %20
%257 = load double*, double** %15
%258 = load i32, i32* %20
%259 = add nsw i32 %258, 1
%260 = sub nsw i32 %259, 1
%261 = load i32, i32* %11
%262 = sub nsw i32 %261, 1
%263 = load i32, i32* %10
%264 = mul nsw i32 %262, %263
%265 = add nsw i32 %260, %264
%266 = sext i32 %265 to i64
%267 = getelementptr inbounds double, double* %257, i64 %266
%268 = load double, double* %267
%269 = load double*, double** %15
%270 = load i32, i32* %20
%271 = sub nsw i32 %270, 1
%272 = load i32, i32* %11
%273 = sub nsw i32 %272, 1
%274 = load i32, i32* %10
%275 = mul nsw i32 %273, %274
%276 = add nsw i32 %271, %275
%277 = sext i32 %276 to i64
%278 = getelementptr inbounds double, double* %269, i64 %277
%279 = load double, double* %278
%280 = fsub double %268, %279
%281 = load double*, double** %14
%282 = load i32, i32* %20
%283 = add nsw i32 %282, 1
%284 = sub nsw i32 %283, 1
%285 = sext i32 %284 to i64
%286 = getelementptr inbounds double, double* %281, i64 %285
%287 = load double, double* %286
%288 = load double*, double** %14
%289 = load i32, i32* %20
%290 = sub nsw i32 %289, 1
%291 = sext i32 %290 to i64
%292 = getelementptr inbounds double, double* %288, i64 %291
%293 = load double, double* %292
%294 = fsub double %287, %293
%295 = fdiv double %280, %294
store double %295, double* %30
%296 = load double*, double** %15
%297 = load i32, i32* %20
%298 = sub nsw i32 %297, 1
%299 = load i32, i32* %11
%300 = sub nsw i32 %299, 1
%301 = load i32, i32* %10
%302 = mul nsw i32 %300, %301
%303 = add nsw i32 %298, %302
%304 = sext i32 %303 to i64
%305 = getelementptr inbounds double, double* %296, i64 %304
%306 = load double, double* %305
%307 = load double*, double** %14
%308 = load i32, i32* %20
%309 = sub nsw i32 %308, 1
%310 = sext i32 %309 to i64
%311 = getelementptr inbounds double, double* %307, i64 %310
%312 = load double, double* %311
%313 = load double, double* %30
%314 = fneg double %312
%315 = call double @llvm.fmuladd.f64(double %314, double %313, double %306)
store double %315, double* %31
%316 = load double, double* %30
%317 = load double, double* %12
%318 = fmul double %316, %317
%319 = load double*, double** %16
%320 = load i32, i32* %19
%321 = sub nsw i32 %320, 1
%322 = load i32, i32* %11
%323 = sub nsw i32 %322, 1
%324 = load i32, i32* %13
%325 = mul nsw i32 %323, %324
%326 = add nsw i32 %321, %325
%327 = sext i32 %326 to i64
%328 = getelementptr inbounds double, double* %319, i64 %327
%329 = load double, double* %328
%330 = load double, double* %31
%331 = call double @llvm.fmuladd.f64(double %318, double %329, double %330)
%332 = fmul double %331, 0x400921FB54442D18
%333 = fdiv double %332, 2.000000e+00
%334 = load double, double* %25
%335 = fadd double %334, %333
store double %335, double* %25
%336 = load i32, i32* %28
%337 = add nsw i32 %336, 1
store i32 %337, i32* %20
br label %338
338: ; preds = %520, %245
%339 = load i32, i32* %20
%340 = load i32, i32* %29
%341 = icmp sle i32 %339, %340
br i1 %341, label %342, label %523
342: ; preds = %338
%343 = load double*, double** %15
%344 = load i32, i32* %20
%345 = add nsw i32 %344, 1
%346 = sub nsw i32 %345, 1
%347 = load i32, i32* %11
%348 = sub nsw i32 %347, 1
%349 = load i32, i32* %10
%350 = mul nsw i32 %348, %349
%351 = add nsw i32 %346, %350
%352 = sext i32 %351 to i64
%353 = getelementptr inbounds double, double* %343, i64 %352
%354 = load double, double* %353
%355 = load double*, double** %15
%356 = load i32, i32* %20
%357 = sub nsw i32 %356, 1
%358 = load i32, i32* %11
%359 = sub nsw i32 %358, 1
%360 = load i32, i32* %10
%361 = mul nsw i32 %359, %360
%362 = add nsw i32 %357, %361
%363 = sext i32 %362 to i64
%364 = getelementptr inbounds double, double* %355, i64 %363
%365 = load double, double* %364
%366 = fsub double %354, %365
%367 = load double*, double** %14
%368 = load i32, i32* %20
%369 = add nsw i32 %368, 1
%370 = sub nsw i32 %369, 1
%371 = sext i32 %370 to i64
%372 = getelementptr inbounds double, double* %367, i64 %371
%373 = load double, double* %372
%374 = load double*, double** %14
%375 = load i32, i32* %20
%376 = sub nsw i32 %375, 1
%377 = sext i32 %376 to i64
%378 = getelementptr inbounds double, double* %374, i64 %377
%379 = load double, double* %378
%380 = fsub double %373, %379
%381 = fdiv double %366, %380
store double %381, double* %32
%382 = load double*, double** %15
%383 = load i32, i32* %20
%384 = sub nsw i32 %383, 1
%385 = load i32, i32* %11
%386 = sub nsw i32 %385, 1
%387 = load i32, i32* %10
%388 = mul nsw i32 %386, %387
%389 = add nsw i32 %384, %388
%390 = sext i32 %389 to i64
%391 = getelementptr inbounds double, double* %382, i64 %390
%392 = load double, double* %391
%393 = load double*, double** %14
%394 = load i32, i32* %20
%395 = sub nsw i32 %394, 1
%396 = sext i32 %395 to i64
%397 = getelementptr inbounds double, double* %393, i64 %396
%398 = load double, double* %397
%399 = load double, double* %32
%400 = fneg double %398
%401 = call double @llvm.fmuladd.f64(double %400, double %399, double %392)
store double %401, double* %33
%402 = load double, double* %32
%403 = load double, double* %30
%404 = fsub double %402, %403
%405 = load double, double* %12
%406 = load double, double* %12
%407 = fneg double %405
%408 = call double @llvm.fmuladd.f64(double %407, double %406, double 1.000000e+00)
%409 = load double*, double** %16
%410 = load i32, i32* %19
%411 = sub nsw i32 %410, 1
%412 = load i32, i32* %11
%413 = sub nsw i32 %412, 1
%414 = load i32, i32* %13
%415 = mul nsw i32 %413, %414
%416 = add nsw i32 %411, %415
%417 = sext i32 %416 to i64
%418 = getelementptr inbounds double, double* %409, i64 %417
%419 = load double, double* %418
%420 = load double*, double** %16
%421 = load i32, i32* %19
%422 = sub nsw i32 %421, 1
%423 = load i32, i32* %11
%424 = sub nsw i32 %423, 1
%425 = load i32, i32* %13
%426 = mul nsw i32 %424, %425
%427 = add nsw i32 %422, %426
%428 = sext i32 %427 to i64
%429 = getelementptr inbounds double, double* %420, i64 %428
%430 = load double, double* %429
%431 = fneg double %419
%432 = call double @llvm.fmuladd.f64(double %431, double %430, double %408)
%433 = load double, double* %12
%434 = fmul double 2.000000e+00, %433
%435 = load double*, double** %16
%436 = load i32, i32* %19
%437 = sub nsw i32 %436, 1
%438 = load i32, i32* %11
%439 = sub nsw i32 %438, 1
%440 = load i32, i32* %13
%441 = mul nsw i32 %439, %440
%442 = add nsw i32 %437, %441
%443 = sext i32 %442 to i64
%444 = getelementptr inbounds double, double* %435, i64 %443
%445 = load double, double* %444
%446 = fmul double %434, %445
%447 = load double*, double** %14
%448 = load i32, i32* %20
%449 = sub nsw i32 %448, 1
%450 = sext i32 %449 to i64
%451 = getelementptr inbounds double, double* %447, i64 %450
%452 = load double, double* %451
%453 = call double @llvm.fmuladd.f64(double %446, double %452, double %432)
%454 = load double*, double** %14
%455 = load i32, i32* %20
%456 = sub nsw i32 %455, 1
%457 = sext i32 %456 to i64
%458 = getelementptr inbounds double, double* %454, i64 %457
%459 = load double, double* %458
%460 = load double*, double** %14
%461 = load i32, i32* %20
%462 = sub nsw i32 %461, 1
%463 = sext i32 %462 to i64
%464 = getelementptr inbounds double, double* %460, i64 %463
%465 = load double, double* %464
%466 = fneg double %459
%467 = call double @llvm.fmuladd.f64(double %466, double %465, double %453)
%468 = call double @sqrt(double %467)
%469 = load double, double* %32
%470 = load double, double* %30
%471 = fsub double %469, %470
%472 = load double, double* %12
%473 = fmul double %471, %472
%474 = load double*, double** %16
%475 = load i32, i32* %19
%476 = sub nsw i32 %475, 1
%477 = load i32, i32* %11
%478 = sub nsw i32 %477, 1
%479 = load i32, i32* %13
%480 = mul nsw i32 %478, %479
%481 = add nsw i32 %476, %480
%482 = sext i32 %481 to i64
%483 = getelementptr inbounds double, double* %474, i64 %482
%484 = load double, double* %483
%485 = load double, double* %33
%486 = call double @llvm.fmuladd.f64(double %473, double %484, double %485)
%487 = load double, double* %31
%488 = fsub double %486, %487
%489 = load double, double* %12
%490 = load double*, double** %16
%491 = load i32, i32* %19
%492 = sub nsw i32 %491, 1
%493 = load i32, i32* %11
%494 = sub nsw i32 %493, 1
%495 = load i32, i32* %13
%496 = mul nsw i32 %494, %495
%497 = add nsw i32 %492, %496
%498 = sext i32 %497 to i64
%499 = getelementptr inbounds double, double* %490, i64 %498
%500 = load double, double* %499
%501 = load double*, double** %14
%502 = load i32, i32* %20
%503 = sub nsw i32 %502, 1
%504 = sext i32 %503 to i64
%505 = getelementptr inbounds double, double* %501, i64 %504
%506 = load double, double* %505
%507 = fneg double %506
%508 = call double @llvm.fmuladd.f64(double %489, double %500, double %507)
%509 = load double, double* %24
%510 = load double, double* %23
%511 = fmul double %509, %510
%512 = fdiv double %508, %511
%513 = call double @asin(double %512)
%514 = fmul double %488, %513
%515 = call double @llvm.fmuladd.f64(double %404, double %468, double %514)
%516 = load double, double* %25
%517 = fadd double %516, %515
store double %517, double* %25
%518 = load double, double* %32
store double %518, double* %30
%519 = load double, double* %33
store double %519, double* %31
br label %520
520: ; preds = %342
%521 = load i32, i32* %20
%522 = add nsw i32 %521, 1
store i32 %522, i32* %20
br label %338
523: ; preds = %338
%524 = load i32, i32* %34
%525 = icmp eq i32 %524, 1
br i1 %525, label %526, label %601
526: ; preds = %523
%527 = load double, double* %30
%528 = fneg double %527
%529 = load double, double* %12
%530 = load double, double* %12
%531 = fneg double %529
%532 = call double @llvm.fmuladd.f64(double %531, double %530, double 1.000000e+00)
%533 = load double*, double** %16
%534 = load i32, i32* %19
%535 = sub nsw i32 %534, 1
%536 = load i32, i32* %11
%537 = sub nsw i32 %536, 1
%538 = load i32, i32* %13
%539 = mul nsw i32 %537, %538
%540 = add nsw i32 %535, %539
%541 = sext i32 %540 to i64
%542 = getelementptr inbounds double, double* %533, i64 %541
%543 = load double, double* %542
%544 = fmul double 2.000000e+00, %543
%545 = load double*, double** %16
%546 = load i32, i32* %19
%547 = sub nsw i32 %546, 1
%548 = load i32, i32* %11
%549 = sub nsw i32 %548, 1
%550 = load i32, i32* %13
%551 = mul nsw i32 %549, %550
%552 = add nsw i32 %547, %551
%553 = sext i32 %552 to i64
%554 = getelementptr inbounds double, double* %545, i64 %553
%555 = load double, double* %554
%556 = fmul double %544, %555
%557 = load double, double* %12
%558 = fsub double %557, 1.000000e+00
%559 = call double @llvm.fmuladd.f64(double %556, double %558, double %532)
%560 = call double @sqrt(double %559)
%561 = load double, double* %30
%562 = load double, double* %12
%563 = fmul double %561, %562
%564 = load double*, double** %16
%565 = load i32, i32* %19
%566 = sub nsw i32 %565, 1
%567 = load i32, i32* %11
%568 = sub nsw i32 %567, 1
%569 = load i32, i32* %13
%570 = mul nsw i32 %568, %569
%571 = add nsw i32 %566, %570
%572 = sext i32 %571 to i64
%573 = getelementptr inbounds double, double* %564, i64 %572
%574 = load double, double* %573
%575 = load double, double* %31
%576 = call double @llvm.fmuladd.f64(double %563, double %574, double %575)
%577 = load double, double* %12
%578 = fsub double %577, 1.000000e+00
%579 = load double*, double** %16
%580 = load i32, i32* %19
%581 = sub nsw i32 %580, 1
%582 = load i32, i32* %11
%583 = sub nsw i32 %582, 1
%584 = load i32, i32* %13
%585 = mul nsw i32 %583, %584
%586 = add nsw i32 %581, %585
%587 = sext i32 %586 to i64
%588 = getelementptr inbounds double, double* %579, i64 %587
%589 = load double, double* %588
%590 = fmul double %578, %589
%591 = load double, double* %24
%592 = load double, double* %23
%593 = fmul double %591, %592
%594 = fdiv double %590, %593
%595 = call double @asin(double %594)
%596 = fmul double %576, %595
%597 = fneg double %596
%598 = call double @llvm.fmuladd.f64(double %528, double %560, double %597)
%599 = load double, double* %25
%600 = fadd double %599, %598
store double %600, double* %25
br label %622
601: ; preds = %523
%602 = load double, double* %30
%603 = load double, double* %12
%604 = fmul double %602, %603
%605 = load double*, double** %16
%606 = load i32, i32* %19
%607 = sub nsw i32 %606, 1
%608 = load i32, i32* %11
%609 = sub nsw i32 %608, 1
%610 = load i32, i32* %13
%611 = mul nsw i32 %609, %610
%612 = add nsw i32 %607, %611
%613 = sext i32 %612 to i64
%614 = getelementptr inbounds double, double* %605, i64 %613
%615 = load double, double* %614
%616 = load double, double* %31
%617 = call double @llvm.fmuladd.f64(double %604, double %615, double %616)
%618 = fmul double %617, 0x400921FB54442D18
%619 = fdiv double %618, 2.000000e+00
%620 = load double, double* %25
%621 = fadd double %620, %619
store double %621, double* %25
br label %622
622: ; preds = %601, %526
br label %623
623: ; preds = %622, %241
br label %624
624: ; preds = %623, %155
%625 = load i32, i32* %19
%626 = icmp eq i32 %625, 1
br i1 %626, label %631, label %627
627: ; preds = %624
%628 = load i32, i32* %19
%629 = load i32, i32* %13
%630 = icmp eq i32 %628, %629
br i1 %630, label %631, label %653
631: ; preds = %627, %624
%632 = load i32*, i32** %17
%633 = load i32, i32* %19
%634 = sub nsw i32 %633, 1
%635 = load i32, i32* %11
%636 = sub nsw i32 %635, 1
%637 = load i32, i32* %13
%638 = mul nsw i32 %636, %637
%639 = add nsw i32 %634, %638
%640 = sext i32 %639 to i64
%641 = getelementptr inbounds i32, i32* %632, i64 %640
%642 = load i32, i32* %641
%643 = icmp eq i32 %642, 1
br i1 %643, label %644, label %648
644: ; preds = %631
%645 = load double, double* %22
%646 = load double, double* %25
%647 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %646, double %645)
store double %647, double* %22
br label %652
648: ; preds = %631
%649 = load double, double* %22
%650 = load double, double* %25
%651 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %650, double %649)
store double %651, double* %22
br label %652
652: ; preds = %648, %644
br label %675
653: ; preds = %627
%654 = load i32*, i32** %17
%655 = load i32, i32* %19
%656 = sub nsw i32 %655, 1
%657 = load i32, i32* %11
%658 = sub nsw i32 %657, 1
%659 = load i32, i32* %13
%660 = mul nsw i32 %658, %659
%661 = add nsw i32 %656, %660
%662 = sext i32 %661 to i64
%663 = getelementptr inbounds i32, i32* %654, i64 %662
%664 = load i32, i32* %663
%665 = icmp eq i32 %664, 1
br i1 %665, label %666, label %670
666: ; preds = %653
%667 = load double, double* %22
%668 = load double, double* %25
%669 = fsub double %667, %668
store double %669, double* %22
br label %674
670: ; preds = %653
%671 = load double, double* %22
%672 = load double, double* %25
%673 = fadd double %671, %672
store double %673, double* %22
br label %674
674: ; preds = %670, %666
br label %675
675: ; preds = %674, %652
br label %676
676: ; preds = %675
%677 = load i32, i32* %19
%678 = add nsw i32 %677, 1
store i32 %678, i32* %19
br label %40
679: ; preds = %40
%680 = load double, double* %18
%681 = load double, double* %22
%682 = fmul double %681, %680
store double %682, double* %22
%683 = load double, double* %22
ret double %683
}

LLVM IR (-O2):
define double @calc_phase_squared(i32 %0, i32 %1, double %2, i32 %3, double* %4, double* nocapture %5, double* nocapture %6, i32* nocapture %7, double %8) {
%10 = fneg double %2
%11 = tail call double @llvm.fmuladd.f64(double %10, double %2, double 1.000000e+00)
%12 = tail call double @sqrt(double %11)
%13 = icmp slt i32 %3, 1
br i1 %13, label %208, label %14
14: ; preds = %9
%15 = fcmp oeq double %2, 1.000000e+00
%16 = add nsw i32 %1, -1
%17 = mul nsw i32 %16, %3
%18 = mul nsw i32 %16, %0
%19 = fmul double %2, 2.000000e+00
%20 = fadd double %2, -1.000000e+00
%21 = sext i32 %18 to i64
%22 = zext i32 %3 to i64
%23 = sext i32 %17 to i64
%24 = add nuw i32 %3, 1
%25 = zext i32 %24 to i64
br label %26
26: ; preds = %14, %204
%27 = phi i64 [ 1, %14 ], [ %206, %204 ]
%28 = phi double [ 0.000000e+00, %14 ], [ %205, %204 ]
%29 = add nsw i64 %27, -1
%30 = add nsw i64 %29, %23
br i1 %15, label %35, label %31
31: ; preds = %26
%32 = getelementptr inbounds double, double* %6, i64 %30
%33 = load double, double* %32
%34 = fcmp oeq double %33, 1.000000e+00
br i1 %34, label %35, label %65
35: ; preds = %26, %31
%36 = getelementptr inbounds double, double* %6, i64 %30
%37 = load double, double* %36
%38 = fmul double %37, %2
%39 = tail call i32 @locate(double* %4, i32 %0, double %38)
%40 = add nsw i32 %39, 1
%41 = add nsw i32 %39, %18
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %5, i64 %42
%44 = load double, double* %43
%45 = load double, double* %36
%46 = sext i32 %39 to i64
%47 = getelementptr inbounds double, double* %4, i64 %46
%48 = load double, double* %47
%49 = fneg double %48
%50 = tail call double @llvm.fmuladd.f64(double %45, double %2, double %49)
%51 = sext i32 %40 to i64
%52 = getelementptr inbounds double, double* %4, i64 %51
%53 = load double, double* %52
%54 = fsub double %53, %48
%55 = fdiv double %50, %54
%56 = add nsw i32 %40, %18
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double, double* %5, i64 %57
%59 = load double, double* %58
%60 = fsub double %59, %44
%61 = tail call double @llvm.fmuladd.f64(double %55, double %60, double %44)
%62 = fmul double %61, 0x400921FB54442D18
br i1 %15, label %63, label %184
63: ; preds = %35
%64 = fmul double %62, 5.000000e-01
br label %184
65: ; preds = %31
%66 = fneg double %33
%67 = tail call double @llvm.fmuladd.f64(double %66, double %33, double 1.000000e+00)
%68 = tail call double @sqrt(double %67)
%69 = load double, double* %32
%70 = fmul double %12, %68
%71 = fneg double %70
%72 = tail call double @llvm.fmuladd.f64(double %2, double %69, double %71)
%73 = tail call double @llvm.fmuladd.f64(double %2, double %69, double %70)
%74 = fcmp olt double %69, %73
%75 = select i1 %74, double %69, double %73
%76 = fcmp olt double %72, %75
br i1 %76, label %77, label %184
77: ; preds = %65
%78 = tail call i32 @locate(double* %4, i32 %0, double %72)
%79 = add nsw i32 %78, 1
%80 = tail call i32 @locate(double* %4, i32 %0, double %75)
%81 = add nsw i32 %79, %18
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds double, double* %5, i64 %82
%84 = load double, double* %83
%85 = add nsw i32 %78, %18
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %5, i64 %86
%88 = load double, double* %87
%89 = fsub double %84, %88
%90 = sext i32 %79 to i64
%91 = getelementptr inbounds double, double* %4, i64 %90
%92 = load double, double* %91
%93 = sext i32 %78 to i64
%94 = getelementptr inbounds double, double* %4, i64 %93
%95 = load double, double* %94
%96 = fsub double %92, %95
%97 = fdiv double %89, %96
%98 = fneg double %95
%99 = tail call double @llvm.fmuladd.f64(double %98, double %97, double %88)
%100 = fmul double %97, %2
%101 = load double, double* %32
%102 = tail call double @llvm.fmuladd.f64(double %100, double %101, double %99)
%103 = fmul double %102, 0x400921FB54442D18
%104 = fmul double %103, 5.000000e-01
%105 = fadd double %104, 0.000000e+00
%106 = icmp slt i32 %78, %80
br i1 %106, label %107, label %156
107: ; preds = %77
%108 = add i32 %78, 2
%109 = sext i32 %108 to i64
%110 = sext i32 %80 to i64
br label %111
111: ; preds = %153, %107
%112 = phi double [ %101, %107 ], [ %155, %153 ]
%113 = phi i64 [ %109, %107 ], [ %154, %153 ]
%114 = phi double [ %99, %107 ], [ %132, %153 ]
%115 = phi double [ %97, %107 ], [ %130, %153 ]
%116 = phi double [ %105, %107 ], [ %151, %153 ]
%117 = add nsw i64 %113, %21
%118 = getelementptr inbounds double, double* %5, i64 %117
%119 = load double, double* %118
%120 = add nsw i64 %113, -1
%121 = add nsw i64 %120, %21
%122 = getelementptr inbounds double, double* %5, i64 %121
%123 = load double, double* %122
%124 = fsub double %119, %123
%125 = getelementptr inbounds double, double* %4, i64 %113
%126 = load double, double* %125
%127 = getelementptr inbounds double, double* %4, i64 %120
%128 = load double, double* %127
%129 = fsub double %126, %128
%130 = fdiv double %124, %129
%131 = fneg double %128
%132 = tail call double @llvm.fmuladd.f64(double %131, double %130, double %123)
%133 = fsub double %130, %115
%134 = fneg double %112
%135 = tail call double @llvm.fmuladd.f64(double %134, double %112, double %11)
%136 = fmul double %19, %112
%137 = tail call double @llvm.fmuladd.f64(double %136, double %128, double %135)
%138 = tail call double @llvm.fmuladd.f64(double %131, double %128, double %137)
%139 = tail call double @sqrt(double %138)
%140 = fmul double %133, %2
%141 = load double, double* %32
%142 = tail call double @llvm.fmuladd.f64(double %140, double %141, double %132)
%143 = fsub double %142, %114
%144 = load double, double* %127
%145 = fneg double %144
%146 = tail call double @llvm.fmuladd.f64(double %2, double %141, double %145)
%147 = fdiv double %146, %70
%148 = tail call double @asin(double %147)
%149 = fmul double %148, %143
%150 = tail call double @llvm.fmuladd.f64(double %133, double %139, double %149)
%151 = fadd double %116, %150
%152 = icmp sgt i64 %113, %110
br i1 %152, label %156, label %153
153: ; preds = %111
%154 = add i64 %113, 1
%155 = load double, double* %32
br label %111
156: ; preds = %111, %77
%157 = phi double [ %105, %77 ], [ %151, %111 ]
%158 = phi double [ %97, %77 ], [ %130, %111 ]
%159 = phi double [ %99, %77 ], [ %132, %111 ]
br i1 %74, label %160, label %177
160: ; preds = %156
%161 = fneg double %158
%162 = load double, double* %32
%163 = fmul double %162, 2.000000e+00
%164 = fmul double %162, %163
%165 = tail call double @llvm.fmuladd.f64(double %164, double %20, double %11)
%166 = tail call double @sqrt(double %165)
%167 = fmul double %158, %2
%168 = load double, double* %32
%169 = tail call double @llvm.fmuladd.f64(double %167, double %168, double %159)
%170 = fmul double %20, %168
%171 = fdiv double %170, %70
%172 = tail call double @asin(double %171)
%173 = fneg double %169
%174 = fmul double %172, %173
%175 = tail call double @llvm.fmuladd.f64(double %161, double %166, double %174)
%176 = fadd double %157, %175
br label %184
177: ; preds = %156
%178 = fmul double %158, %2
%179 = load double, double* %32
%180 = tail call double @llvm.fmuladd.f64(double %178, double %179, double %159)
%181 = fmul double %180, 0x400921FB54442D18
%182 = fmul double %181, 5.000000e-01
%183 = fadd double %157, %182
br label %184
184: ; preds = %65, %177, %160, %35, %63
%185 = phi double [ %64, %63 ], [ %62, %35 ], [ %176, %160 ], [ %183, %177 ], [ 0.000000e+00, %65 ]
%186 = icmp eq i64 %27, 1
%187 = icmp eq i64 %27, %22
%188 = or i1 %186, %187
%189 = add nsw i64 %27, -1
%190 = add nsw i64 %189, %23
%191 = getelementptr inbounds i32, i32* %7, i64 %190
%192 = load i32, i32* %191
%193 = icmp eq i32 %192, 1
br i1 %188, label %194, label %199
194: ; preds = %184
br i1 %193, label %195, label %197
195: ; preds = %194
%196 = tail call double @llvm.fmuladd.f64(double %185, double -5.000000e-01, double %28)
br label %204
197: ; preds = %194
%198 = tail call double @llvm.fmuladd.f64(double %185, double 5.000000e-01, double %28)
br label %204
199: ; preds = %184
br i1 %193, label %200, label %202
200: ; preds = %199
%201 = fsub double %28, %185
br label %204
202: ; preds = %199
%203 = fadd double %28, %185
br label %204
204: ; preds = %197, %195, %202, %200
%205 = phi double [ %196, %195 ], [ %198, %197 ], [ %201, %200 ], [ %203, %202 ]
%206 = add nuw nsw i64 %27, 1
%207 = icmp eq i64 %206, %25
br i1 %207, label %208, label %26
208: ; preds = %204, %9
%209 = phi double [ 0.000000e+00, %9 ], [ %205, %204 ]
%210 = fmul double %209, %8
ret double %210
}