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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xd4(%rbp)
movl   $0x0,-0xdc(%rbp)
movslq -0xd4(%rbp),%rax
lea    -0xd0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe82(%rip),%rdi
call   1050 <scanf@plt>
mov    0x2e5a(%rip),%rcx
cmp    (%rcx),%rax
je     11ab <main+0x6b>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    1166 <main+0x26>
mov    -0xd4(%rbp),%eax
mov    %eax,-0xd8(%rbp)
movl   $0x0,-0xd4(%rbp)
lea    -0xd0(%rbp),%rax
mov    %rax,-0xe8(%rbp)
lea    -0xd0(%rbp),%rdi
mov    -0xd8(%rbp),%esi
mov    -0xe8(%rbp),%rdx
call   1060 <is_in_bound@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
mov    %al,-0xe9(%rbp)
jne    120b <main+0xcb>
cmpl   $0x32,-0xd4(%rbp)
setl   %al
mov    %al,-0xe9(%rbp)
mov    -0xe9(%rbp),%al
test   $0x1,%al
jne    121e <main+0xde>
jmp    1264 <main+0x124>
mov    -0xe8(%rbp),%rax
cmpl   $0x0,(%rax)
jne    123d <main+0xfd>
movl   $0x1,-0xdc(%rbp)
jmp    1264 <main+0x124>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
mov    -0xe8(%rbp),%rdi
call   1030 <hop@plt>
mov    %rax,-0xe8(%rbp)
jmp    11cf <main+0x8f>
mov    -0xdc(%rbp),%esi
mov    -0xd4(%rbp),%edx
lea    0xd89(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xd0,%rsp
mov    $0xffffffff,%ebx
mov    %rsp,%rbp
lea    0xea6(%rip),%r14
mov    0x2e83(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
add    $0x1,%ebx
add    $0x4,%rbp
cmp    (%r15),%rax
jne    1170 <main+0x30>
mov    %rsp,%r14
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
call   1060 <is_in_bound@plt>
xor    %r15d,%r15d
mov    $0x0,%esi
cmp    $0x1,%eax
jne    11ed <main+0xad>
xor    %r12d,%r12d
mov    %r14,%rbp
nopw   0x0(%rax,%rax,1)
cmpl   $0x0,0x0(%rbp)
je     11e5 <main+0xa5>
lea    0x1(%r12),%r15d
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>
xor    %esi,%esi
cmp    $0x1,%eax
jne    11ed <main+0xad>
cmp    $0x31,%r12d
mov    %r15d,%r12d
jb     11b0 <main+0x70>
jmp    11ed <main+0xad>
mov    $0x1,%esi
mov    %r12d,%r15d
lea    0xe0c(%rip),%rdi
mov    %r15d,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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