user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<filter_c_3d_median>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x98,%rsp
  mov    %rdi,%rbx
  mov    %esi,%ebp
  mov    %edx,0x50(%rsp)
  mov    %ecx,%r15d
  mov    %r8,%r14
  mov    0xe0(%rsp),%r12d
  mov    %r12d,%eax
  imul   %r12d,%eax
  imul   %r12d,%eax
  mov    %eax,0x18(%rsp)
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,%r13
  mov    %r12d,%esi
  shr    $0x1f,%esi
  mov    %esi,%eax
  add    %r12d,%eax
  mov    %eax,%esi
  sar    %esi
  mov    %esi,0x54(%rsp)
  mov    0x18(%rsp),%edi
  mov    %edi,%eax
  shr    $0x1f,%eax
  add    %edi,%eax
  sar    %eax
  mov    0x50(%rsp),%edx
  mov    %edx,%ecx
  imul   %r15d,%ecx
  mov    %ecx,0x68(%rsp)
  sub    %esi,%ebp
  mov    %ebp,0x6c(%rsp)
  cmp    %ebp,%esi
  jge    L90
  mov    %ecx,%r11d
  mov    %esi,%edi
  cltq
  lea    0x0(%r13,%rax,4),%rax
  mov    %rax,0x58(%rsp)
  movslq %ecx,%rax
  shl    $0x2,%rax
  mov    %rax,(%rsp)
  mov    %edx,%ecx
  imul   %edx,%esi
  mov    %esi,%eax
  cltq
  mov    %edi,%esi
  imul   %r11d,%esi
  movslq %esi,%rdx
  add    %rdx,%rax
  lea    (%r14,%rax,4),%rax
  mov    %rax,0x40(%rsp)
  mov    %edi,%esi
  movslq %edi,%rax
  mov    %rax,0x30(%rsp)
  neg    %rax
  shl    $0x2,%rax
  movslq %ecx,%rdi
  mov    %rdi,0x70(%rsp)
  lea    0x0(,%rdi,4),%rbp
  lea    -0x1(%r12),%edi
  mov    %edi,0x64(%rsp)
  mov    %r12d,%edi
  imul   %r12d,%edi
  mov    %edi,0xc(%rsp)
  mov    %esi,0x10(%rsp)
  movl   $0x0,0x4c(%rsp)
  sub    %esi,%ecx
  mov    %ecx,0x1c(%rsp)
  sub    %esi,%r15d
  mov    %r15d,0x60(%rsp)
  sub    %r13,%rax
  mov    %rax,0x88(%rsp)
  mov    %r12d,0xe0(%rsp)
  mov    %rbp,%r12
  mov    %rbx,%rbp
  mov    0xe0(%rsp),%ebx
  jmp    L100
L132:
  mov    %eax,%r8d
L79:
  movslq %esi,%rdx
  lea    0x0(%r13,%rdx,4),%rax
  lea    (%r10,%rdx,1),%rcx
  lea    (%r9,%rcx,4),%rcx
  neg    %rdx
  lea    (%rdi,%rdx,4),%rdx
  add    %rbp,%rdx
L5:
  movss  (%rdx,%rax,1),%xmm0
  movss  %xmm0,(%rax)
  add    $0x4,%rax
  cmp    %rcx,%rax
  jne    L5
  add    %ebx,%esi
  lea    0x1(%r8),%eax
  add    %r12,%rdi
  cmp    %eax,%ebx
  jne    L132
  add    0xc(%rsp),%r11d
  lea    0x1(%r15),%eax
  add    (%rsp),%r14
  cmp    %r15d,%r8d
  je     L8
  mov    %eax,%r15d
L66:
  mov    %r14,%rdi
  mov    %r11d,%esi
  mov    $0x0,%r8d
  jmp    L79
L8:
  mov    0x18(%rsp),%eax
  lea    -0x1(%rax),%edx
  mov    $0x0,%esi
  mov    %r13,%rdi
  call   <inkernel_quicksort@plt>
  mov    0x58(%rsp),%rax
  movss  (%rax),%xmm0
  mov    0x78(%rsp),%rdi
  mov    0x20(%rsp),%rax
  movss  %xmm0,(%rdi,%rax,4)
  add    $0x1,%rax
  mov    %rax,0x20(%rsp)
  addq   $0x4,0x28(%rsp)
  cmp    %eax,0x60(%rsp)
  jle    L122
L102:
  mov    0x28(%rsp),%r14
  mov    $0x0,%r11d
  mov    $0x0,%r15d
  mov    0x64(%rsp),%r10d
  lea    0x4(%r13),%r9
  test   %ebx,%ebx
  jg     L66
  jmp    L8
L122:
  addl   $0x1,0x14(%rsp)
  mov    0x14(%rsp),%eax
  mov    0x50(%rsp),%esi
  add    %esi,0x48(%rsp)
  mov    0x70(%rsp),%rsi
  add    %rsi,0x38(%rsp)
  cmp    0x1c(%rsp),%eax
  je     L147
L36:
  mov    0x60(%rsp),%esi
  cmp    %esi,0x54(%rsp)
  jge    L122
  movslq 0x48(%rsp),%rax
  add    0x80(%rsp),%rax
  mov    0x88(%rsp),%rdi
  lea    (%rdi,%rax,4),%rax
  mov    %rax,0x28(%rsp)
  mov    0x40(%rsp),%rax
  mov    0x38(%rsp),%rsi
  lea    (%rax,%rsi,4),%rax
  mov    %rax,0x78(%rsp)
  mov    0x30(%rsp),%rax
  mov    %rax,0x20(%rsp)
  jmp    L102
L147:
  addl   $0x1,0x10(%rsp)
  mov    0x10(%rsp),%eax
  mov    (%rsp),%rsi
  add    %rsi,0x40(%rsp)
  mov    0x68(%rsp),%esi
  add    %esi,0x4c(%rsp)
  cmp    0x6c(%rsp),%eax
  je     L90
L100:
  mov    0x54(%rsp),%eax
  mov    0x1c(%rsp),%esi
  cmp    %esi,%eax
  jge    L147
  mov    %eax,0x14(%rsp)
  movq   $0x0,0x38(%rsp)
  movl   $0x0,0x48(%rsp)
  movslq 0x4c(%rsp),%rax
  add    0x30(%rsp),%rax
  mov    %rax,0x80(%rsp)
  jmp    L36
L90:
  add    $0x98,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

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