#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 */
scalar_t__ magic(int, int **);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void main(void) {
  int size;
  scanf("%d", &size);
  int number[size][size];
  int row, column = 0;
  for (row = 0; row < size; row++) {
    for (column = 0; column < size; column++)
      scanf("%d", &number[row][column]);
  }
  if (magic(size, number))
    printf("Magic square\n");
  else
    printf("Not Magic square\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xec1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x10(%rbp)
mov    %rcx,%rdx
imul   %rdx,%rdx
lea    0xf(,%rdx,4),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x30(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x18(%rbp)
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11ff <main+0xcf>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11ec <main+0xbc>
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rcx
movslq -0x24(%rbp),%rax
imul   %rcx,%rax
shl    $0x2,%rax
add    %rax,%rsi
movslq -0x28(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe27(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11a4 <main+0x74>
jmp    11f1 <main+0xc1>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1191 <main+0x61>
mov    -0x30(%rbp),%rsi
mov    -0x4(%rbp),%edi
call   1030 <magic@plt>
cmp    $0x0,%rax
je     1226 <main+0xf6>
lea    0xdeb(%rip),%rdi
call   1040 <printf@plt>
jmp    1232 <main+0x102>
lea    0xdd6(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
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    $0x28,%rsp
lea    0xeb8(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1050 <scanf@plt>
mov    %rsp,-0x40(%rbp)
mov    -0x2c(%rbp),%ecx
mov    %rcx,%rax
imul   %rcx,%rax
mov    %rsp,%r14
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    -0x2c(%rbp),%edi
test   %edi,%edi
mov    %r14,-0x38(%rbp)
jle    11e2 <main+0xb2>
shl    $0x2,%rcx
xor    %r12d,%r12d
lea    0xe73(%rip),%r15
mov    %rcx,-0x48(%rbp)
jmp    11af <main+0x7f>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movslq %edi,%rax
add    $0x1,%r12
add    %rcx,%r14
cmp    %rax,%r12
jge    11e2 <main+0xb2>
test   %edi,%edi
jle    11a0 <main+0x70>
mov    %r14,%rbx
xor    %r13d,%r13d
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x1,%r13
movslq -0x2c(%rbp),%rdi
add    $0x4,%rbx
cmp    %rdi,%r13
jl     11c0 <main+0x90>
mov    -0x48(%rbp),%rcx
jmp    11a0 <main+0x70>
mov    -0x38(%rbp),%rsi
call   1030 <magic@plt>
test   %rax,%rax
lea    0xe0e(%rip),%rax
lea    0xe0b(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
mov    -0x40(%rbp),%rsp
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"
@.str.1 = [14 x i8] c"Magic square\0A\00"
@.str.2 = [18 x i8] c"Not Magic square\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = zext i32 %8 to i64
%10 = load i32, i32* %1
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %2
%13 = mul nuw i64 %9, %11
%14 = alloca i32, i64 %13
store i64 %9, i64* %3
store i64 %11, i64* %4
store i32 0, i32* %6
store i32 0, i32* %5
br label %15
15: ; preds = %37, %0
%16 = load i32, i32* %5
%17 = load i32, i32* %1
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %40
19: ; preds = %15
store i32 0, i32* %6
br label %20
20: ; preds = %33, %19
%21 = load i32, i32* %6
%22 = load i32, i32* %1
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %36
24: ; preds = %20
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = mul nsw i64 %26, %11
%28 = getelementptr inbounds i32, i32* %14, i64 %27
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %31)
br label %33
33: ; preds = %24
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
br label %20
36: ; preds = %20
br label %37
37: ; preds = %36
%38 = load i32, i32* %5
%39 = add nsw i32 %38, 1
store i32 %39, i32* %5
br label %15
40: ; preds = %15
%41 = load i32, i32* %1
%42 = bitcast i32* %14 to i32**
%43 = call i64 @magic(i32 %41, i32** %42)
%44 = icmp ne i64 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %40
%46 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %49
47: ; preds = %40
%48 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %49
49: ; preds = %47, %45
%50 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [17 x i8] c"Not Magic square\00"
@str.3 = [13 x i8] c"Magic square\00"
define void @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 = zext i32 %4 to i64
%6 = call i8* @llvm.stacksave()
%7 = mul nuw i64 %5, %5
%8 = alloca i32, i64 %7
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %31
11: ; preds = %0, %26
%12 = phi i32 [ %27, %26 ], [ %9, %0 ]
%13 = phi i64 [ %29, %26 ], [ 0, %0 ]
%14 = icmp sgt i32 %12, 0
br i1 %14, label %15, label %26
15: ; preds = %11
%16 = mul nuw nsw i64 %13, %5
%17 = getelementptr inbounds i32, i32* %8, i64 %16
br label %18
18: ; preds = %15, %18
%19 = phi i64 [ 0, %15 ], [ %22, %18 ]
%20 = getelementptr inbounds i32, i32* %17, i64 %19
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %20)
%22 = add nuw nsw i64 %19, 1
%23 = load i32, i32* %1
%24 = sext i32 %23 to i64
%25 = icmp slt i64 %22, %24
br i1 %25, label %18, label %26
26: ; preds = %18, %11
%27 = phi i32 [ %12, %11 ], [ %23, %18 ]
%28 = sext i32 %27 to i64
%29 = add nuw nsw i64 %13, 1
%30 = icmp slt i64 %29, %28
br i1 %30, label %11, label %31
31: ; preds = %26, %0
%32 = phi i32 [ %9, %0 ], [ %27, %26 ]
%33 = bitcast i32* %8 to i32**
%34 = call i64 @magic(i32 %32, i32** %33)
%35 = icmp eq i64 %34, 0
%36 = select i1 %35, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @str.3, i64 0, i64 0)
%37 = call i32 @puts(i8* dereferenceable(1) %36)
ret void
}