#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 */
int /*<<< orphan*/ initfrand();
int /*<<< orphan*/ print_vec_float(float *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sse_transpose(float *);
int main() {
  initfrand();
  float mat[4 * 4];
  int i = 0;
  for (i = 0; i < 4 * 4; i++)
    mat[i] = i;
  printf("M = \n");
  for (i = 0; i < 4; i++)
    print_vec_float(&mat[i * 4]);
  sse_transpose(mat);
  printf("M^T = \n");
  for (i = 0; i < 4; i++)
    print_vec_float(&mat[i * 4]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <initfrand@plt>
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x54(%rbp)
cmpl   $0x10,-0x54(%rbp)
jge    118b <main+0x4b>
cvtsi2ssl -0x54(%rbp),%xmm0
movslq -0x54(%rbp),%rax
movss  %xmm0,-0x50(%rbp,%rax,4)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1164 <main+0x24>
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0x4,-0x54(%rbp)
jge    11ce <main+0x8e>
mov    -0x54(%rbp),%eax
shl    $0x2,%eax
cltq
lea    -0x50(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
call   1060 <print_vec_float@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    119e <main+0x5e>
lea    -0x50(%rbp),%rdi
call   1050 <sse_transpose@plt>
lea    0xe28(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0x4,-0x54(%rbp)
jge    121a <main+0xda>
mov    -0x54(%rbp),%eax
shl    $0x2,%eax
cltq
lea    -0x50(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
call   1060 <print_vec_float@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11ea <main+0xaa>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
xor    %eax,%eax
call   1040 <initfrand@plt>
movaps 0xea7(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x10(%rsp),%r12
movaps 0xea7(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x20(%rsp),%r15
movaps 0xea6(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x30(%rsp),%r14
movaps 0xea5(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <print_vec_float@plt>
mov    %r12,%rdi
call   1060 <print_vec_float@plt>
mov    %r15,%rdi
call   1060 <print_vec_float@plt>
mov    %r14,%rdi
call   1060 <print_vec_float@plt>
mov    %rbx,%rdi
call   1050 <sse_transpose@plt>
lea    0xe77(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1060 <print_vec_float@plt>
mov    %r12,%rdi
call   1060 <print_vec_float@plt>
mov    %r15,%rdi
call   1060 <print_vec_float@plt>
mov    %r14,%rdi
call   1060 <print_vec_float@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"M = \0A\00"
@.str.1 = [8 x i8] c"M^T = \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x float]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @initfrand()
store i32 0, i32* %3
store i32 0, i32* %3
br label %5
5: ; preds = %14, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 16
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sitofp i32 %9 to float
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [16 x float], [16 x float]* %2, i64 0, i64 %12
store float %10, float* %13
br label %14
14: ; preds = %8
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %5
17: ; preds = %5
%18 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %19
19: ; preds = %28, %17
%20 = load i32, i32* %3
%21 = icmp slt i32 %20, 4
br i1 %21, label %22, label %31
22: ; preds = %19
%23 = load i32, i32* %3
%24 = mul nsw i32 %23, 4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [16 x float], [16 x float]* %2, i64 0, i64 %25
%27 = call i32 @print_vec_float(float* %26)
br label %28
28: ; preds = %22
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %19
31: ; preds = %19
%32 = getelementptr inbounds [16 x float], [16 x float]* %2, i64 0, i64 0
%33 = call i32 @sse_transpose(float* %32)
%34 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %35
35: ; preds = %44, %31
%36 = load i32, i32* %3
%37 = icmp slt i32 %36, 4
br i1 %37, label %38, label %47
38: ; preds = %35
%39 = load i32, i32* %3
%40 = mul nsw i32 %39, 4
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [16 x float], [16 x float]* %2, i64 0, i64 %41
%43 = call i32 @print_vec_float(float* %42)
br label %44
44: ; preds = %38
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
br label %35
47: ; preds = %35
ret i32 0
}

LLVM IR (-O2):
@str = [5 x i8] c"M = \00"
@str.2 = [7 x i8] c"M^T = \00"
define i32 @main() {
%1 = alloca [16 x float]
%2 = tail call i32 (...) @initfrand()
%3 = bitcast [16 x float]* %1 to i8*
%4 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%5 = bitcast [16 x float]* %1 to <4 x float>*
store <4 x float> <float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00>, <4 x float>* %5
%6 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 4
%7 = bitcast float* %6 to <4 x float>*
store <4 x float> <float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00>, <4 x float>* %7
%8 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 8
%9 = bitcast float* %8 to <4 x float>*
store <4 x float> <float 8.000000e+00, float 9.000000e+00, float 1.000000e+01, float 1.100000e+01>, <4 x float>* %9
%10 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 12
%11 = bitcast float* %10 to <4 x float>*
store <4 x float> <float 1.200000e+01, float 1.300000e+01, float 1.400000e+01, float 1.500000e+01>, <4 x float>* %11
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%13 = call i32 @print_vec_float(float* %4)
%14 = call i32 @print_vec_float(float* %6)
%15 = call i32 @print_vec_float(float* %8)
%16 = call i32 @print_vec_float(float* %10)
%17 = call i32 @sse_transpose(float* %4)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.2, i64 0, i64 0))
%19 = call i32 @print_vec_float(float* %4)
%20 = call i32 @print_vec_float(float* %6)
%21 = call i32 @print_vec_float(float* %8)
%22 = call i32 @print_vec_float(float* %10)
ret i32 0
}