#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*/ getchar();
int /*<<< orphan*/ scanf(char *, char *);
void readin(char puzzle[][5], int *x, int *y) {
  int i, j;
  for (i = 0; i < 5; i++) {
    if (i)
      for (j = 0; j < 5; j++) {
        scanf("%c", &puzzle[i][j]);
        if (puzzle[i][j] == ' ') {
          *x = i;
          *y = j;
        }
      }
    else
      for (j = 1; j < 5; j++) {
        scanf("%c", &puzzle[i][j]);
        if (puzzle[i][j] == ' ') {
          *x = i;
          *y = j;
        }
      }
    if (puzzle[i][4] == '\n') {
      puzzle[i][4] = ' ';
      *x = i;
      *y = 4;
    } else
      getchar();
  }
}


x86 assembly (clang, -O0):
<readin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    12aa <readin+0x18a>
cmpl   $0x0,-0x1c(%rbp)
je     11cc <readin+0xac>
movl   $0x0,-0x20(%rbp)
cmpl   $0x5,-0x20(%rbp)
jge    11c7 <readin+0xa7>
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
imul   $0x5,%rax,%rax
add    %rax,%rsi
movslq -0x20(%rbp),%rax
add    %rax,%rsi
lea    0xe83(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x5,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    11b4 <readin+0x94>
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    11b9 <readin+0x99>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1156 <readin+0x36>
jmp    1249 <readin+0x129>
movl   $0x1,-0x20(%rbp)
cmpl   $0x5,-0x20(%rbp)
jge    1244 <readin+0x124>
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
imul   $0x5,%rax,%rax
add    %rax,%rsi
movslq -0x20(%rbp),%rax
add    %rax,%rsi
lea    0xe06(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x5,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    1231 <readin+0x111>
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1236 <readin+0x116>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11d3 <readin+0xb3>
jmp    1249 <readin+0x129>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x5,%rcx,%rcx
add    %rcx,%rax
movsbl 0x4(%rax),%eax
cmp    $0xa,%eax
jne    1290 <readin+0x170>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x5,%rcx,%rcx
add    %rcx,%rax
movb   $0x20,0x4(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x4,(%rax)
jmp    1297 <readin+0x177>
mov    $0x0,%al
call   1030 <getchar@plt>
jmp    129c <readin+0x17c>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113b <readin+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readin>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0x1(%rdi),%rax
mov    %rax,0x20(%rsp)
lea    0x2(%rdi),%rax
mov    %rax,0x18(%rsp)
lea    0x3(%rdi),%rax
mov    %rax,0x10(%rsp)
lea    0x4(%rdi),%rax
mov    %rax,0x8(%rsp)
lea    0xe9e(%rip),%r13
xor    %ebp,%ebp
xor    %r12d,%r12d
mov    %rsi,(%rsp)
jmp    1189 <readin+0x69>
nopl   (%rax)
xor    %eax,%eax
call   1030 <getchar@plt>
add    $0x1,%r12d
add    $0x5,%rbp
cmp    $0x19,%rbp
je     130a <readin+0x1ea>
test   %rbp,%rbp
je     1260 <readin+0x140>
lea    (%rbx,%rbp,1),%rsi
mov    %r13,%rdi
call   1040 <scanf@plt>
cmpb   $0x20,(%rbx,%rbp,1)
jne    11ae <readin+0x8e>
mov    %r12d,(%r15)
movl   $0x0,(%r14)
lea    (%rbx,%rbp,1),%rsi
add    $0x1,%rsi
mov    %r13,%rdi
call   1040 <scanf@plt>
cmpb   $0x20,0x1(%rbx,%rbp,1)
jne    11cf <readin+0xaf>
mov    %r12d,(%r15)
movl   $0x1,(%r14)
lea    (%rbx,%rbp,1),%rsi
add    $0x2,%rsi
mov    %r13,%rdi
call   1040 <scanf@plt>
cmpb   $0x20,0x2(%rbx,%rbp,1)
jne    11f0 <readin+0xd0>
mov    %r12d,(%r15)
movl   $0x2,(%r14)
lea    (%rbx,%rbp,1),%rsi
add    $0x3,%rsi
mov    %r13,%rdi
call   1040 <scanf@plt>
cmpb   $0x20,0x3(%rbx,%rbp,1)
jne    1211 <readin+0xf1>
mov    %r12d,(%r15)
movl   $0x3,(%r14)
lea    (%rbx,%rbp,1),%rsi
add    $0x4,%rsi
mov    %r13,%rdi
call   1040 <scanf@plt>
cmpb   $0x20,0x4(%rbx,%rbp,1)
mov    %r12d,%eax
jne    1235 <readin+0x115>
mov    %eax,(%r15)
movl   $0x4,(%r14)
cmpb   $0xa,0x4(%rbx,%rbp,1)
jne    1170 <readin+0x50>
movb   $0x20,0x4(%rbx,%rbp,1)
mov    %r12d,(%r15)
movl   $0x4,(%r14)
jmp    1177 <readin+0x57>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%r15
mov    %r13,%rdi
mov    %r13,%r14
mov    0x20(%rsp),%r13
mov    %r13,%rsi
call   1040 <scanf@plt>
cmpb   $0x20,0x0(%r13)
jne    128e <readin+0x16e>
mov    (%rsp),%rax
movl   $0x0,(%rax)
movl   $0x1,(%r15)
mov    %r14,%rdi
mov    0x18(%rsp),%r13
mov    %r13,%rsi
call   1040 <scanf@plt>
cmpb   $0x20,0x0(%r13)
jne    12b6 <readin+0x196>
mov    (%rsp),%rax
movl   $0x0,(%rax)
movl   $0x2,(%r15)
mov    %r14,%rdi
mov    0x10(%rsp),%r13
mov    %r13,%rsi
call   1040 <scanf@plt>
cmpb   $0x20,0x0(%r13)
jne    12de <readin+0x1be>
mov    (%rsp),%rax
movl   $0x0,(%rax)
movl   $0x3,(%r15)
mov    %r14,%rdi
mov    0x8(%rsp),%r13
mov    %r13,%rsi
call   1040 <scanf@plt>
xor    %eax,%eax
cmpb   $0x20,0x0(%r13)
mov    %r14,%r13
mov    %r15,%r14
mov    (%rsp),%r15
je     122b <readin+0x10b>
jmp    1235 <readin+0x115>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define void @readin([5 x i8]* %0, i32* %1, i32* %2) {
%4 = alloca [5 x i8]*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store [5 x i8]* %0, [5 x i8]** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
store i32 0, i32* %7
br label %9
9: ; preds = %102, %3
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 5
br i1 %11, label %12, label %105
12: ; preds = %9
%13 = load i32, i32* %7
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %48
15: ; preds = %12
store i32 0, i32* %8
br label %16
16: ; preds = %44, %15
%17 = load i32, i32* %8
%18 = icmp slt i32 %17, 5
br i1 %18, label %19, label %47
19: ; preds = %16
%20 = load [5 x i8]*, [5 x i8]** %4
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [5 x i8], [5 x i8]* %20, i64 %22
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [5 x i8], [5 x i8]* %23, i64 0, i64 %25
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %26)
%28 = load [5 x i8]*, [5 x i8]** %4
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [5 x i8], [5 x i8]* %28, i64 %30
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [5 x i8], [5 x i8]* %31, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 32
br i1 %37, label %38, label %43
38: ; preds = %19
%39 = load i32, i32* %7
%40 = load i32*, i32** %5
store i32 %39, i32* %40
%41 = load i32, i32* %8
%42 = load i32*, i32** %6
store i32 %41, i32* %42
br label %43
43: ; preds = %38, %19
br label %44
44: ; preds = %43
%45 = load i32, i32* %8
%46 = add nsw i32 %45, 1
store i32 %46, i32* %8
br label %16
47: ; preds = %16
br label %81
48: ; preds = %12
store i32 1, i32* %8
br label %49
49: ; preds = %77, %48
%50 = load i32, i32* %8
%51 = icmp slt i32 %50, 5
br i1 %51, label %52, label %80
52: ; preds = %49
%53 = load [5 x i8]*, [5 x i8]** %4
%54 = load i32, i32* %7
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [5 x i8], [5 x i8]* %53, i64 %55
%57 = load i32, i32* %8
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [5 x i8], [5 x i8]* %56, i64 0, i64 %58
%60 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %59)
%61 = load [5 x i8]*, [5 x i8]** %4
%62 = load i32, i32* %7
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [5 x i8], [5 x i8]* %61, i64 %63
%65 = load i32, i32* %8
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [5 x i8], [5 x i8]* %64, i64 0, i64 %66
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = icmp eq i32 %69, 32
br i1 %70, label %71, label %76
71: ; preds = %52
%72 = load i32, i32* %7
%73 = load i32*, i32** %5
store i32 %72, i32* %73
%74 = load i32, i32* %8
%75 = load i32*, i32** %6
store i32 %74, i32* %75
br label %76
76: ; preds = %71, %52
br label %77
77: ; preds = %76
%78 = load i32, i32* %8
%79 = add nsw i32 %78, 1
store i32 %79, i32* %8
br label %49
80: ; preds = %49
br label %81
81: ; preds = %80, %47
%82 = load [5 x i8]*, [5 x i8]** %4
%83 = load i32, i32* %7
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [5 x i8], [5 x i8]* %82, i64 %84
%86 = getelementptr inbounds [5 x i8], [5 x i8]* %85, i64 0, i64 4
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = icmp eq i32 %88, 10
br i1 %89, label %90, label %99
90: ; preds = %81
%91 = load [5 x i8]*, [5 x i8]** %4
%92 = load i32, i32* %7
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [5 x i8], [5 x i8]* %91, i64 %93
%95 = getelementptr inbounds [5 x i8], [5 x i8]* %94, i64 0, i64 4
store i8 32, i8* %95
%96 = load i32, i32* %7
%97 = load i32*, i32** %5
store i32 %96, i32* %97
%98 = load i32*, i32** %6
store i32 4, i32* %98
br label %101
99: ; preds = %81
%100 = call i32 (...) @getchar()
br label %101
101: ; preds = %99, %90
br label %102
102: ; preds = %101
%103 = load i32, i32* %7
%104 = add nsw i32 %103, 1
store i32 %104, i32* %7
br label %9
105: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @readin([5 x i8]* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %0, i64 0, i64 1
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %0, i64 0, i64 2
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %0, i64 0, i64 3
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %0, i64 0, i64 4
br label %8
8: ; preds = %3, %75
%9 = phi i64 [ 0, %3 ], [ %76, %75 ]
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%13 = load i8, i8* %4
%14 = icmp eq i8 %13, 32
br i1 %14, label %50, label %51
15: ; preds = %8
%16 = getelementptr inbounds [5 x i8], [5 x i8]* %0, i64 %9, i64 0
%17 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i8, i8* %16
%19 = icmp eq i8 %18, 32
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = trunc i64 %9 to i32
store i32 %21, i32* %1
store i32 0, i32* %2
br label %22
22: ; preds = %15, %20
%23 = getelementptr inbounds [5 x i8], [5 x i8]* %0, i64 %9, i64 1
%24 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = load i8, i8* %23
%26 = icmp eq i8 %25, 32
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = trunc i64 %9 to i32
store i32 %28, i32* %1
store i32 1, i32* %2
br label %29
29: ; preds = %27, %22
%30 = getelementptr inbounds [5 x i8], [5 x i8]* %0, i64 %9, i64 2
%31 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %30)
%32 = load i8, i8* %30
%33 = icmp eq i8 %32, 32
br i1 %33, label %34, label %36
34: ; preds = %29
%35 = trunc i64 %9 to i32
store i32 %35, i32* %1
store i32 2, i32* %2
br label %36
36: ; preds = %34, %29
%37 = getelementptr inbounds [5 x i8], [5 x i8]* %0, i64 %9, i64 3
%38 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %37)
%39 = load i8, i8* %37
%40 = icmp eq i8 %39, 32
br i1 %40, label %41, label %43
41: ; preds = %36
%42 = trunc i64 %9 to i32
store i32 %42, i32* %1
store i32 3, i32* %2
br label %43
43: ; preds = %41, %36
%44 = getelementptr inbounds [5 x i8], [5 x i8]* %0, i64 %9, i64 4
%45 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %44)
%46 = load i8, i8* %44
%47 = icmp eq i8 %46, 32
br i1 %47, label %48, label %67
48: ; preds = %43
%49 = trunc i64 %9 to i32
br label %65
50: ; preds = %11
store i32 0, i32* %1
store i32 1, i32* %2
br label %51
51: ; preds = %11, %50
%52 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%53 = load i8, i8* %5
%54 = icmp eq i8 %53, 32
br i1 %54, label %55, label %56
55: ; preds = %51
store i32 0, i32* %1
store i32 2, i32* %2
br label %56
56: ; preds = %55, %51
%57 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%58 = load i8, i8* %6
%59 = icmp eq i8 %58, 32
br i1 %59, label %60, label %61
60: ; preds = %56
store i32 0, i32* %1
store i32 3, i32* %2
br label %61
61: ; preds = %60, %56
%62 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
%63 = load i8, i8* %7
%64 = icmp eq i8 %63, 32
br i1 %64, label %65, label %67
65: ; preds = %61, %48
%66 = phi i32 [ %49, %48 ], [ 0, %61 ]
store i32 %66, i32* %1
store i32 4, i32* %2
br label %67
67: ; preds = %65, %61, %43
%68 = getelementptr inbounds [5 x i8], [5 x i8]* %0, i64 %9, i64 4
%69 = load i8, i8* %68
%70 = icmp eq i8 %69, 10
br i1 %70, label %71, label %73
71: ; preds = %67
store i8 32, i8* %68
%72 = trunc i64 %9 to i32
store i32 %72, i32* %1
store i32 4, i32* %2
br label %75
73: ; preds = %67
%74 = tail call i32 (...) @getchar()
br label %75
75: ; preds = %71, %73
%76 = add nuw nsw i64 %9, 1
%77 = icmp eq i64 %76, 5
br i1 %77, label %78, label %8
78: ; preds = %75
ret void
}