user: Please show me the C implementation that matches the assembly code listed below:

```asm
<MMF_ISP_VGAto1280_1024New>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdx,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  test   %rdx,%rdx
  je     L56
  mov    %esi,%eax
  cmp    $0x1e0,%di
  mov    %rcx,%rdx
  setne  %sil
  cmp    $0x280,%ax
  mov    $0xffffffff,%eax
  setne  %cl
  or     %cl,%sil
  mov    %sil,-0xd(%rsp)
  jne    L104
  mov    D65(%rip),%eax
  mov    D45(%rip),%ebx
  mov    %rdx,%r15
  movl   $0x0,-0x20(%rsp)
  mov    D64(%rip),%edi
  mov    %eax,-0xc(%rsp)
  mov    %ebx,-0x4(%rsp)
  mov    %edi,-0x8(%rsp)
  mov    %edi,-0x14(%rsp)
  mov    %ebx,-0x18(%rsp)
  mov    %eax,-0x1c(%rsp)
  nopw   0x0(%rax,%rax,1)
L5:
  mov    -0x1c(%rsp),%ebx
  mov    %ebx,%eax
  sub    -0x14(%rsp),%eax
  cmp    %ebx,-0x18(%rsp)
  jne    L42
  addl   $0x1,-0x14(%rsp)
  addl   $0x10,-0x18(%rsp)
  movb   $0x1,-0xd(%rsp)
L42:
  mov    %eax,%r13d
  and    $0x1,%r13d
  jne    L11
  sar    %eax
  lea    (%rax,%rax,4),%ebx
  shl    $0x7,%ebx
  mov    %ebx,%eax
L77:
  cltq
  xor    %edi,%edi
  movslq %ebx,%rbx
  mov    %rax,-0x30(%rsp)
  jmp    L151
  nopl   0x0(%rax)
L164:
  mov    %edi,%eax
  sar    %eax
  cltq
  lea    (%rbx,%rax,1),%rdx
  movzwl (%r14,%rdx,2),%ecx
  mov    %ecx,%r8d
  mov    %ecx,%r11d
  sar    $0x5,%ecx
  sar    $0xb,%r11d
  and    $0x3f,%ecx
  and    $0x1f,%r8d
  test   %r13d,%r13d
  jne    L105
  mov    %r8d,%r10d
  mov    %ecx,%r9d
  mov    %r11d,%eax
L23:
  add    %r11d,%eax
  lea    (%rcx,%r9,1),%edx
  lea    (%r8,%r10,1),%esi
  sar    %eax
  sar    %edx
  sar    %esi
L75:
  shl    $0xb,%eax
  shl    $0x5,%edx
  or     %edx,%eax
  or     %esi,%eax
  mov    %ax,(%r15,%rdi,2)
  add    $0x1,%rdi
  cmp    $0x500,%rdi
  je     L74
L151:
  test   $0x1,%dil
  je     L164
  lea    -0x1(%rdi),%eax
  sar    %eax
  movslq %eax,%rdx
  add    $0x1,%eax
  movslq %eax,%rbp
  lea    (%rdx,%rbx,1),%rcx
  lea    0x0(%rbp,%rbx,1),%rax
  movzwl (%r14,%rcx,2),%r9d
  movzwl (%r14,%rax,2),%ecx
  mov    %r9d,%r10d
  mov    %r9d,%eax
  sar    $0x5,%r9d
  mov    %ecx,%r8d
  mov    %ecx,%r11d
  sar    $0x5,%ecx
  and    $0x3f,%r9d
  sar    $0xb,%eax
  sar    $0xb,%r11d
  and    $0x3f,%ecx
  and    $0x1f,%r10d
  and    $0x1f,%r8d
  test   %r13d,%r13d
  je     L23
  mov    -0x30(%rsp),%rsi
  add    %r11d,%eax
  add    %ecx,%r9d
  add    %r8d,%r10d
  add    %rsi,%rdx
  add    %rsi,%rbp
  movzwl (%r14,%rdx,2),%edx
  movzwl (%r14,%rbp,2),%ebp
  mov    %edx,%esi
  mov    %dx,-0x24(%rsp)
  sar    $0x5,%edx
  mov    %ebp,%r12d
  sar    $0xb,%esi
  mov    %ebp,%r11d
  and    $0x3f,%edx
  sar    $0x5,%ebp
  add    %esi,%eax
  mov    -0x24(%rsp),%esi
  sar    $0xb,%r11d
  add    %r9d,%edx
  and    $0x3f,%ebp
  and    $0x1f,%r12d
  add    %r11d,%eax
  and    $0x1f,%esi
  add    %ebp,%edx
  sar    $0x2,%eax
  add    %r10d,%esi
  sar    $0x2,%edx
  add    %r12d,%esi
  sar    $0x2,%esi
  jmp    L75
  xchg   %ax,%ax
L105:
  add    -0x30(%rsp),%rax
  movzwl (%r14,%rax,2),%edx
  mov    %edx,%esi
  mov    %edx,%eax
  sar    $0x5,%edx
  sar    $0xb,%eax
  and    $0x3f,%edx
  and    $0x1f,%esi
  add    %r11d,%eax
  add    %ecx,%edx
  add    %r8d,%esi
  sar    %eax
  sar    %edx
  sar    %esi
  jmp    L75
L74:
  addl   $0x500,-0x20(%rsp)
  mov    -0x20(%rsp),%eax
  add    $0xa00,%r15
  addl   $0x1,-0x1c(%rsp)
  cmp    $0x5000,%eax
  jne    L5
  cmpb   $0x0,-0xd(%rsp)
  je     L33
  mov    -0x14(%rsp),%eax
  mov    %eax,D3(%rip)
  mov    -0x18(%rsp),%eax
  mov    %eax,D3(%rip)
L52:
  mov    -0xc(%rsp),%ebx
  xor    %edx,%edx
  lea    0x10(%rbx),%eax
  cmp    $0x3f0,%ebx
  cmove  %edx,%eax
  cmpl   $0x400,-0x18(%rsp)
  mov    %eax,D3(%rip)
  jne    L143
  movl   $0x0,D3(%rip)
L143:
  cmpl   $0x40,-0x14(%rsp)
  mov    $0x1,%eax
  je     L169
L104:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L11:
  sub    $0x1,%eax
  sar    %eax
  lea    (%rax,%rax,4),%ebx
  shl    $0x7,%ebx
  lea    0x280(%rbx),%eax
  jmp    L77
L169:
  movl   $0x0,D3(%rip)
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L33:
  mov    -0x8(%rsp),%eax
  mov    %eax,-0x14(%rsp)
  mov    -0x4(%rsp),%eax
  mov    %eax,-0x18(%rsp)
  jmp    L52
L56:
  pop    %rbx
  mov    $0xffffffff,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int MMF_ISP_VGAto1280_1024New(unsigned short hei, unsigned short wid, unsigned short *rgb_buf, unsigned short *output_buf) {
  int x, y;
  int m_min, n_min, m_max, n_max;
  int R_max_max, G_max_max, B_max_max;
  int R_max_min, G_max_min, B_max_min;
  int R_min_max, G_min_max, B_min_max;
  int R_min_min, G_min_min, B_min_min;
  int piex_min_min;
  int piex_min_max;
  int piex_max_min;
  int piex_max_max;
  int R, G, B;
  int row_min, row_max;
  int y_temp;
  static int line_temp = 0;
  static int a = 0;
  static int u = 0;
  if (rgb_buf == 0)
    return -1;
  if ((hei != 480) || (wid != 640)) {
    return -1;
  }
  for (y = line_temp; y < line_temp + 16; y++) {
    if (y == a) {
      y_temp = y - u;
      u++;
      a = a + 16;
    } else {
      y_temp = y - u;
    }
    if ((y_temp & 0x0001) == 0) {
      m_min = (y_temp >> 1);
      m_max = m_min;
      row_min = m_min * wid;
      row_max = row_min;
    } else {
      m_min = ((y_temp - 1) >> 1);
      m_max = m_min + 1;
      row_min = m_min * wid;
      row_max = row_min + wid;
    }
    for (x = 0; x < 1280; x++) {
      if ((x & 0x0001) == 0) {
        n_min = (x >> 1);
        piex_min_min = (int)(*(rgb_buf + row_min + n_min));
        piex_max_min = (int)(*(rgb_buf + row_max + n_min));
        R_min_min = (int)(piex_min_min >> 11);
        R_min_max = R_min_min;
        R_max_min = (int)(piex_max_min >> 11);
        R_max_max = R_max_min;
        G_min_min = (int)((piex_min_min & 0x07ff) >> 5);
        G_min_max = G_min_min;
        G_max_min = (int)((piex_max_min & 0x07ff) >> 5);
        G_max_max = G_max_min;
        B_min_min = (int)(piex_min_min & 0x001f);
        B_min_max = B_min_min;
        B_max_min = (int)(piex_max_min & 0x001f);
        B_max_max = B_max_min;
      } else {
        n_min = ((x - 1) >> 1);
        n_max = n_min + 1;
        piex_min_min = (int)(*(rgb_buf + row_min + n_min));
        piex_min_max = (int)(*(rgb_buf + row_min + n_max));
        piex_max_min = (int)(*(rgb_buf + row_max + n_min));
        piex_max_max = (int)(*(rgb_buf + row_max + n_max));
        R_min_min = (int)(piex_min_min >> 11);
        R_min_max = (int)(piex_min_max >> 11);
        R_max_min = (int)(piex_max_min >> 11);
        R_max_max = (int)(piex_max_max >> 11);
        G_min_min = (int)((piex_min_min & 0x07ff) >> 5);
        G_min_max = (int)((piex_min_max & 0x07ff) >> 5);
        G_max_min = (int)((piex_max_min & 0x07ff) >> 5);
        G_max_max = (int)((piex_max_max & 0x07ff) >> 5);
        B_min_min = (int)(piex_min_min & 0x001f);
        B_min_max = (int)(piex_min_max & 0x001f);
        B_max_min = (int)(piex_max_min & 0x001f);
        B_max_max = (int)(piex_max_max & 0x001f);
      }
      if ((y_temp & 0x0001) == 0) {
        R = (R_min_min + R_min_max) >> 1;
        G = (G_min_min + G_min_max) >> 1;
        B = (B_min_min + B_min_max) >> 1;
      } else if ((x & 0x0001) == 0) {
        R = (R_min_min + R_max_min) >> 1;
        G = (G_min_min + G_max_min) >> 1;
        B = (B_min_min + B_max_min) >> 1;
      } else {
        R = (R_min_min + R_min_max + R_max_min + R_max_max) >> 2;
        G = (G_min_min + G_min_max + G_max_min + G_max_max) >> 2;
        B = (B_min_min + B_min_max + B_max_min + B_max_max) >> 2;
      }
      output_buf[(y - line_temp) * 1280 + x] = ((unsigned short)R << 11) | (((unsigned short)G << 5) & 0x07ff) | ((unsigned short)B & 0x001f);
    }
  }
  line_temp = line_temp + 16;
  if (line_temp == 1024) {
    line_temp = 0;
  }
  if (a == 1024) {
    a = 0;
  }
  if (u == 64) {
    u = 0;
  }
  return 1;
}
```