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

```asm
<mp_mul_csqu_save_d1>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %rcx,-0x30(%rbp)
  mov    %r8,-0x38(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x8(%rax),%rsi
  mov    -0x38(%rbp),%rcx
  mov    -0x30(%rbp),%rdx
  mov    -0x14(%rbp),%eax
  mov    %rcx,%r8
  mov    %rdx,%rcx
  mov    %rsi,%rdx
  mov    $0x1,%esi
  mov    %eax,%edi
  call   <cdft@plt>
  mov    -0x30(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  shl    $0x2,%eax
  cmp    %eax,-0x14(%rbp)
  jle    L2
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rax,%rdx
  mov    -0x14(%rbp),%eax
  sar    $0x2,%eax
  mov    %eax,%ecx
  mov    -0x30(%rbp),%rax
  mov    %rax,%rsi
  mov    %ecx,%edi
  call   <makect@plt>
L2:
  mov    -0x20(%rbp),%rax
  movsd  (%rax),%xmm0
  addsd  %xmm0,%xmm0
  mov    -0x28(%rbp),%rax
  movsd  %xmm0,(%rax)
  mov    -0x20(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm1
  mov    -0x20(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm0,%xmm1
  mov    -0x20(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm2
  mov    -0x20(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  mov    -0x20(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  movapd %xmm0,%xmm1
  addsd  %xmm0,%xmm1
  mov    -0x20(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  mov    -0x28(%rbp),%rax
  add    $0x8,%rax
  movsd  -0x10(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x28(%rbp),%rax
  add    $0x10,%rax
  movsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  cmpl   $0x2,-0x14(%rbp)
  jle    L0
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x30(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%edx
  mov    -0x28(%rbp),%rax
  lea    0x8(%rax),%rdi
  mov    -0x20(%rbp),%rax
  lea    0x8(%rax),%rsi
  mov    -0x14(%rbp),%eax
  mov    %rcx,%r8
  mov    %edx,%ecx
  mov    %rdi,%rdx
  mov    %eax,%edi
  call   <mp_mul_rcsqu_save@plt>
L0:
  mov    -0x14(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x14(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x14(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x28(%rbp),%rax
  lea    0x8(%rax),%rsi
  mov    -0x38(%rbp),%rcx
  mov    -0x30(%rbp),%rdx
  mov    -0x14(%rbp),%eax
  mov    %rcx,%r8
  mov    %rdx,%rcx
  mov    %rsi,%rdx
  mov    $0xffffffff,%esi
  mov    %eax,%edi
  call   <cdft@plt>
  nop
  leave
  ret
```

assistant: ```c
void mp_mul_csqu_save_d1(int nfft, double d1[], double d2[], int ip[], double w[]) {
  void makect(int nc, int *ip, double *c);
  void cdft(int n, int isgn, double *a, int *ip, double *w);
  void mp_mul_rcsqu_save(int n, double *a, double *b, int nc, double *c);
  double xr, xi;
  cdft(nfft, 1, &d1[1], ip, w);
  if (nfft > (ip[1] << 2)) {
    makect(nfft >> 2, ip, &w[ip[0]]);
  }
  d2[0] = 2 * d1[0];
  xr = d1[1] * d1[1] + d1[2] * d1[2];
  xi = 2 * d1[1] * d1[2];
  d2[1] = xr;
  d2[2] = xi;
  if (nfft > 2) {
    mp_mul_rcsqu_save(nfft, &d1[1], &d2[1], ip[1], &w[ip[0]]);
  }
  d2[nfft + 1] = d1[nfft + 1] * d1[nfft + 1];
  cdft(nfft, -1, &d2[1], ip, w);
}
```