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

/* Variables and functions */
int /*<<< orphan*/ _mm_load_sd(double *);
int /*<<< orphan*/ _mm_loadu_pd(double *);
int /*<<< orphan*/ _mm_mul_pd(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_shuffle_pd(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_storeu_pd(double *, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_unpacklo_pd(int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ floor(float);
void transpose_4321_loop_3241_(double *unsorted, double *sorted, int *p_dim1,
                               int *p_dim2, int *p_dim3, int *p_dim4,
                               double *p_factor) {
  int dim1, dim2, dim3, dim4;
  int dim1mod, dim2mod, dim3mod, dim4mod;
  unsigned int old_offset, new_offset;
  unsigned int j1, j2, j3, j4;
  double factor = *p_factor;
  double *pA, *pB;
  register __m128d x, y, z, w, t, t1, fac_vector;
  unsigned int N1, N2;
  fac_vector = _mm_load_sd(&factor);
  fac_vector = _mm_unpacklo_pd(fac_vector, fac_vector);
  dim1 = *p_dim1;
  dim2 = *p_dim2;
  dim3 = *p_dim3;
  dim4 = *p_dim4;
  N1 = dim2 * dim3 * dim4;
  N2 = dim2 * dim3 * dim4;
  dim1mod = (int)floor((float)dim1 / (float)4);
  dim2mod = (int)floor((float)dim2 / (float)4);
  dim3mod = (int)floor((float)dim3 / (float)4);
  dim4mod = (int)floor((float)dim4 / (float)4);
#pragma ivdep
#pragma parallel
#pragma loop count min(10) max(80) avg(40)
#pragma unroll
  for (j3 = 0; j3 < dim3; j3++) {
#pragma loop count min(10) max(80) avg(40)
#pragma unroll
    for (j2 = 0; j2 < dim2; j2++) {
#pragma loop count min(10) max(80) avg(40)
#pragma unroll
#pragma vector always
      for (j4 = 0; j4 < dim4; j4 += 2) {
#pragma loop count min(10) max(80) avg(40)
#pragma unroll
#pragma vector always
        for (j1 = 0; j1 < dim1; j1 += 2) {
          pA = unsorted + j4 + dim4 * (j3 + dim3 * (j2 + dim2 * j1));
          pB = sorted + j1 + dim1 * (j2 + dim2 * (j3 + dim3 * j4));
          x = _mm_loadu_pd(pA);
          x = _mm_mul_pd(x, fac_vector);
          y = _mm_loadu_pd(pA + N2);
          y = _mm_mul_pd(y, fac_vector);
          z = _mm_shuffle_pd(x, y, 0);
          w = _mm_shuffle_pd(x, y, 3);
          _mm_storeu_pd(pB, z);
          _mm_storeu_pd(pB + N1, w);
        }
      }
    }
  }
  return;
}


x86 assembly (clang, -O0):
<transpose_4321_loop_3241_>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
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    0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x70(%rbp)
lea    -0x70(%rbp),%rdi
call   1040 <_mm_load_sd@plt>
mov    %eax,-0x9c(%rbp)
mov    -0x9c(%rbp),%edi
mov    -0x9c(%rbp),%esi
call   1030 <_mm_unpacklo_pd@plt>
mov    %eax,-0x9c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    -0x38(%rbp),%eax
imul   -0x3c(%rbp),%eax
imul   -0x40(%rbp),%eax
mov    %eax,-0xa0(%rbp)
mov    -0x38(%rbp),%eax
imul   -0x3c(%rbp),%eax
imul   -0x40(%rbp),%eax
mov    %eax,-0xa4(%rbp)
cvtsi2ssl -0x34(%rbp),%xmm0
movss  0xde3(%rip),%xmm1
divss  %xmm1,%xmm0
call   1090 <floor@plt>
mov    %eax,-0x44(%rbp)
cvtsi2ssl -0x38(%rbp),%xmm0
movss  0xdca(%rip),%xmm1
divss  %xmm1,%xmm0
call   1090 <floor@plt>
mov    %eax,-0x48(%rbp)
cvtsi2ssl -0x3c(%rbp),%xmm0
movss  0xdb1(%rip),%xmm1
divss  %xmm1,%xmm0
call   1090 <floor@plt>
mov    %eax,-0x4c(%rbp)
cvtsi2ssl -0x40(%rbp),%xmm0
movss  0xd98(%rip),%xmm1
divss  %xmm1,%xmm0
call   1090 <floor@plt>
mov    %eax,-0x50(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jae    1436 <transpose_4321_loop_3241_+0x2c6>
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x38(%rbp),%eax
jae    1423 <transpose_4321_loop_3241_+0x2b3>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x40(%rbp),%eax
jae    1410 <transpose_4321_loop_3241_+0x2a0>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jae    13fd <transpose_4321_loop_3241_+0x28d>
mov    -0x8(%rbp),%rax
mov    -0x68(%rbp),%ecx
shl    $0x3,%rcx
add    %rcx,%rax
mov    -0x40(%rbp),%ecx
mov    -0x64(%rbp),%edx
mov    -0x3c(%rbp),%esi
mov    -0x60(%rbp),%edi
mov    -0x38(%rbp),%r8d
imul   -0x5c(%rbp),%r8d
add    %r8d,%edi
imul   %edi,%esi
add    %esi,%edx
imul   %edx,%ecx
mov    %ecx,%ecx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x78(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x5c(%rbp),%ecx
shl    $0x3,%rcx
add    %rcx,%rax
mov    -0x34(%rbp),%ecx
mov    -0x60(%rbp),%edx
mov    -0x38(%rbp),%esi
mov    -0x64(%rbp),%edi
mov    -0x3c(%rbp),%r8d
imul   -0x68(%rbp),%r8d
add    %r8d,%edi
imul   %edi,%esi
add    %esi,%edx
imul   %edx,%ecx
mov    %ecx,%ecx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x80(%rbp)
mov    -0x78(%rbp),%rdi
call   1080 <_mm_loadu_pd@plt>
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%edi
mov    -0x9c(%rbp),%esi
call   1070 <_mm_mul_pd@plt>
mov    %eax,-0x84(%rbp)
mov    -0x78(%rbp),%rdi
mov    -0xa4(%rbp),%eax
shl    $0x3,%rax
add    %rax,%rdi
call   1080 <_mm_loadu_pd@plt>
mov    %eax,-0x88(%rbp)
mov    -0x88(%rbp),%edi
mov    -0x9c(%rbp),%esi
call   1070 <_mm_mul_pd@plt>
mov    %eax,-0x88(%rbp)
mov    -0x84(%rbp),%edi
mov    -0x88(%rbp),%esi
xor    %edx,%edx
call   1050 <_mm_shuffle_pd@plt>
mov    %eax,-0x8c(%rbp)
mov    -0x84(%rbp),%edi
mov    -0x88(%rbp),%esi
mov    $0x3,%edx
call   1050 <_mm_shuffle_pd@plt>
mov    %eax,-0x90(%rbp)
mov    -0x80(%rbp),%rdi
mov    -0x8c(%rbp),%esi
call   1060 <_mm_storeu_pd@plt>
mov    -0x80(%rbp),%rdi
mov    -0xa0(%rbp),%eax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x90(%rbp),%esi
call   1060 <_mm_storeu_pd@plt>
mov    -0x5c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x5c(%rbp)
jmp    12b4 <transpose_4321_loop_3241_+0x144>
jmp    1402 <transpose_4321_loop_3241_+0x292>
mov    -0x68(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x68(%rbp)
jmp    12a1 <transpose_4321_loop_3241_+0x131>
jmp    1415 <transpose_4321_loop_3241_+0x2a5>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    128e <transpose_4321_loop_3241_+0x11e>
jmp    1428 <transpose_4321_loop_3241_+0x2b8>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    127b <transpose_4321_loop_3241_+0x10b>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transpose_4321_loop_3241_>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %r9,%rbp
mov    %r8,%r14
mov    %rcx,%rbx
mov    %rdx,%r12
mov    %rsi,0x68(%rsp)
mov    %rdi,0x60(%rsp)
mov    0xc0(%rsp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,0x80(%rsp)
lea    0x80(%rsp),%rdi
call   1040 <_mm_load_sd@plt>
mov    %eax,%edi
mov    %eax,%esi
call   1030 <_mm_unpacklo_pd@plt>
mov    %eax,0x30(%rsp)
mov    (%r12),%eax
mov    (%rbx),%ebx
mov    %eax,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    (%r14),%r14d
mov    0x0(%rbp),%r15d
mulss  0xe1a(%rip),%xmm0
call   1090 <floor@plt>
mov    %ebx,0x18(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
mulss  0xe02(%rip),%xmm0
call   1090 <floor@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %r14d,%xmm0
mulss  0xded(%rip),%xmm0
call   1090 <floor@plt>
mov    %r15d,0xc(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %r15d,%xmm0
mulss  0xdd3(%rip),%xmm0
call   1090 <floor@plt>
mov    %r14d,0x1c(%rsp)
test   %r14d,%r14d
je     171b <transpose_4321_loop_3241_+0x5ab>
mov    0x1c(%rsp),%ecx
mov    %ecx,%r14d
mov    0x18(%rsp),%eax
imul   %eax,%r14d
mov    0xc(%rsp),%edx
imul   %edx,%r14d
mov    %eax,%esi
and    $0xfffffffe,%esi
mov    %esi,0x78(%rsp)
imul   %ecx,%edx
lea    (%rdx,%rdx,1),%ecx
mov    %ecx,0x74(%rsp)
mov    %rdx,0x58(%rsp)
mov    %edx,%ecx
imul   %eax,%ecx
add    %ecx,%ecx
mov    %ecx,0x34(%rsp)
movl   $0x0,0x50(%rsp)
movl   $0x0,0x20(%rsp)
mov    %r14,0x28(%rsp)
jmp    12c9 <transpose_4321_loop_3241_+0x159>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x20(%rsp),%edx
add    $0x1,%edx
mov    0xc(%rsp),%eax
add    %eax,0x50(%rsp)
mov    0x58(%rsp),%rcx
add    %eax,%ecx
mov    %rcx,0x58(%rsp)
mov    %edx,0x20(%rsp)
cmp    0x1c(%rsp),%edx
je     171b <transpose_4321_loop_3241_+0x5ab>
cmpl   $0x0,0x18(%rsp)
je     12a0 <transpose_4321_loop_3241_+0x130>
movl   $0x0,0x14(%rsp)
cmpl   $0x1,0x18(%rsp)
je     15bb <transpose_4321_loop_3241_+0x44b>
movl   $0x0,0x14(%rsp)
mov    0x58(%rsp),%rax
mov    %eax,0x54(%rsp)
mov    0x50(%rsp),%eax
mov    %eax,0x24(%rsp)
jmp    1321 <transpose_4321_loop_3241_+0x1b1>
xchg   %ax,%ax
mov    0x14(%rsp),%ecx
add    $0x2,%ecx
mov    0x74(%rsp),%eax
add    %eax,0x24(%rsp)
add    %eax,0x54(%rsp)
mov    %ecx,0x14(%rsp)
cmp    0x78(%rsp),%ecx
je     15b0 <transpose_4321_loop_3241_+0x440>
cmpl   $0x0,0xc(%rsp)
je     1300 <transpose_4321_loop_3241_+0x190>
movl   $0x0,0x8(%rsp)
jmp    1355 <transpose_4321_loop_3241_+0x1e5>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x8(%rsp),%eax
add    $0x2,%eax
mov    %eax,0x8(%rsp)
cmp    0xc(%rsp),%eax
jae    1460 <transpose_4321_loop_3241_+0x2f0>
cmpl   $0x0,0x10(%rsp)
mov    0x30(%rsp),%r12d
je     1340 <transpose_4321_loop_3241_+0x1d0>
mov    0x8(%rsp),%edx
mov    %edx,%eax
mov    0x60(%rsp),%rcx
lea    (%rcx,%rax,8),%rax
mov    %rax,0x40(%rsp)
mov    %edx,%eax
imul   0x1c(%rsp),%eax
add    0x20(%rsp),%eax
imul   0x18(%rsp),%eax
add    0x14(%rsp),%eax
imul   0x10(%rsp),%eax
mov    0x68(%rsp),%rcx
lea    (%rcx,%rax,8),%rax
mov    %rax,0x38(%rsp)
xor    %r13d,%r13d
mov    0x24(%rsp),%r15d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15d,%eax
mov    0x40(%rsp),%rcx
lea    (%rcx,%rax,8),%rbp
mov    %r13d,%eax
mov    0x38(%rsp),%rcx
lea    (%rcx,%rax,8),%rax
mov    %rax,0x48(%rsp)
mov    %rbp,%rdi
call   1080 <_mm_loadu_pd@plt>
mov    %eax,%edi
mov    %r12d,%esi
call   1070 <_mm_mul_pd@plt>
mov    %eax,%ebx
lea    0x0(,%r14,8),%rdi
add    %rbp,%rdi
call   1080 <_mm_loadu_pd@plt>
mov    %eax,%edi
mov    %r12d,%esi
call   1070 <_mm_mul_pd@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %eax,%esi
xor    %edx,%edx
call   1050 <_mm_shuffle_pd@plt>
mov    %eax,%r14d
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x3,%edx
call   1050 <_mm_shuffle_pd@plt>
mov    %eax,%ebx
mov    0x48(%rsp),%rbp
mov    %rbp,%rdi
mov    %r14d,%esi
mov    0x28(%rsp),%r14
call   1060 <_mm_storeu_pd@plt>
lea    0x0(,%r14,8),%rdi
add    %rbp,%rdi
mov    %ebx,%esi
call   1060 <_mm_storeu_pd@plt>
add    $0x2,%r13d
add    0x34(%rsp),%r15d
cmp    0x10(%rsp),%r13d
jb     13b0 <transpose_4321_loop_3241_+0x240>
jmp    1340 <transpose_4321_loop_3241_+0x1d0>
nopl   0x0(%rax,%rax,1)
cmpl   $0x0,0xc(%rsp)
je     1300 <transpose_4321_loop_3241_+0x190>
mov    0x14(%rsp),%eax
or     $0x1,%eax
mov    %eax,0x7c(%rsp)
movl   $0x0,0x8(%rsp)
jmp    1495 <transpose_4321_loop_3241_+0x325>
mov    0x8(%rsp),%eax
add    $0x2,%eax
mov    %eax,0x8(%rsp)
cmp    0xc(%rsp),%eax
jae    1300 <transpose_4321_loop_3241_+0x190>
cmpl   $0x0,0x10(%rsp)
mov    0x30(%rsp),%r12d
je     1480 <transpose_4321_loop_3241_+0x310>
mov    0x8(%rsp),%edx
mov    %edx,%eax
mov    0x60(%rsp),%rcx
lea    (%rcx,%rax,8),%rax
mov    %rax,0x40(%rsp)
mov    %edx,%eax
imul   0x1c(%rsp),%eax
add    0x20(%rsp),%eax
imul   0x18(%rsp),%eax
add    0x7c(%rsp),%eax
imul   0x10(%rsp),%eax
mov    0x68(%rsp),%rcx
lea    (%rcx,%rax,8),%rax
mov    %rax,0x38(%rsp)
xor    %r13d,%r13d
mov    0x54(%rsp),%r15d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15d,%eax
mov    0x40(%rsp),%rcx
lea    (%rcx,%rax,8),%rbp
mov    %r13d,%eax
mov    0x38(%rsp),%rcx
lea    (%rcx,%rax,8),%rax
mov    %rax,0x48(%rsp)
mov    %rbp,%rdi
call   1080 <_mm_loadu_pd@plt>
mov    %eax,%edi
mov    %r12d,%esi
call   1070 <_mm_mul_pd@plt>
mov    %eax,%ebx
mov    0x28(%rsp),%rax
lea    0x0(,%rax,8),%rdi
add    %rbp,%rdi
call   1080 <_mm_loadu_pd@plt>
mov    %eax,%edi
mov    %r12d,%esi
call   1070 <_mm_mul_pd@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %eax,%esi
xor    %edx,%edx
call   1050 <_mm_shuffle_pd@plt>
mov    %r12d,%r14d
mov    %eax,%r12d
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x3,%edx
call   1050 <_mm_shuffle_pd@plt>
mov    %eax,%ebx
mov    0x48(%rsp),%rbp
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %r14d,%r12d
call   1060 <_mm_storeu_pd@plt>
mov    0x28(%rsp),%rax
lea    0x0(,%rax,8),%rdi
add    %rbp,%rdi
mov    0x28(%rsp),%r14
mov    %ebx,%esi
call   1060 <_mm_storeu_pd@plt>
add    $0x2,%r13d
add    0x34(%rsp),%r15d
cmp    0x10(%rsp),%r13d
jb     14f0 <transpose_4321_loop_3241_+0x380>
jmp    1480 <transpose_4321_loop_3241_+0x310>
nopl   0x0(%rax,%rax,1)
testb  $0x1,0x18(%rsp)
je     12a0 <transpose_4321_loop_3241_+0x130>
cmpl   $0x0,0xc(%rsp)
je     12a0 <transpose_4321_loop_3241_+0x130>
mov    0x1c(%rsp),%eax
imul   0x14(%rsp),%eax
add    0x20(%rsp),%eax
imul   0xc(%rsp),%eax
mov    %eax,0x24(%rsp)
movl   $0x0,0x8(%rsp)
jmp    1605 <transpose_4321_loop_3241_+0x495>
cs nopw 0x0(%rax,%rax,1)
mov    0x8(%rsp),%eax
add    $0x2,%eax
mov    %eax,0x8(%rsp)
cmp    0xc(%rsp),%eax
jae    12a0 <transpose_4321_loop_3241_+0x130>
cmpl   $0x0,0x10(%rsp)
mov    0x30(%rsp),%r12d
je     15f0 <transpose_4321_loop_3241_+0x480>
mov    0x8(%rsp),%edx
mov    %edx,%eax
mov    0x60(%rsp),%rcx
lea    (%rcx,%rax,8),%rax
mov    %rax,0x40(%rsp)
mov    %edx,%eax
imul   0x1c(%rsp),%eax
add    0x20(%rsp),%eax
imul   0x18(%rsp),%eax
add    0x14(%rsp),%eax
imul   0x10(%rsp),%eax
mov    0x68(%rsp),%rcx
lea    (%rcx,%rax,8),%rax
mov    %rax,0x38(%rsp)
xor    %r13d,%r13d
mov    0x24(%rsp),%r15d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15d,%eax
mov    0x40(%rsp),%rcx
lea    (%rcx,%rax,8),%rbp
mov    %r13d,%eax
mov    0x38(%rsp),%rcx
lea    (%rcx,%rax,8),%rax
mov    %rax,0x48(%rsp)
mov    %rbp,%rdi
call   1080 <_mm_loadu_pd@plt>
mov    %eax,%edi
mov    %r12d,%esi
call   1070 <_mm_mul_pd@plt>
mov    %eax,%ebx
mov    0x28(%rsp),%rax
lea    0x0(,%rax,8),%rdi
add    %rbp,%rdi
call   1080 <_mm_loadu_pd@plt>
mov    %eax,%edi
mov    %r12d,%esi
call   1070 <_mm_mul_pd@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %eax,%esi
xor    %edx,%edx
call   1050 <_mm_shuffle_pd@plt>
mov    %r12d,%r14d
mov    %eax,%r12d
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x3,%edx
call   1050 <_mm_shuffle_pd@plt>
mov    %eax,%ebx
mov    0x48(%rsp),%rbp
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %r14d,%r12d
call   1060 <_mm_storeu_pd@plt>
mov    0x28(%rsp),%rax
lea    0x0(,%rax,8),%rdi
add    %rbp,%rdi
mov    0x28(%rsp),%r14
mov    %ebx,%esi
call   1060 <_mm_storeu_pd@plt>
add    $0x2,%r13d
add    0x34(%rsp),%r15d
cmp    0x10(%rsp),%r13d
jb     1660 <transpose_4321_loop_3241_+0x4f0>
jmp    15f0 <transpose_4321_loop_3241_+0x480>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @transpose_4321_loop_3241_(double* %0, double* %1, i32* nocapture %2, i32* nocapture %3, i32* nocapture %4, i32* nocapture %5, double* nocapture %6) {
%8 = alloca double
%9 = bitcast double* %8 to i8*
%10 = load double, double* %6
store double %10, double* %8
%11 = call i32 @_mm_load_sd(double* %8)
%12 = call i32 @_mm_unpacklo_pd(i32 %11, i32 %11)
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = sitofp i32 %13 to float
%18 = fmul float %17, 2.500000e-01
%19 = call i64 @floor(float %18)
%20 = sitofp i32 %14 to float
%21 = fmul float %20, 2.500000e-01
%22 = call i64 @floor(float %21)
%23 = sitofp i32 %15 to float
%24 = fmul float %23, 2.500000e-01
%25 = call i64 @floor(float %24)
%26 = sitofp i32 %16 to float
%27 = fmul float %26, 2.500000e-01
%28 = call i64 @floor(float %27)
%29 = icmp eq i32 %15, 0
br i1 %29, label %170, label %30
30: ; preds = %7
%31 = mul nsw i32 %15, %14
%32 = mul nsw i32 %31, %16
%33 = icmp eq i32 %16, 0
%34 = icmp eq i32 %13, 0
%35 = zext i32 %32 to i64
%36 = and i32 %14, 1
%37 = and i32 %14, -2
%38 = icmp eq i32 %36, 0
br label %39
39: ; preds = %30, %167
%40 = phi i32 [ 0, %30 ], [ %168, %167 ]
switch i32 %14, label %41 [
i32 0, label %167
i32 1, label %127
]
41: ; preds = %39, %122
%42 = phi i32 [ %123, %122 ], [ 0, %39 ]
%43 = phi i32 [ %124, %122 ], [ 0, %39 ]
br i1 %33, label %122, label %44
44: ; preds = %41, %79
%45 = phi i32 [ %80, %79 ], [ 0, %41 ]
br i1 %34, label %79, label %46
46: ; preds = %44
%47 = zext i32 %45 to i64
%48 = getelementptr inbounds double, double* %0, i64 %47
%49 = mul i32 %45, %15
%50 = add i32 %49, %40
%51 = mul i32 %50, %14
%52 = add i32 %51, %42
%53 = mul i32 %52, %13
%54 = zext i32 %53 to i64
%55 = getelementptr inbounds double, double* %1, i64 %54
br label %56
56: ; preds = %46, %56
%57 = phi i32 [ 0, %46 ], [ %77, %56 ]
%58 = mul i32 %57, %14
%59 = add i32 %58, %42
%60 = mul i32 %59, %15
%61 = add i32 %60, %40
%62 = mul i32 %61, %16
%63 = zext i32 %62 to i64
%64 = getelementptr inbounds double, double* %48, i64 %63
%65 = zext i32 %57 to i64
%66 = getelementptr inbounds double, double* %55, i64 %65
%67 = call i32 @_mm_loadu_pd(double* %64)
%68 = call i32 @_mm_mul_pd(i32 %67, i32 %12)
%69 = getelementptr inbounds double, double* %64, i64 %35
%70 = call i32 @_mm_loadu_pd(double* %69)
%71 = call i32 @_mm_mul_pd(i32 %70, i32 %12)
%72 = call i32 @_mm_shuffle_pd(i32 %68, i32 %71, i32 0)
%73 = call i32 @_mm_shuffle_pd(i32 %68, i32 %71, i32 3)
%74 = call i32 @_mm_storeu_pd(double* %66, i32 %72)
%75 = getelementptr inbounds double, double* %66, i64 %35
%76 = call i32 @_mm_storeu_pd(double* %75, i32 %73)
%77 = add i32 %57, 2
%78 = icmp ult i32 %77, %13
br i1 %78, label %56, label %79
79: ; preds = %56, %44
%80 = add i32 %45, 2
%81 = icmp ult i32 %80, %16
br i1 %81, label %44, label %82
82: ; preds = %79
%83 = or i32 %42, 1
br i1 %33, label %122, label %84
84: ; preds = %82, %119
%85 = phi i32 [ %120, %119 ], [ 0, %82 ]
br i1 %34, label %119, label %86
86: ; preds = %84
%87 = zext i32 %85 to i64
%88 = getelementptr inbounds double, double* %0, i64 %87
%89 = mul i32 %85, %15
%90 = add i32 %89, %40
%91 = mul i32 %90, %14
%92 = add i32 %91, %83
%93 = mul i32 %92, %13
%94 = zext i32 %93 to i64
%95 = getelementptr inbounds double, double* %1, i64 %94
br label %96
96: ; preds = %96, %86
%97 = phi i32 [ 0, %86 ], [ %117, %96 ]
%98 = mul i32 %97, %14
%99 = add i32 %98, %83
%100 = mul i32 %99, %15
%101 = add i32 %100, %40
%102 = mul i32 %101, %16
%103 = zext i32 %102 to i64
%104 = getelementptr inbounds double, double* %88, i64 %103
%105 = zext i32 %97 to i64
%106 = getelementptr inbounds double, double* %95, i64 %105
%107 = call i32 @_mm_loadu_pd(double* %104)
%108 = call i32 @_mm_mul_pd(i32 %107, i32 %12)
%109 = getelementptr inbounds double, double* %104, i64 %35
%110 = call i32 @_mm_loadu_pd(double* %109)
%111 = call i32 @_mm_mul_pd(i32 %110, i32 %12)
%112 = call i32 @_mm_shuffle_pd(i32 %108, i32 %111, i32 0)
%113 = call i32 @_mm_shuffle_pd(i32 %108, i32 %111, i32 3)
%114 = call i32 @_mm_storeu_pd(double* %106, i32 %112)
%115 = getelementptr inbounds double, double* %106, i64 %35
%116 = call i32 @_mm_storeu_pd(double* %115, i32 %113)
%117 = add i32 %97, 2
%118 = icmp ult i32 %117, %13
br i1 %118, label %96, label %119
119: ; preds = %96, %84
%120 = add i32 %85, 2
%121 = icmp ult i32 %120, %16
br i1 %121, label %84, label %122
122: ; preds = %119, %41, %82
%123 = add nuw i32 %42, 2
%124 = add i32 %43, 2
%125 = icmp eq i32 %124, %37
br i1 %125, label %126, label %41
126: ; preds = %122
br i1 %38, label %167, label %127
127: ; preds = %39, %126
%128 = phi i32 [ %123, %126 ], [ 0, %39 ]
br i1 %33, label %167, label %129
129: ; preds = %127, %164
%130 = phi i32 [ %165, %164 ], [ 0, %127 ]
br i1 %34, label %164, label %131
131: ; preds = %129
%132 = zext i32 %130 to i64
%133 = getelementptr inbounds double, double* %0, i64 %132
%134 = mul i32 %130, %15
%135 = add i32 %134, %40
%136 = mul i32 %135, %14
%137 = add i32 %136, %128
%138 = mul i32 %137, %13
%139 = zext i32 %138 to i64
%140 = getelementptr inbounds double, double* %1, i64 %139
br label %141
141: ; preds = %141, %131
%142 = phi i32 [ 0, %131 ], [ %162, %141 ]
%143 = mul i32 %142, %14
%144 = add i32 %143, %128
%145 = mul i32 %144, %15
%146 = add i32 %145, %40
%147 = mul i32 %146, %16
%148 = zext i32 %147 to i64
%149 = getelementptr inbounds double, double* %133, i64 %148
%150 = zext i32 %142 to i64
%151 = getelementptr inbounds double, double* %140, i64 %150
%152 = call i32 @_mm_loadu_pd(double* %149)
%153 = call i32 @_mm_mul_pd(i32 %152, i32 %12)
%154 = getelementptr inbounds double, double* %149, i64 %35
%155 = call i32 @_mm_loadu_pd(double* %154)
%156 = call i32 @_mm_mul_pd(i32 %155, i32 %12)
%157 = call i32 @_mm_shuffle_pd(i32 %153, i32 %156, i32 0)
%158 = call i32 @_mm_shuffle_pd(i32 %153, i32 %156, i32 3)
%159 = call i32 @_mm_storeu_pd(double* %151, i32 %157)
%160 = getelementptr inbounds double, double* %151, i64 %35
%161 = call i32 @_mm_storeu_pd(double* %160, i32 %158)
%162 = add i32 %142, 2
%163 = icmp ult i32 %162, %13
br i1 %163, label %141, label %164
164: ; preds = %141, %129
%165 = add i32 %130, 2
%166 = icmp ult i32 %165, %16
br i1 %166, label %129, label %167
167: ; preds = %164, %39, %126, %127
%168 = add nuw i32 %40, 1
%169 = icmp eq i32 %168, %15
br i1 %169, label %170, label %39
170: ; preds = %167, %7
ret void
}