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

```asm
<l2project2Tensor>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  mov    %edx,%r15d
  push   %r14
  push   %r13
  push   %r12
  mov    %r8,%r12
  push   %rbx
  sub    $0x78,%rsp
  mov    %rcx,-0x98(%rbp)
  mov    %edi,-0x80(%rbp)
  mov    %rsp,%rcx
  mov    %esi,-0x50(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  mov    %edx,%eax
  imul   %edx,%eax
  mov    %eax,-0x4c(%rbp)
  cltq
  lea    0xf(,%rax,8),%rdx
  mov    %rax,-0x68(%rbp)
  mov    %rdx,%rax
  and    $0xfffffffffffff000,%rdx
  sub    %rdx,%rcx
  and    $0xfffffffffffffff0,%rax
  cmp    %rcx,%rsp
  je     L110
L165:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L165
L110:
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  jne    L209
L176:
  mov    -0x80(%rbp),%edx
  mov    %rsp,%rbx
  test   %edx,%edx
  jle    L201
  mov    -0x4c(%rbp),%eax
  mov    -0x50(%rbp),%edi
  mov    %r15d,%r14d
  movl   $0x0,-0x7c(%rbp)
  movl   $0x0,-0x78(%rbp)
  and    $0xfffffffe,%r14d
  imul   %eax,%edi
  sub    $0x1,%eax
  movl   $0x0,-0x74(%rbp)
  lea    0x8(,%rax,8),%rax
  mov    %r14d,-0x84(%rbp)
  mov    %rax,-0x90(%rbp)
  movslq %r15d,%rax
  lea    0x0(,%rax,8),%r11
  mov    %r15d,%eax
  mov    %edi,-0x88(%rbp)
  shr    %eax
  mov    %r11,%r14
  sub    $0x1,%eax
  add    $0x1,%rax
  shl    $0x4,%rax
  mov    %rax,%r13
L153:
  mov    -0x4c(%rbp),%eax
  test   %eax,%eax
  je     L158
  mov    -0x90(%rbp),%rdx
  xor    %esi,%esi
  mov    %rbx,%rdi
  call   <memset@plt>
L158:
  mov    -0x50(%rbp),%eax
  test   %eax,%eax
  jle    L41
  movslq -0x7c(%rbp),%rdx
  sub    $0x1,%eax
  mov    -0x98(%rbp),%rdi
  movl   $0x0,-0x58(%rbp)
  mov    -0x84(%rbp),%r8d
  pxor   %xmm2,%xmm2
  add    %rdx,%rax
  lea    (%rdi,%rdx,8),%rsi
  lea    0x8(%rdi,%rax,8),%rax
  mov    %rsi,-0x48(%rbp)
  mov    %rax,-0x60(%rbp)
  movslq -0x78(%rbp),%rax
  mov    %rax,-0x70(%rbp)
  mov    %eax,%r11d
  nop
L91:
  mov    -0x48(%rbp),%rax
  movsd  (%rax),%xmm1
  addsd  %xmm1,%xmm2
  test   %r15d,%r15d
  jle    L138
  movslq -0x58(%rbp),%rax
  movapd %xmm1,%xmm3
  add    -0x70(%rbp),%rax
  mov    %rbx,%rcx
  lea    (%r12,%rax,8),%rdi
  xor    %esi,%esi
  unpcklpd %xmm3,%xmm3
  xor    %r10d,%r10d
  nopl   0x0(%rax)
L233:
  lea    (%rsi,%r11,1),%r9d
  cmp    $0x1,%r15d
  je     L66
  xor    %eax,%eax
  nopl   0x0(%rax,%rax,1)
L34:
  movupd (%rdi,%rax,1),%xmm0
  movupd (%rcx,%rax,1),%xmm4
  mulpd  %xmm3,%xmm0
  addpd  %xmm4,%xmm0
  movups %xmm0,(%rcx,%rax,1)
  add    $0x10,%rax
  cmp    %r13,%rax
  jne    L34
  mov    %r8d,%eax
  cmp    %r15d,%r8d
  je     L111
L48:
  lea    (%rsi,%rax,1),%edx
  add    %r9d,%eax
  cltq
  movslq %edx,%rdx
  movsd  (%r12,%rax,8),%xmm0
  mulsd  %xmm1,%xmm0
  addsd  (%rbx,%rdx,8),%xmm0
  movsd  %xmm0,(%rbx,%rdx,8)
L111:
  add    $0x1,%r10d
  add    %r15d,%esi
  add    %r14,%rcx
  add    %r14,%rdi
  cmp    %r10d,%r15d
  jne    L233
L138:
  mov    -0x4c(%rbp),%esi
  addq   $0x8,-0x48(%rbp)
  add    %esi,-0x58(%rbp)
  mov    -0x48(%rbp),%rax
  add    %esi,%r11d
  cmp    -0x60(%rbp),%rax
  jne    L91
  pxor   %xmm5,%xmm5
  movsd  %xmm2,-0x58(%rbp)
  comisd %xmm5,%xmm2
  seta   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  test   %r15d,%r15d
  jle    L225
  movsd  -0x58(%rbp),%xmm2
  movslq -0x78(%rbp),%r11
  movl   $0x0,-0x48(%rbp)
  mov    -0x84(%rbp),%r8d
  movapd %xmm2,%xmm1
  mov    %r11,%r10
  unpcklpd %xmm1,%xmm1
  nopl   0x0(%rax)
L56:
  mov    %rbx,%rdi
  lea    (%r12,%r11,8),%rsi
  xor    %ecx,%ecx
  xor    %r9d,%r9d
  nopl   0x0(%rax)
L232:
  lea    (%rcx,%r10,1),%edx
  cmp    $0x1,%r15d
  je     L119
  xor    %eax,%eax
L216:
  movupd (%rdi,%rax,1),%xmm0
  divpd  %xmm1,%xmm0
  movups %xmm0,(%rsi,%rax,1)
  add    $0x10,%rax
  cmp    %r13,%rax
  jne    L216
  mov    %r8d,%eax
  cmp    %r15d,%r8d
  je     L170
L184:
  add    %eax,%edx
  add    %ecx,%eax
  cltq
  movslq %edx,%rdx
  movsd  (%rbx,%rax,8),%xmm0
  divsd  %xmm2,%xmm0
  movsd  %xmm0,(%r12,%rdx,8)
L170:
  add    $0x1,%r9d
  add    %r15d,%ecx
  add    %r14,%rdi
  add    %r14,%rsi
  cmp    %r9d,%r15d
  jne    L232
  addl   $0x1,-0x48(%rbp)
  add    -0x68(%rbp),%r11
  mov    -0x48(%rbp),%eax
  add    -0x4c(%rbp),%r10d
  cmp    %eax,-0x50(%rbp)
  jne    L56
L225:
  mov    -0x88(%rbp),%esi
  addl   $0x1,-0x74(%rbp)
  add    %esi,-0x78(%rbp)
  mov    -0x74(%rbp),%eax
  mov    -0x50(%rbp),%esi
  add    %esi,-0x7c(%rbp)
  cmp    %eax,-0x80(%rbp)
  jne    L153
L201:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L67
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopl   0x0(%rax)
L119:
  xor    %eax,%eax
  jmp    L184
  nopw   0x0(%rax,%rax,1)
L66:
  xor    %eax,%eax
  jmp    L48
L41:
  xor    %edi,%edi
  call   <assert@plt>
  jmp    L225
L209:
  orq    $0x0,-0x8(%rsp,%rax,1)
  jmp    L176
L67:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void l2project2Tensor(const int nSimplices, const int nPointsPerSimplex, const int nSpace, double *dV, double *r) {
  int eN, k, I, J, nSpace2;
  double vol;
  double ravg[nSpace * nSpace];
  nSpace2 = nSpace * nSpace;
  for (eN = 0; eN < nSimplices; eN++) {
    vol = 0.0;
    for (I = 0; I < nSpace2; I++)
      ravg[I] = 0.0;
    for (k = 0; k < nPointsPerSimplex; k++) {
      vol += dV[eN * nPointsPerSimplex + k];
      for (I = 0; I < nSpace; I++)
        for (J = 0; J < nSpace; J++)
          ravg[I * nSpace + J] += r[eN * nPointsPerSimplex * nSpace2 + k * nSpace2 + I * nSpace + J] * dV[eN * nPointsPerSimplex + k];
    }
    assert(vol > 0.0);
    for (k = 0; k < nPointsPerSimplex; k++) {
      for (I = 0; I < nSpace; I++)
        for (J = 0; J < nSpace; J++)
          r[eN * nPointsPerSimplex * nSpace2 + k * nSpace2 + I * nSpace + J] = ravg[I * nSpace + J] / vol;
    }
  }
}
```