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

/* Variables and functions */
float Round(float);
void MatrixTranspose(float mat[3][3], float result[3][3]) {
  int i, j;
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      result[i][j] = Round(mat[j][i]);
    }
  }
}


x86 assembly (clang, -O0):
<MatrixTranspose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    1198 <MatrixTranspose+0x88>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    1185 <MatrixTranspose+0x75>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1030 <Round@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1138 <MatrixTranspose+0x28>
jmp    118a <MatrixTranspose+0x7a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <MatrixTranspose+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MatrixTranspose>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movss  (%rdi),%xmm0
call   1030 <Round@plt>
movss  %xmm0,(%r14)
movss  0xc(%rbx),%xmm0
call   1030 <Round@plt>
movss  %xmm0,0x4(%r14)
movss  0x18(%rbx),%xmm0
call   1030 <Round@plt>
movss  %xmm0,0x8(%r14)
movss  0x4(%rbx),%xmm0
call   1030 <Round@plt>
movss  %xmm0,0xc(%r14)
movss  0x10(%rbx),%xmm0
call   1030 <Round@plt>
movss  %xmm0,0x10(%r14)
movss  0x1c(%rbx),%xmm0
call   1030 <Round@plt>
movss  %xmm0,0x14(%r14)
movss  0x8(%rbx),%xmm0
call   1030 <Round@plt>
movss  %xmm0,0x18(%r14)
movss  0x14(%rbx),%xmm0
call   1030 <Round@plt>
movss  %xmm0,0x1c(%r14)
movss  0x20(%rbx),%xmm0
call   1030 <Round@plt>
movss  %xmm0,0x20(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @MatrixTranspose([3 x float]* nocapture %0, [3 x float]* nocapture writeonly %1) {
%3 = getelementptr inbounds [3 x float], [3 x float]* %0, i64 0, i64 0
%4 = load float, float* %3
%5 = tail call float @Round(float %4)
%6 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 0
store float %5, float* %6
%7 = getelementptr inbounds [3 x float], [3 x float]* %0, i64 1, i64 0
%8 = load float, float* %7
%9 = tail call float @Round(float %8)
%10 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 1
store float %9, float* %10
%11 = getelementptr inbounds [3 x float], [3 x float]* %0, i64 2, i64 0
%12 = load float, float* %11
%13 = tail call float @Round(float %12)
%14 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 2
store float %13, float* %14
%15 = getelementptr inbounds [3 x float], [3 x float]* %0, i64 0, i64 1
%16 = load float, float* %15
%17 = tail call float @Round(float %16)
%18 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 1, i64 0
store float %17, float* %18
%19 = getelementptr inbounds [3 x float], [3 x float]* %0, i64 1, i64 1
%20 = load float, float* %19
%21 = tail call float @Round(float %20)
%22 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 1, i64 1
store float %21, float* %22
%23 = getelementptr inbounds [3 x float], [3 x float]* %0, i64 2, i64 1
%24 = load float, float* %23
%25 = tail call float @Round(float %24)
%26 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 1, i64 2
store float %25, float* %26
%27 = getelementptr inbounds [3 x float], [3 x float]* %0, i64 0, i64 2
%28 = load float, float* %27
%29 = tail call float @Round(float %28)
%30 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 2, i64 0
store float %29, float* %30
%31 = getelementptr inbounds [3 x float], [3 x float]* %0, i64 1, i64 2
%32 = load float, float* %31
%33 = tail call float @Round(float %32)
%34 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 2, i64 1
store float %33, float* %34
%35 = getelementptr inbounds [3 x float], [3 x float]* %0, i64 2, i64 2
%36 = load float, float* %35
%37 = tail call float @Round(float %36)
%38 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 2, i64 2
store float %37, float* %38
ret void
}