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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xd4(%rbp)
lea    -0xd0(%rbp),%rax
mov    %rax,-0xe0(%rbp)
movl   $0x0,-0xe4(%rbp)
movslq -0xe4(%rbp),%rax
lea    -0xd0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe70(%rip),%rdi
call   1050 <scanf@plt>
mov    %rax,%rcx
mov    $0x1,%al
mov    0x2e47(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0xe5(%rbp)
jne    11c0 <main+0x80>
cmpl   $0x32,-0xe4(%rbp)
setl   %al
mov    %al,-0xe5(%rbp)
mov    -0xe5(%rbp),%al
test   $0x1,%al
jne    11d3 <main+0x93>
jmp    11e7 <main+0xa7>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    1174 <main+0x34>
jmp    11ec <main+0xac>
mov    -0xe0(%rbp),%rcx
xor    %eax,%eax
cmpl   $0x0,(%rcx)
mov    %al,-0xe6(%rbp)
je     1214 <main+0xd4>
cmpl   $0x32,-0xd4(%rbp)
setl   %al
mov    %al,-0xe6(%rbp)
mov    -0xe6(%rbp),%al
test   $0x1,%al
jne    1227 <main+0xe7>
jmp    12f9 <main+0x1b9>
mov    -0xe0(%rbp),%rdi
call   1030 <hop@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xe0(%rbp),%rax
cmpl   $0x0,(%rax)
jne    126f <main+0x12f>
lea    0xdb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xd4(%rbp),%esi
add    $0x1,%esi
lea    0xd98(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xd0(%rbp),%rdi
mov    -0xe4(%rbp),%esi
mov    -0xe0(%rbp),%rdx
call   1060 <is_in_bound@plt>
cmp    $0x0,%rax
jne    12bc <main+0x17c>
lea    0xd6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xd4(%rbp),%esi
add    $0x1,%esi
lea    0xd50(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12f9 <main+0x1b9>
cmpl   $0x31,-0xd4(%rbp)
jne    12e5 <main+0x1a5>
lea    0xd36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd2b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    11ec <main+0xac>
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    %r12d,%r12d
lea    0xe92(%rip),%r14
mov    0x2e73(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12,%rbx
mov    %r14,%rdi
mov    %rbp,%rsi
call   1060 <scanf@plt>
add    $0x1,%r12
add    $0x4,%rbp
cmp    (%r15),%rax
jne    1180 <main+0x30>
cmp    $0x32,%rbx
jb     1180 <main+0x30>
cmpl   $0x0,(%rsp)
je     125c <main+0x10c>
add    $0xffffffffffffffff,%r12
mov    $0x1,%r14d
mov    %rsp,%r15
lea    0xe47(%rip),%rbx
lea    0xe3a(%rip),%r13
mov    %r15,%rbp
nopl   0x0(%rax)
mov    %rbp,%rdi
call   1040 <hop@plt>
mov    %rax,%rbp
cmpl   $0x0,(%rax)
jne    11f5 <main+0xa5>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r12d,%esi
mov    %rbp,%rdx
call   1070 <is_in_bound@plt>
test   %rax,%rax
je     1223 <main+0xd3>
cmp    $0x32,%r14d
je     1242 <main+0xf2>
cmpl   $0x0,0x0(%rbp)
je     125c <main+0x10c>
lea    -0x1(%r14),%eax
add    $0x1,%r14d
cmp    $0x31,%eax
jb     11d0 <main+0x80>
jmp    125c <main+0x10c>
lea    0xdda(%rip),%rdi
call   1030 <puts@plt>
lea    0xdca(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    125c <main+0x10c>
lea    0xdbb(%rip),%rdi
call   1030 <puts@plt>
lea    0xdae(%rip),%rdi
xor    %eax,%eax
call   1050 <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 = [3 x i8] c"1\0A\00"
@.str.2 = [3 x i8] c"0\0A\00"
@.str.3 = [3 x i8] c"50\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i32]
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%6 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 0
store i32* %6, i32** %4
store i32 0, i32* %5
br label %7
7: ; preds = %19, %0
%8 = load i32, i32* %5
%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* %5
%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* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %7
22: ; preds = %17
br label %23
23: ; preds = %60, %22
%24 = load i32*, i32** %4
%25 = load i32, i32* %24
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %23
%28 = load i32, i32* %3
%29 = icmp slt i32 %28, 50
br label %30
30: ; preds = %27, %23
%31 = phi i1 [ false, %23 ], [ %29, %27 ]
br i1 %31, label %32, label %63
32: ; preds = %30
%33 = load i32*, i32** %4
%34 = call i32* @hop(i32* %33)
store i32* %34, i32** %4
%35 = load i32*, i32** %4
%36 = load i32, i32* %35
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %43
38: ; preds = %32
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 1
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %41)
br label %43
43: ; preds = %38, %32
%44 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 0
%45 = load i32, i32* %5
%46 = load i32*, i32** %4
%47 = call i64 @is_in_bound(i32* %44, i32 %45, i32* %46)
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %54
49: ; preds = %43
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%51 = load i32, i32* %3
%52 = add nsw i32 %51, 1
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %52)
br label %63
54: ; preds = %43
%55 = load i32, i32* %3
%56 = icmp eq i32 %55, 49
br i1 %56, label %57, label %60
57: ; preds = %54
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %60
60: ; preds = %57, %54
%61 = load i32, i32* %3
%62 = add nsw i32 %61, 1
store i32 %62, i32* %3
br label %23
63: ; preds = %49, %30
ret i32 0
}

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