void trsp_blk(long N, long N_SQRT, long TR_BS,
              double _Complex data[N_SQRT][N_SQRT]) {
  long i, j;
  for (i = 0; i < TR_BS; i += 8) {
    for (j = 0; j < i; j += 8) {
      middle_trsp_swap(N, N_SQRT, (double _Complex(*)[N_SQRT]) & data[i][j],
                       (double _Complex(*)[N_SQRT]) & data[j][i]);
    }
    middle_trsp_blk(N, N_SQRT, (double _Complex(*)[N_SQRT]) & data[i][i]);
  }
}


x86 assembly (clang, -O0):
<trsp_blk>:
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,-0x38(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    1208 <trsp_blk+0xe8>
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    11c9 <trsp_blk+0xa9>
mov    -0x38(%rbp),%rax
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    %rax,%rcx
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 <middle_trsp_swap@plt>
mov    -0x30(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x30(%rbp)
jmp    115e <trsp_blk+0x3e>
mov    -0x38(%rbp),%rax
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
imul   -0x28(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rdx
mov    -0x28(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rdx
mov    $0x0,%al
call   1040 <middle_trsp_blk@plt>
mov    -0x28(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x28(%rbp)
jmp    1148 <trsp_blk+0x28>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trsp_blk>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rcx,0x8(%rsp)
mov    %rdx,0x18(%rsp)
test   %rdx,%rdx
jle    1207 <trsp_blk+0xe7>
mov    %rsi,%r14
mov    %rdi,%r13
mov    %rsi,%r15
shl    $0x7,%r15
mov    0x8(%rsp),%rbp
mov    %rbp,%rbx
xor    %r12d,%r12d
mov    %rsi,0x10(%rsp)
jmp    1194 <trsp_blk+0x74>
xor    %eax,%eax
shl    $0x4,%rax
add    0x8(%rsp),%rax
mov    %r12,%rdx
shl    $0x4,%rdx
add    %rax,%rdx
mov    %r13,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <middle_trsp_blk@plt>
add    $0x8,%r12
sub    $0xffffffffffffff80,%rbp
add    %r15,%rbx
cmp    0x18(%rsp),%r12
jge    1207 <trsp_blk+0xe7>
test   %r12,%r12
je     1160 <trsp_blk+0x40>
mov    %r12,%rax
imul   %r14,%rax
mov    %rax,0x20(%rsp)
mov    %r13,%r14
mov    %rbx,0x30(%rsp)
mov    %rbp,0x28(%rsp)
mov    %r12,%r13
xor    %r12d,%r12d
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    0x10(%rsp),%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1030 <middle_trsp_swap@plt>
add    $0x8,%r12
add    %r15,%rbp
sub    $0xffffffffffffff80,%rbx
cmp    %r13,%r12
jb     11c0 <trsp_blk+0xa0>
mov    %r14,%rax
mov    0x10(%rsp),%r14
mov    0x30(%rsp),%rbx
mov    0x28(%rsp),%rbp
mov    %r13,%r12
mov    %rax,%r13
mov    0x20(%rsp),%rax
jmp    1162 <trsp_blk+0x42>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @trsp_blk(i64 %0, i64 %1, i64 %2, { double, double }* %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca { double, double }*
%9 = alloca i64
%10 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store { double, double }* %3, { double, double }** %8
%11 = load i64, i64* %6
%12 = load i64, i64* %6
store i64 0, i64* %9
br label %13
13: ; preds = %54, %4
%14 = load i64, i64* %9
%15 = load i64, i64* %7
%16 = icmp slt i64 %14, %15
br i1 %16, label %17, label %57
17: ; preds = %13
store i64 0, i64* %10
br label %18
18: ; preds = %40, %17
%19 = load i64, i64* %10
%20 = load i64, i64* %9
%21 = icmp slt i64 %19, %20
br i1 %21, label %22, label %43
22: ; preds = %18
%23 = load i64, i64* %5
%24 = load i64, i64* %6
%25 = load i64, i64* %6
%26 = load { double, double }*, { double, double }** %8
%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, %12
%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 (...)* @middle_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, 8
store i64 %42, i64* %10
br label %18
43: ; preds = %18
%44 = load i64, i64* %5
%45 = load i64, i64* %6
%46 = load i64, i64* %6
%47 = load { double, double }*, { double, double }** %8
%48 = load i64, i64* %9
%49 = mul nsw i64 %48, %12
%50 = getelementptr inbounds { double, double }, { double, double }* %47, i64 %49
%51 = load i64, i64* %9
%52 = getelementptr inbounds { double, double }, { double, double }* %50, i64 %51
%53 = call i32 (i64, i64, { double, double }*, ...) bitcast (i32 (...)* @middle_trsp_blk to i32 (i64, i64, { double, double }*, ...)*)(i64 %44, i64 %45, { double, double }* %52)
br label %54
54: ; preds = %43
%55 = load i64, i64* %9
%56 = add nsw i64 %55, 8
store i64 %56, i64* %9
br label %13
57: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @trsp_blk(i64 %0, i64 %1, i64 %2, { double, double }* %3) {
%5 = icmp sgt i64 %2, 0
br i1 %5, label %6, label %28
6: ; preds = %4, %21
%7 = phi i64 [ %26, %21 ], [ 0, %4 ]
%8 = icmp eq i64 %7, 0
br i1 %8, label %21, label %9
9: ; preds = %6
%10 = mul nsw i64 %7, %1
%11 = getelementptr inbounds { double, double }, { double, double }* %3, i64 %10
%12 = getelementptr inbounds { double, double }, { double, double }* %3, i64 %7
br label %13
13: ; preds = %9, %13
%14 = phi i64 [ 0, %9 ], [ %19, %13 ]
%15 = getelementptr inbounds { double, double }, { double, double }* %11, i64 %14
%16 = mul nsw i64 %14, %1
%17 = getelementptr inbounds { double, double }, { double, double }* %12, i64 %16
%18 = tail call i32 (i64, i64, { double, double }*, { double, double }*, ...) bitcast (i32 (...)* @middle_trsp_swap to i32 (i64, i64, { double, double }*, { double, double }*, ...)*)(i64 %0, i64 %1, { double, double }* %15, { double, double }* %17)
%19 = add nuw nsw i64 %14, 8
%20 = icmp ult i64 %19, %7
br i1 %20, label %13, label %21
21: ; preds = %13, %6
%22 = phi i64 [ 0, %6 ], [ %10, %13 ]
%23 = getelementptr inbounds { double, double }, { double, double }* %3, i64 %22
%24 = getelementptr inbounds { double, double }, { double, double }* %23, i64 %7
%25 = tail call i32 (i64, i64, { double, double }*, ...) bitcast (i32 (...)* @middle_trsp_blk to i32 (i64, i64, { double, double }*, ...)*)(i64 %0, i64 %1, { double, double }* %24)
%26 = add nuw nsw i64 %7, 8
%27 = icmp slt i64 %26, %2
br i1 %27, label %6, label %28
28: ; preds = %21, %4
ret void
}