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

/* Variables and functions */
int /*<<< orphan*/ _mm_unpackhi_epi16(int /*<<< orphan*/ const,
                                      int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_unpackhi_epi32(int /*<<< orphan*/ const,
                                      int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_unpackhi_epi64(int /*<<< orphan*/ const,
                                      int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_unpacklo_epi16(int /*<<< orphan*/ const,
                                      int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_unpacklo_epi32(int /*<<< orphan*/ const,
                                      int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_unpacklo_epi64(int /*<<< orphan*/ const,
                                      int /*<<< orphan*/ const);
void VP8Transpose_2_4x4_16b(const __m128i *const in0, const __m128i *const in1,
                            const __m128i *const in2, const __m128i *const in3,
                            __m128i *const out0, __m128i *const out1,
                            __m128i *const out2, __m128i *const out3) {
  const __m128i transpose0_0 = _mm_unpacklo_epi16(*in0, *in1);
  const __m128i transpose0_1 = _mm_unpacklo_epi16(*in2, *in3);
  const __m128i transpose0_2 = _mm_unpackhi_epi16(*in0, *in1);
  const __m128i transpose0_3 = _mm_unpackhi_epi16(*in2, *in3);
  const __m128i transpose1_0 = _mm_unpacklo_epi32(transpose0_0, transpose0_1);
  const __m128i transpose1_1 = _mm_unpacklo_epi32(transpose0_2, transpose0_3);
  const __m128i transpose1_2 = _mm_unpackhi_epi32(transpose0_0, transpose0_1);
  const __m128i transpose1_3 = _mm_unpackhi_epi32(transpose0_2, transpose0_3);
  *out0 = _mm_unpacklo_epi64(transpose1_0, transpose1_1);
  *out1 = _mm_unpackhi_epi64(transpose1_0, transpose1_1);
  *out2 = _mm_unpacklo_epi64(transpose1_2, transpose1_3);
  *out3 = _mm_unpackhi_epi64(transpose1_2, transpose1_3);
}


x86 assembly (clang, -O0):
<VP8Transpose_2_4x4_16b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
call   1060 <_mm_unpacklo_epi16@plt>
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
call   1060 <_mm_unpacklo_epi16@plt>
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
call   1040 <_mm_unpackhi_epi16@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
call   1040 <_mm_unpackhi_epi16@plt>
mov    %eax,-0x40(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1030 <_mm_unpacklo_epi32@plt>
mov    %eax,-0x44(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x40(%rbp),%esi
call   1030 <_mm_unpacklo_epi32@plt>
mov    %eax,-0x48(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1080 <_mm_unpackhi_epi32@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x40(%rbp),%esi
call   1080 <_mm_unpackhi_epi32@plt>
mov    %eax,-0x50(%rbp)
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1070 <_mm_unpacklo_epi64@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1050 <_mm_unpackhi_epi64@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4c(%rbp),%edi
mov    -0x50(%rbp),%esi
call   1070 <_mm_unpacklo_epi64@plt>
mov    %eax,%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4c(%rbp),%edi
mov    -0x50(%rbp),%esi
call   1050 <_mm_unpackhi_epi64@plt>
mov    %eax,%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VP8Transpose_2_4x4_16b>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,0x8(%rsp)
mov    %rcx,%r13
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    (%rdi),%edi
mov    (%rsi),%esi
call   1060 <_mm_unpacklo_epi16@plt>
mov    %eax,%ebp
mov    (%rbx),%edi
mov    0x0(%r13),%esi
call   1060 <_mm_unpacklo_epi16@plt>
mov    %eax,%r12d
mov    (%r15),%edi
mov    (%r14),%esi
call   1040 <_mm_unpackhi_epi16@plt>
mov    %eax,%r14d
mov    (%rbx),%edi
mov    0x0(%r13),%esi
call   1040 <_mm_unpackhi_epi16@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %ebp,%r13d
mov    %r12d,%esi
call   1030 <_mm_unpacklo_epi32@plt>
mov    %eax,%r15d
mov    %r14d,%edi
mov    %ebx,%esi
call   1030 <_mm_unpacklo_epi32@plt>
mov    %eax,%ebp
mov    %r13d,%edi
mov    %r12d,%esi
call   1080 <_mm_unpackhi_epi32@plt>
mov    %eax,%r12d
mov    %r14d,%edi
mov    %ebx,%esi
call   1080 <_mm_unpackhi_epi32@plt>
mov    %eax,%ebx
mov    %r15d,%edi
mov    %ebp,%esi
call   1070 <_mm_unpacklo_epi64@plt>
mov    0x8(%rsp),%rcx
mov    %eax,(%rcx)
mov    %r15d,%edi
mov    %ebp,%esi
call   1050 <_mm_unpackhi_epi64@plt>
mov    0x10(%rsp),%rcx
mov    %eax,(%rcx)
mov    %r12d,%edi
mov    %ebx,%esi
call   1070 <_mm_unpacklo_epi64@plt>
mov    0x50(%rsp),%rcx
mov    %eax,(%rcx)
mov    %r12d,%edi
mov    %ebx,%esi
call   1050 <_mm_unpackhi_epi64@plt>
mov    0x58(%rsp),%rcx
mov    %eax,(%rcx)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @VP8Transpose_2_4x4_16b(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2, i32* nocapture %3, i32* nocapture writeonly %4, i32* nocapture writeonly %5, i32* nocapture writeonly %6, i32* nocapture writeonly %7) {
%9 = load i32, i32* %0
%10 = load i32, i32* %1
%11 = tail call i32 @_mm_unpacklo_epi16(i32 %9, i32 %10)
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = tail call i32 @_mm_unpacklo_epi16(i32 %12, i32 %13)
%15 = load i32, i32* %0
%16 = load i32, i32* %1
%17 = tail call i32 @_mm_unpackhi_epi16(i32 %15, i32 %16)
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = tail call i32 @_mm_unpackhi_epi16(i32 %18, i32 %19)
%21 = tail call i32 @_mm_unpacklo_epi32(i32 %11, i32 %14)
%22 = tail call i32 @_mm_unpacklo_epi32(i32 %17, i32 %20)
%23 = tail call i32 @_mm_unpackhi_epi32(i32 %11, i32 %14)
%24 = tail call i32 @_mm_unpackhi_epi32(i32 %17, i32 %20)
%25 = tail call i32 @_mm_unpacklo_epi64(i32 %21, i32 %22)
store i32 %25, i32* %4
%26 = tail call i32 @_mm_unpackhi_epi64(i32 %21, i32 %22)
store i32 %26, i32* %5
%27 = tail call i32 @_mm_unpacklo_epi64(i32 %23, i32 %24)
store i32 %27, i32* %6
%28 = tail call i32 @_mm_unpackhi_epi64(i32 %23, i32 %24)
store i32 %28, i32* %7
ret void
}