#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 */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint32_t;
typedef int int32_t;

/* Variables and functions */
int getBayerPixelCol(int /*<<< orphan*/ *, int, int, int, int, int);
int /*<<< orphan*/ setPixelBounds(int /*<<< orphan*/ *, int, int, int, int, int,
                                  int);
void deBayerBL(uint8_t *in, uint8_t *out, uint32_t img_w, uint32_t img_h) {
  int32_t x, y;
  for (y = 0; y < img_h / 2; ++y) {
    for (x = 0; x < img_w / 2; ++x) {
      setPixelBounds(out, x * 2, y * 2, img_w, img_h, 0,
                     (getBayerPixelCol(in, x, y, img_w, img_h, 0) +
                      getBayerPixelCol(in, x - 1, y, img_w, img_h, 0) +
                      getBayerPixelCol(in, x, y - 1, img_w, img_h, 0) +
                      getBayerPixelCol(in, x - 1, y - 1, img_w, img_h, 0)) /
                         4);
      setPixelBounds(out, x * 2, y * 2, img_w, img_h, 1,
                     (getBayerPixelCol(in, x, y, img_w, img_h, 2) +
                      getBayerPixelCol(in, x - 1, y, img_w, img_h, 2) +
                      getBayerPixelCol(in, x, y, img_w, img_h, 1) +
                      getBayerPixelCol(in, x, y - 1, img_w, img_h, 1)) /
                         4);
      setPixelBounds(out, x * 2, y * 2, img_w, img_h, 2,
                     getBayerPixelCol(in, x, y, img_w, img_h, 3));
      setPixelBounds(out, x * 2 + 1, y * 2, img_w, img_h, 0,
                     (getBayerPixelCol(in, x, y, img_w, img_h, 0) +
                      getBayerPixelCol(in, x, y - 1, img_w, img_h, 0)) /
                         2);
      setPixelBounds(out, x * 2 + 1, y * 2, img_w, img_h, 1,
                     getBayerPixelCol(in, x, y, img_w, img_h, 2));
      setPixelBounds(out, x * 2 + 1, y * 2, img_w, img_h, 2,
                     (getBayerPixelCol(in, x, y, img_w, img_h, 3) +
                      getBayerPixelCol(in, x + 1, y, img_w, img_h, 3)) /
                         2);
      setPixelBounds(out, x * 2, y * 2 + 1, img_w, img_h, 0,
                     (getBayerPixelCol(in, x, y, img_w, img_h, 0) +
                      getBayerPixelCol(in, x - 1, y, img_w, img_h, 0)) /
                         2);
      setPixelBounds(out, x * 2, y * 2 + 1, img_w, img_h, 1,
                     getBayerPixelCol(in, x, y, img_w, img_h, 1));
      setPixelBounds(out, x * 2, y * 2 + 1, img_w, img_h, 2,
                     (getBayerPixelCol(in, x, y, img_w, img_h, 3) +
                      getBayerPixelCol(in, x, y + 1, img_w, img_h, 3)) /
                         2);
      setPixelBounds(out, x * 2 + 1, y * 2 + 1, img_w, img_h, 0,
                     getBayerPixelCol(in, x, y, img_w, img_h, 0));
      setPixelBounds(out, x * 2 + 1, y * 2 + 1, img_w, img_h, 1,
                     (getBayerPixelCol(in, x, y, img_w, img_h, 2) +
                      getBayerPixelCol(in, x, y + 1, img_w, img_h, 2) +
                      getBayerPixelCol(in, x, y, img_w, img_h, 1) +
                      getBayerPixelCol(in, x + 1, y, img_w, img_h, 1)) /
                         4);
      setPixelBounds(out, x * 2 + 1, y * 2 + 1, img_w, img_h, 2,
                     (getBayerPixelCol(in, x, y, img_w, img_h, 3) +
                      getBayerPixelCol(in, x + 1, y, img_w, img_h, 3) +
                      getBayerPixelCol(in, x, y + 1, img_w, img_h, 3) +
                      getBayerPixelCol(in, x + 1, y + 1, img_w, img_h, 3)) /
                         4);
    }
  }
}


