#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*/ mirror(int **, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ transpose(int **, int, int);
void main() {
  int mat[5][3];
  int i, j, k = 0;
  printf("\n Matrix is :\n");
  for (i = 0; i < 5; i++) {
    for (j = 0; j < 3; j++) {
      mat[i][j] = k;
      k++;
      printf("%d ", mat[i][j]);
    }
    printf("\n");
  }
  printf("\n Transpose of Mat\n");
  transpose(mat, 5, 3);
  printf("\n Mirror image of Matrix \n");
  mirror(mat, 5, 3);
  return;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4c(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0x5,-0x44(%rbp)
jge    11df <main+0xaf>
movl   $0x0,-0x48(%rbp)
cmpl   $0x3,-0x48(%rbp)
jge    11c3 <main+0x93>
mov    -0x4c(%rbp),%edx
movslq -0x44(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x48(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
movslq -0x44(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1165 <main+0x35>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1154 <main+0x24>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
mov    $0x3,%edx
call   1050 <transpose@plt>
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
mov    $0x3,%edx
call   1040 <mirror@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
lea    0xed8(%rip),%rdi
call   1040 <puts@plt>
lea    0xec8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movaps 0xe5d(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movaps 0xe1c(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movaps 0xdda(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    %rbx,%rdi
mov    $0xb,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0xc,0x30(%rsp)
mov    %rbx,%rdi
mov    $0xc,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0xd,0x34(%rsp)
mov    %rbx,%rdi
mov    $0xd,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0xe,0x38(%rsp)
mov    %rbx,%rdi
mov    $0xe,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd88(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x3,%edx
call   1070 <transpose@plt>
lea    0xd7a(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x3,%edx
call   1060 <mirror@plt>
add    $0x40,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d \00"
@str = [14 x i8] c"\0A Matrix is :\00"
@str.5 = [19 x i8] c"\0A Transpose of Mat\00"
@str.6 = [26 x i8] c"\0A Mirror image of Matrix \00"
define void @main() {
%1 = alloca [5 x [3 x i32]]
%2 = bitcast [5 x [3 x i32]]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 1)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 2)
%7 = tail call i32 @putchar(i32 10)
%8 = bitcast [5 x [3 x i32]]* %1 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %8
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%10 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %1, i64 0, i64 1, i64 1
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 4)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 5)
%13 = tail call i32 @putchar(i32 10)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 6)
%15 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %15
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 7)
%17 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %1, i64 0, i64 2, i64 2
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 8)
%19 = tail call i32 @putchar(i32 10)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 9)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 10)
%22 = bitcast i32* %17 to <4 x i32>*
store <4 x i32> <i32 8, i32 9, i32 10, i32 11>, <4 x i32>* %22
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 11)
%24 = tail call i32 @putchar(i32 10)
%25 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %1, i64 0, i64 4, i64 0
store i32 12, i32* %25
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 12)
%27 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %1, i64 0, i64 4, i64 1
store i32 13, i32* %27
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 13)
%29 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %1, i64 0, i64 4, i64 2
store i32 14, i32* %29
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 14)
%31 = tail call i32 @putchar(i32 10)
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.5, i64 0, i64 0))
%33 = bitcast [5 x [3 x i32]]* %1 to i32**
%34 = call i32 @transpose(i32** %33, i32 5, i32 3)
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.6, i64 0, i64 0))
%36 = call i32 @mirror(i32** %33, i32 5, i32 3)
ret void
}