user: What would the C source look like for the assembly code provided here?

```asm
<bayer_unshuffle_preview>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %edi,0xc(%rsp)
  mov    %edx,%eax
  mov    %rcx,%rbx
  mov    %r8,0x20(%rsp)
  mov    %fs:0x28,%rdx
  mov    %rdx,0x58(%rsp)
  xor    %edx,%edx
  mov    %edi,%edx
  mov    %eax,%ecx
  sar    %cl,%edi
  mov    %edi,0x10(%rsp)
  sar    %cl,%esi
  mov    %esi,0x34(%rsp)
  mov    $0x1,%r8d
  shl    %cl,%r8d
  test   %esi,%esi
  jle    L14
  mov    %edx,%ebp
  sar    %ebp
  lea    -0x2(%rax,%rax,1),%esi
  mov    %esi,0x14(%rsp)
  lea    -0x1(%rax,%rax,1),%esi
  mov    %esi,0x18(%rsp)
  shl    %cl,%edx
  movslq %edx,%rsi
  mov    %rsi,0x28(%rsp)
  lea    -0x1(%rdi),%edx
  lea    0x3(%rdx,%rdx,2),%rdi
  mov    %rdi,0x38(%rsp)
  movl   $0x0,0x30(%rsp)
  sub    $0x1,%eax
  mov    %eax,0x1c(%rsp)
  jmp    L85
L6:
  movl   $0x0,0x4c(%rsp)
  movl   $0x0,0x50(%rsp)
  movl   $0x0,0x54(%rsp)
  test   %r8d,%r8d
  jle    L42
  mov    %r14d,%r15d
  movzbl 0x1c(%rsp),%ecx
  shl    %cl,%r15d
  mov    $0x0,%r12d
  mov    $0x0,%r11d
L5:
  mov    %r15d,%r9d
  mov    $0x0,%ecx
  mov    %r12d,%edi
  and    $0x1,%edi
L31:
  mov    %ecx,%r10d
  and    $0x1,%r10d
  sete   %dl
  movzbl %dl,%edx
  add    %edi,%edx
  movslq %edx,%rsi
  mov    %ecx,%eax
  sar    %eax
  add    %r9d,%eax
  test   %r10d,%r10d
  mov    %r11d,%r10d
  cmove  %ebp,%r10d
  add    %r10d,%eax
  cltq
  movzbl (%rbx,%rax,1),%eax
  add    0x4c(%rsp,%rsi,4),%eax
  mov    %eax,0x4c(%rsp,%rsi,4)
  add    $0x1,%ecx
  cmp    %ecx,%r8d
  jne    L31
  add    $0x1,%r12d
  add    0xc(%rsp),%r15d
  cmp    %r12d,%r8d
  jne    L5
L42:
  mov    0x4c(%rsp),%eax
  mov    0x14(%rsp),%edi
  mov    %edi,%ecx
  sar    %cl,%eax
  mov    %al,0x0(%r13)
  mov    0x50(%rsp),%eax
  movzbl 0x18(%rsp),%ecx
  sar    %cl,%eax
  mov    %al,0x1(%r13)
  mov    0x54(%rsp),%eax
  mov    %edi,%ecx
  sar    %cl,%eax
  mov    %al,0x2(%r13)
  add    $0x1,%r14d
  add    $0x3,%r13
  cmp    %r14d,0x10(%rsp)
  jne    L6
  mov    0x38(%rsp),%rdi
  add    %rdi,0x20(%rsp)
L22:
  addl   $0x1,0x30(%rsp)
  mov    0x30(%rsp),%eax
  add    0x28(%rsp),%rbx
  cmp    %eax,0x34(%rsp)
  je     L14
L85:
  mov    0x20(%rsp),%r13
  mov    $0x0,%r14d
  cmpl   $0x0,0x10(%rsp)
  jg     L6
  jmp    L22
L14:
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L97
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L97:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void bayer_unshuffle_preview(int w, int h, int scale, unsigned char *raw, unsigned char *output) {
  int x, y, nx, ny;
  int colour;
  int rgb[3];
  int nw = w >> scale;
  int nh = h >> scale;
  int incr = 1 << scale;
  for (ny = 0; ny < nh; ++ny, raw += w << scale) {
    for (nx = 0; nx < nw; ++nx, output += 3) {
      rgb[0] = 0;
      rgb[1] = 0;
      rgb[2] = 0;
      for (y = 0; y < incr; ++y) {
        for (x = 0; x < incr; ++x) {
          colour = 1 - (x & 1) + (y & 1);
          rgb[colour] += raw[y * w + (nx << (scale - 1)) + (x >> 1) + ((x & 1) ? 0 : (w >> 1))];
        }
      }
      output[0] = rgb[0] >> (2 * scale - 2);
      output[1] = rgb[1] >> (2 * scale - 1);
      output[2] = rgb[2] >> (2 * scale - 2);
    }
  }
}
```