#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 */
scalar_t__ EOF;
int /*<<< orphan*/ hop(int *);
scalar_t__ is_in_bound(int *, int, int *);
int /*<<< orphan*/ printf(char *, int, int);
scalar_t__ scanf(char *, int *);
int main() {
  int size = 50;
  int arr[size];
  int c = 0;
  int hops = 0;
  int path = 1;
  while (scanf("%d", &arr[size]) != EOF || c >= size)
    ++c;
  int *current = arr;
  while (current != 0) {
    if (is_in_bound(arr, size, current)) {
      if (hops <= 50) {
        hop(current);
        hops++;
      } else {
        path = 0;
      }
    } else {
      path = 0;
    }
  }
  printf("%d\n%d", path, hops);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x32,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x38(%rbp),%rsi
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe5b(%rip),%rdi
call   1050 <scanf@plt>
mov    %rax,%rcx
mov    $0x1,%al
mov    0x2e2f(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0x39(%rbp)
jne    11d1 <main+0x91>
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
setge  %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    11e1 <main+0xa1>
jmp    11ef <main+0xaf>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1192 <main+0x52>
mov    -0x38(%rbp),%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1255 <main+0x115>
mov    -0x38(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x30(%rbp),%rdx
call   1060 <is_in_bound@plt>
cmp    $0x0,%rax
je     1249 <main+0x109>
cmpl   $0x32,-0x20(%rbp)
jg     123d <main+0xfd>
mov    -0x30(%rbp),%rdi
call   1030 <hop@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1244 <main+0x104>
movl   $0x0,-0x24(%rbp)
jmp    1250 <main+0x110>
movl   $0x0,-0x24(%rbp)
jmp    11f7 <main+0xb7>
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xd9e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xc8,%rsp
xor    %ecx,%ecx
lea    0xc8(%rsp),%r14
lea    0xeb2(%rip),%r15
mov    0x2e93(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ecx,%ebx
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
lea    0x1(%rbx),%ecx
cmp    0x0(%rbp),%rax
jne    1160 <main+0x30>
cmp    $0x31,%ebx
ja     1160 <main+0x30>
xor    %ebp,%ebp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x32,%esi
mov    %rbx,%rdx
call   1050 <is_in_bound@plt>
test   %rax,%rax
je     1180 <main+0x50>
cmp    $0x32,%ebp
ja     1180 <main+0x50>
mov    %rbx,%rdi
call   1030 <hop@plt>
add    $0x1,%ebp
jmp    1180 <main+0x50>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
define i32 @main() {
%1 = alloca [50 x i32]
%2 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 50
br label %3
3: ; preds = %3, %0
%4 = phi i32 [ 0, %0 ], [ %10, %3 ]
%5 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i64, i64* @EOF
%7 = icmp ne i64 %5, %6
%8 = icmp ugt i32 %4, 49
%9 = select i1 %7, i1 true, i1 %8
%10 = add nuw nsw i32 %4, 1
br i1 %9, label %3, label %11
11: ; preds = %3
%12 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 0
br label %13
13: ; preds = %20, %11
%14 = phi i32 [ %22, %20 ], [ 0, %11 ]
%15 = icmp ult i32 %14, 51
br label %16
16: ; preds = %13, %16
%17 = call i64 @is_in_bound(i32* %12, i32 50, i32* %12)
%18 = icmp ne i64 %17, 0
%19 = select i1 %18, i1 %15, i1 false
br i1 %19, label %20, label %16
20: ; preds = %16
%21 = call i32 @hop(i32* %12)
%22 = add nuw nsw i32 %14, 1
br label %13
}