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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xd4(%rbp)
movq   $0x0,-0xe0(%rbp)
movl   $0x0,-0xe4(%rbp)
movl   $0x0,-0xe8(%rbp)
movslq -0xd4(%rbp),%rax
lea    -0xd0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe69(%rip),%rdi
call   1050 <scanf@plt>
mov    %rax,%rcx
mov    $0x1,%al
mov    0x2e40(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0xe9(%rbp)
jne    11c7 <main+0x87>
cmpl   $0x32,-0xd4(%rbp)
setl   %al
mov    %al,-0xe9(%rbp)
mov    -0xe9(%rbp),%al
test   $0x1,%al
jne    11da <main+0x9a>
jmp    11ee <main+0xae>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    117b <main+0x3b>
lea    -0xd0(%rbp),%rax
mov    %rax,-0xe0(%rbp)
movl   $0x0,-0xe4(%rbp)
cmpl   $0x32,-0xe4(%rbp)
jge    1268 <main+0x128>
lea    -0xd0(%rbp),%rdi
mov    -0xd4(%rbp),%esi
mov    -0xe0(%rbp),%rdx
call   1060 <is_in_bound@plt>
cmp    $0x0,%rax
jne    123b <main+0xfb>
jmp    1268 <main+0x128>
mov    -0xe0(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1255 <main+0x115>
movl   $0x1,-0xe8(%rbp)
mov    -0xe0(%rbp),%rdi
call   1030 <hop@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xe8(%rbp),%esi
lea    0xd8e(%rip),%rdi
call   1040 <printf@plt>
mov    -0xe4(%rbp),%esi
lea    0xd7c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %rsp,%r12
xor    %esi,%esi
lea    0xea6(%rip),%r14
mov    0x2e87(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rsi,%rbx
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
lea    0x1(%rbx),%rsi
add    $0x4,%r12
cmp    (%r15),%rax
jne    1170 <main+0x30>
cmp    $0x32,%rbx
jb     1170 <main+0x30>
add    $0xffffffff,%esi
mov    %rsp,%rdi
mov    %rdi,%rdx
call   1060 <is_in_bound@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     11b5 <main+0x75>
cmpl   $0x0,(%rsp)
sete   %bl
mov    %rsp,%rdi
call   1030 <hop@plt>
lea    0xe47(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [4 x i8] c"%d\0A\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 true, i1 %9
%11 = add nuw i64 %4, 1
br i1 %10, label %3, label %12
12: ; preds = %3
%13 = trunc i64 %4 to i32
%14 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 0
%15 = call i64 @is_in_bound(i32* %14, i32 %13, i32* %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %22, label %17
17: ; preds = %12
%18 = load i32, i32* %14
%19 = icmp eq i32 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32* @hop(i32* %14)
br label %22
22: ; preds = %12, %17
%23 = phi i32 [ 0, %12 ], [ %20, %17 ]
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret i32 0
}