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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2730,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    -0x2720(%rbp),%rdi
mov    -0x8(%rbp),%edx
xor    %esi,%esi
call   1040 <mat@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11ca <main+0x9a>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x272c(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
movslq %eax,%rcx
lea    -0x2720(%rbp),%rax
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x2728(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x272c(%rbp),%edx
mov    %eax,%ecx
mov    -0x2728(%rbp),%rax
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1244 <main+0x114>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1228 <main+0xf8>
movslq -0xc(%rbp),%rcx
lea    -0x2720(%rbp),%rax
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11e4 <main+0xb4>
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11d1 <main+0xa1>
xor    %eax,%eax
add    $0x2730,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x2728,%rsp
lea    0xeab(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%edx
lea    0x10(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
call   1050 <mat@plt>
mov    0xc(%rsp),%eax
test   $0x1,%al
je     119c <main+0x5c>
mov    %eax,%ecx
imul   %eax,%ecx
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
sar    %edx
movslq %edx,%rdx
imul   $0xc8,%rdx,%rsi
add    %rsp,%rsi
add    $0x10,%rsi
mov    %ecx,(%rsi,%rdx,4)
test   %eax,%eax
jle    11fe <main+0xbe>
lea    0xe5c(%rip),%r14
xor    %r15d,%r15d
jmp    11cf <main+0x8f>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15
movslq 0xc(%rsp),%rax
add    $0xc8,%r12
cmp    %rax,%r15
jge    11fe <main+0xbe>
test   %eax,%eax
jle    11b0 <main+0x70>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     11e0 <main+0xa0>
jmp    11b0 <main+0x70>
xor    %eax,%eax
add    $0x2728,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\09\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 [50 x [50 x i32]]
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %5, i64 0, i64 0
%8 = bitcast [50 x i32]* %7 to i32**
%9 = load i32, i32* %2
%10 = call i32 @mat(i32** %8, i32 0, i32 %9)
%11 = load i32, i32* %2
%12 = srem i32 %11, 2
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %26
14: ; preds = %0
%15 = load i32, i32* %2
%16 = load i32, i32* %2
%17 = mul nsw i32 %15, %16
%18 = load i32, i32* %2
%19 = sdiv i32 %18, 2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %5, i64 0, i64 %20
%22 = load i32, i32* %2
%23 = sdiv i32 %22, 2
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [50 x i32], [50 x i32]* %21, i64 0, i64 %24
store i32 %17, i32* %25
br label %26
26: ; preds = %14, %0
store i32 0, i32* %3
br label %27
27: ; preds = %50, %26
%28 = load i32, i32* %3
%29 = load i32, i32* %2
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %53
31: ; preds = %27
store i32 0, i32* %4
br label %32
32: ; preds = %45, %31
%33 = load i32, i32* %4
%34 = load i32, i32* %2
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %48
36: ; preds = %32
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %5, i64 0, i64 %38
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [50 x i32], [50 x i32]* %39, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %36
%46 = load i32, i32* %4
%47 = add nsw i32 %46, 1
store i32 %47, i32* %4
br label %32
48: ; preds = %32
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %50
50: ; preds = %48
%51 = load i32, i32* %3
%52 = add nsw i32 %51, 1
store i32 %52, i32* %3
br label %27
53: ; preds = %27
ret i32 0
}

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