user: 请将以下的汇编代码转换成C语言代码:

```asm
<chroma_smooth_2x2>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xa8,%rsp
  mov    %edi,0x5c(%rsp)
  mov    %rcx,0x48(%rsp)
  mov    %r9,0x50(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x98(%rsp)
  xor    %eax,%eax
  lea    -0x5(%rsi),%eax
  mov    %eax,0x58(%rsp)
  cmp    $0x4,%eax
  jle    L31
  lea    -0x4(%rdi),%eax
  lea    (%rdi,%rdi,1),%r14d
  mov    %rdx,%r15
  mov    %r8,%r13
  mov    %eax,0x28(%rsp)
  lea    (%r14,%rdi,1),%eax
  mov    %eax,0x2c(%rsp)
  lea    0x60(%rsp),%rax
  mov    %r14d,0x38(%rsp)
  movl   $0x4,0x3c(%rsp)
  mov    %rax,0x30(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L57:
  cmpl   $0x4,0x28(%rsp)
  jle    L82
  mov    0x5c(%rsp),%ebx
  mov    0x2c(%rsp),%eax
  mov    $0x4,%r12d
  add    %ebx,%eax
  add    %eax,%ebx
  mov    %eax,0x40(%rsp)
  cltq
  lea    (%r15,%rax,4),%rax
  mov    %ebx,0x44(%rsp)
  mov    %rax,0x20(%rsp)
  movslq %ebx,%rax
  lea    (%r15,%rax,4),%rax
  mov    %rax,0x18(%rsp)
  jmp    L6
  xchg   %ax,%ax
L35:
  add    $0x2,%r12
  cmp    %r12d,0x28(%rsp)
  jle    L82
L6:
  mov    0x20(%rsp),%rax
  mov    0x18(%rsp),%rcx
  mov    %r12d,0x14(%rsp)
  movslq 0x4(%rax,%r12,4),%rax
  movslq (%rcx,%r12,4),%rdx
  mov    0x0(%r13,%rdx,4),%ebp
  add    0x0(%r13,%rax,4),%ebp
  cmp    $0x1ffff,%ebp
  jle    L35
  mov    0x38(%rsp),%eax
  xor    %r10d,%r10d
  mov    $0xfffffffe,%r9d
  add    %r12d,%eax
  mov    %eax,0xc(%rsp)
  mov    0x2c(%rsp),%eax
  add    %r12d,%eax
  mov    %eax,0x10(%rsp)
L106:
  mov    0xc(%rsp),%eax
  mov    %r9d,%ebx
  neg    %ebx
  lea    (%rax,%r9,1),%esi
  mov    0x10(%rsp),%eax
  cmovs  %r9d,%ebx
  lea    (%rax,%r9,1),%ecx
  mov    $0xfffffffe,%eax
L32:
  mov    %eax,%edx
  neg    %edx
  cmovs  %eax,%edx
  add    %ebx,%edx
  cmp    $0x4,%edx
  je     L89
  lea    0x1(%rsi),%edx
  movslq %ecx,%rdi
  lea    0x1(%rcx),%r8d
  movslq %r10d,%r11
  movslq %edx,%rdx
  movslq (%r15,%rdi,4),%rdi
  movslq %r8d,%r8
  add    $0x1,%r10d
  movslq (%r15,%rdx,4),%rdx
  mov    0x0(%r13,%rdi,4),%edi
  add    0x0(%r13,%rdx,4),%edi
  mov    %edi,%edx
  shr    $0x1f,%edx
  add    %edi,%edx
  movslq %esi,%rdi
  movslq (%r15,%rdi,4),%rdi
  sar    %edx
  mov    0x0(%r13,%rdi,4),%edi
  sub    %edx,%edi
  mov    %edi,0x60(%rsp,%r11,4)
  movslq (%r15,%r8,4),%rdi
  mov    0x0(%r13,%rdi,4),%edi
  sub    %edx,%edi
  mov    %edi,0x80(%rsp,%r11,4)
L89:
  add    $0x2,%eax
  add    %r14d,%esi
  add    %r14d,%ecx
  cmp    $0x4,%eax
  jne    L32
  add    $0x2,%r9d
  cmp    $0x4,%r9d
  jne    L106
  mov    0x30(%rsp),%rdi
  sar    %ebp
  call   <opt_med5@plt>
  lea    0x80(%rsp),%rdi
  mov    %eax,%ebx
  call   <opt_med5@plt>
  add    %ebp,%ebx
  cmp    $0x8000,%ebx
  jle    L35
  add    %eax,%ebp
  cmp    $0x8000,%ebp
  jle    L35
  movslq %ebx,%rax
  mov    $0x1bfffc,%edx
  mov    0x50(%rsp),%rsi
  mov    0x40(%rsp),%ecx
  shl    $0x2,%rax
  cmp    $0x6ffff,%ebx
  mov    0x14(%rsp),%ebx
  mov    0xe0(%rsp),%edi
  cmovge %rdx,%rax
  add    %ebx,%ecx
  add    (%rsi,%rax,1),%edi
  movslq %ecx,%rcx
  mov    %edi,%eax
  mov    0x48(%rsp),%rdi
  mov    %eax,(%rdi,%rcx,4)
  movslq %ebp,%rax
  mov    0x44(%rsp),%ecx
  shl    $0x2,%rax
  cmp    $0x6ffff,%ebp
  cmovge %rdx,%rax
  lea    0x1(%rbx,%rcx,1),%edx
  mov    0xe0(%rsp),%ecx
  add    $0x2,%r12
  movslq %edx,%rdx
  add    (%rsi,%rax,1),%ecx
  mov    %ecx,(%rdi,%rdx,4)
  cmp    %r12d,0x28(%rsp)
  jg     L6
  nopl   0x0(%rax,%rax,1)
L82:
  addl   $0x2,0x3c(%rsp)
  mov    0x3c(%rsp),%eax
  add    %r14d,0x38(%rsp)
  add    %r14d,0x2c(%rsp)
  cmp    %eax,0x58(%rsp)
  jg     L57
L31:
  mov    0x98(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L56
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L56:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void chroma_smooth_2x2(int w, int h, uint16_t *inp, uint16_t *out, int *raw2ev, int *ev2raw, int black) {
  int x, y;
  for (y = 4; y < h - 5; y += 2) {
    for (x = 4; x < w - 4; x += 2) {
      int g1 = inp[x + 1 + y * w];
      int g2 = inp[x + (y + 1) * w];
      int ge = (raw2ev[g1] + raw2ev[g2]) / 2;
      if (ge < 2 * 32768)
        continue;
      int i, j;
      int k = 0;
      int med_r[5];
      int med_b[5];
      for (i = -2; i <= 2; i += 2) {
        for (j = -2; j <= 2; j += 2) {
          if (((i) > 0 ? (i) : -(i)) + ((j) > 0 ? (j) : -(j)) == 4)
            continue;
          int r = inp[x + i + (y + j) * w];
          int g1 = inp[x + i + 1 + (y + j) * w];
          int g2 = inp[x + i + (y + j + 1) * w];
          int b = inp[x + i + 1 + (y + j + 1) * w];
          int ge = (raw2ev[g1] + raw2ev[g2]) / 2;
          med_r[k] = raw2ev[r] - ge;
          med_b[k] = raw2ev[b] - ge;
          k++;
        }
      }
      int dr = opt_med5(med_r);
      int db = opt_med5(med_b);
      if (ge + dr <= 32768)
        continue;
      if (ge + db <= 32768)
        continue;
      out[x + y * w] = ev2raw[(((((((ge + dr)) < ((14 * 32768 - 1))) ? ((ge + dr)) : ((14 * 32768 - 1)))) > ((0))) ? (((((ge + dr)) < ((14 * 32768 - 1))) ? ((ge + dr)) : ((14 * 32768 - 1)))) : ((0)))] + black;
      out[x + 1 + (y + 1) * w] = ev2raw[(((((((ge + db)) < ((14 * 32768 - 1))) ? ((ge + db)) : ((14 * 32768 - 1)))) > ((0))) ? (((((ge + db)) < ((14 * 32768 - 1))) ? ((ge + db)) : ((14 * 32768 - 1)))) : ((0)))] + black;
    }
  }
}
```