#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, length, *ptr, way = 0, hops = 0;
  for (i = 0; scanf("%d", &arr[i]) != EOF; i++) {
    if (i == 50 - 1) {
      break;
    }
  }
  length = i + 1;
  ptr = arr;
  for (i = 0; is_in_bound(arr, length, ptr) && hops < 50; i += arr[i]) {
    hops++;
    if (arr[i] == 0) {
      way = 1;
      hops--;
      break;
    }
    ptr = hop(&arr[i]);
  }
  printf("%d\n%d", way, hops);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xe4(%rbp)
movl   $0x0,-0xe8(%rbp)
movl   $0x0,-0xd4(%rbp)
movslq -0xd4(%rbp),%rax
lea    -0xd0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe77(%rip),%rdi
call   1050 <scanf@plt>
mov    0x2e50(%rip),%rcx
cmp    (%rcx),%rax
je     11cc <main+0x8c>
cmpl   $0x31,-0xd4(%rbp)
jne    11b3 <main+0x73>
jmp    11cc <main+0x8c>
jmp    11b8 <main+0x78>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    1170 <main+0x30>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
lea    -0xd0(%rbp),%rax
mov    %rax,-0xe0(%rbp)
movl   $0x0,-0xd4(%rbp)
lea    -0xd0(%rbp),%rdi
mov    -0xd8(%rbp),%esi
mov    -0xe0(%rbp),%rdx
call   1060 <is_in_bound@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0xe9(%rbp)
je     1231 <main+0xf1>
cmpl   $0x32,-0xe8(%rbp)
setl   %al
mov    %al,-0xe9(%rbp)
mov    -0xe9(%rbp),%al
test   $0x1,%al
jne    1244 <main+0x104>
jmp    12c6 <main+0x186>
mov    -0xe8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe8(%rbp)
movslq -0xd4(%rbp),%rax
cmpl   $0x0,-0xd0(%rbp,%rax,4)
jne    1286 <main+0x146>
movl   $0x1,-0xe4(%rbp)
mov    -0xe8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xe8(%rbp)
jmp    12c6 <main+0x186>
movslq -0xd4(%rbp),%rax
lea    -0xd0(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <hop@plt>
mov    %rax,-0xe0(%rbp)
movslq -0xd4(%rbp),%rax
mov    -0xd0(%rbp,%rax,4),%eax
add    -0xd4(%rbp),%eax
mov    %eax,-0xd4(%rbp)
jmp    11f3 <main+0xb3>
mov    -0xe4(%rbp),%esi
mov    -0xe8(%rbp),%edx
lea    0xd27(%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),%r15
mov    0x2e84(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
lea    0x1(%rbx),%r14
cmp    (%r12),%rax
je     1192 <main+0x52>
add    $0x4,%rbp
cmp    $0x31,%rbx
mov    %r14,%rbx
jne    1170 <main+0x30>
mov    %rsp,%rdi
mov    %r14d,%esi
mov    %rdi,%rdx
call   1060 <is_in_bound@plt>
test   %rax,%rax
je     11ee <main+0xae>
xor    %r12d,%r12d
mov    %rsp,%rbx
xor    %ebp,%ebp
nopl   (%rax)
movslq %ebp,%rbp
cmpl   $0x0,(%rsp,%rbp,4)
je     11f5 <main+0xb5>
lea    (%rsp,%rbp,4),%r13
lea    0x1(%r12),%r15d
mov    %r13,%rdi
call   1030 <hop@plt>
add    0x0(%r13),%ebp
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %rax,%rdx
call   1060 <is_in_bound@plt>
xor    %esi,%esi
test   %rax,%rax
je     11fd <main+0xbd>
cmp    $0x31,%r12d
mov    %r15d,%r12d
jb     11b0 <main+0x70>
jmp    11fd <main+0xbd>
xor    %r15d,%r15d
xor    %esi,%esi
jmp    11fd <main+0xbd>
mov    $0x1,%esi
mov    %r12d,%r15d
lea    0xdfc(%rip),%rdi
mov    %r15d,%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\0A%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
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
store i32 0, i32* %7
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 %23
15: ; preds = %8
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 49
br i1 %17, label %18, label %19
18: ; preds = %15
br label %23
19: ; preds = %15
br label %20
20: ; preds = %19
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %8
23: ; preds = %18, %8
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
%26 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 0
store i32* %26, i32** %5
store i32 0, i32* %3
br label %27
27: ; preds = %54, %23
%28 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 0
%29 = load i32, i32* %4
%30 = load i32*, i32** %5
%31 = call i64 @is_in_bound(i32* %28, i32 %29, i32* %30)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %27
%34 = load i32, i32* %7
%35 = icmp slt i32 %34, 50
br label %36
36: ; preds = %33, %27
%37 = phi i1 [ false, %27 ], [ %35, %33 ]
br i1 %37, label %38, label %61
38: ; preds = %36
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
%41 = load i32, i32* %3
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 %42
%44 = load i32, i32* %43
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %38
store i32 1, i32* %6
%47 = load i32, i32* %7
%48 = add nsw i32 %47, -1
store i32 %48, i32* %7
br label %61
49: ; preds = %38
%50 = load i32, i32* %3
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 %51
%53 = call i32* @hop(i32* %52)
store i32* %53, i32** %5
br label %54
54: ; preds = %49
%55 = load i32, i32* %3
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 %56
%58 = load i32, i32* %57
%59 = load i32, i32* %3
%60 = add nsw i32 %59, %58
store i32 %60, i32* %3
br label %27
61: ; preds = %46, %36
%62 = load i32, i32* %6
%63 = load i32, i32* %7
%64 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %62, i32 %63)
ret i32 0
}

LLVM IR (-O2):
@.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 [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 eq i64 %6, %7
%9 = icmp eq i64 %4, 49
%10 = select i1 %8, i1 true, i1 %9
%11 = add nuw nsw i64 %4, 1
br i1 %10, label %12, label %3
12: ; preds = %3
%13 = trunc i64 %4 to i32
%14 = add nuw nsw i32 %13, 1
%15 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 0
%16 = call i64 @is_in_bound(i32* %15, i32 %14, i32* %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %34, label %18
18: ; preds = %12, %25
%19 = phi i32 [ %26, %25 ], [ 0, %12 ]
%20 = phi i32 [ %29, %25 ], [ 0, %12 ]
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, 0
br i1 %24, label %34, label %25
25: ; preds = %18
%26 = add nuw nsw i32 %19, 1
%27 = call i32* @hop(i32* %22)
%28 = load i32, i32* %22
%29 = add nsw i32 %28, %20
%30 = call i64 @is_in_bound(i32* %15, i32 %14, i32* %27)
%31 = icmp ne i64 %30, 0
%32 = icmp ult i32 %19, 49
%33 = select i1 %31, i1 %32, i1 false
br i1 %33, label %18, label %34
34: ; preds = %25, %18, %12
%35 = phi i32 [ 0, %12 ], [ %19, %18 ], [ %26, %25 ]
%36 = phi i32 [ 0, %12 ], [ 1, %18 ], [ 0, %25 ]
%37 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %36, i32 %35)
ret i32 0
}