#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 absDiffDiagnols(int *, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  int a[n * n];
  for (int a_i = 0; a_i < n; a_i++) {
    for (int a_j = 0; a_j < n; a_j++) {
      scanf("%d", (a + a_i * n + a_j));
    }
  }
  int diff = absDiffDiagnols(a, n);
  printf("%d", diff);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
imul   %eax,%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11eb <main+0xbb>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d8 <main+0xa8>
mov    -0x30(%rbp),%rsi
mov    -0x1c(%rbp),%eax
imul   -0x8(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rsi
movslq -0x20(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe3b(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1193 <main+0x63>
jmp    11dd <main+0xad>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1180 <main+0x50>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <absDiffDiagnols@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xdfc(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeb8(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1040 <scanf@plt>
mov    %rsp,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
imul   %eax,%eax
mov    %rsp,%r14
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    -0x2c(%rbp),%esi
test   %esi,%esi
jle    11d6 <main+0xa6>
xor    %r13d,%r13d
lea    0xe7f(%rip),%r12
jmp    1199 <main+0x69>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r13d
cmp    %esi,%r13d
jge    11d6 <main+0xa6>
test   %esi,%esi
jle    1190 <main+0x60>
mov    %r14,%rbx
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
imul   %r13d,%esi
movslq %esi,%rax
lea    (%rbx,%rax,4),%rsi
mov    %r12,%rdi
call   1040 <scanf@plt>
add    $0x1,%r15
movslq -0x2c(%rbp),%rsi
add    $0x4,%rbx
cmp    %rsi,%r15
jl     11b0 <main+0x80>
jmp    1190 <main+0x60>
mov    %r14,%rdi
call   1050 <absDiffDiagnols@plt>
lea    0xe1b(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    -0x38(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = mul nsw i32 %4, %4
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
%8 = alloca i32, i64 %6
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %0, %19
%12 = phi i32 [ %20, %19 ], [ %9, %0 ]
%13 = phi i32 [ %21, %19 ], [ 0, %0 ]
%14 = icmp sgt i32 %12, 0
br i1 %14, label %23, label %19
15: ; preds = %19, %0
%16 = phi i32 [ %9, %0 ], [ %20, %19 ]
%17 = call i32 @absDiffDiagnols(i32* %8, i32 %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %17)
ret i32 0
19: ; preds = %23, %11
%20 = phi i32 [ %12, %11 ], [ %32, %23 ]
%21 = add nuw nsw i32 %13, 1
%22 = icmp slt i32 %21, %20
br i1 %22, label %11, label %15
23: ; preds = %11, %23
%24 = phi i64 [ %31, %23 ], [ 0, %11 ]
%25 = phi i32 [ %32, %23 ], [ %12, %11 ]
%26 = mul nsw i32 %25, %13
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %8, i64 %27
%29 = getelementptr inbounds i32, i32* %28, i64 %24
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %29)
%31 = add nuw nsw i64 %24, 1
%32 = load i32, i32* %1
%33 = sext i32 %32 to i64
%34 = icmp slt i64 %31, %33
br i1 %34, label %23, label %19
}