void qc_imag_bay2rgb_ip(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) / 2;
  bay_line2 = 2 * bay_line;
  rgb_line2 = 2 * rgb_line;
  qc_imag_writergb(rgb, 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] + cur_bay[bay_line]) / 3;
    blue = ((unsigned int)cur_bay[bay_line - 1] + cur_bay[bay_line + 1]) / 2;
    qc_imag_writergb(cur_rgb, 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]);
    cur_bay += 2;
    cur_rgb += 2 * bpp;
  } while (--column_cnt);
  green = ((unsigned int)cur_bay[-1] + cur_bay[bay_line]) / 2;
  qc_imag_writergb(cur_rgb, bpp, cur_bay[0], green, cur_bay[bay_line - 1]);
  bay += bay_line;
  rgb += rgb_line;
  do {
    red = ((unsigned int)bay[-bay_line + 1] + bay[bay_line + 1]) / 2;
    green = ((unsigned int)bay[-bay_line] + bay[1] + bay[bay_line]) / 3;
    qc_imag_writergb(rgb + 0, bpp, red, green, bay[0]);
    blue = ((unsigned int)bay[0] + bay[bay_line2]) / 2;
    qc_imag_writergb(rgb + rgb_line, bpp, bay[bay_line + 1], bay[bay_line],
                     blue);
    cur_bay = bay + 1;
    cur_rgb = rgb + bpp;
    column_cnt = total_columns;
    do {
      red = ((unsigned int)cur_bay[-bay_line] + cur_bay[bay_line]) / 2;
      blue = ((unsigned int)cur_bay[-1] + cur_bay[1]) / 2;
      qc_imag_writergb(cur_rgb + 0, bpp, red, cur_bay[0], blue);
      red = ((unsigned int)cur_bay[-bay_line] + cur_bay[-bay_line + 2] +
             cur_bay[bay_line] + cur_bay[bay_line + 2]) /
            4;
      green = ((unsigned int)cur_bay[0] + cur_bay[2] + cur_bay[-bay_line + 1] +
               cur_bay[bay_line + 1]) /
              4;
      qc_imag_writergb(cur_rgb + bpp, bpp, red, green, cur_bay[1]);
      green = ((unsigned int)cur_bay[0] + cur_bay[bay_line2] +
               cur_bay[bay_line - 1] + cur_bay[bay_line + 1]) /
              4;
      blue = ((unsigned int)cur_bay[-1] + cur_bay[1] + cur_bay[bay_line2 - 1] +
              cur_bay[bay_line2 + 1]) /
             4;
      qc_imag_writergb(cur_rgb + rgb_line, bpp, cur_bay[bay_line], green, blue);
      red = ((unsigned int)cur_bay[bay_line] + cur_bay[bay_line + 2]) / 2;
      blue = ((unsigned int)cur_bay[1] + cur_bay[bay_line2 + 1]) / 2;
      qc_imag_writergb(cur_rgb + rgb_line + bpp, bpp, red,
                       cur_bay[bay_line + 1], blue);
      cur_bay += 2;
      cur_rgb += 2 * bpp;
    } while (--column_cnt);
    red = ((unsigned int)cur_bay[-bay_line] + cur_bay[bay_line]) / 2;
    qc_imag_writergb(cur_rgb, bpp, red, cur_bay[0], cur_bay[-1]);
    green = ((unsigned int)cur_bay[0] + cur_bay[bay_line - 1] +
             cur_bay[bay_line2]) /
            3;
    blue = ((unsigned int)cur_bay[-1] + cur_bay[bay_line2 - 1]) / 2;
    qc_imag_writergb(cur_rgb + rgb_line, bpp, cur_bay[bay_line], green, blue);
    bay += bay_line2;
    rgb += rgb_line2;
  } while (--row_cnt);
  green = ((unsigned int)bay[-bay_line] + bay[1]) / 2;
  qc_imag_writergb(rgb, bpp, bay[-bay_line + 1], green, bay[0]);
  cur_bay = bay + 1;
  cur_rgb = rgb + bpp;
  column_cnt = total_columns;
  do {
    blue = ((unsigned int)cur_bay[-1] + cur_bay[1]) / 2;
    qc_imag_writergb(cur_rgb, bpp, cur_bay[-bay_line], cur_bay[0], blue);
    red = ((unsigned int)cur_bay[-bay_line] + cur_bay[-bay_line + 2]) / 2;
    green =
        ((unsigned int)cur_bay[0] + cur_bay[-bay_line + 1] + cur_bay[2]) / 3;
    qc_imag_writergb(cur_rgb + bpp, bpp, red, green, cur_bay[1]);
    cur_bay += 2;
    cur_rgb += 2 * bpp;
  } while (--column_cnt);
  qc_imag_writergb(cur_rgb, bpp, cur_bay[-bay_line], cur_bay[0], cur_bay[-1]);
}


