int transposta(double mtx[3][3], double resp[3][3]) {
  int i, j;
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      resp[i][j] = mtx[j][i];
    }
  }
}


x86 assembly (clang, -O0):
<transposta>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    117f <transposta+0x7f>
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jge    116c <transposta+0x6c>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1124 <transposta+0x24>
jmp    1171 <transposta+0x71>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1113 <transposta+0x13>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<transposta>:
movsd  (%rdi),%xmm0
movsd  %xmm0,(%rsi)
movsd  0x18(%rdi),%xmm0
movsd  %xmm0,0x8(%rsi)
movsd  0x30(%rdi),%xmm0
movsd  %xmm0,0x10(%rsi)
movsd  0x8(%rdi),%xmm0
movsd  %xmm0,0x18(%rsi)
movsd  0x20(%rdi),%xmm0
movsd  %xmm0,0x20(%rsi)
movsd  0x38(%rdi),%xmm0
movsd  %xmm0,0x28(%rsi)
movsd  0x10(%rdi),%xmm0
movsd  %xmm0,0x30(%rsi)
movsd  0x28(%rdi),%xmm0
movsd  %xmm0,0x38(%rsi)
movsd  0x40(%rdi),%xmm0
movsd  %xmm0,0x40(%rsi)
ret

LLVM IR (-O0):
define i32 @transposta([3 x double]* %0, [3 x double]* %1) {
%3 = alloca i32
%4 = alloca [3 x double]*
%5 = alloca [3 x double]*
%6 = alloca i32
%7 = alloca i32
store [3 x double]* %0, [3 x double]** %4
store [3 x double]* %1, [3 x double]** %5
store i32 0, i32* %6
br label %8
8: ; preds = %35, %2
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %38
11: ; preds = %8
store i32 0, i32* %7
br label %12
12: ; preds = %31, %11
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, 3
br i1 %14, label %15, label %34
15: ; preds = %12
%16 = load [3 x double]*, [3 x double]** %4
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [3 x double], [3 x double]* %16, i64 %18
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [3 x double], [3 x double]* %19, i64 0, i64 %21
%23 = load double, double* %22
%24 = load [3 x double]*, [3 x double]** %5
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 %26
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [3 x double], [3 x double]* %27, i64 0, i64 %29
store double %23, double* %30
br label %31
31: ; preds = %15
%32 = load i32, i32* %7
%33 = add nsw i32 %32, 1
store i32 %33, i32* %7
br label %12
34: ; preds = %12
br label %35
35: ; preds = %34
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %8
38: ; preds = %8
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
define i32 @transposta([3 x double]* nocapture %0, [3 x double]* nocapture writeonly %1) {
%3 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 0
%4 = load double, double* %3
%5 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
store double %4, double* %5
%6 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 0
%7 = load double, double* %6
%8 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 1
store double %7, double* %8
%9 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 0
%10 = load double, double* %9
%11 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 2
store double %10, double* %11
%12 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 1
%13 = load double, double* %12
%14 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 0
store double %13, double* %14
%15 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 1
%16 = load double, double* %15
%17 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 1
store double %16, double* %17
%18 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 1
%19 = load double, double* %18
%20 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 2
store double %19, double* %20
%21 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 2
%22 = load double, double* %21
%23 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 0
store double %22, double* %23
%24 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 2
%25 = load double, double* %24
%26 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 1
store double %25, double* %26
%27 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 2
%28 = load double, double* %27
%29 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 2
store double %28, double* %29
ret i32 undef
}