user: Converte this assembly snippet into its equivalent C code:

```asm
<groundwaterTransportCoefficientsEvaluate_hetMat>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xa8,%rsp
  mov    %esi,0x84(%rsp)
  movsd  %xmm0,0x40(%rsp)
  mov    %rcx,%rax
  mov    %r8,0x98(%rsp)
  mov    %r9,0x60(%rsp)
  mov    0xe8(%rsp),%r12
  mov    0x108(%rsp),%r14
  mov    0x110(%rsp),%r13
  mov    %edx,%ecx
  imul   %edx,%ecx
  mov    %ecx,0x3c(%rsp)
  test   %edi,%edi
  jle    L185
  mov    %esi,%ebx
  mov    %edx,%r15d
  mov    %rax,0x70(%rsp)
  imul   %edx,%esi
  mov    %esi,0x88(%rsp)
  mov    %ebx,%esi
  imul   %ecx,%esi
  mov    %esi,0x8c(%rsp)
  lea    -0x1(%rdi),%edx
  lea    0x4(%rax,%rdx,4),%rax
  mov    %rax,0x90(%rsp)
  movslq %r15d,%rax
  mov    %rax,0x58(%rsp)
  lea    0x8(,%rax,8),%rbx
  mov    %rbx,0x8(%rsp)
  lea    0x0(,%rax,8),%rbx
  mov    %rbx,0x50(%rsp)
  neg    %rax
  shl    $0x3,%rax
  mov    %rax,0x68(%rsp)
  movl   $0x0,0x80(%rsp)
  movl   $0x0,0x7c(%rsp)
  movl   $0x0,0x78(%rsp)
  jmp    L43
L49:
  pxor   %xmm1,%xmm1
  jmp    L8
L82:
  movapd %xmm1,%xmm0
  call   <sqrt@plt>
  movapd %xmm0,%xmm1
  comisd D2(%rip),%xmm0
  ja     L85
L13:
  test   %r15d,%r15d
  jle    L151
  movslq 0x38(%rsp),%rax
  mov    0x118(%rsp),%rdi
  lea    (%rdi,%rax,8),%rdx
  mov    $0x0,%eax
  movsd  0x40(%rsp),%xmm1
L29:
  movapd %xmm1,%xmm0
  mulsd  0x0(%rbp),%xmm0
  movsd  %xmm0,(%rdx)
  add    $0x1,%eax
  add    0x8(%rsp),%rdx
  cmp    %eax,%r15d
  jne    L29
  jmp    L151
L78:
  mov    0xe8(%rsp),%r12
  mov    0x108(%rsp),%r14
  mov    0x110(%rsp),%r13
L151:
  addq   $0x8,0x10(%rsp)
  mov    0x10(%rsp),%rax
  addq   $0x8,0x20(%rsp)
  addq   $0x8,0x28(%rsp)
  add    %r15d,0x1c(%rsp)
  mov    0x3c(%rsp),%esi
  add    %esi,0x38(%rsp)
  cmp    0x30(%rsp),%rax
  je     L136
L10:
  mov    0x10(%rsp),%rax
  mov    %rax,%rcx
  movsd  0x0(%rbp),%xmm0
  mulsd  (%rax),%xmm0
  mov    0x20(%rsp),%rax
  movsd  %xmm0,(%rax)
  movsd  0x0(%rbp),%xmm0
  mov    0x28(%rsp),%rax
  movsd  %xmm0,(%rax)
  test   %r15d,%r15d
  jle    L49
  movslq 0x1c(%rsp),%rsi
  lea    0x0(,%rsi,8),%rax
  mov    %r15d,%edx
  add    %rsi,%rdx
  shl    $0x3,%rdx
  pxor   %xmm1,%xmm1
L90:
  movsd  (%r12,%rax,1),%xmm0
  mulsd  (%rcx),%xmm0
  movsd  %xmm0,(%r14,%rax,1)
  movsd  (%r12,%rax,1),%xmm0
  movsd  %xmm0,0x0(%r13,%rax,1)
  mulsd  %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L90
  pxor   %xmm6,%xmm6
  ucomisd %xmm1,%xmm6
  ja     L82
L8:
  sqrtsd %xmm1,%xmm1
  comisd D2(%rip),%xmm1
  jbe    L13
  test   %r15d,%r15d
  jle    L151
L85:
  movslq 0x1c(%rsp),%rax
  lea    (%r12,%rax,8),%r8
  mov    %r8,%r9
  movslq 0x38(%rsp),%rax
  mov    0x58(%rsp),%rdi
  lea    (%rax,%rdi,1),%rdx
  mov    0x118(%rsp),%rdi
  lea    (%rdi,%rdx,8),%r11
  lea    (%rdi,%rax,8),%rcx
  mov    %r15d,%eax
  mov    $0x1,%r10d
  mov    0x60(%rsp),%rsi
  add    0x48(%rsp),%rsi
  movsd  0x40(%rsp),%xmm5
  mov    %r12,0xe8(%rsp)
  mov    0x50(%rsp),%r12
  mov    %r14,0x108(%rsp)
  mov    %r13,0x110(%rsp)
  mov    %rax,%r13
  mov    0x68(%rsp),%r14
L128:
  movsd  (%rbx),%xmm3
  mov    %r9,%rdi
  movsd  (%r9),%xmm4
  movsd  (%rsi),%xmm2
  subsd  %xmm3,%xmm2
  movapd %xmm2,%xmm0
  mulsd  %xmm4,%xmm0
  mulsd  %xmm4,%xmm0
  divsd  %xmm1,%xmm0
  movapd %xmm5,%xmm2
  mulsd  0x0(%rbp),%xmm2
  mulsd  %xmm1,%xmm3
  addsd  %xmm3,%xmm2
  addsd  %xmm2,%xmm0
  movsd  %xmm0,(%r11,%r14,1)
  cmp    %r13,%r10
  je     L78
  mov    %r11,%rdx
  mov    %r10,%rax
L139:
  movsd  (%rsi),%xmm0
  subsd  (%rbx),%xmm0
  mulsd  (%rdi),%xmm0
  mulsd  (%r8,%rax,8),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%rcx,%rax,8)
  movsd  %xmm0,(%rdx)
  add    $0x1,%rax
  add    %r12,%rdx
  cmp    %eax,%r15d
  jg     L139
  add    $0x1,%r10
  add    $0x8,%r9
  add    0x8(%rsp),%r11
  add    %r12,%rcx
  jmp    L128
L136:
  addq   $0x4,0x70(%rsp)
  mov    0x70(%rsp),%rax
  mov    0x88(%rsp),%edi
  add    %edi,0x78(%rsp)
  mov    0x8c(%rsp),%edi
  add    %edi,0x7c(%rsp)
  mov    0x84(%rsp),%edi
  add    %edi,0x80(%rsp)
  cmp    0x90(%rsp),%rax
  je     L185
L43:
  mov    0x70(%rsp),%rax
  mov    (%rax),%eax
  mov    0x84(%rsp),%edi
  test   %edi,%edi
  jle    L136
  cltq
  lea    0x0(,%rax,8),%rbx
  mov    %rbx,0x48(%rsp)
  mov    0x98(%rsp),%rbp
  add    %rbx,%rbp
  movslq 0x80(%rsp),%rdx
  lea    0x0(,%rdx,8),%rax
  mov    %rax,%rsi
  add    0xf0(%rsp),%rsi
  mov    %rsi,0x10(%rsp)
  mov    %rax,%rsi
  add    0xf8(%rsp),%rsi
  mov    %rsi,0x20(%rsp)
  add    0x100(%rsp),%rax
  mov    %rax,0x28(%rsp)
  lea    -0x1(%rdi),%eax
  add    %rdx,%rax
  mov    0xf0(%rsp),%rdi
  lea    0x8(%rdi,%rax,8),%rax
  mov    %rax,0x30(%rsp)
  mov    0x7c(%rsp),%eax
  mov    %eax,0x38(%rsp)
  mov    0x78(%rsp),%eax
  mov    %eax,0x1c(%rsp)
  add    0xe0(%rsp),%rbx
  jmp    L10
L185:
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: retrieve_data
arguments: label: D2
type_infered: f64

tool: D2: 0

assistant: ```c
void groundwaterTransportCoefficientsEvaluate_hetMat(const int nSimplex, const int nPointsPerSimplex, const int nSpace, const double d, const int *materialTypes, const double *omega_types, const double *alpha_L_types, const double *alpha_T_types, const double *v, const double *u, double *m, double *dm, double *f, double *df, double *a) {
  int i, j, k, I, J, matID;
  const int nSpace2 = nSpace * nSpace;
  double norm_v;
  for (i = 0; i < nSimplex; i++) {
    matID = materialTypes[i];
    for (j = 0; j < nPointsPerSimplex; j++) {
      k = i * nPointsPerSimplex + j;
      m[k] = omega_types[matID] * u[k];
      dm[k] = omega_types[matID];
      norm_v = 0.0;
      for (I = 0; I < nSpace; I++) {
        f[k * nSpace + I] = v[k * nSpace + I] * u[k];
        df[k * nSpace + I] = v[k * nSpace + I];
        norm_v += v[k * nSpace + I] * v[k * nSpace + I];
      }
      norm_v = sqrt(norm_v);
      if (norm_v > 0.0) {
        for (I = 0; I < nSpace; I++) {
          a[k * nSpace2 + I * nSpace + I] = omega_types[matID] * d + alpha_T_types[matID] * norm_v + (alpha_L_types[matID] - alpha_T_types[matID]) * v[k * nSpace + I] * v[k * nSpace + I] / norm_v;
          for (J = I + 1; J < nSpace; J++) {
            a[k * nSpace2 + I * nSpace + J] = (alpha_L_types[matID] - alpha_T_types[matID]) * v[k * nSpace + I] * v[k * nSpace + J] / norm_v;
            a[k * nSpace2 + J * nSpace + I] = a[k * nSpace2 + I * nSpace + J];
          }
        }
      } else
        for (I = 0; I < nSpace; I++)
          a[k * nSpace2 + I * nSpace + I] = omega_types[matID] * d;
    }
  }
}
```