#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ qc_imag_writergb(unsigned char *, int, unsigned char,
                                    unsigned char, unsigned char);
void qc_imag_bay2rgb_cott(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;
  total_columns = (columns >> 1) - 1;
  rows = (rows >> 1) - 1;
  bay_line2 = 2 * bay_line;
  rgb_line2 = 2 * rgb_line;
  do {
    cur_bay = bay;
    cur_rgb = rgb;
    columns = total_columns;
    do {
      qc_imag_writergb(cur_rgb + 0, bpp, cur_bay[1],
                       ((unsigned int)cur_bay[0] + cur_bay[bay_line + 1]) / 2,
                       cur_bay[bay_line]);
      qc_imag_writergb(cur_rgb + bpp, bpp, cur_bay[1],
                       ((unsigned int)cur_bay[2] + cur_bay[bay_line + 1]) / 2,
                       cur_bay[bay_line + 2]);
      qc_imag_writergb(
          cur_rgb + rgb_line, bpp, cur_bay[bay_line2 + 1],
          ((unsigned int)cur_bay[bay_line2] + cur_bay[bay_line + 1]) / 2,
          cur_bay[bay_line]);
      qc_imag_writergb(
          cur_rgb + rgb_line + bpp, bpp, cur_bay[bay_line2 + 1],
          ((unsigned int)cur_bay[bay_line2 + 2] + cur_bay[bay_line + 1]) / 2,
          cur_bay[bay_line + 2]);
      cur_bay += 2;
      cur_rgb += 2 * bpp;
    } while (--columns);
    qc_imag_writergb(cur_rgb + 0, bpp, cur_bay[1],
                     ((unsigned int)cur_bay[0] + cur_bay[bay_line + 1]) / 2,
                     cur_bay[bay_line]);
    qc_imag_writergb(cur_rgb + bpp, bpp, cur_bay[1], cur_bay[bay_line + 1],
                     cur_bay[bay_line]);
    qc_imag_writergb(
        cur_rgb + rgb_line, bpp, cur_bay[bay_line2 + 1],
        ((unsigned int)cur_bay[bay_line2] + cur_bay[bay_line + 1]) / 2,
        cur_bay[bay_line]);
    qc_imag_writergb(cur_rgb + rgb_line + bpp, bpp, cur_bay[bay_line2 + 1],
                     cur_bay[bay_line + 1], cur_bay[bay_line]);
    bay += bay_line2;
    rgb += rgb_line2;
  } while (--rows);
  cur_bay = bay;
  cur_rgb = rgb;
  columns = total_columns;
  do {
    qc_imag_writergb(cur_rgb + 0, bpp, cur_bay[1],
                     ((unsigned int)cur_bay[0] + cur_bay[bay_line + 1]) / 2,
                     cur_bay[bay_line]);
    qc_imag_writergb(cur_rgb + bpp, bpp, cur_bay[1],
                     ((unsigned int)cur_bay[2] + cur_bay[bay_line + 1]) / 2,
                     cur_bay[bay_line + 2]);
    qc_imag_writergb(cur_rgb + rgb_line, bpp, cur_bay[1], cur_bay[bay_line + 1],
                     cur_bay[bay_line]);
    qc_imag_writergb(cur_rgb + rgb_line + bpp, bpp, cur_bay[1],
                     cur_bay[bay_line + 1], cur_bay[bay_line + 2]);
    cur_bay += 2;
    cur_rgb += 2 * bpp;
  } while (--columns);
  qc_imag_writergb(cur_rgb + 0, bpp, cur_bay[1],
                   ((unsigned int)cur_bay[0] + cur_bay[bay_line + 1]) / 2,
                   cur_bay[bay_line]);
  qc_imag_writergb(cur_rgb + bpp, bpp, cur_bay[1], cur_bay[bay_line + 1],
                   cur_bay[bay_line]);
  qc_imag_writergb(cur_rgb + rgb_line, bpp, cur_bay[1], cur_bay[bay_line + 1],
                   cur_bay[bay_line]);
  qc_imag_writergb(cur_rgb + rgb_line + bpp, bpp, cur_bay[1],
                   cur_bay[bay_line + 1], cur_bay[bay_line]);
}


