#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, int *, int *);
int main() {
  int swap, i = 0, j = 0, a[4][4];
  for (; i < 4; i++) {
    scanf("%d %d %d %d", &a[i][0], &a[i][1], &a[i][2], &a[i][3]);
  }
  for (i = 0; i < 4; i++) {
    for (j = 0; j < 4 && i != j; j++) {
      swap = a[i][j];
      a[i][j] = a[j][i];
      a[j][i] = swap;
    }
  }
  for (i = 0; i < 4; i++) {
    for (j = 0; j < 4; j++)
      printf("%d", a[i][j]);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    11a9 <main+0x89>
movslq -0xc(%rbp),%rax
lea    -0x50(%rbp),%rsi
shl    $0x4,%rax
add    %rax,%rsi
movslq -0xc(%rbp),%rax
lea    -0x50(%rbp),%rdx
shl    $0x4,%rax
add    %rax,%rdx
add    $0x4,%rdx
movslq -0xc(%rbp),%rax
lea    -0x50(%rbp),%rcx
shl    $0x4,%rax
add    %rax,%rcx
add    $0x8,%rcx
movslq -0xc(%rbp),%rax
lea    -0x50(%rbp),%r8
shl    $0x4,%rax
add    %rax,%r8
add    $0xc,%r8
lea    0xe6a(%rip),%rdi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <main+0x1d>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    126b <main+0x14b>
movl   $0x0,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0x4,-0x10(%rbp)
mov    %al,-0x51(%rbp)
jge    11dc <main+0xbc>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
setne  %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
test   $0x1,%al
jne    11ec <main+0xcc>
jmp    1258 <main+0x138>
movslq -0xc(%rbp),%rcx
lea    -0x50(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x8(%rbp)
movslq -0x10(%rbp),%rcx
lea    -0x50(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
movslq -0xc(%rbp),%rcx
lea    -0x50(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%edx
movslq -0x10(%rbp),%rcx
lea    -0x50(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11c1 <main+0xa1>
jmp    125d <main+0x13d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b0 <main+0x90>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    12db <main+0x1bb>
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    12bf <main+0x19f>
movslq -0xc(%rbp),%rcx
lea    -0x50(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1283 <main+0x163>
lea    0xd46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1272 <main+0x152>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
lea    0x4(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0xc(%rsp),%r8
lea    0xeb5(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x10(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0x1c(%rsp),%r8
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x20(%rsp),%rsi
lea    0x24(%rsp),%rdx
lea    0x28(%rsp),%rcx
lea    0x2c(%rsp),%r8
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x30(%rsp),%rsi
lea    0x34(%rsp),%rdx
lea    0x38(%rsp),%rcx
lea    0x3c(%rsp),%r8
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x10(%rsp),%eax
mov    0x4(%rsp),%ecx
mov    0x8(%rsp),%edx
mov    %ecx,0x10(%rsp)
mov    %eax,0x4(%rsp)
mov    0x20(%rsp),%eax
mov    %edx,0x20(%rsp)
mov    %eax,0x8(%rsp)
mov    0x24(%rsp),%eax
mov    0x18(%rsp),%ecx
mov    %ecx,0x24(%rsp)
mov    %eax,0x18(%rsp)
mov    0x30(%rsp),%eax
mov    0xc(%rsp),%ecx
mov    %ecx,0x30(%rsp)
mov    %eax,0xc(%rsp)
mov    0x34(%rsp),%eax
mov    0x1c(%rsp),%ecx
mov    %ecx,0x34(%rsp)
mov    %eax,0x1c(%rsp)
mov    0x2c(%rsp),%eax
mov    0x38(%rsp),%ecx
mov    %eax,0x38(%rsp)
mov    %ecx,0x2c(%rsp)
mov    (%rsp),%esi
lea    0xdf5(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x28(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x30(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x34(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x38(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x3c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"%d %d %d %d\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [4 x [4 x i32]]
%2 = bitcast [4 x [4 x i32]]* %1 to i8*
%3 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 0, i64 0
%4 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 0, i64 1
%5 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 0, i64 2
%6 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 0, i64 3
%7 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %6)
%8 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 1, i64 0
%9 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 1, i64 1
%10 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 1, i64 2
%11 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 1, i64 3
%12 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %8, i32* %9, i32* %10, i32* %11)
%13 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 2, i64 0
%14 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 2, i64 1
%15 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 2, i64 2
%16 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 2, i64 3
%17 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %13, i32* %14, i32* %15, i32* %16)
%18 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 3, i64 0
%19 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 3, i64 1
%20 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 3, i64 2
%21 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 3, i64 3
%22 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %18, i32* %19, i32* %20, i32* %21)
%23 = load i32, i32* %8
%24 = load i32, i32* %4
store i32 %24, i32* %8
store i32 %23, i32* %4
%25 = load i32, i32* %13
%26 = load i32, i32* %5
store i32 %26, i32* %13
store i32 %25, i32* %5
%27 = load i32, i32* %14
%28 = load i32, i32* %10
store i32 %28, i32* %14
store i32 %27, i32* %10
%29 = load i32, i32* %18
%30 = load i32, i32* %6
store i32 %30, i32* %18
store i32 %29, i32* %6
%31 = load i32, i32* %19
%32 = load i32, i32* %11
store i32 %32, i32* %19
store i32 %31, i32* %11
%33 = load i32, i32* %20
%34 = load i32, i32* %16
store i32 %34, i32* %20
store i32 %33, i32* %16
%35 = load i32, i32* %3
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %4
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %37)
%39 = load i32, i32* %5
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %6
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %41)
%43 = call i32 @putchar(i32 10)
%44 = load i32, i32* %8
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %9
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %10
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %48)
%50 = load i32, i32* %11
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %50)
%52 = call i32 @putchar(i32 10)
%53 = load i32, i32* %13
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %53)
%55 = load i32, i32* %14
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %55)
%57 = load i32, i32* %15
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %57)
%59 = load i32, i32* %16
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %59)
%61 = call i32 @putchar(i32 10)
%62 = load i32, i32* %18
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %62)
%64 = load i32, i32* %19
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %64)
%66 = load i32, i32* %20
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %66)
%68 = load i32, i32* %21
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %68)
%70 = call i32 @putchar(i32 10)
ret i32 0
}