#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*/ IfColumsMagic(int **, int);
int /*<<< orphan*/ IfDiagMagic(int **, int);
int /*<<< orphan*/ IfRowsMagic(int **, int);
int IfSqrMagic(int square[1000][1000], int size) {
  if (!IfRowsMagic(square, size) || !IfColumsMagic(square, size) ||
      !IfDiagMagic(square, size)) {
    return 0;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<IfSqrMagic>:
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   1030 <IfRowsMagic@plt>
cmp    $0x0,%eax
je     117e <IfSqrMagic+0x4e>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <IfColumsMagic@plt>
cmp    $0x0,%eax
je     117e <IfSqrMagic+0x4e>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <IfDiagMagic@plt>
cmp    $0x0,%eax
jne    118a <IfSqrMagic+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    1191 <IfSqrMagic+0x61>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @IfSqrMagic([1000 x i32]* %0, i32 %1) {
%3 = alloca i32
%4 = alloca [1000 x i32]*
%5 = alloca i32
store [1000 x i32]* %0, [1000 x i32]** %4
store i32 %1, i32* %5
%6 = load [1000 x i32]*, [1000 x i32]** %4
%7 = bitcast [1000 x i32]* %6 to i32**
%8 = load i32, i32* %5
%9 = call i32 @IfRowsMagic(i32** %7, i32 %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %23
11: ; preds = %2
%12 = load [1000 x i32]*, [1000 x i32]** %4
%13 = bitcast [1000 x i32]* %12 to i32**
%14 = load i32, i32* %5
%15 = call i32 @IfColumsMagic(i32** %13, i32 %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %11
%18 = load [1000 x i32]*, [1000 x i32]** %4
%19 = bitcast [1000 x i32]* %18 to i32**
%20 = load i32, i32* %5
%21 = call i32 @IfDiagMagic(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 @IfSqrMagic([1000 x i32]* %0, i32 %1) {
%3 = bitcast [1000 x i32]* %0 to i32**
%4 = tail call i32 @IfRowsMagic(i32** %3, i32 %1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %2
%7 = tail call i32 @IfColumsMagic(i32** %3, i32 %1)
%8 = icmp eq i32 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = tail call i32 @IfDiagMagic(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
}