#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_setzero_si128();
int /*<<< orphan*/ _mm_unpackhi_epi16(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_unpackhi_epi32(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_unpackhi_epi64(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_unpacklo_epi16(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_unpacklo_epi32(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_unpacklo_epi64(int /*<<< orphan*/, int /*<<< orphan*/);
void highbd_transpose4x8_8x4_sse2(__m128i *x0, __m128i *x1, __m128i *x2,
                                  __m128i *x3, __m128i *d0, __m128i *d1,
                                  __m128i *d2, __m128i *d3, __m128i *d4,
                                  __m128i *d5, __m128i *d6, __m128i *d7) {
  __m128i w0, w1, ww0, ww1, ww2, ww3;
  __m128i zero = _mm_setzero_si128();
  w0 = _mm_unpacklo_epi16(*x0, *x1);
  w1 = _mm_unpacklo_epi16(*x2, *x3);
  ww0 = _mm_unpacklo_epi32(w0, w1);
  ww1 = _mm_unpackhi_epi32(w0, w1);
  w0 = _mm_unpackhi_epi16(*x0, *x1);
  w1 = _mm_unpackhi_epi16(*x2, *x3);
  ww2 = _mm_unpacklo_epi32(w0, w1);
  ww3 = _mm_unpackhi_epi32(w0, w1);
  *d0 = _mm_unpacklo_epi64(ww0, zero);
  *d1 = _mm_unpackhi_epi64(ww0, zero);
  *d2 = _mm_unpacklo_epi64(ww1, zero);
  *d3 = _mm_unpackhi_epi64(ww1, zero);
  *d4 = _mm_unpacklo_epi64(ww2, zero);
  *d5 = _mm_unpackhi_epi64(ww2, zero);
  *d6 = _mm_unpacklo_epi64(ww3, zero);
  *d7 = _mm_unpackhi_epi64(ww3, zero);
}


x86 assembly (clang, -O0):
<highbd_transpose4x8_8x4_sse2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
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    $0x0,%al
call   1030 <_mm_setzero_si128@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
call   1070 <_mm_unpacklo_epi16@plt>
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
call   1070 <_mm_unpacklo_epi16@plt>
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1040 <_mm_unpacklo_epi32@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1090 <_mm_unpackhi_epi32@plt>
mov    %eax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
call   1050 <_mm_unpackhi_epi16@plt>
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
call   1050 <_mm_unpackhi_epi16@plt>
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1040 <_mm_unpacklo_epi32@plt>
mov    %eax,-0x44(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1090 <_mm_unpackhi_epi32@plt>
mov    %eax,-0x48(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x4c(%rbp),%esi
call   1080 <_mm_unpacklo_epi64@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x3c(%rbp),%edi
mov    -0x4c(%rbp),%esi
call   1060 <_mm_unpackhi_epi64@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x40(%rbp),%edi
mov    -0x4c(%rbp),%esi
call   1080 <_mm_unpacklo_epi64@plt>
mov    %eax,%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x40(%rbp),%edi
mov    -0x4c(%rbp),%esi
call   1060 <_mm_unpackhi_epi64@plt>
mov    %eax,%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x44(%rbp),%edi
mov    -0x4c(%rbp),%esi
call   1080 <_mm_unpacklo_epi64@plt>
mov    %eax,%ecx
mov    0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x44(%rbp),%edi
mov    -0x4c(%rbp),%esi
call   1060 <_mm_unpackhi_epi64@plt>
mov    %eax,%ecx
mov    0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x48(%rbp),%edi
mov    -0x4c(%rbp),%esi
call   1080 <_mm_unpacklo_epi64@plt>
mov    %eax,%ecx
mov    0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x48(%rbp),%edi
mov    -0x4c(%rbp),%esi
call   1060 <_mm_unpackhi_epi64@plt>
mov    %eax,%ecx
mov    0x38(%rbp),%rax
mov    %ecx,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<highbd_transpose4x8_8x4_sse2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,0x20(%rsp)
mov    %r8,0x18(%rsp)
mov    %rcx,%r15
mov    %rcx,0x10(%rsp)
mov    %rdx,%rbx
mov    %rdx,0x8(%rsp)
mov    %rsi,%r14
mov    %rdi,%r12
xor    %eax,%eax
call   1030 <_mm_setzero_si128@plt>
mov    %eax,%r13d
mov    (%r12),%edi
mov    (%r14),%esi
call   1070 <_mm_unpacklo_epi16@plt>
mov    %eax,%ebp
mov    (%rbx),%edi
mov    (%r15),%esi
call   1070 <_mm_unpacklo_epi16@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <_mm_unpacklo_epi32@plt>
mov    %eax,%r15d
mov    %ebp,%edi
mov    %ebx,%esi
call   1090 <_mm_unpackhi_epi32@plt>
mov    %eax,0x4(%rsp)
mov    (%r12),%edi
mov    (%r14),%esi
call   1050 <_mm_unpackhi_epi16@plt>
mov    %eax,%ebx
mov    0x8(%rsp),%rax
mov    (%rax),%edi
mov    0x10(%rsp),%rax
mov    (%rax),%esi
call   1050 <_mm_unpackhi_epi16@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <_mm_unpacklo_epi32@plt>
mov    %eax,%r14d
mov    %ebx,%edi
mov    %ebp,%esi
call   1090 <_mm_unpackhi_epi32@plt>
mov    %eax,%r12d
mov    %r15d,%edi
mov    %r13d,%esi
call   1080 <_mm_unpacklo_epi64@plt>
mov    0x18(%rsp),%rcx
mov    %eax,(%rcx)
mov    %r15d,%edi
mov    %r13d,%esi
call   1060 <_mm_unpackhi_epi64@plt>
mov    0x20(%rsp),%rcx
mov    %eax,(%rcx)
mov    0x4(%rsp),%ebx
mov    %ebx,%edi
mov    %r13d,%esi
call   1080 <_mm_unpacklo_epi64@plt>
mov    0x60(%rsp),%rcx
mov    %eax,(%rcx)
mov    %ebx,%edi
mov    %r13d,%esi
call   1060 <_mm_unpackhi_epi64@plt>
mov    0x68(%rsp),%rcx
mov    %eax,(%rcx)
mov    %r14d,%edi
mov    %r13d,%esi
call   1080 <_mm_unpacklo_epi64@plt>
mov    0x70(%rsp),%rcx
mov    %eax,(%rcx)
mov    %r14d,%edi
mov    %r13d,%esi
call   1060 <_mm_unpackhi_epi64@plt>
mov    0x78(%rsp),%rcx
mov    %eax,(%rcx)
mov    %r12d,%edi
mov    %r13d,%esi
call   1080 <_mm_unpacklo_epi64@plt>
mov    0x80(%rsp),%rcx
mov    %eax,(%rcx)
mov    %r12d,%edi
mov    %r13d,%esi
call   1060 <_mm_unpackhi_epi64@plt>
mov    0x88(%rsp),%rcx
mov    %eax,(%rcx)
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @highbd_transpose4x8_8x4_sse2(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11) {
%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*
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
store i32* %0, i32** %13
store i32* %1, i32** %14
store i32* %2, i32** %15
store i32* %3, i32** %16
store i32* %4, i32** %17
store i32* %5, i32** %18
store i32* %6, i32** %19
store i32* %7, i32** %20
store i32* %8, i32** %21
store i32* %9, i32** %22
store i32* %10, i32** %23
store i32* %11, i32** %24
%32 = call i32 (...) @_mm_setzero_si128()
store i32 %32, i32* %31
%33 = load i32*, i32** %13
%34 = load i32, i32* %33
%35 = load i32*, i32** %14
%36 = load i32, i32* %35
%37 = call i32 @_mm_unpacklo_epi16(i32 %34, i32 %36)
store i32 %37, i32* %25
%38 = load i32*, i32** %15
%39 = load i32, i32* %38
%40 = load i32*, i32** %16
%41 = load i32, i32* %40
%42 = call i32 @_mm_unpacklo_epi16(i32 %39, i32 %41)
store i32 %42, i32* %26
%43 = load i32, i32* %25
%44 = load i32, i32* %26
%45 = call i32 @_mm_unpacklo_epi32(i32 %43, i32 %44)
store i32 %45, i32* %27
%46 = load i32, i32* %25
%47 = load i32, i32* %26
%48 = call i32 @_mm_unpackhi_epi32(i32 %46, i32 %47)
store i32 %48, i32* %28
%49 = load i32*, i32** %13
%50 = load i32, i32* %49
%51 = load i32*, i32** %14
%52 = load i32, i32* %51
%53 = call i32 @_mm_unpackhi_epi16(i32 %50, i32 %52)
store i32 %53, i32* %25
%54 = load i32*, i32** %15
%55 = load i32, i32* %54
%56 = load i32*, i32** %16
%57 = load i32, i32* %56
%58 = call i32 @_mm_unpackhi_epi16(i32 %55, i32 %57)
store i32 %58, i32* %26
%59 = load i32, i32* %25
%60 = load i32, i32* %26
%61 = call i32 @_mm_unpacklo_epi32(i32 %59, i32 %60)
store i32 %61, i32* %29
%62 = load i32, i32* %25
%63 = load i32, i32* %26
%64 = call i32 @_mm_unpackhi_epi32(i32 %62, i32 %63)
store i32 %64, i32* %30
%65 = load i32, i32* %27
%66 = load i32, i32* %31
%67 = call i32 @_mm_unpacklo_epi64(i32 %65, i32 %66)
%68 = load i32*, i32** %17
store i32 %67, i32* %68
%69 = load i32, i32* %27
%70 = load i32, i32* %31
%71 = call i32 @_mm_unpackhi_epi64(i32 %69, i32 %70)
%72 = load i32*, i32** %18
store i32 %71, i32* %72
%73 = load i32, i32* %28
%74 = load i32, i32* %31
%75 = call i32 @_mm_unpacklo_epi64(i32 %73, i32 %74)
%76 = load i32*, i32** %19
store i32 %75, i32* %76
%77 = load i32, i32* %28
%78 = load i32, i32* %31
%79 = call i32 @_mm_unpackhi_epi64(i32 %77, i32 %78)
%80 = load i32*, i32** %20
store i32 %79, i32* %80
%81 = load i32, i32* %29
%82 = load i32, i32* %31
%83 = call i32 @_mm_unpacklo_epi64(i32 %81, i32 %82)
%84 = load i32*, i32** %21
store i32 %83, i32* %84
%85 = load i32, i32* %29
%86 = load i32, i32* %31
%87 = call i32 @_mm_unpackhi_epi64(i32 %85, i32 %86)
%88 = load i32*, i32** %22
store i32 %87, i32* %88
%89 = load i32, i32* %30
%90 = load i32, i32* %31
%91 = call i32 @_mm_unpacklo_epi64(i32 %89, i32 %90)
%92 = load i32*, i32** %23
store i32 %91, i32* %92
%93 = load i32, i32* %30
%94 = load i32, i32* %31
%95 = call i32 @_mm_unpackhi_epi64(i32 %93, i32 %94)
%96 = load i32*, i32** %24
store i32 %95, i32* %96
ret void
}

LLVM IR (-O2):
define void @highbd_transpose4x8_8x4_sse2(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, i32* nocapture writeonly %8, i32* nocapture writeonly %9, i32* nocapture writeonly %10, i32* nocapture writeonly %11) {
%13 = tail call i32 (...) @_mm_setzero_si128()
%14 = load i32, i32* %0
%15 = load i32, i32* %1
%16 = tail call i32 @_mm_unpacklo_epi16(i32 %14, i32 %15)
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = tail call i32 @_mm_unpacklo_epi16(i32 %17, i32 %18)
%20 = tail call i32 @_mm_unpacklo_epi32(i32 %16, i32 %19)
%21 = tail call i32 @_mm_unpackhi_epi32(i32 %16, i32 %19)
%22 = load i32, i32* %0
%23 = load i32, i32* %1
%24 = tail call i32 @_mm_unpackhi_epi16(i32 %22, i32 %23)
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = tail call i32 @_mm_unpackhi_epi16(i32 %25, i32 %26)
%28 = tail call i32 @_mm_unpacklo_epi32(i32 %24, i32 %27)
%29 = tail call i32 @_mm_unpackhi_epi32(i32 %24, i32 %27)
%30 = tail call i32 @_mm_unpacklo_epi64(i32 %20, i32 %13)
store i32 %30, i32* %4
%31 = tail call i32 @_mm_unpackhi_epi64(i32 %20, i32 %13)
store i32 %31, i32* %5
%32 = tail call i32 @_mm_unpacklo_epi64(i32 %21, i32 %13)
store i32 %32, i32* %6
%33 = tail call i32 @_mm_unpackhi_epi64(i32 %21, i32 %13)
store i32 %33, i32* %7
%34 = tail call i32 @_mm_unpacklo_epi64(i32 %28, i32 %13)
store i32 %34, i32* %8
%35 = tail call i32 @_mm_unpackhi_epi64(i32 %28, i32 %13)
store i32 %35, i32* %9
%36 = tail call i32 @_mm_unpacklo_epi64(i32 %29, i32 %13)
store i32 %36, i32* %10
%37 = tail call i32 @_mm_unpackhi_epi64(i32 %29, i32 %13)
store i32 %37, i32* %11
ret void
}