#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_yuv420p_to_8u_bgr(uint8_t *dest, int dstride, int dwidth,
                                       int dheight, const uint8_t *src,
                                       int sstride) {
  const uint8_t *uplane = src + dheight * sstride;
  const uint8_t *vplane = uplane + dheight * sstride / 4;
  for (int i = 0; i < dheight / 2; i++) {
    const uint8_t *yrow1 = src + i * 2 * sstride;
    const uint8_t *yrow2 = src + i * 2 * sstride + sstride;
    const uint8_t *urow = uplane + i * sstride / 2;
    const uint8_t *vrow = vplane + i * sstride / 2;
    uint8_t *rgb1 = dest + i * 2 * dstride;
    uint8_t *rgb2 = dest + i * 2 * dstride + dstride;
    for (int j = 0; j < dwidth / 2; j++) {
      int cb = ((urow[j] - 128) * 454) >> 8;
      int cr = ((vrow[j] - 128) * 359) >> 8;
      int cg = ((vrow[j] - 128) * 183 + (urow[j] - 128) * 88) >> 8;
      int r, g, b, yp;
      yp = yrow1[j * 2];
      r = yp + cr;
      b = yp + cb;
      g = yp - cg;
      rgb1[j * 6 + 2] =
          ((0) > (((255) < (r) ? (255) : (r))) ? (0)
                                               : (((255) < (r) ? (255) : (r))));
      rgb1[j * 6 + 1] =
          ((0) > (((255) < (g) ? (255) : (g))) ? (0)
                                               : (((255) < (g) ? (255) : (g))));
      rgb1[j * 6 + 0] =
          ((0) > (((255) < (b) ? (255) : (b))) ? (0)
                                               : (((255) < (b) ? (255) : (b))));
      yp = yrow1[j * 2 + 1];
      r = yp + cr;
      b = yp + cb;
      g = yp - cg;
      rgb1[j * 6 + 5] =
          ((0) > (((255) < (r) ? (255) : (r))) ? (0)
                                               : (((255) < (r) ? (255) : (r))));
      rgb1[j * 6 + 4] =
          ((0) > (((255) < (g) ? (255) : (g))) ? (0)
                                               : (((255) < (g) ? (255) : (g))));
      rgb1[j * 6 + 3] =
          ((0) > (((255) < (b) ? (255) : (b))) ? (0)
                                               : (((255) < (b) ? (255) : (b))));
      yp = yrow2[j * 2];
      r = yp + cr;
      b = yp + cb;
      g = yp - cg;
      rgb2[j * 6 + 2] =
          ((0) > (((255) < (r) ? (255) : (r))) ? (0)
                                               : (((255) < (r) ? (255) : (r))));
      rgb2[j * 6 + 1] =
          ((0) > (((255) < (g) ? (255) : (g))) ? (0)
                                               : (((255) < (g) ? (255) : (g))));
      rgb2[j * 6 + 0] =
          ((0) > (((255) < (b) ? (255) : (b))) ? (0)
                                               : (((255) < (b) ? (255) : (b))));
      yp = yrow2[j * 2 + 1];
      r = yp + cr;
      b = yp + cb;
      g = yp - cg;
      rgb2[j * 6 + 5] =
          ((0) > (((255) < (r) ? (255) : (r))) ? (0)
                                               : (((255) < (r) ? (255) : (r))));
      rgb2[j * 6 + 4] =
          ((0) > (((255) < (g) ? (255) : (g))) ? (0)
                                               : (((255) < (g) ? (255) : (g))));
      rgb2[j * 6 + 3] =
          ((0) > (((255) < (b) ? (255) : (b))) ? (0)
                                               : (((255) < (b) ? (255) : (b))));
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<pixel_convert_8u_yuv420p_to_8u_bgr>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc8,%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)
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x24(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x24(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x98(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x9c(%rbp),%eax
cmp    %ecx,%eax
jge    1b7d <pixel_convert_8u_yuv420p_to_8u_bgr+0xa7d>
mov    -0x20(%rbp),%rax
mov    -0x3c(%rbp),%ecx
shl    $0x1,%ecx
imul   -0x24(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x3c(%rbp),%ecx
shl    $0x1,%ecx
imul   -0x24(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x24(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x3c(%rbp),%eax
imul   -0x24(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xb0(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x3c(%rbp),%eax
imul   -0x24(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xa8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x3c(%rbp),%ecx
shl    $0x1,%ecx
imul   -0xc(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x68(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x3c(%rbp),%ecx
shl    $0x1,%ecx
imul   -0xc(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
mov    %eax,-0xb4(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xb4(%rbp),%eax
cmp    %ecx,%eax
jge    1b6a <pixel_convert_8u_yuv420p_to_8u_bgr+0xa6a>
mov    -0x58(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
sub    $0x80,%eax
imul   $0x1c6,%eax,%eax
sar    $0x8,%eax
mov    %eax,-0x78(%rbp)
mov    -0x60(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
sub    $0x80,%eax
imul   $0x167,%eax,%eax
sar    $0x8,%eax
mov    %eax,-0x7c(%rbp)
mov    -0x60(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
sub    $0x80,%eax
imul   $0xb7,%eax,%eax
mov    -0x58(%rbp),%rcx
movslq -0x74(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
sub    $0x80,%ecx
imul   $0x58,%ecx,%ecx
add    %ecx,%eax
sar    $0x8,%eax
mov    %eax,-0x80(%rbp)
mov    -0x48(%rbp),%rax
mov    -0x74(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x90(%rbp)
mov    -0x90(%rbp),%eax
add    -0x7c(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x90(%rbp),%eax
add    -0x78(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x90(%rbp),%eax
sub    -0x80(%rbp),%eax
mov    %eax,-0x88(%rbp)
mov    $0xff,%eax
cmp    -0x84(%rbp),%eax
jge    1376 <pixel_convert_8u_yuv420p_to_8u_bgr+0x276>
mov    $0xff,%eax
mov    %eax,-0xb8(%rbp)
jmp    1382 <pixel_convert_8u_yuv420p_to_8u_bgr+0x282>
mov    -0x84(%rbp),%eax
mov    %eax,-0xb8(%rbp)
mov    -0xb8(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    139f <pixel_convert_8u_yuv420p_to_8u_bgr+0x29f>
xor    %eax,%eax
mov    %eax,-0xbc(%rbp)
jmp    13d8 <pixel_convert_8u_yuv420p_to_8u_bgr+0x2d8>
mov    $0xff,%eax
cmp    -0x84(%rbp),%eax
jge    13c0 <pixel_convert_8u_yuv420p_to_8u_bgr+0x2c0>
mov    $0xff,%eax
mov    %eax,-0xc0(%rbp)
jmp    13cc <pixel_convert_8u_yuv420p_to_8u_bgr+0x2cc>
mov    -0x84(%rbp),%eax
mov    %eax,-0xc0(%rbp)
mov    -0xc0(%rbp),%eax
mov    %eax,-0xbc(%rbp)
mov    -0xbc(%rbp),%edx
mov    -0x68(%rbp),%rax
imul   $0x6,-0x74(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    $0xff,%eax
cmp    -0x88(%rbp),%eax
jge    1410 <pixel_convert_8u_yuv420p_to_8u_bgr+0x310>
mov    $0xff,%eax
mov    %eax,-0xc4(%rbp)
jmp    141c <pixel_convert_8u_yuv420p_to_8u_bgr+0x31c>
mov    -0x88(%rbp),%eax
mov    %eax,-0xc4(%rbp)
mov    -0xc4(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    1439 <pixel_convert_8u_yuv420p_to_8u_bgr+0x339>
xor    %eax,%eax
mov    %eax,-0xc8(%rbp)
jmp    1472 <pixel_convert_8u_yuv420p_to_8u_bgr+0x372>
mov    $0xff,%eax
cmp    -0x88(%rbp),%eax
jge    145a <pixel_convert_8u_yuv420p_to_8u_bgr+0x35a>
mov    $0xff,%eax
mov    %eax,-0xcc(%rbp)
jmp    1466 <pixel_convert_8u_yuv420p_to_8u_bgr+0x366>
mov    -0x88(%rbp),%eax
mov    %eax,-0xcc(%rbp)
mov    -0xcc(%rbp),%eax
mov    %eax,-0xc8(%rbp)
mov    -0xc8(%rbp),%edx
mov    -0x68(%rbp),%rax
imul   $0x6,-0x74(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    $0xff,%eax
cmp    -0x8c(%rbp),%eax
jge    14aa <pixel_convert_8u_yuv420p_to_8u_bgr+0x3aa>
mov    $0xff,%eax
mov    %eax,-0xd0(%rbp)
jmp    14b6 <pixel_convert_8u_yuv420p_to_8u_bgr+0x3b6>
mov    -0x8c(%rbp),%eax
mov    %eax,-0xd0(%rbp)
mov    -0xd0(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    14d3 <pixel_convert_8u_yuv420p_to_8u_bgr+0x3d3>
xor    %eax,%eax
mov    %eax,-0xd4(%rbp)
jmp    150c <pixel_convert_8u_yuv420p_to_8u_bgr+0x40c>
mov    $0xff,%eax
cmp    -0x8c(%rbp),%eax
jge    14f4 <pixel_convert_8u_yuv420p_to_8u_bgr+0x3f4>
mov    $0xff,%eax
mov    %eax,-0xd8(%rbp)
jmp    1500 <pixel_convert_8u_yuv420p_to_8u_bgr+0x400>
mov    -0x8c(%rbp),%eax
mov    %eax,-0xd8(%rbp)
mov    -0xd8(%rbp),%eax
mov    %eax,-0xd4(%rbp)
mov    -0xd4(%rbp),%edx
mov    -0x68(%rbp),%rax
imul   $0x6,-0x74(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x48(%rbp),%rax
mov    -0x74(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x90(%rbp)
mov    -0x90(%rbp),%eax
add    -0x7c(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x90(%rbp),%eax
add    -0x78(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x90(%rbp),%eax
sub    -0x80(%rbp),%eax
mov    %eax,-0x88(%rbp)
mov    $0xff,%eax
cmp    -0x84(%rbp),%eax
jge    158a <pixel_convert_8u_yuv420p_to_8u_bgr+0x48a>
mov    $0xff,%eax
mov    %eax,-0xdc(%rbp)
jmp    1596 <pixel_convert_8u_yuv420p_to_8u_bgr+0x496>
mov    -0x84(%rbp),%eax
mov    %eax,-0xdc(%rbp)
mov    -0xdc(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    15b3 <pixel_convert_8u_yuv420p_to_8u_bgr+0x4b3>
xor    %eax,%eax
mov    %eax,-0xe0(%rbp)
jmp    15ec <pixel_convert_8u_yuv420p_to_8u_bgr+0x4ec>
mov    $0xff,%eax
cmp    -0x84(%rbp),%eax
jge    15d4 <pixel_convert_8u_yuv420p_to_8u_bgr+0x4d4>
mov    $0xff,%eax
mov    %eax,-0xe4(%rbp)
jmp    15e0 <pixel_convert_8u_yuv420p_to_8u_bgr+0x4e0>
mov    -0x84(%rbp),%eax
mov    %eax,-0xe4(%rbp)
mov    -0xe4(%rbp),%eax
mov    %eax,-0xe0(%rbp)
mov    -0xe0(%rbp),%edx
mov    -0x68(%rbp),%rax
imul   $0x6,-0x74(%rbp),%ecx
add    $0x5,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    $0xff,%eax
cmp    -0x88(%rbp),%eax
jge    1624 <pixel_convert_8u_yuv420p_to_8u_bgr+0x524>
mov    $0xff,%eax
mov    %eax,-0xe8(%rbp)
jmp    1630 <pixel_convert_8u_yuv420p_to_8u_bgr+0x530>
mov    -0x88(%rbp),%eax
mov    %eax,-0xe8(%rbp)
mov    -0xe8(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    164d <pixel_convert_8u_yuv420p_to_8u_bgr+0x54d>
xor    %eax,%eax
mov    %eax,-0xec(%rbp)
jmp    1686 <pixel_convert_8u_yuv420p_to_8u_bgr+0x586>
mov    $0xff,%eax
cmp    -0x88(%rbp),%eax
jge    166e <pixel_convert_8u_yuv420p_to_8u_bgr+0x56e>
mov    $0xff,%eax
mov    %eax,-0xf0(%rbp)
jmp    167a <pixel_convert_8u_yuv420p_to_8u_bgr+0x57a>
mov    -0x88(%rbp),%eax
mov    %eax,-0xf0(%rbp)
mov    -0xf0(%rbp),%eax
mov    %eax,-0xec(%rbp)
mov    -0xec(%rbp),%edx
mov    -0x68(%rbp),%rax
imul   $0x6,-0x74(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    $0xff,%eax
cmp    -0x8c(%rbp),%eax
jge    16be <pixel_convert_8u_yuv420p_to_8u_bgr+0x5be>
mov    $0xff,%eax
mov    %eax,-0xf4(%rbp)
jmp    16ca <pixel_convert_8u_yuv420p_to_8u_bgr+0x5ca>
mov    -0x8c(%rbp),%eax
mov    %eax,-0xf4(%rbp)
mov    -0xf4(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    16e7 <pixel_convert_8u_yuv420p_to_8u_bgr+0x5e7>
xor    %eax,%eax
mov    %eax,-0xf8(%rbp)
jmp    1720 <pixel_convert_8u_yuv420p_to_8u_bgr+0x620>
mov    $0xff,%eax
cmp    -0x8c(%rbp),%eax
jge    1708 <pixel_convert_8u_yuv420p_to_8u_bgr+0x608>
mov    $0xff,%eax
mov    %eax,-0xfc(%rbp)
jmp    1714 <pixel_convert_8u_yuv420p_to_8u_bgr+0x614>
mov    -0x8c(%rbp),%eax
mov    %eax,-0xfc(%rbp)
mov    -0xfc(%rbp),%eax
mov    %eax,-0xf8(%rbp)
mov    -0xf8(%rbp),%edx
mov    -0x68(%rbp),%rax
imul   $0x6,-0x74(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x50(%rbp),%rax
mov    -0x74(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x90(%rbp)
mov    -0x90(%rbp),%eax
add    -0x7c(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x90(%rbp),%eax
add    -0x78(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x90(%rbp),%eax
sub    -0x80(%rbp),%eax
mov    %eax,-0x88(%rbp)
mov    $0xff,%eax
cmp    -0x84(%rbp),%eax
jge    179b <pixel_convert_8u_yuv420p_to_8u_bgr+0x69b>
mov    $0xff,%eax
mov    %eax,-0x100(%rbp)
jmp    17a7 <pixel_convert_8u_yuv420p_to_8u_bgr+0x6a7>
mov    -0x84(%rbp),%eax
mov    %eax,-0x100(%rbp)
mov    -0x100(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    17c4 <pixel_convert_8u_yuv420p_to_8u_bgr+0x6c4>
xor    %eax,%eax
mov    %eax,-0x104(%rbp)
jmp    17fd <pixel_convert_8u_yuv420p_to_8u_bgr+0x6fd>
mov    $0xff,%eax
cmp    -0x84(%rbp),%eax
jge    17e5 <pixel_convert_8u_yuv420p_to_8u_bgr+0x6e5>
mov    $0xff,%eax
mov    %eax,-0x108(%rbp)
jmp    17f1 <pixel_convert_8u_yuv420p_to_8u_bgr+0x6f1>
mov    -0x84(%rbp),%eax
mov    %eax,-0x108(%rbp)
mov    -0x108(%rbp),%eax
mov    %eax,-0x104(%rbp)
mov    -0x104(%rbp),%edx
mov    -0x70(%rbp),%rax
imul   $0x6,-0x74(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    $0xff,%eax
cmp    -0x88(%rbp),%eax
jge    1835 <pixel_convert_8u_yuv420p_to_8u_bgr+0x735>
mov    $0xff,%eax
mov    %eax,-0x10c(%rbp)
jmp    1841 <pixel_convert_8u_yuv420p_to_8u_bgr+0x741>
mov    -0x88(%rbp),%eax
mov    %eax,-0x10c(%rbp)
mov    -0x10c(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    185e <pixel_convert_8u_yuv420p_to_8u_bgr+0x75e>
xor    %eax,%eax
mov    %eax,-0x110(%rbp)
jmp    1897 <pixel_convert_8u_yuv420p_to_8u_bgr+0x797>
mov    $0xff,%eax
cmp    -0x88(%rbp),%eax
jge    187f <pixel_convert_8u_yuv420p_to_8u_bgr+0x77f>
mov    $0xff,%eax
mov    %eax,-0x114(%rbp)
jmp    188b <pixel_convert_8u_yuv420p_to_8u_bgr+0x78b>
mov    -0x88(%rbp),%eax
mov    %eax,-0x114(%rbp)
mov    -0x114(%rbp),%eax
mov    %eax,-0x110(%rbp)
mov    -0x110(%rbp),%edx
mov    -0x70(%rbp),%rax
imul   $0x6,-0x74(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    $0xff,%eax
cmp    -0x8c(%rbp),%eax
jge    18cf <pixel_convert_8u_yuv420p_to_8u_bgr+0x7cf>
mov    $0xff,%eax
mov    %eax,-0x118(%rbp)
jmp    18db <pixel_convert_8u_yuv420p_to_8u_bgr+0x7db>
mov    -0x8c(%rbp),%eax
mov    %eax,-0x118(%rbp)
mov    -0x118(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    18f8 <pixel_convert_8u_yuv420p_to_8u_bgr+0x7f8>
xor    %eax,%eax
mov    %eax,-0x11c(%rbp)
jmp    1931 <pixel_convert_8u_yuv420p_to_8u_bgr+0x831>
mov    $0xff,%eax
cmp    -0x8c(%rbp),%eax
jge    1919 <pixel_convert_8u_yuv420p_to_8u_bgr+0x819>
mov    $0xff,%eax
mov    %eax,-0x120(%rbp)
jmp    1925 <pixel_convert_8u_yuv420p_to_8u_bgr+0x825>
mov    -0x8c(%rbp),%eax
mov    %eax,-0x120(%rbp)
mov    -0x120(%rbp),%eax
mov    %eax,-0x11c(%rbp)
mov    -0x11c(%rbp),%edx
mov    -0x70(%rbp),%rax
imul   $0x6,-0x74(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x50(%rbp),%rax
mov    -0x74(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x90(%rbp)
mov    -0x90(%rbp),%eax
add    -0x7c(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x90(%rbp),%eax
add    -0x78(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x90(%rbp),%eax
sub    -0x80(%rbp),%eax
mov    %eax,-0x88(%rbp)
mov    $0xff,%eax
cmp    -0x84(%rbp),%eax
jge    19af <pixel_convert_8u_yuv420p_to_8u_bgr+0x8af>
mov    $0xff,%eax
mov    %eax,-0x124(%rbp)
jmp    19bb <pixel_convert_8u_yuv420p_to_8u_bgr+0x8bb>
mov    -0x84(%rbp),%eax
mov    %eax,-0x124(%rbp)
mov    -0x124(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    19d8 <pixel_convert_8u_yuv420p_to_8u_bgr+0x8d8>
xor    %eax,%eax
mov    %eax,-0x128(%rbp)
jmp    1a11 <pixel_convert_8u_yuv420p_to_8u_bgr+0x911>
mov    $0xff,%eax
cmp    -0x84(%rbp),%eax
jge    19f9 <pixel_convert_8u_yuv420p_to_8u_bgr+0x8f9>
mov    $0xff,%eax
mov    %eax,-0x12c(%rbp)
jmp    1a05 <pixel_convert_8u_yuv420p_to_8u_bgr+0x905>
mov    -0x84(%rbp),%eax
mov    %eax,-0x12c(%rbp)
mov    -0x12c(%rbp),%eax
mov    %eax,-0x128(%rbp)
mov    -0x128(%rbp),%edx
mov    -0x70(%rbp),%rax
imul   $0x6,-0x74(%rbp),%ecx
add    $0x5,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    $0xff,%eax
cmp    -0x88(%rbp),%eax
jge    1a49 <pixel_convert_8u_yuv420p_to_8u_bgr+0x949>
mov    $0xff,%eax
mov    %eax,-0x130(%rbp)
jmp    1a55 <pixel_convert_8u_yuv420p_to_8u_bgr+0x955>
mov    -0x88(%rbp),%eax
mov    %eax,-0x130(%rbp)
mov    -0x130(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    1a72 <pixel_convert_8u_yuv420p_to_8u_bgr+0x972>
xor    %eax,%eax
mov    %eax,-0x134(%rbp)
jmp    1aab <pixel_convert_8u_yuv420p_to_8u_bgr+0x9ab>
mov    $0xff,%eax
cmp    -0x88(%rbp),%eax
jge    1a93 <pixel_convert_8u_yuv420p_to_8u_bgr+0x993>
mov    $0xff,%eax
mov    %eax,-0x138(%rbp)
jmp    1a9f <pixel_convert_8u_yuv420p_to_8u_bgr+0x99f>
mov    -0x88(%rbp),%eax
mov    %eax,-0x138(%rbp)
mov    -0x138(%rbp),%eax
mov    %eax,-0x134(%rbp)
mov    -0x134(%rbp),%edx
mov    -0x70(%rbp),%rax
imul   $0x6,-0x74(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    $0xff,%eax
cmp    -0x8c(%rbp),%eax
jge    1ae3 <pixel_convert_8u_yuv420p_to_8u_bgr+0x9e3>
mov    $0xff,%eax
mov    %eax,-0x13c(%rbp)
jmp    1aef <pixel_convert_8u_yuv420p_to_8u_bgr+0x9ef>
mov    -0x8c(%rbp),%eax
mov    %eax,-0x13c(%rbp)
mov    -0x13c(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    1b0c <pixel_convert_8u_yuv420p_to_8u_bgr+0xa0c>
xor    %eax,%eax
mov    %eax,-0x140(%rbp)
jmp    1b45 <pixel_convert_8u_yuv420p_to_8u_bgr+0xa45>
mov    $0xff,%eax
cmp    -0x8c(%rbp),%eax
jge    1b2d <pixel_convert_8u_yuv420p_to_8u_bgr+0xa2d>
mov    $0xff,%eax
mov    %eax,-0x144(%rbp)
jmp    1b39 <pixel_convert_8u_yuv420p_to_8u_bgr+0xa39>
mov    -0x8c(%rbp),%eax
mov    %eax,-0x144(%rbp)
mov    -0x144(%rbp),%eax
mov    %eax,-0x140(%rbp)
mov    -0x140(%rbp),%edx
mov    -0x70(%rbp),%rax
imul   $0x6,-0x74(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1284 <pixel_convert_8u_yuv420p_to_8u_bgr+0x184>
jmp    1b6f <pixel_convert_8u_yuv420p_to_8u_bgr+0xa6f>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1171 <pixel_convert_8u_yuv420p_to_8u_bgr+0x71>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pixel_convert_8u_yuv420p_to_8u_bgr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %edx,-0x44(%rsp)
mov    %rdi,-0x38(%rsp)
mov    %r9d,-0x48(%rsp)
mov    %r9d,%edx
imul   %ecx,%edx
lea    0x3(%rdx),%eax
test   %edx,%edx
cmovns %edx,%eax
mov    %rcx,-0x40(%rsp)
cmp    $0x2,%ecx
jl     13b0 <pixel_convert_8u_yuv420p_to_8u_bgr+0x2b0>
movslq %edx,%rcx
lea    (%r8,%rcx,4),%rcx
sar    $0x2,%eax
cltq
mov    %rcx,-0x20(%rsp)
lea    (%rcx,%rax,4),%rax
mov    %rax,-0x28(%rsp)
mov    -0x40(%rsp),%rax
shr    %eax
mov    %rax,-0x40(%rsp)
movslq -0x48(%rsp),%rcx
movslq %esi,%rsi
mov    -0x44(%rsp),%eax
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
sar    %edx
mov    %rdx,-0x8(%rsp)
addq   $0x14,-0x38(%rsp)
lea    0x0(,%rsi,8),%rax
mov    %rax,-0x18(%rsp)
lea    (%r8,%rcx,4),%rax
add    $0x4,%rax
shl    $0x3,%rcx
mov    %rcx,-0x10(%rsp)
add    $0x4,%r8
xor    %ecx,%ecx
mov    %rcx,-0x30(%rsp)
jmp    11e1 <pixel_convert_8u_yuv420p_to_8u_bgr+0xe1>
cs nopw 0x0(%rax,%rax,1)
nop
mov    -0x30(%rsp),%rdx
add    $0x1,%rdx
mov    -0x18(%rsp),%rcx
add    %rcx,-0x38(%rsp)
mov    -0x10(%rsp),%rcx
add    %rcx,%rax
add    %rcx,%r8
mov    %rdx,%rcx
mov    %rdx,-0x30(%rsp)
cmp    -0x40(%rsp),%rdx
je     13b0 <pixel_convert_8u_yuv420p_to_8u_bgr+0x2b0>
cmpl   $0x2,-0x44(%rsp)
jl     11b0 <pixel_convert_8u_yuv420p_to_8u_bgr+0xb0>
mov    -0x30(%rsp),%rcx
imul   -0x48(%rsp),%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
add    %ecx,%edx
sar    %edx
movslq %edx,%rcx
mov    -0x20(%rsp),%rdx
lea    (%rdx,%rcx,4),%r12
mov    -0x28(%rsp),%rdx
lea    (%rdx,%rcx,4),%r13
mov    -0x38(%rsp),%rdi
xor    %r11d,%r11d
jmp    1238 <pixel_convert_8u_yuv420p_to_8u_bgr+0x138>
nopw   0x0(%rax,%rax,1)
mov    %r9d,-0x8(%rdi,%rsi,4)
add    $0x1,%r11
add    $0x18,%rdi
cmp    %r11,-0x8(%rsp)
je     11b0 <pixel_convert_8u_yuv420p_to_8u_bgr+0xb0>
mov    (%r12,%r11,4),%ecx
add    $0xffffff80,%ecx
imul   $0x1c6,%ecx,%r14d
mov    0x0(%r13,%r11,4),%ebp
add    $0xffffff80,%ebp
imul   $0x167,%ebp,%edx
sar    $0x8,%edx
imul   $0xb7,%ebp,%ebp
imul   $0x58,%ecx,%r15d
add    %ebp,%r15d
sar    $0x8,%r15d
mov    -0x4(%r8,%r11,8),%ecx
lea    (%rdx,%rcx,1),%ebx
mov    %ecx,%r10d
sub    %r15d,%r10d
cmp    $0xff,%ebx
mov    $0xff,%r9d
cmovge %r9d,%ebx
test   %ebx,%ebx
jns    128c <pixel_convert_8u_yuv420p_to_8u_bgr+0x18c>
xor    %ebx,%ebx
sar    $0x8,%r14d
mov    %ebx,-0xc(%rdi)
cmp    $0xff,%r10d
jl     12a2 <pixel_convert_8u_yuv420p_to_8u_bgr+0x1a2>
mov    $0xff,%r10d
add    %r14d,%ecx
test   %r10d,%r10d
jns    12ad <pixel_convert_8u_yuv420p_to_8u_bgr+0x1ad>
xor    %r10d,%r10d
mov    %r10d,-0x10(%rdi)
cmp    $0xff,%ecx
cmovge %r9d,%ecx
test   %ecx,%ecx
jns    12c1 <pixel_convert_8u_yuv420p_to_8u_bgr+0x1c1>
xor    %ecx,%ecx
mov    %ecx,-0x14(%rdi)
mov    (%r8,%r11,8),%ecx
lea    (%rcx,%rdx,1),%ebp
mov    %ecx,%ebx
sub    %r15d,%ebx
cmp    $0xff,%ebp
cmovge %r9d,%ebp
test   %ebp,%ebp
jns    12e0 <pixel_convert_8u_yuv420p_to_8u_bgr+0x1e0>
xor    %ebp,%ebp
mov    %ebp,(%rdi)
cmp    $0xff,%ebx
jl     12ef <pixel_convert_8u_yuv420p_to_8u_bgr+0x1ef>
mov    $0xff,%ebx
add    %r14d,%ecx
test   %ebx,%ebx
jns    12f8 <pixel_convert_8u_yuv420p_to_8u_bgr+0x1f8>
xor    %ebx,%ebx
mov    %ebx,-0x4(%rdi)
cmp    $0xff,%ecx
cmovge %r9d,%ecx
test   %ecx,%ecx
jns    130b <pixel_convert_8u_yuv420p_to_8u_bgr+0x20b>
xor    %ecx,%ecx
mov    %ecx,-0x8(%rdi)
mov    -0x4(%rax,%r11,8),%ecx
lea    (%rcx,%rdx,1),%ebp
mov    %ecx,%ebx
sub    %r15d,%ebx
cmp    $0xff,%ebp
cmovge %r9d,%ebp
test   %ebp,%ebp
jns    132b <pixel_convert_8u_yuv420p_to_8u_bgr+0x22b>
xor    %ebp,%ebp
mov    %ebp,-0xc(%rdi,%rsi,4)
cmp    $0xff,%ebx
jl     133c <pixel_convert_8u_yuv420p_to_8u_bgr+0x23c>
mov    $0xff,%ebx
add    %r14d,%ecx
test   %ebx,%ebx
jns    1345 <pixel_convert_8u_yuv420p_to_8u_bgr+0x245>
xor    %ebx,%ebx
mov    %ebx,-0x10(%rdi,%rsi,4)
cmp    $0xff,%ecx
cmovge %r9d,%ecx
test   %ecx,%ecx
jns    1359 <pixel_convert_8u_yuv420p_to_8u_bgr+0x259>
xor    %ecx,%ecx
mov    %ecx,-0x14(%rdi,%rsi,4)
mov    (%rax,%r11,8),%ebx
add    %ebx,%edx
mov    %ebx,%ecx
sub    %r15d,%ecx
cmp    $0xff,%edx
cmovge %r9d,%edx
test   %edx,%edx
jns    1378 <pixel_convert_8u_yuv420p_to_8u_bgr+0x278>
xor    %edx,%edx
mov    %edx,(%rdi,%rsi,4)
cmp    $0xff,%ecx
jl     1388 <pixel_convert_8u_yuv420p_to_8u_bgr+0x288>
mov    $0xff,%ecx
add    %r14d,%ebx
test   %ecx,%ecx
jns    1391 <pixel_convert_8u_yuv420p_to_8u_bgr+0x291>
xor    %ecx,%ecx
mov    %ecx,-0x4(%rdi,%rsi,4)
cmp    $0xff,%ebx
cmovl  %ebx,%r9d
test   %r9d,%r9d
jns    1220 <pixel_convert_8u_yuv420p_to_8u_bgr+0x120>
xor    %r9d,%r9d
jmp    1220 <pixel_convert_8u_yuv420p_to_8u_bgr+0x120>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @pixel_convert_8u_yuv420p_to_8u_bgr(i32* nocapture writeonly %0, i32 %1, i32 %2, i32 %3, i32* nocapture %4, i32 %5) {
%7 = mul nsw i32 %5, %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %4, i64 %8
%10 = sdiv i32 %7, 4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %9, i64 %11
%13 = icmp sgt i32 %3, 1
br i1 %13, label %14, label %22
14: ; preds = %6
%15 = lshr i32 %3, 1
%16 = sext i32 %5 to i64
%17 = sext i32 %1 to i64
%18 = sdiv i32 %2, 2
%19 = icmp sgt i32 %2, 1
%20 = zext i32 %15 to i64
%21 = zext i32 %18 to i64
br label %23
22: ; preds = %38, %6
ret i32 0
23: ; preds = %14, %38
%24 = phi i64 [ 0, %14 ], [ %39, %38 ]
%25 = shl nuw nsw i64 %24, 1
%26 = mul nsw i64 %25, %16
%27 = getelementptr inbounds i32, i32* %4, i64 %26
%28 = getelementptr inbounds i32, i32* %27, i64 %16
%29 = trunc i64 %24 to i32
%30 = mul i32 %29, %5
%31 = sdiv i32 %30, 2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %9, i64 %32
%34 = getelementptr inbounds i32, i32* %12, i64 %32
%35 = mul nsw i64 %25, %17
%36 = getelementptr inbounds i32, i32* %0, i64 %35
%37 = getelementptr inbounds i32, i32* %36, i64 %17
br i1 %19, label %41, label %38
38: ; preds = %41, %23
%39 = add nuw nsw i64 %24, 1
%40 = icmp eq i64 %39, %20
br i1 %40, label %22, label %23
41: ; preds = %23, %41
%42 = phi i64 [ %145, %41 ], [ 0, %23 ]
%43 = getelementptr inbounds i32, i32* %33, i64 %42
%44 = load i32, i32* %43
%45 = add nsw i32 %44, -128
%46 = mul nsw i32 %45, 454
%47 = ashr i32 %46, 8
%48 = getelementptr inbounds i32, i32* %34, i64 %42
%49 = load i32, i32* %48
%50 = add nsw i32 %49, -128
%51 = mul nsw i32 %50, 359
%52 = ashr i32 %51, 8
%53 = mul nsw i32 %50, 183
%54 = mul nsw i32 %45, 88
%55 = add nsw i32 %53, %54
%56 = ashr i32 %55, 8
%57 = shl nuw nsw i64 %42, 1
%58 = getelementptr inbounds i32, i32* %27, i64 %57
%59 = load i32, i32* %58
%60 = add nsw i32 %52, %59
%61 = add nsw i32 %47, %59
%62 = sub nsw i32 %59, %56
%63 = icmp slt i32 %60, 255
%64 = select i1 %63, i32 %60, i32 255
%65 = icmp sgt i32 %64, 0
%66 = select i1 %65, i32 %64, i32 0
%67 = mul nuw nsw i64 %42, 6
%68 = add nuw nsw i64 %67, 2
%69 = getelementptr inbounds i32, i32* %36, i64 %68
store i32 %66, i32* %69
%70 = icmp slt i32 %62, 255
%71 = select i1 %70, i32 %62, i32 255
%72 = icmp sgt i32 %71, 0
%73 = select i1 %72, i32 %71, i32 0
%74 = or i64 %67, 1
%75 = getelementptr inbounds i32, i32* %36, i64 %74
store i32 %73, i32* %75
%76 = icmp slt i32 %61, 255
%77 = select i1 %76, i32 %61, i32 255
%78 = icmp sgt i32 %77, 0
%79 = select i1 %78, i32 %77, i32 0
%80 = getelementptr inbounds i32, i32* %36, i64 %67
store i32 %79, i32* %80
%81 = or i64 %57, 1
%82 = getelementptr inbounds i32, i32* %27, i64 %81
%83 = load i32, i32* %82
%84 = add nsw i32 %83, %52
%85 = add nsw i32 %83, %47
%86 = sub nsw i32 %83, %56
%87 = icmp slt i32 %84, 255
%88 = select i1 %87, i32 %84, i32 255
%89 = icmp sgt i32 %88, 0
%90 = select i1 %89, i32 %88, i32 0
%91 = add nuw nsw i64 %67, 5
%92 = getelementptr inbounds i32, i32* %36, i64 %91
store i32 %90, i32* %92
%93 = icmp slt i32 %86, 255
%94 = select i1 %93, i32 %86, i32 255
%95 = icmp sgt i32 %94, 0
%96 = select i1 %95, i32 %94, i32 0
%97 = add nuw nsw i64 %67, 4
%98 = getelementptr inbounds i32, i32* %36, i64 %97
store i32 %96, i32* %98
%99 = icmp slt i32 %85, 255
%100 = select i1 %99, i32 %85, i32 255
%101 = icmp sgt i32 %100, 0
%102 = select i1 %101, i32 %100, i32 0
%103 = add nuw nsw i64 %67, 3
%104 = getelementptr inbounds i32, i32* %36, i64 %103
store i32 %102, i32* %104
%105 = getelementptr inbounds i32, i32* %28, i64 %57
%106 = load i32, i32* %105
%107 = add nsw i32 %106, %52
%108 = add nsw i32 %106, %47
%109 = sub nsw i32 %106, %56
%110 = icmp slt i32 %107, 255
%111 = select i1 %110, i32 %107, i32 255
%112 = icmp sgt i32 %111, 0
%113 = select i1 %112, i32 %111, i32 0
%114 = getelementptr inbounds i32, i32* %37, i64 %68
store i32 %113, i32* %114
%115 = icmp slt i32 %109, 255
%116 = select i1 %115, i32 %109, i32 255
%117 = icmp sgt i32 %116, 0
%118 = select i1 %117, i32 %116, i32 0
%119 = getelementptr inbounds i32, i32* %37, i64 %74
store i32 %118, i32* %119
%120 = icmp slt i32 %108, 255
%121 = select i1 %120, i32 %108, i32 255
%122 = icmp sgt i32 %121, 0
%123 = select i1 %122, i32 %121, i32 0
%124 = getelementptr inbounds i32, i32* %37, i64 %67
store i32 %123, i32* %124
%125 = getelementptr inbounds i32, i32* %28, i64 %81
%126 = load i32, i32* %125
%127 = add nsw i32 %126, %52
%128 = add nsw i32 %126, %47
%129 = sub nsw i32 %126, %56
%130 = icmp slt i32 %127, 255
%131 = select i1 %130, i32 %127, i32 255
%132 = icmp sgt i32 %131, 0
%133 = select i1 %132, i32 %131, i32 0
%134 = getelementptr inbounds i32, i32* %37, i64 %91
store i32 %133, i32* %134
%135 = icmp slt i32 %129, 255
%136 = select i1 %135, i32 %129, i32 255
%137 = icmp sgt i32 %136, 0
%138 = select i1 %137, i32 %136, i32 0
%139 = getelementptr inbounds i32, i32* %37, i64 %97
store i32 %138, i32* %139
%140 = icmp slt i32 %128, 255
%141 = select i1 %140, i32 %128, i32 255
%142 = icmp sgt i32 %141, 0
%143 = select i1 %142, i32 %141, i32 0
%144 = getelementptr inbounds i32, i32* %37, i64 %103
store i32 %143, i32* %144
%145 = add nuw nsw i64 %42, 1
%146 = icmp eq i64 %145, %21
br i1 %146, label %38, label %41
}