user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<PolygonD_Clip>:
  endbr64
  movapd %xmm0,%xmm8
  mov    %edx,%r10d
  xor    %r8d,%r8d
  test   %edi,%edi
  jle    L35
  movsd  (%rsi),%xmm5
  movapd %xmm4,%xmm6
  mov    %rsi,%r9
  xor    %edx,%edx
  xorpd  D8(%rip),%xmm6
  mulsd  %xmm0,%xmm5
  movsd  0x8(%rsi),%xmm0
  mulsd  %xmm1,%xmm0
  addsd  %xmm0,%xmm5
  movsd  0x10(%rsi),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm5
  subsd  %xmm3,%xmm5
  jmp    L118
  nopl   0x0(%rax,%rax,1)
L38:
  comisd %xmm0,%xmm6
  jbe    L1
L52:
  cmp    %r10d,%r8d
  jge    L29
  movapd %xmm5,%xmm7
  movsd  (%r9),%xmm9
  add    $0x18,%rcx
  subsd  %xmm0,%xmm7
  divsd  %xmm7,%xmm5
  movsd  (%rax),%xmm7
  subsd  %xmm9,%xmm7
  mulsd  %xmm5,%xmm7
  addsd  %xmm9,%xmm7
  movsd  %xmm7,-0x18(%rcx)
  movsd  0x8(%r9),%xmm9
  movsd  0x8(%rax),%xmm7
  subsd  %xmm9,%xmm7
  mulsd  %xmm5,%xmm7
  addsd  %xmm9,%xmm7
  movsd  %xmm7,-0x10(%rcx)
  movsd  0x10(%r9),%xmm9
  movsd  0x10(%rax),%xmm7
  subsd  %xmm9,%xmm7
  mulsd  %xmm7,%xmm5
  addsd  %xmm9,%xmm5
  movsd  %xmm5,-0x8(%rcx)
L29:
  add    $0x1,%r8d
L116:
  cmp    %edi,%edx
  je     L35
L73:
  movapd %xmm0,%xmm5
  mov    %rax,%r9
L118:
  add    $0x1,%edx
  mov    %rsi,%rax
  cmp    %edi,%edx
  jge    L107
  lea    (%rdx,%rdx,2),%eax
  cltq
  lea    (%rsi,%rax,8),%rax
L107:
  movsd  (%rax),%xmm0
  movsd  0x8(%rax),%xmm7
  comisd %xmm6,%xmm5
  mulsd  %xmm1,%xmm7
  mulsd  %xmm8,%xmm0
  addsd  %xmm7,%xmm0
  movsd  0x10(%rax),%xmm7
  mulsd  %xmm2,%xmm7
  addsd  %xmm7,%xmm0
  subsd  %xmm3,%xmm0
  jb     L27
  cmp    %r8d,%r10d
  jle    L77
  movsd  (%r9),%xmm7
  add    $0x18,%rcx
  movsd  %xmm7,-0x18(%rcx)
  movsd  0x8(%r9),%xmm7
  movsd  %xmm7,-0x10(%rcx)
  movsd  0x10(%r9),%xmm7
  movsd  %xmm7,-0x8(%rcx)
L77:
  add    $0x1,%r8d
L27:
  comisd %xmm4,%xmm5
  ja     L38
L1:
  comisd %xmm5,%xmm6
  jbe    L116
  comisd %xmm4,%xmm0
  ja     L52
  cmp    %edi,%edx
  jne    L73
L35:
  mov    %r8d,%eax
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D8
type_guessed: byte[16]

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

assistant: ```c
int PolygonD_Clip(int innumpoints, const double *inpoints, double planenormalx, double planenormaly, double planenormalz, double planedist, double epsilon, int outfrontmaxpoints, double *outfrontpoints) {
  int i, frontcount = 0;
  const double *n, *p;
  double frac, pdist, ndist;
  if (innumpoints < 1)
    return 0;
  n = inpoints;
  ndist = n[0] * planenormalx + n[1] * planenormaly + n[2] * planenormalz - planedist;
  for (i = 0; i < innumpoints; i++) {
    p = n;
    pdist = ndist;
    n = inpoints + ((i + 1) < innumpoints ? (i + 1) : 0) * 3;
    ndist = n[0] * planenormalx + n[1] * planenormaly + n[2] * planenormalz - planedist;
    if (pdist >= -epsilon) {
      if (frontcount < outfrontmaxpoints) {
        *outfrontpoints++ = p[0];
        *outfrontpoints++ = p[1];
        *outfrontpoints++ = p[2];
      }
      frontcount++;
    }
    if ((pdist > epsilon && ndist < -epsilon) || (pdist < -epsilon && ndist > epsilon)) {
      frac = pdist / (pdist - ndist);
      if (frontcount < outfrontmaxpoints) {
        *outfrontpoints++ = p[0] + frac * (n[0] - p[0]);
        *outfrontpoints++ = p[1] + frac * (n[1] - p[1]);
        *outfrontpoints++ = p[2] + frac * (n[2] - p[2]);
      }
      frontcount++;
    }
  }
  return frontcount;
}
```