#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;

/* Variables and functions */
int abs(int);
int getBayerPixelCol(int /*<<< orphan*/ *, int, int, int, int, int);
int /*<<< orphan*/ setPixelBounds(int /*<<< orphan*/ *, int, int, int, int, int,
                                  int);
void Adaptive_Color_Plane_Interpolation(uint8_t *in, uint8_t *out,
                                        uint32_t img_w, uint32_t img_h) {
  uint32_t x, y;
  for (y = 0; y < img_h / 2; ++y) {
    for (x = 0; x < img_w / 2; ++x) {
      int a = abs(-getBayerPixelCol(in, x - 1, y, img_w, img_h, 0) +
                  (2 * getBayerPixelCol(in, x, y, img_w, img_h, 0)) -
                  getBayerPixelCol(in, x + 1, y, img_w, img_h, 0)) +
              abs(getBayerPixelCol(in, x, y, img_w, img_h, 1) -
                  getBayerPixelCol(in, x + 1, y, img_w, img_h, 1));
      int B = abs(-getBayerPixelCol(in, x - 1, y - 1, img_w, img_h, 0) +
                  (2 * getBayerPixelCol(in, x, y, img_w, img_h, 0)) -
                  getBayerPixelCol(in, x + 1, y + 1, img_w, img_h, 0)) +
              abs(getBayerPixelCol(in, x, y - 1, img_w, img_h, 2) -
                  getBayerPixelCol(in, x, y, img_w, img_h, 2));
      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, 1,
                     getBayerPixelCol(in, x, y, img_w, img_h, 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 + 1, y * 2 + 1, img_w, img_h, 0,
                     getBayerPixelCol(in, x, y, img_w, img_h, 0));
    }
  }
}


