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

```asm
<linetrend>:
  endbr64
  push   %r13
  mov    %rcx,%r13
  push   %r12
  mov    %edx,%r12d
  sub    $0x38,%rsp
  test   %edx,%edx
  jle    L64
  lea    -0x1(%rdx),%ecx
  cmp    $0x2,%ecx
  jbe    L152
  mov    %edx,%eax
  pxor   %xmm6,%xmm6
  movaps %xmm6,%xmm5
  shr    $0x2,%eax
  movaps %xmm6,%xmm3
  movaps %xmm6,%xmm4
  lea    -0x1(%rax),%edx
  movaps %xmm6,%xmm2
  mov    $0x4,%eax
  shl    $0x4,%rdx
  add    $0x14,%rdx
  nopl   0x0(%rax,%rax,1)
L204:
  movups (%rdi,%rax,1),%xmm0
  movaps %xmm0,%xmm1
  addss  %xmm2,%xmm1
  movaps %xmm0,%xmm2
  shufps $0x55,%xmm0,%xmm2
  addss  %xmm2,%xmm1
  movaps %xmm0,%xmm2
  unpckhps %xmm0,%xmm2
  addss  %xmm2,%xmm1
  movaps %xmm0,%xmm2
  shufps $0xff,%xmm0,%xmm2
  mulps  %xmm0,%xmm0
  addss  %xmm1,%xmm2
  movaps %xmm0,%xmm1
  addss  %xmm3,%xmm1
  movaps %xmm0,%xmm3
  shufps $0x55,%xmm0,%xmm3
  addss  %xmm3,%xmm1
  movaps %xmm0,%xmm3
  unpckhps %xmm0,%xmm3
  shufps $0xff,%xmm0,%xmm0
  addss  %xmm3,%xmm1
  movaps %xmm1,%xmm3
  addss  %xmm0,%xmm3
  movups (%rsi,%rax,1),%xmm0
  add    $0x10,%rax
  movaps %xmm0,%xmm1
  addss  %xmm4,%xmm1
  movaps %xmm0,%xmm4
  shufps $0x55,%xmm0,%xmm4
  addss  %xmm4,%xmm1
  movaps %xmm0,%xmm4
  unpckhps %xmm0,%xmm4
  addss  %xmm4,%xmm1
  movaps %xmm0,%xmm4
  shufps $0xff,%xmm0,%xmm4
  mulps  %xmm0,%xmm0
  addss  %xmm1,%xmm4
  movaps %xmm0,%xmm1
  addss  %xmm5,%xmm1
  movaps %xmm0,%xmm5
  shufps $0x55,%xmm0,%xmm5
  addss  %xmm5,%xmm1
  movaps %xmm0,%xmm5
  unpckhps %xmm0,%xmm5
  shufps $0xff,%xmm0,%xmm0
  addss  %xmm5,%xmm1
  movaps %xmm1,%xmm5
  addss  %xmm0,%xmm5
  cmp    %rax,%rdx
  jne    L204
  mov    %r12d,%edx
  and    $0xfffffffc,%edx
  lea    0x1(%rdx),%eax
  cmp    %edx,%r12d
  je     L124
L35:
  movslq %eax,%rcx
  movss  (%rdi,%rcx,4),%xmm0
  lea    0x0(,%rcx,4),%rdx
  addss  %xmm0,%xmm2
  mulss  %xmm0,%xmm0
  addss  %xmm0,%xmm3
  movss  (%rsi,%rcx,4),%xmm0
  lea    0x1(%rax),%ecx
  addss  %xmm0,%xmm4
  mulss  %xmm0,%xmm0
  addss  %xmm0,%xmm5
  cmp    %r12d,%ecx
  jg     L124
  movss  0x4(%rdi,%rdx,1),%xmm0
  add    $0x2,%eax
  addss  %xmm0,%xmm2
  mulss  %xmm0,%xmm0
  addss  %xmm0,%xmm3
  movss  0x4(%rsi,%rdx,1),%xmm0
  addss  %xmm0,%xmm4
  mulss  %xmm0,%xmm0
  addss  %xmm0,%xmm5
  cmp    %eax,%r12d
  jl     L124
  movss  0x8(%rdi,%rdx,1),%xmm0
  addss  %xmm0,%xmm2
  mulss  %xmm0,%xmm0
  addss  %xmm0,%xmm3
  movss  0x8(%rsi,%rdx,1),%xmm0
  addss  %xmm0,%xmm4
  mulss  %xmm0,%xmm0
  addss  %xmm0,%xmm5
L124:
  pxor   %xmm7,%xmm7
  movaps %xmm2,%xmm9
  movaps %xmm4,%xmm8
  cvtsi2ss %r12d,%xmm7
  movaps %xmm3,%xmm10
  divss  %xmm7,%xmm9
  divss  %xmm7,%xmm8
  movaps %xmm9,%xmm0
  mulss  %xmm9,%xmm0
  divss  %xmm7,%xmm10
  divss  %xmm7,%xmm5
  subss  %xmm0,%xmm10
  movaps %xmm8,%xmm0
  mulss  %xmm8,%xmm0
  comiss %xmm10,%xmm6
  subss  %xmm0,%xmm5
  jae    L126
  comiss %xmm5,%xmm6
  jb     L139
L126:
  xorps  %xmm12,%xmm12
L167:
  movlps %xmm12,0x4(%r13)
  movss  %xmm6,0xc(%r13)
  add    $0x38,%rsp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L139:
  ucomiss %xmm10,%xmm6
  ja     L118
  sqrtss %xmm10,%xmm10
L144:
  ucomiss %xmm5,%xmm6
  ja     L178
  sqrtss %xmm5,%xmm5
L65:
  test   %r12d,%r12d
  jle    L115
  lea    -0x1(%r12),%ecx
  cmp    $0x2,%ecx
  jbe    L82
  movaps %xmm9,%xmm11
  movaps %xmm8,%xmm0
  movaps %xmm6,%xmm13
  mov    %r12d,%eax
  shr    $0x2,%eax
  movaps %xmm6,%xmm12
  shufps $0x0,%xmm11,%xmm11
  shufps $0x0,%xmm0,%xmm0
  lea    -0x1(%rax),%edx
  mov    $0x4,%eax
  shl    $0x4,%rdx
  add    $0x14,%rdx
  nopw   0x0(%rax,%rax,1)
L89:
  movups (%rsi,%rax,1),%xmm6
  movups (%rdi,%rax,1),%xmm1
  subps  %xmm0,%xmm6
  subps  %xmm11,%xmm1
  mulps  %xmm1,%xmm6
  addss  %xmm6,%xmm12
  movaps %xmm6,%xmm1
  shufps $0x55,%xmm6,%xmm1
  addss  %xmm12,%xmm1
  movaps %xmm6,%xmm12
  unpckhps %xmm6,%xmm12
  shufps $0xff,%xmm6,%xmm6
  addss  %xmm1,%xmm12
  movups (%rsi,%rax,1),%xmm1
  addss  %xmm6,%xmm12
  movups (%rdi,%rax,1),%xmm6
  add    $0x10,%rax
  mulps  %xmm6,%xmm1
  addss  %xmm1,%xmm13
  movaps %xmm1,%xmm6
  shufps $0x55,%xmm1,%xmm6
  addss  %xmm13,%xmm6
  movaps %xmm1,%xmm13
  unpckhps %xmm1,%xmm13
  shufps $0xff,%xmm1,%xmm1
  addss  %xmm6,%xmm13
  addss  %xmm1,%xmm13
  cmp    %rdx,%rax
  jne    L89
  mov    %r12d,%edx
  and    $0xfffffffc,%edx
  lea    0x1(%rdx),%eax
  cmp    %r12d,%edx
  je     L171
L58:
  sub    %edx,%r12d
  cmp    $0x1,%r12d
  je     L196
  add    $0x1,%edx
  movaps %xmm9,%xmm6
  movaps %xmm8,%xmm14
  movq   (%rdi,%rdx,4),%xmm0
  movq   (%rsi,%rdx,4),%xmm11
  shufps $0xe0,%xmm6,%xmm6
  mov    %r12d,%edx
  shufps $0xe0,%xmm14,%xmm14
  and    $0xfffffffe,%edx
  movaps %xmm0,%xmm1
  add    %edx,%eax
  subps  %xmm6,%xmm1
  mulps  %xmm11,%xmm0
  movaps %xmm11,%xmm6
  subps  %xmm14,%xmm6
  mulps  %xmm6,%xmm1
  movaps %xmm1,%xmm6
  shufps $0xe5,%xmm1,%xmm1
  addss  %xmm12,%xmm6
  addss  %xmm6,%xmm1
  movaps %xmm1,%xmm12
  movaps %xmm0,%xmm1
  shufps $0xe5,%xmm0,%xmm0
  addss  %xmm13,%xmm1
  addss  %xmm1,%xmm0
  movaps %xmm0,%xmm13
  cmp    %r12d,%edx
  je     L171
L196:
  cltq
  movss  (%rdi,%rax,4),%xmm6
  movss  (%rsi,%rax,4),%xmm0
  movaps %xmm6,%xmm11
  movaps %xmm0,%xmm1
  subss  %xmm8,%xmm1
  subss  %xmm9,%xmm11
  mulss  %xmm6,%xmm0
  mulss  %xmm11,%xmm1
  addss  %xmm0,%xmm13
  addss  %xmm1,%xmm12
L171:
  mulss  %xmm2,%xmm4
  pxor   %xmm0,%xmm0
  movaps %xmm8,%xmm6
  mulss  %xmm2,%xmm2
  cvtsi2ss %ecx,%xmm0
  mulss  %xmm5,%xmm10
  divss  %xmm7,%xmm4
  divss  %xmm7,%xmm2
  subss  %xmm4,%xmm13
  divss  %xmm0,%xmm12
  subss  %xmm2,%xmm3
  divss  %xmm3,%xmm13
  divss  %xmm10,%xmm12
  unpcklps %xmm13,%xmm12
  mulss  %xmm9,%xmm13
  subss  %xmm13,%xmm6
  jmp    L167
  nopl   0x0(%rax)
L64:
  pxor   %xmm6,%xmm6
  movaps %xmm6,%xmm5
  movaps %xmm6,%xmm3
  movaps %xmm6,%xmm4
  movaps %xmm6,%xmm2
  jmp    L124
L152:
  pxor   %xmm6,%xmm6
  mov    $0x1,%eax
  movaps %xmm6,%xmm5
  movaps %xmm6,%xmm3
  movaps %xmm6,%xmm4
  movaps %xmm6,%xmm2
  jmp    L35
L115:
  movaps %xmm6,%xmm13
  movaps %xmm6,%xmm12
  lea    -0x1(%r12),%ecx
  jmp    L171
L82:
  xor    %edx,%edx
  movaps %xmm6,%xmm13
  movaps %xmm6,%xmm12
  mov    $0x1,%eax
  jmp    L58
L118:
  movaps %xmm10,%xmm0
  mov    %rsi,0x20(%rsp)
  mov    %rdi,0x18(%rsp)
  movss  %xmm6,0x2c(%rsp)
  movss  %xmm4,0x28(%rsp)
  movss  %xmm3,0x14(%rsp)
  movss  %xmm2,0x10(%rsp)
  movss  %xmm5,0xc(%rsp)
  movss  %xmm8,0x8(%rsp)
  movss  %xmm9,0x4(%rsp)
  movss  %xmm7,(%rsp)
  call   <sqrtf@plt>
  movss  0x2c(%rsp),%xmm6
  mov    0x20(%rsp),%rsi
  mov    0x18(%rsp),%rdi
  movss  0x28(%rsp),%xmm4
  movaps %xmm0,%xmm10
  movss  0x14(%rsp),%xmm3
  movss  0x10(%rsp),%xmm2
  movss  0xc(%rsp),%xmm5
  movss  0x8(%rsp),%xmm8
  movss  0x4(%rsp),%xmm9
  movss  (%rsp),%xmm7
  jmp    L144
L178:
  movaps %xmm5,%xmm0
  mov    %rsi,0x20(%rsp)
  mov    %rdi,0x18(%rsp)
  movss  %xmm6,0x2c(%rsp)
  movss  %xmm4,0x28(%rsp)
  movss  %xmm3,0x14(%rsp)
  movss  %xmm2,0x10(%rsp)
  movss  %xmm10,0xc(%rsp)
  movss  %xmm8,0x8(%rsp)
  movss  %xmm9,0x4(%rsp)
  movss  %xmm7,(%rsp)
  call   <sqrtf@plt>
  movss  0x2c(%rsp),%xmm6
  mov    0x20(%rsp),%rsi
  mov    0x18(%rsp),%rdi
  movss  0x28(%rsp),%xmm4
  movaps %xmm0,%xmm5
  movss  0x14(%rsp),%xmm3
  movss  0x10(%rsp),%xmm2
  movss  0xc(%rsp),%xmm10
  movss  0x8(%rsp),%xmm8
  movss  0x4(%rsp),%xmm9
  movss  (%rsp),%xmm7
  jmp    L65
```

