#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_18__ TYPE_1__;

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

/* Variables and functions */
TYPE_1__ _mm_add_epi16(TYPE_1__, TYPE_1__ const);
TYPE_1__ _mm_add_epi32(TYPE_1__, TYPE_1__);
TYPE_1__ _mm_madd_epi16(TYPE_1__, TYPE_1__ const);
TYPE_1__ _mm_packs_epi32(TYPE_1__, TYPE_1__);
TYPE_1__ _mm_srli_epi32(TYPE_1__, int);
extern void
convert_ga_br_vectors_to_y_vector_bt601_sse2(__m128i *in_4_v16i_ga_br_vectors,
                                             __m128i *out_1_v16i_y_vector) {
  static const __m128i gaYCoeffs = {0x0000408300004083LL, 0x0000408300004083LL};
  static const __m128i brYCoeffs = {0x20E50C8B20E50C8BLL, 0x20E50C8B20E50C8BLL};
  static const __m128i resultOffset = {0x0010001000100010LL,
                                       0x0010001000100010LL};
  __m128i y1Scratch = {0x0LL, 0x0LL};
  __m128i y2Scratch = {0x0LL, 0x0LL};
  __m128i scratch = {0x0LL, 0x0LL};
  (y1Scratch) = _mm_madd_epi16(in_4_v16i_ga_br_vectors[0], (gaYCoeffs));
  (scratch) = _mm_madd_epi16(in_4_v16i_ga_br_vectors[1], (brYCoeffs));
  (y1Scratch) = _mm_add_epi32((y1Scratch), (scratch));
  (y1Scratch) = _mm_srli_epi32((y1Scratch), 15);
  (y2Scratch) = _mm_madd_epi16(in_4_v16i_ga_br_vectors[2], (gaYCoeffs));
  (scratch) = _mm_madd_epi16(in_4_v16i_ga_br_vectors[3], (brYCoeffs));
  (y2Scratch) = _mm_add_epi32((y2Scratch), (scratch));
  (y2Scratch) = _mm_srli_epi32((y2Scratch), 15);
  (y1Scratch) = _mm_packs_epi32((y1Scratch), (y2Scratch));
  *out_1_v16i_y_vector = _mm_add_epi16((y1Scratch), (resultOffset));
}


