#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 checkParity(int **, int, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int mat[100][100], mSize, rowFix, colFix, row, col, result;
  while (1) {
    scanf("%d", &mSize);
    if (mSize == 0)
      break;
    for (row = 0; row < mSize; row++)
      for (col = 0; col < mSize; col++)
        scanf("%d", &mat[row][col]);
    result = checkParity(mat, mSize, &rowFix, &colFix);
    switch (result) {
    case 0:
      printf("OK\n");
      break;
    case 1:
      printf("Change bit (%d,%d)\n", rowFix + 1, colFix + 1);
      break;
    default:
      printf("Corrupt\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9c70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x9c54(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x9c54(%rbp)
jne    1167 <main+0x37>
jmp    129c <main+0x16c>
movl   $0x0,-0x9c60(%rbp)
mov    -0x9c60(%rbp),%eax
cmp    -0x9c54(%rbp),%eax
jge    11fe <main+0xce>
movl   $0x0,-0x9c64(%rbp)
mov    -0x9c64(%rbp),%eax
cmp    -0x9c54(%rbp),%eax
jge    11e5 <main+0xb5>
movslq -0x9c60(%rbp),%rax
lea    -0x9c50(%rbp),%rsi
imul   $0x190,%rax,%rax
add    %rax,%rsi
movslq -0x9c64(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe34(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x9c64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c64(%rbp)
jmp    118d <main+0x5d>
jmp    11ea <main+0xba>
mov    -0x9c60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c60(%rbp)
jmp    1171 <main+0x41>
mov    -0x9c54(%rbp),%esi
lea    -0x9c50(%rbp),%rdi
lea    -0x9c58(%rbp),%rdx
lea    -0x9c5c(%rbp),%rcx
call   1030 <checkParity@plt>
mov    %eax,-0x9c68(%rbp)
mov    -0x9c68(%rbp),%eax
mov    %eax,-0x9c6c(%rbp)
test   %eax,%eax
je     1251 <main+0x121>
jmp    123d <main+0x10d>
mov    -0x9c6c(%rbp),%eax
sub    $0x1,%eax
je     1264 <main+0x134>
jmp    1289 <main+0x159>
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1297 <main+0x167>
mov    -0x9c58(%rbp),%esi
add    $0x1,%esi
mov    -0x9c5c(%rbp),%edx
add    $0x1,%edx
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1297 <main+0x167>
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0x9c70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x9c58,%rsp
lea    0xea8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
je     1251 <main+0x111>
lea    0x10(%rsp),%r15
lea    0xe86(%rip),%rbx
jmp    11a5 <main+0x65>
nopl   0x0(%rax)
lea    0xe93(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
je     1251 <main+0x111>
test   %esi,%esi
jle    1200 <main+0xc0>
mov    %r15,%r14
xor    %r12d,%r12d
jmp    11d3 <main+0x93>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movslq %esi,%rax
add    $0x1,%r12
add    $0x190,%r14
cmp    %rax,%r12
jge    1200 <main+0xc0>
test   %esi,%esi
jle    11c0 <main+0x80>
mov    %r14,%r13
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r13,%rsi
call   1060 <scanf@plt>
add    $0x1,%rbp
movslq 0x4(%rsp),%rsi
add    $0x4,%r13
cmp    %rsi,%rbp
jl     11e0 <main+0xa0>
jmp    11c0 <main+0x80>
nop
mov    %r15,%rdi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1030 <checkParity@plt>
cmp    $0x1,%eax
je     1230 <main+0xf0>
test   %eax,%eax
jne    1180 <main+0x40>
lea    0xdf1(%rip),%rdi
jmp    1187 <main+0x47>
nopl   0x0(%rax,%rax,1)
mov    0xc(%rsp),%esi
add    $0x1,%esi
mov    0x8(%rsp),%edx
add    $0x1,%edx
lea    0xdbe(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    118c <main+0x4c>
xor    %eax,%eax
add    $0x9c58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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