user: Please show me the C implementation that matches the assembly code listed below:

```asm
<PowerSpectrum>:
  endbr64
  push   %r15
  mov    %edi,%r15d
  pxor   %xmm1,%xmm1
  pxor   %xmm6,%xmm6
  shr    $0x1f,%r15d
  push   %r14
  add    %edi,%r15d
  push   %r13
  sar    %r15d
  push   %r12
  push   %rbp
  cvtsi2sd %r15d,%xmm1
  push   %rbx
  mov    %edi,%ebx
  mov    %r15d,%edi
  sub    $0x28,%rsp
  movsd  D65(%rip),%xmm0
  mov    %rsi,0x18(%rsp)
  mov    $0x4,%esi
  divsd  %xmm1,%xmm0
  mov    %rdx,0x10(%rsp)
  cvtsd2ss %xmm0,%xmm6
  movss  %xmm6,0xc(%rsp)
  call   <calloc@plt>
  mov    $0x4,%esi
  mov    %r15d,%edi
  mov    %rax,%r14
  call   <calloc@plt>
  mov    $0x4,%esi
  mov    %r15d,%edi
  mov    %rax,%rbp
  call   <calloc@plt>
  mov    $0x4,%esi
  mov    %r15d,%edi
  mov    %rax,%r12
  call   <calloc@plt>
  mov    %rax,%r13
  cmp    $0x1,%ebx
  jle    L20
  mov    %rbp,%rsi
  mov    0x18(%rsp),%rcx
  mov    %r14,%rdx
  xor    %eax,%eax
  sub    %r14,%rsi
  nopw   0x0(%rax,%rax,1)
L4:
  movss  (%rcx,%rax,8),%xmm0
  movss  %xmm0,(%rdx)
  movss  0x4(%rcx,%rax,8),%xmm0
  add    $0x1,%rax
  movss  %xmm0,(%rsi,%rdx,1)
  add    $0x4,%rdx
  cmp    %eax,%r15d
  jg     L4
  xor    %esi,%esi
  mov    %r15d,%edi
  mov    %r13,%r9
  mov    %r12,%r8
  mov    %rbp,%rcx
  mov    %r14,%rdx
  call   <FFT@plt>
  movss  D68(%rip),%xmm6
  movss  0xc(%rsp),%xmm7
  mulss  %xmm6,%xmm7
  movaps %xmm7,%xmm0
  call   <sin@plt>
  pxor   %xmm0,%xmm0
  movsd  D52(%rip),%xmm7
  cvtsi2ss %rax,%xmm0
  cvtss2sd %xmm0,%xmm0
  mulsd  %xmm0,%xmm7
  mulsd  %xmm0,%xmm7
  movss  0xc(%rsp),%xmm0
  cvtsd2ss %xmm7,%xmm7
  movss  %xmm7,0x18(%rsp)
  call   <sin@plt>
  test   %ebx,%ebx
  lea    0x3(%rbx),%esi
  movss  0x18(%rsp),%xmm7
  cmovns %ebx,%esi
  movss  D43(%rip),%xmm5
  pxor   %xmm8,%xmm8
  cvtsi2ss %rax,%xmm8
  sar    $0x2,%esi
  addss  %xmm7,%xmm5
  mov    %esi,%edi
  cmp    $0x7,%ebx
  jle    L42
  mov    0x10(%rsp),%r8
  movslq %r15d,%r15
  mov    %r13,%r9
  lea    0x4(%r12),%rdx
  movss  D51(%rip),%xmm9
  lea    -0x4(%r12,%r15,4),%rax
  movaps %xmm8,%xmm4
  sub    %r12,%r9
  movss  D68(%rip),%xmm6
  mov    $0x1,%ecx
  sub    %r12,%r8
  nopw   0x0(%rax,%rax,1)
L16:
  movss  (%r9,%rax,1),%xmm11
  movss  (%rdx,%r9,1),%xmm1
  add    $0x1,%ecx
  movss  (%rax),%xmm3
  movss  (%rdx),%xmm2
  movaps %xmm1,%xmm10
  addss  %xmm11,%xmm1
  movaps %xmm2,%xmm0
  subss  %xmm3,%xmm2
  subss  %xmm11,%xmm10
  addss  %xmm3,%xmm0
  mulss  %xmm6,%xmm1
  mulss  %xmm9,%xmm2
  mulss  %xmm6,%xmm0
  mulss  %xmm6,%xmm10
  movaps %xmm1,%xmm12
  mulss  %xmm5,%xmm12
  movaps %xmm2,%xmm11
  mulss  %xmm5,%xmm2
  mulss  %xmm4,%xmm11
  mulss  %xmm4,%xmm1
  movaps %xmm12,%xmm3
  movaps %xmm2,%xmm13
  addss  %xmm0,%xmm3
  subss  %xmm10,%xmm2
  addss  %xmm10,%xmm13
  subss  %xmm12,%xmm0
  subss  %xmm11,%xmm3
  addss  %xmm1,%xmm13
  addss  %xmm11,%xmm0
  addss  %xmm2,%xmm1
  mulss  %xmm3,%xmm3
  mulss  %xmm13,%xmm13
  mulss  %xmm1,%xmm1
  mulss  %xmm0,%xmm0
  addss  %xmm13,%xmm3
  addss  %xmm1,%xmm0
  movaps %xmm8,%xmm1
  movss  %xmm3,(%r8,%rdx,1)
  mulss  %xmm4,%xmm1
  add    $0x4,%rdx
  movss  %xmm0,(%r8,%rax,1)
  movaps %xmm7,%xmm0
  sub    $0x4,%rax
  mulss  %xmm5,%xmm0
  subss  %xmm1,%xmm0
  movaps %xmm5,%xmm1
  mulss  %xmm8,%xmm1
  addss  %xmm0,%xmm5
  movaps %xmm7,%xmm0
  mulss  %xmm4,%xmm0
  addss  %xmm1,%xmm0
  addss  %xmm0,%xmm4
  cmp    %esi,%ecx
  jl     L16
L42:
  movss  0x0(%r13),%xmm2
  movss  (%r12),%xmm0
  movslq %edi,%rdi
  mov    0x10(%rsp),%rax
  movaps %xmm2,%xmm1
  addss  %xmm0,%xmm1
  subss  %xmm2,%xmm0
  mulss  %xmm1,%xmm1
  mulss  %xmm0,%xmm0
  addss  %xmm0,%xmm1
  movss  %xmm1,(%rax)
  movss  (%r12,%rdi,4),%xmm0
  movss  0x0(%r13,%rdi,4),%xmm1
  mulss  %xmm0,%xmm0
  mulss  %xmm1,%xmm1
  addss  %xmm1,%xmm0
  movss  %xmm0,(%rax,%rdi,4)
  mov    %r14,%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    %r12,%rdi
  call   <free@plt>
  add    $0x28,%rsp
  mov    %r13,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1080 <free@plt>
  nopl   0x0(%rax)
L20:
  xor    %esi,%esi
  mov    %r15d,%edi
  mov    %rax,%r9
  mov    %r12,%r8
  mov    %rbp,%rcx
  mov    %r14,%rdx
  call   <FFT@plt>
  movss  0xc(%rsp),%xmm7
  mulss  D68(%rip),%xmm7
  movaps %xmm7,%xmm0
  call   <sin@plt>
  movss  0xc(%rsp),%xmm0
  call   <sin@plt>
  test   %ebx,%ebx
  lea    0x3(%rbx),%edi
  cmovns %ebx,%edi
  sar    $0x2,%edi
  jmp    L42
```

