void redc(double **x, int dim, int N, int K, double *psi, double *scal,
          double *mic) {
  int i, k, *n1;
  double *xc, dx;
  double *eps, Eps;
  int maxdim;
  double dxy1;
  int *nn;
  int d;
  int BOX, BOX1;
  int **box, *lis;
  int **box1;
  int **lis1;
  int **mxi;
  double epsilon;
  int inveps;
  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));
  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 = 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++) {
      n1[d] = neiE1(x[d], i, scal[d], BOX1, Eps, box1[d], lis1[d], mxi[d]);
      if (d == maxdim) {
        dxy1 += psi[n1[d]];
      } else {
        dxy1 += psi[n1[d] + 1];
      }
    }
  }
  dxy1 /= N;
  *mic = (dim - 1) * psi[N] + psi[K] - dxy1;
  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);
}


x86 assembly (clang, -O0):
<redc>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0xd8,%rsp
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    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x78(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x48(%rbp)
movl   $0x1,-0x80(%rbp)
cvtsi2sdl -0x80(%rbp),%xmm0
movsd  0xe3b(%rip),%xmm1
mulsd  %xmm0,%xmm1
cvtsi2sdl -0x80(%rbp),%xmm0
mulsd  %xmm0,%xmm1
cvtsi2sdl -0x1c(%rbp),%xmm0
mulsd  %xmm0,%xmm1
cvtsi2sdl -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11f8 <redc+0x98>
mov    -0x80(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    11b8 <redc+0x58>
cvtsi2sdl -0x80(%rbp),%xmm1
movsd  0xe03(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
mov    -0x80(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0xbc(%rbp)
mov    -0x18(%rbp),%eax
sub    $0x5,%eax
mov    %eax,-0x84(%rbp)
movslq -0x14(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xa0(%rbp)
movslq -0x14(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xa8(%rbp)
movslq -0x14(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xb0(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12f8 <redc+0x198>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,%rdx
mov    -0xa0(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movslq -0x18(%rbp),%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,%rdx
mov    -0xa8(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,%rdx
mov    -0xb0(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1271 <redc+0x111>
movslq -0x80(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x90(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x80(%rbp),%eax
jge    134c <redc+0x1ec>
movslq -0x80(%rbp),%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,%rdx
mov    -0x90(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1313 <redc+0x1b3>
movslq -0x18(%rbp),%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x98(%rbp)
movslq -0x14(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x58(%rbp)
movslq -0x14(%rbp),%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%r8d
sub    $0x1,%r8d
mov    -0x80(%rbp),%r9d
mov    -0xbc(%rbp),%r11d
mov    -0x90(%rbp),%r10
mov    -0x98(%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,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    143b <redc+0x2db>
mov    -0x10(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%esi
mov    -0x30(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x84(%rbp),%edx
mov    -0xa0(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0xa8(%rbp),%rax
movslq -0x7c(%rbp),%r8
mov    (%rax,%r8,8),%r8
mov    -0xb0(%rbp),%rax
movslq -0x7c(%rbp),%r9
mov    (%rax,%r9,8),%r9
mov    $0x1,%al
call   1040 <make_box1@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    13cb <redc+0x26b>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    16d5 <redc+0x575>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1499 <redc+0x339>
mov    -0x10(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    145d <redc+0x2fd>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x34(%rbp),%r8d
mov    -0x80(%rbp),%r9d
movsd  -0xb8(%rbp),%xmm0
ff
mov    -0x1c(%rbp),%ebx
mov    -0x90(%rbp),%r11
mov    -0x98(%rbp),%r10
mov    -0x78(%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,-0x60(%rbp)
movl   $0xffffffff,-0x64(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    15e0 <redc+0x480>
mov    -0x58(%rbp),%rax
movslq -0x7c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x1,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     159d <redc+0x43d>
mov    -0x48(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x78(%rbp),%rcx
movslq -0x38(%rbp),%rdx
movslq (%rcx,%rdx,4),%rcx
subsd  (%rax,%rcx,8),%xmm0
movaps 0xab4(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x58(%rbp),%rax
movslq -0x7c(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    158a <redc+0x42a>
movsd  -0x50(%rbp),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    158f <redc+0x42f>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    151f <redc+0x3bf>
mov    -0x58(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x60(%rbp),%xmm0
jbe    15cd <redc+0x46d>
mov    -0x58(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x7c(%rbp),%eax
mov    %eax,-0x64(%rbp)
jmp    15d2 <redc+0x472>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    14fc <redc+0x39c>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    16c2 <redc+0x562>
mov    -0x10(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x34(%rbp),%esi
mov    -0x30(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x84(%rbp),%edx
movsd  -0x60(%rbp),%xmm1
mov    -0xa0(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0xa8(%rbp),%rax
movslq -0x7c(%rbp),%r8
mov    (%rax,%r8,8),%r8
mov    -0xb0(%rbp),%rax
movslq -0x7c(%rbp),%r9
mov    (%rax,%r9,8),%r9
mov    $0x2,%al
call   1060 <neiE1@plt>
mov    %eax,%edx
mov    -0x40(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x7c(%rbp),%eax
cmp    -0x64(%rbp),%eax
jne    168b <redc+0x52b>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rcx
movslq -0x7c(%rbp),%rdx
movslq (%rcx,%rdx,4),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    16af <redc+0x54f>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rcx
movslq -0x7c(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    16b4 <redc+0x554>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    15e7 <redc+0x487>
jmp    16c7 <redc+0x567>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    144a <redc+0x2ea>
cvtsi2sdl -0x18(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%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  -0x70(%rbp),%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x78(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x80(%rbp),%eax
jge    1768 <redc+0x608>
mov    -0x90(%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    173a <redc+0x5da>
mov    -0x90(%rbp),%rdi
call   1030 <free@plt>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    17dd <redc+0x67d>
mov    -0xa0(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0xa8(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0xb0(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1787 <redc+0x627>
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    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
add    $0xd8,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<redc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    %r9,0x90(%rsp)
mov    %r8,0x28(%rsp)
mov    %ecx,%ebx
mov    %edx,%r15d
mov    %esi,%ebp
mov    %rdi,0x30(%rsp)
mov    0x120(%rsp),%rax
mov    %rax,0xb8(%rsp)
lea    0x1(%rbx),%eax
mov    %eax,0x38(%rsp)
movslq %eax,%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,%r14
mov    %rbp,0x18(%rsp)
movslq %ebp,%rbp
lea    0x8(,%rbp,8),%rdi
call   1070 <malloc@plt>
mov    %rax,0x80(%rsp)
mov    %rbx,0x50(%rsp)
cvtsi2sd %ebx,%xmm0
cvtsi2sd %r15d,%xmm3
mov    $0x1,%eax
movsd  0xe18(%rip),%xmm1
nopl   0x0(%rax,%rax,1)
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     11f0 <redc+0x90>
movsd  %xmm4,0x88(%rsp)
mov    %rcx,0x48(%rsp)
movsd  %xmm3,0x98(%rsp)
movsd  0xdd7(%rip),%xmm0
movsd  %xmm0,0x40(%rsp)
lea    0x0(,%rbp,8),%rbx
mov    %rbx,%rdi
call   1070 <malloc@plt>
mov    %rax,0x10(%rsp)
mov    %rbx,%rdi
call   1070 <malloc@plt>
mov    %rax,%r13
mov    %rbx,%rdi
call   1070 <malloc@plt>
mov    %rax,%r12
mov    %r15,(%rsp)
movslq %r15d,%rax
mov    %rax,0x60(%rsp)
mov    0x18(%rsp),%r15d
test   %ebp,%ebp
jle    12d8 <redc+0x178>
mov    0x60(%rsp),%rax
lea    -0x10(,%rax,4),%rbx
ff
lea    0x0(,%rax,4),%rax
mov    %rax,0xa0(%rsp)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1070 <malloc@plt>
mov    0x10(%rsp),%rcx
mov    %rax,(%rcx,%rbp,8)
mov    0xa0(%rsp),%rdi
call   1070 <malloc@plt>
mov    %rax,0x0(%r13,%rbp,8)
mov    %rbx,%rdi
call   1070 <malloc@plt>
mov    %rax,(%r12,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%r15
jne    12a0 <redc+0x140>
mov    %r12,0x68(%rsp)
mov    %r13,0x58(%rsp)
mov    %r15,0x20(%rsp)
movsd  0x40(%rsp),%xmm0
divsd  0x88(%rsp),%xmm0
movsd  %xmm0,0x40(%rsp)
mov    0x48(%rsp),%rbp
mov    %ebp,%r15d
shr    $0x2,%r15d
mov    (%rsp),%rax
add    $0xfffffffb,%eax
mov    %eax,0x3c(%rsp)
mov    %ebp,%r13d
lea    0x0(,%r13,8),%rdi
call   1070 <malloc@plt>
mov    %rax,%r12
shl    $0x2,%r13
cmp    $0x2,%ebp
mov    $0x1,%ebx
cmovae %ebp,%ebx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1070 <malloc@plt>
mov    %rax,(%r12,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1340 <redc+0x1e0>
mov    %rbx,0xb0(%rsp)
mov    0x60(%rsp),%rax
lea    0x0(,%rax,4),%rdi
call   1070 <malloc@plt>
mov    %rax,%rbp
mov    0x18(%rsp),%rbx
lea    -0x1(%rbx),%r8d
sub    $0x8,%rsp
mov    0x38(%rsp),%r13
mov    %r13,%rdi
mov    %ebx,%esi
mov    0x8(%rsp),%rdx
xor    %ecx,%ecx
mov    %r8d,0x14(%rsp)
mov    0x50(%rsp),%r9
xor    %eax,%eax
mov    %rbp,0x78(%rsp)
push   %rbp
mov    %r12,0x88(%rsp)
push   %r12
push   %r15
call   1080 <make_box2@plt>
add    $0x20,%rsp
test   %ebx,%ebx
mov    0x10(%rsp),%r15
mov    0x20(%rsp),%r12
mov    0x90(%rsp),%rcx
mov    0x58(%rsp),%rsi
mov    0x68(%rsp),%rbp
mov    0x3c(%rsp),%edx
jle    1423 <redc+0x2c3>
xor    %ebx,%ebx
nopl   (%rax)
mov    0x0(%r13,%rbx,8),%rdi
movsd  (%rcx,%rbx,8),%xmm0
mov    (%r15,%rbx,8),%rcx
mov    (%rsi,%rbx,8),%r8
mov    0x0(%rbp,%rbx,8),%r9
mov    (%rsp),%rsi
mov    $0x1,%al
mov    %edx,%r15d
call   1040 <make_box1@plt>
mov    %r15d,%edx
mov    0x58(%rsp),%rsi
mov    0x10(%rsp),%r15
mov    0x90(%rsp),%rcx
add    $0x1,%rbx
cmp    %rbx,%r12
jne    13e0 <redc+0x280>
mov    (%rsp),%rax
test   %eax,%eax
jle    17ae <redc+0x64e>
mov    %eax,%eax
mov    %rax,0xd8(%rsp)
mov    0x38(%rsp),%ebp
mov    0x20(%rsp),%rax
lea    -0x1(%rax),%rcx
mov    %rcx,0xd0(%rsp)
add    $0xffffffffffffffff,%rbp
mov    %eax,%ecx
and    $0x3,%ecx
mov    %rcx,0xc8(%rsp)
and    $0xfffffffc,%eax
mov    %rax,0xc0(%rsp)
mov    %rbp,0xe0(%rsp)
and    $0xfffffffffffffffe,%rbp
neg    %rbp
xorpd  %xmm2,%xmm2
xor    %r13d,%r13d
mov    0x18(%rsp),%rsi
mov    0x80(%rsp),%r12
jmp    14fe <redc+0x39e>
nop
mov    0x30(%rsp),%rdi
xor    %edx,%edx
mov    0xc(%rsp),%ecx
mov    %r13d,%r8d
mov    0x48(%rsp),%r9
movsd  0x40(%rsp),%xmm0
mov    $0x1,%al
push   %r14
push   0x78(%rsp)
push   0x88(%rsp)
push   0x68(%rsp)
call   1050 <neiK@plt>
movsd  0x20(%rsp),%xmm2
mov    0x48(%rsp),%rdx
add    $0x20,%rsp
mov    %r15,%rbx
add    $0x1,%r13
cmp    0xd8(%rsp),%r13
mov    0x18(%rsp),%rsi
mov    %rbx,%r15
mov    0x80(%rsp),%r12
movsd  0x98(%rsp),%xmm1
je     17cd <redc+0x66d>
test   %esi,%esi
movsd  %xmm2,(%rsp)
jle    1490 <redc+0x330>
cmpq   $0x3,0xd0(%rsp)
jae    1520 <redc+0x3c0>
xor    %eax,%eax
mov    0x30(%rsp),%r15
jmp    157f <redc+0x41f>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
mov    0x30(%rsp),%r15
mov    0xc0(%rsp),%rdx
nop
mov    (%r15,%rax,8),%rcx
movsd  (%rcx,%r13,8),%xmm0
movsd  %xmm0,(%r12,%rax,8)
mov    0x8(%r15,%rax,8),%rcx
movsd  (%rcx,%r13,8),%xmm0
movsd  %xmm0,0x8(%r12,%rax,8)
mov    0x10(%r15,%rax,8),%rcx
movsd  (%rcx,%r13,8),%xmm0
movsd  %xmm0,0x10(%r12,%rax,8)
mov    0x18(%r15,%rax,8),%rcx
movsd  (%rcx,%r13,8),%xmm0
movsd  %xmm0,0x18(%r12,%rax,8)
add    $0x4,%rax
cmp    %rax,%rdx
jne    1530 <redc+0x3d0>
mov    0xc8(%rsp),%rbx
test   %rbx,%rbx
je     15b8 <redc+0x458>
lea    (%r12,%rax,8),%rcx
lea    (%r15,%rax,8),%rax
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
mov    (%rax,%rdx,8),%rdi
movsd  (%rdi,%r13,8),%xmm0
movsd  %xmm0,(%rcx,%rdx,8)
add    $0x1,%rdx
cmp    %rdx,%rbx
jne    15a0 <redc+0x440>
mov    %r15,%rdi
xor    %edx,%edx
mov    0xc(%rsp),%ecx
mov    %r13d,%r8d
mov    0x48(%rsp),%r9
movsd  0x40(%rsp),%xmm0
mov    $0x1,%al
push   %r14
push   0x78(%rsp)
push   0x88(%rsp)
push   0x68(%rsp)
mov    %rsi,%rbx
call   1050 <neiK@plt>
mov    %rbx,%r11
add    $0x20,%rsp
test   %r11d,%r11d
jle    1790 <redc+0x630>
mov    $0xffffffff,%eax
xorpd  %xmm1,%xmm1
xor    %ecx,%ecx
mov    0x20(%rsp),%r8
mov    0x50(%rsp),%r9
mov    0x38(%rsp),%r10d
movapd 0x9f4(%rip),%xmm3
movapd 0x9ec(%rip),%xmm4
jmp    1648 <redc+0x4e8>
cs nopw 0x0(%rax,%rax,1)
ucomisd %xmm0,%xmm1
cmova  %ecx,%eax
maxsd  %xmm0,%xmm1
add    $0x1,%rcx
cmp    %r8,%rcx
je     16e0 <redc+0x580>
movapd %xmm1,%xmm0
xorpd  %xmm1,%xmm1
test   %r9d,%r9d
jle    1630 <redc+0x4d0>
movsd  (%r12,%rcx,8),%xmm5
mov    (%r15,%rcx,8),%rdx
xorpd  %xmm1,%xmm1
mov    $0x1,%esi
cmp    $0x2,%r10d
je     16ad <redc+0x54d>
xchg   %ax,%ax
movslq (%r14,%rsi,4),%rdi
movapd %xmm5,%xmm2
subsd  (%rdx,%rdi,8),%xmm2
andpd  %xmm4,%xmm2
maxsd  %xmm1,%xmm2
movslq 0x4(%r14,%rsi,4),%rdi
movapd %xmm5,%xmm1
subsd  (%rdx,%rdi,8),%xmm1
andpd  %xmm4,%xmm1
maxsd  %xmm2,%xmm1
lea    (%rsi,%rbp,1),%rdi
add    $0x2,%rdi
add    $0x2,%rsi
cmp    $0x1,%rdi
jne    1670 <redc+0x510>
testb  $0x1,0xe0(%rsp)
01
je     1630 <redc+0x4d0>
movslq (%r14,%rsi,4),%rsi
subsd  (%rdx,%rsi,8),%xmm5
andpd  %xmm3,%xmm5
maxsd  %xmm1,%xmm5
movapd %xmm5,%xmm1
jmp    1630 <redc+0x4d0>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x68(%rsp),%rcx
test   %r11d,%r11d
mov    0x28(%rsp),%rdx
movsd  (%rsp),%xmm2
jle    17a4 <redc+0x644>
mov    %eax,%eax
mov    %rax,0x88(%rsp)
xor    %r15d,%r15d
mov    0x10(%rsp),%rbx
mov    %rcx,%r12
nopl   (%rax)
movapd %xmm1,0xa0(%rsp)
movsd  %xmm2,(%rsp)
mov    0x30(%rsp),%rax
mov    (%rax,%r15,8),%rdi
mov    0x90(%rsp),%rax
movsd  (%rax,%r15,8),%xmm0
mov    (%rbx,%r15,8),%rcx
mov    0x58(%rsp),%rax
mov    (%rax,%r15,8),%r8
mov    (%r12,%r15,8),%r9
mov    %r13d,%esi
mov    0x3c(%rsp),%edx
mov    $0x2,%al
call   1060 <neiE1@plt>
movapd 0xa0(%rsp),%xmm1
movsd  (%rsp),%xmm2
mov    0x28(%rsp),%rdx
xor    %ecx,%ecx
cmp    %r15,0x88(%rsp)
setne  %cl
add    %eax,%ecx
movslq %ecx,%rax
addsd  (%rdx,%rax,8),%xmm2
add    $0x1,%r15
cmp    %r15,0x20(%rsp)
jne    1710 <redc+0x5b0>
jmp    14d3 <redc+0x373>
xchg   %ax,%ax
mov    0x10(%rsp),%rbx
mov    0x28(%rsp),%rdx
movsd  (%rsp),%xmm2
jmp    14d3 <redc+0x373>
mov    0x10(%rsp),%rbx
jmp    14d3 <redc+0x373>
xorpd  %xmm2,%xmm2
mov    0x28(%rsp),%rdx
mov    0x80(%rsp),%r12
movsd  0x98(%rsp),%xmm1
mov    0x18(%rsp),%rsi
mov    %rsi,%r13
xorps  %xmm0,%xmm0
cvtsi2sdl 0xc(%rsp),%xmm0
divsd  %xmm1,%xmm2
movslq 0x50(%rsp),%rax
mov    0x60(%rsp),%rcx
mulsd  (%rdx,%rcx,8),%xmm0
addsd  (%rdx,%rax,8),%xmm0
subsd  %xmm2,%xmm0
mov    0xb8(%rsp),%rax
movsd  %xmm0,(%rax)
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
mov    0x78(%rsp),%r14
mov    0xb0(%rsp),%rbp
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1820 <redc+0x6c0>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x70(%rsp),%rdi
call   1030 <free@plt>
test   %r13d,%r13d
mov    0x20(%rsp),%rbp
mov    0x68(%rsp),%r14
mov    0x58(%rsp),%r12
jle    1884 <redc+0x724>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rdi
call   1030 <free@plt>
mov    (%r12,%rbx,8),%rdi
call   1030 <free@plt>
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1860 <redc+0x700>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

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

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