user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<gen_signal_double>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  movsd  %xmm0,-0x20(%rbp)
  mov    %esi,-0x24(%rbp)
  mov    %edx,-0x28(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movl   $0x3e8,-0xc(%rbp)
  cmpl   $0x1,-0x24(%rbp)
  jne    L64
  movl   $0x0,-0x10(%rbp)
  jmp    L7
L92:
  mov    -0x10(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  jg     L41
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x10(%rbp),%xmm0
  mulsd  -0x20(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0xc(%rbp),%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  jmp    L62
L41:
  mov    -0x28(%rbp),%eax
  sub    -0xc(%rbp),%eax
  cmp    %eax,-0x10(%rbp)
  jle    L62
  mov    -0x28(%rbp),%eax
  sub    -0x10(%rbp),%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mulsd  -0x20(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0xc(%rbp),%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
L62:
  mov    -0x10(%rbp),%eax
  add    $0x1,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movsd  D107(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  D88(%rip),%xmm1
  divsd  %xmm1,%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  call   <sin@plt>
  movsd  D38(%rip),%xmm1
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x30(%rbp)
  mov    -0x10(%rbp),%eax
  add    $0x1,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movsd  D139(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  D88(%rip),%xmm1
  movapd %xmm0,%xmm3
  divsd  %xmm1,%xmm3
  movq   %xmm3,%rax
  movq   %rax,%xmm0
  call   <cos@plt>
  movsd  D166(%rip),%xmm1
  mulsd  %xmm1,%xmm0
  addsd  -0x30(%rbp),%xmm0
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mulsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x10(%rbp)
L7:
  mov    -0x10(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  jl     L92
  jmp    L2
L64:
  movl   $0x0,-0x10(%rbp)
  jmp    L47
L89:
  mov    -0x10(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  jg     L110
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x10(%rbp),%xmm0
  mulsd  -0x20(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0xc(%rbp),%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  jmp    L74
L110:
  mov    -0x28(%rbp),%eax
  sub    -0xc(%rbp),%eax
  cmp    %eax,-0x10(%rbp)
  jle    L74
  mov    -0x28(%rbp),%eax
  sub    -0x10(%rbp),%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mulsd  -0x20(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0xc(%rbp),%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
L74:
  mov    -0x10(%rbp),%eax
  add    $0x1,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movsd  D107(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  D88(%rip),%xmm1
  divsd  %xmm1,%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  call   <sin@plt>
  movsd  D38(%rip),%xmm1
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x30(%rbp)
  mov    -0x10(%rbp),%eax
  add    $0x1,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movsd  D139(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  D88(%rip),%xmm1
  movapd %xmm0,%xmm5
  divsd  %xmm1,%xmm5
  movq   %xmm5,%rax
  movq   %rax,%xmm0
  call   <cos@plt>
  movsd  D166(%rip),%xmm1
  mulsd  %xmm1,%xmm0
  addsd  -0x30(%rbp),%xmm0
  mov    -0x10(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mulsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x10(%rbp),%eax
  add    $0x1,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movsd  D80(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  D88(%rip),%xmm1
  divsd  %xmm1,%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  call   <sin@plt>
  movsd  D38(%rip),%xmm1
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x30(%rbp)
  mov    -0x10(%rbp),%eax
  add    $0x1,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movsd  D139(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  D88(%rip),%xmm1
  movapd %xmm0,%xmm7
  divsd  %xmm1,%xmm7
  movq   %xmm7,%rax
  movq   %rax,%xmm0
  call   <cos@plt>
  movsd  D166(%rip),%xmm1
  mulsd  %xmm1,%xmm0
  addsd  -0x30(%rbp),%xmm0
  mov    -0x10(%rbp),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mulsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x10(%rbp)
L47:
  mov    -0x10(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  jl     L89
  nop
L2:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: label: D107
type: byte[8]
name: unpack_data
arguments: label: D88
type: f32[2]
name: unpack_data
arguments: label: D38
type: f64
name: unpack_data
arguments: label: D139
type: byte[8]
name: unpack_data
arguments: label: D166
type: f64
name: unpack_data
arguments: label: D80
type: byte[8]

tool: {"D107": [0x53,0x25,0x4a,0xbd,0x5c,0x27,0x6a,0x40]}

tool: {"D88": [0.0,6.17291259765625]}

tool: D38: 0.4

tool: {"D139": [0x06,0x5b,0x18,0xbb,0x31,0xbe,0x93,0x40]}

tool: D166: 0.3

tool: {"D80": [0x1b,0x1f,0x13,0xf3,0x77,0xcb,0x75,0x40]}

assistant: ```c
void gen_signal_double(double *data, double scale, int channels, int datalen) {
  int k, ramplen;
  double amp = 0.0;
  ramplen = 1000;
  if (channels == 1) {
    for (k = 0; k < datalen; k++) {
      if (k <= ramplen)
        amp = scale * k / ((double)ramplen);
      else if (k > datalen - ramplen)
        amp = scale * (datalen - k) / ((double)ramplen);
      data[k] = amp * (0.4 * sin(33.3 * 2.0 * 3.14159265358979323846264338 * ((double)(k + 1)) / ((double)11025)) + 0.3 * cos(201.1 * 2.0 * 3.14159265358979323846264338 * ((double)(k + 1)) / ((double)11025)));
    };
  } else {
    for (k = 0; k < datalen; k++) {
      if (k <= ramplen)
        amp = scale * k / ((double)ramplen);
      else if (k > datalen - ramplen)
        amp = scale * (datalen - k) / ((double)ramplen);
      data[2 * k] = amp * (0.4 * sin(33.3 * 2.0 * 3.14159265358979323846264338 * ((double)(k + 1)) / ((double)11025)) + 0.3 * cos(201.1 * 2.0 * 3.14159265358979323846264338 * ((double)(k + 1)) / ((double)11025)));
      data[2 * k + 1] = amp * (0.4 * sin(55.5 * 2.0 * 3.14159265358979323846264338 * ((double)(k + 1)) / ((double)11025)) + 0.3 * cos(201.1 * 2.0 * 3.14159265358979323846264338 * ((double)(k + 1)) / ((double)11025)));
    };
  };
  return;
}
```