user: Please show me the C implementation that matches the assembly code listed below:

```asm
<mi_xnynKembed>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xc8,%rsp
  mov    %rdi,%rbx
  mov    %esi,0x1c(%rsp)
  mov    %edx,0xa8(%rsp)
  mov    %ecx,%r13d
  mov    %ecx,0x18(%rsp)
  mov    %r8,0x78(%rsp)
  mov    %r9,0x80(%rsp)
  mov    0x130(%rsp),%r15
  lea    0x1(%rcx),%eax
  movslq %eax,%rbp
  lea    0x0(,%rbp,8),%r14
  mov    %r14,%rdi
  call   <malloc@plt>
  mov    %rax,0x88(%rsp)
  test   %r13d,%r13d
  jle    L341
  lea    0x1(%r13),%edx
  mov    $0x1,%eax
  movsd  D10(%rip),%xmm1
L304:
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movapd %xmm1,%xmm2
  divsd  %xmm0,%xmm2
  movsd  (%r15,%rax,8),%xmm0
  subsd  %xmm2,%xmm0
  mov    0x88(%rsp),%rdi
  movsd  %xmm0,(%rdi,%rax,8)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L304
L341:
  lea    0x0(,%rbp,4),%rax
  mov    %rax,0x8(%rsp)
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,%r12
  mov    0x1c(%rsp),%ecx
  lea    (%rcx,%rcx,1),%r13d
  movslq %r13d,%rdi
  shl    $0x3,%rdi
  call   <malloc@plt>
  mov    %rax,%rbp
  sub    $0x8,%r14
  mov    %r14,%rdi
  call   <malloc@plt>
  mov    %rax,0x48(%rsp)
  mov    %r14,%rdi
  call   <malloc@plt>
  mov    %rax,0x50(%rsp)
  mov    0x8(%rsp),%rax
  sub    $0x4,%rax
  mov    %rax,0x8(%rsp)
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,0x58(%rsp)
  mov    0x8(%rsp),%rdi
  call   <malloc@plt>
  mov    %rax,0x60(%rsp)
  mov    0x8(%rsp),%rdi
  call   <malloc@plt>
  mov    %rax,0x68(%rsp)
  mov    0x8(%rsp),%rdi
  call   <malloc@plt>
  mov    %rax,0x70(%rsp)
  mov    %r14,%rdi
  call   <malloc@plt>
  mov    %rax,0x38(%rsp)
  mov    %r14,%rdi
  call   <malloc@plt>
  mov    %rax,0x40(%rsp)
  mov    %r14,%rdi
  call   <malloc@plt>
  mov    %rax,0x28(%rsp)
  mov    0x18(%rsp),%r14d
  movslq %r14d,%rdi
  call   <malloc@plt>
  mov    %rax,0x90(%rsp)
  pxor   %xmm2,%xmm2
  cvtsi2sd %r14d,%xmm2
  pxor   %xmm3,%xmm3
  cvtsi2sdl 0xa8(%rsp),%xmm3
  movsd  %xmm3,0xb0(%rsp)
  movapd %xmm2,%xmm0
  mulsd  D65(%rip),%xmm0
  movl   $0x1,0x8(%rsp)
  comisd %xmm0,%xmm3
  jbe    L211
L225:
  shll   0x8(%rsp)
  mov    0x8(%rsp),%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movapd %xmm1,%xmm0
  mulsd  D65(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  mulsd  %xmm2,%xmm0
  movsd  0xb0(%rsp),%xmm5
  comisd %xmm0,%xmm5
  ja     L225
  movsd  D60(%rip),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0x20(%rsp)
  mov    %eax,%edi
  lea    0x3(%rax),%eax
  test   %edi,%edi
  cmovns %edi,%eax
  sar    $0x2,%eax
  mov    %eax,0x10(%rsp)
  movslq %edi,%r14
  lea    0x0(,%r14,8),%rdi
  call   <malloc@plt>
  mov    %rax,0x30(%rsp)
  cmpl   $0x0,0x8(%rsp)
  jle    L285
L208:
  lea    0x0(,%r14,4),%rax
  mov    %rax,0x98(%rsp)
  mov    $0x0,%r14d
L431:
  mov    0x98(%rsp),%rdi
  call   <malloc@plt>
  mov    0x30(%rsp),%rdi
  mov    %rax,(%rdi,%r14,8)
  add    $0x1,%r14
  cmp    %r14d,0x8(%rsp)
  jg     L431
L285:
  movslq 0xa8(%rsp),%rax
  mov    %rax,0xb8(%rsp)
  lea    0x0(,%rax,4),%r14
  mov    %r14,%rdi
  call   <malloc@plt>
  mov    %rax,0x98(%rsp)
  mov    %r14,%rdi
  call   <malloc@plt>
  mov    %rax,0xa0(%rsp)
  push   0x98(%rsp)
  push   0x38(%rsp)
  push   %rax
  mov    0x28(%rsp),%edi
  push   %rdi
  mov    0x28(%rsp),%r9d
  mov    0x3c(%rsp),%r8d
  mov    $0x0,%ecx
  mov    0xc8(%rsp),%edx
  mov    %r13d,%esi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <make_box2ind@plt>
  add    $0x20,%rsp
  mov    0x18(%rsp),%eax
  test   %eax,%eax
  jle    L376
  mov    %eax,%edx
  mov    $0x0,%eax
L323:
  mov    0x50(%rsp),%rdi
  movq   $0x0,(%rdi,%rax,8)
  mov    0x48(%rsp),%rdi
  movq   $0x0,(%rdi,%rax,8)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L323
  cmpl   $0x0,0xa8(%rsp)
  jle    L471
L21:
  movq   $0x0,0x10(%rsp)
  jmp    L165
L8:
  add    $0x4,%rax
  cmp    %rdx,%rax
  je     L28
L198:
  movslq (%rax),%r14
  movapd %xmm1,%xmm0
  subsd  (%rcx,%r14,8),%xmm0
  andpd  D24(%rip),%xmm0
  comisd (%rsi),%xmm0
  jbe    L8
  movsd  %xmm0,(%rsi)
  jmp    L8
L28:
  add    $0x1,%r15
  cmp    %r8,%r15
  je     L442
L394:
  test   %edi,%edi
  jle    L28
  movsd  0x0(%rbp,%r15,8),%xmm1
  mov    (%rbx,%r15,8),%rcx
  lea    0x4(%r12),%rax
  jmp    L198
L442:
  mov    %r9,%rsi
  movq   $0x0,(%r9)
  cmp    %r11d,%r13d
  jle    L122
  movslq %r11d,%r15
  jmp    L72
L161:
  add    $0x4,%rax
  cmp    %rdx,%rax
  je     L233
L317:
  movslq (%rax),%r14
  movapd %xmm1,%xmm0
  subsd  (%rcx,%r14,8),%xmm0
  andpd  D24(%rip),%xmm0
  comisd (%rsi),%xmm0
  jbe    L161
  movsd  %xmm0,(%rsi)
  jmp    L161
L233:
  add    $0x1,%r15
  cmp    %r15d,%r13d
  jle    L122
L72:
  test   %edi,%edi
  jle    L233
  movsd  0x0(%rbp,%r15,8),%xmm1
  mov    (%rbx,%r15,8),%rcx
  lea    0x4(%r12),%rax
  jmp    L317
L122:
  add    $0x8,%r10
  lea    0x1(%rdi),%eax
  add    $0x8,%r9
  add    $0x4,%rdx
  cmp    0x18(%rsp),%edi
  je     L189
  mov    %eax,%edi
L472:
  mov    %r10,%rsi
  movq   $0x0,(%r10)
  test   %r11d,%r11d
  jle    L442
  mov    $0x0,%r15d
  jmp    L394
L189:
  mov    0x130(%rsp),%r15
  mov    0x1c(%rsp),%eax
  lea    -0x1(%rax),%r14d
  mov    %r14d,0xac(%rsp)
  mov    0x110(%rsp),%rcx
  mov    0x10(%rsp),%rdi
  mov    (%rcx,%rdi,4),%esi
  sub    $0x8,%rsp
  push   0x68(%rsp)
  push   0x118(%rsp)
  push   0x118(%rsp)
  push   0x58(%rsp)
  mov    0x30(%rsp),%edx
  push   %rdx
  movsd  0x50(%rsp),%xmm0
  mov    0x48(%rsp),%r9d
  mov    %eax,0x4c(%rsp)
  mov    %eax,%r8d
  mov    %r14d,%ecx
  mov    $0x0,%edx
  mov    0xa8(%rsp),%rdi
  mov    $0x1,%eax
  call   <neiEK@plt>
  add    $0x28,%rsp
  mov    0x130(%rsp),%rsi
  mov    0x18(%rsp),%rdi
  mov    (%rsi,%rdi,4),%esi
  push   0x78(%rsp)
  push   0x130(%rsp)
  push   0x130(%rsp)
  push   0x60(%rsp)
  mov    0x30(%rsp),%edx
  push   %rdx
  movsd  0x50(%rsp),%xmm0
  mov    0x48(%rsp),%r9d
  mov    0x4c(%rsp),%r8d
  mov    %r14d,%ecx
  mov    $0x0,%edx
  mov    0xb0(%rsp),%rdi
  mov    $0x1,%eax
  call   <neiEK@plt>
  mov    0x48(%rsp),%r14d
  add    $0x30,%rsp
  mov    $0x0,%eax
  mov    0x38(%rsp),%rcx
  mov    0x40(%rsp),%rsi
  mov    0x28(%rsp),%rdi
  mov    0x90(%rsp),%rdx
  jmp    L130
L152:
  movsd  %xmm0,(%rdi,%rax,8)
  movb   $0x1,(%rdx,%rax,1)
L269:
  add    $0x1,%rax
  cmp    %rax,%r14
  je     L419
L130:
  movb   $0x0,(%rdx,%rax,1)
  movsd  (%rcx,%rax,8),%xmm1
  movsd  (%rsi,%rax,8),%xmm0
  comisd %xmm0,%xmm1
  jbe    L152
  movsd  %xmm1,(%rdi,%rax,8)
  jmp    L269
L231:
  movslq 0x0(%r13,%rax,4),%rsi
  movslq (%r11,%rax,4),%rcx
  movsd  0x8(%r15,%rsi,8),%xmm0
  addsd  (%r15,%rcx,8),%xmm0
  addsd  (%rdi,%rax,8),%xmm0
  movsd  %xmm0,(%rdi,%rax,8)
L222:
  movslq (%r8,%rax,4),%rsi
  movslq (%r9,%rax,4),%rcx
  movsd  (%r15,%rsi,8),%xmm0
  addsd  (%r15,%rcx,8),%xmm0
  addsd  (%rdx,%rax,8),%xmm0
  movsd  %xmm0,(%rdx,%rax,8)
  add    $0x1,%rax
  cmp    %r14,%rax
  je     L475
L434:
  cmpb   $0x0,(%r10,%rax,1)
  je     L231
  movslq (%r11,%rax,4),%rsi
  movslq 0x0(%r13,%rax,4),%rcx
  movsd  0x8(%r15,%rsi,8),%xmm0
  addsd  (%r15,%rcx,8),%xmm0
  addsd  (%rdi,%rax,8),%xmm0
  movsd  %xmm0,(%rdi,%rax,8)
  jmp    L222
L475:
  mov    0xac(%rsp),%r13d
L64:
  addq   $0x1,0x10(%rsp)
  mov    0x10(%rsp),%rax
  cmp    %eax,0xa8(%rsp)
  jle    L405
L165:
  test   %r13d,%r13d
  jle    L182
  mov    0xa0(%rsp),%rax
  mov    0x10(%rsp),%rdi
  movslq (%rax,%rdi,4),%rcx
  shl    $0x3,%rcx
  mov    %r13d,%esi
  mov    $0x0,%eax
L314:
  mov    (%rbx,%rax,8),%rdx
  movsd  (%rdx,%rcx,1),%xmm0
  movsd  %xmm0,0x0(%rbp,%rax,8)
  add    $0x1,%rax
  cmp    %rsi,%rax
  jne    L314
L182:
  push   %r12
  push   0xa0(%rsp)
  push   0x40(%rsp)
  mov    0x30(%rsp),%eax
  push   %rax
  movsd  0x40(%rsp),%xmm0
  mov    0x28(%rsp),%r9d
  mov    0xc0(%rsp),%rdi
  mov    0x30(%rsp),%rcx
  mov    (%rdi,%rcx,4),%r8d
  mov    0x3c(%rsp),%r14d
  mov    %r14d,%ecx
  mov    $0x0,%edx
  mov    %r13d,%esi
  mov    %rbx,%rdi
  mov    $0x1,%eax
  call   <neiK@plt>
  add    $0x20,%rsp
  cmpl   $0x0,0x18(%rsp)
  jle    L54
  mov    0x38(%rsp),%r10
  mov    0x40(%rsp),%r9
  lea    0x8(%r12),%rdx
  mov    $0x1,%edi
  mov    %r14d,%r11d
  mov    %r14d,%r8d
  mov    %r15,0x130(%rsp)
  jmp    L472
L405:
  cmpl   $0x0,0x18(%rsp)
  jle    L120
L471:
  mov    0xb8(%rsp),%rax
  lea    (%r15,%rax,8),%rcx
  mov    0x138(%rsp),%rdx
  mov    $0x0,%eax
  mov    0x48(%rsp),%rsi
  mov    0x50(%rsp),%rdi
L119:
  movsd  (%rsi,%rax,8),%xmm1
  movsd  0xb0(%rsp),%xmm4
  divsd  %xmm4,%xmm1
  movsd  %xmm1,(%rsi,%rax,8)
  movsd  (%rcx),%xmm0
  addsd  0x8(%r15,%rax,8),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rdx)
  movsd  (%rdi,%rax,8),%xmm1
  divsd  %xmm4,%xmm1
  movsd  %xmm1,(%rdi,%rax,8)
  movsd  (%rcx),%xmm0
  mov    0x88(%rsp),%rbx
  addsd  0x8(%rbx,%rax,8),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,0x8(%rdx)
  add    $0x1,%rax
  add    $0x10,%rdx
  cmp    %eax,0x18(%rsp)
  jg     L119
L120:
  mov    %rbp,%rdi
  call   <free@plt>
  mov    %r12,%rdi
  call   <free@plt>
  mov    0x98(%rsp),%rdi
  call   <free@plt>
  mov    0x8(%rsp),%eax
  test   %eax,%eax
  jle    L338
  mov    0x30(%rsp),%rdi
  mov    %rdi,%rbx
  lea    -0x1(%rax),%eax
  lea    0x8(%rdi,%rax,8),%rbp
L387:
  mov    (%rbx),%rdi
  call   <free@plt>
  add    $0x8,%rbx
  cmp    %rbp,%rbx
  jne    L387
L338:
  mov    0x30(%rsp),%rdi
  call   <free@plt>
  mov    0xa0(%rsp),%rdi
  call   <free@plt>
  mov    0x88(%rsp),%rdi
  call   <free@plt>
  mov    0x38(%rsp),%rdi
  call   <free@plt>
  mov    0x40(%rsp),%rdi
  call   <free@plt>
  mov    0x28(%rsp),%rdi
  call   <free@plt>
  mov    0x90(%rsp),%rdi
  call   <free@plt>
  mov    0x58(%rsp),%rdi
  call   <free@plt>
  mov    0x60(%rsp),%rdi
  call   <free@plt>
  mov    0x68(%rsp),%rdi
  call   <free@plt>
  mov    0x70(%rsp),%rdi
  call   <free@plt>
  mov    0x48(%rsp),%rdi
  call   <free@plt>
  mov    0x50(%rsp),%rdi
  call   <free@plt>
  add    $0xc8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L419:
  mov    0x128(%rsp),%rdi
  mov    0x10(%rsp),%rax
  mov    (%rdi,%rax,4),%esi
  sub    $0x8,%rsp
  push   0x70(%rsp)
  push   0x130(%rsp)
  push   0x130(%rsp)
  push   0x48(%rsp)
  mov    0x30(%rsp),%edi
  push   %rdi
  movsd  0x50(%rsp),%xmm0
  mov    0x48(%rsp),%r9d
  mov    0x4c(%rsp),%r8d
  mov    0xdc(%rsp),%ecx
  mov    $0x0,%edx
  mov    0xb0(%rsp),%rdi
  mov    $0x1,%eax
  call   <neiEK@plt>
  add    $0x28,%rsp
  mov    0x118(%rsp),%rdx
  mov    0x18(%rsp),%rax
  mov    (%rdx,%rax,4),%esi
  push   0x60(%rsp)
  push   0x118(%rsp)
  push   0x118(%rsp)
  push   0x48(%rsp)
  mov    0x30(%rsp),%edi
  push   %rdi
  movsd  0x50(%rsp),%xmm0
  mov    0x48(%rsp),%r9d
  mov    0x4c(%rsp),%r8d
  mov    0xdc(%rsp),%ecx
  mov    $0x0,%edx
  mov    0xa8(%rsp),%rdi
  mov    $0x1,%eax
  call   <neiEK@plt>
  add    $0x30,%rsp
  mov    $0x0,%eax
  mov    %r13d,0xac(%rsp)
  mov    0x48(%rsp),%rdi
  mov    0x50(%rsp),%rdx
  mov    0x58(%rsp),%r11
  mov    0x60(%rsp),%r8
  mov    0x68(%rsp),%r13
  mov    0x70(%rsp),%r9
  mov    0x90(%rsp),%r10
  jmp    L434
L54:
  mov    0x1c(%rsp),%eax
  lea    -0x1(%rax),%r14d
  mov    0x110(%rsp),%rdx
  mov    0x10(%rsp),%rdi
  mov    (%rdx,%rdi,4),%esi
  sub    $0x8,%rsp
  push   0x68(%rsp)
  push   0x118(%rsp)
  push   0x118(%rsp)
  push   0x58(%rsp)
  mov    0x30(%rsp),%edx
  push   %rdx
  movsd  0x50(%rsp),%xmm0
  mov    0x48(%rsp),%r9d
  mov    %eax,0x4c(%rsp)
  mov    %eax,%r8d
  mov    %r14d,%ecx
  mov    $0x0,%edx
  mov    0xa8(%rsp),%rdi
  mov    $0x1,%eax
  call   <neiEK@plt>
  add    $0x28,%rsp
  mov    0x130(%rsp),%rsi
  mov    0x18(%rsp),%rcx
  mov    (%rsi,%rcx,4),%esi
  push   0x78(%rsp)
  push   0x130(%rsp)
  push   0x130(%rsp)
  push   0x60(%rsp)
  mov    0x30(%rsp),%edx
  push   %rdx
  movsd  0x50(%rsp),%xmm0
  mov    0x48(%rsp),%r9d
  mov    0x4c(%rsp),%r8d
  mov    %r14d,%ecx
  mov    $0x0,%edx
  mov    0xb0(%rsp),%rdi
  mov    $0x1,%eax
  call   <neiEK@plt>
  add    $0x28,%rsp
  mov    0x130(%rsp),%rsi
  mov    0x18(%rsp),%rcx
  mov    (%rsi,%rcx,4),%esi
  push   0x70(%rsp)
  push   0x130(%rsp)
  push   0x130(%rsp)
  push   0x48(%rsp)
  mov    0x30(%rsp),%edx
  push   %rdx
  movsd  0x50(%rsp),%xmm0
  mov    0x48(%rsp),%r9d
  mov    0x4c(%rsp),%r8d
  mov    %r14d,%ecx
  mov    $0x0,%edx
  mov    0xb0(%rsp),%rdi
  mov    $0x1,%eax
  call   <neiEK@plt>
  add    $0x28,%rsp
  mov    0x118(%rsp),%rsi
  mov    0x18(%rsp),%rcx
  mov    (%rsi,%rcx,4),%esi
  push   0x60(%rsp)
  push   0x118(%rsp)
  push   0x118(%rsp)
  push   0x48(%rsp)
  mov    0x30(%rsp),%edx
  push   %rdx
  movsd  0x50(%rsp),%xmm0
  mov    0x48(%rsp),%r9d
  mov    0x4c(%rsp),%r8d
  mov    %r14d,%ecx
  mov    $0x0,%edx
  mov    0xa8(%rsp),%rdi
  mov    $0x1,%eax
  call   <neiEK@plt>
  add    $0x30,%rsp
  jmp    L64
L376:
  cmpl   $0x0,0xa8(%rsp)
  jg     L21
  jmp    L120
L211:
  mov    $0x8,%edi
  call   <malloc@plt>
  mov    %rax,0x30(%rsp)
  movl   $0x1,0x8(%rsp)
  movl   $0x0,0x10(%rsp)
  movsd  D60(%rip),%xmm6
  movsd  %xmm6,0x20(%rsp)
  mov    $0x1,%r14d
  jmp    L208
```

