#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*/ convierte(char **, int, int);
int encuentraRuta(int, int, char **);
int /*<<< orphan*/ muestra(char **, int, int);
int /*<<< orphan*/ printf(char *);
int main() {
  int solucion = 0;
  int filaini = 1;
  int columnaini = 1;
  char laberinto[10][13] = {{
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                            },
                            {
                                '#',
                                '.',
                                '.',
                                '#',
                                '#',
                                '#',
                                '.',
                                '.',
                                '.',
                                '.',
                                '#',
                                '.',
                                '#',
                            },
                            {
                                '#',
                                '#',
                                '.',
                                '.',
                                '.',
                                '#',
                                '.',
                                '#',
                                '#',
                                '#',
                                '.',
                                '.',
                                '#',
                            },
                            {
                                '#',
                                '.',
                                '.',
                                '#',
                                '.',
                                '#',
                                '.',
                                '#',
                                '.',
                                '.',
                                '.',
                                '#',
                                '#',
                            },
                            {
                                '#',
                                '#',
                                '#',
                                '.',
                                '.',
                                '.',
                                '.',
                                '#',
                                '#',
                                '#',
                                '#',
                                '.',
                                '#',
                            },
                            {
                                '#',
                                '.',
                                '.',
                                '.',
                                '#',
                                '#',
                                '#',
                                '.',
                                '.',
                                '.',
                                '.',
                                '#',
                                '#',
                            },
                            {
                                '#',
                                '.',
                                '#',
                                '.',
                                '.',
                                '.',
                                '.',
                                '.',
                                '#',
                                '#',
                                '.',
                                '.',
                                '#',
                            },
                            {
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '.',
                                '#',
                                '#',
                            },
                            {
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '.',
                                '#',
                                '#',
                            },
                            {
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '#',
                                '.',
                                '#',
                                '#',
                            }};
  if (laberinto[filaini][columnaini] == '#')
    printf("Error: Ha empezado en un obstáculo.\n");
  else {
    muestra(laberinto, 10, 13);
    solucion = encuentraRuta(filaini, columnaini, laberinto);
    if (!solucion) {
      printf("\n Error: Desde la posición de inicio dada no se encuentra "
             "salida.\n");
    } else {
      printf("\n Solución encontrada:\n");
      convierte(laberinto, 10, 13);
      muestra(laberinto, 10, 13);
      printf("\n Camino de salida marcado con *.\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
lea    -0xa0(%rbp),%rdi
lea    0xe7b(%rip),%rsi
mov    $0x82,%edx
call   1050 <memcpy@plt>
movslq -0xc(%rbp),%rcx
lea    -0xa0(%rbp),%rax
imul   $0xd,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x23,%eax
jne    11c3 <main+0x73>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
jmp    1252 <main+0x102>
lea    -0xa0(%rbp),%rdi
mov    $0xa,%esi
mov    $0xd,%edx
call   1070 <muestra@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
lea    -0xa0(%rbp),%rdx
call   1060 <encuentraRuta@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1209 <main+0xb9>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
jmp    124d <main+0xfd>
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
lea    -0xa0(%rbp),%rdi
mov    $0xa,%esi
mov    $0xd,%edx
call   1040 <convierte@plt>
lea    -0xa0(%rbp),%rdi
mov    $0xa,%esi
mov    $0xd,%edx
call   1070 <muestra@plt>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
jmp    1252 <main+0x102>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x90,%rsp
lea    0xea1(%rip),%rsi
mov    %rsp,%rbx
mov    $0x82,%edx
mov    %rbx,%rdi
call   1050 <memcpy@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0xd,%edx
call   1070 <muestra@plt>
mov    $0x1,%edi
mov    $0x1,%esi
mov    %rbx,%rdx
call   1060 <encuentraRuta@plt>
test   %eax,%eax
je     11d3 <main+0x83>
lea    0xf27(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0xd,%edx
call   1040 <convierte@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0xd,%edx
call   1070 <muestra@plt>
lea    0xf0c(%rip),%rdi
jmp    11da <main+0x8a>
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.laberinto = [10 x [13 x i8]] [[13 x i8] c"#############", [13 x i8] c"#..###....#.#", [13 x i8] c"##...#.###..#", [13 x i8] c"#..#.#.#...##", [13 x i8] c"###....####.#", [13 x i8] c"#...###....##", [13 x i8] c"#.#.....##..#", [13 x i8] c"##########.##", [13 x i8] c"##########.##", [13 x i8] c"##########.##"]
@.str = [38 x i8] c"Error: Ha empezado en un obst\C3\A1culo.\0A\00"
@.str.1 = [68 x i8] c"\0A Error: Desde la posici\C3\B3n de inicio dada no se encuentra salida.\0A\00"
@.str.2 = [25 x i8] c"\0A Soluci\C3\B3n encontrada:\0A\00"
@.str.3 = [35 x i8] c"\0A Camino de salida marcado con *.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [10 x [13 x i8]]
store i32 0, i32* %1
store i32 0, i32* %2
store i32 1, i32* %3
store i32 1, i32* %4
%6 = bitcast [10 x [13 x i8]]* %5 to i8*
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [10 x [13 x i8]], [10 x [13 x i8]]* %5, i64 0, i64 %8
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [13 x i8], [13 x i8]* %9, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 35
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %41
18: ; preds = %0
%19 = getelementptr inbounds [10 x [13 x i8]], [10 x [13 x i8]]* %5, i64 0, i64 0
%20 = bitcast [13 x i8]* %19 to i8**
%21 = call i32 @muestra(i8** %20, i32 10, i32 13)
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = getelementptr inbounds [10 x [13 x i8]], [10 x [13 x i8]]* %5, i64 0, i64 0
%25 = bitcast [13 x i8]* %24 to i8**
%26 = call i32 @encuentraRuta(i32 %22, i32 %23, i8** %25)
store i32 %26, i32* %2
%27 = load i32, i32* %2
%28 = icmp ne i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %18
%30 = call i32 @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.1, i64 0, i64 0))
br label %40
31: ; preds = %18
%32 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%33 = getelementptr inbounds [10 x [13 x i8]], [10 x [13 x i8]]* %5, i64 0, i64 0
%34 = bitcast [13 x i8]* %33 to i8**
%35 = call i32 @convierte(i8** %34, i32 10, i32 13)
%36 = getelementptr inbounds [10 x [13 x i8]], [10 x [13 x i8]]* %5, i64 0, i64 0
%37 = bitcast [13 x i8]* %36 to i8**
%38 = call i32 @muestra(i8** %37, i32 10, i32 13)
%39 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
br label %40
40: ; preds = %31, %29
br label %41
41: ; preds = %40, %16
ret i32 0
}

LLVM IR (-O2):
@__const.main.laberinto = [10 x [13 x i8]] [[13 x i8] c"#############", [13 x i8] c"#..###....#.#", [13 x i8] c"##...#.###..#", [13 x i8] c"#..#.#.#...##", [13 x i8] c"###....####.#", [13 x i8] c"#...###....##", [13 x i8] c"#.#.....##..#", [13 x i8] c"##########.##", [13 x i8] c"##########.##", [13 x i8] c"##########.##"]
@str = [67 x i8] c"\0A Error: Desde la posici\C3\B3n de inicio dada no se encuentra salida.\00"
@str.4 = [24 x i8] c"\0A Soluci\C3\B3n encontrada:\00"
@str.5 = [34 x i8] c"\0A Camino de salida marcado con *.\00"
define i32 @main() {
%1 = alloca [10 x [13 x i8]]
%2 = getelementptr inbounds [10 x [13 x i8]], [10 x [13 x i8]]* %1, i64 0, i64 0, i64 0
%3 = bitcast [10 x [13 x i8]]* %1 to i8**
%4 = call i32 @muestra(i8** %3, i32 10, i32 13)
%5 = call i32 @encuentraRuta(i32 1, i32 1, i8** %3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.4, i64 0, i64 0))
%9 = call i32 @convierte(i8** %3, i32 10, i32 13)
%10 = call i32 @muestra(i8** %3, i32 10, i32 13)
br label %11
11: ; preds = %0, %7
%12 = phi i8* [ getelementptr inbounds ([34 x i8], [34 x i8]* @str.5, i64 0, i64 0), %7 ], [ getelementptr inbounds ([67 x i8], [67 x i8]* @str, i64 0, i64 0), %0 ]
%13 = call i32 @puts(i8* dereferenceable(1) %12)
ret i32 0
}