user: 请将以下的汇编代码转换成C语言代码:

```asm
<spectral_envelope>:
  endbr64
  push   %r15
  lea    (%rdi,%rdi,1),%r15d
  push   %r14
  mov    %rcx,%r14
  push   %r13
  lea    0x1(%rdi),%r13d
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  mov    %rsi,%rbp
  mov    %r12d,%esi
  push   %rbx
  mov    %edi,%ebx
  sub    $0x48,%rsp
  mov    %edi,0x1c(%rsp)
  mov    %r13d,%edi
  mov    %edx,0x2c(%rsp)
  mov    %r15d,%edx
  mov    %r15d,0x20(%rsp)
  call   <bin_to_freq@plt>
  mov    %r15d,%esi
  mov    %r12d,%edi
  movss  %xmm0,0x24(%rsp)
  movss  D86(%rip),%xmm0
  call   <freq_to_bin@plt>
  mov    %eax,0x28(%rsp)
  test   %ebx,%ebx
  js     L38
  pxor   %xmm7,%xmm7
  cltq
  xor    %r12d,%r12d
  cvtsi2sd %r13d,%xmm7
  shl    $0x2,%rax
  mov    %rax,0x30(%rsp)
  movsd  %xmm7,0x38(%rsp)
  nopw   0x0(%rax,%rax,1)
L72:
  mov    0x20(%rsp),%edx
  mov    0x2c(%rsp),%esi
  mov    %r12d,%edi
  call   <bin_to_freq@plt>
  movsd  D41(%rip),%xmm2
  xor    %edx,%edx
  movsd  D27(%rip),%xmm6
  cvtss2sd %xmm0,%xmm0
  movsd  D23(%rip),%xmm3
  movapd %xmm0,%xmm1
  movsd  D27(%rip),%xmm7
  mulsd  %xmm0,%xmm2
  mulsd  %xmm0,%xmm3
  maxsd  %xmm2,%xmm6
  movsd  0x38(%rsp),%xmm2
  subsd  D34(%rip),%xmm2
  maxsd  %xmm3,%xmm7
  subsd  %xmm6,%xmm1
  movss  0x24(%rsp),%xmm6
  addsd  %xmm7,%xmm0
  cvtsd2ss %xmm1,%xmm1
  divss  %xmm6,%xmm1
  cvtsd2ss %xmm0,%xmm0
  divss  %xmm6,%xmm0
  cvtss2sd %xmm1,%xmm1
  mulsd  %xmm2,%xmm1
  addsd  D54(%rip),%xmm1
  cvttsd2si %xmm1,%eax
  test   %eax,%eax
  cmovs  %edx,%eax
  lea    0x1(%rax),%edx
  cvtss2sd %xmm0,%xmm0
  mulsd  %xmm2,%xmm0
  addsd  D54(%rip),%xmm0
  cvttsd2si %xmm0,%ebx
  cmp    %eax,%r13d
  jg     L61
  mov    0x1c(%rsp),%eax
  mov    %r13d,%edx
L61:
  pxor   %xmm0,%xmm0
  pxor   %xmm1,%xmm1
  pxor   %xmm7,%xmm7
  cmp    %edx,%ebx
  cmovl  %edx,%ebx
  cvtsi2sd %eax,%xmm0
  mulsd  D54(%rip),%xmm0
  cmp    %ebx,%r13d
  cmovle %r13d,%ebx
  cvtsi2sd %ebx,%xmm1
  mulsd  D54(%rip),%xmm1
  addsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm7
  pxor   %xmm0,%xmm0
  movss  %xmm7,0x14(%rsp)
  cvtsi2ss %ebx,%xmm0
  subss  %xmm7,%xmm0
  movss  %xmm0,0x18(%rsp)
  cmp    %ebx,%eax
  jge    L13
  pxor   %xmm2,%xmm2
  movslq %eax,%r15
  movaps %xmm2,%xmm3
  nopl   0x0(%rax)
L52:
  pxor   %xmm0,%xmm0
  movss  %xmm3,0x10(%rsp)
  cvtsi2ss %r15d,%xmm0
  subss  0x14(%rsp),%xmm0
  movss  %xmm2,0xc(%rsp)
  call   <fabs@plt>
  movss  0xc(%rsp),%xmm2
  movss  0x10(%rsp),%xmm3
  movaps %xmm0,%xmm1
  movss  D69(%rip),%xmm0
  divss  0x18(%rsp),%xmm1
  subss  %xmm1,%xmm0
  movss  0x0(%rbp,%r15,4),%xmm1
  add    $0x1,%r15
  mulss  %xmm0,%xmm0
  mulss  %xmm0,%xmm0
  mulss  %xmm1,%xmm0
  mulss  %xmm0,%xmm1
  addss  %xmm0,%xmm3
  addss  %xmm1,%xmm2
  cmp    %r15d,%ebx
  jg     L52
  pxor   %xmm6,%xmm6
  ucomiss %xmm6,%xmm3
  jp     L71
  je     L78
L71:
  divss  %xmm3,%xmm2
L78:
  movss  %xmm2,(%r14)
  add    0x28(%rsp),%r12d
  add    0x30(%rsp),%r14
  cmp    %r12d,0x1c(%rsp)
  jge    L72
L38:
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L13:
  pxor   %xmm2,%xmm2
  jmp    L78
```

