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

```asm
<weightExpPartial>:
  endbr64
  push   %r15
  imul   %edi,%esi
  mov    %r9,%r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edx,%ebx
  sub    $0x38,%rsp
  mov    %edi,0x2c(%rsp)
  mov    0x70(%rsp),%rbp
  mov    %rcx,0x18(%rsp)
  mov    %r8,0x20(%rsp)
  test   %esi,%esi
  jle    L60
  mov    0x78(%rsp),%r13
  lea    -0x1(%rsi),%eax
  pxor   %xmm4,%xmm4
  xor    %r14d,%r14d
  mov    0x80(%rsp),%r12
  movsd  %xmm4,(%rsp)
  lea    0x8(%r13,%rax,8),%rax
  mov    %r13,%rbx
  mov    %edx,%r13d
  mov    %rax,0x10(%rsp)
  lea    -0x1(%rdx),%eax
  mov    %eax,0x28(%rsp)
  nopl   0x0(%rax,%rax,1)
L19:
  test   %r13d,%r13d
  jle    L20
  mov    0x18(%rsp),%rdi
  movslq %r14d,%rax
  pxor   %xmm2,%xmm2
  mov    0x28(%rsp),%esi
  movapd %xmm2,%xmm1
  lea    (%rdi,%rax,4),%rcx
  xor    %eax,%eax
  nopl   0x0(%rax,%rax,1)
L64:
  pxor   %xmm0,%xmm0
  movsd  (%r15,%rax,8),%xmm3
  mov    %rax,%rdx
  cvtsi2sdl (%rcx,%rax,4),%xmm0
  mulsd  %xmm0,%xmm3
  mulsd  0x0(%rbp,%rax,8),%xmm0
  add    $0x1,%rax
  addsd  %xmm3,%xmm1
  addsd  %xmm0,%xmm2
  cmp    %rdx,%rsi
  jne    L64
  xorpd  D35(%rip),%xmm1
  movapd %xmm1,%xmm0
L4:
  movsd  %xmm2,0x8(%rsp)
  add    $0x8,%rbx
  add    $0x8,%r12
  add    %r13d,%r14d
  call   <exp@plt>
  movsd  0x8(%rsp),%xmm2
  movsd  %xmm0,-0x8(%rbx)
  mulsd  %xmm2,%xmm0
  movsd  %xmm0,-0x8(%r12)
  cmp    %rbx,0x10(%rsp)
  jne    L19
  mov    %r13d,%ebx
L60:
  mov    0x2c(%rsp),%eax
  test   %eax,%eax
  jle    L46
  sub    $0x1,%eax
  xor    %r14d,%r14d
  mov    %rbp,0x70(%rsp)
  pxor   %xmm5,%xmm5
  mov    0x88(%rsp),%r13
  mov    0x90(%rsp),%r12
  mov    %ebx,%ebp
  movsd  %xmm5,(%rsp)
  lea    0x8(%r13,%rax,8),%rax
  mov    %rax,0x10(%rsp)
  lea    -0x1(%rbx),%eax
  mov    %r12,%rbx
  mov    %r14d,%r12d
  mov    %eax,0x18(%rsp)
  mov    %r13,%r14
  mov    0x70(%rsp),%r13
  nopl   0x0(%rax)
L51:
  test   %ebp,%ebp
  jle    L21
  mov    0x20(%rsp),%rdi
  movslq %r12d,%rax
  pxor   %xmm2,%xmm2
  mov    0x18(%rsp),%esi
  movapd %xmm2,%xmm1
  lea    (%rdi,%rax,4),%rcx
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L40:
  pxor   %xmm0,%xmm0
  movsd  (%r15,%rax,8),%xmm3
  mov    %rax,%rdx
  cvtsi2sdl (%rcx,%rax,4),%xmm0
  mulsd  %xmm0,%xmm3
  mulsd  0x0(%r13,%rax,8),%xmm0
  add    $0x1,%rax
  addsd  %xmm3,%xmm1
  addsd  %xmm0,%xmm2
  cmp    %rdx,%rsi
  jne    L40
  xorpd  D35(%rip),%xmm1
  movapd %xmm1,%xmm0
L65:
  movsd  %xmm2,0x8(%rsp)
  add    $0x8,%r14
  add    $0x8,%rbx
  add    %ebp,%r12d
  call   <exp@plt>
  movsd  0x8(%rsp),%xmm2
  movsd  %xmm0,-0x8(%r14)
  mulsd  %xmm2,%xmm0
  movsd  %xmm0,-0x8(%rbx)
  cmp    %r14,0x10(%rsp)
  jne    L51
L46:
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L21:
  mov    D35(%rip),%rax
  pxor   %xmm2,%xmm2
  movq   %rax,%xmm0
  jmp    L65
  nopw   0x0(%rax,%rax,1)
L20:
  mov    D35(%rip),%rax
  pxor   %xmm2,%xmm2
  movq   %rax,%xmm0
  jmp    L4
```

tool_calls: name: retrieve_data
arguments: data_tag: D35
type_infered: f32[4]

tool: {"D35": [0.0,-0.0,0.0,0.0]}

assistant: ```c
void weightExpPartial(const int16_t ns, const int16_t nc, const int16_t dims, const int16_t *restrict tcounts, const int16_t *restrict fcounts, const double *restrict weights, const double *restrict dir, double *restrict tprob, double *restrict tvec, double *restrict fprob, double *restrict fvec) {
  for (int t = 0; t < ns * nc; ++t) {
    double lp = 0;
    double v = 0;
    for (int i = 0; i < dims; ++i) {
      lp += tcounts[t * dims + i] * weights[i];
      v += tcounts[t * dims + i] * dir[i];
    }
    double p = exp(-lp);
    tprob[t] = p;
    tvec[t] = p * v;
  }
  for (int t = 0; t < ns; ++t) {
    double lp = 0;
    double v = 0;
    for (int i = 0; i < dims; ++i) {
      lp += fcounts[t * dims + i] * weights[i];
      v += fcounts[t * dims + i] * dir[i];
    }
    double p = exp(-lp);
    fprob[t] = p;
    fvec[t] = p * v;
  }
}
```