#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 step, size;
  int array[50];
  int *step_hop = array;
  for (size = 0; scanf("%d", &array[size]) != EOF; size++)
    ;
  for (step = 1; step < 50; step++) {
    step_hop = hop(step_hop);
    if (*step_hop == 0) {
      printf("1\n%d", step);
      break;
    }
    if (!is_in_bound(array, size, step_hop)) {
      printf("0\n%d", step);
      break;
    }
  }
  if (step == 49) {
    printf("0\n50");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe0(%rbp),%rax
mov    %rax,-0xe8(%rbp)
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
lea    -0xe0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe87(%rip),%rdi
call   1050 <scanf@plt>
mov    0x2e5c(%rip),%rcx
cmp    (%rcx),%rax
je     11a8 <main+0x68>
jmp    119a <main+0x5a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1167 <main+0x27>
movl   $0x1,-0x8(%rbp)
cmpl   $0x32,-0x8(%rbp)
jge    123a <main+0xfa>
mov    -0xe8(%rbp),%rdi
call   1030 <hop@plt>
mov    %rax,-0xe8(%rbp)
mov    -0xe8(%rbp),%rax
cmpl   $0x0,(%rax)
jne    11f2 <main+0xb2>
mov    -0x8(%rbp),%esi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    123a <main+0xfa>
lea    -0xe0(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0xe8(%rbp),%rdx
call   1060 <is_in_bound@plt>
cmp    $0x0,%eax
jne    1227 <main+0xe7>
mov    -0x8(%rbp),%esi
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    123a <main+0xfa>
jmp    122c <main+0xec>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11af <main+0x6f>
cmpl   $0x31,-0x8(%rbp)
jne    1252 <main+0x112>
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%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    $0xffffffff,%ebx
mov    %rsp,%rbp
lea    0xea7(%rip),%r14
mov    0x2e81(%rip),%r15
nopw   0x0(%rax,%rax,1)
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,%r12d
mov    %rsp,%r15
lea    0xe69(%rip),%r14
lea    0xe67(%rip),%r13
mov    %r15,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1030 <hop@plt>
cmpl   $0x0,(%rax)
je     11e0 <main+0xa0>
mov    %rax,%rbp
mov    %r15,%rdi
mov    %ebx,%esi
mov    %rax,%rdx
call   1060 <is_in_bound@plt>
test   %eax,%eax
je     11dd <main+0x9d>
add    $0x1,%r12d
cmp    $0x32,%r12d
jne    11b0 <main+0x70>
jmp    1201 <main+0xc1>
mov    %r13,%r14
mov    %r14,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x31,%r12d
jne    1201 <main+0xc1>
lea    0xe10(%rip),%rdi
xor    %eax,%eax
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 = [5 x i8] c"1\0A%d\00"
@.str.2 = [5 x i8] c"0\0A%d\00"
@.str.3 = [5 x i8] c"0\0A50\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [50 x i32]
%5 = alloca i32*
store i32 0, i32* %1
%6 = getelementptr inbounds [50 x i32], [50 x i32]* %4, i64 0, i64 0
store i32* %6, i32** %5
store i32 0, i32* %3
br label %7
7: ; preds = %15, %0
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [50 x i32], [50 x i32]* %4, 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* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %7
18: ; preds = %7
store i32 1, i32* %2
br label %19
19: ; preds = %41, %18
%20 = load i32, i32* %2
%21 = icmp slt i32 %20, 50
br i1 %21, label %22, label %44
22: ; preds = %19
%23 = load i32*, i32** %5
%24 = call i32* @hop(i32* %23)
store i32* %24, i32** %5
%25 = load i32*, i32** %5
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %22
%29 = load i32, i32* %2
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %29)
br label %44
31: ; preds = %22
%32 = getelementptr inbounds [50 x i32], [50 x i32]* %4, i64 0, i64 0
%33 = load i32, i32* %3
%34 = load i32*, i32** %5
%35 = call i32 @is_in_bound(i32* %32, i32 %33, i32* %34)
%36 = icmp ne i32 %35, 0
br i1 %36, label %40, label %37
37: ; preds = %31
%38 = load i32, i32* %2
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %38)
br label %44
40: ; preds = %31
br label %41
41: ; preds = %40
%42 = load i32, i32* %2
%43 = add nsw i32 %42, 1
store i32 %43, i32* %2
br label %19
44: ; preds = %37, %28, %19
%45 = load i32, i32* %2
%46 = icmp eq i32 %45, 49
br i1 %46, label %47, label %49
47: ; preds = %44
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %49
49: ; preds = %47, %44
%50 = load i32, i32* %1
ret i32 %50
}

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