x86 assembly (clang, -O0):
<convert_ga_br_vectors_to_y_vector_bt601_sse2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1060 <memset@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1060 <memset@plt>
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1060 <memset@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    0xe4f(%rip),%rsi
call   1070 <_mm_madd_epi16@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0xe37(%rip),%rsi
call   1070 <_mm_madd_epi16@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <_mm_add_epi32@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0xf,%esi
call   1080 <_mm_srli_epi32@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0xddc(%rip),%rsi
call   1070 <_mm_madd_epi16@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rdi
mov    0xdc4(%rip),%rsi
call   1070 <_mm_madd_epi16@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <_mm_add_epi32@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0xf,%esi
call   1080 <_mm_srli_epi32@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <_mm_packs_epi32@plt>
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x18(%rbp),%rdi
mov    0xd5c(%rip),%rsi
call   1030 <_mm_add_epi16@plt>
mov    %rax,%rcx
mov    -0x80(%rbp),%rax
mov    %rcx,-0x78(%rbp)
mov    -0x78(%rbp),%rcx
mov    %rcx,(%rax)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_ga_br_vectors_to_y_vector_bt601_sse2>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%rdi
movabs $0x408300004083,%r15
mov    %r15,%rsi
call   1060 <_mm_madd_epi16@plt>
mov    %rax,%r12
mov    0x8(%rbx),%rdi
movabs $0x20e50c8b20e50c8b,%r13
0c e5 20
mov    %r13,%rsi
call   1060 <_mm_madd_epi16@plt>
mov    %r12,%rdi
mov    %rax,%rsi
call   1050 <_mm_add_epi32@plt>
mov    %rax,%rdi
mov    $0xf,%esi
call   1070 <_mm_srli_epi32@plt>
mov    %rax,%r12
mov    0x10(%rbx),%rdi
mov    %r15,%rsi
call   1060 <_mm_madd_epi16@plt>
mov    %rax,%r15
mov    0x18(%rbx),%rdi
mov    %r13,%rsi
call   1060 <_mm_madd_epi16@plt>
mov    %r15,%rdi
mov    %rax,%rsi
call   1050 <_mm_add_epi32@plt>
mov    %rax,%rdi
mov    $0xf,%esi
call   1070 <_mm_srli_epi32@plt>
mov    %r12,%rdi
mov    %rax,%rsi
call   1040 <_mm_packs_epi32@plt>
movabs $0x10001000100010,%rsi
mov    %rax,%rdi
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_18__ = type { i32, i32 }
@convert_ga_br_vectors_to_y_vector_bt601_sse2.gaYCoeffs = internal constant %struct.TYPE_18__ { i32 16515, i32 16515 }
@convert_ga_br_vectors_to_y_vector_bt601_sse2.brYCoeffs = internal constant %struct.TYPE_18__ { i32 551881867, i32 551881867 }
@convert_ga_br_vectors_to_y_vector_bt601_sse2.resultOffset = internal constant %struct.TYPE_18__ { i32 1048592, i32 1048592 }
define void @convert_ga_br_vectors_to_y_vector_bt601_sse2(%struct.TYPE_18__* %0, %struct.TYPE_18__* %1) {
%3 = alloca %struct.TYPE_18__*
%4 = alloca %struct.TYPE_18__*
%5 = alloca %struct.TYPE_18__
%6 = alloca %struct.TYPE_18__
%7 = alloca %struct.TYPE_18__
%8 = alloca %struct.TYPE_18__
%9 = alloca %struct.TYPE_18__
%10 = alloca %struct.TYPE_18__
%11 = alloca %struct.TYPE_18__
%12 = alloca %struct.TYPE_18__
%13 = alloca %struct.TYPE_18__
%14 = alloca %struct.TYPE_18__
%15 = alloca %struct.TYPE_18__
%16 = alloca %struct.TYPE_18__
%17 = alloca %struct.TYPE_18__
store %struct.TYPE_18__* %0, %struct.TYPE_18__** %3
store %struct.TYPE_18__* %1, %struct.TYPE_18__** %4
%18 = bitcast %struct.TYPE_18__* %5 to i8*
%19 = bitcast %struct.TYPE_18__* %6 to i8*
%20 = bitcast %struct.TYPE_18__* %7 to i8*
%21 = load %struct.TYPE_18__*, %struct.TYPE_18__** %3
%22 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %21, i64 0
%23 = bitcast %struct.TYPE_18__* %22 to i64*
%24 = load i64, i64* %23
%25 = load i64, i64* bitcast (%struct.TYPE_18__* @convert_ga_br_vectors_to_y_vector_bt601_sse2.gaYCoeffs to i64*)
%26 = call i64 @_mm_madd_epi16(i64 %24, i64 %25)
%27 = bitcast %struct.TYPE_18__* %8 to i64*
store i64 %26, i64* %27
%28 = bitcast %struct.TYPE_18__* %5 to i8*
%29 = bitcast %struct.TYPE_18__* %8 to i8*
%30 = load %struct.TYPE_18__*, %struct.TYPE_18__** %3
%31 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %30, i64 1
%32 = bitcast %struct.TYPE_18__* %31 to i64*
%33 = load i64, i64* %32
%34 = load i64, i64* bitcast (%struct.TYPE_18__* @convert_ga_br_vectors_to_y_vector_bt601_sse2.brYCoeffs to i64*)
%35 = call i64 @_mm_madd_epi16(i64 %33, i64 %34)
%36 = bitcast %struct.TYPE_18__* %9 to i64*
store i64 %35, i64* %36
%37 = bitcast %struct.TYPE_18__* %7 to i8*
%38 = bitcast %struct.TYPE_18__* %9 to i8*
%39 = bitcast %struct.TYPE_18__* %5 to i64*
%40 = load i64, i64* %39
%41 = bitcast %struct.TYPE_18__* %7 to i64*
%42 = load i64, i64* %41
%43 = call i64 @_mm_add_epi32(i64 %40, i64 %42)
%44 = bitcast %struct.TYPE_18__* %10 to i64*
store i64 %43, i64* %44
%45 = bitcast %struct.TYPE_18__* %5 to i8*
%46 = bitcast %struct.TYPE_18__* %10 to i8*
%47 = bitcast %struct.TYPE_18__* %5 to i64*
%48 = load i64, i64* %47
%49 = call i64 @_mm_srli_epi32(i64 %48, i32 15)
%50 = bitcast %struct.TYPE_18__* %11 to i64*
store i64 %49, i64* %50
%51 = bitcast %struct.TYPE_18__* %5 to i8*
%52 = bitcast %struct.TYPE_18__* %11 to i8*
%53 = load %struct.TYPE_18__*, %struct.TYPE_18__** %3
%54 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %53, i64 2
%55 = bitcast %struct.TYPE_18__* %54 to i64*
%56 = load i64, i64* %55
%57 = load i64, i64* bitcast (%struct.TYPE_18__* @convert_ga_br_vectors_to_y_vector_bt601_sse2.gaYCoeffs to i64*)
%58 = call i64 @_mm_madd_epi16(i64 %56, i64 %57)
%59 = bitcast %struct.TYPE_18__* %12 to i64*
store i64 %58, i64* %59
%60 = bitcast %struct.TYPE_18__* %6 to i8*
%61 = bitcast %struct.TYPE_18__* %12 to i8*
%62 = load %struct.TYPE_18__*, %struct.TYPE_18__** %3
%63 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %62, i64 3
%64 = bitcast %struct.TYPE_18__* %63 to i64*
%65 = load i64, i64* %64
%66 = load i64, i64* bitcast (%struct.TYPE_18__* @convert_ga_br_vectors_to_y_vector_bt601_sse2.brYCoeffs to i64*)
%67 = call i64 @_mm_madd_epi16(i64 %65, i64 %66)
%68 = bitcast %struct.TYPE_18__* %13 to i64*
store i64 %67, i64* %68
%69 = bitcast %struct.TYPE_18__* %7 to i8*
%70 = bitcast %struct.TYPE_18__* %13 to i8*
%71 = bitcast %struct.TYPE_18__* %6 to i64*
%72 = load i64, i64* %71
%73 = bitcast %struct.TYPE_18__* %7 to i64*
%74 = load i64, i64* %73
%75 = call i64 @_mm_add_epi32(i64 %72, i64 %74)
%76 = bitcast %struct.TYPE_18__* %14 to i64*
store i64 %75, i64* %76
%77 = bitcast %struct.TYPE_18__* %6 to i8*
%78 = bitcast %struct.TYPE_18__* %14 to i8*
%79 = bitcast %struct.TYPE_18__* %6 to i64*
%80 = load i64, i64* %79
%81 = call i64 @_mm_srli_epi32(i64 %80, i32 15)
%82 = bitcast %struct.TYPE_18__* %15 to i64*
store i64 %81, i64* %82
%83 = bitcast %struct.TYPE_18__* %6 to i8*
%84 = bitcast %struct.TYPE_18__* %15 to i8*
%85 = bitcast %struct.TYPE_18__* %5 to i64*
%86 = load i64, i64* %85
%87 = bitcast %struct.TYPE_18__* %6 to i64*
%88 = load i64, i64* %87
%89 = call i64 @_mm_packs_epi32(i64 %86, i64 %88)
%90 = bitcast %struct.TYPE_18__* %16 to i64*
store i64 %89, i64* %90
%91 = bitcast %struct.TYPE_18__* %5 to i8*
%92 = bitcast %struct.TYPE_18__* %16 to i8*
%93 = load %struct.TYPE_18__*, %struct.TYPE_18__** %4
%94 = bitcast %struct.TYPE_18__* %5 to i64*
%95 = load i64, i64* %94
%96 = load i64, i64* bitcast (%struct.TYPE_18__* @convert_ga_br_vectors_to_y_vector_bt601_sse2.resultOffset to i64*)
%97 = call i64 @_mm_add_epi16(i64 %95, i64 %96)
%98 = bitcast %struct.TYPE_18__* %17 to i64*
store i64 %97, i64* %98
%99 = bitcast %struct.TYPE_18__* %93 to i8*
%100 = bitcast %struct.TYPE_18__* %17 to i8*
ret void
}

