#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 */
typedef struct TYPE_12__ TYPE_1__;

/* Type definitions */
struct TYPE_12__ {
  int member_0;
  int member_1;
};
typedef TYPE_1__ __m128i;

/* Variables and functions */
TYPE_1__ _mm_add_epi16(TYPE_1__, TYPE_1__);
TYPE_1__ _mm_mulhi_epu16(TYPE_1__, TYPE_1__ const);
TYPE_1__ _mm_slli_epi16(TYPE_1__, int);
extern void convert_8bit_r_g_b_vectors_to_10bit_y_vector_sse2(
    __m128i *in_3_v16i_r_g_b_vectors, __m128i *out_1_v16i_y_vector) {
  static const __m128i rYCoeffs = {0x4C8B4C8B4C8B4C8BLL, 0x4C8B4C8B4C8B4C8BLL};
  static const __m128i gYCoeffs = {0x9646964696469646LL, 0x9646964696469646LL};
  static const __m128i bYCoeffs = {0x1D2F1D2F1D2F1D2FLL, 0x1D2F1D2F1D2F1D2FLL};
  __m128i rScratch = {0x0LL, 0x0LL};
  __m128i gScratch = {0x0LL, 0x0LL};
  __m128i bScratch = {0x0LL, 0x0LL};
  (rScratch) = _mm_slli_epi16(in_3_v16i_r_g_b_vectors[0], 2);
  (gScratch) = _mm_slli_epi16(in_3_v16i_r_g_b_vectors[1], 2);
  (bScratch) = _mm_slli_epi16(in_3_v16i_r_g_b_vectors[2], 2);
  (rScratch) = _mm_mulhi_epu16((rScratch), (rYCoeffs));
  (gScratch) = _mm_mulhi_epu16((gScratch), (gYCoeffs));
  (bScratch) = _mm_mulhi_epu16((bScratch), (bYCoeffs));
  (rScratch) = _mm_add_epi16((rScratch), (gScratch));
  *out_1_v16i_y_vector = _mm_add_epi16((rScratch), (bScratch));
}


