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

```asm
<linweights>:
  endbr64
  push   %r15
  pxor   %xmm2,%xmm2
  pxor   %xmm1,%xmm1
  pxor   %xmm0,%xmm0
  push   %r14
  cvtsi2ss %edi,%xmm1
  mov    %rcx,%r15
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %r8,%r12
  push   %rbp
  push   %rbx
  cvtss2sd %xmm1,%xmm0
  mov    %edi,%ebx
  sub    $0x18,%rsp
  cvtsi2ssl (%r8),%xmm2
  movss  %xmm1,0xc(%rsp)
  cvtss2sd %xmm2,%xmm2
  addsd  D61(%rip),%xmm2
  divsd  %xmm2,%xmm0
  cvtsd2ss %xmm0,%xmm0
  call   <roundf@plt>
  cvttss2si %xmm0,%r14d
  pxor   %xmm0,%xmm0
  cvtsi2ss %r14d,%xmm0
  mulss  D27(%rip),%xmm0
  call   <roundf@plt>
  pxor   %xmm2,%xmm2
  movss  0xc(%rsp),%xmm1
  lea    0x1(%r14),%eax
  cvttss2si %xmm0,%r8d
  movss  D25(%rip),%xmm3
  cvtsi2ss %r8d,%xmm2
  subss  %xmm2,%xmm1
  movss  D28(%rip),%xmm2
  movaps %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2ss %eax,%xmm1
  divss  %xmm1,%xmm0
  movaps %xmm0,%xmm1
  andps  %xmm2,%xmm1
  ucomiss %xmm1,%xmm3
  jbe    L23
  cvttss2si %xmm0,%eax
  pxor   %xmm1,%xmm1
  movaps %xmm0,%xmm3
  movss  D66(%rip),%xmm4
  andnps %xmm0,%xmm2
  cvtsi2ss %eax,%xmm1
  cmpnless %xmm1,%xmm3
  andps  %xmm4,%xmm3
  addss  %xmm3,%xmm1
  orps   %xmm2,%xmm1
  movaps %xmm1,%xmm0
L23:
  cvttss2si %xmm0,%ebp
  mov    %ebx,%esi
  mov    0x0(%r13),%rdi
  mov    %r8d,0xc(%rsp)
  imul   %ebp,%esi
  movslq %esi,%rsi
  shl    $0x2,%rsi
  call   <realloc@plt>
  lea    0x0(%rbp,%rbp,1),%esi
  mov    (%r15),%rdi
  mov    %rax,0x0(%r13)
  movslq %esi,%rsi
  shl    $0x2,%rsi
  call   <realloc@plt>
  mov    %rax,(%r15)
  mov    %rax,%rdi
  mov    %ebp,(%r12)
  test   %ebp,%ebp
  jle    L45
  mov    %ebx,%eax
  mov    %ebx,%r9d
  movss  D66(%rip),%xmm2
  xor    %edx,%edx
  shr    $0x2,%eax
  movaps D66(%rip),%xmm0
  lea    -0x1(%rbx),%r11d
  xor    %esi,%esi
  lea    -0x1(%rax),%r10d
  mov    0xc(%rsp),%r8d
  and    $0xfffffffc,%r9d
  xor    %ecx,%ecx
  add    $0x1,%r10
  shl    $0x4,%r10
  nop
L14:
  test   %ebx,%ebx
  jle    L58
  mov    0x0(%r13),%rbp
  cmp    $0x2,%r11d
  jbe    L30
  movslq %edx,%rax
  lea    0x0(%rbp,%rax,4),%rax
  lea    (%r10,%rax,1),%r15
  xchg   %ax,%ax
L27:
  movups %xmm0,(%rax)
  add    $0x10,%rax
  cmp    %rax,%r15
  jne    L27
  mov    %r9d,%eax
  cmp    %r9d,%ebx
  je     L58
L35:
  lea    (%rdx,%rax,1),%r15d
  movslq %r15d,%r15
  movss  %xmm2,0x0(%rbp,%r15,4)
  lea    0x1(%rax),%r15d
  cmp    %r15d,%ebx
  jle    L58
  add    %edx,%r15d
  add    $0x2,%eax
  movslq %r15d,%r15
  movss  %xmm2,0x0(%rbp,%r15,4)
  cmp    %ebx,%eax
  jge    L58
  add    %edx,%eax
  cltq
  movss  %xmm2,0x0(%rbp,%rax,4)
L58:
  lea    (%r8,%rsi,1),%eax
  movd   %esi,%xmm1
  add    %ebx,%edx
  add    %r14d,%esi
  movd   %eax,%xmm5
  punpckldq %xmm5,%xmm1
  movq   %xmm1,(%rdi,%rcx,8)
  mov    (%r12),%ebp
  add    $0x1,%rcx
  cmp    %ecx,%ebp
  jg     L14
L45:
  lea    -0x2(%rbp,%rbp,1),%eax
  lea    0x1(%rax),%edx
  movslq %edx,%rdx
  lea    (%rdi,%rdx,4),%rdx
  cmp    %ebx,(%rdx)
  jle    L29
  sub    $0x1,%eax
  cltq
  mov    %ebx,(%rdi,%rax,4)
  mov    (%r12),%eax
  lea    -0x2(%rax,%rax,1),%eax
  cltq
  movl   $0x0,(%rdi,%rax,4)
  mov    (%r12),%eax
  lea    -0x2(%rax,%rax,1),%eax
  cltq
  movl   $0x0,0x4(%rdi,%rax,4)
  subl   $0x1,(%r12)
L62:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L30:
  xor    %eax,%eax
  jmp    L35
L29:
  jge    L62
  mov    %ebx,(%rdx)
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: read_data
arguments: data_tag: D61
type_guessed: f64
name: read_data
arguments: data_tag: D27
type_guessed: f32
name: read_data
arguments: data_tag: D25
type_guessed: byte[4]
name: read_data
arguments: data_tag: D28
type_guessed: byte[4]
name: read_data
arguments: data_tag: D66
type_guessed: f32[4]

tool: D61: 3.5

tool: D27: 2.5

tool: {"D25": [0x00,0x00,0x00,0x4b]}

tool: {"D28": [0xff,0xff,0xff,0x7f]}

tool: {"D66": [1.0,1.0,1.0,1.0]}

assistant: ```c
void linweights(int nfreqs, int Fs, float dB, float **wts, int **indices, int *nbands) {
  int whop = (int)roundf((float)nfreqs / ((float)(*nbands) + 3.5));
  int wlen = (int)roundf(2.5 * (float)whop);
  int reqbands = ceil(((float)nfreqs - wlen) / (whop + 1));
  *wts = (float *)realloc(*wts, reqbands * nfreqs * sizeof(float));
  *indices = (int *)realloc(*indices, reqbands * 2 * sizeof(int));
  *nbands = reqbands;
  for (int i = 0; i < *nbands; i++) {
    for (int j = 0; j < nfreqs; j++) {
      (*wts)[i * nfreqs + j] = 1.;
    }
    (*indices)[i * 2] = i * whop;
    (*indices)[i * 2 + 1] = i * whop + wlen;
  }
  if ((*indices)[(*nbands - 1) * 2 + 1] > nfreqs) {
    (*indices)[(*nbands - 2) * 2 + 1] = nfreqs;
    (*indices)[(*nbands - 1) * 2] = 0;
    (*indices)[(*nbands - 1) * 2 + 1] = 0;
    *nbands = *nbands - 1;
  } else if ((*indices)[(*nbands - 1) * 2 + 1] < nfreqs) {
    (*indices)[(*nbands - 1) * 2 + 1] = nfreqs;
  }
}
```