tool_calls: name: parse_data
arguments: data_label: D86
type: byte[4]
name: parse_data
arguments: data_label: D41
type: f64
name: parse_data
arguments: data_label: D27
type: f64
name: parse_data
arguments: data_label: D23
type: f64
name: parse_data
arguments: data_label: D34
type: f64
name: parse_data
arguments: data_label: D54
type: f64
name: parse_data
arguments: data_label: D69
type: byte[4]

tool: {"D86": [0x00,0x00,0xc8,0x42]}

tool: D41: 0.34

tool: D27: 50

tool: D23: 0.58

tool: D34: 1

tool: D54: 0.5

tool: {"D69": [0x00,0x00,0x80,0x3f]}

assistant: ```c
void spectral_envelope(int fft_size_2, float *fft_p2, int samp_rate, float *spectral_envelope_values) {
  int k;
  int spec_size = fft_size_2 + 1;
  float spectral_range = bin_to_freq(spec_size, samp_rate, fft_size_2 * 2);
  int hop = (int)freq_to_bin(100.f, samp_rate, fft_size_2 * 2);
  for (k = 0; k <= fft_size_2; k += hop) {
    float freq = bin_to_freq(k, samp_rate, fft_size_2 * 2);
    float bf = freq - (((50.0) > (freq * 0.34)) ? (50.0) : (freq * 0.34));
    float ef = freq + (((50.0) > (freq * 0.58)) ? (50.0) : (freq * 0.58));
    int b = (int)(bf / spectral_range * (spec_size - 1.0) + 0.5);
    int e = (int)(ef / spectral_range * (spec_size - 1.0) + 0.5);
    b = (((b) > (0)) ? (b) : (0));
    b = (((spec_size - 1) < (b)) ? (spec_size - 1) : (b));
    e = (((e) > (b + 1)) ? (e) : (b + 1));
    e = (((spec_size) < (e)) ? (spec_size) : (e));
    float c = b / 2.0 + e / 2.0;
    float half_window_length = e - c;
    float n = 0.0;
    float wavg = 0.0;
    for (int i = b; i < e; ++i) {
      float weight = 1.0 - fabs((float)(i)-c) / half_window_length;
      weight *= weight;
      weight *= weight;
      float spectrum_energy_val = fft_p2[i];
      weight *= spectrum_energy_val;
      wavg += spectrum_energy_val * weight;
      n += weight;
    }
    if (n != 0.0)
      wavg /= n;
    spectral_envelope_values[k] = wavg;
  }
}
```