void red(double **x, int dim, int N, int K, double *psi, double *scal,
         double *mic, double *mir) {
  int i, k, *n1, *n2;
  double *xc, dx;
  double *eps, Eps;
  int maxdim;
  double dxy1, dxy2;
  int *nn;
  int d;
  int BOX, BOX1;
  int **box, *lis;
  int **box1;
  int **lis1;
  int **mxi;
  double epsilon;
  int inveps;
  double *phi;
  phi = (double *)malloc((K + 1) * sizeof(double));
  for (i = 1; i <= K; i++)
    phi[i] = psi[i] - (dim - 1) / ((double)i);
  nn = (int *)malloc((K + 1) * sizeof(int));
  xc = (double *)malloc((dim + 1) * sizeof(double));
  BOX = 1;
  while (0.5 * BOX * BOX * K < N)
    BOX *= 2;
  epsilon = 4.0 / BOX;
  inveps = BOX / 4;
  BOX1 = N - 5;
  box1 = (int **)malloc(dim * sizeof(int *));
  lis1 = (int **)malloc(dim * sizeof(int *));
  mxi = (int **)malloc(dim * sizeof(int *));
  for (d = 0; d < dim; d++) {
    box1[d] = (int *)malloc((BOX1 + 1) * sizeof(int));
    lis1[d] = (int *)malloc(N * sizeof(int));
    mxi[d] = (int *)malloc((BOX1 + 1) * sizeof(int));
  }
  box = (int **)malloc(BOX * sizeof(int *));
  for (i = 0; i < BOX; i++)
    box[i] = (int *)malloc((BOX) * sizeof(int));
  lis = (int *)malloc(N * sizeof(int));
  eps = (double *)malloc(dim * sizeof(double));
  n1 = (int *)malloc(dim * sizeof(int));
  n2 = (int *)malloc(dim * sizeof(int));
  make_box2(x, dim, N, 0, dim - 1, BOX, inveps, box, lis);
  for (d = 0; d < dim; d++)
    make_box1(x[d], N, scal[d], BOX1, box1[d], lis1[d], mxi[d]);
  dxy1 = dxy2 = 0.0;
  for (i = 0; i < N; i++) {
    for (d = 0; d < dim; d++)
      xc[d] = x[d][i];
    neiK(x, dim, 0, dim - 1, i, BOX, epsilon, K, box, lis, nn);
    Eps = 0;
    maxdim = -1;
    for (d = 0; d < dim; d++) {
      eps[d] = 0;
      for (k = 1; k <= K; k++) {
        if ((dx = fabs(xc[d] - x[d][nn[k]])) > eps[d])
          eps[d] = dx;
      }
      if (eps[d] > Eps) {
        Eps = eps[d];
        maxdim = d;
      }
    }
    for (d = 0; d < dim; d++) {
      n2[d] = neiE1(x[d], i, scal[d], BOX1, eps[d], box1[d], lis1[d], mxi[d]);
      if (d == maxdim) {
        n1[d] = n2[d];
        dxy1 += psi[n1[d]];
      } else {
        n1[d] = neiE1(x[d], i, scal[d], BOX1, Eps, box1[d], lis1[d], mxi[d]);
        dxy1 += psi[n1[d] + 1];
      }
      dxy2 += psi[n2[d]];
    }
  }
  dxy1 /= N;
  *mic = (dim - 1) * psi[N] + psi[K] - dxy1;
  dxy2 /= N;
  *mir = (dim - 1) * psi[N] + phi[K] - dxy2;
  free(xc);
  free(nn);
  for (i = 0; i < BOX; i++)
    free(box[i]);
  free(box);
  free(lis);
  for (d = 0; d < dim; d++) {
    free(box1[d]);
    free(lis1[d]);
    free(mxi[d]);
  }
  free(box1);
  free(lis1);
  free(mxi);
  free(eps);
  free(n1);
  free(n2);
  free(phi);
}


