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

```asm
<HDsSymidxMax>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x108,%rsp
  mov    %rsi,%rbx
  mov    %rcx,%rbp
  mov    %r9,%r12
  mov    0x130(%rsp),%r13d
  mov    %fs:0x28,%rax
  mov    %rax,0xf8(%rsp)
  xor    %eax,%eax
  movsd  (%rdx),%xmm6
  movsd  %xmm6,0x8(%rsp)
  movsd  %xmm6,0x60(%rsp)
  movsd  0x18(%rdx),%xmm7
  movsd  %xmm7,0x10(%rsp)
  movsd  %xmm7,0x68(%rsp)
  movsd  0x30(%rdx),%xmm6
  movsd  %xmm6,0x18(%rsp)
  movsd  %xmm6,0x70(%rsp)
  movsd  0x8(%rdx),%xmm7
  movsd  %xmm7,0x20(%rsp)
  movsd  %xmm7,0x78(%rsp)
  movsd  0x20(%rdx),%xmm6
  movsd  %xmm6,0x28(%rsp)
  movsd  %xmm6,0x80(%rsp)
  movsd  0x38(%rdx),%xmm7
  movsd  %xmm7,0x30(%rsp)
  movsd  %xmm7,0x88(%rsp)
  movsd  0x10(%rdx),%xmm6
  movsd  %xmm6,0x38(%rsp)
  movsd  %xmm6,0x90(%rsp)
  movsd  0x28(%rdx),%xmm7
  movsd  %xmm7,0x40(%rsp)
  movsd  %xmm7,0x98(%rsp)
  movsd  0x40(%rdx),%xmm6
  movsd  %xmm6,0x48(%rsp)
  movsd  %xmm6,0xa0(%rsp)
L20:
  movsd  0x60(%rsp,%rax,1),%xmm0
  movsd  %xmm0,0xb0(%rsp,%rax,1)
  add    $0x8,%rax
  cmp    $0x48,%rax
  jne    L20
  lea    0xb0(%rsp),%rdi
  mov    $0x3,%esi
  call   <minv@plt>
  test   %r13d,%r13d
  jle    L13
  movsd  0xe0(%rsp),%xmm12
  movsd  0xe8(%rsp),%xmm11
  movsd  0xf0(%rsp),%xmm10
  movsd  0xb0(%rsp),%xmm9
  movsd  0xb8(%rsp),%xmm8
  movsd  0xc0(%rsp),%xmm7
  movsd  0xc8(%rsp),%xmm6
  movsd  0xd0(%rsp),%xmm4
  movsd  %xmm4,0x50(%rsp)
  movsd  0xd8(%rsp),%xmm4
  movsd  %xmm4,0x58(%rsp)
  mov    %r12,%rdx
  lea    -0x1(%r13),%eax
  lea    0x4(%r12,%rax,4),%rcx
L11:
  mov    (%rdx),%eax
  lea    (%rax,%rax,2),%eax
  add    %eax,%eax
  cltq
  lea    (%rbx,%rax,8),%rax
  movsd  (%rax),%xmm0
  movsd  0x8(%rax),%xmm13
  movapd %xmm12,%xmm15
  mulsd  %xmm0,%xmm15
  movapd %xmm11,%xmm1
  mulsd  %xmm13,%xmm1
  addsd  %xmm1,%xmm15
  addsd  %xmm10,%xmm15
  movsd  0x18(%rax),%xmm1
  movsd  0x20(%rax),%xmm4
  movsd  0x38(%rsp),%xmm3
  mulsd  %xmm1,%xmm3
  movsd  0x40(%rsp),%xmm2
  mulsd  %xmm4,%xmm2
  addsd  %xmm2,%xmm3
  addsd  0x48(%rsp),%xmm3
  movapd %xmm0,%xmm14
  mulsd  %xmm9,%xmm14
  movapd %xmm13,%xmm2
  mulsd  %xmm8,%xmm2
  addsd  %xmm2,%xmm14
  addsd  %xmm7,%xmm14
  divsd  %xmm15,%xmm14
  movapd %xmm1,%xmm2
  subsd  %xmm14,%xmm2
  movapd %xmm0,%xmm14
  mulsd  %xmm6,%xmm14
  movsd  0x50(%rsp),%xmm5
  mulsd  %xmm13,%xmm5
  addsd  %xmm5,%xmm14
  addsd  0x58(%rsp),%xmm14
  divsd  %xmm15,%xmm14
  movapd %xmm4,%xmm5
  subsd  %xmm14,%xmm5
  mulsd  %xmm2,%xmm2
  mulsd  %xmm5,%xmm5
  addsd  %xmm5,%xmm2
  movsd  0x8(%rsp),%xmm14
  mulsd  %xmm1,%xmm14
  movsd  0x10(%rsp),%xmm5
  mulsd  %xmm4,%xmm5
  addsd  %xmm5,%xmm14
  addsd  0x18(%rsp),%xmm14
  divsd  %xmm3,%xmm14
  subsd  %xmm14,%xmm0
  mulsd  0x20(%rsp),%xmm1
  mulsd  0x28(%rsp),%xmm4
  addsd  %xmm4,%xmm1
  addsd  0x30(%rsp),%xmm1
  divsd  %xmm3,%xmm1
  subsd  %xmm1,%xmm13
  mulsd  %xmm0,%xmm0
  mulsd  %xmm13,%xmm13
  addsd  %xmm13,%xmm0
  maxsd  %xmm2,%xmm0
  movsd  %xmm0,0x0(%rbp)
  add    $0x4,%rdx
  cmp    %rcx,%rdx
  jne    L11
L13:
  mov    0xf8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L27
  add    $0x108,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L27:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void HDsSymidxMax(const double *lin, const double *mu, const double *H, double *p, int len, int *idx, int siz) {
  int i, mi;
  double Hinv[9], H1[9];
  const double *u;
  double a, b, xa, ya, d1, d2, xdiff, ydiff;
  Hinv[0] = H[0];
  Hinv[1] = H[3];
  Hinv[2] = H[6];
  Hinv[3] = H[1];
  Hinv[4] = H[4];
  Hinv[5] = H[7];
  Hinv[6] = H[2];
  Hinv[7] = H[5];
  Hinv[8] = H[8];
  for (i = 0; i < 9; i++)
    H1[i] = Hinv[i];
  minv(H1, 3);
  for (mi = 0; mi < siz; mi++) {
    i = idx[mi];
    u = mu + 6 * i;
    a = H1[6] * u[0] + H1[7] * u[1] + H1[8];
    b = Hinv[6] * u[3] + Hinv[7] * u[4] + Hinv[8];
    xa = (H1[0] * u[0] + H1[1] * u[1] + H1[2]) / a;
    ya = (H1[3] * u[0] + H1[4] * u[1] + H1[5]) / a;
    xdiff = u[3] - xa;
    ydiff = u[4] - ya;
    d1 = xdiff * xdiff + ydiff * ydiff;
    xa = (Hinv[0] * u[3] + Hinv[1] * u[4] + Hinv[2]) / b;
    ya = (Hinv[3] * u[3] + Hinv[4] * u[4] + Hinv[5]) / b;
    xdiff = u[0] - xa;
    ydiff = u[1] - ya;
    d2 = xdiff * xdiff + ydiff * ydiff;
    *p = ((d1) < (d2) ? (d2) : (d1));
  }
}
```