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

```asm
<tpd4>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %ecx,-0x28(%rbp)
  mov    %r8,-0x40(%rbp)
  mov    %r9,-0x48(%rbp)
  mov    -0x24(%rbp),%eax
  add    $0x3,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x11,%eax
  jne    L62
  cmpl   $0x2,-0x28(%rbp)
  jle    L75
L62:
  mov    $0x1,%eax
  jmp    L73
L75:
  mov    -0x40(%rbp),%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x20(%rbp)
  mov    -0x40(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x18(%rbp)
  mov    -0x30(%rbp),%rax
  add    $0x14,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L65
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm1
  mov    -0x38(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x20(%rbp),%xmm0
  addsd  %xmm0,%xmm1
  mov    -0x38(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x18(%rbp),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  mov    -0x38(%rbp),%rax
  add    $0x18,%rax
  movsd  (%rax),%xmm1
  mov    -0x38(%rbp),%rax
  add    $0x20,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x20(%rbp),%xmm0
  addsd  %xmm0,%xmm1
  mov    -0x38(%rbp),%rax
  add    $0x28,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x18(%rbp),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  movsd  -0x10(%rbp),%xmm0
  movsd  %xmm0,-0x20(%rbp)
  addq   $0x30,-0x38(%rbp)
L65:
  cmpl   $0x0,-0x24(%rbp)
  je     L74
  mov    -0x30(%rbp),%rax
  add    $0xc,%rax
  mov    (%rax),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,-0x38(%rbp)
L74:
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm1
  mov    -0x38(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm2
  mov    -0x38(%rbp),%rax
  add    $0x20,%rax
  movsd  (%rax),%xmm3
  mov    -0x38(%rbp),%rax
  add    $0x38,%rax
  movsd  (%rax),%xmm4
  mov    -0x38(%rbp),%rax
  add    $0x60,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x20(%rbp),%xmm0
  addsd  %xmm4,%xmm0
  mulsd  -0x20(%rbp),%xmm0
  addsd  %xmm3,%xmm0
  mulsd  -0x20(%rbp),%xmm0
  addsd  %xmm2,%xmm0
  mulsd  -0x20(%rbp),%xmm0
  addsd  %xmm1,%xmm0
  mov    -0x48(%rbp),%rax
  movsd  %xmm0,(%rax)
  cmpl   $0x1,-0x28(%rbp)
  jne    L32
  mov    $0x0,%eax
  jmp    L73
L32:
  mov    -0x48(%rbp),%rax
  movsd  (%rax),%xmm1
  mov    -0x38(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm2
  mov    -0x38(%rbp),%rax
  add    $0x30,%rax
  movsd  (%rax),%xmm3
  mov    -0x38(%rbp),%rax
  add    $0x50,%rax
  movsd  (%rax),%xmm4
  mov    -0x38(%rbp),%rax
  sub    $0xffffffffffffff80,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x18(%rbp),%xmm0
  addsd  %xmm4,%xmm0
  mulsd  -0x18(%rbp),%xmm0
  addsd  %xmm3,%xmm0
  mulsd  -0x18(%rbp),%xmm0
  addsd  %xmm2,%xmm0
  movapd %xmm0,%xmm2
  mulsd  -0x18(%rbp),%xmm2
  mov    -0x38(%rbp),%rax
  add    $0x28,%rax
  movsd  (%rax),%xmm3
  mov    -0x38(%rbp),%rax
  add    $0x48,%rax
  movsd  (%rax),%xmm4
  mov    -0x38(%rbp),%rax
  add    $0x78,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x18(%rbp),%xmm0
  addsd  %xmm4,%xmm0
  mulsd  -0x18(%rbp),%xmm0
  addsd  %xmm0,%xmm3
  mov    -0x38(%rbp),%rax
  add    $0x40,%rax
  movsd  (%rax),%xmm4
  mov    -0x38(%rbp),%rax
  add    $0x70,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x18(%rbp),%xmm0
  addsd  %xmm0,%xmm4
  mov    -0x38(%rbp),%rax
  add    $0x68,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x20(%rbp),%xmm0
  addsd  %xmm4,%xmm0
  mulsd  -0x20(%rbp),%xmm0
  addsd  %xmm3,%xmm0
  mulsd  -0x20(%rbp),%xmm0
  mulsd  -0x18(%rbp),%xmm0
  addsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  mov    -0x48(%rbp),%rax
  movsd  %xmm0,(%rax)
  mov    -0x30(%rbp),%rax
  add    $0x18,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L22
  movsd  -0x20(%rbp),%xmm0
  movapd %xmm0,%xmm1
  mulsd  %xmm0,%xmm1
  movsd  -0x18(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x48(%rbp),%rax
  movsd  (%rax),%xmm1
  mov    -0x38(%rbp),%rax
  add    $0x18,%rax
  movsd  (%rax),%xmm2
  mov    -0x38(%rbp),%rax
  add    $0x58,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x8(%rbp),%xmm0
  addsd  %xmm2,%xmm0
  mulsd  -0x10(%rbp),%xmm0
  addsd  %xmm1,%xmm0
  mov    -0x48(%rbp),%rax
  movsd  %xmm0,(%rax)
L22:
  mov    $0x0,%eax
L73:
  leave
  ret
```

assistant: ```c
int tpd4(int inverse, const int i[], const double p[], int Nhat, const double rawcrd[], double *discrd) {
  if (i[3 + inverse] != 17 || 2 < Nhat) {
    return 1;
  }
  double r, s;
  double u = rawcrd[0];
  double v = rawcrd[1];
  if (i[5]) {
    r = p[0] + p[1] * u + p[2] * v;
    v = p[3] + p[4] * u + p[5] * v;
    u = r;
    p += 6;
  }
  if (inverse)
    p += i[3];
  *discrd = p[0] + u * (p[1] + u * (p[4] + u * (p[7] + u * (p[12]))));
  if (Nhat == 1)
    return 0;
  *discrd += v * (p[2] + v * (p[6] + v * (p[10] + v * (p[16])))) + u * (p[5] + v * (p[9] + v * (p[15])) + u * (p[8] + v * (p[14]) + u * (p[13]))) * v;
  if (i[6]) {
    s = u * u + v * v;
    r = sqrt(s);
    *discrd += r * (p[3] + s * (p[11]));
  }
  return 0;
}
```