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

```asm
<_sigfil>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rsi,(%rsp)
  movss  %xmm0,0xc(%rsp)
  test   %rcx,%rcx
  jle    L26
  mov    %rdi,%r12
  mov    %rcx,%rbx
  lea    -0x1(%rdx),%rcx
  not    %rdx
  mov    $0x0,%r13d
  pxor   %xmm0,%xmm0
  movaps %xmm0,%xmm1
  mov    $0x0,%eax
  jmp    L55
L181:
  pxor   %xmm0,%xmm0
  movaps %xmm0,%xmm1
  mov    $0x0,%eax
  jmp    L82
L54:
  movss  0x8(%r12,%rcx,4),%xmm2
  addss  %xmm2,%xmm1
  mulss  %xmm2,%xmm2
  addss  %xmm2,%xmm0
  add    $0x1,%rax
L70:
  pxor   %xmm2,%xmm2
  cvtsi2ss %rax,%xmm2
  divss  %xmm2,%xmm1
  movss  %xmm1,0x8(%rsp)
  divss  %xmm2,%xmm0
  mulss  %xmm1,%xmm1
  subss  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  comiss %xmm0,%xmm1
  jbe    L134
L98:
  mulss  0xc(%rsp),%xmm1
  movss  -0x4(%r12,%rbp,4),%xmm0
  subss  0x8(%rsp),%xmm0
  andps  D2(%rip),%xmm0
  comiss %xmm1,%xmm0
  seta   %al
  movzbl %al,%eax
  mov    (%rsp),%rdi
  mov    %ax,-0x2(%rdi,%rbp,2)
  cmp    %rbp,%rbx
  je     L26
  test   %r13,%r13
  js     L181
  cmp    %r13,%rbx
  jle    L181
  movss  -0x4(%r12,%rbp,4),%xmm0
  pxor   %xmm2,%xmm2
  movaps %xmm0,%xmm1
  addss  %xmm2,%xmm1
  mulss  %xmm0,%xmm0
  addss  %xmm2,%xmm0
  mov    $0x1,%eax
L82:
  mov    %r15,%rdx
  mov    %r14,%rcx
  mov    %rbp,%r13
L55:
  mov    %r13,%rbp
  add    $0x1,%rbp
  js     L194
  cmp    %rbp,%rbx
  jle    L194
  movss  (%r12,%rbp,4),%xmm2
  addss  %xmm2,%xmm1
  mulss  %xmm2,%xmm2
  addss  %xmm2,%xmm0
  add    $0x1,%rax
L194:
  mov    %rdx,%r15
  add    $0x1,%r15
  js     L232
  cmp    %r15,%rbx
  jle    L232
  movss  0x4(%r12,%rdx,4),%xmm2
  addss  %xmm2,%xmm1
  mulss  %xmm2,%xmm2
  addss  %xmm2,%xmm0
  add    $0x1,%rax
L232:
  test   %rdx,%rdx
  js     L110
  cmp    %rdx,%rbx
  jle    L110
  movss  (%r12,%rdx,4),%xmm2
  addss  %xmm2,%xmm1
  mulss  %xmm2,%xmm2
  addss  %xmm2,%xmm0
  add    $0x1,%rax
L110:
  mov    %rdx,%rsi
  add    $0x2,%rsi
  js     L208
  cmp    %rsi,%rbx
  jle    L208
  movss  0x8(%r12,%rdx,4),%xmm2
  addss  %xmm2,%xmm1
  mulss  %xmm2,%xmm2
  addss  %xmm2,%xmm0
  add    $0x1,%rax
L208:
  mov    %rcx,%r14
  add    $0x1,%r14
  js     L205
  cmp    %r14,%rbx
  jle    L205
  movss  0x4(%r12,%rcx,4),%xmm2
  addss  %xmm2,%xmm1
  mulss  %xmm2,%xmm2
  addss  %xmm2,%xmm0
  add    $0x1,%rax
L205:
  test   %rcx,%rcx
  js     L78
  cmp    %rcx,%rbx
  jle    L78
  movss  (%r12,%rcx,4),%xmm2
  addss  %xmm2,%xmm1
  mulss  %xmm2,%xmm2
  addss  %xmm2,%xmm0
  add    $0x1,%rax
L78:
  mov    %rcx,%rdx
  add    $0x2,%rdx
  js     L70
  cmp    %rdx,%rbx
  jg     L54
  jmp    L70
L134:
  ucomiss %xmm0,%xmm1
  ja     L239
  sqrtss %xmm0,%xmm0
  movaps %xmm0,%xmm1
  jmp    L98
L239:
  call   <sqrtf@plt>
  movaps %xmm0,%xmm1
  jmp    L98
L26:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: parse_data
arguments: label: D2
datatype: dword[4]

tool: {"D2": [0x7fffffff,0x00000000,0x00000000,0x00000000]}

assistant: ```c
void _sigfil(float *ima, short *bpm, float nsigma, long stride, long npix) {
  long i, k, n;
  float avg1, avg2, val, std;
  for (i = 0; i < npix; i++) {
    avg1 = avg2 = 0.0f;
    n = 0;
    k = i - 1;
    if ((k >= 0) && (k < npix)) {
      avg1 += ima[k];
      avg2 += ima[k] * ima[k];
      n++;
    }
    k = i + 1;
    if ((k >= 0) && (k < npix)) {
      avg1 += ima[k];
      avg2 += ima[k] * ima[k];
      n++;
    }
    k = i - stride;
    if ((k >= 0) && (k < npix)) {
      avg1 += ima[k];
      avg2 += ima[k] * ima[k];
      n++;
    }
    k = i - stride - 1;
    if ((k >= 0) && (k < npix)) {
      avg1 += ima[k];
      avg2 += ima[k] * ima[k];
      n++;
    }
    k = i - stride + 1;
    if ((k >= 0) && (k < npix)) {
      avg1 += ima[k];
      avg2 += ima[k] * ima[k];
      n++;
    }
    k = i + stride;
    if ((k >= 0) && (k < npix)) {
      avg1 += ima[k];
      avg2 += ima[k] * ima[k];
      n++;
    }
    k = i + stride - 1;
    if ((k >= 0) && (k < npix)) {
      avg1 += ima[k];
      avg2 += ima[k] * ima[k];
      n++;
    }
    k = i + stride + 1;
    if ((k >= 0) && (k < npix)) {
      avg1 += ima[k];
      avg2 += ima[k] * ima[k];
      n++;
    }
    avg1 = avg1 / (float)n;
    avg2 = avg2 / (float)n;
    std = avg2 - avg1 * avg1;
    if (std < 0.)
      std = 0.0f;
    else
      std = sqrtf(std);
    val = fabsf(ima[i] - avg1);
    if (val > (nsigma * std))
      bpm[i] = 1;
    else
      bpm[i] = 0;
  }
}
```