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

```asm
<compute_cell_geometry>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x168,%rsp
  mov    %edi,%r15d
  mov    %rsi,%r14
  mov    %rdx,0x38(%rsp)
  mov    %r8,0x40(%rsp)
  mov    %r9,0x48(%rsp)
  mov    0x1a0(%rsp),%rax
  mov    %rax,0x68(%rsp)
  mov    0x1a8(%rsp),%eax
  mov    0x1b0(%rsp),%rsi
  mov    %rsi,0x28(%rsp)
  mov    0x1b8(%rsp),%rsi
  mov    %rsi,0x30(%rsp)
  mov    0x1c0(%rsp),%rdi
  mov    %rdi,0x78(%rsp)
  mov    0x1c8(%rsp),%rsi
  mov    %rsi,0x70(%rsp)
  mov    %fs:0x28,%rdx
  mov    %rdx,0x158(%rsp)
  xor    %edx,%edx
  movq   $0x0,0x140(%rsp)
  movq   $0x0,0x148(%rsp)
  movq   $0x0,0x150(%rsp)
  test   %eax,%eax
  jle    L520
  mov    %eax,%eax
  mov    %rax,0x60(%rsp)
  lea    0x80(%rsp),%rax
  mov    %rax,0x58(%rsp)
  lea    -0x1(%r15),%eax
  lea    0x88(%rsp,%rax,8),%rax
  mov    %rax,0x50(%rsp)
  movq   $0x0,0x10(%rsp)
  mov    %rcx,%r13
  jmp    L351
L148:
  add    $0x4,%rcx
  cmp    %rdi,%rcx
  je     L304
L223:
  test   %r15d,%r15d
  jle    L148
  mov    (%rcx),%eax
  lea    (%rax,%rax,2),%eax
  cltq
  lea    (%r10,%rax,8),%rsi
  mov    $0x0,%eax
L422:
  lea    0x100(%rsp),%rdx
  movsd  (%rdx,%rax,8),%xmm0
  addsd  (%rsi,%rax,8),%xmm0
  movsd  %xmm0,(%rdx,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r15d
  jg     L422
  jmp    L148
L410:
  mov    %r9d,%ecx
  sub    %r8d,%ecx
  test   %r15d,%r15d
  jg     L301
  pxor   %xmm7,%xmm7
  movsd  %xmm7,0x8(%rsp)
  jmp    L44
L431:
  pxor   %xmm7,%xmm7
  movsd  %xmm7,0x8(%rsp)
L44:
  test   %r15d,%r15d
  jle    L150
  mov    0x10(%rsp),%rax
  lea    (%rax,%rax,2),%eax
  cltq
  mov    0x78(%rsp),%rsi
  lea    (%rsi,%rax,8),%rcx
  mov    $0x0,%eax
  lea    0x100(%rsp),%rdx
  movsd  0x8(%rsp),%xmm1
L414:
  movsd  0x120(%rsp,%rax,8),%xmm0
  divsd  %xmm1,%xmm0
  addsd  (%rdx,%rax,8),%xmm0
  movsd  %xmm0,(%rcx,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r15d
  jg     L414
L150:
  mov    0x70(%rsp),%rsi
  mov    0x10(%rsp),%rax
  movsd  0x8(%rsp),%xmm7
  movsd  %xmm7,(%rsi,%rax,8)
  add    $0x1,%rax
  mov    %rax,0x10(%rsp)
  cmp    0x60(%rsp),%rax
  je     L520
L351:
  test   %r15d,%r15d
  jle    L236
  movq   $0x0,0x100(%rsp)
  cmp    $0x1,%r15d
  jle    L219
  movq   $0x0,0x108(%rsp)
  cmp    $0x2,%r15d
  jle    L378
  movq   $0x0,0x110(%rsp)
L378:
  movq   $0x0,0x120(%rsp)
  movq   $0x0,0x128(%rsp)
  cmp    $0x2,%r15d
  jle    L236
  movq   $0x0,0x130(%rsp)
L236:
  mov    0x28(%rsp),%rax
  mov    0x10(%rsp),%rdi
  mov    (%rax,%rdi,4),%r8d
  mov    0x4(%rax,%rdi,4),%r9d
  cmp    %r9d,%r8d
  jge    L410
  movslq %r8d,%rdx
  mov    0x30(%rsp),%rdi
  lea    (%rdi,%rdx,4),%rcx
  lea    -0x1(%r9),%eax
  sub    %r8d,%eax
  add    %rdx,%rax
  lea    0x4(%rdi,%rax,4),%rdi
  mov    0x68(%rsp),%r10
  jmp    L223
L199:
  add    $0x4,%rcx
  cmp    %rcx,%rdi
  je     L89
L491:
  test   %r15d,%r15d
  jle    L199
  mov    (%rcx),%eax
  lea    (%rax,%rax,2),%eax
  cltq
  lea    (%r14,%rax,8),%rsi
  mov    $0x0,%eax
L159:
  lea    0x80(%rsp),%rdx
  movsd  (%rdx,%rax,8),%xmm0
  addsd  (%rsi,%rax,8),%xmm0
  movsd  %xmm0,(%rdx,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r15d
  jg     L159
  jmp    L199
L315:
  lea    0xe0(%rsp),%rdx
  lea    0xc0(%rsp),%rsi
  lea    0xa0(%rsp),%rdi
  mov    $0x0,%eax
  call   <cross@plt>
  pxor   %xmm4,%xmm4
  mov    0x18(%rsp),%rax
  mov    0x10(%rsp),%esi
  cmp    %esi,(%rax)
  jne    L451
  movsd  0x8(%rsp),%xmm7
  addsd  D43(%rip),%xmm7
  movsd  %xmm7,0x8(%rsp)
  jmp    L266
L304:
  test   %r15d,%r15d
  jle    L210
  mov    %r9d,%ecx
  sub    %r8d,%ecx
L301:
  lea    0x100(%rsp),%rax
  mov    $0x0,%edx
  pxor   %xmm1,%xmm1
  cvtsi2sd %ecx,%xmm1
L169:
  movsd  (%rax),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  add    $0x1,%edx
  add    $0x8,%rax
  cmp    %edx,%r15d
  jg     L169
  cmp    %r9d,%r8d
  jge    L431
L210:
  movslq %r8d,%rax
  mov    %rax,0x20(%rsp)
  pxor   %xmm7,%xmm7
  movsd  %xmm7,0x8(%rsp)
  jmp    L290
L267:
  movsd  0x8(%rsp),%xmm6
  addsd  %xmm4,%xmm6
  movsd  %xmm6,0x8(%rsp)
  movapd %xmm4,%xmm1
  jmp    L218
L207:
  mov    0x18(%rsp),%rax
  mov    0x10(%rsp),%edi
  cmp    %edi,(%rax)
  je     L267
L451:
  movapd %xmm4,%xmm1
  xorpd  D21(%rip),%xmm1
  movsd  0x8(%rsp),%xmm5
  subsd  %xmm4,%xmm5
  movsd  %xmm5,0x8(%rsp)
  test   %r15d,%r15d
  jle    L266
L218:
  mov    $0x0,%eax
  lea    0xc0(%rsp),%rcx
  lea    0x80(%rsp),%rdx
L256:
  movsd  0xa0(%rsp,%rax,8),%xmm0
  addsd  (%rcx,%rax,8),%xmm0
  mulsd  D62(%rip),%xmm0
  addsd  (%rdx,%rax,8),%xmm0
  movsd  %xmm0,0x140(%rsp,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r15d
  jg     L256
  mulsd  D28(%rip),%xmm1
  mulsd  D61(%rip),%xmm1
  mov    $0x0,%eax
  lea    0x120(%rsp),%rdx
  lea    0x100(%rsp),%rcx
L375:
  movsd  0x140(%rsp,%rax,8),%xmm0
  subsd  (%rcx,%rax,8),%xmm0
  mulsd  %xmm1,%xmm0
  addsd  (%rdx,%rax,8),%xmm0
  movsd  %xmm0,(%rdx,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r15d
  jg     L375
  mov    $0x0,%eax
L240:
  movsd  0xc0(%rsp,%rax,8),%xmm0
  movsd  %xmm0,0xa0(%rsp,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r15d
  jg     L240
L266:
  add    $0x1,%rbx
  cmp    %ebx,(%r12)
  jle    L1
L532:
  mov    0x0(%r13,%rbx,4),%eax
  test   %r15d,%r15d
  jle    L315
  lea    (%rax,%rax,2),%eax
  cltq
  lea    (%r14,%rax,8),%rcx
  mov    $0x0,%eax
  lea    0x80(%rsp),%rdx
L387:
  movsd  (%rcx,%rax,8),%xmm0
  subsd  (%rdx,%rax,8),%xmm0
  movsd  %xmm0,0xc0(%rsp,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r15d
  jg     L387
  lea    0xe0(%rsp),%rdx
  lea    0xc0(%rsp),%rsi
  lea    0xa0(%rsp),%rdi
  mov    $0x0,%eax
  call   <cross@plt>
  mov    $0x0,%eax
  pxor   %xmm4,%xmm4
  lea    0x100(%rsp),%rdx
  movsd  D24(%rip),%xmm3
L14:
  movsd  0x80(%rsp,%rax,8),%xmm0
  subsd  (%rdx,%rax,8),%xmm0
  movapd %xmm3,%xmm2
  mulsd  0xe0(%rsp,%rax,8),%xmm2
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm4
  add    $0x1,%rax
  cmp    %eax,%r15d
  jg     L14
  mov    $0x0,%eax
  pxor   %xmm2,%xmm2
L184:
  movsd  0xe0(%rsp,%rax,8),%xmm0
  mulsd  0x0(%rbp,%rax,8),%xmm0
  addsd  %xmm0,%xmm2
  add    $0x1,%rax
  cmp    %eax,%r15d
  jg     L184
  pxor   %xmm0,%xmm0
  comisd %xmm2,%xmm0
  jbe    L207
  xorpd  D21(%rip),%xmm4
  jmp    L207
L89:
  test   %r15d,%r15d
  jle    L114
L116:
  mov    %r8d,%edx
  sub    %ebx,%edx
  mov    0x58(%rsp),%rax
  pxor   %xmm1,%xmm1
  cvtsi2sd %edx,%xmm1
  mov    0x50(%rsp),%rdx
L157:
  movsd  (%rax),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  add    $0x8,%rax
  cmp    %rax,%rdx
  jne    L157
  movslq %r8d,%rax
  mov    -0x4(%r13,%rax,4),%eax
  lea    (%rax,%rax,2),%eax
  cltq
  lea    (%r14,%rax,8),%rcx
  mov    $0x0,%eax
  lea    0x80(%rsp),%rdx
L196:
  movsd  (%rcx,%rax,8),%xmm0
  subsd  (%rdx,%rax,8),%xmm0
  movsd  %xmm0,0xa0(%rsp,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r15d
  jg     L196
  cmp    %r8d,%ebx
  jge    L1
L114:
  lea    (%r9,%r9,1),%eax
  movslq %eax,%rdx
  mov    0x40(%rsp),%rsi
  lea    (%rsi,%rdx,4),%rsi
  mov    %rsi,0x18(%rsp)
  movslq %ebx,%rbx
  add    %r9d,%eax
  cltq
  mov    0x48(%rsp),%rsi
  lea    (%rsi,%rax,8),%rbp
  jmp    L532
L536:
  test   %r15d,%r15d
  jg     L116
L1:
  addq   $0x1,0x20(%rsp)
  mov    0x20(%rsp),%rax
  mov    0x28(%rsp),%rsi
  mov    0x10(%rsp),%rdi
  cmp    %eax,0x4(%rsi,%rdi,4)
  jle    L44
L290:
  test   %r15d,%r15d
  jle    L433
  movq   $0x0,0x80(%rsp)
  cmp    $0x1,%r15d
  jle    L527
  movq   $0x0,0x88(%rsp)
  cmp    $0x2,%r15d
  jle    L5
  movq   $0x0,0x90(%rsp)
L5:
  movq   $0x0,0x140(%rsp)
  movq   $0x0,0x148(%rsp)
  cmp    $0x2,%r15d
  jle    L433
  movq   $0x0,0x150(%rsp)
L433:
  mov    0x30(%rsp),%rax
  mov    0x20(%rsp),%rsi
  mov    (%rax,%rsi,4),%r9d
  movslq %r9d,%rax
  mov    0x38(%rsp),%rdi
  mov    (%rdi,%rax,4),%ebx
  lea    0x4(%rdi,%rax,4),%r12
  mov    (%r12),%r8d
  cmp    %r8d,%ebx
  jge    L536
  movslq %ebx,%rdx
  lea    0x0(%r13,%rdx,4),%rcx
  mov    %r8d,%eax
  sub    %ebx,%eax
  lea    -0x1(%rax),%eax
  add    %rdx,%rax
  lea    0x4(%r13,%rax,4),%rdi
  jmp    L491
L527:
  movq   $0x0,0x140(%rsp)
  jmp    L433
L219:
  movq   $0x0,0x120(%rsp)
  jmp    L236
L520:
  mov    0x158(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L320
  add    $0x168,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L320:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D43
datatype: f64
name: read_data
arguments: data_tag: D21
datatype: byte[16]
name: read_data
arguments: data_tag: D62
datatype: byte[8]
name: read_data
arguments: data_tag: D28
datatype: byte[8]
name: read_data
arguments: data_tag: D61
datatype: byte[8]
name: read_data
arguments: data_tag: D24
datatype: byte[8]

tool: D43: 0

tool: {"D21": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

tool: {"D62": [0x55,0x55,0x55,0x55,0x55,0x55,0xd5,0x3f]}

tool: {"D28": [0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x40]}

tool: {"D61": [0x00,0x00,0x00,0x00,0x00,0x00,0xd0,0x3f]}

tool: {"D24": [0x55,0x55,0x55,0x55,0x55,0x55,0xc5,0x3f]}

assistant: ```c
void compute_cell_geometry(int ndims, double *coords, int *nodepos, int *facenodes, int *neighbors, double *fnormals, double *fcentroids, int ncells, int *facepos, int *cellfaces, double *ccentroids, double *cvolumes) {
  int i, k, f, c;
  int face, node;
  double x[3];
  double u[3];
  double v[3];
  double w[3];
  double xcell[3];
  double ccell[3];
  double cface[3] = {0};
  int num_faces;
  double volume;
  double tet_volume, subnormal_sign;
  double twothirds = 0.666666666666666666666666666667;
#pragma omp parallel for default(none) private(i, k, f, c, face, node, x, u, v, w, xcell, ccell, cface, num_faces, volume, tet_volume, subnormal_sign) shared(coords, nodepos, facenodes, neighbors, fnormals, fcentroids, facepos, cellfaces, ccentroids, cvolumes) firstprivate(ncells, ndims, twothirds)
  for (c = 0; c < ncells; ++c) {
    for (i = 0; i < ndims; ++i)
      xcell[i] = 0.0;
    for (i = 0; i < ndims; ++i)
      ccell[i] = 0.0;
    for (f = facepos[c]; f < facepos[c + 1]; ++f) {
      face = cellfaces[f];
      for (i = 0; i < ndims; ++i)
        xcell[i] += fcentroids[3 * face + i];
    }
    num_faces = facepos[c + 1] - facepos[c];
    for (i = 0; i < ndims; ++i)
      xcell[i] /= num_faces;
    volume = 0;
    for (f = facepos[c]; f < facepos[c + 1]; ++f) {
      int num_face_nodes;
      for (i = 0; i < ndims; ++i)
        x[i] = 0.0;
      for (i = 0; i < ndims; ++i)
        cface[i] = 0.0;
      face = cellfaces[f];
      for (k = nodepos[face]; k < nodepos[face + 1]; ++k) {
        node = facenodes[k];
        for (i = 0; i < ndims; ++i)
          x[i] += coords[3 * node + i];
      }
      num_face_nodes = nodepos[face + 1] - nodepos[face];
      for (i = 0; i < ndims; ++i)
        x[i] /= num_face_nodes;
      node = facenodes[nodepos[face + 1] - 1];
      for (i = 0; i < ndims; ++i)
        u[i] = coords[3 * node + i] - x[i];
      for (k = nodepos[face]; k < nodepos[face + 1]; ++k) {
        node = facenodes[k];
        for (i = 0; i < ndims; ++i)
          v[i] = coords[3 * node + i] - x[i];
        cross(u, v, w);
        tet_volume = 0;
        for (i = 0; i < ndims; ++i) {
          tet_volume += 0.5 / 3 * w[i] * (x[i] - xcell[i]);
        }
        subnormal_sign = 0.0;
        for (i = 0; i < ndims; ++i) {
          subnormal_sign += w[i] * fnormals[3 * face + i];
        }
        if (subnormal_sign < 0) {
          tet_volume *= -1.0;
        }
        if (!(neighbors[2 * face + 0] == c)) {
          tet_volume *= -1.0;
        }
        volume += tet_volume;
        for (i = 0; i < ndims; ++i)
          cface[i] = (x[i] + (twothirds)*0.5 * (u[i] + v[i]));
        for (i = 0; i < ndims; ++i)
          ccell[i] += tet_volume * 3 / 4.0 * (cface[i] - xcell[i]);
        for (i = 0; i < ndims; ++i)
          u[i] = v[i];
      }
    }
    for (i = 0; i < ndims; ++i)
      ccentroids[3 * c + i] = xcell[i] + ccell[i] / volume;
    cvolumes[c] = volume;
  }
}
```