x86 assembly (clang, -O0):
<convert_8bit_r_g_b_vectors_to_10bit_y_vector_sse2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1050 <memset@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1050 <memset@plt>
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1050 <memset@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    $0x2,%esi
call   1060 <_mm_slli_epi16@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0x2,%esi
call   1060 <_mm_slli_epi16@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rdi
mov    $0x2,%esi
call   1060 <_mm_slli_epi16@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    0xe1c(%rip),%rsi
call   1040 <_mm_mulhi_epu16@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
mov    0xe08(%rip),%rsi
call   1040 <_mm_mulhi_epu16@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rdi
mov    0xdf4(%rip),%rsi
call   1040 <_mm_mulhi_epu16@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <_mm_add_epi16@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <_mm_add_epi16@plt>
mov    %rax,%rcx
mov    -0x70(%rbp),%rax
mov    %rcx,-0x68(%rbp)
mov    -0x68(%rbp),%rcx
mov    %rcx,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_8bit_r_g_b_vectors_to_10bit_y_vector_sse2>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%rdi
mov    $0x2,%esi
call   1050 <_mm_slli_epi16@plt>
mov    %rax,%r15
mov    0x8(%rbx),%rdi
mov    $0x2,%esi
call   1050 <_mm_slli_epi16@plt>
mov    %rax,%r12
mov    0x10(%rbx),%rdi
mov    $0x2,%esi
call   1050 <_mm_slli_epi16@plt>
mov    %rax,%r13
movabs $0x4c8b4c8b4c8b4c8b,%rsi
4c 8b 4c
mov    %r15,%rdi
call   1040 <_mm_mulhi_epu16@plt>
mov    %rax,%r15
movabs $0x9646964696469646,%rsi
96 46 96
mov    %r12,%rdi
call   1040 <_mm_mulhi_epu16@plt>
mov    %rax,%r12
movabs $0x1d2f1d2f1d2f1d2f,%rsi
1d 2f 1d
mov    %r13,%rdi
call   1040 <_mm_mulhi_epu16@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <_mm_add_epi16@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <_mm_add_epi16@plt>
mov    %rax,(%r14)
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_12__ = type { i32, i32 }
@convert_8bit_r_g_b_vectors_to_10bit_y_vector_sse2.rYCoeffs = internal constant %struct.TYPE_12__ { i32 1284197515, i32 1284197515 }
@convert_8bit_r_g_b_vectors_to_10bit_y_vector_sse2.gYCoeffs = internal constant %struct.TYPE_12__ { i32 -1773758906, i32 -1773758906 }
@convert_8bit_r_g_b_vectors_to_10bit_y_vector_sse2.bYCoeffs = internal constant %struct.TYPE_12__ { i32 489626927, i32 489626927 }
define void @convert_8bit_r_g_b_vectors_to_10bit_y_vector_sse2(%struct.TYPE_12__* %0, %struct.TYPE_12__* %1) {
%3 = alloca %struct.TYPE_12__*
%4 = alloca %struct.TYPE_12__*
%5 = alloca %struct.TYPE_12__
%6 = alloca %struct.TYPE_12__
%7 = alloca %struct.TYPE_12__
%8 = alloca %struct.TYPE_12__
%9 = alloca %struct.TYPE_12__
%10 = alloca %struct.TYPE_12__
%11 = alloca %struct.TYPE_12__
%12 = alloca %struct.TYPE_12__
%13 = alloca %struct.TYPE_12__
%14 = alloca %struct.TYPE_12__
%15 = alloca %struct.TYPE_12__
store %struct.TYPE_12__* %0, %struct.TYPE_12__** %3
store %struct.TYPE_12__* %1, %struct.TYPE_12__** %4
%16 = bitcast %struct.TYPE_12__* %5 to i8*
%17 = bitcast %struct.TYPE_12__* %6 to i8*
%18 = bitcast %struct.TYPE_12__* %7 to i8*
%19 = load %struct.TYPE_12__*, %struct.TYPE_12__** %3
%20 = getelementptr inbounds %struct.TYPE_12__, %struct.TYPE_12__* %19, i64 0
%21 = bitcast %struct.TYPE_12__* %20 to i64*
%22 = load i64, i64* %21
%23 = call i64 @_mm_slli_epi16(i64 %22, i32 2)
%24 = bitcast %struct.TYPE_12__* %8 to i64*
store i64 %23, i64* %24
%25 = bitcast %struct.TYPE_12__* %5 to i8*
%26 = bitcast %struct.TYPE_12__* %8 to i8*
%27 = load %struct.TYPE_12__*, %struct.TYPE_12__** %3
%28 = getelementptr inbounds %struct.TYPE_12__, %struct.TYPE_12__* %27, i64 1
%29 = bitcast %struct.TYPE_12__* %28 to i64*
%30 = load i64, i64* %29
%31 = call i64 @_mm_slli_epi16(i64 %30, i32 2)
%32 = bitcast %struct.TYPE_12__* %9 to i64*
store i64 %31, i64* %32
%33 = bitcast %struct.TYPE_12__* %6 to i8*
%34 = bitcast %struct.TYPE_12__* %9 to i8*
%35 = load %struct.TYPE_12__*, %struct.TYPE_12__** %3
%36 = getelementptr inbounds %struct.TYPE_12__, %struct.TYPE_12__* %35, i64 2
%37 = bitcast %struct.TYPE_12__* %36 to i64*
%38 = load i64, i64* %37
%39 = call i64 @_mm_slli_epi16(i64 %38, i32 2)
%40 = bitcast %struct.TYPE_12__* %10 to i64*
store i64 %39, i64* %40
%41 = bitcast %struct.TYPE_12__* %7 to i8*
%42 = bitcast %struct.TYPE_12__* %10 to i8*
%43 = bitcast %struct.TYPE_12__* %5 to i64*
%44 = load i64, i64* %43
%45 = load i64, i64* bitcast (%struct.TYPE_12__* @convert_8bit_r_g_b_vectors_to_10bit_y_vector_sse2.rYCoeffs to i64*)
%46 = call i64 @_mm_mulhi_epu16(i64 %44, i64 %45)
%47 = bitcast %struct.TYPE_12__* %11 to i64*
store i64 %46, i64* %47
%48 = bitcast %struct.TYPE_12__* %5 to i8*
%49 = bitcast %struct.TYPE_12__* %11 to i8*
%50 = bitcast %struct.TYPE_12__* %6 to i64*
%51 = load i64, i64* %50
%52 = load i64, i64* bitcast (%struct.TYPE_12__* @convert_8bit_r_g_b_vectors_to_10bit_y_vector_sse2.gYCoeffs to i64*)
%53 = call i64 @_mm_mulhi_epu16(i64 %51, i64 %52)
%54 = bitcast %struct.TYPE_12__* %12 to i64*
store i64 %53, i64* %54
%55 = bitcast %struct.TYPE_12__* %6 to i8*
%56 = bitcast %struct.TYPE_12__* %12 to i8*
%57 = bitcast %struct.TYPE_12__* %7 to i64*
%58 = load i64, i64* %57
%59 = load i64, i64* bitcast (%struct.TYPE_12__* @convert_8bit_r_g_b_vectors_to_10bit_y_vector_sse2.bYCoeffs to i64*)
%60 = call i64 @_mm_mulhi_epu16(i64 %58, i64 %59)
%61 = bitcast %struct.TYPE_12__* %13 to i64*
store i64 %60, i64* %61
%62 = bitcast %struct.TYPE_12__* %7 to i8*
%63 = bitcast %struct.TYPE_12__* %13 to i8*
%64 = bitcast %struct.TYPE_12__* %5 to i64*
%65 = load i64, i64* %64
%66 = bitcast %struct.TYPE_12__* %6 to i64*
%67 = load i64, i64* %66
%68 = call i64 @_mm_add_epi16(i64 %65, i64 %67)
%69 = bitcast %struct.TYPE_12__* %14 to i64*
store i64 %68, i64* %69
%70 = bitcast %struct.TYPE_12__* %5 to i8*
%71 = bitcast %struct.TYPE_12__* %14 to i8*
%72 = load %struct.TYPE_12__*, %struct.TYPE_12__** %4
%73 = bitcast %struct.TYPE_12__* %5 to i64*
%74 = load i64, i64* %73
%75 = bitcast %struct.TYPE_12__* %7 to i64*
%76 = load i64, i64* %75
%77 = call i64 @_mm_add_epi16(i64 %74, i64 %76)
%78 = bitcast %struct.TYPE_12__* %15 to i64*
store i64 %77, i64* %78
%79 = bitcast %struct.TYPE_12__* %72 to i8*
%80 = bitcast %struct.TYPE_12__* %15 to i8*
ret void
}

