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

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ YUV444toRGB888(unsigned char, unsigned char, unsigned char,
                                  unsigned char *);
void YUV422ToRGB24(int width, int height, const void *voidSrc, void *voidDst) {
  int i;
  unsigned char *dest = (unsigned char *)voidDst;
  unsigned char *src = (unsigned char *)voidSrc;
  unsigned char u, y1, v, y2;
  const unsigned int widthTimesHeight = width * height;
  for (i = 0; i < widthTimesHeight; i += 2) {
    u = *src++;
    y1 = *src++;
    v = *src++;
    y2 = *src++;
    YUV444toRGB888(y1, u, v, dest);
    dest += 3;
    YUV444toRGB888(y2, u, v, dest);
    dest += 3;
  }
}


x86 assembly (clang, -O0):
<YUV422ToRGB24>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x38(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x38(%rbp),%eax
jae    1203 <YUV422ToRGB24+0xf3>
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
mov    (%rax),%al
mov    %al,-0x31(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
mov    (%rax),%al
mov    %al,-0x32(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
mov    (%rax),%al
mov    %al,-0x33(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
mov    (%rax),%al
mov    %al,-0x34(%rbp)
mov    -0x32(%rbp),%sil
mov    -0x31(%rbp),%dl
mov    -0x33(%rbp),%al
mov    -0x28(%rbp),%rcx
movzbl %sil,%edi
movzbl %dl,%esi
movzbl %al,%edx
call   1030 <YUV444toRGB888@plt>
mov    -0x28(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x28(%rbp)
mov    -0x34(%rbp),%sil
mov    -0x31(%rbp),%dl
mov    -0x33(%rbp),%al
mov    -0x28(%rbp),%rcx
movzbl %sil,%edi
movzbl %dl,%esi
movzbl %al,%edx
call   1030 <YUV444toRGB888@plt>
mov    -0x28(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1c(%rbp)
jmp    1147 <YUV422ToRGB24+0x37>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<YUV422ToRGB24>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
imul   %esi,%edi
test   %edi,%edi
je     1176 <YUV422ToRGB24+0x66>
mov    %rcx,%rbx
mov    %rdx,%r14
xor    %r15d,%r15d
mov    %edi,0x4(%rsp)
nop
movzbl (%r14,%r15,2),%r12d
movzbl 0x1(%r14,%r15,2),%edi
movzbl 0x2(%r14,%r15,2),%ebp
movzbl 0x3(%r14,%r15,2),%r13d
mov    %r12d,%esi
mov    %ebp,%edx
mov    %rbx,%rcx
call   1030 <YUV444toRGB888@plt>
lea    0x3(%rbx),%rcx
mov    %r13d,%edi
mov    %r12d,%esi
mov    %ebp,%edx
call   1030 <YUV444toRGB888@plt>
mov    0x4(%rsp),%edi
add    $0x2,%r15
add    $0x6,%rbx
cmp    %edi,%r15d
jb     1130 <YUV422ToRGB24+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @YUV422ToRGB24(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8
%13 = alloca i8
%14 = alloca i8
%15 = alloca i8
%16 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%17 = load i8*, i8** %8
store i8* %17, i8** %10
%18 = load i8*, i8** %7
store i8* %18, i8** %11
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = mul nsw i32 %19, %20
store i32 %21, i32* %16
store i32 0, i32* %9
br label %22
22: ; preds = %53, %4
%23 = load i32, i32* %9
%24 = load i32, i32* %16
%25 = icmp ult i32 %23, %24
br i1 %25, label %26, label %56
26: ; preds = %22
%27 = load i8*, i8** %11
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %11
%29 = load i8, i8* %27
store i8 %29, i8* %12
%30 = load i8*, i8** %11
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %11
%32 = load i8, i8* %30
store i8 %32, i8* %13
%33 = load i8*, i8** %11
%34 = getelementptr inbounds i8, i8* %33, i32 1
store i8* %34, i8** %11
%35 = load i8, i8* %33
store i8 %35, i8* %14
%36 = load i8*, i8** %11
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %11
%38 = load i8, i8* %36
store i8 %38, i8* %15
%39 = load i8, i8* %13
%40 = load i8, i8* %12
%41 = load i8, i8* %14
%42 = load i8*, i8** %10
%43 = call i32 @YUV444toRGB888(i8 zeroext %39, i8 zeroext %40, i8 zeroext %41, i8* %42)
%44 = load i8*, i8** %10
%45 = getelementptr inbounds i8, i8* %44, i64 3
store i8* %45, i8** %10
%46 = load i8, i8* %15
%47 = load i8, i8* %12
%48 = load i8, i8* %14
%49 = load i8*, i8** %10
%50 = call i32 @YUV444toRGB888(i8 zeroext %46, i8 zeroext %47, i8 zeroext %48, i8* %49)
%51 = load i8*, i8** %10
%52 = getelementptr inbounds i8, i8* %51, i64 3
store i8* %52, i8** %10
br label %53
53: ; preds = %26
%54 = load i32, i32* %9
%55 = add nsw i32 %54, 2
store i32 %55, i32* %9
br label %22
56: ; preds = %22
ret void
}

LLVM IR (-O2):
define void @YUV422ToRGB24(i32 %0, i32 %1, i8* nocapture %2, i8* %3) {
%5 = mul nsw i32 %1, %0
%6 = icmp eq i32 %5, 0
br i1 %6, label %25, label %7
7: ; preds = %4, %7
%8 = phi i32 [ %23, %7 ], [ 0, %4 ]
%9 = phi i8* [ %22, %7 ], [ %3, %4 ]
%10 = phi i8* [ %17, %7 ], [ %2, %4 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %10
%13 = getelementptr inbounds i8, i8* %10, i64 2
%14 = load i8, i8* %11
%15 = getelementptr inbounds i8, i8* %10, i64 3
%16 = load i8, i8* %13
%17 = getelementptr inbounds i8, i8* %10, i64 4
%18 = load i8, i8* %15
%19 = tail call i32 @YUV444toRGB888(i8 zeroext %14, i8 zeroext %12, i8 zeroext %16, i8* %9)
%20 = getelementptr inbounds i8, i8* %9, i64 3
%21 = tail call i32 @YUV444toRGB888(i8 zeroext %18, i8 zeroext %12, i8 zeroext %16, i8* %20)
%22 = getelementptr inbounds i8, i8* %9, i64 6
%23 = add nuw nsw i32 %8, 2
%24 = icmp ult i32 %23, %5
br i1 %24, label %7, label %25
25: ; preds = %7, %4
ret void
}