#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*/ compute(char **, char, char, int *, int *);
char getchar();
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, char *, char *);
int main() {
  char me, opponent;
  int x, y;
  char board[8][8];
  char newline;
  int row, col;
  while (1) {
    scanf("%c %c\n", &me, &opponent);
    for (x = 0; x < 8; x++) {
      for (y = 0; y < 8; y++)
        board[x][y] = getchar();
      newline = getchar();
    }
    compute(board, me, opponent, &row, &col);
    printf("%d %d\n", row, col);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x5(%rbp),%rsi
lea    -0x6(%rbp),%rdx
call   1050 <scanf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    11ca <main+0x8a>
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    11b2 <main+0x72>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,%dl
movslq -0xc(%rbp),%rcx
lea    -0x50(%rbp),%rax
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117b <main+0x3b>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x51(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116a <main+0x2a>
lea    -0x50(%rbp),%rdi
mov    -0x5(%rbp),%al
lea    -0x58(%rbp),%rcx
lea    -0x5c(%rbp),%r8
movsbl %al,%esi
movsbl -0x6(%rbp),%edx
call   1060 <compute@plt>
mov    -0x58(%rbp),%esi
mov    -0x5c(%rbp),%edx
lea    0xe15(%rip),%rdi
call   1030 <printf@plt>
jmp    114f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
lea    0x6(%rsp),%r12
lea    0x10(%rsp),%r13
lea    0xc(%rsp),%rbx
lea    0x8(%rsp),%rbp
lea    0xe9e(%rip),%r14
nopl   0x0(%rax)
lea    0xe89(%rip),%rdi
lea    0x7(%rsp),%rsi
mov    %r12,%rdx
call   1050 <scanf@plt>
xor    %r15d,%r15d
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,0x10(%rsp,%r15,8)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,0x11(%rsp,%r15,8)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,0x12(%rsp,%r15,8)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,0x13(%rsp,%r15,8)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,0x14(%rsp,%r15,8)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,0x15(%rsp,%r15,8)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,0x16(%rsp,%r15,8)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,0x17(%rsp,%r15,8)
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x1,%r15
cmp    $0x8,%r15
jne    1190 <main+0x50>
movsbl 0x7(%rsp),%esi
movsbl 0x6(%rsp),%edx
mov    %r13,%rdi
mov    %rbx,%rcx
mov    %rbp,%r8
call   1060 <compute@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %r14,%rdi
call   1030 <printf@plt>
jmp    1170 <main+0x30>

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

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