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

/* Variables and functions */
int /*<<< orphan*/ _mm256_castsi128_si256(int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm256_insertf128_si256(int /*<<< orphan*/,
                                           int /*<<< orphan*/ const, int);
int /*<<< orphan*/ _mm256_set1_epi32(int);
int /*<<< orphan*/ _mm256_shuffle_epi8(int /*<<< orphan*/ const,
                                       int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_loadu_si128(int /*<<< orphan*/ const *);
void pack_2t_filter(const int16_t *filter, __m256i *f) {
  const __m128i h = _mm_loadu_si128((const __m128i *)filter);
  const __m256i hh = _mm256_insertf128_si256(_mm256_castsi128_si256(h), h, 1);
  const __m256i p = _mm256_set1_epi32(0x09080706);
  f[0] = _mm256_shuffle_epi8(hh, p);
}


x86 assembly (clang, -O0):
<pack_2t_filter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <_mm_loadu_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <_mm256_castsi128_si256@plt>
mov    %eax,%edi
mov    -0x14(%rbp),%esi
mov    $0x1,%edx
call   1060 <_mm256_insertf128_si256@plt>
mov    %eax,-0x18(%rbp)
mov    $0x9080706,%edi
call   1040 <_mm256_set1_epi32@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1070 <_mm256_shuffle_epi8@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pack_2t_filter>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1050 <_mm_loadu_si128@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1030 <_mm256_castsi128_si256@plt>
mov    %eax,%edi
mov    %ebp,%esi
mov    $0x1,%edx
call   1060 <_mm256_insertf128_si256@plt>
mov    %eax,%ebp
mov    $0x9080706,%edi
call   1040 <_mm256_set1_epi32@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1070 <_mm256_shuffle_epi8@plt>
mov    %eax,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @pack_2t_filter(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%8 = load i32*, i32** %3
%9 = call i32 @_mm_loadu_si128(i32* %8)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = call i32 @_mm256_castsi128_si256(i32 %10)
%12 = load i32, i32* %5
%13 = call i32 @_mm256_insertf128_si256(i32 %11, i32 %12, i32 1)
store i32 %13, i32* %6
%14 = call i32 @_mm256_set1_epi32(i32 151521030)
store i32 %14, i32* %7
%15 = load i32, i32* %6
%16 = load i32, i32* %7
%17 = call i32 @_mm256_shuffle_epi8(i32 %15, i32 %16)
%18 = load i32*, i32** %4
%19 = getelementptr inbounds i32, i32* %18, i64 0
store i32 %17, i32* %19
ret void
}

LLVM IR (-O2):
define void @pack_2t_filter(i32* %0, i32* nocapture writeonly %1) {
%3 = tail call i32 @_mm_loadu_si128(i32* %0)
%4 = tail call i32 @_mm256_castsi128_si256(i32 %3)
%5 = tail call i32 @_mm256_insertf128_si256(i32 %4, i32 %3, i32 1)
%6 = tail call i32 @_mm256_set1_epi32(i32 151521030)
%7 = tail call i32 @_mm256_shuffle_epi8(i32 %5, i32 %6)
store i32 %7, i32* %1
ret void
}