#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 check(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int x, k;
  printf("Enter the size of the square:\n");
  scanf("%d", &x);
  int i, sq[x][x];
  for (i = 0; i < x; i++) {
    for (k = 0; k < x; k++) {
      printf("Enter the num for coordinates x[%d][%d]\n", i + 1, k + 1);
      scanf("%d", &sq[i][k]);
    }
  }
  int *pt = &sq[0][0];
  int result = check(pt, x);
  if (result) {
    printf("No it isnt.\n");
  } else {
    printf("Yes it is.\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x18(%rbp)
mov    %rcx,%rdx
imul   %rdx,%rdx
lea    0xf(,%rdx,4),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x40(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x20(%rbp)
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1227 <main+0xf7>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1214 <main+0xe4>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
mov    -0xc(%rbp),%edx
add    $0x1,%edx
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%rcx
mov    -0x40(%rbp),%rsi
movslq -0x10(%rbp),%rax
imul   %rcx,%rax
shl    $0x2,%rax
add    %rax,%rsi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe1e(%rip),%rdi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b2 <main+0x82>
jmp    1219 <main+0xe9>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    119f <main+0x6f>
mov    -0x40(%rbp),%rax
mov    -0x48(%rbp),%rcx
imul   $0x0,%rcx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <check@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     126a <main+0x13a>
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1278 <main+0x148>
lea    0xde7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
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    0xed4(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9c(%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,%rbx
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    -0x2c(%rbp),%esi
test   %esi,%esi
mov    %rbx,-0x38(%rbp)
jle    1216 <main+0xd6>
shl    $0x2,%rcx
lea    0xe5d(%rip),%r15
lea    0xe53(%rip),%r12
xor    %r13d,%r13d
mov    %rcx,-0x48(%rbp)
jmp    11cb <main+0x8b>
cs nopw 0x0(%rax,%rax,1)
movslq %esi,%rax
add    %rcx,%rbx
cmp    %rax,%r13
jge    1216 <main+0xd6>
add    $0x1,%r13
test   %esi,%esi
jle    11c0 <main+0x80>
mov    %rbx,-0x50(%rbp)
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
add    $0x1,%r14
mov    %r15,%rdi
mov    %r13d,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
movslq -0x2c(%rbp),%rsi
add    $0x4,%rbx
cmp    %rsi,%r14
jl     11e0 <main+0xa0>
mov    -0x48(%rbp),%rcx
mov    -0x50(%rbp),%rbx
jmp    11c0 <main+0x80>
mov    -0x38(%rbp),%rdi
call   1060 <check@plt>
test   %eax,%eax
lea    0xe22(%rip),%rax
lea    0xe26(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    -0x40(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Enter the size of the square:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [41 x i8] c"Enter the num for coordinates x[%d][%d]\0A\00"
@.str.3 = [13 x i8] c"No it isnt.\0A\00"
@.str.4 = [12 x i8] c"Yes it is.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32*
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
%13 = zext i32 %12 to i64
%14 = load i32, i32* %2
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %5
%17 = mul nuw i64 %13, %15
%18 = alloca i32, i64 %17
store i64 %13, i64* %6
store i64 %15, i64* %7
store i32 0, i32* %4
br label %19
19: ; preds = %46, %0
%20 = load i32, i32* %4
%21 = load i32, i32* %2
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %49
23: ; preds = %19
store i32 0, i32* %3
br label %24
24: ; preds = %42, %23
%25 = load i32, i32* %3
%26 = load i32, i32* %2
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %45
28: ; preds = %24
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %30, i32 %32)
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = mul nsw i64 %35, %15
%37 = getelementptr inbounds i32, i32* %18, i64 %36
%38 = load i32, i32* %3
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %37, i64 %39
%41 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %40)
br label %42
42: ; preds = %28
%43 = load i32, i32* %3
%44 = add nsw i32 %43, 1
store i32 %44, i32* %3
br label %24
45: ; preds = %24
br label %46
46: ; preds = %45
%47 = load i32, i32* %4
%48 = add nsw i32 %47, 1
store i32 %48, i32* %4
br label %19
49: ; preds = %19
%50 = mul nsw i64 0, %15
%51 = getelementptr inbounds i32, i32* %18, i64 %50
%52 = getelementptr inbounds i32, i32* %51, i64 0
store i32* %52, i32** %8
%53 = load i32*, i32** %8
%54 = load i32, i32* %2
%55 = call i32 @check(i32* %53, i32 %54)
store i32 %55, i32* %9
%56 = load i32, i32* %9
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %60
58: ; preds = %49
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %62
60: ; preds = %49
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %62
62: ; preds = %60, %58
store i32 0, i32* %1
%63 = load i8*, i8** %5
%64 = load i32, i32* %1
ret i32 %64
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [41 x i8] c"Enter the num for coordinates x[%d][%d]\0A\00"
@str = [30 x i8] c"Enter the size of the square:\00"
@str.5 = [11 x i8] c"Yes it is.\00"
@str.6 = [12 x i8] c"No it isnt.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
%8 = mul nuw i64 %6, %6
%9 = alloca i32, i64 %8
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %35
12: ; preds = %0, %31
%13 = phi i32 [ %32, %31 ], [ %10, %0 ]
%14 = phi i64 [ %16, %31 ], [ 0, %0 ]
%15 = icmp sgt i32 %13, 0
%16 = add nuw nsw i64 %14, 1
br i1 %15, label %17, label %31
17: ; preds = %12
%18 = mul nuw nsw i64 %14, %6
%19 = getelementptr inbounds i32, i32* %9, i64 %18
%20 = trunc i64 %16 to i32
br label %21
21: ; preds = %17, %21
%22 = phi i64 [ 0, %17 ], [ %23, %21 ]
%23 = add nuw nsw i64 %22, 1
%24 = trunc i64 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %20, i32 %24)
%26 = getelementptr inbounds i32, i32* %19, i64 %22
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %26)
%28 = load i32, i32* %1
%29 = sext i32 %28 to i64
%30 = icmp slt i64 %23, %29
br i1 %30, label %21, label %31
31: ; preds = %21, %12
%32 = phi i32 [ %13, %12 ], [ %28, %21 ]
%33 = sext i32 %32 to i64
%34 = icmp slt i64 %16, %33
br i1 %34, label %12, label %35
35: ; preds = %31, %0
%36 = phi i32 [ %10, %0 ], [ %32, %31 ]
%37 = call i32 @check(i32* %9, i32 %36)
%38 = icmp eq i32 %37, 0
%39 = select i1 %38, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.6, i64 0, i64 0)
%40 = call i32 @puts(i8* dereferenceable(1) %39)
ret i32 0
}