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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1a4(%rbp)
lea    -0x1a0(%rbp),%rax
mov    %rax,-0x1b0(%rbp)
movl   $0x0,-0x1b4(%rbp)
movslq -0x1a4(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe72(%rip),%rdi
call   1050 <scanf@plt>
mov    0x2e4c(%rip),%rcx
cmp    (%rcx),%rax
je     11b9 <main+0x79>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    1174 <main+0x34>
jmp    11be <main+0x7e>
mov    -0x1b0(%rbp),%rdi
call   1030 <hop@plt>
mov    %rax,-0x1b0(%rbp)
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b4(%rbp)
lea    -0x1a0(%rbp),%rdi
mov    -0x1a4(%rbp),%esi
mov    -0x1b0(%rbp),%rdx
call   1060 <is_in_bound@plt>
cmp    $0x0,%eax
jne    1219 <main+0xd9>
mov    -0x1b4(%rbp),%esi
lea    0xdf1(%rip),%rdi
call   1040 <printf@plt>
jmp    1273 <main+0x133>
mov    -0x1b0(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1240 <main+0x100>
mov    -0x1b4(%rbp),%esi
lea    0xdcf(%rip),%rdi
call   1040 <printf@plt>
jmp    1273 <main+0x133>
cmpl   $0x32,-0x1b4(%rbp)
jne    1264 <main+0x124>
mov    -0x1b4(%rbp),%esi
lea    0xda6(%rip),%rdi
call   1040 <printf@plt>
jmp    1273 <main+0x133>
jmp    1269 <main+0x129>
jmp    126e <main+0x12e>
jmp    11be <main+0x7e>
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,%ebx
mov    %rsp,%rbp
lea    0xea6(%rip),%r14
mov    0x2e85(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
add    $0x1,%ebx
add    $0x4,%rbp
cmp    (%r15),%rax
jne    1170 <main+0x30>
mov    $0x1,%r15d
mov    %rsp,%r14
mov    %r14,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbp,%rdi
call   1030 <hop@plt>
mov    %rax,%rbp
mov    %r14,%rdi
mov    %ebx,%esi
mov    %rax,%rdx
call   1060 <is_in_bound@plt>
test   %eax,%eax
je     11da <main+0x9a>
cmpl   $0x0,0x0(%rbp)
je     11e3 <main+0xa3>
add    $0x1,%r15d
cmp    $0x33,%r15d
jne    11a0 <main+0x60>
lea    0xe2d(%rip),%rdi
mov    $0x32,%esi
jmp    11ed <main+0xad>
lea    0xe1f(%rip),%rdi
jmp    11ea <main+0xaa>
lea    0xe1b(%rip),%rdi
mov    %r15d,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x198,%rsp
pop    %rbx
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"0\0A%d\00"
@.str.2 = [5 x i8] c"1\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
%6 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
store i32* %6, i32** %4
store i32 0, i32* %5
br label %7
7: ; preds = %14, %0
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [100 x i32], [100 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 %17
14: ; preds = %7
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %7
17: ; preds = %7
br label %18
18: ; preds = %17, %46
%19 = load i32*, i32** %4
%20 = call i32* @hop(i32* %19)
store i32* %20, i32** %4
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
%23 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%24 = load i32, i32* %3
%25 = load i32*, i32** %4
%26 = call i32 @is_in_bound(i32* %23, i32 %24, i32* %25)
%27 = icmp ne i32 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %18
%29 = load i32, i32* %5
%30 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %29)
br label %47
31: ; preds = %18
%32 = load i32*, i32** %4
%33 = load i32, i32* %32
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %31
%36 = load i32, i32* %5
%37 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %36)
br label %47
38: ; preds = %31
%39 = load i32, i32* %5
%40 = icmp eq i32 %39, 50
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* %5
%43 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %42)
br label %47
44: ; preds = %38
br label %45
45: ; preds = %44
br label %46
46: ; preds = %45
br label %18
47: ; preds = %41, %35, %28
ret i32 0
}

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