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

```asm
<qc_imag_bay2rgb_horip>:
  endbr64
  push   %r15
  mov    %rdx,%r10
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  movslq %ecx,%rbx
  mov    %rbx,%rax
  add    %eax,%eax
  sub    $0x68,%rsp
  cltq
  mov    %rdx,0x40(%rsp)
  mov    %r9d,%edx
  movslq 0xa0(%rsp),%rcx
  shr    $0x1f,%edx
  mov    %rax,0x58(%rsp)
  add    %r9d,%edx
  mov    %rbx,(%rsp)
  add    %rcx,%rbx
  mov    %rcx,%r12
  sar    %edx
  mov    %rdi,0x38(%rsp)
  mov    %edx,0x4c(%rsp)
  lea    (%rcx,%rcx,1),%edx
  movslq %edx,%r9
  movslq %esi,%rdx
  add    %esi,%esi
  mov    %rcx,0x8(%rsp)
  mov    %rdx,0x30(%rsp)
  lea    -0x2(%r8),%edx
  movslq %esi,%rsi
  mov    %edx,%eax
  mov    %r9,0x18(%rsp)
  shr    $0x1f,%eax
  mov    %rbx,0x20(%rsp)
  add    %edx,%eax
  mov    %rsi,0x50(%rsp)
  sar    %eax
  lea    -0x1(%rax),%edx
  lea    0x1(%rdx),%rax
  imul   %r9,%rax
  add    %rcx,%rax
  add    %r10,%rax
  mov    %rax,0x28(%rsp)
  lea    0x3(%rdi,%rdx,2),%rax
  mov    %rax,0x10(%rsp)
  nopl   0x0(%rax,%rax,1)
L8:
  mov    0x38(%rsp),%rbx
  mov    0x30(%rsp),%r14
  mov    %r12d,%esi
  mov    0x40(%rsp),%r13
  movzbl (%rbx),%ecx
  movzbl 0x1(%rbx),%edx
  lea    0x1(%rbx),%r15
  movzbl (%rbx,%r14,1),%r8d
  mov    %r13,%rdi
  call   <qc_imag_writergb@plt>
  mov    (%rsp),%rdi
  movzbl (%rbx),%ecx
  mov    %r12d,%esi
  movzbl 0x1(%rbx),%edx
  movzbl (%rbx,%r14,1),%r8d
  add    %r13,%rdi
  call   <qc_imag_writergb@plt>
  mov    0x8(%rsp),%rbp
  mov    %rbx,%rax
  mov    %r14,%rbx
  add    %rax,%rbx
  add    %r13,%rbp
  mov    %r15,%r13
  nopl   0x0(%rax)
L0:
  movzbl 0x2(%rbx),%eax
  movzbl (%rbx),%r11d
  mov    %rbp,%rdi
  mov    %r12d,%esi
  movzbl -0x1(%r13),%ecx
  movzbl 0x0(%r13),%edx
  add    $0x2,%rbx
  add    $0x2,%r13
  add    %eax,%r11d
  movzbl -0x1(%r13),%eax
  shr    %r11d
  add    %eax,%ecx
  mov    %r11d,%r8d
  mov    %r11d,%r15d
  shr    %ecx
  call   <qc_imag_writergb@plt>
  movzbl 0x0(%r13),%eax
  movzbl (%rbx),%r8d
  mov    %r12d,%esi
  movzbl -0x2(%r13),%r10d
  movzbl -0x1(%r13),%ecx
  add    %eax,%r10d
  mov    0x8(%rsp),%rax
  mov    %r10d,%r14d
  shr    %r14d
  lea    0x0(%rbp,%rax,1),%rdi
  mov    %r14d,%edx
  call   <qc_imag_writergb@plt>
  mov    (%rsp),%rax
  movzbl -0x1(%rbx),%ecx
  mov    %r15d,%r8d
  movzbl -0x2(%r13),%edx
  mov    %r12d,%esi
  lea    0x0(%rbp,%rax,1),%rdi
  call   <qc_imag_writergb@plt>
  mov    0x20(%rsp),%rax
  mov    %r14d,%edx
  mov    %r12d,%esi
  movzbl -0x1(%r13),%ecx
  movzbl (%rbx),%r8d
  lea    0x0(%rbp,%rax,1),%rdi
  call   <qc_imag_writergb@plt>
  add    0x18(%rsp),%rbp
  cmp    0x10(%rsp),%r13
  jne    L0
  mov    0x30(%rsp),%r14
  mov    0x28(%rsp),%rbx
  mov    %r12d,%esi
  mov    %r13,%r15
  movzbl -0x1(%r13),%ecx
  movzbl 0x0(%r13),%edx
  movzbl -0x1(%r13,%r14,1),%r8d
  mov    %rbx,%rdi
  call   <qc_imag_writergb@plt>
  mov    (%rsp),%rbp
  movzbl 0x0(%r13),%edx
  mov    %r12d,%esi
  movzbl 0x0(%r13,%r14,1),%ecx
  movzbl -0x1(%r13,%r14,1),%r8d
  add    %rbp,%rbx
  mov    %rbx,%rdi
  add    %rbp,%rbx
  call   <qc_imag_writergb@plt>
  mov    0x50(%rsp),%rsi
  mov    0x58(%rsp),%rdx
  mov    %rbx,0x28(%rsp)
  add    %rsi,0x38(%rsp)
  add    %rsi,%r15
  add    %rdx,0x40(%rsp)
  subl   $0x1,0x4c(%rsp)
  mov    %r15,0x10(%rsp)
  jne    L8
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void qc_imag_bay2rgb_horip(unsigned char *bay, int bay_line, unsigned char *rgb, int rgb_line, int columns, int rows, int bpp) {
  unsigned char *cur_bay, *cur_rgb;
  int bay_line2, rgb_line2;
  int total_columns;
  unsigned char red, green, blue;
  unsigned int column_cnt, row_cnt;
  total_columns = (columns - 2) / 2;
  row_cnt = rows / 2;
  bay_line2 = 2 * bay_line;
  rgb_line2 = 2 * rgb_line;
  do {
    qc_imag_writergb(rgb + 0, bpp, bay[1], bay[0], bay[bay_line]);
    qc_imag_writergb(rgb + rgb_line, bpp, bay[1], bay[0], bay[bay_line]);
    cur_bay = bay + 1;
    cur_rgb = rgb + bpp;
    column_cnt = total_columns;
    do {
      green = ((unsigned int)cur_bay[-1] + cur_bay[1]) / 2;
      blue = ((unsigned int)cur_bay[bay_line - 1] + cur_bay[bay_line + 1]) / 2;
      qc_imag_writergb(cur_rgb + 0, bpp, cur_bay[0], green, blue);
      red = ((unsigned int)cur_bay[0] + cur_bay[2]) / 2;
      qc_imag_writergb(cur_rgb + bpp, bpp, red, cur_bay[1], cur_bay[bay_line + 1]);
      green = ((unsigned int)cur_bay[bay_line] + cur_bay[bay_line + 2]) / 2;
      qc_imag_writergb(cur_rgb + rgb_line, bpp, cur_bay[0], cur_bay[bay_line], blue);
      qc_imag_writergb(cur_rgb + rgb_line + bpp, bpp, red, cur_bay[1], cur_bay[bay_line + 1]);
      cur_bay += 2;
      cur_rgb += 2 * bpp;
    } while (--column_cnt);
    qc_imag_writergb(cur_rgb + 0, bpp, cur_bay[0], cur_bay[-1], cur_bay[bay_line - 1]);
    qc_imag_writergb(cur_rgb + rgb_line, bpp, cur_bay[0], cur_bay[bay_line], cur_bay[bay_line - 1]);
    bay += bay_line2;
    rgb += rgb_line2;
  } while (--row_cnt);
}
```