user: 请将以下的汇编代码转换成C语言代码：

```asm
<qc_imag_bay2rgb_horip>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x78,%rsp
  mov    %rdi,0x40(%rsp)
  mov    %rdx,%rbx
  mov    %rdx,0x48(%rsp)
  mov    %ecx,%eax
  mov    0xb0(%rsp),%r14d
  mov    %r9d,%edx
  shr    $0x1f,%edx
  lea    (%rdx,%r9,1),%edx
  sar    %edx
  mov    %edx,0x54(%rsp)
  lea    (%r14,%r14,1),%edx
  movslq %edx,%rcx
  mov    %rcx,0x20(%rsp)
  lea    (%rax,%rax,1),%edx
  movslq %edx,%rdx
  mov    %rdx,0x58(%rsp)
  movslq %eax,%rdx
  mov    %rdx,0x60(%rsp)
  mov    %rbx,%rax
  add    %rdx,%rax
  mov    %rax,0x30(%rsp)
  movslq %r14d,%r10
  mov    %r10,0x8(%rsp)
  lea    -0x2(%r8),%edx
  mov    %edx,%eax
  shr    $0x1f,%eax
  add    %edx,%eax
  sar    %eax
  lea    -0x1(%rax),%edx
  lea    0x1(%rdx),%rax
  imul   %rcx,%rax
  add    %r10,%rax
  add    %rbx,%rax
  mov    %rax,0x38(%rsp)
  lea    (%rsi,%rsi,1),%eax
  cltq
  mov    %rax,0x68(%rsp)
  lea    0x3(%rdi,%rdx,2),%rax
  mov    %rax,0x18(%rsp)
  movslq %esi,%rax
  mov    %rax,0x28(%rsp)
L13:
  mov    0x40(%rsp),%rbx
  movzbl (%rbx),%ecx
  movzbl 0x1(%rbx),%edx
  mov    0x28(%rsp),%rbp
  movzbl (%rbx,%rbp,1),%r8d
  mov    %r14d,%esi
  mov    0x48(%rsp),%r12
  mov    %r12,%rdi
  call   <qc_imag_writergb@plt>
  movzbl (%rbx),%ecx
  movzbl 0x1(%rbx),%edx
  movzbl (%rbx,%rbp,1),%r8d
  mov    %r14d,%esi
  mov    0x30(%rsp),%r13
  mov    %r13,%rdi
  call   <qc_imag_writergb@plt>
  mov    %rbx,%rax
  lea    0x1(%rbx),%rbx
  mov    %r12,%r15
  mov    0x8(%rsp),%rsi
  add    %rsi,%r15
  add    %rax,%rbp
  add    %rsi,%r13
  mov    %r13,0x10(%rsp)
L18:
  movzbl 0x0(%rbp),%r13d
  movzbl 0x2(%rbp),%eax
  add    %eax,%r13d
  shr    %r13d
  movzbl -0x1(%rbx),%ecx
  movzbl 0x1(%rbx),%eax
  add    %eax,%ecx
  shr    %ecx
  movzbl (%rbx),%edx
  mov    %r13d,%r8d
  mov    %r14d,%esi
  mov    %r15,%rdi
  call   <qc_imag_writergb@plt>
  movzbl (%rbx),%r12d
  movzbl 0x2(%rbx),%eax
  add    %eax,%r12d
  shr    %r12d
  movzbl 0x1(%rbx),%ecx
  mov    0x8(%rsp),%rax
  lea    (%r15,%rax,1),%rdi
  movzbl 0x2(%rbp),%r8d
  mov    %r12d,%edx
  mov    %r14d,%esi
  call   <qc_imag_writergb@plt>
  movzbl 0x1(%rbp),%ecx
  movzbl (%rbx),%edx
  mov    %r13d,%r8d
  mov    %r14d,%esi
  mov    0x10(%rsp),%r13
  mov    %r13,%rdi
  call   <qc_imag_writergb@plt>
  movzbl 0x1(%rbx),%ecx
  mov    %r13,%rdi
  add    0x8(%rsp),%rdi
  movzbl 0x2(%rbp),%r8d
  mov    %r12d,%edx
  mov    %r14d,%esi
  call   <qc_imag_writergb@plt>
  add    $0x2,%rbx
  mov    0x20(%rsp),%rax
  add    %rax,%r15
  add    $0x2,%rbp
  add    %rax,%r13
  mov    %r13,0x10(%rsp)
  cmp    0x18(%rsp),%rbx
  jne    L18
  movzbl -0x1(%rbx),%ecx
  movzbl (%rbx),%edx
  mov    0x28(%rsp),%r15
  movzbl -0x1(%rbx,%r15,1),%r8d
  mov    %r14d,%esi
  mov    0x38(%rsp),%rbp
  mov    %rbp,%rdi
  call   <qc_imag_writergb@plt>
  mov    0x60(%rsp),%r12
  add    %r12,%rbp
  movzbl (%rbx,%r15,1),%ecx
  movzbl (%rbx),%edx
  movzbl -0x1(%rbx,%r15,1),%r8d
  mov    %r14d,%esi
  mov    %rbp,%rdi
  call   <qc_imag_writergb@plt>
  mov    0x68(%rsp),%rsi
  add    %rsi,0x40(%rsp)
  mov    0x58(%rsp),%rdx
  add    %rdx,0x48(%rsp)
  add    %rdx,0x30(%rsp)
  add    %r12,%rbp
  mov    %rbp,0x38(%rsp)
  add    %rsi,0x18(%rsp)
  subl   $0x1,0x54(%rsp)
  jne    L13
  add    $0x78,%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);
}
```