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

```asm
<scriptedSphereMotionSignedDistance>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %edx,0x30(%rsp)
  mov    %r9,0x38(%rsp)
  test   %edi,%edi
  jle    L137
  mov    %edi,%eax
  mov    %rcx,%r14
  mov    %r8,%r15
  mov    0x80(%rsp),%rdi
  mov    %rdi,0x20(%rsp)
  lea    (%rax,%rax,2),%eax
  mov    %eax,0x34(%rsp)
  movl   $0x0,0x2c(%rsp)
  movl   $0x0,0x28(%rsp)
  mov    %esi,%r12d
  jmp    L49
L94:
  movapd %xmm1,%xmm0
  call   <sqrt@plt>
  subsd  (%r14,%rbp,8),%xmm0
  movsd  %xmm0,(%rsp)
  test   %ebp,%ebp
  jne    L64
  jmp    L85
L40:
  test   %r12d,%r12d
  jle    L18
L85:
  mov    %r12d,%edx
  mov    $0x0,%eax
  movsd  (%rsp),%xmm1
  addsd  D18(%rip),%xmm1
L63:
  movsd  (%rbx,%rax,8),%xmm0
  subsd  (%r15,%rax,8),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0x0(%r13,%rax,8)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L63
  movsd  (%rsp),%xmm3
  movsd  %xmm3,0x10(%rsp)
L23:
  add    $0x1,%rbp
  cmp    0x18(%rsp),%rbp
  je     L30
L133:
  pxor   %xmm1,%xmm1
  test   %r12d,%r12d
  jle    L45
  mov    %r12d,%ecx
  lea    0x0(%rbp,%rbp,2),%eax
  cltq
  lea    (%r15,%rax,8),%rdx
  mov    $0x0,%eax
  pxor   %xmm1,%xmm1
L81:
  movsd  (%rbx,%rax,8),%xmm0
  subsd  (%rdx,%rax,8),%xmm0
  mulsd  %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L81
  pxor   %xmm2,%xmm2
  ucomisd %xmm1,%xmm2
  ja     L94
L45:
  sqrtsd %xmm1,%xmm1
  subsd  (%r14,%rbp,8),%xmm1
  movsd  %xmm1,(%rsp)
  test   %ebp,%ebp
  je     L40
L64:
  movsd  (%rsp),%xmm0
  call   <fabs@plt>
  mov    %rax,0x8(%rsp)
  movsd  0x10(%rsp),%xmm0
  call   <fabs@plt>
  cmp    %rax,0x8(%rsp)
  jge    L23
  test   %r12d,%r12d
  jle    L20
  mov    %r12d,%ecx
  lea    0x0(%rbp,%rbp,2),%eax
  cltq
  lea    (%r15,%rax,8),%rdx
  mov    $0x0,%eax
  movsd  (%rsp),%xmm1
  addsd  D18(%rip),%xmm1
L26:
  movsd  (%rbx,%rax,8),%xmm0
  subsd  (%rdx,%rax,8),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0x0(%r13,%rax,8)
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L26
  movsd  (%rsp),%xmm4
  movsd  %xmm4,0x10(%rsp)
  jmp    L23
L18:
  movsd  (%rsp),%xmm6
  movsd  %xmm6,0x10(%rsp)
  jmp    L23
L20:
  movsd  (%rsp),%xmm7
  movsd  %xmm7,0x10(%rsp)
  jmp    L23
L30:
  mov    0x20(%rsp),%rax
  movsd  0x10(%rsp),%xmm5
  movsd  %xmm5,(%rax)
  add    $0x8,%rax
  mov    %rax,0x20(%rsp)
  addl   $0x3,0x28(%rsp)
  mov    0x28(%rsp),%eax
  add    %r12d,0x2c(%rsp)
  cmp    0x34(%rsp),%eax
  je     L137
L49:
  mov    0x30(%rsp),%eax
  test   %eax,%eax
  jle    L30
  mov    %eax,%eax
  mov    %rax,0x18(%rsp)
  movslq 0x28(%rsp),%rax
  mov    0x38(%rsp),%rdi
  lea    (%rdi,%rax,8),%rbx
  movslq 0x2c(%rsp),%rax
  mov    0x88(%rsp),%rdi
  lea    (%rdi,%rax,8),%r13
  mov    $0x0,%ebp
  jmp    L133
L137:
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D18
datatype: byte[8]

tool: {"D18": [0x11,0xea,0x2d,0x81,0x99,0x97,0x71,0x3d]}

assistant: ```c
void scriptedSphereMotionSignedDistance(const int nPoints, const double t, const int nSpace, const int nSpheres, const double *radii, const double *centers, const double *x, double *phi, double *n) {
  int i, j, k;
  double minDistance, distance, tmp;
  for (k = 0; k < nPoints; k++) {
    for (j = 0; j < nSpheres; j++) {
      tmp = 0.0;
      for (i = 0; i < nSpace; i++) {
        tmp += (x[3 * k + i] - centers[3 * j + i]) * (x[3 * k + i] - centers[3 * j + i]);
      }
      distance = sqrt(tmp) - radii[j];
      if (j == 0) {
        minDistance = distance;
        for (i = 0; i < nSpace; i++) {
          n[k * nSpace + i] = (x[3 * k + i] - centers[3 * j + i]) / (distance + 1.0e-12);
        }
      } else if (fabs(distance) < fabs(minDistance)) {
        minDistance = distance;
        for (i = 0; i < nSpace; i++) {
          n[k * nSpace + i] = (x[3 * k + i] - centers[3 * j + i]) / (distance + 1.0e-12);
        }
      }
    }
    phi[k] = minDistance;
  }
}
```