user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<_ccv_median>:
  endbr64
  push   %r14
  mov    %rdi,%r11
  push   %r13
  push   %r12
  movslq %esi,%r12
  lea    (%r12,%rdx,1),%ecx
  push   %rbp
  mov    %ecx,%r13d
  push   %rbx
  shr    $0x1f,%r13d
  add    %ecx,%r13d
  sar    %r13d
  cmp    %edx,%r12d
  jge    L97
  lea    0x1(%r12),%eax
  mov    %edx,%ebp
  cmp    %edx,%eax
  je     L37
  nopl   0x0(%rax,%rax,1)
L17:
  mov    %ecx,%edx
  movslq %ebp,%rsi
  shr    $0x1f,%edx
  lea    (%r11,%rsi,4),%r8
  add    %ecx,%edx
  mov    (%r8),%edi
  sar    %edx
  movslq %edx,%rdx
  lea    (%r11,%rdx,4),%rdx
  mov    (%rdx),%ecx
  cmp    %edi,%ecx
  jle    L39
  mov    %edi,(%rdx)
  mov    %ecx,%edi
  mov    %ecx,(%r8)
L39:
  movslq %r12d,%rcx
  shl    $0x2,%rcx
  lea    (%r11,%rcx,1),%rbx
  mov    (%rbx),%esi
  cmp    %edi,%esi
  jle    L50
  mov    %edi,(%rbx)
  mov    %esi,(%r8)
  mov    (%rbx),%esi
L50:
  mov    (%rdx),%edi
  cmp    %esi,%edi
  jle    L25
  mov    %esi,(%rdx)
  mov    %edi,(%rbx)
  mov    (%rdx),%edi
L25:
  lea    0x4(%r11,%rcx,1),%rcx
  add    $0x1,%eax
  mov    (%rcx),%esi
  movslq %eax,%r8
  mov    %esi,(%rdx)
  mov    %ebp,%edx
  mov    %edi,(%rcx)
  mov    (%rbx),%esi
L93:
  mov    (%r11,%r8,4),%r10d
  mov    %r8d,%r14d
  cmp    %esi,%r10d
  jl     L124
  movslq %edx,%rax
  lea    -0x4(%r11,%rax,4),%rax
  nopl   0x0(%rax)
L81:
  mov    %rax,%rdi
  mov    (%rax),%ecx
  mov    %edx,%r9d
  sub    $0x4,%rax
  sub    $0x1,%edx
  cmp    %esi,%ecx
  jg     L81
  cmp    %r8d,%edx
  jl     L38
  mov    %ecx,(%r11,%r8,4)
  mov    %r10d,(%rdi)
  mov    (%rbx),%esi
L124:
  add    $0x1,%r8
  jmp    L93
  nop
L38:
  mov    %ecx,(%rbx)
  mov    %esi,(%rdi)
  cmp    %edx,%r13d
  jge    L56
  lea    -0x2(%r9),%ebp
  cmp    %r12d,%ebp
  jle    L97
L102:
  lea    0x1(%r12),%eax
  cmp    %ebp,%eax
  je     L37
  lea    (%r12,%rbp,1),%ecx
  jmp    L17
L56:
  movslq %r14d,%r12
  cmp    %r12d,%ebp
  jg     L102
L97:
  movslq %r13d,%r13
  pop    %rbx
  pop    %rbp
  mov    (%r11,%r13,4),%eax
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L37:
  movslq %ebp,%rbp
  lea    (%r11,%r12,4),%rcx
  lea    (%r11,%rbp,4),%rax
  mov    (%rcx),%edx
  mov    (%rax),%esi
  cmp    %esi,%edx
  jle    L97
  movslq %r13d,%r13
  mov    %esi,(%rcx)
  mov    %edx,(%rax)
  pop    %rbx
  mov    (%r11,%r13,4),%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
int _ccv_median(int *buf, int low, int high) {
  int middle, ll, hh, w;
  int median = (low + high) / 2;
  for (;;) {
    if (high <= low)
      return buf[median];
    if (high == low + 1) {
      if (buf[low] > buf[high])
        ((w) = (buf[low]), (buf[low]) = (buf[high]), (buf[high]) = (w));
      return buf[median];
    }
    middle = (low + high) / 2;
    if (buf[middle] > buf[high])
      ((w) = (buf[middle]), (buf[middle]) = (buf[high]), (buf[high]) = (w));
    if (buf[low] > buf[high])
      ((w) = (buf[low]), (buf[low]) = (buf[high]), (buf[high]) = (w));
    if (buf[middle] > buf[low])
      ((w) = (buf[middle]), (buf[middle]) = (buf[low]), (buf[low]) = (w));
    ((w) = (buf[middle]), (buf[middle]) = (buf[low + 1]), (buf[low + 1]) = (w));
    ll = low + 1;
    hh = high;
    for (;;) {
      do
        ll++;
      while (buf[low] > buf[ll]);
      do
        hh--;
      while (buf[hh] > buf[low]);
      if (hh < ll)
        break;
      ((w) = (buf[ll]), (buf[ll]) = (buf[hh]), (buf[hh]) = (w));
    }
    ((w) = (buf[low]), (buf[low]) = (buf[hh]), (buf[hh]) = (w));
    if (hh <= median)
      low = ll;
    else if (hh >= median)
      high = hh - 1;
  }
}
```