#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*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_add_epi16(int /*<<< orphan*/ const,
                                 int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_adds_epu16(int /*<<< orphan*/ const,
                                  int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_mulhi_epu16(int /*<<< orphan*/ const,
                                   int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_set1_epi16(int);
int /*<<< orphan*/ _mm_srai_epi16(int /*<<< orphan*/ const, int);
int /*<<< orphan*/ _mm_srli_epi16(int /*<<< orphan*/ const, int);
int /*<<< orphan*/ _mm_sub_epi16(int /*<<< orphan*/ const,
                                 int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_subs_epu16(int /*<<< orphan*/ const,
                                  int /*<<< orphan*/ const);
void ConvertYUV444ToRGB_SSE2(const __m128i *const Y0, const __m128i *const U0,
                             const __m128i *const V0, __m128i *const R,
                             __m128i *const G, __m128i *const B) {
  const __m128i k19077 = _mm_set1_epi16(19077);
  const __m128i k26149 = _mm_set1_epi16(26149);
  const __m128i k14234 = _mm_set1_epi16(14234);
  const __m128i k33050 = _mm_set1_epi16((short)33050);
  const __m128i k17685 = _mm_set1_epi16(17685);
  const __m128i k6419 = _mm_set1_epi16(6419);
  const __m128i k13320 = _mm_set1_epi16(13320);
  const __m128i k8708 = _mm_set1_epi16(8708);
  const __m128i Y1 = _mm_mulhi_epu16(*Y0, k19077);
  const __m128i R0 = _mm_mulhi_epu16(*V0, k26149);
  const __m128i R1 = _mm_sub_epi16(Y1, k14234);
  const __m128i R2 = _mm_add_epi16(R1, R0);
  const __m128i G0 = _mm_mulhi_epu16(*U0, k6419);
  const __m128i G1 = _mm_mulhi_epu16(*V0, k13320);
  const __m128i G2 = _mm_add_epi16(Y1, k8708);
  const __m128i G3 = _mm_add_epi16(G0, G1);
  const __m128i G4 = _mm_sub_epi16(G2, G3);
  const __m128i B0 = _mm_mulhi_epu16(*U0, k33050);
  const __m128i B1 = _mm_adds_epu16(B0, Y1);
  const __m128i B2 = _mm_subs_epu16(B1, k17685);
  *R = _mm_srai_epi16(R2, 6);
  *G = _mm_srai_epi16(G4, 6);
  *B = _mm_srli_epi16(B2, 6);
}


x86 assembly (clang, -O0):
<ConvertYUV444ToRGB_SSE2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    $0x4a85,%edi
call   1080 <_mm_set1_epi16@plt>
mov    %eax,-0x34(%rbp)
mov    $0x6625,%edi
call   1080 <_mm_set1_epi16@plt>
mov    %eax,-0x38(%rbp)
mov    $0x379a,%edi
call   1080 <_mm_set1_epi16@plt>
mov    %eax,-0x3c(%rbp)
mov    $0xffff811a,%edi
call   1080 <_mm_set1_epi16@plt>
mov    %eax,-0x40(%rbp)
mov    $0x4515,%edi
call   1080 <_mm_set1_epi16@plt>
mov    %eax,-0x44(%rbp)
mov    $0x1913,%edi
call   1080 <_mm_set1_epi16@plt>
mov    %eax,-0x48(%rbp)
mov    $0x3408,%edi
call   1080 <_mm_set1_epi16@plt>
mov    %eax,-0x4c(%rbp)
mov    $0x2204,%edi
call   1080 <_mm_set1_epi16@plt>
mov    %eax,-0x50(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x34(%rbp),%esi
call   1060 <_mm_mulhi_epu16@plt>
mov    %eax,-0x54(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%esi
call   1060 <_mm_mulhi_epu16@plt>
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%edi
mov    -0x3c(%rbp),%esi
call   1040 <_mm_sub_epi16@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x5c(%rbp),%edi
mov    -0x58(%rbp),%esi
call   1030 <_mm_add_epi16@plt>
mov    %eax,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%esi
call   1060 <_mm_mulhi_epu16@plt>
mov    %eax,-0x64(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    -0x4c(%rbp),%esi
call   1060 <_mm_mulhi_epu16@plt>
mov    %eax,-0x68(%rbp)
mov    -0x54(%rbp),%edi
mov    -0x50(%rbp),%esi
call   1030 <_mm_add_epi16@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x64(%rbp),%edi
mov    -0x68(%rbp),%esi
call   1030 <_mm_add_epi16@plt>
mov    %eax,-0x70(%rbp)
mov    -0x6c(%rbp),%edi
mov    -0x70(%rbp),%esi
call   1040 <_mm_sub_epi16@plt>
mov    %eax,-0x74(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%esi
call   1060 <_mm_mulhi_epu16@plt>
mov    %eax,-0x78(%rbp)
mov    -0x78(%rbp),%edi
mov    -0x54(%rbp),%esi
call   1070 <_mm_adds_epu16@plt>
mov    %eax,-0x7c(%rbp)
mov    -0x7c(%rbp),%edi
mov    -0x44(%rbp),%esi
call   1090 <_mm_subs_epu16@plt>
mov    %eax,-0x80(%rbp)
mov    -0x60(%rbp),%edi
mov    $0x6,%esi
call   10a0 <_mm_srai_epi16@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x74(%rbp),%edi
mov    $0x6,%esi
call   10a0 <_mm_srai_epi16@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x80(%rbp),%edi
mov    $0x6,%esi
call   1050 <_mm_srli_epi16@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConvertYUV444ToRGB_SSE2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,0x30(%rsp)
mov    %r8,0x28(%rsp)
mov    %rcx,0x20(%rsp)
mov    %rdx,%r13
mov    %rsi,0x18(%rsp)
mov    %rdi,%r15
mov    $0x4a85,%edi
call   1080 <_mm_set1_epi16@plt>
mov    %eax,%r14d
mov    $0x6625,%edi
call   1080 <_mm_set1_epi16@plt>
mov    %eax,%r12d
mov    $0x379a,%edi
call   1080 <_mm_set1_epi16@plt>
mov    %eax,0x4(%rsp)
mov    $0xffff811a,%edi
call   1080 <_mm_set1_epi16@plt>
mov    %eax,0x10(%rsp)
mov    $0x4515,%edi
call   1080 <_mm_set1_epi16@plt>
mov    %eax,0x14(%rsp)
mov    $0x1913,%edi
call   1080 <_mm_set1_epi16@plt>
mov    %eax,%ebp
mov    $0x3408,%edi
call   1080 <_mm_set1_epi16@plt>
mov    %eax,0xc(%rsp)
mov    $0x2204,%edi
call   1080 <_mm_set1_epi16@plt>
mov    %eax,0x8(%rsp)
mov    (%r15),%edi
mov    %r14d,%esi
call   1060 <_mm_mulhi_epu16@plt>
mov    %eax,%r15d
mov    0x0(%r13),%edi
mov    %r12d,%esi
call   1060 <_mm_mulhi_epu16@plt>
mov    %eax,%ebx
mov    %r15d,%edi
mov    0x4(%rsp),%esi
call   1040 <_mm_sub_epi16@plt>
mov    %eax,%edi
mov    %ebx,%esi
call   1030 <_mm_add_epi16@plt>
mov    %eax,0x4(%rsp)
mov    0x18(%rsp),%r14
mov    (%r14),%edi
mov    %ebp,%esi
call   1060 <_mm_mulhi_epu16@plt>
mov    %eax,%r12d
mov    0x0(%r13),%edi
mov    0xc(%rsp),%esi
call   1060 <_mm_mulhi_epu16@plt>
mov    %eax,%ebp
mov    %r15d,%edi
mov    0x8(%rsp),%esi
call   1030 <_mm_add_epi16@plt>
mov    %eax,%ebx
mov    %r12d,%edi
mov    %ebp,%esi
call   1030 <_mm_add_epi16@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <_mm_sub_epi16@plt>
mov    %eax,%ebx
mov    (%r14),%edi
mov    0x10(%rsp),%esi
call   1060 <_mm_mulhi_epu16@plt>
mov    %eax,%edi
mov    %r15d,%esi
call   1070 <_mm_adds_epu16@plt>
mov    %eax,%edi
mov    0x14(%rsp),%esi
call   1090 <_mm_subs_epu16@plt>
mov    %eax,%ebp
mov    0x4(%rsp),%edi
mov    $0x6,%esi
call   10a0 <_mm_srai_epi16@plt>
mov    0x20(%rsp),%rcx
mov    %eax,(%rcx)
mov    %ebx,%edi
mov    $0x6,%esi
call   10a0 <_mm_srai_epi16@plt>
mov    0x28(%rsp),%rcx
mov    %eax,(%rcx)
mov    %ebp,%edi
mov    $0x6,%esi
call   1050 <_mm_srli_epi16@plt>
mov    0x30(%rsp),%rcx
mov    %eax,(%rcx)
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @ConvertYUV444ToRGB_SSE2(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
%30 = alloca i32
%31 = alloca i32
%32 = 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
%33 = call i32 @_mm_set1_epi16(i32 19077)
store i32 %33, i32* %13
%34 = call i32 @_mm_set1_epi16(i32 26149)
store i32 %34, i32* %14
%35 = call i32 @_mm_set1_epi16(i32 14234)
store i32 %35, i32* %15
%36 = call i32 @_mm_set1_epi16(i32 -32486)
store i32 %36, i32* %16
%37 = call i32 @_mm_set1_epi16(i32 17685)
store i32 %37, i32* %17
%38 = call i32 @_mm_set1_epi16(i32 6419)
store i32 %38, i32* %18
%39 = call i32 @_mm_set1_epi16(i32 13320)
store i32 %39, i32* %19
%40 = call i32 @_mm_set1_epi16(i32 8708)
store i32 %40, i32* %20
%41 = load i32*, i32** %7
%42 = load i32, i32* %41
%43 = load i32, i32* %13
%44 = call i32 @_mm_mulhi_epu16(i32 %42, i32 %43)
store i32 %44, i32* %21
%45 = load i32*, i32** %9
%46 = load i32, i32* %45
%47 = load i32, i32* %14
%48 = call i32 @_mm_mulhi_epu16(i32 %46, i32 %47)
store i32 %48, i32* %22
%49 = load i32, i32* %21
%50 = load i32, i32* %15
%51 = call i32 @_mm_sub_epi16(i32 %49, i32 %50)
store i32 %51, i32* %23
%52 = load i32, i32* %23
%53 = load i32, i32* %22
%54 = call i32 @_mm_add_epi16(i32 %52, i32 %53)
store i32 %54, i32* %24
%55 = load i32*, i32** %8
%56 = load i32, i32* %55
%57 = load i32, i32* %18
%58 = call i32 @_mm_mulhi_epu16(i32 %56, i32 %57)
store i32 %58, i32* %25
%59 = load i32*, i32** %9
%60 = load i32, i32* %59
%61 = load i32, i32* %19
%62 = call i32 @_mm_mulhi_epu16(i32 %60, i32 %61)
store i32 %62, i32* %26
%63 = load i32, i32* %21
%64 = load i32, i32* %20
%65 = call i32 @_mm_add_epi16(i32 %63, i32 %64)
store i32 %65, i32* %27
%66 = load i32, i32* %25
%67 = load i32, i32* %26
%68 = call i32 @_mm_add_epi16(i32 %66, i32 %67)
store i32 %68, i32* %28
%69 = load i32, i32* %27
%70 = load i32, i32* %28
%71 = call i32 @_mm_sub_epi16(i32 %69, i32 %70)
store i32 %71, i32* %29
%72 = load i32*, i32** %8
%73 = load i32, i32* %72
%74 = load i32, i32* %16
%75 = call i32 @_mm_mulhi_epu16(i32 %73, i32 %74)
store i32 %75, i32* %30
%76 = load i32, i32* %30
%77 = load i32, i32* %21
%78 = call i32 @_mm_adds_epu16(i32 %76, i32 %77)
store i32 %78, i32* %31
%79 = load i32, i32* %31
%80 = load i32, i32* %17
%81 = call i32 @_mm_subs_epu16(i32 %79, i32 %80)
store i32 %81, i32* %32
%82 = load i32, i32* %24
%83 = call i32 @_mm_srai_epi16(i32 %82, i32 6)
%84 = load i32*, i32** %10
store i32 %83, i32* %84
%85 = load i32, i32* %29
%86 = call i32 @_mm_srai_epi16(i32 %85, i32 6)
%87 = load i32*, i32** %11
store i32 %86, i32* %87
%88 = load i32, i32* %32
%89 = call i32 @_mm_srli_epi16(i32 %88, i32 6)
%90 = load i32*, i32** %12
store i32 %89, i32* %90
ret void
}

LLVM IR (-O2):
define void @ConvertYUV444ToRGB_SSE2(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4, i32* nocapture writeonly %5) {
%7 = tail call i32 @_mm_set1_epi16(i32 19077)
%8 = tail call i32 @_mm_set1_epi16(i32 26149)
%9 = tail call i32 @_mm_set1_epi16(i32 14234)
%10 = tail call i32 @_mm_set1_epi16(i32 -32486)
%11 = tail call i32 @_mm_set1_epi16(i32 17685)
%12 = tail call i32 @_mm_set1_epi16(i32 6419)
%13 = tail call i32 @_mm_set1_epi16(i32 13320)
%14 = tail call i32 @_mm_set1_epi16(i32 8708)
%15 = load i32, i32* %0
%16 = tail call i32 @_mm_mulhi_epu16(i32 %15, i32 %7)
%17 = load i32, i32* %2
%18 = tail call i32 @_mm_mulhi_epu16(i32 %17, i32 %8)
%19 = tail call i32 @_mm_sub_epi16(i32 %16, i32 %9)
%20 = tail call i32 @_mm_add_epi16(i32 %19, i32 %18)
%21 = load i32, i32* %1
%22 = tail call i32 @_mm_mulhi_epu16(i32 %21, i32 %12)
%23 = load i32, i32* %2
%24 = tail call i32 @_mm_mulhi_epu16(i32 %23, i32 %13)
%25 = tail call i32 @_mm_add_epi16(i32 %16, i32 %14)
%26 = tail call i32 @_mm_add_epi16(i32 %22, i32 %24)
%27 = tail call i32 @_mm_sub_epi16(i32 %25, i32 %26)
%28 = load i32, i32* %1
%29 = tail call i32 @_mm_mulhi_epu16(i32 %28, i32 %10)
%30 = tail call i32 @_mm_adds_epu16(i32 %29, i32 %16)
%31 = tail call i32 @_mm_subs_epu16(i32 %30, i32 %11)
%32 = tail call i32 @_mm_srai_epi16(i32 %20, i32 6)
store i32 %32, i32* %3
%33 = tail call i32 @_mm_srai_epi16(i32 %27, i32 6)
store i32 %33, i32* %4
%34 = tail call i32 @_mm_srli_epi16(i32 %31, i32 6)
store i32 %34, i32* %5
ret void
}