#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 goodv(int **, int *, int, int);
int /*<<< orphan*/ printf(char *, int, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int mat[20][20], m, n;
  int g = 0, i, j;
  int index[2];
  scanf("%d", &m);
  scanf("%d", &n);
  for (i = 0; i < m; ++i)
    for (j = 0; j < n; ++j)
      scanf("%d", &mat[i][j]);
  g = goodv(mat, index, m, n);
  printf("%d %d %d", g, index[0] + 1, index[1] + 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x670,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x65c(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x654(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xea0(%rip),%rdi
lea    -0x658(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x660(%rbp)
mov    -0x660(%rbp),%eax
cmp    -0x654(%rbp),%eax
jge    1206 <main+0xd6>
movl   $0x0,-0x664(%rbp)
mov    -0x664(%rbp),%eax
cmp    -0x658(%rbp),%eax
jge    11ed <main+0xbd>
movslq -0x660(%rbp),%rax
lea    -0x650(%rbp),%rsi
imul   $0x50,%rax,%rax
add    %rax,%rsi
movslq -0x664(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe32(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x664(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x664(%rbp)
jmp    1198 <main+0x68>
jmp    11f2 <main+0xc2>
mov    -0x660(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x660(%rbp)
jmp    117c <main+0x4c>
lea    -0x650(%rbp),%rdi
lea    -0x66c(%rbp),%rsi
mov    -0x654(%rbp),%edx
mov    -0x658(%rbp),%ecx
call   1030 <goodv@plt>
mov    %eax,-0x65c(%rbp)
mov    -0x65c(%rbp),%esi
mov    -0x66c(%rbp),%edx
add    $0x1,%edx
mov    -0x668(%rbp),%ecx
add    $0x1,%ecx
lea    0xdb6(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x670,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x650,%rsp
lea    0xebf(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edx
mov    (%rsp),%ecx
test   %edx,%edx
jle    11c2 <main+0x92>
lea    0x10(%rsp),%r15
xor    %r12d,%r12d
lea    0xe8d(%rip),%r14
jmp    1190 <main+0x60>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r12
movslq %edx,%rax
add    $0x50,%r15
cmp    %rax,%r12
jge    11c2 <main+0x92>
test   %ecx,%ecx
jle    1180 <main+0x50>
mov    %r15,%r13
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbx
movslq (%rsp),%rcx
add    $0x4,%r13
cmp    %rcx,%rbx
jl     11a0 <main+0x70>
mov    0x4(%rsp),%edx
jmp    1180 <main+0x50>
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <goodv@plt>
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%ecx
add    $0x1,%edx
add    $0x1,%ecx
lea    0xe1a(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x650,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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