#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 *);
int is_in_bound(int *, int, int *);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ scanf(char *, int *);
int main() {
  int arr[50], size, *ptr;
  int hops = 0;
  int i = 0, temp = 0;
  for (i = 0; scanf("%d", &temp) != EOF; i++) {
    arr[i] = temp;
  }
  temp = 0;
  size = i;
  i = 0;
  ptr = &arr[0];
  while (hops != 50) {
    temp = 0;
    temp = is_in_bound(&arr[0], size, ptr);
    if (*ptr == 0 && temp == 1) {
      temp = 1;
      break;
    }
    if (temp == 0) {
      break;
    }
    if (temp == 1) {
      hops++;
    }
    temp = 0;
    ptr = hop(ptr);
  }
  if (temp == 1) {
    printf("1\n%d", hops);
  } else {
    printf("0\n%d", 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,-0xec(%rbp)
movl   $0x0,-0xe8(%rbp)
lea    0xe86(%rip),%rdi
lea    -0xec(%rbp),%rsi
call   1050 <scanf@plt>
mov    0x2e54(%rip),%rcx
cmp    (%rcx),%rax
je     11c5 <main+0x85>
mov    -0xec(%rbp),%ecx
movslq -0xe8(%rbp),%rax
mov    %ecx,-0xd0(%rbp,%rax,4)
mov    -0xe8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe8(%rbp)
jmp    117a <main+0x3a>
movl   $0x0,-0xec(%rbp)
mov    -0xe8(%rbp),%eax
mov    %eax,-0xd4(%rbp)
movl   $0x0,-0xe8(%rbp)
lea    -0xd0(%rbp),%rax
mov    %rax,-0xe0(%rbp)
cmpl   $0x32,-0xe4(%rbp)
je     12a5 <main+0x165>
movl   $0x0,-0xec(%rbp)
lea    -0xd0(%rbp),%rdi
mov    -0xd4(%rbp),%esi
mov    -0xe0(%rbp),%rdx
call   1060 <is_in_bound@plt>
mov    %eax,-0xec(%rbp)
mov    -0xe0(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1255 <main+0x115>
cmpl   $0x1,-0xec(%rbp)
jne    1255 <main+0x115>
movl   $0x1,-0xec(%rbp)
jmp    12a5 <main+0x165>
cmpl   $0x0,-0xec(%rbp)
jne    1267 <main+0x127>
jmp    12a5 <main+0x165>
cmpl   $0x1,-0xec(%rbp)
jne    1283 <main+0x143>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
movl   $0x0,-0xec(%rbp)
mov    -0xe0(%rbp),%rdi
call   1030 <hop@plt>
mov    %rax,-0xe0(%rbp)
jmp    11f3 <main+0xb3>
cmpl   $0x1,-0xec(%rbp)
jne    12c9 <main+0x189>
mov    -0xe4(%rbp),%esi
lea    0xd41(%rip),%rdi
call   1040 <printf@plt>
jmp    12db <main+0x19b>
mov    -0xe4(%rbp),%esi
lea    0xd2f(%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   %r12
push   %rbx
sub    $0xe0,%rsp
movl   $0x0,0xc(%rsp)
lea    0xea9(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x2e79(%rip),%r12
xor    %r15d,%r15d
mov    $0x0,%ebx
cmp    (%r12),%rax
je     11ad <main+0x6d>
xor    %ebx,%ebx
lea    0xe81(%rip),%r14
lea    0xc(%rsp),%rbp
nopl   0x0(%rax,%rax,1)
mov    0xc(%rsp),%eax
mov    %eax,0x10(%rsp,%rbx,4)
add    $0x1,%rbx
mov    %r14,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
cmp    (%r12),%rax
jne    1190 <main+0x50>
lea    0x10(%rsp),%r14
mov    %r14,%r12
cs nopw 0x0(%rax,%rax,1)
nop
movl   $0x0,0xc(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r12,%rdx
call   1060 <is_in_bound@plt>
mov    %eax,0xc(%rsp)
cmpl   $0x0,(%r12)
jne    11e5 <main+0xa5>
cmp    $0x1,%eax
je     1224 <main+0xe4>
test   %eax,%eax
je     121b <main+0xdb>
xor    %ebp,%ebp
cmp    $0x1,%eax
sete   %bpl
movl   $0x0,0xc(%rsp)
mov    %r12,%rdi
call   1030 <hop@plt>
mov    %rax,%r12
add    %ebp,%r15d
cmp    $0x32,%r15d
jne    11c0 <main+0x80>
mov    $0x32,%r15d
cmpl   $0x1,0xc(%rsp)
je     122c <main+0xec>
lea    0xde3(%rip),%rdi
jmp    1233 <main+0xf3>
movl   $0x1,0xc(%rsp)
lea    0xdcd(%rip),%rdi
mov    %r15d,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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