user: Please show me the C implementation that matches the assembly code listed below:

```asm
<Calculate_Eigenvectors>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %rcx,-0x50(%rbp)
  mov    %r8d,-0x54(%rbp)
  mov    -0x54(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x24(%rbp)
  jmp    L74
L97:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  pxor   %xmm0,%xmm0
  comisd %xmm1,%xmm0
  jbe    L134
  movl   $0x0,-0x2c(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L112
L20:
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movl   $0x0,-0x28(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  jmp    L102
L42:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  -0x10(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  -0x8(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  mov    -0x54(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,-0x20(%rbp)
  addl   $0x1,-0x28(%rbp)
L102:
  mov    -0x28(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jle    L42
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  -0x10(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x54(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,-0x18(%rbp)
  addl   $0x1,-0x2c(%rbp)
L112:
  mov    -0x2c(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jl     L20
  jmp    L23
L134:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm1,%xmm0
  jp     L23
  pxor   %xmm1,%xmm1
  ucomisd %xmm1,%xmm0
  jne    L23
  movl   $0x0,-0x2c(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L115
L62:
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  movl   $0x0,-0x28(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  jmp    L14
L98:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  -0x10(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  addl   $0x1,-0x28(%rbp)
  mov    -0x54(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,-0x20(%rbp)
L14:
  mov    -0x28(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jle    L98
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  -0x10(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x2c(%rbp)
  mov    -0x54(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,-0x18(%rbp)
L115:
  mov    -0x2c(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jl     L62
L23:
  subl   $0x1,-0x24(%rbp)
L74:
  cmpl   $0x0,-0x24(%rbp)
  jns    L97
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void Calculate_Eigenvectors(double *H, double *S, double eigen_real[], double eigen_imag[], int n) {
  double *pH;
  double *pS;
  double x, y;
  int i, j, k;
  for (k = n - 1; k >= 0; k--) {
    if (eigen_imag[k] < 0.0) {
      for (i = 0, pS = S; i < n; pS += n, i++) {
        x = 0.0;
        y = 0.0;
        for (j = 0, pH = H; j <= k; pH += n, j++) {
          x += pS[j] * pH[k - 1];
          y += pS[j] * pH[k];
        }
        pS[k - 1] = x;
        pS[k] = y;
      }
    } else if (eigen_imag[k] == 0.0) {
      for (i = 0, pS = S; i < n; i++, pS += n) {
        x = 0.0;
        for (j = 0, pH = H; j <= k; j++, pH += n)
          x += pS[j] * pH[k];
        pS[k] = x;
      }
    }
  }
}
```