x86 assembly (clang, -O0):
<Adaptive_Color_Plane_Interpolation>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%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,-0x2c(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
cmp    %ecx,%eax
jge    1512 <Adaptive_Color_Plane_Interpolation+0x3e2>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
cmp    %ecx,%eax
jge    14ff <Adaptive_Color_Plane_Interpolation+0x3cf>
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   1040 <getBayerPixelCol@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0xb0(%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   1040 <getBayerPixelCol@plt>
mov    %eax,%ecx
mov    -0xb0(%rbp),%eax
shl    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0xac(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
xor    %r9d,%r9d
call   1040 <getBayerPixelCol@plt>
mov    -0xac(%rbp),%edi
sub    %eax,%edi
call   1030 <abs@plt>
mov    %eax,-0xa4(%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   1040 <getBayerPixelCol@plt>
mov    %eax,-0xa8(%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   1040 <getBayerPixelCol@plt>
mov    -0xa8(%rbp),%edi
sub    %eax,%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    -0xa4(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x24(%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   1040 <getBayerPixelCol@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0xa0(%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   1040 <getBayerPixelCol@plt>
mov    %eax,%ecx
mov    -0xa0(%rbp),%eax
shl    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0x9c(%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
xor    %r9d,%r9d
call   1040 <getBayerPixelCol@plt>
mov    -0x9c(%rbp),%edi
sub    %eax,%edi
call   1030 <abs@plt>
mov    %eax,-0x94(%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    $0x2,%r9d
call   1040 <getBayerPixelCol@plt>
mov    %eax,-0x98(%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   1040 <getBayerPixelCol@plt>
mov    -0x98(%rbp),%edi
sub    %eax,%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    -0x94(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x88(%rbp)
mov    -0x20(%rbp),%eax
shl    $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
mov    $0x3,%r9d
call   1040 <getBayerPixelCol@plt>
mov    -0x90(%rbp),%rdi
mov    -0x88(%rbp),%esi
mov    -0x84(%rbp),%edx
mov    -0x80(%rbp),%ecx
mov    -0x7c(%rbp),%r8d
mov    $0x2,%r9d
mov    %eax,(%rsp)
call   1050 <setPixelBounds@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x6c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x64(%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   1040 <getBayerPixelCol@plt>
mov    -0x78(%rbp),%rdi
mov    -0x70(%rbp),%esi
mov    -0x6c(%rbp),%edx
mov    -0x68(%rbp),%ecx
mov    -0x64(%rbp),%r8d
mov    $0x1,%r9d
mov    %eax,(%rsp)
call   1050 <setPixelBounds@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x58(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x4c(%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   1040 <getBayerPixelCol@plt>
mov    -0x60(%rbp),%rdi
mov    -0x58(%rbp),%esi
mov    -0x54(%rbp),%edx
mov    -0x50(%rbp),%ecx
mov    -0x4c(%rbp),%r8d
mov    $0x1,%r9d
mov    %eax,(%rsp)
call   1050 <setPixelBounds@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x3c(%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
xor    %r9d,%r9d
call   1040 <getBayerPixelCol@plt>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    -0x38(%rbp),%ecx
mov    -0x34(%rbp),%r8d
xor    %r9d,%r9d
mov    %eax,(%rsp)
call   1050 <setPixelBounds@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1175 <Adaptive_Color_Plane_Interpolation+0x45>
jmp    1504 <Adaptive_Color_Plane_Interpolation+0x3d4>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1150 <Adaptive_Color_Plane_Interpolation+0x20>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Adaptive_Color_Plane_Interpolation>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
cmp    $0x2,%ecx
jl     13d2 <Adaptive_Color_Plane_Interpolation+0x2b2>
mov    %ecx,%r12d
mov    %edx,%ebp
mov    %rdi,%r15
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
mov    %edx,%ecx
shr    $0x1f,%ecx
add    %edx,%ecx
sar    %ecx
xor    %edi,%edi
mov    %eax,0x28(%rsp)
mov    %ecx,0x2c(%rsp)
mov    %rsi,0x20(%rsp)
mov    %r15,0x38(%rsp)
mov    0x38(%rsp),%r13
jmp    117f <Adaptive_Color_Plane_Interpolation+0x5f>
nopl   0x0(%rax)
add    $0x1,%edi
mov    %edi,%edx
mov    %edx,%edi
cmp    %eax,%edx
je     13d2 <Adaptive_Color_Plane_Interpolation+0x2b2>
cmp    $0x1,%ebp
jle    1170 <Adaptive_Color_Plane_Interpolation+0x50>
lea    -0x1(%rdi),%eax
mov    %eax,0x34(%rsp)
lea    0x1(%rdi),%eax
mov    %eax,0xc(%rsp)
lea    (%rdi,%rdi,1),%eax
mov    %eax,0x30(%rsp)
lea    (%rdi,%rdi,1),%eax
add    $0x1,%eax
mov    %eax,0x10(%rsp)
xor    %r14d,%r14d
mov    $0x1,%eax
mov    %rax,0x18(%rsp)
mov    %rdi,0x40(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
lea    -0x1(%r14),%esi
mov    %esi,0x8(%rsp)
mov    %r13,%rdi
mov    0x40(%rsp),%r15
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %r12d,%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %r13,%rdi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %r12d,%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
lea    0x1(%r14),%ebx
mov    %r13,%rdi
mov    %ebx,%esi
mov    %ebx,0x14(%rsp)
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %r12d,%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %r13,%rdi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %r12d,%r8d
mov    $0x1,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %r13,%rdi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %r12d,%r8d
mov    $0x1,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %r13,%rdi
mov    0x8(%rsp),%esi
mov    0x34(%rsp),%ebx
mov    %ebx,%edx
mov    %ebp,%ecx
mov    %r12d,%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %r13,%rdi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %r12d,%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %r13,%rdi
mov    0x14(%rsp),%esi
mov    0xc(%rsp),%edx
mov    %ebp,%ecx
mov    %r12d,%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %r13,%rdi
mov    %r14d,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
mov    %r12d,%r8d
mov    $0x2,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %r13,%rdi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %r12d,%r8d
mov    $0x2,%r9d
call   1030 <getBayerPixelCol@plt>
mov    0x18(%rsp),%rax
lea    -0x1(%rax),%ebx
mov    %ebx,0x8(%rsp)
mov    %r13,%rdi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %r12d,%r8d
mov    $0x3,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,(%rsp)
mov    0x20(%rsp),%rdi
mov    %ebx,%esi
mov    0x30(%rsp),%ebx
mov    %ebx,%edx
mov    %ebp,%ecx
mov    %r12d,%r8d
mov    $0x2,%r9d
call   1040 <setPixelBounds@plt>
mov    %r13,%rdi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %r12d,%r8d
mov    $0x2,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,(%rsp)
mov    0x20(%rsp),%rdi
mov    0x18(%rsp),%rsi
mov    %ebx,%edx
mov    %ebp,%ecx
mov    %r12d,%r8d
mov    $0x1,%r9d
call   1040 <setPixelBounds@plt>
mov    %r13,%rdi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %r12d,%r8d
mov    $0x1,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,(%rsp)
mov    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    0x8(%rsp),%esi
mov    0x10(%rsp),%edx
mov    %ebp,%ecx
mov    %r12d,%r8d
mov    $0x1,%r9d
call   1040 <setPixelBounds@plt>
mov    %r13,%rdi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %r12d,%r8d
xor    %r9d,%r9d
call   1030 <getBayerPixelCol@plt>
mov    %eax,(%rsp)
mov    %rbx,%rdi
mov    0x18(%rsp),%rbx
mov    %ebx,%esi
mov    0x10(%rsp),%edx
mov    %ebp,%ecx
mov    %r12d,%r8d
xor    %r9d,%r9d
call   1040 <setPixelBounds@plt>
mov    0x2c(%rsp),%ecx
add    $0x2,%ebx
mov    %rbx,0x18(%rsp)
mov    0x14(%rsp),%eax
mov    %eax,%r14d
cmp    %eax,%ecx
jne    11c0 <Adaptive_Color_Plane_Interpolation+0xa0>
mov    0x28(%rsp),%eax
mov    0xc(%rsp),%edx
jmp    1175 <Adaptive_Color_Plane_Interpolation+0x55>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @Adaptive_Color_Plane_Interpolation(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
%11 = alloca i32
%12 = 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 %13
13: ; preds = %173, %4
%14 = load i32, i32* %10
%15 = load i32, i32* %8
%16 = sdiv i32 %15, 2
%17 = icmp slt i32 %14, %16
br i1 %17, label %18, label %176
18: ; preds = %13
store i32 0, i32* %9
br label %19
19: ; preds = %169, %18
%20 = load i32, i32* %9
%21 = load i32, i32* %7
%22 = sdiv i32 %21, 2
%23 = icmp slt i32 %20, %22
br i1 %23, label %24, label %172
24: ; preds = %19
%25 = load i32*, i32** %5
%26 = load i32, i32* %9
%27 = sub nsw i32 %26, 1
%28 = load i32, i32* %10
%29 = load i32, i32* %7
%30 = load i32, i32* %8
%31 = call i32 @getBayerPixelCol(i32* %25, i32 %27, i32 %28, i32 %29, i32 %30, i32 0)
%32 = sub nsw i32 0, %31
%33 = load i32*, i32** %5
%34 = load i32, i32* %9
%35 = load i32, i32* %10
%36 = load i32, i32* %7
%37 = load i32, i32* %8
%38 = call i32 @getBayerPixelCol(i32* %33, i32 %34, i32 %35, i32 %36, i32 %37, i32 0)
%39 = mul nsw i32 2, %38
%40 = add nsw i32 %32, %39
%41 = load i32*, i32** %5
%42 = load i32, i32* %9
%43 = add nsw i32 %42, 1
%44 = load i32, i32* %10
%45 = load i32, i32* %7
%46 = load i32, i32* %8
%47 = call i32 @getBayerPixelCol(i32* %41, i32 %43, i32 %44, i32 %45, i32 %46, i32 0)
%48 = sub nsw i32 %40, %47
%49 = call i32 @abs(i32 %48)
%50 = load i32*, i32** %5
%51 = load i32, i32* %9
%52 = load i32, i32* %10
%53 = load i32, i32* %7
%54 = load i32, i32* %8
%55 = call i32 @getBayerPixelCol(i32* %50, i32 %51, i32 %52, i32 %53, i32 %54, i32 1)
%56 = load i32*, i32** %5
%57 = load i32, i32* %9
%58 = add nsw i32 %57, 1
%59 = load i32, i32* %10
%60 = load i32, i32* %7
%61 = load i32, i32* %8
%62 = call i32 @getBayerPixelCol(i32* %56, i32 %58, i32 %59, i32 %60, i32 %61, i32 1)
%63 = sub nsw i32 %55, %62
%64 = call i32 @abs(i32 %63)
%65 = add nsw i32 %49, %64
store i32 %65, i32* %11
%66 = load i32*, i32** %5
%67 = load i32, i32* %9
%68 = sub nsw i32 %67, 1
%69 = load i32, i32* %10
%70 = sub nsw i32 %69, 1
%71 = load i32, i32* %7
%72 = load i32, i32* %8
%73 = call i32 @getBayerPixelCol(i32* %66, i32 %68, i32 %70, i32 %71, i32 %72, i32 0)
%74 = sub nsw i32 0, %73
%75 = load i32*, i32** %5
%76 = load i32, i32* %9
%77 = load i32, i32* %10
%78 = load i32, i32* %7
%79 = load i32, i32* %8
%80 = call i32 @getBayerPixelCol(i32* %75, i32 %76, i32 %77, i32 %78, i32 %79, i32 0)
%81 = mul nsw i32 2, %80
%82 = add nsw i32 %74, %81
%83 = load i32*, i32** %5
%84 = load i32, i32* %9
%85 = add nsw i32 %84, 1
%86 = load i32, i32* %10
%87 = add nsw i32 %86, 1
%88 = load i32, i32* %7
%89 = load i32, i32* %8
%90 = call i32 @getBayerPixelCol(i32* %83, i32 %85, i32 %87, i32 %88, i32 %89, i32 0)
%91 = sub nsw i32 %82, %90
%92 = call i32 @abs(i32 %91)
%93 = load i32*, i32** %5
%94 = load i32, i32* %9
%95 = load i32, i32* %10
%96 = sub nsw i32 %95, 1
%97 = load i32, i32* %7
%98 = load i32, i32* %8
%99 = call i32 @getBayerPixelCol(i32* %93, i32 %94, i32 %96, i32 %97, i32 %98, i32 2)
%100 = load i32*, i32** %5
%101 = load i32, i32* %9
%102 = load i32, i32* %10
%103 = load i32, i32* %7
%104 = load i32, i32* %8
%105 = call i32 @getBayerPixelCol(i32* %100, i32 %101, i32 %102, i32 %103, i32 %104, i32 2)
%106 = sub nsw i32 %99, %105
%107 = call i32 @abs(i32 %106)
%108 = add nsw i32 %92, %107
store i32 %108, i32* %12
%109 = load i32*, i32** %6
%110 = load i32, i32* %9
%111 = mul nsw i32 %110, 2
%112 = load i32, i32* %10
%113 = mul nsw i32 %112, 2
%114 = load i32, i32* %7
%115 = load i32, i32* %8
%116 = load i32*, i32** %5
%117 = load i32, i32* %9
%118 = load i32, i32* %10
%119 = load i32, i32* %7
%120 = load i32, i32* %8
%121 = call i32 @getBayerPixelCol(i32* %116, i32 %117, i32 %118, i32 %119, i32 %120, i32 3)
%122 = call i32 @setPixelBounds(i32* %109, i32 %111, i32 %113, i32 %114, i32 %115, i32 2, i32 %121)
%123 = load i32*, i32** %6
%124 = load i32, i32* %9
%125 = mul nsw i32 %124, 2
%126 = add nsw i32 %125, 1
%127 = load i32, i32* %10
%128 = mul nsw i32 %127, 2
%129 = load i32, i32* %7
%130 = load i32, i32* %8
%131 = load i32*, i32** %5
%132 = load i32, i32* %9
%133 = load i32, i32* %10
%134 = load i32, i32* %7
%135 = load i32, i32* %8
%136 = call i32 @getBayerPixelCol(i32* %131, i32 %132, i32 %133, i32 %134, i32 %135, i32 2)
%137 = call i32 @setPixelBounds(i32* %123, i32 %126, i32 %128, i32 %129, i32 %130, i32 1, i32 %136)
%138 = load i32*, i32** %6
%139 = load i32, i32* %9
%140 = mul nsw i32 %139, 2
%141 = load i32, i32* %10
%142 = mul nsw i32 %141, 2
%143 = add nsw i32 %142, 1
%144 = load i32, i32* %7
%145 = load i32, i32* %8
%146 = load i32*, i32** %5
%147 = load i32, i32* %9
%148 = load i32, i32* %10
%149 = load i32, i32* %7
%150 = load i32, i32* %8
%151 = call i32 @getBayerPixelCol(i32* %146, i32 %147, i32 %148, i32 %149, i32 %150, i32 1)
%152 = call i32 @setPixelBounds(i32* %138, i32 %140, i32 %143, i32 %144, i32 %145, i32 1, i32 %151)
%153 = load i32*, i32** %6
%154 = load i32, i32* %9
%155 = mul nsw i32 %154, 2
%156 = add nsw i32 %155, 1
%157 = load i32, i32* %10
%158 = mul nsw i32 %157, 2
%159 = add nsw i32 %158, 1
%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 0)
%168 = call i32 @setPixelBounds(i32* %153, i32 %156, i32 %159, i32 %160, i32 %161, i32 0, i32 %167)
br label %169
169: ; preds = %24
%170 = load i32, i32* %9
%171 = add nsw i32 %170, 1
store i32 %171, i32* %9
br label %19
172: ; preds = %19
br label %173
173: ; preds = %172
%174 = load i32, i32* %10
%175 = add nsw i32 %174, 1
store i32 %175, i32* %10
br label %13
176: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @Adaptive_Color_Plane_Interpolation(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 %47
7: ; preds = %4
%8 = sdiv i32 %2, 2
%9 = icmp sgt i32 %2, 1
br label %10
10: ; preds = %7, %44
%11 = phi i32 [ 0, %7 ], [ %45, %44 ]
br i1 %9, label %14, label %12
12: ; preds = %10
%13 = add nuw nsw i32 %11, 1
br label %44
14: ; preds = %10
%15 = add nsw i32 %11, -1
%16 = add nuw nsw i32 %11, 1
%17 = shl nuw nsw i32 %11, 1
%18 = or i32 %17, 1
br label %19
19: ; preds = %14, %19
%20 = phi i32 [ 0, %14 ], [ %24, %19 ]
%21 = add nsw i32 %20, -1
%22 = tail call i32 @getBayerPixelCol(i32* %0, i32 %21, i32 %11, i32 %2, i32 %3, i32 0)
%23 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 0)
%24 = add nuw nsw i32 %20, 1
%25 = tail call i32 @getBayerPixelCol(i32* %0, i32 %24, i32 %11, i32 %2, i32 %3, i32 0)
%26 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 1)
%27 = tail call i32 @getBayerPixelCol(i32* %0, i32 %24, i32 %11, i32 %2, i32 %3, i32 1)
%28 = tail call i32 @getBayerPixelCol(i32* %0, i32 %21, i32 %15, i32 %2, i32 %3, i32 0)
%29 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 0)
%30 = tail call i32 @getBayerPixelCol(i32* %0, i32 %24, i32 %16, i32 %2, i32 %3, i32 0)
%31 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %15, i32 %2, i32 %3, i32 2)
%32 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 2)
%33 = shl nuw nsw i32 %20, 1
%34 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 3)
%35 = tail call i32 @setPixelBounds(i32* %1, i32 %33, i32 %17, i32 %2, i32 %3, i32 2, i32 %34)
%36 = or i32 %33, 1
%37 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 2)
%38 = tail call i32 @setPixelBounds(i32* %1, i32 %36, i32 %17, i32 %2, i32 %3, i32 1, i32 %37)
%39 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 1)
%40 = tail call i32 @setPixelBounds(i32* %1, i32 %33, i32 %18, i32 %2, i32 %3, i32 1, i32 %39)
%41 = tail call i32 @getBayerPixelCol(i32* %0, i32 %20, i32 %11, i32 %2, i32 %3, i32 0)
%42 = tail call i32 @setPixelBounds(i32* %1, i32 %36, i32 %18, i32 %2, i32 %3, i32 0, i32 %41)
%43 = icmp eq i32 %24, %8
br i1 %43, label %44, label %19
44: ; preds = %19, %12
%45 = phi i32 [ %13, %12 ], [ %16, %19 ]
%46 = icmp eq i32 %45, %5
br i1 %46, label %47, label %10
47: ; preds = %44, %4
ret void
}