#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*/ int16_t;
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_load_si128(int /*<<< orphan*/ const *);
int /*<<< orphan*/ _mm_set1_epi16(int);
int /*<<< orphan*/ _mm_shuffle_epi8(int /*<<< orphan*/ const,
                                    int /*<<< orphan*/);
void shuffle_filter_ssse3(const int16_t *const filter, __m128i *const f) {
  const __m128i f_values = _mm_load_si128((const __m128i *)filter);
  f[0] = _mm_shuffle_epi8(f_values, _mm_set1_epi16(0x0200u));
  f[1] = _mm_shuffle_epi8(f_values, _mm_set1_epi16(0x0604u));
  f[2] = _mm_shuffle_epi8(f_values, _mm_set1_epi16(0x0a08u));
  f[3] = _mm_shuffle_epi8(f_values, _mm_set1_epi16(0x0e0cu));
}


x86 assembly (clang, -O0):
<shuffle_filter_ssse3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <_mm_load_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    $0x200,%edi
call   1050 <_mm_set1_epi16@plt>
mov    -0x24(%rbp),%edi
mov    %eax,%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    $0x604,%edi
call   1050 <_mm_set1_epi16@plt>
mov    -0x20(%rbp),%edi
mov    %eax,%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    $0xa08,%edi
call   1050 <_mm_set1_epi16@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0xe0c,%edi
call   1050 <_mm_set1_epi16@plt>
mov    -0x18(%rbp),%edi
mov    %eax,%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0xc(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shuffle_filter_ssse3>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1030 <_mm_load_si128@plt>
mov    %eax,%ebp
mov    $0x200,%edi
call   1050 <_mm_set1_epi16@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,(%rbx)
mov    $0x604,%edi
call   1050 <_mm_set1_epi16@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,0x4(%rbx)
mov    $0xa08,%edi
call   1050 <_mm_set1_epi16@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,0x8(%rbx)
mov    $0xe0c,%edi
call   1050 <_mm_set1_epi16@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,0xc(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @shuffle_filter_ssse3(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = call i32 @_mm_load_si128(i32* %6)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = call i32 @_mm_set1_epi16(i32 512)
%10 = call i32 @_mm_shuffle_epi8(i32 %8, i32 %9)
%11 = load i32*, i32** %4
%12 = getelementptr inbounds i32, i32* %11, i64 0
store i32 %10, i32* %12
%13 = load i32, i32* %5
%14 = call i32 @_mm_set1_epi16(i32 1540)
%15 = call i32 @_mm_shuffle_epi8(i32 %13, i32 %14)
%16 = load i32*, i32** %4
%17 = getelementptr inbounds i32, i32* %16, i64 1
store i32 %15, i32* %17
%18 = load i32, i32* %5
%19 = call i32 @_mm_set1_epi16(i32 2568)
%20 = call i32 @_mm_shuffle_epi8(i32 %18, i32 %19)
%21 = load i32*, i32** %4
%22 = getelementptr inbounds i32, i32* %21, i64 2
store i32 %20, i32* %22
%23 = load i32, i32* %5
%24 = call i32 @_mm_set1_epi16(i32 3596)
%25 = call i32 @_mm_shuffle_epi8(i32 %23, i32 %24)
%26 = load i32*, i32** %4
%27 = getelementptr inbounds i32, i32* %26, i64 3
store i32 %25, i32* %27
ret void
}

LLVM IR (-O2):
define void @shuffle_filter_ssse3(i32* %0, i32* nocapture writeonly %1) {
%3 = tail call i32 @_mm_load_si128(i32* %0)
%4 = tail call i32 @_mm_set1_epi16(i32 512)
%5 = tail call i32 @_mm_shuffle_epi8(i32 %3, i32 %4)
store i32 %5, i32* %1
%6 = tail call i32 @_mm_set1_epi16(i32 1540)
%7 = tail call i32 @_mm_shuffle_epi8(i32 %3, i32 %6)
%8 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %7, i32* %8
%9 = tail call i32 @_mm_set1_epi16(i32 2568)
%10 = tail call i32 @_mm_shuffle_epi8(i32 %3, i32 %9)
%11 = getelementptr inbounds i32, i32* %1, i64 2
store i32 %10, i32* %11
%12 = tail call i32 @_mm_set1_epi16(i32 3596)
%13 = tail call i32 @_mm_shuffle_epi8(i32 %3, i32 %12)
%14 = getelementptr inbounds i32, i32* %1, i64 3
store i32 %13, i32* %14
ret void
}