user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<BestMatrixDistance>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x998,%rsp
  mov    %rdi,%rbx
  mov    %rdi,0x18(%rsp)
  mov    %rsi,0x48(%rsp)
  mov    %rdx,0x50(%rsp)
  mov    %rcx,0x58(%rsp)
  mov    %r8,0x60(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x1988(%rsp)
  xor    %eax,%eax
  lea    0x80(%rsp),%rax
  mov    %rax,0x38(%rsp)
  lea    0xd00(%rsp),%rdi
  mov    %rax,%rdx
  mov    %rbx,%rsi
  jmp    L59
L101:
  add    $0xa0,%rsi
  add    $0xa0,%rdx
  cmp    %rdi,%rdx
  je     L35
L59:
  mov    %rsi,%rcx
  mov    $0x0,%eax
L115:
  movsd  (%rcx,%rax,1),%xmm0
  movsd  %xmm0,(%rdx,%rax,1)
  add    $0x8,%rax
  cmp    $0xa0,%rax
  jne    L115
  jmp    L101
L35:
  movsd  D3(%rip),%xmm2
  movsd  %xmm2,0x20(%rsp)
  movl   $0x0,0x2c(%rsp)
  lea    0x78(%rsp),%rax
  mov    %rax,0x68(%rsp)
L24:
  mov    0x2c(%rsp),%eax
  mov    %eax,%ebx
  add    $0x1,%eax
  mov    %eax,0x2c(%rsp)
  lea    0x80(%rsp),%rdi
  mov    0x68(%rsp),%rcx
  mov    0x50(%rsp),%rdx
  mov    0x48(%rsp),%rsi
  call   <MatrixLikelihood@plt>
  movsd  0x20(%rsp),%xmm0
  movsd  0x78(%rsp),%xmm1
  movsd  %xmm1,0x20(%rsp)
  comisd %xmm0,%xmm1
  jbe    L16
  mov    0x38(%rsp),%rax
  lea    0xa0(%rax),%r13
  lea    0xd00(%rsp),%rdi
  mov    %rdi,0x40(%rsp)
  add    $0xd20,%rax
  mov    %rax,0x30(%rsp)
  mov    %rdi,0x10(%rsp)
  mov    0x18(%rsp),%rax
  add    $0xa0,%rax
  mov    %rax,0x8(%rsp)
L56:
  mov    0x18(%rsp),%r15
  mov    0x10(%rsp),%r14
L94:
  mov    %r14,%r12
  movq   $0x0,(%r14)
  lea    -0xa0(%r13),%rbx
  mov    %r15,%rbp
L6:
  movsd  (%rbx),%xmm0
  addsd  0x0(%rbp),%xmm0
  call   <exp@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  addsd  (%r12),%xmm0
  movsd  %xmm0,(%r12)
  add    $0x8,%rbx
  add    $0xa0,%rbp
  cmp    %r13,%rbx
  jne    L6
  call   <log@plt>
  movsd  %xmm0,(%r12)
  add    $0x8,%r14
  add    $0x8,%r15
  cmp    0x8(%rsp),%r15
  jne    L94
  add    $0xa0,%r13
  addq   $0xa0,0x10(%rsp)
  cmp    0x30(%rsp),%r13
  jne    L56
  mov    0x40(%rsp),%rsi
  lea    0xc80(%rsi),%rcx
  mov    0x38(%rsp),%rdx
L66:
  mov    $0x0,%eax
L21:
  movsd  (%rsi,%rax,1),%xmm0
  movsd  %xmm0,(%rdx,%rax,1)
  add    $0x8,%rax
  cmp    $0xa0,%rax
  jne    L21
  add    $0xa0,%rsi
  add    $0xa0,%rdx
  cmp    %rcx,%rsi
  jne    L66
  jmp    L24
L16:
  mov    0x60(%rsp),%rax
  movsd  %xmm0,(%rax)
  mov    0x58(%rsp),%rax
  mov    %ebx,(%rax)
  mov    0x1988(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L117
  add    $0x1998,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L117:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D3
type_infered: byte[8]

tool: {"D3": [0x00,0x00,0x00,0xe0,0xcf,0x12,0x63,0xc1]}

assistant: ```c
void BestMatrixDistance(double bmx[20][20], double *pri, double *ct, int *ret_dist, double *ret_ll) {
  double smx[20][20];
  double nmx[20][20];
  int c, r, i;
  int dist;
  double ll;
  double best_ll;
  for (r = 0; r < 20; r++)
    for (c = 0; c < 20; c++)
      smx[r][c] = bmx[r][c];
  best_ll = -9999999.0;
  dist = 0;
  while (1) {
    dist++;
    MatrixLikelihood(smx, pri, ct, &ll);
    if (ll > best_ll)
      best_ll = ll;
    else {
      *ret_ll = best_ll;
      *ret_dist = dist - 1;
      return;
    }
    for (r = 0; r < 20; r++)
      for (c = 0; c < 20; c++) {
        nmx[r][c] = 0.0;
        for (i = 0; i < 20; i++)
          nmx[r][c] += exp(smx[r][i] + bmx[i][c]);
        nmx[r][c] = log(nmx[r][c]);
      }
    for (r = 0; r < 20; r++)
      for (c = 0; c < 20; c++)
        smx[r][c] = nmx[r][c];
  }
}
```