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

/* Variables and functions */
int /*<<< orphan*/ _mm_loadl_epi64(int /*<<< orphan*/ *);
int /*<<< orphan*/ _mm_unpackhi_epi16(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_unpackhi_epi32(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_epi8(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(unsigned char *, char const *, int);
void transpose(unsigned char *src[], int in_p, unsigned char *dst[], int out_p,
               int num_8x8_to_transpose) {
  int idx8x8 = 0;
  __m128i x0, x1, x2, x3, x4, x5, x6, x7;
  do {
    unsigned char *in = src[idx8x8];
    unsigned char *out = dst[idx8x8];
    x0 = _mm_loadl_epi64((__m128i *)(in + 0 * in_p));
    x1 = _mm_loadl_epi64((__m128i *)(in + 1 * in_p));
    x0 = _mm_unpacklo_epi8(x0, x1);
    x2 = _mm_loadl_epi64((__m128i *)(in + 2 * in_p));
    x3 = _mm_loadl_epi64((__m128i *)(in + 3 * in_p));
    x1 = _mm_unpacklo_epi8(x2, x3);
    x4 = _mm_loadl_epi64((__m128i *)(in + 4 * in_p));
    x5 = _mm_loadl_epi64((__m128i *)(in + 5 * in_p));
    x2 = _mm_unpacklo_epi8(x4, x5);
    x6 = _mm_loadl_epi64((__m128i *)(in + 6 * in_p));
    x7 = _mm_loadl_epi64((__m128i *)(in + 7 * in_p));
    x3 = _mm_unpacklo_epi8(x6, x7);
    x4 = _mm_unpacklo_epi16(x0, x1);
    x5 = _mm_unpacklo_epi16(x2, x3);
    x6 = _mm_unpacklo_epi32(x4, x5);
    memcpy((out + 0 * out_p), (const char *)&(x6), 8);
    memcpy((out + 1 * out_p), (const char *)&(x6) + 8, 8);
    x7 = _mm_unpackhi_epi32(x4, x5);
    memcpy((out + 2 * out_p), (const char *)&(x7), 8);
    memcpy((out + 3 * out_p), (const char *)&(x7) + 8, 8);
    x4 = _mm_unpackhi_epi16(x0, x1);
    x5 = _mm_unpackhi_epi16(x2, x3);
    x6 = _mm_unpacklo_epi32(x4, x5);
    memcpy((out + 4 * out_p), (const char *)&(x6), 8);
    memcpy((out + 5 * out_p), (const char *)&(x6) + 8, 8);
    x7 = _mm_unpackhi_epi32(x4, x5);
    memcpy((out + 6 * out_p), (const char *)&(x7), 8);
    memcpy((out + 7 * out_p), (const char *)&(x7) + 8, 8);
  } while (++idx8x8 < num_8x8_to_transpose);
}


x86 assembly (clang, -O0):
<transpose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x58(%rbp)
mov    -0x50(%rbp),%rdi
imul   $0x0,-0xc(%rbp),%eax
cltq
add    %rax,%rdi
call   1060 <_mm_loadl_epi64@plt>
mov    %eax,-0x28(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0xc(%rbp),%eax
shl    $0x0,%eax
cltq
add    %rax,%rdi
call   1060 <_mm_loadl_epi64@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%edi
mov    -0x2c(%rbp),%esi
call   1030 <_mm_unpacklo_epi8@plt>
mov    %eax,-0x28(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
cltq
add    %rax,%rdi
call   1060 <_mm_loadl_epi64@plt>
mov    %eax,-0x30(%rbp)
mov    -0x50(%rbp),%rdi
imul   $0x3,-0xc(%rbp),%eax
cltq
add    %rax,%rdi
call   1060 <_mm_loadl_epi64@plt>
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%edi
mov    -0x34(%rbp),%esi
call   1030 <_mm_unpacklo_epi8@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
cltq
add    %rax,%rdi
call   1060 <_mm_loadl_epi64@plt>
mov    %eax,-0x38(%rbp)
mov    -0x50(%rbp),%rdi
imul   $0x5,-0xc(%rbp),%eax
cltq
add    %rax,%rdi
call   1060 <_mm_loadl_epi64@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%edi
mov    -0x3c(%rbp),%esi
call   1030 <_mm_unpacklo_epi8@plt>
mov    %eax,-0x30(%rbp)
mov    -0x50(%rbp),%rdi
imul   $0x6,-0xc(%rbp),%eax
cltq
add    %rax,%rdi
call   1060 <_mm_loadl_epi64@plt>
mov    %eax,-0x40(%rbp)
mov    -0x50(%rbp),%rdi
imul   $0x7,-0xc(%rbp),%eax
cltq
add    %rax,%rdi
call   1060 <_mm_loadl_epi64@plt>
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%edi
mov    -0x44(%rbp),%esi
call   1030 <_mm_unpacklo_epi8@plt>
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%edi
mov    -0x2c(%rbp),%esi
call   1080 <_mm_unpacklo_epi16@plt>
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%edi
mov    -0x34(%rbp),%esi
call   1080 <_mm_unpacklo_epi16@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%edi
mov    -0x3c(%rbp),%esi
call   1040 <_mm_unpacklo_epi32@plt>
mov    %eax,-0x40(%rbp)
mov    -0x58(%rbp),%rdi
imul   $0x0,-0x1c(%rbp),%eax
cltq
add    %rax,%rdi
lea    -0x40(%rbp),%rsi
mov    $0x8,%edx
call   1070 <memcpy@plt>
mov    -0x58(%rbp),%rdi
mov    -0x1c(%rbp),%eax
shl    $0x0,%eax
cltq
add    %rax,%rdi
lea    -0x40(%rbp),%rsi
add    $0x8,%rsi
mov    $0x8,%edx
call   1070 <memcpy@plt>
mov    -0x38(%rbp),%edi
mov    -0x3c(%rbp),%esi
call   1090 <_mm_unpackhi_epi32@plt>
mov    %eax,-0x44(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
cltq
add    %rax,%rdi
lea    -0x44(%rbp),%rsi
mov    $0x8,%edx
call   1070 <memcpy@plt>
mov    -0x58(%rbp),%rdi
imul   $0x3,-0x1c(%rbp),%eax
cltq
add    %rax,%rdi
lea    -0x44(%rbp),%rsi
add    $0x8,%rsi
mov    $0x8,%edx
call   1070 <memcpy@plt>
mov    -0x28(%rbp),%edi
mov    -0x2c(%rbp),%esi
call   1050 <_mm_unpackhi_epi16@plt>
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%edi
mov    -0x34(%rbp),%esi
call   1050 <_mm_unpackhi_epi16@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%edi
mov    -0x3c(%rbp),%esi
call   1040 <_mm_unpacklo_epi32@plt>
mov    %eax,-0x40(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x1c(%rbp),%eax
shl    $0x2,%eax
cltq
add    %rax,%rdi
lea    -0x40(%rbp),%rsi
mov    $0x8,%edx
call   1070 <memcpy@plt>
mov    -0x58(%rbp),%rdi
imul   $0x5,-0x1c(%rbp),%eax
cltq
add    %rax,%rdi
lea    -0x40(%rbp),%rsi
add    $0x8,%rsi
mov    $0x8,%edx
call   1070 <memcpy@plt>
mov    -0x38(%rbp),%edi
mov    -0x3c(%rbp),%esi
call   1090 <_mm_unpackhi_epi32@plt>
mov    %eax,-0x44(%rbp)
mov    -0x58(%rbp),%rdi
imul   $0x6,-0x1c(%rbp),%eax
cltq
add    %rax,%rdi
lea    -0x44(%rbp),%rsi
mov    $0x8,%edx
call   1070 <memcpy@plt>
mov    -0x58(%rbp),%rdi
imul   $0x7,-0x1c(%rbp),%eax
cltq
add    %rax,%rdi
lea    -0x44(%rbp),%rsi
add    $0x8,%rsi
mov    $0x8,%edx
call   1070 <memcpy@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmp    -0x20(%rbp),%eax
jl     1191 <transpose+0x21>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transpose>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rdx,0x90(%rsp)
mov    %rdi,0x88(%rsp)
movslq %esi,%rdx
lea    (%rdx,%rdx,1),%eax
movslq %eax,%rsi
lea    (%rdx,%rdx,2),%eax
cltq
mov    %rax,0x70(%rsp)
lea    0x0(,%rdx,4),%eax
cltq
mov    %rax,0x68(%rsp)
lea    (%rdx,%rdx,4),%eax
cltq
mov    %rax,0x60(%rsp)
mov    %rsi,0x78(%rsp)
lea    (%rsi,%rsi,2),%eax
cltq
mov    %rax,0x58(%rsp)
lea    0x0(,%rdx,8),%eax
mov    %rdx,0x80(%rsp)
sub    %edx,%eax
cltq
mov    %rax,0x50(%rsp)
movslq %ecx,%rdx
lea    (%rdx,%rdx,1),%eax
movslq %eax,%rsi
lea    (%rdx,%rdx,2),%eax
cltq
mov    %rax,0x38(%rsp)
lea    0x0(,%rdx,8),%eax
sub    %edx,%eax
cmp    $0x2,%r8d
mov    $0x1,%ecx
cmovge %r8d,%ecx
mov    %rcx,0x30(%rsp)
lea    0x0(,%rdx,4),%ecx
movslq %ecx,%rcx
mov    %rcx,0x28(%rsp)
mov    %rdx,0x48(%rsp)
lea    (%rdx,%rdx,4),%ecx
movslq %ecx,%rcx
mov    %rcx,0x20(%rsp)
mov    %rsi,0x40(%rsp)
lea    (%rsi,%rsi,2),%ecx
movslq %ecx,%rcx
mov    %rcx,0x18(%rsp)
cltq
mov    %rax,0x10(%rsp)
xor    %r12d,%r12d
nopw   0x0(%rax,%rax,1)
mov    0x88(%rsp),%rax
mov    (%rax,%r12,8),%rbx
mov    0x90(%rsp),%rax
mov    (%rax,%r12,8),%r14
mov    %rbx,%rdi
call   1060 <_mm_loadl_epi64@plt>
mov    %eax,%ebp
mov    0x80(%rsp),%rax
lea    (%rbx,%rax,1),%rdi
call   1060 <_mm_loadl_epi64@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <_mm_unpacklo_epi8@plt>
mov    %eax,0x8(%rsp)
mov    0x78(%rsp),%rax
lea    (%rbx,%rax,1),%rdi
call   1060 <_mm_loadl_epi64@plt>
mov    %eax,%ebp
mov    0x70(%rsp),%rax
lea    (%rbx,%rax,1),%rdi
call   1060 <_mm_loadl_epi64@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <_mm_unpacklo_epi8@plt>
mov    %eax,%r15d
mov    %eax,0xc(%rsp)
mov    0x68(%rsp),%rax
lea    (%rbx,%rax,1),%rdi
call   1060 <_mm_loadl_epi64@plt>
mov    %eax,%ebp
mov    0x60(%rsp),%rax
lea    (%rbx,%rax,1),%rdi
call   1060 <_mm_loadl_epi64@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <_mm_unpacklo_epi8@plt>
mov    %eax,%r13d
mov    0x58(%rsp),%rax
lea    (%rbx,%rax,1),%rdi
call   1060 <_mm_loadl_epi64@plt>
mov    %eax,(%rsp)
add    0x50(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <_mm_loadl_epi64@plt>
mov    %eax,0x4(%rsp)
mov    (%rsp),%edi
mov    %eax,%esi
call   1030 <_mm_unpacklo_epi8@plt>
mov    %eax,%ebx
mov    0x8(%rsp),%edi
mov    %r15d,%esi
call   1080 <_mm_unpacklo_epi16@plt>
mov    %eax,%ebp
mov    %r13d,%edi
mov    %ebx,%esi
call   1080 <_mm_unpacklo_epi16@plt>
mov    %eax,%r15d
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <_mm_unpacklo_epi32@plt>
mov    %eax,(%rsp)
mov    %r14,%rdi
mov    %rsp,%rsi
mov    $0x8,%edx
call   1070 <memcpy@plt>
mov    0x48(%rsp),%rax
lea    (%r14,%rax,1),%rdi
lea    0x8(%rsp),%rsi
mov    $0x8,%edx
call   1070 <memcpy@plt>
mov    %ebp,%edi
mov    %r15d,%esi
call   1090 <_mm_unpackhi_epi32@plt>
mov    %eax,0x4(%rsp)
mov    0x40(%rsp),%rax
lea    (%r14,%rax,1),%rdi
lea    0x4(%rsp),%rsi
mov    $0x8,%edx
call   1070 <memcpy@plt>
mov    0x38(%rsp),%rax
lea    (%r14,%rax,1),%rdi
lea    0xc(%rsp),%r15
mov    %r15,%rsi
mov    $0x8,%edx
call   1070 <memcpy@plt>
mov    0x8(%rsp),%edi
mov    0xc(%rsp),%esi
call   1050 <_mm_unpackhi_epi16@plt>
mov    %eax,%ebp
mov    %r13d,%edi
mov    %ebx,%esi
call   1050 <_mm_unpackhi_epi16@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <_mm_unpacklo_epi32@plt>
mov    %eax,(%rsp)
mov    0x28(%rsp),%rax
lea    (%r14,%rax,1),%rdi
mov    %rsp,%rsi
mov    $0x8,%edx
call   1070 <memcpy@plt>
mov    0x20(%rsp),%rax
lea    (%r14,%rax,1),%rdi
lea    0x8(%rsp),%rsi
mov    $0x8,%edx
call   1070 <memcpy@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   1090 <_mm_unpackhi_epi32@plt>
mov    %eax,0x4(%rsp)
mov    0x18(%rsp),%rax
lea    (%r14,%rax,1),%rdi
lea    0x4(%rsp),%rsi
mov    $0x8,%edx
call   1070 <memcpy@plt>
add    0x10(%rsp),%r14
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x8,%edx
call   1070 <memcpy@plt>
add    $0x1,%r12
cmp    %r12,0x30(%rsp)
jne    1250 <transpose+0xe0>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @transpose(i8** %0, i32 %1, i8** %2, i32 %3, i32 %4) {
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i8**
%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 i8*
%21 = alloca i8*
store i8** %0, i8*** %6
store i32 %1, i32* %7
store i8** %2, i8*** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
store i32 0, i32* %11
br label %22
22: ; preds = %185, %5
%23 = load i8**, i8*** %6
%24 = load i32, i32* %11
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
store i8* %27, i8** %20
%28 = load i8**, i8*** %8
%29 = load i32, i32* %11
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
store i8* %32, i8** %21
%33 = load i8*, i8** %20
%34 = load i32, i32* %7
%35 = mul nsw i32 0, %34
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %33, i64 %36
%38 = bitcast i8* %37 to i32*
%39 = call i32 @_mm_loadl_epi64(i32* %38)
store i32 %39, i32* %12
%40 = load i8*, i8** %20
%41 = load i32, i32* %7
%42 = mul nsw i32 1, %41
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %40, i64 %43
%45 = bitcast i8* %44 to i32*
%46 = call i32 @_mm_loadl_epi64(i32* %45)
store i32 %46, i32* %13
%47 = load i32, i32* %12
%48 = load i32, i32* %13
%49 = call i32 @_mm_unpacklo_epi8(i32 %47, i32 %48)
store i32 %49, i32* %12
%50 = load i8*, i8** %20
%51 = load i32, i32* %7
%52 = mul nsw i32 2, %51
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %50, i64 %53
%55 = bitcast i8* %54 to i32*
%56 = call i32 @_mm_loadl_epi64(i32* %55)
store i32 %56, i32* %14
%57 = load i8*, i8** %20
%58 = load i32, i32* %7
%59 = mul nsw i32 3, %58
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %57, i64 %60
%62 = bitcast i8* %61 to i32*
%63 = call i32 @_mm_loadl_epi64(i32* %62)
store i32 %63, i32* %15
%64 = load i32, i32* %14
%65 = load i32, i32* %15
%66 = call i32 @_mm_unpacklo_epi8(i32 %64, i32 %65)
store i32 %66, i32* %13
%67 = load i8*, i8** %20
%68 = load i32, i32* %7
%69 = mul nsw i32 4, %68
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8, i8* %67, i64 %70
%72 = bitcast i8* %71 to i32*
%73 = call i32 @_mm_loadl_epi64(i32* %72)
store i32 %73, i32* %16
%74 = load i8*, i8** %20
%75 = load i32, i32* %7
%76 = mul nsw i32 5, %75
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8, i8* %74, i64 %77
%79 = bitcast i8* %78 to i32*
%80 = call i32 @_mm_loadl_epi64(i32* %79)
store i32 %80, i32* %17
%81 = load i32, i32* %16
%82 = load i32, i32* %17
%83 = call i32 @_mm_unpacklo_epi8(i32 %81, i32 %82)
store i32 %83, i32* %14
%84 = load i8*, i8** %20
%85 = load i32, i32* %7
%86 = mul nsw i32 6, %85
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8, i8* %84, i64 %87
%89 = bitcast i8* %88 to i32*
%90 = call i32 @_mm_loadl_epi64(i32* %89)
store i32 %90, i32* %18
%91 = load i8*, i8** %20
%92 = load i32, i32* %7
%93 = mul nsw i32 7, %92
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i8, i8* %91, i64 %94
%96 = bitcast i8* %95 to i32*
%97 = call i32 @_mm_loadl_epi64(i32* %96)
store i32 %97, i32* %19
%98 = load i32, i32* %18
%99 = load i32, i32* %19
%100 = call i32 @_mm_unpacklo_epi8(i32 %98, i32 %99)
store i32 %100, i32* %15
%101 = load i32, i32* %12
%102 = load i32, i32* %13
%103 = call i32 @_mm_unpacklo_epi16(i32 %101, i32 %102)
store i32 %103, i32* %16
%104 = load i32, i32* %14
%105 = load i32, i32* %15
%106 = call i32 @_mm_unpacklo_epi16(i32 %104, i32 %105)
store i32 %106, i32* %17
%107 = load i32, i32* %16
%108 = load i32, i32* %17
%109 = call i32 @_mm_unpacklo_epi32(i32 %107, i32 %108)
store i32 %109, i32* %18
%110 = load i8*, i8** %21
%111 = load i32, i32* %9
%112 = mul nsw i32 0, %111
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds i8, i8* %110, i64 %113
%115 = bitcast i32* %18 to i8*
%116 = call i32 @memcpy(i8* %114, i8* %115, i32 8)
%117 = load i8*, i8** %21
%118 = load i32, i32* %9
%119 = mul nsw i32 1, %118
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds i8, i8* %117, i64 %120
%122 = bitcast i32* %18 to i8*
%123 = getelementptr inbounds i8, i8* %122, i64 8
%124 = call i32 @memcpy(i8* %121, i8* %123, i32 8)
%125 = load i32, i32* %16
%126 = load i32, i32* %17
%127 = call i32 @_mm_unpackhi_epi32(i32 %125, i32 %126)
store i32 %127, i32* %19
%128 = load i8*, i8** %21
%129 = load i32, i32* %9
%130 = mul nsw i32 2, %129
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds i8, i8* %128, i64 %131
%133 = bitcast i32* %19 to i8*
%134 = call i32 @memcpy(i8* %132, i8* %133, i32 8)
%135 = load i8*, i8** %21
%136 = load i32, i32* %9
%137 = mul nsw i32 3, %136
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds i8, i8* %135, i64 %138
%140 = bitcast i32* %19 to i8*
%141 = getelementptr inbounds i8, i8* %140, i64 8
%142 = call i32 @memcpy(i8* %139, i8* %141, i32 8)
%143 = load i32, i32* %12
%144 = load i32, i32* %13
%145 = call i32 @_mm_unpackhi_epi16(i32 %143, i32 %144)
store i32 %145, i32* %16
%146 = load i32, i32* %14
%147 = load i32, i32* %15
%148 = call i32 @_mm_unpackhi_epi16(i32 %146, i32 %147)
store i32 %148, i32* %17
%149 = load i32, i32* %16
%150 = load i32, i32* %17
%151 = call i32 @_mm_unpacklo_epi32(i32 %149, i32 %150)
store i32 %151, i32* %18
%152 = load i8*, i8** %21
%153 = load i32, i32* %9
%154 = mul nsw i32 4, %153
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds i8, i8* %152, i64 %155
%157 = bitcast i32* %18 to i8*
%158 = call i32 @memcpy(i8* %156, i8* %157, i32 8)
%159 = load i8*, i8** %21
%160 = load i32, i32* %9
%161 = mul nsw i32 5, %160
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds i8, i8* %159, i64 %162
%164 = bitcast i32* %18 to i8*
%165 = getelementptr inbounds i8, i8* %164, i64 8
%166 = call i32 @memcpy(i8* %163, i8* %165, i32 8)
%167 = load i32, i32* %16
%168 = load i32, i32* %17
%169 = call i32 @_mm_unpackhi_epi32(i32 %167, i32 %168)
store i32 %169, i32* %19
%170 = load i8*, i8** %21
%171 = load i32, i32* %9
%172 = mul nsw i32 6, %171
%173 = sext i32 %172 to i64
%174 = getelementptr inbounds i8, i8* %170, i64 %173
%175 = bitcast i32* %19 to i8*
%176 = call i32 @memcpy(i8* %174, i8* %175, i32 8)
%177 = load i8*, i8** %21
%178 = load i32, i32* %9
%179 = mul nsw i32 7, %178
%180 = sext i32 %179 to i64
%181 = getelementptr inbounds i8, i8* %177, i64 %180
%182 = bitcast i32* %19 to i8*
%183 = getelementptr inbounds i8, i8* %182, i64 8
%184 = call i32 @memcpy(i8* %181, i8* %183, i32 8)
br label %185
185: ; preds = %22
%186 = load i32, i32* %11
%187 = add nsw i32 %186, 1
store i32 %187, i32* %11
%188 = load i32, i32* %10
%189 = icmp slt i32 %187, %188
br i1 %189, label %22, label %190
190: ; preds = %185
ret void
}

LLVM IR (-O2):
define void @transpose(i8** nocapture %0, i32 %1, i8** nocapture %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i32* %6 to i8*
%9 = bitcast i32* %7 to i8*
%10 = sext i32 %1 to i64
%11 = shl nsw i32 %1, 1
%12 = sext i32 %11 to i64
%13 = mul nsw i32 %1, 3
%14 = sext i32 %13 to i64
%15 = shl nsw i32 %1, 2
%16 = sext i32 %15 to i64
%17 = mul nsw i32 %1, 5
%18 = sext i32 %17 to i64
%19 = mul nsw i32 %1, 6
%20 = sext i32 %19 to i64
%21 = mul nsw i32 %1, 7
%22 = sext i32 %21 to i64
%23 = sext i32 %3 to i64
%24 = getelementptr inbounds i32, i32* %6, i64 2
%25 = bitcast i32* %24 to i8*
%26 = shl nsw i32 %3, 1
%27 = sext i32 %26 to i64
%28 = mul nsw i32 %3, 3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %7, i64 2
%31 = bitcast i32* %30 to i8*
%32 = shl nsw i32 %3, 2
%33 = sext i32 %32 to i64
%34 = mul nsw i32 %3, 5
%35 = sext i32 %34 to i64
%36 = mul nsw i32 %3, 6
%37 = sext i32 %36 to i64
%38 = mul nsw i32 %3, 7
%39 = sext i32 %38 to i64
%40 = call i32 @llvm.smax.i32(i32 %4, i32 1)
%41 = zext i32 %40 to i64
br label %42
42: ; preds = %42, %5
%43 = phi i64 [ %99, %42 ], [ 0, %5 ]
%44 = getelementptr inbounds i8*, i8** %0, i64 %43
%45 = load i8*, i8** %44
%46 = getelementptr inbounds i8*, i8** %2, i64 %43
%47 = load i8*, i8** %46
%48 = bitcast i8* %45 to i32*
%49 = call i32 @_mm_loadl_epi64(i32* %48)
%50 = getelementptr inbounds i8, i8* %45, i64 %10
%51 = bitcast i8* %50 to i32*
%52 = call i32 @_mm_loadl_epi64(i32* %51)
%53 = call i32 @_mm_unpacklo_epi8(i32 %49, i32 %52)
%54 = getelementptr inbounds i8, i8* %45, i64 %12
%55 = bitcast i8* %54 to i32*
%56 = call i32 @_mm_loadl_epi64(i32* %55)
%57 = getelementptr inbounds i8, i8* %45, i64 %14
%58 = bitcast i8* %57 to i32*
%59 = call i32 @_mm_loadl_epi64(i32* %58)
%60 = call i32 @_mm_unpacklo_epi8(i32 %56, i32 %59)
%61 = getelementptr inbounds i8, i8* %45, i64 %16
%62 = bitcast i8* %61 to i32*
%63 = call i32 @_mm_loadl_epi64(i32* %62)
%64 = getelementptr inbounds i8, i8* %45, i64 %18
%65 = bitcast i8* %64 to i32*
%66 = call i32 @_mm_loadl_epi64(i32* %65)
%67 = call i32 @_mm_unpacklo_epi8(i32 %63, i32 %66)
%68 = getelementptr inbounds i8, i8* %45, i64 %20
%69 = bitcast i8* %68 to i32*
%70 = call i32 @_mm_loadl_epi64(i32* %69)
store i32 %70, i32* %6
%71 = getelementptr inbounds i8, i8* %45, i64 %22
%72 = bitcast i8* %71 to i32*
%73 = call i32 @_mm_loadl_epi64(i32* %72)
store i32 %73, i32* %7
%74 = load i32, i32* %6
%75 = call i32 @_mm_unpacklo_epi8(i32 %74, i32 %73)
%76 = call i32 @_mm_unpacklo_epi16(i32 %53, i32 %60)
%77 = call i32 @_mm_unpacklo_epi16(i32 %67, i32 %75)
%78 = call i32 @_mm_unpacklo_epi32(i32 %76, i32 %77)
store i32 %78, i32* %6
%79 = call i32 @memcpy(i8* %47, i8* %8, i32 8)
%80 = getelementptr inbounds i8, i8* %47, i64 %23
%81 = call i32 @memcpy(i8* %80, i8* %25, i32 8)
%82 = call i32 @_mm_unpackhi_epi32(i32 %76, i32 %77)
store i32 %82, i32* %7
%83 = getelementptr inbounds i8, i8* %47, i64 %27
%84 = call i32 @memcpy(i8* %83, i8* %9, i32 8)
%85 = getelementptr inbounds i8, i8* %47, i64 %29
%86 = call i32 @memcpy(i8* %85, i8* %31, i32 8)
%87 = call i32 @_mm_unpackhi_epi16(i32 %53, i32 %60)
%88 = call i32 @_mm_unpackhi_epi16(i32 %67, i32 %75)
%89 = call i32 @_mm_unpacklo_epi32(i32 %87, i32 %88)
store i32 %89, i32* %6
%90 = getelementptr inbounds i8, i8* %47, i64 %33
%91 = call i32 @memcpy(i8* %90, i8* %8, i32 8)
%92 = getelementptr inbounds i8, i8* %47, i64 %35
%93 = call i32 @memcpy(i8* %92, i8* %25, i32 8)
%94 = call i32 @_mm_unpackhi_epi32(i32 %87, i32 %88)
store i32 %94, i32* %7
%95 = getelementptr inbounds i8, i8* %47, i64 %37
%96 = call i32 @memcpy(i8* %95, i8* %9, i32 8)
%97 = getelementptr inbounds i8, i8* %47, i64 %39
%98 = call i32 @memcpy(i8* %97, i8* %31, i32 8)
%99 = add nuw nsw i64 %43, 1
%100 = icmp eq i64 %99, %41
br i1 %100, label %101, label %42
101: ; preds = %42
ret void
}