#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 *hop(int *);
scalar_t__ is_in_bound(int *, int, int *);
int /*<<< orphan*/ printf(char *, int, int);
scalar_t__ scanf(char *, int *);
int main() {
  int arr[50], i, arrSize;
  int *ptr = arr;
  int reachable = 0;
  i = 0;
  while (scanf("%d", &arr[i]) != EOF && i < 50)
    i++;
  arrSize = i;
  i = 0;
  while (i < 50 && is_in_bound(arr, arrSize, ptr)) {
    if (*ptr == 0) {
      reachable = 1;
      break;
    }
    ptr = hop(ptr);
    i++;
  }
  printf("%d %d", reachable, i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xd0(%rbp),%rax
mov    %rax,-0xe0(%rbp)
movl   $0x0,-0xe4(%rbp)
movl   $0x0,-0xd4(%rbp)
movslq -0xd4(%rbp),%rax
lea    -0xd0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe73(%rip),%rdi
call   1050 <scanf@plt>
mov    %rax,%rcx
xor    %eax,%eax
mov    0x2e47(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0xe5(%rbp)
je     11c0 <main+0x80>
cmpl   $0x32,-0xd4(%rbp)
setl   %al
mov    %al,-0xe5(%rbp)
mov    -0xe5(%rbp),%al
test   $0x1,%al
jne    11d3 <main+0x93>
jmp    11e7 <main+0xa7>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    1174 <main+0x34>
mov    -0xd4(%rbp),%eax
mov    %eax,-0xd8(%rbp)
movl   $0x0,-0xd4(%rbp)
xor    %eax,%eax
cmpl   $0x32,-0xd4(%rbp)
mov    %al,-0xe6(%rbp)
jge    1238 <main+0xf8>
lea    -0xd0(%rbp),%rdi
mov    -0xd8(%rbp),%esi
mov    -0xe0(%rbp),%rdx
call   1060 <is_in_bound@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xe6(%rbp)
mov    -0xe6(%rbp),%al
test   $0x1,%al
jne    124b <main+0x10b>
jmp    1291 <main+0x151>
mov    -0xe0(%rbp),%rax
cmpl   $0x0,(%rax)
jne    126a <main+0x12a>
movl   $0x1,-0xe4(%rbp)
jmp    1291 <main+0x151>
mov    -0xe0(%rbp),%rdi
call   1030 <hop@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    11fd <main+0xbd>
mov    -0xe4(%rbp),%esi
mov    -0xd4(%rbp),%edx
lea    0xd5c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %rsp,%rbp
xor    %ebx,%ebx
lea    0xea6(%rip),%r14
mov    0x2e84(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
lea    0x1(%rbx),%r13
cmp    (%r15),%rax
je     1191 <main+0x51>
add    $0x4,%rbp
cmp    $0x32,%rbx
mov    %r13,%rbx
jb     1170 <main+0x30>
mov    %rsp,%r15
add    $0xffffffffffffffff,%r13
xor    %r14d,%r14d
mov    %r15,%rbp
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r13d,%esi
mov    %rbp,%rdx
call   1060 <is_in_bound@plt>
test   %rax,%rax
je     11ec <main+0xac>
cmpl   $0x0,0x0(%rbp)
je     11e6 <main+0xa6>
mov    %rbp,%rdi
call   1030 <hop@plt>
mov    %rax,%rbp
add    $0x1,%r12d
cmp    $0x32,%r12d
jne    11b0 <main+0x70>
mov    $0x32,%r12d
jmp    11ec <main+0xac>
mov    $0x1,%r14d
lea    0xe0d(%rip),%rdi
mov    %r14d,%esi
mov    %r12d,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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