assistant: ```c
void linetrend(float *x, float *y, int n, float *res) {
  float mean_x, mean_y, std_x, std_y;
  float sum_x, sum_y, sum_x2, sum_y2;
  float cov, sum_xy;
  int i;
  sum_x = 0;
  sum_y = 0;
  sum_x2 = 0;
  sum_y2 = 0;
  for (i = 1; i <= n; i++) {
    sum_x += x[i];
    sum_x2 += (x[i] * x[i]);
    sum_y += y[i];
    sum_y2 += (y[i] * y[i]);
  }
  mean_x = sum_x / n;
  mean_y = sum_y / n;
  std_x = sum_x2 / n - mean_x * mean_x;
  std_y = sum_y2 / n - mean_y * mean_y;
  if ((std_x <= 0) | (std_y <= 0)) {
    res[1] = 0;
    res[2] = 0;
    res[3] = 0;
  } else {
    std_x = sqrt(std_x);
    std_y = sqrt(std_y);
    cov = 0;
    sum_xy = 0;
    for (i = 1; i <= n; i++) {
      cov += (x[i] - mean_x) * (y[i] - mean_y);
      sum_xy += (x[i] * y[i]);
    }
    cov = cov / (n - 1);
    res[1] = cov / (std_x * std_y);
    res[2] = (sum_xy - sum_x * sum_y / n) / (sum_x2 - sum_x * sum_x / n);
    res[3] = mean_y - (res[2]) * mean_x;
  }
}
```