#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_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_transpose8x8_low_sse2(__m128i *x0, __m128i *x1, __m128i *x2,
                                  __m128i *x3, __m128i *x4, __m128i *x5,
                                  __m128i *x6, __m128i *x7, __m128i *d0,
                                  __m128i *d1, __m128i *d2, __m128i *d3) {
  __m128i w0, w1, w2, w3, ww0, ww1;
  w0 = _mm_unpacklo_epi16(*x0, *x1);
  w1 = _mm_unpacklo_epi16(*x2, *x3);
  w2 = _mm_unpacklo_epi16(*x4, *x5);
  w3 = _mm_unpacklo_epi16(*x6, *x7);
  ww0 = _mm_unpacklo_epi32(w0, w1);
  ww1 = _mm_unpacklo_epi32(w2, w3);
  *d0 = _mm_unpacklo_epi64(ww0, ww1);
  *d1 = _mm_unpackhi_epi64(ww0, ww1);
  ww0 = _mm_unpackhi_epi32(w0, w1);
  ww1 = _mm_unpackhi_epi32(w2, w3);
  *d2 = _mm_unpacklo_epi64(ww0, ww1);
  *d3 = _mm_unpackhi_epi64(ww0, ww1);
}


x86 assembly (clang, -O0):
<highbd_transpose8x8_low_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    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
call   1050 <_mm_unpacklo_epi16@plt>
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
call   1050 <_mm_unpacklo_epi16@plt>
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
call   1050 <_mm_unpacklo_epi16@plt>
mov    %eax,-0x3c(%rbp)
mov    0x10(%rbp),%rax
mov    (%rax),%edi
mov    0x18(%rbp),%rax
mov    (%rax),%esi
call   1050 <_mm_unpacklo_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    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1060 <_mm_unpacklo_epi64@plt>
mov    %eax,%ecx
mov    0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1040 <_mm_unpackhi_epi64@plt>
mov    %eax,%ecx
mov    0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x34(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1070 <_mm_unpackhi_epi32@plt>
mov    %eax,-0x44(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x40(%rbp),%esi
call   1070 <_mm_unpackhi_epi32@plt>
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1060 <_mm_unpacklo_epi64@plt>
mov    %eax,%ecx
mov    0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1040 <_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_transpose8x8_low_sse2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r12
mov    %r8,%r13
mov    %rcx,%rbx
mov    %rdx,%rbp
mov    (%rdi),%edi
mov    (%rsi),%esi
call   1050 <_mm_unpacklo_epi16@plt>
mov    %eax,%r14d
mov    0x0(%rbp),%edi
mov    (%rbx),%esi
call   1050 <_mm_unpacklo_epi16@plt>
mov    %eax,%r15d
mov    0x0(%r13),%edi
mov    (%r12),%esi
call   1050 <_mm_unpacklo_epi16@plt>
mov    %eax,%r12d
mov    0x40(%rsp),%rax
mov    (%rax),%edi
mov    0x48(%rsp),%rax
mov    (%rax),%esi
call   1050 <_mm_unpacklo_epi16@plt>
mov    %eax,%r13d
mov    %r14d,%edi
mov    %r15d,%esi
call   1030 <_mm_unpacklo_epi32@plt>
mov    %eax,%ebx
mov    %r12d,%edi
mov    %r13d,%esi
call   1030 <_mm_unpacklo_epi32@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %eax,%esi
call   1060 <_mm_unpacklo_epi64@plt>
mov    0x50(%rsp),%rcx
mov    %eax,(%rcx)
mov    %ebx,%edi
mov    %ebp,%esi
call   1040 <_mm_unpackhi_epi64@plt>
mov    0x58(%rsp),%rcx
mov    %eax,(%rcx)
mov    %r14d,%edi
mov    %r15d,%esi
call   1070 <_mm_unpackhi_epi32@plt>
mov    %eax,%ebx
mov    %r12d,%edi
mov    %r13d,%esi
call   1070 <_mm_unpackhi_epi32@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %eax,%esi
call   1060 <_mm_unpacklo_epi64@plt>
mov    0x60(%rsp),%rcx
mov    %eax,(%rcx)
mov    %ebx,%edi
mov    %ebp,%esi
call   1040 <_mm_unpackhi_epi64@plt>
mov    0x68(%rsp),%rcx
mov    %eax,(%rcx)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @highbd_transpose8x8_low_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
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
%31 = load i32*, i32** %13
%32 = load i32, i32* %31
%33 = load i32*, i32** %14
%34 = load i32, i32* %33
%35 = call i32 @_mm_unpacklo_epi16(i32 %32, i32 %34)
store i32 %35, i32* %25
%36 = load i32*, i32** %15
%37 = load i32, i32* %36
%38 = load i32*, i32** %16
%39 = load i32, i32* %38
%40 = call i32 @_mm_unpacklo_epi16(i32 %37, i32 %39)
store i32 %40, i32* %26
%41 = load i32*, i32** %17
%42 = load i32, i32* %41
%43 = load i32*, i32** %18
%44 = load i32, i32* %43
%45 = call i32 @_mm_unpacklo_epi16(i32 %42, i32 %44)
store i32 %45, i32* %27
%46 = load i32*, i32** %19
%47 = load i32, i32* %46
%48 = load i32*, i32** %20
%49 = load i32, i32* %48
%50 = call i32 @_mm_unpacklo_epi16(i32 %47, i32 %49)
store i32 %50, i32* %28
%51 = load i32, i32* %25
%52 = load i32, i32* %26
%53 = call i32 @_mm_unpacklo_epi32(i32 %51, i32 %52)
store i32 %53, i32* %29
%54 = load i32, i32* %27
%55 = load i32, i32* %28
%56 = call i32 @_mm_unpacklo_epi32(i32 %54, i32 %55)
store i32 %56, i32* %30
%57 = load i32, i32* %29
%58 = load i32, i32* %30
%59 = call i32 @_mm_unpacklo_epi64(i32 %57, i32 %58)
%60 = load i32*, i32** %21
store i32 %59, i32* %60
%61 = load i32, i32* %29
%62 = load i32, i32* %30
%63 = call i32 @_mm_unpackhi_epi64(i32 %61, i32 %62)
%64 = load i32*, i32** %22
store i32 %63, i32* %64
%65 = load i32, i32* %25
%66 = load i32, i32* %26
%67 = call i32 @_mm_unpackhi_epi32(i32 %65, i32 %66)
store i32 %67, i32* %29
%68 = load i32, i32* %27
%69 = load i32, i32* %28
%70 = call i32 @_mm_unpackhi_epi32(i32 %68, i32 %69)
store i32 %70, i32* %30
%71 = load i32, i32* %29
%72 = load i32, i32* %30
%73 = call i32 @_mm_unpacklo_epi64(i32 %71, i32 %72)
%74 = load i32*, i32** %23
store i32 %73, i32* %74
%75 = load i32, i32* %29
%76 = load i32, i32* %30
%77 = call i32 @_mm_unpackhi_epi64(i32 %75, i32 %76)
%78 = load i32*, i32** %24
store i32 %77, i32* %78
ret void
}

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