user: Translate the below assembly code into C programming language:

```asm
<median>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %rdi,0x10(%rsp)
  mov    %edx,0xc(%rsp)
  mov    %ecx,0x3c(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  test   %ecx,%ecx
  jle    L47
  test   %edx,%edx
  jle    L47
  mov    %rsi,%r15
  lea    -0x1(%rdx),%esi
  xor    %r14d,%r14d
  xor    %r12d,%r12d
  cmp    %esi,%edx
  mov    %esi,0x34(%rsp)
  lea    -0x1(%rcx),%eax
  cmovle %edx,%esi
  mov    %eax,0x28(%rsp)
  mov    %esi,0x8(%rsp)
  nop
L383:
  mov    0x34(%rsp),%eax
  test   %eax,%eax
  jne    L376
  movslq %r14d,%rax
  xor    %edx,%edx
  mov    %rax,0x20(%rsp)
L368:
  mov    0x20(%rsp),%rsi
  movslq %edx,%rax
  mov    0xc(%rsp),%ecx
  lea    (%rax,%rsi,1),%rdi
  mov    0x10(%rsp),%rsi
  sub    %edx,%ecx
  lea    0x1(%r15,%rdi,1),%r10
  lea    -0x1(%rcx),%r8d
  add    %rdi,%rsi
  mov    %rsi,%r9
  sub    %r10,%r9
  cmp    $0xe,%r9
  jbe    L176
  cmp    %edx,0xc(%rsp)
  setg   %r10b
  cmp    $0x6,%r8d
  seta   %r9b
  test   %r9b,%r10b
  je     L173
  cmp    %edx,0xc(%rsp)
  mov    $0x1,%eax
  cmovle %eax,%ecx
  cmp    $0xe,%r8d
  jbe    L146
  mov    %ecx,%r8d
  lea    (%r15,%rdi,1),%r9
  xor    %eax,%eax
  shr    $0x4,%r8d
  shl    $0x4,%r8
  nopl   0x0(%rax)
L286:
  movdqu (%r9,%rax,1),%xmm0
  movups %xmm0,(%rsi,%rax,1)
  add    $0x10,%rax
  cmp    %rax,%r8
  jne    L286
  mov    %ecx,%eax
  and    $0xfffffff0,%eax
  add    %eax,%edx
  cmp    %ecx,%eax
  je     L387
L167:
  sub    %eax,%ecx
  lea    -0x1(%rcx),%esi
  cmp    $0x6,%esi
  jbe    L351
  add    %rdi,%rax
  mov    0x10(%rsp),%rbx
  mov    (%r15,%rax,1),%rsi
  mov    %rsi,(%rbx,%rax,1)
  mov    %ecx,%eax
  and    $0xfffffff8,%eax
  add    %eax,%edx
  cmp    %eax,%ecx
  je     L387
L351:
  lea    (%r14,%rdx,1),%eax
  mov    0x10(%rsp),%rsi
  mov    0xc(%rsp),%edi
  cltq
  movzbl (%r15,%rax,1),%ecx
  mov    %cl,(%rsi,%rax,1)
  lea    0x1(%rdx),%eax
  cmp    %eax,%edi
  jle    L387
  add    %r14d,%eax
  cltq
  movzbl (%r15,%rax,1),%ecx
  mov    %cl,(%rsi,%rax,1)
  lea    0x2(%rdx),%eax
  cmp    %eax,%edi
  jle    L387
  add    %r14d,%eax
  cltq
  movzbl (%r15,%rax,1),%ecx
  mov    %cl,(%rsi,%rax,1)
  lea    0x3(%rdx),%eax
  cmp    %eax,%edi
  jle    L387
  add    %r14d,%eax
  cltq
  movzbl (%r15,%rax,1),%ecx
  mov    %cl,(%rsi,%rax,1)
  lea    0x4(%rdx),%eax
  cmp    %eax,%edi
  jle    L387
  add    %r14d,%eax
  cltq
  movzbl (%r15,%rax,1),%ecx
  mov    %cl,(%rsi,%rax,1)
  lea    0x5(%rdx),%eax
  cmp    %eax,%edi
  jle    L387
  add    %r14d,%eax
  add    $0x6,%edx
  cltq
  movzbl (%r15,%rax,1),%ecx
  mov    %cl,(%rsi,%rax,1)
  cmp    %edx,%edi
  jle    L387
  add    %r14d,%edx
  movslq %edx,%rax
  movzbl (%r15,%rax,1),%edx
  mov    %dl,(%rsi,%rax,1)
L387:
  add    $0x1,%r12d
  add    0xc(%rsp),%r14d
  cmp    %r12d,0x3c(%rsp)
  jne    L383
L47:
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L34
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L376:
  mov    0x10(%rsp),%r11
  movslq %r14d,%rbx
  lea    0x1(%r14),%edi
  mov    0x34(%rsp),%eax
  mov    %rbx,0x20(%rsp)
  lea    (%r15,%rbx,1),%r13
  mov    %r14d,%ecx
  sub    0xc(%rsp),%ecx
  add    %rbx,%r11
  lea    -0x1(%r14),%ebx
  mov    %edi,0x30(%rsp)
  lea    (%r14,%rax,1),%esi
  mov    %ebx,0x2c(%rsp)
  sub    $0x1,%ecx
  xor    %eax,%eax
  mov    %r14d,0x38(%rsp)
  mov    %r11,%r14
  nopl   0x0(%rax,%rax,1)
L149:
  movzbl 0x0(%r13,%rax,1),%r8d
  test   %r12d,%r12d
  je     L250
  cmp    %r12d,0x28(%rsp)
  jle    L250
  test   %eax,%eax
  je     L250
  movslq %ecx,%rdx
  lea    0x1(%rcx),%r10d
  lea    0x1(%rsi),%r9d
  add    $0x2,%ecx
  movzbl (%r15,%rdx,1),%ebx
  movslq %r10d,%rdx
  movslq %ecx,%rcx
  movzbl (%r15,%rdx,1),%edi
  mov    0x2c(%rsp),%edx
  mov    %rcx,0x18(%rsp)
  lea    (%rdx,%rax,1),%r11d
  mov    0x30(%rsp),%edx
  movslq %r11d,%r11
  lea    (%rdx,%rax,1),%ebp
  movslq %esi,%rdx
  add    $0x2,%esi
  mov    %rdx,%rcx
  movslq %r9d,%rdx
  movslq %ebp,%rbp
  movslq %esi,%rsi
  movzbl (%r15,%rdx,1),%edx
  movzbl (%r15,%rcx,1),%ecx
  movzbl (%r15,%rbp,1),%ebp
  movzbl (%r15,%rsi,1),%esi
  shl    $0x8,%rdx
  or     %rcx,%rdx
  mov    0x18(%rsp),%rcx
  shl    $0x8,%rdx
  or     %rbp,%rdx
  movzbl (%r15,%rcx,1),%ecx
  shl    $0x8,%rdx
  or     %r8,%rdx
  movzbl (%r15,%r11,1),%r8d
  shl    $0x8,%rdx
  or     %r8,%rdx
  shl    $0x8,%rdx
  or     %rcx,%rdx
  movzbl %dil,%ecx
  shl    $0x8,%rdx
  or     %rcx,%rdx
  movzbl %bl,%ecx
  shl    $0x8,%rdx
  or     %rcx,%rdx
  mov    %rdx,0x48(%rsp)
  mov    $0x8,%edx
  jmp    L227
  nopl   0x0(%rax,%rax,1)
L48:
  movzbl 0x4a(%rsp),%ecx
  cmp    %cl,%dil
  jbe    L302
  mov    %dil,0x4a(%rsp)
  mov    %cl,0x49(%rsp)
  mov    %edi,%ecx
L302:
  cmp    $0x2,%edx
  je     L25
  movzbl 0x4b(%rsp),%edi
  xor    %ebx,%ebx
  mov    %dil,%bl
  mov    %cl,%bh
  cmp    %dil,%cl
  jbe    L100
  mov    %bx,0x4a(%rsp)
  mov    %ecx,%edi
L100:
  cmp    $0x3,%edx
  je     L25
  movzbl 0x4c(%rsp),%ecx
  cmp    %cl,%dil
  jbe    L32
  mov    %dil,0x4c(%rsp)
  mov    %cl,0x4b(%rsp)
  mov    %edi,%ecx
L32:
  cmp    $0x4,%edx
  je     L25
  movzbl 0x4d(%rsp),%edi
  xor    %ebx,%ebx
  mov    %dil,%bl
  mov    %cl,%bh
  cmp    %dil,%cl
  jbe    L411
  mov    %bx,0x4c(%rsp)
  mov    %ecx,%edi
L411:
  cmp    $0x5,%edx
  je     L25
  movzbl 0x4e(%rsp),%ecx
  cmp    %cl,%dil
  jbe    L275
  mov    %dil,0x4e(%rsp)
  mov    %cl,0x4d(%rsp)
  mov    %edi,%ecx
L275:
  cmp    $0x6,%edx
  je     L25
  movzbl 0x4f(%rsp),%edi
  xor    %ebx,%ebx
  mov    %dil,%bl
  mov    %cl,%bh
  cmp    %dil,%cl
  jbe    L161
  mov    %bx,0x4e(%rsp)
  mov    %ecx,%edi
L161:
  cmp    $0x8,%edx
  jne    L25
  cmp    %dil,%sil
  jae    L25
  mov    %sil,0x4f(%rsp)
  mov    %edi,%esi
L25:
  movzbl 0x48(%rsp),%ebx
  movzbl 0x49(%rsp),%edi
  sub    $0x1,%edx
L227:
  xor    %ecx,%ecx
  mov    %dil,%cl
  mov    %bl,%ch
  cmp    %dil,%bl
  jbe    L60
  mov    %cx,0x48(%rsp)
  mov    %ebx,%edi
L60:
  cmp    $0x1,%edx
  jne    L48
  movzbl 0x4c(%rsp),%edx
  mov    %dl,(%r14,%rax,1)
  nop
L215:
  lea    0x1(%rax),%edx
  mov    %r10d,%ecx
  add    $0x1,%rax
  mov    %r9d,%esi
  cmp    %eax,0x8(%rsp)
  jg     L149
  mov    0x38(%rsp),%r14d
  cmp    %edx,0xc(%rsp)
  jg     L368
  jmp    L387
  nopl   0x0(%rax,%rax,1)
L250:
  mov    %r8b,(%r14,%rax,1)
  lea    0x1(%rcx),%r10d
  lea    0x1(%rsi),%r9d
  jmp    L215
L173:
  mov    0x20(%rsp),%rdi
  mov    0x10(%rsp),%rbx
  lea    (%r15,%rdi,1),%rsi
  lea    (%rbx,%rdi,1),%rcx
  mov    0xc(%rsp),%edi
  nopl   0x0(%rax)
L374:
  movzbl (%rsi,%rax,1),%edx
  mov    %dl,(%rcx,%rax,1)
  add    $0x1,%rax
  cmp    %eax,%edi
  jg     L374
  jmp    L387
L176:
  mov    0x20(%rsp),%rbx
  mov    0x10(%rsp),%rdi
  lea    (%r15,%rbx,1),%rsi
  lea    (%rdi,%rbx,1),%rcx
  mov    0xc(%rsp),%edi
  jmp    L374
L146:
  xor    %eax,%eax
  jmp    L167
L34:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void median(unsigned char *out, unsigned char *in, int w, int h) {
  int i, j, m, n;
  unsigned char sort[9];
  unsigned char tmp;
  for (i = 0; i < h; i++) {
    for (j = 0; j < w; j++) {
      if (i > 0 && i < h - 1 && j > 0 && j < w - 1) {
        for (m = -1; m <= +1; m++) {
          for (n = -1; n <= +1; n++) {
            sort[(m + 1) * 3 + (n + 1)] = in[(i + m) * w + (j + n)];
          }
        }
        for (m = 0; m < 8; m++) {
          for (n = 0; n < 8 - m; n++) {
            if (sort[n] > sort[n + 1]) {
              tmp = sort[n];
              sort[n] = sort[n + 1];
              sort[n + 1] = tmp;
            }
          }
        }
        out[i * w + j] = sort[4];
      } else {
        out[i * w + j] = in[i * w + j];
      }
    }
  }
}
```