#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 */
int /*<<< orphan*/ cumulativeSum(float *, float *, int);
int /*<<< orphan*/ diffArray(float *, float *, int);
int /*<<< orphan*/ fabs(float);
int /*<<< orphan*/ free(float *);
int /*<<< orphan*/ grd_rampup(float, float, float, float, float **, float **,
                              float **, float **, int *);
int /*<<< orphan*/ grd_trapezoid(float, float, float, float, float **, float **,
                                 float **, float **, int *, int *);
int /*<<< orphan*/ interpolatefloats(float *, float *, int, float *, float *,
                                     int);
scalar_t__ malloc(int);
float maxMagnitude(float *, float *, int);
int /*<<< orphan*/ memcpy(float *, float *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scalecomplex(float *, float *, int, float, int);
int /*<<< orphan*/ scalefloats(float *, int, int /*<<< orphan*/);
int sqrt(double);
int sumfloats(float *, int);
void grd_bipolar_prewinder(float gradMax, float gradMaxSys, float slewMax,
                           float T, float kxpre, float kypre, float Gtgt,
                           float **ktraj, float **grad, float **slew,
                           float **time, int *N) {
  float *gxdep = NULL, *gydep = NULL;
  float *kxdep, *gxdep1, *sxdep, *txdep;
  int len_gxdep;
  float t1;
  float rSMAX_gy;
  float *kydepR, *gydepR, *sydepR, *tydepR;
  int NydepR;
  float adepR;
  float *kydepT, *gydepT, *sydepT, *tydepT;
  int NydepT;
  int len_gydep;
  float *interpvec;
  float adepx;
  float sMax;
  float gMax;
  float sscale;
  float gscale;
  float *slewx = NULL, *slewy = NULL;
  float *ktrajx = NULL, *ktrajy = NULL;
  int n;
  float *tempfloats = NULL;
  float errlevel = 0.0001f;
  int iter;
  float rSMAX_gx = .98 * slewMax;
  float rGMAX_gx = .98 * gradMax;
  for (iter = 0; iter < 50; iter++) {
    grd_trapezoid(rGMAX_gx, rSMAX_gx, kxpre, T, &kxdep, &gxdep1, &sxdep, &txdep,
                  &len_gxdep, &n);
    t1 = txdep[len_gxdep - 1] / (1 + sqrt(2.0));
    rSMAX_gy = Gtgt / t1;
    grd_rampup(gradMaxSys, rSMAX_gy, Gtgt, T, &kydepR, &gydepR, &sydepR,
               &tydepR, &NydepR);
    adepR = 4257 * T * sumfloats(gydepR, NydepR);
    grd_trapezoid(gradMaxSys, rSMAX_gy, -adepR + kypre, T, &kydepT, &gydepT,
                  &sydepT, &tydepT, &NydepT, &n);
    len_gydep = NydepR + NydepT - 1;
    gydep = (float *)malloc(len_gydep * sizeof(float));
    memcpy(gydep, gydepT, NydepT * sizeof(float));
    memcpy(&gydep[NydepT], &gydepR[1], (NydepR - 1) * sizeof(float));
    interpvec = (float *)malloc(len_gydep * sizeof(float));
    gxdep = (float *)malloc(len_gydep * sizeof(float));
    for (n = 0; n < len_gydep; n++)
      interpvec[n] = n * (len_gxdep - 1.0f) / (len_gydep - 1.0f);
    if (tempfloats != NULL)
      free(tempfloats);
    tempfloats = (float *)malloc(len_gxdep * sizeof(float));
    for (n = 0; n < len_gxdep; n++)
      tempfloats[n] = n;
    interpolatefloats(tempfloats, gxdep1, len_gxdep, interpvec, gxdep,
                      len_gydep);
    adepx = 4257 * T * sumfloats(gxdep, len_gxdep);
    if (adepx)
      scalefloats(gxdep, len_gxdep, fabs(kxpre / adepx));
    slewx = (float *)malloc(len_gydep * sizeof(float));
    slewy = (float *)malloc(len_gydep * sizeof(float));
    diffArray(gxdep, slewx, len_gydep);
    diffArray(gydep, slewy, len_gydep);
    slewx[len_gydep - 1] = 0;
    slewy[len_gydep - 1] = 0;
    scalecomplex(slewx, slewy, 1.0f / T, 0.0f, len_gydep);
    sMax = maxMagnitude(slewx, slewy, len_gydep);
    gMax = maxMagnitude(gxdep, gydep, len_gydep);
    if (sMax > slewMax) {
      sscale = slewMax / sMax;
      rSMAX_gx = rSMAX_gx * sscale;
      if (1)
        printf("bipolar_prewinder: scaling Sx by %.3f\n", sscale);
    }
    if (gMax > gradMaxSys) {
      gscale = gradMaxSys / gMax;
      rGMAX_gx = rGMAX_gx * gscale;
      if (1)
        printf("bipolar_prewinder: scaling Gx by %.3f\n", gscale);
    }
    free(slewx);
    free(slewy);
    free(kxdep);
    free(gxdep1);
    free(sxdep);
    free(txdep);
    free(kydepR);
    free(gydepR);
    free(sydepR);
    free(tydepR);
    free(kydepT);
    free(gydepT);
    free(sydepT);
    free(tydepT);
    if (sMax <= (1 + errlevel) * slewMax && gMax <= (1 + errlevel) * gradMaxSys)
      break;
    else {
      free(gxdep);
      free(gydep);
    }
  }
  if (sMax > (1 + errlevel) * slewMax || gMax > (1 + errlevel) * gradMaxSys)
    printf("bipolar_prewinder: not enough iterations\n");
  *ktraj = (float *)malloc(2 * len_gydep * sizeof(float));
  *grad = (float *)malloc(2 * len_gydep * sizeof(float));
  *slew = (float *)malloc(2 * len_gydep * sizeof(float));
  *time = (float *)malloc(len_gydep * sizeof(float));
  memcpy(*grad, gxdep, len_gydep * sizeof(float));
  memcpy(&(*grad)[len_gydep], gydep, len_gydep * sizeof(float));
  ktrajx = *ktraj;
  ktrajy = &(*ktraj)[len_gydep];
  cumulativeSum(gxdep, ktrajx, len_gydep);
  cumulativeSum(gydep, ktrajy, len_gydep);
  scalecomplex(ktrajx, ktrajy, 4257 * T, 0.0f, len_gydep);
  for (n = 0; n < len_gydep; n++)
    (*time)[n] = n * T;
  *N = len_gydep;
  return;
}


x86 assembly (clang, -O0):
<grd_bipolar_prewinder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
movss  %xmm6,-0x1c(%rbp)
mov    %rdi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
mov    %rdx,-0x38(%rbp)
mov    %rcx,-0x40(%rbp)
mov    %r8,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
movq   $0x0,-0x100(%rbp)
movq   $0x0,-0x108(%rbp)
movq   $0x0,-0x110(%rbp)
movq   $0x0,-0x118(%rbp)
movq   $0x0,-0x128(%rbp)
movss  0xd8f(%rip),%xmm0
movss  %xmm0,-0x12c(%rbp)
ff
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd66(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x134(%rbp)
ff
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd45(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x138(%rbp)
ff
movl   $0x0,-0x130(%rbp)
cmpl   $0x32,-0x130(%rbp)
jge    195e <grd_bipolar_prewinder+0x76e>
movss  -0x138(%rbp),%xmm0
ff
movss  -0x134(%rbp),%xmm1
ff
movss  -0x14(%rbp),%xmm2
movss  -0x10(%rbp),%xmm3
lea    -0x60(%rbp),%rdi
lea    -0x68(%rbp),%rsi
lea    -0x70(%rbp),%rdx
lea    -0x78(%rbp),%rcx
lea    -0x7c(%rbp),%r8
lea    -0x11c(%rbp),%r9
call   10d0 <grd_trapezoid@plt>
mov    -0x78(%rbp),%rax
mov    -0x7c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x140(%rbp)
ff
movsd  0xcca(%rip),%xmm0
call   10f0 <sqrt@plt>
movss  -0x140(%rbp),%xmm0
ff
add    $0x1,%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x80(%rbp)
movss  -0x1c(%rbp),%xmm0
divss  -0x80(%rbp),%xmm0
movss  %xmm0,-0x84(%rbp)
ff
movss  -0x8(%rbp),%xmm0
movss  -0x84(%rbp),%xmm1
ff
movss  -0x1c(%rbp),%xmm2
movss  -0x10(%rbp),%xmm3
lea    -0x90(%rbp),%rdi
lea    -0x98(%rbp),%rsi
lea    -0xa0(%rbp),%rdx
lea    -0xa8(%rbp),%rcx
lea    -0xac(%rbp),%r8
call   10e0 <grd_rampup@plt>
movss  0xc60(%rip),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x13c(%rbp)
ff
mov    -0x98(%rbp),%rdi
mov    -0xac(%rbp),%esi
call   1090 <sumfloats@plt>
movss  -0x13c(%rbp),%xmm0
ff
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0xb0(%rbp)
ff
movss  -0x8(%rbp),%xmm0
movss  -0x84(%rbp),%xmm1
ff
movss  -0xb0(%rbp),%xmm2
ff
movd   %xmm2,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
addss  -0x18(%rbp),%xmm2
movss  -0x10(%rbp),%xmm3
lea    -0xb8(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
lea    -0xc8(%rbp),%rdx
lea    -0xd0(%rbp),%rcx
lea    -0xd4(%rbp),%r8
lea    -0x11c(%rbp),%r9
call   10d0 <grd_trapezoid@plt>
mov    -0xac(%rbp),%eax
add    -0xd4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xd8(%rbp)
movslq -0xd8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0xc0(%rbp),%rsi
movslq -0xd4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   10a0 <memcpy@plt>
mov    -0x58(%rbp),%rdi
movslq -0xd4(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x98(%rbp),%rsi
add    $0x4,%rsi
mov    -0xac(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edx
call   10a0 <memcpy@plt>
movslq -0xd8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,-0xe0(%rbp)
movslq -0xd8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x11c(%rbp)
mov    -0x11c(%rbp),%eax
cmp    -0xd8(%rbp),%eax
jge    1568 <grd_bipolar_prewinder+0x378>
cvtsi2ssl -0x11c(%rbp),%xmm0
ff
cvtsi2ssl -0x7c(%rbp),%xmm1
movss  0xaf7(%rip),%xmm2
subss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
cvtsi2ssl -0xd8(%rbp),%xmm1
ff
movss  0xadf(%rip),%xmm2
subss  %xmm2,%xmm1
divss  %xmm1,%xmm0
mov    -0xe0(%rbp),%rax
movslq -0x11c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x11c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x11c(%rbp)
jmp    14fa <grd_bipolar_prewinder+0x30a>
cmpq   $0x0,-0x128(%rbp)
je     1582 <grd_bipolar_prewinder+0x392>
mov    -0x128(%rbp),%rdi
call   1030 <free@plt>
movslq -0x7c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x128(%rbp)
movl   $0x0,-0x11c(%rbp)
mov    -0x11c(%rbp),%eax
cmp    -0x7c(%rbp),%eax
jge    15e0 <grd_bipolar_prewinder+0x3f0>
cvtsi2ssl -0x11c(%rbp),%xmm0
ff
mov    -0x128(%rbp),%rax
movslq -0x11c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x11c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x11c(%rbp)
jmp    15a2 <grd_bipolar_prewinder+0x3b2>
mov    -0x128(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x7c(%rbp),%edx
mov    -0xe0(%rbp),%rcx
mov    -0x50(%rbp),%r8
mov    -0xd8(%rbp),%r9d
call   1100 <interpolatefloats@plt>
movss  0xa07(%rip),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x144(%rbp)
ff
mov    -0x50(%rbp),%rdi
mov    -0x7c(%rbp),%esi
call   1090 <sumfloats@plt>
movss  -0x144(%rbp),%xmm0
ff
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0xe4(%rbp)
ff
movss  -0xe4(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    165d <grd_bipolar_prewinder+0x46d>
jp     165d <grd_bipolar_prewinder+0x46d>
jmp    1697 <grd_bipolar_prewinder+0x4a7>
mov    -0x50(%rbp),%rax
mov    %rax,-0x150(%rbp)
mov    -0x7c(%rbp),%eax
mov    %eax,-0x148(%rbp)
movss  -0x14(%rbp),%xmm0
divss  -0xe4(%rbp),%xmm0
ff
call   1080 <fabs@plt>
mov    -0x150(%rbp),%rdi
mov    -0x148(%rbp),%esi
mov    %eax,%edx
call   1060 <scalefloats@plt>
movslq -0xd8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x100(%rbp)
movslq -0xd8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x108(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x100(%rbp),%rsi
mov    -0xd8(%rbp),%edx
call   10b0 <diffArray@plt>
mov    -0x58(%rbp),%rdi
mov    -0x108(%rbp),%rsi
mov    -0xd8(%rbp),%edx
call   10b0 <diffArray@plt>
mov    -0x100(%rbp),%rax
mov    -0xd8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x108(%rbp),%rax
mov    -0xd8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x100(%rbp),%rdi
mov    -0x108(%rbp),%rsi
movss  0x8d7(%rip),%xmm0
divss  -0x10(%rbp),%xmm0
cvttss2si %xmm0,%edx
mov    -0xd8(%rbp),%ecx
xorps  %xmm0,%xmm0
call   1040 <scalecomplex@plt>
mov    -0x100(%rbp),%rdi
mov    -0x108(%rbp),%rsi
mov    -0xd8(%rbp),%edx
call   1050 <maxMagnitude@plt>
movss  %xmm0,-0xe8(%rbp)
ff
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0xd8(%rbp),%edx
call   1050 <maxMagnitude@plt>
movss  %xmm0,-0xec(%rbp)
ff
movss  -0xe8(%rbp),%xmm0
ff
ucomiss -0xc(%rbp),%xmm0
jbe    17ed <grd_bipolar_prewinder+0x5fd>
movss  -0xc(%rbp),%xmm0
divss  -0xe8(%rbp),%xmm0
ff
movss  %xmm0,-0xf0(%rbp)
ff
movss  -0x134(%rbp),%xmm0
ff
mulss  -0xf0(%rbp),%xmm0
ff
movss  %xmm0,-0x134(%rbp)
ff
movss  -0xf0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0x836(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movss  -0xec(%rbp),%xmm0
ff
ucomiss -0x8(%rbp),%xmm0
jbe    1846 <grd_bipolar_prewinder+0x656>
movss  -0x8(%rbp),%xmm0
divss  -0xec(%rbp),%xmm0
ff
movss  %xmm0,-0xf4(%rbp)
ff
movss  -0x138(%rbp),%xmm0
ff
mulss  -0xf4(%rbp),%xmm0
ff
movss  %xmm0,-0x138(%rbp)
ff
movss  -0xf4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0x804(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
mov    -0x100(%rbp),%rdi
call   1030 <free@plt>
mov    -0x108(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
mov    -0x78(%rbp),%rdi
call   1030 <free@plt>
mov    -0x90(%rbp),%rdi
call   1030 <free@plt>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
mov    -0xa0(%rbp),%rdi
call   1030 <free@plt>
mov    -0xa8(%rbp),%rdi
call   1030 <free@plt>
mov    -0xb8(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc0(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc8(%rbp),%rdi
call   1030 <free@plt>
mov    -0xd0(%rbp),%rdi
call   1030 <free@plt>
movss  -0xe8(%rbp),%xmm1
ff
movss  0x726(%rip),%xmm0
addss  -0x12c(%rbp),%xmm0
ff
mulss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     1933 <grd_bipolar_prewinder+0x743>
movss  -0xec(%rbp),%xmm1
ff
movss  0x700(%rip),%xmm0
addss  -0x12c(%rbp),%xmm0
ff
mulss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     1933 <grd_bipolar_prewinder+0x743>
jmp    195e <grd_bipolar_prewinder+0x76e>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
jmp    194a <grd_bipolar_prewinder+0x75a>
mov    -0x130(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x130(%rbp)
jmp    12d5 <grd_bipolar_prewinder+0xe5>
movss  -0xe8(%rbp),%xmm0
ff
movss  0x6aa(%rip),%xmm1
addss  -0x12c(%rbp),%xmm1
ff
mulss  -0xc(%rbp),%xmm1
ucomiss %xmm1,%xmm0
ja     19aa <grd_bipolar_prewinder+0x7ba>
movss  -0xec(%rbp),%xmm0
ff
movss  0x684(%rip),%xmm1
addss  -0x12c(%rbp),%xmm1
ff
mulss  -0x8(%rbp),%xmm1
ucomiss %xmm1,%xmm0
jbe    19b8 <grd_bipolar_prewinder+0x7c8>
lea    0x6b9(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0xd8(%rbp),%eax
shl    $0x1,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0xd8(%rbp),%eax
shl    $0x1,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
mov    -0xd8(%rbp),%eax
shl    $0x1,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
mov    %rcx,(%rax)
movslq -0xd8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
mov    -0x50(%rbp),%rsi
movslq -0xd8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   10a0 <memcpy@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
movslq -0xd8(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x58(%rbp),%rsi
movslq -0xd8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   10a0 <memcpy@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x110(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
movslq -0xd8(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x118(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x110(%rbp),%rsi
mov    -0xd8(%rbp),%edx
call   1110 <cumulativeSum@plt>
mov    -0x58(%rbp),%rdi
mov    -0x118(%rbp),%rsi
mov    -0xd8(%rbp),%edx
call   1110 <cumulativeSum@plt>
mov    -0x110(%rbp),%rdi
mov    -0x118(%rbp),%rsi
movss  0x52c(%rip),%xmm0
mulss  -0x10(%rbp),%xmm0
cvttss2si %xmm0,%edx
mov    -0xd8(%rbp),%ecx
xorps  %xmm0,%xmm0
call   1040 <scalecomplex@plt>
movl   $0x0,-0x11c(%rbp)
mov    -0x11c(%rbp),%eax
cmp    -0xd8(%rbp),%eax
jge    1b4f <grd_bipolar_prewinder+0x95f>
cvtsi2ssl -0x11c(%rbp),%xmm0
ff
mulss  -0x10(%rbp),%xmm0
mov    -0x40(%rbp),%rax
mov    (%rax),%rax
movslq -0x11c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x11c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x11c(%rbp)
jmp    1b09 <grd_bipolar_prewinder+0x919>
mov    -0xd8(%rbp),%ecx
mov    -0x48(%rbp),%rax
mov    %ecx,(%rax)
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grd_bipolar_prewinder>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x148,%rsp
mov    %r8,0xd0(%rsp)
mov    %rcx,0x70(%rsp)
mov    %rdx,0xc0(%rsp)
mov    %rsi,0xc8(%rsp)
mov    %rdi,0x78(%rsp)
movd   %xmm6,0x4c(%rsp)
movss  %xmm5,0x48(%rsp)
movss  %xmm4,0x2c(%rsp)
movaps %xmm2,%xmm4
unpcklps %xmm0,%xmm4
cvtps2pd %xmm4,%xmm0
mulpd  0xdaa(%rip),%xmm0
cvtpd2ps %xmm0,%xmm0
movapd %xmm0,0x60(%rsp)
movss  0xdf8(%rip),%xmm4
movss  0xdf4(%rip),%xmm0
divss  %xmm3,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,0x44(%rsp)
movaps %xmm3,0x50(%rsp)
mulss  %xmm3,%xmm4
movss  %xmm4,0x1c(%rsp)
movss  0xdd5(%rip),%xmm0
movaps %xmm2,0x130(%rsp)
mulss  %xmm0,%xmm2
movaps %xmm2,0x120(%rsp)
movss  %xmm1,0x18(%rsp)
mulss  %xmm1,%xmm0
movss  %xmm0,0x28(%rsp)
xor    %eax,%eax
mov    %rax,0x80(%rsp)
xor    %r13d,%r13d
jmp    130e <grd_bipolar_prewinder+0x10e>
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x80(%rsp),%rax
add    $0x1,%eax
movaps 0x60(%rsp),%xmm0
unpcklps 0xb0(%rsp),%xmm0
movaps %xmm0,0x60(%rsp)
mov    %rax,0x80(%rsp)
cmp    $0x32,%eax
je     1988 <grd_bipolar_prewinder+0x788>
movaps 0x60(%rsp),%xmm1
movaps %xmm1,%xmm0
shufps $0x55,%xmm1,%xmm0
movaps %xmm0,0xb0(%rsp)
movss  0x2c(%rsp),%xmm2
movaps 0x50(%rsp),%xmm3
lea    0x118(%rsp),%rdi
lea    0xa8(%rsp),%rsi
lea    0x110(%rsp),%rdx
lea    0xa0(%rsp),%rcx
lea    0x10(%rsp),%r8
lea    0x34(%rsp),%rbx
mov    %rbx,%r9
call   10e0 <grd_trapezoid@plt>
mov    0xa0(%rsp),%rax
movslq 0x10(%rsp),%rcx
movss  -0x4(%rax,%rcx,4),%xmm0
movss  %xmm0,0xc(%rsp)
movsd  0xcf8(%rip),%xmm0
call   1100 <sqrt@plt>
add    $0x1,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  0xc(%rsp),%xmm3
divss  %xmm0,%xmm3
movss  0x4c(%rsp),%xmm2
movaps %xmm2,%xmm1
divss  %xmm3,%xmm1
movss  %xmm1,0xc(%rsp)
movss  0x18(%rsp),%xmm0
movaps 0x50(%rsp),%xmm3
lea    0x108(%rsp),%rdi
lea    0x38(%rsp),%rsi
lea    0x100(%rsp),%rdx
lea    0xf8(%rsp),%rcx
lea    0x24(%rsp),%r8
call   10f0 <grd_rampup@plt>
mov    0x38(%rsp),%rdi
mov    0x24(%rsp),%esi
call   10a0 <sumfloats@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0x1c(%rsp),%xmm0
movss  0x48(%rsp),%xmm2
subss  %xmm0,%xmm2
movss  0x18(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movaps 0x50(%rsp),%xmm3
lea    0xf0(%rsp),%rdi
lea    0x98(%rsp),%rsi
lea    0xe8(%rsp),%rdx
lea    0xe0(%rsp),%rcx
lea    0x20(%rsp),%r8
mov    %rbx,%r9
call   10e0 <grd_trapezoid@plt>
movslq 0x24(%rsp),%rax
movslq 0x20(%rsp),%rbp
add    %rax,%rbp
lea    -0x1(%rbp),%r12d
lea    -0x4(,%rbp,4),%r15d
ff
mov    %r15d,%edi
call   10d0 <malloc@plt>
mov    %rax,%rbx
mov    0x98(%rsp),%rsi
mov    0x20(%rsp),%edx
shl    $0x2,%edx
mov    %rax,%rdi
call   10b0 <memcpy@plt>
movslq 0x20(%rsp),%rax
mov    %rbx,0x90(%rsp)
lea    (%rbx,%rax,4),%rdi
mov    0x38(%rsp),%rsi
add    $0x4,%rsi
mov    0x24(%rsp),%eax
lea    -0x4(,%rax,4),%edx
call   10b0 <memcpy@plt>
mov    %r15d,%edi
call   10d0 <malloc@plt>
mov    %rax,%r14
mov    %r15d,0x30(%rsp)
mov    %r15d,%edi
call   10d0 <malloc@plt>
mov    %rax,%r15
mov    $0x0,%edx
mov    %rbp,0x88(%rsp)
cmp    $0x2,%ebp
jl     15d1 <grd_bipolar_prewinder+0x3d1>
xorps  %xmm0,%xmm0
cvtsi2ssl 0x10(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2ss %r12d,%xmm1
movss  0xb7c(%rip),%xmm2
addss  %xmm2,%xmm0
addss  %xmm2,%xmm1
mov    %r12d,%eax
cmp    $0x4,%r12d
jae    1510 <grd_bipolar_prewinder+0x310>
xor    %ecx,%ecx
jmp    15b0 <grd_bipolar_prewinder+0x3b0>
nopl   0x0(%rax,%rax,1)
mov    %eax,%ecx
and    $0xfffffffc,%ecx
movaps %xmm0,%xmm2
shufps $0x0,%xmm0,%xmm2
movaps %xmm1,%xmm3
shufps $0x0,%xmm1,%xmm3
lea    -0x4(%rcx),%rsi
mov    %rsi,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
test   %rsi,%rsi
je     1970 <grd_bipolar_prewinder+0x770>
mov    %rdx,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %esi,%esi
movaps 0xac5(%rip),%xmm4
movdqa 0xacd(%rip),%xmm6
movdqa 0xad5(%rip),%xmm7
nopl   0x0(%rax,%rax,1)
cvtdq2ps %xmm4,%xmm5
mulps  %xmm2,%xmm5
divps  %xmm3,%xmm5
movups %xmm5,(%r14,%rsi,4)
movaps %xmm4,%xmm5
paddd  %xmm6,%xmm5
cvtdq2ps %xmm5,%xmm5
mulps  %xmm2,%xmm5
divps  %xmm3,%xmm5
movups %xmm5,0x10(%r14,%rsi,4)
add    $0x8,%rsi
paddd  %xmm7,%xmm4
add    $0xfffffffffffffffe,%rdi
jne    1560 <grd_bipolar_prewinder+0x360>
test   $0x1,%dl
je     15a5 <grd_bipolar_prewinder+0x3a5>
cvtdq2ps %xmm4,%xmm4
mulps  %xmm4,%xmm2
divps  %xmm3,%xmm2
movups %xmm2,(%r14,%rsi,4)
mov    %r12d,%edx
cmp    %rax,%rcx
je     15d1 <grd_bipolar_prewinder+0x3d1>
nopl   (%rax)
xorps  %xmm2,%xmm2
cvtsi2ss %ecx,%xmm2
mulss  %xmm0,%xmm2
divss  %xmm1,%xmm2
movss  %xmm2,(%r14,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    15b0 <grd_bipolar_prewinder+0x3b0>
mov    %r12d,%edx
mov    %edx,0x34(%rsp)
test   %r13,%r13
je     15e2 <grd_bipolar_prewinder+0x3e2>
mov    %r13,%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%edi
shl    $0x2,%edi
call   10d0 <malloc@plt>
mov    %rax,%r13
mov    0x10(%rsp),%edx
test   %edx,%edx
jle    1610 <grd_bipolar_prewinder+0x410>
cmp    $0x8,%edx
jae    1620 <grd_bipolar_prewinder+0x420>
xor    %eax,%eax
jmp    16f0 <grd_bipolar_prewinder+0x4f0>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
jmp    1709 <grd_bipolar_prewinder+0x509>
nopw   0x0(%rax,%rax,1)
mov    %edx,%eax
and    $0xfffffff8,%eax
lea    -0x8(%rax),%rsi
mov    %rsi,%rcx
shr    $0x3,%rcx
add    $0x1,%rcx
test   %rsi,%rsi
movdqa 0x9e1(%rip),%xmm3
movdqa 0x9e9(%rip),%xmm4
movdqa 0x9f1(%rip),%xmm5
movdqa 0x9f9(%rip),%xmm6
je     1958 <grd_bipolar_prewinder+0x758>
mov    %rcx,%rdi
movabs $0x3ffffffffffffffe,%rsi
ff ff 3f
and    %rsi,%rdi
xor    %esi,%esi
movdqa 0x999(%rip),%xmm0
nopw   0x0(%rax,%rax,1)
movdqa %xmm0,%xmm1
paddd  %xmm3,%xmm1
cvtdq2ps %xmm0,%xmm2
cvtdq2ps %xmm1,%xmm1
movups %xmm2,0x0(%r13,%rsi,4)
movups %xmm1,0x10(%r13,%rsi,4)
movdqa %xmm0,%xmm1
paddd  %xmm4,%xmm1
movdqa %xmm0,%xmm2
paddd  %xmm5,%xmm2
cvtdq2ps %xmm1,%xmm1
cvtdq2ps %xmm2,%xmm2
movups %xmm1,0x20(%r13,%rsi,4)
movups %xmm2,0x30(%r13,%rsi,4)
add    $0x10,%rsi
paddd  %xmm6,%xmm0
add    $0xfffffffffffffffe,%rdi
jne    1680 <grd_bipolar_prewinder+0x480>
test   $0x1,%cl
je     16e5 <grd_bipolar_prewinder+0x4e5>
cvtdq2ps %xmm0,%xmm1
paddd  %xmm3,%xmm0
cvtdq2ps %xmm0,%xmm0
movups %xmm1,0x0(%r13,%rsi,4)
movups %xmm0,0x10(%r13,%rsi,4)
cmp    %rdx,%rax
je     1707 <grd_bipolar_prewinder+0x507>
nopw   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x0(%r13,%rax,4)
add    $0x1,%rax
cmp    %rax,%rdx
jne    16f0 <grd_bipolar_prewinder+0x4f0>
mov    %edx,%eax
mov    %eax,0x34(%rsp)
mov    0xa8(%rsp),%rsi
mov    %r13,%rdi
mov    %r14,%rcx
mov    %r15,%r8
mov    %r12d,%r9d
call   1110 <interpolatefloats@plt>
mov    0x10(%rsp),%esi
mov    %r15,%rdi
call   10a0 <sumfloats@plt>
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
mulss  0x1c(%rsp),%xmm1
ucomiss 0x92a(%rip),%xmm1
jne    174a <grd_bipolar_prewinder+0x54a>
jnp    1769 <grd_bipolar_prewinder+0x569>
mov    0x10(%rsp),%ebx
movss  0x2c(%rsp),%xmm0
divss  %xmm1,%xmm0
call   1090 <fabs@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1070 <scalefloats@plt>
mov    0x30(%rsp),%ebx
mov    %ebx,%edi
call   10d0 <malloc@plt>
mov    %r15,%rbp
mov    %rax,%r15
mov    %ebx,%edi
call   10d0 <malloc@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r12d,%edx
call   10c0 <diffArray@plt>
mov    0x90(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r12d,%edx
call   10c0 <diffArray@plt>
mov    0x88(%rsp),%rax
movl   $0x0,-0x8(%r15,%rax,4)
movl   $0x0,-0x8(%rbx,%rax,4)
xorps  %xmm0,%xmm0
mov    %r15,%rdi
mov    %rbx,%rsi
mov    0x44(%rsp),%edx
mov    %r12d,%ecx
call   1040 <scalecomplex@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12d,%edx
call   1060 <maxMagnitude@plt>
movss  %xmm0,0xc(%rsp)
mov    %r12,%rdx
mov    %rbp,%r12
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %rdx,0xd8(%rsp)
call   1060 <maxMagnitude@plt>
movss  0xc(%rsp),%xmm1
ucomiss 0x130(%rsp),%xmm1
movss  %xmm0,0x14(%rsp)
jbe    184d <grd_bipolar_prewinder+0x64d>
movaps 0x130(%rsp),%xmm0
divss  0xc(%rsp),%xmm0
movaps 0x60(%rsp),%xmm1
mulss  %xmm0,%xmm1
movaps %xmm1,0x60(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0x840(%rip),%rdi
mov    $0x1,%al
call   1080 <printf@plt>
movss  0x14(%rsp),%xmm0
ucomiss 0x18(%rsp),%xmm0
jbe    1886 <grd_bipolar_prewinder+0x686>
movss  0x18(%rsp),%xmm0
divss  0x14(%rsp),%xmm0
movaps 0xb0(%rsp),%xmm1
mulss  %xmm0,%xmm1
movaps %xmm1,0xb0(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0x828(%rip),%rdi
mov    $0x1,%al
call   1080 <printf@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x118(%rsp),%rdi
call   1030 <free@plt>
mov    0xa8(%rsp),%rdi
call   1030 <free@plt>
mov    0x110(%rsp),%rdi
call   1030 <free@plt>
mov    0xa0(%rsp),%rdi
call   1030 <free@plt>
mov    0x108(%rsp),%rdi
call   1030 <free@plt>
mov    0x38(%rsp),%rdi
call   1030 <free@plt>
mov    0x100(%rsp),%rdi
call   1030 <free@plt>
mov    0xf8(%rsp),%rdi
call   1030 <free@plt>
mov    0xf0(%rsp),%rdi
call   1030 <free@plt>
mov    0x98(%rsp),%rdi
call   1030 <free@plt>
mov    0xe8(%rsp),%rdi
call   1030 <free@plt>
mov    0xe0(%rsp),%rdi
call   1030 <free@plt>
movaps 0x120(%rsp),%xmm0
ucomiss 0xc(%rsp),%xmm0
mov    %r12,%r15
jb     12d0 <grd_bipolar_prewinder+0xd0>
movss  0x28(%rsp),%xmm0
ucomiss 0x14(%rsp),%xmm0
jb     12d0 <grd_bipolar_prewinder+0xd0>
jmp    1988 <grd_bipolar_prewinder+0x788>
xor    %esi,%esi
movdqa 0x6ae(%rip),%xmm0
test   $0x1,%cl
jne    16cf <grd_bipolar_prewinder+0x4cf>
jmp    16e5 <grd_bipolar_prewinder+0x4e5>
xor    %esi,%esi
movdqa 0x696(%rip),%xmm4
test   $0x1,%dl
jne    1597 <grd_bipolar_prewinder+0x397>
jmp    15a5 <grd_bipolar_prewinder+0x3a5>
movss  0xc(%rsp),%xmm0
ucomiss 0x120(%rsp),%xmm0
ja     19a5 <grd_bipolar_prewinder+0x7a5>
movss  0x14(%rsp),%xmm0
ucomiss 0x28(%rsp),%xmm0
jbe    19b1 <grd_bipolar_prewinder+0x7b1>
lea    0x722(%rip),%rdi
call   1050 <puts@plt>
mov    0xd8(%rsp),%r12
lea    0x0(,%r12,8),%ebx
mov    %ebx,%edi
call   10d0 <malloc@plt>
mov    0x78(%rsp),%rcx
mov    %rax,(%rcx)
mov    %ebx,%edi
call   10d0 <malloc@plt>
mov    0xc8(%rsp),%r14
mov    %rax,(%r14)
mov    %ebx,%edi
call   10d0 <malloc@plt>
mov    0xc0(%rsp),%rcx
mov    %rax,(%rcx)
movslq %r12d,%r13
mov    0x30(%rsp),%ebx
mov    %ebx,%edi
call   10d0 <malloc@plt>
mov    0x70(%rsp),%rcx
mov    %rax,(%rcx)
mov    (%r14),%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   10b0 <memcpy@plt>
lea    0x0(,%r13,4),%rdi
add    (%r14),%rdi
mov    0x90(%rsp),%rbp
mov    %rbp,%rsi
mov    %ebx,%edx
call   10b0 <memcpy@plt>
mov    0x78(%rsp),%rax
mov    (%rax),%rbx
lea    (%rbx,%r13,4),%r14
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12d,%edx
call   1120 <cumulativeSum@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r12d,%edx
call   1120 <cumulativeSum@plt>
cvttss2si 0x1c(%rsp),%edx
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12d,%ecx
call   1040 <scalecomplex@plt>
cmpl   $0x2,0x88(%rsp)
02
movaps 0x50(%rsp),%xmm1
jl     1b99 <grd_bipolar_prewinder+0x999>
mov    0x70(%rsp),%rax
mov    (%rax),%rax
mov    %r12d,%ecx
cmp    $0x8,%r12d
jae    1a9e <grd_bipolar_prewinder+0x89e>
xor    %edx,%edx
jmp    1b80 <grd_bipolar_prewinder+0x980>
mov    %ecx,%edx
and    $0xfffffff8,%edx
movaps %xmm1,%xmm0
shufps $0x0,%xmm1,%xmm0
lea    -0x8(%rdx),%rsi
mov    %rsi,%rdi
shr    $0x3,%rdi
add    $0x1,%rdi
test   %rsi,%rsi
je     1bb6 <grd_bipolar_prewinder+0x9b6>
movabs $0x3ffffffffffffffe,%rbp
ff ff 3f
and    %rdi,%rbp
movdqa 0x539(%rip),%xmm1
xor    %esi,%esi
movdqa 0x53f(%rip),%xmm4
movdqa 0x547(%rip),%xmm5
movdqa 0x54f(%rip),%xmm6
movdqa 0x557(%rip),%xmm7
nopl   0x0(%rax)
movdqa %xmm1,%xmm2
paddd  %xmm4,%xmm2
cvtdq2ps %xmm1,%xmm3
cvtdq2ps %xmm2,%xmm2
mulps  %xmm0,%xmm3
mulps  %xmm0,%xmm2
movups %xmm3,(%rax,%rsi,4)
movups %xmm2,0x10(%rax,%rsi,4)
movdqa %xmm1,%xmm2
paddd  %xmm5,%xmm2
movdqa %xmm1,%xmm3
paddd  %xmm6,%xmm3
cvtdq2ps %xmm2,%xmm2
cvtdq2ps %xmm3,%xmm3
mulps  %xmm0,%xmm2
mulps  %xmm0,%xmm3
movups %xmm2,0x20(%rax,%rsi,4)
movups %xmm3,0x30(%rax,%rsi,4)
add    $0x10,%rsi
paddd  %xmm7,%xmm1
add    $0xfffffffffffffffe,%rbp
jne    1b00 <grd_bipolar_prewinder+0x900>
test   $0x1,%dil
je     1b74 <grd_bipolar_prewinder+0x974>
cvtdq2ps %xmm1,%xmm2
paddd  0x4be(%rip),%xmm1
cvtdq2ps %xmm1,%xmm1
mulps  %xmm0,%xmm2
mulps  %xmm0,%xmm1
movups %xmm2,(%rax,%rsi,4)
movups %xmm1,0x10(%rax,%rsi,4)
cmp    %rcx,%rdx
movaps 0x50(%rsp),%xmm1
je     1b99 <grd_bipolar_prewinder+0x999>
xchg   %ax,%ax
xorps  %xmm0,%xmm0
cvtsi2ss %edx,%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,(%rax,%rdx,4)
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1b80 <grd_bipolar_prewinder+0x980>
mov    0xd0(%rsp),%rax
mov    %r12d,(%rax)
add    $0x148,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movdqa 0x452(%rip),%xmm1
xor    %esi,%esi
test   $0x1,%dil
jne    1b57 <grd_bipolar_prewinder+0x957>
jmp    1b74 <grd_bipolar_prewinder+0x974>

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

LLVM IR (-O2):
@.str = [39 x i8] c"bipolar_prewinder: scaling Sx by %.3f\0A\00"
@.str.1 = [39 x i8] c"bipolar_prewinder: scaling Gx by %.3f\0A\00"
@str = [41 x i8] c"bipolar_prewinder: not enough iterations\00"
define void @grd_bipolar_prewinder(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float** nocapture %7, float** nocapture %8, float** nocapture writeonly %9, float** nocapture %10, i32* nocapture writeonly %11) {
%13 = alloca float*
%14 = alloca float*
%15 = alloca float*
%16 = alloca float*
%17 = alloca i32
%18 = alloca float*
%19 = alloca float*
%20 = alloca float*
%21 = alloca float*
%22 = alloca i32
%23 = alloca float*
%24 = alloca float*
%25 = alloca float*
%26 = alloca float*
%27 = alloca i32
%28 = alloca i32
%29 = bitcast float** %13 to i8*
%30 = bitcast float** %14 to i8*
%31 = bitcast float** %15 to i8*
%32 = bitcast float** %16 to i8*
%33 = bitcast i32* %17 to i8*
%34 = bitcast float** %18 to i8*
%35 = bitcast float** %19 to i8*
%36 = bitcast float** %20 to i8*
%37 = bitcast float** %21 to i8*
%38 = bitcast i32* %22 to i8*
%39 = bitcast float** %23 to i8*
%40 = bitcast float** %24 to i8*
%41 = bitcast float** %25 to i8*
%42 = bitcast float** %26 to i8*
%43 = bitcast i32* %27 to i8*
%44 = bitcast i32* %28 to i8*
%45 = insertelement <2 x float> poison, float %2, i64 0
%46 = insertelement <2 x float> %45, float %0, i64 1
%47 = fpext <2 x float> %46 to <2 x double>
%48 = fmul <2 x double> %47, <double 0x3FEF5C28F5C28F5C, double 0x3FEF5C28F5C28F5C>
%49 = fptrunc <2 x double> %48 to <2 x float>
%50 = fmul float %3, 4.257000e+03
%51 = fdiv float 1.000000e+00, %3
%52 = fptosi float %51 to i32
%53 = fmul float %2, 0x3FF00068E0000000
%54 = fmul float %1, 0x3FF00068E0000000
br label %55
55: ; preds = %12, %314
%56 = phi i32 [ 0, %12 ], [ %317, %314 ]
%57 = phi float* [ null, %12 ], [ %179, %314 ]
%58 = phi <2 x float> [ %49, %12 ], [ %320, %314 ]
%59 = extractelement <2 x float> %58, i64 0
%60 = extractelement <2 x float> %58, i64 1
%61 = call i32 @grd_trapezoid(float %60, float %59, float %4, float %3, float** %13, float** %14, float** %15, float** %16, i32* %17, i32* %28)
%62 = load float*, float** %16
%63 = load i32, i32* %17
%64 = add nsw i32 %63, -1
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds float, float* %62, i64 %65
%67 = load float, float* %66
%68 = call i32 @sqrt(double 2.000000e+00)
%69 = add nsw i32 %68, 1
%70 = sitofp i32 %69 to float
%71 = fdiv float %67, %70
%72 = fdiv float %6, %71
%73 = call i32 @grd_rampup(float %1, float %72, float %6, float %3, float** %18, float** %19, float** %20, float** %21, i32* %22)
%74 = load float*, float** %19
%75 = load i32, i32* %22
%76 = call i32 @sumfloats(float* %74, i32 %75)
%77 = sitofp i32 %76 to float
%78 = fmul float %50, %77
%79 = fsub float %5, %78
%80 = call i32 @grd_trapezoid(float %1, float %72, float %79, float %3, float** %23, float** %24, float** %25, float** %26, i32* %27, i32* %28)
%81 = load i32, i32* %22
%82 = load i32, i32* %27
%83 = add nsw i32 %82, %81
%84 = add nsw i32 %83, -1
%85 = shl i32 %84, 2
%86 = call i64 @malloc(i32 %85)
%87 = inttoptr i64 %86 to float*
%88 = load float*, float** %24
%89 = load i32, i32* %27
%90 = shl i32 %89, 2
%91 = call i32 @memcpy(float* %87, float* %88, i32 %90)
%92 = load i32, i32* %27
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds float, float* %87, i64 %93
%95 = load float*, float** %19
%96 = getelementptr inbounds float, float* %95, i64 1
%97 = load i32, i32* %22
%98 = shl i32 %97, 2
%99 = add i32 %98, -4
%100 = call i32 @memcpy(float* %94, float* %96, i32 %99)
%101 = call i64 @malloc(i32 %85)
%102 = inttoptr i64 %101 to float*
%103 = call i64 @malloc(i32 %85)
%104 = inttoptr i64 %103 to float*
%105 = icmp sgt i32 %83, 1
br i1 %105, label %106, label %170
106: ; preds = %55
%107 = load i32, i32* %17
%108 = sitofp i32 %107 to float
%109 = fadd float %108, -1.000000e+00
%110 = sitofp i32 %84 to float
%111 = fadd float %110, -1.000000e+00
%112 = zext i32 %84 to i64
%113 = icmp ult i32 %84, 4
br i1 %113, label %159, label %114
114: ; preds = %106
%115 = and i64 %112, 4294967292
%116 = insertelement <4 x float> poison, float %109, i64 0
%117 = shufflevector <4 x float> %116, <4 x float> poison, <4 x i32> zeroinitializer
%118 = insertelement <4 x float> poison, float %111, i64 0
%119 = shufflevector <4 x float> %118, <4 x float> poison, <4 x i32> zeroinitializer
%120 = add nsw i64 %115, -4
%121 = lshr exact i64 %120, 2
%122 = add nuw nsw i64 %121, 1
%123 = and i64 %122, 1
%124 = icmp eq i64 %120, 0
br i1 %124, label %147, label %125
125: ; preds = %114
%126 = and i64 %122, 9223372036854775806
br label %127
127: ; preds = %127, %125
%128 = phi i64 [ 0, %125 ], [ %143, %127 ]
%129 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %125 ], [ %144, %127 ]
%130 = phi i64 [ 0, %125 ], [ %145, %127 ]
%131 = sitofp <4 x i32> %129 to <4 x float>
%132 = fmul <4 x float> %117, %131
%133 = fdiv <4 x float> %132, %119
%134 = getelementptr inbounds float, float* %102, i64 %128
%135 = bitcast float* %134 to <4 x float>*
store <4 x float> %133, <4 x float>* %135
%136 = or i64 %128, 4
%137 = add <4 x i32> %129, <i32 4, i32 4, i32 4, i32 4>
%138 = sitofp <4 x i32> %137 to <4 x float>
%139 = fmul <4 x float> %117, %138
%140 = fdiv <4 x float> %139, %119
%141 = getelementptr inbounds float, float* %102, i64 %136
%142 = bitcast float* %141 to <4 x float>*
store <4 x float> %140, <4 x float>* %142
%143 = add nuw i64 %128, 8
%144 = add <4 x i32> %129, <i32 8, i32 8, i32 8, i32 8>
%145 = add i64 %130, 2
%146 = icmp eq i64 %145, %126
br i1 %146, label %147, label %127
147: ; preds = %127, %114
%148 = phi i64 [ 0, %114 ], [ %143, %127 ]
%149 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %114 ], [ %144, %127 ]
%150 = icmp eq i64 %123, 0
br i1 %150, label %157, label %151
151: ; preds = %147
%152 = sitofp <4 x i32> %149 to <4 x float>
%153 = fmul <4 x float> %117, %152
%154 = fdiv <4 x float> %153, %119
%155 = getelementptr inbounds float, float* %102, i64 %148
%156 = bitcast float* %155 to <4 x float>*
store <4 x float> %154, <4 x float>* %156
br label %157
157: ; preds = %147, %151
%158 = icmp eq i64 %115, %112
br i1 %158, label %170, label %159
159: ; preds = %106, %157
%160 = phi i64 [ 0, %106 ], [ %115, %157 ]
br label %161
161: ; preds = %159, %161
%162 = phi i64 [ %168, %161 ], [ %160, %159 ]
%163 = trunc i64 %162 to i32
%164 = sitofp i32 %163 to float
%165 = fmul float %109, %164
%166 = fdiv float %165, %111
%167 = getelementptr inbounds float, float* %102, i64 %162
store float %166, float* %167
%168 = add nuw nsw i64 %162, 1
%169 = icmp eq i64 %168, %112
br i1 %169, label %170, label %161
170: ; preds = %161, %157, %55
%171 = phi i32 [ 0, %55 ], [ %84, %157 ], [ %84, %161 ]
store i32 %171, i32* %28
%172 = icmp eq float* %57, null
br i1 %172, label %175, label %173
173: ; preds = %170
%174 = call i32 @free(float* %57)
br label %175
175: ; preds = %173, %170
%176 = load i32, i32* %17
%177 = shl i32 %176, 2
%178 = call i64 @malloc(i32 %177)
%179 = inttoptr i64 %178 to float*
%180 = load i32, i32* %17
%181 = icmp sgt i32 %180, 0
br i1 %181, label %182, label %241
182: ; preds = %175
%183 = zext i32 %180 to i64
%184 = icmp ult i32 %180, 8
br i1 %184, label %232, label %185
185: ; preds = %182
%186 = and i64 %183, 4294967288
%187 = add nsw i64 %186, -8
%188 = lshr exact i64 %187, 3
%189 = add nuw nsw i64 %188, 1
%190 = and i64 %189, 1
%191 = icmp eq i64 %187, 0
br i1 %191, label %218, label %192
192: ; preds = %185
%193 = and i64 %189, 4611686018427387902
br label %194
194: ; preds = %194, %192
%195 = phi i64 [ 0, %192 ], [ %214, %194 ]
%196 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %192 ], [ %215, %194 ]
%197 = phi i64 [ 0, %192 ], [ %216, %194 ]
%198 = add <4 x i32> %196, <i32 4, i32 4, i32 4, i32 4>
%199 = sitofp <4 x i32> %196 to <4 x float>
%200 = sitofp <4 x i32> %198 to <4 x float>
%201 = getelementptr inbounds float, float* %179, i64 %195
%202 = bitcast float* %201 to <4 x float>*
store <4 x float> %199, <4 x float>* %202
%203 = getelementptr inbounds float, float* %201, i64 4
%204 = bitcast float* %203 to <4 x float>*
store <4 x float> %200, <4 x float>* %204
%205 = or i64 %195, 8
%206 = add <4 x i32> %196, <i32 8, i32 8, i32 8, i32 8>
%207 = add <4 x i32> %196, <i32 12, i32 12, i32 12, i32 12>
%208 = sitofp <4 x i32> %206 to <4 x float>
%209 = sitofp <4 x i32> %207 to <4 x float>
%210 = getelementptr inbounds float, float* %179, i64 %205
%211 = bitcast float* %210 to <4 x float>*
store <4 x float> %208, <4 x float>* %211
%212 = getelementptr inbounds float, float* %210, i64 4
%213 = bitcast float* %212 to <4 x float>*
store <4 x float> %209, <4 x float>* %213
%214 = add nuw i64 %195, 16
%215 = add <4 x i32> %196, <i32 16, i32 16, i32 16, i32 16>
%216 = add i64 %197, 2
%217 = icmp eq i64 %216, %193
br i1 %217, label %218, label %194
218: ; preds = %194, %185
%219 = phi i64 [ 0, %185 ], [ %214, %194 ]
%220 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %185 ], [ %215, %194 ]
%221 = icmp eq i64 %190, 0
br i1 %221, label %230, label %222
222: ; preds = %218
%223 = add <4 x i32> %220, <i32 4, i32 4, i32 4, i32 4>
%224 = sitofp <4 x i32> %220 to <4 x float>
%225 = sitofp <4 x i32> %223 to <4 x float>
%226 = getelementptr inbounds float, float* %179, i64 %219
%227 = bitcast float* %226 to <4 x float>*
store <4 x float> %224, <4 x float>* %227
%228 = getelementptr inbounds float, float* %226, i64 4
%229 = bitcast float* %228 to <4 x float>*
store <4 x float> %225, <4 x float>* %229
br label %230
230: ; preds = %218, %222
%231 = icmp eq i64 %186, %183
br i1 %231, label %241, label %232
232: ; preds = %182, %230
%233 = phi i64 [ 0, %182 ], [ %186, %230 ]
br label %234
234: ; preds = %232, %234
%235 = phi i64 [ %239, %234 ], [ %233, %232 ]
%236 = trunc i64 %235 to i32
%237 = sitofp i32 %236 to float
%238 = getelementptr inbounds float, float* %179, i64 %235
store float %237, float* %238
%239 = add nuw nsw i64 %235, 1
%240 = icmp eq i64 %239, %183
br i1 %240, label %241, label %234
241: ; preds = %234, %230, %175
%242 = phi i32 [ 0, %175 ], [ %180, %230 ], [ %180, %234 ]
store i32 %242, i32* %28
%243 = load float*, float** %14
%244 = call i32 @interpolatefloats(float* %179, float* %243, i32 %180, float* %102, float* %104, i32 %84)
%245 = load i32, i32* %17
%246 = call i32 @sumfloats(float* %104, i32 %245)
%247 = sitofp i32 %246 to float
%248 = fmul float %50, %247
%249 = fcmp une float %248, 0.000000e+00
br i1 %249, label %250, label %255
250: ; preds = %241
%251 = load i32, i32* %17
%252 = fdiv float %4, %248
%253 = call i32 @fabs(float %252)
%254 = call i32 @scalefloats(float* %104, i32 %251, i32 %253)
br label %255
255: ; preds = %250, %241
%256 = call i64 @malloc(i32 %85)
%257 = inttoptr i64 %256 to float*
%258 = call i64 @malloc(i32 %85)
%259 = inttoptr i64 %258 to float*
%260 = call i32 @diffArray(float* %104, float* %257, i32 %84)
%261 = call i32 @diffArray(float* %87, float* %259, i32 %84)
%262 = add nsw i32 %83, -2
%263 = sext i32 %262 to i64
%264 = getelementptr inbounds float, float* %257, i64 %263
store float 0.000000e+00, float* %264
%265 = getelementptr inbounds float, float* %259, i64 %263
store float 0.000000e+00, float* %265
%266 = call i32 @scalecomplex(float* %257, float* %259, i32 %52, float 0.000000e+00, i32 %84)
%267 = call float @maxMagnitude(float* %257, float* %259, i32 %84)
%268 = call float @maxMagnitude(float* %104, float* %87, i32 %84)
%269 = fcmp ogt float %267, %2
br i1 %269, label %270, label %275
270: ; preds = %255
%271 = fdiv float %2, %267
%272 = fmul float %59, %271
%273 = fpext float %271 to double
%274 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), double %273)
br label %275
275: ; preds = %270, %255
%276 = phi float [ %272, %270 ], [ %59, %255 ]
%277 = fcmp ogt float %268, %1
br i1 %277, label %278, label %283
278: ; preds = %275
%279 = fdiv float %1, %268
%280 = fmul float %60, %279
%281 = fpext float %279 to double
%282 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), double %281)
br label %283
283: ; preds = %278, %275
%284 = phi float [ %280, %278 ], [ %60, %275 ]
%285 = call i32 @free(float* %257)
%286 = call i32 @free(float* %259)
%287 = load float*, float** %13
%288 = call i32 @free(float* %287)
%289 = load float*, float** %14
%290 = call i32 @free(float* %289)
%291 = load float*, float** %15
%292 = call i32 @free(float* %291)
%293 = load float*, float** %16
%294 = call i32 @free(float* %293)
%295 = load float*, float** %18
%296 = call i32 @free(float* %295)
%297 = load float*, float** %19
%298 = call i32 @free(float* %297)
%299 = load float*, float** %20
%300 = call i32 @free(float* %299)
%301 = load float*, float** %21
%302 = call i32 @free(float* %301)
%303 = load float*, float** %23
%304 = call i32 @free(float* %303)
%305 = load float*, float** %24
%306 = call i32 @free(float* %305)
%307 = load float*, float** %25
%308 = call i32 @free(float* %307)
%309 = load float*, float** %26
%310 = call i32 @free(float* %309)
%311 = fcmp ugt float %267, %53
%312 = fcmp ugt float %268, %54
%313 = select i1 %311, i1 true, i1 %312
br i1 %313, label %314, label %321
314: ; preds = %283
%315 = call i32 @free(float* %104)
%316 = call i32 @free(float* %87)
%317 = add nuw nsw i32 %56, 1
%318 = icmp eq i32 %317, 50
%319 = insertelement <2 x float> poison, float %276, i64 0
%320 = insertelement <2 x float> %319, float %284, i64 1
br i1 %318, label %321, label %55
321: ; preds = %314, %283
%322 = inttoptr i64 %86 to float*
%323 = inttoptr i64 %103 to float*
%324 = fcmp ogt float %267, %53
%325 = fcmp ogt float %268, %54
%326 = select i1 %324, i1 true, i1 %325
br i1 %326, label %327, label %329
327: ; preds = %321
%328 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
br label %329
329: ; preds = %321, %327
%330 = shl i32 %84, 3
%331 = call i64 @malloc(i32 %330)
%332 = inttoptr i64 %331 to float*
store float* %332, float** %7
%333 = call i64 @malloc(i32 %330)
%334 = inttoptr i64 %333 to float*
store float* %334, float** %8
%335 = call i64 @malloc(i32 %330)
%336 = inttoptr i64 %335 to float*
store float* %336, float** %9
%337 = sext i32 %84 to i64
%338 = call i64 @malloc(i32 %85)
%339 = inttoptr i64 %338 to float*
store float* %339, float** %10
%340 = load float*, float** %8
%341 = call i32 @memcpy(float* %340, float* %323, i32 %85)
%342 = load float*, float** %8
%343 = getelementptr inbounds float, float* %342, i64 %337
%344 = call i32 @memcpy(float* %343, float* %322, i32 %85)
%345 = load float*, float** %7
%346 = getelementptr inbounds float, float* %345, i64 %337
%347 = call i32 @cumulativeSum(float* %323, float* %345, i32 %84)
%348 = call i32 @cumulativeSum(float* %322, float* %346, i32 %84)
%349 = fptosi float %50 to i32
%350 = call i32 @scalecomplex(float* %345, float* %346, i32 %349, float 0.000000e+00, i32 %84)
br i1 %105, label %351, label %422
351: ; preds = %329
%352 = load float*, float** %10
%353 = zext i32 %84 to i64
%354 = icmp ult i32 %84, 8
br i1 %354, label %412, label %355
355: ; preds = %351
%356 = and i64 %353, 4294967288
%357 = insertelement <4 x float> poison, float %3, i64 0
%358 = shufflevector <4 x float> %357, <4 x float> poison, <4 x i32> zeroinitializer
%359 = insertelement <4 x float> poison, float %3, i64 0
%360 = shufflevector <4 x float> %359, <4 x float> poison, <4 x i32> zeroinitializer
%361 = add nsw i64 %356, -8
%362 = lshr exact i64 %361, 3
%363 = add nuw nsw i64 %362, 1
%364 = and i64 %363, 1
%365 = icmp eq i64 %361, 0
br i1 %365, label %396, label %366
366: ; preds = %355
%367 = and i64 %363, 4611686018427387902
br label %368
368: ; preds = %368, %366
%369 = phi i64 [ 0, %366 ], [ %392, %368 ]
%370 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %366 ], [ %393, %368 ]
%371 = phi i64 [ 0, %366 ], [ %394, %368 ]
%372 = add <4 x i32> %370, <i32 4, i32 4, i32 4, i32 4>
%373 = sitofp <4 x i32> %370 to <4 x float>
%374 = sitofp <4 x i32> %372 to <4 x float>
%375 = fmul <4 x float> %358, %373
%376 = fmul <4 x float> %360, %374
%377 = getelementptr inbounds float, float* %352, i64 %369
%378 = bitcast float* %377 to <4 x float>*
store <4 x float> %375, <4 x float>* %378
%379 = getelementptr inbounds float, float* %377, i64 4
%380 = bitcast float* %379 to <4 x float>*
store <4 x float> %376, <4 x float>* %380
%381 = or i64 %369, 8
%382 = add <4 x i32> %370, <i32 8, i32 8, i32 8, i32 8>
%383 = add <4 x i32> %370, <i32 12, i32 12, i32 12, i32 12>
%384 = sitofp <4 x i32> %382 to <4 x float>
%385 = sitofp <4 x i32> %383 to <4 x float>
%386 = fmul <4 x float> %358, %384
%387 = fmul <4 x float> %360, %385
%388 = getelementptr inbounds float, float* %352, i64 %381
%389 = bitcast float* %388 to <4 x float>*
store <4 x float> %386, <4 x float>* %389
%390 = getelementptr inbounds float, float* %388, i64 4
%391 = bitcast float* %390 to <4 x float>*
store <4 x float> %387, <4 x float>* %391
%392 = add nuw i64 %369, 16
%393 = add <4 x i32> %370, <i32 16, i32 16, i32 16, i32 16>
%394 = add i64 %371, 2
%395 = icmp eq i64 %394, %367
br i1 %395, label %396, label %368
396: ; preds = %368, %355
%397 = phi i64 [ 0, %355 ], [ %392, %368 ]
%398 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %355 ], [ %393, %368 ]
%399 = icmp eq i64 %364, 0
br i1 %399, label %410, label %400
400: ; preds = %396
%401 = add <4 x i32> %398, <i32 4, i32 4, i32 4, i32 4>
%402 = sitofp <4 x i32> %398 to <4 x float>
%403 = sitofp <4 x i32> %401 to <4 x float>
%404 = fmul <4 x float> %358, %402
%405 = fmul <4 x float> %360, %403
%406 = getelementptr inbounds float, float* %352, i64 %397
%407 = bitcast float* %406 to <4 x float>*
store <4 x float> %404, <4 x float>* %407
%408 = getelementptr inbounds float, float* %406, i64 4
%409 = bitcast float* %408 to <4 x float>*
store <4 x float> %405, <4 x float>* %409
br label %410
410: ; preds = %396, %400
%411 = icmp eq i64 %356, %353
br i1 %411, label %422, label %412
412: ; preds = %351, %410
%413 = phi i64 [ 0, %351 ], [ %356, %410 ]
br label %414
414: ; preds = %412, %414
%415 = phi i64 [ %420, %414 ], [ %413, %412 ]
%416 = trunc i64 %415 to i32
%417 = sitofp i32 %416 to float
%418 = fmul float %417, %3
%419 = getelementptr inbounds float, float* %352, i64 %415
store float %418, float* %419
%420 = add nuw nsw i64 %415, 1
%421 = icmp eq i64 %420, %353
br i1 %421, label %422, label %414
422: ; preds = %414, %410, %329
store i32 %84, i32* %11
ret void
}