#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*/ printAdjMatrix(int *, int);
int /*<<< orphan*/ printf(char *);
int *transposeAdjMatrix(int *, int);
int main(int argc, char const *argv[]) {
  int m[3][3] = {{0, 1, 0}, {1, 0, 1}, {0, 1, 0}};
  printAdjMatrix(&m[0][0], 3);
  printf("Transpose:\n");
  printAdjMatrix(transposeAdjMatrix(&m[0][0], 3), 3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x24,%edx
call   1040 <memset@plt>
movl   $0x1,-0x3c(%rbp)
movl   $0x1,-0x34(%rbp)
movl   $0x1,-0x2c(%rbp)
movl   $0x1,-0x24(%rbp)
lea    -0x40(%rbp),%rdi
mov    $0x3,%esi
call   1060 <printAdjMatrix@plt>
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    $0x3,%esi
call   1050 <transposeAdjMatrix@plt>
mov    %rax,%rdi
mov    $0x3,%esi
call   1060 <printAdjMatrix@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x20(%rsp)
movl   $0x1,0x4(%rsp)
movl   $0x1,0xc(%rsp)
movl   $0x1,0x14(%rsp)
movl   $0x1,0x1c(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1050 <printAdjMatrix@plt>
lea    0xe80(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <transposeAdjMatrix@plt>
mov    %rax,%rdi
mov    $0x3,%esi
call   1050 <printAdjMatrix@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@str = [11 x i8] c"Transpose:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [3 x [3 x i32]]
%4 = bitcast [3 x [3 x i32]]* %3 to i8*
%5 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 0, i64 1
store i32 1, i32* %5
%6 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 1, i64 0
store i32 1, i32* %6
%7 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 1, i64 2
store i32 1, i32* %7
%8 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 2, i64 1
store i32 1, i32* %8
%9 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 0, i64 0
%10 = call i32 @printAdjMatrix(i32* %9, i32 3)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%12 = call i32* @transposeAdjMatrix(i32* %9, i32 3)
%13 = call i32 @printAdjMatrix(i32* %12, i32 3)
ret i32 0
}