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

```asm
<computesegmentmeans>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %ecx,-0x20(%rbp)
  mov    %r8,-0x30(%rbp)
  movl   $0x0,-0x4(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L27
L12:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  pxor   %xmm0,%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x4(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  jmp    L8
L53:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x8(%rbp)
L8:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  D12(%rip),%xmm1
  subsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%eax
  cmp    %eax,-0x8(%rbp)
  jl     L53
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  D12(%rip),%xmm2
  subsd  %xmm2,%xmm1
  pxor   %xmm2,%xmm2
  cvtsi2sdl -0x4(%rbp),%xmm2
  subsd  %xmm2,%xmm1
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  D12(%rip),%xmm1
  subsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,-0x4(%rbp)
  addl   $0x1,-0xc(%rbp)
L27:
  mov    -0xc(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jl     L12
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  pxor   %xmm0,%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x4(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  jmp    L20
L57:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x8(%rbp)
L20:
  mov    -0x8(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L57
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x1c(%rbp),%eax
  sub    -0x4(%rbp),%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  nop
  pop    %rbp
  ret
```

tool_calls: name: unpack_data
arguments: label: D12
type_infered: byte[8]

tool: {"D12": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f]}

assistant: ```c
void computesegmentmeans(double *inputvector, int N, double *disc, int numdisc, double *amp) {
  int i, j;
  int prevdisc = 0;
  for (i = 0; i < numdisc; i++) {
    amp[i] = 0;
    for (j = prevdisc; j < (int)(disc[i] - 1); j++)
      amp[i] += inputvector[j];
    amp[i] = amp[i] / ((double)(disc[i] - 1 - prevdisc));
    prevdisc = (int)(disc[i] - 1);
  }
  amp[i] = 0;
  for (j = prevdisc; j < N; j++)
    amp[i] += inputvector[j];
  amp[i] = amp[i] / (double)(N - prevdisc);
}
```