x86 assembly (clang, -O0):
<deBayerBL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cmp    %ecx,%eax
jge    1a69 <deBayerBL+0x949>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
cmp    %ecx,%eax
jge    1a56 <deBayerBL+0x936>
mov    -0x10(%rbp),%rax
mov    %rax,-0x1a0(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x194(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x184(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x190(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x18c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,-0x1a8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
sub    $0x1,%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%ecx
mov    -0x1a8(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x1a4(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
sub    $0x1,%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%ecx
mov    -0x1a4(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x188(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
sub    $0x1,%esi
mov    -0x20(%rbp),%edx
sub    $0x1,%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    -0x1a0(%rbp),%rdi
mov    -0x194(%rbp),%esi
mov    -0x190(%rbp),%ecx
mov    -0x18c(%rbp),%r8d
mov    %eax,%edx
mov    -0x188(%rbp),%eax
add    %edx,%eax
mov    $0x4,%r9d
cltd
idiv   %r9d
mov    -0x184(%rbp),%edx
xor    %r9d,%r9d
mov    %eax,(%rsp)
call   1040 <setPixelBounds@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x178(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x16c(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x15c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x168(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x164(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x2,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,-0x180(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
sub    $0x1,%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x2,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%ecx
mov    -0x180(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x17c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x1,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%ecx
mov    -0x17c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x160(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
sub    $0x1,%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x1,%r9d
call   1030 <getBayerPixelCol@plt>
mov    -0x178(%rbp),%rdi
mov    -0x16c(%rbp),%esi
mov    -0x168(%rbp),%ecx
mov    -0x164(%rbp),%r8d
mov    %eax,%edx
mov    -0x160(%rbp),%eax
add    %edx,%eax
mov    $0x4,%r9d
cltd
idiv   %r9d
mov    -0x15c(%rbp),%edx
mov    $0x1,%r9d
mov    %eax,(%rsp)
call   1040 <setPixelBounds@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x158(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x150(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x14c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x148(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x144(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x3,%r9d
call   1030 <getBayerPixelCol@plt>
mov    -0x158(%rbp),%rdi
mov    -0x150(%rbp),%esi
mov    -0x14c(%rbp),%edx
mov    -0x148(%rbp),%ecx
mov    -0x144(%rbp),%r8d
mov    $0x2,%r9d
mov    %eax,(%rsp)
call   1040 <setPixelBounds@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x140(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x124(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x130(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x12c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,-0x128(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
sub    $0x1,%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    -0x140(%rbp),%rdi
mov    -0x134(%rbp),%esi
mov    -0x130(%rbp),%ecx
mov    -0x12c(%rbp),%r8d
mov    %eax,%edx
mov    -0x128(%rbp),%eax
add    %edx,%eax
mov    $0x2,%r9d
cltd
idiv   %r9d
mov    -0x124(%rbp),%edx
xor    %r9d,%r9d
mov    %eax,(%rsp)
call   1040 <setPixelBounds@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x118(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x114(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x110(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x10c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x2,%r9d
call   1030 <getBayerPixelCol@plt>
mov    -0x120(%rbp),%rdi
mov    -0x118(%rbp),%esi
mov    -0x114(%rbp),%edx
mov    -0x110(%rbp),%ecx
mov    -0x10c(%rbp),%r8d
mov    $0x1,%r9d
mov    %eax,(%rsp)
call   1040 <setPixelBounds@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x108(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0xfc(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xec(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xf8(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0xf4(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x3,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,-0xf0(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x3,%r9d
call   1030 <getBayerPixelCol@plt>
mov    -0x108(%rbp),%rdi
mov    -0xfc(%rbp),%esi
mov    -0xf8(%rbp),%ecx
mov    -0xf4(%rbp),%r8d
mov    %eax,%edx
mov    -0xf0(%rbp),%eax
add    %edx,%eax
mov    $0x2,%r9d
cltd
idiv   %r9d
mov    -0xec(%rbp),%edx
mov    $0x2,%r9d
mov    %eax,(%rsp)
call   1040 <setPixelBounds@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0xe8(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xdc(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xd8(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0xd4(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,-0xd0(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
sub    $0x1,%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    -0xe8(%rbp),%rdi
mov    -0xdc(%rbp),%esi
mov    -0xd8(%rbp),%ecx
mov    -0xd4(%rbp),%r8d
mov    %eax,%edx
mov    -0xd0(%rbp),%eax
add    %edx,%eax
mov    $0x2,%r9d
cltd
idiv   %r9d
mov    -0xcc(%rbp),%edx
xor    %r9d,%r9d
mov    %eax,(%rsp)
call   1040 <setPixelBounds@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0xc8(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc0(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xb8(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0xb4(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x1,%r9d
call   1030 <getBayerPixelCol@plt>
mov    -0xc8(%rbp),%rdi
mov    -0xc0(%rbp),%esi
mov    -0xbc(%rbp),%edx
mov    -0xb8(%rbp),%ecx
mov    -0xb4(%rbp),%r8d
mov    $0x1,%r9d
mov    %eax,(%rsp)
call   1040 <setPixelBounds@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xa4(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xa0(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x3,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,-0x98(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
add    $0x1,%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x3,%r9d
call   1030 <getBayerPixelCol@plt>
mov    -0xb0(%rbp),%rdi
mov    -0xa4(%rbp),%esi
mov    -0xa0(%rbp),%ecx
mov    -0x9c(%rbp),%r8d
mov    %eax,%edx
mov    -0x98(%rbp),%eax
add    %edx,%eax
mov    $0x2,%r9d
cltd
idiv   %r9d
mov    -0x94(%rbp),%edx
mov    $0x2,%r9d
mov    %eax,(%rsp)
call   1040 <setPixelBounds@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    -0x90(%rbp),%rdi
mov    -0x88(%rbp),%esi
mov    -0x84(%rbp),%edx
mov    -0x80(%rbp),%ecx
mov    -0x7c(%rbp),%r8d
xor    %r9d,%r9d
mov    %eax,(%rsp)
call   1040 <setPixelBounds@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x2,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,-0x78(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
add    $0x1,%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x2,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%ecx
mov    -0x78(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x74(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x1,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%ecx
mov    -0x74(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x58(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x1,%r9d
call   1030 <getBayerPixelCol@plt>
mov    -0x70(%rbp),%rdi
mov    -0x64(%rbp),%esi
mov    -0x60(%rbp),%ecx
mov    -0x5c(%rbp),%r8d
mov    %eax,%edx
mov    -0x58(%rbp),%eax
add    %edx,%eax
mov    $0x4,%r9d
cltd
idiv   %r9d
mov    -0x54(%rbp),%edx
mov    $0x1,%r9d
mov    %eax,(%rsp)
call   1040 <setPixelBounds@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x3,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,-0x50(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x3,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
add    $0x1,%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x3,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
mov    -0x20(%rbp),%edx
add    $0x1,%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x3,%r9d
call   1030 <getBayerPixelCol@plt>
mov    -0x48(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x38(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    %eax,%edx
mov    -0x30(%rbp),%eax
add    %edx,%eax
mov    $0x4,%r9d
cltd
idiv   %r9d
mov    -0x2c(%rbp),%edx
mov    $0x2,%r9d
mov    %eax,(%rsp)
call   1040 <setPixelBounds@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1165 <deBayerBL+0x45>
jmp    1a5b <deBayerBL+0x93b>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1140 <deBayerBL+0x20>
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deBayerBL>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
cmp    $0x2,%ecx
jl     174c <deBayerBL+0x62c>
mov    %ecx,%r15d
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%r12
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
mov    %edx,%ecx
shr    $0x1f,%ecx
add    %edx,%ecx
sar    %ecx
xor    %edx,%edx
mov    %eax,0x50(%rsp)
mov    %ecx,0x54(%rsp)
mov    %rsi,0x30(%rsp)
mov    %rdi,0x20(%rsp)
mov    %r14d,0x14(%rsp)
jmp    117f <deBayerBL+0x5f>
add    $0x1,%edx
mov    %edx,%esi
mov    %esi,%edx
cmp    %eax,%esi
je     174c <deBayerBL+0x62c>
cmp    $0x1,%r14d
jle    1170 <deBayerBL+0x50>
lea    (%rdx,%rdx,1),%eax
mov    %eax,0x1c(%rsp)
lea    -0x1(%rdx),%eax
mov    %eax,0x40(%rsp)
lea    (%rdx,%rdx,1),%eax
add    $0x1,%eax
mov    %eax,0x18(%rsp)
lea    0x1(%rdx),%eax
mov    %eax,0x10(%rsp)
xor    %ebp,%ebp
mov    $0x1,%eax
mov    %rdx,0x28(%rsp)
mov    %rax,0x38(%rsp)
add    $0xffffffff,%eax
mov    %eax,0xc(%rsp)
mov    %r12,%rdi
mov    %ebp,%esi
mov    0x28(%rsp),%rbx
mov    %ebx,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%r13d
lea    -0x1(%rbp),%esi
mov    %esi,0x44(%rsp)
mov    %r12,%rdi
mov    %ebx,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%r12d
add    %r13d,%r12d
mov    0x20(%rsp),%rdi
mov    %ebp,%esi
mov    %rbp,%r13
mov    0x40(%rsp),%ebp
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%ebx
add    %r12d,%ebx
mov    0x20(%rsp),%rdi
mov    0x44(%rsp),%r12d
mov    %r12d,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %ebx,%ecx
add    %eax,%ecx
lea    0x3(%rax,%rbx,1),%eax
cmovns %ecx,%eax
sar    $0x2,%eax
mov    %eax,(%rsp)
mov    0x30(%rsp),%rdi
mov    0xc(%rsp),%esi
mov    0x1c(%rsp),%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1040 <setPixelBounds@plt>
mov    0x20(%rsp),%rdi
mov    %r13,%rbp
mov    %ebp,%esi
mov    0x28(%rsp),%r13
mov    %r13d,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x2,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,0x8(%rsp)
mov    0x20(%rsp),%rdi
mov    %r12d,%esi
mov    %r13d,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x2,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%ebx
add    0x8(%rsp),%ebx
mov    0x20(%rsp),%r12
mov    %r12,%rdi
mov    %ebp,%esi
mov    %r15d,%r14d
mov    %rbp,%r15
mov    %r13d,%edx
mov    0x14(%rsp),%ecx
mov    %r14d,%r8d
mov    $0x1,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    %r12,%rdi
mov    %r12,%r13
mov    %r15d,%esi
mov    0x40(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    %r14d,%r8d
mov    $0x1,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %ebp,%ecx
add    %eax,%ecx
lea    0x3(%rax,%rbp,1),%eax
cmovns %ecx,%eax
sar    $0x2,%eax
mov    %eax,(%rsp)
mov    0x30(%rsp),%r12
mov    %r12,%rdi
mov    0xc(%rsp),%esi
mov    0x1c(%rsp),%ebx
mov    %ebx,%edx
mov    0x14(%rsp),%ecx
mov    %r14d,%r8d
mov    $0x1,%r9d
call   1040 <setPixelBounds@plt>
mov    %r13,%rdi
mov    %r15,%r13
mov    %r14d,%r15d
mov    0x14(%rsp),%r14d
mov    %r13d,%esi
mov    0x28(%rsp),%rbp
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x3,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,(%rsp)
mov    %r12,%rdi
mov    0xc(%rsp),%esi
mov    %ebx,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x2,%r9d
call   1040 <setPixelBounds@plt>
mov    0x20(%rsp),%r12
mov    %r12,%rdi
mov    %r13d,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%ebx
mov    %r12,%rdi
mov    %r13d,%esi
mov    0x40(%rsp),%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
add    %ebx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
mov    %ecx,(%rsp)
mov    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    0x38(%rsp),%rsi
mov    0x1c(%rsp),%ebp
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1040 <setPixelBounds@plt>
mov    %r12,%rdi
mov    %r13d,%esi
mov    0x28(%rsp),%rdx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x2,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,(%rsp)
mov    %rbx,%rdi
mov    0x38(%rsp),%rsi
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x1,%r9d
call   1040 <setPixelBounds@plt>
mov    %r12,%rdi
mov    %r13d,%esi
mov    0x28(%rsp),%rbp
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x3,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%ebx
lea    0x1(%r13),%esi
mov    %r13,0x48(%rsp)
mov    %esi,0x8(%rsp)
mov    %r12,%rdi
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x3,%r9d
call   1030 <getBayerPixelCol@plt>
add    %ebx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
mov    %ecx,(%rsp)
mov    0x30(%rsp),%rbp
mov    %rbp,%rdi
mov    0x38(%rsp),%rsi
mov    0x1c(%rsp),%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x2,%r9d
call   1040 <setPixelBounds@plt>
mov    %r12,%rbx
mov    %r12,%rdi
mov    %r13d,%esi
mov    0x28(%rsp),%r13
mov    %r13d,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
mov    0x44(%rsp),%esi
mov    %r13d,%edx
mov    %r13,%rbx
mov    %r14d,%ecx
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
add    %r12d,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
mov    %ecx,(%rsp)
mov    %rbp,%rdi
mov    %rbp,%r12
mov    0xc(%rsp),%ebp
mov    %ebp,%esi
mov    0x18(%rsp),%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1040 <setPixelBounds@plt>
mov    0x20(%rsp),%rdi
mov    0x48(%rsp),%r13
mov    %r13d,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x1,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,(%rsp)
mov    %r12,%rdi
mov    %ebp,%esi
mov    0x18(%rsp),%ebp
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x1,%r9d
call   1040 <setPixelBounds@plt>
mov    0x20(%rsp),%r12
mov    %r12,%rdi
mov    %r13d,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x3,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%ebx
mov    %r12,%rdi
mov    %r13d,%esi
mov    0x10(%rsp),%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x3,%r9d
call   1030 <getBayerPixelCol@plt>
add    %ebx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
mov    %ecx,(%rsp)
mov    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    0xc(%rsp),%esi
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x2,%r9d
call   1040 <setPixelBounds@plt>
mov    %r12,%rdi
mov    %r13d,%esi
mov    0x28(%rsp),%r13
mov    %r13d,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,(%rsp)
mov    %rbx,%rdi
mov    0x38(%rsp),%rsi
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1040 <setPixelBounds@plt>
mov    %r12,%rdi
mov    0x48(%rsp),%rbx
mov    %ebx,%esi
mov    %r13d,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x2,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%r13d
mov    %r12,%rdi
mov    %ebx,%esi
mov    0x10(%rsp),%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x2,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%ebp
add    %r13d,%ebp
mov    %r12,%rdi
mov    %ebx,%esi
mov    0x28(%rsp),%r13
mov    %r13d,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x1,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%ebx
add    %ebp,%ebx
mov    %r12,%rdi
mov    0x8(%rsp),%esi
mov    %r13d,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x1,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %ebx,%ecx
add    %eax,%ecx
lea    0x3(%rax,%rbx,1),%eax
cmovns %ecx,%eax
sar    $0x2,%eax
mov    %eax,(%rsp)
mov    0x30(%rsp),%rdi
mov    0x38(%rsp),%rsi
mov    0x18(%rsp),%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x1,%r9d
call   1040 <setPixelBounds@plt>
mov    %r12,%rdi
mov    0x48(%rsp),%rbx
mov    %ebx,%esi
mov    %r13d,%edx
mov    %r13,%rbp
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x3,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%r13d
mov    %r12,%rdi
mov    0x8(%rsp),%esi
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x3,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%ebp
add    %r13d,%ebp
mov    %r12,%rdi
mov    %ebx,%esi
mov    0x10(%rsp),%r13d
mov    %r13d,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x3,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,%ebx
add    %ebp,%ebx
mov    %r12,%rdi
mov    0x8(%rsp),%ebp
mov    %ebp,%esi
mov    %r13d,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x3,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %ebx,%ecx
add    %eax,%ecx
lea    0x3(%rax,%rbx,1),%eax
cmovns %ecx,%eax
sar    $0x2,%eax
mov    %eax,(%rsp)
mov    0x30(%rsp),%rdi
mov    0x38(%rsp),%rsi
mov    0x18(%rsp),%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x2,%r9d
call   1040 <setPixelBounds@plt>
mov    0x38(%rsp),%rax
mov    0x54(%rsp),%ecx
add    $0x2,%eax
mov    %ebp,%edx
cmp    %ecx,%ebp
jne    11b0 <deBayerBL+0x90>
mov    0x50(%rsp),%eax
mov    0x10(%rsp),%esi
jmp    1175 <deBayerBL+0x55>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @deBayerBL(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = sdiv i32 %3, 2
%6 = icmp sgt i32 %3, 1
br i1 %6, label %7, label %93
7: ; preds = %4
%8 = sdiv i32 %2, 2
%9 = icmp sgt i32 %2, 1
br label %10
10: ; preds = %7, %90
%11 = phi i32 [ 0, %7 ], [ %91, %90 ]
br i1 %9, label %14, label %12
12: ; preds = %10
%13 = add nuw nsw i32 %11, 1
br label %90
14: ; preds = %10
%15 = shl nuw nsw i32 %11, 1
%16 = add nsw i32 %11, -1
%17 = or i32 %15, 1
%18 = add nuw nsw i32 %11, 1
br label %19
19: ; preds = %14, %19
%20 = phi i32 [ 0, %14 ], [ %52, %19 ]
%21 = shl nuw nsw i32 %20, 1
%22 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 0)
%23 = add nsw i32 %20, -1
%24 = tail call i32 @getBayerPixelCol(i32* %0, i32 %23, i32 %11, i32 %2, i32 %3, i32 0)
%25 = add nsw i32 %24, %22
%26 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %16, i32 %2, i32 %3, i32 0)
%27 = add nsw i32 %25, %26
%28 = tail call i32 @getBayerPixelCol(i32* %0, i32 %23, i32 %16, i32 %2, i32 %3, i32 0)
%29 = add nsw i32 %27, %28
%30 = sdiv i32 %29, 4
%31 = tail call i32 @setPixelBounds(i32* %1, i32 %21, i32 %15, i32 %2, i32 %3, i32 0, i32 %30)
%32 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 2)
%33 = tail call i32 @getBayerPixelCol(i32* %0, i32 %23, i32 %11, i32 %2, i32 %3, i32 2)
%34 = add nsw i32 %33, %32
%35 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 1)
%36 = add nsw i32 %34, %35
%37 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %16, i32 %2, i32 %3, i32 1)
%38 = add nsw i32 %36, %37
%39 = sdiv i32 %38, 4
%40 = tail call i32 @setPixelBounds(i32* %1, i32 %21, i32 %15, i32 %2, i32 %3, i32 1, i32 %39)
%41 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 3)
%42 = tail call i32 @setPixelBounds(i32* %1, i32 %21, i32 %15, i32 %2, i32 %3, i32 2, i32 %41)
%43 = or i32 %21, 1
%44 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 0)
%45 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %16, i32 %2, i32 %3, i32 0)
%46 = add nsw i32 %45, %44
%47 = sdiv i32 %46, 2
%48 = tail call i32 @setPixelBounds(i32* %1, i32 %43, i32 %15, i32 %2, i32 %3, i32 0, i32 %47)
%49 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 2)
%50 = tail call i32 @setPixelBounds(i32* %1, i32 %43, i32 %15, i32 %2, i32 %3, i32 1, i32 %49)
%51 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 3)
%52 = add nuw nsw i32 %20, 1
%53 = tail call i32 @getBayerPixelCol(i32* %0, i32 %52, i32 %11, i32 %2, i32 %3, i32 3)
%54 = add nsw i32 %53, %51
%55 = sdiv i32 %54, 2
%56 = tail call i32 @setPixelBounds(i32* %1, i32 %43, i32 %15, i32 %2, i32 %3, i32 2, i32 %55)
%57 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 0)
%58 = tail call i32 @getBayerPixelCol(i32* %0, i32 %23, i32 %11, i32 %2, i32 %3, i32 0)
%59 = add nsw i32 %58, %57
%60 = sdiv i32 %59, 2
%61 = tail call i32 @setPixelBounds(i32* %1, i32 %21, i32 %17, i32 %2, i32 %3, i32 0, i32 %60)
%62 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 1)
%63 = tail call i32 @setPixelBounds(i32* %1, i32 %21, i32 %17, i32 %2, i32 %3, i32 1, i32 %62)
%64 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 3)
%65 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %18, i32 %2, i32 %3, i32 3)
%66 = add nsw i32 %65, %64
%67 = sdiv i32 %66, 2
%68 = tail call i32 @setPixelBounds(i32* %1, i32 %21, i32 %17, i32 %2, i32 %3, i32 2, i32 %67)
%69 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 0)
%70 = tail call i32 @setPixelBounds(i32* %1, i32 %43, i32 %17, i32 %2, i32 %3, i32 0, i32 %69)
%71 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 2)
%72 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %18, i32 %2, i32 %3, i32 2)
%73 = add nsw i32 %72, %71
%74 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 1)
%75 = add nsw i32 %73, %74
%76 = tail call i32 @getBayerPixelCol(i32* %0, i32 %52, i32 %11, i32 %2, i32 %3, i32 1)
%77 = add nsw i32 %75, %76
%78 = sdiv i32 %77, 4
%79 = tail call i32 @setPixelBounds(i32* %1, i32 %43, i32 %17, i32 %2, i32 %3, i32 1, i32 %78)
%80 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 3)
%81 = tail call i32 @getBayerPixelCol(i32* %0, i32 %52, i32 %11, i32 %2, i32 %3, i32 3)
%82 = add nsw i32 %81, %80
%83 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %18, i32 %2, i32 %3, i32 3)
%84 = add nsw i32 %82, %83
%85 = tail call i32 @getBayerPixelCol(i32* %0, i32 %52, i32 %18, i32 %2, i32 %3, i32 3)
%86 = add nsw i32 %84, %85
%87 = sdiv i32 %86, 4
%88 = tail call i32 @setPixelBounds(i32* %1, i32 %43, i32 %17, i32 %2, i32 %3, i32 2, i32 %87)
%89 = icmp eq i32 %52, %8
br i1 %89, label %90, label %19
90: ; preds = %19, %12
%91 = phi i32 [ %13, %12 ], [ %18, %19 ]
%92 = icmp eq i32 %91, %5
br i1 %92, label %93, label %10
93: ; preds = %90, %4
ret void
}