LLVM IR (-O2):
%struct.TYPE_12__ = type { i32, i32 }
define void @convert_8bit_r_g_b_vectors_to_10bit_y_vector_sse2(%struct.TYPE_12__* nocapture %0, %struct.TYPE_12__* nocapture writeonly %1) {
%3 = bitcast %struct.TYPE_12__* %0 to i64*
%4 = load i64, i64* %3
%5 = tail call i64 @_mm_slli_epi16(i64 %4, i32 2)
%6 = getelementptr inbounds %struct.TYPE_12__, %struct.TYPE_12__* %0, i64 1
%7 = bitcast %struct.TYPE_12__* %6 to i64*
%8 = load i64, i64* %7
%9 = tail call i64 @_mm_slli_epi16(i64 %8, i32 2)
%10 = getelementptr inbounds %struct.TYPE_12__, %struct.TYPE_12__* %0, i64 2
%11 = bitcast %struct.TYPE_12__* %10 to i64*
%12 = load i64, i64* %11
%13 = tail call i64 @_mm_slli_epi16(i64 %12, i32 2)
%14 = tail call i64 @_mm_mulhi_epu16(i64 %5, i64 5515586329813666955)
%15 = tail call i64 @_mm_mulhi_epu16(i64 %9, i64 -7618236489737529786)
%16 = tail call i64 @_mm_mulhi_epu16(i64 %13, i64 2102931639195606319)
%17 = tail call i64 @_mm_add_epi16(i64 %14, i64 %15)
%18 = tail call i64 @_mm_add_epi16(i64 %17, i64 %16)
%19 = bitcast %struct.TYPE_12__* %1 to i64*
store i64 %18, i64* %19
ret void
}