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

```asm
<CalcParms>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdx,0x18(%rsp)
  mov    0x60(%rsp),%r12
  test   %edi,%edi
  js     L80
  mov    %rsi,%r14
  mov    %rcx,%rbx
  mov    %r8,%r15
  mov    %r9,%rdi
  movslq %ebp,%r13
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L41:
  movslq (%r14,%rax,4),%rdx
  mov    %rax,0x8(%rsp)
  mov    0x18(%rsp),%rax
  movsd  D42(%rip),%xmm0
  mov    %rdi,0x10(%rsp)
  mulsd  (%rax,%rdx,8),%xmm0
  call   <cos@plt>
  mov    0x8(%rsp),%rax
  mov    0x10(%rsp),%rdi
  mov    %rax,%rdx
  movsd  %xmm0,(%r12,%rax,8)
  add    $0x1,%rax
  cmp    %rdx,%r13
  jne    L41
  lea    -0x1(%rbp),%eax
  movsd  D27(%rip),%xmm3
  movq   D19(%rip),%xmm6
  xor    %r8d,%r8d
  movslq %eax,%rdx
  movsd  D54(%rip),%xmm5
  movsd  D47(%rip),%xmm4
  imul   $0xffffffff88888889,%rdx,%rdx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0x1f,%eax
  sar    $0x3,%edx
  sub    %eax,%edx
  add    $0x1,%edx
  movslq %edx,%rdx
  nopl   (%rax)
L77:
  movsd  (%r12,%r8,8),%xmm2
  xor    %r9d,%r9d
  movapd %xmm3,%xmm1
  nopl   (%rax)
L20:
  mov    %r9,%rax
  cmp    %r9d,%ebp
  jl     L30
L55:
  cmp    %eax,%r8d
  je     L100
  movapd %xmm2,%xmm0
  subsd  (%r12,%rax,8),%xmm0
  addsd  %xmm0,%xmm0
  mulsd  %xmm0,%xmm1
L100:
  add    %rdx,%rax
  cmp    %eax,%ebp
  jge    L55
L30:
  add    $0x1,%r9
  cmp    %r9,%rdx
  jne    L20
  movapd %xmm1,%xmm2
  movapd %xmm4,%xmm0
  andpd  %xmm6,%xmm2
  comisd %xmm2,%xmm5
  ja     L26
  movapd %xmm3,%xmm0
  divsd  %xmm1,%xmm0
L26:
  movsd  %xmm0,(%rdi,%r8,8)
  lea    0x1(%r8),%rax
  cmp    %r8,%r13
  je     L66
  mov    %rax,%r8
  jmp    L77
L66:
  pxor   %xmm1,%xmm1
  movq   D20(%rip),%xmm5
  xor    %eax,%eax
  movapd %xmm3,%xmm2
  movapd %xmm1,%xmm4
  nopl   0x0(%rax,%rax,1)
L106:
  movslq (%r14,%rax,4),%rdx
  movsd  (%rdi,%rax,8),%xmm0
  movsd  (%rbx,%rdx,8),%xmm6
  mulsd  %xmm0,%xmm6
  mulsd  %xmm2,%xmm0
  xorpd  %xmm5,%xmm2
  divsd  (%r15,%rdx,8),%xmm0
  mov    %rax,%rdx
  addsd  %xmm0,%xmm4
  add    $0x1,%rax
  addsd  %xmm6,%xmm1
  cmp    %rdx,%r13
  jne    L106
  movapd %xmm1,%xmm2
  xor    %eax,%eax
  divsd  %xmm4,%xmm2
  xchg   %ax,%ax
L11:
  movslq (%r14,%rax,4),%rdx
  movapd %xmm2,%xmm1
  mov    0x68(%rsp),%rcx
  mulsd  %xmm3,%xmm1
  xorpd  %xmm5,%xmm3
  movsd  (%rbx,%rdx,8),%xmm0
  divsd  (%r15,%rdx,8),%xmm1
  mov    %rax,%rdx
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rcx,%rax,8)
  add    $0x1,%rax
  cmp    %rdx,%r13
  jne    L11
L80:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D42
type_guessed: f64
name: extract_symbolic_data
arguments: data_label: D27
type_guessed: f64
name: extract_symbolic_data
arguments: data_label: D19
type_guessed: qword
name: extract_symbolic_data
arguments: data_label: D54
type_guessed: f64
name: extract_symbolic_data
arguments: data_label: D47
type_guessed: byte[8]
name: extract_symbolic_data
arguments: data_label: D20
type_guessed: byte[8]

tool: D42: 6.283185307179586

tool: D27: 1

tool: D19: 9223372036854775807

tool: D54: 1e-05

tool: {"D47": [0xff,0xff,0xff,0xff,0xff,0x69,0xf8,0x40]}

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

assistant: ```c
void CalcParms(int r, int Ext[], double Grid[], double D[], double W[], double ad[], double x[], double y[]) {
  int i, j, k, ld;
  double sign, xi, delta, denom, numer;
  for (i = 0; i <= r; i++)
    x[i] = cos(6.2831853071795865 * Grid[Ext[i]]);
  ld = (r - 1) / 15 + 1;
  for (i = 0; i <= r; i++) {
    denom = 1.0;
    xi = x[i];
    for (j = 0; j < ld; j++) {
      for (k = j; k <= r; k += ld)
        if (k != i)
          denom *= 2.0 * (xi - x[k]);
    }
    if (fabs(denom) < 0.00001)
      denom = 0.00001;
    ad[i] = 1.0 / denom;
  }
  numer = denom = 0;
  sign = 1;
  for (i = 0; i <= r; i++) {
    numer += ad[i] * D[Ext[i]];
    denom += sign * ad[i] / W[Ext[i]];
    sign = -sign;
  }
  delta = numer / denom;
  sign = 1;
  for (i = 0; i <= r; i++) {
    y[i] = D[Ext[i]] - sign * delta / W[Ext[i]];
    sign = -sign;
  }
}
```