user: Translate the below assembly code into C programming language:

```asm
<doalarm>:
  endbr64
  test   %edi,%edi
  jle    L92
  fldz
  movsd  D6(%rip),%xmm3
  movslq %edi,%rcx
  xor    %eax,%eax
  fld    %st(0)
  pxor   %xmm2,%xmm2
  nopl   0x0(%rax)
L16:
  movsd  (%rsi,%rax,8),%xmm1
  ucomisd %xmm1,%xmm1
  jp     L30
  movsd  (%rdx,%rax,8),%xmm0
  ucomisd %xmm0,%xmm0
  jp     L30
  comisd %xmm2,%xmm0
  jbe    L30
  fxch   %st(1)
  mulsd  %xmm0,%xmm0
  movapd %xmm3,%xmm7
  divsd  %xmm0,%xmm1
  divsd  %xmm0,%xmm7
  movsd  %xmm1,-0x10(%rsp)
  faddl  -0x10(%rsp)
  fxch   %st(1)
  movsd  %xmm7,-0x10(%rsp)
  faddl  -0x10(%rsp)
L30:
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L16
  fdivrp %st,%st(1)
  movsd  (%rsi),%xmm0
  fstpl  -0x10(%rsp)
  movsd  -0x10(%rsp),%xmm3
  subsd  %xmm3,%xmm0
  movsd  %xmm0,(%rsi)
  movsd  (%rdx),%xmm1
  movapd %xmm0,%xmm5
  comisd %xmm2,%xmm0
  mulsd  %xmm0,%xmm5
  movapd %xmm1,%xmm4
  mulsd  %xmm1,%xmm4
  sbb    %r8d,%r8d
  or     $0x1,%r8d
  divsd  %xmm4,%xmm5
  movapd %xmm0,%xmm4
  divsd  %xmm1,%xmm4
  movsd  %xmm5,-0x10(%rsp)
  fldl   -0x10(%rsp)
  movsd  %xmm4,-0x10(%rsp)
  fldl   -0x10(%rsp)
  cmp    $0x1,%edi
  je     L104
  sub    $0x2,%edi
  movsd  %xmm2,-0x10(%rsp)
  mov    $0x1,%eax
  fldl   -0x10(%rsp)
  add    $0x2,%rdi
  jmp    L4
  nopl   (%rax)
L49:
  fstp   %st(0)
  fxch   %st(2)
  fmul   %st(0),%st
  mov    %ecx,%r8d
  faddp  %st,%st(1)
  fstpl  -0x10(%rsp)
  fldl   -0x10(%rsp)
  fxch   %st(2)
L36:
  mulsd  %xmm0,%xmm0
  mulsd  %xmm1,%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rsp)
  faddl  -0x10(%rsp)
  jmp    L40
  nopl   (%rax)
L105:
  fxch   %st(2)
  nopw   0x0(%rax,%rax,1)
L40:
  add    $0x1,%rax
  cmp    %rdi,%rax
  je     L128
  fxch   %st(2)
L4:
  movsd  (%rsi,%rax,8),%xmm0
  ucomisd %xmm0,%xmm0
  jp     L105
  subsd  %xmm3,%xmm0
  movsd  %xmm0,(%rsi,%rax,8)
  movsd  (%rdx,%rax,8),%xmm1
  movapd %xmm0,%xmm6
  comisd %xmm2,%xmm0
  divsd  %xmm1,%xmm6
  sbb    %ecx,%ecx
  or     $0x1,%ecx
  movsd  %xmm6,-0x10(%rsp)
  fldl   -0x10(%rsp)
  fld    %st(0)
  cmp    %r8d,%ecx
  jne    L49
  fstp   %st(1)
  faddp  %st,%st(2)
  fxch   %st(2)
  jmp    L36
  cs nopw 0x0(%rax,%rax,1)
L128:
  fxch   %st(1)
L67:
  fmul   %st(0),%st
  faddp  %st,%st(2)
  fxch   %st(1)
  fstpl  -0x10(%rsp)
  fldl   -0x10(%rsp)
  fdivp  %st,%st(1)
  fsubl  0xd70(%rip)        # 2008 <_fini+0xd50>
  fstpl  -0x10(%rsp)
  movsd  -0x10(%rsp),%xmm0
  ret
  nopl   0x0(%rax,%rax,1)
L92:
  pxor   %xmm0,%xmm0
  ret
L104:
  fldz
  fxch   %st(2)
  fxch   %st(1)
  jmp    L67
```

tool_calls: name: parse_data
arguments: data_tag: D6
type: f64

tool: D6: 1

assistant: ```c
double doalarm(int N, double *resid, double *err) {
  double a, ave;
  long double sum1, sum2;
  int sign, i, n;
  sum1 = 0.;
  sum2 = 0.;
  for (i = 0; i < N; i++) {
    if (!isnan(resid[i]) && !isnan(err[i]) && err[i] > 0.) {
      sum1 += (long double)(resid[i] / (err[i] * err[i]));
      sum2 += (long double)(1. / (err[i] * err[i]));
    }
  }
  a = 0.;
  if (N > 0) {
    ave = sum1 / sum2;
    resid[0] -= ave;
    sum1 = resid[0] * resid[0] / (err[0] * err[0]);
    sum2 = resid[0] / err[0];
    n = 1;
    sign = ((resid[0]) >= 0 ? (1) : (-1));
    for (i = 1; i < N; i++) {
      if (!isnan(resid[i])) {
        resid[i] -= ave;
        if (((resid[i]) >= 0 ? (1) : (-1)) != sign) {
          a += (sum2 * sum2);
          sum2 = resid[i] / err[i];
          n = 1;
          sign = ((resid[i]) >= 0 ? (1) : (-1));
        } else {
          sum2 += resid[i] / err[i];
          n++;
        }
        sum1 += resid[i] * resid[i] / (err[i] * err[i]);
      }
    }
    a += (sum2 * sum2);
    a = (a / sum1) - 2.2732395;
  }
  return (a);
}
```