tool_calls: name: retrieve_data
arguments: data_tag: D10
data_type: f32[2]
name: retrieve_data
arguments: data_tag: D65
data_type: f64
name: retrieve_data
arguments: data_tag: D60
data_type: f64
name: retrieve_data
arguments: data_tag: D24
data_type: qword[2]

tool: {"D10": [0.0,1.875]}

tool: D65: 0.5

tool: D60: 4

tool: {"D24": [0x7fffffffffffffff,0x0000000000000000]}

assistant: ```c
void mi_xnynKembed(double **x, int dim, int N, int K, double **xx, double **yy, int **boxx, int *lisx, int *indx, int **boxy, int *lisy, int *indy, double *psi, double *mi_cr) {
  int i, ik, k, *nx1, *ny1, *nx2, *ny2;
  double *xc, dy, dx;
  double *epsx, *epsy, *Eps;
  char *maxdim;
  double *dxy1, *dxy2;
  int *nn;
  int d;
  int BOX;
  int **box, *lis;
  int *ind;
  double epsilon;
  int inveps;
  double *phi;
  phi = (double *)malloc((K + 1) * sizeof(double));
  for (i = 1; i <= K; i++)
    phi[i] = psi[i] - 1 / ((double)(i));
  nn = (int *)malloc((K + 1) * sizeof(int));
  xc = (double *)malloc((2 * dim) * sizeof(double));
  dxy1 = (double *)malloc((K) * sizeof(double));
  dxy2 = (double *)malloc((K) * sizeof(double));
  nx1 = (int *)malloc((K) * sizeof(int));
  nx2 = (int *)malloc((K) * sizeof(int));
  ny1 = (int *)malloc((K) * sizeof(int));
  ny2 = (int *)malloc((K) * sizeof(int));
  epsx = (double *)malloc((K) * sizeof(double));
  epsy = (double *)malloc((K) * sizeof(double));
  Eps = (double *)malloc((K) * sizeof(double));
  maxdim = (char *)malloc((K) * sizeof(char));
  BOX = 1;
  while (0.5 * BOX * BOX * K < N)
    BOX *= 2;
  epsilon = 4.0 / BOX;
  inveps = BOX / 4;
  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));
  ind = (int *)malloc((N) * sizeof(int));
  make_box2ind(x, 2 * dim, N, 0, dim, BOX, inveps, ind, box, lis);
  for (ik = 0; ik < K; ik++) {
    dxy1[ik] = dxy2[ik] = 0.0;
  }
  for (i = 0; i < N; i++) {
    for (d = 0; d < 2 * dim; d++)
      xc[d] = x[d][ind[i]];
    neiK(x, 2 * dim, 0, dim, ind[i], BOX, epsilon, K, box, lis, nn);
    for (ik = 0; ik < K; ik++) {
      epsx[ik] = 0;
      for (d = 0; d < dim; d++)
        for (k = 1; k <= ik + 1; k++)
          if ((dx = fabs(xc[d] - x[d][nn[k]])) > epsx[ik])
            epsx[ik] = dx;
      epsy[ik] = 0;
      for (d = dim; d < 2 * dim; d++)
        for (k = 1; k <= ik + 1; k++)
          if ((dy = fabs(xc[d] - x[d][nn[k]])) > epsy[ik])
            epsy[ik] = dy;
    }
    neiEK(xx, indx[i], 0, dim - 1, dim, K, BOX, epsilon, epsx, boxx, lisx, nx2);
    neiEK(yy, indy[i], 0, dim - 1, dim, K, BOX, epsilon, epsy, boxy, lisy, ny2);
    for (ik = 0; ik < K; ik++) {
      maxdim[ik] = 0;
      if (epsx[ik] > epsy[ik]) {
        Eps[ik] = epsx[ik];
      } else {
        Eps[ik] = epsy[ik];
        maxdim[ik] = 1;
      }
    }
    neiEK(yy, indy[i], 0, dim - 1, dim, K, BOX, epsilon, Eps, boxy, lisy, ny1);
    neiEK(xx, indx[i], 0, dim - 1, dim, K, BOX, epsilon, Eps, boxx, lisx, nx1);
    for (ik = 0; ik < K; ik++) {
      if (maxdim[ik])
        dxy1[ik] += psi[nx1[ik] + 1] + psi[ny1[ik]];
      else
        dxy1[ik] += psi[nx1[ik]] + psi[ny1[ik] + 1];
      dxy2[ik] += psi[nx2[ik]] + psi[ny2[ik]];
    }
  }
  for (ik = 0; ik < K; ik++) {
    dxy1[ik] /= N;
    mi_cr[2 * ik] = psi[N] + psi[ik + 1] - dxy1[ik];
    dxy2[ik] /= N;
    mi_cr[2 * ik + 1] = psi[N] + phi[ik + 1] - dxy2[ik];
  }
  free(xc);
  free(nn);
  free(lis);
  for (i = 0; i < BOX; i++)
    free(box[i]);
  free(box);
  free(ind);
  free(phi);
  free(epsx);
  free(epsy);
  free(Eps);
  free(maxdim);
  free(nx1);
  free(nx2);
  free(ny1);
  free(ny2);
  free(dxy1);
  free(dxy2);
}
```