x86 assembly (clang, -O0):
<qc_imag_bay2rgb_ip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x20(%rbp),%eax
sub    $0x2,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x44(%rbp)
mov    -0x24(%rbp),%eax
sub    $0x2,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x50(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%edx
mov    -0x8(%rbp),%rax
movzbl (%rax),%ecx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%r8
movzbl (%rax,%r8,1),%r8d
mov    $0x0,%al
call   1030 <qc_imag_writergb@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movslq 0x10(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x30(%rbp),%rax
movzbl -0x1(%rax),%eax
mov    -0x30(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
add    %ecx,%eax
mov    -0x30(%rbp),%rcx
movslq -0xc(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    $0x3,%ecx
xor    %edx,%edx
div    %ecx
mov    %al,-0x46(%rbp)
mov    -0x30(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x30(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,-0x47(%rbp)
mov    -0x38(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
movzbl (%rax),%edx
movzbl -0x46(%rbp),%ecx
movzbl -0x47(%rbp),%r8d
mov    $0x0,%al
call   1030 <qc_imag_writergb@plt>
mov    -0x30(%rbp),%rax
movzbl (%rax),%eax
mov    -0x30(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,-0x45(%rbp)
mov    -0x38(%rbp),%rdi
movslq 0x10(%rbp),%rax
add    %rax,%rdi
mov    0x10(%rbp),%esi
movzbl -0x45(%rbp),%edx
mov    -0x30(%rbp),%rax
movzbl 0x1(%rax),%ecx
mov    -0x30(%rbp),%rax
mov    -0xc(%rbp),%r8d
add    $0x1,%r8d
movslq %r8d,%r8
movzbl (%rax,%r8,1),%r8d
mov    $0x0,%al
call   1030 <qc_imag_writergb@plt>
mov    -0x30(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x30(%rbp)
mov    0x10(%rbp),%ecx
shl    $0x1,%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x4c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4c(%rbp)
cmp    $0x0,%eax
jne    11b0 <qc_imag_bay2rgb_ip+0xa0>
mov    -0x30(%rbp),%rax
movzbl -0x1(%rax),%eax
mov    -0x30(%rbp),%rcx
movslq -0xc(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,-0x46(%rbp)
mov    -0x38(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
movzbl (%rax),%edx
movzbl -0x46(%rbp),%ecx
mov    -0x30(%rbp),%rax
mov    -0xc(%rbp),%r8d
sub    $0x1,%r8d
movslq %r8d,%r8
movzbl (%rax,%r8,1),%r8d
mov    $0x0,%al
call   1030 <qc_imag_writergb@plt>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,-0x45(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    $0x3,%ecx
xor    %edx,%edx
div    %ecx
mov    %al,-0x46(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x10(%rbp),%esi
movzbl -0x45(%rbp),%edx
movzbl -0x46(%rbp),%ecx
mov    -0x8(%rbp),%rax
movzbl (%rax),%r8d
mov    $0x0,%al
call   1030 <qc_imag_writergb@plt>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x8(%rbp),%rcx
movslq -0x3c(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,-0x47(%rbp)
mov    -0x18(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
mov    0x10(%rbp),%esi
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%ecx
movzbl -0x47(%rbp),%r8d
mov    $0x0,%al
call   1030 <qc_imag_writergb@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movslq 0x10(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x30(%rbp),%rax
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x30(%rbp),%rcx
movslq -0xc(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,-0x45(%rbp)
mov    -0x30(%rbp),%rax
movzbl -0x1(%rax),%eax
mov    -0x30(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,-0x47(%rbp)
mov    -0x38(%rbp),%rdi
mov    0x10(%rbp),%esi
movzbl -0x45(%rbp),%edx
mov    -0x30(%rbp),%rax
movzbl (%rax),%ecx
movzbl -0x47(%rbp),%r8d
mov    $0x0,%al
call   1030 <qc_imag_writergb@plt>
mov    -0x30(%rbp),%rax
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x30(%rbp),%rcx
xor    %edx,%edx
sub    -0xc(%rbp),%edx
add    $0x2,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    -0x30(%rbp),%rcx
movslq -0xc(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    -0x30(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x2,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
shr    $0x2,%eax
mov    %al,-0x45(%rbp)
mov    -0x30(%rbp),%rax
movzbl (%rax),%eax
mov    -0x30(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
add    %ecx,%eax
mov    -0x30(%rbp),%rcx
xor    %edx,%edx
sub    -0xc(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    -0x30(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
shr    $0x2,%eax
mov    %al,-0x46(%rbp)
mov    -0x38(%rbp),%rdi
movslq 0x10(%rbp),%rax
add    %rax,%rdi
mov    0x10(%rbp),%esi
movzbl -0x45(%rbp),%edx
movzbl -0x46(%rbp),%ecx
mov    -0x30(%rbp),%rax
movzbl 0x1(%rax),%r8d
mov    $0x0,%al
call   1030 <qc_imag_writergb@plt>
mov    -0x30(%rbp),%rax
movzbl (%rax),%eax
mov    -0x30(%rbp),%rcx
movslq -0x3c(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    -0x30(%rbp),%rcx
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    -0x30(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
shr    $0x2,%eax
mov    %al,-0x46(%rbp)
mov    -0x30(%rbp),%rax
movzbl -0x1(%rax),%eax
mov    -0x30(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
add    %ecx,%eax
mov    -0x30(%rbp),%rcx
mov    -0x3c(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    -0x30(%rbp),%rcx
mov    -0x3c(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
shr    $0x2,%eax
mov    %al,-0x47(%rbp)
mov    -0x38(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
movzbl -0x46(%rbp),%ecx
movzbl -0x47(%rbp),%r8d
mov    $0x0,%al
call   1030 <qc_imag_writergb@plt>
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x30(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x2,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,-0x45(%rbp)
mov    -0x30(%rbp),%rax
movzbl 0x1(%rax),%eax
mov    -0x30(%rbp),%rcx
mov    -0x3c(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,-0x47(%rbp)
mov    -0x38(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
movslq 0x10(%rbp),%rax
add    %rax,%rdi
mov    0x10(%rbp),%esi
movzbl -0x45(%rbp),%edx
mov    -0x30(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%ecx
movzbl -0x47(%rbp),%r8d
mov    $0x0,%al
call   1030 <qc_imag_writergb@plt>
mov    -0x30(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x30(%rbp)
mov    0x10(%rbp),%ecx
shl    $0x1,%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x4c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4c(%rbp)
cmp    $0x0,%eax
jne    13fe <qc_imag_bay2rgb_ip+0x2ee>
mov    -0x30(%rbp),%rax
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x30(%rbp),%rcx
movslq -0xc(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,-0x45(%rbp)
mov    -0x38(%rbp),%rdi
mov    0x10(%rbp),%esi
movzbl -0x45(%rbp),%edx
mov    -0x30(%rbp),%rax
movzbl (%rax),%ecx
mov    -0x30(%rbp),%rax
movzbl -0x1(%rax),%r8d
mov    $0x0,%al
call   1030 <qc_imag_writergb@plt>
mov    -0x30(%rbp),%rax
movzbl (%rax),%eax
mov    -0x30(%rbp),%rcx
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    -0x30(%rbp),%rcx
movslq -0x3c(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    $0x3,%ecx
xor    %edx,%edx
div    %ecx
mov    %al,-0x46(%rbp)
mov    -0x30(%rbp),%rax
movzbl -0x1(%rax),%eax
mov    -0x30(%rbp),%rcx
mov    -0x3c(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,-0x47(%rbp)
mov    -0x38(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
movzbl -0x46(%rbp),%ecx
movzbl -0x47(%rbp),%r8d
mov    $0x0,%al
call   1030 <qc_imag_writergb@plt>
mov    -0x3c(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x40(%rbp),%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x50(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x50(%rbp)
cmp    $0x0,%eax
jne    130d <qc_imag_bay2rgb_ip+0x1fd>
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,-0x46(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edx
movzbl -0x46(%rbp),%ecx
mov    -0x8(%rbp),%rax
movzbl (%rax),%r8d
mov    $0x0,%al
call   1030 <qc_imag_writergb@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movslq 0x10(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x30(%rbp),%rax
movzbl -0x1(%rax),%eax
mov    -0x30(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,-0x47(%rbp)
mov    -0x38(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edx
mov    -0x30(%rbp),%rax
movzbl (%rax),%ecx
movzbl -0x47(%rbp),%r8d
mov    $0x0,%al
call   1030 <qc_imag_writergb@plt>
mov    -0x30(%rbp),%rax
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x30(%rbp),%rcx
xor    %edx,%edx
sub    -0xc(%rbp),%edx
add    $0x2,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,-0x45(%rbp)
mov    -0x30(%rbp),%rax
movzbl (%rax),%eax
mov    -0x30(%rbp),%rcx
xor    %edx,%edx
sub    -0xc(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    -0x30(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
add    %ecx,%eax
mov    $0x3,%ecx
xor    %edx,%edx
div    %ecx
mov    %al,-0x46(%rbp)
mov    -0x38(%rbp),%rdi
movslq 0x10(%rbp),%rax
add    %rax,%rdi
mov    0x10(%rbp),%esi
movzbl -0x45(%rbp),%edx
movzbl -0x46(%rbp),%ecx
mov    -0x30(%rbp),%rax
movzbl 0x1(%rax),%r8d
mov    $0x0,%al
call   1030 <qc_imag_writergb@plt>
mov    -0x30(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x30(%rbp)
mov    0x10(%rbp),%ecx
shl    $0x1,%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x4c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4c(%rbp)
cmp    $0x0,%eax
jne    17c7 <qc_imag_bay2rgb_ip+0x6b7>
mov    -0x38(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edx
mov    -0x30(%rbp),%rax
movzbl (%rax),%ecx
mov    -0x30(%rbp),%rax
movzbl -0x1(%rax),%r8d
mov    $0x0,%al
call   1030 <qc_imag_writergb@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qc_imag_bay2rgb_ip>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %rcx,0x28(%rsp)
mov    %rdx,%rbp
mov    %rdi,%r12
mov    0x140(%rsp),%r14d
mov    %r8d,%eax
add    $0xfffffffe,%eax
shr    $0x1f,%eax
add    %r8d,%eax
add    $0xfffffffe,%eax
sar    %eax
mov    %rax,0x40(%rsp)
add    $0xfffffffe,%r9d
mov    %r9d,0x8(%rsp)
movslq %esi,%rbx
lea    (%rbx,%rbx,1),%rax
mov    %rax,0x58(%rsp)
movzbl 0x1(%rdi),%edx
movzbl (%rdi),%ecx
lea    (%rdi,%rbx,1),%rax
mov    %rax,0x20(%rsp)
movzbl (%rdi,%rbx,1),%r8d
mov    %rbp,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <qc_imag_writergb@plt>
mov    %r14d,0x4(%rsp)
movslq %r14d,%rcx
lea    (%rcx,%rbp,1),%r14
lea    -0x1(%rbx),%rax
mov    %rax,0x18(%rsp)
lea    0x1(%rbx),%rax
mov    %rax,0x50(%rsp)
lea    (%rcx,%rcx,1),%eax
cltq
mov    %rax,0x68(%rsp)
mov    %rcx,0x30(%rsp)
mov    %rbp,0x60(%rsp)
lea    0x0(%rbp,%rcx,2),%r15
lea    (%r12,%rbx,1),%rbp
add    $0x1,%rbp
mov    %rbx,0x80(%rsp)
lea    (%rbx,%r12,1),%r13
add    $0xffffffffffffffff,%r13
add    $0x1,%r13
xor    %ebx,%ebx
mov    %r12,0x10(%rsp)
nopl   0x0(%rax,%rax,1)
movzbl (%r12,%rbx,2),%eax
movzbl 0x2(%r12,%rbx,2),%ecx
add    %eax,%ecx
movzbl 0x0(%rbp,%rbx,2),%eax
add    %ecx,%eax
imul   $0xaaab,%eax,%ecx
shr    $0x11,%ecx
movzbl 0x0(%r13,%rbx,2),%eax
movzbl 0x1(%rbp,%rbx,2),%r8d
add    %eax,%r8d
shr    %r8d
movzbl 0x1(%r12,%rbx,2),%edx
mov    %r14,%rdi
mov    0x4(%rsp),%r12d
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <qc_imag_writergb@plt>
mov    0x10(%rsp),%rax
movzbl 0x1(%rax,%rbx,2),%eax
mov    0x10(%rsp),%rcx
movzbl 0x3(%rcx,%rbx,2),%edx
add    %eax,%edx
shr    %edx
mov    0x10(%rsp),%rax
movzbl 0x2(%rax,%rbx,2),%ecx
movzbl 0x1(%rbp,%rbx,2),%r8d
mov    %r15,%rdi
mov    %r12d,%esi
mov    0x10(%rsp),%r12
xor    %eax,%eax
call   1030 <qc_imag_writergb@plt>
mov    0x68(%rsp),%rax
add    %rax,%r14
add    %rax,%r15
add    $0x1,%rbx
cmp    %ebx,0x40(%rsp)
jne    11e0 <qc_imag_bay2rgb_ip+0xd0>
mov    0x8(%rsp),%eax
mov    %eax,%r15d
shr    $0x1f,%r15d
add    %eax,%r15d
sar    %r15d
mov    0x28(%rsp),%rbp
lea    0x0(%rbp,%rbp,1),%eax
mov    %eax,0x8(%rsp)
movzbl (%r12,%rbx,2),%eax
mov    0x80(%rsp),%r13
lea    (%r12,%r13,1),%rcx
movzbl 0x1(%rcx,%rbx,2),%ecx
add    %eax,%ecx
shr    %ecx
movzbl 0x1(%r12,%rbx,2),%edx
mov    0x18(%rsp),%rax
add    %r12,%rax
movzbl 0x1(%rax,%rbx,2),%r8d
mov    %r14,%rdi
mov    0x4(%rsp),%esi
xor    %eax,%eax
call   1030 <qc_imag_writergb@plt>
movslq %ebp,%rbx
mov    0x60(%rsp),%rcx
lea    (%rcx,%rbx,1),%rdi
mov    %r13,%rax
neg    %rax
mov    %rax,0x78(%rsp)
mov    $0x1,%eax
sub    %r13d,%eax
cltq
mov    %rax,0x38(%rsp)
mov    $0x2,%eax
sub    %r13d,%eax
movslq %eax,%rsi
mov    0x58(%rsp),%rbp
movslq %ebp,%r8
add    %r13,%r8
movslq 0x8(%rsp),%rdx
mov    %rcx,%r14
mov    0x30(%rsp),%rax
lea    (%rax,%rax,1),%r11
lea    (%rbx,%rax,2),%rcx
mov    %rdx,0xc0(%rsp)
mov    %rcx,0x100(%rsp)
add    %rdx,%rcx
add    %r14,%rcx
lea    (%r12,%rbp,1),%r9
lea    (%rax,%rbx,1),%rdx
mov    %rdx,0xa0(%rsp)
lea    (%r11,%rbx,2),%rdx
mov    %rdx,0xf8(%rsp)
mov    %r13,%rdx
add    %rbp,%rdx
lea    (%r12,%rdx,1),%r11
add    $0x2,%r11
add    %r12,%r8
mov    0x18(%rsp),%rax
add    %r13,%rax
lea    (%r12,%rax,1),%r10
add    $0x1,%r10
mov    0x50(%rsp),%rdx
add    %r13,%rdx
add    %r12,%rdx
add    $0x1,%rdx
mov    %rdx,0x98(%rsp)
add    %r13,%rsi
mov    %rbx,0xc8(%rsp)
mov    0x30(%rsp),%rax
lea    (%rax,%rbx,2),%rdx
mov    %rdx,0x90(%rsp)
mov    0x38(%rsp),%rax
lea    0x0(%r13,%rax,1),%rdx
mov    %rdx,0xd0(%rsp)
lea    0x1(%r12,%rdx,1),%rax
mov    %r12,%rdx
lea    0x1(%r12,%r13,2),%r12
lea    0x3(%rdx,%rbp,1),%rbp
mov    %rbp,0x28(%rsp)
mov    %r8,%rbp
mov    %rsi,0xd8(%rsp)
lea    0x1(%rdx,%rsi,1),%rdx
mov    %r13,%r8
mov    0x40(%rsp),%esi
mov    %rsi,0xf0(%rsp)
mov    0x20(%rsp),%r13
nopl   0x0(%rax,%rax,1)
mov    %r10,0x8(%rsp)
mov    %r11,0x20(%rsp)
mov    %rbp,0xa8(%rsp)
mov    %rax,0xb0(%rsp)
mov    %rdx,0xb8(%rsp)
mov    %r15d,0x74(%rsp)
mov    %rcx,0xe8(%rsp)
mov    %r9,0x88(%rsp)
mov    0x38(%rsp),%rax
movzbl 0x0(%r13,%rax,1),%eax
mov    0x50(%rsp),%rcx
movzbl 0x0(%r13,%rcx,1),%edx
add    %eax,%edx
shr    %edx
mov    0x78(%rsp),%rax
movzbl 0x0(%r13,%rax,1),%eax
movzbl 0x1(%r13),%ecx
add    %eax,%ecx
movzbl 0x0(%r13,%r8,1),%eax
add    %ecx,%eax
imul   $0xaaab,%eax,%ecx
shr    $0x11,%ecx
mov    %r8,%rbp
movzbl 0x0(%r13),%r8d
mov    0x4(%rsp),%r15d
mov    %r15d,%esi
xor    %eax,%eax
mov    %rdi,%rbx
call   1030 <qc_imag_writergb@plt>
movzbl 0x0(%r13),%eax
mov    0x58(%rsp),%rdx
lea    (%rdx,%r13,1),%rcx
mov    %rcx,0xe0(%rsp)
movzbl 0x0(%r13,%rdx,1),%r8d
add    %eax,%r8d
shr    %r8d
mov    %rbx,0x48(%rsp)
mov    0xc8(%rsp),%rax
lea    (%rbx,%rax,1),%rdi
mov    0x50(%rsp),%rax
movzbl 0x0(%r13,%rax,1),%edx
movzbl 0x0(%r13,%rbp,1),%ecx
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <qc_imag_writergb@plt>
xor    %ebx,%ebx
mov    %r14,0x60(%rsp)
mov    %r14,%rbp
mov    %r12,0x18(%rsp)
nopl   0x0(%rax,%rax,1)
mov    0xa0(%rsp),%rax
lea    (%rax,%rbp,1),%rdi
mov    0x10(%rsp),%r14
movzbl 0x1(%r14,%rbx,2),%eax
mov    %r12,%r15
movzbl (%r12,%rbx,2),%edx
add    %eax,%edx
shr    %edx
movzbl 0x0(%r13,%rbx,2),%eax
movzbl 0x2(%r13,%rbx,2),%r8d
add    %eax,%r8d
shr    %r8d
movzbl 0x1(%r13,%rbx,2),%ecx
mov    0x4(%rsp),%r12d
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <qc_imag_writergb@plt>
movzbl 0x1(%r14,%rbx,2),%eax
mov    0xb8(%rsp),%rcx
movzbl (%rcx,%rbx,2),%ecx
add    %eax,%ecx
movzbl (%r15,%rbx,2),%eax
add    %ecx,%eax
mov    0x28(%rsp),%rcx
movzbl (%rcx,%rbx,2),%edx
add    %eax,%edx
shr    $0x2,%edx
movzbl 0x1(%r13,%rbx,2),%eax
movzbl 0x3(%r13,%rbx,2),%ecx
add    %eax,%ecx
mov    0xb0(%rsp),%rax
movzbl (%rax,%rbx,2),%eax
add    %ecx,%eax
mov    0x98(%rsp),%r14
movzbl (%r14,%rbx,2),%ecx
add    %eax,%ecx
shr    $0x2,%ecx
mov    0x100(%rsp),%rax
lea    (%rax,%rbp,1),%rdi
movzbl 0x2(%r13,%rbx,2),%r8d
mov    %r12d,%esi
mov    %r12d,%r15d
xor    %eax,%eax
call   1030 <qc_imag_writergb@plt>
movzbl 0x1(%r13,%rbx,2),%eax
mov    0x20(%rsp),%r12
movzbl -0x1(%r12,%rbx,2),%ecx
add    %eax,%ecx
mov    0x8(%rsp),%rax
movzbl (%rax,%rbx,2),%eax
add    %ecx,%eax
movzbl (%r14,%rbx,2),%ecx
add    %eax,%ecx
shr    $0x2,%ecx
movzbl 0x0(%r13,%rbx,2),%eax
movzbl 0x2(%r13,%rbx,2),%edx
add    %eax,%edx
mov    0xa8(%rsp),%rax
movzbl (%rax,%rbx,2),%eax
add    %edx,%eax
movzbl (%r12,%rbx,2),%r8d
add    %eax,%r8d
shr    $0x2,%r8d
mov    0x90(%rsp),%rax
lea    (%rax,%rbp,1),%rdi
mov    0x18(%rsp),%rax
movzbl (%rax,%rbx,2),%edx
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <qc_imag_writergb@plt>
mov    0x18(%rsp),%rax
movzbl (%rax,%rbx,2),%eax
mov    0x28(%rsp),%rcx
movzbl (%rcx,%rbx,2),%edx
add    %eax,%edx
shr    %edx
movzbl 0x2(%r13,%rbx,2),%eax
movzbl (%r12,%rbx,2),%r8d
mov    0x18(%rsp),%r12
add    %eax,%r8d
shr    %r8d
mov    0xf8(%rsp),%rax
lea    (%rax,%rbp,1),%rdi
movzbl (%r14,%rbx,2),%ecx
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <qc_imag_writergb@plt>
add    0x68(%rsp),%rbp
add    $0x1,%rbx
cmp    %ebx,0xf0(%rsp)
jne    14f0 <qc_imag_bay2rgb_ip+0x3e0>
mov    0x10(%rsp),%r15
movzbl 0x1(%r15,%rbx,2),%eax
movzbl (%r12,%rbx,2),%edx
add    %eax,%edx
shr    %edx
movzbl 0x1(%r13,%rbx,2),%ecx
movzbl 0x0(%r13,%rbx,2),%r8d
mov    0xa0(%rsp),%rax
lea    (%rax,%rbp,1),%rdi
mov    0x4(%rsp),%r14d
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <qc_imag_writergb@plt>
movzbl 0x1(%r13,%rbx,2),%eax
mov    0x8(%rsp),%rcx
movzbl (%rcx,%rbx,2),%ecx
add    %eax,%ecx
mov    0x20(%rsp),%rax
movzbl -0x1(%rax,%rbx,2),%eax
add    %ecx,%eax
imul   $0xaaab,%eax,%ecx
shr    $0x11,%ecx
movzbl 0x0(%r13,%rbx,2),%eax
mov    0xa8(%rsp),%rdx
movzbl (%rdx,%rbx,2),%r8d
mov    %rdx,%r13
add    %eax,%r8d
shr    %r8d
add    0x90(%rsp),%rbp
movzbl (%r12,%rbx,2),%edx
mov    %rbp,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <qc_imag_writergb@plt>
mov    0x48(%rsp),%rdi
mov    0xc0(%rsp),%rbx
add    %rbx,%rdi
mov    0xe8(%rsp),%rsi
lea    (%rsi,%rbx,1),%rax
mov    %rax,0x48(%rsp)
mov    0x58(%rsp),%rdx
mov    0x88(%rsp),%rcx
lea    (%rcx,%rdx,1),%r9
mov    0x60(%rsp),%r14
add    %rbx,%r14
mov    0x20(%rsp),%r11
add    %rdx,%r11
add    %rdx,%r13
mov    %r13,%rcx
mov    0x8(%rsp),%r10
add    %rdx,%r10
add    %rdx,0x98(%rsp)
mov    0xb0(%rsp),%rax
add    %rdx,%rax
add    %rdx,%r15
mov    %r15,0x10(%rsp)
mov    %rdx,%rbp
add    %rdx,%r12
add    %rdx,0x28(%rsp)
mov    0xb8(%rsp),%rdx
add    %rbp,%rdx
mov    0xe0(%rsp),%rbx
mov    %rbx,%r13
mov    0x74(%rsp),%r15d
add    $0xffffffff,%r15d
mov    0x80(%rsp),%r8
mov    %rcx,%rbp
mov    0x48(%rsp),%rcx
jne    1400 <qc_imag_bay2rgb_ip+0x2f0>
mov    0x78(%rsp),%rax
movzbl (%rbx,%rax,1),%eax
movzbl 0x1(%rbx),%ecx
add    %eax,%ecx
shr    %ecx
mov    0x38(%rsp),%rax
movzbl (%rbx,%rax,1),%edx
mov    %r8,%r12
movzbl (%rbx),%r8d
mov    %rsi,%r13
mov    0x4(%rsp),%esi
xor    %eax,%eax
mov    %rdi,%rbp
call   1030 <qc_imag_writergb@plt>
mov    0x88(%rsp),%r15
mov    0x30(%rsp),%rbx
add    %rbp,%rbx
mov    0x40(%rsp),%rbp
mov    0x4(%rsp),%r14d
nopw   0x0(%rax,%rax,1)
movzbl (%r15,%r12,1),%eax
movzbl 0x2(%r15,%r12,1),%r8d
add    %eax,%r8d
shr    %r8d
movzbl 0x1(%r15),%edx
movzbl 0x1(%r15,%r12,1),%ecx
mov    %rbx,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <qc_imag_writergb@plt>
movzbl 0x1(%r15),%eax
mov    0xd8(%rsp),%rcx
movzbl 0x1(%r15,%rcx,1),%edx
add    %eax,%edx
shr    %edx
movzbl 0x1(%r15,%r12,1),%eax
mov    0xd0(%rsp),%rcx
movzbl 0x1(%r15,%rcx,1),%ecx
add    %eax,%ecx
movzbl 0x3(%r15,%r12,1),%eax
add    %ecx,%eax
imul   $0xaaab,%eax,%ecx
shr    $0x11,%ecx
movzbl 0x2(%r15,%r12,1),%r8d
mov    %r13,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <qc_imag_writergb@plt>
mov    0x68(%rsp),%rax
add    %rax,%rbx
add    %rax,%r13
add    $0x2,%r15
add    $0xffffffff,%ebp
jne    1810 <qc_imag_bay2rgb_ip+0x700>
movzbl 0x1(%r15),%edx
movzbl 0x1(%r15,%r12,1),%ecx
movzbl (%r15,%r12,1),%r8d
mov    %rbx,%rdi
mov    0x4(%rsp),%esi
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <qc_imag_writergb@plt>

LLVM IR (-O0):
define void @qc_imag_bay2rgb_ip(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i8
%21 = alloca i8
%22 = alloca i8
%23 = alloca i32
%24 = alloca i32
store i8* %0, i8** %8
store i32 %1, i32* %9
store i8* %2, i8** %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%25 = load i32, i32* %12
%26 = sub nsw i32 %25, 2
%27 = sdiv i32 %26, 2
store i32 %27, i32* %19
%28 = load i32, i32* %13
%29 = sub nsw i32 %28, 2
%30 = sdiv i32 %29, 2
store i32 %30, i32* %24
%31 = load i32, i32* %9
%32 = mul nsw i32 2, %31
store i32 %32, i32* %17
%33 = load i32, i32* %11
%34 = mul nsw i32 2, %33
store i32 %34, i32* %18
%35 = load i8*, i8** %10
%36 = load i32, i32* %14
%37 = load i8*, i8** %8
%38 = getelementptr inbounds i8, i8* %37, i64 1
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = load i8*, i8** %8
%42 = getelementptr inbounds i8, i8* %41, i64 0
%43 = load i8, i8* %42
%44 = zext i8 %43 to i32
%45 = load i8*, i8** %8
%46 = load i32, i32* %9
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %45, i64 %47
%49 = load i8, i8* %48
%50 = zext i8 %49 to i32
%51 = call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %35, i32 %36, i32 %40, i32 %44, i32 %50)
%52 = load i8*, i8** %8
%53 = getelementptr inbounds i8, i8* %52, i64 1
store i8* %53, i8** %15
%54 = load i8*, i8** %10
%55 = load i32, i32* %14
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8, i8* %54, i64 %56
store i8* %57, i8** %16
%58 = load i32, i32* %19
store i32 %58, i32* %23
br label %59
59: ; preds = %143, %7
%60 = load i8*, i8** %15
%61 = getelementptr inbounds i8, i8* %60, i64 -1
%62 = load i8, i8* %61
%63 = zext i8 %62 to i32
%64 = load i8*, i8** %15
%65 = getelementptr inbounds i8, i8* %64, i64 1
%66 = load i8, i8* %65
%67 = zext i8 %66 to i32
%68 = add i32 %63, %67
%69 = load i8*, i8** %15
%70 = load i32, i32* %9
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8, i8* %69, i64 %71
%73 = load i8, i8* %72
%74 = zext i8 %73 to i32
%75 = add i32 %68, %74
%76 = udiv i32 %75, 3
%77 = trunc i32 %76 to i8
store i8 %77, i8* %21
%78 = load i8*, i8** %15
%79 = load i32, i32* %9
%80 = sub nsw i32 %79, 1
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i8, i8* %78, i64 %81
%83 = load i8, i8* %82
%84 = zext i8 %83 to i32
%85 = load i8*, i8** %15
%86 = load i32, i32* %9
%87 = add nsw i32 %86, 1
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8, i8* %85, i64 %88
%90 = load i8, i8* %89
%91 = zext i8 %90 to i32
%92 = add i32 %84, %91
%93 = udiv i32 %92, 2
%94 = trunc i32 %93 to i8
store i8 %94, i8* %22
%95 = load i8*, i8** %16
%96 = load i32, i32* %14
%97 = load i8*, i8** %15
%98 = getelementptr inbounds i8, i8* %97, i64 0
%99 = load i8, i8* %98
%100 = zext i8 %99 to i32
%101 = load i8, i8* %21
%102 = zext i8 %101 to i32
%103 = load i8, i8* %22
%104 = zext i8 %103 to i32
%105 = call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %95, i32 %96, i32 %100, i32 %102, i32 %104)
%106 = load i8*, i8** %15
%107 = getelementptr inbounds i8, i8* %106, i64 0
%108 = load i8, i8* %107
%109 = zext i8 %108 to i32
%110 = load i8*, i8** %15
%111 = getelementptr inbounds i8, i8* %110, i64 2
%112 = load i8, i8* %111
%113 = zext i8 %112 to i32
%114 = add i32 %109, %113
%115 = udiv i32 %114, 2
%116 = trunc i32 %115 to i8
store i8 %116, i8* %20
%117 = load i8*, i8** %16
%118 = load i32, i32* %14
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds i8, i8* %117, i64 %119
%121 = load i32, i32* %14
%122 = load i8, i8* %20
%123 = zext i8 %122 to i32
%124 = load i8*, i8** %15
%125 = getelementptr inbounds i8, i8* %124, i64 1
%126 = load i8, i8* %125
%127 = zext i8 %126 to i32
%128 = load i8*, i8** %15
%129 = load i32, i32* %9
%130 = add nsw i32 %129, 1
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds i8, i8* %128, i64 %131
%133 = load i8, i8* %132
%134 = zext i8 %133 to i32
%135 = call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %120, i32 %121, i32 %123, i32 %127, i32 %134)
%136 = load i8*, i8** %15
%137 = getelementptr inbounds i8, i8* %136, i64 2
store i8* %137, i8** %15
%138 = load i32, i32* %14
%139 = mul nsw i32 2, %138
%140 = load i8*, i8** %16
%141 = sext i32 %139 to i64
%142 = getelementptr inbounds i8, i8* %140, i64 %141
store i8* %142, i8** %16
br label %143
143: ; preds = %59
%144 = load i32, i32* %23
%145 = add i32 %144, -1
store i32 %145, i32* %23
%146 = icmp ne i32 %145, 0
br i1 %146, label %59, label %147
147: ; preds = %143
%148 = load i8*, i8** %15
%149 = getelementptr inbounds i8, i8* %148, i64 -1
%150 = load i8, i8* %149
%151 = zext i8 %150 to i32
%152 = load i8*, i8** %15
%153 = load i32, i32* %9
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds i8, i8* %152, i64 %154
%156 = load i8, i8* %155
%157 = zext i8 %156 to i32
%158 = add i32 %151, %157
%159 = udiv i32 %158, 2
%160 = trunc i32 %159 to i8
store i8 %160, i8* %21
%161 = load i8*, i8** %16
%162 = load i32, i32* %14
%163 = load i8*, i8** %15
%164 = getelementptr inbounds i8, i8* %163, i64 0
%165 = load i8, i8* %164
%166 = zext i8 %165 to i32
%167 = load i8, i8* %21
%168 = zext i8 %167 to i32
%169 = load i8*, i8** %15
%170 = load i32, i32* %9
%171 = sub nsw i32 %170, 1
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds i8, i8* %169, i64 %172
%174 = load i8, i8* %173
%175 = zext i8 %174 to i32
%176 = call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %161, i32 %162, i32 %166, i32 %168, i32 %175)
%177 = load i32, i32* %9
%178 = load i8*, i8** %8
%179 = sext i32 %177 to i64
%180 = getelementptr inbounds i8, i8* %178, i64 %179
store i8* %180, i8** %8
%181 = load i32, i32* %11
%182 = load i8*, i8** %10
%183 = sext i32 %181 to i64
%184 = getelementptr inbounds i8, i8* %182, i64 %183
store i8* %184, i8** %10
br label %185
185: ; preds = %615, %147
%186 = load i8*, i8** %8
%187 = load i32, i32* %9
%188 = sub nsw i32 0, %187
%189 = add nsw i32 %188, 1
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds i8, i8* %186, i64 %190
%192 = load i8, i8* %191
%193 = zext i8 %192 to i32
%194 = load i8*, i8** %8
%195 = load i32, i32* %9
%196 = add nsw i32 %195, 1
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds i8, i8* %194, i64 %197
%199 = load i8, i8* %198
%200 = zext i8 %199 to i32
%201 = add i32 %193, %200
%202 = udiv i32 %201, 2
%203 = trunc i32 %202 to i8
store i8 %203, i8* %20
%204 = load i8*, i8** %8
%205 = load i32, i32* %9
%206 = sub nsw i32 0, %205
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds i8, i8* %204, i64 %207
%209 = load i8, i8* %208
%210 = zext i8 %209 to i32
%211 = load i8*, i8** %8
%212 = getelementptr inbounds i8, i8* %211, i64 1
%213 = load i8, i8* %212
%214 = zext i8 %213 to i32
%215 = add i32 %210, %214
%216 = load i8*, i8** %8
%217 = load i32, i32* %9
%218 = sext i32 %217 to i64
%219 = getelementptr inbounds i8, i8* %216, i64 %218
%220 = load i8, i8* %219
%221 = zext i8 %220 to i32
%222 = add i32 %215, %221
%223 = udiv i32 %222, 3
%224 = trunc i32 %223 to i8
store i8 %224, i8* %21
%225 = load i8*, i8** %10
%226 = getelementptr inbounds i8, i8* %225, i64 0
%227 = load i32, i32* %14
%228 = load i8, i8* %20
%229 = zext i8 %228 to i32
%230 = load i8, i8* %21
%231 = zext i8 %230 to i32
%232 = load i8*, i8** %8
%233 = getelementptr inbounds i8, i8* %232, i64 0
%234 = load i8, i8* %233
%235 = zext i8 %234 to i32
%236 = call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %226, i32 %227, i32 %229, i32 %231, i32 %235)
%237 = load i8*, i8** %8
%238 = getelementptr inbounds i8, i8* %237, i64 0
%239 = load i8, i8* %238
%240 = zext i8 %239 to i32
%241 = load i8*, i8** %8
%242 = load i32, i32* %17
%243 = sext i32 %242 to i64
%244 = getelementptr inbounds i8, i8* %241, i64 %243
%245 = load i8, i8* %244
%246 = zext i8 %245 to i32
%247 = add i32 %240, %246
%248 = udiv i32 %247, 2
%249 = trunc i32 %248 to i8
store i8 %249, i8* %22
%250 = load i8*, i8** %10
%251 = load i32, i32* %11
%252 = sext i32 %251 to i64
%253 = getelementptr inbounds i8, i8* %250, i64 %252
%254 = load i32, i32* %14
%255 = load i8*, i8** %8
%256 = load i32, i32* %9
%257 = add nsw i32 %256, 1
%258 = sext i32 %257 to i64
%259 = getelementptr inbounds i8, i8* %255, i64 %258
%260 = load i8, i8* %259
%261 = zext i8 %260 to i32
%262 = load i8*, i8** %8
%263 = load i32, i32* %9
%264 = sext i32 %263 to i64
%265 = getelementptr inbounds i8, i8* %262, i64 %264
%266 = load i8, i8* %265
%267 = zext i8 %266 to i32
%268 = load i8, i8* %22
%269 = zext i8 %268 to i32
%270 = call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %253, i32 %254, i32 %261, i32 %267, i32 %269)
%271 = load i8*, i8** %8
%272 = getelementptr inbounds i8, i8* %271, i64 1
store i8* %272, i8** %15
%273 = load i8*, i8** %10
%274 = load i32, i32* %14
%275 = sext i32 %274 to i64
%276 = getelementptr inbounds i8, i8* %273, i64 %275
store i8* %276, i8** %16
%277 = load i32, i32* %19
store i32 %277, i32* %23
br label %278
278: ; preds = %522, %185
%279 = load i8*, i8** %15
%280 = load i32, i32* %9
%281 = sub nsw i32 0, %280
%282 = sext i32 %281 to i64
%283 = getelementptr inbounds i8, i8* %279, i64 %282
%284 = load i8, i8* %283
%285 = zext i8 %284 to i32
%286 = load i8*, i8** %15
%287 = load i32, i32* %9
%288 = sext i32 %287 to i64
%289 = getelementptr inbounds i8, i8* %286, i64 %288
%290 = load i8, i8* %289
%291 = zext i8 %290 to i32
%292 = add i32 %285, %291
%293 = udiv i32 %292, 2
%294 = trunc i32 %293 to i8
store i8 %294, i8* %20
%295 = load i8*, i8** %15
%296 = getelementptr inbounds i8, i8* %295, i64 -1
%297 = load i8, i8* %296
%298 = zext i8 %297 to i32
%299 = load i8*, i8** %15
%300 = getelementptr inbounds i8, i8* %299, i64 1
%301 = load i8, i8* %300
%302 = zext i8 %301 to i32
%303 = add i32 %298, %302
%304 = udiv i32 %303, 2
%305 = trunc i32 %304 to i8
store i8 %305, i8* %22
%306 = load i8*, i8** %16
%307 = getelementptr inbounds i8, i8* %306, i64 0
%308 = load i32, i32* %14
%309 = load i8, i8* %20
%310 = zext i8 %309 to i32
%311 = load i8*, i8** %15
%312 = getelementptr inbounds i8, i8* %311, i64 0
%313 = load i8, i8* %312
%314 = zext i8 %313 to i32
%315 = load i8, i8* %22
%316 = zext i8 %315 to i32
%317 = call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %307, i32 %308, i32 %310, i32 %314, i32 %316)
%318 = load i8*, i8** %15
%319 = load i32, i32* %9
%320 = sub nsw i32 0, %319
%321 = sext i32 %320 to i64
%322 = getelementptr inbounds i8, i8* %318, i64 %321
%323 = load i8, i8* %322
%324 = zext i8 %323 to i32
%325 = load i8*, i8** %15
%326 = load i32, i32* %9
%327 = sub nsw i32 0, %326
%328 = add nsw i32 %327, 2
%329 = sext i32 %328 to i64
%330 = getelementptr inbounds i8, i8* %325, i64 %329
%331 = load i8, i8* %330
%332 = zext i8 %331 to i32
%333 = add i32 %324, %332
%334 = load i8*, i8** %15
%335 = load i32, i32* %9
%336 = sext i32 %335 to i64
%337 = getelementptr inbounds i8, i8* %334, i64 %336
%338 = load i8, i8* %337
%339 = zext i8 %338 to i32
%340 = add i32 %333, %339
%341 = load i8*, i8** %15
%342 = load i32, i32* %9
%343 = add nsw i32 %342, 2
%344 = sext i32 %343 to i64
%345 = getelementptr inbounds i8, i8* %341, i64 %344
%346 = load i8, i8* %345
%347 = zext i8 %346 to i32
%348 = add i32 %340, %347
%349 = udiv i32 %348, 4
%350 = trunc i32 %349 to i8
store i8 %350, i8* %20
%351 = load i8*, i8** %15
%352 = getelementptr inbounds i8, i8* %351, i64 0
%353 = load i8, i8* %352
%354 = zext i8 %353 to i32
%355 = load i8*, i8** %15
%356 = getelementptr inbounds i8, i8* %355, i64 2
%357 = load i8, i8* %356
%358 = zext i8 %357 to i32
%359 = add i32 %354, %358
%360 = load i8*, i8** %15
%361 = load i32, i32* %9
%362 = sub nsw i32 0, %361
%363 = add nsw i32 %362, 1
%364 = sext i32 %363 to i64
%365 = getelementptr inbounds i8, i8* %360, i64 %364
%366 = load i8, i8* %365
%367 = zext i8 %366 to i32
%368 = add i32 %359, %367
%369 = load i8*, i8** %15
%370 = load i32, i32* %9
%371 = add nsw i32 %370, 1
%372 = sext i32 %371 to i64
%373 = getelementptr inbounds i8, i8* %369, i64 %372
%374 = load i8, i8* %373
%375 = zext i8 %374 to i32
%376 = add i32 %368, %375
%377 = udiv i32 %376, 4
%378 = trunc i32 %377 to i8
store i8 %378, i8* %21
%379 = load i8*, i8** %16
%380 = load i32, i32* %14
%381 = sext i32 %380 to i64
%382 = getelementptr inbounds i8, i8* %379, i64 %381
%383 = load i32, i32* %14
%384 = load i8, i8* %20
%385 = zext i8 %384 to i32
%386 = load i8, i8* %21
%387 = zext i8 %386 to i32
%388 = load i8*, i8** %15
%389 = getelementptr inbounds i8, i8* %388, i64 1
%390 = load i8, i8* %389
%391 = zext i8 %390 to i32
%392 = call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %382, i32 %383, i32 %385, i32 %387, i32 %391)
%393 = load i8*, i8** %15
%394 = getelementptr inbounds i8, i8* %393, i64 0
%395 = load i8, i8* %394
%396 = zext i8 %395 to i32
%397 = load i8*, i8** %15
%398 = load i32, i32* %17
%399 = sext i32 %398 to i64
%400 = getelementptr inbounds i8, i8* %397, i64 %399
%401 = load i8, i8* %400
%402 = zext i8 %401 to i32
%403 = add i32 %396, %402
%404 = load i8*, i8** %15
%405 = load i32, i32* %9
%406 = sub nsw i32 %405, 1
%407 = sext i32 %406 to i64
%408 = getelementptr inbounds i8, i8* %404, i64 %407
%409 = load i8, i8* %408
%410 = zext i8 %409 to i32
%411 = add i32 %403, %410
%412 = load i8*, i8** %15
%413 = load i32, i32* %9
%414 = add nsw i32 %413, 1
%415 = sext i32 %414 to i64
%416 = getelementptr inbounds i8, i8* %412, i64 %415
%417 = load i8, i8* %416
%418 = zext i8 %417 to i32
%419 = add i32 %411, %418
%420 = udiv i32 %419, 4
%421 = trunc i32 %420 to i8
store i8 %421, i8* %21
%422 = load i8*, i8** %15
%423 = getelementptr inbounds i8, i8* %422, i64 -1
%424 = load i8, i8* %423
%425 = zext i8 %424 to i32
%426 = load i8*, i8** %15
%427 = getelementptr inbounds i8, i8* %426, i64 1
%428 = load i8, i8* %427
%429 = zext i8 %428 to i32
%430 = add i32 %425, %429
%431 = load i8*, i8** %15
%432 = load i32, i32* %17
%433 = sub nsw i32 %432, 1
%434 = sext i32 %433 to i64
%435 = getelementptr inbounds i8, i8* %431, i64 %434
%436 = load i8, i8* %435
%437 = zext i8 %436 to i32
%438 = add i32 %430, %437
%439 = load i8*, i8** %15
%440 = load i32, i32* %17
%441 = add nsw i32 %440, 1
%442 = sext i32 %441 to i64
%443 = getelementptr inbounds i8, i8* %439, i64 %442
%444 = load i8, i8* %443
%445 = zext i8 %444 to i32
%446 = add i32 %438, %445
%447 = udiv i32 %446, 4
%448 = trunc i32 %447 to i8
store i8 %448, i8* %22
%449 = load i8*, i8** %16
%450 = load i32, i32* %11
%451 = sext i32 %450 to i64
%452 = getelementptr inbounds i8, i8* %449, i64 %451
%453 = load i32, i32* %14
%454 = load i8*, i8** %15
%455 = load i32, i32* %9
%456 = sext i32 %455 to i64
%457 = getelementptr inbounds i8, i8* %454, i64 %456
%458 = load i8, i8* %457
%459 = zext i8 %458 to i32
%460 = load i8, i8* %21
%461 = zext i8 %460 to i32
%462 = load i8, i8* %22
%463 = zext i8 %462 to i32
%464 = call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %452, i32 %453, i32 %459, i32 %461, i32 %463)
%465 = load i8*, i8** %15
%466 = load i32, i32* %9
%467 = sext i32 %466 to i64
%468 = getelementptr inbounds i8, i8* %465, i64 %467
%469 = load i8, i8* %468
%470 = zext i8 %469 to i32
%471 = load i8*, i8** %15
%472 = load i32, i32* %9
%473 = add nsw i32 %472, 2
%474 = sext i32 %473 to i64
%475 = getelementptr inbounds i8, i8* %471, i64 %474
%476 = load i8, i8* %475
%477 = zext i8 %476 to i32
%478 = add i32 %470, %477
%479 = udiv i32 %478, 2
%480 = trunc i32 %479 to i8
store i8 %480, i8* %20
%481 = load i8*, i8** %15
%482 = getelementptr inbounds i8, i8* %481, i64 1
%483 = load i8, i8* %482
%484 = zext i8 %483 to i32
%485 = load i8*, i8** %15
%486 = load i32, i32* %17
%487 = add nsw i32 %486, 1
%488 = sext i32 %487 to i64
%489 = getelementptr inbounds i8, i8* %485, i64 %488
%490 = load i8, i8* %489
%491 = zext i8 %490 to i32
%492 = add i32 %484, %491
%493 = udiv i32 %492, 2
%494 = trunc i32 %493 to i8
store i8 %494, i8* %22
%495 = load i8*, i8** %16
%496 = load i32, i32* %11
%497 = sext i32 %496 to i64
%498 = getelementptr inbounds i8, i8* %495, i64 %497
%499 = load i32, i32* %14
%500 = sext i32 %499 to i64
%501 = getelementptr inbounds i8, i8* %498, i64 %500
%502 = load i32, i32* %14
%503 = load i8, i8* %20
%504 = zext i8 %503 to i32
%505 = load i8*, i8** %15
%506 = load i32, i32* %9
%507 = add nsw i32 %506, 1
%508 = sext i32 %507 to i64
%509 = getelementptr inbounds i8, i8* %505, i64 %508
%510 = load i8, i8* %509
%511 = zext i8 %510 to i32
%512 = load i8, i8* %22
%513 = zext i8 %512 to i32
%514 = call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %501, i32 %502, i32 %504, i32 %511, i32 %513)
%515 = load i8*, i8** %15
%516 = getelementptr inbounds i8, i8* %515, i64 2
store i8* %516, i8** %15
%517 = load i32, i32* %14
%518 = mul nsw i32 2, %517
%519 = load i8*, i8** %16
%520 = sext i32 %518 to i64
%521 = getelementptr inbounds i8, i8* %519, i64 %520
store i8* %521, i8** %16
br label %522
522: ; preds = %278
%523 = load i32, i32* %23
%524 = add i32 %523, -1
store i32 %524, i32* %23
%525 = icmp ne i32 %524, 0
br i1 %525, label %278, label %526
526: ; preds = %522
%527 = load i8*, i8** %15
%528 = load i32, i32* %9
%529 = sub nsw i32 0, %528
%530 = sext i32 %529 to i64
%531 = getelementptr inbounds i8, i8* %527, i64 %530
%532 = load i8, i8* %531
%533 = zext i8 %532 to i32
%534 = load i8*, i8** %15
%535 = load i32, i32* %9
%536 = sext i32 %535 to i64
%537 = getelementptr inbounds i8, i8* %534, i64 %536
%538 = load i8, i8* %537
%539 = zext i8 %538 to i32
%540 = add i32 %533, %539
%541 = udiv i32 %540, 2
%542 = trunc i32 %541 to i8
store i8 %542, i8* %20
%543 = load i8*, i8** %16
%544 = load i32, i32* %14
%545 = load i8, i8* %20
%546 = zext i8 %545 to i32
%547 = load i8*, i8** %15
%548 = getelementptr inbounds i8, i8* %547, i64 0
%549 = load i8, i8* %548
%550 = zext i8 %549 to i32
%551 = load i8*, i8** %15
%552 = getelementptr inbounds i8, i8* %551, i64 -1
%553 = load i8, i8* %552
%554 = zext i8 %553 to i32
%555 = call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %543, i32 %544, i32 %546, i32 %550, i32 %554)
%556 = load i8*, i8** %15
%557 = getelementptr inbounds i8, i8* %556, i64 0
%558 = load i8, i8* %557
%559 = zext i8 %558 to i32
%560 = load i8*, i8** %15
%561 = load i32, i32* %9
%562 = sub nsw i32 %561, 1
%563 = sext i32 %562 to i64
%564 = getelementptr inbounds i8, i8* %560, i64 %563
%565 = load i8, i8* %564
%566 = zext i8 %565 to i32
%567 = add i32 %559, %566
%568 = load i8*, i8** %15
%569 = load i32, i32* %17
%570 = sext i32 %569 to i64
%571 = getelementptr inbounds i8, i8* %568, i64 %570
%572 = load i8, i8* %571
%573 = zext i8 %572 to i32
%574 = add i32 %567, %573
%575 = udiv i32 %574, 3
%576 = trunc i32 %575 to i8
store i8 %576, i8* %21
%577 = load i8*, i8** %15
%578 = getelementptr inbounds i8, i8* %577, i64 -1
%579 = load i8, i8* %578
%580 = zext i8 %579 to i32
%581 = load i8*, i8** %15
%582 = load i32, i32* %17
%583 = sub nsw i32 %582, 1
%584 = sext i32 %583 to i64
%585 = getelementptr inbounds i8, i8* %581, i64 %584
%586 = load i8, i8* %585
%587 = zext i8 %586 to i32
%588 = add i32 %580, %587
%589 = udiv i32 %588, 2
%590 = trunc i32 %589 to i8
store i8 %590, i8* %22
%591 = load i8*, i8** %16
%592 = load i32, i32* %11
%593 = sext i32 %592 to i64
%594 = getelementptr inbounds i8, i8* %591, i64 %593
%595 = load i32, i32* %14
%596 = load i8*, i8** %15
%597 = load i32, i32* %9
%598 = sext i32 %597 to i64
%599 = getelementptr inbounds i8, i8* %596, i64 %598
%600 = load i8, i8* %599
%601 = zext i8 %600 to i32
%602 = load i8, i8* %21
%603 = zext i8 %602 to i32
%604 = load i8, i8* %22
%605 = zext i8 %604 to i32
%606 = call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %594, i32 %595, i32 %601, i32 %603, i32 %605)
%607 = load i32, i32* %17
%608 = load i8*, i8** %8
%609 = sext i32 %607 to i64
%610 = getelementptr inbounds i8, i8* %608, i64 %609
store i8* %610, i8** %8
%611 = load i32, i32* %18
%612 = load i8*, i8** %10
%613 = sext i32 %611 to i64
%614 = getelementptr inbounds i8, i8* %612, i64 %613
store i8* %614, i8** %10
br label %615
615: ; preds = %526
%616 = load i32, i32* %24
%617 = add i32 %616, -1
store i32 %617, i32* %24
%618 = icmp ne i32 %617, 0
br i1 %618, label %185, label %619
619: ; preds = %615
%620 = load i8*, i8** %8
%621 = load i32, i32* %9
%622 = sub nsw i32 0, %621
%623 = sext i32 %622 to i64
%624 = getelementptr inbounds i8, i8* %620, i64 %623
%625 = load i8, i8* %624
%626 = zext i8 %625 to i32
%627 = load i8*, i8** %8
%628 = getelementptr inbounds i8, i8* %627, i64 1
%629 = load i8, i8* %628
%630 = zext i8 %629 to i32
%631 = add i32 %626, %630
%632 = udiv i32 %631, 2
%633 = trunc i32 %632 to i8
store i8 %633, i8* %21
%634 = load i8*, i8** %10
%635 = load i32, i32* %14
%636 = load i8*, i8** %8
%637 = load i32, i32* %9
%638 = sub nsw i32 0, %637
%639 = add nsw i32 %638, 1
%640 = sext i32 %639 to i64
%641 = getelementptr inbounds i8, i8* %636, i64 %640
%642 = load i8, i8* %641
%643 = zext i8 %642 to i32
%644 = load i8, i8* %21
%645 = zext i8 %644 to i32
%646 = load i8*, i8** %8
%647 = getelementptr inbounds i8, i8* %646, i64 0
%648 = load i8, i8* %647
%649 = zext i8 %648 to i32
%650 = call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %634, i32 %635, i32 %643, i32 %645, i32 %649)
%651 = load i8*, i8** %8
%652 = getelementptr inbounds i8, i8* %651, i64 1
store i8* %652, i8** %15
%653 = load i8*, i8** %10
%654 = load i32, i32* %14
%655 = sext i32 %654 to i64
%656 = getelementptr inbounds i8, i8* %653, i64 %655
store i8* %656, i8** %16
%657 = load i32, i32* %19
store i32 %657, i32* %23
br label %658
658: ; preds = %745, %619
%659 = load i8*, i8** %15
%660 = getelementptr inbounds i8, i8* %659, i64 -1
%661 = load i8, i8* %660
%662 = zext i8 %661 to i32
%663 = load i8*, i8** %15
%664 = getelementptr inbounds i8, i8* %663, i64 1
%665 = load i8, i8* %664
%666 = zext i8 %665 to i32
%667 = add i32 %662, %666
%668 = udiv i32 %667, 2
%669 = trunc i32 %668 to i8
store i8 %669, i8* %22
%670 = load i8*, i8** %16
%671 = load i32, i32* %14
%672 = load i8*, i8** %15
%673 = load i32, i32* %9
%674 = sub nsw i32 0, %673
%675 = sext i32 %674 to i64
%676 = getelementptr inbounds i8, i8* %672, i64 %675
%677 = load i8, i8* %676
%678 = zext i8 %677 to i32
%679 = load i8*, i8** %15
%680 = getelementptr inbounds i8, i8* %679, i64 0
%681 = load i8, i8* %680
%682 = zext i8 %681 to i32
%683 = load i8, i8* %22
%684 = zext i8 %683 to i32
%685 = call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %670, i32 %671, i32 %678, i32 %682, i32 %684)
%686 = load i8*, i8** %15
%687 = load i32, i32* %9
%688 = sub nsw i32 0, %687
%689 = sext i32 %688 to i64
%690 = getelementptr inbounds i8, i8* %686, i64 %689
%691 = load i8, i8* %690
%692 = zext i8 %691 to i32
%693 = load i8*, i8** %15
%694 = load i32, i32* %9
%695 = sub nsw i32 0, %694
%696 = add nsw i32 %695, 2
%697 = sext i32 %696 to i64
%698 = getelementptr inbounds i8, i8* %693, i64 %697
%699 = load i8, i8* %698
%700 = zext i8 %699 to i32
%701 = add i32 %692, %700
%702 = udiv i32 %701, 2
%703 = trunc i32 %702 to i8
store i8 %703, i8* %20
%704 = load i8*, i8** %15
%705 = getelementptr inbounds i8, i8* %704, i64 0
%706 = load i8, i8* %705
%707 = zext i8 %706 to i32
%708 = load i8*, i8** %15
%709 = load i32, i32* %9
%710 = sub nsw i32 0, %709
%711 = add nsw i32 %710, 1
%712 = sext i32 %711 to i64
%713 = getelementptr inbounds i8, i8* %708, i64 %712
%714 = load i8, i8* %713
%715 = zext i8 %714 to i32
%716 = add i32 %707, %715
%717 = load i8*, i8** %15
%718 = getelementptr inbounds i8, i8* %717, i64 2
%719 = load i8, i8* %718
%720 = zext i8 %719 to i32
%721 = add i32 %716, %720
%722 = udiv i32 %721, 3
%723 = trunc i32 %722 to i8
store i8 %723, i8* %21
%724 = load i8*, i8** %16
%725 = load i32, i32* %14
%726 = sext i32 %725 to i64
%727 = getelementptr inbounds i8, i8* %724, i64 %726
%728 = load i32, i32* %14
%729 = load i8, i8* %20
%730 = zext i8 %729 to i32
%731 = load i8, i8* %21
%732 = zext i8 %731 to i32
%733 = load i8*, i8** %15
%734 = getelementptr inbounds i8, i8* %733, i64 1
%735 = load i8, i8* %734
%736 = zext i8 %735 to i32
%737 = call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %727, i32 %728, i32 %730, i32 %732, i32 %736)
%738 = load i8*, i8** %15
%739 = getelementptr inbounds i8, i8* %738, i64 2
store i8* %739, i8** %15
%740 = load i32, i32* %14
%741 = mul nsw i32 2, %740
%742 = load i8*, i8** %16
%743 = sext i32 %741 to i64
%744 = getelementptr inbounds i8, i8* %742, i64 %743
store i8* %744, i8** %16
br label %745
745: ; preds = %658
%746 = load i32, i32* %23
%747 = add i32 %746, -1
store i32 %747, i32* %23
%748 = icmp ne i32 %747, 0
br i1 %748, label %658, label %749
749: ; preds = %745
%750 = load i8*, i8** %16
%751 = load i32, i32* %14
%752 = load i8*, i8** %15
%753 = load i32, i32* %9
%754 = sub nsw i32 0, %753
%755 = sext i32 %754 to i64
%756 = getelementptr inbounds i8, i8* %752, i64 %755
%757 = load i8, i8* %756
%758 = zext i8 %757 to i32
%759 = load i8*, i8** %15
%760 = getelementptr inbounds i8, i8* %759, i64 0
%761 = load i8, i8* %760
%762 = zext i8 %761 to i32
%763 = load i8*, i8** %15
%764 = getelementptr inbounds i8, i8* %763, i64 -1
%765 = load i8, i8* %764
%766 = zext i8 %765 to i32
%767 = call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %750, i32 %751, i32 %758, i32 %762, i32 %766)
ret void
}

LLVM IR (-O2):
define void @qc_imag_bay2rgb_ip(i8* nocapture %0, i32 %1, i8* %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = add nsw i32 %4, -2
%9 = sdiv i32 %8, 2
%10 = add nsw i32 %5, -2
%11 = shl nsw i32 %1, 1
%12 = getelementptr inbounds i8, i8* %0, i64 1
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = load i8, i8* %0
%16 = zext i8 %15 to i32
%17 = sext i32 %1 to i64
%18 = getelementptr inbounds i8, i8* %0, i64 %17
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = tail call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %2, i32 %6, i32 %14, i32 %16, i32 %20)
%22 = sext i32 %6 to i64
%23 = getelementptr inbounds i8, i8* %2, i64 %22
%24 = add nsw i32 %1, -1
%25 = sext i32 %24 to i64
%26 = add nsw i32 %1, 1
%27 = sext i32 %26 to i64
%28 = shl nsw i32 %6, 1
%29 = sext i32 %28 to i64
br label %30
30: ; preds = %30, %7
%31 = phi i8* [ %23, %7 ], [ %71, %30 ]
%32 = phi i8* [ %12, %7 ], [ %60, %30 ]
%33 = phi i32 [ %9, %7 ], [ %72, %30 ]
%34 = getelementptr inbounds i8, i8* %32, i64 -1
%35 = load i8, i8* %34
%36 = zext i8 %35 to i16
%37 = getelementptr inbounds i8, i8* %32, i64 1
%38 = load i8, i8* %37
%39 = zext i8 %38 to i16
%40 = add nuw nsw i16 %39, %36
%41 = getelementptr inbounds i8, i8* %32, i64 %17
%42 = load i8, i8* %41
%43 = zext i8 %42 to i16
%44 = add nuw nsw i16 %40, %43
%45 = udiv i16 %44, 3
%46 = getelementptr inbounds i8, i8* %32, i64 %25
%47 = load i8, i8* %46
%48 = zext i8 %47 to i32
%49 = getelementptr inbounds i8, i8* %32, i64 %27
%50 = load i8, i8* %49
%51 = zext i8 %50 to i32
%52 = add nuw nsw i32 %51, %48
%53 = lshr i32 %52, 1
%54 = load i8, i8* %32
%55 = zext i8 %54 to i32
%56 = zext i16 %45 to i32
%57 = tail call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %31, i32 %6, i32 %55, i32 %56, i32 %53)
%58 = load i8, i8* %32
%59 = zext i8 %58 to i32
%60 = getelementptr inbounds i8, i8* %32, i64 2
%61 = load i8, i8* %60
%62 = zext i8 %61 to i32
%63 = add nuw nsw i32 %62, %59
%64 = lshr i32 %63, 1
%65 = getelementptr inbounds i8, i8* %31, i64 %22
%66 = load i8, i8* %37
%67 = zext i8 %66 to i32
%68 = load i8, i8* %49
%69 = zext i8 %68 to i32
%70 = tail call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %65, i32 %6, i32 %64, i32 %67, i32 %69)
%71 = getelementptr inbounds i8, i8* %31, i64 %29
%72 = add i32 %33, -1
%73 = icmp eq i32 %72, 0
br i1 %73, label %74, label %30
74: ; preds = %30
%75 = getelementptr inbounds i8, i8* %32, i64 1
%76 = sdiv i32 %10, 2
%77 = shl nsw i32 %3, 1
%78 = load i8, i8* %75
%79 = zext i8 %78 to i32
%80 = getelementptr inbounds i8, i8* %60, i64 %17
%81 = load i8, i8* %80
%82 = zext i8 %81 to i32
%83 = add nuw nsw i32 %82, %79
%84 = lshr i32 %83, 1
%85 = load i8, i8* %60
%86 = zext i8 %85 to i32
%87 = getelementptr inbounds i8, i8* %60, i64 %25
%88 = load i8, i8* %87
%89 = zext i8 %88 to i32
%90 = tail call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %71, i32 %6, i32 %86, i32 %84, i32 %89)
%91 = sext i32 %3 to i64
%92 = getelementptr inbounds i8, i8* %2, i64 %91
%93 = sub nsw i32 0, %1
%94 = sub i32 1, %1
%95 = sext i32 %94 to i64
%96 = sext i32 %93 to i64
%97 = sext i32 %11 to i64
%98 = sub i32 2, %1
%99 = sext i32 %98 to i64
%100 = add nsw i32 %1, 2
%101 = sext i32 %100 to i64
%102 = add nsw i32 %11, -1
%103 = sext i32 %102 to i64
%104 = or i32 %11, 1
%105 = sext i32 %104 to i64
%106 = sext i32 %77 to i64
br label %107
107: ; preds = %256, %74
%108 = phi i8* [ %92, %74 ], [ %294, %256 ]
%109 = phi i8* [ %18, %74 ], [ %137, %256 ]
%110 = phi i32 [ %76, %74 ], [ %295, %256 ]
%111 = getelementptr inbounds i8, i8* %109, i64 %95
%112 = load i8, i8* %111
%113 = zext i8 %112 to i32
%114 = getelementptr inbounds i8, i8* %109, i64 %27
%115 = load i8, i8* %114
%116 = zext i8 %115 to i32
%117 = add nuw nsw i32 %116, %113
%118 = lshr i32 %117, 1
%119 = getelementptr inbounds i8, i8* %109, i64 %96
%120 = load i8, i8* %119
%121 = zext i8 %120 to i16
%122 = getelementptr inbounds i8, i8* %109, i64 1
%123 = load i8, i8* %122
%124 = zext i8 %123 to i16
%125 = add nuw nsw i16 %124, %121
%126 = getelementptr inbounds i8, i8* %109, i64 %17
%127 = load i8, i8* %126
%128 = zext i8 %127 to i16
%129 = add nuw nsw i16 %125, %128
%130 = udiv i16 %129, 3
%131 = zext i16 %130 to i32
%132 = load i8, i8* %109
%133 = zext i8 %132 to i32
%134 = tail call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %108, i32 %6, i32 %118, i32 %131, i32 %133)
%135 = load i8, i8* %109
%136 = zext i8 %135 to i32
%137 = getelementptr inbounds i8, i8* %109, i64 %97
%138 = load i8, i8* %137
%139 = zext i8 %138 to i32
%140 = add nuw nsw i32 %139, %136
%141 = lshr i32 %140, 1
%142 = getelementptr inbounds i8, i8* %108, i64 %91
%143 = load i8, i8* %114
%144 = zext i8 %143 to i32
%145 = load i8, i8* %126
%146 = zext i8 %145 to i32
%147 = tail call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %142, i32 %6, i32 %144, i32 %146, i32 %141)
%148 = getelementptr inbounds i8, i8* %108, i64 %22
br label %149
149: ; preds = %149, %107
%150 = phi i8* [ %148, %107 ], [ %253, %149 ]
%151 = phi i8* [ %122, %107 ], [ %188, %149 ]
%152 = phi i32 [ %9, %107 ], [ %254, %149 ]
%153 = getelementptr inbounds i8, i8* %151, i64 %96
%154 = load i8, i8* %153
%155 = zext i8 %154 to i32
%156 = getelementptr inbounds i8, i8* %151, i64 %17
%157 = load i8, i8* %156
%158 = zext i8 %157 to i32
%159 = add nuw nsw i32 %158, %155
%160 = lshr i32 %159, 1
%161 = getelementptr inbounds i8, i8* %151, i64 -1
%162 = load i8, i8* %161
%163 = zext i8 %162 to i32
%164 = getelementptr inbounds i8, i8* %151, i64 1
%165 = load i8, i8* %164
%166 = zext i8 %165 to i32
%167 = add nuw nsw i32 %166, %163
%168 = lshr i32 %167, 1
%169 = load i8, i8* %151
%170 = zext i8 %169 to i32
%171 = tail call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %150, i32 %6, i32 %160, i32 %170, i32 %168)
%172 = load i8, i8* %153
%173 = zext i8 %172 to i32
%174 = getelementptr inbounds i8, i8* %151, i64 %99
%175 = load i8, i8* %174
%176 = zext i8 %175 to i32
%177 = add nuw nsw i32 %176, %173
%178 = load i8, i8* %156
%179 = zext i8 %178 to i32
%180 = add nuw nsw i32 %177, %179
%181 = getelementptr inbounds i8, i8* %151, i64 %101
%182 = load i8, i8* %181
%183 = zext i8 %182 to i32
%184 = add nuw nsw i32 %180, %183
%185 = lshr i32 %184, 2
%186 = load i8, i8* %151
%187 = zext i8 %186 to i32
%188 = getelementptr inbounds i8, i8* %151, i64 2
%189 = load i8, i8* %188
%190 = zext i8 %189 to i32
%191 = add nuw nsw i32 %190, %187
%192 = getelementptr inbounds i8, i8* %151, i64 %95
%193 = load i8, i8* %192
%194 = zext i8 %193 to i32
%195 = add nuw nsw i32 %191, %194
%196 = getelementptr inbounds i8, i8* %151, i64 %27
%197 = load i8, i8* %196
%198 = zext i8 %197 to i32
%199 = add nuw nsw i32 %195, %198
%200 = lshr i32 %199, 2
%201 = getelementptr inbounds i8, i8* %150, i64 %22
%202 = load i8, i8* %164
%203 = zext i8 %202 to i32
%204 = tail call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %201, i32 %6, i32 %185, i32 %200, i32 %203)
%205 = load i8, i8* %151
%206 = zext i8 %205 to i32
%207 = getelementptr inbounds i8, i8* %151, i64 %97
%208 = load i8, i8* %207
%209 = zext i8 %208 to i32
%210 = add nuw nsw i32 %209, %206
%211 = getelementptr inbounds i8, i8* %151, i64 %25
%212 = load i8, i8* %211
%213 = zext i8 %212 to i32
%214 = add nuw nsw i32 %210, %213
%215 = load i8, i8* %196
%216 = zext i8 %215 to i32
%217 = add nuw nsw i32 %214, %216
%218 = lshr i32 %217, 2
%219 = load i8, i8* %161
%220 = zext i8 %219 to i32
%221 = load i8, i8* %164
%222 = zext i8 %221 to i32
%223 = add nuw nsw i32 %222, %220
%224 = getelementptr inbounds i8, i8* %151, i64 %103
%225 = load i8, i8* %224
%226 = zext i8 %225 to i32
%227 = add nuw nsw i32 %223, %226
%228 = getelementptr inbounds i8, i8* %151, i64 %105
%229 = load i8, i8* %228
%230 = zext i8 %229 to i32
%231 = add nuw nsw i32 %227, %230
%232 = lshr i32 %231, 2
%233 = getelementptr inbounds i8, i8* %150, i64 %91
%234 = load i8, i8* %156
%235 = zext i8 %234 to i32
%236 = tail call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %233, i32 %6, i32 %235, i32 %218, i32 %232)
%237 = load i8, i8* %156
%238 = zext i8 %237 to i32
%239 = load i8, i8* %181
%240 = zext i8 %239 to i32
%241 = add nuw nsw i32 %240, %238
%242 = lshr i32 %241, 1
%243 = load i8, i8* %164
%244 = zext i8 %243 to i32
%245 = load i8, i8* %228
%246 = zext i8 %245 to i32
%247 = add nuw nsw i32 %246, %244
%248 = lshr i32 %247, 1
%249 = getelementptr inbounds i8, i8* %233, i64 %22
%250 = load i8, i8* %196
%251 = zext i8 %250 to i32
%252 = tail call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %249, i32 %6, i32 %242, i32 %251, i32 %248)
%253 = getelementptr inbounds i8, i8* %150, i64 %29
%254 = add i32 %152, -1
%255 = icmp eq i32 %254, 0
br i1 %255, label %256, label %149
256: ; preds = %149
%257 = getelementptr inbounds i8, i8* %151, i64 1
%258 = getelementptr inbounds i8, i8* %188, i64 %96
%259 = load i8, i8* %258
%260 = zext i8 %259 to i32
%261 = getelementptr inbounds i8, i8* %188, i64 %17
%262 = load i8, i8* %261
%263 = zext i8 %262 to i32
%264 = add nuw nsw i32 %263, %260
%265 = lshr i32 %264, 1
%266 = load i8, i8* %188
%267 = zext i8 %266 to i32
%268 = load i8, i8* %257
%269 = zext i8 %268 to i32
%270 = tail call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %253, i32 %6, i32 %265, i32 %267, i32 %269)
%271 = load i8, i8* %188
%272 = zext i8 %271 to i16
%273 = getelementptr inbounds i8, i8* %188, i64 %25
%274 = load i8, i8* %273
%275 = zext i8 %274 to i16
%276 = add nuw nsw i16 %275, %272
%277 = getelementptr inbounds i8, i8* %188, i64 %97
%278 = load i8, i8* %277
%279 = zext i8 %278 to i16
%280 = add nuw nsw i16 %276, %279
%281 = udiv i16 %280, 3
%282 = load i8, i8* %257
%283 = zext i8 %282 to i32
%284 = getelementptr inbounds i8, i8* %188, i64 %103
%285 = load i8, i8* %284
%286 = zext i8 %285 to i32
%287 = add nuw nsw i32 %286, %283
%288 = lshr i32 %287, 1
%289 = getelementptr inbounds i8, i8* %253, i64 %91
%290 = load i8, i8* %261
%291 = zext i8 %290 to i32
%292 = zext i16 %281 to i32
%293 = tail call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %289, i32 %6, i32 %291, i32 %292, i32 %288)
%294 = getelementptr inbounds i8, i8* %108, i64 %106
%295 = add i32 %110, -1
%296 = icmp eq i32 %295, 0
br i1 %296, label %297, label %107
297: ; preds = %256
%298 = getelementptr inbounds i8, i8* %137, i64 %96
%299 = load i8, i8* %298
%300 = zext i8 %299 to i32
%301 = getelementptr inbounds i8, i8* %137, i64 1
%302 = load i8, i8* %301
%303 = zext i8 %302 to i32
%304 = add nuw nsw i32 %303, %300
%305 = lshr i32 %304, 1
%306 = getelementptr inbounds i8, i8* %137, i64 %95
%307 = load i8, i8* %306
%308 = zext i8 %307 to i32
%309 = load i8, i8* %137
%310 = zext i8 %309 to i32
%311 = tail call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %294, i32 %6, i32 %308, i32 %305, i32 %310)
%312 = getelementptr inbounds i8, i8* %294, i64 %22
br label %313
313: ; preds = %313, %297
%314 = phi i8* [ %312, %297 ], [ %354, %313 ]
%315 = phi i8* [ %301, %297 ], [ %344, %313 ]
%316 = phi i32 [ %9, %297 ], [ %355, %313 ]
%317 = getelementptr inbounds i8, i8* %315, i64 -1
%318 = load i8, i8* %317
%319 = zext i8 %318 to i32
%320 = getelementptr inbounds i8, i8* %315, i64 1
%321 = load i8, i8* %320
%322 = zext i8 %321 to i32
%323 = add nuw nsw i32 %322, %319
%324 = lshr i32 %323, 1
%325 = getelementptr inbounds i8, i8* %315, i64 %96
%326 = load i8, i8* %325
%327 = zext i8 %326 to i32
%328 = load i8, i8* %315
%329 = zext i8 %328 to i32
%330 = tail call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %314, i32 %6, i32 %327, i32 %329, i32 %324)
%331 = load i8, i8* %325
%332 = zext i8 %331 to i32
%333 = getelementptr inbounds i8, i8* %315, i64 %99
%334 = load i8, i8* %333
%335 = zext i8 %334 to i32
%336 = add nuw nsw i32 %335, %332
%337 = lshr i32 %336, 1
%338 = load i8, i8* %315
%339 = zext i8 %338 to i16
%340 = getelementptr inbounds i8, i8* %315, i64 %95
%341 = load i8, i8* %340
%342 = zext i8 %341 to i16
%343 = add nuw nsw i16 %342, %339
%344 = getelementptr inbounds i8, i8* %315, i64 2
%345 = load i8, i8* %344
%346 = zext i8 %345 to i16
%347 = add nuw nsw i16 %343, %346
%348 = udiv i16 %347, 3
%349 = getelementptr inbounds i8, i8* %314, i64 %22
%350 = zext i16 %348 to i32
%351 = load i8, i8* %320
%352 = zext i8 %351 to i32
%353 = tail call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %349, i32 %6, i32 %337, i32 %350, i32 %352)
%354 = getelementptr inbounds i8, i8* %314, i64 %29
%355 = add i32 %316, -1
%356 = icmp eq i32 %355, 0
br i1 %356, label %357, label %313
357: ; preds = %313
%358 = getelementptr inbounds i8, i8* %315, i64 1
%359 = getelementptr inbounds i8, i8* %344, i64 %96
%360 = load i8, i8* %359
%361 = zext i8 %360 to i32
%362 = load i8, i8* %344
%363 = zext i8 %362 to i32
%364 = load i8, i8* %358
%365 = zext i8 %364 to i32
%366 = tail call i32 (i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @qc_imag_writergb to i32 (i8*, i32, i32, i32, i32, ...)*)(i8* %354, i32 %6, i32 %361, i32 %363, i32 %365)
ret void
}