#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 *hops(int *);
scalar_t__ is_in_bound(int *, int, int *);
int /*<<< orphan*/ printf(char *, int, int);
scalar_t__ scanf(char *, int *);
int main() {
  int arr[49], i, *ptr, l, res = 0;
  for (l = 0; scanf("%d", &arr[l]) != EOF; l++)
    ;
  ptr = hops(&arr[0]);
  for (i = 1; i < 50; i++) {
    if (is_in_bound(arr, l, ptr) == 0 && ptr - &arr[0] > l)
      break;
    else if (arr[ptr - &arr[0]] == 0) {
      res = 1;
      break;
    } else
      ptr = hops(ptr);
  }
  printf("%d\n%d", res, i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xe8(%rbp)
movl   $0x0,-0xe4(%rbp)
movslq -0xe4(%rbp),%rax
lea    -0xd0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe81(%rip),%rdi
call   1050 <scanf@plt>
mov    0x2e5a(%rip),%rcx
cmp    (%rcx),%rax
je     11b0 <main+0x70>
jmp    119c <main+0x5c>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    1166 <main+0x26>
lea    -0xd0(%rbp),%rdi
call   1030 <hops@plt>
mov    %rax,-0xe0(%rbp)
movl   $0x1,-0xd4(%rbp)
cmpl   $0x32,-0xd4(%rbp)
jge    128a <main+0x14a>
lea    -0xd0(%rbp),%rdi
mov    -0xe4(%rbp),%esi
mov    -0xe0(%rbp),%rdx
call   1060 <is_in_bound@plt>
cmp    $0x0,%rax
jne    1227 <main+0xe7>
mov    -0xe0(%rbp),%rax
lea    -0xd0(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
movslq -0xe4(%rbp),%rcx
cmp    %rcx,%rax
jle    1227 <main+0xe7>
jmp    128a <main+0x14a>
mov    -0xe0(%rbp),%rax
lea    -0xd0(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
cmpl   $0x0,-0xd0(%rbp,%rax,4)
jne    1259 <main+0x119>
movl   $0x1,-0xe8(%rbp)
jmp    128a <main+0x14a>
mov    -0xe0(%rbp),%rdi
call   1030 <hops@plt>
mov    %rax,-0xe0(%rbp)
jmp    1271 <main+0x131>
jmp    1276 <main+0x136>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    11cd <main+0x8d>
mov    -0xe8(%rbp),%esi
mov    -0xd4(%rbp),%edx
lea    0xd63(%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    $0xffffffffffffffff,%rbx
mov    %rsp,%rbp
lea    0xea1(%rip),%r14
mov    0x2e7f(%rip),%r15
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbx
add    $0x4,%rbp
cmp    (%r15),%rax
jne    1170 <main+0x30>
mov    %ebx,%r13d
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <hops@plt>
mov    %rax,%rbp
mov    $0x1,%r12d
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %rbp,%rdx
call   1060 <is_in_bound@plt>
mov    %rbp,%rcx
sub    %r14,%rcx
sar    $0x2,%rcx
test   %rax,%rax
jne    11d1 <main+0x91>
cmp    %r13,%rcx
jg     11fa <main+0xba>
cmpl   $0x0,(%rsp,%rcx,4)
je     11f4 <main+0xb4>
mov    %rbp,%rdi
call   1030 <hops@plt>
mov    %rax,%rbp
add    $0x1,%r12d
cmp    $0x32,%r12d
jne    11b0 <main+0x70>
mov    $0x32,%r12d
jmp    11fa <main+0xba>
mov    $0x1,%r15d
lea    0xdff(%rip),%rdi
mov    %r15d,%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\0A%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [49 x i32]
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
store i32 0, i32* %5
br label %7
7: ; preds = %15, %0
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [49 x i32], [49 x i32]* %2, i64 0, i64 %9
%11 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
%12 = load i64, i64* @EOF
%13 = icmp ne i64 %11, %12
br i1 %13, label %14, label %18
14: ; preds = %7
br label %15
15: ; preds = %14
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
store i32 %17, i32* %5
br label %7
18: ; preds = %7
%19 = getelementptr inbounds [49 x i32], [49 x i32]* %2, i64 0, i64 0
%20 = call i32* @hops(i32* %19)
store i32* %20, i32** %4
store i32 1, i32* %3
br label %21
21: ; preds = %57, %18
%22 = load i32, i32* %3
%23 = icmp slt i32 %22, 50
br i1 %23, label %24, label %60
24: ; preds = %21
%25 = getelementptr inbounds [49 x i32], [49 x i32]* %2, i64 0, i64 0
%26 = load i32, i32* %5
%27 = load i32*, i32** %4
%28 = call i64 @is_in_bound(i32* %25, i32 %26, i32* %27)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %41
30: ; preds = %24
%31 = load i32*, i32** %4
%32 = getelementptr inbounds [49 x i32], [49 x i32]* %2, i64 0, i64 0
%33 = ptrtoint i32* %31 to i64
%34 = ptrtoint i32* %32 to i64
%35 = sub i64 %33, %34
%36 = sdiv exact i64 %35, 4
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = icmp sgt i64 %36, %38
br i1 %39, label %40, label %41
40: ; preds = %30
br label %60
41: ; preds = %30, %24
%42 = load i32*, i32** %4
%43 = getelementptr inbounds [49 x i32], [49 x i32]* %2, i64 0, i64 0
%44 = ptrtoint i32* %42 to i64
%45 = ptrtoint i32* %43 to i64
%46 = sub i64 %44, %45
%47 = sdiv exact i64 %46, 4
%48 = getelementptr inbounds [49 x i32], [49 x i32]* %2, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %52
51: ; preds = %41
store i32 1, i32* %6
br label %60
52: ; preds = %41
%53 = load i32*, i32** %4
%54 = call i32* @hops(i32* %53)
store i32* %54, i32** %4
br label %55
55: ; preds = %52
br label %56
56: ; preds = %55
br label %57
57: ; preds = %56
%58 = load i32, i32* %3
%59 = add nsw i32 %58, 1
store i32 %59, i32* %3
br label %21
60: ; preds = %51, %40, %21
%61 = load i32, i32* %6
%62 = load i32, i32* %3
%63 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %61, i32 %62)
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 [49 x i32]
%2 = bitcast [49 x i32]* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ %9, %3 ], [ 0, %0 ]
%5 = getelementptr inbounds [49 x i32], [49 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 = add nuw i64 %4, 1
br i1 %8, label %10, label %3
10: ; preds = %3
%11 = trunc i64 %4 to i32
%12 = and i64 %4, 4294967295
%13 = getelementptr inbounds [49 x i32], [49 x i32]* %1, i64 0, i64 0
%14 = call i32* @hops(i32* %13)
%15 = ptrtoint [49 x i32]* %1 to i64
br label %16
16: ; preds = %10, %30
%17 = phi i32* [ %14, %10 ], [ %31, %30 ]
%18 = phi i32 [ 1, %10 ], [ %32, %30 ]
%19 = call i64 @is_in_bound(i32* %13, i32 %11, i32* %17)
%20 = icmp eq i64 %19, 0
%21 = ptrtoint i32* %17 to i64
%22 = sub i64 %21, %15
%23 = ashr exact i64 %22, 2
%24 = icmp sgt i64 %23, %12
%25 = select i1 %20, i1 %24, i1 false
br i1 %25, label %34, label %26
26: ; preds = %16
%27 = getelementptr inbounds [49 x i32], [49 x i32]* %1, i64 0, i64 %23
%28 = load i32, i32* %27
%29 = icmp eq i32 %28, 0
br i1 %29, label %34, label %30
30: ; preds = %26
%31 = call i32* @hops(i32* %17)
%32 = add nuw nsw i32 %18, 1
%33 = icmp eq i32 %32, 50
br i1 %33, label %34, label %16
34: ; preds = %16, %26, %30
%35 = phi i32 [ %18, %26 ], [ 50, %30 ], [ %18, %16 ]
%36 = phi i32 [ 1, %26 ], [ 0, %30 ], [ 0, %16 ]
%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
}