#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 */
struct VariableDensity {
  int dummy;
};

/* Variables and functions */
int M_PI;
float calculateMaxReadoutGradientAmplitude(float, float);
scalar_t__ calloc(int, int);
int /*<<< orphan*/ ccr_calcGT(float, float, float, float, float, float *,
                              float *);
int ceil(double);
float cos(int);
int /*<<< orphan*/ cumulativeSum(float *, float *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(float *);
int /*<<< orphan*/ getFieldOfView(struct VariableDensity *, int /*<<< orphan*/,
                                  float *, float *, int);
int /*<<< orphan*/ grd_bipolar_prewinder(float, float, float, float, float,
                                         float, float, float **, float **,
                                         float **, float **, int *);
int leastCommonMultiple(int, int);
scalar_t__ malloc(int);
int maxValue(float *, int);
int /*<<< orphan*/ memcpy(float *, float *, int);
int minValue(float *, int);
int /*<<< orphan*/ scalecomplex(float *, float *, float, float, int);
float sin(int);
int /*<<< orphan*/ stderr;
int generateRingGradients(struct VariableDensity *variableDensity,
                          float fieldOfView, float spatialResolution,
                          float readoutDuration, float numRevolutions,
                          float gradientLimit, float slewRateLimit,
                          float samplingInterval, float **gradx, float **grady,
                          int *numDephasePoints, int *numReadoutPoints,
                          int *numRephasePoints, float **theta_rd) {
  int useLTGT = 1;
  int sf;
  int nsrev2;
  float gradientTimeScaleFactor;
  float *gringx, *gringy;
  float *kringx, *kringy;
  float kxpre;
  float kypre;
  int useGDEPIN = 0;
  int Nrep0;
  float *kdep, *gdep0, *sdep, *tdep;
  int n;
  float krMax = 5 / spatialResolution;
  float fieldOfViewInitial;
  getFieldOfView(variableDensity, 0, &fieldOfView, &fieldOfViewInitial, 1);
  float maxGradientAmplitude;
  float minReadoutDuration;
  ccr_calcGT(gradientLimit, slewRateLimit, krMax, fieldOfViewInitial,
             samplingInterval, &maxGradientAmplitude, &minReadoutDuration);
  *numReadoutPoints =
      ceil(numRevolutions * minReadoutDuration / samplingInterval);
  sf = leastCommonMultiple(8, 2 * numRevolutions);
  *numReadoutPoints = sf * ceil(1.0 * *numReadoutPoints / sf);
  if (useLTGT) {
    *numReadoutPoints = readoutDuration / samplingInterval;
    nsrev2 = sf * ceil(1.0 * *numReadoutPoints / sf);
    gradientTimeScaleFactor = minReadoutDuration / readoutDuration;
    if (gradientTimeScaleFactor > 1) {
      fprintf(stderr, "ccr_gengrads: gradientTimeScaleFactor > 1! Cannot align "
                      "readout length to specs.\n");
      fprintf(stderr, "ccr_gengrads: Min = %d, Spec = %d\n", *numReadoutPoints,
              nsrev2);
      fprintf(stderr, "ccr_gengrads: Run script again with lenRdtgt>=%d\n",
              *numReadoutPoints);
      fprintf(stderr, "ccr_gengrads: END\n");
      return 1;
    } else
      *numReadoutPoints = nsrev2;
  } else
    gradientTimeScaleFactor = 1;
  *theta_rd = (float *)malloc(*numReadoutPoints * sizeof(float));
  for (n = 0; n < *numReadoutPoints; n++)
    (*theta_rd)[n] = n * numRevolutions * 2 * M_PI / (*numReadoutPoints);
  gringx = (float *)malloc(*numReadoutPoints * sizeof(float));
  gringy = (float *)malloc(*numReadoutPoints * sizeof(float));
  for (n = 0; n < *numReadoutPoints; n++) {
    (*theta_rd)[n] = numRevolutions * 2 * M_PI * (n + 1) / (*numReadoutPoints);
    gringx[n] =
        -gradientTimeScaleFactor * maxGradientAmplitude * sin((*theta_rd)[n]);
    gringy[n] =
        gradientTimeScaleFactor * maxGradientAmplitude * cos((*theta_rd)[n]);
  }
  kringx = (float *)malloc(*numReadoutPoints * sizeof(float));
  kringy = (float *)malloc(*numReadoutPoints * sizeof(float));
  cumulativeSum(gringx, kringx, *numReadoutPoints);
  cumulativeSum(gringy, kringy, *numReadoutPoints);
  scalecomplex(kringx, kringy, 4257.6388f * samplingInterval, 0.0f,
               *numReadoutPoints);
  kxpre = -minValue(kringx, *numReadoutPoints) / 2;
  kypre = -(maxValue(kringy, *numReadoutPoints) +
            minValue(kringy, *numReadoutPoints)) /
          2;
  int numDephasePointsInitial;
  if (useGDEPIN)
    ;
  else {
    float readoutGradientLimit =
        calculateMaxReadoutGradientAmplitude(fieldOfView, samplingInterval);
    grd_bipolar_prewinder(readoutGradientLimit, gradientLimit, slewRateLimit,
                          samplingInterval, kxpre, kypre,
                          gradientTimeScaleFactor * maxGradientAmplitude, &kdep,
                          &gdep0, &sdep, &tdep, &numDephasePointsInitial);
  }
  *numDephasePoints = numDephasePointsInitial + numDephasePointsInitial % 4;
  Nrep0 = *numDephasePoints - 1;
  *numRephasePoints = Nrep0 + Nrep0 % 4;
  if (numRephasePoints > numDephasePoints)
    numDephasePoints = numRephasePoints;
  else if (numDephasePoints < numRephasePoints)
    numRephasePoints = numDephasePoints;
  int numPoints = *numDephasePoints + *numReadoutPoints + *numRephasePoints;
  *gradx = (float *)calloc(numPoints, sizeof(float));
  *grady = (float *)calloc(numPoints, sizeof(float));
  memcpy(&(*gradx)[*numDephasePoints - numDephasePointsInitial], gdep0,
         sizeof(float) * numDephasePointsInitial);
  memcpy(&(*grady)[*numDephasePoints - numDephasePointsInitial],
         &gdep0[numDephasePointsInitial],
         sizeof(float) * numDephasePointsInitial);
  memcpy(&(*gradx)[*numDephasePoints], gringx,
         sizeof(float) * *numReadoutPoints);
  memcpy(&(*grady)[*numDephasePoints], gringy,
         sizeof(float) * *numReadoutPoints);
  for (n = 0; n < *numRephasePoints; n++) {
    (*gradx)[*numDephasePoints + *numReadoutPoints + n] =
        -(*gradx)[*numDephasePoints - 1 - n];
    (*grady)[*numDephasePoints + *numReadoutPoints + n] =
        (*grady)[*numDephasePoints - 1 - n];
  }
  scalecomplex(&(*gradx)[*numDephasePoints + *numReadoutPoints],
               &(*grady)[*numDephasePoints + *numReadoutPoints],
               cos(2 * M_PI * numRevolutions), sin(2 * M_PI * numRevolutions),
               *numRephasePoints);
  free(gringx);
  free(gringy);
  free(kringx);
  free(kringy);
  free(kdep);
  free(gdep0);
  free(sdep);
  free(tdep);
  return 0;
}


x86 assembly (clang, -O0):
<generateRingGradients>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  %xmm1,-0x18(%rbp)
movss  %xmm2,-0x1c(%rbp)
movss  %xmm3,-0x20(%rbp)
movss  %xmm4,-0x24(%rbp)
movss  %xmm5,-0x28(%rbp)
movss  %xmm6,-0x2c(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x48(%rbp)
mov    %r8,-0x50(%rbp)
mov    %r9,-0x58(%rbp)
movl   $0x1,-0x5c(%rbp)
movl   $0x0,-0x94(%rbp)
movss  0xd99(%rip),%xmm0
divss  -0x18(%rbp),%xmm0
movss  %xmm0,-0xc0(%rbp)
ff
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
lea    -0x14(%rbp),%rdx
lea    -0xc4(%rbp),%rcx
mov    $0x1,%r8d
call   1120 <getFieldOfView@plt>
movss  -0x24(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
movss  -0xc0(%rbp),%xmm2
ff
movss  -0xc4(%rbp),%xmm3
ff
movss  -0x2c(%rbp),%xmm4
lea    -0xc8(%rbp),%rdi
lea    -0xcc(%rbp),%rsi
call   1060 <ccr_calcGT@plt>
movss  -0x20(%rbp),%xmm0
mulss  -0xcc(%rbp),%xmm0
ff
divss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1070 <ceil@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%rax
mov    %ecx,(%rax)
movss  0xd0f(%rip),%xmm0
mulss  -0x20(%rbp),%xmm0
cvttss2si %xmm0,%esi
mov    $0x8,%edi
call   1090 <leastCommonMultiple@plt>
mov    %eax,-0x60(%rbp)
mov    -0x60(%rbp),%eax
mov    %eax,-0xdc(%rbp)
mov    -0x50(%rbp),%rax
cvtsi2sdl (%rax),%xmm1
movsd  0xcd8(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x60(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1070 <ceil@plt>
mov    -0xdc(%rbp),%ecx
imul   %eax,%ecx
mov    -0x50(%rbp),%rax
mov    %ecx,(%rax)
cmpl   $0x0,-0x5c(%rbp)
je     144d <generateRingGradients+0x23d>
movss  -0x1c(%rbp),%xmm0
divss  -0x2c(%rbp),%xmm0
cvttss2si %xmm0,%ecx
mov    -0x50(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x60(%rbp),%eax
mov    %eax,-0xe0(%rbp)
mov    -0x50(%rbp),%rax
cvtsi2sdl (%rax),%xmm1
movsd  0xc80(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x60(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1070 <ceil@plt>
mov    %eax,%ecx
mov    -0xe0(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x64(%rbp)
movss  -0xcc(%rbp),%xmm0
ff
divss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x68(%rbp)
movss  -0x68(%rbp),%xmm0
movss  0xc51(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    143f <generateRingGradients+0x22f>
mov    0x2c09(%rip),%rax
mov    (%rax),%edi
lea    0xc40(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    0x2bf2(%rip),%rax
mov    (%rax),%edi
mov    -0x50(%rbp),%rax
mov    (%rax),%edx
mov    -0x64(%rbp),%ecx
lea    0xc72(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    0x2bd2(%rip),%rax
mov    (%rax),%edi
mov    -0x50(%rbp),%rax
mov    (%rax),%edx
lea    0xc78(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    0x2bb5(%rip),%rax
mov    (%rax),%edi
lea    0xc93(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1b10 <generateRingGradients+0x900>
mov    -0x64(%rbp),%ecx
mov    -0x50(%rbp),%rax
mov    %ecx,(%rax)
jmp    145a <generateRingGradients+0x24a>
movss  0xbbb(%rip),%xmm0
movss  %xmm0,-0x68(%rbp)
mov    -0x50(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10f0 <malloc@plt>
mov    %rax,%rcx
mov    0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0xbc(%rbp)
mov    -0xbc(%rbp),%eax
mov    -0x50(%rbp),%rcx
cmp    (%rcx),%eax
jge    14ed <generateRingGradients+0x2dd>
cvtsi2ssl -0xbc(%rbp),%xmm0
ff
mulss  -0x20(%rbp),%xmm0
movss  0xb61(%rip),%xmm1
mulss  %xmm1,%xmm0
mov    0x2b36(%rip),%rax
cvtsi2ssl (%rax),%xmm1
mulss  %xmm1,%xmm0
mov    -0x50(%rbp),%rax
cvtsi2ssl (%rax),%xmm1
divss  %xmm1,%xmm0
mov    0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0xbc(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0xbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
jmp    1480 <generateRingGradients+0x270>
mov    -0x50(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10f0 <malloc@plt>
mov    %rax,-0x70(%rbp)
mov    -0x50(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10f0 <malloc@plt>
mov    %rax,-0x78(%rbp)
movl   $0x0,-0xbc(%rbp)
mov    -0xbc(%rbp),%eax
mov    -0x50(%rbp),%rcx
cmp    (%rcx),%eax
jge    163a <generateRingGradients+0x42a>
movss  0xacb(%rip),%xmm0
mulss  -0x20(%rbp),%xmm0
mov    0x2a9f(%rip),%rax
cvtsi2ssl (%rax),%xmm1
mulss  %xmm1,%xmm0
mov    -0xbc(%rbp),%eax
add    $0x1,%eax
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
mov    -0x50(%rbp),%rax
cvtsi2ssl (%rax),%xmm1
divss  %xmm1,%xmm0
mov    0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0xbc(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movss  -0x68(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  -0xc8(%rbp),%xmm0
ff
movss  %xmm0,-0xe8(%rbp)
ff
mov    0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0xbc(%rbp),%rcx
cvttss2si (%rax,%rcx,4),%edi
call   10d0 <sin@plt>
movaps %xmm0,%xmm1
movss  -0xe8(%rbp),%xmm0
ff
mulss  %xmm1,%xmm0
mov    -0x70(%rbp),%rax
movslq -0xbc(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movss  -0x68(%rbp),%xmm0
mulss  -0xc8(%rbp),%xmm0
ff
movss  %xmm0,-0xe4(%rbp)
ff
mov    0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0xbc(%rbp),%rcx
cvttss2si (%rax,%rcx,4),%edi
call   1100 <cos@plt>
movaps %xmm0,%xmm1
movss  -0xe4(%rbp),%xmm0
ff
mulss  %xmm1,%xmm0
mov    -0x78(%rbp),%rax
movslq -0xbc(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0xbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
jmp    1523 <generateRingGradients+0x313>
mov    -0x50(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10f0 <malloc@plt>
mov    %rax,-0x80(%rbp)
mov    -0x50(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10f0 <malloc@plt>
mov    %rax,-0x88(%rbp)
mov    -0x70(%rbp),%rdi
mov    -0x80(%rbp),%rsi
mov    -0x50(%rbp),%rax
mov    (%rax),%edx
call   1130 <cumulativeSum@plt>
mov    -0x78(%rbp),%rdi
mov    -0x88(%rbp),%rsi
mov    -0x50(%rbp),%rax
mov    (%rax),%edx
call   1130 <cumulativeSum@plt>
mov    -0x80(%rbp),%rdi
mov    -0x88(%rbp),%rsi
movss  0x96f(%rip),%xmm0
mulss  -0x2c(%rbp),%xmm0
mov    -0x50(%rbp),%rax
mov    (%rax),%edx
xorps  %xmm1,%xmm1
call   1050 <scalecomplex@plt>
mov    -0x80(%rbp),%rdi
mov    -0x50(%rbp),%rax
mov    (%rax),%esi
call   10c0 <minValue@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x8c(%rbp)
ff
mov    -0x88(%rbp),%rdi
mov    -0x50(%rbp),%rax
mov    (%rax),%esi
call   1080 <maxValue@plt>
mov    %eax,-0xec(%rbp)
mov    -0x88(%rbp),%rdi
mov    -0x50(%rbp),%rax
mov    (%rax),%esi
call   10c0 <minValue@plt>
mov    -0xec(%rbp),%ecx
add    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x90(%rbp)
ff
cmpl   $0x0,-0x94(%rbp)
je     173d <generateRingGradients+0x52d>
jmp    17b0 <generateRingGradients+0x5a0>
movss  -0x14(%rbp),%xmm0
movss  -0x2c(%rbp),%xmm1
call   1110 <calculateMaxReadoutGradientAmplitude@plt>
movss  %xmm0,-0xd4(%rbp)
ff
movss  -0xd4(%rbp),%xmm0
ff
movss  -0x24(%rbp),%xmm1
movss  -0x28(%rbp),%xmm2
movss  -0x2c(%rbp),%xmm3
movss  -0x8c(%rbp),%xmm4
ff
movss  -0x90(%rbp),%xmm5
ff
movss  -0x68(%rbp),%xmm6
mulss  -0xc8(%rbp),%xmm6
ff
lea    -0xa0(%rbp),%rdi
lea    -0xa8(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
lea    -0xb8(%rbp),%rcx
lea    -0xd0(%rbp),%r8
call   1040 <grd_bipolar_prewinder@plt>
mov    -0xd0(%rbp),%ecx
mov    -0xd0(%rbp),%eax
mov    $0x4,%esi
cltd
idiv   %esi
add    %edx,%ecx
mov    -0x48(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x48(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x98(%rbp)
mov    -0x98(%rbp),%ecx
mov    -0x98(%rbp),%eax
mov    $0x4,%esi
cltd
idiv   %esi
add    %edx,%ecx
mov    -0x58(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x58(%rbp),%rax
cmp    -0x48(%rbp),%rax
jbe    1812 <generateRingGradients+0x602>
mov    -0x58(%rbp),%rax
mov    %rax,-0x48(%rbp)
jmp    182d <generateRingGradients+0x61d>
mov    -0x48(%rbp),%rax
cmp    -0x58(%rbp),%rax
jae    1828 <generateRingGradients+0x618>
mov    -0x48(%rbp),%rax
mov    %rax,-0x58(%rbp)
jmp    182d <generateRingGradients+0x61d>
mov    -0x48(%rbp),%rax
mov    (%rax),%eax
mov    -0x50(%rbp),%rcx
add    (%rcx),%eax
mov    -0x58(%rbp),%rcx
add    (%rcx),%eax
mov    %eax,-0xd8(%rbp)
mov    -0xd8(%rbp),%edi
mov    $0x4,%esi
call   10a0 <calloc@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
mov    %rcx,(%rax)
mov    -0xd8(%rbp),%edi
mov    $0x4,%esi
call   10a0 <calloc@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x38(%rbp),%rax
mov    (%rax),%rdi
mov    -0x48(%rbp),%rax
mov    (%rax),%eax
sub    -0xd0(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    -0xa8(%rbp),%rsi
movslq -0xd0(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   10e0 <memcpy@plt>
mov    -0x40(%rbp),%rax
mov    (%rax),%rdi
mov    -0x48(%rbp),%rax
mov    (%rax),%eax
sub    -0xd0(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    -0xa8(%rbp),%rsi
movslq -0xd0(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
movslq -0xd0(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   10e0 <memcpy@plt>
mov    -0x38(%rbp),%rax
mov    (%rax),%rdi
mov    -0x48(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x70(%rbp),%rsi
mov    -0x50(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   10e0 <memcpy@plt>
mov    -0x40(%rbp),%rax
mov    (%rax),%rdi
mov    -0x48(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x78(%rbp),%rsi
mov    -0x50(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   10e0 <memcpy@plt>
movl   $0x0,-0xbc(%rbp)
mov    -0xbc(%rbp),%eax
mov    -0x58(%rbp),%rcx
cmp    (%rcx),%eax
jge    1a02 <generateRingGradients+0x7f2>
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
mov    -0x48(%rbp),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
sub    -0xbc(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
mov    -0x48(%rbp),%rcx
mov    (%rcx),%ecx
mov    -0x50(%rbp),%rdx
add    (%rdx),%ecx
add    -0xbc(%rbp),%ecx
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x40(%rbp),%rax
mov    (%rax),%rax
mov    -0x48(%rbp),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
sub    -0xbc(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x40(%rbp),%rax
mov    (%rax),%rax
mov    -0x48(%rbp),%rcx
mov    (%rcx),%ecx
mov    -0x50(%rbp),%rdx
add    (%rdx),%ecx
add    -0xbc(%rbp),%ecx
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0xbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
jmp    1951 <generateRingGradients+0x741>
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
mov    -0x48(%rbp),%rcx
mov    (%rcx),%ecx
mov    -0x50(%rbp),%rdx
add    (%rdx),%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x100(%rbp)
mov    -0x40(%rbp),%rax
mov    (%rax),%rax
mov    -0x48(%rbp),%rcx
mov    (%rcx),%ecx
mov    -0x50(%rbp),%rdx
add    (%rdx),%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0xf8(%rbp)
mov    0x2597(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2ss %eax,%xmm0
mulss  -0x20(%rbp),%xmm0
cvttss2si %xmm0,%edi
call   1100 <cos@plt>
movss  %xmm0,-0xf0(%rbp)
ff
mov    0x2571(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2ss %eax,%xmm0
mulss  -0x20(%rbp),%xmm0
cvttss2si %xmm0,%edi
call   10d0 <sin@plt>
mov    -0x100(%rbp),%rdi
mov    -0xf8(%rbp),%rsi
movaps %xmm0,%xmm1
movss  -0xf0(%rbp),%xmm0
ff
mov    -0x58(%rbp),%rax
mov    (%rax),%edx
call   1050 <scalecomplex@plt>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
mov    -0x78(%rbp),%rdi
call   1030 <free@plt>
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
mov    -0x88(%rbp),%rdi
call   1030 <free@plt>
mov    -0xa0(%rbp),%rdi
call   1030 <free@plt>
mov    -0xa8(%rbp),%rdi
call   1030 <free@plt>
mov    -0xb0(%rbp),%rdi
call   1030 <free@plt>
mov    -0xb8(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generateRingGradients>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %r9,%r13
mov    %r8,%r12
mov    %rcx,0xa8(%rsp)
mov    %rdx,%r15
mov    %rsi,0xa0(%rsp)
movss  %xmm6,0xc(%rsp)
movss  %xmm5,0x24(%rsp)
movss  %xmm4,0x20(%rsp)
movaps %xmm3,0x50(%rsp)
movss  %xmm2,0x10(%rsp)
movss  %xmm0,0x2c(%rsp)
movss  0xd9b(%rip),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,0x30(%rsp)
lea    0x2c(%rsp),%rdx
lea    0x4c(%rsp),%rcx
mov    $0x1,%r14d
xor    %esi,%esi
mov    $0x1,%r8d
call   1120 <getFieldOfView@plt>
movss  0x4c(%rsp),%xmm3
lea    0x1c(%rsp),%rdi
lea    0x28(%rsp),%rsi
movss  0x20(%rsp),%xmm0
movss  0x24(%rsp),%xmm1
movss  0x30(%rsp),%xmm2
movss  0xc(%rsp),%xmm4
call   1060 <ccr_calcGT@plt>
movss  0x28(%rsp),%xmm0
mulss  0x50(%rsp),%xmm0
divss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1070 <ceil@plt>
mov    %eax,(%r12)
movaps 0x50(%rsp),%xmm0
addss  %xmm0,%xmm0
movaps %xmm0,0x80(%rsp)
cvttss2si %xmm0,%esi
mov    $0x8,%edi
call   1090 <leastCommonMultiple@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl (%r12),%xmm0
mov    %eax,%ebx
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  %xmm1,0x30(%rsp)
divsd  %xmm1,%xmm0
call   1070 <ceil@plt>
movss  0x10(%rsp),%xmm0
divss  0xc(%rsp),%xmm0
cvttss2si %xmm0,%eax
mov    %eax,(%r12)
cvttps2dq %xmm0,%xmm0
cvtdq2pd %xmm0,%xmm0
divsd  0x30(%rsp),%xmm0
call   1070 <ceil@plt>
mov    %eax,%ebp
imul   %ebx,%ebp
movss  0x28(%rsp),%xmm0
divss  0x10(%rsp),%xmm0
ucomiss 0xcad(%rip),%xmm0
jbe    13af <generateRingGradients+0x19f>
mov    0x2c78(%rip),%rbx
mov    (%rbx),%edi
lea    0xcf7(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    (%rbx),%edi
mov    (%r12),%edx
lea    0xd35(%rip),%rsi
mov    %ebp,%ecx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    (%rbx),%edi
mov    (%r12),%edx
lea    0xd42(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    (%rbx),%edi
lea    0xd64(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
jmp    192e <generateRingGradients+0x71e>
movaps %xmm0,0x30(%rsp)
mov    0x100(%rsp),%rbx
mov    %ebp,(%r12)
shl    $0x2,%ebp
mov    %ebp,%edi
call   10f0 <malloc@plt>
mov    %rax,(%rbx)
mov    (%r12),%edi
test   %edi,%edi
movaps 0x50(%rsp),%xmm7
jle    14e5 <generateRingGradients+0x2d5>
mov    0x2c03(%rip),%rcx
xorps  %xmm0,%xmm0
cvtsi2ssl (%rcx),%xmm0
xorps  %xmm1,%xmm1
cvtsi2ss %edi,%xmm1
cmp    $0x4,%edi
jae    13ff <generateRingGradients+0x1ef>
xor    %ecx,%ecx
jmp    14c0 <generateRingGradients+0x2b0>
mov    %edi,%ecx
and    $0xfffffffc,%ecx
movaps %xmm7,%xmm2
shufps $0x0,%xmm7,%xmm2
movaps %xmm0,%xmm3
shufps $0x0,%xmm0,%xmm3
movaps %xmm1,%xmm4
shufps $0x0,%xmm1,%xmm4
lea    -0x4(%rcx),%rdx
mov    %rdx,%rbp
shr    $0x2,%rbp
add    $0x1,%rbp
test   %rdx,%rdx
je     1943 <generateRingGradients+0x733>
mov    %rbp,%rdx
and    $0xfffffffffffffffe,%rdx
movaps 0xbe1(%rip),%xmm5
xor    %esi,%esi
movdqa 0xbe6(%rip),%xmm8
movdqa 0xbed(%rip),%xmm9
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cvtdq2ps %xmm5,%xmm6
mulps  %xmm2,%xmm6
addps  %xmm6,%xmm6
mulps  %xmm3,%xmm6
divps  %xmm4,%xmm6
movups %xmm6,(%rax,%rsi,4)
movaps %xmm5,%xmm6
paddd  %xmm8,%xmm6
cvtdq2ps %xmm6,%xmm6
mulps  %xmm2,%xmm6
addps  %xmm6,%xmm6
mulps  %xmm3,%xmm6
divps  %xmm4,%xmm6
movups %xmm6,0x10(%rax,%rsi,4)
add    $0x8,%rsi
paddd  %xmm9,%xmm5
add    $0xfffffffffffffffe,%rdx
jne    1460 <generateRingGradients+0x250>
cvtdq2ps %xmm5,%xmm5
test   $0x1,%bpl
je     14b7 <generateRingGradients+0x2a7>
mulps  %xmm5,%xmm2
addps  %xmm2,%xmm2
mulps  %xmm3,%xmm2
divps  %xmm4,%xmm2
movups %xmm2,(%rax,%rsi,4)
cmp    %rdi,%rcx
je     14e5 <generateRingGradients+0x2d5>
nopl   0x0(%rax)
xorps  %xmm2,%xmm2
cvtsi2ss %ecx,%xmm2
mulss  %xmm7,%xmm2
addss  %xmm2,%xmm2
mulss  %xmm0,%xmm2
divss  %xmm1,%xmm2
movss  %xmm2,(%rax,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%rdi
jne    14c0 <generateRingGradients+0x2b0>
mov    %r15,0x90(%rsp)
shl    $0x2,%edi
call   10f0 <malloc@plt>
mov    %rax,%r14
mov    (%r12),%edi
shl    $0x2,%edi
call   10f0 <malloc@plt>
mov    (%r12),%edi
test   %edi,%edi
mov    %r13,0x98(%rsp)
jle    15e0 <generateRingGradients+0x3d0>
movaps 0xb31(%rip),%xmm0
xorps  0x30(%rsp),%xmm0
movaps %xmm0,0x70(%rsp)
mov    %rbx,%rbp
xor    %ebx,%ebx
mov    %r12,%r13
mov    %rax,%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x2aa1(%rip),%rax
xorps  %xmm0,%xmm0
cvtsi2ssl (%rax),%xmm0
lea    0x1(%rbx),%r12
xorps  %xmm1,%xmm1
cvtsi2ss %r12d,%xmm1
mulss  0x80(%rsp),%xmm0
xorps  %xmm2,%xmm2
cvtsi2ss %edi,%xmm2
mulss  %xmm0,%xmm1
divss  %xmm2,%xmm1
mov    0x0(%rbp),%rax
movss  %xmm1,(%rax,%rbx,4)
movss  0x1c(%rsp),%xmm0
mulss  0x70(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
cvttss2si %xmm1,%edi
call   10d0 <sin@plt>
mulss  0x10(%rsp),%xmm0
movss  %xmm0,(%r14,%rbx,4)
movss  0x1c(%rsp),%xmm0
mulss  0x30(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
mov    0x0(%rbp),%rax
cvttss2si (%rax,%rbx,4),%edi
call   1100 <cos@plt>
mulss  0x10(%rsp),%xmm0
movss  %xmm0,(%r15,%rbx,4)
movslq 0x0(%r13),%rdi
mov    %r12,%rbx
cmp    %rdi,%r12
jl     1540 <generateRingGradients+0x330>
jmp    15e6 <generateRingGradients+0x3d6>
mov    %r12,%r13
mov    %rax,%r15
shl    $0x2,%edi
call   10f0 <malloc@plt>
mov    %rax,%rbx
mov    0x0(%r13),%edi
shl    $0x2,%edi
call   10f0 <malloc@plt>
mov    %rax,%rbp
mov    0x0(%r13),%edx
mov    %r14,0x68(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1130 <cumulativeSum@plt>
mov    0x0(%r13),%edx
mov    %r15,%rdi
mov    %rbp,%rsi
call   1130 <cumulativeSum@plt>
movss  0x9dd(%rip),%xmm0
mulss  0xc(%rsp),%xmm0
mov    0x0(%r13),%edx
xorpd  %xmm1,%xmm1
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <scalecomplex@plt>
mov    0x0(%r13),%esi
mov    %rbx,0x10(%rsp)
mov    %rbx,%rdi
call   10c0 <minValue@plt>
mov    %eax,%ebx
mov    0x0(%r13),%esi
mov    %rbp,%rdi
call   1080 <maxValue@plt>
mov    %eax,%r14d
mov    0x0(%r13),%esi
mov    %rbp,0x80(%rsp)
mov    %rbp,%rdi
call   10c0 <minValue@plt>
add    %r14d,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
neg    %ecx
xorps  %xmm0,%xmm0
cvtsi2ss %ecx,%xmm0
movss  %xmm0,0x70(%rsp)
mov    %ebx,%eax
shr    $0x1f,%eax
add    %ebx,%eax
sar    %eax
neg    %eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x48(%rsp)
movss  0x2c(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1110 <calculateMaxReadoutGradientAmplitude@plt>
movaps 0x30(%rsp),%xmm6
mulss  0x1c(%rsp),%xmm6
lea    0xc0(%rsp),%rdi
lea    0x40(%rsp),%rsi
lea    0xb8(%rsp),%rdx
lea    0xb0(%rsp),%rcx
lea    0x18(%rsp),%r8
movss  0x20(%rsp),%xmm1
movss  0x24(%rsp),%xmm2
movss  0xc(%rsp),%xmm3
movss  0x48(%rsp),%xmm4
movss  0x70(%rsp),%xmm5
call   1040 <grd_bipolar_prewinder@plt>
mov    0x18(%rsp),%eax
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
mov    %eax,%edx
sub    %ecx,%edx
lea    (%rdx,%rax,1),%ecx
mov    0xa8(%rsp),%rbp
mov    %ecx,0x0(%rbp)
lea    (%rax,%rdx,1),%esi
add    $0xffffffff,%esi
add    %edx,%eax
add    $0x2,%eax
test   %esi,%esi
cmovns %esi,%eax
and    $0xfffffffc,%eax
sub    %eax,%esi
lea    (%rsi,%rcx,1),%eax
add    $0xffffffff,%eax
mov    0x98(%rsp),%r12
mov    %eax,(%r12)
cmp    %rbp,%r12
cmova  %r12,%rbp
mov    0x0(%r13),%ebx
add    0x0(%rbp),%ebx
add    %eax,%ebx
mov    %ebx,%edi
mov    $0x4,%esi
call   10a0 <calloc@plt>
mov    0xa0(%rsp),%r14
mov    %rax,(%r14)
mov    %ebx,%edi
mov    $0x4,%esi
call   10a0 <calloc@plt>
mov    0x90(%rsp),%rbx
mov    %rax,(%rbx)
movslq 0x0(%rbp),%rdi
movslq 0x18(%rsp),%rax
sub    %rax,%rdi
shl    $0x2,%rdi
add    (%r14),%rdi
mov    0x40(%rsp),%rsi
lea    0x0(,%rax,4),%edx
call   10e0 <memcpy@plt>
movslq 0x0(%rbp),%rdi
movslq 0x18(%rsp),%rsi
sub    %rsi,%rdi
shl    $0x2,%rdi
add    (%rbx),%rdi
lea    0x0(,%rsi,4),%edx
shl    $0x2,%rsi
add    0x40(%rsp),%rsi
call   10e0 <memcpy@plt>
movslq 0x0(%rbp),%rdi
shl    $0x2,%rdi
add    (%r14),%rdi
mov    0x0(%r13),%edx
shl    $0x2,%edx
mov    0x68(%rsp),%rsi
call   10e0 <memcpy@plt>
movslq 0x0(%rbp),%rdi
shl    $0x2,%rdi
add    (%rbx),%rdi
mov    0x0(%r13),%edx
shl    $0x2,%edx
mov    %r15,%rsi
call   10e0 <memcpy@plt>
mov    (%r12),%edi
mov    (%r14),%rax
mov    0x0(%rbp),%ecx
mov    0x0(%r13),%esi
mov    (%rbx),%rdx
test   %edi,%edi
jle    1869 <generateRingGradients+0x659>
lea    -0x1(%rcx),%ebp
lea    (%rcx,%rsi,1),%ebx
movaps 0x818(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
movslq %ebp,%rbp
movss  (%rax,%rbp,4),%xmm1
xorps  %xmm0,%xmm1
movslq %ebx,%rbx
movss  %xmm1,(%rax,%rbx,4)
movss  (%rdx,%rbp,4),%xmm1
movss  %xmm1,(%rdx,%rbx,4)
add    $0xffffffff,%ebp
add    $0x1,%ebx
add    $0xffffffffffffffff,%rdi
jne    1840 <generateRingGradients+0x630>
mov    0x2778(%rip),%rbp
mov    0x0(%rbp),%edi
add    %edi,%edi
xorps  %xmm0,%xmm0
cvtsi2ss %edi,%xmm0
add    %ecx,%esi
movslq %esi,%rcx
lea    (%rax,%rcx,4),%rbx
lea    (%rdx,%rcx,4),%r14
mulss  0x50(%rsp),%xmm0
cvttss2si %xmm0,%edi
call   1100 <cos@plt>
mov    0x0(%rbp),%eax
add    %eax,%eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
movss  %xmm0,0x30(%rsp)
mulss  0x50(%rsp),%xmm1
cvttss2si %xmm1,%edi
call   10d0 <sin@plt>
movaps %xmm0,%xmm1
mov    (%r12),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
movss  0x30(%rsp),%xmm0
call   1050 <scalecomplex@plt>
mov    0x68(%rsp),%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    0x80(%rsp),%rdi
call   1030 <free@plt>
mov    0xc0(%rsp),%rdi
call   1030 <free@plt>
mov    0x40(%rsp),%rdi
call   1030 <free@plt>
mov    0xb8(%rsp),%rdi
call   1030 <free@plt>
mov    0xb0(%rsp),%rdi
call   1030 <free@plt>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movaps 0x6c6(%rip),%xmm5
xor    %esi,%esi
test   $0x1,%bpl
jne    14a7 <generateRingGradients+0x297>
jmp    14b7 <generateRingGradients+0x2a7>

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

LLVM IR (-O2):
%struct.VariableDensity = type { i32 }
@stderr = global i32 0
@.str = [82 x i8] c"ccr_gengrads: gradientTimeScaleFactor > 1! Cannot align readout length to specs.\0A\00"
@.str.1 = [35 x i8] c"ccr_gengrads: Min = %d, Spec = %d\0A\00"
@.str.2 = [50 x i8] c"ccr_gengrads: Run script again with lenRdtgt>=%d\0A\00"
@.str.3 = [19 x i8] c"ccr_gengrads: END\0A\00"
@M_PI = global i32 0
define i32 @generateRingGradients(%struct.VariableDensity* %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, float** nocapture %8, float** nocapture %9, i32* %10, i32* %11, i32* %12, float** nocapture %13) {
%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 i32
store float %1, float* %15
%24 = bitcast float** %16 to i8*
%25 = bitcast float** %17 to i8*
%26 = bitcast float** %18 to i8*
%27 = bitcast float** %19 to i8*
%28 = fdiv float 5.000000e+00, %2
%29 = bitcast float* %20 to i8*
%30 = call i32 @getFieldOfView(%struct.VariableDensity* %0, i32 0, float* %15, float* %20, i32 1)
%31 = bitcast float* %21 to i8*
%32 = bitcast float* %22 to i8*
%33 = load float, float* %20
%34 = call i32 @ccr_calcGT(float %5, float %6, float %28, float %33, float %7, float* %21, float* %22)
%35 = load float, float* %22
%36 = fmul float %35, %4
%37 = fdiv float %36, %7
%38 = fpext float %37 to double
%39 = call i32 @ceil(double %38)
store i32 %39, i32* %11
%40 = fmul float %4, 2.000000e+00
%41 = fptosi float %40 to i32
%42 = call i32 @leastCommonMultiple(i32 8, i32 %41)
%43 = load i32, i32* %11
%44 = sitofp i32 %43 to double
%45 = sitofp i32 %42 to double
%46 = fdiv double %44, %45
%47 = call i32 @ceil(double %46)
%48 = fdiv float %3, %7
%49 = fptosi float %48 to i32
store i32 %49, i32* %11
%50 = sitofp i32 %49 to double
%51 = fdiv double %50, %45
%52 = call i32 @ceil(double %51)
%53 = mul nsw i32 %52, %42
%54 = load float, float* %22
%55 = fdiv float %54, %3
%56 = fcmp ogt float %55, 1.000000e+00
br i1 %56, label %57, label %68
57: ; preds = %14
%58 = load i32, i32* @stderr
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0))
%60 = load i32, i32* @stderr
%61 = load i32, i32* %11
%62 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %61, i32 %53)
%63 = load i32, i32* @stderr
%64 = load i32, i32* %11
%65 = call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %64)
%66 = load i32, i32* @stderr
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %332
68: ; preds = %14
store i32 %53, i32* %11
%69 = shl i32 %53, 2
%70 = call i64 @malloc(i32 %69)
%71 = inttoptr i64 %70 to float*
store float* %71, float** %13
%72 = load i32, i32* %11
%73 = icmp sgt i32 %72, 0
br i1 %73, label %74, label %147
74: ; preds = %68
%75 = load i32, i32* @M_PI
%76 = sitofp i32 %75 to float
%77 = sitofp i32 %72 to float
%78 = zext i32 %72 to i64
%79 = icmp ult i32 %72, 4
br i1 %79, label %134, label %80
80: ; preds = %74
%81 = and i64 %78, 4294967292
%82 = insertelement <4 x float> poison, float %4, i64 0
%83 = shufflevector <4 x float> %82, <4 x float> poison, <4 x i32> zeroinitializer
%84 = insertelement <4 x float> poison, float %76, i64 0
%85 = shufflevector <4 x float> %84, <4 x float> poison, <4 x i32> zeroinitializer
%86 = insertelement <4 x float> poison, float %77, i64 0
%87 = shufflevector <4 x float> %86, <4 x float> poison, <4 x i32> zeroinitializer
%88 = add nsw i64 %81, -4
%89 = lshr exact i64 %88, 2
%90 = add nuw nsw i64 %89, 1
%91 = and i64 %90, 1
%92 = icmp eq i64 %88, 0
br i1 %92, label %121, label %93
93: ; preds = %80
%94 = and i64 %90, 9223372036854775806
br label %95
95: ; preds = %95, %93
%96 = phi i64 [ 0, %93 ], [ %115, %95 ]
%97 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %93 ], [ %116, %95 ]
%98 = phi i64 [ 0, %93 ], [ %117, %95 ]
%99 = sitofp <4 x i32> %97 to <4 x float>
%100 = fmul <4 x float> %83, %99
%101 = fmul <4 x float> %100, <float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00>
%102 = fmul <4 x float> %101, %85
%103 = fdiv <4 x float> %102, %87
%104 = getelementptr inbounds float, float* %71, i64 %96
%105 = bitcast float* %104 to <4 x float>*
store <4 x float> %103, <4 x float>* %105
%106 = or i64 %96, 4
%107 = add <4 x i32> %97, <i32 4, i32 4, i32 4, i32 4>
%108 = sitofp <4 x i32> %107 to <4 x float>
%109 = fmul <4 x float> %83, %108
%110 = fmul <4 x float> %109, <float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00>
%111 = fmul <4 x float> %110, %85
%112 = fdiv <4 x float> %111, %87
%113 = getelementptr inbounds float, float* %71, i64 %106
%114 = bitcast float* %113 to <4 x float>*
store <4 x float> %112, <4 x float>* %114
%115 = add nuw i64 %96, 8
%116 = add <4 x i32> %97, <i32 8, i32 8, i32 8, i32 8>
%117 = add i64 %98, 2
%118 = icmp eq i64 %117, %94
br i1 %118, label %119, label %95
119: ; preds = %95
%120 = sitofp <4 x i32> %116 to <4 x float>
br label %121
121: ; preds = %119, %80
%122 = phi i64 [ 0, %80 ], [ %115, %119 ]
%123 = phi <4 x float> [ <float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00>, %80 ], [ %120, %119 ]
%124 = icmp eq i64 %91, 0
br i1 %124, label %132, label %125
125: ; preds = %121
%126 = fmul <4 x float> %83, %123
%127 = fmul <4 x float> %126, <float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00>
%128 = fmul <4 x float> %127, %85
%129 = fdiv <4 x float> %128, %87
%130 = getelementptr inbounds float, float* %71, i64 %122
%131 = bitcast float* %130 to <4 x float>*
store <4 x float> %129, <4 x float>* %131
br label %132
132: ; preds = %121, %125
%133 = icmp eq i64 %81, %78
br i1 %133, label %147, label %134
134: ; preds = %74, %132
%135 = phi i64 [ 0, %74 ], [ %81, %132 ]
br label %136
136: ; preds = %134, %136
%137 = phi i64 [ %145, %136 ], [ %135, %134 ]
%138 = trunc i64 %137 to i32
%139 = sitofp i32 %138 to float
%140 = fmul float %139, %4
%141 = fmul float %140, 2.000000e+00
%142 = fmul float %141, %76
%143 = fdiv float %142, %77
%144 = getelementptr inbounds float, float* %71, i64 %137
store float %143, float* %144
%145 = add nuw nsw i64 %137, 1
%146 = icmp eq i64 %145, %78
br i1 %146, label %147, label %136
147: ; preds = %136, %132, %68
%148 = shl i32 %72, 2
%149 = call i64 @malloc(i32 %148)
%150 = inttoptr i64 %149 to float*
%151 = load i32, i32* %11
%152 = shl i32 %151, 2
%153 = call i64 @malloc(i32 %152)
%154 = inttoptr i64 %153 to float*
%155 = load i32, i32* %11
%156 = icmp sgt i32 %155, 0
br i1 %156, label %157, label %191
157: ; preds = %147
%158 = fneg float %55
br label %159
159: ; preds = %157, %159
%160 = phi i64 [ 0, %157 ], [ %165, %159 ]
%161 = phi i32 [ %155, %157 ], [ %188, %159 ]
%162 = load i32, i32* @M_PI
%163 = sitofp i32 %162 to float
%164 = fmul float %40, %163
%165 = add nuw nsw i64 %160, 1
%166 = trunc i64 %165 to i32
%167 = sitofp i32 %166 to float
%168 = fmul float %164, %167
%169 = sitofp i32 %161 to float
%170 = fdiv float %168, %169
%171 = load float*, float** %13
%172 = getelementptr inbounds float, float* %171, i64 %160
store float %170, float* %172
%173 = load float, float* %21
%174 = fmul float %173, %158
%175 = fptosi float %170 to i32
%176 = call float @sin(i32 %175)
%177 = fmul float %174, %176
%178 = getelementptr inbounds float, float* %150, i64 %160
store float %177, float* %178
%179 = load float, float* %21
%180 = fmul float %55, %179
%181 = load float*, float** %13
%182 = getelementptr inbounds float, float* %181, i64 %160
%183 = load float, float* %182
%184 = fptosi float %183 to i32
%185 = call float @cos(i32 %184)
%186 = fmul float %180, %185
%187 = getelementptr inbounds float, float* %154, i64 %160
store float %186, float* %187
%188 = load i32, i32* %11
%189 = sext i32 %188 to i64
%190 = icmp slt i64 %165, %189
br i1 %190, label %159, label %191
191: ; preds = %159, %147
%192 = phi i32 [ %155, %147 ], [ %188, %159 ]
%193 = shl i32 %192, 2
%194 = call i64 @malloc(i32 %193)
%195 = inttoptr i64 %194 to float*
%196 = load i32, i32* %11
%197 = shl i32 %196, 2
%198 = call i64 @malloc(i32 %197)
%199 = inttoptr i64 %198 to float*
%200 = load i32, i32* %11
%201 = call i32 @cumulativeSum(float* %150, float* %195, i32 %200)
%202 = load i32, i32* %11
%203 = call i32 @cumulativeSum(float* %154, float* %199, i32 %202)
%204 = fmul float %7, 0x40B0A1A380000000
%205 = load i32, i32* %11
%206 = call i32 @scalecomplex(float* %195, float* %199, float %204, float 0.000000e+00, i32 %205)
%207 = load i32, i32* %11
%208 = call i32 @minValue(float* %195, i32 %207)
%209 = load i32, i32* %11
%210 = call i32 @maxValue(float* %199, i32 %209)
%211 = load i32, i32* %11
%212 = call i32 @minValue(float* %199, i32 %211)
%213 = bitcast i32* %23 to i8*
%214 = add nsw i32 %212, %210
%215 = sdiv i32 %214, -2
%216 = sitofp i32 %215 to float
%217 = sdiv i32 %208, -2
%218 = sitofp i32 %217 to float
%219 = load float, float* %15
%220 = call float @calculateMaxReadoutGradientAmplitude(float %219, float %7)
%221 = load float, float* %21
%222 = fmul float %55, %221
%223 = call i32 @grd_bipolar_prewinder(float %220, float %5, float %6, float %7, float %218, float %216, float %222, float** %16, float** %17, float** %18, float** %19, i32* %23)
%224 = load i32, i32* %23
%225 = srem i32 %224, 4
%226 = add nsw i32 %225, %224
store i32 %226, i32* %10
%227 = add nsw i32 %226, -1
%228 = srem i32 %227, 4
%229 = add nsw i32 %228, %227
store i32 %229, i32* %12
%230 = icmp ugt i32* %12, %10
%231 = select i1 %230, i32* %12, i32* %10
%232 = load i32, i32* %231
%233 = load i32, i32* %11
%234 = add nsw i32 %233, %232
%235 = add nsw i32 %234, %229
%236 = call i64 @calloc(i32 %235, i32 4)
%237 = inttoptr i64 %236 to float*
store float* %237, float** %8
%238 = call i64 @calloc(i32 %235, i32 4)
%239 = inttoptr i64 %238 to float*
store float* %239, float** %9
%240 = load float*, float** %8
%241 = load i32, i32* %231
%242 = load i32, i32* %23
%243 = sub nsw i32 %241, %242
%244 = sext i32 %243 to i64
%245 = getelementptr inbounds float, float* %240, i64 %244
%246 = load float*, float** %17
%247 = shl i32 %242, 2
%248 = call i32 @memcpy(float* %245, float* %246, i32 %247)
%249 = load float*, float** %9
%250 = load i32, i32* %231
%251 = load i32, i32* %23
%252 = sub nsw i32 %250, %251
%253 = sext i32 %252 to i64
%254 = getelementptr inbounds float, float* %249, i64 %253
%255 = load float*, float** %17
%256 = sext i32 %251 to i64
%257 = getelementptr inbounds float, float* %255, i64 %256
%258 = shl i32 %251, 2
%259 = call i32 @memcpy(float* %254, float* %257, i32 %258)
%260 = load float*, float** %8
%261 = load i32, i32* %231
%262 = sext i32 %261 to i64
%263 = getelementptr inbounds float, float* %260, i64 %262
%264 = load i32, i32* %11
%265 = shl i32 %264, 2
%266 = call i32 @memcpy(float* %263, float* %150, i32 %265)
%267 = load float*, float** %9
%268 = load i32, i32* %231
%269 = sext i32 %268 to i64
%270 = getelementptr inbounds float, float* %267, i64 %269
%271 = load i32, i32* %11
%272 = shl i32 %271, 2
%273 = call i32 @memcpy(float* %270, float* %154, i32 %272)
%274 = load i32, i32* %12
%275 = icmp sgt i32 %274, 0
%276 = load float*, float** %8
%277 = load i32, i32* %231
%278 = load i32, i32* %11
%279 = load float*, float** %9
br i1 %275, label %280, label %301
280: ; preds = %191
%281 = zext i32 %274 to i64
br label %282
282: ; preds = %280, %282
%283 = phi i64 [ 0, %280 ], [ %299, %282 ]
%284 = trunc i64 %283 to i32
%285 = xor i32 %284, -1
%286 = add i32 %277, %285
%287 = sext i32 %286 to i64
%288 = getelementptr inbounds float, float* %276, i64 %287
%289 = load float, float* %288
%290 = fneg float %289
%291 = trunc i64 %283 to i32
%292 = add i32 %277, %291
%293 = add i32 %292, %278
%294 = sext i32 %293 to i64
%295 = getelementptr inbounds float, float* %276, i64 %294
store float %290, float* %295
%296 = getelementptr inbounds float, float* %279, i64 %287
%297 = load float, float* %296
%298 = getelementptr inbounds float, float* %279, i64 %294
store float %297, float* %298
%299 = add nuw nsw i64 %283, 1
%300 = icmp eq i64 %299, %281
br i1 %300, label %301, label %282
301: ; preds = %282, %191
%302 = add nsw i32 %278, %277
%303 = sext i32 %302 to i64
%304 = getelementptr inbounds float, float* %276, i64 %303
%305 = getelementptr inbounds float, float* %279, i64 %303
%306 = load i32, i32* @M_PI
%307 = shl nsw i32 %306, 1
%308 = sitofp i32 %307 to float
%309 = fmul float %308, %4
%310 = fptosi float %309 to i32
%311 = call float @cos(i32 %310)
%312 = load i32, i32* @M_PI
%313 = shl nsw i32 %312, 1
%314 = sitofp i32 %313 to float
%315 = fmul float %314, %4
%316 = fptosi float %315 to i32
%317 = call float @sin(i32 %316)
%318 = load i32, i32* %12
%319 = call i32 @scalecomplex(float* %304, float* %305, float %311, float %317, i32 %318)
%320 = call i32 @free(float* %150)
%321 = call i32 @free(float* %154)
%322 = call i32 @free(float* %195)
%323 = call i32 @free(float* %199)
%324 = load float*, float** %16
%325 = call i32 @free(float* %324)
%326 = load float*, float** %17
%327 = call i32 @free(float* %326)
%328 = load float*, float** %18
%329 = call i32 @free(float* %328)
%330 = load float*, float** %19
%331 = call i32 @free(float* %330)
br label %332
332: ; preds = %301, %57
%333 = phi i32 [ 1, %57 ], [ 0, %301 ]
ret i32 %333
}