#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 *hop(int *);
scalar_t__ is_in_bound(int *, int, int *);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ scanf(char *, int *);
int main() {
  int array[100], size = 0;
  for (size = 0; scanf("%d", &array[size]); size++) {
  }
  int hops = 0;
  int *position = &array[0];
  while (is_in_bound(array, size, position) && hops++ != 50) {
    position = hop(position);
    if (*position == 0) {
      printf("1\n%d", hops);
      break;
    }
  }
  if (*position != 0) {
    if (hops >= 50) {
      hops = 50;
    }
    printf("0\n%d", hops);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1a4(%rbp)
movl   $0x0,-0x1a4(%rbp)
movslq -0x1a4(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe85(%rip),%rdi
call   1050 <scanf@plt>
cmp    $0x0,%rax
je     11aa <main+0x6a>
jmp    1196 <main+0x56>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    1166 <main+0x26>
movl   $0x0,-0x1a8(%rbp)
lea    -0x1a0(%rbp),%rax
mov    %rax,-0x1b0(%rbp)
lea    -0x1a0(%rbp),%rdi
mov    -0x1a4(%rbp),%esi
mov    -0x1b0(%rbp),%rdx
call   1060 <is_in_bound@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x1b1(%rbp)
je     120d <main+0xcd>
mov    -0x1a8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x1a8(%rbp)
cmp    $0x32,%eax
setne  %al
mov    %al,-0x1b1(%rbp)
mov    -0x1b1(%rbp),%al
test   $0x1,%al
jne    1220 <main+0xe0>
jmp    125f <main+0x11f>
mov    -0x1b0(%rbp),%rdi
call   1030 <hop@plt>
mov    %rax,-0x1b0(%rbp)
mov    -0x1b0(%rbp),%rax
cmpl   $0x0,(%rax)
jne    125a <main+0x11a>
mov    -0x1a8(%rbp),%esi
lea    0xdb0(%rip),%rdi
call   1040 <printf@plt>
jmp    125f <main+0x11f>
jmp    11c2 <main+0x82>
mov    -0x1b0(%rbp),%rax
cmpl   $0x0,(%rax)
je     1298 <main+0x158>
cmpl   $0x32,-0x1a8(%rbp)
jl     1286 <main+0x146>
movl   $0x32,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%esi
lea    0xd72(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x198,%rsp
mov    $0xffffffff,%ebp
mov    %rsp,%rbx
lea    0xeab(%rip),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x1,%ebp
add    $0x4,%rbx
test   %rax,%rax
jne    1160 <main+0x20>
xor    %ebx,%ebx
mov    %rsp,%r15
mov    %r15,%r14
nop
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   1060 <is_in_bound@plt>
test   %rax,%rax
je     11b8 <main+0x78>
cmp    $0x32,%ebx
je     11e5 <main+0xa5>
mov    %r14,%rdi
call   1030 <hop@plt>
mov    %rax,%r14
add    $0x1,%ebx
cmpl   $0x0,(%rax)
jne    1180 <main+0x40>
lea    0xe4f(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
cmpl   $0x0,(%r14)
je     11d5 <main+0x95>
cmp    $0x32,%ebx
mov    $0x32,%esi
cmovl  %ebx,%esi
lea    0xe35(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x198,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x33,%ebx
cmpl   $0x0,(%r14)
jne    11be <main+0x7e>
jmp    11d5 <main+0x95>

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

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