tool_calls: name: retrieve_data
arguments: label: D65
type: f64
name: retrieve_data
arguments: label: D68
type: f32
name: retrieve_data
arguments: label: D52
type: byte[8]
name: retrieve_data
arguments: label: D43
type: f32
name: retrieve_data
arguments: label: D51
type: byte[4]

tool: D65: 3.141592653589793

tool: D68: 0.5

tool: {"D52": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0]}

tool: D43: 1

tool: {"D51": [0x00,0x00,0x00,0xbf]}

assistant: ```c
void PowerSpectrum(int NumSamples, float *In, float *Out) {
  int Half, i, i3;
  float theta, wtemp, wpr, wpi, wr, wi;
  float h1r, h1i, h2r, h2i, rt, it;
  float *tmpReal;
  float *tmpImag;
  float *RealOut;
  float *ImagOut;
  Half = NumSamples / 2;
  theta = 3.14159265358979323846 / Half;
  tmpReal = (float *)calloc(Half, sizeof(float));
  tmpImag = (float *)calloc(Half, sizeof(float));
  RealOut = (float *)calloc(Half, sizeof(float));
  ImagOut = (float *)calloc(Half, sizeof(float));
  for (i = 0; i < Half; i++) {
    tmpReal[i] = In[2 * i];
    tmpImag[i] = In[2 * i + 1];
  }
  FFT(Half, 0, tmpReal, tmpImag, RealOut, ImagOut);
  wtemp = (float)sin(0.5 * theta);
  wpr = -2.0 * wtemp * wtemp;
  wpi = (float)sin(theta);
  wr = 1.0 + wpr;
  wi = wpi;
  for (i = 1; i < Half / 2; i++) {
    i3 = Half - i;
    h1r = 0.5 * (RealOut[i] + RealOut[i3]);
    h1i = 0.5 * (ImagOut[i] - ImagOut[i3]);
    h2r = 0.5 * (ImagOut[i] + ImagOut[i3]);
    h2i = -0.5 * (RealOut[i] - RealOut[i3]);
    rt = h1r + wr * h2r - wi * h2i;
    it = h1i + wr * h2i + wi * h2r;
    Out[i] = rt * rt + it * it;
    rt = h1r - wr * h2r + wi * h2i;
    it = -h1i + wr * h2i + wi * h2r;
    Out[i3] = rt * rt + it * it;
    wr = (wtemp = wr) * wpr - wi * wpi + wr;
    wi = wi * wpr + wtemp * wpi + wi;
  }
  rt = (h1r = RealOut[0]) + ImagOut[0];
  it = h1r - ImagOut[0];
  Out[0] = rt * rt + it * it;
  rt = RealOut[Half / 2];
  it = ImagOut[Half / 2];
  Out[Half / 2] = rt * rt + it * it;
  free(tmpReal);
  free(tmpImag);
  free(RealOut);
  free(ImagOut);
}
```