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

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

/* Variables and functions */
TYPE_1__ _mm_shuffle_epi32(TYPE_1__, int);
TYPE_1__ _mm_unpacklo_epi64(TYPE_1__, TYPE_1__);
extern void nnb_422_downsample_ag_rb_vectors_sse2(
    __m128i *in_4_v16i_ag_rb_vectors,
    __m128i *out_2_v16i_nnb_422_ag_rb_vectors) {
  __m128i scratch = {0x0LL, 0x0LL};
  out_2_v16i_nnb_422_ag_rb_vectors[0] =
      _mm_shuffle_epi32(in_4_v16i_ag_rb_vectors[0], 0xD8);
  (scratch) = _mm_shuffle_epi32(in_4_v16i_ag_rb_vectors[2], 0xD8);
  out_2_v16i_nnb_422_ag_rb_vectors[0] =
      _mm_unpacklo_epi64(out_2_v16i_nnb_422_ag_rb_vectors[0], (scratch));
  out_2_v16i_nnb_422_ag_rb_vectors[1] =
      _mm_shuffle_epi32(in_4_v16i_ag_rb_vectors[1], 0xD8);
  (scratch) = _mm_shuffle_epi32(in_4_v16i_ag_rb_vectors[3], 0xD8);
  out_2_v16i_nnb_422_ag_rb_vectors[1] =
      _mm_unpacklo_epi64(out_2_v16i_nnb_422_ag_rb_vectors[1], (scratch));
}


x86 assembly (clang, -O0):
<nnb_422_downsample_ag_rb_vectors_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   1030 <memset@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    $0xd8,%esi
call   1040 <_mm_shuffle_epi32@plt>
mov    %rax,%rcx
mov    -0x68(%rbp),%rax
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rdi
mov    $0xd8,%esi
call   1040 <_mm_shuffle_epi32@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <_mm_unpacklo_epi64@plt>
mov    %rax,%rcx
mov    -0x60(%rbp),%rax
mov    %rcx,-0x30(%rbp)
mov    -0x30(%rbp),%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0xd8,%esi
call   1040 <_mm_shuffle_epi32@plt>
mov    %rax,%rcx
mov    -0x58(%rbp),%rax
mov    %rcx,-0x38(%rbp)
mov    -0x38(%rbp),%rcx
mov    %rcx,0x8(%rax)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rdi
mov    $0xd8,%esi
call   1040 <_mm_shuffle_epi32@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <_mm_unpacklo_epi64@plt>
mov    %rax,%rcx
mov    -0x50(%rbp),%rax
mov    %rcx,-0x48(%rbp)
mov    -0x48(%rbp),%rcx
mov    %rcx,0x8(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nnb_422_downsample_ag_rb_vectors_sse2>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rdi),%rdi
mov    $0xd8,%esi
call   1030 <_mm_shuffle_epi32@plt>
mov    %rax,(%rbx)
mov    0x10(%r14),%rdi
mov    $0xd8,%esi
call   1030 <_mm_shuffle_epi32@plt>
mov    (%rbx),%rdi
mov    %rax,%rsi
call   1040 <_mm_unpacklo_epi64@plt>
mov    %rax,(%rbx)
mov    0x8(%r14),%rdi
mov    $0xd8,%esi
call   1030 <_mm_shuffle_epi32@plt>
mov    %rax,0x8(%rbx)
mov    0x18(%r14),%rdi
mov    $0xd8,%esi
call   1030 <_mm_shuffle_epi32@plt>
mov    0x8(%rbx),%rdi
mov    %rax,%rsi
call   1040 <_mm_unpacklo_epi64@plt>
mov    %rax,0x8(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
%struct.TYPE_9__ = type { i32, i32 }
define void @nnb_422_downsample_ag_rb_vectors_sse2(%struct.TYPE_9__* nocapture %0, %struct.TYPE_9__* nocapture %1) {
%3 = bitcast %struct.TYPE_9__* %0 to i64*
%4 = load i64, i64* %3
%5 = tail call i64 @_mm_shuffle_epi32(i64 %4, i32 216)
%6 = bitcast %struct.TYPE_9__* %1 to i64*
store i64 %5, i64* %6
%7 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %0, i64 2
%8 = bitcast %struct.TYPE_9__* %7 to i64*
%9 = load i64, i64* %8
%10 = tail call i64 @_mm_shuffle_epi32(i64 %9, i32 216)
%11 = load i64, i64* %6
%12 = tail call i64 @_mm_unpacklo_epi64(i64 %11, i64 %10)
store i64 %12, i64* %6
%13 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %0, i64 1
%14 = bitcast %struct.TYPE_9__* %13 to i64*
%15 = load i64, i64* %14
%16 = tail call i64 @_mm_shuffle_epi32(i64 %15, i32 216)
%17 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %1, i64 1
%18 = bitcast %struct.TYPE_9__* %17 to i64*
store i64 %16, i64* %18
%19 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %0, i64 3
%20 = bitcast %struct.TYPE_9__* %19 to i64*
%21 = load i64, i64* %20
%22 = tail call i64 @_mm_shuffle_epi32(i64 %21, i32 216)
%23 = load i64, i64* %18
%24 = tail call i64 @_mm_unpacklo_epi64(i64 %23, i64 %22)
store i64 %24, i64* %18
ret void
}