#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*/ RotateMatrix(int **, int);
int /*<<< orphan*/ printMatrix(int **, int);
int /*<<< orphan*/ printf(char *);
int main(int argc, const char *argv[]) {
  int matrix[4][4] = {
      {1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, {13, 14, 15, 16}};
  int n = 4;
  printMatrix(matrix, n);
  RotateMatrix(matrix, n);
  printf("\n");
  printMatrix(matrix, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xe9f(%rip),%rsi
mov    $0x40,%edx
call   1050 <memcpy@plt>
movl   $0x4,-0x54(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x54(%rbp),%esi
call   1060 <printMatrix@plt>
lea    -0x50(%rbp),%rdi
mov    -0x54(%rbp),%esi
call   1030 <RotateMatrix@plt>
lea    0xeaf(%rip),%rdi
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    -0x54(%rbp),%esi
call   1060 <printMatrix@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
movaps 0xef4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xea0(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1050 <printMatrix@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <RotateMatrix@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1050 <printMatrix@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.matrix = [4 x [4 x i32]] [[4 x i32] [i32 1, i32 2, i32 3, i32 4], [4 x i32] [i32 5, i32 6, i32 7, i32 8], [4 x i32] [i32 9, i32 10, i32 11, i32 12], [4 x i32] [i32 13, i32 14, i32 15, i32 16]]
@.str = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4 x [4 x i32]]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [4 x [4 x i32]]* %6 to i8*
store i32 4, i32* %7
%9 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %6, i64 0, i64 0
%10 = bitcast [4 x i32]* %9 to i32**
%11 = load i32, i32* %7
%12 = call i32 @printMatrix(i32** %10, i32 %11)
%13 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %6, i64 0, i64 0
%14 = bitcast [4 x i32]* %13 to i32**
%15 = load i32, i32* %7
%16 = call i32 @RotateMatrix(i32** %14, i32 %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%18 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %6, i64 0, i64 0
%19 = bitcast [4 x i32]* %18 to i32**
%20 = load i32, i32* %7
%21 = call i32 @printMatrix(i32** %19, i32 %20)
ret i32 0
}

LLVM IR (-O2):
@__const.main.matrix = [4 x [4 x i32]] [[4 x i32] [i32 1, i32 2, i32 3, i32 4], [4 x i32] [i32 5, i32 6, i32 7, i32 8], [4 x i32] [i32 9, i32 10, i32 11, i32 12], [4 x i32] [i32 13, i32 14, i32 15, i32 16]]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [4 x [4 x i32]]
%4 = bitcast [4 x [4 x i32]]* %3 to i8*
%5 = bitcast [4 x [4 x i32]]* %3 to i32**
%6 = call i32 @printMatrix(i32** %5, i32 4)
%7 = call i32 @RotateMatrix(i32** %5, i32 4)
%8 = call i32 @putchar(i32 10)
%9 = call i32 @printMatrix(i32** %5, i32 4)
ret i32 0
}