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

```asm
<ChebyDivRem>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x28(%rbp)
  movsd  %xmm0,-0x30(%rbp)
  mov    %rsi,-0x38(%rbp)
  mov    %edx,-0x3c(%rbp)
  mov    -0x3c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x14(%rbp)
  movsd  -0x30(%rbp),%xmm0
  addsd  %xmm0,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  mov    -0x14(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x10(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0xc(%rbp)
  movl   $0x0,-0x18(%rbp)
  jmp    L15
L6:
  movsd  -0x8(%rbp),%xmm0
  movq   D8(%rip),%xmm1
  xorpd  %xmm0,%xmm1
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm1,%xmm0
  mov    -0x14(%rbp),%eax
  sub    -0x18(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x10(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  movapd %xmm0,%xmm1
  subsd  %xmm2,%xmm1
  mov    -0x14(%rbp),%edx
  mov    -0x18(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  mov    -0xc(%rbp),%eax
  sub    $0x2,%eax
  sub    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movq   D8(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  mov    -0x18(%rbp),%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movapd %xmm1,%xmm2
  mulsd  -0x8(%rbp),%xmm2
  movapd %xmm0,%xmm1
  subsd  %xmm2,%xmm1
  mov    -0x14(%rbp),%edx
  mov    -0x18(%rbp),%eax
  add    %eax,%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x18(%rbp),%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x18(%rbp)
L15:
  mov    -0x18(%rbp),%eax
  cmp    -0x10(%rbp),%eax
  jl     L6
  mov    -0x10(%rbp),%edx
  mov    -0x14(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mulsd  -0x8(%rbp),%xmm1
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x3c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mulsd  -0x30(%rbp),%xmm1
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  nop
  pop    %rbp
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D8
type: byte[8]

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

assistant: ```c
void ChebyDivRem(double *dividend, double m0, double *remres, int n) {
  int rlim, dd;
  int tmpfloor;
  double tm0;
  int halfrlim;
  rlim = n / 2;
  tm0 = 2.0 * m0;
  tmpfloor = (rlim - 1) / 2;
  halfrlim = rlim / 2;
  for (dd = 0; dd < tmpfloor; dd++) {
    remres[dd] = -tm0 * dividend[dd] - dividend[rlim - dd - 2] + dividend[rlim + dd];
    remres[dd + halfrlim] = -dividend[halfrlim - 2 - dd] - tm0 * dividend[dd + halfrlim] + dividend[rlim + dd + halfrlim];
  }
  remres[tmpfloor] = dividend[tmpfloor + rlim] - dividend[tmpfloor] - (tm0 * dividend[tmpfloor]);
  remres[rlim - 1] = dividend[n - 1] - (m0 * dividend[rlim - 1]);
}
```