user: 请从给定的汇编指令推导出C源代码：

```asm
<build_grid>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %esi,-0x28(%rbp)
  mov    %rdx,-0x30(%rbp)
  mov    %ecx,-0x34(%rbp)
  mov    %r8d,-0x38(%rbp)
  mov    %r9d,-0x3c(%rbp)
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0x28(%rbp),%xmm1
  mov    -0x30(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm1,%xmm0
  mov    -0x30(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm1
  mov    -0x30(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm3
  movapd %xmm1,%xmm2
  subsd  %xmm3,%xmm2
  movsd  D45(%rip),%xmm1
  addsd  %xmm1,%xmm2
  movapd %xmm0,%xmm1
  divsd  %xmm2,%xmm1
  movsd  D45(%rip),%xmm0
  addsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movq   %rax,%xmm0
  call   <floor@plt>
  mov    %eax,-0x18(%rbp)
  cmpl   $0x0,-0x18(%rbp)
  jne    L96
  addl   $0x1,-0x18(%rbp)
L96:
  mov    -0x28(%rbp),%eax
  add    $0x1,%eax
  sub    -0x18(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  cmpl   $0x1,-0x14(%rbp)
  jg     L0
  movl   $0x2,-0x14(%rbp)
  jmp    L0
L44:
  shll   -0x38(%rbp)
L0:
  mov    -0x18(%rbp),%edx
  mov    -0x14(%rbp),%eax
  add    %edx,%eax
  sub    $0x1,%eax
  imul   -0x38(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x24(%rbp)
  jg     L44
  mov    -0x18(%rbp),%edx
  mov    -0x14(%rbp),%eax
  add    %edx,%eax
  sub    $0x1,%eax
  imul   -0x38(%rbp),%eax
  lea    0x2(%rax),%edx
  mov    0x28(%rbp),%rax
  mov    %edx,(%rax)
  mov    0x28(%rbp),%rax
  mov    (%rax),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    0x20(%rbp),%rdx
  mov    %rax,(%rdx)
  mov    0x28(%rbp),%rax
  mov    (%rax),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    0x30(%rbp),%rdx
  mov    %rax,(%rdx)
  mov    0x28(%rbp),%rax
  mov    (%rax),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    0x38(%rbp),%rdx
  mov    %rax,(%rdx)
  mov    -0x38(%rbp),%eax
  imul   -0x18(%rbp),%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movsd  D15(%rip),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L34
L10:
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0x10(%rbp),%xmm1
  mov    -0x30(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm1,%xmm0
  mov    0x20(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x10(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  mulsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  mov    0x30(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x10(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rdx
  mov    0x10(%rbp),%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,(%rdx)
  mov    0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x10(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rdx
  mov    0x18(%rbp),%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,(%rdx)
  addl   $0x1,-0x10(%rbp)
L34:
  mov    -0x18(%rbp),%eax
  imul   -0x38(%rbp),%eax
  cmp    %eax,-0x10(%rbp)
  jle    L10
  mov    -0x14(%rbp),%eax
  sub    $0x1,%eax
  imul   -0x38(%rbp),%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movsd  D15(%rip),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L56
L85:
  mov    -0x30(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm1
  pxor   %xmm2,%xmm2
  cvtsi2sdl -0xc(%rbp),%xmm2
  mov    -0x30(%rbp),%rax
  add    $0x18,%rax
  movsd  (%rax),%xmm0
  mov    -0x30(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm3
  subsd  %xmm3,%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  -0x8(%rbp),%xmm0
  mov    0x20(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%eax
  imul   -0x38(%rbp),%eax
  lea    0x1(%rax),%ecx
  mov    -0xc(%rbp),%eax
  add    %ecx,%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  mov    0x10(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    0x30(%rbp),%rax
  mov    (%rax),%rcx
  mov    -0x18(%rbp),%eax
  imul   -0x38(%rbp),%eax
  lea    0x1(%rax),%esi
  mov    -0xc(%rbp),%eax
  add    %esi,%eax
  cltq
  shl    $0x3,%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    0x18(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    0x38(%rbp),%rax
  mov    (%rax),%rcx
  mov    -0x18(%rbp),%eax
  imul   -0x38(%rbp),%eax
  lea    0x1(%rax),%esi
  mov    -0xc(%rbp),%eax
  add    %esi,%eax
  cltq
  shl    $0x3,%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0xc(%rbp)
L56:
  mov    -0x14(%rbp),%eax
  sub    $0x1,%eax
  imul   -0x38(%rbp),%eax
  cmp    %eax,-0xc(%rbp)
  jle    L85
  cmpl   $0x0,-0x3c(%rbp)
  jne    L69
  mov    0x20(%rbp),%rax
  mov    (%rax),%rdx
  mov    0x28(%rbp),%rax
  mov    (%rax),%eax
  cltq
  shl    $0x3,%rax
  sub    $0x8,%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  D45(%rip),%xmm1
  subsd  -0x8(%rbp),%xmm1
  comisd %xmm1,%xmm0
  ja     L91
  jmp    L69
L91:
  mov    0x28(%rbp),%rax
  mov    (%rax),%eax
  lea    -0x1(%rax),%edx
  mov    0x28(%rbp),%rax
  mov    %edx,(%rax)
L69:
  nop
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D45
type: f64
name: extract_symbolic_data
arguments: tag: D15
type: f64

tool: D45: 0.5

tool: D15: 1

assistant: ```c
void build_grid(int lgfiltre, int nfcns, const double *bands, int nbands, int lgrid, int nodd, const double *dev, const double *weight, double **FreqGrille, int *taillegrilledense, double **des, double **wt) {
  int np = floor(0.5 + (nfcns * bands[1]) / (0.5 + (bands[1] - bands[2])));
  if (np == 0)
    np++;
  int ns = nfcns + 1 - np;
  if (ns <= 1)
    ns = 2;
  while ((np + ns - 1) * lgrid + 2 <= lgfiltre)
    lgrid *= 2;
  *taillegrilledense = (np + ns - 1) * lgrid + 2;
  *FreqGrille = malloc(*taillegrilledense * sizeof(double));
  *des = malloc(*taillegrilledense * sizeof(double));
  *wt = malloc(*taillegrilledense * sizeof(double));
  double delf = 1.0 / (lgrid * np);
  for (int k = 0; k < np * lgrid + 1; k++) {
    (*FreqGrille)[k] = k * bands[1] * delf;
    (*des)[k] = dev[0];
    (*wt)[k] = weight[0];
  }
  delf = 1.0 / ((ns - 1) * lgrid);
  for (int k = 0; k < (ns - 1) * lgrid + 1; k++) {
    (*FreqGrille)[(np * lgrid) + 1 + k] = bands[2] + k * (bands[3] - bands[2]) * delf;
    (*des)[(np * lgrid) + 1 + k] = dev[1];
    (*wt)[(np * lgrid) + 1 + k] = weight[1];
  }
  if (nodd == 0 && (*FreqGrille)[*taillegrilledense - 1] > (0.5 - delf))
    (*taillegrilledense)--;
}
```