#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 Suming(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int huchuc, i, j, size;
  int square[size][size];
  printf("vuvedi razmer na kvadrata\n");
  scanf("%d", &size);
  printf("\nVuvedete 4islata na kvadrata:\n");
  for (i = 0; i < size; i++) {
    for (j = 0; j < size; j++) {
      scanf("%d", &square[i][j]);
    }
  }
  huchuc = Suming(size);
  if (huchuc) {
    printf("\nMagic\n");
  } else
    printf("\nNo Magic\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x20(%rbp)
mov    %rcx,%rdx
imul   %rdx,%rdx
lea    0xf(,%rdx,4),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x38(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8e(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1217 <main+0xe7>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1204 <main+0xd4>
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rcx
movslq -0xc(%rbp),%rax
imul   %rcx,%rax
shl    $0x2,%rax
add    %rax,%rsi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe2a(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11bc <main+0x8c>
jmp    1209 <main+0xd9>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a9 <main+0x79>
mov    -0x14(%rbp),%edi
call   1030 <Suming@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     123d <main+0x10d>
lea    0xe0b(%rip),%rdi
call   1040 <printf@plt>
jmp    1249 <main+0x119>
lea    0xe02(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsp,%r15
lea    0xebe(%rip),%rdi
call   1040 <puts@plt>
lea    0xeaf(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
lea    0xebb(%rip),%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%edi
test   %edi,%edi
jle    11bf <main+0x8f>
xor    %r12d,%r12d
mov    %rsp,%r13
lea    0xe84(%rip),%r14
jmp    118c <main+0x5c>
xchg   %ax,%ax
movslq %edi,%rax
add    $0x1,%r12
cmp    %rax,%r12
jge    11bf <main+0x8f>
test   %edi,%edi
jle    1180 <main+0x50>
mov    %r13,%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbp
movslq 0x4(%rsp),%rdi
add    $0x4,%rbx
cmp    %rdi,%rbp
jl     11a0 <main+0x70>
jmp    1180 <main+0x50>
call   1030 <Suming@plt>
test   %eax,%eax
lea    0xe6f(%rip),%rax
lea    0xe72(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
mov    %r15,%rsp
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"vuvedi razmer na kvadrata\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [32 x i8] c"\0AVuvedete 4islata na kvadrata:\0A\00"
@.str.3 = [8 x i8] c"\0AMagic\0A\00"
@.str.4 = [11 x i8] c"\0ANo Magic\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
store i32 0, i32* %1
%9 = load i32, i32* %5
%10 = zext i32 %9 to i64
%11 = load i32, i32* %5
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %6
%14 = mul nuw i64 %10, %12
%15 = alloca i32, i64 %14
store i64 %10, i64* %7
store i64 %12, i64* %8
%16 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%18 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %19
19: ; preds = %41, %0
%20 = load i32, i32* %3
%21 = load i32, i32* %5
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %44
23: ; preds = %19
store i32 0, i32* %4
br label %24
24: ; preds = %37, %23
%25 = load i32, i32* %4
%26 = load i32, i32* %5
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %40
28: ; preds = %24
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = mul nsw i64 %30, %12
%32 = getelementptr inbounds i32, i32* %15, i64 %31
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %32, i64 %34
%36 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %35)
br label %37
37: ; preds = %28
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %24
40: ; preds = %24
br label %41
41: ; preds = %40
%42 = load i32, i32* %3
%43 = add nsw i32 %42, 1
store i32 %43, i32* %3
br label %19
44: ; preds = %19
%45 = load i32, i32* %5
%46 = call i32 @Suming(i32 %45)
store i32 %46, i32* %2
%47 = load i32, i32* %2
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %44
%50 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %53
51: ; preds = %44
%52 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %53
53: ; preds = %51, %49
store i32 0, i32* %1
%54 = load i8*, i8** %6
%55 = load i32, i32* %1
ret i32 %55
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [26 x i8] c"vuvedi razmer na kvadrata\00"
@str.5 = [31 x i8] c"\0AVuvedete 4islata na kvadrata:\00"
@str.6 = [10 x i8] c"\0ANo Magic\00"
@str.7 = [7 x i8] c"\0AMagic\00"
define i32 @main() {
%1 = alloca [0 x i32]
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i8* @llvm.stacksave()
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.5, i64 0, i64 0))
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %27
10: ; preds = %0, %22
%11 = phi i32 [ %23, %22 ], [ %8, %0 ]
%12 = phi i64 [ %25, %22 ], [ 0, %0 ]
%13 = icmp sgt i32 %11, 0
br i1 %13, label %14, label %22
14: ; preds = %10, %14
%15 = phi i64 [ %18, %14 ], [ 0, %10 ]
%16 = getelementptr inbounds [0 x i32], [0 x i32]* %1, i64 0, i64 %15
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = add nuw nsw i64 %15, 1
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = icmp slt i64 %18, %20
br i1 %21, label %14, label %22
22: ; preds = %14, %10
%23 = phi i32 [ %11, %10 ], [ %19, %14 ]
%24 = sext i32 %23 to i64
%25 = add nuw nsw i64 %12, 1
%26 = icmp slt i64 %25, %24
br i1 %26, label %10, label %27
27: ; preds = %22, %0
%28 = phi i32 [ %8, %0 ], [ %23, %22 ]
%29 = call i32 @Suming(i32 %28)
%30 = icmp eq i32 %29, 0
%31 = select i1 %30, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str.6, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str.7, i64 0, i64 0)
%32 = call i32 @puts(i8* dereferenceable(1) %31)
ret i32 0
}