#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*/ printMatrix(char ***);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ rotate(char **);
int main() {
  char matrix1[4][4] = {{'-', '-', '-', '-'},
                        {'-', 'o', '-', '-'},
                        {'o', 'o', 'o', '-'},
                        {'-', '-', '-', '-'}};
  char matrix2[4][4] = {{'-', '-', '-', '-'},
                        {'-', 'o', 'o', '-'},
                        {'o', 'o', '-', '-'},
                        {'-', '-', '-', '-'}};
  char matrix3[4][4] = {{'-', '-', '-', '-'},
                        {'-', 'o', '-', '-'},
                        {'-', 'o', '-', '-'},
                        {'-', 'o', 'o', '-'}};
  char matrix4[4][4] = {{'-', '-', 'o', '-'},
                        {'-', '-', 'o', '-'},
                        {'-', '-', 'o', '-'},
                        {'-', '-', 'o', '-'}};
  int value_to_copy;
  int main_iteration;
  int rot_iteration;
  char rotmatrix[4][4][4];
  for (value_to_copy = 0; value_to_copy < (4 * 4); value_to_copy++) {
    *(rotmatrix[0][0] + value_to_copy) = *(matrix1[0] + value_to_copy);
    *(rotmatrix[1][0] + value_to_copy) = *(matrix2[0] + value_to_copy);
    *(rotmatrix[2][0] + value_to_copy) = *(matrix3[0] + value_to_copy);
    *(rotmatrix[3][0] + value_to_copy) = *(matrix4[0] + value_to_copy);
  }
  printMatrix(rotmatrix);
  for (main_iteration = 0; main_iteration <= 4; main_iteration++) {
    for (rot_iteration = 0; rot_iteration <= 4; rot_iteration++) {
      rotate(rotmatrix[rot_iteration]);
    }
    printMatrix(rotmatrix);
    printf((main_iteration < 4) ? "\n" : "");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb1(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeae(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xeab(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xea8(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xea5(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xea2(%rip),%rax
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x54(%rbp)
cmpl   $0x10,-0x54(%rbp)
jge    11ff <main+0xcf>
movslq -0x54(%rbp),%rax
mov    -0x20(%rbp,%rax,1),%cl
movslq -0x54(%rbp),%rax
mov    %cl,-0xa0(%rbp,%rax,1)
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,1),%cl
movslq -0x54(%rbp),%rax
mov    %cl,-0x90(%rbp,%rax,1)
movslq -0x54(%rbp),%rax
mov    -0x40(%rbp,%rax,1),%cl
movslq -0x54(%rbp),%rax
mov    %cl,-0x80(%rbp,%rax,1)
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,1),%cl
movslq -0x54(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11a1 <main+0x71>
lea    -0xa0(%rbp),%rdi
call   1040 <printMatrix@plt>
movl   $0x0,-0x58(%rbp)
cmpl   $0x4,-0x58(%rbp)
jg     1289 <main+0x159>
movl   $0x0,-0x5c(%rbp)
cmpl   $0x4,-0x5c(%rbp)
jg     1252 <main+0x122>
movslq -0x5c(%rbp),%rax
lea    -0xa0(%rbp),%rdi
shl    $0x4,%rax
add    %rax,%rdi
call   1050 <rotate@plt>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1223 <main+0xf3>
lea    -0xa0(%rbp),%rdi
call   1040 <printMatrix@plt>
mov    -0x58(%rbp),%ecx
lea    0xdd9(%rip),%rdi
lea    0xdd1(%rip),%rax
cmp    $0x4,%ecx
cmovl  %rax,%rdi
call   1030 <printf@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1212 <main+0xe2>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x40,%rsp
movaps 0xebc(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x10(%rsp),%r12
movaps 0xebc(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x20(%rsp),%r15
movaps 0xebb(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x30(%rsp),%r14
movaps 0xeba(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <printMatrix@plt>
mov    %rbx,%rdi
call   1050 <rotate@plt>
mov    %r12,%rdi
call   1050 <rotate@plt>
mov    %r15,%rdi
call   1050 <rotate@plt>
mov    %r14,%rdi
call   1050 <rotate@plt>
lea    0x40(%rsp),%r13
mov    %r13,%rdi
call   1050 <rotate@plt>
mov    %rbx,%rdi
call   1040 <printMatrix@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1050 <rotate@plt>
mov    %r12,%rdi
call   1050 <rotate@plt>
mov    %r15,%rdi
call   1050 <rotate@plt>
mov    %r14,%rdi
call   1050 <rotate@plt>
mov    %r13,%rdi
call   1050 <rotate@plt>
mov    %rbx,%rdi
call   1040 <printMatrix@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1050 <rotate@plt>
mov    %r12,%rdi
call   1050 <rotate@plt>
mov    %r15,%rdi
call   1050 <rotate@plt>
mov    %r14,%rdi
call   1050 <rotate@plt>
mov    %r13,%rdi
call   1050 <rotate@plt>
mov    %rbx,%rdi
call   1040 <printMatrix@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1050 <rotate@plt>
mov    %r12,%rdi
call   1050 <rotate@plt>
mov    %r15,%rdi
call   1050 <rotate@plt>
mov    %r14,%rdi
call   1050 <rotate@plt>
mov    %r13,%rdi
call   1050 <rotate@plt>
mov    %rbx,%rdi
call   1040 <printMatrix@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1050 <rotate@plt>
mov    %r12,%rdi
call   1050 <rotate@plt>
mov    %r15,%rdi
call   1050 <rotate@plt>
mov    %r14,%rdi
call   1050 <rotate@plt>
mov    %r13,%rdi
call   1050 <rotate@plt>
mov    %rbx,%rdi
call   1040 <printMatrix@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.matrix1 = [4 x [4 x i8]] [[4 x i8] c"----", [4 x i8] c"-o--", [4 x i8] c"ooo-", [4 x i8] c"----"]
@__const.main.matrix2 = [4 x [4 x i8]] [[4 x i8] c"----", [4 x i8] c"-oo-", [4 x i8] c"oo--", [4 x i8] c"----"]
@__const.main.matrix3 = [4 x [4 x i8]] [[4 x i8] c"----", [4 x i8] c"-o--", [4 x i8] c"-o--", [4 x i8] c"-oo-"]
@__const.main.matrix4 = [4 x [4 x i8]] [[4 x i8] c"--o-", [4 x i8] c"--o-", [4 x i8] c"--o-", [4 x i8] c"--o-"]
@.str = [2 x i8] c"\0A\00"
@.str.1 = [1 x i8] zeroinitializer
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x [4 x i8]]
%3 = alloca [4 x [4 x i8]]
%4 = alloca [4 x [4 x i8]]
%5 = alloca [4 x [4 x i8]]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [4 x [4 x [4 x i8]]]
store i32 0, i32* %1
%10 = bitcast [4 x [4 x i8]]* %2 to i8*
%11 = bitcast [4 x [4 x i8]]* %3 to i8*
%12 = bitcast [4 x [4 x i8]]* %4 to i8*
%13 = bitcast [4 x [4 x i8]]* %5 to i8*
store i32 0, i32* %6
br label %14
14: ; preds = %66, %0
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 16
br i1 %16, label %17, label %69
17: ; preds = %14
%18 = getelementptr inbounds [4 x [4 x i8]], [4 x [4 x i8]]* %2, i64 0, i64 0
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %18, i64 0, i64 0
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = getelementptr inbounds [4 x [4 x [4 x i8]]], [4 x [4 x [4 x i8]]]* %9, i64 0, i64 0
%25 = getelementptr inbounds [4 x [4 x i8]], [4 x [4 x i8]]* %24, i64 0, i64 0
%26 = getelementptr inbounds [4 x i8], [4 x i8]* %25, i64 0, i64 0
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
store i8 %23, i8* %29
%30 = getelementptr inbounds [4 x [4 x i8]], [4 x [4 x i8]]* %3, i64 0, i64 0
%31 = getelementptr inbounds [4 x i8], [4 x i8]* %30, i64 0, i64 0
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
%35 = load i8, i8* %34
%36 = getelementptr inbounds [4 x [4 x [4 x i8]]], [4 x [4 x [4 x i8]]]* %9, i64 0, i64 1
%37 = getelementptr inbounds [4 x [4 x i8]], [4 x [4 x i8]]* %36, i64 0, i64 0
%38 = getelementptr inbounds [4 x i8], [4 x i8]* %37, i64 0, i64 0
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
store i8 %35, i8* %41
%42 = getelementptr inbounds [4 x [4 x i8]], [4 x [4 x i8]]* %4, i64 0, i64 0
%43 = getelementptr inbounds [4 x i8], [4 x i8]* %42, i64 0, i64 0
%44 = load i32, i32* %6
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
%47 = load i8, i8* %46
%48 = getelementptr inbounds [4 x [4 x [4 x i8]]], [4 x [4 x [4 x i8]]]* %9, i64 0, i64 2
%49 = getelementptr inbounds [4 x [4 x i8]], [4 x [4 x i8]]* %48, i64 0, i64 0
%50 = getelementptr inbounds [4 x i8], [4 x i8]* %49, i64 0, i64 0
%51 = load i32, i32* %6
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8, i8* %50, i64 %52
store i8 %47, i8* %53
%54 = getelementptr inbounds [4 x [4 x i8]], [4 x [4 x i8]]* %5, i64 0, i64 0
%55 = getelementptr inbounds [4 x i8], [4 x i8]* %54, i64 0, i64 0
%56 = load i32, i32* %6
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %55, i64 %57
%59 = load i8, i8* %58
%60 = getelementptr inbounds [4 x [4 x [4 x i8]]], [4 x [4 x [4 x i8]]]* %9, i64 0, i64 3
%61 = getelementptr inbounds [4 x [4 x i8]], [4 x [4 x i8]]* %60, i64 0, i64 0
%62 = getelementptr inbounds [4 x i8], [4 x i8]* %61, i64 0, i64 0
%63 = load i32, i32* %6
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8, i8* %62, i64 %64
store i8 %59, i8* %65
br label %66
66: ; preds = %17
%67 = load i32, i32* %6
%68 = add nsw i32 %67, 1
store i32 %68, i32* %6
br label %14
69: ; preds = %14
%70 = getelementptr inbounds [4 x [4 x [4 x i8]]], [4 x [4 x [4 x i8]]]* %9, i64 0, i64 0
%71 = bitcast [4 x [4 x i8]]* %70 to i8***
%72 = call i32 @printMatrix(i8*** %71)
store i32 0, i32* %7
br label %73
73: ; preds = %99, %69
%74 = load i32, i32* %7
%75 = icmp sle i32 %74, 4
br i1 %75, label %76, label %102
76: ; preds = %73
store i32 0, i32* %8
br label %77
77: ; preds = %87, %76
%78 = load i32, i32* %8
%79 = icmp sle i32 %78, 4
br i1 %79, label %80, label %90
80: ; preds = %77
%81 = load i32, i32* %8
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds [4 x [4 x [4 x i8]]], [4 x [4 x [4 x i8]]]* %9, i64 0, i64 %82
%84 = getelementptr inbounds [4 x [4 x i8]], [4 x [4 x i8]]* %83, i64 0, i64 0
%85 = bitcast [4 x i8]* %84 to i8**
%86 = call i32 @rotate(i8** %85)
br label %87
87: ; preds = %80
%88 = load i32, i32* %8
%89 = add nsw i32 %88, 1
store i32 %89, i32* %8
br label %77
90: ; preds = %77
%91 = getelementptr inbounds [4 x [4 x [4 x i8]]], [4 x [4 x [4 x i8]]]* %9, i64 0, i64 0
%92 = bitcast [4 x [4 x i8]]* %91 to i8***
%93 = call i32 @printMatrix(i8*** %92)
%94 = load i32, i32* %7
%95 = icmp slt i32 %94, 4
%96 = zext i1 %95 to i64
%97 = select i1 %95, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0)
%98 = call i32 @printf(i8* %97)
br label %99
99: ; preds = %90
%100 = load i32, i32* %7
%101 = add nsw i32 %100, 1
store i32 %101, i32* %7
br label %73
102: ; preds = %73
ret i32 0
}

LLVM IR (-O2):
@__const.main.matrix1 = [4 x [4 x i8]] [[4 x i8] c"----", [4 x i8] c"-o--", [4 x i8] c"ooo-", [4 x i8] c"----"]
@__const.main.matrix2 = [4 x [4 x i8]] [[4 x i8] c"----", [4 x i8] c"-oo-", [4 x i8] c"oo--", [4 x i8] c"----"]
@__const.main.matrix3 = [4 x [4 x i8]] [[4 x i8] c"----", [4 x i8] c"-o--", [4 x i8] c"-o--", [4 x i8] c"-oo-"]
@__const.main.matrix4 = [4 x [4 x i8]] [[4 x i8] c"--o-", [4 x i8] c"--o-", [4 x i8] c"--o-", [4 x i8] c"--o-"]
define i32 @main() {
%1 = alloca [4 x [4 x [4 x i8]]]
%2 = getelementptr inbounds [4 x [4 x [4 x i8]]], [4 x [4 x [4 x i8]]]* %1, i64 0, i64 0, i64 0, i64 0
%3 = getelementptr inbounds [4 x [4 x [4 x i8]]], [4 x [4 x [4 x i8]]]* %1, i64 0, i64 0, i64 0, i64 0
%4 = getelementptr inbounds [4 x [4 x [4 x i8]]], [4 x [4 x [4 x i8]]]* %1, i64 0, i64 1, i64 0, i64 0
%5 = getelementptr inbounds [4 x [4 x [4 x i8]]], [4 x [4 x [4 x i8]]]* %1, i64 0, i64 2, i64 0, i64 0
%6 = getelementptr inbounds [4 x [4 x [4 x i8]]], [4 x [4 x [4 x i8]]]* %1, i64 0, i64 3, i64 0, i64 0
%7 = bitcast [4 x [4 x [4 x i8]]]* %1 to i8***
%8 = call i32 @printMatrix(i8*** %7)
%9 = bitcast [4 x [4 x [4 x i8]]]* %1 to i8**
%10 = call i32 @rotate(i8** %9)
%11 = getelementptr inbounds [4 x [4 x [4 x i8]]], [4 x [4 x [4 x i8]]]* %1, i64 0, i64 1, i64 0
%12 = bitcast [4 x i8]* %11 to i8**
%13 = call i32 @rotate(i8** %12)
%14 = getelementptr inbounds [4 x [4 x [4 x i8]]], [4 x [4 x [4 x i8]]]* %1, i64 0, i64 2, i64 0
%15 = bitcast [4 x i8]* %14 to i8**
%16 = call i32 @rotate(i8** %15)
%17 = getelementptr inbounds [4 x [4 x [4 x i8]]], [4 x [4 x [4 x i8]]]* %1, i64 0, i64 3, i64 0
%18 = bitcast [4 x i8]* %17 to i8**
%19 = call i32 @rotate(i8** %18)
%20 = getelementptr inbounds [4 x [4 x [4 x i8]]], [4 x [4 x [4 x i8]]]* %1, i64 0, i64 4, i64 0
%21 = bitcast [4 x i8]* %20 to i8**
%22 = call i32 @rotate(i8** %21)
%23 = call i32 @printMatrix(i8*** %7)
%24 = call i32 @putchar(i32 10)
%25 = call i32 @rotate(i8** %9)
%26 = call i32 @rotate(i8** %12)
%27 = call i32 @rotate(i8** %15)
%28 = call i32 @rotate(i8** %18)
%29 = call i32 @rotate(i8** %21)
%30 = call i32 @printMatrix(i8*** %7)
%31 = call i32 @putchar(i32 10)
%32 = call i32 @rotate(i8** %9)
%33 = call i32 @rotate(i8** %12)
%34 = call i32 @rotate(i8** %15)
%35 = call i32 @rotate(i8** %18)
%36 = call i32 @rotate(i8** %21)
%37 = call i32 @printMatrix(i8*** %7)
%38 = call i32 @putchar(i32 10)
%39 = call i32 @rotate(i8** %9)
%40 = call i32 @rotate(i8** %12)
%41 = call i32 @rotate(i8** %15)
%42 = call i32 @rotate(i8** %18)
%43 = call i32 @rotate(i8** %21)
%44 = call i32 @printMatrix(i8*** %7)
%45 = call i32 @putchar(i32 10)
%46 = call i32 @rotate(i8** %9)
%47 = call i32 @rotate(i8** %12)
%48 = call i32 @rotate(i8** %15)
%49 = call i32 @rotate(i8** %18)
%50 = call i32 @rotate(i8** %21)
%51 = call i32 @printMatrix(i8*** %7)
ret i32 0
}