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

```asm
<filter_c_2d_median>:
  endbr64
  push   %r15
  push   %r14
  mov    %rcx,%r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  sub    $0x88,%rsp
  mov    0xc0(%rsp),%ebx
  mov    %esi,0x20(%rsp)
  mov    %ebx,%edx
  mov    %ebx,%r12d
  imul   %ebx,%edx
  shr    $0x1f,%r12d
  add    %ebx,%r12d
  sar    %r12d
  lea    0x0(,%rdx,4),%edi
  mov    %edx,0x8(%rsp)
  call   <malloc@plt>
  mov    0x20(%rsp),%esi
  mov    0x8(%rsp),%edx
  mov    %rax,%r15
  mov    %esi,%edi
  mov    %edx,%eax
  sub    %r12d,%edi
  sar    %eax
  mov    %edi,0x70(%rsp)
  cmp    %edi,%r12d
  jge    L63
  mov    %ebp,%edi
  cltq
  sub    %r12d,%edi
  lea    (%r15,%rax,4),%rax
  mov    %edi,0x5c(%rsp)
  mov    %rax,0x50(%rsp)
  cmp    %edi,%r12d
  jge    L63
  movslq %esi,%rax
  imul   %r12d,%esi
  mov    %ebx,%ebp
  mov    %r12d,0x6c(%rsp)
  lea    0x0(,%rax,4),%rdi
  and    $0xfffffffc,%ebp
  movl   $0x0,0x58(%rsp)
  mov    %rdi,0x8(%rsp)
  movslq %esi,%rax
  lea    -0x1(%rdx),%esi
  lea    (%r14,%rax,4),%rax
  mov    %esi,0x68(%rsp)
  lea    0x1(%rbp),%r14d
  mov    %rax,0x48(%rsp)
  movslq %ebx,%rax
  shl    $0x2,%rax
  sub    %rax,%rdi
  mov    %rax,0x10(%rsp)
  movslq %r12d,%rax
  mov    %rax,0x78(%rsp)
  mov    %ebx,%eax
  shr    $0x2,%eax
  mov    %rdi,0x18(%rsp)
  sub    $0x1,%eax
  mov    %rax,0x60(%rsp)
  lea    0x2(%rbp),%eax
  mov    %eax,0x74(%rsp)
  lea    -0x1(%rbx),%eax
  mov    %eax,0x24(%rsp)
  lea    0x4(,%rax,4),%rax
  mov    %rax,0x40(%rsp)
L17:
  movslq 0x58(%rsp),%rax
  mov    %r15,%rdi
  mov    0x74(%rsp),%r15d
  lea    0x4(%r13,%rax,4),%rax
  mov    %rax,0x38(%rsp)
  mov    0x78(%rsp),%rax
  mov    %rax,0x30(%rsp)
  nopw   0x0(%rax,%rax,1)
L81:
  test   %ebx,%ebx
  jle    L0
  mov    0x60(%rsp),%rax
  mov    0x38(%rsp),%r10
  mov    %rdi,%rcx
  xor    %esi,%esi
  mov    $0xfffffffffffffffc,%rdx
  mov    0x58(%rsp),%r8d
  xor    %r9d,%r9d
  add    0x30(%rsp),%r8d
  add    $0x1,%rax
  sub    %rdi,%rdx
  shl    $0x4,%rax
  add    %r10,%rdx
  mov    %rax,0x28(%rsp)
  xchg   %ax,%ax
L55:
  mov    %rcx,%r11
  mov    %rcx,%rax
  sub    %r10,%r11
  cmp    $0x8,%r11
  jbe    L5
  cmpl   $0x2,0x24(%rsp)
  jbe    L5
  mov    0x28(%rsp),%r11
  add    %rcx,%r11
  cs nopw 0x0(%rax,%rax,1)
L16:
  movups (%rax,%rdx,1),%xmm1
  add    $0x10,%rax
  movups %xmm1,-0x10(%rax)
  cmp    %r11,%rax
  jne    L16
  cmp    %ebp,%ebx
  je     L104
  lea    (%r8,%rbp,1),%eax
  sub    %r12d,%eax
  cltq
  movss  0x0(%r13,%rax,4),%xmm0
  lea    (%rsi,%rbp,1),%eax
  cltq
  movss  %xmm0,(%rdi,%rax,4)
  cmp    %r14d,%ebx
  jle    L104
  lea    (%r14,%r8,1),%eax
  sub    %r12d,%eax
  cltq
  movss  0x0(%r13,%rax,4),%xmm0
  lea    (%rsi,%r14,1),%eax
  cltq
  movss  %xmm0,(%rdi,%rax,4)
  cmp    %r15d,%ebx
  jle    L104
  lea    (%r8,%r15,1),%eax
  sub    %r12d,%eax
  cltq
  movss  0x0(%r13,%rax,4),%xmm0
  lea    (%rsi,%r15,1),%eax
  cltq
  movss  %xmm0,(%rdi,%rax,4)
L104:
  add    $0x1,%r9d
  add    0x10(%rsp),%rcx
  add    0x8(%rsp),%r10
  add    %ebx,%esi
  add    0x20(%rsp),%r8d
  add    0x18(%rsp),%rdx
  cmp    %r9d,%ebx
  jne    L55
L0:
  mov    0x68(%rsp),%edx
  xor    %esi,%esi
  mov    %rdi,0x28(%rsp)
  call   <inkernel_quicksort@plt>
  mov    0x50(%rsp),%rax
  mov    0x48(%rsp),%rsi
  addq   $0x4,0x38(%rsp)
  mov    0x28(%rsp),%rdi
  movss  (%rax),%xmm0
  mov    0x30(%rsp),%rax
  movss  %xmm0,(%rsi,%rax,4)
  add    $0x1,%rax
  cmp    %eax,0x5c(%rsp)
  mov    %rax,0x30(%rsp)
  jg     L81
  addl   $0x1,0x6c(%rsp)
  mov    %rdi,%r15
  mov    0x6c(%rsp),%eax
  mov    0x20(%rsp),%edi
  add    %edi,0x58(%rsp)
  mov    0x8(%rsp),%rdi
  add    %rdi,0x48(%rsp)
  cmp    0x70(%rsp),%eax
  jne    L17
L63:
  add    $0x88,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L5:
  mov    0x40(%rsp),%rax
  lea    (%rax,%rcx,1),%r11
  mov    %rcx,%rax
  nopl   0x0(%rax)
L25:
  movss  (%rdx,%rax,1),%xmm0
  add    $0x4,%rax
  movss  %xmm0,-0x4(%rax)
  cmp    %r11,%rax
  jne    L25
  jmp    L104
```

assistant: ```c
void filter_c_2d_median(float *im, int ny, int nx, float *res, int nyr, int nxr, int w) {
  int nwin = w * w;
  float *win = (float *)malloc(nwin * sizeof(float));
  int edgex = w / 2;
  int edgey = w / 2;
  int mpos = nwin / 2;
  int x, y, wx, wy, ind, indy, indw;
  for (y = edgey; y < (ny - edgey); ++y) {
    ind = y * ny;
    for (x = edgex; x < (nx - edgex); ++x) {
      for (wy = 0; wy < w; ++wy) {
        indw = wy * w;
        indy = ny * (y + wy - edgey);
        for (wx = 0; wx < w; ++wx) {
          win[indw + wx] = im[indy + x + wx - edgex];
        }
      }
      inkernel_quicksort(win, 0, nwin - 1);
      res[ind + x] = win[mpos];
    }
  }
}
```