#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*/ Are_Columns_Magic(int **, int);
int /*<<< orphan*/ Are_Diagonals_Magic(int **, int);
int /*<<< orphan*/ Are_Rows_Magic(int **, int);
int Is_Square_Magic(int square[999][999], int size) {
  if (!Are_Rows_Magic(square, size) || !Are_Columns_Magic(square, size) ||
      !Are_Diagonals_Magic(square, size)) {
    return 0;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<Is_Square_Magic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <Are_Rows_Magic@plt>
cmp    $0x0,%eax
je     117e <Is_Square_Magic+0x4e>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <Are_Columns_Magic@plt>
cmp    $0x0,%eax
je     117e <Is_Square_Magic+0x4e>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <Are_Diagonals_Magic@plt>
cmp    $0x0,%eax
jne    118a <Is_Square_Magic+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    1191 <Is_Square_Magic+0x61>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Is_Square_Magic>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
call   1050 <Are_Rows_Magic@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     1167 <Is_Square_Magic+0x37>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <Are_Columns_Magic@plt>
test   %eax,%eax
je     1167 <Is_Square_Magic+0x37>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1040 <Are_Diagonals_Magic@plt>
xor    %ebp,%ebp
test   %eax,%eax
setne  %bpl
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @Is_Square_Magic([999 x i32]* %0, i32 %1) {
%3 = alloca i32
%4 = alloca [999 x i32]*
%5 = alloca i32
store [999 x i32]* %0, [999 x i32]** %4
store i32 %1, i32* %5
%6 = load [999 x i32]*, [999 x i32]** %4
%7 = bitcast [999 x i32]* %6 to i32**
%8 = load i32, i32* %5
%9 = call i32 @Are_Rows_Magic(i32** %7, i32 %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %23
11: ; preds = %2
%12 = load [999 x i32]*, [999 x i32]** %4
%13 = bitcast [999 x i32]* %12 to i32**
%14 = load i32, i32* %5
%15 = call i32 @Are_Columns_Magic(i32** %13, i32 %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %11
%18 = load [999 x i32]*, [999 x i32]** %4
%19 = bitcast [999 x i32]* %18 to i32**
%20 = load i32, i32* %5
%21 = call i32 @Are_Diagonals_Magic(i32** %19, i32 %20)
%22 = icmp ne i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %17, %11, %2
store i32 0, i32* %3
br label %25
24: ; preds = %17
store i32 1, i32* %3
br label %25
25: ; preds = %24, %23
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @Is_Square_Magic([999 x i32]* %0, i32 %1) {
%3 = bitcast [999 x i32]* %0 to i32**
%4 = tail call i32 @Are_Rows_Magic(i32** %3, i32 %1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %2
%7 = tail call i32 @Are_Columns_Magic(i32** %3, i32 %1)
%8 = icmp eq i32 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = tail call i32 @Are_Diagonals_Magic(i32** %3, i32 %1)
%11 = icmp ne i32 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %9, %2, %6
%14 = phi i32 [ 0, %6 ], [ 0, %2 ], [ %12, %9 ]
ret i32 %14
}