void middle_tw_trsp_swap(long N, long N_SQRT, long I, long J,
                         double _Complex data1[N_SQRT][N_SQRT],
                         double _Complex data2[N_SQRT][N_SQRT]) {
  long i, j;
  for (i = 0; i < 8; i += 2) {
    for (j = 0; j < 8; j += 2) {
      micro_tw_trsp_swap(N, N_SQRT, I + i, J + j,
                         (double _Complex(*)[N_SQRT]) & data1[i][j],
                         (double _Complex(*)[N_SQRT]) & data2[j][i]);
    }
  }
}


x86 assembly (clang, -O0):
<middle_tw_trsp_swap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
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
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
movq   $0x0,-0x38(%rbp)
cmpq   $0x8,-0x38(%rbp)
jge    11ea <middle_tw_trsp_swap+0xda>
movq   $0x0,-0x40(%rbp)
cmpq   $0x8,-0x40(%rbp)
jge    11d4 <middle_tw_trsp_swap+0xc4>
mov    -0x48(%rbp),%rax
mov    -0x50(%rbp),%r9
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    -0x38(%rbp),%rdx
mov    -0x20(%rbp),%rcx
add    -0x40(%rbp),%rcx
mov    -0x28(%rbp),%r8
imul   -0x38(%rbp),%r9
shl    $0x4,%r9
add    %r9,%r8
mov    -0x40(%rbp),%r9
shl    $0x4,%r9
add    %r9,%r8
mov    -0x30(%rbp),%r9
imul   -0x40(%rbp),%rax
shl    $0x4,%rax
add    %rax,%r9
mov    -0x38(%rbp),%rax
shl    $0x4,%rax
add    %rax,%r9
mov    $0x0,%al
call   1030 <micro_tw_trsp_swap@plt>
mov    -0x40(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x40(%rbp)
jmp    115b <middle_tw_trsp_swap+0x4b>
jmp    11d9 <middle_tw_trsp_swap+0xc9>
mov    -0x38(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x38(%rbp)
jmp    1148 <middle_tw_trsp_swap+0x38>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<middle_tw_trsp_swap>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9,%r15
mov    %r9,0x50(%rsp)
mov    %r8,%r12
mov    %rsi,%rbp
lea    0x2(%rcx),%rax
mov    %rax,0x10(%rsp)
lea    0x4(%rcx),%rax
mov    %rax,0x8(%rsp)
lea    0x6(%rcx),%rax
mov    %rax,(%rsp)
mov    %rcx,0x28(%rsp)
mov    %rdi,%r13
mov    %rdi,0x30(%rsp)
mov    %rdx,%r14
xor    %eax,%eax
call   1030 <micro_tw_trsp_swap@plt>
lea    0x20(%r12),%r8
mov    %rbp,%rbx
shl    $0x5,%rbx
lea    (%r15,%rbx,1),%r9
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %r14,0x48(%rsp)
mov    %r14,%rdx
mov    0x10(%rsp),%rcx
xor    %eax,%eax
call   1030 <micro_tw_trsp_swap@plt>
lea    0x40(%r12),%r8
mov    %rbp,%rax
shl    $0x6,%rax
mov    %rax,0x20(%rsp)
lea    (%r15,%rax,1),%r9
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
mov    0x8(%rsp),%rcx
xor    %eax,%eax
call   1030 <micro_tw_trsp_swap@plt>
lea    0x60(%r12),%r8
lea    (%rbx,%rbx,2),%rax
mov    %rax,0x40(%rsp)
lea    (%r15,%rax,1),%r9
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
mov    (%rsp),%rcx
xor    %eax,%eax
call   1030 <micro_tw_trsp_swap@plt>
add    $0x2,%r14
lea    (%r12,%rbx,1),%r8
lea    0x20(%r15),%r9
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
mov    0x28(%rsp),%rcx
xor    %eax,%eax
call   1030 <micro_tw_trsp_swap@plt>
lea    (%r12,%rbx,1),%r8
add    $0x20,%r8
lea    0x20(%r15,%rbx,1),%r9
mov    %rbx,0x38(%rsp)
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
mov    %r14,%r13
mov    %r14,0x18(%rsp)
mov    0x10(%rsp),%rcx
xor    %eax,%eax
call   1030 <micro_tw_trsp_swap@plt>
lea    (%r12,%rbx,1),%r8
add    $0x40,%r8
mov    0x20(%rsp),%r15
mov    0x50(%rsp),%r14
lea    0x20(%r14,%r15,1),%r9
mov    0x30(%rsp),%rdi
mov    %rbp,%rsi
mov    %r13,%rdx
mov    0x8(%rsp),%rcx
xor    %eax,%eax
call   1030 <micro_tw_trsp_swap@plt>
lea    (%r12,%rbx,1),%r8
add    $0x60,%r8
mov    0x40(%rsp),%rax
lea    0x20(%r14,%rax,1),%r9
mov    0x30(%rsp),%r13
mov    %r13,%rdi
mov    %rbp,%rsi
mov    0x18(%rsp),%rdx
mov    (%rsp),%rcx
xor    %eax,%eax
call   1030 <micro_tw_trsp_swap@plt>
mov    0x48(%rsp),%rax
lea    0x4(%rax),%rbx
lea    (%r12,%r15,1),%r8
lea    0x40(%r14),%r9
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    0x28(%rsp),%rcx
xor    %eax,%eax
call   1030 <micro_tw_trsp_swap@plt>
lea    (%r12,%r15,1),%r8
add    $0x20,%r8
mov    0x38(%rsp),%rax
mov    %r14,%r15
lea    0x40(%r14,%rax,1),%r9
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    %rbx,%r14
mov    %rbx,0x18(%rsp)
mov    0x10(%rsp),%rcx
xor    %eax,%eax
call   1030 <micro_tw_trsp_swap@plt>
mov    0x20(%rsp),%rax
lea    (%r12,%rax,1),%r8
add    $0x40,%r8
lea    0x40(%r15,%rax,1),%r9
mov    %rax,%rbx
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
mov    0x8(%rsp),%rcx
xor    %eax,%eax
call   1030 <micro_tw_trsp_swap@plt>
lea    (%r12,%rbx,1),%r8
add    $0x60,%r8
mov    0x40(%rsp),%r14
lea    0x40(%r15,%r14,1),%r9
mov    %r13,%rdi
mov    %rbp,%rsi
mov    0x18(%rsp),%rdx
mov    (%rsp),%rcx
xor    %eax,%eax
call   1030 <micro_tw_trsp_swap@plt>
mov    0x48(%rsp),%rbx
add    $0x6,%rbx
lea    (%r12,%r14,1),%r8
lea    0x60(%r15),%r9
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    0x28(%rsp),%rcx
xor    %eax,%eax
call   1030 <micro_tw_trsp_swap@plt>
lea    (%r12,%r14,1),%r8
add    $0x20,%r8
mov    0x38(%rsp),%rax
lea    0x60(%r15,%rax,1),%r9
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    0x10(%rsp),%rcx
xor    %eax,%eax
call   1030 <micro_tw_trsp_swap@plt>
lea    (%r12,%r14,1),%r8
add    $0x40,%r8
mov    0x20(%rsp),%rax
lea    0x60(%r15,%rax,1),%r9
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    0x8(%rsp),%rcx
xor    %eax,%eax
call   1030 <micro_tw_trsp_swap@plt>
lea    (%r12,%r14,1),%r8
add    $0x60,%r8
lea    0x60(%r15,%r14,1),%r9
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    (%rsp),%rcx
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <micro_tw_trsp_swap@plt>

LLVM IR (-O0):
define void @middle_tw_trsp_swap(i64 %0, i64 %1, i64 %2, i64 %3, { double, double }* %4, { double, double }* %5) {
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca { double, double }*
%12 = alloca { double, double }*
%13 = alloca i64
%14 = alloca i64
store i64 %0, i64* %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store i64 %3, i64* %10
store { double, double }* %4, { double, double }** %11
store { double, double }* %5, { double, double }** %12
%15 = load i64, i64* %8
%16 = load i64, i64* %8
%17 = load i64, i64* %8
%18 = load i64, i64* %8
store i64 0, i64* %13
br label %19
19: ; preds = %54, %6
%20 = load i64, i64* %13
%21 = icmp slt i64 %20, 8
br i1 %21, label %22, label %57
22: ; preds = %19
store i64 0, i64* %14
br label %23
23: ; preds = %50, %22
%24 = load i64, i64* %14
%25 = icmp slt i64 %24, 8
br i1 %25, label %26, label %53
26: ; preds = %23
%27 = load i64, i64* %7
%28 = load i64, i64* %8
%29 = load i64, i64* %9
%30 = load i64, i64* %13
%31 = add nsw i64 %29, %30
%32 = load i64, i64* %10
%33 = load i64, i64* %14
%34 = add nsw i64 %32, %33
%35 = load i64, i64* %8
%36 = load { double, double }*, { double, double }** %11
%37 = load i64, i64* %13
%38 = mul nsw i64 %37, %16
%39 = getelementptr inbounds { double, double }, { double, double }* %36, i64 %38
%40 = load i64, i64* %14
%41 = getelementptr inbounds { double, double }, { double, double }* %39, i64 %40
%42 = load i64, i64* %8
%43 = load { double, double }*, { double, double }** %12
%44 = load i64, i64* %14
%45 = mul nsw i64 %44, %18
%46 = getelementptr inbounds { double, double }, { double, double }* %43, i64 %45
%47 = load i64, i64* %13
%48 = getelementptr inbounds { double, double }, { double, double }* %46, i64 %47
%49 = call i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_tw_trsp_swap to i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %27, i64 %28, i64 %31, i64 %34, { double, double }* %41, { double, double }* %48)
br label %50
50: ; preds = %26
%51 = load i64, i64* %14
%52 = add nsw i64 %51, 2
store i64 %52, i64* %14
br label %23
53: ; preds = %23
br label %54
54: ; preds = %53
%55 = load i64, i64* %13
%56 = add nsw i64 %55, 2
store i64 %56, i64* %13
br label %19
57: ; preds = %19
ret void
}

LLVM IR (-O2):
define void @middle_tw_trsp_swap(i64 %0, i64 %1, i64 %2, i64 %3, { double, double }* %4, { double, double }* %5) {
%7 = add nsw i64 %3, 2
%8 = shl nsw i64 %1, 1
%9 = add nsw i64 %3, 4
%10 = shl nsw i64 %1, 2
%11 = add nsw i64 %3, 6
%12 = mul nsw i64 %1, 6
%13 = tail call i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_tw_trsp_swap to i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, i64 %2, i64 %3, { double, double }* %4, { double, double }* %5)
%14 = getelementptr inbounds { double, double }, { double, double }* %4, i64 2
%15 = getelementptr inbounds { double, double }, { double, double }* %5, i64 %8
%16 = tail call i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_tw_trsp_swap to i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, i64 %2, i64 %7, { double, double }* %14, { double, double }* %15)
%17 = getelementptr inbounds { double, double }, { double, double }* %4, i64 4
%18 = getelementptr inbounds { double, double }, { double, double }* %5, i64 %10
%19 = tail call i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_tw_trsp_swap to i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, i64 %2, i64 %9, { double, double }* %17, { double, double }* %18)
%20 = getelementptr inbounds { double, double }, { double, double }* %4, i64 6
%21 = getelementptr inbounds { double, double }, { double, double }* %5, i64 %12
%22 = tail call i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_tw_trsp_swap to i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, i64 %2, i64 %11, { double, double }* %20, { double, double }* %21)
%23 = add nsw i64 %2, 2
%24 = shl nsw i64 %1, 1
%25 = getelementptr inbounds { double, double }, { double, double }* %4, i64 %24
%26 = getelementptr inbounds { double, double }, { double, double }* %5, i64 2
%27 = tail call i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_tw_trsp_swap to i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, i64 %23, i64 %3, { double, double }* %25, { double, double }* %26)
%28 = getelementptr inbounds { double, double }, { double, double }* %25, i64 2
%29 = getelementptr inbounds { double, double }, { double, double }* %26, i64 %8
%30 = tail call i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_tw_trsp_swap to i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, i64 %23, i64 %7, { double, double }* %28, { double, double }* %29)
%31 = getelementptr inbounds { double, double }, { double, double }* %25, i64 4
%32 = getelementptr inbounds { double, double }, { double, double }* %26, i64 %10
%33 = tail call i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_tw_trsp_swap to i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, i64 %23, i64 %9, { double, double }* %31, { double, double }* %32)
%34 = getelementptr inbounds { double, double }, { double, double }* %25, i64 6
%35 = getelementptr inbounds { double, double }, { double, double }* %26, i64 %12
%36 = tail call i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_tw_trsp_swap to i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, i64 %23, i64 %11, { double, double }* %34, { double, double }* %35)
%37 = add nsw i64 %2, 4
%38 = shl nsw i64 %1, 2
%39 = getelementptr inbounds { double, double }, { double, double }* %4, i64 %38
%40 = getelementptr inbounds { double, double }, { double, double }* %5, i64 4
%41 = tail call i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_tw_trsp_swap to i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, i64 %37, i64 %3, { double, double }* %39, { double, double }* %40)
%42 = getelementptr inbounds { double, double }, { double, double }* %39, i64 2
%43 = getelementptr inbounds { double, double }, { double, double }* %40, i64 %8
%44 = tail call i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_tw_trsp_swap to i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, i64 %37, i64 %7, { double, double }* %42, { double, double }* %43)
%45 = getelementptr inbounds { double, double }, { double, double }* %39, i64 4
%46 = getelementptr inbounds { double, double }, { double, double }* %40, i64 %10
%47 = tail call i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_tw_trsp_swap to i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, i64 %37, i64 %9, { double, double }* %45, { double, double }* %46)
%48 = getelementptr inbounds { double, double }, { double, double }* %39, i64 6
%49 = getelementptr inbounds { double, double }, { double, double }* %40, i64 %12
%50 = tail call i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_tw_trsp_swap to i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, i64 %37, i64 %11, { double, double }* %48, { double, double }* %49)
%51 = add nsw i64 %2, 6
%52 = mul nsw i64 %1, 6
%53 = getelementptr inbounds { double, double }, { double, double }* %4, i64 %52
%54 = getelementptr inbounds { double, double }, { double, double }* %5, i64 6
%55 = tail call i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_tw_trsp_swap to i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, i64 %51, i64 %3, { double, double }* %53, { double, double }* %54)
%56 = getelementptr inbounds { double, double }, { double, double }* %53, i64 2
%57 = getelementptr inbounds { double, double }, { double, double }* %54, i64 %8
%58 = tail call i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_tw_trsp_swap to i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, i64 %51, i64 %7, { double, double }* %56, { double, double }* %57)
%59 = getelementptr inbounds { double, double }, { double, double }* %53, i64 4
%60 = getelementptr inbounds { double, double }, { double, double }* %54, i64 %10
%61 = tail call i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_tw_trsp_swap to i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, i64 %51, i64 %9, { double, double }* %59, { double, double }* %60)
%62 = getelementptr inbounds { double, double }, { double, double }* %53, i64 6
%63 = getelementptr inbounds { double, double }, { double, double }* %54, i64 %12
%64 = tail call i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_tw_trsp_swap to i32 (i64, i64, i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, i64 %51, i64 %11, { double, double }* %62, { double, double }* %63)
ret void
}