user: Demonstrate the C code that generates the assembly output below:

```asm
<sad4_one_macroblock>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x2d8,%rsp
  mov    %rdi,0x90(%rsp)
  mov    %rdx,0x28(%rsp)
  mov    %ecx,%edi
  mov    %r8d,0xb4(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x2c8(%rsp)
  xor    %eax,%eax
  mov    %r9d,%eax
  shl    $0x4,%eax
  mov    %eax,0x20(%rsp)
  lea    -0x11(%rax),%edx
  mov    %edx,0xa4(%rsp)
  mov    0x310(%rsp),%edx
  shl    $0x4,%edx
  mov    %edx,0x54(%rsp)
  sub    $0x11,%edx
  mov    %edx,0xa0(%rsp)
  movslq %eax,%r8
  add    %r8,%r8
  mov    %rsi,%rcx
  lea    0xc0(%rsp),%rsi
  mov    %rsi,0xb8(%rsp)
  lea    0x2c0(%rsp),%r9
L139:
  mov    $0x0,%eax
L56:
  movzwl (%rcx,%rax,1),%edx
  mov    %dx,(%rsi,%rax,1)
  add    $0x2,%rax
  cmp    $0x20,%rax
  jne    L56
  add    %r8,%rcx
  add    $0x20,%rsi
  cmp    %r9,%rsi
  jne    L139
  movl   $0x1,0x84(%rsp)
  mov    0xb4(%rsp),%esi
  cmp    $0xf,%esi
  jle    L11
  mov    0x20(%rsp),%eax
  sub    $0x20,%eax
  cmp    %esi,%eax
  jle    L181
  cmp    $0xf,%edi
  jg     L180
L181:
  movl   $0x1,0x84(%rsp)
L11:
  lea    -0x10(%rdi),%eax
  mov    %eax,0x88(%rsp)
  mov    0x20(%rsp),%esi
  imul   %esi,%eax
  mov    %eax,0x8c(%rsp)
  lea    0x0(,%rsi,4),%eax
  mov    %eax,0x78(%rsp)
  movq   $0x0,0xa8(%rsp)
  movl   $0x0,0xb0(%rsp)
  mov    0x84(%rsp),%eax
  mov    %eax,0x9c(%rsp)
  jmp    L28
L180:
  mov    0x54(%rsp),%eax
  sub    $0x20,%eax
  cmp    %edi,%eax
  setle  %al
  movzbl %al,%eax
  mov    %eax,0x84(%rsp)
  jmp    L11
L25:
  mov    0x20(%rsp),%r8d
  mov    0x54(%rsp),%ecx
  mov    0x50(%rsp),%edx
  mov    0x1c(%rsp),%esi
  mov    0x28(%rsp),%rdi
  call   <create_padded_row@plt>
  mov    %rax,%rbp
L142:
  addl   $0x1,0x1c(%rsp)
  movswl 0x0(%rbp),%edi
  movswl (%rbx),%eax
  sub    %eax,%edi
  call   <abs@plt>
  mov    %rax,%r12
  movswl 0x2(%rbp),%edi
  movswl 0x2(%rbx),%eax
  sub    %eax,%edi
  call   <abs@plt>
  add    %eax,%r12d
  add    (%rsp),%r12d
  movswl 0x4(%rbp),%edi
  movswl 0x4(%rbx),%eax
  sub    %eax,%edi
  call   <abs@plt>
  lea    (%r12,%rax,1),%r15d
  movswl 0x6(%rbp),%edi
  movswl 0x6(%rbx),%eax
  sub    %eax,%edi
  call   <abs@plt>
  add    %eax,%r15d
  mov    %r15d,(%rsp)
  movswl 0x8(%rbp),%edi
  movswl 0x8(%rbx),%eax
  sub    %eax,%edi
  call   <abs@plt>
  mov    %rax,%r12
  movswl 0xa(%rbp),%edi
  movswl 0xa(%rbx),%eax
  sub    %eax,%edi
  call   <abs@plt>
  add    %eax,%r12d
  add    0x4(%rsp),%r12d
  movswl 0xc(%rbp),%edi
  movswl 0xc(%rbx),%eax
  sub    %eax,%edi
  call   <abs@plt>
  lea    (%r12,%rax,1),%r14d
  movswl 0xe(%rbp),%edi
  movswl 0xe(%rbx),%eax
  sub    %eax,%edi
  call   <abs@plt>
  add    %eax,%r14d
  mov    %r14d,0x4(%rsp)
  movswl 0x10(%rbp),%edi
  movswl 0x10(%rbx),%eax
  sub    %eax,%edi
  call   <abs@plt>
  mov    %rax,%r12
  movswl 0x12(%rbp),%edi
  movswl 0x12(%rbx),%eax
  sub    %eax,%edi
  call   <abs@plt>
  add    %eax,%r12d
  add    0x8(%rsp),%r12d
  movswl 0x14(%rbp),%edi
  movswl 0x14(%rbx),%eax
  sub    %eax,%edi
  call   <abs@plt>
  lea    (%r12,%rax,1),%r13d
  movswl 0x16(%rbp),%edi
  movswl 0x16(%rbx),%eax
  sub    %eax,%edi
  call   <abs@plt>
  add    %eax,%r13d
  mov    %r13d,0x8(%rsp)
  movswl 0x18(%rbp),%edi
  movswl 0x18(%rbx),%eax
  sub    %eax,%edi
  call   <abs@plt>
  mov    %rax,%r12
  movswl 0x1a(%rbp),%edi
  movswl 0x1a(%rbx),%eax
  sub    %eax,%edi
  call   <abs@plt>
  add    %eax,%r12d
  add    0xc(%rsp),%r12d
  movswl 0x1c(%rbp),%edi
  movswl 0x1c(%rbx),%eax
  sub    %eax,%edi
  call   <abs@plt>
  add    %eax,%r12d
  add    $0x20,%rbx
  movswl 0x1e(%rbp),%edi
  movswl -0x2(%rbx),%eax
  sub    %eax,%edi
  call   <abs@plt>
  add    %eax,%r12d
  mov    %r12d,0xc(%rsp)
  mov    0x20(%rsp),%ecx
  add    %ecx,0x18(%rsp)
  cmp    0x10(%rsp),%rbx
  je     L85
L123:
  cmpl   $0x0,0x24(%rsp)
  jne    L25
  movslq 0x18(%rsp),%rax
  add    0x30(%rsp),%rax
  mov    0x28(%rsp),%rdx
  lea    (%rdx,%rax,2),%rbp
  jmp    L142
L85:
  addl   $0x4,0x44(%rsp)
  mov    0x38(%rsp),%rsi
  mov    %r15w,(%rsi)
  mov    %rsi,%rax
  sub    0x48(%rsp),%rax
  mov    0x58(%rsp),%rcx
  mov    %r14w,(%rax,%rcx,1)
  mov    0x60(%rsp),%rdx
  mov    %r13w,(%rax,%rdx,1)
  mov    0x68(%rsp),%rcx
  mov    %r12w,(%rax,%rcx,1)
  subq   $0xffffffffffffff80,0x10(%rsp)
  mov    0x10(%rsp),%rax
  add    $0x2240,%rsi
  mov    %rsi,0x38(%rsp)
  mov    0x78(%rsp),%esi
  add    %esi,0x40(%rsp)
  cmp    0x70(%rsp),%rax
  je     L57
L185:
  mov    0x10(%rsp),%rax
  lea    -0x80(%rax),%rbx
  mov    0x40(%rsp),%eax
  mov    %eax,0x18(%rsp)
  mov    0x44(%rsp),%eax
  mov    %eax,0x1c(%rsp)
  movl   $0x0,0xc(%rsp)
  movl   $0x0,0x8(%rsp)
  movl   $0x0,0x4(%rsp)
  movl   $0x0,(%rsp)
  jmp    L123
L57:
  addq   $0x2,0x48(%rsp)
  addl   $0x1,0x80(%rsp)
  addq   $0x1,0x30(%rsp)
  addl   $0x1,0x7c(%rsp)
  mov    0x7c(%rsp),%edx
  mov    0x98(%rsp),%eax
  add    $0x469,%eax
  cmp    %eax,%edx
  je     L3
L105:
  mov    0x88(%rsp),%eax
  mov    %eax,0x44(%rsp)
  mov    0x80(%rsp),%edx
  mov    %edx,%esi
  mov    %edx,0x50(%rsp)
  mov    0x9c(%rsp),%ecx
  mov    %ecx,0x24(%rsp)
  cmpl   $0x0,0x84(%rsp)
  je     L22
  cmp    %eax,0xa0(%rsp)
  jl     L22
  or     %eax,%edx
  mov    %edx,%eax
  shr    $0x1f,%eax
  cmp    %esi,0xa4(%rsp)
  setl   %dl
  movzbl %dl,%edx
  or     %eax,%edx
  mov    %edx,0x24(%rsp)
L22:
  mov    0x7c(%rsp),%ecx
  movslq %ecx,%rax
  add    %rax,%rax
  mov    %rax,0x58(%rsp)
  lea    0x448(%rcx),%eax
  cltq
  add    %rax,%rax
  mov    %rax,0x60(%rsp)
  lea    0x890(%rcx),%eax
  cltq
  add    %rax,%rax
  mov    %rax,0x68(%rsp)
  lea    0x140(%rsp),%rax
  mov    %rax,0x10(%rsp)
  mov    0x90(%rsp),%rax
  add    0x48(%rsp),%rax
  mov    %rax,0x38(%rsp)
  mov    0x8c(%rsp),%eax
  mov    %eax,0x40(%rsp)
  jmp    L185
L3:
  addl   $0x21,0xb0(%rsp)
  mov    0xb0(%rsp),%eax
  addl   $0x1,0x88(%rsp)
  mov    0x20(%rsp),%edx
  add    %edx,0x8c(%rsp)
  addq   $0x42,0xa8(%rsp)
  cmp    $0x441,%eax
  je     L166
L28:
  mov    0xb4(%rsp),%eax
  lea    -0x10(%rax),%esi
  mov    %esi,0x80(%rsp)
  cltq
  sub    $0x10,%rax
  mov    %rax,0x30(%rsp)
  mov    0xb0(%rsp),%eax
  mov    %eax,0x98(%rsp)
  add    $0x448,%eax
  mov    %eax,0x7c(%rsp)
  mov    0xa8(%rsp),%rax
  mov    %rax,0x48(%rsp)
  mov    0xb8(%rsp),%rax
  add    $0x280,%rax
  mov    %rax,0x70(%rsp)
  jmp    L105
L166:
  mov    0x2c8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L154
  add    $0x2d8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L154:
  call   <__stack_chk_fail@plt>
```

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;
      }
    }
  }
}
```