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

/* Variables and functions */
int pixel_convert_8u_yuv422_to_8u_bgra(uint8_t *dest, int dstride, int dwidth,
                                       int dheight, const uint8_t *src,
                                       int sstride) {
  int i, j;
  for (i = 0; i < dheight; i++) {
    uint8_t *drow = dest + i * dstride;
    const uint8_t *srow = src + i * sstride;
    for (j = 0; j < dwidth / 2; j++) {
      uint8_t y1 = srow[4 * j + 0];
      uint8_t u = srow[4 * j + 1];
      uint8_t y2 = srow[4 * j + 2];
      uint8_t v = srow[4 * j + 3];
      int cb = ((u - 128) * 454) >> 8;
      int cr = ((v - 128) * 359) >> 8;
      int cg = ((v - 128) * 183 + (u - 128) * 88) >> 8;
      int r, g, b;
      r = y1 + cr;
      b = y1 + cb;
      g = y1 - cg;
      drow[8 * j + 0] =
          ((0) > (((255) < (b) ? (255) : (b))) ? (0)
                                               : (((255) < (b) ? (255) : (b))));
      drow[8 * j + 1] =
          ((0) > (((255) < (g) ? (255) : (g))) ? (0)
                                               : (((255) < (g) ? (255) : (g))));
      drow[8 * j + 2] =
          ((0) > (((255) < (r) ? (255) : (r))) ? (0)
                                               : (((255) < (r) ? (255) : (r))));
      drow[8 * j + 3] = 0;
      r = y2 + cr;
      b = y2 + cb;
      g = y2 - cg;
      drow[8 * j + 4] =
          ((0) > (((255) < (b) ? (255) : (b))) ? (0)
                                               : (((255) < (b) ? (255) : (b))));
      drow[8 * j + 5] =
          ((0) > (((255) < (g) ? (255) : (g))) ? (0)
                                               : (((255) < (g) ? (255) : (g))));
      drow[8 * j + 6] =
          ((0) > (((255) < (r) ? (255) : (r))) ? (0)
                                               : (((255) < (r) ? (255) : (r))));
      drow[8 * j + 7] = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<pixel_convert_8u_yuv422_to_8u_bgra>:
push   %rbp
mov    %rsp,%rbp
sub    $0x38,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    15e1 <pixel_convert_8u_yuv422_to_8u_bgra+0x4e1>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%ecx
imul   -0xc(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
imul   -0x24(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x6c(%rbp),%eax
cmp    %ecx,%eax
jge    15ce <pixel_convert_8u_yuv422_to_8u_bgra+0x4ce>
mov    -0x40(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x2,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x48(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x50(%rbp)
mov    -0x48(%rbp),%eax
sub    $0x80,%eax
imul   $0x1c6,%eax,%eax
sar    $0x8,%eax
mov    %eax,-0x54(%rbp)
mov    -0x50(%rbp),%eax
sub    $0x80,%eax
imul   $0x167,%eax,%eax
sar    $0x8,%eax
mov    %eax,-0x58(%rbp)
mov    -0x50(%rbp),%eax
sub    $0x80,%eax
imul   $0xb7,%eax,%eax
mov    -0x48(%rbp),%ecx
sub    $0x80,%ecx
imul   $0x58,%ecx,%ecx
add    %ecx,%eax
sar    $0x8,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x44(%rbp),%eax
add    -0x58(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x44(%rbp),%eax
add    -0x54(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x44(%rbp),%eax
sub    -0x5c(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    $0xff,%eax
cmp    -0x68(%rbp),%eax
jge    125f <pixel_convert_8u_yuv422_to_8u_bgra+0x15f>
mov    $0xff,%eax
mov    %eax,-0x70(%rbp)
jmp    1265 <pixel_convert_8u_yuv422_to_8u_bgra+0x165>
mov    -0x68(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x70(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    127c <pixel_convert_8u_yuv422_to_8u_bgra+0x17c>
xor    %eax,%eax
mov    %eax,-0x74(%rbp)
jmp    12a3 <pixel_convert_8u_yuv422_to_8u_bgra+0x1a3>
mov    $0xff,%eax
cmp    -0x68(%rbp),%eax
jge    1297 <pixel_convert_8u_yuv422_to_8u_bgra+0x197>
mov    $0xff,%eax
mov    %eax,-0x78(%rbp)
jmp    129d <pixel_convert_8u_yuv422_to_8u_bgra+0x19d>
mov    -0x68(%rbp),%eax
mov    %eax,-0x78(%rbp)
mov    -0x78(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%edx
mov    -0x38(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x3,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    $0xff,%eax
cmp    -0x64(%rbp),%eax
jge    12d4 <pixel_convert_8u_yuv422_to_8u_bgra+0x1d4>
mov    $0xff,%eax
mov    %eax,-0x7c(%rbp)
jmp    12da <pixel_convert_8u_yuv422_to_8u_bgra+0x1da>
mov    -0x64(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x7c(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    12f1 <pixel_convert_8u_yuv422_to_8u_bgra+0x1f1>
xor    %eax,%eax
mov    %eax,-0x80(%rbp)
jmp    1321 <pixel_convert_8u_yuv422_to_8u_bgra+0x221>
mov    $0xff,%eax
cmp    -0x64(%rbp),%eax
jge    130f <pixel_convert_8u_yuv422_to_8u_bgra+0x20f>
mov    $0xff,%eax
mov    %eax,-0x84(%rbp)
jmp    1318 <pixel_convert_8u_yuv422_to_8u_bgra+0x218>
mov    -0x64(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    -0x80(%rbp),%edx
mov    -0x38(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x3,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    $0xff,%eax
cmp    -0x60(%rbp),%eax
jge    1355 <pixel_convert_8u_yuv422_to_8u_bgra+0x255>
mov    $0xff,%eax
mov    %eax,-0x88(%rbp)
jmp    135e <pixel_convert_8u_yuv422_to_8u_bgra+0x25e>
mov    -0x60(%rbp),%eax
mov    %eax,-0x88(%rbp)
mov    -0x88(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    137b <pixel_convert_8u_yuv422_to_8u_bgra+0x27b>
xor    %eax,%eax
mov    %eax,-0x8c(%rbp)
jmp    13ae <pixel_convert_8u_yuv422_to_8u_bgra+0x2ae>
mov    $0xff,%eax
cmp    -0x60(%rbp),%eax
jge    1399 <pixel_convert_8u_yuv422_to_8u_bgra+0x299>
mov    $0xff,%eax
mov    %eax,-0x90(%rbp)
jmp    13a2 <pixel_convert_8u_yuv422_to_8u_bgra+0x2a2>
mov    -0x60(%rbp),%eax
mov    %eax,-0x90(%rbp)
mov    -0x90(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x8c(%rbp),%edx
mov    -0x38(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x3,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x38(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x3,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x4c(%rbp),%eax
add    -0x58(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x4c(%rbp),%eax
add    -0x54(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x4c(%rbp),%eax
sub    -0x5c(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    $0xff,%eax
cmp    -0x68(%rbp),%eax
jge    1417 <pixel_convert_8u_yuv422_to_8u_bgra+0x317>
mov    $0xff,%eax
mov    %eax,-0x94(%rbp)
jmp    1420 <pixel_convert_8u_yuv422_to_8u_bgra+0x320>
mov    -0x68(%rbp),%eax
mov    %eax,-0x94(%rbp)
mov    -0x94(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    143d <pixel_convert_8u_yuv422_to_8u_bgra+0x33d>
xor    %eax,%eax
mov    %eax,-0x98(%rbp)
jmp    1470 <pixel_convert_8u_yuv422_to_8u_bgra+0x370>
mov    $0xff,%eax
cmp    -0x68(%rbp),%eax
jge    145b <pixel_convert_8u_yuv422_to_8u_bgra+0x35b>
mov    $0xff,%eax
mov    %eax,-0x9c(%rbp)
jmp    1464 <pixel_convert_8u_yuv422_to_8u_bgra+0x364>
mov    -0x68(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x9c(%rbp),%eax
mov    %eax,-0x98(%rbp)
mov    -0x98(%rbp),%edx
mov    -0x38(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x3,%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    $0xff,%eax
cmp    -0x64(%rbp),%eax
jge    14a7 <pixel_convert_8u_yuv422_to_8u_bgra+0x3a7>
mov    $0xff,%eax
mov    %eax,-0xa0(%rbp)
jmp    14b0 <pixel_convert_8u_yuv422_to_8u_bgra+0x3b0>
mov    -0x64(%rbp),%eax
mov    %eax,-0xa0(%rbp)
mov    -0xa0(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    14cd <pixel_convert_8u_yuv422_to_8u_bgra+0x3cd>
xor    %eax,%eax
mov    %eax,-0xa4(%rbp)
jmp    1500 <pixel_convert_8u_yuv422_to_8u_bgra+0x400>
mov    $0xff,%eax
cmp    -0x64(%rbp),%eax
jge    14eb <pixel_convert_8u_yuv422_to_8u_bgra+0x3eb>
mov    $0xff,%eax
mov    %eax,-0xa8(%rbp)
jmp    14f4 <pixel_convert_8u_yuv422_to_8u_bgra+0x3f4>
mov    -0x64(%rbp),%eax
mov    %eax,-0xa8(%rbp)
mov    -0xa8(%rbp),%eax
mov    %eax,-0xa4(%rbp)
mov    -0xa4(%rbp),%edx
mov    -0x38(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x3,%ecx
add    $0x5,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    $0xff,%eax
cmp    -0x60(%rbp),%eax
jge    1537 <pixel_convert_8u_yuv422_to_8u_bgra+0x437>
mov    $0xff,%eax
mov    %eax,-0xac(%rbp)
jmp    1540 <pixel_convert_8u_yuv422_to_8u_bgra+0x440>
mov    -0x60(%rbp),%eax
mov    %eax,-0xac(%rbp)
mov    -0xac(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    155d <pixel_convert_8u_yuv422_to_8u_bgra+0x45d>
xor    %eax,%eax
mov    %eax,-0xb0(%rbp)
jmp    1590 <pixel_convert_8u_yuv422_to_8u_bgra+0x490>
mov    $0xff,%eax
cmp    -0x60(%rbp),%eax
jge    157b <pixel_convert_8u_yuv422_to_8u_bgra+0x47b>
mov    $0xff,%eax
mov    %eax,-0xb4(%rbp)
jmp    1584 <pixel_convert_8u_yuv422_to_8u_bgra+0x484>
mov    -0x60(%rbp),%eax
mov    %eax,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
mov    %eax,-0xb0(%rbp)
mov    -0xb0(%rbp),%edx
mov    -0x38(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x3,%ecx
add    $0x6,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x38(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x3,%ecx
add    $0x7,%ecx
movslq %ecx,%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1169 <pixel_convert_8u_yuv422_to_8u_bgra+0x69>
jmp    15d3 <pixel_convert_8u_yuv422_to_8u_bgra+0x4d3>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1124 <pixel_convert_8u_yuv422_to_8u_bgra+0x24>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pixel_convert_8u_yuv422_to_8u_bgra>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %edx,-0x2c(%rsp)
mov    %rdi,-0x18(%rsp)
test   %ecx,%ecx
jle    12bb <pixel_convert_8u_yuv422_to_8u_bgra+0x1bb>
mov    -0x2c(%rsp),%eax
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
sar    %edx
mov    %rdx,-0x20(%rsp)
movslq %esi,%rax
mov    %rax,-0x28(%rsp)
movslq %r9d,%rax
mov    %ecx,%ecx
mov    %rcx,-0x10(%rsp)
add    $0xc,%r8
shl    $0x2,%rax
mov    %rax,-0x8(%rsp)
xor    %r15d,%r15d
jmp    1174 <pixel_convert_8u_yuv422_to_8u_bgra+0x74>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15
add    -0x8(%rsp),%r8
cmp    -0x10(%rsp),%r15
je     12bb <pixel_convert_8u_yuv422_to_8u_bgra+0x1bb>
cmpl   $0x2,-0x2c(%rsp)
jl     1160 <pixel_convert_8u_yuv422_to_8u_bgra+0x60>
mov    %r15,%rax
imul   -0x28(%rsp),%rax
mov    -0x18(%rsp),%rcx
lea    (%rcx,%rax,4),%r13
mov    -0x20(%rsp),%r12
xor    %esi,%esi
jmp    11be <pixel_convert_8u_yuv422_to_8u_bgra+0xbe>
cs nopw 0x0(%rax,%rax,1)
lea    0x6(%rsi),%ecx
mov    %eax,0x0(%r13,%rcx,4)
lea    0x7(%rsi),%eax
movl   $0x0,0x0(%r13,%rax,4)
add    $0x8,%rsi
add    $0xffffffffffffffff,%r12
je     1160 <pixel_convert_8u_yuv422_to_8u_bgra+0x60>
mov    -0xc(%r8,%rsi,2),%ecx
mov    -0x8(%r8,%rsi,2),%eax
mov    (%r8,%rsi,2),%edi
add    $0xffffff80,%eax
imul   $0x1c6,%eax,%ebx
sar    $0x8,%ebx
add    $0xffffff80,%edi
imul   $0x167,%edi,%ebp
imul   $0xb7,%edi,%edi
imul   $0x58,%eax,%r10d
add    %edi,%r10d
sar    $0x8,%r10d
lea    (%rbx,%rcx,1),%r9d
mov    %ecx,%r11d
sub    %r10d,%r11d
cmp    $0xff,%r9d
mov    $0xff,%eax
cmovge %eax,%r9d
test   %r9d,%r9d
jns    1214 <pixel_convert_8u_yuv422_to_8u_bgra+0x114>
xor    %r9d,%r9d
sar    $0x8,%ebp
mov    -0x4(%r8,%rsi,2),%edi
mov    %esi,%r14d
mov    %r9d,0x0(%r13,%r14,4)
cmp    $0xff,%r11d
jl     1233 <pixel_convert_8u_yuv422_to_8u_bgra+0x133>
mov    $0xff,%r11d
add    %ebp,%ecx
test   %r11d,%r11d
jns    123d <pixel_convert_8u_yuv422_to_8u_bgra+0x13d>
xor    %r11d,%r11d
lea    0x1(%rsi),%edx
mov    %r11d,0x0(%r13,%rdx,4)
cmp    $0xff,%ecx
cmovge %eax,%ecx
test   %ecx,%ecx
jns    1254 <pixel_convert_8u_yuv422_to_8u_bgra+0x154>
xor    %ecx,%ecx
lea    0x2(%rsi),%edx
mov    %ecx,0x0(%r13,%rdx,4)
lea    0x3(%rsi),%ecx
movl   $0x0,0x0(%r13,%rcx,4)
add    %edi,%ebx
mov    %edi,%ecx
sub    %r10d,%ecx
cmp    $0xff,%ebx
cmovge %eax,%ebx
test   %ebx,%ebx
jns    127e <pixel_convert_8u_yuv422_to_8u_bgra+0x17e>
xor    %ebx,%ebx
lea    0x4(%rsi),%edx
mov    %ebx,0x0(%r13,%rdx,4)
cmp    $0xff,%ecx
jl     1293 <pixel_convert_8u_yuv422_to_8u_bgra+0x193>
mov    $0xff,%ecx
add    %edi,%ebp
test   %ecx,%ecx
jns    129b <pixel_convert_8u_yuv422_to_8u_bgra+0x19b>
xor    %ecx,%ecx
lea    0x5(%rsi),%edx
mov    %ecx,0x0(%r13,%rdx,4)
cmp    $0xff,%ebp
cmovl  %ebp,%eax
test   %eax,%eax
jns    11a0 <pixel_convert_8u_yuv422_to_8u_bgra+0xa0>
xor    %eax,%eax
jmp    11a0 <pixel_convert_8u_yuv422_to_8u_bgra+0xa0>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @pixel_convert_8u_yuv422_to_8u_bgra(i32* %0, i32 %1, i32 %2, i32 %3, i32* %4, i32 %5) {
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
store i32* %0, i32** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32* %4, i32** %11
store i32 %5, i32* %12
store i32 0, i32* %13
br label %27
27: ; preds = %278, %6
%28 = load i32, i32* %13
%29 = load i32, i32* %10
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %281
31: ; preds = %27
%32 = load i32*, i32** %7
%33 = load i32, i32* %13
%34 = load i32, i32* %8
%35 = mul nsw i32 %33, %34
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %32, i64 %36
store i32* %37, i32** %15
%38 = load i32*, i32** %11
%39 = load i32, i32* %13
%40 = load i32, i32* %12
%41 = mul nsw i32 %39, %40
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i32, i32* %38, i64 %42
store i32* %43, i32** %16
store i32 0, i32* %14
br label %44
44: ; preds = %274, %31
%45 = load i32, i32* %14
%46 = load i32, i32* %9
%47 = sdiv i32 %46, 2
%48 = icmp slt i32 %45, %47
br i1 %48, label %49, label %277
49: ; preds = %44
%50 = load i32*, i32** %16
%51 = load i32, i32* %14
%52 = mul nsw i32 4, %51
%53 = add nsw i32 %52, 0
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i32, i32* %50, i64 %54
%56 = load i32, i32* %55
store i32 %56, i32* %17
%57 = load i32*, i32** %16
%58 = load i32, i32* %14
%59 = mul nsw i32 4, %58
%60 = add nsw i32 %59, 1
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i32, i32* %57, i64 %61
%63 = load i32, i32* %62
store i32 %63, i32* %18
%64 = load i32*, i32** %16
%65 = load i32, i32* %14
%66 = mul nsw i32 4, %65
%67 = add nsw i32 %66, 2
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i32, i32* %64, i64 %68
%70 = load i32, i32* %69
store i32 %70, i32* %19
%71 = load i32*, i32** %16
%72 = load i32, i32* %14
%73 = mul nsw i32 4, %72
%74 = add nsw i32 %73, 3
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i32, i32* %71, i64 %75
%77 = load i32, i32* %76
store i32 %77, i32* %20
%78 = load i32, i32* %18
%79 = sub nsw i32 %78, 128
%80 = mul nsw i32 %79, 454
%81 = ashr i32 %80, 8
store i32 %81, i32* %21
%82 = load i32, i32* %20
%83 = sub nsw i32 %82, 128
%84 = mul nsw i32 %83, 359
%85 = ashr i32 %84, 8
store i32 %85, i32* %22
%86 = load i32, i32* %20
%87 = sub nsw i32 %86, 128
%88 = mul nsw i32 %87, 183
%89 = load i32, i32* %18
%90 = sub nsw i32 %89, 128
%91 = mul nsw i32 %90, 88
%92 = add nsw i32 %88, %91
%93 = ashr i32 %92, 8
store i32 %93, i32* %23
%94 = load i32, i32* %17
%95 = load i32, i32* %22
%96 = add nsw i32 %94, %95
store i32 %96, i32* %24
%97 = load i32, i32* %17
%98 = load i32, i32* %21
%99 = add nsw i32 %97, %98
store i32 %99, i32* %26
%100 = load i32, i32* %17
%101 = load i32, i32* %23
%102 = sub nsw i32 %100, %101
store i32 %102, i32* %25
%103 = load i32, i32* %26
%104 = icmp slt i32 255, %103
br i1 %104, label %105, label %106
105: ; preds = %49
br label %108
106: ; preds = %49
%107 = load i32, i32* %26
br label %108
108: ; preds = %106, %105
%109 = phi i32 [ 255, %105 ], [ %107, %106 ]
%110 = icmp sgt i32 0, %109
br i1 %110, label %111, label %112
111: ; preds = %108
br label %120
112: ; preds = %108
%113 = load i32, i32* %26
%114 = icmp slt i32 255, %113
br i1 %114, label %115, label %116
115: ; preds = %112
br label %118
116: ; preds = %112
%117 = load i32, i32* %26
br label %118
118: ; preds = %116, %115
%119 = phi i32 [ 255, %115 ], [ %117, %116 ]
br label %120
120: ; preds = %118, %111
%121 = phi i32 [ 0, %111 ], [ %119, %118 ]
%122 = load i32*, i32** %15
%123 = load i32, i32* %14
%124 = mul nsw i32 8, %123
%125 = add nsw i32 %124, 0
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i32, i32* %122, i64 %126
store i32 %121, i32* %127
%128 = load i32, i32* %25
%129 = icmp slt i32 255, %128
br i1 %129, label %130, label %131
130: ; preds = %120
br label %133
131: ; preds = %120
%132 = load i32, i32* %25
br label %133
133: ; preds = %131, %130
%134 = phi i32 [ 255, %130 ], [ %132, %131 ]
%135 = icmp sgt i32 0, %134
br i1 %135, label %136, label %137
136: ; preds = %133
br label %145
137: ; preds = %133
%138 = load i32, i32* %25
%139 = icmp slt i32 255, %138
br i1 %139, label %140, label %141
140: ; preds = %137
br label %143
141: ; preds = %137
%142 = load i32, i32* %25
br label %143
143: ; preds = %141, %140
%144 = phi i32 [ 255, %140 ], [ %142, %141 ]
br label %145
145: ; preds = %143, %136
%146 = phi i32 [ 0, %136 ], [ %144, %143 ]
%147 = load i32*, i32** %15
%148 = load i32, i32* %14
%149 = mul nsw i32 8, %148
%150 = add nsw i32 %149, 1
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds i32, i32* %147, i64 %151
store i32 %146, i32* %152
%153 = load i32, i32* %24
%154 = icmp slt i32 255, %153
br i1 %154, label %155, label %156
155: ; preds = %145
br label %158
156: ; preds = %145
%157 = load i32, i32* %24
br label %158
158: ; preds = %156, %155
%159 = phi i32 [ 255, %155 ], [ %157, %156 ]
%160 = icmp sgt i32 0, %159
br i1 %160, label %161, label %162
161: ; preds = %158
br label %170
162: ; preds = %158
%163 = load i32, i32* %24
%164 = icmp slt i32 255, %163
br i1 %164, label %165, label %166
165: ; preds = %162
br label %168
166: ; preds = %162
%167 = load i32, i32* %24
br label %168
168: ; preds = %166, %165
%169 = phi i32 [ 255, %165 ], [ %167, %166 ]
br label %170
170: ; preds = %168, %161
%171 = phi i32 [ 0, %161 ], [ %169, %168 ]
%172 = load i32*, i32** %15
%173 = load i32, i32* %14
%174 = mul nsw i32 8, %173
%175 = add nsw i32 %174, 2
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds i32, i32* %172, i64 %176
store i32 %171, i32* %177
%178 = load i32*, i32** %15
%179 = load i32, i32* %14
%180 = mul nsw i32 8, %179
%181 = add nsw i32 %180, 3
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds i32, i32* %178, i64 %182
store i32 0, i32* %183
%184 = load i32, i32* %19
%185 = load i32, i32* %22
%186 = add nsw i32 %184, %185
store i32 %186, i32* %24
%187 = load i32, i32* %19
%188 = load i32, i32* %21
%189 = add nsw i32 %187, %188
store i32 %189, i32* %26
%190 = load i32, i32* %19
%191 = load i32, i32* %23
%192 = sub nsw i32 %190, %191
store i32 %192, i32* %25
%193 = load i32, i32* %26
%194 = icmp slt i32 255, %193
br i1 %194, label %195, label %196
195: ; preds = %170
br label %198
196: ; preds = %170
%197 = load i32, i32* %26
br label %198
198: ; preds = %196, %195
%199 = phi i32 [ 255, %195 ], [ %197, %196 ]
%200 = icmp sgt i32 0, %199
br i1 %200, label %201, label %202
201: ; preds = %198
br label %210
202: ; preds = %198
%203 = load i32, i32* %26
%204 = icmp slt i32 255, %203
br i1 %204, label %205, label %206
205: ; preds = %202
br label %208
206: ; preds = %202
%207 = load i32, i32* %26
br label %208
208: ; preds = %206, %205
%209 = phi i32 [ 255, %205 ], [ %207, %206 ]
br label %210
210: ; preds = %208, %201
%211 = phi i32 [ 0, %201 ], [ %209, %208 ]
%212 = load i32*, i32** %15
%213 = load i32, i32* %14
%214 = mul nsw i32 8, %213
%215 = add nsw i32 %214, 4
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds i32, i32* %212, i64 %216
store i32 %211, i32* %217
%218 = load i32, i32* %25
%219 = icmp slt i32 255, %218
br i1 %219, label %220, label %221
220: ; preds = %210
br label %223
221: ; preds = %210
%222 = load i32, i32* %25
br label %223
223: ; preds = %221, %220
%224 = phi i32 [ 255, %220 ], [ %222, %221 ]
%225 = icmp sgt i32 0, %224
br i1 %225, label %226, label %227
226: ; preds = %223
br label %235
227: ; preds = %223
%228 = load i32, i32* %25
%229 = icmp slt i32 255, %228
br i1 %229, label %230, label %231
230: ; preds = %227
br label %233
231: ; preds = %227
%232 = load i32, i32* %25
br label %233
233: ; preds = %231, %230
%234 = phi i32 [ 255, %230 ], [ %232, %231 ]
br label %235
235: ; preds = %233, %226
%236 = phi i32 [ 0, %226 ], [ %234, %233 ]
%237 = load i32*, i32** %15
%238 = load i32, i32* %14
%239 = mul nsw i32 8, %238
%240 = add nsw i32 %239, 5
%241 = sext i32 %240 to i64
%242 = getelementptr inbounds i32, i32* %237, i64 %241
store i32 %236, i32* %242
%243 = load i32, i32* %24
%244 = icmp slt i32 255, %243
br i1 %244, label %245, label %246
245: ; preds = %235
br label %248
246: ; preds = %235
%247 = load i32, i32* %24
br label %248
248: ; preds = %246, %245
%249 = phi i32 [ 255, %245 ], [ %247, %246 ]
%250 = icmp sgt i32 0, %249
br i1 %250, label %251, label %252
251: ; preds = %248
br label %260
252: ; preds = %248
%253 = load i32, i32* %24
%254 = icmp slt i32 255, %253
br i1 %254, label %255, label %256
255: ; preds = %252
br label %258
256: ; preds = %252
%257 = load i32, i32* %24
br label %258
258: ; preds = %256, %255
%259 = phi i32 [ 255, %255 ], [ %257, %256 ]
br label %260
260: ; preds = %258, %251
%261 = phi i32 [ 0, %251 ], [ %259, %258 ]
%262 = load i32*, i32** %15
%263 = load i32, i32* %14
%264 = mul nsw i32 8, %263
%265 = add nsw i32 %264, 6
%266 = sext i32 %265 to i64
%267 = getelementptr inbounds i32, i32* %262, i64 %266
store i32 %261, i32* %267
%268 = load i32*, i32** %15
%269 = load i32, i32* %14
%270 = mul nsw i32 8, %269
%271 = add nsw i32 %270, 7
%272 = sext i32 %271 to i64
%273 = getelementptr inbounds i32, i32* %268, i64 %272
store i32 0, i32* %273
br label %274
274: ; preds = %260
%275 = load i32, i32* %14
%276 = add nsw i32 %275, 1
store i32 %276, i32* %14
br label %44
277: ; preds = %44
br label %278
278: ; preds = %277
%279 = load i32, i32* %13
%280 = add nsw i32 %279, 1
store i32 %280, i32* %13
br label %27
281: ; preds = %27
ret i32 0
}

LLVM IR (-O2):
define i32 @pixel_convert_8u_yuv422_to_8u_bgra(i32* nocapture writeonly %0, i32 %1, i32 %2, i32 %3, i32* nocapture %4, i32 %5) {
%7 = icmp sgt i32 %3, 0
br i1 %7, label %8, label %105
8: ; preds = %6
%9 = sdiv i32 %2, 2
%10 = icmp sgt i32 %2, 1
%11 = sext i32 %1 to i64
%12 = sext i32 %5 to i64
%13 = zext i32 %3 to i64
%14 = zext i32 %9 to i64
br label %15
15: ; preds = %8, %102
%16 = phi i64 [ 0, %8 ], [ %103, %102 ]
%17 = mul nsw i64 %16, %11
%18 = getelementptr inbounds i32, i32* %0, i64 %17
%19 = mul nsw i64 %16, %12
%20 = getelementptr inbounds i32, i32* %4, i64 %19
br i1 %10, label %21, label %102
21: ; preds = %15, %21
%22 = phi i64 [ %100, %21 ], [ 0, %15 ]
%23 = shl nsw i64 %22, 2
%24 = getelementptr inbounds i32, i32* %20, i64 %23
%25 = load i32, i32* %24
%26 = or i64 %23, 1
%27 = getelementptr inbounds i32, i32* %20, i64 %26
%28 = load i32, i32* %27
%29 = or i64 %23, 2
%30 = getelementptr inbounds i32, i32* %20, i64 %29
%31 = load i32, i32* %30
%32 = or i64 %23, 3
%33 = getelementptr inbounds i32, i32* %20, i64 %32
%34 = load i32, i32* %33
%35 = add nsw i32 %28, -128
%36 = mul nsw i32 %35, 454
%37 = ashr i32 %36, 8
%38 = add nsw i32 %34, -128
%39 = mul nsw i32 %38, 359
%40 = ashr i32 %39, 8
%41 = mul nsw i32 %38, 183
%42 = mul nsw i32 %35, 88
%43 = add nsw i32 %41, %42
%44 = ashr i32 %43, 8
%45 = add nsw i32 %40, %25
%46 = add nsw i32 %37, %25
%47 = sub nsw i32 %25, %44
%48 = icmp slt i32 %46, 255
%49 = select i1 %48, i32 %46, i32 255
%50 = icmp sgt i32 %49, 0
%51 = select i1 %50, i32 %49, i32 0
%52 = trunc i64 %22 to i32
%53 = shl nsw i32 %52, 3
%54 = zext i32 %53 to i64
%55 = getelementptr inbounds i32, i32* %18, i64 %54
store i32 %51, i32* %55
%56 = icmp slt i32 %47, 255
%57 = select i1 %56, i32 %47, i32 255
%58 = icmp sgt i32 %57, 0
%59 = select i1 %58, i32 %57, i32 0
%60 = or i32 %53, 1
%61 = zext i32 %60 to i64
%62 = getelementptr inbounds i32, i32* %18, i64 %61
store i32 %59, i32* %62
%63 = icmp slt i32 %45, 255
%64 = select i1 %63, i32 %45, i32 255
%65 = icmp sgt i32 %64, 0
%66 = select i1 %65, i32 %64, i32 0
%67 = or i32 %53, 2
%68 = zext i32 %67 to i64
%69 = getelementptr inbounds i32, i32* %18, i64 %68
store i32 %66, i32* %69
%70 = or i32 %53, 3
%71 = zext i32 %70 to i64
%72 = getelementptr inbounds i32, i32* %18, i64 %71
store i32 0, i32* %72
%73 = add nsw i32 %40, %31
%74 = add nsw i32 %37, %31
%75 = sub nsw i32 %31, %44
%76 = icmp slt i32 %74, 255
%77 = select i1 %76, i32 %74, i32 255
%78 = icmp sgt i32 %77, 0
%79 = select i1 %78, i32 %77, i32 0
%80 = or i32 %53, 4
%81 = zext i32 %80 to i64
%82 = getelementptr inbounds i32, i32* %18, i64 %81
store i32 %79, i32* %82
%83 = icmp slt i32 %75, 255
%84 = select i1 %83, i32 %75, i32 255
%85 = icmp sgt i32 %84, 0
%86 = select i1 %85, i32 %84, i32 0
%87 = or i32 %53, 5
%88 = zext i32 %87 to i64
%89 = getelementptr inbounds i32, i32* %18, i64 %88
store i32 %86, i32* %89
%90 = icmp slt i32 %73, 255
%91 = select i1 %90, i32 %73, i32 255
%92 = icmp sgt i32 %91, 0
%93 = select i1 %92, i32 %91, i32 0
%94 = or i32 %53, 6
%95 = zext i32 %94 to i64
%96 = getelementptr inbounds i32, i32* %18, i64 %95
store i32 %93, i32* %96
%97 = or i32 %53, 7
%98 = zext i32 %97 to i64
%99 = getelementptr inbounds i32, i32* %18, i64 %98
store i32 0, i32* %99
%100 = add nuw nsw i64 %22, 1
%101 = icmp eq i64 %100, %14
br i1 %101, label %102, label %21
102: ; preds = %21, %15
%103 = add nuw nsw i64 %16, 1
%104 = icmp eq i64 %103, %13
br i1 %104, label %105, label %15
105: ; preds = %102, %6
ret i32 0
}