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

```asm
<iCBConstruct>:
  endbr64
  push   %r15
  mov    %rdx,%r15
  push   %r14
  mov    %r8d,%r14d
  push   %r13
  mov    %rcx,%r13
  push   %r12
  mov    %rsi,%r12
  mov    $0x20,%esi
  push   %rbp
  mov    %r9d,%ebp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0xe8,%rsp
  movsd  D9(%rip),%xmm0
  mov    (%rdx),%edi
  mov    %fs:0x28,%rax
  mov    %rax,0xd8(%rsp)
  xor    %eax,%eax
  call   <gaindequant@plt>
  cmpl   $0x1,0x120(%rsp)
  movaps %xmm0,%xmm1
  jg     L199
L140:
  mov    (%r12),%edx
  lea    0x30(%rsp),%rdi
  mov    %ebp,%r8d
  mov    %r14d,%ecx
  mov    %r13,%rsi
  mov    %rdi,(%rsp)
  movss  %xmm1,0x8(%rsp)
  call   <getCBvec@plt>
  test   %ebp,%ebp
  mov    (%rsp),%rdi
  movss  0x8(%rsp),%xmm1
  jle    L237
L298:
  lea    -0x1(%rbp),%eax
  cmp    $0x2,%eax
  jbe    L367
  movaps 0x30(%rsp),%xmm2
  movaps %xmm1,%xmm0
  mov    %ebp,%eax
  shufps $0x0,%xmm0,%xmm0
  shr    $0x2,%eax
  mulps  %xmm0,%xmm2
  movups %xmm2,(%rbx)
  cmp    $0x1,%eax
  je     L291
  movaps 0x40(%rsp),%xmm2
  mulps  %xmm0,%xmm2
  movups %xmm2,0x10(%rbx)
  cmp    $0x2,%eax
  je     L291
  movaps 0x50(%rsp),%xmm2
  mulps  %xmm0,%xmm2
  movups %xmm2,0x20(%rbx)
  cmp    $0x3,%eax
  je     L291
  movaps 0x60(%rsp),%xmm2
  mulps  %xmm0,%xmm2
  movups %xmm2,0x30(%rbx)
  cmp    $0x4,%eax
  je     L291
  movaps 0x70(%rsp),%xmm2
  mulps  %xmm0,%xmm2
  movups %xmm2,0x40(%rbx)
  cmp    $0x5,%eax
  je     L291
  movaps 0x80(%rsp),%xmm2
  mulps  %xmm0,%xmm2
  movups %xmm2,0x50(%rbx)
  cmp    $0x6,%eax
  je     L291
  movaps 0x90(%rsp),%xmm2
  mulps  %xmm0,%xmm2
  movups %xmm2,0x60(%rbx)
  cmp    $0x7,%eax
  je     L291
  movaps 0xa0(%rsp),%xmm2
  mulps  %xmm0,%xmm2
  movups %xmm2,0x70(%rbx)
  cmp    $0x8,%eax
  je     L291
  movaps 0xb0(%rsp),%xmm2
  mulps  %xmm0,%xmm2
  movups %xmm2,0x80(%rbx)
  cmp    $0x9,%eax
  je     L291
  mulps  0xc0(%rsp),%xmm0
  movups %xmm0,0x90(%rbx)
  nopl   0x0(%rax)
L291:
  mov    %ebp,%edx
  and    $0xfffffffc,%edx
  mov    %edx,%eax
  cmp    %edx,%ebp
  je     L237
L346:
  mov    %ebp,%ecx
  sub    %edx,%ecx
  cmp    $0x1,%ecx
  je     L325
  movq   0x30(%rsp,%rdx,4),%xmm2
  movaps %xmm1,%xmm0
  shufps $0xe0,%xmm0,%xmm0
  mulps  %xmm2,%xmm0
  movlps %xmm0,(%rbx,%rdx,4)
  mov    %ecx,%edx
  and    $0xfffffffe,%edx
  add    %edx,%eax
  cmp    %edx,%ecx
  je     L237
L325:
  cltq
  mulss  0x30(%rsp,%rax,4),%xmm1
  movss  %xmm1,(%rbx,%rax,4)
L237:
  cmpl   $0x1,0x120(%rsp)
  jle    L329
L201:
  mov    0x120(%rsp),%eax
  mov    %ebp,%r11d
  mov    %ebp,%r9d
  mov    %r13,%rsi
  shr    $0x2,%r11d
  and    $0xfffffffc,%r9d
  mov    %r14d,%ecx
  mov    $0x1,%r15d
  mov    %rax,0x10(%rsp)
  lea    -0x1(%rbp),%eax
  mov    %r12,%r14
  mov    %r9d,%r13d
  mov    %eax,0x1c(%rsp)
  mov    %ebp,%r12d
  mov    %r11d,%ebp
L72:
  mov    (%r14,%r15,4),%edx
  mov    %r12d,%r8d
  mov    %ecx,0x18(%rsp)
  mov    %rsi,0x8(%rsp)
  mov    %rdi,(%rsp)
  call   <getCBvec@plt>
  test   %r12d,%r12d
  mov    (%rsp),%rdi
  mov    0x18(%rsp),%ecx
  mov    0x8(%rsp),%rsi
  jle    L94
  cmpl   $0x2,0x1c(%rsp)
  movss  0x24(%rsp,%r15,4),%xmm0
  jbe    L27
  movaps 0x30(%rsp),%xmm2
  movaps %xmm0,%xmm1
  movups (%rbx),%xmm3
  shufps $0x0,%xmm1,%xmm1
  mulps  %xmm1,%xmm2
  addps  %xmm3,%xmm2
  movups %xmm2,(%rbx)
  cmp    $0x1,%ebp
  jbe    L349
  movaps 0x40(%rsp),%xmm2
  movups 0x10(%rbx),%xmm4
  mulps  %xmm1,%xmm2
  addps  %xmm4,%xmm2
  movups %xmm2,0x10(%rbx)
  cmp    $0x2,%ebp
  je     L349
  movaps 0x50(%rsp),%xmm2
  movups 0x20(%rbx),%xmm5
  mulps  %xmm1,%xmm2
  addps  %xmm5,%xmm2
  movups %xmm2,0x20(%rbx)
  cmp    $0x3,%ebp
  je     L349
  movaps 0x60(%rsp),%xmm2
  movups 0x30(%rbx),%xmm6
  mulps  %xmm1,%xmm2
  addps  %xmm6,%xmm2
  movups %xmm2,0x30(%rbx)
  cmp    $0x4,%ebp
  je     L349
  movaps 0x70(%rsp),%xmm2
  movups 0x40(%rbx),%xmm7
  mulps  %xmm1,%xmm2
  addps  %xmm7,%xmm2
  movups %xmm2,0x40(%rbx)
  cmp    $0x5,%ebp
  je     L349
  movaps 0x80(%rsp),%xmm2
  movups 0x50(%rbx),%xmm7
  mulps  %xmm1,%xmm2
  addps  %xmm7,%xmm2
  movups %xmm2,0x50(%rbx)
  cmp    $0x6,%ebp
  je     L349
  movaps 0x90(%rsp),%xmm2
  movups 0x60(%rbx),%xmm6
  mulps  %xmm1,%xmm2
  addps  %xmm6,%xmm2
  movups %xmm2,0x60(%rbx)
  cmp    $0x7,%ebp
  je     L349
  movaps 0xa0(%rsp),%xmm2
  movups 0x70(%rbx),%xmm5
  mulps  %xmm1,%xmm2
  addps  %xmm5,%xmm2
  movups %xmm2,0x70(%rbx)
  cmp    $0x8,%ebp
  je     L349
  movaps 0xb0(%rsp),%xmm2
  movups 0x80(%rbx),%xmm4
  mulps  %xmm1,%xmm2
  addps  %xmm4,%xmm2
  movups %xmm2,0x80(%rbx)
  cmp    $0x9,%ebp
  je     L349
  mulps  0xc0(%rsp),%xmm1
  movups 0x90(%rbx),%xmm7
  addps  %xmm7,%xmm1
  movups %xmm1,0x90(%rbx)
  nopl   0x0(%rax)
L349:
  cmp    %r12d,%r13d
  je     L94
  mov    %r13d,%edx
  mov    %r13d,%eax
L299:
  mov    %r12d,%r8d
  sub    %edx,%r8d
  cmp    $0x1,%r8d
  je     L130
  shl    $0x2,%rdx
  movaps %xmm0,%xmm1
  movq   0x30(%rsp,%rdx,1),%xmm2
  shufps $0xe0,%xmm1,%xmm1
  lea    (%rbx,%rdx,1),%r10
  mov    %r8d,%edx
  and    $0xfffffffe,%edx
  mulps  %xmm2,%xmm1
  movq   (%r10),%xmm2
  add    %edx,%eax
  addps  %xmm2,%xmm1
  movlps %xmm1,(%r10)
  cmp    %edx,%r8d
  je     L94
L130:
  cltq
  lea    (%rbx,%rax,4),%rdx
  mulss  0x30(%rsp,%rax,4),%xmm0
  addss  (%rdx),%xmm0
  movss  %xmm0,(%rdx)
L94:
  add    $0x1,%r15
  cmp    0x10(%rsp),%r15
  jne    L72
L329:
  mov    0xd8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L125
  add    $0xe8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L199:
  movss  %xmm0,(%rsp)
  call   <fabsf@plt>
  mov    0x4(%r15),%edi
  mov    $0x10,%esi
  call   <gaindequant@plt>
  cmpl   $0x2,0x120(%rsp)
  movss  (%rsp),%xmm1
  movss  %xmm0,0x28(%rsp)
  je     L140
  movss  %xmm1,0x8(%rsp)
  call   <fabsf@plt>
  mov    0x8(%r15),%edi
  mov    $0x8,%esi
  call   <gaindequant@plt>
  mov    (%r12),%edx
  mov    %ebp,%r8d
  mov    %r14d,%ecx
  lea    0x30(%rsp),%rdi
  mov    %r13,%rsi
  movss  %xmm0,0x2c(%rsp)
  mov    %rdi,(%rsp)
  call   <getCBvec@plt>
  test   %ebp,%ebp
  mov    (%rsp),%rdi
  movss  0x8(%rsp),%xmm1
  jg     L298
  jmp    L201
L27:
  xor    %edx,%edx
  xor    %eax,%eax
  jmp    L299
L367:
  xor    %edx,%edx
  xor    %eax,%eax
  jmp    L346
L125:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D9
type: f64

tool: D9: 1

assistant: ```c
void iCBConstruct(float *decvector, int *index, int *gain_index, float *mem, int lMem, int veclen, int nStages) {
  int j;
  int k;
  float gain[3];
  float cbvec[40];
  gain[0] = gaindequant(gain_index[0], 1.0, 32);
  if (nStages > 1)
    gain[1] = gaindequant(gain_index[1], fabsf(gain[0]), 16);
  if (nStages > 2)
    gain[2] = gaindequant(gain_index[2], fabsf(gain[1]), 8);
  getCBvec(cbvec, mem, index[0], lMem, veclen);
  for (j = 0; j < veclen; j++)
    decvector[j] = gain[0] * cbvec[j];
  if (nStages > 1) {
    for (k = 1; k < nStages; k++) {
      getCBvec(cbvec, mem, index[k], lMem, veclen);
      for (j = 0; j < veclen; j++)
        decvector[j] += gain[k] * cbvec[j];
    }
  }
}
```