int main() {
  int a[3][3], b[3][3], i, j, k, c[3][3];
  printf("Enter the elements in the first matrix ");
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      scanf("%d", &a[i][j]);
    }
  }
  printf("The transposed matrix is:");
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      b[j][i] = a[i][j];
      printf("%d", &b);
    }
  }
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      c[i][j] = (a[i][j] - b[i][j]);
    }
  }
  if (c[i][j] == 0) {
    printf("The matrix is symmetric");
  } else
    printf("The matrix is not symmetric");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x64(%rbp)
cmpl   $0x3,-0x64(%rbp)
jge    11ab <main+0x8b>
movl   $0x0,-0x68(%rbp)
cmpl   $0x3,-0x68(%rbp)
jge    1198 <main+0x78>
movslq -0x64(%rbp),%rax
lea    -0x30(%rbp),%rsi
imul   $0xc,%rax,%rax
add    %rax,%rsi
movslq -0x68(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1158 <main+0x38>
jmp    119d <main+0x7d>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1147 <main+0x27>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x64(%rbp)
cmpl   $0x3,-0x64(%rbp)
jge    123a <main+0x11a>
movl   $0x0,-0x68(%rbp)
cmpl   $0x3,-0x68(%rbp)
jge    1227 <main+0x107>
movslq -0x64(%rbp),%rcx
lea    -0x30(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x68(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
movslq -0x68(%rbp),%rcx
lea    -0x60(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x64(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
lea    0xe1a(%rip),%rdi
lea    -0x60(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    11d1 <main+0xb1>
jmp    122c <main+0x10c>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    11c0 <main+0xa0>
movl   $0x0,-0x64(%rbp)
cmpl   $0x3,-0x64(%rbp)
jge    12c2 <main+0x1a2>
movl   $0x0,-0x68(%rbp)
cmpl   $0x3,-0x68(%rbp)
jge    12af <main+0x18f>
movslq -0x64(%rbp),%rcx
lea    -0x30(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x68(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
movslq -0x64(%rbp),%rcx
lea    -0x60(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x68(%rbp),%rcx
sub    (%rax,%rcx,4),%edx
movslq -0x64(%rbp),%rcx
lea    -0x90(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x68(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1252 <main+0x132>
jmp    12b4 <main+0x194>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1241 <main+0x121>
movslq -0x64(%rbp),%rcx
lea    -0x90(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x68(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    12f5 <main+0x1d5>
lea    0xd5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1303 <main+0x1e3>
lea    0xd61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x58,%rsp
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeec(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xe63(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%eax
mov    %eax,0x30(%rsp)
lea    0x30(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
mov    %eax,0x3c(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%eax
mov    %eax,0x48(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x34(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%eax
mov    %eax,0x40(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x14(%rsp),%eax
mov    %eax,0x4c(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x18(%rsp),%eax
mov    %eax,0x38(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x1c(%rsp),%eax
mov    %eax,0x44(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x20(%rsp),%eax
mov    %eax,0x50(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdae(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Enter the elements in the first matrix \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"The transposed matrix is:\00"
@.str.3 = [24 x i8] c"The matrix is symmetric\00"
@.str.4 = [28 x i8] c"The matrix is not symmetric\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x [3 x i32]]
%3 = alloca [3 x [3 x i32]]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [3 x [3 x i32]]
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %9
9: ; preds = %28, %0
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 3
br i1 %11, label %12, label %31
12: ; preds = %9
store i32 0, i32* %5
br label %13
13: ; preds = %24, %12
%14 = load i32, i32* %5
%15 = icmp slt i32 %14, 3
br i1 %15, label %16, label %27
16: ; preds = %13
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %2, i64 0, i64 %18
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [3 x i32], [3 x i32]* %19, i64 0, i64 %21
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
br label %24
24: ; preds = %16
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %13
27: ; preds = %13
br label %28
28: ; preds = %27
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %9
31: ; preds = %9
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %33
33: ; preds = %59, %31
%34 = load i32, i32* %4
%35 = icmp slt i32 %34, 3
br i1 %35, label %36, label %62
36: ; preds = %33
store i32 0, i32* %5
br label %37
37: ; preds = %55, %36
%38 = load i32, i32* %5
%39 = icmp slt i32 %38, 3
br i1 %39, label %40, label %58
40: ; preds = %37
%41 = load i32, i32* %4
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %2, i64 0, i64 %42
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = load i32, i32* %5
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %49
%51 = load i32, i32* %4
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [3 x i32], [3 x i32]* %50, i64 0, i64 %52
store i32 %47, i32* %53
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [3 x [3 x i32]]* %3)
br label %55
55: ; preds = %40
%56 = load i32, i32* %5
%57 = add nsw i32 %56, 1
store i32 %57, i32* %5
br label %37
58: ; preds = %37
br label %59
59: ; preds = %58
%60 = load i32, i32* %4
%61 = add nsw i32 %60, 1
store i32 %61, i32* %4
br label %33
62: ; preds = %33
store i32 0, i32* %4
br label %63
63: ; preds = %96, %62
%64 = load i32, i32* %4
%65 = icmp slt i32 %64, 3
br i1 %65, label %66, label %99
66: ; preds = %63
store i32 0, i32* %5
br label %67
67: ; preds = %92, %66
%68 = load i32, i32* %5
%69 = icmp slt i32 %68, 3
br i1 %69, label %70, label %95
70: ; preds = %67
%71 = load i32, i32* %4
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %2, i64 0, i64 %72
%74 = load i32, i32* %5
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [3 x i32], [3 x i32]* %73, i64 0, i64 %75
%77 = load i32, i32* %76
%78 = load i32, i32* %4
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %79
%81 = load i32, i32* %5
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds [3 x i32], [3 x i32]* %80, i64 0, i64 %82
%84 = load i32, i32* %83
%85 = sub nsw i32 %77, %84
%86 = load i32, i32* %4
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %7, i64 0, i64 %87
%89 = load i32, i32* %5
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [3 x i32], [3 x i32]* %88, i64 0, i64 %90
store i32 %85, i32* %91
br label %92
92: ; preds = %70
%93 = load i32, i32* %5
%94 = add nsw i32 %93, 1
store i32 %94, i32* %5
br label %67
95: ; preds = %67
br label %96
96: ; preds = %95
%97 = load i32, i32* %4
%98 = add nsw i32 %97, 1
store i32 %98, i32* %4
br label %63
99: ; preds = %63
%100 = load i32, i32* %4
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %7, i64 0, i64 %101
%103 = load i32, i32* %5
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [3 x i32], [3 x i32]* %102, i64 0, i64 %104
%106 = load i32, i32* %105
%107 = icmp eq i32 %106, 0
br i1 %107, label %108, label %110
108: ; preds = %99
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %112
110: ; preds = %99
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
br label %112
112: ; preds = %110, %108
ret i32 0
}

LLVM IR (-O2):
@.str = [40 x i8] c"Enter the elements in the first matrix \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"The transposed matrix is:\00"
@.str.4 = [28 x i8] c"The matrix is not symmetric\00"
define i32 @main() {
%1 = alloca [3 x [3 x i32]]
%2 = alloca [3 x [3 x i32]]
%3 = bitcast [3 x [3 x i32]]* %1 to i8*
%4 = bitcast [3 x [3 x i32]]* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %1, i64 0, i64 0, i64 0
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %1, i64 0, i64 0, i64 1
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %1, i64 0, i64 0, i64 2
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %1, i64 0, i64 1, i64 0
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %1, i64 0, i64 1, i64 1
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %14)
%16 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %1, i64 0, i64 1, i64 2
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %1, i64 0, i64 2, i64 0
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %18)
%20 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %1, i64 0, i64 2, i64 1
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %20)
%22 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %1, i64 0, i64 2, i64 2
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%25 = load i32, i32* %6
%26 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %2, i64 0, i64 0, i64 0
store i32 %25, i32* %26
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [3 x [3 x i32]]* %2)
%28 = load i32, i32* %8
%29 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %2, i64 0, i64 1, i64 0
store i32 %28, i32* %29
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [3 x [3 x i32]]* %2)
%31 = load i32, i32* %10
%32 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %2, i64 0, i64 2, i64 0
store i32 %31, i32* %32
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [3 x [3 x i32]]* %2)
%34 = load i32, i32* %12
%35 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %2, i64 0, i64 0, i64 1
store i32 %34, i32* %35
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [3 x [3 x i32]]* %2)
%37 = load i32, i32* %14
%38 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %2, i64 0, i64 1, i64 1
store i32 %37, i32* %38
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [3 x [3 x i32]]* %2)
%40 = load i32, i32* %16
%41 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %2, i64 0, i64 2, i64 1
store i32 %40, i32* %41
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [3 x [3 x i32]]* %2)
%43 = load i32, i32* %18
%44 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %2, i64 0, i64 0, i64 2
store i32 %43, i32* %44
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [3 x [3 x i32]]* %2)
%46 = load i32, i32* %20
%47 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %2, i64 0, i64 1, i64 2
store i32 %46, i32* %47
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [3 x [3 x i32]]* %2)
%49 = load i32, i32* %22
%50 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %2, i64 0, i64 2, i64 2
store i32 %49, i32* %50
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [3 x [3 x i32]]* %2)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}