LLVM IR (-O2):
%struct.TYPE_18__ = type { i32, i32 }
define void @convert_ga_br_vectors_to_y_vector_bt601_sse2(%struct.TYPE_18__* nocapture %0, %struct.TYPE_18__* nocapture writeonly %1) {
%3 = bitcast %struct.TYPE_18__* %0 to i64*
%4 = load i64, i64* %3
%5 = tail call i64 @_mm_madd_epi16(i64 %4, i64 70931384909955)
%6 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %0, i64 1
%7 = bitcast %struct.TYPE_18__* %6 to i64*
%8 = load i64, i64* %7
%9 = tail call i64 @_mm_madd_epi16(i64 %8, i64 2370314570572303499)
%10 = tail call i64 @_mm_add_epi32(i64 %5, i64 %9)
%11 = tail call i64 @_mm_srli_epi32(i64 %10, i32 15)
%12 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %0, i64 2
%13 = bitcast %struct.TYPE_18__* %12 to i64*
%14 = load i64, i64* %13
%15 = tail call i64 @_mm_madd_epi16(i64 %14, i64 70931384909955)
%16 = getelementptr inbounds %struct.TYPE_18__, %struct.TYPE_18__* %0, i64 3
%17 = bitcast %struct.TYPE_18__* %16 to i64*
%18 = load i64, i64* %17
%19 = tail call i64 @_mm_madd_epi16(i64 %18, i64 2370314570572303499)
%20 = tail call i64 @_mm_add_epi32(i64 %15, i64 %19)
%21 = tail call i64 @_mm_srli_epi32(i64 %20, i32 15)
%22 = tail call i64 @_mm_packs_epi32(i64 %11, i64 %21)
%23 = tail call i64 @_mm_add_epi16(i64 %22, i64 4503668347895824)
%24 = bitcast %struct.TYPE_18__* %1 to i64*
store i64 %23, i64* %24
ret void
}