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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xdc(%rbp)
movl   $0x0,-0xe0(%rbp)
movl   $0x0,-0xe4(%rbp)
movslq -0xe4(%rbp),%rax
lea    -0xd0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe77(%rip),%rdi
call   1050 <scanf@plt>
mov    %rax,%rcx
xor    %eax,%eax
mov    0x2e4b(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0xe5(%rbp)
je     11bc <main+0x7c>
cmpl   $0x32,-0xe4(%rbp)
setl   %al
mov    %al,-0xe5(%rbp)
mov    -0xe5(%rbp),%al
test   $0x1,%al
jne    11cf <main+0x8f>
jmp    11e3 <main+0xa3>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    1170 <main+0x30>
mov    -0xe4(%rbp),%eax
mov    %eax,-0xdc(%rbp)
lea    -0xd0(%rbp),%rax
mov    %rax,-0xd8(%rbp)
movl   $0x0,-0xe4(%rbp)
lea    -0xd0(%rbp),%rdi
mov    -0xdc(%rbp),%esi
mov    -0xd8(%rbp),%rdx
call   1060 <is_in_bound@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0xe6(%rbp)
je     1245 <main+0x105>
cmpl   $0x32,-0xe4(%rbp)
setl   %al
mov    %al,-0xe6(%rbp)
mov    -0xe6(%rbp),%al
test   $0x1,%al
jne    1258 <main+0x118>
jmp    129e <main+0x15e>
mov    -0xd8(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1277 <main+0x137>
movl   $0x1,-0xe0(%rbp)
jmp    129e <main+0x15e>
mov    -0xd8(%rbp),%rdi
call   1030 <hop@plt>
mov    %rax,-0xd8(%rbp)
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    1207 <main+0xc7>
mov    -0xe0(%rbp),%esi
mov    -0xe4(%rbp),%edx
lea    0xd4f(%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   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %rsp,%rbp
xor    %ebx,%ebx
lea    0xea6(%rip),%r14
mov    0x2e84(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
lea    0x1(%rbx),%r13
cmp    (%r15),%rax
je     1191 <main+0x51>
add    $0x4,%rbp
cmp    $0x32,%rbx
mov    %r13,%rbx
jb     1170 <main+0x30>
add    $0xffffffffffffffff,%r13
mov    %rsp,%r14
mov    %r14,%rdi
mov    %r13d,%esi
mov    %r14,%rdx
call   1060 <is_in_bound@plt>
test   %rax,%rax
je     11f6 <main+0xb6>
xor    %r12d,%r12d
mov    %r14,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpl   $0x0,0x0(%rbp)
je     11fd <main+0xbd>
mov    %rbp,%rdi
call   1030 <hop@plt>
mov    %rax,%rbp
lea    0x1(%r12),%r15d
mov    %r14,%rdi
mov    %r13d,%esi
mov    %rax,%rdx
call   1060 <is_in_bound@plt>
xor    %esi,%esi
test   %rax,%rax
je     1205 <main+0xc5>
cmp    $0x31,%r12d
mov    %r15d,%r12d
jb     11c0 <main+0x80>
jmp    1205 <main+0xc5>
xor    %r15d,%r15d
xor    %esi,%esi
jmp    1205 <main+0xc5>
mov    $0x1,%esi
mov    %r12d,%r15d
lea    0xdf4(%rip),%rdi
mov    %r15d,%edx
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 = [6 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* %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %19, %0
%8 = load i32, i32* %6
%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* %6
%16 = icmp slt i32 %15, 50
br label %17
17: ; preds = %14, %7
%18 = phi i1 [ false, %7 ], [ %16, %14 ]
br i1 %18, label %19, label %22
19: ; preds = %17
%20 = load i32, i32* %6
%21 = add nsw i32 %20, 1
store i32 %21, i32* %6
br label %7
22: ; preds = %17
%23 = load i32, i32* %6
store i32 %23, i32* %4
%24 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 0
store i32* %24, i32** %3
store i32 0, i32* %6
br label %25
25: ; preds = %41, %22
%26 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 0
%27 = load i32, i32* %4
%28 = load i32*, i32** %3
%29 = call i64 @is_in_bound(i32* %26, i32 %27, i32* %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %25
%32 = load i32, i32* %6
%33 = icmp slt i32 %32, 50
br label %34
34: ; preds = %31, %25
%35 = phi i1 [ false, %25 ], [ %33, %31 ]
br i1 %35, label %36, label %46
36: ; preds = %34
%37 = load i32*, i32** %3
%38 = load i32, i32* %37
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %41
40: ; preds = %36
store i32 1, i32* %5
br label %46
41: ; preds = %36
%42 = load i32*, i32** %3
%43 = call i32* @hop(i32* %42)
store i32* %43, i32** %3
%44 = load i32, i32* %6
%45 = add nsw i32 %44, 1
store i32 %45, i32* %6
br label %25
46: ; preds = %40, %34
%47 = load i32, i32* %5
%48 = load i32, i32* %6
%49 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %47, i32 %48)
ret i32 0
}

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