user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<sad4_one_macroblock>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x2b0,%rsp
  mov    %rdi,-0x288(%rbp)
  mov    %rsi,-0x290(%rbp)
  mov    %rdx,-0x298(%rbp)
  mov    %ecx,-0x29c(%rbp)
  mov    %r8d,-0x2a0(%rbp)
  mov    %r9d,-0x2a4(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x2a4(%rbp),%eax
  shl    $0x4,%eax
  mov    %eax,-0x240(%rbp)
  mov    -0x240(%rbp),%eax
  sub    $0x11,%eax
  mov    %eax,-0x23c(%rbp)
  mov    0x10(%rbp),%eax
  shl    $0x4,%eax
  mov    %eax,-0x238(%rbp)
  mov    -0x238(%rbp),%eax
  sub    $0x11,%eax
  mov    %eax,-0x234(%rbp)
  movl   $0x0,-0x25c(%rbp)
  jmp    L26
L207:
  movl   $0x0,-0x260(%rbp)
  jmp    L30
L187:
  mov    -0x240(%rbp),%eax
  imul   -0x25c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x260(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x290(%rbp),%rax
  add    %rdx,%rax
  mov    -0x25c(%rbp),%edx
  mov    %edx,%ecx
  shl    $0x4,%ecx
  mov    -0x260(%rbp),%edx
  add    %edx,%ecx
  movzwl (%rax),%edx
  movslq %ecx,%rax
  mov    %dx,-0x210(%rbp,%rax,2)
  addl   $0x1,-0x260(%rbp)
L30:
  cmpl   $0xf,-0x260(%rbp)
  jle    L187
  addl   $0x1,-0x25c(%rbp)
L26:
  cmpl   $0xf,-0x25c(%rbp)
  jle    L207
  cmpl   $0xf,-0x2a0(%rbp)
  jle    L21
  mov    -0x240(%rbp),%eax
  sub    $0x20,%eax
  cmp    %eax,-0x2a0(%rbp)
  jge    L21
  cmpl   $0xf,-0x29c(%rbp)
  jle    L21
  mov    -0x238(%rbp),%eax
  sub    $0x20,%eax
  cmp    %eax,-0x29c(%rbp)
  jge    L21
  movl   $0x0,-0x268(%rbp)
  jmp    L205
L21:
  movl   $0x1,-0x268(%rbp)
L205:
  movl   $0x0,-0x264(%rbp)
  movl   $0xfffffff0,-0x270(%rbp)
  jmp    L202
L255:
  movl   $0xfffffff0,-0x274(%rbp)
  jmp    L29
L120:
  lea    -0x210(%rbp),%rax
  mov    %rax,-0x228(%rbp)
  mov    -0x288(%rbp),%rax
  mov    %rax,-0x220(%rbp)
  mov    -0x29c(%rbp),%edx
  mov    -0x270(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x254(%rbp)
  mov    -0x2a0(%rbp),%edx
  mov    -0x274(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x230(%rbp)
  cmpl   $0x0,-0x268(%rbp)
  je     L8
  cmpl   $0x0,-0x254(%rbp)
  js     L144
  mov    -0x254(%rbp),%eax
  cmp    -0x234(%rbp),%eax
  jg     L144
  cmpl   $0x0,-0x230(%rbp)
  js     L144
  mov    -0x230(%rbp),%eax
  cmp    -0x23c(%rbp),%eax
  jle    L8
L144:
  mov    $0x1,%eax
  jmp    L10
L8:
  mov    $0x0,%eax
L10:
  mov    %eax,-0x22c(%rbp)
  movl   $0x0,-0x26c(%rbp)
  jmp    L141
L101:
  movl   $0x0,-0x250(%rbp)
  movl   $0x0,-0x24c(%rbp)
  movl   $0x0,-0x248(%rbp)
  movl   $0x0,-0x244(%rbp)
  movl   $0x0,-0x258(%rbp)
  jmp    L247
L181:
  cmpl   $0x0,-0x22c(%rbp)
  je     L152
  mov    -0x240(%rbp),%edi
  mov    -0x238(%rbp),%ecx
  mov    -0x230(%rbp),%edx
  mov    -0x254(%rbp),%esi
  mov    -0x298(%rbp),%rax
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <create_padded_row@plt>
  jmp    L14
L152:
  mov    -0x254(%rbp),%eax
  imul   -0x240(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x230(%rbp),%eax
  cltq
  add    %rdx,%rax
  lea    (%rax,%rax,1),%rdx
  mov    -0x298(%rbp),%rax
  add    %rdx,%rax
L14:
  mov    %rax,-0x218(%rbp)
  addl   $0x1,-0x254(%rbp)
  mov    -0x218(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x218(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%ecx
  mov    -0x228(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x228(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%edx
  mov    %ecx,%eax
  sub    %edx,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,%edx
  mov    -0x250(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x250(%rbp)
  mov    -0x218(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x218(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%ecx
  mov    -0x228(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x228(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%edx
  mov    %ecx,%eax
  sub    %edx,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,%edx
  mov    -0x250(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x250(%rbp)
  mov    -0x218(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x218(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%ecx
  mov    -0x228(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x228(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%edx
  mov    %ecx,%eax
  sub    %edx,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,%edx
  mov    -0x250(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x250(%rbp)
  mov    -0x218(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x218(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%ecx
  mov    -0x228(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x228(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%edx
  mov    %ecx,%eax
  sub    %edx,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,%edx
  mov    -0x250(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x250(%rbp)
  mov    -0x218(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x218(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%ecx
  mov    -0x228(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x228(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%edx
  mov    %ecx,%eax
  sub    %edx,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,%edx
  mov    -0x24c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x24c(%rbp)
  mov    -0x218(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x218(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%ecx
  mov    -0x228(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x228(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%edx
  mov    %ecx,%eax
  sub    %edx,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,%edx
  mov    -0x24c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x24c(%rbp)
  mov    -0x218(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x218(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%ecx
  mov    -0x228(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x228(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%edx
  mov    %ecx,%eax
  sub    %edx,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,%edx
  mov    -0x24c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x24c(%rbp)
  mov    -0x218(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x218(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%ecx
  mov    -0x228(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x228(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%edx
  mov    %ecx,%eax
  sub    %edx,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,%edx
  mov    -0x24c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x24c(%rbp)
  mov    -0x218(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x218(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%ecx
  mov    -0x228(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x228(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%edx
  mov    %ecx,%eax
  sub    %edx,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,%edx
  mov    -0x248(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x248(%rbp)
  mov    -0x218(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x218(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%ecx
  mov    -0x228(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x228(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%edx
  mov    %ecx,%eax
  sub    %edx,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,%edx
  mov    -0x248(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x248(%rbp)
  mov    -0x218(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x218(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%ecx
  mov    -0x228(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x228(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%edx
  mov    %ecx,%eax
  sub    %edx,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,%edx
  mov    -0x248(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x248(%rbp)
  mov    -0x218(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x218(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%ecx
  mov    -0x228(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x228(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%edx
  mov    %ecx,%eax
  sub    %edx,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,%edx
  mov    -0x248(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x248(%rbp)
  mov    -0x218(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x218(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%ecx
  mov    -0x228(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x228(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%edx
  mov    %ecx,%eax
  sub    %edx,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,%edx
  mov    -0x244(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x244(%rbp)
  mov    -0x218(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x218(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%ecx
  mov    -0x228(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x228(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%edx
  mov    %ecx,%eax
  sub    %edx,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,%edx
  mov    -0x244(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x244(%rbp)
  mov    -0x218(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x218(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%ecx
  mov    -0x228(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x228(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%edx
  mov    %ecx,%eax
  sub    %edx,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,%edx
  mov    -0x244(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x244(%rbp)
  mov    -0x218(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x218(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%ecx
  mov    -0x228(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x228(%rbp)
  movzwl (%rax),%eax
  movswl %ax,%edx
  mov    %ecx,%eax
  sub    %edx,%eax
  mov    %eax,%edi
  call   <abs@plt>
  mov    %eax,%edx
  mov    -0x244(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x244(%rbp)
  addl   $0x1,-0x258(%rbp)
L247:
  cmpl   $0x3,-0x258(%rbp)
  jle    L181
  mov    -0x264(%rbp),%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x220(%rbp),%rax
  add    %rdx,%rax
  mov    -0x250(%rbp),%edx
  mov    %dx,(%rax)
  mov    -0x264(%rbp),%eax
  add    $0x448,%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x220(%rbp),%rax
  add    %rdx,%rax
  mov    -0x24c(%rbp),%edx
  mov    %dx,(%rax)
  mov    -0x264(%rbp),%eax
  add    $0x890,%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x220(%rbp),%rax
  add    %rdx,%rax
  mov    -0x248(%rbp),%edx
  mov    %dx,(%rax)
  mov    -0x264(%rbp),%eax
  add    $0xcd8,%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x220(%rbp),%rax
  add    %rdx,%rax
  mov    -0x244(%rbp),%edx
  mov    %dx,(%rax)
  addq   $0x2240,-0x220(%rbp)
  addl   $0x1,-0x26c(%rbp)
L141:
  cmpl   $0x3,-0x26c(%rbp)
  jle    L101
  addl   $0x1,-0x274(%rbp)
  addl   $0x1,-0x264(%rbp)
L29:
  cmpl   $0x10,-0x274(%rbp)
  jle    L120
  addl   $0x1,-0x270(%rbp)
L202:
  cmpl   $0x10,-0x270(%rbp)
  jle    L255
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L200
  call   <__stack_chk_fail@plt>
L200:
  leave
  ret
```

assistant: ```c
void sad4_one_macroblock(unsigned short *macroblock_sad, unsigned short *frame, unsigned short *ref, int frame_y, int frame_x, int mb_width, int mb_height) {
  unsigned short frame_mb[256];
  int pos_x, pos_y;
  int blky, pixy;
  int width = mb_width * 16;
  int max_width = width - 17;
  int height = mb_height * 16;
  int max_height = height - 17;
  int range_partly_outside;
  int pos;
  {
    int x, y;
    for (y = 0; y < 16; y++)
      for (x = 0; x < 16; x++)
        frame_mb[16 * y + x] = frame[width * y + x];
  }
  if ((frame_x >= 16) && (frame_x <= width - 16 - 17) && (frame_y >= 16) && (frame_y <= height - 16 - 17))
    range_partly_outside = 0;
  else
    range_partly_outside = 1;
  pos = 0;
  for (pos_y = -16; pos_y <= 16; pos_y++) {
    for (pos_x = -16; pos_x <= 16; pos_x++, pos++) {
      int y;
      int abs_x, abs_y;
      int do_bounds_check;
      short *curptr = frame_mb;
      short *refptr;
      unsigned short *sad_line = macroblock_sad;
      abs_y = frame_y + pos_y;
      abs_x = frame_x + pos_x;
      do_bounds_check = range_partly_outside && !(abs_y >= 0 && abs_y <= max_height && abs_x >= 0 && abs_x <= max_width);
      for (blky = 0; blky < 4; blky++) {
        int sad0 = 0, sad1 = 0, sad2 = 0, sad3 = 0;
        for (y = 0; y < 4; y++) {
          refptr = do_bounds_check ? create_padded_row(ref, abs_y, abs_x, height, width) : (short *)(ref + abs_y * width + abs_x);
          abs_y++;
          sad0 += abs(*refptr++ - *curptr++);
          sad0 += abs(*refptr++ - *curptr++);
          sad0 += abs(*refptr++ - *curptr++);
          sad0 += abs(*refptr++ - *curptr++);
          sad1 += abs(*refptr++ - *curptr++);
          sad1 += abs(*refptr++ - *curptr++);
          sad1 += abs(*refptr++ - *curptr++);
          sad1 += abs(*refptr++ - *curptr++);
          sad2 += abs(*refptr++ - *curptr++);
          sad2 += abs(*refptr++ - *curptr++);
          sad2 += abs(*refptr++ - *curptr++);
          sad2 += abs(*refptr++ - *curptr++);
          sad3 += abs(*refptr++ - *curptr++);
          sad3 += abs(*refptr++ - *curptr++);
          sad3 += abs(*refptr++ - *curptr++);
          sad3 += abs(*refptr++ - *curptr++);
        }
        sad_line[pos] = sad0;
        sad_line[1096 + pos] = sad1;
        sad_line[1096 * 2 + pos] = sad2;
        sad_line[1096 * 3 + pos] = sad3;
        sad_line += 1096 * 4;
      }
    }
  }
}
```