#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*/ Initialize_Square(int **, int);
scalar_t__ Is_Square_Magic(int **, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int square[999][999];
  int size;
  scanf("%d", &size);
  Initialize_Square(square, size);
  if (Is_Square_Magic(square, size)) {
    printf("Magic\n");
  } else {
    printf("No Magic\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3ce9e0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    -0x3ce9d4(%rbp),%rsi
call   1040 <scanf@plt>
lea    -0x3ce9d0(%rbp),%rdi
mov    -0x3ce9d4(%rbp),%esi
call   1060 <Initialize_Square@plt>
lea    -0x3ce9d0(%rbp),%rdi
mov    -0x3ce9d4(%rbp),%esi
call   1050 <Is_Square_Magic@plt>
cmp    $0x0,%rax
je     11a4 <main+0x64>
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
jmp    11b0 <main+0x70>
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x3ce9e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x3ce9e0,%rsp
lea    0xeb1(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <Initialize_Square@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1050 <Is_Square_Magic@plt>
test   %rax,%rax
lea    0xe83(%rip),%rax
lea    0xe7f(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x3ce9e0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"Magic\0A\00"
@.str.2 = [10 x i8] c"No Magic\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [999 x [999 x i32]]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%5 = getelementptr inbounds [999 x [999 x i32]], [999 x [999 x i32]]* %2, i64 0, i64 0
%6 = bitcast [999 x i32]* %5 to i32**
%7 = load i32, i32* %3
%8 = call i32 @Initialize_Square(i32** %6, i32 %7)
%9 = getelementptr inbounds [999 x [999 x i32]], [999 x [999 x i32]]* %2, i64 0, i64 0
%10 = bitcast [999 x i32]* %9 to i32**
%11 = load i32, i32* %3
%12 = call i64 @Is_Square_Magic(i32** %10, i32 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %18
16: ; preds = %0
%17 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [9 x i8] c"No Magic\00"
@str.3 = [6 x i8] c"Magic\00"
define i32 @main() {
%1 = alloca [999 x [999 x i32]]
%2 = alloca i32
%3 = bitcast [999 x [999 x i32]]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = bitcast [999 x [999 x i32]]* %1 to i32**
%7 = load i32, i32* %2
%8 = call i32 @Initialize_Square(i32** %6, i32 %7)
%9 = load i32, i32* %2
%10 = call i64 @Is_Square_Magic(i32** %6, i32 %9)
%11 = icmp eq i64 %10, 0
%12 = select i1 %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.3, i64 0, i64 0)
%13 = call i32 @puts(i8* dereferenceable(1) %12)
ret i32 0
}