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

```asm
<conservativeHeadRichardsJLeverettAni>:
  endbr64
  push   %r15
  movapd %xmm0,%xmm4
  push   %r14
  mulsd  %xmm0,%xmm4
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edx,%ebx
  sub    $0x118,%rsp
  mov    %edx,0x40(%rsp)
  mov    %rcx,%rdx
  mov    %ebx,%ecx
  imul   %ebx,%ecx
  mov    %r9,0xd8(%rsp)
  movsd  %xmm1,(%rsp)
  mov    %ecx,0x90(%rsp)
  test   %edi,%edi
  jle    L64
  mov    %esi,%eax
  mov    %ecx,%esi
  lea    (%rbx,%rbx,1),%ecx
  test   %eax,%eax
  jle    L64
  mov    %rdx,%r10
  mov    %r8,%r13
  mov    %rdx,0xa0(%rsp)
  movslq %eax,%rdx
  shl    $0x3,%rdx
  mov    %ebx,%r8d
  movapd %xmm0,%xmm3
  mov    %r13,%r12
  imul   %eax,%r8d
  mov    %rdx,0xe0(%rsp)
  mov    %eax,%edx
  imul   %esi,%eax
  lea    0x0(,%rdx,8),%r9
  neg    %rdx
  movq   $0x0,0xd0(%rsp)
  mov    %r9,0x48(%rsp)
  mov    %r8d,0xe8(%rsp)
  mov    %eax,%r9d
  mov    %eax,0xec(%rsp)
  lea    0x2(%rcx),%eax
  mov    %eax,0xc4(%rsp)
  movslq %r8d,%rax
  movq   $0x0,0xc8(%rsp)
  shl    $0x3,%rax
  mov    %rax,0xf0(%rsp)
  movslq %r9d,%rax
  movl   $0x2,0xc0(%rsp)
  shl    $0x3,%rax
  mov    %rax,0xf8(%rsp)
  lea    -0x1(%rdi),%eax
  lea    0x4(%r10,%rax,4),%rax
  mov    %rax,0x100(%rsp)
  movslq %ebx,%rax
  shl    $0x3,%rax
  mov    %rax,0x68(%rsp)
  movslq %esi,%rax
  shl    $0x3,%rax
  mov    %rax,0x60(%rsp)
  lea    0x0(,%rdx,8),%rax
  mov    %rax,0x108(%rsp)
  lea    -0x1(%rbx),%eax
  sub    %ecx,%eax
  mov    %eax,0x94(%rsp)
  nopw   0x0(%rax,%rax,1)
L21:
  mov    0xa0(%rsp),%rax
  mov    0x150(%rsp),%rbx
  mov    %r12,%rdi
  mov    0x160(%rsp),%rsi
  mov    0xd8(%rsp),%rcx
  movslq (%rax),%rax
  mov    0xc8(%rsp),%r15
  mov    0xc4(%rsp),%r14d
  mov    0xc0(%rsp),%r13d
  shl    $0x3,%rax
  mov    0x108(%rsp),%rbp
  add    0x48(%rsp),%rbp
  add    %rax,%rbx
  add    %rax,%rsi
  lea    (%rcx,%rax,1),%r10
  mov    %r14d,0x44(%rsp)
  mov    %rbx,0x50(%rsp)
  mov    0x170(%rsp),%rbx
  mov    %r13d,%r14d
  mov    %r10,%r12
  mov    %rsi,0xb8(%rsp)
  mov    0x178(%rsp),%rsi
  add    %rax,%rbx
  mov    %rbx,0x58(%rsp)
  mov    0x158(%rsp),%rbx
  add    %rax,%rsi
  mov    %rsi,%r13
  add    %rax,%rbx
  mov    %rbx,0xa8(%rsp)
  mov    0x168(%rsp),%rbx
  add    %rax,%rbx
  mov    %rbx,0xb0(%rsp)
  mov    0x180(%rsp),%rbx
  add    %rax,%rbx
  add    0x188(%rsp),%rax
  mov    %rbx,0x70(%rsp)
  mov    0xd0(%rsp),%rbx
  mov    %rax,0x98(%rsp)
  mov    %r15,%rax
  mov    %rbx,%r15
  mov    %rax,%rbx
  jmp    L2
  nopl   0x0(%rax,%rax,1)
L38:
  mov    0x58(%rsp),%rax
  movsd  D36(%rip),%xmm6
  pxor   %xmm1,%xmm1
  movsd  %xmm1,0x38(%rsp)
  subsd  (%rax),%xmm6
  mov    D36(%rip),%rax
  movq   %rax,%xmm2
L7:
  mulsd  (%rsp),%xmm11
  mov    %rdi,0x30(%rsp)
  movsd  %xmm4,0x28(%rsp)
  movsd  %xmm3,0x20(%rsp)
  movsd  %xmm1,0x18(%rsp)
  movsd  %xmm2,0x10(%rsp)
  movapd %xmm11,%xmm0
  movsd  %xmm6,0x8(%rsp)
  call   <exp@plt>
  movsd  0x20(%rsp),%xmm3
  mov    0x30(%rsp),%rdi
  movapd %xmm0,%xmm5
  movsd  0x8(%rsp),%xmm6
  mov    0x40(%rsp),%ecx
  mulsd  %xmm3,%xmm5
  movsd  (%r12),%xmm0
  mov    0x198(%rsp),%rax
  movapd %xmm6,%xmm4
  movsd  0x10(%rsp),%xmm2
  movsd  0x18(%rsp),%xmm1
  mulsd  %xmm5,%xmm4
  mulsd  %xmm4,%xmm0
  movsd  0x28(%rsp),%xmm4
  movsd  %xmm0,(%rax,%rbp,1)
  movsd  (%rsp),%xmm0
  movsd  (%r12),%xmm7
  mov    0x1a0(%rsp),%rax
  mulsd  %xmm5,%xmm0
  mulsd  0x38(%rsp),%xmm5
  mulsd  %xmm6,%xmm0
  mulsd  %xmm7,%xmm5
  mulsd  %xmm7,%xmm0
  addsd  %xmm5,%xmm0
  movsd  %xmm0,(%rax,%rbp,1)
  movsd  0x0(%r13),%xmm0
  mov    0x1a8(%rsp),%rax
  mulsd  %xmm4,%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  (%rdi),%xmm0
  movsd  %xmm0,(%rax,%rbx,1)
  movsd  0x0(%r13),%xmm0
  mov    0x1b0(%rsp),%rax
  mulsd  %xmm4,%xmm0
  mulsd  %xmm1,%xmm0
  mulsd  (%rdi),%xmm0
  movsd  %xmm0,(%rax,%rbx,1)
  movsd  0x0(%r13),%xmm0
  mov    0x1b8(%rsp),%rax
  mulsd  %xmm3,%xmm0
  mulsd  %xmm2,%xmm0
  movsd  %xmm0,(%rax,%r15,1)
  movsd  0x0(%r13),%xmm0
  mov    0x1c0(%rsp),%rax
  mulsd  %xmm3,%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax,%r15,1)
  cmp    $0x1,%ecx
  jle    L72
  mov    0x70(%rsp),%rax
  mov    0x1a8(%rsp),%rdx
  lea    -0x1(%r14),%r11d
  movslq %r11d,%r11
  mov    0x1b0(%rsp),%rsi
  movsd  (%rax),%xmm0
  mulsd  %xmm4,%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  0x8(%rdi),%xmm0
  movsd  %xmm0,(%rdx,%r11,8)
  movsd  (%rax),%xmm0
  mov    0x1b8(%rsp),%rdx
  mulsd  %xmm4,%xmm0
  mulsd  %xmm1,%xmm0
  mulsd  0x8(%rdi),%xmm0
  movsd  %xmm0,(%rsi,%r11,8)
  movsd  (%rax),%xmm0
  mov    0x44(%rsp),%esi
  mov    0x94(%rsp),%r11d
  mulsd  %xmm3,%xmm0
  add    %esi,%r11d
  movslq %r11d,%r11
  mulsd  %xmm2,%xmm0
  movsd  %xmm0,(%rdx,%r11,8)
  movsd  (%rax),%xmm0
  mov    0x1c0(%rsp),%rax
  mulsd  %xmm3,%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax,%r11,8)
  cmp    $0x2,%ecx
  je     L72
  mov    0x98(%rsp),%rax
  mov    0x1a8(%rsp),%rdx
  movslq %r14d,%r11
  movsd  (%rax),%xmm0
  mulsd  %xmm4,%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  0x10(%rdi),%xmm0
  movsd  %xmm0,(%rdx,%r11,8)
  movsd  (%rax),%xmm0
  mov    0x1b0(%rsp),%rdx
  mulsd  %xmm4,%xmm0
  mulsd  %xmm1,%xmm0
  mulsd  0x10(%rdi),%xmm0
  movsd  %xmm0,(%rdx,%r11,8)
  movsd  (%rax),%xmm0
  movslq %esi,%r11
  mov    0x1b8(%rsp),%rsi
  mulsd  %xmm3,%xmm0
  mulsd  %xmm2,%xmm0
  movsd  %xmm0,(%rsi,%r11,8)
  movsd  (%rax),%xmm0
  mov    0x1c0(%rsp),%rax
  mulsd  %xmm3,%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax,%r11,8)
L72:
  mov    0x90(%rsp),%edx
  add    0x40(%rsp),%r14d
  add    $0x8,%rbp
  add    %edx,0x44(%rsp)
  add    0x68(%rsp),%rbx
  add    0x60(%rsp),%r15
  cmp    %rbp,0x48(%rsp)
  je     L3
L2:
  mov    0x190(%rsp),%rax
  movsd  (%rax,%rbp,1),%xmm11
  mov    0x50(%rsp),%rax
  movapd %xmm11,%xmm7
  movsd  (%rax),%xmm2
  xorpd  D65(%rip),%xmm7
  comisd %xmm2,%xmm7
  jb     L38
  divsd  %xmm2,%xmm7
  movsd  %xmm3,0x78(%rsp)
  mov    0xa8(%rsp),%rax
  mov    %rdi,0x88(%rsp)
  movsd  (%rax),%xmm9
  movsd  %xmm11,0x30(%rsp)
  movsd  %xmm4,0x80(%rsp)
  movapd %xmm9,%xmm1
  xorpd  D65(%rip),%xmm1
  movsd  %xmm2,0x18(%rsp)
  movsd  %xmm9,0x10(%rsp)
  movapd %xmm7,%xmm0
  movsd  %xmm7,0x8(%rsp)
  call   <pow@plt>
  mov    0xb0(%rsp),%rax
  movsd  0x10(%rsp),%xmm9
  movapd %xmm0,%xmm8
  movsd  D36(%rip),%xmm0
  movsd  0x8(%rsp),%xmm7
  movsd  (%rax),%xmm1
  mov    0x58(%rsp),%rax
  movapd %xmm9,%xmm10
  movsd  %xmm8,0x8(%rsp)
  movsd  0x18(%rsp),%xmm2
  mulsd  %xmm8,%xmm10
  subsd  %xmm1,%xmm0
  subsd  (%rax),%xmm0
  mulsd  %xmm7,%xmm2
  movapd %xmm0,%xmm6
  mulsd  %xmm8,%xmm6
  divsd  %xmm2,%xmm10
  addsd  %xmm1,%xmm6
  movsd  D1(%rip),%xmm1
  mulsd  %xmm9,%xmm1
  addsd  D68(%rip),%xmm1
  movsd  %xmm6,0x28(%rsp)
  divsd  %xmm9,%xmm1
  mulsd  %xmm10,%xmm0
  movsd  %xmm10,0x20(%rsp)
  movsd  %xmm0,0x38(%rsp)
  movapd %xmm8,%xmm0
  call   <pow@plt>
  movsd  0x10(%rsp),%xmm9
  movsd  D68(%rip),%xmm1
  movsd  0x8(%rsp),%xmm8
  divsd  %xmm9,%xmm1
  addsd  D36(%rip),%xmm9
  movapd %xmm8,%xmm0
  movsd  %xmm8,0x10(%rsp)
  mulsd  %xmm9,%xmm1
  call   <pow@plt>
  mov    0xb8(%rsp),%rax
  movsd  0x10(%rsp),%xmm8
  movsd  (%rax),%xmm7
  movapd %xmm8,%xmm0
  movsd  %xmm8,0x18(%rsp)
  movapd %xmm7,%xmm1
  movsd  %xmm7,0x8(%rsp)
  call   <pow@plt>
  movsd  0x8(%rsp),%xmm7
  movsd  0x18(%rsp),%xmm8
  movsd  %xmm0,0x10(%rsp)
  movapd %xmm7,%xmm1
  subsd  D36(%rip),%xmm1
  movapd %xmm8,%xmm0
  call   <pow@plt>
  movsd  0x8(%rsp),%xmm7
  movsd  0x20(%rsp),%xmm10
  movsd  0x10(%rsp),%xmm2
  movsd  0x28(%rsp),%xmm6
  mulsd  %xmm0,%xmm7
  movsd  0x30(%rsp),%xmm11
  movsd  0x78(%rsp),%xmm3
  movsd  0x80(%rsp),%xmm4
  mov    0x88(%rsp),%rdi
  movapd %xmm7,%xmm1
  mulsd  %xmm10,%xmm1
  jmp    L7
  nopw   0x0(%rax,%rax,1)
L3:
  mov    0xe0(%rsp),%rsi
  mov    %rdi,%r12
  add    %rsi,0x48(%rsp)
  addq   $0x4,0xa0(%rsp)
  mov    0xe8(%rsp),%ebx
  mov    0xec(%rsp),%edx
  mov    0xf0(%rsp),%rcx
  mov    0xf8(%rsp),%rsi
  add    %ebx,0xc0(%rsp)
  add    %edx,0xc4(%rsp)
  mov    0xa0(%rsp),%rax
  add    %rcx,0xc8(%rsp)
  add    %rsi,0xd0(%rsp)
  cmp    0x100(%rsp),%rax
  jne    L21
L64:
  add    $0x118,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D36
type_guessed: f64
name: disassemble_data
arguments: tag: D65
type_guessed: f32[4]
name: disassemble_data
arguments: tag: D1
type_guessed: f64
name: disassemble_data
arguments: tag: D68
type_guessed: f64

tool: D36: 1

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

tool: D1: 3

tool: D68: 2

assistant: ```c
void conservativeHeadRichardsJLeverettAni(const int nSimplex, const int nPointsPerSimplex, const int nSpace, const int *materialTypes, const double rho, const double beta, const double *gravity, const double *phi, const double *psiD, const double *ns, const double *nk, const double *S_wirr, const double *S_nwr, const double *kr0x, const double *kr0y, const double *kr0z, double *u, double *mass, double *dmass, double *f, double *df, double *a, double *da) {
  int i, j, k, I, matID;
  const int nSpace2 = nSpace * nSpace;
  register double psiC, pcBar, Se, dSe, Sw, dSw, kr, dkr, rho2 = rho * rho, rhom, drhom;
  const double reg_diff = 1.0e-2;
  for (i = 0; i < nSimplex; i++) {
    matID = materialTypes[i];
    for (j = 0; j < nPointsPerSimplex; j++) {
      k = i * nPointsPerSimplex + j;
      psiC = -u[k];
      if (psiC >= psiD[matID]) {
        pcBar = psiC / psiD[matID];
        Se = pow(pcBar, -ns[matID]);
        Sw = Se * (1.0 - S_wirr[matID] - S_nwr[matID]) + S_wirr[matID];
        dSe = ns[matID] * Se / (pcBar * psiD[matID]);
        dSw = (1.0 - S_wirr[matID] - S_nwr[matID]) * dSe;
        kr = pow(Se, (2.0 + 3.0 * ns[matID]) / ns[matID]);
        dkr = ((2.0 + 3.0 * ns[matID]) / ns[matID] * pow(Se, 2.0 / ns[matID] * (1.0 + ns[matID])) * dSe);
        kr = pow(Se, nk[matID]);
        dkr = nk[matID] * pow(Se, nk[matID] - 1) * dSe;
      } else {
        Se = 1.0;
        Sw = 1.0 - S_nwr[matID];
        dSw = 0.0;
        kr = 1.0;
        dkr = 0.0;
      }
      rhom = rho * exp(beta * u[k]);
      drhom = beta * rhom;
      mass[k] = rhom * Sw * phi[matID];
      dmass[k] = rhom * dSw * phi[matID] + drhom * Sw * phi[matID];
      I = 0;
      f[k * nSpace + I] = rho2 * kr0x[matID] * kr * gravity[I];
      df[k * nSpace + I] = rho2 * kr0x[matID] * dkr * gravity[I];
      a[k * nSpace2 + I * nSpace + I] = rho * kr0x[matID] * kr;
      da[k * nSpace2 + I * nSpace + I] = rho * kr0x[matID] * dkr;
      if (nSpace > 1) {
        I = 1;
        f[k * nSpace + I] = rho2 * kr0y[matID] * kr * gravity[I];
        df[k * nSpace + I] = rho2 * kr0y[matID] * dkr * gravity[I];
        a[k * nSpace2 + I * nSpace + I] = rho * kr0y[matID] * kr;
        da[k * nSpace2 + I * nSpace + I] = rho * kr0y[matID] * dkr;
        if (nSpace > 2) {
          I = 2;
          f[k * nSpace + I] = rho2 * kr0z[matID] * kr * gravity[I];
          df[k * nSpace + I] = rho2 * kr0z[matID] * dkr * gravity[I];
          a[k * nSpace2 + I * nSpace + I] = rho * kr0z[matID] * kr;
          da[k * nSpace2 + I * nSpace + I] = rho * kr0z[matID] * dkr;
        }
      }
    }
  }
}
```