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

```asm
<reverse_it>:
  endbr64
  mov    %rsi,%rcx
  mov    %edx,%r8d
  mov    %edx,%r9d
  shr    $0x1f,%r9d
  add    %edx,%r9d
  sar    %r9d
  cmp    $0x7,%edx
  jle    L58
  mov    %r9d,%eax
  sar    $0x1f,%eax
  shr    $0x1e,%eax
  lea    (%r9,%rax,1),%edx
  and    $0x3,%edx
  sub    %eax,%edx
  mov    %edx,%eax
  test   %edx,%edx
  jle    L75
  movslq %r8d,%rsi
  shl    $0x3,%rsi
  mov    $0x0,%edx
L65:
  movsd  -0x8(%rdi,%rsi,1),%xmm0
  movsd  %xmm0,(%rcx,%rdx,8)
  movsd  (%rdi,%rdx,8),%xmm0
  movsd  %xmm0,-0x8(%rcx,%rsi,1)
  add    $0x1,%rdx
  sub    $0x8,%rsi
  cmp    %edx,%eax
  jg     L65
L46:
  cmp    %eax,%r9d
  jle    L66
  cltq
  movslq %r8d,%r8
  sub    %rax,%r8
  lea    -0x20(,%r8,8),%rdx
  lea    (%rdi,%rdx,1),%rsi
  add    %rcx,%rdx
L23:
  movsd  0x18(%rsi),%xmm0
  movsd  %xmm0,(%rcx,%rax,8)
  movsd  0x10(%rsi),%xmm0
  movsd  %xmm0,0x8(%rcx,%rax,8)
  movsd  0x8(%rsi),%xmm0
  movsd  %xmm0,0x10(%rcx,%rax,8)
  movsd  (%rsi),%xmm0
  movsd  %xmm0,0x18(%rcx,%rax,8)
  movsd  (%rdi,%rax,8),%xmm0
  movsd  %xmm0,0x18(%rdx)
  movsd  0x8(%rdi,%rax,8),%xmm0
  movsd  %xmm0,0x10(%rdx)
  movsd  0x10(%rdi,%rax,8),%xmm0
  movsd  %xmm0,0x8(%rdx)
  movsd  0x18(%rdi,%rax,8),%xmm0
  movsd  %xmm0,(%rdx)
  add    $0x4,%rax
  sub    $0x20,%rsi
  sub    $0x20,%rdx
  cmp    %eax,%r9d
  jg     L23
  ret
L75:
  mov    $0x0,%eax
  jmp    L46
L58:
  cmp    $0x2,%r9d
  je     L24
  cmp    $0x3,%r9d
  je     L6
  movslq %edx,%r8
  shl    $0x3,%r8
  movsd  -0x8(%rdi,%r8,1),%xmm0
  movsd  %xmm0,(%rsi)
  movsd  (%rdi),%xmm0
  movsd  %xmm0,-0x8(%rsi,%r8,1)
L66:
  ret
L24:
  movslq %edx,%r8
  shl    $0x3,%r8
  movsd  -0x8(%rdi,%r8,1),%xmm0
  movsd  %xmm0,(%rsi)
  movsd  -0x10(%rdi,%r8,1),%xmm0
  movsd  %xmm0,0x8(%rsi)
  movsd  (%rdi),%xmm0
  movsd  %xmm0,-0x8(%rsi,%r8,1)
  movsd  0x8(%rdi),%xmm0
  movsd  %xmm0,-0x10(%rsi,%r8,1)
  ret
L6:
  movslq %edx,%r8
  shl    $0x3,%r8
  movsd  -0x8(%rdi,%r8,1),%xmm0
  movsd  %xmm0,(%rsi)
  movsd  -0x10(%rdi,%r8,1),%xmm0
  movsd  %xmm0,0x8(%rsi)
  movsd  -0x18(%rdi,%r8,1),%xmm0
  movsd  %xmm0,0x10(%rsi)
  movsd  (%rdi),%xmm0
  movsd  %xmm0,-0x8(%rsi,%r8,1)
  movsd  0x8(%rdi),%xmm0
  movsd  %xmm0,-0x10(%rsi,%r8,1)
  movsd  0x10(%rdi),%xmm0
  movsd  %xmm0,-0x18(%rsi,%r8,1)
  ret
```

assistant: ```c
void reverse_it(double *input, double *output, int n) {
  int i, len;
  len = n / 2;
  if (len >= 4) {
    for (i = 0; i < (len % 4); ++i) {
      output[i] = input[n - 1 - i];
      output[n - 1 - i] = input[i];
    }
    for (; i < len; i += 4) {
      output[i] = input[n - i - 1];
      output[i + 1] = input[n - i - 2];
      output[i + 2] = input[n - i - 3];
      output[i + 3] = input[n - i - 4];
      output[n - i - 1] = input[i];
      output[n - i - 2] = input[i + 1];
      output[n - i - 3] = input[i + 2];
      output[n - i - 4] = input[i + 3];
    }
  } else if (len == 2) {
    output[0] = input[n - 1];
    output[1] = input[n - 2];
    output[n - 1] = input[0];
    output[n - 2] = input[1];
  } else if (len == 3) {
    output[0] = input[n - 1];
    output[1] = input[n - 2];
    output[2] = input[n - 3];
    output[n - 1] = input[0];
    output[n - 2] = input[1];
    output[n - 3] = input[2];
  } else {
    output[0] = input[n - 1];
    output[n - 1] = input[0];
  }
}
```