#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*/ __m256i;

/* Variables and functions */
int /*<<< orphan*/ _mm256_permute2x128_si256(int /*<<< orphan*/,
                                             int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm256_set_epi16(int, int, int, int, int, int, int, int, int,
                                    int, int, int, int, int, int, int);
int /*<<< orphan*/ _mm256_shuffle_epi8(int /*<<< orphan*/,
                                       int /*<<< orphan*/ const);
void mm256_reverse_epi16(__m256i *u) {
  const __m256i control = _mm256_set_epi16(
      0x0100, 0x0302, 0x0504, 0x0706, 0x0908, 0x0B0A, 0x0D0C, 0x0F0E, 0x0100,
      0x0302, 0x0504, 0x0706, 0x0908, 0x0B0A, 0x0D0C, 0x0F0E);
  __m256i v = _mm256_shuffle_epi8(*u, control);
  *u = _mm256_permute2x128_si256(v, v, 1);
}


x86 assembly (clang, -O0):
<mm256_reverse_epi16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x100,%edi
mov    $0x302,%esi
mov    $0x504,%edx
mov    $0x706,%ecx
mov    $0x908,%r8d
mov    $0xb0a,%r9d
movl   $0xd0c,(%rsp)
movl   $0xf0e,0x8(%rsp)
movl   $0x100,0x10(%rsp)
movl   $0x302,0x18(%rsp)
movl   $0x504,0x20(%rsp)
movl   $0x706,0x28(%rsp)
movl   $0x908,0x30(%rsp)
movl   $0xb0a,0x38(%rsp)
movl   $0xd0c,0x40(%rsp)
movl   $0xf0e,0x48(%rsp)
call   1030 <_mm256_set_epi16@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%esi
call   1050 <_mm256_shuffle_epi8@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    $0x1,%edx
call   1040 <_mm256_permute2x128_si256@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mm256_reverse_epi16>:
push   %rbx
mov    %rdi,%rbx
mov    $0x100,%edi
mov    $0x302,%esi
mov    $0x504,%edx
mov    $0x706,%ecx
mov    $0x908,%r8d
mov    $0xb0a,%r9d
push   $0xf0e
push   $0xd0c
push   $0xb0a
push   $0x908
push   $0x706
push   $0x504
push   $0x302
push   $0x100
push   $0xf0e
push   $0xd0c
call   1030 <_mm256_set_epi16@plt>
add    $0x50,%rsp
mov    (%rbx),%edi
mov    %eax,%esi
call   1050 <_mm256_shuffle_epi8@plt>
mov    %eax,%edi
mov    %eax,%esi
mov    $0x1,%edx
call   1040 <_mm256_permute2x128_si256@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @mm256_reverse_epi16(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = call i32 @_mm256_set_epi16(i32 256, i32 770, i32 1284, i32 1798, i32 2312, i32 2826, i32 3340, i32 3854, i32 256, i32 770, i32 1284, i32 1798, i32 2312, i32 2826, i32 3340, i32 3854)
store i32 %5, i32* %3
%6 = load i32*, i32** %2
%7 = load i32, i32* %6
%8 = load i32, i32* %3
%9 = call i32 @_mm256_shuffle_epi8(i32 %7, i32 %8)
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = load i32, i32* %4
%12 = call i32 @_mm256_permute2x128_si256(i32 %10, i32 %11, i32 1)
%13 = load i32*, i32** %2
store i32 %12, i32* %13
ret void
}

LLVM IR (-O2):
define void @mm256_reverse_epi16(i32* nocapture %0) {
%2 = tail call i32 @_mm256_set_epi16(i32 256, i32 770, i32 1284, i32 1798, i32 2312, i32 2826, i32 3340, i32 3854, i32 256, i32 770, i32 1284, i32 1798, i32 2312, i32 2826, i32 3340, i32 3854)
%3 = load i32, i32* %0
%4 = tail call i32 @_mm256_shuffle_epi8(i32 %3, i32 %2)
%5 = tail call i32 @_mm256_permute2x128_si256(i32 %4, i32 %4, i32 1)
store i32 %5, i32* %0
ret void
}