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

```asm
<spectral_envelope>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %edi,-0x44(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %edx,-0x48(%rbp)
  mov    %rcx,-0x58(%rbp)
  mov    -0x44(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x30(%rbp)
  mov    -0x44(%rbp),%eax
  lea    (%rax,%rax,1),%edx
  mov    -0x48(%rbp),%ecx
  mov    -0x30(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <bin_to_freq@plt>
  movd   %xmm0,%eax
  mov    %eax,-0x2c(%rbp)
  mov    -0x44(%rbp),%eax
  lea    (%rax,%rax,1),%edx
  mov    -0x48(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    D133(%rip),%eax
  movd   %eax,%xmm0
  call   <freq_to_bin@plt>
  mov    %eax,-0x28(%rbp)
  movl   $0x0,-0x40(%rbp)
  jmp    L97
L90:
  mov    -0x44(%rbp),%eax
  lea    (%rax,%rax,1),%edx
  mov    -0x48(%rbp),%ecx
  mov    -0x40(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <bin_to_freq@plt>
  movd   %xmm0,%eax
  mov    %eax,-0x24(%rbp)
  pxor   %xmm1,%xmm1
  cvtss2sd -0x24(%rbp),%xmm1
  pxor   %xmm2,%xmm2
  cvtss2sd -0x24(%rbp),%xmm2
  movsd  D91(%rip),%xmm0
  mulsd  %xmm0,%xmm2
  movsd  D136(%rip),%xmm0
  comisd %xmm2,%xmm0
  jbe    L13
  movsd  D136(%rip),%xmm0
  jmp    L30
L13:
  pxor   %xmm2,%xmm2
  cvtss2sd -0x24(%rbp),%xmm2
  movsd  D91(%rip),%xmm0
  mulsd  %xmm2,%xmm0
L30:
  subsd  %xmm0,%xmm1
  pxor   %xmm0,%xmm0
  cvtsd2ss %xmm1,%xmm0
  movss  %xmm0,-0x20(%rbp)
  pxor   %xmm1,%xmm1
  cvtss2sd -0x24(%rbp),%xmm1
  pxor   %xmm2,%xmm2
  cvtss2sd -0x24(%rbp),%xmm2
  movsd  D12(%rip),%xmm0
  mulsd  %xmm0,%xmm2
  movsd  D136(%rip),%xmm0
  comisd %xmm2,%xmm0
  jbe    L93
  movsd  D136(%rip),%xmm0
  jmp    L22
L93:
  pxor   %xmm2,%xmm2
  cvtss2sd -0x24(%rbp),%xmm2
  movsd  D12(%rip),%xmm0
  mulsd  %xmm2,%xmm0
L22:
  addsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0x1c(%rbp)
  movss  -0x20(%rbp),%xmm0
  divss  -0x2c(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  cvtss2sd %xmm0,%xmm1
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x30(%rbp),%xmm0
  movsd  D5(%rip),%xmm2
  subsd  %xmm2,%xmm0
  mulsd  %xmm0,%xmm1
  movsd  D121(%rip),%xmm0
  addsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,-0x18(%rbp)
  movss  -0x1c(%rbp),%xmm0
  divss  -0x2c(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  cvtss2sd %xmm0,%xmm1
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x30(%rbp),%xmm0
  movsd  D5(%rip),%xmm2
  subsd  %xmm2,%xmm0
  mulsd  %xmm0,%xmm1
  movsd  D121(%rip),%xmm0
  addsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x18(%rbp),%eax
  mov    $0x0,%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x30(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jg     L66
  mov    -0x30(%rbp),%eax
  sub    $0x1,%eax
  jmp    L7
L66:
  mov    -0x18(%rbp),%eax
L7:
  mov    %eax,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0x14(%rbp),%eax
  cmp    %edx,%eax
  cmovl  %edx,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%edx
  mov    -0x30(%rbp),%eax
  cmp    %eax,%edx
  cmovle %edx,%eax
  mov    %eax,-0x14(%rbp)
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x18(%rbp),%xmm0
  movsd  D112(%rip),%xmm2
  movapd %xmm0,%xmm1
  divsd  %xmm2,%xmm1
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x14(%rbp),%xmm0
  movsd  D112(%rip),%xmm2
  divsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0x10(%rbp)
  pxor   %xmm0,%xmm0
  cvtsi2ssl -0x14(%rbp),%xmm0
  subss  -0x10(%rbp),%xmm0
  movss  %xmm0,-0xc(%rbp)
  pxor   %xmm0,%xmm0
  movss  %xmm0,-0x3c(%rbp)
  pxor   %xmm0,%xmm0
  movss  %xmm0,-0x38(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x34(%rbp)
  jmp    L63
L12:
  pxor   %xmm0,%xmm0
  cvtsi2ssl -0x34(%rbp),%xmm0
  subss  -0x10(%rbp),%xmm0
  movd   %xmm0,%eax
  movd   %eax,%xmm0
  call   <fabs@plt>
  movd   %xmm0,%eax
  movd   %eax,%xmm0
  divss  -0xc(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  cvtss2sd %xmm0,%xmm1
  movsd  D5(%rip),%xmm0
  subsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0x8(%rbp)
  movss  -0x8(%rbp),%xmm0
  mulss  %xmm0,%xmm0
  movss  %xmm0,-0x8(%rbp)
  movss  -0x8(%rbp),%xmm0
  mulss  %xmm0,%xmm0
  movss  %xmm0,-0x8(%rbp)
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  movss  %xmm0,-0x4(%rbp)
  movss  -0x8(%rbp),%xmm0
  mulss  -0x4(%rbp),%xmm0
  movss  %xmm0,-0x8(%rbp)
  movss  -0x4(%rbp),%xmm0
  mulss  -0x8(%rbp),%xmm0
  movss  -0x38(%rbp),%xmm1
  addss  %xmm1,%xmm0
  movss  %xmm0,-0x38(%rbp)
  movss  -0x3c(%rbp),%xmm0
  addss  -0x8(%rbp),%xmm0
  movss  %xmm0,-0x3c(%rbp)
  addl   $0x1,-0x34(%rbp)
L63:
  mov    -0x34(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L12
  pxor   %xmm0,%xmm0
  ucomiss -0x3c(%rbp),%xmm0
  jp     L62
  pxor   %xmm0,%xmm0
  ucomiss -0x3c(%rbp),%xmm0
  je     L87
L62:
  movss  -0x38(%rbp),%xmm0
  divss  -0x3c(%rbp),%xmm0
  movss  %xmm0,-0x38(%rbp)
L87:
  mov    -0x40(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movss  -0x38(%rbp),%xmm0
  movss  %xmm0,(%rax)
  mov    -0x28(%rbp),%eax
  add    %eax,-0x40(%rbp)
L97:
  mov    -0x40(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jle    L90
  nop
  nop
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D133
data_type: byte[4]
name: unpack_data
arguments: data_tag: D91
data_type: f64
name: unpack_data
arguments: data_tag: D136
data_type: f64
name: unpack_data
arguments: data_tag: D12
data_type: f64
name: unpack_data
arguments: data_tag: D5
data_type: f64
name: unpack_data
arguments: data_tag: D121
data_type: f64
name: unpack_data
arguments: data_tag: D112
data_type: f64

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

tool: D91: 0.34

tool: D136: 50

tool: D12: 0.58

tool: D5: 1

tool: D121: 0.5

tool: D112: 2

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;
  }
}
```