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

```asm
<BatchInterpolatedThree3DZero>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x148,%rsp
  mov    0x180(%rsp),%rax
  mov    %rsi,0x8(%rsp)
  mov    %rdx,0x10(%rsp)
  mov    0x190(%rsp),%r13
  mov    %rax,0x30(%rsp)
  mov    0x188(%rsp),%rax
  mov    %rcx,0x18(%rsp)
  mov    0x198(%rsp),%r14
  mov    %rax,0x38(%rsp)
  mov    0x1b0(%rsp),%rax
  mov    %r8,0x20(%rsp)
  mov    0x1a0(%rsp),%r10
  mov    %rax,0x88(%rsp)
  mov    0x1b8(%rsp),%rax
  mov    %r9,0x28(%rsp)
  mov    0x1a8(%rsp),%r11
  mov    %rax,0x90(%rsp)
  mov    0x1c0(%rsp),%rax
  movsd  %xmm4,0xa8(%rsp)
  pxor   %xmm4,%xmm4
  mov    %rax,0x98(%rsp)
  movsd  %xmm3,0xb8(%rsp)
  movsd  0x1e0(%rsp),%xmm3
  movsd  %xmm1,0xa0(%rsp)
  movsd  %xmm6,0xc8(%rsp)
  movsd  %xmm7,0xb0(%rsp)
  mov    0x1e8(%rsp),%r12
  mov    %fs:0x28,%rax
  mov    %rax,0x138(%rsp)
  xor    %eax,%eax
  comisd %xmm4,%xmm6
  jbe    L12
  xor    %ebx,%ebx
  movapd %xmm0,%xmm9
  movapd %xmm2,%xmm8
  mov    %rdi,%r15
  movsd  0xb8(%rsp),%xmm6
  lea    0x100(%rsp),%r9
  movq   $0x0,0xc0(%rsp)
  movq   $0x0,0x80(%rsp)
  comisd %xmm4,%xmm6
  jbe    L12
  nopl   0x0(%rax)
L100:
  movq   $0x0,0x78(%rsp)
  pxor   %xmm4,%xmm4
  movq   $0x0,0x70(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L51:
  pxor   %xmm7,%xmm7
  xor    %ebp,%ebp
  pxor   %xmm0,%xmm0
  comisd %xmm7,%xmm9
  jbe    L23
  nopl   (%rax)
L70:
  movss  (%r12,%rbx,4),%xmm1
  add    $0x1,%rbx
  ucomiss %xmm4,%xmm1
  jp     L106
  jne    L106
  mov    0x8(%rsp),%rax
  add    $0x1,%rbp
  pxor   %xmm0,%xmm0
  movl   $0x0,-0x4(%r15,%rbx,4)
  cvtsi2sd %rbp,%xmm0
  movl   $0x0,-0x4(%rax,%rbx,4)
  mov    0x10(%rsp),%rax
  movl   $0x0,-0x4(%rax,%rbx,4)
  mov    0x18(%rsp),%rax
  comisd %xmm0,%xmm9
  movl   $0x0,-0x4(%rax,%rbx,4)
  mov    0x20(%rsp),%rax
  movl   $0x0,-0x4(%rax,%rbx,4)
  mov    0x28(%rsp),%rax
  movl   $0x0,-0x4(%rax,%rbx,4)
  mov    0x30(%rsp),%rax
  movl   $0x0,-0x4(%rax,%rbx,4)
  mov    0x38(%rsp),%rax
  movl   $0x0,-0x4(%rax,%rbx,4)
  movl   $0x0,-0x4(%r13,%rbx,4)
  movl   $0x0,-0x4(%r14,%rbx,4)
  movl   $0x0,-0x4(%r10,%rbx,4)
  movl   $0x0,-0x4(%r11,%rbx,4)
  ja     L70
L23:
  addq   $0x1,0x78(%rsp)
  mov    0x78(%rsp),%rax
  pxor   %xmm7,%xmm7
  movsd  0xb8(%rsp),%xmm6
  cvtsi2sd %rax,%xmm7
  comisd %xmm7,%xmm6
  movsd  %xmm7,0x70(%rsp)
  ja     L51
  addq   $0x1,0xc0(%rsp)
  pxor   %xmm6,%xmm6
  mov    0xc0(%rsp),%rax
  movsd  0xc8(%rsp),%xmm4
  cvtsi2sd %rax,%xmm6
  movsd  %xmm6,0x80(%rsp)
  comisd %xmm6,%xmm4
  ja     L100
L12:
  mov    0x138(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L42
  add    $0x148,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L106:
  subsd  0xa0(%rsp),%xmm0
  mov    %r11,0x60(%rsp)
  lea    0xf0(%rsp),%rcx
  add    $0x1,%rbp
  mov    %r10,0x58(%rsp)
  lea    0xe8(%rsp),%rdx
  lea    0xe0(%rsp),%rsi
  movsd  %xmm9,0x68(%rsp)
  lea    0xd8(%rsp),%rdi
  sub    $0x8,%rsp
  movsd  %xmm8,0x58(%rsp)
  divsd  %xmm8,%xmm0
  push   0x1f8(%rsp)
  push   0x1e8(%rsp)
  push   0x1e8(%rsp)
  push   0x1e8(%rsp)
  push   0xc0(%rsp)
  push   0xc0(%rsp)
  push   0xc0(%rsp)
  lea    0x170(%rsp),%rax
  push   %rax
  lea    0x170(%rsp),%rax
  push   %rax
  lea    0x170(%rsp),%rax
  push   %rax
  lea    0x170(%rsp),%rax
  push   %rax
  lea    0x170(%rsp),%rax
  push   %rax
  lea    0x170(%rsp),%rax
  push   %rax
  movsd  0xf0(%rsp),%xmm2
  movsd  0xe0(%rsp),%xmm1
  subsd  0x120(%rsp),%xmm2
  subsd  0x118(%rsp),%xmm1
  lea    0x168(%rsp),%r8
  mov    %r9,0xb0(%rsp)
  movsd  %xmm3,0x250(%rsp)
  divsd  %xmm3,%xmm2
  movsd  %xmm5,0xb8(%rsp)
  divsd  %xmm5,%xmm1
  call   <InterpolatedThree3DZero@plt>
  pxor   %xmm0,%xmm0
  mov    0x78(%rsp),%rax
  movsd  0xc0(%rsp),%xmm8
  cvtsd2ss 0x148(%rsp),%xmm0
  movss  %xmm0,-0x4(%r15,%rbx,4)
  pxor   %xmm4,%xmm4
  movsd  0x150(%rsp),%xmm0
  movsd  0xb8(%rsp),%xmm5
  mov    0xc8(%rsp),%r10
  movsd  0x250(%rsp),%xmm3
  divsd  %xmm8,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0x4(%rax,%rbx,4)
  movsd  0x158(%rsp),%xmm0
  mov    0x80(%rsp),%rax
  divsd  %xmm5,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0x4(%rax,%rbx,4)
  movsd  0x160(%rsp),%xmm0
  mov    0x88(%rsp),%rax
  divsd  %xmm3,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0x4(%rax,%rbx,4)
  pxor   %xmm0,%xmm0
  mov    0x90(%rsp),%rax
  cvtsd2ss 0x168(%rsp),%xmm0
  movss  %xmm0,-0x4(%rax,%rbx,4)
  mov    0x98(%rsp),%rax
  movsd  0x170(%rsp),%xmm0
  divsd  %xmm8,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0x4(%rax,%rbx,4)
  movsd  0x178(%rsp),%xmm0
  mov    0xa0(%rsp),%rax
  divsd  %xmm5,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0x4(%rax,%rbx,4)
  movsd  0x180(%rsp),%xmm0
  mov    0xa8(%rsp),%rax
  divsd  %xmm3,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0x4(%rax,%rbx,4)
  pxor   %xmm0,%xmm0
  cvtsd2ss 0x188(%rsp),%xmm0
  movss  %xmm0,-0x4(%r13,%rbx,4)
  movsd  0x190(%rsp),%xmm0
  divsd  %xmm8,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0x4(%r14,%rbx,4)
  movsd  0x198(%rsp),%xmm0
  divsd  %xmm5,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0x4(%r10,%rbx,4)
  movsd  0x1a0(%rsp),%xmm0
  mov    0xd0(%rsp),%r11
  movsd  0xd8(%rsp),%xmm9
  add    $0x70,%rsp
  mov    0x40(%rsp),%r9
  divsd  %xmm3,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0x4(%r11,%rbx,4)
  pxor   %xmm0,%xmm0
  cvtsi2sd %rbp,%xmm0
  comisd %xmm0,%xmm9
  ja     L70
  jmp    L23
L42:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
extern void BatchInterpolatedThree3DZero(float *Bo1, float *Bo1gx, float *Bo1gy, float *Bo1gz, float *Bo2, float *Bo2gx, float *Bo2gy, float *Bo2gz, float *Bo3, float *Bo3gx, float *Bo3gy, float *Bo3gz, float *Bcoeff1, float *Bcoeff2, float *Bcoeff3, long Width, long Height, long Slice, double nx, double offx, double mx, double ny, double offy, double my, double nz, double offz, double mz, float *mask, long SplineDegree) {
  double x, y, z;
  double out1, gradx1, grady1, gradz1;
  double out2, gradx2, grady2, gradz2;
  double out3, gradx3, grady3, gradz3;
  long idx;
  long idcoordx, idcoordy, idcoordz;
  idx = 0;
  for (idcoordz = 0; idcoordz < nz; idcoordz++) {
    for (idcoordy = 0; idcoordy < ny; idcoordy++) {
      for (idcoordx = 0; idcoordx < nx; idcoordx++) {
        if (mask[idx] == 0) {
          Bo1[idx] = 0;
          Bo1gx[idx] = 0;
          Bo1gy[idx] = 0;
          Bo1gz[idx] = 0;
          Bo2[idx] = 0;
          Bo2gx[idx] = 0;
          Bo2gy[idx] = 0;
          Bo2gz[idx] = 0;
          Bo3[idx] = 0;
          Bo3gx[idx] = 0;
          Bo3gy[idx] = 0;
          Bo3gz[idx++] = 0;
        } else {
          x = (idcoordx - offx) / mx;
          y = (idcoordy - offy) / my;
          z = (idcoordz - offz) / mz;
          InterpolatedThree3DZero(&out1, &gradx1, &grady1, &gradz1, &out2, &gradx2, &grady2, &gradz2, &out3, &gradx3, &grady3, &gradz3, Bcoeff1, Bcoeff2, Bcoeff3, Width, Height, Slice, x, y, z, SplineDegree);
          Bo1[idx] = out1;
          Bo1gx[idx] = gradx1 / mx;
          Bo1gy[idx] = grady1 / my;
          Bo1gz[idx] = gradz1 / mz;
          Bo2[idx] = out2;
          Bo2gx[idx] = gradx2 / mx;
          Bo2gy[idx] = grady2 / my;
          Bo2gz[idx] = gradz2 / mz;
          Bo3[idx] = out3;
          Bo3gx[idx] = gradx3 / mx;
          Bo3gy[idx] = grady3 / my;
          Bo3gz[idx++] = gradz3 / mz;
        }
      }
    }
  }
}
```