#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 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*/);
int /*<<< orphan*/ assert(int);
void shuffle_filter_odd_ssse3(const int16_t *const filter, __m128i *const f) {
  const __m128i f_values = _mm_load_si128((const __m128i *)filter);
  assert(filter[3] >= 0 && filter[3] < 256);
  f[0] = _mm_shuffle_epi8(f_values, _mm_set1_epi16(0x0007u));
  f[1] = _mm_shuffle_epi8(f_values, _mm_set1_epi16(0x0402u));
  f[2] = _mm_shuffle_epi8(f_values, _mm_set1_epi16(0x0806u));
  f[3] = _mm_shuffle_epi8(f_values, _mm_set1_epi16(0x0c0au));
  f[4] = _mm_shuffle_epi8(f_values, _mm_set1_epi16(0x070eu));
}


x86 assembly (clang, -O0):
<shuffle_filter_odd_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    -0x8(%rbp),%rcx
xor    %eax,%eax
cmpl   $0x0,0xc(%rcx)
mov    %al,-0x15(%rbp)
jl     1180 <shuffle_filter_odd_ssse3+0x40>
mov    -0x8(%rbp),%rax
cmpl   $0x100,0xc(%rax)
setl   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    $0x7,%edi
call   1050 <_mm_set1_epi16@plt>
mov    -0x2c(%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,-0x28(%rbp)
mov    $0x402,%edi
call   1050 <_mm_set1_epi16@plt>
mov    -0x28(%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,-0x24(%rbp)
mov    $0x806,%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,0x8(%rax)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    $0xc0a,%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,0xc(%rax)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    $0x70e,%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,0x10(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shuffle_filter_odd_ssse3>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <_mm_load_si128@plt>
mov    %eax,%ebp
xor    %edi,%edi
cmpl   $0x100,0xc(%rbx)
setb   %dil
call   1060 <assert@plt>
mov    $0x7,%edi
call   1050 <_mm_set1_epi16@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,(%r14)
mov    $0x402,%edi
call   1050 <_mm_set1_epi16@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,0x4(%r14)
mov    $0x806,%edi
call   1050 <_mm_set1_epi16@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,0x8(%r14)
mov    $0xc0a,%edi
call   1050 <_mm_set1_epi16@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,0xc(%r14)
mov    $0x70e,%edi
call   1050 <_mm_set1_epi16@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <_mm_shuffle_epi8@plt>
mov    %eax,0x10(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @shuffle_filter_odd_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** %3
%9 = getelementptr inbounds i32, i32* %8, i64 3
%10 = load i32, i32* %9
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i32*, i32** %3
%14 = getelementptr inbounds i32, i32* %13, i64 3
%15 = load i32, i32* %14
%16 = icmp slt i32 %15, 256
br label %17
17: ; preds = %12, %2
%18 = phi i1 [ false, %2 ], [ %16, %12 ]
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = load i32, i32* %5
%22 = call i32 @_mm_set1_epi16(i32 7)
%23 = call i32 @_mm_shuffle_epi8(i32 %21, i32 %22)
%24 = load i32*, i32** %4
%25 = getelementptr inbounds i32, i32* %24, i64 0
store i32 %23, i32* %25
%26 = load i32, i32* %5
%27 = call i32 @_mm_set1_epi16(i32 1026)
%28 = call i32 @_mm_shuffle_epi8(i32 %26, i32 %27)
%29 = load i32*, i32** %4
%30 = getelementptr inbounds i32, i32* %29, i64 1
store i32 %28, i32* %30
%31 = load i32, i32* %5
%32 = call i32 @_mm_set1_epi16(i32 2054)
%33 = call i32 @_mm_shuffle_epi8(i32 %31, i32 %32)
%34 = load i32*, i32** %4
%35 = getelementptr inbounds i32, i32* %34, i64 2
store i32 %33, i32* %35
%36 = load i32, i32* %5
%37 = call i32 @_mm_set1_epi16(i32 3082)
%38 = call i32 @_mm_shuffle_epi8(i32 %36, i32 %37)
%39 = load i32*, i32** %4
%40 = getelementptr inbounds i32, i32* %39, i64 3
store i32 %38, i32* %40
%41 = load i32, i32* %5
%42 = call i32 @_mm_set1_epi16(i32 1806)
%43 = call i32 @_mm_shuffle_epi8(i32 %41, i32 %42)
%44 = load i32*, i32** %4
%45 = getelementptr inbounds i32, i32* %44, i64 4
store i32 %43, i32* %45
ret void
}

LLVM IR (-O2):
define void @shuffle_filter_odd_ssse3(i32* %0, i32* nocapture writeonly %1) {
%3 = tail call i32 @_mm_load_si128(i32* %0)
%4 = getelementptr inbounds i32, i32* %0, i64 3
%5 = load i32, i32* %4
%6 = icmp ult i32 %5, 256
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @_mm_set1_epi16(i32 7)
%10 = tail call i32 @_mm_shuffle_epi8(i32 %3, i32 %9)
store i32 %10, i32* %1
%11 = tail call i32 @_mm_set1_epi16(i32 1026)
%12 = tail call i32 @_mm_shuffle_epi8(i32 %3, i32 %11)
%13 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %12, i32* %13
%14 = tail call i32 @_mm_set1_epi16(i32 2054)
%15 = tail call i32 @_mm_shuffle_epi8(i32 %3, i32 %14)
%16 = getelementptr inbounds i32, i32* %1, i64 2
store i32 %15, i32* %16
%17 = tail call i32 @_mm_set1_epi16(i32 3082)
%18 = tail call i32 @_mm_shuffle_epi8(i32 %3, i32 %17)
%19 = getelementptr inbounds i32, i32* %1, i64 3
store i32 %18, i32* %19
%20 = tail call i32 @_mm_set1_epi16(i32 1806)
%21 = tail call i32 @_mm_shuffle_epi8(i32 %3, i32 %20)
%22 = getelementptr inbounds i32, i32* %1, i64 4
store i32 %21, i32* %22
ret void
}