void mi2r(double **x, int N, int K, double *psi, double *scal, double *mir) {
  int i, k, *n2;
  double *xc, dx;
  double *eps;
  double dxy2;
  int *nn;
  int d;
  int BOX, BOX1;
  int **box, *lis;
  int **box1;
  int **lis1;
  int **mxi;
  double epsilon;
  int inveps;
  int dim = 2;
  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));
  n2 = (int *)malloc(dim * sizeof(int));
  make_box2(x, dim, N, 0, 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]);
  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);
    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;
      }
    }
    for (d = 0; d < dim; d++) {
      n2[d] = neiE1(x[d], i, scal[d], BOX1, eps[d], box1[d], lis1[d], mxi[d]);
      dxy2 += psi[n2[d]];
    }
  }
  dxy2 /= N;
  *mir = 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(n2);
  free(phi);
}


x86 assembly (clang, -O0):
<mi2r>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0xd8,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x2,-0xb0(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xb8(%rbp)
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11fd <mi2r+0x9d>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0xb0(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
cvtsi2sdl -0x34(%rbp),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
mov    -0xb8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11ac <mi2r+0x4c>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x68(%rbp)
mov    -0xb0(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x48(%rbp)
movl   $0x1,-0x70(%rbp)
cvtsi2sdl -0x70(%rbp),%xmm0
movsd  0xdc0(%rip),%xmm1
mulsd  %xmm0,%xmm1
cvtsi2sdl -0x70(%rbp),%xmm0
mulsd  %xmm0,%xmm1
cvtsi2sdl -0x18(%rbp),%xmm0
mulsd  %xmm0,%xmm1
cvtsi2sdl -0x14(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1273 <mi2r+0x113>
mov    -0x70(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    1233 <mi2r+0xd3>
cvtsi2sdl -0x70(%rbp),%xmm1
movsd  0xd88(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
mov    -0x70(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0xac(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x5,%eax
mov    %eax,-0x74(%rbp)
movslq -0xb0(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x90(%rbp)
movslq -0xb0(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x98(%rbp)
movslq -0xb0(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xa0(%rbp)
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0xb0(%rbp),%eax
jge    1376 <mi2r+0x216>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,%rdx
mov    -0x90(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movslq -0x14(%rbp),%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,%rdx
mov    -0x98(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,%rdx
mov    -0xa0(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    12f2 <mi2r+0x192>
movslq -0x70(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x80(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x70(%rbp),%eax
jge    13c4 <mi2r+0x264>
movslq -0x70(%rbp),%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,%rdx
mov    -0x80(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    138e <mi2r+0x22e>
movslq -0x14(%rbp),%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x88(%rbp)
movslq -0xb0(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x58(%rbp)
movslq -0xb0(%rbp),%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0xb0(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x70(%rbp),%r9d
mov    -0xac(%rbp),%r11d
mov    -0x80(%rbp),%r10
mov    -0x88(%rbp),%rax
xor    %ecx,%ecx
mov    $0x1,%r8d
mov    %r11d,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   1080 <make_box2@plt>
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0xb0(%rbp),%eax
jge    14b7 <mi2r+0x357>
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x14(%rbp),%esi
mov    -0x28(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x74(%rbp),%edx
mov    -0x90(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x98(%rbp),%rax
movslq -0x6c(%rbp),%r8
mov    (%rax,%r8,8),%r8
mov    -0xa0(%rbp),%rax
movslq -0x6c(%rbp),%r9
mov    (%rax,%r9,8),%r9
mov    $0x1,%al
call   1040 <make_box1@plt>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1447 <mi2r+0x2e7>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    16e9 <mi2r+0x589>
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0xb0(%rbp),%eax
jge    1518 <mi2r+0x3b8>
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    14d9 <mi2r+0x379>
mov    -0x10(%rbp),%rdi
mov    -0xb0(%rbp),%esi
mov    -0xb0(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x34(%rbp),%r8d
mov    -0x70(%rbp),%r9d
movsd  -0xa8(%rbp),%xmm0
ff
mov    -0x18(%rbp),%ebx
mov    -0x80(%rbp),%r11
mov    -0x88(%rbp),%r10
mov    -0x68(%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>
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0xb0(%rbp),%eax
jge    1626 <mi2r+0x4c6>
mov    -0x58(%rbp),%rax
movslq -0x6c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x1,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1613 <mi2r+0x4b3>
mov    -0x48(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x68(%rbp),%rcx
movslq -0x38(%rbp),%rdx
movslq (%rcx,%rdx,4),%rcx
subsd  (%rax,%rcx,8),%xmm0
movaps 0xa3e(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x58(%rbp),%rax
movslq -0x6c(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    1600 <mi2r+0x4a0>
movsd  -0x50(%rbp),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1605 <mi2r+0x4a5>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1595 <mi2r+0x435>
jmp    1618 <mi2r+0x4b8>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    156f <mi2r+0x40f>
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0xb0(%rbp),%eax
jge    16d6 <mi2r+0x576>
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x34(%rbp),%esi
mov    -0x28(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x74(%rbp),%edx
mov    -0x58(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x90(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x98(%rbp),%rax
movslq -0x6c(%rbp),%r8
mov    (%rax,%r8,8),%r8
mov    -0xa0(%rbp),%rax
movslq -0x6c(%rbp),%r9
mov    (%rax,%r9,8),%r9
mov    $0x2,%al
call   1060 <neiE1@plt>
mov    %eax,%edx
mov    -0x40(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
movslq -0x6c(%rbp),%rdx
movslq (%rcx,%rdx,4),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    162d <mi2r+0x4cd>
jmp    16db <mi2r+0x57b>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    14c6 <mi2r+0x366>
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0xb8(%rbp),%rax
movslq -0x18(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
subsd  -0x60(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x70(%rbp),%eax
jge    176a <mi2r+0x60a>
mov    -0x80(%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    173f <mi2r+0x5df>
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
mov    -0x88(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0xb0(%rbp),%eax
jge    17df <mi2r+0x67f>
mov    -0x90(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x98(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0xa0(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1786 <mi2r+0x626>
mov    -0x90(%rbp),%rdi
call   1030 <free@plt>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
mov    -0xa0(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0xb8(%rbp),%rdi
call   1030 <free@plt>
add    $0xd8,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<mi2r>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    %r9,0xc0(%rsp)
mov    %r8,0x98(%rsp)
mov    %rcx,%rbx
mov    %edx,%ebp
mov    %esi,%r12d
mov    %rdi,0x8(%rsp)
lea    0x1(%rbp),%r15d
movslq %r15d,%r14
lea    0x0(,%r14,8),%rdi
call   1070 <malloc@plt>
mov    %rbp,0x28(%rsp)
test   %ebp,%ebp
jle    12c2 <mi2r+0x162>
mov    %r15d,%ecx
lea    -0x1(%rcx),%r9
mov    $0x1,%edx
cmp    $0x2,%r9
jb     128b <mi2r+0x12b>
mov    %r9,%r8
and    $0xfffffffffffffffe,%r8
lea    -0x2(%r8),%rsi
mov    %rsi,%rdx
shr    %rdx
add    $0x1,%rdx
test   %rsi,%rsi
je     18ac <mi2r+0x74c>
mov    %rdx,%rsi
and    $0xfffffffffffffffe,%rsi
movdqa 0xe1e(%rip),%xmm0
mov    $0x1,%edi
movapd 0xe21(%rip),%xmm1
movdqa 0xe29(%rip),%xmm2
movdqa 0xe31(%rip),%xmm3
nop
movupd (%rbx,%rdi,8),%xmm4
cvtdq2pd %xmm0,%xmm5
movapd %xmm1,%xmm6
divpd  %xmm5,%xmm6
subpd  %xmm6,%xmm4
movupd %xmm4,(%rax,%rdi,8)
movdqa %xmm0,%xmm4
paddd  %xmm2,%xmm4
movupd 0x10(%rbx,%rdi,8),%xmm5
cvtdq2pd %xmm4,%xmm4
movapd %xmm1,%xmm6
divpd  %xmm4,%xmm6
subpd  %xmm6,%xmm5
movupd %xmm5,0x10(%rax,%rdi,8)
paddd  %xmm3,%xmm0
add    $0x4,%rdi
add    $0xfffffffffffffffe,%rsi
jne    1210 <mi2r+0xb0>
cvtdq2pd %xmm0,%xmm0
test   $0x1,%dl
je     127f <mi2r+0x11f>
movupd (%rbx,%rdi,8),%xmm1
movapd 0xdde(%rip),%xmm2
divpd  %xmm0,%xmm2
addpd  %xmm1,%xmm2
movupd %xmm2,(%rax,%rdi,8)
cmp    %r8,%r9
je     12c2 <mi2r+0x162>
or     $0x1,%r9
mov    %r9,%rdx
movsd  0xddd(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xorps  %xmm1,%xmm1
cvtsi2sd %edx,%xmm1
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
addsd  (%rbx,%rdx,8),%xmm2
movsd  %xmm2,(%rax,%rdx,8)
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    12a0 <mi2r+0x140>
mov    %r15d,0x18(%rsp)
mov    %rbx,0xa0(%rsp)
mov    %rax,0xc8(%rsp)
shl    $0x2,%r14
mov    %r14,%rdi
call   1070 <malloc@plt>
mov    %rax,%r14
xorps  %xmm0,%xmm0
cvtsi2sdl 0x28(%rsp),%xmm0
xorps  %xmm3,%xmm3
cvtsi2sd %r12d,%xmm3
mov    $0x1,%eax
movsd  0xd74(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %eax,%r15d
xorps  %xmm4,%xmm4
cvtsi2sd %eax,%xmm4
movapd %xmm4,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm4,%xmm2
mulsd  %xmm0,%xmm2
lea    (%r15,%r15,1),%eax
ucomisd %xmm2,%xmm3
ja     1310 <mi2r+0x1b0>
movsd  %xmm3,0xb8(%rsp)
mov    %r15d,%eax
shr    $0x2,%eax
mov    %rax,0x30(%rsp)
mov    %r12,(%rsp)
movslq %r12d,%rax
lea    -0x10(,%rax,4),%rbx
ff
mov    %rax,0xb0(%rsp)
lea    0x0(,%rax,4),%rbp
mov    %rbx,%rdi
movsd  %xmm4,0x20(%rsp)
call   1070 <malloc@plt>
mov    %rax,0x68(%rsp)
mov    %rbp,%rdi
call   1070 <malloc@plt>
mov    %rax,0x60(%rsp)
mov    %rbx,%rdi
call   1070 <malloc@plt>
mov    %rax,0x58(%rsp)
mov    %rbx,%rdi
call   1070 <malloc@plt>
mov    %rax,0x50(%rsp)
mov    %rbp,0x70(%rsp)
mov    %rbp,%rdi
call   1070 <malloc@plt>
mov    %rax,0x48(%rsp)
mov    %rbx,%rdi
call   1070 <malloc@plt>
mov    %rax,0x40(%rsp)
movsd  0xcb8(%rip),%xmm0
divsd  0x20(%rsp),%xmm0
movsd  %xmm0,0xe0(%rsp)
mov    %r15d,%ebx
lea    0x0(,%rbx,8),%rdi
call   1070 <malloc@plt>
mov    %rax,%r13
shl    $0x2,%rbx
cmp    $0x2,%r15d
mov    $0x1,%ebp
cmovae %r15d,%ebp
xor    %r12d,%r12d
xchg   %ax,%ax
mov    %rbx,%rdi
call   1070 <malloc@plt>
mov    %rax,0x0(%r13,%r12,8)
add    $0x1,%r12
cmp    %r12,%rbp
jne    1400 <mi2r+0x2a0>
mov    %rbp,0xa8(%rsp)
mov    (%rsp),%r12
lea    -0x5(%r12),%eax
mov    %eax,0x14(%rsp)
mov    0x70(%rsp),%rdi
call   1070 <malloc@plt>
mov    %rax,%rbp
sub    $0x8,%rsp
mov    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r12d,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
mov    %r15d,%r9d
xor    %eax,%eax
mov    %rbp,0x98(%rsp)
push   %rbp
mov    %r13,0x30(%rsp)
push   %r13
push   0x48(%rsp)
call   1080 <make_box2@plt>
add    $0x20,%rsp
mov    (%rbx),%rdi
mov    %rbx,%rbp
mov    0x98(%rsp),%r13
movsd  0x0(%r13),%xmm0
mov    %r12d,%esi
mov    0x14(%rsp),%ebx
mov    %ebx,%edx
mov    0x68(%rsp),%rcx
mov    0x60(%rsp),%r8
mov    0x58(%rsp),%r9
mov    $0x1,%al
call   1040 <make_box1@plt>
mov    0x8(%rbp),%rdi
movsd  0x8(%r13),%xmm0
mov    %r12d,%esi
mov    %ebx,%edx
mov    0x50(%rsp),%rcx
mov    0x48(%rsp),%r8
mov    0x40(%rsp),%r9
mov    $0x1,%al
call   1040 <make_box1@plt>
test   %r12d,%r12d
jle    17c5 <mi2r+0x665>
mov    %r12d,%eax
mov    %rax,0xd0(%rsp)
mov    0x18(%rsp),%eax
lea    -0x1(%rax),%r12
add    $0xfffffffffffffffe,%rax
mov    %rax,0x18(%rsp)
mov    %r12,%rax
mov    %r12,0x88(%rsp)
and    $0xfffffffffffffffe,%r12
neg    %r12
xorpd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
xor    %ebx,%ebx
mov    %r15,0xd8(%rsp)
mov    0x98(%rsp),%r13
jmp    15e6 <mi2r+0x486>
cs nopw 0x0(%rax,%rax,1)
nop
xorpd  %xmm4,%xmm4
movapd %xmm4,0x70(%rsp)
mov    0x8(%rsp),%rax
mov    (%rax),%rdi
mov    %rax,%r15
movsd  0x0(%r13),%xmm0
mov    %ebx,%esi
mov    %rbx,0x30(%rsp)
mov    0x14(%rsp),%ebx
mov    %ebx,%edx
mov    0x68(%rsp),%rcx
mov    0x60(%rsp),%r8
mov    0x58(%rsp),%r9
mov    $0x2,%al
call   1060 <neiE1@plt>
cltq
mov    0xa0(%rsp),%rbp
movsd  (%rsp),%xmm0
addsd  0x0(%rbp,%rax,8),%xmm0
movsd  %xmm0,(%rsp)
mov    0x8(%r15),%rdi
movsd  0x8(%r13),%xmm0
mov    0xd8(%rsp),%r15
mov    0x30(%rsp),%rsi
mov    %ebx,%edx
mov    0x30(%rsp),%rbx
movapd 0x70(%rsp),%xmm1
mov    0x50(%rsp),%rcx
mov    0x48(%rsp),%r8
mov    0x40(%rsp),%r9
mov    $0x2,%al
call   1060 <neiE1@plt>
cltq
movsd  (%rsp),%xmm0
addsd  0x0(%rbp,%rax,8),%xmm0
movsd  %xmm0,(%rsp)
add    $0x1,%rbx
cmp    0xd0(%rsp),%rbx
je     17ce <mi2r+0x66e>
mov    0x8(%rsp),%rdi
mov    (%rdi),%rax
mov    0x8(%rdi),%rcx
movsd  (%rax,%rbx,8),%xmm0
movaps %xmm0,0x70(%rsp)
movsd  (%rcx,%rbx,8),%xmm0
movaps %xmm0,0x30(%rsp)
mov    $0x2,%esi
xor    %edx,%edx
mov    $0x1,%ecx
mov    %ebx,%r8d
mov    %r15d,%r9d
movsd  0xe0(%rsp),%xmm0
mov    $0x1,%al
push   %r14
push   0x98(%rsp)
push   0x30(%rsp)
mov    0x40(%rsp),%rbp
push   %rbp
call   1050 <neiK@plt>
add    $0x20,%rsp
xorpd  %xmm1,%xmm1
xorpd  %xmm4,%xmm4
test   %ebp,%ebp
jle    1534 <mi2r+0x3d4>
mov    0x8(%rsp),%rax
mov    (%rax),%rax
cmpq   $0x0,0x18(%rsp)
je     1760 <mi2r+0x600>
xorpd  %xmm1,%xmm1
mov    $0x1,%ecx
movapd 0x9ec(%rip),%xmm2
movapd 0x30(%rsp),%xmm3
movapd 0x70(%rsp),%xmm4
movslq (%r14,%rcx,4),%rdx
movapd %xmm4,%xmm0
subsd  (%rax,%rdx,8),%xmm0
andpd  %xmm2,%xmm0
maxsd  %xmm1,%xmm0
movslq 0x4(%r14,%rcx,4),%rdx
movapd %xmm4,%xmm1
subsd  (%rax,%rdx,8),%xmm1
andpd  %xmm2,%xmm1
maxsd  %xmm0,%xmm1
lea    (%r12,%rcx,1),%rdx
add    $0x2,%rdx
add    $0x2,%rcx
cmp    $0x1,%rdx
jne    1680 <mi2r+0x520>
testb  $0x1,0x88(%rsp)
01
je     16e0 <mi2r+0x580>
movslq (%r14,%rcx,4),%rcx
subsd  (%rax,%rcx,8),%xmm4
andpd  0x988(%rip),%xmm4
maxsd  %xmm1,%xmm4
movapd %xmm4,%xmm1
cmpl   $0x0,0x28(%rsp)
jle    1530 <mi2r+0x3d0>
mov    0x8(%rsp),%rax
mov    0x8(%rax),%rax
cmpq   $0x0,0x18(%rsp)
je     1790 <mi2r+0x630>
xorpd  %xmm4,%xmm4
mov    $0x1,%ecx
nopl   0x0(%rax)
movslq (%r14,%rcx,4),%rdx
movapd %xmm3,%xmm0
subsd  (%rax,%rdx,8),%xmm0
andpd  %xmm2,%xmm0
maxsd  %xmm4,%xmm0
movslq 0x4(%r14,%rcx,4),%rdx
movapd %xmm3,%xmm4
subsd  (%rax,%rdx,8),%xmm4
andpd  %xmm2,%xmm4
maxsd  %xmm0,%xmm4
lea    (%r12,%rcx,1),%rdx
add    $0x2,%rdx
add    $0x2,%rcx
cmp    $0x1,%rdx
jne    1710 <mi2r+0x5b0>
testb  $0x1,0x88(%rsp)
01
je     1534 <mi2r+0x3d4>
jmp    17a7 <mi2r+0x647>
nopl   (%rax)
xorpd  %xmm1,%xmm1
mov    $0x1,%ecx
movapd 0x8ef(%rip),%xmm2
movapd 0x30(%rsp),%xmm3
movapd 0x70(%rsp),%xmm4
testb  $0x1,0x88(%rsp)
01
jne    16c7 <mi2r+0x567>
jmp    16e0 <mi2r+0x580>
xorpd  %xmm4,%xmm4
mov    $0x1,%ecx
testb  $0x1,0x88(%rsp)
01
je     1534 <mi2r+0x3d4>
movslq (%r14,%rcx,4),%rcx
subsd  (%rax,%rcx,8),%xmm3
andpd  0x8a8(%rip),%xmm3
maxsd  %xmm4,%xmm3
movapd %xmm3,%xmm4
jmp    1534 <mi2r+0x3d4>
xorpd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm1
divsd  0xb8(%rsp),%xmm1
mov    0xa0(%rsp),%rax
mov    0xb0(%rsp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq 0x28(%rsp),%rax
mov    0xc8(%rsp),%r15
addsd  (%r15,%rax,8),%xmm0
subsd  %xmm1,%xmm0
mov    0xc0(%rsp),%rax
movsd  %xmm0,(%rax)
mov    %r14,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
mov    0x20(%rsp),%r14
mov    0xa8(%rsp),%rbp
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1830 <mi2r+0x6d0>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x90(%rsp),%rdi
call   1030 <free@plt>
mov    0x68(%rsp),%rdi
call   1030 <free@plt>
mov    0x60(%rsp),%rdi
call   1030 <free@plt>
mov    0x58(%rsp),%rdi
call   1030 <free@plt>
mov    0x50(%rsp),%rdi
call   1030 <free@plt>
mov    0x48(%rsp),%rdi
call   1030 <free@plt>
mov    0x40(%rsp),%rdi
call   1030 <free@plt>
mov    %r15,%rdi
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
movapd 0x74c(%rip),%xmm0
mov    $0x1,%edi
test   $0x1,%dl
jne    1265 <mi2r+0x105>
jmp    127f <mi2r+0x11f>

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

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