user: Translate the below assembly code into C programming language:

```asm
<linweights>:
  endbr64
  push   %r15
  pxor   %xmm2,%xmm2
  pxor   %xmm1,%xmm1
  pxor   %xmm0,%xmm0
  push   %r14
  cvtsi2ss %edi,%xmm1
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %r8,%rbp
  push   %rbx
  cvtss2sd %xmm1,%xmm0
  mov    %edi,%ebx
  sub    $0x18,%rsp
  cvtsi2ssl (%r8),%xmm2
  movss  %xmm1,0xc(%rsp)
  mov    %rcx,(%rsp)
  cvtss2sd %xmm2,%xmm2
  addsd  D27(%rip),%xmm2
  divsd  %xmm2,%xmm0
  cvtsd2ss %xmm0,%xmm0
  call   <roundf@plt>
  cvttss2si %xmm0,%r13d
  pxor   %xmm0,%xmm0
  cvtsi2ss %r13d,%xmm0
  mulss  D2(%rip),%xmm0
  call   <roundf@plt>
  pxor   %xmm2,%xmm2
  movss  0xc(%rsp),%xmm1
  lea    0x1(%r13),%eax
  cvttss2si %xmm0,%r14d
  movss  D33(%rip),%xmm3
  cvtsi2ss %r14d,%xmm2
  subss  %xmm2,%xmm1
  movss  D42(%rip),%xmm2
  movaps %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2ss %eax,%xmm1
  divss  %xmm1,%xmm0
  movaps %xmm0,%xmm1
  andps  %xmm2,%xmm1
  ucomiss %xmm1,%xmm3
  jbe    L14
  cvttss2si %xmm0,%eax
  pxor   %xmm1,%xmm1
  movaps %xmm0,%xmm3
  movss  D51(%rip),%xmm4
  andnps %xmm0,%xmm2
  cvtsi2ss %eax,%xmm1
  cmpnless %xmm1,%xmm3
  andps  %xmm4,%xmm3
  addss  %xmm3,%xmm1
  orps   %xmm2,%xmm1
  movaps %xmm1,%xmm0
L14:
  cvttss2si %xmm0,%r15d
  mov    %ebx,%esi
  mov    (%r12),%rdi
  imul   %r15d,%esi
  movslq %esi,%rsi
  shl    $0x2,%rsi
  call   <realloc@plt>
  lea    (%r15,%r15,1),%esi
  mov    %rax,(%r12)
  mov    (%rsp),%rax
  movslq %esi,%rsi
  shl    $0x2,%rsi
  mov    (%rax),%rdi
  call   <realloc@plt>
  mov    %rax,%r8
  mov    (%rsp),%rax
  mov    %r8,(%rax)
  mov    %r15d,0x0(%rbp)
  test   %r15d,%r15d
  jle    L24
  movss  D51(%rip),%xmm0
  xor    %edi,%edi
  xor    %esi,%esi
  xor    %ecx,%ecx
  lea    -0x1(%rbx),%r9d
  xchg   %ax,%ax
L34:
  test   %ebx,%ebx
  jle    L9
  mov    (%r12),%r10
  movslq %edi,%rdx
  lea    (%r10,%rdx,4),%rax
  add    %r9,%rdx
  lea    0x4(%r10,%rdx,4),%rdx
  nopw   0x0(%rax,%rax,1)
L6:
  movss  %xmm0,(%rax)
  add    $0x4,%rax
  cmp    %rax,%rdx
  jne    L6
L9:
  lea    (%r14,%rsi,1),%eax
  mov    %esi,(%r8,%rcx,8)
  add    %ebx,%edi
  add    %r13d,%esi
  mov    %eax,0x4(%r8,%rcx,8)
  mov    0x0(%rbp),%r15d
  add    $0x1,%rcx
  cmp    %ecx,%r15d
  jg     L34
L24:
  lea    -0x2(%r15,%r15,1),%eax
  lea    0x1(%rax),%edx
  movslq %edx,%rdx
  lea    (%r8,%rdx,4),%rdx
  cmp    %ebx,(%rdx)
  jle    L17
  sub    $0x1,%eax
  cltq
  mov    %ebx,(%r8,%rax,4)
  mov    0x0(%rbp),%eax
  lea    -0x2(%rax,%rax,1),%eax
  cltq
  movl   $0x0,(%r8,%rax,4)
  mov    0x0(%rbp),%eax
  lea    -0x2(%rax,%rax,1),%eax
  cltq
  movl   $0x0,0x4(%r8,%rax,4)
  subl   $0x1,0x0(%rbp)
L42:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L17:
  jge    L42
  mov    %ebx,(%rdx)
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D27
data_type: f64
name: retrieve_data
arguments: tag: D2
data_type: f32
name: retrieve_data
arguments: tag: D33
data_type: byte[4]
name: retrieve_data
arguments: tag: D42
data_type: byte[4]
name: retrieve_data
arguments: tag: D51
data_type: f32

tool: D27: 3.5

tool: D2: 2.5

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

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

tool: D51: 1

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