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

```asm
<DFT_Wfunc>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdi,0x18(%rsp)
  mov    %esi,0x24(%rsp)
  movsd  %xmm0,0x28(%rsp)
  test   %esi,%esi
  jle    L97
  cmp    $0x1,%esi
  je     L7
  shr    %esi
  mov    %rdi,%rax
  pxor   %xmm0,%xmm0
  sub    $0x1,%esi
  shl    $0x4,%rsi
  lea    0x10(%rdi,%rsi,1),%rsi
  nopw   0x0(%rax,%rax,1)
L11:
  movsd  (%rax),%xmm2
  add    $0x10,%rax
  addsd  %xmm2,%xmm0
  movsd  -0x8(%rax),%xmm2
  addsd  %xmm2,%xmm0
  cmp    %rsi,%rax
  jne    L11
  mov    0x24(%rsp),%ebx
  mov    %ebx,%eax
  and    $0xfffffffe,%eax
  and    $0x1,%ebx
  je     L26
L14:
  mov    0x18(%rsp),%rdi
  cltq
  addsd  (%rdi,%rax,8),%xmm0
L26:
  mov    0x24(%rsp),%ebx
  pxor   %xmm7,%xmm7
  cvtsi2sd %ebx,%xmm7
  divsd  %xmm7,%xmm0
  movsd  %xmm7,0x30(%rsp)
  movsd  %xmm0,0x8(%rsp)
  movapd %xmm1,%xmm0
  addsd  %xmm1,%xmm0
  addsd  D0(%rip),%xmm0
  xorpd  D9(%rip),%xmm1
  mulsd  0x28(%rsp),%xmm1
  cvttsd2si %xmm0,%eax
  movsd  %xmm1,0x10(%rsp)
  test   %eax,%eax
  jle    L59
  sub    $0x1,%eax
  mov    %rdx,%r15
  mov    %rcx,%r14
  lea    0x8(%rdx,%rax,8),%rax
  mov    0x18(%rsp),%rdx
  mov    %rax,0x38(%rsp)
  lea    -0x1(%rbx),%eax
  lea    0x8(%rdx,%rax,8),%r12
L49:
  mov    0x24(%rsp),%eax
  movq   $0x0,(%r15)
  movq   $0x0,(%r14)
  test   %eax,%eax
  jle    L70
  mov    0x18(%rsp),%r13
  lea    0x48(%rsp),%rbp
  lea    0x40(%rsp),%rbx
  movsd  D27(%rip),%xmm7
  mulsd  0x10(%rsp),%xmm7
  movsd  %xmm7,(%rsp)
  nopl   0x0(%rax,%rax,1)
L3:
  movsd  0x0(%r13),%xmm0
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  add    $0x8,%r13
  subsd  0x8(%rsp),%xmm0
  mulsd  (%rsp),%xmm0
  call   <sincos@plt>
  movsd  (%r15),%xmm0
  addsd  0x40(%rsp),%xmm0
  movsd  %xmm0,(%r15)
  movsd  (%r14),%xmm0
  addsd  0x48(%rsp),%xmm0
  movsd  %xmm0,(%r14)
  cmp    %r12,%r13
  jne    L3
L70:
  movsd  (%r15),%xmm0
  movsd  0x30(%rsp),%xmm5
  add    $0x8,%r15
  add    $0x8,%r14
  movsd  0x10(%rsp),%xmm6
  addsd  0x28(%rsp),%xmm6
  divsd  %xmm5,%xmm0
  movsd  %xmm6,0x10(%rsp)
  movsd  %xmm0,-0x8(%r15)
  movsd  -0x8(%r14),%xmm0
  divsd  %xmm5,%xmm0
  movsd  %xmm0,-0x8(%r14)
  cmp    0x38(%rsp),%r15
  jne    L49
L59:
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L97:
  pxor   %xmm0,%xmm0
  jmp    L26
L7:
  pxor   %xmm0,%xmm0
  xor    %eax,%eax
  jmp    L14
```

tool_calls: name: unpack_data
arguments: label: D0
type_guessed: f32[2]
name: unpack_data
arguments: label: D9
type_guessed: f32[4]
name: unpack_data
arguments: label: D27
type_guessed: byte[8]

tool: {"D0": [0.0,1.875]}

tool: {"D9": [0.0,-0.0,0.0,0.0]}

tool: {"D27": [0x18,0x2d,0x44,0x54,0xfb,0x21,0x19,0xc0]}

assistant: ```c
void DFT_Wfunc(double *x, int N, double df, double Nf, double *W_r, double *W_i) {
  int i, j, Ntot;
  double avx, cosval, sinval, fval, val;
  for (i = 0, avx = 0.; i < N; i++) {
    avx += x[i];
  }
  avx = avx / N;
  Ntot = 2 * Nf + 1;
  for (i = 0, fval = -Nf * df; i < Ntot; i++, fval += df) {
    for (j = 0, W_r[i] = 0., W_i[i] = 0.; j < N; j++) {
      val = -6.28318530717958647692528676656 * fval * (x[j] - avx);
      cosval = cos(val);
      sinval = sin(val);
      W_r[i] += cosval;
      W_i[i] += sinval;
    }
    W_r[i] /= (double)N;
    W_i[i] /= (double)N;
  }
}
```