user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<trapfilter>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0x20000(%rsp),%r11
L36:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L36
  sub    $0x28,%rsp
  mov    0x20060(%rsp),%ebp
  mov    0x20068(%rsp),%r12d
  mov    %r8d,0x4(%rsp)
  mov    %esi,%ebx
  mov    %edx,%r15d
  xor    %esi,%esi
  mov    %r9d,(%rsp)
  mov    $0x10000,%edx
  mov    %rdi,%r13
  mov    %ecx,%r14d
  movsd  %xmm0,0x8(%rsp)
  lea    0x10(%rsp),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x20018(%rsp)
  xor    %eax,%eax
  call   <memset@plt>
  xor    %esi,%esi
  mov    $0x10000,%edx
  lea    0x10010(%rsp),%rdi
  call   <memset@plt>
  mov    (%rsp),%r9d
  mov    0x4(%rsp),%r8d
  lea    (%rbx,%r15,1),%r10d
  cmp    %r8d,%r9d
  cmovg  %r8d,%r9d
  test   %r9d,%r9d
  jle    L45
  pxor   %xmm7,%xmm7
  pxor   %xmm6,%xmm6
  pxor   %xmm3,%xmm3
  mov    %r13,%rsi
  cvtsi2sd %r14d,%xmm7
  lea    -0x1(%r9),%eax
  movapd %xmm3,%xmm4
  xor    %ecx,%ecx
  cvtsi2sd %ebx,%xmm6
  movsd  0x8(%rsp),%xmm5
  movapd %xmm3,%xmm0
  xor    %edx,%edx
  lea    0x4(%r13,%rax,4),%r8
  xor    %edi,%edi
  xchg   %ax,%ax
L21:
  mov    (%rsi),%eax
  movslq %edx,%r9
  add    $0x1,%edx
  pxor   %xmm1,%xmm1
  movslq 0x10(%rsp,%r9,4),%r11
  movapd %xmm5,%xmm2
  sub    %ebp,%eax
  imul   %r12d,%eax
  cmp    %edx,%ebx
  cmovle %edi,%edx
  mov    %eax,0x10(%rsp,%r9,4)
  movslq %ecx,%r9
  cltq
  add    $0x1,%ecx
  sub    %r11,%rax
  movslq 0x10010(%rsp,%r9,4),%r11
  cmp    %ecx,%r10d
  cmovle %edi,%ecx
  mov    %eax,0x10010(%rsp,%r9,4)
  add    $0x4,%rsi
  sub    %r11,%rax
  cvtsi2sd %rax,%xmm1
  addsd  %xmm1,%xmm4
  mulsd  %xmm7,%xmm1
  mulsd  %xmm4,%xmm2
  addsd  %xmm2,%xmm1
  addsd  %xmm1,%xmm3
  movapd %xmm3,%xmm1
  divsd  %xmm6,%xmm1
  cvttsd2si %xmm1,%eax
  movapd %xmm1,%xmm2
  maxsd  %xmm0,%xmm2
  mov    %eax,-0x4(%rsi)
  movapd %xmm2,%xmm0
  cmp    %rsi,%r8
  jne    L21
L47:
  mov    0x20018(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L46
  add    $0x20028,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L45:
  pxor   %xmm0,%xmm0
  jmp    L47
L46:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
double trapfilter(int *pulse, int peaking, int gap, int M, int len, int len_in, double N, int bl, int pol) {
  int delayk_buffer[16384];
  int delayk_index;
  int shiftk;
  long datak_out;
  int delaym_buffer[16384];
  int delaym_index;
  int shiftm;
  long datam_in;
  long datam_out;
  double slowshaperout;
  int i = 0;
  for (i = 0; i < 16384; i++) {
    delayk_buffer[i] = 0;
    delaym_buffer[i] = 0;
  }
  delayk_index = 0;
  shiftk = peaking;
  delaym_index = 0;
  shiftm = peaking + gap;
  if (len_in < len) {
    len = len_in;
  }
  int n = 0;
  i = 0;
  double max = 0;
  double accum1 = 0;
  double accum2 = 0;
  double adder2out;
  double adder3out;
  int input;
  while (i < len) {
    input = (pulse[i] - bl) * pol;
    datak_out = delayk_buffer[delayk_index];
    delayk_buffer[delayk_index] = input;
    delayk_index++;
    if (delayk_index >= shiftk)
      delayk_index = 0;
    datam_in = input - datak_out;
    datam_out = delaym_buffer[delaym_index];
    delaym_buffer[delaym_index] = datam_in;
    delaym_index++;
    if (delaym_index >= shiftm)
      delaym_index = 0;
    adder2out = datam_in - datam_out;
    accum1 += adder2out;
    adder3out = adder2out * M + accum1 * N;
    accum2 += adder3out;
    slowshaperout = accum2 / (double)peaking;
    if (slowshaperout > max) {
      max = slowshaperout;
    }
    pulse[i] = slowshaperout;
    i++;
  }
  return max;
}
```