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

```asm
<polyfit>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x44(%rbp)
  mov    %rcx,-0x50(%rbp)
  mov    %r8d,-0x48(%rbp)
  mov    -0x48(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x44(%rbp),%eax
  cltq
  mov    %eax,%edx
  mov    -0x24(%rbp),%eax
  cltq
  imul   %edx,%eax
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x20(%rbp)
  movl   $0x0,-0x2c(%rbp)
  jmp    L80
L79:
  mov    -0x2c(%rbp),%eax
  imul   -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  D8(%rip),%xmm0
  movsd  %xmm0,(%rax)
  movl   $0x1,-0x28(%rbp)
  jmp    L66
L43:
  mov    -0x2c(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  add    %edx,%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x2c(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x28(%rbp)
L66:
  mov    -0x28(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L43
  addl   $0x1,-0x2c(%rbp)
L80:
  mov    -0x2c(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jl     L79
  mov    -0x44(%rbp),%eax
  cltq
  mov    %eax,%edx
  mov    -0x24(%rbp),%eax
  cltq
  imul   %edx,%eax
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x24(%rbp),%edx
  mov    -0x44(%rbp),%eax
  cmp    %eax,%edx
  cmovle %edx,%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x2c(%rbp)
  jmp    L47
L67:
  movl   $0x0,-0x28(%rbp)
  jmp    L7
L46:
  mov    -0x2c(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  mov    -0x28(%rbp),%eax
  imul   -0x44(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x2c(%rbp),%eax
  add    %ecx,%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x28(%rbp)
L7:
  mov    -0x28(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L46
  addl   $0x1,-0x2c(%rbp)
L47:
  mov    -0x2c(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jl     L67
  mov    -0x10(%rbp),%rdx
  mov    -0x44(%rbp),%esi
  mov    -0x18(%rbp),%rax
  mov    -0x44(%rbp),%ecx
  push   %rcx
  mov    -0x24(%rbp),%ecx
  push   %rcx
  mov    $0x0,%r9d
  mov    $0x0,%r8d
  mov    $0x0,%ecx
  mov    %rax,%rdi
  call   <qrdecomp_hh@plt>
  add    $0x10,%rsp
  mov    -0x44(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x2c(%rbp)
  jmp    L63
L96:
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rax,%rdx
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x2c(%rbp)
L63:
  mov    -0x2c(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jl     L96
  mov    -0x24(%rbp),%r9d
  mov    -0x44(%rbp),%r8d
  mov    -0x8(%rbp),%rcx
  mov    -0x10(%rbp),%rdx
  mov    -0x44(%rbp),%esi
  mov    -0x18(%rbp),%rax
  push   $0x1
  mov    -0x44(%rbp),%edi
  push   %rdi
  mov    %rax,%rdi
  call   <qrsolve_hh@plt>
  add    $0x10,%rsp
  movl   $0x0,-0x2c(%rbp)
  jmp    L98
L87:
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x50(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x2c(%rbp)
L98:
  mov    -0x2c(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L87
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  leave
  ret
```

tool_calls: name: parse_data
arguments: tag: D8
datatype: byte[8]

tool: {"D8": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f]}

assistant: ```c
void polyfit(const double *_x, const double *_y, int _n, double *_c, int _deg) {
  int m;
  double *x;
  int j;
  int i;
  m = _deg + 1;
  x = (double *)malloc(sizeof(*x) * _n * m);
  for (j = 0; j < _n; j++) {
    x[j * m + 0] = 1;
    for (i = 1; i < m; i++) {
      x[j * m + i] = x[j * m + i - 1] * _x[j];
    }
  }
  {
    double *qrt;
    double *d;
    double *b;
    qrt = (double *)malloc(sizeof(*qrt) * _n * m);
    d = (double *)malloc(sizeof(*d) * ((m) > (_n) ? (_n) : (m)));
    for (j = 0; j < _n; j++) {
      for (i = 0; i < m; i++) {
        qrt[i * _n + j] = x[j * m + i];
      }
    }
    qrdecomp_hh(qrt, _n, d, NULL, 0, NULL, m, _n);
    b = (double *)malloc(sizeof(*b) * _n);
    for (j = 0; j < _n; j++) {
      b[j] = _y[j];
    }
    qrsolve_hh(qrt, _n, d, b, _n, m, _n, 1);
    for (j = 0; j < m; j++) {
      _c[j] = b[j];
    }
    free(qrt);
    free(d);
    free(b);
  }
  free(x);
}
```