x86 assembly (clang, -O0):
<red>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0xf8,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xd8(%rbp)
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     11f7 <red+0x97>
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
cvtsi2sdl -0x34(%rbp),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
mov    -0xd8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11a9 <red+0x49>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x88(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x50(%rbp)
movl   $0x1,-0x90(%rbp)
cvtsi2sdl -0x90(%rbp),%xmm0
ff
movsd  0xdc0(%rip),%xmm1
mulsd  %xmm0,%xmm1
cvtsi2sdl -0x90(%rbp),%xmm0
ff
mulsd  %xmm0,%xmm1
cvtsi2sdl -0x1c(%rbp),%xmm0
mulsd  %xmm0,%xmm1
cvtsi2sdl -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    127c <red+0x11c>
mov    -0x90(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    1230 <red+0xd0>
cvtsi2sdl -0x90(%rbp),%xmm1
ff
movsd  0xd7c(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
mov    -0x90(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0xcc(%rbp)
mov    -0x18(%rbp),%eax
sub    $0x5,%eax
mov    %eax,-0x94(%rbp)
movslq -0x14(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xb0(%rbp)
movslq -0x14(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xb8(%rbp)
movslq -0x14(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xc0(%rbp)
movl   $0x0,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1397 <red+0x237>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,%rdx
mov    -0xb0(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movslq -0x18(%rbp),%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,%rdx
mov    -0xb8(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x94(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,%rdx
mov    -0xc0(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    12fe <red+0x19e>
movslq -0x90(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xa0(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x90(%rbp),%eax
jge    13f4 <red+0x294>
movslq -0x90(%rbp),%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,%rdx
mov    -0xa0(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    13b5 <red+0x255>
movslq -0x18(%rbp),%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xa8(%rbp)
movslq -0x14(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x60(%rbp)
movslq -0x14(%rbp),%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x40(%rbp)
movslq -0x14(%rbp),%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%r8d
sub    $0x1,%r8d
mov    -0x90(%rbp),%r9d
mov    -0xcc(%rbp),%r11d
mov    -0xa0(%rbp),%r10
mov    -0xa8(%rbp),%rax
xor    %ecx,%ecx
mov    %r11d,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   1080 <make_box2@plt>
movl   $0x0,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1512 <red+0x3b2>
mov    -0x10(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%esi
mov    -0x30(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x94(%rbp),%edx
mov    -0xb0(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0xb8(%rbp),%rax
movslq -0x8c(%rbp),%r8
mov    (%rax,%r8,8),%r8
mov    -0xc0(%rbp),%rax
movslq -0x8c(%rbp),%r9
mov    (%rax,%r9,8),%r9
mov    $0x1,%al
call   1040 <make_box1@plt>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    148a <red+0x32a>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    18d8 <red+0x778>
movl   $0x0,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    158a <red+0x42a>
mov    -0x10(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x50(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    153f <red+0x3df>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x34(%rbp),%r8d
mov    -0x90(%rbp),%r9d
movsd  -0xc8(%rbp),%xmm0
ff
mov    -0x1c(%rbp),%ebx
mov    -0xa0(%rbp),%r11
mov    -0xa8(%rbp),%r10
mov    -0x88(%rbp),%rax
xor    %edx,%edx
mov    %ebx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
mov    $0x1,%al
call   1050 <neiK@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
movl   $0xffffffff,-0x6c(%rbp)
movl   $0x0,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    16fe <red+0x59e>
mov    -0x60(%rbp),%rax
movslq -0x8c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x1,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     16ac <red+0x54c>
mov    -0x50(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x88(%rbp),%rcx
movslq -0x38(%rbp),%rdx
movslq (%rcx,%rdx,4),%rcx
subsd  (%rax,%rcx,8),%xmm0
movaps 0x9ab(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x60(%rbp),%rax
movslq -0x8c(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    1699 <red+0x539>
movsd  -0x58(%rbp),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    169e <red+0x53e>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    161f <red+0x4bf>
mov    -0x60(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x68(%rbp),%xmm0
jbe    16e5 <red+0x585>
mov    -0x60(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x8c(%rbp),%eax
mov    %eax,-0x6c(%rbp)
jmp    16ea <red+0x58a>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    15f6 <red+0x496>
movl   $0x0,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    18c5 <red+0x765>
mov    -0x10(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x34(%rbp),%esi
mov    -0x30(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x94(%rbp),%edx
mov    -0x60(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0xb0(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0xb8(%rbp),%rax
movslq -0x8c(%rbp),%r8
mov    (%rax,%r8,8),%r8
mov    -0xc0(%rbp),%rax
movslq -0x8c(%rbp),%r9
mov    (%rax,%r9,8),%r9
mov    $0x2,%al
call   1060 <neiE1@plt>
mov    %eax,%edx
mov    -0x48(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8c(%rbp),%eax
cmp    -0x6c(%rbp),%eax
jne    17ee <red+0x68e>
mov    -0x48(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x40(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rcx
movslq -0x8c(%rbp),%rdx
movslq (%rcx,%rdx,4),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    188f <red+0x72f>
mov    -0x10(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x34(%rbp),%esi
mov    -0x30(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x94(%rbp),%edx
movsd  -0x68(%rbp),%xmm1
mov    -0xb0(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0xb8(%rbp),%rax
movslq -0x8c(%rbp),%r8
mov    (%rax,%r8,8),%r8
mov    -0xc0(%rbp),%rax
movslq -0x8c(%rbp),%r9
mov    (%rax,%r9,8),%r9
mov    $0x2,%al
call   1060 <neiE1@plt>
mov    %eax,%edx
mov    -0x40(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rcx
movslq -0x8c(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x48(%rbp),%rcx
movslq -0x8c(%rbp),%rdx
movslq (%rcx,%rdx,4),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    1708 <red+0x5a8>
jmp    18ca <red+0x76a>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1529 <red+0x3c9>
cvtsi2sdl -0x18(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x78(%rbp),%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
cvtsi2sdl -0x18(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0xd8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x80(%rbp),%xmm0
mov    0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x88(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x90(%rbp),%eax
jge    19c0 <red+0x860>
mov    -0xa0(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    198f <red+0x82f>
mov    -0xa0(%rbp),%rdi
call   1030 <free@plt>
mov    -0xa8(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1a4a <red+0x8ea>
mov    -0xb0(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0xb8(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0xc0(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    19e2 <red+0x882>
mov    -0xb0(%rbp),%rdi
call   1030 <free@plt>
mov    -0xb8(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc0(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0xd8(%rbp),%rdi
call   1030 <free@plt>
add    $0xf8,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<red>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
mov    %r9,%r15
mov    %r8,%rbp
mov    %ecx,%r12d
mov    %rdx,0x10(%rsp)
mov    %esi,%r14d
mov    %rdi,%r13
mov    0x168(%rsp),%rax
mov    %rax,0xd0(%rsp)
mov    0x160(%rsp),%rax
mov    %rax,0xc8(%rsp)
lea    0x1(%r12),%eax
mov    %eax,0x1c(%rsp)
movslq %eax,%rbx
lea    0x0(,%rbx,8),%rdi
call   1070 <malloc@plt>
test   %r12d,%r12d
jle    12d7 <red+0x177>
lea    -0x1(%r14),%ecx
cvtsi2sd %ecx,%xmm0
mov    0x1c(%rsp),%ecx
lea    -0x1(%rcx),%r8
mov    $0x1,%edx
cmp    $0x2,%r8
jb     12b0 <red+0x150>
mov    %r8,%r9
and    $0xfffffffffffffffe,%r9
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
lea    -0x2(%r9),%rsi
mov    %rsi,%rdx
shr    %rdx
add    $0x1,%rdx
test   %rsi,%rsi
je     1b47 <red+0x9e7>
mov    %rdx,%rsi
and    $0xfffffffffffffffe,%rsi
movdqa 0xdf5(%rip),%xmm2
mov    $0x1,%edi
movdqa 0xdf8(%rip),%xmm3
movdqa 0xe00(%rip),%xmm4
movupd 0x0(%rbp,%rdi,8),%xmm5
cvtdq2pd %xmm2,%xmm6
movapd %xmm1,%xmm7
divpd  %xmm6,%xmm7
subpd  %xmm7,%xmm5
movupd %xmm5,(%rax,%rdi,8)
movdqa %xmm2,%xmm5
paddd  %xmm3,%xmm5
movupd 0x10(%rbp,%rdi,8),%xmm6
cvtdq2pd %xmm5,%xmm5
movapd %xmm1,%xmm7
divpd  %xmm5,%xmm7
subpd  %xmm7,%xmm6
movupd %xmm6,0x10(%rax,%rdi,8)
paddd  %xmm4,%xmm2
add    $0x4,%rdi
add    $0xfffffffffffffffe,%rsi
jne    1230 <red+0xd0>
cvtdq2pd %xmm2,%xmm2
test   $0x1,%dl
je     1299 <red+0x139>
movupd 0x0(%rbp,%rdi,8),%xmm3
divpd  %xmm2,%xmm1
subpd  %xmm1,%xmm3
movupd %xmm3,(%rax,%rdi,8)
cmp    %r9,%r8
je     12d7 <red+0x177>
or     $0x1,%r8
mov    %r8,%rdx
cs nopw 0x0(%rax,%rax,1)
nop
movsd  0x0(%rbp,%rdx,8),%xmm1
xorps  %xmm2,%xmm2
cvtsi2sd %edx,%xmm2
movapd %xmm0,%xmm3
divsd  %xmm2,%xmm3
subsd  %xmm3,%xmm1
movsd  %xmm1,(%rax,%rdx,8)
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    12b0 <red+0x150>
mov    %r13,0x98(%rsp)
mov    %r15,0x28(%rsp)
mov    %rbp,0xb8(%rsp)
mov    %rax,0xa0(%rsp)
shl    $0x2,%rbx
mov    %rbx,%rdi
call   1070 <malloc@plt>
mov    %rax,%r15
movslq %r14d,%rbp
lea    0x8(,%rbp,8),%rdi
call   1070 <malloc@plt>
mov    %rax,0x50(%rsp)
mov    %r12,0xb0(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm0
mov    0x10(%rsp),%r12
xorps  %xmm3,%xmm3
cvtsi2sd %r12d,%xmm3
mov    $0x1,%eax
movsd  0xd0e(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%ecx
xorps  %xmm4,%xmm4
cvtsi2sd %eax,%xmm4
movapd %xmm4,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm4,%xmm2
mulsd  %xmm0,%xmm2
lea    (%rcx,%rcx,1),%eax
ucomisd %xmm2,%xmm3
ja     1350 <red+0x1f0>
movq   %xmm4,0x8(%rsp)
mov    %rcx,0x88(%rsp)
movsd  %xmm3,0xa8(%rsp)
movsd  0xcc7(%rip),%xmm0
movsd  %xmm0,0x40(%rsp)
shl    $0x3,%rbp
mov    %rbp,%rdi
call   1070 <malloc@plt>
mov    %rax,0x68(%rsp)
mov    %rbp,%rdi
call   1070 <malloc@plt>
mov    %rax,0x60(%rsp)
mov    %rbp,0x30(%rsp)
mov    %rbp,%rdi
call   1070 <malloc@plt>
mov    %rax,%r13
movslq %r12d,%rax
mov    %rax,0x70(%rsp)
mov    %r14d,%edx
mov    %r14,0x48(%rsp)
test   %r14d,%r14d
jle    143e <red+0x2de>
mov    0x70(%rsp),%rax
lea    -0x10(,%rax,4),%rbx
ff
lea    0x0(,%rax,4),%r12
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rdx,%r14
call   1070 <malloc@plt>
mov    0x68(%rsp),%rcx
mov    %rax,(%rcx,%rbp,8)
mov    %r12,%rdi
call   1070 <malloc@plt>
mov    0x60(%rsp),%rcx
mov    %rax,(%rcx,%rbp,8)
mov    %rbx,%rdi
call   1070 <malloc@plt>
mov    %r14,%rdx
mov    %rax,0x0(%r13,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1400 <red+0x2a0>
mov    %rdx,0x38(%rsp)
mov    %r13,0x58(%rsp)
movsd  0x40(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x40(%rsp)
mov    0x88(%rsp),%r12
mov    %r12d,%eax
shr    $0x2,%eax
mov    %rax,0x8(%rsp)
mov    0x10(%rsp),%rax
add    $0xfffffffb,%eax
mov    %eax,0x24(%rsp)
mov    %r12d,%ebx
lea    0x0(,%rbx,8),%rdi
call   1070 <malloc@plt>
mov    %rax,%r13
shl    $0x2,%rbx
cmp    $0x2,%r12d
mov    $0x1,%r14d
cmovae %r12d,%r14d
xor    %ebp,%ebp
mov    %rbx,%rdi
call   1070 <malloc@plt>
mov    %rax,0x0(%r13,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%r14
jne    14a0 <red+0x340>
mov    %r14,0xc0(%rsp)
mov    0x70(%rsp),%rax
lea    0x0(,%rax,4),%rdi
call   1070 <malloc@plt>
mov    %rax,%r14
mov    0x30(%rsp),%rdi
call   1070 <malloc@plt>
mov    %rax,0x90(%rsp)
mov    0x48(%rsp),%rbx
lea    -0x1(%rbx),%r8d
sub    $0x8,%rsp
mov    %r13,%rbp
mov    0xa0(%rsp),%r13
mov    %r13,%rdi
mov    %ebx,%esi
mov    0x18(%rsp),%rdx
xor    %ecx,%ecx
mov    %r8d,0x28(%rsp)
mov    %r12d,%r9d
xor    %eax,%eax
mov    %r14,0x80(%rsp)
push   %r14
mov    %rbp,0x90(%rsp)
push   %rbp
push   0x20(%rsp)
call   1080 <make_box2@plt>
add    $0x20,%rsp
test   %ebx,%ebx
mov    0x28(%rsp),%rcx
mov    0x68(%rsp),%r12
mov    0x60(%rsp),%rbp
mov    0x58(%rsp),%rsi
mov    0x24(%rsp),%r14d
jle    159e <red+0x43e>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%r13,%rbx,8),%rdi
movsd  (%rcx,%rbx,8),%xmm0
mov    (%r12,%rbx,8),%rcx
mov    0x0(%rbp,%rbx,8),%r8
mov    (%rsi,%rbx,8),%r9
mov    0x10(%rsp),%rsi
mov    %r14d,%edx
mov    $0x1,%al
call   1040 <make_box1@plt>
mov    0x38(%rsp),%rdi
mov    0x58(%rsp),%rsi
mov    0x28(%rsp),%rcx
add    $0x1,%rbx
cmp    %rbx,%rdi
jne    1560 <red+0x400>
mov    0x10(%rsp),%rax
test   %eax,%eax
mov    0xb0(%rsp),%r14
jle    19df <red+0x87f>
mov    %eax,%eax
mov    %rax,0xf8(%rsp)
mov    0x1c(%rsp),%r12d
mov    0x38(%rsp),%rdx
lea    -0x1(%rdx),%rax
mov    %rax,0xe0(%rsp)
add    $0xffffffffffffffff,%r12
mov    %r12,0xd8(%rsp)
mov    %edx,%ebp
and    $0x3,%ebp
and    $0xfffffffc,%edx
and    $0xfffffffffffffffe,%r12
neg    %r12
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x30(%rsp)
xor    %ebx,%ebx
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    0x50(%rsp),%rdi
mov    0x48(%rsp),%rsi
mov    %rbp,0xf0(%rsp)
mov    %rdx,0xe8(%rsp)
jmp    16b1 <red+0x551>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13,%rdi
xor    %edx,%edx
mov    %rcx,%rbp
mov    0x20(%rsp),%ecx
mov    0x8(%rsp),%r8
mov    0x88(%rsp),%r9
movsd  0x40(%rsp),%xmm0
mov    $0x1,%al
push   %r15
push   0x80(%rsp)
push   0x90(%rsp)
push   %r14
call   1050 <neiK@plt>
mov    0x28(%rsp),%rbx
mov    %rbp,%rcx
add    $0x20,%rsp
add    $0x1,%rbx
cmp    0xf8(%rsp),%rbx
mov    0x48(%rsp),%rsi
mov    0xb0(%rsp),%r14
mov    0x50(%rsp),%rdi
movsd  0xa8(%rsp),%xmm2
mov    0xf0(%rsp),%rbp
mov    0xe8(%rsp),%rdx
je     1a06 <red+0x8a6>
test   %esi,%esi
mov    %rbx,0x8(%rsp)
jle    1630 <red+0x4d0>
cmpq   $0x3,0xe0(%rsp)
jae    16d0 <red+0x570>
xor    %eax,%eax
jmp    1728 <red+0x5c8>
nopl   (%rax)
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%r13,%rax,8),%rcx
movsd  (%rcx,%rbx,8),%xmm0
movsd  %xmm0,(%rdi,%rax,8)
mov    0x8(%r13,%rax,8),%rcx
movsd  (%rcx,%rbx,8),%xmm0
movsd  %xmm0,0x8(%rdi,%rax,8)
mov    0x10(%r13,%rax,8),%rcx
movsd  (%rcx,%rbx,8),%xmm0
movsd  %xmm0,0x10(%rdi,%rax,8)
mov    0x18(%r13,%rax,8),%rcx
movsd  (%rcx,%rbx,8),%xmm0
movsd  %xmm0,0x18(%rdi,%rax,8)
add    $0x4,%rax
cmp    %rax,%rdx
jne    16e0 <red+0x580>
test   %rbp,%rbp
je     1757 <red+0x5f7>
lea    (%rdi,%rax,8),%rcx
lea    0x0(,%rax,8),%rax
add    %r13,%rax
xor    %edx,%edx
xchg   %ax,%ax
mov    (%rax,%rdx,8),%rdi
movsd  (%rdi,%rbx,8),%xmm0
movsd  %xmm0,(%rcx,%rdx,8)
add    $0x1,%rdx
cmp    %rdx,%rbp
jne    1740 <red+0x5e0>
mov    %r13,%rdi
xor    %edx,%edx
mov    0x20(%rsp),%ecx
mov    %ebx,%r8d
mov    0x88(%rsp),%r9
movsd  0x40(%rsp),%xmm0
mov    $0x1,%al
push   %r15
push   0x80(%rsp)
push   0x90(%rsp)
push   %r14
mov    %rsi,%rbx
call   1050 <neiK@plt>
mov    %rbx,%r10
add    $0x20,%rsp
test   %r10d,%r10d
jle    19d0 <red+0x870>
mov    $0xffffffff,%eax
xorpd  %xmm0,%xmm0
xor    %ecx,%ecx
mov    0x1c(%rsp),%r8d
mov    0x50(%rsp),%r9
mov    0x90(%rsp),%rbp
mov    0xd8(%rsp),%r11
mov    0x38(%rsp),%rbx
movapd 0x871(%rip),%xmm3
movapd 0x869(%rip),%xmm4
jmp    1802 <red+0x6a2>
nopl   0x0(%rax)
movsd  %xmm5,0x0(%rbp,%rcx,8)
ucomisd %xmm0,%xmm5
cmova  %ecx,%eax
maxsd  %xmm0,%xmm5
add    $0x1,%rcx
movapd %xmm5,%xmm0
cmp    %rbx,%rcx
je     18a0 <red+0x740>
movq   $0x0,0x0(%rbp,%rcx,8)
xorpd  %xmm5,%xmm5
test   %r14d,%r14d
jle    17e6 <red+0x686>
movsd  (%r9,%rcx,8),%xmm1
mov    0x0(%r13,%rcx,8),%rdx
xorpd  %xmm5,%xmm5
mov    $0x1,%esi
cmp    $0x2,%r8d
je     186d <red+0x70d>
xchg   %ax,%ax
movslq (%r15,%rsi,4),%rdi
movapd %xmm1,%xmm2
subsd  (%rdx,%rdi,8),%xmm2
andpd  %xmm4,%xmm2
maxsd  %xmm5,%xmm2
movslq 0x4(%r15,%rsi,4),%rdi
movapd %xmm1,%xmm5
subsd  (%rdx,%rdi,8),%xmm5
andpd  %xmm4,%xmm5
maxsd  %xmm2,%xmm5
lea    (%r12,%rsi,1),%rdi
add    $0x2,%rdi
add    $0x2,%rsi
cmp    $0x1,%rdi
jne    1830 <red+0x6d0>
test   $0x1,%r11b
je     17e0 <red+0x680>
movslq (%r15,%rsi,4),%rsi
subsd  (%rdx,%rsi,8),%xmm1
andpd  %xmm3,%xmm1
maxsd  %xmm5,%xmm1
movapd %xmm1,%xmm5
jmp    17e0 <red+0x680>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
test   %r10d,%r10d
mov    0x28(%rsp),%rcx
jle    19d5 <red+0x875>
movapd %xmm5,0x110(%rsp)
mov    %eax,%eax
mov    %rax,0x100(%rsp)
xor    %r14d,%r14d
mov    0x8(%rsp),%rbx
jmp    192b <red+0x7cb>
nopl   0x0(%rax,%rax,1)
cltq
mov    0xb8(%rsp),%rcx
movsd  0x30(%rsp),%xmm0
addsd  (%rcx,%rax,8),%xmm0
movsd  %xmm0,0x30(%rsp)
movslq %ebp,%rax
movsd  0x10(%rsp),%xmm0
addsd  (%rcx,%rax,8),%xmm0
movsd  %xmm0,0x10(%rsp)
add    $0x1,%r14
mov    0x38(%rsp),%rax
cmp    %r14,%rax
mov    0x28(%rsp),%rcx
mov    0x98(%rsp),%r13
mov    0x90(%rsp),%rbp
mov    0x8(%rsp),%rbx
je     1674 <red+0x514>
mov    0x0(%r13,%r14,8),%rdi
movsd  (%rcx,%r14,8),%xmm0
movsd  0x0(%rbp,%r14,8),%xmm1
mov    0x68(%rsp),%rax
mov    (%rax,%r14,8),%rcx
mov    0x60(%rsp),%rax
mov    (%rax,%r14,8),%r13
mov    0x58(%rsp),%rax
mov    (%rax,%r14,8),%r9
mov    %ebx,%esi
mov    %rcx,%rbx
mov    0x24(%rsp),%edx
mov    %r13,%r8
mov    %r9,0x108(%rsp)
mov    $0x2,%al
call   1060 <neiE1@plt>
mov    %eax,%ebp
cmp    %r14,0x100(%rsp)
je     18d0 <red+0x770>
mov    0x98(%rsp),%rax
mov    (%rax,%r14,8),%rdi
mov    0x28(%rsp),%rax
movsd  (%rax,%r14,8),%xmm0
mov    0x8(%rsp),%rsi
mov    0x24(%rsp),%edx
movapd 0x110(%rsp),%xmm1
mov    %rbx,%rcx
mov    %r13,%r8
mov    0x108(%rsp),%r9
mov    $0x2,%al
call   1060 <neiE1@plt>
add    $0x1,%eax
jmp    18d0 <red+0x770>
nopl   0x0(%rax)
mov    0x28(%rsp),%rcx
mov    0x8(%rsp),%rbx
jmp    1674 <red+0x514>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x30(%rsp)
mov    0x50(%rsp),%rdi
movsd  0xa8(%rsp),%xmm2
mov    0x48(%rsp),%rsi
mov    %rsi,%r13
movsd  0x30(%rsp),%xmm3
divsd  %xmm2,%xmm3
xorps  %xmm0,%xmm0
cvtsi2sdl 0x20(%rsp),%xmm0
movslq %r14d,%rax
mov    0xb8(%rsp),%rcx
mov    0x70(%rsp),%rsi
movsd  (%rcx,%rsi,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rcx,%rax,8),%xmm1
subsd  %xmm3,%xmm1
mov    0xc8(%rsp),%rdx
movsd  %xmm1,(%rdx)
movsd  0x10(%rsp),%xmm1
divsd  %xmm2,%xmm1
mulsd  (%rcx,%rsi,8),%xmm0
mov    0xa0(%rsp),%rcx
addsd  (%rcx,%rax,8),%xmm0
subsd  %xmm1,%xmm0
mov    0xd0(%rsp),%rax
movsd  %xmm0,(%rax)
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
mov    0x80(%rsp),%r14
mov    0xc0(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1aa0 <red+0x940>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x78(%rsp),%rdi
call   1030 <free@plt>
test   %r13d,%r13d
mov    0x68(%rsp),%r12
mov    0x60(%rsp),%r14
mov    0x58(%rsp),%r15
mov    0x38(%rsp),%rbp
jle    1b04 <red+0x9a4>
xor    %ebx,%ebx
nop
mov    (%r12,%rbx,8),%rdi
call   1030 <free@plt>
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
mov    (%r15,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1ae0 <red+0x980>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    0x90(%rsp),%rdi
call   1030 <free@plt>
mov    0xa0(%rsp),%rdi
add    $0x128,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
movapd 0x4b1(%rip),%xmm2
mov    $0x1,%edi
test   $0x1,%dl
jne    1286 <red+0x126>
jmp    1299 <red+0x139>

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

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