x86 assembly (clang, -O0):
<qc_imag_bay2rgb_cott>:
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
sar    $0x1,%eax
sub    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x24(%rbp),%eax
sar    $0x1,%eax
sub    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x38(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
mov    0x1(%rax),%dl
mov    -0x30(%rbp),%rax
movzbl (%rax),%eax
mov    -0x30(%rbp),%rcx
mov    -0xc(%rbp),%r8d
add    $0x1,%r8d
movslq %r8d,%r8
movzbl (%rcx,%r8,1),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,%cl
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%r8
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl (%rax,%r8,1),%r8d
call   1030 <qc_imag_writergb@plt>
mov    -0x38(%rbp),%rdi
movslq 0x10(%rbp),%rax
add    %rax,%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
mov    0x1(%rax),%dl
mov    -0x30(%rbp),%rax
movzbl 0x2(%rax),%eax
mov    -0x30(%rbp),%rcx
mov    -0xc(%rbp),%r8d
add    $0x1,%r8d
movslq %r8d,%r8
movzbl (%rcx,%r8,1),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,%cl
mov    -0x30(%rbp),%rax
mov    -0xc(%rbp),%r8d
add    $0x2,%r8d
movslq %r8d,%r8
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl (%rax,%r8,1),%r8d
call   1030 <qc_imag_writergb@plt>
mov    -0x38(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x30(%rbp),%rcx
mov    -0xc(%rbp),%r8d
add    $0x1,%r8d
movslq %r8d,%r8
movzbl (%rcx,%r8,1),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,%cl
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%r8
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl (%rax,%r8,1),%r8d
call   1030 <qc_imag_writergb@plt>
mov    -0x38(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
movslq 0x10(%rbp),%rax
add    %rax,%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x30(%rbp),%rcx
mov    -0xc(%rbp),%r8d
add    $0x1,%r8d
movslq %r8d,%r8
movzbl (%rcx,%r8,1),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,%cl
mov    -0x30(%rbp),%rax
mov    -0xc(%rbp),%r8d
add    $0x2,%r8d
movslq %r8d,%r8
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl (%rax,%r8,1),%r8d
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    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
cmp    $0x0,%eax
jne    1171 <qc_imag_bay2rgb_cott+0x61>
mov    -0x38(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
mov    0x1(%rax),%dl
mov    -0x30(%rbp),%rax
movzbl (%rax),%eax
mov    -0x30(%rbp),%rcx
mov    -0xc(%rbp),%r8d
add    $0x1,%r8d
movslq %r8d,%r8
movzbl (%rcx,%r8,1),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,%cl
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%r8
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl (%rax,%r8,1),%r8d
call   1030 <qc_imag_writergb@plt>
mov    -0x38(%rbp),%rdi
movslq 0x10(%rbp),%rax
add    %rax,%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
mov    0x1(%rax),%dl
mov    -0x30(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%r8
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl (%rax,%r8,1),%r8d
call   1030 <qc_imag_writergb@plt>
mov    -0x38(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x30(%rbp),%rcx
mov    -0xc(%rbp),%r8d
add    $0x1,%r8d
movslq %r8d,%r8
movzbl (%rcx,%r8,1),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,%cl
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%r8
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl (%rax,%r8,1),%r8d
call   1030 <qc_imag_writergb@plt>
mov    -0x38(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
movslq 0x10(%rbp),%rax
add    %rax,%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x30(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%r8
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl (%rax,%r8,1),%r8d
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    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
jne    115b <qc_imag_bay2rgb_cott+0x4b>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x38(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
mov    0x1(%rax),%dl
mov    -0x30(%rbp),%rax
movzbl (%rax),%eax
mov    -0x30(%rbp),%rcx
mov    -0xc(%rbp),%r8d
add    $0x1,%r8d
movslq %r8d,%r8
movzbl (%rcx,%r8,1),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,%cl
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%r8
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl (%rax,%r8,1),%r8d
call   1030 <qc_imag_writergb@plt>
mov    -0x38(%rbp),%rdi
movslq 0x10(%rbp),%rax
add    %rax,%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
mov    0x1(%rax),%dl
mov    -0x30(%rbp),%rax
movzbl 0x2(%rax),%eax
mov    -0x30(%rbp),%rcx
mov    -0xc(%rbp),%r8d
add    $0x1,%r8d
movslq %r8d,%r8
movzbl (%rcx,%r8,1),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,%cl
mov    -0x30(%rbp),%rax
mov    -0xc(%rbp),%r8d
add    $0x2,%r8d
movslq %r8d,%r8
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl (%rax,%r8,1),%r8d
call   1030 <qc_imag_writergb@plt>
mov    -0x38(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
mov    0x1(%rax),%dl
mov    -0x30(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%r8
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl (%rax,%r8,1),%r8d
call   1030 <qc_imag_writergb@plt>
mov    -0x38(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
movslq 0x10(%rbp),%rax
add    %rax,%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
mov    0x1(%rax),%dl
mov    -0x30(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x30(%rbp),%rax
mov    -0xc(%rbp),%r8d
add    $0x2,%r8d
movslq %r8d,%r8
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl (%rax,%r8,1),%r8d
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    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
cmp    $0x0,%eax
jne    1488 <qc_imag_bay2rgb_cott+0x378>
mov    -0x38(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
mov    0x1(%rax),%dl
mov    -0x30(%rbp),%rax
movzbl (%rax),%eax
mov    -0x30(%rbp),%rcx
mov    -0xc(%rbp),%r8d
add    $0x1,%r8d
movslq %r8d,%r8
movzbl (%rcx,%r8,1),%ecx
add    %ecx,%eax
shr    $0x1,%eax
mov    %al,%cl
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%r8
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl (%rax,%r8,1),%r8d
call   1030 <qc_imag_writergb@plt>
mov    -0x38(%rbp),%rdi
movslq 0x10(%rbp),%rax
add    %rax,%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
mov    0x1(%rax),%dl
mov    -0x30(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%r8
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl (%rax,%r8,1),%r8d
call   1030 <qc_imag_writergb@plt>
mov    -0x38(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
mov    0x1(%rax),%dl
mov    -0x30(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%r8
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl (%rax,%r8,1),%r8d
call   1030 <qc_imag_writergb@plt>
mov    -0x38(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
movslq 0x10(%rbp),%rax
add    %rax,%rdi
mov    0x10(%rbp),%esi
mov    -0x30(%rbp),%rax
mov    0x1(%rax),%dl
mov    -0x30(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%r8
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl (%rax,%r8,1),%r8d
call   1030 <qc_imag_writergb@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qc_imag_bay2rgb_cott>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rdx,%r12
mov    %rdi,%r13
mov    0xb0(%rsp),%eax
sar    %r8d
lea    -0x1(%r8),%edx
mov    %edx,0x20(%rsp)
sar    %r9d
add    $0xffffffff,%r9d
movslq %esi,%rdx
add    %esi,%esi
lea    0x1(%rdx),%rdi
mov    %rdi,0x28(%rsp)
movslq %eax,%rbp
lea    0x2(%rdx),%rax
mov    %rax,0x48(%rsp)
movslq %ecx,%r10
add    %ecx,%ecx
movslq %esi,%rsi
lea    0x0(%rbp,%rbp,1),%eax
cltq
mov    %rax,0x30(%rsp)
movslq %ecx,%rax
mov    %rax,0x50(%rsp)
lea    0x1(%rsi,%r13,1),%rax
lea    (%rdx,%r13,1),%rdi
add    $0x2,%rdi
lea    (%rdx,%r13,1),%r15
add    $0x1,%r15
movslq %r8d,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,0x68(%rsp)
mov    %rsi,0x58(%rsp)
lea    (%rsi,%r13,1),%rdx
add    $0x2,%rdx
mov    %r10,0x8(%rsp)
lea    (%r10,%rbp,1),%rcx
mov    %rcx,0x10(%rsp)
xchg   %ax,%ax
mov    %rdx,0x38(%rsp)
mov    %rdi,0x40(%rsp)
mov    %r9d,0x24(%rsp)
mov    %rax,0x18(%rsp)
xor    %r14d,%r14d
mov    %r12,0x60(%rsp)
mov    %r12,%rbx
mov    %r13,0x70(%rsp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl 0x1(%r13,%r14,2),%edx
movzbl 0x0(%r13,%r14,2),%eax
movzbl (%r15,%r14,2),%ecx
add    %eax,%ecx
shr    %ecx
movzbl -0x1(%r15,%r14,2),%r8d
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <qc_imag_writergb@plt>
lea    (%rbx,%rbp,1),%rdi
movzbl 0x1(%r13,%r14,2),%edx
movzbl 0x2(%r13,%r14,2),%eax
movzbl (%r15,%r14,2),%ecx
add    %eax,%ecx
shr    %ecx
mov    0x40(%rsp),%r12
movzbl (%r12,%r14,2),%r8d
mov    %ebp,%esi
call   1030 <qc_imag_writergb@plt>
mov    0x8(%rsp),%rax
lea    (%rbx,%rax,1),%rdi
mov    0x18(%rsp),%r13
movzbl 0x0(%r13,%r14,2),%edx
movzbl -0x1(%r13,%r14,2),%eax
movzbl (%r15,%r14,2),%ecx
add    %eax,%ecx
shr    %ecx
movzbl -0x1(%r15,%r14,2),%r8d
mov    %ebp,%esi
call   1030 <qc_imag_writergb@plt>
mov    0x10(%rsp),%rax
lea    (%rbx,%rax,1),%rdi
movzbl 0x0(%r13,%r14,2),%edx
mov    0x70(%rsp),%r13
mov    0x38(%rsp),%rax
movzbl (%rax,%r14,2),%eax
movzbl (%r15,%r14,2),%ecx
add    %eax,%ecx
shr    %ecx
movzbl (%r12,%r14,2),%r8d
mov    %ebp,%esi
call   1030 <qc_imag_writergb@plt>
add    0x30(%rsp),%rbx
add    $0x1,%r14
cmp    %r14d,0x68(%rsp)
jne    11e0 <qc_imag_bay2rgb_cott+0xd0>
movzbl 0x1(%r13,%r14,2),%edx
movzbl 0x0(%r13,%r14,2),%eax
movzbl (%r15,%r14,2),%ecx
add    %eax,%ecx
shr    %ecx
movzbl -0x1(%r15,%r14,2),%r8d
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <qc_imag_writergb@plt>
lea    (%rbx,%rbp,1),%rdi
movzbl 0x1(%r13,%r14,2),%edx
movzbl (%r15,%r14,2),%ecx
movzbl -0x1(%r15,%r14,2),%r8d
mov    %ebp,%esi
call   1030 <qc_imag_writergb@plt>
mov    0x8(%rsp),%rax
lea    (%rbx,%rax,1),%rdi
mov    0x18(%rsp),%rcx
movzbl (%rcx,%r14,2),%edx
movzbl -0x1(%rcx,%r14,2),%eax
mov    %rcx,%r12
movzbl (%r15,%r14,2),%ecx
add    %eax,%ecx
shr    %ecx
movzbl -0x1(%r15,%r14,2),%r8d
mov    %ebp,%esi
call   1030 <qc_imag_writergb@plt>
add    0x10(%rsp),%rbx
movzbl (%r12,%r14,2),%edx
movzbl (%r15,%r14,2),%ecx
movzbl -0x1(%r15,%r14,2),%r8d
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <qc_imag_writergb@plt>
mov    0x58(%rsp),%rcx
add    %rcx,%r13
mov    0x60(%rsp),%r12
add    0x50(%rsp),%r12
mov    0x18(%rsp),%rbx
lea    (%rbx,%rcx,1),%rax
mov    0x38(%rsp),%rdx
add    %rcx,%rdx
mov    0x40(%rsp),%rdi
add    %rcx,%rdi
add    %rcx,%r15
mov    0x24(%rsp),%r9d
add    $0xffffffff,%r9d
jne    11b0 <qc_imag_bay2rgb_cott+0xa0>
mov    0x28(%rsp),%rax
lea    -0x1(%rax),%r13
mov    0x20(%rsp),%r14d
mov    0x48(%rsp),%r15
nopl   0x0(%rax,%rax,1)
movzbl (%rbx),%edx
movzbl -0x1(%rbx),%eax
movzbl (%rbx,%r13,1),%ecx
add    %eax,%ecx
shr    %ecx
movzbl -0x1(%rbx,%r13,1),%r8d
mov    %r12,%rdi
mov    %ebp,%esi
call   1030 <qc_imag_writergb@plt>
lea    (%r12,%rbp,1),%rdi
movzbl (%rbx),%edx
movzbl 0x1(%rbx),%eax
movzbl (%rbx,%r13,1),%ecx
add    %eax,%ecx
shr    %ecx
movzbl -0x1(%rbx,%r15,1),%r8d
mov    %ebp,%esi
call   1030 <qc_imag_writergb@plt>
mov    0x8(%rsp),%rax
lea    (%r12,%rax,1),%rdi
movzbl (%rbx),%edx
movzbl (%rbx,%r13,1),%ecx
movzbl -0x1(%rbx,%r13,1),%r8d
mov    %ebp,%esi
call   1030 <qc_imag_writergb@plt>
mov    0x10(%rsp),%rax
lea    (%r12,%rax,1),%rdi
movzbl (%rbx),%edx
movzbl (%rbx,%r13,1),%ecx
movzbl -0x1(%rbx,%r15,1),%r8d
mov    %ebp,%esi
call   1030 <qc_imag_writergb@plt>
add    0x30(%rsp),%r12
add    $0x2,%rbx
add    $0xffffffff,%r14d
jne    1390 <qc_imag_bay2rgb_cott+0x280>
movzbl (%rbx),%edx
movzbl -0x1(%rbx),%eax
mov    0x28(%rsp),%r14
movzbl -0x1(%r14,%rbx,1),%ecx
add    %eax,%ecx
shr    %ecx
movzbl -0x2(%r14,%rbx,1),%r8d
mov    %r12,%rdi
mov    %ebp,%esi
call   1030 <qc_imag_writergb@plt>
lea    (%r12,%rbp,1),%rdi
movzbl (%rbx),%edx
movzbl -0x1(%r14,%rbx,1),%ecx
movzbl -0x2(%r14,%rbx,1),%r8d
mov    %ebp,%esi
call   1030 <qc_imag_writergb@plt>
mov    0x8(%rsp),%r15
add    %r12,%r15
movzbl (%rbx),%edx
movzbl -0x1(%r14,%rbx,1),%ecx
movzbl -0x2(%r14,%rbx,1),%r8d
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <qc_imag_writergb@plt>
add    %rbp,%r15
movzbl (%rbx),%edx
movzbl -0x1(%r14,%rbx,1),%ecx
movzbl -0x2(%r14,%rbx,1),%r8d
mov    %r15,%rdi
mov    %ebp,%esi
add    $0x78,%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_cott(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
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
%20 = load i32, i32* %12
%21 = ashr i32 %20, 1
%22 = sub nsw i32 %21, 1
store i32 %22, i32* %19
%23 = load i32, i32* %13
%24 = ashr i32 %23, 1
%25 = sub nsw i32 %24, 1
store i32 %25, i32* %13
%26 = load i32, i32* %9
%27 = mul nsw i32 2, %26
store i32 %27, i32* %17
%28 = load i32, i32* %11
%29 = mul nsw i32 2, %28
store i32 %29, i32* %18
br label %30
30: ; preds = %286, %7
%31 = load i8*, i8** %8
store i8* %31, i8** %15
%32 = load i8*, i8** %10
store i8* %32, i8** %16
%33 = load i32, i32* %19
store i32 %33, i32* %12
br label %34
34: ; preds = %168, %30
%35 = load i8*, i8** %16
%36 = getelementptr inbounds i8, i8* %35, i64 0
%37 = load i32, i32* %14
%38 = load i8*, i8** %15
%39 = getelementptr inbounds i8, i8* %38, i64 1
%40 = load i8, i8* %39
%41 = load i8*, i8** %15
%42 = getelementptr inbounds i8, i8* %41, i64 0
%43 = load i8, i8* %42
%44 = zext i8 %43 to i32
%45 = load i8*, i8** %15
%46 = load i32, i32* %9
%47 = add nsw i32 %46, 1
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %45, i64 %48
%50 = load i8, i8* %49
%51 = zext i8 %50 to i32
%52 = add i32 %44, %51
%53 = udiv i32 %52, 2
%54 = trunc i32 %53 to i8
%55 = load i8*, i8** %15
%56 = load i32, i32* %9
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %55, i64 %57
%59 = load i8, i8* %58
%60 = call i32 @qc_imag_writergb(i8* %36, i32 %37, i8 zeroext %40, i8 zeroext %54, i8 zeroext %59)
%61 = load i8*, i8** %16
%62 = load i32, i32* %14
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8, i8* %61, i64 %63
%65 = load i32, i32* %14
%66 = load i8*, i8** %15
%67 = getelementptr inbounds i8, i8* %66, i64 1
%68 = load i8, i8* %67
%69 = load i8*, i8** %15
%70 = getelementptr inbounds i8, i8* %69, i64 2
%71 = load i8, i8* %70
%72 = zext i8 %71 to i32
%73 = load i8*, i8** %15
%74 = load i32, i32* %9
%75 = add nsw i32 %74, 1
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i8, i8* %73, i64 %76
%78 = load i8, i8* %77
%79 = zext i8 %78 to i32
%80 = add i32 %72, %79
%81 = udiv i32 %80, 2
%82 = trunc i32 %81 to i8
%83 = load i8*, i8** %15
%84 = load i32, i32* %9
%85 = add nsw i32 %84, 2
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8, i8* %83, i64 %86
%88 = load i8, i8* %87
%89 = call i32 @qc_imag_writergb(i8* %64, i32 %65, i8 zeroext %68, i8 zeroext %82, i8 zeroext %88)
%90 = load i8*, i8** %16
%91 = load i32, i32* %11
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds i8, i8* %90, i64 %92
%94 = load i32, i32* %14
%95 = load i8*, i8** %15
%96 = load i32, i32* %17
%97 = add nsw i32 %96, 1
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i8, i8* %95, i64 %98
%100 = load i8, i8* %99
%101 = load i8*, i8** %15
%102 = load i32, i32* %17
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i8, i8* %101, i64 %103
%105 = load i8, i8* %104
%106 = zext i8 %105 to i32
%107 = load i8*, i8** %15
%108 = load i32, i32* %9
%109 = add nsw i32 %108, 1
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i8, i8* %107, i64 %110
%112 = load i8, i8* %111
%113 = zext i8 %112 to i32
%114 = add i32 %106, %113
%115 = udiv i32 %114, 2
%116 = trunc i32 %115 to i8
%117 = load i8*, i8** %15
%118 = load i32, i32* %9
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds i8, i8* %117, i64 %119
%121 = load i8, i8* %120
%122 = call i32 @qc_imag_writergb(i8* %93, i32 %94, i8 zeroext %100, i8 zeroext %116, i8 zeroext %121)
%123 = load i8*, i8** %16
%124 = load i32, i32* %11
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds i8, i8* %123, i64 %125
%127 = load i32, i32* %14
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds i8, i8* %126, i64 %128
%130 = load i32, i32* %14
%131 = load i8*, i8** %15
%132 = load i32, i32* %17
%133 = add nsw i32 %132, 1
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds i8, i8* %131, i64 %134
%136 = load i8, i8* %135
%137 = load i8*, i8** %15
%138 = load i32, i32* %17
%139 = add nsw i32 %138, 2
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds i8, i8* %137, i64 %140
%142 = load i8, i8* %141
%143 = zext i8 %142 to i32
%144 = load i8*, i8** %15
%145 = load i32, i32* %9
%146 = add nsw i32 %145, 1
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds i8, i8* %144, i64 %147
%149 = load i8, i8* %148
%150 = zext i8 %149 to i32
%151 = add i32 %143, %150
%152 = udiv i32 %151, 2
%153 = trunc i32 %152 to i8
%154 = load i8*, i8** %15
%155 = load i32, i32* %9
%156 = add nsw i32 %155, 2
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds i8, i8* %154, i64 %157
%159 = load i8, i8* %158
%160 = call i32 @qc_imag_writergb(i8* %129, i32 %130, i8 zeroext %136, i8 zeroext %153, i8 zeroext %159)
%161 = load i8*, i8** %15
%162 = getelementptr inbounds i8, i8* %161, i64 2
store i8* %162, i8** %15
%163 = load i32, i32* %14
%164 = mul nsw i32 2, %163
%165 = load i8*, i8** %16
%166 = sext i32 %164 to i64
%167 = getelementptr inbounds i8, i8* %165, i64 %166
store i8* %167, i8** %16
br label %168
168: ; preds = %34
%169 = load i32, i32* %12
%170 = add nsw i32 %169, -1
store i32 %170, i32* %12
%171 = icmp ne i32 %170, 0
br i1 %171, label %34, label %172
172: ; preds = %168
%173 = load i8*, i8** %16
%174 = getelementptr inbounds i8, i8* %173, i64 0
%175 = load i32, i32* %14
%176 = load i8*, i8** %15
%177 = getelementptr inbounds i8, i8* %176, i64 1
%178 = load i8, i8* %177
%179 = load i8*, i8** %15
%180 = getelementptr inbounds i8, i8* %179, i64 0
%181 = load i8, i8* %180
%182 = zext i8 %181 to i32
%183 = load i8*, i8** %15
%184 = load i32, i32* %9
%185 = add nsw i32 %184, 1
%186 = sext i32 %185 to i64
%187 = getelementptr inbounds i8, i8* %183, i64 %186
%188 = load i8, i8* %187
%189 = zext i8 %188 to i32
%190 = add i32 %182, %189
%191 = udiv i32 %190, 2
%192 = trunc i32 %191 to i8
%193 = load i8*, i8** %15
%194 = load i32, i32* %9
%195 = sext i32 %194 to i64
%196 = getelementptr inbounds i8, i8* %193, i64 %195
%197 = load i8, i8* %196
%198 = call i32 @qc_imag_writergb(i8* %174, i32 %175, i8 zeroext %178, i8 zeroext %192, i8 zeroext %197)
%199 = load i8*, i8** %16
%200 = load i32, i32* %14
%201 = sext i32 %200 to i64
%202 = getelementptr inbounds i8, i8* %199, i64 %201
%203 = load i32, i32* %14
%204 = load i8*, i8** %15
%205 = getelementptr inbounds i8, i8* %204, i64 1
%206 = load i8, i8* %205
%207 = load i8*, i8** %15
%208 = load i32, i32* %9
%209 = add nsw i32 %208, 1
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds i8, i8* %207, i64 %210
%212 = load i8, i8* %211
%213 = load i8*, i8** %15
%214 = load i32, i32* %9
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds i8, i8* %213, i64 %215
%217 = load i8, i8* %216
%218 = call i32 @qc_imag_writergb(i8* %202, i32 %203, i8 zeroext %206, i8 zeroext %212, i8 zeroext %217)
%219 = load i8*, i8** %16
%220 = load i32, i32* %11
%221 = sext i32 %220 to i64
%222 = getelementptr inbounds i8, i8* %219, i64 %221
%223 = load i32, i32* %14
%224 = load i8*, i8** %15
%225 = load i32, i32* %17
%226 = add nsw i32 %225, 1
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds i8, i8* %224, i64 %227
%229 = load i8, i8* %228
%230 = load i8*, i8** %15
%231 = load i32, i32* %17
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds i8, i8* %230, i64 %232
%234 = load i8, i8* %233
%235 = zext i8 %234 to i32
%236 = load i8*, i8** %15
%237 = load i32, i32* %9
%238 = add nsw i32 %237, 1
%239 = sext i32 %238 to i64
%240 = getelementptr inbounds i8, i8* %236, i64 %239
%241 = load i8, i8* %240
%242 = zext i8 %241 to i32
%243 = add i32 %235, %242
%244 = udiv i32 %243, 2
%245 = trunc i32 %244 to i8
%246 = load i8*, i8** %15
%247 = load i32, i32* %9
%248 = sext i32 %247 to i64
%249 = getelementptr inbounds i8, i8* %246, i64 %248
%250 = load i8, i8* %249
%251 = call i32 @qc_imag_writergb(i8* %222, i32 %223, i8 zeroext %229, i8 zeroext %245, i8 zeroext %250)
%252 = load i8*, i8** %16
%253 = load i32, i32* %11
%254 = sext i32 %253 to i64
%255 = getelementptr inbounds i8, i8* %252, i64 %254
%256 = load i32, i32* %14
%257 = sext i32 %256 to i64
%258 = getelementptr inbounds i8, i8* %255, i64 %257
%259 = load i32, i32* %14
%260 = load i8*, i8** %15
%261 = load i32, i32* %17
%262 = add nsw i32 %261, 1
%263 = sext i32 %262 to i64
%264 = getelementptr inbounds i8, i8* %260, i64 %263
%265 = load i8, i8* %264
%266 = load i8*, i8** %15
%267 = load i32, i32* %9
%268 = add nsw i32 %267, 1
%269 = sext i32 %268 to i64
%270 = getelementptr inbounds i8, i8* %266, i64 %269
%271 = load i8, i8* %270
%272 = load i8*, i8** %15
%273 = load i32, i32* %9
%274 = sext i32 %273 to i64
%275 = getelementptr inbounds i8, i8* %272, i64 %274
%276 = load i8, i8* %275
%277 = call i32 @qc_imag_writergb(i8* %258, i32 %259, i8 zeroext %265, i8 zeroext %271, i8 zeroext %276)
%278 = load i32, i32* %17
%279 = load i8*, i8** %8
%280 = sext i32 %278 to i64
%281 = getelementptr inbounds i8, i8* %279, i64 %280
store i8* %281, i8** %8
%282 = load i32, i32* %18
%283 = load i8*, i8** %10
%284 = sext i32 %282 to i64
%285 = getelementptr inbounds i8, i8* %283, i64 %284
store i8* %285, i8** %10
br label %286
286: ; preds = %172
%287 = load i32, i32* %13
%288 = add nsw i32 %287, -1
store i32 %288, i32* %13
%289 = icmp ne i32 %288, 0
br i1 %289, label %30, label %290
290: ; preds = %286
%291 = load i8*, i8** %8
store i8* %291, i8** %15
%292 = load i8*, i8** %10
store i8* %292, i8** %16
%293 = load i32, i32* %19
store i32 %293, i32* %12
br label %294
294: ; preds = %401, %290
%295 = load i8*, i8** %16
%296 = getelementptr inbounds i8, i8* %295, i64 0
%297 = load i32, i32* %14
%298 = load i8*, i8** %15
%299 = getelementptr inbounds i8, i8* %298, i64 1
%300 = load i8, i8* %299
%301 = load i8*, i8** %15
%302 = getelementptr inbounds i8, i8* %301, i64 0
%303 = load i8, i8* %302
%304 = zext i8 %303 to i32
%305 = load i8*, i8** %15
%306 = load i32, i32* %9
%307 = add nsw i32 %306, 1
%308 = sext i32 %307 to i64
%309 = getelementptr inbounds i8, i8* %305, i64 %308
%310 = load i8, i8* %309
%311 = zext i8 %310 to i32
%312 = add i32 %304, %311
%313 = udiv i32 %312, 2
%314 = trunc i32 %313 to i8
%315 = load i8*, i8** %15
%316 = load i32, i32* %9
%317 = sext i32 %316 to i64
%318 = getelementptr inbounds i8, i8* %315, i64 %317
%319 = load i8, i8* %318
%320 = call i32 @qc_imag_writergb(i8* %296, i32 %297, i8 zeroext %300, i8 zeroext %314, i8 zeroext %319)
%321 = load i8*, i8** %16
%322 = load i32, i32* %14
%323 = sext i32 %322 to i64
%324 = getelementptr inbounds i8, i8* %321, i64 %323
%325 = load i32, i32* %14
%326 = load i8*, i8** %15
%327 = getelementptr inbounds i8, i8* %326, i64 1
%328 = load i8, i8* %327
%329 = load i8*, i8** %15
%330 = getelementptr inbounds i8, i8* %329, i64 2
%331 = load i8, i8* %330
%332 = zext i8 %331 to i32
%333 = load i8*, i8** %15
%334 = load i32, i32* %9
%335 = add nsw i32 %334, 1
%336 = sext i32 %335 to i64
%337 = getelementptr inbounds i8, i8* %333, i64 %336
%338 = load i8, i8* %337
%339 = zext i8 %338 to i32
%340 = add i32 %332, %339
%341 = udiv i32 %340, 2
%342 = trunc i32 %341 to i8
%343 = load i8*, i8** %15
%344 = load i32, i32* %9
%345 = add nsw i32 %344, 2
%346 = sext i32 %345 to i64
%347 = getelementptr inbounds i8, i8* %343, i64 %346
%348 = load i8, i8* %347
%349 = call i32 @qc_imag_writergb(i8* %324, i32 %325, i8 zeroext %328, i8 zeroext %342, i8 zeroext %348)
%350 = load i8*, i8** %16
%351 = load i32, i32* %11
%352 = sext i32 %351 to i64
%353 = getelementptr inbounds i8, i8* %350, i64 %352
%354 = load i32, i32* %14
%355 = load i8*, i8** %15
%356 = getelementptr inbounds i8, i8* %355, i64 1
%357 = load i8, i8* %356
%358 = load i8*, i8** %15
%359 = load i32, i32* %9
%360 = add nsw i32 %359, 1
%361 = sext i32 %360 to i64
%362 = getelementptr inbounds i8, i8* %358, i64 %361
%363 = load i8, i8* %362
%364 = load i8*, i8** %15
%365 = load i32, i32* %9
%366 = sext i32 %365 to i64
%367 = getelementptr inbounds i8, i8* %364, i64 %366
%368 = load i8, i8* %367
%369 = call i32 @qc_imag_writergb(i8* %353, i32 %354, i8 zeroext %357, i8 zeroext %363, i8 zeroext %368)
%370 = load i8*, i8** %16
%371 = load i32, i32* %11
%372 = sext i32 %371 to i64
%373 = getelementptr inbounds i8, i8* %370, i64 %372
%374 = load i32, i32* %14
%375 = sext i32 %374 to i64
%376 = getelementptr inbounds i8, i8* %373, i64 %375
%377 = load i32, i32* %14
%378 = load i8*, i8** %15
%379 = getelementptr inbounds i8, i8* %378, i64 1
%380 = load i8, i8* %379
%381 = load i8*, i8** %15
%382 = load i32, i32* %9
%383 = add nsw i32 %382, 1
%384 = sext i32 %383 to i64
%385 = getelementptr inbounds i8, i8* %381, i64 %384
%386 = load i8, i8* %385
%387 = load i8*, i8** %15
%388 = load i32, i32* %9
%389 = add nsw i32 %388, 2
%390 = sext i32 %389 to i64
%391 = getelementptr inbounds i8, i8* %387, i64 %390
%392 = load i8, i8* %391
%393 = call i32 @qc_imag_writergb(i8* %376, i32 %377, i8 zeroext %380, i8 zeroext %386, i8 zeroext %392)
%394 = load i8*, i8** %15
%395 = getelementptr inbounds i8, i8* %394, i64 2
store i8* %395, i8** %15
%396 = load i32, i32* %14
%397 = mul nsw i32 2, %396
%398 = load i8*, i8** %16
%399 = sext i32 %397 to i64
%400 = getelementptr inbounds i8, i8* %398, i64 %399
store i8* %400, i8** %16
br label %401
401: ; preds = %294
%402 = load i32, i32* %12
%403 = add nsw i32 %402, -1
store i32 %403, i32* %12
%404 = icmp ne i32 %403, 0
br i1 %404, label %294, label %405
405: ; preds = %401
%406 = load i8*, i8** %16
%407 = getelementptr inbounds i8, i8* %406, i64 0
%408 = load i32, i32* %14
%409 = load i8*, i8** %15
%410 = getelementptr inbounds i8, i8* %409, i64 1
%411 = load i8, i8* %410
%412 = load i8*, i8** %15
%413 = getelementptr inbounds i8, i8* %412, i64 0
%414 = load i8, i8* %413
%415 = zext i8 %414 to i32
%416 = load i8*, i8** %15
%417 = load i32, i32* %9
%418 = add nsw i32 %417, 1
%419 = sext i32 %418 to i64
%420 = getelementptr inbounds i8, i8* %416, i64 %419
%421 = load i8, i8* %420
%422 = zext i8 %421 to i32
%423 = add i32 %415, %422
%424 = udiv i32 %423, 2
%425 = trunc i32 %424 to i8
%426 = load i8*, i8** %15
%427 = load i32, i32* %9
%428 = sext i32 %427 to i64
%429 = getelementptr inbounds i8, i8* %426, i64 %428
%430 = load i8, i8* %429
%431 = call i32 @qc_imag_writergb(i8* %407, i32 %408, i8 zeroext %411, i8 zeroext %425, i8 zeroext %430)
%432 = load i8*, i8** %16
%433 = load i32, i32* %14
%434 = sext i32 %433 to i64
%435 = getelementptr inbounds i8, i8* %432, i64 %434
%436 = load i32, i32* %14
%437 = load i8*, i8** %15
%438 = getelementptr inbounds i8, i8* %437, i64 1
%439 = load i8, i8* %438
%440 = load i8*, i8** %15
%441 = load i32, i32* %9
%442 = add nsw i32 %441, 1
%443 = sext i32 %442 to i64
%444 = getelementptr inbounds i8, i8* %440, i64 %443
%445 = load i8, i8* %444
%446 = load i8*, i8** %15
%447 = load i32, i32* %9
%448 = sext i32 %447 to i64
%449 = getelementptr inbounds i8, i8* %446, i64 %448
%450 = load i8, i8* %449
%451 = call i32 @qc_imag_writergb(i8* %435, i32 %436, i8 zeroext %439, i8 zeroext %445, i8 zeroext %450)
%452 = load i8*, i8** %16
%453 = load i32, i32* %11
%454 = sext i32 %453 to i64
%455 = getelementptr inbounds i8, i8* %452, i64 %454
%456 = load i32, i32* %14
%457 = load i8*, i8** %15
%458 = getelementptr inbounds i8, i8* %457, i64 1
%459 = load i8, i8* %458
%460 = load i8*, i8** %15
%461 = load i32, i32* %9
%462 = add nsw i32 %461, 1
%463 = sext i32 %462 to i64
%464 = getelementptr inbounds i8, i8* %460, i64 %463
%465 = load i8, i8* %464
%466 = load i8*, i8** %15
%467 = load i32, i32* %9
%468 = sext i32 %467 to i64
%469 = getelementptr inbounds i8, i8* %466, i64 %468
%470 = load i8, i8* %469
%471 = call i32 @qc_imag_writergb(i8* %455, i32 %456, i8 zeroext %459, i8 zeroext %465, i8 zeroext %470)
%472 = load i8*, i8** %16
%473 = load i32, i32* %11
%474 = sext i32 %473 to i64
%475 = getelementptr inbounds i8, i8* %472, i64 %474
%476 = load i32, i32* %14
%477 = sext i32 %476 to i64
%478 = getelementptr inbounds i8, i8* %475, i64 %477
%479 = load i32, i32* %14
%480 = load i8*, i8** %15
%481 = getelementptr inbounds i8, i8* %480, i64 1
%482 = load i8, i8* %481
%483 = load i8*, i8** %15
%484 = load i32, i32* %9
%485 = add nsw i32 %484, 1
%486 = sext i32 %485 to i64
%487 = getelementptr inbounds i8, i8* %483, i64 %486
%488 = load i8, i8* %487
%489 = load i8*, i8** %15
%490 = load i32, i32* %9
%491 = sext i32 %490 to i64
%492 = getelementptr inbounds i8, i8* %489, i64 %491
%493 = load i8, i8* %492
%494 = call i32 @qc_imag_writergb(i8* %478, i32 %479, i8 zeroext %482, i8 zeroext %488, i8 zeroext %493)
ret void
}

LLVM IR (-O2):
define void @qc_imag_bay2rgb_cott(i8* nocapture %0, i32 %1, i8* %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = ashr i32 %4, 1
%9 = add nsw i32 %8, -1
%10 = ashr i32 %5, 1
%11 = add nsw i32 %10, -1
%12 = shl nsw i32 %1, 1
%13 = shl nsw i32 %3, 1
%14 = add nsw i32 %1, 1
%15 = sext i32 %14 to i64
%16 = sext i32 %1 to i64
%17 = sext i32 %6 to i64
%18 = add nsw i32 %1, 2
%19 = sext i32 %18 to i64
%20 = sext i32 %3 to i64
%21 = or i32 %12, 1
%22 = sext i32 %21 to i64
%23 = sext i32 %12 to i64
%24 = add nsw i32 %12, 2
%25 = sext i32 %24 to i64
%26 = shl nsw i32 %6, 1
%27 = sext i32 %26 to i64
%28 = sext i32 %13 to i64
br label %29
29: ; preds = %91, %7
%30 = phi i32 [ %11, %7 ], [ %130, %91 ]
%31 = phi i8* [ %2, %7 ], [ %129, %91 ]
%32 = phi i8* [ %0, %7 ], [ %128, %91 ]
br label %33
33: ; preds = %33, %29
%34 = phi i8* [ %32, %29 ], [ %52, %33 ]
%35 = phi i8* [ %31, %29 ], [ %88, %33 ]
%36 = phi i32 [ %9, %29 ], [ %89, %33 ]
%37 = getelementptr inbounds i8, i8* %34, i64 1
%38 = load i8, i8* %37
%39 = load i8, i8* %34
%40 = zext i8 %39 to i16
%41 = getelementptr inbounds i8, i8* %34, i64 %15
%42 = load i8, i8* %41
%43 = zext i8 %42 to i16
%44 = add nuw nsw i16 %43, %40
%45 = lshr i16 %44, 1
%46 = trunc i16 %45 to i8
%47 = getelementptr inbounds i8, i8* %34, i64 %16
%48 = load i8, i8* %47
%49 = tail call i32 @qc_imag_writergb(i8* %35, i32 %6, i8 zeroext %38, i8 zeroext %46, i8 zeroext %48)
%50 = getelementptr inbounds i8, i8* %35, i64 %17
%51 = load i8, i8* %37
%52 = getelementptr inbounds i8, i8* %34, i64 2
%53 = load i8, i8* %52
%54 = zext i8 %53 to i16
%55 = load i8, i8* %41
%56 = zext i8 %55 to i16
%57 = add nuw nsw i16 %56, %54
%58 = lshr i16 %57, 1
%59 = trunc i16 %58 to i8
%60 = getelementptr inbounds i8, i8* %34, i64 %19
%61 = load i8, i8* %60
%62 = tail call i32 @qc_imag_writergb(i8* %50, i32 %6, i8 zeroext %51, i8 zeroext %59, i8 zeroext %61)
%63 = getelementptr inbounds i8, i8* %35, i64 %20
%64 = getelementptr inbounds i8, i8* %34, i64 %22
%65 = load i8, i8* %64
%66 = getelementptr inbounds i8, i8* %34, i64 %23
%67 = load i8, i8* %66
%68 = zext i8 %67 to i16
%69 = load i8, i8* %41
%70 = zext i8 %69 to i16
%71 = add nuw nsw i16 %70, %68
%72 = lshr i16 %71, 1
%73 = trunc i16 %72 to i8
%74 = load i8, i8* %47
%75 = tail call i32 @qc_imag_writergb(i8* %63, i32 %6, i8 zeroext %65, i8 zeroext %73, i8 zeroext %74)
%76 = getelementptr inbounds i8, i8* %63, i64 %17
%77 = load i8, i8* %64
%78 = getelementptr inbounds i8, i8* %34, i64 %25
%79 = load i8, i8* %78
%80 = zext i8 %79 to i16
%81 = load i8, i8* %41
%82 = zext i8 %81 to i16
%83 = add nuw nsw i16 %82, %80
%84 = lshr i16 %83, 1
%85 = trunc i16 %84 to i8
%86 = load i8, i8* %60
%87 = tail call i32 @qc_imag_writergb(i8* %76, i32 %6, i8 zeroext %77, i8 zeroext %85, i8 zeroext %86)
%88 = getelementptr inbounds i8, i8* %35, i64 %27
%89 = add nsw i32 %36, -1
%90 = icmp eq i32 %89, 0
br i1 %90, label %91, label %33
91: ; preds = %33
%92 = getelementptr inbounds i8, i8* %34, i64 3
%93 = load i8, i8* %92
%94 = load i8, i8* %52
%95 = zext i8 %94 to i16
%96 = getelementptr inbounds i8, i8* %52, i64 %15
%97 = load i8, i8* %96
%98 = zext i8 %97 to i16
%99 = add nuw nsw i16 %98, %95
%100 = lshr i16 %99, 1
%101 = trunc i16 %100 to i8
%102 = getelementptr inbounds i8, i8* %52, i64 %16
%103 = load i8, i8* %102
%104 = tail call i32 @qc_imag_writergb(i8* %88, i32 %6, i8 zeroext %93, i8 zeroext %101, i8 zeroext %103)
%105 = getelementptr inbounds i8, i8* %88, i64 %17
%106 = load i8, i8* %92
%107 = load i8, i8* %96
%108 = load i8, i8* %102
%109 = tail call i32 @qc_imag_writergb(i8* %105, i32 %6, i8 zeroext %106, i8 zeroext %107, i8 zeroext %108)
%110 = getelementptr inbounds i8, i8* %88, i64 %20
%111 = getelementptr inbounds i8, i8* %52, i64 %22
%112 = load i8, i8* %111
%113 = getelementptr inbounds i8, i8* %52, i64 %23
%114 = load i8, i8* %113
%115 = zext i8 %114 to i16
%116 = load i8, i8* %96
%117 = zext i8 %116 to i16
%118 = add nuw nsw i16 %117, %115
%119 = lshr i16 %118, 1
%120 = trunc i16 %119 to i8
%121 = load i8, i8* %102
%122 = tail call i32 @qc_imag_writergb(i8* %110, i32 %6, i8 zeroext %112, i8 zeroext %120, i8 zeroext %121)
%123 = getelementptr inbounds i8, i8* %110, i64 %17
%124 = load i8, i8* %111
%125 = load i8, i8* %96
%126 = load i8, i8* %102
%127 = tail call i32 @qc_imag_writergb(i8* %123, i32 %6, i8 zeroext %124, i8 zeroext %125, i8 zeroext %126)
%128 = getelementptr inbounds i8, i8* %32, i64 %23
%129 = getelementptr inbounds i8, i8* %31, i64 %28
%130 = add nsw i32 %30, -1
%131 = icmp eq i32 %130, 0
br i1 %131, label %132, label %29
132: ; preds = %91, %132
%133 = phi i8* [ %151, %132 ], [ %128, %91 ]
%134 = phi i8* [ %172, %132 ], [ %129, %91 ]
%135 = phi i32 [ %173, %132 ], [ %9, %91 ]
%136 = getelementptr inbounds i8, i8* %133, i64 1
%137 = load i8, i8* %136
%138 = load i8, i8* %133
%139 = zext i8 %138 to i16
%140 = getelementptr inbounds i8, i8* %133, i64 %15
%141 = load i8, i8* %140
%142 = zext i8 %141 to i16
%143 = add nuw nsw i16 %142, %139
%144 = lshr i16 %143, 1
%145 = trunc i16 %144 to i8
%146 = getelementptr inbounds i8, i8* %133, i64 %16
%147 = load i8, i8* %146
%148 = tail call i32 @qc_imag_writergb(i8* %134, i32 %6, i8 zeroext %137, i8 zeroext %145, i8 zeroext %147)
%149 = getelementptr inbounds i8, i8* %134, i64 %17
%150 = load i8, i8* %136
%151 = getelementptr inbounds i8, i8* %133, i64 2
%152 = load i8, i8* %151
%153 = zext i8 %152 to i16
%154 = load i8, i8* %140
%155 = zext i8 %154 to i16
%156 = add nuw nsw i16 %155, %153
%157 = lshr i16 %156, 1
%158 = trunc i16 %157 to i8
%159 = getelementptr inbounds i8, i8* %133, i64 %19
%160 = load i8, i8* %159
%161 = tail call i32 @qc_imag_writergb(i8* %149, i32 %6, i8 zeroext %150, i8 zeroext %158, i8 zeroext %160)
%162 = getelementptr inbounds i8, i8* %134, i64 %20
%163 = load i8, i8* %136
%164 = load i8, i8* %140
%165 = load i8, i8* %146
%166 = tail call i32 @qc_imag_writergb(i8* %162, i32 %6, i8 zeroext %163, i8 zeroext %164, i8 zeroext %165)
%167 = getelementptr inbounds i8, i8* %162, i64 %17
%168 = load i8, i8* %136
%169 = load i8, i8* %140
%170 = load i8, i8* %159
%171 = tail call i32 @qc_imag_writergb(i8* %167, i32 %6, i8 zeroext %168, i8 zeroext %169, i8 zeroext %170)
%172 = getelementptr inbounds i8, i8* %134, i64 %27
%173 = add nsw i32 %135, -1
%174 = icmp eq i32 %173, 0
br i1 %174, label %175, label %132
175: ; preds = %132
%176 = getelementptr inbounds i8, i8* %133, i64 3
%177 = load i8, i8* %176
%178 = load i8, i8* %151
%179 = zext i8 %178 to i16
%180 = getelementptr inbounds i8, i8* %151, i64 %15
%181 = load i8, i8* %180
%182 = zext i8 %181 to i16
%183 = add nuw nsw i16 %182, %179
%184 = lshr i16 %183, 1
%185 = trunc i16 %184 to i8
%186 = getelementptr inbounds i8, i8* %151, i64 %16
%187 = load i8, i8* %186
%188 = tail call i32 @qc_imag_writergb(i8* %172, i32 %6, i8 zeroext %177, i8 zeroext %185, i8 zeroext %187)
%189 = getelementptr inbounds i8, i8* %172, i64 %17
%190 = load i8, i8* %176
%191 = load i8, i8* %180
%192 = load i8, i8* %186
%193 = tail call i32 @qc_imag_writergb(i8* %189, i32 %6, i8 zeroext %190, i8 zeroext %191, i8 zeroext %192)
%194 = getelementptr inbounds i8, i8* %172, i64 %20
%195 = load i8, i8* %176
%196 = load i8, i8* %180
%197 = load i8, i8* %186
%198 = tail call i32 @qc_imag_writergb(i8* %194, i32 %6, i8 zeroext %195, i8 zeroext %196, i8 zeroext %197)
%199 = getelementptr inbounds i8, i8* %194, i64 %17
%200 = load i8, i8* %176
%201 = load i8, i8* %180
%202 = load i8, i8* %186
%203 = tail call i32 @qc_imag_writergb(i8* %199, i32 %6, i8 zeroext %200, i8 zeroext %201, i8 zeroext %202)
ret void
}