#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*/ check_good(int **, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int ar[30][30], m, n;
  scanf("%d%d", &m, &n);
  int i, j;
  if (m <= 30 && n <= 30) {
    for (i = 0; i < m; ++i) {
      for (j = 0; j < n; ++j)
        scanf("%d", &ar[i][j]);
    }
    check_good(ar, m, n);
  } else
    printf("too big matrix");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0xe24(%rbp),%rsi
lea    -0xe28(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
cmpl   $0x1e,-0xe24(%rbp)
jg     122b <main+0xfb>
cmpl   $0x1e,-0xe28(%rbp)
jg     122b <main+0xfb>
movl   $0x0,-0xe2c(%rbp)
mov    -0xe2c(%rbp),%eax
cmp    -0xe24(%rbp),%eax
jge    120e <main+0xde>
movl   $0x0,-0xe30(%rbp)
mov    -0xe30(%rbp),%eax
cmp    -0xe28(%rbp),%eax
jge    11f5 <main+0xc5>
movslq -0xe2c(%rbp),%rax
lea    -0xe20(%rbp),%rsi
imul   $0x78,%rax,%rax
add    %rax,%rsi
movslq -0xe30(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0xe30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe30(%rbp)
jmp    119e <main+0x6e>
jmp    11fa <main+0xca>
mov    -0xe2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe2c(%rbp)
jmp    1182 <main+0x52>
lea    -0xe20(%rbp),%rdi
mov    -0xe24(%rbp),%esi
mov    -0xe28(%rbp),%edx
call   1030 <check_good@plt>
jmp    1237 <main+0x107>
lea    0xdd3(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xe30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe20,%rsp
lea    0xeb9(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0x1e,%esi
jg     11c5 <main+0x95>
mov    0x8(%rsp),%edx
cmp    $0x1e,%edx
jg     11c5 <main+0x95>
test   %esi,%esi
jle    11d3 <main+0xa3>
lea    0x10(%rsp),%r15
lea    0xe88(%rip),%r14
xor    %r12d,%r12d
jmp    1190 <main+0x60>
nop
add    $0x1,%r12
movslq %esi,%rax
add    $0x78,%r15
cmp    %rax,%r12
jge    11d3 <main+0xa3>
test   %edx,%edx
jle    1180 <main+0x50>
mov    %r15,%r13
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rdx
add    $0x4,%r13
cmp    %rdx,%rbx
jl     11a0 <main+0x70>
mov    0xc(%rsp),%esi
jmp    1180 <main+0x50>
lea    0xe39(%rip),%rdi
call   1040 <printf@plt>
jmp    11dd <main+0xad>
lea    0x10(%rsp),%rdi
call   1030 <check_good@plt>
xor    %eax,%eax
add    $0xe20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"too big matrix\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [30 x [30 x i32]]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%8 = load i32, i32* %3
%9 = icmp sle i32 %8, 30
br i1 %9, label %10, label %44
10: ; preds = %0
%11 = load i32, i32* %4
%12 = icmp sle i32 %11, 30
br i1 %12, label %13, label %44
13: ; preds = %10
store i32 0, i32* %5
br label %14
14: ; preds = %35, %13
%15 = load i32, i32* %5
%16 = load i32, i32* %3
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %38
18: ; preds = %14
store i32 0, i32* %6
br label %19
19: ; preds = %31, %18
%20 = load i32, i32* %6
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %34
23: ; preds = %19
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [30 x [30 x i32]], [30 x [30 x i32]]* %2, i64 0, i64 %25
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [30 x i32], [30 x i32]* %26, i64 0, i64 %28
%30 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %29)
br label %31
31: ; preds = %23
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %19
34: ; preds = %19
br label %35
35: ; preds = %34
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %14
38: ; preds = %14
%39 = getelementptr inbounds [30 x [30 x i32]], [30 x [30 x i32]]* %2, i64 0, i64 0
%40 = bitcast [30 x i32]* %39 to i32**
%41 = load i32, i32* %3
%42 = load i32, i32* %4
%43 = call i32 @check_good(i32** %40, i32 %41, i32 %42)
br label %46
44: ; preds = %10, %0
%45 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %46
46: ; preds = %44, %38
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"too big matrix\00"
define i32 @main() {
%1 = alloca [30 x [30 x i32]]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [30 x [30 x i32]]* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 31
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 31
%12 = select i1 %9, i1 %11, i1 false
br i1 %12, label %13, label %41
13: ; preds = %0
%14 = icmp sgt i32 %8, 0
br i1 %14, label %15, label %36
15: ; preds = %13, %30
%16 = phi i32 [ %31, %30 ], [ %8, %13 ]
%17 = phi i32 [ %32, %30 ], [ %10, %13 ]
%18 = phi i64 [ %33, %30 ], [ 0, %13 ]
%19 = icmp sgt i32 %17, 0
br i1 %19, label %20, label %30
20: ; preds = %15, %20
%21 = phi i64 [ %24, %20 ], [ 0, %15 ]
%22 = getelementptr inbounds [30 x [30 x i32]], [30 x [30 x i32]]* %1, i64 0, i64 %18, i64 %21
%23 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = add nuw nsw i64 %21, 1
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = icmp slt i64 %24, %26
br i1 %27, label %20, label %28
28: ; preds = %20
%29 = load i32, i32* %2
br label %30
30: ; preds = %28, %15
%31 = phi i32 [ %29, %28 ], [ %16, %15 ]
%32 = phi i32 [ %25, %28 ], [ %17, %15 ]
%33 = add nuw nsw i64 %18, 1
%34 = sext i32 %31 to i64
%35 = icmp slt i64 %33, %34
br i1 %35, label %15, label %36
36: ; preds = %30, %13
%37 = phi i32 [ %10, %13 ], [ %32, %30 ]
%38 = phi i32 [ %8, %13 ], [ %31, %30 ]
%39 = bitcast [30 x [30 x i32]]* %1 to i32**
%40 = call i32 @check_good(i32** %39, i32 %38, i32 %37)
br label %43
41: ; preds = %0
%42 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %43
43: ; preds = %41, %36
ret i32 0
}