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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xd0(%rbp),%rax
mov    %rax,-0xd8(%rbp)
movl   $0x0,-0xdc(%rbp)
movslq -0xdc(%rbp),%rax
lea    -0xd0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe7a(%rip),%rdi
call   1050 <scanf@plt>
mov    %rax,%rcx
mov    $0x1,%al
mov    0x2e51(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0xe1(%rbp)
jne    11b6 <main+0x76>
cmpl   $0x32,-0xdc(%rbp)
setl   %al
mov    %al,-0xe1(%rbp)
mov    -0xe1(%rbp),%al
test   $0x1,%al
jne    11c9 <main+0x89>
jmp    11dd <main+0x9d>
mov    -0xdc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xdc(%rbp)
jmp    116a <main+0x2a>
movl   $0x1,-0xe0(%rbp)
mov    $0x1,%al
cmpl   $0x32,-0xe0(%rbp)
mov    %al,-0xe2(%rbp)
jle    120f <main+0xcf>
mov    -0xd8(%rbp),%rax
cmpl   $0x0,(%rax)
sete   %al
mov    %al,-0xe2(%rbp)
mov    -0xe2(%rbp),%al
test   $0x1,%al
jne    1222 <main+0xe2>
jmp    130d <main+0x1cd>
mov    -0xd8(%rbp),%rdi
call   1030 <hop@plt>
mov    %rax,-0xd8(%rbp)
mov    -0xd8(%rbp),%rax
cmpl   $0x0,(%rax)
jne    126c <main+0x12c>
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xe0(%rbp),%esi
lea    0xda0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    130d <main+0x1cd>
lea    -0xd0(%rbp),%rdi
mov    -0xdc(%rbp),%esi
mov    -0xd8(%rbp),%rdx
call   1060 <is_in_bound@plt>
cmp    $0x0,%eax
jne    12b5 <main+0x175>
lea    0xd71(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xe0(%rbp),%esi
lea    0xd57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    130d <main+0x1cd>
cmpl   $0x32,-0xe0(%rbp)
jne    12f4 <main+0x1b4>
mov    -0xd8(%rbp),%rax
cmpl   $0x0,(%rax)
je     12f4 <main+0x1b4>
lea    0xd2d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xe0(%rbp),%esi
lea    0xd13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12f9 <main+0x1b9>
mov    -0xe0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe0(%rbp)
jmp    11e7 <main+0xa7>
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    %r13d,%r13d
lea    0xe92(%rip),%r14
mov    0x2e73(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rbx
mov    %r14,%rdi
mov    %rbp,%rsi
call   1060 <scanf@plt>
add    $0x1,%r13
add    $0x4,%rbp
cmp    (%r15),%rax
jne    1180 <main+0x30>
cmp    $0x32,%rbx
jb     1180 <main+0x30>
mov    %rsp,%r14
add    $0xffffffffffffffff,%r13
mov    $0x1,%ebp
lea    0xe4f(%rip),%r12
lea    0xe45(%rip),%rbx
mov    %r14,%r15
jmp    11c3 <main+0x73>
add    $0x1,%ebp
cmp    $0x33,%ebp
jb     11ce <main+0x7e>
cmpl   $0x0,(%r15)
jne    1235 <main+0xe5>
mov    %r15,%rdi
call   1040 <hop@plt>
cmpl   $0x0,(%rax)
je     1214 <main+0xc4>
mov    %rax,%r15
mov    %r14,%rdi
mov    %r13d,%esi
mov    %rax,%rdx
call   1070 <is_in_bound@plt>
test   %eax,%eax
je     121d <main+0xcd>
cmp    $0x32,%ebp
jne    11c0 <main+0x70>
cmpl   $0x0,(%r15)
je     11c0 <main+0x70>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x32,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11c0 <main+0x70>
lea    0xdea(%rip),%rdi
jmp    1220 <main+0xd0>
mov    %r12,%rdi
call   1030 <puts@plt>
lea    0xdd4(%rip),%rdi
mov    %ebp,%esi
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"
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
%6 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 0
store i32* %6, i32** %3
store i32 0, i32* %4
br label %7
7: ; preds = %19, %0
%8 = load i32, i32* %4
%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* %4
%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* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %7
22: ; preds = %17
store i32 1, i32* %5
br label %23
23: ; preds = %64, %22
%24 = load i32, i32* %5
%25 = icmp sle i32 %24, 50
br i1 %25, label %30, label %26
26: ; preds = %23
%27 = load i32*, i32** %3
%28 = load i32, i32* %27
%29 = icmp eq i32 %28, 0
br label %30
30: ; preds = %26, %23
%31 = phi i1 [ true, %23 ], [ %29, %26 ]
br i1 %31, label %32, label %67
32: ; preds = %30
%33 = load i32*, i32** %3
%34 = call i32* @hop(i32* %33)
store i32* %34, i32** %3
%35 = load i32*, i32** %3
%36 = load i32, i32* %35
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %42
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* %5
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %40)
br label %67
42: ; preds = %32
%43 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 0
%44 = load i32, i32* %4
%45 = load i32*, i32** %3
%46 = call i32 @is_in_bound(i32* %43, i32 %44, i32* %45)
%47 = icmp ne i32 %46, 0
br i1 %47, label %52, label %48
48: ; preds = %42
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%50 = load i32, i32* %5
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %50)
br label %67
52: ; preds = %42
%53 = load i32, i32* %5
%54 = icmp eq i32 %53, 50
br i1 %54, label %55, label %63
55: ; preds = %52
%56 = load i32*, i32** %3
%57 = load i32, i32* %56
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %63
59: ; preds = %55
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%61 = load i32, i32* %5
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %61)
br label %63
63: ; preds = %59, %55, %52
br label %64
64: ; preds = %63
%65 = load i32, i32* %5
%66 = add nsw i32 %65, 1
store i32 %66, i32* %5
br label %23
67: ; preds = %48, %38, %30
ret i32 0
}

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