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

```asm
<PolygonD_Clip>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x34(%rbp)
  mov    %rsi,-0x40(%rbp)
  movsd  %xmm0,-0x48(%rbp)
  movsd  %xmm1,-0x50(%rbp)
  movsd  %xmm2,-0x58(%rbp)
  movsd  %xmm3,-0x60(%rbp)
  movsd  %xmm4,-0x68(%rbp)
  mov    %edx,-0x38(%rbp)
  mov    %rcx,-0x70(%rbp)
  movl   $0x0,-0x2c(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jg     L28
  mov    $0x0,%eax
  jmp    L104
L28:
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  movsd  (%rax),%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x48(%rbp),%xmm1
  mov    -0x28(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x50(%rbp),%xmm0
  addsd  %xmm0,%xmm1
  mov    -0x28(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x58(%rbp),%xmm0
  addsd  %xmm1,%xmm0
  subsd  -0x60(%rbp),%xmm0
  movsd  %xmm0,-0x20(%rbp)
  movl   $0x0,-0x30(%rbp)
  jmp    L120
L100:
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  movsd  -0x20(%rbp),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  mov    -0x30(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x34(%rbp)
  jle    L55
  mov    -0x30(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  jmp    L69
L55:
  mov    $0x0,%edx
L69:
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  movsd  (%rax),%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x48(%rbp),%xmm1
  mov    -0x28(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x50(%rbp),%xmm0
  addsd  %xmm0,%xmm1
  mov    -0x28(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x58(%rbp),%xmm0
  addsd  %xmm1,%xmm0
  subsd  -0x60(%rbp),%xmm0
  movsd  %xmm0,-0x20(%rbp)
  movsd  -0x68(%rbp),%xmm0
  movq   D21(%rip),%xmm1
  xorpd  %xmm0,%xmm1
  movsd  -0x10(%rbp),%xmm0
  comisd %xmm1,%xmm0
  jb     L32
  mov    -0x2c(%rbp),%eax
  cmp    -0x38(%rbp),%eax
  jge    L23
  mov    -0x70(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    %rdx,-0x70(%rbp)
  mov    -0x18(%rbp),%rdx
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x18(%rbp),%rax
  lea    0x8(%rax),%rcx
  mov    -0x70(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    %rdx,-0x70(%rbp)
  movsd  (%rcx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x18(%rbp),%rax
  lea    0x10(%rax),%rcx
  mov    -0x70(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    %rdx,-0x70(%rbp)
  movsd  (%rcx),%xmm0
  movsd  %xmm0,(%rax)
L23:
  addl   $0x1,-0x2c(%rbp)
L32:
  movsd  -0x10(%rbp),%xmm0
  comisd -0x68(%rbp),%xmm0
  jbe    L37
  movsd  -0x68(%rbp),%xmm0
  movq   D21(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  comisd -0x20(%rbp),%xmm0
  ja     L111
L37:
  movsd  -0x68(%rbp),%xmm0
  movq   D21(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  comisd -0x10(%rbp),%xmm0
  jbe    L39
  movsd  -0x20(%rbp),%xmm0
  comisd -0x68(%rbp),%xmm0
  jbe    L39
L111:
  movsd  -0x10(%rbp),%xmm0
  movapd %xmm0,%xmm1
  subsd  -0x20(%rbp),%xmm1
  movsd  -0x10(%rbp),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  mov    -0x2c(%rbp),%eax
  cmp    -0x38(%rbp),%eax
  jge    L123
  mov    -0x18(%rbp),%rax
  movsd  (%rax),%xmm1
  mov    -0x28(%rbp),%rax
  movsd  (%rax),%xmm0
  mov    -0x18(%rbp),%rax
  movsd  (%rax),%xmm2
  subsd  %xmm2,%xmm0
  mulsd  -0x8(%rbp),%xmm0
  mov    -0x70(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    %rdx,-0x70(%rbp)
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm1
  mov    -0x28(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm2
  subsd  %xmm2,%xmm0
  mulsd  -0x8(%rbp),%xmm0
  mov    -0x70(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    %rdx,-0x70(%rbp)
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x18(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm1
  mov    -0x28(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm0
  mov    -0x18(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm2
  subsd  %xmm2,%xmm0
  mulsd  -0x8(%rbp),%xmm0
  mov    -0x70(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    %rdx,-0x70(%rbp)
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
L123:
  addl   $0x1,-0x2c(%rbp)
L39:
  addl   $0x1,-0x30(%rbp)
L120:
  mov    -0x30(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jl     L100
  mov    -0x2c(%rbp),%eax
L104:
  pop    %rbp
  ret
```

tool_calls: name: read_data
arguments: tag: D21
type_infered: byte[8]

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

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;
}
```