user: Converte this assembly snippet into its equivalent C code:

```asm
<lineal>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %edx,0x24(%rsp)
  mov    %rcx,%r15
  mov    %r8,%rbp
  mov    %r9,0x28(%rsp)
  test   %edx,%edx
  jle    L48
  mov    %rdi,%r12
  mov    %rsi,%r13
  mov    %edx,%r14d
  mov    $0x0,%eax
  pxor   %xmm4,%xmm4
  movapd %xmm4,%xmm3
  movsd  %xmm4,0x8(%rsp)
  movapd %xmm4,%xmm2
L16:
  movsd  (%r12,%rax,8),%xmm0
  addsd  %xmm0,%xmm2
  movsd  0x0(%r13,%rax,8),%xmm1
  movsd  0x8(%rsp),%xmm5
  addsd  %xmm1,%xmm5
  movsd  %xmm5,0x8(%rsp)
  mulsd  %xmm0,%xmm1
  addsd  %xmm1,%xmm3
  mulsd  %xmm0,%xmm0
  addsd  %xmm0,%xmm4
  add    $0x1,%rax
  cmp    %rax,%r14
  jne    L16
  pxor   %xmm0,%xmm0
  cvtsi2sdl 0x24(%rsp),%xmm0
  movsd  0x8(%rsp),%xmm6
  movapd %xmm6,%xmm5
  divsd  %xmm0,%xmm5
  movsd  %xmm5,0x18(%rsp)
  mulsd  %xmm0,%xmm3
  mulsd  %xmm2,%xmm6
  subsd  %xmm6,%xmm3
  mulsd  %xmm0,%xmm4
  movapd %xmm2,%xmm1
  mulsd  %xmm2,%xmm1
  subsd  %xmm1,%xmm4
  divsd  %xmm4,%xmm3
  movsd  %xmm3,(%r15)
  divsd  %xmm0,%xmm2
  mulsd  %xmm3,%xmm2
  subsd  %xmm2,%xmm5
  movsd  %xmm5,0x0(%rbp)
  lea    D2(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%ebx
  pxor   %xmm6,%xmm6
  movsd  %xmm6,(%rsp)
  movsd  %xmm6,0x10(%rsp)
L10:
  movsd  0x0(%r13,%rbx,8),%xmm1
  movsd  (%r12,%rbx,8),%xmm0
  movapd %xmm0,%xmm2
  mulsd  (%r15),%xmm2
  movapd %xmm1,%xmm3
  subsd  %xmm2,%xmm3
  subsd  0x0(%rbp),%xmm3
  mulsd  %xmm3,%xmm3
  movapd %xmm1,%xmm2
  subsd  0x18(%rsp),%xmm2
  mulsd  %xmm2,%xmm2
  movsd  0x10(%rsp),%xmm6
  addsd  %xmm2,%xmm6
  movsd  %xmm6,0x10(%rsp)
  movsd  (%rsp),%xmm7
  addsd  %xmm3,%xmm7
  movsd  %xmm7,(%rsp)
  lea    D22(%rip),%rdi
  mov    $0x4,%eax
  call   <printf@plt>
  add    $0x1,%rbx
  cmp    %rbx,%r14
  jne    L10
L14:
  mov    0x24(%rsp),%eax
  sub    $0x2,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movsd  (%rsp),%xmm0
  divsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L5
  sqrtsd %xmm0,%xmm0
L18:
  mov    0x28(%rsp),%rax
  movsd  %xmm0,(%rax)
  movsd  0x10(%rsp),%xmm7
  movapd %xmm7,%xmm0
  movsd  (%rsp),%xmm2
  subsd  %xmm2,%xmm0
  divsd  %xmm7,%xmm0
  mov    0x70(%rsp),%rax
  movsd  %xmm0,(%rax)
  movapd %xmm7,%xmm1
  movsd  0x8(%rsp),%xmm0
  lea    D38(%rip),%rdi
  mov    $0x3,%eax
  call   <printf@plt>
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L5:
  call   <sqrt@plt>
  jmp    L18
L48:
  pxor   %xmm0,%xmm0
  cvtsi2sdl 0x24(%rsp),%xmm0
  pxor   %xmm1,%xmm1
  divsd  %xmm0,%xmm1
  pxor   %xmm4,%xmm4
  mulsd  %xmm4,%xmm0
  divsd  %xmm0,%xmm0
  movsd  %xmm0,(%rcx)
  mulsd  %xmm1,%xmm0
  subsd  %xmm0,%xmm1
  movsd  %xmm1,(%r8)
  lea    D2(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movq   $0x0,0x8(%rsp)
  movq   $0x0,(%rsp)
  movq   $0x0,0x10(%rsp)
  jmp    L14
```

tool_calls: name: read_data
arguments: label: D2
datatype: string
name: read_data
arguments: label: D22
datatype: string
name: read_data
arguments: label: D38
datatype: string

tool: D2: 
       Xi       |        Yi       |     (Yi-Ym)^2     |      (Yi-ao-a1X1)^2   |

tool: D22: 
    %8.4lf    |     %8.4lf    |     %8.4lf      |         %8.4lf      |

tool: D38: 
      sum       |     %8.4lf    |     %8.4lf      |         %8.4lf      |

assistant: ```c
void lineal(double *X, double *Y, int n, double *a1, double *a0, double *syx, double *r2) {
  double sumx = 0, sumy = 0, sumxy = 0, vad;
  double sumx2 = 0, st = 0, sr = 0, cdd;
  double xm, ym;
  int i;
  for (i = 0; i < n; i++) {
    sumx = sumx + X[i];
    sumy = sumy + Y[i];
    sumxy = sumxy + X[i] * Y[i];
    sumx2 = sumx2 + X[i] * X[i];
  }
  xm = sumx / n;
  ym = sumy / n;
  *a1 = (n * sumxy - sumx * sumy) / (n * sumx2 - sumx * sumx);
  *a0 = ym - *a1 * xm;
  printf("\n       Xi       |        Yi       |     (Yi-Ym)^2     |      (Yi-ao-a1X1)^2   |");
  for (i = 0; i < n; i++) {
    vad = (Y[i] - *a1 * X[i] - *a0) * (Y[i] - *a1 * X[i] - *a0);
    cdd = (Y[i] - ym) * (Y[i] - ym);
    st = st + cdd;
    sr = sr + vad;
    printf("\n    %8.4lf    |     %8.4lf    |     %8.4lf      |         %8.4lf      |", X[i], Y[i], cdd, vad);
  }
  *syx = sqrt(sr / (n - 2));
  *r2 = (st - sr) / st;
  printf("\n      sum       |     %8.4lf    |     %8.4lf      |         %8.4lf      |", sumy, st, sr);
}
```