#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*/ displayPathtoPrincess(int, char **);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int main(void) {
  int m;
  scanf("%d", &m);
  char grid[101][101] = {};
  char line[101];
  for (int i = 0; i < m; i++) {
    scanf("%s", line);
    strcpy(grid[i], line);
  }
  displayPathtoPrincess(m, grid);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2870,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x27f0(%rbp),%rdi
xor    %esi,%esi
mov    $0x27d9,%edx
call   1050 <memset@plt>
movl   $0x0,-0x2864(%rbp)
mov    -0x2864(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11da <main+0x9a>
lea    -0x2860(%rbp),%rsi
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
movslq -0x2864(%rbp),%rax
lea    -0x27f0(%rbp),%rdi
imul   $0x65,%rax,%rax
add    %rax,%rdi
lea    -0x2860(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x2864(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2864(%rbp)
jmp    1181 <main+0x41>
mov    -0x8(%rbp),%edi
lea    -0x27f0(%rbp),%rsi
call   1030 <displayPathtoPrincess@plt>
xor    %eax,%eax
add    $0x2870,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x2868,%rsp
lea    0xeab(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0x80(%rsp),%r12
mov    $0x27d9,%edx
mov    %r12,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
mov    0xc(%rsp),%edi
test   %edi,%edi
jle    11ba <main+0x7a>
lea    0xe7c(%rip),%r14
lea    0x10(%rsp),%r15
xor    %ebx,%ebx
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rdi
add    $0x65,%r12
cmp    %rdi,%rbx
jl     1190 <main+0x50>
lea    0x80(%rsp),%rsi
call   1030 <displayPathtoPrincess@plt>
xor    %eax,%eax
add    $0x2868,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [101 x [101 x i8]]
%4 = alloca [101 x i8]
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = bitcast [101 x [101 x i8]]* %3 to i8*
store i32 0, i32* %5
br label %8
8: ; preds = %21, %0
%9 = load i32, i32* %5
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %24
12: ; preds = %8
%13 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [101 x [101 x i8]], [101 x [101 x i8]]* %3, i64 0, i64 %16
%18 = getelementptr inbounds [101 x i8], [101 x i8]* %17, i64 0, i64 0
%19 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%20 = call i32 @strcpy(i8* %18, i8* %19)
br label %21
21: ; preds = %12
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %8
24: ; preds = %8
%25 = load i32, i32* %2
%26 = getelementptr inbounds [101 x [101 x i8]], [101 x [101 x i8]]* %3, i64 0, i64 0
%27 = bitcast [101 x i8]* %26 to i8**
%28 = call i32 @displayPathtoPrincess(i32 %25, i8** %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [101 x [101 x i8]]
%3 = alloca [101 x i8]
%4 = bitcast i32* %1 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = getelementptr inbounds [101 x [101 x i8]], [101 x [101 x i8]]* %2, i64 0, i64 0, i64 0
%7 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 0
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %14, %0
%11 = phi i32 [ %8, %0 ], [ %20, %14 ]
%12 = bitcast [101 x [101 x i8]]* %2 to i8**
%13 = call i32 @displayPathtoPrincess(i32 %11, i8** %12)
ret i32 0
14: ; preds = %0, %14
%15 = phi i64 [ %19, %14 ], [ 0, %0 ]
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%17 = getelementptr inbounds [101 x [101 x i8]], [101 x [101 x i8]]* %2, i64 0, i64 %15, i64 0
%18 = call i32 @strcpy(i8* %17, i8* %7)
%19 = add nuw nsw i64 %15, 1
%20 = load i32, i32* %1
%21 = sext i32 %20 to i64
%22 = icmp slt i64 %19, %21
br i1 %22, label %14, label %10
}