void middle_trsp_swap(long N, long N_SQRT,
                      double _Complex data1[N_SQRT][N_SQRT],
                      double _Complex data2[N_SQRT][N_SQRT]) {
  long i, j;
  for (i = 0; i < 8; i += 4) {
    for (j = 0; j < 8; j += 4) {
      micro_trsp_swap(N, N_SQRT, (double _Complex(*)[N_SQRT]) & data1[i][j],
                      (double _Complex(*)[N_SQRT]) & data2[j][i]);
    }
  }
}


x86 assembly (clang, -O0):
<middle_trsp_swap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
movq   $0x0,-0x28(%rbp)
cmpq   $0x8,-0x28(%rbp)
jge    11d2 <middle_trsp_swap+0xc2>
movq   $0x0,-0x30(%rbp)
cmpq   $0x8,-0x30(%rbp)
jge    11bc <middle_trsp_swap+0xac>
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
imul   -0x28(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rdx
mov    -0x30(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rdx
mov    -0x20(%rbp),%rcx
imul   -0x30(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rcx
mov    -0x28(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rcx
mov    $0x0,%al
call   1030 <micro_trsp_swap@plt>
mov    -0x30(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x30(%rbp)
jmp    1153 <middle_trsp_swap+0x43>
jmp    11c1 <middle_trsp_swap+0xb1>
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x28(%rbp)
jmp    1140 <middle_trsp_swap+0x30>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<middle_trsp_swap>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%r15
xor    %eax,%eax
call   1030 <micro_trsp_swap@plt>
lea    0x40(%r12),%rdx
mov    %r13,%rbx
shl    $0x6,%rbx
lea    (%r14,%rbx,1),%rcx
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1030 <micro_trsp_swap@plt>
lea    (%r12,%rbx,1),%rdx
lea    0x40(%r14),%rcx
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1030 <micro_trsp_swap@plt>
lea    (%r12,%rbx,1),%rdx
add    $0x40,%rdx
lea    (%r14,%rbx,1),%rcx
add    $0x40,%rcx
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <micro_trsp_swap@plt>

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

LLVM IR (-O2):
define void @middle_trsp_swap(i64 %0, i64 %1, { double, double }* %2, { double, double }* %3) {
%5 = tail call i32 (i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_trsp_swap to i32 (i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, { double, double }* %2, { double, double }* %3)
%6 = getelementptr inbounds { double, double }, { double, double }* %2, i64 4
%7 = shl nsw i64 %1, 2
%8 = getelementptr inbounds { double, double }, { double, double }* %3, i64 %7
%9 = tail call i32 (i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_trsp_swap to i32 (i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, { double, double }* %6, { double, double }* %8)
%10 = getelementptr inbounds { double, double }, { double, double }* %2, i64 %7
%11 = getelementptr inbounds { double, double }, { double, double }* %3, i64 4
%12 = tail call i32 (i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_trsp_swap to i32 (i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, { double, double }* %10, { double, double }* %11)
%13 = getelementptr inbounds { double, double }, { double, double }* %10, i64 4
%14 = getelementptr inbounds { double, double }, { double, double }* %11, i64 %7
%15 = tail call i32 (i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @micro_trsp_swap to i32 (i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, { double, double }* %13, { double, double }* %14)
ret void
}